shithub: pokered

Download patch

ref: 813959be7f22cd003ccf1c38037ce49f04d411ec
parent: 1cd1d213d53914cf637de5b6d585598c1254878f
author: Bryan Bishop <kanzure@gmail.com>
date: Thu Jan 5 14:51:32 EST 2012

use sprite constants in pretty printer

hg-commit-id: cd88256deb01


--- a/extras/pretty_map_headers.py
+++ b/extras/pretty_map_headers.py
@@ -4,6 +4,7 @@
 #purpose: dump asm for each map header
 import json
 import extract_maps
+import sprite_helper
 import random
 import string
 
@@ -415,6 +416,12 @@
     name = map_name_cleaner(name, None)
     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):
     map = extract_maps.map_headers[map_id]
     output = ""
@@ -451,7 +458,7 @@
         x = sign["x"]
         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 += spacing + "db $" + hex(int(object["number_of_things"]))[2:] + " ; people\n"
@@ -475,13 +482,12 @@
         movement2 = hex(int(thing["movement2"]))[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"
 
     if object["number_of_warps"] > 0:
         output += spacing + "; warp-to\n"
-        output += "\n"
 
         for warp_to_id in object["warp_tos"]:
             warp_to = object["warp_tos"][warp_to_id]
@@ -489,11 +495,13 @@
             warp_to_y = hex(int(warp_to["y"]))[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 + "db $" + hex(int(warp_to["y"]))[2:] + ", $" + hex(int(warp_to["x"]))[2:] + "\n"
-
-            output += "\n"
+            #output += "\n"
     
         output += "\n"
 
--- a/pokered.asm
+++ b/pokered.asm
@@ -4986,35 +4986,29 @@
 
 	dw PalletTownObject
 
-PalletTownObject: ; 182C3 0x182c3
-	db $0B ; border tile
+PalletTownObject: ; 0x182c3 (size=58)
+    db $b ; border tile
 
-	db 3 ; warps
-	db 5,5,0,$25 ; Red’s house 1F
-	db 5,$D,0,$27 ; Blue’s house
-	db $B,$C,1,$28 ; Oak’s Lab
+    db $3 ; warps
+    db $5, $5, $0, REDS_HOUSE_1F
+    db $5, $d, $0, BLUES_HOUSE
+    db $b, $c, $1, OAKS_LAB
 
-	db 4 ; signs
-	db $D,$D,4 ; sign by lab
-	db 9,7,5 ; Pallet Town sign
-	db 5,3,6 ; sign by Red’s house
-	db 5,$B,7 ; sign by Blue’s house
+    db $4 ; signs
+    db $d, $d, $4 ; PalletTownText4
+    db $9, $7, $5 ; PalletTownText5
+    db $5, $3, $6 ; PalletTownText6
+    db $5, $b, $7 ; PalletTownText7
 
-	db 3 ; people
-	db SPRITE_OAK,5+4,8+4,$FF,$FF,1 ; Oak
-	db SPRITE_GIRL,8+4,3+4,$FE,0,2 ; girl
-	db SPRITE_FAT_MAN,$E+4,$B+4,$FE,0,3 ; fat man
+    db $3 ; people
+    db SPRITE_OAK, $5 + 4, $8 + 4, $ff, $ff, $1 ; person
+    db SPRITE_GIRL, $8 + 4, $3 + 4, $fe, $0, $2 ; person
+    db SPRITE_FAT_MAN, $e + 4, $b + 4, $fe, $0, $3 ; person
 
-	; warp‐to
-
-	dw $C71B
-	db 5,5
-
-	dw $C71F
-	db 5,$D
-
-	dw $C74F
-	db $B,$C
+    ; warp-to
+    EVENT_DISP $a, $5, $5 ; from REDS_HOUSE_1F
+    EVENT_DISP $a, $5, $d ; from BLUES_HOUSE
+    EVENT_DISP $a, $b, $c ; from OAKS_LAB
 
 PalletTownBlocks: ; 0x182fd
 	INCBIN "maps/pallettown.blk"