removed useless engine hooks

replaces some div's to mul's
This commit is contained in:
jeefo 2015-06-22 21:32:29 +03:00
commit 65818243ec
8 changed files with 12 additions and 47 deletions

View file

@ -1023,7 +1023,7 @@ private:
inline bool IsOnFloor (void) { return (pev->flags & (FL_ONGROUND | FL_PARTIALGROUND)) != 0; } inline bool IsOnFloor (void) { return (pev->flags & (FL_ONGROUND | FL_PARTIALGROUND)) != 0; }
inline bool IsInWater (void) { return pev->waterlevel >= 2; } 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 ItemIsVisible (const Vector &dest, char *itemName);
bool LastEnemyShootable (void); bool LastEnemyShootable (void);

View file

@ -2322,7 +2322,7 @@ private:
int delta = 4; int delta = 4;
if (m_allocatedSize > 64) if (m_allocatedSize > 64)
delta = m_allocatedSize / 2; delta = m_allocatedSize * 0.5;
else if (m_allocatedSize > 8) else if (m_allocatedSize > 8)
delta = 16; delta = 16;

View file

@ -415,7 +415,7 @@ void Bot::AvoidGrenades (void)
continue; continue;
// check if visible to the bot // 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; continue;
// TODO: should be done once for grenade, instead of checking several times // 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); Path *path = g_waypoint->GetPath (index);
float bombTimer = mp_c4timer.GetFloat (); 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 ()) if (timeMidBlowup > GetWorldTime ())
{ {
@ -3639,7 +3639,7 @@ void Bot::RunTask (void)
if (m_viewDistance < 500.0 && m_difficulty >= 2) if (m_viewDistance < 500.0 && m_difficulty >= 2)
{ {
// go mad! // 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) if (m_moveSpeed < -pev->maxspeed)
m_moveSpeed = -pev->maxspeed; m_moveSpeed = -pev->maxspeed;
@ -3924,9 +3924,9 @@ void Bot::RunTask (void)
float bombTimer = mp_c4timer.GetFloat (); float bombTimer = mp_c4timer.GetFloat ();
// push camp task on to stack // 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 // 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) if (g_waypoint->GetPath (index)->vis.crouch <= g_waypoint->GetPath (index)->vis.stand)
m_campButtons |= IN_DUCK; m_campButtons |= IN_DUCK;

View file

@ -2756,38 +2756,6 @@ void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...)
(*g_engfuncs.pfnAlertMessage) (alertType, buffer); (*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; gamedll_funcs_t gameDLLFunc;
export int GetEntityAPI2 (gamefuncs_t *functionTable, int *interfaceVersion) 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->pfnCmd_Argc = pfnCmd_Argc;
functionTable->pfnSetClientMaxspeed = pfnSetClientMaxspeed; functionTable->pfnSetClientMaxspeed = pfnSetClientMaxspeed;
functionTable->pfnAlertMessage = pfnAlertMessage; functionTable->pfnAlertMessage = pfnAlertMessage;
functionTable->pfnGetPlayerAuthId = pfnGetPlayerAuthId;
functionTable->pfnGetPlayerWONId = pfnGetPlayerWONId;
return TRUE; return TRUE;
} }

View file

@ -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)); memset (&m_ammo, 0, sizeof (m_ammo));
m_currentWeapon = 0; // current weapon is not assigned at start 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 // copy them over to the temp level variables
m_agressionLevel = m_baseAgressionLevel; m_agressionLevel = m_baseAgressionLevel;

View file

@ -1273,7 +1273,7 @@ public:
while (child) while (child)
{ {
int parent = (child - 1) / 2; int parent = (child - 1) * 0.5;
if (m_heap[parent].pri <= m_heap[child].pri) if (m_heap[parent].pri <= m_heap[child].pri)
break; break;
@ -2135,7 +2135,7 @@ int Bot::FindDefendWaypoint (const Vector &origin)
if (waypointIndex[index] == -1) if (waypointIndex[index] == -1)
break; break;
} }
return waypointIndex[Random.Long (0, (index - 1) / 2)]; return waypointIndex[Random.Long (0, (index - 1) * 0.5)];
} }
int Bot::FindCoverWaypoint (float maxDistance) int Bot::FindCoverWaypoint (float maxDistance)
@ -3069,7 +3069,6 @@ int Bot::GetAimingWaypoint (void)
void Bot::FacePosition (void) void Bot::FacePosition (void)
{ {
// adjust all body and view angles to face an absolute vector // adjust all body and view angles to face an absolute vector
Vector direction = (m_lookAt - EyePosition ()).ToAngles (); Vector direction = (m_lookAt - EyePosition ()).ToAngles ();
direction = direction + pev->punchangle * (m_difficulty * 25) / 100.0; direction = direction + pev->punchangle * (m_difficulty * 25) / 100.0;

View file

@ -116,7 +116,7 @@ bool IsInViewCone (Vector origin, edict_t *ent)
{ {
MakeVectors (ent->v.v_angle); 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 true;
return false; return false;

View file

@ -240,7 +240,7 @@ void Waypoint::Add (int flags, const Vector &waypointOrigin)
flags += path->connectionFlags[i]; flags += path->connectionFlags[i];
if (flags == 0) if (flags == 0)
path->origin = (path->origin + g_hostEntity->v.origin) / 2; path->origin = (path->origin + g_hostEntity->v.origin) * 0.5;
} }
} }
break; break;