mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-03-12 21:41:05 +00:00
TheHLBots
This commit is contained in:
parent
f49a454cfa
commit
10d95581fa
@ -227,10 +227,10 @@ void CHLBot::BotTouch(CBaseEntity *other)
|
|||||||
CBasePlayer *player = static_cast<CBasePlayer *>(other);
|
CBasePlayer *player = static_cast<CBasePlayer *>(other);
|
||||||
|
|
||||||
// get priority of other player
|
// get priority of other player
|
||||||
unsigned int otherPri = TheCSBots()->GetPlayerPriority(player);
|
unsigned int otherPri = TheHLBots()->GetPlayerPriority(player);
|
||||||
|
|
||||||
// get our priority
|
// get our priority
|
||||||
unsigned int myPri = TheCSBots()->GetPlayerPriority(this);
|
unsigned int myPri = TheHLBots()->GetPlayerPriority(this);
|
||||||
|
|
||||||
// if our priority is better, don't budge
|
// if our priority is better, don't budge
|
||||||
if (myPri < otherPri)
|
if (myPri < otherPri)
|
||||||
@ -239,7 +239,7 @@ void CHLBot::BotTouch(CBaseEntity *other)
|
|||||||
// they are higher priority - make way, unless we're already making way for someone more important
|
// they are higher priority - make way, unless we're already making way for someone more important
|
||||||
if (m_avoid != NULL)
|
if (m_avoid != NULL)
|
||||||
{
|
{
|
||||||
unsigned int avoidPri = TheCSBots()->GetPlayerPriority(static_cast<CBasePlayer *>(static_cast<CBaseEntity *>(m_avoid)));
|
unsigned int avoidPri = TheHLBots()->GetPlayerPriority(static_cast<CBasePlayer *>(static_cast<CBaseEntity *>(m_avoid)));
|
||||||
if (avoidPri < otherPri)
|
if (avoidPri < otherPri)
|
||||||
{
|
{
|
||||||
// ignore 'other' because we're already avoiding someone better
|
// ignore 'other' because we're already avoiding someone better
|
||||||
@ -549,7 +549,7 @@ int CHLBot::OutnumberedCount() const
|
|||||||
|
|
||||||
CBasePlayer *CHLBot::GetImportantEnemy(bool checkVisibility) const
|
CBasePlayer *CHLBot::GetImportantEnemy(bool checkVisibility) const
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
CBasePlayer *nearEnemy = NULL;
|
CBasePlayer *nearEnemy = NULL;
|
||||||
float nearDist = 999999999.9f;
|
float nearDist = 999999999.9f;
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ void CHLBot::DecreaseMorale()
|
|||||||
|
|
||||||
bool CHLBot::IsRogue() const
|
bool CHLBot::IsRogue() const
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (!ctrl->AllowRogues())
|
if (!ctrl->AllowRogues())
|
||||||
return false;
|
return false;
|
||||||
@ -675,7 +675,7 @@ bool CHLBot::IsHurrying() const
|
|||||||
if (!m_hurryTimer.IsElapsed())
|
if (!m_hurryTimer.IsElapsed())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -685,7 +685,7 @@ bool CHLBot::IsHurrying() const
|
|||||||
|
|
||||||
bool CHLBot::IsSafe() const
|
bool CHLBot::IsSafe() const
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (ctrl->GetElapsedRoundTime() < m_safeTime)
|
if (ctrl->GetElapsedRoundTime() < m_safeTime)
|
||||||
return true;
|
return true;
|
||||||
@ -697,7 +697,7 @@ bool CHLBot::IsSafe() const
|
|||||||
|
|
||||||
bool CHLBot::IsWellPastSafe() const
|
bool CHLBot::IsWellPastSafe() const
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (ctrl->GetElapsedRoundTime() > 1.25f * m_safeTime)
|
if (ctrl->GetElapsedRoundTime() > 1.25f * m_safeTime)
|
||||||
return true;
|
return true;
|
||||||
@ -716,7 +716,7 @@ bool CHLBot::IsEndOfSafeTime() const
|
|||||||
|
|
||||||
float CHLBot::GetSafeTimeRemaining() const
|
float CHLBot::GetSafeTimeRemaining() const
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
return m_safeTime - ctrl->GetElapsedRoundTime();
|
return m_safeTime - ctrl->GetElapsedRoundTime();
|
||||||
}
|
}
|
||||||
@ -725,7 +725,7 @@ float CHLBot::GetSafeTimeRemaining() const
|
|||||||
|
|
||||||
void CHLBot::AdjustSafeTime()
|
void CHLBot::AdjustSafeTime()
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
// if we spotted an enemy sooner than we thought possible, adjust our notion of "safe" time
|
// if we spotted an enemy sooner than we thought possible, adjust our notion of "safe" time
|
||||||
if (m_safeTime > ctrl->GetElapsedRoundTime())
|
if (m_safeTime > ctrl->GetElapsedRoundTime())
|
||||||
@ -747,7 +747,7 @@ bool CHLBot::HasNotSeenEnemyForLongTime() const
|
|||||||
|
|
||||||
bool CHLBot::GuardRandomZone(float range)
|
bool CHLBot::GuardRandomZone(float range)
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
const CHLBotManager::Zone *zone = ctrl->GetRandomZone();
|
const CHLBotManager::Zone *zone = ctrl->GetRandomZone();
|
||||||
|
|
||||||
if (zone != NULL)
|
if (zone != NULL)
|
||||||
|
@ -1585,7 +1585,7 @@ void BotChatterInterface::ReportIn()
|
|||||||
|
|
||||||
void BotChatterInterface::ReportingIn()
|
void BotChatterInterface::ReportingIn()
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
|
BotStatement *say = new BotStatement(this, REPORT_INFORMATION, 10.0f);
|
||||||
|
|
||||||
// where are we
|
// where are we
|
||||||
@ -1688,7 +1688,7 @@ void BotChatterInterface::PinnedDown()
|
|||||||
|
|
||||||
void BotChatterInterface::HeardNoise(const Vector *pos)
|
void BotChatterInterface::HeardNoise(const Vector *pos)
|
||||||
{
|
{
|
||||||
if (TheCSBots()->IsRoundOver())
|
if (TheHLBots()->IsRoundOver())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_heardNoiseTimer.IsElapsed())
|
if (m_heardNoiseTimer.IsElapsed())
|
||||||
@ -1769,7 +1769,7 @@ void BotChatterInterface::CelebrateWin()
|
|||||||
say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f));
|
say->SetStartTime(gpGlobals->time + RANDOM_FLOAT(2.0f, 5.0f));
|
||||||
|
|
||||||
const float quickRound = 45.0f;
|
const float quickRound = 45.0f;
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (m_me->GetFriendsRemaining() == 0)
|
if (m_me->GetFriendsRemaining() == 0)
|
||||||
{
|
{
|
||||||
@ -1797,7 +1797,7 @@ void BotChatterInterface::CelebrateWin()
|
|||||||
|
|
||||||
void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
|
void BotChatterInterface::AnnouncePlan(const char *phraseName, Place place)
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
if (ctrl->IsRoundOver())
|
if (ctrl->IsRoundOver())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void CHLBot::ResetValues()
|
|||||||
|
|
||||||
void CHLBot::SpawnBot()
|
void CHLBot::SpawnBot()
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
ctrl->ValidateMapData();
|
ctrl->ValidateMapData();
|
||||||
ResetValues();
|
ResetValues();
|
||||||
|
@ -247,7 +247,7 @@ NOXREF inline int OtherTeam(int team)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CHLBotManager *TheCSBots()
|
inline CHLBotManager *TheHLBots()
|
||||||
{
|
{
|
||||||
return reinterpret_cast<CHLBotManager *>(TheBots);
|
return reinterpret_cast<CHLBotManager *>(TheBots);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ void CHLBot::RespondToRadioCommands()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
CBasePlayer *player = m_radioSubject;
|
CBasePlayer *player = m_radioSubject;
|
||||||
if (player == NULL)
|
if (player == NULL)
|
||||||
return;
|
return;
|
||||||
@ -294,7 +294,7 @@ void CHLBot::SendRadioMessage(GameEventType event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
|
PrintIfWatched("%3.1f: SendRadioMessage( %s )\n", gpGlobals->time, GameEventName[ event ]);
|
||||||
|
|
||||||
// note the time the message was sent
|
// note the time the message was sent
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
void CHLBot::Upkeep()
|
void CHLBot::Upkeep()
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (ctrl->IsLearningMap() || !IsAlive())
|
if (ctrl->IsLearningMap() || !IsAlive())
|
||||||
return;
|
return;
|
||||||
@ -153,7 +153,7 @@ void CHLBot::Upkeep()
|
|||||||
|
|
||||||
void CHLBot::Update()
|
void CHLBot::Update()
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
|
if (ctrl->IsAnalysisRequested() && m_processMode == PROCESS_NORMAL)
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,7 @@ bool CHLBot::IsVisible(Vector *pos, bool testFOV) const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check line of sight against smoke
|
// check line of sight against smoke
|
||||||
if (TheCSBots()->IsLineBlockedBySmoke(&GetEyePosition(), pos))
|
if (TheHLBots()->IsLineBlockedBySmoke(&GetEyePosition(), pos))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check line of sight
|
// check line of sight
|
||||||
|
@ -52,7 +52,7 @@ void CHLBot::FireWeaponAtEnemy()
|
|||||||
bool doAttack;
|
bool doAttack;
|
||||||
|
|
||||||
// if friendly fire is on, don't fire if a teammate is blocking our line of fire
|
// if friendly fire is on, don't fire if a teammate is blocking our line of fire
|
||||||
if (TheCSBots()->AllowFriendlyFireDamage())
|
if (TheHLBots()->AllowFriendlyFireDamage())
|
||||||
{
|
{
|
||||||
if (IsFriendInLineOfFire())
|
if (IsFriendInLineOfFire())
|
||||||
doAttack = false;
|
doAttack = false;
|
||||||
@ -435,7 +435,7 @@ void CHLBot::EquipBestWeapon(bool mustEquip)
|
|||||||
if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval)
|
if (!mustEquip && m_equipTimer.GetElapsedTime() < minEquipInterval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
CBasePlayerWeapon *primary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 2 ]);
|
CBasePlayerWeapon *primary = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 2 ]);
|
||||||
/// TODO: hl
|
/// TODO: hl
|
||||||
// always have a knife
|
// always have a knife
|
||||||
@ -450,7 +450,7 @@ void CHLBot::EquipPistol()
|
|||||||
if (m_equipTimer.GetElapsedTime() < minEquipInterval)
|
if (m_equipTimer.GetElapsedTime() < minEquipInterval)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TheCSBots()->AllowPistols() && !IsUsingPistol())
|
if (TheHLBots()->AllowPistols() && !IsUsingPistol())
|
||||||
{
|
{
|
||||||
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 1 ]);
|
CBasePlayerWeapon *pistol = static_cast<CBasePlayerWeapon *>(m_rgpPlayerItems[ 1 ]);
|
||||||
DoEquip(pistol);
|
DoEquip(pistol);
|
||||||
|
@ -12,7 +12,7 @@ CHLGameState::CHLGameState(CHLBot *owner)
|
|||||||
void CHLGameState::Reset()
|
void CHLGameState::Reset()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
m_isRoundOver = false;
|
m_isRoundOver = false;
|
||||||
|
|
||||||
|
@ -3516,7 +3516,7 @@ void CNavArea::DrawConnectedAreas()
|
|||||||
if (player == NULL)
|
if (player == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
const float maxRange = 500.0f;
|
const float maxRange = 500.0f;
|
||||||
|
|
||||||
// draw self
|
// draw self
|
||||||
@ -3686,7 +3686,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool operator()(CNavArea *area)
|
bool operator()(CNavArea *area)
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
if (area->GetPlace() != m_initialPlace)
|
if (area->GetPlace() != m_initialPlace)
|
||||||
return false;
|
return false;
|
||||||
@ -3704,7 +3704,7 @@ private:
|
|||||||
|
|
||||||
void EditNavAreas(NavEditCmdType cmd)
|
void EditNavAreas(NavEditCmdType cmd)
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
CBasePlayer *player = UTIL_GetLocalPlayer();
|
CBasePlayer *player = UTIL_GetLocalPlayer();
|
||||||
if (player == NULL)
|
if (player == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -48,7 +48,7 @@ void IdleState::OnUpdate(CHLBot *me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
// if round is over, hunt
|
// if round is over, hunt
|
||||||
if (me->GetGameState()->IsRoundOver())
|
if (me->GetGameState()->IsRoundOver())
|
||||||
|
@ -38,7 +38,7 @@ void MoveToState::OnEnter(CHLBot *me)
|
|||||||
|
|
||||||
void MoveToState::OnUpdate(CHLBot *me)
|
void MoveToState::OnUpdate(CHLBot *me)
|
||||||
{
|
{
|
||||||
CHLBotManager *ctrl = TheCSBots();
|
CHLBotManager *ctrl = TheHLBots();
|
||||||
|
|
||||||
// assume that we are paying attention and close enough to know our enemy died
|
// assume that we are paying attention and close enough to know our enemy died
|
||||||
if (me->GetTask() == CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
|
if (me->GetTask() == CHLBot::MOVE_TO_LAST_KNOWN_ENEMY_POSITION)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user