diff options
author | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2021-06-05 17:38:22 +0100 |
---|---|---|
committer | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2021-06-05 17:38:22 +0100 |
commit | c693d08b4c40c6d9da0be6a77e51c394270356ca (patch) | |
tree | 4da16a2409e01d2c8d81a79c4336d7c26bff4b42 | |
parent | 38ac7a22c3a4a0dc00a55db38330d1740492a7a5 (diff) | |
parent | d4d63a97e41c40d9081a279e3f113177c8640767 (diff) |
Merge https://github.com/pret/poketcg into temp
-rw-r--r-- | src/constants/misc_constants.asm | 2 | ||||
-rw-r--r-- | src/constants/npc_constants.asm | 2 | ||||
-rw-r--r-- | src/engine/bank01.asm | 47 | ||||
-rw-r--r-- | src/engine/bank03.asm | 38 | ||||
-rw-r--r-- | src/engine/bank04.asm | 1456 | ||||
-rw-r--r-- | src/engine/bank06.asm | 18 | ||||
-rw-r--r-- | src/engine/bank07.asm | 14 | ||||
-rw-r--r-- | src/engine/home.asm | 10 | ||||
-rw-r--r-- | src/sram.asm | 42 | ||||
-rw-r--r-- | src/text/text1.asm | 2 | ||||
-rw-r--r-- | src/text/text3.asm | 38 | ||||
-rw-r--r-- | src/text/text9.asm | 78 | ||||
-rw-r--r-- | src/text/text_offsets.asm | 118 | ||||
-rw-r--r-- | src/wram.asm | 9 |
14 files changed, 1363 insertions, 511 deletions
diff --git a/src/constants/misc_constants.asm b/src/constants/misc_constants.asm index 033ce71..4147b1d 100644 --- a/src/constants/misc_constants.asm +++ b/src/constants/misc_constants.asm @@ -55,6 +55,8 @@ OWMODE_SCRIPT EQU 3 CARDPOP_NAME_LIST_MAX_ELEMS EQU 16 CARDPOP_NAME_LIST_SIZE EQUS "CARDPOP_NAME_LIST_MAX_ELEMS * NAME_BUFFER_LENGTH" +NUM_CHALLENGE_MACHINE_OPPONENTS EQU 5 + ; commands transmitted through IR to be ; executed by the other device ; (see ExecuteReceivedIRCommands) diff --git a/src/constants/npc_constants.asm b/src/constants/npc_constants.asm index 0aa3ad7..bf5aafd 100644 --- a/src/constants/npc_constants.asm +++ b/src/constants/npc_constants.asm @@ -9,7 +9,7 @@ LOADED_NPC_MAX EQU $08 const LOADED_NPC_DIRECTION const LOADED_NPC_FLAGS const LOADED_NPC_ANIM - const LOADED_NPC_UNKNOWN + const LOADED_NPC_DIRECTION_BACKUP const LOADED_NPC_MOVEMENT_STEP const LOADED_NPC_MOVEMENT_PTR const_value = const_value+1 diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index 508f103..e0e3d22 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -5695,7 +5695,6 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6) ld b, NUM_TYPES call SafeCopyDataHLtoDE ret -; 0x6423 Func_6423: ; 6423 (1:6423) ld hl, wDefaultText @@ -5707,7 +5706,6 @@ Func_6423: ; 6423 (1:6423) dec e jr nz, .asm_6428 ret -; 0x6431 Func_6431: ; 6431 (1:6431) xor a @@ -5772,7 +5770,6 @@ Func_6435: call LoadCardDataToBuffer1_FromCardID call OpenCardPage_FromCheckPlayArea jp Func_6435 -; 0x64b0 Func_64b0: ; 64b0 (1:64b0) call ZeroObjectPositionsAndToggleOAMCopy @@ -5812,7 +5809,6 @@ Func_64b0: ; 64b0 (1:64b0) ld [wNumPlayAreaItems], a call EnableLCD ret -; 0x64fc Func_64fc: ; 64fc (1:64fc) ld a, [wLoadedCard1Atk1Category] @@ -5825,7 +5821,6 @@ Func_64fc: ; 64fc (1:64fc) ld hl, wLoadedCard1Atk1Name call InitTextPrinting_ProcessTextFromPointerToID ret -; 0x6510 ; display the screen that prompts the player to use the selected card's ; Pokemon Power. Includes the card's information above, and the Pokemon Power's @@ -8123,7 +8118,6 @@ _TossCoin: ; 71ad (1:71ad) ret z scf ret -; 0x72ff Func_72ff: ; 72ff (1:72ff) ldh [hff96], a @@ -8134,7 +8128,6 @@ Func_72ff: ; 72ff (1:72ff) call SerialSendByte call Func_7344 ret -; 0x7310 Func_7310: ; 7310 (1:7310) ldh [hff96], a @@ -8169,7 +8162,6 @@ Func_7338: ; 7338 (1:7338) jr c, Func_7338 call Func_7344 ret -; 0x7344 Func_7344: ; 7344 (1:7344) push af @@ -8182,7 +8174,6 @@ Func_7344: ; 7344 (1:7344) call Func_3b31 call DuelTransmissionError ret -; 0x7354 BuildVersion: ; 7354 (1:7354) db "VER 12/20 09:36", TX_END @@ -8268,7 +8259,6 @@ Func_7364: ; 7364 (1:7364) call GetNPCDuelConfigurations or a ret -; 0x73d8 ; draws the current opponent to be selected ; (his/her portrait and name) @@ -8296,14 +8286,12 @@ DrawOpponentSelectionScreen: ; 73d8 (1:73d8) lb bc, 15, 10 call WriteTwoByteNumberInTxSymbolFormat ret -; 0x7408 SelectComputerOpponentData: ; 7408 (1:7408) - textitem 10, 0, Text0089 + textitem 10, 0, ClearOpponentNameText textitem 10, 10, NumberOfPrizesText textitem 3, 14, SelectComputerOpponentText db $ff -; 0x7415 Func_7415: ; 7415 (1:7415) xor a @@ -8442,7 +8430,6 @@ PlayAttackAnimation: ; 7494 (1:7494) pop af ldh [hWhoseTurn], a ret -; 0x74dc Func_74dc: ; 74dc (1:74dc) call EmptyScreen @@ -8481,7 +8468,7 @@ Func_74dc: ; 74dc (1:74dc) ld a, [wPrizeCardSelectionFrameCounter] ld e, a ld d, $0 -.asm_751b +.card_loop call LoadCardDataToBuffer1_FromCardID ret c ; card not found push de @@ -8489,8 +8476,7 @@ Func_74dc: ; 74dc (1:74dc) call Func_758a pop de inc de - jr .asm_751b -; 0x7528 + jr .card_loop ; seems to communicate with other device ; for starting a duel @@ -8501,52 +8487,46 @@ DecideLinkDuelVariables: ; 7528 (1:7528) ldtx hl, PressStartWhenReadyText call DrawWideTextBox_PrintText call EnableLCD -.loop_frame +.input_loop call DoFrame ldh a, [hKeysPressed] bit B_BUTTON_F, a - jr nz, .cancel + jr nz, .link_cancel and START - call Func_cc5 - jr nc, .loop_frame + call Func_0cc5 + jr nc, .input_loop ld hl, wPlayerDuelVariables ld a, [wSerialOp] cp $29 - jr z, .success + jr z, .link_continue ld hl, wOpponentDuelVariables cp $12 - jr z, .success -.cancel + jr z, .link_continue +.link_cancel call ResetSerial scf ret - -.success +.link_continue or a ret -; 0x755c ret ; stray ret ReceiveDeckConfiguration: ; 755d (1:755d) farcall _ReceiveDeckConfiguration ret -; 0x7562 SendDeckConfiguration: ; 7562 (1:7562) farcall _SendDeckConfiguration ret -; 0x7567 ReceiveCard: ; 7567 (1:7567) farcall _ReceiveCard ret -; 0x756c SendCard: ; 756c (1:756c) farcall _SendCard ret -; 0x7571 ; handles all the Card Pop! functionality DoCardPop: ; 7571 (1:7571) @@ -8556,27 +8536,22 @@ DoCardPop: ; 7571 (1:7571) Func_7576: ; 7576 (1:7576) farcall Func_1991f ret -; 0x757b PreparePrinterConnection: ; 757b (1:757b) farcall _PreparePrinterConnection ret -; 0x7580 PrintDeckConfiguration: ; 7580 (1:7580) farcall _PrintDeckConfiguration ret -; 0x7585 PrintCardList: ; 7585 (1:7585) farcall _PrintCardList ret -; 0x758a Func_758a: ; 758a (1:758a) farcall Func_19eb4 ret -; 0x758f SetUpAndStartLinkDuel: ; 758f (1:758f) farcall _SetUpAndStartLinkDuel diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 3468a54..eb99590 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -20,7 +20,7 @@ LoadMap: ; c000 (3:4000) ld [wLineSeparation], a xor a ld [wd291], a -.asm_c037 +.warp farcall Func_10ab4 call WhiteOutDMGPals call Func_c241 @@ -45,37 +45,37 @@ LoadMap: ; c000 (3:4000) farcall DoMapOWFrame call SetOverworldDoFrameFunction xor a - ld [wd0b4], a + ld [wOverworldTransition], a ld [wd0c1], a call PlayDefaultSong farcall Func_10af9 call Func_c141 call Func_c17a -.asm_c092 +.overworld_loop call DoFrameIfLCDEnabled call SetScreenScroll call HandleOverworldMode - ld hl, wd0b4 + ld hl, wOverworldTransition ld a, [hl] - and $d0 - jr z, .asm_c092 + and %11010000 + jr z, .overworld_loop call DoFrameIfLCDEnabled - ld hl, wd0b4 + ld hl, wOverworldTransition ld a, [hl] bit 4, [hl] - jr z, .asm_c0b6 + jr z, .no_warp ld a, SFX_0C call PlaySFX - jp .asm_c037 -.asm_c0b6 + jp .warp +.no_warp farcall Func_10ab4 call Func_c1a0 ld a, [wMatchStartTheme] or a - jr z, .asm_c0ca + jr z, .no_duel call Func_c280 farcall Duel_Init -.asm_c0ca +.no_duel call Func_c280 ret @@ -1069,7 +1069,7 @@ Func_c70d: ; c70d (3:470d) ld a, [wCurMap] cp [hl] jr z, .asm_c71c - ld hl, wd0b4 + ld hl, wOverworldTransition set 4, [hl] .asm_c71c pop hl @@ -2109,7 +2109,7 @@ ScriptCommand_StartDuel: ; cd01 (3:4d01) farcall SetNPCOpponentNameAndPortrait ld a, GAME_EVENT_DUEL ld [wGameEvent], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 6, [hl] jp IncreaseScriptPointerBy4 @@ -2140,7 +2140,7 @@ SetNPCDuelParams: ; cd66 (3:4d66) ScriptCommand_BattleCenter: ; cd76 (3:4d76) ld a, GAME_EVENT_BATTLE_CENTER ld [wGameEvent], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 6, [hl] jp IncreaseScriptPointerBy1 @@ -3150,7 +3150,7 @@ ScriptCommand_EnterMap: ; d36d (3:536d) ld [wTempPlayerYCoord], a ld a, [hli] ld [wTempPlayerDirection], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 4, [hl] jp IncreaseScriptPointerBy6 @@ -3175,7 +3175,7 @@ ScriptCommand_GiftCenter: ; d39d (3:539d) .load_gift_center ld a, GAME_EVENT_GIFT_CENTER ld [wGameEvent], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 6, [hl] .done jp IncreaseScriptPointerBy2 @@ -3184,7 +3184,7 @@ ScriptCommand_PlayCredits: ; d3b9 (3:53b9) call GetReceivedLegendaryCards ld a, GAME_EVENT_CREDITS ld [wGameEvent], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 6, [hl] jp IncreaseScriptPointerBy1 @@ -3262,7 +3262,7 @@ ScriptCommand_RecordMasterWin: ; d435 (3:5435) ScriptCommand_ChallengeMachine: ; d43d (3:543d) ld a, GAME_EVENT_CHALLENGE_MACHINE ld [wGameEvent], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 6, [hl] jp IncreaseScriptPointerBy1 diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm index d1d6bfa..ff6ab11 100644 --- a/src/engine/bank04.asm +++ b/src/engine/bank04.asm @@ -58,7 +58,10 @@ Func_10197: ; 10197 (4:4197) INCROM $10197, $101df Func_101df: ; 101df (4:41df) - INCROM $101df, $1024f + INCROM $101df, $10217 + +Func_10217: ; 10217 (4:4217) + INCROM $10217, $1024f Func_1024f: ; 1024f (4:424f) INCROM $1024f, $1029e @@ -252,7 +255,7 @@ Duel_Init: ; 103d3 (4:43d3) add a ld c, a ld b, $0 - ld hl, Unknown_1045b + ld hl, OpponentTitlesAndDeckNames add hl, bc ld a, [hli] ld [wTxRam2], a @@ -263,7 +266,7 @@ Duel_Init: ; 103d3 (4:43d3) ld [wTxRam2_b], a ld a, [wOpponentName + 1] ld [wTxRam2_b + 1], a - ld hl, Unknown_10451 + ld hl, OpponentTitleAndNameTextCoords call Func_111b3 ; LoadDuelistName pop hl ld a, [hli] @@ -273,7 +276,7 @@ Duel_Init: ; 103d3 (4:43d3) ld [wTxRam2 + 1], a or c jr z, .asm_10425 - ld hl, Unknown_10456 + ld hl, OpponentDeckNameTextCoords call Func_111b3 ; LoadDeckName .asm_10425 @@ -294,18 +297,175 @@ Duel_Init: ; 103d3 (4:43d3) ld [wd291], a ret -Unknown_10451: ; 10451 (4:4451) +OpponentTitleAndNameTextCoords: ; 10451 (4:4451) db 1, 14 - tx Text0395 + tx OpponentTitleAndNameText db $ff -Unknown_10456: ; 10456 (4:4456) +OpponentDeckNameTextCoords: ; 10456 (4:4456) db 1, 16 - tx Text0396 + tx OpponentDeckNameText db $ff -Unknown_1045b: ; 1045b (4:445b) - INCROM $1045b, $1052f +OpponentTitlesAndDeckNames: ; 1045b (4:445b) + tx TechText + tx SamsPracticeDeckName + + tx EmptyText + dw NULL + + tx TechText + tx SamsPracticeDeckName + + tx EmptyText + dw NULL + + tx EmptyText + dw NULL + + tx EmptyText + dw NULL + + tx EmptyText + dw NULL + + tx EmptyText + dw NULL + + tx EmptyText + dw NULL + + tx TechText + tx LightningAndFireDeckName + + tx TechText + tx WaterAndFightingDeckName + + tx TechText + tx GrassAndPsychicDeckName + + tx GrandMasterText + tx LegendaryMoltresDeckName + + tx GrandMasterText + tx LegendaryZapdosDeckName + + tx GrandMasterText + tx LegendaryArticunoDeckName + + tx GrandMasterText + tx LegendaryDragoniteDeckName + + tx FightingClubMasterText + tx FirstStrikeDeckName + + tx RockClubMasterText + tx RockCrusherDeckName + + tx WaterClubMasterText + tx GoGoRainDanceDeckName + + tx LightningClubMasterText + tx ZappingSelfdestructDeckName + + tx GrassClubMasterText + tx FlowerPowerDeckName + + tx PsychicClubMasterText + tx StrangePsyshockDeckName + + tx ScienceClubMasterText + tx WondersofScienceDeckName + + tx FireClubMasterText + tx FireChargeDeckName + + tx EmptyText + tx ImRonaldDeckName + + tx EmptyText + tx PowerfulRonaldDeckName + + tx EmptyText + tx InvincibleRonaldDeckName + + tx EmptyText + tx LegendaryRonaldDeckName + + tx FightingClubMemberText + tx MusclesforBrainsDeckName + + tx FightingClubMemberText + tx HeatedBattleDeckName + + tx FightingClubMemberText + tx LovetoBattleDeckName + + tx RockClubMemberText + tx ExcavationDeckName + + tx RockClubMemberText + tx BlisteringPokemonDeckName + + tx RockClubMemberText + tx HardPokemonDeckName + + tx WaterClubMemberText + tx WaterfrontPokemonDeckName + + tx WaterClubMemberText + tx LonelyFriendsDeckName + + tx WaterClubMemberText + tx SoundoftheWavesDeckName + + tx LightningClubMemberText + tx PikachuDeckName + + tx LightningClubMemberText + tx BoomBoomSelfdestructDeckName + + tx LightningClubMemberText + tx PowerGeneratorDeckName + + tx GrassClubMemberText + tx EtceteraDeckName + + tx GrassClubMemberText + tx FlowerGardenDeckName + + tx GrassClubMemberText + tx KaleidoscopeDeckName + + tx PsychicClubMemberText + tx GhostDeckName + + tx PsychicClubMemberText + tx NapTimeDeckName + + tx PsychicClubMemberText + tx StrangePowerDeckName + + tx ScienceClubMemberText + tx FlyinPokemonDeckName + + tx ScienceClubMemberText + tx LovelyNidoranDeckName + + tx ScienceClubMemberText + tx PoisonDeckName + + tx FireClubMemberText + tx AngerDeckName + + tx FireClubMemberText + tx FlamethrowerDeckName + + tx FireClubMemberText + tx ReshuffleDeckName + + tx StrangeLifeformText + tx ImakuniDeckName Func_1052f: ; 1052f (4:452f) INCROM $1052f, $10548 @@ -1233,7 +1393,7 @@ OverworldMap_LoadSelectedMap: ; 10f61 (4:4f61) ld [wTempPlayerYCoord], a ld a, NORTH ld [wTempPlayerDirection], a - ld hl, wd0b4 + ld hl, wOverworldTransition set 4, [hl] pop bc pop hl @@ -2483,12 +2643,7 @@ _GetNPCDuelConfigurations: ; 11f4e (4:5f4e) ret ; 0x11f7d -; this is most likely unreferenced -; since it expects the duel theme song -; to be stored in the duel configuration -; associated with the NPC deck ID, -; but this isn't found in the actual data -Func_11f7d: ; 11f7d (4:5f7d) +_GetChallengeMachineDuelConfigurations: ; 11f7d (4:5f7d) push bc push de ld a, [wNPCDuelDeckID] @@ -2528,462 +2683,370 @@ DeckIDDuelConfigurations: ; 11fae (4:5fae) db SAMS_PRACTICE_DECK_ID ; deck ID db SAM_PIC ; NPC portrait tx SamNPCName ; name text ID - db 2 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_2 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db SAMS_NORMAL_DECK_ID ; deck ID db SAM_PIC ; NPC portrait tx SamNPCName ; name text ID - db 2 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_2 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db LIGHTNING_AND_FIRE_DECK_ID ; deck ID db AARON_PIC ; NPC portrait tx AaronNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $eb ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx TechText ; rank + dw NULL ; element db WATER_AND_FIGHTING_DECK_ID ; deck ID db AARON_PIC ; NPC portrait tx AaronNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $eb ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx TechText ; rank + dw NULL ; element db GRASS_AND_PSYCHIC_DECK_ID ; deck ID db AARON_PIC ; NPC portrait tx AaronNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $eb ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx TechText ; rank + dw NULL ; element db LEGENDARY_MOLTRES_DECK_ID ; deck ID db COURTNEY_PIC ; NPC portrait tx CourtneyNPCName ; name text ID - db 6 ; number of prize cards - db $04 ; unknown - db $ed ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_3 ; theme + tx GrandMasterText ; rank + dw NULL ; element db LEGENDARY_ZAPDOS_DECK_ID ; deck ID db STEVE_PIC ; NPC portrait tx SteveNPCName ; name text ID - db 6 ; number of prize cards - db $04 ; unknown - db $ed ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_3 ; theme + tx GrandMasterText ; rank + dw NULL ; element db LEGENDARY_ARTICUNO_DECK_ID ; deck ID db JACK_PIC ; NPC portrait tx JackNPCName ; name text ID - db 6 ; number of prize cards - db $04 ; unknown - db $ed ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_3 ; theme + tx GrandMasterText ; rank + dw NULL ; element db LEGENDARY_DRAGONITE_DECK_ID ; deck ID db ROD_PIC ; NPC portrait tx RodNPCName ; name text ID - db 6 ; number of prize cards - db $04 ; unknown - db $ed ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_3 ; theme + tx GrandMasterText ; rank + dw NULL ; element db FIRST_STRIKE_DECK_ID ; deck ID db MITCH_PIC ; NPC portrait tx MitchNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineFightingIconText ; element db ROCK_CRUSHER_DECK_ID ; deck ID db GENE_PIC ; NPC portrait tx GeneNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineFightingIconText ; element db GO_GO_RAIN_DANCE_DECK_ID ; deck ID db AMY_PIC ; NPC portrait tx AmyNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $f8 ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineWaterIconText ; element db ZAPPING_SELFDESTRUCT_DECK_ID ; deck ID db ISAAC_PIC ; NPC portrait tx IsaacNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $f7 ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineLightningIconText ; element db FLOWER_POWER_DECK_ID ; deck ID db NIKKI_PIC ; NPC portrait tx NikkiNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineGrassIconText ; element db STRANGE_PSYSHOCK_DECK_ID ; deck ID db MURRAY_PIC ; NPC portrait tx MurrayNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $fa ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachinePsychicIconText ; element db WONDERS_OF_SCIENCE_DECK_ID ; deck ID db RICK_PIC ; NPC portrait tx RickNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineGrassIconText ; element db FIRE_CHARGE_DECK_ID ; deck ID db KEN_PIC ; NPC portrait tx KenNPCName ; name text ID - db 6 ; number of prize cards - db $03 ; unknown - db $ea ; unknown - db $07 ; unknown - db $f6 ; unknown - db $07 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_DUEL_THEME_2 ; theme + tx ClubMasterText ; rank + tx ChallengeMachineFireIconText ; element db IM_RONALD_DECK_ID ; deck ID db RONALD_PIC ; NPC portrait tx RonaldNPCName ; name text ID - db 6 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db POWERFUL_RONALD_DECK_ID ; deck ID db RONALD_PIC ; NPC portrait tx RonaldNPCName ; name text ID - db 6 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db INVINCIBLE_RONALD_DECK_ID ; deck ID db RONALD_PIC ; NPC portrait tx RonaldNPCName ; name text ID - db 4 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db LEGENDARY_RONALD_DECK_ID ; deck ID db RONALD_PIC ; NPC portrait tx RonaldNPCName ; name text ID - db 6 ; number of prize cards - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_STOP ; theme + dw NULL ; rank + dw NULL ; element db MUSCLES_FOR_BRAINS_DECK_ID ; deck ID db CHRIS_PIC ; NPC portrait tx ChrisNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db HEATED_BATTLE_DECK_ID ; deck ID db MICHAEL_PIC ; NPC portrait tx MichaelNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db LOVE_TO_BATTLE_DECK_ID ; deck ID db JESSICA_PIC ; NPC portrait tx JessicaNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db EXCAVATION_DECK_ID ; deck ID db RYAN_PIC ; NPC portrait tx RyanNPCName ; name text ID - db 3 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_3 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db BLISTERING_POKEMON_DECK_ID ; deck ID db ANDREW_PIC ; NPC portrait tx AndrewNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db HARD_POKEMON_DECK_ID ; deck ID db MATTHEW_PIC ; NPC portrait tx MatthewNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f9 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFightingIconText ; element db WATERFRONT_POKEMON_DECK_ID ; deck ID db SARA_PIC ; NPC portrait tx SaraNPCName ; name text ID - db 2 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f8 ; unknown - db $07 ; unknown + db PRIZES_2 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineWaterIconText ; element db LONELY_FRIENDS_DECK_ID ; deck ID db AMANDA_PIC ; NPC portrait tx AmandaNPCName ; name text ID - db 3 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f8 ; unknown - db $07 ; unknown + db PRIZES_3 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineWaterIconText ; element db SOUND_OF_THE_WAVES_DECK_ID ; deck ID db JOSHUA_PIC ; NPC portrait tx JoshuaNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f8 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineWaterIconText ; element db PIKACHU_DECK_ID ; deck ID db JENNIFER_PIC ; NPC portrait tx JenniferNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f7 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineLightningIconText ; element db BOOM_BOOM_SELFDESTRUCT_DECK_ID ; deck ID db NICHOLAS_PIC ; NPC portrait tx NicholasNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f7 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineLightningIconText ; element db POWER_GENERATOR_DECK_ID ; deck ID db BRANDON_PIC ; NPC portrait tx BrandonNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f7 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineLightningIconText ; element db ETCETERA_DECK_ID ; deck ID db BRITTANY_PIC ; NPC portrait tx BrittanyNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db FLOWER_GARDEN_DECK_ID ; deck ID db KRISTIN_PIC ; NPC portrait tx KristinNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db KALEIDOSCOPE_DECK_ID ; deck ID db HEATHER_PIC ; NPC portrait tx HeatherNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db GHOST_DECK_ID ; deck ID db ROBERT_PIC ; NPC portrait tx RobertNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fa ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachinePsychicIconText ; element db NAP_TIME_DECK_ID ; deck ID db DANIEL_PIC ; NPC portrait tx DanielNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fa ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachinePsychicIconText ; element db STRANGE_POWER_DECK_ID ; deck ID db STEPHANIE_PIC ; NPC portrait tx StephanieNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fa ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachinePsychicIconText ; element db FLYIN_POKEMON_DECK_ID ; deck ID db JOSEPH_PIC ; NPC portrait tx JosephNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db LOVELY_NIDORAN_DECK_ID ; deck ID db DAVID_PIC ; NPC portrait tx DavidNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db POISON_DECK_ID ; deck ID db ERIK_PIC ; NPC portrait tx ErikNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $fb ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineGrassIconText ; element db ANGER_DECK_ID ; deck ID db JOHN_PIC ; NPC portrait tx JohnNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f6 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFireIconText ; element db FLAMETHROWER_DECK_ID ; deck ID db ADAM_PIC ; NPC portrait tx AdamNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f6 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFireIconText ; element db RESHUFFLE_DECK_ID ; deck ID db JONATHAN_PIC ; NPC portrait tx JonathanNPCName ; name text ID - db 4 ; number of prize cards - db $02 ; unknown - db $e9 ; unknown - db $07 ; unknown - db $f6 ; unknown - db $07 ; unknown + db PRIZES_4 ; number of prize cards + db MUSIC_DUEL_THEME_1 ; theme + tx ClubMemberText ; rank + tx ChallengeMachineFireIconText ; element db IMAKUNI_DECK_ID ; deck ID db IMAKUNI_PIC ; NPC portrait tx ImakuniNPCName ; name text ID - db 6 ; number of prize cards - db $10 ; unknown - db $ec ; unknown - db $07 ; unknown - db $00 ; unknown - db $00 ; unknown + db PRIZES_6 ; number of prize cards + db MUSIC_IMAKUNI ; theme + tx StrangeLifeformText ; rank + dw NULL ; element db -1 ; end @@ -3884,7 +3947,7 @@ MainMenu_ContinueFromDiary: ; 12741 (4:6741) farcall SetMainSGBBorder call EnableSRAM xor a - ld [sba44], a + ld [sPlayerInChallengeMachine], a call DisableSRAM ld a, GAME_EVENT_OVERWORLD ld [wGameEvent], a @@ -5157,30 +5220,376 @@ BoosterLogoOAM: ; 13132 (4:7132) Func_131b3: ; 131b3 (4:71b3) INCROM $131b3, $131d3 -Func_131d3: ; 131d3 (4:71d3) - INCROM $131d3, $1344d +; if a challenge is already in progress, then resume +; otherwise, start a new 5 round challenge +ChallengeMachine_Start: ; 131d3 (4:71d3) + ld a, 0 + ld [wLineSeparation], a + call Func_10a9b + call ChallengeMachine_Initialize + + call EnableSRAM + ld a, [sPlayerInChallengeMachine] + call DisableSRAM + cp $ff + jr z, .resume_challenge + +; new challenge + call ChallengeMachine_PickOpponentSequnce + call ChallengeMachine_DrawScoreScreen + call FlashWhiteScreen + ldtx hl, PlayTheChallengeMachineText + call YesOrNoMenuWithText_SetCursorToYes + jp c, .end_challenge + + ldtx hl, LetUsChooseYourOpponentText + call PrintScrollableText_NoTextBoxLabel + call Func_10ab4 + call EnableSRAM + xor a + ld [sPresentConsecutiveWinsBackup], a + ld [sPresentConsecutiveWinsBackup + 1], a + call DisableSRAM + + call ChallengeMachine_DrawOpponentList + call FlashWhiteScreen + ldtx hl, YourOpponentsForThisGameText + call PrintScrollableText_NoTextBoxLabel +; begin challenge loop +.next_opponent + call ChallengeMachine_GetCurrentOpponent + call ChallengeMachine_AreYouReady + jr nc, .start_duel + ldtx hl, IfYouQuitTheDuelText + call PrintScrollableText_NoTextBoxLabel + ldtx hl, WouldYouLikeToQuitTheDuelText + call YesOrNoMenuWithText + jr c, .next_opponent + jp .quit + +.start_duel + call EnableSRAM + ld a, $ff + ld [sPlayerInChallengeMachine], a + call DisableSRAM + call ChallengeMachine_Duel +.resume_challenge + call EnableSRAM + xor a + ld [sPlayerInChallengeMachine], a + bank1call DiscardSavedDuelData + call DisableSRAM + call ChallengeMachine_GetCurrentOpponent + call ChallengeMachine_RecordDuelResult + call ChallengeMachine_DrawOpponentList + call FlashWhiteScreen + ld a, [wDuelResult] + or a + jr nz, .lost +; won + call ChallengeMachine_DuelWon + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + cp NUM_CHALLENGE_MACHINE_OPPONENTS - 1 + jr z, .defeated_five_opponents + ld hl, sChallengeMachineOpponentNumber + inc [hl] + call DisableSRAM + jr .next_opponent + +.defeated_five_opponents + ld hl, sTotalChallengeMachineWins + call ChallengeMachine_IncrementHLMax999 + call Func_10ab4 + call ChallengeMachine_CheckForNewRecord + call ChallengeMachine_DrawScoreScreen + call FlashWhiteScreen + call EnableSRAM + ld a, [sTotalChallengeMachineWins] + ld [wTxRam3], a + ld a, [sTotalChallengeMachineWins + 1] + ld [wTxRam3 + 1], a + call DisableSRAM + ldtx hl, SuccessfullyDefeated5OpponentsText + call PrintScrollableText_NoTextBoxLabel + jr .end_challenge + +.lost + call ChallengeMachine_GetCurrentOpponent + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + inc a + ld [wTxRam3], a + xor a + ld [wTxRam3 + 1], a + call DisableSRAM + call ChallengeMachine_GetOpponentNameAndDeck + ld a, [wOpponentName] + ld [wTxRam2], a + ld a, [wOpponentName + 1] + ld [wTxRam2 + 1], a + ldtx hl, LostToTheNthOpponentText + call PrintScrollableText_NoTextBoxLabel +.quit + call ChallengeMachine_PrintFinalConsecutiveWinStreak + call Func_10ab4 + call ChallengeMachine_CheckForNewRecord + call ChallengeMachine_DrawScoreScreen + call FlashWhiteScreen + call EnableSRAM +; reset streak + xor a + ld [sPresentConsecutiveWins], a + ld [sPresentConsecutiveWins + 1], a + call DisableSRAM +.end_challenge ; end, win or lose + call ChallengeMachine_CheckForNewRecord ; redundant? + call EnableSRAM + ld a, [sPresentConsecutiveWins] + ld [sPresentConsecutiveWinsBackup], a + ld a, [sPresentConsecutiveWins + 1] + ld [sPresentConsecutiveWinsBackup + 1], a + call ChallengeMachine_ShowNewRecord + call DisableSRAM + ldtx hl, WeAwaitYourNextChallengeText + call PrintScrollableText_NoTextBoxLabel + ret + +; update wChallengeMachineOpponent with the current +; opponent in the sChallengeMachineOpponents list +ChallengeMachine_GetCurrentOpponent: ; 1330b (4:730b) + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + ld e, a + ld d, 0 + ld hl, sChallengeMachineOpponents + add hl, de + ld a, [hl] + ld [wChallengeMachineOpponent], a + call DisableSRAM + ret + +; play the appropriate match start theme +; then duel the current opponent +ChallengeMachine_Duel: ; 13320 (4:7320) + call ChallengeMachine_PrepareDuel + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + ld e, a + call DisableSRAM + ld d, 0 + ld hl, ChallengeMachine_SongIDs + add hl, de + ld a, [hl] + call PlaySong + call WaitForSongToFinish + xor a + ld [wd112], a + call SaveGeneralSaveData + bank1call StartDuel + ret + +ChallengeMachine_SongIDs: ; 13345 (4:7345) + db MUSIC_MATCH_START_1 + db MUSIC_MATCH_START_1 + db MUSIC_MATCH_START_1 + db MUSIC_MATCH_START_2 + db MUSIC_MATCH_START_2 + +; get the current opponent's name, deck, and prize count +ChallengeMachine_PrepareDuel: ; 1334a (4:734a) + call ChallengeMachine_GetOpponentNameAndDeck + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + ld e, a + call DisableSRAM + ld d, 0 + ld hl, ChallengeMachine_Prizes + add hl, de + ld a, [hl] + ld [wNPCDuelPrizes], a + ret + +ChallengeMachine_Prizes: ; 13362 (4:7362) + db PRIZES_4 + db PRIZES_4 + db PRIZES_4 + db PRIZES_6 + db PRIZES_6 + +; store the result of the last duel in the current +; position of the sChallengeMachineDuelResults list +ChallengeMachine_RecordDuelResult: ; 13367 (4:7367) + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + ld e, a + ld d, 0 + ld hl, sChallengeMachineDuelResults + add hl, de + ld a, [wDuelResult] + or a + jr nz, .lost + ld a, 1 ; won + ld [hl], a + call DisableSRAM + ld hl, sPresentConsecutiveWins + call ChallengeMachine_IncrementHLMax999 + ret + +.lost + ld a, 2 ; lost + ld [hl], a + call DisableSRAM + ret + +; increment the value at hl +; without going above 999 +ChallengeMachine_IncrementHLMax999: ; 1338e (4:738e) + call EnableSRAM + inc hl + ld a, [hld] + cp HIGH(999) + jr nz, .increment + ld a, [hl] + cp LOW(999) + jr z, .skip +.increment + ld a, [hl] + add 1 + ld [hli], a + ld a, [hl] + adc 0 + ld [hl], a +.skip + call DisableSRAM + ret + +; update sMaximumConsecutiveWins if the player set a new record +ChallengeMachine_CheckForNewRecord: ; 133a8 (4:73a8) + call EnableSRAM + ld hl, sMaximumConsecutiveWins + 1 + ld a, [sPresentConsecutiveWins + 1] + cp [hl] + jr nz, .high_bytes_different +; high bytes equal, check low bytes + dec hl + ld a, [sPresentConsecutiveWins] + cp [hl] +.high_bytes_different + jr c, .no_record + jr z, .no_record +; new record + ld hl, sMaximumConsecutiveWins + ld a, [sPresentConsecutiveWins] + ld [hli], a + ld a, [sPresentConsecutiveWins + 1] + ld [hl], a + ld hl, sPlayerName + ld de, sChallengeMachineRecordHolderName + ld bc, NAME_BUFFER_LENGTH + call CopyDataHLtoDE_SaveRegisters +; remember to show congrats message later + ld a, TRUE + ld [sConsecutiveWinRecordIncreased], a +.no_record + call DisableSRAM + ret + +; print the next opponent's name and ask the +; player if they want to begin the next duel +ChallengeMachine_AreYouReady: ; 133dd (4:73dd) + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + inc a + ld [wTxRam3], a + ld [wTxRam3_b], a + xor a + ld [wTxRam3 + 1], a + ld [wTxRam3_b + 1], a + ldtx hl, NthOpponentIsText + ld a, [sPresentConsecutiveWins + 1] + or a + jr nz, .streak + ld a, [sPresentConsecutiveWins] + cp 2 + jr c, .no_streak +.streak + ldtx hl, XConsecutiveWinsNthOpponentIsText + ld a, [sPresentConsecutiveWins] + ld [wTxRam3], a + ld a, [sPresentConsecutiveWins + 1] + ld [wTxRam3 + 1], a +.no_streak + call DisableSRAM + push hl ; text id + call ChallengeMachine_GetOpponentNameAndDeck + ld a, [wOpponentName] + ld [wTxRam2], a + ld a, [wOpponentName + 1] + ld [wTxRam2 + 1], a + pop hl ; text id + call PrintScrollableText_NoTextBoxLabel + ldtx hl, WouldYouLikeToBeginTheDuelText + call YesOrNoMenuWithText_SetCursorToYes + ret + +; print opponent win count +; play a jingle for beating 5 opponents +ChallengeMachine_DuelWon: ; 1342e (4:742e) + call EnableSRAM + ld a, [sChallengeMachineOpponentNumber] + inc a + ld [wTxRam3], a + xor a + ld [wTxRam3 + 1], a + ldtx hl, WonAgainstXOpponentsText + ld a, [sChallengeMachineOpponentNumber] + call DisableSRAM + cp NUM_CHALLENGE_MACHINE_OPPONENTS - 1 + jr z, .beat_five_opponents + call PrintScrollableText_NoTextBoxLabel + ret -Func_1344d: ; 1344d (4:744d) +.beat_five_opponents call PauseSong ld a, MUSIC_MEDAL call PlaySong - ldtx hl, DefeatedFiveOpponentsText + ldtx hl, Defeated5OpponentsText call PrintScrollableText_NoTextBoxLabel call WaitForSongToFinish call ResumeSong ret -; 0x13462 - INCROM $13462, $13485 +; when a player's streak ends, print the final +; consecutive win count +ChallengeMachine_PrintFinalConsecutiveWinStreak: ; 13462 (4:7462) + call EnableSRAM + ld a, [sPresentConsecutiveWins] + ld [wTxRam3], a + ld a, [sPresentConsecutiveWins + 1] + ld [wTxRam3 + 1], a + or a + jr nz, .streak + ld a, [sPresentConsecutiveWins] + cp 2 + jr c, .no_streak +.streak + ldtx hl, ConsecutiveWinsEndedAtText + call PrintScrollableText_NoTextBoxLabel +.no_streak + call DisableSRAM + ret -Func_13485: ; 13485 (4:7485) +; if the player achieved a new record, play a jingle +; otherwise, do nothing +ChallengeMachine_ShowNewRecord: ; 13485 (4:7485) call EnableSRAM - ld a, [sba68] + ld a, [sConsecutiveWinRecordIncreased] or a - ret z - ld a, [sba56] + ret z ; no new record + ld a, [sMaximumConsecutiveWins] ld [wTxRam3], a - ld a, [sba57] + ld a, [sMaximumConsecutiveWins + 1] ld [wTxRam3 + 1], a call DisableSRAM call PauseSong @@ -5191,9 +5600,442 @@ Func_13485: ; 13485 (4:7485) call WaitForSongToFinish call ResumeSong ret -; 0x134b1 - INCROM $134b1, $1372f +ChallengeMachine_DrawScoreScreen: ; 134b1 (4:74b1) + call Func_10000 + lb de, $30, $bf + call SetupText + lb de, 0, 0 + lb bc, 20, 13 + call DrawRegularTextBox + lb de, 0, 12 + lb bc, 20, 6 + call DrawRegularTextBox + call EnableSRAM + ld hl, sChallengeMachineRecordHolderName + ld de, wDefaultText + ld bc, NAME_BUFFER_LENGTH + call CopyDataHLtoDE + call DisableSRAM + xor a + ld [wTxRam2], a + ld [wTxRam2 + 1], a + ld hl, ChallengeMachine_PlayerScoreTexts + call Func_111b3 + ld hl, ChallengeMachine_PlayerScoreValues + call ChallengeMachine_PrintScores + ret + +ChallengeMachine_PlayerScoreTexts: ; 134f2 (4:74f2) + db 1, 0 + tx ChallengeMachineText + + db 1, 2 + tx PlayersScoreText + + db 2, 4 + tx Defeated5OpponentsXTimesText + + db 2, 6 + tx PresentConsecutiveWinsText + + db 1, 8 + tx MaximumConsecutiveWinsText + + db 17, 6 + tx WinsText + + db 16, 10 + tx WinsText + db $ff + +ChallengeMachine_PlayerScoreValues: ; 1350f (4:750f) + dw sTotalChallengeMachineWins + db 12, 4 + + dw sPresentConsecutiveWins + db 14, 6 + + dw sMaximumConsecutiveWins + db 13, 10 + + dw NULL + +ChallengeMachine_DrawOpponentList: ; 1351d (4:751d) + call Func_10000 + lb de, $30, $bf + call SetupText + lb de, 0, 0 + lb bc, 20, 13 + call DrawRegularTextBox + lb de, 0, 12 + lb bc, 20, 6 + call DrawRegularTextBox + ld hl, ChallengeMachine_OpponentNumberTexts + call Func_111b3 + call ChallengeMachine_PrintOpponentInfo + call ChallengeMachine_PrintDuelResultIcons + ret + +ChallengeMachine_OpponentNumberTexts: ; 13545 (4:7545) + db 1, 0 + tx ChallengeMachineText + + db 2, 2 + tx ChallengeMachineOpponent1Text + + db 2, 4 + tx ChallengeMachineOpponent2Text + + db 2, 6 + tx ChallengeMachineOpponent3Text + + db 2, 8 + tx ChallengeMachineOpponent4Text + + db 2, 10 + tx ChallengeMachineOpponent5Text + db $ff + +ChallengeMachine_PrintOpponentInfo: ; 1355e (4:755e) + ld hl, sChallengeMachineOpponents + ld bc, 2 ; beginning y-pos + ld e, NUM_CHALLENGE_MACHINE_OPPONENTS +.loop + push hl + push bc + push de + call EnableSRAM + ld a, [hl] + ld [wChallengeMachineOpponent], a + ld b, 14 ; x-pos + call ChallengeMachine_PrintOpponentName + ld b, 4 ; x-pos + call ChallengeMachine_PrintOpponentClubStatus + pop de + pop bc + pop hl + inc hl + +; down two rows + inc c + inc c + + dec e + jr nz, .loop + call DisableSRAM + ret + +ChallengeMachine_PrintOpponentName: ; 13587 (4:7587) + push bc + call ChallengeMachine_GetOpponentNameAndDeck + ld de, 2 ; name + add hl, de + call ChallengeMachine_PrintText + pop bc + ret + +ChallengeMachine_PrintText: ; 13594 (4:7594) + ld a, [hli] + ld h, [hl] + ld l, a + ld e, c + ld d, b + push de + call InitTextPrinting + call PrintTextNoDelay + pop de + ret + +; print the opponent's rank and element +ChallengeMachine_PrintOpponentClubStatus: ; 135a2 (4:75a2) + push bc + call ChallengeMachine_GetOpponentNameAndDeck + push hl + ld de, 6 ; rank + add hl, de + call ChallengeMachine_PrintText + ld a, d + add $07 + ld d, a + call InitTextPrinting + pop hl + ld bc, 8 ; element + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + or h + jr z, .no_element + call PrintTextNoDelay +.no_element + pop bc + ret + +ChallengeMachine_GetOpponentNameAndDeck: ; 135c5 (4:75c5) + push de + ld a, [wChallengeMachineOpponent] + ld e, a + ld d, 0 + ld hl, ChallengeMachine_OpponentDeckIDs + add hl, de + ld a, [hl] + ld [wNPCDuelDeckID], a + call _GetChallengeMachineDuelConfigurations + pop de + ret + +ChallengeMachine_PrintDuelResultIcons: ; 135d9 (4:75d9) + ld hl, sChallengeMachineDuelResults + ld c, NUM_CHALLENGE_MACHINE_OPPONENTS + lb de, 1, 2 +.print_loop + push hl + push bc + push de + call InitTextPrinting + call EnableSRAM + ld a, [hl] + add a + ld e, a + ld d, 0 + ld hl, ChallengeMachine_DuelResultIcons + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call PrintTextNoDelay + pop de + pop bc + pop hl + inc hl + +; down two rows + inc e + inc e + + dec c + jr nz, .print_loop + call DisableSRAM + ret + +ChallengeMachine_DuelResultIcons: ; 13606 (4:7606) + tx ChallengeMachineNotDuelledIconText + tx ChallengeMachineDuelWonIconText + tx ChallengeMachineDuelLostIconText + +; print all scores in the table pointed to by hl +ChallengeMachine_PrintScores: ; 1360c (4:760c) +.loop + call EnableSRAM + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + or e + jr z, .done + ld b, [hl] + inc hl + ld c, [hl] + inc hl + push hl + push bc + ld a, [de] + ld l, a + inc de + ld a, [de] + ld h, a + call Func_10217 + pop bc + call BCCoordToBGMap0Address + ld hl, wd4b4 + ld b, 3 + call SafeCopyDataHLtoDE + pop hl + jr .loop + +.done + call DisableSRAM + ret + +; if this is the first time the challenge machine has ever +; been used on this cartridge, then clear all vars and +; set Dr. Mason as the record holder +ChallengeMachine_Initialize: ; 13637 (4:7637) + call EnableSRAM + ld a, [sChallengeMachineMagic] + cp $e3 + jr nz, .init_vars + ld a, [sChallengeMachineMagic + 1] + cp $95 + jr z, .done + +.init_vars + ld hl, sChallengeMachineMagic + ld c, sChallengeMachineEnd - sChallengeMachineStart + ld a, $e3 + ld [hli], a + ld a, $95 + ld [hli], a + + xor a +.clear_loop + ld [hli], a + dec c + jr nz, .clear_loop + + ld hl, ChallengeMachine_DrMasonText + ld de, sChallengeMachineRecordHolderName + ld bc, NAME_BUFFER_LENGTH + call CopyDataHLtoDE_SaveRegisters + ld a, 1 + ld [sMaximumConsecutiveWins], a + xor a + ld [sMaximumConsecutiveWins + 1], a + +.done + ld a, [sPlayerInChallengeMachine] + call DisableSRAM + ret + +ChallengeMachine_DrMasonText: ; 13674 (4:7674) + text "Dr. Mason", TX_END, TX_END, TX_END, TX_END, TX_END, TX_END + +; pick the next opponent sequence and clear challenge vars +ChallengeMachine_PickOpponentSequnce: ; 13684 (4:7684) + call EnableSRAM + +; pick first opponent + ld a, CLUB_MASTERS_START + call Random + ld [sChallengeMachineOpponents], a + +.pick_second_opponent + ld a, CLUB_MASTERS_START + call Random + ld c, 1 + call ChallengeMachine_CheckIfOpponentAlreadySelected + jr c, .pick_second_opponent + ld [sChallengeMachineOpponents + 1], a + +.pick_third_opponent + ld a, CLUB_MASTERS_START + call Random + ld c, 2 + call ChallengeMachine_CheckIfOpponentAlreadySelected + jr c, .pick_third_opponent + ld [sChallengeMachineOpponents + 2], a + +; pick fourth opponent + ld a, GRAND_MASTERS_START - CLUB_MASTERS_START + call Random + add CLUB_MASTERS_START + ld [sChallengeMachineOpponents + 3], a + +; pick fifth opponent + call UpdateRNGSources + ld hl, ChallengeMachine_FinalOpponentProbabilities +.next + sub [hl] + jr c, .got_opponent + inc hl + inc hl + jr .next +.got_opponent + inc hl + ld a, [hl] + ld [sChallengeMachineOpponents + 4], a + + xor a + ld [sChallengeMachineOpponentNumber], a + ld [sConsecutiveWinRecordIncreased], a + ld hl, sChallengeMachineDuelResults + ld c, NUM_CHALLENGE_MACHINE_OPPONENTS +.clear_results + ld [hli], a + dec c + jr nz, .clear_results + ld a, [sPresentConsecutiveWinsBackup] + ld [sPresentConsecutiveWins], a + ld a, [sPresentConsecutiveWinsBackup + 1] + ld [sPresentConsecutiveWins + 1], a + call DisableSRAM + ret + +ChallengeMachine_FinalOpponentProbabilities: ; 136e9 (4:76e9) + db 56, GRAND_MASTERS_START + 0 ; 56/256, courtney + db 56, GRAND_MASTERS_START + 1 ; 56/256, steve + db 56, GRAND_MASTERS_START + 2 ; 56/256, jack + db 56, GRAND_MASTERS_START + 3 ; 56/256, rod + db 8, GRAND_MASTERS_START + 4 ; 8/256, aaron + db 8, GRAND_MASTERS_START + 5 ; 8/256, aaron + db 8, GRAND_MASTERS_START + 6 ; 8/256, aaron + db 255, GRAND_MASTERS_START + 7 ; 8/256, imakuni (catch-all) + +; return carry if the opponent in a is already among +; the first c opponents in sChallengeMachineOpponents +ChallengeMachine_CheckIfOpponentAlreadySelected: ; 136f9 (4:76f9) + ld hl, sChallengeMachineOpponents +.loop + cp [hl] + jr z, .found + inc hl + dec c + jr nz, .loop +; not found + or a + ret +.found + scf + ret + +ChallengeMachine_OpponentDeckIDs: ; 13707 (4:7707) +.club_members + db MUSCLES_FOR_BRAINS_DECK_ID + db HEATED_BATTLE_DECK_ID + db LOVE_TO_BATTLE_DECK_ID + db EXCAVATION_DECK_ID + db BLISTERING_POKEMON_DECK_ID + db HARD_POKEMON_DECK_ID + db WATERFRONT_POKEMON_DECK_ID + db LONELY_FRIENDS_DECK_ID + db SOUND_OF_THE_WAVES_DECK_ID + db PIKACHU_DECK_ID + db BOOM_BOOM_SELFDESTRUCT_DECK_ID + db POWER_GENERATOR_DECK_ID + db ETCETERA_DECK_ID + db FLOWER_GARDEN_DECK_ID + db KALEIDOSCOPE_DECK_ID + db GHOST_DECK_ID + db NAP_TIME_DECK_ID + db STRANGE_POWER_DECK_ID + db FLYIN_POKEMON_DECK_ID + db LOVELY_NIDORAN_DECK_ID + db POISON_DECK_ID + db ANGER_DECK_ID + db FLAMETHROWER_DECK_ID + db RESHUFFLE_DECK_ID +.club_masters + db FIRST_STRIKE_DECK_ID + db ROCK_CRUSHER_DECK_ID + db GO_GO_RAIN_DANCE_DECK_ID + db ZAPPING_SELFDESTRUCT_DECK_ID + db FLOWER_POWER_DECK_ID + db STRANGE_PSYSHOCK_DECK_ID + db WONDERS_OF_SCIENCE_DECK_ID + db FIRE_CHARGE_DECK_ID +.grand_masters + db LEGENDARY_MOLTRES_DECK_ID + db LEGENDARY_ZAPDOS_DECK_ID + db LEGENDARY_ARTICUNO_DECK_ID + db LEGENDARY_DRAGONITE_DECK_ID + db LIGHTNING_AND_FIRE_DECK_ID + db WATER_AND_FIGHTING_DECK_ID + db GRASS_AND_PSYCHIC_DECK_ID + db IMAKUNI_DECK_ID + +CLUB_MASTERS_START EQU ChallengeMachine_OpponentDeckIDs.club_masters - ChallengeMachine_OpponentDeckIDs.club_members +GRAND_MASTERS_START EQU ChallengeMachine_OpponentDeckIDs.grand_masters - ChallengeMachine_OpponentDeckIDs.club_members INCLUDE "data/npc_map_data.asm" INCLUDE "data/map_objects.asm" diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 037c2cb..976b64a 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -4239,29 +4239,29 @@ Func_1a61f: ; 1a61f (6:661f) pop af or a jr nz, .else - ld a, $40 + ld a, MOLTRES2 call .legendary_card_text - ld a, $5f + ld a, ARTICUNO2 call .legendary_card_text - ld a, $76 + ld a, ZAPDOS3 call .legendary_card_text - ld a, $c1 + ld a, DRAGONITE1 .legendary_card_text ldtx hl, ReceivedLegendaryCardText jr .print_text .else ldtx hl, ReceivedCardText - cp $1e + cp VILEPLUME jr z, .print_text - cp $43 + cp BLASTOISE jr z, .print_text ldtx hl, ReceivedPromotionalFlyingPikachuText - cp $64 + cp FLYING_PIKACHU jr z, .print_text ldtx hl, ReceivedPromotionalSurfingPikachuText - cp $65 + cp SURFING_PIKACHU1 jr z, .print_text - cp $66 + cp SURFING_PIKACHU2 jr z, .print_text ldtx hl, ReceivedPromotionalCardText .print_text diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm index 2286921..f998061 100644 --- a/src/engine/bank07.asm +++ b/src/engine/bank07.asm @@ -310,7 +310,7 @@ Func_1c52e: ; 1c52e (7:452e) push hl push af ld a, [wLoadedNPCTempIndex] - ld l, LOADED_NPC_UNKNOWN + ld l, LOADED_NPC_DIRECTION_BACKUP call GetItemInLoadedNPCIndex pop af ld [hl], a @@ -325,9 +325,9 @@ Func_1c53f: ; 1c53f (7:453f) ld l, LOADED_NPC_DIRECTION call GetItemInLoadedNPCIndex ld a, [hl] - ld bc, LOADED_NPC_UNKNOWN - LOADED_NPC_DIRECTION + ld bc, LOADED_NPC_DIRECTION_BACKUP - LOADED_NPC_DIRECTION add hl, bc - ld [hl], a + ld [hl], a ; LOADED_NPC_DIRECTION_BACKUP push af call Func_1c5e9 pop af @@ -442,17 +442,17 @@ ApplyRandomCountToNPCAnim: ; 1c5b9 (7:45b9) ; 0x1c5e9 ; sets the loaded NPC's direction -; to the direction that is in LOADED_NPC_UNKNOWN +; to the direction that is in LOADED_NPC_DIRECTION_BACKUP Func_1c5e9: ; 1c5e9 (7:45e9) push hl push bc ld a, [wLoadedNPCTempIndex] - ld l, LOADED_NPC_UNKNOWN + ld l, LOADED_NPC_DIRECTION_BACKUP call GetItemInLoadedNPCIndex ld a, [hl] - ld bc, LOADED_NPC_DIRECTION - LOADED_NPC_UNKNOWN + ld bc, LOADED_NPC_DIRECTION - LOADED_NPC_DIRECTION_BACKUP add hl, bc - ld [hl], a + ld [hl], a ; LOADED_NPC_DIRECTION call UpdateNPCAnimation pop bc pop hl diff --git a/src/engine/home.asm b/src/engine/home.asm index cdf9588..87deaaa 100644 --- a/src/engine/home.asm +++ b/src/engine/home.asm @@ -2310,7 +2310,7 @@ SerialTimerHandler: ; 0c91 (0:0c91) ld [hl], $0 ret -Func_cc5: ; 0cc5 (0:0cc5) +Func_0cc5: ; 0cc5 (0:0cc5) ld hl, wSerialRecvCounter or a jr nz, .asm_cdc @@ -10706,7 +10706,7 @@ GameEvent_Duel: ; 38c0 (0:38c0) ld [wd112], a call EnableSRAM xor a - ld [sba44], a + ld [sPlayerInChallengeMachine], a call DisableSRAM call SaveGeneralSaveData bank1call StartDuel_VSAIOpp @@ -10719,10 +10719,10 @@ GameEvent_ChallengeMachine: ; 38db (0:38db) call PlayDefaultSong call EnableSRAM xor a - ld [sba44], a + ld [sPlayerInChallengeMachine], a call DisableSRAM .asm_38ed - farcall Func_131d3 + farcall ChallengeMachine_Start ld a, MUSIC_OVERWORLD ld [wDefaultSong], a call PlayDefaultSong @@ -10734,7 +10734,7 @@ GameEvent_ContinueDuel: ; 38fb (0:38fb) ld [wd112], a bank1call TryContinueDuel call EnableSRAM - ld a, [sba44] + ld a, [sPlayerInChallengeMachine] call DisableSRAM cp $ff jr z, GameEvent_ChallengeMachine.asm_38ed diff --git a/src/sram.asm b/src/sram.asm index a9b5f4b..dbd80c2 100644 --- a/src/sram.asm +++ b/src/sram.asm @@ -250,24 +250,50 @@ sEventVars:: ; b87b ds $45 sGeneralSaveDataEnd:: - ds $144 + ds $142 -sba44:: ; ba44 - ds $1 +sChallengeMachineMagic:: ; ba42 + ds $2 - ds $11 +sChallengeMachineStart:: ; ba44 -sba56:: ; ba56 +sPlayerInChallengeMachine:: ; ba44 ds $1 -sba57:: ; ba57 +sTotalChallengeMachineWins:: ; ba45 + ds $2 + +sPresentConsecutiveWins:: ; ba47 + ds $2 + +sPresentConsecutiveWinsBackup:: ; ba49 + ds $2 + +sChallengeMachineOpponents:: ; ba4b + ds NUM_CHALLENGE_MACHINE_OPPONENTS + +; 0: not dueled +; 1: won +; 2: lost +sChallengeMachineDuelResults:: ; ba50 + ds NUM_CHALLENGE_MACHINE_OPPONENTS + +; the current opponent number, 0-4 +sChallengeMachineOpponentNumber:: ; ba55 ds $1 - ds $10 +sMaximumConsecutiveWins:: ; ba56 + ds $2 -sba68:: ; ba68 +sChallengeMachineRecordHolderName:: ; ba58 + ds NAME_BUFFER_LENGTH + +; TRUE if just set new consecutive win record +sConsecutiveWinRecordIncreased:: ; ba68 ds $1 +sChallengeMachineEnd:: ; ba69 + ds $97 ; keeps track of last 16 player's names that diff --git a/src/text/text1.asm b/src/text/text1.asm index 26ddc2c..e6192ee 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -612,7 +612,7 @@ DuelistIsThinkingText: ; 36f4a (d:6f4a) text "<RAMNAME> is thinking." done -Text0089: ; 36f5a (d:6f5a) +ClearOpponentNameText: ; 36f5a (d:6f5a) textfw0 " ", " ", " ", " ", " ", " ", " ", " ", " ", " " done diff --git a/src/text/text3.asm b/src/text/text3.asm index acc143b..88556d8 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -1529,79 +1529,79 @@ Text0394: ; 3f4d6 (f:74d6) text "(Name of Deck transferring)" done -Text0395: ; 3f4f3 (f:74f3) +OpponentTitleAndNameText: ; 3f4f3 (f:74f3) text "<RAMTEXT> <RAMTEXT>" done -Text0396: ; 3f4f9 (f:74f9) +OpponentDeckNameText: ; 3f4f9 (f:74f9) text "<RAMTEXT> Deck" done -Text0397: ; 3f501 (f:7501) +FightingClubMemberText: ; 3f501 (f:7501) text "Fighting Club Member" done -Text0398: ; 3f517 (f:7517) +RockClubMemberText: ; 3f517 (f:7517) text "Rock Club Member" done -Text0399: ; 3f529 (f:7529) +WaterClubMemberText: ; 3f529 (f:7529) text "Water Club Member" done -Text039a: ; 3f53c (f:753c) +LightningClubMemberText: ; 3f53c (f:753c) text "Lightning Club Member" done -Text039b: ; 3f553 (f:7553) +GrassClubMemberText: ; 3f553 (f:7553) text "Grass Club Member" done -Text039c: ; 3f566 (f:7566) +PsychicClubMemberText: ; 3f566 (f:7566) text "Psychic Club Member" done -Text039d: ; 3f57b (f:757b) +ScienceClubMemberText: ; 3f57b (f:757b) text "Science Club Member" done -Text039e: ; 3f590 (f:7590) +FireClubMemberText: ; 3f590 (f:7590) text "Fire Club Member" done -Text039f: ; 3f5a2 (f:75a2) +FightingClubMasterText: ; 3f5a2 (f:75a2) text "Fighting Club Master" done -Text03a0: ; 3f5b8 (f:75b8) +RockClubMasterText: ; 3f5b8 (f:75b8) text "Rock Club Master" done -Text03a1: ; 3f5ca (f:75ca) +WaterClubMasterText: ; 3f5ca (f:75ca) text "Water Club Master" done -Text03a2: ; 3f5dd (f:75dd) +LightningClubMasterText: ; 3f5dd (f:75dd) text "Lightning Club Master" done -Text03a3: ; 3f5f4 (f:75f4) +GrassClubMasterText: ; 3f5f4 (f:75f4) text "Grass Club Master" done -Text03a4: ; 3f607 (f:7607) +PsychicClubMasterText: ; 3f607 (f:7607) text "Psychic Club Master" done -Text03a5: ; 3f61c (f:761c) +ScienceClubMasterText: ; 3f61c (f:761c) text "Science Club Master" done -Text03a6: ; 3f631 (f:7631) +FireClubMasterText: ; 3f631 (f:7631) text "Fire Club Master" done -Text03a7: ; 3f643 (f:7643) +EmptyText: ; 3f643 (f:7643) done ColosseumBoosterText: ; 3f644 (f:7644) diff --git a/src/text/text9.asm b/src/text/text9.asm index 036fbd5..a29bb88 100644 --- a/src/text/text9.asm +++ b/src/text/text9.asm @@ -1006,92 +1006,92 @@ CreatedByText: ; 57027 (15:7027) line " Hudson" done -Text07d4: ; 5705e (15:705e) +ChallengeMachineText: ; 5705e (15:705e) text " Challenge Machine " done -Text07d5: ; 57075 (15:7075) +PlayersScoreText: ; 57075 (15:7075) text "<RAMNAME>'s Score" done -Text07d6: ; 57080 (15:7080) +Defeated5OpponentsXTimesText: ; 57080 (15:7080) text "Defeated 5 opponents time(s)." done -Text07d7: ; 570a4 (15:70a4) +PresentConsecutiveWinsText: ; 570a4 (15:70a4) text "Present Consecutive Wins" done -Text07d8: ; 570be (15:70be) +MaximumConsecutiveWinsText: ; 570be (15:70be) text "Maximum Consecutive Wins" line " [ <RAMTEXT> ]" done -Text07d9: ; 570e3 (15:70e3) +WinsText: ; 570e3 (15:70e3) text "Wins" done -Text07da: ; 570e9 (15:70e9) +XConsecutiveWinsNthOpponentIsText: ; 570e9 (15:70e9) text "<RAMNAME> <RAMNUM> Consecutive Wins!" line "" text "<RAMNUM> opponent is <RAMTEXT>." done -Text07db: ; 57112 (15:7112) +NthOpponentIsText: ; 57112 (15:7112) text "<RAMNUM> opponent is <RAMTEXT>." done -Text07dc: ; 57124 (15:7124) +WouldYouLikeToBeginTheDuelText: ; 57124 (15:7124) text "Would you like to begin the Duel?" done -Text07dd: ; 57147 (15:7147) +IfYouQuitTheDuelText: ; 57147 (15:7147) text "If you quit the Duel," line "Your Consecutive Wins will end." done -Text07de: ; 5717e (15:717e) +WouldYouLikeToQuitTheDuelText: ; 5717e (15:717e) text "Would you like to quit the Duel?" done -Text07df: ; 571a0 (15:71a0) +PlayTheChallengeMachineText: ; 571a0 (15:71a0) text "Play the Challenge Machine?" done -Text07e0: ; 571bd (15:71bd) +LetUsChooseYourOpponentText: ; 571bd (15:71bd) text "OK," line "Let us choose your opponent." done -Text07e1: ; 571df (15:71df) +LostToTheNthOpponentText: ; 571df (15:71df) text "You lost to the <RAMNUM> opponent," line "<RAMTEXT>!" done -Text07e2: ; 571ff (15:71ff) +ConsecutiveWinsEndedAtText: ; 571ff (15:71ff) text "<RAMNAME>'s consecutive wins" line "ended at <RAMNUM>." done -Text07e3: ; 57221 (15:7221) +WeAwaitYourNextChallengeText: ; 57221 (15:7221) text "We await your next challenge." done -Text07e4: ; 57240 (15:7240) +YourOpponentsForThisGameText: ; 57240 (15:7240) text "Your opponents for this game:" done -Text07e5: ; 5725f (15:725f) +WonAgainstXOpponentsText: ; 5725f (15:725f) text "Congratulations!" line "You won against <RAMNUM> opponents!" done -DefeatedFiveOpponentsText: ; 5728e (15:728e) +Defeated5OpponentsText: ; 5728e (15:728e) text "Congratulations!" line "You defeated 5 opponents!" done -Text07e7: ; 572ba (15:72ba) +SuccessfullyDefeated5OpponentsText: ; 572ba (15:72ba) text "<RAMNAME> successfully defeated " line "5 opponents " text "<RAMNUM> time(s)!!!" @@ -1102,79 +1102,79 @@ ConsecutiveWinRecordIncreasedText: ; 572ee (15:72ee) line "record increased to <RAMNUM>!" done -Text07e9: ; 5731a (15:731a) +ClubMemberText: ; 5731a (15:731a) text "Club Member" done -Text07ea: ; 57327 (15:7327) +ClubMasterText: ; 57327 (15:7327) text "Club Master" done -Text07eb: ; 57334 (15:7334) +TechText: ; 57334 (15:7334) text "TECH" done -Text07ec: ; 5733a (15:733a) +StrangeLifeformText: ; 5733a (15:733a) text "Strange Life-form" done -Text07ed: ; 5734d (15:734d) +GrandMasterText: ; 5734d (15:734d) text "Grand Master" done -Text07ee: ; 5735b (15:735b) +ChallengeMachineOpponent1Text: ; 5735b (15:735b) textfw0 "1" done -Text07ef: ; 5735d (15:735d) +ChallengeMachineOpponent2Text: ; 5735d (15:735d) textfw0 "2" done -Text07f0: ; 5735f (15:735f) +ChallengeMachineOpponent3Text: ; 5735f (15:735f) textfw0 "3" done -Text07f1: ; 57361 (15:7361) +ChallengeMachineOpponent4Text: ; 57361 (15:7361) textfw0 "4" done -Text07f2: ; 57363 (15:7363) +ChallengeMachineOpponent5Text: ; 57363 (15:7363) textfw0 "5" done -Text07f3: ; 57365 (15:7365) +ChallengeMachineNotDuelledIconText: ; 57365 (15:7365) textfw0 " " done -Text07f4: ; 57367 (15:7367) +ChallengeMachineDuelWonIconText: ; 57367 (15:7367) textfw3 "☆" done -Text07f5: ; 5736a (15:736a) +ChallengeMachineDuelLostIconText: ; 5736a (15:736a) textfw3 "★" done -Text07f6: ; 5736d (15:736d) +ChallengeMachineFireIconText: ; 5736d (15:736d) textfw3 "【", "<FIRE>", "】" done -Text07f7: ; 57374 (15:7374) +ChallengeMachineLightningIconText: ; 57374 (15:7374) textfw3 "【", "<LIGHTNING>", "】" done -Text07f8: ; 5737b (15:737b) +ChallengeMachineWaterIconText: ; 5737b (15:737b) textfw3 "【", "<WATER>", "】" done -Text07f9: ; 57382 (15:7382) +ChallengeMachineFightingIconText: ; 57382 (15:7382) textfw3 "【", "<FIGHTING>", "】" done -Text07fa: ; 57389 (15:7389) +ChallengeMachinePsychicIconText: ; 57389 (15:7389) textfw3 "【", "<PSYCHIC>", "】" done -Text07fb: ; 57390 (15:7390) +ChallengeMachineGrassIconText: ; 57390 (15:7390) textfw3 "【", "<GRASS>", "】" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 69984c7..ee0f3a2 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -138,7 +138,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer SelectCheckText ; 0x0086 textpointer Text0087 ; 0x0087 textpointer DuelistIsThinkingText ; 0x0088 - textpointer Text0089 ; 0x0089 + textpointer ClearOpponentNameText ; 0x0089 textpointer SelectComputerOpponentText ; 0x008a textpointer NumberOfPrizesText ; 0x008b textpointer Text008c ; 0x008c @@ -918,25 +918,25 @@ TextOffsets:: ; 34000 (d:4000) textpointer Text0392 ; 0x0392 textpointer Text0393 ; 0x0393 textpointer Text0394 ; 0x0394 - textpointer Text0395 ; 0x0395 - textpointer Text0396 ; 0x0396 - textpointer Text0397 ; 0x0397 - textpointer Text0398 ; 0x0398 - textpointer Text0399 ; 0x0399 - textpointer Text039a ; 0x039a - textpointer Text039b ; 0x039b - textpointer Text039c ; 0x039c - textpointer Text039d ; 0x039d - textpointer Text039e ; 0x039e - textpointer Text039f ; 0x039f - textpointer Text03a0 ; 0x03a0 - textpointer Text03a1 ; 0x03a1 - textpointer Text03a2 ; 0x03a2 - textpointer Text03a3 ; 0x03a3 - textpointer Text03a4 ; 0x03a4 - textpointer Text03a5 ; 0x03a5 - textpointer Text03a6 ; 0x03a6 - textpointer Text03a7 ; 0x03a7 + textpointer OpponentTitleAndNameText ; 0x0395 + textpointer OpponentDeckNameText ; 0x0396 + textpointer FightingClubMemberText ; 0x0397 + textpointer RockClubMemberText ; 0x0398 + textpointer WaterClubMemberText ; 0x0399 + textpointer LightningClubMemberText ; 0x039a + textpointer GrassClubMemberText ; 0x039b + textpointer PsychicClubMemberText ; 0x039c + textpointer ScienceClubMemberText ; 0x039d + textpointer FireClubMemberText ; 0x039e + textpointer FightingClubMasterText ; 0x039f + textpointer RockClubMasterText ; 0x03a0 + textpointer WaterClubMasterText ; 0x03a1 + textpointer LightningClubMasterText ; 0x03a2 + textpointer GrassClubMasterText ; 0x03a3 + textpointer PsychicClubMasterText ; 0x03a4 + textpointer ScienceClubMasterText ; 0x03a5 + textpointer FireClubMasterText ; 0x03a6 + textpointer EmptyText ; 0x03a7 textpointer ColosseumBoosterText ; 0x03a8 textpointer EvolutionBoosterText ; 0x03a9 textpointer MysteryBoosterText ; 0x03aa @@ -2005,46 +2005,46 @@ TextOffsets:: ; 34000 (d:4000) textpointer SupervisorText ; 0x07d1 textpointer ExecutiveProducerText ; 0x07d2 textpointer CreatedByText ; 0x07d3 - textpointer Text07d4 ; 0x07d4 - textpointer Text07d5 ; 0x07d5 - textpointer Text07d6 ; 0x07d6 - textpointer Text07d7 ; 0x07d7 - textpointer Text07d8 ; 0x07d8 - textpointer Text07d9 ; 0x07d9 - textpointer Text07da ; 0x07da - textpointer Text07db ; 0x07db - textpointer Text07dc ; 0x07dc - textpointer Text07dd ; 0x07dd - textpointer Text07de ; 0x07de - textpointer Text07df ; 0x07df - textpointer Text07e0 ; 0x07e0 - textpointer Text07e1 ; 0x07e1 - textpointer Text07e2 ; 0x07e2 - textpointer Text07e3 ; 0x07e3 - textpointer Text07e4 ; 0x07e4 - textpointer Text07e5 ; 0x07e5 - textpointer DefeatedFiveOpponentsText ; 0x07e6 - textpointer Text07e7 ; 0x07e7 + textpointer ChallengeMachineText ; 0x07d4 + textpointer PlayersScoreText ; 0x07d5 + textpointer Defeated5OpponentsXTimesText ; 0x07d6 + textpointer PresentConsecutiveWinsText ; 0x07d7 + textpointer MaximumConsecutiveWinsText ; 0x07d8 + textpointer WinsText ; 0x07d9 + textpointer XConsecutiveWinsNthOpponentIsText ; 0x07da + textpointer NthOpponentIsText ; 0x07db + textpointer WouldYouLikeToBeginTheDuelText ; 0x07dc + textpointer IfYouQuitTheDuelText ; 0x07dd + textpointer WouldYouLikeToQuitTheDuelText ; 0x07de + textpointer PlayTheChallengeMachineText ; 0x07df + textpointer LetUsChooseYourOpponentText ; 0x07e0 + textpointer LostToTheNthOpponentText ; 0x07e1 + textpointer ConsecutiveWinsEndedAtText ; 0x07e2 + textpointer WeAwaitYourNextChallengeText ; 0x07e3 + textpointer YourOpponentsForThisGameText ; 0x07e4 + textpointer WonAgainstXOpponentsText ; 0x07e5 + textpointer Defeated5OpponentsText ; 0x07e6 + textpointer SuccessfullyDefeated5OpponentsText ; 0x07e7 textpointer ConsecutiveWinRecordIncreasedText ; 0x07e8 - textpointer Text07e9 ; 0x07e9 - textpointer Text07ea ; 0x07ea - textpointer Text07eb ; 0x07eb - textpointer Text07ec ; 0x07ec - textpointer Text07ed ; 0x07ed - textpointer Text07ee ; 0x07ee - textpointer Text07ef ; 0x07ef - textpointer Text07f0 ; 0x07f0 - textpointer Text07f1 ; 0x07f1 - textpointer Text07f2 ; 0x07f2 - textpointer Text07f3 ; 0x07f3 - textpointer Text07f4 ; 0x07f4 - textpointer Text07f5 ; 0x07f5 - textpointer Text07f6 ; 0x07f6 - textpointer Text07f7 ; 0x07f7 - textpointer Text07f8 ; 0x07f8 - textpointer Text07f9 ; 0x07f9 - textpointer Text07fa ; 0x07fa - textpointer Text07fb ; 0x07fb + textpointer ClubMemberText ; 0x07e9 + textpointer ClubMasterText ; 0x07ea + textpointer TechText ; 0x07eb + textpointer StrangeLifeformText ; 0x07ec + textpointer GrandMasterText ; 0x07ed + textpointer ChallengeMachineOpponent1Text ; 0x07ee + textpointer ChallengeMachineOpponent2Text ; 0x07ef + textpointer ChallengeMachineOpponent3Text ; 0x07f0 + textpointer ChallengeMachineOpponent4Text ; 0x07f1 + textpointer ChallengeMachineOpponent5Text ; 0x07f2 + textpointer ChallengeMachineNotDuelledIconText ; 0x07f3 + textpointer ChallengeMachineDuelWonIconText ; 0x07f4 + textpointer ChallengeMachineDuelLostIconText ; 0x07f5 + textpointer ChallengeMachineFireIconText ; 0x07f6 + textpointer ChallengeMachineLightningIconText ; 0x07f7 + textpointer ChallengeMachineWaterIconText ; 0x07f8 + textpointer ChallengeMachineFightingIconText ; 0x07f9 + textpointer ChallengeMachinePsychicIconText ; 0x07fa + textpointer ChallengeMachineGrassIconText ; 0x07fb textpointer GrassEnergyName ; 0x07fc textpointer GrassEnergyDescription ; 0x07fd textpointer FireEnergyName ; 0x07fe diff --git a/src/wram.asm b/src/wram.asm index f417c83..9dc530e 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -2296,7 +2296,11 @@ wCurAutoDeckMachine:: ; d0a9 wAutoDeckMachineTextDescriptions:: ; d0aa ds 2 * NUM_DECK_MACHINE_SLOTS -wd0b4:: ; d0b4 +; if bit 4 is set, transition to another map via a warp +; if bit 6 is set, transition to a special screen +; (duel, challenge machine, battle center, gift center, credits) +; bit 7 may also be used for some unknown purpose +wOverworldTransition:: ; d0b4 ds $1 ; a GAME_EVENT_* constant corresponding to an entry in GameEventPointerTable @@ -3207,6 +3211,9 @@ wBoosterData_EnergyFunctionPointer:: ; d687 wBoosterData_TypeChances:: ; d689 ds NUM_BOOSTER_CARD_TYPES +; index into ChallengeMachine_OpponentDeckIDs +; not the typical NPC duelist ID +wChallengeMachineOpponent:: ; d692 ds $1 wStarterDeckChoice:: ; d693 |