I'm wondering why this has happened as I have not edited this function whatsoever and there's no other reports of such behaviour. Functions such as viewpunch still work properly however.
My current UTIL_ScreenShake function:
- Code: Select all
const float MAX_SHAKE_AMPLITUDE = 16.0f;
void UTIL_ScreenShake( const Vector ¢er, float amplitude, float frequency, float duration, float radius, ShakeCommand_t eCommand, bool bAirShake )
{
int i;
float localAmplitude;
if ( amplitude > MAX_SHAKE_AMPLITUDE )
{
amplitude = MAX_SHAKE_AMPLITUDE;
}
for ( i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *pPlayer = UTIL_PlayerByIndex( i );
//
// Only start shakes for players that are on the ground unless doing an air shake.
//
if ( !pPlayer || (!bAirShake && (eCommand == SHAKE_START) && !(pPlayer->GetFlags() & FL_ONGROUND)) )
{
continue;
}
localAmplitude = ComputeShakeAmplitude( center, pPlayer->WorldSpaceCenter(), amplitude, radius );
// This happens if the player is outside the radius, in which case we should ignore
// all commands
if (localAmplitude < 0)
continue;
TransmitShakeEvent( (CBasePlayer *)pPlayer, localAmplitude, frequency, duration, eCommand );
}
}