From: Lukas Krickl Date: Sun, 15 Dec 2024 10:00:21 +0000 (+0100) Subject: Removed test room loader code and replaced it with an actual memcpy call X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=b2fb23f2577e2c26eb2021ef1e63df0348a9db7f;p=gbrg%2F.git Removed test room loader code and replaced it with an actual memcpy call The test loader for a hard coded room was still present in video init. This lead to an incorrect assumption being made in the map converter. Rooms are now loaded directly from the actual base struct. The base struct now also always points to an empty room exit table. --- diff --git a/maps/base_room.s b/maps/base_room.s index a94d4c8..56d3466 100644 --- a/maps/base_room.s +++ b/maps/base_room.s @@ -1,8 +1,9 @@ ; struct for base_room base_room_struct: -dwb base_room_bg -dwb base_room_flags -dwb base_room_actors +dw base_room_bg +dw base_room_flags +dw base_room_actors +dw room_empty_exits base_room_actors: .db 8 .db 1 , 64 , 72 , 0 diff --git a/src/map.s b/src/map.s index 3e95fa0..675cfbd 100644 --- a/src/map.s +++ b/src/map.s @@ -43,11 +43,20 @@ room_load_from: ; and then load the room ld hl, curr_room_struct ld bc, room_size + call memcpy call room_draw call room_load_actors ret + ; sets the current room + ; inputs: + ; de: ptr to room struct + ; sets curr_room entries + ; as expected by room loader +room_set_curr: + ret + ; loads actors from ; [curr_room_init_act] ; into the active actor table @@ -295,3 +304,10 @@ room_get_flag_masked: ; this can be copied and modified ; by the map gen #include "./maps/base_room.s" + + ; exit table for empty exits +room_empty_exits: +.db 0x00, 0x00 +.db 0x00, 0x00 +.db 0x00, 0x00 +.db 0x00, 0x00 diff --git a/src/video.s b/src/video.s index 60d9786..035ce8c 100644 --- a/src/video.s +++ b/src/video.s @@ -83,21 +83,6 @@ video_init: ; initial test map - ldlo a, base_room_bg - ld [curr_room], a - ldhi a, base_room_bg - ld [curr_room+1], a - - ldlo a, base_room_flags - ld [curr_room_flags], a - ldhi a, base_room_flags - ld [curr_room_flags+1], a - - ldlo a, base_room_actors - ld [curr_room_init_act], a - ldhi a, base_room_actors - ld [curr_room_init_act+1], a - ld de, base_room_struct call room_load_from diff --git a/tools/tms2map.py b/tools/tms2map.py index 50e9177..f60d9fb 100755 --- a/tools/tms2map.py +++ b/tools/tms2map.py @@ -43,9 +43,10 @@ def print_actor(atype, y, x, flags): def print_struct(name): print(" ; struct for ", name) print(name + "_struct:") - print("dwb " + name + '_bg') - print("dwb " + name + '_flags') - print("dwb " + name + '_actors') + print("dw " + name + '_bg') + print("dw " + name + '_flags') + print("dw " + name + '_actors') + print("dw room_empty_exits") def convert(src, name): tree = ET.parse(src)