From 1527ae8808e608df86c856fe3b4257e58a097564 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 20 Dec 2024 19:32:27 +0100 Subject: [PATCH] WIP: room transition loader --- src/map.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/map.s b/src/map.s index d394fa4..3c2efb2 100644 --- a/src/map.s +++ b/src/map.s @@ -49,11 +49,29 @@ room_load_from: call room_load_actors ret + ; define positions that the player must have + ; to be considered inside a tile +#define EXPECTED_POS_NORTH_X 0 +#define EXPECTED_POS_NORTH_Y 0 + ; calls rom goto based on player position + ; defaults to exit special if no position is found for + ; a valid exit ; inputs: ; curr_room_exits: ptr to exits table ; player_x/y: player position room_goto_player_pos: + ld a, [player_y] + ld d, a ; d = player y + div16 d ; d = player y tile + + ld a, [player_x] + ld e, a ; d = player x + div16 e ; d = player x tile + + ; compare to expected positions to decide what to do + + ; default use special exit ld a, EXIT_SPECIAL ; transitions to a new room -- 2.30.2