2121#include " extdll.h"
2222#include " util.h"
2323#include " cbase.h"
24+ #include " game.h"
2425#include " monsters.h"
2526#include " schedule.h"
2627#include " flyingmonster.h"
@@ -76,7 +77,7 @@ class CIchthyosaur : public CFlyingMonster
7677 BOOL CheckMeleeAttack1 ( float flDot, float flDist );
7778 BOOL CheckRangeAttack1 ( float flDot, float flDist );
7879
79- float ChangeYaw ( int speed );
80+ float ChangeYaw ( int yawSpeed );
8081 Activity GetStoppedActivity ( void );
8182
8283 void Move ( float flInterval );
@@ -88,7 +89,7 @@ class CIchthyosaur : public CFlyingMonster
8889
8990 float VectorToPitch ( const Vector &vec );
9091 float FlPitchDiff ( void );
91- float ChangePitch ( int speed );
92+ float ChangePitch ( int pitchSpeed );
9293
9394 Vector m_SaveVelocity;
9495 float m_idealDist;
@@ -106,6 +107,9 @@ class CIchthyosaur : public CFlyingMonster
106107
107108 float m_flNextAlert;
108109
110+ float m_flLastPitchTime; // Last frame time pitch was changed
111+ float m_flLastZYawTime; // Last frame time Z was changed when yaw was changed
112+
109113 static const char *pIdleSounds[];
110114 static const char *pAlertSounds[];
111115 static const char *pAttackSounds[];
@@ -780,7 +784,7 @@ float CIchthyosaur::FlPitchDiff( void )
780784 return flPitchDiff;
781785}
782786
783- float CIchthyosaur::ChangePitch ( int speed )
787+ float CIchthyosaur::ChangePitch ( int pitchSpeed )
784788{
785789 if ( pev->movetype == MOVETYPE_FLY )
786790 {
@@ -793,12 +797,28 @@ float CIchthyosaur::ChangePitch( int speed )
793797 else if ( diff > 20 )
794798 target = -45 ;
795799 }
796- pev->angles .x = UTIL_Approach (target, pev->angles .x , 220 .0f * 0 .1f );
800+
801+ float speed = 220 .f ;
802+
803+ if ( monsteryawspeedfix.value )
804+ {
805+ if ( m_flLastPitchTime == 0 .f )
806+ m_flLastPitchTime = gpGlobals->time - gpGlobals->frametime ;
807+
808+ float delta = Q_min ( gpGlobals->time - m_flLastPitchTime, 0 .25f );
809+ m_flLastPitchTime = gpGlobals->time ;
810+
811+ speed *= delta;
812+ }
813+ else
814+ speed *= 0 .1f ;
815+
816+ pev->angles .x = UTIL_Approach (target, pev->angles .x , speed );
797817 }
798818 return 0 ;
799819}
800820
801- float CIchthyosaur::ChangeYaw ( int speed )
821+ float CIchthyosaur::ChangeYaw ( int yawSpeed )
802822{
803823 if ( pev->movetype == MOVETYPE_FLY )
804824 {
@@ -812,9 +832,25 @@ float CIchthyosaur::ChangeYaw( int speed )
812832 else if ( diff > 20 )
813833 target = -20 ;
814834 }
815- pev->angles .z = UTIL_Approach ( target, pev->angles .z , 220 .0f * 0 .1f );
835+
836+ float speed = 220 .f ;
837+
838+ if ( monsteryawspeedfix.value )
839+ {
840+ if ( m_flLastZYawTime == 0 .f )
841+ m_flLastZYawTime = gpGlobals->time - gpGlobals->frametime ;
842+
843+ float delta = Q_min ( gpGlobals->time - m_flLastZYawTime, 0 .25f );
844+ m_flLastZYawTime = gpGlobals->time ;
845+
846+ speed *= delta;
847+ }
848+ else
849+ speed *= 0 .1f ;
850+
851+ pev->angles .z = UTIL_Approach ( target, pev->angles .z , speed );
816852 }
817- return CFlyingMonster::ChangeYaw ( speed );
853+ return CFlyingMonster::ChangeYaw ( yawSpeed );
818854}
819855
820856Activity CIchthyosaur::GetStoppedActivity ( void )
0 commit comments