removed useless engine hooks
replaces some div's to mul's
This commit is contained in:
parent
f3331aea13
commit
65818243ec
8 changed files with 12 additions and 47 deletions
|
|
@ -1023,7 +1023,7 @@ private:
|
|||
inline bool IsOnFloor (void) { return (pev->flags & (FL_ONGROUND | FL_PARTIALGROUND)) != 0; }
|
||||
inline bool IsInWater (void) { return pev->waterlevel >= 2; }
|
||||
|
||||
inline float GetWalkSpeed (void) { return static_cast <float> ((static_cast <int> (pev->maxspeed) / 2) + (static_cast <int> (pev->maxspeed) / 50)) - 18; }
|
||||
inline float GetWalkSpeed (void) { return static_cast <float> ((static_cast <int> (pev->maxspeed) * 0.5) + (static_cast <int> (pev->maxspeed) / 50)) - 18; }
|
||||
|
||||
bool ItemIsVisible (const Vector &dest, char *itemName);
|
||||
bool LastEnemyShootable (void);
|
||||
|
|
|
|||
|
|
@ -2322,7 +2322,7 @@ private:
|
|||
int delta = 4;
|
||||
|
||||
if (m_allocatedSize > 64)
|
||||
delta = m_allocatedSize / 2;
|
||||
delta = m_allocatedSize * 0.5;
|
||||
else if (m_allocatedSize > 8)
|
||||
delta = 16;
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ void Bot::AvoidGrenades (void)
|
|||
continue;
|
||||
|
||||
// check if visible to the bot
|
||||
if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov / 2)
|
||||
if (!EntityIsVisible (ent->v.origin) && InFieldOfView (ent->v.origin - EyePosition ()) > pev->fov * 0.5)
|
||||
continue;
|
||||
|
||||
// TODO: should be done once for grenade, instead of checking several times
|
||||
|
|
@ -861,7 +861,7 @@ void Bot::FindItem (void)
|
|||
Path *path = g_waypoint->GetPath (index);
|
||||
|
||||
float bombTimer = mp_c4timer.GetFloat ();
|
||||
float timeMidBlowup = g_timeBombPlanted + ((bombTimer / 2) + bombTimer / 4) - g_waypoint->GetTravelTime (pev->maxspeed, pev->origin, path->origin);
|
||||
float timeMidBlowup = g_timeBombPlanted + (bombTimer * 0.5 + bombTimer * 0.25) - g_waypoint->GetTravelTime (pev->maxspeed, pev->origin, path->origin);
|
||||
|
||||
if (timeMidBlowup > GetWorldTime ())
|
||||
{
|
||||
|
|
@ -3639,7 +3639,7 @@ void Bot::RunTask (void)
|
|||
if (m_viewDistance < 500.0 && m_difficulty >= 2)
|
||||
{
|
||||
// go mad!
|
||||
m_moveSpeed = -fabsf ((m_viewDistance - 500.0) / 2.0);
|
||||
m_moveSpeed = -fabsf ((m_viewDistance - 500.0) * 0.5f);
|
||||
|
||||
if (m_moveSpeed < -pev->maxspeed)
|
||||
m_moveSpeed = -pev->maxspeed;
|
||||
|
|
@ -3924,9 +3924,9 @@ void Bot::RunTask (void)
|
|||
float bombTimer = mp_c4timer.GetFloat ();
|
||||
|
||||
// push camp task on to stack
|
||||
StartTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + ((bombTimer / 2) + (bombTimer / 4)), true);
|
||||
StartTask (TASK_CAMP, TASKPRI_CAMP, -1, GetWorldTime () + (bombTimer * 0.5 + bombTimer * 0.25), true);
|
||||
// push move command
|
||||
StartTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + ((bombTimer / 2) + (bombTimer / 4)), true);
|
||||
StartTask (TASK_MOVETOPOSITION, TASKPRI_MOVETOPOSITION, index, GetWorldTime () + (bombTimer * 0.5 + bombTimer * 0.25), true);
|
||||
|
||||
if (g_waypoint->GetPath (index)->vis.crouch <= g_waypoint->GetPath (index)->vis.stand)
|
||||
m_campButtons |= IN_DUCK;
|
||||
|
|
|
|||
|
|
@ -2756,38 +2756,6 @@ void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...)
|
|||
(*g_engfuncs.pfnAlertMessage) (alertType, buffer);
|
||||
}
|
||||
|
||||
const char *pfnGetPlayerAuthId (edict_t *e)
|
||||
{
|
||||
if (IsValidBot (e))
|
||||
{
|
||||
if (g_isMetamod)
|
||||
RETURN_META_VALUE (MRES_SUPERCEDE, "BOT");
|
||||
|
||||
return "BOT";
|
||||
}
|
||||
|
||||
if (g_isMetamod)
|
||||
RETURN_META_VALUE (MRES_IGNORED, 0);
|
||||
|
||||
return (*g_engfuncs.pfnGetPlayerAuthId) (e);
|
||||
}
|
||||
|
||||
unsigned int pfnGetPlayerWONId (edict_t *e)
|
||||
{
|
||||
if (IsValidBot (e))
|
||||
{
|
||||
if (g_isMetamod)
|
||||
RETURN_META_VALUE (MRES_SUPERCEDE, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (g_isMetamod)
|
||||
RETURN_META_VALUE (MRES_IGNORED, 0);
|
||||
|
||||
return (*g_engfuncs.pfnGetPlayerWONId) (e);
|
||||
}
|
||||
|
||||
gamedll_funcs_t gameDLLFunc;
|
||||
|
||||
export int GetEntityAPI2 (gamefuncs_t *functionTable, int *interfaceVersion)
|
||||
|
|
@ -2903,8 +2871,6 @@ export int GetEngineFunctions (enginefuncs_t *functionTable, int *interfaceVersi
|
|||
functionTable->pfnCmd_Argc = pfnCmd_Argc;
|
||||
functionTable->pfnSetClientMaxspeed = pfnSetClientMaxspeed;
|
||||
functionTable->pfnAlertMessage = pfnAlertMessage;
|
||||
functionTable->pfnGetPlayerAuthId = pfnGetPlayerAuthId;
|
||||
functionTable->pfnGetPlayerWONId = pfnGetPlayerWONId;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
memset (&m_ammo, 0, sizeof (m_ammo));
|
||||
|
||||
m_currentWeapon = 0; // current weapon is not assigned at start
|
||||
m_voicePitch = Random.Long (166, 250) / 2; // assign voice pitch
|
||||
m_voicePitch = Random.Long (166, 250) * 0.5; // assign voice pitch
|
||||
|
||||
// copy them over to the temp level variables
|
||||
m_agressionLevel = m_baseAgressionLevel;
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,7 @@ public:
|
|||
|
||||
while (child)
|
||||
{
|
||||
int parent = (child - 1) / 2;
|
||||
int parent = (child - 1) * 0.5;
|
||||
|
||||
if (m_heap[parent].pri <= m_heap[child].pri)
|
||||
break;
|
||||
|
|
@ -2135,7 +2135,7 @@ int Bot::FindDefendWaypoint (const Vector &origin)
|
|||
if (waypointIndex[index] == -1)
|
||||
break;
|
||||
}
|
||||
return waypointIndex[Random.Long (0, (index - 1) / 2)];
|
||||
return waypointIndex[Random.Long (0, (index - 1) * 0.5)];
|
||||
}
|
||||
|
||||
int Bot::FindCoverWaypoint (float maxDistance)
|
||||
|
|
@ -3069,7 +3069,6 @@ int Bot::GetAimingWaypoint (void)
|
|||
|
||||
void Bot::FacePosition (void)
|
||||
{
|
||||
|
||||
// adjust all body and view angles to face an absolute vector
|
||||
Vector direction = (m_lookAt - EyePosition ()).ToAngles ();
|
||||
direction = direction + pev->punchangle * (m_difficulty * 25) / 100.0;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ bool IsInViewCone (Vector origin, edict_t *ent)
|
|||
{
|
||||
MakeVectors (ent->v.v_angle);
|
||||
|
||||
if (((origin - (ent->v.origin + ent->v.view_ofs)).Normalize () | g_pGlobals->v_forward) >= cosf (((ent->v.fov > 0 ? ent->v.fov : 90.0) / 2) * Math::MATH_PI / 180.0))
|
||||
if (((origin - (ent->v.origin + ent->v.view_ofs)).Normalize () | g_pGlobals->v_forward) >= cosf (((ent->v.fov > 0 ? ent->v.fov : 90.0) * 0.5) * Math::MATH_PI / 180.0))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
|
|||
flags += path->connectionFlags[i];
|
||||
|
||||
if (flags == 0)
|
||||
path->origin = (path->origin + g_hostEntity->v.origin) / 2;
|
||||
path->origin = (path->origin + g_hostEntity->v.origin) * 0.5;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue