Clamp moving entities' sounds volume (#751)

This commit is contained in:
Juice 2022-04-11 11:32:00 +03:00 committed by GitHub
parent f050be77db
commit db76e604df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -44,6 +44,15 @@ void CBasePlatTrain::KeyValue(KeyValueData *pkvd)
else if (FStrEq(pkvd->szKeyName, "volume")) else if (FStrEq(pkvd->szKeyName, "volume"))
{ {
m_volume = Q_atof(pkvd->szValue); m_volume = Q_atof(pkvd->szValue);
#ifdef REGAMEDLL_FIXES
if (m_volume > 1.0)
m_volume = 1.0;
if (m_volume < 0.0)
m_volume = 0.0;
#endif
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else else
@ -928,6 +937,14 @@ void CFuncTrackTrain::KeyValue(KeyValueData *pkvd)
m_flVolume = Q_atoi(pkvd->szValue); m_flVolume = Q_atoi(pkvd->szValue);
m_flVolume *= 0.1f; m_flVolume *= 0.1f;
#ifdef REGAMEDLL_FIXES
if (m_flVolume > 1.0)
m_flVolume = 1.0;
if (m_flVolume < 0.0)
m_flVolume = 0.0;
#endif
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "bank")) else if (FStrEq(pkvd->szKeyName, "bank"))

View File

@ -52,6 +52,14 @@ void CFuncVehicle::KeyValue(KeyValueData *pkvd)
m_flVolume = Q_atoi(pkvd->szValue); m_flVolume = Q_atoi(pkvd->szValue);
m_flVolume *= 0.1f; m_flVolume *= 0.1f;
#ifdef REGAMEDLL_FIXES
if (m_flVolume > 1.0)
m_flVolume = 1.0;
if (m_flVolume < 0.0)
m_flVolume = 0.0;
#endif
pkvd->fHandled = TRUE; pkvd->fHandled = TRUE;
} }
else if (FStrEq(pkvd->szKeyName, "bank")) else if (FStrEq(pkvd->szKeyName, "bank"))