From 39afa97ef91bf4032765e53e6cb2311d72a0d6e6 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 26 Nov 2024 14:33:12 +0100 Subject: [PATCH] Moved animation load macro to macro defs --- src/macros.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/macros.inc b/src/macros.inc index e2ac287..a0fd3c8 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -56,3 +56,21 @@ ld a, 1 ld [end_turn], a #endmacro + + ; loads an animation frame + ; from a table + ; uses hl and a + ; inputs: + ; $1: table + ; $2: max frames (mask) + ; returns: + ; a: the frame +#macro load_anim_frame + ld hl, $1 + ld a, [frame_count] + and a, $2 ; max frames + ld d, 0 + ld e, a + add hl, de ; hl = correct tile index + ld a, [hl] +#endmacro -- 2.30.2