From 9abfabb065f244fb190eb754ce1d860836062445 Mon Sep 17 00:00:00 2001 From: Capostrophic <21265616+Capostrophic@users.noreply.github.com> Date: Thu, 5 Jul 2018 22:49:40 +0300 Subject: [PATCH] Ensure forward-compatibility of death animations in old saves (fixes #4274) --- apps/openmw/mwmechanics/character.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 6c1332154..e6a8e8152 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -662,16 +662,19 @@ MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::I void CharacterController::playDeath(float startpoint, CharacterState death) { + // Make sure the character was swimming upon death for forward-compatibility + const bool wasSwimming = MWBase::Environment::get().getWorld()->isSwimming(mPtr); + switch (death) { case CharState_SwimDeath: mCurrentDeath = "swimdeath"; break; case CharState_SwimDeathKnockDown: - mCurrentDeath = "swimdeathknockdown"; + mCurrentDeath = (wasSwimming ? "swimdeathknockdown" : "deathknockdown"); break; case CharState_SwimDeathKnockOut: - mCurrentDeath = "swimdeathknockout"; + mCurrentDeath = (wasSwimming ? "swimdeathknockout" : "deathknockout"); break; case CharState_DeathKnockDown: mCurrentDeath = "deathknockdown";