From b2929dced0a39d591d65db7dc2957d338373ebdc Mon Sep 17 00:00:00 2001 From: earthoul Date: Fri, 16 Jan 2026 15:28:16 +0900 Subject: [PATCH 01/15] Label Ishihara scenes --- src/constants/script_constants.asm | 2 +- src/constants/var_constants.asm | 15 +- src/data/booster_lists.asm | 2 +- src/engine/bank03.asm | 18 +- src/engine/bank0b.asm | 358 +++++++++++----------- src/engine/bank0f.asm | 476 ++++++++++++++--------------- src/text/text10.asm | 58 ++-- src/text/text9.asm | 112 +++---- src/text/text_offsets.asm | 170 +++++------ tools/constants.py | 4 +- 10 files changed, 614 insertions(+), 601 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index 21c9448..d53bfa0 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -275,7 +275,7 @@ const EVENT_F2 ; $f2 const EVENT_F3 ; $f3 const EVENT_ISHIHARA_CARD_TRADE_STATE ; $f4 - const EVENT_F5 ; $f5 + const EVENT_ISHIHARA_LOCATION_STATE ; $f5 DEF NUM_EVENT_FLAGS EQU const_value const_def 1 diff --git a/src/constants/var_constants.asm b/src/constants/var_constants.asm index 1b4ecf0..5aeb98e 100644 --- a/src/constants/var_constants.asm +++ b/src/constants/var_constants.asm @@ -1,7 +1,7 @@ const_def const VAR_00 ; $00 const VAR_01 ; $01 - const VAR_02 ; $02 + const VAR_ISHIHARA_STATE ; $02 const VAR_03 ; $03 const VAR_TIMES_MET_RONALD ; $04 const VAR_05 ; $05 @@ -62,3 +62,16 @@ const VAR_NPC_DECK_ID ; $3c const VAR_DUEL_START_THEME ; $3d const VAR_3E ; $3e + +; VAR_ISHIHARA_STATE values + const_def 1 + const ISHIHARA_HELPING_NIKKI ; $1 + const ISHIHARA_HELPED_NIKKI ; $2 + const ISHIHARA_TRADE_1_DONE ; $3 + const ISHIHARA_TRADE_2_DONE ; $4 + const ISHIHARA_TRADE_3_DONE ; $5 + const ISHIHARA_TALKED_AT_VILLA ; $6 + const ISHIHARA_TRADE_4_DONE ; $7 + const ISHIHARA_TRADE_5_DONE ; $8 + const ISHIHARA_TRADE_6_DONE ; $9 + const ISHIHARA_TRADE_7_DONE_COMPLETE ; $a diff --git a/src/data/booster_lists.asm b/src/data/booster_lists.asm index fb05acb..60ffe49 100644 --- a/src/data/booster_lists.asm +++ b/src/data/booster_lists.asm @@ -264,7 +264,7 @@ BoosterList_cdca: BoosterList_cdcf: booster_list BOOSTERS_GIVE_ALL, BOOSTER_TEAM_ROCKETS_AMBITION, BOOSTER_WE_ARE_TEAM_ROCKET -BoosterList_cdd3: +BoosterList_Ishihara: booster_list BOOSTERS_GIVE_N, 2, BOOSTER_BEGINNING_POKEMON, BOOSTER_LEGENDARY_POWER, BOOSTER_ISLAND_OF_FOSSIL, BOOSTER_PSYCHIC_BATTLE, BOOSTER_SKY_FLYING_POKEMON, BOOSTER_WE_ARE_TEAM_ROCKET, BOOSTER_TEAM_ROCKETS_AMBITION BoosterList_cddd: diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 0937694..50c3640 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -417,18 +417,18 @@ Func_c2d6: ret Func_c2ff: - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE call GetVarValue - cp $06 - jr c, .asm_c318 - ld a, EVENT_F5 + cp ISHIHARA_TALKED_AT_VILLA + jr c, .done + ld a, EVENT_ISHIHARA_LOCATION_STATE call ZeroOutEventValue call UpdateRNGSources rra - jr nc, .asm_c318 - ld a, EVENT_F5 + jr nc, .done + ld a, EVENT_ISHIHARA_LOCATION_STATE call MaxOutEventValue -.asm_c318 +.done ret Func_c319: @@ -2139,13 +2139,13 @@ EventVarMasks: db $33, %00000100 ; EVENT_F2 db $33, %00001000 ; EVENT_F3 db $33, %00010000 ; EVENT_ISHIHARA_CARD_TRADE_STATE - db $33, %00100000 ; EVENT_F5 + db $33, %00100000 ; EVENT_ISHIHARA_LOCATION_STATE ; extra events? GeneralVarMasks: db $00, %11111111 ; VAR_00 db $01, %00000011 ; VAR_01 - db $01, %00111100 ; VAR_02 + db $01, %00111100 ; VAR_ISHIHARA_STATE db $01, %11000000 ; VAR_03 db $02, %00001111 ; VAR_TIMES_MET_RONALD db $03, %00000011 ; VAR_05 diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index 6969197..ddff112 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -9,13 +9,13 @@ IshiharasHouse_StepEvents: db $ff IshiharasHouse_NPCs: - npc NPC_ISHIHARA, 4, 4, SOUTH, Func_2c1b8 - npc NPC_NIKKI, 5, 4, SOUTH, Func_2c46a + npc NPC_ISHIHARA, 4, 4, SOUTH, IshiharasHouse_IshiharaAppearanceCheck + npc NPC_NIKKI, 5, 4, SOUTH, IshiharasHouse_AppearDuringRetreat db $ff IshiharasHouse_NPCInteractions: - npc_script NPC_ISHIHARA, Func_2c172 - npc_script NPC_NIKKI, Func_2c3cb + npc_script NPC_ISHIHARA, Script_IshiharaAtHome + npc_script NPC_NIKKI, Script_NikkiRetreated db $ff IshiharasHouse_OWInteractions: @@ -45,7 +45,7 @@ IshiharasHouse_MapScripts: db $ff Func_2c0b4: - call Func_2c1b8 + call IshiharasHouse_IshiharaAppearanceCheck jr nc, .asm_2c0be ld a, MUSIC_OVERWORLD ld [wNextMusic], a @@ -71,15 +71,15 @@ Func_2c0d1: start_script send_mail $11 end_script - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr z, .asm_2c0ef + jr z, .done ld a, NPC_ISHIHARA lb de, 1, 2 farcall SetOWObjectTilePosition ld b, NORTH farcall SetOWObjectDirection -.asm_2c0ef +.done scf ret @@ -96,29 +96,29 @@ Func_2c0f1: Func_2c101: xor a push af - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr z, .asm_2c10f + jr z, .skip_bit0 pop af or $01 push af -.asm_2c10f +.skip_bit0 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr z, .asm_2c11b + jr z, .skip_bit1 pop af or $02 push af -.asm_2c11b +.skip_bit1 pop af or a - jr z, .asm_2c12c + jr z, .done ld c, a ld a, VAR_00 farcall SetVarValue ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall MaxOutEventValue -.asm_2c12c +.done scf ccf ret @@ -133,16 +133,16 @@ Func_2c12f: ret Func_2c13e: - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall ZeroOutEventValue ld a, VAR_00 farcall GetVarValue bit 0, a push af - call nz, Func_2c164 + call nz, .SetLocationFlag pop af bit 1, a - call nz, Func_2c16b + call nz, .SetTradeFlag ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall ZeroOutEventValue ld a, VAR_00 @@ -150,71 +150,71 @@ Func_2c13e: scf ret -Func_2c164: - ld a, EVENT_F5 +.SetLocationFlag: + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall MaxOutEventValue ret -Func_2c16b: +.SetTradeFlag: ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall MaxOutEventValue ret -Func_2c172: +Script_IshiharaAtHome: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue jr z, .asm_2c185 ld a, EVENT_TALKED_TO_ISHIHARA_POST_GAME farcall GetEventValue jr nz, .asm_2c185 - jp Func_2c3a5 + jp Script_IshiharaCongratsAtHome .asm_2c185 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue jr z, .asm_2c19b - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $05 - jp c, Func_2c28c - jp Func_2c36d + cp ISHIHARA_TRADE_3_DONE + jp c, Script_IshiharaTradeLaterAtHome + jp Script_IshiharaHeadingForVilla .asm_2c19b - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue or a - jp z, Func_2c1db + jp z, Script_IshiharaSheltering ; NONE dec a - jp z, Func_2c203 + jp z, Script_IshiharaWithNikki ; ISHIHARA_HELPING_NIKKI dec a - jp z, Func_2c229 + jp z, Script_IshiharaTrade1 ; ISHIHARA_HELPED_NIKKI dec a - jp z, Func_2c2a7 + jp z, Script_IshiharaTrade2 ; ISHIHARA_TRADE_1_DONE dec a - jp z, Func_2c30a - jp Func_2c388 + jp z, Script_IshiharaTrade3 ; ISHIHARA_TRADE_2_DONE + jp Script_IshiharaBusy ; ISHIHARA_TRADE_3_DONE -Func_2c1b8: - ld a, VAR_02 +IshiharasHouse_IshiharaAppearanceCheck: + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp 5 - jr c, .asm_2c1d8 - jr nz, .asm_2c1ce + cp ISHIHARA_TRADE_3_DONE + jr c, .appear + jr nz, .check_location_flag ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr nz, .asm_2c1d8 - jr .asm_2c1d6 -.asm_2c1ce - ld a, EVENT_F5 + jr nz, .appear + jr .disappear +.check_location_flag + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr nz, .asm_2c1d8 -.asm_2c1d6 + jr nz, .appear +.disappear scf ret -.asm_2c1d8 +.appear scf ccf ret -Func_2c1db: +Script_IshiharaSheltering: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -226,18 +226,18 @@ Func_2c1db: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_2c1fd + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0e97 - script_jump .ows_2c200 -.ows_2c1fd - print_npc_text Text0e98 -.ows_2c200 + print_npc_text IshiharaUnderGRInvasionInitialText + script_jump .done +.repeat + print_npc_text IshiharaUnderGRInvasionRepeatText +.done end_dialog end_script ret -Func_2c203: +Script_IshiharaWithNikki: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -249,17 +249,17 @@ Func_2c203: start_script start_dialog check_event EVENT_GOT_ODDISH_COIN - script_jump_if_b0z .ows_2c223 - print_npc_text Text0e99 - script_jump .ows_2c226 -.ows_2c223 - print_npc_text Text0e9a -.ows_2c226 + script_jump_if_b0z .talked_to_nikki + print_npc_text IshiharaListenToNikkiText + script_jump .done +.talked_to_nikki + print_npc_text IshiharaHelpNikkiText +.done end_dialog end_script ret -Func_2c229: +Script_IshiharaTrade1: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -271,42 +271,42 @@ Func_2c229: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_2c24b + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0e9b - script_jump .ows_2c24e -.ows_2c24b - print_npc_text Text0e9c -.ows_2c24e + print_npc_text IshiharaWantsToTrade1InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade1RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_2c25b - print_npc_text Text0e9d - script_jump .ows_2c289 -.ows_2c25b + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks CLEFAIRY_LV15 - script_jump_if_b0z .ows_2c267 - print_npc_text Text0e9e - script_jump .ows_2c289 -.ows_2c267 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnClefairyLv15Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection CLEFAIRY_LV15 - script_jump_if_b0z .ows_2c273 - print_npc_text Text0e9f - script_jump .ows_2c289 -.ows_2c273 - print_npc_text Text0ea0 - print_text Text0ea1 + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllClefairyLv15InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade1Text + print_text TradedClefairyForFlyingPikachuText receive_card FLYING_PIKACHU_ALT_LV12 take_card CLEFAIRY_LV15 set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $03 - print_npc_text Text0ea2 -.ows_2c289 + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_1_DONE + print_npc_text IshiharaThanksTradedClefairyLv15Text +.done end_dialog end_script ret -Func_2c28c: +Script_IshiharaTradeLaterAtHome: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -317,12 +317,12 @@ Func_2c28c: xor a start_script start_dialog - print_npc_text Text0ea3 + print_npc_text IshiharaAtHomeTradeLaterReadMyBooksText end_dialog end_script ret -Func_2c2a7: +Script_IshiharaTrade2: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -334,42 +334,42 @@ Func_2c2a7: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_2c2c9 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ea4 - script_jump .ows_2c2cc -.ows_2c2c9 - print_npc_text Text0ea5 -.ows_2c2cc + print_npc_text IshiharaWantsToTrade2InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade2RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_2c2d9 - print_npc_text Text0e9d - script_jump .ows_2c307 -.ows_2c2d9 + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks CLEFABLE - script_jump_if_b0z .ows_2c2e5 - print_npc_text Text0ea6 - script_jump .ows_2c307 -.ows_2c2e5 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnClefableLv34Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection CLEFABLE - script_jump_if_b0z .ows_2c2f1 - print_npc_text Text0ea7 - script_jump .ows_2c307 -.ows_2c2f1 - print_npc_text Text0ea8 - print_text Text0ea9 + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllClefableLv34InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade2Text + print_text TradedClefableLv34ForTogepiLv8Text receive_card TOGEPI take_card CLEFABLE set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $04 - print_npc_text Text0eaa -.ows_2c307 + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_2_DONE + print_npc_text IshiharaThanksTradedClefableLv34Text +.done end_dialog end_script ret -Func_2c30a: +Script_IshiharaTrade3: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -381,42 +381,42 @@ Func_2c30a: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_2c32c + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0eab - script_jump .ows_2c32f -.ows_2c32c - print_npc_text Text0eac -.ows_2c32f + print_npc_text IshiharaWantsToTrade3InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade3RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_2c33c - print_npc_text Text0e9d - script_jump .ows_2c36a -.ows_2c33c + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks DRAGONITE_LV45 - script_jump_if_b0z .ows_2c348 - print_npc_text Text0ead - script_jump .ows_2c36a -.ows_2c348 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnDragoniteLv45Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection DRAGONITE_LV45 - script_jump_if_b0z .ows_2c354 - print_npc_text Text0eae - script_jump .ows_2c36a -.ows_2c354 - print_npc_text Text0eaf - print_text Text0eb0 + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllDragoniteLv45InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade3Text + print_text TradedhDragoniteLv45ForMarillLv17Text receive_card MARILL take_card DRAGONITE_LV45 set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $05 - print_npc_text Text0eb1 -.ows_2c36a + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_3_DONE + print_npc_text IshiharaThanksTradedDragoniteLv45Text +.done end_dialog end_script ret -Func_2c36d: +Script_IshiharaHeadingForVilla: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -427,12 +427,12 @@ Func_2c36d: xor a start_script start_dialog - print_npc_text Text0eb2 + print_npc_text IshiharaHeadingForVillaText end_dialog end_script ret -Func_2c388: +Script_IshiharaBusy: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -443,13 +443,13 @@ Func_2c388: xor a start_script start_dialog - print_npc_text Text0eb3 + print_npc_text IshiharaBusyRevisitVillaText end_dialog set_active_npc_direction NORTH end_script ret -Func_2c3a5: +Script_IshiharaCongratsAtHome: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -461,17 +461,17 @@ Func_2c3a5: start_script start_dialog set_event EVENT_TALKED_TO_ISHIHARA_POST_GAME - print_npc_text Text0eb4 + print_npc_text IshiharaDefeatedBiruritchiCongratsText end_dialog - get_var VAR_02 - compare_loaded_var $06 - script_jump_if_b1nz .ows_2c3c9 + get_var VAR_ISHIHARA_STATE + compare_loaded_var ISHIHARA_TALKED_AT_VILLA + script_jump_if_b1nz .done set_active_npc_direction NORTH -.ows_2c3c9 +.done end_script ret -Func_2c3cb: +Script_NikkiRetreated: ld a, NPC_NIKKI ld [wScriptNPC], a ldtx hl, DialogNikkiText @@ -483,60 +483,60 @@ Func_2c3cb: start_script start_dialog check_event EVENT_TALKED_TO_NIKKI - script_jump_if_b0z .ows_2c446 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_NIKKI set_event EVENT_SET_UNTIL_MAP_RELOAD_1 - print_npc_text Text0eb5 + print_npc_text NikkiWantsToGiveAwayGiveInAntiGR2Deck1Text end_dialog get_player_direction compare_loaded_var SOUTH - script_jump_if_b0z .ows_2c3f8 + script_jump_if_b0z .skip_player_reposition set_player_direction WEST animate_player_movement $81, $02 -.ows_2c3f8 +.skip_player_reposition move_active_npc .NPCMovement_2c450 wait_for_player_animation do_frames 30 get_player_y_position - compare_loaded_var $04 - script_jump_if_b0nz .ows_2c40d - script_jump_if_b1nz .ows_2c413 + compare_loaded_var 4 + script_jump_if_b0nz .player_same_row + script_jump_if_b1nz .player_above move_active_npc .NPCMovement_2c457 - script_jump .ows_2c416 -.ows_2c40d + script_jump .nikki_walked +.player_same_row move_active_npc .NPCMovement_2c45c - script_jump .ows_2c416 -.ows_2c413 + script_jump .nikki_walked +.player_above move_active_npc .NPCMovement_2c463 -.ows_2c416 +.nikki_walked wait_for_player_animation do_frames 15 start_dialog - print_npc_text Text0eb6 + print_npc_text NikkiWantsToGiveAwayGiveInAntiGR2Deck2Text give_deck GIVE_IN_ANTI_GR2_DECK_ID - script_jump_if_b1nz .ows_2c42c + script_jump_if_b1nz .decks_full play_song MUSIC_BOOSTER_PACK - print_text Text0eb7 + print_text ReceivedGiveInAntiGR2DeckText wait_song resume_song - script_jump .ows_2c439 -.ows_2c42c - print_npc_text Text0eb8 + script_jump .give_coin +.decks_full + print_npc_text NikkiDecksFullGivesCardsInsteadText play_song MUSIC_BOOSTER_PACK - print_text Text0eb9 + print_text ReceivedCardsForGiveInAntiGR2DeckText wait_song resume_song - print_npc_text Text0eba -.ows_2c439 + print_npc_text NikkiToSendDeckConfigurationToMachineText +.give_coin set_event EVENT_GOT_ODDISH_COIN - print_npc_text Text0ebb + print_npc_text NikkiWantsToGiveOddishCoinText give_coin COIN_ODDISH - print_npc_text Text0ebc - script_jump .ows_2c44d -.ows_2c446 + print_npc_text NikkiGaveOddishCoinText + script_jump .done +.repeat check_event EVENT_SET_UNTIL_MAP_RELOAD_1 - print_variable_npc_text Text0ebd, Text0ebe -.ows_2c44d + print_variable_npc_text NikkiCountingOnYouInitialText, NikkiCountingOnYouRepeatText +.done end_dialog end_script ret @@ -560,15 +560,15 @@ Func_2c3cb: db EAST, MOVE_0 db $ff -Func_2c46a: - ld a, VAR_02 +IshiharasHouse_AppearDuringRetreat: + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $01 - jr nz, .asm_2c477 + cp ISHIHARA_HELPING_NIKKI + jr nz, .disappear scf ccf ret -.asm_2c477 +.disappear scf ret @@ -4838,7 +4838,7 @@ Func_2e449: reset_event EVENT_TALKED_TO_DAVID reset_event EVENT_TALKED_TO_JOSEPH reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $02 + set_var VAR_ISHIHARA_STATE, ISHIHARA_HELPED_NIKKI print_npc_text Text0e74 give_booster_packs BoosterList_cd44 script_jump .ows_2e471 @@ -5927,7 +5927,7 @@ Func_2ec5a: reset_event EVENT_TALKED_TO_DAVID reset_event EVENT_TALKED_TO_JOSEPH reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $02 + set_var VAR_ISHIHARA_STATE, ISHIHARA_HELPED_NIKKI print_npc_text Text1067 give_booster_packs BoosterList_cd44 script_jump .ows_2ec82 diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 83b10f4..8c3decc 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -2063,7 +2063,7 @@ Func_3d02b: check_event EVENT_BEAT_BRITTANY script_jump_if_b0z .ows_3d050 set_event EVENT_BEAT_BRITTANY - set_var VAR_02, $01 + set_var VAR_ISHIHARA_STATE, ISHIHARA_HELPING_NIKKI print_npc_text Text0e81 script_jump .ows_3d05f .ows_3d050 @@ -4965,13 +4965,13 @@ IshiharasVillaMain_StepEvents: db $ff IshiharasVillaMain_NPCs: - npc NPC_ISHIHARA, 6, 5, WEST, Func_3e7d6 - npc NPC_ISHIHARAS_VILLA_GR_GAL, 2, 2, NORTH, Func_3e8d3 + npc NPC_ISHIHARA, 6, 5, WEST, IshiharasVillaMain_IshiharaAppearanceCheck + npc NPC_ISHIHARAS_VILLA_GR_GAL, 2, 2, NORTH, IshiharasVillaMain_DisappearIfInGRCastle db $ff IshiharasVillaMain_NPCInteractions: - npc_script NPC_ISHIHARA, Func_3e7c0 - npc_script NPC_ISHIHARAS_VILLA_GR_GAL, Func_3e8b1 + npc_script NPC_ISHIHARA, Script_IshiharaAtVillaMain + npc_script NPC_ISHIHARAS_VILLA_GR_GAL, Script_RuiAtVillaMain db $ff IshiharasVillaMain_OWInteractions: @@ -4991,12 +4991,12 @@ IshiharasVillaMain_MapScripts: db $ff Func_3e704: - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $05 + cp ISHIHARA_TRADE_3_DONE jr c, .asm_3e722 jr z, .asm_3e71a - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue jr nz, .asm_3e722 jr .asm_3e727 @@ -5037,29 +5037,29 @@ Func_3e73a: Func_3e74a: xor a push af - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr z, .asm_3e758 + jr z, .skip_bit0 pop af or $01 push af -.asm_3e758 +.skip_bit0 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr z, .asm_3e764 + jr z, .skip_bit1 pop af or $02 push af -.asm_3e764 +.skip_bit1 pop af or a - jr z, .asm_3e775 + jr z, .done ld c, a - ld a, $00 + ld a, VAR_00 farcall SetVarValue ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall MaxOutEventValue -.asm_3e775 +.done scf ccf ret @@ -5074,16 +5074,16 @@ Func_3e778: ret Func_3e787: - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall ZeroOutEventValue ld a, VAR_00 farcall GetVarValue bit 0, a push af - call nz, Func_3e7ad + call nz, .SetLocationFlag pop af bit 1, a - call nz, Func_3e7b4 + call nz, .SetTradeFlag ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall ZeroOutEventValue ld a, VAR_00 @@ -5091,51 +5091,51 @@ Func_3e787: scf ret -Func_3e7ad: - ld a, EVENT_F5 +.SetLocationFlag: + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall MaxOutEventValue ret -Func_3e7b4: +.SetTradeFlag: ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall MaxOutEventValue ret Func_3e7bb: - call Func_3e836 + call Script_IshiharaAfterDuel scf ret -Func_3e7c0: +Script_IshiharaAtVillaMain: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr z, .asm_3e7d3 + jr z, .duel ld a, EVENT_TALKED_TO_ISHIHARA_POST_GAME farcall GetEventValue - jr nz, .asm_3e7d3 - jp Func_3e854 -.asm_3e7d3 - jp Func_3e7f5 + jr nz, .duel + jp Script_IshiharaCongratsAtVillaMain +.duel + jp Script_IshiharaDuel -Func_3e7d6: - ld a, VAR_02 +IshiharasVillaMain_IshiharaAppearanceCheck: + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $0a - jr c, .asm_3e7f3 + cp ISHIHARA_TRADE_7_DONE_COMPLETE + jr c, .disappear ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr nz, .asm_3e7f3 - ld a, EVENT_F5 + jr nz, .disappear + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr nz, .asm_3e7f3 + jr nz, .disappear scf ccf ret -.asm_3e7f3 +.disappear scf ret -Func_3e7f5: +Script_IshiharaDuel: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5149,46 +5149,46 @@ Func_3e7f5: get_player_opposite_direction restore_active_npc_direction check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_3e819 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ee2 - script_jump .ows_3e81c -.ows_3e819 - print_npc_text Text0ee3 -.ows_3e81c - ask_question Text0ee4, TRUE - script_jump_if_b0z .ows_3e830 - script_call Script_3e873 - print_npc_text Text0ee5 + print_npc_text IshiharaWantsToDuelInitialText + script_jump .duel_prompt +.repeat + print_npc_text IshiharaWantsToDuelRepeatText +.duel_prompt + ask_question IshiharaDuelPromptText, TRUE + script_jump_if_b0z .declined + script_call Script_SeatPlayerAtIshiharaDuelTable + print_npc_text IshiharaDuelStartText end_dialog start_duel VERY_RARE_CARD_DECK_ID, MUSIC_MATCH_START_MEMBER end_script ret -.ows_3e830 - print_npc_text Text0ee6 +.declined + print_npc_text IshiharaDeclinedDuelText end_dialog end_script ret -Func_3e836: +Script_IshiharaAfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e84e + script_jump_if_b0nz .player_lost set_event EVENT_BATTLED_ISHIHARA - print_npc_text Text0ee7 - give_booster_packs BoosterList_cdd3 - print_npc_text Text0ee8 - script_jump .ows_3e851 -.ows_3e84e - print_npc_text Text0ee9 -.ows_3e851 + print_npc_text IshiharaPlayerWon1Text + give_booster_packs BoosterList_Ishihara + print_npc_text IshiharaPlayerWon2Text + script_jump .done +.player_lost + print_npc_text IshiharaPlayerLostText +.done end_dialog end_script ret -Func_3e854: +Script_IshiharaCongratsAtVillaMain: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5202,12 +5202,12 @@ Func_3e854: get_player_opposite_direction restore_active_npc_direction set_event EVENT_TALKED_TO_ISHIHARA_POST_GAME - print_npc_text Text0eb4 + print_npc_text IshiharaDefeatedBiruritchiCongratsText end_dialog end_script ret -Script_3e873: +Script_SeatPlayerAtIshiharaDuelTable: end_dialog set_active_npc_direction WEST get_player_direction @@ -5245,7 +5245,7 @@ Script_3e873: db EAST, MOVE_0 db $ff -Func_3e8b1: +Script_RuiAtVillaMain: ld a, NPC_ISHIHARAS_VILLA_GR_GAL ld [wScriptNPC], a ldtx hl, DialogRuiText @@ -5256,23 +5256,23 @@ Func_3e8b1: xor a start_script start_dialog - print_npc_text Text0eea + print_npc_text RuiStudyingAtIshiharasVilla1Text get_player_opposite_direction restore_active_npc_direction - print_npc_text Text0eeb + print_npc_text RuiStudyingAtIshiharasVilla2Text end_dialog set_active_npc_direction NORTH end_script ret -Func_3e8d3: +IshiharasVillaMain_DisappearIfInGRCastle: ld a, EVENT_GR_CASTLE_ENTRANCE_DOOR_STATE farcall GetEventValue - jr nz, .asm_3e8de + jr nz, .disappear scf ccf ret -.asm_3e8de +.disappear scf ret @@ -5287,13 +5287,13 @@ IshiharasVillaLibrary_StepEvents: db $ff IshiharasVillaLibrary_NPCs: - npc NPC_ISHIHARA, 5, 4, SOUTH, Func_3ea55 - npc NPC_ISHIHARAS_VILLA_GR_GAL, 4, 2, NORTH, Func_3ecd5 + npc NPC_ISHIHARA, 5, 4, SOUTH, IshiharasVillaLibrary_IshiharaAppearanceCheck + npc NPC_ISHIHARAS_VILLA_GR_GAL, 4, 2, NORTH, IshiharasVillaLibrary_RuiAppearanceCheck db $ff IshiharasVillaLibrary_NPCInteractions: - npc_script NPC_ISHIHARA, Func_3ea12 - npc_script NPC_ISHIHARAS_VILLA_GR_GAL, Func_3ec75 + npc_script NPC_ISHIHARA, Script_IshiharaAtVillaLibrary + npc_script NPC_ISHIHARAS_VILLA_GR_GAL, Script_RuiAtVillaLibrary db $ff IshiharasVillaLibrary_OWInteractions: @@ -5316,12 +5316,12 @@ IshiharasVillaLibrary_MapScripts: db $ff Func_3e95b: - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $05 + cp ISHIHARA_TRADE_3_DONE jr c, .asm_3e979 jr z, .asm_3e971 - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue jr nz, .asm_3e979 jr .asm_3e97e @@ -5362,29 +5362,29 @@ Func_3e991: Func_3e9a1: xor a push af - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr z, .asm_3e9af + jr z, .skip_bit0 pop af or $01 push af -.asm_3e9af +.skip_bit0 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr z, .asm_3e9bb + jr z, .skip_bit1 pop af or $02 push af -.asm_3e9bb +.skip_bit1 pop af or a - jr z, .asm_3e9cc + jr z, .done ld c, a - ld a, $00 + ld a, VAR_00 farcall SetVarValue ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall MaxOutEventValue -.asm_3e9cc +.done scf ccf ret @@ -5399,16 +5399,16 @@ Func_3e9cf: ret Func_3e9de: - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall ZeroOutEventValue ld a, VAR_00 farcall GetVarValue bit 0, a push af - call nz, Func_3ea04 + call nz, .SetLocationFlag pop af bit 1, a - call nz, Func_3ea0b + call nz, .SetTradeFlag ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY farcall ZeroOutEventValue ld a, VAR_00 @@ -5416,76 +5416,76 @@ Func_3e9de: scf ret -Func_3ea04: - ld a, EVENT_F5 +.SetLocationFlag: + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall MaxOutEventValue ret -Func_3ea0b: +.SetTradeFlag: ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall MaxOutEventValue ret -Func_3ea12: +Script_IshiharaAtVillaLibrary: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue jr z, .asm_3ea25 ld a, EVENT_TALKED_TO_ISHIHARA_POST_GAME farcall GetEventValue jr nz, .asm_3ea25 - jp Func_3ec58 + jp Script_IshiharaCongratsAtVillaLibrary .asm_3ea25 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue jr z, .asm_3ea3b - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $06 - jp z, Func_3ea86 - jp Func_3ec3d + cp ISHIHARA_TALKED_AT_VILLA + jp z, Script_IshiharaVillaWelcome + jp Script_IshiharaTradeLaterAtVilla .asm_3ea3b - ld a, VAR_02 + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - sub $05 - jp z, Func_3ea86 + sub ISHIHARA_TRADE_3_DONE + jp z, Script_IshiharaVillaWelcome ; ISHIHARA_TRADE_3_DONE dec a - jp z, Func_3eab1 + jp z, Script_IshiharaTrade4 ; ISHIHARA_TALKED_AT_VILLA dec a - jp z, Func_3eb14 + jp z, Script_IshiharaTrade5 ; ISHIHARA_TRADE_4_DONE dec a - jp z, Func_3eb77 - jp Func_3ebda + jp z, Script_IshiharaTrade6 ; ISHIHARA_TRADE_5_DONE + jp Script_IshiharaTrade7 ; ISHIHARA_TRADE_6_DONE -Func_3ea55: - ld a, VAR_02 +IshiharasVillaLibrary_IshiharaAppearanceCheck: + ld a, VAR_ISHIHARA_STATE farcall GetVarValue - cp $05 - jr c, .asm_3ea84 + cp ISHIHARA_TRADE_3_DONE + jr c, .disappear jr z, .asm_3ea6f - cp $0a + cp ISHIHARA_TRADE_7_DONE_COMPLETE jr z, .asm_3ea79 - ld a, EVENT_F5 + ld a, EVENT_ISHIHARA_LOCATION_STATE farcall GetEventValue - jr nz, .asm_3ea84 - jr .asm_3ea81 + jr nz, .disappear + jr .appear .asm_3ea6f ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr nz, .asm_3ea84 - jr .asm_3ea81 + jr nz, .disappear + jr .appear .asm_3ea79 ld a, EVENT_ISHIHARA_CARD_TRADE_STATE farcall GetEventValue - jr z, .asm_3ea84 -.asm_3ea81 + jr z, .disappear +.appear scf ccf ret -.asm_3ea84 +.disappear scf ret -Func_3ea86: +Script_IshiharaVillaWelcome: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5497,19 +5497,19 @@ Func_3ea86: start_script start_dialog check_event EVENT_ISHIHARA_CARD_TRADE_STATE - script_jump_if_b0z .ows_3eaab - set_var VAR_02, $06 + script_jump_if_b0z .repeat + set_var VAR_ISHIHARA_STATE, ISHIHARA_TALKED_AT_VILLA set_event EVENT_ISHIHARA_CARD_TRADE_STATE - print_npc_text Text0ebf - script_jump .ows_3eaae -.ows_3eaab - print_npc_text Text0ec0 -.ows_3eaae + print_npc_text IshiharaMyVillaText + script_jump .done +.repeat + print_npc_text IshiharaVillaSeeYouLaterText +.done end_dialog end_script ret -Func_3eab1: +Script_IshiharaTrade4: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5521,42 +5521,42 @@ Func_3eab1: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_3ead3 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ec1 - script_jump .ows_3ead6 -.ows_3ead3 - print_npc_text Text0ec2 -.ows_3ead6 + print_npc_text IshiharaWantsToTrade4InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade4RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_3eae3 - print_npc_text Text0e9d - script_jump .ows_3eb11 -.ows_3eae3 + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks MOLTRES_LV37 - script_jump_if_b0z .ows_3eaef - print_npc_text Text0ec3 - script_jump .ows_3eb11 -.ows_3eaef + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnMoltresLv37Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection MOLTRES_LV37 - script_jump_if_b0z .ows_3eafb - print_npc_text Text0ec4 - script_jump .ows_3eb11 -.ows_3eafb - print_npc_text Text0ec5 - print_text Text0ec6 + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllMoltresLv37InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade4Text + print_text TradedMoltresForSurfingPikachuText receive_card SURFING_PIKACHU_ALT_LV13 take_card MOLTRES_LV37 set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $07 - print_npc_text Text0ec7 -.ows_3eb11 + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_4_DONE + print_npc_text IshiharaThanksTradedMoltresLv37Text +.done end_dialog end_script ret -Func_3eb14: +Script_IshiharaTrade5: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5568,42 +5568,42 @@ Func_3eb14: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_3eb36 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ec8 - script_jump .ows_3eb39 -.ows_3eb36 - print_npc_text Text0ec9 -.ows_3eb39 + print_npc_text IshiharaWantsToTrade5InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade5RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_3eb46 - print_npc_text Text0e9d - script_jump .ows_3eb74 -.ows_3eb46 + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks ARTICUNO_LV34 - script_jump_if_b0z .ows_3eb52 - print_npc_text Text0eca - script_jump .ows_3eb74 -.ows_3eb52 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnArticunoLv34Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection ARTICUNO_LV34 - script_jump_if_b0z .ows_3eb5e - print_npc_text Text0ecb - script_jump .ows_3eb74 -.ows_3eb5e - print_npc_text Text0ecc - print_text Text0ecd + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllArticunoLv34InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade5Text + print_text TradedArticunoLv34ForSurfingPikachuText receive_card SURFING_PIKACHU_LV13 take_card ARTICUNO_LV34 set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $08 - print_npc_text Text0ece -.ows_3eb74 + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_5_DONE + print_npc_text IshiharaThanksTradedArticunoLv34Text +.done end_dialog end_script ret -Func_3eb77: +Script_IshiharaTrade6: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5615,42 +5615,42 @@ Func_3eb77: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_3eb99 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ecf - script_jump .ows_3eb9c -.ows_3eb99 - print_npc_text Text0ed0 -.ows_3eb9c + print_npc_text IshiharaWantsToTrade6InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade6RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_3eba9 - print_npc_text Text0e9d - script_jump .ows_3ebd7 -.ows_3eba9 + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks ZAPDOS_LV40 - script_jump_if_b0z .ows_3ebb5 - print_npc_text Text0ed1 - script_jump .ows_3ebd7 -.ows_3ebb5 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnZapdosLv40Text + script_jump .done +.count_cards_outside_decks get_card_count_in_collection ZAPDOS_LV40 - script_jump_if_b0z .ows_3ebc1 - print_npc_text Text0ed2 - script_jump .ows_3ebd7 -.ows_3ebc1 - print_npc_text Text0ed3 - print_text Text0ed4 + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllZapdosLv40InDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade6Text + print_text TradedZapdosLv40ForFlyingPikachuText receive_card FLYING_PIKACHU_LV12 take_card ZAPDOS_LV40 set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $09 - print_npc_text Text0ed5 -.ows_3ebd7 + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_6_DONE + print_npc_text IshiharaThanksTradedZapdosLv40Text +.done end_dialog end_script ret -Func_3ebda: +Script_IshiharaTrade7: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5662,42 +5662,42 @@ Func_3ebda: start_script start_dialog check_event EVENT_TALKED_TO_ISHIHARA - script_jump_if_b0z .ows_3ebfc + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_ISHIHARA - print_npc_text Text0ed6 - script_jump .ows_3ebff -.ows_3ebfc - print_npc_text Text0ed7 -.ows_3ebff + print_npc_text IshiharaWantsToTrade7InitialText + script_jump .trade_prompt +.repeat + print_npc_text IshiharaWantsToTrade7RepeatText +.trade_prompt ask_question TradeCardsPromptText, TRUE - script_jump_if_b0nz .ows_3ec0c - print_npc_text Text0e9d - script_jump .ows_3ec3a -.ows_3ec0c + script_jump_if_b0nz .count_cards + print_npc_text IshiharaDeclinedTradeText + script_jump .done +.count_cards get_card_count_in_collection_and_decks DARK_DRAGONITE - script_jump_if_b0z .ows_3ec18 - print_npc_text Text0ed8 - script_jump .ows_3ec3a -.ows_3ec18 + script_jump_if_b0z .count_cards_outside_decks + print_npc_text IshiharaDoNotOwnDarkDragoniteText + script_jump .done +.count_cards_outside_decks get_card_count_in_collection DARK_DRAGONITE - script_jump_if_b0z .ows_3ec24 - print_npc_text Text0ed9 - script_jump .ows_3ec3a -.ows_3ec24 - print_npc_text Text0eda - print_text Text0edb + script_jump_if_b0z .start_trade + print_npc_text IshiharaUsingAllDarkDragoniteInDecksText + script_jump .done +.start_trade + print_npc_text IshiharaAcceptedTrade7Text + print_text TradedDarkDragoniteForBillsComputerText receive_card BILLS_COMPUTER take_card DARK_DRAGONITE set_event EVENT_ISHIHARA_CARD_TRADE_STATE reset_event EVENT_TALKED_TO_ISHIHARA - set_var VAR_02, $0a - print_npc_text Text0edc -.ows_3ec3a + set_var VAR_ISHIHARA_STATE, ISHIHARA_TRADE_7_DONE_COMPLETE + print_npc_text IshiharaThanksTradedDarkDragoniteTradesCompleteText +.done end_dialog end_script ret -Func_3ec3d: +Script_IshiharaTradeLaterAtVilla: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5708,12 +5708,12 @@ Func_3ec3d: xor a start_script start_dialog - print_npc_text Text0edd + print_npc_text IshiharaAtVillaTradeLaterReadMyBooksText end_dialog end_script ret -Func_3ec58: +Script_IshiharaCongratsAtVillaLibrary: ld a, NPC_ISHIHARA ld [wScriptNPC], a ldtx hl, DialogMrIshiharaText @@ -5725,12 +5725,12 @@ Func_3ec58: start_script start_dialog set_event EVENT_TALKED_TO_ISHIHARA_POST_GAME - print_npc_text Text0eb4 + print_npc_text IshiharaDefeatedBiruritchiCongratsText end_dialog end_script ret -Func_3ec75: +Script_RuiAtVillaLibrary: ld a, NPC_ISHIHARAS_VILLA_GR_GAL ld [wScriptNPC], a ldtx hl, DialogRuiText @@ -5744,33 +5744,33 @@ Func_3ec75: set_event EVENT_MET_GR_GAL_ISHIHARAS_VILLA get_player_opposite_direction restore_active_npc_direction - print_npc_text Text0ede + print_npc_text RuiStudyingAtIshiharasVillaPostgameText end_dialog get_player_direction compare_loaded_var NORTH - script_jump_if_b0z .ows_3ec9d + script_jump_if_b0z .skip_player_reposition set_player_direction EAST animate_player_movement $83, $02 -.ows_3ec9d +.skip_player_reposition check_npc_loaded NPC_ISHIHARA - script_jump_if_b1nz .ows_3ecc2 + script_jump_if_b1nz .no_ishihara move_active_npc .NPCMovement_3ecca wait_for_player_animation start_dialog - print_npc_text Text0edf + print_npc_text RuiThanksIshiharaText set_active_npc NPC_ISHIHARA, DialogMrIshiharaText set_active_npc_direction WEST - print_npc_text Text0ee0 + print_npc_text IshiharaGladToHelpRuiText set_active_npc NPC_ISHIHARAS_VILLA_GR_GAL, DialogRuiText - print_npc_text Text0ee1 + print_npc_text RuiGoodbyeIshiharaText end_dialog move_active_npc .NPCMovement_3eccf wait_for_player_animation - script_jump .ows_3ecc6 -.ows_3ecc2 + script_jump .done +.no_ishihara move_active_npc .NPCMovement_3ecd2 wait_for_player_animation -.ows_3ecc6 +.done unload_npc NPC_ISHIHARAS_VILLA_GR_GAL end_script ret @@ -5785,17 +5785,17 @@ Func_3ec75: db SOUTH, MOVE_7 db $ff -Func_3ecd5: +IshiharasVillaLibrary_RuiAppearanceCheck: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr z, .asm_3ece8 + jr z, .disappear ld a, EVENT_MET_GR_GAL_ISHIHARAS_VILLA farcall GetEventValue - jr nz, .asm_3ece8 + jr nz, .disappear scf ccf ret -.asm_3ece8 +.disappear scf ret diff --git a/src/text/text10.asm b/src/text/text10.asm index d125144..16f7492 100644 --- a/src/text/text10.asm +++ b/src/text/text10.asm @@ -1,4 +1,4 @@ -Text0ecf: +IshiharaWantsToTrade6InitialText: textfw "やあ くんですか" linefw "GR団との対戦 たのしんでますか?" linefw "でんせつのとりポケモンの カードも" @@ -15,7 +15,7 @@ Text0ecf: linefw "カードを もっていませんか?" done -Text0ed0: +IshiharaWantsToTrade6RepeatText: textfw "やあ くんですか" linefw "ポケモンカード たのしんでますか?" linefw "でんせつのとりポケモンの カードも" @@ -30,7 +30,7 @@ Text0ed0: linefw "カードを もっていませんか?" done -Text0ed1: +IshiharaDoNotOwnZapdosLv40Text: textfw "きみの きもちは" linefw "とても ありがたいのですが" linefw "きみは 「サンダー40」の" @@ -39,7 +39,7 @@ Text0ed1: linefw "また こんどということで・・・" done -Text0ed2: +IshiharaUsingAllZapdosLv40InDecksText: textfw "おやおや きみの「サンダー40」は" linefw "ぜんぶデッキに はいっているんですね" linefw "ゲームに つかっているカードを" @@ -48,17 +48,17 @@ Text0ed2: linefw "また こんどということで・・・" done -Text0ed3: +IshiharaAcceptedTrade6Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0ed4: +TradedZapdosLv40ForFlyingPikachuText: textfw "は 「サンダー」と" linefw "「そらをとぶピカチュウ」をこうかん!" done -Text0ed5: +IshiharaThanksTradedZapdosLv40Text: textfw "この「サンダー40」は" linefw "ありがたく いただきますよ" linefw "これで でんせつのとりポケモンの" @@ -67,7 +67,7 @@ Text0ed5: linefw "ほんとうに ありがとう" done -Text0ed6: +IshiharaWantsToTrade7InitialText: textfw "やあ くんですか" linefw "GR団との対戦 たのしんでますか?" linefw "ちょっと かわったカードを" @@ -82,7 +82,7 @@ Text0ed6: linefw "こうかん しませんか?" done -Text0ed7: +IshiharaWantsToTrade7RepeatText: textfw "やあ くんですか" linefw "ポケモンカード たのしんでますか?" linefw "「マサキのパソコン」のカードを" @@ -93,7 +93,7 @@ Text0ed7: linefw "カードを もっていませんか?" done -Text0ed8: +IshiharaDoNotOwnDarkDragoniteText: textfw "きみの きもちは" linefw "とても ありがたいのですが" linefw "きみは 「わるいカイリュー33」の" @@ -102,7 +102,7 @@ Text0ed8: linefw "また こんどということで・・・" done -Text0ed9: +IshiharaUsingAllDarkDragoniteInDecksText: textfw "きみの「わるいカイリュー33」は" linefw "ぜんぶデッキに はいっているんですね" linefw "ゲームに つかっているカードを" @@ -111,17 +111,17 @@ Text0ed9: linefw "また こんどということで・・・" done -Text0eda: +IshiharaAcceptedTrade7Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0edb: +TradedDarkDragoniteForBillsComputerText: textfw "は「わるいカイリュー」と" linefw "「マサキのパソコン」をこうかん!" done -Text0edc: +IshiharaThanksTradedDarkDragoniteTradesCompleteText: textfw "この「わるいカイリュー33」は" linefw "ありがたく いただきますよ" linefw "これで わたしが ひつようとしている" @@ -132,7 +132,7 @@ Text0edc: linefw "ポケモンカードを たのしんでください" done -Text0edd: +IshiharaAtVillaTradeLaterReadMyBooksText: textfw "やあ くんですか" linefw "いらっしゃい" linefw "いまは とくに ほしいカードも" @@ -147,7 +147,7 @@ Text0edd: linefw "対戦で やくにたちますよ" done -Text0ede: +RuiStudyingAtIshiharasVillaPostgameText: textfw "あら くん?" linefw "あなたも べんきょうにきたの?" linefw "Mr.イシハラの本は 対戦のためになる" @@ -163,22 +163,22 @@ Text0ede: linefw "それじゃあね くん" done -Text0edf: +RuiThanksIshiharaText: textfw "いつも ありがとうございます" linefw "Mr.イシハラ・・・" done -Text0ee0: +IshiharaGladToHelpRuiText: textfw "いえいえ わたしの本が" linefw "おやくにたてば なによりです" done -Text0ee1: +RuiGoodbyeIshiharaText: textfw "では しつれいします" linefw "Mr.イシハラ・・・" done -Text0ee2: +IshiharaWantsToDuelInitialText: textfw "やあ くん" linefw "ポケモンカードを たのしんでますか?" linefw "きみのおかげで ひつようなカードは" @@ -191,7 +191,7 @@ Text0ee2: linefw "わたしと 対戦してくれませんか?" done -Text0ee3: +IshiharaWantsToDuelRepeatText: textfw "やあ くん" linefw "ポケモンカードを たのしんでますか?" linefw "いろんなひとと 対戦してみると" @@ -202,32 +202,32 @@ Text0ee3: linefw "わたしと 対戦してくれませんか?" done -Text0ee4: +IshiharaDuelPromptText: textfw "Mr.イシハラと 対戦しますか?" done -Text0ee5: +IshiharaDuelStartText: textfw "ありがとう くん" linefw "それでは 対戦をたのしみましょう" linefw "サイドカードは" linefw "6枚で おねがいいたします" done -Text0ee6: +IshiharaDeclinedDuelText: textfw "そうですか?" linefw "それは ざんねんですね" linefw "それでは カード対戦は" linefw "また こんどということで・・・" done -Text0ee7: +IshiharaPlayerWon1Text: textfw "さすがは くん" linefw "すっかり やられてしまいました" linefw "でも たのしい対戦でしたよ" linefw "これを あげましょう" done -Text0ee8: +IshiharaPlayerWon2Text: textfw "いま さしあげたカードで" linefw "あたらしいデッキを つくってください" linefw "そして もっと" @@ -236,7 +236,7 @@ Text0ee8: linefw "また ぜひ 対戦にきてくださいね" done -Text0ee9: +IshiharaPlayerLostText: textfw "やあ・・・" linefw "わたしが 勝ってしまいましたね" linefw "なかなか たのしい対戦でしたね" @@ -245,12 +245,12 @@ Text0ee9: linefw "また 対戦にきてくださいね" done -Text0eea: +RuiStudyingAtIshiharasVilla1Text: textfw "フン フン なるほどね・・・" linefw "さすがね・・・・" done -Text0eeb: +RuiStudyingAtIshiharasVilla2Text: textfw "なに? いま ポケモンカードの" linefw "べんきょうしているのよ" linefw "Mr.イシハラの本は 対戦のためになる" diff --git a/src/text/text9.asm b/src/text/text9.asm index 3a023ff..4d4a34d 100644 --- a/src/text/text9.asm +++ b/src/text/text9.asm @@ -1414,7 +1414,7 @@ Text0e96: linefw "対戦も してみよーかなー" done -Text0e97: +IshiharaUnderGRInvasionInitialText: textfw "やあ こんにちは" linefw "わたしが Mr.イシハラです" linefw "わたしは ポケモンカードのコレクター" @@ -1427,7 +1427,7 @@ Text0e97: linefw "だいじょうぶなのでしょうか?" done -Text0e98: +IshiharaUnderGRInvasionRepeatText: textfw "やあ こんにちは" linefw "わたしが Mr.イシハラです" linefw "クラブやドームが GR団に" @@ -1436,7 +1436,7 @@ Text0e98: linefw "だいじょうぶなのでしょうか?" done -Text0e99: +IshiharaListenToNikkiText: textfw "やあ こんにちは" linefw "わたしが Mr.イシハラです" linefw "わたしは ポケモンカードのコレクター" @@ -1447,7 +1447,7 @@ Text0e99: linefw "ねがいを きいてあげてください" done -Text0e9a: +IshiharaHelpNikkiText: textfw "やあ こんにちは" linefw "わたしが Mr.イシハラです" linefw "わたしは ポケモンカードのコレクター" @@ -1458,7 +1458,7 @@ Text0e9a: linefw "わたしと トレードしましょう" done -Text0e9b: +IshiharaWantsToTrade1InitialText: textfw "やあ くんですか" linefw "じゃあ カードをこうかんしましょう" linefw "じつは いま 「ピッピ15」を" @@ -1471,7 +1471,7 @@ Text0e9b: linefw "もっていませんか?" done -Text0e9c: +IshiharaWantsToTrade1RepeatText: textfw "やあ くんですか" linefw "ポケモンカード たのしんでますか?" linefw "じつは いま 「ピッピ15」を" @@ -1482,21 +1482,21 @@ Text0e9c: linefw "もっていませんか?" done -Text0e9d: +IshiharaDeclinedTradeText: textfw "そうですか" linefw "それは ざんねんです・・・" linefw "それでは カードのこうかんは" linefw "また こんどということで・・・" done -Text0e9e: +IshiharaDoNotOwnClefairyLv15Text: textfw "きもちは とても ありがたいのですが" linefw "キミは カードをもっていませんね" linefw "それでは カードのこうかんは" linefw "また こんどということで・・・" done -Text0e9f: +IshiharaUsingAllClefairyLv15InDecksText: textfw "おやおや きみの「ピッピ15」は" linefw "ぜんぶデッキに はいっているのですね" linefw "ゲームに つかっているカードを" @@ -1505,24 +1505,24 @@ Text0e9f: linefw "また こんどということで・・・" done -Text0ea0: +IshiharaAcceptedTrade1Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0ea1: +TradedClefairyForFlyingPikachuText: textfw "は 「ピッピ」と" linefw "「そらをとぶピカチュウ」をこうかん!" done -Text0ea2: +IshiharaThanksTradedClefairyLv15Text: textfw "この「ピッピ15」は" linefw "ありがたく いただきますよ" linefw "ほんとうに ありがとう" linefw "たすかりましたよ" done -Text0ea3: +IshiharaAtHomeTradeLaterReadMyBooksText: textfw "やあ くんですか" linefw "いらっしゃい" linefw "いまは とくに ほしいカードも" @@ -1535,7 +1535,7 @@ Text0ea3: linefw "対戦で やくにたちますよ" done -Text0ea4: +IshiharaWantsToTrade2InitialText: textfw "やあ くんですか" linefw "じゃあ カードをこうかんしましょう" linefw "こんどは 「ピクシー34」を" @@ -1546,7 +1546,7 @@ Text0ea4: linefw "もっていませんか?" done -Text0ea5: +IshiharaWantsToTrade2RepeatText: textfw "やあ くんですか" linefw "ポケモンカード たのしんでますか?" linefw "こんどは 「ピクシー34」を" @@ -1557,7 +1557,7 @@ Text0ea5: linefw "もっていませんか?" done -Text0ea6: +IshiharaDoNotOwnClefableLv34Text: textfw "きみは 「ピクシー34」を" linefw "もっていませんね" linefw "「トゲピー8」は" @@ -1566,7 +1566,7 @@ Text0ea6: linefw "また こんどということで・・・" done -Text0ea7: +IshiharaUsingAllClefableLv34InDecksText: textfw "う~む 「ピクシー34」は" linefw "すべて デッキに いれているのですね" linefw "ゲームに つかっているカードを" @@ -1575,24 +1575,24 @@ Text0ea7: linefw "また こんどということで・・・" done -Text0ea8: +IshiharaAcceptedTrade2Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0ea9: +TradedClefableLv34ForTogepiLv8Text: textfw "は 「ピクシー34」と" linefw "「トゲピー8」を こうかん!" done -Text0eaa: +IshiharaThanksTradedClefableLv34Text: textfw "この「ピクシー34」は" linefw "ありがたく いただきますよ" linefw "ほんとうに ありがとう" linefw "たすかりましたよ" done -Text0eab: +IshiharaWantsToTrade3InitialText: textfw "やあ くんですか" linefw "あいかわらず げんきそうですね" linefw "こんどはね 「カイリュー45」を" @@ -1603,7 +1603,7 @@ Text0eab: linefw "もっていませんか?" done -Text0eac: +IshiharaWantsToTrade3RepeatText: textfw "こんどはね 「カイリュー45」を" linefw "さがしているんですよ" linefw "もっているなら「マリル17」と" @@ -1612,7 +1612,7 @@ Text0eac: linefw "もっていませんか?" done -Text0ead: +IshiharaDoNotOwnDragoniteLv45Text: textfw "きみは 「カイリュー45」を" linefw "もっていませんね" linefw "「マリル17」は" @@ -1621,7 +1621,7 @@ Text0ead: linefw "また こんどということで・・・" done -Text0eae: +IshiharaUsingAllDragoniteLv45InDecksText: textfw "う~む 「カイリュー45」は" linefw "すべて デッキに いれているのですね" linefw "ゲームに つかっているカードを" @@ -1630,24 +1630,24 @@ Text0eae: linefw "また こんどということで・・・" done -Text0eaf: +IshiharaAcceptedTrade3Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0eb0: +TradedhDragoniteLv45ForMarillLv17Text: textfw "は「カイリュー45」と" linefw "「マリル17」を こうかん!" done -Text0eb1: +IshiharaThanksTradedDragoniteLv45Text: textfw "この「カイリュー45」は" linefw "ありがたく いただきますよ" linefw "ほんとうに ありがとう" linefw "たすかりましたよ" done -Text0eb2: +IshiharaHeadingForVillaText: textfw "たくさん こうかんしてくれて" linefw "ありがとう くん" linefw "わたしは ちょっと ようじで" @@ -1656,7 +1656,7 @@ Text0eb2: linefw "あそびに きてください" done -Text0eb3: +IshiharaBusyRevisitVillaText: textfw "やあ くん" linefw "ポケモンカード たのしんでますか?" linefw "ちょっと しらべものがあって" @@ -1665,7 +1665,7 @@ Text0eb3: linefw "別莊のほうに きてください" done -Text0eb4: +IshiharaDefeatedBiruritchiCongratsText: textfw "おめでとう くん!" linefw "きいたよ" linefw "ついに GR団のキング!" @@ -1676,7 +1676,7 @@ Text0eb4: linefw "対戦して たのしんでくれたまえ" done -Text0eb5: +NikkiWantsToGiveAwayGiveInAntiGR2Deck1Text: textfw "ええ わたしが クニミ・・・" linefw "グリーンクラブのマスターです" linefw "アヤコさんから きいて" @@ -1687,61 +1687,61 @@ Text0eb5: linefw "きっと だいじょうぶですね" done -Text0eb6: +NikkiWantsToGiveAwayGiveInAntiGR2Deck2Text: textfw "これを うけとってください" linefw " " linefw "GR2号さんとの 対戦に" linefw "やくにたつはずです" done -Text0eb7: +ReceivedGiveInAntiGR2DeckText: textfw "は デッキ" linefw "「まけろ!GR2ごう」をゲット!" done -Text0eb8: +NikkiDecksFullGivesCardsInsteadText: textfw "・・・デッキは これいじょう" linefw "おもちに なれないようですわね" linefw "「まけろ!GR2ごうデッキ」の" linefw "カードを 60枚 さしあげますわ" done -Text0eb9: +ReceivedCardsForGiveInAntiGR2DeckText: textfw "は デッキつくるための" linefw "カード60枚を ゲット!" done -Text0eba: +NikkiToSendDeckConfigurationToMachineText: textfw "「デッキのつくりかた」は" linefw "オーヤマ研究所に おくっておきますわ" linefw "オートデッキマシンで" linefw "つくってくださいね" done -Text0ebb: +NikkiWantsToGiveOddishCoinText: textfw "それと これも うけとってください" done -Text0ebc: +NikkiGaveOddishCoinText: textfw "よろしければ 対戦で" linefw "おつかいください" linefw "グリーンクラブの みんなのためにも" linefw "がんばってください" done -Text0ebd: +NikkiCountingOnYouInitialText: textfw "GR2号さんには わたしのちからでは" linefw "とうてい かないません" linefw "さん" linefw "どうか よろしくおねがいいたします" done -Text0ebe: +NikkiCountingOnYouRepeatText: textfw "グリーンクラブの みんなのためにも" linefw "がんばってください" done -Text0ebf: +IshiharaMyVillaText: textfw "やあ くんですか" linefw "あちらのしまでは おせわになりました" linefw "こちらのしまでの" @@ -1754,7 +1754,7 @@ Text0ebf: linefw "また カードの トレードをしましょう" done -Text0ec0: +IshiharaVillaSeeYouLaterText: textfw "やあ くん" linefw "GR団との対戦 たのしんでいますか?" linefw "ポケモンカードは どんなときでも" @@ -1765,7 +1765,7 @@ Text0ec0: linefw "また あそびに きてくださいね" done -Text0ec1: +IshiharaWantsToTrade4InitialText: textfw "やあ くんですか" linefw "GR団との対戦 たのしんでますか?" linefw "じつは でんせつのとりポケモンの" @@ -1780,7 +1780,7 @@ Text0ec1: linefw "カードを もっていませんか?" done -Text0ec2: +IshiharaWantsToTrade4RepeatText: textfw "ポケモンカード たのしんでますか?" linefw "じつは でんせつのとりポケモンの" linefw "カードを あつめているんですよ" @@ -1792,7 +1792,7 @@ Text0ec2: linefw "カードを もっていませんか?" done -Text0ec3: +IshiharaDoNotOwnMoltresLv37Text: textfw "きみの きもちは" linefw "とても ありがたいのですが" linefw "きみは 「ファイヤー37」の" @@ -1801,7 +1801,7 @@ Text0ec3: linefw "また こんどということで・・・" done -Text0ec4: +IshiharaUsingAllMoltresLv37InDecksText: textfw "おやおや 「ファイヤー37」は" linefw "ぜんぶデッキに はいっているんですね" linefw "ゲームに つかっているカードを" @@ -1810,17 +1810,17 @@ Text0ec4: linefw "また こんどということで・・・" done -Text0ec5: +IshiharaAcceptedTrade4Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0ec6: +TradedMoltresForSurfingPikachuText: textfw "は 「ファイヤー」と" linefw "「なみのりピカチュウ」をこうかん!" done -Text0ec7: +IshiharaThanksTradedMoltresLv37Text: textfw "この「ファイヤー37」は" linefw "ありがたく いただきますよ" linefw "まずは でんせつのとりポケモン" @@ -1829,7 +1829,7 @@ Text0ec7: linefw "たすかりましたよ" done -Text0ec8: +IshiharaWantsToTrade5InitialText: textfw "やあ くんですか" linefw "GR団との対戦 たのしんでますか?" linefw "でんせつのとりポケモンの カードを" @@ -1846,7 +1846,7 @@ Text0ec8: linefw "カードを もっていませんか?" done -Text0ec9: +IshiharaWantsToTrade5RepeatText: textfw "やあ くんですか" linefw "ポケモンカード たのしんでますか?" linefw "でんせつのとりポケモンの カードを" @@ -1861,7 +1861,7 @@ Text0ec9: linefw "カードを もっていませんか?" done -Text0eca: +IshiharaDoNotOwnArticunoLv34Text: textfw "きみの きもちは" linefw "とても ありがたいのですが" linefw "きみは 「フリーザー34」の" @@ -1870,7 +1870,7 @@ Text0eca: linefw "また こんどということで・・・" done -Text0ecb: +IshiharaUsingAllArticunoLv34InDecksText: textfw "おやおや 「フリーザー34」は" linefw "ぜんぶデッキに はいっているんですね" linefw "ゲームに つかっているカードを" @@ -1879,17 +1879,17 @@ Text0ecb: linefw "また こんどということで・・・" done -Text0ecc: +IshiharaAcceptedTrade5Text: textfw "おお それは ありがたい!" linefw "それでは さっそく・・・" done -Text0ecd: +TradedArticunoLv34ForSurfingPikachuText: textfw "は 「フリーザー」と" linefw "「なみのりピカチュウ」をこうかん!" done -Text0ece: +IshiharaThanksTradedArticunoLv34Text: textfw "この「フリーザー34」は" linefw "ありがたく いただきますよ" linefw "これで でんせつのとりポケモン" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 6584e69..c79867d 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -3748,91 +3748,91 @@ TextOffsets:: textpointer Text0e94 ; 0x0e94 textpointer Text0e95 ; 0x0e95 textpointer Text0e96 ; 0x0e96 - textpointer Text0e97 ; 0x0e97 - textpointer Text0e98 ; 0x0e98 - textpointer Text0e99 ; 0x0e99 - textpointer Text0e9a ; 0x0e9a - textpointer Text0e9b ; 0x0e9b - textpointer Text0e9c ; 0x0e9c - textpointer Text0e9d ; 0x0e9d - textpointer Text0e9e ; 0x0e9e - textpointer Text0e9f ; 0x0e9f - textpointer Text0ea0 ; 0x0ea0 - textpointer Text0ea1 ; 0x0ea1 - textpointer Text0ea2 ; 0x0ea2 - textpointer Text0ea3 ; 0x0ea3 - textpointer Text0ea4 ; 0x0ea4 - textpointer Text0ea5 ; 0x0ea5 - textpointer Text0ea6 ; 0x0ea6 - textpointer Text0ea7 ; 0x0ea7 - textpointer Text0ea8 ; 0x0ea8 - textpointer Text0ea9 ; 0x0ea9 - textpointer Text0eaa ; 0x0eaa - textpointer Text0eab ; 0x0eab - textpointer Text0eac ; 0x0eac - textpointer Text0ead ; 0x0ead - textpointer Text0eae ; 0x0eae - textpointer Text0eaf ; 0x0eaf - textpointer Text0eb0 ; 0x0eb0 - textpointer Text0eb1 ; 0x0eb1 - textpointer Text0eb2 ; 0x0eb2 - textpointer Text0eb3 ; 0x0eb3 - textpointer Text0eb4 ; 0x0eb4 - textpointer Text0eb5 ; 0x0eb5 - textpointer Text0eb6 ; 0x0eb6 - textpointer Text0eb7 ; 0x0eb7 - textpointer Text0eb8 ; 0x0eb8 - textpointer Text0eb9 ; 0x0eb9 - textpointer Text0eba ; 0x0eba - textpointer Text0ebb ; 0x0ebb - textpointer Text0ebc ; 0x0ebc - textpointer Text0ebd ; 0x0ebd - textpointer Text0ebe ; 0x0ebe - textpointer Text0ebf ; 0x0ebf - textpointer Text0ec0 ; 0x0ec0 - textpointer Text0ec1 ; 0x0ec1 - textpointer Text0ec2 ; 0x0ec2 - textpointer Text0ec3 ; 0x0ec3 - textpointer Text0ec4 ; 0x0ec4 - textpointer Text0ec5 ; 0x0ec5 - textpointer Text0ec6 ; 0x0ec6 - textpointer Text0ec7 ; 0x0ec7 - textpointer Text0ec8 ; 0x0ec8 - textpointer Text0ec9 ; 0x0ec9 - textpointer Text0eca ; 0x0eca - textpointer Text0ecb ; 0x0ecb - textpointer Text0ecc ; 0x0ecc - textpointer Text0ecd ; 0x0ecd - textpointer Text0ece ; 0x0ece - textpointer Text0ecf ; 0x0ecf - textpointer Text0ed0 ; 0x0ed0 - textpointer Text0ed1 ; 0x0ed1 - textpointer Text0ed2 ; 0x0ed2 - textpointer Text0ed3 ; 0x0ed3 - textpointer Text0ed4 ; 0x0ed4 - textpointer Text0ed5 ; 0x0ed5 - textpointer Text0ed6 ; 0x0ed6 - textpointer Text0ed7 ; 0x0ed7 - textpointer Text0ed8 ; 0x0ed8 - textpointer Text0ed9 ; 0x0ed9 - textpointer Text0eda ; 0x0eda - textpointer Text0edb ; 0x0edb - textpointer Text0edc ; 0x0edc - textpointer Text0edd ; 0x0edd - textpointer Text0ede ; 0x0ede - textpointer Text0edf ; 0x0edf - textpointer Text0ee0 ; 0x0ee0 - textpointer Text0ee1 ; 0x0ee1 - textpointer Text0ee2 ; 0x0ee2 - textpointer Text0ee3 ; 0x0ee3 - textpointer Text0ee4 ; 0x0ee4 - textpointer Text0ee5 ; 0x0ee5 - textpointer Text0ee6 ; 0x0ee6 - textpointer Text0ee7 ; 0x0ee7 - textpointer Text0ee8 ; 0x0ee8 - textpointer Text0ee9 ; 0x0ee9 - textpointer Text0eea ; 0x0eea - textpointer Text0eeb ; 0x0eeb + textpointer IshiharaUnderGRInvasionInitialText ; 0x0e97 + textpointer IshiharaUnderGRInvasionRepeatText ; 0x0e98 + textpointer IshiharaListenToNikkiText ; 0x0e99 + textpointer IshiharaHelpNikkiText ; 0x0e9a + textpointer IshiharaWantsToTrade1InitialText ; 0x0e9b + textpointer IshiharaWantsToTrade1RepeatText ; 0x0e9c + textpointer IshiharaDeclinedTradeText ; 0x0e9d + textpointer IshiharaDoNotOwnClefairyLv15Text ; 0x0e9e + textpointer IshiharaUsingAllClefairyLv15InDecksText ; 0x0e9f + textpointer IshiharaAcceptedTrade1Text ; 0x0ea0 + textpointer TradedClefairyForFlyingPikachuText ; 0x0ea1 + textpointer IshiharaThanksTradedClefairyLv15Text ; 0x0ea2 + textpointer IshiharaAtHomeTradeLaterReadMyBooksText ; 0x0ea3 + textpointer IshiharaWantsToTrade2InitialText ; 0x0ea4 + textpointer IshiharaWantsToTrade2RepeatText ; 0x0ea5 + textpointer IshiharaDoNotOwnClefableLv34Text ; 0x0ea6 + textpointer IshiharaUsingAllClefableLv34InDecksText ; 0x0ea7 + textpointer IshiharaAcceptedTrade2Text ; 0x0ea8 + textpointer TradedClefableLv34ForTogepiLv8Text ; 0x0ea9 + textpointer IshiharaThanksTradedClefableLv34Text ; 0x0eaa + textpointer IshiharaWantsToTrade3InitialText ; 0x0eab + textpointer IshiharaWantsToTrade3RepeatText ; 0x0eac + textpointer IshiharaDoNotOwnDragoniteLv45Text ; 0x0ead + textpointer IshiharaUsingAllDragoniteLv45InDecksText ; 0x0eae + textpointer IshiharaAcceptedTrade3Text ; 0x0eaf + textpointer TradedhDragoniteLv45ForMarillLv17Text ; 0x0eb0 + textpointer IshiharaThanksTradedDragoniteLv45Text ; 0x0eb1 + textpointer IshiharaHeadingForVillaText ; 0x0eb2 + textpointer IshiharaBusyRevisitVillaText ; 0x0eb3 + textpointer IshiharaDefeatedBiruritchiCongratsText ; 0x0eb4 + textpointer NikkiWantsToGiveAwayGiveInAntiGR2Deck1Text ; 0x0eb5 + textpointer NikkiWantsToGiveAwayGiveInAntiGR2Deck2Text ; 0x0eb6 + textpointer ReceivedGiveInAntiGR2DeckText ; 0x0eb7 + textpointer NikkiDecksFullGivesCardsInsteadText ; 0x0eb8 + textpointer ReceivedCardsForGiveInAntiGR2DeckText ; 0x0eb9 + textpointer NikkiToSendDeckConfigurationToMachineText ; 0x0eba + textpointer NikkiWantsToGiveOddishCoinText ; 0x0ebb + textpointer NikkiGaveOddishCoinText ; 0x0ebc + textpointer NikkiCountingOnYouInitialText ; 0x0ebd + textpointer NikkiCountingOnYouRepeatText ; 0x0ebe + textpointer IshiharaMyVillaText ; 0x0ebf + textpointer IshiharaVillaSeeYouLaterText ; 0x0ec0 + textpointer IshiharaWantsToTrade4InitialText ; 0x0ec1 + textpointer IshiharaWantsToTrade4RepeatText ; 0x0ec2 + textpointer IshiharaDoNotOwnMoltresLv37Text ; 0x0ec3 + textpointer IshiharaUsingAllMoltresLv37InDecksText ; 0x0ec4 + textpointer IshiharaAcceptedTrade4Text ; 0x0ec5 + textpointer TradedMoltresForSurfingPikachuText ; 0x0ec6 + textpointer IshiharaThanksTradedMoltresLv37Text ; 0x0ec7 + textpointer IshiharaWantsToTrade5InitialText ; 0x0ec8 + textpointer IshiharaWantsToTrade5RepeatText ; 0x0ec9 + textpointer IshiharaDoNotOwnArticunoLv34Text ; 0x0eca + textpointer IshiharaUsingAllArticunoLv34InDecksText ; 0x0ecb + textpointer IshiharaAcceptedTrade5Text ; 0x0ecc + textpointer TradedArticunoLv34ForSurfingPikachuText ; 0x0ecd + textpointer IshiharaThanksTradedArticunoLv34Text ; 0x0ece + textpointer IshiharaWantsToTrade6InitialText ; 0x0ecf + textpointer IshiharaWantsToTrade6RepeatText ; 0x0ed0 + textpointer IshiharaDoNotOwnZapdosLv40Text ; 0x0ed1 + textpointer IshiharaUsingAllZapdosLv40InDecksText ; 0x0ed2 + textpointer IshiharaAcceptedTrade6Text ; 0x0ed3 + textpointer TradedZapdosLv40ForFlyingPikachuText ; 0x0ed4 + textpointer IshiharaThanksTradedZapdosLv40Text ; 0x0ed5 + textpointer IshiharaWantsToTrade7InitialText ; 0x0ed6 + textpointer IshiharaWantsToTrade7RepeatText ; 0x0ed7 + textpointer IshiharaDoNotOwnDarkDragoniteText ; 0x0ed8 + textpointer IshiharaUsingAllDarkDragoniteInDecksText ; 0x0ed9 + textpointer IshiharaAcceptedTrade7Text ; 0x0eda + textpointer TradedDarkDragoniteForBillsComputerText ; 0x0edb + textpointer IshiharaThanksTradedDarkDragoniteTradesCompleteText ; 0x0edc + textpointer IshiharaAtVillaTradeLaterReadMyBooksText ; 0x0edd + textpointer RuiStudyingAtIshiharasVillaPostgameText ; 0x0ede + textpointer RuiThanksIshiharaText ; 0x0edf + textpointer IshiharaGladToHelpRuiText ; 0x0ee0 + textpointer RuiGoodbyeIshiharaText ; 0x0ee1 + textpointer IshiharaWantsToDuelInitialText ; 0x0ee2 + textpointer IshiharaWantsToDuelRepeatText ; 0x0ee3 + textpointer IshiharaDuelPromptText ; 0x0ee4 + textpointer IshiharaDuelStartText ; 0x0ee5 + textpointer IshiharaDeclinedDuelText ; 0x0ee6 + textpointer IshiharaPlayerWon1Text ; 0x0ee7 + textpointer IshiharaPlayerWon2Text ; 0x0ee8 + textpointer IshiharaPlayerLostText ; 0x0ee9 + textpointer RuiStudyingAtIshiharasVilla1Text ; 0x0eea + textpointer RuiStudyingAtIshiharasVilla2Text ; 0x0eeb textpointer ItsAutoDeckMachine1Text ; 0x0eec textpointer AutoDeckMachine1PromptText ; 0x0eed textpointer ItsAutoDeckMachine2Text ; 0x0eee diff --git a/tools/constants.py b/tools/constants.py index de0106c..28bb82b 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -903,7 +903,7 @@ events = [ "EVENT_F2", "EVENT_F3", "EVENT_ISHIHARA_CARD_TRADE_STATE", - "EVENT_F5", + "EVENT_ISHIHARA_LOCATION_STATE", ] framesets = [ @@ -2958,7 +2958,7 @@ tilemaps = [ vars = [ "VAR_00", "VAR_01", - "VAR_02", + "VAR_ISHIHARA_STATE", "VAR_03", "VAR_TIMES_MET_RONALD", "VAR_05", From 187c9025ff3396f52c449f0c4cefb0c5e1575fc2 Mon Sep 17 00:00:00 2001 From: earthoul Date: Fri, 16 Jan 2026 15:46:31 +0900 Subject: [PATCH 02/15] Label bookshelf scripts --- src/engine/bank0b.asm | 72 ++++++++++++++--------------- src/engine/bank0f.asm | 30 ++++++------- src/engine/bank10.asm | 102 +++++++++++++++++++++--------------------- 3 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index ddff112..fadf173 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -19,18 +19,18 @@ IshiharasHouse_NPCInteractions: db $ff IshiharasHouse_OWInteractions: - ow_script 3, 2, Func_40000 - ow_script 4, 2, Func_40016 - ow_script 5, 2, Func_4002c - ow_script 6, 2, Func_40042 - ow_script 7, 2, Func_40058 - ow_script 8, 2, Func_4006e - ow_script 1, 9, Func_40084 - ow_script 2, 9, Func_4009a - ow_script 3, 9, Func_400b0 - ow_script 6, 9, Func_400c6 - ow_script 7, 9, Func_400dc - ow_script 8, 9, Func_400f2 + ow_script 3, 2, Script_CombosBook + ow_script 4, 2, Script_EnergyTransBook + ow_script 5, 2, Script_ToxicGasBook + ow_script 6, 2, Script_RainDanceBook + ow_script 7, 2, Script_SelfdestructBook + ow_script 8, 2, Script_DamageSwapBook + ow_script 1, 9, Script_RemoveEnergiesBook + ow_script 2, 9, Script_PrehistoricPowerBook + ow_script 3, 9, Script_WeaknessResistanceBook + ow_script 6, 9, Script_TeamGRBook + ow_script 7, 9, Script_GameCenterBook + ow_script 8, 9, Script_SamePokemonBook db $ff IshiharasHouse_MapScripts: @@ -1501,9 +1501,9 @@ PsychicClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_402d6 - ow_script 13, 2, Func_402ec - ow_script 14, 2, Func_40302 + ow_script 12, 2, Script_PsychicPokemonBook + ow_script 13, 2, Script_PsychicPokemonPokemonPowerBook + ow_script 14, 2, Script_UsefulButtonsBook db $ff PsychicClubLobby_MapScripts: @@ -2655,9 +2655,9 @@ RockClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_40108 - ow_script 13, 2, Func_4011e - ow_script 14, 2, Func_40134 + ow_script 12, 2, Script_RockGroundPokemonBook + ow_script 13, 2, Script_FightingPokemonSurefireMethodBook + ow_script 14, 2, Script_FightingPokemonFormidableOpponentsBook db $ff RockClubLobby_MapScripts: @@ -3481,9 +3481,9 @@ FightingClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_4014a - ow_script 13, 2, Func_40160 - ow_script 14, 2, Func_40176 + ow_script 12, 2, Script_FightingPokemonBook + ow_script 13, 2, Script_FightingPokemonCombosBook + ow_script 14, 2, Script_FightingPokemonDeckBuildingBook db $ff FightingClubLobby_MapScripts: @@ -5140,9 +5140,9 @@ ScienceClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_401ce - ow_script 13, 2, Func_401e4 - ow_script 14, 2, Func_401fa + ow_script 12, 2, Script_SciencePokemonBook + ow_script 13, 2, Script_SciencePokemonSurefireMethodBook + ow_script 14, 2, Script_SciencePokemonDeckBuildingBook db $ff ScienceClubLobby_MapScripts: @@ -6142,9 +6142,9 @@ WaterClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_40210 - ow_script 13, 2, Func_40226 - ow_script 14, 2, Func_4023c + ow_script 12, 2, Script_WaterPokemonBook + ow_script 13, 2, Script_WaterPokemonAttacksBook + ow_script 14, 2, Script_PsyduckGolduckBook db $ff WaterClubLobby_MapScripts: @@ -7244,9 +7244,9 @@ FireClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_40252 - ow_script 13, 2, Func_40268 - ow_script 14, 2, Func_4027e + ow_script 12, 2, Script_FirePokemonBook + ow_script 13, 2, Script_FirePokemonAttacksBook + ow_script 14, 2, Script_FirePokemonDeckBuildingBook db $ff FireClubLobby_MapScripts: @@ -8128,12 +8128,12 @@ PokemonDomeEntrance_OWInteractions: ow_script 5, 2, PCMenu ow_script 9, 1, Func_2fe2a ow_script 10, 1, Func_2fe2a - ow_script 1, 2, Func_4035a - ow_script 2, 2, Func_40370 - ow_script 3, 2, Func_40386 - ow_script 1, 5, Func_4039c - ow_script 2, 5, Func_403b2 - ow_script 3, 5, Func_403c8 + ow_script 1, 2, Script_LegendaryPokemonCardsVol1Book + ow_script 2, 2, Script_LegendaryPokemonCardsVol2Book + ow_script 3, 2, Script_LegendaryPokemonCardsVol3Book + ow_script 1, 5, Script_LegendaryPokemonCardsVol4Book + ow_script 2, 5, Script_GrandMastersBook + ow_script 3, 5, Script_CoinsBook db $ff PokemonDomeEntrance_MapScripts: diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 8c3decc..2477f3c 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -1643,9 +1643,9 @@ LightningClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_40294 - ow_script 13, 2, Func_402aa - ow_script 14, 2, Func_402c0 + ow_script 12, 2, Script_LightningPokemonBook + ow_script 13, 2, Script_LightningPokemonDeckBuildingBook + ow_script 14, 2, Script_BirdPokemonBook db $ff LightningClubLobby_MapScripts: @@ -1950,9 +1950,9 @@ GrassClubLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_4018c - ow_script 13, 2, Func_401a2 - ow_script 14, 2, Func_401b8 + ow_script 12, 2, Script_PlantlikePokemonBook + ow_script 13, 2, Script_GrassPokemonBreederBook + ow_script 14, 2, Script_GrassPokemonDeckBuildingBook db $ff GrassClubLobby_MapScripts: @@ -2451,9 +2451,9 @@ TcgChallengeHallLobby_OWInteractions: ow_script 9, 2, PCMenu ow_script 2, 4, Func_3c1b9 ow_script 4, 4, Func_3c2d9 - ow_script 12, 2, Func_40318 - ow_script 13, 2, Func_4032e - ow_script 14, 2, Func_40344 + ow_script 12, 2, Script_ColorlessPokemonBook + ow_script 13, 2, Script_CardPopBook + ow_script 14, 2, Script_EnergyCardColorsBook db $ff TcgChallengeHallLobby_MapScripts: @@ -5297,12 +5297,12 @@ IshiharasVillaLibrary_NPCInteractions: db $ff IshiharasVillaLibrary_OWInteractions: - ow_script 1, 2, Func_403de - ow_script 2, 2, Func_403f4 - ow_script 3, 2, Func_4040a - ow_script 6, 2, Func_40420 - ow_script 7, 2, Func_40436 - ow_script 8, 2, Func_4044c + ow_script 1, 2, Script_PhantomCardsBook + ow_script 2, 2, Script_DarkPokemonBook + ow_script 3, 2, Script_AugmentBasicPokemonBook + ow_script 6, 2, Script_GRKingCardsBook + ow_script 7, 2, Script_SpecialEnergyBook + ow_script 8, 2, Script_GetCoinsBook db $ff IshiharasVillaLibrary_MapScripts: diff --git a/src/engine/bank10.asm b/src/engine/bank10.asm index dd16ba9..480c1cb 100644 --- a/src/engine/bank10.asm +++ b/src/engine/bank10.asm @@ -1,4 +1,4 @@ -Func_40000: +Script_CombosBook: ldtx hl, CombosBookName ld a, l ld [wScriptNPCName], a @@ -12,7 +12,7 @@ Func_40000: end_script ret -Func_40016: +Script_EnergyTransBook: ldtx hl, EnergyTransBookName ld a, l ld [wScriptNPCName], a @@ -26,7 +26,7 @@ Func_40016: end_script ret -Func_4002c: +Script_ToxicGasBook: ldtx hl, ToxicGasBookName ld a, l ld [wScriptNPCName], a @@ -40,7 +40,7 @@ Func_4002c: end_script ret -Func_40042: +Script_RainDanceBook: ldtx hl, RainDanceBookName ld a, l ld [wScriptNPCName], a @@ -54,7 +54,7 @@ Func_40042: end_script ret -Func_40058: +Script_SelfdestructBook: ldtx hl, SelfdestructBookName ld a, l ld [wScriptNPCName], a @@ -68,7 +68,7 @@ Func_40058: end_script ret -Func_4006e: +Script_DamageSwapBook: ldtx hl, DamageSwapBookName ld a, l ld [wScriptNPCName], a @@ -82,7 +82,7 @@ Func_4006e: end_script ret -Func_40084: +Script_RemoveEnergiesBook: ldtx hl, RemoveEnergiesBookName ld a, l ld [wScriptNPCName], a @@ -96,7 +96,7 @@ Func_40084: end_script ret -Func_4009a: +Script_PrehistoricPowerBook: ldtx hl, PrehistoricPowerBookName ld a, l ld [wScriptNPCName], a @@ -110,7 +110,7 @@ Func_4009a: end_script ret -Func_400b0: +Script_WeaknessResistanceBook: ldtx hl, WeaknessResistanceBookName ld a, l ld [wScriptNPCName], a @@ -124,7 +124,7 @@ Func_400b0: end_script ret -Func_400c6: +Script_TeamGRBook: ldtx hl, TeamGRBookName ld a, l ld [wScriptNPCName], a @@ -138,7 +138,7 @@ Func_400c6: end_script ret -Func_400dc: +Script_GameCenterBook: ldtx hl, GameCenterBookName ld a, l ld [wScriptNPCName], a @@ -152,7 +152,7 @@ Func_400dc: end_script ret -Func_400f2: +Script_SamePokemonBook: ldtx hl, SamePokemonBookName ld a, l ld [wScriptNPCName], a @@ -166,7 +166,7 @@ Func_400f2: end_script ret -Func_40108: +Script_RockGroundPokemonBook: ldtx hl, RockGroundPokemonBookName ld a, l ld [wScriptNPCName], a @@ -180,7 +180,7 @@ Func_40108: end_script ret -Func_4011e: +Script_FightingPokemonSurefireMethodBook: ldtx hl, FightingPokemonSurefireMethodBookName ld a, l ld [wScriptNPCName], a @@ -194,7 +194,7 @@ Func_4011e: end_script ret -Func_40134: +Script_FightingPokemonFormidableOpponentsBook: ldtx hl, FightingPokemonFormidableOpponentsBookName ld a, l ld [wScriptNPCName], a @@ -208,7 +208,7 @@ Func_40134: end_script ret -Func_4014a: +Script_FightingPokemonBook: ldtx hl, FightingPokemonBookName ld a, l ld [wScriptNPCName], a @@ -222,7 +222,7 @@ Func_4014a: end_script ret -Func_40160: +Script_FightingPokemonCombosBook: ldtx hl, FightingPokemonCombosBookName ld a, l ld [wScriptNPCName], a @@ -236,7 +236,7 @@ Func_40160: end_script ret -Func_40176: +Script_FightingPokemonDeckBuildingBook: ldtx hl, FightingPokemonDeckBuildingBookName ld a, l ld [wScriptNPCName], a @@ -250,7 +250,7 @@ Func_40176: end_script ret -Func_4018c: +Script_PlantlikePokemonBook: ldtx hl, PlantlikePokemonBookName ld a, l ld [wScriptNPCName], a @@ -264,7 +264,7 @@ Func_4018c: end_script ret -Func_401a2: +Script_GrassPokemonBreederBook: ldtx hl, GrassPokemonBreederBookName ld a, l ld [wScriptNPCName], a @@ -278,7 +278,7 @@ Func_401a2: end_script ret -Func_401b8: +Script_GrassPokemonDeckBuildingBook: ldtx hl, GrassPokemonDeckBuildingBookName ld a, l ld [wScriptNPCName], a @@ -292,7 +292,7 @@ Func_401b8: end_script ret -Func_401ce: +Script_SciencePokemonBook: ldtx hl, SciencePokemonBookName ld a, l ld [wScriptNPCName], a @@ -306,7 +306,7 @@ Func_401ce: end_script ret -Func_401e4: +Script_SciencePokemonSurefireMethodBook: ldtx hl, SciencePokemonSurefireMethodBookName ld a, l ld [wScriptNPCName], a @@ -320,7 +320,7 @@ Func_401e4: end_script ret -Func_401fa: +Script_SciencePokemonDeckBuildingBook: ldtx hl, SciencePokemonDeckBuildingBookName ld a, l ld [wScriptNPCName], a @@ -334,7 +334,7 @@ Func_401fa: end_script ret -Func_40210: +Script_WaterPokemonBook: ldtx hl, WaterPokemonBookName ld a, l ld [wScriptNPCName], a @@ -348,7 +348,7 @@ Func_40210: end_script ret -Func_40226: +Script_WaterPokemonAttacksBook: ldtx hl, WaterPokemonAttacksBookName ld a, l ld [wScriptNPCName], a @@ -362,7 +362,7 @@ Func_40226: end_script ret -Func_4023c: +Script_PsyduckGolduckBook: ldtx hl, PsyduckGolduckBookName ld a, l ld [wScriptNPCName], a @@ -376,7 +376,7 @@ Func_4023c: end_script ret -Func_40252: +Script_FirePokemonBook: ldtx hl, FirePokemonBookName ld a, l ld [wScriptNPCName], a @@ -390,7 +390,7 @@ Func_40252: end_script ret -Func_40268: +Script_FirePokemonAttacksBook: ldtx hl, FirePokemonAttacksBookName ld a, l ld [wScriptNPCName], a @@ -404,7 +404,7 @@ Func_40268: end_script ret -Func_4027e: +Script_FirePokemonDeckBuildingBook: ldtx hl, FirePokemonDeckBuildingBookName ld a, l ld [wScriptNPCName], a @@ -418,7 +418,7 @@ Func_4027e: end_script ret -Func_40294: +Script_LightningPokemonBook: ldtx hl, LightningPokemonBookName ld a, l ld [wScriptNPCName], a @@ -432,7 +432,7 @@ Func_40294: end_script ret -Func_402aa: +Script_LightningPokemonDeckBuildingBook: ldtx hl, LightningPokemonDeckBuildingBookName ld a, l ld [wScriptNPCName], a @@ -446,7 +446,7 @@ Func_402aa: end_script ret -Func_402c0: +Script_BirdPokemonBook: ldtx hl, BirdPokemonBookName ld a, l ld [wScriptNPCName], a @@ -460,7 +460,7 @@ Func_402c0: end_script ret -Func_402d6: +Script_PsychicPokemonBook: ldtx hl, PsychicPokemonBookName ld a, l ld [wScriptNPCName], a @@ -474,7 +474,7 @@ Func_402d6: end_script ret -Func_402ec: +Script_PsychicPokemonPokemonPowerBook: ldtx hl, PsychicPokemonPokemonPowerBookName ld a, l ld [wScriptNPCName], a @@ -488,7 +488,7 @@ Func_402ec: end_script ret -Func_40302: +Script_UsefulButtonsBook: ldtx hl, UsefulButtonsBookName ld a, l ld [wScriptNPCName], a @@ -502,7 +502,7 @@ Func_40302: end_script ret -Func_40318: +Script_ColorlessPokemonBook: ldtx hl, ColorlessPokemonBookName ld a, l ld [wScriptNPCName], a @@ -516,7 +516,7 @@ Func_40318: end_script ret -Func_4032e: +Script_CardPopBook: ldtx hl, CardPopBookName ld a, l ld [wScriptNPCName], a @@ -530,7 +530,7 @@ Func_4032e: end_script ret -Func_40344: +Script_EnergyCardColorsBook: ldtx hl, EnergyCardColorsBookName ld a, l ld [wScriptNPCName], a @@ -544,7 +544,7 @@ Func_40344: end_script ret -Func_4035a: +Script_LegendaryPokemonCardsVol1Book: ldtx hl, LegendaryPokemonCardsVol1BookName ld a, l ld [wScriptNPCName], a @@ -558,7 +558,7 @@ Func_4035a: end_script ret -Func_40370: +Script_LegendaryPokemonCardsVol2Book: ldtx hl, LegendaryPokemonCardsVol2BookName ld a, l ld [wScriptNPCName], a @@ -572,7 +572,7 @@ Func_40370: end_script ret -Func_40386: +Script_LegendaryPokemonCardsVol3Book: ldtx hl, LegendaryPokemonCardsVol3BookName ld a, l ld [wScriptNPCName], a @@ -586,7 +586,7 @@ Func_40386: end_script ret -Func_4039c: +Script_LegendaryPokemonCardsVol4Book: ldtx hl, LegendaryPokemonCardsVol4BookName ld a, l ld [wScriptNPCName], a @@ -600,7 +600,7 @@ Func_4039c: end_script ret -Func_403b2: +Script_GrandMastersBook: ldtx hl, GrandMastersBookName ld a, l ld [wScriptNPCName], a @@ -614,7 +614,7 @@ Func_403b2: end_script ret -Func_403c8: +Script_CoinsBook: ldtx hl, CoinsBookName ld a, l ld [wScriptNPCName], a @@ -628,7 +628,7 @@ Func_403c8: end_script ret -Func_403de: +Script_PhantomCardsBook: ldtx hl, PhantomCardsBookName ld a, l ld [wScriptNPCName], a @@ -642,7 +642,7 @@ Func_403de: end_script ret -Func_403f4: +Script_DarkPokemonBook: ldtx hl, DarkPokemonBookName ld a, l ld [wScriptNPCName], a @@ -656,7 +656,7 @@ Func_403f4: end_script ret -Func_4040a: +Script_AugmentBasicPokemonBook: ldtx hl, AugmentBasicPokemonBookName ld a, l ld [wScriptNPCName], a @@ -670,7 +670,7 @@ Func_4040a: end_script ret -Func_40420: +Script_GRKingCardsBook: ldtx hl, GRKingCardsBookName ld a, l ld [wScriptNPCName], a @@ -684,7 +684,7 @@ Func_40420: end_script ret -Func_40436: +Script_SpecialEnergyBook: ldtx hl, SpecialEnergyBookName ld a, l ld [wScriptNPCName], a @@ -698,7 +698,7 @@ Func_40436: end_script ret -Func_4044c: +Script_GetCoinsBook: ldtx hl, GetCoinsBookName ld a, l ld [wScriptNPCName], a From bb1c28c355cb53e25bf921d4e62cfcc8aab7ac6c Mon Sep 17 00:00:00 2001 From: earthoul Date: Fri, 16 Jan 2026 16:06:41 +0900 Subject: [PATCH 03/15] Label lobby clerk scripts --- src/engine/bank07.asm | 26 +++++++++++++------------- src/engine/bank0b.asm | 24 ++++++++++++------------ src/engine/bank0c.asm | 12 ++++++------ src/engine/bank0d.asm | 8 ++++---- src/engine/bank0f.asm | 38 ++++++++++++++++++++------------------ 5 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 87c4852..d057d23 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -3555,21 +3555,21 @@ _PlayLinkDuelAndGetResult: pop bc ret -Func_1d9be: +HandleGiftCenter: push af push bc push de push hl farcall HideNPCAnimsUnderDialogBox - call Func_1d9ff + call GiftCenter_PrintWelcome call Func_1da45 - jr c, .asm_1d9ed + jr c, .exit ld a, [wdc06] cp $04 - jr z, .asm_1d9ed - call Func_1da1f - call Func_1da2a - jr c, .asm_1d9ed + jr z, .exit + call GiftCenter_PrintSelectedService + call GiftCenter_SaveRequest + jr c, .exit call PauseSong_SaveState push af ld a, MUSIC_CARD_POP @@ -3577,8 +3577,8 @@ Func_1d9be: pop af call Func_1dac1 call ResumeSong_ClearTemp -.asm_1d9ed - call Func_1da14 +.exit + call GiftCenter_PrintComeAgain farcall ShowNPCAnimsUnderDialogBox pop hl pop de @@ -3591,7 +3591,7 @@ Func_1d9f9: ld [wdc06], a ret -Func_1d9ff: +GiftCenter_PrintWelcome: ldtx hl, GiftCenterWelcomeText ldtx de, ReceptionistText farcall PrintScrollableText_WithTextBoxLabelVRAM0 @@ -3600,19 +3600,19 @@ Func_1d9ff: farcall PrintScrollableText_WithTextBoxLabelVRAM0 ret -Func_1da14: +GiftCenter_PrintComeAgain: ldtx hl, GiftCenterComeAgainText ldtx de, ReceptionistText farcall PrintScrollableText_WithTextBoxLabelVRAM0 ret -Func_1da1f: +GiftCenter_PrintSelectedService: ldtx hl, GiftCenterServiceAcknowledgementText ldtx de, ReceptionistText farcall PrintScrollableText_WithTextBoxLabelVRAM0 ret -Func_1da2a: +GiftCenter_SaveRequest: ldtx hl, GiftCenterServiceSaveRequestText ldtx de, ReceptionistText farcall PrintScrollableText_WithTextBoxLabelVRAM0 diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index fadf173..c9976a6 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -1499,8 +1499,8 @@ PsychicClubLobby_NPCInteractions: PsychicClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_PsychicPokemonBook ow_script 13, 2, Script_PsychicPokemonPokemonPowerBook ow_script 14, 2, Script_UsefulButtonsBook @@ -2653,8 +2653,8 @@ RockClubLobby_NPCInteractions: RockClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_RockGroundPokemonBook ow_script 13, 2, Script_FightingPokemonSurefireMethodBook ow_script 14, 2, Script_FightingPokemonFormidableOpponentsBook @@ -3479,8 +3479,8 @@ FightingClubLobby_NPCInteractions: FightingClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_FightingPokemonBook ow_script 13, 2, Script_FightingPokemonCombosBook ow_script 14, 2, Script_FightingPokemonDeckBuildingBook @@ -5138,8 +5138,8 @@ ScienceClubLobby_NPCInteractions: ScienceClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_SciencePokemonBook ow_script 13, 2, Script_SciencePokemonSurefireMethodBook ow_script 14, 2, Script_SciencePokemonDeckBuildingBook @@ -6140,8 +6140,8 @@ WaterClubLobby_NPCInteractions: WaterClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_WaterPokemonBook ow_script 13, 2, Script_WaterPokemonAttacksBook ow_script 14, 2, Script_PsyduckGolduckBook @@ -7242,8 +7242,8 @@ FireClubLobby_NPCInteractions: FireClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_FirePokemonBook ow_script 13, 2, Script_FirePokemonAttacksBook ow_script 14, 2, Script_FirePokemonDeckBuildingBook diff --git a/src/engine/bank0c.asm b/src/engine/bank0c.asm index 8617c6a..e8cbfdc 100644 --- a/src/engine/bank0c.asm +++ b/src/engine/bank0c.asm @@ -1505,8 +1505,8 @@ GrassFortLobby_NPCInteractions: GrassFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff GrassFortLobby_MapScripts: @@ -2547,8 +2547,8 @@ LightningFortLobby_NPCInteractions: LightningFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff LightningFortLobby_MapScripts: @@ -3685,8 +3685,8 @@ FireFortLobby_NPCInteractions: FireFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff FireFortLobby_MapScripts: diff --git a/src/engine/bank0d.asm b/src/engine/bank0d.asm index dfbbd42..c9e7631 100644 --- a/src/engine/bank0d.asm +++ b/src/engine/bank0d.asm @@ -2416,8 +2416,8 @@ GrChallengeHallLobby_NPCInteractions: GrChallengeHallLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff GrChallengeHallLobby_MapScripts: @@ -4372,8 +4372,8 @@ PsychicStrongholdLobby_NPCInteractions: PsychicStrongholdLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff PsychicStrongholdLobby_MapScripts: diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 2477f3c..86d25c6 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -200,7 +200,7 @@ Prologue:: jr c, .loop_wait_2 ret -Func_3c1b9: +Script_TCGBattleCenterClerk: ld a, NPC_CLERK_BATTLE_CENTER ld [wScriptNPC], a ldtx hl, DialogReceptionistText @@ -210,9 +210,9 @@ Func_3c1b9: ld [wScriptNPCName + 1], a ld a, MUSIC_DUEL_THEME_CLUB_MEMBER ld [wDuelTheme], a - jr Func_3c1d0.asm_3c1e5 + jr Script_BattleCenter -Func_3c1d0: +Script_GRBattleCenterClerk: ld a, NPC_GR_CLERK_BATTLE_CENTER ld [wScriptNPC], a ldtx hl, DialogReceptionistText @@ -222,7 +222,9 @@ Func_3c1d0: ld [wScriptNPCName + 1], a ld a, MUSIC_DUEL_THEME_GR_MEMBER ld [wDuelTheme], a -.asm_3c1e5 +; fallthrough + +Script_BattleCenter: xor a start_script start_dialog @@ -338,15 +340,15 @@ Func_3c1d0: .ows_3c2d8 script_ret -Func_3c2d9: +GiftCenter: ld a, EVENT_F2 farcall ZeroOutEventValue - farcall Func_1d9be + farcall HandleGiftCenter ld a, EVENT_F2 farcall GetEventValue - jr z, .asm_3c2ef + jr z, .done farcall PlayCurrentSong -.asm_3c2ef +.done ret Script_3c2f0: @@ -1641,8 +1643,8 @@ LightningClubLobby_NPCInteractions: LightningClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_LightningPokemonBook ow_script 13, 2, Script_LightningPokemonDeckBuildingBook ow_script 14, 2, Script_BirdPokemonBook @@ -1948,8 +1950,8 @@ GrassClubLobby_NPCInteractions: GrassClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_PlantlikePokemonBook ow_script 13, 2, Script_GrassPokemonBreederBook ow_script 14, 2, Script_GrassPokemonDeckBuildingBook @@ -2449,8 +2451,8 @@ TcgChallengeHallLobby_NPCInteractions: TcgChallengeHallLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu - ow_script 2, 4, Func_3c1b9 - ow_script 4, 4, Func_3c2d9 + ow_script 2, 4, Script_TCGBattleCenterClerk + ow_script 4, 4, GiftCenter ow_script 12, 2, Script_ColorlessPokemonBook ow_script 13, 2, Script_CardPopBook ow_script 14, 2, Script_EnergyCardColorsBook @@ -6067,8 +6069,8 @@ GameCenterLobby_NPCInteractions: GameCenterLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff GameCenterLobby_MapScripts: @@ -6948,8 +6950,8 @@ WaterFortLobby_NPCInteractions: WaterFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu - ow_script 5, 4, Func_3c1d0 - ow_script 8, 4, Func_3c2d9 + ow_script 5, 4, Script_GRBattleCenterClerk + ow_script 8, 4, GiftCenter db $ff WaterFortLobby_MapScripts: From dc87f66d451e49794c22fac7155c9786e4c30a36 Mon Sep 17 00:00:00 2001 From: earthoul Date: Tue, 20 Jan 2026 14:44:47 +0900 Subject: [PATCH 04/15] Disassemble and refactor Gift Center handlers and deck-building UI Mostly thanks to TCG1 --- src/constants/card_data_constants.asm | 3 + src/constants/menu_constants.asm | 8 + src/data/save.asm | 2 +- src/engine/bank02.asm | 570 ++++++++++++++++++++++---- src/engine/bank04.asm | 4 +- src/engine/bank07.asm | 135 ++++-- src/engine/bank0b.asm | 12 +- src/engine/bank0c.asm | 6 +- src/engine/bank0d.asm | 4 +- src/engine/bank0f.asm | 14 +- src/macros/menu.asm | 13 + src/text/text2.asm | 6 +- src/text/text_offsets.asm | 4 +- src/wram.asm | 9 +- 14 files changed, 653 insertions(+), 137 deletions(-) diff --git a/src/constants/card_data_constants.asm b/src/constants/card_data_constants.asm index e85028a..beba938 100644 --- a/src/constants/card_data_constants.asm +++ b/src/constants/card_data_constants.asm @@ -330,3 +330,6 @@ DEF DECKCHECKSTRUCT_ENERGY_SURPLUS RB NUM_TYPES ; $15 DEF DECKCHECKSTRUCT_RAINBOW_ENERGY RB ; $1d DEF DECKCHECKSTRUCT_LENGTH EQU _RS ; $1e + +; sending cards +DEF MAX_NUM_CARDS_TO_SEND EQU 60 diff --git a/src/constants/menu_constants.asm b/src/constants/menu_constants.asm index 2f2fbeb..80165d7 100644 --- a/src/constants/menu_constants.asm +++ b/src/constants/menu_constants.asm @@ -69,6 +69,14 @@ const MAILBOXMENU_READ ; 0 const MAILBOXMENU_DELETE ; 1 +; gift center menu options + const_def + const GIFTCENTERMENU_SEND_CARDS ; 0 + const GIFTCENTERMENU_RECEIVE_CARDS ; 1 + const GIFTCENTERMENU_SEND_DECK_CONFIGURATION ; 2 + const GIFTCENTERMENU_RECEIVE_DECK_CONFIGURATION ; 3 + const GIFTCENTERMENU_QUIT ; 4 + ; constants for wGlossaryMenu const_def const GLOSSARY_GAME_BASICS ; 0 diff --git a/src/data/save.asm b/src/data/save.asm index b86aea6..f07eeff 100644 --- a/src/data/save.asm +++ b/src/data/save.asm @@ -47,7 +47,7 @@ WRAMToSRAMMapper_GeneralSave:: wram_sram_map wCoinPage, 1, $00, $ff wram_sram_map wPauseMenuCursorPosition, 1, $00, $ff wram_sram_map wMinicomMenuCursorPosition, 1, $00, $ff - wram_sram_map wdc06, 1, $00, $ff + wram_sram_map wGiftCenterMenuCursorPosition, 1, $00, $ff wram_sram_map wNumMailInQueue, 1, $00, $ff wram_sram_map wMailQueue, MAIL_QUEUE_BUFFER_SIZE, $00, $ff wram_sram_map wMailCount, 1, $00, $ff diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 0f4d731..a99bbba 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -1119,16 +1119,11 @@ PrepareMenuGraphics: call SetupText ret -; inits the following deck building params from hl: -; wMaxNumCardsAllowed -; wd381 -; wSameNameCardsLimit -; wIncludeCardsInDeck -; wDeckConfigurationMenuHandlerFunction -; wDeckConfigurationMenuTransitionTable +; hl = deckbuilding_params source +; inits the 6 params of wDeckBuildingParams from hl InitDeckBuildingParams: - ld de, wMaxNumCardsAllowed - ld b, 8 + ld de, wDeckBuildingParams + ld b, wDeckBuildingParamsEnd - wDeckBuildingParams .loop ld a, [hli] ld [de], a @@ -1138,12 +1133,9 @@ InitDeckBuildingParams: ret DeckBuildingParams: - db DECK_CONFIG_BUFFER_SIZE - db DECK_SIZE - db MAX_NUM_SAME_NAME_CARDS - db TRUE ; whether to include deck cards - dw HandleDeckConfigurationMenu - dw DeckConfigurationMenu_TransitionTable + deckbuilding_params DECK_CONFIG_BUFFER_SIZE, DECK_SIZE, \ + MAX_NUM_SAME_NAME_CARDS, TRUE, \ + HandleDeckConfigurationMenu, DeckConfigurationMenu_TransitionTable DeckSelectionMenu: ld hl, DeckBuildingParams @@ -1218,7 +1210,7 @@ OpenDeckConfirmationMenu: call ClearNBytesFromHL ld a, DECK_SIZE ld [wTotalCardCount], a - ld [wd381], a + ld [wNumValidDeckSize], a ld hl, wCardFilterCounts ld [hl], a call HandleDeckConfirmationMenu @@ -1736,9 +1728,55 @@ _DecrementDeckCardsInCollection: DecrementDeckCardsInCollection: push hl jr _DecrementDeckCardsInCollection -; 0x9360 -SECTION "Bank 2@5397", ROMX[$5397], BANK[$2] +; like AddDeckToCollection, but takes care to +; check if increasing the collection count would +; go over MAX_AMOUNT_OF_CARD and caps it +; this is because it's used within Gift Center, +; so we cannot assume that the deck configuration +; won't make it go over MAX_AMOUNT_OF_CARD +; hl = deck configuration, with cards to add +AddGiftCenterDeckCardsToCollection: + push hl + ld b, MAX_NUM_CARDS_TO_SEND +.loop_receive + ld e, [hl] + inc hl + ld d, [hl] + call CheckIfCardIDIsZero + jr c, .done + inc hl + push hl + push de + push bc + ld a, ALL_DECKS + call CreateCardCollectionListWithDeckCards + pop bc + pop de + ld hl, wTempCardCollection + add hl, de + ld a, [hl] + cp MAX_AMOUNT_OF_CARD + jr z, .next_card ; capped + ld hl, sCardCollection + add hl, de + call EnableSRAM + ld a, [hl] + cp CARD_NOT_OWNED + jr nz, .incr +; not owned yet + xor a + ld [hl], a +.incr + inc [hl] + call DisableSRAM +.next_card + pop hl + dec b + jr nz, .loop_receive +.done + pop hl + ret ; adds all cards in deck in hl to player's collection ; Enables SRAM (contrary to this function in poketcg1) @@ -2166,7 +2204,7 @@ HandleDeckBuildScreen: jr z, .wait_input xor a .wait_list_input - ld hl, $5a3a + ld hl, FilteredCardListSelectionParams call InitializeScrollMenuParameters ld a, [wNumEntriesInCurFilter] ld [wNumCardListEntries], a @@ -2215,16 +2253,16 @@ HandleDeckBuildScreen: ld [hCurMenuItem], a ld a, MENU_CANCEL call PlaySFXConfirmOrCancel - jr .asm_96f3 + jr .selection_made .asm_96a0 call HandleSelectUpAndDownInList jr c, .loop_input call HandleScrollListInput - jr c, .asm_96f3 + jr c, .selection_made jr .loop_input -.asm_96ac +.open_card_page ld a, MENU_CONFIRM call PlaySFXConfirmOrCancel ld a, [wNumMenuItems] @@ -2245,7 +2283,7 @@ HandleDeckBuildScreen: ld [wTempCardTypeFilter], a call DrawHorizontalListCursor_Visible call PrintDeckBuildingCardList - ld hl, $5a3a + ld hl, FilteredCardListSelectionParams call InitializeScrollMenuParameters ld a, [wTempScrollMenuNumVisibleItems] ld [wNumMenuItems], a @@ -2253,13 +2291,13 @@ HandleDeckBuildScreen: ld [wTempCardTypeFilter], a jp .loop_input -.asm_96f3 +.selection_made call DrawListCursor_Invisible ld a, [wTempCardTypeFilter] ld [wTempCurMenuItem], a ld a, [hCurMenuItem] cp $ff - jr nz, .asm_96ac + jr nz, .open_card_page ld hl, FiltersCardSelectionParams call InitializeScrollMenuParameters ld a, [wCurCardTypeFilter] @@ -2718,7 +2756,8 @@ CheckIfThereAreAnyBasicCardsInDeck: FiltersCardSelectionParams: scrollmenu_params 1, 1, 0, 2, NUM_FILTERS, SYM_CURSOR_D, SYM_SPACE, NULL -SECTION "Bank 2@5a43", ROMX[$5a43], BANK[$2] +FilteredCardListSelectionParams: + scrollmenu_params 0, 7, 2, 0, NUM_FILTERED_LIST_VISIBLE_CARDS, SYM_CURSOR_R, SYM_SPACE, NULL DeckConfigurationMenu_TransitionTable: cursor_transition $10, $20, $00, $03, $03, $01, $02 @@ -2860,7 +2899,7 @@ PrintSlashSixty: ld [hli], a ld a, SYM_SLASH ld [hli], a - ld a, [wd381] + ld a, [wNumValidDeckSize] call ConvertToNumericalDigits ld [hl], TX_END call InitTextPrinting @@ -4870,10 +4909,123 @@ GetCardTypeIconPalette: db ICON_TILE_STAGE_2_POKEMON, 2 db ICON_TILE_TRAINER, 3 db $00, $ff -; 0xa603 -SECTION "Bank 2@66ef", ROMX[$66ef], BANK[$2] +; uses deck builder ui +HandleGiftCenterSendCardsScreen: + ld hl, wCurDeckCards + ld a, $81 + call ClearNBytesFromHL + ld a, $ff + ld [wCurDeck], a + ld hl, .title_text + ld de, wCurDeckName + call CopyListFromHLToDE + ld hl, .params + call InitDeckBuildingParams + ld a, $01 + ld [wd121], a + call HandleDeckBuildScreen + ret +; too verbose +.title_text + hiragana "あ" + hiragana "げ" + hiragana "る" + katakana "カ" + katakana "ー" + katakana "ド" + hiragana "い" + hiragana "ち" + hiragana "ら" + hiragana "ん" + done + +.params + deckbuilding_params MAX_NUM_CARDS_TO_SEND, MAX_NUM_CARDS_TO_SEND, \ + MAX_NUM_CARDS_TO_SEND, FALSE, \ + HandleGiftCenterSendCardsMenu, SendCards_TransitionTable + +SendCards_TransitionTable: + cursor_transition $10, $20, $00, $00, $00, $01, $02 + cursor_transition $48, $20, $00, $01, $01, $02, $00 + cursor_transition $80, $20, $00, $02, $02, $00, $01 + +SendCards_MenuData: + textitem 2, 2, DeckBuildingConfirmText + textitem 9, 2, SendText + textitem 16, 2, CancelDeckText + textitems_end + +HandleGiftCenterSendCardsMenu: + ld de, 0 + lb bc, 20, 6 + call DrawRegularTextBox + ld hl, SendCards_MenuData + call PlaceTextItems + ld a, $ff + ld [wd0c4], a +.loop_input + ld a, TRUE + ld [wVBlankOAMCopyToggle], a + call DoFrame + call HandleMultiDirectionalMenu + jr nc, .loop_input + ld [wd11d], a + cp $ff + jr nz, .confirm + call DrawCardTypeIconsAndPrintCardCounts + ld a, [wTempCurMenuItem] + ld [wTempCardTypeFilter], a + ld a, [wCurCardTypeFilter] + call PrintFilteredCardList + jp HandleDeckBuildScreen.skip_draw +.confirm + ld hl, .function_table + call JumpToFunctionInTable + jp OpenDeckConfigurationMenu.skip_init + +.function_table + dw ConfirmDeckConfiguration + dw .Send + dw .Cancel + +.Send: + ld a, [wCurDeckCards] + or a + jr nz, .skip_high + ld a, [wCurDeckCards + 1] + or a + jr z, .Cancel +.skip_high + xor a + ld [wScrollMenuScrollOffset], a + ld hl, GiftCenter_CardSelectionParams + call InitializeScrollMenuParameters + ld hl, wCurDeckCards + ld de, wTempSavedDeckCards + ld b, $82 + call CopyBBytesFromHLToDE_Bank02 + call PrintCardsToSendToPlayerText + call Func_b81d + call EnableLCD + ldtx hl, SendTheseCardsToPlayerPromptText + call YesOrNoMenuWithText + jr nc, .done + add sp, $02 + jp HandleDeckBuildScreen.skip_count + +.done + add sp, $02 + scf + ret + +.Cancel: + add sp, $02 + or a + ret + +; black box Func_a6ef: xor a ld [wScrollMenuScrollOffset], a @@ -4881,11 +5033,11 @@ Func_a6ef: ld de, wTempSavedDeckCards ld b, $82 call CopyBBytesFromHLToDE_Bank02 - call Func_b90c + call EmptyScreenAndDrawTextBox call Func_b81d ret -Func_a705: +HandleBlackBoxSendCardsScreen: ld hl, wCurDeckCards ld a, $81 call ClearNBytesFromHL @@ -4893,15 +5045,60 @@ Func_a705: ld [wCurDeck], a ld hl, wCurDeckName ld [hl], TX_END - ld hl, $6726 + ld hl, .params call InitDeckBuildingParams ld a, $01 ld [wd121], a call HandleDeckBuildScreen ret -; 0xa726 -SECTION "Bank 2@677f", ROMX[$677f], BANK[$2] +.params + deckbuilding_params MAX_NUM_BLACK_BOX_INPUT, MAX_NUM_BLACK_BOX_INPUT, \ + MAX_NUM_BLACK_BOX_INPUT, FALSE, \ + HandleBlackBoxSendCardsMenu, SendCards_TransitionTable + +HandleBlackBoxSendCardsMenu: + ld de, 0 + lb bc, 20, 6 + call DrawRegularTextBox + ld hl, SendCards_MenuData + call PlaceTextItems + ld a, $ff + ld [wd0c4], a +.loop_input + ld a, TRUE + ld [wVBlankOAMCopyToggle], a + call DoFrame + call HandleMultiDirectionalMenu + jr nc, .loop_input + ld [wd11d], a + cp $ff + jr nz, .confirm + call DrawCardTypeIconsAndPrintCardCounts + ld a, [wTempCurMenuItem] + ld [wTempCardTypeFilter], a + ld a, [wCurCardTypeFilter] + call PrintFilteredCardList + jp HandleDeckBuildScreen.skip_draw +.confirm + ld hl, .function_table + call JumpToFunctionInTable + jp OpenDeckConfigurationMenu.skip_init + +.function_table: + dw ConfirmDeckConfiguration + dw .Done + dw .Cancel + +.Done + add sp, $02 + or a + ret + +.Cancel + add sp, $02 + scf + ret CopyBBytesFromHLToDE_Bank02: .loop @@ -4912,7 +5109,7 @@ CopyBBytesFromHLToDE_Bank02: jr nz, .loop ret -Func_a786: +HandlePlayersCardsScreen: call WriteCardListsTerminatorBytes call PrintPlayersCardsHeaderInfo xor a @@ -4923,41 +5120,46 @@ Func_a786: xor a ld hl, FiltersCardSelectionParams call InitializeScrollMenuParameters -.asm_a7a0 +.wait_input call DoFrame ld a, [wCurCardTypeFilter] ld b, a ld a, [wTempCardTypeFilter] cp b - jr z, .asm_a7ca + jr z, .check_d_down ld [wCurCardTypeFilter], a ld hl, wScrollMenuScrollOffset ld [hl], $00 call PrintFilteredCardSelectionList + ld hl, hffbb ld [hl], $01 call PrintPlayersCardsText ld hl, hffbb ld [hl], $00 - ld a, $09 + + ld a, NUM_FILTERS ld [wNumMenuItems], a -.asm_a7ca +.check_d_down ldh a, [hDPadHeld] and PAD_DOWN - jr z, .asm_a7d5 + jr z, .no_d_down call ConfirmSelectionAndReturnCarry - jr .asm_a7e2 -.asm_a7d5 + jr .jump_to_list + +.no_d_down call HandleCardSelectionInput - jr nc, .asm_a7a0 + jr nc, .wait_input ld a, [hCurMenuItem] - cp $ff - jr nz, .asm_a7e2 + cp $ff ; cancelled + jr nz, .jump_to_list ret -.asm_a7e2 + +.jump_to_list ld a, [wNumEntriesInCurFilter] or a - jr z, .asm_a7a0 + jr z, .wait_input + xor a ld hl, GeneralCardListMenuParams call InitializeScrollMenuParameters @@ -4965,9 +5167,9 @@ Func_a786: ld [wNumCardListEntries], a ld hl, wNumVisibleCardListEntries cp [hl] - jr nc, .asm_a7fe + jr nc, .got_length ld [wNumMenuItems], a -.asm_a7fe +.got_length ld hl, GeneralCardListUpdateFunc ld d, h ld a, l @@ -4976,7 +5178,8 @@ Func_a786: ld [hl], d xor a ld [wd119], a -.asm_a80c + +.loop_input call DoFrame ldh a, [hDPadHeld] and PAD_UP @@ -4987,22 +5190,27 @@ Func_a786: jr nz, .asm_a825 ld a, $ff ld [hCurMenuItem], a - jr .asm_a87e + jr .selection_made + .asm_a825 call HandleSelectUpAndDownInList - jr c, .asm_a80c + jr c, .loop_input call HandleScrollListInput - jr c, .asm_a87e + jr c, .selection_made ldh a, [hDPadHeld] and PAD_START - jr z, .asm_a80c -.asm_a835 + jr z, .loop_input + +; pressed start +.open_card_page ld a, MENU_CONFIRM call PlaySFXConfirmOrCancel ld a, [wNumMenuItems] ld [wTempScrollMenuNumVisibleItems], a ld a, [wTempCardTypeFilter] ld [wTempCurMenuItem], a + +; show screen ld de, wTempCardList ld hl, wCurCardListPtr ld [hl], e @@ -5010,6 +5218,7 @@ Func_a786: ld [hl], d call OpenCardPageFromCardList call PrintPlayersCardsHeaderInfo + ld hl, FiltersCardSelectionParams call InitializeScrollMenuParameters ld a, [wCurCardTypeFilter] @@ -5023,19 +5232,20 @@ Func_a786: ld [wNumMenuItems], a ld a, [wTempCurMenuItem] ld [wTempCardTypeFilter], a - jr .asm_a80c -.asm_a87e + jr .loop_input + +.selection_made call DrawListCursor_Invisible ld a, [wTempCardTypeFilter] ld [wTempCurMenuItem], a ld a, [hCurMenuItem] cp $ff - jr nz, .asm_a835 + jr nz, .open_card_page ld hl, FiltersCardSelectionParams call InitializeScrollMenuParameters ld a, [wCurCardTypeFilter] ld [wTempCardTypeFilter], a - jp .asm_a7a0 + jp .wait_input GeneralCardListMenuParams: scrollmenu_params 1, 5, 2, 0, 7, SYM_CURSOR_R, SYM_SPACE, NULL @@ -7030,15 +7240,15 @@ Func_b663: ld a, [wCurDeckName] or a ret z - ld de, $1 + lb de, 0, 1 call InitTextPrinting ld a, [wCurDeck] inc a ld hl, wDefaultText call ConvertToNumericalDigits - ld [hl], $77 + ldfw [hl], "・" inc hl - ld [hl], $00 + ld [hl], TX_END ld hl, wDefaultText call ProcessText ld hl, wCurDeckName @@ -7058,16 +7268,182 @@ Func_b663: call InitTextPrinting call ProcessText ret -; 0xb6ad -SECTION "Bank 2@781d", ROMX[$781d], BANK[$2] +GiftCenter_SendCards: + xor a + ld [wTileMapFill], a + call ZeroObjectPositions + call EmptyScreen + ld a, TRUE + ld [wVBlankOAMCopyToggle], a + call LoadSymbolsFont + bank1call SetDefaultPalettes + + lb de, $3c, $bf + call SetupText + lb de, 3, 1 + call InitTextPrinting + ldtx hl, ProcedureForSendingCardsToPlayerTitleText + call ProcessTextFromID + lb de, 1, 3 + call InitTextPrinting + ldtx hl, ProcedureForSendingCardsToPlayerText + ld a, SINGLE_SPACED + ld [wLineSeparation], a + call ProcessTextFromID + xor a ; DOUBLE_SPACED + ld [wLineSeparation], a + ldtx hl, ReadProcedureForSendingCardsToPlayerText + call DrawWideTextBox_WaitForInput + + call EnableLCD + call HandleGiftCenterSendCardsScreen + jr c, .asm_b6fb + ld a, $01 + or a + ret + +.asm_b6fb + ld de, wCurDeckCards + ld hl, wDuelTempList + bank1call SaveDeckCards + xor a + ld [wNameBuffer], a + farcall 6, $5b1c ; Func_19b1c, SendCards + ret c + + call EnableSRAM + ld hl, wCurDeckCards + call DecrementDeckCardsInCollection + call DisableSRAM + call SaveGame + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ret + +; never reached + scf + ret + +GiftCenter_ReceiveCards: + xor a + ld [wDuelTempList], a + ld [wNameBuffer], a + farcall 6, $5b63 ; Func_19b63, ReceiveCards + ret c + + ld de, wDuelTempList + ld hl, wTempSavedDeckCards + call CopyDeckFromSRAM + ld hl, wTempSavedDeckCards + call AddGiftCenterDeckCardsToCollection + call SaveGame + xor a + ld [wScrollMenuScrollOffset], a + ld hl, GiftCenter_CardSelectionParams + call InitializeScrollMenuParameters + call PrintReceivedTheseCardsText + call Func_b81d + call EnableLCD + ld a, [wNumEntriesInCurFilter] + ld [wNumCardListEntries], a + ld hl, wNumVisibleCardListEntries + cp [hl] + jr nc, .got_length_1 + ld [wNumMenuItems], a +.got_length_1 + ld hl, ShowReceivedCardsList + ld d, h + ld a, l + ld hl, wScrollMenuScrollFunc + ld [hli], a + ld [hl], d + + xor a + ld [wd119], a +.loop_input + call DoFrame + call HandleScrollListInput + jr c, .selection_made + call HandleJumpListInput + jr c, .loop_input + ldh a, [hDPadHeld] + and PAD_START + jr z, .loop_input + +.open_card_page + ld a, MENU_CONFIRM + call PlaySFXConfirmOrCancel + ld a, [wTempCardTypeFilter] + ld [wTempCurMenuItem], a + + ld de, wTempCardList + ld hl, wCurCardListPtr + ld [hl], e + inc hl + ld [hl], d + call OpenCardPageFromCardList + call PrintReceivedTheseCardsText + + call PrintCardSelectionList + call EnableLCD + ld hl, GiftCenter_CardSelectionParams + call InitializeScrollMenuParameters + ld a, [wNumEntriesInCurFilter] + ld hl, wNumVisibleCardListEntries + cp [hl] + jr nc, .got_length_2 + ld [wNumMenuItems], a +.got_length_2 + ld a, [wTempCurMenuItem] + ld [wTempCardTypeFilter], a + jr .loop_input + +.selection_made + call DrawListCursor_Invisible + ld a, [wTempCardTypeFilter] + ld [wTempCurMenuItem], a + ld a, [hCurMenuItem] + cp $ff + jr nz, .open_card_page + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + or a + ret + +GiftCenter_CardSelectionParams: + scrollmenu_params 1, 3, 2, 0, 5, SYM_CURSOR_R, SYM_SPACE, NULL + +ShowReceivedCardsList: + ld hl, hffbb + ld [hl], $01 + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardsReceivedText + call ProcessTextFromID + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ld [wTxRam2], a + ld [wTxRam2 + 1], a + lb de, 1, 14 + call InitTextPrinting + ldtx hl, ReceivedTheseCardsFromText + call PrintTextNoDelay + ld hl, hffbb + ld [hl], $00 + jp PrintCardSelectionList Func_b81d: - xor a - ld hl, wc000 + xor a ; aka $100 bytes + ld hl, wTempCardCollection call ClearNBytesFromHL - xor a - ld hl, $c100 + xor a ; aka $100 bytes + ld hl, wTempCardCollection + $100 call ClearNBytesFromHL ld hl, wTempSavedDeckCards call Func_b84d @@ -7183,19 +7559,67 @@ Func_b860: pop bc pop af ret -; 0xb8d6 -SECTION "Bank 2@790c", ROMX[$790c], BANK[$2] +PrintCardsToSendToPlayerText: + call EmptyScreenAndDrawTextBox + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardsToSendToPlayerText + call ProcessTextFromID + ret -Func_b90c: +PrintReceivedTheseCardsText: + call EmptyScreenAndDrawTextBox + lb de, 1, 1 + call InitTextPrinting + ldtx hl, CardsReceivedText + call ProcessTextFromID + ld hl, wNameBuffer + ld de, wDefaultText + call CopyListFromHLToDE + xor a + ld [wTxRam2], a + ld [wTxRam2 + 1], a + ldtx hl, ReceivedTheseCardsFromText + call DrawWideTextBox_PrintText + ret + +EmptyScreenAndDrawTextBox: call PrepareMenuGraphics lb de, 0, 0 lb bc, 20, 13 call DrawRegularTextBox ret -; 0xb919 -SECTION "Bank 2@7947", ROMX[$7947], BANK[$2] +HandleGiftCenter:: + ld a, [wSelectedGiftCenterMenuItem] + ld hl, .function_table + call JumpToFunctionInTable + jr c, .quit + or a + jr nz, .quit + xor a + ld [wTxRam2], a + ld [wTxRam2 + 1], a + ret +.quit + ld a, $ff + ld [wSelectedGiftCenterMenuItem], a + ret + +.function_table + dw GiftCenter_SendCards + dw GiftCenter_ReceiveCards + dw .SendDeckConfiguration + dw .ReceiveDeckConfiguration + +.SendDeckConfiguration: + farcall $e, $7d5c ; Func_3bd5c + ret + +.ReceiveDeckConfiguration: + farcall $e, $7dd0 ; Func_3bdd0 + ret ; hl = text ID for text box DeckDiagnosisResult: diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 010614d..8bb7587 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -3146,7 +3146,7 @@ _PCMenu: call Func_10252 ret -Func_111f0: +SetPCMenuCursorToShutdown: ld a, PCMENU_SHUTDOWN ld [wPCMenuCursorPosition], a ret @@ -6666,7 +6666,7 @@ Func_13357: call SetFrameFuncAndFadeFromWhite call SetFadePalsFrameFunc .asm_13360 - farcall Func_a705 + farcall HandleBlackBoxSendCardsScreen jr nc, .asm_13373 ldtx hl, GameCenterBlackBoxCancelPromptText ld a, $01 diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index d057d23..34c3045 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -2964,7 +2964,7 @@ ReadOrInitSaveData: farcall ClearGameCenterChips call InitializeMailboxWRAM call Func_1d7a1 - call Func_1d9f9 + call SetGiftCenterMenuCursorToQuit call Func_1dcb7 ; this is unnecessary since Card Pop list @@ -2973,7 +2973,7 @@ ReadOrInitSaveData: call EnableAnimations call ClearwMinicomMenuCursorPosition - farcall Func_111f0 + farcall SetPCMenuCursorToShutdown call InitDefaultConfigMenuSettings call SaveConfigMenuChoicesToSRAM call LoadSavedOptions @@ -3555,17 +3555,17 @@ _PlayLinkDuelAndGetResult: pop bc ret -HandleGiftCenter: +GiftCenter: push af push bc push de push hl farcall HideNPCAnimsUnderDialogBox call GiftCenter_PrintWelcome - call Func_1da45 + call GiftCenter_HandleMenu jr c, .exit - ld a, [wdc06] - cp $04 + ld a, [wGiftCenterMenuCursorPosition] + cp GIFTCENTERMENU_QUIT jr z, .exit call GiftCenter_PrintSelectedService call GiftCenter_SaveRequest @@ -3575,7 +3575,7 @@ HandleGiftCenter: ld a, MUSIC_CARD_POP call SetMusic pop af - call Func_1dac1 + call GiftCenter_ExecuteSelectedOption call ResumeSong_ClearTemp .exit call GiftCenter_PrintComeAgain @@ -3586,9 +3586,9 @@ HandleGiftCenter: pop af ret -Func_1d9f9: - ld a, $04 - ld [wdc06], a +SetGiftCenterMenuCursorToQuit: + ld a, GIFTCENTERMENU_QUIT + ld [wGiftCenterMenuCursorPosition], a ret GiftCenter_PrintWelcome: @@ -3624,68 +3624,131 @@ GiftCenter_SaveRequest: farcall PrintScrollableText_WithTextBoxLabelVRAM0 ret -Func_1da45: - call Func_1da4f - call Func_1da88 - call Func_1dabd +GiftCenter_HandleMenu: + call .ShowMenu + call .HandleInput + call .RestoreNPCs ret -Func_1da4f: - ld de, $400 - ld b, $07 - ld hl, $5a64 +.ShowMenu: + lb de, 4, 0 + ld b, BANK(.menu_params) + ld hl, .menu_params call LoadMenuBoxParams - ld a, [wdc06] + ld a, [wGiftCenterMenuCursorPosition] call HideNPCAnimsUnderMenuBox call DrawMenuBox ret -; 0x1da64 -SECTION "Bank 7@5a88", ROMX[$5a88], BANK[$7] +.menu_params + menubox_params TRUE, 16, 12, \ + SYM_CURSOR_R, SYM_SPACE, SYM_CURSOR_R, SYM_CURSOR_R, \ + PAD_A, PAD_B, FALSE, 1, NULL, NULL + textitem 2, 2, GiftCenterSendCardsText + textitem 2, 4, GiftCenterReceiveCardsText + textitem 2, 6, GiftCenterSendDeckConfigurationText + textitem 2, 8, GiftCenterReceiveDeckConfigurationText + textitem 2, 10, GiftCenterQuitText + textitems_end -Func_1da88: - ld a, [wdc06] +.HandleInput: + ld a, [wGiftCenterMenuCursorPosition] call HandleMenuBox - ld [wdc06], a + ld [wGiftCenterMenuCursorPosition], a push af add a ld c, a ld b, $00 - ld hl, $5ab5 + ld hl, .text_table add hl, bc ld a, [hli] ld [wTxRam2], a ld a, [hl] ld [wTxRam2 + 1], a pop af - jr c, .asm_1daad + jr c, .quit push af ld a, SFX_CONFIRM call CallPlaySFX pop af ret -.asm_1daad +.quit push af ld a, SFX_CANCEL call CallPlaySFX pop af ret -; 0x1dab5 -SECTION "Bank 7@5abd", ROMX[$5abd], BANK[$7] +.text_table + tx GiftCenterSendCardsText + tx GiftCenterReceiveCardsText + tx GiftCenterSendDeckConfigurationText + tx GiftCenterReceiveDeckConfigurationText -Func_1dabd: +.RestoreNPCs: call ShowNPCAnimsUnderMenuBox ret -Func_1dac1: - ld a, [wdc06] - ld hl, $5acb +GiftCenter_ExecuteSelectedOption: + ld a, [wGiftCenterMenuCursorPosition] + ld hl, .function_map call CallMappedFunction ret -; 0x1dacb -SECTION "Bank 7@5b63", ROMX[$5b63], BANK[$7] +.function_map + key_func GIFTCENTERMENU_SEND_CARDS, .SendCards + key_func GIFTCENTERMENU_RECEIVE_CARDS, .ReceiveCards + key_func GIFTCENTERMENU_SEND_DECK_CONFIGURATION, .SendDeckConfiguration + key_func GIFTCENTERMENU_RECEIVE_DECK_CONFIGURATION, .ReceiveDeckConfiguration + db $ff ; end + +.SendCards: + farcall Func_1022a + farcall SetFrameFuncAndFadeFromWhite + farcall UnsetSpriteAnimationAndFadePalsFrameFunc + xor a ; GIFTCENTERMENU_SEND_CARDS + ld [wSelectedGiftCenterMenuItem], a + farcall HandleGiftCenter + farcall SetSpriteAnimationAndFadePalsFrameFunc + farcall FadeToWhiteAndUnsetFrameFunc + farcall Func_10252 + ret + +.ReceiveCards: + farcall Func_1022a + farcall SetFrameFuncAndFadeFromWhite + farcall UnsetSpriteAnimationAndFadePalsFrameFunc + ld a, GIFTCENTERMENU_RECEIVE_CARDS + ld [wSelectedGiftCenterMenuItem], a + farcall HandleGiftCenter + farcall SetSpriteAnimationAndFadePalsFrameFunc + farcall FadeToWhiteAndUnsetFrameFunc + farcall Func_10252 + ret + +.SendDeckConfiguration: + farcall Func_1022a + farcall SetFrameFuncAndFadeFromWhite + farcall UnsetSpriteAnimationAndFadePalsFrameFunc + ld a, GIFTCENTERMENU_SEND_DECK_CONFIGURATION + ld [wSelectedGiftCenterMenuItem], a + farcall HandleGiftCenter + farcall SetSpriteAnimationAndFadePalsFrameFunc + farcall FadeToWhiteAndUnsetFrameFunc + farcall Func_10252 + ret + +.ReceiveDeckConfiguration: + farcall Func_1022a + farcall SetFrameFuncAndFadeFromWhite + farcall UnsetSpriteAnimationAndFadePalsFrameFunc + ld a, GIFTCENTERMENU_RECEIVE_DECK_CONFIGURATION + ld [wSelectedGiftCenterMenuItem], a + farcall HandleGiftCenter + farcall SetSpriteAnimationAndFadePalsFrameFunc + farcall FadeToWhiteAndUnsetFrameFunc + farcall Func_10252 + ret GiveCoin: farcall Func_1022a @@ -5617,7 +5680,7 @@ MinicomDeckSaveMachine: MinicomCardAlbum: farcall ClearSpriteAnimsAndSetInitialGraphicsConfiguration - farcall Func_a786 + farcall HandlePlayersCardsScreen ret Func_1e849: diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index c9976a6..6d9b047 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -1500,7 +1500,7 @@ PsychicClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_PsychicPokemonBook ow_script 13, 2, Script_PsychicPokemonPokemonPowerBook ow_script 14, 2, Script_UsefulButtonsBook @@ -2654,7 +2654,7 @@ RockClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_RockGroundPokemonBook ow_script 13, 2, Script_FightingPokemonSurefireMethodBook ow_script 14, 2, Script_FightingPokemonFormidableOpponentsBook @@ -3480,7 +3480,7 @@ FightingClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_FightingPokemonBook ow_script 13, 2, Script_FightingPokemonCombosBook ow_script 14, 2, Script_FightingPokemonDeckBuildingBook @@ -5139,7 +5139,7 @@ ScienceClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_SciencePokemonBook ow_script 13, 2, Script_SciencePokemonSurefireMethodBook ow_script 14, 2, Script_SciencePokemonDeckBuildingBook @@ -6141,7 +6141,7 @@ WaterClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_WaterPokemonBook ow_script 13, 2, Script_WaterPokemonAttacksBook ow_script 14, 2, Script_PsyduckGolduckBook @@ -7243,7 +7243,7 @@ FireClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_FirePokemonBook ow_script 13, 2, Script_FirePokemonAttacksBook ow_script 14, 2, Script_FirePokemonDeckBuildingBook diff --git a/src/engine/bank0c.asm b/src/engine/bank0c.asm index e8cbfdc..70a0c92 100644 --- a/src/engine/bank0c.asm +++ b/src/engine/bank0c.asm @@ -1506,7 +1506,7 @@ GrassFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff GrassFortLobby_MapScripts: @@ -2548,7 +2548,7 @@ LightningFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff LightningFortLobby_MapScripts: @@ -3686,7 +3686,7 @@ FireFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff FireFortLobby_MapScripts: diff --git a/src/engine/bank0d.asm b/src/engine/bank0d.asm index c9e7631..2da97f1 100644 --- a/src/engine/bank0d.asm +++ b/src/engine/bank0d.asm @@ -2417,7 +2417,7 @@ GrChallengeHallLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff GrChallengeHallLobby_MapScripts: @@ -4373,7 +4373,7 @@ PsychicStrongholdLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff PsychicStrongholdLobby_MapScripts: diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 86d25c6..65792f5 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -340,10 +340,10 @@ Script_BattleCenter: .ows_3c2d8 script_ret -GiftCenter: +Script_GiftCenter: ld a, EVENT_F2 farcall ZeroOutEventValue - farcall HandleGiftCenter + farcall GiftCenter ld a, EVENT_F2 farcall GetEventValue jr z, .done @@ -1644,7 +1644,7 @@ LightningClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_LightningPokemonBook ow_script 13, 2, Script_LightningPokemonDeckBuildingBook ow_script 14, 2, Script_BirdPokemonBook @@ -1951,7 +1951,7 @@ GrassClubLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_PlantlikePokemonBook ow_script 13, 2, Script_GrassPokemonBreederBook ow_script 14, 2, Script_GrassPokemonDeckBuildingBook @@ -2452,7 +2452,7 @@ TcgChallengeHallLobby_OWInteractions: ow_script 8, 2, PCMenu ow_script 9, 2, PCMenu ow_script 2, 4, Script_TCGBattleCenterClerk - ow_script 4, 4, GiftCenter + ow_script 4, 4, Script_GiftCenter ow_script 12, 2, Script_ColorlessPokemonBook ow_script 13, 2, Script_CardPopBook ow_script 14, 2, Script_EnergyCardColorsBook @@ -6070,7 +6070,7 @@ GameCenterLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff GameCenterLobby_MapScripts: @@ -6951,7 +6951,7 @@ WaterFortLobby_OWInteractions: ow_script 1, 2, PCMenu ow_script 2, 2, PCMenu ow_script 5, 4, Script_GRBattleCenterClerk - ow_script 8, 4, GiftCenter + ow_script 8, 4, Script_GiftCenter db $ff WaterFortLobby_MapScripts: diff --git a/src/macros/menu.asm b/src/macros/menu.asm index 9028789..d085565 100644 --- a/src/macros/menu.asm +++ b/src/macros/menu.asm @@ -71,3 +71,16 @@ MACRO? cardlist_params db \1, \2, \3, \4, \5, \6, \7 dw \8 ENDM + +/* + \1 ; wMaxNumCardsAllowed + \2 ; wNumValidDeckSize + \3 ; wSameNameCardsLimit + \4 ; wIncludeCardsInDeck (boolean) + \5 ; wDeckConfigurationMenuHandlerFunction + \6 ; wDeckConfigurationMenuTransitionTable +*/ +MACRO? deckbuilding_params + db \1, \2, \3, \4 + dw \5, \6 +ENDM diff --git a/src/text/text2.asm b/src/text/text2.asm index 4d78b57..af9e819 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -2191,16 +2191,16 @@ ReadProcedureForSendingCardsToPlayerText: linefw "かくにんしてください" done +; used both for sending cards to another player and to in-game machines SendText: - ; used both for sending cards to another player and to in-game machines textfw "おくる" done -CardReceivedText: +CardsReceivedText: textfw "もらったカード" done -CardToSendToPlayerText: +CardsToSendToPlayerText: textfw "あげるカード" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index c79867d..07136ea 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -773,8 +773,8 @@ TextOffsets:: textpointer ProcedureForSendingCardsToPlayerText ; 0x02ff textpointer ReadProcedureForSendingCardsToPlayerText ; 0x0300 textpointer SendText ; 0x0301 - textpointer CardReceivedText ; 0x0302 - textpointer CardToSendToPlayerText ; 0x0303 + textpointer CardsReceivedText ; 0x0302 + textpointer CardsToSendToPlayerText ; 0x0303 textpointer SendTheseCardsToPlayerPromptText ; 0x0304 textpointer ReceivedTheseCardsFromText ; 0x0305 textpointer ChooseDeckConfigurationToSendText ; 0x0306 diff --git a/src/wram.asm b/src/wram.asm index fc0f254..d5efa09 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -2056,12 +2056,14 @@ wTempSavedDeckCards:: ; d2fe ds $a +wDeckBuildingParams:: ; d380 + ; max number of cards that are allowed ; to include when building a deck configuration wMaxNumCardsAllowed:: ; d380 ds $1 -wd381:: ; d381 +wNumValidDeckSize:: ; d381 ds $1 ; max number of cards with same name that are allowed @@ -2087,6 +2089,8 @@ wDeckConfigurationMenuHandlerFunction:: ; d384 wDeckConfigurationMenuTransitionTable:: ; d386 ds $2 +wDeckBuildingParamsEnd:: + wCurCardListPtr:: ; d388 ds $1 @@ -3131,9 +3135,10 @@ wdb86:: ; db86 wdbc6:: ; dbc6 ds $40 -wdc06:: ; dc06 +wGiftCenterMenuCursorPosition:: ; dc06 ds $1 +wSelectedGiftCenterMenuItem:: ; dc07 ds $1 wSelectedCoin:: ; dc08 From 02ad683b388dea3641511225c4e72736d49227cc Mon Sep 17 00:00:00 2001 From: earthoul Date: Wed, 21 Jan 2026 17:18:26 +0900 Subject: [PATCH 05/15] Disassemble the rest of IR functions with refactorings Mostly thanks to TCG1 --- src/constants/misc_constants.asm | 22 +- src/engine/bank02.asm | 8 +- src/engine/bank06.asm | 369 ++++++++++++++++++++++++------- src/home/double_speed.asm | 2 +- src/wram.asm | 5 +- 5 files changed, 316 insertions(+), 90 deletions(-) diff --git a/src/constants/misc_constants.asm b/src/constants/misc_constants.asm index a0c82cd..4c0778a 100644 --- a/src/constants/misc_constants.asm +++ b/src/constants/misc_constants.asm @@ -26,14 +26,6 @@ DEF MAX_NUM_CARDPOP_RECORDS EQU 98 DEF CARDPOP_RECORD_SIZE EQU $20 DEF CARDPOP_RECORD_STATS_SIZE EQU $05 -; rJOYP constants to read IR signals -DEF P15 EQU %00100000 -DEF P14 EQU %00010000 -DEF P13 EQU %00001000 -DEF P12 EQU %00000100 -DEF P11 EQU %00000010 -DEF P10 EQU %00000001 - ; commands transmitted through IR to be ; executed by the other device ; (see ExecuteReceivedIRCommands) @@ -53,6 +45,20 @@ DEF NUM_IR_COMMANDS EQU const_value const IRPARAM_SEND_DECK ; $3 const IRPARAM_RARE_CARD_POP ; $4 +; IR magic strings +DEF IR_MAGIC_STRING_TCG2 EQUS "PK2" +DEF IR_ACK_MAGIC_STRING_TCG2 EQUS "OK2" +DEF IR_MAGIC_STRING_SIZE EQU 3 + +DEF IR_PARAMS_STRUCT_SIZE EQU 4 + +; IR handshake byte +DEF IR_HANDSHAKE_REQUEST_TCG2 EQU $a5 +DEF IR_HANDSHAKE_ACKNOWLEDGE_TCG2 EQU $35 +; cf.) +; DEF IR_HANDSHAKE_REQUEST_TCG1 EQU $aa +; DEF IR_HANDSHAKE_ACKNOWLEDGE_TCG1 EQU $33 + ; serial transfer DEF SERIAL_OP_DATA_END EQU $ac DEF SERIAL_OP_DATA_ESCAPE EQU $ca diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index a99bbba..cac0b11 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -7298,18 +7298,18 @@ GiftCenter_SendCards: call EnableLCD call HandleGiftCenterSendCardsScreen - jr c, .asm_b6fb + jr c, .send ld a, $01 or a ret -.asm_b6fb +.send ld de, wCurDeckCards ld hl, wDuelTempList bank1call SaveDeckCards xor a ld [wNameBuffer], a - farcall 6, $5b1c ; Func_19b1c, SendCards + farcall _SendCard ret c call EnableSRAM @@ -7331,7 +7331,7 @@ GiftCenter_ReceiveCards: xor a ld [wDuelTempList], a ld [wNameBuffer], a - farcall 6, $5b63 ; Func_19b63, ReceiveCards + farcall _ReceiveCard ret c ld de, wDuelTempList diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 388bbd6..383385a 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -2341,7 +2341,7 @@ TransmitByteThroughIR: pop de pop hl ldh a, [rJOYP] - bit 1, a ; P11 + bit B_JOYP_B, a jr z, ReturnZFlagUnsetAndCarryFlagSet xor a ; return z set ret @@ -2354,7 +2354,7 @@ ReceiveByteThroughIR_ZeroIfUnsuccessful: xor a ret - ; returns carry if there's some time out +; returns carry if there's some time out ; and output in register a of $ff ; otherwise returns in a some sequence of bits ; related to how rRP sets/unsets bit 1 @@ -2372,8 +2372,8 @@ ReceiveByteThroughIR: jr z, .ok dec b jr nz, .wait_ir - ; looped around $100 times - ; return $ff and carry set +; looped around $100 times +; return $ff and carry set pop hl pop bc pop de @@ -2392,27 +2392,25 @@ ReceiveByteThroughIR: ld e, 8 .loop ld a, $01 - ; possibly delay cycles? - ld b, 9 - ld b, 9 - ld b, 9 +REPT 4 ; possibly delay cycles? ld b, 9 +ENDR ; checks for bit 1 in rRP ; if in any of the checks it is unset, ; then a is set to 0 ; this is done a total of 9 times bit B_RP_DATA_IN, [hl] - jr nz, .asm_196ec + jr nz, .loop_check xor a -.asm_196ec +.loop_check bit B_RP_DATA_IN, [hl] - jr nz, .asm_196f1 + jr nz, .next xor a -.asm_196f1 +.next dec b - jr nz, .asm_196ec - ; one bit received + jr nz, .loop_check +; one bit received rrca rr d dec e @@ -2431,33 +2429,33 @@ ReturnZFlagUnsetAndCarryFlagSet: ret ; called when expecting to transmit data -Func_196e8: +IRHandshake_Initiate: ld hl, rRP .loop ldh a, [rJOYP] - bit 1, a + bit B_JOYP_B, a jr z, ReturnZFlagUnsetAndCarryFlagSet - ld a, $a5 ; request + ld a, IR_HANDSHAKE_REQUEST_TCG2 call TransmitByteThroughIR push hl pop hl call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp $35 ; acknowledge + cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 jr nz, .loop xor a ret ; called when expecting to receive data -Func_1971e: +IRHandshake_Listen: ld hl, rRP -.asm_19721 +.loop ldh a, [rJOYP] - bit 1, a + bit B_JOYP_B, a jr z, ReturnZFlagUnsetAndCarryFlagSet call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp $a5 ; request - jr nz, .asm_19721 - ld a, $35 ; acknowledge + cp IR_HANDSHAKE_REQUEST_TCG2 + jr nz, .loop + ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 call TransmitByteThroughIR xor a ret @@ -2466,7 +2464,7 @@ ReturnZFlagUnsetAndCarryFlagSet2: jp ReturnZFlagUnsetAndCarryFlagSet TransmitIRDataBuffer: - call Func_196e8 + call IRHandshake_Initiate jr c, ReturnZFlagUnsetAndCarryFlagSet2 ld a, $49 call TransmitByteThroughIR @@ -2477,7 +2475,7 @@ TransmitIRDataBuffer: jr TransmitNBytesFromHLThroughIR ReceiveIRDataBuffer: - call Func_1971e + call IRHandshake_Listen jr c, ReturnZFlagUnsetAndCarryFlagSet2 call ReceiveByteThroughIR cp $49 @@ -2492,21 +2490,21 @@ ReceiveIRDataBuffer: ; hl = start of data to transmit ; c = number of bytes to transmit TransmitNBytesFromHLThroughIR: - ld b, $0 + ld b, 0 .loop_data_bytes ld a, b add [hl] ld b, a ld a, [hli] call TransmitByteThroughIR - jr c, .asm_1977c + jr c, .done dec c jr nz, .loop_data_bytes ld a, b cpl inc a call TransmitByteThroughIR -.asm_1977c +.done ret ; hl = address to write received data @@ -2532,7 +2530,7 @@ ReceiveNBytesToHLThroughIR: StartIRCommunications: di call SwitchToCGBNormalSpeed - ld a, P14 + ld a, JOYP_GET_BUTTONS ldh [rJOYP], a ld a, RP_ENABLE ldh [rRP], a @@ -2540,7 +2538,7 @@ StartIRCommunications: ; reenables interrupts, and switches CGB back to double speed CloseIRCommunications: - ld a, P14 | P15 + ld a, JOYP_GET_NONE ldh [rJOYP], a .wait_vblank_on ldh a, [rSTAT] @@ -2558,7 +2556,7 @@ CloseIRCommunications: ; set rRP to 0 ClearRP: - ld a, $00 + ld a, 0 ldh [rRP], a ret @@ -2622,7 +2620,7 @@ ExecuteReceivedIRCommands: ; receives an address and number of bytes ; and transmits starting at that address .TransmitData - call Func_196e8 + call IRHandshake_Initiate ret c call LoadRegistersFromIRDataBuffer jp TransmitNBytesFromHLThroughIR @@ -2634,10 +2632,10 @@ ExecuteReceivedIRCommands: ld l, e ld h, d call ReceiveNBytesToHLThroughIR - jr c, .asm_19812 + jr c, .received sub b call TransmitByteThroughIR -.asm_19812 +.received ret ; receives an address to call, then stores @@ -2654,14 +2652,14 @@ TrySendIRRequest: ld hl, rRP ld c, 4 .send_request - ld a, $a5 ; request + ld a, IR_HANDSHAKE_REQUEST_TCG2 push bc call TransmitByteThroughIR push bc pop bc call ReceiveByteThroughIR_ZeroIfUnsuccessful pop bc - cp $35 ; acknowledgement + cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 jr z, .received_ack dec c jr nz, .send_request @@ -2682,17 +2680,17 @@ TryReceiveIRRequest: ld hl, rRP .wait_request call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp $a5 ; request + cp IR_HANDSHAKE_REQUEST_TCG2 jr z, .send_ack ldh a, [rJOYP] cpl - and P10 | P11 + and JOYP_A | JOYP_B jr z, .wait_request scf jr .close .send_ack - ld a, $35 ; acknowledgement + ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 call TransmitByteThroughIR xor a .close @@ -2726,7 +2724,7 @@ RequestDataTransmissionThroughIR: call TransmitRegistersThroughIR push de push bc - call Func_1971e + call IRHandshake_Listen pop bc pop hl jr c, SafelyCloseIRCommunications @@ -2745,10 +2743,10 @@ RequestDataReceivalThroughIR: call ReceiveByteThroughIR jr c, SafelyCloseIRCommunications add b - jr nz, .asm_1989e + jr nz, .set_carry xor a jr SafelyCloseIRCommunications -.asm_1989e +.set_carry call ReturnZFlagUnsetAndCarryFlagSet jr SafelyCloseIRCommunications @@ -3032,21 +3030,52 @@ InitSaveData: .terminating_byte ld [de], a ret -; 0x199fa -SECTION "Bank 6@5a30", ROMX[$5a30], BANK[$6] +; hl = text id +LoadLinkConnectingScene: + push hl + call SetSpriteAnimationsAsVBlankFunction + ld a, SCENE_LINK + lb bc, 0, 0 + call EmptyScreenAndLoadScene + pop hl + call DrawWideTextBox_PrintText + call EnableLCD + ret + +; hl = text id +; shows Link Not Connected scene +; then asks the player whether they want to try again +; if the player selects "no", return carry +LoadLinkNotConnectedSceneAndAskWhetherToTryAgain: + push hl + call RestoreVBlankFunction + call SetSpriteAnimationsAsVBlankFunction + ld a, SCENE_LINK_INTRO_NOT_CONNECTED + lb bc, 0, 0 + call EmptyScreenAndLoadScene + pop hl + call DrawWideTextBox_WaitForInput + ldtx hl, TryAgainPromptText + call YesOrNoMenuWithText_SetCursorToYes +; fallthrough + +ClearRPAndRestoreVBlankFunction: + push af + call ClearRP + call RestoreVBlankFunction + pop af + ret ; prepares IR communication parameter data ; a = a IRPARAM_* constant for the function of this connection InitIRCommunications: ld hl, wOwnIRCommunicationParams ld [hl], a +FOR n, IR_MAGIC_STRING_SIZE inc hl - ld [hl], $50 - inc hl - ld [hl], $4b - inc hl - ld [hl], $32 + ld [hl], STRBYTE("{IR_MAGIC_STRING_TCG2}", n) +ENDR ld a, $ff ld [wIRCommunicationErrorCode], a ld a, PLAYER_TURN @@ -3071,9 +3100,45 @@ InitIRCommunications: jr nz, .loop call DisableSRAM ret -; 0x19a64 -SECTION "Bank 6@5a92", ROMX[$5a92], BANK[$6] +; returns carry if communication was unsuccessful +; if a = 0, then it was a communication error +; if a = 1, then operation was cancelled by the player +PrepareSendCardOrDeckConfigurationThroughIR: + call InitIRCommunications + +; pressing A button triggers request for IR communication +.loop_frame + call DoFrame + ldh a, [hKeysPressed] + bit B_PAD_B, a + jr nz, .b_btn + ldh a, [hKeysHeld] + bit B_PAD_A, a + jr z, .loop_frame +; a btn + call TrySendIRRequest + jr nc, .request_success + or a + jr z, .loop_frame + xor a + scf + ret + +; cancelled by the player +.b_btn + ld a, $01 + scf + ret + +.request_success + call ExchangeIRCommunicationParameters + ret c + ld a, [wOtherIRCommunicationParams + 3] + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) + jr nz, SetIRCommunicationErrorCode_Error + or a + ret ; exchanges player names and IR communication parameters ; checks whether parameters for communication match @@ -3081,15 +3146,15 @@ SECTION "Bank 6@5a92", ROMX[$5a92], BANK[$6] ExchangeIRCommunicationParameters: ld hl, wOwnIRCommunicationParams ld de, wOtherIRCommunicationParams - ld c, 4 + ld c, IR_PARAMS_STRUCT_SIZE call RequestDataTransmissionThroughIR jr c, .error ld hl, wOtherIRCommunicationParams + 1 ld a, [hli] - cp $50 + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 0) jr nz, .error ld a, [hli] - cp $4b + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 1) jr nz, .error ld a, [wOwnIRCommunicationParams] ld hl, wOtherIRCommunicationParams @@ -3131,7 +3196,7 @@ SetIRCommunicationErrorCode_Error: SetIRCommunicationErrorCode_NoError: ld hl, wOwnIRCommunicationParams - ld [hl], $00 + ld [hl], NONE ld de, wIRCommunicationErrorCode ld c, 1 call RequestDataReceivalThroughIR @@ -3139,9 +3204,151 @@ SetIRCommunicationErrorCode_NoError: call RequestCloseIRCommunication or a ret -; 0x19afb -SECTION "Bank 6@5bf9", ROMX[$5bf9], BANK[$6] +; makes device receptive to receive data from other device +; to write in wDuelTempList (either list of cards or a deck configuration) +; returns carry if some error occurred +TryReceiveCardOrDeckConfigurationThroughIR: + call InitIRCommunications +.loop_receive_request + xor a + ld [wDuelTempList], a + call TryReceiveIRRequest + jr nc, .receive_data + bit 1, a + jr nz, .cancelled + jr .loop_receive_request +.receive_data + call ExecuteReceivedIRCommands + ld a, [wIRCommunicationErrorCode] + or a + ret z ; no error + xor a + scf + ret + +.cancelled + ld a, $01 + scf + ret + +; returns carry if card(s) wasn't successfully sent +_SendCard: + call StopMusic + ldtx hl, TransmittingCardSenderText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_CARDS + call PrepareSendCardOrDeckConfigurationThroughIR + jr c, .fail + +; send cards + ld hl, wDuelTempList + ld e, l + ld d, h + ld c, DECK_COMPRESSED_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call SetIRCommunicationErrorCode_NoError + jr c, .fail + call ExecuteReceivedIRCommands + jr c, .fail + ld a, [wOwnIRCommunicationParams + 1] + cp STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) + jr nz, .fail + call PlayCardPopSong + xor a + call ClearRPAndRestoreVBlankFunction + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingCardUnsuccessfulSenderText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _SendCard + scf + ret + +PlayCardPopSong: + ld a, MUSIC_CARD_POP + jp PlaySong + +_ReceiveCard: + call StopMusic + ldtx hl, TransmittingCardReceiverText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_CARDS + call TryReceiveCardOrDeckConfigurationThroughIR + jr c, .fail + ld a, STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) + ld [wOwnIRCommunicationParams + 1], a + ld hl, wOwnIRCommunicationParams + ld e, l + ld d, h + ld c, IR_PARAMS_STRUCT_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call RequestCloseIRCommunication + jr c, .fail + call PlayCardPopSong + or a + call ClearRPAndRestoreVBlankFunction + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingCardUnsuccessfulReceiverText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _ReceiveCard + scf + ret + +_SendDeckConfiguration: + call StopMusic + ldtx hl, TransmittingDeckConfigurationSenderText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_DECK + call PrepareSendCardOrDeckConfigurationThroughIR + jr c, .fail + ld hl, wDuelTempList + ld e, l + ld d, h + ld c, DECK_COMPRESSED_STRUCT_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call SetIRCommunicationErrorCode_NoError + jr c, .fail + call PlayCardPopSong + call ClearRPAndRestoreVBlankFunction + or a + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingDeckConfigurationUnsuccessfulSenderText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _SendDeckConfiguration + scf + ret + +_ReceiveDeckConfiguration: + call StopMusic + ldtx hl, TransmittingDeckConfigurationReceiverText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_DECK + call TryReceiveCardOrDeckConfigurationThroughIR + jr c, .fail + call PlayCardPopSong + call ClearRPAndRestoreVBlankFunction + or a + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingDeckConfigurationUnsuccessfulReceiverText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _ReceiveDeckConfiguration + scf + ret _CardPopMenu: call EnableSRAM @@ -3470,7 +3677,7 @@ HandleCardPopCommunications: or a jr nz, .fail - ld a, $32 + ld a, STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) ld [wOtherIRCommunicationParams + 3], a call DecideCardToReceiveFromCardPop call SetCardPopRecord @@ -3537,7 +3744,7 @@ HandleCardPopCommunications: call BankswitchSRAM call CopyDataHLtoDE ld a, [wOtherIRCommunicationParams + 3] - cp $32 + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) jr nz, .asm_19ecb ; copy SRAM so that sCardPopRecords is moved $20 forward @@ -4284,20 +4491,24 @@ IngameCardPop: ldtx hl, CardPopImakuniText ld a, SCRIPTED_CARD_POP_IMAKUNI + 2 jr .got_partner + .Imakuni_rare ldtx hl, CardPopImakuniText ld a, SCRIPTED_RARE_CARD_POP_IMAKUNI + 2 push af ld a, IRPARAM_RARE_CARD_POP jr .got_partner_and_type + .Ronald ldtx hl, CardPopRonaldText ld a, SCRIPTED_CARD_POP_RONALD + 2 ; fallthrough + .got_partner push af ld a, IRPARAM_CARD_POP ; fallthrough + .got_partner_and_type ld [wCardPopType], a call InitSaveData.PrintName @@ -4349,11 +4560,13 @@ IngameCardPop: inc hl ld [hl], d call DecideCardToReceiveFromCardPop - ld bc, .data1 +; load Ronald's stats +; for Imakuni_rare, these will be overwritten later + ld bc, .Ronald_stats jr .got_data ; guaranteed to give IMAKUNI_CARD to player -; and choose a random card for Imakuni? from the list +; and choose a random card for Imakuni? from the 6-card list .with_Imakuni_first ld a, 6 call Random @@ -4373,8 +4586,9 @@ IngameCardPop: call LoadCardDataToBuffer1_FromCardID ld a, MUSIC_MATCH_VICTORY ld [wCardPopCardObtainSong], a - ld bc, .data2 + ld bc, .Imakuni_stats ; fallthrough + .got_data push bc ld hl, wCardPopRecordYourCardID @@ -4382,18 +4596,19 @@ IngameCardPop: inc hl ld [hl], d pop hl - ld de, wCardPopRecordNumBattles + ld de, wCardPopRecordStats ld bc, CARDPOP_RECORD_STATS_SIZE call CopyDataHLtoDE - ld a, 1 - ld [de], a + ld a, IRPARAM_CARD_POP + ld [de], a ; wCardPopRecordType ld a, [wNameBuffer + MAX_PLAYER_NAME_LENGTH + 1] cp SCRIPTED_RARE_CARD_POP_IMAKUNI + 2 jr nz, .display_ingame_pop ; Imakuni_rare ; set his stats: NumBattles = yours / 2, NumCards = yours / 4, NumCoins = 4 - ld hl, wCardPopRecordNumBattles + ld hl, wCardPopRecordStats +; wCardPopRecordNumBattles call EnableSRAM ld a, [sTotalDuelCounter] srl a @@ -4402,6 +4617,7 @@ IngameCardPop: rr a ld [hli], a call DisableSRAM +; wCardPopRecordNumCards push hl call GetAmountOfCardsOwned REPT 2 @@ -4411,7 +4627,6 @@ ENDR ld e, l ld d, h pop hl -; wCardPopRecordNumCards ld [hl], e inc hl ld [hl], d @@ -4422,6 +4637,7 @@ ENDR ; wCardPopRecordType ld [hl], IRPARAM_RARE_CARD_POP ; fallthrough + .display_ingame_pop call SetSpriteAnimationsAsVBlankFunction ld a, SCENE_CARD_POP @@ -4442,7 +4658,7 @@ ENDR jr z, .loop_input ; pressed A call RestoreVBlankFunction - ld a, $32 + ld a, STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) ld [wOtherIRCommunicationParams + 3], a call HandleCardPopCommunications.success call LoadCardPopSceneAndHandleCommunications.add_sram0 @@ -4466,12 +4682,15 @@ ENDR dw MACHAMP_LV67 ; $4 dw CHANSEY_LV55 ; $5 -; data pointer will be pushed to bc -; meant to be custom stats? -.data1 - db $00, $00, $39, $00, $01 -.data2 - db $00, $00, $6c, $00, $01 +; custom stats +.Ronald_stats + dw 0 ; battles + dw 57 ; cards + db 1 ; coins +.Imakuni_stats + dw 0 ; battles + dw 108 ; cards + db 1 ; coins ; sends serial data to printer ; if there's an error in connection, diff --git a/src/home/double_speed.asm b/src/home/double_speed.asm index ba1e170..7d928a6 100644 --- a/src/home/double_speed.asm +++ b/src/home/double_speed.asm @@ -22,7 +22,7 @@ CGBSpeedSwitch: xor a ldh [rIF], a ldh [rIE], a - ld a, $30 + ld a, JOYP_GET_NONE ldh [rJOYP], a stop call SetupTimer diff --git a/src/wram.asm b/src/wram.asm index d5efa09..7e3ddfb 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -94,9 +94,9 @@ wIRCommunicationErrorCode:: ; c5ea ; and received from the other device respectively ; these must match for successful communication wOwnIRCommunicationParams:: ; c5eb - ds $4 + ds IR_PARAMS_STRUCT_SIZE wOtherIRCommunicationParams:: ; c5ef - ds $4 + ds IR_PARAMS_STRUCT_SIZE ; stores the result from LookUpNameInCardPopNameList @@ -1312,6 +1312,7 @@ wCardPopRecordYourCardID:: ; ce3c wCardPopRecordTheirCardID:: ; ce3e ds $2 +wCardPopRecordStats:: ; ce40 wCardPopRecordNumBattles:: ; ce40 ds $2 From 25eb53a2b50b0ff17f05b2aa88201a758a30335a Mon Sep 17 00:00:00 2001 From: earthoul Date: Wed, 21 Jan 2026 17:25:59 +0900 Subject: [PATCH 06/15] Split IR functions as in TCG1 --- src/engine/bank06.asm | 849 +------------------------------ src/engine/link/ir_core.asm | 529 +++++++++++++++++++ src/engine/link/ir_functions.asm | 318 ++++++++++++ 3 files changed, 849 insertions(+), 847 deletions(-) create mode 100644 src/engine/link/ir_core.asm create mode 100644 src/engine/link/ir_functions.asm diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 383385a..7a0f40a 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -2288,535 +2288,7 @@ AttackAnimation_BoneAttack: anim_opponent DUEL_ANIM_QUESTION_MARK anim_end -; if carry flag is set, only delays -; if carry not set: -; - set rRP edge up, wait; -; - set rRP edge down, wait; -; - return -TransmitIRBit: - jr c, .delay_once - ld [hl], RP_WRITE_HIGH | RP_ENABLE - ld a, 5 - jr .loop_delay_1 ; jump to possibly to add more cycles? -.loop_delay_1 - dec a - jr nz, .loop_delay_1 - ld [hl], RP_WRITE_LOW | RP_ENABLE - ld a, 14 - jr .loop_delay_2 ; jump to possibly to add more cycles? -.loop_delay_2 - dec a - jr nz, .loop_delay_2 - ret - -.delay_once - ld a, 21 - jr .loop_delay_3 ; jump to possibly to add more cycles? -.loop_delay_3 - dec a - jr nz, .loop_delay_3 - nop - ret - -; input a = byte to transmit through IR -TransmitByteThroughIR: - push hl - ld hl, rRP - push de - push bc - ld b, a - scf ; carry set - call TransmitIRBit - or a ; carry not set - call TransmitIRBit - ld c, 8 - ld c, 8 ; number of input bits -.loop - ld a, $00 - rr b - call TransmitIRBit - dec c - jr nz, .loop - pop bc - pop de - pop hl - ldh a, [rJOYP] - bit B_JOYP_B, a - jr z, ReturnZFlagUnsetAndCarryFlagSet - xor a ; return z set - ret - -; same as ReceiveByteThroughIR but -; returns $0 in a if there's an error in IR -ReceiveByteThroughIR_ZeroIfUnsuccessful: - call ReceiveByteThroughIR - ret nc - xor a - ret - -; returns carry if there's some time out -; and output in register a of $ff -; otherwise returns in a some sequence of bits -; related to how rRP sets/unsets bit 1 -ReceiveByteThroughIR: - push de - push bc - push hl - -; waits for bit 1 in rRP to be unset -; up to $100 loops - ld b, 0 - ld hl, rRP -.wait_ir - bit B_RP_DATA_IN, [hl] - jr z, .ok - dec b - jr nz, .wait_ir -; looped around $100 times -; return $ff and carry set - pop hl - pop bc - pop de - scf - ld a, $ff - ret - -.ok -; delay for some cycles - ld a, 15 -.loop_delay - dec a - jr nz, .loop_delay - -; loop for each bit - ld e, 8 -.loop - ld a, $01 -REPT 4 ; possibly delay cycles? - ld b, 9 -ENDR - -; checks for bit 1 in rRP -; if in any of the checks it is unset, -; then a is set to 0 -; this is done a total of 9 times - bit B_RP_DATA_IN, [hl] - jr nz, .loop_check - xor a -.loop_check - bit B_RP_DATA_IN, [hl] - jr nz, .next - xor a -.next - dec b - jr nz, .loop_check -; one bit received - rrca - rr d - dec e - jr nz, .loop - ld a, d ; has bits set for each "cycle" that bit 1 was not unset - pop hl - pop bc - pop de - or a - ret - -ReturnZFlagUnsetAndCarryFlagSet: - ld a, $ff - or a ; z not set - scf ; carry set - ret - -; called when expecting to transmit data -IRHandshake_Initiate: - ld hl, rRP -.loop - ldh a, [rJOYP] - bit B_JOYP_B, a - jr z, ReturnZFlagUnsetAndCarryFlagSet - ld a, IR_HANDSHAKE_REQUEST_TCG2 - call TransmitByteThroughIR - push hl - pop hl - call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 - jr nz, .loop - xor a - ret - -; called when expecting to receive data -IRHandshake_Listen: - ld hl, rRP -.loop - ldh a, [rJOYP] - bit B_JOYP_B, a - jr z, ReturnZFlagUnsetAndCarryFlagSet - call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp IR_HANDSHAKE_REQUEST_TCG2 - jr nz, .loop - ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 - call TransmitByteThroughIR - xor a - ret - -ReturnZFlagUnsetAndCarryFlagSet2: - jp ReturnZFlagUnsetAndCarryFlagSet - -TransmitIRDataBuffer: - call IRHandshake_Initiate - jr c, ReturnZFlagUnsetAndCarryFlagSet2 - ld a, $49 - call TransmitByteThroughIR - ld a, $52 - call TransmitByteThroughIR - ld hl, wIRDataBuffer - ld c, 8 - jr TransmitNBytesFromHLThroughIR - -ReceiveIRDataBuffer: - call IRHandshake_Listen - jr c, ReturnZFlagUnsetAndCarryFlagSet2 - call ReceiveByteThroughIR - cp $49 - jr nz, ReceiveIRDataBuffer - call ReceiveByteThroughIR - cp $52 - jr nz, ReceiveIRDataBuffer - ld hl, wIRDataBuffer - ld c, 8 - jr ReceiveNBytesToHLThroughIR - -; hl = start of data to transmit -; c = number of bytes to transmit -TransmitNBytesFromHLThroughIR: - ld b, 0 -.loop_data_bytes - ld a, b - add [hl] - ld b, a - ld a, [hli] - call TransmitByteThroughIR - jr c, .done - dec c - jr nz, .loop_data_bytes - ld a, b - cpl - inc a - call TransmitByteThroughIR -.done - ret - -; hl = address to write received data -; c = number of bytes to be received -ReceiveNBytesToHLThroughIR: - ld b, 0 -.loop_data_bytes - call ReceiveByteThroughIR - jr c, ReturnZFlagUnsetAndCarryFlagSet2 - ld [hli], a - add b - ld b, a - dec c - jr nz, .loop_data_bytes - call ReceiveByteThroughIR - add b - or a - jr nz, ReturnZFlagUnsetAndCarryFlagSet2 - ret - -; disables interrupts, and sets joypad and IR communication port -; switches to CGB normal speed -StartIRCommunications: - di - call SwitchToCGBNormalSpeed - ld a, JOYP_GET_BUTTONS - ldh [rJOYP], a - ld a, RP_ENABLE - ldh [rRP], a - ret - -; reenables interrupts, and switches CGB back to double speed -CloseIRCommunications: - ld a, JOYP_GET_NONE - ldh [rJOYP], a -.wait_vblank_on - ldh a, [rSTAT] - and STAT_MODE - cp STAT_VBLANK - jr z, .wait_vblank_on -.wait_vblank_off - ldh a, [rSTAT] - and STAT_MODE - cp STAT_VBLANK - jr nz, .wait_vblank_off - call SwitchToCGBDoubleSpeed - ei - ret - -; set rRP to 0 -ClearRP: - ld a, 0 - ldh [rRP], a - ret - -; expects to receive a command (IRCMD_* constant) -; in wIRDataBuffer + 1, then calls the subroutine -; corresponding to that command -ExecuteReceivedIRCommands: - call StartIRCommunications -.loop_commands - call ReceiveIRDataBuffer - jr c, .error - jr nz, .loop_commands - ld hl, wIRDataBuffer + 1 - ld a, [hl] - ld hl, .CmdPointerTable - cp NUM_IR_COMMANDS - jr nc, .loop_commands ; invalid command - call .JumpToCmdPointer ; execute command - jr .loop_commands -.error - call CloseIRCommunications - xor a - scf - ret - -.JumpToCmdPointer - add a ; *2 - add l - ld l, a - ld a, 0 - adc h - ld h, a - ld a, [hli] - ld h, [hl] - ld l, a -.jp_hl - jp hl - -.CmdPointerTable - dw .Close ; IRCMD_CLOSE - dw .ReturnWithoutClosing ; IRCMD_RETURN_WO_CLOSING - dw .TransmitData ; IRCMD_TRANSMIT_DATA - dw .ReceiveData ; IRCMD_RECEIVE_DATA - dw .CallFunction ; IRCMD_CALL_FUNCTION - -; closes the IR communications -; pops hl so that the sp points -; to the return address of ExecuteReceivedIRCommands -.Close - pop hl - call CloseIRCommunications - or a - ret - -; returns without closing the IR communications -; will continue the command loop -.ReturnWithoutClosing - or a - ret - -; receives an address and number of bytes -; and transmits starting at that address -.TransmitData - call IRHandshake_Initiate - ret c - call LoadRegistersFromIRDataBuffer - jp TransmitNBytesFromHLThroughIR - -; receives an address and number of bytes -; and writes the data received to that address -.ReceiveData - call LoadRegistersFromIRDataBuffer - ld l, e - ld h, d - call ReceiveNBytesToHLThroughIR - jr c, .received - sub b - call TransmitByteThroughIR -.received - ret - -; receives an address to call, then stores -; the registers in the IR data buffer -.CallFunction - call LoadRegistersFromIRDataBuffer - call .jp_hl - call StoreRegistersInIRDataBuffer - ret - -; returns carry set if request sent was not acknowledged -TrySendIRRequest: - call StartIRCommunications - ld hl, rRP - ld c, 4 -.send_request - ld a, IR_HANDSHAKE_REQUEST_TCG2 - push bc - call TransmitByteThroughIR - push bc - pop bc - call ReceiveByteThroughIR_ZeroIfUnsuccessful - pop bc - cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 - jr z, .received_ack - dec c - jr nz, .send_request - scf - jr .close - -.received_ack - xor a -.close - push af - call CloseIRCommunications - pop af - ret - -; returns carry set if request was not received -TryReceiveIRRequest: - call StartIRCommunications - ld hl, rRP -.wait_request - call ReceiveByteThroughIR_ZeroIfUnsuccessful - cp IR_HANDSHAKE_REQUEST_TCG2 - jr z, .send_ack - ldh a, [rJOYP] - cpl - and JOYP_A | JOYP_B - jr z, .wait_request - scf - jr .close - -.send_ack - ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 - call TransmitByteThroughIR - xor a -.close - push af - call CloseIRCommunications - pop af - ret - -; sends request for other device to close current communication -RequestCloseIRCommunication: - call StartIRCommunications - ld a, IRCMD_CLOSE - ld [wIRDataBuffer + 1], a - call TransmitIRDataBuffer -; fallthrough - -; calls CloseIRCommunications while preserving af -SafelyCloseIRCommunications: - push af - call CloseIRCommunications - pop af - ret - -; sends a request for data to be transmitted -; from the other device -; hl = start of data to request to transmit -; de = address to write data received -; c = length of data -RequestDataTransmissionThroughIR: - ld a, IRCMD_TRANSMIT_DATA - call TransmitRegistersThroughIR - push de - push bc - call IRHandshake_Listen - pop bc - pop hl - jr c, SafelyCloseIRCommunications - call ReceiveNBytesToHLThroughIR - jr SafelyCloseIRCommunications - -; transmits data to be written in the other device -; hl = start of data to transmit -; de = address for other device to write data -; c = length of data -RequestDataReceivalThroughIR: - ld a, IRCMD_RECEIVE_DATA - call TransmitRegistersThroughIR - call TransmitNBytesFromHLThroughIR - jr c, SafelyCloseIRCommunications - call ReceiveByteThroughIR - jr c, SafelyCloseIRCommunications - add b - jr nz, .set_carry - xor a - jr SafelyCloseIRCommunications -.set_carry - call ReturnZFlagUnsetAndCarryFlagSet - jr SafelyCloseIRCommunications - -; first stores all the current registers in wIRDataBuffer -; then transmits it through IR -TransmitRegistersThroughIR: - push hl - push de - push bc - call StoreRegistersInIRDataBuffer - call StartIRCommunications - call TransmitIRDataBuffer - pop bc - pop de - pop hl - ret nc - inc sp - inc sp - jr SafelyCloseIRCommunications - -; stores af, hl, de and bc in wIRDataBuffer -StoreRegistersInIRDataBuffer: - push de - push hl - push af - ld hl, wIRDataBuffer - pop de - ld [hl], e ; <- f - inc hl - ld [hl], d ; <- a - inc hl - pop de - ld [hl], e ; <- l - inc hl - ld [hl], d ; <- h - inc hl - pop de - ld [hl], e ; <- e - inc hl - ld [hl], d ; <- d - inc hl - ld [hl], c ; <- c - inc hl - ld [hl], b ; <- b - ret - -; loads all the registers that were stored -; from StoreRegistersInIRDataBuffer -LoadRegistersFromIRDataBuffer: - ld hl, wIRDataBuffer - ld e, [hl] - inc hl - ld d, [hl] - inc hl - push de - ld e, [hl] - inc hl - ld d, [hl] - inc hl - push de - ld e, [hl] - inc hl - ld d, [hl] - inc hl - ld c, [hl] - inc hl - ld b, [hl] - pop hl - pop af - ret +INCLUDE "engine/link/ir_core.asm" ; empties screen and enables sprite animations SetSpriteAnimationsAsVBlankFunction: @@ -3031,324 +2503,7 @@ InitSaveData: ld [de], a ret -; hl = text id -LoadLinkConnectingScene: - push hl - call SetSpriteAnimationsAsVBlankFunction - ld a, SCENE_LINK - lb bc, 0, 0 - call EmptyScreenAndLoadScene - pop hl - call DrawWideTextBox_PrintText - call EnableLCD - ret - -; hl = text id -; shows Link Not Connected scene -; then asks the player whether they want to try again -; if the player selects "no", return carry -LoadLinkNotConnectedSceneAndAskWhetherToTryAgain: - push hl - call RestoreVBlankFunction - call SetSpriteAnimationsAsVBlankFunction - ld a, SCENE_LINK_INTRO_NOT_CONNECTED - lb bc, 0, 0 - call EmptyScreenAndLoadScene - pop hl - call DrawWideTextBox_WaitForInput - ldtx hl, TryAgainPromptText - call YesOrNoMenuWithText_SetCursorToYes -; fallthrough - -ClearRPAndRestoreVBlankFunction: - push af - call ClearRP - call RestoreVBlankFunction - pop af - ret - -; prepares IR communication parameter data -; a = a IRPARAM_* constant for the function of this connection -InitIRCommunications: - ld hl, wOwnIRCommunicationParams - ld [hl], a -FOR n, IR_MAGIC_STRING_SIZE - inc hl - ld [hl], STRBYTE("{IR_MAGIC_STRING_TCG2}", n) -ENDR - ld a, $ff - ld [wIRCommunicationErrorCode], a - ld a, PLAYER_TURN - ldh [hWhoseTurn], a -; clear wNameBuffer and wOpponentName - xor a - ld [wNameBuffer], a - ld hl, wOpponentName - ld [hli], a - ld [hl], a -; loads player's name from SRAM -; to wDefaultText - call EnableSRAM - ld hl, sPlayerName - ld de, wDefaultText - ld c, NAME_BUFFER_LENGTH -.loop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .loop - call DisableSRAM - ret - -; returns carry if communication was unsuccessful -; if a = 0, then it was a communication error -; if a = 1, then operation was cancelled by the player -PrepareSendCardOrDeckConfigurationThroughIR: - call InitIRCommunications - -; pressing A button triggers request for IR communication -.loop_frame - call DoFrame - ldh a, [hKeysPressed] - bit B_PAD_B, a - jr nz, .b_btn - ldh a, [hKeysHeld] - bit B_PAD_A, a - jr z, .loop_frame -; a btn - call TrySendIRRequest - jr nc, .request_success - or a - jr z, .loop_frame - xor a - scf - ret - -; cancelled by the player -.b_btn - ld a, $01 - scf - ret - -.request_success - call ExchangeIRCommunicationParameters - ret c - ld a, [wOtherIRCommunicationParams + 3] - cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) - jr nz, SetIRCommunicationErrorCode_Error - or a - ret - -; exchanges player names and IR communication parameters -; checks whether parameters for communication match -; and if they don't, an error is issued -ExchangeIRCommunicationParameters: - ld hl, wOwnIRCommunicationParams - ld de, wOtherIRCommunicationParams - ld c, IR_PARAMS_STRUCT_SIZE - call RequestDataTransmissionThroughIR - jr c, .error - ld hl, wOtherIRCommunicationParams + 1 - ld a, [hli] - cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 0) - jr nz, .error - ld a, [hli] - cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 1) - jr nz, .error - ld a, [wOwnIRCommunicationParams] - ld hl, wOtherIRCommunicationParams - cp [hl] ; do parameters match? - jr nz, SetIRCommunicationErrorCode_Error - -; receives wDefaultText from other device -; and writes it to wNameBuffer - ld hl, wDefaultText - ld de, wNameBuffer - ld c, NAME_BUFFER_LENGTH - call RequestDataTransmissionThroughIR - jr c, .error -; transmits wDefaultText to be -; written in wNameBuffer in the other device - ld hl, wDefaultText - ld de, wNameBuffer - ld c, NAME_BUFFER_LENGTH - call RequestDataReceivalThroughIR - jr c, .error - or a - ret - -.error - xor a - scf - ret - -SetIRCommunicationErrorCode_Error: - ld hl, wIRCommunicationErrorCode - ld [hl], $01 - ld de, wIRCommunicationErrorCode - ld c, 1 - call RequestDataReceivalThroughIR - call RequestCloseIRCommunication - ld a, $01 - scf - ret - -SetIRCommunicationErrorCode_NoError: - ld hl, wOwnIRCommunicationParams - ld [hl], NONE - ld de, wIRCommunicationErrorCode - ld c, 1 - call RequestDataReceivalThroughIR - ret c - call RequestCloseIRCommunication - or a - ret - -; makes device receptive to receive data from other device -; to write in wDuelTempList (either list of cards or a deck configuration) -; returns carry if some error occurred -TryReceiveCardOrDeckConfigurationThroughIR: - call InitIRCommunications -.loop_receive_request - xor a - ld [wDuelTempList], a - call TryReceiveIRRequest - jr nc, .receive_data - bit 1, a - jr nz, .cancelled - jr .loop_receive_request -.receive_data - call ExecuteReceivedIRCommands - ld a, [wIRCommunicationErrorCode] - or a - ret z ; no error - xor a - scf - ret - -.cancelled - ld a, $01 - scf - ret - -; returns carry if card(s) wasn't successfully sent -_SendCard: - call StopMusic - ldtx hl, TransmittingCardSenderText - call LoadLinkConnectingScene - ld a, IRPARAM_SEND_CARDS - call PrepareSendCardOrDeckConfigurationThroughIR - jr c, .fail - -; send cards - ld hl, wDuelTempList - ld e, l - ld d, h - ld c, DECK_COMPRESSED_SIZE - call RequestDataReceivalThroughIR - jr c, .fail - call SetIRCommunicationErrorCode_NoError - jr c, .fail - call ExecuteReceivedIRCommands - jr c, .fail - ld a, [wOwnIRCommunicationParams + 1] - cp STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) - jr nz, .fail - call PlayCardPopSong - xor a - call ClearRPAndRestoreVBlankFunction - ret - -.fail - call PlayCardPopSong - ldtx hl, TransmittingCardUnsuccessfulSenderText - call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain - jr nc, _SendCard - scf - ret - -PlayCardPopSong: - ld a, MUSIC_CARD_POP - jp PlaySong - -_ReceiveCard: - call StopMusic - ldtx hl, TransmittingCardReceiverText - call LoadLinkConnectingScene - ld a, IRPARAM_SEND_CARDS - call TryReceiveCardOrDeckConfigurationThroughIR - jr c, .fail - ld a, STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) - ld [wOwnIRCommunicationParams + 1], a - ld hl, wOwnIRCommunicationParams - ld e, l - ld d, h - ld c, IR_PARAMS_STRUCT_SIZE - call RequestDataReceivalThroughIR - jr c, .fail - call RequestCloseIRCommunication - jr c, .fail - call PlayCardPopSong - or a - call ClearRPAndRestoreVBlankFunction - ret - -.fail - call PlayCardPopSong - ldtx hl, TransmittingCardUnsuccessfulReceiverText - call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain - jr nc, _ReceiveCard - scf - ret - -_SendDeckConfiguration: - call StopMusic - ldtx hl, TransmittingDeckConfigurationSenderText - call LoadLinkConnectingScene - ld a, IRPARAM_SEND_DECK - call PrepareSendCardOrDeckConfigurationThroughIR - jr c, .fail - ld hl, wDuelTempList - ld e, l - ld d, h - ld c, DECK_COMPRESSED_STRUCT_SIZE - call RequestDataReceivalThroughIR - jr c, .fail - call SetIRCommunicationErrorCode_NoError - jr c, .fail - call PlayCardPopSong - call ClearRPAndRestoreVBlankFunction - or a - ret - -.fail - call PlayCardPopSong - ldtx hl, TransmittingDeckConfigurationUnsuccessfulSenderText - call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain - jr nc, _SendDeckConfiguration - scf - ret - -_ReceiveDeckConfiguration: - call StopMusic - ldtx hl, TransmittingDeckConfigurationReceiverText - call LoadLinkConnectingScene - ld a, IRPARAM_SEND_DECK - call TryReceiveCardOrDeckConfigurationThroughIR - jr c, .fail - call PlayCardPopSong - call ClearRPAndRestoreVBlankFunction - or a - ret - -.fail - call PlayCardPopSong - ldtx hl, TransmittingDeckConfigurationUnsuccessfulReceiverText - call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain - jr nc, _ReceiveDeckConfiguration - scf - ret +INCLUDE "engine/link/ir_functions.asm" _CardPopMenu: call EnableSRAM diff --git a/src/engine/link/ir_core.asm b/src/engine/link/ir_core.asm new file mode 100644 index 0000000..781c69e --- /dev/null +++ b/src/engine/link/ir_core.asm @@ -0,0 +1,529 @@ +; if carry flag is set, only delays +; if carry not set: +; - set rRP edge up, wait; +; - set rRP edge down, wait; +; - return +TransmitIRBit: + jr c, .delay_once + ld [hl], RP_WRITE_HIGH | RP_ENABLE + ld a, 5 + jr .loop_delay_1 ; jump to possibly to add more cycles? +.loop_delay_1 + dec a + jr nz, .loop_delay_1 + ld [hl], RP_WRITE_LOW | RP_ENABLE + ld a, 14 + jr .loop_delay_2 ; jump to possibly to add more cycles? +.loop_delay_2 + dec a + jr nz, .loop_delay_2 + ret + +.delay_once + ld a, 21 + jr .loop_delay_3 ; jump to possibly to add more cycles? +.loop_delay_3 + dec a + jr nz, .loop_delay_3 + nop + ret + +; input a = byte to transmit through IR +TransmitByteThroughIR: + push hl + ld hl, rRP + push de + push bc + ld b, a + scf ; carry set + call TransmitIRBit + or a ; carry not set + call TransmitIRBit + ld c, 8 + ld c, 8 ; number of input bits +.loop + ld a, $00 + rr b + call TransmitIRBit + dec c + jr nz, .loop + pop bc + pop de + pop hl + ldh a, [rJOYP] + bit B_JOYP_B, a + jr z, ReturnZFlagUnsetAndCarryFlagSet + xor a ; return z set + ret + +; same as ReceiveByteThroughIR but +; returns $0 in a if there's an error in IR +ReceiveByteThroughIR_ZeroIfUnsuccessful: + call ReceiveByteThroughIR + ret nc + xor a + ret + +; returns carry if there's some time out +; and output in register a of $ff +; otherwise returns in a some sequence of bits +; related to how rRP sets/unsets bit 1 +ReceiveByteThroughIR: + push de + push bc + push hl + +; waits for bit 1 in rRP to be unset +; up to $100 loops + ld b, 0 + ld hl, rRP +.wait_ir + bit B_RP_DATA_IN, [hl] + jr z, .ok + dec b + jr nz, .wait_ir +; looped around $100 times +; return $ff and carry set + pop hl + pop bc + pop de + scf + ld a, $ff + ret + +.ok +; delay for some cycles + ld a, 15 +.loop_delay + dec a + jr nz, .loop_delay + +; loop for each bit + ld e, 8 +.loop + ld a, $01 +REPT 4 ; possibly delay cycles? + ld b, 9 +ENDR + +; checks for bit 1 in rRP +; if in any of the checks it is unset, +; then a is set to 0 +; this is done a total of 9 times + bit B_RP_DATA_IN, [hl] + jr nz, .loop_check + xor a +.loop_check + bit B_RP_DATA_IN, [hl] + jr nz, .next + xor a +.next + dec b + jr nz, .loop_check +; one bit received + rrca + rr d + dec e + jr nz, .loop + ld a, d ; has bits set for each "cycle" that bit 1 was not unset + pop hl + pop bc + pop de + or a + ret + +ReturnZFlagUnsetAndCarryFlagSet: + ld a, $ff + or a ; z not set + scf ; carry set + ret + +; called when expecting to transmit data +IRHandshake_Initiate: + ld hl, rRP +.loop + ldh a, [rJOYP] + bit B_JOYP_B, a + jr z, ReturnZFlagUnsetAndCarryFlagSet + ld a, IR_HANDSHAKE_REQUEST_TCG2 + call TransmitByteThroughIR + push hl + pop hl + call ReceiveByteThroughIR_ZeroIfUnsuccessful + cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 + jr nz, .loop + xor a + ret + +; called when expecting to receive data +IRHandshake_Listen: + ld hl, rRP +.loop + ldh a, [rJOYP] + bit B_JOYP_B, a + jr z, ReturnZFlagUnsetAndCarryFlagSet + call ReceiveByteThroughIR_ZeroIfUnsuccessful + cp IR_HANDSHAKE_REQUEST_TCG2 + jr nz, .loop + ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 + call TransmitByteThroughIR + xor a + ret + +ReturnZFlagUnsetAndCarryFlagSet2: + jp ReturnZFlagUnsetAndCarryFlagSet + +TransmitIRDataBuffer: + call IRHandshake_Initiate + jr c, ReturnZFlagUnsetAndCarryFlagSet2 + ld a, $49 + call TransmitByteThroughIR + ld a, $52 + call TransmitByteThroughIR + ld hl, wIRDataBuffer + ld c, 8 + jr TransmitNBytesFromHLThroughIR + +ReceiveIRDataBuffer: + call IRHandshake_Listen + jr c, ReturnZFlagUnsetAndCarryFlagSet2 + call ReceiveByteThroughIR + cp $49 + jr nz, ReceiveIRDataBuffer + call ReceiveByteThroughIR + cp $52 + jr nz, ReceiveIRDataBuffer + ld hl, wIRDataBuffer + ld c, 8 + jr ReceiveNBytesToHLThroughIR + +; hl = start of data to transmit +; c = number of bytes to transmit +TransmitNBytesFromHLThroughIR: + ld b, 0 +.loop_data_bytes + ld a, b + add [hl] + ld b, a + ld a, [hli] + call TransmitByteThroughIR + jr c, .done + dec c + jr nz, .loop_data_bytes + ld a, b + cpl + inc a + call TransmitByteThroughIR +.done + ret + +; hl = address to write received data +; c = number of bytes to be received +ReceiveNBytesToHLThroughIR: + ld b, 0 +.loop_data_bytes + call ReceiveByteThroughIR + jr c, ReturnZFlagUnsetAndCarryFlagSet2 + ld [hli], a + add b + ld b, a + dec c + jr nz, .loop_data_bytes + call ReceiveByteThroughIR + add b + or a + jr nz, ReturnZFlagUnsetAndCarryFlagSet2 + ret + +; disables interrupts, and sets joypad and IR communication port +; switches to CGB normal speed +StartIRCommunications: + di + call SwitchToCGBNormalSpeed + ld a, JOYP_GET_BUTTONS + ldh [rJOYP], a + ld a, RP_ENABLE + ldh [rRP], a + ret + +; reenables interrupts, and switches CGB back to double speed +CloseIRCommunications: + ld a, JOYP_GET_NONE + ldh [rJOYP], a +.wait_vblank_on + ldh a, [rSTAT] + and STAT_MODE + cp STAT_VBLANK + jr z, .wait_vblank_on +.wait_vblank_off + ldh a, [rSTAT] + and STAT_MODE + cp STAT_VBLANK + jr nz, .wait_vblank_off + call SwitchToCGBDoubleSpeed + ei + ret + +; set rRP to 0 +ClearRP: + ld a, 0 + ldh [rRP], a + ret + +; expects to receive a command (IRCMD_* constant) +; in wIRDataBuffer + 1, then calls the subroutine +; corresponding to that command +ExecuteReceivedIRCommands: + call StartIRCommunications +.loop_commands + call ReceiveIRDataBuffer + jr c, .error + jr nz, .loop_commands + ld hl, wIRDataBuffer + 1 + ld a, [hl] + ld hl, .CmdPointerTable + cp NUM_IR_COMMANDS + jr nc, .loop_commands ; invalid command + call .JumpToCmdPointer ; execute command + jr .loop_commands +.error + call CloseIRCommunications + xor a + scf + ret + +.JumpToCmdPointer + add a ; *2 + add l + ld l, a + ld a, 0 + adc h + ld h, a + ld a, [hli] + ld h, [hl] + ld l, a +.jp_hl + jp hl + +.CmdPointerTable + dw .Close ; IRCMD_CLOSE + dw .ReturnWithoutClosing ; IRCMD_RETURN_WO_CLOSING + dw .TransmitData ; IRCMD_TRANSMIT_DATA + dw .ReceiveData ; IRCMD_RECEIVE_DATA + dw .CallFunction ; IRCMD_CALL_FUNCTION + +; closes the IR communications +; pops hl so that the sp points +; to the return address of ExecuteReceivedIRCommands +.Close + pop hl + call CloseIRCommunications + or a + ret + +; returns without closing the IR communications +; will continue the command loop +.ReturnWithoutClosing + or a + ret + +; receives an address and number of bytes +; and transmits starting at that address +.TransmitData + call IRHandshake_Initiate + ret c + call LoadRegistersFromIRDataBuffer + jp TransmitNBytesFromHLThroughIR + +; receives an address and number of bytes +; and writes the data received to that address +.ReceiveData + call LoadRegistersFromIRDataBuffer + ld l, e + ld h, d + call ReceiveNBytesToHLThroughIR + jr c, .received + sub b + call TransmitByteThroughIR +.received + ret + +; receives an address to call, then stores +; the registers in the IR data buffer +.CallFunction + call LoadRegistersFromIRDataBuffer + call .jp_hl + call StoreRegistersInIRDataBuffer + ret + +; returns carry set if request sent was not acknowledged +TrySendIRRequest: + call StartIRCommunications + ld hl, rRP + ld c, 4 +.send_request + ld a, IR_HANDSHAKE_REQUEST_TCG2 + push bc + call TransmitByteThroughIR + push bc + pop bc + call ReceiveByteThroughIR_ZeroIfUnsuccessful + pop bc + cp IR_HANDSHAKE_ACKNOWLEDGE_TCG2 + jr z, .received_ack + dec c + jr nz, .send_request + scf + jr .close + +.received_ack + xor a +.close + push af + call CloseIRCommunications + pop af + ret + +; returns carry set if request was not received +TryReceiveIRRequest: + call StartIRCommunications + ld hl, rRP +.wait_request + call ReceiveByteThroughIR_ZeroIfUnsuccessful + cp IR_HANDSHAKE_REQUEST_TCG2 + jr z, .send_ack + ldh a, [rJOYP] + cpl + and JOYP_A | JOYP_B + jr z, .wait_request + scf + jr .close + +.send_ack + ld a, IR_HANDSHAKE_ACKNOWLEDGE_TCG2 + call TransmitByteThroughIR + xor a +.close + push af + call CloseIRCommunications + pop af + ret + +; sends request for other device to close current communication +RequestCloseIRCommunication: + call StartIRCommunications + ld a, IRCMD_CLOSE + ld [wIRDataBuffer + 1], a + call TransmitIRDataBuffer +; fallthrough + +; calls CloseIRCommunications while preserving af +SafelyCloseIRCommunications: + push af + call CloseIRCommunications + pop af + ret + +; sends a request for data to be transmitted +; from the other device +; hl = start of data to request to transmit +; de = address to write data received +; c = length of data +RequestDataTransmissionThroughIR: + ld a, IRCMD_TRANSMIT_DATA + call TransmitRegistersThroughIR + push de + push bc + call IRHandshake_Listen + pop bc + pop hl + jr c, SafelyCloseIRCommunications + call ReceiveNBytesToHLThroughIR + jr SafelyCloseIRCommunications + +; transmits data to be written in the other device +; hl = start of data to transmit +; de = address for other device to write data +; c = length of data +RequestDataReceivalThroughIR: + ld a, IRCMD_RECEIVE_DATA + call TransmitRegistersThroughIR + call TransmitNBytesFromHLThroughIR + jr c, SafelyCloseIRCommunications + call ReceiveByteThroughIR + jr c, SafelyCloseIRCommunications + add b + jr nz, .set_carry + xor a + jr SafelyCloseIRCommunications +.set_carry + call ReturnZFlagUnsetAndCarryFlagSet + jr SafelyCloseIRCommunications + +; first stores all the current registers in wIRDataBuffer +; then transmits it through IR +TransmitRegistersThroughIR: + push hl + push de + push bc + call StoreRegistersInIRDataBuffer + call StartIRCommunications + call TransmitIRDataBuffer + pop bc + pop de + pop hl + ret nc + inc sp + inc sp + jr SafelyCloseIRCommunications + +; stores af, hl, de and bc in wIRDataBuffer +StoreRegistersInIRDataBuffer: + push de + push hl + push af + ld hl, wIRDataBuffer + pop de + ld [hl], e ; <- f + inc hl + ld [hl], d ; <- a + inc hl + pop de + ld [hl], e ; <- l + inc hl + ld [hl], d ; <- h + inc hl + pop de + ld [hl], e ; <- e + inc hl + ld [hl], d ; <- d + inc hl + ld [hl], c ; <- c + inc hl + ld [hl], b ; <- b + ret + +; loads all the registers that were stored +; from StoreRegistersInIRDataBuffer +LoadRegistersFromIRDataBuffer: + ld hl, wIRDataBuffer + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + push de + ld e, [hl] + inc hl + ld d, [hl] + inc hl + ld c, [hl] + inc hl + ld b, [hl] + pop hl + pop af + ret diff --git a/src/engine/link/ir_functions.asm b/src/engine/link/ir_functions.asm new file mode 100644 index 0000000..0a98278 --- /dev/null +++ b/src/engine/link/ir_functions.asm @@ -0,0 +1,318 @@ +; hl = text id +LoadLinkConnectingScene: + push hl + call SetSpriteAnimationsAsVBlankFunction + ld a, SCENE_LINK + lb bc, 0, 0 + call EmptyScreenAndLoadScene + pop hl + call DrawWideTextBox_PrintText + call EnableLCD + ret + +; hl = text id +; shows Link Not Connected scene +; then asks the player whether they want to try again +; if the player selects "no", return carry +LoadLinkNotConnectedSceneAndAskWhetherToTryAgain: + push hl + call RestoreVBlankFunction + call SetSpriteAnimationsAsVBlankFunction + ld a, SCENE_LINK_INTRO_NOT_CONNECTED + lb bc, 0, 0 + call EmptyScreenAndLoadScene + pop hl + call DrawWideTextBox_WaitForInput + ldtx hl, TryAgainPromptText + call YesOrNoMenuWithText_SetCursorToYes +; fallthrough + +ClearRPAndRestoreVBlankFunction: + push af + call ClearRP + call RestoreVBlankFunction + pop af + ret + +; prepares IR communication parameter data +; a = a IRPARAM_* constant for the function of this connection +InitIRCommunications: + ld hl, wOwnIRCommunicationParams + ld [hl], a +FOR n, IR_MAGIC_STRING_SIZE + inc hl + ld [hl], STRBYTE("{IR_MAGIC_STRING_TCG2}", n) +ENDR + ld a, $ff + ld [wIRCommunicationErrorCode], a + ld a, PLAYER_TURN + ldh [hWhoseTurn], a +; clear wNameBuffer and wOpponentName + xor a + ld [wNameBuffer], a + ld hl, wOpponentName + ld [hli], a + ld [hl], a +; loads player's name from SRAM +; to wDefaultText + call EnableSRAM + ld hl, sPlayerName + ld de, wDefaultText + ld c, NAME_BUFFER_LENGTH +.loop + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop + call DisableSRAM + ret + +; returns carry if communication was unsuccessful +; if a = 0, then it was a communication error +; if a = 1, then operation was cancelled by the player +PrepareSendCardOrDeckConfigurationThroughIR: + call InitIRCommunications + +; pressing A button triggers request for IR communication +.loop_frame + call DoFrame + ldh a, [hKeysPressed] + bit B_PAD_B, a + jr nz, .b_btn + ldh a, [hKeysHeld] + bit B_PAD_A, a + jr z, .loop_frame +; a btn + call TrySendIRRequest + jr nc, .request_success + or a + jr z, .loop_frame + xor a + scf + ret + +; cancelled by the player +.b_btn + ld a, $01 + scf + ret + +.request_success + call ExchangeIRCommunicationParameters + ret c + ld a, [wOtherIRCommunicationParams + 3] + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) + jr nz, SetIRCommunicationErrorCode_Error + or a + ret + +; exchanges player names and IR communication parameters +; checks whether parameters for communication match +; and if they don't, an error is issued +ExchangeIRCommunicationParameters: + ld hl, wOwnIRCommunicationParams + ld de, wOtherIRCommunicationParams + ld c, IR_PARAMS_STRUCT_SIZE + call RequestDataTransmissionThroughIR + jr c, .error + ld hl, wOtherIRCommunicationParams + 1 + ld a, [hli] + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 0) + jr nz, .error + ld a, [hli] + cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 1) + jr nz, .error + ld a, [wOwnIRCommunicationParams] + ld hl, wOtherIRCommunicationParams + cp [hl] ; do parameters match? + jr nz, SetIRCommunicationErrorCode_Error + +; receives wDefaultText from other device +; and writes it to wNameBuffer + ld hl, wDefaultText + ld de, wNameBuffer + ld c, NAME_BUFFER_LENGTH + call RequestDataTransmissionThroughIR + jr c, .error +; transmits wDefaultText to be +; written in wNameBuffer in the other device + ld hl, wDefaultText + ld de, wNameBuffer + ld c, NAME_BUFFER_LENGTH + call RequestDataReceivalThroughIR + jr c, .error + or a + ret + +.error + xor a + scf + ret + +SetIRCommunicationErrorCode_Error: + ld hl, wIRCommunicationErrorCode + ld [hl], $01 + ld de, wIRCommunicationErrorCode + ld c, 1 + call RequestDataReceivalThroughIR + call RequestCloseIRCommunication + ld a, $01 + scf + ret + +SetIRCommunicationErrorCode_NoError: + ld hl, wOwnIRCommunicationParams + ld [hl], NONE + ld de, wIRCommunicationErrorCode + ld c, 1 + call RequestDataReceivalThroughIR + ret c + call RequestCloseIRCommunication + or a + ret + +; makes device receptive to receive data from other device +; to write in wDuelTempList (either list of cards or a deck configuration) +; returns carry if some error occurred +TryReceiveCardOrDeckConfigurationThroughIR: + call InitIRCommunications +.loop_receive_request + xor a + ld [wDuelTempList], a + call TryReceiveIRRequest + jr nc, .receive_data + bit 1, a + jr nz, .cancelled + jr .loop_receive_request +.receive_data + call ExecuteReceivedIRCommands + ld a, [wIRCommunicationErrorCode] + or a + ret z ; no error + xor a + scf + ret + +.cancelled + ld a, $01 + scf + ret + +; returns carry if card(s) wasn't successfully sent +_SendCard: + call StopMusic + ldtx hl, TransmittingCardSenderText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_CARDS + call PrepareSendCardOrDeckConfigurationThroughIR + jr c, .fail + +; send cards + ld hl, wDuelTempList + ld e, l + ld d, h + ld c, DECK_COMPRESSED_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call SetIRCommunicationErrorCode_NoError + jr c, .fail + call ExecuteReceivedIRCommands + jr c, .fail + ld a, [wOwnIRCommunicationParams + 1] + cp STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) + jr nz, .fail + call PlayCardPopSong + xor a + call ClearRPAndRestoreVBlankFunction + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingCardUnsuccessfulSenderText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _SendCard + scf + ret + +PlayCardPopSong: + ld a, MUSIC_CARD_POP + jp PlaySong + +_ReceiveCard: + call StopMusic + ldtx hl, TransmittingCardReceiverText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_CARDS + call TryReceiveCardOrDeckConfigurationThroughIR + jr c, .fail + ld a, STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) + ld [wOwnIRCommunicationParams + 1], a + ld hl, wOwnIRCommunicationParams + ld e, l + ld d, h + ld c, IR_PARAMS_STRUCT_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call RequestCloseIRCommunication + jr c, .fail + call PlayCardPopSong + or a + call ClearRPAndRestoreVBlankFunction + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingCardUnsuccessfulReceiverText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _ReceiveCard + scf + ret + +_SendDeckConfiguration: + call StopMusic + ldtx hl, TransmittingDeckConfigurationSenderText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_DECK + call PrepareSendCardOrDeckConfigurationThroughIR + jr c, .fail + ld hl, wDuelTempList + ld e, l + ld d, h + ld c, DECK_COMPRESSED_STRUCT_SIZE + call RequestDataReceivalThroughIR + jr c, .fail + call SetIRCommunicationErrorCode_NoError + jr c, .fail + call PlayCardPopSong + call ClearRPAndRestoreVBlankFunction + or a + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingDeckConfigurationUnsuccessfulSenderText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _SendDeckConfiguration + scf + ret + +_ReceiveDeckConfiguration: + call StopMusic + ldtx hl, TransmittingDeckConfigurationReceiverText + call LoadLinkConnectingScene + ld a, IRPARAM_SEND_DECK + call TryReceiveCardOrDeckConfigurationThroughIR + jr c, .fail + call PlayCardPopSong + call ClearRPAndRestoreVBlankFunction + or a + ret + +.fail + call PlayCardPopSong + ldtx hl, TransmittingDeckConfigurationUnsuccessfulReceiverText + call LoadLinkNotConnectedSceneAndAskWhetherToTryAgain + jr nc, _ReceiveDeckConfiguration + scf + ret From 8759ee9594a7b72d74ff55fc6cdb3a7b437ce76a Mon Sep 17 00:00:00 2001 From: earthoul Date: Fri, 23 Jan 2026 21:56:31 +0900 Subject: [PATCH 07/15] Refactor IR labels --- src/engine/bank06.asm | 20 ++++++++++---------- src/engine/link/ir_core.asm | 5 +++-- src/engine/link/ir_functions.asm | 18 +++++++++--------- src/wram.asm | 12 +++++++++--- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 7a0f40a..3085ba7 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -2793,8 +2793,8 @@ HandleCardPopCommunications: .loop_request call TryReceiveIRRequest ; receive request jr nc, .execute_commands - bit 1, a - jp nz, .asm_19e7f + bit B_PAD_B, a + jp nz, .cancelled call TrySendIRRequest ; send request jr c, .loop_request @@ -2833,7 +2833,7 @@ HandleCardPopCommunications: jr nz, .fail ld a, STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) - ld [wOtherIRCommunicationParams + 3], a + ld [wOtherIRCommunicationMagicString + 2], a call DecideCardToReceiveFromCardPop call SetCardPopRecord call FillCardPopSummary @@ -2862,12 +2862,12 @@ HandleCardPopCommunications: .fail ld a, [wIRCommunicationErrorCode] cp $01 - jr nz, .asm_19e7f + jr nz, .cancelled ldtx hl, CardPopModeMismatchedText ; Card Pop from one side and Rare Card Pop from the other scf ret -.asm_19e7f +.cancelled ldtx hl, CardPopUnsuccessfulTryAgainText .set_carry scf @@ -2898,9 +2898,9 @@ HandleCardPopCommunications: ld a, BANK("SRAM1") call BankswitchSRAM call CopyDataHLtoDE - ld a, [wOtherIRCommunicationParams + 3] + ld a, [wOtherIRCommunicationMagicString + 2] cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) - jr nz, .asm_19ecb + jr nz, .done ; copy SRAM so that sCardPopRecords is moved $20 forward ld hl, sCardPopRecords + MAX_NUM_CARDPOP_RECORDS * CARDPOP_RECORD_SIZE - 1 @@ -2918,11 +2918,11 @@ HandleCardPopCommunications: ld de, sCardPopRecords ld bc, CARDPOP_RECORD_SIZE call CopyDataHLtoDE -.asm_19ecb +.done xor a call BankswitchSRAM call DisableSRAM - or a + or a ; redundant, leftover from tcg1 ret ; looks up the name in wNameBuffer in wCardPopNameList @@ -3814,7 +3814,7 @@ ENDR ; pressed A call RestoreVBlankFunction ld a, STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) - ld [wOtherIRCommunicationParams + 3], a + ld [wOtherIRCommunicationMagicString + 2], a call HandleCardPopCommunications.success call LoadCardPopSceneAndHandleCommunications.add_sram0 ldtx hl, ReceivedThroughCardPopText diff --git a/src/engine/link/ir_core.asm b/src/engine/link/ir_core.asm index 781c69e..f242df4 100644 --- a/src/engine/link/ir_core.asm +++ b/src/engine/link/ir_core.asm @@ -384,7 +384,7 @@ TrySendIRRequest: pop af ret -; returns carry set if request was not received +; returns carry set and the pressed button (A or B) in a if request was not received TryReceiveIRRequest: call StartIRCommunications ld hl, rRP @@ -394,8 +394,9 @@ TryReceiveIRRequest: jr z, .send_ack ldh a, [rJOYP] cpl - and JOYP_A | JOYP_B + and PAD_A | PAD_B jr z, .wait_request +; not received scf jr .close diff --git a/src/engine/link/ir_functions.asm b/src/engine/link/ir_functions.asm index 0a98278..0fa5c27 100644 --- a/src/engine/link/ir_functions.asm +++ b/src/engine/link/ir_functions.asm @@ -37,7 +37,7 @@ ClearRPAndRestoreVBlankFunction: ; prepares IR communication parameter data ; a = a IRPARAM_* constant for the function of this connection InitIRCommunications: - ld hl, wOwnIRCommunicationParams + ld hl, wOwnIRCommunicationMode ld [hl], a FOR n, IR_MAGIC_STRING_SIZE inc hl @@ -101,7 +101,7 @@ PrepareSendCardOrDeckConfigurationThroughIR: .request_success call ExchangeIRCommunicationParameters ret c - ld a, [wOtherIRCommunicationParams + 3] + ld a, [wOtherIRCommunicationMagicString + 2] cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 2) jr nz, SetIRCommunicationErrorCode_Error or a @@ -116,16 +116,16 @@ ExchangeIRCommunicationParameters: ld c, IR_PARAMS_STRUCT_SIZE call RequestDataTransmissionThroughIR jr c, .error - ld hl, wOtherIRCommunicationParams + 1 + ld hl, wOtherIRCommunicationMagicString ld a, [hli] cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 0) jr nz, .error ld a, [hli] cp STRBYTE("{IR_MAGIC_STRING_TCG2}", 1) jr nz, .error - ld a, [wOwnIRCommunicationParams] - ld hl, wOtherIRCommunicationParams - cp [hl] ; do parameters match? + ld a, [wOwnIRCommunicationMode] + ld hl, wOtherIRCommunicationMode + cp [hl] ; does the mode parameter match? jr nz, SetIRCommunicationErrorCode_Error ; receives wDefaultText from other device @@ -162,7 +162,7 @@ SetIRCommunicationErrorCode_Error: ret SetIRCommunicationErrorCode_NoError: - ld hl, wOwnIRCommunicationParams + ld hl, wOwnIRCommunicationMode ld [hl], NONE ld de, wIRCommunicationErrorCode ld c, 1 @@ -219,7 +219,7 @@ _SendCard: jr c, .fail call ExecuteReceivedIRCommands jr c, .fail - ld a, [wOwnIRCommunicationParams + 1] + ld a, [wOwnIRCommunicationMagicString] cp STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) jr nz, .fail call PlayCardPopSong @@ -247,7 +247,7 @@ _ReceiveCard: call TryReceiveCardOrDeckConfigurationThroughIR jr c, .fail ld a, STRBYTE("{IR_ACK_MAGIC_STRING_TCG2}", 0) - ld [wOwnIRCommunicationParams + 1], a + ld [wOwnIRCommunicationMagicString], a ld hl, wOwnIRCommunicationParams ld e, l ld d, h diff --git a/src/wram.asm b/src/wram.asm index 7e3ddfb..e9523ec 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -94,10 +94,16 @@ wIRCommunicationErrorCode:: ; c5ea ; and received from the other device respectively ; these must match for successful communication wOwnIRCommunicationParams:: ; c5eb - ds IR_PARAMS_STRUCT_SIZE -wOtherIRCommunicationParams:: ; c5ef - ds IR_PARAMS_STRUCT_SIZE +wOwnIRCommunicationMode:: ; c5eb + ds $1 +wOwnIRCommunicationMagicString:: ; c5ec + ds IR_MAGIC_STRING_SIZE +wOtherIRCommunicationParams:: ; c5ef +wOtherIRCommunicationMode:: ; c5ef + ds $1 +wOtherIRCommunicationMagicString:: ; c5f0 + ds IR_MAGIC_STRING_SIZE ; stores the result from LookUpNameInCardPopNameList ; is $ff if name was found in the Card Pop! list From 26c9dbf6df1ca17576f5f2cdae0343d7441c9688 Mon Sep 17 00:00:00 2001 From: earthoul Date: Sun, 25 Jan 2026 12:20:22 +0900 Subject: [PATCH 08/15] Label Pokemon Dome Entrance scripts --- src/engine/bank0b.asm | 81 ++++++++++++++++++++------------------- src/text/text11.asm | 20 +++++----- src/text/text_offsets.asm | 20 +++++----- 3 files changed, 61 insertions(+), 60 deletions(-) diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index 6d9b047..9319f75 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -8116,18 +8116,18 @@ PokemonDomeEntrance_StepEvents: db $ff PokemonDomeEntrance_NPCs: - npc NPC_POKEMON_DOME_FAT_GUY, 8, 3, NORTH, Func_2fe1d + npc NPC_POKEMON_DOME_FAT_GUY, 8, 3, NORTH, PokemonDomeEntrance_AppearAfterGRCoin db $ff PokemonDomeEntrance_NPCInteractions: - npc_script NPC_POKEMON_DOME_FAT_GUY, Func_2fda3 + npc_script NPC_POKEMON_DOME_FAT_GUY, Script_PokemonDomeFatGuy db $ff PokemonDomeEntrance_OWInteractions: ow_script 4, 2, PCMenu ow_script 5, 2, PCMenu - ow_script 9, 1, Func_2fe2a - ow_script 10, 1, Func_2fe2a + ow_script 9, 1, Script_PlateOfLegends + ow_script 10, 1, Script_PlateOfLegends ow_script 1, 2, Script_LegendaryPokemonCardsVol1Book ow_script 2, 2, Script_LegendaryPokemonCardsVol2Book ow_script 3, 2, Script_LegendaryPokemonCardsVol3Book @@ -8146,10 +8146,10 @@ PokemonDomeEntrance_MapScripts: Func_2fd73: ld a, EVENT_GOT_GR_COIN farcall GetEventValue - jr nz, .asm_2fd80 + jr nz, .done ld a, MUSIC_HERE_COMES_GR ld [wNextMusic], a -.asm_2fd80 +.done scf ccf ret @@ -8169,14 +8169,14 @@ Func_2fd8a: Func_2fd93: ld hl, PokemonDomeEntrance_NPCInteractions call Func_328c - jr nc, .asm_2fda1 + jr nc, .done ld hl, PokemonDomeEntrance_OWInteractions call Func_32bf -.asm_2fda1 +.done scf ret -Func_2fda3: +Script_PokemonDomeFatGuy: ld a, NPC_POKEMON_DOME_FAT_GUY ld [wScriptNPC], a ldtx hl, DialogFatGuyText @@ -8188,81 +8188,82 @@ Func_2fda3: start_script start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - script_jump_if_b0z .ows_2fdfa + script_jump_if_b0z .postgame check_event EVENT_FREED_ROD - script_jump_if_b0z .ows_2fdf4 + script_jump_if_b0z .has_rod check_event EVENT_FREED_JACK - script_jump_if_b0z .ows_2fde3 + script_jump_if_b0z .has_jack check_event EVENT_FREED_COURTNEY - script_jump_if_b0z .ows_2fddd + script_jump_if_b0z .has_courtney check_event EVENT_FREED_STEVE - script_jump_if_b0z .ows_2fdd7 - print_npc_text Text102a + script_jump_if_b0z .has_steve +; no grand masters + print_npc_text PokemonDomeFatGuyAllGrandMastersGoneText end_dialog end_script ret -.ows_2fdd7 - print_npc_text Text102b +.has_steve + print_npc_text PokemonDomeFatGuySteveIsBackText end_dialog end_script ret -.ows_2fddd - print_npc_text Text102c +.has_courtney + print_npc_text PokemonDomeFatGuyCourtneyIsBackText end_dialog end_script ret -.ows_2fde3 +.has_jack check_event EVENT_FREED_COURTNEY - script_jump_if_b0z .ows_2fdee - print_npc_text Text102d + script_jump_if_b0z .rod_left + print_npc_text PokemonDomeFatGuyJackIsBackText end_dialog end_script ret -.ows_2fdee - print_npc_text Text102e +.rod_left + print_npc_text PokemonDomeFatGuyWeNeedRodText end_dialog end_script ret -.ows_2fdf4 - print_npc_text Text102f +.has_rod + print_npc_text PokemonDomeFatGuyRodIsBackText end_dialog end_script ret -.ows_2fdfa +.postgame check_event EVENT_SET_UNTIL_MAP_RELOAD_1 - script_jump_if_b0z .ows_2fe17 + script_jump_if_b0z .cup_played get_var VAR_0D compare_loaded_var $02 - script_jump_if_b0nz .ows_2fe11 + script_jump_if_b0nz .cup_active compare_loaded_var $03 - script_jump_if_b0nz .ows_2fe11 - print_npc_text Text1030 + script_jump_if_b0nz .cup_active + print_npc_text PokemonDomeFatGuyGrandMasterCupInactiveText end_dialog end_script ret -.ows_2fe11 - print_npc_text Text1031 +.cup_active + print_npc_text PokemonDomeFatGuyGrandMasterCupActiveText end_dialog end_script ret -.ows_2fe17 - print_npc_text Text1032 +.cup_played + print_npc_text PokemonDomeFatGuyGrandMasterCupPlayedText end_dialog end_script ret -Func_2fe1d: +PokemonDomeEntrance_AppearAfterGRCoin: ld a, EVENT_GOT_GR_COIN farcall GetEventValue - jr nz, .asm_2fe27 + jr nz, .appear scf ret -.asm_2fe27 +.appear scf ccf ret -Func_2fe2a: +Script_PlateOfLegends: ld a, NPC_MARK ld [wScriptNPC], a ldtx hl, DialogPlateOfLegendsText @@ -8273,7 +8274,7 @@ Func_2fe2a: xor a start_script start_dialog - print_npc_text Text1033 + print_npc_text PlateOfLegendsText end_dialog end_script ret diff --git a/src/text/text11.asm b/src/text/text11.asm index 34f43a1..83134b6 100644 --- a/src/text/text11.asm +++ b/src/text/text11.asm @@ -943,7 +943,7 @@ Text1029: linefw "おとずれるが よい" done -Text102a: +PokemonDomeFatGuyAllGrandMastersGoneText: textfw "伝説のポケモンカードを まもっていた" linefw "ポケモンドームの グランドマスターは" linefw "4にんとも GR団によって" @@ -952,7 +952,7 @@ Text102a: linefw "いったい どうなってしまうのだろう" done -Text102b: +PokemonDomeFatGuySteveIsBackText: textfw "イナズマのグランドマスター" linefw "スティーブさんが もどってきたんだ!" linefw "まだ 3にんのグランドマスターが" @@ -961,7 +961,7 @@ Text102b: linefw "たすけだしてくれないかなぁ~" done -Text102c: +PokemonDomeFatGuyCourtneyIsBackText: textfw "やった~ 炎のクイーン!" linefw "ヒロコさんが もどってきたよ!" linefw "いったい だれが" @@ -970,7 +970,7 @@ Text102c: linefw "グランドマスターが あと ふたりだ" done -Text102d: +PokemonDomeFatGuyJackIsBackText: textfw "やあ こおりの グランドマスター" linefw "カネコウジさんが もどってきたよ!" linefw "いったい だれが" @@ -979,7 +979,7 @@ Text102d: linefw "リュウドーさんの ふたりだ" done -Text102e: +PokemonDomeFatGuyWeNeedRodText: textfw "きいたぜ ! きみだって" linefw "グランドマスターを たすけたのは!" linefw "あとは グランドマスターのリーダー" @@ -990,14 +990,14 @@ Text102e: linefw "伝説のポケモンカードを ゲットだ!" done -Text102f: +PokemonDomeFatGuyRodIsBackText: textfw "リュウドーさんも もどってきたし" linefw "ファイナルカップ ふっかつだ!" linefw "4にんのグランドマスターに 勝って" linefw "伝説のポケモンカードを ゲットだ!" done -Text1030: +PokemonDomeFatGuyGrandMasterCupInactiveText: textfw "グランドマスターたちが ひらく" linefw "グランドマスター杯は スゴイ!" linefw "ゆうしょう賞品は" @@ -1008,7 +1008,7 @@ Text1030: linefw "なぞに つつまれているんだ!!" done -Text1031: +PokemonDomeFatGuyGrandMasterCupActiveText: textfw "いま ポケモンドームでは" linefw "グランドマスター杯が かいさい中だ!" linefw "グランドマスター杯は" @@ -1019,7 +1019,7 @@ Text1031: linefw "すきなのを 2枚えらべるんだ!!" done -Text1032: +PokemonDomeFatGuyGrandMasterCupPlayedText: textfw "どうだった!" linefw "ゆうしょう できたかい?" linefw "グランドマスター杯は めったに" @@ -1027,7 +1027,7 @@ Text1032: linefw "つぎは いつになるのかなぁ~" done -Text1033: +PlateOfLegendsText: textfw "「伝説のポケモンカードを" linefw " もとめる ものたちへ" linefw " このポケモンドームに ありし" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 07136ea..1a68793 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -4154,16 +4154,16 @@ SECTION "Text Offsets 2", ROMX textpointer Text1027 ; 0x1027 textpointer Text1028 ; 0x1028 textpointer Text1029 ; 0x1029 - textpointer Text102a ; 0x102a - textpointer Text102b ; 0x102b - textpointer Text102c ; 0x102c - textpointer Text102d ; 0x102d - textpointer Text102e ; 0x102e - textpointer Text102f ; 0x102f - textpointer Text1030 ; 0x1030 - textpointer Text1031 ; 0x1031 - textpointer Text1032 ; 0x1032 - textpointer Text1033 ; 0x1033 + textpointer PokemonDomeFatGuyAllGrandMastersGoneText ; 0x102a + textpointer PokemonDomeFatGuySteveIsBackText ; 0x102b + textpointer PokemonDomeFatGuyCourtneyIsBackText ; 0x102c + textpointer PokemonDomeFatGuyJackIsBackText ; 0x102d + textpointer PokemonDomeFatGuyWeNeedRodText ; 0x102e + textpointer PokemonDomeFatGuyRodIsBackText ; 0x102f + textpointer PokemonDomeFatGuyGrandMasterCupInactiveText ; 0x1030 + textpointer PokemonDomeFatGuyGrandMasterCupActiveText ; 0x1031 + textpointer PokemonDomeFatGuyGrandMasterCupPlayedText ; 0x1032 + textpointer PlateOfLegendsText ; 0x1033 textpointer Text1034 ; 0x1034 textpointer Text1035 ; 0x1035 textpointer Text1036 ; 0x1036 From a57de27eeeecf152edc4627481045e0de44b84f8 Mon Sep 17 00:00:00 2001 From: earthoul Date: Fri, 30 Jan 2026 15:54:01 +0900 Subject: [PATCH 09/15] Label scripts in Pokemon Dome main hall and Final Cup --- src/constants/script_constants.asm | 10 +- src/constants/var_constants.asm | 4 +- src/data/booster_lists.asm | 6 +- src/engine/bank03.asm | 34 +- src/engine/bank0b.asm | 2 +- src/engine/bank0f.asm | 833 +++++++++++++++-------------- src/engine/bank10.asm | 8 +- src/text/text10.asm | 20 +- src/text/text11.asm | 144 ++--- src/text/text_offsets.asm | 164 +++--- tools/constants.py | 14 +- 11 files changed, 623 insertions(+), 616 deletions(-) diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index d53bfa0..5167e16 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -209,10 +209,10 @@ ; Cage flags const EVENT_GODAS_ROOM_CAGE_STATE ; $b9 const EVENT_MIDORIS_ROOM_CAGE_STATE ; $ba - const EVENT_BB ; $bb - const EVENT_BC ; $bc - const EVENT_BD ; $bd ; Grand Master flags + const EVENT_TALKED_TO_COURTNEY_POKEMON_DOME ; $bb + const EVENT_TALKED_TO_STEVE_POKEMON_DOME ; $bc + const EVENT_TALKED_TO_JACK_POKEMON_DOME ; $bd const EVENT_ENTERED_GRAND_MASTER_CUP ; $be const EVENT_FREED_COURTNEY ; $bf const EVENT_FREED_STEVE ; $c0 @@ -245,7 +245,7 @@ const EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT ; $d8 ; Misc flags 2 const EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE ; $d9 - const EVENT_BEAT_GRAND_MASTER_CUP ; $da + const EVENT_BEAT_FINAL_CUP ; $da const EVENT_DB ; $db ; Ghost Master flags const EVENT_GHOST_MASTER_STATUES_STATE ; $dc @@ -266,7 +266,7 @@ const EVENT_TALKED_TO_QUEEN ; $ea ; Misc flags 3 const EVENT_EB ; $eb - const EVENT_EC ; $ec + const EVENT_TALKED_TO_ROD_POKEMON_DOME ; $ec const EVENT_SET_UNTIL_MAP_RELOAD_1 ; $ed const EVENT_EE ; $ee const EVENT_EF ; $ef diff --git a/src/constants/var_constants.asm b/src/constants/var_constants.asm index 5aeb98e..d8e97d3 100644 --- a/src/constants/var_constants.asm +++ b/src/constants/var_constants.asm @@ -11,8 +11,8 @@ const VAR_09 ; $09 const VAR_0A ; $0a const VAR_0B ; $0b - const VAR_0C ; $0c - const VAR_0D ; $0d + const VAR_FINAL_CUP_PLAYED_ROUNDS ; $0c + const VAR_GRAND_MASTER_CUP_STATE ; $0d const VAR_0E ; $0e const VAR_0F ; $0f const VAR_GRANDMASTERCUP_PRIZE_INDEX_0 ; $10 diff --git a/src/data/booster_lists.asm b/src/data/booster_lists.asm index 60ffe49..b42a70a 100644 --- a/src/data/booster_lists.asm +++ b/src/data/booster_lists.asm @@ -252,13 +252,13 @@ BoosterList_cdba: BoosterList_cdbe: booster_list BOOSTERS_GIVE_ALL, BOOSTER_PRESENT_FROM_ALL_SETS -BoosterList_cdc1: +BoosterList_Courtney: booster_list BOOSTERS_GIVE_ALL, BOOSTER_PSYCHIC_BATTLE, BOOSTER_ISLAND_OF_FOSSIL, BOOSTER_BEGINNING_POKEMON -BoosterList_cdc6: +BoosterList_Steve: booster_list BOOSTERS_GIVE_ALL, BOOSTER_PSYCHIC_BATTLE, BOOSTER_ISLAND_OF_FOSSIL -BoosterList_cdca: +BoosterList_Jack: booster_list BOOSTERS_GIVE_ALL, BOOSTER_PSYCHIC_BATTLE, BOOSTER_ISLAND_OF_FOSSIL, BOOSTER_LEGENDARY_POWER BoosterList_cdcf: diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 50c3640..27e620b 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -432,12 +432,12 @@ Func_c2ff: ret Func_c319: - ld a, VAR_0D + ld a, VAR_GRAND_MASTER_CUP_STATE call GetVarValue cp $04 jr c, .asm_c32d jr z, .done - ld a, VAR_0D + ld a, VAR_GRAND_MASTER_CUP_STATE ld c, $01 call SetVarValue jr .done @@ -449,7 +449,7 @@ Func_c319: jr z, .done cp MAP_POKEMON_DOME_BACK jr z, .done - ld a, VAR_0D + ld a, VAR_GRAND_MASTER_CUP_STATE call GetVarValue cp $02 jr z, .done @@ -458,13 +458,13 @@ Func_c319: call GetVarValue cp $0a jr c, .done - ld a, VAR_0D + ld a, VAR_GRAND_MASTER_CUP_STATE ld c, $02 call SetVarValue .done ret .asm_c358 - ld a, VAR_0D + ld a, VAR_GRAND_MASTER_CUP_STATE ld c, $01 call SetVarValue ld a, VAR_20 @@ -2081,9 +2081,9 @@ EventVarMasks: db $1f, %00100000 ; EVENT_TRADED_CARDS_PSYCHIC_STRONGHOLD db $20, %00000001 ; EVENT_GODAS_ROOM_CAGE_STATE db $20, %00000010 ; EVENT_MIDORIS_ROOM_CAGE_STATE - db $21, %00000001 ; EVENT_BB - db $21, %00000010 ; EVENT_BC - db $21, %00000100 ; EVENT_BD + db $21, %00000001 ; EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + db $21, %00000010 ; EVENT_TALKED_TO_STEVE_POKEMON_DOME + db $21, %00000100 ; EVENT_TALKED_TO_JACK_POKEMON_DOME db $21, %00001000 ; EVENT_ENTERED_GRAND_MASTER_CUP db $21, %00010000 ; EVENT_FREED_COURTNEY db $21, %00100000 ; EVENT_FREED_STEVE @@ -2112,7 +2112,7 @@ EventVarMasks: db $25, %00100000 ; EVENT_OPENED_CHEST_FIGHTING_FORT_5 db $25, %01000000 ; EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT db $26, %00000001 ; EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE - db $26, %00000010 ; EVENT_BEAT_GRAND_MASTER_CUP + db $26, %00000010 ; EVENT_BEAT_FINAL_CUP db $26, %00000100 ; EVENT_DB db $27, %00000001 ; EVENT_GHOST_MASTER_STATUES_STATE db $27, %00000010 ; EVENT_BATTLED_TOBICHAN @@ -2130,7 +2130,7 @@ EventVarMasks: db $29, %00001000 ; EVENT_TALKED_TO_ROOK db $29, %00010000 ; EVENT_TALKED_TO_QUEEN db $2a, %00000001 ; EVENT_EB - db $2a, %00000010 ; EVENT_EC + db $2a, %00000010 ; EVENT_TALKED_TO_ROD_POKEMON_DOME db $2b, %00000001 ; EVENT_SET_UNTIL_MAP_RELOAD_1 db $2b, %00000010 ; EVENT_EE db $2b, %00000100 ; EVENT_EF @@ -2155,8 +2155,8 @@ GeneralVarMasks: db $04, %00110000 ; VAR_09 db $04, %11000000 ; VAR_0A db $05, %00000011 ; VAR_0B - db $06, %00000011 ; VAR_0C - db $06, %00011100 ; VAR_0D + db $06, %00000011 ; VAR_FINAL_CUP_PLAYED_ROUNDS + db $06, %00011100 ; VAR_GRAND_MASTER_CUP_STATE db $06, %11100000 ; VAR_0E db $07, %00001111 ; VAR_0F db $08, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_0 @@ -2395,8 +2395,8 @@ CheckTCGIslandMilestoneEvents: jp nz, .set_carry jp .clear_carry -.check_grand_master_cup_or_challenge_machine: - ld a, EVENT_BEAT_GRAND_MASTER_CUP +.check_final_cup_or_postgame: + ld a, EVENT_BEAT_FINAL_CUP call GetEventValue push af ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE @@ -2452,7 +2452,7 @@ CheckTCGIslandMilestoneEvents: dw .check_gr_coin_bottom_left dw .check_pikachu_coin dw .check_gr_coin_bottom_right - dw .check_grand_master_cup_or_challenge_machine + dw .check_final_cup_or_postgame dw .check_event_db ; jump to .check_pointers[a], set carry if the event is set, clear carry if not @@ -2522,7 +2522,7 @@ CheckGRIslandMilestoneEvents: jp nz, .set_carry jp .clear_carry -.check_challenge_machine: +.check_postgame: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE call GetEventValue jp nz, .set_carry @@ -2553,7 +2553,7 @@ CheckGRIslandMilestoneEvents: dw .check_snorlax_coin dw .check_rui_roadblock dw .check_battled_ishihara - dw .check_challenge_machine + dw .check_postgame GetNumberOfDeckDiagnosisStepsUnlocked: push bc diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index 9319f75..ba176d1 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -8232,7 +8232,7 @@ Script_PokemonDomeFatGuy: .postgame check_event EVENT_SET_UNTIL_MAP_RELOAD_1 script_jump_if_b0z .cup_played - get_var VAR_0D + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $02 script_jump_if_b0nz .cup_active compare_loaded_var $03 diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 65792f5..4b045f6 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -2792,34 +2792,34 @@ PokemonDome_StepEvents: db $ff PokemonDome_NPCs: - npc NPC_COURTNEY, 3, 6, EAST, Func_3d7e2 - npc NPC_STEVE, 9, 6, EAST, Func_3d889 - npc NPC_JACK, 12, 6, WEST, Func_3d92c - npc NPC_ROD, 6, 6, SOUTH, Func_3d9b1 - npc NPC_GR_5, 7, 8, SOUTH, Func_3d9fc - npc NPC_TCG_CUP_CLERK_LEFT, 7, 4, SOUTH, Func_3daf0 - npc NPC_TCG_CUP_CLERK_RIGHT, 8, 4, SOUTH, Func_3daf0 - npc NPC_POKEMON_DOME_GR_LASS, 4, 12, EAST, Func_3daf0 - npc NPC_POKEMON_DOME_YOUNGSTER, 9, 8, SOUTH, Func_3daf0 - npc NPC_POKEMON_DOME_SWIMMER, 2, 5, EAST, Func_3daf0 + npc NPC_COURTNEY, 3, 6, EAST, PokemonDome_CourtneyAppearanceCheck + npc NPC_STEVE, 9, 6, EAST, PokemonDome_SteveAppearanceCheck + npc NPC_JACK, 12, 6, WEST, PokemonDome_JackAppearanceCheck + npc NPC_ROD, 6, 6, SOUTH, PokemonDome_RodAppearanceCheck + npc NPC_GR_5, 7, 8, SOUTH, PokemonDome_DisappearAfterGRCoin + npc NPC_TCG_CUP_CLERK_LEFT, 7, 4, SOUTH, PokemonDome_AppearDuringGrandMasterCup + npc NPC_TCG_CUP_CLERK_RIGHT, 8, 4, SOUTH, PokemonDome_AppearDuringGrandMasterCup + npc NPC_POKEMON_DOME_GR_LASS, 4, 12, EAST, PokemonDome_AppearDuringGrandMasterCup + npc NPC_POKEMON_DOME_YOUNGSTER, 9, 8, SOUTH, PokemonDome_AppearDuringGrandMasterCup + npc NPC_POKEMON_DOME_SWIMMER, 2, 5, EAST, PokemonDome_AppearDuringGrandMasterCup db $ff PokemonDome_NPCInteractions: - npc_script NPC_COURTNEY, Func_3d768 - npc_script NPC_STEVE, Func_3d805 - npc_script NPC_JACK, Func_3d8ac - npc_script NPC_ROD, Func_3d94f - npc_script NPC_GR_5, Func_3d9d4 - npc_script NPC_TCG_CUP_CLERK_LEFT, Func_3da09 - npc_script NPC_TCG_CUP_CLERK_RIGHT, Func_3da09 - npc_script NPC_POKEMON_DOME_GR_LASS, Func_3da6c - npc_script NPC_POKEMON_DOME_YOUNGSTER, Func_3da97 - npc_script NPC_POKEMON_DOME_SWIMMER, Func_3dabf + npc_script NPC_COURTNEY, Script_Courtney + npc_script NPC_STEVE, Script_Steve + npc_script NPC_JACK, Script_Jack + npc_script NPC_ROD, Script_Rod + npc_script NPC_GR_5, Script_GR5_PokemonDome + npc_script NPC_TCG_CUP_CLERK_LEFT, Script_GrandMasterCupClerk + npc_script NPC_TCG_CUP_CLERK_RIGHT, Script_GrandMasterCupClerk + npc_script NPC_POKEMON_DOME_GR_LASS, Script_PokemonDomeGRLass + npc_script NPC_POKEMON_DOME_YOUNGSTER, Script_PokemonDomeYoungster + npc_script NPC_POKEMON_DOME_SWIMMER, Script_PokemonDomeSwimmer db $ff PokemonDome_OWInteractions: - ow_script 7, 1, Func_3db13 - ow_script 8, 1, Func_3db13 + ow_script 7, 1, Script_PokemonDomeArenaDoors + ow_script 8, 1, Script_PokemonDomeArenaDoors db $ff PokemonDome_MapScripts: @@ -2836,31 +2836,32 @@ PokemonDome_MapScripts: Func_3d67b: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3d6a1 + jr nz, .check_grand_master_cup ld a, EVENT_FREED_ROD farcall GetEventValue - jr nz, .asm_3d69a + jr nz, .cup_active ld a, EVENT_GOT_GR_COIN farcall GetEventValue - jr nz, .asm_3d6b7 + jr nz, .done +; under gr control ld a, MUSIC_HERE_COMES_GR ld [wNextMusic], a - jr .asm_3d6b7 -.asm_3d69a + jr .done +.cup_active ld a, MUSIC_POKEMON_DOME ld [wNextMusic], a - jr .asm_3d6b7 -.asm_3d6a1 - ld a, VAR_0D + jr .done +.check_grand_master_cup + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr c, .asm_3d6b7 + jr c, .done cp $04 - jr c, .asm_3d69a + jr c, .cup_active ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr nz, .asm_3d69a -.asm_3d6b7 + jr nz, .cup_active +.done scf ccf ret @@ -2883,29 +2884,30 @@ Func_3d6ca: farcall Func_12c0ce ld a, [wPrevMap] cp MAP_POKEMON_DOME_BACK - jr z, .asm_3d6dd + jr z, .cup_played scf ret -.asm_3d6dd +.cup_played ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3d6fc + jr nz, .after_grand_master_cup +; after final cup ld a, OWMODE_SCRIPT ld [wOverworldMode], a - ld a, BANK(Func_3dc4a) + ld a, BANK(Script_RodAfterFinalCup) ld [wOverworldScriptBank], a - ld hl, Func_3dc4a + ld hl, Script_RodAfterFinalCup ld a, l ld [wOverworldScriptPointer], a ld a, h ld [wOverworldScriptPointer + 1], a jr .asm_3d711 -.asm_3d6fc +.after_grand_master_cup ld a, OWMODE_SCRIPT ld [wOverworldMode], a - ld a, BANK(Func_3dc8e) + ld a, BANK(Script_GrandMasterCupClerkAfterTournament) ld [wOverworldScriptBank], a - ld hl, Func_3dc8e + ld hl, Script_GrandMasterCupClerkAfterTournament ld a, l ld [wOverworldScriptPointer], a ld a, h @@ -2920,16 +2922,16 @@ Func_3d6ca: Func_3d719: ld a, [wTempPrevMap] cp MAP_POKEMON_DOME_BACK - jr z, .asm_3d722 + jr z, .cup_played scf ret -.asm_3d722 +.cup_played ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3d72c + jr nz, .after_grand_master_cup scf ret -.asm_3d72c +.after_grand_master_cup ld a, $00 call Func_33a3 scf @@ -2939,10 +2941,10 @@ Func_3d719: Func_3d734: ld a, [wTempPrevMap] cp MAP_POKEMON_DOME_BACK - jr z, .asm_3d73d + jr z, .silent scf ret -.asm_3d73d +.silent scf ccf ret @@ -2950,10 +2952,10 @@ Func_3d734: Func_3d740: ld hl, PokemonDome_NPCInteractions call Func_328c - jr nc, .asm_3d74e + jr nc, .done ld hl, PokemonDome_OWInteractions call Func_32bf -.asm_3d74e +.done scf ret @@ -2965,12 +2967,12 @@ Func_3d750: ret PokemonDome_AfterDuelScripts: - npc_script NPC_COURTNEY, Func_3d7c6 - npc_script NPC_STEVE, Func_3d86d - npc_script NPC_JACK, Func_3d910 + npc_script NPC_COURTNEY, Script_CourtneyAfterDuel + npc_script NPC_STEVE, Script_SteveAfterDuel + npc_script NPC_JACK, Script_JackAfterDuel db $ff -Func_3d768: +Script_Courtney: ld a, NPC_COURTNEY ld [wScriptNPC], a ldtx hl, DialogCourtneyText @@ -2982,85 +2984,85 @@ Func_3d768: start_script start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - script_jump_if_b0z .ows_3d7b3 + script_jump_if_b0z .postgame check_event EVENT_FREED_ROD - script_jump_if_b0z .ows_3d7ad - check_event EVENT_BB - script_jump_if_b0z .ows_3d794 - set_event EVENT_BB - print_npc_text Text0fe8 - script_jump .ows_3d797 -.ows_3d794 - print_npc_text Text0fe9 -.ows_3d797 - ask_question Text0fea, TRUE - script_jump_if_b0z .ows_3d7a7 - print_npc_text Text0feb + script_jump_if_b0z .final_cup + check_event EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + script_jump_if_b0z .repeat + set_event EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + print_npc_text CourtneyWantsToDuelInitialText + script_jump .duel_prompt +.repeat + print_npc_text CourtneyWantsToDuelRepeatText +.duel_prompt + ask_question CourtneyDuelPromptText, TRUE + script_jump_if_b0z .declined + print_npc_text CourtneyDuelStartText end_dialog start_duel GRAND_FIRE_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -.ows_3d7a7 - print_npc_text Text0fec +.declined + print_npc_text CourtneyDeclinedDuelText end_dialog end_script ret -.ows_3d7ad - print_npc_text Text0fed +.final_cup + print_npc_text CourtneyReadyForFinalCupText end_dialog end_script ret -.ows_3d7b3 - check_event EVENT_BB - script_jump_if_b0z .ows_3d7c0 - set_event EVENT_BB - print_npc_text Text0fee - script_jump .ows_3d7c3 -.ows_3d7c0 - print_npc_text Text0fef -.ows_3d7c3 +.postgame + check_event EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + script_jump_if_b0z .postgame_repeat + set_event EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + print_npc_text CourtneyPostgameInitialText + script_jump .postgame_done +.postgame_repeat + print_npc_text CourtneyPostgameRepeatText +.postgame_done end_dialog end_script ret -Func_3d7c6: +Script_CourtneyAfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3d7dc - print_npc_text Text0ff0 - give_booster_packs BoosterList_cdc1 - print_npc_text Text0ff1 - script_jump .ows_3d7df -.ows_3d7dc - print_npc_text Text0ff2 -.ows_3d7df + script_jump_if_b0nz .player_lost + print_npc_text CourtneyPlayerWon1Text + give_booster_packs BoosterList_Courtney + print_npc_text CourtneyPlayerWon2Text + script_jump .done +.player_lost + print_npc_text CourtneyPlayerLostText +.done end_dialog end_script ret -Func_3d7e2: +PokemonDome_CourtneyAppearanceCheck: ld a, EVENT_FREED_COURTNEY farcall GetEventValue - jr z, .asm_3d803 + jr z, .disappear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr nz, .asm_3d803 - ld a, VAR_0D + jr nz, .disappear + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr z, .asm_3d803 + jr z, .disappear cp $03 - jr z, .asm_3d803 + jr z, .disappear scf ccf ret -.asm_3d803 +.disappear scf ret -Func_3d805: +Script_Steve: ld a, NPC_STEVE ld [wScriptNPC], a ldtx hl, DialogSteveText @@ -3072,88 +3074,88 @@ Func_3d805: start_script start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - script_jump_if_b0z .ows_3d854 + script_jump_if_b0z .postgame check_event EVENT_FREED_ROD - script_jump_if_b0z .ows_3d84a - check_event EVENT_BC - script_jump_if_b0z .ows_3d831 - set_event EVENT_BC - print_npc_text Text0ff3 - script_jump .ows_3d834 -.ows_3d831 - print_npc_text Text0ff4 -.ows_3d834 - ask_question Text0ff5, TRUE - script_jump_if_b0z .ows_3d844 - print_npc_text Text0ff6 + script_jump_if_b0z .final_cup + check_event EVENT_TALKED_TO_STEVE_POKEMON_DOME + script_jump_if_b0z .repeat + set_event EVENT_TALKED_TO_STEVE_POKEMON_DOME + print_npc_text SteveWantsToDuelInitialText + script_jump .duel_prompt +.repeat + print_npc_text SteveWantsToDuelRepeatText +.duel_prompt + ask_question SteveDuelPromptText, TRUE + script_jump_if_b0z .declined + print_npc_text SteveDuelStartText end_dialog start_duel LEGENDARY_FOSSIL_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -.ows_3d844 - print_npc_text Text0ff7 +.declined + print_npc_text SteveDeclinedDuelText end_dialog end_script ret -.ows_3d84a - check_event EVENT_BEAT_GRAND_MASTER_CUP - print_variable_npc_text Text0ff8, Text0ff9 +.final_cup + check_event EVENT_BEAT_FINAL_CUP + print_variable_npc_text SteveReadyForFinalCupText, SteveReadyForNextFinalCupText end_dialog end_script ret -.ows_3d854 - check_event EVENT_BC - script_jump_if_b0z .ows_3d861 - set_event EVENT_BC - print_npc_text Text0ffa - script_jump .ows_3d86a -.ows_3d861 - get_var VAR_0D +.postgame + check_event EVENT_TALKED_TO_STEVE_POKEMON_DOME + script_jump_if_b0z .postgame_repeat + set_event EVENT_TALKED_TO_STEVE_POKEMON_DOME + print_npc_text StevePostgameInitialText + script_jump .postgame_done +.postgame_repeat + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $00 - print_variable_npc_text Text0ffb, Text0ffc -.ows_3d86a + print_variable_npc_text StevePostgameRepeatText, SteveGrandMasterCupPlayedText +.postgame_done end_dialog end_script ret -Func_3d86d: +Script_SteveAfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3d883 - print_npc_text Text0ffd - give_booster_packs BoosterList_cdc6 - print_npc_text Text0ffe - script_jump .ows_3d886 -.ows_3d883 - print_npc_text Text0fff -.ows_3d886 + script_jump_if_b0nz .player_lost + print_npc_text StevePlayerWon1Text + give_booster_packs BoosterList_Steve + print_npc_text StevePlayerWon2Text + script_jump .done +.player_lost + print_npc_text StevePlayerLostText +.done end_dialog end_script ret -Func_3d889: +PokemonDome_SteveAppearanceCheck: ld a, EVENT_FREED_STEVE farcall GetEventValue - jr z, .asm_3d8aa + jr z, .disappear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr nz, .asm_3d8aa - ld a, VAR_0D + jr nz, .disappear + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr z, .asm_3d8aa + jr z, .disappear cp $03 - jr z, .asm_3d8aa + jr z, .disappear scf ccf ret -.asm_3d8aa +.disappear scf ret -Func_3d8ac: +Script_Jack: ld a, NPC_JACK ld [wScriptNPC], a ldtx hl, DialogJackText @@ -3165,87 +3167,87 @@ Func_3d8ac: start_script start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - script_jump_if_b0z .ows_3d8f7 + script_jump_if_b0z .postgame check_event EVENT_FREED_ROD - script_jump_if_b0z .ows_3d8f1 - check_event EVENT_BD - script_jump_if_b0z .ows_3d8d8 - set_event EVENT_BD - print_npc_text Text1000 - script_jump .ows_3d8db -.ows_3d8d8 - print_npc_text Text1001 -.ows_3d8db - ask_question Text1002, TRUE - script_jump_if_b0z .ows_3d8eb - print_npc_text Text1003 + script_jump_if_b0z .final_cup + check_event EVENT_TALKED_TO_JACK_POKEMON_DOME + script_jump_if_b0z .repeat + set_event EVENT_TALKED_TO_JACK_POKEMON_DOME + print_npc_text JackWantsToDuelInitialText + script_jump .duel_prompt +.repeat + print_npc_text JackWantsToDuelRepeatText +.duel_prompt + ask_question JackDuelPromptText, TRUE + script_jump_if_b0z .declined + print_npc_text JackDuelStartText end_dialog start_duel WATER_LEGEND_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -.ows_3d8eb - print_npc_text Text1004 +.declined + print_npc_text JackDeclinedDuelText end_dialog end_script ret -.ows_3d8f1 - print_npc_text Text1005 +.final_cup + print_npc_text JackReadyForFinalCupText end_dialog end_script ret -.ows_3d8f7 - check_event EVENT_BD - script_jump_if_b0z .ows_3d904 - set_event EVENT_BD - print_npc_text Text1006 - script_jump .ows_3d90d -.ows_3d904 - get_var VAR_0D +.postgame + check_event EVENT_TALKED_TO_JACK_POKEMON_DOME + script_jump_if_b0z .postgame_repeat + set_event EVENT_TALKED_TO_JACK_POKEMON_DOME + print_npc_text JackPostgameInitialText + script_jump .postgame_done +.postgame_repeat + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $00 - print_variable_npc_text Text1007, Text1008 -.ows_3d90d + print_variable_npc_text JackPostgameRepeatText, JackGrandMasterCupPlayedText +.postgame_done end_dialog end_script ret -Func_3d910: +Script_JackAfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3d926 - print_npc_text Text1009 - give_booster_packs BoosterList_cdca - print_npc_text Text100a - script_jump .ows_3d929 -.ows_3d926 - print_npc_text Text100b -.ows_3d929 + script_jump_if_b0nz .player_lost + print_npc_text JackPlayerWon1Text + give_booster_packs BoosterList_Jack + print_npc_text JackPlayerWon2Text + script_jump .done +.player_lost + print_npc_text JackPlayerLostText +.done end_dialog end_script ret -Func_3d92c: +PokemonDome_JackAppearanceCheck: ld a, EVENT_FREED_JACK farcall GetEventValue - jr z, .asm_3d94d + jr z, .disappear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr nz, .asm_3d94d - ld a, VAR_0D + jr nz, .disappear + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr z, .asm_3d94d + jr z, .disappear cp $03 - jr z, .asm_3d94d + jr z, .disappear scf ccf ret -.asm_3d94d +.disappear scf ret -Func_3d94f: +Script_Rod: ld a, NPC_ROD ld [wScriptNPC], a ldtx hl, DialogRodText @@ -3257,66 +3259,66 @@ Func_3d94f: start_script start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - script_jump_if_b0z .ows_3d998 - check_event EVENT_BEAT_GRAND_MASTER_CUP - script_jump_if_b0z .ows_3d981 + script_jump_if_b0z .postgame + check_event EVENT_BEAT_FINAL_CUP + script_jump_if_b0z .final_cup_again check_event EVENT_ENTERED_GRAND_MASTER_CUP - script_jump_if_b0z .ows_3d97b + script_jump_if_b0z .repeat set_event EVENT_ENTERED_GRAND_MASTER_CUP - print_npc_text Text100c - script_jump .ows_3d984 -.ows_3d97b - print_npc_text Text100d - script_jump .ows_3d984 -.ows_3d981 - print_npc_text Text100e -.ows_3d984 - ask_question Text100f, TRUE - script_jump_if_b0z .ows_3d992 - print_npc_text Text1010 + print_npc_text RodWantsToStartFinalCupInitialText + script_jump .enter_prompt +.repeat + print_npc_text RodWantsToStartFinalCupRepeatText + script_jump .enter_prompt +.final_cup_again + print_npc_text RodWantsToStartNextFinalCupText +.enter_prompt + ask_question FinalCupEnterPrompt, TRUE + script_jump_if_b0z .declined + print_npc_text RodFinalCupEnterAcceptedPrompt end_dialog - script_jump Script_3db41 -.ows_3d992 - print_npc_text Text1011 + script_jump Script_MoveGrandMastersAndPlayerIntoFinalCup +.declined + print_npc_text RodFinalCupEnterDeclinedPrompt end_dialog end_script ret -.ows_3d998 +.postgame check_event EVENT_ENTERED_GRAND_MASTER_CUP - script_jump_if_b0z .ows_3d9a5 + script_jump_if_b0z .check_cup_state set_event EVENT_ENTERED_GRAND_MASTER_CUP - print_npc_text Text1012 - script_jump .ows_3d9ae -.ows_3d9a5 - get_var VAR_0D + print_npc_text RodPostgameInitialText + script_jump .done +.check_cup_state + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $00 - print_variable_npc_text Text1013, Text1014 -.ows_3d9ae + print_variable_npc_text RodPostgameRepeatText, RodGrandMasterCupPlayedText +.done end_dialog end_script ret -Func_3d9b1: +PokemonDome_RodAppearanceCheck: ld a, EVENT_FREED_ROD farcall GetEventValue - jr z, .asm_3d9d2 + jr z, .disappear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr nz, .asm_3d9d2 - ld a, VAR_0D + jr nz, .disappear + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr z, .asm_3d9d2 + jr z, .disappear cp $03 - jr z, .asm_3d9d2 + jr z, .disappear scf ccf ret -.asm_3d9d2 +.disappear scf ret -Func_3d9d4: +Script_GR5_PokemonDome: ld a, NPC_GR_5 ld [wScriptNPC], a ldtx hl, DialogGR5Text @@ -3328,29 +3330,29 @@ Func_3d9d4: start_script start_dialog check_event EVENT_TALKED_TO_GR5_POKEMON_DOME - script_jump_if_b0z .ows_3d9f6 + script_jump_if_b0z .repeat set_event EVENT_TALKED_TO_GR5_POKEMON_DOME - print_npc_text Text1015 - script_jump .ows_3d9f9 -.ows_3d9f6 - print_npc_text Text1016 -.ows_3d9f9 + print_npc_text PokemonDomeGR5PreachInitialText + script_jump .done +.repeat + print_npc_text PokemonDomeGR5PreachRepeatText +.done end_dialog end_script ret -Func_3d9fc: +PokemonDome_DisappearAfterGRCoin: ld a, EVENT_GOT_GR_COIN farcall GetEventValue - jr z, .asm_3da06 + jr z, .appear scf ret -.asm_3da06 +.appear scf ccf ret -Func_3da09: +Script_GrandMasterCupClerk: ld a, NPC_TCG_CUP_CLERK_LEFT ld [wScriptNPC], a ldtx hl, DialogReceptionistText @@ -3361,41 +3363,41 @@ Func_3da09: xor a start_script start_dialog - get_var VAR_0D + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $05 - script_jump_if_b1z .ows_3da48 + script_jump_if_b1z .cup_played compare_loaded_var $02 - script_jump_if_b0z .ows_3da31 - set_var VAR_0D, $03 + script_jump_if_b0z .prizes_set + set_var VAR_GRAND_MASTER_CUP_STATE, $03 script_call Script_SetGrandMasterCupPrizes -.ows_3da31 +.prizes_set print_npc_text GrandMasterCupClerkWelcomeText script_call Script_LoadFirstTwoGrandMasterCupPrizeCardNames print_npc_text GrandMasterCupClerkPrizesText script_call Script_LoadLastTwoGrandMasterCupPrizeCardNames print_npc_text GrandMasterCupClerkPrizesText print_npc_text GrandMasterCupClerkInviteText - script_jump .ows_3da52 -.ows_3da48 + script_jump .enter_prompt +.cup_played compare_loaded_var $06 print_variable_npc_text GrandMasterCupClerkPlayerLostText, GrandMasterCupClerkPlayerWonGrandFinalText - script_jump .ows_3da69 -.ows_3da52 + script_jump .done +.enter_prompt ask_question GrandMasterCupClerkEnterPromptText, TRUE script_jump_if_b0z .declined - set_var VAR_0D, $04 + set_var VAR_GRAND_MASTER_CUP_STATE, $04 set_var VAR_20, $00 print_npc_text GrandMasterCupClerkEnterAcceptedText end_dialog - script_jump Script_3dbde + script_jump Script_MovePlayerIntoGrandMasterCup .declined print_npc_text GrandMasterCupClerkEnterDeclinedText -.ows_3da69 +.done end_dialog end_script ret -Func_3da6c: +Script_PokemonDomeGRLass: ld a, NPC_POKEMON_DOME_GR_LASS ld [wScriptNPC], a ldtx hl, DialogGRKidText @@ -3406,20 +3408,20 @@ Func_3da6c: xor a start_script start_dialog - print_npc_text Text101f - get_var VAR_0D + print_npc_text PokemonDomeGRLassSpectatorText + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $05 - script_jump_if_b1z .ows_3da91 - print_npc_text Text1020 - script_jump .ows_3da94 -.ows_3da91 - print_npc_text Text1021 -.ows_3da94 + script_jump_if_b1z .cup_played + print_npc_text PokemonDomeGRLassAnticipatingText + script_jump .done +.cup_played + print_npc_text PokemonDomeGRLassSpectatedText +.done end_dialog end_script ret -Func_3da97: +Script_PokemonDomeYoungster: ld a, NPC_POKEMON_DOME_YOUNGSTER ld [wScriptNPC], a ldtx hl, DialogLadText @@ -3430,19 +3432,19 @@ Func_3da97: xor a start_script start_dialog - get_var VAR_0D + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $05 - script_jump_if_b1z .ows_3dab9 - print_npc_text Text1022 - script_jump .ows_3dabc -.ows_3dab9 - print_npc_text Text1023 -.ows_3dabc + script_jump_if_b1z .cup_played + print_npc_text PokemonDomeYoungsterSpectatorText + script_jump .done +.cup_played + print_npc_text PokemonDomeYoungsterSpectatedText +.done end_dialog end_script ret -Func_3dabf: +Script_PokemonDomeSwimmer: ld a, NPC_POKEMON_DOME_SWIMMER ld [wScriptNPC], a ldtx hl, DialogSwimmerKidText @@ -3453,64 +3455,64 @@ Func_3dabf: xor a start_script start_dialog - get_var VAR_0D + get_var VAR_GRAND_MASTER_CUP_STATE compare_loaded_var $05 - script_jump_if_b0nz .ows_3dae4 - script_jump_if_b1z .ows_3daea - print_npc_text Text1024 - script_jump .ows_3daed -.ows_3dae4 - print_npc_text Text1025 - script_jump .ows_3daed -.ows_3daea - print_npc_text Text1026 -.ows_3daed + script_jump_if_b0nz .player_won + script_jump_if_b1z .player_lost + print_npc_text PokemonDomeSwimmerSpectatorText + script_jump .done +.player_won + print_npc_text PokemonDomeSwimmerPlayerWonCupText + script_jump .done +.player_lost + print_npc_text PokemonDomeSwimmerPlayerLostCupText +.done end_dialog end_script ret -Func_3daf0: +PokemonDome_AppearDuringGrandMasterCup: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr z, .asm_3db11 - ld a, VAR_0D + jr z, .disappear + ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue cp $02 - jr c, .asm_3db11 + jr c, .disappear cp $04 - jr c, .asm_3db0e + jr c, .appear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue - jr z, .asm_3db11 -.asm_3db0e + jr z, .disappear +.appear scf ccf ret -.asm_3db11 +.disappear scf ret -Func_3db13: +Script_PokemonDomeArenaDoors: xor a start_script check_event EVENT_GOT_GR_COIN - script_jump_if_b0z .ows_3db30 + script_jump_if_b0z .no_gr5 set_active_npc NPC_GR_5, DialogGR5Text move_active_npc .NPCMovement_3db3b wait_for_player_animation start_dialog - print_npc_text Text1027 + print_npc_text PokemonDomeGR5SealedArenaDoorsText end_dialog move_active_npc .NPCMovement_3db3e wait_for_player_animation end_script - jr .asm_3db36 -.ows_3db30 + jr .done +.no_gr5 start_dialog print_text DoorsAreShutText end_dialog end_script -.asm_3db36 +.done farcall OverworldResumeAndHandlePlayerMoveInput ret .NPCMovement_3db3b: @@ -3520,7 +3522,7 @@ Func_3db13: db SOUTH, MOVE_4 db $ff -Script_3db41: +Script_MoveGrandMastersAndPlayerIntoFinalCup: get_player_direction compare_loaded_var NORTH script_jump_if_b0nz .ows_3db5a @@ -3541,7 +3543,7 @@ Script_3db41: wait_for_player_animation do_frames 30 play_sfx SFX_DOORS - load_tilemap TILEMAP_038, $07, $00 + load_tilemap TILEMAP_038, 7, 0 do_frames 30 move_npc NPC_ROD, .NPCMovement_3dbca move_npc NPC_STEVE, .NPCMovement_3dbca @@ -3554,7 +3556,7 @@ Script_3db41: wait_for_player_animation do_frames 60 play_sfx SFX_DOORS - load_tilemap TILEMAP_037, $07, $00 + load_tilemap TILEMAP_037, 7, 0 do_frames 30 end_script ld a, MAP_POKEMON_DOME_BACK @@ -3603,7 +3605,7 @@ Script_3db41: db NORTH, MOVE_4 db $ff -Script_3dbde: +Script_MovePlayerIntoGrandMasterCup: get_player_x_position compare_loaded_var $08 script_jump_if_b1z .ows_3dbff @@ -3632,7 +3634,7 @@ Script_3dbde: do_frames 30 set_scroll_state $02 play_sfx SFX_DOORS - load_tilemap TILEMAP_038, $07, $00 + load_tilemap TILEMAP_038, 7, 0 do_frames 30 animate_player_movement $00, $01 animate_player_movement $00, $01 @@ -3657,7 +3659,7 @@ Script_3dbde: db NORTH, MOVE_4 db $ff -Func_3dc4a: +Script_RodAfterFinalCup: ld a, NPC_ROD ld [wScriptNPC], a ldtx hl, DialogRodText @@ -3667,15 +3669,15 @@ Func_3dc4a: ld [wScriptNPCName + 1], a ld a, EVENT_EE farcall GetEventValue - jr z, .asm_3dc88 + jr z, .resume xor a start_script - check_event EVENT_EC - script_jump_if_b0z .ows_3dc82 - set_event EVENT_EC + check_event EVENT_TALKED_TO_ROD_POKEMON_DOME + script_jump_if_b0z .repeat + set_event EVENT_TALKED_TO_ROD_POKEMON_DOME do_frames 30 start_dialog - print_npc_text Text1028 + print_npc_text RodIAmGrandMasterLeaderText end_dialog do_frames 15 set_player_direction EAST @@ -3684,17 +3686,17 @@ Func_3dc4a: do_frames 30 set_player_direction SOUTH do_frames 30 -.ows_3dc82 +.repeat start_dialog - print_npc_text Text1029 + print_npc_text RodRevisitPokemonDomeForNextFinalCupText end_dialog end_script -.asm_3dc88 +.resume ld a, OWMODE_IDLE ld [wOverworldMode], a ret -Func_3dc8e: +Script_GrandMasterCupClerkAfterTournament: ld a, NPC_TCG_CUP_CLERK_LEFT ld [wScriptNPC], a ldtx hl, DialogReceptionistText @@ -3810,7 +3812,7 @@ PokemonDomeBack_NPCs: npc NPC_STEVE, 8, 12, SOUTH, NULL npc NPC_JACK, 8, 13, SOUTH, NULL npc NPC_ROD, 7, 12, SOUTH, NULL - npc NPC_CUP_HOST, 7, 2, SOUTH, Func_3e68b + npc NPC_CUP_HOST, 7, 2, SOUTH, PokemonDomeBack_AppearOnPostgame db $ff PokemonDomeBack_MapScripts: @@ -3839,7 +3841,8 @@ Func_3ddaf: Func_3ddb8: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3ddec + jr nz, .grand_master_cup +; final cup ld a, NPC_CUP_HOST lb de, 8, 14 ld b, NORTH @@ -3849,16 +3852,16 @@ Func_3ddb8: farcall SetOWObjectAsScrollTarget ld a, OWMODE_SCRIPT ld [wOverworldMode], a - ld a, BANK(Func_3ded6) + ld a, BANK(Script_FinalCupIntroAndRound1Start) ld [wOverworldScriptBank], a - ld hl, Func_3ded6 + ld hl, Script_FinalCupIntroAndRound1Start ld a, l ld [wOverworldScriptPointer], a ld a, h ld [wOverworldScriptPointer + 1], a scf ret -.asm_3ddec +.grand_master_cup ld bc, TILEMAP_0B9 lb de, 5, 0 farcall Func_12c0ce @@ -3920,44 +3923,48 @@ Func_3de6f: PokemonDomeBack_AfterDuel: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr z, .asm_3de7d + jr z, .final_cup +; grand master cup jp Func_3e2a4 -.asm_3de7d - ld a, VAR_0C +.final_cup + ld a, VAR_FINAL_CUP_PLAYED_ROUNDS farcall GetVarValue - jp z, Func_3df57 + jp z, Script_FinalCupRound1AfterDuel dec a - jp z, Func_3dfc3 + jp z, Script_FinalCupRound2AfterDuel dec a - jp z, Func_3e02f - jp Func_3e091 + jp z, Script_FinalCupRound3AfterDuel + jp Script_FinalCupRound4AfterDuel Func_3de91: farcall OverworldResumeWithCurSong ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3deb5 - call .asm_3dea2 - jr .asm_3dec7 -.asm_3dea2: + jr nz, .postgame + + call .FinalCup + jr .done +.FinalCup: xor a start_script reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY - get_var VAR_0C - compare_loaded_var $02 - script_jump_if_b1nz Script_3df8d - script_jump_if_b0nz Script_3dff9 - script_jump Script_3e069 -.asm_3deb5 - call .asm_3deba - jr .asm_3dec7 -.asm_3deba + get_var VAR_FINAL_CUP_PLAYED_ROUNDS + compare_loaded_var 2 + script_jump_if_b1nz Script_FinalCupRound2Start + script_jump_if_b0nz Script_FinalCupRound3Start + script_jump Script_FinalCupRound4Start + +.postgame + call .GrandMasterCup + jr .done +.GrandMasterCup: farcall Func_45573 xor a start_script reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY script_jump Script_3e158 -.asm_3dec7 + +.done scf ccf ret @@ -3969,7 +3976,7 @@ Func_3deca: farcall Func_45573 ret -Func_3ded6: +Script_FinalCupIntroAndRound1Start: xor a start_script move_npc NPC_ROD, .NPCMovement_3df13 @@ -3984,11 +3991,11 @@ Func_3ded6: unload_npc NPC_CUP_HOST set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0f9a + print_npc_text RodFinalCupIntroAndRound1OpponentText end_dialog move_npc NPC_COURTNEY, .NPCMovement_3df3f wait_for_player_animation - script_jump .ows_3df46 + script_jump .round1 .NPCMovement_3df0a: db NORTH, MOVE_3 db WEST, MOVE_3 @@ -4028,37 +4035,37 @@ Func_3ded6: db SOUTH, MOVE_2 db WEST, MOVE_1 db $ff -.ows_3df46 - set_var VAR_0C, $00 +.round1 + set_var VAR_FINAL_CUP_PLAYED_ROUNDS, 0 set_active_npc NPC_COURTNEY, DialogCourtneyText start_dialog - print_npc_text Text0f9b + print_npc_text CourtneyFinalCupDuelStartText end_dialog start_duel GRAND_FIRE_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -Func_3df57: +Script_FinalCupRound1AfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3df7a - print_npc_text Text0f9c + script_jump_if_b0nz .lost_round1 + print_npc_text CourtneyTournamentsPlayerWonText end_dialog move_active_npc .NPCMovement_3df81 wait_for_player_animation set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0f9d + print_npc_text RodFinalCupRound1NextOpponentText end_dialog move_npc NPC_STEVE, .NPCMovement_3df8a wait_for_player_animation - script_jump Script_3df8d -.ows_3df7a - print_npc_text Text0f9e + script_jump Script_FinalCupRound2Start +.lost_round1 + print_npc_text CourtneyFinalCupPlayerLostText end_dialog - script_jump Script_3e105 + script_jump Script_FinalCupPlayerLost .NPCMovement_3df81: db EAST, MOVE_1 db NORTH, MOVE_2 @@ -4069,53 +4076,53 @@ Func_3df57: db WEST, MOVE_2 db $ff -Script_3df8d: - set_var VAR_0C, $01 +Script_FinalCupRound2Start: + set_var VAR_FINAL_CUP_PLAYED_ROUNDS, 1 set_active_npc NPC_STEVE, DialogSteveText start_dialog - print_npc_text Text0f9f + print_npc_text SteveFinalCupReadyToDuelText set_active_npc NPC_ROD, DialogRodText -.ows_3df9c - print_npc_text Text0fa0 +.loop_prep + print_npc_text RodFinalCupAreYourDecksReadyText ask_question DuelPrepPromptText, FALSE - script_jump_if_b0z .ows_3dfb0 + script_jump_if_b0z .start_duel end_dialog set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY open_menu reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY start_dialog - script_jump .ows_3df9c -.ows_3dfb0 + script_jump .loop_prep +.start_duel set_text_ram2 DialogSteveText - print_npc_text Text0fa1 + print_npc_text RodFinalCupResumeRoundText set_active_npc NPC_STEVE, DialogSteveText - print_npc_text Text0fa2 + print_npc_text SteveFinalCupDuelStartText end_dialog start_duel LEGENDARY_FOSSIL_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -Func_3dfc3: +Script_FinalCupRound2AfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3dfe6 - print_npc_text Text0fa3 + script_jump_if_b0nz .lost_round2 + print_npc_text SteveTournamentsPlayerWonText end_dialog move_active_npc .NPCMovement_3dfed wait_for_player_animation set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0fa4 + print_npc_text RodFinalCupRound2NextOpponentText end_dialog move_npc NPC_JACK, .NPCMovement_3dff2 wait_for_player_animation - script_jump Script_3dff9 -.ows_3dfe6 - print_npc_text Text0fa5 + script_jump Script_FinalCupRound3Start +.lost_round2 + print_npc_text SteveTournamentsPlayerLostText end_dialog - script_jump Script_3e105 + script_jump Script_FinalCupPlayerLost .NPCMovement_3dfed: db EAST, MOVE_2 db WEST, MOVE_0 @@ -4126,53 +4133,53 @@ Func_3dfc3: db WEST, MOVE_1 db $ff -Script_3dff9: - set_var VAR_0C, $02 +Script_FinalCupRound3Start: + set_var VAR_FINAL_CUP_PLAYED_ROUNDS, 2 set_active_npc NPC_JACK, DialogJackText start_dialog - print_npc_text Text0fa6 + print_npc_text JackFinalCupReadyToDuelText set_active_npc NPC_ROD, DialogRodText -.ows_3e008 - print_npc_text Text0fa0 +.loop_prep + print_npc_text RodFinalCupAreYourDecksReadyText ask_question DuelPrepPromptText, FALSE - script_jump_if_b0z .ows_3e01c + script_jump_if_b0z .start_duel end_dialog set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY open_menu reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY start_dialog - script_jump .ows_3e008 -.ows_3e01c + script_jump .loop_prep +.start_duel set_text_ram2 DialogJackText - print_npc_text Text0fa1 + print_npc_text RodFinalCupResumeRoundText set_active_npc NPC_JACK, DialogJackText - print_npc_text Text0fa7 + print_npc_text JackFinalCupDuelStartText end_dialog start_duel WATER_LEGEND_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -Func_3e02f: +Script_FinalCupRound3AfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e052 - print_npc_text Text0fa8 + script_jump_if_b0nz .lost_round3 + print_npc_text JackFinalCupPlayerWonText end_dialog move_active_npc .NPCMovement_3e059 wait_for_player_animation set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0fa9 + print_npc_text RodFinalCupRound3NextOpponentText end_dialog move_npc NPC_ROD, .NPCMovement_3e062 wait_for_player_animation - script_jump Script_3e069 -.ows_3e052 - print_npc_text Text0faa + script_jump Script_FinalCupRound4Start +.lost_round3 + print_npc_text JackTournamentsPlayerLostText end_dialog - script_jump Script_3e105 + script_jump Script_FinalCupPlayerLost .NPCMovement_3e059: db EAST, MOVE_1 db SOUTH, MOVE_2 @@ -4185,70 +4192,70 @@ Func_3e02f: db WEST, MOVE_1 db $ff -Script_3e069: - set_var VAR_0C, $03 +Script_FinalCupRound4Start: + set_var VAR_FINAL_CUP_PLAYED_ROUNDS, 3 set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0fab -.ows_3e074 - print_npc_text Text0fa0 + print_npc_text RodFinalCupReadyToDuelText +.loop_prep + print_npc_text RodFinalCupAreYourDecksReadyText ask_question DuelPrepPromptText, FALSE - script_jump_if_b0z .ows_3e088 + script_jump_if_b0z .start_duel end_dialog set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY open_menu reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY start_dialog - script_jump .ows_3e074 -.ows_3e088 - print_npc_text Text0fac + script_jump .loop_prep +.start_duel + print_npc_text RodFinalCupDuelStartText end_dialog start_duel GREAT_DRAGON_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script ret -Func_3e091: +Script_FinalCupRound4AfterDuel: xor a start_script start_dialog check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e0a2 - print_npc_text Text0fad + script_jump_if_b0nz .lost_round4 + print_npc_text RodTournamentsPlayerWonText end_dialog - script_jump .ows_3e0b2 -.ows_3e0a2 - print_npc_text Text0fae + script_jump .proceed_prizes +.lost_round4 + print_npc_text RodTournamentsPlayerLostText end_dialog move_active_npc .NPCMovement_3e0ad wait_for_player_animation - script_jump Script_3e105 + script_jump Script_FinalCupPlayerLost .NPCMovement_3e0ad: db NORTH, MOVE_2 db WEST, MOVE_2 db $ff -.ows_3e0b2 - set_event EVENT_BEAT_GRAND_MASTER_CUP +.proceed_prizes + set_event EVENT_BEAT_FINAL_CUP set_event EVENT_SET_UNTIL_MAP_RELOAD_1 move_active_npc .NPCMovement_3e0fe wait_for_player_animation set_player_direction NORTH start_dialog - print_npc_text Text0faf + print_npc_text RodYouDeserveLegendaryCardsText quit_script farcall Func_1022a - ld de, $7b + ld de, MOLTRES_LV40 farcall Func_c646 - ld de, $e1 + ld de, ZAPDOS_LV68 farcall Func_c646 - ld de, $b9 + ld de, ARTICUNO_LV37 farcall Func_c646 - ld de, $183 + ld de, DRAGONITE_LV41 farcall Func_c646 farcall Func_10252 call WaitPalFading ld a, $01 start_script - print_npc_text Text0fb0 + print_npc_text RodChallengeBiruritchiText end_dialog end_script ld a, MAP_POKEMON_DOME @@ -4262,7 +4269,7 @@ Func_3e091: db SOUTH, MOVE_1 db $ff -Script_3e105: +Script_FinalCupPlayerLost: set_event EVENT_SET_UNTIL_MAP_RELOAD_1 set_event EVENT_EE move_npc NPC_ROD, .NPCMovement_3e126 @@ -4270,7 +4277,7 @@ Script_3e105: set_player_direction NORTH set_active_npc NPC_ROD, DialogRodText start_dialog - print_npc_text Text0fb1 + print_npc_text RodYouDoNotDeserveLegendaryCardsText end_dialog end_script ld a, MAP_POKEMON_DOME @@ -4711,7 +4718,7 @@ Func_3e2a4: set_active_npc NPC_COURTNEY, DialogCourtneyText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 script_jump_if_b0nz .ows_3e4a3 - print_npc_text Text0f9c + print_npc_text CourtneyTournamentsPlayerWonText script_jump .ows_3e5c4 .ows_3e4a3 print_npc_text Text0fd6 @@ -4755,10 +4762,10 @@ Func_3e2a4: set_active_npc NPC_STEVE, DialogSteveText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 script_jump_if_b0nz .ows_3e504 - print_npc_text Text0fa3 + print_npc_text SteveTournamentsPlayerWonText script_jump .ows_3e5c4 .ows_3e504 - print_npc_text Text0fa5 + print_npc_text SteveTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogSteveText print_npc_text Text0fd7 @@ -4800,7 +4807,7 @@ Func_3e2a4: print_npc_text Text0fdc script_jump .ows_3e5c4 .ows_3e561 - print_npc_text Text0faa + print_npc_text JackTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogJackText print_npc_text Text0fd7 @@ -4833,10 +4840,10 @@ Func_3e2a4: set_active_npc NPC_ROD, DialogRodText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 script_jump_if_b0nz .ows_3e5b3 - print_npc_text Text0fad + print_npc_text RodTournamentsPlayerWonText script_jump .ows_3e5c4 .ows_3e5b3 - print_npc_text Text0fae + print_npc_text RodTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogRodText print_npc_text Text0fd7 @@ -4844,7 +4851,7 @@ Func_3e2a4: script_jump .ows_3e65d .ows_3e5c4 set_event EVENT_DB - set_var VAR_0D, $05 + set_var VAR_GRAND_MASTER_CUP_STATE, $05 set_event EVENT_SET_UNTIL_MAP_RELOAD_1 set_active_npc NPC_CUP_HOST, DialogCupHostText print_npc_text Text0fdf @@ -4917,7 +4924,7 @@ Func_3e2a4: db $ff .ows_3e65d: - set_var VAR_0D, $06 + set_var VAR_GRAND_MASTER_CUP_STATE, $06 set_event EVENT_SET_UNTIL_MAP_RELOAD_1 set_active_npc NPC_CUP_HOST, DialogCupHostText move_active_npc .NPCMovement_3e681 @@ -4943,13 +4950,13 @@ Func_3e2a4: db $ff ; end mega function -Func_3e68b: +PokemonDomeBack_AppearOnPostgame: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue - jr nz, .asm_3e695 + jr nz, .appear scf ret -.asm_3e695 +.appear scf ccf ret diff --git a/src/engine/bank10.asm b/src/engine/bank10.asm index 480c1cb..93d3d9f 100644 --- a/src/engine/bank10.asm +++ b/src/engine/bank10.asm @@ -5658,7 +5658,7 @@ Script_43000: print_npc_text Text0928 receive_card GRS_MEWTWO set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - set_event EVENT_BEAT_GRAND_MASTER_CUP + set_event EVENT_BEAT_FINAL_CUP reset_event EVENT_TALKED_TO_MITCH reset_event EVENT_TALKED_TO_AMY reset_event EVENT_TALKED_TO_KEN @@ -5667,9 +5667,9 @@ Script_43000: reset_event EVENT_TALKED_TO_HIDERO reset_event EVENT_TALKED_TO_KANZAKI reset_event EVENT_TALKED_TO_ISHIHARA - reset_event EVENT_BB - reset_event EVENT_BC - reset_event EVENT_BD + reset_event EVENT_TALKED_TO_COURTNEY_POKEMON_DOME + reset_event EVENT_TALKED_TO_STEVE_POKEMON_DOME + reset_event EVENT_TALKED_TO_JACK_POKEMON_DOME reset_event EVENT_ENTERED_GRAND_MASTER_CUP set_var VAR_0B, $01 var_add VAR_27, $05 diff --git a/src/text/text10.asm b/src/text/text10.asm index 16f7492..1805920 100644 --- a/src/text/text10.asm +++ b/src/text/text10.asm @@ -1681,7 +1681,7 @@ Text0f99: linefw "メンツも たもてんからな" done -Text0f9a: +RodFinalCupIntroAndRound1OpponentText: textfw "さあ くん" linefw "ファイナルカップを はじめよう" linefw "われらが 伝説のポケモンカードを" @@ -1692,7 +1692,7 @@ Text0f9a: linefw "ヒロコと 対戦してもらおう!" done -Text0f9b: +CourtneyFinalCupDuelStartText: textfw "ウフフ・・・アタシが 1人目よ" linefw "炎のクイーン・ヒ・ロ・コ!" linefw "いくわよ くん" @@ -1701,46 +1701,46 @@ Text0f9b: linefw "ウフフ・・・ さあ いくわよ!" done -Text0f9c: +CourtneyTournamentsPlayerWonText: textfw "ウフフ・・・アタシの まけよ" linefw "さすがね くん" done -Text0f9d: +RodFinalCupRound1NextOpponentText: textfw "つぎは スティーブと対戦だ!" linefw "くん!" done -Text0f9e: +CourtneyFinalCupPlayerLostText: textfw "ウフフ・・・" linefw "アタシの か・ち・よ" linefw "そんなんじゃ" linefw "GR団には 勝てないわよ" done -Text0f9f: +SteveFinalCupReadyToDuelText: textfw "ヘイ !" linefw "ミーと ポケモンカードバトルね" linefw "サンダー・スティーブとの対戦は" linefw "ビッグ グレートね!" done -Text0fa0: +RodFinalCupAreYourDecksReadyText: textfw "くん" linefw "デッキのじゅんびは いいかね?" done -Text0fa1: +RodFinalCupResumeRoundText: textfw "では" linefw "との対戦を はじめよう" done -Text0fa2: +SteveFinalCupDuelStartText: textfw "サイドは シックスカード!" linefw "レディ? ゴーね!" done -Text0fa3: +SteveTournamentsPlayerWonText: textfw "ユー アー ウィナー!" linefw "オー グレートね!" done diff --git a/src/text/text11.asm b/src/text/text11.asm index 83134b6..cf85da8 100644 --- a/src/text/text11.asm +++ b/src/text/text11.asm @@ -1,76 +1,76 @@ -Text0fa4: +RodFinalCupRound2NextOpponentText: textfw "さすがだな くん" linefw "つぎは カネコウジと対戦だ!" done -Text0fa5: +SteveTournamentsPlayerLostText: textfw "ユー ルーズ!" linefw "まだまだ あまいね!" linefw "また チャレンジね!" linefw "ネバー ギブアップ!!" done -Text0fa6: +JackFinalCupReadyToDuelText: textfw "わたしの ゴージャスなデッキと" linefw "また 対戦ね こんどはまけない" done -Text0fa7: +JackFinalCupDuelStartText: textfw "よろしいか?" linefw "サイドカードは 6枚だ" done -Text0fa8: +JackFinalCupPlayerWonText: textfw "わたしの ゴージャスなデッキが" linefw "やぶれるとは・・・さすがだ" linefw "きみのじつりょくは" linefw "やはり ほんもののようだ・・・" done -Text0fa9: +RodFinalCupRound3NextOpponentText: textfw "くんは" linefw "いつもながら すばらしい!" linefw "では こんどは" linefw "このリュウドーが あいてだ!" done -Text0faa: +JackTournamentsPlayerLostText: textfw "どうですか?" linefw "まけなかったでしょう" linefw "わたしの ゴージャスなデッキは" linefw "すぐれて いるのだよ" done -Text0fab: +RodFinalCupReadyToDuelText: textfw "これが ファイナルカップ" linefw "さいごの対戦だ!" done -Text0fac: +RodFinalCupDuelStartText: textfw "こんどの対戦も" linefw "サイドカードは 6枚だ" linefw "伝説のポケモンカードは" linefw "かんたんには わたさない" done -Text0fad: +RodTournamentsPlayerWonText: textfw "さすがだな くん" linefw "やはり キミは すばらしい!" done -Text0fae: +RodTournamentsPlayerLostText: textfw "ほんのすこし" linefw "ちからが たりなかったようだな" done -Text0faf: +RodYouDeserveLegendaryCardsText: textfw "やはり 伝説のポケモンカードに" linefw "きみは ふさわしい じんぶつだ" linefw "伝説のポケモンカードを" linefw "よろこんで ゆずりわたそう・・・" done -Text0fb0: +RodChallengeBiruritchiText: textfw "さあ くんよ" linefw "GR団のキャッスルへ いくがいい" linefw "そして なんとしても" @@ -85,7 +85,7 @@ Text0fb0: linefw "くん・・・" done -Text0fb1: +RodYouDoNotDeserveLegendaryCardsText: textfw "ざんねんだが" linefw "伝説のポケモンカードは ゆずれん" linefw "でなおして くるのだな" @@ -402,7 +402,7 @@ Text0fe7: linefw "きをつけて おかえりください" done -Text0fe8: +CourtneyWantsToDuelInitialText: textfw "アラ ウフフ・・" linefw "くんじゃない" linefw "GR団から たすけだしてくれて" @@ -413,7 +413,7 @@ Text0fe8: linefw "アタシと 対戦していかない?" done -Text0fe9: +CourtneyWantsToDuelRepeatText: textfw "ウフフ・・・" linefw "くんじゃない" linefw "えっ 伝説のポケモンカード?" @@ -426,25 +426,25 @@ Text0fe9: linefw "ウフフ・・・対戦してあげるわ" done -Text0fea: +CourtneyDuelPromptText: textfw "ヒロコと 対戦しますか?" done -Text0feb: +CourtneyDuelStartText: textfw "アタシの炎の ワザ" linefw "たっぷりと うけてみるがいいわ" linefw "サイドカードは 6枚" linefw "ウフフ・・・さあ いくわよ!" done -Text0fec: +CourtneyDeclinedDuelText: textfw "ウフフ・・・" linefw "そう ざんねんね" linefw "そうね まずは" linefw "GR団とのたたかいを がんばってね" done -Text0fed: +CourtneyReadyForFinalCupText: textfw "ウフフ・・・グランドマスターが" linefw "みんな そろったわよ" linefw "ファイナルカップよ!" @@ -453,7 +453,7 @@ Text0fed: linefw "てかげんしないわよ" done -Text0fee: +CourtneyPostgameInitialText: textfw "くんの おかげで" linefw "GR団とも なかよくなって" linefw "ポケモンカードの せかいが" @@ -462,7 +462,7 @@ Text0fee: linefw "ありがとう くん" done -Text0fef: +CourtneyPostgameRepeatText: textfw "アタシたち グランドマスターも" linefw "GR団に まけないように" linefw "もっと ポケモンカードを" @@ -471,26 +471,26 @@ Text0fef: linefw "みんなで たのしむことを ね!" done -Text0ff0: +CourtneyPlayerWon1Text: textfw "ウフフ・・・" linefw "アタシの まけよ" done -Text0ff1: +CourtneyPlayerWon2Text: textfw "さすがね くん" linefw " " linefw "いちどは 伝説のポケモンカードを" linefw "うけついだだけのことは あるわ" done -Text0ff2: +CourtneyPlayerLostText: textfw "ウフフ・・・" linefw "アタシの か・ち・よ" linefw "たまには" linefw "対戦しに もどってきてね" done -Text0ff3: +SteveWantsToDuelInitialText: textfw "ヘイ !" linefw "GR団のアイランドでは サンキューね" linefw "ミーたち GR団にまけて" @@ -503,7 +503,7 @@ Text0ff3: linefw "スティーブと バトルね!" done -Text0ff4: +SteveWantsToDuelRepeatText: textfw "ヘイ !" linefw "コンディション OK?" linefw "グランドマスター オールそろわないと" @@ -516,25 +516,25 @@ Text0ff4: linefw "スティーブと バトルね!" done -Text0ff5: +SteveDuelPromptText: textfw "スティーブと 対戦しますか?" done -Text0ff6: +SteveDuelStartText: textfw "サイドカード シックス" linefw "ジャパニーズで 「ろく」ね" linefw "!" linefw "レッツ バトル ゴーね!!" done -Text0ff7: +SteveDeclinedDuelText: textfw "オー ノー" linefw "それは ないです " linefw "ミーでは バトルのあいてとして" linefw "パワーぶそく ですか?" done -Text0ff8: +SteveReadyForFinalCupText: textfw "ヘイ !" linefw "リュウドー カムバックね!" linefw "これで" @@ -543,14 +543,14 @@ Text0ff8: linefw "伝説のポケモンカード ゲットね" done -Text0ff9: +SteveReadyForNextFinalCupText: textfw "ミーたち グランドマスターは" linefw "GR団を クラッシュするためなら" linefw "ユーの チャレンジなら" linefw "なんどでも OKね" done -Text0ffa: +StevePostgameInitialText: textfw "ヘイ! " linefw "コングラチュレーションね" linefw "ユーのおかげで GR団とも" @@ -559,7 +559,7 @@ Text0ffa: linefw "ポケモンカードね" done -Text0ffb: +StevePostgameRepeatText: textfw "ヘイ! " linefw "ポケモンカード エンジョイ OK?" linefw "ミーたち グランドマスターは" @@ -568,7 +568,7 @@ Text0ffb: linefw "ぜひ エントリーね!" done -Text0ffc: +SteveGrandMasterCupPlayedText: textfw "ヘイ! " linefw "ポケモンカード エンジョイ OK?" linefw "グランドマスター杯は" @@ -577,12 +577,12 @@ Text0ffc: linefw "だから たまに ここにくるとOK!" done -Text0ffd: +StevePlayerWon1Text: textfw "ユー アー ウィナー!" linefw "オー グレートね!" done -Text0ffe: +StevePlayerWon2Text: textfw "ン~ アイ アム ルーズね" linefw "また まけてしまいました" linefw "" @@ -591,14 +591,14 @@ Text0ffe: linefw "ミーが ウィナーね!!" done -Text0fff: +StevePlayerLostText: textfw "ユー ルーズ!" linefw "まだまだ あまいね!" linefw "また チャレンジね!" linefw "ギブアップ みっともないね!" done -Text1000: +JackWantsToDuelInitialText: textfw "おやおや" linefw "くんでは ありませんか" linefw "GR団から たすけだしていただき" @@ -619,7 +619,7 @@ Text1000: linefw "ゴージャスなデッキと 対戦しますか?" done -Text1001: +JackWantsToDuelRepeatText: textfw "おや" linefw "くんでは ありませんか?" linefw "わたしと 対戦をしに" @@ -630,30 +630,30 @@ Text1001: linefw "ゴージャスなデッキで 対戦しましょう" done -Text1002: +JackDuelPromptText: textfw "カネコウジと 対戦しますか?" done -Text1003: +JackDuelStartText: textfw "よろしいですかな" linefw "サイドカードは 6枚ですよ" done -Text1004: +JackDeclinedDuelText: textfw "そうですか ざんねんですね" linefw "わたしを たすけてくれた" linefw "ゴージャスなデッキと" linefw "対戦してみたかったのですが・・・" done -Text1005: +JackReadyForFinalCupText: textfw "伝説のポケモンカードが ひつようなら" linefw "ファイナルカップで 勝つことだ" linefw "さあ グランドマスターのリーダー" linefw "リュウドーと はなすのだ" done -Text1006: +JackPostgameInitialText: textfw "おやおや" linefw "くんでは ありませんか" linefw "ついに GR団のキングを" @@ -666,7 +666,7 @@ Text1006: linefw "くんの おかげですね" done -Text1007: +JackPostgameRepeatText: textfw "われらのリーダー リュウドーが" linefw "ゴージャスな対戦を かんがえています" linefw "「グランドマスター杯」という" @@ -675,7 +675,7 @@ Text1007: linefw "たのしみに していてください" done -Text1008: +JackGrandMasterCupPlayedText: textfw "グランドマスター杯は" linefw "ゴージャスな大会だったでしょう" linefw "また いつか" @@ -684,24 +684,24 @@ Text1008: linefw "あしを おはこびください" done -Text1009: +JackPlayerWon1Text: textfw "わたしの ゴージャスなデッキが" linefw "やぶれるとは・・・さすがですね" done -Text100a: +JackPlayerWon2Text: textfw "どうやら きみのじつりょくは" linefw "ほんもののようだ・・・" done -Text100b: +JackPlayerLostText: textfw "きみの ゴージャスなデッキも" linefw "なかなかだったが" linefw "わたしの ゴージャスなデッキには" linefw "きみは かてないのだよ" done -Text100c: +RodWantsToStartFinalCupInitialText: textfw "くん" linefw "やはり やってきたか" linefw "GR団のしまでも いったが" @@ -714,7 +714,7 @@ Text100c: linefw "じゅんびのほうは いいかね" done -Text100d: +RodWantsToStartFinalCupRepeatText: textfw "くん・・・" linefw "われら 4にんに勝たなければ" linefw "伝説のポケモンカードは" @@ -725,7 +725,7 @@ Text100d: linefw "じゅんびのほうは いいかね" done -Text100e: +RodWantsToStartNextFinalCupText: textfw "くん なんとしても" linefw "GR団のキング ビルリッチにあえ" linefw "そして GR団の まちがった" @@ -740,23 +740,23 @@ Text100e: linefw "じゅんびは いいかね?" done -Text100f: +FinalCupEnterPrompt: textfw "ファイナルカップを はじめますか?" done -Text1010: +RodFinalCupEnterAcceptedPrompt: textfw "いいだろう" linefw "さあ ファイナルホールへ" done -Text1011: +RodFinalCupEnterDeclinedPrompt: textfw "では じゅんびを ととのえて" linefw "あらためてくるが いい" linefw "GR団を とめられるのは" linefw "「きみだけ」なのを わすれるな" done -Text1012: +RodPostgameInitialText: textfw "ありがとう" linefw "くん" linefw "きみの ゆうきある対戦が" @@ -769,7 +769,7 @@ Text1012: linefw "より たのしむことなのだから・・・" done -Text1013: +RodPostgameRepeatText: textfw "このしまや GR団のひと だけでなく" linefw "さまざまなひとと 対戦するのだ" linefw "バトルセンターなどで" @@ -778,7 +778,7 @@ Text1013: linefw "せかいを ひろげる いっぽなんだ" done -Text1014: +RodGrandMasterCupPlayedText: textfw "グランドマスター杯は" linefw "たのしんで もらえたかな" linefw "また いつか ひらくから" @@ -787,7 +787,7 @@ Text1014: linefw "バトルセンターで 対戦していてくれ" done -Text1015: +PokemonDomeGR5PreachInitialText: textfw "われら グレートロケット団が" linefw "ポケモンドームを しはいした!" linefw "グランドマスターたちも" @@ -804,7 +804,7 @@ Text1015: linefw "ゲットするのだ!!!" done -Text1016: +PokemonDomeGR5PreachRepeatText: textfw "われらGR団の もくてきは" linefw "ただ ひとつ!" linefw "ただ あつめられるだけになった" @@ -860,24 +860,24 @@ GrandMasterCupClerkEnterDeclinedText: linefw "どうぞ また おこしください" done -Text101f: +PokemonDomeGRLassSpectatorText: textfw "グランドマスター杯を" linefw "GR団のしまから みにきたのよ" linefw "クラブマスターのトーナメント戦" linefw "グランドマスターとの いっきうち!" done -Text1020: +PokemonDomeGRLassAnticipatingText: textfw "どうなるのか たのしみだわ!" linefw "ワクワク・・・" done -Text1021: +PokemonDomeGRLassSpectatedText: textfw "すばらしい 対戦だったわ!!" linefw "むねが ドキドキ・・・" done -Text1022: +PokemonDomeYoungsterSpectatorText: textfw "リュウドーさまが" linefw "グランドマスター杯を ひらいたんだ" linefw "でも グランドマスター杯には" @@ -886,7 +886,7 @@ Text1022: linefw "カードマスターに なりたいな" done -Text1023: +PokemonDomeYoungsterSpectatedText: textfw "ねぇ ねぇ" linefw "グランドマスター杯に でたんだろ" linefw "こんかいの ゆうしょうしゃは" @@ -895,7 +895,7 @@ Text1023: linefw "かったのかい?" done -Text1024: +PokemonDomeSwimmerSpectatorText: textfw "グランドマスター杯は ルールは" linefw "8にんのトーナメント戦を おこなって" linefw "そのトーナメントを かちぬいたものが" @@ -908,33 +908,33 @@ Text1024: linefw "ルールを つくったものね" done -Text1025: +PokemonDomeSwimmerPlayerWonCupText: textfw "きいたわよ グランドマスター杯に" linefw "ゆうしょう したんですってね" linefw "さすが " linefw "あなたこそ グランドマスターよ" done -Text1026: +PokemonDomeSwimmerPlayerLostCupText: textfw "トーナメントに 勝ったひとが" linefw "グランドマスターに まけたそうよ" linefw "やっぱり グランドマスターは" linefw "とてつもなく つよいのね!" done -Text1027: +PokemonDomeGR5SealedArenaDoorsText: textfw "そのトビラは ふういんした!" linefw " " linefw "4にんの グランドマスターが" linefw "もどってくれば あけられるかもな" done -Text1028: +RodIAmGrandMasterLeaderText: textfw "くん グランドマスターの" linefw "リーダー リュウドーだ!" done -Text1029: +RodRevisitPokemonDomeForNextFinalCupText: textfw "ファイナルカップは キミのために" linefw "なんどでも ひらこう" linefw "だが いまは まだ そのときではない" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 1a68793..00a86ca 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -4007,30 +4007,30 @@ TextOffsets:: textpointer Text0f97 ; 0x0f97 textpointer Text0f98 ; 0x0f98 textpointer Text0f99 ; 0x0f99 - textpointer Text0f9a ; 0x0f9a - textpointer Text0f9b ; 0x0f9b - textpointer Text0f9c ; 0x0f9c - textpointer Text0f9d ; 0x0f9d - textpointer Text0f9e ; 0x0f9e - textpointer Text0f9f ; 0x0f9f - textpointer Text0fa0 ; 0x0fa0 - textpointer Text0fa1 ; 0x0fa1 - textpointer Text0fa2 ; 0x0fa2 - textpointer Text0fa3 ; 0x0fa3 - textpointer Text0fa4 ; 0x0fa4 - textpointer Text0fa5 ; 0x0fa5 - textpointer Text0fa6 ; 0x0fa6 - textpointer Text0fa7 ; 0x0fa7 - textpointer Text0fa8 ; 0x0fa8 - textpointer Text0fa9 ; 0x0fa9 - textpointer Text0faa ; 0x0faa - textpointer Text0fab ; 0x0fab - textpointer Text0fac ; 0x0fac - textpointer Text0fad ; 0x0fad - textpointer Text0fae ; 0x0fae - textpointer Text0faf ; 0x0faf - textpointer Text0fb0 ; 0x0fb0 - textpointer Text0fb1 ; 0x0fb1 + textpointer RodFinalCupIntroAndRound1OpponentText ; 0x0f9a + textpointer CourtneyFinalCupDuelStartText ; 0x0f9b + textpointer CourtneyTournamentsPlayerWonText ; 0x0f9c + textpointer RodFinalCupRound1NextOpponentText ; 0x0f9d + textpointer CourtneyFinalCupPlayerLostText ; 0x0f9e + textpointer SteveFinalCupReadyToDuelText ; 0x0f9f + textpointer RodFinalCupAreYourDecksReadyText ; 0x0fa0 + textpointer RodFinalCupResumeRoundText ; 0x0fa1 + textpointer SteveFinalCupDuelStartText ; 0x0fa2 + textpointer SteveTournamentsPlayerWonText ; 0x0fa3 + textpointer RodFinalCupRound2NextOpponentText ; 0x0fa4 + textpointer SteveTournamentsPlayerLostText ; 0x0fa5 + textpointer JackFinalCupReadyToDuelText ; 0x0fa6 + textpointer JackFinalCupDuelStartText ; 0x0fa7 + textpointer JackFinalCupPlayerWonText ; 0x0fa8 + textpointer RodFinalCupRound3NextOpponentText ; 0x0fa9 + textpointer JackTournamentsPlayerLostText ; 0x0faa + textpointer RodFinalCupReadyToDuelText ; 0x0fab + textpointer RodFinalCupDuelStartText ; 0x0fac + textpointer RodTournamentsPlayerWonText ; 0x0fad + textpointer RodTournamentsPlayerLostText ; 0x0fae + textpointer RodYouDeserveLegendaryCardsText ; 0x0faf + textpointer RodChallengeBiruritchiText ; 0x0fb0 + textpointer RodYouDoNotDeserveLegendaryCardsText ; 0x0fb1 textpointer Text0fb2 ; 0x0fb2 textpointer Text0fb3 ; 0x0fb3 textpointer Text0fb4 ; 0x0fb4 @@ -4085,56 +4085,56 @@ TextOffsets:: textpointer Text0fe5 ; 0x0fe5 textpointer Text0fe6 ; 0x0fe6 textpointer Text0fe7 ; 0x0fe7 - textpointer Text0fe8 ; 0x0fe8 - textpointer Text0fe9 ; 0x0fe9 - textpointer Text0fea ; 0x0fea - textpointer Text0feb ; 0x0feb - textpointer Text0fec ; 0x0fec - textpointer Text0fed ; 0x0fed - textpointer Text0fee ; 0x0fee - textpointer Text0fef ; 0x0fef - textpointer Text0ff0 ; 0x0ff0 - textpointer Text0ff1 ; 0x0ff1 - textpointer Text0ff2 ; 0x0ff2 - textpointer Text0ff3 ; 0x0ff3 - textpointer Text0ff4 ; 0x0ff4 - textpointer Text0ff5 ; 0x0ff5 - textpointer Text0ff6 ; 0x0ff6 - textpointer Text0ff7 ; 0x0ff7 - textpointer Text0ff8 ; 0x0ff8 - textpointer Text0ff9 ; 0x0ff9 - textpointer Text0ffa ; 0x0ffa - textpointer Text0ffb ; 0x0ffb - textpointer Text0ffc ; 0x0ffc - textpointer Text0ffd ; 0x0ffd - textpointer Text0ffe ; 0x0ffe - textpointer Text0fff ; 0x0fff + textpointer CourtneyWantsToDuelInitialText ; 0x0fe8 + textpointer CourtneyWantsToDuelRepeatText ; 0x0fe9 + textpointer CourtneyDuelPromptText ; 0x0fea + textpointer CourtneyDuelStartText ; 0x0feb + textpointer CourtneyDeclinedDuelText ; 0x0fec + textpointer CourtneyReadyForFinalCupText ; 0x0fed + textpointer CourtneyPostgameInitialText ; 0x0fee + textpointer CourtneyPostgameRepeatText ; 0x0fef + textpointer CourtneyPlayerWon1Text ; 0x0ff0 + textpointer CourtneyPlayerWon2Text ; 0x0ff1 + textpointer CourtneyPlayerLostText ; 0x0ff2 + textpointer SteveWantsToDuelInitialText ; 0x0ff3 + textpointer SteveWantsToDuelRepeatText ; 0x0ff4 + textpointer SteveDuelPromptText ; 0x0ff5 + textpointer SteveDuelStartText ; 0x0ff6 + textpointer SteveDeclinedDuelText ; 0x0ff7 + textpointer SteveReadyForFinalCupText ; 0x0ff8 + textpointer SteveReadyForNextFinalCupText ; 0x0ff9 + textpointer StevePostgameInitialText ; 0x0ffa + textpointer StevePostgameRepeatText ; 0x0ffb + textpointer SteveGrandMasterCupPlayedText ; 0x0ffc + textpointer StevePlayerWon1Text ; 0x0ffd + textpointer StevePlayerWon2Text ; 0x0ffe + textpointer StevePlayerLostText ; 0x0fff SECTION "Text Offsets 2", ROMX - textpointer Text1000 ; 0x1000 - textpointer Text1001 ; 0x1001 - textpointer Text1002 ; 0x1002 - textpointer Text1003 ; 0x1003 - textpointer Text1004 ; 0x1004 - textpointer Text1005 ; 0x1005 - textpointer Text1006 ; 0x1006 - textpointer Text1007 ; 0x1007 - textpointer Text1008 ; 0x1008 - textpointer Text1009 ; 0x1009 - textpointer Text100a ; 0x100a - textpointer Text100b ; 0x100b - textpointer Text100c ; 0x100c - textpointer Text100d ; 0x100d - textpointer Text100e ; 0x100e - textpointer Text100f ; 0x100f - textpointer Text1010 ; 0x1010 - textpointer Text1011 ; 0x1011 - textpointer Text1012 ; 0x1012 - textpointer Text1013 ; 0x1013 - textpointer Text1014 ; 0x1014 - textpointer Text1015 ; 0x1015 - textpointer Text1016 ; 0x1016 + textpointer JackWantsToDuelInitialText ; 0x1000 + textpointer JackWantsToDuelRepeatText ; 0x1001 + textpointer JackDuelPromptText ; 0x1002 + textpointer JackDuelStartText ; 0x1003 + textpointer JackDeclinedDuelText ; 0x1004 + textpointer JackReadyForFinalCupText ; 0x1005 + textpointer JackPostgameInitialText ; 0x1006 + textpointer JackPostgameRepeatText ; 0x1007 + textpointer JackGrandMasterCupPlayedText ; 0x1008 + textpointer JackPlayerWon1Text ; 0x1009 + textpointer JackPlayerWon2Text ; 0x100a + textpointer JackPlayerLostText ; 0x100b + textpointer RodWantsToStartFinalCupInitialText ; 0x100c + textpointer RodWantsToStartFinalCupRepeatText ; 0x100d + textpointer RodWantsToStartNextFinalCupText ; 0x100e + textpointer FinalCupEnterPrompt ; 0x100f + textpointer RodFinalCupEnterAcceptedPrompt ; 0x1010 + textpointer RodFinalCupEnterDeclinedPrompt ; 0x1011 + textpointer RodPostgameInitialText ; 0x1012 + textpointer RodPostgameRepeatText ; 0x1013 + textpointer RodGrandMasterCupPlayedText ; 0x1014 + textpointer PokemonDomeGR5PreachInitialText ; 0x1015 + textpointer PokemonDomeGR5PreachRepeatText ; 0x1016 textpointer GrandMasterCupClerkWelcomeText ; 0x1017 textpointer GrandMasterCupClerkPrizesText ; 0x1018 textpointer GrandMasterCupClerkInviteText ; 0x1019 @@ -4143,17 +4143,17 @@ SECTION "Text Offsets 2", ROMX textpointer GrandMasterCupClerkEnterPromptText ; 0x101c textpointer GrandMasterCupClerkEnterAcceptedText ; 0x101d textpointer GrandMasterCupClerkEnterDeclinedText ; 0x101e - textpointer Text101f ; 0x101f - textpointer Text1020 ; 0x1020 - textpointer Text1021 ; 0x1021 - textpointer Text1022 ; 0x1022 - textpointer Text1023 ; 0x1023 - textpointer Text1024 ; 0x1024 - textpointer Text1025 ; 0x1025 - textpointer Text1026 ; 0x1026 - textpointer Text1027 ; 0x1027 - textpointer Text1028 ; 0x1028 - textpointer Text1029 ; 0x1029 + textpointer PokemonDomeGRLassSpectatorText ; 0x101f + textpointer PokemonDomeGRLassAnticipatingText ; 0x1020 + textpointer PokemonDomeGRLassSpectatedText ; 0x1021 + textpointer PokemonDomeYoungsterSpectatorText ; 0x1022 + textpointer PokemonDomeYoungsterSpectatedText ; 0x1023 + textpointer PokemonDomeSwimmerSpectatorText ; 0x1024 + textpointer PokemonDomeSwimmerPlayerWonCupText ; 0x1025 + textpointer PokemonDomeSwimmerPlayerLostCupText ; 0x1026 + textpointer PokemonDomeGR5SealedArenaDoorsText ; 0x1027 + textpointer RodIAmGrandMasterLeaderText ; 0x1028 + textpointer RodRevisitPokemonDomeForNextFinalCupText ; 0x1029 textpointer PokemonDomeFatGuyAllGrandMastersGoneText ; 0x102a textpointer PokemonDomeFatGuySteveIsBackText ; 0x102b textpointer PokemonDomeFatGuyCourtneyIsBackText ; 0x102c diff --git a/tools/constants.py b/tools/constants.py index 28bb82b..14df230 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -845,9 +845,9 @@ events = [ "EVENT_TRADED_CARDS_PSYCHIC_STRONGHOLD", "EVENT_GODAS_ROOM_CAGE_STATE", "EVENT_MIDORIS_ROOM_CAGE_STATE", - "EVENT_BB", - "EVENT_BC", - "EVENT_BD", + "EVENT_TALKED_TO_COURTNEY_POKEMON_DOME", + "EVENT_TALKED_TO_STEVE_POKEMON_DOME", + "EVENT_TALKED_TO_JACK_POKEMON_DOME", "EVENT_ENTERED_GRAND_MASTER_CUP", "EVENT_FREED_COURTNEY", "EVENT_FREED_STEVE", @@ -876,7 +876,7 @@ events = [ "EVENT_OPENED_CHEST_FIGHTING_FORT_5", "EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT", "EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE", - "EVENT_BEAT_GRAND_MASTER_CUP", + "EVENT_BEAT_FINAL_CUP", "EVENT_DB", "EVENT_GHOST_MASTER_STATUES_STATE", "EVENT_BATTLED_TOBICHAN", @@ -894,7 +894,7 @@ events = [ "EVENT_TALKED_TO_ROOK", "EVENT_TALKED_TO_QUEEN", "EVENT_EB", - "EVENT_EC", + "EVENT_TALKED_TO_ROD_POKEMON_DOME", "EVENT_SET_UNTIL_MAP_RELOAD_1", "EVENT_EE", "EVENT_EF", @@ -2968,8 +2968,8 @@ vars = [ "VAR_09", "VAR_0A", "VAR_0B", - "VAR_0C", - "VAR_0D", + "VAR_FINAL_CUP_PLAYED_ROUNDS", + "VAR_GRAND_MASTER_CUP_STATE", "VAR_0E", "VAR_0F", "VAR_GRANDMASTERCUP_PRIZE_INDEX_0", From a87bc7fc1e22cdd8d501457e471a09463123ca18 Mon Sep 17 00:00:00 2001 From: earthoul Date: Sun, 1 Feb 2026 00:40:49 +0900 Subject: [PATCH 10/15] Label Grand Master Cup sequence --- src/constants/challenge_cup_constants.asm | 16 +- src/constants/duel_constants.asm | 2 + src/constants/npc_constants.asm | 8 + src/constants/ow_object_constants.asm | 12 +- src/constants/script_constants.asm | 12 +- src/constants/var_constants.asm | 6 +- src/engine/bank03.asm | 49 +-- src/engine/bank04.asm | 15 +- src/engine/bank07.asm | 221 ++++++----- src/engine/bank0b.asm | 4 +- src/engine/bank0f.asm | 434 +++++++++++----------- src/engine/bank10.asm | 2 +- src/engine/bank11.asm | 12 +- src/engine/bank4b.asm | 4 +- src/text/text11.asm | 108 +++--- src/text/text4.asm | 5 +- src/text/text_offsets.asm | 108 +++--- src/wram.asm | 22 +- tools/constants.py | 10 +- 19 files changed, 568 insertions(+), 482 deletions(-) diff --git a/src/constants/challenge_cup_constants.asm b/src/constants/challenge_cup_constants.asm index a387180..cac22e8 100644 --- a/src/constants/challenge_cup_constants.asm +++ b/src/constants/challenge_cup_constants.asm @@ -7,6 +7,16 @@ const CHALLENGE_CUP_2 ; 1 const CHALLENGE_CUP_3 ; 2 +; VAR_GRAND_MASTER_CUP_STATE constants + const_def 1 + const GRAND_MASTER_CUP_INACTIVE ; 1 + const GRAND_MASTER_CUP_ACTIVE ; 2 + const GRAND_MASTER_CUP_ACTIVE_PRIZES_SET ; 3 + const GRAND_MASTER_CUP_PLAYING ; 4 +DEF GRAND_MASTER_CUP_PLAYED EQU const_value + const GRAND_MASTER_CUP_RESULT_WON ; 5 + const GRAND_MASTER_CUP_RESULT_LOST ; 6 + ; VAR_*_CHALLENGE_CUP_STATE constants ; cup 1 and 2: limited time windows ; cup 3: post-game @@ -41,7 +51,7 @@ DEF NUM_CHALLENGE_CUP_WINS_FOR_COIN_PRIZE EQU 10 const GRANDMASTERCUP_ISAAC ; 6 const GRANDMASTERCUP_MURRAY ; 7 const GRANDMASTERCUP_RONALD ; 8 -DEF NUM_GRANDMASTERCUP_OPPONENT_IDS EQU const_value +DEF NUM_GRANDMASTERCUP_OPPONENT_POOL EQU const_value DEF NUM_GRANDMASTERCUP_DUELISTS EQU 8 DEF NUM_GRANDMASTERCUP_OPPONENTS EQU NUM_GRANDMASTERCUP_DUELISTS - 1 ; 7 @@ -57,6 +67,10 @@ DEF NUM_GRANDMASTERCUP_PRIZE_POOL EQU 37 const GRANDMASTERCUP_PRIZE_1 ; 1 const GRANDMASTERCUP_PRIZE_2 ; 2 const GRANDMASTERCUP_PRIZE_3 ; 3 +DEF NUM_GRANDMASTERCUP_PRIZE_CANDIDATES EQU 4 + +DEF NUM_GRANDMASTERCUP_PRIZES_TO_RECEIVE EQU 2 +DEF GRANDMASTERCUP_PRIZE_SELECTED EQU $ff DEF NUM_TCG_CHALLENGE_CUP_PRIZE_POOL EQU 17 DEF NUM_GR_CHALLENGE_CUP_PRIZE_POOL EQU 17 diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 7db243b..f7f2eea 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -43,6 +43,8 @@ DEF NUM_CHALLENGE_MACHINE_WINS_FOR_COIN_PRIZE EQU 50 ; caps for both duels won and sets won DEF MAX_NUM_CHALLENGE_MACHINE_WIN_RECORD EQU 999 +; caps for link duel wins to activate grand master cup +DEF MAX_NUM_LINK_DUEL_WINS_FOR_GRAND_MASTER_CUP EQU 10 ; wPlayerDuelVariables or wOpponentDuelVariables constants DEF DUELVARS_CARD_LOCATIONS EQUS "LOW(wPlayerCardLocations)" ; 00 diff --git a/src/constants/npc_constants.asm b/src/constants/npc_constants.asm index bef45b0..9fbdbeb 100644 --- a/src/constants/npc_constants.asm +++ b/src/constants/npc_constants.asm @@ -334,6 +334,14 @@ DEF NUM_PICS EQU const_value DEF NPC_NONE EQU -1 +; grand masters + const_def + const GRAND_MASTER_COURTNEY ; 0 + const GRAND_MASTER_STEVE ; 1 + const GRAND_MASTER_JACK ; 2 + const GRAND_MASTER_ROD ; 3 +DEF NUM_GRAND_MASTERS EQU const_value + ; NPCDuelistPointers use this ordering const_def const NPC_DUELIST_SAM ; $00 diff --git a/src/constants/ow_object_constants.asm b/src/constants/ow_object_constants.asm index 6ecc64f..e7ee698 100644 --- a/src/constants/ow_object_constants.asm +++ b/src/constants/ow_object_constants.asm @@ -180,12 +180,12 @@ DEF MAX_NUM_OW_OBJECTS EQU 10 RSRESET -DEF OWOBJSTRUCT_FLAGS RB ; $0 -DEF OWOBJSTRUCT_ID RB ; $1 -DEF OWOBJSTRUCT_ANIM_PTR RW ; $2 -DEF OWOBJSTRUCT_4 RB ; $4 -DEF OWOBJSTRUCT_5 RB ; $5 -DEF OWOBJSTRUCT_6 RW ; $6 +DEF OWOBJSTRUCT_FLAGS RB ; $0 +DEF OWOBJSTRUCT_ID RB ; $1 +DEF OWOBJSTRUCT_ANIM_PTR RW ; $2 +DEF OWOBJSTRUCT_4 RB ; $4 +DEF OWOBJSTRUCT_MOVEMENT_BANK RB ; $5 +DEF OWOBJSTRUCT_MOVEMENT_PTR RW ; $6 DEF OWOBJSTRUCT_LENGTH EQU _RS DEF OW_OBJECTS_BUFFER_SIZE EQU MAX_NUM_OW_OBJECTS * OWOBJSTRUCT_LENGTH diff --git a/src/constants/script_constants.asm b/src/constants/script_constants.asm index 5167e16..2d5a336 100644 --- a/src/constants/script_constants.asm +++ b/src/constants/script_constants.asm @@ -162,11 +162,12 @@ const EVENT_TALKED_TO_TRADE_NPC_FIRE_FORT ; $8e const EVENT_TALKED_TO_TRADE_NPC_WATER_FORT ; $8f const EVENT_TALKED_TO_TRADE_NPC_PSYCHIC_STRONGHOLD ; $90 -; Misc flags 1 +; Misc NPC flags const EVENT_91 ; $91 const EVENT_92 ; $92 const EVENT_TALKED_TO_SAM ; $93 const EVENT_94 ; $94 +; Ishihara flags const EVENT_TALKED_TO_ISHIHARA ; $95 const EVENT_BATTLED_ISHIHARA ; $96 const EVENT_TALKED_TO_ISHIHARA_POST_GAME ; $97 @@ -243,10 +244,11 @@ const EVENT_OPENED_CHEST_FIGHTING_FORT_4 ; $d6 const EVENT_OPENED_CHEST_FIGHTING_FORT_5 ; $d7 const EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT ; $d8 -; Misc flags 2 +; Flyover flag const EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE ; $d9 - const EVENT_BEAT_FINAL_CUP ; $da - const EVENT_DB ; $db +; Pokemon Dome Cups flags + const EVENT_WON_FINAL_CUP ; $da + const EVENT_WON_GRAND_MASTER_CUP ; $db ; Ghost Master flags const EVENT_GHOST_MASTER_STATUES_STATE ; $dc const EVENT_BATTLED_TOBICHAN ; $dd @@ -264,7 +266,7 @@ const EVENT_TALKED_TO_BISHOP ; $e8 const EVENT_TALKED_TO_ROOK ; $e9 const EVENT_TALKED_TO_QUEEN ; $ea -; Misc flags 3 +; Misc flags const EVENT_EB ; $eb const EVENT_TALKED_TO_ROD_POKEMON_DOME ; $ec const EVENT_SET_UNTIL_MAP_RELOAD_1 ; $ed diff --git a/src/constants/var_constants.asm b/src/constants/var_constants.asm index d8e97d3..5f27365 100644 --- a/src/constants/var_constants.asm +++ b/src/constants/var_constants.asm @@ -13,7 +13,7 @@ const VAR_0B ; $0b const VAR_FINAL_CUP_PLAYED_ROUNDS ; $0c const VAR_GRAND_MASTER_CUP_STATE ; $0d - const VAR_0E ; $0e + const VAR_GRANDMASTERCUP_CURRENT_ROUND ; $0e const VAR_0F ; $0f const VAR_GRANDMASTERCUP_PRIZE_INDEX_0 ; $10 const VAR_GRANDMASTERCUP_PRIZE_INDEX_1 ; $11 @@ -30,8 +30,8 @@ const VAR_1C ; $1c const VAR_1D ; $1d const VAR_1E ; $1e - const VAR_1F ; $1f - const VAR_20 ; $20 + const VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER ; $1f + const VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP ; $20 const VAR_21 ; $21 const VAR_IMAKUNI_BLACK_WIN_COUNT ; $22 const VAR_23 ; $23 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 27e620b..9133274 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -373,7 +373,7 @@ Func_c2a7: call Func_c366 call Func_c3d4 call Func_c2ff - call Func_c319 + call HandleGrandMasterCupState call Func_c439 call Func_c477 ret @@ -431,17 +431,19 @@ Func_c2ff: .done ret -Func_c319: +HandleGrandMasterCupState: ld a, VAR_GRAND_MASTER_CUP_STATE call GetVarValue - cp $04 - jr c, .asm_c32d + cp GRAND_MASTER_CUP_PLAYING + jr c, .not_playing jr z, .done +; played, clear result ld a, VAR_GRAND_MASTER_CUP_STATE - ld c, $01 + ld c, GRAND_MASTER_CUP_INACTIVE call SetVarValue jr .done -.asm_c32d + +.not_playing ld a, [wCurMap] cp MAP_POKEMON_DOME_ENTRANCE jr z, .done @@ -449,25 +451,28 @@ Func_c319: jr z, .done cp MAP_POKEMON_DOME_BACK jr z, .done +; outside pokemon dome ld a, VAR_GRAND_MASTER_CUP_STATE call GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr z, .done - jr nc, .asm_c358 - ld a, VAR_20 + jr nc, .reset +; check cup activation condition + ld a, VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP call GetVarValue - cp $0a + cp MAX_NUM_LINK_DUEL_WINS_FOR_GRAND_MASTER_CUP jr c, .done ld a, VAR_GRAND_MASTER_CUP_STATE - ld c, $02 + ld c, GRAND_MASTER_CUP_ACTIVE call SetVarValue .done ret -.asm_c358 + +.reset ld a, VAR_GRAND_MASTER_CUP_STATE - ld c, $01 + ld c, GRAND_MASTER_CUP_INACTIVE call SetVarValue - ld a, VAR_20 + ld a, VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP call ZeroOutVarValue jr .done @@ -940,11 +945,13 @@ ENDR pop af ret +; de = card id Func_c63e: call GetReceivedCardText farcall Func_1d53a ret +; de = card id Func_c646: call AddCardToCollection call GetReceivedCardText @@ -2112,8 +2119,8 @@ EventVarMasks: db $25, %00100000 ; EVENT_OPENED_CHEST_FIGHTING_FORT_5 db $25, %01000000 ; EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT db $26, %00000001 ; EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE - db $26, %00000010 ; EVENT_BEAT_FINAL_CUP - db $26, %00000100 ; EVENT_DB + db $26, %00000010 ; EVENT_WON_FINAL_CUP + db $26, %00000100 ; EVENT_WON_GRAND_MASTER_CUP db $27, %00000001 ; EVENT_GHOST_MASTER_STATUES_STATE db $27, %00000010 ; EVENT_BATTLED_TOBICHAN db $28, %00000001 ; EVENT_BATTLED_EIJI @@ -2157,7 +2164,7 @@ GeneralVarMasks: db $05, %00000011 ; VAR_0B db $06, %00000011 ; VAR_FINAL_CUP_PLAYED_ROUNDS db $06, %00011100 ; VAR_GRAND_MASTER_CUP_STATE - db $06, %11100000 ; VAR_0E + db $06, %11100000 ; VAR_GRANDMASTERCUP_CURRENT_ROUND db $07, %00001111 ; VAR_0F db $08, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_0 db $09, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_1 @@ -2174,8 +2181,8 @@ GeneralVarMasks: db $14, %11111111 ; VAR_1C db $15, %11111111 ; VAR_1D db $16, %11111111 ; VAR_1E - db $17, %00000011 ; VAR_1F - db $17, %00111100 ; VAR_20 + db $17, %00000011 ; VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER + db $17, %00111100 ; VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP db $18, %00000111 ; VAR_21 db $18, %11110000 ; VAR_IMAKUNI_BLACK_WIN_COUNT db $19, %00000001 ; VAR_23 @@ -2396,7 +2403,7 @@ CheckTCGIslandMilestoneEvents: jp .clear_carry .check_final_cup_or_postgame: - ld a, EVENT_BEAT_FINAL_CUP + ld a, EVENT_WON_FINAL_CUP call GetEventValue push af ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE @@ -2423,7 +2430,7 @@ CheckTCGIslandMilestoneEvents: jp .clear_carry .check_event_db: - ld a, EVENT_DB + ld a, EVENT_WON_GRAND_MASTER_CUP call GetEventValue jp nz, .set_carry jp .clear_carry diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index 8bb7587..161f494 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -946,7 +946,7 @@ SetFontAndTextBoxFrameColor_PreserveRegisters:: pop af ret -Func_10672: +Stub_10672: ret ; input: de = coord @@ -3440,6 +3440,7 @@ Func_1132e: ret ; a = NPC_* ID +; b = NPCMovement data bank ; hl = NPCMovement data pointer _MoveNPC: push af @@ -3456,11 +3457,11 @@ _MoveNPC: pop bc xor a ld [hli], a ; OWOBJSTRUCT_4 - ld [hl], b ; OWOBJSTRUCT_5 + ld [hl], b ; OWOBJSTRUCT_MOVEMENT_BANK inc hl - ld [hl], e ; LOW(OWOBJSTRUCT_6) + ld [hl], e ; LOW(OWOBJSTRUCT_MOVEMENT_PTR) inc hl - ld [hl], d ; HIGH(OWOBJSTRUCT_6) + ld [hl], d ; HIGH(OWOBJSTRUCT_MOVEMENT_PTR) pop hl pop de pop bc @@ -3510,10 +3511,10 @@ ENDR push hl ld a, [hli] ; OWOBJSTRUCT_4 ld c, a - ld a, [hli] ; OWOBJSTRUCT_5 + ld a, [hli] ; OWOBJSTRUCT_MOVEMENT_BANK ld b, a - ld a, [hli] ; LOW(OWOBJSTRUCT_6) - ld h, [hl] ; HIGH(OWOBJSTRUCT_6) + ld a, [hli] ; LOW(OWOBJSTRUCT_MOVEMENT_PTR) + ld h, [hl] ; HIGH(OWOBJSTRUCT_MOVEMENT_PTR) ld l, a call Func_3be0 pop hl diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 34c3045..cc01073 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -7386,39 +7386,41 @@ GetwDD75: and a ret -Func_1f627: +; return b = item1, c = item2 +SelectGrandMasterCupPrizes: farcall Func_102a4 - call Func_1f633 + call _SelectGrandMasterCupPrizes farcall Func_102c4 ret -Func_1f633: +; return b = item1, c = item2 +_SelectGrandMasterCupPrizes: push af push de push hl xor a - ld [wdd78], a - call Func_1f644 - call Func_1f7ad + ld [wGrandMasterCupPrizeSelectionMenuCursorPosition], a + call .SelectionMenu + call .GetSelectedCardItems pop hl pop de pop af ret -Func_1f644: +.SelectionMenu: farcall InitOWObjects farcall SetInitialGraphicsConfiguration - farcall Func_10672 - call Func_1f666 - call Func_1f682 + farcall Stub_10672 + call .DrawSelectionMenuTitle + call .DrawSelectionMenu call StartFadeFromWhite call WaitPalFading_Bank07 - call Func_1f6cd + call .HandleSelectionMenu call StartFadeToWhite call WaitPalFading_Bank07 ret -Func_1f666: +.DrawSelectionMenuTitle: lb de, 0, 0 lb bc, 20, 3 call DrawRegularTextBoxVRAM0 @@ -7430,17 +7432,17 @@ Func_1f666: call InitTextPrinting_ProcessTextFromIDVRAM0 ret -Func_1f682: - ld b, $07 - ld hl, $76ad - ld de, $3 +.DrawSelectionMenu: + ld b, BANK(.menu_box_params) + ld hl, .menu_box_params + lb de, 0, 3 call LoadMenuBoxParams - ld a, [wdd78] + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] call DrawMenuBox - ld de, $404 - ld hl, wdd7a - ld c, $04 -.asm_1f69b + lb de, 4, 4 + ld hl, wGrandMasterCupPrizes + ld c, NUM_GRANDMASTERCUP_PRIZE_CANDIDATES +.loop_print_card_names push hl ld a, [hli] ld h, [hl] @@ -7454,173 +7456,196 @@ Func_1f682: inc e inc e dec c - jr nz, .asm_1f69b + jr nz, .loop_print_card_names ret -; 0x1f6ad -SECTION "Bank 7@76cd", ROMX[$76cd], BANK[$7] +.menu_box_params: + menubox_params FALSE, 20, 8, \ + SYM_CURSOR_R, SYM_SPACE, SYM_CURSOR_R, SYM_CURSOR_R, \ + PAD_A | PAD_START, PAD_B, FALSE, 1, NULL, NULL + textitem 2, 1, SingleSpaceText + textitem 2, 3, SingleSpaceText + textitem 2, 5, SingleSpaceText + textitem 2, 7, SingleSpaceText + textitems_end -Func_1f6cd: -.asm_1f6cd - call Func_1f748 +.HandleSelectionMenu: + call .InitSelection xor a - ld [wdd79], a -.asm_1f6d4 + ld [wNumGrandMasterCupPrizesSelected], a +.loop_dialog_box ldtx hl, GrandMasterCupPrizesDialogText lb de, 1, 14 call InitTextPrinting_ProcessTextFromIDVRAM0 -.asm_1f6dd - ld a, [wdd78] +.wait_input + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] call HandleMenuBox - ld [wdd78], a + ld [wGrandMasterCupPrizeSelectionMenuCursorPosition], a ldh a, [hKeysPressed] and PAD_START - jr z, .asm_1f6f1 - call Func_1f71c - jr .asm_1f6d4 -.asm_1f6f1 + jr z, .no_start_btn + call .CardPreview + jr .loop_dialog_box +.no_start_btn ldh a, [hKeysPressed] and PAD_A - jr z, .asm_1f6fd - ld a, [wdd78] - call Func_1f752 -.asm_1f6fd + jr z, .no_a_btn + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] + call .SelectCurCardItem +.no_a_btn ldh a, [hKeysPressed] and PAD_B - jr z, .asm_1f709 - ld a, [wdd78] - call Func_1f762 -.asm_1f709 - ld a, [wdd79] - cp $02 - jr nz, .asm_1f6dd + jr z, .no_b_btn + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] + call .DeselectCurCardItem +.no_b_btn + ld a, [wNumGrandMasterCupPrizesSelected] + cp NUM_GRANDMASTERCUP_PRIZES_TO_RECEIVE + jr nz, .wait_input + ldtx hl, GrandMasterCupPrizesConfirmPromptText ld a, $01 farcall DrawWideTextBox_PrintTextWithYesOrNoMenu - jr c, .asm_1f6cd + jr c, .HandleSelectionMenu ; loop ret -Func_1f71c: - call Func_1f7b6 +.CardPreview: + call .OpenCardPage + +; back to menu call EmptyScreen farcall InitOWObjects farcall SetInitialGraphicsConfiguration - farcall Func_10672 - call Func_1f666 - call Func_1f682 - ld a, [wdd79] + farcall Stub_10672 + call .DrawSelectionMenuTitle + call .DrawSelectionMenu +; restore marks (HP_NOK) + ld a, [wNumGrandMasterCupPrizesSelected] and a - jr z, .asm_1f744 - ld a, [wdd8e] - ld d, $17 + jr z, .handled_marks_after_preview + ld a, [wSelectedGrandMasterCupPrizeItems] + ld d, SYM_HP_NOK ld e, $00 - call Func_1f76f -.asm_1f744 + call .UpdateMarkOnCurCardItem +.handled_marks_after_preview call EnableLCD ret -Func_1f748: +.InitSelection: xor a -.asm_1f749 - call Func_1f762 +.loop_init + call .DeselectCurCardItem inc a - cp $04 - jr nz, .asm_1f749 + cp NUM_GRANDMASTERCUP_PRIZE_CANDIDATES + jr nz, .loop_init ret -Func_1f752: +; a = cursor pos +; marks with HP_NOK +.SelectCurCardItem: push af - ld d, $17 + ld d, SYM_HP_NOK ld e, $00 - call Func_1f76f - call Func_1f79e - call Func_1f77b + call .UpdateMarkOnCurCardItem + call .SetSelectedCardItems + call .SetCurCardItemFlagAndUpdateCount pop af ret -Func_1f762: +; a = cursor pos +.DeselectCurCardItem: push af - ld d, $00 + ld d, SYM_SPACE ld e, $00 - call Func_1f76f - call Func_1f78d + call .UpdateMarkOnCurCardItem + call .UnsetCurCardItemFlagAndUpdateCount pop af ret -Func_1f76f: +; a = cursor pos (y coord = 2a + 4) +; d = VRAM0 tile index (SYM_*) +; e = VRAM1 tile attributes ($00) +.UpdateMarkOnCurCardItem: push af add a - add $04 + add 4 ld c, a - ld b, $03 + ld b, 3 ; x coord call Func_383b pop af ret -Func_1f77b: +; a = cursor pos +.SetCurCardItemFlagAndUpdateCount: ld c, a ld b, $00 - ld hl, wdd8a + ld hl, wGrandMasterCupPrizesSelectionState add hl, bc ld a, [hl] and a ret nz - ld a, $ff + ld a, GRANDMASTERCUP_PRIZE_SELECTED ld [hl], a - ld hl, wdd79 + ld hl, wNumGrandMasterCupPrizesSelected inc [hl] ret -Func_1f78d: +.UnsetCurCardItemFlagAndUpdateCount: ld c, a ld b, $00 - ld hl, wdd8a + ld hl, wGrandMasterCupPrizesSelectionState add hl, bc ld a, [hl] and a ret z xor a ld [hl], a - ld hl, wdd79 + ld hl, wNumGrandMasterCupPrizesSelected dec [hl] ret -Func_1f79e: - ld a, [wdd79] +.SetSelectedCardItems: + ld a, [wNumGrandMasterCupPrizesSelected] ld c, a ld b, $00 - ld hl, wdd8e + ld hl, wSelectedGrandMasterCupPrizeItems add hl, bc - ld a, [wdd78] + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] ld [hl], a ret -Func_1f7ad: - ld a, [wdd8e] +; return b = item1, c = item2 +.GetSelectedCardItems: + ld a, [wSelectedGrandMasterCupPrizeItem1] ld b, a - ld a, [wdd8e + 1] + ld a, [wSelectedGrandMasterCupPrizeItem2] ld c, a ret -Func_1f7b6: - ld a, [wdd78] +.OpenCardPage: + ld a, [wGrandMasterCupPrizeSelectionMenuCursorPosition] add a add a ld c, a ld b, $00 - ld hl, wdd7a + ld hl, wGrandMasterCupPrizes add hl, bc inc hl inc hl - ld e, [hl] + ld e, [hl] ; low card id inc hl - ld d, [hl] - farcall 1, LoadCardDataToBuffer1_FromCardID ; need to specify bank to match baserom + ld d, [hl] ; high card id +; harmless bug, uses farcall bank1 for all these three funcs +; but BANK(LoadCardDataToBuffer1_FromCardID) = 0 + farcall 1, LoadCardDataToBuffer1_FromCardID farcall SetupDuel farcall OpenCardPage_FromHand ret -Func_1f7d4: +; a = [0, 3] +; bc = card id +; hl = card name +LoadGrandMasterCupPrizeCardData: push af push bc push de @@ -7632,7 +7657,7 @@ Func_1f7d4: add a ld c, a ld b, $00 - ld hl, wdd7a + ld hl, wGrandMasterCupPrizes add hl, bc pop bc ld [hl], e diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index ba176d1..7d7e9d5 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -8233,9 +8233,9 @@ Script_PokemonDomeFatGuy: check_event EVENT_SET_UNTIL_MAP_RELOAD_1 script_jump_if_b0z .cup_played get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $02 + compare_loaded_var GRAND_MASTER_CUP_ACTIVE script_jump_if_b0nz .cup_active - compare_loaded_var $03 + compare_loaded_var GRAND_MASTER_CUP_ACTIVE_PRIZES_SET script_jump_if_b0nz .cup_active print_npc_text PokemonDomeFatGuyGrandMasterCupInactiveText end_dialog diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 4b045f6..6acda2e 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -329,12 +329,12 @@ Script_BattleCenter: .ows_3c2c1 check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE script_jump_if_b0nz .ows_3c2d8 - get_var VAR_20 - compare_loaded_var $0a + get_var VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP + compare_loaded_var MAX_NUM_LINK_DUEL_WINS_FOR_GRAND_MASTER_CUP script_jump_if_b1z .ows_3c2d8 - inc_var VAR_20 - get_var VAR_20 - compare_loaded_var $05 + inc_var VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP + get_var VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP + compare_loaded_var 5 script_jump_if_b0z .ows_3c2d8 send_mail $0f .ows_3c2d8 @@ -2854,9 +2854,9 @@ Func_3d67b: .check_grand_master_cup ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr c, .done - cp $04 + cp GRAND_MASTER_CUP_PLAYING jr c, .cup_active ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue @@ -3051,9 +3051,9 @@ PokemonDome_CourtneyAppearanceCheck: jr nz, .disappear ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr z, .disappear - cp $03 + cp GRAND_MASTER_CUP_ACTIVE_PRIZES_SET jr z, .disappear scf ccf @@ -3098,7 +3098,7 @@ Script_Steve: end_script ret .final_cup - check_event EVENT_BEAT_FINAL_CUP + check_event EVENT_WON_FINAL_CUP print_variable_npc_text SteveReadyForFinalCupText, SteveReadyForNextFinalCupText end_dialog end_script @@ -3111,7 +3111,7 @@ Script_Steve: script_jump .postgame_done .postgame_repeat get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $00 + compare_loaded_var NONE print_variable_npc_text StevePostgameRepeatText, SteveGrandMasterCupPlayedText .postgame_done end_dialog @@ -3144,9 +3144,9 @@ PokemonDome_SteveAppearanceCheck: jr nz, .disappear ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr z, .disappear - cp $03 + cp GRAND_MASTER_CUP_ACTIVE_PRIZES_SET jr z, .disappear scf ccf @@ -3203,7 +3203,7 @@ Script_Jack: script_jump .postgame_done .postgame_repeat get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $00 + compare_loaded_var NONE print_variable_npc_text JackPostgameRepeatText, JackGrandMasterCupPlayedText .postgame_done end_dialog @@ -3236,9 +3236,9 @@ PokemonDome_JackAppearanceCheck: jr nz, .disappear ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr z, .disappear - cp $03 + cp GRAND_MASTER_CUP_ACTIVE_PRIZES_SET jr z, .disappear scf ccf @@ -3260,7 +3260,7 @@ Script_Rod: start_dialog check_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE script_jump_if_b0z .postgame - check_event EVENT_BEAT_FINAL_CUP + check_event EVENT_WON_FINAL_CUP script_jump_if_b0z .final_cup_again check_event EVENT_ENTERED_GRAND_MASTER_CUP script_jump_if_b0z .repeat @@ -3291,7 +3291,7 @@ Script_Rod: script_jump .done .check_cup_state get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $00 + compare_loaded_var NONE print_variable_npc_text RodPostgameRepeatText, RodGrandMasterCupPlayedText .done end_dialog @@ -3307,9 +3307,9 @@ PokemonDome_RodAppearanceCheck: jr nz, .disappear ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr z, .disappear - cp $03 + cp GRAND_MASTER_CUP_ACTIVE_PRIZES_SET jr z, .disappear scf ccf @@ -3364,11 +3364,11 @@ Script_GrandMasterCupClerk: start_script start_dialog get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $05 + compare_loaded_var GRAND_MASTER_CUP_PLAYED script_jump_if_b1z .cup_played - compare_loaded_var $02 + compare_loaded_var GRAND_MASTER_CUP_ACTIVE script_jump_if_b0z .prizes_set - set_var VAR_GRAND_MASTER_CUP_STATE, $03 + set_var VAR_GRAND_MASTER_CUP_STATE, GRAND_MASTER_CUP_ACTIVE_PRIZES_SET script_call Script_SetGrandMasterCupPrizes .prizes_set print_npc_text GrandMasterCupClerkWelcomeText @@ -3379,14 +3379,14 @@ Script_GrandMasterCupClerk: print_npc_text GrandMasterCupClerkInviteText script_jump .enter_prompt .cup_played - compare_loaded_var $06 + compare_loaded_var GRAND_MASTER_CUP_RESULT_LOST print_variable_npc_text GrandMasterCupClerkPlayerLostText, GrandMasterCupClerkPlayerWonGrandFinalText script_jump .done .enter_prompt ask_question GrandMasterCupClerkEnterPromptText, TRUE script_jump_if_b0z .declined - set_var VAR_GRAND_MASTER_CUP_STATE, $04 - set_var VAR_20, $00 + set_var VAR_GRAND_MASTER_CUP_STATE, GRAND_MASTER_CUP_PLAYING + set_var VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP, 0 print_npc_text GrandMasterCupClerkEnterAcceptedText end_dialog script_jump Script_MovePlayerIntoGrandMasterCup @@ -3410,7 +3410,7 @@ Script_PokemonDomeGRLass: start_dialog print_npc_text PokemonDomeGRLassSpectatorText get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $05 + compare_loaded_var GRAND_MASTER_CUP_PLAYED script_jump_if_b1z .cup_played print_npc_text PokemonDomeGRLassAnticipatingText script_jump .done @@ -3433,7 +3433,7 @@ Script_PokemonDomeYoungster: start_script start_dialog get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $05 + compare_loaded_var GRAND_MASTER_CUP_PLAYED script_jump_if_b1z .cup_played print_npc_text PokemonDomeYoungsterSpectatorText script_jump .done @@ -3456,7 +3456,7 @@ Script_PokemonDomeSwimmer: start_script start_dialog get_var VAR_GRAND_MASTER_CUP_STATE - compare_loaded_var $05 + compare_loaded_var GRAND_MASTER_CUP_PLAYED script_jump_if_b0nz .player_won script_jump_if_b1z .player_lost print_npc_text PokemonDomeSwimmerSpectatorText @@ -3477,9 +3477,9 @@ PokemonDome_AppearDuringGrandMasterCup: jr z, .disappear ld a, VAR_GRAND_MASTER_CUP_STATE farcall GetVarValue - cp $02 + cp GRAND_MASTER_CUP_ACTIVE jr c, .disappear - cp $04 + cp GRAND_MASTER_CUP_PLAYING jr c, .appear ld a, EVENT_SET_UNTIL_MAP_RELOAD_1 farcall GetEventValue @@ -3895,9 +3895,9 @@ Func_3ddb8: farcall SetOWScrollState ld a, OWMODE_SCRIPT ld [wOverworldMode], a - ld a, BANK(Func_3e12b) + ld a, BANK(Script_GrandMasterCupHost) ld [wOverworldScriptBank], a - ld hl, Func_3e12b + ld hl, Script_GrandMasterCupHost ld a, l ld [wOverworldScriptPointer], a ld a, h @@ -3925,7 +3925,7 @@ PokemonDomeBack_AfterDuel: farcall GetEventValue jr z, .final_cup ; grand master cup - jp Func_3e2a4 + jp Script_GrandMasterCupAfterDuel .final_cup ld a, VAR_FINAL_CUP_PLAYED_ROUNDS farcall GetVarValue @@ -3962,7 +3962,7 @@ Func_3de91: xor a start_script reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY - script_jump Script_3e158 + script_jump Script_GrandMasterCupRound1Start .done scf @@ -4234,7 +4234,7 @@ Script_FinalCupRound4AfterDuel: db WEST, MOVE_2 db $ff .proceed_prizes - set_event EVENT_BEAT_FINAL_CUP + set_event EVENT_WON_FINAL_CUP set_event EVENT_SET_UNTIL_MAP_RELOAD_1 move_active_npc .NPCMovement_3e0fe wait_for_player_animation @@ -4290,7 +4290,7 @@ Script_FinalCupPlayerLost: db SOUTH, MOVE_1 db $ff -Func_3e12b: +Script_GrandMasterCupHost: ld a, NPC_CUP_HOST ld [wScriptNPC], a ldtx hl, DialogCupHostText @@ -4301,26 +4301,26 @@ Func_3e12b: xor a start_script start_dialog - set_var VAR_0E, $00 - print_npc_text Text0fb2 + set_var VAR_GRANDMASTERCUP_CURRENT_ROUND, 0 + print_npc_text CupHostGrandMasterCupIntroBracketRevealText end_dialog quit_script farcall Func_45573 farcall Func_455a3 ld a, $01 start_script - script_jump Script_3e158 + script_jump Script_GrandMasterCupRound1Start -Script_3e158: - set_var VAR_0E, $01 +Script_GrandMasterCupRound1Start: + set_var VAR_GRANDMASTERCUP_CURRENT_ROUND, 1 set_active_npc NPC_CUP_HOST, DialogCupHostText start_dialog - print_npc_text Text0fb3 + print_npc_text CupHostGrandMasterCupRound1Text end_dialog move_active_npc .NPCMovement_3e1a9 wait_for_player_animation start_dialog - print_npc_text Text0fb4 + print_npc_text CupHostGrandMasterCupRound1CallPlayerText end_dialog move_active_npc .NPCMovement_3e1ae wait_for_player_animation @@ -4329,25 +4329,26 @@ Script_3e158: ld a, $01 start_script start_dialog - print_npc_text Text0fb5 + print_npc_text CupHostGrandMasterCupRound1CallOpponentText end_dialog move_active_npc .NPCMovement_3e1b3 wait_for_player_animation start_dialog - print_npc_text Text0fb6 -.ows_3e188 - print_npc_text Text0fb7 + print_npc_text CupHostGrandMasterCupRound1StartingText +; the only prep opportunity for the cup +.loop_prep + print_npc_text CupHostGrandMasterCupAreYourDecksReadyText ask_question DuelPrepPromptText, FALSE - script_jump_if_b0z .ows_3e19f - print_npc_text Text0fb8 + script_jump_if_b0z .start_duel + print_npc_text CupHostGrandMasterCupMakeYourPreparationsText end_dialog set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY open_menu reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY start_dialog - script_jump .ows_3e188 -.ows_3e19f - print_npc_text Text0fb9 + script_jump .loop_prep +.start_duel + print_npc_text CupHostGrandMasterCupRound1DuelStartText end_dialog end_script farcall SetGrandMasterCupDuelParams @@ -4365,11 +4366,11 @@ Script_3e158: db SOUTH, MOVE_0 db $ff -Script_3e1b8: +Script_GrandMasterCupRound2Start: quit_script farcall Func_455a3 - ld a, VAR_0E - ld c, $02 + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND + ld c, 2 farcall SetVarValue ld a, VAR_1B farcall GetVarValue @@ -4380,12 +4381,12 @@ Script_3e1b8: ld a, $01 start_script start_dialog - print_npc_text Text0fba + print_npc_text CupHostGrandMasterCupRound2Text end_dialog move_active_npc .NPCMovement_3e20d wait_for_player_animation start_dialog - print_npc_text Text0fbb + print_npc_text CupHostGrandMasterCupRound2CallPlayerText end_dialog move_active_npc .NPCMovement_3e212 wait_for_player_animation @@ -4394,12 +4395,12 @@ Script_3e1b8: ld a, $01 start_script start_dialog - print_npc_text Text0fbc + print_npc_text CupHostGrandMasterCupRound2CallOpponentText end_dialog move_active_npc .NPCMovement_3e217 wait_for_player_animation start_dialog - print_npc_text Text0fbd + print_npc_text CupHostGrandMasterCupRound2DuelStartText end_dialog end_script farcall SetGrandMasterCupDuelParams @@ -4417,11 +4418,11 @@ Script_3e1b8: db SOUTH, MOVE_0 db $ff -Script_3e21c: +Script_GrandMasterCupFinalsStart: quit_script farcall Func_455a3 - ld a, VAR_0E - ld c, $03 + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND + ld c, 3 farcall SetVarValue ld a, VAR_1E farcall GetVarValue @@ -4432,12 +4433,12 @@ Script_3e21c: ld a, $01 start_script start_dialog - print_npc_text Text0fbe + print_npc_text CupHostGrandMasterCupFinalsText end_dialog move_active_npc .NPCMovement_3e295 wait_for_player_animation start_dialog - print_npc_text Text0fbf + print_npc_text CupHostGrandMasterCupFinalsCallPlayerText end_dialog move_active_npc .NPCMovement_3e29a wait_for_player_animation @@ -4447,25 +4448,25 @@ Script_3e21c: farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD - jr z, .asm_3e272 + jr z, .ronald farcall LoadGrandMasterCupOpponentLocationAndName ld a, $01 start_script - print_npc_text Text0fc0 - script_jump .ows_3e285 -.asm_3e272 + print_npc_text CupHostGrandMasterCupFinalsCallOpponentClubMasterText + script_jump .start_duel +.ronald ld a, $01 start_script - print_npc_text Text0fc1 + print_npc_text CupHostGrandMasterCupFinalsCallOpponentRonaldText set_active_npc NPC_RONALD, DialogRonaldText - print_npc_text Text0fc2 + print_npc_text RonaldGrandMasterCupFinalsText set_active_npc NPC_CUP_HOST, DialogCupHostText -.ows_3e285 +.start_duel end_dialog move_active_npc .NPCMovement_3e29f wait_for_player_animation start_dialog - print_npc_text Text0fc3 + print_npc_text CupHostGrandMasterCupFinalsDuelStartText end_dialog end_script farcall SetGrandMasterCupDuelParams @@ -4483,19 +4484,21 @@ Script_3e21c: db SOUTH, MOVE_0 db $ff -; mega function -Func_3e2a4: +Script_GrandMasterCupAfterDuel: xor a start_script start_dialog - get_var VAR_0E - compare_loaded_var $03 - script_jump_if_b0nz .ows_3e344 - script_jump_if_b1z .ows_3e416 + get_var VAR_GRANDMASTERCUP_CURRENT_ROUND + compare_loaded_var 3 + script_jump_if_b0nz .after_finals + script_jump_if_b1z .after_grand_finals + +; after round 1 or 2 check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e313 + script_jump_if_b0nz .lost_rounds +; player won round 1 or 2 quit_script - ld a, VAR_0E + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue ld h, $00 ld l, a @@ -4503,18 +4506,19 @@ Func_3e2a4: farcall LoadGrandMasterCupOpponentName ld a, $01 start_script - print_npc_text Text0fc4 + print_npc_text CupHostGrandMasterCupRoundsPlayerWonText end_dialog move_active_npc .NPCMovement_3e333 wait_for_player_animation start_dialog - print_npc_text Text0fc5 + print_npc_text CupHostGrandMasterCupRoundsOpponentEliminatedText end_dialog quit_script farcall Func_45488 farcall GetNPCByDeck_AdjustAmy_PokemonDome push af - ld b, $0f + ld b, BANK(.NPCMovement_3e33f) + ASSERT BANK(.NPCMovement_3e338) == BANK(.NPCMovement_3e33f) ld hl, .NPCMovement_3e33f farcall MoveNPC ld a, NPC_CUP_HOST @@ -4526,15 +4530,15 @@ Func_3e2a4: ld a, $01 start_script start_dialog - print_npc_text Text0fc6 + print_npc_text CupHostGrandMasterCupSeeUpdatedBracketText end_dialog - get_var VAR_0E - compare_loaded_var $01 - script_jump_if_b0nz Script_3e1b8 - script_jump Script_3e21c -.ows_3e313 + get_var VAR_GRANDMASTERCUP_CURRENT_ROUND + compare_loaded_var 1 + script_jump_if_b0nz Script_GrandMasterCupRound2Start + script_jump Script_GrandMasterCupFinalsStart +.lost_rounds quit_script - ld a, VAR_0E + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue ld h, $00 ld l, a @@ -4542,10 +4546,10 @@ Func_3e2a4: farcall LoadGrandMasterCupOpponentName ld a, $01 start_script - print_npc_text Text0fc7 - print_npc_text Text0fc8 + print_npc_text CupHostGrandMasterCupRoundsPlayerLost1Text + print_npc_text CupHostGrandMasterCupRoundsPlayerLost2Text end_dialog - script_jump .ows_3e65d + script_jump Script_GrandMasterCupPlayerLost .NPCMovement_3e333: db EAST, MOVE_2 db SOUTH, MOVE_1 @@ -4559,15 +4563,16 @@ Func_3e2a4: db EAST, MOVE_2 db SOUTH, MOVE_8 db $ff -.ows_3e344: + +.after_finals check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e3c0 - print_npc_text Text0fc9 + script_jump_if_b0nz .lost_finals + print_npc_text CupHostGrandMasterCupFinalsPlayerWon1Text quit_script farcall Func_455a3 ld a, $01 start_script - print_npc_text Text0fca + print_npc_text CupHostGrandMasterCupFinalsPlayerWon2Text end_dialog move_active_npc .NPCMovement_3e405 wait_for_player_animation @@ -4576,29 +4581,31 @@ Func_3e2a4: farcall LoadGrandMasterCupOpponentName ld a, $01 start_script - print_npc_text Text0fcb + print_npc_text CupHostGrandMasterCupFinalsOpponentEliminatedText quit_script ld a, VAR_1E farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD - jr nz, .asm_3e38e + jr nz, .finals_won_against_club_master +; won against Ronald ld a, $01 start_script set_active_npc NPC_RONALD, DialogRonaldText - print_npc_text Text0fcc + print_npc_text RonaldGrandMasterCupFinalsPlayerWonText set_active_npc NPC_CUP_HOST, DialogCupHostText - script_jump .ows_3e393 -.asm_3e38e + script_jump .finals_eliminate_opponent +.finals_won_against_club_master ld a, $01 start_script -.ows_3e393 +.finals_eliminate_opponent end_dialog quit_script farcall Func_45488 farcall GetNPCByDeck_AdjustAmy_PokemonDome push af - ld b, $0f + ld b, BANK(.NPCMovement_3e411) + ASSERT BANK(.NPCMovement_3e40a) == BANK(.NPCMovement_3e411) ld hl, .NPCMovement_3e411 farcall MoveNPC ld a, NPC_CUP_HOST @@ -4609,37 +4616,38 @@ Func_3e2a4: farcall ClearOWObject ld a, $01 start_script - script_jump .ows_3e428 + script_jump Script_GrandMasterCupGrandFinalsStart -.ows_3e3c0: +.lost_finals quit_script farcall LoadGrandMasterCupOpponentName ld a, $01 start_script - print_npc_text Text0fcd + print_npc_text CupHostGrandMasterCupFinalsPlayerLost1Text quit_script farcall Func_455a3 ld a, $01 start_script - print_npc_text Text0fce + print_npc_text CupHostGrandMasterCupFinalsPlayerLost2Text quit_script ld a, VAR_1E farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD - jr nz, .asm_3e3fc + jr nz, .finals_lost_to_club_master +; lost to Ronald ld a, $01 start_script set_active_npc NPC_RONALD, DialogRonaldText - print_npc_text Text0fcf + print_npc_text RonaldGrandMasterCupFinalsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText - script_jump .ows_3e401 -.asm_3e3fc + script_jump .finals_eliminate_player +.finals_lost_to_club_master ld a, $01 start_script -.ows_3e401 +.finals_eliminate_player end_dialog - script_jump .ows_3e65d + script_jump Script_GrandMasterCupPlayerLost .NPCMovement_3e405: db EAST, MOVE_2 db SOUTH, MOVE_1 @@ -4654,51 +4662,53 @@ Func_3e2a4: db SOUTH, MOVE_8 db $ff -.ows_3e416: - get_var VAR_1F - compare_loaded_var $00 - script_jump_if_b0nz .ows_3e494 - compare_loaded_var $02 - script_jump_if_b1nz .ows_3e4f5 - script_jump_if_b0nz .ows_3e552 - script_jump .ows_3e5a4 -.ows_3e428 - set_var VAR_0E, $04 +.after_grand_finals + get_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER + compare_loaded_var GRAND_MASTER_COURTNEY + script_jump_if_b0nz Script_GrandMasterCupGrandFinalsVsCourtneyAfterDuel + compare_loaded_var GRAND_MASTER_JACK + script_jump_if_b1nz Script_GrandMasterCupGrandFinalsVsSteveAfterDuel + script_jump_if_b0nz Script_GrandMasterCupGrandFinalsVsJackAfterDuel + script_jump Script_GrandMasterCupGrandFinalsVsRodAfterDuel + +Script_GrandMasterCupGrandFinalsStart: + set_var VAR_GRANDMASTERCUP_CURRENT_ROUND, 4 start_dialog - print_npc_text Text0fd0 + print_npc_text CupHostGrandMasterCupGrandFinalsText end_dialog set_active_npc NPC_ROD, DialogRodText move_active_npc .NPCMovement_3e44e wait_for_player_animation start_dialog - print_npc_text Text0fd1 - get_random $04 - compare_loaded_var $00 - script_jump_if_b0nz .ows_3e455 - compare_loaded_var $02 - script_jump_if_b1nz .ows_3e4b4 - script_jump_if_b0nz .ows_3e515 - script_jump .ows_3e572 + print_npc_text RodGrandMasterCupGrandFinalsBracketReveal1Text + get_random NUM_GRAND_MASTERS + compare_loaded_var GRAND_MASTER_COURTNEY + script_jump_if_b0nz Script_GrandMasterCupGrandFinalsVsCourtney + compare_loaded_var GRAND_MASTER_JACK + script_jump_if_b1nz Script_GrandMasterCupGrandFinalsVsSteve + script_jump_if_b0nz Script_GrandMasterCupGrandFinalsVsJack + script_jump Script_GrandMasterCupGrandFinalsVsRod .NPCMovement_3e44e: db NORTH, MOVE_1 db WEST, MOVE_4 db SOUTH, MOVE_0 db $ff -.ows_3e455 - set_var VAR_1F, $00 + +Script_GrandMasterCupGrandFinalsVsCourtney: + set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_COURTNEY set_text_ram2 DialogCourtneyText - print_npc_text Text0fd2 + print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd3 + print_npc_text CupHostGrandMasterCupGrandFinalsCallCourtneyText end_dialog move_npc NPC_COURTNEY, .NPCMovement_3e484 move_npc NPC_ROD, .NPCMovement_3e48d wait_for_player_animation start_dialog set_active_npc NPC_COURTNEY, DialogCourtneyText - print_npc_text Text0fd4 + print_npc_text CourtneyGrandMasterCupGrandFinalsText set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd5 + print_npc_text CupHostGrandMasterCupGrandFinalsDuelStartText end_dialog start_duel GRAND_FIRE_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script @@ -4714,34 +4724,36 @@ Func_3e2a4: db SOUTH, MOVE_1 db WEST, MOVE_0 db $ff -.ows_3e494 + +Script_GrandMasterCupGrandFinalsVsCourtneyAfterDuel: set_active_npc NPC_COURTNEY, DialogCourtneyText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e4a3 + script_jump_if_b0nz .lost_to_courtney print_npc_text CourtneyTournamentsPlayerWonText - script_jump .ows_3e5c4 -.ows_3e4a3 - print_npc_text Text0fd6 + script_jump Script_GrandMasterCupChampion +.lost_to_courtney + print_npc_text CourtneyGrandMasterCupGrandFinalsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogCourtneyText - print_npc_text Text0fd7 + print_npc_text CupHostGrandMasterCupGrandFinalsPlayerLostText end_dialog - script_jump .ows_3e65d -.ows_3e4b4 - set_var VAR_1F, $01 + script_jump Script_GrandMasterCupPlayerLost + +Script_GrandMasterCupGrandFinalsVsSteve: + set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_STEVE set_text_ram2 DialogSteveText - print_npc_text Text0fd2 + print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd8 + print_npc_text CupHostGrandMasterCupGrandFinalsCallSteveText end_dialog move_npc NPC_STEVE, .NPCMovement_3e4e3 move_npc NPC_ROD, .NPCMovement_3e4ee wait_for_player_animation start_dialog set_active_npc NPC_STEVE, DialogSteveText - print_npc_text Text0fd9 + print_npc_text SteveGrandMasterCupGrandFinalsText set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd5 + print_npc_text CupHostGrandMasterCupGrandFinalsDuelStartText end_dialog start_duel LEGENDARY_FOSSIL_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script @@ -4758,34 +4770,36 @@ Func_3e2a4: db SOUTH, MOVE_1 db WEST, MOVE_0 db $ff -.ows_3e4f5 + +Script_GrandMasterCupGrandFinalsVsSteveAfterDuel: set_active_npc NPC_STEVE, DialogSteveText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e504 + script_jump_if_b0nz .lost_to_steve print_npc_text SteveTournamentsPlayerWonText - script_jump .ows_3e5c4 -.ows_3e504 + script_jump Script_GrandMasterCupChampion +.lost_to_steve print_npc_text SteveTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogSteveText - print_npc_text Text0fd7 + print_npc_text CupHostGrandMasterCupGrandFinalsPlayerLostText end_dialog - script_jump .ows_3e65d -.ows_3e515 - set_var VAR_1F, $02 + script_jump Script_GrandMasterCupPlayerLost + +Script_GrandMasterCupGrandFinalsVsJack: + set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_JACK set_text_ram2 DialogJackText - print_npc_text Text0fd2 + print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fda + print_npc_text CupHostGrandMasterCupGrandFinalsCallJackText end_dialog move_npc NPC_JACK, .NPCMovement_3e544 move_npc NPC_ROD, .NPCMovement_3e54b wait_for_player_animation start_dialog set_active_npc NPC_JACK, DialogJackText - print_npc_text Text0fdb + print_npc_text JackGrandMasterCupGrandFinalsText set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd5 + print_npc_text CupHostGrandMasterCupGrandFinalsDuelStartText end_dialog start_duel WATER_LEGEND_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script @@ -4800,33 +4814,35 @@ Func_3e2a4: db SOUTH, MOVE_1 db WEST, MOVE_0 db $ff -.ows_3e552 + +Script_GrandMasterCupGrandFinalsVsJackAfterDuel: set_active_npc NPC_JACK, DialogJackText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e561 - print_npc_text Text0fdc - script_jump .ows_3e5c4 -.ows_3e561 + script_jump_if_b0nz .lost_to_jack + print_npc_text JackGrandMasterCupGrandFinalsPlayerWonText + script_jump Script_GrandMasterCupChampion +.lost_to_jack print_npc_text JackTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogJackText - print_npc_text Text0fd7 + print_npc_text CupHostGrandMasterCupGrandFinalsPlayerLostText end_dialog - script_jump .ows_3e65d -.ows_3e572 - set_var VAR_1F, $03 + script_jump Script_GrandMasterCupPlayerLost + +Script_GrandMasterCupGrandFinalsVsRod: + set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_ROD set_text_ram2 DialogRodText - print_npc_text Text0fd2 + print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fdd + print_npc_text CupHostGrandMasterCupGrandFinalsCallRodText end_dialog move_npc NPC_ROD, .NPCMovement_3e59d wait_for_player_animation start_dialog set_active_npc NPC_ROD, DialogRodText - print_npc_text Text0fde + print_npc_text RodGrandMasterCupGrandFinalsText set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fd5 + print_npc_text CupHostGrandMasterCupGrandFinalsDuelStartText end_dialog start_duel GREAT_DRAGON_DECK_ID, MUSIC_MATCH_START_GRAND_MASTER end_script @@ -4836,27 +4852,29 @@ Func_3e2a4: db SOUTH, MOVE_2 db WEST, MOVE_0 db $ff -.ows_3e5a4 + +Script_GrandMasterCupGrandFinalsVsRodAfterDuel: set_active_npc NPC_ROD, DialogRodText check_event EVENT_SET_UNTIL_MAP_RELOAD_2 - script_jump_if_b0nz .ows_3e5b3 + script_jump_if_b0nz .lost_to_rod print_npc_text RodTournamentsPlayerWonText - script_jump .ows_3e5c4 -.ows_3e5b3 + script_jump Script_GrandMasterCupChampion +.lost_to_rod print_npc_text RodTournamentsPlayerLostText set_active_npc NPC_CUP_HOST, DialogCupHostText set_text_ram2 DialogRodText - print_npc_text Text0fd7 + print_npc_text CupHostGrandMasterCupGrandFinalsPlayerLostText end_dialog - script_jump .ows_3e65d -.ows_3e5c4 - set_event EVENT_DB - set_var VAR_GRAND_MASTER_CUP_STATE, $05 + script_jump Script_GrandMasterCupPlayerLost + +Script_GrandMasterCupChampion: + set_event EVENT_WON_GRAND_MASTER_CUP + set_var VAR_GRAND_MASTER_CUP_STATE, GRAND_MASTER_CUP_RESULT_WON set_event EVENT_SET_UNTIL_MAP_RELOAD_1 set_active_npc NPC_CUP_HOST, DialogCupHostText - print_npc_text Text0fdf + print_npc_text CupHostGrandMasterCupGrandFinalsPlayerWonText play_song MUSIC_GRAND_MASTER_CUP_CHAMPION - print_npc_text Text0fe0 + print_npc_text CupHostGrandMasterCupPlayerChampionText wait_song resume_song end_dialog @@ -4864,23 +4882,23 @@ Func_3e2a4: wait_for_player_animation set_player_direction NORTH start_dialog - print_npc_text Text0fe1 + print_npc_text CupHostGrandMasterCupChampionPrizeSelectionText quit_script xor a -.asm_3e5e6 +.loop_load_prizes farcall GetGrandMasterCupPrizeCardID farcall GetGrandMasterCupPrizeCardName - farcall Func_1f7d4 + farcall LoadGrandMasterCupPrizeCardData inc a - cp $04 - jr c, .asm_3e5e6 - farcall Func_1f627 + cp NUM_GRANDMASTERCUP_PRIZE_CANDIDATES + jr c, .loop_load_prizes + farcall SelectGrandMasterCupPrizes push bc ld hl, wScriptNPCName ld a, [hli] ld d, [hl] ld e, a - ldtx hl, Text0fe2 + ldtx hl, CupHostGrandMasterCupChampionPrizesText farcall PrintScrollableText_WithTextBoxLabelVRAM0 pop bc farcall Func_1022a @@ -4898,19 +4916,20 @@ Func_3e2a4: farcall Func_c646 farcall Func_10252 call WaitPalFading + ld a, $01 start_script check_event EVENT_GOT_ARBOK_COIN - script_jump_if_b0z .ows_3e644 - print_npc_text Text0fe3 + script_jump_if_b0z .repeat_champion + print_npc_text CupHostGrandMasterCupFirstChampionRewardsText set_event EVENT_GOT_ARBOK_COIN give_coin COIN_ARBOK - print_npc_text Text0fe4 - script_jump .ows_3e647 -.ows_3e644 - print_npc_text Text0fe5 -.ows_3e647 - print_npc_text Text0fe6 + print_npc_text CupHostGrandMasterCupPlayerFirstChampionCongratsText + script_jump .closing +.repeat_champion + print_npc_text CupHostGrandMasterCupPlayerChampionCongratsText +.closing + print_npc_text CupHostGrandMasterCupPlayerChampionClosingText end_dialog end_script ld a, MAP_POKEMON_DOME @@ -4923,14 +4942,14 @@ Func_3e2a4: db SOUTH, MOVE_1 db $ff -.ows_3e65d: - set_var VAR_GRAND_MASTER_CUP_STATE, $06 +Script_GrandMasterCupPlayerLost: + set_var VAR_GRAND_MASTER_CUP_STATE, GRAND_MASTER_CUP_RESULT_LOST set_event EVENT_SET_UNTIL_MAP_RELOAD_1 set_active_npc NPC_CUP_HOST, DialogCupHostText move_active_npc .NPCMovement_3e681 wait_for_player_animation start_dialog - print_npc_text Text0fe7 + print_npc_text CupHostGrandMasterCupPlayerLostEliminatedText end_dialog move_player .NPCMovement_3e686, TRUE wait_for_player_animation @@ -4948,7 +4967,6 @@ Func_3e2a4: db WEST, MOVE_2 db SOUTH, MOVE_8 db $ff -; end mega function PokemonDomeBack_AppearOnPostgame: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE diff --git a/src/engine/bank10.asm b/src/engine/bank10.asm index 93d3d9f..014d8b0 100644 --- a/src/engine/bank10.asm +++ b/src/engine/bank10.asm @@ -5658,7 +5658,7 @@ Script_43000: print_npc_text Text0928 receive_card GRS_MEWTWO set_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE - set_event EVENT_BEAT_FINAL_CUP + set_event EVENT_WON_FINAL_CUP reset_event EVENT_TALKED_TO_MITCH reset_event EVENT_TALKED_TO_AMY reset_event EVENT_TALKED_TO_KEN diff --git a/src/engine/bank11.asm b/src/engine/bank11.asm index 0f889b4..939b0c1 100644 --- a/src/engine/bank11.asm +++ b/src/engine/bank11.asm @@ -517,7 +517,7 @@ SetGrandMasterCupOpponents: ; for b = bitmask, choose a random opponent and return their deck id in a .PickOpponent: ld hl, GrandMasterCupOpponents - ld a, NUM_GRANDMASTERCUP_OPPONENT_IDS + ld a, NUM_GRANDMASTERCUP_OPPONENT_POOL call Random sla a add_hl_a @@ -561,9 +561,9 @@ GetNPCByDeck_AdjustAmy_PokemonDome: ret Func_45488: - ld a, VAR_0E + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue - cp $02 + cp 2 jr z, .asm_4549c jr nc, .asm_454a4 ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 @@ -704,12 +704,12 @@ Func_45573: ret Func_455a3: - ld a, VAR_0E + ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue - cp $01 + cp 1 jp c, .asm_45658 jr z, .asm_455f0 - cp $02 + cp 2 jr z, .asm_455c8 ld a, EVENT_SET_UNTIL_MAP_RELOAD_2 farcall GetEventValue diff --git a/src/engine/bank4b.asm b/src/engine/bank4b.asm index 7ee9196..c1ccaeb 100644 --- a/src/engine/bank4b.asm +++ b/src/engine/bank4b.asm @@ -828,8 +828,8 @@ _LoadOWObject:: inc hl xor a ld [hli], a ; OWOBJSTRUCT_4 - ld [hli], a ; OWOBJSTRUCT_5 - ld [hli], a ; OWOBJSTRUCT_6 + ld [hli], a ; OWOBJSTRUCT_MOVEMENT_BANK + ld [hli], a ; OWOBJSTRUCT_MOVEMENT_PTR ld [hl], a ; pop hl pop de diff --git a/src/text/text11.asm b/src/text/text11.asm index cf85da8..40a0ac4 100644 --- a/src/text/text11.asm +++ b/src/text/text11.asm @@ -92,7 +92,7 @@ RodYouDoNotDeserveLegendaryCardsText: linefw "では・・・" done -Text0fb2: +CupHostGrandMasterCupIntroBracketRevealText: textfw "さあ グランドマスター杯を" linefw "かいさいします!!" linefw "グランドマスターの みまもるなか!" @@ -101,59 +101,59 @@ Text0fb2: linefw "くみあわせの はっぴょうです" done -Text0fb3: +CupHostGrandMasterCupRound1Text: textfw "それでは トーナメント戦" linefw "だい1回戦を はじめましょう!" done -Text0fb4: +CupHostGrandMasterCupRound1CallPlayerText: textfw "だい 1しあいは" linefw "GR団をたおした さんと" done -Text0fb5: +CupHostGrandMasterCupRound1CallOpponentText: textfw "クラブのマスター!!" linefw "さんです" done -Text0fb6: +CupHostGrandMasterCupRound1StartingText: textfw "さあ それでは" linefw "対戦を はじめましょう" done -Text0fb7: +CupHostGrandMasterCupAreYourDecksReadyText: textfw "2人とも" linefw "デッキのじゅんびは いいですか?" done -Text0fb8: +CupHostGrandMasterCupMakeYourPreparationsText: textfw "それでは" linefw "じゅんびを してください!" done -Text0fb9: +CupHostGrandMasterCupRound1DuelStartText: textfw "よろしいですか" linefw "サイドカードは 6枚です!" linefw "それでは!!" linefw "レディ ゴー!!" done -Text0fba: +CupHostGrandMasterCupRound2Text: textfw "それでは トーナメント戦" linefw "だい2回戦を はじめましょう!" done -Text0fbb: +CupHostGrandMasterCupRound2CallPlayerText: textfw "だい 2しあいは" linefw "GR団をたおした さんと" done -Text0fbc: +CupHostGrandMasterCupRound2CallOpponentText: textfw "クラブのマスター!!" linefw "さんです" done -Text0fbd: +CupHostGrandMasterCupRound2DuelStartText: textfw "さあ それでは" linefw "対戦を はじめましょう" linefw "グランドマスター杯の ルールで" @@ -164,29 +164,29 @@ Text0fbd: linefw "レディ ゴー!!" done -Text0fbe: +CupHostGrandMasterCupFinalsText: textfw "さあ これで けっしょう戦" linefw "しんしゅつしゃが けっていしました" linefw "それでは トーナメント戦" linefw "けっしょう戦を はじめます!" done -Text0fbf: +CupHostGrandMasterCupFinalsCallPlayerText: textfw "けっしょう戦 しんしゅつしゃ!" linefw "ひとりめは さん!!" done -Text0fc0: +CupHostGrandMasterCupFinalsCallOpponentClubMasterText: textfw "そして もうひとり" linefw "クラブマスター !" done -Text0fc1: +CupHostGrandMasterCupFinalsCallOpponentRonaldText: textfw "そして もうひとり" linefw "ランド!" done -Text0fc2: +RonaldGrandMasterCupFinalsText: textfw "おい " linefw "よくまけずに 勝ちのこったな" linefw "だが" @@ -195,7 +195,7 @@ Text0fc2: linefw "このデッキの ちからを みせてやる!" done -Text0fc3: +CupHostGrandMasterCupFinalsDuelStartText: textfw "さあ それでは" linefw "けっしょう戦を はじめましょう" linefw "グランドマスター杯の ルールで" @@ -206,47 +206,47 @@ Text0fc3: linefw "レディ ゴー!!" done -Text0fc4: +CupHostGrandMasterCupRoundsPlayerWonText: textfw "さん" linefw "だい回戦 とっぱです!!" done -Text0fc5: +CupHostGrandMasterCupRoundsOpponentEliminatedText: textfw "さんは ざんねんでした" linefw "きをつけて おかえりください" done -Text0fc6: +CupHostGrandMasterCupSeeUpdatedBracketText: textfw "さあ それでは" linefw "ほかの対戦を みてみましょう!" done -Text0fc7: +CupHostGrandMasterCupRoundsPlayerLost1Text: textfw "勝者!!" linefw "さんです!" done -Text0fc8: +CupHostGrandMasterCupRoundsPlayerLost2Text: textfw "さん" linefw "だい回戦 とっぱです!!" done -Text0fc9: +CupHostGrandMasterCupFinalsPlayerWon1Text: textfw "勝者!!" linefw "さんです!" done -Text0fca: +CupHostGrandMasterCupFinalsPlayerWon2Text: textfw "さん!!" linefw "グランドマスターへ チャレンジです" done -Text0fcb: +CupHostGrandMasterCupFinalsOpponentEliminatedText: textfw "さんは ざんねんでした" linefw "きをつけて おかえりください" done -Text0fcc: +RonaldGrandMasterCupFinalsPlayerWonText: textfw "くそ~!" linefw "また に 勝てないのか?" linefw "いや" @@ -255,24 +255,24 @@ Text0fcc: linefw "おぼえてろ! !!" done -Text0fcd: +CupHostGrandMasterCupFinalsPlayerLost1Text: textfw "勝者!!" linefw "さんです!" done -Text0fce: +CupHostGrandMasterCupFinalsPlayerLost2Text: textfw "さん" linefw "グランドマスターへ チャレンジです" done -Text0fcf: +RonaldGrandMasterCupFinalsPlayerLostText: textfw "みたか !" linefw "オレの じつりょくを!!" linefw "やっぱり オレのほうが" linefw "おまえ なんかより つよいのさ!" done -Text0fd0: +CupHostGrandMasterCupGrandFinalsText: textfw "さあ いよいよ" linefw "グランドマスターとの対戦です!" linefw "さあ こんかいの対戦する" @@ -281,123 +281,123 @@ Text0fd0: linefw "はっぴょうして いただきましょう" done -Text0fd1: +RodGrandMasterCupGrandFinalsBracketReveal1Text: textfw "こんかいの グランドマスター杯の" linefw "対戦あいては・・・" done -Text0fd2: +RodGrandMasterCupGrandFinalsBracketReveal2Text: textfw "グランドマスター!" linefw "!" done -Text0fd3: +CupHostGrandMasterCupGrandFinalsCallCourtneyText: textfw "グランドマスター" linefw "炎のクイーン ヒロコさんです!" done -Text0fd4: +CourtneyGrandMasterCupGrandFinalsText: textfw "いくわよ くん" linefw "ウフフ・・・てかげんは しないわ" done -Text0fd5: +CupHostGrandMasterCupGrandFinalsDuelStartText: textfw "サイドカードは 6枚です" linefw "さあ 対戦です!" done -Text0fd6: +CourtneyGrandMasterCupGrandFinalsPlayerLostText: textfw "ウフフ・・・" linefw "アタシの かちよ ざんねんね" done -Text0fd7: +CupHostGrandMasterCupGrandFinalsPlayerLostText: textfw "勝者! グランドマスター!!" linefw "さんです!" linefw "ああ なんと!!" linefw "さん はいたいです!!" done -Text0fd8: +CupHostGrandMasterCupGrandFinalsCallSteveText: textfw "イナズマの グランドマスター" linefw "サンダー・スティーブさんです!" done -Text0fd9: +SteveGrandMasterCupGrandFinalsText: textfw "サンダー・スティーブとの対戦は" linefw "ビック グレートね!" done -Text0fda: +CupHostGrandMasterCupGrandFinalsCallJackText: textfw "こおりの グランドマスター" linefw "ジェントルマン カネコウジさんです!" done -Text0fdb: +JackGrandMasterCupGrandFinalsText: textfw "わたしの ゴージャスなデッキと" linefw "また 対戦ね こんどはまけない" done -Text0fdc: +JackGrandMasterCupGrandFinalsPlayerWonText: textfw "わたしの ゴージャスなデッキが" linefw "やぶれるとは・・・さすがだ" done -Text0fdd: +CupHostGrandMasterCupGrandFinalsCallRodText: textfw "グランドマスターのリーダー" linefw "リュウドーさんが あいてです!" done -Text0fde: +RodGrandMasterCupGrandFinalsText: textfw "さあ わたし このリュウドーが" linefw "みずから あいてになろう!" done -Text0fdf: +CupHostGrandMasterCupGrandFinalsPlayerWonText: textfw "やりました さん" linefw "おめでとうございます!!" done -Text0fe0: +CupHostGrandMasterCupPlayerChampionText: textfw "グランドマスター杯!" linefw "ゆうしょうです!!" done -Text0fe1: +CupHostGrandMasterCupChampionPrizeSelectionText: textfw "さあ それでは 賞品を" linefw "えらんで いただきましょう!" done -Text0fe2: +CupHostGrandMasterCupChampionPrizesText: textfw "では おうけとりください" linefw "ゆうしょう賞品です!!" done -Text0fe3: +CupHostGrandMasterCupFirstChampionRewardsText: textfw "はじめてのゆうしょう" linefw "おめでとうございます!" linefw "さんには きねんとして" linefw "こちらのコインを さしあげます" done -Text0fe4: +CupHostGrandMasterCupPlayerFirstChampionCongratsText: textfw "あらためて さん" linefw "おめでとうございます" done -Text0fe5: +CupHostGrandMasterCupPlayerChampionCongratsText: textfw "さん" linefw "おめでとうございます" done -Text0fe6: +CupHostGrandMasterCupPlayerChampionClosingText: textfw "こんかいの グランドマスター杯は" linefw "さんの ゆうしょうでした" linefw "では つぎのグランドマスター杯まで" linefw "ごきげんよう さようなら!!" done -Text0fe7: +CupHostGrandMasterCupPlayerLostEliminatedText: textfw "さんは ざんねんでした" linefw "きをつけて おかえりください" done diff --git a/src/text/text4.asm b/src/text/text4.asm index ad4f65a..da2cf63 100644 --- a/src/text/text4.asm +++ b/src/text/text4.asm @@ -464,7 +464,8 @@ DebugBackgroundCoinDisplayText: textfw "BGコインの表示" done -SingleSpaceText: ; Coin-related? +; pseudo-empty +SingleSpaceText: textfw " " done @@ -2274,10 +2275,12 @@ AaronStep4Text: textfw "ステップ4" done +; homonym bug, 商品 (merchandise) should be 賞品 (prize) GrandMasterCupPrizesTitleText: textfw "グランドマスター杯 商品" done +; homonym bug, 商品 (merchandise) should be 賞品 (prize) GrandMasterCupPrizesDialogText: textfw "グランドマスター杯の商品です" linefw "すきなカードを 2枚えらんでください" diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 00a86ca..c87e2d4 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -4031,60 +4031,60 @@ TextOffsets:: textpointer RodYouDeserveLegendaryCardsText ; 0x0faf textpointer RodChallengeBiruritchiText ; 0x0fb0 textpointer RodYouDoNotDeserveLegendaryCardsText ; 0x0fb1 - textpointer Text0fb2 ; 0x0fb2 - textpointer Text0fb3 ; 0x0fb3 - textpointer Text0fb4 ; 0x0fb4 - textpointer Text0fb5 ; 0x0fb5 - textpointer Text0fb6 ; 0x0fb6 - textpointer Text0fb7 ; 0x0fb7 - textpointer Text0fb8 ; 0x0fb8 - textpointer Text0fb9 ; 0x0fb9 - textpointer Text0fba ; 0x0fba - textpointer Text0fbb ; 0x0fbb - textpointer Text0fbc ; 0x0fbc - textpointer Text0fbd ; 0x0fbd - textpointer Text0fbe ; 0x0fbe - textpointer Text0fbf ; 0x0fbf - textpointer Text0fc0 ; 0x0fc0 - textpointer Text0fc1 ; 0x0fc1 - textpointer Text0fc2 ; 0x0fc2 - textpointer Text0fc3 ; 0x0fc3 - textpointer Text0fc4 ; 0x0fc4 - textpointer Text0fc5 ; 0x0fc5 - textpointer Text0fc6 ; 0x0fc6 - textpointer Text0fc7 ; 0x0fc7 - textpointer Text0fc8 ; 0x0fc8 - textpointer Text0fc9 ; 0x0fc9 - textpointer Text0fca ; 0x0fca - textpointer Text0fcb ; 0x0fcb - textpointer Text0fcc ; 0x0fcc - textpointer Text0fcd ; 0x0fcd - textpointer Text0fce ; 0x0fce - textpointer Text0fcf ; 0x0fcf - textpointer Text0fd0 ; 0x0fd0 - textpointer Text0fd1 ; 0x0fd1 - textpointer Text0fd2 ; 0x0fd2 - textpointer Text0fd3 ; 0x0fd3 - textpointer Text0fd4 ; 0x0fd4 - textpointer Text0fd5 ; 0x0fd5 - textpointer Text0fd6 ; 0x0fd6 - textpointer Text0fd7 ; 0x0fd7 - textpointer Text0fd8 ; 0x0fd8 - textpointer Text0fd9 ; 0x0fd9 - textpointer Text0fda ; 0x0fda - textpointer Text0fdb ; 0x0fdb - textpointer Text0fdc ; 0x0fdc - textpointer Text0fdd ; 0x0fdd - textpointer Text0fde ; 0x0fde - textpointer Text0fdf ; 0x0fdf - textpointer Text0fe0 ; 0x0fe0 - textpointer Text0fe1 ; 0x0fe1 - textpointer Text0fe2 ; 0x0fe2 - textpointer Text0fe3 ; 0x0fe3 - textpointer Text0fe4 ; 0x0fe4 - textpointer Text0fe5 ; 0x0fe5 - textpointer Text0fe6 ; 0x0fe6 - textpointer Text0fe7 ; 0x0fe7 + textpointer CupHostGrandMasterCupIntroBracketRevealText ; 0x0fb2 + textpointer CupHostGrandMasterCupRound1Text ; 0x0fb3 + textpointer CupHostGrandMasterCupRound1CallPlayerText ; 0x0fb4 + textpointer CupHostGrandMasterCupRound1CallOpponentText ; 0x0fb5 + textpointer CupHostGrandMasterCupRound1StartingText ; 0x0fb6 + textpointer CupHostGrandMasterCupAreYourDecksReadyText ; 0x0fb7 + textpointer CupHostGrandMasterCupMakeYourPreparationsText ; 0x0fb8 + textpointer CupHostGrandMasterCupRound1DuelStartText ; 0x0fb9 + textpointer CupHostGrandMasterCupRound2Text ; 0x0fba + textpointer CupHostGrandMasterCupRound2CallPlayerText ; 0x0fbb + textpointer CupHostGrandMasterCupRound2CallOpponentText ; 0x0fbc + textpointer CupHostGrandMasterCupRound2DuelStartText ; 0x0fbd + textpointer CupHostGrandMasterCupFinalsText ; 0x0fbe + textpointer CupHostGrandMasterCupFinalsCallPlayerText ; 0x0fbf + textpointer CupHostGrandMasterCupFinalsCallOpponentClubMasterText ; 0x0fc0 + textpointer CupHostGrandMasterCupFinalsCallOpponentRonaldText ; 0x0fc1 + textpointer RonaldGrandMasterCupFinalsText ; 0x0fc2 + textpointer CupHostGrandMasterCupFinalsDuelStartText ; 0x0fc3 + textpointer CupHostGrandMasterCupRoundsPlayerWonText ; 0x0fc4 + textpointer CupHostGrandMasterCupRoundsOpponentEliminatedText ; 0x0fc5 + textpointer CupHostGrandMasterCupSeeUpdatedBracketText ; 0x0fc6 + textpointer CupHostGrandMasterCupRoundsPlayerLost1Text ; 0x0fc7 + textpointer CupHostGrandMasterCupRoundsPlayerLost2Text ; 0x0fc8 + textpointer CupHostGrandMasterCupFinalsPlayerWon1Text ; 0x0fc9 + textpointer CupHostGrandMasterCupFinalsPlayerWon2Text ; 0x0fca + textpointer CupHostGrandMasterCupFinalsOpponentEliminatedText ; 0x0fcb + textpointer RonaldGrandMasterCupFinalsPlayerWonText ; 0x0fcc + textpointer CupHostGrandMasterCupFinalsPlayerLost1Text ; 0x0fcd + textpointer CupHostGrandMasterCupFinalsPlayerLost2Text ; 0x0fce + textpointer RonaldGrandMasterCupFinalsPlayerLostText ; 0x0fcf + textpointer CupHostGrandMasterCupGrandFinalsText ; 0x0fd0 + textpointer RodGrandMasterCupGrandFinalsBracketReveal1Text ; 0x0fd1 + textpointer RodGrandMasterCupGrandFinalsBracketReveal2Text ; 0x0fd2 + textpointer CupHostGrandMasterCupGrandFinalsCallCourtneyText ; 0x0fd3 + textpointer CourtneyGrandMasterCupGrandFinalsText ; 0x0fd4 + textpointer CupHostGrandMasterCupGrandFinalsDuelStartText ; 0x0fd5 + textpointer CourtneyGrandMasterCupGrandFinalsPlayerLostText ; 0x0fd6 + textpointer CupHostGrandMasterCupGrandFinalsPlayerLostText ; 0x0fd7 + textpointer CupHostGrandMasterCupGrandFinalsCallSteveText ; 0x0fd8 + textpointer SteveGrandMasterCupGrandFinalsText ; 0x0fd9 + textpointer CupHostGrandMasterCupGrandFinalsCallJackText ; 0x0fda + textpointer JackGrandMasterCupGrandFinalsText ; 0x0fdb + textpointer JackGrandMasterCupGrandFinalsPlayerWonText ; 0x0fdc + textpointer CupHostGrandMasterCupGrandFinalsCallRodText ; 0x0fdd + textpointer RodGrandMasterCupGrandFinalsText ; 0x0fde + textpointer CupHostGrandMasterCupGrandFinalsPlayerWonText ; 0x0fdf + textpointer CupHostGrandMasterCupPlayerChampionText ; 0x0fe0 + textpointer CupHostGrandMasterCupChampionPrizeSelectionText ; 0x0fe1 + textpointer CupHostGrandMasterCupChampionPrizesText ; 0x0fe2 + textpointer CupHostGrandMasterCupFirstChampionRewardsText ; 0x0fe3 + textpointer CupHostGrandMasterCupPlayerFirstChampionCongratsText ; 0x0fe4 + textpointer CupHostGrandMasterCupPlayerChampionCongratsText ; 0x0fe5 + textpointer CupHostGrandMasterCupPlayerChampionClosingText ; 0x0fe6 + textpointer CupHostGrandMasterCupPlayerLostEliminatedText ; 0x0fe7 textpointer CourtneyWantsToDuelInitialText ; 0x0fe8 textpointer CourtneyWantsToDuelRepeatText ; 0x0fe9 textpointer CourtneyDuelPromptText ; 0x0fea diff --git a/src/wram.asm b/src/wram.asm index e9523ec..23e5267 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -3455,20 +3455,26 @@ wdd76:: ; dd76 wdd77:: ; dd77 ds $1 -wdd78:: ; dd78 +wGrandMasterCupPrizeSelectionMenuCursorPosition:: ; dd78 ds $1 -wdd79:: ; dd79 +wNumGrandMasterCupPrizesSelected:: ; dd79 ds $1 -wdd7a:: ; dd7a - ds $10 +; card name, card id +wGrandMasterCupPrizes:: ; dd7a + ds (2 + 2) * NUM_GRANDMASTERCUP_PRIZE_CANDIDATES -wdd8a:: ; dd8a - ds $4 +wGrandMasterCupPrizesSelectionState:: ; dd8a + ds NUM_GRANDMASTERCUP_PRIZE_CANDIDATES -wdd8e:: ; dd8e - ds $5 +wSelectedGrandMasterCupPrizeItems:: ; dd8e +wSelectedGrandMasterCupPrizeItem1:: ; dd8e + ds $1 +wSelectedGrandMasterCupPrizeItem2:: ; dd8f + ds $1 + + ds $3 wdd93:: ; dd93 ds $1 diff --git a/tools/constants.py b/tools/constants.py index 14df230..1a1942d 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -876,8 +876,8 @@ events = [ "EVENT_OPENED_CHEST_FIGHTING_FORT_5", "EVENT_OPENED_CHEST_FIGHTING_FORT_BASEMENT", "EVENT_SHORT_GR_ISLAND_FLYOVER_SEQUENCE", - "EVENT_BEAT_FINAL_CUP", - "EVENT_DB", + "EVENT_WON_FINAL_CUP", + "EVENT_WON_GRAND_MASTER_CUP", "EVENT_GHOST_MASTER_STATUES_STATE", "EVENT_BATTLED_TOBICHAN", "EVENT_BATTLED_EIJI", @@ -2970,7 +2970,7 @@ vars = [ "VAR_0B", "VAR_FINAL_CUP_PLAYED_ROUNDS", "VAR_GRAND_MASTER_CUP_STATE", - "VAR_0E", + "VAR_GRANDMASTERCUP_CURRENT_ROUND", "VAR_0F", "VAR_GRANDMASTERCUP_PRIZE_INDEX_0", "VAR_GRANDMASTERCUP_PRIZE_INDEX_1", @@ -2987,8 +2987,8 @@ vars = [ "VAR_1C", "VAR_1D", "VAR_1E", - "VAR_1F", - "VAR_20", + "VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER", + "VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP", "VAR_21", "VAR_IMAKUNI_BLACK_WIN_COUNT", "VAR_23", From 45235058f5dd7d1f682e71c118c2b6d066223a67 Mon Sep 17 00:00:00 2001 From: earthoul Date: Sun, 1 Feb 2026 00:49:48 +0900 Subject: [PATCH 11/15] Refactor the bank args of MoveNPC --- src/engine/bank0f.asm | 2 +- src/engine/bank10.asm | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 6acda2e..3dd3fc2 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -7441,7 +7441,7 @@ Func_3f951: Func_3f95e: ld a, [wPlayerOWObject] - ld b, $0f + ld b, BANK(.NPCMovement_3f980) ld hl, .NPCMovement_3f980 farcall MoveNPC call Func_3340 diff --git a/src/engine/bank10.asm b/src/engine/bank10.asm index 014d8b0..4da6f53 100644 --- a/src/engine/bank10.asm +++ b/src/engine/bank10.asm @@ -2712,7 +2712,7 @@ Script_TCGCupRound1AfterDuel: ld b, NORTH lb de, 10, 9 farcall LoadOWObjectInMap - ld b, $10 + ld b, BANK(.NPCMovement_418a1) ld hl, .NPCMovement_418a1 farcall MoveNPC call Func_3340 @@ -2733,7 +2733,7 @@ Script_TCGCupRound1AfterDuel: farcall GetVarValue farcall GetNPCByDeck_AdjustAmy push af - ld b, $10 + ld b, BANK(.NPCMovement_4189c) ld hl, .NPCMovement_4189c farcall MoveNPC call Func_3340 @@ -2839,7 +2839,7 @@ Script_TCGCupRound2AfterDuel: ld b, NORTH lb de, 10, 9 farcall LoadOWObjectInMap - ld b, $10 + ld b, BANK(.NPCMovement_419a6) ld hl, .NPCMovement_419a6 farcall MoveNPC call Func_3340 @@ -2860,7 +2860,7 @@ Script_TCGCupRound2AfterDuel: farcall GetVarValue farcall GetNPCByDeck_AdjustAmy push af - ld b, $10 + ld b, BANK(.NPCMovement_419a1) ld hl, .NPCMovement_419a1 farcall MoveNPC call Func_3340 @@ -3016,7 +3016,7 @@ Script_TCGCupRound3AfterDuel: farcall GetVarValue farcall GetNPCByDeck_AdjustAmy push af - ld b, $10 + ld b, BANK(.NPCMovement_41ae0) ld hl, .NPCMovement_41ae0 farcall MoveNPC call Func_3340 @@ -5321,13 +5321,14 @@ Script_GRCupOpponentEliminated: farcall GetVarValue farcall GetNPCByDeck_AdjustAmy push af - ld b, $10 + ld b, BANK(.NPCMovement_42d9b) ld hl, .NPCMovement_42d9b farcall MoveNPC call Func_3340 pop af push af - ld b, $10 + ld b, BANK(.NPCMovement_42da0) + ASSERT BANK(.NPCMovement_42da0) == BANK(.NPCMovement_42da3) ld hl, .NPCMovement_42da0 farcall MoveNPC ld a, NPC_GR_CUP_CLERK_RIGHT @@ -5337,7 +5338,7 @@ Script_GRCupOpponentEliminated: pop af farcall ClearOWObject ld a, NPC_GR_CUP_CLERK_RIGHT - ld b, $10 + ld b, BANK(.NPCMovement_42da8) ld hl, .NPCMovement_42da8 farcall MoveNPC call Func_3340 @@ -5378,7 +5379,8 @@ Script_GRCupNewChallenger: ld b, NORTH lb de, 11, 10 farcall LoadOWObjectInMap - ld b, $10 + ld b, BANK(.NPCMovement_42e02) + ASSERT BANK(.NPCMovement_42e02) == BANK(.NPCMovement_42e0a) ld hl, .NPCMovement_42e02 farcall MoveNPC ld a, NPC_GR_CUP_CLERK_RIGHT @@ -5386,7 +5388,8 @@ Script_GRCupNewChallenger: farcall MoveNPC call Func_3340 pop af - ld b, $10 + ld b, BANK(.NPCMovement_42e05) + ASSERT BANK(.NPCMovement_42e05) == BANK(.NPCMovement_42e0f) ld hl, .NPCMovement_42e05 farcall MoveNPC ld a, NPC_GR_CUP_CLERK_RIGHT From 70029fced9ff0cb45cf5587c42b02f0a32a3cd7f Mon Sep 17 00:00:00 2001 From: earthoul Date: Tue, 3 Feb 2026 15:04:25 +0900 Subject: [PATCH 12/15] Fix typo --- src/engine/bank0b.asm | 2 +- src/text/text9.asm | 2 +- src/text/text_offsets.asm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/bank0b.asm b/src/engine/bank0b.asm index 7d7e9d5..ab7a67e 100644 --- a/src/engine/bank0b.asm +++ b/src/engine/bank0b.asm @@ -404,7 +404,7 @@ Script_IshiharaTrade3: script_jump .done .start_trade print_npc_text IshiharaAcceptedTrade3Text - print_text TradedhDragoniteLv45ForMarillLv17Text + print_text TradedDragoniteLv45ForMarillLv17Text receive_card MARILL take_card DRAGONITE_LV45 set_event EVENT_ISHIHARA_CARD_TRADE_STATE diff --git a/src/text/text9.asm b/src/text/text9.asm index 4d4a34d..39c431d 100644 --- a/src/text/text9.asm +++ b/src/text/text9.asm @@ -1635,7 +1635,7 @@ IshiharaAcceptedTrade3Text: linefw "それでは さっそく・・・" done -TradedhDragoniteLv45ForMarillLv17Text: +TradedDragoniteLv45ForMarillLv17Text: textfw "は「カイリュー45」と" linefw "「マリル17」を こうかん!" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index c87e2d4..23aeb25 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -3773,7 +3773,7 @@ TextOffsets:: textpointer IshiharaDoNotOwnDragoniteLv45Text ; 0x0ead textpointer IshiharaUsingAllDragoniteLv45InDecksText ; 0x0eae textpointer IshiharaAcceptedTrade3Text ; 0x0eaf - textpointer TradedhDragoniteLv45ForMarillLv17Text ; 0x0eb0 + textpointer TradedDragoniteLv45ForMarillLv17Text ; 0x0eb0 textpointer IshiharaThanksTradedDragoniteLv45Text ; 0x0eb1 textpointer IshiharaHeadingForVillaText ; 0x0eb2 textpointer IshiharaBusyRevisitVillaText ; 0x0eb3 From 044a45c6d0704e5f817d64179ca70d074460275a Mon Sep 17 00:00:00 2001 From: earthoul Date: Wed, 4 Feb 2026 00:03:16 +0900 Subject: [PATCH 13/15] Refactor Grand Master Cup engine funcs --- src/constants/challenge_cup_constants.asm | 21 +- src/constants/var_constants.asm | 24 +- src/engine/bank03.asm | 24 +- src/engine/bank07.asm | 353 +++++++++++++++++----- src/engine/bank0f.asm | 64 ++-- src/engine/bank11.asm | 268 ++++++++-------- src/home/unsorted.asm | 4 +- src/wram.asm | 22 +- tools/constants.py | 24 +- 9 files changed, 525 insertions(+), 279 deletions(-) diff --git a/src/constants/challenge_cup_constants.asm b/src/constants/challenge_cup_constants.asm index cac22e8..6cfe86b 100644 --- a/src/constants/challenge_cup_constants.asm +++ b/src/constants/challenge_cup_constants.asm @@ -53,8 +53,25 @@ DEF NUM_CHALLENGE_CUP_WINS_FOR_COIN_PRIZE EQU 10 const GRANDMASTERCUP_RONALD ; 8 DEF NUM_GRANDMASTERCUP_OPPONENT_POOL EQU const_value -DEF NUM_GRANDMASTERCUP_DUELISTS EQU 8 -DEF NUM_GRANDMASTERCUP_OPPONENTS EQU NUM_GRANDMASTERCUP_DUELISTS - 1 ; 7 +DEF NUM_GRANDMASTERCUP_COMPETITORS EQU 8 +DEF NUM_GRANDMASTERCUP_NPC_COMPETITORS EQU NUM_GRANDMASTERCUP_COMPETITORS - 1 ; 7 + + const_def + const GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 ; 0 + const GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 ; 1 + const GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 ; 2 + const GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 ; 3 + const GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 ; 4 + const GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 ; 5 + const GRANDMASTERCUP_BRACKET_FINAL ; 6 +DEF NUM_GRANDMASTERCUP_BRACKET_MATCHES EQU const_value + + const_def + const GRANDMASTERCUP_BRACKET_LEFT_WON_F ; 0 + const GRANDMASTERCUP_BRACKET_RIGHT_WON_F ; 1 + +DEF GRANDMASTERCUP_BRACKET_LEFT_WON EQU 1 << GRANDMASTERCUP_BRACKET_LEFT_WON_F ; 1 +DEF GRANDMASTERCUP_BRACKET_RIGHT_WON EQU 1 << GRANDMASTERCUP_BRACKET_RIGHT_WON_F ; 2 DEF NUM_TCG_CHALLENGE_CUP_OPPONENT_POOL EQU 44 DEF NUM_GR_CHALLENGE_CUP_OPPONENT_POOL EQU 27 diff --git a/src/constants/var_constants.asm b/src/constants/var_constants.asm index 5f27365..e16dd2c 100644 --- a/src/constants/var_constants.asm +++ b/src/constants/var_constants.asm @@ -19,18 +19,18 @@ const VAR_GRANDMASTERCUP_PRIZE_INDEX_1 ; $11 const VAR_GRANDMASTERCUP_PRIZE_INDEX_2 ; $12 const VAR_GRANDMASTERCUP_PRIZE_INDEX_3 ; $13 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_0 ; $14 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_1 ; $15 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_2 ; $16 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_3 ; $17 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_4 ; $18 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_5 ; $19 - const VAR_GRANDMASTERCUP_OPPONENT_DECK_6 ; $1a - const VAR_1B ; $1b - const VAR_1C ; $1c - const VAR_1D ; $1d - const VAR_1E ; $1e - const VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER ; $1f + const VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID ; $14, vs player + const VAR_GRANDMASTERCUP_ROUND1_NPC2_DECK_ID ; $15 + const VAR_GRANDMASTERCUP_ROUND1_NPC3_DECK_ID ; $16 + const VAR_GRANDMASTERCUP_ROUND1_NPC4_DECK_ID ; $17 + const VAR_GRANDMASTERCUP_ROUND1_NPC5_DECK_ID ; $18 + const VAR_GRANDMASTERCUP_ROUND1_NPC6_DECK_ID ; $19 + const VAR_GRANDMASTERCUP_ROUND1_NPC7_DECK_ID ; $1a + const VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID ; $1b, vs player + const VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID ; $1c + const VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID ; $1d + const VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID ; $1e, vs player + const VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX ; $1f, vs player const VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP ; $20 const VAR_21 ; $21 const VAR_IMAKUNI_BLACK_WIN_COUNT ; $22 diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 9133274..0d8c91d 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -2170,18 +2170,18 @@ GeneralVarMasks: db $09, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_1 db $0a, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_2 db $0b, %11111111 ; VAR_GRANDMASTERCUP_PRIZE_INDEX_3 - db $0c, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_0 - db $0d, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_1 - db $0e, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_2 - db $0f, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_3 - db $10, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_4 - db $11, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_5 - db $12, %11111111 ; VAR_GRANDMASTERCUP_OPPONENT_DECK_6 - db $13, %11111111 ; VAR_1B - db $14, %11111111 ; VAR_1C - db $15, %11111111 ; VAR_1D - db $16, %11111111 ; VAR_1E - db $17, %00000011 ; VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER + db $0c, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID + db $0d, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC2_DECK_ID + db $0e, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC3_DECK_ID + db $0f, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC4_DECK_ID + db $10, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC5_DECK_ID + db $11, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC6_DECK_ID + db $12, %11111111 ; VAR_GRANDMASTERCUP_ROUND1_NPC7_DECK_ID + db $13, %11111111 ; VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID + db $14, %11111111 ; VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID + db $15, %11111111 ; VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID + db $16, %11111111 ; VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID + db $17, %00000011 ; VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX db $17, %00111100 ; VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP db $18, %00000111 ; VAR_21 db $18, %11110000 ; VAR_IMAKUNI_BLACK_WIN_COUNT diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index cc01073..8899d51 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -5851,31 +5851,31 @@ _GiveBoosterPack: farcall GetBoosterPack ret -Func_1e984: +GrandMasterCupBracketScreen: farcall Func_1022a - call Func_1e990 + call ShowGrandMasterCupBracket farcall Func_10252 ret -Func_1e990: +ShowGrandMasterCupBracket: push af push bc push de push hl - call Func_1e99c + call _ShowGrandMasterCupBracket pop hl pop de pop bc pop af ret -Func_1e99c: +_ShowGrandMasterCupBracket: farcall ClearSpriteAnimsAndSetInitialGraphicsConfiguration farcall InitOWObjects - call Func_1e9ce - call Func_1ea1f - call Func_1ea6d - call Func_1eba4 + call .LoadSceneAndPrintTitle + call PrintGrandMasterCupCompetitorNames + call DrawGrandMasterCupBracketAdvancementLines + call PrintGrandMasterCupBracketChampion ld bc, PALETTE_161 farcall GetPaletteGfxPointer ld c, $00 @@ -5887,7 +5887,7 @@ Func_1e99c: farcall FadeToWhiteAndUnsetFrameFunc ret -Func_1e9ce: +.LoadSceneAndPrintTitle: ld a, SCENE_TOURNAMENT_TABLE lb bc, 0, 0 call LoadScene @@ -5899,7 +5899,9 @@ Func_1e9ce: call InitTextPrinting_ProcessTextFromIDVRAM0 ret -Func_1e9ea: +; a = competitor slot [0, 7] +; hl = text (name) to load +LoadGrandMasterCupCompetitorNames: push af push bc push de @@ -5909,7 +5911,7 @@ Func_1e9ea: add a ld c, a ld b, $00 - ld hl, wdd0a + ld hl, wGrandMasterCupCompetitorNames add hl, bc ld [hl], e inc hl @@ -5920,30 +5922,32 @@ Func_1e9ea: pop af ret -Func_1ea00: +InitGrandMasterCupBracket: push af push hl xor a ldtx hl, TxRam1Text -.asm_1ea06 - call Func_1e9ea +.loop_init_names + call LoadGrandMasterCupCompetitorNames inc a - cp $08 - jr nz, .asm_1ea06 - ld hl, wdd1a - ld c, $07 + cp NUM_GRANDMASTERCUP_COMPETITORS + jr nz, .loop_init_names + + ld hl, wGrandMasterCupBracketWinnerSides + ld c, NUM_GRANDMASTERCUP_BRACKET_MATCHES xor a -.asm_1ea14 +.loop_init_results ld [hli], a dec c - jr nz, .asm_1ea14 + jr nz, .loop_init_results + xor a - ld [wdd21], a + ld [wGrandMasterCupBracketWinnerSideBitfield], a pop hl pop af ret -Func_1ea1f: +PrintGrandMasterCupCompetitorNames: push af push bc push de @@ -5952,9 +5956,9 @@ Func_1ea1f: lb bc, 6, 15 farcall FillBoxInBGMapWithZero lb de, 1, 2 - ld hl, wdd0a + ld hl, wGrandMasterCupCompetitorNames xor a -.asm_1ea34 +.loop_print push hl push af ld a, [hli] @@ -5968,73 +5972,78 @@ Func_1ea1f: inc e inc e inc a - cp $08 - jr nz, .asm_1ea34 + cp NUM_GRANDMASTERCUP_COMPETITORS + jr nz, .loop_print pop hl pop de pop bc pop af ret -Func_1ea4c: +; a = bracket match winner side GRANDMASTERCUP_BRACKET_*_WON) +; c = bracket match index (GRANDMASTERCUP_BRACKET_*) +; update wGrandMasterCupBracketWinnerSides and wGrandMasterCupBracketWinnerSideBitfield +UpdateGrandMasterCupBracketResults: push af push bc push hl ld b, $00 - ld hl, wdd1a + ld hl, wGrandMasterCupBracketWinnerSides add hl, bc ld [hl], a + dec a - and $01 + and GRANDMASTERCUP_BRACKET_RIGHT_WON_F inc c -.asm_1ea5a +.loop_shift sla a dec c - jr nz, .asm_1ea5a + jr nz, .loop_shift ld b, a srl b - ld a, [wdd21] + ld a, [wGrandMasterCupBracketWinnerSideBitfield] or b - ld [wdd21], a + ld [wGrandMasterCupBracketWinnerSideBitfield], a pop hl pop bc pop af ret -Func_1ea6d: +DrawGrandMasterCupBracketAdvancementLines: push af push bc push de push hl - ld hl, wdd1a - ld bc, $0 -.asm_1ea77 + ld hl, wGrandMasterCupBracketWinnerSides + ld bc, GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 +.loop_matches ld a, [hli] and a - jr z, .asm_1ea89 + jr z, .next_match push af push bc push de push hl - call Func_1ea94 - call Func_1eaa5 + call .GetTileset + call .Draw pop hl pop de pop bc pop af -.asm_1ea89 +.next_match inc c ld a, c - cp $07 - jr nz, .asm_1ea77 + cp NUM_GRANDMASTERCUP_BRACKET_MATCHES + jr nz, .loop_matches pop hl pop de pop bc pop af ret -Func_1ea94: - ld hl, $6aba +; .tileset_table[c][a-1] +.GetTileset: + ld hl, .tileset_table sla c sla c add hl, bc @@ -6047,8 +6056,7 @@ Func_1ea94: ld l, a ret -Func_1eaa5: -.asm_1eaa5 +.Draw: ld a, [hl] cp $ff ret z @@ -6063,38 +6071,138 @@ Func_1eaa5: ld e, [hl] inc hl call Func_383b - jr .asm_1eaa5 + jr .Draw ret -; 0x1eaba -SECTION "Bank 7@6ba4", ROMX[$6ba4], BANK[$7] +.tileset_table + dw .round1_match1_left_won, .round1_match1_right_won ; GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 + dw .round1_match2_left_won, .round1_match2_right_won ; GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 + dw .round1_match3_left_won, .round1_match3_right_won ; GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 + dw .round1_match4_left_won, .round1_match4_right_won ; GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 + dw .round2_match1_left_won, .round2_match1_right_won ; GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 + dw .round2_match2_left_won, .round2_match2_right_won ; GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 + dw .final_left_won, .final_right_won ; GRANDMASTERCUP_BRACKET_FINAL -Func_1eba4: +; tables +; x, y, (VRAM0 tile index - $80), VRAM1 tile attributes + +.round1_match1_left_won + db 7, 2, $11, $0a + db 8, 2, $12, $0a + db 8, 3, $13, $0a + db $ff + +.round1_match1_right_won + db 7, 4, $11, $0a + db 8, 4, $14, $0a + db 8, 3, $17, $0a + db $ff + +.round1_match2_left_won + db 7, 6, $11, $0a + db 8, 6, $12, $0a + db 8, 7, $13, $0a + db $ff + +.round1_match2_right_won + db 7, 8, $11, $0a + db 8, 8, $14, $0a + db 8, 7, $17, $0a + db $ff + +.round1_match3_left_won + db 7, 10, $11, $0a + db 8, 10, $12, $0a + db 8, 11, $13, $0a + db $ff + +.round1_match3_right_won + db 7, 12, $11, $0a + db 8, 12, $14, $0a + db 8, 11, $17, $0a + db $ff + +.round1_match4_left_won + db 7, 14, $11, $0a + db 8, 14, $12, $0a + db 8, 15, $13, $0a + db $ff + +.round1_match4_right_won + db 7, 16, $11, $0a + db 8, 16, $14, $0a + db 8, 15, $17, $0a + db $ff + +.round2_match1_left_won + db 9, 3, $12, $0a + db 9, 4, $15, $0a + db 9, 5, $13, $0a + db $ff + +.round2_match1_right_won + db 9, 7, $14, $0a + db 9, 6, $15, $0a + db 9, 5, $17, $0a + db $ff + +.round2_match2_left_won + db 9, 11, $12, $0a + db 9, 12, $15, $0a + db 9, 13, $13, $0a + db $ff + +.round2_match2_right_won + db 9, 15, $14, $0a + db 9, 14, $15, $0a + db 9, 13, $17, $0a + db $ff + +.final_left_won + db 10, 5, $12, $0a + db 10, 6, $15, $0a + db 10, 7, $15, $0a + db 10, 8, $15, $0a + db 10, 9, $13, $0a + db 11, 9, $16, $0a + db $ff + +.final_right_won + db 10, 13, $14, $0a + db 10, 12, $15, $0a + db 10, 11, $15, $0a + db 10, 10, $15, $0a + db 10, 9, $17, $0a + db 11, 9, $16, $0a + db $ff + +PrintGrandMasterCupBracketChampion: push af push bc push de push hl ldtx hl, GrandMasterCupBracketChampionshipText - ld a, [wdd20] + ld a, [wGrandMasterCupBracketWinnerSides + GRANDMASTERCUP_BRACKET_FINAL] and a - jr z, .asm_1ebd1 - call Func_1ebe3 + jr z, .print +; final played + call .GetBracketChampionCompetitorIndex push af - farcall Func_4565d - ld [wdd22], a - call Func_1ec0f - ld hl, Func_3d54 + farcall GetGrandMasterCupBracketChampionID + ld [wGrandMasterCupBracketChampion], a + call .DrawSprite + ld hl, SpinGrandMasterCupBracketChampionSprite call Func_3f6b pop af add a ld c, a ld b, $00 - ld hl, wdd0a + ld hl, wGrandMasterCupCompetitorNames add hl, bc ld a, [hli] ld h, [hl] ld l, a -.asm_1ebd1 +.print lb de, 13, 9 lb bc, 6, 1 farcall FillBoxInBGMapWithZero @@ -6105,14 +6213,14 @@ Func_1eba4: pop af ret -Func_1ebe3: +.GetBracketChampionCompetitorIndex: push bc push de push hl - ld hl, $6bff - ld d, $00 -.asm_1ebeb - ld a, [wdd21] + ld hl, .advancement_lines + ld d, 0 +.loop_check_champion + ld a, [wGrandMasterCupBracketWinnerSideBitfield] ld b, [hl] inc hl and b @@ -6120,41 +6228,134 @@ Func_1ebe3: inc hl inc d cp c - jr nz, .asm_1ebeb + jr nz, .loop_check_champion dec d ld a, d - and $07 + and NUM_GRANDMASTERCUP_COMPETITORS - 1 pop hl pop de pop bc ret -; 0x1ebff -SECTION "Bank 7@6c0f", ROMX[$6c0f], BANK[$7] +; matches (bitmask) and results +.advancement_lines: + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 | \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_LEFT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_FINAL + db \ + 1 << GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 | \ + 1 << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + 1 << GRANDMASTERCUP_BRACKET_FINAL, \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 | \ + GRANDMASTERCUP_BRACKET_RIGHT_WON_F << GRANDMASTERCUP_BRACKET_FINAL -Func_1ec0f: +.DrawSprite: push af push bc push de push hl - ld a, [wdd22] + ld a, [wGrandMasterCupBracketChampion] ld b, SOUTH ld d, 112 ld e, 48 farcall LoadOWObject farcall ResetOWObjectSpriteAnimating - ld b, $01 + ld b, $01 ; SPRITEANIMSTRUCT_FRAME_INDEX farcall _SetOWObjectFrameIndex xor a - ld [wdd24], a + ld [wGrandMasterCupBracketChampionSpriteAnimTick], a ld a, $02 - ld [wdd23], a + ld [wGrandMasterCupBracketChampionSpriteAnimIndex], a pop hl pop de pop bc pop af ret -; 0x1ec38 + +_SpinGrandMasterCupBracketChampionSprite:: + ld a, [wGrandMasterCupBracketChampionSpriteAnimTick] + inc a + and $07 + ld [wGrandMasterCupBracketChampionSpriteAnimTick], a + and a + ret nz + + ld a, [wGrandMasterCupBracketChampionSpriteAnimIndex] + inc a + and $1f + ld [wGrandMasterCupBracketChampionSpriteAnimIndex], a + ld c, a + ld b, $00 + ld hl, .direction + add hl, bc + ld a, [hl] + ld b, a + ld a, [wGrandMasterCupBracketChampion] + farcall _SetOWObjectDirection + ld a, b + and $01 + xor $01 + ld b, a + ld a, [wGrandMasterCupBracketChampion] + farcall _SetOWObjectFrameIndex + ret + +.direction: + db SOUTH, SOUTH, SOUTH, SOUTH +REPT 4 + db SOUTH, WEST, NORTH, EAST +ENDR +REPT 3 + db SOUTH, SOUTH, SOUTH, SOUTH +ENDR +; 0x1ec8a SECTION "Bank 7@6c96", ROMX[$6c96], BANK[$7] diff --git a/src/engine/bank0f.asm b/src/engine/bank0f.asm index 3dd3fc2..37d7d6c 100644 --- a/src/engine/bank0f.asm +++ b/src/engine/bank0f.asm @@ -2901,7 +2901,7 @@ Func_3d6ca: ld [wOverworldScriptPointer], a ld a, h ld [wOverworldScriptPointer + 1], a - jr .asm_3d711 + jr .loaded_ow_script .after_grand_master_cup ld a, OWMODE_SCRIPT ld [wOverworldMode], a @@ -2912,7 +2912,7 @@ Func_3d6ca: ld [wOverworldScriptPointer], a ld a, h ld [wOverworldScriptPointer + 1], a -.asm_3d711 +.loaded_ow_script ld a, $00 call Func_338f scf @@ -3744,7 +3744,7 @@ Script_SetGrandMasterCupPrizes: start_script script_ret -; return a = random prize index, while also ensuring no dupes +; return c = random prize index, while also ensuring no dupes .PickPrize: ld a, NUM_GRANDMASTERCUP_PRIZE_POOL call Random @@ -3882,8 +3882,8 @@ Func_3ddb8: ld b, WEST farcall SetOWObjectTilePositionAndDirection farcall SetGrandMasterCupOpponents - farcall Func_454fa - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + farcall SetGrandMasterCupNPCMatchWinners + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID farcall GetVarValue farcall GetNPCByDeck_AdjustAmy_PokemonDome lb de, 9, 4 @@ -3958,7 +3958,7 @@ Func_3de91: call .GrandMasterCup jr .done .GrandMasterCup: - farcall Func_45573 + farcall InitAndLoadGrandMasterCupOpponentNames xor a start_script reset_event EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE_DUMMY @@ -3973,7 +3973,7 @@ Func_3deca: ld a, EVENT_MASONS_LAB_CHALLENGE_MACHINE_STATE farcall GetEventValue ret z - farcall Func_45573 + farcall InitAndLoadGrandMasterCupOpponentNames ret Script_FinalCupIntroAndRound1Start: @@ -4305,8 +4305,8 @@ Script_GrandMasterCupHost: print_npc_text CupHostGrandMasterCupIntroBracketRevealText end_dialog quit_script - farcall Func_45573 - farcall Func_455a3 + farcall InitAndLoadGrandMasterCupOpponentNames + farcall SetupAndShowGrandMasterCupBracket ld a, $01 start_script script_jump Script_GrandMasterCupRound1Start @@ -4325,7 +4325,7 @@ Script_GrandMasterCupRound1Start: move_active_npc .NPCMovement_3e1ae wait_for_player_animation quit_script - farcall LoadGrandMasterCupOpponentLocationAndName + farcall LoadGrandMasterCupCurOpponentLocationAndName ld a, $01 start_script start_dialog @@ -4368,11 +4368,11 @@ Script_GrandMasterCupRound1Start: Script_GrandMasterCupRound2Start: quit_script - farcall Func_455a3 + farcall SetupAndShowGrandMasterCupBracket ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND ld c, 2 farcall SetVarValue - ld a, VAR_1B + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID farcall GetVarValue farcall GetNPCByDeck_AdjustAmy_PokemonDome lb de, 9, 4 @@ -4391,7 +4391,7 @@ Script_GrandMasterCupRound2Start: move_active_npc .NPCMovement_3e212 wait_for_player_animation quit_script - farcall LoadGrandMasterCupOpponentLocationAndName + farcall LoadGrandMasterCupCurOpponentLocationAndName ld a, $01 start_script start_dialog @@ -4420,11 +4420,11 @@ Script_GrandMasterCupRound2Start: Script_GrandMasterCupFinalsStart: quit_script - farcall Func_455a3 + farcall SetupAndShowGrandMasterCupBracket ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND ld c, 3 farcall SetVarValue - ld a, VAR_1E + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue farcall GetNPCByDeck_AdjustAmy_PokemonDome lb de, 9, 4 @@ -4444,12 +4444,12 @@ Script_GrandMasterCupFinalsStart: wait_for_player_animation start_dialog quit_script - ld a, VAR_1E + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD jr z, .ronald - farcall LoadGrandMasterCupOpponentLocationAndName + farcall LoadGrandMasterCupCurOpponentLocationAndName ld a, $01 start_script print_npc_text CupHostGrandMasterCupFinalsCallOpponentClubMasterText @@ -4503,7 +4503,7 @@ Script_GrandMasterCupAfterDuel: ld h, $00 ld l, a call LoadTxRam3 - farcall LoadGrandMasterCupOpponentName + farcall LoadGrandMasterCupCurOpponentName ld a, $01 start_script print_npc_text CupHostGrandMasterCupRoundsPlayerWonText @@ -4514,7 +4514,7 @@ Script_GrandMasterCupAfterDuel: print_npc_text CupHostGrandMasterCupRoundsOpponentEliminatedText end_dialog quit_script - farcall Func_45488 + farcall GetGrandMasterCupCurOpponent farcall GetNPCByDeck_AdjustAmy_PokemonDome push af ld b, BANK(.NPCMovement_3e33f) @@ -4543,7 +4543,7 @@ Script_GrandMasterCupAfterDuel: ld h, $00 ld l, a call LoadTxRam3 - farcall LoadGrandMasterCupOpponentName + farcall LoadGrandMasterCupCurOpponentName ld a, $01 start_script print_npc_text CupHostGrandMasterCupRoundsPlayerLost1Text @@ -4569,7 +4569,7 @@ Script_GrandMasterCupAfterDuel: script_jump_if_b0nz .lost_finals print_npc_text CupHostGrandMasterCupFinalsPlayerWon1Text quit_script - farcall Func_455a3 + farcall SetupAndShowGrandMasterCupBracket ld a, $01 start_script print_npc_text CupHostGrandMasterCupFinalsPlayerWon2Text @@ -4578,12 +4578,12 @@ Script_GrandMasterCupAfterDuel: wait_for_player_animation start_dialog quit_script - farcall LoadGrandMasterCupOpponentName + farcall LoadGrandMasterCupCurOpponentName ld a, $01 start_script print_npc_text CupHostGrandMasterCupFinalsOpponentEliminatedText quit_script - ld a, VAR_1E + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD @@ -4601,7 +4601,7 @@ Script_GrandMasterCupAfterDuel: .finals_eliminate_opponent end_dialog quit_script - farcall Func_45488 + farcall GetGrandMasterCupCurOpponent farcall GetNPCByDeck_AdjustAmy_PokemonDome push af ld b, BANK(.NPCMovement_3e411) @@ -4620,17 +4620,17 @@ Script_GrandMasterCupAfterDuel: .lost_finals quit_script - farcall LoadGrandMasterCupOpponentName + farcall LoadGrandMasterCupCurOpponentName ld a, $01 start_script print_npc_text CupHostGrandMasterCupFinalsPlayerLost1Text quit_script - farcall Func_455a3 + farcall SetupAndShowGrandMasterCupBracket ld a, $01 start_script print_npc_text CupHostGrandMasterCupFinalsPlayerLost2Text quit_script - ld a, VAR_1E + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue farcall GetNPCByDeck cp NPC_RONALD @@ -4663,7 +4663,7 @@ Script_GrandMasterCupAfterDuel: db $ff .after_grand_finals - get_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER + get_var VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX compare_loaded_var GRAND_MASTER_COURTNEY script_jump_if_b0nz Script_GrandMasterCupGrandFinalsVsCourtneyAfterDuel compare_loaded_var GRAND_MASTER_JACK @@ -4695,7 +4695,7 @@ Script_GrandMasterCupGrandFinalsStart: db $ff Script_GrandMasterCupGrandFinalsVsCourtney: - set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_COURTNEY + set_var VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX, GRAND_MASTER_COURTNEY set_text_ram2 DialogCourtneyText print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText @@ -4740,7 +4740,7 @@ Script_GrandMasterCupGrandFinalsVsCourtneyAfterDuel: script_jump Script_GrandMasterCupPlayerLost Script_GrandMasterCupGrandFinalsVsSteve: - set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_STEVE + set_var VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX, GRAND_MASTER_STEVE set_text_ram2 DialogSteveText print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText @@ -4786,7 +4786,7 @@ Script_GrandMasterCupGrandFinalsVsSteveAfterDuel: script_jump Script_GrandMasterCupPlayerLost Script_GrandMasterCupGrandFinalsVsJack: - set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_JACK + set_var VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX, GRAND_MASTER_JACK set_text_ram2 DialogJackText print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText @@ -4830,7 +4830,7 @@ Script_GrandMasterCupGrandFinalsVsJackAfterDuel: script_jump Script_GrandMasterCupPlayerLost Script_GrandMasterCupGrandFinalsVsRod: - set_var VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER, GRAND_MASTER_ROD + set_var VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX, GRAND_MASTER_ROD set_text_ram2 DialogRodText print_npc_text RodGrandMasterCupGrandFinalsBracketReveal2Text set_active_npc NPC_CUP_HOST, DialogCupHostText diff --git a/src/engine/bank11.asm b/src/engine/bank11.asm index 939b0c1..6dcbe24 100644 --- a/src/engine/bank11.asm +++ b/src/engine/bank11.asm @@ -474,8 +474,8 @@ SetChallengeCupDuelParams: SetGrandMasterCupOpponents: ; init - ld e, NUM_GRANDMASTERCUP_OPPONENTS - ld d, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + ld e, NUM_GRANDMASTERCUP_NPC_COMPETITORS + ld d, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID ld c, $ff .loop_init ld a, d @@ -503,13 +503,13 @@ SetGrandMasterCupOpponents: jr c, .loop_pick push bc ld d, a - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID add c ld c, d farcall SetVarValue pop bc inc c - ld a, NUM_GRANDMASTERCUP_OPPONENTS + ld a, NUM_GRANDMASTERCUP_NPC_COMPETITORS cp c jr nz, .loop_set_opponents ret @@ -535,7 +535,7 @@ SetGrandMasterCupOpponents: ld d, a farcall GetNPCByDeck ld l, a - ld e, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + ld e, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID .loop_check ld a, e farcall GetVarValue @@ -560,27 +560,29 @@ GetNPCByDeck_AdjustAmy_PokemonDome: call GetNPCByDeck_AdjustAmy ret -Func_45488: +; return a = opponent deck id of the current round (1, 2, finals) +GetGrandMasterCupCurOpponent: ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue cp 2 - jr z, .asm_4549c - jr nc, .asm_454a4 - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + jr z, .round2 + jr nc, .finals +; round 1 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID farcall GetVarValue - jr .asm_454aa -.asm_4549c - ld a, VAR_1B + jr .done +.round2 + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID farcall GetVarValue - jr .asm_454aa -.asm_454a4 - ld a, VAR_1E + jr .done +.finals + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue -.asm_454aa +.done ret SetGrandMasterCupDuelParams: - call Func_45488 + call GetGrandMasterCupCurOpponent ld [wNPCDuelDeckID], a ld a, MUSIC_MATCH_START_CLUB_MASTER ld [wDuelStartTheme], a @@ -588,8 +590,8 @@ SetGrandMasterCupDuelParams: set 1, [hl] ret -LoadGrandMasterCupOpponentLocationAndName: - call Func_45488 +LoadGrandMasterCupCurOpponentLocationAndName: + call GetGrandMasterCupCurOpponent farcall GetNPCByDeck farcall LoadNPCDuelist ld a, [wCurrentNPCDuelistData + NPC_DUELIST_STRUCT_LOCATION_NAME] @@ -607,8 +609,8 @@ LoadGrandMasterCupOpponentLocationAndName: ld [wTxRam2_b + 1], a ret -LoadGrandMasterCupOpponentName: - call Func_45488 +LoadGrandMasterCupCurOpponentName: + call GetGrandMasterCupCurOpponent farcall GetNPCByDeck farcall LoadNPCDuelist ld a, [wCurrentNPCDuelistData + NPC_DUELIST_STRUCT_DIALOG_NAME] @@ -618,68 +620,77 @@ LoadGrandMasterCupOpponentName: call LoadTxRam2 ret -Func_454fa: - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_1 +; determine all non-player match results up to finals +; by UpdateRNGSources + rrca +SetGrandMasterCupNPCMatchWinners: +; round 1 match 2 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC2_DECK_ID farcall GetVarValue ld c, a call UpdateRNGSources rrca - jr nc, .asm_4550e - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_2 + jr nc, .got_winner_round1_match2 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC3_DECK_ID farcall GetVarValue ld c, a -.asm_4550e - ld a, VAR_1B +.got_winner_round1_match2 + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID farcall SetVarValue - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_3 + +; round 1 match 3 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC4_DECK_ID farcall GetVarValue ld c, a call UpdateRNGSources rrca - jr nc, .asm_45528 - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_4 + jr nc, .got_winner_round1_match3 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC5_DECK_ID farcall GetVarValue ld c, a -.asm_45528 - ld a, VAR_1C +.got_winner_round1_match3 + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID farcall SetVarValue - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_6 + +; round 1 match 4 and round 2 match 2 +; Ronald is guaranteed to advance to finals + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC7_DECK_ID farcall GetVarValue ld c, a farcall GetNPCByDeck cp NPC_RONALD - jr z, .asm_4554a + jr z, .got_winner_round1_match4 call UpdateRNGSources rrca - jr c, .asm_4554a - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_5 + jr c, .got_winner_round1_match4 + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC6_DECK_ID farcall GetVarValue ld c, a -.asm_4554a - ld a, VAR_1D +.got_winner_round1_match4 + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID farcall SetVarValue - ld a, VAR_1D + + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID farcall GetVarValue ld c, a farcall GetNPCByDeck cp NPC_RONALD - jr z, .asm_4556c + jr z, .got_winner_round2_match2 call UpdateRNGSources rrca - jr c, .asm_4556c - ld a, VAR_1C + jr c, .got_winner_round2_match2 + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID farcall GetVarValue ld c, a -.asm_4556c - ld a, VAR_1E +.got_winner_round2_match2 + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall SetVarValue ret -Func_45573: - farcall Func_1ea00 - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_0 - ld c, $01 -.asm_4557b +InitAndLoadGrandMasterCupOpponentNames: + farcall InitGrandMasterCupBracket + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID + ld c, 1 +.loop_load push af push bc farcall GetVarValue @@ -691,116 +702,133 @@ Func_45573: ld h, a pop bc ld a, c - farcall Func_1e9ea + farcall LoadGrandMasterCupCompetitorNames inc c - ld a, $08 + ld a, NUM_GRANDMASTERCUP_COMPETITORS cp c - jr z, .asm_455a1 + jr z, .done pop af inc a - jr .asm_4557b -.asm_455a1 + jr .loop_load +.done pop af ret -Func_455a3: +; defaults to the left (top) side being the match winner, +; so adjust with *_RIGHT_WON otherwise +SetupAndShowGrandMasterCupBracket: ld a, VAR_GRANDMASTERCUP_CURRENT_ROUND farcall GetVarValue cp 1 - jp c, .asm_45658 - jr z, .asm_455f0 + jp c, .draw_bracket + jr z, .draw_round1_results cp 2 - jr z, .asm_455c8 + jr z, .draw_round2_results + +; draw final results ld a, EVENT_SET_UNTIL_MAP_RELOAD_2 farcall GetEventValue - ld c, $06 - jr z, .asm_455c2 - ld a, $01 - jr .asm_455c4 -.asm_455c2 - ld a, $02 -.asm_455c4 - farcall Func_1ea4c -.asm_455c8 - ld c, $04 - ld a, $01 - farcall Func_1ea4c - ld c, $05 - ld a, $01 - farcall Func_1ea4c - ld a, VAR_1C + ld c, GRANDMASTERCUP_BRACKET_FINAL + jr z, .player_lost_finals + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + jr .checked_final_result +.player_lost_finals + ld a, GRANDMASTERCUP_BRACKET_RIGHT_WON +.checked_final_result + farcall UpdateGrandMasterCupBracketResults + +.draw_round2_results + ld c, GRANDMASTERCUP_BRACKET_ROUND2_MATCH1 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults + + ld c, GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults +; check round2-match2 result + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID farcall GetVarValue ld c, a - ld a, VAR_1E + ld a, VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID farcall GetVarValue cp c - jr z, .asm_455f0 - ld c, $05 - ld a, $02 - farcall Func_1ea4c -.asm_455f0 - ld c, $00 - ld a, $01 - farcall Func_1ea4c - ld c, $01 - ld a, $01 - farcall Func_1ea4c - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_1 + jr z, .draw_round1_results + ld c, GRANDMASTERCUP_BRACKET_ROUND2_MATCH2 + ld a, GRANDMASTERCUP_BRACKET_RIGHT_WON + farcall UpdateGrandMasterCupBracketResults + +.draw_round1_results + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH1 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults + + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults +; check round1-match2 result + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC2_DECK_ID farcall GetVarValue ld c, a - ld a, VAR_1B + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID farcall GetVarValue cp c - jr z, .asm_45618 - ld c, $01 - ld a, $02 - farcall Func_1ea4c -.asm_45618 - ld c, $02 - ld a, $01 - farcall Func_1ea4c - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_3 + jr z, .round1_match3 + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH2 + ld a, GRANDMASTERCUP_BRACKET_RIGHT_WON + farcall UpdateGrandMasterCupBracketResults + +.round1_match3 + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults +; check round1-match3 result + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC4_DECK_ID farcall GetVarValue ld c, a - ld a, VAR_1C + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID farcall GetVarValue cp c - jr z, .asm_45638 - ld c, $02 - ld a, $02 - farcall Func_1ea4c -.asm_45638 - ld c, $03 - ld a, $01 - farcall Func_1ea4c - ld a, VAR_GRANDMASTERCUP_OPPONENT_DECK_5 + jr z, .round1_match4 + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH3 + ld a, GRANDMASTERCUP_BRACKET_RIGHT_WON + farcall UpdateGrandMasterCupBracketResults + +.round1_match4 + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 + ld a, GRANDMASTERCUP_BRACKET_LEFT_WON + farcall UpdateGrandMasterCupBracketResults +; check round1-match4 result + ld a, VAR_GRANDMASTERCUP_ROUND1_NPC6_DECK_ID farcall GetVarValue ld c, a - ld a, VAR_1D + ld a, VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID farcall GetVarValue cp c - jr z, .asm_45658 - ld c, $03 - ld a, $02 - farcall Func_1ea4c -.asm_45658 - farcall Func_1e984 + jr z, .draw_bracket + ld c, GRANDMASTERCUP_BRACKET_ROUND1_MATCH4 + ld a, GRANDMASTERCUP_BRACKET_RIGHT_WON + farcall UpdateGrandMasterCupBracketResults + +.draw_bracket + farcall GrandMasterCupBracketScreen ret -Func_4565d: +; a = bracket champion's competitor index, player (0) or npc 1--7 +; return a = NPC ID +GetGrandMasterCupBracketChampionID: push bc push de push hl or a - jr nz, .asm_45668 + jr nz, .npc ld a, [wPlayerOWObject] - jr .asm_45672 -.asm_45668 + jr .done +.npc dec a - add VAR_GRANDMASTERCUP_OPPONENT_DECK_0 + add VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID farcall GetVarValue call GetNPCByDeck_AdjustAmy_PokemonDome -.asm_45672 +.done pop hl pop de pop bc diff --git a/src/home/unsorted.asm b/src/home/unsorted.asm index 0326a52..ec1e571 100644 --- a/src/home/unsorted.asm +++ b/src/home/unsorted.asm @@ -2482,12 +2482,12 @@ ResetActiveMusicState:: ld [wActiveMusicState], a ret -Func_3d54:: +SpinGrandMasterCupBracketChampionSprite:: push af push bc push de push hl - farcall $7, $6c38 + farcall _SpinGrandMasterCupBracketChampionSprite pop hl pop de pop bc diff --git a/src/wram.asm b/src/wram.asm index 23e5267..72596d4 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -3340,25 +3340,25 @@ wCurBoosterPack:: ; dd08 wAnotherBoosterPack:: ; dd09 ds $1 -wdd0a:: ; dd0a - ds $10 +wGrandMasterCupCompetitorNames:: ; dd0a + ds 2 * NUM_GRANDMASTERCUP_COMPETITORS -wdd1a:: ; dd1a - ds $6 +; store the winner side (GRANDMASTERCUP_BRACKET_*_WON) for each match +wGrandMasterCupBracketWinnerSides:: ; dd1a + ds NUM_GRANDMASTERCUP_BRACKET_MATCHES -wdd20:: ; dd20 +; GRANDMASTERCUP_BRACKET_*_WON_F bitfield +wGrandMasterCupBracketWinnerSideBitfield:: ; dd21 ds $1 -wdd21:: ; dd21 +; NPC ID +wGrandMasterCupBracketChampion:: ; dd22 ds $1 -wdd22:: ; dd22 +wGrandMasterCupBracketChampionSpriteAnimIndex:: ; dd23 ds $1 -wdd23:: ; dd23 - ds $1 - -wdd24:: ; dd24 +wGrandMasterCupBracketChampionSpriteAnimTick:: ; dd24 ds $1 wdd25:: ; dd25 diff --git a/tools/constants.py b/tools/constants.py index 1a1942d..2c55628 100644 --- a/tools/constants.py +++ b/tools/constants.py @@ -2976,18 +2976,18 @@ vars = [ "VAR_GRANDMASTERCUP_PRIZE_INDEX_1", "VAR_GRANDMASTERCUP_PRIZE_INDEX_2", "VAR_GRANDMASTERCUP_PRIZE_INDEX_3", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_0", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_1", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_2", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_3", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_4", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_5", - "VAR_GRANDMASTERCUP_OPPONENT_DECK_6", - "VAR_1B", - "VAR_1C", - "VAR_1D", - "VAR_1E", - "VAR_GRANDMASTERCUP_OPPONENT_GRAND_MASTER", + "VAR_GRANDMASTERCUP_ROUND1_NPC1_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC2_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC3_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC4_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC5_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC6_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND1_NPC7_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND2_NPC1_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND2_NPC2_DECK_ID", + "VAR_GRANDMASTERCUP_ROUND2_NPC3_DECK_ID", + "VAR_GRANDMASTERCUP_FINAL_NPC_DECK_ID", + "VAR_GRANDMASTERCUP_GF_GRAND_MASTER_INDEX", "VAR_TIMES_WON_LINK_DUEL_FOR_GRAND_MASTER_CUP", "VAR_21", "VAR_IMAKUNI_BLACK_WIN_COUNT", From 811f681351535efd9c7e13566823ee8562646f03 Mon Sep 17 00:00:00 2001 From: earthoul Date: Wed, 4 Feb 2026 00:06:09 +0900 Subject: [PATCH 14/15] Fill the small gap following Grand Master Cup engine --- src/engine/bank07.asm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 8899d51..129dbab 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -6355,9 +6355,12 @@ ENDR REPT 3 db SOUTH, SOUTH, SOUTH, SOUTH ENDR -; 0x1ec8a -SECTION "Bank 7@6c96", ROMX[$6c96], BANK[$7] +MinicomMailboxScreen: + farcall Func_1022a + call MinicomMailbox + farcall Func_10252 + ret MinicomMailbox: push af From 41038c95e128bb4b558f776211cd080df67f1b67 Mon Sep 17 00:00:00 2001 From: earthoul Date: Wed, 4 Feb 2026 02:02:59 +0900 Subject: [PATCH 15/15] Disassemble engines for sending and receiving deck config modified versions of Deck Save Machine --- src/engine/bank02.asm | 4 +- src/engine/bank0e.asm | 154 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 150 insertions(+), 8 deletions(-) diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index cac0b11..bb78577 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -7614,11 +7614,11 @@ HandleGiftCenter:: dw .ReceiveDeckConfiguration .SendDeckConfiguration: - farcall $e, $7d5c ; Func_3bd5c + farcall SendDeckConfigurationMenu ret .ReceiveDeckConfiguration: - farcall $e, $7dd0 ; Func_3bdd0 + farcall ReceiveDeckConfigurationMenu ret ; hl = text ID for text box diff --git a/src/engine/bank0e.asm b/src/engine/bank0e.asm index b2d22a3..55accb8 100644 --- a/src/engine/bank0e.asm +++ b/src/engine/bank0e.asm @@ -4861,7 +4861,7 @@ Func_3ada1: ld [wNumDeckMachineEntries], a xor a .asm_3adb7 - ld hl, $5eac + ld hl, DeckMachineSelectionParams farcall InitializeScrollMenuParameters call DrawListScrollArrows call PrintNumSavedDecks @@ -5134,13 +5134,13 @@ CopyBBytesFromHLToDE_Bank0e: ret CopyListFromHLToDE_Bank0e: -.asm_3afb1 +.loop ld a, [hli] ld [de], a or a ret z inc de - jr .asm_3afb1 + jr .loop ; a = deck index in wMachineDeckPtrs Func_3afb8: @@ -5679,7 +5679,7 @@ Func_3b315: call DrawListScrollArrows call PrintNumSavedDecks ld a, [wTempScrollMenuItem] - ld hl, $5eac + ld hl, DeckMachineSelectionParams farcall InitializeScrollMenuParameters call HandleScrollMenu.draw_visible_cursor farcall GetSRAMPointerToCurDeck @@ -7105,9 +7105,151 @@ CreateAutoDeckPointerList: dec a jr nz, .loop ret -; 0x3bd5c -SECTION "Bank e@7e8d", ROMX[$7e8d], BANK[$e] +SendDeckConfigurationMenu: + xor a + ld [wScrollMenuScrollOffset], a + ldtx de, DeckSaveMachineText + ld hl, wDeckMachineTitleText + ld [hl], e + inc hl + ld [hl], d + call ClearScreenAndDrawDeckMachineScreen + ld a, NUM_DECK_SAVE_MACHINE_SLOTS + ld [wNumDeckMachineEntries], a + + xor a +.start_selection + ld hl, DeckMachineSelectionParams + farcall InitializeScrollMenuParameters + call DrawListScrollArrows + call PrintNumSavedDecks + ldtx hl, ChooseDeckConfigurationToSendText + call DrawWideTextBox_PrintText + ldtx de, ChooseDeckConfigurationToSendText + call InitDeckMachineDrawingParams +.loop_input + call HandleDeckMachineSelection + jr c, .start_selection + cp $ff + jr nz, .get_deck_machine_slot + ld a, 1 + or a + ret + +.get_deck_machine_slot + ld b, a + ld a, [wScrollMenuScrollOffset] + add b + ld [wSelectedDeckMachineEntry], a + call CheckIfSelectedDeckMachineEntryIsEmpty + jr c, .loop_input + + call GetSelectedSavedDeckPtr + ld de, wDuelTempList + ld b, DECK_COMPRESSED_STRUCT_SIZE + call EnableSRAM + call CopyBBytesFromHLToDE_Bank0e + call DisableSRAM + xor a + ld [wNameBuffer], a + farcall _SendDeckConfiguration + ret c + + call GetSelectedSavedDeckPtr + ld de, wDefaultText + call EnableSRAM + call CopyListFromHLToDE_Bank0e + call DisableSRAM + or a + ret + +ReceiveDeckConfigurationMenu: + xor a + ld [wScrollMenuScrollOffset], a + ldtx de, DeckSaveMachineText + ld hl, wDeckMachineTitleText + ld [hl], e + inc hl + ld [hl], d + call ClearScreenAndDrawDeckMachineScreen + ld a, NUM_DECK_SAVE_MACHINE_SLOTS + ld [wNumDeckMachineEntries], a + + xor a +.start_selection + ld hl, DeckMachineSelectionParams + farcall InitializeScrollMenuParameters + call DrawListScrollArrows + call PrintNumSavedDecks + ldtx hl, ChooseWhereToSaveText + call DrawWideTextBox_PrintText + ldtx de, ChooseWhereToSaveText + call InitDeckMachineDrawingParams + call HandleDeckMachineSelection + jr c, .start_selection + cp $ff + jr nz, .get_deck_machine_slot + ld a, 1 + or a + ret + +.get_deck_machine_slot + ld b, a + ld a, [wScrollMenuScrollOffset] + add b + ld [wSelectedDeckMachineEntry], a + call CheckIfSelectedDeckMachineEntryIsEmpty + jr nc, .overwrite + jr .save + +.overwrite + ldtx hl, DeleteSavedDeckPromptText + call YesOrNoMenuWithText + jr nc, .save + ld a, [wTempCardTypeFilter] + jr .start_selection + +.save + xor a + ld [wDuelTempList], a + ld [wNameBuffer], a + farcall _ReceiveDeckConfiguration + ret c + + call GetSelectedSavedDeckPtr + ld d, h + ld e, l + ld hl, wDuelTempList + ld b, DECK_COMPRESSED_STRUCT_SIZE + call EnableSRAM + call CopyBBytesFromHLToDE_Bank0e + call DisableSRAM + call SaveGame + call ClearScreenAndDrawDeckMachineScreen + ld a, [wTempCardTypeFilter] + ld hl, DeckMachineSelectionParams + farcall InitializeScrollMenuParameters + call DrawListScrollArrows + call PrintNumSavedDecks + call HandleScrollMenu.draw_visible_cursor + ld hl, wNameBuffer + ld de, wDefaultText + call EnableSRAM + call CopyListFromHLToDE_Bank0e + call DisableSRAM + xor a + ld [wTxRam2], a + ld [wTxRam2 + 1], a + ldtx hl, ReceivedDeckConfigurationFromText + call DrawWideTextBox_WaitForInput + call GetSelectedSavedDeckPtr + ld de, wDefaultText + call EnableSRAM + call CopyListFromHLToDE_Bank0e + call DisableSRAM + xor a + ret SaveDeckDataToWRAM2: push de