This commit is contained in:
jeefo 2023-07-27 01:44:36 +03:00
commit 0cf7c65a9b
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
4 changed files with 12 additions and 4 deletions

View file

@ -154,6 +154,10 @@ public:
~PathWalk () = default;
public:
int32_t &doubleNext () {
return at (2);
}
int32_t &next () {
return at (1);
}

View file

@ -3841,7 +3841,7 @@ bool Bot::isBombDefusing (const Vector &bombOrigin) {
}
float Bot::getShiftSpeed () {
if (getCurrentTaskId () == Task::SeekCover || isDucking () || (pev->button & IN_DUCK) || (m_oldButtons & IN_DUCK) || (m_currentTravelFlags & PathFlag::Jump) || (m_pathFlags & NodeFlag::Ladder) || isOnLadder () || isInWater () || m_isStuck) {
if (getCurrentTaskId () == Task::SeekCover || (m_aimFlags & AimFlags::Enemy) || isDucking () || (pev->button & IN_DUCK) || (m_oldButtons & IN_DUCK) || (m_currentTravelFlags & PathFlag::Jump) || (m_pathFlags & NodeFlag::Ladder) || isOnLadder () || isInWater () || m_isStuck) {
return pev->maxspeed;
}
return pev->maxspeed * 0.4f;

View file

@ -221,7 +221,7 @@ void Bot::normal_ () {
}
const float shiftSpeed = getShiftSpeed ();
if (!m_isStuck && (!cr::fzero (m_moveSpeed) && m_moveSpeed > shiftSpeed) && (cv_walking_allowed.bool_ () && mp_footsteps.bool_ ()) && m_difficulty >= Difficulty::Normal && !(m_aimFlags & AimFlags::Enemy) && (m_heardSoundTime + 6.0f >= game.time () || (m_states & Sense::SuspectEnemy)) && numEnemiesNear (pev->origin, 768.0f) >= 1 && !isKnifeMode () && !bots.isBombPlanted ()) {
if ((!cr::fzero (m_moveSpeed) && m_moveSpeed > shiftSpeed) && (cv_walking_allowed.bool_ () && mp_footsteps.bool_ ()) && m_difficulty >= Difficulty::Normal && (m_heardSoundTime + 6.0f >= game.time () || (m_states & Sense::HearingEnemy)) && pev->origin.distanceSq (m_lastEnemyOrigin) < cr::sqrf (768.0f) && !isKnifeMode () && !bots.isBombPlanted ()) {
m_moveSpeed = shiftSpeed;
}

View file

@ -146,7 +146,7 @@ void Bot::updateAimDir () {
predictNode = kInvalidNodeIndex;
pathLength = kInfiniteDistanceLong;
}
return predictNode != kInvalidNodeIndex && pathLength < cv_max_nodes_for_predict.int_ ();
return graph.exists (predictNode) && pathLength < cv_max_nodes_for_predict.int_ ();
};
if (changePredictedEnemy) {
@ -183,8 +183,12 @@ void Bot::updateAimDir () {
if (m_moveToGoal && m_seeEnemyTime + 4.0f < game.time () && !m_isStuck && m_moveSpeed > getShiftSpeed () && !(pev->button & IN_DUCK) && m_currentNodeIndex != kInvalidNodeIndex && !(m_pathFlags & (NodeFlag::Ladder | NodeFlag::Crouch)) && m_pathWalk.hasNext () && pev->origin.distanceSq (m_destOrigin) < cr::sqrf (512.0f)) {
const auto nextPathIndex = m_pathWalk.next ();
const auto doubleNextPath = m_pathWalk.doubleNext ();
if (vistab.visible (m_currentNodeIndex, nextPathIndex)) {
if (vistab.visible (m_currentNodeIndex, doubleNextPath)) {
m_lookAt = graph[doubleNextPath].origin + pev->view_ofs;
}
else if (vistab.visible (m_currentNodeIndex, nextPathIndex)) {
m_lookAt = graph[nextPathIndex].origin + pev->view_ofs;
}
else {