From 271594f0ee8e1c832905e0dbb24c86c21f9804a8 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 14 May 2017 10:27:43 +0300 Subject: [PATCH] [Client] Don't play death animations for NPCs saved as dead on server --- apps/openmw/mwmechanics/character.cpp | 14 ++++++++++++++ apps/openmw/mwmp/Cell.cpp | 3 +++ 2 files changed, 17 insertions(+) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index f27f8bcb1..f73223e94 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -683,6 +683,20 @@ CharacterState CharacterController::chooseRandomDeathState() const void CharacterController::playRandomDeath(float startpoint) { + /* + Start of tes3mp addition + + If this is a LocalActor or DedicatedActor whose death animation is supposed to be finished, + set the start point to the animation's end + */ + if (mPtr.getClass().getCreatureStats(mPtr).isDeathAnimationFinished() && (mwmp::Main::get().getCellController()->isLocalActor(mPtr) || mwmp::Main::get().getCellController()->isDedicatedActor(mPtr))) + { + startpoint = 1.F; + } + /* + End of tes3mp addition + */ + if (mPtr == getPlayer()) { // The first-person animations do not include death, so we need to diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 679379d59..5253a541a 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -188,6 +188,9 @@ void Cell::readStatsDynamic(ActorList& actorList) // That way, if this actor is about to become a LocalActor, initial data about it // received from the server still gets set actor->setStatsDynamic(); + + if (actor->creatureStats.mDynamic[0].mCurrent < 1) + actor->getPtr().getClass().getCreatureStats(actor->getPtr()).setDeathAnimationFinished(true); } } }