void C_NEOPlayer::PreThink() { BaseClass::PreThink(); UpdateSomething2(); UpdateThermoptic(); UpdateGeiger(); UpdateVision(); UpdateInCross(); UpdateSomething( gpGlobals->curtime - m_fLastThinkTime ); m_fLastThinkTime = gpGlobals->curtime; }
void Race::Update(double tick) { UpdateVision(); }
void CHostageImprov::__MAKE_VHOOK(OnUpdate)(float deltaT) { if (!IsAlive() || cv_hostage_stop.value > 0.0f) return; if (m_blinkTimer.IsElapsed()) { if (m_scaredTimer.IsElapsed() && m_animateState.GetPerformance() != HostageAnimateState::Afraid) { m_blinkTimer.Start(RANDOM_FLOAT(3, 10)); m_blinkCounter = RANDOM_LONG(2, 4); } else { m_blinkTimer.Start(RANDOM_FLOAT(0.5f, 2.0f)); m_blinkCounter = RANDOM_LONG(1, 2); } } if (m_blinkCounter) { m_hostage->pev->body = 1; --m_blinkCounter; } else { m_hostage->pev->body = 0; } UpdateGrenadeReactions(); UpdateDelayedChatter(); UpdateVision(); m_behavior.Update(); m_actualVel.x = m_hostage->pev->origin.x - m_lastPosition.x; m_actualVel.y = m_hostage->pev->origin.y - m_lastPosition.y; const float runSpeed = 289.0f; const float walkSpeed = 9.0f; const float fallVelocity = -1000.0f; const float safeTime = 0.4f; if (IsOnGround()) { if (IsCrouching()) { if (m_actualVel.LengthSquared() > 9.0f) { if (m_animateState.GetPerformance() != HostageAnimateState::CrouchWalk) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::CrouchWalk); ClearLookAt(); if (m_scaredTimer.IsElapsed() && m_animateState.GetPerformance() != HostageAnimateState::Afraid) m_animateState.AddSequence(this, ACT_CROUCH_WALK, 99.9, 2.0); else m_animateState.AddSequence(this, ACT_CROUCH_WALK_SCARED, 99.9, 2.0); } } else if (m_animateState.GetPerformance() != HostageAnimateState::Crouch) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::Crouch); if (m_scaredTimer.IsElapsed()) m_animateState.AddSequence(this, ACT_CROUCH_IDLE, 99.9); else m_animateState.AddSequence(this, ACT_CROUCH_IDLE_SCARED); } } else { UTIL_MakeVectors(m_hostage->pev->angles); float dot = DotProduct2D(gpGlobals->v_forward, m_actualVel); if (dot < -3.0f) { if (m_animateState.GetPerformance() != HostageAnimateState::Walk) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::Walk); ClearLookAt(); float speed; if (m_actualVel.LengthSquared() > runSpeed) speed = 2.0f; else speed = 1.0f; m_animateState.AddSequence(this, ACT_WALK_BACK, 99.9, speed); } } else { if (m_actualVel.LengthSquared() > runSpeed) { if (m_animateState.GetPerformance() != HostageAnimateState::Run) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::Run); ClearLookAt(); if (m_scaredTimer.IsElapsed() && m_animateState.GetPerformance() != HostageAnimateState::Afraid && !m_behavior.IsState(&m_escapeState)) m_animateState.AddSequence(this, ACT_RUN, 99.9, 2.0); else m_animateState.AddSequence(this, ACT_RUN_SCARED, 99.9, 2.0); } } else if (m_actualVel.LengthSquared() > walkSpeed) { if (m_animateState.GetPerformance() != HostageAnimateState::Walk) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::Walk); ClearLookAt(); if (m_behavior.IsState(&m_escapeState)) { m_animateState.AddSequence(this, ACT_WALK_SNEAKY, 99.9, 1.5); } else if (m_scaredTimer.IsElapsed() && m_animateState.GetPerformance() != HostageAnimateState::Afraid) { m_animateState.AddSequence(this, ACT_WALK, 99.9, 1.5); } else m_animateState.AddSequence(this, ACT_WALK_SCARED, 99.9, 1.5); } } else { if (m_animateState.GetPerformance() == HostageAnimateState::Walk || m_animateState.GetPerformance() == HostageAnimateState::Run) m_animateState.Reset(); UpdateStationaryAnimation(); } } } } else if (m_hostage->pev->velocity.z < fallVelocity && m_animateState.GetPerformance() != HostageAnimateState::Fall) { m_animateState.Reset(); m_animateState.SetPerformance(HostageAnimateState::Fall); m_animateState.AddSequence(this, ACT_FALL, 99.9); } if (!m_collisionTimer.HasStarted() || m_collisionTimer.IsGreaterThen(safeTime)) SetKnownGoodPosition(m_lastPosition); m_lastPosition = m_hostage->pev->origin; m_animateState.OnUpdate(this); }