animations: Added stub for animation switching
authorLukas Krickl <lukas@krickl.dev>
Sat, 13 Sep 2025 03:52:30 +0000 (05:52 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 13 Sep 2025 03:52:30 +0000 (05:52 +0200)
src/animation.s
src/defs.s
src/player.s
src/unit_demo.s

index 879dfc79b571108492b1103c8d1364c5acb6433a..71fccb8f7d462455f92734e843875bd4a7df3995 100644 (file)
@@ -10,6 +10,32 @@ player_anim_table_f2:
        anim_ent 1, 0, 0x8E, OAM_FXFLIP
        anim_ent 0, 0, 0x00, 0
        
+       ; table that maps actor type to
+       ; a list of animations
+anim_actor_table:
+       dw anim_list_player     
+       dw anim_list_guard
+       dw anim_list_dog
+       dw anim_list_hazmat
+
+
+anim_list_player:
+       ; TDLE_NEUTRAL
+       dw player_anim_table 
+       ; ATTACK LEFT
+       dw player_anim_table
+       ; ATTACK RIGHT
+       dw player_anim_table 
+       ; ATTACK_UP
+       dw player_anim_table 
+       ; ATTACK_DOWN
+       dw player_anim_table 
+
+anim_list_guard:
+anim_list_dog:
+anim_list_hazmat:
+       
+
        ; translates tile to screen
        ; inputs:
        ;               $1: Y/X offset
@@ -21,6 +47,23 @@ player_anim_table_f2:
   sub a, $2 
 #endmacro
        
+       ; loads an animation for the current acotr
+       ; based on its type
+       ; and the requested animation entry
+       ; inputs:
+       ;               de: actor
+       ;                b: the animation
+       ; writes:
+       ;               new animation into selected actor
+anim_load_type:
+       ; TODO:
+       ;       1) load animation list based on type
+
+       ; 2) load animation table based on requested animation
+
+       ; 3) write animation to animation entry
+       ret
+       
        ; performs no drawing
 unit_nop_draw:
        ldnull bc
index ae461307bbf2ed88b0cb1e646ce54a4d4d7446c3..bea62550449fd63517f3573fd424e37decbf72f3 100644 (file)
   ; actor type enum
 .se 0
 .de ACT_T_NULL, 1
-.de ACT_T_CURSOR, 1
-.de ACT_T_DEMO_1, 1
+.de ACT_T_PLAYER, 1
+.de ACT_T_GUARD, 1
+.de ACT_T_DOG, 1
+.de ACT_T_HAZMAT, 1
 
   ; actor struct (unit's are instances of actors) 
   ; actor structs are basically just states
 .de anim_ent_oam_flags, 1
 .de anim_ent_size, 0
 
+; animation types 
+.se 0
+.de ANIM_T_IDLE_NEUTRAL, 1
+.de ANIM_T_ATTACK_LEFT, 1
+.de ANIM_T_ATTACK_RIGHT, 1
+.de ANIM_T_ATTACK_UP, 1
+.de ANIM_T_ATTACK_DOWN, 1
+
+
 ; special text commands
 
 ; consumes the command 
index 1c37328dc750beb450d9dd2ba13605bf33eea92a..0155ce92420db528b4102e8a54c5c7d7d1398aea 100644 (file)
@@ -319,7 +319,7 @@ unit_player_attack:
 
 unit_player:
   st_def 0x00, unit_player_init, st_unit_idle
-  act_def ACT_T_DEMO_1, 0, 2, 2, 0
+  act_def ACT_T_PLAYER, 0, 2, 2, 0
   act_stat_def1 1, 3, 1, 1
   act_stat_def2 1, 1, 90, 1 
   act_st_def st_unit_player_update, st_unit_idle
index 653a73416d182db364ff5bbcdab1f0d116c1e0c0..d301171be8ff8147417d76f11279d09c9b2a637f 100644 (file)
@@ -34,7 +34,7 @@ unit_demo_1_cpu_update_idle:
 
 unit_demo_guard:
   st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
-  act_def ACT_T_DEMO_1, 0, 9, 9, 0 
+  act_def ACT_T_GUARD, 0, 9, 9, 0 
   act_stat_def1 1, 3, 1, 1 
   act_stat_def2 1, 1, 32, 1
   act_st_def st_unit_demo_1_cpu_update, st_unit_idle
@@ -42,7 +42,7 @@ unit_demo_guard:
 
 unit_demo_dog:
   st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
-  act_def ACT_T_DEMO_1, 0, 9, 9, 0 
+  act_def ACT_T_DOG, 0, 9, 9, 0 
   act_stat_def1 1, 2, 1, 1 
   act_stat_def2 1, 1, 32, 1
   act_st_def st_unit_demo_1_cpu_update, st_unit_idle
@@ -51,7 +51,7 @@ unit_demo_dog:
 
 unit_demo_hazmat:
   st_def 0x00, unit_demo_1_init, st_unit_demo_1_cpu_update
-  act_def ACT_T_DEMO_1, 0, 9, 9, 0 
+  act_def ACT_T_HAZMAT, 0, 9, 9, 0 
   act_stat_def1 1, 1, 1, 1 
   act_stat_def2 1, 1, 32, 1
   act_st_def st_unit_demo_1_cpu_update, st_unit_idle