Skip to content

Commit

Permalink
GL_RMAIN/VX_STUFF: Stop corrupting command list when gl_no24bit toggl…
Browse files Browse the repository at this point in the history
…ed 1>0

VX_STUFF was registering commands (gl_checkmodels/gl_inferno/gl_setmode)
in a function only called when gl_no24bit was set to 0.  The commands use
Hunk_Alloc(), so the newly added commands at the front of the linked list
were being allocated in memory that was free'd on the next map change, and
the client would inevitably crash when next finding commands in the list.

Fixes bug QW-Group#73
  • Loading branch information
meag committed Jun 1, 2016
1 parent 41366b6 commit d653607
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions gl_rmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,9 @@ void R_Init(void)
#ifndef CLIENTONLY
Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
#endif
Cmd_AddCommand ("gl_checkmodels", CheckModels_f);
Cmd_AddCommand ("gl_inferno", InfernoFire_f);
Cmd_AddCommand ("gl_setmode", Amf_SetMode_f);

Cvar_SetCurrentGroup(CVAR_GROUP_EYECANDY);
Cvar_Register (&r_bloom);
Expand Down
6 changes: 5 additions & 1 deletion gl_rpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -2585,11 +2585,15 @@ void FuelRodExplosion (vec3_t org)
//VULT PARTICLES
void InfernoFire_f (void)
{

vec3_t forward, right, up;
vec3_t ang, dir;
vec3_t org;

if (!qmb_initialized) {
Com_Printf ("Particle system not initialized\n");
return;
}

ang[0] = cl.simangles[0];
ang[1] = cl.simangles[1];
ang[2] = 0;
Expand Down
10 changes: 6 additions & 4 deletions vx_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,14 @@ void Amf_SetMode_f(void)
char mode[32];
if (Cmd_Argc() != 2)
{
Com_Printf("Usage: %s [modename]\n", Cmd_Argv(0));
Com_Printf("Usage: %s [modename: newtrails or vultwah]\n", Cmd_Argv(0));
return;
}
if (!qmb_initialized) {
Com_Printf ("Particle system not initialized\n");
return;
}

snprintf(mode, sizeof (mode), "%s", Cmd_Argv(1));
if (!strcmp(mode, "newtrails"))
{
Expand Down Expand Up @@ -492,9 +497,6 @@ void InitVXStuff(void)
Cvar_Register (&amf_inferno_speed);
Cvar_Register (&amf_cutf_tesla_effect);
Cvar_ResetCurrentGroup();
Cmd_AddCommand ("gl_checkmodels", CheckModels_f);
Cmd_AddCommand ("gl_inferno", InfernoFire_f);
Cmd_AddCommand ("gl_setmode", Amf_SetMode_f);
}


2 changes: 2 additions & 0 deletions vx_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ void FireballTrailWave (vec3_t start, vec3_t end, vec3_t *trail_origin, byte col
void DrawMuzzleflash (vec3_t start, vec3_t angle, vec3_t vel);
void VXNailhit (vec3_t org, float count);
void InfernoFire_f (void);
void CheckModels_f (void);
void Amf_SetMode_f (void);
void CL_FakeExplosion (vec3_t pos);
void CL_FakeRocketLight(vec3_t org);
void FuelRodExplosion (vec3_t org);
Expand Down

0 comments on commit d653607

Please sign in to comment.