summaryrefslogtreecommitdiff
path: root/engine/items
diff options
context:
space:
mode:
Diffstat (limited to 'engine/items')
-rw-r--r--engine/items/buy_sell_toss.asm47
-rw-r--r--engine/items/item_effects.asm486
-rw-r--r--engine/items/items.asm76
-rw-r--r--engine/items/mart.asm283
-rw-r--r--engine/items/pack.asm401
-rw-r--r--engine/items/pack_kris.asm6
-rw-r--r--engine/items/print_item_description.asm5
-rw-r--r--engine/items/switch_items.asm25
-rw-r--r--engine/items/tmhm.asm85
-rw-r--r--engine/items/tmhm2.asm7
-rw-r--r--engine/items/update_item_description.asm2
11 files changed, 525 insertions, 898 deletions
diff --git a/engine/items/buy_sell_toss.asm b/engine/items/buy_sell_toss.asm
index 84481d030..3303f4319 100644
--- a/engine/items/buy_sell_toss.asm
+++ b/engine/items/buy_sell_toss.asm
@@ -1,13 +1,12 @@
-SelectQuantityToToss: ; 24fbf
+SelectQuantityToToss:
ld hl, TossItem_MenuHeader
call LoadMenuHeader
call Toss_Sell_Loop
ret
-; 24fc9
-SelectQuantityToBuy: ; 24fc9
+SelectQuantityToBuy:
farcall GetItemPrice
-RooftopSale_SelectQuantityToBuy: ; 24fcf
+RooftopSale_SelectQuantityToBuy:
ld a, d
ld [wBuffer1], a
ld a, e
@@ -16,9 +15,8 @@ RooftopSale_SelectQuantityToBuy: ; 24fcf
call LoadMenuHeader
call Toss_Sell_Loop
ret
-; 24fe1
-SelectQuantityToSell: ; 24fe1
+SelectQuantityToSell:
farcall GetItemPrice
ld a, d
ld [wBuffer1], a
@@ -28,9 +26,8 @@ SelectQuantityToSell: ; 24fe1
call LoadMenuHeader
call Toss_Sell_Loop
ret
-; 24ff9
-Toss_Sell_Loop: ; 24ff9
+Toss_Sell_Loop:
ld a, 1
ld [wItemQuantityChangeBuffer], a
.loop
@@ -45,9 +42,8 @@ Toss_Sell_Loop: ; 24ff9
.nope
and a
ret
-; 2500e
-BuySellToss_InterpretJoypad: ; 2500e
+BuySellToss_InterpretJoypad:
call JoyTextDelay_ForcehJoyDown ; get joypad
bit B_BUTTON_F, c
jr nz, .b
@@ -126,9 +122,8 @@ BuySellToss_InterpretJoypad: ; 2500e
ld [wItemQuantityChangeBuffer], a
and a
ret
-; 25072
-BuySellToss_UpdateQuantityDisplay: ; 25072
+BuySellToss_UpdateQuantityDisplay:
call MenuBox
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
@@ -145,26 +140,22 @@ BuySellToss_UpdateQuantityDisplay: ; 25072
ld a, [wMenuDataBank]
call FarCall_de
ret
-; 25097
-ret_25097: ; 25097
+ret_25097:
ret
-; 25098
-DisplayPurchasePrice: ; 25098
+DisplayPurchasePrice:
call BuySell_MultiplyPrice
call BuySell_DisplaySubtotal
ret
-; 2509f
-DisplaySellingPrice: ; 2509f
+DisplaySellingPrice:
call BuySell_MultiplyPrice
call Sell_HalvePrice
call BuySell_DisplaySubtotal
ret
-; 250a9
-BuySell_MultiplyPrice: ; 250a9
+BuySell_MultiplyPrice:
xor a
ld [hMultiplicand + 0], a
ld a, [wBuffer1]
@@ -177,9 +168,8 @@ BuySell_MultiplyPrice: ; 250a9
call Multiply
pop hl
ret
-; 250c1
-Sell_HalvePrice: ; 250c1
+Sell_HalvePrice:
push hl
ld hl, hProduct + 1
ld a, [hl]
@@ -193,9 +183,8 @@ Sell_HalvePrice: ; 250c1
ld [hl], a
pop hl
ret
-; 250d1
-BuySell_DisplaySubtotal: ; 250d1
+BuySell_DisplaySubtotal:
push hl
ld hl, hMoneyTemp
ld a, [hProduct + 1]
@@ -211,25 +200,21 @@ BuySell_DisplaySubtotal: ; 250d1
call PrintNum
call WaitBGMap
ret
-; 250ed
-TossItem_MenuHeader: ; 0x250ed
+TossItem_MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 15, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw ret_25097
db 0 ; default option
-; 0x250f5
-BuyItem_MenuHeader: ; 0x250f5
+BuyItem_MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw DisplayPurchasePrice
db -1 ; default option
-; 0x250fd
-SellItem_MenuHeader: ; 0x250fd
+SellItem_MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw DisplaySellingPrice
db 0 ; default option
-; 0x25105
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index a32ce0ef7..1439b2c6d 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -1,4 +1,4 @@
-_DoItemEffect:: ; e722
+_DoItemEffect::
ld a, [wCurItem]
ld [wd265], a
call GetItemName
@@ -10,10 +10,8 @@ _DoItemEffect:: ; e722
ld hl, ItemEffects
rst JumpTable
ret
-; e73c
-
-ItemEffects: ; e73c
+ItemEffects:
; entries correspond to item ids
dw PokeBallEffect ; MASTER_BALL
dw PokeBallEffect ; ULTRA_BALL
@@ -194,10 +192,8 @@ ItemEffects: ; e73c
dw PokeBallEffect ; PARK_BALL
dw NoEffect ; RAINBOW_WING
dw NoEffect ; ITEM_B3
-; e8a2
-
-PokeBallEffect: ; e8a2
+PokeBallEffect:
ld a, [wBattleMode]
dec a
jp nz, UseBallInTrainerBattle
@@ -488,8 +484,8 @@ PokeBallEffect: ; e8a2
ld de, wEnemyMonPP
ld bc, NUM_MOVES
call CopyBytes
-.Transformed:
+.Transformed:
ld a, [wEnemyMonSpecies]
ld [wWildMon], a
ld [wCurPartySpecies], a
@@ -564,8 +560,8 @@ PokeBallEffect: ; e8a2
ld a, FRIEND_BALL_HAPPINESS
ld [hl], a
-.SkipPartyMonFriendBall:
+.SkipPartyMonFriendBall:
ld hl, Text_AskNicknameNewlyCaughtMon
call PrintText
@@ -713,8 +709,6 @@ PokeBallEffect: ; e8a2
ld hl, wParkBallsRemaining
dec [hl]
ret
-; ec0a
-
BallMultiplierFunctionTable:
; table of routines that increase or decrease the catch rate based on
@@ -767,10 +761,10 @@ GetPokedexEntryBank:
ret
.PokedexEntryBanks:
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
+ db BANK("Pokedex Entries 001-064")
+ db BANK("Pokedex Entries 065-128")
+ db BANK("Pokedex Entries 129-192")
+ db BANK("Pokedex Entries 193-251")
HeavyBallMultiplier:
; subtract 20 from catch rate if weight < 102.4 kg
@@ -907,7 +901,7 @@ MoonBallMultiplier:
pop bc
push bc
- ld a, BANK(EvosAttacks)
+ ld a, BANK("Evolutions and Attacks")
call GetFarByte
cp EVOLVE_ITEM
pop bc
@@ -921,7 +915,7 @@ MoonBallMultiplier:
; No Pokémon evolve with Burn Heal,
; so Moon Balls always have a catch rate of 1×.
push bc
- ld a, BANK(EvosAttacks)
+ ld a, BANK("Evolutions and Attacks")
call GetFarByte
cp MOON_STONE_RED ; BURN_HEAL
pop bc
@@ -1067,43 +1061,37 @@ LevelBallMultiplier:
; These two texts were carried over from gen 1.
; They are not used in gen 2, and are dummied out.
-Text_RBY_CatchMarowak: ; 0xedab
+Text_RBY_CatchMarowak:
; It dodged the thrown BALL! This #MON can't be caught!
text_jump UnknownText_0x1c5a5a
db "@"
-; 0xedb0
-Text_RBY_NoShake: ; 0xedb0
+Text_RBY_NoShake:
; You missed the #MON!
text_jump UnknownText_0x1c5a90
db "@"
-; 0xedb5
-Text_NoShake: ; 0xedb5
+Text_NoShake:
; Oh no! The #MON broke free!
text_jump UnknownText_0x1c5aa6
db "@"
-; 0xedba
-Text_OneShake: ; 0xedba
+Text_OneShake:
; Aww! It appeared to be caught!
text_jump UnknownText_0x1c5ac3
db "@"
-; 0xedbf
-Text_TwoShakes: ; 0xedbf
+Text_TwoShakes:
; Aargh! Almost had it!
text_jump UnknownText_0x1c5ae3
db "@"
-; 0xedc4
-Text_ThreeShakes: ; 0xedc4
+Text_ThreeShakes:
; Shoot! It was so close too!
text_jump UnknownText_0x1c5afa
db "@"
-; 0xedc9
-Text_GotchaMonWasCaught: ; 0xedc9
+Text_GotchaMonWasCaught:
; Gotcha! @ was caught!@ @
text_jump UnknownText_0x1c5b17
start_asm
@@ -1117,49 +1105,40 @@ Text_GotchaMonWasCaught: ; 0xedc9
pop bc
ld hl, TextJump_Waitbutton
ret
-; ede6
-TextJump_Waitbutton: ; 0xede6
+TextJump_Waitbutton:
; @
text_jump Text_Waitbutton_2
db "@"
-; 0xedeb
-Text_SentToBillsPC: ; 0xedeb
+Text_SentToBillsPC:
; was sent to BILL's PC.
text_jump UnknownText_0x1c5b38
db "@"
-; 0xedf0
-Text_AddedToPokedex: ; 0xedf0
+Text_AddedToPokedex:
; 's data was newly added to the #DEX.@ @
text_jump UnknownText_0x1c5b53
db "@"
-; 0xedf5
-Text_AskNicknameNewlyCaughtMon: ; 0xedf5
+Text_AskNicknameNewlyCaughtMon:
; Give a nickname to @ ?
text_jump UnknownText_0x1c5b7f
db "@"
-; 0xedfa
-ReturnToBattle_UseBall: ; edfa (3:6dfa)
+ReturnToBattle_UseBall:
farcall _ReturnToBattle_UseBall
ret
-TownMapEffect: ; ee01
+TownMapEffect:
farcall PokegearMap
ret
-; ee08
-
-BicycleEffect: ; ee08
+BicycleEffect:
farcall BikeFunction
ret
-; ee0f
-
-EvoStoneEffect: ; ee0f
+EvoStoneEffect:
ld b, PARTYMENUACTION_EVO_STONE
call UseItem_SelectMon
@@ -1189,10 +1168,8 @@ EvoStoneEffect: ; ee0f
xor a
ld [wItemEffectSucceeded], a
ret
-; ee3d
-
-VitaminEffect: ; ee3d
+VitaminEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
@@ -1235,15 +1212,12 @@ VitaminEffect: ; ee3d
jp UseDisposableItem
-
-NoEffectMessage: ; ee83
+NoEffectMessage:
ld hl, WontHaveAnyEffectText
call PrintText
jp ClearPalettes
-; ee8c
-
-UpdateStatsAfterItem: ; ee8c
+UpdateStatsAfterItem:
ld a, MON_MAXHP
call GetPartyParamLocation
ld d, h
@@ -1252,23 +1226,18 @@ UpdateStatsAfterItem: ; ee8c
call GetPartyParamLocation
ld b, TRUE
predef_jump CalcMonStats
-; ee9f
-RareCandy_StatBooster_ExitMenu: ; ee9f
+RareCandy_StatBooster_ExitMenu:
xor a
ld [wItemEffectSucceeded], a
jp ClearPalettes
-; eea6
-
-Text_StatRose: ; 0xeea6
+Text_StatRose:
; 's @ rose.
text_jump UnknownText_0x1c5b9a
db "@"
-; 0xeeab
-
-StatStrings: ; eeab
+StatStrings:
dw .health
dw .attack
dw .defense
@@ -1280,10 +1249,8 @@ StatStrings: ; eeab
.defense db "DEFENSE@"
.speed db "SPEED@"
.special db "SPECIAL@"
-; eed9
-
-GetStatExpRelativePointer: ; eed9
+GetStatExpRelativePointer:
ld a, [wCurItem]
ld hl, Table_eeeb
.next
@@ -1298,18 +1265,15 @@ GetStatExpRelativePointer: ; eed9
ld c, a
ld b, 0
ret
-; eeeb
-Table_eeeb: ; eeeb
+Table_eeeb:
db HP_UP, MON_HP_EXP - MON_STAT_EXP
db PROTEIN, MON_ATK_EXP - MON_STAT_EXP
db IRON, MON_DEF_EXP - MON_STAT_EXP
db CARBOS, MON_SPD_EXP - MON_STAT_EXP
db CALCIUM, MON_SPC_EXP - MON_STAT_EXP
-; eef5
-
-RareCandy_StatBooster_GetParameters: ; eef5
+RareCandy_StatBooster_GetParameters:
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
ld [wd265], a
@@ -1322,10 +1286,8 @@ RareCandy_StatBooster_GetParameters: ; eef5
ld hl, wPartyMonNicknames
call GetNick
ret
-; 0xef14
-
-RareCandyEffect: ; ef14
+RareCandyEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
@@ -1414,10 +1376,8 @@ RareCandyEffect: ; ef14
farcall EvolvePokemon
jp UseDisposableItem
-; efad
-
-HealPowderEffect: ; efad
+HealPowderEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
@@ -1436,21 +1396,17 @@ HealPowderEffect: ; efad
.asm_efc9
jp StatusHealer_Jumptable
-; efcc
-
-StatusHealingEffect: ; efcc
+StatusHealingEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, StatusHealer_ExitMenu
-FullyHealStatus: ; efd4
+FullyHealStatus:
call UseStatusHealer
jp StatusHealer_Jumptable
-; efda
-
-UseStatusHealer: ; efda (3:6fda)
+UseStatusHealer:
call IsMonFainted
ld a, $1
ret z
@@ -1476,7 +1432,7 @@ UseStatusHealer: ; efda (3:6fda)
ld a, $0
ret
-IsItemUsedOnConfusedMon: ; f009 (3:7009)
+IsItemUsedOnConfusedMon:
call IsItemUsedOnBattleMon
jr nc, .nope
ld a, [wPlayerSubStatus3]
@@ -1492,7 +1448,7 @@ IsItemUsedOnConfusedMon: ; f009 (3:7009)
and a
ret
-BattlemonRestoreHealth: ; f01e (3:701e)
+BattlemonRestoreHealth:
call IsItemUsedOnBattleMon
ret nc
ld a, MON_HP
@@ -1503,7 +1459,7 @@ BattlemonRestoreHealth: ; f01e (3:701e)
ld [wBattleMonHP + 1], a
ret
-HealStatus: ; f030 (3:7030)
+HealStatus:
call IsItemUsedOnBattleMon
ret nc
xor a
@@ -1524,7 +1480,7 @@ HealStatus: ; f030 (3:7030)
pop bc
ret
-GetItemHealingAction: ; f058 (3:7058)
+GetItemHealingAction:
push hl
ld a, [wCurItem]
ld hl, StatusHealingActions
@@ -1544,22 +1500,20 @@ GetItemHealingAction: ; f058 (3:7058)
cp %11111111
pop hl
ret
-; f071 (3:7071)
INCLUDE "data/items/heal_status.asm"
-StatusHealer_Jumptable: ; f09e (3:709e)
+StatusHealer_Jumptable:
ld hl, .dw
rst JumpTable
ret
-.dw ; f0a3 (3:70a3)
+.dw
dw StatusHealer_ClearPalettes
dw StatusHealer_NoEffect
dw StatusHealer_ExitMenu
-
-RevivalHerbEffect: ; f0a9
+RevivalHerbEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, StatusHealer_ExitMenu
@@ -1575,20 +1529,16 @@ RevivalHerbEffect: ; f0a9
.asm_f0c5
jp StatusHealer_Jumptable
-; f0c8
-
-ReviveEffect: ; f0c8
+ReviveEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, StatusHealer_ExitMenu
call RevivePokemon
jp StatusHealer_Jumptable
-; f0d6
-
-RevivePokemon: ; f0d6
+RevivePokemon:
call IsMonFainted
ld a, 1
ret nz
@@ -1633,10 +1583,8 @@ RevivePokemon: ; f0d6
call UseDisposableItem
ld a, 0
ret
-; f128
-
-FullRestoreEffect: ; f128
+FullRestoreEffect:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
jp c, StatusHealer_ExitMenu
@@ -1652,10 +1600,8 @@ FullRestoreEffect: ; f128
.NotAtFullHealth:
call .FullRestore
jp StatusHealer_Jumptable
-; f144
-
-.FullRestore: ; f144
+.FullRestore:
xor a
ld [wLowHealthAlarm], a
call ReviveFullHP
@@ -1673,10 +1619,8 @@ FullRestoreEffect: ; f128
call UseDisposableItem
ld a, 0
ret
-; f16a
-
-BitterBerryEffect: ; f16a
+BitterBerryEffect:
ld hl, wPlayerSubStatus3
bit SUBSTATUS_CONFUSED, [hl]
ld a, 1
@@ -1694,25 +1638,19 @@ BitterBerryEffect: ; f16a
.done
jp StatusHealer_Jumptable
-; f186
-
-RestoreHPEffect: ; f186
+RestoreHPEffect:
call ItemRestoreHP
jp StatusHealer_Jumptable
-; f18c
-
-EnergypowderEffect: ; f18c
+EnergypowderEffect:
ld c, HAPPINESS_BITTERPOWDER
jr EnergypowderEnergyRootCommon
-; f190
-EnergyRootEffect: ; f190
+EnergyRootEffect:
ld c, HAPPINESS_ENERGYROOT
-; f192
-EnergypowderEnergyRootCommon: ; f192
+EnergypowderEnergyRootCommon:
push bc
call ItemRestoreHP
pop bc
@@ -1725,10 +1663,8 @@ EnergypowderEnergyRootCommon: ; f192
.skip_happiness
jp StatusHealer_Jumptable
-; f1a9
-
-ItemRestoreHP: ; f1a9 (3:71a9)
+ItemRestoreHP:
ld b, PARTYMENUACTION_HEALING_ITEM
call UseItem_SelectMon
ld a, 2
@@ -1755,7 +1691,7 @@ ItemRestoreHP: ; f1a9 (3:71a9)
ld a, 0
ret
-HealHP_SFX_GFX: ; f1db (3:71db)
+HealHP_SFX_GFX:
push de
ld de, SFX_POTION
call WaitPlaySFX
@@ -1768,7 +1704,7 @@ HealHP_SFX_GFX: ; f1db (3:71db)
ld [wWhichHPBar], a
predef_jump AnimateHPBar
-UseItem_SelectMon: ; f1f9 (3:71f9)
+UseItem_SelectMon:
call .SelectMon
ret c
@@ -1784,7 +1720,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9)
and a
ret
-.SelectMon: ; f20b (3:720b)
+.SelectMon:
ld a, b
ld [wPartyMenuActionText], a
push hl
@@ -1797,7 +1733,7 @@ UseItem_SelectMon: ; f1f9 (3:71f9)
pop hl
ret
-ChooseMonToUseItemOn: ; f21c (3:721c)
+ChooseMonToUseItemOn:
farcall LoadPartyMenuGFX
farcall InitPartyMenuWithCancel
farcall InitPartyMenuGFX
@@ -1809,7 +1745,7 @@ ChooseMonToUseItemOn: ; f21c (3:721c)
farcall PartyMenuSelect
ret
-ItemActionText: ; f24a (3:724a)
+ItemActionText:
ld [wPartyMenuActionText], a
ld a, [wCurPartySpecies]
push af
@@ -1832,7 +1768,7 @@ ItemActionText: ; f24a (3:724a)
ld [wCurPartySpecies], a
ret
-ItemActionTextWaitButton: ; f279 (3:7279)
+ItemActionTextWaitButton:
xor a
ld [hBGMapMode], a
hlcoord 0, 0
@@ -1847,18 +1783,18 @@ ItemActionTextWaitButton: ; f279 (3:7279)
call DelayFrames
jp WaitPressAorB_BlinkCursor
-StatusHealer_NoEffect: ; f299 (3:7299)
+StatusHealer_NoEffect:
call WontHaveAnyEffectMessage
jr StatusHealer_ClearPalettes
-StatusHealer_ExitMenu: ; f29e (3:729e)
+StatusHealer_ExitMenu:
xor a
ld [wItemEffectSucceeded], a
-StatusHealer_ClearPalettes: ; f2a2 (3:72a2)
+StatusHealer_ClearPalettes:
call ClearPalettes
ret
-IsItemUsedOnBattleMon: ; f2a6 (3:72a6)
+IsItemUsedOnBattleMon:
ld a, [wBattleMode]
and a
ret z
@@ -1875,15 +1811,15 @@ IsItemUsedOnBattleMon: ; f2a6 (3:72a6)
xor a
ret
-ReviveHalfHP: ; f2ba (3:72ba)
+ReviveHalfHP:
call LoadHPFromBuffer1
srl d
rr e
jr ContinueRevive
-ReviveFullHP: ; f2c3 (3:72c3)
+ReviveFullHP:
call LoadHPFromBuffer1
-ContinueRevive: ; f2c6 (3:72c6)
+ContinueRevive:
ld a, MON_HP
call GetPartyParamLocation
ld [hl], d
@@ -1891,7 +1827,7 @@ ContinueRevive: ; f2c6 (3:72c6)
ld [hl], e
jp LoadCurHPIntoBuffer5
-RestoreHealth: ; f2d1 (3:72d1)
+RestoreHealth:
ld a, MON_HP + 1
call GetPartyParamLocation
ld a, [hl]
@@ -1920,7 +1856,7 @@ RestoreHealth: ; f2d1 (3:72d1)
.finish
ret
-RemoveHP: ; f2f9 (3:72f9)
+RemoveHP:
ld a, MON_HP + 1
call GetPartyParamLocation
ld a, [hl]
@@ -1937,7 +1873,7 @@ RemoveHP: ; f2f9 (3:72f9)
call LoadCurHPIntoBuffer5
ret
-IsMonFainted: ; f30d (3:730d)
+IsMonFainted:
push de
call LoadMaxHPToBuffer1
call LoadCurHPToBuffer3
@@ -1947,7 +1883,7 @@ IsMonFainted: ; f30d (3:730d)
pop de
ret
-IsMonAtFullHealth: ; f31b (3:731b)
+IsMonAtFullHealth:
call LoadHPFromBuffer3
ld h, d
ld l, e
@@ -1958,7 +1894,7 @@ IsMonAtFullHealth: ; f31b (3:731b)
sbc d
ret
-LoadCurHPIntoBuffer5: ; f328 (3:7328)
+LoadCurHPIntoBuffer5:
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
@@ -1966,25 +1902,22 @@ LoadCurHPIntoBuffer5: ; f328 (3:7328)
ld a, [hl]
ld [wBuffer5], a
ret
-; f336 (3:7336)
-LoadHPIntoBuffer5: ; f336
+LoadHPIntoBuffer5:
ld a, d
ld [wBuffer6], a
ld a, e
ld [wBuffer5], a
ret
-; f33f
-LoadHPFromBuffer5: ; f33f
+LoadHPFromBuffer5:
ld a, [wBuffer6]
ld d, a
ld a, [wBuffer5]
ld e, a
ret
-; f348
-LoadCurHPToBuffer3: ; f348 (3:7348)
+LoadCurHPToBuffer3:
ld a, MON_HP
call GetPartyParamLocation
ld a, [hli]
@@ -1993,14 +1926,14 @@ LoadCurHPToBuffer3: ; f348 (3:7348)
ld [wBuffer3], a
ret
-LoadHPFromBuffer3: ; f356 (3:7356)
+LoadHPFromBuffer3:
ld a, [wBuffer4]
ld d, a
ld a, [wBuffer3]
ld e, a
ret
-LoadMaxHPToBuffer1: ; f35f (3:735f)
+LoadMaxHPToBuffer1:
push hl
ld a, MON_MAXHP
call GetPartyParamLocation
@@ -2011,14 +1944,14 @@ LoadMaxHPToBuffer1: ; f35f (3:735f)
pop hl
ret
-LoadHPFromBuffer1: ; f36f (3:736f)
+LoadHPFromBuffer1:
ld a, [wBuffer2]
ld d, a
ld a, [wBuffer1]
ld e, a
ret
-GetOneFifthMaxHP: ; f378 (3:7378)
+GetOneFifthMaxHP:
push bc
ld a, MON_MAXHP
call GetPartyParamLocation
@@ -2037,7 +1970,7 @@ GetOneFifthMaxHP: ; f378 (3:7378)
pop bc
ret
-GetHealingItemAmount: ; f395 (3:7395)
+GetHealingItemAmount:
push hl
ld a, [wCurItem]
ld hl, HealingHPAmounts
@@ -2060,11 +1993,10 @@ GetHealingItemAmount: ; f395 (3:7395)
ld d, [hl]
pop hl
ret
-; f3af (3:73af)
INCLUDE "data/items/heal_hp.asm"
-Softboiled_MilkDrinkFunction: ; f3df (3:73df)
+Softboiled_MilkDrinkFunction:
; Softboiled/Milk Drink in the field
ld a, [wPartyMenuCursor]
dec a
@@ -2094,7 +2026,7 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df)
ld [wPartyMenuCursor], a
ret
-.SelectMilkDrinkRecipient: ; f419 (3:7419)
+.SelectMilkDrinkRecipient:
.loop
push bc
ld a, PARTYMENUACTION_HEALING_ITEM
@@ -2127,16 +2059,13 @@ Softboiled_MilkDrinkFunction: ; f3df (3:73df)
call MenuTextBoxBackup
pop bc
jr .loop
-; f44a (3:744a)
-.Text_CantBeUsed: ; 0xf44a
+.Text_CantBeUsed:
; That can't be used on this #MON.
text_jump UnknownText_0x1c5bac
db "@"
-; 0xf44f
-
-EscapeRopeEffect: ; f44f
+EscapeRopeEffect:
xor a
ld [wItemEffectSucceeded], a
farcall EscapeRopeFunction
@@ -2145,24 +2074,19 @@ EscapeRopeEffect: ; f44f
cp 1
call z, UseDisposableItem
ret
-; f462
-
-SuperRepelEffect: ; f462
+SuperRepelEffect:
ld b, 200
jr UseRepel
-; f466
-MaxRepelEffect: ; f466
+MaxRepelEffect:
ld b, 250
jr UseRepel
-; f466
-RepelEffect: ; f46a
+RepelEffect:
ld b, 100
-; f46c
-UseRepel: ; f46c
+UseRepel:
ld a, [wRepelEffect]
and a
ld hl, TextJump_RepelUsedEarlierIsStillInEffect
@@ -2172,24 +2096,19 @@ UseRepel: ; f46c
ld [wRepelEffect], a
jp UseItemText
-
-TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d
+TextJump_RepelUsedEarlierIsStillInEffect:
; The REPEL used earlier is still in effect.
text_jump Text_RepelUsedEarlierIsStillInEffect
db "@"
-; 0xf482
-
-XAccuracyEffect: ; f482
+XAccuracyEffect:
ld hl, wPlayerSubStatus4
bit SUBSTATUS_X_ACCURACY, [hl]
jp nz, WontHaveAnyEffect_NotUsedMessage
set SUBSTATUS_X_ACCURACY, [hl]
jp UseItemText
-; f48f
-
-PokeDollEffect: ; f48f
+PokeDollEffect:
ld a, [wBattleMode]
dec a
jr nz, .asm_f4a6
@@ -2205,28 +2124,22 @@ PokeDollEffect: ; f48f
xor a
ld [wItemEffectSucceeded], a
ret
-; f4ab
-
-GuardSpecEffect: ; f4ab
+GuardSpecEffect:
ld hl, wPlayerSubStatus4
bit SUBSTATUS_MIST, [hl]
jp nz, WontHaveAnyEffect_NotUsedMessage
set SUBSTATUS_MIST, [hl]
jp UseItemText
-; f4b8
-
-DireHitEffect: ; f4b8
+DireHitEffect:
ld hl, wPlayerSubStatus4
bit SUBSTATUS_FOCUS_ENERGY, [hl]
jp nz, WontHaveAnyEffect_NotUsedMessage
set SUBSTATUS_FOCUS_ENERGY, [hl]
jp UseItemText
-; f4c5
-
-XItemEffect: ; f4c5
+XItemEffect:
call UseItemText
ld a, [wCurItem]
@@ -2257,12 +2170,10 @@ XItemEffect: ; f4c5
ld c, HAPPINESS_USEDXITEM
farcall ChangeHappiness
ret
-; f504
INCLUDE "data/items/x_stats.asm"
-
-PokeFluteEffect: ; f50c
+PokeFluteEffect:
ld a, [wBattleMode]
and a
jr nz, .dummy
@@ -2306,7 +2217,6 @@ PokeFluteEffect: ; f50c
ld hl, .AllSleepingMonWokeUp
jp PrintText
-
.CureSleep:
ld de, PARTYMON_STRUCT_LENGTH
ld c, PARTY_LENGTH
@@ -2326,22 +2236,18 @@ PokeFluteEffect: ; f50c
dec c
jr nz, .loop
ret
-; f56c
-
-.CatchyTune: ; 0xf56c
+.CatchyTune:
; Played the # FLUTE. Now, that's a catchy tune!
text_jump UnknownText_0x1c5bf9
db "@"
-; 0xf571
-.AllSleepingMonWokeUp: ; 0xf571
+.AllSleepingMonWokeUp:
; All sleeping #MON woke up.
text_jump UnknownText_0x1c5c28
db "@"
-; 0xf576
-.PlayedTheFlute: ; 0xf576
+.PlayedTheFlute:
; played the # FLUTE.@ @
text_jump UnknownText_0x1c5c44
start_asm
@@ -2357,57 +2263,44 @@ PokeFluteEffect: ; f50c
.battle
jp PokeFluteTerminatorCharacter
-; f58f
-
-BlueCardEffect: ; f58f
+BlueCardEffect:
ld hl, .bluecardtext
jp MenuTextBoxWaitButton
.bluecardtext
text_jump UnknownText_0x1c5c5e
db "@"
-; f59a
-
-CoinCaseEffect: ; f59a
+CoinCaseEffect:
ld hl, .coincasetext
jp MenuTextBoxWaitButton
.coincasetext
text_jump UnknownText_0x1c5c7b
db "@"
-; f5a5
-
-OldRodEffect: ; f5a5
+OldRodEffect:
ld e, $0
jr UseRod
-; f5a9
-GoodRodEffect: ; f5a9
+GoodRodEffect:
ld e, $1
jr UseRod
-; f5ad
-SuperRodEffect: ; f5ad
+SuperRodEffect:
ld e, $2
jr UseRod
-; f5b1
-UseRod: ; f5b1
+UseRod:
farcall FishFunction
ret
-; f5b8
-
-ItemfinderEffect: ; f5b8
+ItemfinderEffect:
farcall ItemFinder
ret
-; f5bf
-
-RestorePPEffect: ; f5bf
+RestorePPEffect:
ld a, [wCurItem]
ld [wd002], a
@@ -2488,12 +2381,11 @@ RestorePPEffect: ; f5bf
ld hl, TextJump_PPsIncreased
call PrintText
-FinishPPRestore: ; f64c
+FinishPPRestore:
call ClearPalettes
jp UseDisposableItem
-; f652
-BattleRestorePP: ; f652
+BattleRestorePP:
ld a, [wBattleMode]
and a
jr z, .not_in_battle
@@ -2548,15 +2440,13 @@ endr
.done
ret
-; f6a7
-Not_PP_Up: ; f6a7
+Not_PP_Up:
call RestorePP
jr nz, BattleRestorePP
jp PPRestoreItem_NoEffect
-; f6af
-Elixer_RestorePPofAllMoves: ; f6af
+Elixer_RestorePPofAllMoves:
xor a
ld hl, wMenuCursorY
ld [hli], a
@@ -2586,17 +2476,16 @@ Elixer_RestorePPofAllMoves: ; f6af
and a
jp nz, BattleRestorePP
-PPRestoreItem_NoEffect: ; f6dd
+PPRestoreItem_NoEffect:
call WontHaveAnyEffectMessage
-PPRestoreItem_Cancel: ; f6e0
+PPRestoreItem_Cancel:
call ClearPalettes
xor a
ld [wItemEffectSucceeded], a
ret
-; f6e8
-RestorePP: ; f6e8
+RestorePP:
xor a ; PARTYMON
ld [wMonType], a
call GetMaxPPOfMove
@@ -2640,115 +2529,93 @@ RestorePP: ; f6e8
.dont_restore
xor a
ret
-; f725
-TextJump_RaiseThePPOfWhichMove: ; 0xf725
+TextJump_RaiseThePPOfWhichMove:
; Raise the PP of which move?
text_jump Text_RaiseThePPOfWhichMove
db "@"
-; 0xf72a
-TextJump_RestoreThePPOfWhichMove: ; 0xf72a
+TextJump_RestoreThePPOfWhichMove:
; Restore the PP of which move?
text_jump Text_RestoreThePPOfWhichMove
db "@"
-; 0xf72f
-TextJump_PPIsMaxedOut: ; 0xf72f
+TextJump_PPIsMaxedOut:
; 's PP is maxed out.
text_jump Text_PPIsMaxedOut
db "@"
-; 0xf734
-TextJump_PPsIncreased: ; 0xf734
+TextJump_PPsIncreased:
; 's PP increased.
text_jump Text_PPsIncreased
db "@"
-; 0xf739
-UnknownText_0xf739: ; 0xf739
+UnknownText_0xf739:
; PP was restored.
text_jump UnknownText_0x1c5cf1
db "@"
-; 0xf73e
-
-SquirtbottleEffect: ; f73e
+SquirtbottleEffect:
farcall _Squirtbottle
ret
-; f745
-
-CardKeyEffect: ; f745
+CardKeyEffect:
farcall _CardKey
ret
-; f74c
-
-BasementKeyEffect: ; f74c
+BasementKeyEffect:
farcall _BasementKey
ret
-; f753
-
-SacredAshEffect: ; f753
+SacredAshEffect:
farcall _SacredAsh
ld a, [wItemEffectSucceeded]
cp $1
ret nz
call UseDisposableItem
ret
-; f763
-
-NormalBoxEffect: ; f763
+NormalBoxEffect:
ld c, DECOFLAG_SILVER_TROPHY_DOLL
jr OpenBox
-; f767
-GorgeousBoxEffect: ; f767
+GorgeousBoxEffect:
ld c, DECOFLAG_GOLD_TROPHY_DOLL
-OpenBox: ; f769
+OpenBox:
farcall SetSpecificDecorationFlag
ld hl, .text
call PrintText
jp UseDisposableItem
-; f778
-.text ; 0xf778
+.text
; There was a trophy inside!
text_jump UnknownText_0x1c5d03
db "@"
-; 0xf77d
-NoEffect: ; f77d
+NoEffect:
jp IsntTheTimeMessage
-; f780
-
-Play_SFX_FULL_HEAL: ; f780
+Play_SFX_FULL_HEAL:
push de
ld de, SFX_FULL_HEAL
call WaitPlaySFX
pop de
ret
-; f789
-UseItemText: ; f789
+UseItemText:
ld hl, UsedItemText
call PrintText
call Play_SFX_FULL_HEAL
call WaitPressAorB_BlinkCursor
-UseDisposableItem: ; f795
+UseDisposableItem:
ld hl, wNumItems
ld a, 1
ld [wItemQuantityChangeBuffer], a
jp TossItem
-; f7a0
-UseBallInTrainerBattle: ; f7a0
+UseBallInTrainerBattle:
call ReturnToBattle_UseBall
ld de, ANIM_THROW_POKE_BALL
ld a, e
@@ -2765,9 +2632,8 @@ UseBallInTrainerBattle: ; f7a0
ld hl, DontBeAThiefText
call PrintText
jr UseDisposableItem
-; f7ca
-WontHaveAnyEffect_NotUsedMessage: ; f7ca
+WontHaveAnyEffect_NotUsedMessage:
ld hl, WontHaveAnyEffectText
call PrintText
@@ -2775,14 +2641,12 @@ WontHaveAnyEffect_NotUsedMessage: ; f7ca
ld a, $2
ld [wItemEffectSucceeded], a
ret
-; f7d6
-LooksBitterMessage: ; f7d6
+LooksBitterMessage:
ld hl, LooksBitterText
jp PrintText
-; f7dc
-Ball_BoxIsFullMessage: ; f7dc
+Ball_BoxIsFullMessage:
ld hl, Ball_BoxIsFullText
call PrintText
@@ -2790,118 +2654,102 @@ Ball_BoxIsFullMessage: ; f7dc
ld a, $2
ld [wItemEffectSucceeded], a
ret
-; f7e8
-CantUseOnEggMessage: ; f7e8
+CantUseOnEggMessage:
ld hl, CantUseOnEggText
jr CantUseItemMessage
-IsntTheTimeMessage: ; f7ed
+IsntTheTimeMessage:
ld hl, IsntTheTimeText
jr CantUseItemMessage
-WontHaveAnyEffectMessage: ; f7f2
+WontHaveAnyEffectMessage:
ld hl, WontHaveAnyEffectText
jr CantUseItemMessage
-BelongsToSomeoneElseMessage: ; f7f7
+BelongsToSomeoneElseMessage:
ld hl, BelongsToSomeoneElseText
jr CantUseItemMessage
-CyclingIsntAllowedMessage: ; f7fc
+CyclingIsntAllowedMessage:
ld hl, CyclingIsntAllowedText
jr CantUseItemMessage
-CantGetOnYourBikeMessage: ; f801
+CantGetOnYourBikeMessage:
ld hl, CantGetOnYourBikeText
-CantUseItemMessage: ; f804
+CantUseItemMessage:
; Item couldn't be used.
xor a
ld [wItemEffectSucceeded], a
jp PrintText
-; f80b
-LooksBitterText: ; 0xf80b
+LooksBitterText:
; It looks bitter…
text_jump UnknownText_0x1c5d3e
db "@"
-; 0xf810
-CantUseOnEggText: ; 0xf810
+CantUseOnEggText:
; That can't be used on an EGG.
text_jump UnknownText_0x1c5d50
db "@"
-; 0xf815
-IsntTheTimeText: ; 0xf815
+IsntTheTimeText:
; OAK: ! This isn't the time to use that!
text_jump UnknownText_0x1c5d6e
db "@"
-; 0xf81a
-BelongsToSomeoneElseText: ; 0xf81a
+BelongsToSomeoneElseText:
; That belongs to someone else!
text_jump UnknownText_0x1c5d97
db "@"
-; 0xf81f
-WontHaveAnyEffectText: ; 0xf81f
+WontHaveAnyEffectText:
; It won't have any effect.
text_jump UnknownText_0x1c5db6
db "@"
-; 0xf824
-BlockedTheBallText: ; 0xf824
+BlockedTheBallText:
; The trainer blocked the BALL!
text_jump UnknownText_0x1c5dd0
db "@"
-; 0xf829
-DontBeAThiefText: ; 0xf829
+DontBeAThiefText:
; Don't be a thief!
text_jump UnknownText_0x1c5def
db "@"
-; 0xf82e
-CyclingIsntAllowedText: ; 0xf82e
+CyclingIsntAllowedText:
; Cycling isn't allowed here.
text_jump UnknownText_0x1c5e01
db "@"
-; 0xf833
-CantGetOnYourBikeText: ; 0xf833
+CantGetOnYourBikeText:
; Can't get on your @ now.
text_jump UnknownText_0x1c5e1d
db "@"
-; 0xf838
-Ball_BoxIsFullText: ; 0xf838
+Ball_BoxIsFullText:
; The #MON BOX is full. That can't be used now.
text_jump UnknownText_0x1c5e3a
db "@"
-; 0xf83d
-UsedItemText: ; 0xf83d
+UsedItemText:
; used the@ .
text_jump UnknownText_0x1c5e68
db "@"
-; 0xf842
-GotOnTheItemText: ; 0xf842
+GotOnTheItemText:
; got on the@ .
text_jump UnknownText_0x1c5e7b
db "@"
-; 0xf847
-GotOffTheItemText: ; 0xf847
+GotOffTheItemText:
; got off@ the @ .
text_jump UnknownText_0x1c5e90
db "@"
-; 0xf84c
-
-ApplyPPUp: ; f84c
+ApplyPPUp:
ld a, MON_MOVES
call GetPartyParamLocation
push hl
@@ -2935,11 +2783,8 @@ ApplyPPUp: ; f84c
inc hl
inc de
jr .loop
-; f881
-
-
-ComputeMaxPP: ; f881
+ComputeMaxPP:
push bc
; Divide the base PP by 5.
ld a, [de]
@@ -2987,9 +2832,8 @@ ComputeMaxPP: ; f881
ld [hl], b
pop bc
ret
-; f8b9
-RestoreAllPP: ; f8b9
+RestoreAllPP:
ld a, MON_PP
call GetPartyParamLocation
push hl
@@ -3023,10 +2867,8 @@ RestoreAllPP: ; f8b9
dec c
jr nz, .loop
ret
-; f8ec
-
-GetMaxPPOfMove: ; f8ec
+GetMaxPPOfMove:
ld a, [wStringBuffer1 + 0]
push af
ld a, [wStringBuffer1 + 1]
@@ -3103,16 +2945,14 @@ GetMaxPPOfMove: ; f8ec
pop af
ld [wStringBuffer1 + 0], a
ret
-; f963
-GetMthMoveOfNthPartymon: ; f963
+GetMthMoveOfNthPartymon:
ld a, [wCurPartyMon]
call AddNTimes
-GetMthMoveOfCurrentMon: ; f969
+GetMthMoveOfCurrentMon:
ld a, [wMenuCursorY]
ld c, a
ld b, 0
add hl, bc
ret
-; f971
diff --git a/engine/items/items.asm b/engine/items/items.asm
index c07042aed..28c79f4cc 100644
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -1,4 +1,4 @@
-_ReceiveItem:: ; d1d5
+_ReceiveItem::
call DoesHLEqualNumItems
jp nz, PutItemInPocket
push hl
@@ -10,28 +10,28 @@ _ReceiveItem:: ; d1d5
rst JumpTable
ret
-.Pockets: ; d1e9
+.Pockets:
; entries correspond to item types
dw .Item
dw .KeyItem
dw .Ball
dw .TMHM
-.Item: ; d1f1
+.Item:
ld h, d
ld l, e
jp PutItemInPocket
-.KeyItem: ; d1f6
+.KeyItem:
ld h, d
ld l, e
jp ReceiveKeyItem
-.Ball: ; d1fb
+.Ball:
ld hl, wNumBalls
jp PutItemInPocket
-.TMHM: ; d201
+.TMHM:
ld h, d
ld l, e
ld a, [wCurItem]
@@ -39,7 +39,7 @@ _ReceiveItem:: ; d1d5
call GetTMHMNumber
jp ReceiveTMHM
-_TossItem:: ; d20d
+_TossItem::
call DoesHLEqualNumItems
jr nz, .remove
push hl
@@ -58,11 +58,11 @@ _TossItem:: ; d20d
dw .Ball
dw .TMHM
-.Ball: ; d228
+.Ball:
ld hl, wNumBalls
jp RemoveItemFromPocket
-.TMHM: ; d22e
+.TMHM:
ld h, d
ld l, e
ld a, [wCurItem]
@@ -70,19 +70,19 @@ _TossItem:: ; d20d
call GetTMHMNumber
jp TossTMHM
-.KeyItem: ; d23a
+.KeyItem:
ld h, d
ld l, e
jp TossKeyItem
-.Item: ; d23f
+.Item:
ld h, d
ld l, e
.remove
jp RemoveItemFromPocket
-_CheckItem:: ; d244
+_CheckItem::
call DoesHLEqualNumItems
jr nz, .nope
push hl
@@ -101,11 +101,11 @@ _CheckItem:: ; d244
dw .Ball
dw .TMHM
-.Ball: ; d25f
+.Ball:
ld hl, wNumBalls
jp CheckTheItem
-.TMHM: ; d265
+.TMHM:
ld h, d
ld l, e
ld a, [wCurItem]
@@ -113,19 +113,19 @@ _CheckItem:: ; d244
call GetTMHMNumber
jp CheckTMHM
-.KeyItem: ; d271
+.KeyItem:
ld h, d
ld l, e
jp CheckKeyItems
-.Item: ; d276
+.Item:
ld h, d
ld l, e
.nope
jp CheckTheItem
-DoesHLEqualNumItems: ; d27b
+DoesHLEqualNumItems:
ld a, l
cp LOW(wNumItems)
ret nz
@@ -133,7 +133,7 @@ DoesHLEqualNumItems: ; d27b
cp HIGH(wNumItems)
ret
-GetPocketCapacity: ; d283
+GetPocketCapacity:
ld c, MAX_ITEMS
ld a, e
cp LOW(wNumItems)
@@ -155,7 +155,7 @@ GetPocketCapacity: ; d283
ld c, MAX_BALLS
ret
-PutItemInPocket: ; d29c
+PutItemInPocket:
ld d, h
ld e, l
inc hl
@@ -231,7 +231,7 @@ PutItemInPocket: ; d29c
scf
ret
-RemoveItemFromPocket: ; d2ff
+RemoveItemFromPocket:
ld d, h
ld e, l
ld a, [hli]
@@ -296,7 +296,7 @@ RemoveItemFromPocket: ; d2ff
and a
ret
-CheckTheItem: ; d349
+CheckTheItem:
ld a, [wCurItem]
ld c, a
.loop
@@ -313,7 +313,7 @@ CheckTheItem: ; d349
and a
ret
-ReceiveKeyItem: ; d35a
+ReceiveKeyItem:
ld hl, wNumKeyItems
ld a, [hli]
cp MAX_KEY_ITEMS
@@ -333,7 +333,7 @@ ReceiveKeyItem: ; d35a
and a
ret
-TossKeyItem: ; d374
+TossKeyItem:
ld a, [wCurItemQuantity]
ld e, a
ld d, 0
@@ -363,7 +363,7 @@ TossKeyItem: ; d374
scf
ret
-.Toss: ; d396
+.Toss:
ld hl, wNumKeyItems
ld a, [wCurItem]
ld c, a
@@ -384,7 +384,7 @@ TossKeyItem: ; d374
scf
ret
-CheckKeyItems: ; d3b1
+CheckKeyItems:
ld a, [wCurItem]
ld c, a
ld hl, wKeyItems
@@ -401,7 +401,7 @@ CheckKeyItems: ; d3b1
scf
ret
-ReceiveTMHM: ; d3c4
+ReceiveTMHM:
dec c
ld b, 0
ld hl, wTMsHMs
@@ -418,7 +418,7 @@ ReceiveTMHM: ; d3c4
and a
ret
-TossTMHM: ; d3d8
+TossTMHM:
dec c
ld b, 0
ld hl, wTMsHMs
@@ -445,7 +445,7 @@ TossTMHM: ; d3d8
and a
ret
-CheckTMHM: ; d3fb
+CheckTMHM:
dec c
ld b, $0
ld hl, wTMsHMs
@@ -456,7 +456,7 @@ CheckTMHM: ; d3fb
scf
ret
-GetTMHMNumber:: ; d407
+GetTMHMNumber::
; Return the number of a TM/HM by item id c.
ld a, c
; Skip any dummy items.
@@ -473,7 +473,7 @@ GetTMHMNumber:: ; d407
ld c, a
ret
-GetNumberedTMHM: ; d417
+GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
; Skip any gaps.
@@ -491,7 +491,7 @@ GetNumberedTMHM: ; d417
ld c, a
ret
-_CheckTossableItem:: ; d427
+_CheckTossableItem::
; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be removed from the bag.
ld a, ITEMATTR_PERMISSIONS
call GetItemAttr
@@ -500,7 +500,7 @@ _CheckTossableItem:: ; d427
and a
ret
-CheckSelectableItem: ; d432
+CheckSelectableItem:
; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be selected.
ld a, ITEMATTR_PERMISSIONS
call GetItemAttr
@@ -509,7 +509,7 @@ CheckSelectableItem: ; d432
and a
ret
-CheckItemPocket:: ; d43d
+CheckItemPocket::
; Return the pocket for wCurItem in wItemAttributeParamBuffer.
ld a, ITEMATTR_POCKET
call GetItemAttr
@@ -517,7 +517,7 @@ CheckItemPocket:: ; d43d
ld [wItemAttributeParamBuffer], a
ret
-CheckItemContext: ; d448
+CheckItemContext:
; Return the context for wCurItem in wItemAttributeParamBuffer.
ld a, ITEMATTR_HELP
call GetItemAttr
@@ -525,7 +525,7 @@ CheckItemContext: ; d448
ld [wItemAttributeParamBuffer], a
ret
-CheckItemMenu: ; d453
+CheckItemMenu:
; Return the menu for wCurItem in wItemAttributeParamBuffer.
ld a, ITEMATTR_HELP
call GetItemAttr
@@ -534,7 +534,7 @@ CheckItemMenu: ; d453
ld [wItemAttributeParamBuffer], a
ret
-GetItemAttr: ; d460
+GetItemAttr:
; Get attribute a of wCurItem.
push hl
@@ -560,13 +560,13 @@ GetItemAttr: ; d460
pop hl
ret
-ItemAttr_ReturnCarry: ; d47f
+ItemAttr_ReturnCarry:
ld a, 1
ld [wItemAttributeParamBuffer], a
scf
ret
-GetItemPrice: ; d486
+GetItemPrice:
; Return the price of wCurItem in de.
push hl
push bc
diff --git a/engine/items/mart.asm b/engine/items/mart.asm
index 911251f65..7e185662b 100644
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -6,7 +6,7 @@
const MARTTEXT_HERE_YOU_GO
const MARTTEXT_SOLD_OUT
-OpenMartDialog:: ; 15a45
+OpenMartDialog::
call GetMart
ld a, c
ld [wEngineBuffer1], a
@@ -15,7 +15,6 @@ OpenMartDialog:: ; 15a45
ld hl, .dialogs
rst JumpTable
ret
-; 15a57
.dialogs
dw MartDialog
@@ -23,18 +22,16 @@ OpenMartDialog:: ; 15a45
dw BargainShop
dw Pharmacist
dw RooftopSale
-; 15a61
-MartDialog: ; 15a61
+MartDialog:
ld a, 0
ld [wEngineBuffer1], a
- xor a
+ xor a ; STANDARDMART_HOWMAYIHELPYOU
ld [wEngineBuffer5], a
call StandardMart
ret
-; 15a6e
-HerbShop: ; 15a6e
+HerbShop:
call FarReadMart
call LoadStandardMenuHeader
ld hl, Text_HerbShop_Intro
@@ -43,9 +40,8 @@ HerbShop: ; 15a6e
ld hl, Text_HerbShop_ComeAgain
call MartTextBox
ret
-; 15a84
-BargainShop: ; 15a84
+BargainShop:
ld b, BANK(BargainShopData)
ld de, BargainShopData
call LoadMartPointer
@@ -65,9 +61,8 @@ BargainShop: ; 15a84
ld hl, Text_BargainShop_ComeAgain
call MartTextBox
ret
-; 15aae
-Pharmacist: ; 15aae
+Pharmacist:
call FarReadMart
call LoadStandardMenuHeader
ld hl, Text_Pharmacist_Intro
@@ -76,9 +71,8 @@ Pharmacist: ; 15aae
ld hl, Text_Pharmacist_ComeAgain
call MartTextBox
ret
-; 15ac4
-RooftopSale: ; 15ac4
+RooftopSale:
ld b, BANK(RooftopSaleMart1)
ld de, RooftopSaleMart1
ld hl, wStatusFlags
@@ -97,11 +91,10 @@ RooftopSale: ; 15ac4
ld hl, Text_Mart_ComeAgain
call MartTextBox
ret
-; 15aee
INCLUDE "data/items/rooftop_sale.asm"
-LoadMartPointer: ; 15b10
+LoadMartPointer:
ld a, b
ld [wMartPointerBank], a
ld a, e
@@ -110,16 +103,15 @@ LoadMartPointer: ; 15b10
ld [wMartPointer + 1], a
ld hl, wCurMart
xor a
- ld bc, 16
+ ld bc, wCurMartEnd - wCurMart
call ByteFill
xor a
ld [wEngineBuffer5], a
ld [wBargainShopFlags], a
ld [wFacingDirection], a
ret
-; 15b31
-GetMart: ; 15b31
+GetMart:
ld a, e
cp (Marts.End - Marts) / 2
jr c, .IsAMart
@@ -136,36 +128,43 @@ GetMart: ; 15b31
ld d, [hl]
ld b, BANK(Marts)
ret
-; 15b47
-StandardMart: ; 15b47
+; 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]
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
dw .Sell
dw .Quit
dw .AnythingElse
-; 15b62
-.HowMayIHelpYou: ; 15b62
+.HowMayIHelpYou:
call LoadStandardMenuHeader
ld hl, Text_Mart_HowMayIHelpYou
call PrintText
- ld a, $1 ; top menu
+ ld a, STANDARDMART_TOPMENU
ret
-; 15b6e
-.TopMenu: ; 15b6e
+.TopMenu:
ld hl, MenuHeader_BuySell
call CopyMenuHeader
call VerticalMenu
@@ -176,49 +175,44 @@ StandardMart: ; 15b47
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
-; 15b8d
-.Buy: ; 15b8d
+.Buy:
call ExitMenu
call FarReadMart
call BuyMenu
and a
- ld a, $5 ; Anything else?
+ ld a, STANDARDMART_ANYTHINGELSE
ret
-; 15b9a
-.Sell: ; 15b9a
+.Sell:
call ExitMenu
call SellMenu
- ld a, $5 ; Anything else?
+ ld a, STANDARDMART_ANYTHINGELSE
ret
-; 15ba3
-.Quit: ; 15ba3
+.Quit:
call ExitMenu
ld hl, Text_Mart_ComeAgain
call MartTextBox
- ld a, $ff ; exit
+ ld a, -1
ret
-; 15baf
-.AnythingElse: ; 15baf
+.AnythingElse:
call LoadStandardMenuHeader
ld hl, Text_Mart_AnythingElse
call PrintText
- ld a, $1 ; top menu
+ ld a, STANDARDMART_TOPMENU
ret
-; 15bbb
-FarReadMart: ; 15bbb
+FarReadMart:
ld hl, wMartPointer
ld a, [hli]
ld h, [hl]
@@ -246,16 +240,15 @@ FarReadMart: ; 15bbb
.done
ret
-; 15be5
-GetMartItemPrice: ; 15be5
+GetMartItemPrice:
; Return the price of item a in BCD at hl and in tiles at wStringBuffer1.
push hl
ld [wCurItem], a
farcall GetItemPrice
pop hl
-GetMartPrice: ; 15bf0
+GetMartPrice:
; Return price de in BCD at hl and in tiles at wStringBuffer1.
push hl
ld a, d
@@ -280,9 +273,8 @@ GetMartPrice: ; 15bf0
dec c
jr nz, .loop
ret
-; 15c1a
-.CharToNybble: ; 15c1a
+.CharToNybble:
ld a, [de]
inc de
cp " "
@@ -292,9 +284,8 @@ GetMartPrice: ; 15bf0
.not_space
sub "0"
ret
-; 15c25
-ReadMart: ; 15c25
+ReadMart:
; Load the mart pointer. Mart data is local (no need for bank).
ld hl, wMartPointer
ld a, [hli]
@@ -337,12 +328,10 @@ ReadMart: ; 15c25
ld a, [hl]
ld [wCurMart], a
ret
-; 15c51
INCLUDE "data/items/bargain_shop.asm"
-
-BuyMenu: ; 15c62
+BuyMenu:
call FadeToMenu
farcall BlankScreen
xor a
@@ -354,9 +343,8 @@ BuyMenu: ; 15c62
jr nc, .loop
call CloseSubmenu
ret
-; 15c7d
-LoadBuyMenuText: ; 15c7d
+LoadBuyMenuText:
; load text from a nested table
; which table is in wEngineBuffer1
; which entry is in register a
@@ -375,9 +363,8 @@ LoadBuyMenuText: ; 15c7d
ld l, a
call PrintText
ret
-; 15c91
-MartAskPurchaseQuantity: ; 15c91
+MartAskPurchaseQuantity:
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
inc hl
inc hl
@@ -387,9 +374,8 @@ MartAskPurchaseQuantity: ; 15c91
cp 1
jp z, BargainShopAskPurchaseQuantity
jp RooftopSaleAskPurchaseQuantity
-; 15ca3
-GetMartDialogGroup: ; 15ca3
+GetMartDialogGroup:
ld a, [wEngineBuffer1]
ld e, a
ld d, 0
@@ -398,17 +384,15 @@ GetMartDialogGroup: ; 15ca3
add hl, de
add hl, de
ret
-; 15cb0
-.MartTextFunctionPointers: ; 15cb0
+.MartTextFunctionPointers:
dwb .StandardMartPointers, 0
dwb .HerbShopPointers, 0
dwb .BargainShopPointers, 1
dwb .PharmacyPointers, 0
dwb .StandardMartPointers, 2
-; 15cbf
-.StandardMartPointers: ; 15cbf
+.StandardMartPointers:
dw Text_Mart_HowMany
dw Text_Mart_CostsThisMuch
dw Text_Mart_InsufficientFunds
@@ -416,7 +400,7 @@ GetMartDialogGroup: ; 15ca3
dw Text_Mart_HereYouGo
dw BuyMenuLoop
-.HerbShopPointers: ; 15ccb
+.HerbShopPointers:
dw Text_HerbShop_HowMany
dw Text_HerbShop_CostsThisMuch
dw Text_HerbShop_InsufficientFunds
@@ -424,7 +408,7 @@ GetMartDialogGroup: ; 15ca3
dw Text_HerbShop_HereYouGo
dw BuyMenuLoop
-.BargainShopPointers: ; 15cd7
+.BargainShopPointers:
dw BuyMenuLoop
dw Text_BargainShop_CostsThisMuch
dw Text_BargainShop_InsufficientFunds
@@ -432,17 +416,15 @@ GetMartDialogGroup: ; 15ca3
dw Text_BargainShop_HereYouGo
dw Text_BargainShop_SoldOut
-.PharmacyPointers: ; 15ce3
+.PharmacyPointers:
dw Text_Pharmacy_HowMany
dw Text_Pharmacy_CostsThisMuch
dw Text_Pharmacy_InsufficientFunds
dw Text_Pharmacy_BagFull
dw Text_Pharmacy_HereYouGo
dw BuyMenuLoop
-; 15cef
-
-BuyMenuLoop: ; 15cef
+BuyMenuLoop:
farcall PlaceMoneyTopRight
call UpdateSprites
ld hl, MenuHeader_Buy
@@ -470,7 +452,7 @@ BuyMenuLoop: ; 15cef
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
@@ -478,7 +460,7 @@ BuyMenuLoop: ; 15cef
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
@@ -512,7 +494,6 @@ BuyMenuLoop: ; 15cef
call JoyWaitAorB
and a
ret
-; 15d83
StandardMartAskPurchaseQuantity:
ld a, 99
@@ -522,22 +503,20 @@ StandardMartAskPurchaseQuantity:
farcall SelectQuantityToBuy
call ExitMenu
ret
-; 15d97
-MartConfirmPurchase: ; 15d97
+MartConfirmPurchase:
predef PartyMonItemName
ld a, MARTTEXT_COSTS_THIS_MUCH
call LoadBuyMenuText
call YesNoBox
ret
-; 15da5
BargainShopAskPurchaseQuantity:
ld a, 1
ld [wItemQuantityChangeBuffer], a
ld a, [wMartItemID]
ld e, a
- ld d, $0
+ ld d, 0
ld b, CHECK_FLAG
ld hl, wBargainShopFlags
call FlagAction
@@ -546,7 +525,7 @@ BargainShopAskPurchaseQuantity:
jr nz, .SoldOut
ld a, [wMartItemID]
ld e, a
- ld d, $0
+ ld d, 0
ld hl, wMartPointer
ld a, [hli]
ld h, [hl]
@@ -571,7 +550,6 @@ BargainShopAskPurchaseQuantity:
call JoyWaitAorB
scf
ret
-; 15de2
RooftopSaleAskPurchaseQuantity:
ld a, MARTTEXT_HOW_MANY
@@ -582,9 +560,8 @@ RooftopSaleAskPurchaseQuantity:
farcall RooftopSale_SelectQuantityToBuy
call ExitMenu
ret
-; 15df9
-.GetSalePrice: ; 15df9
+.GetSalePrice:
ld a, [wMartItemID]
ld e, a
ld d, 0
@@ -601,29 +578,24 @@ RooftopSaleAskPurchaseQuantity:
inc hl
ld d, [hl]
ret
-; 15e0e
-
-Text_Mart_HowMany: ; 0x15e0e
+Text_Mart_HowMany:
; How many?
text_jump UnknownText_0x1c4bfd
db "@"
-; 0x15e13
-Text_Mart_CostsThisMuch: ; 0x15e13
+Text_Mart_CostsThisMuch:
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4c08
db "@"
-; 0x15e18
-MenuHeader_Buy: ; 0x15e18
+MenuHeader_Buy:
db MENU_BACKUP_TILES ; flags
menu_coords 1, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x15e20
-.MenuData ; 0x15e20
+.MenuData
db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -631,9 +603,8 @@ MenuHeader_Buy: ; 0x15e18
dba PlaceMenuItemName
dba .PrintBCDPrices
dba UpdateItemDescription
-; 15e30
-.PrintBCDPrices: ; 15e30
+.PrintBCDPrices:
ld a, [wScrollingMenuCursorPosition]
ld c, a
ld b, 0
@@ -650,136 +621,113 @@ MenuHeader_Buy: ; 0x15e18
ld c, PRINTNUM_LEADINGZEROS | PRINTNUM_MONEY | 3
call PrintBCDNumber
ret
-; 15e4a (5:5e4a)
-Text_HerbShop_Intro: ; 0x15e4a
+Text_HerbShop_Intro:
; Hello, dear. I sell inexpensive herbal medicine. They're good, but a trifle bitter. Your #MON may not like them. Hehehehe…
text_jump UnknownText_0x1c4c28
db "@"
-; 0x15e4f
-Text_HerbShop_HowMany: ; 0x15e4f
+Text_HerbShop_HowMany:
; How many?
text_jump UnknownText_0x1c4ca3
db "@"
-; 0x15e54
-Text_HerbShop_CostsThisMuch: ; 0x15e54
+Text_HerbShop_CostsThisMuch:
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4cae
db "@"
-; 0x15e59
-Text_HerbShop_HereYouGo: ; 0x15e59
+Text_HerbShop_HereYouGo:
; Thank you, dear. Hehehehe…
text_jump UnknownText_0x1c4cce
db "@"
-; 0x15e5e
-Text_HerbShop_BagFull: ; 0x15e5e
+Text_HerbShop_BagFull:
; Oh? Your PACK is full, dear.
text_jump UnknownText_0x1c4cea
db "@"
-; 0x15e63
-Text_HerbShop_InsufficientFunds: ; 0x15e63
+Text_HerbShop_InsufficientFunds:
; Hehehe… You don't have the money.
text_jump UnknownText_0x1c4d08
db "@"
-; 0x15e68
-Text_HerbShop_ComeAgain: ; 0x15e68
+Text_HerbShop_ComeAgain:
; Come again, dear. Hehehehe…
text_jump UnknownText_0x1c4d2a
db "@"
-; 0x15e6d
-Text_BargainShop_Intro: ; 0x15e6d
+Text_BargainShop_Intro:
; Hiya! Care to see some bargains? I sell rare items that nobody else carries--but only one of each item.
text_jump UnknownText_0x1c4d47
db "@"
-; 0x15e72
-Text_BargainShop_CostsThisMuch: ; 0x15e72
+Text_BargainShop_CostsThisMuch:
; costs ¥@ . Want it?
text_jump UnknownText_0x1c4db0
db "@"
-; 0x15e77
-Text_BargainShop_HereYouGo: ; 0x15e77
+Text_BargainShop_HereYouGo:
; Thanks.
text_jump UnknownText_0x1c4dcd
db "@"
-; 0x15e7c
-Text_BargainShop_BagFull: ; 0x15e7c
+Text_BargainShop_BagFull:
; Uh-oh, your PACK is chock-full.
text_jump UnknownText_0x1c4dd6
db "@"
-; 0x15e81
-Text_BargainShop_SoldOut: ; 0x15e81
+Text_BargainShop_SoldOut:
; You bought that already. I'm all sold out of it.
text_jump UnknownText_0x1c4df7
db "@"
-; 0x15e86
-Text_BargainShop_InsufficientFunds: ; 0x15e86
+Text_BargainShop_InsufficientFunds:
; Uh-oh, you're short on funds.
text_jump UnknownText_0x1c4e28
db "@"
-; 0x15e8b
-Text_BargainShop_ComeAgain: ; 0x15e8b
+Text_BargainShop_ComeAgain:
; Come by again sometime.
text_jump UnknownText_0x1c4e46
db "@"
-; 0x15e90
-Text_Pharmacist_Intro: ; 0x15e90
+Text_Pharmacist_Intro:
; What's up? Need some medicine?
text_jump UnknownText_0x1c4e5f
db "@"
-; 0x15e95
-Text_Pharmacy_HowMany: ; 0x15e95
+Text_Pharmacy_HowMany:
; How many?
text_jump UnknownText_0x1c4e7e
db "@"
-; 0x15e9a
-Text_Pharmacy_CostsThisMuch: ; 0x15e9a
+Text_Pharmacy_CostsThisMuch:
; @ (S) will cost ¥@ .
text_jump UnknownText_0x1c4e89
db "@"
-; 0x15e9f
-Text_Pharmacy_HereYouGo: ; 0x15e9f
+Text_Pharmacy_HereYouGo:
; Thanks much!
text_jump UnknownText_0x1c4eab
db "@"
-; 0x15ea4
-Text_Pharmacy_BagFull: ; 0x15ea4
+Text_Pharmacy_BagFull:
; You don't have any more space.
text_jump UnknownText_0x1c4eb9
db "@"
-; 0x15ea9
-Text_Pharmacy_InsufficientFunds: ; 0x15ea9
+Text_Pharmacy_InsufficientFunds:
; Huh? That's not enough money.
text_jump UnknownText_0x1c4ed8
db "@"
-; 0x15eae
-Text_Pharmacist_ComeAgain: ; 0x15eae
+Text_Pharmacist_ComeAgain:
; All right. See you around.
text_jump UnknownText_0x1c4ef6
db "@"
-; 0x15eb3
-
-SellMenu: ; 15eb3
+SellMenu:
call DisableSpriteUpdates
farcall DepositSellInitPackBuffers
.loop
@@ -794,31 +742,26 @@ SellMenu: ; 15eb3
call ReturnToMapWithSpeechTextbox
and a
ret
-; 15ed3
.Unreferenced_NothingToSell:
ld hl, .NothingToSellText
call MenuTextBoxBackup
and a
ret
-; 15edb
-.NothingToSellText: ; 0x15edb
+.NothingToSellText:
; You don't have anything to sell.
text_jump UnknownText_0x1c4f12
db "@"
-; 0x15ee0
-
-.TryToSellItem: ; 15ee0
+.TryToSellItem:
farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
ret
-; 15eee
-.dw ; 15eee
+.dw
dw .try_sell
dw .cant_buy
dw .cant_buy
@@ -826,14 +769,11 @@ SellMenu: ; 15eb3
dw .try_sell
dw .try_sell
dw .try_sell
-; 15efc
-.cant_buy ; 15efc
+.cant_buy
ret
-; 15efd
-
-.try_sell ; 15efd
+.try_sell
farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -877,94 +817,79 @@ SellMenu: ; 15eb3
call ExitMenu
and a
ret
-; 15f73
-Text_Mart_SellHowMany: ; 0x15f73
+Text_Mart_SellHowMany:
; How many?
text_jump UnknownText_0x1c4f33
db "@"
-; 0x15f78
-Text_Mart_ICanPayThisMuch: ; 0x15f78
+Text_Mart_ICanPayThisMuch:
; I can pay you ¥@ . Is that OK?
text_jump UnknownText_0x1c4f3e
db "@"
-; 0x15f7d
-.UnusedString15f7d: ; 15f7d
+.UnusedString15f7d:
db "!ダミー!@"
-Text_Mart_HowMayIHelpYou: ; 0x15f83
+Text_Mart_HowMayIHelpYou:
; Welcome! How may I help you?
text_jump UnknownText_0x1c4f62
db "@"
-; 0x15f88
-MenuHeader_BuySell: ; 0x15f88
+MenuHeader_BuySell:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 7, 8
dw .MenuData
db 1 ; default option
-; 0x15f90
-.MenuData ; 0x15f90
+.MenuData
db STATICMENU_CURSOR ; strings
db 3 ; items
db "BUY@"
db "SELL@"
db "QUIT@"
-; 0x15f96
-Text_Mart_HereYouGo: ; 0x15fa0
+Text_Mart_HereYouGo:
; Here you are. Thank you!
text_jump UnknownText_0x1c4f80
db "@"
-; 0x15fa5
-Text_Mart_InsufficientFunds: ; 0x15fa5
+Text_Mart_InsufficientFunds:
; You don't have enough money.
text_jump UnknownText_0x1c4f9a
db "@"
-; 0x15faa
-Text_Mart_BagFull: ; 0x15faa
+Text_Mart_BagFull:
; You can't carry any more items.
text_jump UnknownText_0x1c4fb7
db "@"
-; 0x15faf
-TextMart_CantBuyFromYou: ; 0x15faf
+TextMart_CantBuyFromYou:
; Sorry, I can't buy that from you.
text_jump UnknownText_0x1c4fd7
db "@"
-; 0x15fb4
-Text_Mart_ComeAgain: ; 0x15fb4
+Text_Mart_ComeAgain:
; Please come again!
text_jump UnknownText_0x1c4ff9
db "@"
-; 0x15fb9
-Text_Mart_AnythingElse: ; 0x15fb9
+Text_Mart_AnythingElse:
text_jump UnknownText_0x1c500d
db "@"
-; 0x15fbe
-Text_Mart_SoldForAmount: ; 0x15fbe
+Text_Mart_SoldForAmount:
text_jump UnknownText_0x1c502e
db "@"
-; 0x15fc3
-PlayTransactionSound: ; 15fc3
+PlayTransactionSound:
call WaitSFX
ld de, SFX_TRANSACTION
call PlaySFX
ret
-; 15fcd
-MartTextBox: ; 15fcd
+MartTextBox:
call MenuTextBox
call JoyWaitAorB
call ExitMenu
ret
-; 15fd7
diff --git a/engine/items/pack.asm b/engine/items/pack.asm
index ea3a051ac..67e9fe900 100644
--- a/engine/items/pack.asm
+++ b/engine/items/pack.asm
@@ -12,7 +12,7 @@
const PACKSTATE_QUITNOSCRIPT ; 9
const PACKSTATE_QUITRUNSCRIPT ; 10
-Pack: ; 10000
+Pack:
ld hl, wOptions
set NO_TEXT_SCROLL, [hl]
call InitPackBuffers
@@ -31,17 +31,14 @@ Pack: ; 10000
ld hl, wOptions
res NO_TEXT_SCROLL, [hl]
ret
-; 10026
-.RunJumptable: ; 10026
+.RunJumptable:
ld a, [wJumptableIndex]
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
-; 10030
-
-.Jumptable: ; 10030 (4:4030)
+.Jumptable:
; entries correspond to PACKSTATE_* constants
dw .InitGFX ; 0
dw .InitItemsPocket ; 1
@@ -55,7 +52,7 @@ Pack: ; 10000
dw Pack_QuitNoScript ; 9
dw Pack_QuitRunScript ; 10
-.InitGFX: ; 10046 (4:4046)
+.InitGFX:
xor a
ld [hBGMapMode], a
call Pack_InitGFX
@@ -64,7 +61,7 @@ Pack: ; 10000
call Pack_InitColors
ret
-.InitItemsPocket: ; 10056 (4:4056)
+.InitItemsPocket:
xor a ; ITEM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -73,7 +70,7 @@ Pack: ; 10000
call Pack_JumptableNext
ret
-.ItemsPocketMenu: ; 10067 (4:4067)
+.ItemsPocketMenu:
ld hl, ItemsPocketMenuHeader
call CopyMenuHeader
ld a, [wItemsPocketCursor]
@@ -92,7 +89,7 @@ Pack: ; 10000
call .ItemBallsKey_LoadSubmenu
ret
-.InitKeyItemsPocket: ; 10094 (4:4094)
+.InitKeyItemsPocket:
ld a, KEY_ITEM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -101,7 +98,7 @@ Pack: ; 10000
call Pack_JumptableNext
ret
-.KeyItemsPocketMenu: ; 100a6 (4:40a6)
+.KeyItemsPocketMenu:
ld hl, KeyItemsPocketMenuHeader
call CopyMenuHeader
ld a, [wKeyItemsPocketCursor]
@@ -120,7 +117,7 @@ Pack: ; 10000
call .ItemBallsKey_LoadSubmenu
ret
-.InitTMHMPocket: ; 100d3 (4:40d3)
+.InitTMHMPocket:
ld a, TM_HM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -131,7 +128,7 @@ Pack: ; 10000
call Pack_JumptableNext
ret
-.TMHMPocketMenu: ; 100e8 (4:40e8)
+.TMHMPocketMenu:
farcall TMHMPocket
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
@@ -160,49 +157,41 @@ Pack: ; 10000
call Pack_GetJumptablePointer
jp hl
-; 10124 (4:4124)
-.MenuHeader1: ; 0x10124
+.MenuHeader1:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData_1
db 1 ; default option
-; 0x1012c
-.MenuData_1: ; 0x1012c
+.MenuData_1:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 2 ; items
db "USE@"
db "QUIT@"
-; 0x10137
-.Jumptable1: ; 10137
+.Jumptable1:
dw .UseItem
dw QuitItemSubmenu
-; 1013b
-
-.MenuHeader2: ; 0x1013b
+.MenuHeader2:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData_2
db 1 ; default option
-; 0x10143
-.MenuData_2: ; 0x10143
+.MenuData_2:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 3 ; items
db "USE@"
db "GIVE@"
db "QUIT@"
-; 0x10153
-.Jumptable2: ; 10153
+.Jumptable2:
dw .UseItem
dw GiveItem
dw QuitItemSubmenu
-; 10159
-.UseItem: ; 10159
+.UseItem:
farcall AskTeachTMHM
ret c
farcall ChooseMonToLearnTMHM
@@ -222,7 +211,7 @@ Pack: ; 10000
call Pack_InitColors
ret
-.InitBallsPocket: ; 10186 (4:4186)
+.InitBallsPocket:
ld a, BALL_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -231,7 +220,7 @@ Pack: ; 10000
call Pack_JumptableNext
ret
-.BallsPocketMenu: ; 10198 (4:4198)
+.BallsPocketMenu:
ld hl, BallsPocketMenuHeader
call CopyMenuHeader
ld a, [wBallsPocketCursor]
@@ -250,7 +239,7 @@ Pack: ; 10000
call .ItemBallsKey_LoadSubmenu
ret
-.ItemBallsKey_LoadSubmenu: ; 101c5 (4:41c5)
+.ItemBallsKey_LoadSubmenu:
farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -319,15 +308,13 @@ Pack: ; 10000
call Pack_GetJumptablePointer
jp hl
-; 10249 (4:4249)
-MenuHeader_UsableKeyItem: ; 0x10249
+MenuHeader_UsableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10251
-.MenuData: ; 0x10251
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 5 ; items
db "USE@"
@@ -335,133 +322,114 @@ MenuHeader_UsableKeyItem: ; 0x10249
db "TOSS@"
db "SEL@"
db "QUIT@"
-; 0x1026a
-Jumptable_UseGiveTossRegisterQuit: ; 1026a
+Jumptable_UseGiveTossRegisterQuit:
dw UseItem
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
-; 10274
-MenuHeader_UsableItem: ; 0x10274
+MenuHeader_UsableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x1027c
-.MenuData: ; 0x1027c
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 4 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "QUIT@"
-; 0x10291
-Jumptable_UseGiveTossQuit: ; 10291
+Jumptable_UseGiveTossQuit:
dw UseItem
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
-; 10299
-MenuHeader_UnusableItem: ; 0x10299
+MenuHeader_UnusableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x102a1
-.MenuData: ; 0x102a1
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 2 ; items
db "USE@"
db "QUIT@"
-; 0x102ac
-Jumptable_UseQuit: ; 102ac
+Jumptable_UseQuit:
dw UseItem
dw QuitItemSubmenu
-; 102b0
-MenuHeader_UnusableKeyItem: ; 0x102b0
+MenuHeader_UnusableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x102b8
-.MenuData: ; 0x102b8
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 3 ; items
db "USE@"
db "SEL@"
db "QUIT@"
-; 0x102c7
-Jumptable_UseRegisterQuit: ; 102c7
+Jumptable_UseRegisterQuit:
dw UseItem
dw RegisterItem
dw QuitItemSubmenu
-; 102cd
-MenuHeader_HoldableKeyItem: ; 0x102cd
+MenuHeader_HoldableKeyItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x102d5
-.MenuData: ; 0x102d5
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 4 ; items
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
-; 0x102ea
-Jumptable_GiveTossRegisterQuit: ; 102ea
+Jumptable_GiveTossRegisterQuit:
dw GiveItem
dw TossMenu
dw RegisterItem
dw QuitItemSubmenu
-; 102f2
-MenuHeader_HoldableItem: ; 0x102f2
+MenuHeader_HoldableItem:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 5, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x102fa
-.MenuData: ; 0x102fa
+.MenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 3 ; items
db "GIVE@"
db "TOSS@"
db "QUIT@"
-; 0x1030b
-Jumptable_GiveTossQuit: ; 1030b
+Jumptable_GiveTossQuit:
dw GiveItem
dw TossMenu
dw QuitItemSubmenu
-; 10311
-
-UseItem: ; 10311
+UseItem:
farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
ret
-; 1031f
-.dw ; 1031f (4:431f)
+.dw
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
dw .Oak
@@ -470,18 +438,17 @@ UseItem: ; 10311
dw .Current ; ITEMMENU_CURRENT
dw .Party ; ITEMMENU_PARTY
dw .Field ; ITEMMENU_CLOSE
-; 1035c
-.Oak: ; 1032d (4:432d)
+.Oak:
ld hl, Text_ThisIsntTheTime
call Pack_PrintTextNoScroll
ret
-.Current: ; 10334 (4:4334)
+.Current:
call DoItemEffect
ret
-.Party: ; 10338 (4:4338)
+.Party:
ld a, [wPartyCount]
and a
jr z, .NoPokemon
@@ -498,7 +465,7 @@ UseItem: ; 10311
call Pack_PrintTextNoScroll
ret
-.Field: ; 10355 (4:4355)
+.Field:
call DoItemEffect
ld a, [wItemEffectSucceeded]
and a
@@ -506,9 +473,8 @@ UseItem: ; 10311
ld a, PACKSTATE_QUITRUNSCRIPT
ld [wJumptableIndex], a
ret
-; 10364 (4:4364)
-TossMenu: ; 10364
+TossMenu:
ld hl, Text_ThrowAwayHowMany
call Pack_PrintTextNoScroll
farcall SelectQuantityToToss
@@ -532,9 +498,8 @@ TossMenu: ; 10364
call Pack_PrintTextNoScroll
.finish
ret
-; 1039d
-Unreferenced_ResetPocketCursorPositions: ; 1039d
+Unreferenced_ResetPocketCursorPositions:
ld a, [wCurrPocket]
and a ; ITEM_POCKET
jr z, .items
@@ -561,9 +526,8 @@ Unreferenced_ResetPocketCursorPositions: ; 1039d
ld [wKeyItemsPocketCursor], a
ld [wKeyItemsPocketScrollPosition], a
ret
-; 103c2
-RegisterItem: ; 103c2
+RegisterItem:
farcall CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -571,11 +535,11 @@ RegisterItem: ; 103c2
ld a, [wCurrPocket]
rrca
rrca
- and $c0
+ and REGISTERED_POCKET
ld b, a
ld a, [wCurItemQuantity]
inc a
- and $3f
+ and REGISTERED_NUMBER
or b
ld [wWhichRegisteredItem], a
ld a, [wCurItem]
@@ -591,9 +555,8 @@ RegisterItem: ; 103c2
ld hl, Text_CantRegister
call Pack_PrintTextNoScroll
ret
-; 103fd
-GiveItem: ; 103fd
+GiveItem:
ld a, [wPartyCount]
and a
jp z, .NoPokemon
@@ -647,22 +610,19 @@ GiveItem: ; 103fd
call Pack_InitColors
ret
-.NoPokemon: ; 10486 (4:4486)
+.NoPokemon:
ld hl, TextJump_YouDontHaveAMon
call Pack_PrintTextNoScroll
ret
-; 1048d (4:448d)
-.Egg: ; 0x1048d
+.Egg:
; An EGG can't hold an item.
text_jump Text_AnEGGCantHoldAnItem
db "@"
-; 0x10492
-QuitItemSubmenu: ; 10492
+QuitItemSubmenu:
ret
-; 10493
-BattlePack: ; 10493
+BattlePack:
ld hl, wOptions
set NO_TEXT_SCROLL, [hl]
call InitPackBuffers
@@ -681,17 +641,14 @@ BattlePack: ; 10493
ld hl, wOptions
res NO_TEXT_SCROLL, [hl]
ret
-; 104b9
-.RunJumptable: ; 104b9
+.RunJumptable:
ld a, [wJumptableIndex]
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
-; 104c3
-
-.Jumptable: ; 104c3 (4:44c3)
+.Jumptable:
; entries correspond to PACKSTATE_* constants
dw .InitGFX ; 0
dw .InitItemsPocket ; 1
@@ -705,7 +662,7 @@ BattlePack: ; 10493
dw Pack_QuitNoScript ; 9
dw Pack_QuitRunScript ; 10
-.InitGFX: ; 104d9 (4:44d9)
+.InitGFX:
xor a
ld [hBGMapMode], a
call Pack_InitGFX
@@ -714,7 +671,7 @@ BattlePack: ; 10493
call Pack_InitColors
ret
-.InitItemsPocket: ; 104e9 (4:44e9)
+.InitItemsPocket:
xor a ; ITEM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -723,7 +680,7 @@ BattlePack: ; 10493
call Pack_JumptableNext
ret
-.ItemsPocketMenu: ; 104fa (4:44fa)
+.ItemsPocketMenu:
ld hl, ItemsPocketMenuHeader
call CopyMenuHeader
ld a, [wItemsPocketCursor]
@@ -742,7 +699,7 @@ BattlePack: ; 10493
call ItemSubmenu
ret
-.InitKeyItemsPocket: ; 10527 (4:4527)
+.InitKeyItemsPocket:
ld a, KEY_ITEM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -751,7 +708,7 @@ BattlePack: ; 10493
call Pack_JumptableNext
ret
-.KeyItemsPocketMenu: ; 10539 (4:4539)
+.KeyItemsPocketMenu:
ld hl, KeyItemsPocketMenuHeader
call CopyMenuHeader
ld a, [wKeyItemsPocketCursor]
@@ -770,7 +727,7 @@ BattlePack: ; 10493
call ItemSubmenu
ret
-.InitTMHMPocket: ; 10566 (4:4566)
+.InitTMHMPocket:
ld a, TM_HM_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -783,7 +740,7 @@ BattlePack: ; 10493
call Pack_JumptableNext
ret
-.TMHMPocketMenu: ; 10581 (4:4581)
+.TMHMPocketMenu:
farcall TMHMPocket
ld b, PACKSTATE_INITKEYITEMSPOCKET ; left
ld c, PACKSTATE_INITITEMSPOCKET ; right
@@ -793,7 +750,7 @@ BattlePack: ; 10493
call TMHMSubmenu
ret
-.InitBallsPocket: ; 10594 (4:4594)
+.InitBallsPocket:
ld a, BALL_POCKET
ld [wCurrPocket], a
call ClearPocketList
@@ -802,7 +759,7 @@ BattlePack: ; 10493
call Pack_JumptableNext
ret
-.BallsPocketMenu: ; 105a6 (4:45a6)
+.BallsPocketMenu:
ld hl, BallsPocketMenuHeader
call CopyMenuHeader
ld a, [wBallsPocketCursor]
@@ -821,10 +778,10 @@ BattlePack: ; 10493
call ItemSubmenu
ret
-ItemSubmenu: ; 105d3 (4:45d3)
+ItemSubmenu:
farcall CheckItemContext
ld a, [wItemAttributeParamBuffer]
-TMHMSubmenu: ; 105dc (4:45dc)
+TMHMSubmenu:
and a
jr z, .NoUse
ld hl, .UsableMenuHeader
@@ -846,51 +803,44 @@ TMHMSubmenu: ; 105dc (4:45dc)
call Pack_GetJumptablePointer
jp hl
-; 10601 (4:4601)
-.UsableMenuHeader: ; 0x10601
+.UsableMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 7, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .UsableMenuData
db 1 ; default option
-; 0x10609
-.UsableMenuData: ; 0x10609
+.UsableMenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 2 ; items
db "USE@"
db "QUIT@"
-; 0x10614
-.UsableJumptable: ; 10614
+.UsableJumptable:
dw .Use
dw .Quit
-; 10618
-.UnusableMenuHeader: ; 0x10618
+.UnusableMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 13, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .UnusableMenuData
db 1 ; default option
-; 0x10620
-.UnusableMenuData: ; 0x10620
+.UnusableMenuData:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 1 ; items
db "QUIT@"
-; 0x10627
-.UnusableJumptable: ; 10627
+.UnusableJumptable:
dw .Quit
-; 10629
-.Use: ; 10629
+.Use:
farcall CheckItemContext
ld a, [wItemAttributeParamBuffer]
ld hl, .ItemFunctionJumptable
rst JumpTable
ret
-.ItemFunctionJumptable: ; 10637 (4:4637)
+.ItemFunctionJumptable:
; entries correspond to ITEMMENU_* constants
dw .Oak ; ITEMMENU_NOUSE
dw .Oak
@@ -900,19 +850,19 @@ TMHMSubmenu: ; 105dc (4:45dc)
dw .BattleField ; ITEMMENU_PARTY
dw .BattleOnly ; ITEMMENU_CLOSE
-.Oak: ; 10645 (4:4645)
+.Oak:
ld hl, Text_ThisIsntTheTime
call Pack_PrintTextNoScroll
ret
-.Unused: ; 1064c (4:464c)
+.Unused:
call DoItemEffect
ld a, [wItemEffectSucceeded]
and a
jr nz, .ReturnToBattle
ret
-.BattleField: ; 10656 (4:4656)
+.BattleField:
call DoItemEffect
ld a, [wItemEffectSucceeded]
and a
@@ -924,32 +874,30 @@ TMHMSubmenu: ; 105dc (4:45dc)
call Pack_InitColors
ret
-.ReturnToBattle: ; 1066c (4:466c)
+.ReturnToBattle:
call ClearBGPalettes
jr .quit_run_script
-.BattleOnly: ; 10671 (4:4671)
+.BattleOnly:
call DoItemEffect
ld a, [wItemEffectSucceeded]
and a
jr z, .Oak
cp $2
jr z, .didnt_use_item
-.quit_run_script ; 1067e (4:467e)
+.quit_run_script
ld a, PACKSTATE_QUITRUNSCRIPT
ld [wJumptableIndex], a
ret
-.didnt_use_item ; 10684 (4:4684)
+.didnt_use_item
xor a
ld [wItemEffectSucceeded], a
ret
-; 10689 (4:4689)
-.Quit: ; 10689
+.Quit:
ret
-; 1068a
-InitPackBuffers: ; 1068a
+InitPackBuffers:
xor a
ld [wJumptableIndex], a
; pocket id -> jumptable index
@@ -965,9 +913,8 @@ InitPackBuffers: ; 1068a
xor a
ld [wSwitchItem], a
ret
-; 106a5
-DepositSellInitPackBuffers: ; 106a5
+DepositSellInitPackBuffers:
xor a
ld [hBGMapMode], a
ld [wJumptableIndex], a ; PACKSTATE_INITGFX
@@ -978,32 +925,28 @@ DepositSellInitPackBuffers: ; 106a5
call Pack_InitGFX
call Pack_InitColors
ret
-; 106be
-DepositSellPack: ; 106be
+DepositSellPack:
.loop
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
jr c, .loop
ret
-; 106c7
-.RunJumptable: ; 106c7
+.RunJumptable:
ld a, [wJumptableIndex]
ld hl, .Jumptable
call Pack_GetJumptablePointer
jp hl
-; 106d1
-
-.Jumptable: ; 106d1 (4:46d1)
+.Jumptable:
; entries correspond to *_POCKET constants
dw .ItemsPocket
dw .BallsPocket
dw .KeyItemsPocket
dw .TMHMPocket
-.ItemsPocket: ; 106d9 (4:46d9)
+.ItemsPocket:
xor a ; ITEM_POCKET
call InitPocket
ld hl, PC_Mart_ItemsPocketMenuHeader
@@ -1019,7 +962,7 @@ DepositSellPack: ; 106be
ld [wItemsPocketCursor], a
ret
-.KeyItemsPocket: ; 106ff (4:46ff)
+.KeyItemsPocket:
ld a, KEY_ITEM_POCKET
call InitPocket
ld hl, PC_Mart_KeyItemsPocketMenuHeader
@@ -1035,7 +978,7 @@ DepositSellPack: ; 106be
ld [wKeyItemsPocketCursor], a
ret
-.TMHMPocket: ; 10726 (4:4726)
+.TMHMPocket:
ld a, TM_HM_POCKET
call InitPocket
call WaitBGMap_DrawPackGFX
@@ -1044,7 +987,7 @@ DepositSellPack: ; 106be
ld [wCurItem], a
ret
-.BallsPocket: ; 1073b (4:473b)
+.BallsPocket:
ld a, BALL_POCKET
call InitPocket
ld hl, PC_Mart_BallsPocketMenuHeader
@@ -1060,14 +1003,14 @@ DepositSellPack: ; 106be
ld [wBallsPocketCursor], a
ret
-InitPocket: ; 10762 (4:4762)
+InitPocket:
ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
ret
-DepositSellTutorial_InterpretJoypad: ; 1076f
+DepositSellTutorial_InterpretJoypad:
ld hl, wMenuJoypad
ld a, [hl]
and A_BUTTON
@@ -1119,9 +1062,8 @@ DepositSellTutorial_InterpretJoypad: ; 1076f
pop de
scf
ret
-; 107bb
-TutorialPack: ; 107bb
+TutorialPack:
call DepositSellInitPackBuffers
ld a, [wInputType]
or a
@@ -1134,37 +1076,32 @@ TutorialPack: ; 107bb
xor a ; FALSE
ld [wPackUsedItem], a
ret
-; 107d7
-.RunJumptable: ; 107d7
+.RunJumptable:
ld a, [wJumptableIndex]
ld hl, .dw
call Pack_GetJumptablePointer
jp hl
-; 107e1
-
-.dw ; 107e1 (4:47e1)
+.dw
; entries correspond to *_POCKET constants
dw .Items
dw .Balls
dw .KeyItems
dw .TMHM
-.Items: ; 107e9 (4:47e9)
+.Items:
xor a ; ITEM_POCKET
ld hl, .ItemsMenuHeader
jr .DisplayPocket
-; 107ef (4:47ef)
-.ItemsMenuHeader: ; 0x107ef
+.ItemsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .ItemsMenuData
db 1 ; default option
-; 0x107f7
-.ItemsMenuData: ; 0x107f7
+.ItemsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1172,22 +1109,19 @@ TutorialPack: ; 107bb
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10807
-.KeyItems: ; 10807 (4:4807)
+.KeyItems:
ld a, KEY_ITEM_POCKET
ld hl, .KeyItemsMenuHeader
jr .DisplayPocket
-; 1080e (4:480e)
-.KeyItemsMenuHeader: ; 0x1080e
+.KeyItemsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .KeyItemsMenuData
db 1 ; default option
-; 0x10816
-.KeyItemsMenuData: ; 0x10816
+.KeyItemsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1195,9 +1129,8 @@ TutorialPack: ; 107bb
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10826
-.TMHM: ; 10826 (4:4826)
+.TMHM:
ld a, TM_HM_POCKET
call InitPocket
call WaitBGMap_DrawPackGFX
@@ -1206,20 +1139,18 @@ TutorialPack: ; 107bb
ld [wCurItem], a
ret
-.Balls: ; 1083b (4:483b)
+.Balls:
ld a, BALL_POCKET
ld hl, .BallsMenuHeader
jr .DisplayPocket
-; 10842 (4:4842)
-.BallsMenuHeader: ; 0x10842
+.BallsMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .BallsMenuData
db 1 ; default option
-; 0x1084a
-.BallsMenuData: ; 0x1084a
+.BallsMenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1227,9 +1158,8 @@ TutorialPack: ; 107bb
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 1085a
-.DisplayPocket: ; 1085a (4:485a)
+.DisplayPocket:
push hl
call InitPocket
pop hl
@@ -1237,12 +1167,12 @@ TutorialPack: ; 107bb
call ScrollingMenu
ret
-Pack_JumptableNext: ; 10866 (4:4866)
+Pack_JumptableNext:
ld hl, wJumptableIndex
inc [hl]
ret
-Pack_GetJumptablePointer: ; 1086b
+Pack_GetJumptablePointer:
ld e, a
ld d, 0
add hl, de
@@ -1251,23 +1181,22 @@ Pack_GetJumptablePointer: ; 1086b
ld h, [hl]
ld l, a
ret
-; 10874
-Pack_QuitNoScript: ; 10874 (4:4874)
+Pack_QuitNoScript:
ld hl, wJumptableIndex
set 7, [hl]
xor a ; FALSE
ld [wPackUsedItem], a
ret
-Pack_QuitRunScript: ; 1087e (4:487e)
+Pack_QuitRunScript:
ld hl, wJumptableIndex
set 7, [hl]
ld a, TRUE
ld [wPackUsedItem], a
ret
-Pack_PrintTextNoScroll: ; 10889 (4:4889)
+Pack_PrintTextNoScroll:
ld a, [wOptions]
push af
set NO_TEXT_SCROLL, a
@@ -1277,13 +1206,13 @@ Pack_PrintTextNoScroll: ; 10889 (4:4889)
ld [wOptions], a
ret
-WaitBGMap_DrawPackGFX: ; 1089a (4:489a)
+WaitBGMap_DrawPackGFX:
call WaitBGMap
-DrawPackGFX: ; 1089d
+DrawPackGFX:
ld a, [wCurrPocket]
maskbits NUM_POCKETS
ld e, a
- ld d, $0
+ ld d, 0
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .male_dude
@@ -1305,16 +1234,14 @@ DrawPackGFX: ; 1089d
.female
farcall DrawKrisPackGFX
ret
-; 108cc
-PackGFXPointers: ; 108cc
+PackGFXPointers:
dw PackGFX + (15 tiles) * 1 ; ITEM_POCKET
dw PackGFX + (15 tiles) * 3 ; BALL_POCKET
dw PackGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
dw PackGFX + (15 tiles) * 2 ; TM_HM_POCKET
-; 108d4
-Pack_InterpretJoypad: ; 108d4 (4:48d4)
+Pack_InterpretJoypad:
ld hl, wMenuJoypad
ld a, [wSwitchItem]
and a
@@ -1398,7 +1325,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4)
scf
ret
-Pack_InitGFX: ; 10955
+Pack_InitGFX:
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -1435,9 +1362,8 @@ Pack_InitGFX: ; 10955
call EnableLCD
call DrawPackGFX
ret
-; 109a5
-PlacePackGFX: ; 109a5
+PlacePackGFX:
hlcoord 0, 3
ld a, $50
ld de, SCREEN_WIDTH - 5
@@ -1453,9 +1379,8 @@ PlacePackGFX: ; 109a5
dec b
jr nz, .row
ret
-; 109bb
-DrawPocketName: ; 109bb
+DrawPocketName:
ld a, [wCurrPocket]
; * 15
ld d, a
@@ -1484,9 +1409,8 @@ DrawPocketName: ; 109bb
dec c
jr nz, .row
ret
-; 109e1
-.tilemap ; 109e1
+.tilemap
; ITEM_POCKET
db $00, $04, $04, $04, $01 ; top border
db $06, $07, $08, $09, $0a ; Items
@@ -1503,47 +1427,42 @@ DrawPocketName: ; 109bb
db $00, $04, $04, $04, $01 ; top border
db $10, $11, $12, $13, $14 ; TM/HM
db $02, $05, $05, $05, $03 ; bottom border
-; 10a1d
-Pack_GetItemName: ; 10a1d
+Pack_GetItemName:
ld a, [wCurItem]
ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyName1
ret
-; 10a2a
-Unreferenced_Pack_ClearTilemap: ; 10a2a
+Unreferenced_Pack_ClearTilemap:
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
call ByteFill
ret
-; 10a36
-ClearPocketList: ; 10a36 (4:4a36)
+ClearPocketList:
hlcoord 5, 2
lb bc, 10, SCREEN_WIDTH - 5
call ClearBox
ret
-Pack_InitColors: ; 10a40
+Pack_InitColors:
call WaitBGMap
ld b, SCGB_PACKPALS
call GetSGBLayout
call SetPalettes
call DelayFrame
ret
-; 10a4f
-ItemsPocketMenuHeader: ; 0x10a4f
+ItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10a57
-.MenuData: ; 0x10a57
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1551,16 +1470,14 @@ ItemsPocketMenuHeader: ; 0x10a4f
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10a67
-PC_Mart_ItemsPocketMenuHeader: ; 0x10a67
+PC_Mart_ItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10a6f
-.MenuData: ; 0x10a6f
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1568,16 +1485,14 @@ PC_Mart_ItemsPocketMenuHeader: ; 0x10a67
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10a7f
-KeyItemsPocketMenuHeader: ; 0x10a7f
+KeyItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10a87
-.MenuData: ; 0x10a87
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1585,16 +1500,14 @@ KeyItemsPocketMenuHeader: ; 0x10a7f
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10a97
-PC_Mart_KeyItemsPocketMenuHeader: ; 0x10a97
+PC_Mart_KeyItemsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10a9f
-.MenuData: ; 0x10a9f
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1602,16 +1515,14 @@ PC_Mart_KeyItemsPocketMenuHeader: ; 0x10a97
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10aaf
-BallsPocketMenuHeader: ; 0x10aaf
+BallsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10ab7
-.MenuData: ; 0x10ab7
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1619,16 +1530,14 @@ BallsPocketMenuHeader: ; 0x10aaf
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10ac7
-PC_Mart_BallsPocketMenuHeader: ; 0x10ac7
+PC_Mart_BallsPocketMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 7, 1, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
-; 0x10acf
-.MenuData: ; 0x10acf
+.MenuData:
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1636,74 +1545,62 @@ PC_Mart_BallsPocketMenuHeader: ; 0x10ac7
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
-; 10adf
-Text_PackNoItems: ; 0x10adf
+Text_PackNoItems:
; No items.
text_jump UnknownText_0x1c0b9a
db "@"
-; 0x10ae4
-Text_ThrowAwayHowMany: ; 0x10ae4
+Text_ThrowAwayHowMany:
; Throw away how many?
text_jump UnknownText_0x1c0ba5
db "@"
-; 0x10ae9
-Text_ConfirmThrowAway: ; 0x10ae9
+Text_ConfirmThrowAway:
; Throw away @ @ (S)?
text_jump UnknownText_0x1c0bbb
db "@"
-; 0x10aee
-Text_ThrewAway: ; 0x10aee
+Text_ThrewAway:
; Threw away @ (S).
text_jump UnknownText_0x1c0bd8
db "@"
-; 0x10af3
-Text_ThisIsntTheTime: ; 0x10af3
+Text_ThisIsntTheTime:
; OAK: ! This isn't the time to use that!
text_jump UnknownText_0x1c0bee
db "@"
-; 0x10af8
-TextJump_YouDontHaveAMon: ; 0x10af8
+TextJump_YouDontHaveAMon:
; You don't have a #MON!
text_jump Text_YouDontHaveAMon
db "@"
-; 0x10afd
-Text_RegisteredItem: ; 0x10afd
+Text_RegisteredItem:
; Registered the @ .
text_jump UnknownText_0x1c0c2e
db "@"
-; 0x10b02
-Text_CantRegister: ; 0x10b02
+Text_CantRegister:
; You can't register that item.
text_jump UnknownText_0x1c0c45
db "@"
-; 0x10b07
-Text_MoveItemWhere: ; 0x10b07
+Text_MoveItemWhere:
; Where should this be moved to?
text_jump UnknownText_0x1c0c63
db "@"
-; 0x10b0c
-Text_PackEmptyString: ; 0x10b0c
+Text_PackEmptyString:
;
text_jump UnknownText_0x1c0c83
db "@"
-; 0x10b11
-TextJump_YouCantUseItInABattle: ; 0x10b11
+TextJump_YouCantUseItInABattle:
; Doesn't seem to be used anywhere
; "You can't use it in a battle."
text_jump Text_YouCantUseItInABattle
db "@"
-; 0x10b16
PackMenuGFX:
INCBIN "gfx/pack/pack_menu.2bpp"
diff --git a/engine/items/pack_kris.asm b/engine/items/pack_kris.asm
index 54a21e447..1a169ea6e 100644
--- a/engine/items/pack_kris.asm
+++ b/engine/items/pack_kris.asm
@@ -1,4 +1,4 @@
-DrawKrisPackGFX: ; 48e81
+DrawKrisPackGFX:
ld hl, PackFGFXPointers
add hl, de
add hl, de
@@ -10,11 +10,11 @@ DrawKrisPackGFX: ; 48e81
call Request2bpp
ret
-PackFGFXPointers: ; 48e93
+PackFGFXPointers:
dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET
dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET
dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET
-PackFGFX: ; 48e9b
+PackFGFX:
INCBIN "gfx/pack/pack_f.2bpp"
diff --git a/engine/items/print_item_description.asm b/engine/items/print_item_description.asm
index 2a9007b97..b0a3a0b33 100644
--- a/engine/items/print_item_description.asm
+++ b/engine/items/print_item_description.asm
@@ -1,4 +1,4 @@
-PrintItemDescription: ; 0x1c8955
+PrintItemDescription:
; Print the description for item [wCurSpecies] at de.
ld a, [wCurSpecies]
@@ -28,4 +28,5 @@ PrintItemDescription: ; 0x1c8955
ld d, [hl]
pop hl
jp PlaceString
-; 0x1c8987
+
+INCLUDE "data/items/descriptions.asm"
diff --git a/engine/items/switch_items.asm b/engine/items/switch_items.asm
index 77b635246..81b5ac6a5 100644
--- a/engine/items/switch_items.asm
+++ b/engine/items/switch_items.asm
@@ -1,4 +1,4 @@
-SwitchItemsInBag: ; 2490c (9:490c)
+SwitchItemsInBag:
ld a, [wSwitchItem]
and a
jr z, .init
@@ -84,7 +84,7 @@ SwitchItemsInBag: ; 2490c (9:490c)
ld [wSwitchItem], a
ret
-Function249a7: ; 249a7 (9:49a7)
+Function249a7:
ld a, [wSwitchItem]
call ItemSwitch_GetNthItem
ld d, h
@@ -110,7 +110,7 @@ Function249a7: ; 249a7 (9:49a7)
scf
ret
-Function249d1: ; 249d1 (9:49d1)
+Function249d1:
ld a, [wSwitchItem]
call ItemSwitch_GetNthItem
inc hl
@@ -180,14 +180,14 @@ Function249d1: ; 249d1 (9:49d1)
ld [wSwitchItem], a
ret
-Function24a40: ; 24a40 (9:4a40)
+Function24a40:
call ItemSwitch_GetNthItem
ld de, wd002
call ItemSwitch_ConvertSpacingToDW
call CopyBytes
ret
-Function24a4d: ; 24a4d (9:4a4d)
+Function24a4d:
call ItemSwitch_GetNthItem
ld d, h
ld e, l
@@ -196,7 +196,7 @@ Function24a4d: ; 24a4d (9:4a4d)
call CopyBytes
ret
-ItemSwitch_GetNthItem: ; 24a5c (9:4a5c)
+ItemSwitch_GetNthItem:
push af
call ItemSwitch_ConvertSpacingToDW
ld hl, wMenuData_ItemsPointerAddr
@@ -208,7 +208,7 @@ ItemSwitch_GetNthItem: ; 24a5c (9:4a5c)
call AddNTimes
ret
-Function24a6c: ; 24a6c (9:4a6c)
+Function24a6c:
push hl
call ItemSwitch_ConvertSpacingToDW
ld a, d
@@ -224,7 +224,7 @@ Function24a6c: ; 24a6c (9:4a6c)
pop hl
ret
-ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80)
+ItemSwitch_ConvertSpacingToDW:
; This function is absolutely idiotic.
push hl
ld a, [wMenuData_ScrollingMenuSpacing]
@@ -239,13 +239,10 @@ ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80)
pop hl
ret
-; 24a91 (9:4a91)
-
-.spacing_dws ; 24a91
+.spacing_dws
dw 0, 1, 2
-; 24a97
-Function24a97: ; 24a97 (9:4a97)
+Function24a97:
push af
call ItemSwitch_ConvertSpacingToDW
ld a, c
@@ -262,7 +259,7 @@ Function24a97: ; 24a97 (9:4a97)
ld a, $1
ret
-Function24aab: ; 24aab (9:4aab)
+Function24aab:
.loop
ld a, [hld]
ld [de], a
diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm
index 442f73cfa..4958d2afc 100644
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -1,4 +1,4 @@
-TMHMPocket: ; 2c76f (b:476f)
+TMHMPocket:
ld a, $1
ld [hInMenu], a
call TMHM_PocketLoop
@@ -20,7 +20,7 @@ TMHMPocket: ; 2c76f (b:476f)
scf
ret
-.ConvertItemToTMHMNumber: ; 2c798 (b:4798)
+.ConvertItemToTMHMNumber:
ld a, [wCurItem]
ld c, a
callfar GetNumberedTMHM
@@ -28,7 +28,7 @@ TMHMPocket: ; 2c76f (b:476f)
ld [wCurItem], a
ret
-ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
+ConvertCurItemIntoCurTMHM:
ld a, [wCurItem]
ld c, a
callfar GetTMHMNumber
@@ -36,12 +36,12 @@ ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
ld [wCurTMHM], a
ret
-GetTMHMItemMove: ; 2c7b6 (b:47b6)
+GetTMHMItemMove:
call ConvertCurItemIntoCurTMHM
predef GetTMHMMove
ret
-AskTeachTMHM: ; 2c7bf (b:47bf)
+AskTeachTMHM:
ld hl, wOptions
ld a, [hl]
push af
@@ -70,13 +70,13 @@ AskTeachTMHM: ; 2c7bf (b:47bf)
ld [wOptions], a
ret
-ChooseMonToLearnTMHM: ; 2c7fb
+ChooseMonToLearnTMHM:
ld hl, wStringBuffer2
ld de, wTMHMMoveNameBackup
ld bc, 12
call CopyBytes
call ClearBGPalettes
-ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
+ChooseMonToLearnTMHM_NoRefresh:
farcall LoadPartyMenuGFX
farcall InitPartyMenuWithCancel
farcall InitPartyMenuGFX
@@ -115,9 +115,8 @@ ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
pop de
pop hl
jr .loopback
-; 2c867
-TeachTMHM: ; 2c867
+TeachTMHM:
predef CanLearnTMHMMove
push bc
@@ -166,33 +165,28 @@ TeachTMHM: ; 2c867
.learned_move
scf
ret
-; 2c8bf (b:48bf)
-Text_BootedTM: ; 0x2c8bf
+Text_BootedTM:
; Booted up a TM.
text_jump UnknownText_0x1c0373
db "@"
-; 0x2c8c4
-Text_BootedHM: ; 0x2c8c4
+Text_BootedHM:
; Booted up an HM.
text_jump UnknownText_0x1c0384
db "@"
-; 0x2c8c9
-Text_ItContained: ; 0x2c8c9
+Text_ItContained:
; It contained @ . Teach @ to a #MON?
text_jump UnknownText_0x1c0396
db "@"
-; 0x2c8ce
-Text_TMHMNotCompatible: ; 0x2c8ce
+Text_TMHMNotCompatible:
; is not compatible with @ . It can't learn @ .
text_jump UnknownText_0x1c03c2
db "@"
-; 0x2c8d3
-TMHM_PocketLoop: ; 2c8d3 (b:48d3)
+TMHM_PocketLoop:
xor a
ld [hBGMapMode], a
call TMHM_DisplayPocketItems
@@ -225,7 +219,7 @@ TMHM_PocketLoop: ; 2c8d3 (b:48d3)
ld [wMenuCursorX], a
jr TMHM_ShowTMMoveDescription
-TMHM_JoypadLoop: ; 2c915 (b:4915)
+TMHM_JoypadLoop:
call TMHM_DisplayPocketItems
call StaticMenuJoypad
ld b, a
@@ -247,7 +241,7 @@ TMHM_JoypadLoop: ; 2c915 (b:4915)
jp nz, TMHM_ExitPocket
bit D_LEFT_F, a
jp nz, TMHM_ExitPocket
-TMHM_ShowTMMoveDescription: ; 2c946 (b:4946)
+TMHM_ShowTMMoveDescription:
call TMHM_CheckHoveringOverCancel
jp nc, TMHM_ExitPocket
hlcoord 0, 12
@@ -265,7 +259,7 @@ TMHM_ShowTMMoveDescription: ; 2c946 (b:4946)
call PrintMoveDesc
jp TMHM_JoypadLoop
-TMHM_ChooseTMorHM: ; 2c974 (b:4974)
+TMHM_ChooseTMorHM:
call TMHM_PlaySFX_ReadText2
call CountTMsHMs ; This stores the count to wd265.
ld a, [wMenuCursorY]
@@ -277,7 +271,7 @@ TMHM_ChooseTMorHM: ; 2c974 (b:4974)
ld a, [wd265]
cp b
jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
-TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a)
+TMHM_CheckHoveringOverCancel:
call TMHM_GetCurrentPocketPosition
ld a, [wMenuCursorY]
ld b, a
@@ -297,19 +291,19 @@ TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a)
cp -1
ret
-TMHM_ExitPack: ; 2c9a5 (b:49a5)
+TMHM_ExitPack:
call TMHM_PlaySFX_ReadText2
-_TMHM_ExitPack: ; 2c9a8 (b:49a8)
+_TMHM_ExitPack:
ld a, $2
ld [wMenuJoypad], a
and a
ret
-TMHM_ExitPocket: ; 2c9af (b:49af)
+TMHM_ExitPocket:
and a
ret
-TMHM_ScrollPocket: ; 2c9b1 (b:49b1)
+TMHM_ScrollPocket:
ld a, b
bit 7, a
jr nz, .skip
@@ -339,7 +333,7 @@ TMHM_ScrollPocket: ; 2c9b1 (b:49b1)
call TMHM_DisplayPocketItems
jp TMHM_ShowTMMoveDescription
-TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
+TMHM_DisplayPocketItems:
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jp z, Tutorial_TMHMPocket
@@ -433,7 +427,7 @@ TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
.done
ret
-TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86)
+TMHMPocket_GetCurrentLineCoord:
hlcoord 5, 0
ld bc, 2 * SCREEN_WIDTH
ld a, 6
@@ -445,9 +439,8 @@ TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86)
dec e
jr nz, .loop
ret
-; 2ca95 (b:4a95)
-Unreferenced_Function2ca95: ; 2ca95
+Unreferenced_Function2ca95:
pop hl
ld bc, 3
add hl, bc
@@ -459,13 +452,11 @@ Unreferenced_Function2ca95: ; 2ca95
call PlaceString
pop hl
ret
-; 2caae
-TMHM_String_Cancel: ; 2caae
+TMHM_String_Cancel:
db "CANCEL@"
-; 2cab5
-TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5)
+TMHM_GetCurrentPocketPosition:
ld hl, wTMsHMs
ld a, [wTMHMPocketScrollPosition]
ld b, a
@@ -482,7 +473,7 @@ TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5)
dec c
ret
-Tutorial_TMHMPocket: ; 2caca (b:4aca)
+Tutorial_TMHMPocket:
hlcoord 9, 3
push de
ld de, TMHM_String_Cancel
@@ -490,15 +481,14 @@ Tutorial_TMHMPocket: ; 2caca (b:4aca)
pop de
ret
-TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6)
+TMHM_PlaySFX_ReadText2:
push de
ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret
-; 2cadf (b:4adf)
-Unreferenced_Function2cadf: ; 2cadf
+Unreferenced_Function2cadf:
call ConvertCurItemIntoCurTMHM
call .CheckHaveRoomForTMHM
ld hl, .NoRoomText
@@ -506,21 +496,18 @@ Unreferenced_Function2cadf: ; 2cadf
ld hl, .ReceivedText
.print
jp PrintText
-; 2caf0
-.NoRoomText: ; 0x2caf0
+.NoRoomText:
; You have no room for any more @ S.
text_jump UnknownText_0x1c03fa
db "@"
-; 0x2caf5
-.ReceivedText: ; 0x2caf5
+.ReceivedText:
; You received @ !
text_jump UnknownText_0x1c0421
db "@"
-; 0x2cafa
-.CheckHaveRoomForTMHM: ; 2cafa
+.CheckHaveRoomForTMHM:
ld a, [wd265]
dec a
ld hl, wTMsHMs
@@ -533,9 +520,8 @@ Unreferenced_Function2cadf: ; 2cadf
ret nc
ld [hl], a
ret
-; 2cb0c
-ConsumeTM: ; 2cb0c (b:4b0c)
+ConsumeTM:
call ConvertCurItemIntoCurTMHM
ld a, [wd265]
dec a
@@ -556,7 +542,7 @@ ConsumeTM: ; 2cb0c (b:4b0c)
ld [wTMHMPocketScrollPosition], a
ret
-CountTMsHMs: ; 2cb2a (b:4b2a)
+CountTMsHMs:
ld b, 0
ld c, NUM_TMS + NUM_HMS
ld hl, wTMsHMs
@@ -572,7 +558,7 @@ CountTMsHMs: ; 2cb2a (b:4b2a)
ld [wd265], a
ret
-PrintMoveDesc: ; 2cb3e
+PrintMoveDesc:
push hl
ld hl, MoveDescriptions
ld a, [wCurSpecies]
@@ -586,4 +572,3 @@ PrintMoveDesc: ; 2cb3e
ld d, [hl]
pop hl
jp PlaceString
-; 2cb52
diff --git a/engine/items/tmhm2.asm b/engine/items/tmhm2.asm
index 9db3dc291..10206d36b 100644
--- a/engine/items/tmhm2.asm
+++ b/engine/items/tmhm2.asm
@@ -1,4 +1,4 @@
-CanLearnTMHMMove: ; 11639
+CanLearnTMHMMove:
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
@@ -31,9 +31,8 @@ CanLearnTMHMMove: ; 11639
pop hl
ld c, 0
ret
-; 1166a
-GetTMHMMove: ; 1166a
+GetTMHMMove:
ld a, [wd265]
dec a
ld hl, TMHMMoves
@@ -43,7 +42,5 @@ GetTMHMMove: ; 1166a
ld a, [hl]
ld [wd265], a
ret
-; 1167a
-
INCLUDE "data/moves/tmhm_moves.asm"
diff --git a/engine/items/update_item_description.asm b/engine/items/update_item_description.asm
index fdb1e864d..d4bc731a1 100644
--- a/engine/items/update_item_description.asm
+++ b/engine/items/update_item_description.asm
@@ -1,4 +1,4 @@
-UpdateItemDescription: ; 0x244c3
+UpdateItemDescription:
ld a, [wMenuSelection]
ld [wCurSpecies], a
hlcoord 0, 12