summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengine/HoF_room_pc.asm34
-rwxr-xr-xengine/battle/animations.asm7
-rw-r--r--engine/battle/battle_transitions.asm10
-rw-r--r--engine/battle/common_text.asm4
-rwxr-xr-xengine/battle/core.asm18
-rw-r--r--engine/battle/decrement_pp.asm2
-rw-r--r--engine/battle/get_trainer_name.asm1
-rw-r--r--engine/battle/link_battle_versus_text.asm2
-rw-r--r--engine/battle/trainer_ai.asm6
-rwxr-xr-xengine/cable_club.asm12
-rwxr-xr-xengine/clear_save.asm2
-rwxr-xr-xengine/evos_moves.asm5
-rwxr-xr-xengine/gamefreak.asm27
-rwxr-xr-xengine/hall_of_fame.asm11
-rwxr-xr-xengine/hidden_object_functions17.asm40
-rwxr-xr-xengine/hidden_object_functions3.asm10
-rwxr-xr-xengine/hidden_object_functions7.asm14
-rwxr-xr-xengine/hp_bar.asm5
-rwxr-xr-xengine/in_game_trades.asm2
-rwxr-xr-xengine/intro.asm2
-rwxr-xr-xengine/items/items.asm1
-rw-r--r--engine/menu/bills_pc.asm5
-rwxr-xr-xengine/menu/pc.asm6
-rwxr-xr-xengine/menu/pokedex.asm4
-rwxr-xr-xengine/menu/prize_menu.asm24
-rwxr-xr-xengine/menu/start_menu.asm8
-rwxr-xr-xengine/menu/start_sub_menus.asm16
-rwxr-xr-xengine/menu/status_screen.asm6
-rwxr-xr-xengine/mon_party_sprites.asm2
-rwxr-xr-xengine/oak_speech2.asm2
-rwxr-xr-xengine/overworld/emotion_bubbles.asm4
-rwxr-xr-xengine/overworld/healing_machine.asm24
-rwxr-xr-xengine/overworld/map_sprites.asm1
-rw-r--r--engine/overworld/oam.asm2
-rwxr-xr-xengine/overworld/player_animations.asm27
-rwxr-xr-xengine/overworld/trainers.asm10
-rwxr-xr-xengine/palettes.asm8
-rwxr-xr-xengine/predefs.asm15
-rwxr-xr-xengine/save.asm2
-rwxr-xr-xengine/titlescreen.asm6
-rwxr-xr-xengine/titlescreen2.asm2
-rwxr-xr-xengine/town_map.asm32
-rwxr-xr-xengine/trade.asm2
43 files changed, 203 insertions, 220 deletions
diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm
index 31d11677..4a811116 100755
--- a/engine/HoF_room_pc.asm
+++ b/engine/HoF_room_pc.asm
@@ -39,18 +39,18 @@ HallOfFamePC:
jp Credits
FadeInCreditsText:
- ld a, $1
+ ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, HoFGBPalettes
ld b, 4
-.asm_f0f91
+.loop
ld a, [hli]
ld [rBGP], a
call UpdateGBCPal_BGP
ld c, 5
call DelayFrames
dec b
- jr nz, .asm_f0f91
+ jr nz, .loop
ret
HoFGBPalettes:
@@ -76,7 +76,7 @@ DisplayCreditsMon:
call LoadScreenTilesFromBuffer2DisableBGTransfer
ld hl, vBGMap0
call CreditsCopyTileMapToVRAM
- ld a, %11111100
+ ld a, %11111100 ; make the mon a black silhouette
ld [rBGP], a
call UpdateGBCPal_BGP
ld hl, rLCDC
@@ -100,14 +100,13 @@ DisplayCreditsMon:
ret
ScrollCreditsMonLeft:
-.asm_f0fff
ld a, b
ld [hSCX], a
add 8
ld b, a
call DelayFrame
dec c
- jr nz, .asm_f0fff
+ jr nz, ScrollCreditsMonLeft
ret
GetNextCreditsMon:
@@ -129,10 +128,10 @@ INCLUDE "data/credit_mons.asm"
CreditsCopyTileMapToVRAM:
ld a, l
- ld [$ffbc], a
+ ld [H_AUTOBGTRANSFERDEST], a
ld a, h
- ld [$ffbd], a
- ld a, $1
+ ld [H_AUTOBGTRANSFERDEST + 1], a
+ ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
jp Delay3
@@ -154,24 +153,24 @@ CreditsLoadFont:
ret
ZeroMemory:
-.asm_f1071
+; zero bc bytes at hl
ld [hl], 0
inc hl
inc hl
dec bc
ld a, b
or c
- jr nz, .asm_f1071
+ jr nz, ZeroMemory
ret
FillFourRowsWithBlack:
- ld bc, 4 * SCREEN_WIDTH
+ ld bc, SCREEN_WIDTH * 4
ld a, $7e
jp FillMemory
FillMiddleOfScreenWithWhite:
coord hl, 0, 4
- ld bc, 10 * SCREEN_WIDTH
+ ld bc, SCREEN_WIDTH * 10
ld a, " "
jp FillMemory
@@ -193,19 +192,19 @@ FillHalfOfScreenWithWhite:
ld b, 10
ld c, 10
ld a, " "
-.asm_f10a6
+.loop
push bc
push hl
-.asm_f10a8
+.innerLoop
ld [hli], a
dec c
- jr nz, .asm_f10a8
+ jr nz, .innerLoop
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_f10a6
+ jr nz, .loop
ret
Credits: ; Roll credits
@@ -322,4 +321,3 @@ INCLUDE "text/credits_text.asm"
TheEndGfx: ; 7473e (1d:473e) (7473f on blue)
INCBIN "gfx/theend.interleave.2bpp"
TheEndGfxEnd:
-
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 31148392..bfbaa180 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -1034,6 +1034,7 @@ TailWhipAnimationUnused:
ld c, 20
jp DelayFrames
+; Format: Special Effect ID (1 byte), Address (2 bytes)
SpecialEffectPointers:
db SE_DARK_SCREEN_FLASH ; $FE
dw AnimationFlashScreen
@@ -2040,7 +2041,7 @@ _AnimationSlideMonOff:
; functions below catch it by checking if the tile number is within the valid
; range and if not, replacing it with a blank tile.
-.PlayerNextTile ; 79702 (1e:5702)
+.PlayerNextTile
ld a, [hl]
add 7
; bugfix: compares against the max tile + 1 as opposed to the max tile
@@ -2049,7 +2050,7 @@ _AnimationSlideMonOff:
ld a, " "
ret
-.EnemyNextTile ; 7970b (1e:570b)
+.EnemyNextTile
ld a, [hl]
sub 7
; This has the same problem as above, but it has no visible effect because
@@ -3202,7 +3203,7 @@ TossBallAnimation:
; sequence of animations that make up the Poké Ball toss
db POOF_ANIM, HIDEPIC_ANIM, SHAKE_ANIM, POOF_ANIM, SHOWPIC_ANIM
-.BlockBall ; 79ff6 (1e:5ff6)
+.BlockBall
ld a, TOSS_ANIM
ld [wAnimationID], a
call PlayAnimation
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index a4871837..2f3e4e91 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -1,5 +1,5 @@
BattleTransition:
- ld a, $1
+ ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
@@ -363,7 +363,7 @@ BattleTransition_FlashScreen_:
jr z, .done
ld [rBGP], a
call UpdateGBCPal_BGP
- ld c, $2
+ ld c, 2
call DelayFrames
jr .loop
.done
@@ -377,7 +377,7 @@ BattleTransition_FlashScreenPalettes:
; used for low level trainer dungeon battles
BattleTransition_Shrink:
- ld c,9
+ ld c, 9
.loop
push bc
xor a
@@ -411,7 +411,7 @@ BattleTransition_Shrink:
; used for high level trainer dungeon battles
BattleTransition_Split:
- ld c,$9
+ ld c, 9
xor a
ld [H_AUTOBGTRANSFERENABLED], a
.loop
@@ -632,7 +632,7 @@ BattleTransition_Circle_Sub1:
ret
BattleTransition_TransferDelay3:
- ld a, $1
+ ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
xor a
diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm
index 02bb1a61..d84d0300 100644
--- a/engine/battle/common_text.asm
+++ b/engine/battle/common_text.asm
@@ -1,5 +1,5 @@
PrintBeginningBattleText:
- ld a, [wIsInBattle] ; W_ISINBATTLE
+ ld a, [wIsInBattle]
dec a
jr nz, .trainerBattle
ld a, [wCurMap]
@@ -80,7 +80,7 @@ PrintBeginningBattleText:
ld [wFrequencyModifier], a
ld a, $80
ld [wTempoModifier], a
- ld a, $e9 ; (SFX_08_77 - SFX_Headers_08) / 3
+ ld a, SFX_SILPH_SCOPE
call PlaySound
jp WaitForSoundToFinish
.done
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index fa56e5b2..c061b291 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1227,7 +1227,7 @@ ChooseNextMon:
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
- ld a, $1
+ ld a, 1
ld [wActionResultOrTookBattleTurn], a
call LinkBattleExchangeData
.notLinkBattle
@@ -1956,7 +1956,7 @@ AnimateRetreatingPlayerMon:
.clearScreenArea
coord hl, 1, 5
lb bc, 7, 7
- call ClearScreenArea ; jp
+ call ClearScreenArea
ret
; reads player's current mon's HP into wBattleMonHP
@@ -2347,7 +2347,7 @@ DisplayBattleMenu:
call PrintText
jp DisplayBattleMenu
-.RunAwayText ; 3d0df (f:50df)
+.RunAwayText
TX_FAR _RunAwayText
db "@"
@@ -2561,7 +2561,7 @@ PartyMenuOrRockOrRun:
predef StatusScreen
predef StatusScreen2
; now we need to reload the enemy mon pic
- ld a, $1
+ ld a, 1
ld [H_WHOSETURN], a
ld a, [wEnemyBattleStatus2]
bit HasSubstituteUp, a ; does the enemy mon have a substitute?
@@ -2961,7 +2961,7 @@ AnyMoveToSelect:
jr .noMovesLeft
.handleDisabledMove
swap a
- and $f ; get move disabled
+ and $f ; get disabled move
ld b, a
ld d, NUM_MOVES + 1
xor a
@@ -3379,7 +3379,7 @@ getPlayerAnimationType:
ld a,4 ; move has no effect other than dealing damage
jr z,playPlayerMoveAnimation
ld a,5 ; move has effect
-playPlayerMoveAnimation ; 3d890 (f:5890)
+playPlayerMoveAnimation:
push af
ld a,[wPlayerBattleStatus2]
bit HasSubstituteUp,a
@@ -3398,7 +3398,7 @@ playPlayerMoveAnimation ; 3d890 (f:5890)
ld b,BANK(ReshowSubstituteAnim)
call nz,Bankswitch
jr MirrorMoveCheck
-playerCheckIfFlyOrChargeEffect ; 3d8bd (f:58bd)
+playerCheckIfFlyOrChargeEffect:
ld c,30
call DelayFrames
ld a,[wPlayerMoveEffect]
@@ -4105,7 +4105,7 @@ PrintMoveFailureText:
ret nz
; if you get here, the mon used jump kick or hi jump kick and missed
- ld hl, wDamage ; since the move missed, W_DAMAGE will always contain 0 at this point.
+ ld hl, wDamage ; since the move missed, wDamage will always contain 0 at this point.
; Thus, recoil damage will always be equal to 1
; even if it was intended to be potential damage/8.
ld a, [hli]
@@ -7173,7 +7173,7 @@ FellAsleepText:
TX_FAR _FellAsleepText
db "@"
-AlreadyAsleepText: ; 3f1cd (f:71cds)
+AlreadyAsleepText:
TX_FAR _AlreadyAsleepText
db "@"
diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm
index fd1a3184..e23a85ba 100644
--- a/engine/battle/decrement_pp.asm
+++ b/engine/battle/decrement_pp.asm
@@ -33,7 +33,7 @@ DecrementPP:
ld a, [wPlayerMonNumber] ; which mon in party is active
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes ; calculate address of the mon to modify
-.DecrementPP ; f4301 (3d:4301)
+.DecrementPP:
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
ld c, a
ld b, 0
diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm
index e051a02a..36ca019e 100644
--- a/engine/battle/get_trainer_name.asm
+++ b/engine/battle/get_trainer_name.asm
@@ -19,7 +19,6 @@ GetTrainerName_:
call GetName
ld hl, wcd6d
.foundName
-.rival
ld de, wTrainerName
ld bc, $d
jp CopyData
diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm
index 5edf13e6..63142ba6 100644
--- a/engine/battle/link_battle_versus_text.asm
+++ b/engine/battle/link_battle_versus_text.asm
@@ -2,7 +2,7 @@
DisplayLinkBattleVersusTextBox:
call LoadTextBoxTilePatterns
coord hl, 3, 4
- ld bc, $70c
+ lb bc, 7, 12
call TextBoxBorder
coord hl, 4, 5
ld de, wPlayerName
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 3624f5ea..2f2c46a6 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -740,8 +740,7 @@ AICureStatus:
res 0,[hl]
ret
-AIUseXAccuracy:
-; unused
+AIUseXAccuracy: ; unused
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 0,[hl]
@@ -755,8 +754,7 @@ AIUseGuardSpec:
ld a,GUARD_SPEC
jp AIPrintItemUse
-AIUseDireHit:
-; unused
+AIUseDireHit: ; unused
call AIPlayRestoringSFX
ld hl,wEnemyBattleStatus2
set 2,[hl]
diff --git a/engine/cable_club.asm b/engine/cable_club.asm
index a6552939..d7b5bdc8 100755
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -253,7 +253,7 @@ CableClub_DoBattleOrTradeAgain:
ld hl, wEnemyMons + (SERIAL_PREAMBLE_BYTE - 1)
dec c
jr nz, .unpatchEnemyMonsLoop
- ld a, wEnemyMonOT & $ff
+ ld a, wEnemyMonOT % $100
ld [wUnusedCF8D], a
ld a, wEnemyMonOT / $100
ld [wUnusedCF8D + 1], a
@@ -268,7 +268,7 @@ CableClub_DoBattleOrTradeAgain:
cp LINK_STATE_START_BATTLE
ld a, LINK_STATE_TRADING
ld [wLinkState], a
- jr nz, .asm_55a0
+ jr nz, .trading
ld a, LINK_STATE_BATTLING
ld [wLinkState], a
ld a, OPP_SONY1
@@ -288,7 +288,7 @@ CableClub_DoBattleOrTradeAgain:
ld [wLetterPrintingDelayFlags], a
predef HealParty
jp ReturnToCableClubRoom
-.asm_55a0
+.trading
ld c, BANK(Music_GameCorner)
ld a, MUSIC_GAME_CORNER
call PlayMusic
@@ -446,7 +446,6 @@ TradeCenter_SelectMon:
ld a, [wEnemyPartyCount]
dec a
cp b
- ; continue
jr nc, .notPastLastEnemyMon
; when switching to the enemy mon menu, if the menu selection would be past the last enemy mon, select the last enemy mon
ld [wCurrentMenuItem], a
@@ -851,7 +850,6 @@ TradeCenter_Trade:
.usingExternalClock
predef ExternalClockTradeAnim
.tradeCompleted
-; continue
callab TryEvolvingMon
call ClearScreen
call LoadTrainerInfoTextBoxTiles
@@ -973,10 +971,10 @@ CableClub_TextBoxBorder:
; c = width
CableClub_DrawHorizontalLine:
ld d, c
-.drawHorizontalLineLoop
+.loop
ld [hli], a
dec d
- jr nz, .drawHorizontalLineLoop
+ jr nz, .loop
ret
LoadTrainerInfoTextBoxTiles:
diff --git a/engine/clear_save.asm b/engine/clear_save.asm
index ab2a6aa8..f2acbf32 100755
--- a/engine/clear_save.asm
+++ b/engine/clear_save.asm
@@ -1,4 +1,4 @@
-DoClearSaveDialogue: ; DoClearSaveDialogue:
+DoClearSaveDialogue:
call ClearScreen
call RunDefaultPaletteCommand
call LoadFontTilePatterns
diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm
index 78ead030..8ec2c4c7 100755
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -24,8 +24,7 @@ EvolutionAfterBattle:
ld hl, wPartyCount
push hl
-Evolution_PartyMonLoop:
-; loop over party mons
+Evolution_PartyMonLoop: ; loop over party mons
ld hl, wWhichPokemon
inc [hl]
pop hl
@@ -313,7 +312,7 @@ StoppedEvolvingText:
TX_FAR _StoppedEvolvingText
db "@"
-IsEvolvingText: ; 3affe (e:6ffes)
+IsEvolvingText:
TX_FAR _IsEvolvingText
db "@"
diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm
index 6545e216..5472a56e 100755
--- a/engine/gamefreak.asm
+++ b/engine/gamefreak.asm
@@ -2,14 +2,14 @@ LoadShootingStarGraphics:
ld a, $f9
ld [rOBP0], a
ld a, $a4
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
- ld de, AnimationTileset2 + $30 ; $4757 ; star tile (top left quadrant)
+ ld de, AnimationTileset2 + $30 ; star tile (top left quadrant)
ld hl, vChars1 + $200
lb bc, BANK(AnimationTileset2), $01
call CopyVideoData
- ld de, AnimationTileset2 + $130 ; $481e ; star tile (bottom left quadrant)
+ ld de, AnimationTileset2 + $130 ; star tile (bottom left quadrant)
ld hl, vChars1 + $210
lb bc, BANK(AnimationTileset2), $01
call CopyVideoData
@@ -39,7 +39,7 @@ AnimateShootingStar:
push bc
.bigStarInnerLoop
ld a, [hl] ; Y
- add 4 ; y
+ add 4
ld [hli], a
ld a, [hl] ; X
add -4
@@ -60,11 +60,11 @@ AnimateShootingStar:
.next
cp b
jr nz, .bigStarLoop
+
+; Clear big star OAM.
ld hl, wOAMBuffer
ld c, 4
ld de, 4
-
-; Clear big star OAM.
.clearOAMLoop
ld [hl], 160
add hl, de
@@ -74,7 +74,7 @@ AnimateShootingStar:
; Make Gamefreak logo flash.
ld b, 3
.flashLogoLoop
- ld hl, rOBP0 ; $ff48
+ ld hl, rOBP0
rrc [hl]
rrc [hl]
call UpdateGBCPal_OBP0
@@ -83,13 +83,14 @@ AnimateShootingStar:
ret c
dec b
jr nz, .flashLogoLoop
+
; Copy 24 instances of the small stars OAM data.
; Note that their coordinates put them off-screen.
ld de, wOAMBuffer
ld a, 24
.initSmallStarsOAMLoop
push af
- ld hl, SmallStarsOAM ; $40ee
+ ld hl, SmallStarsOAM
ld bc, SmallStarsOAMEnd - SmallStarsOAM
call CopyData
pop af
@@ -98,8 +99,8 @@ AnimateShootingStar:
; Animate the small stars falling from the Gamefreak logo.
xor a
- ld [wMoveDownSmallStarsOAMCount], a ; wWhichTrade
- ld hl, SmallStarsWaveCoordsPointerTable ; 1c:4105
+ ld [wMoveDownSmallStarsOAMCount], a
+ ld hl, SmallStarsWaveCoordsPointerTable
ld c, 6
.smallStarsLoop
ld a, [hli]
@@ -214,15 +215,15 @@ MoveDownSmallStars:
ld de, -4
ld c, a
.innerLoop
- inc [hl]
+ inc [hl] ; Y
add hl, de
dec c
jr nz, .innerLoop
; Toggle the palette so that the lower star in the small stars tile blinks in
; and out.
- ld a, [rOBP1] ; $ff49
+ ld a, [rOBP1]
xor %10100000
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
call UpdateGBCPal_OBP1
ld c, 3
call CheckForUserInterruption
diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm
index 59e97892..554893a9 100755
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -33,8 +33,8 @@ AnimateHallOfFame:
.skipInc
ld a, $90
ld [hWY], a
- ld c, $1f ; BANK(Music_HallOfFame)
- ld a, $ca ; MUSIC_HALL_OF_FAME
+ ld c, BANK(Music_HallOfFame)
+ ld a, MUSIC_HALL_OF_FAME
call PlayMusic
ld hl, wPartySpecies
ld c, $ff
@@ -151,7 +151,7 @@ HoFShowMonOrPlayer:
HoFDisplayAndRecordMonInfo:
ld a, [wHoFPartyMonIndex]
- ld hl, wPartyMonNicks ; wPartyMonNicks
+ ld hl, wPartyMonNicks
call GetPartyMonName
call HoFDisplayMonInfo
ld a, [wHoFPartyMonIndex]
@@ -197,7 +197,7 @@ HoFMonInfoText:
next "TYPE2/@"
HoFLoadPlayerPics:
- ld de, RedPicFront ; $6ede
+ ld de, RedPicFront
ld a, BANK(RedPicFront)
call UncompressSpriteFromDE
ld a,$0
@@ -218,7 +218,8 @@ HoFLoadPlayerPics:
ld c, $1
HoFLoadMonPlayerPicTileIDs:
- ld b, $0
+; c = base tile ID
+ ld b, 0
coord hl, 12, 5
predef_jump CopyTileIDsFromList
diff --git a/engine/hidden_object_functions17.asm b/engine/hidden_object_functions17.asm
index a6044d94..afbcadee 100755
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -122,22 +122,22 @@ LinkCableHelp:
ld hl, LinkCableHelpText1
call PrintText
xor a
- ld [wMenuItemOffset], a
+ ld [wMenuItemOffset], a ; not used
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, $3
+ ld a, 3
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
.linkHelpLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
- lb bc, $8, $d
+ lb bc, 8, 13
call TextBoxBorder
coord hl, 2, 2
ld de, HowToLinkText
@@ -148,13 +148,13 @@ LinkCableHelp:
bit 1, a ; pressed b
jr nz, .exit
ld a, [wCurrentMenuItem]
- cp $3 ; pressed a on "STOP READING"
+ cp 3 ; pressed a on "STOP READING"
jr z, .exit
ld hl, wd730
res 6, [hl]
ld hl, LinkCableInfoTexts
add a
- ld d, $0
+ ld d, 0
ld e, a
add hl, de
ld a, [hli]
@@ -210,11 +210,11 @@ ViridianSchoolBlackboard:
ld [wLastMenuItem], a
ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, $2
+ ld a, 2
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
.blackboardLoop
ld hl, wd730
@@ -236,24 +236,24 @@ ViridianSchoolBlackboard:
bit 4, a ; pressed right
jr z, .didNotPressRight
; move cursor to right column
- ld a, $2
+ ld a, 2
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $6
+ ld a, 6
ld [wTopMenuItemX], a
- ld a, $3 ; in the the right column, use an offset to prevent overlap
+ ld a, 3 ; in the the right column, use an offset to prevent overlap
ld [wMenuItemOffset], a
jr .blackboardLoop
.didNotPressRight
bit 5, a ; pressed left
jr z, .didNotPressLeftOrRight
; move cursor to left column
- ld a, $2
+ ld a, 2
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
xor a
ld [wMenuItemOffset], a
@@ -261,9 +261,9 @@ ViridianSchoolBlackboard:
.didNotPressLeftOrRight
ld a, [wCurrentMenuItem]
ld b, a
- ld a, [wAnimationID]
+ ld a, [wMenuItemOffset]
add b
- cp $5 ; cursor is pointing to "QUIT"
+ cp 5 ; cursor is pointing to "QUIT"
jr z, .exitBlackboard
; we must have pressed a on a status condition
; so print the text
@@ -271,7 +271,7 @@ ViridianSchoolBlackboard:
res 6, [hl]
ld hl, ViridianBlackboardStatusPointers
add a
- ld d, $0
+ ld d, 0
ld e, a
add hl, de
ld a, [hli]
diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm
index 06dc7560..9456e76f 100755
--- a/engine/hidden_object_functions3.asm
+++ b/engine/hidden_object_functions3.asm
@@ -81,9 +81,9 @@ IndigoPlateauStatues:
ld a, [wXCoord]
bit 0, a
ld hl, IndigoPlateauStatuesText2
- jr nz, .asm_fa61
+ jr nz, .ok
ld hl, IndigoPlateauStatuesText3
-.asm_fa61
+.ok
call PrintText
jp TextScriptEnd
@@ -104,12 +104,12 @@ BookOrSculptureText:
ld hl, PokemonBooksText
ld a, [wCurMapTileset]
cp MANSION ; Celadon Mansion tileset
- jr nz, .asm_fa8b
+ jr nz, .ok
aCoord 8, 6
cp $38
- jr nz, .asm_fa8b
+ jr nz, .ok
ld hl, DiglettSculptureText
-.asm_fa8b
+.ok
call PrintText
jp TextScriptEnd
diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm
index 691d05f2..a8676fed 100755
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -85,7 +85,7 @@ SafariZoneGameOver:
ld a, $5
ld [wSafariZoneEntranceCurScript], a
SetEvent EVENT_SAFARI_GAME_OVER
- ld a, $1
+ ld a, 1
ld [wSafariZoneGameOver], a
ret
@@ -138,7 +138,7 @@ CinnabarGymQuiz:
ld [$ffdc], a
ld a, [hGymGateIndex]
ld hl, CinnabarGymQuizIntroText
- cp $1
+ cp 1
jr z, .onFirstQuestion
ld hl, CinnabarGymQuizShortIntroText
.onFirstQuestion
@@ -154,7 +154,7 @@ CinnabarGymQuiz:
ld h, [hl]
ld l, a
call PrintText
- ld a, $1
+ ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call CinnabarGymQuiz_1ea92
jp TextScriptEnd
@@ -435,16 +435,16 @@ BillsHousePokemonList:
ld hl, BillsHousePokemonListText1
call PrintText
xor a
- ld [wMenuItemOffset], a
+ ld [wMenuItemOffset], a ; not used
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, $4
+ ld a, 4
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
.billsPokemonLoop
ld hl, wd730
diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm
index b4abf028..566a7b61 100755
--- a/engine/hp_bar.asm
+++ b/engine/hp_bar.asm
@@ -87,6 +87,7 @@ UpdateHPBar2:
call UpdateHPBar_CompareNewHPToOldHP
jr z, .animateHPBarDone
jr nc, .HPIncrease
+; HP decrease
dec bc ; subtract 1 HP
ld a, c
ld [wHPBarNewHP], a
@@ -95,7 +96,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels
ld a, e
sub d ; calc pixel difference
- jr .asm_f90e
+ jr .ok
.HPIncrease
inc bc ; add 1 HP
ld a, c
@@ -105,7 +106,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels
ld a, d
sub e ; calc pixel difference
-.asm_f90e
+.ok
call UpdateHPBar_PrintHPNumber
and a
jr z, .noPixelDifference
diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm
index 20069e30..60719c7e 100755
--- a/engine/in_game_trades.asm
+++ b/engine/in_game_trades.asm
@@ -133,7 +133,7 @@ InGameTrade_DoTrade:
and a
ld a,$3
jr .tradeSucceeded
-.tradeFailed ; never jumped to
+.tradeFailed
scf
.tradeSucceeded
ld [wInGameTradeTextPointerTableIndex],a
diff --git a/engine/intro.asm b/engine/intro.asm
index 9bc1f503..37bd0151 100755
--- a/engine/intro.asm
+++ b/engine/intro.asm
@@ -8,7 +8,7 @@ PlayIntro:
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call PlayShootingStar
- callab PlayIntroScene ; 3e:582d
+ callab PlayIntroScene
xor a
ld [hSCX], a
ld [H_AUTOBGTRANSFERENABLED], a
diff --git a/engine/items/items.asm b/engine/items/items.asm
index 3fb4b7e1..984cc381 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -3211,7 +3211,6 @@ FindWildLocationsOfMon:
inc hl
inc c
jr .loop
-
.done
ld a, $ff ; list terminator
ld [de], a
diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm
index 57699b8f..eddccc29 100644
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -254,7 +254,7 @@ BillsPCDeposit:
call WaitForSoundToFinish
ld hl, wBoxNumString
ld a, [wCurrentBoxNum]
- and " "
+ and $7f
cp 9
jr c, .singleDigitBoxNum
sub 9
@@ -423,7 +423,7 @@ HMMoveArray:
db SURF
db STRENGTH
db FLASH
- db $ff
+ db -1
DisplayDepositWithdrawMenu:
coord hl, 9, 10
@@ -595,3 +595,4 @@ JustAMomentText::
OpenBillsPCText::
db $FD ; FuncTX_BillsPC
+
diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm
index b31970c8..c9e2cf08 100755
--- a/engine/menu/pc.asm
+++ b/engine/menu/pc.asm
@@ -123,10 +123,10 @@ RemoveItemByID:
ld [hItemToRemoveIndex], a
.loop
ld a, [hli]
- cp $ff ; have we reached the cancel button (terminator)
+ cp -1 ; reached terminator?
ret z
- cp b ; is the current item the item we want?
- jr z, .foundItem ; if so, remove it from the inventory
+ cp b
+ jr z, .foundItem
inc hl
ld a, [hItemToRemoveIndex]
inc a
diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm
index 5bc8f119..166e026d 100755
--- a/engine/menu/pokedex.asm
+++ b/engine/menu/pokedex.asm
@@ -393,7 +393,6 @@ Pokedex_PlacePokemonList:
jr nz, .getPokemonName ; if the player has seen the pokemon
ld de, .dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon
jr .skipGettingName
-
.dashedLine ; for unseen pokemon in the list
db "----------@"
.getPokemonName
@@ -519,10 +518,9 @@ DrawDexEntryOnScreen:
ld a, $6c ; lower left corner tile
Coorda 0, 17
ld a, $6e ; lower right corner tile
-
Coorda 19, 17
- coord hl, 0, 9
+ coord hl, 0, 9
ld de, PokedexDataDividerLine
call PlaceString ; draw horizontal divider line
diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm
index 2a8dcb83..d1b1be3c 100755
--- a/engine/menu/prize_menu.asm
+++ b/engine/menu/prize_menu.asm
@@ -33,7 +33,7 @@ CeladonPrizeMenu:
bit 1,a ; keypress = B (Cancel)
jr nz, .noChoice
ld a,[wCurrentMenuItem]
- cp $03 ; "NO,THANKS" choice
+ cp 3 ; "NO,THANKS" choice
jr z, .noChoice
call HandlePrizeChoice
.noChoice
@@ -68,7 +68,7 @@ GetPrizeMenuId:
ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2)
add a
add a
- ld d, $0
+ ld d, 0
ld e, a
ld hl, PrizeDifferentMenuPtrs
add hl, de
@@ -84,10 +84,10 @@ GetPrizeMenuId:
ld h, [hl]
ld l, a
ld de, wPrize1Price
- ld bc, $6
+ ld bc, 6
call CopyData
ld a, [wWhichPrizeWindow]
- cp $02 ;is TM_menu?
+ cp 2 ;is TM_menu?
jr nz, .putMonName
ld a, [wPrize1]
ld [wd11e], a
@@ -155,10 +155,10 @@ PrintPrizePrice:
call TextBoxBorder
call UpdateSprites
coord hl, 12, 0
- ld de, CoinString
+ ld de, .CoinString
call PlaceString
coord hl, 13, 1
- ld de, SixSpacesString
+ ld de, .SixSpacesString
call PlaceString
coord hl, 13, 1
ld de,wPlayerCoins
@@ -166,16 +166,16 @@ PrintPrizePrice:
call PrintBCDNumber
ret
-CoinString:
+.CoinString:
db "COIN@"
-SixSpacesString:
+.SixSpacesString:
db " @"
LoadCoinsToSubtract:
ld a,[wWhichPrize]
add a
- ld d, $0
+ ld d, 0
ld e, a
ld hl, wPrize1Price
add hl, de ; get selected prize's price
@@ -190,14 +190,14 @@ LoadCoinsToSubtract:
HandlePrizeChoice:
ld a, [wCurrentMenuItem]
ld [wWhichPrize], a
- ld d, $0
+ ld d, 0
ld e, a
ld hl, wPrize1
add hl, de
ld a, [hl]
ld [wd11e], a
ld a, [wWhichPrizeWindow]
- cp $02 ; is prize a TM?
+ cp 2 ; is prize a TM?
jr nz, .getMonName
call GetItemName
jr .givePrize
@@ -261,7 +261,7 @@ HandlePrizeChoice:
ld hl,OhFineThenTextPtr
jp PrintText
-UnknownData528b1:
+UnknownPrizeData:
; XXX what's this?
db $00,$01,$00,$01,$00,$01,$00,$00,$01
diff --git a/engine/menu/start_menu.asm b/engine/menu/start_menu.asm
index 16a9973d..af687432 100755
--- a/engine/menu/start_menu.asm
+++ b/engine/menu/start_menu.asm
@@ -2,7 +2,7 @@ DisplayStartMenu::
switchbank StartMenu_Pokedex ; also bank for other functions
ld a, [wWalkBikeSurfState] ; walking/biking/surfing
ld [wWalkBikeSurfStateCopy], a
- ld a, $8f ; (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound
+ ld a, SFX_START_MENU
call PlaySound
RedisplayStartMenu::
@@ -23,7 +23,7 @@ RedisplayStartMenu_DoNotDrawStartMenu:
and a
jr nz, .loop
; if the player pressed tried to go past the top item, wrap around to the bottom
- CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6
jr nz, .wrapMenuItemId
dec a ; there are only 6 menu items without the pokedex
@@ -35,7 +35,7 @@ RedisplayStartMenu_DoNotDrawStartMenu:
bit 7, a
jr z, .buttonPressed
; if the player pressed tried to go past the bottom item, wrap around to the top
- CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem]
ld c, 7 ; there are 7 menu items with the pokedex
jr nz, .checkIfPastBottom
@@ -56,7 +56,7 @@ RedisplayStartMenu_DoNotDrawStartMenu:
and a, %00001010 ; was the Start button or B button pressed?
jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
- CheckEvent EVENT_GOT_POKEDEX ; does the player have the pokedex?
+ CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem]
jr nz, .displayMenuItem
inc a ; adjust position to account for missing pokedex menu item
diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm
index fc553d93..94469960 100755
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -129,7 +129,7 @@ StartMenu_Pokemon:
dw .dig
dw .teleport
dw .softboiled
-.fly ; 11d1b (4:5d1b)
+.fly
bit 2,a ; does the player have the Thunder Badge?
jp z,.newBadgeRequired
call CheckIfInOutsideMap
@@ -160,7 +160,7 @@ StartMenu_Pokemon:
and a
jp z,.loop
jp CloseTextDisplay
-.surf ; 11d66 (4:5d66)
+.surf
bit 4,a ; does the player have the Soul Badge?
jp z,.newBadgeRequired
callba IsSurfingAllowed
@@ -190,13 +190,13 @@ StartMenu_Pokemon:
xor a
ld [wd473], a
jp .loop
-.strength ; 11dab (4:5dab)
+.strength
bit 3,a ; does the player have the Rainbow Badge?
jp z,.newBadgeRequired
predef PrintStrengthTxt
call GBPalWhiteOutWithDelay3
jp .goBackToMap
-.flash ; 11dbb (4:5dbb)
+.flash
bit 0,a ; does the player have the Boulder Badge?
jp z,.newBadgeRequired
xor a
@@ -208,7 +208,7 @@ StartMenu_Pokemon:
.flashLightsAreaText
TX_FAR _FlashLightsAreaText
db "@"
-.dig ; 11dd5 (4:5dd5)
+.dig
ld a,ESCAPE_ROPE
ld [wcf91],a
ld [wPseudoItemID],a
@@ -218,7 +218,7 @@ StartMenu_Pokemon:
jp z,.loop
call GBPalWhiteOutWithDelay3
jp .goBackToMap
-.teleport ; 11ded (4:5ded)
+.teleport
call CheckIfInOutsideMap
jr z,.canTeleport
ld a,[wWhichPokemon]
@@ -239,7 +239,7 @@ StartMenu_Pokemon:
res 4,[hl]
ld c,60
call DelayFrames
- call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 frames
+ call GBPalWhiteOutWithDelay3
jp .goBackToMap
.warpToLastPokemonCenterText
TX_FAR _WarpToLastPokemonCenterText
@@ -250,7 +250,7 @@ StartMenu_Pokemon:
.cannotFlyHereText
TX_FAR _CannotFlyHereText
db "@"
-.softboiled ; 11e35 (4:5e35)
+.softboiled
ld hl,wPartyMon1MaxHP
ld a,[wWhichPokemon]
ld bc,wPartyMon2 - wPartyMon1
diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm
index 932d206a..4adfb543 100755
--- a/engine/menu/status_screen.asm
+++ b/engine/menu/status_screen.asm
@@ -257,7 +257,7 @@ DrawLineBox:
ld [hl], $6f ; ← (halfarrow ending)
ret
-PTile: ; 11682 (4:5682) ; This is a single 1bpp "P" tile
+PTile: ; This is a single 1bpp "P" tile
INCBIN "gfx/p_tile.1bpp"
PTileEnd:
@@ -349,11 +349,11 @@ StatusScreen2:
ld c, a
ld a, "-"
call StatusScreen_PrintPP ; Fill the rest with --
-.InitPP ; 1175e
+.InitPP
ld hl, wLoadedMonMoves
coord de, 14, 10
ld b, 0
-.PrintPP ; 11766
+.PrintPP
ld a, [hli]
and a
jr z, .PPDone
diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm
index 2e588aa4..6f17f876 100755
--- a/engine/mon_party_sprites.asm
+++ b/engine/mon_party_sprites.asm
@@ -372,7 +372,7 @@ UnusedPartyMonSpriteFunction:
ld [wMonPartySpriteSpecies], a
jr WriteMonPartySpriteOAMBySpecies
-.LoadTilePatterns ; 71959 (1c:5959)
+.LoadTilePatterns
push hl
add a
ld c, a
diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm
index 122803fa..80f1bafc 100755
--- a/engine/oak_speech2.asm
+++ b/engine/oak_speech2.asm
@@ -184,7 +184,7 @@ DisplayIntroNameTextBox:
ld [wMaxMenuItem], a
jp HandleMenuInput
-.namestring ; 6822 (1:6822)
+.namestring
db "NAME@"
DefaultNamesPlayer:
diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm
index 7c7f5e7d..3b02fd55 100755
--- a/engine/overworld/emotion_bubbles.asm
+++ b/engine/overworld/emotion_bubbles.asm
@@ -3,7 +3,7 @@ EmotionBubble:
and $f
swap a
ld c, a
- ld b, $0
+ ld b, 0
ld hl, EmotionBubbles
add hl, bc ; each emotion bubble is 16 bytes, so calculate the offset directly instead of with a pointer table
add hl, bc
@@ -64,7 +64,7 @@ EmotionBubble:
call DelayFrame
call UpdateSprites
ret
- ; jp UpdateSprites
+
EmotionBubblesOAM:
db $F8,$00,$F9,$00
diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm
index 1dc74e2d..ed733d7d 100755
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -1,5 +1,5 @@
AnimateHealingMachine:
- ld de, PokeCenterFlashingMonitorAndHealBall ; $44b7
+ ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
call CopyVideoData
@@ -11,23 +11,23 @@ AnimateHealingMachine:
ld a, [rOBP1]
push af
ld a, $e0
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
call UpdateGBCPal_OBP1
ld hl, wOAMBuffer + $84
- ld de, PokeCenterOAMData ; $44d7
+ ld de, PokeCenterOAMData
call CopyHealingMachineOAM
ld a, 4
ld [wAudioFadeOutControl], a
call StopAllMusic
.waitLoop
ld a, [wAudioFadeOutControl]
- and a
- jr nz, .waitLoop
- ld a, [wPartyCount] ; wPartyCount
+ and a ; is fade-out finished?
+ jr nz, .waitLoop ; if not, check again
+ ld a, [wPartyCount]
ld b, a
.partyLoop
call CopyHealingMachineOAM
- ld a, $9e ; (SFX_02_4a - SFX_Headers_02) / 3
+ ld a, SFX_HEALING_MACHINE
call PlaySound
ld c, 30
call DelayFrames
@@ -38,22 +38,22 @@ AnimateHealingMachine:
ld [wAudioSavedROMBank], a
jr nz, .next
call StopAllMusic
- ld a, $2 ; BANK(Music_PkmnHealed)
+ ld a, BANK(Music_PkmnHealed)
ld [wAudioROMBank], a
.next
- ld a, $e8 ; MUSIC_PKMN_HEALED
+ ld a, MUSIC_PKMN_HEALED
ld [wNewSoundID], a
call PlaySound
ld d, $28
call FlashSprite8Times
.waitLoop2
ld a, [wChannelSoundIDs]
- cp $e8 ; MUSIC_PKMN_HEALED
- jr z, .waitLoop2
+ cp MUSIC_PKMN_HEALED ; is the healed music still playing?
+ jr z, .waitLoop2 ; if so, check gain
ld c, 32
call DelayFrames
pop af
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
call UpdateGBCPal_OBP1
pop hl
pop af
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index 43b44946..32d3d47b 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -328,7 +328,6 @@ GetSplitMapSpriteSetID:
.northSouthDivide
ld a, [wYCoord]
jr .compareCoord
-
.eastWestDivide
ld a, [wXCoord]
.compareCoord
diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm
index 5b9831b0..5a831327 100644
--- a/engine/overworld/oam.asm
+++ b/engine/overworld/oam.asm
@@ -8,7 +8,7 @@ PrepareOAMData:
dec a
jr z, .updateEnabled
- cp $ff
+ cp -1
ret nz
ld [wUpdateSpritesEnabled], a
jp HideSprites
diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm
index eea1b375..d4ecec53 100755
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -9,7 +9,7 @@ EnterMapAnim:
bit 7, [hl] ; used fly out of battle?
res 7, [hl]
jr nz, .flyAnimation
- ld a, $a0 ; (SFX_02_4c - SFX_Headers_02) / 3
+ ld a, SFX_TELEPORT_ENTER_1
call PlaySound
ld hl, wd732
bit 4, [hl] ; used dungeon warp?
@@ -17,7 +17,7 @@ EnterMapAnim:
;res 4, [hl]
jr nz, .dungeonWarpAnimation
call PlayerSpinWhileMovingDown
- ld a, $a3 ; (SFX_02_4f - SFX_Headers_02) / 3
+ ld a, SFX_TELEPORT_ENTER_2
call PlaySound
call IsPlayerStandingOnWarpPadOrHole
ld a, b
@@ -51,7 +51,7 @@ EnterMapAnim:
.flyAnimation
pop hl
call LoadBirdSpriteGraphics
- ld a, $a4 ; SFX_BIRD_FLY
+ ld a, SFX_FLY
call PlaySound
ld hl, wFlyAnimUsingCoordList
xor a ; is using coord list
@@ -104,7 +104,7 @@ _LeaveMapAnim:
dec a
jp nz, LeaveMapThroughHoleAnim
.spinWhileMovingUp
- ld a, $9f ; (SFX_02_4b - SFX_Headers_02) / 3
+ ld a, SFX_TELEPORT_EXIT_1
call PlaySound
ld hl, wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, -$10
@@ -138,7 +138,7 @@ _LeaveMapAnim:
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta
xor a
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue
- ld [hl], $a1 ; SFX_TELEPORT_EXIT_2
+ ld [hl], SFX_TELEPORT_EXIT_2 ; wPlayerSpinInPlaceAnimSoundID
ld hl, wFacingDirectionList
call PlayerSpinInPlace
jr .spinWhileMovingUp
@@ -151,7 +151,7 @@ _LeaveMapAnim:
ld [hli], a ; wFlyAnimCounter
ld [hl], $c ; wFlyAnimBirdSpriteImageIndex
call DoFlyAnimation
- ld a, $a4 ; SFX_FLY
+ ld a, SFX_FLY
call PlaySound
ld hl, wFlyAnimUsingCoordList
xor a ; is using coord list
@@ -253,12 +253,12 @@ DoFlyAnimation:
ret
LoadBirdSpriteGraphics:
- ld de, BirdSprite ; $4d80
+ ld de, BirdSprite
ld b, BANK(BirdSprite)
ld c, $c
ld hl, vNPCSprites
call CopyVideoData
- ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite
+ ld de, BirdSprite + $c0 ; moving animation sprite
ld b, BANK(BirdSprite)
ld c, $0c
ld hl, vNPCSprites2
@@ -392,9 +392,9 @@ FishingAnim:
ld c, 10
call DelayFrames
ld hl, wd736
- set 6, [hl]
+ set 6, [hl] ; reserve the last 4 OAM entries
ld hl, vNPCSprites
- ld de, RedSprite ; $4180
+ ld de, RedSprite
ld b, BANK(RedSprite)
ld c, $c
call CopyVideoData
@@ -422,7 +422,6 @@ FishingAnim:
; there was a bite
; shake the player's sprite vertically
-
ld b, 10
.loop
ld hl, wSpriteStateData1 + 4 ; player's sprite Y screen position
@@ -435,17 +434,19 @@ FishingAnim:
; If the player is facing up, hide the fishing rod so it doesn't overlap with
; the exclamation bubble that will be shown next.
- ld a, [wSpriteStateData1 + 2]
+ ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction
cp SPRITE_FACING_UP
jr nz, .skipHidingFishingRod
ld a, $a0
ld [wOAMBuffer + $9c], a
+
.skipHidingFishingRod
ld hl, wEmotionBubbleSpriteIndex
xor a
ld [hli], a ; player's sprite
ld [hl], a ; EXCLAMATION_BUBBLE
predef EmotionBubble
+
; If the player is facing up, unhide the fishing rod.
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction
cp SPRITE_FACING_UP
@@ -463,7 +464,7 @@ FishingAnim:
call LoadFontTilePatterns
ret
-.ShakePlayerSprite ; 708a3 (1c:48a3)
+.ShakePlayerSprite
ld a, [hl]
xor $1
ld [hl], a
diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm
index 3ee19e8a..655c6b2a 100755
--- a/engine/overworld/trainers.asm
+++ b/engine/overworld/trainers.asm
@@ -57,7 +57,7 @@ _SetSpritePosition1:
_SetSpritePosition2:
ld hl, wSpriteStateData1
- ld de, $4
+ ld de, 4
ld a, [wSpriteIndex]
ld [H_SPRITEINDEX], a
call GetSpriteDataPointer
@@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer:
jr .notInLine ; player too far away
.checkIfLinedUp
ld a, [wTrainerFacingDirection] ; sprite facing direction
- cp SPRITE_FACING_DOWN ; down
+ cp SPRITE_FACING_DOWN
jr z, .checkXCoord
- cp SPRITE_FACING_UP ; up
+ cp SPRITE_FACING_UP
jr z, .checkXCoord
- cp SPRITE_FACING_LEFT ; left
+ cp SPRITE_FACING_LEFT
jr z, .checkYCoord
- cp SPRITE_FACING_RIGHT ; right
+ cp SPRITE_FACING_RIGHT
jr z, .checkYCoord
jr .notInLine
.checkXCoord
diff --git a/engine/palettes.asm b/engine/palettes.asm
index 9418fb72..c6c234ae 100755
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -181,19 +181,15 @@ SetPal_Overworld:
ld a, SET_PAL_OVERWORLD
ld [wDefaultPaletteCommand], a
ret
-
.PokemonTowerOrAgatha
ld a, PAL_GREYMON - 1
jr .town
-
.caveOrBruno
ld a, PAL_CAVE - 1
jr .town
-
.Lorelei
xor a
jr .town
-
.trade_center_colosseum
ld a, PAL_GREYMON - 1
jr .town
@@ -535,9 +531,8 @@ _SendSGBPacket:
; set P14=HIGH, P15=HIGH
ld a, $30
ld [rJOYP], a
- call Wait7000
; wait for about 70000 cycles
-; call Wait7000
+ call Wait7000
; restore (previously pushed) number of packets
pop bc
dec b
@@ -613,6 +608,7 @@ PrepareSuperNintendoVRAMTransfer:
dw DataSnd_72911
CheckSGB:
+; Returns whether the game is running on an SGB in carry.
ld hl, MltReq2Packet
call SendSGBPacket
call Wait7000
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 8b26706a..e752a7ef 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -61,7 +61,7 @@ PredefPointers::
add_predef CopyDownscaledMonTiles
add_predef Func_f0a7
add_predef HealParty
- add_predef MoveAnimation ; 08 play move animation (1e:4d97)
+ add_predef MoveAnimation
add_predef DivideBCDPredef
add_predef DivideBCDPredef2
add_predef AddBCDPredef
@@ -116,7 +116,7 @@ PredefPointers::
add_predef InternalClockTradeAnim
add_predef TrainerEngage
add_predef IndexToPokedex
- add_predef DisplayPicCenteredOrUpperRight ; 3B display pic? (01:600d)
+ add_predef DisplayPicCenteredOrUpperRight
add_predef UsedCut
add_predef ShowPokedexData
add_predef WriteMonMoves
@@ -127,21 +127,21 @@ PredefPointers::
add_predef CanLearnTM
add_predef TMToMove
add_predef _RunPaletteCommand
- add_predef StarterDex ; 46 (17:40d4)
+ add_predef StarterDex
add_predef _AddPartyMon
add_predef UpdateHPBar2
add_predef DrawEnemyHUDAndHPBar
add_predef LoadTownMap_Nest
add_predef PrintMonType
- add_predef EmotionBubble ; 4C player exclamation (10:516f)
- add_predef EmptyFunc3 ; return immediately (01:5b63)
+ add_predef EmotionBubble
+ add_predef EmptyFunc3 ; return immediately
add_predef AskName
add_predef PewterGuys
add_predef SaveSAVtoSRAM2
add_predef LoadSAV2
add_predef LoadSAV
add_predef SaveSAVtoSRAM1
- add_predef DoInGameTradeDialogue ; 54 initiate trade (1c:5b86)
+ add_predef DoInGameTradeDialogue
add_predef HallOfFamePC
add_predef DisplayDexRating
@@ -149,14 +149,13 @@ PredefPointers::
predef_const EnterMapAnim
dbw $1E, _LeaveMapAnim ; wrong bank
dbw $1E, EnterMapAnim ; wrong bank
-
add_predef GetTileTwoStepsInFrontOfPlayer
add_predef CheckForCollisionWhenPushingBoulder
add_predef PrintStrengthTxt
add_predef PickUpItem
add_predef PrintMoveType
add_predef LoadMovePPs
- add_predef DrawHP ; 5F (04:5468)
+ add_predef DrawHP
add_predef DrawHP2
add_predef DisplayElevatorFloorMenu
add_predef OaksAideScript
diff --git a/engine/save.asm b/engine/save.asm
index 171fd055..bb2193a2 100755
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -261,7 +261,7 @@ SaveSAVtoSRAM2:
ld [sMainDataCheckSum], a
call DisableSRAMAndPrepareClockData
ret
-;;;
+
SaveSAVtoSRAM:
ld a, $2
ld [wSaveFileStatus], a
diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm
index c4dff73c..2cfcc445 100755
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -31,7 +31,7 @@ DisplayTitleScreen:
call DisableLCD
call LoadFontTilePatterns
; todo: fix hl pointers
- ld hl, NintendoCopyrightLogoGraphics ; 4:4c48
+ ld hl, NintendoCopyrightLogoGraphics
ld de, vTitleLogo + $600
ld bc, $50
ld a, BANK(NintendoCopyrightLogoGraphics)
@@ -91,7 +91,7 @@ DisplayTitleScreen:
call .ScrollTitleScreenPokemonLogo
jr .bouncePokemonLogoLoop
-.TitleScreenPokemonLogoYScrolls ; 4228 (1:4228)
+.TitleScreenPokemonLogoYScrolls:
; Controls the bouncing effect of the Pokemon logo on the title screen
db -4,16 ; y scroll amount, number of times to scroll
db 3,4
@@ -102,7 +102,7 @@ DisplayTitleScreen:
db -1,2
db 0 ; terminate list with 0
-.ScrollTitleScreenPokemonLogo ; 4237 (1:4237)
+.ScrollTitleScreenPokemonLogo:
; Scrolls the Pokemon logo on the title screen to create the bouncing effect
; Scrolls d pixels e times
call DelayFrame
diff --git a/engine/titlescreen2.asm b/engine/titlescreen2.asm
index 92282b83..8b4bc4de 100755
--- a/engine/titlescreen2.asm
+++ b/engine/titlescreen2.asm
@@ -69,7 +69,7 @@ _TitleScroll:
pop bc
jr _TitleScroll
-.ScrollBetween ; 374ec (d:74ec)
+.ScrollBetween:
.wait
ld a, [rLY] ; rLY
cp l
diff --git a/engine/town_map.asm b/engine/town_map.asm
index 65a10912..cf09be7c 100755
--- a/engine/town_map.asm
+++ b/engine/town_map.asm
@@ -27,7 +27,7 @@ DisplayTownMap:
pop af
jr .enterLoop
-.townMapLoop ; 70ef4 (1c:4ef4)
+.townMapLoop
coord hl, 0, 0
lb bc, 1, 20
call ClearScreenArea
@@ -37,7 +37,7 @@ DisplayTownMap:
ld b, 0
add hl, bc
ld a, [hl]
-.enterLoop ; 70f08 (1c:4f08)
+.enterLoop
ld de, wTownMapCoords
call LoadTownMapEntry
ld a, [de]
@@ -69,7 +69,7 @@ DisplayTownMap:
ld b, a
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop
- ld a, $8c
+ ld a, SFX_TINK
call PlaySound
bit 6, b
jr nz, .pressedUp
@@ -84,7 +84,6 @@ DisplayTownMap:
pop af
ld [hl], a
ret
-
.pressedUp
ld a, [wWhichTownMapLocation]
inc a
@@ -149,7 +148,7 @@ LoadTownMap_Fly:
ld [hJoy7], a
call LoadPlayerSpriteGraphics
call LoadFontTilePatterns
- ld de, BirdSprite ; $4d80
+ ld de, BirdSprite
ld b, BANK(BirdSprite)
ld c, $c
ld hl, vSprites + $40
@@ -205,7 +204,7 @@ LoadTownMap_Fly:
jr z, .inputLoop
bit 0, b
jr nz, .pressedA
- ld a, $8c ; SFX_TINK
+ ld a, SFX_TINK
call PlaySound
bit 6, b
jr nz, .pressedUp
@@ -213,7 +212,7 @@ LoadTownMap_Fly:
jr nz, .pressedDown
jr .pressedB
.pressedA
- ld a, $8e ; SFX_HEAL_AILMENT
+ ld a, SFX_HEAL_AILMENT
call PlaySound
ld a, [hl]
ld [wDestinationMap], a
@@ -299,7 +298,7 @@ LoadTownMap:
ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
ld a, BANK(WorldMapTileGraphics)
call FarCopyData
- ld hl, MonNestIcon ; $574b
+ ld hl, MonNestIcon
ld de, vSprites + $40
ld bc, MonNestIconEnd - MonNestIcon
ld a, BANK(MonNestIcon)
@@ -366,12 +365,12 @@ DrawPlayerOrBirdSprite:
call WritePlayerOrBirdSpriteOAM
pop hl
ld de, wcd6d
-.asm_71266
+.loop
ld a, [hli]
ld [de], a
inc de
cp "@"
- jr nz, .asm_71266
+ jr nz, .loop
ld hl, wOAMBuffer
ld de, wTileMapBackup
ld bc, $a0
@@ -465,7 +464,7 @@ WriteTownMapSpriteOAM:
pop hl
WriteAsymmetricMonPartySpriteOAM:
-; Writes 4 OAM blocks for a helix mon party sprite, since is does not have
+; Writes 4 OAM blocks for a helix mon party sprite, since it does not have
; a vertical line of symmetry.
lb de, 2, 2
.loop
@@ -483,14 +482,14 @@ WriteAsymmetricMonPartySpriteOAM:
xor a
ld [hli], a
inc d
- ld a, $8
+ ld a, 8
add c
ld c, a
dec e
jr nz, .innerLoop
pop bc
pop de
- ld a, $8
+ ld a, 8
add b
ld b, a
dec d
@@ -592,14 +591,9 @@ LoadTownMapEntry:
ld l, a
ret
-; ExternalMapEntries:
- ; dr $7139c,$7140b
-; InternalMapEntries:
- ; dr $7140b,$7174b
-
INCLUDE "data/town_map_entries.asm"
-INCLUDE "text/map_names.asm" ; TODO: relabel addresses
+INCLUDE "text/map_names.asm"
MonNestIcon:
INCBIN "gfx/mon_nest_icon.1bpp"
diff --git a/engine/trade.asm b/engine/trade.asm
index bbd43779..2476ca78 100755
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -253,7 +253,7 @@ Trade_ShowPlayerMon:
ld [hSCX], a
dec a
dec a
- and a ; useless since flags are updated with dec a
+ and a
jr nz, .slideScreenLoop
call Trade_Delay80
ld a, TRADE_BALL_POOF_ANIM