; struct for base_room
-dw base_room_bg
-dw base_room_flags
-dw base_room_actors
+base_room_struct:
+dwb base_room_bg
+dwb base_room_flags
+dwb base_room_actors
base_room_actors:
.db 8
.db 1 , 67 , 54 , 0
#macro dw
.db $1 & 0xFF
.db ($1 >> 8) & 0xFF
+#endmacro
+
+ ; same as dw but
+ ; stores in big endian
+#macro dwb
+.db ($1 >> 8) & 0xFF
+.db $1 & 0xFF
#endmacro
; loads a map
; inputs:
- ; curr_room: ptr to current room
- ; curr_room_init_act: ptr to initial actors to be loaded
+ ; de: ptr to room struct
room_load_from:
+ ; copy de to current room struct
+ ; and then load the room
+ ld hl, curr_room_struct
+ ld bc, room_size
+
call room_draw
call room_load_actors
ret
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
; set up bgp
#define ROOM_H 8
; struct room
+; FIXME: thse ptrs are currently in big endian...
.se 0
-.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_tiles, 2 ; be ptr to tiles
+.de room_flags, 2 ; be ptr to flags
+.de room_actor_table, 2 ; be ptr of actor table to be used
.de room_size, 0
; room flags
.se 1
.de RF_WALL, 1
+ ; current room struct
+ ; same layout as room struct itself
+curr_room_struct:
; pointer to current room struct
curr_room: .adv 2
; flags for current tiles
def print_struct(name):
print(" ; struct for ", name)
- print("dw " + name + '_bg')
- print("dw " + name + '_flags')
- print("dw " + name + '_actors')
+ print(name + "_struct:")
+ print("dwb " + name + '_bg')
+ print("dwb " + name + '_flags')
+ print("dwb " + name + '_actors')
def convert(src, name):
tree = ET.parse(src)