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