[Client] Uninitialize DedicatedActors instantly in some situations

When LocalActors briefly become DedicatedActors as the result of a server script, the DedicatedActors are immediately uninitialized to avoid bugs like them jumping in place or rotating slightly.

Additionally, the playing of animations and sounds received in packets for DedicatedActors is no longer done during their next update, but is instead done instantly when the packets are received.
fix/skillcap
David Cernat 6 years ago
parent 5fd4113978
commit 5bd2244898

@ -171,6 +171,7 @@ void Cell::readAnimPlay(ActorList& actorList)
actor->animation.mode = baseActor.animation.mode;
actor->animation.count = baseActor.animation.count;
actor->animation.persist = baseActor.animation.persist;
actor->playAnimation();
}
}
}
@ -229,6 +230,9 @@ void Cell::readEquipment(ActorList& actorList)
actor->setEquipment();
}
}
if (hasLocalAuthority())
uninitializeDedicatedActors(actorList);
}
void Cell::readSpeech(ActorList& actorList)
@ -243,8 +247,12 @@ void Cell::readSpeech(ActorList& actorList)
{
DedicatedActor *actor = dedicatedActors[mapIndex];
actor->sound = baseActor.sound;
actor->playSound();
}
}
if (hasLocalAuthority())
uninitializeDedicatedActors(actorList);
}
void Cell::readAi(ActorList& actorList)
@ -268,6 +276,9 @@ void Cell::readAi(ActorList& actorList)
actor->setAi();
}
}
if (hasLocalAuthority())
uninitializeDedicatedActors(actorList);
}
void Cell::readAttack(ActorList& actorList)
@ -454,6 +465,17 @@ void Cell::uninitializeLocalActors()
localActors.clear();
}
void Cell::uninitializeDedicatedActors(ActorList& actorList)
{
for (const auto &baseActor : actorList.baseActors)
{
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
Main::get().getCellController()->removeDedicatedActorRecord(mapIndex);
delete dedicatedActors.at(mapIndex);
dedicatedActors.erase(mapIndex);
}
}
void Cell::uninitializeDedicatedActors()
{
for (const auto &actor : dedicatedActors)

@ -35,6 +35,7 @@ namespace mwmp
void initializeDedicatedActors(ActorList& actorList);
void uninitializeLocalActors();
void uninitializeDedicatedActors(ActorList& actorList);
void uninitializeDedicatedActors();
virtual LocalActor *getLocalActor(std::string actorIndex);

@ -61,8 +61,6 @@ void DedicatedActor::update(float dt)
setAnimFlags();
}
playAnimation();
playSound();
setStatsDynamic();
}

Loading…
Cancel
Save