From: Lukas Krickl Date: Tue, 26 Nov 2024 13:33:12 +0000 (+0100) Subject: Moved animation load macro to macro defs X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=39afa97ef91bf4032765e53e6cb2311d72a0d6e6;p=gbrg%2F.git Moved animation load macro to macro defs --- 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