From 58f19904158c02c55b6b264a1bc76ac6467d1e18 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 14 Dec 2020 00:46:55 -0500 Subject: added move_player macro and updated script extractor --- src/engine/bank03.asm | 4 +- src/macros/scripts.asm | 223 +++++++++++++++++++------------------- tools/script_extractor.py | 268 ++++++++++++++++++++++++++-------------------- 3 files changed, 265 insertions(+), 230 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 58367e2..c3b7a50 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3234,9 +3234,7 @@ Script_DrMason: ; d727 (3:5727) Script_EnterLabFirstTime: ; d753 (3:5753) start_script - run_command ScriptCommand_MovePlayer - db NORTH - db $02 + move_player NORTH, 2 run_command ScriptCommand_MovePlayer db NORTH db $02 diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index ed7b30d..19694e8 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -4,117 +4,116 @@ run_command: MACRO db \1_index ENDM -; TODO: create macros for overworld scripts after their usage and arguments are figured out. -; For example (current ScriptCommand_GiveBoosterPacks_index): - -; const SCRIPT_GIVE_BOOSTER_PACKS ; $0c -;give_booster_packs: MACRO -; db SCRIPT_GIVE_BOOSTER_PACKS -; db \1, \2, \3 -;ENDM - const_def - const ScriptCommand_EndScriptLoop1_index ; $00 - const ScriptCommand_CloseAdvancedTextBox_index ; $01 - const ScriptCommand_PrintTextString_index ; $02 - const Func_ccdc_index ; $03 - const ScriptCommand_AskQuestionJump_index ; $04 - const ScriptCommand_StartBattle_index ; $05 - const ScriptCommand_PrintVariableText_index ; $06 - const Func_cda8_index ; $07 - const ScriptCommand_PrintTextQuitFully_index ; $08 - const Func_cdcb_index ; $09 - const ScriptCommand_MoveActiveNPCByDirection_index ; $0a - const ScriptCommand_CloseTextBox_index ; $0b - const ScriptCommand_GiveBoosterPacks_index ; $0c - const ScriptCommand_CheckIfCardInCollectionOrDecks_index ; $0d - const ScriptCommand_CheckIfCardInCollection_index ; $0e - const ScriptCommand_GiveCard_index ; $0f - const ScriptCommand_TakeCard_index ; $10 - const Func_cf53_index ; $11 - const Func_cf7b_index ; $12 - const ScriptCommand_CheckRawAmountOfCardsOwned_index ; $13 - const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 - const Func_cfc6_index ; $15 - const Func_cfd4_index ; $16 - const Func_d00b_index ; $17 - const Func_d025_index ; $18 - const Func_d032_index ; $19 - const Func_d03f_index ; $1a - const ScriptCommand_Jump_index ; $1b - const ScriptCommand_TryGiveMedalPCPacks_index ; $1c - const ScriptCommand_SetPlayerDirection_index ; $1d - const ScriptCommand_MovePlayer_index ; $1e - const ScriptCommand_ShowCardReceivedScreen_index ; $1f - const ScriptCommand_SetDialogName_index ; $20 - const ScriptCommand_SetNextNPCandScript_index ; $21 - const Func_d095_index ; $22 - const Func_d0be_index ; $23 - const ScriptCommand_DoFrames_index ; $24 - const Func_d0d9_index ; $25 - const ScriptCommand_JumpIfPlayerCoordMatches_index ; $26 - const ScriptCommand_MoveActiveNPC_index ; $27 - const ScriptCommand_GiveOneOfEachTrainerBooster_index ; $28 - const Func_d103_index ; $29 - const Func_d125_index ; $2a - const Func_d135_index ; $2b - const Func_d16b_index ; $2c - const Func_cd4f_index ; $2d - const Func_cd94_index ; $2e - const ScriptCommand_MoveWramNPC_index ; $2f - const Func_cdd8_index ; $30 - const Func_cdf5_index ; $31 - const Func_d195_index ; $32 - const Func_d1ad_index ; $33 - const Func_d1b3_index ; $34 - const ScriptCommand_QuitScriptFully_index ; $35 - const Func_d244_index ; $36 - const Func_d24c_index ; $37 - const ScriptCommand_OpenDeckMachine_index ; $38 - const Func_d271_index ; $39 - const ScriptCommand_EnterMap_index ; $3a + const ScriptCommand_EndScriptLoop1_index ; $00 + const ScriptCommand_CloseAdvancedTextBox_index ; $01 + const ScriptCommand_PrintTextString_index ; $02 + const Func_ccdc_index ; $03 + const ScriptCommand_AskQuestionJump_index ; $04 + const ScriptCommand_StartBattle_index ; $05 + const ScriptCommand_PrintVariableText_index ; $06 + const Func_cda8_index ; $07 + const ScriptCommand_PrintTextQuitFully_index ; $08 + const Func_cdcb_index ; $09 + const ScriptCommand_MoveActiveNPCByDirection_index ; $0a + const ScriptCommand_CloseTextBox_index ; $0b + const ScriptCommand_GiveBoosterPacks_index ; $0c + const ScriptCommand_CheckIfCardInCollectionOrDecks_index ; $0d + const ScriptCommand_CheckIfCardInCollection_index ; $0e + const ScriptCommand_GiveCard_index ; $0f + const ScriptCommand_TakeCard_index ; $10 + const Func_cf53_index ; $11 + const Func_cf7b_index ; $12 + const ScriptCommand_CheckRawAmountOfCardsOwned_index ; $13 + const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 + const Func_cfc6_index ; $15 + const Func_cfd4_index ; $16 + const Func_d00b_index ; $17 + const Func_d025_index ; $18 + const Func_d032_index ; $19 + const Func_d03f_index ; $1a + const ScriptCommand_Jump_index ; $1b + const ScriptCommand_TryGiveMedalPCPacks_index ; $1c + const ScriptCommand_SetPlayerDirection_index ; $1d + const ScriptCommand_MovePlayer_index ; $1e + const ScriptCommand_ShowCardReceivedScreen_index ; $1f + const ScriptCommand_SetDialogName_index ; $20 + const ScriptCommand_SetNextNPCandScript_index ; $21 + const Func_d095_index ; $22 + const Func_d0be_index ; $23 + const ScriptCommand_DoFrames_index ; $24 + const Func_d0d9_index ; $25 + const ScriptCommand_JumpIfPlayerCoordMatches_index ; $26 + const ScriptCommand_MoveActiveNPC_index ; $27 + const ScriptCommand_GiveOneOfEachTrainerBooster_index ; $28 + const Func_d103_index ; $29 + const Func_d125_index ; $2a + const Func_d135_index ; $2b + const Func_d16b_index ; $2c + const Func_cd4f_index ; $2d + const Func_cd94_index ; $2e + const ScriptCommand_MoveWramNPC_index ; $2f + const Func_cdd8_index ; $30 + const Func_cdf5_index ; $31 + const Func_d195_index ; $32 + const Func_d1ad_index ; $33 + const Func_d1b3_index ; $34 + const ScriptCommand_QuitScriptFully_index ; $35 + const Func_d244_index ; $36 + const Func_d24c_index ; $37 + const ScriptCommand_OpenDeckMachine_index ; $38 + const Func_d271_index ; $39 + const ScriptCommand_EnterMap_index ; $3a const ScriptCommand_MoveArbitraryNPC_index ; $3b - const Func_d209_index ; $3c - const Func_d38f_index ; $3d - const Func_d396_index ; $3e - const Func_cd76_index ; $3f - const Func_d39d_index ; $40 - const Func_d3b9_index ; $41 - const ScriptCommand_TryGivePCPack_index ; $42 - const ScriptCommand_nop_index ; $43 - const Func_d3d4_index ; $44 - const Func_d3e0_index ; $45 - const Func_d3fe_index ; $46 - const Func_d408_index ; $47 - const Func_d40f_index ; $48 - const ScriptCommand_PlaySFX_index ; $49 - const ScriptCommand_PauseSong_index ; $4a - const ScriptCommand_ResumeSong_index ; $4b - const Func_d41d_index ; $4c - const ScriptCommand_WaitForSongToFinish_index ; $4d - const Func_d435_index ; $4e - const ScriptCommand_AskQuestionJumpDefaultYes_index ; $4f - const Func_d2f6_index ; $50 - const Func_d317_index ; $51 - const Func_d43d_index ; $52 - const ScriptCommand_EndScriptLoop2_index ; $53 - const ScriptCommand_EndScriptLoop3_index ; $54 - const ScriptCommand_EndScriptLoop4_index ; $55 - const ScriptCommand_EndScriptLoop5_index ; $56 - const ScriptCommand_EndScriptLoop6_index ; $57 - const ScriptCommand_SetFlagValue_index ; $58 - const ScriptCommand_JumpIfFlagZero1_index ; $59 - const ScriptCommand_JumpIfFlagNonzero1_index ; $5a - const ScriptCommand_JumpIfFlagEqual_index ; $5b - const ScriptCommand_JumpIfFlagNotEqual_index ; $5c - const ScriptCommand_JumpIfFlagNotLessThan_index ; $5d - const ScriptCommand_JumpIfFlagLessThan_index ; $5e - const ScriptCommand_MaxOutFlagValue_index ; $5f - const ScriptCommand_ZeroOutFlagValue_index ; $60 - const ScriptCommand_JumpIfFlagNonzero2_index ; $61 - const ScriptCommand_JumpIfFlagZero2_index ; $62 - const ScriptCommand_IncrementFlagValue_index ; $63 - const ScriptCommand_EndScriptLoop7_index ; $64 - const ScriptCommand_EndScriptLoop8_index ; $65 - const ScriptCommand_EndScriptLoop9_index ; $66 - const ScriptCommand_EndScriptLoop10_index ; $67 + const Func_d209_index ; $3c + const Func_d38f_index ; $3d + const Func_d396_index ; $3e + const Func_cd76_index ; $3f + const Func_d39d_index ; $40 + const Func_d3b9_index ; $41 + const ScriptCommand_TryGivePCPack_index ; $42 + const ScriptCommand_nop_index ; $43 + const Func_d3d4_index ; $44 + const Func_d3e0_index ; $45 + const Func_d3fe_index ; $46 + const Func_d408_index ; $47 + const Func_d40f_index ; $48 + const ScriptCommand_PlaySFX_index ; $49 + const ScriptCommand_PauseSong_index ; $4a + const ScriptCommand_ResumeSong_index ; $4b + const Func_d41d_index ; $4c + const ScriptCommand_WaitForSongToFinish_index ; $4d + const Func_d435_index ; $4e + const ScriptCommand_AskQuestionJumpDefaultYes_index ; $4f + const Func_d2f6_index ; $50 + const Func_d317_index ; $51 + const Func_d43d_index ; $52 + const ScriptCommand_EndScriptLoop2_index ; $53 + const ScriptCommand_EndScriptLoop3_index ; $54 + const ScriptCommand_EndScriptLoop4_index ; $55 + const ScriptCommand_EndScriptLoop5_index ; $56 + const ScriptCommand_EndScriptLoop6_index ; $57 + const ScriptCommand_SetFlagValue_index ; $58 + const ScriptCommand_JumpIfFlagZero1_index ; $59 + const ScriptCommand_JumpIfFlagNonzero1_index ; $5a + const ScriptCommand_JumpIfFlagEqual_index ; $5b + const ScriptCommand_JumpIfFlagNotEqual_index ; $5c + const ScriptCommand_JumpIfFlagNotLessThan_index ; $5d + const ScriptCommand_JumpIfFlagLessThan_index ; $5e + const ScriptCommand_MaxOutFlagValue_index ; $5f + const ScriptCommand_ZeroOutFlagValue_index ; $60 + const ScriptCommand_JumpIfFlagNonzero2_index ; $61 + const ScriptCommand_JumpIfFlagZero2_index ; $62 + const ScriptCommand_IncrementFlagValue_index ; $63 + const ScriptCommand_EndScriptLoop7_index ; $64 + const ScriptCommand_EndScriptLoop8_index ; $65 + const ScriptCommand_EndScriptLoop9_index ; $66 + const ScriptCommand_EndScriptLoop10_index ; $67 + +; Script Macros + +move_player: MACRO + run_command ScriptCommand_MovePlayer + db \1 + db \2 +ENDM diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 812678c..a678bac 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -55,43 +55,78 @@ def extractMovement(game_data, loc, errQuit): def decodeLine(scriptList, game_data, loc, ignore_broken, locList): currLine = scriptList[game_data[loc]] - ret = "\trun_command " + currLine[0] + "\n" + macroMode = False + if currLine[3] != "": # this seems like a bad way to handle macros, but the least bad I wanna do rn + macroMode = True + ret = "\t" + currLine[3] + " " + else: + ret = "\trun_command " + currLine[0] + "\n" loc+=1 quit = currLine[2] for c in currLine[1]: if c == "b": - ret += "\tdb $" + format(game_data[loc],"02x") + "\n" + if macroMode: + ret += "$" + format(game_data[loc],"02x") + ", " + else: + ret += "\tdb $" + format(game_data[loc],"02x") + "\n" loc += 1 elif c == "i": - ret += "\tdb " + str(game_data[loc]) + "\n" + if macroMode: + ret += str(game_data[loc]) + ", " + else: + ret += "\tdb " + str(game_data[loc]) + "\n" loc += 1 elif c == "w": - ret += "\tdw $" + format((game_data[loc] + (game_data[loc+1]<<8)),"04x") + "\n" + if macroMode: + ret += "$" + format((game_data[loc] + (game_data[loc+1]<<8)),"04x") + ", " + else: + ret += "\tdw $" + format((game_data[loc] + (game_data[loc+1]<<8)),"04x") + "\n" loc += 2 elif c == "j": wordLoc = (game_data[loc] + (game_data[loc+1]<<8)) if wordLoc == 0000: - ret += "\tdw NO_JUMP\n" + if macroMode: + ret += "NO_JUMP, " + else: + ret += "\tdw NO_JUMP\n" else: - ret += "\tdw .ows_" + format(wordLoc+0x8000,"04x") + "\n" + if macroMode: + ret += ".ows_" + format(wordLoc+0x8000,"04x") + ", " + else: + ret += "\tdw .ows_" + format(wordLoc+0x8000,"04x") + "\n" locList.append(wordLoc) loc += 2 elif c == "t": addr = (game_data[loc] + (game_data[loc+1]<<8)) if addr == 0: - ret += "\tdw $0000\n" + if macroMode: + ret += "$0000, " + else: + ret += "\tdw $0000\n" else: - ret += "\ttx Text" + format(addr,"04x") + "\n" + if macroMode: + ret += "Text" + format(addr,"04x") + ", " + else: + ret += "\ttx Text" + format(addr,"04x") + "\n" loc += 2 elif c == "f": - ret += "\tdb EVENT_FLAG_" + format(game_data[loc],"02X") + "\n" + if macroMode: + ret += "EVENT_FLAG_" + format(game_data[loc],"02X") + ", " + else: + ret += "\tdb EVENT_FLAG_" + format(game_data[loc],"02X") + "\n" loc += 1 elif c == "d": - ret += "\tdb " + dir_list[game_data[loc]] + "\n" + if macroMode: + ret += dir_list[game_data[loc]] + ", " + else: + ret += "\tdb " + dir_list[game_data[loc]] + "\n" loc += 1 elif c == "m": wordLoc = (game_data[loc] + (game_data[loc+1]<<8)) - ret += "\tdw NPCMovement_" + format(wordLoc + 0x8000, "04x") + "\n" + if macroMode: + ret += "NPCMovement_" + format(wordLoc + 0x8000, "04x") + ", " + else: + ret += "\tdw NPCMovement_" + format(wordLoc + 0x8000, "04x") + "\n" loc += 2 elif c == "q": print("haven't updated data for this yet") @@ -99,6 +134,9 @@ def decodeLine(scriptList, game_data, loc, ignore_broken, locList): quit = QUIT_DEBUG else: print("UNACCEPTED CHARACTER: " + c) + # if in macro mode, remove the extra `, ` from the end + if macroMode: + ret = ret[:-1] return (loc, ret, quit) def main(): @@ -175,110 +213,110 @@ def printScript(game_data, loc, auto, ignore_broken, scriptList, \ def createList(): # this is a func just so all this can go at the bottom # name, arg list, is an ender return [ - ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE), - ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT), - ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT), - ("Func_ccdc", "t", DO_NOT_QUIT), - ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT), # more complex behavior too (jumping) - ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT), - ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT), - ("Func_cda8", "bbbb", DO_NOT_QUIT), - ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL), - ("Func_cdcb", "", DO_NOT_QUIT), - ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT), - ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT), - ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT), - ("ScriptCommand_CheckIfCardInCollectionOrDecks", "bj", DO_NOT_QUIT), # more complex behavior too (jumping) - ("ScriptCommand_CheckIfCardInCollection", "bj", DO_NOT_QUIT), - ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT), - ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT), - ("Func_cf53", "w", DO_NOT_QUIT), # more complex behavior too (jumping) - ("Func_cf7b", "", DO_NOT_QUIT), - ("ScriptCommand_CheckRawAmountOfCardsOwned", "bbbb", DO_NOT_QUIT), # more complex behavior too (jumping + ??) - ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "w", DO_NOT_QUIT), # only jumps? still needs args to do that though - ("Func_cfc6", "b", DO_NOT_QUIT), - ("Func_cfd4", "", DO_NOT_QUIT), - ("Func_d00b", "", DO_NOT_QUIT), # includes something with random and extra data - ("Func_d025", "w", DO_NOT_QUIT), # possibly only jumps, still needs args - ("Func_d032", "w", DO_NOT_QUIT), # see above - ("Func_d03f", "", DO_NOT_QUIT), - ("ScriptCommand_Jump", "j", QUIT_JUMP), # jumps to d - ("ScriptCommand_TryGiveMedalPCPacks", "", DO_NOT_QUIT), - ("ScriptCommand_SetPlayerDirection", "d", DO_NOT_QUIT), - ("ScriptCommand_MovePlayer", "db", DO_NOT_QUIT), - ("ScriptCommand_ShowCardReceivedScreen", "b", DO_NOT_QUIT), - ("ScriptCommand_SetDialogName", "b", DO_NOT_QUIT), - ("ScriptCommand_SetNextNPCandScript", "bj", DO_NOT_QUIT), - ("Func_d095", "bbb", DO_NOT_QUIT), - ("Func_d0be", "bb", DO_NOT_QUIT), - ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT), - ("Func_d0d9", "bbw", DO_NOT_QUIT), # jumps but still needs args - ("ScriptCommand_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT), # jumps but still needs args - ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT), - ("ScriptCommand_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT), - ("Func_d103", "q", DO_NOT_QUIT), - ("Func_d125", "b", DO_NOT_QUIT), - ("Func_d135", "b", DO_NOT_QUIT), - ("Func_d16b", "b", DO_NOT_QUIT), - ("Func_cd4f", "bbb", DO_NOT_QUIT), - ("Func_cd94", "q", DO_NOT_QUIT), - ("ScriptCommand_MoveWramNPC", "m", DO_NOT_QUIT), - ("Func_cdd8", "", DO_NOT_QUIT), - ("Func_cdf5", "bb", DO_NOT_QUIT), - ("Func_d195", "", DO_NOT_QUIT), - ("Func_d1ad", "", DO_NOT_QUIT), - ("Func_d1b3", "", DO_NOT_QUIT), - ("ScriptCommand_QuitScriptFully", "", QUIT_SPECIAL), - ("Func_d244", "q", DO_NOT_QUIT), - ("Func_d24c", "q", DO_NOT_QUIT), - ("ScriptCommand_OpenDeckMachine", "b", DO_NOT_QUIT), - ("Func_d271", "q", DO_NOT_QUIT), - ("ScriptCommand_EnterMap", "bbood", DO_NOT_QUIT), - ("ScriptCommand_MoveArbitraryNPC", "bm", DO_NOT_QUIT), - ("Func_d209", "", DO_NOT_QUIT), - ("Func_d38f", "b", DO_NOT_QUIT), - ("Func_d396", "b", DO_NOT_QUIT), - ("Func_cd76", "", DO_NOT_QUIT), - ("Func_d39d", "b", DO_NOT_QUIT), - ("Func_d3b9", "", DO_NOT_QUIT), - ("ScriptCommand_TryGivePCPack", "b", DO_NOT_QUIT), - ("ScriptCommand_nop", "", DO_NOT_QUIT), - ("Func_d3d4", "q", DO_NOT_QUIT), - ("Func_d3e0", "", DO_NOT_QUIT), - ("Func_d3fe", "q", DO_NOT_QUIT), - ("Func_d408", "b", DO_NOT_QUIT), - ("Func_d40f", "q", DO_NOT_QUIT), - ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT), - ("ScriptCommand_PauseSong", "q", DO_NOT_QUIT), - ("ScriptCommand_ResumeSong", "q", DO_NOT_QUIT), - ("Func_d41d", "", DO_NOT_QUIT), - ("ScriptCommand_WaitForSongToFinish", "q", DO_NOT_QUIT), - ("Func_d435", "b", DO_NOT_QUIT), - ("ScriptCommand_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT), - ("Func_d2f6", "q", DO_NOT_QUIT), - ("Func_d317", "", DO_NOT_QUIT), - ("Func_d43d", "", DO_NOT_QUIT), - ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagNonzero1", "q", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT), # also capable of jumping - ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT), # jumps - ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT), - ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT), - ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT), - ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT), - ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT), - ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE), - ("ScriptCommand_EndScriptLoop10", "q", QUIT_CONTINUE_CODE) + ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT,""), + ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT,""), + ("Func_ccdc", "t", DO_NOT_QUIT,""), + ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT,""), # more complex behavior too (jumping) + ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT,""), + ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT,""), + ("Func_cda8", "bbbb", DO_NOT_QUIT,""), + ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL,""), + ("Func_cdcb", "", DO_NOT_QUIT,""), + ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT,""), + ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT,""), + ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT,""), + ("ScriptCommand_CheckIfCardInCollectionOrDecks", "bj", DO_NOT_QUIT,""), # more complex behavior too (jumping) + ("ScriptCommand_CheckIfCardInCollection", "bj", DO_NOT_QUIT,""), + ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT,""), + ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT,""), + ("Func_cf53", "w", DO_NOT_QUIT,""), # more complex behavior too (jumping) + ("Func_cf7b", "", DO_NOT_QUIT,""), + ("ScriptCommand_CheckRawAmountOfCardsOwned", "bbbb", DO_NOT_QUIT,""), # more complex behavior too (jumping + ??) + ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "w", DO_NOT_QUIT,""), # only jumps? still needs args to do that though + ("Func_cfc6", "b", DO_NOT_QUIT,""), + ("Func_cfd4", "", DO_NOT_QUIT,""), + ("Func_d00b", "", DO_NOT_QUIT,""), # includes something with random and extra data + ("Func_d025", "w", DO_NOT_QUIT,""), # possibly only jumps, still needs args + ("Func_d032", "w", DO_NOT_QUIT,""), # see above + ("Func_d03f", "", DO_NOT_QUIT,""), + ("ScriptCommand_Jump", "j", QUIT_JUMP,""), # jumps to d + ("ScriptCommand_TryGiveMedalPCPacks", "", DO_NOT_QUIT,""), + ("ScriptCommand_SetPlayerDirection", "d", DO_NOT_QUIT,""), + ("ScriptCommand_MovePlayer", "di", DO_NOT_QUIT,"move_player"), + ("ScriptCommand_ShowCardReceivedScreen", "b", DO_NOT_QUIT,""), + ("ScriptCommand_SetDialogName", "b", DO_NOT_QUIT,""), + ("ScriptCommand_SetNextNPCandScript", "bj", DO_NOT_QUIT,""), + ("Func_d095", "bbb", DO_NOT_QUIT,""), + ("Func_d0be", "bb", DO_NOT_QUIT,""), + ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT,""), + ("Func_d0d9", "bbw", DO_NOT_QUIT,""), # jumps but still needs args + ("ScriptCommand_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT,""), # jumps but still needs args + ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT,""), + ("ScriptCommand_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT,""), + ("Func_d103", "q", DO_NOT_QUIT,""), + ("Func_d125", "b", DO_NOT_QUIT,""), + ("Func_d135", "b", DO_NOT_QUIT,""), + ("Func_d16b", "b", DO_NOT_QUIT,""), + ("Func_cd4f", "bbb", DO_NOT_QUIT,""), + ("Func_cd94", "q", DO_NOT_QUIT,""), + ("ScriptCommand_MoveWramNPC", "m", DO_NOT_QUIT,""), + ("Func_cdd8", "", DO_NOT_QUIT,""), + ("Func_cdf5", "bb", DO_NOT_QUIT,""), + ("Func_d195", "", DO_NOT_QUIT,""), + ("Func_d1ad", "", DO_NOT_QUIT,""), + ("Func_d1b3", "", DO_NOT_QUIT,""), + ("ScriptCommand_QuitScriptFully", "", QUIT_SPECIAL,""), + ("Func_d244", "q", DO_NOT_QUIT,""), + ("Func_d24c", "q", DO_NOT_QUIT,""), + ("ScriptCommand_OpenDeckMachine", "b", DO_NOT_QUIT,""), + ("Func_d271", "q", DO_NOT_QUIT,""), + ("ScriptCommand_EnterMap", "bbood", DO_NOT_QUIT,""), + ("ScriptCommand_MoveArbitraryNPC", "bm", DO_NOT_QUIT,""), + ("Func_d209", "", DO_NOT_QUIT,""), + ("Func_d38f", "b", DO_NOT_QUIT,""), + ("Func_d396", "b", DO_NOT_QUIT,""), + ("Func_cd76", "", DO_NOT_QUIT,""), + ("Func_d39d", "b", DO_NOT_QUIT,""), + ("Func_d3b9", "", DO_NOT_QUIT,""), + ("ScriptCommand_TryGivePCPack", "b", DO_NOT_QUIT,""), + ("ScriptCommand_nop", "", DO_NOT_QUIT,""), + ("Func_d3d4", "q", DO_NOT_QUIT,""), + ("Func_d3e0", "", DO_NOT_QUIT,""), + ("Func_d3fe", "q", DO_NOT_QUIT,""), + ("Func_d408", "b", DO_NOT_QUIT,""), + ("Func_d40f", "q", DO_NOT_QUIT,""), + ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT,""), + ("ScriptCommand_PauseSong", "q", DO_NOT_QUIT,""), + ("ScriptCommand_ResumeSong", "q", DO_NOT_QUIT,""), + ("Func_d41d", "", DO_NOT_QUIT,""), + ("ScriptCommand_WaitForSongToFinish", "q", DO_NOT_QUIT,""), + ("Func_d435", "b", DO_NOT_QUIT,""), + ("ScriptCommand_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT,""), + ("Func_d2f6", "q", DO_NOT_QUIT,""), + ("Func_d317", "", DO_NOT_QUIT,""), + ("Func_d43d", "", DO_NOT_QUIT,""), + ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagNonzero1", "q", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT,""), # also capable of jumping + ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT,""), # jumps + ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT,""), + ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT,""), + ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT,""), + ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT,""), + ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop10", "q", QUIT_CONTINUE_CODE,"") ] main() -- cgit v1.2.3 From 2f99558df349c0e3e949de4ad4f0d2710d28f993 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 14 Dec 2020 01:28:58 -0500 Subject: switched to only using move_player macro --- src/engine/bank03.asm | 208 +++++++++++++------------------------------------- 1 file changed, 52 insertions(+), 156 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index c3b7a50..fdb3061 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3235,30 +3235,14 @@ Script_DrMason: ; d727 (3:5727) Script_EnterLabFirstTime: ; d753 (3:5753) start_script move_player NORTH, 2 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 + move_player NORTH, 2 run_command ScriptCommand_PrintTextString tx Text05e3 run_command ScriptCommand_CloseAdvancedTextBox @@ -3301,23 +3285,13 @@ Script_d794: ; d794 (3:5794) run_command ScriptCommand_PrintTextString tx Text05e6 run_command ScriptCommand_CloseTextBox - run_command ScriptCommand_MovePlayer - db WEST - db $01 - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 + move_player WEST, 1 run_command ScriptCommand_SetPlayerDirection db SOUTH - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 + move_player SOUTH, 1 + move_player SOUTH, 1 + move_player SOUTH, 1 run_command ScriptCommand_SetPlayerDirection db WEST run_command ScriptCommand_MoveActiveNPC @@ -3449,23 +3423,13 @@ AfterTutorialBattleScript: ; d834 (3:5834) dw NPCMovement_d896 run_command ScriptCommand_SetPlayerDirection db NORTH - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 + move_player NORTH, 1 + move_player NORTH, 1 + move_player NORTH, 1 run_command ScriptCommand_SetPlayerDirection db EAST - run_command ScriptCommand_MovePlayer - db EAST - db $01 - run_command ScriptCommand_MovePlayer - db EAST - db $01 + move_player EAST, 1 + move_player EAST, 1 run_command ScriptCommand_SetPlayerDirection db NORTH run_command ScriptCommand_PrintTextString @@ -3946,9 +3910,7 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60) .ows_dd69 run_command ScriptCommand_SetPlayerDirection db EAST - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 .ows_dd6e run_command ScriptCommand_MoveActiveNPC @@ -4470,9 +4432,7 @@ Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) db $08 dw .ows_e1f8 .ows_e1d5 - run_command ScriptCommand_MovePlayer - db SOUTH - db $04 + move_player SOUTH, 4 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e213 run_command ScriptCommand_PrintTextString @@ -4730,17 +4690,11 @@ Script_MeetAmy: ; e2d1 (3:62d1) db $04 run_command ScriptCommand_SetPlayerDirection db $03 - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 run_command ScriptCommand_SetPlayerDirection db $00 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 + move_player NORTH, 1 + move_player NORTH, 1 run_command ScriptCommand_MoveArbitraryNPC db NPC_JOSHUA dw NPCMovement_e2ab @@ -5284,12 +5238,8 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) run_command ScriptCommand_PrintTextString tx Text0645 run_command ScriptCommand_CloseTextBox - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 + move_player NORTH, 1 + move_player NORTH, 1 run_command ScriptCommand_PrintTextString tx Text0646 run_command ScriptCommand_AskQuestionJumpDefaultYes @@ -5309,9 +5259,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) run_command ScriptCommand_CloseTextBox run_command ScriptCommand_SetPlayerDirection db $03 - run_command ScriptCommand_MovePlayer - db EAST - db $04 + move_player EAST, 4 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e894 run_command Func_cdcb @@ -5345,17 +5293,11 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) dw $68d6 run_command ScriptCommand_SetPlayerDirection db WEST - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 run_command ScriptCommand_SetPlayerDirection db SOUTH - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 + move_player SOUTH, 1 + move_player SOUTH, 1 run_command ScriptCommand_PrintTextString tx Text064b run_command ScriptCommand_SetFlagValue @@ -5437,18 +5379,12 @@ ScriptSecondRonaldFight: ; e91e (3:691e) dw .ows_6934 run_command ScriptCommand_SetPlayerDirection db WEST - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 .ows_6934 run_command ScriptCommand_SetPlayerDirection db SOUTH - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 + move_player SOUTH, 1 + move_player SOUTH, 1 run_command ScriptCommand_PrintTextString tx Text0650 run_command ScriptCommand_SetFlagValue @@ -6262,56 +6198,36 @@ Script_Clerk12: ; f295 (3:7295) db 12 db 18 dw .ows_f302 - run_command ScriptCommand_MovePlayer - db NORTH - db $02 + move_player NORTH, 2 run_command ScriptCommand_Jump dw .ows_f307 .ows_f2fa run_command ScriptCommand_SetPlayerDirection db EAST - run_command ScriptCommand_MovePlayer - db EAST - db $02 + move_player EAST, 2 run_command ScriptCommand_Jump dw .ows_f307 .ows_f302 run_command ScriptCommand_SetPlayerDirection db WEST - run_command ScriptCommand_MovePlayer - db WEST - db $02 + move_player WEST, 2 .ows_f307 run_command ScriptCommand_SetPlayerDirection db NORTH - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 + move_player NORTH, 1 + move_player NORTH, 1 + move_player NORTH, 1 + move_player NORTH, 1 + move_player NORTH, 1 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_43 dw .ows_f33a run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_43 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 - run_command ScriptCommand_MovePlayer - db NORTH - db $01 + move_player NORTH, 1 + move_player NORTH, 1 run_command ScriptCommand_SetPlayerDirection db EAST run_command ScriptCommand_DoFrames @@ -6328,18 +6244,12 @@ Script_Clerk12: ; f295 (3:7295) db SOUTH run_command ScriptCommand_DoFrames db 30 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 + move_player SOUTH, 1 + move_player SOUTH, 1 .ows_f33a run_command ScriptCommand_SetPlayerDirection db EAST - run_command ScriptCommand_MovePlayer - db EAST - db $01 + move_player EAST, 1 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f34e run_command ScriptCommand_CloseAdvancedTextBox @@ -6526,29 +6436,15 @@ Script_f3e9: ; f3e9 (3:73e9) dw NPCMovement_f40a run_command ScriptCommand_SetPlayerDirection db WEST - run_command ScriptCommand_MovePlayer - db WEST - db $01 + move_player WEST, 1 run_command ScriptCommand_SetPlayerDirection db SOUTH - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 - run_command ScriptCommand_MovePlayer - db SOUTH - db $01 + move_player SOUTH, 1 + move_player SOUTH, 1 + move_player SOUTH, 1 + move_player SOUTH, 1 + move_player SOUTH, 1 + move_player SOUTH, 1 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f40d run_command ScriptCommand_QuitScriptFully -- cgit v1.2.3 From 551d228c1760778293a7129e83c0d97d9dc08f01 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 14 Dec 2020 02:26:58 -0500 Subject: Added script loop enders as macros --- src/engine/bank03.asm | 16 ++++++++-------- src/macros/scripts.asm | 33 +++++++++++++++++++++++++++++++++ tools/script_extractor.py | 22 +++++++++++----------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index fdb3061..7bdc185 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3249,7 +3249,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) run_command ScriptCommand_SetNextNPCandScript db NPC_SAM dw Script_d779 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret Script_d779: ; d779 (03:5779) @@ -3273,7 +3273,7 @@ Script_d779: ; d779 (03:5779) run_command ScriptCommand_SetNextNPCandScript db NPC_DRMASON dw Script_d794 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret Script_d794: ; d794 (3:5794) @@ -3398,7 +3398,7 @@ Script_d794: ; d794 (3:5794) run_command ScriptCommand_SetNextNPCandScript db NPC_SAM dw Script_d827 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret Script_d827: ; d827 (3:5827) @@ -4625,7 +4625,7 @@ Script_BeatJoshua: ; e26c (3:626c) run_command ScriptCommand_SetNextNPCandScript db NPC_AMY dw Script_MeetAmy - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret NPCMovementTable_e2a1: ; e2a1 (3:62a1) @@ -6256,7 +6256,7 @@ Script_Clerk12: ; f295 (3:7295) run_command ScriptCommand_SetNextNPCandScript db $4a dw Script_f353 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret ; f349 @@ -6427,7 +6427,7 @@ LostAtChallengeHall: ; f392 (3:7392) run_command ScriptCommand_SetNextNPCandScript db NPC_CLERK12 dw Script_f3e9 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret Script_f3e9: ; f3e9 (3:73e9) @@ -6745,7 +6745,7 @@ ScriptJump_f4db: ; f4db (3:74db) run_command ScriptCommand_SetNextNPCandScript db NPC_CLERK12 dw Script_f3e9 - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret ; f559 @@ -6826,7 +6826,7 @@ Script_f631: ; f631 (3:7631) run_command ScriptCommand_SetNextNPCandScript db $02 dw $763c - run_command ScriptCommand_EndScriptLoop1 + end_script_loop ret ; 0xf63c diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 19694e8..cb3c8a8 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -111,9 +111,42 @@ ENDM const ScriptCommand_EndScriptLoop10_index ; $67 ; Script Macros +end_script_loop: MACRO + run_command ScriptCommand_EndScriptLoop1 +ENDM move_player: MACRO run_command ScriptCommand_MovePlayer db \1 db \2 ENDM + +end_script_loop_2: MACRO + run_command ScriptCommand_EndScriptLoop2 +ENDM +end_script_loop_3: MACRO + run_command ScriptCommand_EndScriptLoop3 +ENDM +end_script_loop_4: MACRO + run_command ScriptCommand_EndScriptLoop4 +ENDM +end_script_loop_5: MACRO + run_command ScriptCommand_EndScriptLoop5 +ENDM +end_script_loop_6: MACRO + run_command ScriptCommand_EndScriptLoop6 +ENDM + +end_script_loop_7: MACRO + run_command ScriptCommand_EndScriptLoop7 +ENDM +end_script_loop_8: MACRO + run_command ScriptCommand_EndScriptLoop8 +ENDM +end_script_loop_9: MACRO + run_command ScriptCommand_EndScriptLoop9 +ENDM +end_script_loop_10: MACRO + run_command ScriptCommand_EndScriptLoop10 +ENDM + diff --git a/tools/script_extractor.py b/tools/script_extractor.py index a678bac..79eb276 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -213,8 +213,8 @@ def printScript(game_data, loc, auto, ignore_broken, scriptList, \ def createList(): # this is a func just so all this can go at the bottom # name, arg list, is an ender return [ - ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT,""), + ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE,"end_script_loop"), + ("ScriptCommand_CloseAdvancedTextBo", "", DO_NOT_QUIT,""), ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT,""), ("Func_ccdc", "t", DO_NOT_QUIT,""), ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT,""), # more complex behavior too (jumping) @@ -296,11 +296,11 @@ def createList(): # this is a func just so all this can go at the bottom ("Func_d2f6", "q", DO_NOT_QUIT,""), ("Func_d317", "", DO_NOT_QUIT,""), ("Func_d43d", "", DO_NOT_QUIT,""), - ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE,""), + ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE,"end_script_loop_2"), + ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE,"end_script_loop_3"), + ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE,"end_script_loop_4"), + ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE,"end_script_loop_5"), + ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE,"end_script_loop_6"), ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT,""), ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT,""), ("ScriptCommand_JumpIfFlagNonzero1", "q", DO_NOT_QUIT,""), @@ -313,10 +313,10 @@ def createList(): # this is a func just so all this can go at the bottom ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT,""), ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT,""), ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT,""), - ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE,""), - ("ScriptCommand_EndScriptLoop10", "q", QUIT_CONTINUE_CODE,"") + ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE,"end_script_loop_7"), + ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE,"end_script_loop_8"), + ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE,"end_script_loop_9"), + ("ScriptCommand_EndScriptLoop10", "q", QUIT_CONTINUE_CODE,"end_script_loop_10") ] main() -- cgit v1.2.3 From cab6cfc5f29617416baaa4cb6d96932f4b50078a Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Fri, 18 Dec 2020 01:32:46 -0500 Subject: fix accidental character deletion --- tools/script_extractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 79eb276..54a20b3 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -214,7 +214,7 @@ def createList(): # this is a func just so all this can go at the bottom # name, arg list, is an ender return [ ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE,"end_script_loop"), - ("ScriptCommand_CloseAdvancedTextBo", "", DO_NOT_QUIT,""), + ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT,""), ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT,""), ("Func_ccdc", "t", DO_NOT_QUIT,""), ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT,""), # more complex behavior too (jumping) -- cgit v1.2.3 From 4f85f94a0eb08cdbf719a2d96d5b69537d0a72e8 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Fri, 18 Dec 2020 03:35:38 -0500 Subject: Created macros for a few more script commands --- src/engine/bank03.asm | 623 +++++++++++++++------------------------------- src/macros/scripts.asm | 28 +++ tools/script_extractor.py | 16 +- 3 files changed, 237 insertions(+), 430 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 7bdc185..3f78a5c 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3243,9 +3243,8 @@ Script_EnterLabFirstTime: ; d753 (3:5753) move_player NORTH, 2 move_player NORTH, 2 move_player NORTH, 2 - run_command ScriptCommand_PrintTextString - tx Text05e3 - run_command ScriptCommand_CloseAdvancedTextBox + print_text_string Text05e3 + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_SAM dw Script_d779 @@ -3256,20 +3255,18 @@ Script_d779: ; d779 (03:5779) start_script run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d880 - run_command ScriptCommand_PrintTextString - tx Text05e4 + print_text_string Text05e4 run_command ScriptCommand_SetDialogName db NPC_DRMASON - run_command ScriptCommand_PrintTextString - tx Text05e5 - run_command ScriptCommand_CloseTextBox + print_text_string Text05e5 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d882 run_command Func_cfc6 db $01 run_command ScriptCommand_SetPlayerDirection db $03 - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_DRMASON dw Script_d794 @@ -3282,9 +3279,8 @@ Script_d794: ; d794 (3:5794) dw NPCMovement_d88b run_command ScriptCommand_DoFrames db 40 - run_command ScriptCommand_PrintTextString - tx Text05e6 - run_command ScriptCommand_CloseTextBox + print_text_string Text05e6 + close_text_box move_player WEST, 1 move_player WEST, 1 run_command ScriptCommand_SetPlayerDirection @@ -3296,17 +3292,15 @@ Script_d794: ; d794 (3:5794) db WEST run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d894 - run_command ScriptCommand_PrintTextString - tx Text05e7 + print_text_string Text05e7 run_command ScriptCommand_SetDialogName db $07 - run_command ScriptCommand_PrintTextString - tx Text05e8 + print_text_string Text05e8 .ows_d7bc - run_command ScriptCommand_CloseTextBox + close_text_box run_command Func_d317 - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_75 db $07 @@ -3335,50 +3329,42 @@ Script_d794: ; d794 (3:5794) db EVENT_FLAG_75 db $06 dw .ows_d806 - run_command ScriptCommand_PrintTextString - tx Text05d6 + print_text_string Text05d6 run_command ScriptCommand_Jump dw .ows_d7bc .ows_d7e8 - run_command ScriptCommand_PrintTextString - tx Text05d7 + print_text_string Text05d7 run_command ScriptCommand_Jump dw .ows_d7bc .ows_d7ee - run_command ScriptCommand_PrintTextString - tx Text05d8 + print_text_string Text05d8 run_command ScriptCommand_Jump dw .ows_d7bc .ows_d7f4 - run_command ScriptCommand_PrintTextString - tx Text05d9 + print_text_string Text05d9 run_command ScriptCommand_Jump dw .ows_d7bc .ows_d7fa - run_command ScriptCommand_PrintTextString - tx Text05da + print_text_string Text05da run_command ScriptCommand_Jump dw .ows_d7bc .ows_d800 - run_command ScriptCommand_PrintTextString - tx Text05db + print_text_string Text05db run_command ScriptCommand_Jump dw .ows_d7bc .ows_d806 - run_command ScriptCommand_PrintTextString - tx Text05dc + print_text_string Text05dc run_command ScriptCommand_Jump dw .ows_d7bc .ows_d80c - run_command ScriptCommand_PrintTextString - tx Text05e9 + print_text_string Text05e9 run_command ScriptCommand_AskQuestionJumpDefaultYes dw 0000 dw .ows_d817 @@ -3388,13 +3374,12 @@ Script_d794: ; d794 (3:5794) .ows_d817 run_command ScriptCommand_SetDialogName db $01 - run_command ScriptCommand_PrintTextString - tx Text05ea + print_text_string Text05ea run_command ScriptCommand_nop run_command ScriptCommand_SetFlagValue db EVENT_FLAG_3E db $01 - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_SAM dw Script_d827 @@ -3403,10 +3388,7 @@ Script_d794: ; d794 (3:5794) Script_d827: ; d827 (3:5827) start_script - run_command ScriptCommand_StartBattle - db PRIZES_2 - db SAMS_PRACTICE_DECK_ID - db MUSIC_DUEL_THEME_1 + start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 run_command ScriptCommand_QuitScriptFully ; 0xd82d @@ -3418,7 +3400,7 @@ AfterTutorialBattleScript: ; d834 (3:5834) tx Text05eb run_command ScriptCommand_PrintTextString tx Text05ef - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d896 run_command ScriptCommand_SetPlayerDirection @@ -3434,10 +3416,10 @@ AfterTutorialBattleScript: ; d834 (3:5834) db NORTH run_command ScriptCommand_PrintTextString tx Text05f0 - run_command ScriptCommand_CloseTextBox + close_text_box run_command Func_ccdc tx Text05f1 - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_PrintTextString tx Text05f2 run_command Func_d271 @@ -3610,15 +3592,11 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0729 - tx Text072a + print_variable_text Text0729, Text072a run_command ScriptCommand_SetFlagValue db EVENT_FLAG_1F db $02 - run_command ScriptCommand_AskQuestionJump - tx Text072b - dw .check_ifhave_clefable_incollectionordecks + ask_question_jump Text072b, .check_ifhave_clefable_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c @@ -3644,8 +3622,7 @@ Script_Ishihara: ; db4a (3:5b4a) db $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 - run_command ScriptCommand_PrintTextString - tx Text072f + print_text_string Text072f run_command Func_ccdc tx Text0730 run_command ScriptCommand_TakeCard @@ -3662,15 +3639,11 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $03 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0732 - tx Text0733 + print_variable_text Text0732, Text0733 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_1F db $04 - run_command ScriptCommand_AskQuestionJump - tx Text072b - dw .check_ifhave_ditto_incollectionordecks + ask_question_jump Text072b, .check_ifhave_ditto_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c @@ -3696,8 +3669,7 @@ Script_Ishihara: ; db4a (3:5b4a) db $05 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 - run_command ScriptCommand_PrintTextString - tx Text072f + print_text_string Text072f run_command Func_ccdc tx Text0736 run_command ScriptCommand_TakeCard @@ -3714,15 +3686,11 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $05 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0738 - tx Text0739 + print_variable_text Text0738, Text0739 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_1F db $06 - run_command ScriptCommand_AskQuestionJump - tx Text072b - dw .check_ifhave_chansey_incollectionordecks + ask_question_jump Text072b, .check_ifhave_chansey_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c @@ -3748,8 +3716,7 @@ Script_Ishihara: ; db4a (3:5b4a) db $07 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 - run_command ScriptCommand_PrintTextString - tx Text072f + print_text_string Text072f run_command Func_ccdc tx Text073c run_command ScriptCommand_TakeCard @@ -3784,11 +3751,8 @@ Script_Ronald: ; dc4b (3:5c4b) tx Text073f .ows_dc55 - run_command ScriptCommand_PrintTextString - tx Text0740 - run_command ScriptCommand_AskQuestionJump - tx Text0741 - dw .ows_dc60 + print_text_string Text0740 + ask_question_jump Text0741, .ows_dc60 run_command ScriptCommand_PrintTextQuitFully tx Text0742 @@ -3827,25 +3791,16 @@ Script_Imakuni: ; dd0d (3:5d0d) run_command ScriptCommand_JumpIfFlagZero2 db EVENT_TEMP_TALKED_TO_IMAKUNI dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0467 - tx Text0468 + print_variable_text Text0467, Text0468 run_command ScriptCommand_MaxOutFlagValue db EVENT_TEMP_TALKED_TO_IMAKUNI - run_command ScriptCommand_AskQuestionJump - tx Text0469 - dw .declineDuel - run_command ScriptCommand_PrintTextString - tx Text046a + ask_question_jump Text0469, .declineDuel + print_text_string Text046a run_command ScriptCommand_QuitScriptFully .declineDuel - run_command ScriptCommand_PrintTextString - tx Text046b - run_command ScriptCommand_StartBattle - db PRIZES_6 - db IMAKUNI_DECK_ID - db MUSIC_IMAKUNI + print_text_string Text046b + start_battle PRIZES_6, IMAKUNI_DECK_ID, MUSIC_IMAKUNI run_command ScriptCommand_QuitScriptFully Script_BeatImakuni: ; dd2d (3:5d2d) @@ -3865,41 +3820,35 @@ Script_BeatImakuni: ; dd2d (3:5d2d) db $06 dw .sixWins .giveBoosters - run_command ScriptCommand_PrintTextString - tx Text046c + print_text_string Text046c run_command ScriptCommand_GiveOneOfEachTrainerBooster run_command ScriptCommand_Jump dw .done .threeWins - run_command ScriptCommand_PrintTextString - tx Text046d + print_text_string Text046d run_command ScriptCommand_Jump dw .giveImakuniCard .sixWins - run_command ScriptCommand_PrintTextString - tx Text046e + print_text_string Text046e .giveImakuniCard - run_command ScriptCommand_PrintTextString - tx Text046f + print_text_string Text046f run_command ScriptCommand_GiveCard db IMAKUNI_CARD run_command ScriptCommand_ShowCardReceivedScreen db IMAKUNI_CARD .done - run_command ScriptCommand_PrintTextString - tx Text0470 + print_text_string Text0470 run_command ScriptCommand_Jump dw ScriptJump_ImakuniCommon Script_LostToImakuni: ; dd5c (3:5d5c) start_script - run_command ScriptCommand_PrintTextString - tx Text0471 + print_text_string Text0471 ScriptJump_ImakuniCommon: ; dd60 (3:5d60) - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_JumpIfPlayerCoordMatches db 18 db 4 @@ -4205,41 +4154,33 @@ Script_Gal1: ; e0cf (3:60cf) db EVENT_FLAG_12 db $00 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text041d - tx Text041e + print_variable_text Text041d, Text041e run_command ScriptCommand_SetFlagValue db EVENT_FLAG_12 db $01 - run_command ScriptCommand_AskQuestionJump - tx Text041f - dw .ows_e0eb - run_command ScriptCommand_PrintTextString - tx Text0420 + ask_question_jump Text041f, .ows_e0eb + print_text_string Text0420 run_command ScriptCommand_QuitScriptFully .ows_e0eb run_command ScriptCommand_CheckIfCardInCollectionOrDecks db $59 dw .ows_e0f3 - run_command ScriptCommand_PrintTextString - tx Text0421 + print_text_string Text0421 run_command ScriptCommand_QuitScriptFully .ows_e0f3 run_command ScriptCommand_CheckIfCardInCollection db $59 dw .ows_e0fb - run_command ScriptCommand_PrintTextString - tx Text0422 + print_text_string Text0422 run_command ScriptCommand_QuitScriptFully .ows_e0fb run_command ScriptCommand_SetFlagValue db EVENT_FLAG_12 db $02 - run_command ScriptCommand_PrintTextString - tx Text0423 + print_text_string Text0423 run_command Func_ccdc tx Text0424 run_command ScriptCommand_TakeCard @@ -4248,8 +4189,7 @@ Script_Gal1: ; e0cf (3:60cf) db ARCANINE1 run_command ScriptCommand_ShowCardReceivedScreen db ARCANINE1 - run_command ScriptCommand_PrintTextString - tx Text0425 + print_text_string Text0425 run_command ScriptCommand_QuitScriptFully .ows_e10e @@ -4262,8 +4202,7 @@ Script_Lass1: ; e111 (3:6111) db EVENT_FLAG_14 db $01 dw .ows_e121 - run_command ScriptCommand_PrintTextString - tx Text0427 + print_text_string Text0427 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_14 db $01 @@ -4343,35 +4282,25 @@ WaterClubAfterDuel: ;e157 (3:6157) Script_Sara: ; e177 (3:6177) start_script - run_command ScriptCommand_PrintTextString - tx Text042c - run_command ScriptCommand_AskQuestionJump - tx Text042d - dw .yes_duel - run_command ScriptCommand_PrintTextString - tx Text042e + print_text_string Text042c + ask_question_jump Text042d, .yes_duel + print_text_string Text042e run_command ScriptCommand_QuitScriptFully .yes_duel - run_command ScriptCommand_PrintTextString - tx Text042f - run_command ScriptCommand_StartBattle - db PRIZES_2 - db WATERFRONT_POKEMON_DECK_ID - db MUSIC_DUEL_THEME_1 + print_text_string Text042f + start_battle PRIZES_2, WATERFRONT_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 run_command ScriptCommand_QuitScriptFully Script_BeatSara: ; e18c (3:618c) start_script run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_SARA - run_command ScriptCommand_PrintTextString - tx Text0430 + print_text_string Text0430 run_command ScriptCommand_GiveBoosterPacks db BOOSTER_COLOSSEUM_WATER db BOOSTER_COLOSSEUM_WATER db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0431 + print_text_string Text0431 run_command ScriptCommand_QuitScriptFully Script_LostToSara: ; e19a (03:619a) @@ -4381,35 +4310,25 @@ Script_LostToSara: ; e19a (03:619a) Script_Amanda: ; e19e (03:619e) start_script - run_command ScriptCommand_PrintTextString - tx Text0433 - run_command ScriptCommand_AskQuestionJump - tx Text0434 - dw .yes_duel - run_command ScriptCommand_PrintTextString - tx Text0435 + print_text_string Text0433 + ask_question_jump Text0434, .yes_duel + print_text_string Text0435 run_command ScriptCommand_QuitScriptFully .yes_duel - run_command ScriptCommand_PrintTextString - tx Text0436 - run_command ScriptCommand_StartBattle - db PRIZES_3 - db LONELY_FRIENDS_DECK_ID - db MUSIC_DUEL_THEME_1 + print_text_string Text0436 + start_battle PRIZES_3, LONELY_FRIENDS_DECK_ID, MUSIC_DUEL_THEME_1 run_command ScriptCommand_QuitScriptFully Script_BeatAmanda: ; e1b3 (03:61b3) start_script run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_AMANDA - run_command ScriptCommand_PrintTextString - tx Text0437 + print_text_string Text0437 run_command ScriptCommand_GiveBoosterPacks db BOOSTER_MYSTERY_LIGHTNING_COLORLESS db BOOSTER_MYSTERY_LIGHTNING_COLORLESS db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0438 + print_text_string Text0438 run_command ScriptCommand_QuitScriptFully Script_LostToAmanda: ; e1c1 (03:61c1) @@ -4435,8 +4354,7 @@ Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) move_player SOUTH, 4 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e213 - run_command ScriptCommand_PrintTextString - tx Text043a + print_text_string Text043a run_command ScriptCommand_JumpIfPlayerCoordMatches db $12 db $0a @@ -4525,8 +4443,7 @@ Script_Joshua: ; e21c (3:621c) run_command ScriptCommand_SetFlagValue db EVENT_JOSHUA_STATE db JOSHUA_TALKED - run_command ScriptCommand_PrintTextString - tx Text043b + print_text_string Text043b run_command ScriptCommand_QuitScriptFully .beat_sara_and_amanda @@ -4536,39 +4453,27 @@ Script_Joshua: ; e21c (3:621c) run_command ScriptCommand_SetFlagValue db EVENT_JOSHUA_STATE db JOSHUA_TALKED - run_command ScriptCommand_PrintTextString - tx Text043b - run_command ScriptCommand_PrintTextString - tx Text043c + print_text_string Text043b + print_text_string Text043c .already_talked run_command ScriptCommand_JumpIfFlagEqual db EVENT_JOSHUA_STATE db JOSHUA_TALKED dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text043d - tx Text043e - run_command ScriptCommand_AskQuestionJump - tx Text043f - dw .startDuel + print_variable_text Text043d, Text043e + ask_question_jump Text043f, .startDuel run_command ScriptCommand_JumpIfFlagEqual db EVENT_JOSHUA_STATE db JOSHUA_TALKED dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0440 - tx Text0441 + print_variable_text Text0440, Text0441 run_command ScriptCommand_QuitScriptFully .startDuel: - run_command ScriptCommand_PrintTextString - tx Text0442 + print_text_string Text0442 run_command ScriptCommand_TryGivePCPack db $04 - run_command ScriptCommand_StartBattle - db PRIZES_4 - db SOUND_OF_THE_WAVES_DECK_ID - db MUSIC_DUEL_THEME_1 + start_battle PRIZES_4, SOUND_OF_THE_WAVES_DECK_ID, MUSIC_DUEL_THEME_1 run_command ScriptCommand_QuitScriptFully Script_LostToJoshua: ; e260 (3:6260) @@ -4577,9 +4482,7 @@ Script_LostToJoshua: ; e260 (3:6260) db EVENT_JOSHUA_STATE db JOSHUA_TALKED dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0443 - tx Text0444 + print_variable_text Text0443, Text0444 run_command ScriptCommand_QuitScriptFully Script_BeatJoshua: ; e26c (3:626c) @@ -4588,9 +4491,7 @@ Script_BeatJoshua: ; e26c (3:626c) db EVENT_JOSHUA_STATE db JOSHUA_TALKED dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0445 - tx Text0446 + print_variable_text Text0445, Text0446 run_command ScriptCommand_GiveBoosterPacks db BOOSTER_MYSTERY_WATER_COLORLESS db BOOSTER_MYSTERY_WATER_COLORLESS @@ -4599,9 +4500,7 @@ Script_BeatJoshua: ; e26c (3:626c) db EVENT_JOSHUA_STATE db JOSHUA_TALKED dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0447 - tx Text0448 + print_variable_text Text0447, Text0448 run_command ScriptCommand_JumpIfFlagNotEqual db EVENT_JOSHUA_STATE db JOSHUA_BEATEN @@ -4612,16 +4511,14 @@ Script_BeatJoshua: ; e26c (3:626c) run_command ScriptCommand_SetFlagValue db EVENT_JOSHUA_STATE db JOSHUA_BEATEN - run_command ScriptCommand_PrintTextString - tx Text0449 - run_command ScriptCommand_CloseTextBox + print_text_string Text0449 + close_text_box run_command ScriptCommand_MoveActiveNPCByDirection dw NPCMovementTable_e2a1 - run_command ScriptCommand_PrintTextString - tx Text044a + print_text_string Text044a run_command Func_cfc6 db $00 - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_AMY dw Script_MeetAmy @@ -4664,17 +4561,14 @@ Preload_Amy: ; e2ad (3:62ad) Script_MeetAmy: ; e2d1 (3:62d1) start_script - run_command ScriptCommand_PrintTextString - tx Text044b + print_text_string Text044b run_command ScriptCommand_SetDialogName db NPC_JOSHUA - run_command ScriptCommand_PrintTextString - tx Text044c + print_text_string Text044c run_command ScriptCommand_SetDialogName db NPC_AMY - run_command ScriptCommand_PrintTextString - tx Text044d - run_command ScriptCommand_CloseTextBox + print_text_string Text044d + close_text_box run_command Func_d095 db $09 db $2f @@ -4698,8 +4592,7 @@ Script_MeetAmy: ; e2d1 (3:62d1) run_command ScriptCommand_MoveArbitraryNPC db NPC_JOSHUA dw NPCMovement_e2ab - run_command ScriptCommand_PrintTextString - tx Text044e + print_text_string Text044e run_command ScriptCommand_Jump dw Script_Amy.askConfirmDuel @@ -4708,16 +4601,12 @@ Script_Amy: ; e304 (3:6304) run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_BEAT_AMY dw ScriptJump_TalkToAmyAgain - run_command ScriptCommand_PrintTextString - tx Text044f + print_text_string Text044f .askConfirmDuel - run_command ScriptCommand_AskQuestionJump - tx Text0450 - dw .startDuel + ask_question_jump Text0450, .startDuel .denyDuel - run_command ScriptCommand_PrintTextString - tx Text0451 + print_text_string Text0451 run_command Func_d0d9 db $14 db $04 @@ -4725,23 +4614,17 @@ Script_Amy: ; e304 (3:6304) run_command ScriptCommand_QuitScriptFully .startDuel - run_command ScriptCommand_PrintTextString - tx Text0452 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db GO_GO_RAIN_DANCE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text0452 + start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 run_command ScriptCommand_QuitScriptFully Script_BeatAmy: ; e322 (3:6322) start_script - run_command ScriptCommand_PrintTextString - tx Text0453 + print_text_string Text0453 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_BEAT_AMY dw .beatAmyCommon - run_command ScriptCommand_PrintTextString - tx Text0454 + print_text_string Text0454 run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_AMY run_command ScriptCommand_TryGiveMedalPCPacks @@ -4749,15 +4632,13 @@ Script_BeatAmy: ; e322 (3:6322) db EVENT_BEAT_AMY run_command Func_d435 db $03 - run_command ScriptCommand_PrintTextString - tx Text0455 + print_text_string Text0455 .beatAmyCommon run_command ScriptCommand_GiveBoosterPacks db BOOSTER_LABORATORY_WATER db BOOSTER_LABORATORY_WATER db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0456 + print_text_string Text0456 run_command Func_d0d9 db $14 db $04 @@ -4766,8 +4647,7 @@ Script_BeatAmy: ; e322 (3:6322) Script_LostToAmy: ; e344 (3:6344) start_script - run_command ScriptCommand_PrintTextString - tx Text0457 + print_text_string Text0457 run_command Func_d0d9 db $14 db $04 @@ -4785,21 +4665,14 @@ Script_LostToAmy: ; e344 (3:6344) run_command ScriptCommand_QuitScriptFully ScriptJump_TalkToAmyAgain: ; e356 (3:6356) - run_command ScriptCommand_PrintTextString - tx Text0458 - run_command ScriptCommand_AskQuestionJump - tx Text0450 - dw .startDuel + print_text_string Text0458 + ask_question_jump Text0450, .startDuel run_command ScriptCommand_Jump dw Script_Amy.denyDuel .startDuel - run_command ScriptCommand_PrintTextString - tx Text0459 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db GO_GO_RAIN_DANCE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text0459 + start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 run_command ScriptCommand_QuitScriptFully ; 0xe369 @@ -4919,29 +4792,19 @@ Script_Brittany: ; e5d2 (3:65d2) db EVENT_FLAG_35 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06e0 - tx Text06e1 - run_command ScriptCommand_AskQuestionJump - tx Text06e2 - dw .wantToDuel - run_command ScriptCommand_PrintTextString - tx Text06e3 + print_variable_text Text06e0, Text06e1 + ask_question_jump Text06e2, .wantToDuel + print_text_string Text06e3 run_command ScriptCommand_QuitScriptFully .wantToDuel - run_command ScriptCommand_PrintTextString - tx Text06e4 - run_command ScriptCommand_StartBattle - db PRIZES_4 - db ETCETERA_DECK_ID - db MUSIC_DUEL_THEME_1 + print_text_string Text06e4 + start_battle PRIZES_4, ETCETERA_DECK_ID, MUSIC_DUEL_THEME_1 run_command ScriptCommand_QuitScriptFully Script_BeatBrittany: ; e5ee (3:65ee) start_script - run_command ScriptCommand_PrintTextString - tx Text06e5 + print_text_string Text06e5 run_command ScriptCommand_GiveBoosterPacks db BOOSTER_MYSTERY_GRASS_COLORLESS db BOOSTER_MYSTERY_GRASS_COLORLESS @@ -4950,9 +4813,7 @@ Script_BeatBrittany: ; e5ee (3:65ee) db EVENT_FLAG_35 db $02 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06e6 - tx Text06e7 + print_variable_text Text06e6, Text06e7 run_command ScriptCommand_MaxOutFlagValue db FLAG_BEAT_BRITTANY run_command ScriptCommand_JumpIfFlagNotLessThan @@ -4970,8 +4831,7 @@ Script_BeatBrittany: ; e5ee (3:65ee) db $01 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_1E - run_command ScriptCommand_PrintTextString - tx Text06e8 + print_text_string Text06e8 .finishScript run_command ScriptCommand_QuitScriptFully @@ -5005,15 +4865,11 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $00 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06eb - tx Text06ec + print_variable_text Text06eb, Text06ec run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $01 - run_command ScriptCommand_AskQuestionJump - tx Text06ed - dw .ows_e648 + ask_question_jump Text06ed, .ows_e648 run_command ScriptCommand_PrintTextQuitFully tx Text06ee @@ -5037,8 +4893,7 @@ Script_Lass2: ; e61f (3:661f) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $02 - run_command ScriptCommand_PrintTextString - tx Text06f1 + print_text_string Text06f1 run_command Func_ccdc tx Text06f2 run_command ScriptCommand_TakeCard @@ -5055,15 +4910,11 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $02 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06f4 - tx Text06f5 + print_variable_text Text06f4, Text06f5 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $03 - run_command ScriptCommand_AskQuestionJump - tx Text06ed - dw .ows_e67f + ask_question_jump Text06ed, .ows_e67f run_command ScriptCommand_PrintTextQuitFully tx Text06f6 @@ -5087,8 +4938,7 @@ Script_Lass2: ; e61f (3:661f) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $04 - run_command ScriptCommand_PrintTextString - tx Text06f9 + print_text_string Text06f9 run_command Func_ccdc tx Text06fa run_command ScriptCommand_TakeCard @@ -5105,15 +4955,11 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $04 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06fb - tx Text06fc + print_variable_text Text06fb, Text06fc run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $05 - run_command ScriptCommand_AskQuestionJump - tx Text06ed - dw .ows_e6b6 + ask_question_jump Text06ed, .ows_e6b6 run_command ScriptCommand_PrintTextQuitFully tx Text06fd @@ -5137,8 +4983,7 @@ Script_Lass2: ; e61f (3:661f) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_37 db $06 - run_command ScriptCommand_PrintTextString - tx Text0700 + print_text_string Text0700 run_command Func_ccdc tx Text0701 run_command ScriptCommand_TakeCard @@ -5235,28 +5080,23 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) dw NPCMovement_e894 run_command Func_d135 db $00 - run_command ScriptCommand_PrintTextString - tx Text0645 - run_command ScriptCommand_CloseTextBox + print_text_string Text0645 + close_text_box move_player NORTH, 1 move_player NORTH, 1 - run_command ScriptCommand_PrintTextString - tx Text0646 + print_text_string Text0646 run_command ScriptCommand_AskQuestionJumpDefaultYes dw 0000 dw .ows_e882 - run_command ScriptCommand_PrintTextString - tx Text0647 + print_text_string Text0647 run_command ScriptCommand_Jump dw .ows_e885 .ows_e882 - run_command ScriptCommand_PrintTextString - tx Text0648 + print_text_string Text0648 .ows_e885 - run_command ScriptCommand_PrintTextString - tx Text0649 - run_command ScriptCommand_CloseTextBox + print_text_string Text0649 + close_text_box run_command ScriptCommand_SetPlayerDirection db $03 move_player EAST, 4 @@ -5285,8 +5125,7 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) db $3c run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90d - run_command ScriptCommand_PrintTextString - tx Text064a + print_text_string Text064a run_command ScriptCommand_JumpIfPlayerCoordMatches db $08 db $02 @@ -5298,40 +5137,33 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) db SOUTH move_player SOUTH, 1 move_player SOUTH, 1 - run_command ScriptCommand_PrintTextString - tx Text064b + print_text_string Text064b run_command ScriptCommand_SetFlagValue db $4c db $01 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db IM_RONALD_DECK_ID - db MUSIC_RONALD + start_battle PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD run_command ScriptCommand_QuitScriptFully Script_BeatFirstRonaldFight: ; e8e9 (3:68e9) start_script - run_command ScriptCommand_PrintTextString - tx Text064c + print_text_string Text064c run_command ScriptCommand_GiveCard db JIGGLYPUFF1 run_command ScriptCommand_ShowCardReceivedScreen db JIGGLYPUFF1 - run_command ScriptCommand_PrintTextString - tx Text064d + print_text_string Text064d run_command ScriptCommand_Jump dw ScriptJump_FinishedFirstRonaldFight Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) start_script - run_command ScriptCommand_PrintTextString - tx Text064e + print_text_string Text064e ScriptJump_FinishedFirstRonaldFight: run_command ScriptCommand_SetFlagValue db EVENT_FLAG_4C db $02 - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90f run_command Func_cdcb @@ -5371,8 +5203,7 @@ ScriptSecondRonaldFight: ; e91e (3:691e) db 60 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90d - run_command ScriptCommand_PrintTextString - tx Text064f + print_text_string Text064f run_command ScriptCommand_JumpIfPlayerCoordMatches db $08 db $02 @@ -5385,40 +5216,33 @@ ScriptSecondRonaldFight: ; e91e (3:691e) db SOUTH move_player SOUTH, 1 move_player SOUTH, 1 - run_command ScriptCommand_PrintTextString - tx Text0650 + print_text_string Text0650 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_4D db $01 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db POWERFUL_RONALD_DECK_ID - db MUSIC_RONALD + start_battle PRIZES_6, POWERFUL_RONALD_DECK_ID, MUSIC_RONALD run_command ScriptCommand_QuitScriptFully Script_BeatSecondRonaldFight: ; e947 (3:6947) start_script - run_command ScriptCommand_PrintTextString - tx Text0651 + print_text_string Text0651 run_command ScriptCommand_GiveCard db SUPER_ENERGY_RETRIEVAL run_command ScriptCommand_ShowCardReceivedScreen db SUPER_ENERGY_RETRIEVAL - run_command ScriptCommand_PrintTextString - tx Text0652 + print_text_string Text0652 run_command ScriptCommand_Jump dw ScriptJump_FinishedSecondRonaldFight Script_LostToSecondRonaldFight: ; e955 (3:6955) start_script - run_command ScriptCommand_PrintTextString - tx Text0653 + print_text_string Text0653 ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_4D db $02 - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90f run_command Func_cdcb @@ -6159,35 +5983,28 @@ Script_Clerk12: ; f295 (3:7295) tx Text052a .ows_f2c7 - run_command ScriptCommand_PrintTextString - tx Text052b + print_text_string Text052b run_command ScriptCommand_Jump dw .ows_f2d6 .ows_f2cd - run_command ScriptCommand_PrintTextString - tx Text052c + print_text_string Text052c run_command ScriptCommand_Jump dw .ows_f2d6 .ows_f2d3 - run_command ScriptCommand_PrintTextString - tx Text052d + print_text_string Text052d .ows_f2d6 - run_command ScriptCommand_PrintTextString - tx Text052e - run_command ScriptCommand_AskQuestionJump - tx Text052f - dw .ows_f2e1 + print_text_string Text052e + ask_question_jump Text052f, .ows_f2e1 run_command ScriptCommand_PrintTextQuitFully tx Text0530 .ows_f2e1 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_59 - run_command ScriptCommand_PrintTextString - tx Text0531 - run_command ScriptCommand_CloseTextBox + print_text_string Text0531 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f349 run_command ScriptCommand_JumpIfPlayerCoordMatches @@ -6252,7 +6069,7 @@ Script_Clerk12: ; f295 (3:7295) move_player EAST, 1 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f34e - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db $4a dw Script_f353 @@ -6291,23 +6108,19 @@ Script_f353: ; f353 (3:7353) dw NPCMovement_f390 run_command Func_d16b db $00 - run_command ScriptCommand_PrintTextString - tx Text0532 - run_command ScriptCommand_CloseTextBox + print_text_string Text0532 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37f - run_command ScriptCommand_PrintTextString - tx Text0533 - run_command ScriptCommand_CloseTextBox + print_text_string Text0533 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f388 - run_command ScriptCommand_PrintTextString - tx Text0534 - run_command ScriptCommand_CloseTextBox + print_text_string Text0534 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f38e - run_command ScriptCommand_PrintTextString - tx Text0535 + print_text_string Text0535 run_command Func_cd4f db $04 db $00 @@ -6373,15 +6186,13 @@ LostAtChallengeHall: ; f392 (3:7392) db $00 run_command Func_d16b db $01 - run_command ScriptCommand_PrintTextString - tx Text0536 + print_text_string Text0536 .ows_f3ae - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f38b - run_command ScriptCommand_PrintTextString - tx Text0537 - run_command ScriptCommand_CloseTextBox + print_text_string Text0537 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f38e run_command ScriptCommand_JumpIfFlagEqual @@ -6423,7 +6234,7 @@ LostAtChallengeHall: ; f392 (3:7392) run_command ScriptCommand_Jump dw .ows_f3e2 .ows_f3e2 - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_CLERK12 dw Script_f3e9 @@ -6464,14 +6275,12 @@ ScriptJump_f410: ; f410 (4:7410) db $00 run_command Func_d16b db $01 - run_command ScriptCommand_PrintTextString - tx Text0538 + print_text_string Text0538 run_command ScriptCommand_Jump dw LostAtChallengeHall.ows_f3ae .ows_f41a - run_command ScriptCommand_PrintTextString - tx Text0539 + print_text_string Text0539 run_command ScriptCommand_SetDialogName db NPC_RONALD1 run_command ScriptCommand_JumpIfFlagEqual @@ -6482,9 +6291,7 @@ ScriptJump_f410: ; f410 (4:7410) db EVENT_FLAG_44 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text053a - tx Text053b + print_variable_text Text053a, Text053b .ows_f42e run_command ScriptCommand_SetDialogName db NPC_HOST @@ -6527,22 +6334,18 @@ WonAtChallengeHall: ; f441 (3:7441) db EVENT_FLAG_45 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text053c - tx Text053d + print_variable_text Text053c, Text053d run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37f run_command Func_d16b db $00 - run_command ScriptCommand_PrintTextString - tx Text053e - run_command ScriptCommand_CloseTextBox + print_text_string Text053e + close_text_box run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4c8 run_command Func_cdd8 - run_command ScriptCommand_PrintTextString - tx Text053f - run_command ScriptCommand_CloseTextBox + print_text_string Text053f + close_text_box run_command Func_d195 run_command Func_cdf5 db $14 @@ -6555,9 +6358,7 @@ WonAtChallengeHall: ; f441 (3:7441) db EVENT_FLAG_45 db $02 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0540 - tx Text0541 + print_variable_text Text0540, Text0541 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f383 run_command ScriptCommand_JumpIfFlagEqual @@ -6568,27 +6369,23 @@ WonAtChallengeHall: ; f441 (3:7441) db EVENT_FLAG_44 db $03 dw .ows_f4a1 - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_SetDialogName db $02 run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0542 - tx Text0543 + print_variable_text Text0542, Text0543 run_command ScriptCommand_SetDialogName db NPC_HOST - run_command ScriptCommand_CloseTextBox + close_text_box .ows_f4a1 - run_command ScriptCommand_PrintTextString - tx Text0544 + print_text_string Text0544 .ows_f4a4 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_47 - run_command ScriptCommand_PrintTextString - tx Text0545 + print_text_string Text0545 run_command ScriptCommand_AskQuestionJumpDefaultYes tx Text0546 dw .ows_f4bd @@ -6596,22 +6393,19 @@ WonAtChallengeHall: ; f441 (3:7441) db EVENT_FLAG_45 db $02 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text0547 - tx Text0548 + print_variable_text Text0547, Text0548 run_command Func_cd4f db $04 db $00 db $00 run_command ScriptCommand_QuitScriptFully .ows_f4bd - run_command ScriptCommand_PrintTextString - tx Text0549 - run_command ScriptCommand_CloseTextBox + print_text_string Text0549 + close_text_box run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_47 run_command Func_d1ad - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_Jump dw .ows_f4a4 @@ -6642,15 +6436,13 @@ NPCMovement_f4d8: ; f4d8 (3:74d8) db $ff ScriptJump_f4db: ; f4db (3:74db) - run_command ScriptCommand_PrintTextString - tx Text054a + print_text_string Text054a run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37f run_command Func_d16b db $00 - run_command ScriptCommand_PrintTextString - tx Text054b - run_command ScriptCommand_CloseTextBox + print_text_string Text054b + close_text_box run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $03 @@ -6661,9 +6453,7 @@ ScriptJump_f4db: ; f4db (3:74db) db EVENT_FLAG_44 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text054c - tx Text054d + print_variable_text Text054c, Text054d run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4d8 run_command ScriptCommand_DoFrames @@ -6674,12 +6464,10 @@ ScriptJump_f4db: ; f4db (3:74db) db EVENT_FLAG_44 db $01 dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text054e - tx Text054f + print_variable_text Text054e, Text054f run_command ScriptCommand_SetDialogName db NPC_HOST - run_command ScriptCommand_CloseTextBox + close_text_box run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4c9 run_command ScriptCommand_Jump @@ -6691,21 +6479,18 @@ ScriptJump_f4db: ; f4db (3:74db) run_command Func_cdd8 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f383 - run_command ScriptCommand_PrintTextString - tx Text0550 - run_command ScriptCommand_CloseTextBox + print_text_string Text0550 + close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f38b run_command Func_d1b3 - run_command ScriptCommand_PrintTextString - tx Text0551 + print_text_string Text0551 run_command ScriptCommand_GiveCard db $00 run_command ScriptCommand_ShowCardReceivedScreen db $00 - run_command ScriptCommand_PrintTextString - tx Text0552 - run_command ScriptCommand_CloseTextBox + print_text_string Text0552 + close_text_box run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $02 @@ -6741,7 +6526,7 @@ ScriptJump_f4db: ; f4db (3:74db) run_command ScriptCommand_Jump dw .ows_f552 .ows_f552 - run_command ScriptCommand_CloseAdvancedTextBox + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db NPC_CLERK12 dw Script_f3e9 @@ -6820,9 +6605,8 @@ Func_f602: ; f602 (3:7602) Script_f631: ; f631 (3:7631) start_script - run_command ScriptCommand_PrintTextString - tx Text0508 - run_command ScriptCommand_CloseAdvancedTextBox + print_text_string Text0508 + close_advanced_text_box run_command ScriptCommand_SetNextNPCandScript db $02 dw $763c @@ -6937,8 +6721,7 @@ PointerTable_fc4c: ; fc4c (3:7c4c) Script_fc52: ; fc52 (3:7c52) start_script - run_command ScriptCommand_PrintTextString - tx Text06c8 + print_text_string Text06c8 run_command ScriptCommand_AskQuestionJumpDefaultYes dw $0000 dw .ows_fc5e @@ -6980,21 +6763,18 @@ Func_fc7a: ; fc7a (3:7c7a) db EVENT_FLAG_74 db $02 dw Func_fcad.ows_fcd5 - run_command ScriptCommand_PrintTextString - tx Text06cd + print_text_string Text06cd run_command Func_d39d db $00 run_command ScriptCommand_JumpIfFlagNotLessThan db EVENT_FLAG_72 db $04 dw Func_fc7a.ows_fcaa - run_command ScriptCommand_PrintTextString - tx Text06ce + print_text_string Text06ce run_command ScriptCommand_AskQuestionJumpDefaultYes tx Text06cf dw .ows_fca0 - run_command ScriptCommand_PrintTextString - tx Text06d0 + print_text_string Text06d0 run_command ScriptCommand_Jump dw Func_fc7a.ows_fcaa @@ -7054,8 +6834,7 @@ Func_fcad: ; fcad (3:7cad) run_command ScriptCommand_MoveArbitraryNPC db NPC_GIFT_CENTER_CLERK dw NPCMovement_fce1 - run_command ScriptCommand_PrintTextString - tx Text06d6 + print_text_string Text06d6 run_command ScriptCommand_MoveArbitraryNPC db NPC_GIFT_CENTER_CLERK dw NPCMovement_fce3 diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index cb3c8a8..a9bd3a9 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -114,6 +114,34 @@ ENDM end_script_loop: MACRO run_command ScriptCommand_EndScriptLoop1 ENDM +close_advanced_text_box: MACRO + run_command ScriptCommand_CloseAdvancedTextBox +ENDM +print_text_string: MACRO + run_command ScriptCommand_PrintTextString + tx \1 +ENDM + +ask_question_jump: MACRO + run_command ScriptCommand_AskQuestionJump + tx \1 + dw \2 +ENDM +start_battle: MACRO + run_command ScriptCommand_StartBattle + db \1 + db \2 + db \3 +ENDM +print_variable_text: MACRO + run_command ScriptCommand_PrintVariableText + tx \1 + tx \2 +ENDM + +close_text_box: MACRO + run_command ScriptCommand_CloseTextBox +ENDM move_player: MACRO run_command ScriptCommand_MovePlayer diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 54a20b3..3d84e01 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -135,8 +135,8 @@ def decodeLine(scriptList, game_data, loc, ignore_broken, locList): else: print("UNACCEPTED CHARACTER: " + c) # if in macro mode, remove the extra `, ` from the end - if macroMode: - ret = ret[:-1] + if ret[-2:] == ", ": + ret = ret[:-1] return (loc, ret, quit) def main(): @@ -214,17 +214,17 @@ def createList(): # this is a func just so all this can go at the bottom # name, arg list, is an ender return [ ("ScriptCommand_EndScriptLoop1", "", QUIT_CONTINUE_CODE,"end_script_loop"), - ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT,""), - ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT,""), + ("ScriptCommand_CloseAdvancedTextBox", "", DO_NOT_QUIT,"close_advanced_text_box"), + ("ScriptCommand_PrintTextString", "t", DO_NOT_QUIT,"print_text_string"), ("Func_ccdc", "t", DO_NOT_QUIT,""), - ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT,""), # more complex behavior too (jumping) - ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT,""), - ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT,""), + ("ScriptCommand_AskQuestionJump", "tj", DO_NOT_QUIT,"ask_question_jump"), # more complex behavior too (jumping) + ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT,"start_battle"), + ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT,"print_variable_text"), ("Func_cda8", "bbbb", DO_NOT_QUIT,""), ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL,""), ("Func_cdcb", "", DO_NOT_QUIT,""), ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT,""), - ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT,""), + ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT,"close_text_box"), ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT,""), ("ScriptCommand_CheckIfCardInCollectionOrDecks", "bj", DO_NOT_QUIT,""), # more complex behavior too (jumping) ("ScriptCommand_CheckIfCardInCollection", "bj", DO_NOT_QUIT,""), -- cgit v1.2.3 From ef676eb46802db828ec831e95a6d26ae4e977c36 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sat, 19 Dec 2020 00:55:39 -0500 Subject: Added more macros, changed the name of a couple --- src/engine/bank03.asm | 283 ++++++++++++++-------------------------------- src/engine/bank04.asm | 6 +- src/engine/home.asm | 2 +- src/macros/scripts.asm | 31 ++++- tools/script_extractor.py | 12 +- 5 files changed, 126 insertions(+), 208 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 3f78a5c..77a4771 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2214,12 +2214,12 @@ ScriptCommand_ShowCardReceivedScreen: ; cee2 (3:4ee2) xor a jr .asm_cef0 -ScriptCommand_CheckIfCardInCollectionOrDecks: ; cf0c (3:4f0c) +ScriptCommand_JumpIfCardOwned: ; cf0c (3:4f0c) ld a, c call GetCardCountInCollectionAndDecks jr asm_cf16 -ScriptCommand_CheckIfCardInCollection: ; cf12 (3:4f12) +ScriptCommand_JumpIfCardInCollection: ; cf12 (3:4f12) ld a, c call GetCardCountInCollection @@ -2240,11 +2240,11 @@ asm_cf1f: asm_cf2a: jp IncreaseScriptPointerBy4 -ScriptCommand_CheckRawAmountOfCardsOwned: ; cf2d (3:4f2d) +ScriptCommand_CheckAmountOfCardsOwned: ; cf2d (3:4f2d) push bc call IncreaseScriptPointerBy1 pop bc - call GetRawAmountOfCardsOwned + call GetAmountOfCardsOwned ld a, h cp b jr nz, .asm_cf3b @@ -3580,12 +3580,10 @@ Script_Ishihara: ; db4a (3:5b4a) run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_39 .ows_db8d - run_command ScriptCommand_PrintTextQuitFully - tx Text0727 + print_text_quit_fully Text0727 .ows_db90 - run_command ScriptCommand_PrintTextQuitFully - tx Text0728 + print_text_quit_fully Text0728 .ows_db93 run_command ScriptCommand_JumpIfFlagEqual @@ -3597,22 +3595,15 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $02 ask_question_jump Text072b, .check_ifhave_clefable_incollectionordecks - run_command ScriptCommand_PrintTextQuitFully - tx Text072c + print_text_quit_fully Text072c .check_ifhave_clefable_incollectionordecks - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db CLEFABLE - dw .check_ifhave_clefable_incollectiononly - run_command ScriptCommand_PrintTextQuitFully - tx Text072d + jump_if_cardowned CLEFABLE, .check_ifhave_clefable_incollectiononly + print_text_quit_fully Text072d .check_ifhave_clefable_incollectiononly - run_command ScriptCommand_CheckIfCardInCollection - db CLEFABLE - dw .do_clefable_trade - run_command ScriptCommand_PrintTextQuitFully - tx Text072e + jump_if_card_in_collection CLEFABLE, .do_clefable_trade + print_text_quit_fully Text072e .do_clefable_trade run_command ScriptCommand_MaxOutFlagValue @@ -3631,8 +3622,7 @@ Script_Ishihara: ; db4a (3:5b4a) db SURFING_PIKACHU1 run_command ScriptCommand_ShowCardReceivedScreen db SURFING_PIKACHU1 - run_command ScriptCommand_PrintTextQuitFully - tx Text0731 + print_text_quit_fully Text0731 .ows_dbcc run_command ScriptCommand_JumpIfFlagEqual @@ -3644,22 +3634,15 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $04 ask_question_jump Text072b, .check_ifhave_ditto_incollectionordecks - run_command ScriptCommand_PrintTextQuitFully - tx Text072c + print_text_quit_fully Text072c .check_ifhave_ditto_incollectionordecks - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db DITTO - dw .check_ifhave_ditto_incollectiononly - run_command ScriptCommand_PrintTextQuitFully - tx Text0734 + jump_if_cardowned DITTO, .check_ifhave_ditto_incollectiononly + print_text_quit_fully Text0734 .check_ifhave_ditto_incollectiononly - run_command ScriptCommand_CheckIfCardInCollection - db DITTO - dw .do_ditto_trade - run_command ScriptCommand_PrintTextQuitFully - tx Text0735 + jump_if_card_in_collection DITTO, .do_ditto_trade + print_text_quit_fully Text0735 .do_ditto_trade run_command ScriptCommand_MaxOutFlagValue @@ -3678,8 +3661,7 @@ Script_Ishihara: ; db4a (3:5b4a) db FLYING_PIKACHU run_command ScriptCommand_ShowCardReceivedScreen db FLYING_PIKACHU - run_command ScriptCommand_PrintTextQuitFully - tx Text0737 + print_text_quit_fully Text0737 .ows_dc05 run_command ScriptCommand_JumpIfFlagEqual @@ -3691,22 +3673,15 @@ Script_Ishihara: ; db4a (3:5b4a) db EVENT_FLAG_1F db $06 ask_question_jump Text072b, .check_ifhave_chansey_incollectionordecks - run_command ScriptCommand_PrintTextQuitFully - tx Text072c + print_text_quit_fully Text072c .check_ifhave_chansey_incollectionordecks - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db CHANSEY - dw .check_ifhave_chansey_incollectiononly - run_command ScriptCommand_PrintTextQuitFully - tx Text073a + jump_if_cardowned CHANSEY, .check_ifhave_chansey_incollectiononly + print_text_quit_fully Text073a .check_ifhave_chansey_incollectiononly - run_command ScriptCommand_CheckIfCardInCollection - db CHANSEY - dw .do_chansey_trade - run_command ScriptCommand_PrintTextQuitFully - tx Text073b + jump_if_card_in_collection CHANSEY, .do_chansey_trade + print_text_quit_fully Text073b .do_chansey_trade run_command ScriptCommand_MaxOutFlagValue @@ -3725,14 +3700,12 @@ Script_Ishihara: ; db4a (3:5b4a) db SURFING_PIKACHU2 run_command ScriptCommand_ShowCardReceivedScreen db SURFING_PIKACHU2 - run_command ScriptCommand_PrintTextQuitFully - tx Text073d + print_text_quit_fully Text073d .ows_dc3e run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_39 - run_command ScriptCommand_PrintTextQuitFully - tx Text073e + print_text_quit_fully Text073e Preload_Ronald1InIshiharasHouse: ; dc43 (3:5c43) get_flag_value EVENT_RECEIVED_LEGENDARY_CARD @@ -3747,18 +3720,15 @@ Script_Ronald: ; dc4b (3:5c4b) dw .ows_dc55 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_4E - run_command ScriptCommand_PrintTextQuitFully - tx Text073f + print_text_quit_fully Text073f .ows_dc55 print_text_string Text0740 ask_question_jump Text0741, .ows_dc60 - run_command ScriptCommand_PrintTextQuitFully - tx Text0742 + print_text_quit_fully Text0742 .ows_dc60 - run_command ScriptCommand_PrintTextQuitFully - tx Text0743 + print_text_quit_fully Text0743 ; could be a commented function, or could be placed by mistake from ; someone thinking that the Ronald script ended with more code execution @@ -3766,8 +3736,7 @@ Script_Ronald: ; dc4b (3:5c4b) Script_Clerk1: ; dc64 (3:5c64) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text045a + print_text_quit_fully Text045a FightingClubLobbyAfterDuel: ; dc68 (3:5c68) ld hl, .after_duel_table @@ -4163,16 +4132,12 @@ Script_Gal1: ; e0cf (3:60cf) run_command ScriptCommand_QuitScriptFully .ows_e0eb - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db $59 - dw .ows_e0f3 + jump_if_cardowned $59, .ows_e0f3 print_text_string Text0421 run_command ScriptCommand_QuitScriptFully .ows_e0f3 - run_command ScriptCommand_CheckIfCardInCollection - db $59 - dw .ows_e0fb + jump_if_card_in_collection $59, .ows_e0fb print_text_string Text0422 run_command ScriptCommand_QuitScriptFully @@ -4193,8 +4158,7 @@ Script_Gal1: ; e0cf (3:60cf) run_command ScriptCommand_QuitScriptFully .ows_e10e - run_command ScriptCommand_PrintTextQuitFully - tx Text0426 + print_text_quit_fully Text0426 Script_Lass1: ; e111 (3:6111) start_script @@ -4219,12 +4183,10 @@ Script_Lass1: ; e111 (3:6111) run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_TEMP_BATTLED_IMAKUNI dw .ows_e12d - run_command ScriptCommand_PrintTextQuitFully - tx Text0428 + print_text_quit_fully Text0428 .ows_e12d - run_command ScriptCommand_PrintTextQuitFully - tx Text0429 + print_text_quit_fully Text0429 Preload_Man2InWaterClubLobby: ; e130 (3:6130) get_flag_value EVENT_JOSHUA_STATE @@ -4233,13 +4195,11 @@ Preload_Man2InWaterClubLobby: ; e130 (3:6130) Script_Man2: ; e137 (3:6137) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text042a + print_text_quit_fully Text042a Script_Pappy2: ; e13b (3:613b) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text042b + print_text_quit_fully Text042b WaterClubMovePlayer: ; e13f (3:613f) ld a, [wPlayerYCoord] @@ -4296,17 +4256,13 @@ Script_BeatSara: ; e18c (3:618c) run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_SARA print_text_string Text0430 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_COLOSSEUM_WATER - db BOOSTER_COLOSSEUM_WATER - db NO_BOOSTER + give_booster_packs BOOSTER_COLOSSEUM_WATER, BOOSTER_COLOSSEUM_WATER, NO_BOOSTER print_text_string Text0431 run_command ScriptCommand_QuitScriptFully Script_LostToSara: ; e19a (03:619a) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0432 + print_text_quit_fully Text0432 Script_Amanda: ; e19e (03:619e) start_script @@ -4324,17 +4280,13 @@ Script_BeatAmanda: ; e1b3 (03:61b3) run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_AMANDA print_text_string Text0437 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_MYSTERY_LIGHTNING_COLORLESS - db BOOSTER_MYSTERY_LIGHTNING_COLORLESS - db NO_BOOSTER + give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER print_text_string Text0438 run_command ScriptCommand_QuitScriptFully Script_LostToAmanda: ; e1c1 (03:61c1) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0439 + print_text_quit_fully Text0439 Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) start_script @@ -4492,10 +4444,7 @@ Script_BeatJoshua: ; e26c (3:626c) db JOSHUA_TALKED dw NO_JUMP print_variable_text Text0445, Text0446 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_MYSTERY_WATER_COLORLESS - db BOOSTER_MYSTERY_WATER_COLORLESS - db NO_BOOSTER + give_booster_packs BOOSTER_MYSTERY_WATER_COLORLESS, BOOSTER_MYSTERY_WATER_COLORLESS, NO_BOOSTER run_command ScriptCommand_JumpIfFlagEqual db EVENT_JOSHUA_STATE db JOSHUA_TALKED @@ -4513,8 +4462,7 @@ Script_BeatJoshua: ; e26c (3:626c) db JOSHUA_BEATEN print_text_string Text0449 close_text_box - run_command ScriptCommand_MoveActiveNPCByDirection - dw NPCMovementTable_e2a1 + move_active_npc_by_direction NPCMovementTable_e2a1 print_text_string Text044a run_command Func_cfc6 db $00 @@ -4634,10 +4582,7 @@ Script_BeatAmy: ; e322 (3:6322) db $03 print_text_string Text0455 .beatAmyCommon - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_LABORATORY_WATER - db BOOSTER_LABORATORY_WATER - db NO_BOOSTER + give_booster_packs BOOSTER_LABORATORY_WATER, BOOSTER_LABORATORY_WATER, NO_BOOSTER print_text_string Text0456 run_command Func_d0d9 db $14 @@ -4805,10 +4750,7 @@ Script_Brittany: ; e5d2 (3:65d2) Script_BeatBrittany: ; e5ee (3:65ee) start_script print_text_string Text06e5 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_MYSTERY_GRASS_COLORLESS - db BOOSTER_MYSTERY_GRASS_COLORLESS - db NO_BOOSTER + give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER run_command ScriptCommand_JumpIfFlagLessThan db EVENT_FLAG_35 db $02 @@ -4837,12 +4779,10 @@ Script_BeatBrittany: ; e5ee (3:65ee) Script_LostToBrittany: ; e618 (3:6618) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text06e9 + print_text_quit_fully Text06e9 Script_e61c: ; e61c (3:661c) - run_command ScriptCommand_PrintTextQuitFully - tx Text06ea + print_text_quit_fully Text06ea Script_Lass2: ; e61f (3:661f) start_script @@ -4870,22 +4810,15 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $01 ask_question_jump Text06ed, .ows_e648 - run_command ScriptCommand_PrintTextQuitFully - tx Text06ee + print_text_quit_fully Text06ee .ows_e648 - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db $1c - dw .ows_e64f - run_command ScriptCommand_PrintTextQuitFully - tx Text06ef + jump_if_cardowned $1c, .ows_e64f + print_text_quit_fully Text06ef .ows_e64f - run_command ScriptCommand_CheckIfCardInCollection - db $1c - dw .ows_e656 - run_command ScriptCommand_PrintTextQuitFully - tx Text06f0 + jump_if_card_in_collection $1c, .ows_e656 + print_text_quit_fully Text06f0 .ows_e656 run_command ScriptCommand_MaxOutFlagValue @@ -4902,8 +4835,7 @@ Script_Lass2: ; e61f (3:661f) db VILEPLUME run_command ScriptCommand_ShowCardReceivedScreen db VILEPLUME - run_command ScriptCommand_PrintTextQuitFully - tx Text06f3 + print_text_quit_fully Text06f3 .ows_e66a run_command ScriptCommand_JumpIfFlagEqual @@ -4915,22 +4847,15 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $03 ask_question_jump Text06ed, .ows_e67f - run_command ScriptCommand_PrintTextQuitFully - tx Text06f6 + print_text_quit_fully Text06f6 .ows_e67f - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db $ab - dw .ows_e686 - run_command ScriptCommand_PrintTextQuitFully - tx Text06f7 + jump_if_cardowned $ab, .ows_e686 + print_text_quit_fully Text06f7 .ows_e686 - run_command ScriptCommand_CheckIfCardInCollection - db $ab - dw .ows_e68d - run_command ScriptCommand_PrintTextQuitFully - tx Text06f8 + jump_if_card_in_collection $ab, .ows_e68d + print_text_quit_fully Text06f8 .ows_e68d run_command ScriptCommand_MaxOutFlagValue @@ -4947,8 +4872,7 @@ Script_Lass2: ; e61f (3:661f) db PIKACHU3 run_command ScriptCommand_ShowCardReceivedScreen db PIKACHU3 - run_command ScriptCommand_PrintTextQuitFully - tx Text06f3 + print_text_quit_fully Text06f3 .ows_e6a1 run_command ScriptCommand_JumpIfFlagEqual @@ -4960,22 +4884,15 @@ Script_Lass2: ; e61f (3:661f) db EVENT_FLAG_37 db $05 ask_question_jump Text06ed, .ows_e6b6 - run_command ScriptCommand_PrintTextQuitFully - tx Text06fd + print_text_quit_fully Text06fd .ows_e6b6 - run_command ScriptCommand_CheckIfCardInCollectionOrDecks - db $32 - dw .ows_e6bd - run_command ScriptCommand_PrintTextQuitFully - tx Text06fe + jump_if_cardowned CHARIZARD, .ows_e6bd + print_text_quit_fully Text06fe .ows_e6bd - run_command ScriptCommand_CheckIfCardInCollection - db $32 - dw .ows_e6c4 - run_command ScriptCommand_PrintTextQuitFully - tx Text06ff + jump_if_card_in_collection CHARIZARD, .ows_e6c4 + print_text_quit_fully Text06ff .ows_e6c4 run_command ScriptCommand_MaxOutFlagValue @@ -4992,8 +4909,7 @@ Script_Lass2: ; e61f (3:661f) db BLASTOISE run_command ScriptCommand_ShowCardReceivedScreen db BLASTOISE - run_command ScriptCommand_PrintTextQuitFully - tx Text06f3 + print_text_quit_fully Text06f3 ; 0xe6d8 Script_Granny2: ; e6d8 (3:66d8) @@ -5481,7 +5397,7 @@ Script_Ken: ; ef22 (3:6f22) run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_23 dw .have_300_cards - run_command ScriptCommand_CheckRawAmountOfCardsOwned + run_command ScriptCommand_CheckAmountOfCardsOwned dw 300 dw .have_300_cards run_command ScriptCommand_JumpIfFlagZero1 @@ -5713,24 +5629,19 @@ Script_Clerk9: ; f025 (3:7025) db $01 dw .ows_f06c .ows_f066 - run_command ScriptCommand_PrintTextQuitFully - tx Text050a + print_text_quit_fully Text050a .ows_f069 - run_command ScriptCommand_PrintTextQuitFully - tx Text050b + print_text_quit_fully Text050b .ows_f06c - run_command ScriptCommand_PrintTextQuitFully - tx Text050c + print_text_quit_fully Text050c .ows_f06f - run_command ScriptCommand_PrintTextQuitFully - tx Text050d + print_text_quit_fully Text050d .ows_f072 - run_command ScriptCommand_PrintTextQuitFully - tx Text050e + print_text_quit_fully Text050e Preload_ChallengeHallNPCs2: ; f075 (3:7075) call Preload_ChallengeHallNPCs1 @@ -5759,33 +5670,27 @@ ChallengeHallLobbyLoadMap: ; f088 (3:7088) Script_Pappy3: ; f09c (3:709c) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text050f + print_text_quit_fully Text050f Script_Gal4: ; f0a0 (3:70a0) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0510 + print_text_quit_fully Text0510 Script_Champ: ; f0a4 (3:70a4) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0511 + print_text_quit_fully Text0511 Script_Hood2: ; f0a8 (3:70a8) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0512 + print_text_quit_fully Text0512 Script_Lass5: ; f0ac (3:70ac) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0513 + print_text_quit_fully Text0513 Script_Chap5: ; f0b0 (3:70b0) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0514 + print_text_quit_fully Text0514 Preload_ChallengeHallLobbyRonald1: ; f0b4 (3:70b4) zero_flag_value2 EVENT_FLAG_58 @@ -5903,8 +5808,7 @@ ChallengeHallLoadMap: ; f258 (3:7258) Script_Clerk13: ; f26c (3:726c) start_script - run_command ScriptCommand_PrintTextQuitFully - tx Text0525 + print_text_quit_fully Text0525 Preload_Guide: ; f270 (3:7270) get_flag_value EVENT_FLAG_42 @@ -5923,19 +5827,16 @@ Script_Guide: ; f283 (3:7283) run_command ScriptCommand_JumpIfFlagZero2 db EVENT_FLAG_42 dw .ows_f28b - run_command ScriptCommand_PrintTextQuitFully - tx Text0526 + print_text_quit_fully Text0526 .ows_f28b run_command ScriptCommand_JumpIfFlagZero1 db $3f dw .ows_f292 - run_command ScriptCommand_PrintTextQuitFully - tx Text0527 + print_text_quit_fully Text0527 .ows_f292 - run_command ScriptCommand_PrintTextQuitFully - tx Text0528 + print_text_quit_fully Text0528 Script_Clerk12: ; f295 (3:7295) start_script @@ -5975,12 +5876,10 @@ Script_Clerk12: ; f295 (3:7295) dw .ows_f2c7 .ows_f2c1 - run_command ScriptCommand_PrintTextQuitFully - tx Text0529 + print_text_quit_fully Text0529 .ows_f2c4 - run_command ScriptCommand_PrintTextQuitFully - tx Text052a + print_text_quit_fully Text052a .ows_f2c7 print_text_string Text052b @@ -5997,8 +5896,7 @@ Script_Clerk12: ; f295 (3:7295) .ows_f2d6 print_text_string Text052e ask_question_jump Text052f, .ows_f2e1 - run_command ScriptCommand_PrintTextQuitFully - tx Text0530 + print_text_quit_fully Text0530 .ows_f2e1 run_command ScriptCommand_MaxOutFlagValue @@ -6725,8 +6623,7 @@ Script_fc52: ; fc52 (3:7c52) run_command ScriptCommand_AskQuestionJumpDefaultYes dw $0000 dw .ows_fc5e - run_command ScriptCommand_PrintTextQuitFully - tx Text06c9 + print_text_quit_fully Text06c9 .ows_fc5e run_command Func_cd76 @@ -6790,8 +6687,7 @@ Func_fc7a: ; fc7a (3:7c7a) run_command ScriptCommand_QuitScriptFully .ows_fcaa - run_command ScriptCommand_PrintTextQuitFully - tx Text06d2 + print_text_quit_fully Text06d2 Func_fcad: ; fcad (3:7cad) ld a, [wd10e] @@ -6819,16 +6715,13 @@ Func_fcad: ; fcad (3:7cad) dw Func_fc7a.ows_fcaa .ows_fccc - run_command ScriptCommand_PrintTextQuitFully - tx Text06d3 + print_text_quit_fully Text06d3 .ows_fccf - run_command ScriptCommand_PrintTextQuitFully - tx Text06d4 + print_text_quit_fully Text06d4 .ows_fcd2 - run_command ScriptCommand_PrintTextQuitFully - tx Text06d5 + print_text_quit_fully Text06d5 .ows_fcd5 run_command ScriptCommand_MoveArbitraryNPC diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index a1e504f..45aef8f 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -981,13 +981,13 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_MoveActiveNPCByDirection dw ScriptCommand_CloseTextBox dw ScriptCommand_GiveBoosterPacks - dw ScriptCommand_CheckIfCardInCollectionOrDecks - dw ScriptCommand_CheckIfCardInCollection + dw ScriptCommand_JumpIfCardOwned + dw ScriptCommand_JumpIfCardInCollection dw ScriptCommand_GiveCard dw ScriptCommand_TakeCard dw Func_cf53 dw Func_cf7b - dw ScriptCommand_CheckRawAmountOfCardsOwned + dw ScriptCommand_CheckAmountOfCardsOwned dw ScriptCommand_JumpBasedOnFightingClubPupilStatus dw Func_cfc6 dw Func_cfd4 diff --git a/src/engine/home.asm b/src/engine/home.asm index ff887fd..d04081e 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -5280,7 +5280,7 @@ CopyOpponentName: ; 1c8e (0:1c8e) jp CopyText ; return, in hl, the total amount of cards owned anywhere, including duplicates -GetRawAmountOfCardsOwned: ; 1caa (0:1caa) +GetAmountOfCardsOwned: ; 1caa (0:1caa) push de push bc call EnableSRAM diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index a9bd3a9..77acd84 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -18,13 +18,13 @@ ENDM const ScriptCommand_MoveActiveNPCByDirection_index ; $0a const ScriptCommand_CloseTextBox_index ; $0b const ScriptCommand_GiveBoosterPacks_index ; $0c - const ScriptCommand_CheckIfCardInCollectionOrDecks_index ; $0d - const ScriptCommand_CheckIfCardInCollection_index ; $0e + const ScriptCommand_JumpIfCardOwned_index ; $0d + const ScriptCommand_JumpIfCardInCollection_index ; $0e const ScriptCommand_GiveCard_index ; $0f const ScriptCommand_TakeCard_index ; $10 const Func_cf53_index ; $11 const Func_cf7b_index ; $12 - const ScriptCommand_CheckRawAmountOfCardsOwned_index ; $13 + const ScriptCommand_CheckAmountOfCardsOwned_index ; $13 const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 const Func_cfc6_index ; $15 const Func_cfd4_index ; $16 @@ -139,9 +139,34 @@ print_variable_text: MACRO tx \2 ENDM +print_text_quit_fully: MACRO + run_command ScriptCommand_PrintTextQuitFully + tx \1 +ENDM + +move_active_npc_by_direction: MACRO + run_command ScriptCommand_MoveActiveNPCByDirection + dw \1 +ENDM close_text_box: MACRO run_command ScriptCommand_CloseTextBox ENDM +give_booster_packs: MACRO + run_command ScriptCommand_GiveBoosterPacks + db \1 + db \2 + db \3 +ENDM +jump_if_cardowned: MACRO + run_command ScriptCommand_JumpIfCardOwned + db \1 + dw \2 +ENDM +jump_if_card_in_collection: MACRO + run_command ScriptCommand_JumpIfCardInCollection + db \1 + dw \2 +ENDM move_player: MACRO run_command ScriptCommand_MovePlayer diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 3d84e01..40d252e 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -221,18 +221,18 @@ def createList(): # this is a func just so all this can go at the bottom ("ScriptCommand_StartBattle", "bbb", DO_NOT_QUIT,"start_battle"), ("ScriptCommand_PrintVariableText", "tt", DO_NOT_QUIT,"print_variable_text"), ("Func_cda8", "bbbb", DO_NOT_QUIT,""), - ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL,""), + ("ScriptCommand_PrintTextQuitFully", "t", QUIT_SPECIAL,"print_text_quit_fully"), ("Func_cdcb", "", DO_NOT_QUIT,""), - ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT,""), + ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT,"move_active_npc_by_direction"), ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT,"close_text_box"), - ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT,""), - ("ScriptCommand_CheckIfCardInCollectionOrDecks", "bj", DO_NOT_QUIT,""), # more complex behavior too (jumping) - ("ScriptCommand_CheckIfCardInCollection", "bj", DO_NOT_QUIT,""), + ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT,"give_booster_packs"), + ("ScriptCommand_JumpIfCardOwned", "bj", DO_NOT_QUIT,"jump_if_card_owned"), # more complex behavior too (jumping) + ("ScriptCommand_JumpIfCardInCollection", "bj", DO_NOT_QUIT,"jump_if_card_in_collection"), ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT,""), ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT,""), ("Func_cf53", "w", DO_NOT_QUIT,""), # more complex behavior too (jumping) ("Func_cf7b", "", DO_NOT_QUIT,""), - ("ScriptCommand_CheckRawAmountOfCardsOwned", "bbbb", DO_NOT_QUIT,""), # more complex behavior too (jumping + ??) + ("ScriptCommand_CheckAmountOfCardsOwned", "bbbb", DO_NOT_QUIT,""), # more complex behavior too (jumping + ??) ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "w", DO_NOT_QUIT,""), # only jumps? still needs args to do that though ("Func_cfc6", "b", DO_NOT_QUIT,""), ("Func_cfd4", "", DO_NOT_QUIT,""), -- cgit v1.2.3 From 3f33b4757c580fec05ec53f647ed6a2a0914aa77 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 20 Dec 2020 00:52:47 -0500 Subject: Added more scripts, fixed some spacing, renamed some scripts --- src/constants/script_constants.asm | 2 + src/engine/bank03.asm | 903 +++++++++++++++---------------------- src/engine/bank04.asm | 6 +- src/macros/scripts.asm | 49 +- tools/script_extractor.py | 24 +- 5 files changed, 439 insertions(+), 545 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index 9607ba0..ffdd0c6 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -145,3 +145,5 @@ EAST EQU $01 SOUTH EQU $02 WEST EQU $03 NO_MOVE EQU %10000000 ; For rotations without movement + +VARIABLE_CARD EQU 0 ; use the card located in wd697 instead of using the script's argument diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 77a4771..b8563b3 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2240,7 +2240,7 @@ asm_cf1f: asm_cf2a: jp IncreaseScriptPointerBy4 -ScriptCommand_CheckAmountOfCardsOwned: ; cf2d (3:4f2d) +ScriptCommand_JumpIfEnoughCardsOwned: ; cf2d (3:4f2d) push bc call IncreaseScriptPointerBy1 pop bc @@ -2461,12 +2461,12 @@ ScriptCommand_MovePlayer: ; 505c (3:505c) call SetScreenScroll jp IncreaseScriptPointerBy3 -ScriptCommand_SetDialogName: ; d080 (3:5080) +ScriptCommand_SetDialogNPC: ; d080 (3:5080) ld a, c farcall SetNPCDialogName jp IncreaseScriptPointerBy2 -ScriptCommand_SetNextNPCandScript: ; d088 (3:5088) +ScriptCommand_SetNextNPCAndScript: ; d088 (3:5088) ld a, c ld [wTempNPC], a call GetScriptArgs2AfterPointer @@ -3148,11 +3148,9 @@ Func_d4fb: ; d4fb (3:54fb) Script_BeginGame: ; d52e (3:552e) start_script - run_command ScriptCommand_DoFrames - db $3c + do_frames $3c run_command Func_d3e0 - run_command ScriptCommand_DoFrames - db $78 + do_frames $78 run_command ScriptCommand_EnterMap db $02 db MASON_LABORATORY @@ -3245,9 +3243,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) move_player NORTH, 2 print_text_string Text05e3 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_SAM - dw Script_d779 + set_next_npc_and_script NPC_SAM, Script_d779 end_script_loop ret @@ -3256,20 +3252,16 @@ Script_d779: ; d779 (03:5779) run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d880 print_text_string Text05e4 - run_command ScriptCommand_SetDialogName - db NPC_DRMASON + set_dialog_npc NPC_DRMASON print_text_string Text05e5 close_text_box run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d882 run_command Func_cfc6 db $01 - run_command ScriptCommand_SetPlayerDirection - db $03 + set_player_direction WEST close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_DRMASON - dw Script_d794 + set_next_npc_and_script NPC_DRMASON, Script_d794 end_script_loop ret @@ -3277,24 +3269,20 @@ Script_d794: ; d794 (3:5794) start_script run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d88b - run_command ScriptCommand_DoFrames - db 40 + do_frames 40 print_text_string Text05e6 close_text_box move_player WEST, 1 move_player WEST, 1 - run_command ScriptCommand_SetPlayerDirection - db SOUTH + set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 move_player SOUTH, 1 - run_command ScriptCommand_SetPlayerDirection - db WEST + set_player_direction WEST run_command ScriptCommand_MoveActiveNPC dw NPCMovement_d894 print_text_string Text05e7 - run_command ScriptCommand_SetDialogName - db $07 + set_dialog_npc $07 print_text_string Text05e8 .ows_d7bc @@ -3330,59 +3318,48 @@ Script_d794: ; d794 (3:5794) db $06 dw .ows_d806 print_text_string Text05d6 - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d7e8 print_text_string Text05d7 - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d7ee print_text_string Text05d8 - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d7f4 print_text_string Text05d9 - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d7fa print_text_string Text05da - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d800 print_text_string Text05db - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d806 print_text_string Text05dc - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d80c print_text_string Text05e9 run_command ScriptCommand_AskQuestionJumpDefaultYes dw 0000 dw .ows_d817 - run_command ScriptCommand_Jump - dw .ows_d7bc + script_jump .ows_d7bc .ows_d817 - run_command ScriptCommand_SetDialogName - db $01 + set_dialog_npc $01 print_text_string Text05ea run_command ScriptCommand_nop run_command ScriptCommand_SetFlagValue db EVENT_FLAG_3E db $01 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_SAM - dw Script_d827 + set_next_npc_and_script NPC_SAM, Script_d827 end_script_loop ret @@ -3395,34 +3372,31 @@ Script_d827: ; d827 (3:5827) INCROM $d82d, $d834 AfterTutorialBattleScript: ; d834 (3:5834) - start_script - run_command ScriptCommand_PrintTextString - tx Text05eb - run_command ScriptCommand_PrintTextString - tx Text05ef - close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d896 - run_command ScriptCommand_SetPlayerDirection - db NORTH - move_player NORTH, 1 - move_player NORTH, 1 - move_player NORTH, 1 - run_command ScriptCommand_SetPlayerDirection - db EAST - move_player EAST, 1 - move_player EAST, 1 - run_command ScriptCommand_SetPlayerDirection - db NORTH - run_command ScriptCommand_PrintTextString - tx Text05f0 - close_text_box - run_command Func_ccdc - tx Text05f1 - close_text_box - run_command ScriptCommand_PrintTextString - tx Text05f2 - run_command Func_d271 + start_script + run_command ScriptCommand_PrintTextString + tx Text05eb + run_command ScriptCommand_PrintTextString + tx Text05ef + close_text_box + run_command ScriptCommand_MoveActiveNPC + dw NPCMovement_d896 + set_player_direction NORTH + move_player NORTH, 1 + move_player NORTH, 1 + move_player NORTH, 1 + set_player_direction EAST + move_player EAST, 1 + move_player EAST, 1 + set_player_direction NORTH + run_command ScriptCommand_PrintTextString + tx Text05f0 + close_text_box + run_command Func_ccdc + tx Text05f1 + close_text_box + run_command ScriptCommand_PrintTextString + tx Text05f2 + run_command Func_d271 ; 0xd860 INCROM $d860, $d880 @@ -3616,12 +3590,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_string Text072f run_command Func_ccdc tx Text0730 - run_command ScriptCommand_TakeCard - db CLEFABLE - run_command ScriptCommand_GiveCard - db SURFING_PIKACHU1 - run_command ScriptCommand_ShowCardReceivedScreen - db SURFING_PIKACHU1 + take_card CLEFABLE + give_card SURFING_PIKACHU1 + show_card_received_screen SURFING_PIKACHU1 print_text_quit_fully Text0731 .ows_dbcc @@ -3655,12 +3626,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_string Text072f run_command Func_ccdc tx Text0736 - run_command ScriptCommand_TakeCard - db DITTO - run_command ScriptCommand_GiveCard - db FLYING_PIKACHU - run_command ScriptCommand_ShowCardReceivedScreen - db FLYING_PIKACHU + take_card DITTO + give_card FLYING_PIKACHU + show_card_received_screen FLYING_PIKACHU print_text_quit_fully Text0737 .ows_dc05 @@ -3694,12 +3662,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_string Text072f run_command Func_ccdc tx Text073c - run_command ScriptCommand_TakeCard - db CHANSEY - run_command ScriptCommand_GiveCard - db SURFING_PIKACHU2 - run_command ScriptCommand_ShowCardReceivedScreen - db SURFING_PIKACHU2 + take_card CHANSEY + give_card SURFING_PIKACHU2 + show_card_received_screen SURFING_PIKACHU2 print_text_quit_fully Text073d .ows_dc3e @@ -3791,26 +3756,21 @@ Script_BeatImakuni: ; dd2d (3:5d2d) .giveBoosters print_text_string Text046c run_command ScriptCommand_GiveOneOfEachTrainerBooster - run_command ScriptCommand_Jump - dw .done + script_jump .done .threeWins print_text_string Text046d - run_command ScriptCommand_Jump - dw .giveImakuniCard + script_jump .giveImakuniCard .sixWins print_text_string Text046e .giveImakuniCard print_text_string Text046f - run_command ScriptCommand_GiveCard - db IMAKUNI_CARD - run_command ScriptCommand_ShowCardReceivedScreen - db IMAKUNI_CARD + give_card IMAKUNI_CARD + show_card_received_screen IMAKUNI_CARD .done print_text_string Text0470 - run_command ScriptCommand_Jump - dw ScriptJump_ImakuniCommon + script_jump ScriptJump_ImakuniCommon Script_LostToImakuni: ; dd5c (3:5d5c) start_script @@ -3822,12 +3782,10 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60) db 18 db 4 dw .ows_dd69 - run_command ScriptCommand_Jump - dw .ows_dd6e + script_jump .ows_dd6e .ows_dd69 - run_command ScriptCommand_SetPlayerDirection - db EAST + set_player_direction EAST move_player WEST, 1 .ows_dd6e @@ -3865,9 +3823,9 @@ Script_Granny1: ; dd9f (3:5d9f) FightingClubAfterDuel: ; dda3 (3:5da3) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xddaa .after_duel_table @@ -3895,133 +3853,133 @@ FightingClubAfterDuel: ; dda3 (3:5da3) ; ddc3 Script_Mitch: ; ddc3 (3:5dc3) - start_script - run_command ScriptCommand_TryGivePCPack - db $02 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_AlreadyHaveMedal - run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus - dw .first_interaction - dw .three_pupils_remaining - dw .two_pupils_remaining - dw .one_pupil_remaining - dw .all_pupils_defeated + start_script + run_command ScriptCommand_TryGivePCPack + db $02 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_AlreadyHaveMedal + run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus + dw .first_interaction + dw .three_pupils_remaining + dw .two_pupils_remaining + dw .one_pupil_remaining + dw .all_pupils_defeated .first_interaction - run_command ScriptCommand_PrintTextString - tx Text0477 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_11 - db $01 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_17 - db $01 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_20 - db $01 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text0477 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_11 + db $01 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_17 + db $01 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_20 + db $01 + run_command ScriptCommand_QuitScriptFully ; 0xdde2 .three_pupils_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text0478 + run_command ScriptCommand_PrintTextQuitFully + tx Text0478 ; 0xdde5 .two_pupils_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text0479 + run_command ScriptCommand_PrintTextQuitFully + tx Text0479 ; 0xdde8 .one_pupil_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text047a + run_command ScriptCommand_PrintTextQuitFully + tx Text047a ; 0xddeb .all_pupils_defeated - run_command ScriptCommand_PrintTextString - tx Text047b - run_command ScriptCommand_AskQuestionJump - tx Text047c - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text047d - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text047b + run_command ScriptCommand_AskQuestionJump + tx Text047c + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text047d + run_command ScriptCommand_QuitScriptFully ; 0xddf7 .do_battle - run_command ScriptCommand_PrintTextString - tx Text047e - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRST_STRIKE_DECK_ID - db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text047e + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRST_STRIKE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully ; 0xddff Script_BeatMitch: ; ddff (3:5dff) - start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_GiveBoosters - run_command ScriptCommand_PrintTextString - tx Text047f - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_0F - run_command ScriptCommand_TryGiveMedalPCPacks - run_command Func_d125 - db $0f - run_command Func_d435 - db $01 - run_command ScriptCommand_PrintTextString - tx Text0480 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_LABORATORY_NEUTRAL - db BOOSTER_LABORATORY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0481 - run_command ScriptCommand_QuitScriptFully + start_script + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_GiveBoosters + run_command ScriptCommand_PrintTextString + tx Text047f + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_0F + try_give_medal_pc_packs + run_command Func_d125 + db $0f + run_command Func_d435 + db $01 + run_command ScriptCommand_PrintTextString + tx Text0480 + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_LABORATORY_NEUTRAL + db BOOSTER_LABORATORY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text0481 + run_command ScriptCommand_QuitScriptFully ; 0xde19 Script_LoseToMitch: ; de19 (3:5e19) - start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_PrintTrainHarderText - run_command ScriptCommand_PrintTextQuitFully - tx Text0482 + start_script + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_PrintTrainHarderText + run_command ScriptCommand_PrintTextQuitFully + tx Text0482 ; 0xde21 Script_Mitch_AlreadyHaveMedal: ; 0xde21 - run_command ScriptCommand_PrintTextString - tx Text0483 - run_command ScriptCommand_AskQuestionJump - tx Text047c - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text0484 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text0483 + run_command ScriptCommand_AskQuestionJump + tx Text047c + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text0484 + run_command ScriptCommand_QuitScriptFully ; 0xde2d .do_battle - run_command ScriptCommand_PrintTextString - tx Text0485 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRST_STRIKE_DECK_ID - db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text0485 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRST_STRIKE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully ; 0xde35 Script_Mitch_GiveBoosters: - run_command ScriptCommand_PrintTextString - tx Text0486 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_LABORATORY_NEUTRAL - db BOOSTER_LABORATORY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0487 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text0486 + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_LABORATORY_NEUTRAL + db BOOSTER_LABORATORY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text0487 + run_command ScriptCommand_QuitScriptFully ; 0xde40 Script_Mitch_PrintTrainHarderText: - run_command ScriptCommand_PrintTextQuitFully - tx Text0488 + run_command ScriptCommand_PrintTextQuitFully + tx Text0488 ; 0xde43 INCROM $de43, $ded1 @@ -4031,9 +3989,9 @@ Script_Clerk2: ; ded1 (3:5ed1) RockClubLobbyAfterDuel: ; ded5 (3:5ed5) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xdedc .after_duel_table @@ -4081,9 +4039,9 @@ Script_Clerk3: ; e09e (3:609e) WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xe0a9 .after_duel_table @@ -4148,12 +4106,9 @@ Script_Gal1: ; e0cf (3:60cf) print_text_string Text0423 run_command Func_ccdc tx Text0424 - run_command ScriptCommand_TakeCard - db LAPRAS - run_command ScriptCommand_GiveCard - db ARCANINE1 - run_command ScriptCommand_ShowCardReceivedScreen - db ARCANINE1 + take_card LAPRAS + give_card ARCANINE1 + show_card_received_screen ARCANINE1 print_text_string Text0425 run_command ScriptCommand_QuitScriptFully @@ -4322,18 +4277,15 @@ Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) .ows_e1ec run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e206 - run_command ScriptCommand_Jump - dw .ows_e1d5 + script_jump .ows_e1d5 .ows_e1f2 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e20b - run_command ScriptCommand_Jump - dw .ows_e1d5 + script_jump .ows_e1d5 .ows_e1f8 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e20f - run_command ScriptCommand_Jump - dw .ows_e1d5 + script_jump .ows_e1d5 .ows_e1fe run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e218 @@ -4389,8 +4341,7 @@ Script_Joshua: ; e21c (3:621c) run_command ScriptCommand_JumpIfFlagZero2 db EVENT_BEAT_SARA dw .sara_and_amanda_not_beaten - run_command ScriptCommand_Jump - dw .beat_sara_and_amanda + script_jump .beat_sara_and_amanda .sara_and_amanda_not_beaten run_command ScriptCommand_SetFlagValue db EVENT_JOSHUA_STATE @@ -4467,9 +4418,7 @@ Script_BeatJoshua: ; e26c (3:626c) run_command Func_cfc6 db $00 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_AMY - dw Script_MeetAmy + set_next_npc_and_script NPC_AMY, Script_MeetAmy end_script_loop ret @@ -4510,19 +4459,16 @@ Preload_Amy: ; e2ad (3:62ad) Script_MeetAmy: ; e2d1 (3:62d1) start_script print_text_string Text044b - run_command ScriptCommand_SetDialogName - db NPC_JOSHUA + set_dialog_npc NPC_JOSHUA print_text_string Text044c - run_command ScriptCommand_SetDialogName - db NPC_AMY + set_dialog_npc NPC_AMY print_text_string Text044d close_text_box run_command Func_d095 db $09 db $2f db $10 - run_command ScriptCommand_DoFrames - db $20 + do_frames $20 run_command Func_d095 db $04 db $0e @@ -4530,19 +4476,16 @@ Script_MeetAmy: ; e2d1 (3:62d1) run_command Func_d0be db $14 db $04 - run_command ScriptCommand_SetPlayerDirection - db $03 + set_player_direction $03 move_player WEST, 1 - run_command ScriptCommand_SetPlayerDirection - db $00 + set_player_direction $00 move_player NORTH, 1 move_player NORTH, 1 run_command ScriptCommand_MoveArbitraryNPC db NPC_JOSHUA dw NPCMovement_e2ab print_text_string Text044e - run_command ScriptCommand_Jump - dw Script_Amy.askConfirmDuel + script_jump Script_Amy.askConfirmDuel Script_Amy: ; e304 (3:6304) start_script @@ -4575,7 +4518,7 @@ Script_BeatAmy: ; e322 (3:6322) print_text_string Text0454 run_command ScriptCommand_MaxOutFlagValue db EVENT_BEAT_AMY - run_command ScriptCommand_TryGiveMedalPCPacks + try_give_medal_pc_packs run_command Func_d125 db EVENT_BEAT_AMY run_command Func_d435 @@ -4612,8 +4555,7 @@ Script_LostToAmy: ; e344 (3:6344) ScriptJump_TalkToAmyAgain: ; e356 (3:6356) print_text_string Text0458 ask_question_jump Text0450, .startDuel - run_command ScriptCommand_Jump - dw Script_Amy.denyDuel + script_jump Script_Amy.denyDuel .startDuel print_text_string Text0459 @@ -4625,9 +4567,9 @@ Script_Clerk4: ; e369 (3:6369) INCROM $e369, $e36d LightningClubLobbyAfterDuel: ; e36d (3:636d) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xe374 .after_duel_table @@ -4829,12 +4771,9 @@ Script_Lass2: ; e61f (3:661f) print_text_string Text06f1 run_command Func_ccdc tx Text06f2 - run_command ScriptCommand_TakeCard - db ODDISH - run_command ScriptCommand_GiveCard - db VILEPLUME - run_command ScriptCommand_ShowCardReceivedScreen - db VILEPLUME + take_card ODDISH + give_card VILEPLUME + show_card_received_screen VILEPLUME print_text_quit_fully Text06f3 .ows_e66a @@ -4866,12 +4805,9 @@ Script_Lass2: ; e61f (3:661f) print_text_string Text06f9 run_command Func_ccdc tx Text06fa - run_command ScriptCommand_TakeCard - db CLEFAIRY - run_command ScriptCommand_GiveCard - db PIKACHU3 - run_command ScriptCommand_ShowCardReceivedScreen - db PIKACHU3 + take_card CLEFAIRY + give_card PIKACHU3 + show_card_received_screen PIKACHU3 print_text_quit_fully Text06f3 .ows_e6a1 @@ -4903,12 +4839,9 @@ Script_Lass2: ; e61f (3:661f) print_text_string Text0700 run_command Func_ccdc tx Text0701 - run_command ScriptCommand_TakeCard - db CHARIZARD - run_command ScriptCommand_GiveCard - db BLASTOISE - run_command ScriptCommand_ShowCardReceivedScreen - db BLASTOISE + take_card CHARIZARD + give_card BLASTOISE + show_card_received_screen BLASTOISE print_text_quit_fully Text06f3 ; 0xe6d8 @@ -5005,16 +4938,14 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) dw 0000 dw .ows_e882 print_text_string Text0647 - run_command ScriptCommand_Jump - dw .ows_e885 + script_jump .ows_e885 .ows_e882 print_text_string Text0648 .ows_e885 print_text_string Text0649 close_text_box - run_command ScriptCommand_SetPlayerDirection - db $03 + set_player_direction $03 move_player EAST, 4 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e894 @@ -5037,8 +4968,7 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) start_script run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e905 - run_command ScriptCommand_DoFrames - db $3c + do_frames $3c run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90d print_text_string Text064a @@ -5046,11 +4976,9 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) db $08 db $02 dw $68d6 - run_command ScriptCommand_SetPlayerDirection - db WEST + set_player_direction WEST move_player WEST, 1 - run_command ScriptCommand_SetPlayerDirection - db SOUTH + set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 print_text_string Text064b @@ -5063,13 +4991,10 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) Script_BeatFirstRonaldFight: ; e8e9 (3:68e9) start_script print_text_string Text064c - run_command ScriptCommand_GiveCard - db JIGGLYPUFF1 - run_command ScriptCommand_ShowCardReceivedScreen - db JIGGLYPUFF1 + give_card JIGGLYPUFF1 + show_card_received_screen JIGGLYPUFF1 print_text_string Text064d - run_command ScriptCommand_Jump - dw ScriptJump_FinishedFirstRonaldFight + script_jump ScriptJump_FinishedFirstRonaldFight Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) start_script @@ -5115,8 +5040,7 @@ ScriptSecondRonaldFight: ; e91e (3:691e) start_script run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e905 - run_command ScriptCommand_DoFrames - db 60 + do_frames 60 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_e90d print_text_string Text064f @@ -5124,12 +5048,10 @@ ScriptSecondRonaldFight: ; e91e (3:691e) db $08 db $02 dw .ows_6934 - run_command ScriptCommand_SetPlayerDirection - db WEST + set_player_direction WEST move_player WEST, 1 .ows_6934 - run_command ScriptCommand_SetPlayerDirection - db SOUTH + set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 print_text_string Text0650 @@ -5142,13 +5064,10 @@ ScriptSecondRonaldFight: ; e91e (3:691e) Script_BeatSecondRonaldFight: ; e947 (3:6947) start_script print_text_string Text0651 - run_command ScriptCommand_GiveCard - db SUPER_ENERGY_RETRIEVAL - run_command ScriptCommand_ShowCardReceivedScreen - db SUPER_ENERGY_RETRIEVAL + give_card SUPER_ENERGY_RETRIEVAL + show_card_received_screen SUPER_ENERGY_RETRIEVAL print_text_string Text0652 - run_command ScriptCommand_Jump - dw ScriptJump_FinishedSecondRonaldFight + script_jump ScriptJump_FinishedSecondRonaldFight Script_LostToSecondRonaldFight: ; e955 (3:6955) start_script @@ -5168,9 +5087,9 @@ ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) PsychicClubLobbyAfterDuel: ; e963 (3:6963) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xe96a .after_duel_table @@ -5212,9 +5131,9 @@ Script_Clerk7: ; eb53 (3:6b53) ScienceClubLobbyAfterDuel:; eb57 (3:6b57) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xeb5e .after_duel_table @@ -5256,9 +5175,9 @@ Script_Clerk8: ; ed45 (3:6d45) INCROM $ed45, $ed49 FireClubLobbyAfterDuel: ; ed49 (3:6d49) - ld hl, .after_duel_table - call FindEndOfBattleScript - ret + ld hl, .after_duel_table + call FindEndOfBattleScript + ret ; 0xed50 .after_duel_table @@ -5341,10 +5260,8 @@ Script_ee76: ; ee76 (3:6e76) db $02 run_command Func_ccdc tx Text06a2 - run_command ScriptCommand_GiveCard - db SLOWPOKE1 - run_command ScriptCommand_ShowCardReceivedScreen - db SLOWPOKE1 + give_card SLOWPOKE1 + show_card_received_screen SLOWPOKE1 run_command ScriptCommand_QuitScriptFully ; 0xee88 @@ -5391,111 +5308,109 @@ Script_Jonathan: ; eefd (3:6efd) INCROM $eefd, $ef22 Script_Ken: ; ef22 (3:6f22) - start_script - run_command ScriptCommand_TryGivePCPack - db $09 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_23 - dw .have_300_cards - run_command ScriptCommand_CheckAmountOfCardsOwned - dw 300 - dw .have_300_cards - run_command ScriptCommand_JumpIfFlagZero1 - db EVENT_FLAG_24 - dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06ba - tx Text06bb - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_24 - db $01 - run_command ScriptCommand_QuitScriptFully + start_script + run_command ScriptCommand_TryGivePCPack + db $09 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_23 + dw .have_300_cards + jump_if_enough_cards_owned 300, .have_300_cards + run_command ScriptCommand_JumpIfFlagZero1 + db EVENT_FLAG_24 + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06ba + tx Text06bb + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_24 + db $01 + run_command ScriptCommand_QuitScriptFully .have_300_cards - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_23 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0A - dw Script_KenBattle_AlreadyHaveMedal - run_command ScriptCommand_JumpIfFlagZero1 - db EVENT_FLAG_24 - dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06bc - tx Text06bd - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_24 - db $01 - run_command ScriptCommand_AskQuestionJump - tx Text06be - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text06bf - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_23 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0A + dw Script_KenBattle_AlreadyHaveMedal + run_command ScriptCommand_JumpIfFlagZero1 + db EVENT_FLAG_24 + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06bc + tx Text06bd + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_24 + db $01 + run_command ScriptCommand_AskQuestionJump + tx Text06be + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text06bf + run_command ScriptCommand_QuitScriptFully .do_battle - run_command ScriptCommand_PrintTextString - tx Text06c0 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRE_CHARGE_DECK_ID - db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text06c0 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRE_CHARGE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully ; 0xef5e Script_BeatKen: ; ef5e (3:6f5e) - start_script - run_command ScriptCommand_PrintTextString - tx Text06c1 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0A - dw .give_booster_packs - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_0A - run_command ScriptCommand_TryGiveMedalPCPacks - run_command Func_d125 - db $0a - run_command Func_d435 - db $08 - run_command ScriptCommand_PrintTextString - tx Text06c2 + start_script + run_command ScriptCommand_PrintTextString + tx Text06c1 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0A + dw .give_booster_packs + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_0A + try_give_medal_pc_packs + run_command Func_d125 + db $0a + run_command Func_d435 + db $08 + run_command ScriptCommand_PrintTextString + tx Text06c2 .give_booster_packs - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_MYSTERY_NEUTRAL - db BOOSTER_MYSTERY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text06c3 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_MYSTERY_NEUTRAL + db BOOSTER_MYSTERY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text06c3 + run_command ScriptCommand_QuitScriptFully ; 0xef78 Script_LoseToKen: ; ef78 (3:6f78) - start_script - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_0A - dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06c4 - tx Text06c5 - run_command ScriptCommand_QuitScriptFully + start_script + run_command ScriptCommand_JumpIfFlagZero2 + db EVENT_FLAG_0A + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06c4 + tx Text06c5 + run_command ScriptCommand_QuitScriptFully ; 0xef83 Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) - run_command ScriptCommand_PrintTextString - tx Text06c6 - run_command ScriptCommand_AskQuestionJump - tx Text06be - dw .do_battle - run_command ScriptCommand_PrintTextQuitFully - tx Text06bf + run_command ScriptCommand_PrintTextString + tx Text06c6 + run_command ScriptCommand_AskQuestionJump + tx Text06be + dw .do_battle + run_command ScriptCommand_PrintTextQuitFully + tx Text06bf .do_battle - run_command ScriptCommand_PrintTextString - tx Text06c7 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRE_CHARGE_DECK_ID - db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + run_command ScriptCommand_PrintTextString + tx Text06c7 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRE_CHARGE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully ; 0xef96 Preload_Clerk9: ; ef96 (3:6f96) @@ -5872,8 +5787,7 @@ Script_Clerk12: ; f295 (3:7295) db EVENT_FLAG_44 db $03 dw .ows_f2d3 - run_command ScriptCommand_Jump - dw .ows_f2c7 + script_jump .ows_f2c7 .ows_f2c1 print_text_quit_fully Text0529 @@ -5883,13 +5797,11 @@ Script_Clerk12: ; f295 (3:7295) .ows_f2c7 print_text_string Text052b - run_command ScriptCommand_Jump - dw .ows_f2d6 + script_jump .ows_f2d6 .ows_f2cd print_text_string Text052c - run_command ScriptCommand_Jump - dw .ows_f2d6 + script_jump .ows_f2d6 .ows_f2d3 print_text_string Text052d @@ -5914,23 +5826,18 @@ Script_Clerk12: ; f295 (3:7295) db 18 dw .ows_f302 move_player NORTH, 2 - run_command ScriptCommand_Jump - dw .ows_f307 + script_jump .ows_f307 .ows_f2fa - run_command ScriptCommand_SetPlayerDirection - db EAST + set_player_direction EAST move_player EAST, 2 - run_command ScriptCommand_Jump - dw .ows_f307 + script_jump .ows_f307 .ows_f302 - run_command ScriptCommand_SetPlayerDirection - db WEST + set_player_direction WEST move_player WEST, 2 .ows_f307 - run_command ScriptCommand_SetPlayerDirection - db NORTH + set_player_direction NORTH move_player NORTH, 1 move_player NORTH, 1 move_player NORTH, 1 @@ -5943,34 +5850,23 @@ Script_Clerk12: ; f295 (3:7295) db EVENT_FLAG_43 move_player NORTH, 1 move_player NORTH, 1 - run_command ScriptCommand_SetPlayerDirection - db EAST - run_command ScriptCommand_DoFrames - db 30 - run_command ScriptCommand_SetPlayerDirection - db SOUTH - run_command ScriptCommand_DoFrames - db 20 - run_command ScriptCommand_SetPlayerDirection - db EAST - run_command ScriptCommand_DoFrames - db 20 - run_command ScriptCommand_SetPlayerDirection - db SOUTH - run_command ScriptCommand_DoFrames - db 30 + set_player_direction EAST + do_frames 30 + set_player_direction SOUTH + do_frames 20 + set_player_direction EAST + do_frames 20 + set_player_direction SOUTH + do_frames 30 move_player SOUTH, 1 move_player SOUTH, 1 .ows_f33a - run_command ScriptCommand_SetPlayerDirection - db EAST + set_player_direction EAST move_player EAST, 1 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f34e close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db $4a - dw Script_f353 + set_next_npc_and_script $4a, Script_f353 end_script_loop ret ; f349 @@ -5996,12 +5892,10 @@ Script_Host: ; f352 (3:7352) Script_f353: ; f353 (3:7353) start_script - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37d - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f390 run_command Func_d16b @@ -6064,12 +5958,10 @@ NPCMovement_f390: ; f390 (3:7390) LostAtChallengeHall: ; f392 (3:7392) start_script - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37d - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f390 run_command ScriptCommand_JumpIfFlagEqual @@ -6109,8 +6001,7 @@ LostAtChallengeHall: ; f392 (3:7392) db $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_51 - run_command ScriptCommand_Jump - dw .ows_f3e2 + script_jump .ows_f3e2 .ows_f3ce run_command ScriptCommand_SetFlagValue db EVENT_FLAG_40 @@ -6120,8 +6011,7 @@ LostAtChallengeHall: ; f392 (3:7392) db $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_55 - run_command ScriptCommand_Jump - dw .ows_f3e2 + script_jump .ows_f3e2 .ows_f3d9 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_41 @@ -6129,13 +6019,10 @@ LostAtChallengeHall: ; f392 (3:7392) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_4A db $03 - run_command ScriptCommand_Jump - dw .ows_f3e2 + script_jump .ows_f3e2 .ows_f3e2 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_CLERK12 - dw Script_f3e9 + set_next_npc_and_script NPC_CLERK12, Script_f3e9 end_script_loop ret @@ -6143,11 +6030,9 @@ Script_f3e9: ; f3e9 (3:73e9) start_script run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f40a - run_command ScriptCommand_SetPlayerDirection - db WEST + set_player_direction WEST move_player WEST, 1 - run_command ScriptCommand_SetPlayerDirection - db SOUTH + set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 move_player SOUTH, 1 @@ -6174,13 +6059,11 @@ ScriptJump_f410: ; f410 (4:7410) run_command Func_d16b db $01 print_text_string Text0538 - run_command ScriptCommand_Jump - dw LostAtChallengeHall.ows_f3ae + script_jump LostAtChallengeHall.ows_f3ae .ows_f41a print_text_string Text0539 - run_command ScriptCommand_SetDialogName - db NPC_RONALD1 + set_dialog_npc NPC_RONALD1 run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $03 @@ -6191,32 +6074,25 @@ ScriptJump_f410: ; f410 (4:7410) dw NO_JUMP print_variable_text Text053a, Text053b .ows_f42e - run_command ScriptCommand_SetDialogName - db NPC_HOST - run_command ScriptCommand_Jump - dw LostAtChallengeHall.ows_f3ae + set_dialog_npc NPC_HOST + script_jump LostAtChallengeHall.ows_f3ae Script_f433: ; f433 (3:7433) start_script - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37d - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f390 - run_command ScriptCommand_Jump - dw WonAtChallengeHall.ows_f4a4 + script_jump WonAtChallengeHall.ows_f4a4 WonAtChallengeHall: ; f441 (3:7441) start_script - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f37d - run_command ScriptCommand_DoFrames - db 20 + do_frames 20 run_command ScriptCommand_MoveActiveNPC dw NPCMovement_f390 run_command ScriptCommand_JumpIfFlagEqual @@ -6268,15 +6144,13 @@ WonAtChallengeHall: ; f441 (3:7441) db $03 dw .ows_f4a1 close_text_box - run_command ScriptCommand_SetDialogName - db $02 + set_dialog_npc $02 run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $01 dw NO_JUMP print_variable_text Text0542, Text0543 - run_command ScriptCommand_SetDialogName - db NPC_HOST + set_dialog_npc NPC_HOST close_text_box .ows_f4a1 print_text_string Text0544 @@ -6304,8 +6178,7 @@ WonAtChallengeHall: ; f441 (3:7441) db EVENT_FLAG_47 run_command Func_d1ad close_text_box - run_command ScriptCommand_Jump - dw .ows_f4a4 + script_jump .ows_f4a4 NPCMovement_f4c8: ; f4c8 (3:74c8) db EAST @@ -6345,8 +6218,7 @@ ScriptJump_f4db: ; f4db (3:74db) db EVENT_FLAG_44 db $03 dw .ows_f513 - run_command ScriptCommand_SetDialogName - db $02 + set_dialog_npc $02 run_command ScriptCommand_JumpIfFlagEqual db EVENT_FLAG_44 db $01 @@ -6354,8 +6226,7 @@ ScriptJump_f4db: ; f4db (3:74db) print_variable_text Text054c, Text054d run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4d8 - run_command ScriptCommand_DoFrames - db 40 + do_frames 40 run_command ScriptCommand_MoveWramNPC dw NPCMovement_f34c run_command ScriptCommand_JumpIfFlagEqual @@ -6363,13 +6234,11 @@ ScriptJump_f4db: ; f4db (3:74db) db $01 dw NO_JUMP print_variable_text Text054e, Text054f - run_command ScriptCommand_SetDialogName - db NPC_HOST + set_dialog_npc NPC_HOST close_text_box run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4c9 - run_command ScriptCommand_Jump - dw .ows_f516 + script_jump .ows_f516 .ows_f513 run_command ScriptCommand_MoveWramNPC dw NPCMovement_f4c8 @@ -6383,10 +6252,8 @@ ScriptJump_f4db: ; f4db (3:74db) dw NPCMovement_f38b run_command Func_d1b3 print_text_string Text0551 - run_command ScriptCommand_GiveCard - db $00 - run_command ScriptCommand_ShowCardReceivedScreen - db $00 + give_card $00 + show_card_received_screen $00 print_text_string Text0552 close_text_box run_command ScriptCommand_JumpIfFlagEqual @@ -6403,8 +6270,7 @@ ScriptJump_f4db: ; f4db (3:74db) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_48 db $02 - run_command ScriptCommand_Jump - dw .ows_f552 + script_jump .ows_f552 .ows_f540 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_40 @@ -6412,8 +6278,7 @@ ScriptJump_f4db: ; f4db (3:74db) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_49 db $02 - run_command ScriptCommand_Jump - dw .ows_f552 + script_jump .ows_f552 .ows_f549 run_command ScriptCommand_SetFlagValue db EVENT_FLAG_41 @@ -6421,13 +6286,10 @@ ScriptJump_f4db: ; f4db (3:74db) run_command ScriptCommand_SetFlagValue db EVENT_FLAG_4A db $02 - run_command ScriptCommand_Jump - dw .ows_f552 + script_jump .ows_f552 .ows_f552 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db NPC_CLERK12 - dw Script_f3e9 + set_next_npc_and_script NPC_CLERK12, Script_f3e9 end_script_loop ret ; f559 @@ -6505,14 +6367,12 @@ Script_f631: ; f631 (3:7631) start_script print_text_string Text0508 close_advanced_text_box - run_command ScriptCommand_SetNextNPCandScript - db $02 - dw $763c + set_next_npc_and_script NPC_RONALD1, .ows_f63c end_script_loop ret -; 0xf63c +.ows_f63c INCROM $f63c, $f71f Script_Courtney: ; f71f (3:771f) @@ -6544,16 +6404,11 @@ Script_fbf1: ; fbf1 (3:7bf1) db EVENT_RECEIVED_LEGENDARY_CARD run_command Func_ccdc tx Text05b8 - run_command ScriptCommand_GiveCard - db ZAPDOS3 - run_command ScriptCommand_GiveCard - db MOLTRES2 - run_command ScriptCommand_GiveCard - db ARTICUNO2 - run_command ScriptCommand_GiveCard - db DRAGONITE1 - run_command ScriptCommand_ShowCardReceivedScreen - db $ff + give_card ZAPDOS3 + give_card MOLTRES2 + give_card ARTICUNO2 + give_card DRAGONITE1 + show_card_received_screen $ff .ows_fc05 run_command Func_d38f db $00 @@ -6575,12 +6430,9 @@ Script_fbf1: ; fbf1 (3:7bf1) run_command Func_d209 run_command Func_ccdc tx Text05ba - run_command ScriptCommand_GiveCard - db $00 - run_command ScriptCommand_ShowCardReceivedScreen - db $00 - run_command ScriptCommand_Jump - dw .ows_fc05 + give_card VARIABLE_CARD + show_card_received_screen VARIABLE_CARD + script_jump .ows_fc05 .ows_fc20 run_command Func_ccdc @@ -6589,8 +6441,7 @@ Script_fbf1: ; fbf1 (3:7bf1) db $00 run_command Func_ccdc tx Text05bc - run_command ScriptCommand_Jump - dw .ows_fc0a + script_jump .ows_fc0a Func_fc2b: ; fc2b (3:7c2b) ld a, [wDuelResult] @@ -6672,8 +6523,7 @@ Func_fc7a: ; fc7a (3:7c7a) tx Text06cf dw .ows_fca0 print_text_string Text06d0 - run_command ScriptCommand_Jump - dw Func_fc7a.ows_fcaa + script_jump Func_fc7a.ows_fcaa .ows_fca0 run_command Func_d396 @@ -6711,8 +6561,7 @@ Func_fcad: ; fcad (3:7cad) db EVENT_FLAG_72 db $03 dw .ows_fcd2 - run_command ScriptCommand_Jump - dw Func_fc7a.ows_fcaa + script_jump Func_fc7a.ows_fcaa .ows_fccc print_text_quit_fully Text06d3 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 45aef8f..e6171e5 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -987,7 +987,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_TakeCard dw Func_cf53 dw Func_cf7b - dw ScriptCommand_CheckAmountOfCardsOwned + dw ScriptCommand_JumpIfEnoughCardsOwned dw ScriptCommand_JumpBasedOnFightingClubPupilStatus dw Func_cfc6 dw Func_cfd4 @@ -1000,8 +1000,8 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_SetPlayerDirection dw ScriptCommand_MovePlayer dw ScriptCommand_ShowCardReceivedScreen - dw ScriptCommand_SetDialogName - dw ScriptCommand_SetNextNPCandScript + dw ScriptCommand_SetDialogNPC + dw ScriptCommand_SetNextNPCAndScript dw Func_d095 dw Func_d0be dw ScriptCommand_DoFrames diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 77acd84..63d514a 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -24,7 +24,7 @@ ENDM const ScriptCommand_TakeCard_index ; $10 const Func_cf53_index ; $11 const Func_cf7b_index ; $12 - const ScriptCommand_CheckAmountOfCardsOwned_index ; $13 + const ScriptCommand_JumpIfEnoughCardsOwned_index ; $13 const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 const Func_cfc6_index ; $15 const Func_cfd4_index ; $16 @@ -37,8 +37,8 @@ ENDM const ScriptCommand_SetPlayerDirection_index ; $1d const ScriptCommand_MovePlayer_index ; $1e const ScriptCommand_ShowCardReceivedScreen_index ; $1f - const ScriptCommand_SetDialogName_index ; $20 - const ScriptCommand_SetNextNPCandScript_index ; $21 + const ScriptCommand_SetDialogNPC_index ; $20 + const ScriptCommand_SetNextNPCAndScript_index ; $21 const Func_d095_index ; $22 const Func_d0be_index ; $23 const ScriptCommand_DoFrames_index ; $24 @@ -167,12 +167,55 @@ jump_if_card_in_collection: MACRO db \1 dw \2 ENDM +give_card: MACRO + run_command ScriptCommand_GiveCard + db \1 +ENDM +take_card: MACRO + run_command ScriptCommand_TakeCard + db \1 +ENDM + +jump_if_enough_cards_owned: MACRO + run_command ScriptCommand_JumpIfEnoughCardsOwned + dw \1 + dw \2 +ENDM +script_jump: MACRO + run_command ScriptCommand_Jump + dw \1 +ENDM +try_give_medal_pc_packs: MACRO + run_command ScriptCommand_TryGiveMedalPCPacks +ENDM +set_player_direction: MACRO + run_command ScriptCommand_SetPlayerDirection + db \1 +ENDM move_player: MACRO run_command ScriptCommand_MovePlayer db \1 db \2 ENDM +show_card_received_screen: MACRO + run_command ScriptCommand_ShowCardReceivedScreen + db \1 +ENDM +set_dialog_npc: MACRO + run_command ScriptCommand_SetDialogNPC + db \1 +ENDM +set_next_npc_and_script: MACRO + run_command ScriptCommand_SetNextNPCAndScript + db \1 + dw \2 +ENDM + +do_frames: MACRO + run_command ScriptCommand_DoFrames + db \1 +ENDM end_script_loop_2: MACRO run_command ScriptCommand_EndScriptLoop2 diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 40d252e..bfc2eb8 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -226,30 +226,30 @@ def createList(): # this is a func just so all this can go at the bottom ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT,"move_active_npc_by_direction"), ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT,"close_text_box"), ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT,"give_booster_packs"), - ("ScriptCommand_JumpIfCardOwned", "bj", DO_NOT_QUIT,"jump_if_card_owned"), # more complex behavior too (jumping) + ("ScriptCommand_JumpIfCardOwned", "bj", DO_NOT_QUIT,"jump_if_card_owned"), ("ScriptCommand_JumpIfCardInCollection", "bj", DO_NOT_QUIT,"jump_if_card_in_collection"), - ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT,""), - ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT,""), + ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT,"give_card"), + ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT,"take_card"), ("Func_cf53", "w", DO_NOT_QUIT,""), # more complex behavior too (jumping) ("Func_cf7b", "", DO_NOT_QUIT,""), - ("ScriptCommand_CheckAmountOfCardsOwned", "bbbb", DO_NOT_QUIT,""), # more complex behavior too (jumping + ??) - ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "w", DO_NOT_QUIT,""), # only jumps? still needs args to do that though + ("ScriptCommand_JumpIfEnoughCardsOwned", "wj", DO_NOT_QUIT,"jump_if_enough_cards_owned"), + ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "jjjj", DO_NOT_QUIT,""), ("Func_cfc6", "b", DO_NOT_QUIT,""), ("Func_cfd4", "", DO_NOT_QUIT,""), ("Func_d00b", "", DO_NOT_QUIT,""), # includes something with random and extra data ("Func_d025", "w", DO_NOT_QUIT,""), # possibly only jumps, still needs args ("Func_d032", "w", DO_NOT_QUIT,""), # see above ("Func_d03f", "", DO_NOT_QUIT,""), - ("ScriptCommand_Jump", "j", QUIT_JUMP,""), # jumps to d - ("ScriptCommand_TryGiveMedalPCPacks", "", DO_NOT_QUIT,""), - ("ScriptCommand_SetPlayerDirection", "d", DO_NOT_QUIT,""), + ("ScriptCommand_Jump", "j", QUIT_JUMP,"script_jump"), + ("ScriptCommand_TryGiveMedalPCPacks", "", DO_NOT_QUIT,"try_give_medal_pc_packs"), + ("ScriptCommand_SetPlayerDirection", "d", DO_NOT_QUIT,"set_player_direction"), ("ScriptCommand_MovePlayer", "di", DO_NOT_QUIT,"move_player"), - ("ScriptCommand_ShowCardReceivedScreen", "b", DO_NOT_QUIT,""), - ("ScriptCommand_SetDialogName", "b", DO_NOT_QUIT,""), - ("ScriptCommand_SetNextNPCandScript", "bj", DO_NOT_QUIT,""), + ("ScriptCommand_ShowCardReceivedScreen", "b", DO_NOT_QUIT,"show_card_received_screen"), + ("ScriptCommand_SetDialogNPC", "b", DO_NOT_QUIT,"set_dialog_npc"), + ("ScriptCommand_SetNextNPCAndScript", "bj", DO_NOT_QUIT,"set_next_npc_and_script"), ("Func_d095", "bbb", DO_NOT_QUIT,""), ("Func_d0be", "bb", DO_NOT_QUIT,""), - ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT,""), + ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT,"do_frames"), ("Func_d0d9", "bbw", DO_NOT_QUIT,""), # jumps but still needs args ("ScriptCommand_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT,""), # jumps but still needs args ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT,""), -- cgit v1.2.3 From ba153434c3630bff8a253adf16d3c67793a5e7e6 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 20 Dec 2020 15:40:34 -0500 Subject: more macros created --- src/engine/bank03.asm | 993 +++++++++++++--------------------------------- src/engine/bank04.asm | 2 +- src/macros/scripts.asm | 112 +++++- tools/script_extractor.py | 52 +-- 4 files changed, 409 insertions(+), 750 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index b8563b3..a2685d6 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2528,7 +2528,7 @@ Func_d0d9: ; d0d9 (3:50d9) jp nz, ScriptEventFailedNoJump jp ScriptEventPassedTryJump -ScriptCommand_JumpIfPlayerCoordMatches: ; d0f2 (3:50f2) +ScriptCommand_JumpIfPlayerCoordsMatch: ; d0f2 (3:50f2) ld a, [wPlayerXCoord] cp c jp nz, ScriptEventFailedNoJump @@ -3151,13 +3151,8 @@ Script_BeginGame: ; d52e (3:552e) do_frames $3c run_command Func_d3e0 do_frames $78 - run_command ScriptCommand_EnterMap - db $02 - db MASON_LABORATORY - db 14 - db 26 - db NORTH - run_command ScriptCommand_QuitScriptFully + enter_map $02, MASON_LABORATORY, 14, 26, NORTH + quit_script_fully MasonLaboratoryAfterDuel: ; d53b (3:553b) ld hl, .after_duel_table @@ -3207,7 +3202,7 @@ Script_ChallengeMachine: ; d57d (3:557d) run_command Func_ccdc tx Text05bd run_command Func_d43d - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_Tech1: ; d583 (3:5583) INCROM $d583, $d5ca @@ -3249,14 +3244,12 @@ Script_EnterLabFirstTime: ; d753 (3:5753) Script_d779: ; d779 (03:5779) start_script - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d880 + move_active_npc NPCMovement_d880 print_text_string Text05e4 set_dialog_npc NPC_DRMASON print_text_string Text05e5 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d882 + move_active_npc NPCMovement_d882 run_command Func_cfc6 db $01 set_player_direction WEST @@ -3267,8 +3260,7 @@ Script_d779: ; d779 (03:5779) Script_d794: ; d794 (3:5794) start_script - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d88b + move_active_npc NPCMovement_d88b do_frames 40 print_text_string Text05e6 close_text_box @@ -3279,8 +3271,7 @@ Script_d794: ; d794 (3:5794) move_player SOUTH, 1 move_player SOUTH, 1 set_player_direction WEST - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d894 + move_active_npc NPCMovement_d894 print_text_string Text05e7 set_dialog_npc $07 print_text_string Text05e8 @@ -3289,34 +3280,13 @@ Script_d794: ; d794 (3:5794) close_text_box run_command Func_d317 close_text_box - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $07 - dw .ows_d80c - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $01 - dw .ows_d7e8 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $02 - dw .ows_d7ee - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $03 - dw .ows_d7f4 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $04 - dw .ows_d7fa - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $05 - dw .ows_d800 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_75 - db $06 - dw .ows_d806 + jump_if_flag_equal EVENT_FLAG_75, $07, .ows_d80c + jump_if_flag_equal EVENT_FLAG_75, $01, .ows_d7e8 + jump_if_flag_equal EVENT_FLAG_75, $02, .ows_d7ee + jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d7f4 + jump_if_flag_equal EVENT_FLAG_75, $04, .ows_d7fa + jump_if_flag_equal EVENT_FLAG_75, $05, .ows_d800 + jump_if_flag_equal EVENT_FLAG_75, $06, .ows_d806 print_text_string Text05d6 script_jump .ows_d7bc @@ -3346,18 +3316,14 @@ Script_d794: ; d794 (3:5794) .ows_d80c print_text_string Text05e9 - run_command ScriptCommand_AskQuestionJumpDefaultYes - dw 0000 - dw .ows_d817 + ask_question_jump_default_yes 0000, .ows_d817 script_jump .ows_d7bc .ows_d817 set_dialog_npc $01 print_text_string Text05ea - run_command ScriptCommand_nop - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_3E - db $01 + script_nop + script_set_flag_value EVENT_FLAG_3E, $01 close_advanced_text_box set_next_npc_and_script NPC_SAM, Script_d827 end_script_loop @@ -3366,7 +3332,7 @@ Script_d794: ; d794 (3:5794) Script_d827: ; d827 (3:5827) start_script start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xd82d INCROM $d82d, $d834 @@ -3378,8 +3344,7 @@ AfterTutorialBattleScript: ; d834 (3:5834) run_command ScriptCommand_PrintTextString tx Text05ef close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_d896 + move_active_npc NPCMovement_d896 set_player_direction NORTH move_player NORTH, 1 move_player NORTH, 1 @@ -3464,12 +3429,11 @@ Script_d932: ; d932 (3:5932) run_command ScriptCommand_AskQuestionJumpDefaultYes tx Text0606 dw .ows_d93c - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_d93c - run_command ScriptCommand_OpenDeckMachine - db $09 - run_command ScriptCommand_QuitScriptFully + open_deck_machine $09 + quit_script_fully ; 0xd93f INCROM $d93f, $dadd @@ -3499,10 +3463,7 @@ Script_Ishihara: ; db4a (3:5b4a) start_script run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_1D - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $00 - dw .ows_db80 + jump_if_flag_equal EVENT_FLAG_1F, $00, .ows_db80 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_39 dw .ows_db5a @@ -3516,36 +3477,16 @@ Script_Ishihara: ; db4a (3:5b4a) run_command ScriptCommand_JumpIfFlagZero2 db EVENT_FLAG_38 dw .ows_db90 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $01 - dw .ows_db93 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $02 - dw .ows_db93 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $03 - dw .ows_dbcc - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $04 - dw .ows_dbcc - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $05 - dw .ows_dc05 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $06 - dw .ows_dc05 + jump_if_flag_equal EVENT_FLAG_1F, $01, .ows_db93 + jump_if_flag_equal EVENT_FLAG_1F, $02, .ows_db93 + jump_if_flag_equal EVENT_FLAG_1F, $03, .ows_dbcc + jump_if_flag_equal EVENT_FLAG_1F, $04, .ows_dbcc + jump_if_flag_equal EVENT_FLAG_1F, $05, .ows_dc05 + jump_if_flag_equal EVENT_FLAG_1F, $06, .ows_dc05 .ows_db80 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $01 + script_set_flag_value EVENT_FLAG_1F, $01 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 run_command ScriptCommand_JumpIfFlagZero2 @@ -3560,14 +3501,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0728 .ows_db93 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $01 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $01, NO_JUMP print_variable_text Text0729, Text072a - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $02 + script_set_flag_value EVENT_FLAG_1F, $02 ask_question_jump Text072b, .check_ifhave_clefable_incollectionordecks print_text_quit_fully Text072c @@ -3582,9 +3518,7 @@ Script_Ishihara: ; db4a (3:5b4a) .do_clefable_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $03 + script_set_flag_value EVENT_FLAG_1F, $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 print_text_string Text072f @@ -3596,14 +3530,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0731 .ows_dbcc - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $03 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $03, NO_JUMP print_variable_text Text0732, Text0733 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $04 + script_set_flag_value EVENT_FLAG_1F, $04 ask_question_jump Text072b, .check_ifhave_ditto_incollectionordecks print_text_quit_fully Text072c @@ -3618,9 +3547,7 @@ Script_Ishihara: ; db4a (3:5b4a) .do_ditto_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $05 + script_set_flag_value EVENT_FLAG_1F, $05 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 print_text_string Text072f @@ -3632,14 +3559,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0737 .ows_dc05 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_1F - db $05 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $05, NO_JUMP print_variable_text Text0738, Text0739 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $06 + script_set_flag_value EVENT_FLAG_1F, $06 ask_question_jump Text072b, .check_ifhave_chansey_incollectionordecks print_text_quit_fully Text072c @@ -3654,9 +3576,7 @@ Script_Ishihara: ; db4a (3:5b4a) .do_chansey_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_1F - db $07 + script_set_flag_value EVENT_FLAG_1F, $07 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_38 print_text_string Text072f @@ -3719,9 +3639,7 @@ Script_Man1: ; dc76 (3:5c76) Script_Imakuni: ; dd0d (3:5d0d) start_script - run_command ScriptCommand_SetFlagValue - db EVENT_IMAKUNI_STATE - db IMAKUNI_TALKED + script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_TALKED run_command ScriptCommand_JumpIfFlagZero2 db EVENT_TEMP_TALKED_TO_IMAKUNI dw NO_JUMP @@ -3730,32 +3648,23 @@ Script_Imakuni: ; dd0d (3:5d0d) db EVENT_TEMP_TALKED_TO_IMAKUNI ask_question_jump Text0469, .declineDuel print_text_string Text046a - run_command ScriptCommand_QuitScriptFully + quit_script_fully .declineDuel print_text_string Text046b start_battle PRIZES_6, IMAKUNI_DECK_ID, MUSIC_IMAKUNI - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatImakuni: ; dd2d (3:5d2d) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_IMAKUNI_WIN_COUNT - db $07 - dw .giveBoosters + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $07, .giveBoosters run_command ScriptCommand_IncrementFlagValue db EVENT_IMAKUNI_WIN_COUNT - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_IMAKUNI_WIN_COUNT - db $03 - dw .threeWins - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_IMAKUNI_WIN_COUNT - db $06 - dw .sixWins + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $03, .threeWins + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $06, .sixWins .giveBoosters print_text_string Text046c - run_command ScriptCommand_GiveOneOfEachTrainerBooster + give_one_of_each_trainer_booster script_jump .done .threeWins @@ -3778,10 +3687,7 @@ Script_LostToImakuni: ; dd5c (3:5d5c) ScriptJump_ImakuniCommon: ; dd60 (3:5d60) close_text_box - run_command ScriptCommand_JumpIfPlayerCoordMatches - db 18 - db 4 - dw .ows_dd69 + jump_if_player_coords_match 18, 4, .ows_dd69 script_jump .ows_dd6e .ows_dd69 @@ -3789,15 +3695,14 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60) move_player WEST, 1 .ows_dd6e - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_dd78 + move_active_npc NPCMovement_dd78 run_command Func_cdcb run_command ScriptCommand_MaxOutFlagValue db EVENT_TEMP_BATTLED_IMAKUNI run_command Func_d408 db $09 run_command Func_d41d - run_command ScriptCommand_QuitScriptFully + quit_script_fully NPCMovement_dd78: ; dd78 (3:5d78) db SOUTH @@ -3854,8 +3759,7 @@ FightingClubAfterDuel: ; dda3 (3:5da3) Script_Mitch: ; ddc3 (3:5dc3) start_script - run_command ScriptCommand_TryGivePCPack - db $02 + try_give_pc_pack $02 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_0F dw Script_Mitch_AlreadyHaveMedal @@ -3868,16 +3772,10 @@ Script_Mitch: ; ddc3 (3:5dc3) .first_interaction run_command ScriptCommand_PrintTextString tx Text0477 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_11 - db $01 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_17 - db $01 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_20 - db $01 - run_command ScriptCommand_QuitScriptFully + script_set_flag_value EVENT_FLAG_11, $01 + script_set_flag_value EVENT_FLAG_17, $01 + script_set_flag_value EVENT_FLAG_20, $01 + quit_script_fully ; 0xdde2 .three_pupils_remaining run_command ScriptCommand_PrintTextQuitFully @@ -3899,7 +3797,7 @@ Script_Mitch: ; ddc3 (3:5dc3) dw .do_battle run_command ScriptCommand_PrintTextString tx Text047d - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xddf7 .do_battle run_command ScriptCommand_PrintTextString @@ -3908,7 +3806,7 @@ Script_Mitch: ; ddc3 (3:5dc3) db PRIZES_6 db FIRST_STRIKE_DECK_ID db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xddff Script_BeatMitch: ; ddff (3:5dff) @@ -3933,7 +3831,7 @@ Script_BeatMitch: ; ddff (3:5dff) db NO_BOOSTER run_command ScriptCommand_PrintTextString tx Text0481 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xde19 Script_LoseToMitch: ; de19 (3:5e19) @@ -3953,7 +3851,7 @@ Script_Mitch_AlreadyHaveMedal: ; 0xde21 dw .do_battle run_command ScriptCommand_PrintTextString tx Text0484 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xde2d .do_battle run_command ScriptCommand_PrintTextString @@ -3962,7 +3860,7 @@ Script_Mitch_AlreadyHaveMedal: ; 0xde21 db PRIZES_6 db FIRST_STRIKE_DECK_ID db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xde35 Script_Mitch_GiveBoosters: @@ -3974,7 +3872,7 @@ Script_Mitch_GiveBoosters: db NO_BOOSTER run_command ScriptCommand_PrintTextString tx Text0487 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xde40 Script_Mitch_PrintTrainHarderText: @@ -4073,36 +3971,26 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) Script_Gal1: ; e0cf (3:60cf) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_12 - db $02 - dw .ows_e10e - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_12 - db $00 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_12, $02, .ows_e10e + jump_if_flag_equal EVENT_FLAG_12, $00, NO_JUMP print_variable_text Text041d, Text041e - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_12 - db $01 + script_set_flag_value EVENT_FLAG_12, $01 ask_question_jump Text041f, .ows_e0eb print_text_string Text0420 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_e0eb jump_if_cardowned $59, .ows_e0f3 print_text_string Text0421 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_e0f3 jump_if_card_in_collection $59, .ows_e0fb print_text_string Text0422 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_e0fb - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_12 - db $02 + script_set_flag_value EVENT_FLAG_12, $02 print_text_string Text0423 run_command Func_ccdc tx Text0424 @@ -4110,31 +3998,21 @@ Script_Gal1: ; e0cf (3:60cf) give_card ARCANINE1 show_card_received_screen ARCANINE1 print_text_string Text0425 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_e10e print_text_quit_fully Text0426 Script_Lass1: ; e111 (3:6111) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_14 - db $01 - dw .ows_e121 + jump_if_flag_equal EVENT_FLAG_14, $01, .ows_e121 print_text_string Text0427 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_14 - db $01 - run_command ScriptCommand_SetFlagValue - db EVENT_IMAKUNI_STATE - db IMAKUNI_MENTIONED - run_command ScriptCommand_QuitScriptFully + script_set_flag_value EVENT_FLAG_14, $01 + script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_MENTIONED + quit_script_fully .ows_e121 - run_command ScriptCommand_JumpIfFlagNotEqual - db EVENT_IMAKUNI_ROOM - db IMAKUNI_WATER_CLUB - dw .ows_e12d + jump_if_flag_not_equal EVENT_IMAKUNI_ROOM, IMAKUNI_WATER_CLUB, .ows_e12d run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_TEMP_BATTLED_IMAKUNI dw .ows_e12d @@ -4200,11 +4078,11 @@ Script_Sara: ; e177 (3:6177) print_text_string Text042c ask_question_jump Text042d, .yes_duel print_text_string Text042e - run_command ScriptCommand_QuitScriptFully + quit_script_fully .yes_duel print_text_string Text042f start_battle PRIZES_2, WATERFRONT_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatSara: ; e18c (3:618c) start_script @@ -4213,7 +4091,7 @@ Script_BeatSara: ; e18c (3:618c) print_text_string Text0430 give_booster_packs BOOSTER_COLOSSEUM_WATER, BOOSTER_COLOSSEUM_WATER, NO_BOOSTER print_text_string Text0431 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_LostToSara: ; e19a (03:619a) start_script @@ -4224,11 +4102,11 @@ Script_Amanda: ; e19e (03:619e) print_text_string Text0433 ask_question_jump Text0434, .yes_duel print_text_string Text0435 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .yes_duel print_text_string Text0436 start_battle PRIZES_3, LONELY_FRIENDS_DECK_ID, MUSIC_DUEL_THEME_1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatAmanda: ; e1b3 (03:61b3) start_script @@ -4237,7 +4115,7 @@ Script_BeatAmanda: ; e1b3 (03:61b3) print_text_string Text0437 give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER print_text_string Text0438 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_LostToAmanda: ; e1c1 (03:61c1) start_script @@ -4245,56 +4123,34 @@ Script_LostToAmanda: ; e1c1 (03:61c1) Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) start_script - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $12 - db $08 - dw .ows_e1ec - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $14 - db $08 - dw .ows_e1f2 - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $18 - db $08 - dw .ows_e1f8 + jump_if_player_coords_match $12, $08, .ows_e1ec + jump_if_player_coords_match $14, $08, .ows_e1f2 + jump_if_player_coords_match $18, $08, .ows_e1f8 .ows_e1d5 move_player SOUTH, 4 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e213 + move_active_npc NPCMovement_e213 print_text_string Text043a - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $12 - db $0a - dw .ows_e1fe - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $14 - db $0a - dw .ows_e202 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e215 - run_command ScriptCommand_QuitScriptFully + jump_if_player_coords_match $12, $0a, .ows_e1fe + jump_if_player_coords_match $14, $0a, .ows_e202 + move_active_npc NPCMovement_e215 + quit_script_fully .ows_e1ec - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e206 + move_active_npc NPCMovement_e206 script_jump .ows_e1d5 .ows_e1f2 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e20b + move_active_npc NPCMovement_e20b script_jump .ows_e1d5 .ows_e1f8 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e20f + move_active_npc NPCMovement_e20f script_jump .ows_e1d5 .ows_e1fe - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e218 - run_command ScriptCommand_QuitScriptFully + move_active_npc NPCMovement_e218 + quit_script_fully .ows_e202 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e219 - run_command ScriptCommand_QuitScriptFully + move_active_npc NPCMovement_e219 + quit_script_fully NPCMovement_e206: ; e206 (3:6206) db NORTH @@ -4343,74 +4199,47 @@ Script_Joshua: ; e21c (3:621c) dw .sara_and_amanda_not_beaten script_jump .beat_sara_and_amanda .sara_and_amanda_not_beaten - run_command ScriptCommand_SetFlagValue - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED + script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_TALKED print_text_string Text043b - run_command ScriptCommand_QuitScriptFully + quit_script_fully .beat_sara_and_amanda - run_command ScriptCommand_JumpIfFlagNonzero1 - db EVENT_JOSHUA_STATE - dw .already_talked - run_command ScriptCommand_SetFlagValue - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED + jump_if_flag_nonzero_1 EVENT_JOSHUA_STATE, .already_talked + script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_TALKED print_text_string Text043b print_text_string Text043c .already_talked - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED - dw NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP print_variable_text Text043d, Text043e ask_question_jump Text043f, .startDuel - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED - dw NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP print_variable_text Text0440, Text0441 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .startDuel: print_text_string Text0442 - run_command ScriptCommand_TryGivePCPack - db $04 + try_give_pc_pack $04 start_battle PRIZES_4, SOUND_OF_THE_WAVES_DECK_ID, MUSIC_DUEL_THEME_1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_LostToJoshua: ; e260 (3:6260) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED - dw NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP print_variable_text Text0443, Text0444 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatJoshua: ; e26c (3:626c) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED - dw NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP print_variable_text Text0445, Text0446 give_booster_packs BOOSTER_MYSTERY_WATER_COLORLESS, BOOSTER_MYSTERY_WATER_COLORLESS, NO_BOOSTER - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_JOSHUA_STATE - db JOSHUA_TALKED - dw NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP print_variable_text Text0447, Text0448 - run_command ScriptCommand_JumpIfFlagNotEqual - db EVENT_JOSHUA_STATE - db JOSHUA_BEATEN - dw .firstJoshuaWin - run_command ScriptCommand_QuitScriptFully + jump_if_flag_not_equal EVENT_JOSHUA_STATE, JOSHUA_BEATEN, .firstJoshuaWin + quit_script_fully .firstJoshuaWin: - run_command ScriptCommand_SetFlagValue - db EVENT_JOSHUA_STATE - db JOSHUA_BEATEN + script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_BEATEN print_text_string Text0449 close_text_box move_active_npc_by_direction NPCMovementTable_e2a1 @@ -4481,9 +4310,7 @@ Script_MeetAmy: ; e2d1 (3:62d1) set_player_direction $00 move_player NORTH, 1 move_player NORTH, 1 - run_command ScriptCommand_MoveArbitraryNPC - db NPC_JOSHUA - dw NPCMovement_e2ab + move_arbitrary_npc NPC_JOSHUA, NPCMovement_e2ab print_text_string Text044e script_jump Script_Amy.askConfirmDuel @@ -4502,12 +4329,12 @@ Script_Amy: ; e304 (3:6304) db $14 db $04 dw Script_LostToAmy.ows_e34e - run_command ScriptCommand_QuitScriptFully + quit_script_fully .startDuel print_text_string Text0452 start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatAmy: ; e322 (3:6322) start_script @@ -4531,7 +4358,7 @@ Script_BeatAmy: ; e322 (3:6322) db $14 db $04 dw Script_LostToAmy.ows_e34e - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_LostToAmy: ; e344 (3:6344) start_script @@ -4540,7 +4367,7 @@ Script_LostToAmy: ; e344 (3:6344) db $14 db $04 dw .ows_e34e - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_e34e run_command Func_d095 @@ -4550,7 +4377,7 @@ Script_LostToAmy: ; e344 (3:6344) run_command Func_d0be db $16 db $04 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ScriptJump_TalkToAmyAgain: ; e356 (3:6356) print_text_string Text0458 @@ -4560,7 +4387,7 @@ ScriptJump_TalkToAmyAgain: ; e356 (3:6356) .startDuel print_text_string Text0459 start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xe369 Script_Clerk4: ; e369 (3:6369) @@ -4682,12 +4509,12 @@ Script_Brittany: ; e5d2 (3:65d2) print_variable_text Text06e0, Text06e1 ask_question_jump Text06e2, .wantToDuel print_text_string Text06e3 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .wantToDuel print_text_string Text06e4 start_battle PRIZES_4, ETCETERA_DECK_ID, MUSIC_DUEL_THEME_1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatBrittany: ; e5ee (3:65ee) start_script @@ -4700,24 +4527,19 @@ Script_BeatBrittany: ; e5ee (3:65ee) print_variable_text Text06e6, Text06e7 run_command ScriptCommand_MaxOutFlagValue db FLAG_BEAT_BRITTANY - run_command ScriptCommand_JumpIfFlagNotLessThan - db EVENT_FLAG_35 - db $02 - dw .finishScript + jump_if_flag_not_less_than EVENT_FLAG_35, $02, .finishScript run_command ScriptCommand_JumpIfFlagZero2 db EVENT_FLAG_3A dw .finishScript run_command ScriptCommand_JumpIfFlagZero2 db EVENT_FLAG_3B dw .finishScript - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_35 - db $01 + script_set_flag_value EVENT_FLAG_35, $01 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_1E print_text_string Text06e8 .finishScript - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_LostToBrittany: ; e618 (3:6618) start_script @@ -4731,26 +4553,12 @@ Script_Lass2: ; e61f (3:661f) run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_04 dw Script_e61c - run_command ScriptCommand_JumpIfFlagNotLessThan - db EVENT_FLAG_37 - db $06 - dw Script_e61c - run_command ScriptCommand_JumpIfFlagNotLessThan - db EVENT_FLAG_37 - db $04 - dw .ows_e6a1 - run_command ScriptCommand_JumpIfFlagNotLessThan - db EVENT_FLAG_37 - db $02 - dw .ows_e66a - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_37 - db $00 - dw NO_JUMP + jump_if_flag_not_less_than EVENT_FLAG_37, $06, Script_e61c + jump_if_flag_not_less_than EVENT_FLAG_37, $04, .ows_e6a1 + jump_if_flag_not_less_than EVENT_FLAG_37, $02, .ows_e66a + jump_if_flag_equal EVENT_FLAG_37, $00, NO_JUMP print_variable_text Text06eb, Text06ec - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $01 + script_set_flag_value EVENT_FLAG_37, $01 ask_question_jump Text06ed, .ows_e648 print_text_quit_fully Text06ee @@ -4765,9 +4573,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e656 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_04 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $02 + script_set_flag_value EVENT_FLAG_37, $02 print_text_string Text06f1 run_command Func_ccdc tx Text06f2 @@ -4777,14 +4583,9 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e66a - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_37 - db $02 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_37, $02, NO_JUMP print_variable_text Text06f4, Text06f5 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $03 + script_set_flag_value EVENT_FLAG_37, $03 ask_question_jump Text06ed, .ows_e67f print_text_quit_fully Text06f6 @@ -4799,9 +4600,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e68d run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_04 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $04 + script_set_flag_value EVENT_FLAG_37, $04 print_text_string Text06f9 run_command Func_ccdc tx Text06fa @@ -4811,14 +4610,9 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e6a1 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_37 - db $04 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_37, $04, NO_JUMP print_variable_text Text06fb, Text06fc - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $05 + script_set_flag_value EVENT_FLAG_37, $05 ask_question_jump Text06ed, .ows_e6b6 print_text_quit_fully Text06fd @@ -4833,9 +4627,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e6c4 run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_04 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_37 - db $06 + script_set_flag_value EVENT_FLAG_37, $06 print_text_string Text0700 run_command Func_ccdc tx Text0701 @@ -4925,8 +4717,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) start_script run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_4B - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e894 + move_active_npc NPCMovement_e894 run_command Func_d135 db $00 print_text_string Text0645 @@ -4934,9 +4725,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) move_player NORTH, 1 move_player NORTH, 1 print_text_string Text0646 - run_command ScriptCommand_AskQuestionJumpDefaultYes - dw 0000 - dw .ows_e882 + ask_question_jump_default_yes 0000, .ows_e882 print_text_string Text0647 script_jump .ows_e885 @@ -4947,11 +4736,10 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) close_text_box set_player_direction $03 move_player EAST, 4 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e894 + move_active_npc NPCMovement_e894 run_command Func_cdcb run_command Func_d41d - run_command ScriptCommand_QuitScriptFully + quit_script_fully NPCMovement_e894: ; e894 (3:6894) db SOUTH @@ -4966,27 +4754,20 @@ NPCMovement_e894: ; e894 (3:6894) Script_FirstRonaldFight: ; e8c0 (3:68c0) start_script - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e905 + move_active_npc NPCMovement_e905 do_frames $3c - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e90d + move_active_npc NPCMovement_e90d print_text_string Text064a - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $08 - db $02 - dw $68d6 + jump_if_player_coords_match $08, $02, $68d6 set_player_direction WEST move_player WEST, 1 set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 print_text_string Text064b - run_command ScriptCommand_SetFlagValue - db $4c - db $01 + script_set_flag_value $4c, $01 start_battle PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatFirstRonaldFight: ; e8e9 (3:68e9) start_script @@ -5001,15 +4782,12 @@ Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) print_text_string Text064e ScriptJump_FinishedFirstRonaldFight: - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_4C - db $02 + script_set_flag_value EVENT_FLAG_4C, $02 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e90f + move_active_npc NPCMovement_e90f run_command Func_cdcb run_command Func_d41d - run_command ScriptCommand_QuitScriptFully + quit_script_fully NPCMovement_e905: ; e905 (3:6905) db EAST @@ -5038,16 +4816,11 @@ NPCMovement_e90f: ; e90f (3:690f) ScriptSecondRonaldFight: ; e91e (3:691e) start_script - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e905 + move_active_npc NPCMovement_e905 do_frames 60 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e90d + move_active_npc NPCMovement_e90d print_text_string Text064f - run_command ScriptCommand_JumpIfPlayerCoordMatches - db $08 - db $02 - dw .ows_6934 + jump_if_player_coords_match $08, $02, .ows_6934 set_player_direction WEST move_player WEST, 1 .ows_6934 @@ -5055,11 +4828,9 @@ ScriptSecondRonaldFight: ; e91e (3:691e) move_player SOUTH, 1 move_player SOUTH, 1 print_text_string Text0650 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_4D - db $01 + script_set_flag_value EVENT_FLAG_4D, $01 start_battle PRIZES_6, POWERFUL_RONALD_DECK_ID, MUSIC_RONALD - run_command ScriptCommand_QuitScriptFully + quit_script_fully Script_BeatSecondRonaldFight: ; e947 (3:6947) start_script @@ -5074,15 +4845,12 @@ Script_LostToSecondRonaldFight: ; e955 (3:6955) print_text_string Text0653 ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_4D - db $02 + script_set_flag_value EVENT_FLAG_4D, $02 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_e90f + move_active_npc NPCMovement_e90f run_command Func_cdcb run_command Func_d41d - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xe963 @@ -5248,21 +5016,16 @@ Script_Lad2: ; ee2c (3:6e2c) Script_ee76: ; ee76 (3:6e76) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_21 - db $01 - dw .ows_ee7d - run_command ScriptCommand_QuitScriptFully + jump_if_flag_equal EVENT_FLAG_21, $01, .ows_ee7d + quit_script_fully .ows_ee7d - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_21 - db $02 + script_set_flag_value EVENT_FLAG_21, $02 run_command Func_ccdc tx Text06a2 give_card SLOWPOKE1 show_card_received_screen SLOWPOKE1 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xee88 Script_Mania: ; ee88 (3:6e88) @@ -5309,43 +5072,34 @@ Script_Jonathan: ; eefd (3:6efd) Script_Ken: ; ef22 (3:6f22) start_script - run_command ScriptCommand_TryGivePCPack - db $09 + try_give_pc_pack $09 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_23 dw .have_300_cards jump_if_enough_cards_owned 300, .have_300_cards - run_command ScriptCommand_JumpIfFlagZero1 - db EVENT_FLAG_24 - dw NO_JUMP + jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP run_command ScriptCommand_PrintVariableText tx Text06ba tx Text06bb - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_24 - db $01 - run_command ScriptCommand_QuitScriptFully + script_set_flag_value EVENT_FLAG_24, $01 + quit_script_fully .have_300_cards run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_23 run_command ScriptCommand_JumpIfFlagNonzero2 db EVENT_FLAG_0A dw Script_KenBattle_AlreadyHaveMedal - run_command ScriptCommand_JumpIfFlagZero1 - db EVENT_FLAG_24 - dw NO_JUMP + jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP run_command ScriptCommand_PrintVariableText tx Text06bc tx Text06bd - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_24 - db $01 + script_set_flag_value EVENT_FLAG_24, $01 run_command ScriptCommand_AskQuestionJump tx Text06be dw .do_battle run_command ScriptCommand_PrintTextString tx Text06bf - run_command ScriptCommand_QuitScriptFully + quit_script_fully .do_battle run_command ScriptCommand_PrintTextString tx Text06c0 @@ -5353,7 +5107,7 @@ Script_Ken: ; ef22 (3:6f22) db PRIZES_6 db FIRE_CHARGE_DECK_ID db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xef5e Script_BeatKen: ; ef5e (3:6f5e) @@ -5379,7 +5133,7 @@ Script_BeatKen: ; ef5e (3:6f5e) db NO_BOOSTER run_command ScriptCommand_PrintTextString tx Text06c3 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xef78 @@ -5392,7 +5146,7 @@ Script_LoseToKen: ; ef78 (3:6f78) run_command ScriptCommand_PrintVariableText tx Text06c4 tx Text06c5 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xef83 Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) @@ -5410,7 +5164,7 @@ Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) db PRIZES_6 db FIRE_CHARGE_DECK_ID db MUSIC_DUEL_THEME_2 - run_command ScriptCommand_QuitScriptFully + quit_script_fully ; 0xef96 Preload_Clerk9: ; ef96 (3:6f96) @@ -5492,57 +5246,19 @@ Preload_Clerk9: ; ef96 (3:6f96) Script_Clerk9: ; f025 (3:7025) start_script - run_command ScriptCommand_JumpIfFlagZero1 - db EVENT_FLAG_3F - dw .ows_f066 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $07 - dw .ows_f069 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $03 - dw .ows_f06f - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $02 - dw .ows_f072 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $01 - dw .ows_f06c - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $07 - dw .ows_f069 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $03 - dw .ows_f06f - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $02 - dw .ows_f072 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $01 - dw .ows_f06c - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $07 - dw .ows_f069 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $03 - dw .ows_f06f - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $02 - dw .ows_f072 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $01 - dw .ows_f06c + jump_if_flag_zero_1 EVENT_FLAG_3F, .ows_f066 + jump_if_flag_equal EVENT_FLAG_41, $07, .ows_f069 + jump_if_flag_equal EVENT_FLAG_41, $03, .ows_f06f + jump_if_flag_equal EVENT_FLAG_41, $02, .ows_f072 + jump_if_flag_equal EVENT_FLAG_41, $01, .ows_f06c + jump_if_flag_equal EVENT_FLAG_40, $07, .ows_f069 + jump_if_flag_equal EVENT_FLAG_40, $03, .ows_f06f + jump_if_flag_equal EVENT_FLAG_40, $02, .ows_f072 + jump_if_flag_equal EVENT_FLAG_40, $01, .ows_f06c + jump_if_flag_equal EVENT_FLAG_3F, $07, .ows_f069 + jump_if_flag_equal EVENT_FLAG_3F, $03, .ows_f06f + jump_if_flag_equal EVENT_FLAG_3F, $02, .ows_f072 + jump_if_flag_equal EVENT_FLAG_3F, $01, .ows_f06c .ows_f066 print_text_quit_fully Text050a @@ -5745,9 +5461,7 @@ Script_Guide: ; f283 (3:7283) print_text_quit_fully Text0526 .ows_f28b - run_command ScriptCommand_JumpIfFlagZero1 - db $3f - dw .ows_f292 + jump_if_flag_zero_1 EVENT_FLAG_3F, .ows_f292 print_text_quit_fully Text0527 .ows_f292 @@ -5755,38 +5469,14 @@ Script_Guide: ; f283 (3:7283) Script_Clerk12: ; f295 (3:7295) start_script - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $03 - dw .ows_f2c4 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_41 - db $02 - dw .ows_f2c1 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $03 - dw .ows_f2c4 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_40 - db $02 - dw .ows_f2c1 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $03 - dw .ows_f2c4 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_3F - db $02 - dw .ows_f2c1 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $02 - dw .ows_f2cd - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f2d3 + jump_if_flag_equal EVENT_FLAG_41, $03, .ows_f2c4 + jump_if_flag_equal EVENT_FLAG_41, $02, .ows_f2c1 + jump_if_flag_equal EVENT_FLAG_40, $03, .ows_f2c4 + jump_if_flag_equal EVENT_FLAG_40, $02, .ows_f2c1 + jump_if_flag_equal EVENT_FLAG_3F, $03, .ows_f2c4 + jump_if_flag_equal EVENT_FLAG_3F, $02, .ows_f2c1 + jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f2cd + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f2d3 script_jump .ows_f2c7 .ows_f2c1 @@ -5815,16 +5505,9 @@ Script_Clerk12: ; f295 (3:7295) db EVENT_FLAG_59 print_text_string Text0531 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f349 - run_command ScriptCommand_JumpIfPlayerCoordMatches - db 8 - db 18 - dw .ows_f2fa - run_command ScriptCommand_JumpIfPlayerCoordMatches - db 12 - db 18 - dw .ows_f302 + move_active_npc NPCMovement_f349 + jump_if_player_coords_match 8, 18, .ows_f2fa + jump_if_player_coords_match 12, 18, .ows_f302 move_player NORTH, 2 script_jump .ows_f307 @@ -5863,8 +5546,7 @@ Script_Clerk12: ; f295 (3:7295) .ows_f33a set_player_direction EAST move_player EAST, 1 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f34e + move_active_npc NPCMovement_f34e close_advanced_text_box set_next_npc_and_script $4a, Script_f353 end_script_loop @@ -5893,31 +5575,26 @@ Script_Host: ; f352 (3:7352) Script_f353: ; f353 (3:7353) start_script do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37d + move_active_npc NPCMovement_f37d do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f390 + move_active_npc NPCMovement_f390 run_command Func_d16b db $00 print_text_string Text0532 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37f + move_active_npc NPCMovement_f37f print_text_string Text0533 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f388 + move_active_npc NPCMovement_f388 print_text_string Text0534 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f38e + move_active_npc NPCMovement_f38e print_text_string Text0535 run_command Func_cd4f db $04 db $00 db $00 - run_command ScriptCommand_QuitScriptFully + quit_script_fully NPCMovement_f37d: ; f37d (3:737d) db EAST | NO_MOVE @@ -5959,19 +5636,11 @@ NPCMovement_f390: ; f390 (3:7390) LostAtChallengeHall: ; f392 (3:7392) start_script do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37d + move_active_npc NPCMovement_f37d do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f390 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $02 - dw ScriptJump_f410 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $03 - dw ScriptJump_f410.ows_f41a + move_active_npc NPCMovement_f390 + jump_if_flag_equal EVENT_FLAG_45, $02, ScriptJump_f410 + jump_if_flag_equal EVENT_FLAG_45, $03, ScriptJump_f410.ows_f41a run_command Func_d16b db $00 run_command Func_d16b @@ -5979,46 +5648,26 @@ LostAtChallengeHall: ; f392 (3:7392) print_text_string Text0536 .ows_f3ae close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f38b + move_active_npc NPCMovement_f38b print_text_string Text0537 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f38e - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $02 - dw .ows_f3ce - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f3d9 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_3F - db $03 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_48 - db $03 + move_active_npc NPCMovement_f38e + jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f3ce + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f3d9 + script_set_flag_value EVENT_FLAG_3F, $03 + script_set_flag_value EVENT_FLAG_48, $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_51 script_jump .ows_f3e2 .ows_f3ce - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_40 - db $03 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_49 - db $03 + script_set_flag_value EVENT_FLAG_40, $03 + script_set_flag_value EVENT_FLAG_49, $03 run_command ScriptCommand_ZeroOutFlagValue db EVENT_FLAG_55 script_jump .ows_f3e2 .ows_f3d9 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_41 - db $03 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_4A - db $03 + script_set_flag_value EVENT_FLAG_41, $03 + script_set_flag_value EVENT_FLAG_4A, $03 script_jump .ows_f3e2 .ows_f3e2 close_advanced_text_box @@ -6028,8 +5677,7 @@ LostAtChallengeHall: ; f392 (3:7392) Script_f3e9: ; f3e9 (3:73e9) start_script - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f40a + move_active_npc NPCMovement_f40a set_player_direction WEST move_player WEST, 1 set_player_direction SOUTH @@ -6039,9 +5687,8 @@ Script_f3e9: ; f3e9 (3:73e9) move_player SOUTH, 1 move_player SOUTH, 1 move_player SOUTH, 1 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f40d - run_command ScriptCommand_QuitScriptFully + move_active_npc NPCMovement_f40d + quit_script_fully NPCMovement_f40a: ; f40a (3:740a) db WEST @@ -6064,14 +5711,8 @@ ScriptJump_f410: ; f410 (4:7410) .ows_f41a print_text_string Text0539 set_dialog_npc NPC_RONALD1 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f42e - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $01 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f42e + jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP print_variable_text Text053a, Text053b .ows_f42e set_dialog_npc NPC_HOST @@ -6080,43 +5721,28 @@ ScriptJump_f410: ; f410 (4:7410) Script_f433: ; f433 (3:7433) start_script do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37d + move_active_npc NPCMovement_f37d do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f390 + move_active_npc NPCMovement_f390 script_jump WonAtChallengeHall.ows_f4a4 WonAtChallengeHall: ; f441 (3:7441) start_script do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37d + move_active_npc NPCMovement_f37d do_frames 20 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f390 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $03 - dw ScriptJump_f4db - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $02 - dw .ows_f456 + move_active_npc NPCMovement_f390 + jump_if_flag_equal EVENT_FLAG_45, $03, ScriptJump_f4db + jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f456 .ows_f456 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $01 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $01, NO_JUMP print_variable_text Text053c, Text053d - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37f + move_active_npc NPCMovement_f37f run_command Func_d16b db $00 print_text_string Text053e close_text_box - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f4c8 + move_wram_npc NPCMovement_f4c8 run_command Func_cdd8 print_text_string Text053f close_text_box @@ -6124,31 +5750,17 @@ WonAtChallengeHall: ; f441 (3:7441) run_command Func_cdf5 db $14 db $14 - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f4d0 + move_wram_npc NPCMovement_f4d0 run_command Func_d16b db $00 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $02 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $02, NO_JUMP print_variable_text Text0540, Text0541 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f383 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $02 - dw .ows_f4a4 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f4a1 + move_active_npc NPCMovement_f383 + jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f4a4 + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f4a1 close_text_box set_dialog_npc $02 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $01 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP print_variable_text Text0542, Text0543 set_dialog_npc NPC_HOST close_text_box @@ -6161,16 +5773,13 @@ WonAtChallengeHall: ; f441 (3:7441) run_command ScriptCommand_AskQuestionJumpDefaultYes tx Text0546 dw .ows_f4bd - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_45 - db $02 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $02, NO_JUMP print_variable_text Text0547, Text0548 run_command Func_cd4f db $04 db $00 db $00 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_f4bd print_text_string Text0549 close_text_box @@ -6208,84 +5817,50 @@ NPCMovement_f4d8: ; f4d8 (3:74d8) ScriptJump_f4db: ; f4db (3:74db) print_text_string Text054a - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f37f + move_active_npc NPCMovement_f37f run_command Func_d16b db $00 print_text_string Text054b close_text_box - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f513 + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 set_dialog_npc $02 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $01 - dw NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP print_variable_text Text054c, Text054d - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f4d8 + move_wram_npc NPCMovement_f4d8 do_frames 40 - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f34c - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $01 - dw NO_JUMP + move_wram_npc NPCMovement_f34c + jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP print_variable_text Text054e, Text054f set_dialog_npc NPC_HOST close_text_box - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f4c9 + move_wram_npc NPCMovement_f4c9 script_jump .ows_f516 .ows_f513 - run_command ScriptCommand_MoveWramNPC - dw NPCMovement_f4c8 + move_wram_npc NPCMovement_f4c8 .ows_f516 run_command Func_cdd8 - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f383 + move_active_npc NPCMovement_f383 print_text_string Text0550 close_text_box - run_command ScriptCommand_MoveActiveNPC - dw NPCMovement_f38b + move_active_npc NPCMovement_f38b run_command Func_d1b3 print_text_string Text0551 give_card $00 show_card_received_screen $00 print_text_string Text0552 close_text_box - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $02 - dw .ows_f540 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_44 - db $03 - dw .ows_f549 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_3F - db $02 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_48 - db $02 + jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f540 + jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f549 + script_set_flag_value EVENT_FLAG_3F, $02 + script_set_flag_value EVENT_FLAG_48, $02 script_jump .ows_f552 .ows_f540 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_40 - db $02 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_49 - db $02 + script_set_flag_value EVENT_FLAG_40, $02 + script_set_flag_value EVENT_FLAG_49, $02 script_jump .ows_f552 .ows_f549 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_41 - db $02 - run_command ScriptCommand_SetFlagValue - db EVENT_FLAG_4A - db $02 + script_set_flag_value EVENT_FLAG_41, $02 + script_set_flag_value EVENT_FLAG_4A, $02 script_jump .ows_f552 .ows_f552 close_advanced_text_box @@ -6420,13 +5995,10 @@ Script_fbf1: ; fbf1 (3:7bf1) run_command Func_d396 db $01 run_command Func_d3b9 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_fc10 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_71 - db $0f - dw .ows_fc20 + jump_if_flag_equal EVENT_FLAG_71, $0f, .ows_fc20 run_command Func_d209 run_command Func_ccdc tx Text05ba @@ -6471,14 +6043,12 @@ PointerTable_fc4c: ; fc4c (3:7c4c) Script_fc52: ; fc52 (3:7c52) start_script print_text_string Text06c8 - run_command ScriptCommand_AskQuestionJumpDefaultYes - dw $0000 - dw .ows_fc5e + ask_question_jump_default_yes $0000, .ows_fc5e print_text_quit_fully Text06c9 .ows_fc5e run_command Func_cd76 - run_command ScriptCommand_QuitScriptFully + quit_script_fully Unknown_fc60: ; fc60 (3:7c60) INCROM $fc60, $fc64 @@ -6507,17 +6077,11 @@ Func_fc7a: ; fc7a (3:7c7a) set_flag_value EVENT_FLAG_74 start_script - run_command ScriptCommand_JumpIfFlagNotEqual - db EVENT_FLAG_74 - db $02 - dw Func_fcad.ows_fcd5 + jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5 print_text_string Text06cd run_command Func_d39d db $00 - run_command ScriptCommand_JumpIfFlagNotLessThan - db EVENT_FLAG_72 - db $04 - dw Func_fc7a.ows_fcaa + jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa print_text_string Text06ce run_command ScriptCommand_AskQuestionJumpDefaultYes tx Text06cf @@ -6528,13 +6092,12 @@ Func_fc7a: ; fc7a (3:7c7a) .ows_fca0 run_command Func_d396 db $00 - run_command ScriptCommand_PlaySFX - db $56 + play_sfx $56 run_command Func_ccdc tx Text06d1 run_command Func_d39d db $01 - run_command ScriptCommand_QuitScriptFully + quit_script_fully .ows_fcaa print_text_quit_fully Text06d2 @@ -6545,22 +6108,12 @@ Func_fcad: ; fcad (3:7cad) set_flag_value EVENT_FLAG_72 start_script - run_command ScriptCommand_PlaySFX - db $56 + play_sfx $56 run_command Func_d396 db $00 - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_72 - db $00 - dw .ows_fccc - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_72 - db $02 - dw .ows_fccf - run_command ScriptCommand_JumpIfFlagEqual - db EVENT_FLAG_72 - db $03 - dw .ows_fcd2 + jump_if_flag_equal EVENT_FLAG_72, $00, .ows_fccc + jump_if_flag_equal EVENT_FLAG_72, $02, .ows_fccf + jump_if_flag_equal EVENT_FLAG_72, $03, .ows_fcd2 script_jump Func_fc7a.ows_fcaa .ows_fccc @@ -6573,14 +6126,10 @@ Func_fcad: ; fcad (3:7cad) print_text_quit_fully Text06d5 .ows_fcd5 - run_command ScriptCommand_MoveArbitraryNPC - db NPC_GIFT_CENTER_CLERK - dw NPCMovement_fce1 + move_arbitrary_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce1 print_text_string Text06d6 - run_command ScriptCommand_MoveArbitraryNPC - db NPC_GIFT_CENTER_CLERK - dw NPCMovement_fce3 - run_command ScriptCommand_QuitScriptFully + move_arbitrary_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce3 + quit_script_fully NPCMovement_fce1: ; fce1 (3:7ce1) db SOUTH | NO_MOVE diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index e6171e5..7a7f052 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1006,7 +1006,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw Func_d0be dw ScriptCommand_DoFrames dw Func_d0d9 - dw ScriptCommand_JumpIfPlayerCoordMatches + dw ScriptCommand_JumpIfPlayerCoordsMatch dw ScriptCommand_MoveActiveNPC dw ScriptCommand_GiveOneOfEachTrainerBooster dw Func_d103 diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 63d514a..6081750 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -43,7 +43,7 @@ ENDM const Func_d0be_index ; $23 const ScriptCommand_DoFrames_index ; $24 const Func_d0d9_index ; $25 - const ScriptCommand_JumpIfPlayerCoordMatches_index ; $26 + const ScriptCommand_JumpIfPlayerCoordsMatch_index ; $26 const ScriptCommand_MoveActiveNPC_index ; $27 const ScriptCommand_GiveOneOfEachTrainerBooster_index ; $28 const Func_d103_index ; $29 @@ -217,6 +217,81 @@ do_frames: MACRO db \1 ENDM +jump_if_player_coords_match: MACRO + run_command ScriptCommand_JumpIfPlayerCoordsMatch + db \1 + db \2 + dw \3 +ENDM +move_active_npc: MACRO + run_command ScriptCommand_MoveActiveNPC + dw \1 +ENDM +give_one_of_each_trainer_booster: MACRO + run_command ScriptCommand_GiveOneOfEachTrainerBooster +ENDM + +move_wram_npc: MACRO + run_command ScriptCommand_MoveWramNPC + dw \1 +ENDM + +quit_script_fully: MACRO + run_command ScriptCommand_QuitScriptFully +ENDM + +open_deck_machine: MACRO + run_command ScriptCommand_OpenDeckMachine + db \1 +ENDM + +enter_map: MACRO + run_command ScriptCommand_EnterMap + db \1 + db \2 + db \3 + db \4 + db \5 +ENDM +move_arbitrary_npc: MACRO + run_command ScriptCommand_MoveArbitraryNPC + db \1 + dw \2 +ENDM + +try_give_pc_pack: MACRO + run_command ScriptCommand_TryGivePCPack + db \1 +ENDM +script_nop: MACRO + run_command ScriptCommand_nop +ENDM + +play_sfx: MACRO + run_command ScriptCommand_PlaySFX + db \1 +ENDM +pause_song: MACRO + run_command ScriptCommand_PauseSong +ENDM +resume_song: MACRO + run_command ScriptCommand_ResumeSong +ENDM + +wait_for_song_to_finish: MACRO + run_command ScriptCommand_WaitForSongToFinish +ENDM + +ask_question_jump_default_yes: MACRO + run_command ScriptCommand_AskQuestionJumpDefaultYes +IF \1 == 0 + dw 0000 +ELSE + tx \1 +ENDC + dw \2 +ENDM + end_script_loop_2: MACRO run_command ScriptCommand_EndScriptLoop2 ENDM @@ -232,6 +307,41 @@ ENDM end_script_loop_6: MACRO run_command ScriptCommand_EndScriptLoop6 ENDM +script_set_flag_value: MACRO + run_command ScriptCommand_SetFlagValue + db \1 + db \2 +ENDM +jump_if_flag_zero_1: MACRO + run_command ScriptCommand_JumpIfFlagZero1 + db \1 + dw \2 +ENDM +jump_if_flag_nonzero_1: MACRO + run_command ScriptCommand_JumpIfFlagNonzero1 + db \1 + dw \2 +ENDM +jump_if_flag_equal: MACRO + run_command ScriptCommand_JumpIfFlagEqual + db \1 + db \2 + dw \3 +ENDM +jump_if_flag_not_equal: MACRO + run_command ScriptCommand_JumpIfFlagNotEqual + db \1 + db \2 + dw \3 +ENDM +jump_if_flag_not_less_than: MACRO + run_command ScriptCommand_JumpIfFlagNotLessThan + db \1 + db \2 + dw \3 +ENDM + + end_script_loop_7: MACRO run_command ScriptCommand_EndScriptLoop7 diff --git a/tools/script_extractor.py b/tools/script_extractor.py index bfc2eb8..fd1028c 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -251,62 +251,62 @@ def createList(): # this is a func just so all this can go at the bottom ("Func_d0be", "bb", DO_NOT_QUIT,""), ("ScriptCommand_DoFrames", "i", DO_NOT_QUIT,"do_frames"), ("Func_d0d9", "bbw", DO_NOT_QUIT,""), # jumps but still needs args - ("ScriptCommand_JumpIfPlayerCoordMatches", "iij", DO_NOT_QUIT,""), # jumps but still needs args - ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT,""), - ("ScriptCommand_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfPlayerCoordsMatch", "iij", DO_NOT_QUIT,"jump_if_player_coords_match"), # jumps but still needs args + ("ScriptCommand_MoveActiveNPC", "m", DO_NOT_QUIT,"move_active_npc"), + ("ScriptCommand_GiveOneOfEachTrainerBooster", "", DO_NOT_QUIT,"give_one_of_each_trainer_booster"), ("Func_d103", "q", DO_NOT_QUIT,""), ("Func_d125", "b", DO_NOT_QUIT,""), ("Func_d135", "b", DO_NOT_QUIT,""), ("Func_d16b", "b", DO_NOT_QUIT,""), ("Func_cd4f", "bbb", DO_NOT_QUIT,""), ("Func_cd94", "q", DO_NOT_QUIT,""), - ("ScriptCommand_MoveWramNPC", "m", DO_NOT_QUIT,""), + ("ScriptCommand_MoveWramNPC", "m", DO_NOT_QUIT,"move_wram_npc"), ("Func_cdd8", "", DO_NOT_QUIT,""), ("Func_cdf5", "bb", DO_NOT_QUIT,""), ("Func_d195", "", DO_NOT_QUIT,""), ("Func_d1ad", "", DO_NOT_QUIT,""), ("Func_d1b3", "", DO_NOT_QUIT,""), - ("ScriptCommand_QuitScriptFully", "", QUIT_SPECIAL,""), + ("ScriptCommand_QuitScriptFully", "", QUIT_SPECIAL,"quit_script_fully"), ("Func_d244", "q", DO_NOT_QUIT,""), ("Func_d24c", "q", DO_NOT_QUIT,""), - ("ScriptCommand_OpenDeckMachine", "b", DO_NOT_QUIT,""), + ("ScriptCommand_OpenDeckMachine", "b", DO_NOT_QUIT,"open_deck_machine"), ("Func_d271", "q", DO_NOT_QUIT,""), - ("ScriptCommand_EnterMap", "bbood", DO_NOT_QUIT,""), - ("ScriptCommand_MoveArbitraryNPC", "bm", DO_NOT_QUIT,""), + ("ScriptCommand_EnterMap", "bbood", DO_NOT_QUIT,"enter_map"), + ("ScriptCommand_MoveArbitraryNPC", "bm", DO_NOT_QUIT,"move_arbitrary_npc"), ("Func_d209", "", DO_NOT_QUIT,""), ("Func_d38f", "b", DO_NOT_QUIT,""), ("Func_d396", "b", DO_NOT_QUIT,""), ("Func_cd76", "", DO_NOT_QUIT,""), ("Func_d39d", "b", DO_NOT_QUIT,""), ("Func_d3b9", "", DO_NOT_QUIT,""), - ("ScriptCommand_TryGivePCPack", "b", DO_NOT_QUIT,""), - ("ScriptCommand_nop", "", DO_NOT_QUIT,""), + ("ScriptCommand_TryGivePCPack", "b", DO_NOT_QUIT,"try_give_pc_pack"), + ("ScriptCommand_nop", "", DO_NOT_QUIT,"script_nop"), ("Func_d3d4", "q", DO_NOT_QUIT,""), ("Func_d3e0", "", DO_NOT_QUIT,""), ("Func_d3fe", "q", DO_NOT_QUIT,""), ("Func_d408", "b", DO_NOT_QUIT,""), ("Func_d40f", "q", DO_NOT_QUIT,""), - ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT,""), - ("ScriptCommand_PauseSong", "q", DO_NOT_QUIT,""), - ("ScriptCommand_ResumeSong", "q", DO_NOT_QUIT,""), + ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT,"play_sfx"), + ("ScriptCommand_PauseSong", "", DO_NOT_QUIT,"pause_song"), + ("ScriptCommand_ResumeSong", "", DO_NOT_QUIT,"resume_song"), ("Func_d41d", "", DO_NOT_QUIT,""), - ("ScriptCommand_WaitForSongToFinish", "q", DO_NOT_QUIT,""), + ("ScriptCommand_WaitForSongToFinish", "", DO_NOT_QUIT,"wait_for_song_to_finish"), ("Func_d435", "b", DO_NOT_QUIT,""), - ("ScriptCommand_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT,""), + ("ScriptCommand_AskQuestionJumpDefaultYes", "tj", DO_NOT_QUIT,"ask_question_jump_default_yes"), ("Func_d2f6", "q", DO_NOT_QUIT,""), ("Func_d317", "", DO_NOT_QUIT,""), ("Func_d43d", "", DO_NOT_QUIT,""), - ("ScriptCommand_EndScriptLoop2", "q", QUIT_CONTINUE_CODE,"end_script_loop_2"), - ("ScriptCommand_EndScriptLoop3", "q", QUIT_CONTINUE_CODE,"end_script_loop_3"), - ("ScriptCommand_EndScriptLoop4", "q", QUIT_CONTINUE_CODE,"end_script_loop_4"), - ("ScriptCommand_EndScriptLoop5", "q", QUIT_CONTINUE_CODE,"end_script_loop_5"), - ("ScriptCommand_EndScriptLoop6", "q", QUIT_CONTINUE_CODE,"end_script_loop_6"), - ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT,""), - ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT,""), - ("ScriptCommand_JumpIfFlagNonzero1", "q", DO_NOT_QUIT,""), - ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT,""), # also capable of jumping - ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT,""), # jumps - ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT,""), + ("ScriptCommand_EndScriptLoop2", "", QUIT_CONTINUE_CODE,"end_script_loop_2"), + ("ScriptCommand_EndScriptLoop3", "", QUIT_CONTINUE_CODE,"end_script_loop_3"), + ("ScriptCommand_EndScriptLoop4", "", QUIT_CONTINUE_CODE,"end_script_loop_4"), + ("ScriptCommand_EndScriptLoop5", "", QUIT_CONTINUE_CODE,"end_script_loop_5"), + ("ScriptCommand_EndScriptLoop6", "", QUIT_CONTINUE_CODE,"end_script_loop_6"), + ("ScriptCommand_SetFlagValue", "fb", DO_NOT_QUIT,"script_set_flag_value"), + ("ScriptCommand_JumpIfFlagZero1", "fj", DO_NOT_QUIT,"jump_if_flag_zero_1"), + ("ScriptCommand_JumpIfFlagNonzero1", "fj", DO_NOT_QUIT,"jump_if_flag_nonzero_1"), + ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT,"jump_if_flag_equal"), + ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT,"jump_if_flag_not_equal"), + ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT,"jump_if_flag_not_less_than"), ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT,""), ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT,""), ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT,""), -- cgit v1.2.3 From 5930b53dd28705197ebfc1a905ea3175552ba39a Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 20 Dec 2020 16:19:47 -0500 Subject: Finished all known commands before pulling from main again --- src/engine/bank03.asm | 382 +++++++++++++--------------------------------- src/macros/scripts.asm | 40 ++++- tools/script_extractor.py | 14 +- 3 files changed, 154 insertions(+), 282 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index a2685d6..b4561f3 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3339,10 +3339,8 @@ Script_d827: ; d827 (3:5827) AfterTutorialBattleScript: ; d834 (3:5834) start_script - run_command ScriptCommand_PrintTextString - tx Text05eb - run_command ScriptCommand_PrintTextString - tx Text05ef + print_text_string Text05eb + print_text_string Text05ef close_text_box move_active_npc NPCMovement_d896 set_player_direction NORTH @@ -3353,14 +3351,12 @@ AfterTutorialBattleScript: ; d834 (3:5834) move_player EAST, 1 move_player EAST, 1 set_player_direction NORTH - run_command ScriptCommand_PrintTextString - tx Text05f0 + print_text_string Text05f0 close_text_box run_command Func_ccdc tx Text05f1 close_text_box - run_command ScriptCommand_PrintTextString - tx Text05f2 + print_text_string Text05f2 run_command Func_d271 ; 0xd860 @@ -3426,9 +3422,7 @@ Script_d932: ; d932 (3:5932) start_script run_command Func_ccdc tx Text0605 - run_command ScriptCommand_AskQuestionJumpDefaultYes - tx Text0606 - dw .ows_d93c + ask_question_jump_default_yes Text0606, .ows_d93c quit_script_fully .ows_d93c @@ -3461,22 +3455,13 @@ Preload_IshiharaInIshiharasHouse: ; db3d (3:5b3d) Script_Ishihara: ; db4a (3:5b4a) start_script - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_1D + max_out_flag_value EVENT_FLAG_1D jump_if_flag_equal EVENT_FLAG_1F, $00, .ows_db80 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_39 - dw .ows_db5a - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_RECEIVED_LEGENDARY_CARD - dw .ows_dc3e + jump_if_flag_nonzero_2 EVENT_FLAG_39, .ows_db5a + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_dc3e .ows_db5a - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_00 - dw .ows_db90 - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_38 - dw .ows_db90 + jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_db90 + jump_if_flag_zero_2 EVENT_FLAG_38, .ows_db90 jump_if_flag_equal EVENT_FLAG_1F, $01, .ows_db93 jump_if_flag_equal EVENT_FLAG_1F, $02, .ows_db93 jump_if_flag_equal EVENT_FLAG_1F, $03, .ows_dbcc @@ -3484,16 +3469,11 @@ Script_Ishihara: ; db4a (3:5b4a) jump_if_flag_equal EVENT_FLAG_1F, $05, .ows_dc05 jump_if_flag_equal EVENT_FLAG_1F, $06, .ows_dc05 .ows_db80 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_00 + max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $01 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_38 - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_RECEIVED_LEGENDARY_CARD - dw .ows_db8d - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_39 + zero_out_flag_value EVENT_FLAG_38 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_db8d + max_out_flag_value EVENT_FLAG_39 .ows_db8d print_text_quit_fully Text0727 @@ -3516,11 +3496,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text072e .do_clefable_trade - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_00 + max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $03 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_38 + zero_out_flag_value EVENT_FLAG_38 print_text_string Text072f run_command Func_ccdc tx Text0730 @@ -3545,11 +3523,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0735 .do_ditto_trade - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_00 + max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $05 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_38 + zero_out_flag_value EVENT_FLAG_38 print_text_string Text072f run_command Func_ccdc tx Text0736 @@ -3574,11 +3550,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text073b .do_chansey_trade - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_00 + max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $07 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_38 + zero_out_flag_value EVENT_FLAG_38 print_text_string Text072f run_command Func_ccdc tx Text073c @@ -3588,8 +3562,7 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text073d .ows_dc3e - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_39 + max_out_flag_value EVENT_FLAG_39 print_text_quit_fully Text073e Preload_Ronald1InIshiharasHouse: ; dc43 (3:5c43) @@ -3600,11 +3573,8 @@ Preload_Ronald1InIshiharasHouse: ; dc43 (3:5c43) Script_Ronald: ; dc4b (3:5c4b) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_4E - dw .ows_dc55 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_4E + jump_if_flag_nonzero_2 EVENT_FLAG_4E, .ows_dc55 + max_out_flag_value EVENT_FLAG_4E print_text_quit_fully Text073f .ows_dc55 @@ -3640,12 +3610,9 @@ Script_Man1: ; dc76 (3:5c76) Script_Imakuni: ; dd0d (3:5d0d) start_script script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_TALKED - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_TEMP_TALKED_TO_IMAKUNI - dw NO_JUMP + jump_if_flag_zero_2 EVENT_TEMP_TALKED_TO_IMAKUNI, NO_JUMP print_variable_text Text0467, Text0468 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_TEMP_TALKED_TO_IMAKUNI + max_out_flag_value EVENT_TEMP_TALKED_TO_IMAKUNI ask_question_jump Text0469, .declineDuel print_text_string Text046a quit_script_fully @@ -3658,8 +3625,7 @@ Script_Imakuni: ; dd0d (3:5d0d) Script_BeatImakuni: ; dd2d (3:5d2d) start_script jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $07, .giveBoosters - run_command ScriptCommand_IncrementFlagValue - db EVENT_IMAKUNI_WIN_COUNT + script_increment_flag_value EVENT_IMAKUNI_WIN_COUNT jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $03, .threeWins jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $06, .sixWins .giveBoosters @@ -3697,8 +3663,7 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60) .ows_dd6e move_active_npc NPCMovement_dd78 run_command Func_cdcb - run_command ScriptCommand_MaxOutFlagValue - db EVENT_TEMP_BATTLED_IMAKUNI + max_out_flag_value EVENT_TEMP_BATTLED_IMAKUNI run_command Func_d408 db $09 run_command Func_d41d @@ -3760,124 +3725,80 @@ FightingClubAfterDuel: ; dda3 (3:5da3) Script_Mitch: ; ddc3 (3:5dc3) start_script try_give_pc_pack $02 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_AlreadyHaveMedal - run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus - dw .first_interaction - dw .three_pupils_remaining - dw .two_pupils_remaining - dw .one_pupil_remaining - dw .all_pupils_defeated + jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_AlreadyHaveMedal + fight_club_pupil_jump .first_interaction, .three_pupils_remaining, \ + .two_pupils_remaining, .one_pupil_remaining, .all_pupils_defeated .first_interaction - run_command ScriptCommand_PrintTextString - tx Text0477 + print_text_string Text0477 script_set_flag_value EVENT_FLAG_11, $01 script_set_flag_value EVENT_FLAG_17, $01 script_set_flag_value EVENT_FLAG_20, $01 quit_script_fully ; 0xdde2 .three_pupils_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text0478 + print_text_quit_fully Text0478 ; 0xdde5 .two_pupils_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text0479 + print_text_quit_fully Text0479 ; 0xdde8 .one_pupil_remaining - run_command ScriptCommand_PrintTextQuitFully - tx Text047a + print_text_quit_fully Text047a ; 0xddeb .all_pupils_defeated - run_command ScriptCommand_PrintTextString - tx Text047b - run_command ScriptCommand_AskQuestionJump - tx Text047c - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text047d + print_text_string Text047b + ask_question_jump Text047c, .do_battle + print_text_string Text047d quit_script_fully ; 0xddf7 .do_battle - run_command ScriptCommand_PrintTextString - tx Text047e - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRST_STRIKE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text047e + start_battle PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully ; 0xddff Script_BeatMitch: ; ddff (3:5dff) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_GiveBoosters - run_command ScriptCommand_PrintTextString - tx Text047f - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_0F + jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_GiveBoosters + print_text_string Text047f + max_out_flag_value EVENT_FLAG_0F try_give_medal_pc_packs run_command Func_d125 db $0f run_command Func_d435 db $01 - run_command ScriptCommand_PrintTextString - tx Text0480 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_LABORATORY_NEUTRAL - db BOOSTER_LABORATORY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0481 + print_text_string Text0480 + give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER + print_text_string Text0481 quit_script_fully ; 0xde19 Script_LoseToMitch: ; de19 (3:5e19) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0F - dw Script_Mitch_PrintTrainHarderText - run_command ScriptCommand_PrintTextQuitFully - tx Text0482 + jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_PrintTrainHarderText + print_text_quit_fully Text0482 ; 0xde21 Script_Mitch_AlreadyHaveMedal: ; 0xde21 - run_command ScriptCommand_PrintTextString - tx Text0483 - run_command ScriptCommand_AskQuestionJump - tx Text047c - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text0484 + print_text_string Text0483 + ask_question_jump Text047c, .do_battle + print_text_string Text0484 quit_script_fully ; 0xde2d .do_battle - run_command ScriptCommand_PrintTextString - tx Text0485 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRST_STRIKE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text0485 + start_battle PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully ; 0xde35 Script_Mitch_GiveBoosters: - run_command ScriptCommand_PrintTextString - tx Text0486 - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_LABORATORY_NEUTRAL - db BOOSTER_LABORATORY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text0487 + print_text_string Text0486 + give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER + print_text_string Text0487 quit_script_fully ; 0xde40 Script_Mitch_PrintTrainHarderText: - run_command ScriptCommand_PrintTextQuitFully - tx Text0488 + print_text_quit_fully Text0488 ; 0xde43 INCROM $de43, $ded1 @@ -4013,9 +3934,7 @@ Script_Lass1: ; e111 (3:6111) .ows_e121 jump_if_flag_not_equal EVENT_IMAKUNI_ROOM, IMAKUNI_WATER_CLUB, .ows_e12d - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_TEMP_BATTLED_IMAKUNI - dw .ows_e12d + jump_if_flag_nonzero_2 EVENT_TEMP_BATTLED_IMAKUNI, .ows_e12d print_text_quit_fully Text0428 .ows_e12d @@ -4086,8 +4005,7 @@ Script_Sara: ; e177 (3:6177) Script_BeatSara: ; e18c (3:618c) start_script - run_command ScriptCommand_MaxOutFlagValue - db EVENT_BEAT_SARA + max_out_flag_value EVENT_BEAT_SARA print_text_string Text0430 give_booster_packs BOOSTER_COLOSSEUM_WATER, BOOSTER_COLOSSEUM_WATER, NO_BOOSTER print_text_string Text0431 @@ -4110,8 +4028,7 @@ Script_Amanda: ; e19e (03:619e) Script_BeatAmanda: ; e1b3 (03:61b3) start_script - run_command ScriptCommand_MaxOutFlagValue - db EVENT_BEAT_AMANDA + max_out_flag_value EVENT_BEAT_AMANDA print_text_string Text0437 give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER print_text_string Text0438 @@ -4191,12 +4108,8 @@ NPCMovement_e219: ; e219 (3:6219) Script_Joshua: ; e21c (3:621c) start_script - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_BEAT_AMANDA - dw .sara_and_amanda_not_beaten - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_BEAT_SARA - dw .sara_and_amanda_not_beaten + jump_if_flag_zero_2 EVENT_BEAT_AMANDA, .sara_and_amanda_not_beaten + jump_if_flag_zero_2 EVENT_BEAT_SARA, .sara_and_amanda_not_beaten script_jump .beat_sara_and_amanda .sara_and_amanda_not_beaten script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_TALKED @@ -4316,9 +4229,7 @@ Script_MeetAmy: ; e2d1 (3:62d1) Script_Amy: ; e304 (3:6304) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_BEAT_AMY - dw ScriptJump_TalkToAmyAgain + jump_if_flag_nonzero_2 EVENT_BEAT_AMY, ScriptJump_TalkToAmyAgain print_text_string Text044f .askConfirmDuel ask_question_jump Text0450, .startDuel @@ -4339,12 +4250,9 @@ Script_Amy: ; e304 (3:6304) Script_BeatAmy: ; e322 (3:6322) start_script print_text_string Text0453 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_BEAT_AMY - dw .beatAmyCommon + jump_if_flag_nonzero_2 EVENT_BEAT_AMY, .beatAmyCommon print_text_string Text0454 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_BEAT_AMY + max_out_flag_value EVENT_BEAT_AMY try_give_medal_pc_packs run_command Func_d125 db EVENT_BEAT_AMY @@ -4502,10 +4410,7 @@ GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) Script_Brittany: ; e5d2 (3:65d2) start_script - run_command ScriptCommand_JumpIfFlagLessThan - db EVENT_FLAG_35 - db $01 - dw NO_JUMP + jump_if_flag_less_than EVENT_FLAG_35, $01, NO_JUMP print_variable_text Text06e0, Text06e1 ask_question_jump Text06e2, .wantToDuel print_text_string Text06e3 @@ -4520,23 +4425,14 @@ Script_BeatBrittany: ; e5ee (3:65ee) start_script print_text_string Text06e5 give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER - run_command ScriptCommand_JumpIfFlagLessThan - db EVENT_FLAG_35 - db $02 - dw NO_JUMP + jump_if_flag_less_than EVENT_FLAG_35, $02, NO_JUMP print_variable_text Text06e6, Text06e7 - run_command ScriptCommand_MaxOutFlagValue - db FLAG_BEAT_BRITTANY + max_out_flag_value FLAG_BEAT_BRITTANY jump_if_flag_not_less_than EVENT_FLAG_35, $02, .finishScript - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_3A - dw .finishScript - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_3B - dw .finishScript + jump_if_flag_zero_2 EVENT_FLAG_3A, .finishScript + jump_if_flag_zero_2 EVENT_FLAG_3B, .finishScript script_set_flag_value EVENT_FLAG_35, $01 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_1E + max_out_flag_value EVENT_FLAG_1E print_text_string Text06e8 .finishScript quit_script_fully @@ -4550,9 +4446,7 @@ Script_e61c: ; e61c (3:661c) Script_Lass2: ; e61f (3:661f) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_04 - dw Script_e61c + jump_if_flag_nonzero_2 EVENT_FLAG_04, Script_e61c jump_if_flag_not_less_than EVENT_FLAG_37, $06, Script_e61c jump_if_flag_not_less_than EVENT_FLAG_37, $04, .ows_e6a1 jump_if_flag_not_less_than EVENT_FLAG_37, $02, .ows_e66a @@ -4571,8 +4465,7 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f0 .ows_e656 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_04 + max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $02 print_text_string Text06f1 run_command Func_ccdc @@ -4598,8 +4491,7 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f8 .ows_e68d - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_04 + max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $04 print_text_string Text06f9 run_command Func_ccdc @@ -4625,8 +4517,7 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06ff .ows_e6c4 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_04 + max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $06 print_text_string Text0700 run_command Func_ccdc @@ -4715,8 +4606,7 @@ Script_Lad3: ; e850 (3:6850) Script_FirstRonaldEncounter: ; e862 (3:6862) start_script - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_4B + max_out_flag_value EVENT_FLAG_4B move_active_npc NPCMovement_e894 run_command Func_d135 db $00 @@ -5073,66 +4963,41 @@ Script_Jonathan: ; eefd (3:6efd) Script_Ken: ; ef22 (3:6f22) start_script try_give_pc_pack $09 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_23 - dw .have_300_cards + jump_if_flag_nonzero_2 EVENT_FLAG_23, .have_300_cards jump_if_enough_cards_owned 300, .have_300_cards jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06ba - tx Text06bb + print_variable_text Text06ba, Text06bb script_set_flag_value EVENT_FLAG_24, $01 quit_script_fully .have_300_cards - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_23 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0A - dw Script_KenBattle_AlreadyHaveMedal + max_out_flag_value EVENT_FLAG_23 + jump_if_flag_nonzero_2 EVENT_FLAG_0A, Script_KenBattle_AlreadyHaveMedal jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06bc - tx Text06bd + print_variable_text Text06bc, Text06bd script_set_flag_value EVENT_FLAG_24, $01 - run_command ScriptCommand_AskQuestionJump - tx Text06be - dw .do_battle - run_command ScriptCommand_PrintTextString - tx Text06bf + ask_question_jump Text06be, .do_battle + print_text_string Text06bf quit_script_fully .do_battle - run_command ScriptCommand_PrintTextString - tx Text06c0 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRE_CHARGE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text06c0 + start_battle PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully ; 0xef5e Script_BeatKen: ; ef5e (3:6f5e) start_script - run_command ScriptCommand_PrintTextString - tx Text06c1 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_0A - dw .give_booster_packs - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_0A + print_text_string Text06c1 + jump_if_flag_nonzero_2 EVENT_FLAG_0A, .give_booster_packs + max_out_flag_value EVENT_FLAG_0A try_give_medal_pc_packs run_command Func_d125 db $0a run_command Func_d435 db $08 - run_command ScriptCommand_PrintTextString - tx Text06c2 + print_text_string Text06c2 .give_booster_packs - run_command ScriptCommand_GiveBoosterPacks - db BOOSTER_MYSTERY_NEUTRAL - db BOOSTER_MYSTERY_NEUTRAL - db NO_BOOSTER - run_command ScriptCommand_PrintTextString - tx Text06c3 + give_booster_packs BOOSTER_MYSTERY_NEUTRAL, BOOSTER_MYSTERY_NEUTRAL, NO_BOOSTER + print_text_string Text06c3 quit_script_fully ; 0xef78 @@ -5140,30 +5005,18 @@ Script_BeatKen: ; ef5e (3:6f5e) Script_LoseToKen: ; ef78 (3:6f78) start_script - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_0A - dw NO_JUMP - run_command ScriptCommand_PrintVariableText - tx Text06c4 - tx Text06c5 + jump_if_flag_zero_2 EVENT_FLAG_0A, NO_JUMP + print_variable_text Text06c4, Text06c5 quit_script_fully ; 0xef83 Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) - run_command ScriptCommand_PrintTextString - tx Text06c6 - run_command ScriptCommand_AskQuestionJump - tx Text06be - dw .do_battle - run_command ScriptCommand_PrintTextQuitFully - tx Text06bf + print_text_string Text06c6 + ask_question_jump Text06be, .do_battle + print_text_quit_fully Text06bf .do_battle - run_command ScriptCommand_PrintTextString - tx Text06c7 - run_command ScriptCommand_StartBattle - db PRIZES_6 - db FIRE_CHARGE_DECK_ID - db MUSIC_DUEL_THEME_2 + print_text_string Text06c7 + start_battle PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully ; 0xef96 @@ -5455,9 +5308,7 @@ Preload_Guide: ; f270 (3:7270) Script_Guide: ; f283 (3:7283) start_script - run_command ScriptCommand_JumpIfFlagZero2 - db EVENT_FLAG_42 - dw .ows_f28b + jump_if_flag_zero_2 EVENT_FLAG_42, .ows_f28b print_text_quit_fully Text0526 .ows_f28b @@ -5501,8 +5352,7 @@ Script_Clerk12: ; f295 (3:7295) print_text_quit_fully Text0530 .ows_f2e1 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_59 + max_out_flag_value EVENT_FLAG_59 print_text_string Text0531 close_text_box move_active_npc NPCMovement_f349 @@ -5526,11 +5376,8 @@ Script_Clerk12: ; f295 (3:7295) move_player NORTH, 1 move_player NORTH, 1 move_player NORTH, 1 - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_FLAG_43 - dw .ows_f33a - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_43 + jump_if_flag_nonzero_2 EVENT_FLAG_43, .ows_f33a + max_out_flag_value EVENT_FLAG_43 move_player NORTH, 1 move_player NORTH, 1 set_player_direction EAST @@ -5656,14 +5503,12 @@ LostAtChallengeHall: ; f392 (3:7392) jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f3d9 script_set_flag_value EVENT_FLAG_3F, $03 script_set_flag_value EVENT_FLAG_48, $03 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_51 + zero_out_flag_value EVENT_FLAG_51 script_jump .ows_f3e2 .ows_f3ce script_set_flag_value EVENT_FLAG_40, $03 script_set_flag_value EVENT_FLAG_49, $03 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_55 + zero_out_flag_value EVENT_FLAG_55 script_jump .ows_f3e2 .ows_f3d9 script_set_flag_value EVENT_FLAG_41, $03 @@ -5767,12 +5612,9 @@ WonAtChallengeHall: ; f441 (3:7441) .ows_f4a1 print_text_string Text0544 .ows_f4a4 - run_command ScriptCommand_ZeroOutFlagValue - db EVENT_FLAG_47 + zero_out_flag_value EVENT_FLAG_47 print_text_string Text0545 - run_command ScriptCommand_AskQuestionJumpDefaultYes - tx Text0546 - dw .ows_f4bd + ask_question_jump_default_yes Text0546, .ows_f4bd jump_if_flag_equal EVENT_FLAG_45, $02, NO_JUMP print_variable_text Text0547, Text0548 run_command Func_cd4f @@ -5783,8 +5625,7 @@ WonAtChallengeHall: ; f441 (3:7441) .ows_f4bd print_text_string Text0549 close_text_box - run_command ScriptCommand_MaxOutFlagValue - db EVENT_FLAG_47 + max_out_flag_value EVENT_FLAG_47 run_command Func_d1ad close_text_box script_jump .ows_f4a4 @@ -5972,11 +5813,8 @@ HallOfHonorLoadMap: ; fbdb (3:7bdb) Script_fbf1: ; fbf1 (3:7bf1) start_script - run_command ScriptCommand_JumpIfFlagNonzero2 - db EVENT_RECEIVED_LEGENDARY_CARD - dw .ows_fc10 - run_command ScriptCommand_MaxOutFlagValue - db EVENT_RECEIVED_LEGENDARY_CARD + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fc10 + max_out_flag_value EVENT_RECEIVED_LEGENDARY_CARD run_command Func_ccdc tx Text05b8 give_card ZAPDOS3 @@ -6083,9 +5921,7 @@ Func_fc7a: ; fc7a (3:7c7a) db $00 jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa print_text_string Text06ce - run_command ScriptCommand_AskQuestionJumpDefaultYes - tx Text06cf - dw .ows_fca0 + ask_question_jump_default_yes Text06cf, .ows_fca0 print_text_string Text06d0 script_jump Func_fc7a.ows_fcaa diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 6081750..1201408 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -181,6 +181,14 @@ jump_if_enough_cards_owned: MACRO dw \1 dw \2 ENDM +fight_club_pupil_jump: MACRO + run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus + dw \1 + dw \2 + dw \3 + dw \4 + dw \5 +ENDM script_jump: MACRO run_command ScriptCommand_Jump @@ -284,8 +292,8 @@ ENDM ask_question_jump_default_yes: MACRO run_command ScriptCommand_AskQuestionJumpDefaultYes -IF \1 == 0 - dw 0000 +IF ISCONST(\1) + dw \1 ELSE tx \1 ENDC @@ -340,6 +348,34 @@ jump_if_flag_not_less_than: MACRO db \2 dw \3 ENDM +jump_if_flag_less_than: MACRO + run_command ScriptCommand_JumpIfFlagLessThan + db \1 + db \2 + dw \3 +ENDM +max_out_flag_value: MACRO + run_command ScriptCommand_MaxOutFlagValue + db \1 +ENDM +zero_out_flag_value: MACRO + run_command ScriptCommand_ZeroOutFlagValue + db \1 +ENDM +jump_if_flag_zero_2: MACRO + run_command ScriptCommand_JumpIfFlagZero2 + db \1 + dw \2 +ENDM +jump_if_flag_nonzero_2: MACRO + run_command ScriptCommand_JumpIfFlagNonzero2 + db \1 + dw \2 +ENDM +script_increment_flag_value: MACRO + run_command ScriptCommand_IncrementFlagValue + db \1 +ENDM diff --git a/tools/script_extractor.py b/tools/script_extractor.py index fd1028c..776d45f 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -233,7 +233,7 @@ def createList(): # this is a func just so all this can go at the bottom ("Func_cf53", "w", DO_NOT_QUIT,""), # more complex behavior too (jumping) ("Func_cf7b", "", DO_NOT_QUIT,""), ("ScriptCommand_JumpIfEnoughCardsOwned", "wj", DO_NOT_QUIT,"jump_if_enough_cards_owned"), - ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "jjjj", DO_NOT_QUIT,""), + ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "jjjjj", DO_NOT_QUIT,"fight_club_pupil_jump"), ("Func_cfc6", "b", DO_NOT_QUIT,""), ("Func_cfd4", "", DO_NOT_QUIT,""), ("Func_d00b", "", DO_NOT_QUIT,""), # includes something with random and extra data @@ -307,12 +307,12 @@ def createList(): # this is a func just so all this can go at the bottom ("ScriptCommand_JumpIfFlagEqual", "fbj", DO_NOT_QUIT,"jump_if_flag_equal"), ("ScriptCommand_JumpIfFlagNotEqual", "fbj", DO_NOT_QUIT,"jump_if_flag_not_equal"), ("ScriptCommand_JumpIfFlagNotLessThan", "fbj", DO_NOT_QUIT,"jump_if_flag_not_less_than"), - ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT,""), - ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT,""), - ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT,""), - ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT,""), - ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT,""), - ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT,""), + ("ScriptCommand_JumpIfFlagLessThan", "fbj", DO_NOT_QUIT,"jump_if_flag_less_than"), + ("ScriptCommand_MaxOutFlagValue", "f", DO_NOT_QUIT,"max_out_flag_value"), + ("ScriptCommand_ZeroOutFlagValue", "f", DO_NOT_QUIT,"zero_out_flag_value"), + ("ScriptCommand_JumpIfFlagNonzero2", "fj", DO_NOT_QUIT,"jump_if_flag_nonzero_2"), + ("ScriptCommand_JumpIfFlagZero2", "fj", DO_NOT_QUIT,"jump_if_flag_zero_2"), + ("ScriptCommand_IncrementFlagValue", "f", DO_NOT_QUIT,"increment_flag_value"), ("ScriptCommand_EndScriptLoop7", "q", QUIT_CONTINUE_CODE,"end_script_loop_7"), ("ScriptCommand_EndScriptLoop8", "q", QUIT_CONTINUE_CODE,"end_script_loop_8"), ("ScriptCommand_EndScriptLoop9", "q", QUIT_CONTINUE_CODE,"end_script_loop_9"), -- cgit v1.2.3 From 5f193001c022f8983b5ffc54a7a47610505ba76c Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Sun, 20 Dec 2020 17:52:40 -0500 Subject: Fixed some whitespace issues --- src/engine/bank03.asm | 48 ++++++++++++++++++++++-------------------------- src/macros/scripts.asm | 2 +- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index f696096..59231c2 100755 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2107,7 +2107,7 @@ ScriptCommand_MoveWramNPC: ; ce52 (3:4e52) ; Executes movement on an arbitrary NPC using values in a and on the stack ; Changes and fixes Temp NPC using stack values -ExecuteArbitraryNPCMovementFromStack: +ExecuteArbitraryNPCMovementFromStack: ; ce5d (3:4e5d) ld [wTempNPC], a call FindLoadedNPC call ExecuteNPCMovement @@ -2871,13 +2871,13 @@ ScriptCommand_ShowSamTutorialMultichoice: ; d317 (3:5317) set_flag_value EVENT_FLAG_75 jp IncreaseScriptPointerBy1 -.multichoice_menu_args: ; d32b (3:532b) +.multichoice_menu_args ; d32b (3:532b) dw $0000 ; NPC title for textbox under menu dw $0000 ; text for textbox under menu dw SamTutorialMultichoice_ConfigurationTable ; location of table configuration in bank 4 db $07 ; the value to return when b is pressed dw wMultichoiceTextboxResult_Sam ; ram location to return result into - dw $0000 + dw $0000 ; location of table containing text entries ScriptCommand_OpenDeckMachine: ; d336 (3:5336) push bc @@ -3149,7 +3149,7 @@ ScriptCommand_JumpIfFlagNonzero2: ; d4ca (3:54ca) .noJumpArgs jp IncreaseScriptPointerBy4 -ScriptCommand_JumpIfFlagZero2: +ScriptCommand_JumpIfFlagZero2: ; d4df (3:54df) ld a, c call GetEventFlagValue or a @@ -3381,7 +3381,7 @@ Script_d827: ; d827 (3:5827) ; 0xd82d INCROM $d82d, $d834 - + AfterTutorialBattleScript: ; d834 (3:5834) start_script print_text_string Text05eb @@ -3454,7 +3454,7 @@ NPCMovement_d88b: ; d88b (3:588b) NPCMovement_d894: ; d894 (4:5894) db SOUTH | NO_MOVE db $ff - + NPCMovement_d896: ; d896 (3:5896) db NORTH db NORTH @@ -3660,6 +3660,7 @@ FightingClubLobbyAfterDuel: ; dc68 (3:5c68) ld hl, .after_duel_table call FindEndOfBattleScript ret + .after_duel_table db NPC_IMAKUNI db NPC_IMAKUNI @@ -3754,7 +3755,6 @@ Script_Granny1: ; dd9f (3:5d9f) INCROM $dd9f, $dda3 - FightingClubAfterDuel: ; dda3 (3:5da3) ld hl, .after_duel_table call FindEndOfBattleScript @@ -3865,11 +3865,10 @@ Script_Mitch_PrintTrainHarderText: ; 0xde43 INCROM $de43, $ded1 - + Script_Clerk2: ; ded1 (3:5ed1) INCROM $ded1, $ded5 - RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ld hl, .after_duel_table call FindEndOfBattleScript @@ -3877,7 +3876,6 @@ RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ; 0xdedc .after_duel_table - db NPC_CHRIS db NPC_CHRIS dw $5f0c @@ -3891,7 +3889,7 @@ RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ; 0xdee9 INCROM $dee9, $def2 - + Script_Chris: ; def2 (3:5ef2) INCROM $def2, $df39 @@ -3919,7 +3917,7 @@ Script_Gene: ; e03e (3:603e) Script_Clerk3: ; e09e (3:609e) INCROM $e09e, $e0a2 - + WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) ld hl, .after_duel_table call FindEndOfBattleScript @@ -3934,7 +3932,6 @@ WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) db $00 ; 0xe0b0 - Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) get_flag_value EVENT_IMAKUNI_STATE cp IMAKUNI_TALKED @@ -4822,16 +4819,16 @@ PsychicClubLobbyAfterDuel: ; e963 (3:6963) db $00 INCROM $e971, $e980 - + Script_Robert: ; e980 (3:6980) INCROM $e980, $e9a5 - + Script_Pappy1: ; e9a5 (3:69a5) INCROM $e9a5, $ea30 Script_Gal3: ; ea30 (3:6a30) INCROM $ea30, $ea3b - + Script_Chap4: ; ea3b (3:6a3b) INCROM $ea3b, $ea60 @@ -4840,13 +4837,13 @@ Script_Daniel: ; ea60 (3:6a60) Script_Stephanie: ; eaa2 (3:6aa2) INCROM $eaa2, $eadf - + Script_Murray2: ; eadf (3:6adf) INCROM $eadf, $eadf Script_Murray1: ; eadf (3:6adf) INCROM $eadf, $eb53 - + Script_Clerk7: ; eb53 (3:6b53) INCROM $eb53, $eb57 @@ -4858,7 +4855,6 @@ ScienceClubLobbyAfterDuel:; eb57 (3:6b57) ; 0xeb5e .after_duel_table - db NPC_IMAKUNI db NPC_IMAKUNI dw Script_BeatImakuni @@ -4867,7 +4863,7 @@ ScienceClubLobbyAfterDuel:; eb57 (3:6b57) ; 0xeb65 INCROM $eb65, $eb84 - + Script_Lad1: ; eb84 (3:6b84) INCROM $eb84, $ebc1 @@ -4993,18 +4989,18 @@ FireClubAfterDuel: ;ee93 (3:6e93) .after_duel_table db NPC_JOHN db NPC_JOHN - dw $6ec8 + dw $6ec8 dw $6ed4 - + db NPC_ADAM db NPC_ADAM - dw $6eed - dw $6ef9 + dw $6eed + dw $6ef9 db NPC_JONATHAN db NPC_JONATHAN - dw $6f12 - dw $6f1e + dw $6f12 + dw $6f1e db NPC_KEN db NPC_KEN diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 9825501..439df64 100755 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -62,7 +62,7 @@ ENDM const Func_d244_index ; $36 const ScriptCommand_ChooseDeckToDuelAgainstMultichoice_index ; $37 const ScriptCommand_OpenDeckMachine_index ; $38 - const ScriptCommand_ChooseStarterDeckMultichoice_index ; $39 + const ScriptCommand_ChooseStarterDeckMultichoice_index ; $39 const ScriptCommand_EnterMap_index ; $3a const ScriptCommand_MoveArbitraryNPC_index ; $3b const Func_d209_index ; $3c -- cgit v1.2.3 From 8afbdc1c83e1d96802b8cf35f7dd1b03fa2908f7 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Tue, 29 Dec 2020 22:54:39 -0500 Subject: add various requested changes --- src/constants/script_constants.asm | 2 +- src/engine/bank03.asm | 90 +++++++++++++++++++------------------- src/macros/scripts.asm | 52 ++++++++++++++++++++-- 3 files changed, 95 insertions(+), 49 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index ffdd0c6..9f37375 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -138,7 +138,7 @@ IMAKUNI_SCIENCE_CLUB EQU 1 IMAKUNI_LIGHTNING_CLUB EQU 2 IMAKUNI_WATER_CLUB EQU 3 -NO_JUMP EQU $0000 +NULL EQU $0000 NORTH EQU $00 EAST EQU $01 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 59231c2..e4a5dea 100755 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2722,7 +2722,7 @@ ScriptCommand_ChooseDeckToDuelAgainstMultichoice: ; d24c (3:524c) jp IncreaseScriptPointerBy1 .multichoice_menu_args ; d25e - dw $0000 ; NPC title for textbox under menu + dw NULL ; NPC title for textbox under menu tx Text03f9 ; text for textbox under menu dw MultichoiceTextbox_ConfigTable_ChooseDeckToDuelAgainst ; location of table configuration in bank 4 db $03 ; the value to return when b is pressed @@ -2744,7 +2744,7 @@ ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) ; 0xd27b .multichoice_menu_args ; d27b - dw $0000 ; NPC title for textbox under menu + dw NULL ; NPC title for textbox under menu tx Text03fd ; text for textbox under menu dw MultichoiceTextbox_ConfigTable_ChooseDeckStarterDeck ; location of table configuration in bank 4 db $00 ; the value to return when b is pressed @@ -2860,7 +2860,7 @@ ScriptCommand_ShowSamNormalMultichoice: ; d2f6 (3:52f6) dw SamNormalMultichoice_ConfigurationTable ; location of table configuration in bank 4 db $03 ; the value to return when b is pressed dw wMultichoiceTextboxResult_Sam ; ram location to return result into - dw $0000 ; location of table containing text entries + dw NULL ; location of table containing text entries ScriptCommand_ShowSamTutorialMultichoice: ; d317 (3:5317) ld hl, .multichoice_menu_args @@ -2872,12 +2872,12 @@ ScriptCommand_ShowSamTutorialMultichoice: ; d317 (3:5317) jp IncreaseScriptPointerBy1 .multichoice_menu_args ; d32b (3:532b) - dw $0000 ; NPC title for textbox under menu - dw $0000 ; text for textbox under menu + dw NULL ; NPC title for textbox under menu + dw NULL ; text for textbox under menu dw SamTutorialMultichoice_ConfigurationTable ; location of table configuration in bank 4 db $07 ; the value to return when b is pressed dw wMultichoiceTextboxResult_Sam ; ram location to return result into - dw $0000 ; location of table containing text entries + dw NULL ; location of table containing text entries ScriptCommand_OpenDeckMachine: ; d336 (3:5336) push bc @@ -3193,9 +3193,9 @@ Func_d4fb: ; d4fb (3:54fb) Script_BeginGame: ; d52e (3:552e) start_script - do_frames $3c + do_frames 60 run_command Func_d3e0 - do_frames $78 + do_frames 120 enter_map $02, MASON_LABORATORY, 14, 26, NORTH quit_script_fully @@ -3544,14 +3544,14 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0728 .ows_db93 - jump_if_flag_equal EVENT_FLAG_1F, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $01, NULL print_variable_text Text0729, Text072a script_set_flag_value EVENT_FLAG_1F, $02 ask_question_jump Text072b, .check_ifhave_clefable_incollectionordecks print_text_quit_fully Text072c .check_ifhave_clefable_incollectionordecks - jump_if_cardowned CLEFABLE, .check_ifhave_clefable_incollectiononly + jump_if_card_owned CLEFABLE, .check_ifhave_clefable_incollectiononly print_text_quit_fully Text072d .check_ifhave_clefable_incollectiononly @@ -3571,14 +3571,14 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0731 .ows_dbcc - jump_if_flag_equal EVENT_FLAG_1F, $03, NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $03, NULL print_variable_text Text0732, Text0733 script_set_flag_value EVENT_FLAG_1F, $04 ask_question_jump Text072b, .check_ifhave_ditto_incollectionordecks print_text_quit_fully Text072c .check_ifhave_ditto_incollectionordecks - jump_if_cardowned DITTO, .check_ifhave_ditto_incollectiononly + jump_if_card_owned DITTO, .check_ifhave_ditto_incollectiononly print_text_quit_fully Text0734 .check_ifhave_ditto_incollectiononly @@ -3598,14 +3598,14 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0737 .ows_dc05 - jump_if_flag_equal EVENT_FLAG_1F, $05, NO_JUMP + jump_if_flag_equal EVENT_FLAG_1F, $05, NULL print_variable_text Text0738, Text0739 script_set_flag_value EVENT_FLAG_1F, $06 ask_question_jump Text072b, .check_ifhave_chansey_incollectionordecks print_text_quit_fully Text072c .check_ifhave_chansey_incollectionordecks - jump_if_cardowned CHANSEY, .check_ifhave_chansey_incollectiononly + jump_if_card_owned CHANSEY, .check_ifhave_chansey_incollectiononly print_text_quit_fully Text073a .check_ifhave_chansey_incollectiononly @@ -3674,7 +3674,7 @@ Script_Man1: ; dc76 (3:5c76) Script_Imakuni: ; dd0d (3:5d0d) start_script script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_TALKED - jump_if_flag_zero_2 EVENT_TEMP_TALKED_TO_IMAKUNI, NO_JUMP + jump_if_flag_zero_2 EVENT_TEMP_TALKED_TO_IMAKUNI, NULL print_variable_text Text0467, Text0468 max_out_flag_value EVENT_TEMP_TALKED_TO_IMAKUNI ask_question_jump Text0469, .declineDuel @@ -3953,7 +3953,7 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) Script_Gal1: ; e0cf (3:60cf) start_script jump_if_flag_equal EVENT_FLAG_12, $02, .ows_e10e - jump_if_flag_equal EVENT_FLAG_12, $00, NO_JUMP + jump_if_flag_equal EVENT_FLAG_12, $00, NULL print_variable_text Text041d, Text041e script_set_flag_value EVENT_FLAG_12, $01 ask_question_jump Text041f, .ows_e0eb @@ -3961,7 +3961,7 @@ Script_Gal1: ; e0cf (3:60cf) quit_script_fully .ows_e0eb - jump_if_cardowned $59, .ows_e0f3 + jump_if_card_owned $59, .ows_e0f3 print_text_string Text0421 quit_script_fully @@ -4182,10 +4182,10 @@ Script_Joshua: ; e21c (3:621c) print_text_string Text043b print_text_string Text043c .already_talked - jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL print_variable_text Text043d, Text043e ask_question_jump Text043f, .startDuel - jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL print_variable_text Text0440, Text0441 quit_script_fully @@ -4197,16 +4197,16 @@ Script_Joshua: ; e21c (3:621c) Script_LostToJoshua: ; e260 (3:6260) start_script - jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL print_variable_text Text0443, Text0444 quit_script_fully Script_BeatJoshua: ; e26c (3:626c) start_script - jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL print_variable_text Text0445, Text0446 give_booster_packs BOOSTER_MYSTERY_WATER_COLORLESS, BOOSTER_MYSTERY_WATER_COLORLESS, NO_BOOSTER - jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NO_JUMP + jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL print_variable_text Text0447, Text0448 jump_if_flag_not_equal EVENT_JOSHUA_STATE, JOSHUA_BEATEN, .firstJoshuaWin quit_script_fully @@ -4278,9 +4278,9 @@ Script_MeetAmy: ; e2d1 (3:62d1) run_command Func_d0be db $14 db $04 - set_player_direction $03 + set_player_direction WEST move_player WEST, 1 - set_player_direction $00 + set_player_direction NORTH move_player NORTH, 1 move_player NORTH, 1 move_arbitrary_npc NPC_JOSHUA, NPCMovement_e2ab @@ -4470,7 +4470,7 @@ GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) Script_Brittany: ; e5d2 (3:65d2) start_script - jump_if_flag_less_than EVENT_FLAG_35, $01, NO_JUMP + jump_if_flag_less_than EVENT_FLAG_35, $01, NULL print_variable_text Text06e0, Text06e1 ask_question_jump Text06e2, .wantToDuel print_text_string Text06e3 @@ -4485,7 +4485,7 @@ Script_BeatBrittany: ; e5ee (3:65ee) start_script print_text_string Text06e5 give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER - jump_if_flag_less_than EVENT_FLAG_35, $02, NO_JUMP + jump_if_flag_less_than EVENT_FLAG_35, $02, NULL print_variable_text Text06e6, Text06e7 max_out_flag_value FLAG_BEAT_BRITTANY jump_if_flag_not_less_than EVENT_FLAG_35, $02, .finishScript @@ -4510,14 +4510,14 @@ Script_Lass2: ; e61f (3:661f) jump_if_flag_not_less_than EVENT_FLAG_37, $06, Script_e61c jump_if_flag_not_less_than EVENT_FLAG_37, $04, .ows_e6a1 jump_if_flag_not_less_than EVENT_FLAG_37, $02, .ows_e66a - jump_if_flag_equal EVENT_FLAG_37, $00, NO_JUMP + jump_if_flag_equal EVENT_FLAG_37, $00, NULL print_variable_text Text06eb, Text06ec script_set_flag_value EVENT_FLAG_37, $01 ask_question_jump Text06ed, .ows_e648 print_text_quit_fully Text06ee .ows_e648 - jump_if_cardowned $1c, .ows_e64f + jump_if_card_owned $1c, .ows_e64f print_text_quit_fully Text06ef .ows_e64f @@ -4536,14 +4536,14 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e66a - jump_if_flag_equal EVENT_FLAG_37, $02, NO_JUMP + jump_if_flag_equal EVENT_FLAG_37, $02, NULL print_variable_text Text06f4, Text06f5 script_set_flag_value EVENT_FLAG_37, $03 ask_question_jump Text06ed, .ows_e67f print_text_quit_fully Text06f6 .ows_e67f - jump_if_cardowned $ab, .ows_e686 + jump_if_card_owned $ab, .ows_e686 print_text_quit_fully Text06f7 .ows_e686 @@ -4562,14 +4562,14 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e6a1 - jump_if_flag_equal EVENT_FLAG_37, $04, NO_JUMP + jump_if_flag_equal EVENT_FLAG_37, $04, NULL print_variable_text Text06fb, Text06fc script_set_flag_value EVENT_FLAG_37, $05 ask_question_jump Text06ed, .ows_e6b6 print_text_quit_fully Text06fd .ows_e6b6 - jump_if_cardowned CHARIZARD, .ows_e6bd + jump_if_card_owned CHARIZARD, .ows_e6bd print_text_quit_fully Text06fe .ows_e6bd @@ -4684,7 +4684,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) .ows_e885 print_text_string Text0649 close_text_box - set_player_direction $03 + set_player_direction WEST move_player EAST, 4 move_active_npc NPCMovement_e894 run_command Func_cdcb @@ -5024,14 +5024,14 @@ Script_Ken: ; ef22 (3:6f22) try_give_pc_pack $09 jump_if_flag_nonzero_2 EVENT_FLAG_23, .have_300_cards jump_if_enough_cards_owned 300, .have_300_cards - jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP + jump_if_flag_zero_1 EVENT_FLAG_24, NULL print_variable_text Text06ba, Text06bb script_set_flag_value EVENT_FLAG_24, $01 quit_script_fully .have_300_cards max_out_flag_value EVENT_FLAG_23 jump_if_flag_nonzero_2 EVENT_FLAG_0A, Script_KenBattle_AlreadyHaveMedal - jump_if_flag_zero_1 EVENT_FLAG_24, NO_JUMP + jump_if_flag_zero_1 EVENT_FLAG_24, NULL print_variable_text Text06bc, Text06bd script_set_flag_value EVENT_FLAG_24, $01 ask_question_jump Text06be, .do_battle @@ -5064,7 +5064,7 @@ Script_BeatKen: ; ef5e (3:6f5e) Script_LoseToKen: ; ef78 (3:6f78) start_script - jump_if_flag_zero_2 EVENT_FLAG_0A, NO_JUMP + jump_if_flag_zero_2 EVENT_FLAG_0A, NULL print_variable_text Text06c4, Text06c5 quit_script_fully ; 0xef83 @@ -5616,7 +5616,7 @@ ScriptJump_f410: ; f410 (4:7410) print_text_string Text0539 set_dialog_npc NPC_RONALD1 jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f42e - jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_text Text053a, Text053b .ows_f42e set_dialog_npc NPC_HOST @@ -5639,7 +5639,7 @@ WonAtChallengeHall: ; f441 (3:7441) jump_if_flag_equal EVENT_FLAG_45, $03, ScriptJump_f4db jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f456 .ows_f456 - jump_if_flag_equal EVENT_FLAG_45, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $01, NULL print_variable_text Text053c, Text053d move_active_npc NPCMovement_f37f run_command Func_d16b @@ -5657,14 +5657,14 @@ WonAtChallengeHall: ; f441 (3:7441) move_wram_npc NPCMovement_f4d0 run_command Func_d16b db $00 - jump_if_flag_equal EVENT_FLAG_45, $02, NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_text Text0540, Text0541 move_active_npc NPCMovement_f383 jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f4a4 jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f4a1 close_text_box set_dialog_npc $02 - jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_text Text0542, Text0543 set_dialog_npc NPC_HOST close_text_box @@ -5674,7 +5674,7 @@ WonAtChallengeHall: ; f441 (3:7441) zero_out_flag_value EVENT_FLAG_47 print_text_string Text0545 ask_question_jump_default_yes Text0546, .ows_f4bd - jump_if_flag_equal EVENT_FLAG_45, $02, NO_JUMP + jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_text Text0547, Text0548 run_command Func_cd4f db $04 @@ -5724,12 +5724,12 @@ ScriptJump_f4db: ; f4db (3:74db) close_text_box jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 set_dialog_npc $02 - jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_text Text054c, Text054d move_wram_npc NPCMovement_f4d8 do_frames 40 move_wram_npc NPCMovement_f34c - jump_if_flag_equal EVENT_FLAG_44, $01, NO_JUMP + jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_text Text054e, Text054f set_dialog_npc NPC_HOST close_text_box @@ -5745,7 +5745,7 @@ ScriptJump_f4db: ; f4db (3:74db) move_active_npc NPCMovement_f38b run_command Func_d1b3 print_text_string Text0551 - give_card $00 + give_card VARIABLE_CARD show_card_received_screen $00 print_text_string Text0552 close_text_box @@ -5940,7 +5940,7 @@ PointerTable_fc4c: ; fc4c (3:7c4c) Script_fc52: ; fc52 (3:7c52) start_script print_text_string Text06c8 - ask_question_jump_default_yes $0000, .ows_fc5e + ask_question_jump_default_yes NULL, .ows_fc5e print_text_quit_fully Text06c9 .ows_fc5e diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 439df64..d6ec604 100755 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -114,9 +114,11 @@ ENDM end_script_loop: MACRO run_command ScriptCommand_EndScriptLoop1 ENDM + close_advanced_text_box: MACRO run_command ScriptCommand_CloseAdvancedTextBox ENDM + print_text_string: MACRO run_command ScriptCommand_PrintTextString tx \1 @@ -127,12 +129,14 @@ ask_question_jump: MACRO tx \1 dw \2 ENDM + start_battle: MACRO run_command ScriptCommand_StartBattle db \1 db \2 db \3 ENDM + print_variable_text: MACRO run_command ScriptCommand_PrintVariableText tx \1 @@ -148,29 +152,35 @@ move_active_npc_by_direction: MACRO run_command ScriptCommand_MoveActiveNPCByDirection dw \1 ENDM + close_text_box: MACRO run_command ScriptCommand_CloseTextBox ENDM + give_booster_packs: MACRO run_command ScriptCommand_GiveBoosterPacks db \1 db \2 db \3 ENDM -jump_if_cardowned: MACRO + +jump_if_card_owned: MACRO run_command ScriptCommand_JumpIfCardOwned db \1 dw \2 ENDM + jump_if_card_in_collection: MACRO run_command ScriptCommand_JumpIfCardInCollection db \1 dw \2 ENDM + give_card: MACRO run_command ScriptCommand_GiveCard db \1 ENDM + take_card: MACRO run_command ScriptCommand_TakeCard db \1 @@ -181,6 +191,7 @@ jump_if_enough_cards_owned: MACRO dw \1 dw \2 ENDM + fight_club_pupil_jump: MACRO run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus dw \1 @@ -194,26 +205,32 @@ script_jump: MACRO run_command ScriptCommand_Jump dw \1 ENDM + try_give_medal_pc_packs: MACRO run_command ScriptCommand_TryGiveMedalPCPacks ENDM + set_player_direction: MACRO run_command ScriptCommand_SetPlayerDirection db \1 ENDM + move_player: MACRO run_command ScriptCommand_MovePlayer db \1 db \2 ENDM + show_card_received_screen: MACRO run_command ScriptCommand_ShowCardReceivedScreen db \1 ENDM + set_dialog_npc: MACRO run_command ScriptCommand_SetDialogNPC db \1 ENDM + set_next_npc_and_script: MACRO run_command ScriptCommand_SetNextNPCAndScript db \1 @@ -231,10 +248,12 @@ jump_if_player_coords_match: MACRO db \2 dw \3 ENDM + move_active_npc: MACRO run_command ScriptCommand_MoveActiveNPC dw \1 ENDM + give_one_of_each_trainer_booster: MACRO run_command ScriptCommand_GiveOneOfEachTrainerBooster ENDM @@ -251,13 +270,16 @@ ENDM choose_deck_to_duel_against_multichoice: MACRO run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice ENDM + open_deck_machine: MACRO run_command ScriptCommand_OpenDeckMachine db \1 ENDM + choose_starter_deck_multichoice: MACRO run_command ScriptCommand_ChooseStarterDeckMultichoice ENDM + enter_map: MACRO run_command ScriptCommand_EnterMap db \1 @@ -266,6 +288,7 @@ enter_map: MACRO db \4 db \5 ENDM + move_arbitrary_npc: MACRO run_command ScriptCommand_MoveArbitraryNPC db \1 @@ -276,6 +299,7 @@ try_give_pc_pack: MACRO run_command ScriptCommand_TryGivePCPack db \1 ENDM + script_nop: MACRO run_command ScriptCommand_nop ENDM @@ -284,9 +308,11 @@ play_sfx: MACRO run_command ScriptCommand_PlaySFX db \1 ENDM + pause_song: MACRO run_command ScriptCommand_PauseSong ENDM + resume_song: MACRO run_command ScriptCommand_ResumeSong ENDM @@ -304,9 +330,11 @@ ELSE ENDC dw \2 ENDM + show_sam_normal_multichoice: MACRO run_command ScriptCommand_ShowSamNormalMultichoice ENDM + show_sam_tutorial_multichoice: MACRO run_command ScriptCommand_ShowSamTutorialMultichoice ENDM @@ -314,92 +342,110 @@ ENDM end_script_loop_2: MACRO run_command ScriptCommand_EndScriptLoop2 ENDM + end_script_loop_3: MACRO run_command ScriptCommand_EndScriptLoop3 ENDM + end_script_loop_4: MACRO run_command ScriptCommand_EndScriptLoop4 ENDM + end_script_loop_5: MACRO run_command ScriptCommand_EndScriptLoop5 ENDM + end_script_loop_6: MACRO run_command ScriptCommand_EndScriptLoop6 ENDM + script_set_flag_value: MACRO run_command ScriptCommand_SetFlagValue db \1 db \2 ENDM + jump_if_flag_zero_1: MACRO run_command ScriptCommand_JumpIfFlagZero1 db \1 dw \2 ENDM + jump_if_flag_nonzero_1: MACRO run_command ScriptCommand_JumpIfFlagNonzero1 db \1 dw \2 ENDM + jump_if_flag_equal: MACRO run_command ScriptCommand_JumpIfFlagEqual db \1 db \2 dw \3 ENDM + jump_if_flag_not_equal: MACRO run_command ScriptCommand_JumpIfFlagNotEqual db \1 db \2 dw \3 ENDM + jump_if_flag_not_less_than: MACRO run_command ScriptCommand_JumpIfFlagNotLessThan db \1 db \2 dw \3 ENDM + jump_if_flag_less_than: MACRO run_command ScriptCommand_JumpIfFlagLessThan db \1 db \2 dw \3 ENDM + max_out_flag_value: MACRO run_command ScriptCommand_MaxOutFlagValue db \1 ENDM + zero_out_flag_value: MACRO run_command ScriptCommand_ZeroOutFlagValue db \1 ENDM + jump_if_flag_zero_2: MACRO run_command ScriptCommand_JumpIfFlagZero2 db \1 dw \2 ENDM + jump_if_flag_nonzero_2: MACRO run_command ScriptCommand_JumpIfFlagNonzero2 db \1 dw \2 ENDM + script_increment_flag_value: MACRO run_command ScriptCommand_IncrementFlagValue db \1 ENDM - - end_script_loop_7: MACRO run_command ScriptCommand_EndScriptLoop7 ENDM + end_script_loop_8: MACRO run_command ScriptCommand_EndScriptLoop8 ENDM + end_script_loop_9: MACRO run_command ScriptCommand_EndScriptLoop9 ENDM + end_script_loop_10: MACRO run_command ScriptCommand_EndScriptLoop10 ENDM + -- cgit v1.2.3 From 6b585efe6697884191607b47644e97daa56c0978 Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Wed, 30 Dec 2020 00:17:00 -0500 Subject: Added documentation and fixed some small issues --- src/engine/bank03.asm | 22 ++--- src/macros/scripts.asm | 215 +++++++++++++++++++++++++++++++------------------ 2 files changed, 148 insertions(+), 89 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index e4a5dea..8f39e57 100755 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -758,7 +758,7 @@ AttemptPlayerMovementFromDirection: ; c5fe (3:45fe) pop bc ret -StartScript_dMovement: ; c607 (3:4607) +StartScriptedMovement: ; c607 (3:4607) push bc ld a, [wPlayerSpriteIndex] ld [wWhichSprite], a @@ -1885,7 +1885,7 @@ ScriptCommand_AskQuestionJumpDefaultYes: ; cce4 (3:4ce4) ; fallthrough ; Asks the player a question then jumps if they answer yes. Seem to be able to -; take a text of 0000 to overwrite last with (yes no) prompt at the bottom +; take a text of 0000 (NULL) to overwrite last with (yes no) prompt at the bottom ScriptCommand_AskQuestionJump: ; cce9 (3:4ce9) ld l, c ld h, b @@ -2449,7 +2449,7 @@ ScriptCommand_MovePlayer: ; 505c (3:505c) ld [wd339], a ld a, b ld [wd33a], a - call StartScript_dMovement + call StartScriptedMovement .asm_d067 call DoFrameIfLCDEnabled call SetScreenScroll @@ -3361,7 +3361,7 @@ Script_d794: ; d794 (3:5794) .ows_d80c print_text_string Text05e9 - ask_question_jump_default_yes 0000, .ows_d817 + ask_question_jump_default_yes NULL, .ows_d817 script_jump .ows_d7bc .ows_d817 @@ -3677,11 +3677,11 @@ Script_Imakuni: ; dd0d (3:5d0d) jump_if_flag_zero_2 EVENT_TEMP_TALKED_TO_IMAKUNI, NULL print_variable_text Text0467, Text0468 max_out_flag_value EVENT_TEMP_TALKED_TO_IMAKUNI - ask_question_jump Text0469, .declineDuel + ask_question_jump Text0469, .acceptDuel print_text_string Text046a quit_script_fully -.declineDuel +.acceptDuel print_text_string Text046b start_battle PRIZES_6, IMAKUNI_DECK_ID, MUSIC_IMAKUNI quit_script_fully @@ -3961,12 +3961,12 @@ Script_Gal1: ; e0cf (3:60cf) quit_script_fully .ows_e0eb - jump_if_card_owned $59, .ows_e0f3 + jump_if_card_owned LAPRAS, .ows_e0f3 print_text_string Text0421 quit_script_fully .ows_e0f3 - jump_if_card_in_collection $59, .ows_e0fb + jump_if_card_in_collection LAPRAS, .ows_e0fb print_text_string Text0422 quit_script_fully @@ -4675,7 +4675,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) move_player NORTH, 1 move_player NORTH, 1 print_text_string Text0646 - ask_question_jump_default_yes 0000, .ows_e882 + ask_question_jump_default_yes NULL, .ows_e882 print_text_string Text0647 script_jump .ows_e885 @@ -5987,7 +5987,7 @@ Func_fc7a: ; fc7a (3:7c7a) .ows_fca0 run_command Func_d396 db $00 - play_sfx $56 + play_sfx SFX_56 run_command Func_ccdc tx Text06d1 run_command Func_d39d @@ -6003,7 +6003,7 @@ Func_fcad: ; fcad (3:7cad) set_flag_value EVENT_FLAG_72 start_script - play_sfx $56 + play_sfx SFX_56 run_command Func_d396 db $00 jump_if_flag_equal EVENT_FLAG_72, $00, .ows_fccc diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index d6ec604..31a96c3 100755 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -111,158 +111,195 @@ ENDM const ScriptCommand_EndScriptLoop10_index ; $67 ; Script Macros + +; Stops the current script and returns control flow back to assembly end_script_loop: MACRO run_command ScriptCommand_EndScriptLoop1 ENDM +; Closes current dialog window close_advanced_text_box: MACRO run_command ScriptCommand_CloseAdvancedTextBox ENDM +; Opens a new dialog window and displays the given text print_text_string: MACRO run_command ScriptCommand_PrintTextString - tx \1 + tx \1 ; Text Pointer ENDM +; Displays text and allows players to choose yes or no. Will jump on yes. +; if first argument is 0000 (NULL), will overwrite last text with yes/no. ask_question_jump: MACRO run_command ScriptCommand_AskQuestionJump - tx \1 - dw \2 +IF ISCONST(\1) + dw \1 ; NULL +ELSE + tx \1 ; Text Pointer +ENDC + dw \2 ; Jump Location ENDM +; Begins a battle with the NPC currently being spoken to start_battle: MACRO run_command ScriptCommand_StartBattle - db \1 - db \2 - db \3 + db \1 ; Prize Amount (ex PRIZES_2) + db \2 ; Deck ID (ex SAMS_PRACTICE_DECK_ID) + db \3 ; Duel Music (ex MUSIC_DUEL_THEME_1) ENDM +; Prints the first or second text depending on if wScriptControlByte is nonzero or zero respectively print_variable_text: MACRO run_command ScriptCommand_PrintVariableText - tx \1 - tx \2 + tx \1 ; Text Pointer + tx \2 ; Text Pointer ENDM +; Displays text then fully quits out of scripting system (Does NOT return to RST20) print_text_quit_fully: MACRO run_command ScriptCommand_PrintTextQuitFully - tx \1 + tx \1 ; Text Pointer ENDM +; Moves the current NPC depending on their current direction +; Argument points to a table of 4 NPCMovements chosen based on direction value move_active_npc_by_direction: MACRO run_command ScriptCommand_MoveActiveNPCByDirection - dw \1 + dw \1 ; Movement Table ENDM +; Closes the textbox currently on the screen close_text_box: MACRO run_command ScriptCommand_CloseTextBox ENDM +; Gives the player up to 3 booster packs. Arguments can be replaced by NO_BOOSTER give_booster_packs: MACRO run_command ScriptCommand_GiveBoosterPacks - db \1 - db \2 - db \3 + db \1 ; booster pack (ex BOOSTER_LABORATORY_NEUTRAL + db \2 ; booster pack + db \3 ; booster pack ENDM +; Jumps to a given script position if the player owns a card anywhere jump_if_card_owned: MACRO run_command ScriptCommand_JumpIfCardOwned - db \1 - dw \2 + db \1 ; card ID (ex LAPRAS) + dw \2 ; script label ENDM +; Jumps to a given script position if the player has a card specifically in their collection jump_if_card_in_collection: MACRO run_command ScriptCommand_JumpIfCardInCollection - db \1 - dw \2 + db \1 ; card ID (ex LAPRAS) + dw \2 ; script label ENDM +; Gives the player a card straight to their collection. +; Does not show the card received screen. For that see show_card_received_screen give_card: MACRO run_command ScriptCommand_GiveCard - db \1 + db \1 ; card ID (ex LAPRAS) ENDM +; Removes a card from the player's collection, usually to trade take_card: MACRO run_command ScriptCommand_TakeCard - db \1 + db \1 ; card ID (ex LAPRAS) ENDM +; Jumps to a given script position if the player owns enough cards jump_if_enough_cards_owned: MACRO run_command ScriptCommand_JumpIfEnoughCardsOwned - dw \1 - dw \2 + dw \1 ; amount of cards needed + dw \2 ; script label ENDM +; Jumps to a script position depending on how far in the fight club pupil quest you are fight_club_pupil_jump: MACRO run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus - dw \1 - dw \2 - dw \3 - dw \4 - dw \5 + dw \1 ; Script Label (First Interaction) + dw \2 ; Script Label (Three Pupils Remaining) + dw \3 ; Script Label (Two Pupils Remaining) + dw \4 ; Script Label (One Pupil Remaining) + dw \5 ; Script Label (All Pupils Defeated) ENDM +; Jumps to a given script position script_jump: MACRO run_command ScriptCommand_Jump - dw \1 + dw \1 ; Script Label ENDM +; Attemps to send Dr. Mason's PC Packs to the player try_give_medal_pc_packs: MACRO run_command ScriptCommand_TryGiveMedalPCPacks ENDM +; Causes the player to face the specified direction set_player_direction: MACRO run_command ScriptCommand_SetPlayerDirection - db \1 + db \1 ; Direction (ex NORTH) ENDM +; Moves the player move_player: MACRO run_command ScriptCommand_MovePlayer - db \1 - db \2 + db \1 ; Direction (ex NORTH) + db \2 ; Speed ENDM +; Shows a fullscreen image of a card and says the player has received it show_card_received_screen: MACRO run_command ScriptCommand_ShowCardReceivedScreen - db \1 + db \1 ; Card received (ex LAPRAS) ENDM +; Sets the active NPC set_dialog_npc: MACRO run_command ScriptCommand_SetDialogNPC - db \1 + db \1 ; NPC (ex NPC_DRMASON) ENDM +; Sets the active NPC and script. Not immediately executed. set_next_npc_and_script: MACRO run_command ScriptCommand_SetNextNPCAndScript - db \1 - dw \2 + db \1 ; NPC (ex NPC_DRMASON) + dw \2 ; Script Label ENDM +; Waits a number of frames do_frames: MACRO run_command ScriptCommand_DoFrames - db \1 + db \1 ; Number of frames to wait ENDM +; Jumps to a script position if the player's X and Y match the given values jump_if_player_coords_match: MACRO run_command ScriptCommand_JumpIfPlayerCoordsMatch - db \1 - db \2 - dw \3 + db \1 ; X Coord + db \2 ; Y Coord + dw \3 ; Script Label ENDM +; Moves the active NPC using an NPCMovement move_active_npc: MACRO run_command ScriptCommand_MoveActiveNPC - dw \1 + dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM +; Gives the player one of each booster pack with a trainer focus give_one_of_each_trainer_booster: MACRO run_command ScriptCommand_GiveOneOfEachTrainerBooster ENDM +; Moves the NPC in wTempNPC using an NPCMovement move_wram_npc: MACRO run_command ScriptCommand_MoveWramNPC - dw \1 + dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM +; Closes Advanced TextBoxes then Ends Script Loop quit_script_fully: MACRO run_command ScriptCommand_QuitScriptFully ENDM @@ -271,64 +308,74 @@ choose_deck_to_duel_against_multichoice: MACRO run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice ENDM +; Opens the deck machine open_deck_machine: MACRO run_command ScriptCommand_OpenDeckMachine - db \1 + db \1 ; Deck Machine Type? ENDM choose_starter_deck_multichoice: MACRO run_command ScriptCommand_ChooseStarterDeckMultichoice ENDM +; Enters a given map screen enter_map: MACRO run_command ScriptCommand_EnterMap - db \1 - db \2 - db \3 - db \4 - db \5 + db \1 ; Unused + db \2 ; Room (ex MASON_LABORATORY) + db \3 ; Player X + db \4 ; Player Y + db \5 ; Player Direction ENDM +; Moves any NPC using an NPCMovement move_arbitrary_npc: MACRO run_command ScriptCommand_MoveArbitraryNPC - db \1 - dw \2 + db \1 ; NPC (ex NPC_JOSHUA) + dw \2 ; NPCMovement (NPCMovement_e2ab) ENDM +; Tries to give the player a specific PC Pack from Dr. Mason try_give_pc_pack: MACRO run_command ScriptCommand_TryGivePCPack - db \1 + db \1 ; PC Pack Index ENDM +; Nothing. script_nop: MACRO run_command ScriptCommand_nop ENDM +; Plays a sound effect play_sfx: MACRO run_command ScriptCommand_PlaySFX - db \1 + db \1 ; Sound Effect (ex SFX_56) ENDM +; Pauses the current song pause_song: MACRO run_command ScriptCommand_PauseSong ENDM +; Resumes the current song resume_song: MACRO run_command ScriptCommand_ResumeSong ENDM +; Waits for the current song to finish wait_for_song_to_finish: MACRO run_command ScriptCommand_WaitForSongToFinish ENDM +; Asks the player a question then jumps ask_question_jump_default_yes: MACRO run_command ScriptCommand_AskQuestionJumpDefaultYes IF ISCONST(\1) - dw \1 + dw \1 ; NULL ELSE - tx \1 + tx \1 ; Text Pointer ENDC - dw \2 + dw \2 ; Script Label ENDM show_sam_normal_multichoice: MACRO @@ -359,77 +406,89 @@ end_script_loop_6: MACRO run_command ScriptCommand_EndScriptLoop6 ENDM +; Sets a flag's value script_set_flag_value: MACRO run_command ScriptCommand_SetFlagValue - db \1 - db \2 + db \1 ; flag (ex EVENT_FLAG_11) + db \2 ; new value ENDM +; Jumps to a script position if a given flag is zero jump_if_flag_zero_1: MACRO run_command ScriptCommand_JumpIfFlagZero1 - db \1 - dw \2 + db \1 ; flag (ex EVENT_FLAG_11) + dw \2 ; Script Label ENDM +; Jumps to a script position if a given flag is nonzero jump_if_flag_nonzero_1: MACRO run_command ScriptCommand_JumpIfFlagNonzero1 - db \1 - dw \2 + db \1 ; flag (ex EVENT_FLAG_11) + dw \2 ; Script Label ENDM +; Jumps to a script position if a flag matches given value jump_if_flag_equal: MACRO run_command ScriptCommand_JumpIfFlagEqual - db \1 - db \2 - dw \3 + db \1 ; flag (ex EVENT_FLAG_11) + db \2 ; value + dw \3 ; Script Label ENDM +; Jumps to a script position if a flag does not match a given value jump_if_flag_not_equal: MACRO run_command ScriptCommand_JumpIfFlagNotEqual - db \1 - db \2 - dw \3 + db \1 ; flag (ex EVENT_FLAG_11) + db \2 ; value + dw \3 ; Script Label ENDM +; Jump to a script position if a flag is not less than a given value jump_if_flag_not_less_than: MACRO run_command ScriptCommand_JumpIfFlagNotLessThan - db \1 - db \2 - dw \3 + db \1 ; flag (ex EVENT_FLAG_11) + db \2 ; value + dw \3 ; Script Label ENDM +; Jump to a script position if a flag is less than a given value jump_if_flag_less_than: MACRO run_command ScriptCommand_JumpIfFlagLessThan - db \1 - db \2 - dw \3 + db \1 ; flag (ex EVENT_FLAG_11) + db \2 ; value + dw \3 ; Script Label ENDM +; Sets a flag to its maximum possible value max_out_flag_value: MACRO run_command ScriptCommand_MaxOutFlagValue - db \1 + db \1 ; flag (ex EVENT_FLAG_11) ENDM +; Sets a flags value to zero zero_out_flag_value: MACRO run_command ScriptCommand_ZeroOutFlagValue - db \1 + db \1 ; flag (ex EVENT_FLAG_11) ENDM +; Jumps to a script position if a flag is zero jump_if_flag_zero_2: MACRO run_command ScriptCommand_JumpIfFlagZero2 - db \1 - dw \2 + db \1 ; flag (ex EVENT_FLAG_11) + dw \2 ; Script Label ENDM +; Jumps to a script position if a flag is nonzero jump_if_flag_nonzero_2: MACRO run_command ScriptCommand_JumpIfFlagNonzero2 - db \1 - dw \2 + db \1 ; flag (ex EVENT_FLAG_11) + dw \2 ; Script Label ENDM +; Increments given flags value (truncates the new value) script_increment_flag_value: MACRO run_command ScriptCommand_IncrementFlagValue - db \1 + db \1 ; flag (ex EVENT_FLAG_11) ENDM end_script_loop_7: MACRO -- cgit v1.2.3 From 409058484b5f59f02ece691c3dbceb6aa33c8bdf Mon Sep 17 00:00:00 2001 From: Andrew Martinek Date: Wed, 30 Dec 2020 20:46:02 -0500 Subject: Fixed small typos --- src/macros/scripts.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 31a96c3..6836b4d 100755 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -176,7 +176,7 @@ ENDM ; Gives the player up to 3 booster packs. Arguments can be replaced by NO_BOOSTER give_booster_packs: MACRO run_command ScriptCommand_GiveBoosterPacks - db \1 ; booster pack (ex BOOSTER_LABORATORY_NEUTRAL + db \1 ; booster pack (ex BOOSTER_LABORATORY_NEUTRAL) db \2 ; booster pack db \3 ; booster pack ENDM @@ -231,7 +231,7 @@ script_jump: MACRO dw \1 ; Script Label ENDM -; Attemps to send Dr. Mason's PC Packs to the player +; Attempts to send Dr. Mason's PC Packs to the player try_give_medal_pc_packs: MACRO run_command ScriptCommand_TryGiveMedalPCPacks ENDM -- cgit v1.2.3