From 5f64d73c3fcd49f93bcbc3f8a5fc0dd0043faf4d Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 3 Jan 2021 13:28:04 -0600 Subject: Rename some referenced text labels --- src/data/map_objects.asm | 170 +++++++++++++++++++++++----------------------- src/engine/bank03.asm | 22 +++--- src/engine/bank06.asm | 58 ++++++++-------- src/text/text2.asm | 16 ++--- src/text/text3.asm | 74 ++++++++++---------- src/text/text4.asm | 24 +++---- src/text/text5.asm | 2 +- src/text/text8.asm | 2 +- src/text/text_offsets.asm | 118 ++++++++++++++++---------------- 9 files changed, 243 insertions(+), 243 deletions(-) diff --git a/src/data/map_objects.asm b/src/data/map_objects.asm index 069b12d..eaa456f 100644 --- a/src/data/map_objects.asm +++ b/src/data/map_objects.asm @@ -8,7 +8,7 @@ MasonLabObjects: ; 13b04 (3:7b04) db NORTH, 18, 2 dw PrintInteractableObjectText tx Text04a0 - tx Text049f + tx WhatIsADeckText db NORTH, 20, 2 dw PrintInteractableObjectText @@ -42,8 +42,8 @@ MasonLabObjects: ; 13b04 (3:7b04) db NORTH, 2, 2 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db $ff @@ -51,103 +51,103 @@ MasonLabObjects: ; 13b04 (3:7b04) DeckMachineRoomObjects: ; 13b4d (3:7b4d) db NORTH, 2, 2 dw Script_d932 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 4, 2 dw Script_d932 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 2 dw $593f - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 8, 2 dw $593f - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 10, 2 dw $5995 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 12, 2 dw $5995 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 14, 2 dw $59c2 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 16, 2 dw $59c2 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 18, 2 dw $59ef - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 20, 2 dw $59ef - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 14, 10 dw $5a1c - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 16, 10 dw $5a1c - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 18, 10 dw $5a49 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 20, 10 dw $5a49 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 14, 18 dw $5a76 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 16, 18 dw $5a76 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 18, 18 dw $5aa3 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 20, 18 dw $5aa3 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 2, 18 dw $5ad0 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 4, 18 dw $5ad0 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db $ff @@ -234,17 +234,17 @@ FightingClubLobbyObjects: ; 13c6f (3:7c6f) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -268,17 +268,17 @@ RockClubLobbyObjects: ; 13ca6 (3:7ca6) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -302,17 +302,17 @@ WaterClubLobbyObjects: ; 13cdd (3:7cdd) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -336,17 +336,17 @@ LightningClubLobbyObjects: ; 13d14 (3:7d14) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -370,17 +370,17 @@ GrassClubLobbyObjects: ; 13d4b (3:7d4b) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -404,17 +404,17 @@ PsychicClubLobbyObjects: ; 13d82 (3:7d82) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -438,17 +438,17 @@ ScienceClubLobbyObjects: ; 13db9 (3:7db9) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -472,17 +472,17 @@ FireClubLobbyObjects: ; 13df0 (3:7df0) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -506,17 +506,17 @@ ChallengeHallLobbyObjects: ; 13e27 (3:7e27) db NORTH, 2, 8 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 6, 6 dw Script_fc52 - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db NORTH, 10, 6 dw Func_fc7a - tx Text041b + tx PlaceholderMessageText tx ClerkNPCName db $ff @@ -575,8 +575,8 @@ PokemonDomeEntranceObjects: ; 13e5e (3:7e5e) db NORTH, 28, 2 dw PC_c7ea - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db $ff @@ -596,12 +596,12 @@ HallOfHonorObjects: ; 13ec2 (3:7ec2) db NORTH, 10, 2 dw $7be1 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db NORTH, 12, 2 dw $7be1 - tx Text041b - tx Text041a + tx PlaceholderMessageText + tx PokemonTradingCards101Text db $ff diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 8f39e57..b162dc6 100755 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2856,7 +2856,7 @@ ScriptCommand_ShowSamNormalMultichoice: ; d2f6 (3:52f6) .multichoice_menu_args ; d30c tx SamNPCName ; NPC title for textbox under menu - tx Text03fe ; text for textbox under menu + tx HowCanIHelpText ; text for textbox under menu 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 @@ -3954,35 +3954,35 @@ 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, NULL - print_variable_text Text041d, Text041e + print_variable_text Gal1WantToTrade1Text, Gal1WantToTrade2Text script_set_flag_value EVENT_FLAG_12, $01 - ask_question_jump Text041f, .ows_e0eb - print_text_string Text0420 + ask_question_jump Gal1WouldYouLikeToTradeText, .ows_e0eb + print_text_string Gal1DeclinedTradeText quit_script_fully .ows_e0eb jump_if_card_owned LAPRAS, .ows_e0f3 - print_text_string Text0421 + print_text_string Gal1DontOwnCardText quit_script_fully .ows_e0f3 jump_if_card_in_collection LAPRAS, .ows_e0fb - print_text_string Text0422 + print_text_string Gal1CardInDeckText quit_script_fully .ows_e0fb script_set_flag_value EVENT_FLAG_12, $02 - print_text_string Text0423 + print_text_string Gal1LetsTradeText run_command Func_ccdc - tx Text0424 + tx Gal1TradeCompleteText take_card LAPRAS give_card ARCANINE1 show_card_received_screen ARCANINE1 - print_text_string Text0425 + print_text_string Gal1ThanksText quit_script_fully .ows_e10e - print_text_quit_fully Text0426 + print_text_quit_fully Gal1AfterTradeText Script_Lass1: ; e111 (3:6111) start_script @@ -4971,7 +4971,7 @@ Script_ee76: ; ee76 (3:6e76) .ows_ee7d script_set_flag_value EVENT_FLAG_21, $02 run_command Func_ccdc - tx Text06a2 + tx FoundLv9SlowpokeText give_card SLOWPOKE1 show_card_received_screen SLOWPOKE1 quit_script_fully diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 4dcad9d..8101215 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -923,26 +923,26 @@ glossary_entry: MACRO ENDM GlossaryData1: - glossary_entry 7, Text02fa, Text030c - glossary_entry 5, Text02fb, Text030d - glossary_entry 7, Text02fc, Text030e - glossary_entry 6, Text02fd, Text030f - glossary_entry 6, Text02fe, Text0310 - glossary_entry 4, Text02ff, Text0311 - glossary_entry 5, Text0300, Text0312 - glossary_entry 7, Text0301, Text0313 - glossary_entry 5, Text0302, Text0314 + glossary_entry 7, AboutTheDeckText, DeckDescriptionText + glossary_entry 5, AboutTheDiscardPileText, DiscardPileDescriptionText + glossary_entry 7, AboutTheHandText, HandDescriptionText + glossary_entry 6, AboutTheArenaText, ArenaDescriptionText + glossary_entry 6, AboutTheBenchText, BenchDescriptionText + glossary_entry 4, AboutTheActivePokemonText, ActivePokemonDescriptionText + glossary_entry 5, AboutBenchPokemonText, BenchPokemonDescriptionText + glossary_entry 7, AboutPrizesText, PrizesDescriptionText + glossary_entry 5, AboutDamageCountersText, DamageCountersDescriptionText GlossaryData2: - glossary_entry 5, Text0303, Text0315 - glossary_entry 5, Text0304, Text0316 - glossary_entry 5, Text0305, Text0317 - glossary_entry 5, Text0306, Text0318 - glossary_entry 6, Text0307, Text0319 - glossary_entry 5, Text0308, Text031a - glossary_entry 6, Text0309, Text031b - glossary_entry 6, Text030a, Text031c - glossary_entry 6, Text030b, Text031d + glossary_entry 5, AboutEnergyCardsText, EnergyCardsDescriptionText + glossary_entry 5, AboutTrainerCardsText, TrainerCardsDescriptionText + glossary_entry 5, AboutBasicPokemonText, BasicPokemonDescriptionText + glossary_entry 5, AboutEvolutionCardsText, EvolutionCardsDescriptionText + glossary_entry 6, AboutAttackingText, AttackingDescriptionText + glossary_entry 5, AboutPokemonPowerText, PokemonPowerDescriptionText + glossary_entry 6, AboutWeaknessText, WeaknessDescriptionText + glossary_entry 6, AboutResistanceText, ResistanceDescriptionText + glossary_entry 6, AboutRetreatingText, RetreatingDescriptionText Func_18661: ; 18661 (6:4661) xor a @@ -1619,7 +1619,7 @@ Func_1a68d: ; 1a68d (6:668d) call SetupText bank1call InitAndDrawCardListScreenLayout ldtx hl, ChooseTheCardYouWishToExamineText - ldtx de, Text0196 + ldtx de, BoosterPackText bank1call SetCardListHeaderText ld a, A_BUTTON | START ld [wNoItemSelectionMenuKeys], a @@ -1723,20 +1723,20 @@ WhatIsYourNameData: ; 1a75e (6:675e) ; without any bank description. ; That is, the developers hard-coded it. -_-;; Deck1Data: ; 1a763 (6:6763) - textitem 2, 1, Text022b - textitem 14, 1, Text0219 + textitem 2, 1, Deck1Text + textitem 14, 1, DeckText db $ff Deck2Data: ; 1a76c (6:676c) - textitem 2, 1, Text022c - textitem 14, 1, Text0219 + textitem 2, 1, Deck2Text + textitem 14, 1, DeckText db $ff Deck3Data: ; 1a775 (6:6775) - textitem 2, 1, Text022d - textitem 14, 1, Text0219 + textitem 2, 1, Deck3Text + textitem 14, 1, DeckText db $ff Deck4Data: ; 1a77e (6:677e) - textitem 2, 1, Text022e - textitem 14, 1, Text0219 + textitem 2, 1, Deck4Text + textitem 14, 1, DeckText db $ff ; set each byte zero from hl for b bytes. @@ -1933,7 +1933,7 @@ DrawNamingScreenBG: ; 1a892 (6:6892) ; print "End". ld hl, .data call PlaceTextItems - ldtx hl, Text0221 + ldtx hl, PlayerNameKeyboardText lb de, 2, 4 call InitTextPrinting call ProcessTextFromID @@ -2810,7 +2810,7 @@ Func_1ae99: ; 1ae99 (6:6e99) ld hl, DrawNamingScreenBG.data call PlaceTextItems ; print the keyboard characters. - ldtx hl, NamingScreenKeyboardText ; "A B C D..." + ldtx hl, DeckNameKeyboardText ; "A B C D..." lb de, 2, 4 call InitTextPrinting call ProcessTextFromID diff --git a/src/text/text2.asm b/src/text/text2.asm index fc603ee..d85eda7 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -844,7 +844,7 @@ Text0195: ; 39f03 (e:5f03) line "Please wait..." done -Text0196: ; 39f21 (e:5f21) +BoosterPackText: ; 39f21 (e:5f21) text "Booster Pack" done @@ -1507,7 +1507,7 @@ OpponentsDiscardPileText: ; 3b7cf (e:77cf) text "Opponent's Discard Pile" done -Text0219: ; 3b7e8 (e:77e8) +DeckText: ; 3b7e8 (e:77e8) text "Deck" done @@ -1563,7 +1563,7 @@ Text0220: ; 3b886 (e:7886) textfw0 "-(2)" done -Text0221: ; 3b8f2 (e:78f2) +PlayerNameKeyboardText: ; 3b8f2 (e:78f2) textfw3 "A", " ", "B", " ", "C", " ", "D", " ", "E", " ", "F", " ", "G", " ", "H", " ", "I" line "" textfw3 "J", " ", "K", " ", "L", " ", "M", " ", "N", " ", "O", " ", "P", " ", "Q", " ", "R" @@ -1580,7 +1580,7 @@ Text0221: ; 3b8f2 (e:78f2) textfw0 " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " " done -NamingScreenKeyboardText: ; 3b97b (e:797b) +DeckNameKeyboardText: ; 3b97b (e:797b) textfw3 "A", " ", "B", " ", "C", " ", "D", " ", "E", " ", "F", " ", "G", " ", "H", " ", "I" line "" textfw3 "J", " ", "K", " ", "L", " ", "M", " ", "N", " ", "O", " ", "P", " ", "Q", " ", "R" @@ -1632,19 +1632,19 @@ ChosenAsDuelingDeckText: ; 3ba55 (e:7a55) line "chosen as the dueling deck!" done -Text022b: ; 3ba78 (e:7a78) +Deck1Text: ; 3ba78 (e:7a78) textfw0 "1", "·" done -Text022c: ; 3ba7b (e:7a7b) +Deck2Text: ; 3ba7b (e:7a7b) textfw0 "2", "·" done -Text022d: ; 3ba7e (e:7a7e) +Deck3Text: ; 3ba7e (e:7a7e) textfw0 "3", "·" done -Text022e: ; 3ba81 (e:7a81) +Deck4Text: ; 3ba81 (e:7a81) textfw0 "4", "·" done diff --git a/src/text/text3.asm b/src/text/text3.asm index 4d3fccf..18b329e 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -644,79 +644,79 @@ ChooseWordAndPressAButtonText: ; 3d48f (f:548f) line "A button." done -Text02fa: ; 3d4b6 (f:54b6) +AboutTheDeckText: ; 3d4b6 (f:54b6) text "About the Deck" done -Text02fb: ; 3d4c6 (f:54c6) +AboutTheDiscardPileText: ; 3d4c6 (f:54c6) text "About the Discard Pile" done -Text02fc: ; 3d4de (f:54de) +AboutTheHandText: ; 3d4de (f:54de) text "About the Hand" done -Text02fd: ; 3d4ee (f:54ee) +AboutTheArenaText: ; 3d4ee (f:54ee) text "About the Arena" done -Text02fe: ; 3d4ff (f:54ff) +AboutTheBenchText: ; 3d4ff (f:54ff) text "About the Bench" done -Text02ff: ; 3d510 (f:5510) +AboutTheActivePokemonText: ; 3d510 (f:5510) text "About the Active Pokémon" done -Text0300: ; 3d52a (f:552a) +AboutBenchPokemonText: ; 3d52a (f:552a) text "About Bench Pokémon" done -Text0301: ; 3d53f (f:553f) +AboutPrizesText: ; 3d53f (f:553f) text "About Prizes" done -Text0302: ; 3d54d (f:554d) +AboutDamageCountersText: ; 3d54d (f:554d) text "About Damage Counters" done -Text0303: ; 3d564 (f:5564) +AboutEnergyCardsText: ; 3d564 (f:5564) text "About Energy Cards" done -Text0304: ; 3d578 (f:5578) +AboutTrainerCardsText: ; 3d578 (f:5578) text "About Trainer Cards" done -Text0305: ; 3d58d (f:558d) +AboutBasicPokemonText: ; 3d58d (f:558d) text "About Basic Pokémon" done -Text0306: ; 3d5a2 (f:55a2) +AboutEvolutionCardsText: ; 3d5a2 (f:55a2) text "About Evolution Cards" done -Text0307: ; 3d5b9 (f:55b9) +AboutAttackingText: ; 3d5b9 (f:55b9) text "About Attacking" done -Text0308: ; 3d5ca (f:55ca) +AboutPokemonPowerText: ; 3d5ca (f:55ca) text "About Pokémon Power" done -Text0309: ; 3d5df (f:55df) +AboutWeaknessText: ; 3d5df (f:55df) text "About Weakness" done -Text030a: ; 3d5ef (f:55ef) +AboutResistanceText: ; 3d5ef (f:55ef) text "About Resistance" done -Text030b: ; 3d601 (f:5601) +AboutRetreatingText: ; 3d601 (f:5601) text "About Retreating" done -Text030c: ; 3d613 (f:5613) +DeckDescriptionText: ; 3d613 (f:5613) text "The Deck is the pile of cards" line "you will be drawing from." line "At the beginning of your turn, you" @@ -725,7 +725,7 @@ Text030c: ; 3d613 (f:5613) line "from the Deck, you lose the game." done -Text030d: ; 3d6d0 (f:56d0) +DiscardPileDescriptionText: ; 3d6d0 (f:56d0) text "The pile in which you place used" line "cards is called the Discard Pile." line "You can look at both yours and your" @@ -733,7 +733,7 @@ Text030d: ; 3d6d0 (f:56d0) line "with the Check command." done -Text030e: ; 3d769 (f:5769) +HandDescriptionText: ; 3d769 (f:5769) text "The cards held by each player" line "are called a Hand." line "There is no restriction to the" @@ -742,7 +742,7 @@ Text030e: ; 3d769 (f:5769) line "cards in your Hand." done -Text030f: ; 3d807 (f:5807) +ArenaDescriptionText: ; 3d807 (f:5807) text "The place where the Pokémon" line "that is actively fighting" line "is placed is called the Arena." @@ -750,7 +750,7 @@ Text030f: ; 3d807 (f:5807) line "Active Pokémon in the Arena." done -Text0310: ; 3d899 (f:5899) +BenchDescriptionText: ; 3d899 (f:5899) text "The Bench is where your Pokémon" line "that are in play but aren't actively" line "fighting sit." @@ -761,14 +761,14 @@ Text0310: ; 3d899 (f:5899) line "the Bench." done -Text0311: ; 3d96e (f:596e) +ActivePokemonDescriptionText: ; 3d96e (f:596e) text "The Active Pokémon is the " line "Pokémon that is in the Arena." line "Only Active Pokémon can " line "attack." done -Text0312: ; 3d9c9 (f:59c9) +BenchPokemonDescriptionText: ; 3d9c9 (f:59c9) text "The Pokémon that are in play" line "but aren't actively fighting" line "are called Bench Pokémon." @@ -780,7 +780,7 @@ Text0312: ; 3d9c9 (f:59c9) line "Pokémon, you lose the game." done -Text0313: ; 3dad1 (f:5ad1) +PrizesDescriptionText: ; 3dad1 (f:5ad1) text "Prizes are the cards placed to" line "count the number of the opponent's" line "Pokémon you Knocked Out." @@ -791,7 +791,7 @@ Text0313: ; 3dad1 (f:5ad1) line "you win the game." done -Text0314: ; 3dbc5 (f:5bc5) +DamageCountersDescriptionText: ; 3dbc5 (f:5bc5) text "A Damage Counter represents the" line "amount of damage a certain Pokémon" line "has taken." @@ -803,7 +803,7 @@ Text0314: ; 3dbc5 (f:5bc5) line "HP is 0." done -Text0315: ; 3dcb2 (f:5cb2) +EnergyCardsDescriptionText: ; 3dcb2 (f:5cb2) text "Energy Cards are cards that power" line "your Pokémon, making them able" line "to Attack." @@ -816,7 +816,7 @@ Text0315: ; 3dcb2 (f:5cb2) line "from your Hand per turn." done -Text0316: ; 3ddbe (f:5dbe) +TrainerCardsDescriptionText: ; 3ddbe (f:5dbe) text "Trainer Cards are support cards." line "There are many Trainer Cards" line "with different effects." @@ -828,7 +828,7 @@ Text0316: ; 3ddbe (f:5dbe) line "as you like." done -Text0317: ; 3deb0 (f:5eb0) +BasicPokemonDescriptionText: ; 3deb0 (f:5eb0) text "Basic Pokémon are cards that " line "can be played directly from your " line "hand into the play area. Basic " @@ -838,7 +838,7 @@ Text0317: ; 3deb0 (f:5eb0) line "examples of Basic Pokémon." done -Text0318: ; 3df82 (f:5f82) +EvolutionCardsDescriptionText: ; 3df82 (f:5f82) text "Evolution Cards are cards you" line "play on top of a Basic Pokémon card" line "(or sometimes on top of another" @@ -853,7 +853,7 @@ Text0318: ; 3df82 (f:5f82) line "place the Stage 2 Evolution Card." done -Text0319: ; 3e10a (f:610a) +AttackingDescriptionText: ; 3e10a (f:610a) text "By choosing Attack, your Pokémon" line "will fight your opponent's Pokémon." line "Your Pokémon require Energy" @@ -864,7 +864,7 @@ Text0319: ; 3e10a (f:610a) line "Pokémon that can Attack." done -Text031a: ; 3e1f7 (f:61f7) +PokemonPowerDescriptionText: ; 3e1f7 (f:61f7) text "Unlike Attacks, Pokémon Power" line "can be used by Active or Benched" line "Pokémon. Some Pokémon Power are" @@ -874,14 +874,14 @@ Text031a: ; 3e1f7 (f:61f7) line "command, PKMN Power." done -Text031b: ; 3e2c5 (f:62c5) +WeaknessDescriptionText: ; 3e2c5 (f:62c5) text "Some Pokémon have a Weakness." line "If a Pokémon has a Weakness, it" line "takes double damage when attacked by" line "Pokémon of a certain type." done -Text031c: ; 3e344 (f:6344) +ResistanceDescriptionText: ; 3e344 (f:6344) text "Some Pokémon have Resistance." line "If a Pokémon has Resistance, it" line "takes 30 less damage whenever" @@ -889,7 +889,7 @@ Text031c: ; 3e344 (f:6344) line "a certain type." done -Text031d: ; 3e3c8 (f:63c8) +RetreatingDescriptionText: ; 3e3c8 (f:63c8) text "By choosing Retreat, you can" line "switch the Active Pokémon with" line "a Pokémon on your Bench." @@ -1949,7 +1949,7 @@ Text03fd: ; 3f9d0 (f:79d0) text "Please select the Deck you want." done -Text03fe: ; 3f9f2 (f:79f2) +HowCanIHelpText: ; 3f9f2 (f:79f2) text "Hi, ." line "How can I help you?" done diff --git a/src/text/text4.asm b/src/text/text4.asm index 74bec46..b597fb6 100644 --- a/src/text/text4.asm +++ b/src/text/text4.asm @@ -320,11 +320,11 @@ Text0419: ; 41965 (10:5965) line "attached Booster Pack." done -Text041a: ; 4199b (10:599b) +PokemonTradingCards101Text: ; 4199b (10:599b) text "”Pokémon Trading Cards 101”" done -Text041b: ; 419b8 (10:59b8) +PlaceholderMessageText: ; 419b8 (10:59b8) text "This message is not in yet!" done @@ -338,7 +338,7 @@ Text041c: ; 419d5 (10:59d5) line "just to collect them." done -Text041d: ; 41a74 (10:5a74) +Gal1WantToTrade1Text: ; 41a74 (10:5a74) text "We don't use Fire Pokémon cards" line "here at the Water Club." line "I have this rare Arcanine, but" @@ -347,17 +347,17 @@ Text041d: ; 41a74 (10:5a74) line "mind trading it for my Arcanine?" done -Text041e: ; 41b1d (10:5b1d) +Gal1WantToTrade2Text: ; 41b1d (10:5b1d) text "Hi! We meet again!" line "Have you decided to trade your" line "Lapras for my rare Arcanine?" done -Text041f: ; 41b6d (10:5b6d) +Gal1WouldYouLikeToTradeText: ; 41b6d (10:5b6d) text "Would you like to trade?" done -Text0420: ; 41b87 (10:5b87) +Gal1DeclinedTradeText: ; 41b87 (10:5b87) text "Aw, you're not going to" line "trade with me?" line "Well, that's too bad..." @@ -365,13 +365,13 @@ Text0420: ; 41b87 (10:5b87) line "come look for me." done -Text0421: ; 41bf6 (10:5bf6) +Gal1DontOwnCardText: ; 41bf6 (10:5bf6) text "Hey! What are you trying to pull?" line "You don't have a Lapras!?!" line "Come see me when you get a Lapras." done -Text0422: ; 41c57 (10:5c57) +Gal1CardInDeckText: ; 41c57 (10:5c57) text "OK! Let's trade your Lapras" line "for my Arcanine..." line "Oh! I see your Lapras" @@ -382,23 +382,23 @@ Text0422: ; 41c57 (10:5c57) line "" done -Text0423: ; 41cf7 (10:5cf7) +Gal1LetsTradeText: ; 41cf7 (10:5cf7) text "OK then, let's trade your" line "Lapras for my Arcanine." done -Text0424: ; 41d2a (10:5d2a) +Gal1TradeCompleteText: ; 41d2a (10:5d2a) text " traded a Lapras" line "for an Arcanine!" done -Text0425: ; 41d4e (10:5d4e) +Gal1ThanksText: ; 41d4e (10:5d4e) text "Thanks, !" line "I'll take good care" line "of this Lapras." done -Text0426: ; 41d7e (10:5d7e) +Gal1AfterTradeText: ; 41d7e (10:5d7e) text "Hey! You're the one who" line "gave me your Lapras!" line "I'm taking good care of" diff --git a/src/text/text5.asm b/src/text/text5.asm index ba26ccb..809cb63 100644 --- a/src/text/text5.asm +++ b/src/text/text5.asm @@ -95,7 +95,7 @@ Text049e: ; 4437a (11:437a) line "Well, I hope I see you around!" done -Text049f: ; 443d6 (11:43d6) +WhatIsADeckText: ; 443d6 (11:43d6) text "What is a deck?" done diff --git a/src/text/text8.asm b/src/text/text8.asm index c76de49..6bd0fe6 100644 --- a/src/text/text8.asm +++ b/src/text/text8.asm @@ -205,7 +205,7 @@ Text06a1: ; 509f2 (14:49f2) line "Bye!" done -Text06a2: ; 50a9e (14:4a9e) +FoundLv9SlowpokeText: ; 50a9e (14:4a9e) text "" line "checked the wall!" line "" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index b793894..0d2ca4d 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -407,7 +407,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer ReceivedPromotionalSurfingPikachuText ; 0x0193 textpointer Text0194 ; 0x0194 textpointer Text0195 ; 0x0195 - textpointer Text0196 ; 0x0196 + textpointer BoosterPackText ; 0x0196 textpointer Text0197 ; 0x0197 textpointer Text0198 ; 0x0198 textpointer Text0199 ; 0x0199 @@ -538,7 +538,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer InchesText ; 0x0216 textpointer YourDiscardPileText ; 0x0217 textpointer OpponentsDiscardPileText ; 0x0218 - textpointer Text0219 ; 0x0219 + textpointer DeckText ; 0x0219 textpointer Text021a ; 0x021a textpointer Text021b ; 0x021b textpointer Text021c ; 0x021c @@ -546,8 +546,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer WhatIsYourNameText ; 0x021e textpointer Text021f ; 0x021f textpointer Text0220 ; 0x0220 - textpointer Text0221 ; 0x0221 - textpointer NamingScreenKeyboardText ; 0x0222 + textpointer PlayerNameKeyboardText ; 0x0221 + textpointer DeckNameKeyboardText ; 0x0222 textpointer NewDeckText ; 0x0223 textpointer PleaseSelectDeckText ; 0x0224 textpointer Text0225 ; 0x0225 @@ -556,10 +556,10 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0228 ; 0x0228 textpointer Text0229 ; 0x0229 textpointer ChosenAsDuelingDeckText ; 0x022a - textpointer Text022b ; 0x022b - textpointer Text022c ; 0x022c - textpointer Text022d ; 0x022d - textpointer Text022e ; 0x022e + textpointer Deck1Text ; 0x022b + textpointer Deck2Text ; 0x022c + textpointer Deck3Text ; 0x022d + textpointer Deck4Text ; 0x022e textpointer ThereIsNoDeckHereText ; 0x022f textpointer Text0230 ; 0x0230 textpointer Text0231 ; 0x0231 @@ -763,42 +763,42 @@ TextOffsets:: ; 34000 (d:4000) textpointer GlossaryMenuPage1Text ; 0x02f7 textpointer GlossaryMenuPage2Text ; 0x02f8 textpointer ChooseWordAndPressAButtonText ; 0x02f9 - textpointer Text02fa ; 0x02fa - textpointer Text02fb ; 0x02fb - textpointer Text02fc ; 0x02fc - textpointer Text02fd ; 0x02fd - textpointer Text02fe ; 0x02fe - textpointer Text02ff ; 0x02ff - textpointer Text0300 ; 0x0300 - textpointer Text0301 ; 0x0301 - textpointer Text0302 ; 0x0302 - textpointer Text0303 ; 0x0303 - textpointer Text0304 ; 0x0304 - textpointer Text0305 ; 0x0305 - textpointer Text0306 ; 0x0306 - textpointer Text0307 ; 0x0307 - textpointer Text0308 ; 0x0308 - textpointer Text0309 ; 0x0309 - textpointer Text030a ; 0x030a - textpointer Text030b ; 0x030b - textpointer Text030c ; 0x030c - textpointer Text030d ; 0x030d - textpointer Text030e ; 0x030e - textpointer Text030f ; 0x030f - textpointer Text0310 ; 0x0310 - textpointer Text0311 ; 0x0311 - textpointer Text0312 ; 0x0312 - textpointer Text0313 ; 0x0313 - textpointer Text0314 ; 0x0314 - textpointer Text0315 ; 0x0315 - textpointer Text0316 ; 0x0316 - textpointer Text0317 ; 0x0317 - textpointer Text0318 ; 0x0318 - textpointer Text0319 ; 0x0319 - textpointer Text031a ; 0x031a - textpointer Text031b ; 0x031b - textpointer Text031c ; 0x031c - textpointer Text031d ; 0x031d + textpointer AboutTheDeckText ; 0x02fa + textpointer AboutTheDiscardPileText ; 0x02fb + textpointer AboutTheHandText ; 0x02fc + textpointer AboutTheArenaText ; 0x02fd + textpointer AboutTheBenchText ; 0x02fe + textpointer AboutTheActivePokemonText ; 0x02ff + textpointer AboutBenchPokemonText ; 0x0300 + textpointer AboutPrizesText ; 0x0301 + textpointer AboutDamageCountersText ; 0x0302 + textpointer AboutEnergyCardsText ; 0x0303 + textpointer AboutTrainerCardsText ; 0x0304 + textpointer AboutBasicPokemonText ; 0x0305 + textpointer AboutEvolutionCardsText ; 0x0306 + textpointer AboutAttackingText ; 0x0307 + textpointer AboutPokemonPowerText ; 0x0308 + textpointer AboutWeaknessText ; 0x0309 + textpointer AboutResistanceText ; 0x030a + textpointer AboutRetreatingText ; 0x030b + textpointer DeckDescriptionText ; 0x030c + textpointer DiscardPileDescriptionText ; 0x030d + textpointer HandDescriptionText ; 0x030e + textpointer ArenaDescriptionText ; 0x030f + textpointer BenchDescriptionText ; 0x0310 + textpointer ActivePokemonDescriptionText ; 0x0311 + textpointer BenchPokemonDescriptionText ; 0x0312 + textpointer PrizesDescriptionText ; 0x0313 + textpointer DamageCountersDescriptionText ; 0x0314 + textpointer EnergyCardsDescriptionText ; 0x0315 + textpointer TrainerCardsDescriptionText ; 0x0316 + textpointer BasicPokemonDescriptionText ; 0x0317 + textpointer EvolutionCardsDescriptionText ; 0x0318 + textpointer AttackingDescriptionText ; 0x0319 + textpointer PokemonPowerDescriptionText ; 0x031a + textpointer WeaknessDescriptionText ; 0x031b + textpointer ResistanceDescriptionText ; 0x031c + textpointer RetreatingDescriptionText ; 0x031d textpointer Text031e ; 0x031e textpointer Text031f ; 0x031f textpointer Text0320 ; 0x0320 @@ -1023,7 +1023,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text03fb ; 0x03fb textpointer Text03fc ; 0x03fc textpointer Text03fd ; 0x03fd - textpointer Text03fe ; 0x03fe + textpointer HowCanIHelpText ; 0x03fe textpointer Text03ff ; 0x03ff textpointer Text0400 ; 0x0400 textpointer Text0401 ; 0x0401 @@ -1051,19 +1051,19 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0417 ; 0x0417 textpointer Text0418 ; 0x0418 textpointer Text0419 ; 0x0419 - textpointer Text041a ; 0x041a - textpointer Text041b ; 0x041b + textpointer PokemonTradingCards101Text ; 0x041a + textpointer PlaceholderMessageText ; 0x041b textpointer Text041c ; 0x041c - textpointer Text041d ; 0x041d - textpointer Text041e ; 0x041e - textpointer Text041f ; 0x041f - textpointer Text0420 ; 0x0420 - textpointer Text0421 ; 0x0421 - textpointer Text0422 ; 0x0422 - textpointer Text0423 ; 0x0423 - textpointer Text0424 ; 0x0424 - textpointer Text0425 ; 0x0425 - textpointer Text0426 ; 0x0426 + textpointer Gal1WantToTrade1Text ; 0x041d + textpointer Gal1WantToTrade2Text ; 0x041e + textpointer Gal1WouldYouLikeToTradeText ; 0x041f + textpointer Gal1DeclinedTradeText ; 0x0420 + textpointer Gal1DontOwnCardText ; 0x0421 + textpointer Gal1CardInDeckText ; 0x0422 + textpointer Gal1LetsTradeText ; 0x0423 + textpointer Gal1TradeCompleteText ; 0x0424 + textpointer Gal1ThanksText ; 0x0425 + textpointer Gal1AfterTradeText ; 0x0426 textpointer Text0427 ; 0x0427 textpointer Text0428 ; 0x0428 textpointer Text0429 ; 0x0429 @@ -1184,7 +1184,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text049c ; 0x049c textpointer Text049d ; 0x049d textpointer Text049e ; 0x049e - textpointer Text049f ; 0x049f + textpointer WhatIsADeckText ; 0x049f textpointer Text04a0 ; 0x04a0 textpointer Text04a1 ; 0x04a1 textpointer Text04a2 ; 0x04a2 @@ -1699,7 +1699,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text069f ; 0x069f textpointer Text06a0 ; 0x06a0 textpointer Text06a1 ; 0x06a1 - textpointer Text06a2 ; 0x06a2 + textpointer FoundLv9SlowpokeText ; 0x06a2 textpointer Text06a3 ; 0x06a3 textpointer Text06a4 ; 0x06a4 textpointer Text06a5 ; 0x06a5 -- cgit v1.2.3 From 96168b95d2c70375a77243da759c2a4b54e80707 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 3 Jan 2021 23:36:02 -0600 Subject: Add labels for some addresses --- src/audio/music1_headers.asm | 156 +++++++++--------- src/audio/music2_headers.asm | 204 +++++++++++------------ src/data/booster_packs.asm | 24 +-- src/data/cards.asm | 4 +- src/data/decks.asm | 2 +- src/data/map_objects.asm | 52 +++--- src/data/map_scripts.asm | 348 ++++++++++++++++++++-------------------- src/data/move_animations.asm | 2 +- src/data/npc_map_data.asm | 158 +++++++++--------- src/data/warps.asm | 2 +- src/engine/bank01.asm | 56 ++++--- src/engine/bank02.asm | 241 ++++++++++++++++++---------- src/engine/bank03.asm | 108 +++++++++---- src/engine/bank04.asm | 127 ++++++++++----- src/engine/bank06.asm | 36 ++--- src/engine/bank07.asm | 138 ++++++++++------ src/engine/bank20.asm | 36 ++--- src/engine/effect_functions.asm | 8 +- src/engine/home.asm | 38 ++--- src/sram.asm | 26 +++ src/text/text1.asm | 4 +- src/text/text3.asm | 2 +- src/text/text_offsets.asm | 6 +- src/wram.asm | 34 +++- 24 files changed, 1032 insertions(+), 780 deletions(-) diff --git a/src/audio/music1_headers.asm b/src/audio/music1_headers.asm index 05f33bb..26cdff4 100644 --- a/src/audio/music1_headers.asm +++ b/src/audio/music1_headers.asm @@ -41,19 +41,19 @@ SongHeaderPointers1: ; f4f05 (3d:4f05) dw Music_DuelTheme2 dw Music_DuelTheme3 dw Music_PauseMenu - dw $0000 + dw NULL dw Music_DeckMachine dw Music_CardPop dw Music_Overworld - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL dw Music_Unused13 dw Music_Unused14 dw Music_MatchStart1 @@ -107,10 +107,10 @@ Music_PauseMenu: ; f4f68 (3d:4f68) ;Music_PCMainMenu db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_DeckMachine: ; f4f7a (3d:4f7a) db %1111 @@ -135,147 +135,147 @@ Music_Overworld: ; f4f8c (3d:4f8c) ;Music_PokemonDome db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_ChallengeHall db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Club1 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Club2 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Club3 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Ronald db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Imakuni db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_HallOfHonor db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Credits db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_Unused13: ; f4fe6 (3d:4fe6) db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_Unused14: ; f4fef (3d:4fef) db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_MatchStart1: ; f4ff8 (3d:4ff8) db %0001 dw Music_MatchStart1_Ch1 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL Music_MatchStart2: ; f5001 (3d:5001) db %0011 dw Music_MatchStart2_Ch1 dw Music_MatchStart2_Ch2 - dw $0000 - dw $0000 + dw NULL + dw NULL Music_MatchStart3: ; f500a (3d:500a) db %0011 dw Music_MatchStart3_Ch1 dw Music_MatchStart3_Ch2 - dw $0000 - dw $0000 + dw NULL + dw NULL Music_MatchVictory: ; f5013 (3d:5013) db %0111 dw Music_MatchVictory_Ch1 dw Music_MatchVictory_Ch2 dw Music_MatchVictory_Ch3 - dw $0000 + dw NULL Music_MatchLoss: ; f501c (3d:501c) db %0111 dw Music_MatchLoss_Ch1 dw Music_MatchLoss_Ch2 dw Music_MatchLoss_Ch3 - dw $0000 + dw NULL Music_MatchDraw: ; f5025 (3d:5025) db %0111 dw Music_MatchDraw_Ch1 dw Music_MatchDraw_Ch2 dw Music_MatchDraw_Ch3 - dw $0000 + dw NULL Music_Unused1b: ; f502e (3d:502e) db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_BoosterPack: ; f5037 (3d:5037) db %0111 dw Music_BoosterPack_Ch1 dw Music_BoosterPack_Ch2 dw Music_BoosterPack_Ch3 - dw $0000 + dw NULL Music_Medal: ; f5040 (3d:5040) db %0111 dw Music_Medal_Ch1 dw Music_Medal_Ch2 dw Music_Medal_Ch3 - dw $0000 + dw NULL Music_Unused1e: ; f5049 (3d:5049) db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL diff --git a/src/audio/music2_headers.asm b/src/audio/music2_headers.asm index 206d8fd..3a088f7 100644 --- a/src/audio/music2_headers.asm +++ b/src/audio/music2_headers.asm @@ -36,15 +36,15 @@ SongBanks2: ; f8ee6 (3e:4ee6) SongHeaderPointers2: ; f8f05 (3e:4f05) dw Music_Stop - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL dw Music_PCMainMenu - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw Music_PokemonDome dw Music_ChallengeHall dw Music_Club1 @@ -54,56 +54,56 @@ SongHeaderPointers2: ; f8f05 (3e:4f05) dw Music_Imakuni dw Music_HallOfHonor dw Music_Credits - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Stop db %0000 ;Music_TitleScreen db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_DuelTheme1 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_DuelTheme2 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_DuelTheme3 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_PauseMenu db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_PCMainMenu: ; f8f71 (3e:4f71) db %1111 @@ -114,24 +114,24 @@ Music_PCMainMenu: ; f8f71 (3e:4f71) ;Music_DeckMachine db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_CardPop db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Overworld db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL Music_PokemonDome: ; f8f95 (3e:4f95) db %1111 @@ -159,7 +159,7 @@ Music_Club2: ; f8fb0 (3e:4fb0) dw Music_Club2_Ch1 dw Music_Club2_Ch2 dw Music_Club2_Ch3 - dw $0000 + dw NULL Music_Club3: ; f8fb9 (3e:4fb9) db %1111 @@ -187,7 +187,7 @@ Music_HallOfHonor: ; f8fd4 (3e:4fd4) dw Music_HallOfHonor_Ch1 dw Music_HallOfHonor_Ch2 dw Music_HallOfHonor_Ch3 - dw $0000 + dw NULL Music_Credits: ; f8fdd (3e:4fdd) db %1111 @@ -198,84 +198,84 @@ Music_Credits: ; f8fdd (3e:4fdd) ;Music_Unused13 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Unused14 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchStart1 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchStart2 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchStart3 db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchVictory db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchLoss db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_MatchDraw db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Unused1b db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_BoosterPack db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Medal db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL ;Music_Unused1e db %0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL diff --git a/src/data/booster_packs.asm b/src/data/booster_packs.asm index 44a401f..51bb8c2 100644 --- a/src/data/booster_packs.asm +++ b/src/data/booster_packs.asm @@ -14,7 +14,7 @@ ENDM ; For the energy or energy generation function, there are three options: ; - Pointer to a function that generates energies (some generate one, some generate a full pack) ; - A single energy of a specific type -; - $0000 if no card in the pack is an energy +; - NULL if no card in the pack is an energy ; As for Card Type Chances, note that whenever one card of the 10 is drawn, the chances of ; the type of that card are reduced by the original average of all 8 types (capping the result at 1). @@ -232,7 +232,7 @@ BoosterPack_EvolutionTrainer:: ; 1e580 (7:6580) BoosterPack_MysteryNeutral:: ; 1e58c (7:658c) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 17 ; Grass Type Chance @@ -247,7 +247,7 @@ BoosterPack_MysteryNeutral:: ; 1e58c (7:658c) BoosterPack_MysteryGrassColorless:: ; 1e598 (7:6598) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 48 ; Grass Type Chance @@ -262,7 +262,7 @@ BoosterPack_MysteryGrassColorless:: ; 1e598 (7:6598) BoosterPack_MysteryWaterColorless:: ; 1e5a4 (7:65a4) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 12 ; Grass Type Chance @@ -277,7 +277,7 @@ BoosterPack_MysteryWaterColorless:: ; 1e5a4 (7:65a4) BoosterPack_MysteryLightningColorless:: ; 1e5b0 (7:65b0) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 12 ; Grass Type Chance @@ -292,7 +292,7 @@ BoosterPack_MysteryLightningColorless:: ; 1e5b0 (7:65b0) BoosterPack_MysteryFightingColorless:: ; 1e5bc (7:65bc) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 12 ; Grass Type Chance @@ -307,7 +307,7 @@ BoosterPack_MysteryFightingColorless:: ; 1e5bc (7:65bc) BoosterPack_MysteryTrainerColorless:: ; 1e5c8 (7:65c8) booster_set MYSTERY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 12 ; Grass Type Chance @@ -322,7 +322,7 @@ BoosterPack_MysteryTrainerColorless:: ; 1e5c8 (7:65c8) BoosterPack_LaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4) booster_set LABORATORY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 20 ; Grass Type Chance @@ -337,7 +337,7 @@ BoosterPack_LaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4) BoosterPack_LaboratoryGrass:: ; 1e5e0 (7:65e0) booster_set LABORATORY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 48 ; Grass Type Chance @@ -352,7 +352,7 @@ BoosterPack_LaboratoryGrass:: ; 1e5e0 (7:65e0) BoosterPack_LaboratoryWater:: ; 1e5ec (7:65ec) booster_set LABORATORY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 16 ; Grass Type Chance @@ -367,7 +367,7 @@ BoosterPack_LaboratoryWater:: ; 1e5ec (7:65ec) BoosterPack_LaboratoryPsychic:: ; 1e5f8 (7:65f8) booster_set LABORATORY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 16 ; Grass Type Chance @@ -382,7 +382,7 @@ BoosterPack_LaboratoryPsychic:: ; 1e5f8 (7:65f8) BoosterPack_LaboratoryTrainer:: ; 1e604 (7:6604) booster_set LABORATORY ; booster pack set - dw $0000 ; energy or energy generation function + dw NULL ; energy or energy generation function ; Card Type Chances db 16 ; Grass Type Chance diff --git a/src/data/cards.asm b/src/data/cards.asm index dca875a..de92db2 100644 --- a/src/data/cards.asm +++ b/src/data/cards.asm @@ -2,7 +2,7 @@ ; convenience once the meaning of all fields is figured out. CardPointers: ; 30c5c (c:4c5c) - dw $0000 + dw NULL dw GrassEnergyCard dw FireEnergyCard dw WaterEnergyCard @@ -231,7 +231,7 @@ CardPointers: ; 30c5c (c:4c5c) dw PokemonFluteCard dw GamblerCard dw RecycleCard - dw $0000 + dw NULL BulbasaurCard: ; 30e28 (c:4e28) db TYPE_PKMN_GRASS ; type diff --git a/src/data/decks.asm b/src/data/decks.asm index 424874b..8b800f4 100644 --- a/src/data/decks.asm +++ b/src/data/decks.asm @@ -54,7 +54,7 @@ DeckPointers: ; 30000 (c:4000) dw FlamethrowerDeck dw ReshuffleDeck dw ImakuniDeck - dw $0000 + dw NULL UnnamedDeck: ; 30070 (c:4070) db 20, PSYCHIC_ENERGY diff --git a/src/data/map_objects.asm b/src/data/map_objects.asm index eaa456f..046c20f 100644 --- a/src/data/map_objects.asm +++ b/src/data/map_objects.asm @@ -60,92 +60,92 @@ DeckMachineRoomObjects: ; 13b4d (3:7b4d) tx PokemonTradingCards101Text db NORTH, 6, 2 - dw $593f + dw Script_d93f tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 8, 2 - dw $593f + dw Script_d93f tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 10, 2 - dw $5995 + dw Script_d995 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 12, 2 - dw $5995 + dw Script_d995 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 14, 2 - dw $59c2 + dw Script_d9c2 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 16, 2 - dw $59c2 + dw Script_d9c2 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 18, 2 - dw $59ef + dw Script_d9ef tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 20, 2 - dw $59ef + dw Script_d9ef tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 14, 10 - dw $5a1c + dw Script_da1c tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 16, 10 - dw $5a1c + dw Script_da1c tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 18, 10 - dw $5a49 + dw Script_da49 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 20, 10 - dw $5a49 + dw Script_da49 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 14, 18 - dw $5a76 + dw Script_da76 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 16, 18 - dw $5a76 + dw Script_da76 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 18, 18 - dw $5aa3 + dw Script_daa3 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 20, 18 - dw $5aa3 + dw Script_daa3 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 2, 18 - dw $5ad0 + dw Script_dad0 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 4, 18 - dw $5ad0 + dw Script_dad0 tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -564,12 +564,12 @@ PokemonDomeEntranceObjects: ; 13e5e (3:7e5e) tx Text0507 db NORTH, 22, 0 - dw $76af + dw Script_f6af tx Text0558 tx Text0509 db NORTH, 24, 0 - dw $76af + dw Script_f6af tx Text0558 tx Text0509 @@ -585,22 +585,22 @@ HallOfHonorObjects: ; 13ec2 (3:7ec2) ; Legendary Cards db NORTH, 10, 10 dw Script_fbf1 - dw $0000 - dw $0000 + dw NULL + dw NULL ; Legendary Cards db NORTH, 12, 10 dw Script_fbf1 - dw $0000 - dw $0000 + dw NULL + dw NULL db NORTH, 10, 2 - dw $7be1 + dw Script_fbe1 tx PlaceholderMessageText tx PokemonTradingCards101Text db NORTH, 12, 2 - dw $7be1 + dw Script_fbe1 tx PlaceholderMessageText tx PokemonTradingCards101Text diff --git a/src/data/map_scripts.asm b/src/data/map_scripts.asm index 3084f8b..ff4e608 100644 --- a/src/data/map_scripts.asm +++ b/src/data/map_scripts.asm @@ -1,7 +1,7 @@ ; each map has a maximum of 8 scripts ; scripts are referenced with ids [0,2,4,6,8,a,c,e] ; each script id is used for a specific event -; if a script pointer is $0000, that map has no script for that event +; if a script pointer is NULL, that map has no script for that event ; 0: NPC data ; 2: Called after every NPC is loaded (unused) ; 4: Interactable Objects @@ -13,330 +13,330 @@ MapScripts: ; 1162a (4:562a) ; OVERWORLD_MAP - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw LoadOverworld - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL ; MASON_LABORATORY dw MasonLabNPCS - dw $0000 + dw NULL dw MasonLabObjects dw MasonLabPressedA dw MasonLabLoadMap dw MasonLaboratoryAfterDuel - dw $0000 + dw NULL dw MasonLabCloseTextBox ; DECK_MACHINE_ROOM dw DeckMachineRoomNPCS - dw $0000 + dw NULL dw DeckMachineRoomObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw $589f - dw $0000 + dw NULL dw $58ad ; ISHIHARAS_HOUSE dw IshiharasHouseNPCS - dw $0000 + dw NULL dw IshiharasHouseObjects - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL ; FIGHTING_CLUB_ENTRANCE dw FightingClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; FIGHTING_CLUB_LOBBY dw FightingClubLobbyNPCS - dw $0000 + dw NULL dw FightingClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw FightingClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; FIGHTING_CLUB dw FightingClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw FightingClubAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; ROCK_CLUB_ENTRANCE dw RockClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; ROCK_CLUB_LOBBY dw RockClubLobbyNPCS - dw $0000 + dw NULL dw RockClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw RockClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; ROCK_CLUB dw RockClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw $5fd6 - dw $0000 - dw $0000 + dw NULL + dw NULL ; WATER_CLUB_ENTRANCE dw WaterClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; WATER_CLUB_LOBBY dw WaterClubLobbyNPCS - dw $0000 + dw NULL dw WaterClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw WaterClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; WATER_CLUB dw WaterClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw WaterClubAfterDuel dw WaterClubMovePlayer - dw $0000 + dw NULL ; LIGHTNING_CLUB_ENTRANCE dw LightningClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; LIGHTNING_CLUB_LOBBY dw LightningClubLobbyNPCS - dw $0000 + dw NULL dw LightningClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw LightningClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; LIGHTNING_CLUB dw LightningClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw $63e8 - dw $0000 - dw $0000 + dw NULL + dw NULL ; GRASS_CLUB_ENTRANCE dw GrassClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw GrassClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; GRASS_CLUB_LOBBY dw GrassClubLobbyNPCS - dw $0000 + dw NULL dw GrassClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw GrassClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; GRASS_CLUB dw GrassClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw $66e7 - dw $0000 - dw $0000 + dw NULL + dw NULL ; PSYCHIC_CLUB_ENTRANCE dw PsychicClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; PSYCHIC_CLUB_LOBBY dw PsychicClubLobbyNPCS - dw $0000 + dw NULL dw PsychicClubLobbyObjects - dw $0000 + dw NULL dw $6971 dw PsychicClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; PSYCHIC_CLUB dw PsychicClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw $6a46 - dw $0000 - dw $0000 + dw NULL + dw NULL ; SCIENCE_CLUB_ENTRANCE dw ScienceClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; SCIENCE_CLUB_LOBBY dw ScienceClubLobbyNPCS - dw $0000 + dw NULL dw ScienceClubLobbyObjects - dw $0000 - dw $0000 + dw NULL + dw NULL dw ScienceClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; SCIENCE_CLUB dw ScienceClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw $6bf1 - dw $0000 - dw $0000 + dw NULL + dw NULL ; FIRE_CLUB_ENTRANCE dw FireClubEntranceNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw LoadClubEntrance dw ClubEntranceAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; FIRE_CLUB_LOBBY dw FireClubLobbyNPCS - dw $0000 + dw NULL dw FireClubLobbyObjects dw FireClubPressedA - dw $0000 + dw NULL dw FireClubLobbyAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; FIRE_CLUB dw FireClubNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL dw FireClubAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; CHALLENGE_HALL_ENTRANCE dw ChallengeHallEntranceNPCS - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL + dw NULL ; CHALLENGE_HALL_LOBBY dw ChallengeHallLobbyNPCS - dw $0000 + dw NULL dw ChallengeHallLobbyObjects - dw $0000 + dw NULL dw ChallengeHallLobbyLoadMap - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL ; CHALLENGE_HALL dw ChallengeHallNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw ChallengeHallLoadMap dw ChallengeHallAfterDuel - dw $0000 - dw $0000 + dw NULL + dw NULL ; POKEMON_DOME_ENTRANCE dw PokemonDomeEntranceNPCS - dw $0000 + dw NULL dw PokemonDomeEntranceObjects - dw $0000 + dw NULL dw $7607 - dw $0000 - dw $0000 + dw NULL + dw NULL dw $762a ; POKEMON_DOME dw PokemonDomeNPCS - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL dw $7706 dw $76e0 dw $76c6 @@ -344,10 +344,10 @@ MapScripts: ; 1162a (4:562a) ; HALL_OF_HONOR dw HallOfHonorNPCS - dw $0000 + dw NULL dw HallOfHonorObjects - dw $0000 + dw NULL dw HallOfHonorLoadMap - dw $0000 - dw $0000 - dw $0000 + dw NULL + dw NULL + dw NULL diff --git a/src/data/move_animations.asm b/src/data/move_animations.asm index 222a6d7..48cf7c6 100644 --- a/src/data/move_animations.asm +++ b/src/data/move_animations.asm @@ -21,7 +21,7 @@ anim_end2: MACRO ENDM PointerTable_MoveAnimation: - dw $0000 + dw NULL dw MoveAnimation_52c6 dw MoveAnimation_52cf dw MoveAnimation_52c6 diff --git a/src/data/npc_map_data.asm b/src/data/npc_map_data.asm index 7c01e72..bf26269 100644 --- a/src/data/npc_map_data.asm +++ b/src/data/npc_map_data.asm @@ -8,26 +8,26 @@ MasonLabNPCS: ; 772f (4:1372f) db NPC_SAM, $04, $0e, EAST dw $5604 db NPC_TECH1, $16, $08, WEST - dw $0000 + dw NULL db NPC_TECH2, $16, $14, SOUTH - dw $0000 + dw NULL db NPC_TECH3, $16, $16, WEST - dw $0000 + dw NULL db NPC_TECH4, $0a, $16, EAST - dw $0000 + dw NULL db NPC_TECH5, $06, $04, SOUTH dw $55eb db $00 DeckMachineRoomNPCS: ; 775a (4:1375a) db NPC_TECH6, $06, $08, SOUTH - dw $0000 + dw NULL db NPC_TECH7, $06, $16, WEST - dw $0000 + dw NULL db NPC_TECH8, $0a, $12, WEST - dw $0000 + dw NULL db NPC_AARON, $0c, $0c, WEST - dw $0000 + dw NULL db $00 IshiharasHouseNPCS: ; 7773 (4:13773) @@ -41,7 +41,7 @@ IshiharasHouseNPCS: ; 7773 (4:13773) FightingClubEntranceNPCS: ; 7786 (4:13786) db NPC_CLERK1, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -52,17 +52,17 @@ FightingClubEntranceNPCS: ; 7786 (4:13786) FightingClubLobbyNPCS: ; 779f (4:1379f) db NPC_MAN1, $0c, $0e, WEST - dw $0000 + dw NULL db NPC_IMAKUNI, $12, $02, NORTH dw $5ceb db NPC_SPECS1, $12, $10, EAST - dw $0000 + dw NULL db NPC_BUTCH, $14, $10, WEST - dw $0000 + dw NULL db NPC_GRANNY1, $04, $10, WEST dw $5d98 db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 @@ -75,12 +75,12 @@ FightingClubNPCS: ; 77ca (4:137ca) db NPC_JESSICA, $12, $06, EAST dw $5ea5 db NPC_MITCH, $0a, $04, SOUTH - dw $0000 + dw NULL db $00 RockClubEntranceNPCS: ; 77e3 (4:137e3) db NPC_CLERK2, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -93,31 +93,31 @@ RockClubLobbyNPCS: ; 77fc (4:137fc) db NPC_CHRIS, $12, $08, WEST dw $5ee9 db NPC_MATTHEW, $06, $0e, EAST - dw $0000 + dw NULL db NPC_WOMAN1, $14, $12, NORTH - dw $0000 + dw NULL db NPC_CHAP1, $0e, $10, EAST - dw $0000 + dw NULL db NPC_LASS3, $10, $04, SOUTH dw $5fcb db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 RockClubNPCS: ; 7827 (4:13827) db NPC_RYAN, $14, $0e, EAST - dw $0000 + dw NULL db NPC_ANDREW, $06, $14, NORTH - dw $0000 + dw NULL db NPC_GENE, $0c, $06, NORTH - dw $0000 + dw NULL db $00 WaterClubEntranceNPCS: ; 783a (4:1383a) db NPC_CLERK3, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -128,35 +128,35 @@ WaterClubEntranceNPCS: ; 783a (4:1383a) WaterClubLobbyNPCS: ; 7853 (4:13853) db NPC_GAL1, $06, $0e, SOUTH - dw $0000 + dw NULL db NPC_LASS1, $10, $0a, SOUTH - dw $0000 + dw NULL db NPC_IMAKUNI, $12, $02, NORTH dw Preload_ImakuniInWaterClubLobby db NPC_MAN2, $04, $12, EAST dw Preload_Man2InWaterClubLobby db NPC_PAPPY2, $16, $10, NORTH - dw $0000 + dw NULL db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 WaterClubNPCS: ; 787e (4:1387e) db NPC_SARA, $06, $12, EAST - dw $0000 + dw NULL db NPC_AMANDA, $16, $14, WEST - dw $0000 + dw NULL db NPC_JOSHUA, $16, $08, SOUTH - dw $0000 + dw NULL db NPC_AMY, $16, $04, SOUTH dw Preload_Amy db $00 LightningClubEntranceNPCS: ; 7897 (4:13897) db NPC_CLERK4, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -167,33 +167,33 @@ LightningClubEntranceNPCS: ; 7897 (4:13897) LightningClubLobbyNPCS: ; 78b0 (4:138b0) db NPC_CHAP2, $12, $10, WEST - dw $0000 + dw NULL db NPC_IMAKUNI, $12, $02, NORTH dw $637b db NPC_LASS4, $08, $0c, SOUTH - dw $0000 + dw NULL db NPC_HOOD1, $14, $08, SOUTH - dw $0000 + dw NULL db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 LightningClubNPCS: ; 78d5 (4:138d5) db NPC_JENNIFER, $0e, $12, SOUTH - dw $0000 + dw NULL db NPC_NICHOLAS, $06, $0a, SOUTH - dw $0000 + dw NULL db NPC_BRANDON, $16, $0c, NORTH - dw $0000 + dw NULL db NPC_ISAAC, $0c, $04, NORTH dw $6494 db $00 GrassClubEntranceNPCS: ; 78ee (4:138ee) db NPC_CLERK5, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_MICHAEL, $0e, $08, SOUTH dw $656a db NPC_RONALD1, $08, $fe, SOUTH @@ -206,31 +206,31 @@ GrassClubEntranceNPCS: ; 78ee (4:138ee) GrassClubLobbyNPCS: ; 790d (4:1390d) db NPC_BRITTANY, $0c, $0e, WEST - dw $0000 + dw NULL db NPC_LASS2, $12, $08, SOUTH - dw $0000 + dw NULL db NPC_GRANNY2, $04, $10, EAST - dw $0000 + dw NULL db NPC_GAL2, $14, $10, NORTH dw $66dc db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 GrassClubNPCS: ; 7932 (4:13932) db NPC_KRISTIN, $04, $0a, EAST - dw $0000 + dw NULL db NPC_HEATHER, $0e, $10, SOUTH - dw $0000 + dw NULL db NPC_NIKKI, $0c, $04, SOUTH dw $6796 db $00 PsychicClubEntranceNPCS: ; 7945 (4:13945) db NPC_CLERK6, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -238,31 +238,31 @@ PsychicClubEntranceNPCS: ; 7945 (4:13945) db NPC_RONALD3, $fe, $08, NORTH dw $6915 db NPC_LAD3, $0e, $04, SOUTH - dw $0000 + dw NULL db $00 PsychicClubLobbyNPCS: ; 7964 (4:13964) db NPC_ROBERT, $14, $08, NORTH - dw $0000 + dw NULL db NPC_PAPPY1, $04, $10, EAST - dw $0000 + dw NULL db NPC_RONALD1, $0c, $0a, EAST dw $69f7 db NPC_GAL3, $10, $0e, WEST - dw $0000 + dw NULL db NPC_CHAP4, $18, $10, SOUTH - dw $0000 + dw NULL db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 PsychicClubNPCS: ; 798f (4:1398f) db NPC_DANIEL, $08, $08, NORTH - dw $0000 + dw NULL db NPC_STEPHANIE, $16, $0c, EAST - dw $0000 + dw NULL db NPC_MURRAY2, $02, $02, WEST dw $6ad0 db NPC_MURRAY1, $0c, $06, SOUTH @@ -271,7 +271,7 @@ PsychicClubNPCS: ; 798f (4:1398f) ScienceClubEntranceNPCS: ; 79a8 (4:139a8) db NPC_CLERK7, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -282,17 +282,17 @@ ScienceClubEntranceNPCS: ; 79a8 (4:139a8) ScienceClubLobbyNPCS: ; 79c1 (4:139c1) db NPC_LAD1, $12, $12, NORTH - dw $0000 + dw NULL db NPC_IMAKUNI, $12, $02, NORTH dw $6b65 db NPC_MAN3, $04, $0e, WEST - dw $0000 + dw NULL db NPC_SPECS2, $0c, $0e, WEST - dw $0000 + dw NULL db NPC_SPECS3, $16, $08, SOUTH - dw $0000 + dw NULL db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 @@ -301,16 +301,16 @@ ScienceClubNPCS: ; 79ec (4:139ec) db NPC_JOSEPH, $08, $0a, SOUTH dw $6cc4 db NPC_DAVID, $14, $04, NORTH - dw $0000 + dw NULL db NPC_ERIK, $06, $12, SOUTH - dw $0000 + dw NULL db NPC_RICK, $04, $04, NORTH - dw $0000 + dw NULL db $00 FireClubEntranceNPCS: ; 7a05 (4:13a05) db NPC_CLERK8, $06, $02, SOUTH - dw $0000 + dw NULL db NPC_RONALD1, $08, $fe, SOUTH dw $685b db NPC_RONALD2, $fe, $08, NORTH @@ -325,24 +325,24 @@ FireClubLobbyNPCS: ; 7a1e (4:13a1e) db NPC_LAD2, $12, $06, EAST dw $6e25 db NPC_CHAP3, $06, $0a, NORTH - dw $0000 + dw NULL db NPC_MANIA, $14, $12, NORTH - dw $0000 + dw NULL db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 FireClubNPCS: ; 7a43 (4:13a43) db NPC_JOHN, $0c, $12, SOUTH - dw $0000 + dw NULL db NPC_ADAM, $08, $0e, SOUTH - dw $0000 + dw NULL db NPC_JONATHAN, $12, $0a, SOUTH - dw $0000 + dw NULL db NPC_KEN, $0e, $04, SOUTH - dw $0000 + dw NULL db $00 ChallengeHallEntranceNPCS: ; 7a5c (4:13a5c) @@ -366,7 +366,7 @@ ChallengeHallLobbyNPCS: ; 7a63 (4:13a63) db NPC_RONALD1, $08, $0c, SOUTH dw Preload_ChallengeHallLobbyRonald1 db NPC_CLERK10, $06, $04, SOUTH - dw $0000 + dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH dw Preload_GiftCenterClerk db $00 @@ -386,7 +386,7 @@ ChallengeHallNPCS: ; 7a9a (4:13a9a) PokemonDomeEntranceNPCS: ; 7ab9 (4:13ab9) db NPC_RONALD1, $0e, $12, SOUTH - dw $0000 + dw NULL db $00 PokemonDomeNPCS: ; 7ac0 (4:13ac0) @@ -404,15 +404,15 @@ PokemonDomeNPCS: ; 7ac0 (4:13ac0) HallOfHonorNPCS: ; 7adf (4:13adf) db NPC_LEGENDARY_CARD_TOP_LEFT, $0a, $08, SOUTH - dw $0000 + dw NULL db NPC_LEGENDARY_CARD_TOP_RIGHT, $0c, $08, SOUTH - dw $0000 + dw NULL db NPC_LEGENDARY_CARD_LEFT_SPARK, $08, $0a, SOUTH - dw $0000 + dw NULL db NPC_LEGENDARY_CARD_BOTTOM_LEFT, $0a, $0a, SOUTH - dw $0000 + dw NULL db NPC_LEGENDARY_CARD_BOTTOM_RIGHT, $0c, $0a, SOUTH - dw $0000 + dw NULL db NPC_LEGENDARY_CARD_RIGHT_SPARK, $0e, $0a, SOUTH - dw $0000 + dw NULL db $00 diff --git a/src/data/warps.asm b/src/data/warps.asm index cb34721..cba8053 100644 --- a/src/data/warps.asm +++ b/src/data/warps.asm @@ -1,5 +1,5 @@ WarpDataPointers: ; 1c099 (7:4099) - dw $0000 + dw NULL dw MasonLaboratoryWarpData dw DeckMachineRoomWarpData dw IshiharasHouseWarpData diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 572109f..af902ac 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -509,7 +509,7 @@ OpenActivePokemonScreen: ; 4376 (1:4376) ; triggered by selecting the "Pkmn Power" item in the duel menu DuelMenu_PkmnPower: ; 438e (1:438e) - call $6431 + call Func_6431 jp c, DuelMainInterface call UseAttackOrPokemonPower jp DuelMainInterface @@ -1026,7 +1026,7 @@ EnergyDiscardCardListParameters: ; 46f3 (1:46f3) db 4 ; number of items selectable without scrolling db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; triggered by selecting the "Attack" item in the duel menu DuelMenu_Attack: ; 46fc (1:46fc) @@ -1167,28 +1167,28 @@ AttackMenuParameters: ; 47e4 (1:47e4) db 2 ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; display the card page with id at wMovePageNumber of wLoadedCard1 -DisplayMovePage: ; $47ec (1:47ec) +DisplayMovePage: ; 47ec (1:47ec) ld a, [wMovePageNumber] ld hl, MovePageDisplayPointerTable jp JumpToFunctionInTable -MovePageDisplayPointerTable: ; $47f5 (1:47f5) +MovePageDisplayPointerTable: ; 47f5 (1:47f5) dw DisplayMovePage_Move1Page1 ; MOVEPAGE_MOVE1_1 dw DisplayMovePage_Move1Page2 ; MOVEPAGE_MOVE1_2 dw DisplayMovePage_Move2Page1 ; MOVEPAGE_MOVE2_1 dw DisplayMovePage_Move2Page2 ; MOVEPAGE_MOVE2_2 ; display MOVEPAGE_MOVE1_1 -DisplayMovePage_Move1Page1: ; $47fd (1:47fd) +DisplayMovePage_Move1Page1: ; 47fd (1:47fd) call DisplayCardPage_PokemonMove1Page1 jr SwitchMovePage ; display MOVEPAGE_MOVE1_2 if it exists. otherwise return in order ; to switch back to MOVEPAGE_MOVE1_1 and display it instead. -DisplayMovePage_Move1Page2: ; $4802 (1:4802) +DisplayMovePage_Move1Page2: ; 4802 (1:4802) ld hl, wLoadedCard1Move1Description + 2 ld a, [hli] or [hl] @@ -1197,13 +1197,13 @@ DisplayMovePage_Move1Page2: ; $4802 (1:4802) jr SwitchMovePage ; display MOVEPAGE_MOVE2_1 -DisplayMovePage_Move2Page1: ; $480d (1:480d) +DisplayMovePage_Move2Page1: ; 480d (1:480d) call DisplayCardPage_PokemonMove2Page1 jr SwitchMovePage ; display MOVEPAGE_MOVE2_2 if it exists. otherwise return in order ; to switch back to MOVEPAGE_MOVE2_1 and display it instead. -DisplayMovePage_Move2Page2: ; $4812 (1:4812) +DisplayMovePage_Move2Page2: ; 4812 (1:4812) ld hl, wLoadedCard1Move2Description + 2 ld a, [hli] or [hl] @@ -1213,7 +1213,7 @@ DisplayMovePage_Move2Page2: ; $4812 (1:4812) ; switch to MOVEPAGE_MOVE*_2 if in MOVEPAGE_MOVE*_1 and vice versa. ; sets the next move page to switch to if Right or Left are pressed. -SwitchMovePage: ; $481b (1:481b) +SwitchMovePage: ; 481b (1:481b) ld hl, wMovePageNumber ld a, $01 xor [hl] @@ -2148,7 +2148,7 @@ NoBasicPokemonCardListParameters: ; 4e37 (1:4e37) db 7 ; number of items selectable without scrolling db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; used only during the practice duel with Sam. ; displays the list with the player's cards in hand, and the player's name above the list. @@ -2631,7 +2631,7 @@ DoPracticeDuelAction: ; 51e7 (1:51e7) jp JumpToFunctionInTable PracticeDuelActionTable: ; 51f8 (1:51f8) - dw $0000 + dw NULL dw PracticeDuel_DrawSevenCards dw PracticeDuel_PlayGoldeen dw PracticeDuel_PutStaryuInBench @@ -3451,7 +3451,7 @@ ItemSelectionMenuParameters: ; 5708 (1:5708) db 2 ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 CardListParameters: ; 5710 (1:5710) db 1, 3 ; cursor x, cursor y @@ -5661,7 +5661,10 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6) ret ; 0x6423 - INCROM $6423, $6510 + INCROM $6423, $6431 + +Func_6431: ; 6431 (1:6431) + INCROM $6431, $6510 ; display the screen that prompts the player to use the selected card's ; Pokemon Power. Includes the card's information above, and the Pokemon Power's @@ -6803,7 +6806,7 @@ HandleBetweenTurnsEvents: ; 6baf (1:6baf) .asm_6c3a call DiscardAttachedDefenders call SwapTurn - call $6e4c + call Func_6e4c ret ; discard any PLUSPOWER attached to the turn holder's arena and/or bench Pokemon @@ -7128,6 +7131,9 @@ ApplyStatusConditionToArenaPokemon: ; 6e38 (1:6e38) Func_6e49: ; 6e49 (1:6e49) call HandleDestinyBondSubstatus + ; fallthrough + +Func_6e4c: ; 6e4c (1:6e4c) call ClearDamageReductionSubstatus2OfKnockedOutPokemon xor a ld [wcce8], a @@ -7778,12 +7784,12 @@ _TossCoin: ; 71ad (1:71ad) ld a, [wcd9e] or a jr z, .asm_7236 - call $7324 + call Func_7324 jr .asm_723c .asm_7236 call WaitForWideTextBoxInput - call $72ff + call Func_72ff .asm_723c call Func_3b21 @@ -7802,7 +7808,7 @@ _TossCoin: ; 71ad (1:71ad) or a jr z, .asm_725e ld a, e - call $7310 + call Func_7310 ld e, a jr .asm_726c @@ -7813,7 +7819,7 @@ _TossCoin: ; 71ad (1:71ad) pop de jr c, .asm_725e ld a, e - call $72ff + call Func_72ff .asm_726c ld b, $5c @@ -7879,7 +7885,7 @@ _TossCoin: ; 71ad (1:71ad) ld hl, wcd9c cp [hl] call z, WaitForWideTextBoxInput - call $7324 + call Func_7324 ld a, [wcd9c] ld hl, wCoinTossNumHeads or [hl] @@ -7889,7 +7895,7 @@ _TossCoin: ; 71ad (1:71ad) .asm_72dc call WaitForWideTextBoxInput - call $72ff + call Func_72ff .asm_72e2 call Func_3b31 @@ -7922,13 +7928,15 @@ Func_7310: ; 7310 (1:7310) ldh [hff96], a ld a, [wDuelType] cp DUELTYPE_LINK - jr z, .asm_7338 + jr z, Func_7324.asm_7338 .asm_7319 call DoFrame call CheckAnyAnimationPlaying jr c, .asm_7319 ldh a, [hff96] ret + +Func_7324: ; 7324 (1:7324) ldh [hff96], a ld a, [wDuelType] cp DUELTYPE_LINK @@ -8042,7 +8050,7 @@ Func_73d8: ; 73d8 (1:73d8) ld [hli], a ld [hl], a .asm_73ec - ld hl, $7408 + ld hl, Data_7408 call PlaceTextItems call DrawDuelistPortraitsAndNames ld a, [wOpponentDeckID] @@ -8052,8 +8060,8 @@ Func_73d8: ; 73d8 (1:73d8) lb bc, 15, 10 call WriteTwoByteNumberInTxSymbolFormat ret -; 0x7408 +Data_7408: ; 7408 (1:7408) INCROM $7408, $7415 Func_7415: ; 7415 (1:7415) diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 1e6179b..c72af73 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -1379,8 +1379,8 @@ Func_8764: ; 8764 (2:4764) call LoadCursorTile ; reset ce5c and ce56 xor a - ld [$ce5c], a - ld [$ce56], a + ld [wce5c], a + ld [wce56], a ; draw play area screen for the turn player ldh a, [hWhoseTurn] @@ -1389,13 +1389,13 @@ Func_8764: ; 8764 (2:4764) call DrawYourOrOppPlayAreaScreen .swap - ld a, [$ce56] + ld a, [wce56] or a jr z, .draw_menu ; if ce56 != 0, swap turn call SwapTurn xor a - ld [$ce56], a + ld [wce56], a .draw_menu xor a @@ -1430,7 +1430,7 @@ Func_8764: ; 8764 (2:4764) ld l, a call DrawYourOrOppPlayAreaScreen xor a - ld [$ce56], a + ld [wce56], a .text call DrawWideTextBox @@ -1482,7 +1482,7 @@ PlayAreaMenuParameters: ; 8811 (2:4811) db 2 ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 Func_8819: ; 8819 (2:4819) ld a, [wPrizeCardCursorPosition] @@ -1506,7 +1506,7 @@ Func_8819: ; 8819 (2:4819) ld a, c add $40 - ld [$ce5c], a + ld [wce5c], a ld a, c add DUELVARS_PRIZE_CARDS call GetTurnDuelistVariable @@ -1524,7 +1524,7 @@ Func_8849: ; 8849 (2:4849) call CreateDeckCardList ret c ld a, %01111111 - ld [$ce5c], a + ld [wce5c], a ld a, [wDuelTempList] ; fallthrough @@ -1535,11 +1535,11 @@ Func_8849: ; 8849 (2:4849) ; with upper bit set if turn was swapped Func_8855: ; 8855 (2:4855) ld b, a - ld a, [$ce5c] + ld a, [wce5c] or a jr nz, .display ld a, b - ld [$ce5c], a + ld [wce5c], a .display ld a, b call LoadCardDataToBuffer1_FromDeckIndex @@ -1550,15 +1550,15 @@ Func_8855: ; 8855 (2:4855) pop af ; if ce56 != 0, swap turn - ld a, [$ce56] + ld a, [wce56] or a jr z, .dont_swap call SwapTurn - ld a, [$ce5c] + ld a, [wce5c] or %10000000 ret .dont_swap - ld a, [$ce5c] + ld a, [wce5c] ret Func_8883: ; 8883 (2:4883) @@ -1597,7 +1597,7 @@ Func_8883: ; 8883 (2:4883) call SwapTurn ld a, $01 - ld [$ce56], a + ld [wce56], a jp Func_8764.loop_2 Func_8764_TransitionTable: ; 88c2 (2:48c2) @@ -1866,13 +1866,13 @@ Func_8cd4: ; 8cd4 (2:4cd4) Func_8cf9: ; 8cf9 (2:4cf9) call EnableSRAM xor a - ld hl, $b703 + ld hl, sb703 ld [hli], a inc a ld [hli], a ld [hli], a ld [hl], a - ld [$b701], a + ld [sb701], a call DisableSRAM Func_8d0b: ; 8d0b (2:4d0b) ld hl, Unknown_8d15 @@ -2106,7 +2106,7 @@ Func_8f05: ; 8f05 (2:4f05) ret Func_8f38: ; 8f38 (2:4f38) - ld hl, $b701 + ld hl, sb701 call EnableSRAM ld a, [hli] ld h, [hl] @@ -2127,7 +2127,7 @@ Func_8f38: ; 8f38 (2:4f38) inc hl ld [hl], $20 inc hl - ld de, $c592 + ld de, wc592 ld a, [de] inc de ld [hli], a @@ -2138,7 +2138,7 @@ Func_8f38: ; 8f38 (2:4f38) ld [hli], a xor a ld [hl], a - ld hl, $b701 + ld hl, sb701 call EnableSRAM ld e, [hl] inc hl @@ -2447,17 +2447,17 @@ Func_9152: ; 9152 (2:5152) Func_9168: ; 9168 (2:5168) ld [hffb5], a call Func_8d56 - ld de, $0000 - ld bc, $1404 + lb de, 0, 0 + lb bc, 20, 4 call DrawRegularTextBox - ld de, $0003 - ld bc, $1404 + lb de, 0, 3 + lb bc, 20, 4 call DrawRegularTextBox - ld de, $0006 - ld bc, $1404 + lb de, 0, 6 + lb bc, 20, 4 call DrawRegularTextBox - ld de, $0009 - ld bc, $1404 + lb de, 0, 9 + lb bc, 20, 4 call DrawRegularTextBox ld hl, Unknown_9242 call PlaceTextItems @@ -2709,13 +2709,19 @@ CalculateOnesAndTensDigits: ; 98a6 (2:58a6) pop af ret - INCROM $98c7, $9e41 + INCROM $98c7, $9a6d + +Func_9a6d: ; 9a6d (2:5a6d) + INCROM $9a6d, $9e41 Func_9e41: ; 9e41 (2:5e41) INCROM $9e41, $a288 Func_a288: ; a288 (2:6288) - INCROM $a288, $b177 + INCROM $a288, $adfe + +Func_adfe: ; adfe (2:6dfe) + INCROM $adfe, $b177 Func_b177: ; b177 (2:7177) INCROM $b177, $b19d @@ -2728,20 +2734,20 @@ Func_b19d: ; b19d (2:719d) ld [hl], e inc hl ld [hl], d - call $7379 + call Func_b379 ld a, $3c ld [wd0a5], a xor a .asm_b1b3 - ld hl, $76fb - call $5a6d - call $7704 - call $7545 + ld hl, Unknown_b6fb + call Func_9a6d + call Func_b704 + call Func_b545 ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText ld de, $0224 ; PleaseSelectDeckText? - call $7285 - call $729f + call Func_b285 + call Func_b29f jr c, .asm_b1b3 cp $ff ret z @@ -2751,15 +2757,16 @@ Func_b19d: ; b19d (2:719d) ld [wd088], a call ResetCheckMenuCursorPositionAndBlink call DrawWideTextBox - ld hl, $7274 + ld hl, Unknown_b274 call PlaceTextItems +.asm_b1e7 call DoFrame call HandleCheckMenuInput - jp nc, $71e7 + jp nc, .asm_b1e7 cp $ff jr nz, .asm_b1fa ld a, [wd086] - jp $71b3 + jp .asm_b1b3 .asm_b1fa ld a, [wCheckMenuCursorYPosition] @@ -2768,66 +2775,108 @@ Func_b19d: ; b19d (2:719d) add [hl] or a jr nz, .asm_b22c - call $735b + call Func_b35b jr nc, .asm_b216 - call $7592 + call Func_b592 ld a, [wd086] - jp c, $71b3 + jp c, .asm_b1b3 jr .asm_b25e .asm_b216 - ld hl, $0272 + ldtx hl, OKIfFileDeletedText call YesOrNoMenuWithText ld a, [wd086] jr c, .asm_b1b3 - call $7592 + call Func_b592 ld a, [wd086] - jp c, $71b3 + jp c, .asm_b1b3 jr .asm_b25e .asm_b22c cp $1 jr nz, .asm_b24c - call $735b + call Func_b35b jr c, .asm_b240 - call $76ca + call Func_b6ca ld a, [wd086] - jp c, $71b3 + jp c, .asm_b1b3 jr .asm_b25e .asm_b240 ld hl, WaitForVBlank call DrawWideTextBox_WaitForInput ld a, [wd086] - jp $71b3 + jp .asm_b1b3 .asm_b24c cp $2 jr nz, .asm_b273 - call $735b + call Func_b35b jr c, .asm_b240 - call $77c6 + call Func_b7c6 ld a, [wd086] - jp nc, $71b3 + jp nc, .asm_b1b3 .asm_b25e ld a, [wd087] ld [wcea1], a - call $7379 - call $7704 - call $7545 + call Func_b379 + call Func_b704 + call Func_b545 ld a, [wd086] - jp $71b3 + jp .asm_b1b3 .asm_b273 ret -; 0xb274 - INCROM $b274, $ba04 +Unknown_b274: ; b274 (2:7274) + INCROM $b274, $b285 + +Func_b285: ; b285 (2:7285) + INCROM $b285, $b29f + +Func_b29f: ; b29f (2:729f) + INCROM $b29f, $b35b + +Func_b35b: ; b35b (2:735b) + INCROM $b35b, $b379 + +Func_b379: ; b379 (2:7379) + INCROM $b379, $b3fe + +Unknown_b3fe: ; b3fe (2:73fe) + INCROM $b3fe, $b545 + +Func_b545: ; b545 (2:7545) + INCROM $b545, $b592 + +Func_b592: ; b592 (2:7592) + INCROM $b592, $b625 + +Func_b625: ; b625 (2:7625) + INCROM $b625, $b644 + +Func_b644: ; b644 (2:7644) + INCROM $b644, $b653 + +Func_b653: ; b653 (2:7653) + INCROM $b653, $b6ca + +Func_b6ca: ; b6ca (2:76ca) + INCROM $b6ca, $b6fb + +Unknown_b6fb: ; b6fb (2:76fb) + INCROM $b6fb, $b704 + +Func_b704: ; b704 (2:7704) + INCROM $b704, $b7c6 + +Func_b7c6: ; b7c6 (2:77c6) + INCROM $b7c6, $ba04 Func_ba04: ; ba04 (2:7a04) ld a, [wd0a9] - ld hl, $7b83 + ld hl, Data_bb83 sla a ld c, a ld b, $0 @@ -2840,17 +2889,20 @@ Func_ba04: ; ba04 (2:7a04) ld [de], a xor a ld [wcea1], a - call $7b97 + call Func_bb97 ld a, $5 ld [wd0a5], a xor a - ld hl, $7b6e + ; fallthrough + +Func_ba25: ; ba25 (2:7a25) + ld hl, Func_bb6e call InitializeMenuParameters ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText ld a, $5 ld [wNamingScreenKeyboardHeight], a - ld hl, $73fe + ld hl, Unknown_b3fe ld d, h ld a, l ld hl, wcece @@ -2882,7 +2934,7 @@ Func_ba04: ; ba04 (2:7a04) ld b, $0 ld hl, wd00d add hl, bc - call $7653 + call Func_b653 ld a, [hli] ld h, [hl] ld l, a @@ -2893,19 +2945,19 @@ Func_ba04: ; ba04 (2:7a04) ld e, l ld a, [hl] pop hl - call $7644 + call Func_b644 or a jr z, .asm_ba40 ld a, $1 call PlaySFXConfirmOrCancel - call $7653 + call Func_b653 call Func_8e1f - call $7644 + call Func_b644 ld a, [wd087] ld [wcea1], a - call $7b97 + call Func_bb97 ld a, [wd086] - jp $7a25 + jp Func_ba25 .asm_baa3 call DrawCursor2 @@ -2915,21 +2967,22 @@ Func_ba04: ; ba04 (2:7a04) ld [wd086], a ldh a, [hCurMenuItem] cp $ff - jp z, $7b0d + jp z, .asm_bb0d ld [wd088], a call ResetCheckMenuCursorPositionAndBlink xor a ld [wce5e], a call DrawWideTextBox - ld hl, $7b76 + ld hl, Data_bb76 call PlaceTextItems +.asm_bacc call DoFrame - call $46ac - jp nc, $7acc + call HandleCheckMenuInput_YourOrOppPlayArea + jp nc, .asm_bacc cp $ff jr nz, .asm_badf ld a, [wd086] - jp $7a25 + jp Func_ba25 .asm_badf ld a, [wCheckMenuCursorYPosition] @@ -2938,20 +2991,21 @@ Func_ba04: ; ba04 (2:7a04) add [hl] or a jr nz, .asm_bb09 - call $7653 - call $77c6 - call $7644 + call Func_b653 + call Func_b7c6 + call Func_b644 ld a, [wd086] - jp nc, $7a25 + jp nc, Func_ba25 ld a, [wd087] ld [wcea1], a - call $7b97 + call Func_bb97 ld a, [wd086] - jp $7a25 + jp Func_ba25 .asm_bb09 cp $1 jr nz, .asm_bb12 +.asm_bb0d xor a ld [wd0a4], a ret @@ -2979,7 +3033,7 @@ Func_ba04: ; ba04 (2:7a04) ld a, [hl] ld [bc], a pop hl - call $7653 + call Func_b653 ld a, [hli] ld h, [hl] ld l, a @@ -2990,20 +3044,29 @@ Func_ba04: ; ba04 (2:7a04) ld e, l ld a, [hl] pop hl - call $7644 + call Func_b644 or a - jp z, $7a40 + jp z, .asm_ba40 ld a, $1 call PlaySFXConfirmOrCancel - call $7653 + call Func_b653 xor a - call $6dfe - call $7644 + call Func_adfe + call Func_b644 ld a, [wd087] ld [wcea1], a - call $7b97 + call Func_bb97 ld a, [wd086] - jp $7a25 -; 0xbb6e + jp Func_ba25 + +Func_bb6e: ; bb6e (2:7b6e) + INCROM $bb6e, $bb76 + +Data_bb76: ; bb76 (2:7b76) + INCROM $bb76, $bb83 + +Data_bb83: ; bb83 (2:7b83) + INCROM $bb83, $bb97 - INCROM $bb6e, $c000 +Func_bb97: ; bb97 (2:7b97) + INCROM $bb97, $c000 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index b162dc6..f779482 100755 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -468,7 +468,16 @@ Func_c36a: ; c36a (3:436a) ret ; 0xc37a - INCROM $c37a, $c41c + INCROM $c37a, $c38f + +Func_c38f: ; c38f (3:438f) + INCROM $c38f, $c3ca + +Func_c3ca: ; c3ca (3:43ca) + INCROM $c3ca, $c3ee + +Func_c3ee: ; c3ee (3:43ee) + INCROM $c3ee, $c41c Func_c41c: ; c41c (3:441c) ld a, [wd332] @@ -1068,7 +1077,7 @@ PC_c7ea: ; c7ea (3:47ea) call DoFrameIfLCDEnabled ldtx hl, TurnedPCOnText call PrintScrollableText_NoTextBoxLabel - call $484e + call Func_c84e .asm_c801 ld a, $1 call Func_c29b @@ -1085,9 +1094,9 @@ PC_c7ea: ; c7ea (3:47ea) jr z, .asm_c82f call Func_c2a3 ld a, [wd0b9] - ld hl, $4846 + ld hl, Unknown_c846 call JumpToFunctionInTable - ld hl, $484e + ld hl, Func_c84e call Func_c32b jr .asm_c801 .asm_c82f @@ -1100,9 +1109,12 @@ PC_c7ea: ; c7ea (3:47ea) ld [wd112], a call Func_39fc ret -; 0xc846 - INCROM $c846, $c891 +Unknown_c846: ; c846 (3:4846) + INCROM $c846, $c84e + +Func_c84e: ; c84e (3:484e) + INCROM $c84e, $c891 Func_c891: ; c891 (3:4891) push hl @@ -1158,7 +1170,7 @@ Func_c8ba: ; c8ba (3:48ba) call Func_c241 call Func_c915 call DoFrameIfLCDEnabled - call $2c62 + call PrintScrollableText_WithTextBoxLabel ret Func_c8ed: ; c8ed (3:48ed) @@ -1198,7 +1210,7 @@ Func_c915: ; c915 (3:4915) ld de, $000c ld bc, $1406 call AdjustCoordinatesForBGScroll - call $43ca + call Func_c3ca pop de pop bc ret @@ -2546,11 +2558,11 @@ Func_d103: ; d103 (3:5103) ld [wTempNPC], a call FindLoadedNPC jr c, .asm_d119 - call $54d1 + call ScriptCommand_JumpIfFlagNonzero2.passTryJump jr .asm_d11c .asm_d119 - call $54e6 + call ScriptCommand_JumpIfFlagZero2.fail .asm_d11c pop af @@ -2643,7 +2655,7 @@ Func_d1b3: ; d1b3 (3:51b3) ; fallthrough .asm_d1c3 - ld hl, $51dc + ld hl, Unknown_d1dc asm_d1c6: ld e, a add a @@ -2659,6 +2671,7 @@ asm_d1c6: ld [wTxRam2 + 1], a jp IncreaseScriptPointerBy1 +Unknown_d1dc: ; d1dc (3:51dc) INCROM $d1dc, $d209 Func_d209: ; d209 (3:5209) @@ -2748,7 +2761,7 @@ ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) 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 - dw $d693 ; ram location to return result into + dw wd693 ; ram location to return result into dw .text_entries ; location of table containing text entries .text_entries @@ -3493,7 +3506,32 @@ Script_d932: ; d932 (3:5932) quit_script_fully ; 0xd93f - INCROM $d93f, $dadd +Script_d93f: ; d93f (3:593f) + INCROM $d93f, $d995 + +Script_d995: ; d995 (3:5995) + INCROM $d995, $d9c2 + +Script_d9c2: ; d9c2 (3:59c2) + INCROM $d9c2, $d9ef + +Script_d9ef: ; d9ef (3:59ef) + INCROM $d9ef, $da1c + +Script_da1c: ; da1c (3:5a1c) + INCROM $da1c, $da49 + +Script_da49: ; da49 (3:5a49) + INCROM $da49, $da76 + +Script_da76: ; da76 (3:5a76) + INCROM $da76, $daa3 + +Script_daa3: ; daa3 (3:5aa3) + INCROM $daa3, $dad0 + +Script_dad0: ; dad0 (3:5ad0) + INCROM $dad0, $dadd Preload_NikkiInIshiharasHouse: ; dadd (3:5add) get_flag_value EVENT_FLAG_35 @@ -4637,7 +4675,7 @@ TryFirstRonaldEncounter: ; e813 (3:6813) TryFirstRonaldFight: ; e822 (3:6822) ld a, NPC_RONALD2 - ld [$d3ab], a + ld [wTempNPC], a call FindLoadedNPC ret c get_flag_value EVENT_FLAG_4C @@ -4648,7 +4686,7 @@ TryFirstRonaldFight: ; e822 (3:6822) TrySecondRonaldFight: ; e837 (3:6837) ld a, NPC_RONALD3 - ld [$d3ab], a + ld [wTempNPC], a call FindLoadedNPC ret c get_flag_value EVENT_FLAG_4D @@ -4708,9 +4746,10 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) do_frames $3c move_active_npc NPCMovement_e90d print_text_string Text064a - jump_if_player_coords_match $08, $02, $68d6 + jump_if_player_coords_match $08, $02, .ows_e8d6 set_player_direction WEST move_player WEST, 1 +.ows_e8d6 set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 @@ -5208,7 +5247,7 @@ ChallengeHallLobbyLoadMap: ; f088 (3:7088) ld a, $02 ld [wTempNPC], a call FindLoadedNPC - ld bc, $7166 + ld bc, Script_f166 jp SetNextNPCAndScript Script_Pappy3: ; f09c (3:709c) @@ -5316,7 +5355,10 @@ Unknown_f146: ; f146 (3:7146) INCROM $f146, $f156 Unknown_f156: ; f156 (3:7156) - INCROM $f156, $f239 + INCROM $f156, $f166 + +Script_f166: ; f166 (3:7166) + INCROM $f166, $f239 ChallengeHallAfterDuel: ; f239 (3:7239) ld c, $00 @@ -5808,11 +5850,11 @@ Func_f580: ; f580 (3:7580) ld a, d call Random ld c, a - call $75cc + call Func_f5cc jr c, .asm_f598 - call $75d4 + call Func_f5d4 ld b, $0 - ld hl, $75b3 + ld hl, Unknown_f5b3 add hl, bc ld a, [hl] @@ -5820,16 +5862,22 @@ Func_f580: ; f580 (3:7580) ld [wTempNPC], a ld [wd696], a ret -; 0xf5b3 - INCROM $f5b3, $f5db +Unknown_f5b3: ; f5b3 (3:75b3) + INCROM $f5b3, $f5cc + +Func_f5cc: ; f5cc (3:75cc) + INCROM $f5cc, $f5d4 + +Func_f5d4: ; f5d4 (3:75d4) + INCROM $f5d4, $f5db Func_f5db: ; f5db (3:75db) xor a - ld [$d698], a - ld [$d699], a - ld [$d69a], a - ld [$d69b], a + ld [wd698], a + ld [wd699], a + ld [wd69a], a + ld [wd69b], a ret ; 0xf5e9 @@ -5848,7 +5896,10 @@ Script_f631: ; f631 (3:7631) ret .ows_f63c - INCROM $f63c, $f71f + INCROM $f63c, $f6af + +Script_f6af: ; f6af (3:76af) + INCROM $f6af, $f71f Script_Courtney: ; f71f (3:771f) INCROM $f71f, $f72a @@ -5868,6 +5919,7 @@ HallOfHonorLoadMap: ; fbdb (3:7bdb) ret ; 0xfbe1 +Script_fbe1: ; fbe1 (3:7be1) INCROM $fbe1, $fbf1 Script_fbf1: ; fbf1 (3:7bf1) diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index dc148ad..68570c4 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -28,13 +28,13 @@ Func_10031: ; 10031 (4:4031) push af ld a, $1 call BankswitchSRAM - call $4cbb + call Func_10cbb call DisableSRAM - call $4b28 + call Func_10b28 call FlushAllPalettes call EnableLCD call DoFrameIfLCDEnabled - call $4cea + call Func_10cea call FlushAllPalettes pop af call BankswitchSRAM @@ -45,7 +45,13 @@ Func_10059: ; 10059 (4:4059) INCROM $10059, $100a2 Func_100a2: ; 100a2 (4:40a2) - INCROM $100a2, $1029e + INCROM $100a2, $1010c + +Func_1010c: ; 1010c (4:410c) + INCROM $1010c, $10197 + +Func_10197: ; 10197 (4:4197) + INCROM $10197, $1029e Medal_1029e: ; 1029e (4:429e) sub $8 @@ -59,10 +65,10 @@ Medal_1029e: ; 1029e (4:429e) call PlaySong farcall Func_70000 call DisableLCD - call $4000 + call Func_10000 ld a, $fa ld [wd114], a - call $410c + call Func_1010c pop bc ld a, c add a @@ -74,7 +80,7 @@ Medal_1029e: ; 1029e (4:429e) ld [wTxRam2], a ld a, [hl] ld [wTxRam2 + 1], a - call $4031 + call Func_10031 ld a, MUSIC_MEDAL call PlaySong ld a, $ff @@ -86,7 +92,7 @@ Medal_1029e: ; 1029e (4:429e) ld [wd116], a and $f jr nz, .asm_102e2 - call $4197 + call Func_10197 ld a, [wd116] cp $e0 jr nz, .asm_102e2 @@ -107,25 +113,25 @@ BoosterPack_1031b: ; 1031b (4:431b) push af push bc call DisableLCD - call $4000 + call Func_10000 xor a ld [wTextBoxFrameType], a pop bc push bc ld b, $0 - ld hl, $43a5 + ld hl, Unknown_103a5 add hl, bc ld a, [hl] ld c, a add a add a ld c, a - ld hl, $43c2 + ld hl, Unknown_103c2 add hl, bc ld a, [hli] push hl ld bc, $0600 - call $70ca + call Func_130ca pop hl ld a, [hli] ld [wTxRam3], a @@ -135,7 +141,7 @@ BoosterPack_1031b: ; 1031b (4:431b) ld [wTxRam2], a ld a, [hl] ld [wTxRam2 + 1], a - call $4031 + call Func_10031 call PauseSong ld a, MUSIC_BOOSTER_PACK call PlaySong @@ -166,9 +172,12 @@ BoosterPack_1031b: ; 1031b (4:431b) pop af ld [wd291], a ret -; 0x103a5 - INCROM $103a5, $103d2 +Unknown_103a5: ; 103a5 (4:43a5) + INCROM $103a5, $103c2 + +Unknown_103c2: ; 103c2 (4:43c2) + INCROM $103c2, $103d2 Func_103d2: ; 103d2 (4:43d2) INCROM $103d2, $103d3 @@ -177,7 +186,7 @@ Duel_Init: ; 103d3 (4:43d3) ld a, [wd291] push af call DisableLCD - call $4000 + call Func_10000 ld a, $4 ld [wTextBoxFrameType], a lb de, 0, 12 @@ -188,7 +197,7 @@ Duel_Init: ; 103d3 (4:43d3) add a ld c, a ld b, $0 - ld hl, $445b + ld hl, Unknown_1045b add hl, bc ld a, [hli] ld [wTxRam2], a @@ -199,8 +208,8 @@ Duel_Init: ; 103d3 (4:43d3) ld [wTxRam2_b], a ld a, [wOpponentName + 1] ld [wTxRam2_b + 1], a - ld hl, $4451 - call $51b3 ; LoadDuelistName + ld hl, Unknown_10451 + call Func_111b3 ; LoadDuelistName pop hl ld a, [hli] ld [wTxRam2], a @@ -209,8 +218,8 @@ Duel_Init: ; 103d3 (4:43d3) ld [wTxRam2 + 1], a or c jr z, .asm_10425 - ld hl, $4456 - call $51b3 ; LoadDeckName + ld hl, Unknown_10456 + call Func_111b3 ; LoadDeckName .asm_10425 ld bc, $0703 @@ -218,7 +227,7 @@ Duel_Init: ; 103d3 (4:43d3) call Func_3e2a ; LoadDuelistPortrait ld a, [wMatchStartTheme] call PlaySong - call $4031 + call Func_10031 call DoFrameIfLCDEnabled lb bc, $2f, $1d ; cursor tile, tile behind cursor lb de, 18, 17 ; x, y @@ -229,9 +238,15 @@ Duel_Init: ; 103d3 (4:43d3) pop af ld [wd291], a ret -; 0x10451 - INCROM $10451, $10548 +Unknown_10451: ; 10451 (4:4451) + INCROM $10451, $10456 + +Unknown_10456: ; 10456 (4:4456) + INCROM $10456, $1045b + +Unknown_1045b: ; 1045b (4:445b) + INCROM $1045b, $10548 Func_10548: ; 10548 (4:4548) INCROM $10548, $10756 @@ -284,7 +299,10 @@ Func_10ab4: ; 10ab4 (4:4ab4) INCROM $10ab4, $10af9 Func_10af9: ; 10af9 (4:4af9) - INCROM $10af9, $10c96 + INCROM $10af9, $10b28 + +Func_10b28: ; 10b28 (4:4b28) + INCROM $10b28, $10c96 Func_10c96: ; 10c96 (4:4c96) ldh a, [hBankSRAM] @@ -292,13 +310,13 @@ Func_10c96: ; 10c96 (4:4c96) push bc ld a, $1 call BankswitchSRAM - call $4cbb + call Func_10cbb call Func_10ab4 pop bc ld a, c or a jr nz, .asm_10cb0 - call $4cea + call Func_10cea call Func_10af9 .asm_10cb0 @@ -307,15 +325,18 @@ Func_10c96: ; 10c96 (4:4c96) call BankswitchSRAM call DisableSRAM ret -; 0x10cbb - INCROM $10cbb, $10dba +Func_10cbb: ; 10cbb (4:4cbb) + INCROM $10cbb, $10cea + +Func_10cea: ; 10cea (4:4cea) + INCROM $10cea, $10dba Func_10dba: ; 10dba (4:4dba) ld a, $1 farcall Func_c29b ld a, [wd0ba] - ld hl, $4e17 + ld hl, Unknown_10e17 farcall Func_111e9 .asm_10dca call DoFrameIfLCDEnabled @@ -331,15 +352,18 @@ Func_10dba: ; 10dba (4:4dba) .asm_10ddd ld [wd10e], a push af - ld hl, $4df0 + ld hl, Unknown_10df0 call JumpToFunctionInTable farcall CloseTextBox call DoFrameIfLCDEnabled pop af ret -; 0x10df0 - INCROM $10df0, $10e28 +Unknown_10df0: ; 10df0 (4:4df0) + INCROM $10df0, $10e17 + +Unknown_10e17: ; 10e17 (4:4e17) + INCROM $10e17, $10e28 Func_10e28: ; 10e28 (4:4e28) INCROM $10e28, $10e55 @@ -788,12 +812,15 @@ Func_11184: ; 11184 (4:5184) ld hl, wd341 dec [hl] ret -; 0x111b3 +Func_111b3: ; 111b3 (4:51b3) INCROM $111b3, $111e9 Func_111e9: ; 111e9 (4:51e9) - INCROM $111e9, $1124d + INCROM $111e9, $11238 + +Func_11238: ; 11238 (4:5238) + INCROM $11238, $1124d Func_1124d: ; 1124d (4:524d) INCROM $1124d, $11320 @@ -830,7 +857,7 @@ Func_1157c: ; 1157c (4:557c) ld [wd32e], a .asm_1159f - call $5238 + call Func_11238 ret Func_115a3: ; 115a3 (4:55a3) @@ -1202,7 +1229,7 @@ MainMenu_ContinueFromDiary: ; 12741 (4:6741) farcall Func_70000 call EnableSRAM xor a - ld [$ba44], a + ld [sba44], a call DisableSRAM ld a, GAME_EVENT_OVERWORLD ld [wGameEvent], a @@ -1234,7 +1261,10 @@ MainMenu_ContinueDuel: ; 1277e (4:677e) ret ; 0x1279a - INCROM $1279a, $12871 + INCROM $1279a, $12863 + +Func_12863: ; 12863 (4:6863) + INCROM $12863, $12871 Func_12871: ; 12871 (4:6871) INCROM $12871, $1288c @@ -1357,9 +1387,12 @@ FillNewSpriteAnimBufferEntry: ; 129d9 (4:69d9) pop bc pop hl ret -; 0x129fa - INCROM $129fa, $12a21 +Func_129fa: ; 129fa (4:69fa) + INCROM $129fa, $129fd + +Func_129fd: ; 129fd (4:69fd) + INCROM $129fd, $12a21 HandleAllSpriteAnimations: ; 12a21 (4:6a21) push af @@ -1719,7 +1752,13 @@ Func_12c5e: ; 12c5e (4:6c5e) INCROM $12c5e, $12c7f Func_12c7f: ; 12c7f (4:6c7f) - INCROM $12c7f, $131b3 + INCROM $12c7f, $12fc6 + +Func_12fc6: ; 12fc6 (4:6fc6) + INCROM $12fc6, $130ca + +Func_130ca: ; 130ca (4:70ca) + INCROM $130ca, $131b3 Func_131b3: ; 131b3 (4:71b3) INCROM $131b3, $131d3 @@ -1742,12 +1781,12 @@ Func_1344d: ; 1344d (4:744d) Func_13485: ; 13485 (4:7485) call EnableSRAM - ld a, [$ba68] + ld a, [sba68] or a ret z - ld a, [$ba56] + ld a, [sba56] ld [wTxRam3], a - ld a, [$ba57] + ld a, [sba57] ld [wTxRam3 + 1], a call DisableSRAM call PauseSong diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 8101215..b69d109 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -1076,7 +1076,7 @@ Func_18f9c: ; 18f9c (6:4f9c) ld a, $00 ld [wd4ae], a ld a, $01 - ld [$d4b3], a + ld [wd4b3], a xor a ld [wd4b0], a ld a, [de] @@ -1144,10 +1144,10 @@ Func_19014: ; 19014 (6:5014) ld a, $97 call Func_3b6a ld a, [wce81] - ld [$d4b3], a + ld [wd4b3], a push de ld hl, wce7f - ld de, $d4b1 + ld de, wd4b1 ld a, [hli] ld [de], a inc de @@ -1189,7 +1189,7 @@ Func_19014: ; 19014 (6:5014) Func_19079: ; 19079 (6:5079) ld a, [de] inc de - ld [$d4b3], a + ld [wd4b3], a ld a, [wce82] ld [wd4b0], a call Func_1909d @@ -1207,7 +1207,7 @@ PointerTable_006_508f: ; 1908f (6:508f) dw Func_19013 Func_1909d: ; 1909d (6:509d) - ld a, [$d4b3] + ld a, [wd4b3] cp $04 jr z, .asm_50ad cp $01 @@ -1261,7 +1261,7 @@ Func_1909d: ; 1909d (6:509d) ; this part is not perfectly analyzed. ; needs some fix. - ld a, [$d4b3] + ld a, [wd4b3] cp $04 jr z, Func_190fb.asm_510f Func_190fb: ; 190fb (6:50fb) @@ -1336,25 +1336,25 @@ Func_19168: ; 19168 (6:5168) jr z, .asm_5188 call LoadTxRam3 ld a, [wce81] - ld hl, $003a + ldtx hl, AttackDamageText and $06 ret z - ld hl, $0038 + ldtx hl, WeaknessMoreDamage2Text cp $06 ret z and $02 - ld hl, $0037 + ldtx hl, WeaknessMoreDamageText ret nz - ld hl, $0036 + ldtx hl, ResistanceLessDamageText ret .asm_5188 call CheckNoDamageOrEffect ret c - ld hl, $003b + ldtx hl, NoDamageText ld a, [wce81] and $04 ret z - ld hl, $0039 + ldtx hl, ResistanceNoDamageText ret ; needs analyze. @@ -1679,12 +1679,12 @@ Func_1a6cd: ; 1a6cd (6:66cd) ld hl, $00a3 bank1call DrawWholeScreenTextBox ld a, $0a - ld [$0000], a + ld [MBC3SRamEnable], a xor a ldh [hBankSRAM], a - ld [$4000], a - ld [$a000], a - ld [$0000], a + ld [MBC3SRamBank], a + ld [MBC3RTC], a + ld [MBC3SRamEnable], a jp Reset ret @@ -1707,7 +1707,7 @@ Func_1a73a: ; 1a73a (6:673a) or b jr nz, .asm_6749 ld a, $0a - ld [$0000], a + ld [MBC3SRamEnable], a ld a, e ld [s0a00b], a pop bc @@ -3292,7 +3292,7 @@ Func_1bae4: ; 1bae4 (6:7ae4) push af ld hl, wd088 ld b, [hl] - farcall $2, $7625 + farcall Func_b625 jr c, .asm_7af5 pop af ld [wd0a6], a diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 375a161..800d83b 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -112,7 +112,7 @@ Func_1c461: ; 1c461 (7:4461) ld a, b ld [hli], a ld [hl], c - call $46e3 + call Func_1c6e3 pop bc pop hl ret @@ -214,7 +214,7 @@ Func_1c50a: ; 1c50a (7:450a) ld a, [hl] or a jr z, .asm_1c52c - call $44fa + call Func_1c4fa jr nc, .asm_1c521 xor a ld [wd3b8], a @@ -223,7 +223,7 @@ Func_1c50a: ; 1c50a (7:450a) xor a ld [hli], a ld a, [hl] - farcall $4, $69fd + farcall Func_129fd ld hl, wd349 dec [hl] @@ -337,7 +337,7 @@ Func_1c5e9: ; 1c5e9 (7:45e9) ld l, LOADED_NPC_FIELD_07 call GetItemInLoadedNPCIndex ld a, [hl] - ld bc, $fffd + ld bc, -3 add hl, bc ld [hl], a call Func_1c58e @@ -346,6 +346,7 @@ Func_1c5e9: ; 1c5e9 (7:45e9) ret ; 0x1c5ff +Func_1c5ff: ; 1c5ff (7:45ff) INCROM $1c5ff, $1c610 Func_1c610: ; 1c610 (7:4610) @@ -382,7 +383,7 @@ Func_1c719: ; 1c719 (7:4719) ld b, a ld c, [hl] ld a, $40 - call $3937 + call UpdatePermissionOfMapPosition pop bc pop hl ret @@ -473,12 +474,12 @@ Func_1c78d: ; 1c78d (7:478d) inc hl ld [hl], b dec hl - call $39ea + call Func_39ea cp $f0 jr nc, .asm_1c7bb push af and $7f - call $45ff + call Func_1c5ff pop af bit 7, a jr z, .asm_1c7dc @@ -489,7 +490,7 @@ Func_1c78d: ; 1c78d (7:478d) cp $ff jr z, .asm_1c7d2 inc bc - call $39ea + call Func_39ea push hl ld l, a ld h, $0 @@ -551,8 +552,8 @@ Func_1c83d: ; 1c83d (7:483d) pop bc pop hl ret -; 0x1c858 +Func_1c858: ; 1c858 (7:4858) INCROM $1c858, $1c8bc Func_1c8bc: ; 1c8bc (7:48bc) @@ -598,7 +599,7 @@ Func_1c8ef: ; 1c8ef (7:48ef) ld a, [wTempAnimation] ld [wd4bf], a cp $61 - jp nc, $4b5e ; asm_007_4b5e + jp nc, Func_1cb5e push hl push bc push de @@ -672,7 +673,7 @@ Func_1c94a: ; 1c94a (7:494a) ld [wd4ca], a ld [wd4cb], a ld a, [hli] - farcall $20, $4418 + farcall Func_80418 ld a, [hli] push af @@ -824,7 +825,7 @@ Data_1ca04: macro_1ca04 $2838, $00 macro_1ca04 $2818, $00 -Func_1ca31: ; 1ca31 (7:4a6b) +Func_1ca31: ; 1ca31 (7:4a31) push hl push bc ld a, [wd4ac] @@ -835,10 +836,10 @@ Func_1ca31: ; 1ca31 (7:4a6b) add %00001000 and %01111111 cp b - jp z, .asm_007_4a6b + jp z, .asm_1ca6b ld [hl], a ld b, 0 - ld hl, $d42c + ld hl, wd42c add hl, bc ld a, [wTempAnimation] ld [hli], a @@ -848,15 +849,15 @@ Func_1ca31: ; 1ca31 (7:4a6b) ld [hli], a ld a, [wd4b0] ld [hli], a - ld a, [$d4b1] + ld a, [wd4b1] ld [hli], a - ld a, [$d4b2] + ld a, [wd4b2] ld [hli], a - ld a, [$d4b3] + ld a, [wd4b3] ld [hli], a ld a, [wd4be] ld [hl], a -.asm_007_4a6b +.asm_1ca6b pop bc pop hl ret @@ -878,6 +879,7 @@ Func_1cab3: ; 1cab3 (7:4ab3) pop bc ret +Func_1cac5: ; 1cac5 (7:4ac5) INCROM $1cac5, $1cb18 Func_1cb18: ; 1cb18 (7:4b18) @@ -894,7 +896,7 @@ Func_1cb18: ; 1cb18 (7:4b18) ld [wd4c0], a ld a, [wd42a] cp $ff - call nz, $4cd4 + call nz, Func_1ccd4 ld hl, wAnimationQueue ld c, $07 .asm_1cb3b @@ -903,7 +905,7 @@ Func_1cb18: ; 1cb18 (7:4b18) cp $ff jr z, .asm_1cb4b ld [wWhichSprite], a - farcall $4, $69fa + farcall Func_129fa ld a, $ff ld [hl], a .asm_1cb4b @@ -924,6 +926,7 @@ Func_1cb18: ; 1cb18 (7:4b18) jr .asm_1cb57 ; 0x1cb5e +Func_1cb5e: ; 1cb5e (7:4b5e) INCROM $1cb5e, $1ccbc Func_1ccbc: ; 1ccbc (7:4cbc) @@ -941,6 +944,7 @@ Func_1ccbc: ; 1ccbc (7:4cbc) ret ; 0x1ccd4 +Func_1ccd4: ; 1ccd4 (7:4cd4) INCROM $1ccd4, $1d078 Func_1d078: ; 1d078 (7:5078) @@ -951,8 +955,8 @@ Func_1d078: ; 1d078 (7:5078) ld a, MUSIC_STOP call PlaySong call Func_3ca0 - call $5335 - call $53ce + call Func_1d335 + call Func_1d3ce xor a ld [wd635], a ld a, $3c @@ -960,7 +964,7 @@ Func_1d078: ; 1d078 (7:5078) .asm_1d095 call DoFrameIfLCDEnabled call UpdateRNGSources - call $5614 + call Func_1d614 ld hl, wd635 inc [hl] call AssertSongFinished @@ -984,46 +988,46 @@ Func_1d078: ; 1d078 (7:5078) farcall Func_10ab4 .asm_1d0c7 - call $50fa - call $511c + call Func_1d0fa + call Func_1d11c ld a, [wd628] cp $2 jr nz, .asm_1d0db - call $5289 + call Func_1d289 jr c, Func_1d078 jr .asm_1d0e7 .asm_1d0db ld a, [wd628] cp $1 jr nz, .asm_1d0e7 - call $52b8 + call Func_1d2b8 jr c, Func_1d078 .asm_1d0e7 ld a, [wd628] cp $0 jr nz, .asm_1d0f3 - call $52dd + call Func_1d2dd jr c, Func_1d078 .asm_1d0f3 call ResetDoFrameFunction call Func_3ca0 ret -; 0x1d0fa +Func_1d0fa: ; 1d0fa (7:50fa) INCROM $1d0fa, $1d11c Func_1d11c: ; 1d11c (7:511c) ld a, MUSIC_PC_MAIN_MENU call PlaySong call DisableLCD - farcall $4, $4000 + farcall Func_10000 lb de, $30, $8f call SetupText call Func_3ca0 xor a ld [wLineSeparation], a - call $51e1 - call $517f + call Func_1d1e1 + call Func_1d17f ld a, $ff ld [wd626], a ld a, [wd627] @@ -1036,13 +1040,13 @@ Func_1d11c: ; 1d11c (7:511c) .asm_1d14f ld hl, wd636 farcall Func_111e9 - farcall $4, $4031 + farcall Func_10031 .asm_1d15a call DoFrameIfLCDEnabled call UpdateRNGSources call HandleMenuInput push af - call $51e9 + call Func_1d1e9 pop af jr nc, .asm_1d15a ldh a, [hCurMenuItem] @@ -1058,12 +1062,30 @@ Func_1d11c: ; 1d11c (7:511c) ld a, e ld [wd628], a ret -; 0x1d17f - INCROM $1d17f, $1d306 +Func_1d17f: ; 1d17f (7:517f) + INCROM $1d17f, $1d1e1 + +Func_1d1e1: ; 1d1e1 (7:51e1) + INCROM $1d1e1, $1d1e9 + +Func_1d1e9: ; 1d1e9 (7:51e9) + INCROM $1d1e9, $1d289 + +Func_1d289: ; 1d289 (7:5289) + INCROM $1d289, $1d2b8 + +Func_1d2b8: ; 1d2b8 (7:52b8) + INCROM $1d2b8, $1d2dd + +Func_1d2dd: ; 1d2dd (7:52dd) + INCROM $1d2dd, $1d306 Func_1d306: ; 1d306 (7:5306) - INCROM $1d306, $1d386 + INCROM $1d306, $1d335 + +Func_1d335: ; 1d335 (7:5335) + INCROM $1d335, $1d386 Titlescreen_1d386: ; 1d386 (7:5386) call AssertSongFinished @@ -1083,7 +1105,10 @@ Titlescreen_1d386: ; 1d386 (7:5386) ret Func_1d3a9: ; 1d3a9 (7:53a9) - INCROM $1d3a9, $1d42e + INCROM $1d3a9, $1d3ce + +Func_1d3ce: ; 1d3ce (7:53ce) + INCROM $1d3ce, $1d42e Func_1d42e: ; 1d42e (7:542e) INCROM $1d42e, $1d519 @@ -1099,35 +1124,38 @@ Titlescreen_1d519: ; 1d519 (7:5519) INCROM $1d523, $1d59c Func_1d59c: ; 1d59c (7:559c) - INCROM $1d59c, $1d6ad + INCROM $1d59c, $1d614 + +Func_1d614: ; 1d614 (7:5614) + INCROM $1d614, $1d6ad Credits_1d6ad: ; 1d6ad (7:56ad) ld a, MUSIC_STOP call PlaySong - call $5705 - call $4858 + call Func_1d705 + call Func_1c858 xor a ld [wd324], a ld a, MUSIC_CREDITS call PlaySong - farcall $4, $4031 - call $57fc + farcall Func_10031 + call Func_1d7fc .asm_1d6c8 call DoFrameIfLCDEnabled - call $5765 - call $580b + call Func_1d765 + call Func_1d80b ld a, [wd633] cp $ff jr nz, .asm_1d6c8 call WaitForSongToFinish ld a, $8 - farcall $4, $6863 + farcall Func_12863 ld a, MUSIC_STOP call PlaySong farcall Func_10ab4 call Func_3ca4 call Set_WD_off - call $5758 + call Func_1d758 call EnableLCD call DoFrameIfLCDEnabled call DisableLCD @@ -1135,6 +1163,18 @@ Credits_1d6ad: ; 1d6ad (7:56ad) set 1, [hl] call ResetDoFrameFunction ret -; 0x1d705 - INCROM $1d705, $1e1c4 +Func_1d705: ; 1d705 (7:5705) + INCROM $1d705, $1d758 + +Func_1d758: ; 1d758 (7:5758) + INCROM $1d758, $1d765 + +Func_1d765: ; 1d765 (7:5765) + INCROM $1d765, $1d7fc + +Func_1d7fc: ; 1d7fc (7:57fc) + INCROM $1d7fc, $1d80b + +Func_1d80b: ; 1d80b (7:580b) + INCROM $1d80b, $1e1c4 diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm index 14292f9..ab74d7b 100644 --- a/src/engine/bank20.asm +++ b/src/engine/bank20.asm @@ -5,9 +5,9 @@ Func_80028: ; 80028 (20:4028) call Func_801f1 ld bc, $0000 call Func_80077 - farcall $3, $49c7 - call $41a1 - farcall $3, $43ee + farcall Func_c9c7 + call Func_801a1 + farcall Func_c3ee ret ; 0x8003d @@ -16,12 +16,12 @@ Func_80028: ; 80028 (20:4028) Func_80077: ; 80077 (20:4077) ld a, $1 ld [wd292], a - jr .asm_80082 + jr Func_80082 xor a ld [wd292], a -.asm_80082 +Func_80082: ; 80082 (20:4082) push hl push bc push de @@ -78,7 +78,7 @@ Func_800bd: ; 800bd (20:40bd) Func_800e0: ; 800e0 (20:40e0) push hl - ld hl, $d28e + ld hl, wd28e ld a, [wd12f] ld [hl], a ld a, [wd23c] @@ -99,7 +99,7 @@ Func_800e0: ; 800e0 (20:40e0) push bc push de ld b, $00 - ld a, [$d28e] + ld a, [wd28e] ld c, a ld de, wd23e call Func_3be4 @@ -138,17 +138,17 @@ Func_800e0: ; 800e0 (20:40e0) ret Func_80148: ; 80148 (20:4148) - ld a, [$d291] + ld a, [wd291] or a ret z - ld a, [$d23c] + ld a, [wd23c] or a jr z, .asm_80162 push hl push bc .asm_80155 push bc - ld a, [$d291] + ld a, [wd291] add [hl] ld [hli], a pop bc @@ -160,7 +160,7 @@ Func_80148: ; 80148 (20:4148) .asm_80162 push hl push bc - ld a, [$d291] + ld a, [wd291] .asm_80167 ld [hli], a dec b @@ -394,7 +394,7 @@ Func_803b9: ; 803b9 (20:43b9) call GetMapDataPointer call LoadGraphicsPointerFromHL ld a, [hl] - ld [$d239], a + ld [wd239], a ret ; 0x803c9 @@ -418,9 +418,9 @@ Func_80b89: ; 80b89 (20:4b89) push af ld c, a ld a, $01 - ld [$d292], a + ld [wd292], a ld b, $00 - ld hl, $d323 + ld hl, wd323 add hl, bc ld a, [hl] or a @@ -466,7 +466,7 @@ Func_80baa: ; 80baa (20:4baa) add a ld c, a ld b, $0 - ld hl, $4c21 + ld hl, Unknown_80c21 add hl, bc ld a, [hli] ld h, [hl] @@ -484,7 +484,7 @@ Func_80baa: ; 80baa (20:4baa) ld a, [hl] ld [wd131], a push bc - farcall $20, $4082 + farcall Func_80082 pop bc srl b ld a, c @@ -496,7 +496,7 @@ Func_80baa: ; 80baa (20:4baa) ld b, $0 ld hl, wBoosterViableCardList add hl, bc - farcall $3, $438f + farcall Func_c38f pop af ld [wd23b], a pop af @@ -513,8 +513,8 @@ Func_80baa: ; 80baa (20:4baa) pop bc pop hl ret -; 0x80c21 +Unknown_80c21: ; 80c21 (20:4c21) INCROM $80c21, $80e5a SpriteNullAnimationPointer: ; 80e5a (20:4e5a) diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index b381661..0fc94d4 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -877,7 +877,7 @@ HandleDefendingPokemonAttackSelection: ; 2c391 (b:4391) db 2 ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; 0x2c3fc ; loads in hl the pointer to attack's name. @@ -1244,7 +1244,7 @@ HandleColorChangeScreen: ; 2c588 (b:4588) db MAX_PLAY_AREA_POKEMON ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; 0x2c5be .DrawScreen: ; 2c5be (b:45be) @@ -1444,7 +1444,7 @@ PlayAreaSelectionMenuParameters: ; 2c6e0 (b:46e0) db MAX_PLAY_AREA_POKEMON ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; 0x2c6e8 BenchSelectionMenuParameters: ; 2c6e8 (b:46e8) @@ -1453,7 +1453,7 @@ BenchSelectionMenuParameters: ; 2c6e8 (b:46e8) db MAX_PLAY_AREA_POKEMON ; number of items db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; 0x2c6f0 SpitPoison_AIEffect: ; 2c6f0 (b:46f0) diff --git a/src/engine/home.asm b/src/engine/home.asm index 9649f69..1ba64dd 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -7983,7 +7983,7 @@ NarrowTextBoxMenuParameters: ; 2a96 (0:2a96) db 1 ; number of items db SYM_CURSOR_D ; cursor tile number db SYM_BOX_BOTTOM ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; draw a 20x6 text box aligned to the bottom of the screen DrawWideTextBox: ; 2a9e (0:2a9e) @@ -8020,7 +8020,7 @@ WideTextBoxMenuParameters: ; 2ac8 (0:2ac8) db 1 ; number of items db SYM_CURSOR_D ; cursor tile number db SYM_BOX_BOTTOM ; tile behind cursor - dw $0000 ; function pointer if non-0 + dw NULL ; function pointer if non-0 ; display a two-item horizontal menu with custom text provided in hl and handle input TwoItemHorizontalMenu: ; 2ad0 (0:2ad0) @@ -8793,7 +8793,7 @@ LoadTxRam3: ; 2ec4 (0:2ec4) ; load data of card with text id of name at de to wLoadedCard1 LoadCardDataToBuffer1_FromName: ; 2ecd (0:2ecd) - ld hl, CardPointers + 2 ; skip first $0000 pointer + ld hl, CardPointers + 2 ; skip first NULL pointer ld a, BANK(CardPointers) call BankpushROM2 .find_card_loop @@ -9051,7 +9051,7 @@ CheckMatchingCommand: ; 2ffe (0:2ffe) ld a, l or h jr nz, .not_null_pointer - ; return carry if pointer is $0000 + ; return carry if pointer is NULL scf ret @@ -10639,7 +10639,7 @@ GameEvent_Duel: ; 38c0 (0:38c0) ld [wd112], a call EnableSRAM xor a - ld [$ba44], a + ld [sba44], a call DisableSRAM call Func_3a3b bank1call StartDuel @@ -10652,7 +10652,7 @@ GameEvent_ChallengeMachine: ; 38db (0:38db) call Func_39fc call EnableSRAM xor a - ld [$ba44], a + ld [sba44], a call DisableSRAM .asm_38ed farcall Func_131d3 @@ -10667,7 +10667,7 @@ GameEvent_ContinueDuel: ; 38fb (0:38fb) ld [wd112], a bank1call TryContinueDuel call EnableSRAM - ld a, [$ba44] + ld a, [sba44] call DisableSRAM cp $ff jr z, GameEvent_ChallengeMachine.asm_38ed @@ -11059,9 +11059,9 @@ RunOverworldScript: ; 3aed (0:3aed) Func_3b11: ; 3b11 (0:3b11) ldh a, [hBankROM] push af - ld a, $04 + ld a, BANK(_GameLoop) call BankswitchROM - call $66d1 + call _GameLoop pop af call BankswitchROM ret @@ -11123,7 +11123,7 @@ Func_3b6a: ; 3b6a (0:3b6a) push hl push bc push de - ld a, $07 + ld a, BANK(Func_1ca31) ; BANK(Func_1c8ef) call BankswitchROM ld a, [wTempAnimation] cp $61 @@ -11135,10 +11135,10 @@ Func_3b6a: ; 3b6a (0:3b6a) call CheckAnyAnimationPlaying jr nc, .asm_3b95 .asm_3b90 - call $4a31 + call Func_1ca31 jr .asm_3b9a .asm_3b95 - call $48ef + call Func_1c8ef jr .asm_3b9a .asm_3b9a pop de @@ -11151,9 +11151,9 @@ Func_3b6a: ; 3b6a (0:3b6a) Func_3ba2: ; 3ba2 (0:3ba2) ldh a, [hBankROM] push af - ld a, $07 + ld a, BANK(Func_1cac5) call BankswitchROM - call $4ac5 + call Func_1cac5 call Func_3cb4 pop af call BankswitchROM @@ -11184,7 +11184,7 @@ SetDoFrameFunction: ; 3bd2 (0:3bd2) ResetDoFrameFunction: ; 3bdb (0:3bdb) push hl - ld hl, $0000 + ld hl, NULL call SetDoFrameFunction pop hl ret @@ -11617,9 +11617,9 @@ Func_3e17: ; 3e17 (0:3e17) ld [wd131], a ldh a, [hBankROM] push af - ld a, $4 + ld a, BANK(Func_12fc6) call BankswitchROM - call $6fc6 + call Func_12fc6 pop af call BankswitchROM ret @@ -11634,9 +11634,9 @@ Func_3e31: ; 3e31 (0:3e31) ldh a, [hBankROM] push af call Func_3cb4 - ld a, $20 + ld a, BANK(Func_804d8) call BankswitchROM - call $44d8 + call Func_804d8 pop af call BankswitchROM ret diff --git a/src/sram.asm b/src/sram.asm index f9c1a9e..6ad3cdd 100644 --- a/src/sram.asm +++ b/src/sram.asm @@ -66,6 +66,32 @@ s0a3f8:: ; a3f8 sCurrentlySelectedDeck:: ; b700 ds $1 +sb701:: ; b701 + ds $1 + + ds $1 + +sb703:: ; b703 + ds $1 + + ds $340 + +sba44:: ; ba44 + ds $1 + + ds $11 + +sba56:: ; ba56 + ds $1 + +sba57:: ; ba57 + ds $1 + + ds $10 + +sba68:: ; ba68 + ds $1 + SECTION "SRAM1", SRAM SECTION "SRAM2", SRAM diff --git a/src/text/text1.asm b/src/text/text1.asm index 93c389f..931a98d 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -222,12 +222,12 @@ ResistanceLessDamageText: ; 365e1 (d:65e1) line " damage due to Resistance!" done -Text0037: ; 36609 (d:6609) +WeaknessMoreDamageText: ; 36609 (d:6609) text " received" line " damage due to Weakness!" done -Text0038: ; 3662f (d:662f) +WeaknessMoreDamage2Text: ; 3662f (d:662f) text " received" line " damage due to Weakness!" done diff --git a/src/text/text3.asm b/src/text/text3.asm index 18b329e..dd18539 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -21,7 +21,7 @@ Text0271: ; 3c082 (f:4082) text "Dismantled the Deck." done -Text0272: ; 3c098 (f:4098) +OKIfFileDeletedText: ; 3c098 (f:4098) text "OK if this file is deleted?" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 0d2ca4d..a061dc9 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -56,8 +56,8 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0034 ; 0x0034 textpointer PokemonsAttackText ; 0x0035 textpointer ResistanceLessDamageText ; 0x0036 - textpointer Text0037 ; 0x0037 - textpointer Text0038 ; 0x0038 + textpointer WeaknessMoreDamageText ; 0x0037 + textpointer WeaknessMoreDamage2Text ; 0x0038 textpointer ResistanceNoDamageText ; 0x0039 textpointer AttackDamageText ; 0x003a textpointer NoDamageText ; 0x003b @@ -627,7 +627,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text026f ; 0x026f textpointer Text0270 ; 0x0270 textpointer Text0271 ; 0x0271 - textpointer Text0272 ; 0x0272 + textpointer OKIfFileDeletedText ; 0x0272 textpointer Text0273 ; 0x0273 textpointer Text0274 ; 0x0274 textpointer Text0275 ; 0x0275 diff --git a/src/wram.asm b/src/wram.asm index 3189288..109f1d4 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -404,7 +404,10 @@ wDuelTempList:: ; c510 ; this is kept updated with some default text that is used ; when the text printing functions are called with text id $0000 wDefaultText:: ; c590 - ds $70 + ds $2 + +wc592:: ; c592 + ds $6e SECTION "WRAM0 Text Engine", WRAM0 @@ -1619,6 +1622,7 @@ wce53:: ; ce53 wDuelInitialPrizesUpperBitsSet:: ; ce55 ds $1 +wce56:: ; ce56 ds $1 ; it's used for restore the position of cursor @@ -1635,7 +1639,10 @@ wInPlayAreaTemporaryPosition:: ; ce58 wce59:: ; ce59 ds $1 - ds $3 + ds $2 + +wce5c:: ; ce5c + ds $1 ; stores whether there are Pokemon in play area ; player arena Pokemon sets bit 0 @@ -1927,7 +1934,7 @@ wd0a5:: ; d0a5 wd0a6:: ; d0a6 ds $1 -dw0a7:: ; d0a7 +wd0a7:: ; d0a7 ds $2 wd0a9:: ; d0a9 @@ -2112,6 +2119,7 @@ wd237:: ; d237 wd238:: ; d238 ds $1 +wd239:: ; d239 ds $1 wd23a:: ; d23a @@ -2129,7 +2137,10 @@ wd23d:: ; d23d wd23e:: ; d23e ds $1 - ds $50 + ds $4f + +wd28e:: ; d28e + ds $1 wd28f:: ; d28f ds $1 @@ -2354,6 +2365,7 @@ wd42a:: ; d42a wd42b:: ; d42b ds $1 +wd42c:: ; d42c ds $80 wd4ac:: ; d4ac @@ -2639,7 +2651,19 @@ wd696:: ; d696 wd697:: ; d697 ds $1 - ds $6e8 +wd698:: ; d698 + ds $1 + +wd699:: ; d699 + ds $1 + +wd69a:: ; d69a + ds $1 + +wd69b:: ; d69b + ds $1 + + ds $6e4 SECTION "WRAM1 Audio", WRAMX -- cgit v1.2.3 From ebad4c7215bb79f59b40bd65696bdd33cda3ece3 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 3 Jan 2021 23:42:29 -0600 Subject: Fix file modes --- src/engine/bank03.asm | 0 src/macros/scripts.asm | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/engine/bank03.asm mode change 100755 => 100644 src/macros/scripts.asm diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm old mode 100755 new mode 100644 diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm old mode 100755 new mode 100644 -- cgit v1.2.3 From ba3682f2b28ed62a2541ff98caa24afb328deeda Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 5 Jan 2021 19:03:12 -0600 Subject: Add more labels for map/npc scripts --- src/data/map_scripts.asm | 28 +- src/data/npc_map_data.asm | 104 +++---- src/data/npcs.asm | 4 +- src/engine/bank03.asm | 697 ++++++++++++++++++++++++++++++++++++---------- 4 files changed, 620 insertions(+), 213 deletions(-) diff --git a/src/data/map_scripts.asm b/src/data/map_scripts.asm index ff4e608..0ee337d 100644 --- a/src/data/map_scripts.asm +++ b/src/data/map_scripts.asm @@ -38,9 +38,9 @@ MapScripts: ; 1162a (4:562a) dw DeckMachineRoomObjects dw NULL dw NULL - dw $589f + dw DeckMachineRoomAfterDuel dw NULL - dw $58ad + dw DeckMachineRoomCloseTextBox ; ISHIHARAS_HOUSE dw IshiharasHouseNPCS @@ -108,7 +108,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw NULL dw NULL - dw $5fd6 + dw RockClubAfterDuel dw NULL dw NULL @@ -168,7 +168,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw NULL dw NULL - dw $63e8 + dw LightningClubAfterDuel dw NULL dw NULL @@ -198,7 +198,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw NULL dw NULL - dw $66e7 + dw GrassClubAfterDuel dw NULL dw NULL @@ -217,7 +217,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw PsychicClubLobbyObjects dw NULL - dw $6971 + dw PsychicClubLobbyLoadMap dw PsychicClubLobbyAfterDuel dw NULL dw NULL @@ -228,7 +228,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw NULL dw NULL - dw $6a46 + dw PsychicClubAfterDuel dw NULL dw NULL @@ -258,7 +258,7 @@ MapScripts: ; 1162a (4:562a) dw NULL dw NULL dw NULL - dw $6bf1 + dw ScienceClubAfterDuel dw NULL dw NULL @@ -327,20 +327,20 @@ MapScripts: ; 1162a (4:562a) dw NULL dw PokemonDomeEntranceObjects dw NULL - dw $7607 + dw PokemonDomeEntranceLoadMap dw NULL dw NULL - dw $762a + dw PokemonDomeEntranceCloseTextBox ; POKEMON_DOME dw PokemonDomeNPCS dw NULL dw NULL dw NULL - dw $7706 - dw $76e0 - dw $76c6 - dw $7718 + dw PokemonDomeLoadMap + dw PokemonDomeAfterDuel + dw PokemonDomeMovePlayer + dw PokemonDomeCloseTextBox ; HALL_OF_HONOR dw HallOfHonorNPCS diff --git a/src/data/npc_map_data.asm b/src/data/npc_map_data.asm index bf26269..adcbee2 100644 --- a/src/data/npc_map_data.asm +++ b/src/data/npc_map_data.asm @@ -4,9 +4,9 @@ ; pre-load function. (Resets c flag if NPC should not be loaded) MasonLabNPCS: ; 772f (4:1372f) db NPC_DRMASON, $0e, $06, SOUTH - dw $5710 + dw Preload_DrMason db NPC_SAM, $04, $0e, EAST - dw $5604 + dw Preload_Sam db NPC_TECH1, $16, $08, WEST dw NULL db NPC_TECH2, $16, $14, SOUTH @@ -16,7 +16,7 @@ MasonLabNPCS: ; 772f (4:1372f) db NPC_TECH4, $0a, $16, EAST dw NULL db NPC_TECH5, $06, $04, SOUTH - dw $55eb + dw Preload_Tech5 db $00 DeckMachineRoomNPCS: ; 775a (4:1375a) @@ -43,24 +43,24 @@ FightingClubEntranceNPCS: ; 7786 (4:13786) db NPC_CLERK1, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 FightingClubLobbyNPCS: ; 779f (4:1379f) db NPC_MAN1, $0c, $0e, WEST dw NULL db NPC_IMAKUNI, $12, $02, NORTH - dw $5ceb + dw Preload_ImakuniInFightingClubLobby db NPC_SPECS1, $12, $10, EAST dw NULL db NPC_BUTCH, $14, $10, WEST dw NULL db NPC_GRANNY1, $04, $10, WEST - dw $5d98 + dw Preload_Granny1 db NPC_CLERK10, $06, $04, SOUTH dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH @@ -69,11 +69,11 @@ FightingClubLobbyNPCS: ; 779f (4:1379f) FightingClubNPCS: ; 77ca (4:137ca) db NPC_CHRIS, $04, $08, SOUTH - dw $5e43 + dw Preload_ChrisInFightingClub db NPC_MICHAEL, $0e, $0a, SOUTH - dw $5e79 + dw Preload_MichaelInFightingClub db NPC_JESSICA, $12, $06, EAST - dw $5ea5 + dw Preload_JessicaInFightingClub db NPC_MITCH, $0a, $04, SOUTH dw NULL db $00 @@ -82,16 +82,16 @@ RockClubEntranceNPCS: ; 77e3 (4:137e3) db NPC_CLERK2, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 RockClubLobbyNPCS: ; 77fc (4:137fc) db NPC_CHRIS, $12, $08, WEST - dw $5ee9 + dw Preload_ChrisInRockClubLobby db NPC_MATTHEW, $06, $0e, EAST dw NULL db NPC_WOMAN1, $14, $12, NORTH @@ -99,7 +99,7 @@ RockClubLobbyNPCS: ; 77fc (4:137fc) db NPC_CHAP1, $0e, $10, EAST dw NULL db NPC_LASS3, $10, $04, SOUTH - dw $5fcb + dw Preload_Lass3 db NPC_CLERK10, $06, $04, SOUTH dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH @@ -119,11 +119,11 @@ WaterClubEntranceNPCS: ; 783a (4:1383a) db NPC_CLERK3, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 WaterClubLobbyNPCS: ; 7853 (4:13853) @@ -134,7 +134,7 @@ WaterClubLobbyNPCS: ; 7853 (4:13853) db NPC_IMAKUNI, $12, $02, NORTH dw Preload_ImakuniInWaterClubLobby db NPC_MAN2, $04, $12, EAST - dw Preload_Man2InWaterClubLobby + dw Preload_Man2 db NPC_PAPPY2, $16, $10, NORTH dw NULL db NPC_CLERK10, $06, $04, SOUTH @@ -158,18 +158,18 @@ LightningClubEntranceNPCS: ; 7897 (4:13897) db NPC_CLERK4, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 LightningClubLobbyNPCS: ; 78b0 (4:138b0) db NPC_CHAP2, $12, $10, WEST dw NULL db NPC_IMAKUNI, $12, $02, NORTH - dw $637b + dw Preload_ImakuniInLightningClubLobby db NPC_LASS4, $08, $0c, SOUTH dw NULL db NPC_HOOD1, $14, $08, SOUTH @@ -188,20 +188,20 @@ LightningClubNPCS: ; 78d5 (4:138d5) db NPC_BRANDON, $16, $0c, NORTH dw NULL db NPC_ISAAC, $0c, $04, NORTH - dw $6494 + dw Preload_Isaac db $00 GrassClubEntranceNPCS: ; 78ee (4:138ee) db NPC_CLERK5, $06, $02, SOUTH dw NULL db NPC_MICHAEL, $0e, $08, SOUTH - dw $656a + dw Preload_MichaelInGrassClubEntrance db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 GrassClubLobbyNPCS: ; 790d (4:1390d) @@ -212,7 +212,7 @@ GrassClubLobbyNPCS: ; 790d (4:1390d) db NPC_GRANNY2, $04, $10, EAST dw NULL db NPC_GAL2, $14, $10, NORTH - dw $66dc + dw Preload_Gal2 db NPC_CLERK10, $06, $04, SOUTH dw NULL db NPC_GIFT_CENTER_CLERK, $0a, $04, SOUTH @@ -225,18 +225,18 @@ GrassClubNPCS: ; 7932 (4:13932) db NPC_HEATHER, $0e, $10, SOUTH dw NULL db NPC_NIKKI, $0c, $04, SOUTH - dw $6796 + dw Preload_NikkiInGrassClub db $00 PsychicClubEntranceNPCS: ; 7945 (4:13945) db NPC_CLERK6, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db NPC_LAD3, $0e, $04, SOUTH dw NULL db $00 @@ -247,7 +247,7 @@ PsychicClubLobbyNPCS: ; 7964 (4:13964) db NPC_PAPPY1, $04, $10, EAST dw NULL db NPC_RONALD1, $0c, $0a, EAST - dw $69f7 + dw Preload_Ronald1InPsychicClubLobby db NPC_GAL3, $10, $0e, WEST dw NULL db NPC_CHAP4, $18, $10, SOUTH @@ -264,27 +264,27 @@ PsychicClubNPCS: ; 798f (4:1398f) db NPC_STEPHANIE, $16, $0c, EAST dw NULL db NPC_MURRAY2, $02, $02, WEST - dw $6ad0 + dw Preload_Murray2 db NPC_MURRAY1, $0c, $06, SOUTH - dw $6ada + dw Preload_Murray1 db $00 ScienceClubEntranceNPCS: ; 79a8 (4:139a8) db NPC_CLERK7, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 ScienceClubLobbyNPCS: ; 79c1 (4:139c1) db NPC_LAD1, $12, $12, NORTH dw NULL db NPC_IMAKUNI, $12, $02, NORTH - dw $6b65 + dw Preload_ImakuniInScienceClubLobby db NPC_MAN3, $04, $0e, WEST dw NULL db NPC_SPECS2, $0c, $0e, WEST @@ -299,7 +299,7 @@ ScienceClubLobbyNPCS: ; 79c1 (4:139c1) ScienceClubNPCS: ; 79ec (4:139ec) db NPC_JOSEPH, $08, $0a, SOUTH - dw $6cc4 + dw Preload_Joseph db NPC_DAVID, $14, $04, NORTH dw NULL db NPC_ERIK, $06, $12, SOUTH @@ -312,18 +312,18 @@ FireClubEntranceNPCS: ; 7a05 (4:13a05) db NPC_CLERK8, $06, $02, SOUTH dw NULL db NPC_RONALD1, $08, $fe, SOUTH - dw $685b + dw Preload_Ronald1InClubEntrance db NPC_RONALD2, $fe, $08, NORTH - dw $689a + dw Preload_Ronald2InClubEntrance db NPC_RONALD3, $fe, $08, NORTH - dw $6915 + dw Preload_Ronald3InClubEntrance db $00 FireClubLobbyNPCS: ; 7a1e (4:13a1e) db NPC_JESSICA, $0c, $0e, WEST - dw $6d8d + dw Preload_JessicaInFireClubLobby db NPC_LAD2, $12, $06, EAST - dw $6e25 + dw Preload_Lad2 db NPC_CHAP3, $06, $0a, NORTH dw NULL db NPC_MANIA, $14, $12, NORTH @@ -391,15 +391,15 @@ PokemonDomeEntranceNPCS: ; 7ab9 (4:13ab9) PokemonDomeNPCS: ; 7ac0 (4:13ac0) db NPC_COURTNEY, $12, $02, SOUTH - dw $774b + dw Preload_Courtney db NPC_STEVE, $16, $02, SOUTH - dw $778c + dw Preload_Steve db NPC_JACK, $08, $02, SOUTH - dw $77a3 + dw Preload_Jack db NPC_ROD, $0c, $02, SOUTH - dw $77ba + dw Preload_Rod db NPC_RONALD1, $1e, $00, SOUTH - dw $77d6 + dw Preload_Ronald1InPokemonDome db $00 HallOfHonorNPCS: ; 7adf (4:13adf) diff --git a/src/data/npcs.asm b/src/data/npcs.asm index 7880a8b..c083d32 100644 --- a/src/data/npcs.asm +++ b/src/data/npcs.asm @@ -710,7 +710,7 @@ Murray1NPCHeader: db $00 db $12 db $00 - dw Script_Murray1 + dw Script_Murray tx MurrayNPCName db MURRAY_PIC db STRANGE_PSYSHOCK_DECK_ID @@ -723,7 +723,7 @@ Murray2NPCHeader: db $03 db $15 db $10 - dw Script_Murray2 + dw Script_Murray tx MurrayNPCName db MURRAY_PIC db STRANGE_PSYSHOCK_DECK_ID diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index f779482..c1ca2d0 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2754,7 +2754,6 @@ ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) xor a call ShowMultichoiceTextbox jp IncreaseScriptPointerBy1 -; 0xd27b .multichoice_menu_args ; d27b dw NULL ; NPC title for textbox under menu @@ -2769,7 +2768,6 @@ ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) tx Text03fb tx Text03fc - ; displays a textbox with multiple choices and a cursor. ; takes as an argument in h1 a pointer to a table ; dw text id for NPC title for textbox under menu @@ -2865,7 +2863,6 @@ ScriptCommand_ShowSamNormalMultichoice: ; d2f6 (3:52f6) xor a ld [wMultichoiceTextboxResult_Sam], a jp IncreaseScriptPointerBy1 -; 0xd30c .multichoice_menu_args ; d30c tx SamNPCName ; NPC title for textbox under menu @@ -3071,7 +3068,7 @@ ScriptCommand_JumpIfFlagZero1: ; d460 (3:5460) ld a, c call GetEventFlagValue or a - jr z, ScriptCommand_JumpIfFlagZero1.passTryJump + jr z, .passTryJump .fail call SetScriptControlByteFail @@ -3154,7 +3151,7 @@ ScriptCommand_JumpIfFlagNonzero2: ; d4ca (3:54ca) or a jr z, ScriptCommand_JumpIfFlagZero2.fail -.passTryJump: +.passTryJump call SetScriptControlBytePass call GetScriptArgs2AfterPointer jr z, .noJumpArgs @@ -3220,8 +3217,8 @@ MasonLaboratoryAfterDuel: ; d53b (3:553b) .after_duel_table db NPC_SAM db NPC_SAM - dw $568a - dw $569f + dw Script_BeatSam + dw Script_LostToSam db $00 MasonLabLoadMap: ; d549 (3:5549) @@ -3272,13 +3269,28 @@ Script_Tech3: ; d5d5 (3:55d5) INCROM $d5d5, $d5e0 Script_Tech4: ; d5e0 (3:55e0) - INCROM $d5e0, $d5f9 + INCROM $d5e0, $d5eb + +Preload_Tech5: ; d5eb (3:55eb) + INCROM $d5eb, $d5f9 Script_Tech5: ; d5f9 (3:55f9) - INCROM $d5f9, $d61d + INCROM $d5f9, $d604 + +Preload_Sam: ; d604 (3:5604) + INCROM $d604, $d61d Script_Sam: ; d61d (3:561d) - INCROM $d61d, $d727 + INCROM $d61d, $d68a + +Script_BeatSam: ; d68a (3:568a) + INCROM $d68a, $d69f + +Script_LostToSam: ; d69f (3:569f) + INCROM $d69f, $d710 + +Preload_DrMason: ; d710 (3:5710) + INCROM $d710, $d727 Script_DrMason: ; d727 (3:5727) INCROM $d727, $d753 @@ -3478,9 +3490,21 @@ NPCMovement_d896: ; d896 (3:5896) db EAST db SOUTH | NO_MOVE db $ff -; 0xd89f - INCROM $d89f, $d8bb +DeckMachineRoomAfterDuel: ; d89f (3:589f) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_AARON + db NPC_AARON + dw Script_BeatAaron + dw Script_LostToAaron + db $00 + +DeckMachineRoomCloseTextBox: ; d8ad (3:58ad) + INCROM $d8ad, $d8bb Script_Tech6: ; d8bb (3:58bb) INCROM $d8bb, $d8c6 @@ -3492,7 +3516,13 @@ Script_Tech8: ; d8d1 (3:58d1) INCROM $d8d1, $d8dd Script_Aaron: ; d8dd (3:58dd) - INCROM $d8dd, $d932 + INCROM $d8dd, $d903 + +Script_BeatAaron: ; d903 (3:5903) + INCROM $d903, $d92e + +Script_LostToAaron: ; d92e (3:592e) + INCROM $d92e, $d932 Script_d932: ; d932 (3:5932) start_script @@ -3504,7 +3534,6 @@ Script_d932: ; d932 (3:5932) .ows_d93c open_deck_machine $09 quit_script_fully -; 0xd93f Script_d93f: ; d93f (3:593f) INCROM $d93f, $d995 @@ -3707,7 +3736,10 @@ FightingClubLobbyAfterDuel: ; dc68 (3:5c68) db $00 Script_Man1: ; dc76 (3:5c76) - INCROM $dc76, $dd0d + INCROM $dc76, $dceb + +Preload_ImakuniInFightingClubLobby: ; dceb (3:5ceb) + INCROM $dceb, $dd0d Script_Imakuni: ; dd0d (3:5d0d) start_script @@ -3787,41 +3819,40 @@ Script_Specs1: ; dd82 (3:5d82) INCROM $dd82, $dd8d Script_Butch: ; dd8d (3:5d8d) - INCROM $dd8d, $dd9f + INCROM $dd8d, $dd98 + +Preload_Granny1: ; dd98 (3:5d98) + INCROM $dd98, $dd9f Script_Granny1: ; dd9f (3:5d9f) INCROM $dd9f, $dda3 - FightingClubAfterDuel: ; dda3 (3:5da3) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xddaa .after_duel_table db NPC_CHRIS db NPC_CHRIS - dw $5e69 - dw $5e75 + dw Script_BeatChrisInFightingClub + dw Script_LostToChrisInFightingClub db NPC_MICHAEL db NPC_MICHAEL - dw $5e95 - dw $5ea1 + dw Script_BeatMichaelInFightingClub + dw Script_LostToMichaelInFightingClub db NPC_JESSICA db NPC_JESSICA - dw $5ec1 - dw $5ecd + dw Script_BeatJessicaInFightingClub + dw Script_LostToJessicaInFightingClub db NPC_MITCH db NPC_MITCH dw Script_BeatMitch - dw Script_LoseToMitch - + dw Script_LostToMitch db $00 -; ddc3 Script_Mitch: ; ddc3 (3:5dc3) start_script @@ -3835,27 +3866,21 @@ Script_Mitch: ; ddc3 (3:5dc3) script_set_flag_value EVENT_FLAG_17, $01 script_set_flag_value EVENT_FLAG_20, $01 quit_script_fully -; 0xdde2 .three_pupils_remaining print_text_quit_fully Text0478 -; 0xdde5 .two_pupils_remaining print_text_quit_fully Text0479 -; 0xdde8 .one_pupil_remaining print_text_quit_fully Text047a -; 0xddeb .all_pupils_defeated print_text_string Text047b ask_question_jump Text047c, .do_battle print_text_string Text047d quit_script_fully -; 0xddf7 .do_battle 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 @@ -3871,38 +3896,57 @@ Script_BeatMitch: ; ddff (3:5dff) give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER print_text_string Text0481 quit_script_fully -; 0xde19 -Script_LoseToMitch: ; de19 (3:5e19) +Script_LostToMitch: ; de19 (3:5e19) start_script jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_PrintTrainHarderText print_text_quit_fully Text0482 -; 0xde21 -Script_Mitch_AlreadyHaveMedal: ; 0xde21 +Script_Mitch_AlreadyHaveMedal: ; de21 (3:5e21) print_text_string Text0483 ask_question_jump Text047c, .do_battle print_text_string Text0484 quit_script_fully -; 0xde2d .do_battle print_text_string Text0485 start_battle PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully -; 0xde35 Script_Mitch_GiveBoosters: 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: print_text_quit_fully Text0488 -; 0xde43 - INCROM $de43, $ded1 +Preload_ChrisInFightingClub: ; de43 (3:5e43) + INCROM $de43, $de69 + +Script_BeatChrisInFightingClub: ; de69 (3:5e69) + INCROM $de69, $de75 + +Script_LostToChrisInFightingClub: ; de75 (3:5e75) + INCROM $de75, $de79 + +Preload_MichaelInFightingClub: ; de79 (3:5e79) + INCROM $de79, $de95 + +Script_BeatMichaelInFightingClub: ; de95 (3:5e95) + INCROM $de95, $dea1 + +Script_LostToMichaelInFightingClub: ; dea1 (3:5ea1) + INCROM $dea1, $dea5 + +Preload_JessicaInFightingClub: ; dea5 (3:5ea5) + INCROM $dea5, $dec1 + +Script_BeatJessicaInFightingClub: ; dec1 (3:5ec1) + INCROM $dec1, $decd + +Script_LostToJessicaInFightingClub: ; decd (3:5ecd) + INCROM $decd, $ded1 Script_Clerk2: ; ded1 (3:5ed1) INCROM $ded1, $ded5 @@ -3911,56 +3955,108 @@ RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xdedc .after_duel_table db NPC_CHRIS db NPC_CHRIS - dw $5f0c - dw $5f20 + dw Script_BeatChrisInRockClubLobby + dw Script_LostToChrisInRockClubLobby db NPC_MATTHEW db NPC_MATTHEW - dw $5f63 - dw $5f78 + dw Script_BeatMatthew + dw Script_LostToMatthew db $00 -; 0xdee9 +Preload_ChrisInRockClubLobby: ; dee9 (3:5ee9) INCROM $dee9, $def2 Script_Chris: ; def2 (3:5ef2) - INCROM $def2, $df39 + INCROM $def2, $df0c + +Script_BeatChrisInRockClubLobby: ; df0c (3:5f0c) + INCROM $df0c, $df20 + +Script_LostToChrisInRockClubLobby: ; df20 (3:5f20) + INCROM $df20, $df39 Script_Matthew: ; df39 (3:5f39) - INCROM $df39, $df83 + INCROM $df39, $df63 + +Script_BeatMatthew: ; df63 (3:5f63) + INCROM $df63, $df78 + +Script_LostToMatthew: ; df78 (3:5f78) + INCROM $df78, $df83 Script_Woman1: ; df83 (3:5f83) INCROM $df83, $dfc0 Script_Chap1: ; dfc0 (3:5fc0) - INCROM $dfc0, $dfd2 + INCROM $dfc0, $dfcb + +Preload_Lass3: ; dfcb (3:5fcb) + INCROM $dfcb, $dfd2 Script_Lass3: ; dfd2 (3:5fd2) - INCROM $dfd2, $dff0 + INCROM $dfd2, $dfd6 + +RockClubAfterDuel: ; dfd6 (3:5fd6) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_RYAN + db NPC_RYAN + dw Script_BeatRyan + dw Script_LostToRyan + + db NPC_ANDREW + db NPC_ANDREW + dw Script_BeatAndrew + dw Script_LostToAndrew + + db NPC_GENE + db NPC_GENE + dw Script_BeatGene + dw Script_LostToGene + db $00 Script_Ryan: ; dff0 (3:5ff0) - INCROM $dff0, $e017 + INCROM $dff0, $e007 + +Script_BeatRyan: ; e007 (3:6007) + INCROM $e007, $e013 + +Script_LostToRyan: ; e013 (3:6013) + INCROM $e013, $e017 Script_Andrew: ; e017 (3:6017) - INCROM $e017, $e03e + INCROM $e017, $e02e + +Script_BeatAndrew: ; e02e (3:602e) + INCROM $e02e, $e03a + +Script_LostToAndrew: ; e03a (3:603a) + INCROM $e03a, $e03e Script_Gene: ; e03e (3:603e) - INCROM $e03e, $e09e + INCROM $e03e, $e059 + +Script_BeatGene: ; e059 (3:6059) + INCROM $e059, $e073 + +Script_LostToGene: ; e073 (3:6073) + INCROM $e073, $e09e Script_Clerk3: ; e09e (3:609e) INCROM $e09e, $e0a2 - WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xe0a9 .after_duel_table db NPC_IMAKUNI @@ -3968,7 +4064,6 @@ WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) dw Script_BeatImakuni dw Script_LostToImakuni db $00 -; 0xe0b0 Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) get_flag_value EVENT_IMAKUNI_STATE @@ -4038,7 +4133,7 @@ Script_Lass1: ; e111 (3:6111) .ows_e12d print_text_quit_fully Text0429 -Preload_Man2InWaterClubLobby: ; e130 (3:6130) +Preload_Man2: ; e130 (3:6130) get_flag_value EVENT_JOSHUA_STATE cp JOSHUA_BEATEN ret @@ -4063,7 +4158,7 @@ WaterClubMovePlayer: ; e13f (3:613f) ld bc, Script_NotReadyToSeeAmy jp SetNextNPCAndScript -WaterClubAfterDuel: ;e157 (3:6157) +WaterClubAfterDuel: ; e157 (3:6157) ld hl, .after_duel_table call FindEndOfBattleScript ret @@ -4227,7 +4322,7 @@ Script_Joshua: ; e21c (3:621c) print_variable_text Text0440, Text0441 quit_script_fully -.startDuel: +.startDuel print_text_string Text0442 try_give_pc_pack $04 start_battle PRIZES_4, SOUND_OF_THE_WAVES_DECK_ID, MUSIC_DUEL_THEME_1 @@ -4249,7 +4344,7 @@ Script_BeatJoshua: ; e26c (3:626c) jump_if_flag_not_equal EVENT_JOSHUA_STATE, JOSHUA_BEATEN, .firstJoshuaWin quit_script_fully -.firstJoshuaWin: +.firstJoshuaWin script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_BEATEN print_text_string Text0449 close_text_box @@ -4394,7 +4489,6 @@ ScriptJump_TalkToAmyAgain: ; e356 (3:6356) print_text_string Text0459 start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully -; 0xe369 Script_Clerk4: ; e369 (3:6369) INCROM $e369, $e36d @@ -4403,7 +4497,6 @@ LightningClubLobbyAfterDuel: ; e36d (3:636d) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xe374 .after_duel_table db NPC_IMAKUNI @@ -4411,9 +4504,9 @@ LightningClubLobbyAfterDuel: ; e36d (3:636d) dw Script_BeatImakuni dw Script_LostToImakuni db $00 -; 0xe37B - INCROM $e37B, $e39a +Preload_ImakuniInLightningClubLobby: ; e37b (3:637b) + INCROM $e37b, $e39a Script_Chap2: ; e39a (3:639a) INCROM $e39a, $e3d9 @@ -4422,19 +4515,73 @@ Script_Lass4: ; e3d9 (3:63d9) INCROM $e3d9, $e3dd Script_Hood1: ; e3dd (3:63dd) - INCROM $e3dd, $e408 + INCROM $e3dd, $e3e8 + +LightningClubAfterDuel: ; e3e8 (3:63e8) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_JENNIFER + db NPC_JENNIFER + dw Script_BeatJennifer + dw Script_LostToJennifer + + db NPC_NICHOLAS + db NPC_NICHOLAS + dw Script_BeatNicholas + dw Script_LostToNicholas + + db NPC_BRANDON + db NPC_BRANDON + dw Script_BeatBrandon + dw Script_LostToBrandon + + db NPC_ISAAC + db NPC_ISAAC + dw Script_BeatIsaac + dw Script_LostToIsaac + db $00 Script_Jennifer: ; e408 (3:6408) - INCROM $e408, $e42f + INCROM $e408, $e41d + +Script_BeatJennifer: ; e41d (3:641d) + INCROM $e41d, $e42b + +Script_LostToJennifer: ; e42b (3:642b) + INCROM $e42b, $e42f Script_Nicholas: ; e42f (3:642f) - INCROM $e42f, $e456 + INCROM $e42f, $e444 + +Script_BeatNicholas: ; e444 (3:6444) + INCROM $e444, $e452 + +Script_LostToNicholas: ; e452 (3:6452) + INCROM $e452, $e456 Script_Brandon: ; e456 (3:6456) - INCROM $e456, $e4ad + INCROM $e456, $e480 + +Script_BeatBrandon: ; e480 (3:6480) + INCROM $e480, $e490 + +Script_LostToBrandon: ; e490 (3:6490) + INCROM $e490, $e494 + +Preload_Isaac: ; e494 (3:6494) + INCROM $e494, $e4ad Script_Isaac: ; e4ad (3:64ad) - INCROM $e4ad, $e525 + INCROM $e4ad, $e4e1 + +Script_BeatIsaac: ; e4e1 (3:64e1) + INCROM $e4e1, $e4fb + +Script_LostToIsaac: ; e4fb (3:64fb) + INCROM $e4fb, $e525 GrassClubEntranceAfterDuel: ; e525 (3:6525) ld hl, GrassClubEntranceAfterDuelTable @@ -4474,8 +4621,8 @@ FindEndOfBattleScript: ; e52c (3:652c) GrassClubEntranceAfterDuelTable: ; e553 (3:6553) db NPC_MICHAEL db NPC_MICHAEL - dw $6597 - dw $65ab + dw Script_BeatMichaelInGrassClubEntrance + dw Script_LostToMichaelInGrassClubEntrance db NPC_RONALD2 db NPC_RONALD2 @@ -4489,10 +4636,19 @@ GrassClubEntranceAfterDuelTable: ; e553 (3:6553) db $00 Script_Clerk5: ; e566 (3:6566) - INCROM $e566, $e573 + INCROM $e566, $e56a + +Preload_MichaelInGrassClubEntrance: ; e56a (3:656a) + INCROM $e56a, $e573 Script_Michael: ; e573 (3:6573) - INCROM $e573, $e5c4 + INCROM $e573, $e597 + +Script_BeatMichaelInGrassClubEntrance: ; e597 (3:6597) + INCROM $e597, $e5ab + +Script_LostToMichaelInGrassClubEntrance: ; e5ab (3:65ab) + INCROM $e5ab, $e5c4 GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) ld hl, .after_duel_table @@ -4624,22 +4780,67 @@ Script_Lass2: ; e61f (3:661f) give_card BLASTOISE show_card_received_screen BLASTOISE print_text_quit_fully Text06f3 -; 0xe6d8 Script_Granny2: ; e6d8 (3:66d8) - INCROM $e6d8, $e6e3 + INCROM $e6d8, $e6dc + +Preload_Gal2: ; e6dc (3:66dc) + INCROM $e6dc, $e6e3 Script_Gal2: ; e6e3 (3:66e3) - INCROM $e6e3, $e701 + INCROM $e6e3, $e6e7 + +GrassClubAfterDuel: ; e6e7 (3:66e7) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_KRISTIN + db NPC_KRISTIN + dw Script_BeatKristin + dw Script_LostToKristin + + db NPC_HEATHER + db NPC_HEATHER + dw Script_BeatHeather + dw Script_LostToHeather + + db NPC_NIKKI + db NPC_NIKKI + dw Script_BeatNikki + dw Script_LostToNikki + db $00 Script_Kristin: ; e701 (3:6701) - INCROM $e701, $e745 + INCROM $e701, $e71c + +Script_BeatKristin: ; e71c (3:671c) + INCROM $e71c, $e741 + +Script_LostToKristin: ; e741 (3:6741) + INCROM $e741, $e745 Script_Heather: ; e745 (3:6745) - INCROM $e745, $e79e + INCROM $e745, $e760 + +Script_BeatHeather: ; e760 (3:6760) + INCROM $e760, $e78a + +Script_LostToHeather: ; e78a (3:678a) + INCROM $e78a, $e796 + +Preload_NikkiInGrassClub: ; e796 (3:6796) + INCROM $e796, $e79e Script_Nikki: ; e79e (3:679e) - INCROM $e79e, $e7f6 + INCROM $e79e, $e7d3 + +Script_BeatNikki: ; e7d3 (3:67d3) + INCROM $e7d3, $e7f2 + +Script_LostToNikki: ; e7f2 (3:67f2) + INCROM $e7f2, $e7f6 ClubEntranceAfterDuel: ; e7f6 (3:67f6) ld hl, .after_duel_table @@ -4694,13 +4895,15 @@ TrySecondRonaldFight: ; e837 (3:6837) ret nz ld bc, ScriptSecondRonaldFight jp SetNextNPCAndScript -; 0xe84c Script_Clerk6: ; e84c (3:684c) INCROM $e84c, $e850 Script_Lad3: ; e850 (3:6850) - INCROM $e850, $e862 + INCROM $e850, $e85b + +Preload_Ronald1InClubEntrance: ; e85b (3:685b) + INCROM $e85b, $e862 Script_FirstRonaldEncounter: ; e862 (3:6862) start_script @@ -4736,8 +4939,8 @@ NPCMovement_e894: ; e894 (3:6894) db SOUTH db SOUTH db $ff -; e89a +Preload_Ronald2InClubEntrance: ; e89a (3:689a) INCROM $e89a, $e8c0 Script_FirstRonaldFight: ; e8c0 (3:68c0) @@ -4799,8 +5002,8 @@ NPCMovement_e90f: ; e90f (3:690f) db SOUTH db SOUTH db $ff -; e915 +Preload_Ronald3InClubEntrance: ; e915 (3:6915) INCROM $e915, $e91e ScriptSecondRonaldFight: ; e91e (3:691e) @@ -4840,58 +5043,105 @@ ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) run_command Func_cdcb run_command Func_d41d quit_script_fully -; 0xe963 - PsychicClubLobbyAfterDuel: ; e963 (3:6963) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xe96a .after_duel_table - db NPC_ROBERT db NPC_ROBERT - dw $6995 - dw $69a1 + dw Script_BeatRobert + dw Script_LostToRobert db $00 +PsychicClubLobbyLoadMap: ; e971 (3:6971) INCROM $e971, $e980 Script_Robert: ; e980 (3:6980) - INCROM $e980, $e9a5 + INCROM $e980, $e995 + +Script_BeatRobert: ; e995 (3:6995) + INCROM $e995, $e9a1 + +Script_LostToRobert: ; e9a1 (3:69a1) + INCROM $e9a1, $e9a5 Script_Pappy1: ; e9a5 (3:69a5) - INCROM $e9a5, $ea30 + INCROM $e9a5, $e9f7 + +Preload_Ronald1InPsychicClubLobby: ; e9f7 (3:69f7) + INCROM $e9f7, $ea30 Script_Gal3: ; ea30 (3:6a30) INCROM $ea30, $ea3b Script_Chap4: ; ea3b (3:6a3b) - INCROM $ea3b, $ea60 + INCROM $ea3b, $ea46 + +PsychicClubAfterDuel: ; ea46 (3:6a46) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_DANIEL + db NPC_DANIEL + dw Script_BeatDaniel + dw Script_LostToDaniel + + db NPC_STEPHANIE + db NPC_STEPHANIE + dw Script_BeatStephanie + dw Script_LostToStephanie + + db NPC_MURRAY1 + db NPC_MURRAY1 + dw Script_BeatMurray + dw Script_LostToMurray + db $00 Script_Daniel: ; ea60 (3:6a60) - INCROM $ea60, $eaa2 + INCROM $ea60, $ea92 + +Script_BeatDaniel: ; ea92 (3:6a92) + INCROM $ea92, $ea9e + +Script_LostToDaniel: ; ea9e (3:6a9e) + INCROM $ea9e, $eaa2 Script_Stephanie: ; eaa2 (3:6aa2) - INCROM $eaa2, $eadf + INCROM $eaa2, $eac0 + +Script_BeatStephanie: ; eac0 (3:6ac0) + INCROM $eac0, $eacc + +Script_LostToStephanie: ; eacc (3:6acc) + INCROM $eacc, $ead0 + +Preload_Murray2: ; ead0 (3:6ad0) + INCROM $ead0, $eada -Script_Murray2: ; eadf (3:6adf) - INCROM $eadf, $eadf +Preload_Murray1: ; eada (3:6ada) + INCROM $eada, $eadf -Script_Murray1: ; eadf (3:6adf) - INCROM $eadf, $eb53 +Script_Murray: ; eadf (3:6adf) + INCROM $eadf, $eb0f + +Script_BeatMurray: ; eb0f (3:6b0f) + INCROM $eb0f, $eb29 + +Script_LostToMurray: ; eb29 (3:6b29) + INCROM $eb29, $eb53 Script_Clerk7: ; eb53 (3:6b53) INCROM $eb53, $eb57 - ScienceClubLobbyAfterDuel:; eb57 (3:6b57) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xeb5e .after_duel_table db NPC_IMAKUNI @@ -4899,8 +5149,8 @@ ScienceClubLobbyAfterDuel:; eb57 (3:6b57) dw Script_BeatImakuni dw Script_LostToImakuni db $00 -; 0xeb65 +Preload_ImakuniInScienceClubLobby: ; eb65 (3:6b65) INCROM $eb65, $eb84 Script_Lad1: ; eb84 (3:6b84) @@ -4913,19 +5163,73 @@ Script_Specs2: ; ebc5 (3:6bc5) INCROM $ebc5, $ebed Script_Specs3: ; ebed (3:6bed) - INCROM $ebed, $ec11 + INCROM $ebed, $ebf1 + +ScienceClubAfterDuel: ; ebf1 (3:6bf1) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_JOSEPH + db NPC_JOSEPH + dw Script_BeatJoseph + dw Script_LostToJoseph + + db NPC_DAVID + db NPC_DAVID + dw Script_BeatDavid + dw Script_LostToDavid + + db NPC_ERIK + db NPC_ERIK + dw Script_BeatErik + dw Script_LostToErik + + db NPC_RICK + db NPC_RICK + dw Script_BeatRick + dw Script_LostToRick + db $00 Script_David: ; ec11 (3:6c11) - INCROM $ec11, $ec42 + INCROM $ec11, $ec2f + +Script_BeatDavid: ; ec2f (3:6c2f) + INCROM $ec2f, $ec3e + +Script_LostToDavid: ; ec3e (3:6c3e) + INCROM $ec3e, $ec42 Script_Erik: ; ec42 (3:6c42) - INCROM $ec42, $ec67 + INCROM $ec42, $ec57 + +Script_BeatErik: ; ec57 (3:6c57) + INCROM $ec57, $ec63 + +Script_LostToErik: ; ec63 (3:6c63) + INCROM $ec63, $ec67 Script_Rick: ; ec67 (3:6c67) - INCROM $ec67, $ecdb + INCROM $ec67, $ec80 + +Script_BeatRick: ; ec80 (3:6c80) + INCROM $ec80, $ec9a + +Script_LostToRick: ; ec9a (3:6c9a) + INCROM $ec9a, $ecc4 + +Preload_Joseph: ; ecc4 (3:6cc4) + INCROM $ecc4, $ecdb Script_Joseph: ; ecdb (3:6cdb) - INCROM $ecdb, $ed45 + INCROM $ecdb, $ecf6 + +Script_BeatJoseph: ; ecf6 (3:6cf6) + INCROM $ecf6, $ed1c + +Script_LostToJoseph: ; ed1c (3:6d1c) + INCROM $ed1c, $ed45 Script_Clerk8: ; ed45 (3:6d45) INCROM $ed45, $ed49 @@ -4934,17 +5238,14 @@ FireClubLobbyAfterDuel: ; ed49 (3:6d49) ld hl, .after_duel_table call FindEndOfBattleScript ret -; 0xed50 .after_duel_table db NPC_JESSICA db NPC_JESSICA - dw $6dba - dw $6dce + dw Script_BeatJessicaInFireClubLobby + dw Script_LostToJessicaInFireClubLobby db $00 -; 0xed57 - FireClubPressedA: ; ed57 (3:6d57) ld hl, SlowpokePaintingObjectTable call FindExtraInteractableObjects @@ -4989,15 +5290,24 @@ FindExtraInteractableObjects: ; ed64 (3:6d64) call SetNextScript scf ret -; 0xed8d +Preload_JessicaInFireClubLobby: ; ed8d (3:6d8d) INCROM $ed8d, $ed96 Script_Jessica: ; ed96 (3:6d96) - INCROM $ed96, $ede8 + INCROM $ed96, $edba + +Script_BeatJessicaInFireClubLobby: ; edba (3:6dba) + INCROM $edba, $edce + +Script_LostToJessicaInFireClubLobby: ; edce (3:6dce) + INCROM $edce, $ede8 Script_Chap3: ; ede8 (3:6de8) - INCROM $ede8, $ee2c + INCROM $ede8, $ee25 + +Preload_Lad2: ; ee25 (3:6e25) + INCROM $ee25, $ee2c Script_Lad2: ; ee2c (3:6e2c) INCROM $ee2c, $ee76 @@ -5014,13 +5324,11 @@ Script_ee76: ; ee76 (3:6e76) give_card SLOWPOKE1 show_card_received_screen SLOWPOKE1 quit_script_fully -; 0xee88 Script_Mania: ; ee88 (3:6e88) INCROM $ee88, $ee93 - -FireClubAfterDuel: ;ee93 (3:6e93) +FireClubAfterDuel: ; ee93 (3:6e93) ld hl, .after_duel_table call FindEndOfBattleScript ret @@ -5028,35 +5336,51 @@ FireClubAfterDuel: ;ee93 (3:6e93) .after_duel_table db NPC_JOHN db NPC_JOHN - dw $6ec8 - dw $6ed4 + dw Script_BeatJohn + dw Script_LostToJohn db NPC_ADAM db NPC_ADAM - dw $6eed - dw $6ef9 + dw Script_BeatAdam + dw Script_LostToAdam db NPC_JONATHAN db NPC_JONATHAN - dw $6f12 - dw $6f1e + dw Script_BeatJonathan + dw Script_LostToJonathan db NPC_KEN db NPC_KEN dw Script_BeatKen - dw Script_LoseToKen - + dw Script_LostToKen db $00 -; 0xeeb3 Script_John: ; eeb3 (3:6eb3) - INCROM $eeb3, $eed8 + INCROM $eeb3, $eec8 + +Script_BeatJohn: ; eec8 (3:6ec8) + INCROM $eec8, $eed4 + +Script_LostToJohn: ; eed4 (3:6ed4) + INCROM $eed4, $eed8 Script_Adam: ; eed8 (3:6ed8) - INCROM $eed8, $eefd + INCROM $eed8, $eeed + +Script_BeatAdam: ; eeed (3:6eed) + INCROM $eeed, $eef9 + +Script_LostToAdam: ; eef9 (3:6ef9) + INCROM $eef9, $eefd Script_Jonathan: ; eefd (3:6efd) - INCROM $eefd, $ef22 + INCROM $eefd, $ef12 + +Script_BeatJonathan: ; ef12 (3:6f12) + INCROM $ef12, $ef1e + +Script_LostToJonathan: ; ef1e (3:6f1e) + INCROM $ef1e, $ef22 Script_Ken: ; ef22 (3:6f22) start_script @@ -5080,7 +5404,6 @@ Script_Ken: ; ef22 (3:6f22) 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 @@ -5097,16 +5420,12 @@ Script_BeatKen: ; ef5e (3:6f5e) give_booster_packs BOOSTER_MYSTERY_NEUTRAL, BOOSTER_MYSTERY_NEUTRAL, NO_BOOSTER print_text_string Text06c3 quit_script_fully -; 0xef78 - - -Script_LoseToKen: ; ef78 (3:6f78) +Script_LostToKen: ; ef78 (3:6f78) start_script jump_if_flag_zero_2 EVENT_FLAG_0A, NULL print_variable_text Text06c4, Text06c5 quit_script_fully -; 0xef83 Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) print_text_string Text06c6 @@ -5116,7 +5435,6 @@ Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) print_text_string Text06c7 start_battle PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully -; 0xef96 Preload_Clerk9: ; ef96 (3:6f96) call TryGiveMedalPCPacks @@ -5499,7 +5817,6 @@ Script_Clerk12: ; f295 (3:7295) set_next_npc_and_script $4a, Script_f353 end_script_loop ret -; f349 NPCMovement_f349: ; f349 (3:7349) db NORTH @@ -5809,7 +6126,6 @@ ScriptJump_f4db: ; f4db (3:74db) set_next_npc_and_script NPC_CLERK12, Script_f3e9 end_script_loop ret -; f559 ; Loads the NPC to fight at the challenge hall Preload_ChallengeHallOpponent: ; f559 (3:7559) @@ -5884,7 +6200,13 @@ Func_f5db: ; f5db (3:75db) INCROM $f5e9, $f602 Func_f602: ; f602 (3:7602) - INCROM $f602, $f631 + INCROM $f602, $f607 + +PokemonDomeEntranceLoadMap: ; f607 (3:7607) + INCROM $f607, $f62a + +PokemonDomeEntranceCloseTextBox: ; f62a (3:762a) + INCROM $f62a, $f631 Script_f631: ; f631 (3:7631) start_script @@ -5899,7 +6221,48 @@ Script_f631: ; f631 (3:7631) INCROM $f63c, $f6af Script_f6af: ; f6af (3:76af) - INCROM $f6af, $f71f + INCROM $f6af, $f6c6 + +PokemonDomeMovePlayer: ; f6c6 (3:76c6) + INCROM $f6c6, $f6e0 + +PokemonDomeAfterDuel: ; f6e0 (3:76e0) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_COURTNEY + db NPC_COURTNEY + dw Script_BeatCourtney + dw Script_LostToCourtney + + db NPC_STEVE + db NPC_STEVE + dw Script_BeatSteve + dw Script_LostToSteve + + db NPC_JACK + db NPC_JACK + dw Script_BeatJack + dw Script_LostToJack + + db NPC_ROD + db NPC_ROD + dw Script_BeatRod + dw Script_LostToRod + + db NPC_RONALD1 + db NPC_RONALD1 + dw Script_BeatRonald1InPokemonDome + dw Script_LostToRonald1InPokemonDome + db $00 + +PokemonDomeLoadMap: ; f706 (3:7706) + INCROM $f706, $f718 + +PokemonDomeCloseTextBox: ; f718 (3:7718) + INCROM $f718, $f71f Script_Courtney: ; f71f (3:771f) INCROM $f71f, $f72a @@ -5911,13 +6274,57 @@ Script_Jack: ; f735 (3:7735) INCROM $f735, $f740 Script_Rod: ; f740 (3:7740) - INCROM $f740, $fbdb + INCROM $f740, $f74b + +Preload_Courtney: ; f74b (3:774b) + INCROM $f74b, $f78c + +Preload_Steve: ; f78c (3:778c) + INCROM $f78c, $f7a3 + +Preload_Jack: ; f7a3 (3:77a3) + INCROM $f7a3, $f7ba + +Preload_Rod: ; f7ba (3:77ba) + INCROM $f7ba, $f7d6 + +Preload_Ronald1InPokemonDome: ; f7d6 (3:77d6) + INCROM $f7d6, $f93f + +Script_LostToCourtney: ; f93f (3:793f) + INCROM $f93f, $f95a + +Script_BeatCourtney: ; f95a (3:795a) + INCROM $f95a, $f9b7 + +Script_LostToSteve: ; f9b7 (3:79b7) + INCROM $f9b7, $f9c8 + +Script_BeatSteve: ; f9c8 (3:79c8) + INCROM $f9c8, $fa23 + +Script_LostToJack: ; fa23 (3:7a23) + INCROM $fa23, $fa34 + +Script_BeatJack: ; fa34 (3:7a34) + INCROM $fa34, $fa98 + +Script_LostToRod: ; fa98 (3:7a98) + INCROM $fa98, $faae + +Script_BeatRod: ; faae (3:7aae) + INCROM $faae, $fb48 + +Script_LostToRonald1InPokemonDome: ; fb48 (3:7b48) + INCROM $fb48, $fb53 + +Script_BeatRonald1InPokemonDome: ; fb53 (3:7b53) + INCROM $fb53, $fbdb HallOfHonorLoadMap: ; fbdb (3:7bdb) ld a, SFX_10 call PlaySFX ret -; 0xfbe1 Script_fbe1: ; fbe1 (3:7be1) INCROM $fbe1, $fbf1 @@ -6085,7 +6492,7 @@ NPCMovement_fce1: ; fce1 (3:7ce1) NPCMovement_fce3: ; fce3 (3:7ce3) db NORTH | NO_MOVE db $ff -; fce5 +; 0xfce5 rept $31b db $ff -- cgit v1.2.3 From 4b12dbdee2df014892bda9df2554e21d291c4ecf Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 5 Jan 2021 20:07:05 -0600 Subject: A few bank03 data tables and text labels --- src/engine/bank03.asm | 192 ++++++++++++++++++++++++++++++++++++---------- src/text/text3.asm | 52 ++++++------- src/text/text_offsets.asm | 52 ++++++------- 3 files changed, 202 insertions(+), 94 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index c1ca2d0..c3dcd8c 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1094,7 +1094,7 @@ PC_c7ea: ; c7ea (3:47ea) jr z, .asm_c82f call Func_c2a3 ld a, [wd0b9] - ld hl, Unknown_c846 + ld hl, PointerTable_c846 call JumpToFunctionInTable ld hl, Func_c84e call Func_c32b @@ -1110,11 +1110,26 @@ PC_c7ea: ; c7ea (3:47ea) call Func_39fc ret -Unknown_c846: ; c846 (3:4846) - INCROM $c846, $c84e +PointerTable_c846: ; c846 (3:4846) + dw Func_c859 + dw Func_c86d + dw Func_c872 + dw Func_c877 Func_c84e: ; c84e (3:484e) - INCROM $c84e, $c891 + INCROM $c84e, $c859 + +Func_c859: ; c859 (3:4859) + INCROM $c859, $c86d + +Func_c86d: ; c86d (3:486d) + INCROM $c86d, $c872 + +Func_c872: ; c872 (3:4872) + INCROM $c872, $c877 + +Func_c877: ; c877 (3:4877) + INCROM $c877, $c891 Func_c891: ; c891 (3:4891) push hl @@ -1813,9 +1828,10 @@ SetScriptPointer: ; cc8b (3:4c8b) inc hl ld [hl], b ret -; 0xcc92 - INCROM $cc92, $cc96 +GetScriptArgs5AfterPointer: ; cc92 (3:4c92) + ld a, $5 + jr GetScriptArgsAfterPointer GetScriptArgs1AfterPointer: ; cc96 (3:4c96) ld a, $1 @@ -2590,7 +2606,7 @@ Func_d135: ; d135 (3:5135) rlca ld c, a ld b, $0 - ld hl, $5151 + ld hl, MapNames - 2 add hl, bc ld e, [hl] inc hl @@ -2601,7 +2617,19 @@ Func_d135: ; d135 (3:5135) ld [hl], d jp IncreaseScriptPointerBy2 - INCROM $d153, $d16b +MapNames: ; d153 (3:5153) + tx MasonLaboratoryMapNameText + tx MrIshiharasHouseMapNameText + tx FightingClubMapNameText + tx RockClubMapNameText + tx WaterClubMapNameText + tx LightningClubMapNameText + tx GrassClubMapNameText + tx PsychicClubMapNameText + tx ScienceClubMapNameText + tx FireClubMapNameText + tx ChallengeHallMapNameText + tx PokemonDomeMapNameText Func_d16b: ; d16b (3:516b) ld hl, wCurrentNPCNameTx @@ -2655,7 +2683,7 @@ Func_d1b3: ; d1b3 (3:51b3) ; fallthrough .asm_d1c3 - ld hl, Unknown_d1dc + ld hl, TradeCardNames asm_d1c6: ld e, a add a @@ -2671,8 +2699,51 @@ asm_d1c6: ld [wTxRam2 + 1], a jp IncreaseScriptPointerBy1 -Unknown_d1dc: ; d1dc (3:51dc) - INCROM $d1dc, $d209 +TradeCardNames: ; d1dc (3:51dc) + db MEWTWO2 + tx MewtwoTradeCardName + + db MEW1 + tx MewTradeCardName + + db ARCANINE1 + tx ArcanineTradeCardName + + db PIKACHU3 + tx PikachuTradeCardName + + db PIKACHU4 + tx PikachuTradeCardName + + db SURFING_PIKACHU1 + tx SurfingPikachuTradeCardName + + db SURFING_PIKACHU2 + tx SurfingPikachuTradeCardName + + db ELECTABUZZ1 + tx ElectabuzzTradeCardName + + db SLOWPOKE1 + tx SlowpokeTradeCardName + + db MEWTWO3 + tx MewtwoTradeCardName + + db MEWTWO2 + tx MewtwoTradeCardName + + db MEW1 + tx MewTradeCardName + + db JIGGLYPUFF1 + tx JigglypuffTradeCardName + + db SUPER_ENERGY_RETRIEVAL + tx SuperEnergyRetrievalTradeCardName + + db FLYING_PIKACHU + tx FlyingPikachuTradeCardName Func_d209: ; d209 (3:5209) get_flag_value EVENT_FLAG_71 @@ -2706,13 +2777,16 @@ Func_d209: ; d209 (3:5209) LegendaryCards: ; d234 (3:5234) db ZAPDOS3 - tx Text03f0 + tx ZapdosLegendaryCardName + db MOLTRES2 - tx Text03f1 + tx MoltresLegendaryCardName + db ARTICUNO2 - tx Text03f2 + tx ArticunoLegendaryCardName + db DRAGONITE1 - tx Text03f3 + tx DragoniteLegendaryCardName Flags_d240: ; d240 (3:5240) db EVENT_FLAG_6D @@ -2747,7 +2821,7 @@ ScriptCommand_ChooseDeckToDuelAgainstMultichoice: ; d24c (3:524c) tx Text03f7 tx Text03f8 - INCROM $d26f, $d271 + dw NULL ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) ld hl, .multichoice_menu_args @@ -5670,10 +5744,16 @@ Func_f121: ; f121 (3:7121) ret Unknown_f146: ; f146 (3:7146) - INCROM $f146, $f156 + db $01, $00, EVENT_FLAG_50, $01 + db $03, $03, EVENT_FLAG_51, $02 + db $07, $03, EVENT_FLAG_52, $03 + db $07, $00, EVENT_FLAG_53, $04 Unknown_f156: ; f156 (3:7156) - INCROM $f156, $f166 + db $01, $00, EVENT_FLAG_54, $05 + db $03, $03, EVENT_FLAG_55, $06 + db $07, $03, EVENT_FLAG_56, $07 + db $07, $00, EVENT_FLAG_57, $08 Script_f166: ; f166 (3:7166) INCROM $f166, $f239 @@ -6151,36 +6231,61 @@ Preload_ChallengeHallOpponent: ; f559 (3:7559) Func_f580: ; f580 (3:7580) get_flag_value EVENT_FLAG_44 cp $3 - jr z, .asm_f596 + jr z, .pick_challenger_include_ronald get_flag_value EVENT_FLAG_45 cp $3 - ld d, $18 - jr nz, .asm_f598 - ld a, $2 - jr .asm_f5ac + ld d, ChallengeHallNPCsEnd - ChallengeHallNPCs - 1 ; discount Ronald + jr nz, .pick_challenger + ld a, NPC_RONALD1 + jr .force_ronald -.asm_f596 - ld d, $19 +.pick_challenger_include_ronald + ld d, ChallengeHallNPCsEnd - ChallengeHallNPCs -.asm_f598 +.pick_challenger ld a, d call Random ld c, a call Func_f5cc - jr c, .asm_f598 + jr c, .pick_challenger call Func_f5d4 ld b, $0 - ld hl, Unknown_f5b3 + ld hl, ChallengeHallNPCs add hl, bc ld a, [hl] -.asm_f5ac +.force_ronald ld [wTempNPC], a ld [wd696], a ret -Unknown_f5b3: ; f5b3 (3:75b3) - INCROM $f5b3, $f5cc +ChallengeHallNPCs: ; f5b3 (3:75b3) + db NPC_CHRIS + db NPC_MICHAEL + db NPC_JESSICA + db NPC_MATTHEW + db NPC_RYAN + db NPC_ANDREW + db NPC_SARA + db NPC_AMANDA + db NPC_JOSHUA + db NPC_JENNIFER + db NPC_NICHOLAS + db NPC_BRANDON + db NPC_BRITTANY + db NPC_KRISTIN + db NPC_HEATHER + db NPC_ROBERT + db NPC_DANIEL + db NPC_STEPHANIE + db NPC_JOSEPH + db NPC_DAVID + db NPC_ERIK + db NPC_JOHN + db NPC_ADAM + db NPC_JONATHAN + db NPC_RONALD1 +ChallengeHallNPCsEnd: Func_f5cc: ; f5cc (3:75cc) INCROM $f5cc, $f5d4 @@ -6385,16 +6490,16 @@ Func_fc2b: ; fc2b (3:7c2b) ld c, [hl] inc hl ld b, [hl] - ld a, $b0 + ld a, LOW(ClerkNPCName_) ld [wCurrentNPCNameTx], a - ld a, $3 + ld a, HIGH(ClerkNPCName_) ld [wCurrentNPCNameTx+1], a jp SetNextScript PointerTable_fc4c: ; fc4c (3:7c4c) - dw Unknown_fc64 - dw Unknown_fc68 - dw Unknown_fc60 + dw Script_fc64 + dw Script_fc68 + dw Script_fc60 Script_fc52: ; fc52 (3:7c52) start_script @@ -6406,14 +6511,17 @@ Script_fc52: ; fc52 (3:7c52) run_command Func_cd76 quit_script_fully -Unknown_fc60: ; fc60 (3:7c60) - INCROM $fc60, $fc64 +Script_fc60: ; fc60 (3:7c60) + start_script + print_text_quit_fully Text06ca -Unknown_fc64: ; fc64 (3:7c64) - INCROM $fc64, $fc68 +Script_fc64: ; fc64 (3:7c64) + start_script + print_text_quit_fully Text06cb -Unknown_fc68: ; fc68 (3:7c68) - INCROM $fc68, $fc6c +Script_fc68: ; fc68 (3:7c68) + start_script + print_text_quit_fully Text06cc ; Clerk looks away from you if you can't use infrared ; This is one of the preloads that does not change whether or not they appear diff --git a/src/text/text3.asm b/src/text/text3.asm index dd18539..a0cf867 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -994,51 +994,51 @@ Text032f: ; 3e768 (f:6768) text " ??'s House " done -Text0330: ; 3e77e (f:677e) +MasonLaboratoryMapNameText: ; 3e77e (f:677e) text "Mason Laboratory" done -Text0331: ; 3e790 (f:6790) +MrIshiharasHouseMapNameText: ; 3e790 (f:6790) text "Mr Ishihara's House" done -Text0332: ; 3e7a5 (f:67a5) +FightingClubMapNameText: ; 3e7a5 (f:67a5) text "Fighting" done -Text0333: ; 3e7af (f:67af) +RockClubMapNameText: ; 3e7af (f:67af) text "Rock" done -Text0334: ; 3e7b5 (f:67b5) +WaterClubMapNameText: ; 3e7b5 (f:67b5) text "Water" done -Text0335: ; 3e7bc (f:67bc) +LightningClubMapNameText: ; 3e7bc (f:67bc) text "Lightning" done -Text0336: ; 3e7c7 (f:67c7) +GrassClubMapNameText: ; 3e7c7 (f:67c7) text "Grass" done -Text0337: ; 3e7ce (f:67ce) +PsychicClubMapNameText: ; 3e7ce (f:67ce) text "Psychic" done -Text0338: ; 3e7d7 (f:67d7) +ScienceClubMapNameText: ; 3e7d7 (f:67d7) text "Science" done -Text0339: ; 3e7e0 (f:67e0) +FireClubMapNameText: ; 3e7e0 (f:67e0) text "Fire" done -Text033a: ; 3e7e6 (f:67e6) +ChallengeHallMapNameText: ; 3e7e6 (f:67e6) text "Challenge Hall" done -Text033b: ; 3e7f6 (f:67f6) +PokemonDomeMapNameText: ; 3e7f6 (f:67f6) text "Pokémon Dome" done @@ -1860,59 +1860,59 @@ AaronNPCName: ; 3f823 (f:7823) text "Aaron" done -Text03e8: ; 3f82a (f:782a) +MewtwoTradeCardName: ; 3f82a (f:782a) text "60 MEWTWO " done -Text03e9: ; 3f838 (f:7838) +MewTradeCardName: ; 3f838 (f:7838) text "8 MEW " done -Text03ea: ; 3f842 (f:7842) +ArcanineTradeCardName: ; 3f842 (f:7842) text "34 ARCANINE" done -Text03eb: ; 3f851 (f:7851) +PikachuTradeCardName: ; 3f851 (f:7851) text "16 PIKACHU" done -Text03ec: ; 3f85f (f:785f) +SurfingPikachuTradeCardName: ; 3f85f (f:785f) text "13 SURFING PIKACHU" done -Text03ed: ; 3f875 (f:7875) +ElectabuzzTradeCardName: ; 3f875 (f:7875) text "20 ELECTABUZZ" done -Text03ee: ; 3f886 (f:7886) +SlowpokeTradeCardName: ; 3f886 (f:7886) text "9 SLOWPOKE" done -Text03ef: ; 3f894 (f:7894) +JigglypuffTradeCardName: ; 3f894 (f:7894) text "12 JIGGLYPUFF" done -Text03f0: ; 3f8a5 (f:78a5) +ZapdosLegendaryCardName: ; 3f8a5 (f:78a5) text "68 ZAPDOS" done -Text03f1: ; 3f8b2 (f:78b2) +MoltresLegendaryCardName: ; 3f8b2 (f:78b2) text "37 MOLTRES" done -Text03f2: ; 3f8c0 (f:78c0) +ArticunoLegendaryCardName: ; 3f8c0 (f:78c0) text "37 ARTICUNO" done -Text03f3: ; 3f8cf (f:78cf) +DragoniteLegendaryCardName: ; 3f8cf (f:78cf) text "41 DRAGONITE" done -Text03f4: ; 3f8df (f:78df) +SuperEnergyRetrievalTradeCardName: ; 3f8df (f:78df) text "Super Energy Retrieval" done -Text03f5: ; 3f8f7 (f:78f7) +FlyingPikachuTradeCardName: ; 3f8f7 (f:78f7) text "12 FLYING PIKACHU" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index a061dc9..3e9e463 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -817,18 +817,18 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text032d ; 0x032d textpointer Text032e ; 0x032e textpointer Text032f ; 0x032f - textpointer Text0330 ; 0x0330 - textpointer Text0331 ; 0x0331 - textpointer Text0332 ; 0x0332 - textpointer Text0333 ; 0x0333 - textpointer Text0334 ; 0x0334 - textpointer Text0335 ; 0x0335 - textpointer Text0336 ; 0x0336 - textpointer Text0337 ; 0x0337 - textpointer Text0338 ; 0x0338 - textpointer Text0339 ; 0x0339 - textpointer Text033a ; 0x033a - textpointer Text033b ; 0x033b + textpointer MasonLaboratoryMapNameText ; 0x0330 + textpointer MrIshiharasHouseMapNameText ; 0x0331 + textpointer FightingClubMapNameText ; 0x0332 + textpointer RockClubMapNameText ; 0x0333 + textpointer WaterClubMapNameText ; 0x0334 + textpointer LightningClubMapNameText ; 0x0335 + textpointer GrassClubMapNameText ; 0x0336 + textpointer PsychicClubMapNameText ; 0x0337 + textpointer ScienceClubMapNameText ; 0x0338 + textpointer FireClubMapNameText ; 0x0339 + textpointer ChallengeHallMapNameText ; 0x033a + textpointer PokemonDomeMapNameText ; 0x033b textpointer Text033c ; 0x033c textpointer Text033d ; 0x033d textpointer Text033e ; 0x033e @@ -1001,20 +1001,20 @@ TextOffsets:: ; 34000 (d:4000) textpointer GrannyNPCName ; 0x03e5 textpointer GuideNPCName ; 0x03e6 textpointer AaronNPCName ; 0x03e7 - textpointer Text03e8 ; 0x03e8 - textpointer Text03e9 ; 0x03e9 - textpointer Text03ea ; 0x03ea - textpointer Text03eb ; 0x03eb - textpointer Text03ec ; 0x03ec - textpointer Text03ed ; 0x03ed - textpointer Text03ee ; 0x03ee - textpointer Text03ef ; 0x03ef - textpointer Text03f0 ; 0x03f0 - textpointer Text03f1 ; 0x03f1 - textpointer Text03f2 ; 0x03f2 - textpointer Text03f3 ; 0x03f3 - textpointer Text03f4 ; 0x03f4 - textpointer Text03f5 ; 0x03f5 + textpointer MewtwoTradeCardName ; 0x03e8 + textpointer MewTradeCardName ; 0x03e9 + textpointer ArcanineTradeCardName ; 0x03ea + textpointer PikachuTradeCardName ; 0x03eb + textpointer SurfingPikachuTradeCardName ; 0x03ec + textpointer ElectabuzzTradeCardName ; 0x03ed + textpointer SlowpokeTradeCardName ; 0x03ee + textpointer JigglypuffTradeCardName ; 0x03ef + textpointer ZapdosLegendaryCardName ; 0x03f0 + textpointer MoltresLegendaryCardName ; 0x03f1 + textpointer ArticunoLegendaryCardName ; 0x03f2 + textpointer DragoniteLegendaryCardName ; 0x03f3 + textpointer SuperEnergyRetrievalTradeCardName ; 0x03f4 + textpointer FlyingPikachuTradeCardName ; 0x03f5 textpointer Text03f6 ; 0x03f6 textpointer Text03f7 ; 0x03f7 textpointer Text03f8 ; 0x03f8 -- cgit v1.2.3 From 62de45a387eb955c730aa08400cd1895e35ce2d7 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Thu, 7 Jan 2021 00:21:51 -0600 Subject: Add Script_Tech1 and fix play_song script command --- src/engine/bank03.asm | 65 ++++++++++++++++++++++++++++++++++++++++++----- src/engine/bank04.asm | 2 +- src/engine/home.asm | 2 +- src/macros/scripts.asm | 8 +++++- src/text/text6.asm | 16 ++++++------ src/text/text_offsets.asm | 16 ++++++------ tools/script_extractor.py | 6 ++--- 7 files changed, 86 insertions(+), 29 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 071ee2d..d94963d 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3086,9 +3086,9 @@ Func_d408: ; d408 (3:5408) ld [wd111], a jp IncreaseScriptPointerBy2 -Func_d40f: ; d40f (3:540f) +ScriptCommand_PlaySong: ; d40f (3:540f) ld a, c - call CallPlaySong + call ScriptPlaySong jp IncreaseScriptPointerBy2 ScriptCommand_PlaySFX: ; d416 (3:5416) @@ -3332,15 +3332,67 @@ ChallengeMachineObjectTable: ; d572 (3:5572) Script_ChallengeMachine: ; d57d (3:557d) start_script run_command Func_ccdc - tx Text05bd + tx ItsTheChallengeMachineText run_command Func_d43d quit_script_fully Script_Tech1: ; d583 (3:5583) - INCROM $d583, $d5ca + lb bc, 0, EnergyCardListEnd - EnergyCardList + ld hl, EnergyCardList +.count_loop + ld a, [hli] + call GetCardCountInCollection + add b + ld b, a + dec c + jr nz, .count_loop + ld a, b + cp 10 + jr c, .low_on_energies + + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_text Tech1MasterMedalExplanationText, Tech1AutoDeckMachineExplanationText + quit_script_fully + +.low_on_energies + ld c, EnergyCardListEnd - EnergyCardList + ld hl, EnergyCardList +.next_energy_card + ld b, 10 + ld a, [hli] +.add_loop + push af + call AddCardToCollection + pop af + dec b + jr nz, .add_loop + dec c + jr nz, .next_energy_card + + start_script + print_text_string Tech1FewEnergyCardsText + pause_song + play_song MUSIC_BOOSTER_PACK + print_text_string Tech1ReceivedEnergyCardsText + wait_for_song_to_finish + resume_song + print_text_quit_fully Tech1GoodbyeText + +EnergyCardList: ; d5c4 (3:55c4) + db GRASS_ENERGY + db FIRE_ENERGY + db WATER_ENERGY + db LIGHTNING_ENERGY + db FIGHTING_ENERGY + db PSYCHIC_ENERGY +EnergyCardListEnd: Script_Tech2: ; d5ca (3:55ca) - INCROM $d5ca, $d5d5 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_text Tech2LegendaryCardsExplanationText, Tech2LegendaryCardsCongratsText + quit_script_fully Script_Tech3: ; d5d5 (3:55d5) INCROM $d5d5, $d5e0 @@ -3513,8 +3565,7 @@ AfterTutorialBattleScript: ; d834 (3:5834) print_text_string Text05f4 close_text_box pause_song - run_command Func_d40f - try_give_medal_pc_packs + play_song MUSIC_BOOSTER_PACK run_command Func_ccdc tx Text05f5 wait_for_song_to_finish diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 4815618..8759551 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1067,7 +1067,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw Func_d3e0 dw Func_d3fe dw Func_d408 - dw Func_d40f + dw ScriptCommand_PlaySong dw ScriptCommand_PlaySFX dw ScriptCommand_PauseSong dw ScriptCommand_ResumeSong diff --git a/src/engine/home.asm b/src/engine/home.asm index 7a3714d..f255bb4 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -11331,7 +11331,7 @@ DivideBCbyDE: ; 3c5a (0:3c5a) jr nz, .asm_3c63 ret -CallPlaySong: ; 3c83 (0:3c83) +ScriptPlaySong: ; 3c83 (0:3c83) call PlaySong ret diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 6836b4d..54f78e9 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -77,7 +77,7 @@ ENDM const Func_d3e0_index ; $45 const Func_d3fe_index ; $46 const Func_d408_index ; $47 - const Func_d40f_index ; $48 + const ScriptCommand_PlaySong_index ; $48 const ScriptCommand_PlaySFX_index ; $49 const ScriptCommand_PauseSong_index ; $4a const ScriptCommand_ResumeSong_index ; $4b @@ -346,6 +346,12 @@ script_nop: MACRO run_command ScriptCommand_nop ENDM +; Plays a song +play_song: MACRO + run_command ScriptCommand_PlaySong + db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) +ENDM + ; Plays a sound effect play_sfx: MACRO run_command ScriptCommand_PlaySFX diff --git a/src/text/text6.asm b/src/text/text6.asm index 901e9fe..3c70229 100644 --- a/src/text/text6.asm +++ b/src/text/text6.asm @@ -932,12 +932,12 @@ Text05bc: ; 4ab23 (12:6b23) line " A new journey has just begun...”" done -Text05bd: ; 4ad20 (12:6d20) +ItsTheChallengeMachineText: ; 4ad20 (12:6d20) text "It's the Challenge Machine," line "created by Dr. Mason!" done -Text05be: ; 4ad53 (12:6d53) +Tech1MasterMedalExplanationText: ; 4ad53 (12:6d53) text "The 8 Club Masters each own a" line "Master Medal." line "The secret of each Club's deck is" @@ -949,7 +949,7 @@ Text05be: ; 4ad53 (12:6d53) line "different Decks!" done -Text05bf: ; 4ae4d (12:6e4d) +Tech1AutoDeckMachineExplanationText: ; 4ae4d (12:6e4d) text "You finally inherited the" line "Legendary Pokémon Cards!" line "Did you see the Legendary Auto" @@ -960,7 +960,7 @@ Text05bf: ; 4ae4d (12:6e4d) line "to a very powerful deck!" done -Text05c0: ; 4af26 (12:6f26) +Tech1FewEnergyCardsText: ; 4af26 (12:6f26) text "Excuse me, but you don't seem " line "to have many Energy cards." line "Building a deck must be difficult " @@ -968,17 +968,17 @@ Text05c0: ; 4af26 (12:6f26) line "Here, take these!" done -Text05c1: ; 4afb0 (12:6fb0) +Tech1ReceivedEnergyCardsText: ; 4afb0 (12:6fb0) text " received some " line "Energy cards!" done -Text05c2: ; 4afd0 (12:6fd0) +Tech1GoodbyeText: ; 4afd0 (12:6fd0) text "Goodbye!" line "Take care!" done -Text05c3: ; 4afe5 (12:6fe5) +Tech2LegendaryCardsExplanationText: ; 4afe5 (12:6fe5) text "Are you also hoping to inherit" line "the Legendary Pokémon Cards?" line "If you want the Legendary Cards," @@ -991,7 +991,7 @@ Text05c3: ; 4afe5 (12:6fe5) line "more about the Legendary Cards." done -Text05c4: ; 4b129 (12:7129) +Tech2LegendaryCardsCongratsText: ; 4b129 (12:7129) text "You finally inherited the" line "Legendary Pokémon Cards!" line "Amazing!" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 3e9e463..ccaa251 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -1470,14 +1470,14 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text05ba ; 0x05ba textpointer Text05bb ; 0x05bb textpointer Text05bc ; 0x05bc - textpointer Text05bd ; 0x05bd - textpointer Text05be ; 0x05be - textpointer Text05bf ; 0x05bf - textpointer Text05c0 ; 0x05c0 - textpointer Text05c1 ; 0x05c1 - textpointer Text05c2 ; 0x05c2 - textpointer Text05c3 ; 0x05c3 - textpointer Text05c4 ; 0x05c4 + textpointer ItsTheChallengeMachineText ; 0x05bd + textpointer Tech1MasterMedalExplanationText ; 0x05be + textpointer Tech1AutoDeckMachineExplanationText ; 0x05bf + textpointer Tech1FewEnergyCardsText ; 0x05c0 + textpointer Tech1ReceivedEnergyCardsText ; 0x05c1 + textpointer Tech1GoodbyeText ; 0x05c2 + textpointer Tech2LegendaryCardsExplanationText ; 0x05c3 + textpointer Tech2LegendaryCardsCongratsText ; 0x05c4 textpointer Text05c5 ; 0x05c5 textpointer Text05c6 ; 0x05c6 textpointer Text05c7 ; 0x05c7 diff --git a/tools/script_extractor.py b/tools/script_extractor.py index 8869c66..ed8eaf9 100755 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -86,9 +86,9 @@ def decodeLine(scriptList, game_data, loc, ignore_broken, locList): wordLoc = (game_data[loc] + (game_data[loc+1]<<8)) if wordLoc == 0000: if macroMode: - ret += "NO_JUMP, " + ret += "NULL, " else: - ret += "\tdw NO_JUMP\n" + ret += "\tdw NULL\n" else: if macroMode: ret += ".ows_" + format(wordLoc+0x8000,"04x") + ", " @@ -285,7 +285,7 @@ def createList(): # this is a func just so all this can go at the bottom ("Func_d3e0", "", DO_NOT_QUIT,""), ("Func_d3fe", "q", DO_NOT_QUIT,""), ("Func_d408", "b", DO_NOT_QUIT,""), - ("Func_d40f", "q", DO_NOT_QUIT,""), + ("ScriptCommand_PlaySong", "b", DO_NOT_QUIT,"play_song"), ("ScriptCommand_PlaySFX", "b", DO_NOT_QUIT,"play_sfx"), ("ScriptCommand_PauseSong", "", DO_NOT_QUIT,"pause_song"), ("ScriptCommand_ResumeSong", "", DO_NOT_QUIT,"resume_song"), -- cgit v1.2.3 From c8c78a2213f23ca6425feea875be596c8019e8eb Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 9 Jan 2021 23:57:21 -0600 Subject: Add Script_Sam --- src/engine/bank03.asm | 176 +++++++++++++++++++++++++++++++++++----- src/engine/bank04.asm | 27 +++--- src/engine/bank07.asm | 2 +- src/engine/effect_functions.asm | 4 +- src/macros/scripts.asm | 14 ++-- src/text/text3.asm | 16 ++-- src/text/text6.asm | 12 +-- src/text/text_offsets.asm | 28 +++---- src/wram.asm | 2 +- 9 files changed, 212 insertions(+), 69 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index d94963d..3608d97 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2425,7 +2425,11 @@ Func_cfd4: ; cfd4 (3:4fd4) jp IncreaseScriptPointerBy1 Data_d006: ; d006 (3:5006) - INCROM $d006, $d00b + db GRAVELER + db OMASTAR + db PARASECT + db RAPIDASH + db WEEZING Func_d00b: ; d00b (3:500b) sla c @@ -2813,16 +2817,16 @@ ScriptCommand_ChooseDeckToDuelAgainstMultichoice: ; d24c (3:524c) .multichoice_menu_args ; d25e dw NULL ; NPC title for textbox under menu - tx Text03f9 ; text for textbox under menu + tx SelectDeckToDuelText ; 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 dw wMultichoiceTextboxResult_ChooseDeckToDuelAgainst ; ram location to return result into dw .text_entries ; location of table containing text entries .text_entries ; d269 - tx Text03f6 - tx Text03f7 - tx Text03f8 + tx LightningAndFireDeckChoiceText + tx WaterAndFightingDeckChoiceText + tx GrassAndPsychicDeckChoiceText dw NULL @@ -2834,16 +2838,16 @@ ScriptCommand_ChooseStarterDeckMultichoice: ; d271 (3:5271) .multichoice_menu_args ; d27b dw NULL ; NPC title for textbox under menu - tx Text03fd ; text for textbox under menu + tx SelectDeckToTakeText ; 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 dw wd693 ; ram location to return result into dw .text_entries ; location of table containing text entries .text_entries - tx Text03fa - tx Text03fb - tx Text03fc + tx CharmanderAndFriendsDeckChoiceText + tx SquirtleAndFriendsDeckChoiceText + tx BulbasaurAndFriendsDeckChoiceText ; displays a textbox with multiple choices and a cursor. ; takes as an argument in h1 a pointer to a table @@ -3395,28 +3399,156 @@ Script_Tech2: ; d5ca (3:55ca) quit_script_fully Script_Tech3: ; d5d5 (3:55d5) - INCROM $d5d5, $d5e0 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_text Tech3BoosterPackExplanationText, Tech3LegendaryCardsCongratsText + quit_script_fully Script_Tech4: ; d5e0 (3:55e0) - INCROM $d5e0, $d5eb + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_text Tech4ClubsExplanationText, Tech4DefeatedTheGrandMastersText + quit_script_fully Preload_Tech5: ; d5eb (3:55eb) - INCROM $d5eb, $d5f9 + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + or a + jr z, .skip + ld hl, wLoadNPCXPos + inc [hl] + inc [hl] +.skip + scf + ret Script_Tech5: ; d5f9 (3:55f9) - INCROM $d5f9, $d604 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_text Tech5DiaryAndEmailExplanationText, Tech5ChallengeMachineExplanationText + quit_script_fully Preload_Sam: ; d604 (3:5604) - INCROM $d604, $d61d + get_flag_value EVENT_FLAG_3E + cp $01 + jr nc, .skip + ld a, $0a + ld [wLoadNPCXPos], a + ld a, $08 + ld [wLoadNPCYPos], a + ld a, SOUTH + ld [wLoadNPCDirection], a +.skip + scf + ret Script_Sam: ; d61d (3:561d) - INCROM $d61d, $d68a + start_script + show_sam_normal_multichoice + close_text_box + jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d63b + jump_if_flag_equal EVENT_FLAG_75, $02, Script_d6b0 + jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d637 + print_text_string Text05cb + ask_question_jump Text05cc, .ows_d647 +.ows_d637 + print_text_string Text05cd + quit_script_fully + +.ows_d63b + print_text_string Text05ce + ask_question_jump Text05cf, .ows_d647 + print_text_string Text05d0 + quit_script_fully + +.ows_d647 + close_text_box + jump_if_player_coords_match 4, 12, .ows_above_sam + jump_if_player_coords_match 2, 14, .ows_left_of_sam +; ows_below_sam + set_player_direction WEST + move_player WEST, 1 + set_player_direction NORTH + move_player NORTH, 1 +.ows_left_of_sam + set_player_direction NORTH + move_player NORTH, 1 + set_player_direction EAST + move_player EAST, 1 +.ows_above_sam + set_player_direction EAST + move_player EAST, 1 + move_player EAST, 1 + move_player EAST, 1 + set_player_direction SOUTH + move_player SOUTH, 1 + set_player_direction WEST + move_active_npc NPCMovement_d889 + jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d685 + start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully + +.ows_d685 + start_battle PRIZES_2, SAMS_NORMAL_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatSam: ; d68a (3:568a) - INCROM $d68a, $d69f + start_script + jump_if_flag_equal EVENT_FLAG_3E, $01, Script_d82d + jump_if_flag_equal EVENT_FLAG_75, $01, Script_d6ad + print_text_string Text05d1 + give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER + print_text_quit_fully Text05d2 Script_LostToSam: ; d69f (3:569f) - INCROM $d69f, $d710 + start_script + jump_if_flag_equal EVENT_FLAG_3E, $01, Script_d82d + jump_if_flag_equal EVENT_FLAG_75, $01, Script_d6ad + print_text_quit_fully Text05d3 + +Script_d6ad: + print_text_quit_fully Text05d4 + +Script_d6b0: + print_text_string Text05d5 +.ows_d6b3 + close_text_box + show_sam_tutorial_multichoice + close_text_box + jump_if_flag_equal EVENT_FLAG_75, $07, Script_Sam.ows_d637 + jump_if_flag_equal EVENT_FLAG_75, $01, .ows_d6df + jump_if_flag_equal EVENT_FLAG_75, $02, .ows_d6e5 + jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d6eb + jump_if_flag_equal EVENT_FLAG_75, $04, .ows_d6f1 + jump_if_flag_equal EVENT_FLAG_75, $05, .ows_d6f7 + jump_if_flag_equal EVENT_FLAG_75, $06, .ows_d6fd + print_text_string Text05d6 + script_jump .ows_d6b3 +.ows_d6df + print_text_string Text05d7 + script_jump .ows_d6b3 +.ows_d6e5 + print_text_string Text05d8 + script_jump .ows_d6b3 +.ows_d6eb + print_text_string Text05d9 + script_jump .ows_d6b3 +.ows_d6f1 + print_text_string Text05da + script_jump .ows_d6b3 +.ows_d6f7 + print_text_string Text05db + script_jump .ows_d6b3 +.ows_d6fd + print_text_string Text05dc + script_jump .ows_d6b3 + +Func_d703: ; d703 (3:5703) + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + or a + ret z + ld a, $0a + farcall Func_80ba4 + ret Preload_DrMason: ; d710 (3:5710) INCROM $d710, $d727 @@ -3532,9 +3664,12 @@ Script_d827: ; d827 (3:5827) start_script start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully -; 0xd82d - INCROM $d82d, $d834 +Script_d82d: + close_advanced_text_box + set_next_npc_and_script $01, AfterTutorialBattleScript + end_script_loop + ret AfterTutorialBattleScript: ; d834 (3:5834) start_script @@ -3590,6 +3725,7 @@ NPCMovement_d882: ; d882 (3:5882) db WEST db WEST db SOUTH +NPCMovement_d889: ; d889 (3:5889) db EAST | NO_MOVE db $ff @@ -3887,7 +4023,7 @@ Script_Imakuni: ; dd0d (3:5d0d) Script_BeatImakuni: ; dd2d (3:5d2d) start_script jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $07, .giveBoosters - script_increment_flag_value EVENT_IMAKUNI_WIN_COUNT + 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 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 8759551..db3ae26 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -74,7 +74,7 @@ Medal_1029e: ; 1029e (4:429e) add a ld c, a ld b, $0 - ld hl, Unknown_1030b + ld hl, MasterMedalNames add hl, bc ld a, [hli] ld [wTxRam2], a @@ -104,8 +104,15 @@ Medal_1029e: ; 1029e (4:429e) ld [wd291], a ret -Unknown_1030b: ; 1030b (4:430b) - INCROM $1030b, $1031b +MasterMedalNames: ; 1030b (4:430b) + tx GrassClubMapNameText + tx ScienceClubMapNameText + tx FireClubMapNameText + tx WaterClubMapNameText + tx LightningClubMapNameText + tx PsychicClubMapNameText + tx RockClubMapNameText + tx FightingClubMapNameText BoosterPack_1031b: ; 1031b (4:431b) ld c, a @@ -1105,11 +1112,11 @@ MultichoiceTextbox_ConfigTable_ChooseDeckToDuelAgainst: ;1224b db $04, $00 ; x, y to start drawing box db $10, $08 ; width, height of box db $06, $02 ; x, y coordinate to start printing next text - tx Text03f6 ; text id to print next + tx LightningAndFireDeckChoiceText ; text id to print next db $06, $04 ; x, y coordinate to start printing next text - tx Text03f7 ; text id to print next + tx WaterAndFightingDeckChoiceText ; text id to print next db $06, $06 ; x, y coordinate to start printing next text - tx Text03f8 ; text id to print next + tx GrassAndPsychicDeckChoiceText ; text id to print next db $ff ; marker byte -- end text entries db $05, $02 ; cursor starting x, y db $02 ; number of tiles the cursor moves per toggle @@ -1122,11 +1129,11 @@ MultichoiceTextbox_ConfigTable_ChooseDeckStarterDeck: ;12264 db $04, $00 ; x, y to start drawing box db $10, $08 ; width, height of box db $06, $02 ; x, y coordinate to start printing next text - tx Text03fa ; text id to print next + tx CharmanderAndFriendsDeckChoiceText ; text id to print next db $06, $04 ; x, y coordinate to start printing next text - tx Text03fb ; text id to print next + tx SquirtleAndFriendsDeckChoiceText ; text id to print next db $06, $06 ; x, y coordinate to start printing next text - tx Text03fc ; text id to print next + tx BulbasaurAndFriendsDeckChoiceText ; text id to print next db $ff ; marker byte -- end text entries db $05, $02 ; cursor starting x, y db $02 ; number of tiles the cursor moves per toggle @@ -1142,7 +1149,7 @@ SamNormalMultichoice_ConfigurationTable: ;1227d tx Text03ff ; text id to print next db $ff ; marker byte -- end text entries db $0b, $02 ; cursor starting x, y - db $02 ; number of tiles the cursor moves per toggle + db $02 ; number of tiles the cursor moves per toggle db $04 ; cursor max index db $0f ; cursor image diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 1430c81..ea6e432 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -1160,7 +1160,7 @@ Func_1cc03: ; 1cc03 (7:4c03) ret ; 0x1cc2f -.Func_1cc2f +.Func_1cc2f ld a, $4e .loop inc a diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 0fc94d4..1394815 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -495,7 +495,7 @@ ApplyAndAnimateHPRecovery: ; 2c221 (b:4221) ld e, a ld a, 0 adc d - ld d, a + ld d, a ; de = damage dealt + current HP ; bc = max HP of card call CompareDEtoBC @@ -9097,7 +9097,7 @@ MorphEffect: ; 2eff6 (b:6ff6) .successful ld a, DUELVARS_ARENA_CARD_STAGE call GetTurnDuelistVariable - or a + or a jr z, .skip_discard_stage_below ; if this is a stage 1 Pokemon (in case it's used diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 54f78e9..5884ffc 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -477,22 +477,22 @@ zero_out_flag_value: MACRO 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 +; Jumps to a script position if a flag is nonzero +jump_if_flag_nonzero_2: MACRO + run_command ScriptCommand_JumpIfFlagNonzero2 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 +; Jumps to a script position if a flag is zero +jump_if_flag_zero_2: MACRO + run_command ScriptCommand_JumpIfFlagZero2 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 +increment_flag_value: MACRO run_command ScriptCommand_IncrementFlagValue db \1 ; flag (ex EVENT_FLAG_11) ENDM diff --git a/src/text/text3.asm b/src/text/text3.asm index a0cf867..e7dadf6 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -1916,36 +1916,36 @@ FlyingPikachuTradeCardName: ; 3f8f7 (f:78f7) text "12 FLYING PIKACHU" done -Text03f6: ; 3f90c (f:790c) +LightningAndFireDeckChoiceText: ; 3f90c (f:790c) text "Lightning & Fire Deck" done -Text03f7: ; 3f923 (f:7923) +WaterAndFightingDeckChoiceText: ; 3f923 (f:7923) text "Water & Fighting Deck" done -Text03f8: ; 3f93a (f:793a) +GrassAndPsychicDeckChoiceText: ; 3f93a (f:793a) text "Grass & Psychic Deck" done -Text03f9: ; 3f950 (f:7950) +SelectDeckToDuelText: ; 3f950 (f:7950) text "Please select the Deck" line "you wish to Duel against." done -Text03fa: ; 3f982 (f:7982) +CharmanderAndFriendsDeckChoiceText: ; 3f982 (f:7982) text "CHARMANDER & Friends Deck" done -Text03fb: ; 3f99d (f:799d) +SquirtleAndFriendsDeckChoiceText: ; 3f99d (f:799d) text "SQUIRTLE & Friends Deck" done -Text03fc: ; 3f9b6 (f:79b6) +BulbasaurAndFriendsDeckChoiceText: ; 3f9b6 (f:79b6) text "BULBASAUR & Friends Deck" done -Text03fd: ; 3f9d0 (f:79d0) +SelectDeckToTakeText: ; 3f9d0 (f:79d0) text "Please select the Deck you want." done diff --git a/src/text/text6.asm b/src/text/text6.asm index 3c70229..eb045ea 100644 --- a/src/text/text6.asm +++ b/src/text/text6.asm @@ -998,7 +998,7 @@ Tech2LegendaryCardsCongratsText: ; 4b129 (12:7129) line "Congratulations, !!!" done -Text05c5: ; 4b17c (12:717c) +Tech3BoosterPackExplanationText: ; 4b17c (12:717c) text "When you defeat a Club Member," line "you'll receive a Booster Pack." line "Each Booster Pack has 10 cards." @@ -1009,7 +1009,7 @@ Text05c5: ; 4b17c (12:717c) line "so choose your opponents well." done -Text05c6: ; 4b274 (12:7274) +Tech3LegendaryCardsCongratsText: ; 4b274 (12:7274) text "Congratulations on inheriting " line "the Legendary Pokémon Cards," line "" @@ -1019,7 +1019,7 @@ Text05c6: ; 4b274 (12:7274) line "you'll have a good time!" done -Text05c7: ; 4b323 (12:7323) +Tech4ClubsExplanationText: ; 4b323 (12:7323) text "I'm sure you already know, but there" line "are 8 Clubs: the Fighting, Water," line "Lightning, Grass, Psychic, Fire," @@ -1028,14 +1028,14 @@ Text05c7: ; 4b323 (12:7323) line "are specific to that Club." done -Text05c8: ; 4b3e2 (12:73e2) +Tech4DefeatedTheGrandMastersText: ; 4b3e2 (12:73e2) text "Amazing! You beat the 8 Club " line "Masters!" line "And you even defeated the" line "4 Grand Masters! Amazing!" done -Text05c9: ; 4b43e (12:743e) +Tech5DiaryAndEmailExplanationText: ; 4b43e (12:743e) text "To save your game, press START" line "and choose Diary from the Menu." line "You can do all sorts of stuff with" @@ -1044,7 +1044,7 @@ Text05c9: ; 4b43e (12:743e) line "Dr. Mason on that PC, too!" done -Text05ca: ; 4b4ea (12:74ea) +Tech5ChallengeMachineExplanationText: ; 4b4ea (12:74ea) text "This is the Challenge Machine" line "created by Dr. Mason!" line "The Challenge Machine is a " diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index ccaa251..50838e6 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -1015,14 +1015,14 @@ TextOffsets:: ; 34000 (d:4000) textpointer DragoniteLegendaryCardName ; 0x03f3 textpointer SuperEnergyRetrievalTradeCardName ; 0x03f4 textpointer FlyingPikachuTradeCardName ; 0x03f5 - textpointer Text03f6 ; 0x03f6 - textpointer Text03f7 ; 0x03f7 - textpointer Text03f8 ; 0x03f8 - textpointer Text03f9 ; 0x03f9 - textpointer Text03fa ; 0x03fa - textpointer Text03fb ; 0x03fb - textpointer Text03fc ; 0x03fc - textpointer Text03fd ; 0x03fd + textpointer LightningAndFireDeckChoiceText ; 0x03f6 + textpointer WaterAndFightingDeckChoiceText ; 0x03f7 + textpointer GrassAndPsychicDeckChoiceText ; 0x03f8 + textpointer SelectDeckToDuelText ; 0x03f9 + textpointer CharmanderAndFriendsDeckChoiceText ; 0x03fa + textpointer SquirtleAndFriendsDeckChoiceText ; 0x03fb + textpointer BulbasaurAndFriendsDeckChoiceText ; 0x03fc + textpointer SelectDeckToTakeText ; 0x03fd textpointer HowCanIHelpText ; 0x03fe textpointer Text03ff ; 0x03ff textpointer Text0400 ; 0x0400 @@ -1478,12 +1478,12 @@ TextOffsets:: ; 34000 (d:4000) textpointer Tech1GoodbyeText ; 0x05c2 textpointer Tech2LegendaryCardsExplanationText ; 0x05c3 textpointer Tech2LegendaryCardsCongratsText ; 0x05c4 - textpointer Text05c5 ; 0x05c5 - textpointer Text05c6 ; 0x05c6 - textpointer Text05c7 ; 0x05c7 - textpointer Text05c8 ; 0x05c8 - textpointer Text05c9 ; 0x05c9 - textpointer Text05ca ; 0x05ca + textpointer Tech3BoosterPackExplanationText ; 0x05c5 + textpointer Tech3LegendaryCardsCongratsText ; 0x05c6 + textpointer Tech4ClubsExplanationText ; 0x05c7 + textpointer Tech4DefeatedTheGrandMastersText ; 0x05c8 + textpointer Tech5DiaryAndEmailExplanationText ; 0x05c9 + textpointer Tech5ChallengeMachineExplanationText ; 0x05ca textpointer Text05cb ; 0x05cb textpointer Text05cc ; 0x05cc textpointer Text05cd ; 0x05cd diff --git a/src/wram.asm b/src/wram.asm index c8956d9..238c36f 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -2677,7 +2677,7 @@ wd693:: ; d693 wMultichoiceTextboxResult_Sam:: ; d694 ds $1 - + UNION wMultichoiceTextboxResult_ChooseDeckToDuelAgainst:: ; d695 -- cgit v1.2.3 From c1bed788e7cf9ff226e2ca19d8e165011607815f Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 10 Jan 2021 18:24:55 -0600 Subject: Add new script extractor --- tools/script_extractor2.py | 337 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100755 tools/script_extractor2.py diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py new file mode 100755 index 0000000..30e4894 --- /dev/null +++ b/tools/script_extractor2.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python + +import argparse + +args = None +rom = None + +# script command names and parameter lists +script_commands = { + 0xe7: { "name": "start_script", "params": [] }, + + 0x00: { "name": "end_script_loop", "params": [] }, + 0x01: { "name": "close_advanced_text_box", "params": [] }, + 0x02: { "name": "print_text_string", "params": [ "text" ] }, + 0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text and ??? + 0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] }, + 0x05: { "name": "start_battle", "params": [ "byte", "byte", "byte" ] }, # prizes, deck, song + 0x06: { "name": "print_variable_text", "params": [ "text", "text" ] }, + 0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text and ??? + 0x08: { "name": "print_text_quit_fully", "params": [ "text" ] }, + 0x09: { "name": "Func_cdcb", "params": [] }, + 0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] }, + 0x0b: { "name": "close_text_box", "params": [] }, + 0x0c: { "name": "give_booster_packs", "params": [ "byte", "byte", "byte" ] }, # booster, booster, booster + 0x0d: { "name": "jump_if_card_owned", "params": [ "byte", "label" ] }, # card + 0x0e: { "name": "jump_if_card_in_collection", "params": [ "byte", "label" ] }, # card + 0x0f: { "name": "give_card", "params": [ "byte" ] }, # card + 0x10: { "name": "take_card", "params": [ "byte" ] }, # card + 0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection + 0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection + 0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] }, + 0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] }, + 0x15: { "name": "Func_cfc6", "params": [ "byte" ] }, + 0x16: { "name": "Func_cfd4", "params": [] }, + 0x17: { "name": "Func_d00b", "params": [] }, # get card name for EVENT_FLAG_2B + 0x18: { "name": "Func_d025", "params": [ "label" ] }, # jump if card in EVENT_FLAG_2B is in collection or decks + 0x19: { "name": "Func_d032", "params": [ "label" ] }, # jump if card in EVENT_FLAG_2B is in collection + 0x1a: { "name": "Func_d03f", "params": [] }, # remove card in EVENT_FLAG_2B from collection + 0x1b: { "name": "script_jump", "params": [ "label" ] }, + 0x1c: { "name": "try_give_medal_pc_packs", "params": [] }, + 0x1d: { "name": "set_player_direction", "params": [ "direction" ] }, + 0x1e: { "name": "move_player", "params": [ "direction", "byte_decimal" ] }, + 0x1f: { "name": "show_card_received_screen", "params": [ "byte" ] }, # card + 0x20: { "name": "set_dialog_npc", "params": [ "byte" ] }, # npc + 0x21: { "name": "set_next_npc_and_script", "params": [ "byte", "label" ] }, # npc + 0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06 + 0x23: { "name": "Func_d0be", "params": [ "byte", "byte" ] }, # coords + 0x24: { "name": "do_frames", "params": [ "byte_decimal" ] }, + 0x25: { "name": "Func_d0d9", "params": [ "byte", "byte", "label" ] }, # coords, jump if npc coords match + 0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, + 0x27: { "name": "move_active_npc", "params": [ "movement" ] }, + 0x28: { "name": "give_one_of_each_trainer_booster", "params": [] }, + 0x29: { "name": "Func_d103", "params": [ "byte", "label" ] }, # npc, jump if npc loaded + 0x2a: { "name": "Func_d125", "params": [ "byte" ] }, # give medal + 0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot + 0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load current npc name into tx ram slot + 0x2d: { "name": "Func_cd4f", "params": [ "byte", "byte", "byte" ] }, # prizes, deck, song + 0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, + 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, + 0x30: { "name": "Func_cdd8", "params": [] }, + 0x31: { "name": "Func_cdf5", "params": [ "byte", "byte" ] }, # coords + 0x32: { "name": "Func_d195", "params": [] }, # pick challenge hall opponent + 0x33: { "name": "Func_d1ad", "params": [] }, # open menu + 0x34: { "name": "Func_d1b3", "params": [] }, # pick trade card + 0x35: { "name": "quit_script_fully", "params": [] }, + 0x36: { "name": "Func_d244", "params": [ "byte" ] }, + 0x37: { "name": "choose_deck_to_duel_against_multichoice", "params": [] }, + 0x38: { "name": "open_deck_machine", "params": [ "byte" ] }, + 0x39: { "name": "choose_starter_deck_multichoice", "params": [] }, + 0x3a: { "name": "enter_map", "params": [ "byte", "byte", "byte_decimal", "byte_decimal", "direction" ] }, + 0x3b: { "name": "move_arbitrary_npc", "params": [ "byte", "movement" ] }, + 0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card + 0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, + 0x3e: { "name": "Func_d396", "params": [ "byte" ] }, + 0x3f: { "name": "Func_cd76", "params": [] }, + 0x40: { "name": "Func_d39d", "params": [ "byte" ] }, + 0x41: { "name": "Func_d3b9", "params": [] }, + 0x42: { "name": "try_give_pc_pack", "params": [ "byte" ] }, + 0x43: { "name": "script_nop", "params": [] }, + 0x44: { "name": "Func_d3d4", "params": [] }, + 0x45: { "name": "Func_d3e0", "params": [] }, + 0x46: { "name": "Func_d3fe", "params": [ "byte" ] }, # song + 0x47: { "name": "Func_d408", "params": [ "byte" ] }, # set default song? + 0x48: { "name": "play_song", "params": [ "byte" ] }, + 0x49: { "name": "play_sfx", "params": [ "byte" ] }, + 0x4a: { "name": "pause_song", "params": [] }, + 0x4b: { "name": "resume_song", "params": [] }, + 0x4c: { "name": "Func_d41d", "params": [] }, # play default song? + 0x4d: { "name": "wait_for_song_to_finish", "params": [] }, + 0x4e: { "name": "Func_d435", "params": [ "byte" ] }, + 0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] }, + 0x50: { "name": "show_sam_normal_multichoice", "params": [] }, + 0x51: { "name": "show_sam_tutorial_multichoice", "params": [] }, + 0x52: { "name": "Func_d43d", "params": [] }, + 0x53: { "name": "end_script_loop_2", "params": [] }, + 0x54: { "name": "end_script_loop_3", "params": [] }, + 0x55: { "name": "end_script_loop_4", "params": [] }, + 0x56: { "name": "end_script_loop_5", "params": [] }, + 0x57: { "name": "end_script_loop_6", "params": [] }, + 0x58: { "name": "script_set_flag_value", "params": [ "event", "byte" ] }, + 0x59: { "name": "jump_if_flag_zero_1", "params": [ "event", "label" ] }, + 0x5a: { "name": "jump_if_flag_nonzero_1", "params": [ "event", "label" ] }, + 0x5b: { "name": "jump_if_flag_equal", "params": [ "event", "byte", "label" ] }, + 0x5c: { "name": "jump_if_flag_not_equal", "params": [ "event", "byte", "label" ] }, + 0x5d: { "name": "jump_if_flag_not_less_than", "params": [ "event", "byte", "label" ] }, + 0x5e: { "name": "jump_if_flag_less_than", "params": [ "event", "byte", "label" ] }, + 0x5f: { "name": "max_out_flag_value", "params": [ "event" ] }, + 0x60: { "name": "zero_out_flag_value", "params": [ "event" ] }, + 0x61: { "name": "jump_if_flag_nonzero_2", "params": [ "event", "label"] }, + 0x62: { "name": "jump_if_flag_zero_2", "params": [ "event", "label" ] }, + 0x63: { "name": "increment_flag_value", "params": [ "event" ] }, + 0x64: { "name": "end_script_loop_7", "params": [] }, + 0x65: { "name": "end_script_loop_8", "params": [] }, + 0x66: { "name": "end_script_loop_9", "params": [] }, + 0x67: { "name": "end_script_loop_10", "params": [] }, +} + +quit_commands = [ + 0x00, + 0x08, + 0x1b, + 0x35, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x64, + 0x65, + 0x66, + 0x67, +] + +# length in bytes of each type of parameter +param_lengths = { + "byte": 1, + "byte_decimal": 1, + "event": 1, + "direction": 1, + "word_decimal": 2, + "movement": 2, + "movement_table": 2, + "text": 2, + "label": 2, +} + +directions = [ + "NORTH", + "EAST", + "SOUTH", + "WEST", +] + +def get_bank(address): + return int(address / 0x4000) + +def get_relative_address(address): + if address < 0x4000: + return address + return (address % 0x4000) + 0x4000 + +# get absolute pointer stored at an address in the rom +# if bank is None, assumes the pointer refers to the same bank as the bank it is located in +def get_pointer(address, bank=None): + raw_pointer = rom[address + 1] * 0x100 + rom[address] + if raw_pointer < 0x4000: + bank = 0 + if bank is None: + bank = get_bank(address) + return (raw_pointer % 0x4000) + bank * 0x4000 + +def make_address_comment(address): + return " ; {:x} ({:x}:{:x})\n".format(address, get_bank(address), get_relative_address(address)) + +def make_blob(start, output, end=None): + return { "start": start, "output": output, "end": end if end else start } + +def dump_movement(address): + blobs = [] + blobs.append(make_blob(address, "NPCMovement_{:x}:".format(address) + make_address_comment(address))) + while 1: + movement = rom[address] + if movement == 0xff: + blobs.append(make_blob(address, "\tdb $ff\n\n", address + 1)) + break + blobs.append(make_blob(address, "\tdb {}".format(directions[movement & 0b01111111]) + (" | NO_MOVE\n" if movement & 0b10000000 else "\n"), address + 1)) + address += 1 + return blobs + +def dump_movement_table(address): + blobs = [] + blobs.append(make_blob(address, "NPCMovementTable_{:x}:".format(address) + make_address_comment(address))) + for i in range(4): + pointer = get_pointer(address) + blobs.append(make_blob(address, "\tdw NPCMovement_{:x}\n".format(pointer) + ("\n" if i == 3 else ""), address + 2)) + blobs += dump_movement(pointer) + address += 2 + return blobs + +# parse a script starting at the given address +# returns a list of all commands +def dump_script(start_address, address=None, visited=set()): + blobs = [] + branches = set() + if address is None: + blobs.append(make_blob(start_address, "Script_{:x}:".format(start_address) + make_address_comment(start_address))) + address = start_address + if address in visited: + return blobs + visited.add(address) + while 1: + command_address = address + command_id = rom[command_address] + command = script_commands[command_id] + address += 1 + macro_mode = not command["name"].startswith("Func_") + if macro_mode: + output = "\t{}".format(command["name"]) + else: + output = "\trun_command {}".format(command["name"]) + # print all params for current command + for i in range(len(command["params"])): + param = rom[address] + param_type = command["params"][i] + param_length = param_lengths[param_type] + if param_type == "byte": + if not macro_mode: + output += "\n\tdb" + output += " ${:02x}".format(param) + elif param_type == "byte_decimal": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(param) + elif param_type == "event": + if not macro_mode: + output += "\n\tdb" + output += " EVENT_FLAG_{:02X}".format(param) + elif param_type == "direction": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(directions[param]) + elif param_type == "word_decimal": + if not macro_mode: + output += "\n\tdw" + output += " {}".format(param + rom[address + 1] * 0x100) + elif param_type == "movement": + param = get_pointer(address) + label = "NPCMovement_{:x}".format(param) + if not macro_mode: + output += "\n\tdw" + output += " {}".format(label) + blobs += dump_movement(param) + elif param_type == "movement_table": + param = get_pointer(address) + label = "NPCMovementTable_{:x}".format(param) + if not macro_mode: + output += "\n\tdw" + output += " {}".format(label) + blobs += dump_movement_table(param) + elif param_type == "text": + text_id = param + rom[address + 1] * 0x100 + if not macro_mode: + if text_id == 0x0000: + output += "\n\tdw" + else: + output += "\n\ttx" + if text_id == 0x0000: + output += " NULL" + else: + output += " Text{:04x}".format(text_id) + elif param_type == "label": + param = get_pointer(address) + if param == 0x0000: + label = "NULL" + elif param == start_address: + label = "Script_{:x}".format(param) + else: + label = ".ows_{:x}".format(param) + if (param > start_address or args.allow_backward_jumps): + branches.add(param) + blobs.append(make_blob(param, ".ows_{:x}\n".format(param))) + if not macro_mode: + output += "\n\tdw" + output += " {}".format(label) + address += param_length + if macro_mode and i < len(command["params"]) - 1: + output += "," + output += "\n" + blobs.append(make_blob(command_address, output, address)) + if (command_id in quit_commands): + if rom[address] == 0xc9: + blobs.append(make_blob(address, "\tret\n", address + 1)) + address += 1 + blobs.append(make_blob(address, "; 0x{:x}\n\n".format(address))) + break + for branch in branches: + blobs += dump_script(start_address, branch, visited) + return blobs + +def fill_gap(start, end): + output = "" + for address in range(start, end): + output += "\tdb ${:x}\n".format(rom[address]) + output += "\n" + return output + +def sort_and_filter(blobs): + blobs.sort(key=lambda b: (b["start"], b["end"], len(b["output"]), not b["output"].startswith(";"))) + filtered = [] + for blob, next in zip(blobs, blobs[1:]+[None]): + if next and blob["start"] == next["start"] and blob["output"] == next["output"]: + continue + if next and blob["end"] < next["start"] and get_bank(blob["end"]) == get_bank(next["start"]): + if args.fill_gaps: + blob["output"] += fill_gap(blob["end"], next["start"]) + else: + blob["output"] += "; gap from 0x{:x} to 0x{:x}\n\n".format(blob["end"], next["start"]) + filtered.append(blob) + filtered[-1]["output"] = filtered[-1]["output"].rstrip("\n") + return filtered + +if __name__ == "__main__": + ap = argparse.ArgumentParser(description="Pokemon TCG Script Extractor") + ap.add_argument("-b", "--allow-backward-jumps", action="store_true", help="extract scripts that are found before the starting address") + ap.add_argument("-g", "--fill-gaps", action="store_true", help="use 'db's to fill the gaps between visited locations") + ap.add_argument("-r", "--rom", default="baserom.gbc", help="rom file to extract script from") + ap.add_argument("addresses", nargs="+", help="addresses to extract from") + args = ap.parse_args() + rom = bytearray(open(args.rom, "rb").read()) + blobs = [] + for address in args.addresses: + blobs += dump_script(int(address, 16)) + blobs = sort_and_filter(blobs) + output = "" + for blob in blobs: + output += blob["output"] + print(output) -- cgit v1.2.3 From 8e4f8050fcea856982bb942e43b3d07c71e7aa3f Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 10 Jan 2021 21:34:45 -0600 Subject: Use more automatic constants in script_extractor2 --- tools/constants.py | 739 +++++++++++++++++++++++++++++++++++++++++++++ tools/script_extractor2.py | 99 ++++-- 2 files changed, 810 insertions(+), 28 deletions(-) create mode 100644 tools/constants.py diff --git a/tools/constants.py b/tools/constants.py new file mode 100644 index 0000000..d54b0be --- /dev/null +++ b/tools/constants.py @@ -0,0 +1,739 @@ +boosters = { + 0x00: "BOOSTER_COLOSSEUM_NEUTRAL", + 0x01: "BOOSTER_COLOSSEUM_GRASS", + 0x02: "BOOSTER_COLOSSEUM_FIRE", + 0x03: "BOOSTER_COLOSSEUM_WATER", + 0x04: "BOOSTER_COLOSSEUM_LIGHTNING", + 0x05: "BOOSTER_COLOSSEUM_FIGHTING", + 0x06: "BOOSTER_COLOSSEUM_TRAINER", + 0x07: "BOOSTER_EVOLUTION_NEUTRAL", + 0x08: "BOOSTER_EVOLUTION_GRASS", + 0x09: "BOOSTER_EVOLUTION_FIRE", + 0x0a: "BOOSTER_EVOLUTION_WATER", + 0x0b: "BOOSTER_EVOLUTION_FIGHTING", + 0x0c: "BOOSTER_EVOLUTION_PSYCHIC", + 0x0d: "BOOSTER_EVOLUTION_TRAINER", + 0x0e: "BOOSTER_MYSTERY_NEUTRAL", + 0x0f: "BOOSTER_MYSTERY_GRASS_COLORLESS", + 0x10: "BOOSTER_MYSTERY_WATER_COLORLESS", + 0x11: "BOOSTER_MYSTERY_LIGHTNING_COLORLESS", + 0x12: "BOOSTER_MYSTERY_FIGHTING_COLORLESS", + 0x13: "BOOSTER_MYSTERY_TRAINER_COLORLESS", + 0x14: "BOOSTER_LABORATORY_NEUTRAL", + 0x15: "BOOSTER_LABORATORY_GRASS", + 0x16: "BOOSTER_LABORATORY_WATER", + 0x17: "BOOSTER_LABORATORY_PSYCHIC", + 0x18: "BOOSTER_LABORATORY_TRAINER", + 0x19: "BOOSTER_ENERGY_LIGHTNING_FIRE", + 0x1a: "BOOSTER_ENERGY_WATER_FIGHTING", + 0x1b: "BOOSTER_ENERGY_GRASS_PSYCHIC", + 0x1c: "BOOSTER_ENERGY_RANDOM", + 0xff: "NO_BOOSTER", +} + +cards = { + 0x00: "VARIABLE_CARD", + 0x01: "GRASS_ENERGY", + 0x02: "FIRE_ENERGY", + 0x03: "WATER_ENERGY", + 0x04: "LIGHTNING_ENERGY", + 0x05: "FIGHTING_ENERGY", + 0x06: "PSYCHIC_ENERGY", + 0x07: "DOUBLE_COLORLESS_ENERGY", + 0x08: "BULBASAUR", + 0x09: "IVYSAUR", + 0x0a: "VENUSAUR1", + 0x0b: "VENUSAUR2", + 0x0c: "CATERPIE", + 0x0d: "METAPOD", + 0x0e: "BUTTERFREE", + 0x0f: "WEEDLE", + 0x10: "KAKUNA", + 0x11: "BEEDRILL", + 0x12: "EKANS", + 0x13: "ARBOK", + 0x14: "NIDORANF", + 0x15: "NIDORINA", + 0x16: "NIDOQUEEN", + 0x17: "NIDORANM", + 0x18: "NIDORINO", + 0x19: "NIDOKING", + 0x1a: "ZUBAT", + 0x1b: "GOLBAT", + 0x1c: "ODDISH", + 0x1d: "GLOOM", + 0x1e: "VILEPLUME", + 0x1f: "PARAS", + 0x20: "PARASECT", + 0x21: "VENONAT", + 0x22: "VENOMOTH", + 0x23: "BELLSPROUT", + 0x24: "WEEPINBELL", + 0x25: "VICTREEBEL", + 0x26: "GRIMER", + 0x27: "MUK", + 0x28: "EXEGGCUTE", + 0x29: "EXEGGUTOR", + 0x2a: "KOFFING", + 0x2b: "WEEZING", + 0x2c: "TANGELA1", + 0x2d: "TANGELA2", + 0x2e: "SCYTHER", + 0x2f: "PINSIR", + 0x30: "CHARMANDER", + 0x31: "CHARMELEON", + 0x32: "CHARIZARD", + 0x33: "VULPIX", + 0x34: "NINETAILS1", + 0x35: "NINETAILS2", + 0x36: "GROWLITHE", + 0x37: "ARCANINE1", + 0x38: "ARCANINE2", + 0x39: "PONYTA", + 0x3a: "RAPIDASH", + 0x3b: "MAGMAR1", + 0x3c: "MAGMAR2", + 0x3d: "FLAREON1", + 0x3e: "FLAREON2", + 0x3f: "MOLTRES1", + 0x40: "MOLTRES2", + 0x41: "SQUIRTLE", + 0x42: "WARTORTLE", + 0x43: "BLASTOISE", + 0x44: "PSYDUCK", + 0x45: "GOLDUCK", + 0x46: "POLIWAG", + 0x47: "POLIWHIRL", + 0x48: "POLIWRATH", + 0x49: "TENTACOOL", + 0x4a: "TENTACRUEL", + 0x4b: "SEEL", + 0x4c: "DEWGONG", + 0x4d: "SHELLDER", + 0x4e: "CLOYSTER", + 0x4f: "KRABBY", + 0x50: "KINGLER", + 0x51: "HORSEA", + 0x52: "SEADRA", + 0x53: "GOLDEEN", + 0x54: "SEAKING", + 0x55: "STARYU", + 0x56: "STARMIE", + 0x57: "MAGIKARP", + 0x58: "GYARADOS", + 0x59: "LAPRAS", + 0x5a: "VAPOREON1", + 0x5b: "VAPOREON2", + 0x5c: "OMANYTE", + 0x5d: "OMASTAR", + 0x5e: "ARTICUNO1", + 0x5f: "ARTICUNO2", + 0x60: "PIKACHU1", + 0x61: "PIKACHU2", + 0x62: "PIKACHU3", + 0x63: "PIKACHU4", + 0x64: "FLYING_PIKACHU", + 0x65: "SURFING_PIKACHU1", + 0x66: "SURFING_PIKACHU2", + 0x67: "RAICHU1", + 0x68: "RAICHU2", + 0x69: "MAGNEMITE1", + 0x6a: "MAGNEMITE2", + 0x6b: "MAGNETON1", + 0x6c: "MAGNETON2", + 0x6d: "VOLTORB", + 0x6e: "ELECTRODE1", + 0x6f: "ELECTRODE2", + 0x70: "ELECTABUZZ1", + 0x71: "ELECTABUZZ2", + 0x72: "JOLTEON1", + 0x73: "JOLTEON2", + 0x74: "ZAPDOS1", + 0x75: "ZAPDOS2", + 0x76: "ZAPDOS3", + 0x77: "SANDSHREW", + 0x78: "SANDSLASH", + 0x79: "DIGLETT", + 0x7a: "DUGTRIO", + 0x7b: "MANKEY", + 0x7c: "PRIMEAPE", + 0x7d: "MACHOP", + 0x7e: "MACHOKE", + 0x7f: "MACHAMP", + 0x80: "GEODUDE", + 0x81: "GRAVELER", + 0x82: "GOLEM", + 0x83: "ONIX", + 0x84: "CUBONE", + 0x85: "MAROWAK1", + 0x86: "MAROWAK2", + 0x87: "HITMONLEE", + 0x88: "HITMONCHAN", + 0x89: "RHYHORN", + 0x8a: "RHYDON", + 0x8b: "KABUTO", + 0x8c: "KABUTOPS", + 0x8d: "AERODACTYL", + 0x8e: "ABRA", + 0x8f: "KADABRA", + 0x90: "ALAKAZAM", + 0x91: "SLOWPOKE1", + 0x92: "SLOWPOKE2", + 0x93: "SLOWBRO", + 0x94: "GASTLY1", + 0x95: "GASTLY2", + 0x96: "HAUNTER1", + 0x97: "HAUNTER2", + 0x98: "GENGAR", + 0x99: "DROWZEE", + 0x9a: "HYPNO", + 0x9b: "MR_MIME", + 0x9c: "JYNX", + 0x9d: "MEWTWO1", + 0x9e: "MEWTWO2", + 0x9f: "MEWTWO3", + 0xa0: "MEW1", + 0xa1: "MEW2", + 0xa2: "MEW3", + 0xa3: "PIDGEY", + 0xa4: "PIDGEOTTO", + 0xa5: "PIDGEOT1", + 0xa6: "PIDGEOT2", + 0xa7: "RATTATA", + 0xa8: "RATICATE", + 0xa9: "SPEAROW", + 0xaa: "FEAROW", + 0xab: "CLEFAIRY", + 0xac: "CLEFABLE", + 0xad: "JIGGLYPUFF1", + 0xae: "JIGGLYPUFF2", + 0xaf: "JIGGLYPUFF3", + 0xb0: "WIGGLYTUFF", + 0xb1: "MEOWTH1", + 0xb2: "MEOWTH2", + 0xb3: "PERSIAN", + 0xb4: "FARFETCHD", + 0xb5: "DODUO", + 0xb6: "DODRIO", + 0xb7: "LICKITUNG", + 0xb8: "CHANSEY", + 0xb9: "KANGASKHAN", + 0xba: "TAUROS", + 0xbb: "DITTO", + 0xbc: "EEVEE", + 0xbd: "PORYGON", + 0xbe: "SNORLAX", + 0xbf: "DRATINI", + 0xc0: "DRAGONAIR", + 0xc1: "DRAGONITE1", + 0xc2: "DRAGONITE2", + 0xc3: "PROFESSOR_OAK", + 0xc4: "IMPOSTER_PROFESSOR_OAK", + 0xc5: "BILL", + 0xc6: "MR_FUJI", + 0xc7: "LASS", + 0xc8: "IMAKUNI_CARD", + 0xc9: "POKEMON_TRADER", + 0xca: "POKEMON_BREEDER", + 0xcb: "CLEFAIRY_DOLL", + 0xcc: "MYSTERIOUS_FOSSIL", + 0xcd: "ENERGY_RETRIEVAL", + 0xce: "SUPER_ENERGY_RETRIEVAL", + 0xcf: "ENERGY_SEARCH", + 0xd0: "ENERGY_REMOVAL", + 0xd1: "SUPER_ENERGY_REMOVAL", + 0xd2: "SWITCH", + 0xd3: "POKEMON_CENTER", + 0xd4: "POKE_BALL", + 0xd5: "SCOOP_UP", + 0xd6: "COMPUTER_SEARCH", + 0xd7: "POKEDEX", + 0xd8: "PLUSPOWER", + 0xd9: "DEFENDER", + 0xda: "ITEM_FINDER", + 0xdb: "GUST_OF_WIND", + 0xdc: "DEVOLUTION_SPRAY", + 0xdd: "POTION", + 0xde: "SUPER_POTION", + 0xdf: "FULL_HEAL", + 0xe0: "REVIVE", + 0xe1: "MAINTENANCE", + 0xe2: "POKEMON_FLUTE", + 0xe3: "GAMBLER", + 0xe4: "RECYCLE", + 0xff: "$ff", +} + +decks = [ + "SAMS_PRACTICE_DECK_ID", + "PRACTICE_PLAYER_DECK_ID", + "SAMS_NORMAL_DECK_ID", + "CHARMANDER_AND_FRIENDS_DECK_ID", + "CHARMANDER_EXTRA_DECK_ID", + "SQUIRTLE_AND_FRIENDS_DECK_ID", + "SQUIRTLE_EXTRA_DECK_ID", + "BULBASAUR_AND_FRIENDS_DECK_ID", + "BULBASAUR_EXTRA_DECK_ID", + "LIGHTNING_AND_FIRE_DECK_ID", + "WATER_AND_FIGHTING_DECK_ID", + "GRASS_AND_PSYCHIC_DECK_ID", + "LEGENDARY_MOLTRES_DECK_ID", + "LEGENDARY_ZAPDOS_DECK_ID", + "LEGENDARY_ARTICUNO_DECK_ID", + "LEGENDARY_DRAGONITE_DECK_ID", + "FIRST_STRIKE_DECK_ID", + "ROCK_CRUSHER_DECK_ID", + "GO_GO_RAIN_DANCE_DECK_ID", + "ZAPPING_SELFDESTRUCT_DECK_ID", + "FLOWER_POWER_DECK_ID", + "STRANGE_PSYSHOCK_DECK_ID", + "WONDERS_OF_SCIENCE_DECK_ID", + "FIRE_CHARGE_DECK_ID", + "IM_RONALD_DECK_ID", + "POWERFUL_RONALD_DECK_ID", + "INVINCIBLE_RONALD_DECK_ID", + "LEGENDARY_RONALD_DECK_ID", + "MUSCLES_FOR_BRAINS_DECK_ID", + "HEATED_BATTLE_DECK_ID", + "LOVE_TO_BATTLE_DECK_ID", + "EXCAVATION_DECK_ID", + "BLISTERING_POKEMON_DECK_ID", + "HARD_POKEMON_DECK_ID", + "WATERFRONT_POKEMON_DECK_ID", + "LONELY_FRIENDS_DECK_ID", + "SOUND_OF_THE_WAVES_DECK_ID", + "PIKACHU_DECK_ID", + "BOOM_BOOM_SELFDESTRUCT_DECK_ID", + "POWER_GENERATOR_DECK_ID", + "ETCETERA_DECK_ID", + "FLOWER_GARDEN_DECK_ID", + "KALEIDOSCOPE_DECK_ID", + "GHOST_DECK_ID", + "NAP_TIME_DECK_ID", + "STRANGE_POWER_DECK_ID", + "FLYIN_POKEMON_DECK_ID", + "LOVELY_NIDORAN_DECK_ID", + "POISON_DECK_ID", + "ANGER_DECK_ID", + "FLAMETHROWER_DECK_ID", + "RESHUFFLE_DECK_ID", + "IMAKUNI_DECK_ID", +] + +directions = [ + "NORTH", + "EAST", + "SOUTH", + "WEST", +] + +events = [ + "EVENT_FLAG_00", + "EVENT_FLAG_01", + "EVENT_TEMP_TALKED_TO_IMAKUNI", + "EVENT_TEMP_BATTLED_IMAKUNI", + "EVENT_FLAG_04", + "EVENT_FLAG_05", + "EVENT_FLAG_06", + "EVENT_FLAG_07", + "EVENT_FLAG_08", + "EVENT_FLAG_09", + "EVENT_FLAG_0A", + "EVENT_BEAT_AMY", + "EVENT_FLAG_0C", + "EVENT_FLAG_0D", + "EVENT_FLAG_0E", + "EVENT_FLAG_0F", + "EVENT_FLAG_10", + "EVENT_FLAG_11", + "EVENT_FLAG_12", + "EVENT_IMAKUNI_STATE", + "EVENT_FLAG_14", + "EVENT_BEAT_SARA", + "EVENT_BEAT_AMANDA", + "EVENT_FLAG_17", + "EVENT_FLAG_18", + "EVENT_FLAG_19", + "EVENT_FLAG_1A", + "EVENT_FLAG_1B", + "EVENT_FLAG_1C", + "EVENT_FLAG_1D", + "EVENT_FLAG_1E", + "EVENT_FLAG_1F", + "EVENT_FLAG_20", + "EVENT_FLAG_21", + "EVENT_RECEIVED_LEGENDARY_CARD", + "EVENT_FLAG_23", + "EVENT_FLAG_24", + "EVENT_FLAG_25", + "EVENT_FLAG_26", + "EVENT_FLAG_27", + "EVENT_FLAG_28", + "EVENT_FLAG_29", + "EVENT_FLAG_2A", + "EVENT_FLAG_2B", + "EVENT_FLAG_2C", + "EVENT_FLAG_2D", + "EVENT_MEDAL_COUNT", + "EVENT_FLAG_2F", + "EVENT_FLAG_30", + "EVENT_FLAG_31", + "EVENT_FLAG_32", + "EVENT_JOSHUA_STATE", + "EVENT_IMAKUNI_ROOM", + "EVENT_FLAG_35", + "EVENT_IMAKUNI_WIN_COUNT", + "EVENT_FLAG_37", + "EVENT_FLAG_38", + "EVENT_FLAG_39", + "EVENT_FLAG_3A", + "EVENT_FLAG_3B", + "FLAG_BEAT_BRITTANY", + "EVENT_FLAG_3D", + "EVENT_FLAG_3E", + "EVENT_FLAG_3F", + "EVENT_FLAG_40", + "EVENT_FLAG_41", + "EVENT_FLAG_42", + "EVENT_FLAG_43", + "EVENT_FLAG_44", + "EVENT_FLAG_45", + "EVENT_FLAG_46", + "EVENT_FLAG_47", + "EVENT_FLAG_48", + "EVENT_FLAG_49", + "EVENT_FLAG_4A", + "EVENT_FLAG_4B", + "EVENT_FLAG_4C", + "EVENT_FLAG_4D", + "EVENT_FLAG_4E", + "EVENT_FLAG_4F", + "EVENT_FLAG_50", + "EVENT_FLAG_51", + "EVENT_FLAG_52", + "EVENT_FLAG_53", + "EVENT_FLAG_54", + "EVENT_FLAG_55", + "EVENT_FLAG_56", + "EVENT_FLAG_57", + "EVENT_FLAG_58", + "EVENT_FLAG_59", + "EVENT_FLAG_5A", + "EVENT_FLAG_5B", + "EVENT_FLAG_5C", + "EVENT_FLAG_5D", + "EVENT_FLAG_5E", + "EVENT_FLAG_5F", + "EVENT_FLAG_60", + "EVENT_FLAG_61", + "EVENT_FLAG_62", + "EVENT_FLAG_63", + "EVENT_FLAG_64", + "EVENT_FLAG_65", + "EVENT_FLAG_66", + "EVENT_FLAG_67", + "EVENT_FLAG_68", + "EVENT_FLAG_69", + "EVENT_FLAG_6A", + "EVENT_FLAG_6B", + "EVENT_FLAG_6C", + "EVENT_FLAG_6D", + "EVENT_FLAG_6E", + "EVENT_FLAG_6F", + "EVENT_FLAG_70", + "EVENT_FLAG_71", + "EVENT_FLAG_72", + "EVENT_FLAG_73", + "EVENT_FLAG_74", + "EVENT_FLAG_75", + "EVENT_FLAG_76", +] + +maps = [ + "OVERWORLD_MAP", + "MASON_LABORATORY", + "DECK_MACHINE_ROOM", + "ISHIHARAS_HOUSE", + "FIGHTING_CLUB_ENTRANCE", + "FIGHTING_CLUB_LOBBY", + "FIGHTING_CLUB", + "ROCK_CLUB_ENTRANCE", + "ROCK_CLUB_LOBBY", + "ROCK_CLUB", + "WATER_CLUB_ENTRANCE", + "WATER_CLUB_LOBBY", + "WATER_CLUB", + "LIGHTNING_CLUB_ENTRANCE", + "LIGHTNING_CLUB_LOBBY", + "LIGHTNING_CLUB", + "GRASS_CLUB_ENTRANCE", + "GRASS_CLUB_LOBBY", + "GRASS_CLUB", + "PSYCHIC_CLUB_ENTRANCE", + "PSYCHIC_CLUB_LOBBY", + "PSYCHIC_CLUB", + "SCIENCE_CLUB_ENTRANCE", + "SCIENCE_CLUB_LOBBY", + "SCIENCE_CLUB", + "FIRE_CLUB_ENTRANCE", + "FIRE_CLUB_LOBBY", + "FIRE_CLUB", + "CHALLENGE_HALL_ENTRANCE", + "CHALLENGE_HALL_LOBBY", + "CHALLENGE_HALL", + "POKEMON_DOME_ENTRANCE", + "POKEMON_DOME", + "HALL_OF_HONOR", +] + +npcs = [ + "", + "NPC_DRMASON", + "NPC_RONALD1", + "NPC_ISHIHARA", + "NPC_IMAKUNI", + "NPC_05", + "NPC_06", + "NPC_SAM", + "NPC_TECH1", + "NPC_TECH2", + "NPC_TECH3", + "NPC_TECH4", + "NPC_TECH5", + "NPC_TECH6", + "NPC_CLERK1", + "NPC_CLERK2", + "NPC_CLERK3", + "NPC_CLERK4", + "NPC_CLERK5", + "NPC_CLERK6", + "NPC_CLERK7", + "NPC_CLERK8", + "NPC_CLERK9", + "NPC_CHRIS", + "NPC_MICHAEL", + "NPC_JESSICA", + "NPC_MITCH", + "NPC_MATTHEW", + "NPC_RYAN", + "NPC_ANDREW", + "NPC_GENE", + "NPC_SARA", + "NPC_AMANDA", + "NPC_JOSHUA", + "NPC_AMY", + "NPC_JENNIFER", + "NPC_NICHOLAS", + "NPC_BRANDON", + "NPC_ISAAC", + "NPC_BRITTANY", + "NPC_KRISTIN", + "NPC_HEATHER", + "NPC_NIKKI", + "NPC_ROBERT", + "NPC_DANIEL", + "NPC_STEPHANIE", + "NPC_MURRAY1", + "NPC_JOSEPH", + "NPC_DAVID", + "NPC_ERIK", + "NPC_RICK", + "NPC_JOHN", + "NPC_ADAM", + "NPC_JONATHAN", + "NPC_KEN", + "NPC_COURTNEY", + "NPC_STEVE", + "NPC_JACK", + "NPC_ROD", + "NPC_CLERK10", + "NPC_GIFT_CENTER_CLERK", + "NPC_MAN1", + "NPC_WOMAN1", + "NPC_CHAP1", + "NPC_GAL1", + "NPC_LASS1", + "NPC_CHAP2", + "NPC_LASS2", + "NPC_PAPPY1", + "NPC_LAD1", + "NPC_LAD2", + "NPC_CHAP3", + "NPC_CLERK12", + "NPC_CLERK13", + "NPC_HOST", + "NPC_SPECS1", + "NPC_BUTCH", + "NPC_GRANNY1", + "NPC_LASS3", + "NPC_MAN2", + "NPC_PAPPY2", + "NPC_LASS4", + "NPC_HOOD1", + "NPC_GRANNY2", + "NPC_GAL2", + "NPC_LAD3", + "NPC_GAL3", + "NPC_CHAP4", + "NPC_MAN3", + "NPC_SPECS2", + "NPC_SPECS3", + "NPC_WOMAN2", + "NPC_MANIA", + "NPC_PAPPY3", + "NPC_GAL4", + "NPC_CHAMP", + "NPC_HOOD2", + "NPC_LASS5", + "NPC_CHAP5", + "NPC_AARON", + "NPC_GUIDE", + "NPC_TECH7", + "NPC_TECH8", + "NPC_TORCH", + "NPC_LEGENDARY_CARD_TOP_LEFT", + "NPC_LEGENDARY_CARD_TOP_RIGHT", + "NPC_LEGENDARY_CARD_LEFT_SPARK", + "NPC_LEGENDARY_CARD_BOTTOM_LEFT", + "NPC_LEGENDARY_CARD_BOTTOM_RIGHT", + "NPC_LEGENDARY_CARD_RIGHT_SPARK", + "NPC_6E", + "NPC_6F", + "NPC_MURRAY2", + "NPC_RONALD2", + "NPC_RONALD3", + "NPC_73", +] + +sfxs = [ + "SFX_STOP", + "SFX_01", + "SFX_02", + "SFX_03", + "SFX_04", + "SFX_05", + "SFX_06", + "SFX_07", + "SFX_08", + "SFX_09", + "SFX_0A", + "SFX_0B", + "SFX_0C", + "SFX_0D", + "SFX_0E", + "SFX_0F", + "SFX_10", + "SFX_11", + "SFX_12", + "SFX_13", + "SFX_14", + "SFX_15", + "SFX_16", + "SFX_17", + "SFX_18", + "SFX_19", + "SFX_1A", + "SFX_1B", + "SFX_1C", + "SFX_1D", + "SFX_1E", + "SFX_1F", + "SFX_20", + "SFX_21", + "SFX_22", + "SFX_23", + "SFX_24", + "SFX_25", + "SFX_26", + "SFX_27", + "SFX_28", + "SFX_29", + "SFX_2A", + "SFX_2B", + "SFX_2C", + "SFX_2D", + "SFX_2E", + "SFX_2F", + "SFX_30", + "SFX_31", + "SFX_32", + "SFX_33", + "SFX_34", + "SFX_35", + "SFX_36", + "SFX_37", + "SFX_38", + "SFX_39", + "SFX_3A", + "SFX_3B", + "SFX_3C", + "SFX_3D", + "SFX_3E", + "SFX_3F", + "SFX_40", + "SFX_41", + "SFX_42", + "SFX_43", + "SFX_44", + "SFX_45", + "SFX_46", + "SFX_47", + "SFX_48", + "SFX_49", + "SFX_4A", + "SFX_4B", + "SFX_4C", + "SFX_4D", + "SFX_4E", + "SFX_4F", + "SFX_50", + "SFX_51", + "SFX_52", + "SFX_53", + "SFX_54", + "SFX_55", + "SFX_56", + "SFX_57", + "SFX_58", + "SFX_59", + "SFX_5A", + "SFX_5B", + "SFX_5C", + "SFX_5D", + "SFX_5E", + "SFX_5F", +] + +songs = [ + "MUSIC_STOP", + "MUSIC_TITLESCREEN", + "MUSIC_DUEL_THEME_1", + "MUSIC_DUEL_THEME_2", + "MUSIC_DUEL_THEME_3", + "MUSIC_PAUSE_MENU", + "MUSIC_PC_MAIN_MENU", + "MUSIC_DECK_MACHINE", + "MUSIC_CARD_POP", + "MUSIC_OVERWORLD", + "MUSIC_POKEMON_DOME", + "MUSIC_CHALLENGE_HALL", + "MUSIC_CLUB_1", + "MUSIC_CLUB_2", + "MUSIC_CLUB_3", + "MUSIC_RONALD", + "MUSIC_IMAKUNI", + "MUSIC_HALL_OF_HONOR", + "MUSIC_CREDITS", + "MUSIC_UNUSED_13", + "MUSIC_UNUSED_14", + "MUSIC_MATCH_START_1", + "MUSIC_MATCH_START_2", + "MUSIC_MATCH_START_3", + "MUSIC_MATCH_VICTORY", + "MUSIC_MATCH_LOSS", + "MUSIC_MATCH_DRAW", + "MUSIC_UNUSED_1B", + "MUSIC_BOOSTER_PACK", + "MUSIC_MEDAL", + "MUSIC_UNUSED_1E", +] diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 30e4894..385a2c2 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -2,6 +2,16 @@ import argparse +from constants import boosters +from constants import cards +from constants import decks +from constants import directions +from constants import events +from constants import maps +from constants import npcs +from constants import sfxs +from constants import songs + args = None rom = None @@ -14,18 +24,18 @@ script_commands = { 0x02: { "name": "print_text_string", "params": [ "text" ] }, 0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text and ??? 0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] }, - 0x05: { "name": "start_battle", "params": [ "byte", "byte", "byte" ] }, # prizes, deck, song + 0x05: { "name": "start_battle", "params": [ "prizes", "deck", "song" ] }, 0x06: { "name": "print_variable_text", "params": [ "text", "text" ] }, 0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text and ??? 0x08: { "name": "print_text_quit_fully", "params": [ "text" ] }, 0x09: { "name": "Func_cdcb", "params": [] }, 0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] }, 0x0b: { "name": "close_text_box", "params": [] }, - 0x0c: { "name": "give_booster_packs", "params": [ "byte", "byte", "byte" ] }, # booster, booster, booster - 0x0d: { "name": "jump_if_card_owned", "params": [ "byte", "label" ] }, # card - 0x0e: { "name": "jump_if_card_in_collection", "params": [ "byte", "label" ] }, # card - 0x0f: { "name": "give_card", "params": [ "byte" ] }, # card - 0x10: { "name": "take_card", "params": [ "byte" ] }, # card + 0x0c: { "name": "give_booster_packs", "params": [ "booster", "booster", "booster" ] }, + 0x0d: { "name": "jump_if_card_owned", "params": [ "card", "label" ] }, + 0x0e: { "name": "jump_if_card_in_collection", "params": [ "card", "label" ] }, + 0x0f: { "name": "give_card", "params": [ "card" ] }, + 0x10: { "name": "take_card", "params": [ "card" ] }, 0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection 0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection 0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] }, @@ -40,9 +50,9 @@ script_commands = { 0x1c: { "name": "try_give_medal_pc_packs", "params": [] }, 0x1d: { "name": "set_player_direction", "params": [ "direction" ] }, 0x1e: { "name": "move_player", "params": [ "direction", "byte_decimal" ] }, - 0x1f: { "name": "show_card_received_screen", "params": [ "byte" ] }, # card - 0x20: { "name": "set_dialog_npc", "params": [ "byte" ] }, # npc - 0x21: { "name": "set_next_npc_and_script", "params": [ "byte", "label" ] }, # npc + 0x1f: { "name": "show_card_received_screen", "params": [ "card" ] }, + 0x20: { "name": "set_dialog_npc", "params": [ "npc" ] }, + 0x21: { "name": "set_next_npc_and_script", "params": [ "npc", "label" ] }, 0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06 0x23: { "name": "Func_d0be", "params": [ "byte", "byte" ] }, # coords 0x24: { "name": "do_frames", "params": [ "byte_decimal" ] }, @@ -50,11 +60,11 @@ script_commands = { 0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, 0x27: { "name": "move_active_npc", "params": [ "movement" ] }, 0x28: { "name": "give_one_of_each_trainer_booster", "params": [] }, - 0x29: { "name": "Func_d103", "params": [ "byte", "label" ] }, # npc, jump if npc loaded - 0x2a: { "name": "Func_d125", "params": [ "byte" ] }, # give medal + 0x29: { "name": "Func_d103", "params": [ "npc", "label" ] }, # jump if npc loaded + 0x2a: { "name": "Func_d125", "params": [ "event" ] }, # give medal 0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot 0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load current npc name into tx ram slot - 0x2d: { "name": "Func_cd4f", "params": [ "byte", "byte", "byte" ] }, # prizes, deck, song + 0x2d: { "name": "Func_cd4f", "params": [ "prizes", "deck", "song" ] }, 0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, 0x30: { "name": "Func_cdd8", "params": [] }, @@ -67,8 +77,8 @@ script_commands = { 0x37: { "name": "choose_deck_to_duel_against_multichoice", "params": [] }, 0x38: { "name": "open_deck_machine", "params": [ "byte" ] }, 0x39: { "name": "choose_starter_deck_multichoice", "params": [] }, - 0x3a: { "name": "enter_map", "params": [ "byte", "byte", "byte_decimal", "byte_decimal", "direction" ] }, - 0x3b: { "name": "move_arbitrary_npc", "params": [ "byte", "movement" ] }, + 0x3a: { "name": "enter_map", "params": [ "byte", "map", "byte_decimal", "byte_decimal", "direction" ] }, + 0x3b: { "name": "move_arbitrary_npc", "params": [ "npc", "movement" ] }, 0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card 0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, 0x3e: { "name": "Func_d396", "params": [ "byte" ] }, @@ -79,13 +89,13 @@ script_commands = { 0x43: { "name": "script_nop", "params": [] }, 0x44: { "name": "Func_d3d4", "params": [] }, 0x45: { "name": "Func_d3e0", "params": [] }, - 0x46: { "name": "Func_d3fe", "params": [ "byte" ] }, # song - 0x47: { "name": "Func_d408", "params": [ "byte" ] }, # set default song? + 0x46: { "name": "Func_d3fe", "params": [ "song" ] }, + 0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song 0x48: { "name": "play_song", "params": [ "byte" ] }, - 0x49: { "name": "play_sfx", "params": [ "byte" ] }, + 0x49: { "name": "play_sfx", "params": [ "sfx" ] }, 0x4a: { "name": "pause_song", "params": [] }, 0x4b: { "name": "resume_song", "params": [] }, - 0x4c: { "name": "Func_d41d", "params": [] }, # play default song? + 0x4c: { "name": "Func_d41d", "params": [] }, # play default song 0x4d: { "name": "wait_for_song_to_finish", "params": [] }, 0x4e: { "name": "Func_d435", "params": [ "byte" ] }, 0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] }, @@ -135,8 +145,16 @@ quit_commands = [ param_lengths = { "byte": 1, "byte_decimal": 1, - "event": 1, + "booster": 1, + "card": 1, + "deck": 1, "direction": 1, + "event": 1, + "map": 1, + "npc": 1, + "prizes": 1, + "sfx": 1, + "song": 1, "word_decimal": 2, "movement": 2, "movement_table": 2, @@ -144,13 +162,6 @@ param_lengths = { "label": 2, } -directions = [ - "NORTH", - "EAST", - "SOUTH", - "WEST", -] - def get_bank(address): return int(address / 0x4000) @@ -231,14 +242,46 @@ def dump_script(start_address, address=None, visited=set()): if not macro_mode: output += "\n\tdb" output += " {}".format(param) - elif param_type == "event": + elif param_type == "booster": if not macro_mode: output += "\n\tdb" - output += " EVENT_FLAG_{:02X}".format(param) + output += " {}".format(boosters[param]) + elif param_type == "card": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(cards[param]) + elif param_type == "deck": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(decks[param]) elif param_type == "direction": if not macro_mode: output += "\n\tdb" output += " {}".format(directions[param]) + elif param_type == "event": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(events[param]) + elif param_type == "map": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(maps[param]) + elif param_type == "npc": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(npcs[param]) + elif param_type == "prizes": + if not macro_mode: + output += "\n\tdb" + output += " PRIZES_{}".format(param) + elif param_type == "sfx": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(sfxs[param]) + elif param_type == "song": + if not macro_mode: + output += "\n\tdb" + output += " {}".format(songs[param]) elif param_type == "word_decimal": if not macro_mode: output += "\n\tdw" -- cgit v1.2.3 From 1246f2eb3709dca713c1c0fe643e249bf41b6b7c Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 10 Jan 2021 22:35:30 -0600 Subject: Add npc movement jump command and add $ff deck id value --- tools/constants.py | 111 +++++++++++++++++++++++---------------------- tools/script_extractor2.py | 10 +++- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/tools/constants.py b/tools/constants.py index d54b0be..ee3069e 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -264,61 +264,62 @@ cards = { 0xff: "$ff", } -decks = [ - "SAMS_PRACTICE_DECK_ID", - "PRACTICE_PLAYER_DECK_ID", - "SAMS_NORMAL_DECK_ID", - "CHARMANDER_AND_FRIENDS_DECK_ID", - "CHARMANDER_EXTRA_DECK_ID", - "SQUIRTLE_AND_FRIENDS_DECK_ID", - "SQUIRTLE_EXTRA_DECK_ID", - "BULBASAUR_AND_FRIENDS_DECK_ID", - "BULBASAUR_EXTRA_DECK_ID", - "LIGHTNING_AND_FIRE_DECK_ID", - "WATER_AND_FIGHTING_DECK_ID", - "GRASS_AND_PSYCHIC_DECK_ID", - "LEGENDARY_MOLTRES_DECK_ID", - "LEGENDARY_ZAPDOS_DECK_ID", - "LEGENDARY_ARTICUNO_DECK_ID", - "LEGENDARY_DRAGONITE_DECK_ID", - "FIRST_STRIKE_DECK_ID", - "ROCK_CRUSHER_DECK_ID", - "GO_GO_RAIN_DANCE_DECK_ID", - "ZAPPING_SELFDESTRUCT_DECK_ID", - "FLOWER_POWER_DECK_ID", - "STRANGE_PSYSHOCK_DECK_ID", - "WONDERS_OF_SCIENCE_DECK_ID", - "FIRE_CHARGE_DECK_ID", - "IM_RONALD_DECK_ID", - "POWERFUL_RONALD_DECK_ID", - "INVINCIBLE_RONALD_DECK_ID", - "LEGENDARY_RONALD_DECK_ID", - "MUSCLES_FOR_BRAINS_DECK_ID", - "HEATED_BATTLE_DECK_ID", - "LOVE_TO_BATTLE_DECK_ID", - "EXCAVATION_DECK_ID", - "BLISTERING_POKEMON_DECK_ID", - "HARD_POKEMON_DECK_ID", - "WATERFRONT_POKEMON_DECK_ID", - "LONELY_FRIENDS_DECK_ID", - "SOUND_OF_THE_WAVES_DECK_ID", - "PIKACHU_DECK_ID", - "BOOM_BOOM_SELFDESTRUCT_DECK_ID", - "POWER_GENERATOR_DECK_ID", - "ETCETERA_DECK_ID", - "FLOWER_GARDEN_DECK_ID", - "KALEIDOSCOPE_DECK_ID", - "GHOST_DECK_ID", - "NAP_TIME_DECK_ID", - "STRANGE_POWER_DECK_ID", - "FLYIN_POKEMON_DECK_ID", - "LOVELY_NIDORAN_DECK_ID", - "POISON_DECK_ID", - "ANGER_DECK_ID", - "FLAMETHROWER_DECK_ID", - "RESHUFFLE_DECK_ID", - "IMAKUNI_DECK_ID", -] +decks = { + 0x00: "SAMS_PRACTICE_DECK_ID", + 0x01: "PRACTICE_PLAYER_DECK_ID", + 0x02: "SAMS_NORMAL_DECK_ID", + 0x03: "CHARMANDER_AND_FRIENDS_DECK_ID", + 0x04: "CHARMANDER_EXTRA_DECK_ID", + 0x05: "SQUIRTLE_AND_FRIENDS_DECK_ID", + 0x06: "SQUIRTLE_EXTRA_DECK_ID", + 0x07: "BULBASAUR_AND_FRIENDS_DECK_ID", + 0x08: "BULBASAUR_EXTRA_DECK_ID", + 0x09: "LIGHTNING_AND_FIRE_DECK_ID", + 0x0a: "WATER_AND_FIGHTING_DECK_ID", + 0x0b: "GRASS_AND_PSYCHIC_DECK_ID", + 0x0c: "LEGENDARY_MOLTRES_DECK_ID", + 0x0d: "LEGENDARY_ZAPDOS_DECK_ID", + 0x0e: "LEGENDARY_ARTICUNO_DECK_ID", + 0x0f: "LEGENDARY_DRAGONITE_DECK_ID", + 0x10: "FIRST_STRIKE_DECK_ID", + 0x11: "ROCK_CRUSHER_DECK_ID", + 0x12: "GO_GO_RAIN_DANCE_DECK_ID", + 0x13: "ZAPPING_SELFDESTRUCT_DECK_ID", + 0x14: "FLOWER_POWER_DECK_ID", + 0x15: "STRANGE_PSYSHOCK_DECK_ID", + 0x16: "WONDERS_OF_SCIENCE_DECK_ID", + 0x17: "FIRE_CHARGE_DECK_ID", + 0x18: "IM_RONALD_DECK_ID", + 0x19: "POWERFUL_RONALD_DECK_ID", + 0x1a: "INVINCIBLE_RONALD_DECK_ID", + 0x1b: "LEGENDARY_RONALD_DECK_ID", + 0x1c: "MUSCLES_FOR_BRAINS_DECK_ID", + 0x1d: "HEATED_BATTLE_DECK_ID", + 0x1e: "LOVE_TO_BATTLE_DECK_ID", + 0x1f: "EXCAVATION_DECK_ID", + 0x20: "BLISTERING_POKEMON_DECK_ID", + 0x21: "HARD_POKEMON_DECK_ID", + 0x22: "WATERFRONT_POKEMON_DECK_ID", + 0x23: "LONELY_FRIENDS_DECK_ID", + 0x24: "SOUND_OF_THE_WAVES_DECK_ID", + 0x25: "PIKACHU_DECK_ID", + 0x26: "BOOM_BOOM_SELFDESTRUCT_DECK_ID", + 0x27: "POWER_GENERATOR_DECK_ID", + 0x28: "ETCETERA_DECK_ID", + 0x29: "FLOWER_GARDEN_DECK_ID", + 0x2a: "KALEIDOSCOPE_DECK_ID", + 0x2b: "GHOST_DECK_ID", + 0x2c: "NAP_TIME_DECK_ID", + 0x2d: "STRANGE_POWER_DECK_ID", + 0x2e: "FLYIN_POKEMON_DECK_ID", + 0x2f: "LOVELY_NIDORAN_DECK_ID", + 0x30: "POISON_DECK_ID", + 0x31: "ANGER_DECK_ID", + 0x32: "FLAMETHROWER_DECK_ID", + 0x33: "RESHUFFLE_DECK_ID", + 0x34: "IMAKUNI_DECK_ID", + 0xff: "$ff", +} directions = [ "NORTH", diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 385a2c2..25fef03 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -192,7 +192,13 @@ def dump_movement(address): while 1: movement = rom[address] if movement == 0xff: - blobs.append(make_blob(address, "\tdb $ff\n\n", address + 1)) + blobs.append(make_blob(address, "\tdb ${:02x}\n\n".format(movement), address + 1)) + break + if movement == 0xfe: + jump = rom[address + 1] + if jump > 127: + jump -= 256 + blobs.append(make_blob(address, "\tdb ${:02x}, {}\n\n".format(movement, jump), address + 2)) break blobs.append(make_blob(address, "\tdb {}".format(directions[movement & 0b01111111]) + (" | NO_MOVE\n" if movement & 0b10000000 else "\n"), address + 1)) address += 1 @@ -339,7 +345,7 @@ def dump_script(start_address, address=None, visited=set()): for branch in branches: blobs += dump_script(start_address, branch, visited) return blobs - + def fill_gap(start, end): output = "" for address in range(start, end): -- cgit v1.2.3 From 3143d75086ff35199ef7a8864a707e5f33d3aede Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 12 Jan 2021 02:12:24 -0600 Subject: Add --ignore-errors to script_extractor2 most useful when parsing many starting addresses at once and wanting to get as much valid output as possible --- tools/script_extractor2.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 25fef03..0e835e4 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -91,7 +91,7 @@ script_commands = { 0x45: { "name": "Func_d3e0", "params": [] }, 0x46: { "name": "Func_d3fe", "params": [ "song" ] }, 0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song - 0x48: { "name": "play_song", "params": [ "byte" ] }, + 0x48: { "name": "play_song", "params": [ "song" ] }, 0x49: { "name": "play_sfx", "params": [ "sfx" ] }, 0x4a: { "name": "pause_song", "params": [] }, 0x4b: { "name": "resume_song", "params": [] }, @@ -222,6 +222,8 @@ def dump_script(start_address, address=None, visited=set()): if address is None: blobs.append(make_blob(start_address, "Script_{:x}:".format(start_address) + make_address_comment(start_address))) address = start_address + else: + blobs.append(make_blob(address, ".ows_{:x}\n".format(address))) if address in visited: return blobs visited.add(address) @@ -325,9 +327,8 @@ def dump_script(start_address, address=None, visited=set()): label = "Script_{:x}".format(param) else: label = ".ows_{:x}".format(param) - if (param > start_address or args.allow_backward_jumps): + if param > start_address or args.allow_backward_jumps: branches.add(param) - blobs.append(make_blob(param, ".ows_{:x}\n".format(param))) if not macro_mode: output += "\n\tdw" output += " {}".format(label) @@ -336,7 +337,7 @@ def dump_script(start_address, address=None, visited=set()): output += "," output += "\n" blobs.append(make_blob(command_address, output, address)) - if (command_id in quit_commands): + if command_id in quit_commands: if rom[address] == 0xc9: blobs.append(make_blob(address, "\tret\n", address + 1)) address += 1 @@ -354,7 +355,7 @@ def fill_gap(start, end): return output def sort_and_filter(blobs): - blobs.sort(key=lambda b: (b["start"], b["end"], len(b["output"]), not b["output"].startswith(";"))) + blobs.sort(key=lambda b: (b["start"], b["end"], not b["output"].startswith(";"))) filtered = [] for blob, next in zip(blobs, blobs[1:]+[None]): if next and blob["start"] == next["start"] and blob["output"] == next["output"]: @@ -365,20 +366,26 @@ def sort_and_filter(blobs): else: blob["output"] += "; gap from 0x{:x} to 0x{:x}\n\n".format(blob["end"], next["start"]) filtered.append(blob) - filtered[-1]["output"] = filtered[-1]["output"].rstrip("\n") + if len(filtered) > 0: + filtered[-1]["output"] = filtered[-1]["output"].rstrip("\n") return filtered if __name__ == "__main__": ap = argparse.ArgumentParser(description="Pokemon TCG Script Extractor") ap.add_argument("-b", "--allow-backward-jumps", action="store_true", help="extract scripts that are found before the starting address") ap.add_argument("-g", "--fill-gaps", action="store_true", help="use 'db's to fill the gaps between visited locations") + ap.add_argument("-i", "--ignore-errors", action="store_true", help="silently proceed to the next address if an error occurs") ap.add_argument("-r", "--rom", default="baserom.gbc", help="rom file to extract script from") ap.add_argument("addresses", nargs="+", help="addresses to extract from") args = ap.parse_args() rom = bytearray(open(args.rom, "rb").read()) blobs = [] for address in args.addresses: - blobs += dump_script(int(address, 16)) + try: + blobs += dump_script(int(address, 16)) + except: + if not args.ignore_errors: + raise blobs = sort_and_filter(blobs) output = "" for blob in blobs: -- cgit v1.2.3 From d7b68ad09ab03a4f1094cc964507f488bff466cf Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Thu, 14 Jan 2021 21:54:38 -0600 Subject: Use real text labels and script labels in script_extractor2 --- tools/script_extractor2.py | 66 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 0e835e4..b5fc4d0 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -1,6 +1,9 @@ #!/usr/bin/env python +from __future__ import print_function + import argparse +import sys from constants import boosters from constants import cards @@ -14,6 +17,8 @@ from constants import songs args = None rom = None +symbols = None +texts = None # script command names and parameter lists script_commands = { @@ -181,14 +186,17 @@ def get_pointer(address, bank=None): return (raw_pointer % 0x4000) + bank * 0x4000 def make_address_comment(address): - return " ; {:x} ({:x}:{:x})\n".format(address, get_bank(address), get_relative_address(address)) + return ": ; {:x} ({:x}:{:x})\n".format(address, get_bank(address), get_relative_address(address)) def make_blob(start, output, end=None): return { "start": start, "output": output, "end": end if end else start } def dump_movement(address): blobs = [] - blobs.append(make_blob(address, "NPCMovement_{:x}:".format(address) + make_address_comment(address))) + label = "NPCMovement_{:x}".format(address) + if address in symbols: + label = symbols[address] + blobs.append(make_blob(address, label + make_address_comment(address))) while 1: movement = rom[address] if movement == 0xff: @@ -206,7 +214,10 @@ def dump_movement(address): def dump_movement_table(address): blobs = [] - blobs.append(make_blob(address, "NPCMovementTable_{:x}:".format(address) + make_address_comment(address))) + label = "NPCMovementTable_{:x}".format(address) + if address in symbols: + label = symbols[address] + blobs.append(make_blob(address, label + make_address_comment(address))) for i in range(4): pointer = get_pointer(address) blobs.append(make_blob(address, "\tdw NPCMovement_{:x}\n".format(pointer) + ("\n" if i == 3 else ""), address + 2)) @@ -220,10 +231,20 @@ def dump_script(start_address, address=None, visited=set()): blobs = [] branches = set() if address is None: - blobs.append(make_blob(start_address, "Script_{:x}:".format(start_address) + make_address_comment(start_address))) + label = "Script_{:x}".format(start_address) + if start_address in symbols: + label = symbols[start_address] + blobs.append(make_blob(start_address, label + make_address_comment(start_address))) address = start_address else: - blobs.append(make_blob(address, ".ows_{:x}\n".format(address))) + label = ".ows_{:x}\n".format(address) + if address in symbols: + label = symbols[address] + if label.startswith("."): + label += "\n" + else: + label += make_address_comment(address) + blobs.append(make_blob(address, label)) if address in visited: return blobs visited.add(address) @@ -297,6 +318,8 @@ def dump_script(start_address, address=None, visited=set()): elif param_type == "movement": param = get_pointer(address) label = "NPCMovement_{:x}".format(param) + if param in symbols: + label = symbols[param] if not macro_mode: output += "\n\tdw" output += " {}".format(label) @@ -304,6 +327,8 @@ def dump_script(start_address, address=None, visited=set()): elif param_type == "movement_table": param = get_pointer(address) label = "NPCMovementTable_{:x}".format(param) + if param in symbols: + label = symbols[param] if not macro_mode: output += "\n\tdw" output += " {}".format(label) @@ -318,15 +343,19 @@ def dump_script(start_address, address=None, visited=set()): if text_id == 0x0000: output += " NULL" else: - output += " Text{:04x}".format(text_id) + output += " {}".format(texts[text_id]) elif param_type == "label": param = get_pointer(address) if param == 0x0000: label = "NULL" elif param == start_address: label = "Script_{:x}".format(param) + if param in symbols: + label = symbols[param] else: label = ".ows_{:x}".format(param) + if param in symbols: + label = symbols[param] if param > start_address or args.allow_backward_jumps: branches.add(param) if not macro_mode: @@ -370,20 +399,45 @@ def sort_and_filter(blobs): filtered[-1]["output"] = filtered[-1]["output"].rstrip("\n") return filtered +def load_symbols(symfile): + sym = {} + for line in open(symfile): + line = line.split(";")[0].strip() + # NOTE: only worry about bank 3 symbols for now + if line.startswith("03:"): + bank_address, label = line.split(" ")[:2] + bank, address = bank_address.split(":") + address = (int(address, 16) % 0x4000) + int(bank, 16) * 0x4000 + if "." in label: + label = "." + label.split(".")[1] + sym[address] = label + return sym + +def load_texts(txfile): + tx = [None] + for line in open(txfile): + if line.startswith("\ttextpointer"): + tx.append(line.split()[1]) + return tx + if __name__ == "__main__": ap = argparse.ArgumentParser(description="Pokemon TCG Script Extractor") ap.add_argument("-b", "--allow-backward-jumps", action="store_true", help="extract scripts that are found before the starting address") ap.add_argument("-g", "--fill-gaps", action="store_true", help="use 'db's to fill the gaps between visited locations") ap.add_argument("-i", "--ignore-errors", action="store_true", help="silently proceed to the next address if an error occurs") ap.add_argument("-r", "--rom", default="baserom.gbc", help="rom file to extract script from") + ap.add_argument("-s", "--symfile", default="poketcg.sym", help="symfile to extract symbols from") ap.add_argument("addresses", nargs="+", help="addresses to extract from") args = ap.parse_args() rom = bytearray(open(args.rom, "rb").read()) + symbols = load_symbols(args.symfile) + texts = load_texts("src/text/text_offsets.asm") blobs = [] for address in args.addresses: try: blobs += dump_script(int(address, 16)) except: + print("Parsing script failed: 0x{:x}".format(int(address, 16)), file=sys.stderr) if not args.ignore_errors: raise blobs = sort_and_filter(blobs) -- cgit v1.2.3 From 09ac45cb24b6182ba4e6bc2dc3c71e205a652d37 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Fri, 15 Jan 2021 00:20:39 -0600 Subject: Detect and fix unreachable local labels in script_extractor2 --- tools/script_extractor2.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index b5fc4d0..bc1a945 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -399,6 +399,53 @@ def sort_and_filter(blobs): filtered[-1]["output"] = filtered[-1]["output"].rstrip("\n") return filtered +def find_unreachable_labels(input): + scope = "" + label_scopes = {} + local_labels = set() + local_references = set() + unreachable_labels = set() + for line in input.split("\n"): + line = line.split(";")[0].rstrip() + if line.startswith("\t"): + for word in [x.rstrip(",") for x in line.split()]: + if word.startswith("."): + local_references.add(word) + elif line.startswith("."): + label = line.split()[0] + local_labels.add(label) + label_scopes[label] = scope + elif line.endswith(":"): + for label in local_references: + if label not in local_labels: + unreachable_labels.add(label) + scope = line[:-1] + local_labels = set() + local_references = set() + for label in local_references: + if label not in local_labels: + unreachable_labels.add(label) + unreachable_labels = list(unreachable_labels) + for i in range(len(unreachable_labels)): + label = unreachable_labels[i] + unreachable_labels[i] = { "scope": label_scopes.get(label, ""), "label": label } + return unreachable_labels + +def fix_unreachable_labels(input, unreachable_labels): + scope = "" + output = "" + for line in input.split("\n"): + stripped_line = line.split(";")[0].rstrip() + if line.startswith("\t"): + for label in unreachable_labels: + if label["label"] in line and label["scope"] != scope: + line = line.replace(label["label"], label["scope"] + label["label"]) + elif stripped_line.endswith(":"): + scope = stripped_line[:-1] + output += line + "\n" + output = output.rstrip("\n") + return output + def load_symbols(symfile): sym = {} for line in open(symfile): @@ -423,6 +470,7 @@ def load_texts(txfile): if __name__ == "__main__": ap = argparse.ArgumentParser(description="Pokemon TCG Script Extractor") ap.add_argument("-b", "--allow-backward-jumps", action="store_true", help="extract scripts that are found before the starting address") + ap.add_argument("-f", "--fix-unreachable", action="store_true", help="fix unreachable labels that are referenced from the wrong scope") ap.add_argument("-g", "--fill-gaps", action="store_true", help="use 'db's to fill the gaps between visited locations") ap.add_argument("-i", "--ignore-errors", action="store_true", help="silently proceed to the next address if an error occurs") ap.add_argument("-r", "--rom", default="baserom.gbc", help="rom file to extract script from") @@ -444,4 +492,7 @@ if __name__ == "__main__": output = "" for blob in blobs: output += blob["output"] + if args.fix_unreachable: + unreachable_labels = find_unreachable_labels(output) + output = fix_unreachable_labels(output, unreachable_labels) print(output) -- cgit v1.2.3 From 518e7d399cd69b3775226f0ed5b7921e92f05c64 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 10:46:08 -0600 Subject: Rename some script commands like print_text_string -> print_npc_text etc, and change instances of 'battle' to 'duel' --- src/constants/script_constants.asm | 2 +- src/data/npc_map_data.asm | 2 +- src/engine/bank01.asm | 20 +- src/engine/bank03.asm | 833 ++++++++++++++++++++----------------- src/engine/bank04.asm | 31 +- src/engine/bank05.asm | 4 +- src/macros/scripts.asm | 88 ++-- src/wram.asm | 4 +- tools/constants.py | 2 +- tools/script_extractor2.py | 210 +++++----- 10 files changed, 625 insertions(+), 571 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index 9f37375..d5b05ee 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -2,7 +2,7 @@ const EVENT_FLAG_00 ; $00 const EVENT_FLAG_01 ; $01 const EVENT_TEMP_TALKED_TO_IMAKUNI ; $02 - const EVENT_TEMP_BATTLED_IMAKUNI ; $03 + const EVENT_TEMP_DUELED_IMAKUNI ; $03 const EVENT_FLAG_04 ; $04 const EVENT_FLAG_05 ; $05 const EVENT_FLAG_06 ; $06 diff --git a/src/data/npc_map_data.asm b/src/data/npc_map_data.asm index adcbee2..5278db3 100644 --- a/src/data/npc_map_data.asm +++ b/src/data/npc_map_data.asm @@ -1,4 +1,4 @@ -; NPC Map data. Note: pre-load functions also run after battles +; NPC Map data. Note: pre-load functions also run after duels ; Format: ; NPC, X position, Y Position, Direction, ; pre-load function. (Resets c flag if NPC should not be loaded) diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 9cdb098..4936cbc 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -188,29 +188,29 @@ MainDuelLoop: ; 40ee (1:40ee) ; load the correct music and animation depending on result ld a, [wDuelFinished] cp TURN_PLAYER_WON - jr z, .active_duelist_won_battle + jr z, .active_duelist_won_duel cp TURN_PLAYER_LOST - jr z, .active_duelist_lost_battle + jr z, .active_duelist_lost_duel ld a, DUEL_ANIM_DUEL_DRAW ld c, MUSIC_MATCH_DRAW ldtx hl, DuelWasADrawText jr .handle_duel_finished -.active_duelist_won_battle +.active_duelist_won_duel ldh a, [hWhoseTurn] cp PLAYER_TURN - jr nz, .opponent_won_battle -.player_won_battle + jr nz, .opponent_won_duel +.player_won_duel xor a ; DUEL_WIN ld [wDuelResult], a ld a, DUEL_ANIM_DUEL_WIN ld c, MUSIC_MATCH_VICTORY ldtx hl, WonDuelText jr .handle_duel_finished -.active_duelist_lost_battle +.active_duelist_lost_duel ldh a, [hWhoseTurn] cp PLAYER_TURN - jr nz, .player_won_battle -.opponent_won_battle + jr nz, .player_won_duel +.opponent_won_duel ld a, DUEL_LOSS ld [wDuelResult], a ld a, DUEL_ANIM_DUEL_LOSS @@ -232,7 +232,7 @@ MainDuelLoop: ; 40ee (1:40ee) jr nz, .wait_song ld a, [wDuelFinished] cp TURN_PLAYER_TIED - jr z, .tied_battle + jr z, .tied_duel call Func_39fc call WaitForWideTextBoxInput call Func_3b31 @@ -241,7 +241,7 @@ MainDuelLoop: ; 40ee (1:40ee) ldh [hWhoseTurn], a ret -.tied_battle +.tied_duel call WaitForWideTextBoxInput call Func_3b31 ld a, [wDuelTheme] diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 3608d97..210d3ad 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1024,7 +1024,7 @@ MainMenu_c75a: ; c75a (3:475a) Func_c797: ; c797 (3:4797) ld a, [wd0b8] - ld hl, Unknown_cd98 + ld hl, Unknown_10d98 farcall Func_111e9 ret @@ -1565,7 +1565,7 @@ TryGiveMedalPCPacks: ; cad8 (3:4ad8) cp $7 jr nc, .givePacksForSevenMedals cp $3 - jr nc, .givePacksForTwoMedals + jr nc, .givePacksForThreeMedals jr .finish .givePacksForEightMedals @@ -1576,7 +1576,7 @@ TryGiveMedalPCPacks: ; cad8 (3:4ad8) ld a, $b farcall TryGivePCPack -.givePacksForTwoMedals +.givePacksForThreeMedals ld a, $a farcall TryGivePCPack @@ -1620,7 +1620,7 @@ EventFlagMods: ; cb37 (3:4b37) flag_def $3f, %10000000 ; EVENT_FLAG_00 ; 0-7 are reset when game resets flag_def $3f, %01000000 ; EVENT_FLAG_01 flag_def $3f, %00100000 ; EVENT_TEMP_TALKED_TO_IMAKUNI - flag_def $3f, %00010000 ; EVENT_TEMP_BATTLED_IMAKUNI + flag_def $3f, %00010000 ; EVENT_TEMP_DUELED_IMAKUNI flag_def $3f, %00001000 ; EVENT_FLAG_04 flag_def $3f, %00000100 ; EVENT_FLAG_05 flag_def $3f, %00000010 ; EVENT_FLAG_06 @@ -1873,16 +1873,7 @@ SetScriptControlByteFail: ; ccb9 (3:4cb9) ret ; Exits Script mode and runs the next instruction like normal -ScriptCommand_EndScriptLoop1: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop2: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop3: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop4: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop5: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop6: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop7: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop8: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop9: ; ccbe (3:4cbe) -ScriptCommand_EndScriptLoop10: ; ccbe (3:4cbe) +ScriptCommand_EndScript: ; ccbe (3:4cbe) ld a, $01 ld [wBreakScriptLoop], a jp IncreaseScriptPointerBy1 @@ -1893,12 +1884,12 @@ ScriptCommand_CloseAdvancedTextBox: ; ccc6 (3:4cc6) ScriptCommand_QuitScriptFully: ; cccc (3:4ccc) call ScriptCommand_CloseAdvancedTextBox - call ScriptCommand_EndScriptLoop1 + call ScriptCommand_EndScript pop hl ret ; args: 2-Text String Index -ScriptCommand_PrintTextString: ; ccd4 (3:4cd4) +ScriptCommand_PrintNPCText: ; ccd4 (3:4cd4) ld l, c ld h, b call Func_cc32 @@ -1932,8 +1923,8 @@ ScriptCommand_AskQuestionJump: ; cce9 (3:4ce9) jp IncreaseScriptPointerBy5 ; args - prize cards, deck id, duel theme index -; sets a battle up, doesn't start until we break out of the script system. -ScriptCommand_StartBattle: ; cd01 (3:4d01) +; sets a duel up, doesn't start until we break out of the script system. +ScriptCommand_StartDuel: ; cd01 (3:4d01) call Func_cd66 ld a, [wScriptNPC] ld l, LOADED_NPC_ID @@ -2001,7 +1992,7 @@ Func_cd76: ; cd76 (3:4d76) jp IncreaseScriptPointerBy1 ; prints text arg 1 or arg 2 depending on wScriptControlByte. -ScriptCommand_PrintVariableText: ; cd83 (3:4d83) +ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83) ld a, [wScriptControlByte] or a jr nz, .printText @@ -2014,7 +2005,6 @@ ScriptCommand_PrintVariableText: ; cd83 (3:4d83) Func_cd94: ; cd94 (3:4d94) get_flag_value EVENT_FLAG_44 -Unknown_cd98: dec a and $3 add a @@ -2690,7 +2680,7 @@ Func_d1b3: ; d1b3 (3:51b3) ; fallthrough .asm_d1c3 - ld hl, TradeCardNames + ld hl, ChallengeCupPrizeCards asm_d1c6: ld e, a add a @@ -2706,7 +2696,7 @@ asm_d1c6: ld [wTxRam2 + 1], a jp IncreaseScriptPointerBy1 -TradeCardNames: ; d1dc (3:51dc) +ChallengeCupPrizeCards: ; d1dc (3:51dc) db MEWTWO2 tx MewtwoTradeCardName @@ -3292,7 +3282,7 @@ Script_BeginGame: ; d52e (3:552e) MasonLaboratoryAfterDuel: ; d53b (3:553b) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -3356,7 +3346,7 @@ Script_Tech1: ; d583 (3:5583) start_script jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL - print_variable_text Tech1MasterMedalExplanationText, Tech1AutoDeckMachineExplanationText + print_variable_npc_text Tech1MasterMedalExplanationText, Tech1AutoDeckMachineExplanationText quit_script_fully .low_on_energies @@ -3375,10 +3365,10 @@ Script_Tech1: ; d583 (3:5583) jr nz, .next_energy_card start_script - print_text_string Tech1FewEnergyCardsText + print_npc_text Tech1FewEnergyCardsText pause_song play_song MUSIC_BOOSTER_PACK - print_text_string Tech1ReceivedEnergyCardsText + print_npc_text Tech1ReceivedEnergyCardsText wait_for_song_to_finish resume_song print_text_quit_fully Tech1GoodbyeText @@ -3395,19 +3385,19 @@ EnergyCardListEnd: Script_Tech2: ; d5ca (3:55ca) start_script jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL - print_variable_text Tech2LegendaryCardsExplanationText, Tech2LegendaryCardsCongratsText + print_variable_npc_text Tech2LegendaryCardsExplanationText, Tech2LegendaryCardsCongratsText quit_script_fully Script_Tech3: ; d5d5 (3:55d5) start_script jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL - print_variable_text Tech3BoosterPackExplanationText, Tech3LegendaryCardsCongratsText + print_variable_npc_text Tech3BoosterPackExplanationText, Tech3LegendaryCardsCongratsText quit_script_fully Script_Tech4: ; d5e0 (3:55e0) start_script jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL - print_variable_text Tech4ClubsExplanationText, Tech4DefeatedTheGrandMastersText + print_variable_npc_text Tech4ClubsExplanationText, Tech4DefeatedTheGrandMastersText quit_script_fully Preload_Tech5: ; d5eb (3:55eb) @@ -3424,7 +3414,7 @@ Preload_Tech5: ; d5eb (3:55eb) Script_Tech5: ; d5f9 (3:55f9) start_script jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL - print_variable_text Tech5DiaryAndEmailExplanationText, Tech5ChallengeMachineExplanationText + print_variable_npc_text Tech5DiaryAndEmailExplanationText, Tech5ChallengeMachineExplanationText quit_script_fully Preload_Sam: ; d604 (3:5604) @@ -3446,18 +3436,18 @@ Script_Sam: ; d61d (3:561d) show_sam_normal_multichoice close_text_box jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d63b - jump_if_flag_equal EVENT_FLAG_75, $02, Script_d6b0 + jump_if_flag_equal EVENT_FLAG_75, $02, Script_LostToSam.ows_d6b0 jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d637 - print_text_string Text05cb + print_npc_text Text05cb ask_question_jump Text05cc, .ows_d647 .ows_d637 - print_text_string Text05cd + print_npc_text Text05cd quit_script_fully .ows_d63b - print_text_string Text05ce + print_npc_text Text05ce ask_question_jump Text05cf, .ows_d647 - print_text_string Text05d0 + print_npc_text Text05d0 quit_script_fully .ows_d647 @@ -3484,32 +3474,32 @@ Script_Sam: ; d61d (3:561d) set_player_direction WEST move_active_npc NPCMovement_d889 jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d685 - start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 + start_duel PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully .ows_d685 - start_battle PRIZES_2, SAMS_NORMAL_DECK_ID, MUSIC_DUEL_THEME_1 + start_duel PRIZES_2, SAMS_NORMAL_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully Script_BeatSam: ; d68a (3:568a) start_script - jump_if_flag_equal EVENT_FLAG_3E, $01, Script_d82d - jump_if_flag_equal EVENT_FLAG_75, $01, Script_d6ad - print_text_string Text05d1 + jump_if_flag_equal EVENT_FLAG_3E, $01, Script_EnterLabFirstTime.ows_d82d + jump_if_flag_equal EVENT_FLAG_75, $01, Script_LostToSam.ows_d6ad + print_npc_text Text05d1 give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER print_text_quit_fully Text05d2 Script_LostToSam: ; d69f (3:569f) start_script - jump_if_flag_equal EVENT_FLAG_3E, $01, Script_d82d - jump_if_flag_equal EVENT_FLAG_75, $01, Script_d6ad + jump_if_flag_equal EVENT_FLAG_3E, $01, Script_EnterLabFirstTime.ows_d82d + jump_if_flag_equal EVENT_FLAG_75, $01, .ows_d6ad print_text_quit_fully Text05d3 -Script_d6ad: +.ows_d6ad print_text_quit_fully Text05d4 -Script_d6b0: - print_text_string Text05d5 +.ows_d6b0 + print_npc_text Text05d5 .ows_d6b3 close_text_box show_sam_tutorial_multichoice @@ -3521,25 +3511,25 @@ Script_d6b0: jump_if_flag_equal EVENT_FLAG_75, $04, .ows_d6f1 jump_if_flag_equal EVENT_FLAG_75, $05, .ows_d6f7 jump_if_flag_equal EVENT_FLAG_75, $06, .ows_d6fd - print_text_string Text05d6 + print_npc_text Text05d6 script_jump .ows_d6b3 .ows_d6df - print_text_string Text05d7 + print_npc_text Text05d7 script_jump .ows_d6b3 .ows_d6e5 - print_text_string Text05d8 + print_npc_text Text05d8 script_jump .ows_d6b3 .ows_d6eb - print_text_string Text05d9 + print_npc_text Text05d9 script_jump .ows_d6b3 .ows_d6f1 - print_text_string Text05da + print_npc_text Text05da script_jump .ows_d6b3 .ows_d6f7 - print_text_string Text05db + print_npc_text Text05db script_jump .ows_d6b3 .ows_d6fd - print_text_string Text05dc + print_npc_text Text05dc script_jump .ows_d6b3 Func_d703: ; d703 (3:5703) @@ -3567,33 +3557,33 @@ Script_EnterLabFirstTime: ; d753 (3:5753) move_player NORTH, 2 move_player NORTH, 2 move_player NORTH, 2 - print_text_string Text05e3 + print_npc_text Text05e3 close_advanced_text_box - set_next_npc_and_script NPC_SAM, Script_d779 - end_script_loop + set_next_npc_and_script NPC_SAM, .ows_d779 + end_script ret -Script_d779: ; d779 (03:5779) +.ows_d779 start_script move_active_npc NPCMovement_d880 - print_text_string Text05e4 + print_npc_text Text05e4 set_dialog_npc NPC_DRMASON - print_text_string Text05e5 + print_npc_text Text05e5 close_text_box move_active_npc NPCMovement_d882 run_command Func_cfc6 db $01 set_player_direction WEST close_advanced_text_box - set_next_npc_and_script NPC_DRMASON, Script_d794 - end_script_loop + set_next_npc_and_script NPC_DRMASON, .ows_d794 + end_script ret -Script_d794: ; d794 (3:5794) +.ows_d794 start_script move_active_npc NPCMovement_d88b do_frames 40 - print_text_string Text05e6 + print_npc_text Text05e6 close_text_box move_player WEST, 1 move_player WEST, 1 @@ -3603,9 +3593,9 @@ Script_d794: ; d794 (3:5794) move_player SOUTH, 1 set_player_direction WEST move_active_npc NPCMovement_d894 - print_text_string Text05e7 + print_npc_text Text05e7 set_dialog_npc $07 - print_text_string Text05e8 + print_npc_text Text05e8 .ows_d7bc close_text_box @@ -3618,63 +3608,63 @@ Script_d794: ; d794 (3:5794) 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 + print_npc_text Text05d6 script_jump .ows_d7bc .ows_d7e8 - print_text_string Text05d7 + print_npc_text Text05d7 script_jump .ows_d7bc .ows_d7ee - print_text_string Text05d8 + print_npc_text Text05d8 script_jump .ows_d7bc .ows_d7f4 - print_text_string Text05d9 + print_npc_text Text05d9 script_jump .ows_d7bc .ows_d7fa - print_text_string Text05da + print_npc_text Text05da script_jump .ows_d7bc .ows_d800 - print_text_string Text05db + print_npc_text Text05db script_jump .ows_d7bc .ows_d806 - print_text_string Text05dc + print_npc_text Text05dc script_jump .ows_d7bc .ows_d80c - print_text_string Text05e9 + print_npc_text Text05e9 ask_question_jump_default_yes NULL, .ows_d817 script_jump .ows_d7bc .ows_d817 set_dialog_npc $01 - print_text_string Text05ea + print_npc_text Text05ea 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 + set_next_npc_and_script NPC_SAM, .ows_d827 + end_script ret -Script_d827: ; d827 (3:5827) +.ows_d827 start_script - start_battle PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 + start_duel PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully -Script_d82d: +.ows_d82d close_advanced_text_box - set_next_npc_and_script $01, AfterTutorialBattleScript - end_script_loop + set_next_npc_and_script $01, Script_AfterPracticeDuel + end_script ret -AfterTutorialBattleScript: ; d834 (3:5834) +Script_AfterPracticeDuel: ; d834 (3:5834) start_script - print_text_string Text05eb - print_text_string Text05ef + print_npc_text Text05eb + print_npc_text Text05ef close_text_box move_active_npc NPCMovement_d896 set_player_direction NORTH @@ -3685,19 +3675,19 @@ AfterTutorialBattleScript: ; d834 (3:5834) move_player EAST, 1 move_player EAST, 1 set_player_direction NORTH - print_text_string Text05f0 + print_npc_text Text05f0 close_text_box run_command Func_ccdc tx Text05f1 close_text_box - print_text_string Text05f2 + print_npc_text Text05f2 .ows_d85f - choose_starter_deck_multichoice + choose_starter_deck close_text_box ask_question_jump Text05f3, .ows_d869 script_jump .ows_d85f .ows_d869 - print_text_string Text05f4 + print_npc_text Text05f4 close_text_box pause_song play_song MUSIC_BOOSTER_PACK @@ -3708,7 +3698,7 @@ AfterTutorialBattleScript: ; d834 (3:5834) close_text_box script_set_flag_value EVENT_FLAG_3E, $03 run_command Func_d3d4 - print_text_string Text05f6 + print_npc_text Text05f6 run_command Func_d396 db $00 quit_script_fully @@ -3757,7 +3747,7 @@ NPCMovement_d896: ; d896 (3:5896) DeckMachineRoomAfterDuel: ; d89f (3:589f) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -3783,7 +3773,12 @@ Script_Aaron: ; d8dd (3:58dd) INCROM $d8dd, $d903 Script_BeatAaron: ; d903 (3:5903) - INCROM $d903, $d92e + ld a, [wMultichoiceTextboxResult_ChooseDeckToDuelAgainst] + ld c, a + set_flag_value EVENT_FLAG_73 +; 0xd90b + + INCROM $d90b, $d92e Script_LostToAaron: ; d92e (3:592e) INCROM $d92e, $d932 @@ -3800,28 +3795,85 @@ Script_d932: ; d932 (3:5932) quit_script_fully Script_d93f: ; d93f (3:593f) - INCROM $d93f, $d995 + ld a, $02 + call Func_d96c +; 0xd944 + + INCROM $d944, $d96c + +Func_d96c: ; d96c (3:596c) + sub $02 + add a + ld c, a + ld b, $00 + ld hl, ClubMapNames + add hl, bc + ld a, [hli] + ld [wTxRam2], a + ld [wTxRam2_b], a + ld a, [hl] + ld [wTxRam2 + 1], a + ld [wTxRam2_b + 1], a + ret + +ClubMapNames: ; d985 (3:5985) + tx FightingClubMapNameText + tx RockClubMapNameText + tx WaterClubMapNameText + tx LightningClubMapNameText + tx GrassClubMapNameText + tx PsychicClubMapNameText + tx ScienceClubMapNameText + tx FireClubMapNameText Script_d995: ; d995 (3:5995) - INCROM $d995, $d9c2 + ld a, $03 + call Func_d96c +; 0xd99a + + INCROM $d99a, $d9c2 Script_d9c2: ; d9c2 (3:59c2) - INCROM $d9c2, $d9ef + ld a, $04 + call Func_d96c +; 0xd9c7 + + INCROM $d9c7, $d9ef Script_d9ef: ; d9ef (3:59ef) - INCROM $d9ef, $da1c + ld a, $05 + call Func_d96c +; 0xd9f4 + + INCROM $d9f4, $da1c Script_da1c: ; da1c (3:5a1c) - INCROM $da1c, $da49 + ld a, $06 + call Func_d96c +; 0xda21 + + INCROM $da21, $da49 Script_da49: ; da49 (3:5a49) - INCROM $da49, $da76 + ld a, $07 + call Func_d96c +; 0xda4e + + INCROM $da4e, $da76 Script_da76: ; da76 (3:5a76) - INCROM $da76, $daa3 + ld a, $08 + call Func_d96c +; 0xda7b + + INCROM $da7b, $daa3 Script_daa3: ; daa3 (3:5aa3) - INCROM $daa3, $dad0 + ld a, $09 + call Func_d96c +; 0xdaa8 + + INCROM $daa8, $dad0 Script_dad0: ; dad0 (3:5ad0) INCROM $dad0, $dadd @@ -3837,6 +3889,7 @@ Preload_NikkiInIshiharasHouse: ; dadd (3:5add) ret ; 0xdae9 +Script_dae9: ; dae9 (3:5ae9) INCROM $dae9, $db3d Preload_IshiharaInIshiharasHouse: ; db3d (3:5b3d) @@ -3876,16 +3929,16 @@ Script_Ishihara: ; db4a (3:5b4a) .ows_db93 jump_if_flag_equal EVENT_FLAG_1F, $01, NULL - print_variable_text Text0729, Text072a + print_variable_npc_text Text0729, Text072a script_set_flag_value EVENT_FLAG_1F, $02 - ask_question_jump Text072b, .check_ifhave_clefable_incollectionordecks + ask_question_jump Text072b, .check_if_clefable_owned print_text_quit_fully Text072c -.check_ifhave_clefable_incollectionordecks - jump_if_card_owned CLEFABLE, .check_ifhave_clefable_incollectiononly +.check_if_clefable_owned + jump_if_card_owned CLEFABLE, .check_if_clefable_in_collection print_text_quit_fully Text072d -.check_ifhave_clefable_incollectiononly +.check_if_clefable_in_collection jump_if_card_in_collection CLEFABLE, .do_clefable_trade print_text_quit_fully Text072e @@ -3893,7 +3946,7 @@ Script_Ishihara: ; db4a (3:5b4a) max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $03 zero_out_flag_value EVENT_FLAG_38 - print_text_string Text072f + print_npc_text Text072f run_command Func_ccdc tx Text0730 take_card CLEFABLE @@ -3903,16 +3956,16 @@ Script_Ishihara: ; db4a (3:5b4a) .ows_dbcc jump_if_flag_equal EVENT_FLAG_1F, $03, NULL - print_variable_text Text0732, Text0733 + print_variable_npc_text Text0732, Text0733 script_set_flag_value EVENT_FLAG_1F, $04 - ask_question_jump Text072b, .check_ifhave_ditto_incollectionordecks + ask_question_jump Text072b, .check_if_ditto_owned print_text_quit_fully Text072c -.check_ifhave_ditto_incollectionordecks - jump_if_card_owned DITTO, .check_ifhave_ditto_incollectiononly +.check_if_ditto_owned + jump_if_card_owned DITTO, .check_if_ditto_in_collection print_text_quit_fully Text0734 -.check_ifhave_ditto_incollectiononly +.check_if_ditto_in_collection jump_if_card_in_collection DITTO, .do_ditto_trade print_text_quit_fully Text0735 @@ -3920,7 +3973,7 @@ Script_Ishihara: ; db4a (3:5b4a) max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $05 zero_out_flag_value EVENT_FLAG_38 - print_text_string Text072f + print_npc_text Text072f run_command Func_ccdc tx Text0736 take_card DITTO @@ -3930,16 +3983,16 @@ Script_Ishihara: ; db4a (3:5b4a) .ows_dc05 jump_if_flag_equal EVENT_FLAG_1F, $05, NULL - print_variable_text Text0738, Text0739 + print_variable_npc_text Text0738, Text0739 script_set_flag_value EVENT_FLAG_1F, $06 - ask_question_jump Text072b, .check_ifhave_chansey_incollectionordecks + ask_question_jump Text072b, .check_if_chansey_owned print_text_quit_fully Text072c -.check_ifhave_chansey_incollectionordecks - jump_if_card_owned CHANSEY, .check_ifhave_chansey_incollectiononly +.check_if_chansey_owned + jump_if_card_owned CHANSEY, .check_if_chansey_in_collection print_text_quit_fully Text073a -.check_ifhave_chansey_incollectiononly +.check_if_chansey_in_collection jump_if_card_in_collection CHANSEY, .do_chansey_trade print_text_quit_fully Text073b @@ -3947,7 +4000,7 @@ Script_Ishihara: ; db4a (3:5b4a) max_out_flag_value EVENT_FLAG_00 script_set_flag_value EVENT_FLAG_1F, $07 zero_out_flag_value EVENT_FLAG_38 - print_text_string Text072f + print_npc_text Text072f run_command Func_ccdc tx Text073c take_card CHANSEY @@ -3972,7 +4025,7 @@ Script_Ronald: ; dc4b (3:5c4b) print_text_quit_fully Text073f .ows_dc55 - print_text_string Text0740 + print_npc_text Text0740 ask_question_jump Text0741, .ows_dc60 print_text_quit_fully Text0742 @@ -3989,7 +4042,7 @@ Script_Clerk1: ; dc64 (3:5c64) FightingClubLobbyAfterDuel: ; dc68 (3:5c68) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4009,47 +4062,46 @@ 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, NULL - print_variable_text Text0467, Text0468 + print_variable_npc_text Text0467, Text0468 max_out_flag_value EVENT_TEMP_TALKED_TO_IMAKUNI - ask_question_jump Text0469, .acceptDuel - print_text_string Text046a + ask_question_jump Text0469, .start_duel + print_npc_text Text046a quit_script_fully -.acceptDuel - print_text_string Text046b - start_battle PRIZES_6, IMAKUNI_DECK_ID, MUSIC_IMAKUNI +.start_duel + print_npc_text Text046b + start_duel PRIZES_6, IMAKUNI_DECK_ID, MUSIC_IMAKUNI quit_script_fully Script_BeatImakuni: ; dd2d (3:5d2d) start_script - jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $07, .giveBoosters + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $07, .give_boosters 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 - print_text_string Text046c + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $03, .three_wins + jump_if_flag_equal EVENT_IMAKUNI_WIN_COUNT, $06, .six_wins +.give_boosters + print_npc_text Text046c give_one_of_each_trainer_booster script_jump .done -.threeWins - print_text_string Text046d - script_jump .giveImakuniCard +.three_wins + print_npc_text Text046d + script_jump .give_imakuni_card -.sixWins - print_text_string Text046e -.giveImakuniCard - print_text_string Text046f +.six_wins + print_npc_text Text046e +.give_imakuni_card + print_npc_text Text046f give_card IMAKUNI_CARD show_card_received_screen IMAKUNI_CARD .done - print_text_string Text0470 - script_jump ScriptJump_ImakuniCommon + print_npc_text Text0470 + script_jump Script_LostToImakuni.imakuni_common Script_LostToImakuni: ; dd5c (3:5d5c) start_script - print_text_string Text0471 - -ScriptJump_ImakuniCommon: ; dd60 (3:5d60) + print_npc_text Text0471 +.imakuni_common close_text_box jump_if_player_coords_match 18, 4, .ows_dd69 script_jump .ows_dd6e @@ -4061,7 +4113,7 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60) .ows_dd6e move_active_npc NPCMovement_dd78 run_command Func_cdcb - max_out_flag_value EVENT_TEMP_BATTLED_IMAKUNI + max_out_flag_value EVENT_TEMP_DUELED_IMAKUNI run_command Func_d408 db $09 run_command Func_d41d @@ -4093,7 +4145,7 @@ Script_Granny1: ; dd9f (3:5d9f) FightingClubAfterDuel: ; dda3 (3:5da3) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4125,7 +4177,7 @@ Script_Mitch: ; ddc3 (3:5dc3) fight_club_pupil_jump .first_interaction, .three_pupils_remaining, \ .two_pupils_remaining, .one_pupil_remaining, .all_pupils_defeated .first_interaction - print_text_string Text0477 + print_npc_text 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 @@ -4137,28 +4189,28 @@ Script_Mitch: ; ddc3 (3:5dc3) .one_pupil_remaining print_text_quit_fully Text047a .all_pupils_defeated - print_text_string Text047b - ask_question_jump Text047c, .do_battle - print_text_string Text047d + print_npc_text Text047b + ask_question_jump Text047c, .start_duel + print_npc_text Text047d quit_script_fully -.do_battle - print_text_string Text047e - start_battle PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text047e + start_duel PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully Script_BeatMitch: ; ddff (3:5dff) start_script jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_GiveBoosters - print_text_string Text047f + print_npc_text 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 - print_text_string Text0480 + print_npc_text Text0480 give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER - print_text_string Text0481 + print_npc_text Text0481 quit_script_fully Script_LostToMitch: ; de19 (3:5e19) @@ -4167,22 +4219,22 @@ Script_LostToMitch: ; de19 (3:5e19) print_text_quit_fully Text0482 Script_Mitch_AlreadyHaveMedal: ; de21 (3:5e21) - print_text_string Text0483 - ask_question_jump Text047c, .do_battle - print_text_string Text0484 + print_npc_text Text0483 + ask_question_jump Text047c, .start_duel + print_npc_text Text0484 quit_script_fully -.do_battle - print_text_string Text0485 - start_battle PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text0485 + start_duel PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully -Script_Mitch_GiveBoosters: - print_text_string Text0486 +Script_Mitch_GiveBoosters: ; de35 (3:5e35) + print_npc_text Text0486 give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER - print_text_string Text0487 + print_npc_text Text0487 quit_script_fully -Script_Mitch_PrintTrainHarderText: +Script_Mitch_PrintTrainHarderText: ; de40 (3:5e40) print_text_quit_fully Text0488 Preload_ChrisInFightingClub: ; de43 (3:5e43) @@ -4217,7 +4269,7 @@ Script_Clerk2: ; ded1 (3:5ed1) RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4267,7 +4319,7 @@ Script_Lass3: ; dfd2 (3:5fd2) RockClubAfterDuel: ; dfd6 (3:5fd6) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4319,7 +4371,7 @@ Script_Clerk3: ; e09e (3:609e) WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4333,7 +4385,7 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) get_flag_value EVENT_IMAKUNI_STATE cp IMAKUNI_TALKED jr c, .asm_e0c6 - get_flag_value EVENT_TEMP_BATTLED_IMAKUNI + get_flag_value EVENT_TEMP_DUELED_IMAKUNI jr nz, .asm_e0c6 get_flag_value EVENT_IMAKUNI_ROOM cp IMAKUNI_WATER_CLUB @@ -4351,31 +4403,31 @@ 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, NULL - print_variable_text Gal1WantToTrade1Text, Gal1WantToTrade2Text + print_variable_npc_text Gal1WantToTrade1Text, Gal1WantToTrade2Text script_set_flag_value EVENT_FLAG_12, $01 ask_question_jump Gal1WouldYouLikeToTradeText, .ows_e0eb - print_text_string Gal1DeclinedTradeText + print_npc_text Gal1DeclinedTradeText quit_script_fully .ows_e0eb jump_if_card_owned LAPRAS, .ows_e0f3 - print_text_string Gal1DontOwnCardText + print_npc_text Gal1DontOwnCardText quit_script_fully .ows_e0f3 jump_if_card_in_collection LAPRAS, .ows_e0fb - print_text_string Gal1CardInDeckText + print_npc_text Gal1CardInDeckText quit_script_fully .ows_e0fb script_set_flag_value EVENT_FLAG_12, $02 - print_text_string Gal1LetsTradeText + print_npc_text Gal1LetsTradeText run_command Func_ccdc tx Gal1TradeCompleteText take_card LAPRAS give_card ARCANINE1 show_card_received_screen ARCANINE1 - print_text_string Gal1ThanksText + print_npc_text Gal1ThanksText quit_script_fully .ows_e10e @@ -4384,14 +4436,14 @@ Script_Gal1: ; e0cf (3:60cf) Script_Lass1: ; e111 (3:6111) start_script jump_if_flag_equal EVENT_FLAG_14, $01, .ows_e121 - print_text_string Text0427 + print_npc_text Text0427 script_set_flag_value EVENT_FLAG_14, $01 script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_MENTIONED quit_script_fully .ows_e121 jump_if_flag_not_equal EVENT_IMAKUNI_ROOM, IMAKUNI_WATER_CLUB, .ows_e12d - jump_if_flag_nonzero_2 EVENT_TEMP_BATTLED_IMAKUNI, .ows_e12d + jump_if_flag_nonzero_2 EVENT_TEMP_DUELED_IMAKUNI, .ows_e12d print_text_quit_fully Text0428 .ows_e12d @@ -4424,7 +4476,7 @@ WaterClubMovePlayer: ; e13f (3:613f) WaterClubAfterDuel: ; e157 (3:6157) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4451,21 +4503,21 @@ WaterClubAfterDuel: ; e157 (3:6157) Script_Sara: ; e177 (3:6177) start_script - print_text_string Text042c - ask_question_jump Text042d, .yes_duel - print_text_string Text042e + print_npc_text Text042c + ask_question_jump Text042d, .start_duel + print_npc_text Text042e quit_script_fully -.yes_duel - print_text_string Text042f - start_battle PRIZES_2, WATERFRONT_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 +.start_duel + print_npc_text Text042f + start_duel PRIZES_2, WATERFRONT_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully Script_BeatSara: ; e18c (3:618c) start_script max_out_flag_value EVENT_BEAT_SARA - print_text_string Text0430 + print_npc_text Text0430 give_booster_packs BOOSTER_COLOSSEUM_WATER, BOOSTER_COLOSSEUM_WATER, NO_BOOSTER - print_text_string Text0431 + print_npc_text Text0431 quit_script_fully Script_LostToSara: ; e19a (03:619a) @@ -4474,21 +4526,21 @@ Script_LostToSara: ; e19a (03:619a) Script_Amanda: ; e19e (03:619e) start_script - print_text_string Text0433 - ask_question_jump Text0434, .yes_duel - print_text_string Text0435 + print_npc_text Text0433 + ask_question_jump Text0434, .start_duel + print_npc_text Text0435 quit_script_fully -.yes_duel - print_text_string Text0436 - start_battle PRIZES_3, LONELY_FRIENDS_DECK_ID, MUSIC_DUEL_THEME_1 +.start_duel + print_npc_text Text0436 + start_duel PRIZES_3, LONELY_FRIENDS_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully Script_BeatAmanda: ; e1b3 (03:61b3) start_script max_out_flag_value EVENT_BEAT_AMANDA - print_text_string Text0437 + print_npc_text Text0437 give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER - print_text_string Text0438 + print_npc_text Text0438 quit_script_fully Script_LostToAmanda: ; e1c1 (03:61c1) @@ -4503,7 +4555,7 @@ Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) .ows_e1d5 move_player SOUTH, 4 move_active_npc NPCMovement_e213 - print_text_string Text043a + print_npc_text Text043a jump_if_player_coords_match $12, $0a, .ows_e1fe jump_if_player_coords_match $14, $0a, .ows_e202 move_active_npc NPCMovement_e215 @@ -4570,55 +4622,55 @@ Script_Joshua: ; e21c (3:621c) script_jump .beat_sara_and_amanda .sara_and_amanda_not_beaten script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_TALKED - print_text_string Text043b + print_npc_text Text043b quit_script_fully .beat_sara_and_amanda 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 + print_npc_text Text043b + print_npc_text Text043c .already_talked jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL - print_variable_text Text043d, Text043e - ask_question_jump Text043f, .startDuel + print_variable_npc_text Text043d, Text043e + ask_question_jump Text043f, .start_duel jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL - print_variable_text Text0440, Text0441 + print_variable_npc_text Text0440, Text0441 quit_script_fully -.startDuel - print_text_string Text0442 +.start_duel + print_npc_text Text0442 try_give_pc_pack $04 - start_battle PRIZES_4, SOUND_OF_THE_WAVES_DECK_ID, MUSIC_DUEL_THEME_1 + start_duel PRIZES_4, SOUND_OF_THE_WAVES_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully Script_LostToJoshua: ; e260 (3:6260) start_script jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL - print_variable_text Text0443, Text0444 + print_variable_npc_text Text0443, Text0444 quit_script_fully Script_BeatJoshua: ; e26c (3:626c) start_script jump_if_flag_equal EVENT_JOSHUA_STATE, JOSHUA_TALKED, NULL - print_variable_text Text0445, Text0446 + print_variable_npc_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, NULL - print_variable_text Text0447, Text0448 - jump_if_flag_not_equal EVENT_JOSHUA_STATE, JOSHUA_BEATEN, .firstJoshuaWin + print_variable_npc_text Text0447, Text0448 + jump_if_flag_not_equal EVENT_JOSHUA_STATE, JOSHUA_BEATEN, .first_joshua_win quit_script_fully -.firstJoshuaWin +.first_joshua_win script_set_flag_value EVENT_JOSHUA_STATE, JOSHUA_BEATEN - print_text_string Text0449 + print_npc_text Text0449 close_text_box move_active_npc_by_direction NPCMovementTable_e2a1 - print_text_string Text044a + print_npc_text Text044a run_command Func_cfc6 db $00 close_advanced_text_box set_next_npc_and_script NPC_AMY, Script_MeetAmy - end_script_loop + end_script ret NPCMovementTable_e2a1: ; e2a1 (3:62a1) @@ -4657,11 +4709,11 @@ Preload_Amy: ; e2ad (3:62ad) Script_MeetAmy: ; e2d1 (3:62d1) start_script - print_text_string Text044b + print_npc_text Text044b set_dialog_npc NPC_JOSHUA - print_text_string Text044c + print_npc_text Text044c set_dialog_npc NPC_AMY - print_text_string Text044d + print_npc_text Text044d close_text_box run_command Func_d095 db $09 @@ -4680,45 +4732,45 @@ Script_MeetAmy: ; e2d1 (3:62d1) set_player_direction NORTH move_player NORTH, 1 move_player NORTH, 1 - move_arbitrary_npc NPC_JOSHUA, NPCMovement_e2ab - print_text_string Text044e - script_jump Script_Amy.askConfirmDuel + move_npc NPC_JOSHUA, NPCMovement_e2ab + print_npc_text Text044e + script_jump Script_Amy.ask_for_duel Script_Amy: ; e304 (3:6304) start_script - jump_if_flag_nonzero_2 EVENT_BEAT_AMY, ScriptJump_TalkToAmyAgain - print_text_string Text044f -.askConfirmDuel - ask_question_jump Text0450, .startDuel + jump_if_flag_nonzero_2 EVENT_BEAT_AMY, Script_Amy_AlreadyHaveMedal + print_npc_text Text044f +.ask_for_duel + ask_question_jump Text0450, .start_duel -.denyDuel - print_text_string Text0451 +.deny_duel + print_npc_text Text0451 run_command Func_d0d9 db $14 db $04 dw Script_LostToAmy.ows_e34e quit_script_fully -.startDuel - print_text_string Text0452 - start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text0452 + start_duel PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully Script_BeatAmy: ; e322 (3:6322) start_script - print_text_string Text0453 - jump_if_flag_nonzero_2 EVENT_BEAT_AMY, .beatAmyCommon - print_text_string Text0454 + print_npc_text Text0453 + jump_if_flag_nonzero_2 EVENT_BEAT_AMY, .give_booster_packs + print_npc_text Text0454 max_out_flag_value EVENT_BEAT_AMY try_give_medal_pc_packs run_command Func_d125 db EVENT_BEAT_AMY run_command Func_d435 db $03 - print_text_string Text0455 -.beatAmyCommon + print_npc_text Text0455 +.give_booster_packs give_booster_packs BOOSTER_LABORATORY_WATER, BOOSTER_LABORATORY_WATER, NO_BOOSTER - print_text_string Text0456 + print_npc_text Text0456 run_command Func_d0d9 db $14 db $04 @@ -4727,7 +4779,7 @@ Script_BeatAmy: ; e322 (3:6322) Script_LostToAmy: ; e344 (3:6344) start_script - print_text_string Text0457 + print_npc_text Text0457 run_command Func_d0d9 db $14 db $04 @@ -4744,14 +4796,14 @@ Script_LostToAmy: ; e344 (3:6344) db $04 quit_script_fully -ScriptJump_TalkToAmyAgain: ; e356 (3:6356) - print_text_string Text0458 - ask_question_jump Text0450, .startDuel - script_jump Script_Amy.denyDuel +Script_Amy_AlreadyHaveMedal: ; e356 (3:6356) + print_npc_text Text0458 + ask_question_jump Text0450, .start_duel + script_jump Script_Amy.deny_duel -.startDuel - print_text_string Text0459 - start_battle PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text0459 + start_duel PRIZES_6, GO_GO_RAIN_DANCE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully Script_Clerk4: ; e369 (3:6369) @@ -4759,7 +4811,7 @@ Script_Clerk4: ; e369 (3:6369) LightningClubLobbyAfterDuel: ; e36d (3:636d) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4783,7 +4835,7 @@ Script_Hood1: ; e3dd (3:63dd) LightningClubAfterDuel: ; e3e8 (3:63e8) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4849,10 +4901,10 @@ Script_LostToIsaac: ; e4fb (3:64fb) GrassClubEntranceAfterDuel: ; e525 (3:6525) ld hl, GrassClubEntranceAfterDuelTable - call FindEndOfBattleScript + call FindEndOfDuelScript ret -FindEndOfBattleScript: ; e52c (3:652c) +FindEndOfDuelScript: ; e52c (3:652c) ld c, $0 ld a, [wDuelResult] or a ; cp DUEL_WIN @@ -4916,7 +4968,7 @@ Script_LostToMichaelInGrassClubEntrance: ; e5ab (3:65ab) GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -4929,30 +4981,30 @@ GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) Script_Brittany: ; e5d2 (3:65d2) start_script jump_if_flag_less_than EVENT_FLAG_35, $01, NULL - print_variable_text Text06e0, Text06e1 - ask_question_jump Text06e2, .wantToDuel - print_text_string Text06e3 + print_variable_npc_text Text06e0, Text06e1 + ask_question_jump Text06e2, .start_duel + print_npc_text Text06e3 quit_script_fully -.wantToDuel - print_text_string Text06e4 - start_battle PRIZES_4, ETCETERA_DECK_ID, MUSIC_DUEL_THEME_1 +.start_duel + print_npc_text Text06e4 + start_duel PRIZES_4, ETCETERA_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully Script_BeatBrittany: ; e5ee (3:65ee) start_script - print_text_string Text06e5 + print_npc_text Text06e5 give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER jump_if_flag_less_than EVENT_FLAG_35, $02, NULL - print_variable_text Text06e6, Text06e7 + print_variable_npc_text Text06e6, Text06e7 max_out_flag_value FLAG_BEAT_BRITTANY - jump_if_flag_not_less_than EVENT_FLAG_35, $02, .finishScript - jump_if_flag_zero_2 EVENT_FLAG_3A, .finishScript - jump_if_flag_zero_2 EVENT_FLAG_3B, .finishScript + jump_if_flag_not_less_than EVENT_FLAG_35, $02, .quit + jump_if_flag_zero_2 EVENT_FLAG_3A, .quit + jump_if_flag_zero_2 EVENT_FLAG_3B, .quit script_set_flag_value EVENT_FLAG_35, $01 max_out_flag_value EVENT_FLAG_1E - print_text_string Text06e8 -.finishScript + print_npc_text Text06e8 +.quit quit_script_fully Script_LostToBrittany: ; e618 (3:6618) @@ -4969,7 +5021,7 @@ Script_Lass2: ; e61f (3:661f) 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, NULL - print_variable_text Text06eb, Text06ec + print_variable_npc_text Text06eb, Text06ec script_set_flag_value EVENT_FLAG_37, $01 ask_question_jump Text06ed, .ows_e648 print_text_quit_fully Text06ee @@ -4985,7 +5037,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e656 max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $02 - print_text_string Text06f1 + print_npc_text Text06f1 run_command Func_ccdc tx Text06f2 take_card ODDISH @@ -4995,7 +5047,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e66a jump_if_flag_equal EVENT_FLAG_37, $02, NULL - print_variable_text Text06f4, Text06f5 + print_variable_npc_text Text06f4, Text06f5 script_set_flag_value EVENT_FLAG_37, $03 ask_question_jump Text06ed, .ows_e67f print_text_quit_fully Text06f6 @@ -5011,7 +5063,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e68d max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $04 - print_text_string Text06f9 + print_npc_text Text06f9 run_command Func_ccdc tx Text06fa take_card CLEFAIRY @@ -5021,7 +5073,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e6a1 jump_if_flag_equal EVENT_FLAG_37, $04, NULL - print_variable_text Text06fb, Text06fc + print_variable_npc_text Text06fb, Text06fc script_set_flag_value EVENT_FLAG_37, $05 ask_question_jump Text06ed, .ows_e6b6 print_text_quit_fully Text06fd @@ -5037,7 +5089,7 @@ Script_Lass2: ; e61f (3:661f) .ows_e6c4 max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $06 - print_text_string Text0700 + print_npc_text Text0700 run_command Func_ccdc tx Text0701 take_card CHARIZARD @@ -5056,7 +5108,7 @@ Script_Gal2: ; e6e3 (3:66e3) GrassClubAfterDuel: ; e6e7 (3:66e7) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5098,7 +5150,12 @@ Preload_NikkiInGrassClub: ; e796 (3:6796) INCROM $e796, $e79e Script_Nikki: ; e79e (3:679e) - INCROM $e79e, $e7d3 + ld a, [wCurMap] + cp ISHIHARAS_HOUSE + jp z, Script_dae9 +; 0xe7a6 + + INCROM $e7a6, $e7d3 Script_BeatNikki: ; e7d3 (3:67d3) INCROM $e7d3, $e7f2 @@ -5108,7 +5165,7 @@ Script_LostToNikki: ; e7f2 (3:67f2) ClubEntranceAfterDuel: ; e7f6 (3:67f6) ld hl, .after_duel_table - jp FindEndOfBattleScript + jp FindEndOfDuelScript .after_duel_table db NPC_RONALD2 @@ -5157,7 +5214,7 @@ TrySecondRonaldFight: ; e837 (3:6837) get_flag_value EVENT_FLAG_4D or a ret nz - ld bc, ScriptSecondRonaldFight + ld bc, Script_SecondRonaldFight jp SetNextNPCAndScript Script_Clerk6: ; e84c (3:684c) @@ -5175,19 +5232,19 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) move_active_npc NPCMovement_e894 run_command Func_d135 db $00 - print_text_string Text0645 + print_npc_text Text0645 close_text_box move_player NORTH, 1 move_player NORTH, 1 - print_text_string Text0646 + print_npc_text Text0646 ask_question_jump_default_yes NULL, .ows_e882 - print_text_string Text0647 + print_npc_text Text0647 script_jump .ows_e885 .ows_e882 - print_text_string Text0648 + print_npc_text Text0648 .ows_e885 - print_text_string Text0649 + print_npc_text Text0649 close_text_box set_player_direction WEST move_player EAST, 4 @@ -5212,7 +5269,7 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) move_active_npc NPCMovement_e905 do_frames $3c move_active_npc NPCMovement_e90d - print_text_string Text064a + print_npc_text Text064a jump_if_player_coords_match $08, $02, .ows_e8d6 set_player_direction WEST move_player WEST, 1 @@ -5220,24 +5277,23 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 - print_text_string Text064b + print_npc_text Text064b script_set_flag_value $4c, $01 - start_battle PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD + start_duel PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD quit_script_fully Script_BeatFirstRonaldFight: ; e8e9 (3:68e9) start_script - print_text_string Text064c + print_npc_text Text064c give_card JIGGLYPUFF1 show_card_received_screen JIGGLYPUFF1 - print_text_string Text064d - script_jump ScriptJump_FinishedFirstRonaldFight + print_npc_text Text064d + script_jump Script_LostToFirstRonaldFight.ows_e8fb Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) start_script - print_text_string Text064e - -ScriptJump_FinishedFirstRonaldFight: + print_npc_text Text064e +.ows_e8fb script_set_flag_value EVENT_FLAG_4C, $02 close_text_box move_active_npc NPCMovement_e90f @@ -5270,12 +5326,12 @@ NPCMovement_e90f: ; e90f (3:690f) Preload_Ronald3InClubEntrance: ; e915 (3:6915) INCROM $e915, $e91e -ScriptSecondRonaldFight: ; e91e (3:691e) +Script_SecondRonaldFight: ; e91e (3:691e) start_script move_active_npc NPCMovement_e905 do_frames 60 move_active_npc NPCMovement_e90d - print_text_string Text064f + print_npc_text Text064f jump_if_player_coords_match $08, $02, .ows_6934 set_player_direction WEST move_player WEST, 1 @@ -5283,24 +5339,23 @@ ScriptSecondRonaldFight: ; e91e (3:691e) set_player_direction SOUTH move_player SOUTH, 1 move_player SOUTH, 1 - print_text_string Text0650 + print_npc_text Text0650 script_set_flag_value EVENT_FLAG_4D, $01 - start_battle PRIZES_6, POWERFUL_RONALD_DECK_ID, MUSIC_RONALD + start_duel PRIZES_6, POWERFUL_RONALD_DECK_ID, MUSIC_RONALD quit_script_fully Script_BeatSecondRonaldFight: ; e947 (3:6947) start_script - print_text_string Text0651 + print_npc_text Text0651 give_card SUPER_ENERGY_RETRIEVAL show_card_received_screen SUPER_ENERGY_RETRIEVAL - print_text_string Text0652 - script_jump ScriptJump_FinishedSecondRonaldFight + print_npc_text Text0652 + script_jump Script_LostToSecondRonaldFight.ows_e959 Script_LostToSecondRonaldFight: ; e955 (3:6955) start_script - print_text_string Text0653 - -ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) + print_npc_text Text0653 +.ows_e959 script_set_flag_value EVENT_FLAG_4D, $02 close_text_box move_active_npc NPCMovement_e90f @@ -5310,7 +5365,7 @@ ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959) PsychicClubLobbyAfterDuel: ; e963 (3:6963) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5346,7 +5401,7 @@ Script_Chap4: ; ea3b (3:6a3b) PsychicClubAfterDuel: ; ea46 (3:6a46) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5404,7 +5459,7 @@ Script_Clerk7: ; eb53 (3:6b53) ScienceClubLobbyAfterDuel:; eb57 (3:6b57) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5424,14 +5479,37 @@ Script_Man3: ; ebc1 (3:6bc1) INCROM $ebc1, $ebc5 Script_Specs2: ; ebc5 (3:6bc5) - INCROM $ebc5, $ebed + call UpdateRNGSources + and $03 + ld c, a + ld b, $00 + ld hl, Data_ebe7 + add hl, bc + ld e, [hl] + ld d, $00 + call GetCardName + ld hl, wTxRam2 + ld a, e + ld [hli], a + ld [hl], d +; 0xebdd + + INCROM $ebdd, $ebe7 + +Data_ebe7: ; ebe7 (3:6be7) + db PORYGON + db DITTO + db MUK + db WEEZING + + INCROM $ebeb, $ebed Script_Specs3: ; ebed (3:6bed) INCROM $ebed, $ebf1 ScienceClubAfterDuel: ; ebf1 (3:6bf1) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5500,7 +5578,7 @@ Script_Clerk8: ; ed45 (3:6d45) FireClubLobbyAfterDuel: ; ed49 (3:6d49) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5594,7 +5672,7 @@ Script_Mania: ; ee88 (3:6e88) FireClubAfterDuel: ; ee93 (3:6e93) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -5652,26 +5730,26 @@ Script_Ken: ; ef22 (3:6f22) 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, NULL - print_variable_text Text06ba, Text06bb + print_variable_npc_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_nonzero_2 EVENT_FLAG_0A, Script_Ken_AlreadyHaveMedal jump_if_flag_zero_1 EVENT_FLAG_24, NULL - print_variable_text Text06bc, Text06bd + print_variable_npc_text Text06bc, Text06bd script_set_flag_value EVENT_FLAG_24, $01 - ask_question_jump Text06be, .do_battle - print_text_string Text06bf + ask_question_jump Text06be, .start_duel + print_npc_text Text06bf quit_script_fully -.do_battle - print_text_string Text06c0 - start_battle PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text06c0 + start_duel PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully Script_BeatKen: ; ef5e (3:6f5e) start_script - print_text_string Text06c1 + print_npc_text Text06c1 jump_if_flag_nonzero_2 EVENT_FLAG_0A, .give_booster_packs max_out_flag_value EVENT_FLAG_0A try_give_medal_pc_packs @@ -5679,25 +5757,25 @@ Script_BeatKen: ; ef5e (3:6f5e) db $0a run_command Func_d435 db $08 - print_text_string Text06c2 + print_npc_text Text06c2 .give_booster_packs give_booster_packs BOOSTER_MYSTERY_NEUTRAL, BOOSTER_MYSTERY_NEUTRAL, NO_BOOSTER - print_text_string Text06c3 + print_npc_text Text06c3 quit_script_fully Script_LostToKen: ; ef78 (3:6f78) start_script jump_if_flag_zero_2 EVENT_FLAG_0A, NULL - print_variable_text Text06c4, Text06c5 + print_variable_npc_text Text06c4, Text06c5 quit_script_fully -Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) - print_text_string Text06c6 - ask_question_jump Text06be, .do_battle +Script_Ken_AlreadyHaveMedal: ; ef83 (3:6f83) + print_npc_text Text06c6 + ask_question_jump Text06be, .start_duel print_text_quit_fully Text06bf -.do_battle - print_text_string Text06c7 - start_battle PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 +.start_duel + print_npc_text Text06c7 + start_duel PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully Preload_Clerk9: ; ef96 (3:6f96) @@ -5966,8 +6044,8 @@ ChallengeHallAfterDuel: ; f239 (3:7239) jp SetNextNPCAndScript ChallengeHallAfterDuelTable: - dw WonAtChallengeHall - dw LostAtChallengeHall + dw Script_WonAtChallengeHall + dw Script_LostAtChallengeHall ChallengeHallLoadMap: ; f258 (3:7258) get_flag_value EVENT_FLAG_47 @@ -6026,23 +6104,23 @@ Script_Clerk12: ; f295 (3:7295) print_text_quit_fully Text052a .ows_f2c7 - print_text_string Text052b + print_npc_text Text052b script_jump .ows_f2d6 .ows_f2cd - print_text_string Text052c + print_npc_text Text052c script_jump .ows_f2d6 .ows_f2d3 - print_text_string Text052d + print_npc_text Text052d .ows_f2d6 - print_text_string Text052e + print_npc_text Text052e ask_question_jump Text052f, .ows_f2e1 print_text_quit_fully Text0530 .ows_f2e1 max_out_flag_value EVENT_FLAG_59 - print_text_string Text0531 + print_npc_text Text0531 close_text_box move_active_npc NPCMovement_f349 jump_if_player_coords_match 8, 18, .ows_f2fa @@ -6085,7 +6163,7 @@ Script_Clerk12: ; f295 (3:7295) move_active_npc NPCMovement_f34e close_advanced_text_box set_next_npc_and_script $4a, Script_f353 - end_script_loop + end_script ret NPCMovement_f349: ; f349 (3:7349) @@ -6115,16 +6193,16 @@ Script_f353: ; f353 (3:7353) move_active_npc NPCMovement_f390 run_command Func_d16b db $00 - print_text_string Text0532 + print_npc_text Text0532 close_text_box move_active_npc NPCMovement_f37f - print_text_string Text0533 + print_npc_text Text0533 close_text_box move_active_npc NPCMovement_f388 - print_text_string Text0534 + print_npc_text Text0534 close_text_box move_active_npc NPCMovement_f38e - print_text_string Text0535 + print_npc_text Text0535 run_command Func_cd4f db $04 db $00 @@ -6168,23 +6246,23 @@ NPCMovement_f390: ; f390 (3:7390) db SOUTH | NO_MOVE db $ff -LostAtChallengeHall: ; f392 (3:7392) +Script_LostAtChallengeHall: ; f392 (3:7392) start_script do_frames 20 move_active_npc NPCMovement_f37d do_frames 20 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 + jump_if_flag_equal EVENT_FLAG_45, $02, Script_f410 + jump_if_flag_equal EVENT_FLAG_45, $03, Script_f410.ows_f41a run_command Func_d16b db $00 run_command Func_d16b db $01 - print_text_string Text0536 + print_npc_text Text0536 .ows_f3ae close_text_box move_active_npc NPCMovement_f38b - print_text_string Text0537 + print_npc_text Text0537 close_text_box move_active_npc NPCMovement_f38e jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f3ce @@ -6205,7 +6283,7 @@ LostAtChallengeHall: ; f392 (3:7392) .ows_f3e2 close_advanced_text_box set_next_npc_and_script NPC_CLERK12, Script_f3e9 - end_script_loop + end_script ret Script_f3e9: ; f3e9 (3:73e9) @@ -6233,23 +6311,23 @@ NPCMovement_f40d: ; f40d (3:740d) db SOUTH | NO_MOVE db $ff -ScriptJump_f410: ; f410 (4:7410) +Script_f410: ; f410 (4:7410) run_command Func_d16b db $00 run_command Func_d16b db $01 - print_text_string Text0538 - script_jump LostAtChallengeHall.ows_f3ae + print_npc_text Text0538 + script_jump Script_LostAtChallengeHall.ows_f3ae .ows_f41a - print_text_string Text0539 + print_npc_text Text0539 set_dialog_npc NPC_RONALD1 jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f42e jump_if_flag_equal EVENT_FLAG_44, $01, NULL - print_variable_text Text053a, Text053b + print_variable_npc_text Text053a, Text053b .ows_f42e set_dialog_npc NPC_HOST - script_jump LostAtChallengeHall.ows_f3ae + script_jump Script_LostAtChallengeHall.ows_f3ae Script_f433: ; f433 (3:7433) start_script @@ -6257,27 +6335,27 @@ Script_f433: ; f433 (3:7433) move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - script_jump WonAtChallengeHall.ows_f4a4 + script_jump Script_WonAtChallengeHall.ows_f4a4 -WonAtChallengeHall: ; f441 (3:7441) +Script_WonAtChallengeHall: ; f441 (3:7441) start_script do_frames 20 move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - jump_if_flag_equal EVENT_FLAG_45, $03, ScriptJump_f4db + jump_if_flag_equal EVENT_FLAG_45, $03, Script_f4db jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f456 .ows_f456 jump_if_flag_equal EVENT_FLAG_45, $01, NULL - print_variable_text Text053c, Text053d + print_variable_npc_text Text053c, Text053d move_active_npc NPCMovement_f37f run_command Func_d16b db $00 - print_text_string Text053e + print_npc_text Text053e close_text_box move_wram_npc NPCMovement_f4c8 run_command Func_cdd8 - print_text_string Text053f + print_npc_text Text053f close_text_box run_command Func_d195 run_command Func_cdf5 @@ -6287,31 +6365,31 @@ WonAtChallengeHall: ; f441 (3:7441) run_command Func_d16b db $00 jump_if_flag_equal EVENT_FLAG_45, $02, NULL - print_variable_text Text0540, Text0541 + print_variable_npc_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, NULL - print_variable_text Text0542, Text0543 + print_variable_npc_text Text0542, Text0543 set_dialog_npc NPC_HOST close_text_box .ows_f4a1 - print_text_string Text0544 + print_npc_text Text0544 .ows_f4a4 zero_out_flag_value EVENT_FLAG_47 - print_text_string Text0545 + print_npc_text Text0545 ask_question_jump_default_yes Text0546, .ows_f4bd jump_if_flag_equal EVENT_FLAG_45, $02, NULL - print_variable_text Text0547, Text0548 + print_variable_npc_text Text0547, Text0548 run_command Func_cd4f db $04 db $00 db $00 quit_script_fully .ows_f4bd - print_text_string Text0549 + print_npc_text Text0549 close_text_box max_out_flag_value EVENT_FLAG_47 run_command Func_d1ad @@ -6344,22 +6422,22 @@ NPCMovement_f4d8: ; f4d8 (3:74d8) db SOUTH | NO_MOVE db $ff -ScriptJump_f4db: ; f4db (3:74db) - print_text_string Text054a +Script_f4db: ; f4db (3:74db) + print_npc_text Text054a move_active_npc NPCMovement_f37f run_command Func_d16b db $00 - print_text_string Text054b + print_npc_text Text054b 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, NULL - print_variable_text Text054c, Text054d + print_variable_npc_text Text054c, Text054d move_wram_npc NPCMovement_f4d8 do_frames 40 move_wram_npc NPCMovement_f34c jump_if_flag_equal EVENT_FLAG_44, $01, NULL - print_variable_text Text054e, Text054f + print_variable_npc_text Text054e, Text054f set_dialog_npc NPC_HOST close_text_box move_wram_npc NPCMovement_f4c9 @@ -6369,14 +6447,14 @@ ScriptJump_f4db: ; f4db (3:74db) .ows_f516 run_command Func_cdd8 move_active_npc NPCMovement_f383 - print_text_string Text0550 + print_npc_text Text0550 close_text_box move_active_npc NPCMovement_f38b run_command Func_d1b3 - print_text_string Text0551 + print_npc_text Text0551 give_card VARIABLE_CARD show_card_received_screen $00 - print_text_string Text0552 + print_npc_text Text0552 close_text_box jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f540 jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f549 @@ -6394,7 +6472,7 @@ ScriptJump_f4db: ; f4db (3:74db) .ows_f552 close_advanced_text_box set_next_npc_and_script NPC_CLERK12, Script_f3e9 - end_script_loop + end_script ret ; Loads the NPC to fight at the challenge hall @@ -6505,15 +6583,24 @@ PokemonDomeEntranceCloseTextBox: ; f62a (3:762a) Script_f631: ; f631 (3:7631) start_script - print_text_string Text0508 + print_npc_text Text0508 close_advanced_text_box set_next_npc_and_script NPC_RONALD1, .ows_f63c - end_script_loop - + end_script ret .ows_f63c - INCROM $f63c, $f6af + call TryGiveMedalPCPacks + get_flag_value EVENT_MEDAL_COUNT + ld [wTxRam3], a + inc a + ld [wTxRam3_b], a + xor a + ld [wTxRam3 + 1], a + ld [wTxRam3_b + 1], a +; 0xf651 + + INCROM $f651, $f6af Script_f6af: ; f6af (3:76af) INCROM $f6af, $f6c6 @@ -6523,7 +6610,7 @@ PokemonDomeMovePlayer: ; f6c6 (3:76c6) PokemonDomeAfterDuel: ; f6e0 (3:76e0) ld hl, .after_duel_table - call FindEndOfBattleScript + call FindEndOfDuelScript ret .after_duel_table @@ -6693,7 +6780,7 @@ PointerTable_fc4c: ; fc4c (3:7c4c) Script_fc52: ; fc52 (3:7c52) start_script - print_text_string Text06c8 + print_npc_text Text06c8 ask_question_jump_default_yes NULL, .ows_fc5e print_text_quit_fully Text06c9 @@ -6732,13 +6819,13 @@ Func_fc7a: ; fc7a (3:7c7a) start_script jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5 - print_text_string Text06cd + print_npc_text Text06cd run_command Func_d39d db $00 jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa - print_text_string Text06ce + print_npc_text Text06ce ask_question_jump_default_yes Text06cf, .ows_fca0 - print_text_string Text06d0 + print_npc_text Text06d0 script_jump Func_fc7a.ows_fcaa .ows_fca0 @@ -6778,9 +6865,9 @@ Func_fcad: ; fcad (3:7cad) print_text_quit_fully Text06d5 .ows_fcd5 - move_arbitrary_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce1 - print_text_string Text06d6 - move_arbitrary_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce3 + move_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce1 + print_npc_text Text06d6 + move_npc NPC_GIFT_CENTER_CLERK, NPCMovement_fce3 quit_script_fully NPCMovement_fce1: ; fce1 (3:7ce1) diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index db3ae26..143d37d 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -337,7 +337,10 @@ Func_10cbb: ; 10cbb (4:4cbb) INCROM $10cbb, $10cea Func_10cea: ; 10cea (4:4cea) - INCROM $10cea, $10dba + INCROM $10cea, $10d98 + +Unknown_10d98: ; 10d98 (4:4d98) + INCROM $10d98, $10dba Func_10dba: ; 10dba (4:4dba) ld a, $1 @@ -1002,13 +1005,13 @@ Func_11f4e: ; 11f4e (4:5f4e) INCROM $11f4e, $1217b OverworldScriptTable: ; 1217b (4:617b) - dw ScriptCommand_EndScriptLoop1 + dw ScriptCommand_EndScript dw ScriptCommand_CloseAdvancedTextBox - dw ScriptCommand_PrintTextString + dw ScriptCommand_PrintNPCText dw Func_ccdc dw ScriptCommand_AskQuestionJump - dw ScriptCommand_StartBattle - dw ScriptCommand_PrintVariableText + dw ScriptCommand_StartDuel + dw ScriptCommand_PrintVariableNPCText dw Func_cda8 dw ScriptCommand_PrintTextQuitFully dw Func_cdcb @@ -1085,11 +1088,11 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_ShowSamNormalMultichoice dw ScriptCommand_ShowSamTutorialMultichoice dw Func_d43d - dw ScriptCommand_EndScriptLoop2 - dw ScriptCommand_EndScriptLoop3 - dw ScriptCommand_EndScriptLoop4 - dw ScriptCommand_EndScriptLoop5 - dw ScriptCommand_EndScriptLoop6 + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript dw ScriptCommand_SetFlagValue dw ScriptCommand_JumpIfFlagZero1 dw ScriptCommand_JumpIfFlagNonzero1 @@ -1102,10 +1105,10 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_JumpIfFlagNonzero2 dw ScriptCommand_JumpIfFlagZero2 dw ScriptCommand_IncrementFlagValue - dw ScriptCommand_EndScriptLoop7 - dw ScriptCommand_EndScriptLoop8 - dw ScriptCommand_EndScriptLoop9 - dw ScriptCommand_EndScriptLoop10 + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript + dw ScriptCommand_EndScript MultichoiceTextbox_ConfigTable_ChooseDeckToDuelAgainst: ;1224b diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm index 0de163d..a1c6f0d 100644 --- a/src/engine/bank05.asm +++ b/src/engine/bank05.asm @@ -804,7 +804,7 @@ EstimateDamage_VersusDefendingCard: ; 143e5 (5:43e5) push hl ld [hl], $00 call CalculateDamage_VersusDefendingPokemon -; ...and subsequently recovered to continue the battle normally +; ...and subsequently recovered to continue the duel normally pop hl pop af ld [hl], a @@ -1025,7 +1025,7 @@ EstimateDamage_FromDefendingPokemon: ; 1450b (5:450b) push hl ld [hl], $00 call CalculateDamage_FromDefendingPokemon -; ...and subsequently recovered to continue the battle normally +; ...and subsequently recovered to continue the duel normally pop hl pop af ld [hl], a diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 5884ffc..961c240 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -5,13 +5,13 @@ run_command: MACRO ENDM const_def - const ScriptCommand_EndScriptLoop1_index ; $00 + const ScriptCommand_EndScript_index ; $00 const ScriptCommand_CloseAdvancedTextBox_index ; $01 - const ScriptCommand_PrintTextString_index ; $02 + const ScriptCommand_PrintNPCText_index ; $02 const Func_ccdc_index ; $03 const ScriptCommand_AskQuestionJump_index ; $04 - const ScriptCommand_StartBattle_index ; $05 - const ScriptCommand_PrintVariableText_index ; $06 + const ScriptCommand_StartDuel_index ; $05 + const ScriptCommand_PrintVariableNPCText_index ; $06 const Func_cda8_index ; $07 const ScriptCommand_PrintTextQuitFully_index ; $08 const Func_cdcb_index ; $09 @@ -88,11 +88,11 @@ ENDM const ScriptCommand_ShowSamNormalMultichoice_index ; $50 const ScriptCommand_ShowSamTutorialMultichoice_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_EndScript2_index ; $53 + const ScriptCommand_EndScript3_index ; $54 + const ScriptCommand_EndScript4_index ; $55 + const ScriptCommand_EndScript5_index ; $56 + const ScriptCommand_EndScript6_index ; $57 const ScriptCommand_SetFlagValue_index ; $58 const ScriptCommand_JumpIfFlagZero1_index ; $59 const ScriptCommand_JumpIfFlagNonzero1_index ; $5a @@ -105,16 +105,16 @@ ENDM 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 ScriptCommand_EndScript7_index ; $64 + const ScriptCommand_EndScript8_index ; $65 + const ScriptCommand_EndScript9_index ; $66 + const ScriptCommand_EndScript10_index ; $67 ; Script Macros ; Stops the current script and returns control flow back to assembly -end_script_loop: MACRO - run_command ScriptCommand_EndScriptLoop1 +end_script: MACRO + run_command ScriptCommand_EndScript ENDM ; Closes current dialog window @@ -122,9 +122,9 @@ 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 +; Opens a new dialog window and displays the given text and active npc name +print_npc_text: MACRO + run_command ScriptCommand_PrintNPCText tx \1 ; Text Pointer ENDM @@ -140,17 +140,17 @@ ENDC dw \2 ; Jump Location ENDM -; Begins a battle with the NPC currently being spoken to -start_battle: MACRO - run_command ScriptCommand_StartBattle +; Begins a duel with the NPC currently being spoken to +start_duel: MACRO + run_command ScriptCommand_StartDuel 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 +print_variable_npc_text: MACRO + run_command ScriptCommand_PrintVariableNPCText tx \1 ; Text Pointer tx \2 ; Text Pointer ENDM @@ -304,7 +304,7 @@ quit_script_fully: MACRO run_command ScriptCommand_QuitScriptFully ENDM -choose_deck_to_duel_against_multichoice: MACRO +choose_deck_to_duel_against: MACRO run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice ENDM @@ -314,7 +314,7 @@ open_deck_machine: MACRO db \1 ; Deck Machine Type? ENDM -choose_starter_deck_multichoice: MACRO +choose_starter_deck: MACRO run_command ScriptCommand_ChooseStarterDeckMultichoice ENDM @@ -329,7 +329,7 @@ enter_map: MACRO ENDM ; Moves any NPC using an NPCMovement -move_arbitrary_npc: MACRO +move_npc: MACRO run_command ScriptCommand_MoveArbitraryNPC db \1 ; NPC (ex NPC_JOSHUA) dw \2 ; NPCMovement (NPCMovement_e2ab) @@ -392,26 +392,6 @@ show_sam_tutorial_multichoice: MACRO run_command ScriptCommand_ShowSamTutorialMultichoice 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 - ; Sets a flag's value script_set_flag_value: MACRO run_command ScriptCommand_SetFlagValue @@ -497,20 +477,4 @@ increment_flag_value: MACRO db \1 ; flag (ex EVENT_FLAG_11) 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/src/wram.asm b/src/wram.asm index 238c36f..23dea8a 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -2310,9 +2310,9 @@ wd3b9:: ; d3b9 ds $2 wd3bb:: ; d3bb - ds $1 + ds $a - ds $14 + ds $b wd3d0:: ; d3d0 ds $1 diff --git a/tools/constants.py b/tools/constants.py index ee3069e..a891d96 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -332,7 +332,7 @@ events = [ "EVENT_FLAG_00", "EVENT_FLAG_01", "EVENT_TEMP_TALKED_TO_IMAKUNI", - "EVENT_TEMP_BATTLED_IMAKUNI", + "EVENT_TEMP_DUELED_IMAKUNI", "EVENT_FLAG_04", "EVENT_FLAG_05", "EVENT_FLAG_06", diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index bc1a945..9e0c924 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -22,112 +22,112 @@ texts = None # script command names and parameter lists script_commands = { - 0xe7: { "name": "start_script", "params": [] }, + 0xe7: { "name": "start_script", "params": [] }, - 0x00: { "name": "end_script_loop", "params": [] }, - 0x01: { "name": "close_advanced_text_box", "params": [] }, - 0x02: { "name": "print_text_string", "params": [ "text" ] }, - 0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text and ??? - 0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] }, - 0x05: { "name": "start_battle", "params": [ "prizes", "deck", "song" ] }, - 0x06: { "name": "print_variable_text", "params": [ "text", "text" ] }, - 0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text and ??? - 0x08: { "name": "print_text_quit_fully", "params": [ "text" ] }, - 0x09: { "name": "Func_cdcb", "params": [] }, - 0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] }, - 0x0b: { "name": "close_text_box", "params": [] }, - 0x0c: { "name": "give_booster_packs", "params": [ "booster", "booster", "booster" ] }, - 0x0d: { "name": "jump_if_card_owned", "params": [ "card", "label" ] }, - 0x0e: { "name": "jump_if_card_in_collection", "params": [ "card", "label" ] }, - 0x0f: { "name": "give_card", "params": [ "card" ] }, - 0x10: { "name": "take_card", "params": [ "card" ] }, - 0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection - 0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection - 0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] }, - 0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] }, - 0x15: { "name": "Func_cfc6", "params": [ "byte" ] }, - 0x16: { "name": "Func_cfd4", "params": [] }, - 0x17: { "name": "Func_d00b", "params": [] }, # get card name for EVENT_FLAG_2B - 0x18: { "name": "Func_d025", "params": [ "label" ] }, # jump if card in EVENT_FLAG_2B is in collection or decks - 0x19: { "name": "Func_d032", "params": [ "label" ] }, # jump if card in EVENT_FLAG_2B is in collection - 0x1a: { "name": "Func_d03f", "params": [] }, # remove card in EVENT_FLAG_2B from collection - 0x1b: { "name": "script_jump", "params": [ "label" ] }, - 0x1c: { "name": "try_give_medal_pc_packs", "params": [] }, - 0x1d: { "name": "set_player_direction", "params": [ "direction" ] }, - 0x1e: { "name": "move_player", "params": [ "direction", "byte_decimal" ] }, - 0x1f: { "name": "show_card_received_screen", "params": [ "card" ] }, - 0x20: { "name": "set_dialog_npc", "params": [ "npc" ] }, - 0x21: { "name": "set_next_npc_and_script", "params": [ "npc", "label" ] }, - 0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06 - 0x23: { "name": "Func_d0be", "params": [ "byte", "byte" ] }, # coords - 0x24: { "name": "do_frames", "params": [ "byte_decimal" ] }, - 0x25: { "name": "Func_d0d9", "params": [ "byte", "byte", "label" ] }, # coords, jump if npc coords match - 0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, - 0x27: { "name": "move_active_npc", "params": [ "movement" ] }, - 0x28: { "name": "give_one_of_each_trainer_booster", "params": [] }, - 0x29: { "name": "Func_d103", "params": [ "npc", "label" ] }, # jump if npc loaded - 0x2a: { "name": "Func_d125", "params": [ "event" ] }, # give medal - 0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot - 0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load current npc name into tx ram slot - 0x2d: { "name": "Func_cd4f", "params": [ "prizes", "deck", "song" ] }, - 0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, - 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, - 0x30: { "name": "Func_cdd8", "params": [] }, - 0x31: { "name": "Func_cdf5", "params": [ "byte", "byte" ] }, # coords - 0x32: { "name": "Func_d195", "params": [] }, # pick challenge hall opponent - 0x33: { "name": "Func_d1ad", "params": [] }, # open menu - 0x34: { "name": "Func_d1b3", "params": [] }, # pick trade card - 0x35: { "name": "quit_script_fully", "params": [] }, - 0x36: { "name": "Func_d244", "params": [ "byte" ] }, - 0x37: { "name": "choose_deck_to_duel_against_multichoice", "params": [] }, - 0x38: { "name": "open_deck_machine", "params": [ "byte" ] }, - 0x39: { "name": "choose_starter_deck_multichoice", "params": [] }, - 0x3a: { "name": "enter_map", "params": [ "byte", "map", "byte_decimal", "byte_decimal", "direction" ] }, - 0x3b: { "name": "move_arbitrary_npc", "params": [ "npc", "movement" ] }, - 0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card - 0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, - 0x3e: { "name": "Func_d396", "params": [ "byte" ] }, - 0x3f: { "name": "Func_cd76", "params": [] }, - 0x40: { "name": "Func_d39d", "params": [ "byte" ] }, - 0x41: { "name": "Func_d3b9", "params": [] }, - 0x42: { "name": "try_give_pc_pack", "params": [ "byte" ] }, - 0x43: { "name": "script_nop", "params": [] }, - 0x44: { "name": "Func_d3d4", "params": [] }, - 0x45: { "name": "Func_d3e0", "params": [] }, - 0x46: { "name": "Func_d3fe", "params": [ "song" ] }, - 0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song - 0x48: { "name": "play_song", "params": [ "song" ] }, - 0x49: { "name": "play_sfx", "params": [ "sfx" ] }, - 0x4a: { "name": "pause_song", "params": [] }, - 0x4b: { "name": "resume_song", "params": [] }, - 0x4c: { "name": "Func_d41d", "params": [] }, # play default song - 0x4d: { "name": "wait_for_song_to_finish", "params": [] }, - 0x4e: { "name": "Func_d435", "params": [ "byte" ] }, - 0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] }, - 0x50: { "name": "show_sam_normal_multichoice", "params": [] }, - 0x51: { "name": "show_sam_tutorial_multichoice", "params": [] }, - 0x52: { "name": "Func_d43d", "params": [] }, - 0x53: { "name": "end_script_loop_2", "params": [] }, - 0x54: { "name": "end_script_loop_3", "params": [] }, - 0x55: { "name": "end_script_loop_4", "params": [] }, - 0x56: { "name": "end_script_loop_5", "params": [] }, - 0x57: { "name": "end_script_loop_6", "params": [] }, - 0x58: { "name": "script_set_flag_value", "params": [ "event", "byte" ] }, - 0x59: { "name": "jump_if_flag_zero_1", "params": [ "event", "label" ] }, - 0x5a: { "name": "jump_if_flag_nonzero_1", "params": [ "event", "label" ] }, - 0x5b: { "name": "jump_if_flag_equal", "params": [ "event", "byte", "label" ] }, - 0x5c: { "name": "jump_if_flag_not_equal", "params": [ "event", "byte", "label" ] }, - 0x5d: { "name": "jump_if_flag_not_less_than", "params": [ "event", "byte", "label" ] }, - 0x5e: { "name": "jump_if_flag_less_than", "params": [ "event", "byte", "label" ] }, - 0x5f: { "name": "max_out_flag_value", "params": [ "event" ] }, - 0x60: { "name": "zero_out_flag_value", "params": [ "event" ] }, - 0x61: { "name": "jump_if_flag_nonzero_2", "params": [ "event", "label"] }, - 0x62: { "name": "jump_if_flag_zero_2", "params": [ "event", "label" ] }, - 0x63: { "name": "increment_flag_value", "params": [ "event" ] }, - 0x64: { "name": "end_script_loop_7", "params": [] }, - 0x65: { "name": "end_script_loop_8", "params": [] }, - 0x66: { "name": "end_script_loop_9", "params": [] }, - 0x67: { "name": "end_script_loop_10", "params": [] }, + 0x00: { "name": "end_script", "params": [] }, + 0x01: { "name": "close_advanced_text_box", "params": [] }, + 0x02: { "name": "print_npc_text", "params": [ "text" ] }, + 0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text without npc name + 0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] }, + 0x05: { "name": "start_duel", "params": [ "prizes", "deck", "song" ] }, + 0x06: { "name": "print_variable_npc_text", "params": [ "text", "text" ] }, + 0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text without npc name + 0x08: { "name": "print_text_quit_fully", "params": [ "text" ] }, + 0x09: { "name": "Func_cdcb", "params": [] }, # unload active npc + 0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] }, + 0x0b: { "name": "close_text_box", "params": [] }, + 0x0c: { "name": "give_booster_packs", "params": [ "booster", "booster", "booster" ] }, + 0x0d: { "name": "jump_if_card_owned", "params": [ "card", "label" ] }, + 0x0e: { "name": "jump_if_card_in_collection", "params": [ "card", "label" ] }, + 0x0f: { "name": "give_card", "params": [ "card" ] }, + 0x10: { "name": "take_card", "params": [ "card" ] }, + 0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection + 0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection + 0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] }, + 0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] }, + 0x15: { "name": "Func_cfc6", "params": [ "direction" ] }, # set active npc direction + 0x16: { "name": "Func_cfd4", "params": [] }, # pick next man1 requested card (EVENT_FLAG_2B) + 0x17: { "name": "Func_d00b", "params": [] }, # get man1 requested card name text (EVENT_FLAG_2B) + 0x18: { "name": "Func_d025", "params": [ "label" ] }, # jump if man1 requested card owned (EVENT_FLAG_2B) + 0x19: { "name": "Func_d032", "params": [ "label" ] }, # jump if man1 requested card in collection (EVENT_FLAG_2B) + 0x1a: { "name": "Func_d03f", "params": [] }, # remove man1 requested card from collection (EVENT_FLAG_2B) + 0x1b: { "name": "script_jump", "params": [ "label" ] }, + 0x1c: { "name": "try_give_medal_pc_packs", "params": [] }, + 0x1d: { "name": "set_player_direction", "params": [ "direction" ] }, + 0x1e: { "name": "move_player", "params": [ "direction", "byte_decimal" ] }, + 0x1f: { "name": "show_card_received_screen", "params": [ "card" ] }, + 0x20: { "name": "set_dialog_npc", "params": [ "npc" ] }, + 0x21: { "name": "set_next_npc_and_script", "params": [ "npc", "label" ] }, + 0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # set sprite attributes LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06 + 0x23: { "name": "Func_d0be", "params": [ "byte_decimal", "byte_decimal" ] }, # coords, set active npc coords + 0x24: { "name": "do_frames", "params": [ "byte_decimal" ] }, + 0x25: { "name": "Func_d0d9", "params": [ "byte_decimal", "byte_decimal", "label" ] }, # coords, jump if active npc coords match + 0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, + 0x27: { "name": "move_active_npc", "params": [ "movement" ] }, + 0x28: { "name": "give_one_of_each_trainer_booster", "params": [] }, + 0x29: { "name": "Func_d103", "params": [ "npc", "label" ] }, # jump if npc loaded + 0x2a: { "name": "Func_d125", "params": [ "event" ] }, # show medal received screen ? + 0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot + 0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load active npc name into tx ram slot + 0x2d: { "name": "Func_cd4f", "params": [ "prizes", "deck", "song" ] }, # start challenge hall duel + 0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, # print text based on challenge cup number + 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, + 0x30: { "name": "Func_cdd8", "params": [] }, # unload challenge hall npc + 0x31: { "name": "Func_cdf5", "params": [ "byte", "byte" ] }, # coords, set challenge hall npc coords + 0x32: { "name": "Func_d195", "params": [] }, # pick challenge hall opponent + 0x33: { "name": "Func_d1ad", "params": [] }, # open menu + 0x34: { "name": "Func_d1b3", "params": [] }, # pick challenge cup prize card + 0x35: { "name": "quit_script_fully", "params": [] }, + 0x36: { "name": "Func_d244", "params": [ "byte" ] }, # replace map blocks (dech machines, pokemon dome doors, hall of honor doors, challenge machine) + 0x37: { "name": "choose_deck_to_duel_against", "params": [] }, + 0x38: { "name": "open_deck_machine", "params": [ "byte" ] }, + 0x39: { "name": "choose_starter_deck", "params": [] }, + 0x3a: { "name": "enter_map", "params": [ "byte", "map", "byte_decimal", "byte_decimal", "direction" ] }, + 0x3b: { "name": "move_npc", "params": [ "npc", "movement" ] }, + 0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card + 0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, # flash screen (bool arg, true to stay white) + 0x3e: { "name": "Func_d396", "params": [ "byte" ] }, # save game (bool arg, true to go back to dr mason lab) + 0x3f: { "name": "Func_cd76", "params": [] }, # battle center + 0x40: { "name": "Func_d39d", "params": [ "byte" ] }, # gift center (bool arg, false for menu, true to executing selection) + 0x41: { "name": "Func_d3b9", "params": [] }, # play credits + 0x42: { "name": "try_give_pc_pack", "params": [ "byte" ] }, + 0x43: { "name": "script_nop", "params": [] }, + 0x44: { "name": "Func_d3d4", "params": [] }, # give starter deck + 0x45: { "name": "Func_d3e0", "params": [] }, # walk player to dr mason lab + 0x46: { "name": "Func_d3fe", "params": [ "song" ] }, # override song + 0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song + 0x48: { "name": "play_song", "params": [ "song" ] }, + 0x49: { "name": "play_sfx", "params": [ "sfx" ] }, + 0x4a: { "name": "pause_song", "params": [] }, + 0x4b: { "name": "resume_song", "params": [] }, + 0x4c: { "name": "Func_d41d", "params": [] }, # play default song + 0x4d: { "name": "wait_for_song_to_finish", "params": [] }, + 0x4e: { "name": "Func_d435", "params": [ "byte" ] }, # record master win (8 clubs plus ronald card master) + 0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] }, + 0x50: { "name": "show_sam_normal_multichoice", "params": [] }, + 0x51: { "name": "show_sam_tutorial_multichoice", "params": [] }, + 0x52: { "name": "Func_d43d", "params": [] }, # challenge machine + 0x53: { "name": "end_script_2", "params": [] }, + 0x54: { "name": "end_script_3", "params": [] }, + 0x55: { "name": "end_script_4", "params": [] }, + 0x56: { "name": "end_script_5", "params": [] }, + 0x57: { "name": "end_script_6", "params": [] }, + 0x58: { "name": "script_set_flag_value", "params": [ "event", "byte" ] }, + 0x59: { "name": "jump_if_flag_zero_1", "params": [ "event", "label" ] }, + 0x5a: { "name": "jump_if_flag_nonzero_1", "params": [ "event", "label" ] }, + 0x5b: { "name": "jump_if_flag_equal", "params": [ "event", "byte", "label" ] }, + 0x5c: { "name": "jump_if_flag_not_equal", "params": [ "event", "byte", "label" ] }, + 0x5d: { "name": "jump_if_flag_not_less_than", "params": [ "event", "byte", "label" ] }, + 0x5e: { "name": "jump_if_flag_less_than", "params": [ "event", "byte", "label" ] }, + 0x5f: { "name": "max_out_flag_value", "params": [ "event" ] }, + 0x60: { "name": "zero_out_flag_value", "params": [ "event" ] }, + 0x61: { "name": "jump_if_flag_nonzero_2", "params": [ "event", "label"] }, + 0x62: { "name": "jump_if_flag_zero_2", "params": [ "event", "label" ] }, + 0x63: { "name": "increment_flag_value", "params": [ "event" ] }, + 0x64: { "name": "end_script_7", "params": [] }, + 0x65: { "name": "end_script_8", "params": [] }, + 0x66: { "name": "end_script_9", "params": [] }, + 0x67: { "name": "end_script_10", "params": [] }, } quit_commands = [ -- cgit v1.2.3 From 342a35185976cc38ad7dfdcac3e411dcb07c9e71 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 10:53:05 -0600 Subject: Create macros for remaining script commands --- src/engine/bank03.asm | 303 ++++++++++++++++-------------------------- src/engine/bank04.asm | 78 +++++------ src/macros/scripts.asm | 324 +++++++++++++++++++++++++++++++++++++++------ tools/script_extractor2.py | 123 ++++++----------- 4 files changed, 476 insertions(+), 352 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 210d3ad..8d4a8ee 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1895,7 +1895,7 @@ ScriptCommand_PrintNPCText: ; ccd4 (3:4cd4) call Func_cc32 jp IncreaseScriptPointerBy3 -Func_ccdc: ; ccdc (3:4cdc) +ScriptCommand_PrintText: ; ccdc (3:4cdc) ld l, c ld h, b call Func_c891 @@ -1960,7 +1960,7 @@ asm_cd2f: set 6, [hl] jp IncreaseScriptPointerBy4 -Func_cd4f: ; cd4f (3:4d4f) +ScriptCommand_StartChallengeHallDuel: ; cd4f (3:4d4f) call Func_cd66 ld a, [wd696] farcall Func_118bf @@ -1984,7 +1984,7 @@ Func_cd66: ; cd66 (3:4d66) ld [wDuelTheme], a ret -Func_cd76: ; cd76 (3:4d76) +ScriptCommand_BattleCenter: ; cd76 (3:4d76) ld a, GAME_EVENT_BATTLE_CENTER ld [wGameEvent], a ld hl, wd0b4 @@ -2003,7 +2003,7 @@ ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83) call Func_cc32 jp IncreaseScriptPointerBy5 -Func_cd94: ; cd94 (3:4d94) +ScriptCommand_PrintTextForChallengeCup: ; cd94 (3:4d94) get_flag_value EVENT_FLAG_44 dec a and $3 @@ -2015,7 +2015,7 @@ Func_cd94: ; cd94 (3:4d94) call Func_cc32 jp IncreaseScriptPointerBy7 -Func_cda8: ; cda8 (3:4da8) +ScriptCommand_PrintVariableText: ; cda8 (3:4da8) ld a, [wScriptControlByte] or a jr nz, .asm_cdb1 @@ -2038,14 +2038,14 @@ ScriptCommand_PrintTextQuitFully: ; cdb9 (3:4db9) pop hl ret -Func_cdcb: ; cdcb (3:4dcb) +ScriptCommand_UnloadActiveNPC: ; cdcb (3:4dcb) ld a, [wScriptNPC] ld [wLoadedNPCTempIndex], a Func_cdd1: ; cdd1 (3:4dd1) farcall Func_1c50a jp IncreaseScriptPointerBy1 -Func_cdd8: ; cdd8 (3:4dd8) +ScriptCommand_UnloadChallengeHallNPC: ; cdd8 (3:4dd8) ld a, [wLoadedNPCTempIndex] push af ld a, [wTempNPC] @@ -2060,7 +2060,7 @@ Func_cdd8: ; cdd8 (3:4dd8) ld [wLoadedNPCTempIndex], a ret -Func_cdf5: ; cdf5 (3:4df5) +ScriptCommand_SetChallengeHallNPCCoords: ; cdf5 (3:4df5) ld a, [wLoadedNPCTempIndex] push af ld a, [wTempNPC] @@ -2292,7 +2292,7 @@ ScriptCommand_TakeCard: ; cf4c (3:4f4c) call RemoveCardFromCollection jp IncreaseScriptPointerBy2 -Func_cf53: ; cf53 (3:4f53) +ScriptCommand_JumpIfAnyEnergyCardsInCollection: ; cf53 (3:4f53) ld c, $1 ld b, $0 .asm_cf57 @@ -2320,7 +2320,7 @@ Func_cf6d: ; cf6d (3:4f6d) .asm_cf78 jp IncreaseScriptPointerBy3 -Func_cf7b: ; cf7b (3:4f7b) +ScriptCommand_RemoveAllEnergyCardsFromCollection: ; cf7b (3:4f7b) ld c, $1 .asm_cf7d push bc @@ -2373,14 +2373,14 @@ Func_cfc0: ; cfc0 (3:4fc0) call GetScriptArgs1AfterPointer jp SetScriptPointer -Func_cfc6: ; cfc6 (3:4fc6) +ScriptCommand_SetActiveNPCDirection: ; cfc6 (3:4fc6) ld a, [wScriptNPC] ld [wLoadedNPCTempIndex], a ld a, c farcall Func_1c52e jp IncreaseScriptPointerBy2 -Func_cfd4: ; cfd4 (3:4fd4) +ScriptCommand_PickNextMan1RequestedCard: ; cfd4 (3:4fd4) get_flag_value EVENT_FLAG_2D ld b, a .asm_cfd9 @@ -2421,7 +2421,7 @@ Data_d006: ; d006 (3:5006) db RAPIDASH db WEEZING -Func_d00b: ; d00b (3:500b) +ScriptCommand_GetMan1RequestedCardNameText: ; d00b (3:500b) sla c ld b, $0 ld hl, wTxRam2 @@ -2437,19 +2437,19 @@ Func_d00b: ; d00b (3:500b) ld [hl], d jp IncreaseScriptPointerBy2 -Func_d025: ; d025 (3:5025) +ScriptCommand_JumpIfMan1RequestedCardOwned: ; d025 (3:5025) get_flag_value EVENT_FLAG_2B call GetCardCountInCollectionAndDecks jp c, Func_cf67 jp Func_cf6d -Func_d032: ; d032 (3:5032) +ScriptCommand_JumpIfMan1RequestedCardInCollection: ; d032 (3:5032) get_flag_value EVENT_FLAG_2B call GetCardCountInCollection jp c, Func_cf67 jp Func_cf6d -Func_d03f: ; d03f (3:503f) +ScriptCommand_RemoveMan1RequestedCardFromCollection: ; d03f (3:503f) get_flag_value EVENT_FLAG_2B call RemoveCardFromCollection jp IncreaseScriptPointerBy1 @@ -2498,7 +2498,7 @@ ScriptCommand_SetNextNPCAndScript: ; d088 (3:5088) call SetNextNPCAndScript jp IncreaseScriptPointerBy4 -Func_d095: ; d095 (3:5095) +ScriptCommand_SetSpriteAttributes: ; d095 (3:5095) ld a, [wScriptNPC] ld [wLoadedNPCTempIndex], a push bc @@ -2522,7 +2522,7 @@ Func_d095: ; d095 (3:5095) farcall Func_1c57b jp IncreaseScriptPointerBy4 -Func_d0be: ; d0be (3:50be) +ScriptCommand_SetActiveNPCCoords: ; d0be (3:50be) ld a, [wScriptNPC] ld [wLoadedNPCTempIndex], a ld a, c @@ -2539,7 +2539,7 @@ ScriptCommand_DoFrames: ; d0ce (3:50ce) jr nz, ScriptCommand_DoFrames jp IncreaseScriptPointerBy2 -Func_d0d9: ; d0d9 (3:50d9) +ScriptCommand_JumpIfActiveNPCCoordsMatch: ; d0d9 (3:50d9) ld a, [wScriptNPC] ld [wLoadedNPCTempIndex], a ld d, c @@ -2562,7 +2562,7 @@ ScriptCommand_JumpIfPlayerCoordsMatch: ; d0f2 (3:50f2) jp nz, ScriptEventFailedNoJump jp ScriptEventPassedTryJump -Func_d103: ; d103 (3:5103) +ScriptCommand_JumpIfNPCLoaded: ; d103 (3:5103) ld a, [wLoadedNPCTempIndex] push af ld a, [wTempNPC] @@ -2584,7 +2584,7 @@ Func_d103: ; d103 (3:5103) ld [wLoadedNPCTempIndex], a ret -Func_d125: ; d125 (3:5125) +ScriptCommand_ShowMedalReceivedScreen: ; d125 (3:5125) ld a, c push af call Func_c2a3 @@ -2593,7 +2593,7 @@ Func_d125: ; d125 (3:5125) call Func_c2d4 jp IncreaseScriptPointerBy2 -Func_d135: ; d135 (3:5135) +ScriptCommand_LoadCurrentMapNameIntoTxRamSlot: ; d135 (3:5135) sla c ld b, $0 ld hl, wTxRam2 @@ -2628,7 +2628,7 @@ MapNames: ; d153 (3:5153) tx ChallengeHallMapNameText tx PokemonDomeMapNameText -Func_d16b: ; d16b (3:516b) +ScriptCommand_LoadActiveNPCNameIntoTxRamSlot: ; d16b (3:516b) ld hl, wCurrentNPCNameTx ld e, [hl] inc hl @@ -2653,7 +2653,7 @@ Func_d16b: ; d16b (3:516b) ld [hl], d jp IncreaseScriptPointerBy2 -Func_d195: ; d195 (3:5195) +ScriptCommand_PickChallengeHallOpponent: ; d195 (3:5195) ld a, [wTempNPC] push af get_flag_value EVENT_FLAG_45 @@ -2665,11 +2665,11 @@ Func_d195: ; d195 (3:5195) ld [wTempNPC], a jp IncreaseScriptPointerBy1 -Func_d1ad: ; d1ad (3:51ad) +ScriptCommand_OpenMenu: ; d1ad (3:51ad) call MainMenu_c75a jp IncreaseScriptPointerBy1 -Func_d1b3: ; d1b3 (3:51b3) +ScriptCommand_PickChallengeCupPrizeCard: ; d1b3 (3:51b3) get_flag_value EVENT_FLAG_44 dec a cp $2 @@ -2742,7 +2742,7 @@ ChallengeCupPrizeCards: ; d1dc (3:51dc) db FLYING_PIKACHU tx FlyingPikachuTradeCardName -Func_d209: ; d209 (3:5209) +ScriptCommand_PickLegendaryCard: ; d209 (3:5209) get_flag_value EVENT_FLAG_71 ld e, a .asm_d20e @@ -2791,7 +2791,7 @@ Flags_d240: ; d240 (3:5240) db EVENT_FLAG_6F db EVENT_FLAG_70 -Func_d244: ; d244 (3:5244) +ScriptCommand_ReplaceMapBlocks: ; d244 (3:5244) ld a, c farcall Func_80ba4 jp IncreaseScriptPointerBy2 @@ -3007,15 +3007,15 @@ ScriptCommand_EnterMap: ; d36d (3:536d) set 4, [hl] jp IncreaseScriptPointerBy6 -Func_d38f: ; d38f (3:538f) +ScriptCommand_FlashScreen: ; d38f (3:538f) farcall Func_10c96 jp IncreaseScriptPointerBy2 -Func_d396: ; d396 (3:5396) +ScriptCommand_SaveGame: ; d396 (3:5396) farcall Func_1157c jp IncreaseScriptPointerBy2 -Func_d39d: ; d39d (3:539d) +ScriptCommand_GiftCenter: ; d39d (3:539d) ld a, c or a jr nz, .asm_d3ac @@ -3033,7 +3033,7 @@ Func_d39d: ; d39d (3:539d) .asm_d3b6 jp IncreaseScriptPointerBy2 -Func_d3b9: ; d3b9 (3:53b9) +ScriptCommand_PlayCredits: ; d3b9 (3:53b9) call Func_3917 ld a, GAME_EVENT_CREDITS ld [wGameEvent], a @@ -3049,14 +3049,14 @@ ScriptCommand_TryGivePCPack: ; d3c9 (3:53c9) ScriptCommand_nop: ; d3d1 (3:53d1) jp IncreaseScriptPointerBy1 -Func_d3d4: ; d3d4 (3:53d4) +ScriptCommand_GiveStarterDeck: ; d3d4 (3:53d4) ld a, [wd693] bank1call Func_7576 jp IncreaseScriptPointerBy1 INCROM $d3dd, $d3e0 -Func_d3e0: ; d3e0 (3:53e0) +ScriptCommand_WalkPlayerToMasonLaboratory: ; d3e0 (3:53e0) ld a, $1 ld [wd32e], a farcall Func_11024 @@ -3069,13 +3069,13 @@ Func_d3e0: ; d3e0 (3:53e0) farcall Func_10f2e jp IncreaseScriptPointerBy1 -Func_d3fe: ; d3fe (3:53fe) +ScriptCommand_OverrideSong: ; d3fe (3:53fe) ld a, c ld [wd112], a call PlaySong jp IncreaseScriptPointerBy2 -Func_d408: ; d408 (3:5408) +ScriptCommand_SetDefaultSong: ; d408 (3:5408) ld a, c ld [wd111], a jp IncreaseScriptPointerBy2 @@ -3090,7 +3090,7 @@ ScriptCommand_PlaySFX: ; d416 (3:5416) call PlaySFX jp IncreaseScriptPointerBy2 -Func_d41d: ; d41d (3:541d) +ScriptCommand_PlayDefaultSong: ; d41d (3:541d) call Func_39fc jp IncreaseScriptPointerBy1 @@ -3106,12 +3106,12 @@ ScriptCommand_WaitForSongToFinish: ; d42f (3:542f) call WaitForSongToFinish jp IncreaseScriptPointerBy1 -Func_d435: ; d435 (3:5435) +ScriptCommand_RecordMasterWin: ; d435 (3:5435) ld a, c farcall Func_1c83d jp IncreaseScriptPointerBy2 -Func_d43d: ; d43d (3:543d) +ScriptCommand_ChallengeMachine: ; d43d (3:543d) ld a, GAME_EVENT_CHALLENGE_MACHINE ld [wGameEvent], a ld hl, wd0b4 @@ -3275,7 +3275,7 @@ Func_d4fb: ; d4fb (3:54fb) Script_BeginGame: ; d52e (3:552e) start_script do_frames 60 - run_command Func_d3e0 + walk_player_to_mason_lab do_frames 120 enter_map $02, MASON_LABORATORY, 14, 26, NORTH quit_script_fully @@ -3325,9 +3325,8 @@ ChallengeMachineObjectTable: ; d572 (3:5572) Script_ChallengeMachine: ; d57d (3:557d) start_script - run_command Func_ccdc - tx ItsTheChallengeMachineText - run_command Func_d43d + print_text ItsTheChallengeMachineText + challenge_machine quit_script_fully Script_Tech1: ; d583 (3:5583) @@ -3571,8 +3570,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) print_npc_text Text05e5 close_text_box move_active_npc NPCMovement_d882 - run_command Func_cfc6 - db $01 + set_active_npc_direction EAST set_player_direction WEST close_advanced_text_box set_next_npc_and_script NPC_DRMASON, .ows_d794 @@ -3677,8 +3675,7 @@ Script_AfterPracticeDuel: ; d834 (3:5834) set_player_direction NORTH print_npc_text Text05f0 close_text_box - run_command Func_ccdc - tx Text05f1 + print_text Text05f1 close_text_box print_npc_text Text05f2 .ows_d85f @@ -3691,16 +3688,14 @@ Script_AfterPracticeDuel: ; d834 (3:5834) close_text_box pause_song play_song MUSIC_BOOSTER_PACK - run_command Func_ccdc - tx Text05f5 + print_text Text05f5 wait_for_song_to_finish resume_song close_text_box script_set_flag_value EVENT_FLAG_3E, $03 - run_command Func_d3d4 + give_stater_deck print_npc_text Text05f6 - run_command Func_d396 - db $00 + save_game $00 quit_script_fully NPCMovement_d880: ; d880 (3:5880) @@ -3785,8 +3780,7 @@ Script_LostToAaron: ; d92e (3:592e) Script_d932: ; d932 (3:5932) start_script - run_command Func_ccdc - tx Text0605 + print_text Text0605 ask_question_jump_default_yes Text0606, .ows_d93c quit_script_fully @@ -3947,8 +3941,7 @@ Script_Ishihara: ; db4a (3:5b4a) script_set_flag_value EVENT_FLAG_1F, $03 zero_out_flag_value EVENT_FLAG_38 print_npc_text Text072f - run_command Func_ccdc - tx Text0730 + print_text Text0730 take_card CLEFABLE give_card SURFING_PIKACHU1 show_card_received_screen SURFING_PIKACHU1 @@ -3974,8 +3967,7 @@ Script_Ishihara: ; db4a (3:5b4a) script_set_flag_value EVENT_FLAG_1F, $05 zero_out_flag_value EVENT_FLAG_38 print_npc_text Text072f - run_command Func_ccdc - tx Text0736 + print_text Text0736 take_card DITTO give_card FLYING_PIKACHU show_card_received_screen FLYING_PIKACHU @@ -4001,8 +3993,7 @@ Script_Ishihara: ; db4a (3:5b4a) script_set_flag_value EVENT_FLAG_1F, $07 zero_out_flag_value EVENT_FLAG_38 print_npc_text Text072f - run_command Func_ccdc - tx Text073c + print_text Text073c take_card CHANSEY give_card SURFING_PIKACHU2 show_card_received_screen SURFING_PIKACHU2 @@ -4112,11 +4103,10 @@ Script_LostToImakuni: ; dd5c (3:5d5c) .ows_dd6e move_active_npc NPCMovement_dd78 - run_command Func_cdcb + unload_active_npc max_out_flag_value EVENT_TEMP_DUELED_IMAKUNI - run_command Func_d408 - db $09 - run_command Func_d41d + set_default_song MUSIC_OVERWORLD + play_default_song quit_script_fully NPCMovement_dd78: ; dd78 (3:5d78) @@ -4204,10 +4194,8 @@ Script_BeatMitch: ; ddff (3:5dff) print_npc_text 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 + show_medal_received_screen EVENT_FLAG_0F + record_master_win $01 print_npc_text Text0480 give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER print_npc_text Text0481 @@ -4422,8 +4410,7 @@ Script_Gal1: ; e0cf (3:60cf) .ows_e0fb script_set_flag_value EVENT_FLAG_12, $02 print_npc_text Gal1LetsTradeText - run_command Func_ccdc - tx Gal1TradeCompleteText + print_text Gal1TradeCompleteText take_card LAPRAS give_card ARCANINE1 show_card_received_screen ARCANINE1 @@ -4666,8 +4653,7 @@ Script_BeatJoshua: ; e26c (3:626c) close_text_box move_active_npc_by_direction NPCMovementTable_e2a1 print_npc_text Text044a - run_command Func_cfc6 - db $00 + set_active_npc_direction NORTH close_advanced_text_box set_next_npc_and_script NPC_AMY, Script_MeetAmy end_script @@ -4715,18 +4701,10 @@ Script_MeetAmy: ; e2d1 (3:62d1) set_dialog_npc NPC_AMY print_npc_text Text044d close_text_box - run_command Func_d095 - db $09 - db $2f - db $10 + set_sprite_attributes $09, $2f, $10 do_frames $20 - run_command Func_d095 - db $04 - db $0e - db $00 - run_command Func_d0be - db $14 - db $04 + set_sprite_attributes $04, $0e, $00 + set_active_npc_coords $14, $04 set_player_direction WEST move_player WEST, 1 set_player_direction NORTH @@ -4745,10 +4723,7 @@ Script_Amy: ; e304 (3:6304) .deny_duel print_npc_text Text0451 - run_command Func_d0d9 - db $14 - db $04 - dw Script_LostToAmy.ows_e34e + jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e quit_script_fully .start_duel @@ -4763,37 +4738,24 @@ Script_BeatAmy: ; e322 (3:6322) print_npc_text Text0454 max_out_flag_value EVENT_BEAT_AMY try_give_medal_pc_packs - run_command Func_d125 - db EVENT_BEAT_AMY - run_command Func_d435 - db $03 + show_medal_received_screen EVENT_BEAT_AMY + record_master_win $03 print_npc_text Text0455 .give_booster_packs give_booster_packs BOOSTER_LABORATORY_WATER, BOOSTER_LABORATORY_WATER, NO_BOOSTER print_npc_text Text0456 - run_command Func_d0d9 - db $14 - db $04 - dw Script_LostToAmy.ows_e34e + jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e quit_script_fully Script_LostToAmy: ; e344 (3:6344) start_script print_npc_text Text0457 - run_command Func_d0d9 - db $14 - db $04 - dw .ows_e34e + jump_if_active_npc_coords_match $14, $04, .ows_e34e quit_script_fully .ows_e34e - run_command Func_d095 - db $08 - db $2e - db $10 - run_command Func_d0be - db $16 - db $04 + set_sprite_attributes $08, $2e, $10 + set_active_npc_coords $16, $04 quit_script_fully Script_Amy_AlreadyHaveMedal: ; e356 (3:6356) @@ -5038,8 +5000,7 @@ Script_Lass2: ; e61f (3:661f) max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $02 print_npc_text Text06f1 - run_command Func_ccdc - tx Text06f2 + print_text Text06f2 take_card ODDISH give_card VILEPLUME show_card_received_screen VILEPLUME @@ -5064,8 +5025,7 @@ Script_Lass2: ; e61f (3:661f) max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $04 print_npc_text Text06f9 - run_command Func_ccdc - tx Text06fa + print_text Text06fa take_card CLEFAIRY give_card PIKACHU3 show_card_received_screen PIKACHU3 @@ -5090,8 +5050,7 @@ Script_Lass2: ; e61f (3:661f) max_out_flag_value EVENT_FLAG_04 script_set_flag_value EVENT_FLAG_37, $06 print_npc_text Text0700 - run_command Func_ccdc - tx Text0701 + print_text Text0701 take_card CHARIZARD give_card BLASTOISE show_card_received_screen BLASTOISE @@ -5230,8 +5189,7 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) start_script max_out_flag_value EVENT_FLAG_4B move_active_npc NPCMovement_e894 - run_command Func_d135 - db $00 + load_current_map_name_into_txram_slot $00 print_npc_text Text0645 close_text_box move_player NORTH, 1 @@ -5249,8 +5207,8 @@ Script_FirstRonaldEncounter: ; e862 (3:6862) set_player_direction WEST move_player EAST, 4 move_active_npc NPCMovement_e894 - run_command Func_cdcb - run_command Func_d41d + unload_active_npc + play_default_song quit_script_fully NPCMovement_e894: ; e894 (3:6894) @@ -5297,8 +5255,8 @@ Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) script_set_flag_value EVENT_FLAG_4C, $02 close_text_box move_active_npc NPCMovement_e90f - run_command Func_cdcb - run_command Func_d41d + unload_active_npc + play_default_song quit_script_fully NPCMovement_e905: ; e905 (3:6905) @@ -5359,8 +5317,8 @@ Script_LostToSecondRonaldFight: ; e955 (3:6955) script_set_flag_value EVENT_FLAG_4D, $02 close_text_box move_active_npc NPCMovement_e90f - run_command Func_cdcb - run_command Func_d41d + unload_active_npc + play_default_song quit_script_fully PsychicClubLobbyAfterDuel: ; e963 (3:6963) @@ -5661,8 +5619,7 @@ Script_ee76: ; ee76 (3:6e76) .ows_ee7d script_set_flag_value EVENT_FLAG_21, $02 - run_command Func_ccdc - tx FoundLv9SlowpokeText + print_text FoundLv9SlowpokeText give_card SLOWPOKE1 show_card_received_screen SLOWPOKE1 quit_script_fully @@ -5753,10 +5710,8 @@ Script_BeatKen: ; ef5e (3:6f5e) 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 + show_medal_received_screen EVENT_FLAG_0A + record_master_win $08 print_npc_text Text06c2 .give_booster_packs give_booster_packs BOOSTER_MYSTERY_NEUTRAL, BOOSTER_MYSTERY_NEUTRAL, NO_BOOSTER @@ -6191,8 +6146,7 @@ Script_f353: ; f353 (3:7353) move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - run_command Func_d16b - db $00 + load_active_npc_name_into_txram_slot $00 print_npc_text Text0532 close_text_box move_active_npc NPCMovement_f37f @@ -6203,10 +6157,7 @@ Script_f353: ; f353 (3:7353) close_text_box move_active_npc NPCMovement_f38e print_npc_text Text0535 - run_command Func_cd4f - db $04 - db $00 - db $00 + start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP quit_script_fully NPCMovement_f37d: ; f37d (3:737d) @@ -6254,10 +6205,8 @@ Script_LostAtChallengeHall: ; f392 (3:7392) move_active_npc NPCMovement_f390 jump_if_flag_equal EVENT_FLAG_45, $02, Script_f410 jump_if_flag_equal EVENT_FLAG_45, $03, Script_f410.ows_f41a - run_command Func_d16b - db $00 - run_command Func_d16b - db $01 + load_active_npc_name_into_txram_slot $00 + load_active_npc_name_into_txram_slot $01 print_npc_text Text0536 .ows_f3ae close_text_box @@ -6312,10 +6261,8 @@ NPCMovement_f40d: ; f40d (3:740d) db $ff Script_f410: ; f410 (4:7410) - run_command Func_d16b - db $00 - run_command Func_d16b - db $01 + load_active_npc_name_into_txram_slot $00 + load_active_npc_name_into_txram_slot $01 print_npc_text Text0538 script_jump Script_LostAtChallengeHall.ows_f3ae @@ -6349,21 +6296,17 @@ Script_WonAtChallengeHall: ; f441 (3:7441) jump_if_flag_equal EVENT_FLAG_45, $01, NULL print_variable_npc_text Text053c, Text053d move_active_npc NPCMovement_f37f - run_command Func_d16b - db $00 + load_active_npc_name_into_txram_slot $00 print_npc_text Text053e close_text_box move_wram_npc NPCMovement_f4c8 - run_command Func_cdd8 + unload_challenge_hall_npc print_npc_text Text053f close_text_box - run_command Func_d195 - run_command Func_cdf5 - db $14 - db $14 + pick_challenge_hall_opponent + set_challenge_hall_npc_coords $14, $14 move_wram_npc NPCMovement_f4d0 - run_command Func_d16b - db $00 + load_active_npc_name_into_txram_slot $00 jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_npc_text Text0540, Text0541 move_active_npc NPCMovement_f383 @@ -6383,16 +6326,13 @@ Script_WonAtChallengeHall: ; f441 (3:7441) ask_question_jump_default_yes Text0546, .ows_f4bd jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_npc_text Text0547, Text0548 - run_command Func_cd4f - db $04 - db $00 - db $00 + start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP quit_script_fully .ows_f4bd print_npc_text Text0549 close_text_box max_out_flag_value EVENT_FLAG_47 - run_command Func_d1ad + open_menu close_text_box script_jump .ows_f4a4 @@ -6425,8 +6365,7 @@ NPCMovement_f4d8: ; f4d8 (3:74d8) Script_f4db: ; f4db (3:74db) print_npc_text Text054a move_active_npc NPCMovement_f37f - run_command Func_d16b - db $00 + load_active_npc_name_into_txram_slot $00 print_npc_text Text054b close_text_box jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 @@ -6445,12 +6384,12 @@ Script_f4db: ; f4db (3:74db) .ows_f513 move_wram_npc NPCMovement_f4c8 .ows_f516 - run_command Func_cdd8 + unload_challenge_hall_npc move_active_npc NPCMovement_f383 print_npc_text Text0550 close_text_box move_active_npc NPCMovement_f38b - run_command Func_d1b3 + pick_challenge_cup_prize_card print_npc_text Text0551 give_card VARIABLE_CARD show_card_received_screen $00 @@ -6715,42 +6654,33 @@ Script_fbf1: ; fbf1 (3:7bf1) start_script 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 + print_text Text05b8 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 - run_command Func_ccdc - tx Text05b9 + flash_screen $00 + print_text Text05b9 .ows_fc0a - run_command Func_d38f - db $01 - run_command Func_d396 - db $01 - run_command Func_d3b9 + flash_screen $01 + save_game $01 + play_credits quit_script_fully .ows_fc10 jump_if_flag_equal EVENT_FLAG_71, $0f, .ows_fc20 - run_command Func_d209 - run_command Func_ccdc - tx Text05ba + pick_legendary_card + print_text Text05ba give_card VARIABLE_CARD show_card_received_screen VARIABLE_CARD script_jump .ows_fc05 .ows_fc20 - run_command Func_ccdc - tx Text05bb - run_command Func_d38f - db $00 - run_command Func_ccdc - tx Text05bc + print_text Text05bb + flash_screen $00 + print_text Text05bc script_jump .ows_fc0a Func_fc2b: ; fc2b (3:7c2b) @@ -6785,7 +6715,7 @@ Script_fc52: ; fc52 (3:7c52) print_text_quit_fully Text06c9 .ows_fc5e - run_command Func_cd76 + battle_center quit_script_fully Script_fc60: ; fc60 (3:7c60) @@ -6820,8 +6750,7 @@ Func_fc7a: ; fc7a (3:7c7a) start_script jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5 print_npc_text Text06cd - run_command Func_d39d - db $00 + gift_center $00 jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa print_npc_text Text06ce ask_question_jump_default_yes Text06cf, .ows_fca0 @@ -6829,13 +6758,10 @@ Func_fc7a: ; fc7a (3:7c7a) script_jump Func_fc7a.ows_fcaa .ows_fca0 - run_command Func_d396 - db $00 + save_game $00 play_sfx SFX_56 - run_command Func_ccdc - tx Text06d1 - run_command Func_d39d - db $01 + print_text Text06d1 + gift_center $01 quit_script_fully .ows_fcaa @@ -6848,8 +6774,7 @@ Func_fcad: ; fcad (3:7cad) start_script play_sfx SFX_56 - run_command Func_d396 - db $00 + save_game $00 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 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 143d37d..04e1e85 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1008,13 +1008,13 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_EndScript dw ScriptCommand_CloseAdvancedTextBox dw ScriptCommand_PrintNPCText - dw Func_ccdc + dw ScriptCommand_PrintText dw ScriptCommand_AskQuestionJump dw ScriptCommand_StartDuel dw ScriptCommand_PrintVariableNPCText - dw Func_cda8 + dw ScriptCommand_PrintVariableText dw ScriptCommand_PrintTextQuitFully - dw Func_cdcb + dw ScriptCommand_UnloadActiveNPC dw ScriptCommand_MoveActiveNPCByDirection dw ScriptCommand_CloseTextBox dw ScriptCommand_GiveBoosterPacks @@ -1022,16 +1022,16 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_JumpIfCardInCollection dw ScriptCommand_GiveCard dw ScriptCommand_TakeCard - dw Func_cf53 - dw Func_cf7b + dw ScriptCommand_JumpIfAnyEnergyCardsInCollection + dw ScriptCommand_RemoveAllEnergyCardsFromCollection dw ScriptCommand_JumpIfEnoughCardsOwned dw ScriptCommand_JumpBasedOnFightingClubPupilStatus - dw Func_cfc6 - dw Func_cfd4 - dw Func_d00b - dw Func_d025 - dw Func_d032 - dw Func_d03f + dw ScriptCommand_SetActiveNPCDirection + dw ScriptCommand_PickNextMan1RequestedCard + dw ScriptCommand_GetMan1RequestedCardNameText + dw ScriptCommand_JumpIfMan1RequestedCardOwned + dw ScriptCommand_JumpIfMan1RequestedCardInCollection + dw ScriptCommand_RemoveMan1RequestedCardFromCollection dw ScriptCommand_Jump dw ScriptCommand_TryGiveMedalPCPacks dw ScriptCommand_SetPlayerDirection @@ -1039,55 +1039,55 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_ShowCardReceivedScreen dw ScriptCommand_SetDialogNPC dw ScriptCommand_SetNextNPCAndScript - dw Func_d095 - dw Func_d0be + dw ScriptCommand_SetSpriteAttributes + dw ScriptCommand_SetActiveNPCCoords dw ScriptCommand_DoFrames - dw Func_d0d9 + dw ScriptCommand_JumpIfActiveNPCCoordsMatch dw ScriptCommand_JumpIfPlayerCoordsMatch dw ScriptCommand_MoveActiveNPC dw ScriptCommand_GiveOneOfEachTrainerBooster - dw Func_d103 - dw Func_d125 - dw Func_d135 - dw Func_d16b - dw Func_cd4f - dw Func_cd94 + dw ScriptCommand_JumpIfNPCLoaded + dw ScriptCommand_ShowMedalReceivedScreen + dw ScriptCommand_LoadCurrentMapNameIntoTxRamSlot + dw ScriptCommand_LoadActiveNPCNameIntoTxRamSlot + dw ScriptCommand_StartChallengeHallDuel + dw ScriptCommand_PrintTextForChallengeCup dw ScriptCommand_MoveWramNPC - dw Func_cdd8 - dw Func_cdf5 - dw Func_d195 - dw Func_d1ad - dw Func_d1b3 + dw ScriptCommand_UnloadChallengeHallNPC + dw ScriptCommand_SetChallengeHallNPCCoords + dw ScriptCommand_PickChallengeHallOpponent + dw ScriptCommand_OpenMenu + dw ScriptCommand_PickChallengeCupPrizeCard dw ScriptCommand_QuitScriptFully - dw Func_d244 + dw ScriptCommand_ReplaceMapBlocks dw ScriptCommand_ChooseDeckToDuelAgainstMultichoice dw ScriptCommand_OpenDeckMachine dw ScriptCommand_ChooseStarterDeckMultichoice dw ScriptCommand_EnterMap dw ScriptCommand_MoveArbitraryNPC - dw Func_d209 - dw Func_d38f - dw Func_d396 - dw Func_cd76 - dw Func_d39d - dw Func_d3b9 + dw ScriptCommand_PickLegendaryCard + dw ScriptCommand_FlashScreen + dw ScriptCommand_SaveGame + dw ScriptCommand_BattleCenter + dw ScriptCommand_GiftCenter + dw ScriptCommand_PlayCredits dw ScriptCommand_TryGivePCPack dw ScriptCommand_nop - dw Func_d3d4 - dw Func_d3e0 - dw Func_d3fe - dw Func_d408 + dw ScriptCommand_GiveStarterDeck + dw ScriptCommand_WalkPlayerToMasonLaboratory + dw ScriptCommand_OverrideSong + dw ScriptCommand_SetDefaultSong dw ScriptCommand_PlaySong dw ScriptCommand_PlaySFX dw ScriptCommand_PauseSong dw ScriptCommand_ResumeSong - dw Func_d41d + dw ScriptCommand_PlayDefaultSong dw ScriptCommand_WaitForSongToFinish - dw Func_d435 + dw ScriptCommand_RecordMasterWin dw ScriptCommand_AskQuestionJumpDefaultYes dw ScriptCommand_ShowSamNormalMultichoice dw ScriptCommand_ShowSamTutorialMultichoice - dw Func_d43d + dw ScriptCommand_ChallengeMachine dw ScriptCommand_EndScript dw ScriptCommand_EndScript dw ScriptCommand_EndScript diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 961c240..91ca3bb 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -8,13 +8,13 @@ ENDM const ScriptCommand_EndScript_index ; $00 const ScriptCommand_CloseAdvancedTextBox_index ; $01 const ScriptCommand_PrintNPCText_index ; $02 - const Func_ccdc_index ; $03 + const ScriptCommand_PrintText_index ; $03 const ScriptCommand_AskQuestionJump_index ; $04 const ScriptCommand_StartDuel_index ; $05 const ScriptCommand_PrintVariableNPCText_index ; $06 - const Func_cda8_index ; $07 + const ScriptCommand_PrintVariableText_index ; $07 const ScriptCommand_PrintTextQuitFully_index ; $08 - const Func_cdcb_index ; $09 + const ScriptCommand_UnloadActiveNPC_index ; $09 const ScriptCommand_MoveActiveNPCByDirection_index ; $0a const ScriptCommand_CloseTextBox_index ; $0b const ScriptCommand_GiveBoosterPacks_index ; $0c @@ -22,16 +22,16 @@ ENDM 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_JumpIfAnyEnergyCardsInCollection_index ; $11 + const ScriptCommand_RemoveAllEnergyCardsFromCollection_index ; $12 const ScriptCommand_JumpIfEnoughCardsOwned_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_SetActiveNPCDirection_index ; $15 + const ScriptCommand_PickNextMan1RequestedCard_index ; $16 + const ScriptCommand_GetMan1RequestedCardNameText_index ; $17 + const ScriptCommand_JumpIfMan1RequestedCardOwned_index ; $18 + const ScriptCommand_JumpIfMan1RequestedCardInCollection_index ; $19 + const ScriptCommand_RemoveMan1RequestedCardFromCollection_index ; $1a const ScriptCommand_Jump_index ; $1b const ScriptCommand_TryGiveMedalPCPacks_index ; $1c const ScriptCommand_SetPlayerDirection_index ; $1d @@ -39,55 +39,55 @@ ENDM const ScriptCommand_ShowCardReceivedScreen_index ; $1f const ScriptCommand_SetDialogNPC_index ; $20 const ScriptCommand_SetNextNPCAndScript_index ; $21 - const Func_d095_index ; $22 - const Func_d0be_index ; $23 + const ScriptCommand_SetSpriteAttributes_index ; $22 + const ScriptCommand_SetActiveNPCCoords_index ; $23 const ScriptCommand_DoFrames_index ; $24 - const Func_d0d9_index ; $25 + const ScriptCommand_JumpIfActiveNPCCoordsMatch_index ; $25 const ScriptCommand_JumpIfPlayerCoordsMatch_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_JumpIfNPCLoaded_index ; $29 + const ScriptCommand_ShowMedalReceivedScreen_index ; $2a + const ScriptCommand_LoadCurrentMapNameIntoTxRamSlot_index ; $2b + const ScriptCommand_LoadActiveNPCNameIntoTxRamSlot_index ; $2c + const ScriptCommand_StartChallengeHallDuel_index ; $2d + const ScriptCommand_PrintTextForChallengeCup_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_UnloadChallengeHallNPC_index ; $30 + const ScriptCommand_SetChallengeHallNPCCoords_index ; $31 + const ScriptCommand_PickChallengeHallOpponent_index ; $32 + const ScriptCommand_OpenMenu_index ; $33 + const ScriptCommand_PickChallengeCupPrizeCard_index ; $34 const ScriptCommand_QuitScriptFully_index ; $35 - const Func_d244_index ; $36 + const ScriptCommand_ReplaceMapBlocks_index ; $36 const ScriptCommand_ChooseDeckToDuelAgainstMultichoice_index ; $37 const ScriptCommand_OpenDeckMachine_index ; $38 const ScriptCommand_ChooseStarterDeckMultichoice_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_PickLegendaryCard_index ; $3c + const ScriptCommand_FlashScreen_index ; $3d + const ScriptCommand_SaveGame_index ; $3e + const ScriptCommand_BattleCenter_index ; $3f + const ScriptCommand_GiftCenter_index ; $40 + const ScriptCommand_PlayCredits_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 ScriptCommand_GiveStarterDeck_index ; $44 + const ScriptCommand_WalkPlayerToMasonLaboratory_index ; $45 + const ScriptCommand_OverrideSong_index ; $46 + const ScriptCommand_SetDefaultSong_index ; $47 const ScriptCommand_PlaySong_index ; $48 const ScriptCommand_PlaySFX_index ; $49 const ScriptCommand_PauseSong_index ; $4a const ScriptCommand_ResumeSong_index ; $4b - const Func_d41d_index ; $4c + const ScriptCommand_PlayDefaultSong_index ; $4c const ScriptCommand_WaitForSongToFinish_index ; $4d - const Func_d435_index ; $4e + const ScriptCommand_RecordMasterWin_index ; $4e const ScriptCommand_AskQuestionJumpDefaultYes_index ; $4f const ScriptCommand_ShowSamNormalMultichoice_index ; $50 const ScriptCommand_ShowSamTutorialMultichoice_index ; $51 - const Func_d43d_index ; $52 + const ScriptCommand_ChallengeMachine_index ; $52 const ScriptCommand_EndScript2_index ; $53 const ScriptCommand_EndScript3_index ; $54 const ScriptCommand_EndScript4_index ; $55 @@ -128,6 +128,12 @@ print_npc_text: MACRO tx \1 ; Text Pointer ENDM +; Opens a new dialog window and displays the given text +print_text: MACRO + run_command ScriptCommand_PrintText + 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 @@ -148,19 +154,31 @@ start_duel: MACRO 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 +; Prints the first or second npc text depending on if wScriptControlByte is nonzero or zero respectively print_variable_npc_text: MACRO run_command ScriptCommand_PrintVariableNPCText tx \1 ; Text Pointer tx \2 ; Text Pointer 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 ; 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 ; Text Pointer ENDM +; Removes the current NPC from the map +unload_active_npc: MACRO + run_command ScriptCommand_UnloadActiveNPC +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 @@ -208,6 +226,17 @@ take_card: MACRO db \1 ; card ID (ex LAPRAS) ENDM +; Jumps to a given script position if the player has any energy cards in their collection +jump_if_any_energy_cards_in_collection: MACRO + run_command ScriptCommand_JumpIfAnyEnergyCardsInCollection + dw \1 ; script label +ENDM + +; Removes all of the player's energy cards from their collection +remove_all_energy_cards_from_collection: MACRO + run_command ScriptCommand_RemoveAllEnergyCardsFromCollection +ENDM + ; Jumps to a given script position if the player owns enough cards jump_if_enough_cards_owned: MACRO run_command ScriptCommand_JumpIfEnoughCardsOwned @@ -225,6 +254,39 @@ fight_club_pupil_jump: MACRO dw \5 ; Script Label (All Pupils Defeated) ENDM +; Causes the active NPC to face the specified direction +set_active_npc_direction: MACRO + run_command ScriptCommand_SetActiveNPCDirection + db \1 ; Direction (ex NORTH) +ENDM + +; Picks the next card gift that will be requested by NPC_MAN1 +pick_next_man1_requested_card: MACRO + run_command ScriptCommand_PickNextMan1RequestedCard +ENDM + +; Loads the name text for the card gift requested by NPC_MAN1 +get_man1_requested_card_name_text: MACRO + run_command ScriptCommand_GetMan1RequestedCardNameText +ENDM + +; Jumps to the given script position if the player owns the card gift requested by NPC_MAN1 +jump_if_man1_requested_card_owned: MACRO + run_command ScriptCommand_JumpIfMan1RequestedCardOwned + dw \1 ; Script Label +ENDM + +; Jumps to the given script position if the player's collection contains the card gift requested by NPC_MAN1 +jump_if_man1_requested_card_in_collection: MACRO + run_command ScriptCommand_JumpIfMan1RequestedCardInCollection + dw \1 ; Script Label +ENDM + +; Removes from the player's collection the card gift requested by NPC_MAN1 +remove_man1_requested_card_from_collection: MACRO + run_command ScriptCommand_RemoveMan1RequestedCardFromCollection +ENDM + ; Jumps to a given script position script_jump: MACRO run_command ScriptCommand_Jump @@ -268,12 +330,35 @@ set_next_npc_and_script: MACRO dw \2 ; Script Label ENDM +; Sets some NPC sprite attributes +set_sprite_attributes: MACRO + run_command ScriptCommand_SetSpriteAttributes + db \1 ; Relates to LOADED_NPC_FIELD_05 + db \2 ; Relates to LOADED_NPC_FIELD_05 + db \3 ; Relates to LOADED_NPC_FIELD_06 +ENDM + +; Sets the active NPC's coords +set_active_npc_coords: MACRO + run_command ScriptCommand_SetActiveNPCCoords + db \1 ; X Coord + db \2 ; Y Coord +ENDM + ; Waits a number of frames do_frames: MACRO run_command ScriptCommand_DoFrames db \1 ; Number of frames to wait ENDM +; Jumps to a script position if the active NPC's X and Y match the given values +jump_if_active_npc_coords_match: MACRO + run_command ScriptCommand_JumpIfActiveNPCCoordsMatch + db \1 ; X Coord + db \2 ; Y Coord + dw \3 ; Script Label +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 @@ -293,17 +378,93 @@ give_one_of_each_trainer_booster: MACRO run_command ScriptCommand_GiveOneOfEachTrainerBooster ENDM +; Jumps to a script position if the NPC is loaded +jump_if_npc_loaded: MACRO + run_command ScriptCommand_JumpIfNPCLoaded + db \1 ; NPC (ex NPC_DRMASON) + dw \2 ; Script Label +ENDM + +; Shows the medal received screen for the given master medal +show_medal_received_screen: MACRO + run_command ScriptCommand_ShowMedalReceivedScreen + db \1 ; medal event +ENDM + +; Loads the current map name into the given txram slot +load_current_map_name_into_txram_slot: MACRO + run_command ScriptCommand_LoadCurrentMapNameIntoTxRamSlot + db \1 ; TxRam slot +ENDM + +; Loads the active NPC name into the given txram slot +load_active_npc_name_into_txram_slot: MACRO + run_command ScriptCommand_LoadActiveNPCNameIntoTxRamSlot + db \1 ; TxRam slot +ENDM + +; Begins a duel with the challenge hall opponent +; The deck and song arguments are overwritten when the duel is initialized +start_challenge_hall_duel: MACRO + run_command ScriptCommand_StartChallengeHallDuel + 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 text based on the current challenge cup number +print_text_for_challenge_cup: MACRO + run_command ScriptCommand_PrintTextForChallengeCup + tx \1 ; Text Pointer for Challenge Cup #1 + tx \2 ; Text Pointer for Challenge Cup #2 + tx \3 ; Text Pointer for Challenge Cup #3 +ENDM + ; Moves the NPC in wTempNPC using an NPCMovement move_wram_npc: MACRO run_command ScriptCommand_MoveWramNPC dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM +; Unloads the Challenge Hall opponent NPC +unload_challenge_hall_npc: MACRO + run_command ScriptCommand_UnloadChallengeHallNPC +ENDM + +; Sets the Challenge Hall opponent NPC's coords +set_challenge_hall_npc_coords: MACRO + run_command ScriptCommand_SetChallengeHallNPCCoords + db \1 ; X Coord + db \2 ; Y Coord +ENDM + +; Picks the next Challenge Hall opponent NPC +pick_challenge_hall_opponent: MACRO + run_command ScriptCommand_PickChallengeHallOpponent +ENDM + +; Opens the pause menu +open_menu: MACRO + run_command ScriptCommand_OpenMenu +ENDM + +; Picks the Challenge Cup prize card +pick_challenge_cup_prize_card: MACRO + run_command ScriptCommand_PickChallengeCupPrizeCard +ENDM + ; Closes Advanced TextBoxes then Ends Script Loop quit_script_fully: MACRO run_command ScriptCommand_QuitScriptFully ENDM +; Replaces map blocks +; used for deck machines, challenge machine, Pokemon Dome doors, Hall of Honor doors etc +replace_map_blocks: MACRO + run_command ScriptCommand_ReplaceMapBlocks + db \1 ; id +ENDM + choose_deck_to_duel_against: MACRO run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice ENDM @@ -335,6 +496,45 @@ move_npc: MACRO dw \2 ; NPCMovement (NPCMovement_e2ab) ENDM +; Picks the next legendary card +pick_legendary_card: MACRO + run_command ScriptCommand_PickLegendaryCard +ENDM + +; Flashes the screen to white +; if arg is non-zero, keep the screen white +; otherwise, fade the screen back in +flash_screen: MACRO + run_command ScriptCommand_FlashScreen + db \1 ; keep screen white? +ENDM + +; Saves the game +; if arg is non-zero, save the player in MASON_LABORATORY +; otherwise, save the player in their current location +save_game: MACRO + run_command ScriptCommand_SaveGame + db \1 ; send to MASON_LABORATORY? +ENDM + +; Loads the Battle Center +battle_center: MACRO + run_command ScriptCommand_BattleCenter +ENDM + +; Loads the Gift Center +; if arg is zero, display the options selection menu +; otherwise, execute the player's previously chosen selection +gift_center: MACRO + run_command ScriptCommand_GiftCenter + db \1 ; execute selection? +ENDM + +; Plays the credits +play_credits: MACRO + run_command ScriptCommand_PlayCredits +ENDM + ; Tries to give the player a specific PC Pack from Dr. Mason try_give_pc_pack: MACRO run_command ScriptCommand_TryGivePCPack @@ -346,6 +546,28 @@ script_nop: MACRO run_command ScriptCommand_nop ENDM +; Gives the player their previously chosen starter deck +give_stater_deck: MACRO + run_command ScriptCommand_GiveStarterDeck +ENDM + +; Walks the player across the overworld map to MASON_LABORATORY +walk_player_to_mason_lab: MACRO + run_command ScriptCommand_WalkPlayerToMasonLaboratory +ENDM + +; Plays a song and saves it to wd112 +override_song: MACRO + run_command ScriptCommand_OverrideSong + db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) +ENDM + +; Sets the default song for the overworld +set_default_song: MACRO + run_command ScriptCommand_SetDefaultSong + db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) +ENDM + ; Plays a song play_song: MACRO run_command ScriptCommand_PlaySong @@ -368,11 +590,24 @@ resume_song: MACRO run_command ScriptCommand_ResumeSong ENDM +; Plays the default overworld song +play_default_song: MACRO + run_command ScriptCommand_PlayDefaultSong +ENDM + ; Waits for the current song to finish wait_for_song_to_finish: MACRO run_command ScriptCommand_WaitForSongToFinish ENDM +; Records when the player defeats a master (the 8 Club Masters or the Ronald Grand Master duel) +; the order of wins is stored in wd3bb +; the purpose of this is still unknown +record_master_win: MACRO + run_command ScriptCommand_RecordMasterWin + db \1 ; which master duel +ENDM + ; Asks the player a question then jumps ask_question_jump_default_yes: MACRO run_command ScriptCommand_AskQuestionJumpDefaultYes @@ -392,6 +627,11 @@ show_sam_tutorial_multichoice: MACRO run_command ScriptCommand_ShowSamTutorialMultichoice ENDM +; Runs the Challenge Machine +challenge_machine: MACRO + run_command ScriptCommand_ChallengeMachine +ENDM + ; Sets a flag's value script_set_flag_value: MACRO run_command ScriptCommand_SetFlagValue @@ -429,7 +669,7 @@ jump_if_flag_not_equal: MACRO dw \3 ; Script Label ENDM -; Jump to a script position if a flag is not less than a given value +; Jumps 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 ; flag (ex EVENT_FLAG_11) @@ -437,7 +677,7 @@ jump_if_flag_not_less_than: MACRO dw \3 ; Script Label ENDM -; Jump to a script position if a flag is less than a given value +; Jumps 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 ; flag (ex EVENT_FLAG_11) diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 9e0c924..1b7aaf7 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -27,13 +27,13 @@ script_commands = { 0x00: { "name": "end_script", "params": [] }, 0x01: { "name": "close_advanced_text_box", "params": [] }, 0x02: { "name": "print_npc_text", "params": [ "text" ] }, - 0x03: { "name": "Func_ccdc", "params": [ "text" ] }, # print text without npc name + 0x03: { "name": "print_text", "params": [ "text" ] }, 0x04: { "name": "ask_question_jump", "params": [ "text", "label" ] }, 0x05: { "name": "start_duel", "params": [ "prizes", "deck", "song" ] }, 0x06: { "name": "print_variable_npc_text", "params": [ "text", "text" ] }, - 0x07: { "name": "Func_cda8", "params": [ "text", "text" ] }, # print variable text without npc name + 0x07: { "name": "print_variable_text", "params": [ "text", "text" ] }, 0x08: { "name": "print_text_quit_fully", "params": [ "text" ] }, - 0x09: { "name": "Func_cdcb", "params": [] }, # unload active npc + 0x09: { "name": "unload_active_npc", "params": [] }, 0x0a: { "name": "move_active_npc_by_direction", "params": [ "movement_table" ] }, 0x0b: { "name": "close_text_box", "params": [] }, 0x0c: { "name": "give_booster_packs", "params": [ "booster", "booster", "booster" ] }, @@ -41,16 +41,16 @@ script_commands = { 0x0e: { "name": "jump_if_card_in_collection", "params": [ "card", "label" ] }, 0x0f: { "name": "give_card", "params": [ "card" ] }, 0x10: { "name": "take_card", "params": [ "card" ] }, - 0x11: { "name": "Func_cf53", "params": [ "label" ] }, # jump if any energy cards in collection - 0x12: { "name": "Func_cf7b", "params": [] }, # remove all energy cards from collection + 0x11: { "name": "jump_if_any_energy_cards_in_collection", "params": [ "label" ] }, + 0x12: { "name": "remove_all_energy_cards_from_collection", "params": [] }, 0x13: { "name": "jump_if_enough_cards_owned", "params": [ "word_decimal", "label" ] }, 0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] }, - 0x15: { "name": "Func_cfc6", "params": [ "direction" ] }, # set active npc direction - 0x16: { "name": "Func_cfd4", "params": [] }, # pick next man1 requested card (EVENT_FLAG_2B) - 0x17: { "name": "Func_d00b", "params": [] }, # get man1 requested card name text (EVENT_FLAG_2B) - 0x18: { "name": "Func_d025", "params": [ "label" ] }, # jump if man1 requested card owned (EVENT_FLAG_2B) - 0x19: { "name": "Func_d032", "params": [ "label" ] }, # jump if man1 requested card in collection (EVENT_FLAG_2B) - 0x1a: { "name": "Func_d03f", "params": [] }, # remove man1 requested card from collection (EVENT_FLAG_2B) + 0x15: { "name": "set_active_npc_direction", "params": [ "direction" ] }, + 0x16: { "name": "pick_next_man1_requested_card", "params": [] }, + 0x17: { "name": "get_man1_requested_card_name_text", "params": [] }, + 0x18: { "name": "jump_if_man1_requested_card_owned", "params": [ "label" ] }, + 0x19: { "name": "jump_if_man1_requested_card_in_collection", "params": [ "label" ] }, + 0x1a: { "name": "remove_man1_requested_card_from_collection", "params": [] }, 0x1b: { "name": "script_jump", "params": [ "label" ] }, 0x1c: { "name": "try_give_medal_pc_packs", "params": [] }, 0x1d: { "name": "set_player_direction", "params": [ "direction" ] }, @@ -58,55 +58,55 @@ script_commands = { 0x1f: { "name": "show_card_received_screen", "params": [ "card" ] }, 0x20: { "name": "set_dialog_npc", "params": [ "npc" ] }, 0x21: { "name": "set_next_npc_and_script", "params": [ "npc", "label" ] }, - 0x22: { "name": "Func_d095", "params": [ "byte", "byte", "byte" ] }, # set sprite attributes LOADED_NPC_FIELD_05 and LOADED_NPC_FIELD_06 - 0x23: { "name": "Func_d0be", "params": [ "byte_decimal", "byte_decimal" ] }, # coords, set active npc coords + 0x22: { "name": "set_sprite_attributes", "params": [ "byte", "byte", "byte" ] }, + 0x23: { "name": "set_active_npc_coords", "params": [ "byte_decimal", "byte_decimal" ] }, 0x24: { "name": "do_frames", "params": [ "byte_decimal" ] }, - 0x25: { "name": "Func_d0d9", "params": [ "byte_decimal", "byte_decimal", "label" ] }, # coords, jump if active npc coords match + 0x25: { "name": "jump_if_active_npc_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, 0x26: { "name": "jump_if_player_coords_match", "params": [ "byte_decimal", "byte_decimal", "label" ] }, 0x27: { "name": "move_active_npc", "params": [ "movement" ] }, 0x28: { "name": "give_one_of_each_trainer_booster", "params": [] }, - 0x29: { "name": "Func_d103", "params": [ "npc", "label" ] }, # jump if npc loaded - 0x2a: { "name": "Func_d125", "params": [ "event" ] }, # show medal received screen ? - 0x2b: { "name": "Func_d135", "params": [ "byte" ] }, # load current map name into tx ram slot - 0x2c: { "name": "Func_d16b", "params": [ "byte" ] }, # load active npc name into tx ram slot - 0x2d: { "name": "Func_cd4f", "params": [ "prizes", "deck", "song" ] }, # start challenge hall duel - 0x2e: { "name": "Func_cd94", "params": [ "text", "text", "text" ] }, # print text based on challenge cup number + 0x29: { "name": "jump_if_npc_loaded", "params": [ "npc", "label" ] }, + 0x2a: { "name": "show_medal_received_screen", "params": [ "event" ] }, + 0x2b: { "name": "load_current_map_name_into_txram_slot", "params": [ "byte" ] }, + 0x2c: { "name": "load_active_npc_name_into_txram_slot", "params": [ "byte" ] }, + 0x2d: { "name": "start_challenge_hall_duel", "params": [ "prizes", "deck", "song" ] }, + 0x2e: { "name": "print_text_for_challenge_cup", "params": [ "text", "text", "text" ] }, 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, - 0x30: { "name": "Func_cdd8", "params": [] }, # unload challenge hall npc - 0x31: { "name": "Func_cdf5", "params": [ "byte", "byte" ] }, # coords, set challenge hall npc coords - 0x32: { "name": "Func_d195", "params": [] }, # pick challenge hall opponent - 0x33: { "name": "Func_d1ad", "params": [] }, # open menu - 0x34: { "name": "Func_d1b3", "params": [] }, # pick challenge cup prize card + 0x30: { "name": "unload_challenge_hall_npc", "params": [] }, + 0x31: { "name": "set_challenge_hall_npc_coords", "params": [ "byte_decimal", "byte_decimal" ] }, + 0x32: { "name": "pick_challenge_hall_opponent", "params": [] }, + 0x33: { "name": "open_menu", "params": [] }, + 0x34: { "name": "pick_challenge_cup_prize_card", "params": [] }, 0x35: { "name": "quit_script_fully", "params": [] }, - 0x36: { "name": "Func_d244", "params": [ "byte" ] }, # replace map blocks (dech machines, pokemon dome doors, hall of honor doors, challenge machine) + 0x36: { "name": "replace_map_blocks", "params": [ "byte" ] }, 0x37: { "name": "choose_deck_to_duel_against", "params": [] }, 0x38: { "name": "open_deck_machine", "params": [ "byte" ] }, 0x39: { "name": "choose_starter_deck", "params": [] }, 0x3a: { "name": "enter_map", "params": [ "byte", "map", "byte_decimal", "byte_decimal", "direction" ] }, 0x3b: { "name": "move_npc", "params": [ "npc", "movement" ] }, - 0x3c: { "name": "Func_d209", "params": [] }, # pick legendary card - 0x3d: { "name": "Func_d38f", "params": [ "byte" ] }, # flash screen (bool arg, true to stay white) - 0x3e: { "name": "Func_d396", "params": [ "byte" ] }, # save game (bool arg, true to go back to dr mason lab) - 0x3f: { "name": "Func_cd76", "params": [] }, # battle center - 0x40: { "name": "Func_d39d", "params": [ "byte" ] }, # gift center (bool arg, false for menu, true to executing selection) - 0x41: { "name": "Func_d3b9", "params": [] }, # play credits + 0x3c: { "name": "pick_legendary_card", "params": [] }, + 0x3d: { "name": "flash_screen", "params": [ "byte" ] }, + 0x3e: { "name": "save_game", "params": [ "byte" ] }, + 0x3f: { "name": "battle_center", "params": [] }, + 0x40: { "name": "gift_center", "params": [ "byte" ] }, + 0x41: { "name": "play_credits", "params": [] }, 0x42: { "name": "try_give_pc_pack", "params": [ "byte" ] }, 0x43: { "name": "script_nop", "params": [] }, - 0x44: { "name": "Func_d3d4", "params": [] }, # give starter deck - 0x45: { "name": "Func_d3e0", "params": [] }, # walk player to dr mason lab - 0x46: { "name": "Func_d3fe", "params": [ "song" ] }, # override song - 0x47: { "name": "Func_d408", "params": [ "song" ] }, # set default song + 0x44: { "name": "give_stater_deck", "params": [] }, + 0x45: { "name": "walk_player_to_mason_lab", "params": [] }, + 0x46: { "name": "override_song", "params": [ "song" ] }, + 0x47: { "name": "set_default_song", "params": [ "song" ] }, 0x48: { "name": "play_song", "params": [ "song" ] }, 0x49: { "name": "play_sfx", "params": [ "sfx" ] }, 0x4a: { "name": "pause_song", "params": [] }, 0x4b: { "name": "resume_song", "params": [] }, - 0x4c: { "name": "Func_d41d", "params": [] }, # play default song + 0x4c: { "name": "play_default_song", "params": [] }, 0x4d: { "name": "wait_for_song_to_finish", "params": [] }, - 0x4e: { "name": "Func_d435", "params": [ "byte" ] }, # record master win (8 clubs plus ronald card master) + 0x4e: { "name": "record_master_win", "params": [ "byte" ] }, 0x4f: { "name": "ask_question_jump_default_yes", "params": [ "text", "label" ] }, 0x50: { "name": "show_sam_normal_multichoice", "params": [] }, 0x51: { "name": "show_sam_tutorial_multichoice", "params": [] }, - 0x52: { "name": "Func_d43d", "params": [] }, # challenge machine + 0x52: { "name": "challenge_machine", "params": [] }, 0x53: { "name": "end_script_2", "params": [] }, 0x54: { "name": "end_script_3", "params": [] }, 0x55: { "name": "end_script_4", "params": [] }, @@ -253,75 +253,43 @@ def dump_script(start_address, address=None, visited=set()): command_id = rom[command_address] command = script_commands[command_id] address += 1 - macro_mode = not command["name"].startswith("Func_") - if macro_mode: - output = "\t{}".format(command["name"]) - else: - output = "\trun_command {}".format(command["name"]) + output = "\t{}".format(command["name"]) # print all params for current command for i in range(len(command["params"])): param = rom[address] param_type = command["params"][i] param_length = param_lengths[param_type] if param_type == "byte": - if not macro_mode: - output += "\n\tdb" output += " ${:02x}".format(param) elif param_type == "byte_decimal": - if not macro_mode: - output += "\n\tdb" output += " {}".format(param) elif param_type == "booster": - if not macro_mode: - output += "\n\tdb" output += " {}".format(boosters[param]) elif param_type == "card": - if not macro_mode: - output += "\n\tdb" output += " {}".format(cards[param]) elif param_type == "deck": - if not macro_mode: - output += "\n\tdb" output += " {}".format(decks[param]) elif param_type == "direction": - if not macro_mode: - output += "\n\tdb" output += " {}".format(directions[param]) elif param_type == "event": - if not macro_mode: - output += "\n\tdb" output += " {}".format(events[param]) elif param_type == "map": - if not macro_mode: - output += "\n\tdb" output += " {}".format(maps[param]) elif param_type == "npc": - if not macro_mode: - output += "\n\tdb" output += " {}".format(npcs[param]) elif param_type == "prizes": - if not macro_mode: - output += "\n\tdb" output += " PRIZES_{}".format(param) elif param_type == "sfx": - if not macro_mode: - output += "\n\tdb" output += " {}".format(sfxs[param]) elif param_type == "song": - if not macro_mode: - output += "\n\tdb" output += " {}".format(songs[param]) elif param_type == "word_decimal": - if not macro_mode: - output += "\n\tdw" output += " {}".format(param + rom[address + 1] * 0x100) elif param_type == "movement": param = get_pointer(address) label = "NPCMovement_{:x}".format(param) if param in symbols: label = symbols[param] - if not macro_mode: - output += "\n\tdw" output += " {}".format(label) blobs += dump_movement(param) elif param_type == "movement_table": @@ -329,17 +297,10 @@ def dump_script(start_address, address=None, visited=set()): label = "NPCMovementTable_{:x}".format(param) if param in symbols: label = symbols[param] - if not macro_mode: - output += "\n\tdw" output += " {}".format(label) blobs += dump_movement_table(param) elif param_type == "text": text_id = param + rom[address + 1] * 0x100 - if not macro_mode: - if text_id == 0x0000: - output += "\n\tdw" - else: - output += "\n\ttx" if text_id == 0x0000: output += " NULL" else: @@ -358,11 +319,9 @@ def dump_script(start_address, address=None, visited=set()): label = symbols[param] if param > start_address or args.allow_backward_jumps: branches.add(param) - if not macro_mode: - output += "\n\tdw" output += " {}".format(label) address += param_length - if macro_mode and i < len(command["params"]) - 1: + if i < len(command["params"]) - 1: output += "," output += "\n" blobs.append(make_blob(command_address, output, address)) -- cgit v1.2.3 From 5af59b450677468d315e130678562ce922ba1a95 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 13:47:20 -0600 Subject: Dump all overworld scripts --- src/engine/bank03.asm | 2539 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 2322 insertions(+), 217 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 8d4a8ee..489468f 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3512,21 +3512,27 @@ Script_LostToSam: ; d69f (3:569f) jump_if_flag_equal EVENT_FLAG_75, $06, .ows_d6fd print_npc_text Text05d6 script_jump .ows_d6b3 + .ows_d6df print_npc_text Text05d7 script_jump .ows_d6b3 + .ows_d6e5 print_npc_text Text05d8 script_jump .ows_d6b3 + .ows_d6eb print_npc_text Text05d9 script_jump .ows_d6b3 + .ows_d6f1 print_npc_text Text05da script_jump .ows_d6b3 + .ows_d6f7 print_npc_text Text05db script_jump .ows_d6b3 + .ows_d6fd print_npc_text Text05dc script_jump .ows_d6b3 @@ -3543,7 +3549,30 @@ Preload_DrMason: ; d710 (3:5710) INCROM $d710, $d727 Script_DrMason: ; d727 (3:5727) - INCROM $d727, $d753 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_4B, .ows_d72f + print_text_quit_fully Text05dd + +.ows_d72f + try_give_medal_pc_packs + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $02, .ows_d738 + print_text_quit_fully Text05de + +.ows_d738 + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $07, .ows_d740 + print_text_quit_fully Text05df + +.ows_d740 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_d747 + print_text_quit_fully Text05e0 + +.ows_d747 + jump_if_flag_nonzero_2 EVENT_FLAG_3D, .ows_d750 + max_out_flag_value EVENT_FLAG_3D + print_text_quit_fully Text05e1 + +.ows_d750 + print_text_quit_fully Text05e2 Script_EnterLabFirstTime: ; d753 (3:5753) start_script @@ -3592,9 +3621,8 @@ Script_EnterLabFirstTime: ; d753 (3:5753) set_player_direction WEST move_active_npc NPCMovement_d894 print_npc_text Text05e7 - set_dialog_npc $07 + set_dialog_npc NPC_SAM print_npc_text Text05e8 - .ows_d7bc close_text_box show_sam_tutorial_multichoice @@ -3639,7 +3667,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) script_jump .ows_d7bc .ows_d817 - set_dialog_npc $01 + set_dialog_npc NPC_DRMASON print_npc_text Text05ea script_nop script_set_flag_value EVENT_FLAG_3E, $01 @@ -3655,7 +3683,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) .ows_d82d close_advanced_text_box - set_next_npc_and_script $01, Script_AfterPracticeDuel + set_next_npc_and_script NPC_DRMASON, Script_AfterPracticeDuel end_script ret @@ -3683,6 +3711,7 @@ Script_AfterPracticeDuel: ; d834 (3:5834) close_text_box ask_question_jump Text05f3, .ows_d869 script_jump .ows_d85f + .ows_d869 print_npc_text Text05f4 close_text_box @@ -3725,7 +3754,7 @@ NPCMovement_d88b: ; d88b (3:588b) db EAST | NO_MOVE db $ff -NPCMovement_d894: ; d894 (4:5894) +NPCMovement_d894: ; d894 (3:5894) db SOUTH | NO_MOVE db $ff @@ -3756,27 +3785,67 @@ DeckMachineRoomCloseTextBox: ; d8ad (3:58ad) INCROM $d8ad, $d8bb Script_Tech6: ; d8bb (3:58bb) - INCROM $d8bb, $d8c6 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text05f7, Text05f8 + quit_script_fully Script_Tech7: ; d8c6 (3:58c6) - INCROM $d8c6, $d8d1 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text05f9, Text05fa + quit_script_fully Script_Tech8: ; d8d1 (3:58d1) - INCROM $d8d1, $d8dd + start_script + jump_if_flag_not_equal EVENT_FLAG_62, $ff, NULL + print_variable_npc_text Text05fb, Text05fc + quit_script_fully Script_Aaron: ; d8dd (3:58dd) - INCROM $d8dd, $d903 + start_script + print_npc_text Text05fd + ask_question_jump Text05fe, .ows_d8e9 +.ows_d8e6 + print_text_quit_fully Text05ff + +.ows_d8e9 + print_npc_text Text0600 + choose_deck_to_duel_against + close_text_box + jump_if_flag_equal EVENT_FLAG_76, $03, .ows_d8e6 + ask_question_jump Text0601, .ows_d8fb + script_jump .ows_d8e6 + +.ows_d8fb + print_npc_text Text0602 + start_duel PRIZES_4, $ff, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatAaron: ; d903 (3:5903) ld a, [wMultichoiceTextboxResult_ChooseDeckToDuelAgainst] ld c, a set_flag_value EVENT_FLAG_73 -; 0xd90b - INCROM $d90b, $d92e + start_script + print_npc_text Text0603 + jump_if_flag_equal EVENT_FLAG_73, $01, .ows_d920 + jump_if_flag_equal EVENT_FLAG_73, $02, .ows_d927 + give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER + script_jump Script_LostToAaron.ows_d92f + +.ows_d920 + give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER + script_jump Script_LostToAaron.ows_d92f + +.ows_d927 + give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER + script_jump Script_LostToAaron.ows_d92f Script_LostToAaron: ; d92e (3:592e) - INCROM $d92e, $d932 + start_script +.ows_d92f + print_text_quit_fully Text0604 Script_d932: ; d932 (3:5932) start_script @@ -3791,9 +3860,30 @@ Script_d932: ; d932 (3:5932) Script_d93f: ; d93f (3:593f) ld a, $02 call Func_d96c -; 0xd944 - INCROM $d944, $d96c + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5A, .ows_d963 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_0F, .ows_d954 + quit_script_fully + +.ows_d954 + ask_question_jump_default_yes Text0609, .ows_d95a + quit_script_fully + +.ows_d95a + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5A + replace_map_blocks $02 + print_text Text060a +.ows_d963 + ask_question_jump_default_yes Text060b, .ows_d969 + quit_script_fully + +.ows_d969 + open_deck_machine $01 + quit_script_fully Func_d96c: ; d96c (3:596c) sub $02 @@ -3823,54 +3913,208 @@ ClubMapNames: ; d985 (3:5985) Script_d995: ; d995 (3:5995) ld a, $03 call Func_d96c -; 0xd99a - INCROM $d99a, $d9c2 + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5B, .ows_d9b9 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_0E, .ows_d9aa + quit_script_fully + +.ows_d9aa + ask_question_jump_default_yes Text0609, .ows_d9b0 + quit_script_fully + +.ows_d9b0 + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5B + replace_map_blocks $03 + print_text Text060a +.ows_d9b9 + ask_question_jump_default_yes Text060b, .ows_d9bf + quit_script_fully + +.ows_d9bf + open_deck_machine $02 + quit_script_fully Script_d9c2: ; d9c2 (3:59c2) ld a, $04 call Func_d96c -; 0xd9c7 - INCROM $d9c7, $d9ef + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5C, .ows_d9e6 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_BEAT_AMY, .ows_d9d7 + quit_script_fully + +.ows_d9d7 + ask_question_jump_default_yes Text0609, .ows_d9dd + quit_script_fully + +.ows_d9dd + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5C + replace_map_blocks $04 + print_text Text060a +.ows_d9e6 + ask_question_jump_default_yes Text060b, .ows_d9ec + quit_script_fully + +.ows_d9ec + open_deck_machine $03 + quit_script_fully Script_d9ef: ; d9ef (3:59ef) ld a, $05 call Func_d96c -; 0xd9f4 - INCROM $d9f4, $da1c + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5D, .ows_da13 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_0C, .ows_da04 + quit_script_fully + +.ows_da04 + ask_question_jump_default_yes Text0609, .ows_da0a + quit_script_fully + +.ows_da0a + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5D + replace_map_blocks $05 + print_text Text060a +.ows_da13 + ask_question_jump_default_yes Text060b, .ows_da19 + quit_script_fully + +.ows_da19 + open_deck_machine $04 + quit_script_fully Script_da1c: ; da1c (3:5a1c) ld a, $06 call Func_d96c -; 0xda21 - INCROM $da21, $da49 + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5E, .ows_da40 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_da31 + quit_script_fully + +.ows_da31 + ask_question_jump_default_yes Text0609, .ows_da37 + quit_script_fully + +.ows_da37 + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5E + replace_map_blocks $06 + print_text Text060a +.ows_da40 + ask_question_jump_default_yes Text060b, .ows_da46 + quit_script_fully + +.ows_da46 + open_deck_machine $05 + quit_script_fully Script_da49: ; da49 (3:5a49) ld a, $07 call Func_d96c -; 0xda4e - INCROM $da4e, $da76 + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_5F, .ows_da6d + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_da5e + quit_script_fully + +.ows_da5e + ask_question_jump_default_yes Text0609, .ows_da64 + quit_script_fully + +.ows_da64 + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_5F + replace_map_blocks $07 + print_text Text060a +.ows_da6d + ask_question_jump_default_yes Text060b, .ows_da73 + quit_script_fully + +.ows_da73 + open_deck_machine $06 + quit_script_fully Script_da76: ; da76 (3:5a76) ld a, $08 call Func_d96c -; 0xda7b - INCROM $da7b, $daa3 + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_60, .ows_da9a + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_09, .ows_da8b + quit_script_fully + +.ows_da8b + ask_question_jump_default_yes Text0609, .ows_da91 + quit_script_fully + +.ows_da91 + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_60 + replace_map_blocks $08 + print_text Text060a +.ows_da9a + ask_question_jump_default_yes Text060b, .ows_daa0 + quit_script_fully + +.ows_daa0 + open_deck_machine $07 + quit_script_fully Script_daa3: ; daa3 (3:5aa3) ld a, $09 call Func_d96c -; 0xdaa8 - INCROM $daa8, $dad0 + start_script + print_text Text0607 + jump_if_flag_nonzero_2 EVENT_FLAG_61, .ows_dac7 + print_text Text0608 + jump_if_flag_nonzero_2 EVENT_FLAG_0A, .ows_dab8 + quit_script_fully + +.ows_dab8 + ask_question_jump_default_yes Text0609, .ows_dabe + quit_script_fully + +.ows_dabe + play_sfx SFX_5A + max_out_flag_value EVENT_FLAG_61 + replace_map_blocks $09 + print_text Text060a +.ows_dac7 + ask_question_jump_default_yes Text060b, .ows_dacd + quit_script_fully + +.ows_dacd + open_deck_machine $08 + quit_script_fully Script_dad0: ; dad0 (3:5ad0) - INCROM $dad0, $dadd + start_script + print_text Text060c + ask_question_jump_default_yes Text060d, .ows_dada + quit_script_fully + +.ows_dada + open_deck_machine $00 + quit_script_fully Preload_NikkiInIshiharasHouse: ; dadd (3:5add) get_flag_value EVENT_FLAG_35 @@ -3881,10 +4125,75 @@ Preload_NikkiInIshiharasHouse: ; dadd (3:5add) .dontLoadNikki or a ret -; 0xdae9 Script_dae9: ; dae9 (3:5ae9) - INCROM $dae9, $db3d + start_script + print_npc_text Text0723 + script_set_flag_value EVENT_FLAG_35, $02 + close_text_box + jump_if_npc_loaded NPC_ISHIHARA, .ows_dafb + move_active_npc_by_direction NPCMovementTable_db24 + script_jump .ows_db0f + +.ows_dafb + move_active_npc_by_direction NPCMovementTable_db11 + print_npc_text Text0724 + set_dialog_npc NPC_ISHIHARA + print_npc_text Text0725 + set_dialog_npc NPC_NIKKI + print_npc_text Text0726 + close_text_box + move_active_npc NPCMovement_db31 +.ows_db0f + unload_active_npc + quit_script_fully + +NPCMovementTable_db11: ; db11 (3:5b11) + dw NPCMovement_db19 + dw NPCMovement_db20 + dw NPCMovement_db19 + dw NPCMovement_db19 + +NPCMovement_db19: ; db19 (3:5b19) + db EAST + db SOUTH + db SOUTH + db SOUTH + db EAST + db NORTH | NO_MOVE + db $ff + +NPCMovement_db20: ; db20 (3:5b20) + db SOUTH + db EAST + db $fe, -8 + +NPCMovementTable_db24: ; db24 (3:5b24) + dw NPCMovement_db2c + dw NPCMovement_db39 + dw NPCMovement_db2c + dw NPCMovement_db2c + +NPCMovement_db2c: ; db2c (3:5b2c) + db EAST + db SOUTH + db SOUTH + db SOUTH + db EAST +NPCMovement_db31: ; db31 (3:5b31) + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db $ff + +NPCMovement_db39: ; db39 (3:5b39) + db SOUTH + db EAST + db $fe, -14 Preload_IshiharaInIshiharasHouse: ; db3d (3:5b3d) get_flag_value EVENT_FLAG_1C @@ -4044,7 +4353,39 @@ FightingClubLobbyAfterDuel: ; dc68 (3:5c68) db $00 Script_Man1: ; dc76 (3:5c76) - INCROM $dc76, $dceb + start_script + jump_if_flag_equal EVENT_FLAG_2C, $06, .ows_dce8 + jump_if_flag_nonzero_2 EVENT_FLAG_01, .ows_dce5 + jump_if_flag_nonzero_2 EVENT_FLAG_29, .ows_dc91 + max_out_flag_value EVENT_FLAG_29 + pick_next_man1_requested_card + get_man1_requested_card_name_text + end_script +; 0xdc89 + + INCROM $dc89, $dc91 + +.ows_dc91 + jump_if_flag_zero_2 EVENT_FLAG_2A, .ows_dc9d + get_man1_requested_card_name_text + end_script +; 0xdc97 + + INCROM $dc97, $dc9d + +.ows_dc9d + pick_next_man1_requested_card + get_man1_requested_card_name_text + end_script +; 0xdca0 + + INCROM $dca0, $dce5 + +.ows_dce5 + print_text_quit_fully Text0465 + +.ows_dce8 + print_text_quit_fully Text0466 Preload_ImakuniInFightingClubLobby: ; dceb (3:5ceb) INCROM $dceb, $dd0d @@ -4100,7 +4441,6 @@ Script_LostToImakuni: ; dd5c (3:5d5c) .ows_dd69 set_player_direction EAST move_player WEST, 1 - .ows_dd6e move_active_npc NPCMovement_dd78 unload_active_npc @@ -4122,16 +4462,23 @@ NPCMovement_dd78: ; dd78 (3:5d78) db $ff Script_Specs1: ; dd82 (3:5d82) - INCROM $dd82, $dd8d + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0472, Text0473 + quit_script_fully Script_Butch: ; dd8d (3:5d8d) - INCROM $dd8d, $dd98 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0474, Text0475 + quit_script_fully Preload_Granny1: ; dd98 (3:5d98) INCROM $dd98, $dd9f Script_Granny1: ; dd9f (3:5d9f) - INCROM $dd9f, $dda3 + start_script + print_text_quit_fully Text0476 FightingClubAfterDuel: ; dda3 (3:5da3) ld hl, .after_duel_table @@ -4172,17 +4519,22 @@ Script_Mitch: ; ddc3 (3:5dc3) script_set_flag_value EVENT_FLAG_17, $01 script_set_flag_value EVENT_FLAG_20, $01 quit_script_fully + .three_pupils_remaining print_text_quit_fully Text0478 + .two_pupils_remaining print_text_quit_fully Text0479 + .one_pupil_remaining print_text_quit_fully Text047a + .all_pupils_defeated print_npc_text Text047b ask_question_jump Text047c, .start_duel print_npc_text Text047d quit_script_fully + .start_duel print_npc_text Text047e start_duel PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 @@ -4211,6 +4563,7 @@ Script_Mitch_AlreadyHaveMedal: ; de21 (3:5e21) ask_question_jump Text047c, .start_duel print_npc_text Text0484 quit_script_fully + .start_duel print_npc_text Text0485 start_duel PRIZES_6, FIRST_STRIKE_DECK_ID, MUSIC_DUEL_THEME_2 @@ -4226,34 +4579,85 @@ Script_Mitch_PrintTrainHarderText: ; de40 (3:5e40) print_text_quit_fully Text0488 Preload_ChrisInFightingClub: ; de43 (3:5e43) - INCROM $de43, $de69 + INCROM $de43, $de4b + +Script_de4b: ; de4b (3:5e4b) + jump_if_flag_equal EVENT_FLAG_17, $08, NULL + print_variable_npc_text Text0489, Text048a + script_set_flag_value EVENT_FLAG_17, $09 + ask_question_jump Text048b, .ows_de61 + print_npc_text Text048c + quit_script_fully + +.ows_de61 + print_npc_text Text048d + start_duel PRIZES_4, MUSCLES_FOR_BRAINS_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatChrisInFightingClub: ; de69 (3:5e69) - INCROM $de69, $de75 + start_script + print_npc_text Text048e + give_booster_packs BOOSTER_EVOLUTION_FIGHTING, BOOSTER_EVOLUTION_FIGHTING, NO_BOOSTER + print_npc_text Text048f + quit_script_fully Script_LostToChrisInFightingClub: ; de75 (3:5e75) - INCROM $de75, $de79 + start_script + print_text_quit_fully Text0490 Preload_MichaelInFightingClub: ; de79 (3:5e79) - INCROM $de79, $de95 + INCROM $de79, $de81 + +Script_de81: ; de81 (3:5e81) + print_npc_text Text0491 + ask_question_jump Text0492, .ows_de8d + print_npc_text Text0493 + quit_script_fully + +.ows_de8d + print_npc_text Text0494 + start_duel PRIZES_4, HEATED_BATTLE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatMichaelInFightingClub: ; de95 (3:5e95) - INCROM $de95, $dea1 + start_script + print_npc_text Text0495 + give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER + print_npc_text Text0496 + quit_script_fully Script_LostToMichaelInFightingClub: ; dea1 (3:5ea1) - INCROM $dea1, $dea5 + start_script + print_text_quit_fully Text0497 Preload_JessicaInFightingClub: ; dea5 (3:5ea5) - INCROM $dea5, $dec1 + INCROM $dea5, $dead + +Script_dead: ; dead (3:5ead) + print_npc_text Text0498 + ask_question_jump Text0499, .ows_deb9 + print_npc_text Text049a + quit_script_fully + +.ows_deb9 + print_npc_text Text049b + start_duel PRIZES_4, LOVE_TO_BATTLE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJessicaInFightingClub: ; dec1 (3:5ec1) - INCROM $dec1, $decd + start_script + print_npc_text Text049c + give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER + print_npc_text Text049d + quit_script_fully Script_LostToJessicaInFightingClub: ; decd (3:5ecd) - INCROM $decd, $ded1 + start_script + print_text_quit_fully Text049e Script_Clerk2: ; ded1 (3:5ed1) - INCROM $ded1, $ded5 + start_script + print_text_quit_fully Text0779 RockClubLobbyAfterDuel: ; ded5 (3:5ed5) ld hl, .after_duel_table @@ -4276,34 +4680,135 @@ Preload_ChrisInRockClubLobby: ; dee9 (3:5ee9) INCROM $dee9, $def2 Script_Chris: ; def2 (3:5ef2) - INCROM $def2, $df0c + start_script + jump_if_flag_not_less_than EVENT_FLAG_17, $08, Script_de4b + print_npc_text Text077a + ask_question_jump Text077b, .ows_df04 + print_npc_text Text077c + quit_script_fully + +.ows_df04 + print_npc_text Text077d + start_duel PRIZES_4, MUSCLES_FOR_BRAINS_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatChrisInRockClubLobby: ; df0c (3:5f0c) - INCROM $df0c, $df20 + start_script + script_set_flag_value EVENT_FLAG_17, $08 + print_npc_text Text077e + give_booster_packs BOOSTER_EVOLUTION_FIGHTING, BOOSTER_EVOLUTION_FIGHTING, NO_BOOSTER + print_npc_text Text077f + close_text_box + move_active_npc_by_direction NPCMovementTable_df24 + unload_active_npc + quit_script_fully Script_LostToChrisInRockClubLobby: ; df20 (3:5f20) - INCROM $df20, $df39 + start_script + print_text_quit_fully Text0780 + +NPCMovementTable_df24: ; df24 (3:5f24) + dw NPCMovement_df2c + dw NPCMovement_df2c + dw NPCMovement_df34 + dw NPCMovement_df2c + +NPCMovement_df2c: ; df2c (3:5f2c) + db SOUTH + db SOUTH + db EAST + db EAST + db EAST + db EAST + db EAST + db $ff + +NPCMovement_df34: ; df34 (3:5f34) + db EAST + db SOUTH + db SOUTH + db $fe, -9 Script_Matthew: ; df39 (3:5f39) - INCROM $df39, $df63 + start_script + try_give_pc_pack $03 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_df4c + jump_if_flag_zero_1 EVENT_FLAG_18, NULL + print_variable_npc_text Text0781, Text0782 + script_jump .ows_df4f + +.ows_df4c + print_npc_text Text0783 +.ows_df4f + script_set_flag_value EVENT_FLAG_18, $01 + ask_question_jump Text0784, .ows_df5b + print_npc_text Text0785 + quit_script_fully + +.ows_df5b + print_npc_text Text0786 + start_duel PRIZES_4, HARD_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatMatthew: ; df63 (3:5f63) - INCROM $df63, $df78 + start_script + script_set_flag_value EVENT_FLAG_18, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0787, Text0788 + give_booster_packs BOOSTER_MYSTERY_FIGHTING_COLORLESS, BOOSTER_MYSTERY_FIGHTING_COLORLESS, NO_BOOSTER + print_npc_text Text0789 + quit_script_fully Script_LostToMatthew: ; df78 (3:5f78) - INCROM $df78, $df83 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text078a, Text078b + quit_script_fully Script_Woman1: ; df83 (3:5f83) - INCROM $df83, $dfc0 + start_script + jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_dfba + jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_df96 + max_out_flag_value EVENT_FLAG_1C + max_out_flag_value EVENT_FLAG_1E + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text078c + +.ows_df96 + jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_dfb7 + jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_dfae + jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_dfa9 + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text078d + +.ows_dfa9 + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text078e + +.ows_dfae + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_dfb7 + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text078f + +.ows_dfb7 + print_text_quit_fully Text0790 + +.ows_dfba + script_set_flag_value EVENT_FLAG_1F, $08 + print_text_quit_fully Text0791 Script_Chap1: ; dfc0 (3:5fc0) - INCROM $dfc0, $dfcb + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0792, Text0793 + quit_script_fully Preload_Lass3: ; dfcb (3:5fcb) INCROM $dfcb, $dfd2 Script_Lass3: ; dfd2 (3:5fd2) - INCROM $dfd2, $dfd6 + start_script + print_text_quit_fully Text0794 RockClubAfterDuel: ; dfd6 (3:5fd6) ld hl, .after_duel_table @@ -4328,39 +4833,114 @@ RockClubAfterDuel: ; dfd6 (3:5fd6) db $00 Script_Ryan: ; dff0 (3:5ff0) - INCROM $dff0, $e007 + start_script + try_give_pc_pack $03 + print_npc_text Text0795 + ask_question_jump Text0796, .ows_dfff + print_npc_text Text0797 + quit_script_fully + +.ows_dfff + print_npc_text Text0798 + start_duel PRIZES_3, EXCAVATION_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatRyan: ; e007 (3:6007) - INCROM $e007, $e013 + start_script + print_npc_text Text0799 + give_booster_packs BOOSTER_EVOLUTION_FIGHTING, BOOSTER_EVOLUTION_FIGHTING, NO_BOOSTER + print_npc_text Text079a + quit_script_fully Script_LostToRyan: ; e013 (3:6013) - INCROM $e013, $e017 + start_script + print_text_quit_fully Text079b Script_Andrew: ; e017 (3:6017) - INCROM $e017, $e02e + start_script + try_give_pc_pack $03 + print_npc_text Text079c + ask_question_jump Text079d, .ows_e026 + print_npc_text Text079e + quit_script_fully + +.ows_e026 + print_npc_text Text079f + start_duel PRIZES_4, BLISTERING_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatAndrew: ; e02e (3:602e) - INCROM $e02e, $e03a + start_script + print_npc_text Text07a0 + give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER + print_npc_text Text07a1 + quit_script_fully Script_LostToAndrew: ; e03a (3:603a) - INCROM $e03a, $e03e + start_script + print_text_quit_fully Text07a2 Script_Gene: ; e03e (3:603e) - INCROM $e03e, $e059 + start_script + try_give_pc_pack $03 + jump_if_flag_nonzero_2 EVENT_FLAG_0E, Script_LostToGene.ows_e07b + print_npc_text Text07a3 + ask_question_jump Text07a4, .ows_e051 + print_npc_text Text07a5 + quit_script_fully + +.ows_e051 + print_npc_text Text07a6 + start_duel PRIZES_6, ROCK_CRUSHER_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully Script_BeatGene: ; e059 (3:6059) - INCROM $e059, $e073 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0E, Script_LostToGene.ows_e08f + print_npc_text Text07a7 + max_out_flag_value EVENT_FLAG_0E + try_give_medal_pc_packs + show_medal_received_screen EVENT_FLAG_0E + record_master_win $02 + print_npc_text Text07a8 + give_booster_packs BOOSTER_MYSTERY_FIGHTING_COLORLESS, BOOSTER_MYSTERY_FIGHTING_COLORLESS, NO_BOOSTER + print_npc_text Text07a9 + quit_script_fully Script_LostToGene: ; e073 (3:6073) - INCROM $e073, $e09e + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0E, .ows_e09a + print_text_quit_fully Text07aa -Script_Clerk3: ; e09e (3:609e) - INCROM $e09e, $e0a2 +.ows_e07b + print_npc_text Text07ab + ask_question_jump Text07a4, .ows_e087 + print_npc_text Text07ac + quit_script_fully -WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) - ld hl, .after_duel_table - call FindEndOfDuelScript - ret +.ows_e087 + print_npc_text Text07ad + start_duel PRIZES_6, ROCK_CRUSHER_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully + +.ows_e08f + print_npc_text Text07ae + give_booster_packs BOOSTER_MYSTERY_FIGHTING_COLORLESS, BOOSTER_MYSTERY_FIGHTING_COLORLESS, NO_BOOSTER + print_npc_text Text07af + quit_script_fully + +.ows_e09a + print_text_quit_fully Text07b0 + ret + +Script_Clerk3: ; e09e (3:609e) + start_script + print_text_quit_fully Text041c + +WaterClubLobbyAfterDuel: ; e0a2 (3:60a2) + ld hl, .after_duel_table + call FindEndOfDuelScript + ret .after_duel_table db NPC_IMAKUNI @@ -4494,6 +5074,7 @@ Script_Sara: ; e177 (3:6177) ask_question_jump Text042d, .start_duel print_npc_text Text042e quit_script_fully + .start_duel print_npc_text Text042f start_duel PRIZES_2, WATERFRONT_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 @@ -4507,22 +5088,23 @@ Script_BeatSara: ; e18c (3:618c) print_npc_text Text0431 quit_script_fully -Script_LostToSara: ; e19a (03:619a) +Script_LostToSara: ; e19a (3:619a) start_script print_text_quit_fully Text0432 -Script_Amanda: ; e19e (03:619e) +Script_Amanda: ; e19e (3:619e) start_script print_npc_text Text0433 ask_question_jump Text0434, .start_duel print_npc_text Text0435 quit_script_fully + .start_duel print_npc_text Text0436 start_duel PRIZES_3, LONELY_FRIENDS_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully -Script_BeatAmanda: ; e1b3 (03:61b3) +Script_BeatAmanda: ; e1b3 (3:61b3) start_script max_out_flag_value EVENT_BEAT_AMANDA print_npc_text Text0437 @@ -4530,33 +5112,36 @@ Script_BeatAmanda: ; e1b3 (03:61b3) print_npc_text Text0438 quit_script_fully -Script_LostToAmanda: ; e1c1 (03:61c1) +Script_LostToAmanda: ; e1c1 (3:61c1) start_script print_text_quit_fully Text0439 -Script_NotReadyToSeeAmy: ; e1c5 (03:61c5) +Script_NotReadyToSeeAmy: ; e1c5 (3:61c5) start_script - 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 + jump_if_player_coords_match 18, 8, .ows_e1ec + jump_if_player_coords_match 20, 8, .ows_e1f2 + jump_if_player_coords_match 24, 8, .ows_e1f8 .ows_e1d5 move_player SOUTH, 4 move_active_npc NPCMovement_e213 print_npc_text Text043a - jump_if_player_coords_match $12, $0a, .ows_e1fe - jump_if_player_coords_match $14, $0a, .ows_e202 + jump_if_player_coords_match 18, 10, .ows_e1fe + jump_if_player_coords_match 20, 10, .ows_e202 move_active_npc NPCMovement_e215 quit_script_fully .ows_e1ec move_active_npc NPCMovement_e206 script_jump .ows_e1d5 + .ows_e1f2 move_active_npc NPCMovement_e20b script_jump .ows_e1d5 + .ows_e1f8 move_active_npc NPCMovement_e20f script_jump .ows_e1d5 + .ows_e1fe move_active_npc NPCMovement_e218 quit_script_fully @@ -4595,8 +5180,6 @@ NPCMovement_e215: ; e215 (3:6215) NPCMovement_e218: ; e218 (3:6218) db EAST -; fallthrough - NPCMovement_e219: ; e219 (3:6219) db EAST db SOUTH | NO_MOVE @@ -4607,6 +5190,7 @@ Script_Joshua: ; e21c (3:621c) 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 print_npc_text Text043b @@ -4702,9 +5286,9 @@ Script_MeetAmy: ; e2d1 (3:62d1) print_npc_text Text044d close_text_box set_sprite_attributes $09, $2f, $10 - do_frames $20 + do_frames 32 set_sprite_attributes $04, $0e, $00 - set_active_npc_coords $14, $04 + set_active_npc_coords 20, 4 set_player_direction WEST move_player WEST, 1 set_player_direction NORTH @@ -4720,10 +5304,9 @@ Script_Amy: ; e304 (3:6304) print_npc_text Text044f .ask_for_duel ask_question_jump Text0450, .start_duel - .deny_duel print_npc_text Text0451 - jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e + jump_if_active_npc_coords_match 20, 4, Script_LostToAmy.ows_e34e quit_script_fully .start_duel @@ -4744,18 +5327,18 @@ Script_BeatAmy: ; e322 (3:6322) .give_booster_packs give_booster_packs BOOSTER_LABORATORY_WATER, BOOSTER_LABORATORY_WATER, NO_BOOSTER print_npc_text Text0456 - jump_if_active_npc_coords_match $14, $04, Script_LostToAmy.ows_e34e + jump_if_active_npc_coords_match 20, 4, Script_LostToAmy.ows_e34e quit_script_fully Script_LostToAmy: ; e344 (3:6344) start_script print_npc_text Text0457 - jump_if_active_npc_coords_match $14, $04, .ows_e34e + jump_if_active_npc_coords_match 20, 4, .ows_e34e quit_script_fully .ows_e34e set_sprite_attributes $08, $2e, $10 - set_active_npc_coords $16, $04 + set_active_npc_coords 22, 4 quit_script_fully Script_Amy_AlreadyHaveMedal: ; e356 (3:6356) @@ -4769,7 +5352,8 @@ Script_Amy_AlreadyHaveMedal: ; e356 (3:6356) quit_script_fully Script_Clerk4: ; e369 (3:6369) - INCROM $e369, $e36d + start_script + print_text_quit_fully Text060e LightningClubLobbyAfterDuel: ; e36d (3:636d) ld hl, .after_duel_table @@ -4787,13 +5371,46 @@ Preload_ImakuniInLightningClubLobby: ; e37b (3:637b) INCROM $e37b, $e39a Script_Chap2: ; e39a (3:639a) - INCROM $e39a, $e3d9 + start_script + jump_if_flag_equal EVENT_FLAG_19, $02, .ows_e3d6 + jump_if_flag_equal EVENT_FLAG_19, $00, NULL + print_variable_npc_text Text060f, Text0610 + script_set_flag_value EVENT_FLAG_19, $01 + ask_question_jump Text0611, .ows_e3b6 + print_npc_text Text0612 + quit_script_fully + +.ows_e3b6 + jump_if_card_owned ELECTABUZZ2, .ows_e3be + print_npc_text Text0613 + quit_script_fully + +.ows_e3be + jump_if_card_in_collection ELECTABUZZ2, .ows_e3c6 + print_npc_text Text0614 + quit_script_fully + +.ows_e3c6 + script_set_flag_value EVENT_FLAG_19, $02 + print_npc_text Text0615 + take_card ELECTABUZZ2 + give_card ELECTABUZZ1 + show_card_received_screen ELECTABUZZ1 + print_npc_text Text0616 + quit_script_fully + +.ows_e3d6 + print_text_quit_fully Text0617 Script_Lass4: ; e3d9 (3:63d9) - INCROM $e3d9, $e3dd + start_script + print_text_quit_fully Text0618 Script_Hood1: ; e3dd (3:63dd) - INCROM $e3dd, $e3e8 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0619, Text061a + quit_script_fully LightningClubAfterDuel: ; e3e8 (3:63e8) ld hl, .after_duel_table @@ -4823,43 +5440,152 @@ LightningClubAfterDuel: ; e3e8 (3:63e8) db $00 Script_Jennifer: ; e408 (3:6408) - INCROM $e408, $e41d + start_script + print_npc_text Text061b + ask_question_jump Text061c, .ows_e415 + print_npc_text Text061d + quit_script_fully + +.ows_e415 + print_npc_text Text061e + start_duel PRIZES_4, PIKACHU_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJennifer: ; e41d (3:641d) - INCROM $e41d, $e42b + start_script + max_out_flag_value EVENT_FLAG_25 + print_npc_text Text061f + give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER + print_npc_text Text0620 + quit_script_fully Script_LostToJennifer: ; e42b (3:642b) - INCROM $e42b, $e42f + start_script + print_text_quit_fully Text0621 Script_Nicholas: ; e42f (3:642f) - INCROM $e42f, $e444 + start_script + print_npc_text Text0622 + ask_question_jump Text0623, .ows_e43c + print_npc_text Text0624 + quit_script_fully + +.ows_e43c + print_npc_text Text0625 + start_duel PRIZES_4, BOOM_BOOM_SELFDESTRUCT_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatNicholas: ; e444 (3:6444) - INCROM $e444, $e452 + start_script + max_out_flag_value EVENT_FLAG_26 + print_npc_text Text0626 + give_booster_packs BOOSTER_COLOSSEUM_LIGHTNING, BOOSTER_COLOSSEUM_LIGHTNING, NO_BOOSTER + print_npc_text Text0627 + quit_script_fully Script_LostToNicholas: ; e452 (3:6452) - INCROM $e452, $e456 + start_script + print_text_quit_fully Text0628 Script_Brandon: ; e456 (3:6456) - INCROM $e456, $e480 + start_script + jump_if_flag_zero_2 EVENT_FLAG_25, .ows_e469 + jump_if_flag_zero_2 EVENT_FLAG_26, .ows_e469 + jump_if_flag_zero_2 EVENT_FLAG_27, .ows_e469 + print_npc_text Text0629 + script_jump .ows_e46c + +.ows_e469 + print_npc_text Text062a +.ows_e46c + print_npc_text Text062b + ask_question_jump Text062c, .ows_e478 + print_npc_text Text062d + quit_script_fully + +.ows_e478 + print_npc_text Text062e + start_duel PRIZES_4, POWER_GENERATOR_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatBrandon: ; e480 (3:6480) - INCROM $e480, $e490 + start_script + try_give_pc_pack $05 + max_out_flag_value EVENT_FLAG_27 + print_npc_text Text062f + give_booster_packs BOOSTER_COLOSSEUM_LIGHTNING, BOOSTER_COLOSSEUM_LIGHTNING, NO_BOOSTER + print_npc_text Text0630 + quit_script_fully Script_LostToBrandon: ; e490 (3:6490) - INCROM $e490, $e494 + start_script + print_text_quit_fully Text0631 Preload_Isaac: ; e494 (3:6494) INCROM $e494, $e4ad Script_Isaac: ; e4ad (3:64ad) - INCROM $e4ad, $e4e1 + start_script + jump_if_flag_zero_2 EVENT_FLAG_25, .ows_e4bd + jump_if_flag_zero_2 EVENT_FLAG_26, .ows_e4bd + jump_if_flag_zero_2 EVENT_FLAG_27, .ows_e4bd + script_jump .ows_e4c1 + +.ows_e4bd + print_npc_text Text0632 + quit_script_fully + +.ows_e4c1 + jump_if_flag_nonzero_2 EVENT_FLAG_0C, Script_LostToIsaac.ows_e503 + jump_if_flag_zero_2 EVENT_FLAG_28, NULL + print_variable_npc_text Text0633, Text0634 + max_out_flag_value EVENT_FLAG_28 + ask_question_jump Text0635, .ows_e4d9 + print_npc_text Text0636 + quit_script_fully + +.ows_e4d9 + print_npc_text Text0637 + start_duel PRIZES_6, ZAPPING_SELFDESTRUCT_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully Script_BeatIsaac: ; e4e1 (3:64e1) - INCROM $e4e1, $e4fb + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0C, Script_LostToIsaac.ows_e517 + print_npc_text Text0638 + max_out_flag_value EVENT_FLAG_0C + try_give_medal_pc_packs + show_medal_received_screen EVENT_FLAG_0C + record_master_win $04 + print_npc_text Text0639 + give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER + print_npc_text Text063a + quit_script_fully Script_LostToIsaac: ; e4fb (3:64fb) - INCROM $e4fb, $e525 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0C, .ows_e522 + print_text_quit_fully Text063b + +.ows_e503 + print_npc_text Text063c + ask_question_jump Text0635, .ows_e50f + print_npc_text Text063d + quit_script_fully + +.ows_e50f + print_npc_text Text063e + start_duel PRIZES_6, ZAPPING_SELFDESTRUCT_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully + +.ows_e517 + print_npc_text Text063f + give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER + print_npc_text Text0640 + quit_script_fully + +.ows_e522 + print_text_quit_fully Text0641 GrassClubEntranceAfterDuel: ; e525 (3:6525) ld hl, GrassClubEntranceAfterDuelTable @@ -4914,19 +5640,63 @@ GrassClubEntranceAfterDuelTable: ; e553 (3:6553) db $00 Script_Clerk5: ; e566 (3:6566) - INCROM $e566, $e56a + start_script + print_text_quit_fully Text06d7 Preload_MichaelInGrassClubEntrance: ; e56a (3:656a) INCROM $e56a, $e573 Script_Michael: ; e573 (3:6573) - INCROM $e573, $e597 + start_script + jump_if_flag_not_less_than EVENT_FLAG_11, $08, Script_de81 + jump_if_flag_equal EVENT_FLAG_11, $01, NULL + print_variable_npc_text Text06d8, Text06d9 + script_set_flag_value EVENT_FLAG_11, $02 + ask_question_jump Text06da, .ows_e58f + print_npc_text Text06db + quit_script_fully + +.ows_e58f + print_npc_text Text06dc + start_duel PRIZES_4, HEATED_BATTLE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatMichaelInGrassClubEntrance: ; e597 (3:6597) - INCROM $e597, $e5ab + start_script + script_set_flag_value EVENT_FLAG_11, $08 + print_npc_text Text06dd + give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER + print_npc_text Text06de + close_text_box + move_active_npc_by_direction NPCMovementTable_e5af + unload_active_npc + quit_script_fully Script_LostToMichaelInGrassClubEntrance: ; e5ab (3:65ab) - INCROM $e5ab, $e5c4 + start_script + print_text_quit_fully Text06df + +NPCMovementTable_e5af: ; e5af (3:65af) + dw NPCMovement_e5b7 + dw NPCMovement_e5b7 + dw NPCMovement_e5b7 + dw NPCMovement_e5bf + +NPCMovement_e5b7: ; e5b7 (3:65b7) + db WEST + db WEST + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db $ff + +NPCMovement_e5bf: ; e5bf (3:65bf) + db SOUTH + db WEST + db WEST + db $fe, -9 GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) ld hl, .after_duel_table @@ -4989,11 +5759,11 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06ee .ows_e648 - jump_if_card_owned $1c, .ows_e64f + jump_if_card_owned ODDISH, .ows_e64f print_text_quit_fully Text06ef .ows_e64f - jump_if_card_in_collection $1c, .ows_e656 + jump_if_card_in_collection ODDISH, .ows_e656 print_text_quit_fully Text06f0 .ows_e656 @@ -5014,11 +5784,11 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f6 .ows_e67f - jump_if_card_owned $ab, .ows_e686 + jump_if_card_owned CLEFAIRY, .ows_e686 print_text_quit_fully Text06f7 .ows_e686 - jump_if_card_in_collection $ab, .ows_e68d + jump_if_card_in_collection CLEFAIRY, .ows_e68d print_text_quit_fully Text06f8 .ows_e68d @@ -5057,13 +5827,15 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 Script_Granny2: ; e6d8 (3:66d8) - INCROM $e6d8, $e6dc + start_script + print_text_quit_fully Text0702 Preload_Gal2: ; e6dc (3:66dc) INCROM $e6dc, $e6e3 Script_Gal2: ; e6e3 (3:66e3) - INCROM $e6e3, $e6e7 + start_script + print_text_quit_fully Text0703 GrassClubAfterDuel: ; e6e7 (3:66e7) ld hl, .after_duel_table @@ -5088,22 +5860,70 @@ GrassClubAfterDuel: ; e6e7 (3:66e7) db $00 Script_Kristin: ; e701 (3:6701) - INCROM $e701, $e71c + start_script + jump_if_flag_less_than EVENT_FLAG_35, $01, NULL + print_variable_npc_text Text0704, Text0705 + ask_question_jump Text0706, .ows_e714 + print_text_quit_fully Text0707 + +.ows_e714 + print_npc_text Text0708 + start_duel PRIZES_4, FLOWER_GARDEN_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatKristin: ; e71c (3:671c) - INCROM $e71c, $e741 + start_script + try_give_pc_pack $06 + print_npc_text Text0709 + give_booster_packs BOOSTER_EVOLUTION_GRASS, BOOSTER_EVOLUTION_GRASS, NO_BOOSTER + print_npc_text Text070a + max_out_flag_value EVENT_FLAG_3A + jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e740 + jump_if_flag_zero_2 FLAG_BEAT_BRITTANY, .ows_e740 + jump_if_flag_zero_2 EVENT_FLAG_3B, .ows_e740 + script_set_flag_value EVENT_FLAG_35, $01 + max_out_flag_value EVENT_FLAG_1E + print_npc_text Text070b +.ows_e740 + quit_script_fully Script_LostToKristin: ; e741 (3:6741) - INCROM $e741, $e745 + start_script + print_text_quit_fully Text070c Script_Heather: ; e745 (3:6745) - INCROM $e745, $e760 + start_script + jump_if_flag_less_than EVENT_FLAG_35, $01, NULL + print_variable_npc_text Text070d, Text070e + ask_question_jump Text070f, .ows_e758 + print_text_quit_fully Text0710 + +.ows_e758 + print_npc_text Text0711 + start_duel PRIZES_4, KALEIDOSCOPE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatHeather: ; e760 (3:6760) - INCROM $e760, $e78a + start_script + jump_if_flag_less_than EVENT_FLAG_35, $02, NULL + print_variable_npc_text Text0712, Text0713 + give_booster_packs BOOSTER_COLOSSEUM_GRASS, BOOSTER_COLOSSEUM_GRASS, NO_BOOSTER + print_npc_text Text0714 + max_out_flag_value EVENT_FLAG_3B + jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e789 + jump_if_flag_zero_2 FLAG_BEAT_BRITTANY, .ows_e789 + jump_if_flag_zero_2 EVENT_FLAG_3A, .ows_e789 + script_set_flag_value EVENT_FLAG_35, $01 + max_out_flag_value EVENT_FLAG_1E + print_npc_text Text0715 +.ows_e789 + quit_script_fully Script_LostToHeather: ; e78a (3:678a) - INCROM $e78a, $e796 + start_script + jump_if_flag_less_than EVENT_FLAG_35, $02, NULL + print_variable_npc_text Text0716, Text0717 + quit_script_fully Preload_NikkiInGrassClub: ; e796 (3:6796) INCROM $e796, $e79e @@ -5112,15 +5932,44 @@ Script_Nikki: ; e79e (3:679e) ld a, [wCurMap] cp ISHIHARAS_HOUSE jp z, Script_dae9 -; 0xe7a6 - INCROM $e7a6, $e7d3 + start_script + jump_if_flag_zero_2 EVENT_FLAG_08, NULL + print_variable_npc_text Text0718, Text0719 + ask_question_jump Text071a, .ows_e7bf + jump_if_flag_zero_2 EVENT_FLAG_08, NULL + print_variable_npc_text Text071b, Text071c + quit_script_fully + +.ows_e7bf + jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_e7cb + print_npc_text Text071d + start_duel PRIZES_6, FLOWER_POWER_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully + +.ows_e7cb + print_npc_text Text071e + start_duel PRIZES_6, FLOWER_POWER_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully Script_BeatNikki: ; e7d3 (3:67d3) - INCROM $e7d3, $e7f2 + start_script + jump_if_flag_zero_2 EVENT_FLAG_08, NULL + print_variable_npc_text Text071f, Text0720 + jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_e7eb + max_out_flag_value EVENT_FLAG_08 + try_give_medal_pc_packs + show_medal_received_screen EVENT_FLAG_08 + record_master_win $05 + print_npc_text Text0721 +.ows_e7eb + give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER + script_jump Script_LostToNikki.ows_e7f3 Script_LostToNikki: ; e7f2 (3:67f2) - INCROM $e7f2, $e7f6 + start_script +.ows_e7f3 + print_text_quit_fully Text0722 ClubEntranceAfterDuel: ; e7f6 (3:67f6) ld hl, .after_duel_table @@ -5177,10 +6026,14 @@ TrySecondRonaldFight: ; e837 (3:6837) jp SetNextNPCAndScript Script_Clerk6: ; e84c (3:684c) - INCROM $e84c, $e850 + start_script + print_text_quit_fully Text0642 Script_Lad3: ; e850 (3:6850) - INCROM $e850, $e85b + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0643, Text0644 + quit_script_fully Preload_Ronald1InClubEntrance: ; e85b (3:685b) INCROM $e85b, $e862 @@ -5225,10 +6078,10 @@ Preload_Ronald2InClubEntrance: ; e89a (3:689a) Script_FirstRonaldFight: ; e8c0 (3:68c0) start_script move_active_npc NPCMovement_e905 - do_frames $3c + do_frames 60 move_active_npc NPCMovement_e90d print_npc_text Text064a - jump_if_player_coords_match $08, $02, .ows_e8d6 + jump_if_player_coords_match 8, 2, .ows_e8d6 set_player_direction WEST move_player WEST, 1 .ows_e8d6 @@ -5236,7 +6089,7 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) move_player SOUTH, 1 move_player SOUTH, 1 print_npc_text Text064b - script_set_flag_value $4c, $01 + script_set_flag_value EVENT_FLAG_4C, $01 start_duel PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD quit_script_fully @@ -5290,7 +6143,7 @@ Script_SecondRonaldFight: ; e91e (3:691e) do_frames 60 move_active_npc NPCMovement_e90d print_npc_text Text064f - jump_if_player_coords_match $08, $02, .ows_6934 + jump_if_player_coords_match 8, 2, .ows_6934 set_player_direction WEST move_player WEST, 1 .ows_6934 @@ -5337,25 +6190,108 @@ PsychicClubLobbyLoadMap: ; e971 (3:6971) INCROM $e971, $e980 Script_Robert: ; e980 (3:6980) - INCROM $e980, $e995 + start_script + print_npc_text Text0654 + ask_question_jump Text0655, .ows_e98d + print_npc_text Text0656 + quit_script_fully + +.ows_e98d + print_npc_text Text0657 + start_duel PRIZES_4, GHOST_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatRobert: ; e995 (3:6995) - INCROM $e995, $e9a1 + start_script + print_npc_text Text0658 + give_booster_packs BOOSTER_EVOLUTION_PSYCHIC, BOOSTER_EVOLUTION_PSYCHIC, NO_BOOSTER + print_npc_text Text0659 + quit_script_fully Script_LostToRobert: ; e9a1 (3:69a1) - INCROM $e9a1, $e9a5 + start_script + print_text_quit_fully Text065a Script_Pappy1: ; e9a5 (3:69a5) - INCROM $e9a5, $e9f7 + start_script + jump_if_flag_equal EVENT_FLAG_31, $03, .ows_e9de + jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_e9cb + jump_if_flag_equal EVENT_FLAG_31, $02, .ows_e9c8 + script_set_flag_value EVENT_FLAG_31, $01 + print_npc_text Text065b + ask_question_jump_default_yes Text065c, .ows_e9c2 + print_text_quit_fully Text065d + +.ows_e9c2 + script_set_flag_value EVENT_FLAG_31, $02 + print_text_quit_fully Text065e + +.ows_e9c8 + print_text_quit_fully Text065f + +.ows_e9cb + jump_if_flag_zero_1 EVENT_FLAG_31, NULL + print_variable_npc_text Text0660, Text0661 + give_card MEWTWO3 + show_card_received_screen MEWTWO3 + script_set_flag_value EVENT_FLAG_31, $03 + print_text_quit_fully Text0662 + +.ows_e9de + print_text_quit_fully Text0663 +; 0xe9e1 + + INCROM $e9e1, $e9f7 Preload_Ronald1InPsychicClubLobby: ; e9f7 (3:69f7) - INCROM $e9f7, $ea30 + INCROM $e9f7, $ea02 + +Script_ea02: ; ea02 (3:6a02) + start_script + move_active_npc_by_direction NPCMovementTable_ea1a + max_out_flag_value EVENT_FLAG_32 + print_npc_text Text0664 + close_text_box + set_player_direction SOUTH + move_player NORTH, 4 + move_player NORTH, 1 + move_active_npc_by_direction NPCMovementTable_ea22 + unload_active_npc + play_default_song + quit_script_fully + +NPCMovementTable_ea1a: ; ea1a (3:6a1a) + dw NPCMovement_ea2a + dw NPCMovement_ea2a + dw NPCMovement_ea2a + dw NPCMovement_ea2a + +NPCMovementTable_ea22: ; ea22 (3:6a22) + dw NPCMovement_ea2c + dw NPCMovement_ea2c + dw NPCMovement_ea2c + dw NPCMovement_ea2c + +NPCMovement_ea2a: ; ea2a (3:6a2a) + db EAST + db EAST +NPCMovement_ea2c: ; ea2c (3:6a2c) + db EAST + db EAST + db EAST + db $ff Script_Gal3: ; ea30 (3:6a30) - INCROM $ea30, $ea3b + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0665, Text0666 + quit_script_fully Script_Chap4: ; ea3b (3:6a3b) - INCROM $ea3b, $ea46 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0667, Text0668 + quit_script_fully PsychicClubAfterDuel: ; ea46 (3:6a46) ld hl, .after_duel_table @@ -5380,22 +6316,70 @@ PsychicClubAfterDuel: ; ea46 (3:6a46) db $00 Script_Daniel: ; ea60 (3:6a60) - INCROM $ea60, $ea92 + start_script + try_give_medal_pc_packs + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $04, .ows_ea7e + jump_if_flag_nonzero_2 EVENT_FLAG_2F, .ows_ea70 + max_out_flag_value EVENT_FLAG_2F + print_npc_text Text0669 +.ows_ea70 + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $01, .ows_ea78 + print_text_quit_fully Text066a + +.ows_ea78 + print_npc_text Text066b + script_jump .ows_ea81 + +.ows_ea7e + print_npc_text Text066c +.ows_ea81 + ask_question_jump Text066d, .ows_ea8a + print_npc_text Text066e + quit_script_fully + +.ows_ea8a + print_npc_text Text066f + start_duel PRIZES_4, NAP_TIME_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatDaniel: ; ea92 (3:6a92) - INCROM $ea92, $ea9e + start_script + print_npc_text Text0670 + give_booster_packs BOOSTER_EVOLUTION_PSYCHIC, BOOSTER_EVOLUTION_PSYCHIC, NO_BOOSTER + print_npc_text Text0671 + quit_script_fully Script_LostToDaniel: ; ea9e (3:6a9e) - INCROM $ea9e, $eaa2 + start_script + print_text_quit_fully Text0672 Script_Stephanie: ; eaa2 (3:6aa2) - INCROM $eaa2, $eac0 + start_script + try_give_medal_pc_packs + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $02, .ows_eaac + print_text_quit_fully Text0673 + +.ows_eaac + print_npc_text Text0674 + ask_question_jump Text0675, .ows_eab8 + print_npc_text Text0676 + quit_script_fully + +.ows_eab8 + print_npc_text Text0677 + start_duel PRIZES_4, STRANGE_POWER_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatStephanie: ; eac0 (3:6ac0) - INCROM $eac0, $eacc + start_script + print_npc_text Text0678 + give_booster_packs BOOSTER_LABORATORY_PSYCHIC, BOOSTER_LABORATORY_PSYCHIC, NO_BOOSTER + print_npc_text Text0679 + quit_script_fully Script_LostToStephanie: ; eacc (3:6acc) - INCROM $eacc, $ead0 + start_script + print_text_quit_fully Text067a Preload_Murray2: ; ead0 (3:6ad0) INCROM $ead0, $eada @@ -5404,16 +6388,69 @@ Preload_Murray1: ; eada (3:6ada) INCROM $eada, $eadf Script_Murray: ; eadf (3:6adf) - INCROM $eadf, $eb0f + start_script + try_give_pc_pack $07 + try_give_medal_pc_packs + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $04, .ows_eaef + print_npc_text Text067b + print_text Text067c + quit_script_fully + +.ows_eaef + jump_if_flag_nonzero_2 EVENT_FLAG_0D, Script_LostToMurray.ows_eb31 + jump_if_flag_zero_2 EVENT_FLAG_30, NULL + print_variable_npc_text Text067d, Text067e + max_out_flag_value EVENT_FLAG_30 + ask_question_jump Text067f, .ows_eb07 + print_npc_text Text0680 + quit_script_fully + +.ows_eb07 + print_npc_text Text0681 + start_duel PRIZES_6, STRANGE_PSYSHOCK_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully Script_BeatMurray: ; eb0f (3:6b0f) - INCROM $eb0f, $eb29 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0D, Script_LostToMurray.ows_eb45 + print_npc_text Text0682 + max_out_flag_value EVENT_FLAG_0D + try_give_medal_pc_packs + show_medal_received_screen EVENT_FLAG_0D + record_master_win $06 + print_npc_text Text0683 + give_booster_packs BOOSTER_LABORATORY_PSYCHIC, BOOSTER_LABORATORY_PSYCHIC, NO_BOOSTER + print_npc_text Text0684 + quit_script_fully Script_LostToMurray: ; eb29 (3:6b29) - INCROM $eb29, $eb53 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_eb50 + print_text_quit_fully Text0685 + +.ows_eb31 + print_npc_text Text0686 + ask_question_jump Text067f, .ows_eb3d + print_npc_text Text0687 + quit_script_fully + +.ows_eb3d + print_npc_text Text0688 + start_duel PRIZES_6, STRANGE_PSYSHOCK_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully + +.ows_eb45 + print_npc_text Text0689 + give_booster_packs BOOSTER_LABORATORY_PSYCHIC, BOOSTER_LABORATORY_PSYCHIC, NO_BOOSTER + print_npc_text Text068a + quit_script_fully + +.ows_eb50 + print_text_quit_fully Text068b Script_Clerk7: ; eb53 (3:6b53) - INCROM $eb53, $eb57 + start_script + print_text_quit_fully Text0744 ScienceClubLobbyAfterDuel:; eb57 (3:6b57) ld hl, .after_duel_table @@ -5431,10 +6468,40 @@ Preload_ImakuniInScienceClubLobby: ; eb65 (3:6b65) INCROM $eb65, $eb84 Script_Lad1: ; eb84 (3:6b84) - INCROM $eb84, $ebc1 + start_script + jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_ebbb + jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_eb97 + max_out_flag_value EVENT_FLAG_1C + max_out_flag_value EVENT_FLAG_1E + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0745 + +.ows_eb97 + jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_ebb8 + jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_ebaf + jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_ebaa + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0746 + +.ows_ebaa + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0747 + +.ows_ebaf + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_ebb8 + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0748 + +.ows_ebb8 + print_text_quit_fully Text0749 + +.ows_ebbb + script_set_flag_value EVENT_FLAG_1F, $08 + print_text_quit_fully Text074a Script_Man3: ; ebc1 (3:6bc1) - INCROM $ebc1, $ebc5 + start_script + print_text_quit_fully Text074b Script_Specs2: ; ebc5 (3:6bc5) call UpdateRNGSources @@ -5450,9 +6517,11 @@ Script_Specs2: ; ebc5 (3:6bc5) ld a, e ld [hli], a ld [hl], d -; 0xebdd - INCROM $ebdd, $ebe7 + start_script + print_npc_text Text074c + move_active_npc NPCMovement_ebeb + print_text_quit_fully Text074d Data_ebe7: ; ebe7 (3:6be7) db PORYGON @@ -5460,10 +6529,13 @@ Data_ebe7: ; ebe7 (3:6be7) db MUK db WEEZING - INCROM $ebeb, $ebed +NPCMovement_ebeb: ; ebeb (3:6beb) + db WEST | NO_MOVE + db $ff Script_Specs3: ; ebed (3:6bed) - INCROM $ebed, $ebf1 + start_script + print_text_quit_fully Text074e ScienceClubAfterDuel: ; ebf1 (3:6bf1) ld hl, .after_duel_table @@ -5493,46 +6565,173 @@ ScienceClubAfterDuel: ; ebf1 (3:6bf1) db $00 Script_David: ; ec11 (3:6c11) - INCROM $ec11, $ec2f + start_script + jump_if_flag_zero_1 EVENT_FLAG_1A, NULL + print_variable_npc_text Text074f, Text0750 + script_set_flag_value EVENT_FLAG_1A, $01 + ask_question_jump Text0751, .ows_ec27 + print_npc_text Text0752 + quit_script_fully + +.ows_ec27 + print_npc_text Text0753 + start_duel PRIZES_4, LOVELY_NIDORAN_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatDavid: ; ec2f (3:6c2f) - INCROM $ec2f, $ec3e + start_script + script_set_flag_value EVENT_FLAG_1A, $02 + print_npc_text Text0754 + give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER + print_npc_text Text0755 + quit_script_fully Script_LostToDavid: ; ec3e (3:6c3e) - INCROM $ec3e, $ec42 + start_script + print_text_quit_fully Text0756 Script_Erik: ; ec42 (3:6c42) - INCROM $ec42, $ec57 + start_script + print_npc_text Text0757 + ask_question_jump Text0758, .ows_ec4f + print_npc_text Text0759 + quit_script_fully + +.ows_ec4f + print_npc_text Text075a + start_duel PRIZES_4, POISON_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatErik: ; ec57 (3:6c57) - INCROM $ec57, $ec63 + start_script + print_npc_text Text075b + give_booster_packs BOOSTER_EVOLUTION_GRASS, BOOSTER_EVOLUTION_GRASS, NO_BOOSTER + print_npc_text Text075c + quit_script_fully Script_LostToErik: ; ec63 (3:6c63) - INCROM $ec63, $ec67 + start_script + print_text_quit_fully Text075d Script_Rick: ; ec67 (3:6c67) - INCROM $ec67, $ec80 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_09, Script_LostToRick.ows_eca2 + print_npc_text Text075e + ask_question_jump Text075f, .ows_ec78 + print_npc_text Text0760 + quit_script_fully + +.ows_ec78 + print_npc_text Text0761 + start_duel PRIZES_6, WONDERS_OF_SCIENCE_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully Script_BeatRick: ; ec80 (3:6c80) - INCROM $ec80, $ec9a + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_09, Script_LostToRick.ows_ecb6 + print_npc_text Text0762 + max_out_flag_value EVENT_FLAG_09 + try_give_medal_pc_packs + show_medal_received_screen EVENT_FLAG_09 + record_master_win $07 + print_npc_text Text0763 + give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER + print_npc_text Text0764 + quit_script_fully Script_LostToRick: ; ec9a (3:6c9a) - INCROM $ec9a, $ecc4 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_09, .ows_ecc1 + print_text_quit_fully Text0765 + +.ows_eca2 + print_npc_text Text0766 + ask_question_jump Text075f, .ows_ecae + print_npc_text Text0767 + quit_script_fully + +.ows_ecae + print_npc_text Text0768 + start_duel PRIZES_6, WONDERS_OF_SCIENCE_DECK_ID, MUSIC_DUEL_THEME_2 + quit_script_fully + +.ows_ecb6 + print_npc_text Text0769 + give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER + print_npc_text Text076a + quit_script_fully + +.ows_ecc1 + print_text_quit_fully Text076b Preload_Joseph: ; ecc4 (3:6cc4) INCROM $ecc4, $ecdb Script_Joseph: ; ecdb (3:6cdb) - INCROM $ecdb, $ecf6 + start_script + try_give_pc_pack $08 + jump_if_flag_nonzero_2 EVENT_FLAG_1B, Script_LostToJoseph.ows_ed24 + print_npc_text Text076c + ask_question_jump Text076d, .ows_ecee + print_npc_text Text076e + quit_script_fully + +.ows_ecee + print_npc_text Text076f + start_duel PRIZES_4, FLYIN_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJoseph: ; ecf6 (3:6cf6) - INCROM $ecf6, $ed1c + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_1B, Script_LostToJoseph.ows_ed37 + print_npc_text Text0770 + close_text_box + move_active_npc_by_direction NPCMovementTable_ed11 + set_active_npc_direction WEST + max_out_flag_value EVENT_FLAG_1B + print_npc_text Text0771 + give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER + print_npc_text Text0772 + quit_script_fully + +NPCMovementTable_ed11: ; ed11 (3:6d11) + dw NPCMovement_ed19 + dw NPCMovement_ed19 + dw NPCMovement_ed19 + dw NPCMovement_ed19 + +NPCMovement_ed19: ; ed19 (3:6d19) + db EAST + db WEST | NO_MOVE + db $ff Script_LostToJoseph: ; ed1c (3:6d1c) - INCROM $ed1c, $ed45 + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_1B, .ows_ed42 + print_text_quit_fully Text0773 + +.ows_ed24 + print_npc_text Text0774 + ask_question_jump Text076d, .ows_ed2f + print_text_quit_fully Text076e + +.ows_ed2f + print_npc_text Text0775 + start_duel PRIZES_4, FLYIN_POKEMON_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully + +.ows_ed37 + print_npc_text Text0776 + give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER + print_npc_text Text0777 + quit_script_fully + +.ows_ed42 + print_text_quit_fully Text0778 Script_Clerk8: ; ed45 (3:6d45) - INCROM $ed45, $ed49 + start_script + print_text_quit_fully Text068c FireClubLobbyAfterDuel: ; ed49 (3:6d49) ld hl, .after_duel_table @@ -5595,22 +6794,145 @@ Preload_JessicaInFireClubLobby: ; ed8d (3:6d8d) INCROM $ed8d, $ed96 Script_Jessica: ; ed96 (3:6d96) - INCROM $ed96, $edba + start_script + jump_if_flag_not_less_than EVENT_FLAG_20, $08, Script_dead + jump_if_flag_equal EVENT_FLAG_20, $01, NULL + print_variable_npc_text Text068d, Text068e + script_set_flag_value EVENT_FLAG_20, $02 + ask_question_jump Text068f, .ows_edb2 + print_npc_text Text0690 + quit_script_fully + +.ows_edb2 + print_npc_text Text0691 + start_duel PRIZES_4, LOVE_TO_BATTLE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJessicaInFireClubLobby: ; edba (3:6dba) - INCROM $edba, $edce + start_script + script_set_flag_value EVENT_FLAG_20, $08 + print_npc_text Text0692 + give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER + print_npc_text Text0693 + close_text_box + move_active_npc_by_direction NPCMovementTable_edd2 + unload_active_npc + quit_script_fully Script_LostToJessicaInFireClubLobby: ; edce (3:6dce) - INCROM $edce, $ede8 + start_script + print_text_quit_fully Text0694 + +NPCMovementTable_edd2: ; edd2 (3:6dd2) + dw NPCMovement_edda + dw NPCMovement_ede4 + dw NPCMovement_edda + dw NPCMovement_edda + +NPCMovement_edda: ; edda (3:6dda) + db EAST + db NORTH + db EAST + db EAST + db EAST + db EAST + db EAST + db EAST + db EAST + db $ff + +NPCMovement_ede4: ; ede4 (3:6de4) + db NORTH + db EAST + db $fe, -11 Script_Chap3: ; ede8 (3:6de8) - INCROM $ede8, $ee25 + start_script + jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_ee1f + jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_edfb + max_out_flag_value EVENT_FLAG_1C + max_out_flag_value EVENT_FLAG_1E + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0695 + +.ows_edfb + jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_ee1c + jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_ee13 + jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_ee0e + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0696 + +.ows_ee0e + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0697 + +.ows_ee13 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_ee1c + max_out_flag_value EVENT_FLAG_38 + print_text_quit_fully Text0698 + +.ows_ee1c + print_text_quit_fully Text0699 + +.ows_ee1f + script_set_flag_value EVENT_FLAG_1F, $08 + print_text_quit_fully Text069a Preload_Lad2: ; ee25 (3:6e25) INCROM $ee25, $ee2c Script_Lad2: ; ee2c (3:6e2c) - INCROM $ee2c, $ee76 + start_script + try_give_medal_pc_packs + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $03, .ows_ee36 + print_text_quit_fully Text069b + +.ows_ee36 + print_npc_text Text069c + ask_question_jump Text069d, .ows_ee4a + print_npc_text Text069e + script_set_flag_value EVENT_FLAG_21, $02 + close_text_box + move_active_npc_by_direction NPCMovementTable_ee61 + unload_active_npc + quit_script_fully + +.ows_ee4a + jump_if_any_energy_cards_in_collection .ows_ee51 + print_npc_text Text069f + quit_script_fully + +.ows_ee51 + remove_all_energy_cards_from_collection + print_text Text06a0 + print_npc_text Text06a1 + script_set_flag_value EVENT_FLAG_21, $01 + close_text_box + move_active_npc_by_direction NPCMovementTable_ee61 + unload_active_npc + quit_script_fully + +NPCMovementTable_ee61: ; ee61 (3:6e61) + dw NPCMovement_ee69 + dw NPCMovement_ee72 + dw NPCMovement_ee69 + dw NPCMovement_ee69 + +NPCMovement_ee69: ; ee69 (3:6e69) + db EAST + db SOUTH + db SOUTH + db SOUTH + db EAST + db EAST + db EAST + db EAST + db $ff + +NPCMovement_ee72: ; ee72 (3:6e72) + db SOUTH + db EAST + db $fe, -10 Script_ee76: ; ee76 (3:6e76) start_script @@ -5625,7 +6947,10 @@ Script_ee76: ; ee76 (3:6e76) quit_script_fully Script_Mania: ; ee88 (3:6e88) - INCROM $ee88, $ee93 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text06a3, Text06a4 + quit_script_fully FireClubAfterDuel: ; ee93 (3:6e93) ld hl, .after_duel_table @@ -5655,31 +6980,73 @@ FireClubAfterDuel: ; ee93 (3:6e93) db $00 Script_John: ; eeb3 (3:6eb3) - INCROM $eeb3, $eec8 + start_script + print_npc_text Text06a5 + ask_question_jump Text06a6, .ows_eec0 + print_npc_text Text06a7 + quit_script_fully + +.ows_eec0 + print_npc_text Text06a8 + start_duel PRIZES_4, ANGER_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJohn: ; eec8 (3:6ec8) - INCROM $eec8, $eed4 + start_script + print_npc_text Text06a9 + give_booster_packs BOOSTER_EVOLUTION_FIRE, BOOSTER_EVOLUTION_FIRE, NO_BOOSTER + print_npc_text Text06aa + quit_script_fully Script_LostToJohn: ; eed4 (3:6ed4) - INCROM $eed4, $eed8 + start_script + print_text_quit_fully Text06ab Script_Adam: ; eed8 (3:6ed8) - INCROM $eed8, $eeed + start_script + print_npc_text Text06ac + ask_question_jump Text06ad, .ows_eee5 + print_npc_text Text06ae + quit_script_fully + +.ows_eee5 + print_npc_text Text06af + start_duel PRIZES_4, FLAMETHROWER_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatAdam: ; eeed (3:6eed) - INCROM $eeed, $eef9 + start_script + print_npc_text Text06b0 + give_booster_packs BOOSTER_COLOSSEUM_FIRE, BOOSTER_COLOSSEUM_FIRE, NO_BOOSTER + print_npc_text Text06b1 + quit_script_fully Script_LostToAdam: ; eef9 (3:6ef9) - INCROM $eef9, $eefd + start_script + print_text_quit_fully Text06b2 Script_Jonathan: ; eefd (3:6efd) - INCROM $eefd, $ef12 + start_script + print_npc_text Text06b3 + ask_question_jump Text06b4, .ows_ef0a + print_npc_text Text06b5 + quit_script_fully + +.ows_ef0a + print_npc_text Text06b6 + start_duel PRIZES_4, RESHUFFLE_DECK_ID, MUSIC_DUEL_THEME_1 + quit_script_fully Script_BeatJonathan: ; ef12 (3:6f12) - INCROM $ef12, $ef1e + start_script + print_npc_text Text06b7 + give_booster_packs BOOSTER_COLOSSEUM_FIRE, BOOSTER_COLOSSEUM_FIRE, NO_BOOSTER + print_npc_text Text06b8 + quit_script_fully Script_LostToJonathan: ; ef1e (3:6f1e) - INCROM $ef1e, $ef22 + start_script + print_text_quit_fully Text06b9 Script_Ken: ; ef22 (3:6f22) start_script @@ -5690,6 +7057,7 @@ Script_Ken: ; ef22 (3:6f22) print_variable_npc_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_Ken_AlreadyHaveMedal @@ -5699,6 +7067,7 @@ Script_Ken: ; ef22 (3:6f22) ask_question_jump Text06be, .start_duel print_npc_text Text06bf quit_script_fully + .start_duel print_npc_text Text06c0 start_duel PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 @@ -5728,6 +7097,7 @@ Script_Ken_AlreadyHaveMedal: ; ef83 (3:6f83) print_npc_text Text06c6 ask_question_jump Text06be, .start_duel print_text_quit_fully Text06bf + .start_duel print_npc_text Text06c7 start_duel PRIZES_6, FIRE_CHARGE_DECK_ID, MUSIC_DUEL_THEME_2 @@ -5979,7 +7349,102 @@ Unknown_f156: ; f156 (3:7156) db $07, $00, EVENT_FLAG_57, $08 Script_f166: ; f166 (3:7166) - INCROM $f166, $f239 + start_script + move_active_npc NPCMovement_f232 + jump_if_flag_equal EVENT_FLAG_58, $01, .ows_f192 + jump_if_flag_equal EVENT_FLAG_58, $02, .ows_f1a5 + jump_if_flag_equal EVENT_FLAG_58, $03, .ows_f1b8 + jump_if_flag_equal EVENT_FLAG_58, $04, .ows_f1cb + jump_if_flag_equal EVENT_FLAG_58, $05, .ows_f1de + jump_if_flag_equal EVENT_FLAG_58, $06, .ows_f1f1 + jump_if_flag_equal EVENT_FLAG_58, $07, .ows_f204 + jump_if_flag_equal EVENT_FLAG_58, $08, .ows_f217 +.ows_f192 + print_npc_text Text0515 + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text0516 + script_jump .ows_f227 + +.ows_f1a5 + print_npc_text Text0517 + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text0518 + script_jump .ows_f227 + +.ows_f1b8 + print_npc_text Text0519 + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text051a + script_jump .ows_f227 + +.ows_f1cb + print_npc_text Text051b + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text051c + script_jump .ows_f227 + +.ows_f1de + print_npc_text Text051d + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text051e + script_jump .ows_f227 + +.ows_f1f1 + print_npc_text Text051f + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text0520 + script_jump .ows_f227 + +.ows_f204 + print_npc_text Text0521 + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text0522 + script_jump .ows_f227 + +.ows_f217 + print_npc_text Text0523 + close_text_box + move_player WEST, 1 + move_player WEST, 1 + move_player WEST, 1 + print_npc_text Text0524 +.ows_f227 + close_text_box + set_player_direction SOUTH + move_player NORTH, 4 + move_active_npc NPCMovement_f232 + unload_active_npc + quit_script_fully + +NPCMovement_f232: ; f232 (3:7232) + db EAST + db EAST + db EAST + db EAST + db EAST + db EAST + db $ff ChallengeHallAfterDuel: ; f239 (3:7239) ld c, $00 @@ -6117,7 +7582,7 @@ Script_Clerk12: ; f295 (3:7295) move_player EAST, 1 move_active_npc NPCMovement_f34e close_advanced_text_box - set_next_npc_and_script $4a, Script_f353 + set_next_npc_and_script NPC_HOST, Script_f353 end_script ret @@ -6125,8 +7590,6 @@ NPCMovement_f349: ; f349 (3:7349) db NORTH db NORTH db EAST -; fallthrough - NPCMovement_f34c: ; f34c (3:734c) db WEST | NO_MOVE db $ff @@ -6181,8 +7644,6 @@ NPCMovement_f388: ; f388 (3:7388) db NORTH db WEST db WEST -; fallthrough - NPCMovement_f38b: ; f38b (3:738b) db WEST db SOUTH @@ -6191,8 +7652,6 @@ NPCMovement_f38b: ; f38b (3:738b) NPCMovement_f38e: ; f38e (3:738e) db NORTH db EAST -; fallthrough - NPCMovement_f390: ; f390 (3:7390) db SOUTH | NO_MOVE db $ff @@ -6220,15 +7679,18 @@ Script_LostAtChallengeHall: ; f392 (3:7392) script_set_flag_value EVENT_FLAG_48, $03 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 zero_out_flag_value EVENT_FLAG_55 script_jump .ows_f3e2 + .ows_f3d9 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 set_next_npc_and_script NPC_CLERK12, Script_f3e9 @@ -6260,7 +7722,7 @@ NPCMovement_f40d: ; f40d (3:740d) db SOUTH | NO_MOVE db $ff -Script_f410: ; f410 (4:7410) +Script_f410: ; f410 (3:7410) load_active_npc_name_into_txram_slot $00 load_active_npc_name_into_txram_slot $01 print_npc_text Text0538 @@ -6304,7 +7766,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) print_npc_text Text053f close_text_box pick_challenge_hall_opponent - set_challenge_hall_npc_coords $14, $14 + set_challenge_hall_npc_coords 20, 20 move_wram_npc NPCMovement_f4d0 load_active_npc_name_into_txram_slot $00 jump_if_flag_equal EVENT_FLAG_45, $02, NULL @@ -6313,7 +7775,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) 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 + set_dialog_npc NPC_RONALD1 jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_npc_text Text0542, Text0543 set_dialog_npc NPC_HOST @@ -6328,6 +7790,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) print_variable_npc_text Text0547, Text0548 start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP quit_script_fully + .ows_f4bd print_npc_text Text0549 close_text_box @@ -6369,7 +7832,7 @@ Script_f4db: ; f4db (3:74db) print_npc_text Text054b close_text_box jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 - set_dialog_npc $02 + set_dialog_npc NPC_RONALD1 jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_npc_text Text054c, Text054d move_wram_npc NPCMovement_f4d8 @@ -6381,6 +7844,7 @@ Script_f4db: ; f4db (3:74db) close_text_box move_wram_npc NPCMovement_f4c9 script_jump .ows_f516 + .ows_f513 move_wram_npc NPCMovement_f4c8 .ows_f516 @@ -6392,7 +7856,7 @@ Script_f4db: ; f4db (3:74db) pick_challenge_cup_prize_card print_npc_text Text0551 give_card VARIABLE_CARD - show_card_received_screen $00 + show_card_received_screen VARIABLE_CARD print_npc_text Text0552 close_text_box jump_if_flag_equal EVENT_FLAG_44, $02, .ows_f540 @@ -6400,14 +7864,17 @@ Script_f4db: ; f4db (3:74db) script_set_flag_value EVENT_FLAG_3F, $02 script_set_flag_value EVENT_FLAG_48, $02 script_jump .ows_f552 + .ows_f540 script_set_flag_value EVENT_FLAG_40, $02 script_set_flag_value EVENT_FLAG_49, $02 script_jump .ows_f552 + .ows_f549 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 set_next_npc_and_script NPC_CLERK12, Script_f3e9 @@ -6537,12 +8004,81 @@ Script_f631: ; f631 (3:7631) xor a ld [wTxRam3 + 1], a ld [wTxRam3_b + 1], a -; 0xf651 - INCROM $f651, $f6af + start_script + jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $07, .ows_f69b + jump_if_flag_zero_2 EVENT_FLAG_4B, .ows_f69b + jump_if_flag_nonzero_2 EVENT_FLAG_4F, .ows_f69b + override_song MUSIC_RONALD + max_out_flag_value EVENT_FLAG_4F + jump_if_player_coords_match 18, 2, .ows_f66e + move_active_npc NPCMovement_f69c + script_jump .ows_f671 + +.ows_f66e + move_active_npc NPCMovement_f69d +.ows_f671 + print_npc_text Text0553 + close_text_box + set_player_direction SOUTH + move_player SOUTH, 1 + print_npc_text Text0554 + ask_question_jump_default_yes NULL, .ows_f688 + print_npc_text Text0555 + script_jump .ows_f695 + +.ows_f688 + jump_if_flag_zero_1 EVENT_MEDAL_COUNT, .ows_f692 + print_npc_text Text0556 + script_jump .ows_f695 + +.ows_f692 + print_npc_text Text0557 +.ows_f695 + close_text_box + move_active_npc NPCMovement_f6a6 + unload_active_npc + play_default_song +.ows_f69b + quit_script_fully + +NPCMovement_f69c: ; f69c (3:769c) + db EAST +NPCMovement_f69d: ; f69d (3:769d) + db NORTH + db NORTH + db NORTH + db NORTH + db EAST + db EAST + db NORTH + db NORTH + db $ff + +NPCMovement_f6a6: ; f6a6 (3:76a6) + db WEST + db WEST + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db $ff Script_f6af: ; f6af (3:76af) - INCROM $f6af, $f6c6 + start_script + try_give_medal_pc_packs + jump_if_flag_equal EVENT_MEDAL_COUNT, $08, .ows_f6b9 + print_text_quit_fully Text0558 + +.ows_f6b9 + print_npc_text Text0559 + play_sfx SFX_0F + replace_map_blocks $00 + do_frames 30 + move_player NORTH, 1 + quit_script_fully PokemonDomeMovePlayer: ; f6c6 (3:76c6) INCROM $f6c6, $f6e0 @@ -6586,16 +8122,28 @@ PokemonDomeCloseTextBox: ; f718 (3:7718) INCROM $f718, $f71f Script_Courtney: ; f71f (3:771f) - INCROM $f71f, $f72a + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text055a, Text055b + quit_script_fully Script_Steve: ; f72a (3:772a) - INCROM $f72a, $f735 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text055c, Text055d + quit_script_fully Script_Jack: ; f735 (3:7735) - INCROM $f735, $f740 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text055e, Text055f + quit_script_fully Script_Rod: ; f740 (3:7740) - INCROM $f740, $f74b + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0560, Text0561 + quit_script_fully Preload_Courtney: ; f74b (3:774b) INCROM $f74b, $f78c @@ -6610,37 +8158,586 @@ Preload_Rod: ; f7ba (3:77ba) INCROM $f7ba, $f7d6 Preload_Ronald1InPokemonDome: ; f7d6 (3:77d6) - INCROM $f7d6, $f93f + INCROM $f7d6, $f7ed + +Script_f7ed: ; f7ed (3:77ed) + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_f7f9 + print_npc_text Text0562 +.ows_f7f4 + close_text_box + move_player NORTH, 2 + quit_script_fully + +.ows_f7f9 + print_npc_text Text0563 + ask_question_jump Text0564, .ows_f804 + script_jump .ows_f7f4 + +.ows_f804 + enter_map $0c, POKEMON_DOME_ENTRANCE, 22, 4, NORTH + quit_script_fully + +Script_f80b: ; f80b (3:780b) + start_script + jump_if_flag_equal EVENT_FLAG_69, $01, .ows_f820 + jump_if_flag_equal EVENT_FLAG_6A, $01, .ows_f82b + jump_if_flag_equal EVENT_FLAG_6B, $01, .ows_f836 + jump_if_flag_equal EVENT_FLAG_6C, $01, .ows_f841 +.ows_f820 + close_advanced_text_box + set_next_npc_and_script NPC_STEVE, .ows_f827 + end_script + ret + +.ows_f827 + start_script + script_jump Script_BeatCourtney.ows_f996 + +.ows_f82b + close_advanced_text_box + set_next_npc_and_script NPC_JACK, .ows_f832 + end_script + ret + +.ows_f832 + start_script + script_jump Script_BeatSteve.ows_fa02 + +.ows_f836 + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_f83d + end_script + ret + +.ows_f83d + start_script + script_jump Script_BeatJack.ows_fa78 + +.ows_f841 + close_advanced_text_box + set_next_npc_and_script NPC_RONALD1, .ows_f848 + end_script + ret + +.ows_f848 + start_script + script_jump Script_BeatRod.ows_fb20 + +Script_f84c: ; f84c (3:784c) + start_script + jump_if_flag_nonzero_2 EVENT_FLAG_63, Script_f7ed + print_npc_text Text0565 + ask_question_jump Text0566, .ows_f85f + print_npc_text Text0567 + script_jump Script_f7ed.ows_f804 + +.ows_f85f + print_npc_text Text0568 + close_text_box + jump_if_player_coords_match 14, 22, .ows_f86f + set_player_direction WEST + move_player WEST, 1 + set_player_direction NORTH +.ows_f86f + move_player NORTH, 1 + move_player NORTH, 1 + set_player_direction WEST + move_player WEST, 1 + move_player WEST, 1 + set_player_direction NORTH + move_player NORTH, 1 + 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 + jump_if_flag_zero_2 EVENT_FLAG_64, NULL + print_variable_npc_text Text0569, Text056a + move_active_npc NPCMovement_fb8c + jump_if_flag_nonzero_2 EVENT_FLAG_64, .ows_f8ef + print_npc_text Text056b + close_advanced_text_box + set_next_npc_and_script NPC_COURTNEY, .ows_f8af + end_script + ret + +.ows_f8af + start_script + move_active_npc NPCMovement_fb8e + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_f8ba + end_script + ret + +.ows_f8ba + start_script + print_npc_text Text056c + close_advanced_text_box + set_next_npc_and_script NPC_STEVE, .ows_f8c5 + end_script + ret + +.ows_f8c5 + start_script + move_active_npc NPCMovement_fb8e + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_f8d0 + end_script + ret + +.ows_f8d0 + start_script + print_npc_text Text056d + close_advanced_text_box + set_next_npc_and_script NPC_JACK, .ows_f8db + end_script + ret + +.ows_f8db + start_script + move_active_npc NPCMovement_fb8e + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_f8e6 + end_script + ret + +.ows_f8e6 + start_script + max_out_flag_value EVENT_FLAG_64 + print_npc_text Text056e + script_jump .ows_f8f8 + +.ows_f8ef + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text056f, Text0570 +.ows_f8f8 + print_npc_text Text0571 + close_text_box + set_player_direction WEST + move_player WEST, 1 + set_player_direction SOUTH + move_player SOUTH, 1 + move_player SOUTH, 1 + set_player_direction EAST + move_active_npc NPCMovement_fb8d + script_set_flag_value EVENT_FLAG_65, $01 + close_advanced_text_box + set_next_npc_and_script NPC_COURTNEY, .ows_f918 + end_script + ret + +.ows_f918 + start_script + try_give_pc_pack $0e + script_set_flag_value EVENT_FLAG_68, $01 + set_dialog_npc NPC_ROD + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0572, Text0573 + close_text_box + set_dialog_npc NPC_COURTNEY + move_active_npc NPCMovement_fba6 + set_active_npc_direction WEST + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0574, Text0575 + start_duel PRIZES_6, LEGENDARY_MOLTRES_DECK_ID, MUSIC_DUEL_THEME_3 + quit_script_fully Script_LostToCourtney: ; f93f (3:793f) - INCROM $f93f, $f95a + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0576, Text0577 + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_f950 + end_script + ret + +.ows_f950 + start_script + move_active_npc NPCMovement_fba1 + print_npc_text Text0578 + script_jump Script_f7ed.ows_f804 Script_BeatCourtney: ; f95a (3:795a) - INCROM $f95a, $f9b7 + start_script + script_set_flag_value EVENT_FLAG_68, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0579, Text057a + close_text_box + move_active_npc NPCMovement_fbb7 + set_active_npc_direction WEST + close_advanced_text_box + set_next_npc_and_script NPC_STEVE, .ows_f974 + end_script + ret + +.ows_f974 + start_script + try_give_pc_pack $0f + script_set_flag_value EVENT_FLAG_69, $01 + set_dialog_npc NPC_ROD + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text057b, Text057c + close_text_box + set_dialog_npc NPC_STEVE + move_active_npc NPCMovement_fba4 + set_active_npc_direction WEST + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text057d, Text057e +.ows_f996 + zero_out_flag_value EVENT_FLAG_66 + set_dialog_npc NPC_ROD + print_npc_text Text057f + ask_question_jump_default_yes Text0580, .ows_f9af + print_npc_text Text0581 + set_dialog_npc NPC_STEVE + print_npc_text Text0582 + start_duel PRIZES_6, LEGENDARY_ZAPDOS_DECK_ID, MUSIC_DUEL_THEME_3 + quit_script_fully + +.ows_f9af + close_text_box + max_out_flag_value EVENT_FLAG_66 + open_menu + close_text_box + script_jump .ows_f996 Script_LostToSteve: ; f9b7 (3:79b7) - INCROM $f9b7, $f9c8 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0583, Text0584 + close_advanced_text_box + set_next_npc_and_script NPC_ROD, Script_LostToCourtney.ows_f950 + end_script + ret Script_BeatSteve: ; f9c8 (3:79c8) - INCROM $f9c8, $fa23 + start_script + script_set_flag_value EVENT_FLAG_69, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0585, Text0586 + close_text_box + move_active_npc NPCMovement_fbb8 + set_active_npc_direction WEST + close_advanced_text_box + set_next_npc_and_script NPC_JACK, .ows_f9e2 + end_script + ret + +.ows_f9e2 + start_script + script_set_flag_value EVENT_FLAG_6A, $01 + set_dialog_npc NPC_ROD + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0587, Text0588 + close_text_box + set_dialog_npc NPC_JACK + move_active_npc NPCMovement_fbbc + set_active_npc_direction WEST + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0589, Text058a +.ows_fa02 + zero_out_flag_value EVENT_FLAG_66 + set_dialog_npc NPC_ROD + print_npc_text Text058b + ask_question_jump_default_yes Text058c, .ows_fa1b + print_npc_text Text058d + set_dialog_npc NPC_JACK + print_npc_text Text058e + start_duel PRIZES_6, LEGENDARY_ARTICUNO_DECK_ID, MUSIC_DUEL_THEME_3 + quit_script_fully + +.ows_fa1b + close_text_box + max_out_flag_value EVENT_FLAG_66 + open_menu + close_text_box + script_jump .ows_fa02 Script_LostToJack: ; fa23 (3:7a23) - INCROM $fa23, $fa34 + start_script + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text058f, Text0590 + close_advanced_text_box + set_next_npc_and_script NPC_ROD, Script_LostToCourtney.ows_f950 + end_script + ret Script_BeatJack: ; fa34 (3:7a34) - INCROM $fa34, $fa98 + start_script + script_set_flag_value EVENT_FLAG_6A, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0591, Text0592 + close_text_box + move_active_npc NPCMovement_fbc2 + set_active_npc_direction WEST + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_fa52 + move_npc NPC_ROD, NPCMovement_f390 + end_script + ret + +.ows_fa52 + start_script + script_set_flag_value EVENT_FLAG_6B, $01 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text0593, Text0594 + close_text_box + move_active_npc NPCMovement_fbaf + set_active_npc_direction WEST + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fa75 + jump_if_flag_zero_2 EVENT_FLAG_67, NULL + print_variable_npc_text Text0595, Text0596 + script_jump .ows_fa78 + +.ows_fa75 + print_npc_text Text0597 +.ows_fa78 + zero_out_flag_value EVENT_FLAG_66 + print_npc_text Text0598 + ask_question_jump_default_yes Text0599, .ows_fa90 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text059a, Text059b + start_duel PRIZES_6, LEGENDARY_DRAGONITE_DECK_ID, MUSIC_DUEL_THEME_3 + quit_script_fully + +.ows_fa90 + close_text_box + max_out_flag_value EVENT_FLAG_66 + open_menu + close_text_box + script_jump .ows_fa78 Script_LostToRod: ; fa98 (3:7a98) - INCROM $fa98, $faae + start_script + print_npc_text Text059c + close_text_box + move_active_npc NPCMovement_fb9d + set_active_npc_direction SOUTH + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + print_variable_npc_text Text059d, Text059e + script_jump Script_f7ed.ows_f804 Script_BeatRod: ; faae (3:7aae) - INCROM $faae, $fb48 + start_script + script_set_flag_value EVENT_FLAG_6B, $02 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fad5 + jump_if_flag_zero_2 EVENT_FLAG_67, NULL + print_variable_npc_text Text059f, Text05a0 + close_text_box + move_active_npc NPCMovement_fb90 + set_active_npc_direction SOUTH + jump_if_flag_zero_2 EVENT_FLAG_67, NULL + print_variable_npc_text Text05a1, Text05a2 + close_advanced_text_box + set_next_npc_and_script NPC_RONALD1, .ows_fae9 + end_script + ret + +.ows_fad5 + print_npc_text Text05a3 + move_active_npc NPCMovement_fb96 + set_active_npc_direction SOUTH + play_sfx SFX_0F + replace_map_blocks $01 + script_set_flag_value EVENT_FLAG_65, $02 + max_out_flag_value EVENT_FLAG_63 + print_text_quit_fully Text05a4 + +.ows_fae9 + start_script + override_song MUSIC_STOP + script_set_flag_value EVENT_FLAG_6C, $01 + play_sfx SFX_0F + replace_map_blocks $01 + move_active_npc NPCMovement_fbd2 + set_default_song MUSIC_RONALD + play_default_song + jump_if_flag_nonzero_2 EVENT_FLAG_67, .ows_fb15 + print_npc_text Text05a5 + set_dialog_npc NPC_ROD + move_npc NPC_ROD, NPCMovement_fb9b + print_npc_text Text05a6 + set_dialog_npc NPC_RONALD1 + print_npc_text Text05a7 + move_npc NPC_ROD, NPCMovement_fb99 + script_jump .ows_fb18 + +.ows_fb15 + print_npc_text Text05a8 +.ows_fb18 + close_text_box + move_active_npc NPCMovement_fba8 + set_active_npc_direction WEST + max_out_flag_value EVENT_FLAG_67 +.ows_fb20 + zero_out_flag_value EVENT_FLAG_66 + set_dialog_npc NPC_ROD + print_npc_text Text05a9 + ask_question_jump_default_yes Text05aa, .ows_fb40 + print_npc_text Text05ab + set_dialog_npc NPC_RONALD1 + print_npc_text Text05ac + set_dialog_npc NPC_ROD + print_npc_text Text05ad + set_dialog_npc NPC_RONALD1 + start_duel PRIZES_6, LEGENDARY_RONALD_DECK_ID, MUSIC_DUEL_THEME_3 + quit_script_fully + +.ows_fb40 + close_text_box + max_out_flag_value EVENT_FLAG_66 + open_menu + close_text_box + script_jump .ows_fb20 Script_LostToRonald1InPokemonDome: ; fb48 (3:7b48) - INCROM $fb48, $fb53 + start_script + print_npc_text Text05ae + close_advanced_text_box + set_next_npc_and_script NPC_ROD, Script_LostToCourtney.ows_f950 + end_script + ret Script_BeatRonald1InPokemonDome: ; fb53 (3:7b53) - INCROM $fb53, $fbdb + start_script + script_set_flag_value EVENT_FLAG_6C, $02 + print_npc_text Text05af + set_dialog_npc NPC_ROD + print_npc_text Text05b0 + print_text Text05b1 + set_dialog_npc NPC_RONALD1 + print_npc_text Text05b2 + close_text_box + move_active_npc NPCMovement_fbc7 + unload_active_npc + set_default_song MUSIC_HALL_OF_HONOR + play_default_song + close_advanced_text_box + set_next_npc_and_script NPC_ROD, .ows_fb76 + end_script + ret + +.ows_fb76 + start_script + move_active_npc NPCMovement_fba1 + set_player_direction NORTH + print_npc_text Text05b3 + move_active_npc NPCMovement_fbb2 + script_set_flag_value EVENT_FLAG_65, $02 + max_out_flag_value EVENT_FLAG_63 + record_master_win $0a + print_text_quit_fully Text05b4 + +NPCMovement_fb8c: ; fb8c (3:7b8c) + db EAST +NPCMovement_fb8d: ; fb8d (3:7b8d) + db SOUTH +NPCMovement_fb8e: ; fb8e (3:7b8e) + db SOUTH + db $ff + +NPCMovement_fb90: ; fb90 (3:7b90) + db NORTH + db NORTH + db WEST + db WEST + db SOUTH | NO_MOVE + db $ff + +NPCMovement_fb96: ; fb96 (3:7b96) + db NORTH + db NORTH + db WEST +NPCMovement_fb99: ; fb99 (3:7b99) + db SOUTH | NO_MOVE + db $ff + +NPCMovement_fb9b: ; fb9b (3:7b9b) + db NORTH | NO_MOVE + db $ff + +NPCMovement_fb9d: ; fb9d (3:7b9d) + db NORTH + db NORTH + db WEST + db WEST +NPCMovement_fba1: ; fba1 (3:7ba1) + db WEST + db SOUTH + db $ff + +NPCMovement_fba4: ; fba4 (3:7ba4) + db WEST + db WEST +NPCMovement_fba6: ; fba6 (3:7ba6) + db WEST + db SOUTH +NPCMovement_fba8: ; fba8 (3:7ba8) + db SOUTH + db SOUTH + db EAST + db SOUTH + db SOUTH + db WEST | NO_MOVE + db $ff + +NPCMovement_fbaf: ; fbaf (3:7baf) + db EAST + db $fe, -7 + +NPCMovement_fbb2: ; fbb2 (3:7bb2) + db NORTH + db EAST + db EAST + db SOUTH | NO_MOVE + db $ff + +NPCMovement_fbb7: ; fbb7 (3:7bb7) + db NORTH +NPCMovement_fbb8: ; fbb8 (3:7bb8) + db EAST + db EAST + db WEST | NO_MOVE + db $ff + +NPCMovement_fbbc: ; fbbc (3:7bbc) + db EAST + db EAST + db EAST + db EAST + db $fe, -26 + +NPCMovement_fbc2: ; fbc2 (3:7bc2) + db NORTH + db NORTH + db EAST + db WEST | NO_MOVE + db $ff + +NPCMovement_fbc7: ; fbc7 (3:7bc7) + db SOUTH + db SOUTH + db WEST + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db SOUTH + db $ff + +NPCMovement_fbd2: ; fbd2 (3:7bd2) + db WEST + db WEST + db WEST + db WEST + db WEST + db WEST + db WEST + db $fe, -12 HallOfHonorLoadMap: ; fbdb (3:7bdb) ld a, SFX_10 @@ -6648,7 +8745,15 @@ HallOfHonorLoadMap: ; fbdb (3:7bdb) ret Script_fbe1: ; fbe1 (3:7be1) - INCROM $fbe1, $fbf1 + start_script + print_text Text05b5 + ask_question_jump_default_yes Text05b6, .ows_fbee + print_text Text05b7 + quit_script_fully + +.ows_fbee + open_deck_machine $0a + quit_script_fully Script_fbf1: ; fbf1 (3:7bf1) start_script @@ -6751,11 +8856,11 @@ Func_fc7a: ; fc7a (3:7c7a) jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5 print_npc_text Text06cd gift_center $00 - jump_if_flag_not_less_than EVENT_FLAG_72, $04, Func_fc7a.ows_fcaa + jump_if_flag_not_less_than EVENT_FLAG_72, $04, .ows_fcaa print_npc_text Text06ce ask_question_jump_default_yes Text06cf, .ows_fca0 print_npc_text Text06d0 - script_jump Func_fc7a.ows_fcaa + script_jump .ows_fcaa .ows_fca0 save_game $00 -- cgit v1.2.3 From 5ca3f85df5cd0601f810797ee19a5086a0bf24c1 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 14:11:08 -0600 Subject: Fix script command 0x17 argument list --- src/engine/bank03.asm | 62 ++++++++++++++++++++++++++++++++++------------ src/engine/bank04.asm | 2 +- src/macros/scripts.asm | 9 ++++--- tools/script_extractor2.py | 2 +- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 489468f..b97d49f 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2421,7 +2421,7 @@ Data_d006: ; d006 (3:5006) db RAPIDASH db WEEZING -ScriptCommand_GetMan1RequestedCardNameText: ; d00b (3:500b) +ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot: ; d00b (3:500b) sla c ld b, $0 ld hl, wTxRam2 @@ -4359,27 +4359,57 @@ Script_Man1: ; dc76 (3:5c76) jump_if_flag_nonzero_2 EVENT_FLAG_29, .ows_dc91 max_out_flag_value EVENT_FLAG_29 pick_next_man1_requested_card - get_man1_requested_card_name_text - end_script -; 0xdc89 - - INCROM $dc89, $dc91 + load_man1_requested_card_into_txram_slot $00 + print_npc_text Text045b + max_out_flag_value EVENT_FLAG_2A + script_jump .ows_dca5 .ows_dc91 jump_if_flag_zero_2 EVENT_FLAG_2A, .ows_dc9d - get_man1_requested_card_name_text - end_script -; 0xdc97 - - INCROM $dc97, $dc9d + load_man1_requested_card_into_txram_slot $00 + print_npc_text Text045c + script_jump .ows_dca5 .ows_dc9d pick_next_man1_requested_card - get_man1_requested_card_name_text - end_script -; 0xdca0 - - INCROM $dca0, $dce5 + load_man1_requested_card_into_txram_slot $00 + print_npc_text Text045d + max_out_flag_value EVENT_FLAG_2A +.ows_dca5 + load_man1_requested_card_into_txram_slot $00 + ask_question_jump Text045e, .ows_dcaf + print_text_quit_fully Text045f + +.ows_dcaf + jump_if_man1_requested_card_owned .ows_dcb9 + load_man1_requested_card_into_txram_slot $00 + load_man1_requested_card_into_txram_slot $01 + print_text_quit_fully Text0460 + +.ows_dcb9 + jump_if_man1_requested_card_in_collection .ows_dcc3 + load_man1_requested_card_into_txram_slot $00 + load_man1_requested_card_into_txram_slot $01 + print_text_quit_fully Text0461 + +.ows_dcc3 + load_man1_requested_card_into_txram_slot $00 + load_man1_requested_card_into_txram_slot $01 + print_npc_text Text0462 + remove_man1_requested_card_from_collection + max_out_flag_value EVENT_FLAG_01 + zero_out_flag_value EVENT_FLAG_2A + increment_flag_value EVENT_FLAG_2C + jump_if_flag_equal EVENT_FLAG_2C, $05, .ows_dcd7 + quit_script_fully + +.ows_dcd7 + print_npc_text Text0463 + give_card PIKACHU4 + show_card_received_screen PIKACHU4 + print_npc_text Text0464 + script_set_flag_value EVENT_FLAG_2C, $06 + quit_script_fully .ows_dce5 print_text_quit_fully Text0465 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 04e1e85..4e92876 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1028,7 +1028,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_JumpBasedOnFightingClubPupilStatus dw ScriptCommand_SetActiveNPCDirection dw ScriptCommand_PickNextMan1RequestedCard - dw ScriptCommand_GetMan1RequestedCardNameText + dw ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot dw ScriptCommand_JumpIfMan1RequestedCardOwned dw ScriptCommand_JumpIfMan1RequestedCardInCollection dw ScriptCommand_RemoveMan1RequestedCardFromCollection diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 91ca3bb..25c2ae1 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -28,7 +28,7 @@ ENDM const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 const ScriptCommand_SetActiveNPCDirection_index ; $15 const ScriptCommand_PickNextMan1RequestedCard_index ; $16 - const ScriptCommand_GetMan1RequestedCardNameText_index ; $17 + const ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot_index ; $17 const ScriptCommand_JumpIfMan1RequestedCardOwned_index ; $18 const ScriptCommand_JumpIfMan1RequestedCardInCollection_index ; $19 const ScriptCommand_RemoveMan1RequestedCardFromCollection_index ; $1a @@ -265,9 +265,10 @@ pick_next_man1_requested_card: MACRO run_command ScriptCommand_PickNextMan1RequestedCard ENDM -; Loads the name text for the card gift requested by NPC_MAN1 -get_man1_requested_card_name_text: MACRO - run_command ScriptCommand_GetMan1RequestedCardNameText +; Loads into the given txram slot the name of the card gift requested by NPC_MAN1 +load_man1_requested_card_into_txram_slot: MACRO + run_command ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot + db \1 ; TxRam slot ENDM ; Jumps to the given script position if the player owns the card gift requested by NPC_MAN1 diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 1b7aaf7..912c16d 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -47,7 +47,7 @@ script_commands = { 0x14: { "name": "fight_club_pupil_jump", "params": [ "label", "label", "label", "label", "label" ] }, 0x15: { "name": "set_active_npc_direction", "params": [ "direction" ] }, 0x16: { "name": "pick_next_man1_requested_card", "params": [] }, - 0x17: { "name": "get_man1_requested_card_name_text", "params": [] }, + 0x17: { "name": "load_man1_requested_card_into_txram_slot", "params": [ "byte" ] }, 0x18: { "name": "jump_if_man1_requested_card_owned", "params": [ "label" ] }, 0x19: { "name": "jump_if_man1_requested_card_in_collection", "params": [ "label" ] }, 0x1a: { "name": "remove_man1_requested_card_from_collection", "params": [] }, -- cgit v1.2.3 From 953f8d2e7a04846e5ce7a63c06b06476b6c5610e Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 14:20:28 -0600 Subject: Rename move_wram_npc to move_challenge_hall_npc --- src/engine/bank03.asm | 16 ++++++++-------- src/engine/bank04.asm | 2 +- src/macros/scripts.asm | 8 ++++---- tools/script_extractor2.py | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index b97d49f..14220b5 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2116,9 +2116,9 @@ ScriptCommand_MoveActiveNPC: ; ce4a (3:4e4a) ld [wLoadedNPCTempIndex], a jr ExecuteNPCMovement -; Begin a series of NPC movements on an arbitrary NPC +; Begin a series of NPC movements on the Challenge Hall opponent NPC ; based on the series of directions pointed to by bc -ScriptCommand_MoveWramNPC: ; ce52 (3:4e52) +ScriptCommand_MoveChallengeHallNPC: ; ce52 (3:4e52) ld a, [wLoadedNPCTempIndex] push af ld a, [wTempNPC] @@ -7791,13 +7791,13 @@ Script_WonAtChallengeHall: ; f441 (3:7441) load_active_npc_name_into_txram_slot $00 print_npc_text Text053e close_text_box - move_wram_npc NPCMovement_f4c8 + move_challenge_hall_npc NPCMovement_f4c8 unload_challenge_hall_npc print_npc_text Text053f close_text_box pick_challenge_hall_opponent set_challenge_hall_npc_coords 20, 20 - move_wram_npc NPCMovement_f4d0 + move_challenge_hall_npc NPCMovement_f4d0 load_active_npc_name_into_txram_slot $00 jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_npc_text Text0540, Text0541 @@ -7865,18 +7865,18 @@ Script_f4db: ; f4db (3:74db) set_dialog_npc NPC_RONALD1 jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_npc_text Text054c, Text054d - move_wram_npc NPCMovement_f4d8 + move_challenge_hall_npc NPCMovement_f4d8 do_frames 40 - move_wram_npc NPCMovement_f34c + move_challenge_hall_npc NPCMovement_f34c jump_if_flag_equal EVENT_FLAG_44, $01, NULL print_variable_npc_text Text054e, Text054f set_dialog_npc NPC_HOST close_text_box - move_wram_npc NPCMovement_f4c9 + move_challenge_hall_npc NPCMovement_f4c9 script_jump .ows_f516 .ows_f513 - move_wram_npc NPCMovement_f4c8 + move_challenge_hall_npc NPCMovement_f4c8 .ows_f516 unload_challenge_hall_npc move_active_npc NPCMovement_f383 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 4e92876..bb4340e 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -1052,7 +1052,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_LoadActiveNPCNameIntoTxRamSlot dw ScriptCommand_StartChallengeHallDuel dw ScriptCommand_PrintTextForChallengeCup - dw ScriptCommand_MoveWramNPC + dw ScriptCommand_MoveChallengeHallNPC dw ScriptCommand_UnloadChallengeHallNPC dw ScriptCommand_SetChallengeHallNPCCoords dw ScriptCommand_PickChallengeHallOpponent diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 25c2ae1..828d5d4 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -52,7 +52,7 @@ ENDM const ScriptCommand_LoadActiveNPCNameIntoTxRamSlot_index ; $2c const ScriptCommand_StartChallengeHallDuel_index ; $2d const ScriptCommand_PrintTextForChallengeCup_index ; $2e - const ScriptCommand_MoveWramNPC_index ; $2f + const ScriptCommand_MoveChallengeHallNPC_index ; $2f const ScriptCommand_UnloadChallengeHallNPC_index ; $30 const ScriptCommand_SetChallengeHallNPCCoords_index ; $31 const ScriptCommand_PickChallengeHallOpponent_index ; $32 @@ -421,9 +421,9 @@ print_text_for_challenge_cup: MACRO tx \3 ; Text Pointer for Challenge Cup #3 ENDM -; Moves the NPC in wTempNPC using an NPCMovement -move_wram_npc: MACRO - run_command ScriptCommand_MoveWramNPC +; Moves the Challenge Hall opponent NPC using an NPCMovement +move_challenge_hall_npc: MACRO + run_command ScriptCommand_MoveChallengeHallNPC dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index 912c16d..db9dd3c 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -71,7 +71,7 @@ script_commands = { 0x2c: { "name": "load_active_npc_name_into_txram_slot", "params": [ "byte" ] }, 0x2d: { "name": "start_challenge_hall_duel", "params": [ "prizes", "deck", "song" ] }, 0x2e: { "name": "print_text_for_challenge_cup", "params": [ "text", "text", "text" ] }, - 0x2f: { "name": "move_wram_npc", "params": [ "movement" ] }, + 0x2f: { "name": "move_challenge_hall_npc", "params": [ "movement" ] }, 0x30: { "name": "unload_challenge_hall_npc", "params": [] }, 0x31: { "name": "set_challenge_hall_npc_coords", "params": [ "byte_decimal", "byte_decimal" ] }, 0x32: { "name": "pick_challenge_hall_opponent", "params": [] }, -- cgit v1.2.3 From 946b425cf46f350f01066e1d71021b8595cfac18 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 16:17:41 -0600 Subject: Disassemble remaining map events and npc preload routines --- src/constants/script_constants.asm | 2 +- src/engine/bank03.asm | 366 ++++++++++++++++++++++++++++++++----- tools/constants.py | 2 +- 3 files changed, 323 insertions(+), 47 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index d5b05ee..9734f67 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -59,7 +59,7 @@ const EVENT_FLAG_39 ; $39 const EVENT_FLAG_3A ; $3a const EVENT_FLAG_3B ; $3b - const FLAG_BEAT_BRITTANY ; $3c + const EVENT_BEAT_BRITTANY ; $3c const EVENT_FLAG_3D ; $3d const EVENT_FLAG_3E ; $3e const EVENT_FLAG_3F ; $3f diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 14220b5..80686ca 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -1677,7 +1677,7 @@ EventFlagMods: ; cb37 (3:4b37) flag_def $0c, %00000001 ; EVENT_FLAG_39 flag_def $0d, %10000000 ; EVENT_FLAG_3A flag_def $0d, %01000000 ; EVENT_FLAG_3B - flag_def $0d, %00100000 ; FLAG_BEAT_BRITTANY + flag_def $0d, %00100000 ; EVENT_BEAT_BRITTANY flag_def $0d, %00010000 ; EVENT_FLAG_3D flag_def $0d, %00001110 ; EVENT_FLAG_3E flag_def $0e, %11100000 ; EVENT_FLAG_3F @@ -2071,7 +2071,7 @@ ScriptCommand_SetChallengeHallNPCCoords: ; cdf5 (3:4df5) ld [wLoadNPCXPos], a ld a, b ld [wLoadNPCYPos], a - ld a, $2 + ld a, SOUTH ld [wLoadNPCDirection], a ld a, [wTempNPC] farcall LoadNPCSpriteData @@ -3546,7 +3546,17 @@ Func_d703: ; d703 (3:5703) ret Preload_DrMason: ; d710 (3:5710) - INCROM $d710, $d727 + call Func_d703 + get_flag_value EVENT_FLAG_3E + cp $01 + jr nz, .asm_d725 + ld a, $06 + ld [wLoadNPCXPos], a + ld a, $0c + ld [wLoadNPCYPos], a +.asm_d725 + scf + ret Script_DrMason: ; d727 (3:5727) start_script @@ -3782,7 +3792,15 @@ DeckMachineRoomAfterDuel: ; d89f (3:589f) db $00 DeckMachineRoomCloseTextBox: ; d8ad (3:58ad) - INCROM $d8ad, $d8bb + ld a, $02 +.asm_d8af + push af + farcall Func_80b89 + pop af + inc a + cp $0a + jr c, .asm_d8af + ret Script_Tech6: ; d8bb (3:58bb) start_script @@ -4418,7 +4436,24 @@ Script_Man1: ; dc76 (3:5c76) print_text_quit_fully Text0466 Preload_ImakuniInFightingClubLobby: ; dceb (3:5ceb) - INCROM $dceb, $dd0d + get_flag_value EVENT_IMAKUNI_STATE + cp IMAKUNI_MENTIONED + jr z, .asm_dd06 + or a + jr z, .asm_dd04 + get_flag_value EVENT_TEMP_DUELED_IMAKUNI + jr nz, .asm_dd04 + get_flag_value EVENT_IMAKUNI_ROOM + cp IMAKUNI_FIGHTING_CLUB + jr z, .asm_dd06 +.asm_dd04 + or a + ret +.asm_dd06 + ld a, MUSIC_IMAKUNI + ld [wd111], a + scf + ret Script_Imakuni: ; dd0d (3:5d0d) start_script @@ -4504,7 +4539,9 @@ Script_Butch: ; dd8d (3:5d8d) quit_script_fully Preload_Granny1: ; dd98 (3:5d98) - INCROM $dd98, $dd9f + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + cp $01 + ret Script_Granny1: ; dd9f (3:5d9f) start_script @@ -4609,7 +4646,10 @@ Script_Mitch_PrintTrainHarderText: ; de40 (3:5e40) print_text_quit_fully Text0488 Preload_ChrisInFightingClub: ; de43 (3:5e43) - INCROM $de43, $de4b + get_flag_value EVENT_FLAG_17 + cp $08 + ccf + ret Script_de4b: ; de4b (3:5e4b) jump_if_flag_equal EVENT_FLAG_17, $08, NULL @@ -4636,7 +4676,10 @@ Script_LostToChrisInFightingClub: ; de75 (3:5e75) print_text_quit_fully Text0490 Preload_MichaelInFightingClub: ; de79 (3:5e79) - INCROM $de79, $de81 + get_flag_value EVENT_FLAG_11 + cp $08 + ccf + ret Script_de81: ; de81 (3:5e81) print_npc_text Text0491 @@ -4661,7 +4704,10 @@ Script_LostToMichaelInFightingClub: ; dea1 (3:5ea1) print_text_quit_fully Text0497 Preload_JessicaInFightingClub: ; dea5 (3:5ea5) - INCROM $dea5, $dead + get_flag_value EVENT_FLAG_20 + cp $08 + ccf + ret Script_dead: ; dead (3:5ead) print_npc_text Text0498 @@ -4707,7 +4753,11 @@ RockClubLobbyAfterDuel: ; ded5 (3:5ed5) db $00 Preload_ChrisInRockClubLobby: ; dee9 (3:5ee9) - INCROM $dee9, $def2 + get_flag_value EVENT_FLAG_17 + or a + ret z + cp $08 + ret Script_Chris: ; def2 (3:5ef2) start_script @@ -4834,7 +4884,9 @@ Script_Chap1: ; dfc0 (3:5fc0) quit_script_fully Preload_Lass3: ; dfcb (3:5fcb) - INCROM $dfcb, $dfd2 + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + cp $01 + ret Script_Lass3: ; dfd2 (3:5fd2) start_script @@ -4992,7 +5044,7 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) or a ret .asm_e0c8 - ld a, $10 + ld a, MUSIC_IMAKUNI ld [wd111], a scf ret @@ -5398,7 +5450,22 @@ LightningClubLobbyAfterDuel: ; e36d (3:636d) db $00 Preload_ImakuniInLightningClubLobby: ; e37b (3:637b) - INCROM $e37b, $e39a + get_flag_value EVENT_IMAKUNI_STATE + cp IMAKUNI_TALKED + jr c, .asm_e391 + get_flag_value EVENT_TEMP_DUELED_IMAKUNI + jr nz, .asm_e391 + get_flag_value EVENT_IMAKUNI_ROOM + cp IMAKUNI_LIGHTNING_CLUB + jr z, .asm_e393 +.asm_e391 + or a + ret +.asm_e393 + ld a, MUSIC_IMAKUNI + ld [wd111], a + scf + ret Script_Chap2: ; e39a (3:639a) start_script @@ -5552,7 +5619,17 @@ Script_LostToBrandon: ; e490 (3:6490) print_text_quit_fully Text0631 Preload_Isaac: ; e494 (3:6494) - INCROM $e494, $e4ad + get_flag_value EVENT_FLAG_25 + jr z, .asm_e4ab + get_flag_value EVENT_FLAG_26 + jr z, .asm_e4ab + get_flag_value EVENT_FLAG_27 + jr z, .asm_e4ab + ld a, SOUTH + ld [wLoadNPCDirection], a +.asm_e4ab + scf + ret Script_Isaac: ; e4ad (3:64ad) start_script @@ -5674,7 +5751,11 @@ Script_Clerk5: ; e566 (3:6566) print_text_quit_fully Text06d7 Preload_MichaelInGrassClubEntrance: ; e56a (3:656a) - INCROM $e56a, $e573 + get_flag_value EVENT_FLAG_11 + or a + ret z + cp $08 + ret Script_Michael: ; e573 (3:6573) start_script @@ -5759,7 +5840,7 @@ Script_BeatBrittany: ; e5ee (3:65ee) give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER jump_if_flag_less_than EVENT_FLAG_35, $02, NULL print_variable_npc_text Text06e6, Text06e7 - max_out_flag_value FLAG_BEAT_BRITTANY + max_out_flag_value EVENT_BEAT_BRITTANY jump_if_flag_not_less_than EVENT_FLAG_35, $02, .quit jump_if_flag_zero_2 EVENT_FLAG_3A, .quit jump_if_flag_zero_2 EVENT_FLAG_3B, .quit @@ -5861,7 +5942,9 @@ Script_Granny2: ; e6d8 (3:66d8) print_text_quit_fully Text0702 Preload_Gal2: ; e6dc (3:66dc) - INCROM $e6dc, $e6e3 + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + cp $01 + ret Script_Gal2: ; e6e3 (3:66e3) start_script @@ -5909,7 +5992,7 @@ Script_BeatKristin: ; e71c (3:671c) print_npc_text Text070a max_out_flag_value EVENT_FLAG_3A jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e740 - jump_if_flag_zero_2 FLAG_BEAT_BRITTANY, .ows_e740 + jump_if_flag_zero_2 EVENT_BEAT_BRITTANY, .ows_e740 jump_if_flag_zero_2 EVENT_FLAG_3B, .ows_e740 script_set_flag_value EVENT_FLAG_35, $01 max_out_flag_value EVENT_FLAG_1E @@ -5941,7 +6024,7 @@ Script_BeatHeather: ; e760 (3:6760) print_npc_text Text0714 max_out_flag_value EVENT_FLAG_3B jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e789 - jump_if_flag_zero_2 FLAG_BEAT_BRITTANY, .ows_e789 + jump_if_flag_zero_2 EVENT_BEAT_BRITTANY, .ows_e789 jump_if_flag_zero_2 EVENT_FLAG_3A, .ows_e789 script_set_flag_value EVENT_FLAG_35, $01 max_out_flag_value EVENT_FLAG_1E @@ -5956,7 +6039,10 @@ Script_LostToHeather: ; e78a (3:678a) quit_script_fully Preload_NikkiInGrassClub: ; e796 (3:6796) - INCROM $e796, $e79e + get_flag_value EVENT_FLAG_35 + cp $02 + ccf + ret Script_Nikki: ; e79e (3:679e) ld a, [wCurMap] @@ -6066,7 +6152,9 @@ Script_Lad3: ; e850 (3:6850) quit_script_fully Preload_Ronald1InClubEntrance: ; e85b (3:685b) - INCROM $e85b, $e862 + get_flag_value EVENT_FLAG_4B + cp $01 + ret Script_FirstRonaldEncounter: ; e862 (3:6862) start_script @@ -6103,7 +6191,28 @@ NPCMovement_e894: ; e894 (3:6894) db $ff Preload_Ronald2InClubEntrance: ; e89a (3:689a) - INCROM $e89a, $e8c0 + get_flag_value EVENT_FLAG_4C + ld e, $02 +Func_e8a0: ; e8a0 (3:68a0) + cp $01 + jr z, .asm_e8b4 + cp $02 + jr nc, .asm_e8b2 + call TryGiveMedalPCPacks + get_flag_value EVENT_MEDAL_COUNT + cp e + jr z, .asm_e8be +.asm_e8b2 + or a + ret +.asm_e8b4 + ld a, $08 + ld [wLoadNPCXPos], a + ld a, $08 + ld [wLoadNPCYPos], a +.asm_e8be + scf + ret Script_FirstRonaldFight: ; e8c0 (3:68c0) start_script @@ -6165,7 +6274,9 @@ NPCMovement_e90f: ; e90f (3:690f) db $ff Preload_Ronald3InClubEntrance: ; e915 (3:6915) - INCROM $e915, $e91e + get_flag_value EVENT_FLAG_4D + ld e, $05 + jp Func_e8a0 Script_SecondRonaldFight: ; e91e (3:691e) start_script @@ -6217,7 +6328,12 @@ PsychicClubLobbyAfterDuel: ; e963 (3:6963) db $00 PsychicClubLobbyLoadMap: ; e971 (3:6971) - INCROM $e971, $e980 + ld a, NPC_RONALD1 + ld [wTempNPC], a + call FindLoadedNPC + ret c + ld bc, Script_ea02 + jp SetNextNPCAndScript Script_Robert: ; e980 (3:6980) start_script @@ -6269,12 +6385,27 @@ Script_Pappy1: ; e9a5 (3:69a5) .ows_e9de print_text_quit_fully Text0663 -; 0xe9e1 - INCROM $e9e1, $e9f7 +Func_e9e1: ; e9e1 (3:69e1) + call TryGiveMedalPCPacks + get_flag_value EVENT_MEDAL_COUNT + cp $04 + jr nz, .asm_e9f5 + get_flag_value EVENT_FLAG_32 + or a + jr nz, .asm_e9f5 + scf + ret +.asm_e9f5 + or a + ret Preload_Ronald1InPsychicClubLobby: ; e9f7 (3:69f7) - INCROM $e9f7, $ea02 + call Func_e9e1 + ret nc + ld a, [wPlayerYCoord] + ld [wLoadNPCYPos], a + ret Script_ea02: ; ea02 (3:6a02) start_script @@ -6412,10 +6543,15 @@ Script_LostToStephanie: ; eacc (3:6acc) print_text_quit_fully Text067a Preload_Murray2: ; ead0 (3:6ad0) - INCROM $ead0, $eada + call TryGiveMedalPCPacks + get_flag_value EVENT_MEDAL_COUNT + cp $04 + ret Preload_Murray1: ; eada (3:6ada) - INCROM $eada, $eadf + call Preload_Murray2 + ccf + ret Script_Murray: ; eadf (3:6adf) start_script @@ -6495,7 +6631,22 @@ ScienceClubLobbyAfterDuel:; eb57 (3:6b57) db $00 Preload_ImakuniInScienceClubLobby: ; eb65 (3:6b65) - INCROM $eb65, $eb84 + get_flag_value EVENT_IMAKUNI_STATE + cp IMAKUNI_TALKED + jr c, .asm_eb7b + get_flag_value EVENT_TEMP_DUELED_IMAKUNI + jr nz, .asm_eb7b + get_flag_value EVENT_IMAKUNI_ROOM + cp IMAKUNI_SCIENCE_CLUB + jr z, .asm_eb7d +.asm_eb7b + or a + ret +.asm_eb7d + ld a, MUSIC_IMAKUNI + ld [wd111], a + scf + ret Script_Lad1: ; eb84 (3:6b84) start_script @@ -6695,7 +6846,18 @@ Script_LostToRick: ; ec9a (3:6c9a) print_text_quit_fully Text076b Preload_Joseph: ; ecc4 (3:6cc4) - INCROM $ecc4, $ecdb + ld a, EVENT_FLAG_1B + call GetEventFlagValue + or a + jr z, .asm_ecd9 + ld a, [wLoadNPCXPos] + add $02 + ld [wLoadNPCXPos], a + ld a, $03 + ld [wLoadNPCDirection], a +.asm_ecd9 + scf + ret Script_Joseph: ; ecdb (3:6cdb) start_script @@ -6821,7 +6983,11 @@ FindExtraInteractableObjects: ; ed64 (3:6d64) ret Preload_JessicaInFireClubLobby: ; ed8d (3:6d8d) - INCROM $ed8d, $ed96 + get_flag_value EVENT_FLAG_20 + or a + ret z + cp $08 + ret Script_Jessica: ; ed96 (3:6d96) start_script @@ -6909,7 +7075,9 @@ Script_Chap3: ; ede8 (3:6de8) print_text_quit_fully Text069a Preload_Lad2: ; ee25 (3:6e25) - INCROM $ee25, $ee2c + get_flag_value EVENT_FLAG_21 + cp $01 + ret Script_Lad2: ; ee2c (3:6e2c) start_script @@ -7204,7 +7372,7 @@ Preload_Clerk9: ; ef96 (3:6f96) .asm_f016 set_flag_value EVENT_FLAG_44 max_flag_value EVENT_FLAG_42 - ld a, $0b + ld a, MUSIC_CHALLENGE_HALL ld [wd111], a .asm_f023 scf @@ -7249,7 +7417,7 @@ Preload_ChallengeHallNPCs1: ; f07a (3:707a) get_flag_value EVENT_FLAG_42 or a jr z, .quit - ld a, $0b + ld a, MUSIC_CHALLENGE_HALL ld [wd111], a scf .quit @@ -8012,10 +8180,22 @@ Func_f602: ; f602 (3:7602) INCROM $f602, $f607 PokemonDomeEntranceLoadMap: ; f607 (3:7607) - INCROM $f607, $f62a + zero_flag_value EVENT_FLAG_63 + zero_flag_value2 EVENT_FLAG_65 + zero_flag_value2 EVENT_FLAG_68 + zero_flag_value2 EVENT_FLAG_69 + zero_flag_value2 EVENT_FLAG_6A + zero_flag_value2 EVENT_FLAG_6B + get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + or a + ret nz + zero_flag_value2 EVENT_FLAG_6C + ret PokemonDomeEntranceCloseTextBox: ; f62a (3:762a) - INCROM $f62a, $f631 + ld a, $00 + farcall Func_80b89 + ret Script_f631: ; f631 (3:7631) start_script @@ -8111,7 +8291,18 @@ Script_f6af: ; f6af (3:76af) quit_script_fully PokemonDomeMovePlayer: ; f6c6 (3:76c6) - INCROM $f6c6, $f6e0 + ld a, [wPlayerYCoord] + cp $16 + ret nz + ld a, [wPlayerXCoord] + cp $0e + ret c + cp $11 + ret nc + ld a, NPC_ROD + ld [wTempNPC], a + ld bc, Script_f84c + jp SetNextNPCAndScript PokemonDomeAfterDuel: ; f6e0 (3:76e0) ld hl, .after_duel_table @@ -8146,10 +8337,18 @@ PokemonDomeAfterDuel: ; f6e0 (3:76e0) db $00 PokemonDomeLoadMap: ; f706 (3:7706) - INCROM $f706, $f718 + ld a, $0d + farcall TryGivePCPack + get_flag_value EVENT_FLAG_66 + or a + ret z + ld bc, Script_f80b + jp SetNextScript PokemonDomeCloseTextBox: ; f718 (3:7718) - INCROM $f718, $f71f + ld a, $01 + farcall Func_80b89 + ret Script_Courtney: ; f71f (3:771f) start_script @@ -8176,19 +8375,96 @@ Script_Rod: ; f740 (3:7740) quit_script_fully Preload_Courtney: ; f74b (3:774b) - INCROM $f74b, $f78c + get_flag_value EVENT_FLAG_68 + cp $01 + jr z, Func_f76c + lb bc, $16, $0c + cp $02 + jr z, Func_f77d + get_flag_value EVENT_FLAG_64 + jr nz, Func_f762 + scf + ret + +Func_f762: ; f762 (3:7762) + ld a, [wLoadNPCYPos] + add $02 + ld [wLoadNPCYPos], a + scf + ret + +Func_f76c: ; f76c (3:776c) + ld a, $12 + ld [wLoadNPCXPos], a + ld a, $0e + ld [wLoadNPCYPos], a + ld a, WEST + ld [wLoadNPCDirection], a + scf + ret + +Func_f77d: ; f77d (3:777d) + ld a, WEST + ld [wLoadNPCDirection], a +Func_f782: ; f782 (3:7782) + ld a, b + ld [wLoadNPCXPos], a + ld a, c + ld [wLoadNPCYPos], a + scf + ret Preload_Steve: ; f78c (3:778c) - INCROM $f78c, $f7a3 + get_flag_value EVENT_FLAG_69 + cp $01 + jr z, Func_f76c + lb bc, $16, $0e + cp $02 + jr z, Func_f77d + get_flag_value EVENT_FLAG_64 + jr nz, Func_f762 + scf + ret Preload_Jack: ; f7a3 (3:77a3) - INCROM $f7a3, $f7ba + get_flag_value EVENT_FLAG_6A + cp $01 + jr z, Func_f76c + lb bc, $14, $0a + cp $02 + jr z, Func_f77d + get_flag_value EVENT_FLAG_64 + jr nz, Func_f762 + scf + ret Preload_Rod: ; f7ba (3:77ba) - INCROM $f7ba, $f7d6 + get_flag_value EVENT_FLAG_6B + cp $01 + jr z, Func_f76c + get_flag_value EVENT_FLAG_65 + lb bc, $10, $0a + cp $02 + jr z, Func_f782 + lb bc, $0e, $0a + cp $01 + jr z, Func_f782 + scf + ret Preload_Ronald1InPokemonDome: ; f7d6 (3:77d6) - INCROM $f7d6, $f7ed + get_flag_value EVENT_FLAG_6C + cp $02 + ret nc + get_flag_value EVENT_FLAG_6C + or a + jr z, .asm_f7eb + ld a, MUSIC_RONALD + ld [wd111], a + jr Func_f76c +.asm_f7eb + scf + ret Script_f7ed: ; f7ed (3:77ed) jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_f7f9 diff --git a/tools/constants.py b/tools/constants.py index a891d96..d50f5a4 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -389,7 +389,7 @@ events = [ "EVENT_FLAG_39", "EVENT_FLAG_3A", "EVENT_FLAG_3B", - "FLAG_BEAT_BRITTANY", + "EVENT_BEAT_BRITTANY", "EVENT_FLAG_3D", "EVENT_FLAG_3E", "EVENT_FLAG_3F", -- cgit v1.2.3 From 6ffa0b342a053bc3e78ca126c44edf89f9a622ec Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sat, 16 Jan 2021 16:40:34 -0600 Subject: Disassemble the rest of bank 3 --- src/engine/bank02.asm | 8 +- src/engine/bank03.asm | 191 +++++++++++++++++++++++++++++++++++++++++----- src/engine/bank04.asm | 15 +++- src/text/text3.asm | 2 +- src/text/text_offsets.asm | 2 +- 5 files changed, 193 insertions(+), 25 deletions(-) diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index c72af73..01e8872 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -2718,7 +2718,13 @@ Func_9e41: ; 9e41 (2:5e41) INCROM $9e41, $a288 Func_a288: ; a288 (2:6288) - INCROM $a288, $adfe + INCROM $a288, $a913 + +Func_a913: ; a913 (2:6913) + INCROM $a913, $ad51 + +Func_ad51: ; ad51 (2:6d51) + INCROM $ad51, $adfe Func_adfe: ; adfe (2:6dfe) INCROM $adfe, $b177 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 80686ca..b336d52 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -319,7 +319,7 @@ asm_c25d: ret Func_c268: ; c268 (3:4268) - ld hl, Unknown_c27c + ld hl, PauseMenuTextList .asm_c26b push hl ld a, [hli] @@ -336,8 +336,9 @@ Func_c268: ; c268 (3:4268) pop hl ret -Unknown_c27c: ; c27c (3:427c) - INCROM $c27c, $c280 +PauseMenuTextList: ; c27c (3:427c) + tx PauseMenuOptionsText + dw NULL Func_c280: ; c280 (3:4280) call Func_c228 @@ -466,18 +467,121 @@ Func_c36a: ; c36a (3:436a) ld [wd324], a .asm_c379 ret -; 0xc37a - INCROM $c37a, $c38f +Func_c37a: ; c37a (3:437a) + push hl + push bc + ld hl, wBoosterViableCardList + push hl + ld a, $80 + ld c, $00 +.asm_c384 + ld [hli], a + dec c + jr nz, .asm_c384 + pop hl + call Func_c38f + pop bc + pop hl + ret Func_c38f: ; c38f (3:438f) - INCROM $c38f, $c3ca + push hl + push bc + ld a, [wd23a] + ld e, a + ld a, [wd23b] + ld d, a + or e + jr z, .asm_c3c7 + push hl + ld b, $c0 + call Func_08bf + ld a, [wd23d] + ld [wTempPointerBank], a + ld a, [wd130] + inc a + srl a + ld b, a + ld a, [wd12f] + inc a + srl a + ld c, a + pop de +.asm_c3b7 + push bc + ld b, $00 + call Func_3be4 + ld hl, $10 + add hl, de + ld d, h + ld e, l + pop bc + dec b + jr nz, .asm_c3b7 +.asm_c3c7 + pop bc + pop hl + ret Func_c3ca: ; c3ca (3:43ca) - INCROM $c3ca, $c3ee + push hl + push bc + push de + push bc + push de + pop bc + call GetPermissionByteOfMapPosition + pop bc + srl b + srl c + ld de, $10 +.asm_c3db + push bc + push hl +.asm_c3dd + ld a, [hl] + or $10 + ld [hli], a + dec b + jr nz, .asm_c3dd + pop hl + add hl, de + pop bc + dec c + jr nz, .asm_c3db + pop de + pop bc + pop hl + ret Func_c3ee: ; c3ee (3:43ee) - INCROM $c3ee, $c41c + push hl + push bc + ld c, $00 + ld hl, wBoosterViableCardList +.asm_c3f5 + ld a, [hl] + and $ef + ld [hli], a + dec c + jr nz, .asm_c3f5 + pop bc + pop hl + ret + +Func_c3ff: ; c3ff (3:43ff) + ld a, [wd12f] + sub $14 + ld [wd237], a + ld a, [wd130] + sub $12 + ld [wd238], a + call Func_c41c + call Func_c469 + call SetScreenScrollWram + call SetScreenScroll + ret Func_c41c: ; c41c (3:441c) ld a, [wd332] @@ -1120,19 +1224,40 @@ PointerTable_c846: ; c846 (3:4846) dw Func_c877 Func_c84e: ; c84e (3:484e) - INCROM $c84e, $c859 + ld a, [wd0b9] + ld hl, Unknown_10da9 + farcall Func_111e9 + ret Func_c859: ; c859 (3:4859) - INCROM $c859, $c86d + xor a + ldh [hSCX], a + ldh [hSCY], a + call Set_OBJ_8x16 + farcall Func_1288c + farcall Func_a913 + call Set_OBJ_8x8 + ret Func_c86d: ; c86d (3:486d) - INCROM $c86d, $c872 + farcall Func_1076d + ret Func_c872: ; c872 (3:4872) - INCROM $c872, $c877 + farcall Func_1052f + ret Func_c877: ; c877 (3:4877) - INCROM $c877, $c891 + xor a + ldh [hSCX], a + ldh [hSCY], a + call Set_OBJ_8x16 + farcall Func_1288c + farcall Func_ad51 + call Set_OBJ_8x8 + call WhiteOutDMGPals + call DoFrameIfLCDEnabled + ret Func_c891: ; c891 (3:4891) push hl @@ -3054,7 +3179,8 @@ ScriptCommand_GiveStarterDeck: ; d3d4 (3:53d4) bank1call Func_7576 jp IncreaseScriptPointerBy1 - INCROM $d3dd, $d3e0 +Unknown_d3dd: ; d3dd (3:53dd) + db $03, $05, $07 ScriptCommand_WalkPlayerToMasonLaboratory: ; d3e0 (3:53e0) ld a, $1 @@ -8160,10 +8286,19 @@ ChallengeHallNPCs: ; f5b3 (3:75b3) ChallengeHallNPCsEnd: Func_f5cc: ; f5cc (3:75cc) - INCROM $f5cc, $f5d4 + call Func_f5e9 + ld a, [hl] + and b + ret z + scf + ret Func_f5d4: ; f5d4 (3:75d4) - INCROM $f5d4, $f5db + call Func_f5e9 + ld a, [hl] + or b + ld [hl], a + ret Func_f5db: ; f5db (3:75db) xor a @@ -8172,12 +8307,30 @@ Func_f5db: ; f5db (3:75db) ld [wd69a], a ld [wd69b], a ret -; 0xf5e9 - INCROM $f5e9, $f602 +Func_f5e9: ; f5e9 (3:75e9) + ld hl, wd698 + ld a, c +.asm_f5ed + cp $08 + jr c, .asm_f5f6 + sub $08 + inc hl + jr .asm_f5ed +.asm_f5f6 + ld b, $80 + jr .asm_f5fd +.asm_f5fa + srl b + dec a +.asm_f5fd + cp $00 + jr nz, .asm_f5fa + ret Func_f602: ; f602 (3:7602) - INCROM $f602, $f607 + zero_flag_value EVENT_FLAG_46 + ret PokemonDomeEntranceLoadMap: ; f607 (3:7607) zero_flag_value EVENT_FLAG_63 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index bb4340e..be5f987 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -253,13 +253,19 @@ Unknown_10456: ; 10456 (4:4456) INCROM $10456, $1045b Unknown_1045b: ; 1045b (4:445b) - INCROM $1045b, $10548 + INCROM $1045b, $1052f + +Func_1052f: ; 1052f (4:452f) + INCROM $1052f, $10548 Func_10548: ; 10548 (4:4548) INCROM $10548, $10756 Func_10756: ; 10756 (4:4756) - INCROM $10756, $10a70 + INCROM $10756, $1076d + +Func_1076d: ; 1076d (4:476d) + INCROM $1076d, $10a70 ; gives the pc pack described in a TryGivePCPack: ; 10a70 (4:4a70) @@ -340,7 +346,10 @@ Func_10cea: ; 10cea (4:4cea) INCROM $10cea, $10d98 Unknown_10d98: ; 10d98 (4:4d98) - INCROM $10d98, $10dba + INCROM $10d98, $10da9 + +Unknown_10da9: ; 10da9 (4:4da9) + INCROM $10da9, $10dba Func_10dba: ; 10dba (4:4dba) ld a, $1 diff --git a/src/text/text3.asm b/src/text/text3.asm index e7dadf6..ac0adb1 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -1046,7 +1046,7 @@ Text033c: ; 3e804 (f:6804) text "??'s House" done -Text033d: ; 3e810 (f:6810) +PauseMenuOptionsText: ; 3e810 (f:6810) text "Status" line "Diary" line "Deck" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 50838e6..c72a57e 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -830,7 +830,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer ChallengeHallMapNameText ; 0x033a textpointer PokemonDomeMapNameText ; 0x033b textpointer Text033c ; 0x033c - textpointer Text033d ; 0x033d + textpointer PauseMenuOptionsText ; 0x033d textpointer Text033e ; 0x033e textpointer PlayerStatusNameText ; 0x033f textpointer PlayerStatusAlbumText ; 0x0340 -- cgit v1.2.3 From 3ced01a4b5b9fb96ca568cd078051a916a950dfa Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Sun, 17 Jan 2021 23:22:11 -0600 Subject: Improve some labels in bank 3 --- src/constants/misc_constants.asm | 5 + src/constants/script_constants.asm | 2 - src/data/map_objects.asm | 22 +- src/engine/bank03.asm | 679 +++++++++++++++++++------------------ src/engine/bank04.asm | 4 +- src/engine/home.asm | 52 +-- src/macros/scripts.asm | 14 +- src/text/text3.asm | 28 +- src/text/text_offsets.asm | 28 +- tools/script_extractor2.py | 2 +- 10 files changed, 423 insertions(+), 413 deletions(-) diff --git a/src/constants/misc_constants.asm b/src/constants/misc_constants.asm index 47b9bf6..45d8bf2 100644 --- a/src/constants/misc_constants.asm +++ b/src/constants/misc_constants.asm @@ -49,3 +49,8 @@ OWMODE_MAP EQU 0 OWMODE_MOVE EQU 1 OWMODE_START_SCRIPT EQU 2 OWMODE_SCRIPT EQU 3 + +NULL EQU $0000 + +FALSE EQU 0 +TRUE EQU 1 diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index 9734f67..ba5301c 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -138,8 +138,6 @@ IMAKUNI_SCIENCE_CLUB EQU 1 IMAKUNI_LIGHTNING_CLUB EQU 2 IMAKUNI_WATER_CLUB EQU 3 -NULL EQU $0000 - NORTH EQU $00 EAST EQU $01 SOUTH EQU $02 diff --git a/src/data/map_objects.asm b/src/data/map_objects.asm index 046c20f..34e2def 100644 --- a/src/data/map_objects.asm +++ b/src/data/map_objects.asm @@ -41,7 +41,7 @@ MasonLabObjects: ; 13b04 (3:7b04) tx Text04ab db NORTH, 2, 2 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -233,7 +233,7 @@ FightingClubLobbyObjects: ; 13c6f (3:7c6f) tx Text04c9 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -267,7 +267,7 @@ RockClubLobbyObjects: ; 13ca6 (3:7ca6) tx Text04cf db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -301,7 +301,7 @@ WaterClubLobbyObjects: ; 13cdd (3:7cdd) tx Text04d5 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -335,7 +335,7 @@ LightningClubLobbyObjects: ; 13d14 (3:7d14) tx Text04db db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -369,7 +369,7 @@ GrassClubLobbyObjects: ; 13d4b (3:7d4b) tx Text04e1 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -403,7 +403,7 @@ PsychicClubLobbyObjects: ; 13d82 (3:7d82) tx Text04e7 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -437,7 +437,7 @@ ScienceClubLobbyObjects: ; 13db9 (3:7db9) tx Text04ed db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -471,7 +471,7 @@ FireClubLobbyObjects: ; 13df0 (3:7df0) tx Text04f3 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -505,7 +505,7 @@ ChallengeHallLobbyObjects: ; 13e27 (3:7e27) tx Text04f9 db NORTH, 2, 8 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text @@ -574,7 +574,7 @@ PokemonDomeEntranceObjects: ; 13e5e (3:7e5e) tx Text0509 db NORTH, 28, 2 - dw PC_c7ea + dw PCMenu tx PlaceholderMessageText tx PokemonTradingCards101Text diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index b336d52..3734f05 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -114,8 +114,8 @@ SetScriptData: ; c0f1 (3:40f1) ld a, c ld [wNextScript], a ld a, b - ld [wNextScript+1], a - ld a, $3 + ld [wNextScript + 1], a + ld a, OWMODE_SCRIPT ld [wOverworldMode], a jr EnterScript @@ -190,19 +190,19 @@ Func_c158: ; c158 (3:4158) Func_c17a: ; c17a (3:417a) ld a, [wOverworldMode] - cp $3 + cp OWMODE_SCRIPT ret z call Func_c9b8 ret Func_c184: ; c184 (3:4184) push bc - ld c, $1 + ld c, OWMODE_MOVE ld a, [wCurMap] cp OVERWORLD_MAP - jr nz, .asm_c190 - ld c, $0 -.asm_c190 + jr nz, .not_map + ld c, OWMODE_MAP +.not_map ld a, c ld [wOverworldMode], a ld [wd0c0], a @@ -230,13 +230,13 @@ WhiteOutDMGPals: ; c1a4 (3:41a4) Func_c1b1: ; c1b1 (3:41b1) ld a, $c ld [wd32e], a - ld a, $0 + ld a, OVERWORLD_MAP ld [wTempMap], a ld a, $c ld [wTempPlayerXCoord], a ld a, $c ld [wTempPlayerYCoord], a - ld a, $2 + ld a, SOUTH ld [wTempPlayerDirection], a call Func_c9cb call Func_c9dd @@ -303,13 +303,13 @@ Func_c251: ; c251 (3:4251) ldh a, [hffb0] push af ld a, $1 - jr asm_c25d + jr Func_c258.asm_c25d Func_c258: ; c258 (3:4258) ldh a, [hffb0] push af ld a, $2 -asm_c25d: +.asm_c25d ldh [hffb0], a push hl call Func_c268 @@ -320,19 +320,19 @@ asm_c25d: Func_c268: ; c268 (3:4268) ld hl, PauseMenuTextList -.asm_c26b +.loop push hl ld a, [hli] ld h, [hl] ld l, a or h - jr z, .asm_c27a + jr z, .done call ProcessTextFromID pop hl inc hl inc hl - jr .asm_c26b -.asm_c27a + jr .loop +.done pop hl ret @@ -686,10 +686,10 @@ Func_c4b9: ; c4b9 (3:44b9) farcall Func_80418 ld b, $0 ld a, [wConsole] - cp $2 - jr nz, .asm_c4d1 + cp CONSOLE_CGB + jr nz, .not_cgb ld b, $1e -.asm_c4d1 +.not_cgb ld a, b ld [wd337], a @@ -699,13 +699,13 @@ Func_c4b9: ; c4b9 (3:44b9) ld a, [wWhichSprite] ld [wPlayerSpriteIndex], a - ld b, $2 + ld b, SOUTH ld a, [wCurMap] cp OVERWORLD_MAP - jr z, .asm_c4ee + jr z, .ow_map ld a, [wTempPlayerDirection] ld b, a -.asm_c4ee +.ow_map ld a, b ld [wPlayerDirection], a call UpdatePlayerSprite @@ -717,9 +717,9 @@ Func_c4b9: ; c4b9 (3:44b9) ld [wd338], a ld a, [wCurMap] cp OVERWORLD_MAP - jr nz, .asm_c50f + jr nz, .not_ow_map farcall Func_10fde -.asm_c50f +.not_ow_map ret HandlePlayerMoveMode: ; c510 (3:4510) @@ -732,14 +732,14 @@ HandlePlayerMoveMode: ; c510 (3:4510) call z, HandlePlayerMoveModeInput ld a, [wPlayerCurrentlyMoving] or a - jr z, .notMoving + jr z, .not_moving bit 0, a call nz, Func_c66c ld a, [wPlayerCurrentlyMoving] bit 1, a call nz, Func_c6dc ret -.notMoving +.not_moving ldh a, [hKeysPressed] and START call nz, OpenStartMenu @@ -761,10 +761,10 @@ Func_c554: ; c554 (3:4554) ld [wWhichSprite], a ld a, [wCurMap] cp OVERWORLD_MAP - jr nz, .asm_c566 + jr nz, .not_ow_map farcall Func_10e28 ret -.asm_c566 +.not_ow_map push hl push bc push de @@ -814,13 +814,13 @@ Func_c58b: ; c58b (3:458b) HandlePlayerMoveModeInput: ; c5ac (3:45ac) ldh a, [hKeysHeld] and D_PAD - jr z, .skipMoving + jr z, .skip_moving call UpdatePlayerDirectionFromDPad call AttemptPlayerMovementFromDirection ld a, [wPlayerCurrentlyMoving] and $1 jr nz, .done -.skipMoving +.skip_moving ldh a, [hKeysPressed] and A_BUTTON jr z, .done @@ -840,13 +840,13 @@ GetDirectionFromDPad: ; c5d5 (3:45d5) push hl ld hl, KeypadDirectionMap or a - jr z, .loadDirectionMapping -.findDirectionMappingLoop + jr z, .get_direction +.loop rlca - jr c, .loadDirectionMapping + jr c, .get_direction inc hl - jr .findDirectionMappingLoop -.loadDirectionMapping + jr .loop +.get_direction ld a, [hl] pop hl ret @@ -926,7 +926,7 @@ FindPlayerMovementWithOffset: ; c656 (3:4656) ld c, a ld b, $0 push hl - ld hl, PlayerMovementOffsetTable + ld hl, PlayerMovementOffsetTable_Tiles add hl, bc ld a, [wPlayerXCoord] add [hl] @@ -972,7 +972,7 @@ Func_c694: ; c694 (3:4694) rlca ld c, a ld b, $0 - ld hl, Unknown_396b + ld hl, PlayerMovementOffsetTable add hl, bc pop bc .asm_c6a0 @@ -1028,7 +1028,7 @@ Func_c6dc: ; c6dc (3:46dc) call Func_3997 call Func_c70d ld a, [wOverworldMode] - cp $1 + cp OWMODE_MOVE call z, Func_c9c0 pop hl ret @@ -1064,23 +1064,23 @@ FindNPCOrObject: ; c71e (3:471e) call FindPlayerMovementFromDirection call GetPermissionOfMapPosition and $40 - jr z, .noNPC + jr z, .no_npc farcall FindNPCAtLocation - jr c, .noNPC + jr c, .no_npc ld a, [wLoadedNPCTempIndex] ld [wScriptNPC], a ld a, OWMODE_START_SCRIPT - jr .changeStateExit + jr .set_mode -.noNPC +.no_npc call HandleMoveModeAPress jr nc, .exit ld a, OWMODE_SCRIPT - jr .changeStateExit + jr .set_mode .exit or a ret -.changeStateExit +.set_mode ld [wOverworldMode], a scf ret @@ -1089,40 +1089,40 @@ OpenStartMenu: ; c74d (3:474d) push hl push bc push de - call MainMenu_c75a + call StartMenu call CloseAdvancedDialogueBox pop de pop bc pop hl ret -MainMenu_c75a: ; c75a (3:475a) +StartMenu: ; c75a (3:475a) call PauseSong ld a, MUSIC_PAUSE_MENU call PlaySong call Func_c797 -.asm_c765 +.loop ld a, $1 call Func_c29b -.asm_c76a +.wait_input call DoFrameIfLCDEnabled call HandleMenuInput - jr nc, .asm_c76a + jr nc, .wait_input ld a, e ld [wd0b8], a ldh a, [hCurMenuItem] cp e - jr nz, .asm_c793 + jr nz, .exit cp $5 - jr z, .asm_c793 + jr z, .exit call Func_c2a3 ld a, [wd0b8] ld hl, PointerTable_c7a2 call JumpToFunctionInTable ld hl, Func_c797 call Func_c32b - jr .asm_c765 -.asm_c793 + jr .loop +.exit call ResumeSong ret @@ -1176,7 +1176,7 @@ Func_c7e5: ; c7e5 (3:47e5) farcall Func_103d2 ret -PC_c7ea: ; c7ea (3:47ea) +PCMenu: ; c7ea (3:47ea) ld a, MUSIC_PC_MAIN_MENU call PlaySong call Func_c241 @@ -1185,28 +1185,28 @@ PC_c7ea: ; c7ea (3:47ea) ldtx hl, TurnedPCOnText call PrintScrollableText_NoTextBoxLabel call Func_c84e -.asm_c801 +.loop ld a, $1 call Func_c29b -.asm_c806 +.wait_input call DoFrameIfLCDEnabled call HandleMenuInput - jr nc, .asm_c806 + jr nc, .wait_input ld a, e ld [wd0b9], a ldh a, [hCurMenuItem] cp e - jr nz, .asm_c82f + jr nz, .exit cp $4 - jr z, .asm_c82f + jr z, .exit call Func_c2a3 ld a, [wd0b9] ld hl, PointerTable_c846 call JumpToFunctionInTable ld hl, Func_c84e call Func_c32b - jr .asm_c801 -.asm_c82f + jr .loop +.exit call CloseTextBox call DoFrameIfLCDEnabled ldtx hl, TurnedPCOffText @@ -1350,8 +1350,8 @@ Func_c8ed: ; c8ed (3:48ed) Func_c915: ; c915 (3:4915) push bc push de - ld de, $000c - ld bc, $1406 + lb de, $00, $0c + lb bc, $14, $06 call AdjustCoordinatesForBGScroll call Func_c3ca pop de @@ -1373,7 +1373,7 @@ SetNextScript: ; c935 (3:4935) ld [hl], c inc hl ld [hl], b - ld a, $3 + ld a, OWMODE_SCRIPT ld [wOverworldMode], a pop hl ret @@ -1385,7 +1385,7 @@ Func_c943: ; c943 (3:4943) ld l, MAP_SCRIPT_NPCS call GetMapScriptPointer jr nc, .quit -.loadNPCLoop +.load_npc_loop ld a, l ld [wTempPointer], a ld a, h @@ -1401,22 +1401,22 @@ Func_c943: ; c943 (3:4943) push hl ld a, [wLoadNPCFunction] ld l, a - ld a, [wLoadNPCFunction+1] + ld a, [wLoadNPCFunction + 1] ld h, a or l - jr z, .noScript + jr z, .no_script call CallHL2 - jr nc, .nextNPC -.noScript + jr nc, .next_npc +.no_script ld a, [wTempNPC] farcall LoadNPCSpriteData call Func_c998 farcall Func_1c485 -.nextNPC +.next_npc pop hl ld bc, NPC_MAP_SIZE add hl, bc - jr .loadNPCLoop + jr .load_npc_loop .quit ld l, MAP_SCRIPT_POST_NPC call CallMapScriptPointerIfExists @@ -1427,17 +1427,17 @@ Func_c943: ; c943 (3:4943) Func_c998: ; c998 (3:4998) ld a, [wTempNPC] - cp $22 + cp NPC_AMY ret nz ld a, [wd3d0] or a ret z ld b, $4 ld a, [wConsole] - cp $2 - jr nz, .asm_c9ae + cp CONSOLE_CGB + jr nz, .not_cgb ld b, $e -.asm_c9ae +.not_cgb ld a, b ld [wd3b1], a ld a, $0 @@ -1468,14 +1468,14 @@ Func_c9cb: ; c9cb (3:49cb) push hl push bc ld hl, wEventFlags - ld bc, $0040 -.asm_c9d3 + ld bc, EVENT_FLAG_BYTES +.loop xor a ld [hli], a dec bc ld a, b or c - jr nz, .asm_c9d3 + jr nz, .loop pop bc pop hl ret @@ -1494,18 +1494,18 @@ DetermineImakuniRoom: ; c9e8 (3:49e8) ld c, $0 get_flag_value EVENT_IMAKUNI_STATE cp IMAKUNI_TALKED - jr c, .finish -.tryLoadImakuniLoop + jr c, .skip +.loop call UpdateRNGSources - and $3 + and %11 ld c, a - ld b, $0 + ld b, 0 ld hl, ImakuniPossibleRooms add hl, bc ld a, [wTempMap] cp [hl] - jr z, .tryLoadImakuniLoop -.finish + jr z, .loop +.skip ld a, c set_flag_value EVENT_IMAKUNI_ROOM ret @@ -1575,13 +1575,13 @@ GetEventFlagValue: ; ca6c (3:4a6c) call GetEventFlag ld c, [hl] ld a, [wLoadedFlagBits] -.shiftLoop +.loop bit 0, a - jr nz, .lsbReached + jr nz, .done srl a srl c - jr .shiftLoop -.lsbReached + jr .loop +.done and c pop bc pop hl @@ -1609,13 +1609,13 @@ SetEventFlagValue: ; ca92 (3:4a92) push bc call GetEventFlag ld a, [wLoadedFlagBits] -.asm_ca9a +.loop bit 0, a - jr nz, .asm_caa4 + jr nz, .done srl a sla c - jr .asm_ca9a -.asm_caa4 + jr .loop +.done ld a, [wLoadedFlagBits] and c ld c, a @@ -1631,7 +1631,7 @@ SetEventFlagValue: ; ca92 (3:4a92) ; returns in a the byte db'd after the call to a function that calls this GetByteAfterCall: ; cab3 (3:4ab3) push hl - ld hl, sp+$4 + ld hl, sp+4 push bc ld c, [hl] inc hl @@ -1671,41 +1671,41 @@ TryGiveMedalPCPacks: ; cad8 (3:4ad8) push hl push bc ld hl, MedalEventFlags - ld bc, $0008 -.countMedalsLoop + lb bc, 0, 8 +.loop ld a, [hli] call GetEventFlagValue - jr z, .noMedal + jr z, .no_medal inc b -.noMedal +.no_medal dec c - jr nz, .countMedalsLoop + jr nz, .loop ld c, b set_flag_value EVENT_MEDAL_COUNT ld a, c push af - cp $8 - jr nc, .givePacksForEightMedals - cp $7 - jr nc, .givePacksForSevenMedals - cp $3 - jr nc, .givePacksForThreeMedals - jr .finish + cp 8 + jr nc, .give_packs_for_eight_medals + cp 7 + jr nc, .give_packs_for_seven_medals + cp 3 + jr nc, .give_packs_for_three_medals + jr .done -.givePacksForEightMedals +.give_packs_for_eight_medals ld a, $c farcall TryGivePCPack -.givePacksForSevenMedals +.give_packs_for_seven_medals ld a, $b farcall TryGivePCPack -.givePacksForThreeMedals +.give_packs_for_three_medals ld a, $a farcall TryGivePCPack -.finish +.done pop af pop bc pop hl @@ -1725,24 +1725,27 @@ MedalEventFlags: ; cb15 (3:4b15) GetEventFlag: ; cb1d (3:4b1d) push bc ld c, a - ld b, $0 + ld b, 0 sla c rl b - ld hl, EventFlagMods + ld hl, EventFlagMasks add hl, bc ld a, [hli] ld c, a ld a, [hl] ld [wLoadedFlagBits], a - ld b, $0 + ld b, 0 ld hl, wEventFlags add hl, bc pop bc ret -; offset - bytes to set or reset -EventFlagMods: ; cb37 (3:4b37) - flag_def $3f, %10000000 ; EVENT_FLAG_00 ; 0-7 are reset when game resets +; location in wEventFlags of each event flag: +; offset - which byte holds the event flag +; mask - which bits in the byte hold the value +; events 0-7 are reset when game resets +EventFlagMasks: ; cb37 (3:4b37) + flag_def $3f, %10000000 ; EVENT_FLAG_00 flag_def $3f, %01000000 ; EVENT_FLAG_01 flag_def $3f, %00100000 ; EVENT_TEMP_TALKED_TO_IMAKUNI flag_def $3f, %00010000 ; EVENT_TEMP_DUELED_IMAKUNI @@ -1905,14 +1908,14 @@ RST20: ; cc42 (3:4c42) ld a, l ld [wScriptPointer], a ld a, h - ld [wScriptPointer+1], a + ld [wScriptPointer + 1], a xor a ld [wBreakScriptLoop], a -.continueScriptLoop +.loop call RunOverworldScript ld a, [wBreakScriptLoop] ; if you break out, it jumps or a - jr z, .continueScriptLoop + jr z, .loop ld hl, wScriptPointer ld a, [hli] ld c, a @@ -1922,32 +1925,37 @@ RST20: ; cc42 (3:4c42) IncreaseScriptPointerBy1: ; cc60 (3:4c60) ld a, 1 jr IncreaseScriptPointer + IncreaseScriptPointerBy2: ; cc64 (3:4c64) ld a, 2 jr IncreaseScriptPointer + IncreaseScriptPointerBy4: ; cc68 (3:4c68) ld a, 4 jr IncreaseScriptPointer + IncreaseScriptPointerBy5: ; cc6c (3:4c6c) ld a, 5 jr IncreaseScriptPointer + IncreaseScriptPointerBy6: ; cc70 (3:4c70) ld a, 6 jr IncreaseScriptPointer + IncreaseScriptPointerBy7: ; cc74 (3:4c74) ld a, 7 jr IncreaseScriptPointer + IncreaseScriptPointerBy3: ; cc78 (3:4c78) ld a, 3 - IncreaseScriptPointer: ; cc7a (3:4c7a) ld c, a ld a, [wScriptPointer] add c ld [wScriptPointer], a - ld a, [wScriptPointer+1] + ld a, [wScriptPointer + 1] adc 0 - ld [wScriptPointer+1], a + ld [wScriptPointer + 1], a ret SetScriptPointer: ; cc8b (3:4c8b) @@ -1958,27 +1966,27 @@ SetScriptPointer: ; cc8b (3:4c8b) ret GetScriptArgs5AfterPointer: ; cc92 (3:4c92) - ld a, $5 + ld a, 5 jr GetScriptArgsAfterPointer GetScriptArgs1AfterPointer: ; cc96 (3:4c96) - ld a, $1 + ld a, 1 jr GetScriptArgsAfterPointer GetScriptArgs2AfterPointer: ; cc9a (3:4c9a) - ld a, $2 + ld a, 2 jr GetScriptArgsAfterPointer -GetScriptArgs3AfterPointer: ; cc9e (3:4c9e) - ld a, $3 +GetScriptArgs3AfterPointer: ; cc9e (3:4c9e) + ld a, 3 GetScriptArgsAfterPointer: ; cca0 (3:4ca0) push hl ld l, a ld a, [wScriptPointer] add l ld l, a - ld a, [wScriptPointer+1] - adc $0 + ld a, [wScriptPointer + 1] + adc 0 ld h, a ld a, [hli] ld c, a @@ -1999,7 +2007,7 @@ SetScriptControlByteFail: ; ccb9 (3:4cb9) ; Exits Script mode and runs the next instruction like normal ScriptCommand_EndScript: ; ccbe (3:4cbe) - ld a, $01 + ld a, TRUE ld [wBreakScriptLoop], a jp IncreaseScriptPointerBy1 @@ -2027,7 +2035,7 @@ ScriptCommand_PrintText: ; ccdc (3:4cdc) jp IncreaseScriptPointerBy3 ScriptCommand_AskQuestionJumpDefaultYes: ; cce4 (3:4ce4) - ld a, $1 + ld a, TRUE ld [wDefaultYesOrNo], a ; fallthrough @@ -2039,12 +2047,12 @@ ScriptCommand_AskQuestionJump: ; cce9 (3:4ce9) call Func_c8ed ld a, [hCurMenuItem] ld [wScriptControlByte], a - jr c, .asm_ccfe + jr c, .no_jump call GetScriptArgs3AfterPointer - jr z, .asm_ccfe + jr z, .no_jump jp SetScriptPointer -.asm_ccfe +.no_jump jp IncreaseScriptPointerBy5 ; args - prize cards, deck id, duel theme index @@ -2058,20 +2066,20 @@ ScriptCommand_StartDuel: ; cd01 (3:4d01) farcall Func_118d3 ld a, [wcc19] cp $ff - jr nz, .asm_cd26 + jr nz, .not_aaron_duel ld a, [wd695] ld c, a - ld b, $0 + ld b, 0 ld hl, AaronDeckIDs add hl, bc ld a, [hl] ld [wcc19], a -.asm_cd26 +.not_aaron_duel ld a, [wScriptNPC] ld l, LOADED_NPC_ID call GetItemInLoadedNPCIndex ld a, [hl] -asm_cd2f: +.start_duel ld [wd0c4], a ld [wcc14], a push af @@ -2089,10 +2097,10 @@ ScriptCommand_StartChallengeHallDuel: ; cd4f (3:4d4f) call Func_cd66 ld a, [wd696] farcall Func_118bf - ld a, $16 + ld a, MUSIC_MATCH_START_2 ld [wMatchStartTheme], a ld a, [wd696] - jr asm_cd2f + jr ScriptCommand_StartDuel.start_duel AaronDeckIDs: ; cd63 (3:4d63) db LIGHTNING_AND_FIRE_DECK_ID @@ -2120,9 +2128,9 @@ ScriptCommand_BattleCenter: ; cd76 (3:4d76) ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83) ld a, [wScriptControlByte] or a - jr nz, .printText + jr nz, .print_text call GetScriptArgs3AfterPointer -.printText +.print_text ld l, c ld h, b call Func_cc32 @@ -2131,7 +2139,7 @@ ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83) ScriptCommand_PrintTextForChallengeCup: ; cd94 (3:4d94) get_flag_value EVENT_FLAG_44 dec a - and $3 + and %11 add a inc a call GetScriptArgsAfterPointer @@ -2143,9 +2151,9 @@ ScriptCommand_PrintTextForChallengeCup: ; cd94 (3:4d94) ScriptCommand_PrintVariableText: ; cda8 (3:4da8) ld a, [wScriptControlByte] or a - jr nz, .asm_cdb1 + jr nz, .print_text call GetScriptArgs3AfterPointer -.asm_cdb1 +.print_text ld l, c ld h, b call Func_c891 @@ -2157,7 +2165,7 @@ ScriptCommand_PrintTextQuitFully: ; cdb9 (3:4db9) ld h, b call Func_cc32 call CloseAdvancedDialogueBox - ld a, $1 + ld a, TRUE ld [wBreakScriptLoop], a call IncreaseScriptPointerBy3 pop hl @@ -2217,7 +2225,7 @@ ScriptCommand_MoveActiveNPCByDirection: ; ce26 (3:4e26) add c ld l, a ld a, b - adc $0 + adc 0 ld h, a ld c, [hl] inc hl @@ -2228,10 +2236,10 @@ ScriptCommand_MoveActiveNPCByDirection: ; ce26 (3:4e26) ; set bit 7 to only rotate the NPC ExecuteNPCMovement: ; ce3a (3:4e3a) farcall Func_1c78d -.asm_ce3e +.loop call DoFrameIfLCDEnabled farcall Func_1c7de - jr nz, .asm_ce3e + jr nz, .loop jp IncreaseScriptPointerBy3 ; Begin a series of NPC movements on the currently talking NPC @@ -2296,14 +2304,14 @@ ScriptCommand_GiveBoosterPacks: ; ce8a (3:4e8a) pop bc ld a, b cp NO_BOOSTER - jr z, .asm_ceb4 + jr z, .done farcall BoosterPack_1031b call GetScriptArgs3AfterPointer ld a, c cp NO_BOOSTER - jr z, .asm_ceb4 + jr z, .done farcall BoosterPack_1031b -.asm_ceb4 +.done call Func_c2d4 jp IncreaseScriptPointerBy4 @@ -2312,7 +2320,7 @@ ScriptCommand_GiveOneOfEachTrainerBooster: ; ceba (3:4eba) ld [wd117], a call Func_c2a3 ld hl, .booster_type_table -.giveBoosterLoop +.loop ld a, [hl] cp NO_BOOSTER jr z, .done @@ -2322,7 +2330,7 @@ ScriptCommand_GiveOneOfEachTrainerBooster: ; ceba (3:4eba) ld [wd117], a pop hl inc hl - jr .giveBoosterLoop + jr .loop .done call Func_c2d4 jp IncreaseScriptPointerBy1 @@ -2335,17 +2343,17 @@ ScriptCommand_GiveOneOfEachTrainerBooster: ; ceba (3:4eba) db NO_BOOSTER ; $ff ; Shows the card received screen for a given promotional card -; arg can either be the card, $00 for a wram card, or $ff for the 4 legends +; arg can either be the card, $00 for a wram card, or $ff for the 4 legendary cards ScriptCommand_ShowCardReceivedScreen: ; cee2 (3:4ee2) call Func_c2a3 ld a, c cp $ff - jr z, .asm_cf09 + jr z, .legendary_card or a - jr nz, .asm_cef0 + jr nz, .show_card ld a, [wd697] -.asm_cef0 +.show_card push af farcall Func_10000 farcall Func_10031 @@ -2356,34 +2364,34 @@ ScriptCommand_ShowCardReceivedScreen: ; cee2 (3:4ee2) call Func_c2d4 jp IncreaseScriptPointerBy2 -.asm_cf09 +.legendary_card xor a - jr .asm_cef0 + jr .show_card ScriptCommand_JumpIfCardOwned: ; cf0c (3:4f0c) ld a, c call GetCardCountInCollectionAndDecks - jr asm_cf16 + jr ScriptCommand_JumpIfCardInCollection.count_check ScriptCommand_JumpIfCardInCollection: ; cf12 (3:4f12) ld a, c call GetCardCountInCollection -asm_cf16: +.count_check or a - jr nz, asm_cf1f + jr nz, .pass_try_jump -asm_cf19: +.fail call SetScriptControlByteFail jp IncreaseScriptPointerBy4 -asm_cf1f: +.pass_try_jump call SetScriptControlBytePass call GetScriptArgs2AfterPointer - jr z, asm_cf2a + jr z, .no_jump jp SetScriptPointer -asm_cf2a: +.no_jump jp IncreaseScriptPointerBy4 ScriptCommand_JumpIfEnoughCardsOwned: ; cf2d (3:4f2d) @@ -2393,22 +2401,22 @@ ScriptCommand_JumpIfEnoughCardsOwned: ; cf2d (3:4f2d) call GetAmountOfCardsOwned ld a, h cp b - jr nz, .asm_cf3b + jr nz, .high_byte_not_equal ld a, l cp c -.asm_cf3b - jr nc, asm_cf1f - jr asm_cf19 +.high_byte_not_equal + jr nc, ScriptCommand_JumpIfCardInCollection.pass_try_jump + jr ScriptCommand_JumpIfCardInCollection.fail ; Gives the first arg as a card. If that's 0 pulls from wd697 ScriptCommand_GiveCard: ; cf3f (3:4f3f) ld a, c or a - jr nz, .giveCard + jr nz, .give_card ld a, [wd697] -.giveCard +.give_card call AddCardToCollection jp IncreaseScriptPointerBy2 @@ -2418,83 +2426,82 @@ ScriptCommand_TakeCard: ; cf4c (3:4f4c) jp IncreaseScriptPointerBy2 ScriptCommand_JumpIfAnyEnergyCardsInCollection: ; cf53 (3:4f53) - ld c, $1 - ld b, $0 -.asm_cf57 + ld c, GRASS_ENERGY + ld b, 0 +.loop ld a, c call GetCardCountInCollection add b ld b, a inc c ld a, c - cp $8 - jr c, .asm_cf57 + cp DOUBLE_COLORLESS_ENERGY + 1 + jr c, .loop ld a, b or a - jr nz, Func_cf6d -Func_cf67: ; cf67 (3:4f67) + jr nz, .pass_try_jump + +.fail call SetScriptControlByteFail jp IncreaseScriptPointerBy3 -Func_cf6d: ; cf6d (3:4f6d) +.pass_try_jump call SetScriptControlBytePass call GetScriptArgs1AfterPointer - jr z, .asm_cf78 + jr z, .no_jump jp SetScriptPointer -.asm_cf78 +.no_jump jp IncreaseScriptPointerBy3 ScriptCommand_RemoveAllEnergyCardsFromCollection: ; cf7b (3:4f7b) - ld c, $1 -.asm_cf7d + ld c, GRASS_ENERGY +.next_energy push bc ld a, c call GetCardCountInCollection - jr c, .asm_cf8c + jr c, .no_energy ld b, a -.asm_cf85 +.remove_loop ld a, c call RemoveCardFromCollection dec b - jr nz, .asm_cf85 + jr nz, .remove_loop -.asm_cf8c +.no_energy pop bc inc c ld a, c - cp $8 - jr c, .asm_cf7d + cp DOUBLE_COLORLESS_ENERGY + 1 + jr c, .next_energy jp IncreaseScriptPointerBy1 ScriptCommand_JumpBasedOnFightingClubPupilStatus: ; cf96 (3:4f96) - ld c, $0 + ld c, 0 get_flag_value EVENT_FLAG_11 or a - jr z, Func_cfc0 - cp a, $08 - jr c, .asm_cfa4 + jr z, .first_interaction + cp 8 + jr c, .pupil1_not_defeated inc c - -.asm_cfa4 +.pupil1_not_defeated get_flag_value EVENT_FLAG_17 - cp $8 - jr c, .asm_cfad + cp 8 + jr c, .pupil2_not_defeated inc c - -.asm_cfad +.pupil2_not_defeated get_flag_value EVENT_FLAG_20 - cp a, $08 - jr c, .asm_cfb6 + cp 8 + jr c, .pupil3_not_defeated inc c -.asm_cfb6 +.pupil3_not_defeated ld a, c rlca - add $3 + add 3 call GetScriptArgsAfterPointer jp SetScriptPointer -Func_cfc0: ; cfc0 (3:4fc0) +.first_interaction call GetScriptArgs1AfterPointer jp SetScriptPointer @@ -2508,53 +2515,53 @@ ScriptCommand_SetActiveNPCDirection: ; cfc6 (3:4fc6) ScriptCommand_PickNextMan1RequestedCard: ; cfd4 (3:4fd4) get_flag_value EVENT_FLAG_2D ld b, a -.asm_cfd9 - ld a, $5 +.choose_again + ld a, Man1RequestedCardsList.end - Man1RequestedCardsList call Random - ld e, $1 + ld e, 1 ld c, a push bc or a - jr z, .asm_cfea -.asm_cfe5 + jr z, .skip_shift +.shift_loop sla e dec c - jr nz, .asm_cfe5 - -.asm_cfea + jr nz, .shift_loop +.skip_shift ld a, e - and b + and b ; has this card already been chosed before? pop bc - jr nz, .asm_cfd9 + jr nz, .choose_again ld a, e or b push bc ld c, a set_flag_value EVENT_FLAG_2D pop bc - ld b, $0 - ld hl, Data_d006 + ld b, 0 + ld hl, Man1RequestedCardsList add hl, bc ld c, [hl] set_flag_value EVENT_FLAG_2B jp IncreaseScriptPointerBy1 -Data_d006: ; d006 (3:5006) +Man1RequestedCardsList: ; d006 (3:5006) db GRAVELER db OMASTAR db PARASECT db RAPIDASH db WEEZING +.end ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot: ; d00b (3:500b) sla c - ld b, $0 + ld b, 0 ld hl, wTxRam2 add hl, bc push hl get_flag_value EVENT_FLAG_2B ld e, a - ld d, $0 + ld d, 0 call GetCardName pop hl ld [hl], e @@ -2565,14 +2572,14 @@ ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot: ; d00b (3:500b) ScriptCommand_JumpIfMan1RequestedCardOwned: ; d025 (3:5025) get_flag_value EVENT_FLAG_2B call GetCardCountInCollectionAndDecks - jp c, Func_cf67 - jp Func_cf6d + jp c, ScriptCommand_JumpIfAnyEnergyCardsInCollection.fail + jp ScriptCommand_JumpIfAnyEnergyCardsInCollection.pass_try_jump ScriptCommand_JumpIfMan1RequestedCardInCollection: ; d032 (3:5032) get_flag_value EVENT_FLAG_2B call GetCardCountInCollection - jp c, Func_cf67 - jp Func_cf6d + jp c, ScriptCommand_JumpIfAnyEnergyCardsInCollection.fail + jp ScriptCommand_JumpIfAnyEnergyCardsInCollection.pass_try_jump ScriptCommand_RemoveMan1RequestedCardFromCollection: ; d03f (3:503f) get_flag_value EVENT_FLAG_2B @@ -2592,7 +2599,7 @@ ScriptCommand_SetPlayerDirection: ; d055 (3:5055) call UpdatePlayerDirection jp IncreaseScriptPointerBy2 -; arg1 - Direction (index in PlayerMovementOffsetTable) +; arg1 - Direction (index in PlayerMovementOffsetTable_Tiles) ; arg2 - Tiles Moves (Speed) ScriptCommand_MovePlayer: ; 505c (3:505c) ld a, c @@ -2600,13 +2607,13 @@ ScriptCommand_MovePlayer: ; 505c (3:505c) ld a, b ld [wd33a], a call StartScriptedMovement -.asm_d067 +.wait call DoFrameIfLCDEnabled call SetScreenScroll call Func_c53d ld a, [wPlayerCurrentlyMoving] and $03 - jr nz, .asm_d067 + jr nz, .wait call DoFrameIfLCDEnabled call SetScreenScroll jp IncreaseScriptPointerBy3 @@ -2638,11 +2645,10 @@ ScriptCommand_SetSpriteAttributes: ; d095 (3:5095) pop bc ld e, c ld a, [wConsole] - cp $2 - jr nz, .asm_d0b6 + cp CONSOLE_CGB + jr nz, .not_cgb ld e, b - -.asm_d0b6 +.not_cgb ld a, e farcall Func_1c57b jp IncreaseScriptPointerBy4 @@ -2672,20 +2678,20 @@ ScriptCommand_JumpIfActiveNPCCoordsMatch: ; d0d9 (3:50d9) farcall Func_1c477 ld a, e cp c - jp nz, ScriptEventFailedNoJump + jp nz, ScriptCommand_JumpIfFlagEqual.fail ld a, d cp b - jp nz, ScriptEventFailedNoJump - jp ScriptEventPassedTryJump + jp nz, ScriptCommand_JumpIfFlagEqual.fail + jp ScriptCommand_JumpIfFlagEqual.pass_try_jump ScriptCommand_JumpIfPlayerCoordsMatch: ; d0f2 (3:50f2) ld a, [wPlayerXCoord] cp c - jp nz, ScriptEventFailedNoJump + jp nz, ScriptCommand_JumpIfFlagEqual.fail ld a, [wPlayerYCoord] cp b - jp nz, ScriptEventFailedNoJump - jp ScriptEventPassedTryJump + jp nz, ScriptCommand_JumpIfFlagEqual.fail + jp ScriptCommand_JumpIfFlagEqual.pass_try_jump ScriptCommand_JumpIfNPCLoaded: ; d103 (3:5103) ld a, [wLoadedNPCTempIndex] @@ -2695,14 +2701,14 @@ ScriptCommand_JumpIfNPCLoaded: ; d103 (3:5103) ld a, c ld [wTempNPC], a call FindLoadedNPC - jr c, .asm_d119 - call ScriptCommand_JumpIfFlagNonzero2.passTryJump - jr .asm_d11c + jr c, .not_loaded + call ScriptCommand_JumpIfFlagNonzero2.pass_try_jump + jr .done -.asm_d119 +.not_loaded call ScriptCommand_JumpIfFlagZero2.fail -.asm_d11c +.done pop af ld [wTempNPC], a pop af @@ -2720,14 +2726,14 @@ ScriptCommand_ShowMedalReceivedScreen: ; d125 (3:5125) ScriptCommand_LoadCurrentMapNameIntoTxRamSlot: ; d135 (3:5135) sla c - ld b, $0 + ld b, 0 ld hl, wTxRam2 add hl, bc push hl ld a, [wd32e] rlca ld c, a - ld b, $0 + ld b, 0 ld hl, MapNames - 2 add hl, bc ld e, [hl] @@ -2753,14 +2759,14 @@ MapNames: ; d153 (3:5153) tx ChallengeHallMapNameText tx PokemonDomeMapNameText -ScriptCommand_LoadActiveNPCNameIntoTxRamSlot: ; d16b (3:516b) +ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot: ; d16b (3:516b) ld hl, wCurrentNPCNameTx ld e, [hl] inc hl ld d, [hl] push de sla c - ld b, $0 + ld b, 0 ld hl, wTxRam2 add hl, bc push hl @@ -2769,7 +2775,7 @@ ScriptCommand_LoadActiveNPCNameIntoTxRamSlot: ; d16b (3:516b) pop hl ld a, [wCurrentNPCNameTx] ld [hli], a - ld a, [wCurrentNPCNameTx+1] + ld a, [wCurrentNPCNameTx + 1] ld [hl], a pop de ld hl, wCurrentNPCNameTx @@ -2791,27 +2797,25 @@ ScriptCommand_PickChallengeHallOpponent: ; d195 (3:5195) jp IncreaseScriptPointerBy1 ScriptCommand_OpenMenu: ; d1ad (3:51ad) - call MainMenu_c75a + call StartMenu jp IncreaseScriptPointerBy1 ScriptCommand_PickChallengeCupPrizeCard: ; d1b3 (3:51b3) get_flag_value EVENT_FLAG_44 dec a - cp $2 - jr c, .asm_d1c3 - ld a, $d + cp 2 + jr c, .first_or_second_cup + ld a, (ChallengeCupPrizeCards.end - ChallengeCupPrizeCards) / 3 - 2 call Random - add $2 -; fallthrough - -.asm_d1c3 + add 2 +.first_or_second_cup ld hl, ChallengeCupPrizeCards -asm_d1c6: +.get_card_from_list ld e, a add a add e ld e, a - ld d, $0 + ld d, 0 add hl, de ld a, [hli] ld [wd697], a @@ -2866,36 +2870,36 @@ ChallengeCupPrizeCards: ; d1dc (3:51dc) db FLYING_PIKACHU tx FlyingPikachuTradeCardName +.end ScriptCommand_PickLegendaryCard: ; d209 (3:5209) get_flag_value EVENT_FLAG_71 ld e, a -.asm_d20e +.new_random call UpdateRNGSources - ld d, $8 - and $3 + ld d, %00001000 + and %11 ld c, a ld b, a -.asm_d217 - jr z, .asm_d21e +.loop + jr z, .done srl d dec b - jr .asm_d217 - -.asm_d21e + jr .loop +.done ld a, d - and e - jr nz, .asm_d20e + and e ; has this legendary been given already? + jr nz, .new_random push bc - ld b, $0 + ld b, 0 ld hl, Flags_d240 add hl, bc ld a, [hl] - call MaxOutEventFlag + call MaxOutEventFlag ; also modifies EVENT_FLAG_71 pop bc ld hl, LegendaryCards ld a, c - jr asm_d1c6 + jr ScriptCommand_PickChallengeCupPrizeCard.get_card_from_list LegendaryCards: ; d234 (3:5234) db ZAPDOS3 @@ -2989,10 +2993,9 @@ ShowMultichoiceTextbox: ; d28c (3:528c) ld h, [hl] ld l, a or h - jr z, .asm_d2a8 + jr z, .no_text call Func_c8ba - -.asm_d2a8 +.no_text ld a, $1 call Func_c29b pop hl @@ -3009,27 +3012,27 @@ ShowMultichoiceTextbox: ; d28c (3:528c) ld [wd417], a push hl -.asm_d2c1 +.wait_input call DoFrameIfLCDEnabled call HandleMenuInput - jr nc, .asm_d2c1 + jr nc, .wait_input ld a, [hCurMenuItem] cp e - jr z, .asm_d2d9 + jr z, .got_result ld a, [wd417] or a - jr z, .asm_d2c1 + jr z, .wait_input ld e, a ld [hCurMenuItem], a -.asm_d2d9 +.got_result pop hl ld a, [hli] push hl ld h, [hl] ld l, a ld a, e - ld [hl], a + ld [hl], a ; store result add a ld c, a ld b, $0 @@ -3039,14 +3042,13 @@ ShowMultichoiceTextbox: ; d28c (3:528c) ld h, [hl] ld l, a or h - jr z, .asm_d2f5 + jr z, .no_text_2 add hl, bc ld a, [hli] ld [wTxRam2], a ld a, [hl] ld [wTxRam2 + 1], a - -.asm_d2f5 +.no_text_2 ret ScriptCommand_ShowSamNormalMultichoice: ; d2f6 (3:52f6) @@ -3116,7 +3118,7 @@ ScriptCommand_OpenDeckMachine: ; d336 (3:5336) ScriptCommand_EnterMap: ; d36d (3:536d) ld a, [wScriptPointer] ld l, a - ld a, [wScriptPointer+1] + ld a, [wScriptPointer + 1] ld h, a inc hl ld a, [hli] @@ -3143,19 +3145,19 @@ ScriptCommand_SaveGame: ; d396 (3:5396) ScriptCommand_GiftCenter: ; d39d (3:539d) ld a, c or a - jr nz, .asm_d3ac + jr nz, .load_gift_center + ; show menu farcall Func_10dba ld c, a set_flag_value EVENT_FLAG_72 - jr .asm_d3b6 + jr .done -.asm_d3ac +.load_gift_center ld a, GAME_EVENT_GIFT_CENTER ld [wGameEvent], a ld hl, wd0b4 set 6, [hl] - -.asm_d3b6 +.done jp IncreaseScriptPointerBy2 ScriptCommand_PlayCredits: ; d3b9 (3:53b9) @@ -3265,64 +3267,64 @@ ScriptCommand_JumpIfFlagZero1: ; d460 (3:5460) ld a, c call GetEventFlagValue or a - jr z, .passTryJump + jr z, .pass_try_jump .fail call SetScriptControlByteFail jp IncreaseScriptPointerBy4 -.passTryJump +.pass_try_jump call SetScriptControlBytePass call GetScriptArgs2AfterPointer - jr z, .noJumpTarget + jr z, .no_jump jp SetScriptPointer -.noJumpTarget +.no_jump jp IncreaseScriptPointerBy4 ScriptCommand_JumpIfFlagNonzero1: ; d47b (3:547b) ld a, c call GetEventFlagValue or a - jr nz, ScriptCommand_JumpIfFlagZero1.passTryJump + jr nz, ScriptCommand_JumpIfFlagZero1.pass_try_jump jr ScriptCommand_JumpIfFlagZero1.fail ; args - event flag, value, jump address ScriptCommand_JumpIfFlagEqual: ; d484 (3:5484) call GetEventFlagValueBC cp c - jr z, ScriptEventPassedTryJump + jr z, .pass_try_jump -ScriptEventFailedNoJump: ; d48a (3:548a) +.fail call SetScriptControlByteFail jp IncreaseScriptPointerBy5 -ScriptEventPassedTryJump: ; d490 (3:5490) +.pass_try_jump call SetScriptControlBytePass call GetScriptArgs3AfterPointer - jr z, .noJumpAddress + jr z, .no_jump jp SetScriptPointer -.noJumpAddress +.no_jump jp IncreaseScriptPointerBy5 ScriptCommand_JumpIfFlagNotEqual: ; d49e (3:549e) call GetEventFlagValueBC cp c - jr nz, ScriptEventPassedTryJump - jr ScriptEventFailedNoJump + jr nz, ScriptCommand_JumpIfFlagEqual.pass_try_jump + jr ScriptCommand_JumpIfFlagEqual.fail ScriptCommand_JumpIfFlagNotLessThan: ; d4a6 (3:54a6) call GetEventFlagValueBC cp c - jr nc, ScriptEventPassedTryJump - jr ScriptEventFailedNoJump + jr nc, ScriptCommand_JumpIfFlagEqual.pass_try_jump + jr ScriptCommand_JumpIfFlagEqual.fail ScriptCommand_JumpIfFlagLessThan: ; d4ae (3:54ae) call GetEventFlagValueBC cp c - jr c, ScriptEventPassedTryJump - jr ScriptEventFailedNoJump + jr c, ScriptCommand_JumpIfFlagEqual.pass_try_jump + jr ScriptCommand_JumpIfFlagEqual.fail ; Gets event flag at c (Script defaults) ; c takes on the value of b as a side effect @@ -3348,19 +3350,20 @@ ScriptCommand_JumpIfFlagNonzero2: ; d4ca (3:54ca) or a jr z, ScriptCommand_JumpIfFlagZero2.fail -.passTryJump +.pass_try_jump call SetScriptControlBytePass call GetScriptArgs2AfterPointer - jr z, .noJumpArgs + jr z, .no_jump jp SetScriptPointer -.noJumpArgs + +.no_jump jp IncreaseScriptPointerBy4 ScriptCommand_JumpIfFlagZero2: ; d4df (3:54df) ld a, c call GetEventFlagValue or a - jr z, ScriptCommand_JumpIfFlagNonzero2.passTryJump + jr z, ScriptCommand_JumpIfFlagNonzero2.pass_try_jump .fail call SetScriptControlByteFail @@ -3456,7 +3459,7 @@ Script_ChallengeMachine: ; d57d (3:557d) quit_script_fully Script_Tech1: ; d583 (3:5583) - lb bc, 0, EnergyCardListEnd - EnergyCardList + lb bc, 0, EnergyCardList.end - EnergyCardList ld hl, EnergyCardList .count_loop ld a, [hli] @@ -3475,7 +3478,7 @@ Script_Tech1: ; d583 (3:5583) quit_script_fully .low_on_energies - ld c, EnergyCardListEnd - EnergyCardList + ld c, EnergyCardList.end - EnergyCardList ld hl, EnergyCardList .next_energy_card ld b, 10 @@ -3505,7 +3508,7 @@ EnergyCardList: ; d5c4 (3:55c4) db LIGHTNING_ENERGY db FIGHTING_ENERGY db PSYCHIC_ENERGY -EnergyCardListEnd: +.end Script_Tech2: ; d5ca (3:55ca) start_script @@ -4263,10 +4266,10 @@ Script_dad0: ; dad0 (3:5ad0) Preload_NikkiInIshiharasHouse: ; dadd (3:5add) get_flag_value EVENT_FLAG_35 cp $01 - jr nz, .dontLoadNikki + jr nz, .dont_load scf ret -.dontLoadNikki +.dont_load or a ret @@ -4807,7 +4810,7 @@ Preload_MichaelInFightingClub: ; de79 (3:5e79) ccf ret -Script_de81: ; de81 (3:5e81) +Script_MichaelRematch: ; de81 (3:5e81) print_npc_text Text0491 ask_question_jump Text0492, .ows_de8d print_npc_text Text0493 @@ -5885,7 +5888,7 @@ Preload_MichaelInGrassClubEntrance: ; e56a (3:656a) Script_Michael: ; e573 (3:6573) start_script - jump_if_flag_not_less_than EVENT_FLAG_11, $08, Script_de81 + jump_if_flag_not_less_than EVENT_FLAG_11, $08, Script_MichaelRematch jump_if_flag_equal EVENT_FLAG_11, $01, NULL print_variable_npc_text Text06d8, Text06d9 script_set_flag_value EVENT_FLAG_11, $02 @@ -7078,27 +7081,27 @@ SlowpokePaintingObjectTable: ; ed5e (3:6d5e) ; Searches to try to find a match, and starts a Script if possible FindExtraInteractableObjects: ; ed64 (3:6d64) ld de, $5 -.findObjectMatchLoop +.loop ld a, [hl] or a ret z push hl ld a, [wPlayerXCoord] cp [hl] - jr nz, .didNotMatch + jr nz, .not_match inc hl ld a, [wPlayerYCoord] cp [hl] - jr nz, .didNotMatch + jr nz, .not_match inc hl ld a, [wPlayerDirection] cp [hl] - jr z, .foundObject -.didNotMatch + jr z, .match +.not_match pop hl add hl, de - jr .findObjectMatchLoop -.foundObject + jr .loop +.match inc hl ld c, [hl] inc hl @@ -7430,13 +7433,13 @@ Script_Ken_AlreadyHaveMedal: ; ef83 (3:6f83) Preload_Clerk9: ; ef96 (3:6f96) call TryGiveMedalPCPacks get_flag_value EVENT_MEDAL_COUNT - ld hl, .jumpTable + ld hl, .jump_table cp $09 jp c, JumpToFunctionInTable debug_ret jr .asm_efe4 -.jumpTable +.jump_table dw .asm_efe4 dw .asm_efe4 dw .asm_efe4 @@ -7553,7 +7556,7 @@ ChallengeHallLobbyLoadMap: ; f088 (3:7088) get_flag_value EVENT_FLAG_58 or a ret z - ld a, $02 + ld a, NPC_RONALD1 ld [wTempNPC], a call FindLoadedNPC ld bc, Script_f166 @@ -7933,7 +7936,7 @@ Script_f353: ; f353 (3:7353) move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - load_active_npc_name_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $00 print_npc_text Text0532 close_text_box move_active_npc NPCMovement_f37f @@ -7988,8 +7991,8 @@ Script_LostAtChallengeHall: ; f392 (3:7392) move_active_npc NPCMovement_f390 jump_if_flag_equal EVENT_FLAG_45, $02, Script_f410 jump_if_flag_equal EVENT_FLAG_45, $03, Script_f410.ows_f41a - load_active_npc_name_into_txram_slot $00 - load_active_npc_name_into_txram_slot $01 + load_challenge_hall_npc_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $01 print_npc_text Text0536 .ows_f3ae close_text_box @@ -8047,8 +8050,8 @@ NPCMovement_f40d: ; f40d (3:740d) db $ff Script_f410: ; f410 (3:7410) - load_active_npc_name_into_txram_slot $00 - load_active_npc_name_into_txram_slot $01 + load_challenge_hall_npc_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $01 print_npc_text Text0538 script_jump Script_LostAtChallengeHall.ows_f3ae @@ -8082,7 +8085,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) jump_if_flag_equal EVENT_FLAG_45, $01, NULL print_variable_npc_text Text053c, Text053d move_active_npc NPCMovement_f37f - load_active_npc_name_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $00 print_npc_text Text053e close_text_box move_challenge_hall_npc NPCMovement_f4c8 @@ -8092,7 +8095,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) pick_challenge_hall_opponent set_challenge_hall_npc_coords 20, 20 move_challenge_hall_npc NPCMovement_f4d0 - load_active_npc_name_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $00 jump_if_flag_equal EVENT_FLAG_45, $02, NULL print_variable_npc_text Text0540, Text0541 move_active_npc NPCMovement_f383 @@ -8152,7 +8155,7 @@ NPCMovement_f4d8: ; f4d8 (3:74d8) Script_f4db: ; f4db (3:74db) print_npc_text Text054a move_active_npc NPCMovement_f37f - load_active_npc_name_into_txram_slot $00 + load_challenge_hall_npc_into_txram_slot $00 print_npc_text Text054b close_text_box jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 @@ -8232,13 +8235,13 @@ Func_f580: ; f580 (3:7580) jr z, .pick_challenger_include_ronald get_flag_value EVENT_FLAG_45 cp $3 - ld d, ChallengeHallNPCsEnd - ChallengeHallNPCs - 1 ; discount Ronald + ld d, ChallengeHallNPCs.end - ChallengeHallNPCs - 1 ; discount Ronald jr nz, .pick_challenger ld a, NPC_RONALD1 jr .force_ronald .pick_challenger_include_ronald - ld d, ChallengeHallNPCsEnd - ChallengeHallNPCs + ld d, ChallengeHallNPCs.end - ChallengeHallNPCs .pick_challenger ld a, d @@ -8283,7 +8286,7 @@ ChallengeHallNPCs: ; f5b3 (3:75b3) db NPC_ADAM db NPC_JONATHAN db NPC_RONALD1 -ChallengeHallNPCsEnd: +.end Func_f5cc: ; f5cc (3:75cc) call Func_f5e9 @@ -9264,7 +9267,7 @@ Func_fc2b: ; fc2b (3:7c2b) ld a, LOW(ClerkNPCName_) ld [wCurrentNPCNameTx], a ld a, HIGH(ClerkNPCName_) - ld [wCurrentNPCNameTx+1], a + ld [wCurrentNPCNameTx + 1], a jp SetNextScript PointerTable_fc4c: ; fc4c (3:7c4c) @@ -9299,10 +9302,10 @@ Script_fc68: ; fc68 (3:7c68) Preload_GiftCenterClerk: ; fc6c (3:7c6c) ld a, [wConsole] cp CONSOLE_CGB - jr z, .notCGB + jr z, .cgb ld a, NORTH ld [wLoadNPCDirection], a -.notCGB +.cgb scf ret diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index be5f987..65bf179 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -484,7 +484,7 @@ Func_10f2e: ; 10f2e (4:4f2e) rlca ld e, a ld d, $0 - ld hl, Unknown_397b + ld hl, OverworldMapNames add hl, de ld a, [hli] ld h, [hl] @@ -1058,7 +1058,7 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_JumpIfNPCLoaded dw ScriptCommand_ShowMedalReceivedScreen dw ScriptCommand_LoadCurrentMapNameIntoTxRamSlot - dw ScriptCommand_LoadActiveNPCNameIntoTxRamSlot + dw ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot dw ScriptCommand_StartChallengeHallDuel dw ScriptCommand_PrintTextForChallengeCup dw ScriptCommand_MoveChallengeHallNPC diff --git a/src/engine/home.asm b/src/engine/home.asm index 8e5233b..8ccfa5d 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10750,31 +10750,35 @@ CopyGfxDataFromTempBank: ; 395a (0:395a) call BankswitchROM ret -Unknown_396b: ; 396b (0:396b) - db $00, -$01, $01, $00, $00, $01, -$01, $00 - ; Movement offsets for player movements -PlayerMovementOffsetTable: ; 3973 (0:3973) - db 0, -2 ; move 2 tiles up - db 2, 0 ; move 2 tiles right - db 0, 2 ; move 2 tiles down - db -2, 0 ; move 2 tiles left - -Unknown_397b: ; 397b (0:397b) - dw $0323 - dw $0323 - dw $0324 - dw $0325 - dw $0326 - dw $0327 - dw $0328 - dw $0329 - dw $032a - dw $032b - dw $032c - dw $032d - dw $032e - dw $032f +PlayerMovementOffsetTable: ; 396b (0:396b) + db 0, -1 ; NORTH + db 1, 0 ; EAST + db 0, 1 ; SOUTH + db -1, 0 ; WEST + +; Movement offsets for player movements, in tiles +PlayerMovementOffsetTable_Tiles: ; 3973 (0:3973) + db 0, -2 ; NORTH + db 2, 0 ; EAST + db 0, 2 ; SOUTH + db -2, 0 ; WEST + +OverworldMapNames: ; 397b (0:397b) + tx OverworldMapMasonLaboratoryText + tx OverworldMapMasonLaboratoryText + tx OverworldMapIshiharasHouseText + tx OverworldMapFightingClubText + tx OverworldMapRockClubText + tx OverworldMapWaterClubText + tx OverworldMapLightningClubText + tx OverworldMapGrassClubText + tx OverworldMapPsychicClubText + tx OverworldMapScienceClubText + tx OverworldMapFireClubText + tx OverworldMapChallengeHallText + tx OverworldMapPokemonDomeText + tx OverworldMapMysteryHouseText Func_3997: ; 3997 (0:3997) ldh a, [hBankROM] diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 828d5d4..61a0ecc 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -49,7 +49,7 @@ ENDM const ScriptCommand_JumpIfNPCLoaded_index ; $29 const ScriptCommand_ShowMedalReceivedScreen_index ; $2a const ScriptCommand_LoadCurrentMapNameIntoTxRamSlot_index ; $2b - const ScriptCommand_LoadActiveNPCNameIntoTxRamSlot_index ; $2c + const ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot_index ; $2c const ScriptCommand_StartChallengeHallDuel_index ; $2d const ScriptCommand_PrintTextForChallengeCup_index ; $2e const ScriptCommand_MoveChallengeHallNPC_index ; $2f @@ -334,9 +334,9 @@ ENDM ; Sets some NPC sprite attributes set_sprite_attributes: MACRO run_command ScriptCommand_SetSpriteAttributes - db \1 ; Relates to LOADED_NPC_FIELD_05 - db \2 ; Relates to LOADED_NPC_FIELD_05 - db \3 ; Relates to LOADED_NPC_FIELD_06 + db \1 ; Relates to LOADED_NPC_FIELD_06 + db \2 ; Relates to LOADED_NPC_FIELD_06 + db \3 ; Relates to LOADED_NPC_FIELD_05 ENDM ; Sets the active NPC's coords @@ -398,9 +398,9 @@ load_current_map_name_into_txram_slot: MACRO db \1 ; TxRam slot ENDM -; Loads the active NPC name into the given txram slot -load_active_npc_name_into_txram_slot: MACRO - run_command ScriptCommand_LoadActiveNPCNameIntoTxRamSlot +; Loads the challenge hall opponent NPC name into the given txram slot +load_challenge_hall_npc_into_txram_slot: MACRO + run_command ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot db \1 ; TxRam slot ENDM diff --git a/src/text/text3.asm b/src/text/text3.asm index ac0adb1..7699e08 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -942,55 +942,55 @@ Text0322: ; 3e64c (f:664c) line "" done -Text0323: ; 3e660 (f:6660) +OverworldMapMasonLaboratoryText: ; 3e660 (f:6660) text " Mason Laboratory " done -Text0324: ; 3e676 (f:6676) +OverworldMapIshiharasHouseText: ; 3e676 (f:6676) text " ISHIHARA's House " done -Text0325: ; 3e68c (f:668c) +OverworldMapFightingClubText: ; 3e68c (f:668c) text " Fighting Club " done -Text0326: ; 3e6a2 (f:66a2) +OverworldMapRockClubText: ; 3e6a2 (f:66a2) text " Rock Club " done -Text0327: ; 3e6b8 (f:66b8) +OverworldMapWaterClubText: ; 3e6b8 (f:66b8) text " Water Club " done -Text0328: ; 3e6ce (f:66ce) +OverworldMapLightningClubText: ; 3e6ce (f:66ce) text " Lightning Club " done -Text0329: ; 3e6e4 (f:66e4) +OverworldMapGrassClubText: ; 3e6e4 (f:66e4) text " Grass Club " done -Text032a: ; 3e6fa (f:66fa) +OverworldMapPsychicClubText: ; 3e6fa (f:66fa) text " Psychic Club " done -Text032b: ; 3e710 (f:6710) +OverworldMapScienceClubText: ; 3e710 (f:6710) text " Science Club " done -Text032c: ; 3e726 (f:6726) +OverworldMapFireClubText: ; 3e726 (f:6726) text " Fire Club " done -Text032d: ; 3e73c (f:673c) +OverworldMapChallengeHallText: ; 3e73c (f:673c) text " Challenge Hall " done -Text032e: ; 3e752 (f:6752) +OverworldMapPokemonDomeText: ; 3e752 (f:6752) text " Pokémon Dome " done -Text032f: ; 3e768 (f:6768) +OverworldMapMysteryHouseText: ; 3e768 (f:6768) text " ??'s House " done @@ -1055,7 +1055,7 @@ PauseMenuOptionsText: ; 3e810 (f:6810) line "Exit" done -Text033e: ; 3e834 (f:6834) +DebugPauseMenuOptionsText: ; 3e834 (f:6834) text "Status" line "Diary" line "Deck" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index c72a57e..ff757fe 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -804,19 +804,19 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0320 ; 0x0320 textpointer Text0321 ; 0x0321 textpointer Text0322 ; 0x0322 - textpointer Text0323 ; 0x0323 - textpointer Text0324 ; 0x0324 - textpointer Text0325 ; 0x0325 - textpointer Text0326 ; 0x0326 - textpointer Text0327 ; 0x0327 - textpointer Text0328 ; 0x0328 - textpointer Text0329 ; 0x0329 - textpointer Text032a ; 0x032a - textpointer Text032b ; 0x032b - textpointer Text032c ; 0x032c - textpointer Text032d ; 0x032d - textpointer Text032e ; 0x032e - textpointer Text032f ; 0x032f + textpointer OverworldMapMasonLaboratoryText ; 0x0323 + textpointer OverworldMapIshiharasHouseText ; 0x0324 + textpointer OverworldMapFightingClubText ; 0x0325 + textpointer OverworldMapRockClubText ; 0x0326 + textpointer OverworldMapWaterClubText ; 0x0327 + textpointer OverworldMapLightningClubText ; 0x0328 + textpointer OverworldMapGrassClubText ; 0x0329 + textpointer OverworldMapPsychicClubText ; 0x032a + textpointer OverworldMapScienceClubText ; 0x032b + textpointer OverworldMapFireClubText ; 0x032c + textpointer OverworldMapChallengeHallText ; 0x032d + textpointer OverworldMapPokemonDomeText ; 0x032e + textpointer OverworldMapMysteryHouseText ; 0x032f textpointer MasonLaboratoryMapNameText ; 0x0330 textpointer MrIshiharasHouseMapNameText ; 0x0331 textpointer FightingClubMapNameText ; 0x0332 @@ -831,7 +831,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer PokemonDomeMapNameText ; 0x033b textpointer Text033c ; 0x033c textpointer PauseMenuOptionsText ; 0x033d - textpointer Text033e ; 0x033e + textpointer DebugPauseMenuOptionsText ; 0x033e textpointer PlayerStatusNameText ; 0x033f textpointer PlayerStatusAlbumText ; 0x0340 textpointer PlayerStatusPlayTimeText ; 0x0341 diff --git a/tools/script_extractor2.py b/tools/script_extractor2.py index db9dd3c..e406e68 100755 --- a/tools/script_extractor2.py +++ b/tools/script_extractor2.py @@ -68,7 +68,7 @@ script_commands = { 0x29: { "name": "jump_if_npc_loaded", "params": [ "npc", "label" ] }, 0x2a: { "name": "show_medal_received_screen", "params": [ "event" ] }, 0x2b: { "name": "load_current_map_name_into_txram_slot", "params": [ "byte" ] }, - 0x2c: { "name": "load_active_npc_name_into_txram_slot", "params": [ "byte" ] }, + 0x2c: { "name": "load_challenge_hall_npc_into_txram_slot", "params": [ "byte" ] }, 0x2d: { "name": "start_challenge_hall_duel", "params": [ "prizes", "deck", "song" ] }, 0x2e: { "name": "print_text_for_challenge_cup", "params": [ "text", "text", "text" ] }, 0x2f: { "name": "move_challenge_hall_npc", "params": [ "movement" ] }, -- cgit v1.2.3 From 8a71ce39643684d73f67c87d650d3f352e55103f Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Tue, 19 Jan 2021 01:23:31 -0600 Subject: Rename all event constants --- src/constants/script_constants.asm | 238 +++--- src/engine/bank03.asm | 1578 ++++++++++++++++++------------------ src/engine/home.asm | 2 +- src/macros/scripts.asm | 28 +- tools/constants.py | 216 ++--- 5 files changed, 1037 insertions(+), 1025 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index ba5301c..358acc3 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -1,123 +1,123 @@ const_def - const EVENT_FLAG_00 ; $00 - const EVENT_FLAG_01 ; $01 - const EVENT_TEMP_TALKED_TO_IMAKUNI ; $02 - const EVENT_TEMP_DUELED_IMAKUNI ; $03 - const EVENT_FLAG_04 ; $04 - const EVENT_FLAG_05 ; $05 - const EVENT_FLAG_06 ; $06 - const EVENT_FLAG_07 ; $07 - const EVENT_FLAG_08 ; $08 - const EVENT_FLAG_09 ; $09 - const EVENT_FLAG_0A ; $0a - const EVENT_BEAT_AMY ; $0b - const EVENT_FLAG_0C ; $0c - const EVENT_FLAG_0D ; $0d - const EVENT_FLAG_0E ; $0e - const EVENT_FLAG_0F ; $0f - const EVENT_FLAG_10 ; $10 - const EVENT_FLAG_11 ; $11 - const EVENT_FLAG_12 ; $12 - const EVENT_IMAKUNI_STATE ; $13 - const EVENT_FLAG_14 ; $14 - const EVENT_BEAT_SARA ; $15 - const EVENT_BEAT_AMANDA ; $16 - const EVENT_FLAG_17 ; $17 - const EVENT_FLAG_18 ; $18 - const EVENT_FLAG_19 ; $19 - const EVENT_FLAG_1A ; $1a - const EVENT_FLAG_1B ; $1b - const EVENT_FLAG_1C ; $1c - const EVENT_FLAG_1D ; $1d - const EVENT_FLAG_1E ; $1e - const EVENT_FLAG_1F ; $1f - const EVENT_FLAG_20 ; $20 - const EVENT_FLAG_21 ; $21 - const EVENT_RECEIVED_LEGENDARY_CARD ; $22 - const EVENT_FLAG_23 ; $23 - const EVENT_FLAG_24 ; $24 - const EVENT_FLAG_25 ; $25 - const EVENT_FLAG_26 ; $26 - const EVENT_FLAG_27 ; $27 - const EVENT_FLAG_28 ; $28 - const EVENT_FLAG_29 ; $29 - const EVENT_FLAG_2A ; $2a - const EVENT_FLAG_2B ; $2b - const EVENT_FLAG_2C ; $2c - const EVENT_FLAG_2D ; $2d - const EVENT_MEDAL_COUNT ; $2e - const EVENT_FLAG_2F ; $2f - const EVENT_FLAG_30 ; $30 - const EVENT_FLAG_31 ; $31 - const EVENT_FLAG_32 ; $32 - const EVENT_JOSHUA_STATE ; $33 - const EVENT_IMAKUNI_ROOM ; $34 - const EVENT_FLAG_35 ; $35 - const EVENT_IMAKUNI_WIN_COUNT ; $36 - const EVENT_FLAG_37 ; $37 - const EVENT_FLAG_38 ; $38 - const EVENT_FLAG_39 ; $39 - const EVENT_FLAG_3A ; $3a - const EVENT_FLAG_3B ; $3b - const EVENT_BEAT_BRITTANY ; $3c - const EVENT_FLAG_3D ; $3d - const EVENT_FLAG_3E ; $3e - const EVENT_FLAG_3F ; $3f - const EVENT_FLAG_40 ; $40 - const EVENT_FLAG_41 ; $41 - const EVENT_FLAG_42 ; $42 - const EVENT_FLAG_43 ; $43 - const EVENT_FLAG_44 ; $44 - const EVENT_FLAG_45 ; $45 - const EVENT_FLAG_46 ; $46 - const EVENT_FLAG_47 ; $47 - const EVENT_FLAG_48 ; $48 - const EVENT_FLAG_49 ; $49 - const EVENT_FLAG_4A ; $4a - const EVENT_FLAG_4B ; $4b - const EVENT_FLAG_4C ; $4c - const EVENT_FLAG_4D ; $4d - const EVENT_FLAG_4E ; $4e - const EVENT_FLAG_4F ; $4f - const EVENT_FLAG_50 ; $50 - const EVENT_FLAG_51 ; $51 - const EVENT_FLAG_52 ; $52 - const EVENT_FLAG_53 ; $53 - const EVENT_FLAG_54 ; $54 - const EVENT_FLAG_55 ; $55 - const EVENT_FLAG_56 ; $56 - const EVENT_FLAG_57 ; $57 - const EVENT_FLAG_58 ; $58 - const EVENT_FLAG_59 ; $59 - const EVENT_FLAG_5A ; $5a - const EVENT_FLAG_5B ; $5b - const EVENT_FLAG_5C ; $5c - const EVENT_FLAG_5D ; $5d - const EVENT_FLAG_5E ; $5e - const EVENT_FLAG_5F ; $5f - const EVENT_FLAG_60 ; $60 - const EVENT_FLAG_61 ; $61 - const EVENT_FLAG_62 ; $62 - const EVENT_FLAG_63 ; $63 - const EVENT_FLAG_64 ; $64 - const EVENT_FLAG_65 ; $65 - const EVENT_FLAG_66 ; $66 - const EVENT_FLAG_67 ; $67 - const EVENT_FLAG_68 ; $68 - const EVENT_FLAG_69 ; $69 - const EVENT_FLAG_6A ; $6a - const EVENT_FLAG_6B ; $6b - const EVENT_FLAG_6C ; $6c - const EVENT_FLAG_6D ; $6d - const EVENT_FLAG_6E ; $6e - const EVENT_FLAG_6F ; $6f - const EVENT_FLAG_70 ; $70 - const EVENT_FLAG_71 ; $71 - const EVENT_FLAG_72 ; $72 - const EVENT_FLAG_73 ; $73 - const EVENT_FLAG_74 ; $74 - const EVENT_FLAG_75 ; $75 - const EVENT_FLAG_76 ; $76 + const EVENT_TEMP_TRADED_WITH_ISHIHARA ; $00 + const EVENT_TEMP_GIFTED_TO_MAN1 ; $01 + const EVENT_TEMP_TALKED_TO_IMAKUNI ; $02 + const EVENT_TEMP_DUELED_IMAKUNI ; $03 + const EVENT_TEMP_TRADED_WITH_LASS2 ; $04 + const EVENT_TEMP_05 ; $05 + const EVENT_TEMP_06 ; $06 + const EVENT_TEMP_07 ; $07 + const EVENT_BEAT_NIKKI ; $08 + const EVENT_BEAT_RICK ; $09 + const EVENT_BEAT_KEN ; $0a + const EVENT_BEAT_AMY ; $0b + const EVENT_BEAT_ISAAC ; $0c + const EVENT_BEAT_MURRAY ; $0d + const EVENT_BEAT_GENE ; $0e + const EVENT_BEAT_MITCH ; $0f + const EVENT_MEDAL_FLAGS ; $10 + const EVENT_PUPIL_MICHAEL_STATE ; $11 + const EVENT_GAL1_TRADE_STATE ; $12 + const EVENT_IMAKUNI_STATE ; $13 + const EVENT_LASS1_MENTIONED_IMAKUNI ; $14 + const EVENT_BEAT_SARA ; $15 + const EVENT_BEAT_AMANDA ; $16 + const EVENT_PUPIL_CHRIS_STATE ; $17 + const EVENT_MATTHEW_STATE ; $18 + const EVENT_CHAP2_TRADE_STATE ; $19 + const EVENT_DAVID_STATE ; $1a + const EVENT_JOSEPH_STATE ; $1b + const EVENT_ISHIHARA_MENTIONED ; $1c + const EVENT_ISHIHARA_MET ; $1d + const EVENT_ISHIHARAS_HOUSE_MENTIONED ; $1e + const EVENT_ISHIHARA_TRADE_STATE ; $1f + const EVENT_PUPIL_JESSICA_STATE ; $20 + const EVENT_LAD2_STATE ; $21 + const EVENT_RECEIVED_LEGENDARY_CARDS ; $22 + const EVENT_KEN_HAD_ENOUGH_CARDS ; $23 + const EVENT_KEN_TALKED ; $24 + const EVENT_BEAT_JENNIFER ; $25 + const EVENT_BEAT_NICHOLAS ; $26 + const EVENT_BEAT_BRANDON ; $27 + const EVENT_ISAAC_TALKED ; $28 + const EVENT_MAN1_TALKED ; $29 + const EVENT_MAN1_WAITING_FOR_CARD ; $2a + const EVENT_MAN1_REQUESTED_CARD_ID ; $2b + const EVENT_MAN1_GIFT_SEQUENCE_STATE ; $2c + const EVENT_MAN1_GIFTED_CARD_FLAGS ; $2d + const EVENT_MEDAL_COUNT ; $2e + const EVENT_DANIEL_TALKED ; $2f + const EVENT_MURRAY_TALKED ; $30 + const EVENT_PAPPY1_STATE ; $31 + const EVENT_RONALD_PSYCHIC_CLUB_LOBBY_ENCOUNTER ; $32 + const EVENT_JOSHUA_STATE ; $33 + const EVENT_IMAKUNI_ROOM ; $34 + const EVENT_NIKKI_STATE ; $35 + const EVENT_IMAKUNI_WIN_COUNT ; $36 + const EVENT_LASS2_TRADE_STATE ; $37 + const EVENT_ISHIHARA_WANTS_TO_TRADE ; $38 + const EVENT_ISHIHARA_CONGRATULATED_PLAYER ; $39 + const EVENT_BEAT_KRISTIN ; $3a + const EVENT_BEAT_HEATHER ; $3b + const EVENT_BEAT_BRITTANY ; $3c + const EVENT_DRMASON_CONGRATULATED_PLAYER ; $3d + const EVENT_MASON_LAB_STATE ; $3e + const EVENT_CHALLENGE_CUP_1_STATE ; $3f + const EVENT_CHALLENGE_CUP_2_STATE ; $40 + const EVENT_CHALLENGE_CUP_3_STATE ; $41 + const EVENT_CHALLENGE_CUP_STARTING ; $42 + const EVENT_CHALLENGE_CUP_STAGE_VISITED ; $43 + const EVENT_CHALLENGE_CUP_NUMBER ; $44 + const EVENT_CHALLENGE_CUP_OPPONENT_NUMBER ; $45 + const EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN ; $46 + const EVENT_CHALLENGE_CUP_IN_MENU ; $47 + const EVENT_CHALLENGE_CUP_1_RESULT ; $48 + const EVENT_CHALLENGE_CUP_2_RESULT ; $49 + const EVENT_CHALLENGE_CUP_3_RESULT ; $4a + const EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER ; $4b + const EVENT_RONALD_FIRST_DUEL_STATE ; $4c + const EVENT_RONALD_SECOND_DUEL_STATE ; $4d + const EVENT_RONALD_TALKED ; $4e + const EVENT_RONALD_POKEMON_DOME_ENTRANCE_ENCOUNTER ; $4f + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_1 ; $50 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2 ; $51 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_3 ; $52 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_4 ; $53 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_5 ; $54 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6 ; $55 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_7 ; $56 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_8 ; $57 + const EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE ; $58 + const EVENT_PLAYER_ENTERED_CHALLENGE_CUP ; $59 + const EVENT_FIGHTING_DECK_MACHINE_ACTIVE ; $5a + const EVENT_ROCK_DECK_MACHINE_ACTIVE ; $5b + const EVENT_WATER_DECK_MACHINE_ACTIVE ; $5c + const EVENT_LIGHTNING_DECK_MACHINE_ACTIVE ; $5d + const EVENT_GRASS_DECK_MACHINE_ACTIVE ; $5e + const EVENT_PSYCHIC_DECK_MACHINE_ACTIVE ; $5f + const EVENT_SCIENCE_DECK_MACHINE_ACTIVE ; $60 + const EVENT_FIRE_DECK_MACHINE_ACTIVE ; $61 + const EVENT_ALL_DECK_MACHINE_FLAGS ; $62 + const EVENT_HALL_OF_HONOR_DOORS_OPEN ; $63 + const EVENT_CHALLENGED_GRAND_MASTERS ; $64 + const EVENT_POKEMON_DOME_STATE ; $65 + const EVENT_POKEMON_DOME_IN_MENU ; $66 + const EVENT_CHALLENGED_RONALD ; $67 + const EVENT_COURTNEY_STATE ; $68 + const EVENT_STEVE_STATE ; $69 + const EVENT_JACK_STATE ; $6a + const EVENT_ROD_STATE ; $6b + const EVENT_RONALD_POKEMON_DOME_STATE ; $6c + const EVENT_RECEIVED_ZAPDOS ; $6d + const EVENT_RECEIVED_MOLTRES ; $6e + const EVENT_RECEIVED_ARTICUNO ; $6f + const EVENT_RECEIVED_DRAGONITE ; $70 + const EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS ; $71 + const EVENT_GIFT_CENTER_MENU_CHOICE ; $72 + const EVENT_AARON_BOOSTER_REWARD ; $73 + const EVENT_CONSOLE ; $74 + const EVENT_SAM_TUTORIAL_MENU_CHOICE ; $75 + const EVENT_AARON_DECK_MENU_CHOICE ; $76 EVENT_FLAG_AMOUNT EQU const_value EVENT_FLAG_BYTES EQU $40 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 3734f05..7a5884e 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -739,6 +739,7 @@ HandlePlayerMoveMode: ; c510 (3:4510) bit 1, a call nz, Func_c6dc ret + .not_moving ldh a, [hKeysPressed] and START @@ -764,6 +765,7 @@ Func_c554: ; c554 (3:4554) jr nz, .not_ow_map farcall Func_10e28 ret + .not_ow_map push hl push bc @@ -1080,6 +1082,7 @@ FindNPCOrObject: ; c71e (3:471e) .exit or a ret + .set_mode ld [wOverworldMode], a scf @@ -1519,32 +1522,33 @@ ImakuniPossibleRooms: ; ca0a (3:4a04) Func_ca0e: ; ca0e (3:4a0e) ld a, [wd32e] cp $b - jr z, .asm_ca68 - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + jr z, .done + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a - jr nz, .asm_ca4a - get_flag_value EVENT_FLAG_40 + jr nz, .challenge_cup_three +; challenge cup two + get_flag_value EVENT_CHALLENGE_CUP_2_STATE cp $7 - jr z, .asm_ca68 + jr z, .done or a - jr z, .asm_ca33 + jr z, .challenge_cup_one cp $2 - jr z, .asm_ca62 + jr z, .close_challenge_cup_one ld c, $1 - set_flag_value EVENT_FLAG_40 - jr .asm_ca62 -.asm_ca33 - get_flag_value EVENT_FLAG_3F + set_flag_value EVENT_CHALLENGE_CUP_2_STATE + jr .close_challenge_cup_one +.challenge_cup_one + get_flag_value EVENT_CHALLENGE_CUP_1_STATE cp $7 - jr z, .asm_ca68 + jr z, .done or a - jr z, .asm_ca68 + jr z, .done cp $2 - jr z, .asm_ca68 + jr z, .done ld c, $1 - set_flag_value EVENT_FLAG_3F - jr .asm_ca68 -.asm_ca4a + set_flag_value EVENT_CHALLENGE_CUP_1_STATE + jr .done +.challenge_cup_three call UpdateRNGSources ld c, $1 and $3 @@ -1552,15 +1556,15 @@ Func_ca0e: ; ca0e (3:4a0e) jr z, .asm_ca56 ld c, $0 .asm_ca56 - set_flag_value EVENT_FLAG_41 - jr .asm_ca5c -.asm_ca5c + set_flag_value EVENT_CHALLENGE_CUP_3_STATE + jr .close_challenge_cup_two +.close_challenge_cup_two ld c, $7 - set_flag_value EVENT_FLAG_40 -.asm_ca62 + set_flag_value EVENT_CHALLENGE_CUP_2_STATE +.close_challenge_cup_one ld c, $7 - set_flag_value EVENT_FLAG_3F -.asm_ca68 + set_flag_value EVENT_CHALLENGE_CUP_1_STATE +.done ret GetStackFlagValue: ; ca69 (3:4a69) @@ -1712,14 +1716,14 @@ TryGiveMedalPCPacks: ; cad8 (3:4ad8) ret MedalEventFlags: ; cb15 (3:4b15) - db EVENT_FLAG_08 - db EVENT_FLAG_09 - db EVENT_FLAG_0A + db EVENT_BEAT_NIKKI + db EVENT_BEAT_RICK + db EVENT_BEAT_KEN db EVENT_BEAT_AMY - db EVENT_FLAG_0C - db EVENT_FLAG_0D - db EVENT_FLAG_0E - db EVENT_FLAG_0F + db EVENT_BEAT_ISAAC + db EVENT_BEAT_MURRAY + db EVENT_BEAT_GENE + db EVENT_BEAT_MITCH ; returns wEventFlags byte in hl, related bits in wLoadedFlagBits GetEventFlag: ; cb1d (3:4b1d) @@ -1745,125 +1749,125 @@ GetEventFlag: ; cb1d (3:4b1d) ; mask - which bits in the byte hold the value ; events 0-7 are reset when game resets EventFlagMasks: ; cb37 (3:4b37) - flag_def $3f, %10000000 ; EVENT_FLAG_00 - flag_def $3f, %01000000 ; EVENT_FLAG_01 + flag_def $3f, %10000000 ; EVENT_TEMP_TRADED_WITH_ISHIHARA + flag_def $3f, %01000000 ; EVENT_TEMP_GIFTED_TO_MAN1 flag_def $3f, %00100000 ; EVENT_TEMP_TALKED_TO_IMAKUNI flag_def $3f, %00010000 ; EVENT_TEMP_DUELED_IMAKUNI - flag_def $3f, %00001000 ; EVENT_FLAG_04 - flag_def $3f, %00000100 ; EVENT_FLAG_05 - flag_def $3f, %00000010 ; EVENT_FLAG_06 - flag_def $3f, %00000001 ; EVENT_FLAG_07 - flag_def $00, %10000000 ; EVENT_FLAG_08 - flag_def $00, %01000000 ; EVENT_FLAG_09 - flag_def $00, %00100000 ; EVENT_FLAG_0A + flag_def $3f, %00001000 ; EVENT_TEMP_TRADED_WITH_LASS2 + flag_def $3f, %00000100 ; EVENT_TEMP_05 unused? + flag_def $3f, %00000010 ; EVENT_TEMP_06 unused? + flag_def $3f, %00000001 ; EVENT_TEMP_07 unused? + flag_def $00, %10000000 ; EVENT_BEAT_NIKKI + flag_def $00, %01000000 ; EVENT_BEAT_RICK + flag_def $00, %00100000 ; EVENT_BEAT_KEN flag_def $00, %00010000 ; EVENT_BEAT_AMY - flag_def $00, %00001000 ; EVENT_FLAG_0C - flag_def $00, %00000100 ; EVENT_FLAG_0D - flag_def $00, %00000010 ; EVENT_FLAG_0E - flag_def $00, %00000001 ; EVENT_FLAG_0F - flag_def $00, %11111111 ; EVENT_FLAG_10 - flag_def $01, %11110000 ; EVENT_FLAG_11 - flag_def $01, %00001111 ; EVENT_FLAG_12 + flag_def $00, %00001000 ; EVENT_BEAT_ISAAC + flag_def $00, %00000100 ; EVENT_BEAT_MURRAY + flag_def $00, %00000010 ; EVENT_BEAT_GENE + flag_def $00, %00000001 ; EVENT_BEAT_MITCH + flag_def $00, %11111111 ; EVENT_MEDAL_FLAGS + flag_def $01, %11110000 ; EVENT_PUPIL_MICHAEL_STATE + flag_def $01, %00001111 ; EVENT_GAL1_TRADE_STATE flag_def $02, %11000000 ; EVENT_IMAKUNI_STATE - flag_def $02, %00110000 ; EVENT_FLAG_14 + flag_def $02, %00110000 ; EVENT_LASS1_MENTIONED_IMAKUNI flag_def $02, %00001000 ; EVENT_BEAT_SARA flag_def $02, %00000100 ; EVENT_BEAT_AMANDA - flag_def $03, %11110000 ; EVENT_FLAG_17 - flag_def $03, %00001111 ; EVENT_FLAG_18 - flag_def $04, %11110000 ; EVENT_FLAG_19 - flag_def $04, %00001111 ; EVENT_FLAG_1A - flag_def $05, %10000000 ; EVENT_FLAG_1B - flag_def $05, %01000000 ; EVENT_FLAG_1C - flag_def $05, %00100000 ; EVENT_FLAG_1D - flag_def $05, %00010000 ; EVENT_FLAG_1E - flag_def $05, %00001111 ; EVENT_FLAG_1F - flag_def $06, %11110000 ; EVENT_FLAG_20 - flag_def $06, %00001100 ; EVENT_FLAG_21 - flag_def $06, %00000010 ; EVENT_RECEIVED_LEGENDARY_CARD - flag_def $06, %00000001 ; EVENT_FLAG_23 - flag_def $07, %11000000 ; EVENT_FLAG_24 - flag_def $07, %00100000 ; EVENT_FLAG_25 - flag_def $07, %00010000 ; EVENT_FLAG_26 - flag_def $07, %00001000 ; EVENT_FLAG_27 - flag_def $07, %00000100 ; EVENT_FLAG_28 - flag_def $07, %00000010 ; EVENT_FLAG_29 - flag_def $07, %00000001 ; EVENT_FLAG_2A - flag_def $08, %11111111 ; EVENT_FLAG_2B - flag_def $09, %11100000 ; EVENT_FLAG_2C - flag_def $09, %00011111 ; EVENT_FLAG_2D + flag_def $03, %11110000 ; EVENT_PUPIL_CHRIS_STATE + flag_def $03, %00001111 ; EVENT_MATTHEW_STATE + flag_def $04, %11110000 ; EVENT_CHAP2_TRADE_STATE + flag_def $04, %00001111 ; EVENT_DAVID_STATE + flag_def $05, %10000000 ; EVENT_JOSEPH_STATE + flag_def $05, %01000000 ; EVENT_ISHIHARA_MENTIONED + flag_def $05, %00100000 ; EVENT_ISHIHARA_MET + flag_def $05, %00010000 ; EVENT_ISHIHARAS_HOUSE_MENTIONED + flag_def $05, %00001111 ; EVENT_ISHIHARA_TRADE_STATE + flag_def $06, %11110000 ; EVENT_PUPIL_JESSICA_STATE + flag_def $06, %00001100 ; EVENT_LAD2_STATE + flag_def $06, %00000010 ; EVENT_RECEIVED_LEGENDARY_CARDS + flag_def $06, %00000001 ; EVENT_KEN_HAD_ENOUGH_CARDS + flag_def $07, %11000000 ; EVENT_KEN_TALKED + flag_def $07, %00100000 ; EVENT_BEAT_JENNIFER + flag_def $07, %00010000 ; EVENT_BEAT_NICHOLAS + flag_def $07, %00001000 ; EVENT_BEAT_BRANDON + flag_def $07, %00000100 ; EVENT_ISAAC_TALKED + flag_def $07, %00000010 ; EVENT_MAN1_TALKED + flag_def $07, %00000001 ; EVENT_MAN1_WAITING_FOR_CARD + flag_def $08, %11111111 ; EVENT_MAN1_REQUESTED_CARD_ID + flag_def $09, %11100000 ; EVENT_MAN1_GIFT_SEQUENCE_STATE + flag_def $09, %00011111 ; EVENT_MAN1_GIFTED_CARD_FLAGS flag_def $0a, %11110000 ; EVENT_MEDAL_COUNT - flag_def $0a, %00001000 ; EVENT_FLAG_2F - flag_def $0a, %00000100 ; EVENT_FLAG_30 - flag_def $0a, %00000011 ; EVENT_FLAG_31 - flag_def $0b, %10000000 ; EVENT_FLAG_32 + flag_def $0a, %00001000 ; EVENT_DANIEL_TALKED + flag_def $0a, %00000100 ; EVENT_MURRAY_TALKED + flag_def $0a, %00000011 ; EVENT_PAPPY1_STATE + flag_def $0b, %10000000 ; EVENT_RONALD_PSYCHIC_CLUB_LOBBY_ENCOUNTER flag_def $0b, %01110000 ; EVENT_JOSHUA_STATE flag_def $0b, %00001100 ; EVENT_IMAKUNI_ROOM - flag_def $0b, %00000011 ; EVENT_FLAG_35 + flag_def $0b, %00000011 ; EVENT_NIKKI_STATE flag_def $0c, %11100000 ; EVENT_IMAKUNI_WIN_COUNT - flag_def $0c, %00011100 ; EVENT_FLAG_37 - flag_def $0c, %00000010 ; EVENT_FLAG_38 - flag_def $0c, %00000001 ; EVENT_FLAG_39 - flag_def $0d, %10000000 ; EVENT_FLAG_3A - flag_def $0d, %01000000 ; EVENT_FLAG_3B + flag_def $0c, %00011100 ; EVENT_LASS2_TRADE_STATE + flag_def $0c, %00000010 ; EVENT_ISHIHARA_WANTS_TO_TRADE + flag_def $0c, %00000001 ; EVENT_ISHIHARA_CONGRATULATED_PLAYER + flag_def $0d, %10000000 ; EVENT_BEAT_KRISTIN + flag_def $0d, %01000000 ; EVENT_BEAT_HEATHER flag_def $0d, %00100000 ; EVENT_BEAT_BRITTANY - flag_def $0d, %00010000 ; EVENT_FLAG_3D - flag_def $0d, %00001110 ; EVENT_FLAG_3E - flag_def $0e, %11100000 ; EVENT_FLAG_3F - flag_def $0e, %00011100 ; EVENT_FLAG_40 - flag_def $0f, %11100000 ; EVENT_FLAG_41 - flag_def $10, %10000000 ; EVENT_FLAG_42 - flag_def $10, %01000000 ; EVENT_FLAG_43 - flag_def $10, %00110000 ; EVENT_FLAG_44 - flag_def $10, %00001100 ; EVENT_FLAG_45 - flag_def $10, %00000010 ; EVENT_FLAG_46 - flag_def $10, %00000001 ; EVENT_FLAG_47 - flag_def $11, %11100000 ; EVENT_FLAG_48 - flag_def $11, %00011100 ; EVENT_FLAG_49 - flag_def $12, %11100000 ; EVENT_FLAG_4A - flag_def $13, %10000000 ; EVENT_FLAG_4B - flag_def $13, %01100000 ; EVENT_FLAG_4C - flag_def $13, %00011000 ; EVENT_FLAG_4D - flag_def $13, %00000100 ; EVENT_FLAG_4E - flag_def $13, %00000010 ; EVENT_FLAG_4F - flag_def $14, %10000000 ; EVENT_FLAG_50 - flag_def $14, %01000000 ; EVENT_FLAG_51 - flag_def $14, %00100000 ; EVENT_FLAG_52 - flag_def $14, %00010000 ; EVENT_FLAG_53 - flag_def $14, %00001000 ; EVENT_FLAG_54 - flag_def $14, %00000100 ; EVENT_FLAG_55 - flag_def $14, %00000010 ; EVENT_FLAG_56 - flag_def $14, %00000001 ; EVENT_FLAG_57 - flag_def $15, %11110000 ; EVENT_FLAG_58 - flag_def $15, %00001000 ; EVENT_FLAG_59 - flag_def $16, %10000000 ; EVENT_FLAG_5A - flag_def $16, %01000000 ; EVENT_FLAG_5B - flag_def $16, %00100000 ; EVENT_FLAG_5C - flag_def $16, %00010000 ; EVENT_FLAG_5D - flag_def $16, %00001000 ; EVENT_FLAG_5E - flag_def $16, %00000100 ; EVENT_FLAG_5F - flag_def $16, %00000010 ; EVENT_FLAG_60 - flag_def $16, %00000001 ; EVENT_FLAG_61 - flag_def $16, %11111111 ; EVENT_FLAG_62 - flag_def $17, %10000000 ; EVENT_FLAG_63 - flag_def $17, %01000000 ; EVENT_FLAG_64 - flag_def $17, %00110000 ; EVENT_FLAG_65 - flag_def $17, %00001000 ; EVENT_FLAG_66 - flag_def $17, %00000100 ; EVENT_FLAG_67 - flag_def $18, %11000000 ; EVENT_FLAG_68 - flag_def $18, %00110000 ; EVENT_FLAG_69 - flag_def $18, %00001100 ; EVENT_FLAG_6A - flag_def $18, %00000011 ; EVENT_FLAG_6B - flag_def $19, %11000000 ; EVENT_FLAG_6C - flag_def $19, %00100000 ; EVENT_FLAG_6D - flag_def $19, %00010000 ; EVENT_FLAG_6E - flag_def $19, %00001000 ; EVENT_FLAG_6F - flag_def $19, %00000100 ; EVENT_FLAG_70 - flag_def $19, %00111100 ; EVENT_FLAG_71 - flag_def $1a, %11111100 ; EVENT_FLAG_72 - flag_def $1a, %00000011 ; EVENT_FLAG_73 - flag_def $1b, %11111111 ; EVENT_FLAG_74 - flag_def $1c, %11110000 ; EVENT_FLAG_75 - flag_def $1c, %00001111 ; EVENT_FLAG_76 + flag_def $0d, %00010000 ; EVENT_DRMASON_CONGRATULATED_PLAYER + flag_def $0d, %00001110 ; EVENT_MASON_LAB_STATE + flag_def $0e, %11100000 ; EVENT_CHALLENGE_CUP_1_STATE + flag_def $0e, %00011100 ; EVENT_CHALLENGE_CUP_2_STATE + flag_def $0f, %11100000 ; EVENT_CHALLENGE_CUP_3_STATE + flag_def $10, %10000000 ; EVENT_CHALLENGE_CUP_STARTING + flag_def $10, %01000000 ; EVENT_CHALLENGE_CUP_STAGE_VISITED + flag_def $10, %00110000 ; EVENT_CHALLENGE_CUP_NUMBER + flag_def $10, %00001100 ; EVENT_CHALLENGE_CUP_OPPONENT_NUMBER + flag_def $10, %00000010 ; EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN + flag_def $10, %00000001 ; EVENT_CHALLENGE_CUP_IN_MENU + flag_def $11, %11100000 ; EVENT_CHALLENGE_CUP_1_RESULT + flag_def $11, %00011100 ; EVENT_CHALLENGE_CUP_2_RESULT + flag_def $12, %11100000 ; EVENT_CHALLENGE_CUP_3_RESULT + flag_def $13, %10000000 ; EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER + flag_def $13, %01100000 ; EVENT_RONALD_FIRST_DUEL_STATE + flag_def $13, %00011000 ; EVENT_RONALD_SECOND_DUEL_STATE + flag_def $13, %00000100 ; EVENT_RONALD_TALKED + flag_def $13, %00000010 ; EVENT_RONALD_POKEMON_DOME_ENTRANCE_ENCOUNTER + flag_def $14, %10000000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_1 + flag_def $14, %01000000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2 + flag_def $14, %00100000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_3 + flag_def $14, %00010000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_4 + flag_def $14, %00001000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_5 + flag_def $14, %00000100 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6 + flag_def $14, %00000010 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_7 + flag_def $14, %00000001 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_8 + flag_def $15, %11110000 ; EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE + flag_def $15, %00001000 ; EVENT_PLAYER_ENTERED_CHALLENGE_CUP + flag_def $16, %10000000 ; EVENT_FIGHTING_DECK_MACHINE_ACTIVE + flag_def $16, %01000000 ; EVENT_ROCK_DECK_MACHINE_ACTIVE + flag_def $16, %00100000 ; EVENT_WATER_DECK_MACHINE_ACTIVE + flag_def $16, %00010000 ; EVENT_LIGHTNING_DECK_MACHINE_ACTIVE + flag_def $16, %00001000 ; EVENT_GRASS_DECK_MACHINE_ACTIVE + flag_def $16, %00000100 ; EVENT_PSYCHIC_DECK_MACHINE_ACTIVE + flag_def $16, %00000010 ; EVENT_SCIENCE_DECK_MACHINE_ACTIVE + flag_def $16, %00000001 ; EVENT_FIRE_DECK_MACHINE_ACTIVE + flag_def $16, %11111111 ; EVENT_ALL_DECK_MACHINE_FLAGS + flag_def $17, %10000000 ; EVENT_HALL_OF_HONOR_DOORS_OPEN + flag_def $17, %01000000 ; EVENT_CHALLENGED_GRAND_MASTERS + flag_def $17, %00110000 ; EVENT_POKEMON_DOME_STATE + flag_def $17, %00001000 ; EVENT_POKEMON_DOME_IN_MENU + flag_def $17, %00000100 ; EVENT_CHALLENGED_RONALD + flag_def $18, %11000000 ; EVENT_COURTNEY_STATE + flag_def $18, %00110000 ; EVENT_STEVE_STATE + flag_def $18, %00001100 ; EVENT_JACK_STATE + flag_def $18, %00000011 ; EVENT_ROD_STATE + flag_def $19, %11000000 ; EVENT_RONALD_POKEMON_DOME_STATE + flag_def $19, %00100000 ; EVENT_RECEIVED_ZAPDOS + flag_def $19, %00010000 ; EVENT_RECEIVED_MOLTRES + flag_def $19, %00001000 ; EVENT_RECEIVED_ARTICUNO + flag_def $19, %00000100 ; EVENT_RECEIVED_DRAGONITE + flag_def $19, %00111100 ; EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS + flag_def $1a, %11111100 ; EVENT_GIFT_CENTER_MENU_CHOICE + flag_def $1a, %00000011 ; EVENT_AARON_BOOSTER_REWARD + flag_def $1b, %11111111 ; EVENT_CONSOLE + flag_def $1c, %11110000 ; EVENT_SAM_TUTORIAL_MENU_CHOICE + flag_def $1c, %00001111 ; EVENT_AARON_DECK_MENU_CHOICE ; Used for basic level objects that just print text and quit PrintInteractableObjectText: ; cc25 (3:4c25) @@ -2137,7 +2141,7 @@ ScriptCommand_PrintVariableNPCText: ; cd83 (3:4d83) jp IncreaseScriptPointerBy5 ScriptCommand_PrintTextForChallengeCup: ; cd94 (3:4d94) - get_flag_value EVENT_FLAG_44 + get_flag_value EVENT_CHALLENGE_CUP_NUMBER dec a and %11 add a @@ -2478,19 +2482,19 @@ ScriptCommand_RemoveAllEnergyCardsFromCollection: ; cf7b (3:4f7b) ScriptCommand_JumpBasedOnFightingClubPupilStatus: ; cf96 (3:4f96) ld c, 0 - get_flag_value EVENT_FLAG_11 + get_flag_value EVENT_PUPIL_MICHAEL_STATE or a jr z, .first_interaction cp 8 jr c, .pupil1_not_defeated inc c .pupil1_not_defeated - get_flag_value EVENT_FLAG_17 + get_flag_value EVENT_PUPIL_CHRIS_STATE cp 8 jr c, .pupil2_not_defeated inc c .pupil2_not_defeated - get_flag_value EVENT_FLAG_20 + get_flag_value EVENT_PUPIL_JESSICA_STATE cp 8 jr c, .pupil3_not_defeated inc c @@ -2513,7 +2517,7 @@ ScriptCommand_SetActiveNPCDirection: ; cfc6 (3:4fc6) jp IncreaseScriptPointerBy2 ScriptCommand_PickNextMan1RequestedCard: ; cfd4 (3:4fd4) - get_flag_value EVENT_FLAG_2D + get_flag_value EVENT_MAN1_GIFTED_CARD_FLAGS ld b, a .choose_again ld a, Man1RequestedCardsList.end - Man1RequestedCardsList @@ -2536,13 +2540,13 @@ ScriptCommand_PickNextMan1RequestedCard: ; cfd4 (3:4fd4) or b push bc ld c, a - set_flag_value EVENT_FLAG_2D + set_flag_value EVENT_MAN1_GIFTED_CARD_FLAGS pop bc ld b, 0 ld hl, Man1RequestedCardsList add hl, bc ld c, [hl] - set_flag_value EVENT_FLAG_2B + set_flag_value EVENT_MAN1_REQUESTED_CARD_ID jp IncreaseScriptPointerBy1 Man1RequestedCardsList: ; d006 (3:5006) @@ -2559,7 +2563,7 @@ ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot: ; d00b (3:500b) ld hl, wTxRam2 add hl, bc push hl - get_flag_value EVENT_FLAG_2B + get_flag_value EVENT_MAN1_REQUESTED_CARD_ID ld e, a ld d, 0 call GetCardName @@ -2570,19 +2574,19 @@ ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot: ; d00b (3:500b) jp IncreaseScriptPointerBy2 ScriptCommand_JumpIfMan1RequestedCardOwned: ; d025 (3:5025) - get_flag_value EVENT_FLAG_2B + get_flag_value EVENT_MAN1_REQUESTED_CARD_ID call GetCardCountInCollectionAndDecks jp c, ScriptCommand_JumpIfAnyEnergyCardsInCollection.fail jp ScriptCommand_JumpIfAnyEnergyCardsInCollection.pass_try_jump ScriptCommand_JumpIfMan1RequestedCardInCollection: ; d032 (3:5032) - get_flag_value EVENT_FLAG_2B + get_flag_value EVENT_MAN1_REQUESTED_CARD_ID call GetCardCountInCollection jp c, ScriptCommand_JumpIfAnyEnergyCardsInCollection.fail jp ScriptCommand_JumpIfAnyEnergyCardsInCollection.pass_try_jump ScriptCommand_RemoveMan1RequestedCardFromCollection: ; d03f (3:503f) - get_flag_value EVENT_FLAG_2B + get_flag_value EVENT_MAN1_REQUESTED_CARD_ID call RemoveCardFromCollection jp IncreaseScriptPointerBy1 @@ -2787,10 +2791,10 @@ ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot: ; d16b (3:516b) ScriptCommand_PickChallengeHallOpponent: ; d195 (3:5195) ld a, [wTempNPC] push af - get_flag_value EVENT_FLAG_45 + get_flag_value EVENT_CHALLENGE_CUP_OPPONENT_NUMBER inc a ld c, a - set_flag_value EVENT_FLAG_45 + set_flag_value EVENT_CHALLENGE_CUP_OPPONENT_NUMBER call Func_f580 pop af ld [wTempNPC], a @@ -2801,7 +2805,7 @@ ScriptCommand_OpenMenu: ; d1ad (3:51ad) jp IncreaseScriptPointerBy1 ScriptCommand_PickChallengeCupPrizeCard: ; d1b3 (3:51b3) - get_flag_value EVENT_FLAG_44 + get_flag_value EVENT_CHALLENGE_CUP_NUMBER dec a cp 2 jr c, .first_or_second_cup @@ -2873,7 +2877,7 @@ ChallengeCupPrizeCards: ; d1dc (3:51dc) .end ScriptCommand_PickLegendaryCard: ; d209 (3:5209) - get_flag_value EVENT_FLAG_71 + get_flag_value EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS ld e, a .new_random call UpdateRNGSources @@ -2895,7 +2899,7 @@ ScriptCommand_PickLegendaryCard: ; d209 (3:5209) ld hl, Flags_d240 add hl, bc ld a, [hl] - call MaxOutEventFlag ; also modifies EVENT_FLAG_71 + call MaxOutEventFlag ; also modifies EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS pop bc ld hl, LegendaryCards ld a, c @@ -2915,10 +2919,10 @@ LegendaryCards: ; d234 (3:5234) tx DragoniteLegendaryCardName Flags_d240: ; d240 (3:5240) - db EVENT_FLAG_6D - db EVENT_FLAG_6E - db EVENT_FLAG_6F - db EVENT_FLAG_70 + db EVENT_RECEIVED_ZAPDOS + db EVENT_RECEIVED_MOLTRES + db EVENT_RECEIVED_ARTICUNO + db EVENT_RECEIVED_DRAGONITE ScriptCommand_ReplaceMapBlocks: ; d244 (3:5244) ld a, c @@ -2931,7 +2935,7 @@ ScriptCommand_ChooseDeckToDuelAgainstMultichoice: ; d24c (3:524c) call ShowMultichoiceTextbox ld a, [wMultichoiceTextboxResult_ChooseDeckToDuelAgainst] ld c, a - set_flag_value EVENT_FLAG_76 + set_flag_value EVENT_AARON_DECK_MENU_CHOICE jp IncreaseScriptPointerBy1 .multichoice_menu_args ; d25e @@ -3057,7 +3061,7 @@ ScriptCommand_ShowSamNormalMultichoice: ; d2f6 (3:52f6) call ShowMultichoiceTextbox ld a, [wMultichoiceTextboxResult_Sam] ld c, a - set_flag_value EVENT_FLAG_75 + set_flag_value EVENT_SAM_TUTORIAL_MENU_CHOICE xor a ld [wMultichoiceTextboxResult_Sam], a jp IncreaseScriptPointerBy1 @@ -3076,7 +3080,7 @@ ScriptCommand_ShowSamTutorialMultichoice: ; d317 (3:5317) call ShowMultichoiceTextbox ld a, [wMultichoiceTextboxResult_Sam] ld c, a - set_flag_value EVENT_FLAG_75 + set_flag_value EVENT_SAM_TUTORIAL_MENU_CHOICE jp IncreaseScriptPointerBy1 .multichoice_menu_args ; d32b (3:532b) @@ -3149,7 +3153,7 @@ ScriptCommand_GiftCenter: ; d39d (3:539d) ; show menu farcall Func_10dba ld c, a - set_flag_value EVENT_FLAG_72 + set_flag_value EVENT_GIFT_CENTER_MENU_CHOICE jr .done .load_gift_center @@ -3371,34 +3375,35 @@ ScriptCommand_JumpIfFlagZero2: ; d4df (3:54df) LoadOverworld: ; d4ec (3:54ec) call Func_d4fb - get_flag_value EVENT_FLAG_3E + get_flag_value EVENT_MASON_LAB_STATE or a ret nz ld bc, Script_BeginGame jp SetNextScript Func_d4fb: ; d4fb (3:54fb) - zero_flag_value EVENT_FLAG_59 + zero_flag_value EVENT_PLAYER_ENTERED_CHALLENGE_CUP call Func_f602 - get_flag_value EVENT_FLAG_3F + get_flag_value EVENT_CHALLENGE_CUP_1_STATE cp $02 jr z, .asm_d527 - get_flag_value EVENT_FLAG_40 + get_flag_value EVENT_CHALLENGE_CUP_2_STATE cp $02 jr z, .asm_d521 - get_flag_value EVENT_FLAG_41 + get_flag_value EVENT_CHALLENGE_CUP_3_STATE cp $02 jr z, .asm_d51b ret + .asm_d51b ld c, $07 - set_flag_value EVENT_FLAG_41 + set_flag_value EVENT_CHALLENGE_CUP_3_STATE .asm_d521 ld c, $07 - set_flag_value EVENT_FLAG_40 + set_flag_value EVENT_CHALLENGE_CUP_2_STATE .asm_d527 ld c, $07 - set_flag_value EVENT_FLAG_3F + set_flag_value EVENT_CHALLENGE_CUP_1_STATE ret Script_BeginGame: ; d52e (3:552e) @@ -3422,7 +3427,7 @@ MasonLaboratoryAfterDuel: ; d53b (3:553b) db $00 MasonLabLoadMap: ; d549 (3:5549) - get_flag_value EVENT_FLAG_3E + get_flag_value EVENT_MASON_LAB_STATE cp $03 ret nc ld a, NPC_DRMASON @@ -3438,7 +3443,7 @@ MasonLabCloseTextBox: ; d55e (3:555e) ; Lets you access the Challenge Machine if available MasonLabPressedA: ; d565 (3:5565) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a ret z ld hl, ChallengeMachineObjectTable @@ -3473,7 +3478,7 @@ Script_Tech1: ; d583 (3:5583) jr c, .low_on_energies start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Tech1MasterMedalExplanationText, Tech1AutoDeckMachineExplanationText quit_script_fully @@ -3512,24 +3517,24 @@ EnergyCardList: ; d5c4 (3:55c4) Script_Tech2: ; d5ca (3:55ca) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Tech2LegendaryCardsExplanationText, Tech2LegendaryCardsCongratsText quit_script_fully Script_Tech3: ; d5d5 (3:55d5) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Tech3BoosterPackExplanationText, Tech3LegendaryCardsCongratsText quit_script_fully Script_Tech4: ; d5e0 (3:55e0) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Tech4ClubsExplanationText, Tech4DefeatedTheGrandMastersText quit_script_fully Preload_Tech5: ; d5eb (3:55eb) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a jr z, .skip ld hl, wLoadNPCXPos @@ -3541,12 +3546,12 @@ Preload_Tech5: ; d5eb (3:55eb) Script_Tech5: ; d5f9 (3:55f9) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Tech5DiaryAndEmailExplanationText, Tech5ChallengeMachineExplanationText quit_script_fully Preload_Sam: ; d604 (3:5604) - get_flag_value EVENT_FLAG_3E + get_flag_value EVENT_MASON_LAB_STATE cp $01 jr nc, .skip ld a, $0a @@ -3563,9 +3568,9 @@ Script_Sam: ; d61d (3:561d) start_script show_sam_normal_multichoice close_text_box - jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d63b - jump_if_flag_equal EVENT_FLAG_75, $02, Script_LostToSam.ows_d6b0 - jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d637 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $00, .ows_d63b + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $02, Script_LostToSam.ows_d6b0 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $03, .ows_d637 print_npc_text Text05cb ask_question_jump Text05cc, .ows_d647 .ows_d637 @@ -3601,7 +3606,7 @@ Script_Sam: ; d61d (3:561d) move_player SOUTH, 1 set_player_direction WEST move_active_npc NPCMovement_d889 - jump_if_flag_equal EVENT_FLAG_75, $00, .ows_d685 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $00, .ows_d685 start_duel PRIZES_2, SAMS_PRACTICE_DECK_ID, MUSIC_DUEL_THEME_1 quit_script_fully @@ -3611,16 +3616,16 @@ Script_Sam: ; d61d (3:561d) Script_BeatSam: ; d68a (3:568a) start_script - jump_if_flag_equal EVENT_FLAG_3E, $01, Script_EnterLabFirstTime.ows_d82d - jump_if_flag_equal EVENT_FLAG_75, $01, Script_LostToSam.ows_d6ad + jump_if_flag_equal EVENT_MASON_LAB_STATE, $01, Script_EnterLabFirstTime.ows_d82d + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $01, Script_LostToSam.ows_d6ad print_npc_text Text05d1 give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER print_text_quit_fully Text05d2 Script_LostToSam: ; d69f (3:569f) start_script - jump_if_flag_equal EVENT_FLAG_3E, $01, Script_EnterLabFirstTime.ows_d82d - jump_if_flag_equal EVENT_FLAG_75, $01, .ows_d6ad + jump_if_flag_equal EVENT_MASON_LAB_STATE, $01, Script_EnterLabFirstTime.ows_d82d + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $01, .ows_d6ad print_text_quit_fully Text05d3 .ows_d6ad @@ -3632,13 +3637,13 @@ Script_LostToSam: ; d69f (3:569f) close_text_box show_sam_tutorial_multichoice close_text_box - jump_if_flag_equal EVENT_FLAG_75, $07, Script_Sam.ows_d637 - jump_if_flag_equal EVENT_FLAG_75, $01, .ows_d6df - jump_if_flag_equal EVENT_FLAG_75, $02, .ows_d6e5 - jump_if_flag_equal EVENT_FLAG_75, $03, .ows_d6eb - jump_if_flag_equal EVENT_FLAG_75, $04, .ows_d6f1 - jump_if_flag_equal EVENT_FLAG_75, $05, .ows_d6f7 - jump_if_flag_equal EVENT_FLAG_75, $06, .ows_d6fd + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $07, Script_Sam.ows_d637 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $01, .ows_d6df + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $02, .ows_d6e5 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $03, .ows_d6eb + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $04, .ows_d6f1 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $05, .ows_d6f7 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $06, .ows_d6fd print_npc_text Text05d6 script_jump .ows_d6b3 @@ -3667,7 +3672,7 @@ Script_LostToSam: ; d69f (3:569f) script_jump .ows_d6b3 Func_d703: ; d703 (3:5703) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a ret z ld a, $0a @@ -3676,7 +3681,7 @@ Func_d703: ; d703 (3:5703) Preload_DrMason: ; d710 (3:5710) call Func_d703 - get_flag_value EVENT_FLAG_3E + get_flag_value EVENT_MASON_LAB_STATE cp $01 jr nz, .asm_d725 ld a, $06 @@ -3689,7 +3694,7 @@ Preload_DrMason: ; d710 (3:5710) Script_DrMason: ; d727 (3:5727) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_4B, .ows_d72f + jump_if_flag_nonzero_2 EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER, .ows_d72f print_text_quit_fully Text05dd .ows_d72f @@ -3702,12 +3707,12 @@ Script_DrMason: ; d727 (3:5727) print_text_quit_fully Text05df .ows_d740 - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_d747 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_d747 print_text_quit_fully Text05e0 .ows_d747 - jump_if_flag_nonzero_2 EVENT_FLAG_3D, .ows_d750 - max_out_flag_value EVENT_FLAG_3D + jump_if_flag_nonzero_2 EVENT_DRMASON_CONGRATULATED_PLAYER, .ows_d750 + max_out_flag_value EVENT_DRMASON_CONGRATULATED_PLAYER print_text_quit_fully Text05e1 .ows_d750 @@ -3766,13 +3771,13 @@ Script_EnterLabFirstTime: ; d753 (3:5753) close_text_box show_sam_tutorial_multichoice close_text_box - 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 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $07, .ows_d80c + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $01, .ows_d7e8 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $02, .ows_d7ee + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $03, .ows_d7f4 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $04, .ows_d7fa + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $05, .ows_d800 + jump_if_flag_equal EVENT_SAM_TUTORIAL_MENU_CHOICE, $06, .ows_d806 print_npc_text Text05d6 script_jump .ows_d7bc @@ -3809,7 +3814,7 @@ Script_EnterLabFirstTime: ; d753 (3:5753) set_dialog_npc NPC_DRMASON print_npc_text Text05ea script_nop - script_set_flag_value EVENT_FLAG_3E, $01 + script_set_flag_value EVENT_MASON_LAB_STATE, $01 close_advanced_text_box set_next_npc_and_script NPC_SAM, .ows_d827 end_script @@ -3860,7 +3865,7 @@ Script_AfterPracticeDuel: ; d834 (3:5834) wait_for_song_to_finish resume_song close_text_box - script_set_flag_value EVENT_FLAG_3E, $03 + script_set_flag_value EVENT_MASON_LAB_STATE, $03 give_stater_deck print_npc_text Text05f6 save_game $00 @@ -3933,19 +3938,19 @@ DeckMachineRoomCloseTextBox: ; d8ad (3:58ad) Script_Tech6: ; d8bb (3:58bb) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text05f7, Text05f8 quit_script_fully Script_Tech7: ; d8c6 (3:58c6) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text05f9, Text05fa quit_script_fully Script_Tech8: ; d8d1 (3:58d1) start_script - jump_if_flag_not_equal EVENT_FLAG_62, $ff, NULL + jump_if_flag_not_equal EVENT_ALL_DECK_MACHINE_FLAGS, $ff, NULL print_variable_npc_text Text05fb, Text05fc quit_script_fully @@ -3960,7 +3965,7 @@ Script_Aaron: ; d8dd (3:58dd) print_npc_text Text0600 choose_deck_to_duel_against close_text_box - jump_if_flag_equal EVENT_FLAG_76, $03, .ows_d8e6 + jump_if_flag_equal EVENT_AARON_DECK_MENU_CHOICE, $03, .ows_d8e6 ask_question_jump Text0601, .ows_d8fb script_jump .ows_d8e6 @@ -3972,12 +3977,12 @@ Script_Aaron: ; d8dd (3:58dd) Script_BeatAaron: ; d903 (3:5903) ld a, [wMultichoiceTextboxResult_ChooseDeckToDuelAgainst] ld c, a - set_flag_value EVENT_FLAG_73 + set_flag_value EVENT_AARON_BOOSTER_REWARD start_script print_npc_text Text0603 - jump_if_flag_equal EVENT_FLAG_73, $01, .ows_d920 - jump_if_flag_equal EVENT_FLAG_73, $02, .ows_d927 + jump_if_flag_equal EVENT_AARON_BOOSTER_REWARD, $01, .ows_d920 + jump_if_flag_equal EVENT_AARON_BOOSTER_REWARD, $02, .ows_d927 give_booster_packs BOOSTER_ENERGY_RANDOM, NO_BOOSTER, NO_BOOSTER script_jump Script_LostToAaron.ows_d92f @@ -4010,9 +4015,9 @@ Script_d93f: ; d93f (3:593f) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5A, .ows_d963 + jump_if_flag_nonzero_2 EVENT_FIGHTING_DECK_MACHINE_ACTIVE, .ows_d963 print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_0F, .ows_d954 + jump_if_flag_nonzero_2 EVENT_BEAT_MITCH, .ows_d954 quit_script_fully .ows_d954 @@ -4021,7 +4026,7 @@ Script_d93f: ; d93f (3:593f) .ows_d95a play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5A + max_out_flag_value EVENT_FIGHTING_DECK_MACHINE_ACTIVE replace_map_blocks $02 print_text Text060a .ows_d963 @@ -4063,9 +4068,9 @@ Script_d995: ; d995 (3:5995) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5B, .ows_d9b9 + jump_if_flag_nonzero_2 EVENT_ROCK_DECK_MACHINE_ACTIVE, .ows_d9b9 print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_0E, .ows_d9aa + jump_if_flag_nonzero_2 EVENT_BEAT_GENE, .ows_d9aa quit_script_fully .ows_d9aa @@ -4074,7 +4079,7 @@ Script_d995: ; d995 (3:5995) .ows_d9b0 play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5B + max_out_flag_value EVENT_ROCK_DECK_MACHINE_ACTIVE replace_map_blocks $03 print_text Text060a .ows_d9b9 @@ -4091,7 +4096,7 @@ Script_d9c2: ; d9c2 (3:59c2) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5C, .ows_d9e6 + jump_if_flag_nonzero_2 EVENT_WATER_DECK_MACHINE_ACTIVE, .ows_d9e6 print_text Text0608 jump_if_flag_nonzero_2 EVENT_BEAT_AMY, .ows_d9d7 quit_script_fully @@ -4102,7 +4107,7 @@ Script_d9c2: ; d9c2 (3:59c2) .ows_d9dd play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5C + max_out_flag_value EVENT_WATER_DECK_MACHINE_ACTIVE replace_map_blocks $04 print_text Text060a .ows_d9e6 @@ -4119,9 +4124,9 @@ Script_d9ef: ; d9ef (3:59ef) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5D, .ows_da13 + jump_if_flag_nonzero_2 EVENT_LIGHTNING_DECK_MACHINE_ACTIVE, .ows_da13 print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_0C, .ows_da04 + jump_if_flag_nonzero_2 EVENT_BEAT_ISAAC, .ows_da04 quit_script_fully .ows_da04 @@ -4130,7 +4135,7 @@ Script_d9ef: ; d9ef (3:59ef) .ows_da0a play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5D + max_out_flag_value EVENT_LIGHTNING_DECK_MACHINE_ACTIVE replace_map_blocks $05 print_text Text060a .ows_da13 @@ -4147,9 +4152,9 @@ Script_da1c: ; da1c (3:5a1c) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5E, .ows_da40 + jump_if_flag_nonzero_2 EVENT_GRASS_DECK_MACHINE_ACTIVE, .ows_da40 print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_da31 + jump_if_flag_nonzero_2 EVENT_BEAT_NIKKI, .ows_da31 quit_script_fully .ows_da31 @@ -4158,7 +4163,7 @@ Script_da1c: ; da1c (3:5a1c) .ows_da37 play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5E + max_out_flag_value EVENT_GRASS_DECK_MACHINE_ACTIVE replace_map_blocks $06 print_text Text060a .ows_da40 @@ -4175,9 +4180,9 @@ Script_da49: ; da49 (3:5a49) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_5F, .ows_da6d + jump_if_flag_nonzero_2 EVENT_PSYCHIC_DECK_MACHINE_ACTIVE, .ows_da6d print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_da5e + jump_if_flag_nonzero_2 EVENT_BEAT_MURRAY, .ows_da5e quit_script_fully .ows_da5e @@ -4186,7 +4191,7 @@ Script_da49: ; da49 (3:5a49) .ows_da64 play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_5F + max_out_flag_value EVENT_PSYCHIC_DECK_MACHINE_ACTIVE replace_map_blocks $07 print_text Text060a .ows_da6d @@ -4203,9 +4208,9 @@ Script_da76: ; da76 (3:5a76) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_60, .ows_da9a + jump_if_flag_nonzero_2 EVENT_SCIENCE_DECK_MACHINE_ACTIVE, .ows_da9a print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_09, .ows_da8b + jump_if_flag_nonzero_2 EVENT_BEAT_RICK, .ows_da8b quit_script_fully .ows_da8b @@ -4214,7 +4219,7 @@ Script_da76: ; da76 (3:5a76) .ows_da91 play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_60 + max_out_flag_value EVENT_SCIENCE_DECK_MACHINE_ACTIVE replace_map_blocks $08 print_text Text060a .ows_da9a @@ -4231,9 +4236,9 @@ Script_daa3: ; daa3 (3:5aa3) start_script print_text Text0607 - jump_if_flag_nonzero_2 EVENT_FLAG_61, .ows_dac7 + jump_if_flag_nonzero_2 EVENT_FIRE_DECK_MACHINE_ACTIVE, .ows_dac7 print_text Text0608 - jump_if_flag_nonzero_2 EVENT_FLAG_0A, .ows_dab8 + jump_if_flag_nonzero_2 EVENT_BEAT_KEN, .ows_dab8 quit_script_fully .ows_dab8 @@ -4242,7 +4247,7 @@ Script_daa3: ; daa3 (3:5aa3) .ows_dabe play_sfx SFX_5A - max_out_flag_value EVENT_FLAG_61 + max_out_flag_value EVENT_FIRE_DECK_MACHINE_ACTIVE replace_map_blocks $09 print_text Text060a .ows_dac7 @@ -4264,7 +4269,7 @@ Script_dad0: ; dad0 (3:5ad0) quit_script_fully Preload_NikkiInIshiharasHouse: ; dadd (3:5add) - get_flag_value EVENT_FLAG_35 + get_flag_value EVENT_NIKKI_STATE cp $01 jr nz, .dont_load scf @@ -4276,7 +4281,7 @@ Preload_NikkiInIshiharasHouse: ; dadd (3:5add) Script_dae9: ; dae9 (3:5ae9) start_script print_npc_text Text0723 - script_set_flag_value EVENT_FLAG_35, $02 + script_set_flag_value EVENT_NIKKI_STATE, $02 close_text_box jump_if_npc_loaded NPC_ISHIHARA, .ows_dafb move_active_npc_by_direction NPCMovementTable_db24 @@ -4343,34 +4348,34 @@ NPCMovement_db39: ; db39 (3:5b39) db $fe, -14 Preload_IshiharaInIshiharasHouse: ; db3d (3:5b3d) - get_flag_value EVENT_FLAG_1C + get_flag_value EVENT_ISHIHARA_MENTIONED or a ret z - get_flag_value EVENT_FLAG_1F + get_flag_value EVENT_ISHIHARA_TRADE_STATE cp $08 ret Script_Ishihara: ; db4a (3:5b4a) start_script - max_out_flag_value EVENT_FLAG_1D - jump_if_flag_equal EVENT_FLAG_1F, $00, .ows_db80 - jump_if_flag_nonzero_2 EVENT_FLAG_39, .ows_db5a - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_dc3e + max_out_flag_value EVENT_ISHIHARA_MET + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $00, .ows_db80 + jump_if_flag_nonzero_2 EVENT_ISHIHARA_CONGRATULATED_PLAYER, .ows_db5a + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_dc3e .ows_db5a - 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 - 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 + jump_if_flag_nonzero_2 EVENT_TEMP_TRADED_WITH_ISHIHARA, .ows_db90 + jump_if_flag_zero_2 EVENT_ISHIHARA_WANTS_TO_TRADE, .ows_db90 + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $01, .ows_db93 + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $02, .ows_db93 + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $03, .ows_dbcc + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $04, .ows_dbcc + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $05, .ows_dc05 + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $06, .ows_dc05 .ows_db80 - max_out_flag_value EVENT_FLAG_00 - script_set_flag_value EVENT_FLAG_1F, $01 - 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 + max_out_flag_value EVENT_TEMP_TRADED_WITH_ISHIHARA + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $01 + zero_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_db8d + max_out_flag_value EVENT_ISHIHARA_CONGRATULATED_PLAYER .ows_db8d print_text_quit_fully Text0727 @@ -4378,9 +4383,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0728 .ows_db93 - jump_if_flag_equal EVENT_FLAG_1F, $01, NULL + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $01, NULL print_variable_npc_text Text0729, Text072a - script_set_flag_value EVENT_FLAG_1F, $02 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $02 ask_question_jump Text072b, .check_if_clefable_owned print_text_quit_fully Text072c @@ -4393,9 +4398,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text072e .do_clefable_trade - max_out_flag_value EVENT_FLAG_00 - script_set_flag_value EVENT_FLAG_1F, $03 - zero_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_TEMP_TRADED_WITH_ISHIHARA + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $03 + zero_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_npc_text Text072f print_text Text0730 take_card CLEFABLE @@ -4404,9 +4409,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0731 .ows_dbcc - jump_if_flag_equal EVENT_FLAG_1F, $03, NULL + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $03, NULL print_variable_npc_text Text0732, Text0733 - script_set_flag_value EVENT_FLAG_1F, $04 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $04 ask_question_jump Text072b, .check_if_ditto_owned print_text_quit_fully Text072c @@ -4419,9 +4424,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0735 .do_ditto_trade - max_out_flag_value EVENT_FLAG_00 - script_set_flag_value EVENT_FLAG_1F, $05 - zero_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_TEMP_TRADED_WITH_ISHIHARA + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $05 + zero_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_npc_text Text072f print_text Text0736 take_card DITTO @@ -4430,9 +4435,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text0737 .ows_dc05 - jump_if_flag_equal EVENT_FLAG_1F, $05, NULL + jump_if_flag_equal EVENT_ISHIHARA_TRADE_STATE, $05, NULL print_variable_npc_text Text0738, Text0739 - script_set_flag_value EVENT_FLAG_1F, $06 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $06 ask_question_jump Text072b, .check_if_chansey_owned print_text_quit_fully Text072c @@ -4445,9 +4450,9 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text073b .do_chansey_trade - max_out_flag_value EVENT_FLAG_00 - script_set_flag_value EVENT_FLAG_1F, $07 - zero_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_TEMP_TRADED_WITH_ISHIHARA + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $07 + zero_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_npc_text Text072f print_text Text073c take_card CHANSEY @@ -4456,19 +4461,19 @@ Script_Ishihara: ; db4a (3:5b4a) print_text_quit_fully Text073d .ows_dc3e - max_out_flag_value EVENT_FLAG_39 + max_out_flag_value EVENT_ISHIHARA_CONGRATULATED_PLAYER print_text_quit_fully Text073e Preload_Ronald1InIshiharasHouse: ; dc43 (3:5c43) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS cp $01 ccf ret Script_Ronald: ; dc4b (3:5c4b) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_4E, .ows_dc55 - max_out_flag_value EVENT_FLAG_4E + jump_if_flag_nonzero_2 EVENT_RONALD_TALKED, .ows_dc55 + max_out_flag_value EVENT_RONALD_TALKED print_text_quit_fully Text073f .ows_dc55 @@ -4501,18 +4506,18 @@ FightingClubLobbyAfterDuel: ; dc68 (3:5c68) Script_Man1: ; dc76 (3:5c76) start_script - jump_if_flag_equal EVENT_FLAG_2C, $06, .ows_dce8 - jump_if_flag_nonzero_2 EVENT_FLAG_01, .ows_dce5 - jump_if_flag_nonzero_2 EVENT_FLAG_29, .ows_dc91 - max_out_flag_value EVENT_FLAG_29 + jump_if_flag_equal EVENT_MAN1_GIFT_SEQUENCE_STATE, $06, .ows_dce8 + jump_if_flag_nonzero_2 EVENT_TEMP_GIFTED_TO_MAN1, .ows_dce5 + jump_if_flag_nonzero_2 EVENT_MAN1_TALKED, .ows_dc91 + max_out_flag_value EVENT_MAN1_TALKED pick_next_man1_requested_card load_man1_requested_card_into_txram_slot $00 print_npc_text Text045b - max_out_flag_value EVENT_FLAG_2A + max_out_flag_value EVENT_MAN1_WAITING_FOR_CARD script_jump .ows_dca5 .ows_dc91 - jump_if_flag_zero_2 EVENT_FLAG_2A, .ows_dc9d + jump_if_flag_zero_2 EVENT_MAN1_WAITING_FOR_CARD, .ows_dc9d load_man1_requested_card_into_txram_slot $00 print_npc_text Text045c script_jump .ows_dca5 @@ -4521,7 +4526,7 @@ Script_Man1: ; dc76 (3:5c76) pick_next_man1_requested_card load_man1_requested_card_into_txram_slot $00 print_npc_text Text045d - max_out_flag_value EVENT_FLAG_2A + max_out_flag_value EVENT_MAN1_WAITING_FOR_CARD .ows_dca5 load_man1_requested_card_into_txram_slot $00 ask_question_jump Text045e, .ows_dcaf @@ -4544,10 +4549,10 @@ Script_Man1: ; dc76 (3:5c76) load_man1_requested_card_into_txram_slot $01 print_npc_text Text0462 remove_man1_requested_card_from_collection - max_out_flag_value EVENT_FLAG_01 - zero_out_flag_value EVENT_FLAG_2A - increment_flag_value EVENT_FLAG_2C - jump_if_flag_equal EVENT_FLAG_2C, $05, .ows_dcd7 + max_out_flag_value EVENT_TEMP_GIFTED_TO_MAN1 + zero_out_flag_value EVENT_MAN1_WAITING_FOR_CARD + increment_flag_value EVENT_MAN1_GIFT_SEQUENCE_STATE + jump_if_flag_equal EVENT_MAN1_GIFT_SEQUENCE_STATE, $05, .ows_dcd7 quit_script_fully .ows_dcd7 @@ -4555,7 +4560,7 @@ Script_Man1: ; dc76 (3:5c76) give_card PIKACHU4 show_card_received_screen PIKACHU4 print_npc_text Text0464 - script_set_flag_value EVENT_FLAG_2C, $06 + script_set_flag_value EVENT_MAN1_GIFT_SEQUENCE_STATE, $06 quit_script_fully .ows_dce5 @@ -4578,6 +4583,7 @@ Preload_ImakuniInFightingClubLobby: ; dceb (3:5ceb) .asm_dd04 or a ret + .asm_dd06 ld a, MUSIC_IMAKUNI ld [wd111], a @@ -4657,18 +4663,18 @@ NPCMovement_dd78: ; dd78 (3:5d78) Script_Specs1: ; dd82 (3:5d82) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0472, Text0473 quit_script_fully Script_Butch: ; dd8d (3:5d8d) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0474, Text0475 quit_script_fully Preload_Granny1: ; dd98 (3:5d98) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS cp $01 ret @@ -4706,14 +4712,14 @@ FightingClubAfterDuel: ; dda3 (3:5da3) Script_Mitch: ; ddc3 (3:5dc3) start_script try_give_pc_pack $02 - jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_AlreadyHaveMedal + jump_if_flag_nonzero_2 EVENT_BEAT_MITCH, Script_Mitch_AlreadyHaveMedal fight_club_pupil_jump .first_interaction, .three_pupils_remaining, \ .two_pupils_remaining, .one_pupil_remaining, .all_pupils_defeated .first_interaction print_npc_text 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 + script_set_flag_value EVENT_PUPIL_MICHAEL_STATE, 1 + script_set_flag_value EVENT_PUPIL_CHRIS_STATE, 1 + script_set_flag_value EVENT_PUPIL_JESSICA_STATE, 1 quit_script_fully .three_pupils_remaining @@ -4738,11 +4744,11 @@ Script_Mitch: ; ddc3 (3:5dc3) Script_BeatMitch: ; ddff (3:5dff) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_GiveBoosters + jump_if_flag_nonzero_2 EVENT_BEAT_MITCH, Script_Mitch_GiveBoosters print_npc_text Text047f - max_out_flag_value EVENT_FLAG_0F + max_out_flag_value EVENT_BEAT_MITCH try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_0F + show_medal_received_screen EVENT_BEAT_MITCH record_master_win $01 print_npc_text Text0480 give_booster_packs BOOSTER_LABORATORY_NEUTRAL, BOOSTER_LABORATORY_NEUTRAL, NO_BOOSTER @@ -4751,7 +4757,7 @@ Script_BeatMitch: ; ddff (3:5dff) Script_LostToMitch: ; de19 (3:5e19) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0F, Script_Mitch_PrintTrainHarderText + jump_if_flag_nonzero_2 EVENT_BEAT_MITCH, Script_Mitch_PrintTrainHarderText print_text_quit_fully Text0482 Script_Mitch_AlreadyHaveMedal: ; de21 (3:5e21) @@ -4775,15 +4781,15 @@ Script_Mitch_PrintTrainHarderText: ; de40 (3:5e40) print_text_quit_fully Text0488 Preload_ChrisInFightingClub: ; de43 (3:5e43) - get_flag_value EVENT_FLAG_17 - cp $08 + get_flag_value EVENT_PUPIL_CHRIS_STATE + cp 8 ccf ret Script_de4b: ; de4b (3:5e4b) - jump_if_flag_equal EVENT_FLAG_17, $08, NULL + jump_if_flag_equal EVENT_PUPIL_CHRIS_STATE, 8, NULL print_variable_npc_text Text0489, Text048a - script_set_flag_value EVENT_FLAG_17, $09 + script_set_flag_value EVENT_PUPIL_CHRIS_STATE, 9 ask_question_jump Text048b, .ows_de61 print_npc_text Text048c quit_script_fully @@ -4805,8 +4811,8 @@ Script_LostToChrisInFightingClub: ; de75 (3:5e75) print_text_quit_fully Text0490 Preload_MichaelInFightingClub: ; de79 (3:5e79) - get_flag_value EVENT_FLAG_11 - cp $08 + get_flag_value EVENT_PUPIL_MICHAEL_STATE + cp 8 ccf ret @@ -4833,8 +4839,8 @@ Script_LostToMichaelInFightingClub: ; dea1 (3:5ea1) print_text_quit_fully Text0497 Preload_JessicaInFightingClub: ; dea5 (3:5ea5) - get_flag_value EVENT_FLAG_20 - cp $08 + get_flag_value EVENT_PUPIL_JESSICA_STATE + cp 8 ccf ret @@ -4882,15 +4888,15 @@ RockClubLobbyAfterDuel: ; ded5 (3:5ed5) db $00 Preload_ChrisInRockClubLobby: ; dee9 (3:5ee9) - get_flag_value EVENT_FLAG_17 + get_flag_value EVENT_PUPIL_CHRIS_STATE or a ret z - cp $08 + cp 8 ret Script_Chris: ; def2 (3:5ef2) start_script - jump_if_flag_not_less_than EVENT_FLAG_17, $08, Script_de4b + jump_if_flag_not_less_than EVENT_PUPIL_CHRIS_STATE, 8, Script_de4b print_npc_text Text077a ask_question_jump Text077b, .ows_df04 print_npc_text Text077c @@ -4903,7 +4909,7 @@ Script_Chris: ; def2 (3:5ef2) Script_BeatChrisInRockClubLobby: ; df0c (3:5f0c) start_script - script_set_flag_value EVENT_FLAG_17, $08 + script_set_flag_value EVENT_PUPIL_CHRIS_STATE, 8 print_npc_text Text077e give_booster_packs BOOSTER_EVOLUTION_FIGHTING, BOOSTER_EVOLUTION_FIGHTING, NO_BOOSTER print_npc_text Text077f @@ -4941,15 +4947,15 @@ NPCMovement_df34: ; df34 (3:5f34) Script_Matthew: ; df39 (3:5f39) start_script try_give_pc_pack $03 - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_df4c - jump_if_flag_zero_1 EVENT_FLAG_18, NULL + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_df4c + jump_if_flag_zero_1 EVENT_MATTHEW_STATE, NULL print_variable_npc_text Text0781, Text0782 script_jump .ows_df4f .ows_df4c print_npc_text Text0783 .ows_df4f - script_set_flag_value EVENT_FLAG_18, $01 + script_set_flag_value EVENT_MATTHEW_STATE, $01 ask_question_jump Text0784, .ows_df5b print_npc_text Text0785 quit_script_fully @@ -4961,8 +4967,8 @@ Script_Matthew: ; df39 (3:5f39) Script_BeatMatthew: ; df63 (3:5f63) start_script - script_set_flag_value EVENT_FLAG_18, $02 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + script_set_flag_value EVENT_MATTHEW_STATE, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0787, Text0788 give_booster_packs BOOSTER_MYSTERY_FIGHTING_COLORLESS, BOOSTER_MYSTERY_FIGHTING_COLORLESS, NO_BOOSTER print_npc_text Text0789 @@ -4970,50 +4976,50 @@ Script_BeatMatthew: ; df63 (3:5f63) Script_LostToMatthew: ; df78 (3:5f78) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text078a, Text078b quit_script_fully Script_Woman1: ; df83 (3:5f83) start_script - jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_dfba - jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_df96 - max_out_flag_value EVENT_FLAG_1C - max_out_flag_value EVENT_FLAG_1E - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $07, .ows_dfba + jump_if_flag_nonzero_2 EVENT_ISHIHARA_MET, .ows_df96 + max_out_flag_value EVENT_ISHIHARA_MENTIONED + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text078c .ows_df96 - jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_dfb7 - jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_dfae - jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_dfa9 - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_nonzero_2 EVENT_TEMP_TRADED_WITH_ISHIHARA, .ows_dfb7 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $05, .ows_dfae + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $03, .ows_dfa9 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text078d .ows_dfa9 - max_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text078e .ows_dfae - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_dfb7 - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_dfb7 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text078f .ows_dfb7 print_text_quit_fully Text0790 .ows_dfba - script_set_flag_value EVENT_FLAG_1F, $08 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $08 print_text_quit_fully Text0791 Script_Chap1: ; dfc0 (3:5fc0) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0792, Text0793 quit_script_fully Preload_Lass3: ; dfcb (3:5fcb) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS cp $01 ret @@ -5094,7 +5100,7 @@ Script_LostToAndrew: ; e03a (3:603a) Script_Gene: ; e03e (3:603e) start_script try_give_pc_pack $03 - jump_if_flag_nonzero_2 EVENT_FLAG_0E, Script_LostToGene.ows_e07b + jump_if_flag_nonzero_2 EVENT_BEAT_GENE, Script_LostToGene.ows_e07b print_npc_text Text07a3 ask_question_jump Text07a4, .ows_e051 print_npc_text Text07a5 @@ -5107,11 +5113,11 @@ Script_Gene: ; e03e (3:603e) Script_BeatGene: ; e059 (3:6059) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0E, Script_LostToGene.ows_e08f + jump_if_flag_nonzero_2 EVENT_BEAT_GENE, Script_LostToGene.ows_e08f print_npc_text Text07a7 - max_out_flag_value EVENT_FLAG_0E + max_out_flag_value EVENT_BEAT_GENE try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_0E + show_medal_received_screen EVENT_BEAT_GENE record_master_win $02 print_npc_text Text07a8 give_booster_packs BOOSTER_MYSTERY_FIGHTING_COLORLESS, BOOSTER_MYSTERY_FIGHTING_COLORLESS, NO_BOOSTER @@ -5120,7 +5126,7 @@ Script_BeatGene: ; e059 (3:6059) Script_LostToGene: ; e073 (3:6073) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0E, .ows_e09a + jump_if_flag_nonzero_2 EVENT_BEAT_GENE, .ows_e09a print_text_quit_fully Text07aa .ows_e07b @@ -5172,6 +5178,7 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) .asm_e0c6 or a ret + .asm_e0c8 ld a, MUSIC_IMAKUNI ld [wd111], a @@ -5180,10 +5187,10 @@ 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, NULL + jump_if_flag_equal EVENT_GAL1_TRADE_STATE, $02, .ows_e10e + jump_if_flag_equal EVENT_GAL1_TRADE_STATE, $00, NULL print_variable_npc_text Gal1WantToTrade1Text, Gal1WantToTrade2Text - script_set_flag_value EVENT_FLAG_12, $01 + script_set_flag_value EVENT_GAL1_TRADE_STATE, $01 ask_question_jump Gal1WouldYouLikeToTradeText, .ows_e0eb print_npc_text Gal1DeclinedTradeText quit_script_fully @@ -5199,7 +5206,7 @@ Script_Gal1: ; e0cf (3:60cf) quit_script_fully .ows_e0fb - script_set_flag_value EVENT_FLAG_12, $02 + script_set_flag_value EVENT_GAL1_TRADE_STATE, $02 print_npc_text Gal1LetsTradeText print_text Gal1TradeCompleteText take_card LAPRAS @@ -5213,9 +5220,9 @@ Script_Gal1: ; e0cf (3:60cf) Script_Lass1: ; e111 (3:6111) start_script - jump_if_flag_equal EVENT_FLAG_14, $01, .ows_e121 + jump_if_flag_equal EVENT_LASS1_MENTIONED_IMAKUNI, $01, .ows_e121 print_npc_text Text0427 - script_set_flag_value EVENT_FLAG_14, $01 + script_set_flag_value EVENT_LASS1_MENTIONED_IMAKUNI, $01 script_set_flag_value EVENT_IMAKUNI_STATE, IMAKUNI_MENTIONED quit_script_fully @@ -5590,6 +5597,7 @@ Preload_ImakuniInLightningClubLobby: ; e37b (3:637b) .asm_e391 or a ret + .asm_e393 ld a, MUSIC_IMAKUNI ld [wd111], a @@ -5598,10 +5606,10 @@ Preload_ImakuniInLightningClubLobby: ; e37b (3:637b) Script_Chap2: ; e39a (3:639a) start_script - jump_if_flag_equal EVENT_FLAG_19, $02, .ows_e3d6 - jump_if_flag_equal EVENT_FLAG_19, $00, NULL + jump_if_flag_equal EVENT_CHAP2_TRADE_STATE, $02, .ows_e3d6 + jump_if_flag_equal EVENT_CHAP2_TRADE_STATE, $00, NULL print_variable_npc_text Text060f, Text0610 - script_set_flag_value EVENT_FLAG_19, $01 + script_set_flag_value EVENT_CHAP2_TRADE_STATE, $01 ask_question_jump Text0611, .ows_e3b6 print_npc_text Text0612 quit_script_fully @@ -5617,7 +5625,7 @@ Script_Chap2: ; e39a (3:639a) quit_script_fully .ows_e3c6 - script_set_flag_value EVENT_FLAG_19, $02 + script_set_flag_value EVENT_CHAP2_TRADE_STATE, $02 print_npc_text Text0615 take_card ELECTABUZZ2 give_card ELECTABUZZ1 @@ -5634,7 +5642,7 @@ Script_Lass4: ; e3d9 (3:63d9) Script_Hood1: ; e3dd (3:63dd) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0619, Text061a quit_script_fully @@ -5679,7 +5687,7 @@ Script_Jennifer: ; e408 (3:6408) Script_BeatJennifer: ; e41d (3:641d) start_script - max_out_flag_value EVENT_FLAG_25 + max_out_flag_value EVENT_BEAT_JENNIFER print_npc_text Text061f give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER print_npc_text Text0620 @@ -5703,7 +5711,7 @@ Script_Nicholas: ; e42f (3:642f) Script_BeatNicholas: ; e444 (3:6444) start_script - max_out_flag_value EVENT_FLAG_26 + max_out_flag_value EVENT_BEAT_NICHOLAS print_npc_text Text0626 give_booster_packs BOOSTER_COLOSSEUM_LIGHTNING, BOOSTER_COLOSSEUM_LIGHTNING, NO_BOOSTER print_npc_text Text0627 @@ -5715,9 +5723,9 @@ Script_LostToNicholas: ; e452 (3:6452) Script_Brandon: ; e456 (3:6456) start_script - jump_if_flag_zero_2 EVENT_FLAG_25, .ows_e469 - jump_if_flag_zero_2 EVENT_FLAG_26, .ows_e469 - jump_if_flag_zero_2 EVENT_FLAG_27, .ows_e469 + jump_if_flag_zero_2 EVENT_BEAT_JENNIFER, .ows_e469 + jump_if_flag_zero_2 EVENT_BEAT_NICHOLAS, .ows_e469 + jump_if_flag_zero_2 EVENT_BEAT_BRANDON, .ows_e469 print_npc_text Text0629 script_jump .ows_e46c @@ -5737,7 +5745,7 @@ Script_Brandon: ; e456 (3:6456) Script_BeatBrandon: ; e480 (3:6480) start_script try_give_pc_pack $05 - max_out_flag_value EVENT_FLAG_27 + max_out_flag_value EVENT_BEAT_BRANDON print_npc_text Text062f give_booster_packs BOOSTER_COLOSSEUM_LIGHTNING, BOOSTER_COLOSSEUM_LIGHTNING, NO_BOOSTER print_npc_text Text0630 @@ -5748,11 +5756,11 @@ Script_LostToBrandon: ; e490 (3:6490) print_text_quit_fully Text0631 Preload_Isaac: ; e494 (3:6494) - get_flag_value EVENT_FLAG_25 + get_flag_value EVENT_BEAT_JENNIFER jr z, .asm_e4ab - get_flag_value EVENT_FLAG_26 + get_flag_value EVENT_BEAT_NICHOLAS jr z, .asm_e4ab - get_flag_value EVENT_FLAG_27 + get_flag_value EVENT_BEAT_BRANDON jr z, .asm_e4ab ld a, SOUTH ld [wLoadNPCDirection], a @@ -5762,9 +5770,9 @@ Preload_Isaac: ; e494 (3:6494) Script_Isaac: ; e4ad (3:64ad) start_script - jump_if_flag_zero_2 EVENT_FLAG_25, .ows_e4bd - jump_if_flag_zero_2 EVENT_FLAG_26, .ows_e4bd - jump_if_flag_zero_2 EVENT_FLAG_27, .ows_e4bd + jump_if_flag_zero_2 EVENT_BEAT_JENNIFER, .ows_e4bd + jump_if_flag_zero_2 EVENT_BEAT_NICHOLAS, .ows_e4bd + jump_if_flag_zero_2 EVENT_BEAT_BRANDON, .ows_e4bd script_jump .ows_e4c1 .ows_e4bd @@ -5772,10 +5780,10 @@ Script_Isaac: ; e4ad (3:64ad) quit_script_fully .ows_e4c1 - jump_if_flag_nonzero_2 EVENT_FLAG_0C, Script_LostToIsaac.ows_e503 - jump_if_flag_zero_2 EVENT_FLAG_28, NULL + jump_if_flag_nonzero_2 EVENT_BEAT_ISAAC, Script_LostToIsaac.ows_e503 + jump_if_flag_zero_2 EVENT_ISAAC_TALKED, NULL print_variable_npc_text Text0633, Text0634 - max_out_flag_value EVENT_FLAG_28 + max_out_flag_value EVENT_ISAAC_TALKED ask_question_jump Text0635, .ows_e4d9 print_npc_text Text0636 quit_script_fully @@ -5787,11 +5795,11 @@ Script_Isaac: ; e4ad (3:64ad) Script_BeatIsaac: ; e4e1 (3:64e1) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0C, Script_LostToIsaac.ows_e517 + jump_if_flag_nonzero_2 EVENT_BEAT_ISAAC, Script_LostToIsaac.ows_e517 print_npc_text Text0638 - max_out_flag_value EVENT_FLAG_0C + max_out_flag_value EVENT_BEAT_ISAAC try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_0C + show_medal_received_screen EVENT_BEAT_ISAAC record_master_win $04 print_npc_text Text0639 give_booster_packs BOOSTER_MYSTERY_LIGHTNING_COLORLESS, BOOSTER_MYSTERY_LIGHTNING_COLORLESS, NO_BOOSTER @@ -5800,7 +5808,7 @@ Script_BeatIsaac: ; e4e1 (3:64e1) Script_LostToIsaac: ; e4fb (3:64fb) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0C, .ows_e522 + jump_if_flag_nonzero_2 EVENT_BEAT_ISAAC, .ows_e522 print_text_quit_fully Text063b .ows_e503 @@ -5880,18 +5888,18 @@ Script_Clerk5: ; e566 (3:6566) print_text_quit_fully Text06d7 Preload_MichaelInGrassClubEntrance: ; e56a (3:656a) - get_flag_value EVENT_FLAG_11 + get_flag_value EVENT_PUPIL_MICHAEL_STATE or a ret z - cp $08 + cp 8 ret Script_Michael: ; e573 (3:6573) start_script - jump_if_flag_not_less_than EVENT_FLAG_11, $08, Script_MichaelRematch - jump_if_flag_equal EVENT_FLAG_11, $01, NULL + jump_if_flag_not_less_than EVENT_PUPIL_MICHAEL_STATE, 8, Script_MichaelRematch + jump_if_flag_equal EVENT_PUPIL_MICHAEL_STATE, 1, NULL print_variable_npc_text Text06d8, Text06d9 - script_set_flag_value EVENT_FLAG_11, $02 + script_set_flag_value EVENT_PUPIL_MICHAEL_STATE, 2 ask_question_jump Text06da, .ows_e58f print_npc_text Text06db quit_script_fully @@ -5903,7 +5911,7 @@ Script_Michael: ; e573 (3:6573) Script_BeatMichaelInGrassClubEntrance: ; e597 (3:6597) start_script - script_set_flag_value EVENT_FLAG_11, $08 + script_set_flag_value EVENT_PUPIL_MICHAEL_STATE, 8 print_npc_text Text06dd give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER print_npc_text Text06de @@ -5952,7 +5960,7 @@ GrassClubLobbyAfterDuel: ; e5c4 (3:65c4) Script_Brittany: ; e5d2 (3:65d2) start_script - jump_if_flag_less_than EVENT_FLAG_35, $01, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $01, NULL print_variable_npc_text Text06e0, Text06e1 ask_question_jump Text06e2, .start_duel print_npc_text Text06e3 @@ -5967,14 +5975,14 @@ Script_BeatBrittany: ; e5ee (3:65ee) start_script print_npc_text Text06e5 give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER - jump_if_flag_less_than EVENT_FLAG_35, $02, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $02, NULL print_variable_npc_text Text06e6, Text06e7 max_out_flag_value EVENT_BEAT_BRITTANY - jump_if_flag_not_less_than EVENT_FLAG_35, $02, .quit - jump_if_flag_zero_2 EVENT_FLAG_3A, .quit - jump_if_flag_zero_2 EVENT_FLAG_3B, .quit - script_set_flag_value EVENT_FLAG_35, $01 - max_out_flag_value EVENT_FLAG_1E + jump_if_flag_not_less_than EVENT_NIKKI_STATE, $02, .quit + jump_if_flag_zero_2 EVENT_BEAT_KRISTIN, .quit + jump_if_flag_zero_2 EVENT_BEAT_HEATHER, .quit + script_set_flag_value EVENT_NIKKI_STATE, $01 + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED print_npc_text Text06e8 .quit quit_script_fully @@ -5988,13 +5996,13 @@ Script_e61c: ; e61c (3:661c) Script_Lass2: ; e61f (3:661f) start_script - 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 - jump_if_flag_equal EVENT_FLAG_37, $00, NULL + jump_if_flag_nonzero_2 EVENT_TEMP_TRADED_WITH_LASS2, Script_e61c + jump_if_flag_not_less_than EVENT_LASS2_TRADE_STATE, $06, Script_e61c + jump_if_flag_not_less_than EVENT_LASS2_TRADE_STATE, $04, .ows_e6a1 + jump_if_flag_not_less_than EVENT_LASS2_TRADE_STATE, $02, .ows_e66a + jump_if_flag_equal EVENT_LASS2_TRADE_STATE, $00, NULL print_variable_npc_text Text06eb, Text06ec - script_set_flag_value EVENT_FLAG_37, $01 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $01 ask_question_jump Text06ed, .ows_e648 print_text_quit_fully Text06ee @@ -6007,8 +6015,8 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f0 .ows_e656 - max_out_flag_value EVENT_FLAG_04 - script_set_flag_value EVENT_FLAG_37, $02 + max_out_flag_value EVENT_TEMP_TRADED_WITH_LASS2 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $02 print_npc_text Text06f1 print_text Text06f2 take_card ODDISH @@ -6017,9 +6025,9 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e66a - jump_if_flag_equal EVENT_FLAG_37, $02, NULL + jump_if_flag_equal EVENT_LASS2_TRADE_STATE, $02, NULL print_variable_npc_text Text06f4, Text06f5 - script_set_flag_value EVENT_FLAG_37, $03 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $03 ask_question_jump Text06ed, .ows_e67f print_text_quit_fully Text06f6 @@ -6032,8 +6040,8 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f8 .ows_e68d - max_out_flag_value EVENT_FLAG_04 - script_set_flag_value EVENT_FLAG_37, $04 + max_out_flag_value EVENT_TEMP_TRADED_WITH_LASS2 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $04 print_npc_text Text06f9 print_text Text06fa take_card CLEFAIRY @@ -6042,9 +6050,9 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06f3 .ows_e6a1 - jump_if_flag_equal EVENT_FLAG_37, $04, NULL + jump_if_flag_equal EVENT_LASS2_TRADE_STATE, $04, NULL print_variable_npc_text Text06fb, Text06fc - script_set_flag_value EVENT_FLAG_37, $05 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $05 ask_question_jump Text06ed, .ows_e6b6 print_text_quit_fully Text06fd @@ -6057,8 +6065,8 @@ Script_Lass2: ; e61f (3:661f) print_text_quit_fully Text06ff .ows_e6c4 - max_out_flag_value EVENT_FLAG_04 - script_set_flag_value EVENT_FLAG_37, $06 + max_out_flag_value EVENT_TEMP_TRADED_WITH_LASS2 + script_set_flag_value EVENT_LASS2_TRADE_STATE, $06 print_npc_text Text0700 print_text Text0701 take_card CHARIZARD @@ -6071,7 +6079,7 @@ Script_Granny2: ; e6d8 (3:66d8) print_text_quit_fully Text0702 Preload_Gal2: ; e6dc (3:66dc) - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS cp $01 ret @@ -6103,7 +6111,7 @@ GrassClubAfterDuel: ; e6e7 (3:66e7) Script_Kristin: ; e701 (3:6701) start_script - jump_if_flag_less_than EVENT_FLAG_35, $01, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $01, NULL print_variable_npc_text Text0704, Text0705 ask_question_jump Text0706, .ows_e714 print_text_quit_fully Text0707 @@ -6119,12 +6127,12 @@ Script_BeatKristin: ; e71c (3:671c) print_npc_text Text0709 give_booster_packs BOOSTER_EVOLUTION_GRASS, BOOSTER_EVOLUTION_GRASS, NO_BOOSTER print_npc_text Text070a - max_out_flag_value EVENT_FLAG_3A - jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e740 + max_out_flag_value EVENT_BEAT_KRISTIN + jump_if_flag_not_less_than EVENT_NIKKI_STATE, $02, .ows_e740 jump_if_flag_zero_2 EVENT_BEAT_BRITTANY, .ows_e740 - jump_if_flag_zero_2 EVENT_FLAG_3B, .ows_e740 - script_set_flag_value EVENT_FLAG_35, $01 - max_out_flag_value EVENT_FLAG_1E + jump_if_flag_zero_2 EVENT_BEAT_HEATHER, .ows_e740 + script_set_flag_value EVENT_NIKKI_STATE, $01 + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED print_npc_text Text070b .ows_e740 quit_script_fully @@ -6135,7 +6143,7 @@ Script_LostToKristin: ; e741 (3:6741) Script_Heather: ; e745 (3:6745) start_script - jump_if_flag_less_than EVENT_FLAG_35, $01, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $01, NULL print_variable_npc_text Text070d, Text070e ask_question_jump Text070f, .ows_e758 print_text_quit_fully Text0710 @@ -6147,28 +6155,28 @@ Script_Heather: ; e745 (3:6745) Script_BeatHeather: ; e760 (3:6760) start_script - jump_if_flag_less_than EVENT_FLAG_35, $02, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $02, NULL print_variable_npc_text Text0712, Text0713 give_booster_packs BOOSTER_COLOSSEUM_GRASS, BOOSTER_COLOSSEUM_GRASS, NO_BOOSTER print_npc_text Text0714 - max_out_flag_value EVENT_FLAG_3B - jump_if_flag_not_less_than EVENT_FLAG_35, $02, .ows_e789 + max_out_flag_value EVENT_BEAT_HEATHER + jump_if_flag_not_less_than EVENT_NIKKI_STATE, $02, .ows_e789 jump_if_flag_zero_2 EVENT_BEAT_BRITTANY, .ows_e789 - jump_if_flag_zero_2 EVENT_FLAG_3A, .ows_e789 - script_set_flag_value EVENT_FLAG_35, $01 - max_out_flag_value EVENT_FLAG_1E + jump_if_flag_zero_2 EVENT_BEAT_KRISTIN, .ows_e789 + script_set_flag_value EVENT_NIKKI_STATE, $01 + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED print_npc_text Text0715 .ows_e789 quit_script_fully Script_LostToHeather: ; e78a (3:678a) start_script - jump_if_flag_less_than EVENT_FLAG_35, $02, NULL + jump_if_flag_less_than EVENT_NIKKI_STATE, $02, NULL print_variable_npc_text Text0716, Text0717 quit_script_fully Preload_NikkiInGrassClub: ; e796 (3:6796) - get_flag_value EVENT_FLAG_35 + get_flag_value EVENT_NIKKI_STATE cp $02 ccf ret @@ -6179,15 +6187,15 @@ Script_Nikki: ; e79e (3:679e) jp z, Script_dae9 start_script - jump_if_flag_zero_2 EVENT_FLAG_08, NULL + jump_if_flag_zero_2 EVENT_BEAT_NIKKI, NULL print_variable_npc_text Text0718, Text0719 ask_question_jump Text071a, .ows_e7bf - jump_if_flag_zero_2 EVENT_FLAG_08, NULL + jump_if_flag_zero_2 EVENT_BEAT_NIKKI, NULL print_variable_npc_text Text071b, Text071c quit_script_fully .ows_e7bf - jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_e7cb + jump_if_flag_nonzero_2 EVENT_BEAT_NIKKI, .ows_e7cb print_npc_text Text071d start_duel PRIZES_6, FLOWER_POWER_DECK_ID, MUSIC_DUEL_THEME_2 quit_script_fully @@ -6199,12 +6207,12 @@ Script_Nikki: ; e79e (3:679e) Script_BeatNikki: ; e7d3 (3:67d3) start_script - jump_if_flag_zero_2 EVENT_FLAG_08, NULL + jump_if_flag_zero_2 EVENT_BEAT_NIKKI, NULL print_variable_npc_text Text071f, Text0720 - jump_if_flag_nonzero_2 EVENT_FLAG_08, .ows_e7eb - max_out_flag_value EVENT_FLAG_08 + jump_if_flag_nonzero_2 EVENT_BEAT_NIKKI, .ows_e7eb + max_out_flag_value EVENT_BEAT_NIKKI try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_08 + show_medal_received_screen EVENT_BEAT_NIKKI record_master_win $05 print_npc_text Text0721 .ows_e7eb @@ -6253,7 +6261,7 @@ TryFirstRonaldFight: ; e822 (3:6822) ld [wTempNPC], a call FindLoadedNPC ret c - get_flag_value EVENT_FLAG_4C + get_flag_value EVENT_RONALD_FIRST_DUEL_STATE or a ret nz ld bc, Script_FirstRonaldFight @@ -6264,7 +6272,7 @@ TrySecondRonaldFight: ; e837 (3:6837) ld [wTempNPC], a call FindLoadedNPC ret c - get_flag_value EVENT_FLAG_4D + get_flag_value EVENT_RONALD_SECOND_DUEL_STATE or a ret nz ld bc, Script_SecondRonaldFight @@ -6276,18 +6284,18 @@ Script_Clerk6: ; e84c (3:684c) Script_Lad3: ; e850 (3:6850) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0643, Text0644 quit_script_fully Preload_Ronald1InClubEntrance: ; e85b (3:685b) - get_flag_value EVENT_FLAG_4B + get_flag_value EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER cp $01 ret Script_FirstRonaldEncounter: ; e862 (3:6862) start_script - max_out_flag_value EVENT_FLAG_4B + max_out_flag_value EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER move_active_npc NPCMovement_e894 load_current_map_name_into_txram_slot $00 print_npc_text Text0645 @@ -6320,7 +6328,7 @@ NPCMovement_e894: ; e894 (3:6894) db $ff Preload_Ronald2InClubEntrance: ; e89a (3:689a) - get_flag_value EVENT_FLAG_4C + get_flag_value EVENT_RONALD_FIRST_DUEL_STATE ld e, $02 Func_e8a0: ; e8a0 (3:68a0) cp $01 @@ -6334,6 +6342,7 @@ Func_e8a0: ; e8a0 (3:68a0) .asm_e8b2 or a ret + .asm_e8b4 ld a, $08 ld [wLoadNPCXPos], a @@ -6357,7 +6366,7 @@ Script_FirstRonaldFight: ; e8c0 (3:68c0) move_player SOUTH, 1 move_player SOUTH, 1 print_npc_text Text064b - script_set_flag_value EVENT_FLAG_4C, $01 + script_set_flag_value EVENT_RONALD_FIRST_DUEL_STATE, $01 start_duel PRIZES_6, IM_RONALD_DECK_ID, MUSIC_RONALD quit_script_fully @@ -6373,7 +6382,7 @@ Script_LostToFirstRonaldFight: ; e8f7 (3:68f7) start_script print_npc_text Text064e .ows_e8fb - script_set_flag_value EVENT_FLAG_4C, $02 + script_set_flag_value EVENT_RONALD_FIRST_DUEL_STATE, $02 close_text_box move_active_npc NPCMovement_e90f unload_active_npc @@ -6403,7 +6412,7 @@ NPCMovement_e90f: ; e90f (3:690f) db $ff Preload_Ronald3InClubEntrance: ; e915 (3:6915) - get_flag_value EVENT_FLAG_4D + get_flag_value EVENT_RONALD_SECOND_DUEL_STATE ld e, $05 jp Func_e8a0 @@ -6421,7 +6430,7 @@ Script_SecondRonaldFight: ; e91e (3:691e) move_player SOUTH, 1 move_player SOUTH, 1 print_npc_text Text0650 - script_set_flag_value EVENT_FLAG_4D, $01 + script_set_flag_value EVENT_RONALD_SECOND_DUEL_STATE, $01 start_duel PRIZES_6, POWERFUL_RONALD_DECK_ID, MUSIC_RONALD quit_script_fully @@ -6437,7 +6446,7 @@ Script_LostToSecondRonaldFight: ; e955 (3:6955) start_script print_npc_text Text0653 .ows_e959 - script_set_flag_value EVENT_FLAG_4D, $02 + script_set_flag_value EVENT_RONALD_SECOND_DUEL_STATE, $02 close_text_box move_active_npc NPCMovement_e90f unload_active_npc @@ -6489,27 +6498,27 @@ Script_LostToRobert: ; e9a1 (3:69a1) Script_Pappy1: ; e9a5 (3:69a5) start_script - jump_if_flag_equal EVENT_FLAG_31, $03, .ows_e9de - jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_e9cb - jump_if_flag_equal EVENT_FLAG_31, $02, .ows_e9c8 - script_set_flag_value EVENT_FLAG_31, $01 + jump_if_flag_equal EVENT_PAPPY1_STATE, $03, .ows_e9de + jump_if_flag_nonzero_2 EVENT_BEAT_MURRAY, .ows_e9cb + jump_if_flag_equal EVENT_PAPPY1_STATE, $02, .ows_e9c8 + script_set_flag_value EVENT_PAPPY1_STATE, $01 print_npc_text Text065b ask_question_jump_default_yes Text065c, .ows_e9c2 print_text_quit_fully Text065d .ows_e9c2 - script_set_flag_value EVENT_FLAG_31, $02 + script_set_flag_value EVENT_PAPPY1_STATE, $02 print_text_quit_fully Text065e .ows_e9c8 print_text_quit_fully Text065f .ows_e9cb - jump_if_flag_zero_1 EVENT_FLAG_31, NULL + jump_if_flag_zero_1 EVENT_PAPPY1_STATE, NULL print_variable_npc_text Text0660, Text0661 give_card MEWTWO3 show_card_received_screen MEWTWO3 - script_set_flag_value EVENT_FLAG_31, $03 + script_set_flag_value EVENT_PAPPY1_STATE, $03 print_text_quit_fully Text0662 .ows_e9de @@ -6520,7 +6529,7 @@ Func_e9e1: ; e9e1 (3:69e1) get_flag_value EVENT_MEDAL_COUNT cp $04 jr nz, .asm_e9f5 - get_flag_value EVENT_FLAG_32 + get_flag_value EVENT_RONALD_PSYCHIC_CLUB_LOBBY_ENCOUNTER or a jr nz, .asm_e9f5 scf @@ -6539,7 +6548,7 @@ Preload_Ronald1InPsychicClubLobby: ; e9f7 (3:69f7) Script_ea02: ; ea02 (3:6a02) start_script move_active_npc_by_direction NPCMovementTable_ea1a - max_out_flag_value EVENT_FLAG_32 + max_out_flag_value EVENT_RONALD_PSYCHIC_CLUB_LOBBY_ENCOUNTER print_npc_text Text0664 close_text_box set_player_direction SOUTH @@ -6573,13 +6582,13 @@ NPCMovement_ea2c: ; ea2c (3:6a2c) Script_Gal3: ; ea30 (3:6a30) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0665, Text0666 quit_script_fully Script_Chap4: ; ea3b (3:6a3b) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0667, Text0668 quit_script_fully @@ -6609,8 +6618,8 @@ Script_Daniel: ; ea60 (3:6a60) start_script try_give_medal_pc_packs jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $04, .ows_ea7e - jump_if_flag_nonzero_2 EVENT_FLAG_2F, .ows_ea70 - max_out_flag_value EVENT_FLAG_2F + jump_if_flag_nonzero_2 EVENT_DANIEL_TALKED, .ows_ea70 + max_out_flag_value EVENT_DANIEL_TALKED print_npc_text Text0669 .ows_ea70 jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $01, .ows_ea78 @@ -6692,10 +6701,10 @@ Script_Murray: ; eadf (3:6adf) quit_script_fully .ows_eaef - jump_if_flag_nonzero_2 EVENT_FLAG_0D, Script_LostToMurray.ows_eb31 - jump_if_flag_zero_2 EVENT_FLAG_30, NULL + jump_if_flag_nonzero_2 EVENT_BEAT_MURRAY, Script_LostToMurray.ows_eb31 + jump_if_flag_zero_2 EVENT_MURRAY_TALKED, NULL print_variable_npc_text Text067d, Text067e - max_out_flag_value EVENT_FLAG_30 + max_out_flag_value EVENT_MURRAY_TALKED ask_question_jump Text067f, .ows_eb07 print_npc_text Text0680 quit_script_fully @@ -6707,11 +6716,11 @@ Script_Murray: ; eadf (3:6adf) Script_BeatMurray: ; eb0f (3:6b0f) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0D, Script_LostToMurray.ows_eb45 + jump_if_flag_nonzero_2 EVENT_BEAT_MURRAY, Script_LostToMurray.ows_eb45 print_npc_text Text0682 - max_out_flag_value EVENT_FLAG_0D + max_out_flag_value EVENT_BEAT_MURRAY try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_0D + show_medal_received_screen EVENT_BEAT_MURRAY record_master_win $06 print_npc_text Text0683 give_booster_packs BOOSTER_LABORATORY_PSYCHIC, BOOSTER_LABORATORY_PSYCHIC, NO_BOOSTER @@ -6720,7 +6729,7 @@ Script_BeatMurray: ; eb0f (3:6b0f) Script_LostToMurray: ; eb29 (3:6b29) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_0D, .ows_eb50 + jump_if_flag_nonzero_2 EVENT_BEAT_MURRAY, .ows_eb50 print_text_quit_fully Text0685 .ows_eb31 @@ -6771,6 +6780,7 @@ Preload_ImakuniInScienceClubLobby: ; eb65 (3:6b65) .asm_eb7b or a ret + .asm_eb7d ld a, MUSIC_IMAKUNI ld [wd111], a @@ -6779,34 +6789,34 @@ Preload_ImakuniInScienceClubLobby: ; eb65 (3:6b65) Script_Lad1: ; eb84 (3:6b84) start_script - jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_ebbb - jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_eb97 - max_out_flag_value EVENT_FLAG_1C - max_out_flag_value EVENT_FLAG_1E - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $07, .ows_ebbb + jump_if_flag_nonzero_2 EVENT_ISHIHARA_MET, .ows_eb97 + max_out_flag_value EVENT_ISHIHARA_MENTIONED + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0745 .ows_eb97 - jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_ebb8 - jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_ebaf - jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_ebaa - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_nonzero_2 EVENT_TEMP_TRADED_WITH_ISHIHARA, .ows_ebb8 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $05, .ows_ebaf + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $03, .ows_ebaa + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0746 .ows_ebaa - max_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0747 .ows_ebaf - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_ebb8 - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_ebb8 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0748 .ows_ebb8 print_text_quit_fully Text0749 .ows_ebbb - script_set_flag_value EVENT_FLAG_1F, $08 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $08 print_text_quit_fully Text074a Script_Man3: ; ebc1 (3:6bc1) @@ -6876,9 +6886,9 @@ ScienceClubAfterDuel: ; ebf1 (3:6bf1) Script_David: ; ec11 (3:6c11) start_script - jump_if_flag_zero_1 EVENT_FLAG_1A, NULL + jump_if_flag_zero_1 EVENT_DAVID_STATE, NULL print_variable_npc_text Text074f, Text0750 - script_set_flag_value EVENT_FLAG_1A, $01 + script_set_flag_value EVENT_DAVID_STATE, $01 ask_question_jump Text0751, .ows_ec27 print_npc_text Text0752 quit_script_fully @@ -6890,7 +6900,7 @@ Script_David: ; ec11 (3:6c11) Script_BeatDavid: ; ec2f (3:6c2f) start_script - script_set_flag_value EVENT_FLAG_1A, $02 + script_set_flag_value EVENT_DAVID_STATE, $02 print_npc_text Text0754 give_booster_packs BOOSTER_MYSTERY_GRASS_COLORLESS, BOOSTER_MYSTERY_GRASS_COLORLESS, NO_BOOSTER print_npc_text Text0755 @@ -6925,7 +6935,7 @@ Script_LostToErik: ; ec63 (3:6c63) Script_Rick: ; ec67 (3:6c67) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_09, Script_LostToRick.ows_eca2 + jump_if_flag_nonzero_2 EVENT_BEAT_RICK, Script_LostToRick.ows_eca2 print_npc_text Text075e ask_question_jump Text075f, .ows_ec78 print_npc_text Text0760 @@ -6938,11 +6948,11 @@ Script_Rick: ; ec67 (3:6c67) Script_BeatRick: ; ec80 (3:6c80) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_09, Script_LostToRick.ows_ecb6 + jump_if_flag_nonzero_2 EVENT_BEAT_RICK, Script_LostToRick.ows_ecb6 print_npc_text Text0762 - max_out_flag_value EVENT_FLAG_09 + max_out_flag_value EVENT_BEAT_RICK try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_09 + show_medal_received_screen EVENT_BEAT_RICK record_master_win $07 print_npc_text Text0763 give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER @@ -6951,7 +6961,7 @@ Script_BeatRick: ; ec80 (3:6c80) Script_LostToRick: ; ec9a (3:6c9a) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_09, .ows_ecc1 + jump_if_flag_nonzero_2 EVENT_BEAT_RICK, .ows_ecc1 print_text_quit_fully Text0765 .ows_eca2 @@ -6975,7 +6985,7 @@ Script_LostToRick: ; ec9a (3:6c9a) print_text_quit_fully Text076b Preload_Joseph: ; ecc4 (3:6cc4) - ld a, EVENT_FLAG_1B + ld a, EVENT_JOSEPH_STATE call GetEventFlagValue or a jr z, .asm_ecd9 @@ -6991,7 +7001,7 @@ Preload_Joseph: ; ecc4 (3:6cc4) Script_Joseph: ; ecdb (3:6cdb) start_script try_give_pc_pack $08 - jump_if_flag_nonzero_2 EVENT_FLAG_1B, Script_LostToJoseph.ows_ed24 + jump_if_flag_nonzero_2 EVENT_JOSEPH_STATE, Script_LostToJoseph.ows_ed24 print_npc_text Text076c ask_question_jump Text076d, .ows_ecee print_npc_text Text076e @@ -7004,12 +7014,12 @@ Script_Joseph: ; ecdb (3:6cdb) Script_BeatJoseph: ; ecf6 (3:6cf6) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_1B, Script_LostToJoseph.ows_ed37 + jump_if_flag_nonzero_2 EVENT_JOSEPH_STATE, Script_LostToJoseph.ows_ed37 print_npc_text Text0770 close_text_box move_active_npc_by_direction NPCMovementTable_ed11 set_active_npc_direction WEST - max_out_flag_value EVENT_FLAG_1B + max_out_flag_value EVENT_JOSEPH_STATE print_npc_text Text0771 give_booster_packs BOOSTER_LABORATORY_GRASS, BOOSTER_LABORATORY_GRASS, NO_BOOSTER print_npc_text Text0772 @@ -7028,7 +7038,7 @@ NPCMovement_ed19: ; ed19 (3:6d19) Script_LostToJoseph: ; ed1c (3:6d1c) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_1B, .ows_ed42 + jump_if_flag_nonzero_2 EVENT_JOSEPH_STATE, .ows_ed42 print_text_quit_fully Text0773 .ows_ed24 @@ -7112,18 +7122,18 @@ FindExtraInteractableObjects: ; ed64 (3:6d64) ret Preload_JessicaInFireClubLobby: ; ed8d (3:6d8d) - get_flag_value EVENT_FLAG_20 + get_flag_value EVENT_PUPIL_JESSICA_STATE or a ret z - cp $08 + cp 8 ret Script_Jessica: ; ed96 (3:6d96) start_script - jump_if_flag_not_less_than EVENT_FLAG_20, $08, Script_dead - jump_if_flag_equal EVENT_FLAG_20, $01, NULL + jump_if_flag_not_less_than EVENT_PUPIL_JESSICA_STATE, 8, Script_dead + jump_if_flag_equal EVENT_PUPIL_JESSICA_STATE, 1, NULL print_variable_npc_text Text068d, Text068e - script_set_flag_value EVENT_FLAG_20, $02 + script_set_flag_value EVENT_PUPIL_JESSICA_STATE, 2 ask_question_jump Text068f, .ows_edb2 print_npc_text Text0690 quit_script_fully @@ -7135,7 +7145,7 @@ Script_Jessica: ; ed96 (3:6d96) Script_BeatJessicaInFireClubLobby: ; edba (3:6dba) start_script - script_set_flag_value EVENT_FLAG_20, $08 + script_set_flag_value EVENT_PUPIL_JESSICA_STATE, 8 print_npc_text Text0692 give_booster_packs BOOSTER_COLOSSEUM_FIGHTING, BOOSTER_COLOSSEUM_FIGHTING, NO_BOOSTER print_npc_text Text0693 @@ -7173,38 +7183,38 @@ NPCMovement_ede4: ; ede4 (3:6de4) Script_Chap3: ; ede8 (3:6de8) start_script - jump_if_flag_not_less_than EVENT_FLAG_1F, $07, .ows_ee1f - jump_if_flag_nonzero_2 EVENT_FLAG_1D, .ows_edfb - max_out_flag_value EVENT_FLAG_1C - max_out_flag_value EVENT_FLAG_1E - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $07, .ows_ee1f + jump_if_flag_nonzero_2 EVENT_ISHIHARA_MET, .ows_edfb + max_out_flag_value EVENT_ISHIHARA_MENTIONED + max_out_flag_value EVENT_ISHIHARAS_HOUSE_MENTIONED + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0695 .ows_edfb - jump_if_flag_nonzero_2 EVENT_FLAG_00, .ows_ee1c - jump_if_flag_not_less_than EVENT_FLAG_1F, $05, .ows_ee13 - jump_if_flag_not_less_than EVENT_FLAG_1F, $03, .ows_ee0e - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_nonzero_2 EVENT_TEMP_TRADED_WITH_ISHIHARA, .ows_ee1c + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $05, .ows_ee13 + jump_if_flag_not_less_than EVENT_ISHIHARA_TRADE_STATE, $03, .ows_ee0e + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0696 .ows_ee0e - max_out_flag_value EVENT_FLAG_38 + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0697 .ows_ee13 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_ee1c - max_out_flag_value EVENT_FLAG_38 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_ee1c + max_out_flag_value EVENT_ISHIHARA_WANTS_TO_TRADE print_text_quit_fully Text0698 .ows_ee1c print_text_quit_fully Text0699 .ows_ee1f - script_set_flag_value EVENT_FLAG_1F, $08 + script_set_flag_value EVENT_ISHIHARA_TRADE_STATE, $08 print_text_quit_fully Text069a Preload_Lad2: ; ee25 (3:6e25) - get_flag_value EVENT_FLAG_21 + get_flag_value EVENT_LAD2_STATE cp $01 ret @@ -7218,7 +7228,7 @@ Script_Lad2: ; ee2c (3:6e2c) print_npc_text Text069c ask_question_jump Text069d, .ows_ee4a print_npc_text Text069e - script_set_flag_value EVENT_FLAG_21, $02 + script_set_flag_value EVENT_LAD2_STATE, $02 close_text_box move_active_npc_by_direction NPCMovementTable_ee61 unload_active_npc @@ -7233,7 +7243,7 @@ Script_Lad2: ; ee2c (3:6e2c) remove_all_energy_cards_from_collection print_text Text06a0 print_npc_text Text06a1 - script_set_flag_value EVENT_FLAG_21, $01 + script_set_flag_value EVENT_LAD2_STATE, $01 close_text_box move_active_npc_by_direction NPCMovementTable_ee61 unload_active_npc @@ -7263,11 +7273,11 @@ NPCMovement_ee72: ; ee72 (3:6e72) Script_ee76: ; ee76 (3:6e76) start_script - jump_if_flag_equal EVENT_FLAG_21, $01, .ows_ee7d + jump_if_flag_equal EVENT_LAD2_STATE, $01, .ows_ee7d quit_script_fully .ows_ee7d - script_set_flag_value EVENT_FLAG_21, $02 + script_set_flag_value EVENT_LAD2_STATE, $02 print_text FoundLv9SlowpokeText give_card SLOWPOKE1 show_card_received_screen SLOWPOKE1 @@ -7275,7 +7285,7 @@ Script_ee76: ; ee76 (3:6e76) Script_Mania: ; ee88 (3:6e88) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text06a3, Text06a4 quit_script_fully @@ -7378,19 +7388,19 @@ Script_LostToJonathan: ; ef1e (3:6f1e) Script_Ken: ; ef22 (3:6f22) start_script try_give_pc_pack $09 - jump_if_flag_nonzero_2 EVENT_FLAG_23, .have_300_cards + jump_if_flag_nonzero_2 EVENT_KEN_HAD_ENOUGH_CARDS, .have_300_cards jump_if_enough_cards_owned 300, .have_300_cards - jump_if_flag_zero_1 EVENT_FLAG_24, NULL + jump_if_flag_zero_1 EVENT_KEN_TALKED, NULL print_variable_npc_text Text06ba, Text06bb - script_set_flag_value EVENT_FLAG_24, $01 + script_set_flag_value EVENT_KEN_TALKED, $01 quit_script_fully .have_300_cards - max_out_flag_value EVENT_FLAG_23 - jump_if_flag_nonzero_2 EVENT_FLAG_0A, Script_Ken_AlreadyHaveMedal - jump_if_flag_zero_1 EVENT_FLAG_24, NULL + max_out_flag_value EVENT_KEN_HAD_ENOUGH_CARDS + jump_if_flag_nonzero_2 EVENT_BEAT_KEN, Script_Ken_AlreadyHaveMedal + jump_if_flag_zero_1 EVENT_KEN_TALKED, NULL print_variable_npc_text Text06bc, Text06bd - script_set_flag_value EVENT_FLAG_24, $01 + script_set_flag_value EVENT_KEN_TALKED, $01 ask_question_jump Text06be, .start_duel print_npc_text Text06bf quit_script_fully @@ -7403,10 +7413,10 @@ Script_Ken: ; ef22 (3:6f22) Script_BeatKen: ; ef5e (3:6f5e) start_script print_npc_text Text06c1 - jump_if_flag_nonzero_2 EVENT_FLAG_0A, .give_booster_packs - max_out_flag_value EVENT_FLAG_0A + jump_if_flag_nonzero_2 EVENT_BEAT_KEN, .give_booster_packs + max_out_flag_value EVENT_BEAT_KEN try_give_medal_pc_packs - show_medal_received_screen EVENT_FLAG_0A + show_medal_received_screen EVENT_BEAT_KEN record_master_win $08 print_npc_text Text06c2 .give_booster_packs @@ -7416,7 +7426,7 @@ Script_BeatKen: ; ef5e (3:6f5e) Script_LostToKen: ; ef78 (3:6f78) start_script - jump_if_flag_zero_2 EVENT_FLAG_0A, NULL + jump_if_flag_zero_2 EVENT_BEAT_KEN, NULL print_variable_npc_text Text06c4, Text06c5 quit_script_fully @@ -7437,91 +7447,91 @@ Preload_Clerk9: ; ef96 (3:6f96) cp $09 jp c, JumpToFunctionInTable debug_ret - jr .asm_efe4 + jr .less_than_three_medals .jump_table - dw .asm_efe4 - dw .asm_efe4 - dw .asm_efe4 - dw .asm_efba - dw .asm_efde - dw .asm_efc9 - dw .asm_efd8 - dw .asm_efd8 - dw .asm_efd8 - -.asm_efba - get_flag_value EVENT_FLAG_3F + dw .less_than_three_medals + dw .less_than_three_medals + dw .less_than_three_medals + dw .three_medals + dw .four_medals + dw .five_medals + dw .more_than_five_medals + dw .more_than_five_medals + dw .more_than_five_medals + +.three_medals + get_flag_value EVENT_CHALLENGE_CUP_1_STATE or a - jr nz, .asm_efe4 + jr nz, .less_than_three_medals ld c, $01 - set_flag_value EVENT_FLAG_3F - jr .asm_efe4 + set_flag_value EVENT_CHALLENGE_CUP_1_STATE + jr .less_than_three_medals -.asm_efc9 - get_flag_value EVENT_FLAG_40 +.five_medals + get_flag_value EVENT_CHALLENGE_CUP_2_STATE or a - jr nz, .asm_efde + jr nz, .four_medals ld c, $01 - set_flag_value EVENT_FLAG_40 - jr .asm_efde + set_flag_value EVENT_CHALLENGE_CUP_2_STATE + jr .four_medals -.asm_efd8 +.more_than_five_medals ld c, $07 - set_flag_value EVENT_FLAG_40 -.asm_efde + set_flag_value EVENT_CHALLENGE_CUP_2_STATE +.four_medals ld c, $07 - set_flag_value EVENT_FLAG_3F -.asm_efe4 - zero_flag_value EVENT_FLAG_42 - get_flag_value EVENT_FLAG_3F + set_flag_value EVENT_CHALLENGE_CUP_1_STATE +.less_than_three_medals + zero_flag_value EVENT_CHALLENGE_CUP_STARTING + get_flag_value EVENT_CHALLENGE_CUP_1_STATE cp $00 - jr z, .asm_eff8 + jr z, .check_challenge_cup_two cp $07 - jr z, .asm_eff8 + jr z, .check_challenge_cup_two ld c, $01 - jr .asm_f016 + jr .start_challenge_cup -.asm_eff8 - get_flag_value EVENT_FLAG_40 +.check_challenge_cup_two + get_flag_value EVENT_CHALLENGE_CUP_2_STATE cp $00 - jr z, .asm_f008 + jr z, .check_challenge_cup_three cp $07 - jr z, .asm_f008 + jr z, .check_challenge_cup_three ld c, $02 - jr .asm_f016 + jr .start_challenge_cup -.asm_f008 - get_flag_value EVENT_FLAG_41 +.check_challenge_cup_three + get_flag_value EVENT_CHALLENGE_CUP_3_STATE cp $00 - jr z, .asm_f023 + jr z, .no_challenge_cup cp $07 - jr z, .asm_f023 + jr z, .no_challenge_cup ld c, $03 -.asm_f016 - set_flag_value EVENT_FLAG_44 - max_flag_value EVENT_FLAG_42 +.start_challenge_cup + set_flag_value EVENT_CHALLENGE_CUP_NUMBER + max_flag_value EVENT_CHALLENGE_CUP_STARTING ld a, MUSIC_CHALLENGE_HALL ld [wd111], a -.asm_f023 +.no_challenge_cup scf ret Script_Clerk9: ; f025 (3:7025) start_script - 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 + jump_if_flag_zero_1 EVENT_CHALLENGE_CUP_1_STATE, .ows_f066 + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $07, .ows_f069 + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $03, .ows_f06f + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $02, .ows_f072 + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $01, .ows_f06c + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $07, .ows_f069 + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $03, .ows_f06f + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $02, .ows_f072 + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $01, .ows_f06c + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $07, .ows_f069 + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $03, .ows_f06f + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $02, .ows_f072 + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $01, .ows_f06c .ows_f066 print_text_quit_fully Text050a @@ -7543,7 +7553,7 @@ Preload_ChallengeHallNPCs2: ; f075 (3:7075) ret Preload_ChallengeHallNPCs1: ; f07a (3:707a) - get_flag_value EVENT_FLAG_42 + get_flag_value EVENT_CHALLENGE_CUP_STARTING or a jr z, .quit ld a, MUSIC_CHALLENGE_HALL @@ -7553,7 +7563,7 @@ Preload_ChallengeHallNPCs1: ; f07a (3:707a) ret ChallengeHallLobbyLoadMap: ; f088 (3:7088) - get_flag_value EVENT_FLAG_58 + get_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE or a ret z ld a, NPC_RONALD1 @@ -7587,105 +7597,108 @@ Script_Chap5: ; f0b0 (3:70b0) print_text_quit_fully Text0514 Preload_ChallengeHallLobbyRonald1: ; f0b4 (3:70b4) - zero_flag_value2 EVENT_FLAG_58 - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + zero_flag_value2 EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a - jr nz, .asm_f0ff - get_flag_value EVENT_FLAG_59 + jr nz, .challenge_cup_2_ended + get_flag_value EVENT_PLAYER_ENTERED_CHALLENGE_CUP or a - jr nz, .asm_f11f - get_flag_value EVENT_FLAG_40 + jr nz, .dont_load + get_flag_value EVENT_CHALLENGE_CUP_2_STATE cp $00 - jr z, .asm_f0e5 - call .asm_710f - get_flag_value EVENT_FLAG_40 + jr z, .check_challenge_cup_1 + call .challenge_cup_1_ended + get_flag_value EVENT_CHALLENGE_CUP_2_STATE ld e, a - get_flag_value EVENT_FLAG_49 + get_flag_value EVENT_CHALLENGE_CUP_2_RESULT ld d, a - ld hl, Unknown_f156 - call Func_f121 - jr nc, .asm_f11f - jr .asm_f0f7 -.asm_f0e5 - get_flag_value EVENT_FLAG_3F + ld hl, RonaldChallengeHallLobbyCup2States + call SetRonaldChallengeHallLobbyState + jr nc, .dont_load + jr .load_ronald + +.check_challenge_cup_1 + get_flag_value EVENT_CHALLENGE_CUP_1_STATE ld e, a - get_flag_value EVENT_FLAG_48 + get_flag_value EVENT_CHALLENGE_CUP_1_RESULT ld d, a - ld hl, Unknown_f146 - call Func_f121 - jr nc, .asm_f11f -.asm_f0f7 + ld hl, RonaldChallengeHallLobbyCup1States + call SetRonaldChallengeHallLobbyState + jr nc, .dont_load +.load_ronald ld a, [wPlayerYCoord] ld [wLoadNPCYPos], a scf ret -.asm_f0ff - max_flag_value EVENT_FLAG_54 - max_flag_value EVENT_FLAG_55 - max_flag_value EVENT_FLAG_56 - max_flag_value EVENT_FLAG_57 -.asm_710f - max_flag_value EVENT_FLAG_50 - max_flag_value EVENT_FLAG_51 - max_flag_value EVENT_FLAG_52 - max_flag_value EVENT_FLAG_53 -.asm_f11f + +.challenge_cup_2_ended + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_5 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_7 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_8 +.challenge_cup_1_ended + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_1 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_3 + max_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_4 +.dont_load or a ret -Func_f121: ; f121 (3:7121) +SetRonaldChallengeHallLobbyState: ; f121 (3:7121) ld c, $04 -.asm_f123 +.loop ld a, [hli] cp e - jr nz, .asm_f13e + jr nz, .next_inc ld a, [hli] cp d - jr nz, .asm_f13f + jr nz, .next ld a, [hl] call GetEventFlagValue or a - jr nz, .asm_f13f + jr nz, .next ld a, [hl] call MaxOutEventFlag inc hl ld c, [hl] - set_flag_value EVENT_FLAG_58 + set_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE scf ret -.asm_f13e + +.next_inc inc hl -.asm_f13f +.next inc hl inc hl dec c - jr nz, .asm_f123 + jr nz, .loop or a ret -Unknown_f146: ; f146 (3:7146) - db $01, $00, EVENT_FLAG_50, $01 - db $03, $03, EVENT_FLAG_51, $02 - db $07, $03, EVENT_FLAG_52, $03 - db $07, $00, EVENT_FLAG_53, $04 +RonaldChallengeHallLobbyCup1States: ; f146 (3:7146) + db $01, $00, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_1, $01 + db $03, $03, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2, $02 + db $07, $03, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_3, $03 + db $07, $00, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_4, $04 -Unknown_f156: ; f156 (3:7156) - db $01, $00, EVENT_FLAG_54, $05 - db $03, $03, EVENT_FLAG_55, $06 - db $07, $03, EVENT_FLAG_56, $07 - db $07, $00, EVENT_FLAG_57, $08 +RonaldChallengeHallLobbyCup2States: ; f156 (3:7156) + db $01, $00, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_5, $05 + db $03, $03, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6, $06 + db $07, $03, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_7, $07 + db $07, $00, EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_8, $08 Script_f166: ; f166 (3:7166) start_script move_active_npc NPCMovement_f232 - jump_if_flag_equal EVENT_FLAG_58, $01, .ows_f192 - jump_if_flag_equal EVENT_FLAG_58, $02, .ows_f1a5 - jump_if_flag_equal EVENT_FLAG_58, $03, .ows_f1b8 - jump_if_flag_equal EVENT_FLAG_58, $04, .ows_f1cb - jump_if_flag_equal EVENT_FLAG_58, $05, .ows_f1de - jump_if_flag_equal EVENT_FLAG_58, $06, .ows_f1f1 - jump_if_flag_equal EVENT_FLAG_58, $07, .ows_f204 - jump_if_flag_equal EVENT_FLAG_58, $08, .ows_f217 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $01, .ows_f192 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $02, .ows_f1a5 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $03, .ows_f1b8 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $04, .ows_f1cb + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $05, .ows_f1de + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $06, .ows_f1f1 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $07, .ows_f204 + jump_if_flag_equal EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE, $08, .ows_f217 .ows_f192 print_npc_text Text0515 close_text_box @@ -7795,7 +7808,7 @@ ChallengeHallAfterDuelTable: dw Script_LostAtChallengeHall ChallengeHallLoadMap: ; f258 (3:7258) - get_flag_value EVENT_FLAG_47 + get_flag_value EVENT_CHALLENGE_CUP_IN_MENU or a ret z ld a, NPC_HOST @@ -7809,7 +7822,7 @@ Script_Clerk13: ; f26c (3:726c) print_text_quit_fully Text0525 Preload_Guide: ; f270 (3:7270) - get_flag_value EVENT_FLAG_42 + get_flag_value EVENT_CHALLENGE_CUP_STARTING or a jr z, .asm_f281 ld a, $1c @@ -7822,11 +7835,11 @@ Preload_Guide: ; f270 (3:7270) Script_Guide: ; f283 (3:7283) start_script - jump_if_flag_zero_2 EVENT_FLAG_42, .ows_f28b + jump_if_flag_zero_2 EVENT_CHALLENGE_CUP_STARTING, .ows_f28b print_text_quit_fully Text0526 .ows_f28b - jump_if_flag_zero_1 EVENT_FLAG_3F, .ows_f292 + jump_if_flag_zero_1 EVENT_CHALLENGE_CUP_1_STATE, .ows_f292 print_text_quit_fully Text0527 .ows_f292 @@ -7834,14 +7847,14 @@ Script_Guide: ; f283 (3:7283) Script_Clerk12: ; f295 (3:7295) start_script - 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 + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $03, .ows_f2c4 + jump_if_flag_equal EVENT_CHALLENGE_CUP_3_STATE, $02, .ows_f2c1 + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $03, .ows_f2c4 + jump_if_flag_equal EVENT_CHALLENGE_CUP_2_STATE, $02, .ows_f2c1 + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $03, .ows_f2c4 + jump_if_flag_equal EVENT_CHALLENGE_CUP_1_STATE, $02, .ows_f2c1 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $02, .ows_f2cd + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f2d3 script_jump .ows_f2c7 .ows_f2c1 @@ -7866,7 +7879,7 @@ Script_Clerk12: ; f295 (3:7295) print_text_quit_fully Text0530 .ows_f2e1 - max_out_flag_value EVENT_FLAG_59 + max_out_flag_value EVENT_PLAYER_ENTERED_CHALLENGE_CUP print_npc_text Text0531 close_text_box move_active_npc NPCMovement_f349 @@ -7890,8 +7903,8 @@ Script_Clerk12: ; f295 (3:7295) move_player NORTH, 1 move_player NORTH, 1 move_player NORTH, 1 - jump_if_flag_nonzero_2 EVENT_FLAG_43, .ows_f33a - max_out_flag_value EVENT_FLAG_43 + jump_if_flag_nonzero_2 EVENT_CHALLENGE_CUP_STAGE_VISITED, .ows_f33a + max_out_flag_value EVENT_CHALLENGE_CUP_STAGE_VISITED move_player NORTH, 1 move_player NORTH, 1 set_player_direction EAST @@ -7989,8 +8002,8 @@ Script_LostAtChallengeHall: ; f392 (3:7392) move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - jump_if_flag_equal EVENT_FLAG_45, $02, Script_f410 - jump_if_flag_equal EVENT_FLAG_45, $03, Script_f410.ows_f41a + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $02, Script_f410 + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $03, Script_f410.ows_f41a load_challenge_hall_npc_into_txram_slot $00 load_challenge_hall_npc_into_txram_slot $01 print_npc_text Text0536 @@ -8000,22 +8013,22 @@ Script_LostAtChallengeHall: ; f392 (3:7392) print_npc_text Text0537 close_text_box 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 - zero_out_flag_value EVENT_FLAG_51 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $02, .ows_f3ce + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f3d9 + script_set_flag_value EVENT_CHALLENGE_CUP_1_STATE, $03 + script_set_flag_value EVENT_CHALLENGE_CUP_1_RESULT, $03 + zero_out_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2 script_jump .ows_f3e2 .ows_f3ce - script_set_flag_value EVENT_FLAG_40, $03 - script_set_flag_value EVENT_FLAG_49, $03 - zero_out_flag_value EVENT_FLAG_55 + script_set_flag_value EVENT_CHALLENGE_CUP_2_STATE, $03 + script_set_flag_value EVENT_CHALLENGE_CUP_2_RESULT, $03 + zero_out_flag_value EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6 script_jump .ows_f3e2 .ows_f3d9 - script_set_flag_value EVENT_FLAG_41, $03 - script_set_flag_value EVENT_FLAG_4A, $03 + script_set_flag_value EVENT_CHALLENGE_CUP_3_STATE, $03 + script_set_flag_value EVENT_CHALLENGE_CUP_3_RESULT, $03 script_jump .ows_f3e2 .ows_f3e2 @@ -8058,8 +8071,8 @@ Script_f410: ; f410 (3:7410) .ows_f41a print_npc_text Text0539 set_dialog_npc NPC_RONALD1 - jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f42e - jump_if_flag_equal EVENT_FLAG_44, $01, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f42e + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $01, NULL print_variable_npc_text Text053a, Text053b .ows_f42e set_dialog_npc NPC_HOST @@ -8079,10 +8092,10 @@ Script_WonAtChallengeHall: ; f441 (3:7441) move_active_npc NPCMovement_f37d do_frames 20 move_active_npc NPCMovement_f390 - jump_if_flag_equal EVENT_FLAG_45, $03, Script_f4db - jump_if_flag_equal EVENT_FLAG_45, $02, .ows_f456 + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $03, Script_f4db + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $02, .ows_f456 .ows_f456 - jump_if_flag_equal EVENT_FLAG_45, $01, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $01, NULL print_variable_npc_text Text053c, Text053d move_active_npc NPCMovement_f37f load_challenge_hall_npc_into_txram_slot $00 @@ -8096,24 +8109,24 @@ Script_WonAtChallengeHall: ; f441 (3:7441) set_challenge_hall_npc_coords 20, 20 move_challenge_hall_npc NPCMovement_f4d0 load_challenge_hall_npc_into_txram_slot $00 - jump_if_flag_equal EVENT_FLAG_45, $02, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $02, NULL print_variable_npc_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 + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $02, .ows_f4a4 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f4a1 close_text_box set_dialog_npc NPC_RONALD1 - jump_if_flag_equal EVENT_FLAG_44, $01, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $01, NULL print_variable_npc_text Text0542, Text0543 set_dialog_npc NPC_HOST close_text_box .ows_f4a1 print_npc_text Text0544 .ows_f4a4 - zero_out_flag_value EVENT_FLAG_47 + zero_out_flag_value EVENT_CHALLENGE_CUP_IN_MENU print_npc_text Text0545 ask_question_jump_default_yes Text0546, .ows_f4bd - jump_if_flag_equal EVENT_FLAG_45, $02, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_OPPONENT_NUMBER, $02, NULL print_variable_npc_text Text0547, Text0548 start_challenge_hall_duel PRIZES_4, SAMS_PRACTICE_DECK_ID, MUSIC_STOP quit_script_fully @@ -8121,7 +8134,7 @@ Script_WonAtChallengeHall: ; f441 (3:7441) .ows_f4bd print_npc_text Text0549 close_text_box - max_out_flag_value EVENT_FLAG_47 + max_out_flag_value EVENT_CHALLENGE_CUP_IN_MENU open_menu close_text_box script_jump .ows_f4a4 @@ -8158,14 +8171,14 @@ Script_f4db: ; f4db (3:74db) load_challenge_hall_npc_into_txram_slot $00 print_npc_text Text054b close_text_box - jump_if_flag_equal EVENT_FLAG_44, $03, .ows_f513 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f513 set_dialog_npc NPC_RONALD1 - jump_if_flag_equal EVENT_FLAG_44, $01, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $01, NULL print_variable_npc_text Text054c, Text054d move_challenge_hall_npc NPCMovement_f4d8 do_frames 40 move_challenge_hall_npc NPCMovement_f34c - jump_if_flag_equal EVENT_FLAG_44, $01, NULL + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $01, NULL print_variable_npc_text Text054e, Text054f set_dialog_npc NPC_HOST close_text_box @@ -8186,20 +8199,20 @@ Script_f4db: ; f4db (3:74db) show_card_received_screen VARIABLE_CARD print_npc_text Text0552 close_text_box - 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 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $02, .ows_f540 + jump_if_flag_equal EVENT_CHALLENGE_CUP_NUMBER, $03, .ows_f549 + script_set_flag_value EVENT_CHALLENGE_CUP_1_STATE, $02 + script_set_flag_value EVENT_CHALLENGE_CUP_1_RESULT, $02 script_jump .ows_f552 .ows_f540 - script_set_flag_value EVENT_FLAG_40, $02 - script_set_flag_value EVENT_FLAG_49, $02 + script_set_flag_value EVENT_CHALLENGE_CUP_2_STATE, $02 + script_set_flag_value EVENT_CHALLENGE_CUP_2_RESULT, $02 script_jump .ows_f552 .ows_f549 - script_set_flag_value EVENT_FLAG_41, $02 - script_set_flag_value EVENT_FLAG_4A, $02 + script_set_flag_value EVENT_CHALLENGE_CUP_3_STATE, $02 + script_set_flag_value EVENT_CHALLENGE_CUP_3_RESULT, $02 script_jump .ows_f552 .ows_f552 @@ -8210,30 +8223,31 @@ Script_f4db: ; f4db (3:74db) ; Loads the NPC to fight at the challenge hall Preload_ChallengeHallOpponent: ; f559 (3:7559) - get_flag_value EVENT_FLAG_42 + get_flag_value EVENT_CHALLENGE_CUP_STARTING or a ret z - get_flag_value EVENT_FLAG_46 + get_flag_value EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN or a jr z, .asm_f56e ld a, [wd696] ld [wTempNPC], a scf ret + .asm_f56e call Func_f5db ld c, $01 - set_flag_value EVENT_FLAG_45 + set_flag_value EVENT_CHALLENGE_CUP_OPPONENT_NUMBER call Func_f580 - max_flag_value EVENT_FLAG_46 + max_flag_value EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN scf ret Func_f580: ; f580 (3:7580) - get_flag_value EVENT_FLAG_44 + get_flag_value EVENT_CHALLENGE_CUP_NUMBER cp $3 jr z, .pick_challenger_include_ronald - get_flag_value EVENT_FLAG_45 + get_flag_value EVENT_CHALLENGE_CUP_OPPONENT_NUMBER cp $3 ld d, ChallengeHallNPCs.end - ChallengeHallNPCs - 1 ; discount Ronald jr nz, .pick_challenger @@ -8332,20 +8346,20 @@ Func_f5e9: ; f5e9 (3:75e9) ret Func_f602: ; f602 (3:7602) - zero_flag_value EVENT_FLAG_46 + zero_flag_value EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN ret PokemonDomeEntranceLoadMap: ; f607 (3:7607) - zero_flag_value EVENT_FLAG_63 - zero_flag_value2 EVENT_FLAG_65 - zero_flag_value2 EVENT_FLAG_68 - zero_flag_value2 EVENT_FLAG_69 - zero_flag_value2 EVENT_FLAG_6A - zero_flag_value2 EVENT_FLAG_6B - get_flag_value EVENT_RECEIVED_LEGENDARY_CARD + zero_flag_value EVENT_HALL_OF_HONOR_DOORS_OPEN + zero_flag_value2 EVENT_POKEMON_DOME_STATE + zero_flag_value2 EVENT_COURTNEY_STATE + zero_flag_value2 EVENT_STEVE_STATE + zero_flag_value2 EVENT_JACK_STATE + zero_flag_value2 EVENT_ROD_STATE + get_flag_value EVENT_RECEIVED_LEGENDARY_CARDS or a ret nz - zero_flag_value2 EVENT_FLAG_6C + zero_flag_value2 EVENT_RONALD_POKEMON_DOME_STATE ret PokemonDomeEntranceCloseTextBox: ; f62a (3:762a) @@ -8373,10 +8387,10 @@ Script_f631: ; f631 (3:7631) start_script jump_if_flag_not_less_than EVENT_MEDAL_COUNT, $07, .ows_f69b - jump_if_flag_zero_2 EVENT_FLAG_4B, .ows_f69b - jump_if_flag_nonzero_2 EVENT_FLAG_4F, .ows_f69b + jump_if_flag_zero_2 EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER, .ows_f69b + jump_if_flag_nonzero_2 EVENT_RONALD_POKEMON_DOME_ENTRANCE_ENCOUNTER, .ows_f69b override_song MUSIC_RONALD - max_out_flag_value EVENT_FLAG_4F + max_out_flag_value EVENT_RONALD_POKEMON_DOME_ENTRANCE_ENCOUNTER jump_if_player_coords_match 18, 2, .ows_f66e move_active_npc NPCMovement_f69c script_jump .ows_f671 @@ -8495,7 +8509,7 @@ PokemonDomeAfterDuel: ; f6e0 (3:76e0) PokemonDomeLoadMap: ; f706 (3:7706) ld a, $0d farcall TryGivePCPack - get_flag_value EVENT_FLAG_66 + get_flag_value EVENT_POKEMON_DOME_IN_MENU or a ret z ld bc, Script_f80b @@ -8508,36 +8522,36 @@ PokemonDomeCloseTextBox: ; f718 (3:7718) Script_Courtney: ; f71f (3:771f) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text055a, Text055b quit_script_fully Script_Steve: ; f72a (3:772a) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text055c, Text055d quit_script_fully Script_Jack: ; f735 (3:7735) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text055e, Text055f quit_script_fully Script_Rod: ; f740 (3:7740) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0560, Text0561 quit_script_fully Preload_Courtney: ; f74b (3:774b) - get_flag_value EVENT_FLAG_68 + get_flag_value EVENT_COURTNEY_STATE cp $01 jr z, Func_f76c lb bc, $16, $0c cp $02 jr z, Func_f77d - get_flag_value EVENT_FLAG_64 + get_flag_value EVENT_CHALLENGED_GRAND_MASTERS jr nz, Func_f762 scf ret @@ -8571,34 +8585,34 @@ Func_f782: ; f782 (3:7782) ret Preload_Steve: ; f78c (3:778c) - get_flag_value EVENT_FLAG_69 + get_flag_value EVENT_STEVE_STATE cp $01 jr z, Func_f76c lb bc, $16, $0e cp $02 jr z, Func_f77d - get_flag_value EVENT_FLAG_64 + get_flag_value EVENT_CHALLENGED_GRAND_MASTERS jr nz, Func_f762 scf ret Preload_Jack: ; f7a3 (3:77a3) - get_flag_value EVENT_FLAG_6A + get_flag_value EVENT_JACK_STATE cp $01 jr z, Func_f76c lb bc, $14, $0a cp $02 jr z, Func_f77d - get_flag_value EVENT_FLAG_64 + get_flag_value EVENT_CHALLENGED_GRAND_MASTERS jr nz, Func_f762 scf ret Preload_Rod: ; f7ba (3:77ba) - get_flag_value EVENT_FLAG_6B + get_flag_value EVENT_ROD_STATE cp $01 jr z, Func_f76c - get_flag_value EVENT_FLAG_65 + get_flag_value EVENT_POKEMON_DOME_STATE lb bc, $10, $0a cp $02 jr z, Func_f782 @@ -8609,10 +8623,10 @@ Preload_Rod: ; f7ba (3:77ba) ret Preload_Ronald1InPokemonDome: ; f7d6 (3:77d6) - get_flag_value EVENT_FLAG_6C + get_flag_value EVENT_RONALD_POKEMON_DOME_STATE cp $02 ret nc - get_flag_value EVENT_FLAG_6C + get_flag_value EVENT_RONALD_POKEMON_DOME_STATE or a jr z, .asm_f7eb ld a, MUSIC_RONALD @@ -8623,7 +8637,7 @@ Preload_Ronald1InPokemonDome: ; f7d6 (3:77d6) ret Script_f7ed: ; f7ed (3:77ed) - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_f7f9 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_f7f9 print_npc_text Text0562 .ows_f7f4 close_text_box @@ -8641,10 +8655,10 @@ Script_f7ed: ; f7ed (3:77ed) Script_f80b: ; f80b (3:780b) start_script - jump_if_flag_equal EVENT_FLAG_69, $01, .ows_f820 - jump_if_flag_equal EVENT_FLAG_6A, $01, .ows_f82b - jump_if_flag_equal EVENT_FLAG_6B, $01, .ows_f836 - jump_if_flag_equal EVENT_FLAG_6C, $01, .ows_f841 + jump_if_flag_equal EVENT_STEVE_STATE, $01, .ows_f820 + jump_if_flag_equal EVENT_JACK_STATE, $01, .ows_f82b + jump_if_flag_equal EVENT_ROD_STATE, $01, .ows_f836 + jump_if_flag_equal EVENT_RONALD_POKEMON_DOME_STATE, $01, .ows_f841 .ows_f820 close_advanced_text_box set_next_npc_and_script NPC_STEVE, .ows_f827 @@ -8687,7 +8701,7 @@ Script_f80b: ; f80b (3:780b) Script_f84c: ; f84c (3:784c) start_script - jump_if_flag_nonzero_2 EVENT_FLAG_63, Script_f7ed + jump_if_flag_nonzero_2 EVENT_HALL_OF_HONOR_DOORS_OPEN, Script_f7ed print_npc_text Text0565 ask_question_jump Text0566, .ows_f85f print_npc_text Text0567 @@ -8715,10 +8729,10 @@ Script_f84c: ; f84c (3:784c) move_player EAST, 1 move_player EAST, 1 set_player_direction NORTH - jump_if_flag_zero_2 EVENT_FLAG_64, NULL + jump_if_flag_zero_2 EVENT_CHALLENGED_GRAND_MASTERS, NULL print_variable_npc_text Text0569, Text056a move_active_npc NPCMovement_fb8c - jump_if_flag_nonzero_2 EVENT_FLAG_64, .ows_f8ef + jump_if_flag_nonzero_2 EVENT_CHALLENGED_GRAND_MASTERS, .ows_f8ef print_npc_text Text056b close_advanced_text_box set_next_npc_and_script NPC_COURTNEY, .ows_f8af @@ -8767,12 +8781,12 @@ Script_f84c: ; f84c (3:784c) .ows_f8e6 start_script - max_out_flag_value EVENT_FLAG_64 + max_out_flag_value EVENT_CHALLENGED_GRAND_MASTERS print_npc_text Text056e script_jump .ows_f8f8 .ows_f8ef - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text056f, Text0570 .ows_f8f8 print_npc_text Text0571 @@ -8784,7 +8798,7 @@ Script_f84c: ; f84c (3:784c) move_player SOUTH, 1 set_player_direction EAST move_active_npc NPCMovement_fb8d - script_set_flag_value EVENT_FLAG_65, $01 + script_set_flag_value EVENT_POKEMON_DOME_STATE, $01 close_advanced_text_box set_next_npc_and_script NPC_COURTNEY, .ows_f918 end_script @@ -8793,22 +8807,22 @@ Script_f84c: ; f84c (3:784c) .ows_f918 start_script try_give_pc_pack $0e - script_set_flag_value EVENT_FLAG_68, $01 + script_set_flag_value EVENT_COURTNEY_STATE, $01 set_dialog_npc NPC_ROD - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0572, Text0573 close_text_box set_dialog_npc NPC_COURTNEY move_active_npc NPCMovement_fba6 set_active_npc_direction WEST - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0574, Text0575 start_duel PRIZES_6, LEGENDARY_MOLTRES_DECK_ID, MUSIC_DUEL_THEME_3 quit_script_fully Script_LostToCourtney: ; f93f (3:793f) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0576, Text0577 close_advanced_text_box set_next_npc_and_script NPC_ROD, .ows_f950 @@ -8823,8 +8837,8 @@ Script_LostToCourtney: ; f93f (3:793f) Script_BeatCourtney: ; f95a (3:795a) start_script - script_set_flag_value EVENT_FLAG_68, $02 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + script_set_flag_value EVENT_COURTNEY_STATE, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0579, Text057a close_text_box move_active_npc NPCMovement_fbb7 @@ -8837,18 +8851,18 @@ Script_BeatCourtney: ; f95a (3:795a) .ows_f974 start_script try_give_pc_pack $0f - script_set_flag_value EVENT_FLAG_69, $01 + script_set_flag_value EVENT_STEVE_STATE, $01 set_dialog_npc NPC_ROD - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text057b, Text057c close_text_box set_dialog_npc NPC_STEVE move_active_npc NPCMovement_fba4 set_active_npc_direction WEST - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text057d, Text057e .ows_f996 - zero_out_flag_value EVENT_FLAG_66 + zero_out_flag_value EVENT_POKEMON_DOME_IN_MENU set_dialog_npc NPC_ROD print_npc_text Text057f ask_question_jump_default_yes Text0580, .ows_f9af @@ -8860,14 +8874,14 @@ Script_BeatCourtney: ; f95a (3:795a) .ows_f9af close_text_box - max_out_flag_value EVENT_FLAG_66 + max_out_flag_value EVENT_POKEMON_DOME_IN_MENU open_menu close_text_box script_jump .ows_f996 Script_LostToSteve: ; f9b7 (3:79b7) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0583, Text0584 close_advanced_text_box set_next_npc_and_script NPC_ROD, Script_LostToCourtney.ows_f950 @@ -8876,8 +8890,8 @@ Script_LostToSteve: ; f9b7 (3:79b7) Script_BeatSteve: ; f9c8 (3:79c8) start_script - script_set_flag_value EVENT_FLAG_69, $02 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + script_set_flag_value EVENT_STEVE_STATE, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0585, Text0586 close_text_box move_active_npc NPCMovement_fbb8 @@ -8889,18 +8903,18 @@ Script_BeatSteve: ; f9c8 (3:79c8) .ows_f9e2 start_script - script_set_flag_value EVENT_FLAG_6A, $01 + script_set_flag_value EVENT_JACK_STATE, $01 set_dialog_npc NPC_ROD - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0587, Text0588 close_text_box set_dialog_npc NPC_JACK move_active_npc NPCMovement_fbbc set_active_npc_direction WEST - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0589, Text058a .ows_fa02 - zero_out_flag_value EVENT_FLAG_66 + zero_out_flag_value EVENT_POKEMON_DOME_IN_MENU set_dialog_npc NPC_ROD print_npc_text Text058b ask_question_jump_default_yes Text058c, .ows_fa1b @@ -8912,14 +8926,14 @@ Script_BeatSteve: ; f9c8 (3:79c8) .ows_fa1b close_text_box - max_out_flag_value EVENT_FLAG_66 + max_out_flag_value EVENT_POKEMON_DOME_IN_MENU open_menu close_text_box script_jump .ows_fa02 Script_LostToJack: ; fa23 (3:7a23) start_script - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text058f, Text0590 close_advanced_text_box set_next_npc_and_script NPC_ROD, Script_LostToCourtney.ows_f950 @@ -8928,8 +8942,8 @@ Script_LostToJack: ; fa23 (3:7a23) Script_BeatJack: ; fa34 (3:7a34) start_script - script_set_flag_value EVENT_FLAG_6A, $02 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + script_set_flag_value EVENT_JACK_STATE, $02 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0591, Text0592 close_text_box move_active_npc NPCMovement_fbc2 @@ -8942,31 +8956,31 @@ Script_BeatJack: ; fa34 (3:7a34) .ows_fa52 start_script - script_set_flag_value EVENT_FLAG_6B, $01 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + script_set_flag_value EVENT_ROD_STATE, $01 + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text0593, Text0594 close_text_box move_active_npc NPCMovement_fbaf set_active_npc_direction WEST - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fa75 - jump_if_flag_zero_2 EVENT_FLAG_67, NULL + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_fa75 + jump_if_flag_zero_2 EVENT_CHALLENGED_RONALD, NULL print_variable_npc_text Text0595, Text0596 script_jump .ows_fa78 .ows_fa75 print_npc_text Text0597 .ows_fa78 - zero_out_flag_value EVENT_FLAG_66 + zero_out_flag_value EVENT_POKEMON_DOME_IN_MENU print_npc_text Text0598 ask_question_jump_default_yes Text0599, .ows_fa90 - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text059a, Text059b start_duel PRIZES_6, LEGENDARY_DRAGONITE_DECK_ID, MUSIC_DUEL_THEME_3 quit_script_fully .ows_fa90 close_text_box - max_out_flag_value EVENT_FLAG_66 + max_out_flag_value EVENT_POKEMON_DOME_IN_MENU open_menu close_text_box script_jump .ows_fa78 @@ -8977,20 +8991,20 @@ Script_LostToRod: ; fa98 (3:7a98) close_text_box move_active_npc NPCMovement_fb9d set_active_npc_direction SOUTH - jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARD, NULL + jump_if_flag_zero_2 EVENT_RECEIVED_LEGENDARY_CARDS, NULL print_variable_npc_text Text059d, Text059e script_jump Script_f7ed.ows_f804 Script_BeatRod: ; faae (3:7aae) start_script - script_set_flag_value EVENT_FLAG_6B, $02 - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fad5 - jump_if_flag_zero_2 EVENT_FLAG_67, NULL + script_set_flag_value EVENT_ROD_STATE, $02 + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_fad5 + jump_if_flag_zero_2 EVENT_CHALLENGED_RONALD, NULL print_variable_npc_text Text059f, Text05a0 close_text_box move_active_npc NPCMovement_fb90 set_active_npc_direction SOUTH - jump_if_flag_zero_2 EVENT_FLAG_67, NULL + jump_if_flag_zero_2 EVENT_CHALLENGED_RONALD, NULL print_variable_npc_text Text05a1, Text05a2 close_advanced_text_box set_next_npc_and_script NPC_RONALD1, .ows_fae9 @@ -9003,20 +9017,20 @@ Script_BeatRod: ; faae (3:7aae) set_active_npc_direction SOUTH play_sfx SFX_0F replace_map_blocks $01 - script_set_flag_value EVENT_FLAG_65, $02 - max_out_flag_value EVENT_FLAG_63 + script_set_flag_value EVENT_POKEMON_DOME_STATE, $02 + max_out_flag_value EVENT_HALL_OF_HONOR_DOORS_OPEN print_text_quit_fully Text05a4 .ows_fae9 start_script override_song MUSIC_STOP - script_set_flag_value EVENT_FLAG_6C, $01 + script_set_flag_value EVENT_RONALD_POKEMON_DOME_STATE, $01 play_sfx SFX_0F replace_map_blocks $01 move_active_npc NPCMovement_fbd2 set_default_song MUSIC_RONALD play_default_song - jump_if_flag_nonzero_2 EVENT_FLAG_67, .ows_fb15 + jump_if_flag_nonzero_2 EVENT_CHALLENGED_RONALD, .ows_fb15 print_npc_text Text05a5 set_dialog_npc NPC_ROD move_npc NPC_ROD, NPCMovement_fb9b @@ -9032,9 +9046,9 @@ Script_BeatRod: ; faae (3:7aae) close_text_box move_active_npc NPCMovement_fba8 set_active_npc_direction WEST - max_out_flag_value EVENT_FLAG_67 + max_out_flag_value EVENT_CHALLENGED_RONALD .ows_fb20 - zero_out_flag_value EVENT_FLAG_66 + zero_out_flag_value EVENT_POKEMON_DOME_IN_MENU set_dialog_npc NPC_ROD print_npc_text Text05a9 ask_question_jump_default_yes Text05aa, .ows_fb40 @@ -9049,7 +9063,7 @@ Script_BeatRod: ; faae (3:7aae) .ows_fb40 close_text_box - max_out_flag_value EVENT_FLAG_66 + max_out_flag_value EVENT_POKEMON_DOME_IN_MENU open_menu close_text_box script_jump .ows_fb20 @@ -9064,7 +9078,7 @@ Script_LostToRonald1InPokemonDome: ; fb48 (3:7b48) Script_BeatRonald1InPokemonDome: ; fb53 (3:7b53) start_script - script_set_flag_value EVENT_FLAG_6C, $02 + script_set_flag_value EVENT_RONALD_POKEMON_DOME_STATE, $02 print_npc_text Text05af set_dialog_npc NPC_ROD print_npc_text Text05b0 @@ -9087,8 +9101,8 @@ Script_BeatRonald1InPokemonDome: ; fb53 (3:7b53) set_player_direction NORTH print_npc_text Text05b3 move_active_npc NPCMovement_fbb2 - script_set_flag_value EVENT_FLAG_65, $02 - max_out_flag_value EVENT_FLAG_63 + script_set_flag_value EVENT_POKEMON_DOME_STATE, $02 + max_out_flag_value EVENT_HALL_OF_HONOR_DOORS_OPEN record_master_win $0a print_text_quit_fully Text05b4 @@ -9219,8 +9233,8 @@ Script_fbe1: ; fbe1 (3:7be1) Script_fbf1: ; fbf1 (3:7bf1) start_script - jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARD, .ows_fc10 - max_out_flag_value EVENT_RECEIVED_LEGENDARY_CARD + jump_if_flag_nonzero_2 EVENT_RECEIVED_LEGENDARY_CARDS, .ows_fc10 + max_out_flag_value EVENT_RECEIVED_LEGENDARY_CARDS print_text Text05b8 give_card ZAPDOS3 give_card MOLTRES2 @@ -9237,7 +9251,7 @@ Script_fbf1: ; fbf1 (3:7bf1) quit_script_fully .ows_fc10 - jump_if_flag_equal EVENT_FLAG_71, $0f, .ows_fc20 + jump_if_flag_equal EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS, $0f, .ows_fc20 pick_legendary_card print_text Text05ba give_card VARIABLE_CARD @@ -9312,13 +9326,13 @@ Preload_GiftCenterClerk: ; fc6c (3:7c6c) Func_fc7a: ; fc7a (3:7c7a) ld a, [wConsole] ld c, a - set_flag_value EVENT_FLAG_74 + set_flag_value EVENT_CONSOLE start_script - jump_if_flag_not_equal EVENT_FLAG_74, $02, Func_fcad.ows_fcd5 + jump_if_flag_not_equal EVENT_CONSOLE, $02, Func_fcad.ows_fcd5 print_npc_text Text06cd gift_center $00 - jump_if_flag_not_less_than EVENT_FLAG_72, $04, .ows_fcaa + jump_if_flag_not_less_than EVENT_GIFT_CENTER_MENU_CHOICE, $04, .ows_fcaa print_npc_text Text06ce ask_question_jump_default_yes Text06cf, .ows_fca0 print_npc_text Text06d0 @@ -9337,14 +9351,14 @@ Func_fc7a: ; fc7a (3:7c7a) Func_fcad: ; fcad (3:7cad) ld a, [wd10e] ld c, a - set_flag_value EVENT_FLAG_72 + set_flag_value EVENT_GIFT_CENTER_MENU_CHOICE start_script play_sfx SFX_56 save_game $00 - 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 + jump_if_flag_equal EVENT_GIFT_CENTER_MENU_CHOICE, $00, .ows_fccc + jump_if_flag_equal EVENT_GIFT_CENTER_MENU_CHOICE, $02, .ows_fccf + jump_if_flag_equal EVENT_GIFT_CENTER_MENU_CHOICE, $03, .ows_fcd2 script_jump Func_fc7a.ows_fcaa .ows_fccc diff --git a/src/engine/home.asm b/src/engine/home.asm index 8ccfa5d..6f8ae26 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -10680,7 +10680,7 @@ GameEvent_Credits: ; 3911 (0:3911) ret Func_3917: ; 3917 (0:3917) - ld a, EVENT_RECEIVED_LEGENDARY_CARD + ld a, EVENT_RECEIVED_LEGENDARY_CARDS farcall GetEventFlagValue call EnableSRAM ld [s0a00a], a diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 61a0ecc..fd8aacf 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -389,7 +389,7 @@ ENDM ; Shows the medal received screen for the given master medal show_medal_received_screen: MACRO run_command ScriptCommand_ShowMedalReceivedScreen - db \1 ; medal event + db \1 ; medal event (ex EVENT_BEAT_NIKKI) ENDM ; Loads the current map name into the given txram slot @@ -636,28 +636,28 @@ ENDM ; Sets a flag's value script_set_flag_value: MACRO run_command ScriptCommand_SetFlagValue - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value dw \3 ; Script Label ENDM @@ -665,7 +665,7 @@ 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value dw \3 ; Script Label ENDM @@ -673,7 +673,7 @@ ENDM ; Jumps 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value dw \3 ; Script Label ENDM @@ -681,7 +681,7 @@ ENDM ; Jumps 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 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value dw \3 ; Script Label ENDM @@ -689,33 +689,31 @@ ENDM ; Sets a flag to its maximum possible value max_out_flag_value: MACRO run_command ScriptCommand_MaxOutFlagValue - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) ENDM ; Sets a flags value to zero zero_out_flag_value: MACRO run_command ScriptCommand_ZeroOutFlagValue - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) ENDM ; Jumps to a script position if a flag is nonzero jump_if_flag_nonzero_2: MACRO run_command ScriptCommand_JumpIfFlagNonzero2 - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) dw \2 ; Script Label ENDM ; Jumps to a script position if a flag is zero jump_if_flag_zero_2: MACRO run_command ScriptCommand_JumpIfFlagZero2 - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) dw \2 ; Script Label ENDM ; Increments given flags value (truncates the new value) increment_flag_value: MACRO run_command ScriptCommand_IncrementFlagValue - db \1 ; flag (ex EVENT_FLAG_11) + db \1 ; flag (ex EVENT_IMAKUNI_WIN_COUNT) ENDM - - diff --git a/tools/constants.py b/tools/constants.py index d50f5a4..7cd6a64 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -329,125 +329,125 @@ directions = [ ] events = [ - "EVENT_FLAG_00", - "EVENT_FLAG_01", + "EVENT_TEMP_TRADED_WITH_ISHIHARA", + "EVENT_TEMP_GIFTED_TO_MAN1", "EVENT_TEMP_TALKED_TO_IMAKUNI", "EVENT_TEMP_DUELED_IMAKUNI", - "EVENT_FLAG_04", - "EVENT_FLAG_05", - "EVENT_FLAG_06", - "EVENT_FLAG_07", - "EVENT_FLAG_08", - "EVENT_FLAG_09", - "EVENT_FLAG_0A", + "EVENT_TEMP_TRADED_WITH_LASS2", + "EVENT_TEMP_05", + "EVENT_TEMP_06", + "EVENT_TEMP_07", + "EVENT_BEAT_NIKKI", + "EVENT_BEAT_RICK", + "EVENT_BEAT_KEN", "EVENT_BEAT_AMY", - "EVENT_FLAG_0C", - "EVENT_FLAG_0D", - "EVENT_FLAG_0E", - "EVENT_FLAG_0F", - "EVENT_FLAG_10", - "EVENT_FLAG_11", - "EVENT_FLAG_12", + "EVENT_BEAT_ISAAC", + "EVENT_BEAT_MURRAY", + "EVENT_BEAT_GENE", + "EVENT_BEAT_MITCH", + "EVENT_MEDAL_FLAGS", + "EVENT_PUPIL_MICHAEL_STATE", + "EVENT_GAL1_TRADE_STATE", "EVENT_IMAKUNI_STATE", - "EVENT_FLAG_14", + "EVENT_LASS1_MENTIONED_IMAKUNI", "EVENT_BEAT_SARA", "EVENT_BEAT_AMANDA", - "EVENT_FLAG_17", - "EVENT_FLAG_18", - "EVENT_FLAG_19", - "EVENT_FLAG_1A", - "EVENT_FLAG_1B", - "EVENT_FLAG_1C", - "EVENT_FLAG_1D", - "EVENT_FLAG_1E", - "EVENT_FLAG_1F", - "EVENT_FLAG_20", - "EVENT_FLAG_21", - "EVENT_RECEIVED_LEGENDARY_CARD", - "EVENT_FLAG_23", - "EVENT_FLAG_24", - "EVENT_FLAG_25", - "EVENT_FLAG_26", - "EVENT_FLAG_27", - "EVENT_FLAG_28", - "EVENT_FLAG_29", - "EVENT_FLAG_2A", - "EVENT_FLAG_2B", - "EVENT_FLAG_2C", - "EVENT_FLAG_2D", + "EVENT_PUPIL_CHRIS_STATE", + "EVENT_MATTHEW_STATE", + "EVENT_CHAP2_TRADE_STATE", + "EVENT_DAVID_STATE", + "EVENT_JOSEPH_STATE", + "EVENT_ISHIHARA_MENTIONED", + "EVENT_ISHIHARA_MET", + "EVENT_ISHIHARAS_HOUSE_MENTIONED", + "EVENT_ISHIHARA_TRADE_STATE", + "EVENT_PUPIL_JESSICA_STATE", + "EVENT_LAD2_STATE", + "EVENT_RECEIVED_LEGENDARY_CARDS", + "EVENT_KEN_HAD_ENOUGH_CARDS", + "EVENT_KEN_TALKED", + "EVENT_BEAT_JENNIFER", + "EVENT_BEAT_NICHOLAS", + "EVENT_BEAT_BRANDON", + "EVENT_ISAAC_TALKED", + "EVENT_MAN1_TALKED", + "EVENT_MAN1_WAITING_FOR_CARD", + "EVENT_MAN1_REQUESTED_CARD_ID", + "EVENT_MAN1_GIFT_SEQUENCE_STATE", + "EVENT_MAN1_GIFTED_CARD_FLAGS", "EVENT_MEDAL_COUNT", - "EVENT_FLAG_2F", - "EVENT_FLAG_30", - "EVENT_FLAG_31", - "EVENT_FLAG_32", + "EVENT_DANIEL_TALKED", + "EVENT_MURRAY_TALKED", + "EVENT_PAPPY1_STATE", + "EVENT_RONALD_PSYCHIC_CLUB_LOBBY_ENCOUNTER", "EVENT_JOSHUA_STATE", "EVENT_IMAKUNI_ROOM", - "EVENT_FLAG_35", + "EVENT_NIKKI_STATE", "EVENT_IMAKUNI_WIN_COUNT", - "EVENT_FLAG_37", - "EVENT_FLAG_38", - "EVENT_FLAG_39", - "EVENT_FLAG_3A", - "EVENT_FLAG_3B", + "EVENT_LASS2_TRADE_STATE", + "EVENT_ISHIHARA_WANTS_TO_TRADE", + "EVENT_ISHIHARA_CONGRATULATED_PLAYER", + "EVENT_BEAT_KRISTIN", + "EVENT_BEAT_HEATHER", "EVENT_BEAT_BRITTANY", - "EVENT_FLAG_3D", - "EVENT_FLAG_3E", - "EVENT_FLAG_3F", - "EVENT_FLAG_40", - "EVENT_FLAG_41", - "EVENT_FLAG_42", - "EVENT_FLAG_43", - "EVENT_FLAG_44", - "EVENT_FLAG_45", - "EVENT_FLAG_46", - "EVENT_FLAG_47", - "EVENT_FLAG_48", - "EVENT_FLAG_49", - "EVENT_FLAG_4A", - "EVENT_FLAG_4B", - "EVENT_FLAG_4C", - "EVENT_FLAG_4D", - "EVENT_FLAG_4E", - "EVENT_FLAG_4F", - "EVENT_FLAG_50", - "EVENT_FLAG_51", - "EVENT_FLAG_52", - "EVENT_FLAG_53", - "EVENT_FLAG_54", - "EVENT_FLAG_55", - "EVENT_FLAG_56", - "EVENT_FLAG_57", - "EVENT_FLAG_58", - "EVENT_FLAG_59", - "EVENT_FLAG_5A", - "EVENT_FLAG_5B", - "EVENT_FLAG_5C", - "EVENT_FLAG_5D", - "EVENT_FLAG_5E", - "EVENT_FLAG_5F", - "EVENT_FLAG_60", - "EVENT_FLAG_61", - "EVENT_FLAG_62", - "EVENT_FLAG_63", - "EVENT_FLAG_64", - "EVENT_FLAG_65", - "EVENT_FLAG_66", - "EVENT_FLAG_67", - "EVENT_FLAG_68", - "EVENT_FLAG_69", - "EVENT_FLAG_6A", - "EVENT_FLAG_6B", - "EVENT_FLAG_6C", - "EVENT_FLAG_6D", - "EVENT_FLAG_6E", - "EVENT_FLAG_6F", - "EVENT_FLAG_70", - "EVENT_FLAG_71", - "EVENT_FLAG_72", - "EVENT_FLAG_73", - "EVENT_FLAG_74", - "EVENT_FLAG_75", - "EVENT_FLAG_76", + "EVENT_DRMASON_CONGRATULATED_PLAYER", + "EVENT_MASON_LAB_STATE", + "EVENT_CHALLENGE_CUP_1_STATE", + "EVENT_CHALLENGE_CUP_2_STATE", + "EVENT_CHALLENGE_CUP_3_STATE", + "EVENT_CHALLENGE_CUP_STARTING", + "EVENT_CHALLENGE_CUP_STAGE_VISITED", + "EVENT_CHALLENGE_CUP_NUMBER", + "EVENT_CHALLENGE_CUP_OPPONENT_NUMBER", + "EVENT_CHALLENGE_CUP_OPPONENT_CHOSEN", + "EVENT_CHALLENGE_CUP_IN_MENU", + "EVENT_CHALLENGE_CUP_1_RESULT", + "EVENT_CHALLENGE_CUP_2_RESULT", + "EVENT_CHALLENGE_CUP_3_RESULT", + "EVENT_RONALD_FIRST_CLUB_ENTRANCE_ENCOUNTER", + "EVENT_RONALD_FIRST_DUEL_STATE", + "EVENT_RONALD_SECOND_DUEL_STATE", + "EVENT_RONALD_TALKED", + "EVENT_RONALD_POKEMON_DOME_ENTRANCE_ENCOUNTER", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_1", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_2", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_3", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_4", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_5", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_6", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_7", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_CONVO_8", + "EVENT_RONALD_CHALLENGE_HALL_LOBBY_STATE", + "EVENT_PLAYER_ENTERED_CHALLENGE_CUP", + "EVENT_FIGHTING_DECK_MACHINE_ACTIVE", + "EVENT_ROCK_DECK_MACHINE_ACTIVE", + "EVENT_WATER_DECK_MACHINE_ACTIVE", + "EVENT_LIGHTNING_DECK_MACHINE_ACTIVE", + "EVENT_GRASS_DECK_MACHINE_ACTIVE", + "EVENT_PSYCHIC_DECK_MACHINE_ACTIVE", + "EVENT_SCIENCE_DECK_MACHINE_ACTIVE", + "EVENT_FIRE_DECK_MACHINE_ACTIVE", + "EVENT_ALL_DECK_MACHINE_FLAGS", + "EVENT_HALL_OF_HONOR_DOORS_OPEN", + "EVENT_CHALLENGED_GRAND_MASTERS", + "EVENT_POKEMON_DOME_STATE", + "EVENT_POKEMON_DOME_IN_MENU", + "EVENT_CHALLENGED_RONALD", + "EVENT_COURTNEY_STATE", + "EVENT_STEVE_STATE", + "EVENT_JACK_STATE", + "EVENT_ROD_STATE", + "EVENT_RONALD_POKEMON_DOME_STATE", + "EVENT_RECEIVED_ZAPDOS", + "EVENT_RECEIVED_MOLTRES", + "EVENT_RECEIVED_ARTICUNO", + "EVENT_RECEIVED_DRAGONITE", + "EVENT_LEGENDARY_CARDS_RECEIVED_FLAGS", + "EVENT_GIFT_CENTER_MENU_CHOICE", + "EVENT_AARON_BOOSTER_REWARD", + "EVENT_CONSOLE", + "EVENT_SAM_TUTORIAL_MENU_CHOICE", + "EVENT_AARON_DECK_MENU_CHOICE", ] maps = [ -- cgit v1.2.3