update last_address in MapScriptHeader to get asm output working again

This commit is contained in:
Bryan Bishop 2012-04-25 18:51:54 -05:00
parent 9a3733e8d1
commit f61e028871

View File

@ -3388,7 +3388,8 @@ class MapScriptHeader:
for (index, trigger_bytes) in enumerate(groups): for (index, trigger_bytes) in enumerate(groups):
print "parsing a map trigger script at "+hex(current_address)+" map_group="+str(map_group)+" map_id="+str(map_id) print "parsing a map trigger script at "+hex(current_address)+" map_group="+str(map_group)+" map_id="+str(map_id)
script = ScriptPointerLabelParam(address=current_address, map_group=map_group, map_id=map_id, debug=debug) script = ScriptPointerLabelParam(address=current_address, map_group=map_group, map_id=map_id, debug=debug)
self.triggers.append(script) extra_bytes = MultiByteParam(address=current_address+2, map_group=map_group, map_id=map_id, debug=debug)
self.triggers.append([script, extra_bytes])
current_address += ptr_line_size current_address += ptr_line_size
current_address = address + (self.trigger_count * ptr_line_size) + 1 current_address = address + (self.trigger_count * ptr_line_size) + 1
#[[Number2 of pointers] Number2 * [hook number][2byte pointer to script]] #[[Number2 of pointers] Number2 * [hook number][2byte pointer to script]]
@ -3408,9 +3409,10 @@ class MapScriptHeader:
return True return True
def get_dependencies(self): def get_dependencies(self):
dependencies = copy(self.triggers) dependencies = []
for p in list(dependencies): for p in list(self.triggers):
dependencies.extend(p.get_dependencies()) #dependencies.append(p[0])
dependencies.extend(p[0].get_dependencies())
for callback in self.callbacks: for callback in self.callbacks:
dependencies.append(callback["callback"]) dependencies.append(callback["callback"])
dependencies.extend(callback["callback"].get_dependencies()) dependencies.extend(callback["callback"].get_dependencies())
@ -3422,7 +3424,7 @@ class MapScriptHeader:
output += "db %d\n"%self.trigger_count output += "db %d\n"%self.trigger_count
if len(self.triggers) > 0: if len(self.triggers) > 0:
output += "\n; triggers\n" output += "\n; triggers\n"
output += "\n".join([str("dw "+p.to_asm()) for p in self.triggers]) output += "\n".join([str("dw "+p[0].to_asm()+", "+p[1].to_asm()) for p in self.triggers])
output += "\n" output += "\n"
output += "\n; callback count\n" output += "\n; callback count\n"
output += "db %d"%self.callback_count output += "db %d"%self.callback_count
@ -4211,7 +4213,7 @@ def to_asm(some_object):
if isinstance(some_object, int): if isinstance(some_object, int):
some_object = script_parse_table[some_object] some_object = script_parse_table[some_object]
#add one to the last_address to show where the next byte is in the file #add one to the last_address to show where the next byte is in the file
last_address = some_object.last_address + 1 last_address = some_object.last_address
#create a line like "label: ; 0x10101" #create a line like "label: ; 0x10101"
asm = some_object.label + ": ; " + hex(some_object.address) + "\n" asm = some_object.label + ": ; " + hex(some_object.address) + "\n"
#now add the inner/actual asm #now add the inner/actual asm