From: Lukas Krickl Date: Tue, 24 Dec 2024 11:29:42 +0000 (+0100) Subject: Added new test room. X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=76b0110e0b19dc064c8d1001af6007f4ae5d13f7;p=gbrg%2F.git Added new test room. 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. --- diff --git a/makefile b/makefile index e7df063..8c1def6 100644 --- 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 index 0000000..6adb9de --- /dev/null +++ b/maps/base_room2.s @@ -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 diff --git a/src/map.s b/src/map.s index fccc323..9de9f4d 100644 --- 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