delaying jump collision action instead of randoming

This commit is contained in:
jeefo 2015-07-22 19:14:07 +03:00
commit 5174799000
2 changed files with 5 additions and 1 deletions

View file

@ -848,6 +848,7 @@ private:
float m_firstCollideTime; // time of first collision
float m_probeTime; // time of probing different moves
float m_lastCollTime; // time until next collision check
float m_jumpStateTimer; // timer for jumping collision check
unsigned int m_collisionProbeBits; // bits of possible collision moves
unsigned int m_collideMoves[MAX_COLLIDE_MOVES]; // sorted array of movements

View file

@ -428,7 +428,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
else if (IsInWater ())
bits |= (PROBE_JUMP | PROBE_STRAFE);
else
bits |= (PROBE_STRAFE | (Random.Long (0, 20) > (cantMoveForward ? 10 : 5) ? PROBE_JUMP : 0));
bits |= (PROBE_STRAFE | (m_jumpStateTimer < GetWorldTime () ? PROBE_JUMP : 0));
// collision check allowed if not flying through the air
if (IsOnFloor () || IsOnLadder () || IsInWater ())
@ -617,7 +617,10 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
{
case COLLISION_JUMP:
if (IsOnFloor () || IsInWater ())
{
pev->button |= IN_JUMP;
m_jumpStateTimer = Random.Float (1.0f, 2.0f);
}
break;
case COLLISION_DUCK: