Skip to content

Commit

Permalink
"Fix" DoActionMove for war1gus:
Browse files Browse the repository at this point in the history
war1gus' move animation is of the form
`{"unbreakable begin", "frame 5", "move N", "wait 2", "wait 1", "unbreakable begin", "frame 0", "wait 1"}`;
//                                           ^^^^ Computation here (unbreakable) :/              ^^^^^ and can be break here
(whereas wargus one is
`{"unbreakable begin", "frame 5", "move N1", "wait 2", "frame 4", "move N2",  "unbreakable begin", "frame 0", "wait 1"}`)
//                                                                                                             ^^^^^ computation here (breakable)
Computation on path (and IX/IY) was done on next (finished) `"wait X"` after reaching the tile (so was done **inside** the `unbreakable` section for war1gus).
Workaround is to do the computation only on new animation cycle.
Alternative:
- Grouping `"wait N1", "wait N2"` into `"wait N1+N2"` would not be enough (but would be fine).
- Compute path on first `"move"` is problematic (for Wait/unreachable).
  • Loading branch information
Jarod42 committed Aug 18, 2024
1 parent d5a050d commit 09719a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/action/action_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ int DoActionMove(CUnit &unit)
Vec2i posd{}; // movement in tile.
int d{};

if (unit.Moving != 1 && (&unit.Type->Animations->Move != unit.Anim.CurrAnim || !unit.Anim.Wait)) {
if (unit.Moving != 1
&& (&unit.Type->Animations->Move != unit.Anim.CurrAnim
|| (unit.Anim.Wait == 0 && unit.Anim.Anim == 0))) {
if (unit.Anim.Unbreakable && unit.Moving > 1) {
// subtile movement, we're finished, but inside an unbreakable animation that we have to finish
int m = UnitShowAnimationScaled(unit, &unit.Type->Animations->Move, 1) >> 1;
Expand Down

0 comments on commit 09719a0

Please sign in to comment.