From 9af5eac5e9274e631d015bee0263f312149815b8 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 8 Sep 2025 20:31:17 +0200 Subject: [PATCH] animation: Added defs for new animation system --- src/animation.s | 6 ++++++ src/defs.s | 25 +++++++++++++++++++++++++ src/macros.inc | 29 +++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/src/animation.s b/src/animation.s index b4ac80d..c8fad8a 100644 --- a/src/animation.s +++ b/src/animation.s @@ -1,3 +1,9 @@ +player_anim_header: + anim_header 2, ANIM_HEAD_F_LOOP, 1, player_anim_table, NULL + +player_anim_table: + anim_ent 0x8C, 0x00, 0, 0 + anim_ent 0x8C, 0x00, 0, 0 ; calls unit's draw function diff --git a/src/defs.s b/src/defs.s index b004e4c..39bf082 100644 --- a/src/defs.s +++ b/src/defs.s @@ -348,6 +348,30 @@ .se 0 .de action_st_action_ptr, 2 .de action_size, 0 + +; animation header struct +.se 0 + ; how many objects can an animation draw + ; valid values are 1, 2, 3, 4 +.de anim_header_objs, 1 +.de anim_header_flags, 1 +.de anim_header_frames, 1 +.de anim_header_table, 1 +.de anim_header_next, 2 ; next animation if not looping + +; animation header flags +.se 1 + ; loop the animation + ; if set to 0 return to next animation +.de ANIM_HEAD_F_LOOP, 1 + + +; animation entry struct +.se 0 +.de anim_ent_oam_tile, 1 +.de anim_ent_oam_flags, 1 +.de anim_ent_x_offset, 1 +.de anim_ent_y_offset, 1 ; special text commands @@ -366,3 +390,4 @@ .def int DIRDOWN = BTNDOWN .def int DIRLEFT = BTNLEFT .def int DIRRIGHT = BTNRIGHT + diff --git a/src/macros.inc b/src/macros.inc index 7ad9c98..27a21f2 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -280,3 +280,32 @@ sub a, c ld b, a #endmacro + + ; animation header + ; inputs: + ; $1: obj count (1, 2, 3, 4) + ; $2: flags + ; $3: number of frames + ; $4: animation table + ; $5: next animation +#macro anim_header + .db $1 + .db $2 + .db $3 + dw $4 + dw $5 +#endmacro + + ; animation entry + ; inputs: + ; $1: tile + ; $2: oam flags + ; $3: x offset + ; $4: y offset +#macro anim_ent + .db $1 + .db $2 + .db $3 + .db $4 +#endmacro + -- 2.30.2