Actors from the map table are now positions correctly
authorLukas Krickl <lukas@krickl.dev>
Fri, 25 Oct 2024 17:29:49 +0000 (19:29 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 25 Oct 2024 17:29:49 +0000 (19:29 +0200)
src/actor.s

index 761ba7c07f22b1ed7459a015aab837c87d25e3dd..a78be76e5ff471786293177bdff62865fac43fc5 100644 (file)
@@ -1,7 +1,7 @@
 
 ; function ptrs for each actor type 
 ; inputs:
-;   de: actor ptr
+;   bc: actor ptr
 ; actor_soam_ptr: next soam item 
 actor_update_table:
   dw actor_update_null
@@ -16,10 +16,15 @@ actor_update_dust:
   ld h, a
   ld a, [actor_soam_ptr+1]
   ld l, a
+  
+  inc bc ; bc = actor_y 
 
-  ld a, 20
-  ld [hl+], a
-  ld [hl+], a
+  ld a, [bc] ; a = y
+  ld [hl+], a ; set y
+  inc bc
+
+  ld a, [bc] ; a = x
+  ld [hl+], a ; set x
 
   ld a, PLAYER_TILE_IDLE1
   ld [hl+], a
@@ -46,24 +51,24 @@ actors_update:
   ldhi a, shadow_oam
   ld [actor_soam_ptr], a
 
-  ld b, ACTORS_MAX ; loop counter
-  ld de, actor_table 
+  ld d, ACTORS_MAX ; loop counter
+  ld bc, actor_table 
 @loop: 
 
   push de
   push bc
 
   ld hl, actor_update_table
-  ld a, [de
+  ld a, [bc
   call call_tbl
 
   pop bc
   pop de
 @skip:
   ; inc de sizeof(actor) times 
-.rep i, actor_size, 1, inc de
-  dec b
-  ld a, b
+.rep i, actor_size, 1, inc bc 
+  dec d
+  ld a, d
   cp a, 0
   jr nz, @loop REL