save point for tomorrow, good night
This commit is contained in:
parent
44512457c8
commit
02823791c0
5 changed files with 69 additions and 17 deletions
|
|
@ -1284,6 +1284,9 @@ private:
|
||||||
bool m_economicsGood[2]; // is team able to buy anything
|
bool m_economicsGood[2]; // is team able to buy anything
|
||||||
bool m_deathMsgSent; // for fakeping
|
bool m_deathMsgSent; // for fakeping
|
||||||
|
|
||||||
|
// holds currently active grenades in the map
|
||||||
|
Array <entity_t> m_activeGrenades;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int CreateBot (String name, int difficulty, int personality, int team, int member);
|
int CreateBot (String name, int difficulty, int personality, int team, int member);
|
||||||
|
|
||||||
|
|
@ -1330,9 +1333,23 @@ public:
|
||||||
void CheckTeamEconomics (int team);
|
void CheckTeamEconomics (int team);
|
||||||
|
|
||||||
static void CallGameEntity (entvars_t *vars);
|
static void CallGameEntity (entvars_t *vars);
|
||||||
|
inline void SetDeathMsgState (bool sent)
|
||||||
|
{
|
||||||
|
m_deathMsgSent = sent;
|
||||||
|
}
|
||||||
|
|
||||||
inline void SetDeathMsgState (bool sent) { m_deathMsgSent = sent; }
|
inline bool GetDeathMsgState (void)
|
||||||
inline bool GetDeathMsgState (void) { return m_deathMsgSent; }
|
{
|
||||||
|
return m_deathMsgSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// grenades
|
||||||
|
void UpdateActiveGrenades (void);
|
||||||
|
const Array <entity_t> GetActiveGrenades (void);
|
||||||
|
inline bool HasActiveGrenades (void)
|
||||||
|
{
|
||||||
|
return !m_activeGrenades.IsEmpty ();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void CalculatePingOffsets (void);
|
void CalculatePingOffsets (void);
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,9 @@ void Bot::AvoidGrenades (void)
|
||||||
{
|
{
|
||||||
// checks if bot 'sees' a grenade, and avoid it
|
// checks if bot 'sees' a grenade, and avoid it
|
||||||
|
|
||||||
|
if (!g_botManager->HasActiveGrenades ())
|
||||||
|
return;
|
||||||
|
|
||||||
edict_t *ent = m_avoidGrenade;
|
edict_t *ent = m_avoidGrenade;
|
||||||
|
|
||||||
// check if old pointers to grenade is invalid
|
// check if old pointers to grenade is invalid
|
||||||
|
|
@ -272,12 +275,12 @@ void Bot::AvoidGrenades (void)
|
||||||
// TODO: should be done once for grenade, instead of checking several times
|
// TODO: should be done once for grenade, instead of checking several times
|
||||||
if (m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
|
if (m_difficulty == 4 && strcmp (STRING (ent->v.model) + 9, "flashbang.mdl") == 0)
|
||||||
{
|
{
|
||||||
Vector position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles ();
|
const Vector &position = (GetEntityOrigin (ent) - EyePosition ()).ToAngles ();
|
||||||
|
|
||||||
// don't look at flashbang
|
// don't look at flashbang
|
||||||
if (!(m_states & STATE_SEEING_ENEMY))
|
if (!(m_states & STATE_SEEING_ENEMY))
|
||||||
{
|
{
|
||||||
pev->v_angle.y = AngleNormalize (position.y + 180.0);
|
pev->v_angle.y = AngleNormalize (position.y + 180.0f);
|
||||||
m_canChooseAimDirection = false;
|
m_canChooseAimDirection = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -315,6 +318,9 @@ void Bot::AvoidGrenades (void)
|
||||||
|
|
||||||
bool Bot::IsBehindSmokeClouds (edict_t *ent)
|
bool Bot::IsBehindSmokeClouds (edict_t *ent)
|
||||||
{
|
{
|
||||||
|
if (!g_botManager->HasActiveGrenades ())
|
||||||
|
return false;
|
||||||
|
|
||||||
edict_t *pentGrenade = NULL;
|
edict_t *pentGrenade = NULL;
|
||||||
Vector betweenUs = (ent->v.origin - pev->origin).Normalize ();
|
Vector betweenUs = (ent->v.origin - pev->origin).Normalize ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2216,7 +2216,7 @@ void StartFrame (void)
|
||||||
}
|
}
|
||||||
g_botManager->SetDeathMsgState (false);
|
g_botManager->SetDeathMsgState (false);
|
||||||
|
|
||||||
if (g_timePerSecondUpdate <= GetWorldTime ())
|
if (g_timePerSecondUpdate < GetWorldTime ())
|
||||||
{
|
{
|
||||||
g_botManager->CalculatePingOffsets ();
|
g_botManager->CalculatePingOffsets ();
|
||||||
|
|
||||||
|
|
@ -2246,20 +2246,28 @@ void StartFrame (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (g_bombPlanted)
|
||||||
|
g_waypoint->SetBombPosition ();
|
||||||
|
|
||||||
if (g_isMetamod)
|
if (g_isMetamod)
|
||||||
{
|
{
|
||||||
cvar_t *csdm_active = CVAR_GET_POINTER ("csdm_active");
|
static cvar_t *csdm_active;
|
||||||
cvar_t *mp_freeforall = CVAR_GET_POINTER ("mp_freeforall");
|
static cvar_t *mp_freeforall;
|
||||||
|
|
||||||
|
if (csdm_active == NULL)
|
||||||
|
csdm_active = CVAR_GET_POINTER ("csdm_active");
|
||||||
|
|
||||||
|
if (mp_freeforall == NULL)
|
||||||
|
mp_freeforall = CVAR_GET_POINTER ("mp_freeforall");
|
||||||
|
|
||||||
if (csdm_active != NULL && csdm_active->value > 0)
|
if (csdm_active != NULL && csdm_active->value > 0)
|
||||||
yb_csdm_mode.SetInt (mp_freeforall != NULL && mp_freeforall->value > 0 ? 2 : 1);
|
yb_csdm_mode.SetInt (mp_freeforall != NULL && mp_freeforall->value > 0 ? 2 : 1);
|
||||||
}
|
}
|
||||||
g_timePerSecondUpdate = GetWorldTime () + 1.0f;
|
g_timePerSecondUpdate = GetWorldTime () + 1.0f;
|
||||||
}
|
}
|
||||||
if (g_bombPlanted)
|
else if (g_timePerSecondUpdate * 0.5f < GetWorldTime ())
|
||||||
g_waypoint->SetBombPosition ();
|
g_botManager->UpdateActiveGrenades ();
|
||||||
}
|
|
||||||
|
|
||||||
// keep bot number up to date
|
// keep bot number up to date
|
||||||
g_botManager->MaintainBotQuota ();
|
g_botManager->MaintainBotQuota ();
|
||||||
|
|
|
||||||
|
|
@ -1348,3 +1348,25 @@ void BotManager::SendDeathMsgFix (void)
|
||||||
SendPingDataOffsets (g_clients[i].ent);
|
SendPingDataOffsets (g_clients[i].ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BotManager::UpdateActiveGrenades (void)
|
||||||
|
{
|
||||||
|
edict_t *grenade = NULL;
|
||||||
|
|
||||||
|
// clear previously stored grenades
|
||||||
|
m_activeGrenades.RemoveAll ();
|
||||||
|
|
||||||
|
// search the map for any type of grenade
|
||||||
|
while (!IsEntityNull (grenade = FIND_ENTITY_BY_CLASSNAME (grenade, "grenade")))
|
||||||
|
{
|
||||||
|
if (grenade->v.effects & EF_NODRAW)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
m_activeGrenades.Push (grenade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Array <entity_t> BotManager::GetActiveGrenades (void)
|
||||||
|
{
|
||||||
|
return m_activeGrenades;
|
||||||
|
}
|
||||||
|
|
@ -2323,7 +2323,6 @@ bool Bot::HeadTowardWaypoint (void)
|
||||||
m_navNode = m_navNode->next; // advance in list
|
m_navNode = m_navNode->next; // advance in list
|
||||||
m_currentTravelFlags = 0; // reset travel flags (jumping etc)
|
m_currentTravelFlags = 0; // reset travel flags (jumping etc)
|
||||||
|
|
||||||
// we're not at the end of the list?
|
|
||||||
// we're not at the end of the list?
|
// we're not at the end of the list?
|
||||||
if (m_navNode != NULL)
|
if (m_navNode != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -2347,7 +2346,7 @@ bool Bot::HeadTowardWaypoint (void)
|
||||||
kills = (g_experienceData + (waypoint * g_numWaypoints) + waypoint)->team1Damage / g_highestDamageCT;
|
kills = (g_experienceData + (waypoint * g_numWaypoints) + waypoint)->team1Damage / g_highestDamageCT;
|
||||||
|
|
||||||
// if damage done higher than one
|
// if damage done higher than one
|
||||||
if (kills > 0.15f && g_timeRoundMid > GetWorldTime ())
|
if (kills > 0.15f && g_timeRoundMid + 15.0f > GetWorldTime ())
|
||||||
{
|
{
|
||||||
switch (m_personality)
|
switch (m_personality)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue