bg: made queue index 2 byte offset
authorLukas Krickl <lukas@krickl.dev>
Tue, 15 Apr 2025 03:35:16 +0000 (05:35 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 15 Apr 2025 03:35:16 +0000 (05:35 +0200)
src/update.s
src/wram.s

index 294245a5278a04e43a52db9d343b552b669af0f0..0ad16f7a332a5c8e9abf87312edc60cfc5d29c34 100644 (file)
@@ -49,14 +49,18 @@ bg_update_queue_push:
   push af
   ld hl, bg_update_queue
   ld a, [bg_update_index]
-  ld d, 0
   ld e, a
+  ld a, [bg_update_index+1]
+  ld d, a
   add hl, de ; hl = update queue + current offset 
 
-  inc a ; offset += bgu_size 
-  inc a 
-  inc a
+  inc de ; offset += bgu_size 
+  inc de 
+  inc de
+  ld a, e
   ld [bg_update_index], a
+  ld a, d
+  ld [bg_update_index+1], a
   
   ; store ptr
   ld a, c
index 60df77661bdeb6ba09d42b759bf23c4660f2320e..4376b059e89b3ce4bf69f579c6bacc8ed9a20324 100644 (file)
@@ -28,6 +28,7 @@ building_state: .adv st_size
   ; they get updated once a frame
 actor_player: .adv act_size 
 
+  ; offset into bg_update_queue 
 bg_update_index: .adv 2
 bg_update_queue: .adv bge_size * BGE_MAX