Created
February 8, 2020 07:16
-
-
Save Langerz82/e918b01907d976028e8653f558ae500f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp | |
index ee1b9cecd..b0b4d994d 100644 | |
--- a/apps/openmw/mwmechanics/aicombat.cpp | |
+++ b/apps/openmw/mwmechanics/aicombat.cpp | |
@@ -133,7 +133,10 @@ namespace MWMechanics | |
} | |
storage.updateCombatMove(duration); | |
+ storage.mRotateMove = false; | |
if (storage.mReadyToAttack) updateActorsMovement(actor, duration, storage); | |
+ if (storage.mRotateMove) | |
+ return false; | |
storage.updateAttack(characterController); | |
} | |
else | |
@@ -392,17 +395,21 @@ namespace MWMechanics | |
std::shared_ptr<Action>& currentAction = storage.mCurrentAction; | |
bool isRangedCombat = false; | |
currentAction->getCombatRange(isRangedCombat); | |
+ bool isTurning = false; | |
// Check if the actor now facing desired direction, no need to turn any more | |
if (isRangedCombat) | |
{ | |
- if (smoothTurn(actor, targetAngleRadians, axis)) | |
+ isTurning = !smoothTurn(actor, targetAngleRadians, axis); | |
+ if (!isTurning) | |
targetAngleRadians = 0; | |
} | |
else | |
{ | |
- if (smoothTurn(actor, targetAngleRadians, axis, osg::DegreesToRadians(3.f))) | |
+ isTurning = !smoothTurn(actor, targetAngleRadians, axis, osg::DegreesToRadians(3.f)); | |
+ if (!isTurning) | |
targetAngleRadians = 0; | |
} | |
+ storage.mRotateMove = isTurning; | |
} | |
} | |
diff --git a/apps/openmw/mwmechanics/aicombat.hpp b/apps/openmw/mwmechanics/aicombat.hpp | |
index f89e71678..f9327c712 100644 | |
--- a/apps/openmw/mwmechanics/aicombat.hpp | |
+++ b/apps/openmw/mwmechanics/aicombat.hpp | |
@@ -33,6 +33,7 @@ namespace MWMechanics | |
bool mAttack; | |
float mAttackRange; | |
bool mCombatMove; | |
+ bool mRotateMove; | |
osg::Vec3f mLastTargetPos; | |
const MWWorld::CellStore* mCell; | |
std::shared_ptr<Action> mCurrentAction; | |
@@ -63,6 +64,7 @@ namespace MWMechanics | |
mAttack(false), | |
mAttackRange(0.0f), | |
mCombatMove(false), | |
+ mRotateMove(false), | |
mLastTargetPos(0,0,0), | |
mCell(nullptr), | |
mCurrentAction(), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment