mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 03:06:43 +00:00
[Client] Synchronize positions for actors during death animations
This needs some improvements, because: 1) Sometimes the cell authority sends the death animation too late and a different one gets played on the other clients 2) There is probably a simpler check that can be done for position changes during a death animation.
This commit is contained in:
parent
9b8818687d
commit
4b27f8986b
2 changed files with 27 additions and 3 deletions
|
@ -2793,6 +2793,17 @@ CharacterController::KillResult CharacterController::kill()
|
|||
return Result_DeathAnimPlaying;
|
||||
if (!cStats.isDeathAnimationFinished())
|
||||
{
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
*/
|
||||
if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
|
||||
{
|
||||
mwmp::Main::get().getCellController()->getLocalActor(mPtr)->creatureStats.mDeathAnimationFinished = true;
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
cStats.setDeathAnimationFinished(true);
|
||||
return Result_DeathAnimJustFinished;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ LocalActor::LocalActor()
|
|||
killer.name = "";
|
||||
|
||||
creatureStats.mDead = false;
|
||||
creatureStats.mDeathAnimationFinished = false;
|
||||
}
|
||||
|
||||
LocalActor::~LocalActor()
|
||||
|
@ -59,7 +60,7 @@ void LocalActor::update(bool forceUpdate)
|
|||
updateStatsDynamic(forceUpdate);
|
||||
updateEquipment(forceUpdate, false);
|
||||
|
||||
if (forceUpdate || !creatureStats.mDead)
|
||||
if (forceUpdate || !creatureStats.mDeathAnimationFinished)
|
||||
{
|
||||
updatePosition(forceUpdate);
|
||||
updateAnimFlags(forceUpdate);
|
||||
|
@ -87,8 +88,19 @@ void LocalActor::updateCell()
|
|||
|
||||
void LocalActor::updatePosition(bool forceUpdate)
|
||||
{
|
||||
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
||||
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0);
|
||||
bool posIsChanging = false;
|
||||
|
||||
if (creatureStats.mDead)
|
||||
{
|
||||
ESM::Position ptrPosition = ptr.getRefData().getPosition();
|
||||
posIsChanging = position.pos[0] != ptrPosition.pos[0] || position.pos[1] != ptrPosition.pos[1] ||
|
||||
position.pos[2] != ptrPosition.pos[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
posIsChanging = direction.pos[0] != 0 || direction.pos[1] != 0 || direction.pos[2] != 0 ||
|
||||
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0;
|
||||
}
|
||||
|
||||
if (forceUpdate || posIsChanging || posWasChanged)
|
||||
{
|
||||
|
@ -191,6 +203,7 @@ void LocalActor::updateStatsDynamic(bool forceUpdate)
|
|||
fatigue.writeState(creatureStats.mDynamic[2]);
|
||||
|
||||
creatureStats.mDead = ptrCreatureStats->isDead();
|
||||
creatureStats.mDeathAnimationFinished = ptrCreatureStats->isDeathAnimationFinished();
|
||||
|
||||
mwmp::Main::get().getNetworking()->getActorList()->addStatsDynamicActor(*this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue