virtual GetIdleCountdown()

GetIdleCountdown() is now virtual as art2432 needs certain units to have different idle countdowns
This commit is contained in:
Nathan Fulton 2017-04-29 22:32:54 -04:00
parent 278aecfb70
commit aa342e4b7f
4 changed files with 25 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;