mirror of https://github.com/FWGS/hlsdk-xash3d
Rename classes
This commit is contained in:
parent
d7008be97d
commit
798509f0e1
|
@ -27,7 +27,7 @@ int GetBotFollowCount(CBasePlayer *leader)
|
|||
if (!player->IsAlive())
|
||||
continue;
|
||||
|
||||
CCSBot *bot = dynamic_cast<CCSBot *>(player);
|
||||
CHLBot *bot = dynamic_cast<CHLBot *>(player);
|
||||
if (bot != NULL && bot->GetFollowLeader() == leader)
|
||||
++count;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ int GetBotFollowCount(CBasePlayer *leader)
|
|||
|
||||
// Change movement speed to walking
|
||||
|
||||
void CCSBot::Walk()
|
||||
void CHLBot::Walk()
|
||||
{
|
||||
if (m_mustRunTimer.IsElapsed())
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ void CCSBot::Walk()
|
|||
// Return true if jump was started.
|
||||
// This is extended from the base jump to disallow jumping when in a crouch area.
|
||||
|
||||
bool CCSBot::Jump(bool mustJump)
|
||||
bool CHLBot::Jump(bool mustJump)
|
||||
{
|
||||
// prevent jumping if we're crouched, unless we're in a crouchjump area - jump wins
|
||||
bool inCrouchJumpArea = (m_lastKnownArea &&
|
||||
|
@ -70,7 +70,7 @@ bool CCSBot::Jump(bool mustJump)
|
|||
// Invoked when injured by something
|
||||
// NOTE: We dont want to directly call Attack() here, or the bots will have super-human reaction times when injured
|
||||
|
||||
int CCSBot::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
|
||||
int CHLBot::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
|
||||
{
|
||||
CBaseEntity *attacker = GetClassPtr((CBaseEntity *)pevInflictor);
|
||||
|
||||
|
@ -148,7 +148,7 @@ int CCSBot::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float fl
|
|||
|
||||
// Invoked when killed
|
||||
|
||||
void CCSBot::Killed(entvars_t *pevAttacker, int iGib)
|
||||
void CHLBot::Killed(entvars_t *pevAttacker, int iGib)
|
||||
{
|
||||
PrintIfWatched("Killed( attacker = %s )\n", STRING(pevAttacker->netname));
|
||||
|
||||
|
@ -215,7 +215,7 @@ bool IsIntersectingBox(const Vector *start, const Vector *end, const Vector *box
|
|||
|
||||
// When bot is touched by another entity.
|
||||
|
||||
void CCSBot::BotTouch(CBaseEntity *other)
|
||||
void CHLBot::BotTouch(CBaseEntity *other)
|
||||
{
|
||||
// if we have touched a higher-priority player, make way
|
||||
// TODO: Need to account for reaction time, etc.
|
||||
|
@ -285,7 +285,7 @@ void CCSBot::BotTouch(CBaseEntity *other)
|
|||
}
|
||||
}
|
||||
|
||||
bool CCSBot::IsBusy() const
|
||||
bool CHLBot::IsBusy() const
|
||||
{
|
||||
if (IsAttacking() || IsSniping())
|
||||
{
|
||||
|
@ -295,12 +295,12 @@ bool CCSBot::IsBusy() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void CCSBot::BotDeathThink()
|
||||
void CHLBot::BotDeathThink()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
CBasePlayer *CCSBot::FindNearbyPlayer()
|
||||
CBasePlayer *CHLBot::FindNearbyPlayer()
|
||||
{
|
||||
CBaseEntity *pEntity = NULL;
|
||||
Vector vecSrc = pev->origin;
|
||||
|
@ -322,7 +322,7 @@ CBasePlayer *CCSBot::FindNearbyPlayer()
|
|||
|
||||
// Assign given player as our current enemy to attack
|
||||
|
||||
void CCSBot::SetEnemy(CBasePlayer *enemy)
|
||||
void CHLBot::SetEnemy(CBasePlayer *enemy)
|
||||
{
|
||||
if (m_enemy != enemy)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ void CCSBot::SetEnemy(CBasePlayer *enemy)
|
|||
// move towards last known area.
|
||||
// Return false if off mesh.
|
||||
|
||||
bool CCSBot::StayOnNavMesh()
|
||||
bool CHLBot::StayOnNavMesh()
|
||||
{
|
||||
if (m_currentArea != NULL)
|
||||
return true;
|
||||
|
@ -382,7 +382,7 @@ bool CCSBot::StayOnNavMesh()
|
|||
return false;
|
||||
}
|
||||
|
||||
void CCSBot::Panic(CBasePlayer *enemy)
|
||||
void CHLBot::Panic(CBasePlayer *enemy)
|
||||
{
|
||||
if (IsSurprised())
|
||||
return;
|
||||
|
@ -443,7 +443,7 @@ void CCSBot::Panic(CBasePlayer *enemy)
|
|||
PrintIfWatched("Aaaah!\n");
|
||||
}
|
||||
|
||||
bool CCSBot::IsDoingScenario() const
|
||||
bool CHLBot::IsDoingScenario() const
|
||||
{
|
||||
if (cv_bot_defer_to_human.value <= 0.0f)
|
||||
return true;
|
||||
|
@ -452,7 +452,7 @@ bool CCSBot::IsDoingScenario() const
|
|||
}
|
||||
// Return last enemy that hurt us
|
||||
|
||||
CBasePlayer *CCSBot::GetAttacker() const
|
||||
CBasePlayer *CHLBot::GetAttacker() const
|
||||
{
|
||||
if (m_attacker != NULL && m_attacker->IsAlive())
|
||||
return m_attacker;
|
||||
|
@ -462,7 +462,7 @@ CBasePlayer *CCSBot::GetAttacker() const
|
|||
|
||||
// Immediately jump off of our ladder, if we're on one
|
||||
|
||||
void CCSBot::GetOffLadder()
|
||||
void CHLBot::GetOffLadder()
|
||||
{
|
||||
if (IsUsingLadder())
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ void CCSBot::GetOffLadder()
|
|||
|
||||
// Return time when given spot was last checked
|
||||
|
||||
float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const
|
||||
float CHLBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const
|
||||
{
|
||||
for (int i = 0; i < m_checkedHidingSpotCount; ++i)
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ float CCSBot::GetHidingSpotCheckTimestamp(HidingSpot *spot) const
|
|||
// Set the timestamp of the given spot to now.
|
||||
// If the spot is not in the set, overwrite the least recently checked spot.
|
||||
|
||||
void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
|
||||
void CHLBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
|
||||
{
|
||||
int leastRecent = 0;
|
||||
float leastRecentTime = gpGlobals->time + 1.0f;
|
||||
|
@ -525,14 +525,14 @@ void CCSBot::SetHidingSpotCheckTimestamp(HidingSpot *spot)
|
|||
}
|
||||
// Return true if we are outnumbered by enemies
|
||||
|
||||
bool CCSBot::IsOutnumbered() const
|
||||
bool CHLBot::IsOutnumbered() const
|
||||
{
|
||||
return (GetNearbyFriendCount() < GetNearbyEnemyCount() - 1) ? true : false;
|
||||
}
|
||||
|
||||
// Return number of enemies we are outnumbered by
|
||||
|
||||
int CCSBot::OutnumberedCount() const
|
||||
int CHLBot::OutnumberedCount() const
|
||||
{
|
||||
if (IsOutnumbered())
|
||||
{
|
||||
|
@ -544,9 +544,9 @@ int CCSBot::OutnumberedCount() const
|
|||
|
||||
// Return the closest "important" enemy for the given scenario (bomb carrier, VIP, hostage escorter)
|
||||
|
||||
CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
|
||||
CBasePlayer *CHLBot::GetImportantEnemy(bool checkVisibility) const
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
CBasePlayer *nearEnemy = NULL;
|
||||
float nearDist = 999999999.9f;
|
||||
|
||||
|
@ -594,7 +594,7 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
|
|||
|
||||
// Sets our current disposition
|
||||
|
||||
void CCSBot::SetDisposition(DispositionType disposition)
|
||||
void CHLBot::SetDisposition(DispositionType disposition)
|
||||
{
|
||||
m_disposition = disposition;
|
||||
|
||||
|
@ -606,7 +606,7 @@ void CCSBot::SetDisposition(DispositionType disposition)
|
|||
|
||||
// Return our current disposition
|
||||
|
||||
CCSBot::DispositionType CCSBot::GetDisposition() const
|
||||
CHLBot::DispositionType CHLBot::GetDisposition() const
|
||||
{
|
||||
if (!m_ignoreEnemiesTimer.IsElapsed())
|
||||
return IGNORE_ENEMIES;
|
||||
|
@ -616,14 +616,14 @@ CCSBot::DispositionType CCSBot::GetDisposition() const
|
|||
|
||||
// Ignore enemies for a short durationy
|
||||
|
||||
void CCSBot::IgnoreEnemies(float duration)
|
||||
void CHLBot::IgnoreEnemies(float duration)
|
||||
{
|
||||
m_ignoreEnemiesTimer.Start(duration);
|
||||
}
|
||||
|
||||
// Increase morale one step
|
||||
|
||||
void CCSBot::IncreaseMorale()
|
||||
void CHLBot::IncreaseMorale()
|
||||
{
|
||||
if (m_morale < EXCELLENT)
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ void CCSBot::IncreaseMorale()
|
|||
|
||||
// Decrease morale one step
|
||||
|
||||
void CCSBot::DecreaseMorale()
|
||||
void CHLBot::DecreaseMorale()
|
||||
{
|
||||
if (m_morale > TERRIBLE)
|
||||
{
|
||||
|
@ -644,9 +644,9 @@ void CCSBot::DecreaseMorale()
|
|||
// Return true if we are acting like a rogue (not listening to teammates, not doing scenario goals)
|
||||
// TODO: Account for morale
|
||||
|
||||
bool CCSBot::IsRogue() const
|
||||
bool CHLBot::IsRogue() const
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (!ctrl->AllowRogues())
|
||||
return false;
|
||||
|
@ -667,12 +667,12 @@ bool CCSBot::IsRogue() const
|
|||
|
||||
// Return true if we are in a hurry
|
||||
|
||||
bool CCSBot::IsHurrying() const
|
||||
bool CHLBot::IsHurrying() const
|
||||
{
|
||||
if (!m_hurryTimer.IsElapsed())
|
||||
return true;
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
|
||||
return false;
|
||||
|
@ -680,9 +680,9 @@ bool CCSBot::IsHurrying() const
|
|||
|
||||
// Return true if it is the early, "safe", part of the round
|
||||
|
||||
bool CCSBot::IsSafe() const
|
||||
bool CHLBot::IsSafe() const
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (ctrl->GetElapsedRoundTime() < m_safeTime)
|
||||
return true;
|
||||
|
@ -692,9 +692,9 @@ bool CCSBot::IsSafe() const
|
|||
|
||||
// Return true if it is well past the early, "safe", part of the round
|
||||
|
||||
bool CCSBot::IsWellPastSafe() const
|
||||
bool CHLBot::IsWellPastSafe() const
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (ctrl->GetElapsedRoundTime() > 1.25f * m_safeTime)
|
||||
return true;
|
||||
|
@ -704,25 +704,25 @@ bool CCSBot::IsWellPastSafe() const
|
|||
|
||||
// Return true if we were in the safe time last update, but not now
|
||||
|
||||
bool CCSBot::IsEndOfSafeTime() const
|
||||
bool CHLBot::IsEndOfSafeTime() const
|
||||
{
|
||||
return m_wasSafe && !IsSafe();
|
||||
}
|
||||
|
||||
// Return the amount of "safe time" we have left
|
||||
|
||||
float CCSBot::GetSafeTimeRemaining() const
|
||||
float CHLBot::GetSafeTimeRemaining() const
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
return m_safeTime - ctrl->GetElapsedRoundTime();
|
||||
}
|
||||
|
||||
// Called when enemy seen to adjust safe time for this round
|
||||
|
||||
void CCSBot::AdjustSafeTime()
|
||||
void CHLBot::AdjustSafeTime()
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
// if we spotted an enemy sooner than we thought possible, adjust our notion of "safe" time
|
||||
if (m_safeTime > ctrl->GetElapsedRoundTime())
|
||||
|
@ -734,7 +734,7 @@ void CCSBot::AdjustSafeTime()
|
|||
|
||||
// Return true if we haven't seen an enemy for "a long time"
|
||||
|
||||
bool CCSBot::HasNotSeenEnemyForLongTime() const
|
||||
bool CHLBot::HasNotSeenEnemyForLongTime() const
|
||||
{
|
||||
const float longTime = 30.0f;
|
||||
return (GetTimeSinceLastSawEnemy() > longTime);
|
||||
|
@ -742,10 +742,10 @@ bool CCSBot::HasNotSeenEnemyForLongTime() const
|
|||
|
||||
// Pick a random zone and hide near it
|
||||
|
||||
bool CCSBot::GuardRandomZone(float range)
|
||||
bool CHLBot::GuardRandomZone(float range)
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
const CCSBotManager::Zone *zone = ctrl->GetRandomZone();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
const CHLBotManager::Zone *zone = ctrl->GetRandomZone();
|
||||
|
||||
if (zone != NULL)
|
||||
{
|
||||
|
@ -763,7 +763,7 @@ bool CCSBot::GuardRandomZone(float range)
|
|||
// Do a breadth-first search to find a good retreat spot.
|
||||
// Don't pick a spot that a Player is currently occupying.
|
||||
|
||||
const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange)
|
||||
const Vector *FindNearbyRetreatSpot(CHLBot *me, float maxRange)
|
||||
{
|
||||
CNavArea *area = me->GetLastKnownArea();
|
||||
if (area == NULL)
|
||||
|
|
|
@ -62,32 +62,32 @@ extern struct BuyInfo secondaryWeaponBuyInfoCT[ SECONDARY_WEAPON_BUY_COUNT ];
|
|||
extern struct BuyInfo primaryWeaponBuyInfoT[ PRIMARY_WEAPON_BUY_COUNT ];
|
||||
extern struct BuyInfo secondaryWeaponBuyInfoT[ SECONDARY_WEAPON_BUY_COUNT ];
|
||||
*/
|
||||
class CCSBot;
|
||||
class CHLBot;
|
||||
class BotChatterInterface;
|
||||
|
||||
class BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me) {}
|
||||
virtual void OnUpdate(CCSBot *me) {}
|
||||
virtual void OnExit(CCSBot *me) {}
|
||||
virtual void OnEnter(CHLBot *me) {}
|
||||
virtual void OnUpdate(CHLBot *me) {}
|
||||
virtual void OnExit(CHLBot *me) {}
|
||||
virtual const char *GetName() const = 0;
|
||||
};
|
||||
|
||||
class IdleState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual const char *GetName() const { return "Idle"; }
|
||||
};
|
||||
|
||||
class HuntState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "Hunt"; }
|
||||
|
||||
void ClearHuntArea() { m_huntArea = NULL; }
|
||||
|
@ -98,13 +98,13 @@ private:
|
|||
class AttackState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "Attack"; }
|
||||
|
||||
void SetCrouchAndHold(bool crouch) { m_crouchAndHold = crouch; }
|
||||
void StopAttacking(CCSBot *me);
|
||||
void StopAttacking(CHLBot *me);
|
||||
|
||||
protected:
|
||||
enum DodgeStateType
|
||||
|
@ -136,13 +136,13 @@ protected:
|
|||
class InvestigateNoiseState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "InvestigateNoise"; }
|
||||
|
||||
private:
|
||||
void AttendCurrentNoise(CCSBot *me);
|
||||
void AttendCurrentNoise(CHLBot *me);
|
||||
Vector m_checkNoisePosition;
|
||||
};
|
||||
#if 0
|
||||
|
@ -169,9 +169,9 @@ private:
|
|||
class MoveToState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "MoveTo"; }
|
||||
|
||||
void SetGoalPosition(const Vector &pos) { m_goalPosition = pos; }
|
||||
|
@ -213,9 +213,9 @@ public:
|
|||
class HideState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "Hide"; }
|
||||
|
||||
public:
|
||||
|
@ -258,9 +258,9 @@ public:
|
|||
class FollowState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "Follow"; }
|
||||
|
||||
void SetLeader(CBaseEntity *leader) { m_leader = leader; }
|
||||
|
@ -298,9 +298,9 @@ private:
|
|||
class UseEntityState: public BotState
|
||||
{
|
||||
public:
|
||||
virtual void OnEnter(CCSBot *me);
|
||||
virtual void OnUpdate(CCSBot *me);
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual void OnEnter(CHLBot *me);
|
||||
virtual void OnUpdate(CHLBot *me);
|
||||
virtual void OnExit(CHLBot *me);
|
||||
virtual const char *GetName() const { return "UseEntity"; }
|
||||
|
||||
void SetEntity(CBaseEntity *entity) { m_entity = entity; }
|
||||
|
@ -311,10 +311,10 @@ private:
|
|||
|
||||
// The Counter-strike Bot
|
||||
|
||||
class CCSBot: public CBot
|
||||
class CHLBot: public CBot
|
||||
{
|
||||
public:
|
||||
CCSBot(); // constructor initializes all values to zero
|
||||
CHLBot(); // constructor initializes all values to zero
|
||||
|
||||
public:
|
||||
virtual int ObjectCaps( void ) { return CBaseMonster :: ObjectCaps() | FCAP_DONT_SAVE; }
|
||||
|
@ -423,8 +423,8 @@ public:
|
|||
bool IsDoingScenario() const; // return true if we will do scenario-related tasks
|
||||
|
||||
// scenario / gamestate
|
||||
CSGameState *GetGameState(); // return an interface to this bot's gamestate
|
||||
const CSGameState *GetGameState() const; // return an interface to this bot's gamestate
|
||||
CHLGameState *GetGameState(); // return an interface to this bot's gamestate
|
||||
const CHLGameState *GetGameState() const; // return an interface to this bot's gamestate
|
||||
|
||||
bool IsAtBombsite(); // return true if we are in a bomb planting zone
|
||||
bool GuardRandomZone(float range = 500.0f); // pick a random zone and hide near it
|
||||
|
@ -677,7 +677,7 @@ public:
|
|||
bool HasAnyAmmo(CBasePlayerWeapon *weapon) const;
|
||||
|
||||
private:
|
||||
friend class CCSBotManager;
|
||||
friend class CHLBotManager;
|
||||
|
||||
// TODO: Get rid of these
|
||||
friend class AttackState;
|
||||
|
@ -809,7 +809,7 @@ private:
|
|||
CountdownTimer m_mustRunTimer; // if nonzero, bot cannot walk
|
||||
|
||||
// game scenario mechanisms
|
||||
CSGameState m_gameState;
|
||||
CHLGameState m_gameState;
|
||||
#if 0
|
||||
// hostages mechanism
|
||||
byte m_hostageEscortCount;
|
||||
|
@ -1018,22 +1018,22 @@ public:
|
|||
|
||||
// Inlines
|
||||
|
||||
inline float CCSBot::GetCombatRange() const
|
||||
inline float CHLBot::GetCombatRange() const
|
||||
{
|
||||
return m_combatRange;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetRogue(bool rogue)
|
||||
inline void CHLBot::SetRogue(bool rogue)
|
||||
{
|
||||
m_isRogue = rogue;
|
||||
}
|
||||
|
||||
inline void CCSBot::Hurry(float duration)
|
||||
inline void CHLBot::Hurry(float duration)
|
||||
{
|
||||
m_hurryTimer.Start(duration);
|
||||
}
|
||||
|
||||
inline float CCSBot::GetSafeTime() const
|
||||
inline float CHLBot::GetSafeTime() const
|
||||
{
|
||||
return m_safeTime;
|
||||
}
|
||||
|
@ -1044,83 +1044,83 @@ inline bool CCSBot::IsCarryingBomb() const
|
|||
}
|
||||
#endif
|
||||
|
||||
inline bool CCSBot::IsFollowing() const
|
||||
inline bool CHLBot::IsFollowing() const
|
||||
{
|
||||
return m_isFollowing;
|
||||
}
|
||||
|
||||
inline CBasePlayer *CCSBot::GetFollowLeader()
|
||||
inline CBasePlayer *CHLBot::GetFollowLeader()
|
||||
{
|
||||
return (CBasePlayer*)(CBaseEntity*)m_leader;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetFollowDuration() const
|
||||
inline float CHLBot::GetFollowDuration() const
|
||||
{
|
||||
return gpGlobals->time - m_followTimestamp;
|
||||
}
|
||||
|
||||
inline bool CCSBot::CanAutoFollow() const
|
||||
inline bool CHLBot::CanAutoFollow() const
|
||||
{
|
||||
return (gpGlobals->time > m_allowAutoFollowTime);
|
||||
}
|
||||
|
||||
inline void CCSBot::AimAtEnemy()
|
||||
inline void CHLBot::AimAtEnemy()
|
||||
{
|
||||
m_isAimingAtEnemy = true;
|
||||
}
|
||||
|
||||
inline void CCSBot::StopAiming()
|
||||
inline void CHLBot::StopAiming()
|
||||
{
|
||||
m_isAimingAtEnemy = false;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsAimingAtEnemy() const
|
||||
inline bool CHLBot::IsAimingAtEnemy() const
|
||||
{
|
||||
return m_isAimingAtEnemy;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsSurprised() const
|
||||
inline bool CHLBot::IsSurprised() const
|
||||
{
|
||||
return gpGlobals->time - m_surpriseTimestamp < 5.0f;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetSurpriseDelay() const
|
||||
inline float CHLBot::GetSurpriseDelay() const
|
||||
{
|
||||
return ( gpGlobals->time - IsSurprised() )? m_surpriseDelay : 0.0f;
|
||||
}
|
||||
|
||||
inline void CCSBot::ClearSurpriseDelay()
|
||||
inline void CHLBot::ClearSurpriseDelay()
|
||||
{
|
||||
m_surpriseDelay = 0.0f;
|
||||
m_surpriseTimestamp = 0.0f;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetStateTimestamp() const
|
||||
inline float CHLBot::GetStateTimestamp() const
|
||||
{
|
||||
return m_stateTimestamp;
|
||||
}
|
||||
|
||||
inline CSGameState *CCSBot::GetGameState()
|
||||
inline CHLGameState *CHLBot::GetGameState()
|
||||
{
|
||||
return &m_gameState;
|
||||
}
|
||||
|
||||
inline const CSGameState *CCSBot::GetGameState() const
|
||||
inline const CHLGameState *CHLBot::GetGameState() const
|
||||
{
|
||||
return &m_gameState;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsAtBombsite()
|
||||
inline bool CHLBot::IsAtBombsite()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline CCSBot::MoraleType CCSBot::GetMorale() const
|
||||
inline CHLBot::MoraleType CHLBot::GetMorale() const
|
||||
{
|
||||
return m_morale;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsNoiseHeard() const
|
||||
inline bool CHLBot::IsNoiseHeard() const
|
||||
{
|
||||
if (m_noiseTimestamp <= 0.0f)
|
||||
return false;
|
||||
|
@ -1132,203 +1132,203 @@ inline bool CCSBot::IsNoiseHeard() const
|
|||
return false;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetTask(TaskType task, CBaseEntity *entity)
|
||||
inline void CHLBot::SetTask(TaskType task, CBaseEntity *entity)
|
||||
{
|
||||
m_task = task;
|
||||
m_taskEntity = entity;
|
||||
}
|
||||
|
||||
inline CCSBot::TaskType CCSBot::GetTask() const
|
||||
inline CHLBot::TaskType CHLBot::GetTask() const
|
||||
{
|
||||
return m_task;
|
||||
}
|
||||
|
||||
inline CBaseEntity *CCSBot::GetTaskEntity()
|
||||
inline CBaseEntity *CHLBot::GetTaskEntity()
|
||||
{
|
||||
return m_taskEntity;
|
||||
}
|
||||
|
||||
inline CNavArea *CCSBot::GetNoiseArea() const
|
||||
inline CNavArea *CHLBot::GetNoiseArea() const
|
||||
{
|
||||
return m_noiseArea;
|
||||
}
|
||||
|
||||
inline void CCSBot::ForgetNoise()
|
||||
inline void CHLBot::ForgetNoise()
|
||||
{
|
||||
m_noiseTimestamp = 0.0f;
|
||||
}
|
||||
|
||||
inline PriorityType CCSBot::GetNoisePriority() const
|
||||
inline PriorityType CHLBot::GetNoisePriority() const
|
||||
{
|
||||
return m_noisePriority;
|
||||
}
|
||||
|
||||
inline BotChatterInterface *CCSBot::GetChatter()
|
||||
inline BotChatterInterface *CHLBot::GetChatter()
|
||||
{
|
||||
return &m_chatter;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsUsingVoice() const
|
||||
inline bool CHLBot::IsUsingVoice() const
|
||||
{
|
||||
return (m_voiceFeedbackEndTimestamp != 0.0f);
|
||||
}
|
||||
|
||||
inline CBasePlayer *CCSBot::GetEnemy()
|
||||
inline CBasePlayer *CHLBot::GetEnemy()
|
||||
{
|
||||
return (CBasePlayer*)(CBaseEntity*)m_enemy;
|
||||
}
|
||||
|
||||
inline int CCSBot::GetNearbyEnemyCount() const
|
||||
inline int CHLBot::GetNearbyEnemyCount() const
|
||||
{
|
||||
return Q_min(GetEnemiesRemaining(), m_nearbyEnemyCount);
|
||||
}
|
||||
|
||||
inline unsigned int CCSBot::GetEnemyPlace() const
|
||||
inline unsigned int CHLBot::GetEnemyPlace() const
|
||||
{
|
||||
return m_enemyPlace;
|
||||
}
|
||||
|
||||
inline bool CCSBot::CanSeeBomber() const
|
||||
inline bool CHLBot::CanSeeBomber() const
|
||||
{
|
||||
return (m_bomber == NULL) ? false : true;
|
||||
}
|
||||
|
||||
inline CBasePlayer *CCSBot::GetBomber() const
|
||||
inline CBasePlayer *CHLBot::GetBomber() const
|
||||
{
|
||||
return m_bomber;
|
||||
}
|
||||
|
||||
inline int CCSBot::GetNearbyFriendCount() const
|
||||
inline int CHLBot::GetNearbyFriendCount() const
|
||||
{
|
||||
return Q_min(GetFriendsRemaining(), m_nearbyFriendCount);
|
||||
}
|
||||
|
||||
inline CBasePlayer *CCSBot::GetClosestVisibleFriend() const
|
||||
inline CBasePlayer *CHLBot::GetClosestVisibleFriend() const
|
||||
{
|
||||
return m_closestVisibleFriend;
|
||||
}
|
||||
|
||||
inline CBasePlayer *CCSBot::GetClosestVisibleHumanFriend() const
|
||||
inline CBasePlayer *CHLBot::GetClosestVisibleHumanFriend() const
|
||||
{
|
||||
return m_closestVisibleHumanFriend;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetTimeSinceAttacked() const
|
||||
inline float CHLBot::GetTimeSinceAttacked() const
|
||||
{
|
||||
return gpGlobals->time - m_attackedTimestamp;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetFirstSawEnemyTimestamp() const
|
||||
inline float CHLBot::GetFirstSawEnemyTimestamp() const
|
||||
{
|
||||
return m_firstSawEnemyTimestamp;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetLastSawEnemyTimestamp() const
|
||||
inline float CHLBot::GetLastSawEnemyTimestamp() const
|
||||
{
|
||||
return m_lastSawEnemyTimestamp;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetTimeSinceLastSawEnemy() const
|
||||
inline float CHLBot::GetTimeSinceLastSawEnemy() const
|
||||
{
|
||||
return gpGlobals->time - m_lastSawEnemyTimestamp;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetTimeSinceAcquiredCurrentEnemy() const
|
||||
inline float CHLBot::GetTimeSinceAcquiredCurrentEnemy() const
|
||||
{
|
||||
return gpGlobals->time - m_currentEnemyAcquireTimestamp;
|
||||
}
|
||||
|
||||
inline const Vector &CCSBot::GetLastKnownEnemyPosition() const
|
||||
inline const Vector &CHLBot::GetLastKnownEnemyPosition() const
|
||||
{
|
||||
return m_lastEnemyPosition;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsEnemyVisible() const
|
||||
inline bool CHLBot::IsEnemyVisible() const
|
||||
{
|
||||
return m_isEnemyVisible;
|
||||
}
|
||||
|
||||
inline float CCSBot::GetEnemyDeathTimestamp() const
|
||||
inline float CHLBot::GetEnemyDeathTimestamp() const
|
||||
{
|
||||
return m_enemyDeathTimestamp;
|
||||
}
|
||||
|
||||
inline int CCSBot::GetLastVictimID() const
|
||||
inline int CHLBot::GetLastVictimID() const
|
||||
{
|
||||
return m_lastVictimID;
|
||||
}
|
||||
|
||||
inline bool CCSBot::HasPath() const
|
||||
inline bool CHLBot::HasPath() const
|
||||
{
|
||||
return m_pathLength != 0;
|
||||
}
|
||||
|
||||
inline void CCSBot::DestroyPath()
|
||||
inline void CHLBot::DestroyPath()
|
||||
{
|
||||
m_pathLength = 0;
|
||||
m_pathLadder = NULL;
|
||||
}
|
||||
|
||||
inline CNavArea *CCSBot::GetLastKnownArea() const
|
||||
inline CNavArea *CHLBot::GetLastKnownArea() const
|
||||
{
|
||||
return m_lastKnownArea;
|
||||
}
|
||||
|
||||
inline const Vector &CCSBot::GetPathEndpoint() const
|
||||
inline const Vector &CHLBot::GetPathEndpoint() const
|
||||
{
|
||||
return m_path[ m_pathLength - 1 ].pos;
|
||||
}
|
||||
|
||||
inline const Vector &CCSBot::GetPathPosition(int numpath) const
|
||||
inline const Vector &CHLBot::GetPathPosition(int numpath) const
|
||||
{
|
||||
return m_path[ numpath ].pos;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsUsingLadder() const
|
||||
inline bool CHLBot::IsUsingLadder() const
|
||||
{
|
||||
return m_pathLadder != NULL;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetGoalEntity(CBaseEntity *entity)
|
||||
inline void CHLBot::SetGoalEntity(CBaseEntity *entity)
|
||||
{
|
||||
m_goalEntity = entity;
|
||||
}
|
||||
|
||||
inline CBaseEntity *CCSBot::GetGoalEntity()
|
||||
inline CBaseEntity *CHLBot::GetGoalEntity()
|
||||
{
|
||||
return m_goalEntity;
|
||||
}
|
||||
|
||||
inline void CCSBot::ForceRun(float duration)
|
||||
inline void CHLBot::ForceRun(float duration)
|
||||
{
|
||||
Run();
|
||||
m_mustRunTimer.Start(duration);
|
||||
}
|
||||
|
||||
inline void CCSBot::SetLookAngles(float yaw, float pitch)
|
||||
inline void CHLBot::SetLookAngles(float yaw, float pitch)
|
||||
{
|
||||
m_lookYaw = yaw;
|
||||
m_lookPitch = pitch;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetForwardAngle(float angle)
|
||||
inline void CHLBot::SetForwardAngle(float angle)
|
||||
{
|
||||
m_forwardAngle = angle;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetLookAheadAngle(float angle)
|
||||
inline void CHLBot::SetLookAheadAngle(float angle)
|
||||
{
|
||||
m_lookAheadAngle = angle;
|
||||
}
|
||||
|
||||
inline void CCSBot::ClearLookAt()
|
||||
inline void CHLBot::ClearLookAt()
|
||||
{
|
||||
//PrintIfWatched("ClearLookAt()\n");
|
||||
m_lookAtSpotState = NOT_LOOKING_AT_SPOT;
|
||||
m_lookAtDesc = NULL;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const
|
||||
inline bool CHLBot::IsLookingAtSpot(PriorityType pri) const
|
||||
{
|
||||
if (m_lookAtSpotState != NOT_LOOKING_AT_SPOT && m_lookAtSpotPriority >= pri)
|
||||
return true;
|
||||
|
@ -1336,7 +1336,7 @@ inline bool CCSBot::IsLookingAtSpot(PriorityType pri) const
|
|||
return false;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsViewMoving(float angleVelThreshold) const
|
||||
inline bool CHLBot::IsViewMoving(float angleVelThreshold) const
|
||||
{
|
||||
if (m_lookYawVel < angleVelThreshold && m_lookYawVel > -angleVelThreshold &&
|
||||
m_lookPitchVel < angleVelThreshold && m_lookPitchVel > -angleVelThreshold)
|
||||
|
@ -1346,27 +1346,27 @@ inline bool CCSBot::IsViewMoving(float angleVelThreshold) const
|
|||
return true;
|
||||
}
|
||||
|
||||
inline void CCSBot::ClearApproachPoints()
|
||||
inline void CHLBot::ClearApproachPoints()
|
||||
{
|
||||
m_approachPointCount = 0;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsThrowingGrenade() const
|
||||
inline bool CHLBot::IsThrowingGrenade() const
|
||||
{
|
||||
return m_isWaitingToTossGrenade;
|
||||
}
|
||||
|
||||
inline void CCSBot::StartRapidFire()
|
||||
inline void CHLBot::StartRapidFire()
|
||||
{
|
||||
m_isRapidFiring = true;
|
||||
}
|
||||
|
||||
inline void CCSBot::StopRapidFire()
|
||||
inline void CHLBot::StopRapidFire()
|
||||
{
|
||||
m_isRapidFiring = false;
|
||||
}
|
||||
|
||||
inline CCSBot::ZoomType CCSBot::GetZoomLevel() const
|
||||
inline CHLBot::ZoomType CHLBot::GetZoomLevel() const
|
||||
{
|
||||
if (m_iFOV > 60.0f)
|
||||
return NO_ZOOM;
|
||||
|
@ -1393,7 +1393,7 @@ inline void CCSBot::ResetWaitForHostagePatience()
|
|||
m_inhibitWaitingForHostageTimer.Invalidate();
|
||||
}
|
||||
#endif
|
||||
inline float CCSBot::GetFeetZ() const
|
||||
inline float CHLBot::GetFeetZ() const
|
||||
{
|
||||
if (IsCrouching())
|
||||
{
|
||||
|
@ -1407,7 +1407,7 @@ inline float CCSBot::GetFeetZ() const
|
|||
}
|
||||
}
|
||||
|
||||
inline const Vector *CCSBot::GetNoisePosition() const
|
||||
inline const Vector *CHLBot::GetNoisePosition() const
|
||||
{
|
||||
if (m_noiseTimestamp > 0.0f)
|
||||
return &m_noisePosition;
|
||||
|
@ -1415,7 +1415,7 @@ inline const Vector *CCSBot::GetNoisePosition() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsAwareOfEnemyDeath() const
|
||||
inline bool CHLBot::IsAwareOfEnemyDeath() const
|
||||
{
|
||||
if (GetEnemyDeathTimestamp() == 0.0f)
|
||||
return false;
|
||||
|
@ -1429,13 +1429,13 @@ inline bool CCSBot::IsAwareOfEnemyDeath() const
|
|||
return false;
|
||||
}
|
||||
|
||||
inline bool CCSBot::IsNotMoving() const
|
||||
inline bool CHLBot::IsNotMoving() const
|
||||
{
|
||||
const float stillSpeed = 10.0f;
|
||||
return pev->velocity.IsLengthLessThan(stillSpeed);
|
||||
}
|
||||
|
||||
inline bool CCSBot::HasAnyAmmo(CBasePlayerWeapon *weapon) const
|
||||
inline bool CHLBot::HasAnyAmmo(CBasePlayerWeapon *weapon) const
|
||||
{
|
||||
return (weapon->m_iClip != 0 || m_rgAmmo[weapon->m_iPrimaryAmmoType] > 0);
|
||||
}
|
||||
|
@ -1443,7 +1443,7 @@ inline bool CCSBot::HasAnyAmmo(CBasePlayerWeapon *weapon) const
|
|||
class CollectRetreatSpotsFunctor
|
||||
{
|
||||
public:
|
||||
CollectRetreatSpotsFunctor(CCSBot *me, float range)
|
||||
CollectRetreatSpotsFunctor(CHLBot *me, float range)
|
||||
{
|
||||
m_me = me;
|
||||
m_count = 0;
|
||||
|
@ -1498,7 +1498,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
CCSBot *m_me;
|
||||
CHLBot *m_me;
|
||||
float m_range;
|
||||
|
||||
const Vector *m_spot[ MAX_SPOTS ];
|
||||
|
@ -1508,7 +1508,7 @@ public:
|
|||
class FarthestHostage
|
||||
{
|
||||
public:
|
||||
FarthestHostage(const CCSBot *me)
|
||||
FarthestHostage(const CHLBot *me)
|
||||
{
|
||||
m_me = me;
|
||||
m_farRange = -1.0f;
|
||||
|
@ -1548,7 +1548,7 @@ public:
|
|||
return true;*/
|
||||
//}*/
|
||||
|
||||
const CCSBot *m_me;
|
||||
const CHLBot *m_me;
|
||||
float m_farRange;
|
||||
};
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ public:
|
|||
class PathCost
|
||||
{
|
||||
public:
|
||||
PathCost(CCSBot *bot, RouteType route = SAFEST_ROUTE)
|
||||
PathCost(CHLBot *bot, RouteType route = SAFEST_ROUTE)
|
||||
{
|
||||
m_bot = bot;
|
||||
m_route = route;
|
||||
|
@ -1692,7 +1692,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
CCSBot *m_bot;
|
||||
CHLBot *m_bot;
|
||||
RouteType m_route;
|
||||
};
|
||||
|
||||
|
@ -1769,13 +1769,13 @@ void InstallBotControl();
|
|||
void Bot_ServerCommand();
|
||||
void Bot_RegisterCvars();
|
||||
int GetBotFollowCount(CBasePlayer *leader);
|
||||
const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange);
|
||||
const Vector *FindNearbyRetreatSpot(CHLBot *me, float maxRange);
|
||||
|
||||
void drawProgressMeter(float progress, char *title);
|
||||
void startProgressMeter(const char *title);
|
||||
void hideProgressMeter();
|
||||
|
||||
bool isSniperRifle(CBasePlayerItem *item);
|
||||
float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder);
|
||||
float StayOnLadderLine(CHLBot *me, const CNavLadder *ladder);
|
||||
|
||||
#endif // CS_BOT_H
|
||||
|
|
|
@ -38,7 +38,7 @@ const Vector *GetRandomSpotAtPlace(Place place)
|
|||
|
||||
// Transmit meme to other bots
|
||||
|
||||
void BotMeme::Transmit(CCSBot *sender) const
|
||||
void BotMeme::Transmit(CHLBot *sender) const
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ void BotMeme::Transmit(CCSBot *sender) const
|
|||
if (!player->IsBot())
|
||||
continue;
|
||||
|
||||
CCSBot *bot = dynamic_cast<CCSBot *>(player);
|
||||
CHLBot *bot = dynamic_cast<CHLBot *>(player);
|
||||
|
||||
if (!bot)
|
||||
continue;
|
||||
|
@ -77,7 +77,7 @@ void BotMeme::Transmit(CCSBot *sender) const
|
|||
|
||||
// A teammate called for help - respond
|
||||
|
||||
void BotHelpMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotHelpMeme::Interpret(CHLBot *sender, CHLBot *receiver) const
|
||||
{
|
||||
const float maxHelpRange = 3000.0f; // 2000
|
||||
// receiver->RespondToHelpRequest(sender, m_place, maxHelpRange);
|
||||
|
@ -85,7 +85,7 @@ void BotHelpMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
|||
|
||||
// A teammate has asked that we follow him
|
||||
|
||||
void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotFollowMeme::Interpret(CHLBot *sender, CHLBot *receiver) const
|
||||
{
|
||||
if (receiver->IsRogue())
|
||||
return;
|
||||
|
@ -112,7 +112,7 @@ void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
|||
|
||||
// A teammate has asked us to defend a place
|
||||
|
||||
void BotDefendHereMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotDefendHereMeme::Interpret(CHLBot *sender, CHLBot *receiver) const
|
||||
{
|
||||
if (receiver->IsRogue())
|
||||
return;
|
||||
|
@ -128,14 +128,14 @@ void BotDefendHereMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
|||
const Vector *spot = FindRandomHidingSpot(receiver, place, receiver->IsSniper());
|
||||
if (spot != NULL)
|
||||
{
|
||||
receiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
receiver->SetTask(CHLBot::HOLD_POSITION);
|
||||
receiver->Hide(spot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// hide nearby
|
||||
receiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
receiver->SetTask(CHLBot::HOLD_POSITION);
|
||||
receiver->Hide(TheNavAreaGrid.GetNearestNavArea(&m_pos));
|
||||
|
||||
// acknowledge
|
||||
|
@ -144,7 +144,7 @@ void BotDefendHereMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
|||
|
||||
// A teammate has asked us to report in
|
||||
|
||||
void BotRequestReportMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotRequestReportMeme::Interpret(CHLBot *sender, CHLBot *receiver) const
|
||||
{
|
||||
receiver->GetChatter()->ReportingIn();
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ BotStatement::~BotStatement()
|
|||
}
|
||||
}
|
||||
|
||||
CCSBot *BotStatement::GetOwner() const
|
||||
CHLBot *BotStatement::GetOwner() const
|
||||
{
|
||||
return m_chatter->GetOwner();
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ extern int gmsgSayText;
|
|||
|
||||
bool BotStatement::Update()
|
||||
{
|
||||
CCSBot *me = GetOwner();
|
||||
CHLBot *me = GetOwner();
|
||||
|
||||
// if all of our teammates are dead, the only non-redundant statements are emotes
|
||||
if (me->GetFriendsRemaining() == 0 && GetType() != REPORT_EMOTE)
|
||||
|
@ -1148,7 +1148,7 @@ enum PitchHack { P_HI, P_NORMAL, P_LOW };
|
|||
|
||||
static int nextPitch = P_HI;
|
||||
|
||||
BotChatterInterface::BotChatterInterface(CCSBot *me)
|
||||
BotChatterInterface::BotChatterInterface(CHLBot *me)
|
||||
{
|
||||
m_me = me;
|
||||
m_statementList = NULL;
|
||||
|
@ -1487,7 +1487,7 @@ BotStatement *BotChatterInterface::GetActiveStatement()
|
|||
// if (m_me->m_iTeam != player->m_iTeam)
|
||||
// continue;
|
||||
|
||||
CCSBot *bot = dynamic_cast<CCSBot *>(player);
|
||||
CHLBot *bot = dynamic_cast<CHLBot *>(player);
|
||||
|
||||
// if not a bot, fail the test
|
||||
// TODO: Check if human is currently talking
|
||||
|
@ -1585,7 +1585,7 @@ void BotChatterInterface::ReportIn()
|
|||
|
||||
void BotChatterInterface::ReportingIn()
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
|
||||
|
||||
// where are we
|
||||
|
@ -1769,7 +1769,7 @@ void BotChatterInterface::CelebrateWin()
|
|||
say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f));
|
||||
|
||||
const float quickRound = 45.0f;
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (m_me->GetFriendsRemaining() == 0)
|
||||
{
|
||||
|
@ -1797,7 +1797,7 @@ void BotChatterInterface::CelebrateWin()
|
|||
|
||||
void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
if (ctrl->IsRoundOver())
|
||||
return;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#define UNDEFINED_SUBJECT (-1)
|
||||
#define COUNT_MANY 4 // equal to or greater than this is "many"
|
||||
|
||||
class CCSBot;
|
||||
class CHLBot;
|
||||
class BotChatterInterface;
|
||||
|
||||
typedef unsigned int PlaceCriteria;
|
||||
|
@ -51,8 +51,8 @@ class BotMeme
|
|||
public:
|
||||
virtual ~BotMeme(){}
|
||||
|
||||
void Transmit(CCSBot *sender) const; // transmit meme to other bots
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme
|
||||
void Transmit(CHLBot *sender) const; // transmit meme to other bots
|
||||
virtual void Interpret(CHLBot *sender, CHLBot *receiver) const = 0; // cause the given bot to act on this meme
|
||||
};
|
||||
class BotHelpMeme: public BotMeme
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
{
|
||||
m_place = place;
|
||||
}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CHLBot *sender, CHLBot *receiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
Place m_place;
|
||||
|
@ -69,7 +69,7 @@ private:
|
|||
class BotFollowMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CHLBot *sender, CHLBot *receiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotDefendHereMeme: public BotMeme
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
{
|
||||
m_pos = pos;
|
||||
}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CHLBot *sender, CHLBot *receiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
Vector m_pos;
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
class BotRequestReportMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CHLBot *sender, CHLBot *receiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
enum BotStatementType
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
|
||||
public:
|
||||
BotChatterInterface *GetChatter() const { return m_chatter; }
|
||||
CCSBot *GetOwner() const;
|
||||
CHLBot *GetOwner() const;
|
||||
|
||||
BotStatementType GetType() const { return m_type; } // return the type of statement this is
|
||||
bool IsImportant() const; // return true if this statement is "important" and not personality chatter
|
||||
|
@ -394,7 +394,7 @@ class BotChatterInterface
|
|||
public:
|
||||
BotChatterInterface() {};
|
||||
|
||||
BotChatterInterface(CCSBot *me);
|
||||
BotChatterInterface(CHLBot *me);
|
||||
~BotChatterInterface();
|
||||
|
||||
void Reset(); // reset to initial state
|
||||
|
@ -412,7 +412,7 @@ public:
|
|||
};
|
||||
VerbosityType GetVerbosity() const; // return our current level of verbosity
|
||||
|
||||
CCSBot *GetOwner() const { return m_me; }
|
||||
CHLBot *GetOwner() const { return m_me; }
|
||||
bool IsTalking() const; // return true if we are currently talking
|
||||
float GetRadioSilenceDuration(); // return time since any teammate said anything
|
||||
void ResetRadioSilenceDuration();
|
||||
|
@ -460,7 +460,7 @@ private:
|
|||
void ReportEnemies(); // track nearby enemy count and generate enemy activity statements
|
||||
bool ShouldSpeak() const; // return true if we speaking makes sense now
|
||||
|
||||
CCSBot *m_me; // the bot this chatter is for
|
||||
CHLBot *m_me; // the bot this chatter is for
|
||||
|
||||
bool m_seeAtLeastOneEnemy;
|
||||
float m_timeWhenSawFirstEnemy;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "bot_common.h"
|
||||
|
||||
void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CHLBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
|
||||
GetGameState()->OnEvent(event, entity, other);
|
||||
|
|
|
@ -41,7 +41,7 @@ void InstallBotControl()
|
|||
TheBots = NULL;
|
||||
}
|
||||
|
||||
TheBots = new CCSBotManager;
|
||||
TheBots = new CHLBotManager;
|
||||
}
|
||||
|
||||
// Engine callback for custom server commands
|
||||
|
@ -93,14 +93,14 @@ void Bot_RegisterCvars()
|
|||
|
||||
// Constructor
|
||||
|
||||
CCSBot::CCSBot() : m_chatter(this), m_gameState(this)
|
||||
CHLBot::CHLBot() : m_chatter(this), m_gameState(this)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
// Prepare bot for action
|
||||
|
||||
bool CCSBot::Initialize(const BotProfile *profile)
|
||||
bool CHLBot::Initialize(const BotProfile *profile)
|
||||
{
|
||||
// extend
|
||||
CBot::Initialize(profile);
|
||||
|
@ -127,7 +127,7 @@ bool CCSBot::Initialize(const BotProfile *profile)
|
|||
|
||||
// Reset internal data to initial state
|
||||
|
||||
void CCSBot::ResetValues()
|
||||
void CHLBot::ResetValues()
|
||||
{
|
||||
m_chatter.Reset();
|
||||
m_gameState.Reset();
|
||||
|
@ -277,9 +277,9 @@ void CCSBot::ResetValues()
|
|||
// Called when bot is placed in map, and when bots are reset after a round ends.
|
||||
// NOTE: For some reason, this can be called twice when a bot is added.
|
||||
|
||||
void CCSBot::SpawnBot()
|
||||
void CHLBot::SpawnBot()
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
ctrl->ValidateMapData();
|
||||
ResetValues();
|
||||
|
@ -287,7 +287,7 @@ void CCSBot::SpawnBot()
|
|||
Q_strcpy(m_name, STRING(pev->netname));
|
||||
|
||||
SetState(&m_followState);
|
||||
SetTouch(&CCSBot::BotTouch);
|
||||
SetTouch(&CHLBot::BotTouch);
|
||||
|
||||
if (!TheNavAreaList.Count () && !ctrl->IsLearningMap())
|
||||
{
|
||||
|
@ -296,14 +296,14 @@ void CCSBot::SpawnBot()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBot::RoundRespawn()
|
||||
void CHLBot::RoundRespawn()
|
||||
{
|
||||
// do the normal player spawn process
|
||||
//CBasePlayer::RoundRespawn();
|
||||
// EndVoiceFeedback();
|
||||
}
|
||||
|
||||
void CCSBot::Disconnect()
|
||||
void CHLBot::Disconnect()
|
||||
{
|
||||
// EndVoiceFeedback();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CNavNode *CCSBot::AddNode(const Vector *destPos, const Vector *normal, NavDirType dir, CNavNode *source)
|
||||
CNavNode *CHLBot::AddNode(const Vector *destPos, const Vector *normal, NavDirType dir, CNavNode *source)
|
||||
{
|
||||
// check if a node exists at this location
|
||||
CNavNode *node = const_cast<CNavNode *>(CNavNode::GetNode(destPos));
|
||||
|
@ -142,7 +142,7 @@ void hideProgressMeter()
|
|||
#endif
|
||||
}
|
||||
|
||||
void CCSBot::StartLearnProcess()
|
||||
void CHLBot::StartLearnProcess()
|
||||
{
|
||||
startProgressMeter("Analyzing map geometry...");
|
||||
drawProgressMeter(0, "Analyzing map geometry...");
|
||||
|
@ -178,7 +178,7 @@ void CCSBot::StartLearnProcess()
|
|||
// Sample the map one "step" in a cardinal direction to learn the map.
|
||||
// Returns true if sampling needs to continue, or false if done.
|
||||
|
||||
bool CCSBot::LearnStep()
|
||||
bool CHLBot::LearnStep()
|
||||
{
|
||||
// take a step
|
||||
while (true)
|
||||
|
@ -353,7 +353,7 @@ bool CCSBot::LearnStep()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBot::UpdateLearnProcess()
|
||||
void CHLBot::UpdateLearnProcess()
|
||||
{
|
||||
float startTime = g_engfuncs.pfnTime();
|
||||
while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration)
|
||||
|
@ -366,7 +366,7 @@ void CCSBot::UpdateLearnProcess()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBot::StartAnalyzeAlphaProcess()
|
||||
void CHLBot::StartAnalyzeAlphaProcess()
|
||||
{
|
||||
m_processMode = PROCESS_ANALYZE_ALPHA;
|
||||
m_analyzeIter = TheNavAreaList.Head ();
|
||||
|
@ -380,7 +380,7 @@ void CCSBot::StartAnalyzeAlphaProcess()
|
|||
drawProgressMeter(0, "Analyzing hiding spots...");
|
||||
}
|
||||
|
||||
bool CCSBot::AnalyzeAlphaStep()
|
||||
bool CHLBot::AnalyzeAlphaStep()
|
||||
{
|
||||
++_currentIndex;
|
||||
if (m_analyzeIter == TheNavAreaList.InvalidIndex ())
|
||||
|
@ -394,7 +394,7 @@ bool CCSBot::AnalyzeAlphaStep()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CCSBot::UpdateAnalyzeAlphaProcess()
|
||||
void CHLBot::UpdateAnalyzeAlphaProcess()
|
||||
{
|
||||
float startTime = g_engfuncs.pfnTime();
|
||||
while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration)
|
||||
|
@ -411,7 +411,7 @@ void CCSBot::UpdateAnalyzeAlphaProcess()
|
|||
drawProgressMeter(progress, "Analyzing hiding spots...");
|
||||
}
|
||||
|
||||
void CCSBot::StartAnalyzeBetaProcess()
|
||||
void CHLBot::StartAnalyzeBetaProcess()
|
||||
{
|
||||
m_processMode = PROCESS_ANALYZE_BETA;
|
||||
m_analyzeIter = TheNavAreaList.Head ();
|
||||
|
@ -420,7 +420,7 @@ void CCSBot::StartAnalyzeBetaProcess()
|
|||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
bool CCSBot::AnalyzeBetaStep()
|
||||
bool CHLBot::AnalyzeBetaStep()
|
||||
{
|
||||
++_currentIndex;
|
||||
if (m_analyzeIter == TheNavAreaList.InvalidIndex ())
|
||||
|
@ -434,7 +434,7 @@ bool CCSBot::AnalyzeBetaStep()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CCSBot::UpdateAnalyzeBetaProcess()
|
||||
void CHLBot::UpdateAnalyzeBetaProcess()
|
||||
{
|
||||
float startTime = g_engfuncs.pfnTime();
|
||||
while (g_engfuncs.pfnTime() - startTime < updateTimesliceDuration)
|
||||
|
@ -451,12 +451,12 @@ void CCSBot::UpdateAnalyzeBetaProcess()
|
|||
drawProgressMeter(progress, "Analyzing approach points...");
|
||||
}
|
||||
|
||||
void CCSBot::StartSaveProcess()
|
||||
void CHLBot::StartSaveProcess()
|
||||
{
|
||||
m_processMode = PROCESS_SAVE;
|
||||
}
|
||||
|
||||
void CCSBot::UpdateSaveProcess()
|
||||
void CHLBot::UpdateSaveProcess()
|
||||
{
|
||||
char filename[256];
|
||||
char msg[256];
|
||||
|
@ -480,7 +480,7 @@ void CCSBot::UpdateSaveProcess()
|
|||
SERVER_COMMAND(cmd);
|
||||
}
|
||||
|
||||
void CCSBot::StartNormalProcess()
|
||||
void CHLBot::StartNormalProcess()
|
||||
{
|
||||
m_processMode = PROCESS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Listen for enemy noises, and determine if we should react to them.
|
||||
// Returns true if heard a noise and should move to investigate.
|
||||
|
||||
bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
|
||||
bool CHLBot::ShouldInvestigateNoise(float *retNoiseDist)
|
||||
{
|
||||
if (m_isNoiseTravelRangeChecked)
|
||||
return false;
|
||||
|
@ -72,7 +72,7 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
|
|||
// Return true if we hear nearby threatening enemy gunfire within given range
|
||||
// -1 == infinite range
|
||||
|
||||
bool CCSBot::CanHearNearbyEnemyGunfire(float range) const
|
||||
bool CHLBot::CanHearNearbyEnemyGunfire(float range) const
|
||||
{
|
||||
// only attend to noise if it just happened
|
||||
if (gpGlobals->time - m_noiseTimestamp > 0.5f)
|
||||
|
@ -107,7 +107,7 @@ bool CCSBot::CanHearNearbyEnemyGunfire(float range) const
|
|||
// NOTE: Dont check FOV, since this is used to determine if we should turn our head to look at the noise
|
||||
// NOTE: Dont use IsVisible(), because smoke shouldnt cause us to not look toward noises
|
||||
|
||||
bool CCSBot::CanSeeNoisePosition() const
|
||||
bool CHLBot::CanSeeNoisePosition() const
|
||||
{
|
||||
TraceResult result;
|
||||
UTIL_TraceLine(GetEyePosition(), m_noisePosition + Vector(0, 0, HalfHumanHeight), ignore_monsters, ignore_glass, ENT(pev), &result);
|
||||
|
@ -124,7 +124,7 @@ bool CCSBot::CanSeeNoisePosition() const
|
|||
// Return true if we decided to look towards the most recent noise source
|
||||
// Assumes m_noisePosition is valid.
|
||||
|
||||
bool CCSBot::UpdateLookAtNoise()
|
||||
bool CHLBot::UpdateLookAtNoise()
|
||||
{
|
||||
// make sure a noise exists
|
||||
if (!IsNoiseHeard() || gpGlobals->time - m_noiseTimestamp > 0.5f)
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
*/
|
||||
CBotManager *TheBots = NULL;
|
||||
|
||||
float CCSBotManager::m_flNextCVarCheck = 0.0f;
|
||||
bool CCSBotManager::m_isMapDataLoaded = false;
|
||||
bool CCSBotManager::m_isLearningMap = false;
|
||||
bool CCSBotManager::m_isAnalysisRequested = false;
|
||||
NavEditCmdType CCSBotManager::m_editCmd = EDIT_NONE;
|
||||
float CHLBotManager::m_flNextCVarCheck = 0.0f;
|
||||
bool CHLBotManager::m_isMapDataLoaded = false;
|
||||
bool CHLBotManager::m_isLearningMap = false;
|
||||
bool CHLBotManager::m_isAnalysisRequested = false;
|
||||
NavEditCmdType CHLBotManager::m_editCmd = EDIT_NONE;
|
||||
|
||||
|
||||
CCSBotManager::CCSBotManager()
|
||||
CHLBotManager::CHLBotManager()
|
||||
{
|
||||
m_flNextCVarCheck = 0.0f;
|
||||
|
||||
|
@ -80,7 +80,7 @@ CCSBotManager::CCSBotManager()
|
|||
|
||||
// Invoked when a new round begins
|
||||
|
||||
void CCSBotManager::RestartRound()
|
||||
void CHLBotManager::RestartRound()
|
||||
{
|
||||
// extend
|
||||
CBotManager::RestartRound();
|
||||
|
@ -162,7 +162,7 @@ void UTIL_DrawBox(Extent *extent, int lifetime, int red, int green, int blue)
|
|||
|
||||
// Called each frame
|
||||
|
||||
void CCSBotManager::StartFrame()
|
||||
void CHLBotManager::StartFrame()
|
||||
{
|
||||
// EXTEND
|
||||
CBotManager::StartFrame();
|
||||
|
@ -181,28 +181,28 @@ void CCSBotManager::StartFrame()
|
|||
|
||||
// Return true if the bot can use this weapon
|
||||
|
||||
bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
|
||||
bool CHLBotManager::IsWeaponUseable(CBasePlayerItem *item) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return true if this player is on "defense"
|
||||
|
||||
bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
|
||||
bool CHLBotManager::IsOnDefense(CBasePlayer *player) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if this player is on "offense"
|
||||
|
||||
bool CCSBotManager::IsOnOffense(CBasePlayer *player) const
|
||||
bool CHLBotManager::IsOnOffense(CBasePlayer *player) const
|
||||
{
|
||||
return !IsOnDefense(player);
|
||||
}
|
||||
|
||||
// Invoked when a map has just been loaded
|
||||
|
||||
void CCSBotManager::ServerActivate()
|
||||
void CHLBotManager::ServerActivate()
|
||||
{
|
||||
DestroyNavigationMap();
|
||||
m_isMapDataLoaded = false;
|
||||
|
@ -222,12 +222,12 @@ void CCSBotManager::ServerActivate()
|
|||
TheBotPhrases->OnMapChange();
|
||||
}
|
||||
|
||||
void CCSBotManager::AddServerCommand(const char *cmd)
|
||||
void CHLBotManager::AddServerCommand(const char *cmd)
|
||||
{
|
||||
ADD_SERVER_COMMAND((char *)cmd, Bot_ServerCommand);
|
||||
}
|
||||
|
||||
void CCSBotManager::AddServerCommands()
|
||||
void CHLBotManager::AddServerCommands()
|
||||
{
|
||||
static bool fFirstTime = true;
|
||||
|
||||
|
@ -282,17 +282,17 @@ void CCSBotManager::AddServerCommands()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBotManager::ServerDeactivate()
|
||||
void CHLBotManager::ServerDeactivate()
|
||||
{
|
||||
m_bServerActive = false;
|
||||
}
|
||||
|
||||
void CCSBotManager::ClientDisconnect(CBasePlayer *pPlayer)
|
||||
void CHLBotManager::ClientDisconnect(CBasePlayer *pPlayer)
|
||||
{
|
||||
if (pPlayer != NULL && pPlayer->IsBot())
|
||||
{
|
||||
entvars_t *temp = VARS(pPlayer->edict());
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
CHLBot *pBot = static_cast<CHLBot *>(pPlayer);
|
||||
|
||||
if (pBot != NULL)
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ void PrintAllEntities()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
void CHLBotManager::ServerCommand(const char *pcmd)
|
||||
{
|
||||
if (!m_bServerActive)
|
||||
return;
|
||||
|
@ -646,7 +646,7 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
|||
|
||||
if (playerOrBot->IsBot())
|
||||
{
|
||||
CCSBot *bot = static_cast<CCSBot *>(playerOrBot);
|
||||
CHLBot *bot = static_cast<CHLBot *>(playerOrBot);
|
||||
if (bot != NULL)
|
||||
{
|
||||
bot->MoveTo(&area->m_center, FASTEST_ROUTE);
|
||||
|
@ -660,7 +660,7 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
|||
else if (FStrEq(pcmd, "bot_memory_usage"))
|
||||
{
|
||||
CONSOLE_ECHO("Memory usage:\n");
|
||||
CONSOLE_ECHO(" %d bytes per bot\b", sizeof(CCSBot));
|
||||
CONSOLE_ECHO(" %d bytes per bot\b", sizeof(CHLBot));
|
||||
CONSOLE_ECHO(" %d Navigation Areas @ %d bytes each = %d bytes\n",
|
||||
TheNavAreaGrid.GetNavAreaCount(),
|
||||
sizeof(CNavArea),
|
||||
|
@ -718,14 +718,14 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL CCSBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
||||
BOOL CHLBotManager::ClientCommand(CBasePlayer *pPlayer, const char *pcmd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Process the "bot_add" console command
|
||||
|
||||
bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
bool CHLBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
||||
{
|
||||
// dont allow bots to join if the Navigation Area is being generated
|
||||
if (m_isLearningMap)
|
||||
|
@ -797,7 +797,7 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
|
|||
|
||||
// Keep a minimum quota of bots in the game
|
||||
|
||||
void CCSBotManager::MaintainBotQuota()
|
||||
void CHLBotManager::MaintainBotQuota()
|
||||
{
|
||||
if (m_isLearningMap)
|
||||
return;
|
||||
|
@ -847,7 +847,7 @@ void CCSBotManager::MaintainBotQuota()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBotManager::MonitorBotCVars()
|
||||
void CHLBotManager::MonitorBotCVars()
|
||||
{
|
||||
if (cv_bot_nav_edit.value != 0.0f)
|
||||
{
|
||||
|
@ -869,7 +869,7 @@ void CCSBotManager::MonitorBotCVars()
|
|||
class CollectOverlappingAreas
|
||||
{
|
||||
public:
|
||||
CollectOverlappingAreas(CCSBotManager::Zone *zone)
|
||||
CollectOverlappingAreas(CHLBotManager::Zone *zone)
|
||||
{
|
||||
m_zone = zone;
|
||||
zone->m_areaCount = 0;
|
||||
|
@ -884,7 +884,7 @@ public:
|
|||
{
|
||||
// area overlaps m_zone
|
||||
m_zone->m_area[ m_zone->m_areaCount++ ] = area;
|
||||
if (m_zone->m_areaCount == CCSBotManager::MAX_ZONE_NAV_AREAS)
|
||||
if (m_zone->m_areaCount == CHLBotManager::MAX_ZONE_NAV_AREAS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -894,12 +894,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
CCSBotManager::Zone *m_zone;
|
||||
CHLBotManager::Zone *m_zone;
|
||||
};
|
||||
|
||||
// Search the map entities to determine the game scenario and define important zones.
|
||||
|
||||
void CCSBotManager::ValidateMapData()
|
||||
void CHLBotManager::ValidateMapData()
|
||||
{
|
||||
if (m_isMapDataLoaded )
|
||||
return;
|
||||
|
@ -1039,9 +1039,9 @@ void CCSBotManager::ValidateMapData()
|
|||
}
|
||||
}
|
||||
|
||||
bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
|
||||
bool CHLBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
|
||||
{
|
||||
CCSBot *pBot = CreateBot<CCSBot>(profile);
|
||||
CHLBot *pBot = CreateBot<CHLBot>(profile);
|
||||
if (pBot == NULL)
|
||||
{
|
||||
return false;
|
||||
|
@ -1058,7 +1058,7 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
|
|||
|
||||
// Return the zone that contains the given position
|
||||
|
||||
const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const
|
||||
const CHLBotManager::Zone *CHLBotManager::GetZone(const Vector *pos) const
|
||||
{
|
||||
for (int z = 0; z < m_zoneCount; ++z)
|
||||
{
|
||||
|
@ -1073,7 +1073,7 @@ const CCSBotManager::Zone *CCSBotManager::GetZone(const Vector *pos) const
|
|||
|
||||
// Return the closest zone to the given position
|
||||
|
||||
const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) const
|
||||
const CHLBotManager::Zone *CHLBotManager::GetClosestZone(const Vector *pos) const
|
||||
{
|
||||
const Zone *close = NULL;
|
||||
float closeRangeSq = 1e9f;
|
||||
|
@ -1094,7 +1094,7 @@ const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) cons
|
|||
|
||||
// Return a random position inside the given zone
|
||||
|
||||
const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
|
||||
const Vector *CHLBotManager::GetRandomPositionInZone(const Zone *zone) const
|
||||
{
|
||||
static Vector pos;
|
||||
|
||||
|
@ -1133,7 +1133,7 @@ const Vector *CCSBotManager::GetRandomPositionInZone(const Zone *zone) const
|
|||
|
||||
// Return a random area inside the given zone
|
||||
|
||||
CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
|
||||
CNavArea *CHLBotManager::GetRandomAreaInZone(const Zone *zone) const
|
||||
{
|
||||
// TODO: improvement is needed
|
||||
if (!zone->m_areaCount)
|
||||
|
@ -1142,7 +1142,7 @@ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
|
|||
return zone->m_area[ RANDOM_LONG(0, zone->m_areaCount - 1) ];
|
||||
}
|
||||
|
||||
void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CHLBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
|
@ -1184,12 +1184,12 @@ void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntit
|
|||
|
||||
// Get the time remaining before the planted bomb explodes
|
||||
|
||||
float CCSBotManager::GetBombTimeLeft() const
|
||||
float CHLBotManager::GetBombTimeLeft() const
|
||||
{
|
||||
return 10;//(g_pGameRules->m_iC4Timer - (gpGlobals->time - m_bombPlantTimestamp));
|
||||
}
|
||||
|
||||
void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
|
||||
void CHLBotManager::SetLooseBomb(CBaseEntity *bomb)
|
||||
{
|
||||
m_looseBomb = bomb;
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
|
|||
|
||||
// Return true if player is important to scenario (VIP, bomb carrier, etc)
|
||||
|
||||
bool CCSBotManager::IsImportantPlayer(CBasePlayer *player) const
|
||||
bool CHLBotManager::IsImportantPlayer(CBasePlayer *player) const
|
||||
{
|
||||
// everyone is equally important in a deathmatch
|
||||
return false;
|
||||
|
@ -1213,7 +1213,7 @@ bool CCSBotManager::IsImportantPlayer(CBasePlayer *player) const
|
|||
|
||||
// Return priority of player (0 = max pri)
|
||||
|
||||
unsigned int CCSBotManager::GetPlayerPriority(CBasePlayer *player) const
|
||||
unsigned int CHLBotManager::GetPlayerPriority(CBasePlayer *player) const
|
||||
{
|
||||
const unsigned int lowestPriority = 0xFFFFFFFF;
|
||||
|
||||
|
@ -1224,7 +1224,7 @@ unsigned int CCSBotManager::GetPlayerPriority(CBasePlayer *player) const
|
|||
if (!player->IsBot())
|
||||
return 0;
|
||||
|
||||
CCSBot *bot = dynamic_cast<CCSBot *>(player);
|
||||
CHLBot *bot = dynamic_cast<CHLBot *>(player);
|
||||
|
||||
if (!bot)
|
||||
return 0;
|
||||
|
@ -1235,14 +1235,14 @@ unsigned int CCSBotManager::GetPlayerPriority(CBasePlayer *player) const
|
|||
// Return the last time the given radio message was sent for given team
|
||||
// 'teamID' can be CT or TERRORIST
|
||||
|
||||
float CCSBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) const
|
||||
float CHLBotManager::GetRadioMessageTimestamp(GameEventType event, int teamID) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return the interval since the last time this message was sent
|
||||
|
||||
float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) const
|
||||
float CHLBotManager::GetRadioMessageInterval(GameEventType event, int teamID) const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -1250,12 +1250,12 @@ float CCSBotManager::GetRadioMessageInterval(GameEventType event, int teamID) co
|
|||
// Set the given radio message timestamp.
|
||||
// 'teamID' can be CT or TERRORIST
|
||||
|
||||
void CCSBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
|
||||
void CHLBotManager::SetRadioMessageTimestamp(GameEventType event, int teamID)
|
||||
{
|
||||
}
|
||||
|
||||
// Reset all radio message timestamps
|
||||
|
||||
void CCSBotManager::ResetRadioMessageTimestamps()
|
||||
void CHLBotManager::ResetRadioMessageTimestamps()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
extern CBotManager *TheBots;
|
||||
|
||||
// The manager for Counter-Strike specific bots
|
||||
class CCSBotManager: public CBotManager
|
||||
class CHLBotManager: public CBotManager
|
||||
{
|
||||
public:
|
||||
CCSBotManager();
|
||||
CHLBotManager();
|
||||
|
||||
virtual void ClientDisconnect(CBasePlayer *pPlayer);
|
||||
virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd);
|
||||
|
@ -246,9 +246,9 @@ NOXREF inline int OtherTeam(int team)
|
|||
return 0;
|
||||
}
|
||||
|
||||
inline CCSBotManager *TheCSBots()
|
||||
inline CHLBotManager *TheCSBots()
|
||||
{
|
||||
return reinterpret_cast<CCSBotManager *>(TheBots);
|
||||
return reinterpret_cast<CHLBotManager *>(TheBots);
|
||||
}
|
||||
|
||||
void PrintAllEntities();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Reset the stuck-checker.
|
||||
|
||||
void CCSBot::ResetStuckMonitor()
|
||||
void CHLBot::ResetStuckMonitor()
|
||||
{
|
||||
if (m_isStuck)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ void CCSBot::ResetStuckMonitor()
|
|||
|
||||
// Test if we have become stuck
|
||||
|
||||
void CCSBot::StuckCheck()
|
||||
void CHLBot::StuckCheck()
|
||||
{
|
||||
// m_isStuck = false;
|
||||
// return;
|
||||
|
@ -100,7 +100,7 @@ void CCSBot::StuckCheck()
|
|||
|
||||
// Check if we need to jump due to height change
|
||||
|
||||
bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
|
||||
bool CHLBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
|
||||
{
|
||||
// don't try to jump again.
|
||||
if (m_isJumpCrouching)
|
||||
|
@ -141,7 +141,7 @@ bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
|
|||
|
||||
// Find "simple" ground height, treating current nav area as part of the floor
|
||||
|
||||
bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal)
|
||||
bool CHLBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal)
|
||||
{
|
||||
if (GetSimpleGroundHeight(pos, height, normal))
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Ve
|
|||
return false;
|
||||
}
|
||||
|
||||
Place CCSBot::GetPlace() const
|
||||
Place CHLBot::GetPlace() const
|
||||
{
|
||||
if (m_lastKnownArea != NULL)
|
||||
return m_lastKnownArea->GetPlace();
|
||||
|
@ -165,7 +165,7 @@ Place CCSBot::GetPlace() const
|
|||
return UNDEFINED_PLACE;
|
||||
}
|
||||
|
||||
void CCSBot::MoveTowardsPosition(const Vector *pos)
|
||||
void CHLBot::MoveTowardsPosition(const Vector *pos)
|
||||
{
|
||||
// Jump up on ledges
|
||||
// Because we may not be able to get to our goal position and enter the next
|
||||
|
@ -260,7 +260,7 @@ void CCSBot::MoveTowardsPosition(const Vector *pos)
|
|||
|
||||
// Move away from position, independant of view angle
|
||||
|
||||
NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
|
||||
NOXREF void CHLBot::MoveAwayFromPosition(const Vector *pos)
|
||||
{
|
||||
// compute our current forward and lateral vectors
|
||||
float angle = pev->v_angle[ YAW ];
|
||||
|
@ -290,7 +290,7 @@ NOXREF void CCSBot::MoveAwayFromPosition(const Vector *pos)
|
|||
|
||||
// Strafe (sidestep) away from position, independant of view angle
|
||||
|
||||
void CCSBot::StrafeAwayFromPosition(const Vector *pos)
|
||||
void CHLBot::StrafeAwayFromPosition(const Vector *pos)
|
||||
{
|
||||
// compute our current forward and lateral vectors
|
||||
float angle = pev->v_angle[ YAW ];
|
||||
|
@ -312,7 +312,7 @@ void CCSBot::StrafeAwayFromPosition(const Vector *pos)
|
|||
|
||||
// For getting un-stuck
|
||||
|
||||
void CCSBot::Wiggle()
|
||||
void CHLBot::Wiggle()
|
||||
{
|
||||
if (IsCrouching())
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ void CCSBot::Wiggle()
|
|||
|
||||
// Determine approach points from eye position and approach areas of current area
|
||||
|
||||
void CCSBot::ComputeApproachPoints()
|
||||
void CHLBot::ComputeApproachPoints()
|
||||
{
|
||||
m_approachPointCount = 0;
|
||||
|
||||
|
@ -399,7 +399,7 @@ void CCSBot::ComputeApproachPoints()
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBot::DrawApproachPoints()
|
||||
void CHLBot::DrawApproachPoints()
|
||||
{
|
||||
for (int i = 0; i < m_approachPointCount; ++i)
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ void CCSBot::DrawApproachPoints()
|
|||
|
||||
// Find the approach point that is nearest to our current path, ahead of us
|
||||
|
||||
NOXREF bool CCSBot::FindApproachPointNearestPath(Vector *pos)
|
||||
NOXREF bool CHLBot::FindApproachPointNearestPath(Vector *pos)
|
||||
{
|
||||
if (!HasPath())
|
||||
return false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Determine actual path positions bot will move between along the path
|
||||
|
||||
bool CCSBot::ComputePathPositions()
|
||||
bool CHLBot::ComputePathPositions()
|
||||
{
|
||||
if (m_pathLength == 0)
|
||||
return false;
|
||||
|
@ -124,7 +124,7 @@ bool CCSBot::ComputePathPositions()
|
|||
|
||||
// If next step of path uses a ladder, prepare to traverse it
|
||||
|
||||
void CCSBot::SetupLadderMovement()
|
||||
void CHLBot::SetupLadderMovement()
|
||||
{
|
||||
if (m_pathIndex < 1 || m_pathLength == 0)
|
||||
return;
|
||||
|
@ -185,7 +185,7 @@ void CCSBot::SetupLadderMovement()
|
|||
|
||||
// TODO: What about ladders whose top AND bottom are messed up?
|
||||
|
||||
void CCSBot::ComputeLadderEndpoint(bool isAscending)
|
||||
void CHLBot::ComputeLadderEndpoint(bool isAscending)
|
||||
{
|
||||
TraceResult result;
|
||||
Vector from, to;
|
||||
|
@ -218,7 +218,7 @@ void CCSBot::ComputeLadderEndpoint(bool isAscending)
|
|||
// Navigate our current ladder. Return true if we are doing ladder navigation.
|
||||
// TODO: Need Push() and Pop() for run/walk context to keep ladder speed contained.
|
||||
|
||||
bool CCSBot::UpdateLadderMovement()
|
||||
bool CHLBot::UpdateLadderMovement()
|
||||
{
|
||||
if (m_pathLadder == NULL)
|
||||
return false;
|
||||
|
@ -578,7 +578,7 @@ bool CCSBot::UpdateLadderMovement()
|
|||
// Compute closest point on path to given point
|
||||
// NOTE: This does not do line-of-sight tests, so closest point may be thru the floor, etc
|
||||
|
||||
bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const
|
||||
bool CHLBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const
|
||||
{
|
||||
if (!HasPath() || close == NULL)
|
||||
return false;
|
||||
|
@ -632,7 +632,7 @@ bool CCSBot::FindClosestPointOnPath(const Vector *worldPos, int startIndex, int
|
|||
// Return the closest point to our current position on our current path
|
||||
// If "local" is true, only check the portion of the path surrounding m_pathIndex.
|
||||
|
||||
int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
|
||||
int CHLBot::FindOurPositionOnPath(Vector *close, bool local) const
|
||||
{
|
||||
if (!HasPath())
|
||||
return -1;
|
||||
|
@ -718,7 +718,7 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
|
|||
|
||||
// Test for un-jumpable height change, or unrecoverable fall
|
||||
|
||||
bool CCSBot::IsStraightLinePathWalkable(const Vector *goal) const
|
||||
bool CHLBot::IsStraightLinePathWalkable(const Vector *goal) const
|
||||
{
|
||||
// this is causing hang-up problems when crawling thru ducts/windows that drop off into rooms (they fail the "falling" check)
|
||||
return true;
|
||||
|
@ -775,7 +775,7 @@ return true;
|
|||
// Compute a point a fixed distance ahead along our path.
|
||||
// Returns path index just after point.
|
||||
|
||||
int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
int CHLBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
||||
{
|
||||
// find path index just past aheadRange
|
||||
int afterIndex;
|
||||
|
@ -1013,7 +1013,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
|
|||
|
||||
// Set the current index along the path
|
||||
|
||||
void CCSBot::SetPathIndex(int newIndex)
|
||||
void CHLBot::SetPathIndex(int newIndex)
|
||||
{
|
||||
m_pathIndex = Q_min(newIndex, m_pathLength - 1);
|
||||
m_areaEnteredTimestamp = gpGlobals->time;
|
||||
|
@ -1036,7 +1036,7 @@ void CCSBot::SetPathIndex(int newIndex)
|
|||
|
||||
// Return true if nearing a jump in the path
|
||||
|
||||
bool CCSBot::IsNearJump() const
|
||||
bool CHLBot::IsNearJump() const
|
||||
{
|
||||
if (m_pathIndex == 0 || m_pathIndex >= m_pathLength)
|
||||
return false;
|
||||
|
@ -1057,7 +1057,7 @@ bool CCSBot::IsNearJump() const
|
|||
|
||||
// Return approximately how much damage will will take from the given fall height
|
||||
|
||||
float CCSBot::GetApproximateFallDamage(float height) const
|
||||
float CHLBot::GetApproximateFallDamage(float height) const
|
||||
{
|
||||
// empirically discovered height values
|
||||
const float slope = 0.2178f;
|
||||
|
@ -1073,7 +1073,7 @@ float CCSBot::GetApproximateFallDamage(float height) const
|
|||
|
||||
// Return true if a friend is between us and the given position
|
||||
|
||||
bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
|
||||
bool CHLBot::IsFriendInTheWay(const Vector *goalPos) const
|
||||
{
|
||||
// do this check less often to ease CPU burden
|
||||
if (!m_avoidFriendTimer.IsElapsed())
|
||||
|
@ -1149,7 +1149,7 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
|
|||
|
||||
// Do reflex avoidance movements if our "feelers" are touched
|
||||
|
||||
void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
|
||||
void CHLBot::FeelerReflexAdjustment(Vector *goalPosition)
|
||||
{
|
||||
// if we are in a "precise" area, do not do feeler adjustments
|
||||
if (m_lastKnownArea != NULL && (m_lastKnownArea->GetAttributes() & NAV_PRECISE))
|
||||
|
@ -1254,7 +1254,7 @@ void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
|
|||
|
||||
// Move along the path. Return false if end of path reached.
|
||||
|
||||
CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
CHLBot::PathResult CHLBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
{
|
||||
if (m_pathLength == 0)
|
||||
return PATH_FAILURE;
|
||||
|
@ -1560,7 +1560,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
|||
|
||||
// Build trivial path to goal, assuming we are already in the same area
|
||||
|
||||
void CCSBot::BuildTrivialPath(const Vector *goal)
|
||||
void CHLBot::BuildTrivialPath(const Vector *goal)
|
||||
{
|
||||
m_pathIndex = 1;
|
||||
m_pathLength = 2;
|
||||
|
@ -1587,7 +1587,7 @@ void CCSBot::BuildTrivialPath(const Vector *goal)
|
|||
// Compute shortest path to goal position via A* algorithm
|
||||
// If 'goalArea' is NULL, path will get as close as it can.
|
||||
|
||||
bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route)
|
||||
bool CHLBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route)
|
||||
{
|
||||
// Throttle re-pathing
|
||||
if (!m_repathTimer.IsElapsed())
|
||||
|
@ -1715,7 +1715,7 @@ bool CCSBot::ComputePath(CNavArea *goalArea, const Vector *goal, RouteType route
|
|||
|
||||
// Return estimated distance left to travel along path
|
||||
|
||||
float CCSBot::GetPathDistanceRemaining() const
|
||||
float CHLBot::GetPathDistanceRemaining() const
|
||||
{
|
||||
if (!HasPath())
|
||||
return -1.0f;
|
||||
|
@ -1736,7 +1736,7 @@ float CCSBot::GetPathDistanceRemaining() const
|
|||
|
||||
// Draw a portion of our current path for debugging.
|
||||
|
||||
void CCSBot::DrawPath()
|
||||
void CHLBot::DrawPath()
|
||||
{
|
||||
if (!HasPath())
|
||||
return;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Returns true if the radio message is an order to do something
|
||||
// NOTE: "Report in" is not considered a "command" because it doesnt ask the bot to go somewhere, or change its mind
|
||||
bool CCSBot::IsRadioCommand(GameEventType event) const
|
||||
bool CHLBot::IsRadioCommand(GameEventType event) const
|
||||
{
|
||||
if (event == EVENT_RADIO_AFFIRMATIVE
|
||||
|| event == EVENT_RADIO_NEGATIVE
|
||||
|
@ -18,7 +18,7 @@ bool CCSBot::IsRadioCommand(GameEventType event) const
|
|||
|
||||
// Respond to radio commands from HUMAN players
|
||||
|
||||
void CCSBot::RespondToRadioCommands()
|
||||
void CHLBot::RespondToRadioCommands()
|
||||
{
|
||||
// bots use the chatter system to respond to each other
|
||||
if (m_radioSubject != NULL && m_radioSubject->IsPlayer())
|
||||
|
@ -72,7 +72,7 @@ void CCSBot::RespondToRadioCommands()
|
|||
return;
|
||||
}
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
CBasePlayer *player = m_radioSubject;
|
||||
if (player == NULL)
|
||||
return;
|
||||
|
@ -152,11 +152,11 @@ void CCSBot::RespondToRadioCommands()
|
|||
{
|
||||
// if this is a defusal scenario, and the bomb is planted,
|
||||
// and a human player cleared a bombsite, check it off our list too
|
||||
if (ctrl->GetScenario() == CCSBotManager::SCENARIO_DEFUSE_BOMB)
|
||||
if (ctrl->GetScenario() == CHLBotManager::SCENARIO_DEFUSE_BOMB)
|
||||
{
|
||||
if (m_iTeam == CT && ctrl->IsBombPlanted())
|
||||
{
|
||||
const CCSBotManager::Zone *zone = ctrl->GetClosestZone(player);
|
||||
const CHLBotManager::Zone *zone = ctrl->GetClosestZone(player);
|
||||
|
||||
if (zone != NULL)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ void CCSBot::RespondToRadioCommands()
|
|||
|
||||
// Send voice chatter. Also sends the entindex.
|
||||
|
||||
void CCSBot::StartVoiceFeedback(float duration)
|
||||
void CHLBot::StartVoiceFeedback(float duration)
|
||||
{
|
||||
m_voiceFeedbackStartTimestamp = gpGlobals->time;
|
||||
m_voiceFeedbackEndTimestamp = duration + gpGlobals->time;
|
||||
|
@ -210,7 +210,7 @@ void CCSBot::StartVoiceFeedback(float duration)
|
|||
}
|
||||
}
|
||||
|
||||
void CCSBot::EndVoiceFeedback(bool force)
|
||||
void CHLBot::EndVoiceFeedback(bool force)
|
||||
{
|
||||
if (!force && !m_voiceFeedbackEndTimestamp)
|
||||
return;
|
||||
|
@ -225,7 +225,7 @@ void CCSBot::EndVoiceFeedback(bool force)
|
|||
|
||||
// Decide if we should move to help the player, return true if we will
|
||||
|
||||
bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange)
|
||||
bool CHLBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange)
|
||||
{
|
||||
if (IsRogue())
|
||||
return false;
|
||||
|
@ -286,7 +286,7 @@ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange
|
|||
|
||||
// Send a radio message
|
||||
|
||||
void CCSBot::SendRadioMessage(GameEventType event)
|
||||
void CHLBot::SendRadioMessage(GameEventType event)
|
||||
{
|
||||
// make sure this is a radio event
|
||||
if (event <= EVENT_START_RADIO_1 || event >= EVENT_END_RADIO)
|
||||
|
@ -294,7 +294,7 @@ void CCSBot::SendRadioMessage(GameEventType event)
|
|||
return;
|
||||
}
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
|
||||
|
||||
// note the time the message was sent
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// This method is the ONLY legal way to change a bot's current state
|
||||
|
||||
void CCSBot::SetState(BotState *state)
|
||||
void CHLBot::SetState(BotState *state)
|
||||
{
|
||||
PrintIfWatched("SetState: %s -> %s\n", (m_state != NULL) ? m_state->GetName() : "NULL", state->GetName());
|
||||
|
||||
|
@ -19,13 +19,13 @@ void CCSBot::SetState(BotState *state)
|
|||
m_stateTimestamp = gpGlobals->time;
|
||||
}
|
||||
|
||||
void CCSBot::Idle()
|
||||
void CHLBot::Idle()
|
||||
{
|
||||
SetTask(SEEK_AND_DESTROY);
|
||||
SetState(&m_idleState);
|
||||
}
|
||||
|
||||
void CCSBot::Follow(CBasePlayer *player)
|
||||
void CHLBot::Follow(CBasePlayer *player)
|
||||
{
|
||||
if (player == NULL)
|
||||
return;
|
||||
|
@ -44,7 +44,7 @@ void CCSBot::Follow(CBasePlayer *player)
|
|||
|
||||
// Continue following our leader after finishing what we were doing
|
||||
|
||||
void CCSBot::ContinueFollowing()
|
||||
void CHLBot::ContinueFollowing()
|
||||
{
|
||||
SetTask(FOLLOW);
|
||||
m_followState.SetLeader(m_leader);
|
||||
|
@ -53,7 +53,7 @@ void CCSBot::ContinueFollowing()
|
|||
|
||||
// Stop following
|
||||
|
||||
void CCSBot::StopFollowing()
|
||||
void CHLBot::StopFollowing()
|
||||
{
|
||||
m_isFollowing = false;
|
||||
m_leader = NULL;
|
||||
|
@ -62,7 +62,7 @@ void CCSBot::StopFollowing()
|
|||
|
||||
// Use the entity
|
||||
|
||||
void CCSBot::UseEntity(CBaseEntity *entity)
|
||||
void CHLBot::UseEntity(CBaseEntity *entity)
|
||||
{
|
||||
m_useEntityState.SetEntity(entity);
|
||||
SetState(&m_useEntityState);
|
||||
|
@ -72,7 +72,7 @@ void CCSBot::UseEntity(CBaseEntity *entity)
|
|||
// Move to a hiding place.
|
||||
// If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first.
|
||||
|
||||
void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition)
|
||||
void CHLBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition)
|
||||
{
|
||||
DestroyPath();
|
||||
|
||||
|
@ -131,7 +131,7 @@ void CCSBot::Hide(CNavArea *searchFromArea, float duration, float hideRange, boo
|
|||
|
||||
// Move to the given hiding place
|
||||
|
||||
void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition)
|
||||
void CHLBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition)
|
||||
{
|
||||
CNavArea *hideArea = TheNavAreaGrid.GetNearestNavArea(hidingSpot);
|
||||
if (hideArea == NULL)
|
||||
|
@ -163,7 +163,7 @@ void CCSBot::Hide(const Vector *hidingSpot, float duration, bool holdPosition)
|
|||
// Try to hide nearby. Return true if hiding, false if can't hide here.
|
||||
// If 'searchFromArea' is non-NULL, hiding spots are looked for from that area first.
|
||||
|
||||
bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition, bool useNearest)
|
||||
bool CHLBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange, bool holdPosition, bool useNearest)
|
||||
{
|
||||
CNavArea *source;
|
||||
Vector sourcePos;
|
||||
|
@ -212,7 +212,7 @@ bool CCSBot::TryToHide(CNavArea *searchFromArea, float duration, float hideRange
|
|||
|
||||
// Retreat to a nearby hiding spot, away from enemies
|
||||
|
||||
bool CCSBot::TryToRetreat()
|
||||
bool CHLBot::TryToRetreat()
|
||||
{
|
||||
const float maxRange = 1000.0f;
|
||||
const Vector *spot = FindNearbyRetreatSpot(this, maxRange);
|
||||
|
@ -236,7 +236,7 @@ bool CCSBot::TryToRetreat()
|
|||
return false;
|
||||
}
|
||||
|
||||
void CCSBot::Hunt()
|
||||
void CHLBot::Hunt()
|
||||
{
|
||||
SetState(&m_huntState);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ void CCSBot::Hunt()
|
|||
// Attack our the given victim
|
||||
// NOTE: Attacking does not change our task.
|
||||
|
||||
void CCSBot::Attack(CBasePlayer *victim)
|
||||
void CHLBot::Attack(CBasePlayer *victim)
|
||||
{
|
||||
if (victim == NULL)
|
||||
return;
|
||||
|
@ -304,7 +304,7 @@ void CCSBot::Attack(CBasePlayer *victim)
|
|||
|
||||
// Exit the Attack state
|
||||
|
||||
void CCSBot::StopAttacking()
|
||||
void CHLBot::StopAttacking()
|
||||
{
|
||||
PrintIfWatched("ATTACK END\n");
|
||||
m_attackState.OnExit(this);
|
||||
|
@ -317,14 +317,14 @@ void CCSBot::StopAttacking()
|
|||
}
|
||||
}
|
||||
|
||||
bool CCSBot::IsAttacking() const
|
||||
bool CHLBot::IsAttacking() const
|
||||
{
|
||||
return m_isAttacking;
|
||||
}
|
||||
|
||||
// Return true if we are hiding
|
||||
|
||||
bool CCSBot::IsHiding() const
|
||||
bool CHLBot::IsHiding() const
|
||||
{
|
||||
if (m_state == static_cast<const BotState *>(&m_hideState))
|
||||
return true;
|
||||
|
@ -334,7 +334,7 @@ bool CCSBot::IsHiding() const
|
|||
|
||||
// Return true if we are hiding and at our hiding spot
|
||||
|
||||
bool CCSBot::IsAtHidingSpot() const
|
||||
bool CHLBot::IsAtHidingSpot() const
|
||||
{
|
||||
if (!IsHiding())
|
||||
return false;
|
||||
|
@ -344,7 +344,7 @@ bool CCSBot::IsAtHidingSpot() const
|
|||
|
||||
// Return true if we are huting
|
||||
|
||||
bool CCSBot::IsHunting() const
|
||||
bool CHLBot::IsHunting() const
|
||||
{
|
||||
if (m_state == static_cast<const BotState *>(&m_huntState))
|
||||
return true;
|
||||
|
@ -354,7 +354,7 @@ bool CCSBot::IsHunting() const
|
|||
|
||||
// Return true if we are in the MoveTo state
|
||||
|
||||
bool CCSBot::IsMovingTo() const
|
||||
bool CHLBot::IsMovingTo() const
|
||||
{
|
||||
if (m_state == static_cast<const BotState *>(&m_moveToState))
|
||||
return true;
|
||||
|
@ -365,7 +365,7 @@ bool CCSBot::IsMovingTo() const
|
|||
|
||||
// Move to potentially distant position
|
||||
|
||||
void CCSBot::MoveTo(const Vector *pos, RouteType route)
|
||||
void CHLBot::MoveTo(const Vector *pos, RouteType route)
|
||||
{
|
||||
m_moveToState.SetGoalPosition(*pos);
|
||||
m_moveToState.SetRouteType(route);
|
||||
|
@ -375,7 +375,7 @@ void CCSBot::MoveTo(const Vector *pos, RouteType route)
|
|||
|
||||
// Investigate recent enemy noise
|
||||
|
||||
void CCSBot::InvestigateNoise()
|
||||
void CHLBot::InvestigateNoise()
|
||||
{
|
||||
SetState(&m_investigateNoiseState);
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
// Lightweight maintenance, invoked frequently
|
||||
|
||||
void CCSBot::Upkeep()
|
||||
void CHLBot::Upkeep()
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (ctrl->IsLearningMap() || !IsAlive())
|
||||
return;
|
||||
|
@ -151,9 +151,9 @@ void CCSBot::Upkeep()
|
|||
|
||||
// Heavyweight processing, invoked less often
|
||||
|
||||
void CCSBot::Update()
|
||||
void CHLBot::Update()
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Used to update view angles to stay on a ladder
|
||||
|
||||
float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder)
|
||||
float StayOnLadderLine(CHLBot *me, const CNavLadder *ladder)
|
||||
{
|
||||
// determine our facing
|
||||
NavDirType faceDir = AngleToDirection(me->pev->v_angle.y);
|
||||
|
@ -27,7 +27,7 @@ float StayOnLadderLine(CCSBot *me, const CNavLadder *ladder)
|
|||
// Move actual view angles towards desired ones.
|
||||
// This is the only place v_angle is altered.
|
||||
// TODO: Make stiffness and turn rate constants timestep invariant.
|
||||
void CCSBot::UpdateLookAngles()
|
||||
void CHLBot::UpdateLookAngles()
|
||||
{
|
||||
const float deltaT = g_flBotCommandInterval;
|
||||
float maxAccel;
|
||||
|
@ -193,14 +193,14 @@ void CCSBot::UpdateLookAngles()
|
|||
}
|
||||
|
||||
// Return true if we can see the point
|
||||
bool CCSBot::IsVisible(Vector *pos, bool testFOV) const
|
||||
bool CHLBot::IsVisible(Vector *pos, bool testFOV) const
|
||||
{
|
||||
// we can't see anything if we're blind
|
||||
// if (IsBlind())
|
||||
// return false;
|
||||
|
||||
// is it in my general viewcone?
|
||||
if (testFOV && !(const_cast<CCSBot *>(this)->FInViewCone(pos)))
|
||||
if (testFOV && !(const_cast<CHLBot *>(this)->FInViewCone(pos)))
|
||||
return false;
|
||||
|
||||
// check line of sight against smoke
|
||||
|
@ -221,7 +221,7 @@ bool CCSBot::IsVisible(Vector *pos, bool testFOV) const
|
|||
// Return true if we can see any part of the player
|
||||
// Check parts in order of importance. Return the first part seen in "visParts" if it is non-NULL.
|
||||
|
||||
bool CCSBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visParts) const
|
||||
bool CHLBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visParts) const
|
||||
{
|
||||
Vector spot = player->pev->origin;
|
||||
int testVisParts = NONE;
|
||||
|
@ -275,7 +275,7 @@ bool CCSBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visPart
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CCSBot::IsEnemyPartVisible(VisiblePartType part) const
|
||||
bool CHLBot::IsEnemyPartVisible(VisiblePartType part) const
|
||||
{
|
||||
if (!IsEnemyVisible())
|
||||
return false;
|
||||
|
@ -283,7 +283,7 @@ bool CCSBot::IsEnemyPartVisible(VisiblePartType part) const
|
|||
return (m_visibleEnemyParts & part) != 0;
|
||||
}
|
||||
|
||||
void CCSBot::UpdateLookAt()
|
||||
void CHLBot::UpdateLookAt()
|
||||
{
|
||||
Vector to = m_lookAtSpot - EyePosition();
|
||||
Vector idealAngle = UTIL_VecToAngles(to);
|
||||
|
@ -294,7 +294,7 @@ void CCSBot::UpdateLookAt()
|
|||
|
||||
// Look at the given point in space for the given duration (-1 means forever)
|
||||
|
||||
void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, float duration, bool clearIfClose, float angleTolerance)
|
||||
void CHLBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, float duration, bool clearIfClose, float angleTolerance)
|
||||
{
|
||||
if (pos == NULL)
|
||||
return;
|
||||
|
@ -328,14 +328,14 @@ void CCSBot::SetLookAt(const char *desc, const Vector *pos, PriorityType pri, fl
|
|||
|
||||
// Block all "look at" and "look around" behavior for given duration - just look ahead
|
||||
|
||||
void CCSBot::InhibitLookAround(float duration)
|
||||
void CHLBot::InhibitLookAround(float duration)
|
||||
{
|
||||
m_inhibitLookAroundTimestamp = gpGlobals->time + duration;
|
||||
}
|
||||
|
||||
// Update enounter spot timestamps, etc
|
||||
|
||||
void CCSBot::UpdatePeripheralVision()
|
||||
void CHLBot::UpdatePeripheralVision()
|
||||
{
|
||||
// if we update at 10Hz, this ensures we test once every three
|
||||
const float peripheralUpdateInterval = 0.29f;
|
||||
|
@ -371,7 +371,7 @@ void CCSBot::UpdatePeripheralVision()
|
|||
|
||||
// Update the "looking around" behavior.
|
||||
|
||||
void CCSBot::UpdateLookAround(bool updateNow)
|
||||
void CHLBot::UpdateLookAround(bool updateNow)
|
||||
{
|
||||
// check if looking around has been inhibited
|
||||
// Moved inhibit to allow high priority enemy lookats to still occur
|
||||
|
@ -558,7 +558,7 @@ void CCSBot::UpdateLookAround(bool updateNow)
|
|||
|
||||
// "Bend" our line of sight around corners until we can "see" the point.
|
||||
|
||||
bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const
|
||||
bool CHLBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *bend) const
|
||||
{
|
||||
// if we can directly see the point, use it
|
||||
TraceResult result;
|
||||
|
@ -637,7 +637,7 @@ bool CCSBot::BendLineOfSight(const Vector *eye, const Vector *point, Vector *ben
|
|||
return false;
|
||||
}
|
||||
|
||||
CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
CBasePlayer *CHLBot::FindMostDangerousThreat()
|
||||
{
|
||||
// maximum number of simulataneously attendable threats
|
||||
enum { MAX_THREATS = 16 };
|
||||
|
@ -791,7 +791,7 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
|||
{
|
||||
// find the area the player/bot is standing on
|
||||
CNavArea *area;
|
||||
CCSBot *bot = dynamic_cast<CCSBot *>(threat[i].enemy);
|
||||
CHLBot *bot = dynamic_cast<CHLBot *>(threat[i].enemy);
|
||||
if (bot != NULL && bot->IsBot())
|
||||
{
|
||||
area = bot->GetLastKnownArea();
|
||||
|
@ -866,7 +866,7 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
|||
|
||||
// Update our reaction time queue
|
||||
|
||||
void CCSBot::UpdateReactionQueue()
|
||||
void CHLBot::UpdateReactionQueue()
|
||||
{
|
||||
// zombies dont see any threats
|
||||
if (cv_bot_zombie.value > 0.0f)
|
||||
|
@ -917,7 +917,7 @@ void CCSBot::UpdateReactionQueue()
|
|||
|
||||
// Return the most dangerous threat we are "conscious" of
|
||||
|
||||
CBasePlayer *CCSBot::GetRecognizedEnemy()
|
||||
CBasePlayer *CHLBot::GetRecognizedEnemy()
|
||||
{
|
||||
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
|
||||
return NULL;
|
||||
|
@ -927,7 +927,7 @@ CBasePlayer *CCSBot::GetRecognizedEnemy()
|
|||
|
||||
// Return true if the enemy we are "conscious" of is reloading
|
||||
|
||||
bool CCSBot::IsRecognizedEnemyReloading()
|
||||
bool CHLBot::IsRecognizedEnemyReloading()
|
||||
{
|
||||
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
|
||||
return false;
|
||||
|
@ -937,7 +937,7 @@ bool CCSBot::IsRecognizedEnemyReloading()
|
|||
|
||||
// Return true if the enemy we are "conscious" of is hiding behind a shield
|
||||
|
||||
bool CCSBot::IsRecognizedEnemyProtectedByShield()
|
||||
bool CHLBot::IsRecognizedEnemyProtectedByShield()
|
||||
{
|
||||
if (m_enemyQueueAttendIndex >= m_enemyQueueCount)
|
||||
return false;
|
||||
|
@ -947,7 +947,7 @@ bool CCSBot::IsRecognizedEnemyProtectedByShield()
|
|||
|
||||
// Return distance to closest enemy we are "conscious" of
|
||||
|
||||
float CCSBot::GetRangeToNearestRecognizedEnemy()
|
||||
float CHLBot::GetRangeToNearestRecognizedEnemy()
|
||||
{
|
||||
const CBasePlayer *enemy = GetRecognizedEnemy();
|
||||
|
||||
|
@ -961,7 +961,7 @@ float CCSBot::GetRangeToNearestRecognizedEnemy()
|
|||
|
||||
// Blind the bot for the given duration
|
||||
|
||||
void CCSBot::Blind(float duration, float holdTime, float fadeTime, int alpha)
|
||||
void CHLBot::Blind(float duration, float holdTime, float fadeTime, int alpha)
|
||||
{
|
||||
// extend
|
||||
//CBasePlayer::Blind(duration, holdTime, fadeTime, alpha);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Fire our active weapon towards our current enemy
|
||||
// NOTE: Aiming our weapon is handled in RunBotUpkeep()
|
||||
|
||||
void CCSBot::FireWeaponAtEnemy()
|
||||
void CHLBot::FireWeaponAtEnemy()
|
||||
{
|
||||
CBasePlayer *enemy = GetEnemy();
|
||||
if (enemy == NULL)
|
||||
|
@ -150,7 +150,7 @@ void CCSBot::FireWeaponAtEnemy()
|
|||
|
||||
// Set the current aim offset using given accuracy (1.0 = perfect aim, 0.0f = terrible aim)
|
||||
|
||||
void CCSBot::SetAimOffset(float accuracy)
|
||||
void CHLBot::SetAimOffset(float accuracy)
|
||||
{
|
||||
// if our accuracy is less than perfect, it will improve as we "focus in" while not rotating our view
|
||||
if (accuracy < 1.0f)
|
||||
|
@ -192,7 +192,7 @@ void CCSBot::SetAimOffset(float accuracy)
|
|||
|
||||
// Wiggle aim error based on GetProfile()->GetSkill()
|
||||
|
||||
void CCSBot::UpdateAimOffset()
|
||||
void CHLBot::UpdateAimOffset()
|
||||
{
|
||||
if (gpGlobals->time >= m_aimOffsetTimestamp)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ void CCSBot::UpdateAimOffset()
|
|||
// Change our zoom level to be appropriate for the given range.
|
||||
// Return true if the zoom level changed.
|
||||
|
||||
bool CCSBot::AdjustZoom(float range)
|
||||
bool CHLBot::AdjustZoom(float range)
|
||||
{
|
||||
bool adjustZoom = false;
|
||||
|
||||
|
@ -278,7 +278,7 @@ bool isSniperRifle(CBasePlayerItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
bool CCSBot::IsUsingAWP() const
|
||||
bool CHLBot::IsUsingAWP() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -290,7 +290,7 @@ bool CCSBot::IsUsingAWP() const
|
|||
|
||||
// Returns true if we are using a weapon with a removable silencer
|
||||
|
||||
bool CCSBot::DoesActiveWeaponHaveSilencer() const
|
||||
bool CHLBot::DoesActiveWeaponHaveSilencer() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -305,7 +305,7 @@ bool CCSBot::DoesActiveWeaponHaveSilencer() const
|
|||
|
||||
// Return true if we are using a sniper rifle
|
||||
|
||||
bool CCSBot::IsUsingSniperRifle() const
|
||||
bool CHLBot::IsUsingSniperRifle() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -317,7 +317,7 @@ bool CCSBot::IsUsingSniperRifle() const
|
|||
|
||||
// Return true if we have a sniper rifle in our inventory
|
||||
|
||||
bool CCSBot::IsSniper() const
|
||||
bool CHLBot::IsSniper() const
|
||||
{
|
||||
for (int i = 0; i < MAX_ITEM_TYPES; ++i)
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ bool CCSBot::IsSniper() const
|
|||
|
||||
// Return true if we are actively sniping (moving to sniper spot or settled in)
|
||||
|
||||
bool CCSBot::IsSniping() const
|
||||
bool CHLBot::IsSniping() const
|
||||
{
|
||||
if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING)
|
||||
return true;
|
||||
|
@ -347,7 +347,7 @@ bool CCSBot::IsSniping() const
|
|||
|
||||
// Return true if we are using a shotgun
|
||||
|
||||
bool CCSBot::IsUsingShotgun() const
|
||||
bool CHLBot::IsUsingShotgun() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -362,7 +362,7 @@ bool CCSBot::IsUsingShotgun() const
|
|||
|
||||
// Returns true if using the big 'ol machinegun
|
||||
|
||||
bool CCSBot::IsUsingMachinegun() const
|
||||
bool CHLBot::IsUsingMachinegun() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -374,7 +374,7 @@ bool CCSBot::IsUsingMachinegun() const
|
|||
|
||||
// Return true if primary weapon doesn't exist or is totally out of ammo
|
||||
|
||||
bool CCSBot::IsPrimaryWeaponEmpty() const
|
||||
bool CHLBot::IsPrimaryWeaponEmpty() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 2 ]);
|
||||
|
||||
|
@ -390,7 +390,7 @@ bool CCSBot::IsPrimaryWeaponEmpty() const
|
|||
|
||||
// Return true if pistol doesn't exist or is totally out of ammo
|
||||
|
||||
bool CCSBot::IsPistolEmpty() const
|
||||
bool CHLBot::IsPistolEmpty() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 1 ]);
|
||||
|
||||
|
@ -408,7 +408,7 @@ bool CCSBot::IsPistolEmpty() const
|
|||
|
||||
// Equip the given item
|
||||
|
||||
bool CCSBot::DoEquip(CBasePlayerWeapon *gun)
|
||||
bool CHLBot::DoEquip(CBasePlayerWeapon *gun)
|
||||
{
|
||||
if (gun == NULL)
|
||||
return false;
|
||||
|
@ -429,13 +429,13 @@ const float minEquipInterval = 5.0f;
|
|||
|
||||
// Equip the best weapon we are carrying that has ammo
|
||||
|
||||
void CCSBot::EquipBestWeapon(bool mustEquip)
|
||||
void CHLBot::EquipBestWeapon(bool mustEquip)
|
||||
{
|
||||
// throttle how often equipping is allowed
|
||||
if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval)
|
||||
return;
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
CBasePlayerWeapon *primary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 2 ]);
|
||||
/// TODO: hl
|
||||
// always have a knife
|
||||
|
@ -444,7 +444,7 @@ void CCSBot::EquipBestWeapon(bool mustEquip)
|
|||
|
||||
// Equip our pistol
|
||||
|
||||
void CCSBot::EquipPistol()
|
||||
void CHLBot::EquipPistol()
|
||||
{
|
||||
// throttle how often equipping is allowed
|
||||
if (m_equipTimer.GetElapsedTime() < minEquipInterval)
|
||||
|
@ -459,7 +459,7 @@ void CCSBot::EquipPistol()
|
|||
|
||||
// Equip the knife
|
||||
|
||||
void CCSBot::EquipKnife()
|
||||
void CHLBot::EquipKnife()
|
||||
{
|
||||
if (!IsUsingKnife())
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ void CCSBot::EquipKnife()
|
|||
|
||||
// Return true if we have a grenade in our inventory
|
||||
|
||||
bool CCSBot::HasGrenade() const
|
||||
bool CHLBot::HasGrenade() const
|
||||
{
|
||||
CBasePlayerWeapon *grenade = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 4 ]);
|
||||
return grenade != NULL;
|
||||
|
@ -481,7 +481,7 @@ bool CCSBot::HasGrenade() const
|
|||
|
||||
// Equip a grenade, return false if we cant
|
||||
|
||||
bool CCSBot::EquipGrenade(bool noSmoke)
|
||||
bool CHLBot::EquipGrenade(bool noSmoke)
|
||||
{
|
||||
// snipers don't use grenades
|
||||
if (IsSniper())
|
||||
|
@ -509,7 +509,7 @@ bool CCSBot::EquipGrenade(bool noSmoke)
|
|||
|
||||
// Returns true if we have knife equipped
|
||||
|
||||
bool CCSBot::IsUsingKnife() const
|
||||
bool CHLBot::IsUsingKnife() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -521,7 +521,7 @@ bool CCSBot::IsUsingKnife() const
|
|||
|
||||
// Returns true if we have pistol equipped
|
||||
|
||||
bool CCSBot::IsUsingPistol() const
|
||||
bool CHLBot::IsUsingPistol() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -533,7 +533,7 @@ bool CCSBot::IsUsingPistol() const
|
|||
|
||||
// Returns true if we have a grenade equipped
|
||||
|
||||
bool CCSBot::IsUsingGrenade() const
|
||||
bool CHLBot::IsUsingGrenade() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -546,7 +546,7 @@ bool CCSBot::IsUsingGrenade() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CCSBot::IsUsingHEGrenade() const
|
||||
bool CHLBot::IsUsingHEGrenade() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
|
||||
|
@ -558,7 +558,7 @@ bool CCSBot::IsUsingHEGrenade() const
|
|||
|
||||
// Begin the process of throwing the grenade
|
||||
|
||||
void CCSBot::ThrowGrenade(const Vector *target)
|
||||
void CHLBot::ThrowGrenade(const Vector *target)
|
||||
{
|
||||
if (IsUsingGrenade() && !m_isWaitingToTossGrenade)
|
||||
{
|
||||
|
@ -573,7 +573,7 @@ void CCSBot::ThrowGrenade(const Vector *target)
|
|||
|
||||
// Find spot to throw grenade ahead of us and "around the corner" along our path
|
||||
|
||||
bool CCSBot::FindGrenadeTossPathTarget(Vector *pos)
|
||||
bool CHLBot::FindGrenadeTossPathTarget(Vector *pos)
|
||||
{
|
||||
if (!HasPath())
|
||||
return false;
|
||||
|
@ -672,7 +672,7 @@ bool CCSBot::FindGrenadeTossPathTarget(Vector *pos)
|
|||
|
||||
// Reload our weapon if we must
|
||||
|
||||
void CCSBot::ReloadCheck()
|
||||
void CHLBot::ReloadCheck()
|
||||
{
|
||||
const float safeReloadWaitTime = 3.0f;
|
||||
const float reloadAmmoRatio = 0.6f;
|
||||
|
@ -747,7 +747,7 @@ void CCSBot::ReloadCheck()
|
|||
|
||||
// Silence/unsilence our weapon if we must
|
||||
|
||||
void CCSBot::SilencerCheck()
|
||||
void CHLBot::SilencerCheck()
|
||||
{
|
||||
// longer than reload check because reloading should take precedence
|
||||
const float safeSilencerWaitTime = 3.5f;
|
||||
|
@ -785,7 +785,7 @@ void CCSBot::SilencerCheck()
|
|||
|
||||
// Invoked when in contact with a CWeaponBox
|
||||
|
||||
void CCSBot::OnTouchingWeapon(CWeaponBox *box)
|
||||
void CHLBot::OnTouchingWeapon(CWeaponBox *box)
|
||||
{
|
||||
CBasePlayerItem *droppedGun = dynamic_cast<CBasePlayerItem *>(box->m_rgpPlayerItems[ 2 ]);
|
||||
|
||||
|
@ -832,7 +832,7 @@ void CCSBot::OnTouchingWeapon(CWeaponBox *box)
|
|||
// Return true if a friend is in our weapon's way
|
||||
// TODO: Check more rays for safety.
|
||||
|
||||
bool CCSBot::IsFriendInLineOfFire()
|
||||
bool CHLBot::IsFriendInLineOfFire()
|
||||
{
|
||||
UTIL_MakeVectors(pev->punchangle + pev->v_angle);
|
||||
|
||||
|
@ -863,7 +863,7 @@ bool CCSBot::IsFriendInLineOfFire()
|
|||
// Return line-of-sight distance to obstacle along weapon fire ray
|
||||
// TODO: Re-use this computation with IsFriendInLineOfFire()
|
||||
|
||||
float CCSBot::ComputeWeaponSightRange()
|
||||
float CHLBot::ComputeWeaponSightRange()
|
||||
{
|
||||
UTIL_MakeVectors(pev->punchangle + pev->v_angle);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "bot_common.h"
|
||||
|
||||
CSGameState::CSGameState(CCSBot *owner)
|
||||
CHLGameState::CHLGameState(CHLBot *owner)
|
||||
{
|
||||
m_owner = owner;
|
||||
m_isRoundOver = false;
|
||||
|
@ -9,10 +9,10 @@ CSGameState::CSGameState(CCSBot *owner)
|
|||
|
||||
// Reset at round start
|
||||
|
||||
void CSGameState::Reset()
|
||||
void CHLGameState::Reset()
|
||||
{
|
||||
int i;
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
m_isRoundOver = false;
|
||||
|
||||
|
@ -20,14 +20,14 @@ void CSGameState::Reset()
|
|||
|
||||
// Update game state based on events we have received
|
||||
|
||||
void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CHLGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// True if round has been won or lost (but not yet reset)
|
||||
|
||||
bool CSGameState::IsRoundOver() const
|
||||
bool CHLGameState::IsRoundOver() const
|
||||
{
|
||||
return m_isRoundOver;
|
||||
}
|
||||
|
|
|
@ -32,24 +32,22 @@
|
|||
#pragma once
|
||||
#endif
|
||||
|
||||
class CCSBot;
|
||||
class CHLBot;
|
||||
|
||||
// This class represents the game state as known by a particular bot
|
||||
class CSGameState
|
||||
class CHLGameState
|
||||
{
|
||||
public:
|
||||
CSGameState() {};
|
||||
CSGameState(CCSBot *owner);
|
||||
CHLGameState() {};
|
||||
CHLGameState(CHLBot *owner);
|
||||
|
||||
void Reset();
|
||||
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other); // Event handling
|
||||
bool IsRoundOver() const; // true if round has been won or lost (but not yet reset)
|
||||
|
||||
// hostage rescue scenario
|
||||
//enum ValidateStatusType:unsigned char //C++11 feature
|
||||
|
||||
private:
|
||||
CCSBot *m_owner; // who owns this gamestate
|
||||
CHLBot *m_owner; // who owns this gamestate
|
||||
bool m_isRoundOver; // true if round is over, but no yet reset
|
||||
|
||||
CountdownTimer m_validateInterval;
|
||||
|
|
|
@ -3516,7 +3516,7 @@ void CNavArea::DrawConnectedAreas()
|
|||
if (player == NULL)
|
||||
return;
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
const float maxRange = 500.0f;
|
||||
|
||||
// draw self
|
||||
|
@ -3686,7 +3686,7 @@ public:
|
|||
}
|
||||
bool operator()(CNavArea *area)
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
if (area->GetPlace() != m_initialPlace)
|
||||
return false;
|
||||
|
@ -3704,7 +3704,7 @@ private:
|
|||
|
||||
void EditNavAreas(NavEditCmdType cmd)
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
CBasePlayer *player = UTIL_GetLocalPlayer();
|
||||
if (player == NULL)
|
||||
return;
|
||||
|
|
|
@ -358,7 +358,7 @@ private:
|
|||
friend void DestroyHidingSpots();
|
||||
friend void StripNavigationAreas();
|
||||
friend class CNavAreaGrid;
|
||||
friend class CCSBotManager;
|
||||
friend class CHLBotManager;
|
||||
|
||||
void Initialize(); // to keep constructors consistent
|
||||
static bool m_isReset; // if true, don't bother cleaning up in destructor since everything is going away
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Begin attacking
|
||||
|
||||
void AttackState::OnEnter(CCSBot *me)
|
||||
void AttackState::OnEnter(CHLBot *me)
|
||||
{
|
||||
CBasePlayer *enemy = me->GetEnemy();
|
||||
|
||||
|
@ -108,9 +108,9 @@ void AttackState::OnEnter(CCSBot *me)
|
|||
m_isCoward = (RANDOM_FLOAT(0.0f, 100.0f) > 100.0f * me->GetProfile()->GetAggression());
|
||||
}
|
||||
|
||||
void AttackState::StopAttacking(CCSBot *me)
|
||||
void AttackState::StopAttacking(CHLBot *me)
|
||||
{
|
||||
if (me->m_task == CCSBot::SNIPING)
|
||||
if (me->m_task == CHLBot::SNIPING)
|
||||
{
|
||||
// stay in our hiding spot
|
||||
me->Hide(me->GetLastKnownArea(), -1.0f, 50.0f);
|
||||
|
@ -123,7 +123,7 @@ void AttackState::StopAttacking(CCSBot *me)
|
|||
|
||||
// Perform attack behavior
|
||||
|
||||
void AttackState::OnUpdate(CCSBot *me)
|
||||
void AttackState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// can't be stuck while attacking
|
||||
me->ResetStuckMonitor();
|
||||
|
@ -223,7 +223,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
|
||||
// move towards victim
|
||||
if (me->UpdatePathMovement(NO_SPEED_CHANGE) != CCSBot::PROGRESSING)
|
||||
if (me->UpdatePathMovement(NO_SPEED_CHANGE) != CHLBot::PROGRESSING)
|
||||
{
|
||||
me->DestroyPath();
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
float targetRange = toAimSpot3D.Length();
|
||||
|
||||
// dont adjust zoom level if we're already zoomed in - just fire
|
||||
if (me->GetZoomLevel() == CCSBot::NO_ZOOM && me->AdjustZoom(targetRange))
|
||||
if (me->GetZoomLevel() == CHLBot::NO_ZOOM && me->AdjustZoom(targetRange))
|
||||
m_scopeTimestamp = gpGlobals->time;
|
||||
|
||||
const float waitScopeTime = 0.2f + me->GetProfile()->GetReactionTime();
|
||||
|
@ -310,7 +310,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
|
||||
if (notSeenEnemyTime > 0.1f)
|
||||
{
|
||||
if (me->GetDisposition() == CCSBot::ENGAGE_AND_INVESTIGATE)
|
||||
if (me->GetDisposition() == CHLBot::ENGAGE_AND_INVESTIGATE)
|
||||
{
|
||||
// decide whether we should hide and "ambush" our enemy
|
||||
if (m_haveSeenEnemy && !m_didAmbushCheck)
|
||||
|
@ -374,7 +374,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
if (!me->IsEnemyVisible() && (notSeenEnemyTime > chaseTime || !m_haveSeenEnemy))
|
||||
{
|
||||
// snipers don't chase their prey - they wait for their prey to come to them
|
||||
if (me->GetTask() == CCSBot::SNIPING)
|
||||
if (me->GetTask() == CHLBot::SNIPING)
|
||||
{
|
||||
StopAttacking(me);
|
||||
return;
|
||||
|
@ -382,7 +382,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
else
|
||||
{
|
||||
// move to last known position of enemy
|
||||
me->SetTask(CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION, enemy);
|
||||
me->SetTask(CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION, enemy);
|
||||
me->MoveTo(&me->GetLastKnownEnemyPosition());
|
||||
return;
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void AttackState::OnUpdate(CCSBot *me)
|
|||
|
||||
// Finish attack
|
||||
|
||||
void AttackState::OnExit(CCSBot *me)
|
||||
void AttackState::OnExit(CHLBot *me)
|
||||
{
|
||||
me->PrintIfWatched("AttackState:OnExit()\n");
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Follow our leader
|
||||
|
||||
void FollowState::OnEnter(CCSBot *me)
|
||||
void FollowState::OnEnter(CHLBot *me)
|
||||
{
|
||||
me->StandUp();
|
||||
me->Run();
|
||||
|
@ -75,7 +75,7 @@ void FollowState::ComputeLeaderMotionState(float leaderSpeed)
|
|||
// Follow our leader
|
||||
// TODO: Clean up this nasty mess
|
||||
|
||||
void FollowState::OnUpdate(CCSBot *me)
|
||||
void FollowState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// if we lost our leader, give up
|
||||
if (m_leader == NULL || !m_leader->IsAlive())
|
||||
|
@ -174,7 +174,7 @@ void FollowState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
|
||||
// move along our path
|
||||
if (me->UpdatePathMovement(NO_SPEED_CHANGE) != CCSBot::PROGRESSING)
|
||||
if (me->UpdatePathMovement(NO_SPEED_CHANGE) != CHLBot::PROGRESSING)
|
||||
{
|
||||
me->DestroyPath();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ void FollowState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
}
|
||||
|
||||
void FollowState::OnExit(CCSBot *me)
|
||||
void FollowState::OnExit(CHLBot *me)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Begin moving to a nearby hidey-hole.
|
||||
// NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot!
|
||||
|
||||
void HideState::OnEnter(CCSBot *me)
|
||||
void HideState::OnEnter(CHLBot *me)
|
||||
{
|
||||
m_isAtSpot = false;
|
||||
|
||||
|
@ -42,7 +42,7 @@ void HideState::OnEnter(CCSBot *me)
|
|||
// Move to a nearby hidey-hole.
|
||||
// NOTE: Do not forget this state may include a very long "move-to" time to get to our hidey spot!
|
||||
|
||||
void HideState::OnUpdate(CCSBot *me)
|
||||
void HideState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// wait until finished reloading to leave hide state
|
||||
if (!me->IsActiveWeaponReloading())
|
||||
|
@ -83,7 +83,7 @@ void HideState::OnUpdate(CCSBot *me)
|
|||
// dont investigate noises if we are reloading
|
||||
if (!me->IsActiveWeaponReloading() &&
|
||||
!isSettledInSniper &&
|
||||
me->GetDisposition() == CCSBot::ENGAGE_AND_INVESTIGATE)
|
||||
me->GetDisposition() == CHLBot::ENGAGE_AND_INVESTIGATE)
|
||||
{
|
||||
// if we are holding position, and have heard the enemy nearby, investigate after our hold time is up
|
||||
if (m_isHoldingPosition && m_heardEnemy && (gpGlobals->time - m_firstHeardEnemyTime > m_holdPositionTime))
|
||||
|
@ -182,12 +182,12 @@ void HideState::OnUpdate(CCSBot *me)
|
|||
|
||||
// ready our weapon and prepare to attack
|
||||
me->EquipBestWeapon(MUST_EQUIP);
|
||||
me->SetDisposition(CCSBot::OPPORTUNITY_FIRE);
|
||||
me->SetDisposition(CHLBot::OPPORTUNITY_FIRE);
|
||||
|
||||
// if we are a sniper, update our task
|
||||
if (me->GetTask() == CCSBot::MOVE_TO_SNIPER_SPOT)
|
||||
if (me->GetTask() == CHLBot::MOVE_TO_SNIPER_SPOT)
|
||||
{
|
||||
me->SetTask(CCSBot::SNIPING);
|
||||
me->SetTask(CHLBot::SNIPING);
|
||||
}
|
||||
|
||||
// determine which way to look
|
||||
|
@ -209,7 +209,7 @@ void HideState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
|
||||
// move to hiding spot
|
||||
if (me->UpdatePathMovement() != CCSBot::PROGRESSING && !m_isAtSpot)
|
||||
if (me->UpdatePathMovement() != CHLBot::PROGRESSING && !m_isAtSpot)
|
||||
{
|
||||
// we couldn't get to our hiding spot - pick another
|
||||
me->PrintIfWatched("Can't get to my hiding spot - finding another...\n");
|
||||
|
@ -242,7 +242,7 @@ void HideState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
}
|
||||
|
||||
void HideState::OnExit(CCSBot *me)
|
||||
void HideState::OnExit(CHLBot *me)
|
||||
{
|
||||
m_isHoldingPosition = false;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Begin the hunt
|
||||
|
||||
void HuntState::OnEnter(CCSBot *me)
|
||||
void HuntState::OnEnter(CHLBot *me)
|
||||
{
|
||||
// lurking death
|
||||
if (me->IsUsingKnife() && me->IsWellPastSafe() && !me->IsHurrying())
|
||||
|
@ -11,14 +11,14 @@ void HuntState::OnEnter(CCSBot *me)
|
|||
me->Run();
|
||||
|
||||
me->StandUp();
|
||||
me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE);
|
||||
me->SetTask(CCSBot::SEEK_AND_DESTROY);
|
||||
me->SetDisposition(CHLBot::ENGAGE_AND_INVESTIGATE);
|
||||
me->SetTask(CHLBot::SEEK_AND_DESTROY);
|
||||
me->DestroyPath();
|
||||
}
|
||||
|
||||
// Hunt down our enemies
|
||||
|
||||
void HuntState::OnUpdate(CCSBot *me)
|
||||
void HuntState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// listen for enemy noises
|
||||
if (me->ShouldInvestigateNoise())
|
||||
|
@ -32,7 +32,7 @@ void HuntState::OnUpdate(CCSBot *me)
|
|||
|
||||
// if we have reached our destination area, pick a new one
|
||||
// if our path fails, pick a new one
|
||||
if (me->GetLastKnownArea() == m_huntArea || me->UpdatePathMovement() != CCSBot::PROGRESSING)
|
||||
if (me->GetLastKnownArea() == m_huntArea || me->UpdatePathMovement() != CHLBot::PROGRESSING)
|
||||
{
|
||||
m_huntArea = NULL;
|
||||
float oldest = 0.0f;
|
||||
|
@ -84,7 +84,7 @@ void HuntState::OnUpdate(CCSBot *me)
|
|||
|
||||
// Done hunting
|
||||
|
||||
void HuntState::OnExit(CCSBot *me)
|
||||
void HuntState::OnExit(CHLBot *me)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ const float sniperHideRange = 2000.0f;
|
|||
// We never stay in the Idle state - it is a "home base" for the state machine that
|
||||
// does various checks to determine what we should do next.
|
||||
|
||||
void IdleState::OnEnter(CCSBot *me)
|
||||
void IdleState::OnEnter(CHLBot *me)
|
||||
{
|
||||
me->DestroyPath();
|
||||
me->SetEnemy(NULL);
|
||||
|
@ -17,11 +17,11 @@ void IdleState::OnEnter(CCSBot *me)
|
|||
me->Walk();
|
||||
|
||||
// Since Idle assigns tasks, we assume that coming back to Idle means our task is complete
|
||||
me->SetTask(CCSBot::SEEK_AND_DESTROY);
|
||||
me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE);
|
||||
me->SetTask(CHLBot::SEEK_AND_DESTROY);
|
||||
me->SetDisposition(CHLBot::ENGAGE_AND_INVESTIGATE);
|
||||
}
|
||||
|
||||
void IdleState::OnUpdate(CCSBot *me)
|
||||
void IdleState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// all other states assume GetLastKnownArea() is valid, ensure that it is
|
||||
if (me->GetLastKnownArea() == NULL && me->StayOnNavMesh() == false)
|
||||
|
@ -48,7 +48,7 @@ void IdleState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
}
|
||||
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
// if round is over, hunt
|
||||
if (me->GetGameState()->IsRoundOver())
|
||||
|
@ -70,9 +70,9 @@ void IdleState::OnUpdate(CCSBot *me)
|
|||
// sniping check
|
||||
if (me->GetFriendsRemaining() && me->IsSniper() && RANDOM_FLOAT(0, 100.0f) < offenseSniperCampChance)
|
||||
{
|
||||
me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT);
|
||||
me->SetTask(CHLBot::MOVE_TO_SNIPER_SPOT);
|
||||
me->Hide(me->GetLastKnownArea(), RANDOM_FLOAT(10.0f, 30.0f), sniperHideRange);
|
||||
me->SetDisposition(CCSBot::OPPORTUNITY_FIRE);
|
||||
me->SetDisposition(CHLBot::OPPORTUNITY_FIRE);
|
||||
me->PrintIfWatched("Sniping!\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Move towards currently heard noise
|
||||
|
||||
void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me)
|
||||
void InvestigateNoiseState::AttendCurrentNoise(CHLBot *me)
|
||||
{
|
||||
if (!me->IsNoiseHeard() && me->GetNoisePosition())
|
||||
return;
|
||||
|
@ -22,14 +22,14 @@ void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me)
|
|||
me->ForgetNoise();
|
||||
}
|
||||
|
||||
void InvestigateNoiseState::OnEnter(CCSBot *me)
|
||||
void InvestigateNoiseState::OnEnter(CHLBot *me)
|
||||
{
|
||||
AttendCurrentNoise(me);
|
||||
}
|
||||
|
||||
// Use TravelDistance instead of distance...
|
||||
|
||||
void InvestigateNoiseState::OnUpdate(CCSBot *me)
|
||||
void InvestigateNoiseState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
float newNoiseDist;
|
||||
if (me->ShouldInvestigateNoise(&newNoiseDist))
|
||||
|
@ -100,13 +100,13 @@ void InvestigateNoiseState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
|
||||
// move towards noise
|
||||
if (me->UpdatePathMovement() != CCSBot::PROGRESSING)
|
||||
if (me->UpdatePathMovement() != CHLBot::PROGRESSING)
|
||||
{
|
||||
me->Idle();
|
||||
}
|
||||
}
|
||||
|
||||
void InvestigateNoiseState::OnExit(CCSBot *me)
|
||||
void InvestigateNoiseState::OnExit(CHLBot *me)
|
||||
{
|
||||
// reset to run mode in case we were sneaking about
|
||||
me->Run();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Move to a potentially far away position.
|
||||
|
||||
void MoveToState::OnEnter(CCSBot *me)
|
||||
void MoveToState::OnEnter(CHLBot *me)
|
||||
{
|
||||
if (me->IsUsingKnife() && me->IsWellPastSafe() && !me->IsHurrying())
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ void MoveToState::OnEnter(CCSBot *me)
|
|||
switch (me->GetTask())
|
||||
{
|
||||
// maybe also fastest way to healthkits??
|
||||
case CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION:
|
||||
case CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION:
|
||||
route = FASTEST_ROUTE;
|
||||
break;
|
||||
|
||||
|
@ -36,12 +36,12 @@ void MoveToState::OnEnter(CCSBot *me)
|
|||
|
||||
// Move to a potentially far away position.
|
||||
|
||||
void MoveToState::OnUpdate(CCSBot *me)
|
||||
void MoveToState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
CCSBotManager *ctrl = TheCSBots();
|
||||
CHLBotManager *ctrl = TheCSBots();
|
||||
|
||||
// assume that we are paying attention and close enough to know our enemy died
|
||||
if (me->GetTask() == CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
|
||||
if (me->GetTask() == CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
|
||||
{
|
||||
// TODO: Account for reaction time so we take some time to realized the enemy is dead
|
||||
CBasePlayer *victim = static_cast<CBasePlayer *>(me->GetTaskEntity());
|
||||
|
@ -56,12 +56,12 @@ void MoveToState::OnUpdate(CCSBot *me)
|
|||
// look around
|
||||
me->UpdateLookAround();
|
||||
|
||||
if (me->UpdatePathMovement() != CCSBot::PROGRESSING)
|
||||
if (me->UpdatePathMovement() != CHLBot::PROGRESSING)
|
||||
{
|
||||
// reached destination
|
||||
switch (me->GetTask())
|
||||
{
|
||||
case CCSBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION:
|
||||
case CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION:
|
||||
{
|
||||
CBasePlayer *victim = static_cast<CBasePlayer *>(me->GetTaskEntity());
|
||||
if (victim != NULL && victim->IsAlive())
|
||||
|
@ -79,10 +79,10 @@ void MoveToState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
}
|
||||
|
||||
void MoveToState::OnExit(CCSBot *me)
|
||||
void MoveToState::OnExit(CHLBot *me)
|
||||
{
|
||||
// reset to run in case we were walking near our goal position
|
||||
me->Run();
|
||||
me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE);
|
||||
me->SetDisposition(CHLBot::ENGAGE_AND_INVESTIGATE);
|
||||
//me->StopAiming();
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
// Face the entity and "use" it
|
||||
// NOTE: This state assumes we are standing in range of the entity to be used, with no obstructions.
|
||||
|
||||
void UseEntityState::OnEnter(CCSBot *me)
|
||||
void UseEntityState::OnEnter(CHLBot *me)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void UseEntityState::OnUpdate(CCSBot *me)
|
||||
void UseEntityState::OnUpdate(CHLBot *me)
|
||||
{
|
||||
// in the very rare situation where two or more bots "used" a hostage at the same time,
|
||||
// one bot will fail and needs to time out of this state
|
||||
|
@ -32,7 +32,7 @@ void UseEntityState::OnUpdate(CCSBot *me)
|
|||
}
|
||||
}
|
||||
|
||||
void UseEntityState::OnExit(CCSBot *me)
|
||||
void UseEntityState::OnExit(CHLBot *me)
|
||||
{
|
||||
me->ClearLookAt();
|
||||
me->ResetStuckMonitor();
|
||||
|
|
Loading…
Reference in New Issue