summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/common.c8
-rw-r--r--source/mvd_parse.c1
-rw-r--r--source/sv_game.c1
3 files changed, 10 insertions, 0 deletions
diff --git a/source/common.c b/source/common.c
index afe079f..0d632e9 100644
--- a/source/common.c
+++ b/source/common.c
@@ -505,6 +505,8 @@ typedef struct zhead_s {
static zhead_t z_chain;
+static cvar_t *z_perturb;
+
typedef struct zstatic_s {
zhead_t z;
char data[2]; /* !!make sure 'tail' field is aligned properly */
@@ -772,6 +774,11 @@ void *Z_TagMalloc( size_t size, memtag_t tag ) {
z_chain.next->prev = z;
z_chain.next = z;
+ if( z_perturb && z_perturb->integer ) {
+ memset( z + 1, z_perturb->integer, size -
+ sizeof( zhead_t ) - sizeof( uint16 ) );
+ }
+
*( uint16 * )( ( byte * )z + size - sizeof( uint16 ) ) = Z_TAIL;
s = &z_stats[tag < TAG_MAX ? tag : TAG_FREE];
@@ -1385,6 +1392,7 @@ void Qcommon_Init( char *commandLine ) {
//
// init commands and vars
//
+ z_perturb = Cvar_Get( "z_perturb", "0", 0 );
host_speeds = Cvar_Get ("host_speeds", "0", 0);
developer = Cvar_Get ("developer", "0", 0);
timescale = Cvar_Get ("timescale", "1", CVAR_CHEAT );
diff --git a/source/mvd_parse.c b/source/mvd_parse.c
index dd24697..88f5f4a 100644
--- a/source/mvd_parse.c
+++ b/source/mvd_parse.c
@@ -532,6 +532,7 @@ static void MVD_ParseSound( mvd_t *mvd, int extrabits ) {
msg = LIST_FIRST( sound_packet_t, &cl->freemsg, entry );
+ msg->cursize = 0;
msg->flags = flags;
msg->index = index;
msg->volume = volume;
diff --git a/source/sv_game.c b/source/sv_game.c
index c7b4c30..d2c4eba 100644
--- a/source/sv_game.c
+++ b/source/sv_game.c
@@ -596,6 +596,7 @@ static void PF_StartSound( edict_t *edict, int channel,
msg = LIST_FIRST( sound_packet_t, &client->freemsg, entry );
+ msg->cursize = 0; // !!! make sure this does not get Z_Free'ed
msg->flags = flags;
msg->index = soundindex;
msg->volume = volume * 255;