From 99710e8f559583796740f39d1407406d31b61d21 Mon Sep 17 00:00:00 2001 From: capostrophic Date: Sat, 10 Aug 2019 00:55:18 +0300 Subject: [PATCH] Allow SwimRunForward state WalkForward fallback (bug #5126) --- CHANGELOG.md | 2 ++ apps/openmw/mwmechanics/character.cpp | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b15ef7270..88a48d60c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,7 +127,9 @@ Bug #5112: Insufficient magicka for current spell not reflected on HUD icon Bug #5123: Script won't run on respawn Bug #5124: Arrow remains attached to actor if pulling animation was cancelled + Bug #5126: Swimming creatures without RunForward animations are motionless during combat Bug #5134: Doors rotation by "Lock" console command is inconsistent + Bug #5126: Swimming creatures without RunForward animations are motionless during combat Bug #5137: Textures with Clamp Mode set to Clamp instead of Wrap are too dark outside the boundaries Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index e2021bea9..ac7edcbfd 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -529,19 +529,7 @@ void CharacterController::refreshMovementAnims(const std::string& weapShortGroup if(!mAnimation->hasAnimation(movementAnimName)) { std::string::size_type swimpos = movementAnimName.find("swim"); - if(swimpos == std::string::npos) - { - std::string::size_type runpos = movementAnimName.find("run"); - if (runpos != std::string::npos) - { - movementAnimName.replace(runpos, runpos+3, "walk"); - if (!mAnimation->hasAnimation(movementAnimName)) - movementAnimName.clear(); - } - else - movementAnimName.clear(); - } - else + if (swimpos != std::string::npos) { movementAnimName.erase(swimpos, 4); if (!weapShortGroup.empty()) @@ -552,8 +540,18 @@ void CharacterController::refreshMovementAnims(const std::string& weapShortGroup else movementAnimName = fallbackShortWeaponGroup(movementAnimName, &movemask); } + } - if (!mAnimation->hasAnimation(movementAnimName)) + if (swimpos == std::string::npos || !mAnimation->hasAnimation(movementAnimName)) + { + std::string::size_type runpos = movementAnimName.find("run"); + if (runpos != std::string::npos) + { + movementAnimName.replace(runpos, runpos+3, "walk"); + if (!mAnimation->hasAnimation(movementAnimName)) + movementAnimName.clear(); + } + else movementAnimName.clear(); } }