summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/ai/items.asm12
-rw-r--r--engine/battle/battle_transition.asm2
-rw-r--r--engine/battle/core.asm16
-rw-r--r--engine/battle/effect_commands.asm14
-rw-r--r--engine/battle/menu.asm6
-rw-r--r--engine/battle/move_effects/baton_pass.asm2
-rw-r--r--engine/battle_anims/anim_commands.asm4
-rw-r--r--engine/battle_anims/core.asm8
-rw-r--r--engine/battle_anims/functions.asm4
-rw-r--r--engine/debug/color_picker.asm4
-rw-r--r--engine/debug/debug_room.asm6
-rw-r--r--engine/events/battle_tower/battle_tower.asm6
-rw-r--r--engine/events/battle_tower/load_trainer.asm2
-rw-r--r--engine/events/buena.asm22
-rw-r--r--engine/events/celebi.asm5
-rw-r--r--engine/events/daycare.asm2
-rw-r--r--engine/events/engine_flags.asm2
-rw-r--r--engine/events/heal_machine_anim.asm4
-rw-r--r--engine/events/magnet_train.asm2
-rw-r--r--engine/events/overworld.asm4
-rw-r--r--engine/events/poisonstep.asm2
-rw-r--r--engine/events/print_unown_2.asm4
-rw-r--r--engine/events/specials.asm6
-rw-r--r--engine/events/treemons.asm2
-rw-r--r--engine/games/card_flip.asm3
-rw-r--r--engine/games/dummy_game.asm2
-rw-r--r--engine/gfx/cgb_layouts.asm2
-rw-r--r--engine/gfx/color.asm34
-rw-r--r--engine/gfx/player_gfx.asm6
-rw-r--r--engine/items/item_effects.asm23
-rw-r--r--engine/items/items.asm2
-rw-r--r--engine/items/pack.asm4
-rw-r--r--engine/items/tmhm.asm2
-rw-r--r--engine/link/link.asm12
-rw-r--r--engine/link/link_trade.asm2
-rw-r--r--engine/link/mystery_gift.asm2
-rw-r--r--engine/link/mystery_gift_2.asm16
-rw-r--r--engine/math/print_num.asm3
-rw-r--r--engine/menus/main_menu.asm9
-rw-r--r--engine/menus/menu_2.asm18
-rw-r--r--engine/menus/naming_screen.asm3
-rw-r--r--engine/movie/credits.asm2
-rw-r--r--engine/movie/unused_title.asm4
-rw-r--r--engine/overworld/decorations.asm4
-rw-r--r--engine/overworld/events.asm58
-rw-r--r--engine/overworld/map_objects.asm16
-rw-r--r--engine/overworld/scripting.asm3
-rw-r--r--engine/overworld/time.asm10
-rw-r--r--engine/phone/phone.asm4
-rw-r--r--engine/phone/scripts/elm.asm2
-rw-r--r--engine/phone/scripts/generic_callee.asm2
-rw-r--r--engine/phone/scripts/hangups_2.asm2
-rw-r--r--engine/pokedex/pokedex.asm3
-rw-r--r--engine/pokegear/pokegear.asm6
-rw-r--r--engine/pokegear/radio.asm5
-rw-r--r--engine/pokemon/bills_pc.asm18
-rw-r--r--engine/pokemon/breedmon_level_growth.asm4
-rw-r--r--engine/pokemon/mail.asm19
-rw-r--r--engine/pokemon/mail_2.asm14
-rw-r--r--engine/pokemon/party_menu.asm6
-rw-r--r--engine/printer/printer_serial.asm6
-rw-r--r--engine/smallflag.asm4
-rw-r--r--engine/tilesets/tileset_anims.asm4
63 files changed, 238 insertions, 242 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm
index 4de82d153..62adaca77 100644
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -20,8 +20,9 @@ AI_SwitchOrTryItem:
and a
jr nz, DontSwitch
+ ; always load the first trainer class in wTrainerClass for Battle Tower trainers
ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
- ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers
+ ld a, [wInBattleTowerBattle]
and a
jr nz, .ok
@@ -29,6 +30,7 @@ AI_SwitchOrTryItem:
dec a
ld bc, NUM_TRAINER_ATTRIBUTES
call AddNTimes
+
.ok
bit SWITCH_OFTEN_F, [hl]
jp nz, SwitchOften
@@ -145,13 +147,13 @@ SwitchSometimes:
ld [wEnemySwitchMonIndex], a
jp AI_TrySwitch
-CheckSubstatusCantRun:
+CheckSubstatusCantRun: ; unreferenced
ld a, [wEnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
ret
AI_TryItem:
- ; items are not allowed in the BattleTower
+ ; items are not allowed in the Battle Tower
ld a, [wInBattleTowerBattle]
and a
ret nz
@@ -213,7 +215,7 @@ AI_TryItem:
inc hl
jr c, .loop
-.used_item
+; used item
xor a
ld [de], a
inc a
@@ -259,7 +261,7 @@ AI_TryItem:
cp e
jr nc, .yes
-.no
+.no ; unreferenced
and a
ret
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index a1cdd239d..318556f7f 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -449,7 +449,7 @@ ENDM
spin_quadrant LOWER_LEFT, .wedge1, 1, 11
db -1
-.load
+.load:
ld a, [hli]
ld e, a
ld a, [hli]
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 85cba5f85..56b20b9cc 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1697,7 +1697,7 @@ HandleWeather:
cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
-.player_first
+; player first
call SetPlayerTurn
call .SandstormDamage
call SetEnemyTurn
@@ -2711,7 +2711,7 @@ AskUseNextPokemon:
ForcePlayerMonChoice:
call EmptyBattleTextbox
call LoadStandardMenuHeader
- call SetUpBattlePartyMenu_NoLoop
+ call SetUpBattlePartyMenu
call ForcePickPartyMonInBattle
ld a, [wLinkMode]
and a
@@ -2810,9 +2810,9 @@ IsMobileBattle:
cp LINK_MOBILE
ret
-SetUpBattlePartyMenu_NoLoop:
+SetUpBattlePartyMenu:
call ClearBGPalettes
-SetUpBattlePartyMenu: ; switch to fullscreen menu?
+SetUpBattlePartyMenu_Loop: ; switch to fullscreen menu?
farcall LoadPartyMenuGFX
farcall InitPartyMenuWithCancel
farcall InitPartyMenuBGPal7
@@ -3486,7 +3486,7 @@ OfferSwitch:
ld a, [wMenuCursorY]
dec a
jr nz, .said_no
- call SetUpBattlePartyMenu_NoLoop
+ call SetUpBattlePartyMenu
call PickSwitchMonInBattle
jr c, .canceled_switch
ld a, [wCurBattleMon]
@@ -5043,7 +5043,7 @@ BattleMenuPKMN_ReturnFromStats:
call LoadStandardMenuHeader
call ClearBGPalettes
BattleMenuPKMN_Loop:
- call SetUpBattlePartyMenu
+ call SetUpBattlePartyMenu_Loop
xor a
ld [wPartyMenuActionText], a
call JumpToPartyMenuAndPrintText
@@ -8952,13 +8952,13 @@ InitBattleDisplay:
ldh [rSVBK], a
ld hl, wDecompressScratch
- ld bc, wScratchAttrmap - wDecompressScratch
+ ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT
ld a, " "
call ByteFill
ld de, wDecompressScratch
hlbgcoord 0, 0
- lb bc, BANK(.BlankBGMap), $40
+ lb bc, BANK(@), (BG_MAP_WIDTH * BG_MAP_HEIGHT) / LEN_2BPP_TILE
call Request2bpp
pop af
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index 4d670b4b1..d3f9290fa 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -134,7 +134,7 @@ BattleCommand_CheckTurn:
and a
jp nz, CheckEnemyTurn
-CheckPlayerTurn:
+; check player turn
ld hl, wPlayerSubStatus4
bit SUBSTATUS_RECHARGE, [hl]
jr z, .no_recharge
@@ -2586,7 +2586,7 @@ PlayerAttackDamage:
cp SPECIAL
jr nc, .special
-.physical
+; physical
ld hl, wEnemyMonDefense
ld a, [hli]
ld b, a
@@ -2826,9 +2826,9 @@ EnemyAttackDamage:
ld a, [hl]
cp SPECIAL
- jr nc, .Special
+ jr nc, .special
-.physical
+; physical
ld hl, wBattleMonDefense
ld a, [hli]
ld b, a
@@ -2852,7 +2852,7 @@ EnemyAttackDamage:
ld hl, wEnemyAttack
jr .thickclub
-.Special:
+.special
ld hl, wBattleMonSpclDef
ld a, [hli]
ld b, a
@@ -6124,7 +6124,7 @@ INCLUDE "engine/battle/move_effects/conversion.asm"
BattleCommand_ResetStats:
; resetstats
- ld a, 7 ; neutral
+ ld a, BASE_STAT_LEVEL
ld hl, wPlayerStatLevels
call .Fill
ld hl, wEnemyStatLevels
@@ -6147,7 +6147,7 @@ BattleCommand_ResetStats:
jp StdBattleTextbox
.Fill:
- ld b, wPlayerStatLevelsEnd - wPlayerStatLevels
+ ld b, NUM_LEVEL_STATS
.next
ld [hli], a
dec b
diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm
index a4955ec6a..e29bff48b 100644
--- a/engine/battle/menu.asm
+++ b/engine/battle/menu.asm
@@ -9,8 +9,7 @@ LoadBattleMenu:
call ExitMenu
ret
-SafariBattleMenu:
-; untranslated
+SafariBattleMenu: ; unreferenced
ld hl, SafariBattleMenuHeader
call LoadMenuHeader
jr CommonBattleMenu
@@ -18,7 +17,8 @@ SafariBattleMenu:
ContestBattleMenu:
ld hl, ContestBattleMenuHeader
call LoadMenuHeader
-; fallthrough
+ ; fallthrough
+
CommonBattleMenu:
ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a
diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm
index 46baeb75f..bafe33866 100644
--- a/engine/battle/move_effects/baton_pass.asm
+++ b/engine/battle/move_effects/baton_pass.asm
@@ -17,7 +17,7 @@ BattleCommand_BatonPass:
; Transition into switchmon menu
call LoadStandardMenuHeader
- farcall SetUpBattlePartyMenu_NoLoop
+ farcall SetUpBattlePartyMenu
farcall ForcePickSwitchMonInBattle
diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm
index fd2457bb3..cd14b7c67 100644
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -1050,7 +1050,7 @@ GetMinimizePic:
and a
jr z, .player
- ld de, sScratch + $1a tiles
+ ld de, sScratch + (3 * 7 + 5) tiles
call CopyMinimizePic
ld hl, vTiles2 tile $00
ld de, sScratch
@@ -1058,7 +1058,7 @@ GetMinimizePic:
ret
.player
- ld de, sScratch + $160
+ ld de, sScratch + (3 * 6 + 4) tiles
call CopyMinimizePic
ld hl, vTiles2 tile $31
ld de, sScratch
diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm
index adba64e0d..d756a447a 100644
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -263,14 +263,12 @@ InitBattleAnimBuffer:
jr nz, .no_sub
ld a, [wFXAnimID]
cp KINESIS
- jr z, .kinesis
+ jr z, .do_sub
cp SOFTBOILED
- jr z, .softboiled
+ jr z, .do_sub
cp MILK_DRINK
jr nz, .no_sub
-.kinesis
-.softboiled
-.milk_drink
+.do_sub
pop af
sub 1 * 8
jr .done
diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm
index 271c39252..5a04a5b65 100644
--- a/engine/battle_anims/functions.asm
+++ b/engine/battle_anims/functions.asm
@@ -4299,14 +4299,14 @@ BattleAnim_Cosine_e:
ld e, a
ret
-BattleAnim_AbsSinePrecise:
+BattleAnim_AbsSinePrecise: ; unreferenced
ld a, e
call BattleAnim_Sine
ld e, l
ld d, h
ret
-BattleAnim_AbsCosinePrecise:
+BattleAnim_AbsCosinePrecise: ; unreferenced
ld a, e
call BattleAnim_Cosine
ld e, l
diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm
index ee9a9f6a6..c8545b734 100644
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -32,7 +32,7 @@
const DEBUGCOLORMAIN_INITTMHM ; 4
const DEBUGCOLORMAIN_TMHMJOYPAD ; 5
-DebugColorPicker:
+DebugColorPicker: ; unreferenced
; A debug menu to test monster and trainer palettes at runtime.
ldh a, [hCGB]
and a
@@ -1069,7 +1069,7 @@ INCBIN "gfx/debug/up_arrow.2bpp"
DebugColor_GFX:
INCBIN "gfx/debug/color_test.2bpp"
-TilesetColorPicker:
+TilesetColorPicker: ; unreferenced
; A debug menu to test tileset palettes at runtime.
; dummied out
ret
diff --git a/engine/debug/debug_room.asm b/engine/debug/debug_room.asm
index 95692c8d3..895de62d5 100644
--- a/engine/debug/debug_room.asm
+++ b/engine/debug/debug_room.asm
@@ -1328,9 +1328,9 @@ DebugRoom_BoxStructStrings:
.Move4: db "MOVE 4@"
.ID0: db "ID[0]@"
.ID1: db "ID[1]@"
-.BaseExp0: db "BASE EXP[0]@"
-.BaseExp1: db "BASE EXP[1]@"
-.BaseExp2: db "BASE EXP[2]@"
+.BaseExp0: db "BASE EXP[0]@" ; unreferenced
+.BaseExp1: db "BASE EXP[1]@" ; unreferenced
+.BaseExp2: db "BASE EXP[2]@" ; unreferenced
.HPExp0: db "HP EXP[0]@"
.HPExp1: db "HP EXP[1]@"
.AttkExp0: db "ATTK EXP[0]@"
diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm
index f335a83c9..0e59b4737 100644
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -67,7 +67,7 @@ Function170114:
call Function170c8b
ret
-Function170139:
+Function170139: ; unreferenced
; Convert the 4-digit decimal number at s5_aa41 into binary
ld a, BANK(s5_aa41)
call OpenSRAM
@@ -374,7 +374,7 @@ ReadBTTrainerParty:
ld [bc], a
ret
-ValidateBTParty:
+ValidateBTParty: ; unreferenced
; Check for and fix errors in party data
ld hl, wBT_OTTempMon1Species
ld d, BATTLETOWER_PARTY_LENGTH
@@ -386,7 +386,7 @@ ValidateBTParty:
ld a, [hl]
and a
x = $ff
-rept ($ff - NUM_POKEMON)
+rept $ff - NUM_POKEMON
jr z, .invalid
cp x
x = x - 1
diff --git a/engine/events/battle_tower/load_trainer.asm b/engine/events/battle_tower/load_trainer.asm
index 8ed401afe..165efb8dd 100644
--- a/engine/events/battle_tower/load_trainer.asm
+++ b/engine/events/battle_tower/load_trainer.asm
@@ -95,7 +95,7 @@ Function_LoadRandomBattleTowerMon:
ld c, BATTLETOWER_PARTY_LENGTH
.loop
push bc
- ld a, BANK(sBTMonPrevTrainer1)
+ ld a, BANK(sBTMonOfTrainers)
call OpenSRAM
.FindARandomBattleTowerMon:
diff --git a/engine/events/buena.asm b/engine/events/buena.asm
index 452f5d62a..dca125ece 100644
--- a/engine/events/buena.asm
+++ b/engine/events/buena.asm
@@ -85,7 +85,7 @@ BuenaPrize:
call Buena_PrizeMenu
jr z, .done
ld [wMenuSelectionQuantity], a
- call Buena_getprize
+ call Buena_GetPrize
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetItemName
@@ -95,7 +95,7 @@ BuenaPrize:
jr c, .loop
ld a, [wMenuSelectionQuantity]
- call Buena_getprize
+ call Buena_GetPrize
inc hl
ld a, [hld]
ld c, a
@@ -258,11 +258,11 @@ Buena_PrizeMenu:
db SCROLLINGMENU_DISPLAY_ARROWS ; flags
db 4, 13 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format
- dba .indices
- dba .prizeitem
- dba .prizepoints
+ dba .Prizes
+ dba .PrintPrizeItem
+ dba .PrintPrizePoints
-.indices:
+.Prizes:
db NUM_BUENA_PRIZES
x = 1
rept NUM_BUENA_PRIZES
@@ -271,9 +271,9 @@ x = x + 1
endr
db -1
-.prizeitem:
+.PrintPrizeItem:
ld a, [wMenuSelection]
- call Buena_getprize
+ call Buena_GetPrize
ld a, [hl]
push de
ld [wNamedObjectIndexBuffer], a
@@ -282,9 +282,9 @@ endr
call PlaceString
ret
-.prizepoints:
+.PrintPrizePoints:
ld a, [wMenuSelection]
- call Buena_getprize
+ call Buena_GetPrize
inc hl
ld a, [hl]
ld c, "0"
@@ -292,7 +292,7 @@ endr
ld [de], a
ret
-Buena_getprize:
+Buena_GetPrize:
dec a
ld hl, BuenaPrizeItems
ld b, 0
diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm
index 028f2e350..fe842819b 100644
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -1,6 +1,6 @@
SPECIALCELEBIEVENT_CELEBI EQU $84
-UnusedForestTreeFrames:
+UnusedForestTreeFrames: ; unreferenced
INCBIN "gfx/tilesets/forest-tree/1.2bpp"
INCBIN "gfx/tilesets/forest-tree/2.2bpp"
INCBIN "gfx/tilesets/forest-tree/3.2bpp"
@@ -99,8 +99,7 @@ CelebiEvent_CountDown:
set 7, [hl]
ret
-CelebiEvent_SpawnLeaf:
-; unused
+CelebiEvent_SpawnLeaf: ; unreferenced
ld hl, wcf65
ld a, [hl]
inc [hl]
diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm
index 1c08ca1b8..98de75212 100644
--- a/engine/events/daycare.asm
+++ b/engine/events/daycare.asm
@@ -166,7 +166,7 @@ DayCareAskDepositPokemon:
scf
ret
-.DaycareDummyText:
+.DaycareDummyText: ; unreferenced
text_far _DaycareDummyText
text_end
diff --git a/engine/events/engine_flags.asm b/engine/events/engine_flags.asm
index aebbacdc1..13f9a9a81 100644
--- a/engine/events/engine_flags.asm
+++ b/engine/events/engine_flags.asm
@@ -57,7 +57,7 @@ EngineFlagAction::
jr z, .set ; b = 1
; Return the given flag in c.
-.check
+; check
ld a, [de]
and c
ld c, a
diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm
index 38ccbf12c..166b42b67 100644
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -56,7 +56,7 @@ HealMachineAnim:
.Pointers:
; entries correspond to HEALMACHINE_* constants
dw .Pokecenter
- dw .ElmLab
+ dw .ElmsLab
dw .HallOfFame
healmachineanimseq: MACRO
@@ -68,7 +68,7 @@ ENDM
.Pokecenter:
healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
-.ElmLab:
+.ElmsLab:
healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
.HallOfFame:
healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH
diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm
index 14ccb02ba..43b1d716d 100644
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -69,7 +69,7 @@ MagnetTrain:
ld [wRequested2bppSource + 1], a
ld [wRequested2bppDest], a
ld [wRequested2bppDest + 1], a
- ld [wRequested2bpp], a
+ ld [wRequested2bppSize], a
call ClearTilemap
pop af
diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm
index 9c956e83b..7f613ceaf 100644
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -1414,7 +1414,7 @@ HasRockSmash:
ld d, ROCK_SMASH
call CheckPartyMove
jr nc, .yes
-.no
+; no
ld a, 1
jr .done
.yes
@@ -1616,7 +1616,7 @@ RodNothingText:
text_far _RodNothingText
text_end
-UnusedNothingHereText: ; unused
+UnusedNothingHereText: ; unreferenced
text_far _UnusedNothingHereText
text_end
diff --git a/engine/events/poisonstep.asm b/engine/events/poisonstep.asm
index e6de6f19f..827f69411 100644
--- a/engine/events/poisonstep.asm
+++ b/engine/events/poisonstep.asm
@@ -149,6 +149,6 @@ DoPoisonStep::
text_far _PoisonFaintText
text_end
-.PoisonWhiteoutText:
+.PoisonWhiteoutText: ; unreferenced
text_far _PoisonWhiteoutText
text_end
diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm
index 0badae200..7d83ff049 100644
--- a/engine/events/print_unown_2.asm
+++ b/engine/events/print_unown_2.asm
@@ -30,7 +30,7 @@ RotateUnownFrontpic:
cp 7 * 7
jr c, .loop
- ld hl, wGameboyPrinterRAM
+ ld hl, wGameboyPrinter2bppSource
ld de, sScratch
ld bc, 7 * 7 tiles
call CopyBytes
@@ -100,7 +100,7 @@ y = 0
rept \1
x = \1 * (\2 - 1) + y
rept \2
- dw wGameboyPrinterRAM tile x
+ dw wGameboyPrinter2bppSource tile x
x = x - \2
endr
y = y + 1
diff --git a/engine/events/specials.asm b/engine/events/specials.asm
index 28cf2dd13..1ce06de57 100644
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -380,17 +380,17 @@ GameboyCheck:
ldh a, [hCGB]
and a
jr nz, .cgb
-
ldh a, [hSGB]
and a
jr nz, .sgb
-
-.gb
+; gb
xor a ; GBCHECK_GB
jr .done
+
.sgb
ld a, GBCHECK_SGB
jr .done
+
.cgb
ld a, GBCHECK_CGB
.done
diff --git a/engine/events/treemons.asm b/engine/events/treemons.asm
index 680a9d7f5..9adcdbdc2 100644
--- a/engine/events/treemons.asm
+++ b/engine/events/treemons.asm
@@ -210,7 +210,7 @@ GetTreeScore:
cp 5
jr c, .good
-.bad
+; bad
xor a ; TREEMON_SCORE_BAD
ret
diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm
index 1244ca081..bee7aee11 100644
--- a/engine/games/card_flip.asm
+++ b/engine/games/card_flip.asm
@@ -1,7 +1,8 @@
CARDFLIP_LIGHT_OFF EQU "♂" ; $ef
CARDFLIP_LIGHT_ON EQU "♀" ; $f5
-CARDFLIP_DECK_SIZE EQU 4 * 6
+CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)"
+ assert wDiscardPileEnd - wDiscardPile == wDeckEnd - wDeck
DummyGameGFX:
; Graphics for an unused Game Corner
diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm
index e4bb2d060..445bbfc41 100644
--- a/engine/games/dummy_game.asm
+++ b/engine/games/dummy_game.asm
@@ -20,7 +20,7 @@ _DummyGame:
ld a, BANK(DummyGameGFX)
call FarCopyBytes
ld a, $8
- ld hl, wc300
+ ld hl, wSpriteAnimDict
ld [hli], a
ld [hl], $0
hlcoord 0, 0
diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm
index cd6f16cdb..ab4805dcf 100644
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -326,7 +326,7 @@ Function9009: ; unreferenced
call LoadHLPaletteIntoDE
jr .GotPalette
-.GetMonPalette:
+.GetMonPalette: ; unreferenced
ld bc, wTempMonDVs
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index 76c2dc504..d84bfdf3b 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -15,31 +15,31 @@ CheckShininess:
; Attack
ld a, [hl]
and 1 << SHINY_ATK_BIT
- jr z, .NotShiny
+ jr z, .not_shiny
; Defense
ld a, [hli]
and $f
cp SHINY_DEF_VAL
- jr nz, .NotShiny
+ jr nz, .not_shiny
; Speed
ld a, [hl]
and $f0
cp SHINY_SPD_VAL << 4
- jr nz, .NotShiny
+ jr nz, .not_shiny
; Special
ld a, [hl]
and $f
cp SHINY_SPC_VAL
- jr nz, .NotShiny
+ jr nz, .not_shiny
-.Shiny:
+; shiny
scf
ret
-.NotShiny:
+.not_shiny
and a
ret
@@ -49,30 +49,30 @@ Unused_CheckShininess:
; Attack
ld a, [hl]
cp 10 << 4
- jr c, .NotShiny
+ jr c, .not_shiny
; Defense
ld a, [hli]
and $f
cp 10
- jr c, .NotShiny
+ jr c, .not_shiny
; Speed
ld a, [hl]
cp 10 << 4
- jr c, .NotShiny
+ jr c, .not_shiny
; Special
ld a, [hl]
and $f
cp 10
- jr c, .NotShiny
+ jr c, .not_shiny
-.Shiny:
+; shiny
scf
ret
-.NotShiny:
+.not_shiny
and a
ret
@@ -977,7 +977,7 @@ PushSGBBorder:
.LoadSGBBorderPointers:
ld hl, SGBBorderGFX
- ld de, SGBBorderMap
+ ld de, SGBBorderMapAndPalettes
ret
SGB_ClearVRAM:
@@ -1174,12 +1174,10 @@ INCLUDE "data/sgb_ctrl_packets.asm"
PredefPals:
INCLUDE "gfx/sgb/predef.pal"
-SGBBorderMap:
+SGBBorderMapAndPalettes:
; interleaved tile ids and palette ids, without the center 20x18 screen area
INCBIN "gfx/sgb/sgb_border.sgb.tilemap"
-
-SGBBorderPalettes:
-; assumed to come after SGBBorderMap
+; four SGB palettes of 16 colors each; only the first 4 colors are used
INCLUDE "gfx/sgb/sgb_border.pal"
SGBBorderGFX:
@@ -1317,7 +1315,7 @@ INCLUDE "gfx/diploma/diploma.pal"
PartyMenuOBPals:
INCLUDE "gfx/stats/party_menu_ob.pal"
-UnusedBattleObjectPals:
+UnusedBattleObjectPals: ; unreferenced
INCLUDE "gfx/battle_anims/unused_battle_anims.pal"
UnusedGSTitleBGPals:
diff --git a/engine/gfx/player_gfx.asm b/engine/gfx/player_gfx.asm
index 9a395e048..149c0ef4a 100644
--- a/engine/gfx/player_gfx.asm
+++ b/engine/gfx/player_gfx.asm
@@ -113,10 +113,10 @@ GetCardPic:
ld bc, $23 tiles
ld a, BANK(ChrisCardPic) ; aka BANK(KrisCardPic)
call FarCopyBytes
- ld hl, CardGFX
+ ld hl, TrainerCardGFX
ld de, vTiles2 tile $23
ld bc, 6 tiles
- ld a, BANK(CardGFX)
+ ld a, BANK(TrainerCardGFX)
call FarCopyBytes
ret
@@ -126,7 +126,7 @@ INCBIN "gfx/trainer_card/chris_card.2bpp"
KrisCardPic:
INCBIN "gfx/trainer_card/kris_card.2bpp"
-CardGFX:
+TrainerCardGFX:
INCBIN "gfx/trainer_card/trainer_card.2bpp"
GetPlayerBackpic:
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index bc185500e..24bc22add 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -1062,14 +1062,13 @@ LevelBallMultiplier:
ld b, $ff
ret
-; These two texts were carried over from gen 1.
-; They are not used in gen 2, and are dummied out.
+; BallDodgedText and BallMissedText were used in Gen 1.
-BallDodgedText:
+BallDodgedText: ; unreferenced
text_far _BallDodgedText
text_end
-BallMissedText:
+BallMissedText: ; unreferenced
text_far _BallMissedText
text_end
@@ -1896,14 +1895,14 @@ LoadCurHPIntoBuffer5:
ld [wBuffer5], a
ret
-LoadHPIntoBuffer5:
+LoadHPIntoBuffer5: ; unreferenced
ld a, d
ld [wBuffer6], a
ld a, e
ld [wBuffer5], a
ret
-LoadHPFromBuffer5:
+LoadHPFromBuffer5: ; unreferenced
ld a, [wBuffer6]
ld d, a
ld a, [wBuffer5]
@@ -2353,7 +2352,6 @@ RestorePPEffect:
jr c, .do_ppup
.CantUsePPUpOnSketch:
-.pp_is_maxed_out
ld hl, PPIsMaxedOutText
call PrintText
jr .loop2
@@ -2650,16 +2648,17 @@ WontHaveAnyEffectMessage:
ld hl, ItemWontHaveEffectText
jr CantUseItemMessage
-BelongsToSomeoneElseMessage:
+BelongsToSomeoneElseMessage: ; unreferenced
ld hl, ItemBelongsToSomeoneElseText
jr CantUseItemMessage
-CyclingIsntAllowedMessage:
+CyclingIsntAllowedMessage: ; unreferenced
ld hl, NoCyclingText
jr CantUseItemMessage
-CantGetOnYourBikeMessage:
+CantGetOnYourBikeMessage: ; unreferenced
ld hl, ItemCantGetOnText
+ ; fallthrough
CantUseItemMessage:
; Item couldn't be used.
@@ -2711,11 +2710,11 @@ ItemUsedText:
text_far _ItemUsedText
text_end
-ItemGotOnText:
+ItemGotOnText: ; unreferenced
text_far _ItemGotOnText
text_end
-ItemGotOffText:
+ItemGotOffText: ; unreferenced
text_far _ItemGotOffText
text_end
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 78b0e2cd9..42381b411 100644
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -481,7 +481,7 @@ GetNumberedTMHM:
jr c, .done
cp ITEM_DC - (TM01 - 1) - 1
jr c, .skip_one
-.skip_two
+; skip two
inc a
.skip_one
inc a
diff --git a/engine/items/pack.asm b/engine/items/pack.asm
index 4f8e7617f..17662cf60 100644
--- a/engine/items/pack.asm
+++ b/engine/items/pack.asm
@@ -1531,7 +1531,7 @@ PC_Mart_BallsPocketMenuHeader:
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-PackNoItemText:
+PackNoItemText: ; unreferenced
text_far _PackNoItemText
text_end
@@ -1571,7 +1571,7 @@ PackEmptyText:
text_far _PackEmptyText
text_end
-YouCantUseItInABattleText:
+YouCantUseItInABattleText: ; unreferenced
text_far _YouCantUseItInABattleText
text_end
diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm
index fd8293603..ea990d849 100644
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -159,7 +159,7 @@ TeachTMHM:
and a
ret
-.unused
+.didnt_use ; unreferenced
ld a, 2
ld [wItemEffectSucceeded], a
.learned_move
diff --git a/engine/link/link.asm b/engine/link/link.asm
index 3d6d5cf24..b6ceb5245 100644
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -107,8 +107,8 @@ Gen2ToGen1LinkComms:
ld de, wLinkData
ld bc, $1a2
call Link_CopyOTData
- ld de, wPlayerTrademonSpecies
- ld hl, wTimeCapsulePartyMon1Species
+ ld de, wPlayerTrademon
+ ld hl, wTimeCapsulePlayerData
ld c, 2
.loop
ld a, [de]
@@ -162,7 +162,7 @@ Gen2ToGen1LinkComms:
.done_party
ld [de], a
- ld hl, wTimeCapsulePartyMon1Species
+ ld hl, wTimeCapsulePlayerData
call Function2868a
ld a, LOW(wOTPartyMonOT)
ld [wUnusedD102], a
@@ -253,8 +253,8 @@ Gen2ToGen2LinkComms:
ld de, wLinkData
ld bc, $1b9
call Link_CopyOTData
- ld de, wPlayerTrademonSpecies
- ld hl, wLinkPlayerPartyMon1Species
+ ld de, wPlayerTrademon
+ ld hl, wLinkPlayerData
ld c, 2
.loop1
ld a, [de]
@@ -584,7 +584,7 @@ FixDataForLinkTransfer:
ld [hli], a
dec b
jr nz, .loop3
- ld hl, wTimeCapsulePartyMon1 - 1 + PARTY_LENGTH
+ ld hl, wTimeCapsulePlayerData - 1 + PARTY_LENGTH
ld de, wc612
lb bc, 0, 0
.loop4
diff --git a/engine/link/link_trade.asm b/engine/link/link_trade.asm
index 3bec9c27c..add057241 100644
--- a/engine/link/link_trade.asm
+++ b/engine/link/link_trade.asm
@@ -15,7 +15,7 @@ Function16d42e:
call CopyBytes
ret
-Function16d43b:
+Function16d43b: ; unreferenced
call LoadStandardMenuHeader
call ClearBGPalettes
call ClearTilemap
diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm
index e28167f14..cc73d2761 100644
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -1148,7 +1148,7 @@ MysteryGift_CopyReceivedDecosToPC:
.skip
inc c
ld a, c
- cp TrophyIDs - DecorationIDs
+ cp NUM_NON_TROPHY_DECOS
jr c, .loop
jp CloseSRAM
diff --git a/engine/link/mystery_gift_2.asm b/engine/link/mystery_gift_2.asm
index f6e9fa320..36472118c 100644
--- a/engine/link/mystery_gift_2.asm
+++ b/engine/link/mystery_gift_2.asm
@@ -2,23 +2,23 @@ PrepMysteryGiftDataToSend:
ld de, wMysteryGiftStaging
ld a, $1 + GS_VERSION
ld [de], a
- inc de ; wc801
+ inc de ; wMysteryGiftStaging+1
ld a, BANK(sGameData)
call OpenSRAM
ld hl, sPlayerData + wPlayerID - wPlayerData
ld a, [hli]
ld [de], a
ld b, a
- inc de ; wc802
+ inc de ; wMysteryGiftStaging+2
ld a, [hl]
ld [de], a
ld c, a
- inc de ; wc803
+ inc de ; wMysteryGiftStaging+3
push bc
ld hl, sPlayerData + wPlayerName - wPlayerData
ld bc, NAME_LENGTH
call CopyBytes
- push de ; wc80e
+ push de ; wMysteryGiftStaging+14
ld hl, sPokemonData + wPokedexCaught - wPokemonData
ld b, wEndPokedexCaught - wPokedexCaught
call CountSetBits
@@ -26,21 +26,21 @@ PrepMysteryGiftDataToSend:
pop bc
ld a, [wNumSetBits]
ld [de], a
- inc de ; wc80f
+ inc de ; wMysteryGiftStaging+15
call CloseSRAM
call Random
and 1
ld [de], a
- inc de ; wc810
+ inc de ; wMysteryGiftStaging+16
call .RandomSample
ld [de], a
- inc de ; wc811
+ inc de ; wMysteryGiftStaging+17
ld a, c
ld c, b
ld b, a
call .RandomSample
ld [de], a
- inc de ; wc812
+ inc de ; wMysteryGiftStaging+18
ld a, BANK(sBackupMysteryGiftItem)
call OpenSRAM
ld a, [sBackupMysteryGiftItem]
diff --git a/engine/math/print_num.asm b/engine/math/print_num.asm
index 409379257..09a10128b 100644
--- a/engine/math/print_num.asm
+++ b/engine/math/print_num.asm
@@ -35,7 +35,6 @@ _PrintNum::
cp 2
jr z, .word
; maximum 3 bytes
-.long
ld a, [de]
ldh [hPrintNumBuffer + 1], a
inc de
@@ -81,7 +80,7 @@ _PrintNum::
cp 6
jr z, .six
-.seven
+; seven
ld a, HIGH(1000000 >> 8)
ldh [hPrintNumBuffer + 4], a
ld a, HIGH(1000000) ; mid
diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm
index fcbd7d430..5d441dc9d 100644
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -316,20 +316,19 @@ MainMenu_PrintCurrentTimeAndDay:
call PrintNum
ret
-.min
-; unused
+.minString: ; unreferenced
db "min.@"
.PrintTimeNotSet:
hlcoord 1, 14
- ld de, .TimeNotSet
+ ld de, .TimeNotSetString
call PlaceString
ret
-.TimeNotSet:
+.TimeNotSetString:
db "TIME NOT SET@"
-.MainMenuTimeUnknownText:
+.MainMenuTimeUnknownText: ; unreferenced
text_far _MainMenuTimeUnknownText
text_end
diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm
index 64a58a18d..08666bfab 100644
--- a/engine/menus/menu_2.asm
+++ b/engine/menus/menu_2.asm
@@ -156,18 +156,18 @@ StartMenu_PrintBugContestStatus:
set NO_TEXT_SCROLL, [hl]
call StartMenu_DrawBugContestStatusBox
hlcoord 1, 5
- ld de, .Balls_EN
+ ld de, .BallsString
call PlaceString
hlcoord 8, 5
ld de, wParkBallsRemaining
lb bc, PRINTNUM_LEFTALIGN | 1, 2
call PrintNum
hlcoord 1, 1
- ld de, .CAUGHT
+ ld de, .CaughtString
call PlaceString
ld a, [wContestMon]
and a
- ld de, .None
+ ld de, .NoneString
jr z, .no_contest_mon
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
@@ -179,7 +179,7 @@ StartMenu_PrintBugContestStatus:
and a
jr z, .skip_level
hlcoord 1, 3
- ld de, .LEVEL
+ ld de, .LevelString
call PlaceString
ld a, [wContestMonLevel]
ld h, b
@@ -193,15 +193,15 @@ StartMenu_PrintBugContestStatus:
ld [wOptions], a
ret
-.Balls_JP:
+.BallsJPString: ; unreferenced
db "ボール   こ@"
-.CAUGHT:
+.CaughtString:
db "CAUGHT@"
-.Balls_EN:
+.BallsString:
db "BALLS:@"
-.None:
+.NoneString:
db "None@"
-.LEVEL:
+.LevelString:
db "LEVEL@"
FindApricornsInBag:
diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm
index f95845b51..da15dc83c 100644
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -275,6 +275,7 @@ NamingScreen_InitText:
NamingScreen_ApplyTextInputMode:
call NamingScreen_IsTargetBox
jr nz, .not_box
+ assert BoxNameInputLower - NameInputLower == BoxNameInputUpper - NameInputUpper
ld hl, BoxNameInputLower - NameInputLower
add hl, de
ld d, h
@@ -880,7 +881,7 @@ INCBIN "gfx/naming_screen/cursor.2bpp"
INCLUDE "data/text/name_input_chars.asm"
-NamingScreenGFX_End: ; unused
+NamingScreenGFX_End: ; unreferenced
INCBIN "gfx/naming_screen/end.1bpp"
NamingScreenGFX_MiddleLine:
diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm
index 701b8c57d..6cdbef709 100644
--- a/engine/movie/credits.asm
+++ b/engine/movie/credits.asm
@@ -199,7 +199,7 @@ Credits_RequestGFX:
xor a
ldh [hBGMapMode], a
ld a, 8
- ld [wRequested2bpp], a
+ ld [wRequested2bppSize], a
jp Credits_Next
Credits_LYOverride:
diff --git a/engine/movie/unused_title.asm b/engine/movie/unused_title.asm
index 615d92d36..4b8845f6f 100644
--- a/engine/movie/unused_title.asm
+++ b/engine/movie/unused_title.asm
@@ -1,4 +1,4 @@
-UnusedTitleScreen:
+UnusedTitleScreen: ; unreferenced
call ClearBGPalettes
call ClearTilemap
call DisableLCD
@@ -154,7 +154,7 @@ UnusedTitleFG_OAM:
dbsprite 13, 11, 0, 0, $4c, 1
dbsprite 14, 11, 0, 0, $4e, 1
-Function10ed51:
+Function10ed51: ; unreferenced
call _TitleScreen
.loop
call JoyTextDelay
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm
index 6c56330ed..3499cf54f 100644
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -549,7 +549,7 @@ GetDecoName:
ld a, e
jr .getpokename
-.unused
+.unused ; unreferenced
push de
call .getdeconame
pop de
@@ -939,7 +939,7 @@ GetDecorationID:
pop hl
ret
-SetAllDecorationFlags:
+SetAllDecorationFlags: ; unreferenced
ld hl, DecorationIDs
.loop
ld a, [hli]
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index 218b7efc0..5213468bb 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -25,76 +25,76 @@ OverworldLoop::
DisableEvents:
xor a
- ld [wScriptFlags3], a
+ ld [wScriptFlags2], a
ret
EnableEvents::
ld a, $ff
- ld [wScriptFlags3], a
+ ld [wScriptFlags2], a
ret
-CheckBit5_ScriptFlags3:
- ld hl, wScriptFlags3
+CheckBit5_ScriptFlags2:
+ ld hl, wScriptFlags2
bit 5, [hl]
ret
-DisableWarpsConnxns:
- ld hl, wScriptFlags3
+DisableWarpsConnxns: ; unreferenced
+ ld hl, wScriptFlags2
res 2, [hl]
ret
-DisableCoordEvents:
- ld hl, wScriptFlags3
+DisableCoordEvents: ; unreferenced
+ ld hl, wScriptFlags2
res 1, [hl]
ret
-DisableStepCount:
- ld hl, wScriptFlags3
+DisableStepCount: ; unreferenced
+ ld hl, wScriptFlags2
res 0, [hl]
ret
-DisableWildEncounters:
- ld hl, wScriptFlags3
+DisableWildEncounters: ; unreferenced
+ ld hl, wScriptFlags2
res 4, [hl]
ret
-EnableWarpsConnxns:
- ld hl, wScriptFlags3
+EnableWarpsConnxns: ; unreferenced
+ ld hl, wScriptFlags2
set 2, [hl]
ret
-EnableCoordEvents:
- ld hl, wScriptFlags3
+EnableCoordEvents: ; unreferenced
+ ld hl, wScriptFlags2
set 1, [hl]
ret
-EnableStepCount:
- ld hl, wScriptFlags3
+EnableStepCount: ; unreferenced
+ ld hl, wScriptFlags2
set 0, [hl]
ret
EnableWildEncounters:
- ld hl, wScriptFlags3
+ ld hl, wScriptFlags2
set 4, [hl]
ret
CheckWarpConnxnScriptFlag:
- ld hl, wScriptFlags3
+ ld hl, wScriptFlags2
bit 2, [hl]
ret
CheckCoordEventScriptFlag:
- ld hl, wScriptFlags3
+ ld hl, wScriptFlags2
bit 1, [hl]
ret
CheckStepCountScriptFlag:
- ld hl, wScriptFlags3
+ ld hl, wScriptFlags2
bit 0, [hl]
ret
CheckWildEncountersScriptFlag:
- ld hl, wScriptFlags3
+ ld hl, wScriptFlags2
bit 4, [hl]
ret
@@ -135,7 +135,7 @@ EnterMap:
ld [wMapStatus], a
ret
-UnusedWait30Frames:
+UnusedWait30Frames: ; unreferenced
ld c, 30
call DelayFrames
ret
@@ -248,7 +248,7 @@ PlayerEvents:
and a
ret nz
- call Dummy_CheckScriptFlags3Bit5 ; This is a waste of time
+ call Dummy_CheckScriptFlags2Bit5 ; This is a waste of time
call CheckTrainerBattle_GetPlayerEvent
jr c, .ok
@@ -395,8 +395,8 @@ SetMinTwoStepWildEncounterCooldown:
ld [wWildEncounterCooldown], a
ret
-Dummy_CheckScriptFlags3Bit5:
- call CheckBit5_ScriptFlags3
+Dummy_CheckScriptFlags2Bit5:
+ call CheckBit5_ScriptFlags2
ret z
call SetXYCompareFlags
ret
@@ -480,8 +480,8 @@ CheckTimeEvents:
scf
ret
-.unused
- ld a, 8
+.unused ; unreferenced
+ ld a, $8 ; ???
scf
ret
diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm
index 59b8abf84..f6157ce83 100644
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -2894,20 +2894,20 @@ InitSprites:
ldh [hCurSpriteTile], a
xor a
bit 7, [hl]
- jr nz, .skip1
+ jr nz, .not_vram1
or VRAM_BANK_1
-.skip1
+.not_vram1
ld hl, OBJECT_FLAGS2
add hl, bc
ld e, [hl]
bit OBJ_FLAGS2_7, e
- jr z, .skip2
+ jr z, .not_priority
or PRIORITY
-.skip2
+.not_priority
bit USE_OBP1_F, e
- jr z, .skip3
+ jr z, .not_obp_num
or OBP_NUM
-.skip3
+.not_obp_num
ld hl, OBJECT_PALETTE
add hl, bc
ld d, a
@@ -2917,9 +2917,9 @@ InitSprites:
ld d, a
xor a
bit OVERHEAD_F, e
- jr z, .skip4
+ jr z, .not_overhead
or PRIORITY
-.skip4
+.not_overhead
ldh [hCurSpriteOAMFlags], a
ld hl, OBJECT_SPRITE_X
add hl, bc
diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm
index 7e86795fc..457b75a5d 100644
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -2173,8 +2173,7 @@ Script_warpcheck:
farcall EnableEvents
ret
-Script_enableevents:
-; unused
+Script_enableevents: ; unreferenced
farcall EnableEvents
ret
diff --git a/engine/overworld/time.asm b/engine/overworld/time.asm
index 86807119d..52e744d90 100644
--- a/engine/overworld/time.asm
+++ b/engine/overworld/time.asm
@@ -203,7 +203,7 @@ CheckPokerusTick::
xor a
ret
-SetUnusedTwoDayTimer:
+SetUnusedTwoDayTimer: ; unreferenced
ld a, 2
ld hl, wUnusedTwoDayTimer
ld [hl], a
@@ -308,7 +308,7 @@ UpdateTimeRemaining:
scf
ret
-GetSecondsSinceIfLessThan60:
+GetSecondsSinceIfLessThan60: ; unreferenced
ld a, [wDaysSince]
and a
jr nz, GetTimeElapsed_ExceedsUnitLimit
@@ -330,7 +330,7 @@ GetMinutesSinceIfLessThan60:
ld a, [wMinutesSince]
ret
-GetHoursSinceIfLessThan24:
+GetHoursSinceIfLessThan24: ; unreferenced
ld a, [wDaysSince]
and a
jr nz, GetTimeElapsed_ExceedsUnitLimit
@@ -349,7 +349,7 @@ CalcDaysSince:
xor a
jr _CalcDaysSince
-CalcHoursDaysSince:
+CalcHoursDaysSince: ; unreferenced
inc hl
xor a
jr _CalcHoursDaysSince
@@ -423,7 +423,7 @@ CopyDayToHL:
ld [hl], a
ret
-CopyDayHourToHL:
+CopyDayHourToHL: ; unreferenced
ld a, [wCurDay]
ld [hli], a
ldh a, [hHours]
diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm
index 18533678c..5b808cf67 100644
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -437,7 +437,7 @@ Script_SpecialBillCall::
ld e, PHONE_BILL
jp LoadCallerScript
-LoadElmCallScript:
+Script_SpecialElmCall: ; unreferenced
callasm .LoadElmScript
pause 30
sjump Script_ReceivePhoneCall
@@ -720,7 +720,7 @@ PhoneJustTalkToThemText:
text_far _PhoneJustTalkToThemText
text_end
-PhoneThankYouTextScript:
+PhoneThankYouTextScript: ; unreferenced
writetext PhoneThankYouText
end
diff --git a/engine/phone/scripts/elm.asm b/engine/phone/scripts/elm.asm
index 4760d8505..b8341541d 100644
--- a/engine/phone/scripts/elm.asm
+++ b/engine/phone/scripts/elm.asm
@@ -95,7 +95,7 @@ ElmPhoneCallerScript:
specialphonecall SPECIALCALL_NONE
end
-.unused
+.neat ; unreferenced
farwritetext ElmPhoneGotAholdOfSomethingNeatText
specialphonecall SPECIALCALL_NONE
end
diff --git a/engine/phone/scripts/generic_callee.asm b/engine/phone/scripts/generic_callee.asm
index f8a5f7394..51bcd4947 100644
--- a/engine/phone/scripts/generic_callee.asm
+++ b/engine/phone/scripts/generic_callee.asm
@@ -1103,7 +1103,7 @@ PhoneScript_Generic_Male:
promptbutton
end
-.Unknown:
+.Unknown: ; unreferenced
farwritetext UnknownGenericText
promptbutton
end
diff --git a/engine/phone/scripts/hangups_2.asm b/engine/phone/scripts/hangups_2.asm
index aad10df21..197845fa8 100644
--- a/engine/phone/scripts/hangups_2.asm
+++ b/engine/phone/scripts/hangups_2.asm
@@ -3,7 +3,7 @@ BeverlyComePickUpScript:
promptbutton
sjump PhoneScript_HangUpText_Female
-JoseComePickUpScript:
+JoseComePickUpScript: ; unreferenced
farwritetext JoseComePickUpText
promptbutton
sjump PhoneScript_HangUpText_Male
diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm
index 245cbf11f..e8972ece4 100644
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -1166,7 +1166,7 @@ Pokedex_DrawDexEntryScreenBG:
call Pokedex_PlaceFrontpicTopLeftCorner
ret
-.Unused:
+.Number: ; unreferenced
db $5c, $5d, -1 ; No.
.Height:
db "HT ?", $5e, "??", $5f, -1 ; HT ?'??"
@@ -2480,6 +2480,7 @@ Pokedex_LoadUnownFont:
ld a, BANK(sScratch)
call OpenSRAM
ld hl, UnownFont
+ ; sScratch + $188 was the address of sDecompressBuffer in pokegold
ld de, sScratch + $188
ld bc, 39 tiles
ld a, BANK(UnownFont)
diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm
index 02fb65fea..5dae16865 100644
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -1546,7 +1546,7 @@ RadioChannels:
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
-.kanto
+; kanto
and a
ret
@@ -2265,7 +2265,7 @@ FlyMap:
; The first 46 locations are part of Johto. The rest are in Kanto.
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
-.JohtoFlyMap:
+; Johto fly map
; Note that .NoKanto should be modified in tandem with this branch
push af
ld a, JOHTO_FLYPOINT ; first Johto flypoint
@@ -2569,7 +2569,7 @@ Pokedex_GetArea:
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
-.kanto
+; kanto
ld a, [wTownMapCursorLandmark]
and a
jr z, .clear
diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm
index 803a7b036..985657198 100644
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -141,7 +141,7 @@ PrintRadioLine:
ld [wRadioTextDelay], a
ret
-ReplacePeriodsWithSpaces:
+ReplacePeriodsWithSpaces: ; unreferenced
push hl
ld b, SCREEN_WIDTH * 2
.loop
@@ -149,7 +149,6 @@ ReplacePeriodsWithSpaces:
cp "."
jr nz, .next
ld [hl], " "
-
.next
inc hl
dec b
@@ -1779,7 +1778,7 @@ CopyRadioTextToRAM:
cp TX_FAR
jp z, FarCopyRadioText
ld de, wRadioText
- ld bc, SCREEN_WIDTH * 2
+ ld bc, 2 * SCREEN_WIDTH
jp CopyBytes
StartRadioStation:
diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm
index ed7856957..8230ec7f3 100644
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -101,7 +101,7 @@ _DepositPKMN:
ld [wJumptableIndex], a
ret
-.go_back
+.go_back ; unreferenced
ld hl, wJumptableIndex
dec [hl]
ret
@@ -358,7 +358,7 @@ _WithdrawPKMN:
ld [wJumptableIndex], a
ret
-.unused
+.go_back ; unreferenced
ld hl, wJumptableIndex
dec [hl]
ret
@@ -609,7 +609,7 @@ _MovePKMNWithoutMail:
ld [wJumptableIndex], a
ret
-.unused
+.go_back ; unreferenced
ld hl, wJumptableIndex
dec [hl]
ret
@@ -2222,7 +2222,7 @@ PCString_ReleasedPKMN: db "Released <PK><MN>.@"
PCString_Bye: db "Bye,@"
PCString_Stored: db "Stored @"
PCString_Got: db "Got @"
-PCString_Non: db "Non.@"
+PCString_Non: db "Non.@" ; unreferenced
PCString_BoxFull: db "The BOX is full.@"
PCString_PartyFull: db "The party's full!@"
PCString_NoReleasingEGGS: db "No releasing EGGS!@"
@@ -2268,16 +2268,16 @@ _ChangeBox_MenuHeader:
dw .MenuData
db 1 ; default option
-.MenuData
+.MenuData:
db SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 0 ; rows, columns
db SCROLLINGMENU_ITEMS_NORMAL ; item format
- dba .boxes
- dba .boxnames
+ dba .Boxes
+ dba .PrintBoxNames
dba NULL
dba BillsPC_PrintBoxCountAndCapacity
-.boxes
+.Boxes:
db NUM_BOXES
x = 1
rept NUM_BOXES
@@ -2286,7 +2286,7 @@ x = x + 1
endr
db -1
-.boxnames
+.PrintBoxNames:
push de
ld a, [wMenuSelection]
dec a
diff --git a/engine/pokemon/breedmon_level_growth.asm b/engine/pokemon/breedmon_level_growth.asm
index c6356dd6e..f64bd6ca0 100644
--- a/engine/pokemon/breedmon_level_growth.asm
+++ b/engine/pokemon/breedmon_level_growth.asm
@@ -1,5 +1,5 @@
GetBreedMon1LevelGrowth:
- ld hl, wBreedMon1Stats
+ ld hl, wBreedMon1
ld de, wTempMon
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
@@ -13,7 +13,7 @@ GetBreedMon1LevelGrowth:
ret
GetBreedMon2LevelGrowth:
- ld hl, wBreedMon2Stats
+ ld hl, wBreedMon2
ld de, wTempMon
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
diff --git a/engine/pokemon/mail.asm b/engine/pokemon/mail.asm
index acf6626b1..c7b1ab4ed 100644
--- a/engine/pokemon/mail.asm
+++ b/engine/pokemon/mail.asm
@@ -8,7 +8,7 @@ SendMailToPC:
cp MAILBOX_CAPACITY
jr nc, .full
ld bc, MAIL_STRUCT_LENGTH
- ld hl, sMailbox
+ ld hl, sMailboxes
call AddNTimes
ld d, h
ld e, l
@@ -44,7 +44,7 @@ DeleteMailFromPC:
call OpenSRAM
ld a, b
push bc
- ld hl, sMailbox
+ ld hl, sMailboxes
ld bc, MAIL_STRUCT_LENGTH
call AddNTimes
push hl
@@ -73,7 +73,7 @@ DeleteMailFromPC:
ReadMailMessage:
ld a, b
- ld hl, sMailbox
+ ld hl, sMailboxes
ld bc, MAIL_STRUCT_LENGTH
call AddNTimes
ld d, h
@@ -87,7 +87,7 @@ MoveMailFromPCToParty:
push bc
ld a, b
ld bc, MAIL_STRUCT_LENGTH
- ld hl, sMailbox
+ ld hl, sMailboxes
call AddNTimes
push hl
ld a, [wCurPartyMon]
@@ -314,19 +314,19 @@ _PlayerMailBoxMenu:
text_end
InitMail:
-; initialize wMailboxCount and beyond with incrementing values, one per mail
-; set z if no mail
+; return z if no mail
ld a, BANK(sMailboxCount)
call OpenSRAM
ld a, [sMailboxCount]
call CloseSRAM
+
+; initialize wMailboxCount from sMailboxCount
ld hl, wMailboxCount
- ld [hli], a
+ ld [hli], a ; now hl = wMailboxItems
and a
-
jr z, .done ; if no mail, we're done
- ; load values in memory with incrementing values starting at wMailboxCount
+; initialize wMailboxItems with incrementing values starting at 1
ld b, a
ld a, 1
.loop
@@ -334,6 +334,7 @@ InitMail:
inc a
dec b
jr nz, .loop
+
.done
ld [hl], -1 ; terminate
diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm
index b7fc57e8e..934a6bece 100644
--- a/engine/pokemon/mail_2.asm
+++ b/engine/pokemon/mail_2.asm
@@ -404,7 +404,7 @@ LoadBlueSkyMailGFX:
ld de, BlueSkyMailGrassGFX
ld c, 1 * LEN_1BPP_TILE
call LoadMailGFX_Color3
- ld de, MailDragoniteGFX
+ ld de, MailDragoniteAndSentretGFX
ld c, 23 * LEN_1BPP_TILE
call LoadMailGFX_Color3
ld de, MailCloudGFX
@@ -767,7 +767,7 @@ Mail_Place14TileAlternatingRow:
ld b, 14 / 2
jr Mail_PlaceAlternatingRow
-Mail_Place16TileAlternatingRow:
+Mail_Place16TileAlternatingRow: ; unreferenced
push af
ld b, 16 / 2
jr Mail_PlaceAlternatingRow
@@ -775,6 +775,7 @@ Mail_Place16TileAlternatingRow:
Mail_Place18TileAlternatingRow:
push af
ld b, 18 / 2
+ ; fallthrough
Mail_PlaceAlternatingRow:
.loop
@@ -812,16 +813,16 @@ Mail_PlaceAlternatingColumn:
pop af
ret
-Mail_Draw7TileRow:
- ld b, $7
+Mail_Draw7TileRow: ; unreferenced
+ ld b, 7
jr Mail_DrawRowLoop
Mail_Draw13TileRow:
- ld b, $d
+ ld b, 13
jr Mail_DrawRowLoop
Mail_Draw16TileRow:
- ld b, $10
+ ld b, 16
jr Mail_DrawRowLoop
Mail_DrawTopBottomBorder:
@@ -830,6 +831,7 @@ Mail_DrawTopBottomBorder:
Mail_DrawFullWidthBorder:
ld b, SCREEN_WIDTH
+ ; fallthrough
Mail_DrawRowLoop:
.loop
diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm
index fe470ed96..e318a0430 100644
--- a/engine/pokemon/party_menu.asm
+++ b/engine/pokemon/party_menu.asm
@@ -758,12 +758,10 @@ TeachWhichPKMNString:
MoveToWhereString:
db "Move to where?@"
-ChooseAFemalePKMNString:
-; unused
+ChooseAFemalePKMNString: ; unreferenced
db "Choose a ♀<PK><MN>.@"
-ChooseAMalePKMNString:
-; unused
+ChooseAMalePKMNString: ; unreferenced
db "Choose a ♂<PK><MN>.@"
ToWhichPKMNString:
diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm
index 9d0bd907d..f717ad381 100644
--- a/engine/printer/printer_serial.asm
+++ b/engine/printer/printer_serial.asm
@@ -304,7 +304,7 @@ Printer_ResetData:
xor a
ld [wPrinterSendByteCounter], a
ld [wPrinterSendByteCounter + 1], a
- ld hl, wGameboyPrinterRAM
+ ld hl, wGameboyPrinter2bppSource
ld bc, wGameboyPrinter2bppSourceEnd - wGameboyPrinter2bppSource
call Printer_ByteFill
ret
@@ -435,10 +435,10 @@ PrinterDataPacket3:
PrinterDataPacket4:
db 4, 0, $00, 0
dw 4
-PrinterDataPacket5: ; unused
+PrinterDataPacket5: ; unreferenced
db 8, 0, $00, 0
dw 8
-PrinterDataPacket6: ; unused
+PrinterDataPacket6: ; unreferenced
db 15, 0, $00, 0
dw 15
diff --git a/engine/smallflag.asm b/engine/smallflag.asm
index 04cbfcc23..316ae6aa6 100644
--- a/engine/smallflag.asm
+++ b/engine/smallflag.asm
@@ -36,9 +36,9 @@ SmallFarFlagAction:
jr z, .set ; 1 = SET_FLAG
dec b
jr z, .check ; 2 = CHECK_FLAG
-; 0 = RESET_FLAG
+ ; 0 = RESET_FLAG
-.reset
+; reset
ld a, c
cpl
and [hl]
diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm
index d59c750a8..8ed05c625 100644
--- a/engine/tilesets/tileset_anims.asm
+++ b/engine/tilesets/tileset_anims.asm
@@ -305,7 +305,7 @@ ScrollTileRightLeft:
jr nz, ScrollTileLeft
jr ScrollTileRight
-ScrollTileUpDown:
+ScrollTileUpDown: ; unreferenced
; Scroll up for 4 ticks, then down for 4 ticks.
ld a, [wTileAnimationTimer]
inc a
@@ -891,7 +891,7 @@ AnimateWaterPalette:
cp %100 ; frame 4
jr z, .color2
-.color1
+; color1
ld hl, wBGPals1 palette PAL_BG_WATER color 1
ld a, [hli]
ldh [rBGPD], a