ref: 91f914718a263839daef24d44eda857bfc7cca95
parent: 364854623267a8a39242243b0cdf80144e868642
parent: 6e44095c2aadd2f07a716db6dacfc3ce2fa83658
author: yenatch <yenatch@gmail.com>
date: Sun Jun 24 18:38:08 EDT 2018
Merge pull request #530 from Rangi42/master [RTM] Finish removing address comments, split out mart_constants.asm, and other tweaks
--- a/constants.asm
+++ b/constants.asm
@@ -28,6 +28,7 @@
INCLUDE "constants/map_data_constants.asm"
INCLUDE "constants/map_object_constants.asm"
INCLUDE "constants/map_setup_constants.asm"
+INCLUDE "constants/mart_constants.asm"
INCLUDE "constants/menu_constants.asm"
INCLUDE "constants/mobile_constants.asm"
INCLUDE "constants/move_constants.asm"
--- a/constants/item_data_constants.asm
+++ b/constants/item_data_constants.asm
@@ -129,49 +129,3 @@
const HELD_BRIGHTPOWDER
const HELD_78
const HELD_FOCUS_BAND
-
-
-; mart types (see engine/items/mart.asm)
- const_def
- const MARTTYPE_STANDARD
- const MARTTYPE_BITTER
- const MARTTYPE_BARGAIN
- const MARTTYPE_PHARMACY
- const MARTTYPE_ROOFTOP
-
-; Marts indexes (see data/items/marts.asm)
- const_def
- const MART_CHERRYGROVE
- const MART_CHERRYGROVE_DEX
- const MART_VIOLET
- const MART_AZALEA
- const MART_CIANWOOD
- const MART_GOLDENROD_2F_1
- const MART_GOLDENROD_2F_2
- const MART_GOLDENROD_3F
- const MART_GOLDENROD_4F
- const MART_GOLDENROD_5F_1
- const MART_GOLDENROD_5F_2
- const MART_GOLDENROD_5F_3
- const MART_GOLDENROD_5F_4
- const MART_OLIVINE
- const MART_ECRUTEAK
- const MART_MAHOGANY_1
- const MART_MAHOGANY_2
- const MART_BLACKTHORN
- const MART_VIRIDIAN
- const MART_PEWTER
- const MART_CERULEAN
- const MART_LAVENDER
- const MART_VERMILION
- const MART_CELADON_2F_1
- const MART_CELADON_2F_2
- const MART_CELADON_3F
- const MART_CELADON_4F
- const MART_CELADON_5F_1
- const MART_CELADON_5F_2
- const MART_FUCHSIA
- const MART_SAFFRON
- const MART_MT_MOON
- const MART_INDIGO_PLATEAU
- const MART_UNDERGROUND
--- /dev/null
+++ b/constants/mart_constants.asm
@@ -1,0 +1,44 @@
+; mart types (see engine/items/mart.asm)
+ const_def
+ const MARTTYPE_STANDARD
+ const MARTTYPE_BITTER
+ const MARTTYPE_BARGAIN
+ const MARTTYPE_PHARMACY
+ const MARTTYPE_ROOFTOP
+
+; Marts indexes (see data/items/marts.asm)
+ const_def
+ const MART_CHERRYGROVE
+ const MART_CHERRYGROVE_DEX
+ const MART_VIOLET
+ const MART_AZALEA
+ const MART_CIANWOOD
+ const MART_GOLDENROD_2F_1
+ const MART_GOLDENROD_2F_2
+ const MART_GOLDENROD_3F
+ const MART_GOLDENROD_4F
+ const MART_GOLDENROD_5F_1
+ const MART_GOLDENROD_5F_2
+ const MART_GOLDENROD_5F_3
+ const MART_GOLDENROD_5F_4
+ const MART_OLIVINE
+ const MART_ECRUTEAK
+ const MART_MAHOGANY_1
+ const MART_MAHOGANY_2
+ const MART_BLACKTHORN
+ const MART_VIRIDIAN
+ const MART_PEWTER
+ const MART_CERULEAN
+ const MART_LAVENDER
+ const MART_VERMILION
+ const MART_CELADON_2F_1
+ const MART_CELADON_2F_2
+ const MART_CELADON_3F
+ const MART_CELADON_4F
+ const MART_CELADON_5F_1
+ const MART_CELADON_5F_2
+ const MART_FUCHSIA
+ const MART_SAFFRON
+ const MART_MT_MOON
+ const MART_INDIGO_PLATEAU
+ const MART_UNDERGROUND
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -158,6 +158,7 @@
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
+FISHGROUP_DATA_LENGTH EQU 1 + 2 * 3
NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm)
--- a/data/collision_permissions.asm
+++ b/data/collision_permissions.asm
@@ -1,7 +1,7 @@
NONTALKABLE EQUS "db"
TALKABLE EQUS "db TALK +"
-TileCollisionTable:: ; 4ce1f
+TileCollisionTable::
; entries correspond to COLL_* constants
NONTALKABLE LANDTILE ; COLL_FLOOR
NONTALKABLE LANDTILE ; COLL_01
@@ -259,4 +259,3 @@
NONTALKABLE LANDTILE ; fd
NONTALKABLE LANDTILE ; fe
NONTALKABLE WALLTILE ; COLL_FF
-; 4cf1f
--- /dev/null
+++ b/data/pokemon/unused_pic_banks.asm
@@ -1,0 +1,17 @@
+; This was a table of Pokémon sprite banks in the 1997 G/S prototype.
+; See pokegold-spaceworld's gfx/pokemon/pkmn_pic_banks.asm.
+
+Unreferenced_MonPicBanks:
+ ; last mon in bank, bank #
+ db RAICHU, $15 + 0
+ db DUGTRIO, $15 + 1
+ db GRAVELER, $15 + 2
+ db KRABBY, $15 + 3
+ db STARMIE, $15 + 4
+ db ARTICUNO, $15 + 5
+ db ARIADOS, $15 + 6 ; JARANRA in pokegold-spaceworld
+ db ESPEON, $15 + 7 ; KOUNYA in pokegold-spaceworld
+ db OCTILLERY, $15 + 8 ; BOMBSEEKER in pokegold-spaceworld
+ db LARVITAR, $15 + 9 ; NYULA in pokegold-spaceworld
+ db $ff, $15 + 10
+ db $ff, $15 + 11
--- a/data/unused_53d84.asm
+++ /dev/null
@@ -1,13 +1,0 @@
-Unreferenced_53d84:
- db $1a, $15
- db $33, $16
- db $4b, $17
- db $62, $18
- db $79, $19
- db $90, $1a
- db $a8, $1b
- db $c4, $1c
- db $e0, $1d
- db $f6, $1e
- db $ff, $1f
- db $ff, $20
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -162,7 +162,7 @@
This is a bug with `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm):
```asm
-BattleCommand_BellyDrum: ; 37c1a
+BattleCommand_BellyDrum:
; bellydrum
; This command is buggy because it raises the user's attack
; before checking that it has enough HP to use the move.
@@ -180,7 +180,7 @@
**Fix:**
```asm
-BattleCommand_BellyDrum: ; 37c1a
+BattleCommand_BellyDrum:
; bellydrum
callfar GetHalfMaxHP
callfar CheckUserHasEnoughHP
@@ -293,7 +293,7 @@
This is a bug with `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```asm
-CheckHiddenOpponent: ; 37daa
+CheckHiddenOpponent:
; BUG: This routine should account for Lock-On and Mind Reader.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -390,7 +390,7 @@
This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect.
```asm
-BattleCommand_BeatUpFailText: ; 355b5
+BattleCommand_BeatUpFailText:
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
@@ -403,7 +403,7 @@
**Fix:**
```asm
-BattleCommand_BeatUpFailText: ; 355b5
+BattleCommand_BeatUpFailText:
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
@@ -428,7 +428,7 @@
This is a bug with `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm):
```asm
-BattleCommand_Present: ; 37874
+BattleCommand_Present:
; present
ld a, [wLinkMode]
@@ -451,7 +451,7 @@
**Fix:**
```asm
-BattleCommand_Present: ; 37874
+BattleCommand_Present:
; present
push bc
@@ -484,13 +484,13 @@
In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```asm
-BattleCheckTypeMatchup: ; 347c8
+BattleCheckTypeMatchup:
ld hl, wEnemyMonType1
ld a, [hBattleTurn]
and a
jr z, CheckTypeMatchup
ld hl, wBattleMonType1
-CheckTypeMatchup: ; 347d3
+CheckTypeMatchup:
; There is an incorrect assumption about this function made in the AI related code: when
; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
; offensive type in a will make this function do the right thing. Since a is overwritten,
@@ -515,7 +515,7 @@
This is a bug with `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battle/ai/items.asm):
```asm
-AI_HealStatus: ; 384e0
+AI_HealStatus:
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
ld bc, PARTYMON_STRUCT_LENGTH
@@ -530,7 +530,6 @@
ld hl, wEnemySubStatus5
res SUBSTATUS_TOXIC, [hl]
ret
-; 384f7
```
**Fix:** Uncomment `ld hl, wEnemySubStatus1` and `res SUBSTATUS_NIGHTMARE, [hl]`.
@@ -600,7 +599,7 @@
This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm):
```asm
-CalcExpAtLevel: ; 50e47
+CalcExpAtLevel:
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, [wBaseGrowthRate]
add a
@@ -614,7 +613,7 @@
**Fix:**
```asm
-CalcExpAtLevel: ; 50e47
+CalcExpAtLevel:
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, d
cp 1
@@ -821,7 +820,7 @@
INCLUDE "data/events/happiness_probabilities.asm"
-CopyPokemonName_Buffer1_Buffer3: ; 746e
+CopyPokemonName_Buffer1_Buffer3:
ld hl, wStringBuffer1
ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH
@@ -831,7 +830,7 @@
In [data/events/happiness_probabilities.asm](/data/events/happiness_probabilities.asm):
```asm
-HappinessData_DaisysGrooming: ; 746b
+HappinessData_DaisysGrooming:
db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance
```
@@ -838,7 +837,7 @@
**Fix:**
```asm
-HappinessData_DaisysGrooming: ; 746b
+HappinessData_DaisysGrooming:
db $80, 2, HAPPINESS_GROOMING ; 50% chance
db $ff, 2, HAPPINESS_GROOMING ; 50% chance
```
@@ -916,7 +915,7 @@
This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](/engine/events/magikarp.asm):
```asm
-.BCLessThanDE: ; fbc9a
+.BCLessThanDE:
; Intention: Return bc < de.
; Reality: Return b < d.
ld a, b
@@ -926,7 +925,6 @@
ld a, c
cp e
ret
-; fbca1
```
**Fix:** Delete `ret nc`.
@@ -939,7 +937,7 @@
This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm
-StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
+StartTrainerBattle_DetermineWhichAnimation:
; The screen flashes a different number of times depending on the level of
; your lead Pokemon relative to the opponent's.
; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever
@@ -966,15 +964,13 @@
ld a, [hl]
ld [wJumptableIndex], a
ret
-; 8c38f (23:438f)
-.StartingPoints: ; 8c38f
+.StartingPoints:
; entries correspond to TRANS_* constants
db BATTLETRANSITION_CAVE
db BATTLETRANSITION_CAVE_STRONGER
db BATTLETRANSITION_NO_CAVE
db BATTLETRANSITION_NO_CAVE_STRONGER
-; 8c393
```
*To do:* Fix this bug.
@@ -1108,7 +1104,7 @@
The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm):
```asm
-.Cry: ; 40340
+.Cry:
call Pokedex_GetSelectedMon
ld a, [wd265]
call GetCryIndex
@@ -1121,7 +1117,7 @@
**Workaround:**
```asm
-.Cry: ; 40340
+.Cry:
ld a, [wCurPartySpecies]
call PlayMonCry
ret
@@ -1365,7 +1361,7 @@
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
```asm
-.DetermineCompatibility: ; 50268
+.DetermineCompatibility:
ld de, wStringBuffer1
ld a, BANK(EvosAttacksPointers)
ld bc, 2
@@ -1461,7 +1457,7 @@
In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm):
```asm
-LoadSpriteGFX: ; 14306
+LoadSpriteGFX:
; Bug: b is not preserved, so it's useless as a next count.
; Uncomment the lines below to fix.
@@ -1487,7 +1483,6 @@
; pop bc
ld a, l
ret
-; 1431e
```
**Fix:** Uncomment `push bc` and `pop bc`.
@@ -1498,7 +1493,7 @@
In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm):
```asm
-ChooseWildEncounter: ; 2a14f
+ChooseWildEncounter:
...
ld a, b
ld [wCurPartyLevel], a
@@ -1513,7 +1508,7 @@
...
-ValidateTempWildMonSpecies: ; 2a4a0
+ValidateTempWildMonSpecies:
; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a.
```
@@ -1564,7 +1559,7 @@
In [engine/events/bug_contest/contest_2.asm](/engine/events/bug_contest/contest_2.asm):
```asm
-CheckBugContestContestantFlag: ; 139ed
+CheckBugContestContestantFlag:
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
; Bug: If a >= NUM_BUG_CONTESTANTS when this is called,
@@ -1581,7 +1576,6 @@
ld b, CHECK_FLAG
call EventFlagAction
ret
-; 139fe
INCLUDE "data/events/bug_contest_flags.asm"
```
@@ -1594,7 +1588,7 @@
In [home/init.asm](/home/init.asm):
```asm
-ClearWRAM:: ; 25a
+ClearWRAM::
; Wipe swappable WRAM banks (1-7)
; Assumes CGB or AGB
@@ -1611,7 +1605,6 @@
cp 8
jr nc, .bank_loop ; Should be jr c
ret
-; 270
```
**Fix:** Change `jr nc, .bank_loop` to `jr c, .bank_loop`.
--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -28,7 +28,7 @@
The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm):
```asm
-FixPicBank: ; 511c5
+FixPicBank:
; This is a thing for some reason.
PICS_FIX EQU $36
@@ -46,7 +46,7 @@
pop hl
ret
-.PicsBanks: ; 511d4
+.PicsBanks:
db BANK("Pics 1") ; BANK("Pics 1") + 0
db BANK("Pics 2") ; BANK("Pics 1") + 1
db BANK("Pics 3") ; BANK("Pics 1") + 2
@@ -298,7 +298,7 @@
`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](/engine/items/items.asm) have to compensate for this:
```asm
-GetTMHMNumber:: ; d407
+GetTMHMNumber::
; Return the number of a TM/HM by item id c.
ld a, c
; Skip any dummy items.
@@ -315,7 +315,7 @@
ld c, a
ret
-GetNumberedTMHM: ; d417
+GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
; Skip any gaps.
@@ -341,7 +341,7 @@
Modify engine/items/items.asm:
```asm
-GetTMHMNumber:: ; d407
+GetTMHMNumber::
; Return the number of a TM/HM by item id c.
ld a, c
sub TM01
@@ -349,7 +349,7 @@
ld c, a
ret
-GetNumberedTMHM: ; d417
+GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
add TM01
@@ -366,7 +366,7 @@
Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
```asm
-GetDexEntryPointer: ; 44333
+GetDexEntryPointer:
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
@@ -460,7 +460,7 @@
`_Sine` in [engine/math/sine.asm](/engine/math/sine.asm):
```asm
-_Sine:: ; 84d9
+_Sine::
; a = d * sin(e * pi/32)
ld a, e
calc_sine_wave
@@ -469,11 +469,11 @@
`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](/engine/gfx/sprites.asm):
```asm
-Sprites_Cosine: ; 8e72a
+Sprites_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
-Sprites_Sine: ; 8e72c
+Sprites_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave
```
@@ -481,37 +481,34 @@
`BattleAnim_Cosine` and `BattleAnim_Sine` in [engine/battle_anims/functions.asm](/engine/battle_anims/functions.asm):
```asm
-BattleAnim_Cosine: ; ce732 (33:6732)
+BattleAnim_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
-BattleAnim_Sine: ; ce734 (33:6734)
+BattleAnim_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave BattleAnimSineWave
...
-BattleAnimSineWave: ; ce77f
+BattleAnimSineWave:
sine_table 32
-; ce7bf
```
`StartTrainerBattle_DrawSineWave` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm
-StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
+StartTrainerBattle_DrawSineWave:
calc_sine_wave
-; 8c768
```
And `CelebiEvent_Cosine` in [engine/events/celebi.asm](/engine/events/celebi.asm):
```asm
-CelebiEvent_Cosine: ; 49b3b (12:5b3b)
+CelebiEvent_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
calc_sine_wave
-; 49bae
```
They all rely on `calc_sine_wave` in [macros/code.asm](/macros/code.asm):
@@ -586,7 +583,7 @@
In [engine/tilesets/tileset_anims.asm](/engine/tilesets/tileset_anims.asm):
```asm
-GetForestTreeFrame: ; fc54c
+GetForestTreeFrame:
; Return 0 if a is even, or 2 if odd.
and a
jr z, .even
@@ -609,16 +606,14 @@
.even
xor a
ret
-; fc56d
```
**Fix:**
```asm
-GetForestTreeFrame: ; fc54c
+GetForestTreeFrame:
; Return 0 if a is even, or 2 if odd.
and 1
add a
ret
-; fc56d
```
--- a/docs/menu.md
+++ b/docs/menu.md
@@ -54,8 +54,8 @@
```
All of them:
-[MenuSelection] = Current item. -1 is the CANCEL item.
-[MenuSelectionQuantity] = Quantity of the current item.
+[wMenuSelection] = Current item. -1 is the CANCEL item.
+[wMenuSelectionQuantity] = Quantity of the current item.
Function1: Called to display a menu entry.
de = Cursor position in TileMap
@@ -90,7 +90,7 @@
...
```
-In case it's 1, `[MenuSelectionQuantity]` will simply contain the next entry.
+In case it's 1, `[wMenuSelectionQuantity]` will simply contain the next entry.
## `_2DMenu`
@@ -208,7 +208,7 @@
Call state for `DisplayFunction`:
```
-[MenuSelection] = Current item. -1 is the CANCEL item.
+[wMenuSelection] = Current item. -1 is the CANCEL item.
de = Cursor position in TileMap
```
--- a/engine/battle/move_effects/present.asm
+++ b/engine/battle/move_effects/present.asm
@@ -32,12 +32,12 @@
.next
ld a, [hli]
cp -1
- jr z, .heal_effect ; 378a4 $11
+ jr z, .heal_effect
cp b
- jr nc, .got_power ; 378a7 $4
+ jr nc, .got_power
inc c
inc hl
- jr .next ; 378ab $f4
+ jr .next
.got_power
ld a, c
@@ -56,12 +56,12 @@
ld hl, AICheckPlayerMaxHP
ld a, [hBattleTurn]
and a
- jr z, .got_hp_fn_pointer ; 378c9 $3
+ jr z, .got_hp_fn_pointer
ld hl, AICheckEnemyMaxHP
.got_hp_fn_pointer
ld a, BANK(AICheckPlayerMaxHP)
rst FarCall
- jr c, .already_fully_healed ; 378d1 $20
+ jr c, .already_fully_healed
ld hl, GetQuarterMaxHP
call CallBattleCore
@@ -73,12 +73,12 @@
call StdBattleTextBox
call BattleCommand_SwitchTurn
call UpdateOpponentInParty
- jr .do_animation ; 378f1 $11
+ jr .do_animation
.already_fully_healed
call BattleCommand_SwitchTurn
call _CheckBattleScene
- jr nc, .do_animation ; 378f9 $9
+ jr nc, .do_animation
call AnimateFailedMove
ld hl, RefusedGiftText
call StdBattleTextBox
--- a/engine/events/fish.asm
+++ b/engine/events/fish.asm
@@ -11,7 +11,7 @@
call GetFishGroupIndex
ld hl, FishGroups
-rept 7
+rept FISHGROUP_DATA_LENGTH
add hl, de
endr
call .Fish
--- a/engine/gfx/crystal_layouts.asm
+++ b/engine/gfx/crystal_layouts.asm
@@ -1,4 +1,4 @@
-GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile)
+GetMysteryGift_MobileAdapterLayout:
ld a, b
cp SCGB_RAM
jr nz, .not_ram
--- a/engine/gfx/player_gfx.asm
+++ b/engine/gfx/player_gfx.asm
@@ -72,7 +72,7 @@
INCLUDE "data/player_names.asm"
-GetPlayerNameArray: ; 88318 This Function is never called
+Unreferenced_GetPlayerNameArray:
ld hl, wPlayerName
ld de, MalePlayerNameArray
ld a, [wPlayerGender]
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -26,7 +26,7 @@
MartDialog:
ld a, 0
ld [wEngineBuffer1], a
- xor a
+ xor a ; STANDARDMART_HOWMAYIHELPYOU
ld [wEngineBuffer5], a
call StandardMart
ret
@@ -103,7 +103,7 @@
ld [wMartPointer + 1], a
ld hl, wCurMart
xor a
- ld bc, 16
+ ld bc, wCurMartEnd - wCurMart
call ByteFill
xor a
ld [wEngineBuffer5], a
@@ -129,6 +129,15 @@
ld b, BANK(Marts)
ret
+; StandardMart.MartFunctions indexes
+ const_def
+ const STANDARDMART_HOWMAYIHELPYOU ; 0
+ const STANDARDMART_TOPMENU ; 1
+ const STANDARDMART_BUY ; 2
+ const STANDARDMART_SELL ; 3
+ const STANDARDMART_QUIT ; 4
+ const STANDARDMART_ANYTHINGELSE ; 5
+
StandardMart:
.loop
ld a, [wEngineBuffer5]
@@ -135,11 +144,12 @@
ld hl, .MartFunctions
rst JumpTable
ld [wEngineBuffer5], a
- cp $ff
+ cp -1
jr nz, .loop
ret
.MartFunctions:
+; entries correspond to STANDARDMART_* constants
dw .HowMayIHelpYou
dw .TopMenu
dw .Buy
@@ -151,7 +161,7 @@
call LoadStandardMenuHeader
ld hl, Text_Mart_HowMayIHelpYou
call PrintText
- ld a, $1 ; top menu
+ ld a, STANDARDMART_TOPMENU
ret
.TopMenu:
@@ -165,13 +175,13 @@
cp $2
jr z, .sell
.quit
- ld a, $4 ; Come again!
+ ld a, STANDARDMART_QUIT
ret
.buy
- ld a, $2 ; buy
+ ld a, STANDARDMART_BUY
ret
.sell
- ld a, $3 ; sell
+ ld a, STANDARDMART_SELL
ret
.Buy:
@@ -179,13 +189,13 @@
call FarReadMart
call BuyMenu
and a
- ld a, $5 ; Anything else?
+ ld a, STANDARDMART_ANYTHINGELSE
ret
.Sell:
call ExitMenu
call SellMenu
- ld a, $5 ; Anything else?
+ ld a, STANDARDMART_ANYTHINGELSE
ret
.Quit:
@@ -192,7 +202,7 @@
call ExitMenu
ld hl, Text_Mart_ComeAgain
call MartTextBox
- ld a, $ff ; exit
+ ld a, -1
ret
.AnythingElse:
@@ -199,7 +209,7 @@
call LoadStandardMenuHeader
ld hl, Text_Mart_AnythingElse
call PrintText
- ld a, $1 ; top menu
+ ld a, STANDARDMART_TOPMENU
ret
FarReadMart:
@@ -444,7 +454,7 @@
jr c, .cancel
ld de, wMoney
ld bc, hMoneyTemp
- ld a, $3 ; useless load
+ ld a, 3 ; useless load
call CompareMoney
jr c, .insufficient_funds
ld hl, wNumItems
@@ -452,7 +462,7 @@
jr nc, .insufficient_bag_space
ld a, [wMartItemID]
ld e, a
- ld d, $0
+ ld d, 0
ld b, SET_FLAG
ld hl, wBargainShopFlags
call FlagAction
@@ -508,7 +518,7 @@
ld [wItemQuantityChangeBuffer], a
ld a, [wMartItemID]
ld e, a
- ld d, $0
+ ld d, 0
ld b, CHECK_FLAG
ld hl, wBargainShopFlags
call FlagAction
@@ -517,7 +527,7 @@
jr nz, .SoldOut
ld a, [wMartItemID]
ld e, a
- ld d, $0
+ ld d, 0
ld hl, wMartPointer
ld a, [hli]
ld h, [hl]
--- a/engine/link/link_2.asm
+++ b/engine/link/link_2.asm
@@ -66,11 +66,11 @@
add hl, de
.loop
push hl
- ld a, "┌"
+ ld a, $79
ld [hli], a
ld a, " "
call .PlaceRow
- ld [hl], "─"
+ ld [hl], $7a
pop hl
ld de, SCREEN_WIDTH
add hl, de
@@ -77,11 +77,11 @@
dec b
jr nz, .loop
- ld a, "┐"
+ ld a, $7b
ld [hli], a
- ld a, "│"
+ ld a, $7c
call .PlaceRow
- ld [hl], "└"
+ ld [hl], $7d
ret
.PlaceRow:
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -925,7 +925,7 @@
NamingScreenGFX_UnderLine:
INCBIN "gfx/naming_screen/underline.1bpp"
-_ComposeMailMessage: ; 11e75 (mail?)
+_ComposeMailMessage:
ld hl, wNamingScreenDestinationPointer
ld [hl], e
inc hl
--- a/engine/overworld/map_object_action.asm
+++ b/engine/overworld/map_object_action.asm
@@ -190,7 +190,7 @@
ld [hl], FACING_SHADOW
ret
-SetFacingEmote: ; 4582 emote
+SetFacingEmote:
ld hl, OBJECT_FACING_STEP
add hl, bc
ld [hl], FACING_EMOTE
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -2159,7 +2159,8 @@
jr nz, .loop
ret
-Function5602: ; 5602, called at battle start
+Function5602:
+; called at battle start
call Function5645 ; clear sprites
ld a, PLAYER
call Function5629 ; respawn player
--- a/engine/overworld/wildmons.asm
+++ b/engine/overworld/wildmons.asm
@@ -86,7 +86,7 @@
ld a, [hli]
ld c, a
inc hl
- ld a, 3
+ ld a, NUM_WATERMON
call .SearchMapForMon
jr nc, .next_water
ld [de], a
@@ -94,7 +94,7 @@
.next_water
pop hl
- ld bc, 3 * 3
+ ld bc, WATER_WILDDATA_LENGTH
add hl, bc
jr .FindWater
@@ -264,7 +264,7 @@
inc hl
inc hl
ld a, [wTimeOfDay]
- ld bc, $e
+ ld bc, NUM_GRASSMON * 2
call AddNTimes
ld de, GrassMonProbTable
@@ -655,7 +655,7 @@
jr nc, .update_loop ; invalid index, try again
inc hl
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
add hl, bc
ld a, [wRoamMons_LastMapGroup]
@@ -796,7 +796,7 @@
jr z, .randloop1
dec a
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
add hl, bc
; We now have the pointer to one of the last (rarest) three wild Pokemon found in that area.
@@ -870,7 +870,7 @@
call Random
and %11
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
add hl, bc
inc hl
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -226,13 +226,13 @@
ld [wJumptableIndex], a
ret
-BillsPCDepositMenuHeader: ; 0xe253d (38:653d)
+BillsPCDepositMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 9, 4, SCREEN_WIDTH - 1, 13
dw .MenuData
db 1 ; default option
-.MenuData: ; 0xe2545 (38:6545)
+.MenuData:
db STATICMENU_CURSOR ; flags
db 4 ; items
db "DEPOSIT@"
@@ -239,7 +239,6 @@
db "STATS@"
db "RELEASE@"
db "CANCEL@"
-; 0xe2564 (38:6564)
Unreferenced_BillsPCClearThreeBoxes:
hlcoord 0, 0
@@ -405,7 +404,7 @@
ld l, a
jp hl
-.dw ; e2699 (38:6699) #mark
+.dw
dw .withdraw ; Withdraw
dw .stats ; Stats
dw .release ; Release
--- a/engine/printer/printer_serial.asm
+++ b/engine/printer/printer_serial.asm
@@ -27,7 +27,7 @@
ld l, a
jp hl
-.Jumptable: ; 84031 (21:4031)
+.Jumptable:
dw Print_InitPrinterHandshake ; 00
dw Printer_CheckConnectionStatus ; 01
dw Printer_WaitSerial ; 02
--- a/home/menu_window.asm
+++ b/home/menu_window.asm
@@ -41,7 +41,7 @@
ld [hli], a
dec de
dec c
- jr nz, .col ; 0x1c3b $fa
+ jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
@@ -48,7 +48,7 @@
add hl, bc
pop bc
dec b
- jr nz, .row ; 0x1c44 $ef
+ jr nz, .row
ret
@@ -60,7 +60,7 @@
ld [de], a
inc de
dec b
- jr nz, .loop ; 0x1c50 $fa
+ jr nz, .loop
ret
GetMenuBoxDims::
--- a/home/scrolling_menu.asm
+++ b/home/scrolling_menu.asm
@@ -40,7 +40,7 @@
pop bc
jp TextBox
-JoyTextDelay_ForcehJoyDown:: ; 354b joypad
+JoyTextDelay_ForcehJoyDown::
call DelayFrame
ld a, [hInMenu]
--- a/main.asm
+++ b/main.asm
@@ -264,7 +264,7 @@
INCLUDE "engine/pokemon/move_mon_wo_mail.asm"
INCLUDE "data/pokemon/base_stats.asm"
INCLUDE "data/pokemon/names.asm"
-INCLUDE "data/unused_53d84.asm"
+INCLUDE "data/pokemon/unused_pic_banks.asm"
UnknownEggPic::
; Another egg pic. This is shifted up a few pixels.
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -1035,7 +1035,7 @@
ld a, $18
ld [hli], a
dec c
- jr nz, .asm_89713 ; 0x8971c $f5
+ jr nz, .asm_89713
ret
Function8971f:
--- a/mobile/mobile_41.asm
+++ b/mobile/mobile_41.asm
@@ -810,7 +810,8 @@
or a
ret
-Function106331: ; 106331 - called by Mobile_DummyReturnFalse in Crystal-J
+Function106331:
+; called by Mobile_DummyReturnFalse in Crystal-J
; check ~[4:b000] == [7:a800]
ld a, $4
call GetSRAMBank
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -5130,7 +5130,7 @@
db "データ<NO>よみこみを"
next "ちゅうし しますか?@"
-String_11a7c1: ; 11a7c1 ; new news?
+String_11a7c1:
db "あたらしい ニュースは"
next "ありません でした@"
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -5076,7 +5076,7 @@
next "せつめいしょを ごらんください"
db "@"
-String_17fe9a: ; 17fe9a ; unused
+String_17fe9a: ; unused
db "ポケモンニュースが"
next "あたらしくなっているので"
next "レポートを おくれません"
--- a/sram.asm
+++ b/sram.asm
@@ -208,7 +208,7 @@
sBattleTowerReward:: db
; team of previous trainer
-sBTMonOfTrainers:: ; 0xbe51
+sBTMonOfTrainers:: ; be51
sBTMonPrevTrainer1:: db
sBTMonPrevTrainer2:: db
sBTMonPrevTrainer3:: db
--- a/wram.asm
+++ b/wram.asm
@@ -1629,7 +1629,6 @@
wMartItem8BCD:: ds 3
wMartItem9BCD:: ds 3
wMartItem10BCD:: ds 3
-wMartItemBCDEnd::
NEXTU ; d002
; town map data