mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-04 15:57:59 +03:00
Merge branch 'sneakyidles' into 'master'
Fix idle swim/sneak animation fallback again Closes #6816 See merge request OpenMW/openmw!2031
This commit is contained in:
commit
aa5535c9dc
1 changed files with 26 additions and 23 deletions
|
@ -672,28 +672,30 @@ void CharacterController::refreshIdleAnims(CharacterState idle, bool force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mIdleState = idle;
|
mIdleState = idle;
|
||||||
size_t numLoops = ~0ul;
|
|
||||||
|
|
||||||
std::string idleGroup = idleStateToAnimGroup(mIdleState);
|
std::string idleGroup = idleStateToAnimGroup(mIdleState);
|
||||||
|
|
||||||
// Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to
|
|
||||||
// "idle"+weapon or "idle".
|
|
||||||
if ((mIdleState == CharState_IdleSwim || mIdleState == CharState_IdleSneak) && !mAnimation->hasAnimation(idleGroup))
|
|
||||||
{
|
|
||||||
mIdleState = CharState_Idle;
|
|
||||||
idleGroup = idleStateToAnimGroup(mIdleState);
|
|
||||||
}
|
|
||||||
|
|
||||||
MWRender::Animation::AnimPriority priority = getIdlePriority(mIdleState);
|
|
||||||
|
|
||||||
if (idleGroup.empty())
|
if (idleGroup.empty())
|
||||||
{
|
{
|
||||||
resetCurrentIdleState();
|
resetCurrentIdleState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWRender::Animation::AnimPriority priority = getIdlePriority(mIdleState);
|
||||||
|
size_t numLoops = std::numeric_limits<size_t>::max();
|
||||||
|
|
||||||
|
// Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to
|
||||||
|
// "idle"+weapon or "idle".
|
||||||
|
bool fallback = mIdleState != CharState_Idle && !mAnimation->hasAnimation(idleGroup);
|
||||||
|
if (fallback)
|
||||||
|
{
|
||||||
|
priority = getIdlePriority(CharState_Idle);
|
||||||
|
idleGroup = idleStateToAnimGroup(CharState_Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fallback || mIdleState == CharState_Idle || mIdleState == CharState_SpecialIdle)
|
||||||
|
{
|
||||||
std::string weapShortGroup = getWeaponShortGroup(mWeaponType);
|
std::string weapShortGroup = getWeaponShortGroup(mWeaponType);
|
||||||
if (mIdleState != CharState_IdleSwim && mIdleState != CharState_IdleSneak && mIdleState != CharState_None && !weapShortGroup.empty())
|
if (!weapShortGroup.empty())
|
||||||
{
|
{
|
||||||
std::string weapIdleGroup = idleGroup + weapShortGroup;
|
std::string weapIdleGroup = idleGroup + weapShortGroup;
|
||||||
if (!mAnimation->hasAnimation(weapIdleGroup))
|
if (!mAnimation->hasAnimation(weapIdleGroup))
|
||||||
|
@ -705,6 +707,7 @@ void CharacterController::refreshIdleAnims(CharacterState idle, bool force)
|
||||||
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
|
||||||
numLoops = 1 + Misc::Rng::rollDice(4, prng);
|
numLoops = 1 + Misc::Rng::rollDice(4, prng);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!mAnimation->hasAnimation(idleGroup))
|
if (!mAnimation->hasAnimation(idleGroup))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue