From 2ca40173711a1b191896021472df1c0d3a61347f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 1 Nov 2017 22:00:54 +0200 Subject: [PATCH] [Client] Force position updates for players in animations --- apps/openmw/mwmp/LocalPlayer.cpp | 13 +++++++++++++ components/openmw-mp/Base/BasePlayer.hpp | 1 + 2 files changed, 14 insertions(+) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 956bad587..98a6497b0 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -67,6 +67,7 @@ LocalPlayer::LocalPlayer() diedSinceArrestAttempt = false; isReceivingQuickKeys = false; + isPlayingAnimation = false; } LocalPlayer::~LocalPlayer() @@ -339,6 +340,16 @@ void LocalPlayer::updatePosition(bool forceUpdate) bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || position.rot[0] != oldRot[0] || position.rot[2] != oldRot[1]); + // Animations can change a player's position without actually creating directional movement, + // so update positions accordingly + if (!posIsChanging && isPlayingAnimation) + { + if (MWBase::Environment::get().getMechanicsManager()->checkAnimationPlaying(ptrPlayer, animation.groupname)) + posIsChanging = true; + else + isPlayingAnimation = false; + } + if (forceUpdate || posIsChanging || posWasChanged) { oldRot[0] = position.rot[0]; @@ -1452,6 +1463,8 @@ void LocalPlayer::playAnimation() { MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(), animation.groupname, animation.mode, animation.count, animation.persist); + + isPlayingAnimation = true; } void LocalPlayer::playSpeech() diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index d96936a6d..b6c3d5630 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -292,6 +292,7 @@ namespace mwmp bool diedSinceArrestAttempt; bool isReceivingQuickKeys; + bool isPlayingAnimation; }; }