You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Use labels instead of constants for HRAM
Use explicit ldh instruction to access HRAM locations, don't rely on optimizing ld
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
BattleCommand_BatonPass:
|
||||
; batonpass
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jp nz, .Enemy
|
||||
|
||||
|
@@ -2,7 +2,7 @@ BattleCommand_BeatUp:
|
||||
; beatup
|
||||
|
||||
call ResetDamage
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jp nz, .enemy_beats_up
|
||||
|
||||
@@ -210,7 +210,7 @@ GetBeatupMonLocation:
|
||||
push bc
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, wPartyMon1Species
|
||||
jr z, .got_species
|
||||
|
@@ -7,7 +7,7 @@ BattleCommand_StoreEnergy:
|
||||
ret z
|
||||
|
||||
ld hl, wPlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .check_still_storing_energy
|
||||
ld hl, wEnemyRolloutCount
|
||||
@@ -28,7 +28,7 @@ BattleCommand_StoreEnergy:
|
||||
ld [hl], a
|
||||
ld hl, wPlayerDamageTaken + 1
|
||||
ld de, wPlayerCharging ; player
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .player
|
||||
ld hl, wEnemyDamageTaken + 1
|
||||
@@ -74,7 +74,7 @@ BattleCommand_UnleashEnergy:
|
||||
|
||||
ld de, wPlayerDamageTaken
|
||||
ld bc, wPlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_damage
|
||||
ld de, wEnemyDamageTaken
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_Conversion:
|
||||
|
||||
ld hl, wBattleMonMoves
|
||||
ld de, wBattleMonType1
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_moves
|
||||
ld hl, wEnemyMonMoves
|
||||
|
@@ -5,7 +5,7 @@ BattleCommand_Conversion2:
|
||||
and a
|
||||
jr nz, .failed
|
||||
ld hl, wBattleMonType1
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_type
|
||||
ld hl, wEnemyMonType1
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_Curse:
|
||||
|
||||
ld de, wBattleMonType1
|
||||
ld bc, wPlayerStatLevels
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .go
|
||||
ld de, wEnemyMonType1
|
||||
|
@@ -7,7 +7,7 @@ BattleCommand_Disable:
|
||||
|
||||
ld de, wEnemyDisableCount
|
||||
ld hl, wEnemyMonMoves
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_moves
|
||||
ld de, wPlayerDisableCount
|
||||
@@ -33,7 +33,7 @@ BattleCommand_Disable:
|
||||
cp b
|
||||
jr nz, .loop
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, wEnemyMonPP
|
||||
jr z, .got_pp
|
||||
@@ -55,7 +55,7 @@ BattleCommand_Disable:
|
||||
ld [de], a
|
||||
call AnimateCurrentMove
|
||||
ld hl, wDisabledMove
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr nz, .got_disabled_move_pointer
|
||||
inc hl
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_Encore:
|
||||
|
||||
ld hl, wEnemyMonMoves
|
||||
ld de, wEnemyEncoreCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .ok
|
||||
ld hl, wBattleMonMoves
|
||||
@@ -47,7 +47,7 @@ BattleCommand_Encore:
|
||||
ld [de], a
|
||||
call CheckOpponentWentFirst
|
||||
jr nz, .finish_move
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .force_last_enemy_move
|
||||
|
||||
|
@@ -4,7 +4,7 @@ BattleCommand_FalseSwipe:
|
||||
; Makes sure wCurDamage < MonHP
|
||||
|
||||
ld hl, wEnemyMonHP
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_hp
|
||||
ld hl, wBattleMonHP
|
||||
|
@@ -3,25 +3,25 @@ BattleCommand_FrustrationPower:
|
||||
|
||||
push bc
|
||||
ld hl, wBattleMonHappiness
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_happiness
|
||||
ld hl, wEnemyMonHappiness
|
||||
.got_happiness
|
||||
ld a, $ff
|
||||
sub [hl]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
xor a
|
||||
ld [hMultiplicand + 0], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 0], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, 10
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, 25
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
ld d, a
|
||||
pop bc
|
||||
ret
|
||||
|
@@ -2,7 +2,7 @@ BattleCommand_FuryCutter:
|
||||
; furycutter
|
||||
|
||||
ld hl, wPlayerFuryCutterCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .go
|
||||
ld hl, wEnemyFuryCutterCount
|
||||
@@ -42,7 +42,7 @@ ResetFuryCutterCount:
|
||||
push hl
|
||||
|
||||
ld hl, wPlayerFuryCutterCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .reset
|
||||
ld hl, wEnemyFuryCutterCount
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_CheckFutureSight:
|
||||
|
||||
ld hl, wPlayerFutureSightCount
|
||||
ld de, wPlayerFutureSightDamage
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .ok
|
||||
ld hl, wEnemyFutureSightCount
|
||||
@@ -41,7 +41,7 @@ BattleCommand_FutureSight:
|
||||
ld [hl], b
|
||||
.AlreadyChargingFutureSight:
|
||||
ld hl, wPlayerFutureSightCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .GotFutureSightCount
|
||||
ld hl, wEnemyFutureSightCount
|
||||
@@ -57,7 +57,7 @@ BattleCommand_FutureSight:
|
||||
call StdBattleTextBox
|
||||
call BattleCommand_RaiseSub
|
||||
ld de, wPlayerFutureSightDamage
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .StoreDamage
|
||||
ld de, wEnemyFutureSightDamage
|
||||
|
@@ -5,7 +5,7 @@ BattleCommand_HealBell:
|
||||
call GetBattleVarAddr
|
||||
res SUBSTATUS_NIGHTMARE, [hl]
|
||||
ld de, wPartyMon1Status
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_status
|
||||
ld de, wOTPartyMon1Status
|
||||
@@ -28,7 +28,7 @@ BattleCommand_HealBell:
|
||||
ld hl, BellChimedText
|
||||
call StdBattleTextBox
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jp z, CalcPlayerStats
|
||||
jp CalcEnemyStats
|
||||
|
@@ -7,7 +7,7 @@ BattleCommand_LeechSeed:
|
||||
jr nz, .evaded
|
||||
|
||||
ld de, wEnemyMonType1
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .ok
|
||||
ld de, wBattleMonType1
|
||||
|
@@ -7,7 +7,7 @@ BattleCommand_Mimic:
|
||||
and a
|
||||
jr nz, .fail
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .player_turn
|
||||
ld hl, wEnemyMonMoves
|
||||
|
@@ -5,7 +5,7 @@ BattleCommand_PayDay:
|
||||
ld hl, wStringBuffer1
|
||||
ld [hli], a
|
||||
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
ld a, [wBattleMonLevel]
|
||||
jr z, .ok
|
||||
|
@@ -54,7 +54,7 @@ BattleCommand_Present:
|
||||
call AnimateCurrentMove
|
||||
call BattleCommand_SwitchTurn
|
||||
ld hl, AICheckPlayerMaxHP
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_hp_fn_pointer
|
||||
ld hl, AICheckEnemyMaxHP
|
||||
|
@@ -14,7 +14,7 @@ BattleCommand_Protect:
|
||||
|
||||
ProtectChance:
|
||||
ld de, wPlayerProtectCount
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .asm_37637
|
||||
ld de, wEnemyProtectCount
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_PsychUp:
|
||||
|
||||
ld hl, wEnemyStatLevels
|
||||
ld de, wPlayerStatLevels
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .pointers_correct
|
||||
; It's the enemy's turn, so swap the pointers.
|
||||
@@ -35,7 +35,7 @@ BattleCommand_PsychUp:
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .loop2
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr nz, .calc_enemy_stats
|
||||
call CalcPlayerStats
|
||||
|
@@ -3,7 +3,7 @@ BattleCommand_Pursuit:
|
||||
; Double damage if the opponent is switching.
|
||||
|
||||
ld hl, wEnemyIsSwitching
|
||||
ld a, [hBattleTurn]
|
||||
ldh a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .ok
|
||||
ld hl, wPlayerIsSwitching
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user