summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--constants/wram_constants.asm8
-rw-r--r--data/events/special_pointers.asm16
-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/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/sgb_layouts.asm10
-rw-r--r--engine/gfx/sprite_anims.asm4
-rw-r--r--engine/link/init_list.asm4
-rw-r--r--engine/link/link.asm18
-rw-r--r--engine/menus/intro_menu.asm4
-rw-r--r--engine/menus/main_menu.asm4
-rw-r--r--engine/movie/trade_animation.asm4
-rw-r--r--engine/overworld/events.asm2
-rw-r--r--engine/overworld/overworld.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/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--wram.asm71
33 files changed, 179 insertions, 145 deletions
diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm
index 9150cc21..9f93aa33 100644
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -21,8 +21,12 @@ AUTO_INPUT EQU $ff
const TEMPMON ; 3
const WILDMON ; 4
-; wGameTimerPause::
-GAMETIMERPAUSE_TIMER_PAUSED_F EQU 0
+; wGameTimerPaused::
+GAME_TIMER_PAUSED_F EQU 0
+
+; 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/special_pointers.asm b/data/events/special_pointers.asm
index c2a625fe..a25b6ab2 100644
--- a/data/events/special_pointers.asm
+++ b/data/events/special_pointers.asm
@@ -60,8 +60,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 FadeBlackQuickly
add_special FadeInPalettes
@@ -69,21 +69,21 @@ SpecialsPointers::
add_special ReloadSpritesNoPalettes, 2
add_special ClearBGPalettes
add_special UpdateTimePals
- add_special ClearTilemap
+ add_special ClearTilemap ; unused as special
add_special UpdateSprites
add_special UpdatePlayerSprite
add_special GameCornerPrizeMonCheckDex
- add_special UnusedSetSeenMon
+ add_special UnusedSetSeenMon ; unused
add_special WaitSFX, 3
add_special PlayMapMusic
add_special RestartMapMusic
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
@@ -127,4 +127,4 @@ SpecialsPointers::
add_special InitialSetDSTFlag
add_special InitialClearDSTFlag
add_special MrChrono
- add_special DummySpecial_c389
+ add_special UnusedDummySpecial ; unused
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index 611702b3..f5b4effe 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -208,7 +208,7 @@ StartTrainerBattle_NextScene:
StartTrainerBattle_SetUpBGMap:
call StartTrainerBattle_NextScene
xor a
- ld [wce64], a
+ ld [wBattleTransitionCounter], a
ldh [hBGMapMode], a
ret
@@ -222,7 +222,7 @@ StartTrainerBattle_Flash:
ld a, [wTimeOfDayPalset]
cp DARKNESS_PALSET
jr z, .done
- ld hl, wce64
+ ld hl, wBattleTransitionCounter
ld a, [hl]
inc [hl]
srl a
@@ -240,7 +240,7 @@ StartTrainerBattle_Flash:
.done
xor a
- ld [wce64], a
+ ld [wBattleTransitionCounter], a
scf
ret
@@ -271,12 +271,12 @@ StartTrainerBattle_SetUpForWavyOutro:
ld a, $90
ldh [hLYOverrideEnd], a
xor a
- ld [wce64], a
- ld [wce65], a
+ ld [wBattleTransitionCounter], a
+ ld [wBattleTransitionSineWaveOffset], a
ret
StartTrainerBattle_SineWave:
- ld a, [wce64]
+ ld a, [wBattleTransitionCounter]
cp $60
jr nc, .end
call .DoSineWave
@@ -288,10 +288,10 @@ StartTrainerBattle_SineWave:
ret
.DoSineWave:
- ld hl, wce65
+ ld hl, wBattleTransitionSineWaveOffset
ld a, [hl]
inc [hl]
- ld hl, wce64
+ ld hl, wBattleTransitionCounter
ld d, [hl]
add [hl]
ld [hl], a
@@ -319,13 +319,13 @@ StartTrainerBattle_SetUpForSpinOutro:
farcall RespawnPlayerAndOpponent
call StartTrainerBattle_NextScene
xor a
- ld [wce64], a
+ ld [wBattleTransitionCounter], a
ret
StartTrainerBattle_SpinToBlack:
xor a
ldh [hBGMapMode], a
- ld a, [wce64]
+ ld a, [wBattleTransitionCounter]
ld e, a
ld d, 0
ld hl, .spin_quadrants
@@ -335,13 +335,13 @@ endr
ld a, [hli]
cp -1
jr z, .end
- ld [wce65], a
+ ld [wBattleTransitionSpinQuadrant], a
call .load
ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
- ld hl, wce64
+ ld hl, wBattleTransitionCounter
inc [hl]
ret
@@ -411,7 +411,7 @@ ENDM
inc de
.loop1
ld [hl], BATTLETRANSITION_BLACK
- ld a, [wce65]
+ ld a, [wBattleTransitionSpinQuadrant]
bit RIGHT_QUADRANT_F, a
jr z, .leftside
inc hl
@@ -422,7 +422,7 @@ ENDM
dec c
jr nz, .loop1
pop hl
- ld a, [wce65]
+ ld a, [wBattleTransitionSpinQuadrant]
bit LOWER_QUADRANT_F, a
ld bc, SCREEN_WIDTH
jr z, .upper
@@ -437,7 +437,7 @@ ENDM
jr z, .loop
ld c, a
.loop2
- ld a, [wce65]
+ ld a, [wBattleTransitionSpinQuadrant]
bit RIGHT_QUADRANT_F, a
jr z, .leftside2
dec hl
@@ -459,13 +459,13 @@ StartTrainerBattle_SetUpForRandomScatterOutro:
farcall RespawnPlayerAndOpponent
call StartTrainerBattle_NextScene
ld a, $10
- ld [wce64], a
+ ld [wBattleTransitionCounter], a
ld a, 1
ldh [hBGMapMode], a
ret
StartTrainerBattle_SpeckleToBlack:
- ld hl, wce64
+ ld hl, wBattleTransitionCounter
ld a, [hl]
and a
jr z, .done
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 830a7a23..a006f376 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2817,10 +2817,11 @@ PlayerMonFaintedAnimation:
jp MonFaintedAnimation
MonFaintedAnimation:
- ld a, [wd8ba]
+ ld a, [wJoypadDisable]
push af
- set 6, a
- ld [wd8ba], a
+ set JOYPAD_DISABLE_MON_FAINT_F, a
+ ld [wJoypadDisable], a
+
ld b, 7
.OuterLoop:
@@ -2863,7 +2864,7 @@ MonFaintedAnimation:
jr nz, .OuterLoop
pop af
- ld [wd8ba], a
+ ld [wJoypadDisable], a
ret
.Spaces:
@@ -4403,7 +4404,7 @@ CheckDanger:
PrintPlayerHUD:
ld de, wBattleMonNick
hlcoord 10, 7
- call ret_3df99
+ call Battle_DummyFunction
call PlaceString
push bc
@@ -4489,7 +4490,7 @@ DrawEnemyHUD:
call GetBaseData
ld de, wEnemyMonNick
hlcoord 1, 0
- call ret_3df99
+ call Battle_DummyFunction
call PlaceString
ld h, b
ld l, c
@@ -4618,7 +4619,8 @@ UpdateHPPal:
ret z
jp FinishBattleAnim
-ret_3df99:
+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 324d6c57..2ebf4861 100644
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -913,13 +913,13 @@ DebugColor_FillBoxWithByte:
ret
DebugColor_PushSGBPals:
- ld a, [wd8ba]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wd8ba], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
call _DebugColor_PushSGBPals
pop af
- ld [wd8ba], a
+ ld [wJoypadDisable], a
ret
_DebugColor_PushSGBPals:
diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm
index 39c92b2e..8085084f 100644
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -421,7 +421,7 @@ FlyFunction_FrameTimer:
ret
.SpawnLeaf:
- ld hl, wce65
+ 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 d4e450c2..94773f2f 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, [wce64]
+ ; wTradeDialog aliases wFrameCounter, which TradeAnimation uses
+ ld a, [wTradeDialog]
push af
predef TradeAnimation
pop af
- ld [wce64], 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 [wce64], a
+ ld [wTradeDialog], a
ret
DoNPCTrade:
@@ -366,7 +367,7 @@ PrintTradeText:
rept 6
add hl, de
endr
- ld a, [wce64]
+ ld a, [wTradeDialog]
ld e, a
add hl, de
add hl, de
diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm
index 9c4d1d85..cc441e2d 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, wceed
+ 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, wcefd
+ 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, wcefd
+ ld hl, wPrintedUnownTileDest
ld e, %10000000
ld d, 8
.loop_decompress
push hl
- ld hl, wceed
+ ld hl, wPrintedUnownTileSource
call .CountSetBit
pop hl
ld a, b
diff --git a/engine/events/specials.asm b/engine/events/specials.asm
index 5c26daa7..0b3e3560 100644
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -15,7 +15,7 @@ Special::
INCLUDE "data/events/special_pointers.asm"
-DummySpecial_c389:
+UnusedDummySpecial:
ret
GameCornerPrizeMonCheckDex:
@@ -205,7 +205,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 8f03e66c..648346fc 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 [wce64], a
+ ld [wDummyGameCardChoice], a
ld hl, wJumptableIndex
inc [hl]
.PickCard1:
- ld a, [wce64]
+ ld a, [wDummyGameCardChoice]
and a
ret z
dec a
@@ -155,13 +155,13 @@ endr
call DummyGame_Card2Coord
call DummyGame_PlaceCard
xor a
- ld [wce64], a
+ ld [wDummyGameCardChoice], a
ld hl, wJumptableIndex
inc [hl]
ret
.PickCard2:
- ld a, [wce64]
+ 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 [wce64], a
+ ld [wDummyGameCardChoice], a
ret
.pressed_left
diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm
index 68a56bbc..47f1cc42 100644
--- a/engine/games/slot_machine.asm
+++ b/engine/games/slot_machine.asm
@@ -248,7 +248,7 @@ DebugPrintSlotBias: ; unreferenced
AnimateSlotReelIcons: ; unreferenced
; This animation was present in pokegold-spaceworld.
- ld hl, wce66
+ 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 70c4a29c..f30bd328 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
dw _CGB_Pokedex_5x5
_CGB_BattleGrayscale:
@@ -303,7 +303,7 @@ _CGB_BillsPC:
ldh [hCGBPalUpdate], a
ret
-Function95a0: ; unreferenced
+_CGB_Unknown: ; unreferenced
ld hl, BillsPCOrangePalette
call LoadHLPaletteIntoDE
jr .GotPalette
@@ -568,7 +568,7 @@ _CGB_GSTitleScreen:
ldh [hCGBPalUpdate], a
ret
-_CGB0d:
+_CGB_Unused0D:
ld hl, PalPacket_Diploma + 1
call CopyFourPalettes
call WipeAttrmap
@@ -831,7 +831,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 fd42d597..18ae76a8 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -144,6 +144,7 @@ SGB_ApplyPartyMenuHPPals:
Intro_LoadMagikarpPalettes:
call CheckCGB
ret z
+
; CGB only
ld hl, .BGPal
ld de, wBGPals1
@@ -715,13 +716,13 @@ endr
ret
PushSGBPals:
- ld a, [wd8ba]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wd8ba], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
call _PushSGBPals
pop af
- ld [wd8ba], a
+ ld [wJoypadDisable], a
ret
_PushSGBPals:
@@ -767,12 +768,14 @@ _PushSGBPals:
InitSGBBorder:
call CheckCGB
ret nz
+
; SGB/DMG only
di
- ld a, [wd8ba]
+ ld a, [wJoypadDisable]
push af
- set 7, a
- ld [wd8ba], a
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, a
+ ld [wJoypadDisable], a
+
xor a
ldh [rJOYP], a
ldh [hSGB], a
@@ -792,13 +795,14 @@ InitSGBBorder:
.skip
pop af
- ld [wd8ba], 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/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm
index 2ed648f6..1b2799bf 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
dw .SGB_Pokedex_5x5
.SGB_BattleGrayscale:
@@ -403,7 +403,7 @@ endr
ld de, BlkPacket_AllPal0
ret
-.SGB0d:
+.SGB_Unused0D:
.SGB_TrainerCard:
ld hl, PalPacket_Diploma
ld de, BlkPacket_AllPal0
@@ -443,7 +443,7 @@ endr
ld de, wSGBPals + PALPACKET_LENGTH
ret
-.SGB1e:
+.SGB_Unused1E:
ld hl, PalPacket_Pal01
ld de, wSGBPals
ld bc, PALPACKET_LENGTH
@@ -456,7 +456,7 @@ endr
add hl, hl
ld de, PokemonPalettes
add hl, de
- ld a, [wce65]
+ ld a, [wUnusedSGB1eColorOffset]
and 3
sla a
sla a
diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm
index 2a4cc868..93b69a3c 100644
--- a/engine/gfx/sprite_anims.asm
+++ b/engine/gfx/sprite_anims.asm
@@ -1066,7 +1066,7 @@ AnimSeq_SlotsGolem:
AnimSeq_SlotsChansey:
callfar Slots_AnimateChansey
- ld hl, wce64
+ ld hl, wSlotsDelay
ld a, [hl]
cp $2
ret nz
@@ -1091,7 +1091,7 @@ AnimSeq_SlotsChanseyEgg:
jr c, .move_right
call DeinitializeSprite
ld a, $4
- ld [wce64], a
+ ld [wSlotsDelay], a
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
ret
diff --git a/engine/link/init_list.asm b/engine/link/init_list.asm
index b85cf001..3e16d349 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 [wUnusedCFFE], a
+ ld [wUnusedNamesPointer], a
ld a, d
- ld [wUnusedCFFE + 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 ba2ae115..f80bb86e 100644
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -82,9 +82,9 @@ Gen2ToGen1LinkComms:
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
- ld hl, wLink_c508
+ ld hl, wc508
ld de, wTrademons
- ld bc, wTrademons - wLink_c508
+ ld bc, wTrademons - wc508
call Serial_ExchangeBytes
xor a
ldh [rIF], a
@@ -163,9 +163,9 @@ Gen2ToGen1LinkComms:
ld hl, wTimeCapsulePlayerData
call Link_ConvertPartyStruct1to2
ld a, LOW(wOTPartyMonOT)
- ld [wUnusedCFFE], a
+ ld [wUnusedNamesPointer], a
ld a, HIGH(wOTPartyMonOT)
- ld [wUnusedCFFE + 1], a
+ ld [wUnusedNamesPointer + 1], a
ld de, MUSIC_NONE
call PlayMusic
ldh a, [hSerialConnectionStatus]
@@ -226,9 +226,9 @@ Gen2ToGen2LinkComms:
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
- ld hl, wLink_c508
+ ld hl, wc508
ld de, wTrademons
- ld bc, wTrademons - wLink_c508
+ ld bc, wTrademons - wc508
call Serial_ExchangeBytes
ld a, [wLinkMode]
cp LINK_TRADECENTER
@@ -377,9 +377,9 @@ Gen2ToGen2LinkComms:
ld bc, wOTPartyDataEnd - wOTPartyMons
call CopyBytes
ld a, LOW(wOTPartyMonOT)
- ld [wUnusedCFFE], a
+ ld [wUnusedNamesPointer], a
ld a, HIGH(wOTPartyMonOT)
- ld [wUnusedCFFE + 1], a
+ ld [wUnusedNamesPointer + 1], a
ld de, MUSIC_NONE
call PlayMusic
ldh a, [hSerialConnectionStatus]
@@ -514,7 +514,7 @@ FixDataForLinkTransfer:
ld [hli], a
dec b
jr nz, .loop2
- ld hl, wLink_c508
+ ld hl, wc508
ld a, SERIAL_PREAMBLE_BYTE
ld [hli], a
ld [hli], a
diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm
index 2fe285b1..9b744f72 100644
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -344,8 +344,8 @@ FinishContinueFunction:
.loop
xor a
ld [wDontPlayMapMusicOnReload], a
- ld hl, wGameTimerPause
- set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ set GAME_TIMER_PAUSED_F, [hl]
farcall OverworldLoop
ld a, [wSpawnAfterChampion]
cp SPAWN_RED
diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm
index 22308a87..eb34cb26 100644
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -28,8 +28,8 @@ MainMenu:
call ClearTilemapEtc
ld b, SCGB_DIPLOMA
call GetSGBLayout
- 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 6877514a..f99e9e0c 100644
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -212,7 +212,7 @@ DoTradeAnimation:
jr nz, .finished
call .DoTradeAnimCommand
callfar PlaySpriteAnimations
- ld hl, wce65
+ ld hl, wFrameCounter2
inc [hl]
call DelayFrame
and a
@@ -1269,7 +1269,7 @@ LinkTradeAnim_LoadTradeMonSpecies:
ret
TradeAnim_FlashBGPals:
- ld a, [wce65]
+ ld a, [wFrameCounter2]
and $7
ret nz
ldh a, [rBGP]
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index fda0149e..ee2facbe 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -800,7 +800,7 @@ PlayerMovement:
CheckMenuOW:
xor a
ldh [hMenuReturn], a
- ldh [hUnusedFFA3], a
+ ldh [hUnusedByte], a
ldh a, [hJoyPressed]
bit SELECT_F, a
diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm
index 0d285d2a..40157524 100644
--- a/engine/overworld/overworld.asm
+++ b/engine/overworld/overworld.asm
@@ -119,7 +119,7 @@ AddOutdoorSprites:
dec c
jr nz, .loop
- ld a, [wUnusedD05A]
+ ld a, [wUnusedAddOutdoorSpritesReturnValue]
ld c, a
ret
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index a97f7621..105f53e2 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -432,11 +432,11 @@ Script_verbosegiveitem:
ld de, GiveItemScript
jp ScriptCall
-ret_96e71:
+GiveItemScript_DummyFunction:
ret
GiveItemScript:
- callasm ret_96e71
+ callasm GiveItemScript_DummyFunction
writetext .ReceivedItemText
iffalse .Full
waitsfx
@@ -2206,11 +2206,11 @@ Script_endall:
ret
Script_halloffame:
- ld hl, wGameTimerPause
- res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
+ ld hl, wGameTimerPaused
+ res GAME_TIMER_PAUSED_F, [hl]
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 90aa56c4..23840d1d 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 [wce66], a
+ ld [wUnusedPokedexByte], a
call Pokedex_CheckUnlockedUnownMode
diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm
index e75af0cd..6586774e 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 [wce66], a
+ ld [wUnusedPokegearByte], a
ld [wPokegearPhoneScrollPosition], a
ld [wPokegearPhoneCursorPosition], a
ld [wPokegearPhoneSelectedPerson], a
@@ -1989,7 +1989,7 @@ _FlyMap:
lb bc, BANK(FlyMapLabelBorderGFX), 6
call Request1bpp
call FlyMap
- call ret_91bfd
+ call Pokegear_DummyFunction
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
@@ -2194,7 +2194,7 @@ HasVisitedSpawn:
INCLUDE "data/maps/flypoints.asm"
-ret_91bfd:
+Pokegear_DummyFunction:
ret
FlyMap:
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm
index af266312..43d79586 100644
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -767,9 +767,9 @@ BillsPC_InitRAM:
call ByteFill
xor a
ld [wJumptableIndex], a
- ld [wce64], a
- ld [wce65], a
- ld [wce66], 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/printer/printer.asm b/engine/printer/printer.asm
index a6e0f956..5b17c52f 100644
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -443,9 +443,11 @@ CheckCancelPrint:
ret
.pressed_b
- ld a, [wc980]
+ 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 b0039952..33d7bcc1 100644
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -20,8 +20,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 461937e4..fc9cf6d3 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -5,8 +5,8 @@ Reset::
call ClearPalettes
ei
- ld hl, wd8ba
- set 7, [hl]
+ ld hl, wJoypadDisable
+ set JOYPAD_DISABLE_SGB_TRANSFER_F, [hl]
ld c, 32
call DelayFrames
@@ -43,7 +43,7 @@ Init::
ldh [rOBP1], a
ldh [rTMA], a
ldh [rTAC], a
- ld [wceeb], 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 66d5649e..effe8e89 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, [wd8ba]
- 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 e3da8793..58cc0fbb 100644
--- a/home/names.asm
+++ b/home/names.asm
@@ -56,9 +56,9 @@ GetName::
.done
ld a, e
- ld [wUnusedCFFE], a
+ ld [wUnusedNamesPointer], a
ld a, d
- ld [wUnusedCFFE + 1], a
+ ld [wUnusedNamesPointer + 1], a
pop de
pop bc
diff --git a/hram.asm b/hram.asm
index a26c4834..d1d5d0ae 100644
--- a/hram.asm
+++ b/hram.asm
@@ -27,7 +27,7 @@ hVBlank:: db
hMapEntryMethod:: db
hMenuReturn:: db
-hUnusedFFA3:: db
+hUnusedByte:: db
hJoypadReleased:: db
hJoypadPressed:: db
diff --git a/wram.asm b/wram.asm
index 0c45e405..612ada71 100644
--- a/wram.asm
+++ b/wram.asm
@@ -299,7 +299,7 @@ wHallOfFameTemp:: hall_of_fame wHallOfFameTemp
NEXTU
; link engine data
-wLink_c508:: ds 10
+wc508:: ds 10
wc512:: ds 10
NEXTU
@@ -467,7 +467,7 @@ NEXTU
wGameboyPrinterRAM::
wGameboyPrinter2bppSource:: ds 40 tiles
wGameboyPrinter2bppSourceEnd::
-wc980:: db
+wUnusedGameboyPrinterSafeCancelFlag:: db
wPrinterRowIndex:: db
; Printer data
@@ -1085,12 +1085,6 @@ wNamedObjectTypeBuffer:: db
wJumptableIndex:: db
UNION
-; unidentified
-wce64:: db
-wce65:: db
-wce66:: db
-
-NEXTU
; intro data
wIntroSceneFrameCounter:: db
wIntroSceneTimer:: db
@@ -1111,11 +1105,13 @@ NEXTU
wPrevDexEntryJumptableIndex:: db
wPrevDexEntryBackup::
wPokedexStatus:: db
+wUnusedPokedexByte:: db
NEXTU
; pokegear
wPokegearCard:: db
wPokegearMapRegion:: db
+wUnusedPokegearByte:: db
NEXTU
; pack
@@ -1130,12 +1126,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
@@ -1148,6 +1154,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
@@ -1165,9 +1181,12 @@ wFrameCounter::
wMomBankDigitCursorPosition::
wNamingScreenLetterCase::
wHallOfFameMonCounter::
-wSlotsDelay::
+wTradeDialog::
+ db
+wFrameCounter2::
+wPrinterQueueLength::
+wUnusedSGB1eColorOffset::
db
-wPrinterQueueLength:: db
ENDU
wRequested2bppSize:: db
@@ -1317,7 +1336,7 @@ wOverworldDelay:: db
wTextDelayFrames:: db
wVBlankOccurred:: db
-wceeb:: db
+wUnusedInitializedToZero:: db
wDefaultSpawnpoint:: db
@@ -1415,6 +1434,11 @@ wBankOfBoxToPrint:: db
wWhichBoxToPrint:: db
NEXTU
+; Unown printing
+wPrintedUnownTileSource:: ds 1 tiles
+wPrintedUnownTileDest:: ds 1 tiles
+
+NEXTU
; trainer HUD data
ds 1
wPlaceBallsDirection:: db
@@ -1469,11 +1493,7 @@ wceed:: db
wceee:: db
wceef:: db
- ds 13
-
-wcefd:: ds 1
-
- ds 43
+ ds 57
UNION
; trainer data
@@ -1706,7 +1726,7 @@ wMailboxItems:: ds MAILBOX_CAPACITY
ENDU
wListPointer:: dw
-wUnusedCFFE:: dw
+wUnusedNamesPointer:: dw
SECTION "WRAM 1", WRAMX
@@ -1774,7 +1794,7 @@ wPrevMapNumber:: db
ds 17
-wUnusedD05A:: db
+wUnusedAddOutdoorSpritesReturnValue:: db
wBGMapAnchor:: dw
@@ -1857,9 +1877,8 @@ wEvolutionPicOffset:: db
wEvolutionCanceled:: db
NEXTU
-
+; link
ds 9
-
wd0dc:: ds 1
NEXTU
@@ -2328,15 +2347,17 @@ wEventFlags:: flag_array NUM_EVENTS
wd8b7:: db
-wGameTimerPause:: db
+wGameTimerPaused::
+; bit 7: game timer paused
+ db
ds 1
-wd8ba::
+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