From 54a2076e17cc0122b15de4010afb6d3bf9169ba1 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 18 May 2025 20:29:55 +0200 Subject: [PATCH] unit: Added move reset function --- src/unit.s | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/unit.s b/src/unit.s index 302accb..90d949d 100644 --- a/src/unit.s +++ b/src/unit.s @@ -427,8 +427,26 @@ unit_next: jp @again ; resets all moves - ; of all actors un p0 and p1_unts + ; of all actors in p0 and p1_unts unit_reset_all_moves: + ld b, UNITS_MAX * PLAYERS + ld hl, p0_units +@loop: + push hl + ld de, act_moves+1 + add hl, de ; hl = act_moves_max + + ld a, [hl] + dec hl ; hl = current moves + ld [hl], a ; moves are now reset + + pop hl + ld de, act_size + add hl, de ; move to next act + + dec b + jr z, @loop REL + ret -- 2.30.2