View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-25-2012 , 18:32   Re: HP damage sound bug fix
Reply With Quote #13

That's not really a bug and there is nothing wrong with the sound.

This damage is specific when you fall and you do damage between 0.0 and 1.0.
The fall damage is calculated like that :

pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED; // 500
Fall Damage= pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;


with constants like :

#define PLAYER_FATAL_FALL_SPEED 980
#define PLAYER_MAX_SAFE_FALL_SPEED 500
#define DAMAGE_FOR_FALL_SPEED 100 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED )


Therefore you will get a real float value, like 0.598252.

You get pain because you have damage > 0.

And you don't get damage because when CBaseMonster::TakeDamage (where damage is applied) is called after, the damage is cast into an integer in the header.

@OT, I'm not sure this bug would appear with weapon, if so, you don't take in count the weapons ratio, but considering weapon damage starts from a hardcoding base value, I don't think it will happen after be passed into TraceAttack and TakeDamage.
__________________

Last edited by Arkshine; 02-25-2012 at 19:08.
Arkshine is offline