From 08cf0185633371bc492100add43e1b04650c6514 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Sun, 12 Jan 2020 08:05:35 +0000 Subject: [PATCH] Added cvars to change/disable the often-unwanted build-in sound effects. --- Quake/sv_main.c | 6 ++++++ Quake/sv_phys.c | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Quake/sv_main.c b/Quake/sv_main.c index 719444c3..35828e89 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -1256,6 +1256,9 @@ void SV_Init (void) extern cvar_t com_protocolname; //spike extern cvar_t net_masters[]; //spike extern cvar_t rcon_password; //spike, proquake-compatible rcon + extern cvar_t sv_sound_watersplash; //spike - making these changable is handy... + extern cvar_t sv_sound_land; //spike - and also mutable... + Cvar_RegisterVariable (&sv_maxvelocity); Cvar_RegisterVariable (&sv_gravity); @@ -1276,6 +1279,9 @@ void SV_Init (void) Cvar_RegisterVariable (&pr_checkextension); Cvar_RegisterVariable (&sv_altnoclip); //johnfitz + Cvar_RegisterVariable (&sv_sound_watersplash); //spike + Cvar_RegisterVariable (&sv_sound_land); //spike + if (isDedicated) sv_public.string = "1"; else diff --git a/Quake/sv_phys.c b/Quake/sv_phys.c index de73be71..bb6b372e 100644 --- a/Quake/sv_phys.c +++ b/Quake/sv_phys.c @@ -49,6 +49,9 @@ cvar_t sv_nostep = {"sv_nostep","0",CVAR_NONE}; cvar_t sv_freezenonclients = {"sv_freezenonclients","0",CVAR_NONE}; cvar_t sv_gameplayfix_spawnbeforethinks = {"sv_gameplayfix_spawnbeforethinks","0",CVAR_NONE}; +cvar_t sv_sound_watersplash = {"sv_sound_watersplash", "misc/h2ohit1.wav", CVAR_NONE}; +cvar_t sv_sound_land = {"sv_sound_land", "demon/dland2.wav", CVAR_NONE}; + #define MOVE_EPSILON 0.01 @@ -1085,18 +1088,18 @@ void SV_CheckWaterTransition (edict_t *ent) if (cont <= CONTENTS_WATER) { - if (ent->v.watertype == CONTENTS_EMPTY) + if (ent->v.watertype == CONTENTS_EMPTY && *sv_sound_watersplash.string) { // just crossed into water - SV_StartSound (ent, NULL, 0, "misc/h2ohit1.wav", 255, 1); + SV_StartSound (ent, NULL, 0, sv_sound_watersplash.string, 255, 1); } ent->v.watertype = cont; ent->v.waterlevel = 1; } else { - if (ent->v.watertype != CONTENTS_EMPTY) + if (ent->v.watertype != CONTENTS_EMPTY && *sv_sound_watersplash.string) { // just crossed into water - SV_StartSound (ent, NULL, 0, "misc/h2ohit1.wav", 255, 1); + SV_StartSound (ent, NULL, 0, sv_sound_watersplash.string, 255, 1); } ent->v.watertype = CONTENTS_EMPTY; ent->v.waterlevel = cont; @@ -1252,8 +1255,8 @@ void SV_Physics_Step (edict_t *ent) if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground { - if (hitsound) - SV_StartSound (ent, NULL, 0, "demon/dland2.wav", 255, 1); + if (hitsound && *sv_sound_land.string) + SV_StartSound (ent, NULL, 0, sv_sound_land.string, 255, 1); } }