ref: 9dec80b07e3638c722b9768a1ca0184edea20392
parent: 2ec900d96c3b6020be0816151b9ad606c04114b5
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Jul 28 15:27:34 EDT 2018
Add meaningful aliases for wd265 Introduce MONICON_* constants Introduce BATTLEPLAYERACTION_* constants
--- a/constants/battle_constants.asm
+++ b/constants/battle_constants.asm
@@ -63,8 +63,8 @@
const STAT_SATK
NUM_EXP_STATS EQU const_value + -1
const STAT_SDEF
-NUM_STATS EQU const_value +- 1
-STAT_SPC EQU STAT_SATK
+NUM_STATS EQU const_value + -1
+NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP
; stat formula constants
STAT_MIN_NORMAL EQU 5
@@ -243,6 +243,12 @@
const BATTLEACTION_D
const BATTLEACTION_E
const BATTLEACTION_FORFEIT
+
+; wBattlePlayerAction
+ const_def
+ const BATTLEPLAYERACTION_USEMOVE
+ const BATTLEPLAYERACTION_USEITEM
+ const BATTLEPLAYERACTION_SWITCH
; wBattleResult
const_def
--- a/constants/icon_constants.asm
+++ b/constants/icon_constants.asm
@@ -39,3 +39,13 @@
const ICON_SLOWPOKE
const ICON_SUDOWOODO
const ICON_BIGMON
+
+; LoadMenuMonIcon.Jumptable indexes (see engine/gfx/mon_icons.asm)
+ const_def
+ const MONICON_PARTYMENU
+ const MONICON_NAMINGSCREEN
+ const MONICON_MOVES
+ const MONICON_TRADE
+ const MONICON_MOBILE1
+ const MONICON_MOBILE2
+ const MONICON_UNUSED
--- a/data/text/battle.asm
+++ b/data/text/battle.asm
@@ -87,7 +87,7 @@
PerishCountText:
text "<USER>'s"
line "PERISH count is @"
- deciram wd265, 1, 1
+ deciram wDeciramBuffer, 1, 1
text "!"
prompt
@@ -669,7 +669,7 @@
text_from_ram wStringBuffer1
text " was"
cont "reduced by @"
- deciram wd265, 1, 1
+ deciram wDeciramBuffer, 1, 1
text "!"
prompt
@@ -1029,7 +1029,7 @@
MagnitudeText:
text "Magnitude @"
- deciram wd265, 1, 1
+ deciram wDeciramBuffer, 1, 1
text "!"
prompt
--- a/data/text/common_1.asm
+++ b/data/text/common_1.asm
@@ -41,7 +41,7 @@
text_from_ram wStringBuffer1
text_start
line "recovered @"
- deciram wd1f3, 2, 3
+ deciram wCurHPAnimDeltaHP, 2, 3
text "HP!"
done
@@ -1155,7 +1155,7 @@
UnknownText_0x1bd0d8::
text "The compatibility"
line "is @"
- deciram wd265, 1, 3
+ deciram wDeciramBuffer, 1, 3
text "."
cont "Should they breed?"
done
--- a/data/text/common_2.asm
+++ b/data/text/common_2.asm
@@ -262,7 +262,7 @@
text_from_ram wc850
text "'s CARD was"
line "listed as no.@"
- deciram wd265, 1, 2
+ deciram wDeciramBuffer, 1, 2
text "."
prompt
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -818,7 +818,7 @@
PrintText_UsedItemOn:
ld a, [wCurEnemyItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -171,10 +171,10 @@
pop bc
pop hl
- ld a, [wd265]
+ ld a, [wTypeMatchup]
and a
jr z, .immune
- cp 10 ; 1.0
+ cp EFFECTIVE
jr z, .checkmove
jr c, .noteffective
@@ -415,8 +415,8 @@
pop hl
; 60% chance to discourage this move if not very effective.
- ld a, [wd265]
- cp 10 ; 1.0
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr c, .asm_38815
; Do nothing if effectiveness is neutral.
@@ -491,8 +491,8 @@
push hl
push bc
farcall BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop bc
pop hl
jr c, .asm_3884f
@@ -1292,8 +1292,8 @@
ld [hBattleTurn], a
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop hl
jr c, .asm_38bef
jr z, .asm_38bd4
@@ -1408,8 +1408,8 @@
predef CheckTypeMatchup
pop hl
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr nc, .asm_38c68
and a
@@ -1679,8 +1679,8 @@
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp $a
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
pop hl
jr c, .asm_38dc9
ret z
@@ -2293,8 +2293,8 @@
pop hl
; Discourage Hidden Power if not very effective.
- ld a, [wd265]
- cp 10
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE
jr c, .bad
; Discourage Hidden Power if its base power is lower than 50.
@@ -2303,8 +2303,8 @@
jr c, .bad
; Encourage Hidden Power if super-effective.
- ld a, [wd265]
- cp 11
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE + 1
jr nc, .good
; Encourage Hidden Power if its base power is 70.
@@ -3125,7 +3125,7 @@
pop bc
pop hl
- ld a, [wd265]
+ ld a, [wTypeMatchup]
and a
jr nz, .checkmove
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -373,7 +373,7 @@
push bc
callfar GetUserItem
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
sub BERSERK_GENE
pop bc
pop de
@@ -447,7 +447,7 @@
sub BATTLEACTION_SWITCH1
jr c, .use_move
ld a, [wBattlePlayerAction]
- cp $2
+ cp BATTLEPLAYERACTION_SWITCH
jr nz, .switch
ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
@@ -472,7 +472,7 @@
.use_move
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
jp nz, .player_first
call CompareMovePriority
jr z, .equal_priority
@@ -611,7 +611,7 @@
.not_encored
ld a, [wBattlePlayerAction]
- cp $2
+ cp BATTLEPLAYERACTION_SWITCH
jr z, .reset_rage
and a
jr nz, .reset_bide
@@ -900,7 +900,7 @@
call ResidualDamage
jp z, HandlePlayerMonFaint
call RefreshBattleHuds
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@@ -949,7 +949,7 @@
call ResidualDamage
jp z, HandleEnemyMonFaint
call RefreshBattleHuds
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@@ -1161,7 +1161,7 @@
ret z
dec [hl]
ld a, [hl]
- ld [wd265], a
+ ld [wDeciramBuffer], a
push af
ld hl, PerishCountText
call StdBattleTextBox
@@ -1235,7 +1235,7 @@
ret nz
ld a, [de]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wFXAnimID], a
call GetMoveName
dec [hl]
@@ -1288,7 +1288,7 @@
callfar GetUserItem
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld a, b
cp HELD_LEFTOVERS
@@ -1397,7 +1397,7 @@
push bc
push bc
ld a, [hl]
- ld [wd265], a
+ ld [wTempByteValue], a
ld de, wBattleMonMoves - 1
ld hl, wBattleMonPP
ld a, [hBattleTurn]
@@ -1417,7 +1417,7 @@
pop de
pop bc
- ld a, [wd265]
+ ld a, [wTempByteValue]
cp [hl]
jr nz, .skip_checks
ld a, [hBattleTurn]
@@ -1434,7 +1434,7 @@
.skip_checks
callfar GetUserItem
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
xor a
ld [hl], a
call GetPartymonItem
@@ -2048,7 +2048,7 @@
call CheckMobileBattleError
jp c, WildFled_EnemyFled_LinkBattleCanceled
- ld a, $1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
@@ -2055,11 +2055,11 @@
jr DoubleSwitch
.player_mon_not_fainted
- ld a, $1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@@ -2088,7 +2088,7 @@
call PlayerPartyMonEntrance
.done
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
@@ -2636,7 +2636,7 @@
ld a, c
and a
ret nz
- ld a, $1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
@@ -2716,12 +2716,12 @@
ld a, [wLinkMode]
and a
jr z, .skip_link
- ld a, $1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call LinkBattleSendReceiveAction
.skip_link
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
call CheckMobileBattleError
jr c, .enemy_fainted_mobile_error
@@ -3287,8 +3287,8 @@
pop bc
pop de
pop hl
- ld a, [wd265] ; Get The Effectiveness Modifier
- cp 10 + 1 ; 1.0 + 0.1
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE + 1
jr c, .loop
ld hl, wBuffer1
set 0, [hl]
@@ -3319,14 +3319,14 @@
ld [wPlayerMoveStruct + MOVE_TYPE], a
call SetPlayerTurn
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp 10 + 1 ; 1.0 + 0.1
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE + 1
jr nc, .super_effective
ld a, [wBattleMonType2]
ld [wPlayerMoveStruct + MOVE_TYPE], a
callfar BattleCheckTypeMatchup
- ld a, [wd265]
- cp 10 + 1 ; 1.0 + 0.1
+ ld a, [wTypeMatchup]
+ cp EFFECTIVE + 1
jr nc, .super_effective
pop bc
ret
@@ -3695,7 +3695,7 @@
push hl
push de
ld a, [wBattleMonItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld b, a
callfar GetItemHeldEffect
ld a, b
@@ -3732,7 +3732,7 @@
xor a
ld [hMultiplicand], a
- ld a, $20
+ ld a, 32
ld [hMultiplier], a
call Multiply
ld a, [hProduct + 2]
@@ -3772,7 +3772,7 @@
ld a, [hQuotient + 2]
cp b
jr nc, .can_escape
- ld a, $1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
ld hl, BattleText_CantEscape2
jr .print_inescapable_text
@@ -3786,7 +3786,7 @@
.print_inescapable_text
call StdBattleTextBox
- ld a, $1
+ ld a, TRUE
ld [wFailedToFlee], a
call LoadTileMapToTempTileMap
and a
@@ -3798,7 +3798,7 @@
ld a, DRAW
jr z, .fled
call LoadTileMapToTempTileMap
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ld a, $f
ld [wCurMoveNum], a
@@ -4429,7 +4429,7 @@
.heal_status
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
res SUBSTATUS_CONFUSED, [hl]
@@ -4496,7 +4496,7 @@
jr nz, .loop
pop bc
ld a, [bc]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
push bc
dec hl
dec hl
@@ -4952,7 +4952,7 @@
farcall BattlePack
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
jr z, .didnt_use_item
jr .got_item
@@ -5157,7 +5157,7 @@
jp z, BattleMenuPKMN_Loop
ld a, [wCurBattleMon]
ld [wLastPlayerMon], a
- ld a, $2
+ ld a, BATTLEPLAYERACTION_SWITCH
ld [wBattlePlayerAction], a
call ClearPalettes
call DelayFrame
@@ -5270,8 +5270,8 @@
ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
- xor a
- ld [wd265], a
+ xor a ; FALSE
+ ld [wApplyStatLevelMultipliersToEnemy], a
call ApplyStatLevelMultiplierOnAllStats
call SendOutPlayerMon
call EmptyBattleTextBox
@@ -5286,11 +5286,11 @@
ld hl, wBattleMonSpeed
ld de, wEnemyMonSpeed
call TryToRunAwayFromBattle
- ld a, $0
+ ld a, FALSE
ld [wFailedToFlee], a
ret c
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
ret nz
jp BattleMenu
@@ -5770,7 +5770,7 @@
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
call z, LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
ld a, [wBattleAction]
@@ -6375,7 +6375,7 @@
ld [de], a
ld a, [wTempEnemyMonSpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
@@ -6661,7 +6661,7 @@
call ApplyStatLevelMultiplier
inc c
ld a, c
- cp 5
+ cp NUM_BATTLE_STATS
jr nz, .stat_loop
ret
@@ -6668,7 +6668,7 @@
ApplyStatLevelMultiplier:
push bc
push bc
- ld a, [wd265]
+ ld a, [wApplyStatLevelMultipliersToEnemy]
and a
ld a, c
ld hl, wBattleMonAttack
@@ -6718,7 +6718,7 @@
call Multiply
ld a, [hl]
ld [hDivisor], a
- ld b, $4
+ ld b, 4
call Divide
pop hl
@@ -7192,7 +7192,7 @@
add hl, bc
ld a, [hl]
ld [wCurSpecies], a
- ld [wd265], a
+ ld [wTempSpecies], a ; unused?
call GetBaseData
ld hl, MON_MAXHP + 1
add hl, bc
@@ -7256,8 +7256,8 @@
call CopyBytes
.transformed
- xor a
- ld [wd265], a
+ xor a ; FALSE
+ ld [wApplyStatLevelMultipliersToEnemy], a
call ApplyStatLevelMultiplierOnAllStats
callfar ApplyStatusEffectOnPlayerStats
callfar BadgeStatBoosts
@@ -7299,7 +7299,7 @@
xor a ; PARTYMON
ld [wMonType], a
ld a, [wCurSpecies]
- ld [wd265], a
+ ld [wTempSpecies], a ; unused?
ld a, [wCurPartyLevel]
push af
ld c, a
@@ -7359,7 +7359,7 @@
cp 2
ret c
- ld [wd265], a
+ ld [wTempByteValue], a
ld hl, wEnemyMonBaseStats
ld c, wEnemyMonEnd - wEnemyMonBaseStats
.count_loop2
@@ -7367,7 +7367,7 @@
ld [hDividend + 0], a
ld a, [hl]
ld [hDividend + 1], a
- ld a, [wd265]
+ ld a, [wTempByteValue]
ld [hDivisor], a
ld b, 2
call Divide
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -2,7 +2,7 @@
call SetPlayerTurn
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
ret nz
jr DoTurn
@@ -1248,7 +1248,7 @@
.go
ld a, BATTLE_VARS_MOVE_TYPE
call GetBattleVarAddr
- ld [wTypeMatchup], a
+ ld [wCurType], a
push hl
push de
@@ -1264,7 +1264,7 @@
pop bc
pop de
- ld a, [wTypeMatchup]
+ ld a, [wCurType]
cp b
jr z, .stab
cp c
--- a/engine/battle/misc.asm
+++ b/engine/battle/misc.asm
@@ -53,13 +53,13 @@
ld de, WeatherTypeModifiers
ld a, [wBattleWeather]
ld b, a
- ld a, [wd265] ; move type
+ ld a, [wCurType]
ld c, a
.CheckWeatherType:
ld a, [de]
inc de
- cp $ff
+ cp -1
jr z, .done_weather_types
cp b
@@ -84,7 +84,7 @@
.CheckWeatherMove:
ld a, [de]
inc de
- cp $ff
+ cp -1
jr z, .done
cp b
@@ -116,7 +116,7 @@
ld a, 10
ld [hDivisor], a
- ld b, $4
+ ld b, 4
call Divide
ld a, [hQuotient + 0]
@@ -176,7 +176,7 @@
rr c
jr nc, .NextBadge
- ld a, [wd265] ; move type
+ ld a, [wCurType]
cp [hl]
jr z, .ApplyBoost
--- a/engine/battle/move_effects/baton_pass.asm
+++ b/engine/battle/move_effects/baton_pass.asm
@@ -68,8 +68,8 @@
call CallBattleCore
ld hl, ResetBattleParticipants
call CallBattleCore
- ld a, 1
- ld [wTypeMatchup], a
+ ld a, TRUE
+ ld [wApplyStatLevelMultipliersToEnemy], a
ld hl, ApplyStatLevelMultiplierOnAllStats
call CallBattleCore
@@ -83,7 +83,7 @@
and a
ret z
- ld a, 1
+ ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call LoadStandardMenuHeader
@@ -91,7 +91,7 @@
call CallBattleCore
call CloseWindow
- xor a
+ xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
--- a/engine/battle/move_effects/magnitude.asm
+++ b/engine/battle/move_effects/magnitude.asm
@@ -18,7 +18,7 @@
push de
inc hl
ld a, [hl]
- ld [wTypeMatchup], a
+ ld [wDeciramBuffer], a
call BattleCommand_MoveDelay
ld hl, MagnitudeText
call StdBattleTextBox
--- a/engine/battle/move_effects/mirror_move.asm
+++ b/engine/battle/move_effects/mirror_move.asm
@@ -24,7 +24,7 @@
.use
ld a, b
ld [hl], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
push af
ld a, BATTLE_VARS_MOVE_ANIM
--- a/engine/battle/move_effects/sketch.asm
+++ b/engine/battle/move_effects/sketch.asm
@@ -34,7 +34,7 @@
.get_last_move
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
call GetBattleVar
- ld [wTypeMatchup], a
+ ld [wNamedObjectIndexBuffer], a
ld b, a
; Fail if move is invalid or is Struggle.
and a
--- a/engine/battle/move_effects/spite.asm
+++ b/engine/battle/move_effects/spite.asm
@@ -24,7 +24,7 @@
ld a, [hli]
cp b
jr nz, .loop
- ld [wTypeMatchup], a
+ ld [wNamedObjectIndexBuffer], a
dec hl
ld b, 0
push bc
@@ -78,7 +78,7 @@
call AnimateCurrentMove
pop de
ld a, d
- ld [wTypeMatchup], a
+ ld [wDeciramBuffer], a
ld hl, SpiteEffectText
jp StdBattleTextBox
--- a/engine/battle/move_effects/thief.asm
+++ b/engine/battle/move_effects/thief.asm
@@ -21,7 +21,7 @@
; Can't steal mail.
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld d, a
farcall ItemIsMail
ret c
@@ -45,7 +45,7 @@
ld [de], a
call .playeritem
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld [hl], a
ld [de], a
jr .stole
@@ -68,7 +68,7 @@
; Can't steal mail!
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld d, a
farcall ItemIsMail
ret c
@@ -86,7 +86,7 @@
ld [de], a
call .enemyitem
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld [hl], a
ld [de], a
--- a/engine/battle/used_move_text.asm
+++ b/engine/battle/used_move_text.asm
@@ -26,7 +26,7 @@
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
- ld [wd265], a
+ ld [wMoveGrammar], a
push hl
farcall CheckUserIsCharging
@@ -34,13 +34,12 @@
jr nz, .grammar
; update last move
- ld a, [wd265]
+ ld a, [wMoveGrammar]
ld [hl], a
ld [de], a
.grammar
- call GetMoveGrammar
-; wd265 now contains MoveGrammar
+ call GetMoveGrammar ; convert move id to grammar index
; everything except 'instead' made redundant in localization
@@ -51,7 +50,7 @@
ret nz
; check move grammar
- ld a, [wd265]
+ ld a, [wMoveGrammar]
cp $3
ld hl, UsedMove2Text
ret c
@@ -89,7 +88,7 @@
ld hl, .endusedmovetexts
; get move id
- ld a, [wd265]
+ ld a, [wMoveGrammar]
; 2-byte pointer
add a
@@ -96,7 +95,7 @@
; seek
push bc
- ld b, $0
+ ld b, 0
ld c, a
add hl, bc
pop bc
@@ -132,13 +131,13 @@
db "@"
GetMoveGrammar:
-; store move grammar type in wd265
+; store move grammar type in wMoveGrammar
push bc
-; c = move id
- ld a, [wd265]
- ld c, a
- ld b, $0
+; wMoveGrammar contains move id
+ ld a, [wMoveGrammar]
+ ld c, a ; move id
+ ld b, 0 ; grammar index
; read grammar table
ld hl, MoveGrammar
@@ -158,9 +157,9 @@
jr .loop
.end
-; wd265 now contains move grammar
+; wMoveGrammar now contains move grammar
ld a, b
- ld [wd265], a
+ ld [wMoveGrammar], a
; we're done
pop bc
--- a/engine/events/bug_contest/caught_mon.asm
+++ b/engine/events/bug_contest/caught_mon.asm
@@ -2,7 +2,7 @@
ld a, [wContestMon]
and a
jr z, .firstcatch
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
farcall DisplayAlreadyCaughtText
farcall DisplayCaughtContestMonStats
lb bc, 14, 7
@@ -12,7 +12,7 @@
.firstcatch
call .generatestats
ld a, [wTempEnemyMonSpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, .caughttext
call PrintText
--- a/engine/events/bug_contest/display_stats.asm
+++ b/engine/events/bug_contest/display_stats.asm
@@ -36,7 +36,7 @@
call PlaceString
ld a, [wContestMon]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld de, wStringBuffer1
hlcoord 1, 2
--- a/engine/events/daycare.asm
+++ b/engine/events/daycare.asm
@@ -558,7 +558,7 @@
bit DAYCAREMAN_HAS_MON_F, a
ret z
callfar CheckBreedmonCompatibility
- ld a, [wd265]
+ ld a, [wBreedingCompatibility]
and a
ret z
inc a
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -407,7 +407,7 @@
ld d, 0
add hl, de
ld a, [hl]
- ld [wd265], a
+ ld [wTempIconSpecies], a
ld e, FIELDMOVE_FLY
farcall FlyFunction_GetMonIcon
xor a
--- a/engine/events/halloffame.asm
+++ b/engine/events/halloffame.asm
@@ -462,7 +462,7 @@
call TextBox
ld a, [wTempMonSpecies]
ld [wCurPartySpecies], a
- ld [wd265], a
+ ld [wDeciramBuffer], a
ld hl, wTempMonDVs
predef GetUnownLetter
xor a
@@ -477,7 +477,7 @@
ld [hli], a
ld [hl], "<DOT>"
hlcoord 3, 13
- ld de, wd265
+ ld de, wDeciramBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
call GetBasePokemonName
--- a/engine/events/happiness_egg.asm
+++ b/engine/events/happiness_egg.asm
@@ -11,7 +11,7 @@
jr .loop
.done
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld a, [hl]
ld [wScriptVar], a
call GetPokemonName
@@ -19,9 +19,9 @@
CheckFirstMonIsEgg:
ld a, [wPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
cp EGG
- ld a, 1
+ ld a, TRUE
jr z, .egg
xor a
@@ -196,15 +196,15 @@
call Random
ld [hl], a
callfar CheckBreedmonCompatibility
- ld a, [wd265]
+ ld a, [wBreedingCompatibility]
cp 230
ld b, 32 percent - 1
jr nc, .okay
- ld a, [wd265]
+ ld a, [wBreedingCompatibility]
cp 170
ld b, 16 percent
jr nc, .okay
- ld a, [wd265]
+ ld a, [wBreedingCompatibility]
cp 110
ld b, 12 percent
jr nc, .okay
--- a/engine/events/lucky_number.asm
+++ b/engine/events/lucky_number.asm
@@ -1,7 +1,7 @@
CheckForLuckyNumberWinners:
xor a
ld [wScriptVar], a
- ld [wFoundMatchingIDInParty], a
+ ld [wTempByteValue], a
ld a, [wPartyCount]
and a
ret z
@@ -34,8 +34,8 @@
jr z, .SkipOpenBoxMon
call .CompareLuckyNumberToMonID
jr nc, .SkipOpenBoxMon
- ld a, 1
- ld [wFoundMatchingIDInParty], a
+ ld a, TRUE
+ ld [wTempByteValue], a
.SkipOpenBoxMon:
push bc
@@ -81,8 +81,8 @@
call .CompareLuckyNumberToMonID ; sets wScriptVar and wCurPartySpecies appropriately
jr nc, .SkipBoxMon
- ld a, 1
- ld [wFoundMatchingIDInParty], a
+ ld a, TRUE
+ ld [wTempByteValue], a
.SkipBoxMon:
push bc
@@ -104,7 +104,7 @@
and a
ret z ; found nothing
farcall StubbedTrainerRankings_LuckyNumberShow
- ld a, [wFoundMatchingIDInParty]
+ ld a, [wTempByteValue]
and a
push af
ld a, [wCurPartySpecies]
--- a/engine/events/magikarp.asm
+++ b/engine/events/magikarp.asm
@@ -185,7 +185,7 @@
ld hl, MagikarpLengths
ld a, 2
- ld [wd265], a
+ ld [wTempByteValue], a
.read
ld a, [hli]
@@ -214,7 +214,7 @@
ld [hMultiplicand + 1], a
ld a, 100
ld [hMultiplicand + 2], a
- ld a, [wd265]
+ ld a, [wTempByteValue]
ld [hMultiplier], a
call Multiply
ld b, 0
@@ -228,9 +228,9 @@
.next
inc hl ; align to next triplet
- ld a, [wd265]
+ ld a, [wTempByteValue]
inc a
- ld [wd265], a
+ ld [wTempByteValue], a
cp 16
jr c, .read
--- a/engine/events/move_deleter.asm
+++ b/engine/events/move_deleter.asm
@@ -27,8 +27,8 @@
jr c, .declined
ld a, [wMenuCursorY]
push af
- ld a, [wCurSpecies]
- ld [wd265], a
+ ld a, [wCurMove]
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
ld hl, .ConfirmDeleteText
call PrintText
--- a/engine/events/move_tutor.asm
+++ b/engine/events/move_tutor.asm
@@ -8,7 +8,7 @@
xor a
ld [wItemAttributeParamBuffer], a
call .GetMoveTutorMove
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
--- a/engine/events/name_rater.asm
+++ b/engine/events/name_rater.asm
@@ -29,7 +29,7 @@
xor a ; PARTYMON
ld [wMonType], a
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wCurSpecies], a
call GetBaseData
ld b, 0
--- a/engine/events/npc_trade.asm
+++ b/engine/events/npc_trade.asm
@@ -301,7 +301,7 @@
GetTradeMonName:
push de
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetBasePokemonName
ld hl, wStringBuffer1
pop de
--- a/engine/events/specials.asm
+++ b/engine/events/specials.asm
@@ -34,7 +34,7 @@
call SetSeenAndCaughtMon
call FadeToMenu
ld a, [wScriptVar]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
farcall NewPokedexEntry
call ExitAllMenus
ret
@@ -153,7 +153,7 @@
ld [sMysteryGiftItem], a
call CloseSRAM
ld a, [wCurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, .ReceiveItemText
call PrintText
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -34,13 +34,14 @@
jp hl
.Jumptable:
- dw PartyMenu_InitAnimatedMonIcon ; party menu
- dw NamingScreen_InitAnimatedMonIcon ; naming screen
- dw MoveList_InitAnimatedMonIcon ; moves (?)
- dw Trade_LoadMonIconGFX ; trade
- dw Mobile_InitAnimatedMonIcon ; mobile
- dw Mobile_InitPartyMenuBGPal71 ; mobile
- dw .GetPartyMenuMonIcon ; unused
+; entries correspond to MONICON_* constants
+ dw PartyMenu_InitAnimatedMonIcon ; MONICON_PARTYMENU
+ dw NamingScreen_InitAnimatedMonIcon ; MONICON_NAMINGSCREEN
+ dw MoveList_InitAnimatedMonIcon ; MONICON_MOVES
+ dw Trade_LoadMonIconGFX ; MONICON_TRADE
+ dw Mobile_InitAnimatedMonIcon ; MONICON_MOBILE1
+ dw Mobile_InitPartyMenuBGPal71 ; MONICON_MOBILE2
+ dw .GetPartyMenuMonIcon ; MONICON_UNUSED
.GetPartyMenuMonIcon:
call InitPartyMenuIcon
@@ -65,14 +66,14 @@
pop bc
pop hl
jr c, .not_mail
- ld a, $6
+ ld a, $06
jr .got_tile
.not_mail
- ld a, $5
- ; jr .got_tile
+ ld a, $05
+ ; fallthrough
.no_item
- ld a, $4
+ ld a, $04
.got_tile
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -156,7 +157,7 @@
ld a, [hObjectStructIndexBuffer]
ld hl, wPartySpecies
ld e, a
- ld d, $0
+ ld d, 0
add hl, de
ld a, [hl]
call ReadMonMenuIcon
@@ -214,7 +215,7 @@
db $80 ; HP_RED
NamingScreen_InitAnimatedMonIcon:
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
xor a
@@ -228,7 +229,7 @@
ret
MoveList_InitAnimatedMonIcon:
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
xor a
@@ -243,7 +244,7 @@
ret
Trade_LoadMonIconGFX:
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
ld a, $62
@@ -254,7 +255,7 @@
GetSpeciesIcon:
; Load species icon into VRAM at tile a
push de
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
@@ -264,7 +265,7 @@
FlyFunction_GetMonIcon:
push de
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
@@ -274,7 +275,7 @@
Unreferenced_GetMonIcon2:
push de
- ld a, [wd265]
+ ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -1,6 +1,6 @@
_DoItemEffect::
ld a, [wCurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyName1
ld a, 1
@@ -489,7 +489,7 @@
ld a, [wEnemyMonSpecies]
ld [wWildMon], a
ld [wCurPartySpecies], a
- ld [wd265], a
+ ld [wTempSpecies], a
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jp z, .FinishTutorial
@@ -501,13 +501,13 @@
call ClearSprites
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
ld a, c
push af
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call SetSeenAndCaughtMon
pop af
@@ -523,7 +523,7 @@
call ClearSprites
ld a, [wEnemyMonSpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
predef NewPokedexEntry
.skip_pokedex
@@ -566,7 +566,7 @@
call PrintText
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call YesNoBox
@@ -626,7 +626,7 @@
call PrintText
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call YesNoBox
@@ -1276,7 +1276,7 @@
RareCandy_StatBooster_GetParameters:
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
- ld [wd265], a
+ ld [wTempSpecies], a
ld a, MON_LEVEL
call GetPartyParamLocation
ld a, [hl]
@@ -1368,7 +1368,7 @@
xor a ; PARTYMON
ld [wMonType], a
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
predef LearnLevelMoves
xor a
@@ -2344,7 +2344,7 @@
push hl
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
call CopyName1
pop hl
@@ -2373,8 +2373,8 @@
ld a, [hl]
add PP_UP_ONE
ld [hl], a
- ld a, $1
- ld [wd265], a
+ ld a, TRUE
+ ld [wUsePPUp], a
call ApplyPPUp
call Play_SFX_FULL_HEAL
@@ -2492,7 +2492,7 @@
ld hl, wPartyMon1PP
ld bc, PARTYMON_STRUCT_LENGTH
call GetMthMoveOfNthPartymon
- ld a, [wd265]
+ ld a, [wTempPP]
ld b, a
ld a, [hl]
and PP_MASK
@@ -2765,8 +2765,8 @@
ld a, b
cp NUM_MOVES + 1
ret z
- ld a, [wd265]
- dec a
+ ld a, [wUsePPUp]
+ dec a ; FALSE?
jr nz, .use
ld a, [wMenuCursorY]
inc a
@@ -2822,7 +2822,7 @@
.okay
add b
ld b, a
- ld a, [wd265]
+ ld a, [wTempPP]
dec a
jr z, .NoPPUp
dec c
@@ -2857,7 +2857,7 @@
ld a, [de]
and PP_UP_MASK
ld b, a
- ld a, [wd265]
+ ld a, [wTempPP]
add b
ld [de], a
inc de
@@ -2933,12 +2933,12 @@
ld hl, wStringBuffer1 + 1
ld [hl], a
xor a
- ld [wd265], a
+ ld [wTempPP], a
ld a, b ; this gets lost anyway
call ComputeMaxPP
ld a, [hl]
and PP_MASK
- ld [wd265], a
+ ld [wTempPP], a
pop af
ld [wStringBuffer1 + 1], a
--- a/engine/items/print_item_description.asm
+++ b/engine/items/print_item_description.asm
@@ -9,7 +9,7 @@
push de
farcall GetTMHMItemMove
pop hl
- ld a, [wd265]
+ ld a, [wTempTMHM]
ld [wCurSpecies], a
predef PrintMoveDesc
ret
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -33,7 +33,7 @@
ld c, a
callfar GetTMHMNumber
ld a, c
- ld [wCurTMHM], a
+ ld [wTempTMHM], a
ret
GetTMHMItemMove:
@@ -50,7 +50,7 @@
cp TM01
jr c, .NotTMHM
call GetTMHMItemMove
- ld a, [wCurTMHM]
+ ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
@@ -251,9 +251,9 @@
ld a, [wCurItem]
cp NUM_TMS + NUM_HMS + 1
jr nc, TMHM_JoypadLoop
- ld [wd265], a
+ ld [wTempTMHM], a
predef GetTMHMMove
- ld a, [wd265]
+ ld a, [wTempTMHM]
ld [wCurSpecies], a
hlcoord 1, 14
call PrintMoveDesc
@@ -261,7 +261,7 @@
TMHM_ChooseTMorHM:
call TMHM_PlaySFX_ReadText2
- call CountTMsHMs ; This stores the count to wd265.
+ call CountTMsHMs ; This stores the count to wTempTMHM.
ld a, [wMenuCursorY]
dec a
ld b, a
@@ -268,7 +268,7 @@
ld a, [wTMHMPocketScrollPosition]
add b
ld b, a
- ld a, [wd265]
+ ld a, [wTempTMHM]
cp b
jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
TMHM_CheckHoveringOverCancel:
@@ -354,16 +354,16 @@
jr z, .loop2
ld b, a
ld a, c
- ld [wd265], a
+ ld [wTempTMHM], a
push hl
push de
push bc
call TMHMPocket_GetCurrentLineCoord
push hl
- ld a, [wd265]
+ ld a, [wTempTMHM]
cp NUM_TMS + 1
jr nc, .HM
- ld de, wd265
+ ld de, wTempTMHM
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
jr .okay
@@ -371,17 +371,17 @@
.HM:
push af
sub NUM_TMS
- ld [wd265], a
+ ld [wTempTMHM], a
ld [hl], "H"
inc hl
- ld de, wd265
+ ld de, wTempTMHM
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
pop af
- ld [wd265], a
+ ld [wTempTMHM], a
.okay
predef GetTMHMMove
- ld a, [wd265]
+ ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
pop hl
@@ -403,8 +403,8 @@
pop bc
push bc
ld a, b
- ld [wd265], a
- ld de, wd265
+ ld [wTempTMHM], a
+ ld de, wTempTMHM
lb bc, 1, 2
call PrintNum
.hm2
@@ -445,7 +445,7 @@
ld bc, 3
add hl, bc
predef GetTMHMMove
- ld a, [wd265]
+ ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
push hl
@@ -508,7 +508,7 @@
db "@"
.CheckHaveRoomForTMHM:
- ld a, [wd265]
+ ld a, [wTempTMHM]
dec a
ld hl, wTMsHMs
ld b, 0
@@ -523,7 +523,7 @@
ConsumeTM:
call ConvertCurItemIntoCurTMHM
- ld a, [wd265]
+ ld a, [wTempTMHM]
dec a
ld hl, wTMsHMs
ld b, 0
@@ -555,7 +555,7 @@
dec c
jr nz, .loop
ld a, b
- ld [wd265], a
+ ld [wTempTMHM], a
ret
PrintMoveDesc:
--- a/engine/items/tmhm2.asm
+++ b/engine/items/tmhm2.asm
@@ -33,7 +33,7 @@
ret
GetTMHMMove:
- ld a, [wd265]
+ ld a, [wTempTMHM]
dec a
ld hl, TMHMMoves
ld b, 0
@@ -40,7 +40,7 @@
ld c, a
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wTempTMHM], a
ret
INCLUDE "data/moves/tmhm_moves.asm"
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -149,13 +149,13 @@
ld a, [hli]
cp -1
jr z, .done_party
- ld [wd265], a
+ ld [wTempSpecies], a
push hl
push de
callfar ConvertMon_1to2
pop de
pop hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [de], a
inc de
jr .party_loop
@@ -651,13 +651,13 @@
ld a, [hli]
cp -1
jr z, .done_party
- ld [wd265], a
+ ld [wTempSpecies], a
push hl
push de
callfar ConvertMon_2to1
pop de
pop hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [de], a
inc de
jr .loop2
@@ -692,11 +692,11 @@
push de
push bc
ld a, [hl]
- ld [wd265], a
+ ld [wTempSpecies], a
callfar ConvertMon_2to1
pop bc
pop de
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [de], a
inc de
ld hl, MON_HP
@@ -976,11 +976,11 @@
inc de
push bc
push de
- ld [wd265], a
+ ld [wTempSpecies], a
callfar ConvertMon_1to2
pop de
pop bc
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [bc], a
ld [wCurSpecies], a
ld hl, MON_HP
@@ -1461,7 +1461,7 @@
ld b, 0
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
hlcoord 0, 12
ld b, 4
@@ -1619,7 +1619,7 @@
ld b, 0
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wd004
@@ -1631,7 +1631,7 @@
ld b, 0
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
@@ -2047,7 +2047,7 @@
jr .done
.mon_too_new
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld a, $1
jr .done
@@ -2054,7 +2054,7 @@
.move_too_new
push bc
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
call CopyName1
pop bc
@@ -2079,7 +2079,7 @@
ld hl, wPartyCount
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ret
@@ -2146,13 +2146,13 @@
SetBitsForLinkTradeRequest:
ld a, LINK_TRADECENTER - 1
ld [wPlayerLinkAction], a
- ld [wd265], a
+ ld [wChosenCableClubRoom], a
ret
SetBitsForBattleRequest:
ld a, LINK_COLOSSEUM - 1
ld [wPlayerLinkAction], a
- ld [wd265], a
+ ld [wChosenCableClubRoom], a
ret
SetBitsForTimeCapsuleRequest:
@@ -2166,7 +2166,7 @@
ld [rSC], a
xor a ; LINK_TIMECAPSULE - 1
ld [wPlayerLinkAction], a
- ld [wd265], a
+ ld [wChosenCableClubRoom], a
ret
WaitForLinkedFriend:
@@ -2373,7 +2373,7 @@
ret
TryQuickSave:
- ld a, [wd265]
+ ld a, [wChosenCableClubRoom]
push af
farcall Link_SaveGame
ld a, TRUE
@@ -2384,11 +2384,11 @@
ld c, 30
call DelayFrames
pop af
- ld [wd265], a
+ ld [wChosenCableClubRoom], a
ret
CheckBothSelectedSameRoom:
- ld a, [wd265]
+ ld a, [wChosenCableClubRoom]
call Link_EnsureSync
push af
call LinkDataReceived
@@ -2396,10 +2396,10 @@
call LinkDataReceived
pop af
ld b, a
- ld a, [wd265]
+ ld a, [wChosenCableClubRoom]
cp b
jr nz, .fail
- ld a, [wd265]
+ ld a, [wChosenCableClubRoom]
inc a
ld [wLinkMode], a
xor a
--- a/engine/link/mystery_gift.asm
+++ b/engine/link/mystery_gift.asm
@@ -1430,7 +1430,7 @@
ld de, wMysteryGiftTrainerData
farcall Function8ac70
ld a, c
- ld [wd265], a
+ ld [wDeciramBuffer], a
ld hl, Text_CardNotRegistered
jr c, PrintTextAndExit_JP
ld hl, Text_ListedCardAsNumber
--- a/engine/link/mystery_gift_2.asm
+++ b/engine/link/mystery_gift_2.asm
@@ -24,7 +24,7 @@
call CountSetBits
pop de
pop bc
- ld a, [wd265]
+ ld a, [wNumSetBits]
ld [de], a
inc de ; wc80f
call CloseSRAM
--- a/engine/link/time_capsule.asm
+++ b/engine/link/time_capsule.asm
@@ -122,7 +122,7 @@
ld a, [de]
cp -1
ret z
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
push bc
push hl
push de
--- a/engine/link/time_capsule_2.asm
+++ b/engine/link/time_capsule_2.asm
@@ -1,8 +1,10 @@
ConvertMon_2to1:
-; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265.
+; Takes the Gen 2 Pokemon number stored in wTempSpecies,
+; finds it in the Pokered_MonIndices table,
+; and returns its index in wTempSpecies.
push bc
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld b, a
ld c, 0
ld hl, Pokered_MonIndices
@@ -12,16 +14,17 @@
cp b
jr nz, .loop
ld a, c
- ld [wd265], a
+ ld [wTempSpecies], a
pop hl
pop bc
ret
ConvertMon_1to2:
-; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265.
+; Takes the Gen 1 Pokemon number stored in wTempSpecies
+; and returns the corresponding value from Pokered_MonIndices in wTempSpecies.
push bc
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
ld hl, Pokered_MonIndices
ld b, 0
@@ -28,7 +31,7 @@
ld c, a
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wTempSpecies], a
pop hl
pop bc
ret
--- a/engine/menus/debug.asm
+++ b/engine/menus/debug.asm
@@ -311,9 +311,9 @@
ld a, [wcf66]
inc a
ld [wCurPartySpecies], a
- ld [wd265], a
+ ld [wDeciramBuffer], a
hlcoord 0, 1
- ld de, wd265
+ ld de, wDeciramBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
ld a, [wd002]
@@ -353,7 +353,7 @@
jr .asm_81ba9
.asm_81b7a
- ld a, [wd265]
+ ld a, [wDeciramBuffer]
ld [wTrainerClass], a
callfar GetTrainerAttributes
ld de, wStringBuffer1
@@ -738,9 +738,9 @@
call Function81e5e
ld a, [wd004]
inc a
- ld [wd265], a
+ ld [wTempTMHM], a
predef GetTMHMMove
- ld a, [wd265]
+ ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
hlcoord 10, 12
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -593,7 +593,7 @@
ld b, 2
call CountSetBits
pop hl
- ld de, wd265
+ ld de, wNumSetBits
lb bc, 1, 2
jp PrintNum
@@ -610,7 +610,7 @@
endc
call CountSetBits
pop hl
- ld de, wd265
+ ld de, wNumSetBits
lb bc, 1, 3
jp PrintNum
--- a/engine/menus/menu_2.asm
+++ b/engine/menus/menu_2.asm
@@ -170,7 +170,7 @@
and a
ld de, .None
jr z, .no_contest_mon
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
.no_contest_mon
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -84,13 +84,13 @@
.Pokemon:
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempIconSpecies], a
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
- ld e, $1
- rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f))
+ ld e, MONICON_NAMINGSCREEN
+ rst FarCall
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
hlcoord 5, 2
call PlaceString
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -133,12 +133,12 @@
ret
PauseGameLogic:
- ld a, $1
+ ld a, TRUE
ld [wGameLogicPaused], a
ret
ResumeGameLogic:
- xor a
+ xor a ; FALSE
ld [wGameLogicPaused], a
ret
@@ -230,13 +230,13 @@
SavedTheGame:
call _SaveGameData
; wait 32 frames
- ld c, $20
+ ld c, 32
call DelayFrames
; copy the original text speed setting to the stack
ld a, [wOptions]
push af
- ; set text speed super slow
- ld a, 3
+ ; set text speed to medium
+ ld a, TEXT_DELAY_MED
ld [wOptions], a
; <PLAYER> saved the game!
ld hl, Text_PlayerSavedTheGame
@@ -248,7 +248,7 @@
call WaitPlaySFX
call WaitSFX
; wait 30 frames
- ld c, $1e
+ ld c, 30
call DelayFrames
ret
@@ -332,8 +332,8 @@
; Save the text speed setting to the stack
ld a, [wOptions]
push af
- ; Set the text speed to super slow
- ld a, $3
+ ; Set the text speed to medium
+ ld a, TEXT_DELAY_MED
ld [wOptions], a
; SAVING... DON'T TURN OFF THE POWER.
ld hl, Text_SavingDontTurnOffThePower
@@ -342,7 +342,7 @@
pop af
ld [wOptions], a
; Wait for 16 frames
- ld c, $10
+ ld c, 16
call DelayFrames
ret
--- a/engine/menus/start_menu.asm
+++ b/engine/menus/start_menu.asm
@@ -639,7 +639,7 @@
PartyMonItemName:
ld a, [wCurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyName1
ret
@@ -842,7 +842,7 @@
ret
.already_holding_item
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, SwitchAlreadyHoldingText
call StartMenuYesNo
@@ -849,10 +849,10 @@
jr c, .abort
call GiveItemToPokemon
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
push af
ld a, [wCurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
pop af
ld [wCurItem], a
call ReceiveItemFromPokemon
@@ -860,13 +860,13 @@
ld hl, TookAndMadeHoldText
call MenuTextBoxBackup
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld [wCurItem], a
call GivePartyItem
ret
.bag_full
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld [wCurItem], a
call ReceiveItemFromPokemon
ld hl, ItemStorageIsFullText
@@ -901,7 +901,7 @@
farcall ItemIsMail
call GetPartyItemLocation
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [hl], NO_ITEM
call GetItemName
ld hl, TookFromText
@@ -1654,8 +1654,8 @@
ld hl, wPartySpecies
add hl, de
ld a, [hl]
- ld [wd265], a
- ld e, $2
+ ld [wTempIconSpecies], a
+ ld e, MONICON_MOVES
farcall LoadMenuMonIcon
hlcoord 0, 1
ld b, 9
@@ -1755,8 +1755,8 @@
hlcoord 16, 12
cp 2
jr c, .no_power
- ld [wd265], a
- ld de, wd265
+ ld [wDeciramBuffer], a
+ ld de, wDeciramBuffer
lb bc, 1, 3
call PrintNum
jr .description
--- a/engine/menus/trainer_card.asm
+++ b/engine/menus/trainer_card.asm
@@ -276,7 +276,7 @@
ld hl, wPokedexCaught
ld b, wEndPokedexCaught - wPokedexCaught
call CountSetBits
- ld de, wd265
+ ld de, wNumSetBits
hlcoord 15, 10
lb bc, 1, 3
call PrintNum
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -317,7 +317,7 @@
ld a, TRADEANIM_RIGHT_ARROW
call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeSendmonSpecies]
- ld [wd265], a
+ ld [wTempIconSpecies], a
xor a
depixel 5, 11, 4, 0
ld b, $0
@@ -327,7 +327,7 @@
ld a, TRADEANIM_LEFT_ARROW
call TradeAnim_PlaceTrademonStatsOnTubeAnim
ld a, [wLinkTradeGetmonSpecies]
- ld [wd265], a
+ ld [wTempIconSpecies], a
ld a, TRADEANIMSTATE_2
depixel 9, 18, 4, 4
ld b, $4
@@ -820,7 +820,7 @@
TradeAnim_GetNickname:
push de
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
pop de
@@ -1373,7 +1373,7 @@
LoadTradeBubbleGFX:
call DelayFrame
- ld e, $3
+ ld e, MONICON_TRADE
callfar LoadMenuMonIcon
ld de, TradeBubbleGFX
ld hl, vTiles0 tile $72
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -559,7 +559,7 @@
.getpokename
push bc
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
pop bc
jr .copy
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -623,7 +623,7 @@
CurItemName:
ld a, [wCurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ret
@@ -1863,7 +1863,7 @@
jr nz, .gotit
ld a, [wScriptVar]
.gotit
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld de, wStringBuffer1
@@ -1890,7 +1890,7 @@
jr nz, .ok
ld a, [wScriptVar]
.ok
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ld de, wStringBuffer1
jr ConvertMemToText
--- a/engine/overworld/variables.asm
+++ b/engine/overworld/variables.asm
@@ -72,7 +72,7 @@
ld hl, wPokedexCaught
ld b, wEndPokedexCaught - wPokedexCaught
call CountSetBits
- ld a, [wd265]
+ ld a, [wNumSetBits]
jp .loadstringbuffer2
.CountSeenMons:
@@ -80,7 +80,7 @@
ld hl, wPokedexSeen
ld b, wEndPokedexSeen - wPokedexSeen
call CountSetBits
- ld a, [wd265]
+ ld a, [wNumSetBits]
jp .loadstringbuffer2
.CountBadges:
@@ -88,7 +88,7 @@
ld hl, wBadges
ld b, 2
call CountSetBits
- ld a, [wd265]
+ ld a, [wNumSetBits]
jp .loadstringbuffer2
.PlayerFacing:
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -465,7 +465,7 @@
.Cry:
call Pokedex_GetSelectedMon
- ld a, [wd265]
+ ld a, [wTempSpecies]
call GetCryIndex
ld e, c
ld d, b
@@ -1088,7 +1088,7 @@
ld hl, wPokedexSeen
ld b, wEndPokedexSeen - wPokedexSeen
call CountSetBits
- ld de, wd265
+ ld de, wNumSetBits
hlcoord 5, 12
lb bc, 1, 3
call PrintNum
@@ -1098,7 +1098,7 @@
ld hl, wPokedexCaught
ld b, wEndPokedexCaught - wPokedexCaught
call CountSetBits
- ld de, wd265
+ ld de, wNumSetBits
hlcoord 5, 15
lb bc, 1, 3
call PrintNum
@@ -1492,7 +1492,7 @@
.loop
push af
ld a, [de]
- ld [wd265], a
+ ld [wTempSpecies], a
push de
push hl
call .PrintEntry
@@ -1531,7 +1531,7 @@
push hl
ld de, -SCREEN_WIDTH
add hl, de
- ld de, wd265
+ ld de, wTempSpecies
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
pop hl
@@ -1585,13 +1585,13 @@
ld hl, wPokedexOrder
add hl, de
ld a, [hl]
- ld [wd265], a
+ ld [wTempSpecies], a
ret
Pokedex_CheckCaught:
push de
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
pop hl
@@ -1601,7 +1601,7 @@
Pokedex_CheckSeen:
push de
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckSeenMon
pop hl
@@ -1654,7 +1654,7 @@
ld e, d
.loopfindend
ld a, [hld]
- ld [wd265], a
+ ld [wTempSpecies], a
call Pokedex_CheckSeen
jr nz, .foundend
dec d
@@ -1674,10 +1674,10 @@
.loop1abc
push bc
ld a, [de]
- ld [wd265], a
+ ld [wTempSpecies], a
call Pokedex_CheckSeen
jr z, .skipabc
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [hli], a
ld a, [wDexListingEnd]
inc a
@@ -1898,7 +1898,7 @@
ld a, [hl]
and a
jr z, .next_mon
- ld [wd265], a
+ ld [wTempSpecies], a
ld [wCurSpecies], a
call Pokedex_CheckCaught
jr z, .next_mon
@@ -1917,7 +1917,7 @@
jr nz, .next_mon
.match_found
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [de], a
inc de
ld a, [wDexSearchResultCount]
@@ -2354,7 +2354,7 @@
jr z, .QuestionMark
ld a, [wFirstUnownSeen]
ld [wUnownLetter], a
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurPartySpecies], a
call GetBaseData
ld de, vTiles2
@@ -2378,7 +2378,7 @@
call Pokedex_GetSelectedMon
Pokedex_LoadAnyFootprint:
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
and %11111000
srl a
@@ -2386,7 +2386,7 @@
srl a
ld e, 0
ld d, a
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
and %111
swap a ; * $10
@@ -2524,7 +2524,7 @@
call LoadFontsExtra
call Pokedex_LoadGFX
call Pokedex_LoadAnyFootprint
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurPartySpecies], a
call Pokedex_DrawDexEntryScreenBG
call Pokedex_DrawFootprint
--- a/engine/pokedex/pokedex_2.asm
+++ b/engine/pokedex/pokedex_2.asm
@@ -80,7 +80,7 @@
call GetPokemonName
hlcoord 9, 3
call PlaceString ; mon species
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld b, a
call GetDexEntryPointer
ld a, b
@@ -96,11 +96,11 @@
ld [hli], a
ld a, $5d ; .
ld [hli], a
- ld de, wd265
+ ld de, wTempSpecies
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
; Check to see if we caught it. Get out of here if we haven't.
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
pop hl
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -1287,12 +1287,12 @@
cp 12
jr c, .am
sub 12
- ld [wd265], a
+ ld [wTempByteValue], a
scf
ret
.am
- ld [wd265], a
+ ld [wTempByteValue], a
and a
ret
@@ -2741,7 +2741,7 @@
ld d, $0
add hl, de
ld a, [hl]
- ld [wd265], a
+ ld [wTempIconSpecies], a
; Get FlyMon icon
ld e, $08 ; starting tile in VRAM
farcall GetSpeciesIcon
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -1035,7 +1035,7 @@
cp -1
ret z
- ld [wd265], a
+ ld [wTempSpecies], a
hlcoord 1, 4
xor a
ld b, 7
@@ -1057,7 +1057,7 @@
jr nz, .row
call BillsPC_LoadMonStats
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
ld hl, wTempMonDVs
@@ -1068,7 +1068,7 @@
xor a
ld [wBillsPC_MonHasMail], a
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
cp EGG
ret z
@@ -1676,9 +1676,9 @@
and a
jr z, .did_nothing
call BillsPC_GetSelectedPokemonSpecies
- ld [wd265], a
+ ld [wTempSpecies], a
call BillsPC_LoadMonStats
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
ld hl, wTempMonDVs
@@ -1893,7 +1893,7 @@
.skip_cry
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
call GetPokemonName
hlcoord 1, 16
ld de, PCString_ReleasedPKMN
@@ -2314,9 +2314,9 @@
ld de, .Pokemon
call PlaceString
call GetBoxCount
- ld [wd265], a
+ ld [wDeciramBuffer], a
hlcoord 13, 11
- ld de, wd265
+ ld de, wDeciramBuffer
lb bc, 1, 2
call PrintNum
ld de, .out_of_20
--- a/engine/pokemon/breeding.asm
+++ b/engine/pokemon/breeding.asm
@@ -81,7 +81,7 @@
.done
ld a, c
- ld [wd265], a
+ ld [wBreedingCompatibility], a
ret
.CheckDVs:
@@ -250,7 +250,7 @@
ld a, [wCurPartySpecies]
dec de
ld [de], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wCurSpecies], a
call GetPokemonName
xor a
@@ -676,7 +676,7 @@
ret
EggHatch_AnimationSequence:
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld [wJumptableIndex], a
ld a, [wCurSpecies]
push af
@@ -910,7 +910,7 @@
call CopyBytes
call CheckBreedmonCompatibility
pop bc
- ld a, [wd265]
+ ld a, [wBreedingCompatibility]
ld hl, .AllAlone
cp -1
jr z, .done
--- a/engine/pokemon/caught_data.asm
+++ b/engine/pokemon/caught_data.asm
@@ -38,7 +38,7 @@
ld hl, wPlayerName
call CopyBytes
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
@@ -105,7 +105,7 @@
call CopyBytes
callfar InsertPokemonIntoBox
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call GiveANickname_YesNo
ld hl, wStringBuffer1
--- a/engine/pokemon/correct_party_errors.asm
+++ b/engine/pokemon/correct_party_errors.asm
@@ -123,7 +123,7 @@
cp EGG
ld hl, .TAMAGO
jr z, .got_nickname
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
.got_nickname
--- a/engine/pokemon/evolve.asm
+++ b/engine/pokemon/evolve.asm
@@ -236,7 +236,7 @@
ld [wCurSpecies], a
ld [wTempMonSpecies], a
ld [wEvolutionNewSpecies], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
push hl
@@ -293,15 +293,15 @@
call CopyBytes
ld a, [wCurSpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
xor a
ld [wMonType], a
call LearnLevelMoves
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call SetSeenAndCaughtMon
- ld a, [wd265]
+ ld a, [wTempSpecies]
cp UNOWN
jr nz, .skip_unown
@@ -348,7 +348,7 @@
ld a, [wCurSpecies]
push af
ld a, [wBaseDexNo]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
pop af
ld [wCurSpecies], a
@@ -369,7 +369,7 @@
call AddNTimes
push hl
ld a, [wCurSpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
pop de
@@ -415,7 +415,7 @@
db "@"
LearnLevelMoves:
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurPartySpecies], a
dec a
ld b, 0
@@ -466,7 +466,7 @@
.learn
ld a, d
ld [wPutativeTMHMMove], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
call CopyName1
predef LearnMove
@@ -475,7 +475,7 @@
.done
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
ret
FillMoves:
--- a/engine/pokemon/learn.asm
+++ b/engine/pokemon/learn.asm
@@ -36,7 +36,7 @@
push hl
push de
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld b, a
ld a, [wBattleMode]
--- a/engine/pokemon/mail.asm
+++ b/engine/pokemon/mail.asm
@@ -149,7 +149,7 @@
; Compare the mail message, byte for byte, with the expected message.
ld a, MAIL_MSG_LENGTH
- ld [wd265], a
+ ld [wTempByteValue], a
.loop
ld a, [de]
ld c, a
@@ -162,9 +162,9 @@
jr nz, .close_sram_return
inc hl
inc de
- ld a, [wd265]
+ ld a, [wTempByteValue]
dec a
- ld [wd265], a
+ ld [wTempByteValue], a
jr nz, .loop
.done
--- a/engine/pokemon/mon_menu.asm
+++ b/engine/pokemon/mon_menu.asm
@@ -100,7 +100,7 @@
jr z, .NotMove
inc hl
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
ret
--- a/engine/pokemon/mon_stats.asm
+++ b/engine/pokemon/mon_stats.asm
@@ -295,7 +295,7 @@
call PrintNum
ld a, "/"
ld [hli], a
- ld de, wd265
+ ld de, wTempPP
lb bc, 1, 2
call PrintNum
pop hl
--- a/engine/pokemon/move_mon.asm
+++ b/engine/pokemon/move_mon.asm
@@ -52,7 +52,7 @@
and a
jr nz, .skipnickname
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wPartyMonNicknames
ld a, [hMoveMon]
@@ -185,11 +185,11 @@
.registerpokedex
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wTempSpecies], a
dec a
push de
call CheckCaughtMon
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call SetSeenAndCaughtMon
pop de
@@ -750,7 +750,7 @@
farcall GetMaxPPOfMove
pop de
pop hl
- ld a, [wd265]
+ ld a, [wTempPP]
ld b, a
ld a, [de]
and %11000000
@@ -970,7 +970,7 @@
call CopyBytes
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld de, sBoxMonNicknames
@@ -1669,7 +1669,7 @@
.done
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wTempEnemyMonSpecies], a
call GetPokemonName
ld hl, wStringBuffer1
--- a/engine/pokemon/move_mon_wo_mail.asm
+++ b/engine/pokemon/move_mon_wo_mail.asm
@@ -5,7 +5,7 @@
call InsertSpeciesIntoBoxOrParty
ld a, [sBoxCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMonNicknames
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
@@ -12,7 +12,7 @@
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
@@ -19,7 +19,7 @@
call InsertDataIntoBoxOrParty
ld a, [sBoxCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, sBoxMons
ld bc, BOXMON_STRUCT_LENGTH
ld de, wBufferMon
@@ -42,7 +42,7 @@
call InsertSpeciesIntoBoxOrParty
ld a, [wPartyCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMonNicknames
ld bc, MON_NAME_LENGTH
ld de, wBufferMonNick
@@ -49,7 +49,7 @@
call InsertDataIntoBoxOrParty
ld a, [wPartyCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
ld de, wBufferMonOT
@@ -56,7 +56,7 @@
call InsertDataIntoBoxOrParty
ld a, [wPartyCount]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
ld hl, wPartyMons
ld bc, PARTYMON_STRUCT_LENGTH
ld de, wBufferMon
@@ -85,7 +85,7 @@
push de
push hl
push bc
- ld a, [wd265]
+ ld a, [wNextBoxOrPartyIndex]
dec a
call AddNTimes
push hl
@@ -95,7 +95,7 @@
pop hl
.loop
push bc
- ld a, [wd265]
+ ld a, [wNextBoxOrPartyIndex]
ld b, a
ld a, [wCurPartyMon]
cp b
@@ -116,9 +116,9 @@
sbc b
ld h, a
pop de
- ld a, [wd265]
+ ld a, [wNextBoxOrPartyIndex]
dec a
- ld [wd265], a
+ ld [wNextBoxOrPartyIndex], a
jr .loop
.insert
--- a/engine/pokemon/party_menu.asm
+++ b/engine/pokemon/party_menu.asm
@@ -596,7 +596,7 @@
push hl
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
- ld e, $0
+ ld e, MONICON_PARTYMENU
rst FarCall
ld a, [hObjectStructIndexBuffer]
inc a
--- a/engine/pokemon/stats_screen.asm
+++ b/engine/pokemon/stats_screen.asm
@@ -377,7 +377,7 @@
xor a
ld [hBGMapMode], a
ld a, [wBaseDexNo]
- ld [wd265], a
+ ld [wDeciramBuffer], a
ld [wCurSpecies], a
hlcoord 8, 0
ld [hl], "№"
@@ -386,7 +386,7 @@
inc hl
hlcoord 10, 0
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
- ld de, wd265
+ ld de, wDeciramBuffer
call PrintNum
hlcoord 14, 0
call PrintLevel
@@ -401,7 +401,7 @@
ld a, "/"
ld [hli], a
ld a, [wBaseDexNo]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call PlaceString
call StatsScreen_PlaceHorizontalDivider
@@ -483,7 +483,7 @@
StatsScreen_LoadGFX:
ld a, [wBaseDexNo]
- ld [wd265], a
+ ld [wTempSpecies], a
ld [wCurSpecies], a
xor a
ld [hBGMapMode], a
@@ -708,7 +708,7 @@
ld b, a
farcall TimeCapsule_ReplaceTeruSama
ld a, b
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
ret
--- a/engine/pokemon/types.asm
+++ b/engine/pokemon/types.asm
@@ -74,9 +74,9 @@
jp PlaceString
GetTypeName:
-; Copy the name of type [wd265] to wStringBuffer1.
+; Copy the name of type [wNamedObjectIndexBuffer] to wStringBuffer1.
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld hl, TypeNames
ld e, a
ld d, 0
--- a/engine/printer/print_party.asm
+++ b/engine/printer/print_party.asm
@@ -26,11 +26,11 @@
hlcoord 2, 11, wPrinterTileMapBuffer
lb bc, 5, 18
call ClearBox
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
push af
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld b, a
ld c, 1 ; get page 1
farcall GetDexEntryPagePointer
@@ -75,11 +75,11 @@
ld bc, SCREEN_WIDTH
ld a, $32
call ByteFill
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
push af
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld b, a
ld c, 2 ; get page 2
farcall GetDexEntryPagePointer
@@ -170,7 +170,7 @@
lb bc, 2, 3
call PrintNum
ld a, [wCurPartySpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wCurSpecies], a
ld hl, wPartyMonNicknames
call Function1dc50e
@@ -186,7 +186,7 @@
inc hl
ld [hl], "."
inc hl
- ld de, wd265
+ ld de, wNamedObjectIndexBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
hlcoord 1, 9
@@ -297,7 +297,7 @@
and a
jr z, .no_move
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetMoveName
jr .got_string
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -725,7 +725,7 @@
ld a, [de]
cp $ff
jp z, .finish
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
ld [wCurPartySpecies], a
push bc
--- a/engine/rtc/timeset.asm
+++ b/engine/rtc/timeset.asm
@@ -694,8 +694,8 @@
inc hl
pop bc
call AdjustHourForAMorPM
- ld [wd265], a
- ld de, wd265
+ ld [wDeciramBuffer], a
+ ld de, wDeciramBuffer
call PrintTwoDigitNumberRightAlign
ret
--- a/home.asm
+++ b/home.asm
@@ -169,7 +169,7 @@
CountSetBits::
; Count the number of set bits in b bytes starting from hl.
-; Return in a, c and [wd265].
+; Return in a, c and [wNumSetBits].
ld c, 0
.next
ld a, [hli]
@@ -188,7 +188,7 @@
jr nz, .next
ld a, c
- ld [wd265], a
+ ld [wNumSetBits], a
ret
GetWeekday::
--- a/home/names.asm
+++ b/home/names.asm
@@ -23,7 +23,7 @@
jr nz, .NotPokeName
ld a, [wCurSpecies]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, MON_NAME_LENGTH
add hl, de
@@ -110,7 +110,7 @@
ret
GetPokemonName::
-; Get Pokemon name wd265.
+; Get Pokemon name for wNamedObjectIndexBuffer.
ld a, [hROMBank]
push af
@@ -119,7 +119,7 @@
rst Bankswitch
; Each name is ten characters
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
dec a
ld d, 0
ld e, a
@@ -147,11 +147,11 @@
ret
GetItemName::
-; Get item name wd265.
+; Get item name for wNamedObjectIndexBuffer.
push hl
push bc
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
cp TM01
jr nc, .TM
@@ -170,12 +170,12 @@
ret
GetTMHMName::
-; Get TM/HM name by item id wd265.
+; Get TM/HM name for item wNamedObjectIndexBuffer.
push hl
push de
push bc
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
push af
; TM/HM prefix
@@ -197,7 +197,7 @@
; TM/HM number
push de
- ld a, [wd265]
+ ld a, [wNamedObjectIndexBuffer]
ld c, a
callfar GetTMHMNumber
pop de
@@ -235,7 +235,7 @@
ld [de], a
pop af
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
pop bc
pop de
pop hl
--- a/home/print_level.asm
+++ b/home/print_level.asm
@@ -22,7 +22,7 @@
ld c, 3
Print8BitNumRightAlign::
- ld [wd265], a
- ld de, wd265
+ ld [wDeciramBuffer], a
+ ld de, wDeciramBuffer
ld b, PRINTNUM_RIGHTALIGN | 1
jp PrintNum
--- a/maps/BattleTowerBattleRoom.asm
+++ b/maps/BattleTowerBattleRoom.asm
@@ -34,7 +34,7 @@
special FadeOutPalettes
reloadmap
ifnotequal $0, Script_FailedBattleTowerChallenge
- copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64
+ copybytetovar wNrOfBeatenBattleTowerTrainers
ifequal BATTLETOWER_STREAK_LENGTH, Script_BeatenAllTrainers
applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksOut
warpsound
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -261,7 +261,7 @@
.get_name
ld a, e
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld bc, MON_NAME_LENGTH - 1
--- a/mobile/mobile_12_2.asm
+++ b/mobile/mobile_12_2.asm
@@ -428,7 +428,7 @@
.loop
push bc
push hl
- ld e, 0
+ ld e, MONICON_PARTYMENU
farcall LoadMenuMonIcon
ld a, [hObjectStructIndexBuffer]
inc a
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -1549,7 +1549,7 @@
.StageForSend:
ld a, [wBattlePlayerAction]
- and a
+ and a ; BATTLEPLAYERACTION_USEMOVE?
jr nz, .switch
ld a, [wCurPlayerMove]
ld b, BATTLEACTION_E
@@ -6383,7 +6383,7 @@
ld hl, wPartyCount
add hl, de
ld a, [hl]
- ld [wd265], a
+ ld [wTempSpecies], a
cp EGG
jr z, .asm_102d6d
dec a
@@ -6396,7 +6396,7 @@
ld [hl], BASE_HAPPINESS
.asm_102d6d
- ld a, [wd265]
+ ld a, [wTempSpecies]
cp UNOWN
jr nz, .asm_102d98
ld a, [wcd4c]
@@ -6529,7 +6529,7 @@
ld a, [de]
cp $ff
ret z
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
push bc
push hl
push de
@@ -6557,7 +6557,7 @@
ld hl, wPartySpecies
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wStringBuffer2
@@ -6570,7 +6570,7 @@
ld hl, wOTPartySpecies
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, UnknownText_0x102ee2
call PrintTextBoxText
@@ -6639,7 +6639,7 @@
ld hl, wOTPartySpecies
add hl, bc
ld a, [hl]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
call Function102dc3
ld de, String_102fb2
@@ -7518,11 +7518,11 @@
db "@"
Function103780:
- ld a, [wd265]
+ ld a, [wChosenCableClubRoom]
push af
call Function10378c
pop af
- ld [wd265], a
+ ld [wChosenCableClubRoom], a
ret
Function10378c:
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -318,7 +318,7 @@
MobileTradeAnim_InitSpeciesName:
push de
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
pop de
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -3967,7 +3967,7 @@
.uber_under_70
pop af
ld a, [de]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
ld de, wcd49
@@ -5624,11 +5624,11 @@
ld [wCurIconTile], a
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
- ld e, $4
+ ld e, MONICON_MOBILE1
rst FarCall
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon)
- ld e, $5
+ ld e, MONICON_MOBILE2
rst FarCall
ld hl, $c6d0
ld bc, $0115
@@ -6127,7 +6127,7 @@
.loop
push af
ld a, [de]
- ld [wd265], a
+ ld [wTempSpecies], a
push de
push hl
call .PlaceMonNameOrPlaceholderString
@@ -6387,13 +6387,13 @@
ld hl, $c6d0
add hl, de
ld a, [hl]
- ld [wd265], a
+ ld [wTempSpecies], a
ret
CheckCaughtMemMon:
push de
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckCaughtMon
pop hl
@@ -6403,7 +6403,7 @@
CheckSeenMemMon:
push de
push hl
- ld a, [wd265]
+ ld a, [wTempSpecies]
dec a
call CheckSeenMon
pop hl
@@ -6463,7 +6463,7 @@
ret
Function11b279:
- ld a, [wd265]
+ ld a, [wTempSpecies]
ld [wCurSpecies], a
call CheckSeenMemMon
jr z, .asm_11b28f
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -121,10 +121,10 @@
push hl
ld de, 0
xor a
- ld [wd265], a
+ ld [wTempByteValue], a
.asm_170c30
ld hl, wPartyMon1HP
- ld a, [wd265]
+ ld a, [wTempByteValue]
call GetPartyLocation
ld a, [hli]
ld b, a
@@ -143,9 +143,9 @@
push hl
pop de
jr c, .asm_170c58
- ld a, [wd265]
+ ld a, [wTempByteValue]
inc a
- ld [wd265], a
+ ld [wTempByteValue], a
cp $3
jr c, .asm_170c30
jr .asm_170c5b
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -3902,7 +3902,7 @@
ld a, [hl]
ld a, $1
ld [rSVBK], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetPokemonName
pop hl
call PlaceString
@@ -4021,7 +4021,7 @@
ld a, [hl]
ld a, $1
ld [rSVBK], a
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
pop hl
call PlaceString
--- a/wram.asm
+++ b/wram.asm
@@ -2199,11 +2199,24 @@
wInitListType:: db
wBattleHasJustStarted:: db
+; d265 has many different short-term uses
wNamedObjectIndexBuffer::
-wCurTMHM::
+wDeciramBuffer::
+wTempByteValue::
+wNumSetBits::
wTypeMatchup::
-wFoundMatchingIDInParty::
-wd265::
+wCurType::
+wTempSpecies::
+wTempIconSpecies::
+wTempTMHM::
+wTempPP::
+wNextBoxOrPartyIndex::
+wChosenCableClubRoom::
+wBreedingCompatibility::
+wMoveGrammar::
+wApplyStatLevelMultipliersToEnemy::
+wUsePPUp::
+wd265:: ; mobile
db
wFailedToFlee:: db