do not compare traceresult fraction directly 1.0
some cosmetic changes bots will spray more logos reduced "cheating" in jumping a little bit optimized checking 3d vector for zero
This commit is contained in:
parent
cdcf59c76b
commit
36b865abde
14 changed files with 958 additions and 1060 deletions
|
|
@ -567,42 +567,40 @@ const int FV_EXPERIENCE = 3;
|
|||
const int FV_VISTABLE = 1;
|
||||
|
||||
// some hardcoded desire defines used to override calculated ones
|
||||
const float TASKPRI_NORMAL = 35.0;
|
||||
const float TASKPRI_PAUSE = 36.0;
|
||||
const float TASKPRI_CAMP = 37.0;
|
||||
const float TASKPRI_SPRAYLOGO = 38.0;
|
||||
const float TASKPRI_FOLLOWUSER = 39.0;
|
||||
const float TASKPRI_MOVETOPOSITION = 50.0;
|
||||
const float TASKPRI_DEFUSEBOMB = 89.0;
|
||||
const float TASKPRI_PLANTBOMB = 89.0;
|
||||
const float TASKPRI_ATTACK = 90.0;
|
||||
const float TASKPRI_SEEKCOVER = 91.0;
|
||||
const float TASKPRI_HIDE = 92.0;
|
||||
const float TASKPRI_THROWGRENADE = 99.0;
|
||||
const float TASKPRI_DOUBLEJUMP = 99.0;
|
||||
const float TASKPRI_BLINDED = 100.0;
|
||||
const float TASKPRI_SHOOTBREAKABLE = 100.0;
|
||||
const float TASKPRI_ESCAPEFROMBOMB = 100.0;
|
||||
const float TASKPRI_NORMAL = 35.0f;
|
||||
const float TASKPRI_PAUSE = 36.0f;
|
||||
const float TASKPRI_CAMP = 37.0f;
|
||||
const float TASKPRI_SPRAYLOGO = 38.0f;
|
||||
const float TASKPRI_FOLLOWUSER = 39.0f;
|
||||
const float TASKPRI_MOVETOPOSITION = 50.0f;
|
||||
const float TASKPRI_DEFUSEBOMB = 89.0f;
|
||||
const float TASKPRI_PLANTBOMB = 89.0f;
|
||||
const float TASKPRI_ATTACK = 90.0f;
|
||||
const float TASKPRI_SEEKCOVER = 91.0f;
|
||||
const float TASKPRI_HIDE = 92.0f;
|
||||
const float TASKPRI_THROWGRENADE = 99.0f;
|
||||
const float TASKPRI_DOUBLEJUMP = 99.0f;
|
||||
const float TASKPRI_BLINDED = 100.0f;
|
||||
const float TASKPRI_SHOOTBREAKABLE = 100.0f;
|
||||
const float TASKPRI_ESCAPEFROMBOMB = 100.0f;
|
||||
|
||||
const float MAX_GRENADE_TIMER = 2.34f;
|
||||
const float TRACE_FRACTION_EQ = 0.999999f;
|
||||
|
||||
const int MAX_HOSTAGES = 8;
|
||||
const int MAX_PATH_INDEX = 8;
|
||||
const int MAX_DAMAGE_VALUE = 2040;
|
||||
const int MAX_GOAL_VALUE = 2040;
|
||||
const int MAX_KILL_HISTORY = 16;
|
||||
const int MAX_REG_MESSAGES = 256;
|
||||
const int MAX_WAYPOINTS = 1024;
|
||||
const int MAX_WEAPONS = 32;
|
||||
const int NUM_WEAPONS = 26;
|
||||
const int MAX_COLLIDE_MOVES = 3;
|
||||
|
||||
// weapon masks
|
||||
const int WEAPON_PRIMARY = ((1 << WEAPON_XM1014) | (1 <<WEAPON_M3) | (1 << WEAPON_MAC10) | (1 << WEAPON_UMP45) | (1 << WEAPON_MP5) | (1 << WEAPON_TMP) | (1 << WEAPON_P90) | (1 << WEAPON_AUG) | (1 << WEAPON_M4A1) | (1 << WEAPON_SG552) | (1 << WEAPON_AK47) | (1 << WEAPON_SCOUT) | (1 << WEAPON_SG550) | (1 << WEAPON_AWP) | (1 << WEAPON_G3SG1) | (1 << WEAPON_M249) | (1 << WEAPON_FAMAS) | (1 << WEAPON_GALIL));
|
||||
const int WEAPON_SECONDARY = ((1 << WEAPON_P228) | (1 << WEAPON_ELITE) | (1 << WEAPON_USP) | (1 << WEAPON_GLOCK) | (1 << WEAPON_DEAGLE) | (1 << WEAPON_FIVESEVEN));
|
||||
|
||||
// maximum collide moves
|
||||
const int MAX_COLLIDE_MOVES = 3;
|
||||
|
||||
// this structure links waypoints returned from pathfinder
|
||||
struct PathNode
|
||||
{
|
||||
|
|
@ -930,7 +928,7 @@ private:
|
|||
|
||||
float m_duckTime; // time to duck
|
||||
float m_jumpTime; // time last jump happened
|
||||
float m_voiceTimers[Chatter_Total]; // voice command timers
|
||||
float m_chatterTimes[Chatter_Total]; // voice command timers
|
||||
float m_soundUpdateTime; // time to update the sound
|
||||
float m_heardSoundTime; // last time noise is heard
|
||||
float m_buttonPushTime; // time to push the button
|
||||
|
|
@ -1505,7 +1503,7 @@ public:
|
|||
int FindNearest (const Vector &origin, float minDistance = 99999999.0f, int flags = -1);
|
||||
void FindInRadius (Array <int> &radiusHolder, float radius, const Vector &origin, int maxCount = -1);
|
||||
|
||||
void Add (int flags, const Vector &waypointOrigin = nullvec);
|
||||
void Add (int flags, const Vector &waypointOrigin = Vector::GetZero ());
|
||||
void Delete (void);
|
||||
void ToggleFlags (int toggleFlag);
|
||||
void SetRadius (int radius);
|
||||
|
|
|
|||
|
|
@ -592,14 +592,14 @@ public:
|
|||
}
|
||||
|
||||
//
|
||||
// Function: IsNull
|
||||
// Function: IsZero
|
||||
//
|
||||
// Checks whether vector is null.
|
||||
//
|
||||
// Returns:
|
||||
// True if this vector is (0.0f, 0.0f, 0.0f) within tolerance, false otherwise.
|
||||
//
|
||||
inline bool IsNull (void) const
|
||||
inline bool IsZero (void) const
|
||||
{
|
||||
return Math::FltZero (x) && Math::FltZero (y) && Math::FltZero (z);
|
||||
}
|
||||
|
|
@ -612,10 +612,17 @@ public:
|
|||
// Returns:
|
||||
// Nulled vector.
|
||||
//
|
||||
inline static const Vector &GetNull (void)
|
||||
inline static const Vector &GetZero (void)
|
||||
{
|
||||
static const Vector &s_null = Vector (0.0, 0.0, 0.0f);
|
||||
return s_null;
|
||||
static const Vector &s_zero = Vector (0.0f, 0.0f, 0.0f);
|
||||
return s_zero;
|
||||
}
|
||||
|
||||
inline void Zero (void)
|
||||
{
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
z = 0.0f;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -729,9 +736,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static const Vector &nullvec = Vector::GetNull ();
|
||||
|
||||
|
||||
//
|
||||
// Class: List
|
||||
// Simple linked list container.
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VSPerformanceSession Version="1.00">
|
||||
<Options>
|
||||
<Solution>yapb.sln</Solution>
|
||||
<CollectionMethod>Sampling</CollectionMethod>
|
||||
<AllocationMethod>None</AllocationMethod>
|
||||
<AddReport>true</AddReport>
|
||||
<ResourceBasedAnalysisSelected>true</ResourceBasedAnalysisSelected>
|
||||
<UniqueReport>Timestamp</UniqueReport>
|
||||
<SamplingMethod>Cycles</SamplingMethod>
|
||||
<CycleCount>10000000</CycleCount>
|
||||
<PageFaultCount>10</PageFaultCount>
|
||||
<SysCallCount>10</SysCallCount>
|
||||
<SamplingCounter Name="" ReloadValue="00000000000f4240" DisplayName="" />
|
||||
<RelocateBinaries>false</RelocateBinaries>
|
||||
<HardwareCounters EnableHWCounters="false" />
|
||||
<EtwSettings />
|
||||
<PdhSettings>
|
||||
<PdhCountersEnabled>false</PdhCountersEnabled>
|
||||
<PdhCountersRate>500</PdhCountersRate>
|
||||
<PdhCounters>
|
||||
<PdhCounter>\Memory\Pages/sec</PdhCounter>
|
||||
<PdhCounter>\PhysicalDisk(_Total)\Avg. Disk Queue Length</PdhCounter>
|
||||
<PdhCounter>\Processor(_Total)\% Processor Time</PdhCounter>
|
||||
</PdhCounters>
|
||||
</PdhSettings>
|
||||
</Options>
|
||||
<ExcludeSmallFuncs>true</ExcludeSmallFuncs>
|
||||
<JScriptProfilingEnabled>false</JScriptProfilingEnabled>
|
||||
<PreinstrumentEvent>
|
||||
<InstrEventExclude>false</InstrEventExclude>
|
||||
</PreinstrumentEvent>
|
||||
<PostinstrumentEvent>
|
||||
<InstrEventExclude>false</InstrEventExclude>
|
||||
</PostinstrumentEvent>
|
||||
<Reports>
|
||||
<Report>
|
||||
<Path>Report150602.vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(1).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(2).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(3).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(4).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(5).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150602(6).vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150603.vspx</Path>
|
||||
</Report>
|
||||
<Report>
|
||||
<Path>Report150603(1).vspx</Path>
|
||||
</Report>
|
||||
</Reports>
|
||||
</VSPerformanceSession>
|
||||
|
|
@ -22,7 +22,7 @@ OBJECTS = $(SRC_DIR)/basecode.cpp \
|
|||
$(SRC_DIR)/support.cpp \
|
||||
$(SRC_DIR)/waypoint.cpp \
|
||||
|
||||
C_OPT_FLAGS = -O3 -DNDEBUG=1 -ffast-math -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_OPT_FLAGS = -O3 -DNDEBUG=1 -fno-exceptions -fno-rtti -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -32,7 +32,7 @@ void StripTags (char *buffer)
|
|||
fieldStop = strstr (buffer, tagClose[index]) - buffer; // look for a tag stop
|
||||
|
||||
// have we found a tag stop?
|
||||
if ((fieldStop > fieldStart) && (fieldStop < 32))
|
||||
if (fieldStop > fieldStart && fieldStop < 32)
|
||||
{
|
||||
int tagLength = strlen (tagClose[index]);
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ void Bot::PrepareChatMessage (char *text)
|
|||
|
||||
for (i = 0; i < GetMaxClients (); i++)
|
||||
{
|
||||
if (!(g_clients[i].flags & CF_USED) || !(g_clients[i].flags & CF_ALIVE) || (g_clients[i].team != m_team) || (g_clients[i].ent == GetEntity ()))
|
||||
if (!(g_clients[i].flags & CF_USED) || !(g_clients[i].flags & CF_ALIVE) || g_clients[i].team != m_team || g_clients[i].ent == GetEntity ())
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
|
@ -232,7 +232,7 @@ void Bot::PrepareChatMessage (char *text)
|
|||
|
||||
if (i < GetMaxClients ())
|
||||
{
|
||||
if (!IsEntityNull (pev->dmg_inflictor) && (m_team == GetTeam (pev->dmg_inflictor)))
|
||||
if (!IsEntityNull (pev->dmg_inflictor) && m_team == GetTeam (pev->dmg_inflictor))
|
||||
talkEntity = pev->dmg_inflictor;
|
||||
else
|
||||
talkEntity = g_clients[i].ent;
|
||||
|
|
@ -243,7 +243,7 @@ void Bot::PrepareChatMessage (char *text)
|
|||
{
|
||||
for (i = 0; i < GetMaxClients (); i++)
|
||||
{
|
||||
if (!(g_clients[i].flags & CF_USED) || (g_clients[i].team != m_team) || (g_clients[i].ent == GetEntity ()))
|
||||
if (!(g_clients[i].flags & CF_USED) || g_clients[i].team != m_team || g_clients[i].ent == GetEntity ())
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
|
@ -263,7 +263,7 @@ void Bot::PrepareChatMessage (char *text)
|
|||
|
||||
for (i = 0; i < GetMaxClients (); i++)
|
||||
{
|
||||
if (!(g_clients[i].flags & CF_USED) || !(g_clients[i].flags & CF_ALIVE) || (g_clients[i].team == m_team) || (g_clients[i].ent == GetEntity ()))
|
||||
if (!(g_clients[i].flags & CF_USED) || !(g_clients[i].flags & CF_ALIVE) || g_clients[i].team == m_team || g_clients[i].ent == GetEntity ())
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ void Bot::PrepareChatMessage (char *text)
|
|||
{
|
||||
for (i = 0; i < GetMaxClients (); i++)
|
||||
{
|
||||
if (!(g_clients[i].flags & CF_USED) || (g_clients[i].team == m_team) || (g_clients[i].ent == GetEntity ()))
|
||||
if (!(g_clients[i].flags & CF_USED) || g_clients[i].team == m_team || g_clients[i].ent == GetEntity ())
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
if (IsEnemyHiddenByRendering (target))
|
||||
{
|
||||
*bodyPart = 0;
|
||||
*origin = nullvec;
|
||||
origin->Zero();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
// check for the body
|
||||
TraceLine (botHead, target->v.origin, true, true, GetEntity (), &tr);
|
||||
|
||||
if (tr.flFraction >= 1.0f)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
*bodyPart |= VISIBLE_BODY;
|
||||
*origin = target->v.origin;
|
||||
|
|
@ -121,7 +121,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
// check for the head
|
||||
TraceLine (botHead, target->v.origin + target->v.view_ofs, true, true, GetEntity (), &tr);
|
||||
|
||||
if (tr.flFraction >= 1.0f)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
*bodyPart |= VISIBLE_HEAD;
|
||||
*origin = target->v.origin + target->v.view_ofs;
|
||||
|
|
@ -184,7 +184,7 @@ bool Bot::CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart)
|
|||
TraceLine (botHead, pos, true, true, GetEntity (), &tr);
|
||||
|
||||
// check if we hit something
|
||||
if (tr.flFraction >= 1.0f)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
*origin = tr.vecEndPos;
|
||||
*bodyPart |= VISIBLE_OTHER;
|
||||
|
|
@ -276,14 +276,14 @@ bool Bot::LookupEnemy (void)
|
|||
// do some blind by smoke grenade
|
||||
if (m_blindRecognizeTime < GetWorldTime () && IsBehindSmokeClouds (player))
|
||||
{
|
||||
m_blindRecognizeTime = GetWorldTime () + Random.Float (1.0, 2.0);
|
||||
m_blindRecognizeTime = GetWorldTime () + Random.Float (1.0f, 2.0f);
|
||||
|
||||
if (Random.Long (0, 100) < 50)
|
||||
ChatterMessage (Chatter_BehindSmoke);
|
||||
}
|
||||
|
||||
if (player->v.button & (IN_ATTACK | IN_ATTACK2))
|
||||
m_blindRecognizeTime = GetWorldTime () - 0.1;
|
||||
m_blindRecognizeTime = GetWorldTime () - 0.1f;
|
||||
|
||||
// see if bot can see the player...
|
||||
if (m_blindRecognizeTime < GetWorldTime () && IsEnemyViewable (player))
|
||||
|
|
@ -324,7 +324,7 @@ bool Bot::LookupEnemy (void)
|
|||
m_seeEnemyTime = GetWorldTime ();
|
||||
|
||||
// zero out reaction time
|
||||
m_actualReactionTime = 0.0;
|
||||
m_actualReactionTime = 0.0f;
|
||||
m_lastEnemy = newEnemy;
|
||||
m_lastEnemyOrigin = newEnemy->v.origin;
|
||||
|
||||
|
|
@ -343,11 +343,11 @@ bool Bot::LookupEnemy (void)
|
|||
m_enemySurpriseTime = GetWorldTime () + m_actualReactionTime;
|
||||
|
||||
// zero out reaction time
|
||||
m_actualReactionTime = 0.0;
|
||||
m_actualReactionTime = 0.0f;
|
||||
m_enemy = newEnemy;
|
||||
m_lastEnemy = newEnemy;
|
||||
m_lastEnemyOrigin = newEnemy->v.origin;
|
||||
m_enemyReachableTimer = 0.0;
|
||||
m_enemyReachableTimer = 0.0f;
|
||||
|
||||
// keep track of when we last saw an enemy
|
||||
m_seeEnemyTime = GetWorldTime ();
|
||||
|
|
@ -400,7 +400,7 @@ bool Bot::LookupEnemy (void)
|
|||
}
|
||||
else if (m_shootAtDeadTime > GetWorldTime ())
|
||||
{
|
||||
m_actualReactionTime = 0.0;
|
||||
m_actualReactionTime = 0.0f;
|
||||
m_states |= STATE_SUSPECT_ENEMY;
|
||||
|
||||
return true;
|
||||
|
|
@ -425,19 +425,19 @@ bool Bot::LookupEnemy (void)
|
|||
}
|
||||
|
||||
// check if bots should reload...
|
||||
if ((m_aimFlags <= AIM_PREDICT_PATH && m_seeEnemyTime + 3.0 < GetWorldTime () && !(m_states & (STATE_SEEING_ENEMY | STATE_HEARING_ENEMY)) && IsEntityNull (m_lastEnemy) && IsEntityNull (m_enemy) && GetTaskId () != TASK_SHOOTBREAKABLE && GetTaskId () != TASK_PLANTBOMB && GetTaskId () != TASK_DEFUSEBOMB) || g_roundEnded)
|
||||
if ((m_aimFlags <= AIM_PREDICT_PATH && m_seeEnemyTime + 3.0f < GetWorldTime () && !(m_states & (STATE_SEEING_ENEMY | STATE_HEARING_ENEMY)) && IsEntityNull (m_lastEnemy) && IsEntityNull (m_enemy) && GetTaskId () != TASK_SHOOTBREAKABLE && GetTaskId () != TASK_PLANTBOMB && GetTaskId () != TASK_DEFUSEBOMB) || g_roundEnded)
|
||||
{
|
||||
if (!m_reloadState)
|
||||
m_reloadState = RELOAD_PRIMARY;
|
||||
}
|
||||
|
||||
// is the bot using a sniper rifle or a zoomable rifle?
|
||||
if ((UsesSniper () || UsesZoomableRifle ()) && m_zoomCheckTime + 1.0 < GetWorldTime ())
|
||||
if ((UsesSniper () || UsesZoomableRifle ()) && m_zoomCheckTime + 1.0f < GetWorldTime ())
|
||||
{
|
||||
if (pev->fov < 90) // let the bot zoom out
|
||||
if (pev->fov < 90.0f) // let the bot zoom out
|
||||
pev->button |= IN_ATTACK2;
|
||||
else
|
||||
m_zoomCheckTime = 0.0;
|
||||
m_zoomCheckTime = 0.0f;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -451,7 +451,7 @@ const Vector &Bot::GetAimPosition (void)
|
|||
|
||||
// get enemy position initially
|
||||
Vector targetOrigin = m_enemy->v.origin;
|
||||
Vector randomize = nullvec;
|
||||
Vector randomize;
|
||||
|
||||
const Vector &adjust = Vector (Random.Float (m_enemy->v.mins.x * 0.5f, m_enemy->v.maxs.x * 0.5f), Random.Float (m_enemy->v.mins.y * 0.5f, m_enemy->v.maxs.y * 0.5f), Random.Float (m_enemy->v.mins.z * 0.5f, m_enemy->v.maxs.z * 0.5f));
|
||||
|
||||
|
|
@ -490,9 +490,9 @@ const Vector &Bot::GetAimPosition (void)
|
|||
}
|
||||
m_lastEnemyOrigin = targetOrigin;
|
||||
}
|
||||
const Vector &velocity = UsesSniper () ? nullvec : 1.0f * m_frameInterval * (m_enemy->v.velocity - pev->velocity);
|
||||
const Vector &velocity = UsesSniper () ? Vector::GetZero () : 1.0f * m_frameInterval * (m_enemy->v.velocity - pev->velocity);
|
||||
|
||||
if (m_difficulty < 3 && randomize != nullvec)
|
||||
if (m_difficulty < 3 && !randomize.IsZero ())
|
||||
{
|
||||
float divOffs = (m_enemyOrigin - pev->origin).GetLength ();
|
||||
|
||||
|
|
@ -597,7 +597,7 @@ bool Bot::IsFriendInLineOfFire (float distance)
|
|||
edict_t *ent = g_clients[i].ent;
|
||||
|
||||
float friendDistance = (ent->v.origin - pev->origin).GetLength ();
|
||||
float squareDistance = sqrtf (1089.0 + (friendDistance * friendDistance));
|
||||
float squareDistance = sqrtf (1089.0f + (friendDistance * friendDistance));
|
||||
|
||||
if (GetShootingConeDeviation (GetEntity (), &ent->v.origin) > (friendDistance * friendDistance) / (squareDistance * squareDistance) && friendDistance <= distance)
|
||||
return true;
|
||||
|
|
@ -631,7 +631,7 @@ bool Bot::IsShootableThruObstacle (const Vector &dest)
|
|||
const Vector &source = tr.vecEndPos;
|
||||
TraceLine (dest, source, true, GetEntity (), &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ)
|
||||
{
|
||||
if ((tr.vecEndPos - dest).GetLengthSquared () > GET_SQUARE (800.0f))
|
||||
return false;
|
||||
|
|
@ -669,7 +669,7 @@ bool Bot::IsShootableThruObstacleEx (const Vector &dest)
|
|||
|
||||
Vector source = EyePosition ();
|
||||
Vector direction = (dest - source).Normalize (); // 1 unit long
|
||||
Vector point = nullvec;
|
||||
Vector point;
|
||||
|
||||
int thikness = 0;
|
||||
int numHits = 0;
|
||||
|
|
@ -677,7 +677,7 @@ bool Bot::IsShootableThruObstacleEx (const Vector &dest)
|
|||
TraceResult tr;
|
||||
TraceLine (source, dest, true, true, GetEntity (), &tr);
|
||||
|
||||
while (tr.flFraction != 1.0 && numHits < 3)
|
||||
while (tr.flFraction <= TRACE_FRACTION_EQ && numHits < 3)
|
||||
{
|
||||
numHits++;
|
||||
thikness++;
|
||||
|
|
@ -713,7 +713,7 @@ bool Bot::DoFirePause (float distance)
|
|||
if (m_firePause > GetWorldTime ())
|
||||
return true;
|
||||
|
||||
if ((m_aimFlags & AIM_ENEMY) && m_enemyOrigin != nullvec)
|
||||
if ((m_aimFlags & AIM_ENEMY) && !m_enemyOrigin.IsZero ())
|
||||
{
|
||||
if (IsEnemyProtectedByShield (m_enemy) && GetShootingConeDeviation (GetEntity (), &m_enemyOrigin) > 0.92f)
|
||||
return true;
|
||||
|
|
@ -725,9 +725,9 @@ bool Bot::DoFirePause (float distance)
|
|||
if (distance < BurstDistance)
|
||||
return false;
|
||||
else if (distance < 2 * BurstDistance)
|
||||
offset = 10.0;
|
||||
offset = 10.0f;
|
||||
else
|
||||
offset = 5.0;
|
||||
offset = 5.0f;
|
||||
|
||||
const float xPunch = DegreeToRadian (pev->punchangle.x);
|
||||
const float yPunch = DegreeToRadian (pev->punchangle.y);
|
||||
|
|
@ -751,7 +751,7 @@ void Bot::FireWeapon (void)
|
|||
// if using grenade stop this
|
||||
if (m_isUsingGrenade)
|
||||
{
|
||||
m_shootTime = GetWorldTime () + 0.1;
|
||||
m_shootTime = GetWorldTime () + 0.1f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -778,7 +778,7 @@ void Bot::FireWeapon (void)
|
|||
goto WeaponSelectEnd;
|
||||
|
||||
// use knife if near and good difficulty (l33t dude!)
|
||||
if (m_difficulty >= 3 && pev->health > 80 && !IsEntityNull (enemy) && pev->health >= enemy->v.health && distance < 100.0f && !IsOnLadder () && !IsGroupOfEnemies (pev->origin))
|
||||
if (m_difficulty >= 3 && pev->health > 80.0f && !IsEntityNull (enemy) && pev->health >= enemy->v.health && distance < 100.0f && !IsOnLadder () && !IsGroupOfEnemies (pev->origin))
|
||||
goto WeaponSelectEnd;
|
||||
|
||||
// loop through all the weapons until terminator is found...
|
||||
|
|
@ -833,7 +833,7 @@ WeaponSelectEnd:
|
|||
if (!m_isReloading)
|
||||
{
|
||||
m_reloadState = RELOAD_NONE;
|
||||
m_reloadCheckTime = GetWorldTime () + 3.0;
|
||||
m_reloadCheckTime = GetWorldTime () + 3.0f;
|
||||
}
|
||||
|
||||
// select this weapon if it isn't already selected
|
||||
|
|
@ -842,8 +842,8 @@ WeaponSelectEnd:
|
|||
SelectWeaponByName (g_weaponDefs[selectId].className);
|
||||
|
||||
// reset burst fire variables
|
||||
m_firePause = 0.0;
|
||||
m_timeLastFired = 0.0;
|
||||
m_firePause = 0.0f;
|
||||
m_timeLastFired = 0.0f;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -867,40 +867,40 @@ WeaponSelectEnd:
|
|||
|
||||
if (HasShield () && m_shieldCheckTime < GetWorldTime () && GetTaskId () != TASK_CAMP) // better shield gun usage
|
||||
{
|
||||
if (distance >= 750 && !IsShieldDrawn ())
|
||||
if (distance >= 750.0f && !IsShieldDrawn ())
|
||||
pev->button |= IN_ATTACK2; // draw the shield
|
||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && (m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable(m_enemy)))
|
||||
pev->button |= IN_ATTACK2; // draw out the shield
|
||||
|
||||
m_shieldCheckTime = GetWorldTime () + 1.0;
|
||||
m_shieldCheckTime = GetWorldTime () + 1.0f;
|
||||
}
|
||||
|
||||
if (UsesSniper () && m_zoomCheckTime < GetWorldTime ()) // is the bot holding a sniper rifle?
|
||||
{
|
||||
if (distance > 1500 && pev->fov >= 40) // should the bot switch to the long-range zoom?
|
||||
if (distance > 1500.0f && pev->fov >= 40.0f) // should the bot switch to the long-range zoom?
|
||||
pev->button |= IN_ATTACK2;
|
||||
|
||||
else if (distance > 150 && pev->fov >= 90) // else should the bot switch to the close-range zoom ?
|
||||
else if (distance > 150.0f && pev->fov >= 90.0f) // else should the bot switch to the close-range zoom ?
|
||||
pev->button |= IN_ATTACK2;
|
||||
|
||||
else if (distance <= 150 && pev->fov < 90) // else should the bot restore the normal view ?
|
||||
else if (distance <= 150.0f && pev->fov < 90.0f) // else should the bot restore the normal view ?
|
||||
pev->button |= IN_ATTACK2;
|
||||
|
||||
m_zoomCheckTime = GetWorldTime ();
|
||||
|
||||
if (!IsEntityNull (m_enemy) && (pev->velocity.x != 0 || pev->velocity.y != 0 || pev->velocity.z != 0) && (pev->basevelocity.x != 0 || pev->basevelocity.y != 0 || pev->basevelocity.z != 0))
|
||||
if (!IsEntityNull (m_enemy) && (pev->velocity.x != 0.0f || pev->velocity.y != 0.0f || pev->velocity.z != 0.0f) && (pev->basevelocity.x != 0.0f || pev->basevelocity.y != 0.0f || pev->basevelocity.z != 0.0f))
|
||||
{
|
||||
m_moveSpeed = 0.0;
|
||||
m_strafeSpeed = 0.0;
|
||||
m_moveSpeed = 0.0f;
|
||||
m_strafeSpeed = 0.0f;
|
||||
m_navTimeset = GetWorldTime ();
|
||||
}
|
||||
}
|
||||
else if (m_difficulty < 4 && UsesZoomableRifle () && m_zoomCheckTime < GetWorldTime ()) // else is the bot holding a zoomable rifle?
|
||||
{
|
||||
if (distance > 800 && pev->fov >= 90) // should the bot switch to zoomed mode?
|
||||
if (distance > 800.0f && pev->fov >= 90.0f) // should the bot switch to zoomed mode?
|
||||
pev->button |= IN_ATTACK2;
|
||||
|
||||
else if (distance <= 800 && pev->fov < 90) // else should the bot restore the normal view?
|
||||
else if (distance <= 800.0f && pev->fov < 90.0f) // else should the bot restore the normal view?
|
||||
pev->button |= IN_ATTACK2;
|
||||
|
||||
m_zoomCheckTime = GetWorldTime ();
|
||||
|
|
@ -918,7 +918,7 @@ WeaponSelectEnd:
|
|||
}
|
||||
|
||||
// need to care for burst fire?
|
||||
if (distance < 256.0 || m_blindTime > GetWorldTime ())
|
||||
if (distance < 256.0f || m_blindTime > GetWorldTime ())
|
||||
{
|
||||
if (selectId == WEAPON_KNIFE)
|
||||
{
|
||||
|
|
@ -1084,7 +1084,7 @@ void Bot::CombatFight (void)
|
|||
|
||||
if (UsesPistol() && !((m_enemy->v.weapons & WEAPON_SECONDARY) || (m_enemy->v.weapons & (1 << WEAPON_SG550))) && !g_bombPlanted)
|
||||
{
|
||||
m_fearLevel += 0.5;
|
||||
m_fearLevel += 0.5f;
|
||||
|
||||
CheckGrenades();
|
||||
CheckThrow (EyePosition(), m_throw);
|
||||
|
|
@ -1102,14 +1102,14 @@ void Bot::CombatFight (void)
|
|||
|
||||
task->id = TASK_SEEKCOVER;
|
||||
task->resume = true;
|
||||
task->desire = TASKPRI_ATTACK + 1.0;
|
||||
task->desire = TASKPRI_ATTACK + 1.0f;
|
||||
}
|
||||
else if (approach < 50)
|
||||
m_moveSpeed = 0.0;
|
||||
m_moveSpeed = 0.0f;
|
||||
else
|
||||
m_moveSpeed = pev->maxspeed;
|
||||
|
||||
if (distance < 96 && m_currentWeapon != WEAPON_KNIFE)
|
||||
if (distance < 96.0f && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = -pev->maxspeed;
|
||||
|
||||
if (UsesSniper ())
|
||||
|
|
@ -1123,9 +1123,9 @@ void Bot::CombatFight (void)
|
|||
{
|
||||
int rand = Random.Long (1, 100);
|
||||
|
||||
if (distance < 450)
|
||||
if (distance < 450.0f)
|
||||
m_fightStyle = 0;
|
||||
else if (distance < 1024)
|
||||
else if (distance < 1024.0f)
|
||||
{
|
||||
if (rand < (UsesSubmachineGun () ? 50 : 30))
|
||||
m_fightStyle = 0;
|
||||
|
|
@ -1144,7 +1144,7 @@ void Bot::CombatFight (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_lastFightStyleCheck + 3.0 < GetWorldTime ())
|
||||
if (m_lastFightStyleCheck + 3.0f < GetWorldTime ())
|
||||
{
|
||||
if (Random.Long (0, 100) < 50)
|
||||
m_fightStyle = 1;
|
||||
|
|
@ -1173,7 +1173,7 @@ void Bot::CombatFight (void)
|
|||
if (Random.Long (1, 100) < 30)
|
||||
m_combatStrafeDir ^= 1;
|
||||
|
||||
m_strafeSetTime = GetWorldTime () + Random.Float (0.5, 3.0);
|
||||
m_strafeSetTime = GetWorldTime () + Random.Float (0.5f, 3.0f);
|
||||
}
|
||||
|
||||
if (m_combatStrafeDir == 0)
|
||||
|
|
@ -1183,7 +1183,7 @@ void Bot::CombatFight (void)
|
|||
else
|
||||
{
|
||||
m_combatStrafeDir ^= 1;
|
||||
m_strafeSetTime = GetWorldTime () + 1.0;
|
||||
m_strafeSetTime = GetWorldTime () + 1.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1193,15 +1193,15 @@ void Bot::CombatFight (void)
|
|||
else
|
||||
{
|
||||
m_combatStrafeDir ^= 1;
|
||||
m_strafeSetTime = GetWorldTime () + 1.0;
|
||||
m_strafeSetTime = GetWorldTime () + 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_difficulty >= 3 && (m_jumpTime + 5.0 < GetWorldTime () && IsOnFloor () && Random.Long (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.GetLength2D () > 150.0) && !UsesSniper ())
|
||||
if (m_difficulty >= 3 && (m_jumpTime + 5.0f < GetWorldTime () && IsOnFloor () && Random.Long (0, 1000) < (m_isReloading ? 8 : 2) && pev->velocity.GetLength2D () > 150.0f) && !UsesSniper ())
|
||||
pev->button |= IN_JUMP;
|
||||
|
||||
if (m_moveSpeed > 0.0 && distance > 100.0 && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = 0.0;
|
||||
if (m_moveSpeed > 0.0f && distance > 100.0f && m_currentWeapon != WEAPON_KNIFE)
|
||||
m_moveSpeed = 0.0f;
|
||||
|
||||
if (m_currentWeapon == WEAPON_KNIFE)
|
||||
m_strafeSpeed = 0.0f;
|
||||
|
|
@ -1211,25 +1211,25 @@ void Bot::CombatFight (void)
|
|||
bool shouldDuck = true; // should duck
|
||||
|
||||
// check the enemy height
|
||||
float enemyHalfHeight = ((m_enemy->v.flags & FL_DUCKING) == FL_DUCKING ? 36.0 : 72.0) / 2;
|
||||
float enemyHalfHeight = ((m_enemy->v.flags & FL_DUCKING) == FL_DUCKING ? 36.0f : 72.0f) * 0.5f;
|
||||
|
||||
// check center/feet
|
||||
if (!IsVisible (m_enemy->v.origin, GetEntity ()) && !IsVisible (m_enemy->v.origin + Vector (0, 0, -enemyHalfHeight), GetEntity ()))
|
||||
if (!IsVisible (m_enemy->v.origin, GetEntity ()) && !IsVisible (m_enemy->v.origin + Vector (0.0f, 0.0f, -enemyHalfHeight), GetEntity ()))
|
||||
shouldDuck = false;
|
||||
|
||||
if (shouldDuck && GetTaskId () != TASK_SEEKCOVER && GetTaskId () != TASK_HUNTENEMY && (m_visibility & VISIBLE_BODY) && !(m_visibility & VISIBLE_OTHER) && waypoints.IsDuckVisible (m_currentWaypointIndex, waypoints.FindNearest (m_enemy->v.origin)))
|
||||
m_duckTime = GetWorldTime () + 0.5f;
|
||||
|
||||
m_moveSpeed = 0.0;
|
||||
m_strafeSpeed = 0.0;
|
||||
m_moveSpeed = 0.0f;
|
||||
m_strafeSpeed = 0.0f;
|
||||
m_navTimeset = GetWorldTime ();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_duckTime > GetWorldTime ())
|
||||
{
|
||||
m_moveSpeed = 0.0;
|
||||
m_strafeSpeed = 0.0;
|
||||
m_moveSpeed = 0.0f;
|
||||
m_strafeSpeed = 0.0f;
|
||||
}
|
||||
|
||||
if (m_moveSpeed > 0.0f && m_currentWeapon != WEAPON_KNIFE)
|
||||
|
|
@ -1245,7 +1245,7 @@ void Bot::CombatFight (void)
|
|||
{
|
||||
MakeVectors (pev->v_angle);
|
||||
|
||||
if (IsDeadlyDrop (pev->origin + (g_pGlobals->v_forward * m_moveSpeed * 0.2) + (g_pGlobals->v_right * m_strafeSpeed * 0.2) + (pev->velocity * m_frameInterval)))
|
||||
if (IsDeadlyDrop (pev->origin + (g_pGlobals->v_forward * m_moveSpeed * 0.2f) + (g_pGlobals->v_right * m_strafeSpeed * 0.2f) + (pev->velocity * m_frameInterval)))
|
||||
{
|
||||
m_strafeSpeed = -m_strafeSpeed;
|
||||
m_moveSpeed = -m_moveSpeed;
|
||||
|
|
@ -1443,7 +1443,6 @@ void Bot::SelectBestWeapon (void)
|
|||
m_reloadState = RELOAD_NONE;
|
||||
}
|
||||
|
||||
|
||||
void Bot::SelectPistol (void)
|
||||
{
|
||||
int oldWeapons = pev->weapons;
|
||||
|
|
@ -1506,7 +1505,7 @@ void Bot::AttachToUser (void)
|
|||
m_targetEntity = foundUsers.GetRandomElement ();
|
||||
|
||||
ChatterMessage (Chatter_LeadOnSir);
|
||||
PushTask (TASK_FOLLOWUSER, TASKPRI_FOLLOWUSER, -1, 0.0, true);
|
||||
PushTask (TASK_FOLLOWUSER, TASKPRI_FOLLOWUSER, -1, 0.0f, true);
|
||||
}
|
||||
|
||||
void Bot::CommandTeam (void)
|
||||
|
|
@ -1545,7 +1544,7 @@ void Bot::CommandTeam (void)
|
|||
else if (memberExists && yb_communication_type.GetInt () == 2)
|
||||
ChatterMessage(Chatter_ScaredEmotion);
|
||||
|
||||
m_timeTeamOrder = GetWorldTime () + Random.Float (5.0, 30.0);
|
||||
m_timeTeamOrder = GetWorldTime () + Random.Float (5.0f, 30.0f);
|
||||
}
|
||||
|
||||
bool Bot::IsGroupOfEnemies (const Vector &location, int numEnemies, int radius)
|
||||
|
|
@ -1581,7 +1580,7 @@ void Bot::CheckReload (void)
|
|||
}
|
||||
|
||||
m_isReloading = false; // update reloading status
|
||||
m_reloadCheckTime = GetWorldTime () + 3.0;
|
||||
m_reloadCheckTime = GetWorldTime () + 3.0f;
|
||||
|
||||
if (m_reloadState != RELOAD_NONE)
|
||||
{
|
||||
|
|
@ -1673,7 +1672,7 @@ void Bot::CheckReload (void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_ammoInClip[weaponIndex] < maxClip * 0.8 && g_weaponDefs[weaponIndex].ammo1 != -1 && g_weaponDefs[weaponIndex].ammo1 < 32 && m_ammo[g_weaponDefs[weaponIndex].ammo1] > 0)
|
||||
if (m_ammoInClip[weaponIndex] < maxClip * 0.8f && g_weaponDefs[weaponIndex].ammo1 != -1 && g_weaponDefs[weaponIndex].ammo1 < 32 && m_ammo[g_weaponDefs[weaponIndex].ammo1] > 0)
|
||||
{
|
||||
if (m_currentWeapon != weaponIndex)
|
||||
SelectWeaponByName (g_weaponDefs[weaponIndex].className);
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ bool g_autoWaypoint = false;
|
|||
bool g_bLearnJumpWaypoint = false;
|
||||
bool g_leaderChoosen[2] = {false, false};
|
||||
|
||||
float g_lastChatTime = 0.0;
|
||||
float g_timeRoundStart = 0.0;
|
||||
float g_timeRoundEnd = 0.0;
|
||||
float g_timeRoundMid = 0.0;
|
||||
float g_timeNextBombUpdate = 0.0;
|
||||
float g_timeBombPlanted = 0.0;
|
||||
float g_timePerSecondUpdate = 0.0;
|
||||
float g_lastRadioTime[2] = {0.0, 0.0};
|
||||
float g_autoPathDistance = 250.0;
|
||||
float g_lastChatTime = 0.0f;
|
||||
float g_timeRoundStart = 0.0f;
|
||||
float g_timeRoundEnd = 0.0f;
|
||||
float g_timeRoundMid = 0.0f;
|
||||
float g_timeNextBombUpdate = 0.0f;
|
||||
float g_timeBombPlanted = 0.0f;
|
||||
float g_timePerSecondUpdate = 0.0f;
|
||||
float g_lastRadioTime[2] = {0.0f, 0.0f};
|
||||
float g_autoPathDistance = 250.0f;
|
||||
|
||||
int g_lastRadio[2];
|
||||
int g_storeAddbotVars[4];
|
||||
|
|
@ -131,27 +131,27 @@ plugin_info_t Plugin_info =
|
|||
// table with all available actions for the bots (filtered in & out in Bot::SetConditions) some of them have subactions included
|
||||
TaskItem g_taskFilters[] =
|
||||
{
|
||||
{TASK_NORMAL, 0, -1, 0.0, true},
|
||||
{TASK_PAUSE, 0, -1, 0.0, false},
|
||||
{TASK_MOVETOPOSITION, 0, -1, 0.0, true},
|
||||
{TASK_FOLLOWUSER, 0, -1,0.0, true},
|
||||
{TASK_WAITFORGO, 0, -1, 0.0, true},
|
||||
{TASK_PICKUPITEM, 0, -1, 0.0, true},
|
||||
{TASK_CAMP, 0, -1, 0.0, true},
|
||||
{TASK_PLANTBOMB, 0, -1, 0.0, false},
|
||||
{TASK_DEFUSEBOMB, 0, -1, 0.0, false},
|
||||
{TASK_ATTACK, 0, -1, 0.0, false},
|
||||
{TASK_HUNTENEMY, 0, -1, 0.0, false},
|
||||
{TASK_SEEKCOVER, 0, -1, 0.0, false},
|
||||
{TASK_THROWHEGRENADE, 0, -1, 0.0, false},
|
||||
{TASK_THROWFLASHBANG, 0, -1, 0.0, false},
|
||||
{TASK_THROWSMOKE, 0, -1, 0.0, false},
|
||||
{TASK_DOUBLEJUMP, 0, -1, 0.0, false},
|
||||
{TASK_ESCAPEFROMBOMB, 0, -1, 0.0, false},
|
||||
{TASK_SHOOTBREAKABLE, 0, -1, 0.0, false},
|
||||
{TASK_HIDE, 0, -1, 0.0, false},
|
||||
{TASK_BLINDED, 0, -1, 0.0, false},
|
||||
{TASK_SPRAY, 0, -1, 0.0, false}
|
||||
{TASK_NORMAL, 0, -1, 0.0f, true},
|
||||
{TASK_PAUSE, 0, -1, 0.0f, false},
|
||||
{TASK_MOVETOPOSITION, 0, -1, 0.0f, true},
|
||||
{TASK_FOLLOWUSER, 0, -1, 0.0f, true},
|
||||
{TASK_WAITFORGO, 0, -1, 0.0f, true},
|
||||
{TASK_PICKUPITEM, 0, -1, 0.0f, true},
|
||||
{TASK_CAMP, 0, -1, 0.0f, true},
|
||||
{TASK_PLANTBOMB, 0, -1, 0.0f, false},
|
||||
{TASK_DEFUSEBOMB, 0, -1, 0.0f, false},
|
||||
{TASK_ATTACK, 0, -1, 0.0f, false},
|
||||
{TASK_HUNTENEMY, 0, -1, 0.0f, false},
|
||||
{TASK_SEEKCOVER, 0, -1, 0.0f, false},
|
||||
{TASK_THROWHEGRENADE, 0, -1, 0.0f, false},
|
||||
{TASK_THROWFLASHBANG, 0, -1, 0.0f, false},
|
||||
{TASK_THROWSMOKE, 0, -1, 0.0f, false},
|
||||
{TASK_DOUBLEJUMP, 0, -1, 0.0f, false},
|
||||
{TASK_ESCAPEFROMBOMB, 0, -1, 0.0f, false},
|
||||
{TASK_SHOOTBREAKABLE, 0, -1, 0.0f, false},
|
||||
{TASK_HIDE, 0, -1, 0.0f, false},
|
||||
{TASK_BLINDED, 0, -1, 0.0f, false},
|
||||
{TASK_SPRAY, 0, -1, 0.0f, false}
|
||||
};
|
||||
|
||||
// weapons and their specifications
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ void ParseVoiceEvent (const String &base, int type, float timeToRepeat)
|
|||
{
|
||||
temp[i].Trim ().TrimQuotes ();
|
||||
|
||||
if (GetWaveLength (temp[i]) == 0.0)
|
||||
if (GetWaveLength (temp[i]) == 0.0f)
|
||||
continue;
|
||||
|
||||
chatterItem.name = temp[i];
|
||||
|
|
|
|||
|
|
@ -819,10 +819,10 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
|
||||
m_startAction = GSM_IDLE;
|
||||
m_moneyAmount = 0;
|
||||
m_logotypeIndex = Random.Long (0, 5);
|
||||
m_logotypeIndex = Random.Long (0, 9);
|
||||
|
||||
// assign how talkative this bot will be
|
||||
m_sayTextBuffer.chatDelay = Random.Float (3.8, 10.0);
|
||||
m_sayTextBuffer.chatDelay = Random.Float (3.8f, 10.0f);
|
||||
m_sayTextBuffer.chatProbability = Random.Long (1, 100);
|
||||
|
||||
m_notKilled = false;
|
||||
|
|
@ -843,20 +843,20 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
{
|
||||
case 1:
|
||||
m_personality = PERSONALITY_RUSHER;
|
||||
m_baseAgressionLevel = Random.Float (0.7, 1.0);
|
||||
m_baseFearLevel = Random.Float (0.0, 0.4);
|
||||
m_baseAgressionLevel = Random.Float (0.7f, 1.0f);
|
||||
m_baseFearLevel = Random.Float (0.0f, 0.4f);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_personality = PERSONALITY_CAREFUL;
|
||||
m_baseAgressionLevel = Random.Float (0.2, 0.5);
|
||||
m_baseFearLevel = Random.Float (0.7, 1.0);
|
||||
m_baseAgressionLevel = Random.Float (0.2f, 0.5f);
|
||||
m_baseFearLevel = Random.Float (0.7f, 1.0f);
|
||||
break;
|
||||
|
||||
default:
|
||||
m_personality = PERSONALITY_NORMAL;
|
||||
m_baseAgressionLevel = Random.Float (0.4, 0.7);
|
||||
m_baseFearLevel = Random.Float (0.4, 0.7);
|
||||
m_baseAgressionLevel = Random.Float (0.4f, 0.7f);
|
||||
m_baseFearLevel = Random.Float (0.4f, 0.7f);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -869,7 +869,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
// copy them over to the temp level variables
|
||||
m_agressionLevel = m_baseAgressionLevel;
|
||||
m_fearLevel = m_baseFearLevel;
|
||||
m_nextEmotionUpdate = GetWorldTime () + 0.5;
|
||||
m_nextEmotionUpdate = GetWorldTime () + 0.5f;
|
||||
|
||||
// just to be sure
|
||||
m_actMessageIndex = 0;
|
||||
|
|
@ -962,20 +962,20 @@ void Bot::NewRound (void)
|
|||
// delete all allocated path nodes
|
||||
DeleteSearchNodes ();
|
||||
|
||||
m_waypointOrigin = nullvec;
|
||||
m_destOrigin = nullvec;
|
||||
m_waypointOrigin.Zero ();
|
||||
m_destOrigin.Zero ();
|
||||
m_currentWaypointIndex = -1;
|
||||
m_currentPath = NULL;
|
||||
m_currentTravelFlags = 0;
|
||||
m_goalFailed = 0;
|
||||
m_desiredVelocity = nullvec;
|
||||
m_desiredVelocity.Zero ();
|
||||
m_prevGoalIndex = -1;
|
||||
m_chosenGoalIndex = -1;
|
||||
m_loosedBombWptIndex = -1;
|
||||
|
||||
m_moveToC4 = false;
|
||||
m_duckDefuse = false;
|
||||
m_duckDefuseCheckTime = 0.0;
|
||||
m_duckDefuseCheckTime = 0.0f;
|
||||
|
||||
m_numFriendsLeft = 0;
|
||||
m_numEnemiesLeft = 0;
|
||||
|
|
@ -1011,26 +1011,26 @@ void Bot::NewRound (void)
|
|||
m_canChooseAimDirection = true;
|
||||
m_turnAwayFromFlashbang = 0.0f;
|
||||
|
||||
m_timeTeamOrder = 0.0;
|
||||
m_askCheckTime = 0.0;
|
||||
m_minSpeed = 260.0;
|
||||
m_prevSpeed = 0.0;
|
||||
m_prevOrigin = Vector (9999.0, 9999.0, 9999.0);
|
||||
m_timeTeamOrder = 0.0f;
|
||||
m_askCheckTime = 0.0f;
|
||||
m_minSpeed = 260.0f;
|
||||
m_prevSpeed = 0.0f;
|
||||
m_prevOrigin = Vector (9999.0f, 9999.0f, 9999.0f);
|
||||
m_prevTime = GetWorldTime ();
|
||||
m_blindRecognizeTime = GetWorldTime ();
|
||||
m_lookUpdateTime = GetWorldTime ();
|
||||
|
||||
m_viewDistance = 4096.0;
|
||||
m_maxViewDistance = 4096.0;
|
||||
m_viewDistance = 4096.0f;
|
||||
m_maxViewDistance = 4096.0f;
|
||||
|
||||
m_liftEntity = NULL;
|
||||
m_pickupItem = NULL;
|
||||
m_itemIgnore = NULL;
|
||||
m_itemCheckTime = 0.0;
|
||||
m_itemCheckTime = 0.0f;
|
||||
|
||||
m_breakableEntity = NULL;
|
||||
m_breakable = nullvec;
|
||||
m_timeDoorOpen = 0.0;
|
||||
m_breakable.Zero ();
|
||||
m_timeDoorOpen = 0.0f;
|
||||
|
||||
ResetCollideState ();
|
||||
ResetDoubleJumpState ();
|
||||
|
|
@ -1038,16 +1038,16 @@ void Bot::NewRound (void)
|
|||
m_enemy = NULL;
|
||||
m_lastVictim = NULL;
|
||||
m_lastEnemy = NULL;
|
||||
m_lastEnemyOrigin = nullvec;
|
||||
m_lastEnemyOrigin.Zero ();
|
||||
m_trackingEdict = NULL;
|
||||
m_timeNextTracking = 0.0;
|
||||
m_timeNextTracking = 0.0f;
|
||||
|
||||
m_buttonPushTime = 0.0;
|
||||
m_enemyUpdateTime = 0.0;
|
||||
m_seeEnemyTime = 0.0;
|
||||
m_shootAtDeadTime = 0.0;
|
||||
m_oldCombatDesire = 0.0;
|
||||
m_liftUsageTime = 0.0;
|
||||
m_buttonPushTime = 0.0f;
|
||||
m_enemyUpdateTime = 0.0f;
|
||||
m_seeEnemyTime = 0.0f;
|
||||
m_shootAtDeadTime = 0.0f;
|
||||
m_oldCombatDesire = 0.0f;
|
||||
m_liftUsageTime = 0.0f;
|
||||
|
||||
m_avoidGrenade = NULL;
|
||||
m_needAvoidGrenade = 0;
|
||||
|
|
@ -1060,31 +1060,31 @@ void Bot::NewRound (void)
|
|||
m_aimFlags = 0;
|
||||
m_liftState = 0;
|
||||
|
||||
m_position = nullvec;
|
||||
m_liftTravelPos = nullvec;
|
||||
m_position.Zero ();
|
||||
m_liftTravelPos.Zero ();
|
||||
|
||||
SetIdealReactionTimes (true);
|
||||
|
||||
m_targetEntity = NULL;
|
||||
m_tasks = NULL;
|
||||
m_followWaitTime = 0.0;
|
||||
m_followWaitTime = 0.0f;
|
||||
|
||||
for (i = 0; i < MAX_HOSTAGES; i++)
|
||||
m_hostages[i] = NULL;
|
||||
|
||||
for (i = 0; i < Chatter_Total; i++)
|
||||
m_voiceTimers[i] = -1.0;
|
||||
m_chatterTimes[i] = -1.0f;
|
||||
|
||||
m_isReloading = false;
|
||||
m_reloadState = RELOAD_NONE;
|
||||
|
||||
m_reloadCheckTime = 0.0;
|
||||
m_reloadCheckTime = 0.0f;
|
||||
m_shootTime = GetWorldTime ();
|
||||
m_playerTargetTime = GetWorldTime ();
|
||||
m_firePause = 0.0;
|
||||
m_timeLastFired = 0.0;
|
||||
m_firePause = 0.0f;
|
||||
m_timeLastFired = 0.0f;
|
||||
|
||||
m_grenadeCheckTime = 0.0;
|
||||
m_grenadeCheckTime = 0.0f;
|
||||
m_isUsingGrenade = false;
|
||||
|
||||
m_blindButton = 0;
|
||||
|
|
@ -1116,12 +1116,12 @@ void Bot::NewRound (void)
|
|||
m_inBombZone = false;
|
||||
m_hasC4 = false;
|
||||
|
||||
m_shieldCheckTime = 0.0;
|
||||
m_zoomCheckTime = 0.0;
|
||||
m_strafeSetTime = 0.0;
|
||||
m_shieldCheckTime = 0.0f;
|
||||
m_zoomCheckTime = 0.0f;
|
||||
m_strafeSetTime = 0.0f;
|
||||
m_combatStrafeDir = 0;
|
||||
m_fightStyle = 0;
|
||||
m_lastFightStyleCheck = 0.0;
|
||||
m_lastFightStyleCheck = 0.0f;
|
||||
|
||||
m_checkWeaponSwitch = true;
|
||||
m_checkKnifeSwitch = true;
|
||||
|
|
@ -1133,7 +1133,7 @@ void Bot::NewRound (void)
|
|||
m_defendHostage = false;
|
||||
m_headedTime = 0.0f;
|
||||
|
||||
m_timeLogoSpray = GetWorldTime () + Random.Float (0.5, 2.0);
|
||||
m_timeLogoSpray = GetWorldTime () + Random.Float (0.5f, 2.0f);
|
||||
m_spawnTime = GetWorldTime ();
|
||||
m_lastChatTime = GetWorldTime ();
|
||||
|
||||
|
|
@ -1142,7 +1142,7 @@ void Bot::NewRound (void)
|
|||
m_nextCampDirTime = 0;
|
||||
m_campButtons = 0;
|
||||
|
||||
m_soundUpdateTime = 0.0;
|
||||
m_soundUpdateTime = 0.0f;
|
||||
m_heardSoundTime = GetWorldTime ();
|
||||
|
||||
// clear its message queue
|
||||
|
|
@ -1154,7 +1154,7 @@ void Bot::NewRound (void)
|
|||
|
||||
// and put buying into its message queue
|
||||
PushMessageQueue (GSM_BUY_STUFF);
|
||||
PushTask (TASK_NORMAL, TASKPRI_NORMAL, -1, 0.0, true);
|
||||
PushTask (TASK_NORMAL, TASKPRI_NORMAL, -1, 0.0f, true);
|
||||
|
||||
if (Random.Long (0, 100) < 50)
|
||||
ChatterMessage (Chatter_NewRound);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -291,7 +291,7 @@ void NetworkMsg::Execute (void *p)
|
|||
|
||||
if (bot != NULL && IsAlive (bot->GetEntity ()) && GetTeam (bot->GetEntity ()) == GetTeam (victim) && IsVisible (killer->v.origin, bot->GetEntity ()) && IsEntityNull (bot->m_enemy) && GetTeam (killer) != GetTeam (victim))
|
||||
{
|
||||
bot->m_actualReactionTime = 0.0;
|
||||
bot->m_actualReactionTime = 0.0f;
|
||||
bot->m_seeEnemyTime = GetWorldTime ();
|
||||
bot->m_enemy = killer;
|
||||
bot->m_lastEnemy = killer;
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ bool IsVisible (const Vector &origin, edict_t *ent)
|
|||
TraceResult tr;
|
||||
TraceLine (ent->v.origin + ent->v.view_ofs, origin, true, true, ent, &tr);
|
||||
|
||||
if (tr.flFraction != 1.0)
|
||||
return false; // line of sight is not established
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
return true;
|
||||
|
||||
return true; // line of sight is valid.
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector GetEntityOrigin (edict_t *ent)
|
||||
|
|
@ -142,10 +142,10 @@ Vector GetEntityOrigin (edict_t *ent)
|
|||
// entity that has a bounding box has its center at the center of the bounding box itself.
|
||||
|
||||
if (IsEntityNull (ent))
|
||||
return nullvec;
|
||||
return Vector::GetZero ();
|
||||
|
||||
if (ent->v.origin == nullvec)
|
||||
return ent->v.absmin + ent->v.size * 0.5;
|
||||
if (ent->v.origin.IsZero ())
|
||||
return ent->v.absmin + ent->v.size * 0.5f;
|
||||
|
||||
return ent->v.origin;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex)
|
|||
if (decalIndex < 0)
|
||||
decalIndex = (*g_engfuncs.pfnDecalIndex) ("{lambda06");
|
||||
|
||||
if (trace->flFraction == 1.0)
|
||||
if (trace->flFraction > TRACE_FRACTION_EQ)
|
||||
return;
|
||||
|
||||
if (!IsEntityNull (trace->pHit))
|
||||
|
|
@ -745,14 +745,14 @@ void RoundInit (void)
|
|||
waypoints.ClearGoalScore ();
|
||||
|
||||
g_bombSayString = false;
|
||||
g_timeBombPlanted = 0.0;
|
||||
g_timeNextBombUpdate = 0.0;
|
||||
g_timeBombPlanted = 0.0f;
|
||||
g_timeNextBombUpdate = 0.0f;
|
||||
|
||||
g_leaderChoosen[TEAM_CF] = false;
|
||||
g_leaderChoosen[TEAM_TF] = false;
|
||||
|
||||
g_lastRadioTime[0] = 0.0;
|
||||
g_lastRadioTime[1] = 0.0;
|
||||
g_lastRadioTime[0] = 0.0f;
|
||||
g_lastRadioTime[1] = 0.0f;
|
||||
g_botsCanPause = false;
|
||||
|
||||
for (int i = 0; i < TASK_MAX; i++)
|
||||
|
|
@ -762,8 +762,8 @@ void RoundInit (void)
|
|||
|
||||
// calculate the round mid/end in world time
|
||||
g_timeRoundStart = GetWorldTime () + mp_freezetime.GetFloat ();
|
||||
g_timeRoundMid = g_timeRoundStart + mp_roundtime.GetFloat () * 60 * 0.5f;
|
||||
g_timeRoundEnd = g_timeRoundStart + mp_roundtime.GetFloat () * 60;
|
||||
g_timeRoundMid = g_timeRoundStart + mp_roundtime.GetFloat () * 60.0f * 0.5f;
|
||||
g_timeRoundEnd = g_timeRoundStart + mp_roundtime.GetFloat () * 60.0f;
|
||||
}
|
||||
|
||||
int GetWeaponPenetrationPower (int id)
|
||||
|
|
@ -877,7 +877,6 @@ void ChartPrint (const char *format, ...)
|
|||
WRITE_BYTE (HUD_PRINTTALK);
|
||||
WRITE_STRING (string);
|
||||
MESSAGE_END ();
|
||||
|
||||
}
|
||||
|
||||
void ClientPrint (edict_t *ent, int dest, const char *format, ...)
|
||||
|
|
@ -978,7 +977,7 @@ void CheckWelcomeMessage (void)
|
|||
// the purpose of this function, is to send quick welcome message, to the listenserver entity.
|
||||
|
||||
static bool alreadyReceived = !yb_listenserver_welcome.GetBool ();
|
||||
static float receiveTime = 0.0;
|
||||
static float receiveTime = 0.0f;
|
||||
|
||||
if (alreadyReceived)
|
||||
return;
|
||||
|
|
@ -1004,9 +1003,9 @@ void CheckWelcomeMessage (void)
|
|||
sentences.Push ("warning, medical attention required");
|
||||
|
||||
if (IsAlive (g_hostEntity) && !alreadyReceived && receiveTime < 1.0 && (g_numWaypoints > 0 ? g_isCommencing : true))
|
||||
receiveTime = GetWorldTime () + 4.0; // receive welcome message in four seconds after game has commencing
|
||||
receiveTime = GetWorldTime () + 4.0f; // receive welcome message in four seconds after game has commencing
|
||||
|
||||
if (receiveTime > 0.0 && receiveTime < GetWorldTime () && !alreadyReceived && (g_numWaypoints > 0 ? g_isCommencing : true))
|
||||
if (receiveTime > 0.0f && receiveTime < GetWorldTime () && !alreadyReceived && (g_numWaypoints > 0 ? g_isCommencing : true))
|
||||
{
|
||||
ServerCommand ("speak \"%s\"", const_cast <char *> (sentences.GetRandomElement ().GetBuffer ()));
|
||||
|
||||
|
|
@ -1026,10 +1025,10 @@ void CheckWelcomeMessage (void)
|
|||
WRITE_BYTE (Random.Long (230, 255));
|
||||
WRITE_BYTE (Random.Long (230, 255));
|
||||
WRITE_BYTE (200);
|
||||
WRITE_SHORT (FixedUnsigned16 (0.0078125, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (2, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (6, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (0.1, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (0.0078125f, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (2.0f, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (6.0f, 1 << 8));
|
||||
WRITE_SHORT (FixedUnsigned16 (0.1f, 1 << 8));
|
||||
WRITE_STRING (FormatBuffer ("\nServer is running YaPB v%s (Build: %u)\nDeveloped by %s\n\n%s", PRODUCT_VERSION, GenerateBuildNumber (), PRODUCT_AUTHOR, waypoints.GetInfo ()));
|
||||
MESSAGE_END ();
|
||||
|
||||
|
|
@ -1059,7 +1058,7 @@ void DetectCSVersion (void)
|
|||
void PlaySound (edict_t *ent, const char *name)
|
||||
{
|
||||
// TODO: make this obsolete
|
||||
EMIT_SOUND_DYN2 (ent, CHAN_WEAPON, name, 1.0, ATTN_NORM, 0, 100);
|
||||
EMIT_SOUND_DYN2 (ent, CHAN_WEAPON, name, 1.0f, ATTN_NORM, 0, 100.0f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -1163,12 +1162,16 @@ void AddLogEntry (bool outputToConsole, int logLevel, const char *format, ...)
|
|||
|
||||
if (logLevel == LL_FATAL)
|
||||
{
|
||||
bots.RemoveAll ();
|
||||
FreeLibraryMemory ();
|
||||
|
||||
#if defined (PLATFORM_WIN32)
|
||||
DestroyWindow (GetForegroundWindow ());
|
||||
MessageBoxA (GetActiveWindow (), buffer, "YaPB Error", MB_ICONSTOP);
|
||||
#else
|
||||
printf ("%s", buffer);
|
||||
#endif
|
||||
FreeLibraryMemory ();
|
||||
|
||||
|
||||
#if defined (PLATFORM_WIN32)
|
||||
_exit (1);
|
||||
|
|
@ -1228,7 +1231,7 @@ bool FindNearestPlayer (void **pvHolder, edict_t *to, float searchDistance, bool
|
|||
// be filled with bot pointer, else with edict pointer(!).
|
||||
|
||||
edict_t *survive = NULL; // pointer to temporaly & survive entity
|
||||
float nearestPlayer = 4096.0; // nearest player
|
||||
float nearestPlayer = 4096.0f; // nearest player
|
||||
|
||||
int toTeam = GetTeam (to);
|
||||
|
||||
|
|
@ -1299,50 +1302,50 @@ void SoundAttachToClients (edict_t *ent, const char *sample, float volume)
|
|||
if (strncmp ("player/bhit_flesh", sample, 17) == 0 || strncmp ("player/headshot", sample, 15) == 0)
|
||||
{
|
||||
// hit/fall sound?
|
||||
client->hearingDistance = 768.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.5;
|
||||
client->hearingDistance = 768.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.5f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("items/gunpickup", sample, 15) == 0)
|
||||
{
|
||||
// weapon pickup?
|
||||
client->hearingDistance = 768.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.5;
|
||||
client->hearingDistance = 768.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.5f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("weapons/zoom", sample, 12) == 0)
|
||||
{
|
||||
// sniper zooming?
|
||||
client->hearingDistance = 512.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.1;
|
||||
client->hearingDistance = 512.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.1f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("items/9mmclip", sample, 13) == 0)
|
||||
{
|
||||
// ammo pickup?
|
||||
client->hearingDistance = 512.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.1;
|
||||
client->hearingDistance = 512.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 0.1f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("hostage/hos", sample, 11) == 0)
|
||||
{
|
||||
// CT used hostage?
|
||||
client->hearingDistance = 1024.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 5.0;
|
||||
client->hearingDistance = 1024.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 5.0f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("debris/bustmetal", sample, 16) == 0 || strncmp ("debris/bustglass", sample, 16) == 0)
|
||||
{
|
||||
// broke something?
|
||||
client->hearingDistance = 1024.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 2.0;
|
||||
client->hearingDistance = 1024.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 2.0f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
else if (strncmp ("doors/doormove", sample, 14) == 0)
|
||||
{
|
||||
// someone opened a door
|
||||
client->hearingDistance = 1024.0 * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 3.0;
|
||||
client->hearingDistance = 1024.0f * volume;
|
||||
client->timeSoundLasting = GetWorldTime () + 3.0f;
|
||||
client->soundPosition = origin;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ void Waypoint::Init (void)
|
|||
{
|
||||
// this function initialize the waypoint structures..
|
||||
|
||||
m_learnVelocity = nullvec;
|
||||
m_learnPosition = nullvec;
|
||||
m_lastWaypoint = nullvec;
|
||||
m_learnVelocity.Zero ();
|
||||
m_learnPosition.Zero ();
|
||||
m_lastWaypoint.Zero ();
|
||||
|
||||
// have any waypoint path nodes been allocated yet?
|
||||
if (m_waypointPaths)
|
||||
|
|
@ -32,7 +32,6 @@ void Waypoint::Init (void)
|
|||
}
|
||||
}
|
||||
g_numWaypoints = 0;
|
||||
m_lastWaypoint = nullvec;
|
||||
}
|
||||
|
||||
void Waypoint::AddPath (short int addIndex, short int pathIndex, float distance)
|
||||
|
|
@ -149,13 +148,13 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
int index = -1, i;
|
||||
float distance;
|
||||
|
||||
Vector forward = nullvec;
|
||||
Vector forward;
|
||||
Path *path = NULL;
|
||||
|
||||
bool placeNew = true;
|
||||
Vector newOrigin = waypointOrigin;
|
||||
|
||||
if (waypointOrigin == nullvec)
|
||||
if (waypointOrigin.IsZero ())
|
||||
newOrigin = g_hostEntity->v.origin;
|
||||
|
||||
if (bots.GetBotsNum () > 0)
|
||||
|
|
@ -166,7 +165,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
switch (flags)
|
||||
{
|
||||
case 6:
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
|
|
@ -179,7 +178,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
}
|
||||
|
||||
MakeVectors (g_hostEntity->v.v_angle);
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640;
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640.0f;
|
||||
|
||||
path->campEndX = forward.x;
|
||||
path->campEndY = forward.y;
|
||||
|
|
@ -190,19 +189,19 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
return;
|
||||
|
||||
case 9:
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
distance = (m_paths[index]->origin - g_hostEntity->v.origin).GetLength ();
|
||||
|
||||
if (distance < 50)
|
||||
if (distance < 50.0f)
|
||||
{
|
||||
placeNew = false;
|
||||
path = m_paths[index];
|
||||
|
||||
if (flags == 9)
|
||||
path->origin = (path->origin + m_learnPosition) / 2;
|
||||
path->origin = (path->origin + m_learnPosition) * 0.5f;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -210,13 +209,13 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index != -1 && m_paths[index] != NULL)
|
||||
{
|
||||
distance = (m_paths[index]->origin - g_hostEntity->v.origin).GetLength ();
|
||||
|
||||
if (distance < 50)
|
||||
if (distance < 50.0f)
|
||||
{
|
||||
placeNew = false;
|
||||
path = m_paths[index];
|
||||
|
|
@ -227,7 +226,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
flags += path->connectionFlags[i];
|
||||
|
||||
if (flags == 0)
|
||||
path->origin = (path->origin + g_hostEntity->v.origin) * 0.5;
|
||||
path->origin = (path->origin + g_hostEntity->v.origin) * 0.5f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -255,10 +254,10 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
// store the origin (location) of this waypoint
|
||||
path->origin = newOrigin;
|
||||
|
||||
path->campEndX = 0;
|
||||
path->campEndY = 0;
|
||||
path->campStartX = 0;
|
||||
path->campStartY = 0;
|
||||
path->campEndX = 0.0f;
|
||||
path->campEndY = 0.0f;
|
||||
path->campStartX = 0.0f;
|
||||
path->campStartY = 0.0f;
|
||||
|
||||
for (i = 0; i < MAX_PATH_INDEX; i++)
|
||||
{
|
||||
|
|
@ -266,7 +265,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
path->distances[i] = 0;
|
||||
|
||||
path->connectionFlags[i] = 0;
|
||||
path->connectionVelocity[i] = nullvec;
|
||||
path->connectionVelocity[i].Zero ();
|
||||
}
|
||||
|
||||
// store the last used waypoint for the auto waypoint code...
|
||||
|
|
@ -306,7 +305,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
path->flags |= FLAG_LADDER;
|
||||
MakeVectors (g_hostEntity->v.v_angle);
|
||||
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640;
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640.0f;
|
||||
path->campStartY = forward.y;
|
||||
}
|
||||
else if (m_isOnLadder)
|
||||
|
|
@ -337,7 +336,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
path->flags |= FLAG_CAMP;
|
||||
|
||||
MakeVectors (g_hostEntity->v.v_angle);
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640;
|
||||
forward = g_hostEntity->v.origin + g_hostEntity->v.view_ofs + g_pGlobals->v_forward * 640.0f;
|
||||
|
||||
path->campStartX = forward.x;
|
||||
path->campStartY = forward.y;
|
||||
|
|
@ -351,7 +350,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
// Ladder waypoints need careful connections
|
||||
if (path->flags & FLAG_LADDER)
|
||||
{
|
||||
float minDistance = 9999.0;
|
||||
float minDistance = 9999.0f;
|
||||
int destIndex = -1;
|
||||
|
||||
TraceResult tr;
|
||||
|
|
@ -368,7 +367,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
// check if the waypoint is reachable from the new one
|
||||
TraceLine (newOrigin, m_paths[i]->origin, true, g_hostEntity, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0 && fabs (newOrigin.x - m_paths[i]->origin.x) < 64 && fabs (newOrigin.y - m_paths[i]->origin.y) < 64 && fabs (newOrigin.z - m_paths[i]->origin.z) < g_autoPathDistance)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ && fabs (newOrigin.x - m_paths[i]->origin.x) < 64.0f && fabs (newOrigin.y - m_paths[i]->origin.y) < 64.0f && fabs (newOrigin.z - m_paths[i]->origin.z) < g_autoPathDistance)
|
||||
{
|
||||
distance = (m_paths[i]->origin - newOrigin).GetLength ();
|
||||
|
||||
|
|
@ -446,7 +445,7 @@ void Waypoint::Delete (void)
|
|||
if (bots.GetBotsNum () > 0)
|
||||
bots.RemoveAll ();
|
||||
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index == -1)
|
||||
return;
|
||||
|
|
@ -467,7 +466,7 @@ void Waypoint::Delete (void)
|
|||
path->index[j] = -1; // unassign this path
|
||||
path->connectionFlags[j] = 0;
|
||||
path->distances[j] = 0;
|
||||
path->connectionVelocity[j] = nullvec;
|
||||
path->connectionVelocity[j].Zero ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -504,7 +503,7 @@ void Waypoint::ToggleFlags (int toggleFlag)
|
|||
{
|
||||
// this function allow manually changing flags
|
||||
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
|
|
@ -530,7 +529,7 @@ void Waypoint::SetRadius (int radius)
|
|||
{
|
||||
// this function allow manually setting the zone radius
|
||||
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int index = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
|
|
@ -558,27 +557,27 @@ int Waypoint::GetFacingIndex (void)
|
|||
// this function finds waypoint the user is pointing at.
|
||||
|
||||
int pointedIndex = -1;
|
||||
float viewCone[3] = {0.0, 0.0, 0.0};
|
||||
float viewCone[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
// find the waypoint the user is pointing at
|
||||
for (int i = 0; i < g_numWaypoints; i++)
|
||||
{
|
||||
if ((m_paths[i]->origin - g_hostEntity->v.origin).GetLengthSquared () > 250000)
|
||||
if ((m_paths[i]->origin - g_hostEntity->v.origin).GetLengthSquared () > 250000.0f)
|
||||
continue;
|
||||
|
||||
// get the current view cone
|
||||
viewCone[0] = GetShootingConeDeviation (g_hostEntity, &m_paths[i]->origin);
|
||||
Vector bound = m_paths[i]->origin - Vector (0, 0, (m_paths[i]->flags & FLAG_CROUCH) ? 8 : 15);
|
||||
Vector bound = m_paths[i]->origin - Vector (0.0f, 0.0f, (m_paths[i]->flags & FLAG_CROUCH) ? 8.0f : 15.0f);
|
||||
|
||||
// get the current view cone
|
||||
viewCone[1] = GetShootingConeDeviation (g_hostEntity, &bound);
|
||||
bound = m_paths[i]->origin + Vector (0, 0, (m_paths[i]->flags & FLAG_CROUCH) ? 8 : 15);
|
||||
bound = m_paths[i]->origin + Vector (0.0f, 0.0f, (m_paths[i]->flags & FLAG_CROUCH) ? 8.0f : 15.0f);
|
||||
|
||||
// get the current view cone
|
||||
viewCone[2] = GetShootingConeDeviation (g_hostEntity, &bound);
|
||||
|
||||
// check if we can see it
|
||||
if (viewCone[0] < 0.998 && viewCone[1] < 0.997 && viewCone[2] < 0.997)
|
||||
if (viewCone[0] < 0.998f && viewCone[1] < 0.997f && viewCone[2] < 0.997f)
|
||||
continue;
|
||||
|
||||
pointedIndex = i;
|
||||
|
|
@ -590,7 +589,7 @@ void Waypoint::CreatePath (char dir)
|
|||
{
|
||||
// this function allow player to manually create a path from one waypoint to another
|
||||
|
||||
int nodeFrom = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int nodeFrom = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (nodeFrom == -1)
|
||||
{
|
||||
|
|
@ -637,7 +636,7 @@ void Waypoint::DeletePath (void)
|
|||
{
|
||||
// this function allow player to manually remove a path from one waypoint to another
|
||||
|
||||
int nodeFrom = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int nodeFrom = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
int index = 0;
|
||||
|
||||
if (nodeFrom == -1)
|
||||
|
|
@ -664,10 +663,10 @@ void Waypoint::DeletePath (void)
|
|||
{
|
||||
g_waypointsChanged = true;
|
||||
|
||||
m_paths[nodeFrom]->index[index] = -1; // unassign this path
|
||||
m_paths[nodeFrom]->connectionFlags[index] = 0;
|
||||
m_paths[nodeFrom]->connectionVelocity[index] = nullvec;
|
||||
m_paths[nodeFrom]->index[index] = -1; // unassigns this path
|
||||
m_paths[nodeFrom]->distances[index] = 0;
|
||||
m_paths[nodeFrom]->connectionFlags[index] = 0;
|
||||
m_paths[nodeFrom]->connectionVelocity[index].Zero ();
|
||||
|
||||
PlaySound (g_hostEntity, "weapons/mine_activate.wav");
|
||||
return;
|
||||
|
|
@ -686,10 +685,11 @@ void Waypoint::DeletePath (void)
|
|||
g_waypointsChanged = true;
|
||||
|
||||
m_paths[nodeFrom]->index[index] = -1; // unassign this path
|
||||
m_paths[nodeFrom]->connectionFlags[index] = 0;
|
||||
m_paths[nodeFrom]->connectionVelocity[index] = nullvec;
|
||||
m_paths[nodeFrom]->distances[index] = 0;
|
||||
|
||||
m_paths[nodeFrom]->connectionFlags[index] = 0;
|
||||
m_paths[nodeFrom]->connectionVelocity[index].Zero ();
|
||||
|
||||
PlaySound (g_hostEntity, "weapons/mine_activate.wav");
|
||||
return;
|
||||
}
|
||||
|
|
@ -699,7 +699,7 @@ void Waypoint::DeletePath (void)
|
|||
|
||||
void Waypoint::CacheWaypoint (void)
|
||||
{
|
||||
int node = FindNearest (g_hostEntity->v.origin, 50.0);
|
||||
int node = FindNearest (g_hostEntity->v.origin, 50.0f);
|
||||
|
||||
if (node == -1)
|
||||
{
|
||||
|
|
@ -724,7 +724,7 @@ void Waypoint::CalculateWayzone (int index)
|
|||
|
||||
if ((path->flags & (FLAG_LADDER | FLAG_GOAL | FLAG_CAMP | FLAG_RESCUE | FLAG_CROUCH)) || m_learnJumpWaypoint)
|
||||
{
|
||||
path->radius = 0;
|
||||
path->radius = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -732,7 +732,7 @@ void Waypoint::CalculateWayzone (int index)
|
|||
{
|
||||
if (path->index[i] != -1 && (m_paths[path->index[i]]->flags & FLAG_LADDER))
|
||||
{
|
||||
path->radius = 0;
|
||||
path->radius = 0.0f;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -740,14 +740,14 @@ void Waypoint::CalculateWayzone (int index)
|
|||
for (int scanDistance = 16; scanDistance < 128; scanDistance += 16)
|
||||
{
|
||||
start = path->origin;
|
||||
MakeVectors (nullvec);
|
||||
MakeVectors (Vector::GetZero ());
|
||||
|
||||
direction = g_pGlobals->v_forward * scanDistance;
|
||||
direction = direction.ToAngles ();
|
||||
|
||||
path->radius = scanDistance;
|
||||
|
||||
for (float circleRadius = 0.0; circleRadius < 180.0; circleRadius += 5)
|
||||
for (float circleRadius = 0.0f; circleRadius < 180.0f; circleRadius += 5.0f)
|
||||
{
|
||||
MakeVectors (direction);
|
||||
|
||||
|
|
@ -756,55 +756,55 @@ void Waypoint::CalculateWayzone (int index)
|
|||
|
||||
TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr);
|
||||
|
||||
if (tr.flFraction < 1.0)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ)
|
||||
{
|
||||
TraceLine (radiusStart, radiusEnd, true, NULL, &tr);
|
||||
|
||||
if (FClassnameIs (tr.pHit, "func_door") || FClassnameIs (tr.pHit, "func_door_rotating"))
|
||||
{
|
||||
path->radius = 0;
|
||||
path->radius = 0.0f;
|
||||
wayBlocked = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
wayBlocked = true;
|
||||
path->radius -= 16;
|
||||
path->radius -= 16.0f;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Vector dropStart = start + (g_pGlobals->v_forward * scanDistance);
|
||||
Vector dropEnd = dropStart - Vector (0, 0, scanDistance + 60);
|
||||
Vector dropStart = start + g_pGlobals->v_forward * scanDistance;
|
||||
Vector dropEnd = dropStart - Vector (0.0f, 0.0f, scanDistance + 60.0f);
|
||||
|
||||
TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr);
|
||||
|
||||
if (tr.flFraction >= 1.0)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
wayBlocked = true;
|
||||
path->radius -= 16;
|
||||
path->radius -= 16.0f;
|
||||
|
||||
break;
|
||||
}
|
||||
dropStart = start - (g_pGlobals->v_forward * scanDistance);
|
||||
dropEnd = dropStart - Vector (0, 0, scanDistance + 60);
|
||||
dropStart = start - g_pGlobals->v_forward * scanDistance;
|
||||
dropEnd = dropStart - Vector (0.0f, 0.0f, scanDistance + 60.0f);
|
||||
|
||||
TraceHull (dropStart, dropEnd, true, head_hull, NULL, &tr);
|
||||
|
||||
if (tr.flFraction >= 1.0)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
wayBlocked = true;
|
||||
path->radius -= 16;
|
||||
path->radius -= 16.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
radiusEnd.z += 34;
|
||||
radiusEnd.z += 34.0f;
|
||||
TraceHull (radiusStart, radiusEnd, true, head_hull, NULL, &tr);
|
||||
|
||||
if (tr.flFraction < 1.0)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ)
|
||||
{
|
||||
wayBlocked = true;
|
||||
path->radius -= 16;
|
||||
path->radius -= 16.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -813,10 +813,10 @@ void Waypoint::CalculateWayzone (int index)
|
|||
if (wayBlocked)
|
||||
break;
|
||||
}
|
||||
path->radius -= 16;
|
||||
path->radius -= 16.0f;
|
||||
|
||||
if (path->radius < 0)
|
||||
path->radius = 0;
|
||||
if (path->radius < 0.0f)
|
||||
path->radius = 0.0f;
|
||||
}
|
||||
|
||||
void Waypoint::SaveExperienceTab (void)
|
||||
|
|
@ -1188,8 +1188,8 @@ bool Waypoint::Load (void)
|
|||
g_waypointsChanged = false;
|
||||
g_highestKills = 1;
|
||||
|
||||
m_pathDisplayTime = 0.0;
|
||||
m_arrowDisplayTime = 0.0;
|
||||
m_pathDisplayTime = 0.0f;
|
||||
m_arrowDisplayTime = 0.0f;
|
||||
|
||||
InitVisibilityTab ();
|
||||
InitExperienceTab ();
|
||||
|
|
@ -1278,7 +1278,7 @@ bool Waypoint::Reachable (Bot *bot, int index)
|
|||
TraceLine (src, dest, true, bot->GetEntity (), &tr);
|
||||
|
||||
// if waypoint is visible from current position (even behind head)...
|
||||
if (tr.flFraction >= 1.0)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
{
|
||||
if (bot->pev->waterlevel == 2 || bot->pev->waterlevel == 3)
|
||||
return true;
|
||||
|
|
@ -1286,7 +1286,7 @@ bool Waypoint::Reachable (Bot *bot, int index)
|
|||
float distance2D = (dest - src).GetLength2D ();
|
||||
|
||||
// is destination waypoint higher that source (62 is max jump height), or destination waypoint higher that source
|
||||
if (((dest.z > src.z + 62.0 || dest.z < src.z - 100.0f) && (!(m_paths[index]->flags & FLAG_LADDER))) || distance2D >= 120.0f)
|
||||
if (((dest.z > src.z + 62.0f || dest.z < src.z - 100.0f) && (!(m_paths[index]->flags & FLAG_LADDER))) || distance2D >= 120.0f)
|
||||
return false; // unable to reach this one
|
||||
|
||||
return true;
|
||||
|
|
@ -1314,14 +1314,14 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
|
|||
TraceLine (src, destination, ignore_monsters, g_hostEntity, &tr);
|
||||
|
||||
// if waypoint is visible from current position (even behind head)...
|
||||
if (tr.flFraction >= 1.0 || strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ || strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0)
|
||||
{
|
||||
// if it's a door check if nothing blocks behind
|
||||
if (strncmp ("func_door", STRING (tr.pHit->v.classname), 9) == 0)
|
||||
{
|
||||
TraceLine (tr.vecEndPos, destination, ignore_monsters, tr.pHit, &tr);
|
||||
|
||||
if (tr.flFraction < 1.0)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1330,16 +1330,16 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
|
|||
return true; // then they're reachable each other
|
||||
|
||||
// is dest waypoint higher than src? (45 is max jump height)
|
||||
if (destination.z > src.z + 45.0)
|
||||
if (destination.z > src.z + 45.0f)
|
||||
{
|
||||
Vector sourceNew = destination;
|
||||
Vector destinationNew = destination;
|
||||
destinationNew.z = destinationNew.z - 50; // straight down 50 units
|
||||
destinationNew.z = destinationNew.z - 50.0f; // straight down 50 units
|
||||
|
||||
TraceLine (sourceNew, destinationNew, ignore_monsters, g_hostEntity, &tr);
|
||||
|
||||
// check if we didn't hit anything, if not then it's in mid-air
|
||||
if (tr.flFraction >= 1.0)
|
||||
if (tr.flFraction > TRACE_FRACTION_EQ)
|
||||
return false; // can't reach this one
|
||||
}
|
||||
|
||||
|
|
@ -1347,27 +1347,27 @@ bool Waypoint::IsNodeReachable (const Vector &src, const Vector &destination)
|
|||
Vector direction = (destination - src).Normalize(); // 1 unit long
|
||||
Vector check = src, down = src;
|
||||
|
||||
down.z = down.z - 1000.0; // straight down 1000 units
|
||||
down.z = down.z - 1000.0f; // straight down 1000 units
|
||||
|
||||
TraceLine (check, down, ignore_monsters, g_hostEntity, &tr);
|
||||
|
||||
float lastHeight = tr.flFraction * 1000.0; // height from ground
|
||||
float lastHeight = tr.flFraction * 1000.0f; // height from ground
|
||||
distance = (destination - check).GetLength (); // distance from goal
|
||||
|
||||
while (distance > 10.0)
|
||||
while (distance > 10.0f)
|
||||
{
|
||||
// move 10 units closer to the goal...
|
||||
check = check + (direction * 10.0);
|
||||
check = check + (direction * 10.0f);
|
||||
|
||||
down = check;
|
||||
down.z = down.z - 1000.0; // straight down 1000 units
|
||||
down.z = down.z - 1000.0f; // straight down 1000 units
|
||||
|
||||
TraceLine (check, down, ignore_monsters, g_hostEntity, &tr);
|
||||
|
||||
float height = tr.flFraction * 1000.0; // height from ground
|
||||
float height = tr.flFraction * 1000.0f; // height from ground
|
||||
|
||||
// is the current height greater than the step height?
|
||||
if (height < lastHeight - 18.0)
|
||||
if (height < lastHeight - 18.0f)
|
||||
return false; // can't get there without jumping...
|
||||
|
||||
lastHeight = height;
|
||||
|
|
@ -1393,13 +1393,13 @@ void Waypoint::InitializeVisibility (void)
|
|||
|
||||
if (m_paths[m_visibilityIndex]->flags & FLAG_CROUCH)
|
||||
{
|
||||
sourceDuck.z += 12.0;
|
||||
sourceStand.z += 18.0 + 28.0;
|
||||
sourceDuck.z += 12.0f;
|
||||
sourceStand.z += 18.0f + 28.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceDuck.z += -18.0 + 12.0;
|
||||
sourceStand.z += 28.0;
|
||||
sourceDuck.z += -18.0f + 12.0f;
|
||||
sourceStand.z += 28.0f;
|
||||
}
|
||||
uint16 standCount = 0, crouchCount = 0;
|
||||
|
||||
|
|
@ -1411,7 +1411,7 @@ void Waypoint::InitializeVisibility (void)
|
|||
TraceLine (sourceDuck, dest, true, NULL, &tr);
|
||||
|
||||
// check if line of sight to object is not blocked (i.e. visible)
|
||||
if ((tr.flFraction != 1.0) || tr.fStartSolid)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fStartSolid)
|
||||
res = 1;
|
||||
else
|
||||
res = 0;
|
||||
|
|
@ -1421,7 +1421,7 @@ void Waypoint::InitializeVisibility (void)
|
|||
TraceLine (sourceStand, dest, true, NULL, &tr);
|
||||
|
||||
// check if line of sight to object is not blocked (i.e. visible)
|
||||
if ((tr.flFraction != 1.0) || tr.fStartSolid)
|
||||
if (tr.flFraction <= TRACE_FRACTION_EQ || tr.fStartSolid)
|
||||
res |= 1;
|
||||
|
||||
shift = (i % 4) << 1;
|
||||
|
|
@ -1534,7 +1534,7 @@ void Waypoint::Think (void)
|
|||
// find the distance from the last used waypoint
|
||||
float distance = (m_lastWaypoint - g_hostEntity->v.origin).GetLengthSquared ();
|
||||
|
||||
if (distance > 16384)
|
||||
if (distance > 16384.0f)
|
||||
{
|
||||
// check that no other reachable waypoints are nearby...
|
||||
for (int i = 0; i < g_numWaypoints; i++)
|
||||
|
|
@ -1549,7 +1549,7 @@ void Waypoint::Think (void)
|
|||
}
|
||||
|
||||
// make sure nearest waypoint is far enough away...
|
||||
if (nearestDistance >= 16384)
|
||||
if (nearestDistance >= 16384.0f)
|
||||
Add (0); // place a waypoint here
|
||||
}
|
||||
}
|
||||
|
|
@ -1564,7 +1564,7 @@ void Waypoint::Think (void)
|
|||
float distance = (m_paths[i]->origin - g_hostEntity->v.origin).GetLengthSquared ();
|
||||
|
||||
// check if waypoint is whitin a distance, and is visible
|
||||
if (distance < 500 * 500 && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 2500))
|
||||
if (distance < GET_SQUARE (500.0f) && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 2500.0f))
|
||||
{
|
||||
// check the distance
|
||||
if (distance < nearestDistance)
|
||||
|
|
@ -1573,20 +1573,20 @@ void Waypoint::Think (void)
|
|||
nearestDistance = distance;
|
||||
}
|
||||
|
||||
if (m_waypointDisplayTime[i] + 1.0 < GetWorldTime ())
|
||||
if (m_waypointDisplayTime[i] + 1.0f < GetWorldTime ())
|
||||
{
|
||||
float nodeHeight = 0.0;
|
||||
float nodeHeight = 0.0f;
|
||||
|
||||
// check the node height
|
||||
if (m_paths[i]->flags & FLAG_CROUCH)
|
||||
nodeHeight = 36.0;
|
||||
nodeHeight = 36.0f;
|
||||
else
|
||||
nodeHeight = 72.0;
|
||||
nodeHeight = 72.0f;
|
||||
|
||||
float nodeHalfHeight = nodeHeight * 0.5;
|
||||
float nodeHalfHeight = nodeHeight * 0.5f;
|
||||
|
||||
// all waypoints are by default are green
|
||||
Vector nodeColor = nullvec;
|
||||
Vector nodeColor;
|
||||
|
||||
// colorize all other waypoints
|
||||
if (m_paths[i]->flags & FLAG_CAMP)
|
||||
|
|
@ -1633,7 +1633,7 @@ void Waypoint::Think (void)
|
|||
if ((m_findWPIndex != -1 && m_findWPIndex < g_numWaypoints) || (m_cacheWaypointIndex != -1 && m_cacheWaypointIndex < g_numWaypoints) || (m_facingAtIndex != -1 && m_facingAtIndex < g_numWaypoints))
|
||||
{
|
||||
// check for drawing code
|
||||
if (m_arrowDisplayTime + 0.5 < GetWorldTime ())
|
||||
if (m_arrowDisplayTime + 0.5f < GetWorldTime ())
|
||||
{
|
||||
// finding waypoint - pink arrow
|
||||
if (m_findWPIndex != -1)
|
||||
|
|
@ -1655,18 +1655,18 @@ void Waypoint::Think (void)
|
|||
Path *path = m_paths[nearestIndex];
|
||||
|
||||
// draw a paths, camplines and danger directions for nearest waypoint
|
||||
if (nearestDistance < 4096 && m_pathDisplayTime <= GetWorldTime ())
|
||||
if (nearestDistance < 4096.0f && m_pathDisplayTime <= GetWorldTime ())
|
||||
{
|
||||
m_pathDisplayTime = GetWorldTime () + 1.0;
|
||||
m_pathDisplayTime = GetWorldTime () + 1.0f;
|
||||
|
||||
// draw the camplines
|
||||
if (path->flags & FLAG_CAMP)
|
||||
{
|
||||
Vector campSourceOrigin = path->origin + Vector (0, 0, 36);
|
||||
Vector campSourceOrigin = path->origin + Vector (0.0f, 0.0f, 36.0f);
|
||||
|
||||
// check if it's a source
|
||||
if (path->flags & FLAG_CROUCH)
|
||||
campSourceOrigin = path->origin + Vector (0, 0, 18);
|
||||
campSourceOrigin = path->origin + Vector (0.0f, 0.0f, 18.0f);
|
||||
|
||||
Vector campStartOrigin = Vector (path->campStartX, path->campStartY, campSourceOrigin.z); // camp start
|
||||
Vector campEndOrigin = Vector (path->campEndX, path->campEndY, campSourceOrigin.z); // camp end
|
||||
|
|
@ -1699,31 +1699,31 @@ void Waypoint::Think (void)
|
|||
}
|
||||
|
||||
// draw the radius circle
|
||||
Vector origin = (path->flags & FLAG_CROUCH) ? path->origin : path->origin - Vector (0, 0, 18);
|
||||
Vector origin = (path->flags & FLAG_CROUCH) ? path->origin : path->origin - Vector (0.0f, 0.0f, 18.0f);
|
||||
|
||||
// if radius is nonzero, draw a full circle
|
||||
if (path->radius > 0.0)
|
||||
if (path->radius > 0.0f)
|
||||
{
|
||||
float squareRoot = sqrtf ((path->radius * path->radius) * 0.5);
|
||||
float squareRoot = sqrtf (path->radius * path->radius * 0.5f);
|
||||
|
||||
DrawLine (g_hostEntity, origin + Vector (path->radius, 0, 0), origin + Vector (squareRoot, -squareRoot, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0), origin + Vector (0, -path->radius, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (path->radius, 0.0f, 0.0f), origin + Vector (squareRoot, -squareRoot, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0.0f), origin + Vector (0.0f, -path->radius, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
|
||||
DrawLine (g_hostEntity, origin + Vector (0, -path->radius, 0), origin + Vector (-squareRoot, -squareRoot, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, -squareRoot, 0), origin + Vector (-path->radius, 0, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (0.0f, -path->radius, 0.0f), origin + Vector (-squareRoot, -squareRoot, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, -squareRoot, 0.0f), origin + Vector (-path->radius, 0.0f, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
|
||||
DrawLine (g_hostEntity, origin + Vector (-path->radius, 0, 0), origin + Vector (-squareRoot, squareRoot, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, squareRoot, 0), origin + Vector (0, path->radius, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-path->radius, 0.0f, 0.0f), origin + Vector (-squareRoot, squareRoot, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, squareRoot, 0.0f), origin + Vector (0.0f, path->radius, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
|
||||
DrawLine (g_hostEntity, origin + Vector (0, path->radius, 0), origin + Vector (squareRoot, squareRoot, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, squareRoot, 0), origin + Vector (path->radius, 0, 0), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (0.0f, path->radius, 0.0f), origin + Vector (squareRoot, squareRoot, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, squareRoot, 0.0f), origin + Vector (path->radius, 0.0f, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
float squareRoot = sqrtf (32.0);
|
||||
float squareRoot = sqrtf (32.0f);
|
||||
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0), origin + Vector (-squareRoot, squareRoot, 0), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, -squareRoot, 0), origin + Vector (squareRoot, squareRoot, 0), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0.0f), origin + Vector (-squareRoot, squareRoot, 0.0f), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
DrawLine (g_hostEntity, origin + Vector (-squareRoot, -squareRoot, 0.0f), origin + Vector (squareRoot, squareRoot, 0.0f), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
}
|
||||
|
||||
// draw the danger directions
|
||||
|
|
@ -2187,7 +2187,7 @@ void Waypoint::SetGoalVisited (int index)
|
|||
int bombPoint = FindNearest (GetBombPosition ());
|
||||
|
||||
Array <int> markAsVisited;
|
||||
FindInRadius (markAsVisited, 356.0, GetPath (index)->origin);
|
||||
FindInRadius (markAsVisited, 356.0f, GetPath (index)->origin);
|
||||
|
||||
IterateArray (markAsVisited, i)
|
||||
{
|
||||
|
|
@ -2228,7 +2228,7 @@ void Waypoint::CreateBasic (void)
|
|||
TraceResult tr;
|
||||
Vector up, down, front, back;
|
||||
|
||||
Vector diff = ((ladderLeft - ladderRight) ^ Vector (0, 0, 0)).Normalize () * 15.0;
|
||||
Vector diff = ((ladderLeft - ladderRight) ^ Vector (0.0f, 0.0f, 0.0f)).Normalize () * 15.0f;
|
||||
front = back = GetEntityOrigin (ent);
|
||||
|
||||
front = front + diff; // front
|
||||
|
|
@ -2239,29 +2239,29 @@ void Waypoint::CreateBasic (void)
|
|||
|
||||
TraceHull (down, up, true, point_hull, NULL, &tr);
|
||||
|
||||
if (POINT_CONTENTS (up) == CONTENTS_SOLID || tr.flFraction != 1.0)
|
||||
if (POINT_CONTENTS (up) == CONTENTS_SOLID || tr.flFraction <= TRACE_FRACTION_EQ)
|
||||
{
|
||||
up = down = back;
|
||||
down.z = ent->v.absmax.z;
|
||||
}
|
||||
|
||||
TraceHull (down, up - Vector (0, 0, 1000), true, point_hull, NULL, &tr);
|
||||
TraceHull (down, up - Vector (0.0f, 0.0f, 1000.0f), true, point_hull, NULL, &tr);
|
||||
up = tr.vecEndPos;
|
||||
|
||||
Vector pointOrigin = up + Vector (0, 0, 39);
|
||||
Vector pointOrigin = up + Vector (0.0f, 0.0f, 39.0f);
|
||||
m_isOnLadder = true;
|
||||
|
||||
do
|
||||
{
|
||||
if (FindNearest (pointOrigin, 50.0) == -1)
|
||||
if (FindNearest (pointOrigin, 50.0f) == -1)
|
||||
Add (3, pointOrigin);
|
||||
|
||||
pointOrigin.z += 160;
|
||||
} while (pointOrigin.z < down.z - 40);
|
||||
} while (pointOrigin.z < down.z - 40.0f);
|
||||
|
||||
pointOrigin = down + Vector (0, 0, 38);
|
||||
pointOrigin = down + Vector (0.0f, 0.0f, 38.0f);
|
||||
|
||||
if (FindNearest (pointOrigin, 50.0) == -1)
|
||||
if (FindNearest (pointOrigin, 50.0f) == -1)
|
||||
Add (3, pointOrigin);
|
||||
|
||||
m_isOnLadder = false;
|
||||
|
|
@ -2272,7 +2272,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (0, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2281,7 +2281,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (0, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2290,7 +2290,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (0, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2299,7 +2299,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (4, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2308,7 +2308,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (4, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2317,7 +2317,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (100, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2326,7 +2326,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (100, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2334,7 +2334,7 @@ void Waypoint::CreateBasic (void)
|
|||
while (!IsEntityNull (ent = FIND_ENTITY_BY_CLASSNAME (ent, "hostage_entity")))
|
||||
{
|
||||
// if already saved || moving skip it
|
||||
if ((ent->v.effects & EF_NODRAW) && (ent->v.speed > 0))
|
||||
if ((ent->v.effects & EF_NODRAW) && ent->v.speed > 0.0f)
|
||||
continue;
|
||||
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
|
@ -2348,7 +2348,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (100, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2357,7 +2357,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (100, origin);
|
||||
}
|
||||
|
||||
|
|
@ -2366,7 +2366,7 @@ void Waypoint::CreateBasic (void)
|
|||
{
|
||||
Vector origin = GetEntityOrigin (ent);
|
||||
|
||||
if (FindNearest (origin, 50) == -1)
|
||||
if (FindNearest (origin, 50.0f) == -1)
|
||||
Add (0, origin);
|
||||
}
|
||||
}
|
||||
|
|
@ -2413,7 +2413,7 @@ void Waypoint::SetBombPosition (bool shouldReset)
|
|||
|
||||
if (shouldReset)
|
||||
{
|
||||
m_foundBombOrigin = nullvec;
|
||||
m_foundBombOrigin.Zero ();
|
||||
g_bombPlanted = false;
|
||||
|
||||
return;
|
||||
|
|
@ -2450,12 +2450,12 @@ int Waypoint::AddGoalScore (int index, int other[4])
|
|||
{
|
||||
Array <int> left;
|
||||
|
||||
if (m_goalsScore[index] < 1024.0)
|
||||
if (m_goalsScore[index] < 1024.0f)
|
||||
left.Push (index);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (m_goalsScore[other[i]] < 1024.0)
|
||||
if (m_goalsScore[other[i]] < 1024.0f)
|
||||
left.Push (other[i]);
|
||||
}
|
||||
|
||||
|
|
@ -2465,11 +2465,11 @@ int Waypoint::AddGoalScore (int index, int other[4])
|
|||
index = left.GetRandomElement ();
|
||||
|
||||
if (m_paths[index]->flags & FLAG_GOAL)
|
||||
m_goalsScore[index] += 384.0;
|
||||
m_goalsScore[index] += 384.0f;
|
||||
else if (m_paths[index]->flags & (FLAG_CF_ONLY | FLAG_TF_ONLY))
|
||||
m_goalsScore[index] += 768.0;
|
||||
m_goalsScore[index] += 768.0f;
|
||||
else if (m_paths[index]->flags & FLAG_CAMP)
|
||||
m_goalsScore[index] += 1024.0;
|
||||
m_goalsScore[index] += 1024.0f;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
|
@ -2478,7 +2478,7 @@ void Waypoint::ClearGoalScore (void)
|
|||
{
|
||||
// iterate though all waypoints
|
||||
for (int i = 0; i < MAX_WAYPOINTS; i++)
|
||||
m_goalsScore[i] = 0.0;
|
||||
m_goalsScore[i] = 0.0f;
|
||||
}
|
||||
|
||||
Waypoint::Waypoint (void)
|
||||
|
|
@ -2487,7 +2487,7 @@ Waypoint::Waypoint (void)
|
|||
m_endJumpPoint = false;
|
||||
m_redoneVisibility = false;
|
||||
m_learnJumpWaypoint = false;
|
||||
m_timeJumpStarted = 0.0;
|
||||
m_timeJumpStarted = 0.0f;
|
||||
|
||||
m_lastJumpWaypoint = -1;
|
||||
m_cacheWaypointIndex = -1;
|
||||
|
|
@ -2497,8 +2497,8 @@ Waypoint::Waypoint (void)
|
|||
|
||||
m_isOnLadder = false;
|
||||
|
||||
m_pathDisplayTime = 0.0;
|
||||
m_arrowDisplayTime = 0.0;
|
||||
m_pathDisplayTime = 0.0f;
|
||||
m_arrowDisplayTime = 0.0f;
|
||||
|
||||
m_terrorPoints.RemoveAll ();
|
||||
m_ctPoints.RemoveAll ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue