mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-31 23:41:25 +00:00
client: add support foodstep based on floor material
Based on: * https://github.com/Paril/q2pro.git
This commit is contained in:
parent
05499dd331
commit
af7b8f6c61
3 changed files with 48 additions and 2 deletions
|
@ -2064,8 +2064,52 @@ CL_EntityEvent(entity_state_t *ent)
|
|||
|
||||
if (cl_footsteps->value)
|
||||
{
|
||||
vec3_t mins = {0, 0, 0}, maxs = {0, 0, 0}, dir = { 0, 0, -1000000 };
|
||||
struct sfx_s *sfx = NULL;
|
||||
trace_t trace;
|
||||
trace = CM_BoxTrace(ent->origin, dir, mins, maxs, 0, MASK_DEADSOLID);
|
||||
|
||||
/* ladder does not have separate material */
|
||||
if ((trace.contents & CONTENTS_LADDER))
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
int step;
|
||||
|
||||
/* material has sometime 5 steps versions */
|
||||
step = randk() % 5;
|
||||
|
||||
Com_sprintf(name, sizeof(name), "player/ladder%i.wav",
|
||||
step + 1);
|
||||
|
||||
sfx = S_RegisterSound(name);
|
||||
}
|
||||
|
||||
/* step sound based onb material */
|
||||
if (!sfx && trace.surface->material[0])
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
int step;
|
||||
|
||||
/* material has sometime 5 steps versions */
|
||||
step = randk() % 5;
|
||||
|
||||
Com_sprintf(name, sizeof(name), "player/%s%i.wav",
|
||||
trace.surface->material, step + 1);
|
||||
|
||||
sfx = S_RegisterSound(name);
|
||||
}
|
||||
|
||||
/* no material steps sound found */
|
||||
if (!sfx)
|
||||
{
|
||||
int step;
|
||||
|
||||
step = randk() & 3;
|
||||
sfx = cl_sfx_footsteps[step];
|
||||
}
|
||||
|
||||
S_StartSound(NULL, ent->number, CHAN_BODY,
|
||||
cl_sfx_footsteps[randk() & 3], 1, ATTN_NORM, 0);
|
||||
sfx, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -119,7 +119,6 @@ void
|
|||
CL_RegisterTEntSounds(void)
|
||||
{
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
|
||||
cl_sfx_ric1 = S_RegisterSound("world/ric1.wav");
|
||||
cl_sfx_ric2 = S_RegisterSound("world/ric2.wav");
|
||||
|
@ -139,6 +138,8 @@ CL_RegisterTEntSounds(void)
|
|||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
|
||||
Com_sprintf(name, sizeof(name), "player/step%i.wav", i + 1);
|
||||
cl_sfx_footsteps[i] = S_RegisterSound(name);
|
||||
}
|
||||
|
|
|
@ -662,6 +662,7 @@ AL_Spatialize(channel_t *ch)
|
|||
{
|
||||
AL_ApplyReverb();
|
||||
}
|
||||
|
||||
/* Forsed reverb effect */
|
||||
else if (s_reverb_preset->value >= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue