Fixed potential crash caused by infinite recursion in client footstep code.

This commit is contained in:
Knightmare66 2020-02-09 03:04:16 -05:00
parent c6c7e79b5a
commit 2efcb5a672
2 changed files with 15 additions and 8 deletions

View file

@ -111,7 +111,7 @@ Since this is a replacement for plain Jane EV_FOOTSTEP, we already know
the player is definitely on the ground when this is called. the player is definitely on the ground when this is called.
=============== ===============
*/ */
void CL_FootSteps (entity_state_t *ent, qboolean loud) void CL_FootSteps (entity_state_t *ent, qboolean loud, qboolean recursed)
{ {
trace_t tr; trace_t tr;
vec3_t end; vec3_t end;
@ -174,20 +174,25 @@ void CL_FootSteps (entity_state_t *ent, qboolean loud)
volume = 1.0; volume = 1.0;
break; break;
default: default:
if (cl_footstep_override->value && num_texsurfs) if (cl_footstep_override->value && num_texsurfs && !recursed)
{ {
int i; int i;
for (i=0; i<num_texsurfs; i++) for (i=0; i<num_texsurfs; i++)
if (strstr(tr.surface->name,tex_surf[i].tex) && tex_surf[i].step_id > 0) if (strstr(tr.surface->name,tex_surf[i].tex) && tex_surf[i].step_id > 0)
{ {
tr.surface->flags &= ~SURF_STEPMASK;
tr.surface->flags |= (SURF_METAL << (tex_surf[i].step_id - 1)); tr.surface->flags |= (SURF_METAL << (tex_surf[i].step_id - 1));
CL_FootSteps (ent, loud); // start over CL_FootSteps (ent, loud, true); // start over
return; return;
} }
} }
tr.surface->flags |= SURF_STANDARD; // tr.surface->flags &= ~SURF_STEPMASK;
CL_FootSteps (ent, loud); // start over // tr.surface->flags |= SURF_STANDARD;
return; // CL_FootSteps (ent, loud, true); // start over
// return;
stepsound = clMedia.sfx_footsteps[r];
volume = 1.0;
break;
} }
if (loud) if (loud)
@ -227,11 +232,11 @@ void CL_EntityEvent (entity_state_t *ent)
if (cl_footsteps->value) if (cl_footsteps->value)
//Knightmare- Lazarus footsteps //Knightmare- Lazarus footsteps
//S_StartSound (NULL, ent->number, CHAN_BODY, clMedia.sfx_footsteps[rand()&3], 1, ATTN_NORM, 0); //S_StartSound (NULL, ent->number, CHAN_BODY, clMedia.sfx_footsteps[rand()&3], 1, ATTN_NORM, 0);
CL_FootSteps (ent, false); CL_FootSteps (ent, false, false);
break; break;
case EV_LOUDSTEP: case EV_LOUDSTEP:
if (cl_footsteps->value) if (cl_footsteps->value)
CL_FootSteps (ent, true); CL_FootSteps (ent, true, false);
break; break;
//end Knightmare //end Knightmare
case EV_FALLSHORT: case EV_FALLSHORT:

View file

@ -32,6 +32,8 @@ Changes as of v0.20 update 8:
- Fixed crash when rapidly pressing the Esc key during a map load. - Fixed crash when rapidly pressing the Esc key during a map load.
- Fixed potential crash caused by infinite recursion in client footstep code.
- Fixed fatal error when too many alias models are loaded (such as many unique player models in a multiplayer game). - Fixed fatal error when too many alias models are loaded (such as many unique player models in a multiplayer game).
- Fixed light blooms killing performance if texture compression is enabled. - Fixed light blooms killing performance if texture compression is enabled.