Merge branch 'master' of https://github.com/yapb/yapb
This commit is contained in:
commit
0cf7c65a9b
4 changed files with 12 additions and 4 deletions
|
|
@ -154,6 +154,10 @@ public:
|
||||||
~PathWalk () = default;
|
~PathWalk () = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int32_t &doubleNext () {
|
||||||
|
return at (2);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t &next () {
|
int32_t &next () {
|
||||||
return at (1);
|
return at (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3841,7 +3841,7 @@ bool Bot::isBombDefusing (const Vector &bombOrigin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float Bot::getShiftSpeed () {
|
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;
|
||||||
}
|
}
|
||||||
return pev->maxspeed * 0.4f;
|
return pev->maxspeed * 0.4f;
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ void Bot::normal_ () {
|
||||||
}
|
}
|
||||||
const float shiftSpeed = getShiftSpeed ();
|
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;
|
m_moveSpeed = shiftSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ void Bot::updateAimDir () {
|
||||||
predictNode = kInvalidNodeIndex;
|
predictNode = kInvalidNodeIndex;
|
||||||
pathLength = kInfiniteDistanceLong;
|
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) {
|
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)) {
|
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 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;
|
m_lookAt = graph[nextPathIndex].origin + pev->view_ofs;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue