From 17d73513ccb25490f591ebb6e15622b1c019fae6 Mon Sep 17 00:00:00 2001 From: Matthew Jimenez Date: Mon, 24 Aug 2020 21:42:06 -0500 Subject: [PATCH] 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. --- engines/ultima/ultima8/world/actors/actor.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp index 16503df3309..bff7d85737c 100644 --- a/engines/ultima/ultima8/world/actors/actor.cpp +++ b/engines/ultima/ultima8/world/actors/actor.cpp @@ -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; }