runplayermove is now not called every frame, the same as main bot code
this gives another fps boost for server perfomance, but gives a little shaky viewmodel (gun) drawing for bot while spectating him in firstperson mode.
This commit is contained in:
parent
6502c44050
commit
11d3ffe20e
4 changed files with 11 additions and 5 deletions
|
|
@ -944,6 +944,7 @@ private:
|
||||||
|
|
||||||
float m_lookYawVel; // look yaw velocity
|
float m_lookYawVel; // look yaw velocity
|
||||||
float m_lookPitchVel; // look pitch velocity
|
float m_lookPitchVel; // look pitch velocity
|
||||||
|
float m_lookUpdateTime; // lookangles update time
|
||||||
|
|
||||||
bool m_moveToGoal; // bot currently moving to goal??
|
bool m_moveToGoal; // bot currently moving to goal??
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2886,7 +2886,7 @@ void Bot::ThinkMain (void)
|
||||||
void Bot::ThinkFrame (void)
|
void Bot::ThinkFrame (void)
|
||||||
{
|
{
|
||||||
UpdateLookAngles ();
|
UpdateLookAngles ();
|
||||||
RunPlayerMovement ();
|
// RunPlayerMovement ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::Think (void)
|
void Bot::Think (void)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,10 @@ Bot *BotManager::FindOneValidAliveBot (void)
|
||||||
|
|
||||||
for (int i = 0; i < GetMaxClients (); i++)
|
for (int i = 0; i < GetMaxClients (); i++)
|
||||||
{
|
{
|
||||||
if (m_bots[i] != NULL && IsAlive (m_bots[i]->GetEntity ()) && foundBots.GetSize () < 5)
|
if (foundBots.GetSize () > 4)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (m_bots[i] != NULL && IsAlive (m_bots[i]->GetEntity ()))
|
||||||
foundBots.Push (i);
|
foundBots.Push (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -976,6 +979,7 @@ void Bot::NewRound (void)
|
||||||
m_prevOrigin = Vector (9999.0, 9999.0, 9999.0);
|
m_prevOrigin = Vector (9999.0, 9999.0, 9999.0);
|
||||||
m_prevTime = GetWorldTime ();
|
m_prevTime = GetWorldTime ();
|
||||||
m_blindRecognizeTime = GetWorldTime ();
|
m_blindRecognizeTime = GetWorldTime ();
|
||||||
|
m_lookUpdateTime = GetWorldTime ();
|
||||||
|
|
||||||
m_viewDistance = 4096.0;
|
m_viewDistance = 4096.0;
|
||||||
m_maxViewDistance = 4096.0;
|
m_maxViewDistance = 4096.0;
|
||||||
|
|
|
||||||
|
|
@ -3164,8 +3164,11 @@ void Bot::UpdateBodyAngles (void)
|
||||||
|
|
||||||
void Bot::UpdateLookAngles (void)
|
void Bot::UpdateLookAngles (void)
|
||||||
{
|
{
|
||||||
|
const float delta = GetWorldTime () - m_lookUpdateTime;
|
||||||
|
m_lookUpdateTime = GetWorldTime ();
|
||||||
|
|
||||||
// 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 () + pev->punchangle * (m_difficulty * 25) / 100.0;
|
Vector direction = (m_lookAt - EyePosition ()).ToAngles ();
|
||||||
direction.x *= -1.0f; // invert for engine
|
direction.x *= -1.0f; // invert for engine
|
||||||
|
|
||||||
direction.ClampAngles ();
|
direction.ClampAngles ();
|
||||||
|
|
@ -3189,8 +3192,6 @@ void Bot::UpdateLookAngles (void)
|
||||||
float angleDiffYaw = AngleNormalize (direction.y - m_idealAngles.y);
|
float angleDiffYaw = AngleNormalize (direction.y - m_idealAngles.y);
|
||||||
float angleDiffPitch = AngleNormalize (direction.x - m_idealAngles.x);
|
float angleDiffPitch = AngleNormalize (direction.x - m_idealAngles.x);
|
||||||
|
|
||||||
const float delta = m_frameInterval;
|
|
||||||
|
|
||||||
if (angleDiffYaw < 1.0f && angleDiffYaw > -1.0f)
|
if (angleDiffYaw < 1.0f && angleDiffYaw > -1.0f)
|
||||||
{
|
{
|
||||||
m_lookYawVel = 0.0f;
|
m_lookYawVel = 0.0f;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue