Useless stuff, but someone may be interested...
cstrike values (should be the sames for czero)
Code:
#define PLAYER_FATAL_FALL_SPEED 980.0
#define PLAYER_MAX_SAFE_FALL_SPEED 500.0
#define PLAYER_FALL_PUNCH_THRESHHOLD 250.0 // found by arkshine
player.h (those are half life default values)
Code:
#define PLAYER_FATAL_FALL_SPEED 1024// approx 60 feet
#define PLAYER_MAX_SAFE_FALL_SPEED 580// approx 20 feet
#define DAMAGE_FOR_FALL_SPEED (float) 100 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED )// damage per unit per second.
#define PLAYER_MIN_BOUNCE_SPEED 200
#define PLAYER_FALL_PUNCH_THRESHHOLD (float)350 // won't punch player's screen/make scrape noise unless player falling at least this fast.
multiplay_gamerules.cpp
Code:
float CHalfLifeMultiplay :: FlPlayerFallDamage( CBasePlayer *pPlayer )
{
int iFallDamage = (int)falldamage.value;
switch ( iFallDamage )
{
case 1://progressive
pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED;
return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
break;
default:
case 0:// fixed
return 10;
break;
}
}
player.cpp
Code:
void CBasePlayer::PostThink()
{
// [...]
// check to see if player landed hard enough to make a sound
// falling farther than half of the maximum safe distance, but not as far a max safe distance will
// play a bootscrape sound, and no damage will be inflicted. Fallling a distance shorter than half
// of maximum safe distance will make no sound. Falling farther than max safe distance will play a
// fallpain sound, and damage will be inflicted based on how far the player fell
if ( (FBitSet(pev->flags, FL_ONGROUND)) && (pev->health > 0) && m_flFallVelocity >= PLAYER_FALL_PUNCH_THRESHHOLD )
{
// ALERT ( at_console, "%f\n", m_flFallVelocity );
if (pev->watertype == CONTENT_WATER)
{
// Did he hit the world or a non-moving entity?
// BUG - this happens all the time in water, especially when
// BUG - water has current force
// if ( !pev->groundentity || VARS(pev->groundentity)->velocity.z == 0 )
// EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_wade1.wav", 1, ATTN_NORM);
}
else if ( m_flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED )
{// after this point, we start doing damage
float flFallDamage = g_pGameRules->FlPlayerFallDamage( this );
if ( flFallDamage > pev->health )
{//splat
// note: play on item channel because we play footstep landing on body channel
EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/bodysplat.wav", 1, ATTN_NORM);
}
if ( flFallDamage > 0 )
{
TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), flFallDamage, DMG_FALL );
pev->punchangle.x = 0;
}
}
if ( IsAlive() )
{
SetAnimation( PLAYER_WALK );
}
}
if (FBitSet(pev->flags, FL_ONGROUND))
{
if (m_flFallVelocity > 64 && !g_pGameRules->IsMultiplayer())
{
CSoundEnt::InsertSound ( bits_SOUND_PLAYER, pev->origin, m_flFallVelocity, 0.2 );
// ALERT( at_console, "fall %f\n", m_flFallVelocity );
}
m_flFallVelocity = 0;
}
__________________