aboutsummaryrefslogtreecommitdiffstats
path: root/engine/items
diff options
context:
space:
mode:
Diffstat (limited to 'engine/items')
-rw-r--r--engine/items/inventory.asm6
-rw-r--r--engine/items/item_effects.asm201
-rw-r--r--engine/items/tm_prices.asm4
-rw-r--r--engine/items/tms.asm12
-rw-r--r--engine/items/town_map.asm41
5 files changed, 134 insertions, 130 deletions
diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm
index e28edc6c..758c81d7 100644
--- a/engine/items/inventory.asm
+++ b/engine/items/inventory.asm
@@ -1,7 +1,7 @@
; function to add an item (in varying quantities) to the player's bag or PC box
; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems)
-; [wcf91] = item ID
+; [wCurItem] = item ID
; [wItemQuantity] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory_::
@@ -30,7 +30,7 @@ AddItemToInventory_::
.notAtEndOfInventory
ld a, [hli]
ld b, a ; b = ID of current item in table
- ld a, [wcf91] ; a = ID of item being added
+ ld a, [wCurItem] ; a = ID of item being added
cp b ; does the current item in the table match the item being added?
jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
@@ -51,7 +51,7 @@ AddItemToInventory_::
ld c, a
ld b, 0
add hl, bc ; hl = address to store the item
- ld a, [wcf91]
+ ld a, [wCurItem]
ld [hli], a ; store item ID
ld a, [wItemQuantity]
ld [hli], a ; store item quantity
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index 5e502cfa..c39e223b 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -1,7 +1,7 @@
UseItem_::
ld a, 1
ld [wActionResultOrTookBattleTurn], a ; initialise to success value
- ld a, [wcf91] ;contains item_ID
+ ld a, [wCurItem]
cp HM01
jp nc, ItemUseTMHM
ld hl, ItemUsePtrTable
@@ -199,7 +199,7 @@ ItemUseBall:
ld b, a
; Get the item ID.
- ld hl, wcf91
+ ld hl, wCurItem
ld a, [hl]
; The Master Ball always succeeds.
@@ -263,7 +263,7 @@ ItemUseBall:
call Multiply
; Determine BallFactor. It's 8 for Great Balls and 12 for the others.
- ld a, [wcf91]
+ ld a, [wCurItem]
cp GREAT_BALL
ld a, 12
jr nz, .skip1
@@ -349,7 +349,7 @@ ItemUseBall:
; Poké Ball: BallFactor2 = 255
; Great Ball: BallFactor2 = 200
; Ultra/Safari Ball: BallFactor2 = 150
- ld a, [wcf91]
+ ld a, [wCurItem]
ld b, 255
cp POKE_BALL
jr z, .skip4
@@ -442,11 +442,11 @@ ItemUseBall:
ld [wDamageMultipliers], a
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
push af
predef MoveAnimation
pop af
- ld [wcf91], a
+ ld [wCurItem], a
pop af
ld [wWhichPokemon], a
@@ -504,15 +504,15 @@ ItemUseBall:
ld [hl], a
.skip6
- ld a, [wcf91]
+ ld a, [wCurPartySpecies]
push af
ld a, [wEnemyMonSpecies2]
- ld [wcf91], a
+ ld [wCurPartySpecies], a
ld a, [wEnemyMonLevel]
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
callfar LoadEnemyMonData
pop af
- ld [wcf91], a
+ ld [wCurPartySpecies], a
pop hl
pop af
ld [hld], a
@@ -523,8 +523,8 @@ ItemUseBall:
ld [hl], a
ld a, [wEnemyMonSpecies]
ld [wCapturedMonSpecies], a
- ld [wcf91], a
- ld [wd11e], a
+ ld [wCurPartySpecies], a
+ ld [wPokedexNum], a
ld a, [wBattleType]
cp BATTLE_TYPE_OLD_MAN ; is this the old man battle?
jp z, .oldManCaughtMon ; if so, don't give the player the caught Pokémon
@@ -535,7 +535,7 @@ ItemUseBall:
; Add the caught Pokémon to the Pokédex.
predef IndexToPokedex
- ld a, [wd11e]
+ ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_TEST
@@ -543,7 +543,7 @@ ItemUseBall:
predef FlagActionPredef
ld a, c
push af
- ld a, [wd11e]
+ ld a, [wPokedexNum]
dec a
ld c, a
ld b, FLAG_SET
@@ -557,7 +557,7 @@ ItemUseBall:
call PrintText
call ClearSprites
ld a, [wEnemyMonSpecies]
- ld [wd11e], a
+ ld [wPokedexNum], a
predef ShowPokedexData
.skipShowingPokedexData
@@ -710,8 +710,8 @@ ItemUseSurfboard:
jp c, SurfingAttemptFailed
.surf
call .makePlayerMoveForward
- ld hl, wd730
- set 7, [hl]
+ ld hl, wStatusFlags5
+ set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, 2
ld [wWalkBikeSurfState], a ; change player state to surfing
call PlayDefaultMusic ; play surfing music
@@ -720,11 +720,11 @@ ItemUseSurfboard:
.tryToStopSurfing
xor a
- ldh [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndex], a
ld d, 16 ; talking range in pixels (normal range)
call IsSpriteInFrontOfPlayer2
- res 7, [hl]
- ldh a, [hSpriteIndexOrTextID]
+ res BIT_FACE_PLAYER, [hl]
+ ldh a, [hSpriteIndex]
and a ; is there a sprite in the way?
jr nz, .cannotStopSurfing
ld hl, TilePairCollisionsWater
@@ -744,8 +744,8 @@ ItemUseSurfboard:
ld [wPikachuSpawnState], a
ld hl, wPikachuOverworldStateFlags
set 5, [hl]
- ld hl, wd730
- set 7, [hl]
+ ld hl, wStatusFlags5
+ set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
xor a
ld [wWalkBikeSurfState], a ; change player state to walking
dec a
@@ -771,7 +771,7 @@ ItemUseSurfboard:
ld a, b
ld [wSimulatedJoypadStatesEnd], a
xor a
- ld [wUnusedCD39], a
+ ld [wUnusedSimulatedJoypadStatesMask], a
inc a
ld [wSimulatedJoypadStatesIndex], a
ret
@@ -793,7 +793,7 @@ ItemUseEvoStone:
jp nz, ItemUseNotTime
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
ld [wEvoStoneItemID], a
push af
ld a, EVO_STONE_PARTY_MENU
@@ -801,12 +801,12 @@ ItemUseEvoStone:
ld a, $ff
ld [wUpdateSpritesEnabled], a
call DisplayPartyMenu
- ld a, [wcf91]
+ ld a, [wCurPartySpecies]
ld [wLoadedMon], a
pop bc
jr c, .canceledItemUse
ld a, b
- ld [wcf91], a
+ ld [wCurPartySpecies], a
call Func_d85d
jr nc, .noEffect
callfar IsThisPartymonStarterPikachu_Party
@@ -854,19 +854,19 @@ Func_d85d:
ld b, $0
add hl, bc
add hl, bc
- ld de, wcd6d
+ ld de, wEvoDataBuffer
ld a, BANK(TryEvolvingMon)
ld bc, $2
call FarCopyData
- ld hl, wcd6d
+ ld hl, wEvoDataBuffer
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, wcd6d
+ ld de, wEvoDataBuffer
ld a, BANK(TryEvolvingMon)
ld bc, 13
call FarCopyData
- ld hl, wcd6d
+ ld hl, wEvoDataBuffer
.loop
ld a, [hli]
and a
@@ -878,7 +878,7 @@ Func_d85d:
dec hl
dec hl
ld b, [hl]
- ld a, [wcf91]
+ ld a, [wCurItem]
inc hl
inc hl
inc hl
@@ -906,7 +906,7 @@ ItemUseMedicine:
jp z, Func_e4bf
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
push af
ld a, USE_ITEM_PARTY_MENU
ld [wPartyMenuTypeOrMessageID], a
@@ -929,9 +929,9 @@ ItemUseMedicine:
ld a, [wWhichPokemon]
ld [wUsedItemOnWhichPokemon], a
ld d, a
- ld a, [wcf91]
+ ld a, [wCurPartySpecies]
ld e, a
- ld [wd0b5], a
+ ld [wCurSpecies], a
pop af
push af
cp CALCIUM + 1
@@ -943,7 +943,7 @@ ItemUseMedicine:
pop hl
.noHappinessBoost
pop af
- ld [wcf91], a
+ ld [wCurItem], a
pop af
ld [wWhichPokemon], a
ld a, [wPseudoItemID]
@@ -954,7 +954,7 @@ ItemUseMedicine:
cp d ; is the pokemon trying to use softboiled on itself?
jr z, ItemUseMedicine ; if so, force another choice
.checkItemType
- ld a, [wcf91]
+ ld a, [wCurItem]
cp REVIVE
jr nc, .healHP ; if it's a Revive or Max Revive
cp FULL_HEAL
@@ -967,7 +967,7 @@ ItemUseMedicine:
.cureStatusAilment
ld bc, wPartyMon1Status - wPartyMon1
add hl, bc ; hl now points to status
- ld a, [wcf91]
+ ld a, [wCurItem]
lb bc, ANTIDOTE_MSG, 1 << PSN
cp ANTIDOTE
jr z, .checkMonStatus
@@ -1022,7 +1022,7 @@ ItemUseMedicine:
or b
jr nz, .notFainted
.fainted
- ld a, [wcf91]
+ ld a, [wCurItem]
cp REVIVE
jr z, .updateInBattleFaintedData
cp MAX_REVIVE
@@ -1070,7 +1070,7 @@ ItemUseMedicine:
jr .compareCurrentHPToMaxHP
.notFainted
- ld a, [wcf91]
+ ld a, [wCurItem]
cp REVIVE
jp z, .healingItemNoEffect
cp MAX_REVIVE
@@ -1090,7 +1090,7 @@ ItemUseMedicine:
pop hl
jr nz, .notFullHP
.fullHP ; if the pokemon's current HP equals its max HP
- ld a, [wcf91]
+ ld a, [wCurItem]
cp FULL_RESTORE
jp nz, .healingItemNoEffect
inc hl
@@ -1099,7 +1099,7 @@ ItemUseMedicine:
and a ; does the pokemon have a status ailment?
jp z, .healingItemNoEffect
ld a, FULL_HEAL
- ld [wcf91], a
+ ld [wCurItem], a
dec hl
dec hl
dec hl
@@ -1169,13 +1169,13 @@ ItemUseMedicine:
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
ldh a, [hUILayoutFlags]
- set 0, a
+ set BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
ldh a, [hUILayoutFlags]
- res 0, a
+ res BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
pop af
ld b, a ; store heal amount (1/5 of max HP)
@@ -1191,7 +1191,7 @@ ItemUseMedicine:
jr .addHealAmount
.notUsingSoftboiled2
- ld a, [wcf91]
+ ld a, [wCurItem]
cp SODA_POP
ld b, 60 ; Soda Pop heal amount
jr z, .addHealAmount
@@ -1226,7 +1226,7 @@ ItemUseMedicine:
ld e, l ; de now points to current HP
ld hl, (wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1)
add hl, de ; hl now points to max HP
- ld a, [wcf91]
+ ld a, [wCurItem]
cp REVIVE
jr z, .setCurrentHPToHalfMaxHP
ld a, [hld]
@@ -1238,7 +1238,7 @@ ItemUseMedicine:
ld a, [de]
sbc b
jr nc, .setCurrentHPToMaxHp ; if current HP exceeds max HP after healing
- ld a, [wcf91]
+ ld a, [wCurItem]
cp HYPER_POTION
jr c, .setCurrentHPToMaxHp ; if using a Full Restore or Max Potion
cp MAX_REVIVE
@@ -1270,7 +1270,7 @@ ItemUseMedicine:
ld [wHPBarNewHP], a
dec de
.doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure
- ld a, [wcf91]
+ ld a, [wCurItem]
cp FULL_RESTORE
jr nz, .updateInBattleData
ld bc, wPartyMon1Status - (wPartyMon1MaxHP + 1)
@@ -1289,7 +1289,7 @@ ItemUseMedicine:
ld [wBattleMonHP], a
ld a, [hld]
ld [wBattleMonHP + 1], a
- ld a, [wcf91]
+ ld a, [wCurItem]
cp FULL_RESTORE
jr nz, .calculateHPBarCoords
xor a
@@ -1316,7 +1316,7 @@ ItemUseMedicine:
call RemoveUsedItem
pop hl
.skipRemovingItem
- ld a, [wcf91]
+ ld a, [wCurItem]
cp FULL_RESTORE
jr c, .playStatusAilmentCuringSound
cp FULL_HEAL
@@ -1324,17 +1324,17 @@ ItemUseMedicine:
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
ldh a, [hUILayoutFlags]
- set 0, a
+ set BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate the HP bar lengthening
ldh a, [hUILayoutFlags]
- res 0, a
+ res BIT_PARTY_MENU_HP_BAR, a
ldh [hUILayoutFlags], a
ld a, REVIVE_MSG
ld [wPartyMenuTypeOrMessageID], a
- ld a, [wcf91]
+ ld a, [wCurItem]
cp REVIVE
jr z, .showHealingItemMessage
cp MAX_REVIVE
@@ -1379,12 +1379,12 @@ ItemUseMedicine:
.useVitamin
push hl
ld a, [hl]
- ld [wd0b5], a
- ld [wd11e], a
+ ld [wCurSpecies], a
+ ld [wPokedexNum], a
ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level
ld a, [hl] ; a = level
- ld [wCurEnemyLVL], a ; store level
+ ld [wCurEnemyLevel], a ; store level
call GetMonHeader
push de
ld a, d
@@ -1392,7 +1392,7 @@ ItemUseMedicine:
call GetPartyMonName
pop de
pop hl
- ld a, [wcf91]
+ ld a, [wCurItem]
cp RARE_CANDY
jp z, .useRareCandy
push hl
@@ -1418,7 +1418,7 @@ ItemUseMedicine:
pop hl
call .recalculateStats
ld hl, VitaminStats
- ld a, [wcf91]
+ ld a, [wCurItem]
sub HP_UP - 1
ld c, a
.statNameLoop ; loop to get the address of the name of the stat the vitamin increases
@@ -1466,7 +1466,7 @@ ItemUseMedicine:
jr z, .vitaminNoEffect ; can't raise level above 100
inc a
ld [hl], a ; store incremented level
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
push hl
push de
ld d, a
@@ -1485,7 +1485,7 @@ ItemUseMedicine:
pop hl
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
push af
push de
push hl
@@ -1524,7 +1524,7 @@ ItemUseMedicine:
ld a, d
ld [wWhichPokemon], a
ld a, e
- ld [wd11e], a
+ ld [wPokedexNum], a
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
@@ -1550,7 +1550,7 @@ ItemUseMedicine:
ld a, $01
ld [wUpdateSpritesEnabled], a
pop af
- ld [wcf91], a
+ ld [wCurItem], a
pop af
ld [wWhichPokemon], a
jp RemoveUsedItem
@@ -1647,12 +1647,12 @@ ItemUseEscapeRope:
jr z, .notUsable
cp b
jr nz, .loop
- ld hl, wd732
- set 3, [hl]
- set 6, [hl]
+ ld hl, wStatusFlags6
+ set BIT_FLY_WARP, [hl]
+ set BIT_ESCAPE_WARP, [hl]
call Func_1510
- ld hl, wd72e
- res 4, [hl]
+ ld hl, wStatusFlags4
+ res BIT_NO_BATTLES, [hl]
ResetEvent EVENT_IN_SAFARI_ZONE
xor a
ld [wNumSafariBalls], a
@@ -1698,7 +1698,7 @@ ItemUseXAccuracy:
; The Card Key is handled in a different way.
ItemUseCardKey:
xor a
- ld [wUnusedD71F], a
+ ld [wUnusedCardKeyGateID], a
call GetTileAndCoordsInFrontOfPlayer
ld a, [GetTileAndCoordsInFrontOfPlayer]
cp $18
@@ -1732,7 +1732,7 @@ ItemUseCardKey:
cp e
jr nz, .nextEntry3
ld a, [hl]
- ld [wUnusedD71F], a
+ ld [wUnusedCardKeyGateID], a
jr .done
.nextEntry1
@@ -1746,8 +1746,8 @@ ItemUseCardKey:
.done
ld hl, ItemUseText00
call PrintText
- ld hl, wd728
- set 7, [hl]
+ ld hl, wStatusFlags1
+ set BIT_UNUSED_CARD_KEY, [hl] ; never checked
ret
INCLUDE "data/events/card_key_coords.asm"
@@ -1818,7 +1818,7 @@ ItemUseXStat:
ld a, [hl]
push af ; save [wPlayerMoveEffect]
push hl
- ld a, [wcf91]
+ ld a, [wCurItem]
sub X_ATTACK - ATTACK_UP1_EFFECT
ld [hl], a ; store player move effect
call PrintItemUseTextAndRemoveItem
@@ -2087,7 +2087,7 @@ RodResponse:
ld a, 1
ld [wMoveMissed], a
ld a, b ; level
- ld [wCurEnemyLVL], a
+ ld [wCurEnemyLevel], a
ld a, c ; species
ld [wCurOpponent], a
@@ -2175,7 +2175,7 @@ ItemUsePPUp:
ItemUsePPRestore:
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
ld [wPPRestoreItem], a
.chooseMon
xor a
@@ -2225,7 +2225,7 @@ ItemUsePPRestore:
call GetSelectedMoveOffset
push hl
ld a, [hl]
- ld [wd11e], a
+ ld [wNamedObjectIndex], a
call GetMoveName
call CopyToStringBuffer
pop hl
@@ -2247,7 +2247,7 @@ ItemUsePPRestore:
add 1 << 6 ; increase PP Up count by 1
ld [hl], a
ld a, 1 ; 1 PP Up used
- ld [wd11e], a
+ ld [wUsingPPUp], a
call RestoreBonusPP ; add the bonus PP to current PP
ld a, SFX_HEAL_AILMENT
call PlaySound
@@ -2400,16 +2400,16 @@ ItemUseTMHM:
ld a, [wIsInBattle]
and a
jp nz, ItemUseNotTime
- ld a, [wcf91]
+ ld a, [wCurItem]
sub TM01 ; underflows below 0 for HM items (before TM items)
push af
jr nc, .skipAdding
add NUM_TMS + NUM_HMS ; adjust HM IDs to come after TM IDs
.skipAdding
inc a
- ld [wd11e], a
+ ld [wTempTMHM], a
predef TMToMove ; get move ID from TM/HM ID
- ld a, [wd11e]
+ ld a, [wTempTMHM]
ld [wMoveNum], a
call GetMoveName
call CopyToStringBuffer
@@ -2436,7 +2436,7 @@ ItemUseTMHM:
.useMachine
ld a, [wWhichPokemon]
push af
- ld a, [wcf91]
+ ld a, [wCurItem]
push af
.chooseMon
ld hl, wStringBuffer
@@ -2486,7 +2486,7 @@ ItemUseTMHM:
ld a, [wWhichPokemon]
ld d, a
pop af
- ld [wcf91], a
+ ld [wCurItem], a
pop af
ld [wWhichPokemon], a
ld a, b
@@ -2500,7 +2500,7 @@ ItemUseTMHM:
callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM
callfar IsThisPartymonStarterPikachu_Party
jr nc, .notTeachingThunderboltOrThunderToPikachu
- ld a, [wcf91]
+ ld a, [wCurItem]
cp TM_THUNDERBOLT ; are we teaching thunderbolt to the player pikachu?
jr z, .teachingThunderboltOrThunderToPlayerPikachu
cp TM_THUNDER ; are we teaching thunder then?
@@ -2514,7 +2514,7 @@ ItemUseTMHM:
pop af
ld [wWhichPokemon], a
- ld a, [wcf91]
+ ld a, [wCurItem]
call IsItemHM
ret c
jp RemoveUsedItem
@@ -2775,10 +2775,10 @@ GetMaxPP:
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
- ld de, wcd6d
+ ld de, wMoveData
ld a, BANK(Moves)
call FarCopyData
- ld de, wcd6d + 5 ; PP is byte 5 of move data
+ ld de, wMoveData + MOVE_PP
ld a, [de]
ld b, a ; b = normal max PP
pop hl
@@ -2794,9 +2794,10 @@ GetMaxPP:
and %11000000 ; get PP Up count
pop bc
or b ; place normal max PP in 6 lower bits of a
+ assert wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP
ld h, d
ld l, e
- inc hl ; hl = wcd73
+ inc hl ; hl = wPPUpCountAndMaxPP
ld [hl], a
xor a ; add the bonus for the existing PP Up count
ld [wUsingPPUp], a
@@ -2820,14 +2821,14 @@ GetSelectedMoveOffset2:
; confirms the item toss and then tosses the item
; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems)
-; [wcf91] = item ID
+; [wCurItem] = item ID
; [wWhichPokemon] = index of item within inventory
; [wItemQuantity] = quantity to toss
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
TossItem_::
push hl
- ld a, [wcf91]
+ ld a, [wCurItem]
call IsItemHM
pop hl
jr c, .tooImportantToToss
@@ -2838,8 +2839,8 @@ TossItem_::
and a
jr nz, .tooImportantToToss
push hl
- ld a, [wcf91]
- ld [wd11e], a
+ ld a, [wCurItem]
+ ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld hl, IsItOKToTossItemText
@@ -2858,8 +2859,8 @@ TossItem_::
push hl
ld a, [wWhichPokemon]
call RemoveItemFromInventory
- ld a, [wcf91]
- ld [wd11e], a
+ ld a, [wCurItem]
+ ld [wNamedObjectIndex], a
call GetItemName
call CopyToStringBuffer
ld hl, ThrewAwayItemText
@@ -2890,7 +2891,7 @@ TooImportantToTossText:
; checks if an item is a key item
; INPUT:
-; [wcf91] = item ID
+; [wCurItem] = item ID
; OUTPUT:
; [wIsKeyItem] = result
; 00: item is not key item
@@ -2898,7 +2899,7 @@ TooImportantToTossText:
IsKeyItem_::
ld a, $01
ld [wIsKeyItem], a
- ld a, [wcf91]
+ ld a, [wCurItem]
cp HM01 ; is the item an HM or TM?
jr nc, .checkIfItemIsHM
; if the item is not an HM or TM
@@ -2918,7 +2919,7 @@ IsKeyItem_::
and a
ret nz
.checkIfItemIsHM
- ld a, [wcf91]
+ ld a, [wCurItem]
call IsItemHM
ret c
xor a
@@ -2932,8 +2933,8 @@ SendNewMonToBox:
ld a, [de]
inc a
ld [de], a
- ld a, [wcf91]
- ld [wd0b5], a
+ ld a, [wCurPartySpecies]
+ ld [wCurSpecies], a
ld c, a
.loop
inc de
@@ -3057,7 +3058,7 @@ SendNewMonToBox:
ld [de], a
inc de
push de
- ld a, [wCurEnemyLVL]
+ ld a, [wCurEnemyLevel]
ld d, a
callfar CalcExperience
pop de
@@ -3091,7 +3092,7 @@ SendNewMonToBox:
ld [de], a
dec b
jr nz, .loop6
- ld a, [wcf91]
+ ld a, [wCurPartySpecies]
cp KADABRA
jr nz, .notKadabra
ld a, TWISTEDSPOON_GSC
@@ -3131,7 +3132,7 @@ ItemUseReloadOverworldData:
call LoadCurrentMapView
jp UpdateSprites
-; creates a list at wBuffer of maps where the mon in [wd11e] can be found.
+; creates a list at wBuffer of maps where the mon in [wPokedexNum] can be found.
; this is used by the pokedex to display locations the mon can be found on the map.
FindWildLocationsOfMon:
ld hl, WildDataPointers
@@ -3166,7 +3167,7 @@ CheckMapForMon:
inc hl
ld b, NUM_WILDMONS
.loop
- ld a, [wd11e]
+ ld a, [wPokedexNum]
cp [hl]
jr nz, .nextEntry
ld a, c
diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm
index df9761bd..8e64e5d0 100644
--- a/engine/items/tm_prices.asm
+++ b/engine/items/tm_prices.asm
@@ -1,7 +1,7 @@
GetMachinePrice::
-; Input: [wcf91] = Item Id of a TM
+; Input: [wCurItem] = Item ID of a TM
; Output: Stores the TM price at hItemPrice
- ld a, [wcf91] ; a contains TM item id
+ ld a, [wCurItem]
sub TM01 ; underflows below 0 for HM items (before TM items)
ret c ; HMs are priceless
ld d, a
diff --git a/engine/items/tms.asm b/engine/items/tms.asm
index 40030675..06d60ad3 100644
--- a/engine/items/tms.asm
+++ b/engine/items/tms.asm
@@ -1,7 +1,7 @@
-; tests if mon [wcf91] can learn move [wMoveNum]
+; tests if mon [wCurPartySpecies] can learn move [wMoveNum]
CanLearnTM:
- ld a, [wcf91]
- ld [wd0b5], a
+ ld a, [wCurPartySpecies]
+ ld [wCurSpecies], a
call GetMonHeader
ld hl, wMonHLearnset
push hl
@@ -26,17 +26,17 @@ CanLearnTM:
ld c, 0
ret
-; converts TM/HM number in wd11e into move number
+; converts TM/HM number in [wTempTMHM] into move number
; HMs start at 51
TMToMove:
- ld a, [wd11e]
+ ld a, [wTempTMHM]
dec a
ld hl, TechnicalMachines
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
- ld [wd11e], a
+ ld [wTempTMHM], a
ret
INCLUDE "data/moves/tmhm_moves.asm"
diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm
index 1ed146f2..a49e751e 100644
--- a/engine/items/town_map.asm
+++ b/engine/items/town_map.asm
@@ -1,5 +1,7 @@
DEF NOT_VISITED EQU $fe
+DEF BIRD_BASE_TILE EQU $04
+
DisplayTownMap:
call LoadTownMap
ld hl, wUpdateSpritesEnabled
@@ -12,15 +14,15 @@ DisplayTownMap:
ld a, [wCurMap]
push af
ld b, $0
- call DrawPlayerOrBirdSprite ; player sprite
+ call DrawPlayerOrBirdSprite
hlcoord 1, 0
- ld de, wcd6d
+ ld de, wNameBuffer
call PlaceString
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $10
call CopyData
- ld hl, vSprites tile $04
+ ld hl, vSprites tile BIRD_BASE_TILE
ld de, TownMapCursor
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
call CopyVideoDataDouble
@@ -50,15 +52,15 @@ DisplayTownMap:
ld hl, wShadowOAMSprite04
call WriteTownMapSpriteOAM ; town map cursor sprite
pop hl
- ld de, wcd6d
+ ld de, wNameBuffer
.copyMapName
ld a, [hli]
ld [de], a
inc de
- cp $50
+ cp "@"
jr nz, .copyMapName
hlcoord 1, 0
- ld de, wcd6d
+ ld de, wNameBuffer
call PlaceString
ld hl, wShadowOAMSprite04
ld de, wTileMapBackup + 16
@@ -73,9 +75,9 @@ DisplayTownMap:
jr z, .inputLoop
ld a, SFX_TINK
call PlaySound
- bit 6, b
+ bit BIT_D_UP, b
jr nz, .pressedUp
- bit 7, b
+ bit BIT_D_DOWN, b
jr nz, .pressedDown
xor a
ld [wTownMapSpriteBlinkingEnabled], a
@@ -153,7 +155,7 @@ LoadTownMap_Fly::
ld de, BirdSprite
ld b, BANK(BirdSprite)
ld c, 12
- ld hl, vSprites tile $04
+ ld hl, vSprites tile BIRD_BASE_TILE
call CopyVideoData
ld de, TownMapUpArrow
ld hl, vChars1 tile $6d
@@ -183,10 +185,10 @@ LoadTownMap_Fly::
call ClearScreenArea
pop hl
ld a, [hl]
- ld b, $4
- call DrawPlayerOrBirdSprite ; draw bird sprite
+ ld b, BIRD_BASE_TILE
+ call DrawPlayerOrBirdSprite
hlcoord 3, 0
- ld de, wcd6d
+ ld de, wNameBuffer
call PlaceString
ld c, 15
call DelayFrames
@@ -204,13 +206,13 @@ LoadTownMap_Fly::
pop hl
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop
- bit 0, b
+ bit BIT_A_BUTTON, b
jr nz, .pressedA
ld a, SFX_TINK
call PlaySound
- bit 6, b
+ bit BIT_D_UP, b
jr nz, .pressedUp
- bit 7, b
+ bit BIT_D_DOWN, b
jr nz, .pressedDown
jr .pressedB
.pressedA
@@ -218,10 +220,11 @@ LoadTownMap_Fly::
call PlaySound
ld a, [hl]
ld [wDestinationMap], a
- ld hl, wd732
- set 3, [hl]
+ ld hl, wStatusFlags6
+ set BIT_FLY_WARP, [hl]
+ assert wStatusFlags6 + 1 == wStatusFlags7
inc hl
- set 7, [hl]
+ set BIT_USED_FLY, [hl]
.pressedB
xor a
ld [wTownMapSpriteBlinkingEnabled], a
@@ -365,7 +368,7 @@ DrawPlayerOrBirdSprite:
call TownMapCoordsToOAMCoords
call WritePlayerOrBirdSpriteOAM
pop hl
- ld de, wcd6d
+ ld de, wNameBuffer
.loop
ld a, [hli]
ld [de], a