animation: Added defs for new animation system
authorLukas Krickl <lukas@krickl.dev>
Mon, 8 Sep 2025 18:31:17 +0000 (20:31 +0200)
committerLukas Krickl <lukas@krickl.dev>
Mon, 8 Sep 2025 18:31:17 +0000 (20:31 +0200)
src/animation.s
src/defs.s
src/macros.inc

index b4ac80d40085436b8d2ad6294bffbf7e3d007255..c8fad8a2e71b6250f056eeba147eebdde4ce060e 100644 (file)
@@ -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
index b004e4c7e960850f72556d405226fce016089fb5..39bf082200616915244edc736c06c3d91c880c6d 100644 (file)
 .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
 
 .def int DIRDOWN = BTNDOWN
 .def int DIRLEFT = BTNLEFT
 .def int DIRRIGHT = BTNRIGHT
+
index 7ad9c9898d37e33b2333353adac2757585c308d7..27a21f25c707cb5bb8ddd0583b718e225d1f1e0c 100644 (file)
        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
+