ref: 17f34cb29c1aeb1bb623e587e3e4cf1f1fc295fb
parent: fd0a78d708f6e4e9f6489f951f07e3e9478d773d
author: Remy Oukaour <[email protected]>
date: Thu Jan 11 10:36:11 EST 2018
Disambiguate some uses of wcf64/5/6
--- a/constants/landmark_constants.asm
+++ b/constants/landmark_constants.asm
@@ -110,3 +110,4 @@
const_def
const JOHTO_REGION ; 0
const KANTO_REGION ; 1
+NUM_REGIONS EQU const_value
--- a/engine/breeding.asm
+++ b/engine/breeding.asm
@@ -726,11 +726,11 @@
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 @@
jp GetSGBLayout
EggHatch_CrackShell: ; 1736d (5:736d)
- ld a, [wcf64]
+ ld a, [wFrameCounter]
dec a
and $7
cp $7
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -94,7 +94,7 @@
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 @@
; e468d
PlaceGameFreakPresents_1: ; e468d
- ld hl, wcf65
+ ld hl, wIntroSceneTimer
ld a, [hl]
cp $20
jr nc, .PlaceGameFreak
@@ -173,7 +173,7 @@
; e46ba
PlaceGameFreakPresents_2: ; e46ba
- ld hl, wcf65
+ ld hl, wIntroSceneTimer
ld a, [hl]
cp $40
jr nc, .place_presents
@@ -197,7 +197,7 @@
; e46dd
PlaceGameFreakPresents_3: ; e46dd
- ld hl, wcf65
+ ld hl, wIntroSceneTimer
ld a, [hl]
cp $80
jr nc, .finish
@@ -503,7 +503,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -523,7 +523,7 @@
call PlaySFX
pop af
.DontPlaySound:
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
xor a
call CrystalIntro_UnownFade
ret
@@ -642,7 +642,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -669,7 +669,7 @@
call PlaySFX
pop af
.NoUnown:
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
xor a
call CrystalIntro_UnownFade
ret
@@ -682,7 +682,7 @@
call PlaySFX
pop af
.StopUnown:
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, $1
call CrystalIntro_UnownFade
ret
@@ -758,7 +758,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -907,7 +907,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -925,7 +925,7 @@
ld c, a
and $1f
sla a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, c
and $e0
srl a
@@ -939,7 +939,7 @@
and $f
sla a
sla a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, c
and $70
or $40
@@ -1041,7 +1041,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -1068,7 +1068,7 @@
.asm_e4e1a
ld a, $1
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, [wGlobalAnimXOffset]
cp $88
jr c, .asm_e4e2c
@@ -1150,7 +1150,7 @@
call _InitSpriteAnimStruct
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -1217,7 +1217,7 @@
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -1299,7 +1299,7 @@
call _InitSpriteAnimStruct
xor a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -1331,7 +1331,7 @@
and $1c
srl a
srl a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
xor a
call Intro_Scene20_AppearUnown
ret
@@ -1341,7 +1341,7 @@
and $1c
srl a
srl a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, 1
call Intro_Scene20_AppearUnown
ret
@@ -1358,7 +1358,7 @@
xor a
ld [hBGMapMode], a
ld [wIntroSceneFrameCounter], a
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
call NextIntroScene
ret
@@ -1461,13 +1461,13 @@
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 @@
ld c, a
and $f
- ld [wcf65], a
+ ld [wIntroSceneTimer], a
ld a, c
and $70
swap a
@@ -1603,7 +1603,7 @@
add hl, de
inc hl
inc hl
- ld a, [wcf65]
+ ld a, [wIntroSceneTimer]
and %111111
cp %011111
jr z, .okay
@@ -1714,7 +1714,7 @@
ld hl, .pal2
.got_pointer
- ld a, [wcf65]
+ ld a, [wIntroSceneTimer]
and $7
add a
add a
@@ -1784,7 +1784,7 @@
rept 4
inc hl
endr
- ld a, [wcf65]
+ ld a, [wIntroSceneTimer]
add a
ld c, a
ld b, $0
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -19,7 +19,7 @@
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 @@
; 49935
CelebiEvent_CountDown: ; 49935
- ld hl, wcf64
+ ld hl, wFrameCounter
ld a, [hl]
and a
jr z, .done
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -39,13 +39,13 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_FrameTimer: ; 8cbc8 (23:4bc8)
call .SpawnLeaf
- ld hl, wcf64
+ ld hl, wFrameCounter
ld a, [hl]
and a
jr z, .exit
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -92,9 +92,9 @@
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 @@
pop hl
call .DisplayNewHallOfFamer
jr c, .done
- ld hl, wcf64
+ ld hl, wHallOfFameMonCounter
inc [hl]
jr .loop
@@ -321,7 +321,7 @@
.DisplayTeam:
xor a
- ld [wcf64], a
+ ld [wHallOfFameMonCounter], a
.next
call .DisplayMonAndStrings
jr c, .start_button
@@ -341,7 +341,7 @@
jr .loop
.a_button
- ld hl, wcf64
+ ld hl, wHallOfFameMonCounter
inc [hl]
jr .next
@@ -356,7 +356,7 @@
.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
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -86,20 +86,20 @@
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 @@
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 @@
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 @@
xor $ff
inc a
add e
- ld [wcf65], a
+ ld [wMagnetTrainPosition], a
ld hl, wGlobalAnimXOffset
ld a, [wMagnetTrainDirection]
add [hl]
@@ -365,12 +365,12 @@
.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 @@
.MoveTrain2: ; 8ce7a
ld hl, wMagnetTrainFinalPosition
- ld a, [wcf65]
+ ld a, [wMagnetTrainPosition]
cp [hl]
jr z, .PrepareToFinishAnim
ld e, a
@@ -395,7 +395,7 @@
ld a, e
add d
add d
- ld [wcf65], a
+ ld [wMagnetTrainPosition], a
ld hl, wGlobalAnimXOffset
ld a, [wMagnetTrainDirection]
ld d, a
--- a/engine/events/mom.asm
+++ b/engine/events/mom.asm
@@ -146,7 +146,7 @@
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 @@
ld [hli], a
ld [hl], a
ld a, $5
- ld [wcf64], a
+ ld [wMomBankDigitCursorPosition], a
call LoadStandardMenuDataHeader
call Mom_SetUpWithdrawMenu
call Mom_Wait10Frames
--- a/engine/events/pokecenter_pc.asm
+++ b/engine/events/pokecenter_pc.asm
@@ -421,7 +421,7 @@
farcall DepositSellInitPackBuffers
.loop
farcall DepositSellPack
- ld a, [wcf66]
+ ld a, [wPackUsedItem]
and a
jr z, .close
call .TryDepositItem
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -785,7 +785,7 @@
farcall DepositSellInitPackBuffers
.loop
farcall DepositSellPack
- ld a, [wcf66]
+ ld a, [wPackUsedItem]
and a
jp z, .quit
call .TryToSellItem
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -490,7 +490,7 @@
ret
.select
- ld hl, wcf64
+ ld hl, wNamingScreenLetterCase
ld a, [hl]
xor 1
ld [hl], a
@@ -922,7 +922,7 @@
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 @@
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
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -59,7 +59,7 @@
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 @@
.give
ld a, [wJumptableIndex]
push af
- ld a, [wcf64]
+ ld a, [wPackJumptableIndex]
push af
call GetCurNick
ld hl, StringBuffer1
@@ -643,7 +643,7 @@
call CopyBytes
call TryGiveItemToPartymon
pop af
- ld [wcf64], a
+ ld [wPackJumptableIndex], a
pop af
ld [wJumptableIndex], a
.finish
@@ -718,7 +718,7 @@
xor a
ld [hBGMapMode], a
call Pack_InitGFX
- ld a, [wcf64]
+ ld a, [wPackJumptableIndex]
ld [wJumptableIndex], a
call Pack_InitColors
ret
@@ -963,6 +963,7 @@
InitPackBuffers: ; 1068a
xor a
ld [wJumptableIndex], a
+ ; pocket id -> jumptable index
ld a, [wLastPocket]
maskbits NUM_POCKETS +- 1
ld [wCurrPocket], a
@@ -969,10 +970,10 @@
inc a
add a
dec a
- ld [wcf64], a
+ ld [wPackJumptableIndex], a
+ xor a ; FALSE
+ ld [wPackUsedItem], a
xor a
- ld [wcf66], a
- xor a
ld [wSwitchItem], a
ret
; 106a5
@@ -980,10 +981,10 @@
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 @@
.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 @@
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
jr c, .loop
- xor a
- ld [wcf66], a
+ xor a ; FALSE
+ ld [wPackUsedItem], a
ret
; 107d7
@@ -1269,8 +1270,8 @@
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)
@@ -1277,7 +1278,7 @@
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 @@
.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 @@
.d_right
ld a, c
ld [wJumptableIndex], a
- ld [wcf64], a
+ ld [wPackJumptableIndex], a
push de
ld de, SFX_SWITCH_POCKETS
call PlaySFX
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -87,8 +87,8 @@
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_InitCursorPosition: ; 400b4
ld hl, wPokedexOrder
- ld a, [wLastDexEntry]
+ ld a, [wPrevDexEntry]
and a
jr z, .done
cp NUM_POKEMON + 1
@@ -291,7 +291,7 @@
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 @@
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 @@
.max_volume
call MaxVolume
- ld a, [wDexEntryPrevJumptableIndex]
+ ld a, [wPrevDexEntryJumptableIndex]
ld [wJumptableIndex], a
ret
@@ -386,7 +386,7 @@
xor $1
ld [wPokedexStatus], a
call Pokedex_GetSelectedMon
- ld [wLastDexEntry], a
+ ld [wPrevDexEntry], a
farcall DisplayDexEntry
call WaitBGMap
ret
@@ -402,7 +402,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -87,9 +87,9 @@
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 @@
ret
AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41)
- ld hl, wcf64
+ ld hl, wPokegearCard
ld e, [hl]
ld d, 0
ld hl, .XCoords
@@ -239,8 +239,8 @@
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 @@
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 @@
.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 @@
.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 @@
ld a, c
ld [wJumptableIndex], a
ld a, b
- ld [wcf64], a
+ ld [wPokegearCard], a
call DeleteSpriteAnimStruct2ToEnd
ret
--- a/engine/start_menu.asm
+++ b/engine/start_menu.asm
@@ -503,7 +503,7 @@
call FadeToMenu
farcall Pack
- ld a, [wcf66]
+ ld a, [wPackUsedItem]
and a
jr nz, .used_item
call CloseSubmenu
--- a/engine/trade_animation.asm
+++ b/engine/trade_animation.asm
@@ -398,8 +398,8 @@
call DmgToCgbObjPal0
call TradeAnim_IncrementJumptableIndex
- ld a, $5c
- ld [wcf64], a
+ ld a, 92
+ ld [wFrameCounter], a
ret
; 291af
@@ -486,8 +486,8 @@
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_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 @@
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 @@
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 @@
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 @@
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 @@
; 29879
TradeAnim_WaitAnim: ; 29879
- ld hl, wcf64
+ ld hl, wFrameCounter
ld a, [hl]
and a
jr z, .done
@@ -1561,7 +1561,7 @@
; 29886
TradeAnim_WaitAnim2: ; 29886
- ld hl, wcf64
+ ld hl, wFrameCounter
ld a, [hl]
and a
jr z, .done
--- a/wram.asm
+++ b/wram.asm
@@ -152,7 +152,7 @@
wPrinterConnectionOpen:: db
wPrinterOpcode:: db
-wLastDexEntry:: db
+wPrevDexEntry:: db
wDisableTextAcceleration:: db
wPreviousLandmark:: db
wCurrentLandmark:: db
@@ -1302,8 +1302,8 @@
ds 1
-wBattleTowerBattleEnded::
wJumptableIndex::
+wBattleTowerBattleEnded::
db
UNION ; cf64
@@ -1315,7 +1315,11 @@
NEXTU ; cf64
; intro and title data
wIntroSceneFrameCounter:: db
+UNION ; cf65
+wIntroSceneTimer:: db
+NEXTU ; cf65
wTitleScreenTimer:: dw
+ENDU
NEXTU ; cf64
; credits data
@@ -1324,23 +1328,25 @@
wCreditsLYOverride:: db
NEXTU ; cf64
-; unown puzzle data
-wHoldingUnownPuzzlePiece:: db
-wUnownPuzzleCursorPosition:: db
-wUnownPuzzleHeldPiece:: db
+; pokedex
+wPrevDexEntryJumptableIndex:: db
+if DEF(_CRYSTAL11)
+wPrevDexEntryBackup:: db
+else
+wPrevDexEntryBackup::
+wPokedexStatus:: db
+endc
NEXTU ; cf64
-; card flip data
-wCardFlipCursorY:: db
-wCardFlipCursorX:: db
-wCardFlipWhichCard:: db
+; pokegear
+wPokegearCard:: db
+wPokegearMapRegion:: db
NEXTU ; cf64
-; pokedex
-wDexEntryPrevJumptableIndex:: db
-if !DEF(_CRYSTAL11)
-wPokedexStatus:: db
-endc
+; pack
+wPackJumptableIndex:: db
+wCurrPocket:: db
+wPackUsedItem:: db
NEXTU ; cf64
; trainer card badges
@@ -1349,12 +1355,32 @@
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