WIP: room transition loader
authorLukas Krickl <lukas@krickl.dev>
Fri, 20 Dec 2024 18:32:27 +0000 (19:32 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 20 Dec 2024 18:32:27 +0000 (19:32 +0100)
src/map.s

index d394fa41be7a8dc1a8ef3cf12e41349a293529de..3c2efb27de83020d56eae9ee4eb009da3252e178 100644 (file)
--- 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