Added a separate "host_pitchscale" cvar which can override host_timescale's sound pitch scaling

This commit is contained in:
Blixibon 2021-09-20 23:46:39 -05:00
parent fc93d736ee
commit e39e1e0cca

View File

@ -132,12 +132,18 @@ void Hack_FixEscapeChars( char *str )
#ifdef MAPBASE #ifdef MAPBASE
static const ConVar *pHostTimescale; static const ConVar *pHostTimescale;
static ConVar host_pitchscale( "host_pitchscale", "-1", FCVAR_REPLICATED, "If greater than 0, controls the pitch scale of sounds instead of host_timescale." );
static float GetSoundPitchScale() static float GetSoundPitchScale()
{ {
static ConVarRef sv_cheats( "sv_cheats" ); static ConVarRef sv_cheats( "sv_cheats" );
if (sv_cheats.GetBool()) if (sv_cheats.GetBool())
return pHostTimescale->GetFloat(); {
if (host_pitchscale.GetFloat() > 0.0f)
return host_pitchscale.GetFloat();
else
return pHostTimescale->GetFloat();
}
return 1.0f; return 1.0f;
} }