From b0303c1098fbdf796f4e87828369415272f35c2a Mon Sep 17 00:00:00 2001 From: Yamagi Date: Tue, 2 Mar 2021 15:20:43 +0100 Subject: [PATCH] Add a cvar `g_footsteps` to control the generation of footstep sound. 1: The Vanilla Quake II behaviour, footsteps are generated when the player is faster than 255. 0: Footstep sounds are never generated. 2: Footstep sounds are always generated. Defaults to `1` --- src/g_main.c | 1 + src/header/local.h | 1 + src/player/view.c | 12 +++++++++++- src/savegame/savegame.c | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/g_main.c b/src/g_main.c index 3fd865d..8ddc3c5 100644 --- a/src/g_main.c +++ b/src/g_main.c @@ -37,6 +37,7 @@ cvar_t *maxspectators; cvar_t *maxentities; cvar_t *g_select_empty; cvar_t *dedicated; +cvar_t *g_footsteps; cvar_t *filterban; diff --git a/src/header/local.h b/src/header/local.h index 14ee9f3..3564591 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -595,6 +595,7 @@ extern cvar_t *password; extern cvar_t *spectator_password; extern cvar_t *g_select_empty; extern cvar_t *dedicated; +extern cvar_t *g_footsteps; extern cvar_t *filterban; diff --git a/src/player/view.c b/src/player/view.c index 246d196..8b1755b 100644 --- a/src/player/view.c +++ b/src/player/view.c @@ -1089,7 +1089,17 @@ G_SetClientEvent(edict_t *ent) return; } - if (ent->groundentity && (xyspeed > 225)) + if (g_footsteps->value == 1) + { + if (ent->groundentity && (xyspeed > 225)) + { + if ((int)(current_client->bobtime + bobmove) != bobcycle) + { + ent->s.event = EV_FOOTSTEP; + } + } + } + if (g_footsteps->value == 2) { if ((int)(current_client->bobtime + bobmove) != bobcycle) { diff --git a/src/savegame/savegame.c b/src/savegame/savegame.c index f2f7030..3493cdc 100644 --- a/src/savegame/savegame.c +++ b/src/savegame/savegame.c @@ -219,6 +219,7 @@ InitGame(void) skill = gi.cvar ("skill", "1", CVAR_LATCH); maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH); gamerules = gi.cvar ("gamerules", "0", CVAR_LATCH); //PGM + g_footsteps = gi.cvar ("g_footsteps", "1", CVAR_LATCH); /* change anytime vars */ dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO);