diff --git a/CHANGELOG.md b/CHANGELOG.md index c6881a0fe4..0421a594b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Bug #6550: Cloned body parts don't inherit texture effects Bug #6574: Crash at far away from world origin coordinates Bug #6645: Enemy block sounds align with animation instead of blocked hits + Bug #6665: The kobolds in the skyrim: home of the nords mod are oversized Bug #6657: Distant terrain tiles become black when using FWIW mod Bug #6661: Saved games that have no preview screenshot cause issues or crashes Bug #6716: mwscript comparison operator handling is too restrictive diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 287e5d035c..27c3cff6b8 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -2042,7 +2042,8 @@ namespace MWMechanics float effectiveRotation = rot.z(); bool canMove = cls.getMaxSpeed(mPtr) > 0; const bool turnToMovementDirection = Settings::game().mTurnToMovementDirection; - if (!turnToMovementDirection || isFirstPersonPlayer) + const bool isBiped = mPtr.getClass().isBipedal(mPtr); + if (!isBiped || !turnToMovementDirection || isFirstPersonPlayer) { movementSettings.mIsStrafing = std::abs(vec.x()) > std::abs(vec.y()) * 2; stats.setSideMovementAngle(0); @@ -2286,7 +2287,7 @@ namespace MWMechanics // It seems only bipedal actors use turning animations. // Also do not use turning animations in the first-person view and when sneaking. - if (!sneak && !isFirstPersonPlayer && mPtr.getClass().isBipedal(mPtr)) + if (!sneak && !isFirstPersonPlayer && isBiped) { if (effectiveRotation > rotationThreshold) movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight; @@ -2296,7 +2297,7 @@ namespace MWMechanics } } - if (turnToMovementDirection && !isFirstPersonPlayer + if (turnToMovementDirection && !isFirstPersonPlayer && isBiped && (movestate == CharState_SwimRunForward || movestate == CharState_SwimWalkForward || movestate == CharState_SwimRunBack || movestate == CharState_SwimWalkBack)) { @@ -2330,7 +2331,7 @@ namespace MWMechanics } else { - if (mPtr.getClass().isBipedal(mPtr)) + if (isBiped) { if (mTurnAnimationThreshold > 0) mTurnAnimationThreshold -= duration; diff --git a/apps/openmw/mwrender/rotatecontroller.cpp b/apps/openmw/mwrender/rotatecontroller.cpp index 61a2a2628a..b8bcde9ee6 100644 --- a/apps/openmw/mwrender/rotatecontroller.cpp +++ b/apps/openmw/mwrender/rotatecontroller.cpp @@ -35,12 +35,25 @@ namespace MWRender return; } osg::Matrix matrix = node->getMatrix(); - osg::Quat worldOrient = getWorldOrientation(node); + + osg::Quat worldOrient; + osg::Vec3d worldScale(1.0, 1.0, 1.0); + + osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo); + + if (!nodepaths.empty()) + { + osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]); + worldOrient = worldMat.getRotate(); + worldScale = worldMat.getScale(); + } + osg::Quat worldOrientInverse = worldOrient.inverse(); osg::Quat orient = worldOrient * mRotate * worldOrientInverse * matrix.getRotate(); matrix.setRotate(orient); - matrix.setTrans(matrix.getTrans() + worldOrientInverse * mOffset); + + matrix *= osg::Matrix::scale(worldScale); node->setMatrix(matrix); @@ -57,18 +70,4 @@ namespace MWRender traverse(node, nv); } - - osg::Quat RotateController::getWorldOrientation(osg::Node* node) - { - // this could be optimized later, we just need the world orientation, not the full matrix - osg::NodePathList nodepaths = node->getParentalNodePaths(mRelativeTo); - osg::Quat worldOrient; - if (!nodepaths.empty()) - { - osg::Matrixf worldMat = osg::computeLocalToWorld(nodepaths[0]); - worldOrient = worldMat.getRotate(); - } - return worldOrient; - } - } diff --git a/apps/openmw/mwrender/rotatecontroller.hpp b/apps/openmw/mwrender/rotatecontroller.hpp index 87bf0adfe1..3c7e130d98 100644 --- a/apps/openmw/mwrender/rotatecontroller.hpp +++ b/apps/openmw/mwrender/rotatecontroller.hpp @@ -27,8 +27,6 @@ namespace MWRender void operator()(osg::MatrixTransform* node, osg::NodeVisitor* nv); protected: - osg::Quat getWorldOrientation(osg::Node* node); - bool mEnabled; osg::Vec3f mOffset; osg::Quat mRotate;