unit: draw now uses actor's tile and oam flags
authorLukas Krickl <lukas@krickl.dev>
Sat, 24 May 2025 15:26:23 +0000 (17:26 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 24 May 2025 15:26:23 +0000 (17:26 +0200)
src/unit.s

index 3bb8bfdf7903c14a5574c256f36e10162285708e..c20d1c8b3d4e0b0e56f1b6516c4a48c8d85b029e 100644 (file)
@@ -86,10 +86,15 @@ unit_demo_1_update:
 
   ; inputs
   ;   de: actor
-unit_demo_1_draw:
-  ld b, 0x84 ; tile 
-  ld c, 0x00 ; flags
+unit_draw:
   push de
+  ld hl, act_oam_tile
+  add hl, de ; hl = tile 
+  ld a, [hl+]
+
+  ld b, a ; tile
+  ld a, [hl]
+  ld c, a ; flags
   call unit_generic_draw
   pop de
   ldnull bc
@@ -607,20 +612,20 @@ unit_demo_1:
   st_def 0x00, unit_demo_1_init, st_unit_idle
   act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 6, 2, 2, 0 
   act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
-  act_def_draw unit_demo_1_draw, 0x84, 0
+  act_def_draw unit_draw, 0x84, 0
 
 
 unit_demo_2:
   st_def 0x00, unit_demo_1_init, st_unit_idle
   act_def ACT_T_DEMO_1, 0, 1, 2, 3, 1, 5, 3, 3, 0 
   act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
-  act_def_draw unit_demo_1_draw, 0x84, 0
+  act_def_draw unit_draw, 0x84, 0
 
 unit_demo_3:
   st_def 0x00, unit_demo_1_init, st_unit_idle
   act_def ACT_T_DEMO_1, 0, 1, 2, 3, 0, 5, 4, 4, 0 
   act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
-  act_def_draw unit_demo_1_draw, 0x84, 0
+  act_def_draw unit_draw, 0x84, 0
 
 st_unit_demo_1_update:
   st_def 0x00, unit_demo_1_update, st_unit_demo_1_update