ULTIMA8: Finish actor turn with stand animation instead appending after turn.

This prevents a head snaping animation at the of a turn and allows the next queued animation to not have an addition wait before starting.
This commit is contained in:
Matthew Jimenez 2020-08-24 21:42:06 -05:00
parent d7ea3450e3
commit 17d73513cc

View File

@ -584,6 +584,7 @@ uint16 Actor::turnTowardDir(Direction targetdir) {
standanim = Animation::surrenderStand;
}
ProcId animpid = 0;
ProcId prevpid = 0;
// Create a sequence of turn animations from
@ -600,28 +601,22 @@ uint16 Actor::turnTowardDir(Direction targetdir) {
bool done = false;
for (Direction dir = curdir; !done; dir = Direction_TurnByDelta(dir, stepDelta, mode)) {
ProcId animpid = doAnim(turnanim, dir);
Animation::Sequence nextanim = turnanim;
if (dir == targetdir) {
nextanim = standanim;
done = true;
}
animpid = doAnim(nextanim, dir);
if (prevpid) {
Process *proc = Kernel::get_instance()->getProcess(animpid);
assert(proc);
proc->waitFor(prevpid);
}
done = (dir == targetdir);
prevpid = animpid;
}
ProcId animpid = prevpid;
if (turnanim != standanim) {
animpid = doAnim(standanim, targetdir);
if (prevpid) {
Process *proc = Kernel::get_instance()->getProcess(animpid);
assert(proc);
proc->waitFor(prevpid);
}
}
return animpid;
}