summaryrefslogtreecommitdiff
path: root/engine/battle/core.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle/core.asm')
-rw-r--r--engine/battle/core.asm1609
1 files changed, 805 insertions, 804 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 1a58b3df5..0fe77df40 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -4,11 +4,11 @@ DoBattle: ; 3c000
xor a
ld [wBattleParticipantsNotFainted], a
ld [wBattleParticipantsIncludingFainted], a
- ld [wPlayerAction], a
- ld [BattleEnded], a
+ ld [wBattlePlayerAction], a
+ ld [wBattleEnded], a
inc a
ld [wBattleHasJustStarted], a
- ld hl, OTPartyMon1HP
+ ld hl, wOTPartyMon1HP
ld bc, PARTYMON_STRUCT_LENGTH - 1
ld d, BATTLEACTION_SWITCH1 - 1
.loop
@@ -52,33 +52,33 @@ DoBattle: ; 3c000
and a
jp z, LostBattle
call Call_LoadTempTileMapToTileMap
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_DEBUG
jp z, .tutorial_debug
cp BATTLETYPE_TUTORIAL
jp z, .tutorial_debug
xor a
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
.loop2
call CheckIfCurPartyMonIsFitToFight
jr nz, .alive2
- ld hl, CurPartyMon
+ ld hl, wCurPartyMon
inc [hl]
jr .loop2
.alive2
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
inc a
- ld hl, PartySpecies - 1
+ ld hl, wPartySpecies - 1
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
- ld [CurPartySpecies], a
- ld [TempBattleMonSpecies], a
+ ld [wCurPartySpecies], a
+ ld [wTempBattleMonSpecies], a
hlcoord 1, 5
ld a, 9
call SlideBattlePicOut
@@ -154,7 +154,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
.skip_sfx
call SetPlayerTurn
ld a, 1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
ret
; 3c12f
@@ -170,8 +170,8 @@ BattleTurn: ; 3c12f
ld [wBattleHasJustStarted], a
ld [wPlayerJustGotFrozen], a
ld [wEnemyJustGotFrozen], a
- ld [CurDamage], a
- ld [CurDamage + 1], a
+ ld [wCurDamage], a
+ ld [wCurDamage + 1], a
call HandleBerserkGene
call UpdateBattleMonInParty
@@ -190,7 +190,7 @@ BattleTurn: ; 3c12f
.loop1
call BattleMenu
jr c, .quit
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .quit
ld a, [wForcedSwitch] ; roared/whirlwinded/teleported
@@ -217,12 +217,12 @@ BattleTurn: ; 3c12f
and a
jr nz, .quit
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .quit
call HandleBetweenTurnEffects
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .quit
jp .loop
@@ -303,7 +303,7 @@ CheckFaint_PlayerThenEnemy: ; 3c23c
call HasPlayerFainted
jr nz, .PlayerNotFainted
call HandlePlayerMonFaint
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .BattleIsOver
@@ -311,7 +311,7 @@ CheckFaint_PlayerThenEnemy: ; 3c23c
call HasEnemyFainted
jr nz, .BattleContinues
call HandleEnemyMonFaint
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .BattleIsOver
@@ -328,7 +328,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c
call HasEnemyFainted
jr nz, .EnemyNotFainted
call HandleEnemyMonFaint
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .BattleIsOver
@@ -336,7 +336,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c
call HasPlayerFainted
jr nz, .BattleContinues
call HandlePlayerMonFaint
- ld a, [BattleEnded]
+ ld a, [wBattleEnded]
and a
jr nz, .BattleIsOver
@@ -363,15 +363,15 @@ HandleBerserkGene: ; 3c27c
.player
call SetPlayerTurn
- ld de, PartyMon1Item
- ld a, [CurBattleMon]
+ ld de, wPartyMon1Item
+ ld a, [wCurBattleMon]
ld b, a
jr .go
.enemy
call SetEnemyTurn
- ld de, OTPartyMon1Item
- ld a, [CurOTMon]
+ ld de, wOTPartyMon1Item
+ ld a, [wCurOTMon]
ld b, a
; jr .go
@@ -404,8 +404,8 @@ HandleBerserkGene: ; 3c27c
push af
xor a
ld [hl], a
- ld [AttackMissed], a
- ld [EffectFailed], a
+ ld [wAttackMissed], a
+ ld [wEffectFailed], a
farcall BattleCommand_AttackUp2
pop af
pop hl
@@ -455,7 +455,7 @@ DetermineMoveOrder: ; 3c314
jr z, .use_move
sub BATTLEACTION_SWITCH1
jr c, .use_move
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
cp $2
jr nz, .switch
ld a, [hSerialConnectionStatus]
@@ -480,7 +480,7 @@ DetermineMoveOrder: ; 3c314
jp .enemy_first
.use_move
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
and a
jp nz, .player_first
call CompareMovePriority
@@ -536,8 +536,8 @@ DetermineMoveOrder: ; 3c314
jr .speed_check
.speed_check
- ld de, BattleMonSpeed
- ld hl, EnemyMonSpeed
+ ld de, wBattleMonSpeed
+ ld hl, wEnemyMonSpeed
ld c, 2
call StringCmp
jr z, .speed_tie
@@ -568,7 +568,7 @@ DetermineMoveOrder: ; 3c314
; 3c3f5
CheckContestBattleOver: ; 3c3f5
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_CONTEST
jr nz, .contest_not_over
ld a, [wParkBallsRemaining]
@@ -587,20 +587,20 @@ CheckContestBattleOver: ; 3c3f5
; 3c410
CheckPlayerLockedIn: ; 3c410
- ld a, [PlayerSubStatus4]
+ ld a, [wPlayerSubStatus4]
and 1 << SUBSTATUS_RECHARGE
jp nz, .quit
- ld hl, EnemySubStatus3
+ ld hl, wEnemySubStatus3
res SUBSTATUS_FLINCHED, [hl]
- ld hl, PlayerSubStatus3
+ ld hl, wPlayerSubStatus3
res SUBSTATUS_FLINCHED, [hl]
ld a, [hl]
and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE
jp nz, .quit
- ld hl, PlayerSubStatus1
+ ld hl, wPlayerSubStatus1
bit SUBSTATUS_ROLLOUT, [hl]
jp nz, .quit
@@ -615,31 +615,31 @@ CheckPlayerLockedIn: ; 3c410
ParsePlayerAction: ; 3c434
call CheckPlayerLockedIn
jp c, .locked_in
- ld hl, PlayerSubStatus5
+ ld hl, wPlayerSubStatus5
bit SUBSTATUS_ENCORED, [hl]
jr z, .not_encored
- ld a, [LastPlayerMove]
- ld [CurPlayerMove], a
+ ld a, [wLastPlayerMove]
+ ld [wCurPlayerMove], a
jr .encored
.not_encored
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
cp $2
jr z, .reset_rage
and a
jr nz, .reset_bide
- ld a, [PlayerSubStatus3]
+ ld a, [wPlayerSubStatus3]
and 1 << SUBSTATUS_BIDE
jr nz, .locked_in
xor a
ld [wMoveSelectionMenuType], a
inc a ; POUND
- ld [FXAnimID], a
+ ld [wFXAnimID], a
call MoveSelectionScreen
push af
call Call_LoadTempTileMapToTileMap
call UpdateBattleHuds
- ld a, [CurPlayerMove]
+ ld a, [wCurPlayerMove]
cp STRUGGLE
jr z, .struggle
call PlayClickSFX
@@ -659,13 +659,13 @@ ParsePlayerAction: ; 3c434
cp EFFECT_FURY_CUTTER
jr z, .continue_fury_cutter
xor a
- ld [PlayerFuryCutterCount], a
+ ld [wPlayerFuryCutterCount], a
.continue_fury_cutter
ld a, [wPlayerMoveStruct + MOVE_EFFECT]
cp EFFECT_RAGE
jr z, .continue_rage
- ld hl, PlayerSubStatus4
+ ld hl, wPlayerSubStatus4
res SUBSTATUS_RAGE, [hl]
xor a
ld [wPlayerRageCounter], a
@@ -677,19 +677,19 @@ ParsePlayerAction: ; 3c434
cp EFFECT_ENDURE
jr z, .continue_protect
xor a
- ld [PlayerProtectCount], a
+ ld [wPlayerProtectCount], a
jr .continue_protect
.reset_bide
- ld hl, PlayerSubStatus3
+ ld hl, wPlayerSubStatus3
res SUBSTATUS_BIDE, [hl]
.locked_in
xor a
- ld [PlayerFuryCutterCount], a
- ld [PlayerProtectCount], a
+ ld [wPlayerFuryCutterCount], a
+ ld [wPlayerProtectCount], a
ld [wPlayerRageCounter], a
- ld hl, PlayerSubStatus4
+ ld hl, wPlayerSubStatus4
res SUBSTATUS_RAGE, [hl]
.continue_protect
@@ -699,10 +699,10 @@ ParsePlayerAction: ; 3c434
.reset_rage
xor a
- ld [PlayerFuryCutterCount], a
- ld [PlayerProtectCount], a
+ ld [wPlayerFuryCutterCount], a
+ ld [wPlayerProtectCount], a
ld [wPlayerRageCounter], a
- ld hl, PlayerSubStatus4
+ ld hl, wPlayerSubStatus4
res SUBSTATUS_RAGE, [hl]
xor a
ret
@@ -718,15 +718,15 @@ HandleEncore: ; 3c4df
.player_1
call .do_enemy
.do_player
- ld hl, PlayerSubStatus5
+ ld hl, wPlayerSubStatus5
bit SUBSTATUS_ENCORED, [hl]
ret z
- ld a, [PlayerEncoreCount]
+ ld a, [wPlayerEncoreCount]
dec a
- ld [PlayerEncoreCount], a
+ ld [wPlayerEncoreCount], a
jr z, .end_player_encore
- ld hl, BattleMonPP
- ld a, [CurMoveNum]
+ ld hl, wBattleMonPP
+ ld a, [wCurMoveNum]
ld c, a
ld b, 0
add hl, bc
@@ -735,22 +735,22 @@ HandleEncore: ; 3c4df
ret nz
.end_player_encore
- ld hl, PlayerSubStatus5
+ ld hl, wPlayerSubStatus5
res SUBSTATUS_ENCORED, [hl]
call SetEnemyTurn
ld hl, BattleText_TargetsEncoreEnded
jp StdBattleTextBox
.do_enemy
- ld hl, EnemySubStatus5
+ ld hl, wEnemySubStatus5
bit SUBSTATUS_ENCORED, [hl]
ret z
- ld a, [EnemyEncoreCount]
+ ld a, [wEnemyEncoreCount]
dec a
- ld [EnemyEncoreCount], a
+ ld [wEnemyEncoreCount], a
jr z, .end_enemy_encore
- ld hl, EnemyMonPP
- ld a, [CurEnemyMoveNum]
+ ld hl, wEnemyMonPP
+ ld a, [wCurEnemyMoveNum]
ld c, a
ld b, 0
add hl, bc
@@ -759,7 +759,7 @@ HandleEncore: ; 3c4df
ret nz
.end_enemy_encore
- ld hl, EnemySubStatus5
+ ld hl, wEnemySubStatus5
res SUBSTATUS_ENCORED, [hl]
call SetPlayerTurn
ld hl, BattleText_TargetsEncoreEnded
@@ -771,7 +771,7 @@ TryEnemyFlee: ; 3c543
dec a
jr nz, .Stay
- ld a, [PlayerSubStatus5]
+ ld a, [wPlayerSubStatus5]
bit SUBSTATUS_CANT_RUN, a
jr nz, .Stay
@@ -779,11 +779,11 @@ TryEnemyFlee: ; 3c543
and a
jr nz, .Stay
- ld a, [EnemyMonStatus]
+ ld a, [wEnemyMonStatus]
and 1 << FRZ | SLP
jr nz, .Stay
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld de, 1
ld hl, AlwaysFleeMons
call IsInArray
@@ -795,7 +795,7 @@ TryEnemyFlee: ; 3c543
jr nc, .Stay
push bc
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld de, 1
ld hl, OftenFleeMons
call IsInArray
@@ -806,7 +806,7 @@ TryEnemyFlee: ; 3c543
cp 1 + (10 percent)
jr nc, .Stay
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld de, 1
ld hl, SometimesFleeMons
call IsInArray
@@ -827,11 +827,11 @@ CompareMovePriority: ; 3c5b4
; Compare the priority of the player and enemy's moves.
; Return carry if the player goes first, or z if they match.
- ld a, [CurPlayerMove]
+ ld a, [wCurPlayerMove]
call GetMovePriority
ld b, a
push bc
- ld a, [CurEnemyMove]
+ ld a, [wCurEnemyMove]
call GetMovePriority
pop bc
cp b
@@ -920,7 +920,7 @@ Battle_EnemyFirst: ; 3c5fe
jp z, HandlePlayerMonFaint
call RefreshBattleHuds
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ret
; 3c664
@@ -970,7 +970,7 @@ Battle_PlayerFirst: ; 3c664
jp z, HandleEnemyMonFaint
call RefreshBattleHuds
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ret
; 3c6cf
@@ -1011,11 +1011,11 @@ HasUserFainted: ; 3c706
and a
jr z, HasPlayerFainted
HasEnemyFainted: ; 3c70b
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
jr CheckIfHPIsZero
HasPlayerFainted: ; 3c710
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
CheckIfHPIsZero: ; 3c713
ld a, [hli]
@@ -1052,11 +1052,11 @@ ResidualDamage: ; 3c716
ld [wNumHits], a
call Call_PlayBattleAnim_OnlyIfVisible
call GetEighthMaxHP
- ld de, PlayerToxicCount
+ ld de, wPlayerToxicCount
ld a, [hBattleTurn]
and a
jr z, .check_toxic
- ld de, EnemyToxicCount
+ ld de, wEnemyToxicCount
.check_toxic
ld a, BATTLE_VARS_SUBSTATUS5
@@ -1141,11 +1141,11 @@ ResidualDamage: ; 3c716
call StdBattleTextBox
.not_cursed
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
jr z, .check_fainted
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
.check_fainted
ld a, [hli]
@@ -1175,11 +1175,11 @@ HandlePerishSong: ; 3c801
call SetPlayerTurn
.do_it
- ld hl, PlayerPerishCount
+ ld hl, wPlayerPerishCount
ld a, [hBattleTurn]
and a
jr z, .got_count
- ld hl, EnemyPerishCount
+ ld hl, wEnemyPerishCount
.got_count
ld a, BATTLE_VARS_SUBSTATUS1
@@ -1200,12 +1200,12 @@ HandlePerishSong: ; 3c801
ld a, [hBattleTurn]
and a
jr nz, .kill_enemy
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
xor a
ld [hli], a
ld [hl], a
- ld hl, PartyMon1HP
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1HP
+ ld a, [wCurBattleMon]
call GetPartyLocation
xor a
ld [hli], a
@@ -1213,15 +1213,15 @@ HandlePerishSong: ; 3c801
ret
.kill_enemy
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
xor a
ld [hli], a
ld [hl], a
ld a, [wBattleMode]
dec a
ret z
- ld hl, OTPartyMon1HP
- ld a, [CurOTMon]
+ ld hl, wOTPartyMon1HP
+ ld a, [wCurOTMon]
call GetPartyLocation
xor a
ld [hli], a
@@ -1264,7 +1264,7 @@ HandleWrap: ; 3c874
ld a, [de]
ld [wd265], a
- ld [FXAnimID], a
+ ld [wFXAnimID], a
call GetMoveName
dec [hl]
jr z, .release_from_bounds
@@ -1277,7 +1277,7 @@ HandleWrap: ; 3c874
call SwitchTurnCore
xor a
ld [wNumHits], a
- ld [FXAnimID + 1], a
+ ld [wFXAnimID + 1], a
predef PlayBattleAnim
call SwitchTurnCore
@@ -1324,11 +1324,11 @@ HandleLeftovers: ; 3c8eb
cp HELD_LEFTOVERS
ret nz
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
jr z, .got_hp
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
.got_hp
; Don't restore if we're already at max HP
@@ -1370,13 +1370,13 @@ HandleMysteryberry: ; 3c93c
ld a, b
cp HELD_RESTORE_PP
jr nz, .quit
- ld hl, PartyMon1PP
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1PP
+ ld a, [wCurBattleMon]
call GetPartyLocation
ld d, h
ld e, l
- ld hl, PartyMon1Moves
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1Moves
+ ld a, [wCurBattleMon]
call GetPartyLocation
ld a, [hBattleTurn]
and a
@@ -1386,13 +1386,13 @@ HandleMysteryberry: ; 3c93c
ld a, [wBattleMode]
dec a
jr z, .wild
- ld hl, OTPartyMon1PP
- ld a, [CurOTMon]
+ ld hl, wOTPartyMon1PP
+ ld a, [wCurOTMon]
call GetPartyLocation
ld d, h
ld e, l
- ld hl, OTPartyMon1Moves
- ld a, [CurOTMon]
+ ld hl, wOTPartyMon1Moves
+ ld a, [wCurOTMon]
call GetPartyLocation
.wild
@@ -1429,13 +1429,13 @@ HandleMysteryberry: ; 3c93c
push bc
ld a, [hl]
ld [wd265], a
- ld de, BattleMonMoves - 1
- ld hl, BattleMonPP
+ ld de, wBattleMonMoves - 1
+ ld hl, wBattleMonPP
ld a, [hBattleTurn]
and a
jr z, .player_pp
- ld de, EnemyMonMoves - 1
- ld hl, EnemyMonPP
+ ld de, wEnemyMonMoves - 1
+ ld hl, wEnemyMonPP
.player_pp
inc de
pop bc
@@ -1453,9 +1453,9 @@ HandleMysteryberry: ; 3c93c
jr nz, .skip_checks
ld a, [hBattleTurn]
and a
- ld a, [PlayerSubStatus5]
+ ld a, [wPlayerSubStatus5]
jr z, .check_transform
- ld a, [EnemySubStatus5]
+ ld a, [wEnemySubStatus5]
.check_transform
bit SUBSTATUS_TRANSFORMED, a
jr nz, .skip_checks
@@ -1531,14 +1531,14 @@ HandleFutureSight: ; 3ca26
callfar UpdateMoveData
xor a
- ld [AttackMissed], a
- ld [AlreadyDisobeyed], a
+ ld [wAttackMissed], a
+ ld [wAlreadyDisobeyed], a
ld a, 10
- ld [TypeModifier], a
+ ld [wTypeModifier], a
callfar DoMove
xor a
- ld [CurDamage], a
- ld [CurDamage + 1], a
+ ld [wCurDamage], a
+ ld [wCurDamage + 1], a
ld a, BATTLE_VARS_MOVE
call GetBattleVarAddr
@@ -1559,7 +1559,7 @@ HanleDefrost: ; 3ca8f
.enemy_first
call .do_enemy_turn
.do_player_turn
- ld a, [BattleMonStatus]
+ ld a, [wBattleMonStatus]
bit FRZ, a
ret z
@@ -1571,9 +1571,9 @@ HanleDefrost: ; 3ca8f
cp 10 percent
ret nc
xor a
- ld [BattleMonStatus], a
- ld a, [CurBattleMon]
- ld hl, PartyMon1Status
+ ld [wBattleMonStatus], a
+ ld a, [wCurBattleMon]
+ ld hl, wPartyMon1Status
call GetPartyLocation
ld [hl], 0
call UpdateBattleHuds
@@ -1582,7 +1582,7 @@ HanleDefrost: ; 3ca8f
jp StdBattleTextBox
.do_enemy_turn
- ld a, [EnemyMonStatus]
+ ld a, [wEnemyMonStatus]
bit FRZ, a
ret z
ld a, [wEnemyJustGotFrozen]
@@ -1592,13 +1592,13 @@ HanleDefrost: ; 3ca8f
cp 10 percent
ret nc
xor a
- ld [EnemyMonStatus], a
+ ld [wEnemyMonStatus], a
ld a, [wBattleMode]
dec a
jr z, .wild
- ld a, [CurOTMon]
- ld hl, OTPartyMon1Status
+ ld a, [wCurOTMon]
+ ld hl, wOTPartyMon1Status
call GetPartyLocation
ld [hl], 0
.wild
@@ -1619,26 +1619,26 @@ HandleSafeguard: ; 3cafb
.player1
call .CheckEnemy
.CheckPlayer:
- ld a, [PlayerScreens]
+ ld a, [wPlayerScreens]
bit SCREENS_SAFEGUARD, a
ret z
- ld hl, PlayerSafeguardCount
+ ld hl, wPlayerSafeguardCount
dec [hl]
ret nz
res SCREENS_SAFEGUARD, a
- ld [PlayerScreens], a
+ ld [wPlayerScreens], a
xor a
jr .print
.CheckEnemy:
- ld a, [EnemyScreens]
+ ld a, [wEnemyScreens]
bit SCREENS_SAFEGUARD, a
ret z
- ld hl, EnemySafeguardCount
+ ld hl, wEnemySafeguardCount
dec [hl]
ret nz
res SCREENS_SAFEGUARD, a
- ld [EnemyScreens], a
+ ld [wEnemyScreens], a
ld a, $1
.print
@@ -1660,16 +1660,16 @@ HandleScreens: ; 3cb36
call SetPlayerTurn
ld de, .Your
call .Copy
- ld hl, PlayerScreens
- ld de, PlayerLightScreenCount
+ ld hl, wPlayerScreens
+ ld de, wPlayerLightScreenCount
jr .TickScreens
.CheckEnemy:
call SetEnemyTurn
ld de, .Enemy
call .Copy
- ld hl, EnemyScreens
- ld de, EnemyLightScreenCount
+ ld hl, wEnemyScreens
+ ld de, wEnemyLightScreenCount
.TickScreens:
bit SCREENS_LIGHT_SCREEN, [hl]
@@ -1679,7 +1679,7 @@ HandleScreens: ; 3cb36
ret
.Copy:
- ld hl, StringBuffer1
+ ld hl, wStringBuffer1
jp CopyName2
; 3cb75
@@ -1716,18 +1716,18 @@ HandleScreens: ; 3cb36
; 3cb9e
HandleWeather: ; 3cb9e
- ld a, [Weather]
+ ld a, [wBattleWeather]
cp WEATHER_NONE
ret z
- ld hl, WeatherCount
+ ld hl, wWeatherCount
dec [hl]
jr z, .ended
ld hl, .WeatherMessages
call .PrintWeatherMessage
- ld a, [Weather]
+ ld a, [wBattleWeather]
cp WEATHER_SANDSTORM
ret nz
@@ -1752,11 +1752,11 @@ HandleWeather: ; 3cb9e
bit SUBSTATUS_UNDERGROUND, a
ret nz
- ld hl, BattleMonType1
+ ld hl, wBattleMonType1
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyMonType1
+ ld hl, wEnemyMonType1
.ok
ld a, [hli]
cp ROCK
@@ -1790,11 +1790,11 @@ HandleWeather: ; 3cb9e
ld hl, .WeatherEndedMessages
call .PrintWeatherMessage
xor a
- ld [Weather], a
+ ld [wBattleWeather], a
ret
.PrintWeatherMessage:
- ld a, [Weather]
+ ld a, [wBattleWeather]
dec a
ld c, a
ld b, 0
@@ -1828,34 +1828,34 @@ SubtractHPFromUser: ; 3cc3f
; 3cc45
SubtractHP: ; 3cc45
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
.ok
inc hl
ld a, [hl]
- ld [Buffer3], a
+ ld [wBuffer3], a
sub c
ld [hld], a
- ld [Buffer5], a
+ ld [wBuffer5], a
ld a, [hl]
- ld [Buffer4], a
+ ld [wBuffer4], a
sbc b
ld [hl], a
- ld [Buffer6], a
+ ld [wBuffer6], a
ret nc
- ld a, [Buffer3]
+ ld a, [wBuffer3]
ld c, a
- ld a, [Buffer4]
+ ld a, [wBuffer4]
ld b, a
xor a
ld [hli], a
ld [hl], a
- ld [Buffer5], a
- ld [Buffer6], a
+ ld [wBuffer5], a
+ ld [wBuffer6], a
ret
; 3cc76
@@ -1926,30 +1926,30 @@ GetHalfMaxHP: ; 3cc9f
; 3ccac
GetMaxHP: ; 3ccac
-; output: bc, Buffer1-2
+; output: bc, wBuffer1-2
- ld hl, BattleMonMaxHP
+ ld hl, wBattleMonMaxHP
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyMonMaxHP
+ ld hl, wEnemyMonMaxHP
.ok
ld a, [hli]
- ld [Buffer2], a
+ ld [wBuffer2], a
ld b, a
ld a, [hl]
- ld [Buffer1], a
+ ld [wBuffer1], a
ld c, a
ret
; 3ccc2
Unreferenced_GetHalfHP: ; 3ccc2
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
.ok
ld a, [hli]
ld b, a
@@ -1958,18 +1958,18 @@ Unreferenced_GetHalfHP: ; 3ccc2
srl b
rr c
ld a, [hli]
- ld [Buffer2], a
+ ld [wBuffer2], a
ld a, [hl]
- ld [Buffer1], a
+ ld [wBuffer1], a
ret
; 3ccde
CheckUserHasEnoughHP: ; 3ccde
- ld hl, BattleMonHP + 1
+ ld hl, wBattleMonHP + 1
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyMonHP + 1
+ ld hl, wEnemyMonHP + 1
.ok
ld a, c
sub [hl]
@@ -1980,43 +1980,43 @@ CheckUserHasEnoughHP: ; 3ccde
; 3ccef
RestoreHP ; 3ccef
- ld hl, EnemyMonMaxHP
+ ld hl, wEnemyMonMaxHP
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, BattleMonMaxHP
+ ld hl, wBattleMonMaxHP
.ok
ld a, [hli]
- ld [Buffer2], a
+ ld [wBuffer2], a
ld a, [hld]
- ld [Buffer1], a
+ ld [wBuffer1], a
dec hl
ld a, [hl]
- ld [Buffer3], a
+ ld [wBuffer3], a
add c
ld [hld], a
- ld [Buffer5], a
+ ld [wBuffer5], a
ld a, [hl]
- ld [Buffer4], a
+ ld [wBuffer4], a
adc b
ld [hli], a
- ld [Buffer6], a
+ ld [wBuffer6], a
- ld a, [Buffer1]
+ ld a, [wBuffer1]
ld c, a
ld a, [hld]
sub c
- ld a, [Buffer2]
+ ld a, [wBuffer2]
ld b, a
ld a, [hl]
sbc b
jr c, .asm_3cd2d
ld a, b
ld [hli], a
- ld [Buffer6], a
+ ld [wBuffer6], a
ld a, c
ld [hl], a
- ld [Buffer5], a
+ ld [wBuffer5], a
.asm_3cd2d
call SwitchTurnCore
@@ -2047,7 +2047,7 @@ UpdateHPBar: ; 3cd3c
HandleEnemyMonFaint: ; 3cd55
call FaintEnemyPokemon
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
call z, FaintYourPokemon
@@ -2059,7 +2059,7 @@ HandleEnemyMonFaint: ; 3cd55
and a
jp z, LostBattle
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
call nz, UpdatePlayerHUD
@@ -2074,14 +2074,14 @@ HandleEnemyMonFaint: ; 3cd55
jr nz, .trainer
ld a, 1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
ret
.trainer
call CheckEnemyTrainerDefeated
jp z, WinTrainerBattle
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
jr nz, .player_mon_not_fainted
@@ -2090,7 +2090,7 @@ HandleEnemyMonFaint: ; 3cd55
jr nc, .dont_flee
ld a, 1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
ret
.dont_flee
@@ -2099,18 +2099,18 @@ HandleEnemyMonFaint: ; 3cd55
jp c, WildFled_EnemyFled_LinkBattleCanceled
ld a, $1
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
jr DoubleSwitch
.player_mon_not_fainted
ld a, $1
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ret
; 3cdca
@@ -2128,19 +2128,19 @@ DoubleSwitch: ; 3cdca
jr .done
.player_1
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
push af
ld a, $1
call EnemyPartyMonEntrance
call ClearSprites
call LoadTileMapToTempTileMap
pop af
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
call PlayerPartyMonEntrance
.done
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ret
; 3ce01
@@ -2149,18 +2149,18 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
ld a, [wBattleMode]
dec a
jr z, .wild
- ld a, [CurOTMon]
- ld hl, OTPartyMon1HP
+ ld a, [wCurOTMon]
+ ld hl, wOTPartyMon1HP
call GetPartyLocation
xor a
ld [hli], a
ld [hl], a
.wild
- ld hl, PlayerSubStatus3
+ ld hl, wPlayerSubStatus3
res SUBSTATUS_IN_LOOP, [hl]
xor a
- ld hl, EnemyDamageTaken
+ ld hl, wEnemyDamageTaken
ld [hli], a
ld [hl], a
call NewEnemyMonStatus
@@ -2173,10 +2173,10 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
.wild2
call StopDangerSound
ld a, $1
- ld [wDanger], a
+ ld [wBattleLowHealthAlarm], a
.trainer
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
jr nz, .player_mon_did_not_faint
@@ -2200,8 +2200,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
ld [wBattleResult], a
call IsAnyMonHoldingExpShare
jr z, .skip_exp
- ld hl, EnemyMonBaseStats
- ld b, EnemyMonEnd - EnemyMonBaseStats
+ ld hl, wEnemyMonBaseStats
+ ld b, wEnemyMonEnd - wEnemyMonBaseStats
.loop
srl [hl]
inc hl
@@ -2209,9 +2209,9 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
jr nz, .loop
.skip_exp
- ld hl, EnemyMonBaseStats
+ ld hl, wEnemyMonBaseStats
ld de, wBackupEnemyMonBaseStats
- ld bc, EnemyMonEnd - EnemyMonBaseStats
+ ld bc, wEnemyMonEnd - wEnemyMonBaseStats
call CopyBytes
xor a
ld [wGivingExperienceToExpShareHolders], a
@@ -2224,8 +2224,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
ld a, d
ld [wBattleParticipantsNotFainted], a
ld hl, wBackupEnemyMonBaseStats
- ld de, EnemyMonBaseStats
- ld bc, EnemyMonEnd - EnemyMonBaseStats
+ ld de, wEnemyMonBaseStats
+ ld bc, wEnemyMonEnd - wEnemyMonBaseStats
call CopyBytes
ld a, $1
ld [wGivingExperienceToExpShareHolders], a
@@ -2236,9 +2236,9 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
; 3ceaa
IsAnyMonHoldingExpShare: ; 3ceaa
- ld a, [PartyCount]
+ ld a, [wPartyCount]
ld b, a
- ld hl, PartyMon1
+ ld hl, wPartyMon1
ld c, 1
ld d, 0
.loop
@@ -2293,7 +2293,7 @@ IsAnyMonHoldingExpShare: ; 3ceaa
StopDangerSound: ; 3ceec
xor a
- ld [Danger], a
+ ld [wLowHealthAlarm], a
ret
; 3cef1
@@ -2301,8 +2301,8 @@ FaintYourPokemon: ; 3cef1
call StopDangerSound
call WaitSFX
ld a, $f0
- ld [CryTracks], a
- ld a, [BattleMonSpecies]
+ ld [wCryTracks], a
+ ld a, [wBattleMonSpecies]
call PlayStereoCry
call PlayerMonFaintedAnimation
hlcoord 9, 7
@@ -2327,10 +2327,10 @@ FaintEnemyPokemon: ; 3cf14
; 3cf35
CheckEnemyTrainerDefeated: ; 3cf35
- ld a, [OTPartyCount]
+ ld a, [wOTPartyCount]
ld b, a
xor a
- ld hl, OTPartyMon1HP
+ ld hl, wOTPartyMon1HP
ld de, PARTYMON_STRUCT_LENGTH
.loop
@@ -2347,7 +2347,7 @@ CheckEnemyTrainerDefeated: ; 3cf35
; 3cf4a
HandleEnemySwitch: ; 3cf4a
- ld hl, EnemyHPPal
+ ld hl, wEnemyHPPal
ld e, HP_BAR_LENGTH_PX
call UpdateHPPal
call WaitBGMap
@@ -2364,7 +2364,7 @@ HandleEnemySwitch: ; 3cf4a
call Call_LoadTempTileMapToTileMap
.not_linked
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
ld a, $0
@@ -2394,7 +2394,7 @@ EnemyPartyMonEntrance: ; 3cf78
call SpikesDamage
xor a
ld [wEnemyMoveStruct + MOVE_ANIM], a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
inc a
ret
; 3cfa4
@@ -2403,8 +2403,8 @@ WinTrainerBattle: ; 3cfa4
; Player won the battle
call StopDangerSound
ld a, $1
- ld [wDanger], a
- ld [BattleEnded], a
+ ld [wBattleLowHealthAlarm], a
+ ld [wBattleEnded], a
ld a, [wLinkMode]
and a
ld a, b
@@ -2419,14 +2419,14 @@ WinTrainerBattle: ; 3cfa4
and a
ret nz
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
bit 0, a
jr nz, .battle_tower
call BattleWinSlideInEnemyTrainerFrontpic
ld c, 40
call DelayFrames
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_CANLOSE
jr nz, .skip_heal
predef HealParty
@@ -2535,7 +2535,7 @@ WinTrainerBattle: ; 3cfa4
.AddMoneyToWallet: ; 3d08d
push bc
ld hl, wBattleReward + 2
- ld de, Money + 2
+ ld de, wMoney + 2
call AddBattleMoneyToAccount
pop bc
ret
@@ -2652,7 +2652,7 @@ IsGymLeader: ; 0x3d128
ld hl, GymLeaders
IsGymLeaderCommon:
push de
- ld a, [OtherTrainerClass]
+ ld a, [wOtherTrainerClass]
ld de, $1
call IsInArray
pop de
@@ -2663,7 +2663,7 @@ INCLUDE "data/trainers/leaders.asm"
HandlePlayerMonFaint: ; 3d14e
call FaintYourPokemon
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
call z, FaintEnemyPokemon
@@ -2674,7 +2674,7 @@ HandlePlayerMonFaint: ; 3d14e
ld a, d
and a
jp z, LostBattle
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
jr nz, .notfainted
@@ -2683,7 +2683,7 @@ HandlePlayerMonFaint: ; 3d14e
dec a
jr nz, .trainer
ld a, $1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
ret
.trainer
@@ -2694,7 +2694,7 @@ HandlePlayerMonFaint: ; 3d14e
call AskUseNextPokemon
jr nc, .switch
ld a, $1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
ret
.switch
@@ -2705,40 +2705,40 @@ HandlePlayerMonFaint: ; 3d14e
and a
ret nz
ld a, $1
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
jp DoubleSwitch
; 3d1aa
PlayerMonFaintHappinessMod: ; 3d1aa
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
ld b, RESET_FLAG
predef SmallFarFlagAction
- ld hl, EnemySubStatus3
+ ld hl, wEnemySubStatus3
res SUBSTATUS_IN_LOOP, [hl]
xor a
- ld [Danger], a
- ld hl, PlayerDamageTaken
+ ld [wLowHealthAlarm], a
+ ld hl, wPlayerDamageTaken
ld [hli], a
ld [hl], a
- ld [BattleMonStatus], a
+ ld [wBattleMonStatus], a
call UpdateBattleMonInParty
ld c, HAPPINESS_FAINTED
; If TheirLevel > (YourLevel + 30), use a different parameter
- ld a, [BattleMonLevel]
+ ld a, [wBattleMonLevel]
add 30
ld b, a
- ld a, [EnemyMonLevel]
+ ld a, [wEnemyMonLevel]
cp b
jr c, .got_param
ld c, HAPPINESS_BEATENBYSTRONGFOE
.got_param
- ld a, [CurBattleMon]
- ld [CurPartyMon], a
+ ld a, [wCurBattleMon]
+ ld [wCurPartyMon], a
callfar ChangeHappiness
ld a, [wBattleResult]
and %11000000
@@ -2774,8 +2774,8 @@ AskUseNextPokemon: ; 3d1f8
ld a, [wMenuCursorY]
cp $1 ; YES
jr z, .loop
- ld hl, PartyMon1Speed
- ld de, EnemyMonSpeed
+ ld hl, wPartyMon1Speed
+ ld de, wEnemyMonSpeed
jp TryToRunAwayFromBattle
; 3d227
@@ -2788,15 +2788,15 @@ ForcePlayerMonChoice: ; 3d227
and a
jr z, .skip_link
ld a, $1
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call LinkBattleSendReceiveAction
.skip_link
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call CheckMobileBattleError
jr c, .enemy_fainted_mobile_error
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
jr nz, .send_out_pokemon
@@ -2816,10 +2816,10 @@ ForcePlayerMonChoice: ; 3d227
.send_out_pokemon
call ClearSprites
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
call ResetPlayerStatLevels
@@ -2844,10 +2844,10 @@ ForcePlayerMonChoice: ; 3d227
; 3d2b3
PlayerPartyMonEntrance: ; 3d2b3
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
call ResetPlayerStatLevels
@@ -2918,7 +2918,7 @@ SelectBattleMon: ; 3d329
PickPartyMonInBattle: ; 3d33c
.loop
ld a, PARTYMENUACTION_SWITCH ; Which PKMN?
- ld [PartyMenuActionText], a
+ ld [wPartyMenuActionText], a
call JumpToPartyMenuAndPrintText
call SelectBattleMon
ret c
@@ -2929,8 +2929,8 @@ PickPartyMonInBattle: ; 3d33c
; 3d34f
SwitchMonAlreadyOut: ; 3d34f
- ld hl, CurBattleMon
- ld a, [CurPartyMon]
+ ld hl, wCurBattleMon
+ ld a, [wCurPartyMon]
cp [hl]
jr nz, .notout
@@ -2985,13 +2985,13 @@ ForcePickSwitchMonInBattle: ; 3d380
LostBattle: ; 3d38e
ld a, 1
- ld [BattleEnded], a
+ ld [wBattleEnded], a
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
bit 0, a
jr nz, .battle_tower
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_CANLOSE
jr nz, .not_canlose
@@ -3229,7 +3229,7 @@ EnemySwitch: ; 3d4e1
xor a
ld [wBattleParticipantsNotFainted], a
ld [wBattleParticipantsIncludingFainted], a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
inc a
ld [wEnemyIsSwitching], a
call LoadTileMapToTempTileMap
@@ -3288,10 +3288,10 @@ CheckWhetherSwitchmonIsPredetermined: ; 3d533
ResetEnemyBattleVars: ; 3d557
; and draw empty TextBox
xor a
- ld [LastPlayerCounterMove], a
- ld [LastEnemyCounterMove], a
- ld [LastEnemyMove], a
- ld [CurEnemyMove], a
+ ld [wLastPlayerCounterMove], a
+ ld [wLastEnemyCounterMove], a
+ ld [wLastEnemyMove], a
+ ld [wCurEnemyMove], a
dec a
ld [wEnemyItemState], a
xor a
@@ -3308,7 +3308,7 @@ ResetBattleParticipants: ; 3d57a
ld [wBattleParticipantsNotFainted], a
ld [wBattleParticipantsIncludingFainted], a
AddBattleParticipant: ; 3d581
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
ld b, SET_FLAG
@@ -3322,21 +3322,21 @@ AddBattleParticipant: ; 3d581
FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599
ld b, $ff
ld a, $1
- ld [Buffer1], a
- ld [Buffer2], a
+ ld [wBuffer1], a
+ ld [wBuffer2], a
.loop
- ld hl, Buffer1
+ ld hl, wBuffer1
sla [hl]
inc hl
sla [hl]
inc b
- ld a, [OTPartyCount]
+ ld a, [wOTPartyCount]
cp b
jp z, ScoreMonTypeMatchups
- ld a, [CurOTMon]
+ ld a, [wCurOTMon]
cp b
jr z, .discourage
- ld hl, OTPartyMon1HP
+ ld hl, wOTPartyMon1HP
push bc
ld a, b
call GetPartyLocation
@@ -3351,14 +3351,14 @@ FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599
jr .loop
.discourage
- ld hl, Buffer2
+ ld hl, wBuffer2
set 0, [hl]
jr .loop
; 3d5d7
LookUpTheEffectivenessOfEveryMove: ; 3d5d7
push bc
- ld hl, OTPartyMon1Moves
+ ld hl, wOTPartyMon1Moves
ld a, b
call GetPartyLocation
pop bc
@@ -3387,7 +3387,7 @@ LookUpTheEffectivenessOfEveryMove: ; 3d5d7
ld a, [wd265] ; Get The Effectiveness Modifier
cp 10 + 1 ; 1.0 + 0.1
jr c, .loop
- ld hl, Buffer1
+ ld hl, wBuffer1
set 0, [hl]
ret
.done
@@ -3398,7 +3398,7 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618
; Calculates the effectiveness of the types of the PlayerPkmn
; against the OTPkmn
push bc
- ld hl, OTPartyCount
+ ld hl, wOTPartyCount
ld a, b
inc a
ld c, a
@@ -3409,18 +3409,18 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618
ld hl, BaseData + BASE_TYPES
ld bc, BASE_DATA_SIZE
call AddNTimes
- ld de, EnemyMonType
+ ld de, wEnemyMonType
ld bc, BASE_CATCH_RATE - BASE_TYPES
ld a, BANK(BaseData)
call FarCopyBytes
- ld a, [BattleMonType1]
+ ld a, [wBattleMonType1]
ld [wPlayerMoveStruct + MOVE_TYPE], a
call SetPlayerTurn
callfar BattleCheckTypeMatchup
ld a, [wd265]
cp 10 + 1 ; 1.0 + 0.1
jr nc, .super_effective
- ld a, [BattleMonType2]
+ ld a, [wBattleMonType2]
ld [wPlayerMoveStruct + MOVE_TYPE], a
callfar BattleCheckTypeMatchup
ld a, [wd265]
@@ -3431,7 +3431,7 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618
.super_effective
pop bc
- ld hl, Buffer1
+ ld hl, wBuffer1
bit 0, [hl]
jr nz, .reset
inc hl
@@ -3445,12 +3445,12 @@ IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618
ScoreMonTypeMatchups: ; 3d672
.loop1
- ld hl, Buffer1
+ ld hl, wBuffer1
sla [hl]
inc hl
sla [hl]
jr nc, .loop1
- ld a, [OTPartyCount]
+ ld a, [wOTPartyCount]
ld b, a
ld c, [hl]
.loop2
@@ -3461,7 +3461,7 @@ ScoreMonTypeMatchups: ; 3d672
jr .loop2
.okay
- ld a, [Buffer1]
+ ld a, [wBuffer1]
and a
jr z, .okay2
ld b, $ff
@@ -3474,7 +3474,7 @@ ScoreMonTypeMatchups: ; 3d672
.okay2
ld b, $ff
- ld a, [Buffer2]
+ ld a, [wBuffer2]
ld c, a
.loop4
inc b
@@ -3483,17 +3483,17 @@ ScoreMonTypeMatchups: ; 3d672
jr .quit
.loop5
- ld a, [OTPartyCount]
+ ld a, [wOTPartyCount]
ld b, a
call BattleRandom
and $7
cp b
jr nc, .loop5
ld b, a
- ld a, [CurOTMon]
+ ld a, [wCurOTMon]
cp b
jr z, .loop5
- ld hl, OTPartyMon1HP
+ ld hl, wOTPartyMon1HP
push bc
ld a, b
call GetPartyLocation
@@ -3511,35 +3511,35 @@ ScoreMonTypeMatchups: ; 3d672
LoadEnemyPkmnToSwitchTo: ; 3d6ca
; 'b' contains the PartyNr of the Pkmn the AI will switch to
ld a, b
- ld [CurPartyMon], a
- ld hl, OTPartyMon1Level
+ ld [wCurPartyMon], a
+ ld hl, wOTPartyMon1Level
call GetPartyLocation
ld a, [hl]
- ld [CurPartyLevel], a
- ld a, [CurPartyMon]
+ ld [wCurPartyLevel], a
+ ld a, [wCurPartyMon]
inc a
- ld hl, OTPartyCount
+ ld hl, wOTPartyCount
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
- ld [TempEnemyMonSpecies], a
- ld [CurPartySpecies], a
+ ld [wTempEnemyMonSpecies], a
+ ld [wCurPartySpecies], a
call LoadEnemyMon
- ld a, [CurPartySpecies]
+ ld a, [wCurPartySpecies]
cp UNOWN
jr nz, .skip_unown
ld a, [wFirstUnownSeen]
and a
jr nz, .skip_unown
- ld hl, EnemyMonDVs
+ ld hl, wEnemyMonDVs
predef GetUnownLetter
- ld a, [UnownLetter]
+ ld a, [wUnownLetter]
ld [wFirstUnownSeen], a
.skip_unown
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
ld [wEnemyHPAtTimeOfPlayerSwitch], a
ld a, [hl]
@@ -3551,23 +3551,23 @@ CheckWhetherToAskSwitch: ; 3d714
ld a, [wBattleHasJustStarted]
dec a
jp z, .return_nc
- ld a, [PartyCount]
+ ld a, [wPartyCount]
dec a
jp z, .return_nc
ld a, [wLinkMode]
and a
jp nz, .return_nc
- ld a, [Options]
+ ld a, [wOptions]
bit BATTLE_SHIFT, a
jr nz, .return_nc
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
push af
- ld a, [CurBattleMon]
- ld [CurPartyMon], a
+ ld a, [wCurBattleMon]
+ ld [wCurPartyMon], a
farcall CheckCurPartyMonFainted
pop bc
ld a, b
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
jr c, .return_nc
scf
ret
@@ -3578,7 +3578,7 @@ CheckWhetherToAskSwitch: ; 3d714
; 3d74b
OfferSwitch: ; 3d74b
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
push af
callfar Battle_GetTrainerName
ld hl, BattleText_EnemyIsAboutToUseWillPlayerChangePkmn
@@ -3591,18 +3591,18 @@ OfferSwitch: ; 3d74b
call SetUpBattlePartyMenu_NoLoop
call PickSwitchMonInBattle
jr c, .canceled_switch
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
call ClearPalettes
call DelayFrame
call _LoadHPBar
pop af
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
xor a
- ld [CurEnemyMove], a
- ld [CurPlayerMove], a
+ ld [wCurEnemyMove], a
+ ld [wCurPlayerMove], a
and a
ret
@@ -3613,7 +3613,7 @@ OfferSwitch: ; 3d74b
.said_no
pop af
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
scf
ret
; 3d7a0
@@ -3638,12 +3638,12 @@ Function_BattleTextEnemySentOut: ; 3d7b8
; 3d7c7
Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
- ld a, [TempEnemyMonSpecies]
- ld [CurPartySpecies], a
- ld [CurSpecies], a
+ ld a, [wTempEnemyMonSpecies]
+ ld [wCurPartySpecies], a
+ ld [wCurSpecies], a
call GetBaseData
ld a, OTPARTYMON
- ld [MonType], a
+ ld [wMonType], a
predef CopyPkmnToTempMon
call GetEnemyMonFrontpic
@@ -3662,7 +3662,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
call Call_PlayBattleAnim
.not_shiny
- ld bc, TempMonSpecies
+ ld bc, wTempMonSpecies
farcall CheckFaintedFrzSlp
jr c, .skip_cry
farcall CheckBattleScene
@@ -3675,8 +3675,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
.cry_no_anim
ld a, $f
- ld [CryTracks], a
- ld a, [TempEnemyMonSpecies]
+ ld [wCryTracks], a
+ ld a, [wTempEnemyMonSpecies]
call PlayStereoCry
.skip_cry
@@ -3688,24 +3688,24 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
NewEnemyMonStatus: ; 3d834
xor a
- ld [LastPlayerCounterMove], a
- ld [LastEnemyCounterMove], a
- ld [LastEnemyMove], a
- ld hl, EnemySubStatus1
+ ld [wLastPlayerCounterMove], a
+ ld [wLastEnemyCounterMove], a
+ ld [wLastEnemyMove], a
+ ld hl, wEnemySubStatus1
rept 4
ld [hli], a
endr
ld [hl], a
- ld [EnemyDisableCount], a
- ld [EnemyFuryCutterCount], a
- ld [EnemyProtectCount], a
+ ld [wEnemyDisableCount], a
+ ld [wEnemyFuryCutterCount], a
+ ld [wEnemyProtectCount], a
ld [wEnemyRageCounter], a
- ld [EnemyDisabledMove], a
+ ld [wEnemyDisabledMove], a
ld [wEnemyMinimized], a
ld [wPlayerWrapCount], a
ld [wEnemyWrapCount], a
- ld [EnemyTurnsTaken], a
- ld hl, PlayerSubStatus5
+ ld [wEnemyTurnsTaken], a
+ ld hl, wPlayerSubStatus5
res SUBSTATUS_CANT_RUN, [hl]
ret
; 3d867
@@ -3713,7 +3713,7 @@ endr
ResetEnemyStatLevels: ; 3d867
ld a, BASE_STAT_LEVEL
ld b, NUM_LEVEL_STATS
- ld hl, EnemyStatLevels
+ ld hl, wEnemyStatLevels
.loop
ld [hli], a
dec b
@@ -3723,11 +3723,11 @@ ResetEnemyStatLevels: ; 3d867
CheckPlayerPartyForFitPkmn: ; 3d873
; Has the player any Pkmn in his Party that can fight?
- ld a, [PartyCount]
+ ld a, [wPartyCount]
ld e, a
xor a
- ld hl, PartyMon1HP
- ld bc, PartyMon2 - (PartyMon1 + 1)
+ ld hl, wPartyMon1HP
+ ld bc, wPartyMon2 - (wPartyMon1 + 1)
.loop
or [hl]
inc hl
@@ -3740,8 +3740,8 @@ CheckPlayerPartyForFitPkmn: ; 3d873
; 3d887
CheckIfCurPartyMonIsFitToFight: ; 3d887
- ld a, [CurPartyMon]
- ld hl, PartyMon1HP
+ ld a, [wCurPartyMon]
+ ld hl, wPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
@@ -3750,8 +3750,8 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887
ld a, [wBattleHasJustStarted]
and a
jr nz, .finish_fail
- ld hl, PartySpecies
- ld a, [CurPartyMon]
+ ld hl, wPartySpecies
+ ld a, [wCurPartyMon]
ld c, a
ld b, 0
add hl, bc
@@ -3772,7 +3772,7 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887
TryToRunAwayFromBattle: ; 3d8b3
; Run away from battle, with or without item
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_DEBUG
jp z, .can_escape
cp BATTLETYPE_CONTEST
@@ -3794,7 +3794,7 @@ TryToRunAwayFromBattle: ; 3d8b3
dec a
jp nz, .cant_run_from_trainer
- ld a, [EnemySubStatus5]
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
jp nz, .cant_escape
@@ -3804,7 +3804,7 @@ TryToRunAwayFromBattle: ; 3d8b3
push hl
push de
- ld a, [BattleMonItem]
+ ld a, [wBattleMonItem]
ld [wd265], a
ld b, a
callfar GetItemHeldEffect
@@ -3883,7 +3883,7 @@ TryToRunAwayFromBattle: ; 3d8b3
cp b
jr nc, .can_escape
ld a, $1
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ld hl, BattleText_CantEscape2
jr .print_inescapable_text
@@ -3909,11 +3909,11 @@ TryToRunAwayFromBattle: ; 3d8b3
jr z, .fled
call LoadTileMapToTempTileMap
xor a
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
ld a, $f
- ld [CurMoveNum], a
+ ld [wCurMoveNum], a
xor a
- ld [CurPlayerMove], a
+ ld [wCurPlayerMove], a
call LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
call CheckMobileBattleError
@@ -3962,37 +3962,37 @@ TryToRunAwayFromBattle: ; 3d8b3
InitBattleMon: ; 3da0d
ld a, MON_SPECIES
call GetPartyParamLocation
- ld de, BattleMonSpecies
+ ld de, wBattleMonSpecies
ld bc, MON_ID
call CopyBytes
ld bc, MON_DVS - MON_ID
add hl, bc
- ld de, BattleMonDVs
+ ld de, wBattleMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
inc hl
inc hl
inc hl
- ld de, BattleMonLevel
+ ld de, wBattleMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
- ld a, [BattleMonSpecies]
- ld [TempBattleMonSpecies], a
- ld [CurPartySpecies], a
- ld [CurSpecies], a
+ ld a, [wBattleMonSpecies]
+ ld [wTempBattleMonSpecies], a
+ ld [wCurPartySpecies], a
+ ld [wCurSpecies], a
call GetBaseData
- ld a, [BaseType1]
- ld [BattleMonType1], a
- ld a, [BaseType2]
- ld [BattleMonType2], a
- ld hl, PartyMonNicknames
- ld a, [CurBattleMon]
+ ld a, [wBaseType1]
+ ld [wBattleMonType1], a
+ ld a, [wBaseType2]
+ ld [wBattleMonType2], a
+ ld hl, wPartyMonNicknames
+ ld a, [wCurBattleMon]
call SkipNames
- ld de, BattleMonNick
+ ld de, wBattleMonNick
ld bc, MON_NAME_LENGTH
call CopyBytes
- ld hl, BattleMonAttack
- ld de, PlayerStats
+ ld hl, wBattleMonAttack
+ ld de, wPlayerStats
ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
call CopyBytes
call ApplyStatusEffectOnPlayerStats
@@ -4015,33 +4015,33 @@ BattleCheckShininess: ; 3da7c
; 3da85
GetPartyMonDVs: ; 3da85
- ld hl, BattleMonDVs
- ld a, [PlayerSubStatus5]
+ ld hl, wBattleMonDVs
+ ld a, [wPlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
ret z
- ld hl, PartyMon1DVs
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1DVs
+ ld a, [wCurBattleMon]
jp GetPartyLocation
; 3da97
GetEnemyMonDVs: ; 3da97
- ld hl, EnemyMonDVs
- ld a, [EnemySubStatus5]
+ ld hl, wEnemyMonDVs
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
ret z
ld hl, wEnemyBackupDVs
ld a, [wBattleMode]
dec a
ret z
- ld hl, OTPartyMon1DVs
- ld a, [CurOTMon]
+ ld hl, wOTPartyMon1DVs
+ ld a, [wCurOTMon]
jp GetPartyLocation
; 3dab1
ResetPlayerStatLevels: ; 3dab1
ld a, BASE_STAT_LEVEL
ld b, NUM_LEVEL_STATS
- ld hl, PlayerStatLevels
+ ld hl, wPlayerStatLevels
.loop
ld [hli], a
dec b
@@ -4050,46 +4050,46 @@ ResetPlayerStatLevels: ; 3dab1
; 3dabd
InitEnemyMon: ; 3dabd
- ld a, [CurPartyMon]
- ld hl, OTPartyMon1Species
+ ld a, [wCurPartyMon]
+ ld hl, wOTPartyMon1Species
call GetPartyLocation
- ld de, EnemyMonSpecies
+ ld de, wEnemyMonSpecies
ld bc, MON_ID
call CopyBytes
ld bc, MON_DVS - MON_ID
add hl, bc
- ld de, EnemyMonDVs
+ ld de, wEnemyMonDVs
ld bc, MON_PKRUS - MON_DVS
call CopyBytes
inc hl
inc hl
inc hl
- ld de, EnemyMonLevel
+ ld de, wEnemyMonLevel
ld bc, PARTYMON_STRUCT_LENGTH - MON_LEVEL
call CopyBytes
- ld a, [EnemyMonSpecies]
- ld [CurSpecies], a
+ ld a, [wEnemyMonSpecies]
+ ld [wCurSpecies], a
call GetBaseData
- ld hl, OTPartyMonNicknames
- ld a, [CurPartyMon]
+ ld hl, wOTPartyMonNicknames
+ ld a, [wCurPartyMon]
call SkipNames
- ld de, EnemyMonNick
+ ld de, wEnemyMonNick
ld bc, MON_NAME_LENGTH
call CopyBytes
- ld hl, EnemyMonAttack
- ld de, EnemyStats
+ ld hl, wEnemyMonAttack
+ ld de, wEnemyStats
ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
call CopyBytes
call ApplyStatusEffectOnEnemyStats
- ld hl, BaseType1
- ld de, EnemyMonType1
+ ld hl, wBaseType1
+ ld de, wEnemyMonType1
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
- ld hl, BaseStats
- ld de, EnemyMonBaseStats
+ ld hl, wBaseStats
+ ld de, wEnemyMonBaseStats
ld b, 5
.loop
ld a, [hli]
@@ -4097,17 +4097,17 @@ InitEnemyMon: ; 3dabd
inc de
dec b
jr nz, .loop
- ld a, [CurPartyMon]
- ld [CurOTMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurOTMon], a
ret
; 3db32
SwitchPlayerMon: ; 3db32
call ClearSprites
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
call ResetPlayerStatLevels
@@ -4116,14 +4116,14 @@ SwitchPlayerMon: ; 3db32
call SendOutPlayerMon
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
ret
; 3db5f
SendOutPlayerMon: ; 3db5f
- ld hl, BattleMonDVs
+ ld hl, wBattleMonDVs
predef GetUnownLetter
hlcoord 1, 5
ld b, 7
@@ -4136,12 +4136,12 @@ SendOutPlayerMon: ; 3db5f
xor a
ld [hGraphicStartTile], a
ld [wBattleMenuCursorBuffer], a
- ld [CurMoveNum], a
- ld [TypeModifier], a
+ ld [wCurMoveNum], a
+ ld [wTypeModifier], a
ld [wPlayerMoveStruct + MOVE_ANIM], a
- ld [LastPlayerCounterMove], a
- ld [LastEnemyCounterMove], a
- ld [LastPlayerMove], a
+ ld [wLastPlayerCounterMove], a
+ ld [wLastEnemyCounterMove], a
+ ld [wLastPlayerMove], a
call CheckAmuletCoin
call FinishBattleAnim
xor a
@@ -4167,8 +4167,8 @@ SendOutPlayerMon: ; 3db5f
farcall CheckFaintedFrzSlp
jr c, .statused
ld a, $f0
- ld [CryTracks], a
- ld a, [CurPartySpecies]
+ ld [wCryTracks], a
+ ld a, [wCurPartySpecies]
call PlayStereoCry
.statused
@@ -4180,50 +4180,50 @@ SendOutPlayerMon: ; 3db5f
NewBattleMonStatus: ; 3dbde
xor a
- ld [LastPlayerCounterMove], a
- ld [LastEnemyCounterMove], a
- ld [LastPlayerMove], a
- ld hl, PlayerSubStatus1
+ ld [wLastPlayerCounterMove], a
+ ld [wLastEnemyCounterMove], a
+ ld [wLastPlayerMove], a
+ ld hl, wPlayerSubStatus1
rept 4
ld [hli], a
endr
ld [hl], a
- ld hl, PlayerUsedMoves
+ ld hl, wPlayerUsedMoves
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
- ld [PlayerDisableCount], a
- ld [PlayerFuryCutterCount], a
- ld [PlayerProtectCount], a
+ ld [wPlayerDisableCount], a
+ ld [wPlayerFuryCutterCount], a
+ ld [wPlayerProtectCount], a
ld [wPlayerRageCounter], a
- ld [DisabledMove], a
+ ld [wDisabledMove], a
ld [wPlayerMinimized], a
ld [wEnemyWrapCount], a
ld [wPlayerWrapCount], a
- ld [PlayerTurnsTaken], a
- ld hl, EnemySubStatus5
+ ld [wPlayerTurnsTaken], a
+ ld hl, wEnemySubStatus5
res SUBSTATUS_CANT_RUN, [hl]
ret
; 3dc18
BreakAttraction: ; 3dc18
- ld hl, PlayerSubStatus1
+ ld hl, wPlayerSubStatus1
res SUBSTATUS_IN_LOVE, [hl]
- ld hl, EnemySubStatus1
+ ld hl, wEnemySubStatus1
res SUBSTATUS_IN_LOVE, [hl]
ret
; 3dc23
SpikesDamage: ; 3dc23
- ld hl, PlayerScreens
- ld de, BattleMonType
+ ld hl, wPlayerScreens
+ ld de, wBattleMonType
ld bc, UpdatePlayerHUD
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, EnemyScreens
- ld de, EnemyMonType
+ ld hl, wEnemyScreens
+ ld de, wEnemyMonType
ld bc, UpdateEnemyHUD
.ok
@@ -4265,7 +4265,7 @@ PursuitSwitch: ; 3dc5b
cp EFFECT_PURSUIT
jr nz, .done
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
push af
ld hl, DoPlayerTurn
@@ -4273,8 +4273,8 @@ PursuitSwitch: ; 3dc5b
and a
jr z, .do_turn
ld hl, DoEnemyTurn
- ld a, [LastPlayerMon]
- ld [CurBattleMon], a
+ ld a, [wLastPlayerMon]
+ ld [wCurBattleMon], a
.do_turn
ld a, BANK(DoPlayerTurn)
rst FarCall
@@ -4285,24 +4285,24 @@ PursuitSwitch: ; 3dc5b
ld [hl], a
pop af
- ld [CurBattleMon], a
+ ld [wCurBattleMon], a
ld a, [hBattleTurn]
and a
jr z, .check_enemy_fainted
- ld a, [LastPlayerMon]
+ ld a, [wLastPlayerMon]
call UpdateBattleMon
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
jr nz, .done
ld a, $f0
- ld [CryTracks], a
- ld a, [BattleMonSpecies]
+ ld [wCryTracks], a
+ ld a, [wBattleMonSpecies]
call PlayStereoCry
- ld a, [LastPlayerMon]
+ ld a, [wLastPlayerMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
ld b, RESET_FLAG
@@ -4312,7 +4312,7 @@ PursuitSwitch: ; 3dc5b
jr .done_fainted
.check_enemy_fainted
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
jr nz, .done
@@ -4378,26 +4378,26 @@ HandleHPHealingItem: ; 3dd2f
ld a, b
cp HELD_BERRY
ret nz
- ld de, EnemyMonHP + 1
- ld hl, EnemyMonMaxHP
+ ld de, wEnemyMonHP + 1
+ ld hl, wEnemyMonMaxHP
ld a, [hBattleTurn]
and a
jr z, .go
- ld de, BattleMonHP + 1
- ld hl, BattleMonMaxHP
+ ld de, wBattleMonHP + 1
+ ld hl, wBattleMonMaxHP
.go
; If, and only if, Pokemon's HP is less than half max, use the item.
; Store current HP in Buffer 3/4
push bc
ld a, [de]
- ld [Buffer3], a
+ ld [wBuffer3], a
add a
ld c, a
dec de
ld a, [de]
inc de
- ld [Buffer4], a
+ ld [wBuffer4], a
adc a
ld b, a
ld a, b
@@ -4416,19 +4416,19 @@ HandleHPHealingItem: ; 3dd2f
.less
call ItemRecoveryAnim
- ; store max HP in Buffer1/2
+ ; store max HP in wBuffer1/2
ld a, [hli]
- ld [Buffer2], a
+ ld [wBuffer2], a
ld a, [hl]
- ld [Buffer1], a
+ ld [wBuffer1], a
ld a, [de]
add c
- ld [Buffer5], a
+ ld [wBuffer5], a
ld c, a
dec de
ld a, [de]
adc $0
- ld [Buffer6], a
+ ld [wBuffer6], a
ld b, a
ld a, [hld]
cp c
@@ -4436,15 +4436,15 @@ HandleHPHealingItem: ; 3dd2f
sbc b
jr nc, .okay
ld a, [hli]
- ld [Buffer6], a
+ ld [wBuffer6], a
ld a, [hl]
- ld [Buffer5], a
+ ld [wBuffer5], a
.okay
- ld a, [Buffer6]
+ ld a, [wBuffer6]
ld [de], a
inc de
- ld a, [Buffer5]
+ ld a, [wBuffer5]
ld [de], a
ld a, [hBattleTurn]
ld [wWhichHPBar], a
@@ -4473,11 +4473,11 @@ ItemRecoveryAnim: ; 3ddc8
push bc
call EmptyBattleTextBox
ld a, RECOVER
- ld [FXAnimID], a
+ ld [wFXAnimID], a
call SwitchTurnCore
xor a
ld [wNumHits], a
- ld [FXAnimID + 1], a
+ ld [wFXAnimID + 1], a
predef PlayBattleAnim
call SwitchTurnCore
pop bc
@@ -4646,7 +4646,7 @@ HandleStatBoostingHeldItems: ; 3de97
rst FarCall
pop bc
pop de
- ld a, [FailedMessage]
+ ld a, [wFailedMessage]
and a
ret nz
xor a
@@ -4676,18 +4676,18 @@ HandleStatBoostingHeldItems: ; 3de97
; 3df12
GetPartymonItem: ; 3df12
- ld hl, PartyMon1Item
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1Item
+ ld a, [wCurBattleMon]
call GetPartyLocation
- ld bc, BattleMonItem
+ ld bc, wBattleMonItem
ret
; 3df1f
GetOTPartymonItem: ; 3df1f
- ld hl, OTPartyMon1Item
- ld a, [CurOTMon]
+ ld hl, wOTPartyMon1Item
+ ld a, [wCurOTMon]
call GetPartyLocation
- ld bc, EnemyMonItem
+ ld bc, wEnemyMonItem
ret
; 3df2c
@@ -4696,11 +4696,11 @@ UpdateBattleHUDs: ; 3df2c
push de
push bc
call DrawPlayerHUD
- ld hl, PlayerHPPal
+ ld hl, wPlayerHPPal
call SetHPPal
call CheckDanger
call DrawEnemyHUD
- ld hl, EnemyHPPal
+ ld hl, wEnemyHPPal
call SetHPPal
pop bc
pop de
@@ -4740,19 +4740,19 @@ DrawPlayerHUD: ; 3df58
hlcoord 10, 9
ld b, 1
xor a ; PARTYMON
- ld [MonType], a
+ ld [wMonType], a
predef DrawPlayerHP
; Exp bar
push de
- ld a, [CurBattleMon]
- ld hl, PartyMon1Exp + 2
+ ld a, [wCurBattleMon]
+ ld hl, wPartyMon1Exp + 2
call GetPartyLocation
ld d, h
ld e, l
hlcoord 10, 11
- ld a, [TempMonLevel]
+ ld a, [wTempMonLevel]
ld b, a
call FillInExpBar
pop de
@@ -4760,29 +4760,29 @@ DrawPlayerHUD: ; 3df58
; 3df98
UpdatePlayerHPPal: ; 3df98
- ld hl, PlayerHPPal
+ ld hl, wPlayerHPPal
jp UpdateHPPal
; 3df9e
CheckDanger: ; 3df9e
- ld hl, BattleMonHP
+ ld hl, wBattleMonHP
ld a, [hli]
or [hl]
jr z, .no_danger
- ld a, [wDanger]
+ ld a, [wBattleLowHealthAlarm]
and a
jr nz, .done
- ld a, [PlayerHPPal]
+ ld a, [wPlayerHPPal]
cp HP_RED
jr z, .danger
.no_danger
- ld hl, Danger
+ ld hl, wLowHealthAlarm
res DANGER_ON_F, [hl]
jr .done
.danger
- ld hl, Danger
+ ld hl, wLowHealthAlarm
set DANGER_ON_F, [hl]
.done
@@ -4790,39 +4790,39 @@ CheckDanger: ; 3df9e
; 3dfbf
PrintPlayerHUD: ; 3dfbf
- ld de, BattleMonNick
+ ld de, wBattleMonNick
hlcoord 10, 7
call ret_3e138
call PlaceString
push bc
- ld a, [CurBattleMon]
- ld hl, PartyMon1DVs
+ ld a, [wCurBattleMon]
+ ld hl, wPartyMon1DVs
call GetPartyLocation
- ld de, TempMonDVs
+ ld de, wTempMonDVs
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
- ld hl, BattleMonLevel
- ld de, TempMonLevel
+ ld hl, wBattleMonLevel
+ ld de, wTempMonLevel
ld bc, $11
call CopyBytes
- ld a, [CurBattleMon]
- ld hl, PartyMon1Species
+ ld a, [wCurBattleMon]
+ ld hl, wPartyMon1Species
call GetPartyLocation
ld a, [hl]
- ld [CurPartySpecies], a
- ld [CurSpecies], a
+ ld [wCurPartySpecies], a
+ ld [wCurSpecies], a
call GetBaseData
pop hl
dec hl
ld a, TEMPMON
- ld [MonType], a
+ ld [wMonType], a
callfar GetGender
ld a, " "
jr c, .got_gender_char
@@ -4836,7 +4836,7 @@ PrintPlayerHUD: ; 3dfbf
hlcoord 14, 8
push af ; back up gender
push hl
- ld de, BattleMonStatus
+ ld de, wBattleMonStatus
predef PlaceNonFaintStatus
pop hl
pop bc
@@ -4847,8 +4847,8 @@ PrintPlayerHUD: ; 3dfbf
dec hl ; genderless
.copy_level
- ld a, [BattleMonLevel]
- ld [TempMonLevel], a
+ ld a, [wBattleMonLevel]
+ ld [wTempMonLevel], a
jp PrintLevel
; 3e036
@@ -4874,11 +4874,11 @@ DrawEnemyHUD: ; 3e043
farcall DrawEnemyHUDBorder
- ld a, [TempEnemyMonSpecies]
- ld [CurSpecies], a
- ld [CurPartySpecies], a
+ ld a, [wTempEnemyMonSpecies]
+ ld [wCurSpecies], a
+ ld [wCurPartySpecies], a
call GetBaseData
- ld de, EnemyMonNick
+ ld de, wEnemyMonNick
hlcoord 1, 0
call ret_3e138
call PlaceString
@@ -4886,9 +4886,9 @@ DrawEnemyHUD: ; 3e043
ld l, c
dec hl
- ld hl, EnemyMonDVs
- ld de, TempMonDVs
- ld a, [EnemySubStatus5]
+ ld hl, wEnemyMonDVs
+ ld de, wTempMonDVs
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .ok
ld hl, wEnemyBackupDVs
@@ -4900,7 +4900,7 @@ DrawEnemyHUD: ; 3e043
ld [de], a
ld a, TEMPMON
- ld [MonType], a
+ ld [wMonType], a
callfar GetGender
ld a, " "
jr c, .got_gender
@@ -4915,7 +4915,7 @@ DrawEnemyHUD: ; 3e043
hlcoord 6, 1
push af
push hl
- ld de, EnemyMonStatus
+ ld de, wEnemyMonStatus
predef PlaceNonFaintStatus
pop hl
pop bc
@@ -4925,12 +4925,12 @@ DrawEnemyHUD: ; 3e043
jr nz, .print_level
dec hl
.print_level
- ld a, [EnemyMonLevel]
- ld [TempMonLevel], a
+ ld a, [wEnemyMonLevel]
+ ld [wTempMonLevel], a
call PrintLevel
.skip_level
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
ld [hMultiplicand + 1], a
ld a, [hld]
@@ -4949,7 +4949,7 @@ DrawEnemyHUD: ; 3e043
ld a, HP_BAR_LENGTH_PX
ld [hMultiplier], a
call Multiply
- ld hl, EnemyMonMaxHP
+ ld hl, wEnemyMonMaxHP
ld a, [hli]
ld b, a
ld a, [hl]
@@ -4998,7 +4998,7 @@ DrawEnemyHUD: ; 3e043
; 3e127
UpdateEnemyHPPal: ; 3e127
- ld hl, EnemyHPPal
+ ld hl, wEnemyHPPal
call UpdateHPPal
ret
; 3e12e
@@ -5021,7 +5021,7 @@ BattleMenu: ; 3e139
ld [hBGMapMode], a
call LoadTempTileMapToTileMap
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_DEBUG
jr z, .ok
cp BATTLETYPE_TUTORIAL
@@ -5033,7 +5033,7 @@ BattleMenu: ; 3e139
.ok
.loop
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_CONTEST
jr nz, .not_contest
farcall ContestBattleMenu
@@ -5041,7 +5041,7 @@ BattleMenu: ; 3e139
.not_contest
; Auto input: choose "ITEM"
- ld a, [InputType]
+ ld a, [wInputType]
or a
jr z, .skip_dude_pack_select
farcall _DudeAutoInput_DownA
@@ -5103,20 +5103,20 @@ BattleMenu_Pack: ; 3e1c7
and a
jp nz, .ItemsCantBeUsed
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
and a
jp nz, .ItemsCantBeUsed
call LoadStandardMenuDataHeader
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .tutorial
cp BATTLETYPE_CONTEST
jr z, .contest
farcall BattlePack
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
and a
jr z, .didnt_use_item
jr .got_item
@@ -5124,13 +5124,13 @@ BattleMenu_Pack: ; 3e1c7
.tutorial
farcall TutorialPack
ld a, POKE_BALL
- ld [CurItem], a
+ ld [wCurItem], a
call DoItemEffect
jr .got_item
.contest
ld a, PARK_BALL
- ld [CurItem], a
+ ld [wCurItem], a
call DoItemEffect
.got_item
@@ -5171,7 +5171,7 @@ BattleMenu_Pack: ; 3e1c7
ld [hBGMapMode], a
call _LoadBattleFontsHPBar
call ClearSprites
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .tutorial2
call GetBattleMonBackpic
@@ -5210,7 +5210,7 @@ BattleMenuPKMN_ReturnFromStats:
BattleMenuPKMN_Loop:
call SetUpBattlePartyMenu
xor a
- ld [PartyMenuActionText], a
+ ld [wPartyMenuActionText], a
call JumpToPartyMenuAndPrintText
call SelectBattleMon
jr c, .Cancel
@@ -5280,7 +5280,7 @@ Battle_StatsScreen: ; 3e308
call ClearSprites
call LowVolume
xor a ; PARTYMON
- ld [MonType], a
+ ld [wMonType], a
farcall BattleStatsScreenInit
call MaxVolume
@@ -5301,9 +5301,9 @@ Battle_StatsScreen: ; 3e308
; 3e358
TryPlayerSwitch: ; 3e358
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
ld d, a
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
cp d
jr nz, .check_trapped
ld hl, BattleText_PkmnIsAlreadyOut
@@ -5314,7 +5314,7 @@ TryPlayerSwitch: ; 3e358
ld a, [wPlayerWrapCount]
and a
jr nz, .trapped
- ld a, [EnemySubStatus5]
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
jr z, .try_switch
@@ -5326,10 +5326,10 @@ TryPlayerSwitch: ; 3e358
.try_switch
call CheckIfCurPartyMonIsFitToFight
jp z, BattleMenuPKMN_Loop
- ld a, [CurBattleMon]
- ld [LastPlayerMon], a
+ ld a, [wCurBattleMon]
+ ld [wLastPlayerMon], a
ld a, $2
- ld [wPlayerAction], a
+ ld [wBattlePlayerAction], a
call ClearPalettes
call DelayFrame
call ClearSprites
@@ -5337,8 +5337,8 @@ TryPlayerSwitch: ; 3e358
call CloseWindow
call GetMemSGBLayout
call SetPalettes
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
PlayerSwitch: ; 3e3ad
ld a, 1
ld [wPlayerIsSwitching], a
@@ -5401,7 +5401,7 @@ BattleMonEntrance: ; 3e40b
ld c, 50
call DelayFrames
- ld hl, PlayerSubStatus4
+ ld hl, wPlayerSubStatus4
res SUBSTATUS_RAGE, [hl]
call SetEnemyTurn
@@ -5414,8 +5414,8 @@ BattleMonEntrance: ; 3e40b
lb bc, 5, 11
call ClearBox
- ld a, [CurBattleMon]
- ld [CurPartyMon], a
+ ld a, [wCurBattleMon]
+ ld [wCurPartyMon], a
call AddBattleParticipant
call InitBattleMon
call ResetPlayerStatLevels
@@ -5440,8 +5440,8 @@ PassedBattleMonEntrance: ; 3e459
lb bc, 5, 11
call ClearBox
- ld a, [CurPartyMon]
- ld [CurBattleMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurBattleMon], a
call AddBattleParticipant
call InitBattleMon
xor a
@@ -5458,20 +5458,20 @@ BattleMenu_Run: ; 3e489
call Call_LoadTempTileMapToTileMap
ld a, $3
ld [wMenuCursorY], a
- ld hl, BattleMonSpeed
- ld de, EnemyMonSpeed
+ ld hl, wBattleMonSpeed
+ ld de, wEnemyMonSpeed
call TryToRunAwayFromBattle
ld a, $0
ld [wFailedToFlee], a
ret c
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
and a
ret nz
jp BattleMenu
; 3e4a8
CheckAmuletCoin: ; 3e4a8
- ld a, [BattleMonItem]
+ ld a, [wBattleMonItem]
ld b, a
callfar GetItemHeldEffect
ld a, b
@@ -5489,7 +5489,7 @@ MoveSelectionScreen: ; 3e4bc
ret
.not_mobile
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
ld a, [wMoveSelectionMenuType]
dec a
jr z, .got_menu_type
@@ -5497,7 +5497,7 @@ MoveSelectionScreen: ; 3e4bc
jr z, .ether_elixer_menu
call CheckPlayerHasUsableMoves
ret z ; use Struggle
- ld hl, BattleMonMoves
+ ld hl, wBattleMonMoves
jr .got_menu_type
.ether_elixer_menu
@@ -5530,7 +5530,7 @@ MoveSelectionScreen: ; 3e4bc
hlcoord 6, 17 - NUM_MOVES - 4
.got_start_coord
ld a, SCREEN_WIDTH
- ld [Buffer1], a
+ ld [wBuffer1], a
predef ListMoves
ld b, 5
@@ -5548,7 +5548,7 @@ MoveSelectionScreen: ; 3e4bc
ld a, [wMoveSelectionMenuType]
cp $1
jr z, .skip_inc
- ld a, [CurMoveNum]
+ ld a, [wCurMoveNum]
inc a
.skip_inc
@@ -5634,7 +5634,7 @@ MoveSelectionScreen: ; 3e4bc
.not_enemy_moves_process_b
dec a
ld a, b
- ld [CurMoveNum], a
+ ld [wCurMoveNum], a
jr nz, .use_move
pop af
@@ -5644,7 +5644,7 @@ MoveSelectionScreen: ; 3e4bc
pop af
ret nz
- ld hl, BattleMonPP
+ ld hl, wBattleMonPP
ld a, [wMenuCursorY]
ld c, a
ld b, 0
@@ -5652,7 +5652,7 @@ MoveSelectionScreen: ; 3e4bc
ld a, [hl]
and PP_MASK
jr z, .no_pp_left
- ld a, [PlayerDisableCount]
+ ld a, [wPlayerDisableCount]
swap a
and $f
dec a
@@ -5662,14 +5662,14 @@ MoveSelectionScreen: ; 3e4bc
and a
jr nz, .skip2
ld a, [wMenuCursorY]
- ld hl, BattleMonMoves
+ ld hl, wBattleMonMoves
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
.skip2
- ld [CurPlayerMove], a
+ ld [wCurPlayerMove], a
xor a
ret
@@ -5717,11 +5717,11 @@ MoveSelectionScreen: ; 3e4bc
ld a, [wMoveSwapBuffer]
and a
jr z, .start_swap
- ld hl, BattleMonMoves
+ ld hl, wBattleMonMoves
call .swap_bytes
- ld hl, BattleMonPP
+ ld hl, wBattleMonPP
call .swap_bytes
- ld hl, PlayerDisableCount
+ ld hl, wPlayerDisableCount
ld a, [hl]
swap a
and $f
@@ -5752,11 +5752,11 @@ MoveSelectionScreen: ; 3e4bc
.swap_moves_in_party_struct
; Fixes the COOLTRAINER glitch
- ld a, [PlayerSubStatus5]
+ ld a, [wPlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr nz, .transformed
- ld hl, PartyMon1Moves
- ld a, [CurBattleMon]
+ ld hl, wPartyMon1Moves
+ ld a, [wCurBattleMon]
call GetPartyLocation
push hl
call .swap_bytes
@@ -5808,7 +5808,7 @@ MoveInfoBox: ; 3e6c8
call TextBox
call MobileTextBorder
- ld a, [PlayerDisableCount]
+ ld a, [wPlayerDisableCount]
and a
jr z, .not_disabled
@@ -5828,29 +5828,29 @@ MoveInfoBox: ; 3e6c8
ld hl, wMenuCursorY
dec [hl]
call SetPlayerTurn
- ld hl, BattleMonMoves
+ ld hl, wBattleMonMoves
ld a, [wMenuCursorY]
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
- ld [CurPlayerMove], a
+ ld [wCurPlayerMove], a
- ld a, [CurBattleMon]
- ld [CurPartyMon], a
+ ld a, [wCurBattleMon]
+ ld [wCurPartyMon], a
ld a, WILDMON
- ld [MonType], a
+ ld [wMonType], a
callfar GetMaxPPOfMove
ld hl, wMenuCursorY
ld c, [hl]
inc [hl]
ld b, 0
- ld hl, BattleMonPP
+ ld hl, wBattleMonPP
add hl, bc
ld a, [hl]
and PP_MASK
- ld [StringBuffer1], a
+ ld [wStringBuffer1], a
call .PrintPP
hlcoord 1, 9
@@ -5884,7 +5884,7 @@ MoveInfoBox: ; 3e6c8
hlcoord 5, 11
.ok
push hl
- ld de, StringBuffer1
+ ld de, wStringBuffer1
lb bc, 1, 2
call PrintNum
pop hl
@@ -5900,10 +5900,10 @@ MoveInfoBox: ; 3e6c8
CheckPlayerHasUsableMoves: ; 3e786
ld a, STRUGGLE
- ld [CurPlayerMove], a
- ld a, [PlayerDisableCount]
+ ld [wCurPlayerMove], a
+ ld a, [wPlayerDisableCount]
and a
- ld hl, BattleMonPP
+ ld hl, wBattleMonPP
jr nz, .disabled
ld a, [hli]
@@ -5955,7 +5955,7 @@ ParseEnemyAction: ; 3e7c1
jr z, .not_linked
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
- ld a, [wPlayerAction]
+ ld a, [wBattlePlayerAction]
and a
call z, LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
@@ -5966,30 +5966,30 @@ ParseEnemyAction: ; 3e7c1
jp z, .battle_action_d
cp BATTLEACTION_SWITCH1
jp nc, ResetVarsForSubstatusRage
- ld [CurEnemyMoveNum], a
+ ld [wCurEnemyMoveNum], a
ld c, a
- ld a, [EnemySubStatus1]
+ ld a, [wEnemySubStatus1]
bit SUBSTATUS_ROLLOUT, a
jp nz, .skip_load
- ld a, [EnemySubStatus3]
+ ld a, [wEnemySubStatus3]
and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE
jp nz, .skip_load
- ld hl, EnemySubStatus5
+ ld hl, wEnemySubStatus5
bit SUBSTATUS_ENCORED, [hl]
- ld a, [LastEnemyMove]
+ ld a, [wLastEnemyMove]
jp nz, .finish
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
ld b, 0
add hl, bc
ld a, [hl]
jp .finish
.not_linked
- ld hl, EnemySubStatus5
+ ld hl, wEnemySubStatus5
bit SUBSTATUS_ENCORED, [hl]
jr z, .skip_encore
- ld a, [LastEnemyMove]
+ ld a, [wLastEnemyMove]
jp .finish
.skip_encore
@@ -6002,14 +6002,14 @@ ParseEnemyAction: ; 3e7c1
jr .finish
.continue
- ld hl, EnemyMonMoves
- ld de, EnemyMonPP
+ ld hl, wEnemyMonMoves
+ ld de, wEnemyMonPP
ld b, NUM_MOVES
.loop
ld a, [hl]
and a
jp z, .struggle
- ld a, [EnemyDisabledMove]
+ ld a, [wEnemyDisabledMove]
cp [hl]
jr z, .disabled
ld a, [de]
@@ -6029,13 +6029,13 @@ ParseEnemyAction: ; 3e7c1
jr nz, .skip_load
; wild
.loop2
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
call BattleRandom
maskbits NUM_MOVES
ld c, a
ld b, 0
add hl, bc
- ld a, [EnemyDisableCount]
+ ld a, [wEnemyDisableCount]
swap a
and $f
dec a
@@ -6044,18 +6044,18 @@ ParseEnemyAction: ; 3e7c1
ld a, [hl]
and a
jr z, .loop2
- ld hl, EnemyMonPP
+ ld hl, wEnemyMonPP
add hl, bc
ld b, a
ld a, [hl]
and PP_MASK
jr z, .loop2
ld a, c
- ld [CurEnemyMoveNum], a
+ ld [wCurEnemyMoveNum], a
ld a, b
.finish
- ld [CurEnemyMove], a
+ ld [wCurEnemyMove], a
.skip_load
call SetEnemyTurn
@@ -6070,13 +6070,13 @@ ParseEnemyAction: ; 3e7c1
cp EFFECT_FURY_CUTTER
jr z, .fury_cutter
xor a
- ld [EnemyFuryCutterCount], a
+ ld [wEnemyFuryCutterCount], a
.fury_cutter
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
cp EFFECT_RAGE
jr z, .no_rage
- ld hl, EnemySubStatus4
+ ld hl, wEnemySubStatus4
res SUBSTATUS_RAGE, [hl]
xor a
ld [wEnemyRageCounter], a
@@ -6088,7 +6088,7 @@ ParseEnemyAction: ; 3e7c1
cp EFFECT_ENDURE
ret z
xor a
- ld [EnemyProtectCount], a
+ ld [wEnemyProtectCount], a
ret
.struggle
@@ -6098,25 +6098,25 @@ ParseEnemyAction: ; 3e7c1
ResetVarsForSubstatusRage: ; 3e8c1
xor a
- ld [EnemyFuryCutterCount], a
- ld [EnemyProtectCount], a
+ ld [wEnemyFuryCutterCount], a
+ ld [wEnemyProtectCount], a
ld [wEnemyRageCounter], a
- ld hl, EnemySubStatus4
+ ld hl, wEnemySubStatus4
res SUBSTATUS_RAGE, [hl]
ret
; 3e8d1
CheckEnemyLockedIn: ; 3e8d1
- ld a, [EnemySubStatus4]
+ ld a, [wEnemySubStatus4]
and 1 << SUBSTATUS_RECHARGE
ret nz
- ld hl, EnemySubStatus3
+ ld hl, wEnemySubStatus3
ld a, [hl]
and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE
ret nz
- ld hl, EnemySubStatus1
+ ld hl, wEnemySubStatus1
bit SUBSTATUS_ROLLOUT, [hl]
ret
; 3e8e4
@@ -6128,15 +6128,15 @@ LinkBattleSendReceiveAction: ; 3e8e4
LoadEnemyMon: ; 3e8eb
; Initialize enemy monster parameters
-; To do this we pull the species from TempEnemyMonSpecies
+; To do this we pull the species from wTempEnemyMonSpecies
; Notes:
; BattleRandom is used to ensure sync between Game Boys
-; Clear the whole EnemyMon struct
+; Clear the whole enemy mon struct (wEnemyMon)
xor a
- ld hl, EnemyMonSpecies
- ld bc, EnemyMonEnd - EnemyMon
+ ld hl, wEnemyMonSpecies
+ ld bc, wEnemyMonEnd - wEnemyMon
call ByteFill
; We don't need to be here if we're in a link battle
@@ -6145,15 +6145,15 @@ LoadEnemyMon: ; 3e8eb
jp nz, InitEnemyMon
; and also not in a BattleTower-Battle
- ld a, [InBattleTowerBattle] ; ????
+ ld a, [wInBattleTowerBattle] ; ????
bit 0, a
jp nz, InitEnemyMon
; Make sure everything knows what species we're working with
- ld a, [TempEnemyMonSpecies]
- ld [EnemyMonSpecies], a
- ld [CurSpecies], a
- ld [CurPartySpecies], a
+ ld a, [wTempEnemyMonSpecies]
+ ld [wEnemyMonSpecies], a
+ ld [wCurSpecies], a
+ ld [wCurPartySpecies], a
; Grab the BaseData for this species
call GetBaseData
@@ -6166,9 +6166,9 @@ LoadEnemyMon: ; 3e8eb
jr z, .WildItem
; If we're in a trainer battle, the item is in the party struct
- ld a, [CurPartyMon]
- ld hl, OTPartyMon1Item
- call GetPartyLocation ; bc = PartyMon[CurPartyMon] - PartyMons
+ ld a, [wCurPartyMon]
+ ld hl, wOTPartyMon1Item
+ call GetPartyLocation ; bc = PartyMon[wCurPartyMon] - wPartyMons
ld a, [hl]
jr .UpdateItem
@@ -6177,9 +6177,9 @@ LoadEnemyMon: ; 3e8eb
; Force Item1
; Used for Ho-Oh, Lugia and Snorlax encounters
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_FORCEITEM
- ld a, [BaseItems]
+ ld a, [wBaseItems]
jr z, .UpdateItem
; Failing that, it's all up to chance
@@ -6197,12 +6197,12 @@ LoadEnemyMon: ; 3e8eb
; From there, an 8% chance for Item2
call BattleRandom
cp 8 percent ; 8% of 25% = 2% Item2
- ld a, [BaseItems]
+ ld a, [wBaseItems]
jr nc, .UpdateItem
- ld a, [BaseItems+1]
+ ld a, [wBaseItems+1]
.UpdateItem:
- ld [EnemyMonItem], a
+ ld [wEnemyMonItem], a
; Initialize DVs
@@ -6211,13 +6211,13 @@ LoadEnemyMon: ; 3e8eb
and a
jr z, .InitDVs
- ld a, [EnemySubStatus5]
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .InitDVs
; Unknown
ld hl, wEnemyBackupDVs
- ld de, EnemyMonDVs
+ ld de, wEnemyMonDVs
ld a, [hli]
ld [de], a
inc de
@@ -6242,7 +6242,7 @@ LoadEnemyMon: ; 3e8eb
; Roaming monsters (Entei, Raikou) work differently
; They have their own structs, which are shorter than normal
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_ROAMING
jr nz, .NotRoaming
@@ -6280,7 +6280,7 @@ LoadEnemyMon: ; 3e8eb
jr .UpdateDVs
.NotRoaming:
-; Register a contains BattleType
+; Register a contains wBattleType
; Forced shiny battle type
; Used by Red Gyarados at Lake of Rage
@@ -6300,7 +6300,7 @@ LoadEnemyMon: ; 3e8eb
.UpdateDVs:
; Input DVs in register bc
- ld hl, EnemyMonDVs
+ ld hl, wEnemyMonDVs
ld a, b
ld [hli], a
ld [hl], c
@@ -6313,12 +6313,12 @@ LoadEnemyMon: ; 3e8eb
; Species-specfic:
; Unown
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
cp UNOWN
jr nz, .Magikarp
; Get letter based on DVs
- ld hl, EnemyMonDVs
+ ld hl, wEnemyMonDVs
predef GetUnownLetter
; Can't use any letters that haven't been unlocked
; If combined with forced shiny battletype, causes an infinite loop
@@ -6334,13 +6334,13 @@ LoadEnemyMon: ; 3e8eb
; by targeting those 1600 mm (= 5'3") or larger.
; After the conversion to feet, it is unable to target any,
; since the largest possible Magikarp is 5'3", and $0503 = 1283 mm.
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
cp MAGIKARP
jr nz, .Happiness
; Get Magikarp's length
- ld de, EnemyMonDVs
- ld bc, PlayerID
+ ld de, wEnemyMonDVs
+ ld bc, wPlayerID
callfar CalcMagikarpLength
; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet)
@@ -6380,10 +6380,10 @@ LoadEnemyMon: ; 3e8eb
; Moreover, due to the check not being translated to feet+inches, all Magikarp
; smaller than 4'0" may be caught by the filter, a lot more than intended.
- ld a, [MapGroup]
+ ld a, [wMapGroup]
cp GROUP_LAKE_OF_RAGE
jr z, .Happiness
- ld a, [MapNumber]
+ ld a, [wMapNumber]
cp MAP_LAKE_OF_RAGE
jr z, .Happiness
; 40% chance of not flooring
@@ -6400,14 +6400,14 @@ LoadEnemyMon: ; 3e8eb
.Happiness:
; Set happiness
ld a, BASE_HAPPINESS
- ld [EnemyMonHappiness], a
+ ld [wEnemyMonHappiness], a
; Set level
- ld a, [CurPartyLevel]
- ld [EnemyMonLevel], a
+ ld a, [wCurPartyLevel]
+ ld [wEnemyMonLevel], a
; Fill stats
- ld de, EnemyMonMaxHP
+ ld de, wEnemyMonMaxHP
ld b, FALSE
- ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ?
+ ld hl, wEnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; wLinkBattleRNs + 7 ; ?
predef CalcPkmnStats
; If we're in a trainer battle,
@@ -6420,7 +6420,7 @@ LoadEnemyMon: ; 3e8eb
and a
jr z, .TreeMon
- ld a, [EnemySubStatus5]
+ ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jp nz, .Moves
@@ -6433,7 +6433,7 @@ LoadEnemyMon: ; 3e8eb
xor a
.UpdateStatus:
- ld hl, EnemyMonStatus
+ ld hl, wEnemyMonStatus
ld [hli], a
; Unused byte
@@ -6441,13 +6441,13 @@ LoadEnemyMon: ; 3e8eb
ld [hli], a
; Full HP..
- ld a, [EnemyMonMaxHP]
+ ld a, [wEnemyMonMaxHP]
ld [hli], a
- ld a, [EnemyMonMaxHP + 1]
+ ld a, [wEnemyMonMaxHP + 1]
ld [hl], a
; ..unless it's a RoamMon
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_ROAMING
jr nz, .Moves
@@ -6459,38 +6459,38 @@ LoadEnemyMon: ; 3e8eb
jr z, .InitRoamHP
; Update from the struct if it has
ld a, [hl]
- ld [EnemyMonHP + 1], a
+ ld [wEnemyMonHP + 1], a
jr .Moves
.InitRoamHP:
; HP only uses the lo byte in the RoamMon struct since
; Raikou/Entei/Suicune will have < 256 hp at level 40
- ld a, [EnemyMonHP + 1]
+ ld a, [wEnemyMonHP + 1]
ld [hl], a
jr .Moves
.OpponentParty:
; Get HP from the party struct
- ld hl, (OTPartyMon1HP + 1)
- ld a, [CurPartyMon]
+ ld hl, (wOTPartyMon1HP + 1)
+ ld a, [wCurPartyMon]
call GetPartyLocation
ld a, [hld]
- ld [EnemyMonHP + 1], a
+ ld [wEnemyMonHP + 1], a
ld a, [hld]
- ld [EnemyMonHP], a
+ ld [wEnemyMonHP], a
; Make sure everything knows which monster the opponent is using
- ld a, [CurPartyMon]
- ld [CurOTMon], a
+ ld a, [wCurPartyMon]
+ ld [wCurOTMon], a
; Get status from the party struct
dec hl
ld a, [hl] ; OTPartyMonStatus
- ld [EnemyMonStatus], a
+ ld [wEnemyMonStatus], a
.Moves:
- ld hl, BaseType1
- ld de, EnemyMonType1
+ ld hl, wBaseType1
+ ld de, wEnemyMonType1
ld a, [hli]
ld [de], a
inc de
@@ -6498,21 +6498,21 @@ LoadEnemyMon: ; 3e8eb
ld [de], a
; Get moves
- ld de, EnemyMonMoves
+ ld de, wEnemyMonMoves
; Are we in a trainer battle?
ld a, [wBattleMode]
cp TRAINER_BATTLE
jr nz, .WildMoves
; Then copy moves from the party struct
- ld hl, OTPartyMon1Moves
- ld a, [CurPartyMon]
+ ld hl, wOTPartyMon1Moves
+ ld a, [wCurPartyMon]
call GetPartyLocation
ld bc, NUM_MOVES
call CopyBytes
jr .PP
.WildMoves:
-; Clear EnemyMonMoves
+; Clear wEnemyMonMoves
xor a
ld h, d
ld l, e
@@ -6532,25 +6532,25 @@ LoadEnemyMon: ; 3e8eb
jr z, .TrainerPP
; Fill wild PP
- ld hl, EnemyMonMoves
- ld de, EnemyMonPP
+ ld hl, wEnemyMonMoves
+ ld de, wEnemyMonPP
predef FillPP
jr .Finish
.TrainerPP:
; Copy PP from the party struct
- ld hl, OTPartyMon1PP
- ld a, [CurPartyMon]
+ ld hl, wOTPartyMon1PP
+ ld a, [wCurPartyMon]
call GetPartyLocation
- ld de, EnemyMonPP
+ ld de, wEnemyMonPP
ld bc, NUM_MOVES
call CopyBytes
.Finish:
; Only the first five base stats are copied..
- ld hl, BaseStats
- ld de, EnemyMonBaseStats
- ld b, BaseSpecialDefense - BaseStats
+ ld hl, wBaseStats
+ ld de, wEnemyMonBaseStats
+ ld b, wBaseSpecialDefense - wBaseStats
.loop
ld a, [hli]
ld [de], a
@@ -6558,14 +6558,14 @@ LoadEnemyMon: ; 3e8eb
dec b
jr nz, .loop
- ld a, [BaseCatchRate]
+ ld a, [wBaseCatchRate]
ld [de], a
inc de
- ld a, [BaseExp]
+ ld a, [wBaseExp]
ld [de], a
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld [wd265], a
call GetPokemonName
@@ -6576,22 +6576,22 @@ LoadEnemyMon: ; 3e8eb
ret z
; Update enemy nick
- ld hl, StringBuffer1
- ld de, EnemyMonNick
+ ld hl, wStringBuffer1
+ ld de, wEnemyMonNick
ld bc, MON_NAME_LENGTH
call CopyBytes
; Saw this mon
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
dec a
ld c, a
ld b, SET_FLAG
- ld hl, PokedexSeen
+ ld hl, wPokedexSeen
predef SmallFarFlagAction
- ld hl, EnemyMonStats
- ld de, EnemyStats
- ld bc, EnemyMonStatsEnd - EnemyMonStats
+ ld hl, wEnemyMonStats
+ ld de, wEnemyStats
+ ld bc, wEnemyMonStatsEnd - wEnemyMonStats
call CopyBytes
ret
@@ -6602,13 +6602,13 @@ CheckSleepingTreeMon: ; 3eb38
; for the current time of day
; Don't do anything if this isn't a tree encounter
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_TREE
jr nz, .NotSleeping
; Get list for the time of day
ld hl, AsleepTreeMonsMorn
- ld a, [TimeOfDay]
+ ld a, [wTimeOfDay]
cp DAY_F
jr c, .Check
ld hl, AsleepTreeMonsDay
@@ -6616,7 +6616,7 @@ CheckSleepingTreeMon: ; 3eb38
ld hl, AsleepTreeMonsNite
.Check:
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld de, 1 ; length of species id
call IsInArray
; If it's a match, the opponent is asleep
@@ -6649,7 +6649,7 @@ CheckUnownLetter: ; 3eb75
ld l, a
push de
- ld a, [UnownLetter]
+ ld a, [wUnownLetter]
ld de, 1
push bc
call IsInArray
@@ -6698,22 +6698,22 @@ CheckUnownLetter: ; 3eb75
Unreferenced_SwapBattlerLevels: ; 3ebc7
push bc
- ld a, [BattleMonLevel]
+ ld a, [wBattleMonLevel]
ld b, a
- ld a, [EnemyMonLevel]
- ld [BattleMonLevel], a
+ ld a, [wEnemyMonLevel]
+ ld [wBattleMonLevel], a
ld a, b
- ld [EnemyMonLevel], a
+ ld [wEnemyMonLevel], a
pop bc
ret
; 3ebd8
BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
xor a
- ld [TempEnemyMonSpecies], a
+ ld [wTempEnemyMonSpecies], a
call FinishBattleAnim
- ld a, [OtherTrainerClass]
- ld [TrainerClass], a
+ ld a, [wOtherTrainerClass]
+ ld [wTrainerClass], a
ld de, vTiles2
callfar GetTrainerPic
hlcoord 19, 0
@@ -6789,10 +6789,10 @@ ApplyPrzEffectOnSpeed: ; 3ec39
ld a, [hBattleTurn]
and a
jr z, .enemy
- ld a, [BattleMonStatus]
+ ld a, [wBattleMonStatus]
and 1 << PAR
ret z
- ld hl, BattleMonSpeed + 1
+ ld hl, wBattleMonSpeed + 1
ld a, [hld]
ld b, a
ld a, [hl]
@@ -6810,10 +6810,10 @@ ApplyPrzEffectOnSpeed: ; 3ec39
ret
.enemy
- ld a, [EnemyMonStatus]
+ ld a, [wEnemyMonStatus]
and 1 << PAR
ret z
- ld hl, EnemyMonSpeed + 1
+ ld hl, wEnemyMonSpeed + 1
ld a, [hld]
ld b, a
ld a, [hl]
@@ -6835,10 +6835,10 @@ ApplyBrnEffectOnAttack: ; 3ec76
ld a, [hBattleTurn]
and a
jr z, .enemy
- ld a, [BattleMonStatus]
+ ld a, [wBattleMonStatus]
and 1 << BRN
ret z
- ld hl, BattleMonAttack + 1
+ ld hl, wBattleMonAttack + 1
ld a, [hld]
ld b, a
ld a, [hl]
@@ -6854,10 +6854,10 @@ ApplyBrnEffectOnAttack: ; 3ec76
ret
.enemy
- ld a, [EnemyMonStatus]
+ ld a, [wEnemyMonStatus]
and 1 << BRN
ret z
- ld hl, EnemyMonAttack + 1
+ ld hl, wEnemyMonAttack + 1
ld a, [hld]
ld b, a
ld a, [hl]
@@ -6891,13 +6891,13 @@ ApplyStatLevelMultiplier: ; 3ecb7
ld a, [wd265]
and a
ld a, c
- ld hl, BattleMonAttack
- ld de, PlayerStats
- ld bc, PlayerAtkLevel
+ ld hl, wBattleMonAttack
+ ld de, wPlayerStats
+ ld bc, wPlayerAtkLevel
jr z, .got_pointers
- ld hl, EnemyMonAttack
- ld de, EnemyStats
- ld bc, EnemyAtkLevel
+ ld hl, wEnemyMonAttack
+ ld de, wEnemyStats
+ ld bc, wEnemyAtkLevel
.got_pointers
add c
@@ -6989,7 +6989,8 @@ ApplyStatLevelMultiplier: ; 3ecb7
; 3ed45
BadgeStatBoosts: ; 3ed45
-; Raise BattleMon stats depending on which badges have been obtained.
+; Raise the stats of the battle mon in wBattleMon
+; depending on which badges have been obtained.
; Every other badge boosts a stat, starting from the first.
@@ -7005,7 +7006,7 @@ BadgeStatBoosts: ; 3ed45
and a
ret nz
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
and a
ret nz
@@ -7028,7 +7029,7 @@ BadgeStatBoosts: ; 3ed45
or c
ld b, a
- ld hl, BattleMonAttack
+ ld hl, wBattleMonAttack
ld c, 4
.CheckBadge:
ld a, b
@@ -7124,13 +7125,13 @@ _BattleRandom:: ; 3edd8
; Which value are we trying to pull?
push hl
push bc
- ld a, [LinkBattleRNCount]
+ ld a, [wLinkBattleRNCount]
ld c, a
ld b, 0
- ld hl, LinkBattleRNs
+ ld hl, wLinkBattleRNs
add hl, bc
inc a
- ld [LinkBattleRNCount], a
+ ld [wLinkBattleRNCount], a
; If we haven't hit the end yet, we're good
cp 10 - 1 ; Exclude last value. See the closing comment
@@ -7147,8 +7148,8 @@ _BattleRandom:: ; 3edd8
; Reset count to 0
xor a
- ld [LinkBattleRNCount], a
- ld hl, LinkBattleRNs
+ ld [wLinkBattleRNCount], a
+ ld hl, wLinkBattleRNs
ld b, 10 ; number of seeds
; Generate next number in the sequence for each seed
@@ -7188,9 +7189,9 @@ Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
Call_PlayBattleAnim: ; 3ee17
ld a, e
- ld [FXAnimID], a
+ ld [wFXAnimID], a
ld a, d
- ld [FXAnimID + 1], a
+ ld [wFXAnimID + 1], a
call WaitBGMap
predef_jump PlayBattleAnim
; 3ee27
@@ -7218,14 +7219,14 @@ GiveExperiencePoints: ; 3ee3b
and a
ret nz
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
bit 0, a
ret nz
call .EvenlyDivideExpAmongParticipants
xor a
- ld [CurPartyMon], a
- ld bc, PartyMon1Species
+ ld [wCurPartyMon], a
+ ld bc, wPartyMon1Species
.loop
ld hl, MON_HP
@@ -7236,7 +7237,7 @@ GiveExperiencePoints: ; 3ee3b
push bc
ld hl, wBattleParticipantsNotFainted
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
ld c, a
ld b, CHECK_FLAG
ld d, $0
@@ -7251,7 +7252,7 @@ GiveExperiencePoints: ; 3ee3b
add hl, bc
ld d, h
ld e, l
- ld hl, EnemyMonBaseStats - 1
+ ld hl, wEnemyMonBaseStats - 1
push bc
ld c, $5
.loop1
@@ -7303,9 +7304,9 @@ GiveExperiencePoints: ; 3ee3b
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
- ld a, [EnemyMonBaseExp]
+ ld a, [wEnemyMonBaseExp]
ld [hMultiplicand + 2], a
- ld a, [EnemyMonLevel]
+ ld a, [wEnemyMonLevel]
ld [hMultiplier], a
call Multiply
ld a, 7
@@ -7316,11 +7317,11 @@ GiveExperiencePoints: ; 3ee3b
pop bc
ld hl, MON_ID
add hl, bc
- ld a, [PlayerID]
+ ld a, [wPlayerID]
cp [hl]
jr nz, .boosted
inc hl
- ld a, [PlayerID + 1]
+ ld a, [wPlayerID + 1]
cp [hl]
ld a, $0
jr z, .no_boost
@@ -7331,7 +7332,7 @@ GiveExperiencePoints: ; 3ee3b
.no_boost
; Boost experience for a Trainer Battle
- ld [StringBuffer2 + 2], a
+ ld [wStringBuffer2 + 2], a
ld a, [wBattleMode]
dec a
call nz, BoostExp
@@ -7343,17 +7344,17 @@ GiveExperiencePoints: ; 3ee3b
cp LUCKY_EGG
call z, BoostExp
ld a, [hQuotient + 2]
- ld [StringBuffer2 + 1], a
+ ld [wStringBuffer2 + 1], a
ld a, [hQuotient + 1]
- ld [StringBuffer2], a
- ld a, [CurPartyMon]
- ld hl, PartyMonNicknames
+ ld [wStringBuffer2], a
+ ld a, [wCurPartyMon]
+ ld hl, wPartyMonNicknames
call GetNick
ld hl, Text_PkmnGainedExpPoint
call BattleTextBox
- ld a, [StringBuffer2 + 1]
+ ld a, [wStringBuffer2 + 1]
ld [hQuotient + 2], a
- ld a, [StringBuffer2]
+ ld a, [wStringBuffer2]
ld [hQuotient + 1], a
pop bc
call AnimateExpBar
@@ -7380,13 +7381,13 @@ GiveExperiencePoints: ; 3ee3b
ld [hl], a
.skip2
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
ld e, a
ld d, $0
- ld hl, PartySpecies
+ ld hl, wPartySpecies
add hl, de
ld a, [hl]
- ld [CurSpecies], a
+ ld [wCurSpecies], a
call GetBaseData
push bc
ld d, MAX_LEVEL
@@ -7417,7 +7418,7 @@ GiveExperiencePoints: ; 3ee3b
.not_max_exp
xor a ; PARTYMON
- ld [MonType], a
+ ld [wMonType], a
predef CopyPkmnToTempMon
callfar CalcLevel
pop bc
@@ -7430,15 +7431,15 @@ GiveExperiencePoints: ; 3ee3b
jp z, .skip_stats
; <NICKNAME> grew to level ##!
ld [wTempLevel], a
- ld a, [CurPartyLevel]
+ ld a, [wCurPartyLevel]
push af
ld a, d
- ld [CurPartyLevel], a
+ ld [wCurPartyLevel], a
ld [hl], a
ld hl, MON_SPECIES
add hl, bc
ld a, [hl]
- ld [CurSpecies], a
+ ld [wCurSpecies], a
ld [wd265], a
call GetBaseData
ld hl, MON_MAXHP + 1
@@ -7473,18 +7474,18 @@ GiveExperiencePoints: ; 3ee3b
ld a, [hl]
adc d
ld [hl], a
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
ld d, a
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
cp d
jr nz, .skip_animation
- ld de, BattleMonHP
+ ld de, wBattleMonHP
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
- ld de, BattleMonMaxHP
+ ld de, wBattleMonMaxHP
push bc
ld bc, PARTYMON_STRUCT_LENGTH - MON_MAXHP
call CopyBytes
@@ -7492,13 +7493,13 @@ GiveExperiencePoints: ; 3ee3b
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
- ld [BattleMonLevel], a
- ld a, [PlayerSubStatus5]
+ ld [wBattleMonLevel], a
+ ld a, [wPlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr nz, .transformed
ld hl, MON_ATK
add hl, bc
- ld de, PlayerStats
+ ld de, wPlayerStats
ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
call CopyBytes
@@ -7516,9 +7517,9 @@ GiveExperiencePoints: ; 3ee3b
.skip_animation
farcall LevelUpHappinessMod
- ld a, [CurBattleMon]
+ ld a, [wCurBattleMon]
ld b, a
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
cp b
jr z, .skip_animation2
ld de, SFX_HIT_END_OF_EXP_BAR
@@ -7530,7 +7531,7 @@ GiveExperiencePoints: ; 3ee3b
.skip_animation2
xor a ; PARTYMON
- ld [MonType], a
+ ld [wMonType], a
predef CopyPkmnToTempMon
hlcoord 9, 0
ld b, $a
@@ -7544,10 +7545,10 @@ GiveExperiencePoints: ; 3ee3b
call WaitPressAorB_BlinkCursor
call Call_LoadTempTileMapToTileMap
xor a ; PARTYMON
- ld [MonType], a
- ld a, [CurSpecies]
+ ld [wMonType], a
+ ld a, [wCurSpecies]
ld [wd265], a
- ld a, [CurPartyLevel]
+ ld a, [wCurPartyLevel]
push af
ld c, a
ld a, [wTempLevel]
@@ -7556,7 +7557,7 @@ GiveExperiencePoints: ; 3ee3b
.level_loop
inc b
ld a, b
- ld [CurPartyLevel], a
+ ld [wCurPartyLevel], a
push bc
predef LearnLevelMoves
pop bc
@@ -7564,23 +7565,23 @@ GiveExperiencePoints: ; 3ee3b
cp c
jr nz, .level_loop
pop af
- ld [CurPartyLevel], a
- ld hl, EvolvableFlags
- ld a, [CurPartyMon]
+ ld [wCurPartyLevel], a
+ ld hl, wEvolvableFlags
+ ld a, [wCurPartyMon]
ld c, a
ld b, SET_FLAG
predef SmallFarFlagAction
pop af
- ld [CurPartyLevel], a
+ ld [wCurPartyLevel], a
.skip_stats
- ld a, [PartyCount]
+ ld a, [wPartyCount]
ld b, a
- ld a, [CurPartyMon]
+ ld a, [wCurPartyMon]
inc a
cp b
jr z, .done
- ld [CurPartyMon], a
+ ld [wCurPartyMon], a
ld a, MON_SPECIES
call GetPartyParamLocation
ld b, h
@@ -7608,8 +7609,8 @@ GiveExperiencePoints: ; 3ee3b
ret c
ld [wd265], a
- ld hl, EnemyMonBaseStats
- ld c, EnemyMonEnd - EnemyMonBaseStats
+ ld hl, wEnemyMonBaseStats
+ ld c, wEnemyMonEnd - wEnemyMonBaseStats
.count_loop2
xor a
ld [hDividend + 0], a
@@ -7651,7 +7652,7 @@ Text_PkmnGainedExpPoint: ; 3f11b
text_jump Text_Gained
start_asm
ld hl, TextJump_StringBuffer2ExpPoints
- ld a, [StringBuffer2 + 2] ; IsTradedMon
+ ld a, [wStringBuffer2 + 2] ; IsTradedMon
and a
ret z
@@ -7672,12 +7673,12 @@ TextJump_StringBuffer2ExpPoints: ; 3f131
AnimateExpBar: ; 3f136
push bc
- ld hl, CurPartyMon
- ld a, [CurBattleMon]
+ ld hl, wCurPartyMon
+ ld a, [wCurBattleMon]
cp [hl]
jp nz, .finish
- ld a, [BattleMonLevel]
+ ld a, [wBattleMonLevel]
cp MAX_LEVEL
jp nc, .finish
@@ -7690,16 +7691,16 @@ AnimateExpBar: ; 3f136
xor a
ld [wd002], a
xor a ; PARTYMON
- ld [MonType], a
+ ld [wMonType], a
predef CopyPkmnToTempMon
- ld a, [TempMonLevel]
+ ld a, [wTempMonLevel]
ld b, a
ld e, a
push de
- ld de, TempMonExp + 2
+ ld de, wTempMonExp + 2
call CalcExpBar
push bc
- ld hl, TempMonExp + 2
+ ld hl, wTempMonExp + 2
ld a, [wd004]
add [hl]
ld [hld], a
@@ -7723,7 +7724,7 @@ AnimateExpBar: ; 3f136
ld c, a
ld a, [hProduct + 3]
ld d, a
- ld hl, TempMonExp + 2
+ ld hl, wTempMonExp + 2
ld a, [hld]
sub d
ld a, [hld]
@@ -7756,16 +7757,16 @@ AnimateExpBar: ; 3f136
cp d
jr z, .FinishExpBar
inc a
- ld [TempMonLevel], a
- ld [CurPartyLevel], a
- ld [BattleMonLevel], a
+ ld [wTempMonLevel], a
+ ld [wCurPartyLevel], a
+ ld [wBattleMonLevel], a
push de
call .PlayExpBarSound
ld c, $40
call .LoopBarAnimation
call PrintPlayerHUD
- ld hl, BattleMonNick
- ld de, StringBuffer1
+ ld hl, wBattleMonNick
+ ld de, wStringBuffer1
ld bc, MON_NAME_LENGTH
call CopyBytes
call TerminateExpBarSound
@@ -7783,7 +7784,7 @@ AnimateExpBar: ; 3f136
.FinishExpBar:
push bc
ld b, d
- ld de, TempMonExp + 2
+ ld de, wTempMonExp + 2
call CalcExpBar
ld a, b
pop bc
@@ -7868,7 +7869,7 @@ SendOutPkmnText: ; 3f26d
.not_linked
; Depending on the HP of the enemy Pkmn, the game prints a different text
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
or [hl]
ld hl, JumpText_GoPkmn
@@ -7877,7 +7878,7 @@ SendOutPkmnText: ; 3f26d
; compute enemy helth remaining as a percentage
xor a
ld [hMultiplicand + 0], a
- ld hl, EnemyMonHP
+ ld hl, wEnemyMonHP
ld a, [hli]
ld [wEnemyHPAtTimeOfPlayerSwitch], a
ld [hMultiplicand + 1], a
@@ -7887,7 +7888,7 @@ SendOutPkmnText: ; 3f26d
ld a, 25
ld [hMultiplier], a
call Multiply
- ld hl, EnemyMonMaxHP
+ ld hl, wEnemyMonMaxHP
ld a, [hli]
ld b, [hl]
srl a
@@ -7959,7 +7960,7 @@ WithdrawPkmnText: ; 3f2f4
; depending on HP the message is different
push de
push bc
- ld hl, EnemyMonHP + 1
+ ld hl, wEnemyMonHP + 1
ld de, wEnemyHPAtTimeOfPlayerSwitch + 1
ld b, [hl]
dec hl
@@ -7974,7 +7975,7 @@ WithdrawPkmnText: ; 3f2f4
ld a, 25
ld [hMultiplier], a
call Multiply
- ld hl, EnemyMonMaxHP
+ ld hl, wEnemyMonMaxHP
ld a, [hli]
ld b, [hl]
srl a
@@ -8048,11 +8049,11 @@ Unreferenced_HandleSafariAngerEatingStatus:
ld hl, BattleText_WildPkmnIsAngry
jr nz, .finish
push hl
- ld a, [EnemyMonSpecies]
- ld [CurSpecies], a
+ ld a, [wEnemyMonSpecies]
+ ld [wCurSpecies], a
call GetBaseData
- ld a, [BaseCatchRate]
- ld [EnemyMonCatchRate], a
+ ld a, [wBaseCatchRate]
+ ld [wEnemyMonCatchRate], a
pop hl
.finish
@@ -8205,7 +8206,7 @@ PlaceExpBar: ; 3f41c
; 3f43d
GetBattleMonBackpic: ; 3f43d
- ld a, [PlayerSubStatus4]
+ ld a, [wPlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
jr nz, GetBattleMonBackpic_DoAnim ; substitute
@@ -8215,16 +8216,16 @@ DropPlayerSub: ; 3f447
and a
ld hl, BattleAnimCmd_MinimizeOpp
jr nz, GetBattleMonBackpic_DoAnim
- ld a, [CurPartySpecies]
+ ld a, [wCurPartySpecies]
push af
- ld a, [BattleMonSpecies]
- ld [CurPartySpecies], a
- ld hl, BattleMonDVs
+ ld a, [wBattleMonSpecies]
+ ld [wCurPartySpecies], a
+ ld hl, wBattleMonDVs
predef GetUnownLetter
ld de, vTiles2 tile $31
predef GetMonBackpic
pop af
- ld [CurPartySpecies], a
+ ld [wCurPartySpecies], a
ret
; 3f46f
@@ -8241,7 +8242,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f
; 3f47c
GetEnemyMonFrontpic: ; 3f47c
- ld a, [EnemySubStatus4]
+ ld a, [wEnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
jr nz, GetEnemyMonFrontpic_DoAnim
@@ -8252,18 +8253,18 @@ DropEnemySub: ; 3f486
ld hl, BattleAnimCmd_MinimizeOpp
jr nz, GetEnemyMonFrontpic_DoAnim
- ld a, [CurPartySpecies]
+ ld a, [wCurPartySpecies]
push af
- ld a, [EnemyMonSpecies]
- ld [CurSpecies], a
- ld [CurPartySpecies], a
+ ld a, [wEnemyMonSpecies]
+ ld [wCurSpecies], a
+ ld [wCurPartySpecies], a
call GetBaseData
- ld hl, EnemyMonDVs
+ ld hl, wEnemyMonDVs
predef GetUnownLetter
ld de, vTiles2
predef GetAnimatedFrontpic
pop af
- ld [CurPartySpecies], a
+ ld [wCurPartySpecies], a
ret
; 3f4b4
@@ -8282,17 +8283,17 @@ StartBattle: ; 3f4c1
; This check prevents you from entering a battle without any Pokemon.
; Those using walk-through-walls to bypass getting a Pokemon experience
; the effects of this check.
- ld a, [PartyCount]
+ ld a, [wPartyCount]
and a
ret z
- ld a, [TimeOfDayPal]
+ ld a, [wTimeOfDayPal]
push af
call BattleIntro
call DoBattle
call ExitBattle
pop af
- ld [TimeOfDayPal], a
+ ld [wTimeOfDayPal], a
scf
ret
; 3f4d9
@@ -8306,7 +8307,7 @@ BattleIntro: ; 3f4dd
farcall StubbedTrainerRankings_Battles ; mobile
call LoadTrainerOrWildMonPic
xor a
- ld [TempBattleMonSpecies], a
+ ld [wTempBattleMonSpecies], a
ld [wBattleMenuCursorBuffer], a
xor a
ld [hMapAnims], a
@@ -8344,19 +8345,19 @@ BattleIntro: ; 3f4dd
; 3f54e
LoadTrainerOrWildMonPic: ; 3f54e
- ld a, [OtherTrainerClass]
+ ld a, [wOtherTrainerClass]
and a
jr nz, .Trainer
- ld a, [TempWildMonSpecies]
- ld [CurPartySpecies], a
+ ld a, [wTempWildMonSpecies]
+ ld [wCurPartySpecies], a
.Trainer:
- ld [TempEnemyMonSpecies], a
+ ld [wTempEnemyMonSpecies], a
ret
; 3f55e
InitEnemy: ; 3f55e
- ld a, [OtherTrainerClass]
+ ld a, [wOtherTrainerClass]
and a
jp nz, InitEnemyTrainer ; trainer
jp InitEnemyWildmon ; wild
@@ -8387,19 +8388,19 @@ BackUpBGMap2: ; 3f568
; 3f594
InitEnemyTrainer: ; 3f594
- ld [TrainerClass], a
+ ld [wTrainerClass], a
farcall StubbedTrainerRankings_TrainerBattles
xor a
- ld [TempEnemyMonSpecies], a
+ ld [wTempEnemyMonSpecies], a
callfar GetTrainerAttributes
callfar ReadTrainerParty
; RIVAL1's first mon has no held item
- ld a, [TrainerClass]
+ ld a, [wTrainerClass]
cp RIVAL1
jr nz, .ok
xor a
- ld [OTPartyMon1Item], a
+ ld [wOTPartyMon1Item], a
.ok
ld de, vTiles2
@@ -8412,15 +8413,15 @@ InitEnemyTrainer: ; 3f594
lb bc, 7, 7
predef PlaceGraphic
ld a, -1
- ld [CurOTMon], a
+ ld [wCurOTMon], a
ld a, TRAINER_BATTLE
ld [wBattleMode], a
call IsGymLeader
jr nc, .done
xor a
- ld [CurPartyMon], a
- ld a, [PartyCount]
+ ld [wCurPartyMon], a
+ ld a, [wPartyCount]
ld b, a
.partyloop
push bc
@@ -8435,7 +8436,7 @@ InitEnemyTrainer: ; 3f594
pop bc
dec b
jr z, .done
- ld hl, CurPartyMon
+ ld hl, wCurPartyMon
inc [hl]
jr .partyloop
.done
@@ -8447,29 +8448,29 @@ InitEnemyWildmon: ; 3f607
ld [wBattleMode], a
farcall StubbedTrainerRankings_WildBattles
call LoadEnemyMon
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
ld de, wWildMonMoves
ld bc, NUM_MOVES
call CopyBytes
- ld hl, EnemyMonPP
+ ld hl, wEnemyMonPP
ld de, wWildMonPP
ld bc, NUM_MOVES
call CopyBytes
- ld hl, EnemyMonDVs
+ ld hl, wEnemyMonDVs
predef GetUnownLetter
- ld a, [CurPartySpecies]
+ ld a, [wCurPartySpecies]
cp UNOWN
jr nz, .skip_unown
ld a, [wFirstUnownSeen]
and a
jr nz, .skip_unown
- ld a, [UnownLetter]
+ ld a, [wUnownLetter]
ld [wFirstUnownSeen], a
.skip_unown
ld de, vTiles2
predef GetAnimatedFrontpic
xor a
- ld [TrainerClass], a
+ ld [wTrainerClass], a
ld [hGraphicStartTile], a
hlcoord 12, 0
lb bc, 7, 7
@@ -8478,7 +8479,7 @@ InitEnemyWildmon: ; 3f607
; 3f662
Unreferenced_Function3f662: ; 3f662
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
ld de, wListMoves_MoveIndicesBuffer
ld b, NUM_MOVES
.loop
@@ -8500,7 +8501,7 @@ Unreferenced_Function3f662: ; 3f662
call GetFarByte
pop hl
- ld bc, EnemyMonPP - (EnemyMonMoves + 1)
+ ld bc, wEnemyMonPP - (wEnemyMonMoves + 1)
add hl, bc
ld [hl], a
@@ -8518,7 +8519,7 @@ Unreferenced_Function3f662: ; 3f662
.clearpp
push bc
push hl
- ld bc, EnemyMonPP - (EnemyMonMoves + 1)
+ ld bc, wEnemyMonPP - (wEnemyMonMoves + 1)
add hl, bc
xor a
ld [hl], a
@@ -8560,12 +8561,12 @@ ExitBattle: ; 3f69e
CleanUpBattleRAM: ; 3f6d0
call BattleEnd_HandleRoamMons
xor a
- ld [Danger], a
+ ld [wLowHealthAlarm], a
ld [wBattleMode], a
- ld [BattleType], a
- ld [AttackMissed], a
- ld [TempWildMonSpecies], a
- ld [OtherTrainerClass], a
+ ld [wBattleType], a
+ ld [wAttackMissed], a
+ ld [wTempWildMonSpecies], a
+ ld [wOtherTrainerClass], a
ld [wFailedToFlee], a
ld [wNumFleeAttempts], a
ld [wForcedSwitch], a
@@ -8573,15 +8574,15 @@ CleanUpBattleRAM: ; 3f6d0
ld [wKeyItemsPocketCursor], a
ld [wItemsPocketCursor], a
ld [wBattleMenuCursorBuffer], a
- ld [CurMoveNum], a
+ ld [wCurMoveNum], a
ld [wBallsPocketCursor], a
ld [wLastPocket], a
ld [wMenuScrollPosition], a
ld [wKeyItemsPocketScrollPosition], a
ld [wItemsPocketScrollPosition], a
ld [wBallsPocketScrollPosition], a
- ld hl, PlayerSubStatus1
- ld b, EnemyFuryCutterCount - PlayerSubStatus1
+ ld hl, wPlayerSubStatus1
+ ld b, wEnemyFuryCutterCount - wPlayerSubStatus1
.loop
ld [hli], a
dec b
@@ -8614,11 +8615,11 @@ CheckPayDay: ; 3f71d
.okay
ld hl, wPayDayMoney + 2
- ld de, Money + 2
+ ld de, wMoney + 2
call AddBattleMoneyToAccount
ld hl, BattleText_PlayerPickedUpPayDayMoney
call StdBattleTextBox
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
bit 0, a
ret z
call ClearTileMap
@@ -8629,10 +8630,10 @@ CheckPayDay: ; 3f71d
ShowLinkBattleParticipantsAfterEnd: ; 3f759
farcall StubbedTrainerRankings_LinkBattles
farcall BackupMobileEventIndex
- ld a, [CurOTMon]
- ld hl, OTPartyMon1Status
+ ld a, [wCurOTMon]
+ ld hl, wOTPartyMon1Status
call GetPartyLocation
- ld a, [EnemyMonStatus]
+ ld a, [wEnemyMonStatus]
ld [hl], a
call ClearTileMap
farcall _ShowLinkBattleParticipants
@@ -8734,7 +8735,7 @@ DisplayLinkRecord: ; 3f836
call ReadAndPrintLinkBattleRecord
call CloseSRAM
- hlcoord 0, 0, AttrMap
+ hlcoord 0, 0, wAttrMap
xor a
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call ByteFill
@@ -8883,14 +8884,14 @@ ReadAndPrintLinkBattleRecord: ; 3f85f
; 3f998
BattleEnd_HandleRoamMons: ; 3f998
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_ROAMING
jr nz, .not_roaming
ld a, [wBattleResult]
and $f
jr z, .caught_or_defeated_roam_mon
call GetRoamMonHP
- ld a, [EnemyMonHP + 1]
+ ld a, [wEnemyMonHP + 1]
ld [hl], a
jr .update_roam_mons
@@ -8916,7 +8917,7 @@ BattleEnd_HandleRoamMons: ; 3f998
; 3f9d1
GetRoamMonMapGroup: ; 3f9d1
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
cp b
@@ -8931,7 +8932,7 @@ GetRoamMonMapGroup: ; 3f9d1
; 3f9e9
GetRoamMonMapNumber: ; 3f9e9
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
cp b
@@ -8947,7 +8948,7 @@ GetRoamMonMapNumber: ; 3f9e9
GetRoamMonHP: ; 3fa01
; output: hl = wRoamMonHP
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
cp b
@@ -8963,7 +8964,7 @@ GetRoamMonHP: ; 3fa01
GetRoamMonDVs: ; 3fa19
; output: hl = wRoamMonDVs
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
cp b
@@ -8978,7 +8979,7 @@ GetRoamMonDVs: ; 3fa19
; 3fa31
GetRoamMonSpecies: ; 3fa31
- ld a, [TempEnemyMonSpecies]
+ ld a, [wTempEnemyMonSpecies]
ld hl, wRoamMon1Species
cp [hl]
ret z
@@ -8990,11 +8991,11 @@ GetRoamMonSpecies: ; 3fa31
; 3fa42
AddLastMobileBattleToLinkRecord: ; 3fa42
- ld hl, OTPlayerID
- ld de, StringBuffer1
+ ld hl, wOTPlayerID
+ ld de, wStringBuffer1
ld bc, 2
call CopyBytes
- ld hl, OTPlayerName
+ ld hl, wOTPlayerName
ld bc, NAME_LENGTH - 1
call CopyBytes
ld hl, sLinkBattleResults
@@ -9012,7 +9013,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
jr z, .copy
push de
ld bc, 12
- ld de, StringBuffer1
+ ld de, wStringBuffer1
call CompareLong
pop de
pop hl
@@ -9028,7 +9029,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
.copy
ld d, h
ld e, l
- ld hl, StringBuffer1
+ ld hl, wStringBuffer1
ld bc, 12
call CopyBytes
ld b, 6
@@ -9275,7 +9276,7 @@ GetTrainerBackpic: ; 3fbff
; Special exception for Dude.
ld b, BANK(DudeBackpic)
ld hl, DudeBackpic
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .Decompress
@@ -9326,7 +9327,7 @@ CopyBackpic: ; 3fc30
; 3fc5b
.LoadTrainerBackpicAsOAM: ; 3fc5b
- ld hl, Sprite01
+ ld hl, wVirtualOAMSprite00
xor a
ld [hMapObjectIndexBuffer], a
ld b, 6
@@ -9406,12 +9407,12 @@ BattleStartMessage: ; 3fc8b
.cry_no_anim
ld a, $0f
- ld [CryTracks], a
- ld a, [TempEnemyMonSpecies]
+ ld [wCryTracks], a
+ ld a, [wTempEnemyMonSpecies]
call PlayStereoCry
.skip_cry
- ld a, [BattleType]
+ ld a, [wBattleType]
cp BATTLETYPE_FISH
jr nz, .NotFishing