diff options
Diffstat (limited to 'engine/battle/core.asm')
-rw-r--r-- | engine/battle/core.asm | 438 |
1 files changed, 219 insertions, 219 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 2d5e85cef..32de2d307 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -26,7 +26,7 @@ DoBattle: and a jr z, .not_linked - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .player_2 @@ -97,7 +97,7 @@ DoBattle: ld a, [wLinkMode] and a jr z, .not_linked_2 - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr nz, .not_linked_2 xor a @@ -247,7 +247,7 @@ Stubbed_Function3c1bf: ret HandleBetweenTurnEffects: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy @@ -343,7 +343,7 @@ CheckFaint_EnemyThenPlayer: ret HandleBerserkGene: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .reverse @@ -449,7 +449,7 @@ DetermineMoveOrder: ld a, [wBattlePlayerAction] cp BATTLEPLAYERACTION_SWITCH jr nz, .switch - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .player_2 @@ -506,7 +506,7 @@ DetermineMoveOrder: jp .enemy_first .both_have_quick_claw - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .player_2b call BattleRandom @@ -536,7 +536,7 @@ DetermineMoveOrder: jp .enemy_first .speed_tie - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK jr z, .player_2c call BattleRandom @@ -633,7 +633,7 @@ ParsePlayerAction: .struggle ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a pop af ret nz @@ -695,7 +695,7 @@ ParsePlayerAction: ret HandleEncore: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 call .do_player @@ -982,7 +982,7 @@ EndUserDestinyBond: ret HasUserFainted: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, HasPlayerFainted HasEnemyFainted: @@ -1027,7 +1027,7 @@ ResidualDamage: call Call_PlayBattleAnim_OnlyIfVisible call GetEighthMaxHP ld de, wPlayerToxicCount - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .check_toxic ld de, wEnemyToxicCount @@ -1074,7 +1074,7 @@ ResidualDamage: call GetEighthMaxHP call SubtractHPFromUser ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a call RestoreHP ld hl, LeechSeedSapsText call StdBattleTextBox @@ -1116,7 +1116,7 @@ ResidualDamage: .not_cursed ld hl, wBattleMonHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .check_fainted ld hl, wEnemyMonHP @@ -1134,7 +1134,7 @@ ResidualDamage: ret HandlePerishSong: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn @@ -1149,7 +1149,7 @@ HandlePerishSong: .do_it ld hl, wPlayerPerishCount - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .got_count ld hl, wEnemyPerishCount @@ -1170,7 +1170,7 @@ HandlePerishSong: ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarAddr res SUBSTATUS_PERISH, [hl] - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr nz, .kill_enemy ld hl, wBattleMonHP @@ -1202,7 +1202,7 @@ HandlePerishSong: ret HandleWrap: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn @@ -1218,7 +1218,7 @@ HandleWrap: .do_it ld hl, wPlayerWrapCount ld de, wPlayerTrappingMove - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .got_addrs ld hl, wEnemyWrapCount @@ -1266,13 +1266,13 @@ HandleWrap: jp StdBattleTextBox SwitchTurnCore: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] xor 1 - ld [hBattleTurn], a + ldh [hBattleTurn], a ret HandleLeftovers: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn @@ -1295,7 +1295,7 @@ HandleLeftovers: ret nz ld hl, wBattleMonHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .got_hp ld hl, wEnemyMonHP @@ -1321,7 +1321,7 @@ HandleLeftovers: jp StdBattleTextBox HandleMysteryberry: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn @@ -1347,7 +1347,7 @@ HandleMysteryberry: ld hl, wPartyMon1Moves ld a, [wCurBattleMon] call GetPartyLocation - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .wild ld de, wWildMonPP @@ -1400,7 +1400,7 @@ HandleMysteryberry: ld [wTempByteValue], a ld de, wBattleMonMoves - 1 ld hl, wBattleMonPP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .player_pp ld de, wEnemyMonMoves - 1 @@ -1420,7 +1420,7 @@ HandleMysteryberry: ld a, [wTempByteValue] cp [hl] jr nz, .skip_checks - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a ld a, [wPlayerSubStatus5] jr z, .check_transform @@ -1438,7 +1438,7 @@ HandleMysteryberry: xor a ld [hl], a call GetPartymonItem - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .consume_item ld a, [wBattleMode] @@ -1459,7 +1459,7 @@ HandleMysteryberry: jp StdBattleTextBox HandleFutureSight: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .enemy_first call SetPlayerTurn @@ -1474,7 +1474,7 @@ HandleFutureSight: .do_it ld hl, wPlayerFutureSightCount - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .okay ld hl, wEnemyFutureSightCount @@ -1517,7 +1517,7 @@ HandleFutureSight: jp UpdateEnemyMonInParty HandleDefrost: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .enemy_first call .do_player_turn @@ -1576,7 +1576,7 @@ HandleDefrost: jp StdBattleTextBox HandleSafeguard: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player1 call .CheckPlayer @@ -1608,12 +1608,12 @@ HandleSafeguard: ld a, $1 .print - ld [hBattleTurn], a + ldh [hBattleTurn], a ld hl, BattleText_SafeguardFaded jp StdBattleTextBox HandleScreens: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .Both call .CheckPlayer @@ -1693,7 +1693,7 @@ HandleWeather: cp WEATHER_SANDSTORM ret nz - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .enemy_first @@ -1715,7 +1715,7 @@ HandleWeather: ret nz ld hl, wBattleMonType1 - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonType1 @@ -1790,7 +1790,7 @@ SubtractHPFromUser: SubtractHP: ld hl, wBattleMonHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonHP @@ -1885,7 +1885,7 @@ GetMaxHP: ; output: bc, wBuffer1-2 ld hl, wBattleMonMaxHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonMaxHP @@ -1901,7 +1901,7 @@ GetMaxHP: Unreferenced_GetHalfHP: ld hl, wBattleMonHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonHP @@ -1920,7 +1920,7 @@ Unreferenced_GetHalfHP: CheckUserHasEnoughHP: ld hl, wBattleMonHP + 1 - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonHP + 1 @@ -1934,7 +1934,7 @@ CheckUserHasEnoughHP: RestoreHP ld hl, wEnemyMonMaxHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wBattleMonMaxHP @@ -1982,7 +1982,7 @@ UpdateHPBarBattleHuds: UpdateHPBar: hlcoord 10, 9 - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a ld a, 1 jr z, .ok @@ -2015,7 +2015,7 @@ HandleEnemyMonFaint: call nz, UpdatePlayerHUD ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld c, 60 call DelayFrames @@ -2064,7 +2064,7 @@ HandleEnemyMonFaint: ret DoubleSwitch: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 call ClearSprites @@ -3059,7 +3059,7 @@ MonFaintedAnimation: db " @" SlideBattlePicOut: - ld [hMapObjectIndexBuffer], a + ldh [hMapObjectIndexBuffer], a ld c, a .loop push bc @@ -3082,7 +3082,7 @@ SlideBattlePicOut: ret .DoFrame: - ld a, [hMapObjectIndexBuffer] + ldh a, [hMapObjectIndexBuffer] ld c, a cp $8 jr nz, .back @@ -3517,7 +3517,7 @@ OfferSwitch: ClearEnemyMonBox: xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a call ExitMenu call ClearSprites hlcoord 1, 0 @@ -3577,7 +3577,7 @@ Function_SetEnemyMonAndSendOutAnimation: .skip_cry call UpdateEnemyHUD ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ret NewEnemyMonStatus: @@ -3715,14 +3715,14 @@ TryToRunAwayFromBattle: inc a ld [wNumFleeAttempts], a ld a, [hli] - ld [hPartyMon1Speed + 0], a + ldh [hPartyMon1Speed + 0], a ld a, [hl] - ld [hPartyMon1Speed + 1], a + ldh [hPartyMon1Speed + 1], a ld a, [de] inc de - ld [hEnemyMonSpeed + 0], a + ldh [hEnemyMonSpeed + 0], a ld a, [de] - ld [hEnemyMonSpeed + 1], a + ldh [hEnemyMonSpeed + 1], a call Call_LoadTempTileMapToTileMap ld de, hPartyMon1Speed ld hl, hEnemyMonSpeed @@ -3731,27 +3731,27 @@ TryToRunAwayFromBattle: jr nc, .can_escape xor a - ld [hMultiplicand], a + ldh [hMultiplicand], a ld a, 32 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply - ld a, [hProduct + 2] - ld [hDividend + 0], a - ld a, [hProduct + 3] - ld [hDividend + 1], a - ld a, [hEnemyMonSpeed + 0] + ldh a, [hProduct + 2] + ldh [hDividend + 0], a + ldh a, [hProduct + 3] + ldh [hDividend + 1], a + ldh a, [hEnemyMonSpeed + 0] ld b, a - ld a, [hEnemyMonSpeed + 1] + ldh a, [hEnemyMonSpeed + 1] srl b rr a srl b rr a and a jr z, .can_escape - ld [hDivisor], a + ldh [hDivisor], a ld b, 2 call Divide - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] and a jr nz, .can_escape ld a, [wNumFleeAttempts] @@ -3760,16 +3760,16 @@ TryToRunAwayFromBattle: dec c jr z, .cant_escape_2 ld b, 30 - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] add b - ld [hQuotient + 2], a + ldh [hQuotient + 2], a jr c, .can_escape jr .loop .cant_escape_2 call BattleRandom ld b, a - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] cp b jr nc, .can_escape ld a, BATTLEPLAYERACTION_USEITEM @@ -4013,10 +4013,10 @@ SendOutPlayerMon: call ClearBox call WaitBGMap xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a call GetBattleMonBackpic xor a - ld [hGraphicStartTile], a + ldh [hGraphicStartTile], a ld [wBattleMenuCursorBuffer], a ld [wCurMoveNum], a ld [wTypeModifier], a @@ -4056,7 +4056,7 @@ SendOutPlayerMon: .statused call UpdatePlayerHUD ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ret NewBattleMonStatus: @@ -4098,7 +4098,7 @@ SpikesDamage: ld hl, wPlayerScreens ld de, wBattleMonType ld bc, UpdatePlayerHUD - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyScreens @@ -4147,7 +4147,7 @@ PursuitSwitch: push af ld hl, DoPlayerTurn - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .do_turn ld hl, DoEnemyTurn @@ -4165,7 +4165,7 @@ PursuitSwitch: pop af ld [wCurBattleMon], a - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .check_enemy_fainted @@ -4214,19 +4214,19 @@ PursuitSwitch: ret RecallPlayerMon: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] push af xor a - ld [hBattleTurn], a + ldh [hBattleTurn], a ld [wNumHits], a ld de, ANIM_RETURN_MON call Call_PlayBattleAnim pop af - ld [hBattleTurn], a + ldh [hBattleTurn], a ret HandleHealingItems: - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 call SetPlayerTurn @@ -4255,7 +4255,7 @@ HandleHPHealingItem: ret nz ld de, wEnemyMonHP + 1 ld hl, wEnemyMonMaxHP - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .go ld de, wBattleMonHP + 1 @@ -4321,7 +4321,7 @@ HandleHPHealingItem: inc de ld a, [wBuffer5] ld [de], a - ld a, [hBattleTurn] + ldh a, [hBattleTurn] ld [wWhichHPBar], a and a hlcoord 2, 2 @@ -4397,7 +4397,7 @@ UseHeldStatusHealingItem: .skip_confuse ld hl, CalcEnemyStats - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .got_pointer ld hl, CalcPlayerStats @@ -4437,7 +4437,7 @@ UseConfusionHealingItem: call ItemRecoveryAnim ld hl, BattleText_ItemHealedConfusion call StdBattleTextBox - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr nz, .do_partymon call GetOTPartymonItem @@ -4458,7 +4458,7 @@ UseConfusionHealingItem: HandleStatBoostingHeldItems: ; The effects handled here are not used in-game. - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 call .DoPlayer @@ -4477,7 +4477,7 @@ HandleStatBoostingHeldItems: call GetOTPartymonItem ld a, $1 .HandleItem: - ld [hBattleTurn], a + ldh [hBattleTurn], a ld d, h ld e, l push de @@ -4570,7 +4570,7 @@ UpdatePlayerHUD:: DrawPlayerHUD: xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a ; Clear the area hlcoord 9, 7 @@ -4708,7 +4708,7 @@ UpdateEnemyHUD:: DrawEnemyHUD: xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a hlcoord 1, 0 lb bc, 4, 11 @@ -4774,9 +4774,9 @@ DrawEnemyHUD: ld hl, wEnemyMonHP ld a, [hli] - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 1], a ld a, [hld] - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a or [hl] jr nz, .not_fainted @@ -4787,44 +4787,44 @@ DrawEnemyHUD: .not_fainted xor a - ld [hMultiplicand], a + ldh [hMultiplicand], a ld a, HP_BAR_LENGTH_PX - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ld hl, wEnemyMonMaxHP ld a, [hli] ld b, a ld a, [hl] - ld [hMultiplier], a + ldh [hMultiplier], a ld a, b and a jr z, .less_than_256_max - ld a, [hMultiplier] + ldh a, [hMultiplier] srl b rr a srl b rr a - ld [hDivisor], a - ld a, [hProduct + 2] + ldh [hDivisor], a + ldh a, [hProduct + 2] ld b, a srl b - ld a, [hProduct + 3] + ldh a, [hProduct + 3] rr a srl b rr a - ld [hProduct + 3], a + ldh [hProduct + 3], a ld a, b - ld [hProduct + 2], a + ldh [hProduct + 2], a .less_than_256_max - ld a, [hProduct + 2] - ld [hDividend + 0], a - ld a, [hProduct + 3] - ld [hDividend + 1], a + ldh a, [hProduct + 2] + ldh [hDividend + 0], a + ldh a, [hProduct + 3] + ldh [hDividend + 1], a ld a, 2 ld b, a call Divide - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld e, a ld a, HP_BAR_LENGTH ld d, a @@ -4856,7 +4856,7 @@ ret_3e138: BattleMenu: xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a call LoadTempTileMapToTileMap ld a, [wBattleType] @@ -4889,7 +4889,7 @@ BattleMenu: .next ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld a, [wBattleMenuCursorBuffer] cp $1 jp z, BattleMenu_Fight @@ -5001,7 +5001,7 @@ BattleMenu_Pack: .ball xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a call _LoadBattleFontsHPBar call ClearSprites ld a, [wBattleType] @@ -5203,7 +5203,7 @@ PlayerSwitch: ret .dont_run - ld a, [hSerialConnectionStatus] + ldh a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK jr z, .player_1 call BattleMonEntrance @@ -5332,7 +5332,7 @@ MoveSelectionScreen: ld bc, NUM_MOVES call CopyBytes xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a hlcoord 4, 17 - NUM_MOVES - 1 ld b, 4 @@ -5429,7 +5429,7 @@ MoveSelectionScreen: .interpret_joypad ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a call ScrollingMenuJoypad bit D_UP_F, a jp nz, .pressed_up @@ -5618,7 +5618,7 @@ MoveSelectionScreen: MoveInfoBox: xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a hlcoord 0, 8 ld b, 3 @@ -6513,8 +6513,8 @@ BattleWinSlideInEnemyTrainerFrontpic: cp 7 ret z xor a - ld [hBGMapMode], a - ld [hBGMapThird], a + ldh [hBGMapMode], a + ldh [hBGMapThird], a ld d, $0 push bc push hl @@ -6529,7 +6529,7 @@ BattleWinSlideInEnemyTrainerFrontpic: jr nz, .inner_loop ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld c, 4 call DelayFrames pop hl @@ -6564,12 +6564,12 @@ ApplyStatusEffectOnEnemyStats: xor a ApplyStatusEffectOnStats: - ld [hBattleTurn], a + ldh [hBattleTurn], a call ApplyPrzEffectOnSpeed jp ApplyBrnEffectOnAttack ApplyPrzEffectOnSpeed: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .enemy ld a, [wBattleMonStatus] @@ -6614,7 +6614,7 @@ ApplyPrzEffectOnSpeed: ret ApplyBrnEffectOnAttack: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] and a jr z, .enemy ld a, [wBattleMonStatus] @@ -6707,38 +6707,38 @@ ApplyStatLevelMultiplier: ld b, 0 add hl, bc xor a - ld [hMultiplicand + 0], a + ldh [hMultiplicand + 0], a ld a, [de] - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 1], a inc de ld a, [de] - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a ld a, [hli] - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ld a, [hl] - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide pop hl ; Cap at 999. - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] sub LOW(MAX_STAT_VALUE) - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] sbc HIGH(MAX_STAT_VALUE) jp c, .okay3 ld a, HIGH(MAX_STAT_VALUE) - ld [hQuotient + 1], a + ldh [hQuotient + 1], a ld a, LOW(MAX_STAT_VALUE) - ld [hQuotient + 2], a + ldh [hQuotient + 2], a .okay3 - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] ld [hli], a ld b, a - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld [hl], a or b jr nz, .okay4 @@ -7054,15 +7054,15 @@ GiveExperiencePoints: dec c jr nz, .loop1 xor a - ld [hMultiplicand + 0], a - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 0], a + ldh [hMultiplicand + 1], a ld a, [wEnemyMonBaseExp] - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a ld a, [wEnemyMonLevel] - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ld a, 7 - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide ; Boost Experience for traded Pokemon @@ -7095,9 +7095,9 @@ GiveExperiencePoints: ld a, [hl] cp LUCKY_EGG call z, BoostExp - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld [wStringBuffer2 + 1], a - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] ld [wStringBuffer2], a ld a, [wCurPartyMon] ld hl, wPartyMonNicknames @@ -7105,9 +7105,9 @@ GiveExperiencePoints: ld hl, Text_MonGainedExpPoint call BattleTextBox ld a, [wStringBuffer2 + 1] - ld [hQuotient + 2], a + ldh [hQuotient + 2], a ld a, [wStringBuffer2] - ld [hQuotient + 1], a + ldh [hQuotient + 1], a pop bc call AnimateExpBar push bc @@ -7116,11 +7116,11 @@ GiveExperiencePoints: ld hl, MON_EXP + 2 add hl, bc ld d, [hl] - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] add d ld [hld], a ld d, [hl] - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] adc d ld [hl], a jr nc, .skip2 @@ -7148,11 +7148,11 @@ GiveExperiencePoints: ld hl, MON_EXP + 2 add hl, bc push bc - ld a, [hQuotient] + ldh a, [hQuotient] ld b, a - ld a, [hQuotient + 1] + ldh a, [hQuotient + 1] ld c, a - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld d, a ld a, [hld] sub d @@ -7265,7 +7265,7 @@ GiveExperiencePoints: call EmptyBattleTextBox call LoadTileMapToTempTileMap ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a .skip_animation farcall LevelUpHappinessMod @@ -7364,14 +7364,14 @@ GiveExperiencePoints: ld c, wEnemyMonEnd - wEnemyMonBaseStats .count_loop2 xor a - ld [hDividend + 0], a + ldh [hDividend + 0], a ld a, [hl] - ld [hDividend + 1], a + ldh [hDividend + 1], a ld a, [wTempByteValue] - ld [hDivisor], a + ldh [hDivisor], a ld b, 2 call Divide - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld [hli], a dec c jr nz, .count_loop2 @@ -7381,19 +7381,19 @@ BoostExp: ; Multiply experience by 1.5x push bc ; load experience value - ld a, [hProduct + 2] + ldh a, [hProduct + 2] ld b, a - ld a, [hProduct + 3] + ldh a, [hProduct + 3] ld c, a ; halve it srl b rr c ; add it back to the whole exp value add c - ld [hProduct + 3], a - ld a, [hProduct + 2] + ldh [hProduct + 3], a + ldh a, [hProduct + 2] adc b - ld [hProduct + 2], a + ldh [hProduct + 2], a pop bc ret @@ -7428,10 +7428,10 @@ AnimateExpBar: cp MAX_LEVEL jp nc, .finish - ld a, [hProduct + 3] + ldh a, [hProduct + 3] ld [wd004], a push af - ld a, [hProduct + 2] + ldh a, [hProduct + 2] ld [wd003], a push af xor a @@ -7464,11 +7464,11 @@ AnimateExpBar: .NoOverflow: ld d, MAX_LEVEL callfar CalcExpAtLevel - ld a, [hProduct + 1] + ldh a, [hProduct + 1] ld b, a - ld a, [hProduct + 2] + ldh a, [hProduct + 2] ld c, a - ld a, [hProduct + 3] + ldh a, [hProduct + 3] ld d, a ld hl, wTempMonExp + 2 ld a, [hld] @@ -7539,9 +7539,9 @@ AnimateExpBar: call .LoopBarAnimation call TerminateExpBarSound pop af - ld [hProduct + 2], a + ldh [hProduct + 2], a pop af - ld [hProduct + 3], a + ldh [hProduct + 3], a .finish pop bc @@ -7568,11 +7568,11 @@ AnimateExpBar: call PlaceExpBar pop de ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld c, d call DelayFrames xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a pop bc ld a, c cp b @@ -7584,11 +7584,11 @@ AnimateExpBar: call PlaceExpBar pop de ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld c, d call DelayFrames xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a dec d jr nz, .min_number_of_frames ld d, 1 @@ -7599,7 +7599,7 @@ AnimateExpBar: jr nz, .anim_loop .end_animation ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ret SendOutMonText: @@ -7623,16 +7623,16 @@ SendOutMonText: ; compute enemy helth remaining as a percentage xor a - ld [hMultiplicand + 0], a + ldh [hMultiplicand + 0], a ld hl, wEnemyMonHP ld a, [hli] ld [wEnemyHPAtTimeOfPlayerSwitch], a - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 1], a ld a, [hl] ld [wEnemyHPAtTimeOfPlayerSwitch + 1], a - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a ld a, 25 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ld hl, wEnemyMonMaxHP ld a, [hli] @@ -7643,10 +7643,10 @@ SendOutMonText: rr b ld a, b ld b, 4 - ld [hDivisor], a + ldh [hDivisor], a call Divide - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld hl, JumpText_GoMon cp 70 jr nc, .skip_to_textbox @@ -7706,14 +7706,14 @@ WithdrawMonText: dec hl ld a, [de] sub b - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a dec de ld b, [hl] ld a, [de] sbc b - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 1], a ld a, 25 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ld hl, wEnemyMonMaxHP ld a, [hli] @@ -7724,11 +7724,11 @@ WithdrawMonText: rr b ld a, b ld b, 4 - ld [hDivisor], a + ldh [hDivisor], a call Divide pop bc pop de - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld hl, TextJump_ThatsEnoughComeBack and a ret z @@ -7826,17 +7826,17 @@ CalcExpBar: ; back up the next level exp, and subtract the two levels ld hl, hMultiplicand + 2 ld a, [hl] - ld [hMathBuffer + 2], a + ldh [hMathBuffer + 2], a pop bc sub b ld [hld], a ld a, [hl] - ld [hMathBuffer + 1], a + ldh [hMathBuffer + 1], a pop bc sbc b ld [hld], a ld a, [hl] - ld [hMathBuffer], a + ldh [hMathBuffer], a pop bc sbc b ld [hl], a @@ -7852,25 +7852,25 @@ CalcExpBar: ld a, [de] dec de ld c, a - ld a, [hMathBuffer + 2] + ldh a, [hMathBuffer + 2] sub c ld [hld], a ld a, [de] dec de ld b, a - ld a, [hMathBuffer + 1] + ldh a, [hMathBuffer + 1] sbc b ld [hld], a ld a, [de] ld c, a - ld a, [hMathBuffer] + ldh a, [hMathBuffer] sbc c ld [hld], a xor a ld [hl], a ; multiply by 64 ld a, $40 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply pop af ld c, a @@ -7894,10 +7894,10 @@ CalcExpBar: .done ld a, c - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld b, a ld a, $40 sub b @@ -7959,14 +7959,14 @@ DropPlayerSub: ret GetBattleMonBackpic_DoAnim: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] push af xor a - ld [hBattleTurn], a + ldh [hBattleTurn], a ld a, BANK(BattleAnimCommands) rst FarCall pop af - ld [hBattleTurn], a + ldh [hBattleTurn], a ret GetEnemyMonFrontpic: @@ -7996,13 +7996,13 @@ DropEnemySub: ret GetEnemyMonFrontpic_DoAnim: - ld a, [hBattleTurn] + ldh a, [hBattleTurn] push af call SetEnemyTurn ld a, BANK(BattleAnimCommands) rst FarCall pop af - ld [hBattleTurn], a + ldh [hBattleTurn], a ret StartBattle: @@ -8034,7 +8034,7 @@ BattleIntro: ld [wTempBattleMonSpecies], a ld [wBattleMenuCursorBuffer], a xor a - ld [hMapAnims], a + ldh [hMapAnims], a farcall PlayBattleMusic farcall ShowLinkBattleParticipants farcall FindFirstAliveMonAndStartBattle @@ -8051,7 +8051,7 @@ BattleIntro: ld hl, rLCDC set rLCDC_WINDOW_TILEMAP, [hl] ; select 9C00-9FFF xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a call EmptyBattleTextBox hlcoord 9, 7 lb bc, 5, 11 @@ -8064,7 +8064,7 @@ BattleIntro: cp WILD_BATTLE call z, UpdateEnemyHUD ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ret LoadTrainerOrWildMonPic: @@ -8085,26 +8085,26 @@ InitEnemy: jp InitEnemyWildmon ; wild BackUpBGMap2: - ld a, [rSVBK] + ldh a, [rSVBK] push af ld a, BANK(wDecompressScratch) - ld [rSVBK], a + ldh [rSVBK], a ld hl, wDecompressScratch ld bc, $40 tiles ; vBGMap3 - vBGMap2 ld a, $2 call ByteFill - ld a, [rVBK] + ldh a, [rVBK] push af ld a, $1 - ld [rVBK], a + ldh [rVBK], a ld de, wDecompressScratch hlbgcoord 0, 0 ; vBGMap2 lb bc, BANK(BackUpBGMap2), $40 call Request2bpp pop af - ld [rVBK], a + ldh [rVBK], a pop af - ld [rSVBK], a + ldh [rSVBK], a ret InitEnemyTrainer: @@ -8126,7 +8126,7 @@ InitEnemyTrainer: ld de, vTiles2 callfar GetTrainerPic xor a - ld [hGraphicStartTile], a + ldh [hGraphicStartTile], a dec a ld [wEnemyItemState], a hlcoord 12, 0 @@ -8190,7 +8190,7 @@ InitEnemyWildmon: predef GetAnimatedFrontpic xor a ld [wTrainerClass], a - ld [hGraphicStartTile], a + ldh [hGraphicStartTile], a hlcoord 12, 0 lb bc, 7, 7 predef PlaceGraphic @@ -8906,41 +8906,41 @@ InitBattleDisplay: call _LoadBattleFontsHPBar call .BlankBGMap xor a - ld [hMapAnims], a - ld [hSCY], a + ldh [hMapAnims], a + ldh [hSCY], a ld a, $90 - ld [hWY], a - ld [rWY], a + ldh [hWY], a + ldh [rWY], a call WaitBGMap xor a - ld [hBGMapMode], a + ldh [hBGMapMode], a farcall BattleIntroSlidingPics ld a, $1 - ld [hBGMapMode], a + ldh [hBGMapMode], a ld a, $31 - ld [hGraphicStartTile], a + ldh [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 predef PlaceGraphic xor a - ld [hWY], a - ld [rWY], a + ldh [hWY], a + ldh [rWY], a call WaitBGMap call HideSprites ld b, SCGB_BATTLE_COLORS call GetSGBLayout call SetPalettes ld a, $90 - ld [hWY], a + ldh [hWY], a xor a - ld [hSCX], a + ldh [hSCX], a ret .BlankBGMap: - ld a, [rSVBK] + ldh a, [rSVBK] push af ld a, BANK(wDecompressScratch) - ld [rSVBK], a + ldh [rSVBK], a ld hl, wDecompressScratch ld bc, wScratchAttrMap - wDecompressScratch @@ -8953,7 +8953,7 @@ InitBattleDisplay: call Request2bpp pop af - ld [rSVBK], a + ldh [rSVBK], a ret .InitBackPic: @@ -8995,21 +8995,21 @@ GetTrainerBackpic: ret CopyBackpic: - ld a, [rSVBK] + ldh a, [rSVBK] push af ld a, BANK(wDecompressScratch) - ld [rSVBK], a + ldh [rSVBK], a ld hl, vTiles0 ld de, vTiles2 tile $31 - ld a, [hROMBank] + ldh a, [hROMBank] ld b, a ld c, $31 call Get2bpp pop af - ld [rSVBK], a + ldh [rSVBK], a call .LoadTrainerBackpicAsOAM ld a, $31 - ld [hGraphicStartTile], a + ldh [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 predef PlaceGraphic @@ -9018,7 +9018,7 @@ CopyBackpic: .LoadTrainerBackpicAsOAM: ld hl, wVirtualOAMSprite00 xor a - ld [hMapObjectIndexBuffer], a + ldh [hMapObjectIndexBuffer], a ld b, 6 ld e, (SCREEN_WIDTH + 1) * TILE_WIDTH .outer_loop @@ -9029,10 +9029,10 @@ CopyBackpic: inc hl ld [hl], e ; x inc hl - ld a, [hMapObjectIndexBuffer] + ldh a, [hMapObjectIndexBuffer] ld [hli], a ; tile id inc a - ld [hMapObjectIndexBuffer], a + ldh [hMapObjectIndexBuffer], a ld a, PAL_BATTLE_OB_PLAYER ld [hli], a ; attributes ld a, d @@ -9040,9 +9040,9 @@ CopyBackpic: ld d, a dec c jr nz, .inner_loop - ld a, [hMapObjectIndexBuffer] + ldh a, [hMapObjectIndexBuffer] add $3 - ld [hMapObjectIndexBuffer], a + ldh [hMapObjectIndexBuffer], a ld a, e add 1 * TILE_WIDTH ld e, a @@ -9074,7 +9074,7 @@ BattleStartMessage: xor a ld [wNumHits], a ld a, 1 - ld [hBattleTurn], a + ldh [hBattleTurn], a ld a, 1 ld [wBattleAnimParam], a ld de, ANIM_SEND_OUT_MON |