Skip to content

Commit

Permalink
Floor taken damage for player instead casting to int. Avoid casting i…
Browse files Browse the repository at this point in the history
…ssues (#505)
  • Loading branch information
FreeSlave authored Jan 3, 2025
1 parent 75b38fc commit e530099
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl

// this cast to INT is critical!!! If a player ends up with 0.5 health, the engine will get that
// as an int (zero) and think the player is dead! (this will incite a clientside screentilt, etc)
fTookDamage = CBaseMonster::TakeDamage( pevInflictor, pevAttacker, (int)flDamage, bitsDamageType );
fTookDamage = CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage >= 0.0f ? floor(flDamage) : ceil(flDamage), bitsDamageType );

// reset damage time countdown for each type of time based damage player just sustained
{
Expand Down

0 comments on commit e530099

Please sign in to comment.