Added new test room.
authorLukas Krickl <lukas@krickl.dev>
Tue, 24 Dec 2024 11:29:42 +0000 (12:29 +0100)
committerLukas Krickl <lukas@krickl.dev>
Tue, 24 Dec 2024 11:29:42 +0000 (12:29 +0100)
Also fixed a bug that caused the A value to be destroyed
in room_goto. This caused it to always use the special exit value.

makefile
maps/base_room2.s [new file with mode: 0644]
src/map.s

index e7df063b24b5876097cebcff80072462e15fcce3..8c1def6ade6babaaddbb6e094fadc558beaaf309 100644 (file)
--- a/makefile
+++ b/makefile
@@ -16,3 +16,4 @@ tiles:
 .PHONY: maps
 maps:
        ./tools/tms2map.py assets/maps/base.tmx base_room > maps/base_room.s
+       ./tools/tms2map.py assets/maps/base2.tmx base_room2 > maps/base_room2.s
diff --git a/maps/base_room2.s b/maps/base_room2.s
new file mode 100644 (file)
index 0000000..6adb9de
--- /dev/null
@@ -0,0 +1,14 @@
+ ; struct for  base_room2
+base_room2_struct:
+dw base_room2_bg
+dw base_room2_flags
+dw base_room2_actors
+dw room_empty_exits
+base_room2_actors:
+.db  8
+.db  1 , 64 , 72 , 0
+.db  1 , 48 , 56 , 0
+base_room2_bg:
+.db 0x60, 0x62, 0x62, 0x64, 0x40, 0x40, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x40, 0x40, 0x60, 0x68, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6c, 0x6e, 0x40, 0x40, 0x40, 0x40, 0x48, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x40, 0x40, 0x44, 0x4a, 0x4a, 0x6e
+base_room2_flags:
+.db 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1
index fccc323a975554cbfdc7e07a362602c4e30cee9b..9de9f4ddc3990cf1f372e0af28a261025978e864 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -155,18 +155,25 @@ room_goto_player_pos:
   ;   curr_room_exits: ptr to exits table
   ;   a: direction EAST, WEST, NORTH, SOUTH, EXIT_SPECIAL
 room_goto:
+  ; save a for later
+  push af
 
   ; TODO: save current tables back 
   call disableinterrutpts
   call vblank_wait
   ;call lcd_off
 
+
   ld hl, curr_room_exits ; ptr to exit table 
   ld a, [hl+]
   ld c, a
   ld a, [hl]
   ld b, a ; bc = exit table 
   
+  pop af ; get back a
+  ; a  * 2
+  add a, a
+
   ld h, 0
   ld l, a 
   add hl, bc ; hl = exit table + exit direction
@@ -447,11 +454,12 @@ room_get_flag_masked:
   ; this can be copied and modified 
   ; by the map gen
 #include "./maps/base_room.s"
+#include "./maps/base_room2.s"
 
   ; exit table for empty exits 
 room_empty_exits:
+dw base_room2_struct 
 dw base_room_struct 
-dw base_room_struct 
-dw base_room_struct 
+dw base_room2_struct 
 dw base_room_struct 
 dw base_room_struct