diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/engine/bank03.asm | 22 | ||||
-rwxr-xr-x | 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 |