From 17f34cb29c1aeb1bb623e587e3e4cf1f1fc295fb Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Thu, 11 Jan 2018 15:36:11 -0500 Subject: [PATCH] Disambiguate some uses of wcf64/5/6 --- constants/landmark_constants.asm | 1 + engine/breeding.asm | 6 ++-- engine/crystal_intro.asm | 54 ++++++++++++++-------------- engine/events/celebi.asm | 4 +-- engine/events/field_moves.asm | 18 +++++----- engine/events/halloffame.asm | 12 +++---- engine/events/magnet_train.asm | 30 ++++++++-------- engine/events/mom.asm | 4 +-- engine/events/pokecenter_pc.asm | 2 +- engine/mart.asm | 2 +- engine/namingscreen.asm | 8 ++--- engine/pack.asm | 43 ++++++++++++----------- engine/pokedex.asm | 34 +++++++++--------- engine/pokegear.asm | 24 ++++++------- engine/start_menu.asm | 2 +- engine/trade_animation.asm | 30 ++++++++-------- wram.asm | 60 +++++++++++++++++++++++--------- 17 files changed, 181 insertions(+), 153 deletions(-) diff --git a/constants/landmark_constants.asm b/constants/landmark_constants.asm index 4de94ddf9..5f74b3386 100644 --- a/constants/landmark_constants.asm +++ b/constants/landmark_constants.asm @@ -110,3 +110,4 @@ EVENT_LOCATION EQU $7f const_def const JOHTO_REGION ; 0 const KANTO_REGION ; 1 +NUM_REGIONS EQU const_value diff --git a/engine/breeding.asm b/engine/breeding.asm index 6674f288d..df8b36e6a 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -726,11 +726,11 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) ld c, 80 call DelayFrames xor a - ld [wcf64], a + ld [wFrameCounter], a ld a, [hSCX] ld b, a .outerloop - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] inc [hl] cp 8 @@ -791,7 +791,7 @@ Hatch_LoadFrontpicPal: ; 17363 (5:7363) jp GetSGBLayout EggHatch_CrackShell: ; 1736d (5:736d) - ld a, [wcf64] + ld a, [wFrameCounter] dec a and $7 cp $7 diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 0d86533c1..7ce19004a 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -94,7 +94,7 @@ Copyright_GFPresents: ; e4579 xor a ld [wJumptableIndex], a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a ld [hSCX], a ld [hSCY], a ld a, $1 @@ -146,7 +146,7 @@ PlaceGameFreakPresents_0: ; e468c ; e468d PlaceGameFreakPresents_1: ; e468d - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $20 jr nc, .PlaceGameFreak @@ -173,7 +173,7 @@ PlaceGameFreakPresents_1: ; e468d ; e46ba PlaceGameFreakPresents_2: ; e46ba - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $40 jr nc, .place_presents @@ -197,7 +197,7 @@ PlaceGameFreakPresents_2: ; e46ba ; e46dd PlaceGameFreakPresents_3: ; e46dd - ld hl, wcf65 + ld hl, wIntroSceneTimer ld a, [hl] cp $80 jr nc, .finish @@ -503,7 +503,7 @@ IntroScene1: ; e495b (39:495b) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -523,7 +523,7 @@ IntroScene2: ; e49d6 (39:49d6) call PlaySFX pop af .DontPlaySound: - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call CrystalIntro_UnownFade ret @@ -642,7 +642,7 @@ IntroScene5: ; e4a7a (39:4a7a) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -669,7 +669,7 @@ IntroScene6: ; e4af7 (39:4af7) call PlaySFX pop af .NoUnown: - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call CrystalIntro_UnownFade ret @@ -682,7 +682,7 @@ IntroScene6: ; e4af7 (39:4af7) call PlaySFX pop af .StopUnown: - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, $1 call CrystalIntro_UnownFade ret @@ -758,7 +758,7 @@ IntroScene7: ; e4b3f (39:4b3f) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -907,7 +907,7 @@ IntroScene11: ; e4c86 (39:4c86) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -925,7 +925,7 @@ IntroScene12: ; e4cfa (39:4cfa) ld c, a and $1f sla a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $e0 srl a @@ -939,7 +939,7 @@ IntroScene12: ; e4cfa (39:4cfa) and $f sla a sla a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $70 or $40 @@ -1041,7 +1041,7 @@ IntroScene13: ; e4d6d (39:4d6d) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1068,7 +1068,7 @@ IntroScene14: ; e4dfa (39:4dfa) .asm_e4e1a ld a, $1 - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, [wGlobalAnimXOffset] cp $88 jr c, .asm_e4e2c @@ -1150,7 +1150,7 @@ IntroScene15: ; e4e40 (39:4e40) call _InitSpriteAnimStruct xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1217,7 +1217,7 @@ IntroScene17: ; e4ef5 (39:4ef5) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1299,7 +1299,7 @@ IntroScene19: ; e4f7e (39:4f7e) call _InitSpriteAnimStruct xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1331,7 +1331,7 @@ IntroScene20: ; e5019 (39:5019) and $1c srl a srl a - ld [wcf65], a + ld [wIntroSceneTimer], a xor a call Intro_Scene20_AppearUnown ret @@ -1341,7 +1341,7 @@ IntroScene20: ; e5019 (39:5019) and $1c srl a srl a - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, 1 call Intro_Scene20_AppearUnown ret @@ -1358,7 +1358,7 @@ IntroScene21: ; e505d (39:505d) xor a ld [hBGMapMode], a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret @@ -1461,13 +1461,13 @@ IntroScene26: ; e50bb (39:50bb) call Intro_SetCGBPalUpdate xor a ld [wIntroSceneFrameCounter], a - ld [wcf65], a + ld [wIntroSceneTimer], a call NextIntroScene ret IntroScene27: ; e512d (39:512d) ; Spell out C R Y S T A L with Unown. - ld hl, wcf65 + ld hl, wIntroSceneTimer inc [hl] ld hl, wIntroSceneFrameCounter ld a, [hl] @@ -1477,7 +1477,7 @@ IntroScene27: ; e512d (39:512d) ld c, a and $f - ld [wcf65], a + ld [wIntroSceneTimer], a ld a, c and $70 swap a @@ -1603,7 +1603,7 @@ CrystalIntro_UnownFade: ; e5223 (39:5223) add hl, de inc hl inc hl - ld a, [wcf65] + ld a, [wIntroSceneTimer] and %111111 cp %011111 jr z, .okay @@ -1714,7 +1714,7 @@ Intro_Scene20_AppearUnown: ; e5348 (39:5348) ld hl, .pal2 .got_pointer - ld a, [wcf65] + ld a, [wIntroSceneTimer] and $7 add a add a @@ -1784,7 +1784,7 @@ Intro_FadeUnownWordPals: ; e539d (39:539d) rept 4 inc hl endr - ld a, [wcf65] + ld a, [wIntroSceneTimer] add a ld c, a ld b, $0 diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index e4ed0df57..e61bdec8f 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -19,7 +19,7 @@ Special_CelebiShrineEvent: ; 4989a ld a, $80 ld [hl], a ld a, 160 ; frame count - ld [wcf64], a + ld [wFrameCounter], a ld d, $0 .loop ld a, [wJumptableIndex] @@ -86,7 +86,7 @@ LoadCelebiGFX: ; 49912 ; 49935 CelebiEvent_CountDown: ; 49935 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 7f28bca56..efa1403be 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -39,13 +39,13 @@ ShakeHeadbuttTree: ; 8c80a ld [wCurrSpriteOAMAddr], a farcall DoNextFrameForAllSprites call HideHeadbuttTree - ld a, $20 - ld [wcf64], a + ld a, 32 + ld [wFrameCounter], a call WaitSFX ld de, SFX_SANDSTORM call PlaySFX .loop - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -188,7 +188,7 @@ Cut_SpawnAnimateTree: ; 8ca23 (23:4a23) add hl, bc ld [hl], $84 ld a, 32 - ld [wcf64], a + ld [wFrameCounter], a ; Cut_StartWaiting ld hl, wJumptableIndex inc [hl] @@ -206,7 +206,7 @@ Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c) ld a, $30 call Cut_SpawnLeaf ld a, 32 ; frames - ld [wcf64], a + ld [wFrameCounter], a ; Cut_StartWaiting ld hl, wJumptableIndex inc [hl] @@ -220,7 +220,7 @@ Cut_StartWaiting: ; 8ca5c (23:4a5c) inc [hl] Cut_WaitAnimSFX: ; 8ca64 (23:4a64) - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .finished @@ -336,7 +336,7 @@ FlyFromAnim: ; 8caed add hl, bc ld [hl], SPRITE_ANIM_SEQ_FLY_FROM ld a, 128 - ld [wcf64], a + ld [wFrameCounter], a .loop ld a, [wJumptableIndex] bit 7, a @@ -374,7 +374,7 @@ FlyToAnim: ; 8cb33 add hl, bc ld [hl], 11 * 8 ld a, 64 - ld [wcf64], a + ld [wFrameCounter], a .loop ld a, [wJumptableIndex] bit 7, a @@ -431,7 +431,7 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) FlyFunction_FrameTimer: ; 8cbc8 (23:4bc8) call .SpawnLeaf - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .exit diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index f1981c2fd..768ea9e58 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -92,9 +92,9 @@ AnimateHallOfFame: ; 864c3 ld de, MUSIC_HALL_OF_FAME call HallOfFame_PlayMusicDE xor a - ld [wcf64], a + ld [wHallOfFameMonCounter], a .loop - ld a, [wcf64] + ld a, [wHallOfFameMonCounter] cp PARTY_LENGTH jr nc, .done ld hl, wHallOfFameTempMon1 @@ -108,7 +108,7 @@ AnimateHallOfFame: ; 864c3 pop hl call .DisplayNewHallOfFamer jr c, .done - ld hl, wcf64 + ld hl, wHallOfFameMonCounter inc [hl] jr .loop @@ -321,7 +321,7 @@ _HallOfFamePC: ; 86650 .DisplayTeam: xor a - ld [wcf64], a + ld [wHallOfFameMonCounter], a .next call .DisplayMonAndStrings jr c, .start_button @@ -341,7 +341,7 @@ _HallOfFamePC: ; 86650 jr .loop .a_button - ld hl, wcf64 + ld hl, wHallOfFameMonCounter inc [hl] jr .next @@ -356,7 +356,7 @@ _HallOfFamePC: ; 86650 .DisplayMonAndStrings: ; Print the number of times the player has entered the Hall of Fame. ; If that number is above 200, print "HOF Master!" instead. - ld a, [wcf64] + ld a, [wHallOfFameMonCounter] cp PARTY_LENGTH jr nc, .fail ld hl, wHallOfFameTempMon1 diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index fb05ff7f6..fd936f902 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -86,20 +86,20 @@ Special_MagnetTrain: ; 8cc04 MagnetTrain_UpdateLYOverrides: ; 8cc99 ld hl, LYOverridesBackup ld c, $2f - ld a, [wcf64] + ld a, [wMagnetTrainOffset] add a ld [hSCX], a call .loadloop ld c, $30 - ld a, [wcf65] + ld a, [wMagnetTrainPosition] call .loadloop ld c, $31 - ld a, [wcf64] + ld a, [wMagnetTrainOffset] add a call .loadloop ld a, [wMagnetTrainDirection] ld d, a - ld hl, wcf64 + ld hl, wMagnetTrainOffset ld a, [hl] add d add d @@ -147,11 +147,11 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 call MagnetTrain_InitLYOverrides ld hl, wJumptableIndex xor a - ld [hli], a + ld [hli], a ; wJumptableIndex ld a, [wMagnetTrainInitPosition] - ld [hli], a - ld [hli], a - ld [hli], a + ld [hli], a ; wMagnetTrainOffset + ld [hli], a ; wMagnetTrainPosition + ld [hli], a ; wMagnetTrainWaitCounter ld de, MUSIC_MAGNET_TRAIN call PlayMusic2 ret @@ -341,13 +341,13 @@ MagnetTrain_Jumptable: ; 8cdf7 ld [hl], $0 call .Next ld a, $80 - ld [wcf66], a + ld [wMagnetTrainWaitCounter], a ret ; 8ce47 .MoveTrain1: ; 8ce47 ld hl, wMagnetTrainHoldPosition - ld a, [wcf65] + ld a, [wMagnetTrainPosition] cp [hl] jr z, .PrepareToHoldTrain ld e, a @@ -355,7 +355,7 @@ MagnetTrain_Jumptable: ; 8cdf7 xor $ff inc a add e - ld [wcf65], a + ld [wMagnetTrainPosition], a ld hl, wGlobalAnimXOffset ld a, [wMagnetTrainDirection] add [hl] @@ -365,12 +365,12 @@ MagnetTrain_Jumptable: ; 8cdf7 .PrepareToHoldTrain: call .Next ld a, $80 - ld [wcf66], a + ld [wMagnetTrainWaitCounter], a ret ; 8ce6d .WaitScene: ; 8ce6d - ld hl, wcf66 + ld hl, wMagnetTrainWaitCounter ld a, [hl] and a jr z, .DoneWaiting @@ -384,7 +384,7 @@ MagnetTrain_Jumptable: ; 8cdf7 .MoveTrain2: ; 8ce7a ld hl, wMagnetTrainFinalPosition - ld a, [wcf65] + ld a, [wMagnetTrainPosition] cp [hl] jr z, .PrepareToFinishAnim ld e, a @@ -395,7 +395,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, e add d add d - ld [wcf65], a + ld [wMagnetTrainPosition], a ld hl, wGlobalAnimXOffset ld a, [wMagnetTrainDirection] ld d, a diff --git a/engine/events/mom.asm b/engine/events/mom.asm index 6e3c7b320..296f3ad6f 100644 --- a/engine/events/mom.asm +++ b/engine/events/mom.asm @@ -146,7 +146,7 @@ Special_BankOfMom: ; 16218 ld [hli], a ld [hl], a ld a, $5 - ld [wcf64], a + ld [wMomBankDigitCursorPosition], a call LoadStandardMenuDataHeader call Mom_SetUpDepositMenu call Mom_Wait10Frames @@ -213,7 +213,7 @@ Special_BankOfMom: ; 16218 ld [hli], a ld [hl], a ld a, $5 - ld [wcf64], a + ld [wMomBankDigitCursorPosition], a call LoadStandardMenuDataHeader call Mom_SetUpWithdrawMenu call Mom_Wait10Frames diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 7045dc1c8..8d0300aa4 100755 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -421,7 +421,7 @@ KrisDepositItemMenu: ; 0x1588b farcall DepositSellInitPackBuffers .loop farcall DepositSellPack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jr z, .close call .TryDepositItem diff --git a/engine/mart.asm b/engine/mart.asm index 4a8d9e17b..96423cfec 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -785,7 +785,7 @@ SellMenu: ; 15eb3 farcall DepositSellInitPackBuffers .loop farcall DepositSellPack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jp z, .quit call .TryToSellItem diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index e0de37c5f..c2d7b9c1a 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -490,7 +490,7 @@ NamingScreenJoypadLoop: ; 11915 ret .select - ld hl, wcf64 + ld hl, wNamingScreenLetterCase ld a, [hl] xor 1 ld [hl], a @@ -922,7 +922,7 @@ LoadNamingScreenGFX: ; 11c51 ld [hSCX], a ld [wGlobalAnimXOffset], a ld [wJumptableIndex], a - ld [wcf64], a + ld [wNamingScreenLetterCase], a ld [hBGMapMode], a ld [wNamingScreenCurrNameLength], a ld a, $7 @@ -1218,9 +1218,9 @@ INCBIN "gfx/icons/mail2.2bpp" ret .select - ld hl, wcf64 + ld hl, wNamingScreenLetterCase ld a, [hl] - xor $1 + xor 1 ld [hl], a jr nz, .switch_to_lowercase ld de, MailEntry_Uppercase diff --git a/engine/pack.asm b/engine/pack.asm index ea2a06cb9..323592d39 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -59,7 +59,7 @@ Pack: ; 10000 xor a ld [hBGMapMode], a call Pack_InitGFX - ld a, [wcf64] + ld a, [wPackJumptableIndex] ld [wJumptableIndex], a call Pack_InitColors ret @@ -634,7 +634,7 @@ GiveItem: ; 103fd .give ld a, [wJumptableIndex] push af - ld a, [wcf64] + ld a, [wPackJumptableIndex] push af call GetCurNick ld hl, StringBuffer1 @@ -643,7 +643,7 @@ GiveItem: ; 103fd call CopyBytes call TryGiveItemToPartymon pop af - ld [wcf64], a + ld [wPackJumptableIndex], a pop af ld [wJumptableIndex], a .finish @@ -718,7 +718,7 @@ BattlePack: ; 10493 xor a ld [hBGMapMode], a call Pack_InitGFX - ld a, [wcf64] + ld a, [wPackJumptableIndex] ld [wJumptableIndex], a call Pack_InitColors ret @@ -963,15 +963,16 @@ TMHMSubmenu: ; 105dc (4:45dc) InitPackBuffers: ; 1068a xor a ld [wJumptableIndex], a + ; pocket id -> jumptable index ld a, [wLastPocket] maskbits NUM_POCKETS +- 1 ld [wCurrPocket], a inc a add a dec a - ld [wcf64], a - xor a - ld [wcf66], a + ld [wPackJumptableIndex], a + xor a ; FALSE + ld [wPackUsedItem], a xor a ld [wSwitchItem], a ret @@ -980,10 +981,10 @@ InitPackBuffers: ; 1068a DepositSellInitPackBuffers: ; 106a5 xor a ld [hBGMapMode], a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wCurrPocket], a - ld [wcf66], a + ld [wJumptableIndex], a ; PACKSTATE_INITGFX + ld [wPackJumptableIndex], a ; PACKSTATE_INITGFX + ld [wCurrPocket], a ; ITEM_POCKET + ld [wPackUsedItem], a ld [wSwitchItem], a call Pack_InitGFX call Pack_InitColors @@ -1096,13 +1097,13 @@ DepositSellTutorial_InterpretJoypad: ; 1076f .a_button ld a, TRUE - ld [wcf66], a + ld [wPackUsedItem], a and a ret .b_button - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a and a ret @@ -1141,8 +1142,8 @@ TutorialPack: ; 107bb call .RunJumptable call DepositSellTutorial_InterpretJoypad jr c, .loop - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a ret ; 107d7 @@ -1269,15 +1270,15 @@ Pack_GetJumptablePointer: ; 1086b Pack_QuitNoScript: ; 10874 (4:4874) ld hl, wJumptableIndex set 7, [hl] - xor a - ld [wcf66], a + xor a ; FALSE + ld [wPackUsedItem], a ret Pack_QuitRunScript: ; 1087e (4:487e) ld hl, wJumptableIndex set 7, [hl] ld a, TRUE - ld [wcf66], a + ld [wPackUsedItem], a ret Pack_PrintTextNoScroll: ; 10889 (4:4889) @@ -1363,7 +1364,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) .d_left ld a, b ld [wJumptableIndex], a - ld [wcf64], a + ld [wPackJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS call PlaySFX @@ -1374,7 +1375,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4) .d_right ld a, c ld [wJumptableIndex], a - ld [wcf64], a + ld [wPackJumptableIndex], a push de ld de, SFX_SWITCH_POCKETS call PlaySFX diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 7fe3852ed..69a51c792 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -87,8 +87,8 @@ InitPokedex: ; 40063 xor a ld [wJumptableIndex], a - ld [wDexEntryPrevJumptableIndex], a - ld [wcf65], a + ld [wPrevDexEntryJumptableIndex], a + ld [wPrevDexEntryBackup], a ld [wcf66], a call Pokedex_CheckUnlockedUnownMode @@ -119,7 +119,7 @@ Pokedex_CheckUnlockedUnownMode: ; 400a2 Pokedex_InitCursorPosition: ; 400b4 ld hl, wPokedexOrder - ld a, [wLastDexEntry] + ld a, [wPrevDexEntry] and a jr z, .done cp NUM_POKEMON + 1 @@ -291,7 +291,7 @@ Pokedex_UpdateMainScreen: ; 401ae (10:41ae) ld a, DEXSTATE_DEX_ENTRY_SCR ld [wJumptableIndex], a ld a, DEXSTATE_MAIN_SCR - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a ret .select @@ -332,7 +332,7 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217) call Pokedex_DrawDexEntryScreenBG call Pokedex_InitArrowCursor call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call Pokedex_DrawFootprint call WaitBGMap @@ -377,7 +377,7 @@ Pokedex_UpdateDexEntryScreen: ; 40258 (10:4258) .max_volume call MaxVolume - ld a, [wDexEntryPrevJumptableIndex] + ld a, [wPrevDexEntryJumptableIndex] ld [wJumptableIndex], a ret @@ -386,7 +386,7 @@ Pokedex_Page: ; 40292 xor $1 ld [wPokedexStatus], a call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call WaitBGMap ret @@ -402,7 +402,7 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa) call Pokedex_InitArrowCursor call Pokedex_LoadCurrentFootprint call Pokedex_GetSelectedMon - ld [wLastDexEntry], a + ld [wPrevDexEntry], a farcall DisplayDexEntry call Pokedex_DrawFootprint call Pokedex_LoadSelectedMonTiles @@ -475,9 +475,9 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 call Pokedex_ApplyPrintPals xor a ld [hSCX], a - ld a, [wcf65] + ld a, [wPrevDexEntryBackup] push af - ld a, [wDexEntryPrevJumptableIndex] + ld a, [wPrevDexEntryJumptableIndex] push af ld a, [wJumptableIndex] push af @@ -485,9 +485,9 @@ DexEntryScreen_MenuActionJumptable: ; 402f2 pop af ld [wJumptableIndex], a pop af - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a pop af - ld [wcf65], a + ld [wPrevDexEntryBackup], a call ClearBGPalettes call DisableLCD call Pokedex_LoadInvertedFont @@ -697,8 +697,8 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471) ld [wDexListingScrollOffsetBackup], a ld a, [wDexListingCursor] ld [wDexListingCursorBackup], a - ld a, [wLastDexEntry] - ld [wcf65], a + ld a, [wPrevDexEntry] + ld [wPrevDexEntryBackup], a xor a ld [wDexListingScrollOffset], a ld [wDexListingCursor], a @@ -773,7 +773,7 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ld a, DEXSTATE_DEX_ENTRY_SCR ld [wJumptableIndex], a ld a, DEXSTATE_SEARCH_RESULTS_SCR - ld [wDexEntryPrevJumptableIndex], a + ld [wPrevDexEntryJumptableIndex], a ret .return_to_search_screen @@ -781,8 +781,8 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562) ld [wDexListingScrollOffset], a ld a, [wDexListingCursorBackup] ld [wDexListingCursor], a - ld a, [wcf65] - ld [wLastDexEntry], a + ld a, [wPrevDexEntryBackup] + ld [wPrevDexEntry], a call Pokedex_BlackOutBG call ClearSprites call Pokedex_OrderMonsByMode diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 4141b08fa..ee993749e 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -87,9 +87,9 @@ PokeGear: ; 90b8d (24:4b8d) ld [rLCDC], a call TownMap_InitCursorAndPlayerIconPositions xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a + ld [wJumptableIndex], a ; POKEGEARSTATE_CLOCKINIT + ld [wPokegearCard], a ; POKEGEARCARD_CLOCK + ld [wPokegearMapRegion], a ; JOHTO_REGION ld [wcf66], a ld [wPokegearPhoneScrollPosition], a ld [wPokegearPhoneCursorPosition], a @@ -173,7 +173,7 @@ InitPokegearModeIndicatorArrow: ; 90d32 (24:4d32) ret AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41) - ld hl, wcf64 + ld hl, wPokegearCard ld e, [hl] ld d, 0 ld hl, .XCoords @@ -239,8 +239,8 @@ TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70) Pokegear_InitJumptableIndices: ; 90d9e (24:4d9e) ld a, POKEGEARSTATE_CLOCKINIT ld [wJumptableIndex], a - xor a - ld [wcf64], a + xor a ; POKEGEARCARD_CLOCK + ld [wPokegearCard], a ret InitPokegearTilemap: ; 90da8 (24:4da8) @@ -250,7 +250,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld bc, TileMapEnd - TileMap ld a, $4f call ByteFill - ld a, [wcf64] + ld a, [wPokegearCard] maskbits NUM_POKEGEAR_CARDS +- 1 add a ld e, a @@ -267,7 +267,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8) .return_from_jumptable call Pokegear_FinishTilemap farcall TownMapPals - ld a, [wcf65] + ld a, [wPokegearMapRegion] and a jr nz, .kanto_0 xor a ; LOW(vBGMap0) @@ -288,10 +288,10 @@ InitPokegearTilemap: ; 90da8 (24:4da8) .finish ld [hWY], a ; swap region maps - ld a, [wcf65] - and 1 + ld a, [wPokegearMapRegion] + maskbits NUM_REGIONS +- 1 xor 1 - ld [wcf65], a + ld [wPokegearMapRegion], a ret .UpdateBGMap: ; 90e00 (24:4e00) @@ -1361,7 +1361,7 @@ Pokegear_SwitchPage: ; 91480 (24:5480) ld a, c ld [wJumptableIndex], a ld a, b - ld [wcf64], a + ld [wPokegearCard], a call DeleteSpriteAnimStruct2ToEnd ret diff --git a/engine/start_menu.asm b/engine/start_menu.asm index 913bf3780..91d6caff9 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -503,7 +503,7 @@ StartMenu_Pack: ; 1295b call FadeToMenu farcall Pack - ld a, [wcf66] + ld a, [wPackUsedItem] and a jr nz, .used_item call CloseSubmenu diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index f5bd375d1..b6711ac61 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -398,8 +398,8 @@ TradeAnim_InitTubeAnim: ; 2914e call DmgToCgbObjPal0 call TradeAnim_IncrementJumptableIndex - ld a, $5c - ld [wcf64], a + ld a, 92 + ld [wFrameCounter], a ret ; 291af @@ -486,8 +486,8 @@ TradeAnim_TubeToPlayer5: ; 29211 TradeAnim_TubeToOT6: TradeAnim_TubeToPlayer6: ; 29220 - ld a, $80 - ld [wcf64], a + ld a, 128 + ld [wFrameCounter], a call TradeAnim_IncrementJumptableIndex ret @@ -522,7 +522,7 @@ TradeAnim_TubeToOT7: TradeAnim_TubeToPlayer2: TradeAnim_TubeToPlayer7: ; 2925d call TradeAnim_FlashBGPals - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -1126,8 +1126,8 @@ TradeAnim_RockingBall: ; 2961b ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $20 - ld [wcf64], a + ld a, 32 + ld [wFrameCounter], a ret ; 2962c @@ -1143,8 +1143,8 @@ TradeAnim_DropBall: ; 2962c add hl, bc ld [hl], $dc call TradeAnim_AdvanceScriptPointer - ld a, $38 - ld [wcf64], a + ld a, 56 + ld [wFrameCounter], a ret ; 29649 @@ -1154,8 +1154,8 @@ TradeAnim_Poof: ; 29649 ld a, SPRITE_ANIM_INDEX_TRADE_POOF call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $10 - ld [wcf64], a + ld a, 16 + ld [wFrameCounter], a ld de, SFX_BALL_POOF call PlaySFX ret @@ -1169,8 +1169,8 @@ TradeAnim_BulgeThroughTube: ; 29660 ld a, SPRITE_ANIM_INDEX_TRADE_TUBE_BULGE call _InitSpriteAnimStruct call TradeAnim_AdvanceScriptPointer - ld a, $40 - ld [wcf64], a + ld a, 64 + ld [wFrameCounter], a ret ; 29676 @@ -1547,7 +1547,7 @@ LoadTradeBubbleGFX: ; 2985a ; 29879 TradeAnim_WaitAnim: ; 29879 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done @@ -1561,7 +1561,7 @@ TradeAnim_WaitAnim: ; 29879 ; 29886 TradeAnim_WaitAnim2: ; 29886 - ld hl, wcf64 + ld hl, wFrameCounter ld a, [hl] and a jr z, .done diff --git a/wram.asm b/wram.asm index f13d4cb2d..6df133132 100644 --- a/wram.asm +++ b/wram.asm @@ -152,7 +152,7 @@ wMapTimeOfDay:: db wPrinterConnectionOpen:: db wPrinterOpcode:: db -wLastDexEntry:: db +wPrevDexEntry:: db wDisableTextAcceleration:: db wPreviousLandmark:: db wCurrentLandmark:: db @@ -1302,8 +1302,8 @@ wNamedObjectTypeBuffer:: db ds 1 -wBattleTowerBattleEnded:: wJumptableIndex:: +wBattleTowerBattleEnded:: db UNION ; cf64 @@ -1315,7 +1315,11 @@ wcf66:: db NEXTU ; cf64 ; intro and title data wIntroSceneFrameCounter:: db +UNION ; cf65 +wIntroSceneTimer:: db +NEXTU ; cf65 wTitleScreenTimer:: dw +ENDU NEXTU ; cf64 ; credits data @@ -1323,38 +1327,60 @@ wCreditsBorderFrame:: db wCreditsBorderMon:: db wCreditsLYOverride:: db -NEXTU ; cf64 -; unown puzzle data -wHoldingUnownPuzzlePiece:: db -wUnownPuzzleCursorPosition:: db -wUnownPuzzleHeldPiece:: db - -NEXTU ; cf64 -; card flip data -wCardFlipCursorY:: db -wCardFlipCursorX:: db -wCardFlipWhichCard:: db - NEXTU ; cf64 ; pokedex -wDexEntryPrevJumptableIndex:: db -if !DEF(_CRYSTAL11) +wPrevDexEntryJumptableIndex:: db +if DEF(_CRYSTAL11) +wPrevDexEntryBackup:: db +else +wPrevDexEntryBackup:: wPokedexStatus:: db endc +NEXTU ; cf64 +; pokegear +wPokegearCard:: db +wPokegearMapRegion:: db + +NEXTU ; cf64 +; pack +wPackJumptableIndex:: db +wCurrPocket:: db +wPackUsedItem:: db + NEXTU ; cf64 ; trainer card badges wTrainerCardBadgeFrameCounter:: db wTrainerCardBadgeTileID:: db wTrainerCardBadgeAttributes:: db +NEXTU ; cf64 +; card flip data +wCardFlipCursorY:: db +wCardFlipCursorX:: db +wCardFlipWhichCard:: db + +NEXTU ; cf64 +; magnet train +wMagnetTrainOffset:: db +wMagnetTrainPosition:: db +wMagnetTrainWaitCounter:: db + +NEXTU ; cf64 +; unown puzzle data +wHoldingUnownPuzzlePiece:: db +wUnownPuzzleCursorPosition:: db +wUnownPuzzleHeldPiece:: db + NEXTU ; cf64 ; miscellaneous +wFrameCounter:: wNrOfBeatenBattleTowerTrainers:: wMomBankDigitCursorPosition:: +wNamingScreenLetterCase:: +wHallOfFameMonCounter:: wSlotsDelay:: db -wCurrPocket:: wPrinterQueueLength:: db ENDU ; cf67