From f7154ae25f203f60d0adf3254f86fa7c15d0c7de Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 23 Dec 2024 14:46:51 +0100 Subject: [PATCH] WIP: room loader --- src/map.s | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/map.s b/src/map.s index acd54c1..fa030de 100644 --- a/src/map.s +++ b/src/map.s @@ -110,6 +110,32 @@ room_goto_player_pos: ; curr_room_exits: ptr to exits table ; a: direction EAST, WEST, NORTH, SOUTH, EXIT_SPECIAL room_goto: + + ; TODO: save current tables back + ; TODO: weird oob reads when calling room_load_from + + ld hl, curr_room_exits ; ptr to exit table + ld a, [hl+] + ld c, a + ld a, [hl] + ld b, a ; bc = exit table + + ld h, 0 + ld l, a + add hl, bc ; hl = exit table + exit direction + + ; load room ptr into de + ld a, [hl+] + ld d, a + ld a, [hl] + ld e, a + + call room_load_from + + ; its player's turn again + ld a, WHO_PLAYER + ld [who], a + ret ; loads actors from -- 2.30.2