use sprite constants in pretty printer

hg-commit-id: cd88256deb01
This commit is contained in:
Bryan Bishop 2012-01-05 19:51:32 -06:00
parent 1cd1d213d5
commit 813959be7f
2 changed files with 33 additions and 31 deletions

View file

@ -4,6 +4,7 @@
#purpose: dump asm for each map header #purpose: dump asm for each map header
import json import json
import extract_maps import extract_maps
import sprite_helper
import random import random
import string import string
@ -415,6 +416,12 @@ def make_object_label_name(name):
name = map_name_cleaner(name, None) name = map_name_cleaner(name, None)
return name.replace("_h", "") + "Object" return name.replace("_h", "") + "Object"
def make_text_label(map_name, id):
"""using standard object labels
for instance, PalletTownText3"""
label = map_name_cleaner(map_name, None)[:-2] + "Text" + str(id)
return label
def object_data_pretty_printer(map_id): def object_data_pretty_printer(map_id):
map = extract_maps.map_headers[map_id] map = extract_maps.map_headers[map_id]
output = "" output = ""
@ -451,7 +458,7 @@ def object_data_pretty_printer(map_id):
x = sign["x"] x = sign["x"]
text_id = sign["text_id"] text_id = sign["text_id"]
output += spacing + "db $" + hex(int(y))[2:] + ", $" + hex(int(x))[2:] + ", $" + hex(int(text_id))[2:] + "\n" output += spacing + "db $" + hex(int(y))[2:] + ", $" + hex(int(x))[2:] + ", $" + hex(int(text_id))[2:] + " ; " + make_text_label(map["name"], text_id) + "\n"
output += "\n" output += "\n"
output += spacing + "db $" + hex(int(object["number_of_things"]))[2:] + " ; people\n" output += spacing + "db $" + hex(int(object["number_of_things"]))[2:] + " ; people\n"
@ -475,13 +482,12 @@ def object_data_pretty_printer(map_id):
movement2 = hex(int(thing["movement2"]))[2:] movement2 = hex(int(thing["movement2"]))[2:]
text_id = hex(int(thing["original_text_string_number"]))[2:] text_id = hex(int(thing["original_text_string_number"]))[2:]
output += spacing + "db $" + picture_number + ", $" + y + " + 4, $" + x + " + 4, $" + movement1 + ", $" + movement2 + ", $" + text_id + ending output += spacing + "db " + sprite_helper.sprites[thing["picture_number"]] + ", $" + y + " + 4, $" + x + " + 4, $" + movement1 + ", $" + movement2 + ", $" + text_id + ending
output += "\n" output += "\n"
if object["number_of_warps"] > 0: if object["number_of_warps"] > 0:
output += spacing + "; warp-to\n" output += spacing + "; warp-to\n"
output += "\n"
for warp_to_id in object["warp_tos"]: for warp_to_id in object["warp_tos"]:
warp_to = object["warp_tos"][warp_to_id] warp_to = object["warp_tos"][warp_to_id]
@ -489,11 +495,13 @@ def object_data_pretty_printer(map_id):
warp_to_y = hex(int(warp_to["y"]))[2:] warp_to_y = hex(int(warp_to["y"]))[2:]
warp_to_x = hex(int(warp_to["x"]))[2:] warp_to_x = hex(int(warp_to["x"]))[2:]
output += spacing + "EVENT_DISP $" + map_width[2:] + ", $" + warp_to_y + ", $" + warp_to_x + "\n" previous_location = map_constants[object["warps"][warp_to_id]["warp_to_map_id"]]
comment = previous_location
output += spacing + "EVENT_DISP $" + map_width[2:] + ", $" + warp_to_y + ", $" + warp_to_x + " ; " + comment + "\n"
#output += spacing + "dw $" + hex(int(warp_to["event_displacement"][1]))[2:] + hex(int(warp_to["event_displacement"][0]))[2:] + "\n" #output += spacing + "dw $" + hex(int(warp_to["event_displacement"][1]))[2:] + hex(int(warp_to["event_displacement"][0]))[2:] + "\n"
#output += spacing + "db $" + hex(int(warp_to["y"]))[2:] + ", $" + hex(int(warp_to["x"]))[2:] + "\n" #output += spacing + "db $" + hex(int(warp_to["y"]))[2:] + ", $" + hex(int(warp_to["x"]))[2:] + "\n"
#output += "\n"
output += "\n"
output += "\n" output += "\n"

View file

@ -4986,35 +4986,29 @@ PalletTown_h:
dw PalletTownObject dw PalletTownObject
PalletTownObject: ; 182C3 0x182c3 PalletTownObject: ; 0x182c3 (size=58)
db $0B ; border tile db $b ; border tile
db 3 ; warps db $3 ; warps
db 5,5,0,$25 ; Reds house 1F db $5, $5, $0, REDS_HOUSE_1F
db 5,$D,0,$27 ; Blues house db $5, $d, $0, BLUES_HOUSE
db $B,$C,1,$28 ; Oaks Lab db $b, $c, $1, OAKS_LAB
db 4 ; signs db $4 ; signs
db $D,$D,4 ; sign by lab db $d, $d, $4 ; PalletTownText4
db 9,7,5 ; Pallet Town sign db $9, $7, $5 ; PalletTownText5
db 5,3,6 ; sign by Reds house db $5, $3, $6 ; PalletTownText6
db 5,$B,7 ; sign by Blues house db $5, $b, $7 ; PalletTownText7
db 3 ; people db $3 ; people
db SPRITE_OAK,5+4,8+4,$FF,$FF,1 ; Oak db SPRITE_OAK, $5 + 4, $8 + 4, $ff, $ff, $1 ; person
db SPRITE_GIRL,8+4,3+4,$FE,0,2 ; girl db SPRITE_GIRL, $8 + 4, $3 + 4, $fe, $0, $2 ; person
db SPRITE_FAT_MAN,$E+4,$B+4,$FE,0,3 ; fat man db SPRITE_FAT_MAN, $e + 4, $b + 4, $fe, $0, $3 ; person
; warpto ; warp-to
EVENT_DISP $a, $5, $5 ; from REDS_HOUSE_1F
dw $C71B EVENT_DISP $a, $5, $d ; from BLUES_HOUSE
db 5,5 EVENT_DISP $a, $b, $c ; from OAKS_LAB
dw $C71F
db 5,$D
dw $C74F
db $B,$C
PalletTownBlocks: ; 0x182fd PalletTownBlocks: ; 0x182fd
INCBIN "maps/pallettown.blk" INCBIN "maps/pallettown.blk"