CPatterned: ApproachDest fixes

This commit is contained in:
Luke Street 2020-09-16 02:18:03 -04:00
parent daad01d129
commit 5b44ac143d
1 changed files with 10 additions and 6 deletions

View File

@ -1321,8 +1321,10 @@ void CPatterned::UpdateDest(CStateManager& mgr) {
void CPatterned::ApproachDest(CStateManager& mgr) { void CPatterned::ApproachDest(CStateManager& mgr) {
zeus::CVector3f faceVec = mgr.GetPlayer().GetTranslation() - GetTranslation(); zeus::CVector3f faceVec = mgr.GetPlayer().GetTranslation() - GetTranslation();
zeus::CVector3f moveVec = x2e0_destPos - GetTranslation(); zeus::CVector3f moveVec = x2e0_destPos - GetTranslation();
if (!x328_25_verticalMovement) if (!x328_25_verticalMovement) {
moveVec.z() = 0.f; moveVec.z() = 0.f;
faceVec.z() = 0.f;
}
zeus::CVector3f pathLine = x2e0_destPos - x2ec_reflectedDestPos; zeus::CVector3f pathLine = x2e0_destPos - x2ec_reflectedDestPos;
if (pathLine.dot(moveVec) <= 0.f) if (pathLine.dot(moveVec) <= 0.f)
x328_24_inPosition = true; x328_24_inPosition = true;
@ -1348,18 +1350,20 @@ void CPatterned::ApproachDest(CStateManager& mgr) {
} }
x31c_faceVec = faceVec; x31c_faceVec = faceVec;
x310_moveVec = x3b0_moveSpeed * moveVec; x310_moveVec = x3b0_moveSpeed * moveVec;
pas::EStepDirection stepDir;
if (!KnockbackWhenFrozen()) { if (!KnockbackWhenFrozen()) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, x31c_faceVec, 1.f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, x31c_faceVec, 1.f));
} else if (x30c_behaviourOrient == EBehaviourOrient::MoveDir || } else if (x30c_behaviourOrient == EBehaviourOrient::MoveDir ||
!x450_bodyController->HasBodyState(pas::EAnimationState::Step)) { !x450_bodyController->HasBodyState(pas::EAnimationState::Step)) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, zeus::skZero3f, 1.f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, zeus::skZero3f, 1.f));
} else if ((stepDir = GetStepDirection(x310_moveVec)) != pas::EStepDirection::Forward) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(stepDir, pas::EStepType::Normal));
} else { } else {
pas::EStepDirection stepDir = GetStepDirection(x310_moveVec);
if (stepDir == pas::EStepDirection::Forward) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, zeus::skZero3f, 1.f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(x310_moveVec, zeus::skZero3f, 1.f));
} else {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(stepDir, pas::EStepType::Normal));
} }
x450_bodyController->GetCommandMgr().DeliverTargetVector(x31c_faceVec); x450_bodyController->GetCommandMgr().DeliverTargetVector(x31c_faceVec);
}
} else if (x450_bodyController->GetBodyStateInfo().GetMaxSpeed() > FLT_EPSILON) { } else if (x450_bodyController->GetBodyStateInfo().GetMaxSpeed() > FLT_EPSILON) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd( x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(
(x138_velocity.magnitude() / x450_bodyController->GetBodyStateInfo().GetMaxSpeed()) * x34_transform.basis[1], (x138_velocity.magnitude() / x450_bodyController->GetBodyStateInfo().GetMaxSpeed()) * x34_transform.basis[1],