From 166859256c337388c1642eafc8a33f7573c10544 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 25 Oct 2024 11:45:46 +0200 Subject: [PATCH] Updated room script to also output a room struct --- maps/base_room.s | 4 ++++ src/map.s | 2 +- src/video.s | 2 +- src/wram.s | 4 +++- tools/tms2map.py | 8 ++++++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/maps/base_room.s b/maps/base_room.s index 48028fd..35b5d66 100644 --- a/maps/base_room.s +++ b/maps/base_room.s @@ -1,3 +1,7 @@ + ; struct for base_room +dw base_room_bg +dw base_room_flags +dw base_room_actors base_room_actors: .db 8 .db 1 , 67 , 54 , 0 diff --git a/src/map.s b/src/map.s index 7983dca..ae9cd8a 100644 --- a/src/map.s +++ b/src/map.s @@ -30,7 +30,7 @@ ; inputs: ; curr_room: ptr to current room ; curr_room_init_act: ptr to initial actors to be loaded -map_load: +room_load_from: call room_draw call room_load_actors ret diff --git a/src/video.s b/src/video.s index 9cbdffb..40fe54f 100644 --- a/src/video.s +++ b/src/video.s @@ -98,7 +98,7 @@ video_init: ldhi a, base_room_actors ld [curr_room_init_act+1], a - call map_load + call room_load_from ; set up bgp ld a, BGP diff --git a/src/wram.s b/src/wram.s index b8d46f2..9451b3b 100644 --- a/src/wram.s +++ b/src/wram.s @@ -78,7 +78,9 @@ damage_anim: .adv 1 ; struct room .se 0 -.de tiles, ROOM_W * ROOM_H +.de room_tiles, 2 ; ptr to tiles +.de room_flags, 2 ; ptr to flags +.de room_actor_table, 2 ; actor table ot be used .de room_size, 0 ; room flags diff --git a/tools/tms2map.py b/tools/tms2map.py index a54a63d..46a862d 100755 --- a/tools/tms2map.py +++ b/tools/tms2map.py @@ -33,10 +33,18 @@ def print_data(data, name, layer): def print_actor(atype, y, x, flags): print(".db ", int(atype), ",", int(float(y)), ",", int(float(x)), ",", int(flags)) +def print_struct(name): + print(" ; struct for ", name) + print("dw " + name + '_bg') + print("dw " + name + '_flags') + print("dw " + name + '_actors') def convert(src, name): tree = ET.parse(src) root = tree.getroot() + + print_struct(name) + for child in root: if child.tag == "layer": for data in child: -- 2.30.2