diff --git a/game/LRInfantry.cpp b/game/LRInfantry.cpp index ea2d291..493c2ca 100644 --- a/game/LRInfantry.cpp +++ b/game/LRInfantry.cpp @@ -100,6 +100,11 @@ void LRInfantryGob::Idle() } } +int LRInfantryGob::GetIdleCountdown() +{ + return (GetRandom() % 100) + 50; // somewhere between 8 & 12 seconds +} + int LRInfantryGob::ProcessStateMachineMessage(State st, Message *pmsg) { BeginStateMachine diff --git a/game/MobileUnit.cpp b/game/MobileUnit.cpp index 51ca4ad..f8374c5 100644 --- a/game/MobileUnit.cpp +++ b/game/MobileUnit.cpp @@ -50,8 +50,6 @@ int g_mpDirToDy[8] = { -1, -1, 0, 1, 1, 1, 0, -1 }; AnimationData *g_panidMoveTarget; static AnimationData *s_panidVehicleExplosion; -#define GetIdleCountdown() ((GetRandom() % 50) + 50) // somewhere between 4 & 8 seconds - const int kcFireCountdown = 6; // 6 updates (~.5 secs) Path *MobileUnitGob::s_apathCached[kcPathsCache]; @@ -723,6 +721,11 @@ bool MobileUnitGob::IsAttackPointWithinFiringRangeOfTarget(UnitGob *puntTarget) return IsTargetWithinRange(&wptAttack, puntTarget, m_pmuntc->tcFiringRange); } +int MobileUnitGob::GetIdleCountdown() +{ + return (GetRandom() % 50) + 50; // somewhere between 4 & 8 seconds +} + // TUNE: const TCoord ktcVicinity = 5; diff --git a/game/SRInfantry.cpp b/game/SRInfantry.cpp index f69ce75..fa4a6be 100644 --- a/game/SRInfantry.cpp +++ b/game/SRInfantry.cpp @@ -99,6 +99,11 @@ void SRInfantryGob::Idle() } } +int SRInfantryGob::GetIdleCountdown() +{ + return (GetRandom() % 100) + 50; // somewhere between 8 & 12 seconds +} + int SRInfantryGob::ProcessStateMachineMessage(State st, Message *pmsg) { BeginStateMachine diff --git a/game/ht.h b/game/ht.h index c7cee0c..09fc47e 100644 --- a/game/ht.h +++ b/game/ht.h @@ -6691,6 +6691,8 @@ public: bool IsMobile() secUnitGob; bool IsStandingOnActivator() secUnitGob; + virtual int GetIdleCountdown() secUnitGob; + bool HasAttackTarget() { return m_gidTarget != kgidNull; } @@ -7024,6 +7026,10 @@ public: virtual bool Fire(UnitGob *puntTarget, WCoord wx, WCoord wy, WCoord wdx, WCoord wdy) secInfantryGob; virtual void Idle() secInfantryGob; + // MobileUnitGob overrides + + virtual int GetIdleCountdown() secInfantryGob; + // StateMachine methods virtual int ProcessStateMachineMessage(State st, Message *pmsg) secInfantryGob; @@ -7044,6 +7050,10 @@ public: virtual bool Fire(UnitGob *puntTarget, WCoord wx, WCoord wy, WCoord wdx, WCoord wdy) secInfantryGob; virtual void Idle() secInfantryGob; + // MobileUnitGob overrides + + virtual int GetIdleCountdown() secInfantryGob; + // StateMachine methods virtual int ProcessStateMachineMessage(State st, Message *pmsg) secInfantryGob;