diff options
Diffstat (limited to 'engine/items')
-rwxr-xr-x | engine/items/item_effects.asm | 110 | ||||
-rwxr-xr-x | engine/items/tm_prices.asm | 6 | ||||
-rwxr-xr-x | engine/items/town_map.asm | 8 |
3 files changed, 62 insertions, 62 deletions
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 238c2ea9..3668dd74 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -239,14 +239,14 @@ ItemUseBall: ; Calculate MaxHP * 255. xor a - ld [hMultiplicand], a + ldh [hMultiplicand], a ld hl, wEnemyMonMaxHP ld a, [hli] - ld [hMultiplicand + 1], a + ldh [hMultiplicand + 1], a ld a, [hl] - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a ld a, 255 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ; Determine BallFactor. It's 8 for Great Balls and 12 for the others. @@ -260,7 +260,7 @@ ItemUseBall: ; Note that the results of all division operations are floored. ; Calculate (MaxHP * 255) / BallFactor. - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 ; number of bytes in dividend call Divide @@ -281,17 +281,17 @@ ItemUseBall: .skip2 ; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide ; If W > 255, store 255 in [hQuotient + 3]. ; Let X = min(W, 255) = [hQuotient + 3]. - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] and a jr z, .skip3 ld a, 255 - ld [hQuotient + 3], a + ldh [hQuotient + 3], a .skip3 pop bc ; b = Rand1 - Status @@ -302,7 +302,7 @@ ItemUseBall: jr c, .failedToCapture ; If W > 255, the ball captures the Pokémon. - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] and a jr nz, .captured @@ -310,7 +310,7 @@ ItemUseBall: ; If Rand2 > X, the ball fails to capture the Pokémon. ld b, a - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] cp b jr c, .failedToCapture @@ -318,17 +318,17 @@ ItemUseBall: jr .skipShakeCalculations .failedToCapture - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] ld [wPokeBallCaptureCalcTemp], a ; Save X. ; Calculate CatchRate * 100. xor a - ld [hMultiplicand], a - ld [hMultiplicand + 1], a + ldh [hMultiplicand], a + ldh [hMultiplicand + 1], a ld a, [wEnemyMonActualCatchRate] - ld [hMultiplicand + 2], a + ldh [hMultiplicand + 2], a ld a, 100 - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ; Determine BallFactor2. @@ -349,26 +349,26 @@ ItemUseBall: .skip4 ; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. ld a, b - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide ; If Y > 255, there are 3 shakes. ; Note that this shouldn't be possible. ; The maximum value of Y is (255 * 100) / 150 = 170. - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] and a ld b, $63 ; 3 shakes jr nz, .setAnimData ; Calculate X * Y. ld a, [wPokeBallCaptureCalcTemp] - ld [hMultiplier], a + ldh [hMultiplier], a call Multiply ; Calculate (X * Y) / 255. ld a, 255 - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide @@ -386,9 +386,9 @@ ItemUseBall: .addAilmentValue ; If the Pokémon has a status ailment, add Status2. - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] add b - ld [hQuotient + 3], a + ldh [hQuotient + 3], a .skip5 ; Finally determine the number of shakes. @@ -398,7 +398,7 @@ ItemUseBall: ; 10 ≤ Z < 30: 1 shake ; 30 ≤ Z < 70: 2 shakes ; 70 ≤ Z: 3 shakes - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] cp 10 ld b, $20 jr c, .setAnimData @@ -422,7 +422,7 @@ ItemUseBall: ld a, TOSS_ANIM ld [wAnimationID], a xor a - ld [hWhoseTurn], a + ldh [hWhoseTurn], a ld [wAnimationType], a ld [wDamageMultipliers], a ld a, [wWhichPokemon] @@ -656,7 +656,7 @@ ItemUseBicycle: jp nc, NoCyclingAllowedHere call ItemUseReloadOverworldData xor a ; no keys pressed - ld [hJoyHeld], a ; current joypad state + ldh [hJoyHeld], a ; current joypad state inc a ld [wWalkBikeSurfState], a ; change player state to bicycling ld hl, GotOnBicycleText @@ -687,11 +687,11 @@ ItemUseSurfboard: jp PrintText .tryToStopSurfing xor a - ld [hSpriteIndexOrTextID], a + ldh [hSpriteIndexOrTextID], a ld d, 16 ; talking range in pixels (normal range) call IsSpriteInFrontOfPlayer2 res 7, [hl] - ld a, [hSpriteIndexOrTextID] + ldh a, [hSpriteIndexOrTextID] and a ; is there a sprite in the way? jr nz, .cannotStopSurfing ld hl, TilePairCollisionsWater @@ -1018,18 +1018,18 @@ ItemUseMedicine: call AddNTimes ld a, [hli] ld [wHPBarMaxHP + 1], a - ld [hDividend], a + ldh [hDividend], a ld a, [hl] ld [wHPBarMaxHP], a - ld [hDividend + 1], a + ldh [hDividend + 1], a ld a, 5 - ld [hDivisor], a + ldh [hDivisor], a ld b, 2 ; number of bytes call Divide ; get 1/5 of max HP of pokemon that used Softboiled ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] push af ld b, a ld a, [hl] @@ -1037,7 +1037,7 @@ ItemUseMedicine: sub b ld [hld], a ld [wHPBarNewHP], a - ld a, [hQuotient + 2] + ldh a, [hQuotient + 2] ld b, a ld a, [hl] ld [wHPBarOldHP+1], a @@ -1050,15 +1050,15 @@ ItemUseMedicine: call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a, [hFlagsFFF6] + ldh a, [hFlagsFFF6] set 0, a - ld [hFlagsFFF6], a + ldh [hFlagsFFF6], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled - ld a, [hFlagsFFF6] + ldh a, [hFlagsFFF6] res 0, a - ld [hFlagsFFF6], a + ldh [hFlagsFFF6], a pop af ld b, a ; store heal amount (1/5 of max HP) ld hl, wHPBarOldHP + 1 @@ -1200,15 +1200,15 @@ ItemUseMedicine: jr z, .playStatusAilmentCuringSound ld a, SFX_HEAL_HP call PlaySoundWaitForCurrent - ld a, [hFlagsFFF6] + ldh a, [hFlagsFFF6] set 0, a - ld [hFlagsFFF6], a + ldh [hFlagsFFF6], a ld a, $02 ld [wHPBarType], a predef UpdateHPBar2 ; animate the HP bar lengthening - ld a, [hFlagsFFF6] + ldh a, [hFlagsFFF6] res 0, a - ld [hFlagsFFF6], a + ldh [hFlagsFFF6], a ld a, REVIVE_MSG ld [wPartyMenuTypeOrMessageID], a ld a, [wcf91] @@ -1224,13 +1224,13 @@ ItemUseMedicine: call PlaySoundWaitForCurrent .showHealingItemMessage xor a - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a call ClearScreen dec a ld [wUpdateSpritesEnabled], a call RedrawPartyMenu ; redraws the party menu and displays the message ld a, 1 - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a ld c, 50 call DelayFrames call WaitForTextScrollButtonPress @@ -1347,11 +1347,11 @@ ItemUseMedicine: ld bc, wPartyMon1Exp - wPartyMon1Level add hl, bc ; hl now points to MSB of experience ; update experience to minimum for new level - ld a, [hExperience] + ldh a, [hExperience] ld [hli], a - ld a, [hExperience + 1] + ldh a, [hExperience + 1] ld [hli], a - ld a, [hExperience + 2] + ldh a, [hExperience + 2] ld [hl], a pop hl ld a, [wWhichPokemon] @@ -1459,7 +1459,7 @@ BaitRockCommon: ld [wAnimationID], a xor a ld [wAnimationType], a - ld [hWhoseTurn], a + ldh [hWhoseTurn], a ld [de], a ; zero escape factor (for bait), zero bait factor (for rock) .randomLoop ; loop until a random number less than 5 is generated call Random @@ -1698,7 +1698,7 @@ ItemUseXStat: call LoadScreenTilesFromBuffer1 ; restore saved screen call Delay3 xor a - ld [hWhoseTurn], a ; set turn to player's turn + ldh [hWhoseTurn], a ; set turn to player's turn callba StatModifierUpEffect ; do stat increase move pop hl pop af @@ -2463,13 +2463,13 @@ RestoreBonusPP: AddBonusPP: push bc ld a, [de] ; normal max PP of move - ld [hDividend + 3], a + ldh [hDividend + 3], a xor a - ld [hDividend], a - ld [hDividend + 1], a - ld [hDividend + 2], a + ldh [hDividend], a + ldh [hDividend + 1], a + ldh [hDividend + 2], a ld a, 5 - ld [hDivisor], a + ldh [hDivisor], a ld b, 4 call Divide ld a, [hl] ; move PP @@ -2480,7 +2480,7 @@ AddBonusPP: srl a ld c, a ; c = number of PP Ups used .loop - ld a, [hQuotient + 3] + ldh a, [hQuotient + 3] cp 8 ; is the amount greater than or equal to 8? jr c, .addAmount ld a, 7 ; cap the amount at 7 @@ -2822,13 +2822,13 @@ SendNewMonToBox: ld d, a callab CalcExperience pop de - ld a, [hExperience] + ldh a, [hExperience] ld [de], a inc de - ld a, [hExperience + 1] + ldh a, [hExperience + 1] ld [de], a inc de - ld a, [hExperience + 2] + ldh a, [hExperience + 2] ld [de], a inc de xor a diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index 502191d5..df9761bd 100755 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -16,10 +16,10 @@ GetMachinePrice:: swap a .highNybbleIsPrice and $f0 - ld [hItemPrice + 1], a + ldh [hItemPrice + 1], a xor a - ld [hItemPrice], a - ld [hItemPrice + 2], a + ldh [hItemPrice], a + ldh [hItemPrice + 2], a ret INCLUDE "data/items/tm_prices.asm" diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 285dbfa5..3f6d4fa5 100755 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -6,7 +6,7 @@ DisplayTownMap: ld [hl], $ff push hl ld a, $1 - ld [hJoy7], a + ldh [hJoy7], a ld a, [wCurMap] push af ld b, $0 @@ -65,7 +65,7 @@ DisplayTownMap: .inputLoop call TownMapSpriteBlinkingAnimation call JoypadLowSensitivity - ld a, [hJoy5] + ldh a, [hJoy5] ld b, a and A_BUTTON | B_BUTTON | D_UP | D_DOWN jr z, .inputLoop @@ -77,7 +77,7 @@ DisplayTownMap: jr nz, .pressedDown xor a ld [wTownMapSpriteBlinkingEnabled], a - ld [hJoy7], a + ldh [hJoy7], a ld [wAnimCounter], a call ExitTownMap pop hl @@ -187,7 +187,7 @@ LoadTownMap_Fly:: push hl call DelayFrame call JoypadLowSensitivity - ld a, [hJoy5] + ldh a, [hJoy5] ld b, a pop hl and A_BUTTON | B_BUTTON | D_UP | D_DOWN |