delaying jump collision action instead of randoming
This commit is contained in:
parent
db3cf85758
commit
5174799000
2 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue