2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 18:05:23 +01:00

server: fix monster yaw speed (#137)

This makes the yaw speed for all monsters (scientists, headcrabs, etc.) framerate independent.

Fix by Solokiller with mikela-valve's adjustments:
https://github.com/ValveSoftware/halflife/issues/2458
This commit is contained in:
Logan 2020-10-10 13:06:04 -04:00 committed by GitHub
parent dbd9b1c698
commit 4be53d8527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -328,5 +328,9 @@ public:
BOOL CineCleanup(); BOOL CineCleanup();
CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item. CBaseEntity* DropItem( const char *pszItemName, const Vector &vecPos, const Vector &vecAng );// drop an item.
#ifdef MONSTER_YAWSPEED_FIX
float m_flLastYawTime;
#endif
}; };
#endif // BASEMONSTER_H #endif // BASEMONSTER_H

View File

@ -2022,6 +2022,10 @@ void CBaseMonster::MonsterInit( void )
SetThink( &CBaseMonster::MonsterInitThink ); SetThink( &CBaseMonster::MonsterInitThink );
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
SetUse( &CBaseMonster::MonsterUse ); SetUse( &CBaseMonster::MonsterUse );
#ifdef MONSTER_YAWSPEED_FIX
m_flLastYawTime = gpGlobals->time;
#endif
} }
//========================================================= //=========================================================
@ -2504,7 +2508,15 @@ float CBaseMonster::ChangeYaw( int yawSpeed )
ideal = pev->ideal_yaw; ideal = pev->ideal_yaw;
if( current != ideal ) if( current != ideal )
{ {
#ifdef MONSTER_YAWSPEED_FIX
float delta = gpGlobals->time - m_flLastYawTime;
if( delta > 0.25 )
delta = 0.25;
speed = (float)yawSpeed * delta * 2;
#else
speed = (float)yawSpeed * gpGlobals->frametime * 10; speed = (float)yawSpeed * gpGlobals->frametime * 10;
#endif
move = ideal - current; move = ideal - current;
if( ideal > current ) if( ideal > current )
@ -2548,6 +2560,10 @@ float CBaseMonster::ChangeYaw( int yawSpeed )
else else
move = 0; move = 0;
#ifdef MONSTER_YAWSPEED_FIX
m_flLastYawTime = gpGlobals->time;
#endif
return move; return move;
} }

View File

@ -275,6 +275,7 @@ def configure(conf):
conf.define('CROWBAR_DELAY_FIX', False) conf.define('CROWBAR_DELAY_FIX', False)
conf.define('CROWBAR_FIX_RAPID_CROWBAR', False) conf.define('CROWBAR_FIX_RAPID_CROWBAR', False)
conf.define('GAUSS_OVERCHARGE_FIX', False) conf.define('GAUSS_OVERCHARGE_FIX', False)
conf.define('MONSTER_YAWSPEED_FIX', False)
if conf.env.DEST_OS == 'android' or conf.options.ENABLE_MOD_HACKS: if conf.env.DEST_OS == 'android' or conf.options.ENABLE_MOD_HACKS:
conf.define('MOBILE_HACKS', '1') conf.define('MOBILE_HACKS', '1')