[Client] Force position updates for players in animations

0.6.2
David Cernat 7 years ago
parent be25decee2
commit 2ca4017371

@ -67,6 +67,7 @@ LocalPlayer::LocalPlayer()
diedSinceArrestAttempt = false; diedSinceArrestAttempt = false;
isReceivingQuickKeys = false; isReceivingQuickKeys = false;
isPlayingAnimation = false;
} }
LocalPlayer::~LocalPlayer() LocalPlayer::~LocalPlayer()
@ -339,6 +340,16 @@ void LocalPlayer::updatePosition(bool forceUpdate)
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 ||
position.rot[0] != oldRot[0] || position.rot[2] != oldRot[1]); 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) if (forceUpdate || posIsChanging || posWasChanged)
{ {
oldRot[0] = position.rot[0]; oldRot[0] = position.rot[0];
@ -1452,6 +1463,8 @@ void LocalPlayer::playAnimation()
{ {
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(), MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(getPlayerPtr(),
animation.groupname, animation.mode, animation.count, animation.persist); animation.groupname, animation.mode, animation.count, animation.persist);
isPlayingAnimation = true;
} }
void LocalPlayer::playSpeech() void LocalPlayer::playSpeech()

@ -292,6 +292,7 @@ namespace mwmp
bool diedSinceArrestAttempt; bool diedSinceArrestAttempt;
bool isReceivingQuickKeys; bool isReceivingQuickKeys;
bool isPlayingAnimation;
}; };
} }

Loading…
Cancel
Save