summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audio/sfx_crystal.asm4
-rw-r--r--constants/engine_flags.asm2
-rw-r--r--constants/wram_constants.asm10
-rw-r--r--data/events/engine_flags.asm2
-rw-r--r--data/events/special_pointers.asm20
-rw-r--r--engine/battle/battle_transition.asm34
-rw-r--r--engine/battle/core.asm16
-rw-r--r--engine/debug/color_picker.asm8
-rw-r--r--engine/events/battle_tower/battle_tower.asm12
-rw-r--r--engine/events/celebi.asm2
-rw-r--r--engine/events/field_moves.asm2
-rw-r--r--engine/events/npc_trade.asm9
-rw-r--r--engine/events/print_unown_2.asm12
-rw-r--r--engine/events/specials.asm4
-rw-r--r--engine/games/dummy_game.asm10
-rw-r--r--engine/games/slot_machine.asm2
-rw-r--r--engine/gfx/cgb_layouts.asm10
-rw-r--r--engine/gfx/color.asm20
-rw-r--r--engine/gfx/crystal_layouts.asm17
-rw-r--r--engine/gfx/sgb_layouts.asm10
-rw-r--r--engine/gfx/sprite_anims.asm6
-rw-r--r--engine/link/init_list.asm4
-rw-r--r--engine/link/link.asm8
-rw-r--r--engine/menus/intro_menu.asm6
-rw-r--r--engine/menus/main_menu.asm4
-rw-r--r--engine/movie/trade_animation.asm20
-rw-r--r--engine/overworld/events.asm2
-rw-r--r--engine/overworld/scripting.asm12
-rw-r--r--engine/pokedex/pokedex.asm2
-rw-r--r--engine/pokegear/pokegear.asm6
-rw-r--r--engine/pokemon/bills_pc.asm6
-rw-r--r--engine/pokemon/stats_screen.asm54
-rw-r--r--engine/printer/printer.asm4
-rw-r--r--home/game_time.asm4
-rw-r--r--home/init.asm6
-rw-r--r--home/joypad.asm4
-rw-r--r--home/names.asm4
-rw-r--r--hram.asm2
-rw-r--r--mobile/mobile_22.asm12
-rw-r--r--mobile/mobile_40.asm12
-rw-r--r--mobile/mobile_5b.asm10
-rw-r--r--wram.asm69
42 files changed, 255 insertions, 208 deletions
diff --git a/audio/sfx_crystal.asm b/audio/sfx_crystal.asm
index f2deb8fcc..1a5d1e2d8 100644
--- a/audio/sfx_crystal.asm
+++ b/audio/sfx_crystal.asm
@@ -184,7 +184,7 @@ Sfx_Tingle_Ch5:
duty_cycle 1
transpose 0, 11
note_type 1, 11, 1
-Sfx_Tingle_branch_17996c:
+.loop1:
octave 5
note C_, 3
octave 6
@@ -192,7 +192,7 @@ Sfx_Tingle_branch_17996c:
octave 5
note C_, 3
rest 2
- sound_loop 2, Sfx_Tingle_branch_17996c
+ sound_loop 2, .loop1
note C_, 2
volume_envelope 10, 1
note G_, 13
diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm
index 800e7651b..8fa25b4bb 100644
--- a/constants/engine_flags.asm
+++ b/constants/engine_flags.asm
@@ -115,7 +115,7 @@
; wSwarmFlags
const ENGINE_BUENAS_PASSWORD_2
const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
-; wGameTimerPause
+; wGameTimerPaused
const ENGINE_62
; wPlayerGender
const ENGINE_PLAYER_IS_FEMALE
diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm
index c571faf8b..b4156e171 100644
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -21,9 +21,13 @@ AUTO_INPUT EQU $ff
const TEMPMON ; 3
const WILDMON ; 4
-; wGameTimerPause::
-GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0
-GAMETIMERPAUSE_MOBILE_7_F EQU 7
+; wGameTimerPaused::
+GAME_TIMER_PAUSED_F EQU 0
+GAME_TIMER_MOBILE_F EQU 7
+
+; wJoypadDisable::
+JOYPAD_DISABLE_MON_FAINT_F EQU 6
+JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7
; wOptions::
TEXT_DELAY_MASK EQU %111
diff --git a/data/events/engine_flags.asm b/data/events/engine_flags.asm
index f43e64aea..526413651 100644
--- a/data/events/engine_flags.asm
+++ b/data/events/engine_flags.asm
@@ -125,7 +125,7 @@ EngineFlags:
engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F
engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F
- engine_flag wGameTimerPause, GAMETIMERPAUSE_MOBILE_7_F
+ engine_flag wGameTimerPaused, GAME_TIMER_MOBILE_F
engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F
diff --git a/data/events/special_pointers.asm b/data/events/special_pointers.asm
index e1702991c..5d6b0a16e 100644
--- a/data/events/special_pointers.asm
+++ b/data/events/special_pointers.asm
@@ -55,8 +55,8 @@ SpecialsPointers::
add_special UnownPuzzle
add_special SlotMachine
add_special CardFlip
- add_special DummyNonfunctionalGameCornerGame
- add_special ClearBGPalettesBufferScreen
+ add_special UnusedDummyGame ; unused
+ add_special ClearBGPalettesBufferScreen ; unused
add_special FadeOutPalettes
add_special BattleTowerFade
add_special FadeBlackQuickly
@@ -65,21 +65,21 @@ SpecialsPointers::
add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0
- add_special ClearTilemap ; bank 0
+ add_special ClearTilemap ; bank 0; unused as special
add_special UpdateSprites ; bank 0
add_special UpdatePlayerSprite ; bank 0
add_special GameCornerPrizeMonCheckDex
- add_special UnusedSetSeenMon
+ add_special UnusedSetSeenMon ; unused
add_special WaitSFX ; bank 0
add_special PlayMapMusic ; bank 0
add_special RestartMapMusic ; bank 0
add_special HealMachineAnim
add_special SurfStartStep
- add_special FindPartyMonAboveLevel
- add_special FindPartyMonAtLeastThatHappy
+ add_special FindPartyMonAboveLevel ; unused
+ add_special FindPartyMonAtLeastThatHappy ; unused
add_special FindPartyMonThatSpecies
add_special FindPartyMonThatSpeciesYourTrainerID
- add_special UnusedCheckUnusedTwoDayTimer
+ add_special UnusedCheckUnusedTwoDayTimer ; unused
add_special DayCareMon1
add_special DayCareMon2
add_special SelectRandomBugContestContestants
@@ -134,7 +134,7 @@ SpecialsPointers::
add_special Function170114
add_special BattleTowerBattle
add_special Function1704e1
- add_special DummySpecial_17021d
+ add_special UnusedBattleTowerDummySpecial1
add_special LoadOpponentTrainerAndPokemonWithOTSprite
add_special Function11ba38
add_special CheckForBattleTowerRules
@@ -166,7 +166,7 @@ SpecialsPointers::
add_special BeastsCheck
add_special MonCheck
add_special SetPlayerPalette
- add_special DummySpecial_170bd2
+ add_special UnusedBattleTowerDummySpecial2
add_special Mobile_SelectThreeMons
add_special Function1037eb
add_special Function10383c
@@ -181,4 +181,4 @@ SpecialsPointers::
add_special UnusedFindItemInPCOrBag
add_special InitialSetDSTFlag
add_special InitialClearDSTFlag
- add_special DummySpecial_c224
+ add_special UnusedDummySpecial ; unused
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index 318556f7f..12932ede5 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -258,7 +258,7 @@ StartTrainerBattle_NextScene:
StartTrainerBattle_SetUpBGMap:
call StartTrainerBattle_NextScene
xor a
- ld [wcf64], a
+ ld [wBattleTransitionCounter], a
ldh [hBGMapMode], a
ret
@@ -272,7 +272,7 @@ StartTrainerBattle_Flash:
ld a, [wTimeOfDayPalset]
cp DARKNESS_PALSET
jr z, .done
- ld hl, wcf64
+ ld hl, wBattleTransitionCounter
ld a, [hl]
inc [hl]
srl a
@@ -290,7 +290,7 @@ StartTrainerBattle_Flash:
.done
xor a
- ld [wcf64], a
+ ld [wBattleTransitionCounter], a
scf
ret
@@ -322,12 +322,12 @@ StartTrainerBattle_SetUpForWavyOutro:
ld a, $90
ldh [hLYOverrideEnd], a
xor a
- ld [wcf64], a
- ld [wcf65], a
+ ld [wBattleTransitionCounter], a
+ ld [wBattleTransitionSineWaveOffset], a
ret
StartTrainerBattle_SineWave:
- ld a, [wcf64]
+ ld a, [wBattleTransitionCounter]
cp $60
jr nc, .end
call .DoSineWave
@@ -339,10 +339,10 @@ StartTrainerBattle_SineWave:
ret
.DoSineWave:
- ld hl, wcf65
+ ld hl, wBattleTransitionSineWaveOffset
ld a, [hl]
inc [hl]
- ld hl, wcf64
+ ld hl, wBattleTransitionCounter
ld d, [hl]
add [hl]
ld [hl], a
@@ -372,13 +372,13 @@ StartTrainerBattle_SetUpForSpinOutro:
ldh [rSVBK], a
call StartTrainerBattle_NextScene
xor a
- ld [wcf64], a
+ ld [wBattleTransitionCounter], a
ret
StartTrainerBattle_SpinToBlack:
xor a
ldh [hBGMapMode], a
- ld a, [wcf64]
+ ld a, [wBattleTransitionCounter]
ld e, a
ld d, 0
ld hl, .spin_quadrants
@@ -388,13 +388,13 @@ endr
ld a, [hli]
cp -1
jr z, .end
- ld [wcf65], a
+ ld [wBattleTransitionSineWaveOffset], a
call .load
ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
- ld hl, wcf64
+ ld hl, wBattleTransitionCounter
inc [hl]
ret
@@ -464,7 +464,7 @@ ENDM
inc de
.loop1
ld [hl], BATTLETRANSITION_BLACK
- ld a, [wcf65]
+ ld a, [wBattleTransitionSineWaveOffset]
bit RIGHT_QUADRANT_F, a
jr z, .leftside
inc hl
@@ -475,7 +475,7 @@ ENDM
dec c
jr nz, .loop1
pop hl
- ld a, [wcf65]
+ ld a, [wBattleTransitionSineWaveOffset]
bit LOWER_QUADRANT_F, a
ld bc, SCREEN_WIDTH
jr z, .upper
@@ -490,7 +490,7 @@ ENDM
jr z, .loop
ld c, a
.loop2
- ld a, [wcf65]
+ ld a, [wBattleTransitionSineWaveOffset]
bit RIGHT_QUADRANT_F, a
jr z, .leftside2
dec hl
@@ -514,13 +514,13 @@ StartTrainerBattle_SetUpForRandomScatterOutro:
ldh [rSVBK], a
call StartTrainerBattle_NextScene
ld a, $10
- ld [wcf64], a
+ ld [wBattleTransitionCounter], a
ld a, 1
ldh [hBGMapMode], a
ret
StartTrainerBattle_SpeckleToBlack:
- ld hl, wcf64
+ ld hl, wBattleTransitionCounter
ld a, [hl]
and a
jr z, .done
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 97a4a4cda..3c2bf571f 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -3006,10 +3006,11 @@ PlayerMonFaintedAnimation:
jp MonFaintedAnimation
MonFaintedAnimation:
- ld a, [wcfbe]
+ ld a, [wJoypadDisable]
push af
- set 6, a
- ld [wcfbe], a
+ set JOYPAD_DISABLE_MON_FAINT_F, a
+ ld [wJoypadDisable], a
+
ld b, 7
.OuterLoop:
@@ -3052,7 +3053,7 @@ MonFaintedAnimation:
jr nz, .OuterLoop
pop af
- ld [wcfbe], a
+ ld [wJoypadDisable], a
ret
.Spaces:
@@ -4639,7 +4640,7 @@ CheckDanger:
PrintPlayerHUD:
ld de, wBattleMonNick
hlcoord 10, 7
- call ret_3e138
+ call Battle_DummyFunction
call PlaceString
push bc
@@ -4725,7 +4726,7 @@ DrawEnemyHUD:
call GetBaseData
ld de, wEnemyMonNick
hlcoord 1, 0
- call ret_3e138
+ call Battle_DummyFunction
call PlaceString
ld h, b
ld l, c
@@ -4854,7 +4855,8 @@ UpdateHPPal:
ret z
jp FinishBattleAnim
-ret_3e138:
+Battle_DummyFunction:
+; called before placing either battler's nickname in the HUD
ret
BattleMenu:
diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm
index d14efc59f..40261a391 100644
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -929,13 +929,13 @@ DebugColor_FillBoxWithByte:
ret
DebugColor_PushSGBPals:
- ld a, [wcfbe]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wcfbe], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
call _DebugColor_PushSGBPals
pop af
- ld [wcfbe], a
+ ld [wJoypadDisable], a
ret
_DebugColor_PushSGBPals:
diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm
index 0e59b4737..0164ede48 100644
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -183,7 +183,7 @@ BattleTowerBattle:
call _BattleTowerBattle
ret
-DummySpecial_17021d:
+UnusedBattleTowerDummySpecial1:
ret
InitBattleTowerChallengeRAM:
@@ -1008,11 +1008,11 @@ BattleTowerAction_SetExplanationRead:
BattleTowerAction_SetByteToQuickSaveChallenge:
ld c, BATTLETOWER_SAVED_AND_LEFT
- jr asm_17079f
+ jr SetBattleTowerChallengeState
BattleTowerAction_SetByteToCancelChallenge:
ld c, BATTLETOWER_NO_CHALLENGE
-asm_17079f:
+SetBattleTowerChallengeState:
ld a, BANK(sBattleTowerChallengeState)
call OpenSRAM
ld a, c
@@ -1447,11 +1447,11 @@ Function1709bb: ; BattleTowerAction $10
Function170a9c:
ld c, FALSE
- jr asm_170aa2
+ jr Set_s5_aa8d
Function170aa0:
ld c, TRUE
-asm_170aa2:
+Set_s5_aa8d:
ld a, BANK(s5_aa8d)
call OpenSRAM
ld a, c
@@ -1576,7 +1576,7 @@ LoadOpponentTrainerAndPokemonWithOTSprite:
INCLUDE "data/trainers/sprites.asm"
-DummySpecial_170bd2:
+UnusedBattleTowerDummySpecial2:
ret
CheckForBattleTowerRules:
diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm
index fe842819b..6a2d16dfc 100644
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -100,7 +100,7 @@ CelebiEvent_CountDown:
ret
CelebiEvent_SpawnLeaf: ; unreferenced
- ld hl, wcf65
+ ld hl, wFrameCounter2
ld a, [hl]
inc [hl]
and $7
diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm
index 6bbb7cbec..130ec411d 100644
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -426,7 +426,7 @@ FlyFunction_FrameTimer:
ret
.SpawnLeaf:
- ld hl, wcf65
+ ld hl, wFrameCounter2
ld a, [hl]
inc [hl]
and $7
diff --git a/engine/events/npc_trade.asm b/engine/events/npc_trade.asm
index 94aaace72..6b32aff56 100644
--- a/engine/events/npc_trade.asm
+++ b/engine/events/npc_trade.asm
@@ -56,11 +56,12 @@ NPCTrade::
call DisableSpriteUpdates
ld a, [wJumptableIndex]
push af
- ld a, [wcf64]
+ ; wTradeDialog aliases wFrameCounter, which TradeAnimation uses
+ ld a, [wTradeDialog]
push af
predef TradeAnimation
pop af
- ld [wcf64], a
+ ld [wTradeDialog], a
pop af
ld [wJumptableIndex], a
call ReturnToMapWithSpeechTextbox
@@ -107,7 +108,7 @@ Trade_GetDialog:
ld e, NPCTRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
- ld [wcf64], a
+ ld [wTradeDialog], a
ret
DoNPCTrade:
@@ -392,7 +393,7 @@ PrintTradeText:
ld bc, 2 * 4
ld hl, TradeTexts
call AddNTimes
- ld a, [wcf64]
+ ld a, [wTradeDialog]
ld c, a
add hl, bc
add hl, bc
diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm
index 7d83ff049..0b72ae0b0 100644
--- a/engine/events/print_unown_2.asm
+++ b/engine/events/print_unown_2.asm
@@ -9,7 +9,7 @@ RotateUnownFrontpic:
push bc
push hl
push bc
- ld de, wd002
+ ld de, wPrintedUnownTileSource
call .Copy
call .Rotate
ld hl, UnownPrinter_GBPrinterRectangle
@@ -19,10 +19,10 @@ RotateUnownFrontpic:
ld a, [hli]
ld e, a
ld d, [hl]
- ld hl, wd012
+ ld hl, wPrintedUnownTileDest
call .Copy
pop hl
- ld bc, $10
+ ld bc, LEN_2BPP_TILE
add hl, bc
pop bc
inc c
@@ -44,7 +44,7 @@ RotateUnownFrontpic:
ret
.Copy:
- ld c, $10
+ ld c, LEN_2BPP_TILE
.loop_copy
ld a, [hli]
ld [de], a
@@ -54,12 +54,12 @@ RotateUnownFrontpic:
ret
.Rotate:
- ld hl, wd012
+ ld hl, wPrintedUnownTileDest
ld e, %10000000
ld d, 8
.loop_decompress
push hl
- ld hl, wd002
+ ld hl, wPrintedUnownTileSource
call .CountSetBit
pop hl
ld a, b
diff --git a/engine/events/specials.asm b/engine/events/specials.asm
index 1ce06de57..1333f27ce 100644
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -15,7 +15,7 @@ Special::
INCLUDE "data/events/special_pointers.asm"
-DummySpecial_c224:
+UnusedDummySpecial:
ret
SetPlayerPalette:
@@ -207,7 +207,7 @@ CardFlip:
call StartGameCornerGame
ret
-DummyNonfunctionalGameCornerGame:
+UnusedDummyGame:
call CheckCoinsAndCoinCase
ret c
ld a, BANK(_DummyGame)
diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm
index 445bbfc41..648346fc3 100644
--- a/engine/games/dummy_game.asm
+++ b/engine/games/dummy_game.asm
@@ -133,11 +133,11 @@ endr
.next_try
dec [hl]
xor a
- ld [wcf64], a
+ ld [wDummyGameCardChoice], a
ld hl, wJumptableIndex
inc [hl]
.PickCard1:
- ld a, [wcf64]
+ ld a, [wDummyGameCardChoice]
and a
ret z
dec a
@@ -155,13 +155,13 @@ endr
call DummyGame_Card2Coord
call DummyGame_PlaceCard
xor a
- ld [wcf64], a
+ ld [wDummyGameCardChoice], a
ld hl, wJumptableIndex
inc [hl]
ret
.PickCard2:
- ld a, [wcf64]
+ ld a, [wDummyGameCardChoice]
and a
ret z
dec a
@@ -527,7 +527,7 @@ DummyGame_InterpretJoypad_AnimateCursor:
add hl, bc
ld a, [hl]
inc a
- ld [wcf64], a
+ ld [wDummyGameCardChoice], a
ret
.pressed_left
diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm
index 84f50e69d..0b2a08fac 100644
--- a/engine/games/slot_machine.asm
+++ b/engine/games/slot_machine.asm
@@ -249,7 +249,7 @@ DebugPrintSlotBias: ; unreferenced
AnimateSlotReelIcons: ; unreferenced
; This animation was present in pokegold-spaceworld.
- ld hl, wcf66
+ ld hl, wUnusedSlotReelIconDelay
ld a, [hl]
inc [hl]
and $7
diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm
index ab4805dcf..9988b1935 100644
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -43,7 +43,7 @@ LoadSGBLayoutCGB:
dw _CGB_PartyMenu
dw _CGB_Evolution
dw _CGB_GSTitleScreen
- dw _CGB0d
+ dw _CGB_Unused0D
dw _CGB_MoveList
dw _CGB_BetaPikachuMinigame
dw _CGB_PokedexSearchOption
@@ -60,7 +60,7 @@ LoadSGBLayoutCGB:
dw _CGB_TradeTube
dw _CGB_TrainerOrMonFrontpicPals
dw _CGB_MysteryGift
- dw _CGB1e
+ dw _CGB_Unused1E
_CGB_BattleGrayscale:
ld hl, PalPacket_BattleGrayscale + 1
@@ -321,7 +321,7 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a
ret
-Function9009: ; unreferenced
+_CGB_Unknown: ; unreferenced
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .GotPalette
@@ -595,7 +595,7 @@ _CGB_GSTitleScreen:
ldh [hCGBPalUpdate], a
ret
-_CGB0d:
+_CGB_Unused0D:
ld hl, PalPacket_Diploma + 1
call CopyFourPalettes
call WipeAttrmap
@@ -911,7 +911,7 @@ _CGB_PlayerOrMonFrontpicPals:
call ApplyPals
ret
-_CGB1e:
+_CGB_Unused1E:
ld de, wBGPals1
ld a, [wCurPartySpecies]
call GetMonPalettePointer
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index d84bfdf3b..9f42d24f6 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -136,6 +136,7 @@ SGB_ApplyPartyMenuHPPals:
Intro_LoadMagikarpPalettes: ; unreferenced
call CheckCGB
ret z
+
; CGB only
ld hl, .BGPal
ld de, wBGPals1
@@ -789,13 +790,13 @@ endr
ret
PushSGBPals:
- ld a, [wcfbe]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wcfbe], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
call _PushSGBPals
pop af
- ld [wcfbe], a
+ ld [wJoypadDisable], a
ret
_PushSGBPals:
@@ -841,12 +842,14 @@ _PushSGBPals:
InitSGBBorder:
call CheckCGB
ret nz
+
; SGB/DMG only
di
- ld a, [wcfbe]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wcfbe], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
+
xor a
ldh [rJOYP], a
ldh [hSGB], a
@@ -866,13 +869,14 @@ InitSGBBorder:
.skip
pop af
- ld [wcfbe], a
+ ld [wJoypadDisable], a
ei
ret
InitCGBPals::
call CheckCGB
ret z
+
; CGB only
ld a, BANK(vTiles3)
ldh [rVBK], a
diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm
index 9c47797d1..7c15d35c1 100644
--- a/engine/gfx/crystal_layouts.asm
+++ b/engine/gfx/crystal_layouts.asm
@@ -132,7 +132,7 @@ Function49420::
MG_Mobile_Layout01:
call MG_Mobile_Layout_LoadPals
ld de, wBGPals1 palette PAL_BG_TEXT
- ld hl, .Palette_49478
+ ld hl, .TextPalette
ld bc, 1 palettes
ld a, BANK(wBGPals1)
call FarCopyWRAM
@@ -149,19 +149,18 @@ MG_Mobile_Layout01:
bit 6, a
jr z, .asm_49464
call Function49480
- jr .asm_49467
+ jr .done
.asm_49464
call Function49496
-
-.asm_49467
+.done
farcall ApplyAttrmap
farcall ApplyPals
ld a, TRUE
ldh [hCGBPalUpdate], a
ret
-.Palette_49478:
+.TextPalette:
RGB 31, 31, 31
RGB 26, 31, 00
RGB 20, 16, 03
@@ -194,7 +193,7 @@ Function49496:
INCLUDE "engine/tilesets/tileset_palettes.asm"
MG_Mobile_Layout02:
- ld hl, .Palette_49732
+ ld hl, .BGPalette
ld de, wBGPals1
ld bc, 1 palettes
ld a, BANK(wBGPals1)
@@ -202,20 +201,20 @@ MG_Mobile_Layout02:
farcall ApplyPals
call MG_Mobile_Layout_WipeAttrmap
farcall ApplyAttrmap
- ld hl, .Palette_4973a
+ ld hl, .OBPalette
ld de, wOBPals1
ld bc, 1 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
ret
-.Palette_49732:
+.BGPalette:
RGB 31, 31, 31
RGB 23, 16, 07
RGB 23, 07, 07
RGB 03, 07, 20
-.Palette_4973a:
+.OBPalette:
RGB 00, 00, 00
RGB 07, 05, 31
RGB 14, 18, 31
diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm
index bfdaeb098..1e5055f26 100644
--- a/engine/gfx/sgb_layouts.asm
+++ b/engine/gfx/sgb_layouts.asm
@@ -35,7 +35,7 @@ LoadSGBLayout:
dw .SGB_PartyMenu
dw .SGB_Evolution
dw .SGB_GSTitleScreen
- dw .SGB0d
+ dw .SGB_Unused0D
dw .SGB_MoveList
dw .SGB_BetaPikachuMinigame
dw .SGB_PokedexSearchOption
@@ -52,7 +52,7 @@ LoadSGBLayout:
dw .SGB_TradeTube
dw .SGB_TrainerOrMonFrontpicPals
dw .SGB_MysteryGift
- dw .SGB1e
+ dw .SGB_Unused1E
.SGB_BattleGrayscale:
ld hl, PalPacket_BattleGrayscale
@@ -397,7 +397,7 @@ endr
ld de, BlkPacket_AllPal0
ret
-.SGB0d:
+.SGB_Unused0D:
.SGB_TrainerCard:
ld hl, PalPacket_Diploma
ld de, BlkPacket_AllPal0
@@ -437,7 +437,7 @@ endr
ld de, wSGBPals + PALPACKET_LENGTH
ret
-.SGB1e:
+.SGB_Unused1E:
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
@@ -450,7 +450,7 @@ endr
add hl, hl
ld de, PokemonPalettes
add hl, de
- ld a, [wcf65]
+ ld a, [wUnusedSGB1eColorOffset]
and 3
sla a
sla a
diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm
index 53fe6b882..0c2c42bcb 100644
--- a/engine/gfx/sprite_anims.asm
+++ b/engine/gfx/sprite_anims.asm
@@ -357,7 +357,7 @@ AnimSeq_SlotsGolem:
AnimSeq_SlotsChansey:
callfar Slots_AnimateChansey
- ld hl, wcf64
+ ld hl, wSlotsDelay
ld a, [hl]
cp $2
ret nz
@@ -382,7 +382,7 @@ AnimSeq_SlotsChanseyEgg:
jr c, .move_right
call DeinitializeSprite
ld a, $4
- ld [wcf64], a
+ ld [wSlotsDelay], a
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
ret
@@ -819,7 +819,7 @@ AnimSeq_IntroUnown:
ret
AnimSeq_IntroUnownF:
- ld a, [wcf64]
+ ld a, [wSlotsDelay]
cp $40
ret nz
ld a, SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F_2
diff --git a/engine/link/init_list.asm b/engine/link/init_list.asm
index 470280c4b..3e16d3494 100644
--- a/engine/link/init_list.asm
+++ b/engine/link/init_list.asm
@@ -44,9 +44,9 @@ InitList:
ld a, h
ld [wListPointer + 1], a
ld a, e
- ld [wUnusedD102], a
+ ld [wUnusedNamesPointer], a
ld a, d
- ld [wUnusedD102 + 1], a
+ ld [wUnusedNamesPointer + 1], a
ld bc, ItemAttributes
ld a, c
ld [wItemAttributesPtr], a
diff --git a/engine/link/link.asm b/engine/link/link.asm
index b6ceb5245..7c396c098 100644
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -165,9 +165,9 @@ Gen2ToGen1LinkComms:
ld hl, wTimeCapsulePlayerData
call Function2868a
ld a, LOW(wOTPartyMonOT)
- ld [wUnusedD102], a
+ ld [wUnusedNamesPointer], a
ld a, HIGH(wOTPartyMonOT)
- ld [wUnusedD102 + 1], a
+ ld [wUnusedNamesPointer + 1], a
ld de, MUSIC_NONE
call PlayMusic
ldh a, [hSerialConnectionStatus]
@@ -407,9 +407,9 @@ Gen2ToGen2LinkComms:
ld bc, wOTPartyDataEnd - wOTPartyMons
call CopyBytes
ld a, LOW(wOTPartyMonOT)
- ld [wUnusedD102], a
+ ld [wUnusedNamesPointer], a
ld a, HIGH(wOTPartyMonOT)
- ld [wUnusedD102 + 1], a
+ ld [wUnusedNamesPointer + 1], a
ld de, MUSIC_NONE
call PlayMusic
ldh a, [hSerialConnectionStatus]
diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm
index 509777fb5..5849fa0f9 100644
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -465,9 +465,9 @@ FinishContinueFunction:
xor a
ld [wDontPlayMapMusicOnReload], a
ld [wLinkMode], a
- ld hl, wGameTimerPause
- set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
- res GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ set GAME_TIMER_PAUSED_F, [hl]
+ res GAME_TIMER_MOBILE_F, [hl]
ld hl, wEnteredMapFromContinue
set 1, [hl]
farcall OverworldLoop
diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm
index 8bb90785d..63173ec0c 100644
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -31,8 +31,8 @@ MainMenu:
ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
- ld hl, wGameTimerPause
- res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ res GAME_TIMER_PAUSED_F, [hl]
call MainMenu_GetWhichMenu
ld [wWhichIndexSet], a
call MainMenu_PrintCurrentTimeAndDay
diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm
index 71e438767..0b65ccfc9 100644
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -20,7 +20,7 @@ ENDM
TradeAnimation:
xor a
- ld [wcf66], a
+ ld [wUnusedTradeAnimPlayEvolutionMusic], a
ld hl, wPlayerTrademonSenderName
ld de, wOTTrademonSenderName
call LinkTradeAnim_LoadTradePlayerNames
@@ -71,7 +71,7 @@ TradeAnimation:
TradeAnimationPlayer2:
xor a
- ld [wcf66], a
+ ld [wUnusedTradeAnimPlayEvolutionMusic], a
ld hl, wOTTrademonSenderName
ld de, wPlayerTrademonSenderName
call LinkTradeAnim_LoadTradePlayerNames
@@ -137,7 +137,7 @@ RunTradeAnimScript:
push af
set NO_TEXT_SCROLL, [hl]
call .TradeAnimLayout
- ld a, [wcf66]
+ ld a, [wUnusedTradeAnimPlayEvolutionMusic]
and a
jr nz, .anim_loop
ld de, MUSIC_EVOLUTION
@@ -225,7 +225,7 @@ DoTradeAnimation:
jr nz, .finished
call .DoTradeAnimCommand
callfar PlaySpriteAnimations
- ld hl, wcf65
+ ld hl, wFrameCounter2
inc [hl]
call DelayFrame
and a
@@ -273,8 +273,8 @@ DoTradeAnimation:
add_tradeanim TradeAnim_TextboxScrollStart ; 1e
add_tradeanim TradeAnim_ScrollOutRight ; 1f
add_tradeanim TradeAnim_ScrollOutRight2 ; 20
- add_tradeanim TradeAnim_Wait80 ; 21
- add_tradeanim TradeAnim_Wait40 ; 22
+ add_tradeanim TradeAnim_Wait80 ; 21
+ add_tradeanim TradeAnim_Wait40 ; 22
add_tradeanim TradeAnim_RockingBall ; 23
add_tradeanim TradeAnim_DropBall ; 24
add_tradeanim TradeAnim_WaitAnim ; 25
@@ -285,9 +285,9 @@ DoTradeAnimation:
add_tradeanim TradeAnim_GetTrademonSFX ; 2a
add_tradeanim TradeAnim_End ; 2b
add_tradeanim TradeAnim_AnimateFrontpic ; 2c
- add_tradeanim TradeAnim_Wait96 ; 2d
- add_tradeanim TradeAnim_Wait80IfOTEgg ; 2e
- add_tradeanim TradeAnim_Wait180IfOTEgg ; 2f
+ add_tradeanim TradeAnim_Wait96 ; 2d
+ add_tradeanim TradeAnim_Wait80IfOTEgg ; 2e
+ add_tradeanim TradeAnim_Wait180IfOTEgg ; 2f
TradeAnim_IncrementJumptableIndex:
ld hl, wJumptableIndex
@@ -1333,7 +1333,7 @@ LinkTradeAnim_LoadTradeMonSpecies:
ret
TradeAnim_FlashBGPals:
- ld a, [wcf65]
+ ld a, [wFrameCounter2]
and $7
ret nz
ldh a, [rBGP]
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index 5213468bb..822b9ebf9 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -812,7 +812,7 @@ PlayerMovement:
CheckMenuOW:
xor a
ldh [hMenuReturn], a
- ldh [hUnusedFFA1], a
+ ldh [hUnusedByte], a
ldh a, [hJoyPressed]
bit SELECT_F, a
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index 9ba79f5e0..8258ea830 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -458,11 +458,11 @@ Script_verbosegiveitem:
ld de, GiveItemScript
jp ScriptCall
-ret_96f76:
+GiveItemScript_DummyFunction:
ret
GiveItemScript:
- callasm ret_96f76
+ callasm GiveItemScript_DummyFunction
writetext .ReceivedItemText
iffalse .Full
waitsfx
@@ -2316,13 +2316,13 @@ Script_endall:
ret
Script_halloffame:
- ld hl, wGameTimerPause
- res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ res GAME_TIMER_PAUSED_F, [hl]
farcall StubbedTrainerRankings_HallOfFame
farcall StubbedTrainerRankings_HallOfFame2
farcall HallOfFame
- ld hl, wGameTimerPause
- set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ set GAME_TIMER_PAUSED_F, [hl]
jr ReturnFromCredits
Script_credits:
diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm
index e8972ece4..10cd6ef8d 100644
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -91,7 +91,7 @@ InitPokedex:
ld [wJumptableIndex], a
ld [wPrevDexEntryJumptableIndex], a
ld [wPrevDexEntryBackup], a
- ld [wcf66], a
+ ld [wUnusedPokedexByte], a
call Pokedex_CheckUnlockedUnownMode
diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm
index 90f90d07f..ad06ad059 100644
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -92,7 +92,7 @@ PokeGear:
ld [wJumptableIndex], a ; POKEGEARSTATE_CLOCKINIT
ld [wPokegearCard], a ; POKEGEARCARD_CLOCK
ld [wPokegearMapRegion], a ; JOHTO_REGION
- ld [wcf66], a
+ ld [wUnusedPokegearByte], a
ld [wPokegearPhoneScrollPosition], a
ld [wPokegearPhoneCursorPosition], a
ld [wPokegearPhoneSelectedPerson], a
@@ -2038,7 +2038,7 @@ _FlyMap:
lb bc, BANK(FlyMapLabelBorderGFX), 6
call Request1bpp
call FlyMap
- call ret_91c8f
+ call Pokegear_DummyFunction
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
@@ -2243,7 +2243,7 @@ HasVisitedSpawn:
INCLUDE "data/maps/flypoints.asm"
-ret_91c8f:
+Pokegear_DummyFunction:
ret
FlyMap:
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm
index a38e78e4a..d96aaa245 100644
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -782,9 +782,9 @@ BillsPC_InitRAM:
call ByteFill
xor a
ld [wJumptableIndex], a
- ld [wcf64], a
- ld [wcf65], a
- ld [wcf66], a
+ ld [wUnusedBillsPCData], a
+ ld [wUnusedBillsPCData+1], a
+ ld [wUnusedBillsPCData+2], a
ld [wBillsPC_CursorPosition], a
ld [wBillsPC_ScrollPosition], a
ret
diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm
index a6ad0818e..c9a5fbbe3 100644
--- a/engine/pokemon/stats_screen.asm
+++ b/engine/pokemon/stats_screen.asm
@@ -33,7 +33,7 @@ StatsScreenInit_gotaddress:
push af
ld a, [wJumptableIndex]
ld b, a
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
ld c, a
push bc
@@ -52,7 +52,7 @@ StatsScreenInit_gotaddress:
ld a, b
ld [wJumptableIndex], a
ld a, c
- ld [wcf64], a
+ ld [wStatsScreenFlags], a
pop af
ld [wBoxAlignment], a
pop af
@@ -63,11 +63,11 @@ StatsScreenMain:
xor a
ld [wJumptableIndex], a
; ???
- ld [wcf64], a
- ld a, [wcf64]
+ ld [wStatsScreenFlags], a
+ ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK
or PINK_PAGE ; first_page
- ld [wcf64], a
+ ld [wStatsScreenFlags], a
.loop
ld a, [wJumptableIndex]
and $ff ^ (1 << 7)
@@ -83,11 +83,11 @@ StatsScreenMobile:
xor a
ld [wJumptableIndex], a
; ???
- ld [wcf64], a
- ld a, [wcf64]
+ ld [wStatsScreenFlags], a
+ ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK
or PINK_PAGE ; first_page
- ld [wcf64], a
+ ld [wStatsScreenFlags], a
.loop
farcall Mobile_SetOverworldDelay
ld a, [wJumptableIndex]
@@ -115,7 +115,7 @@ StatsScreenPointerTable:
dw StatsScreen_Exit
StatsScreen_WaitAnim:
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
bit 6, [hl]
jr nz, .try_anim
bit 5, [hl]
@@ -126,10 +126,10 @@ StatsScreen_WaitAnim:
.try_anim
farcall SetUpPokeAnim
jr nc, .finish
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
res 6, [hl]
.finish
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
res 5, [hl]
farcall HDMATransferTilemapToWRAMBank3
ret
@@ -147,7 +147,7 @@ StatsScreen_Exit:
ret
MonStatsInit:
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
res 6, [hl]
call ClearBGPalettes
call ClearTilemap
@@ -157,7 +157,7 @@ MonStatsInit:
cp EGG
jr z, .egg
call StatsScreen_InitUpperHalf
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 4, [hl]
ld h, 4
call StatsScreen_SetJumptableIndex
@@ -217,7 +217,7 @@ if DEF(_DEBUG)
ld de, .HatchSoonString
hlcoord 8, 17
call PlaceString
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 5, [hl]
pop hl
pop de
@@ -232,7 +232,7 @@ endc
StatsScreen_LoadPage:
call StatsScreen_LoadGFX
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
res 4, [hl]
ld a, [wJumptableIndex]
inc a
@@ -314,7 +314,7 @@ StatsScreen_GetJoypad:
StatsScreen_JoypadAction:
push af
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
maskbits NUM_STAT_PAGES
ld c, a
pop af
@@ -393,10 +393,10 @@ StatsScreen_JoypadAction:
ret
.set_page
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
and $ff ^ STAT_PAGE_MASK
or c
- ld [wcf64], a
+ ld [wStatsScreenFlags], a
ld h, 4
call StatsScreen_SetJumptableIndex
ret
@@ -530,7 +530,7 @@ StatsScreen_LoadGFX:
call .ClearBox
call .PageTilemap
call .LoadPals
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
bit 4, [hl]
jr nz, .place_frontpic
call SetPalettes
@@ -541,7 +541,7 @@ StatsScreen_LoadGFX:
ret
.ClearBox:
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
maskbits NUM_STAT_PAGES
ld c, a
call StatsScreen_LoadPageIndicators
@@ -551,17 +551,17 @@ StatsScreen_LoadGFX:
ret
.LoadPals:
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
maskbits NUM_STAT_PAGES
ld c, a
farcall LoadStatsScreenPals
call DelayFrame
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 5, [hl]
ret
.PageTilemap:
- ld a, [wcf64]
+ ld a, [wStatsScreenFlags]
maskbits NUM_STAT_PAGES
dec a
ld hl, .Jumptable
@@ -848,7 +848,7 @@ StatsScreen_PlaceFrontpic:
ret
.AnimateMon:
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 5, [hl]
ld a, [wCurPartySpecies]
cp UNOWN
@@ -890,7 +890,7 @@ StatsScreen_PlaceFrontpic:
ld d, $0
ld e, ANIM_MON_MENU
predef LoadMonAnimation
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 6, [hl]
ret
@@ -1033,7 +1033,7 @@ endc
.picked
hlcoord 1, 9
call PlaceString
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 5, [hl]
call SetPalettes ; pals
call DelayFrame
@@ -1099,7 +1099,7 @@ StatsScreen_AnimateEgg:
hlcoord 0, 0
ld d, $0
predef LoadMonAnimation
- ld hl, wcf64
+ ld hl, wStatsScreenFlags
set 6, [hl]
ret
diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm
index fcfd4be39..e8e93bf2d 100644
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -447,9 +447,11 @@ CheckCancelPrint:
ret
.pressed_b
- ld a, [wca80]
+ ld a, [wUnusedGameboyPrinterSafeCancelFlag]
cp $0c
jr nz, .cancel
+
+; wait for printer activity to finish before canceling?
.loop
ld a, [wPrinterOpcode]
and a
diff --git a/home/game_time.asm b/home/game_time.asm
index 7b958c897..1ae33cc47 100644
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -32,8 +32,8 @@ GameTimer::
ret nz
; Is the timer paused?
- ld hl, wGameTimerPause
- bit GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ bit GAME_TIMER_PAUSED_F, [hl]
ret z
; Is the timer already capped?
diff --git a/home/init.asm b/home/init.asm
index 76dc28422..a270b2b9a 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -10,8 +10,8 @@ Reset::
ldh [rIE], a
ei
- ld hl, wcfbe
- set 7, [hl]
+ ld hl, wJoypadDisable
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, [hl]
ld c, 32
call DelayFrames
@@ -50,7 +50,7 @@ Init::
ldh [rOBP1], a
ldh [rTMA], a
ldh [rTAC], a
- ld [wd000], a
+ ld [wUnusedInitializedToZero], a
ld a, %100 ; Start timer at 4096Hz
ldh [rTAC], a
diff --git a/home/joypad.asm b/home/joypad.asm
index 05868d8b3..8dbe2cc5c 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -27,8 +27,8 @@ UpdateJoypad::
; hJoypadSum: pressed so far
; Any of these three bits can be used to disable input.
- ld a, [wcfbe]
- and %11010000
+ ld a, [wJoypadDisable]
+ and (1 << JOYPAD_DISABLE_MON_FAINT_F) | (1 << JOYPAD_DISABLE_SGB_TRANSFER_F) | (1 << 4)
ret nz
; If we're saving, input is disabled.
diff --git a/home/names.asm b/home/names.asm
index e2ce8175c..1add8a888 100644
--- a/home/names.asm
+++ b/home/names.asm
@@ -56,9 +56,9 @@ GetName::
.done
ld a, e
- ld [wUnusedD102], a
+ ld [wUnusedNamesPointer], a
ld a, d
- ld [wUnusedD102 + 1], a
+ ld [wUnusedNamesPointer + 1], a
pop de
pop bc
diff --git a/hram.asm b/hram.asm
index be774f9f6..aca62d831 100644
--- a/hram.asm
+++ b/hram.asm
@@ -31,7 +31,7 @@ hVBlank:: db
hMapEntryMethod:: db
hMenuReturn:: db
-hUnusedFFA1:: db
+hUnusedByte:: db
hJoypadReleased:: db
hJoypadPressed:: db
diff --git a/mobile/mobile_22.asm b/mobile/mobile_22.asm
index dfd23b8b0..75a6bd49e 100644
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -20,18 +20,18 @@ OpenSRAMBank4:
ret
Function89168:
- ld hl, wGameTimerPause
- set GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ set GAME_TIMER_MOBILE_F, [hl]
ret
Function8916e:
- ld hl, wGameTimerPause
- res GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ res GAME_TIMER_MOBILE_F, [hl]
ret
Function89174:
- ld hl, wGameTimerPause
- bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ bit GAME_TIMER_MOBILE_F, [hl]
ret
Function8917a:
diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm
index 0e3bfe145..677216bc6 100644
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -2660,8 +2660,8 @@ Function1011f1:
call CloseSRAM
ld hl, wdc41
res 4, [hl]
- ld hl, wGameTimerPause
- bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ bit GAME_TIMER_MOBILE_F, [hl]
jr z, .skip
ld hl, wdc41
set 4, [hl]
@@ -4425,15 +4425,15 @@ Function101e98:
call ClearSprites
farcall Function8adb3
ret c
- ld hl, wGameTimerPause
- set GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ set GAME_TIMER_MOBILE_F, [hl]
ld hl, wdc41
set 4, [hl]
ret
Function101ead:
- ld hl, wGameTimerPause
- bit GAMETIMERPAUSE_MOBILE_7_F, [hl]
+ ld hl, wGameTimerPaused
+ bit GAME_TIMER_MOBILE_F, [hl]
jr nz, .asm_101ec8
ld hl, wdc41
bit 2, [hl]
diff --git a/mobile/mobile_5b.asm b/mobile/mobile_5b.asm
index 2002facb5..297891e4f 100644
--- a/mobile/mobile_5b.asm
+++ b/mobile/mobile_5b.asm
@@ -7,11 +7,11 @@ Function16c000: ; unreferenced
ldh a, [hSystemBooted]
and a
ret z
- ; Set some flag, preserving the old state
- ld a, [wcfbe]
+ ; Disable the joypad during mobile setup
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wcfbe], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
; Do stuff
call MobileSystemSplashScreen_InitGFX ; Load GFX
farcall SetRAMStateForMobile
@@ -24,7 +24,7 @@ Function16c000: ; unreferenced
ldh [hSystemBooted], a
; Restore the flag state
pop af
- ld [wcfbe], a
+ ld [wJoypadDisable], a
ret
.RunJumptable:
diff --git a/wram.asm b/wram.asm
index 70fa767bf..bbc78d30d 100644
--- a/wram.asm
+++ b/wram.asm
@@ -904,7 +904,7 @@ NEXTU
wGameboyPrinterRAM::
wGameboyPrinter2bppSource:: ds 40 tiles
wGameboyPrinter2bppSourceEnd::
-wca80:: db
+wUnusedGameboyPrinterSafeCancelFlag:: db
wPrinterRowIndex:: db
; Printer data
@@ -1356,12 +1356,6 @@ wBattleTowerBattleEnded::
db
UNION
-; unidentified
-wcf64:: db
-wcf65:: db
-wcf66:: db
-
-NEXTU
; intro data
wIntroSceneFrameCounter:: db
wIntroSceneTimer:: db
@@ -1386,11 +1380,13 @@ else
wPrevDexEntryBackup::
wPokedexStatus:: db
endc
+wUnusedPokedexByte:: db
NEXTU
; pokegear
wPokegearCard:: db
wPokegearMapRegion:: db
+wUnusedPokegearByte:: db
NEXTU
; pack
@@ -1405,12 +1401,22 @@ wTrainerCardBadgeTileID:: db
wTrainerCardBadgeAttributes:: db
NEXTU
-; card flip data
+; slot machine
+wSlotsDelay:: db
+ ds 1
+wUnusedSlotReelIconDelay:: db
+
+NEXTU
+; card flip
wCardFlipCursorY:: db
wCardFlipCursorX:: db
wCardFlipWhichCard:: db
NEXTU
+; dummy game
+wDummyGameCardChoice:: db
+
+NEXTU
; magnet train
wMagnetTrainOffset:: db
wMagnetTrainPosition:: db
@@ -1423,6 +1429,16 @@ wUnownPuzzleCursorPosition:: db
wUnownPuzzleHeldPiece:: db
NEXTU
+; battle transitions
+wBattleTransitionCounter:: db
+wBattleTransitionSineWaveOffset::
+wBattleTransitionSpinQuadrant:: db
+
+NEXTU
+; bill's pc
+wUnusedBillsPCData:: ds 3
+
+NEXTU
; debug mon color picker
wDebugColorRGBJumptableIndex:: db
wDebugColorCurColor:: db
@@ -1435,21 +1451,34 @@ wDebugTilesetRGBJumptableIndex:: db
wDebugTilesetCurColor:: db
NEXTU
+; stats screen
+wStatsScreenFlags:: db
+
+NEXTU
; battle tower
- ds $2
+wNrOfBeatenBattleTowerTrainers:: db
+ ds 1
wBattleTowerRoomMenuJumptableIndex:: db
NEXTU
; miscellaneous
wFrameCounter::
-wNrOfBeatenBattleTowerTrainers::
wMomBankDigitCursorPosition::
wNamingScreenLetterCase::
wHallOfFameMonCounter::
-wSlotsDelay::
+wTradeDialog::
db
+wFrameCounter2::
wPrinterQueueLength::
+wUnusedSGB1eColorOffset::
db
+wUnusedTradeAnimPlayEvolutionMusic:: db
+
+NEXTU
+; mobile
+wcf64:: db
+wcf65:: db
+wcf66:: db
ENDU
wRequested2bppSize:: db
@@ -1553,18 +1582,18 @@ wFarCallBCBuffer:: dw
wcfbb:: db
-wGameTimerPause::
+wGameTimerPaused::
; bit 0: game timer paused
; bit 7: something mobile
db
ds 1
-wcfbe::
+wJoypadDisable::
; bits 4, 6, or 7 can be used to disable joypad input
; bit 4
-; bit 6: mon fainted?
-; bit 7: SGB flag?
+; bit 6: ongoing mon faint animation
+; bit 7: ongoing sgb data transfer
db
ds 1
@@ -1635,7 +1664,7 @@ SECTION "WRAM 1", WRAMX
wGBCOnlyDecompressBuffer:: ; a $540-byte buffer that continues past this SECTION
-wd000:: db
+wUnusedInitializedToZero:: db
wDefaultSpawnpoint:: db
@@ -1734,6 +1763,11 @@ wBankOfBoxToPrint:: db
wWhichBoxToPrint:: db
NEXTU
+; Unown printing
+wPrintedUnownTileSource:: ds 1 tiles
+wPrintedUnownTileDest:: ds 1 tiles
+
+NEXTU
; trainer HUD data
ds 1
wPlaceBallsDirection:: db
@@ -2017,7 +2051,8 @@ wMailboxItems:: ds MAILBOX_CAPACITY
ENDU
wListPointer:: dw
-wUnusedD102:: dw
+wUnusedNamesPointer:: dw
+
wItemAttributesPtr:: dw
wCurItem:: db