From 180f3a509cd23e6fcb14a9a279bc3e57cb5441a5 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 6 Jan 2025 08:14:10 +0100 Subject: [PATCH] map: Mapgen now loads the table entries correctly. Before this was rather broken and the fact that it did not crash was just luck. It was not reading room pointers correctly nor was the room max mask not masking correctly due to an off-by-one-error :^) --- maps/base_room4.s | 8 ++++---- src/map.s | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/maps/base_room4.s b/maps/base_room4.s index ec20fa6..0f5422a 100644 --- a/maps/base_room4.s +++ b/maps/base_room4.s @@ -9,10 +9,10 @@ base_room4_actors: .db 1 , 48 , 24 , 0 .db 1 , 48 , 136 , 0 .db 1 , 112 , 40 , 0 -.db 1 , 32 , 72 , 0 -.db 1 , 112 , 104 , 0 -.db 1 , 32 , 88 , 0 -.db 1 , 32 , 56 , 0 +.db 0 , 16 , 8 , 0 +.db 0 , 16 , 8 , 0 +.db 0 , 16 , 8 , 0 +.db 0 , 16 , 8 , 0 base_room4_bg: .db 0x60, 0x62, 0x62, 0x64, 0x62, 0x62, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x40, 0x82, 0x82, 0x82, 0x82, 0x40, 0x40, 0xe0, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x48, 0x40, 0x40, 0x40, 0x82, 0x82, 0x40, 0x40, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x4a, 0x4a, 0x44, 0x4a, 0x4a, 0x6e base_room4_flags: diff --git a/src/map.s b/src/map.s index 61df12e..9f2be4d 100644 --- a/src/map.s +++ b/src/map.s @@ -544,6 +544,7 @@ map_gen_next: ld h, a ld l, b ; hl = room table max length ld a, [hl+] ; hl = first room entry + dec a ; -1 for mask ld b, a ; b = max length of room table ; c = previous room selection @@ -562,6 +563,7 @@ map_gen_next: ; store for next iteration ld [mapgen_last_room], a + add a, a ; a * 2 for ptr offset ld b, 0 ld c, a add hl, bc ; base + random offset -- 2.30.2