From ae9a248e9ea7505a63e6fd62d104771988c1fcdc Mon Sep 17 00:00:00 2001 From: Yamagi Date: Tue, 2 Mar 2021 15:08:23 +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`, cheat protected to `1`. Closes #666. --- doc/040_cvarlist.md | 6 ++++++ src/client/cl_main.c | 1 + src/game/g_main.c | 1 + src/game/header/local.h | 1 + src/game/player/view.c | 12 +++++++++++- src/game/savegame/savegame.c | 1 + 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index d84a1c6d..717efc5d 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -138,6 +138,12 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` disable it again before playing Ground Zero maps in co-op. By default this cvar is disabled (set to 0). +* **g_footsteps**: If set to `1` (the default) footstep sounds are + generated when the player faster than 255. This is the behaviour of + Vanilla Quake II. If set to `2` footestep sound always generated. If + set to `0` footstep sounds are never generated. Cheat protected to + `1`. + * **g_disruptor (Ground Zero only)**: This boolean cvar controls the availability of the Disruptor weapon to players. The Disruptor is a weapon that was cut from Ground Zero during development but all diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 0a53009b..a548ce8a 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -666,6 +666,7 @@ cheatvar_t cheatvars[] = { {"gl_lightmap", "0"}, {"gl_saturatelighting", "0"}, {"cl_kickangles", "1"}, + {"g_footsteps", "1"}, {NULL, NULL} }; diff --git a/src/game/g_main.c b/src/game/g_main.c index 01b33633..51448bdf 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -54,6 +54,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/game/header/local.h b/src/game/header/local.h index 6f7547cb..6c53e4c3 100644 --- a/src/game/header/local.h +++ b/src/game/header/local.h @@ -519,6 +519,7 @@ extern cvar_t *spectator_password; extern cvar_t *needpass; extern cvar_t *g_select_empty; extern cvar_t *dedicated; +extern cvar_t *g_footsteps; extern cvar_t *filterban; diff --git a/src/game/player/view.c b/src/game/player/view.c index 4b2e52ab..c1bebea3 100644 --- a/src/game/player/view.c +++ b/src/game/player/view.c @@ -1026,7 +1026,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/game/savegame/savegame.c b/src/game/savegame/savegame.c index f15ae38c..2754b9d0 100644 --- a/src/game/savegame/savegame.c +++ b/src/game/savegame/savegame.c @@ -236,6 +236,7 @@ InitGame(void) coop_elevator_delay = gi.cvar("coop_elevator_delay", "1.0", CVAR_ARCHIVE); skill = gi.cvar("skill", "1", CVAR_LATCH); maxentities = gi.cvar("maxentities", "1024", CVAR_LATCH); + g_footsteps = gi.cvar("g_footsteps", "1", CVAR_ARCHIVE); /* change anytime vars */ dmflags = gi.cvar("dmflags", "0", CVAR_SERVERINFO);