Added skip turn code to all other actor types for now
authorLukas Krickl <lukas@krickl.dev>
Mon, 18 Nov 2024 18:18:33 +0000 (19:18 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 18 Nov 2024 18:18:33 +0000 (19:18 +0100)
src/actor.s
src/wram.s

index 1470ae1a26faea34bfb56a63da4742d19454ea01..b23b5c36ca9c92426c689702f3c9f25b41e6a02a 100644 (file)
@@ -8,9 +8,33 @@ actor_update_table:
   dw actor_update_rock
 
 actor_update_null:
+  ; if who is current actor simply
+  ; skip
+  ld a, [act]
+  ld b, a
+  ld a, [who]
+  cp a, b
+  jr nz, @skip REL
+  
+  call turn_finish 
+  call who_next
+
+@skip:
   ret
 
 actor_update_rock:
+
+  ld a, [act]
+  ld d, a
+  ld a, [who]
+  cp a, d
+  jr nz, @skip REL
+  
+  call turn_finish
+  call who_next
+
+@skip:
+
   ; load oam ptr 
   ld a, [actor_soam_ptr]
   ld h, a
@@ -63,6 +87,11 @@ actors_update:
   push de
   push bc
 
+  ; store current actor in act
+  ld a, d
+  dec a ; -1 to get 0-index counter
+  ld [act], a
+
   ld hl, actor_update_table
   ld a, [bc] 
   call call_tbl
index c4037e972a5917e6c4cbaaac4cfba3584ad9897a..e4a8119cd239ffdd389f89dc2188c9ab67f15b01 100644 (file)
@@ -155,6 +155,9 @@ who: .adv 1
   ; give control to the next actor 
 end_turn: .adv 1
 
+  ; current actor that is being updated 
+act: .adv 1
+
 #define ANIM_MOVE_TILE_SIZE 16
 #define ANIM_STEP_DOWN 1
 #define ANIM_STEP_LEFT 0xFF