From: Lukas Krickl Date: Fri, 20 Dec 2024 18:32:27 +0000 (+0100) Subject: WIP: room transition loader X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=1527ae8808e608df86c856fe3b4257e58a097564;p=gbrg%2F.git WIP: room transition loader --- 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