- When rooms are linked it is possible to overwrite exits
- anim_move does not actually move the way it was intended. anim_move should have another parameter that allows configuration of the loop step. Currently this is only a `dec operation`.
-- Actor positions are off and are fixed implicitly by obj arrangement code. This makes it so player collision code will not work for actors even though it should.
dw base_room_actors
dw room_empty_exits
base_room_actors:
-.db 1 , 96 , 104 , 0
-.db 1 , 48 , 56 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
+.db 1 , 0x50 , 0x60 , 0
+.db 1 , 0x10 , 0x10 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
base_room_bg:
.db 0x60, 0x62, 0x62, 0x64, 0x62, 0x62, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0xe0, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x48, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x4a, 0x4a, 0x44, 0x4a, 0x4a, 0x6e
base_room_flags:
dw base_room2_actors
dw room_empty_exits
base_room2_actors:
-.db 1 , 64 , 72 , 0
-.db 1 , 48 , 56 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
+.db 1 , 0x30 , 0x40 , 0
+.db 1 , 0x20 , 0x30 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
base_room2_bg:
.db 0x60, 0x62, 0x62, 0x64, 0x62, 0x62, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x82, 0x40, 0x40, 0x82, 0x40, 0x40, 0x6a, 0x46, 0x82, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x82, 0xe0, 0x4c, 0x40, 0x40, 0x82, 0xe8, 0xe8, 0x82, 0x40, 0x40, 0x6a, 0x4c, 0x40, 0x40, 0x82, 0xe8, 0xe8, 0x82, 0x40, 0x40, 0x6a, 0x48, 0x82, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x82, 0xe2, 0x4c, 0x40, 0x40, 0x82, 0x40, 0x40, 0x82, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x4a, 0x4a, 0x44, 0x4a, 0x4a, 0x6e
base_room2_flags:
dw base_room3_actors
dw room_empty_exits
base_room3_actors:
-.db 1 , 112 , 136 , 0
-.db 1 , 48 , 40 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
+.db 1 , 0x60 , 0x80 , 0
+.db 1 , 0x10 , 0x10 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
base_room3_bg:
.db 0x60, 0x62, 0x62, 0x64, 0x62, 0x62, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x40, 0x40, 0x82, 0x82, 0x40, 0x40, 0x40, 0xe0, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x48, 0x40, 0x40, 0x40, 0x82, 0x82, 0x40, 0x40, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x4a, 0x4a, 0x44, 0x4a, 0x4a, 0x6e
base_room3_flags:
dw base_room4_actors
dw room_empty_exits
base_room4_actors:
-.db 1 , 112 , 136 , 0
-.db 1 , 48 , 24 , 0
-.db 1 , 48 , 136 , 0
-.db 1 , 112 , 40 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
-.db 0 , 16 , 8 , 0
+.db 1 , 0x60 , 0x80 , 0
+.db 1 , 0x10 , 0x10 , 0
+.db 1 , 0x10 , 0x80 , 0
+.db 1 , 0x60 , 0x10 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
+.db 0 , 0x0 , 0x0 , 0
base_room4_bg:
.db 0x60, 0x62, 0x62, 0x64, 0x62, 0x62, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x40, 0x82, 0x82, 0x82, 0x82, 0x40, 0x40, 0xe0, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x4c, 0x40, 0x82, 0x40, 0x40, 0x40, 0x40, 0x82, 0x40, 0x6a, 0x48, 0x40, 0x40, 0x40, 0x82, 0x82, 0x40, 0x40, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x4a, 0x4a, 0x44, 0x4a, 0x4a, 0x6e
base_room4_flags:
; tile 1
ld a, [bc] ; a = y
+ add a, OBJ_OFF_Y
ld [hl+], a ; set y
inc bc ; bc = actor_x
ld a, [bc] ; a = x
+ add a, OBJ_OFF_X
ld [hl+], a ; set x
ld a, [tmp]
; tile 2
dec bc ; bc = actor_y
ld a, [bc]
+ add a, OBJ_OFF_Y
ld [hl+], a ; set y
inc bc ; bc = actor_x
ld a, [bc]
+ add a, OBJ_OFF_X
add a, 8
ld [hl+], a ; set x
import xml.etree.ElementTree as ET
TILE_SIZE = 16
-ACTOR_OFFSET_X = 8
-ACTOR_OFFSET_Y = 16
+ACTOR_OFFSET_X = 0
+ACTOR_OFFSET_Y = 0
if len(sys.argv) < 3:
print("Usage: tmx2map.py <source> <map name>")
print(hex(val), end=end)
def actor_round(n, base=TILE_SIZE):
- return base * round(n/base)
+ return (round(n)) & 0xF0
def print_actor(atype, y, x, flags):
- print(".db ", int(atype), ",", int(actor_round(float(y))) + ACTOR_OFFSET_Y, ",", int(actor_round(float(x))) + ACTOR_OFFSET_X, ",", int(flags))
+ print(".db ", int(atype), ",", hex(int(actor_round(float(y))) + ACTOR_OFFSET_Y), ",", hex(int(actor_round(float(x))) + ACTOR_OFFSET_X), ",", int(flags))
def print_struct(name):
print(" ; struct for ", name)