mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-04-08 19:40:40 +12:00
H_CONSTANTNAMES -> hConstantNames
This commit is contained in:
parent
55bb99580e
commit
35deb77113
104 changed files with 1163 additions and 1164 deletions
|
|
@ -308,7 +308,7 @@ LoadSubanimation:
|
|||
; sets the transform to the subanimation type if it's the enemy's turn
|
||||
GetSubanimationTransform1:
|
||||
ld b, a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, b
|
||||
ret nz
|
||||
|
|
@ -319,7 +319,7 @@ GetSubanimationTransform1:
|
|||
; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
|
||||
; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
|
||||
GetSubanimationTransform2:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, 2 << 5
|
||||
ret z
|
||||
|
|
@ -421,7 +421,7 @@ MoveAnimation:
|
|||
|
||||
ShareMoveAnimations:
|
||||
; some moves just reuse animations from status conditions
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ret z
|
||||
|
||||
|
|
@ -920,16 +920,16 @@ AnimationDelay10:
|
|||
; calls a function with the turn flipped from player to enemy or vice versa
|
||||
; input - hl - address of function to call
|
||||
CallWithTurnFlipped:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
push af
|
||||
xor 1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld de, .returnAddress
|
||||
push de
|
||||
jp hl
|
||||
.returnAddress
|
||||
pop af
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ret
|
||||
|
||||
; flashes the screen for an extended period (48 frames)
|
||||
|
|
@ -1133,7 +1133,7 @@ _AnimationWaterDroplets:
|
|||
AnimationSlideMonUp:
|
||||
; Slides the mon's sprite upwards.
|
||||
ld c, 7
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 1, 6
|
||||
coord de, 1, 5
|
||||
|
|
@ -1201,7 +1201,7 @@ _AnimationSlideMonUp:
|
|||
jr nz, .slideLoop
|
||||
|
||||
; Fill in the bottom row of the mon pic with the next row's tile IDs.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 1, 11
|
||||
jr z, .next
|
||||
|
|
@ -1370,7 +1370,7 @@ AnimationShowEnemyMonPic:
|
|||
AnimationShakeBackAndForth:
|
||||
; Shakes the mon's sprite back and forth rapidly. This is used in Double Team.
|
||||
; The mon's sprite disappears after this animation.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 0, 5
|
||||
coord de, 2, 5
|
||||
|
|
@ -1418,7 +1418,7 @@ AnimationMoveMonHorizontally:
|
|||
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
|
||||
; animations like Tackle/Body Slam.
|
||||
call AnimationHideMonPic
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 2, 5
|
||||
jr z, .next
|
||||
|
|
@ -1434,7 +1434,7 @@ AnimationMoveMonHorizontally:
|
|||
|
||||
AnimationResetMonPosition:
|
||||
; Resets the mon's sprites to be located at the normal coordinates.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, 5 * SCREEN_WIDTH + 2
|
||||
jr z, .next
|
||||
|
|
@ -1446,7 +1446,7 @@ AnimationResetMonPosition:
|
|||
AnimationSpiralBallsInward:
|
||||
; Creates an effect that looks like energy balls spiralling into the
|
||||
; player mon's sprite. Used in Focus Energy, for example.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, -40
|
||||
|
|
@ -1530,7 +1530,7 @@ AnimationSquishMonPic:
|
|||
ld c, 4
|
||||
.loop
|
||||
push bc
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
coord hl, 16, 0
|
||||
|
|
@ -1583,7 +1583,7 @@ _AnimationSquishMonPic:
|
|||
AnimationShootBallsUpward:
|
||||
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
|
||||
; animations.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
lb bc, 0, 16 * 8
|
||||
|
|
@ -1651,7 +1651,7 @@ _AnimationShootBallsUpward:
|
|||
|
||||
AnimationShootManyBallsUpward:
|
||||
; Shoots several pillars of "energy" balls upward.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, UpwardBallsAnimXCoordinatesPlayerTurn
|
||||
ld a, $50 ; y coordinate for "energy" ball pillar
|
||||
|
|
@ -1743,7 +1743,7 @@ AnimationSlideMonDownAndHide:
|
|||
_AnimationSlideMonOff:
|
||||
; Slides the mon's sprite off the screen horizontally by e tiles and waits
|
||||
; [wSlideMonDelay] V-blanks each time the pic is slid by one tile.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
coord hl, 12, 0
|
||||
|
|
@ -1758,7 +1758,7 @@ _AnimationSlideMonOff:
|
|||
.rowLoop ; iterates once for each row
|
||||
ld c, 8
|
||||
.tileLoop ; iterates once for each tile in the row
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn2
|
||||
call .EnemyNextTile
|
||||
|
|
@ -1821,7 +1821,7 @@ AnimationSlideMonHalfOff:
|
|||
jp Delay3
|
||||
|
||||
CopyTempPicToMonPic:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, vBackPic ; player turn
|
||||
jr z, .next
|
||||
|
|
@ -1837,7 +1837,7 @@ AnimationWavyScreen:
|
|||
call BattleAnimCopyTileMapToVRAM
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, SCREEN_HEIGHT_PIXELS
|
||||
ld [hWY], a
|
||||
ld d, $80 ; terminator
|
||||
|
|
@ -1865,7 +1865,7 @@ AnimationWavyScreen:
|
|||
call SaveScreenTilesToBuffer2
|
||||
call ClearScreen
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
call LoadScreenTilesFromBuffer2
|
||||
ld hl, vBGMap1
|
||||
|
|
@ -1898,7 +1898,7 @@ AnimationSubstitute:
|
|||
xor a
|
||||
ld bc, $0310
|
||||
call FillMemory
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld hl, SlowbroSprite ; facing down sprite
|
||||
|
|
@ -1937,7 +1937,7 @@ CopySlowbroSpriteData:
|
|||
jp FarCopyData2
|
||||
|
||||
HideSubstituteShowMonAnim:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wPlayerMonMinimized
|
||||
ld a, [wPlayerBattleStatus2]
|
||||
|
|
@ -1987,7 +1987,7 @@ AnimationTransformMon:
|
|||
ld [wChangeMonPicEnemyTurnSpecies], a
|
||||
|
||||
ChangeMonPic:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, [wChangeMonPicEnemyTurnSpecies]
|
||||
|
|
@ -2020,11 +2020,11 @@ ChangeMonPic:
|
|||
AnimationHideEnemyMonPic:
|
||||
; Hides the enemy mon's sprite
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld hl, AnimationHideMonPic
|
||||
call CallWithTurnFlipped
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jp Delay3
|
||||
|
||||
InitMultipleObjectsOAM:
|
||||
|
|
@ -2050,7 +2050,7 @@ InitMultipleObjectsOAM:
|
|||
|
||||
AnimationHideMonPic:
|
||||
; Hides the mon's sprite.
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, 12
|
||||
|
|
@ -2078,7 +2078,7 @@ ClearMonPicFromTileMap:
|
|||
; in order to show only a portion of the mon sprite.
|
||||
GetMonSpriteTileMapPointerFromRowCount:
|
||||
push de
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .enemyTurn
|
||||
ld a, 20 * 5 + 1
|
||||
|
|
@ -2166,7 +2166,7 @@ GetMoveSound:
|
|||
ld b, a
|
||||
call IsCryMove
|
||||
jr nc, .NotCryMove
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .next
|
||||
ld a, [wBattleMonSpecies] ; get number of current monster
|
||||
|
|
@ -2211,7 +2211,7 @@ IsCryMove:
|
|||
INCLUDE "data/moves/sfx.asm"
|
||||
|
||||
CopyPicTiles:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $31 ; base tile ID of player mon sprite
|
||||
jr z, .next
|
||||
|
|
@ -2235,7 +2235,7 @@ CopyDownscaledMonTiles:
|
|||
|
||||
CopyTileIDs_NoBGTransfer:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
; fall through
|
||||
|
||||
; b = number of rows
|
||||
|
|
@ -2261,7 +2261,7 @@ CopyTileIDs:
|
|||
dec b
|
||||
jr nz, .rowLoop
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
pop hl
|
||||
ret
|
||||
|
||||
|
|
@ -2624,9 +2624,9 @@ ShakeEnemyHUD_ShakeBG:
|
|||
|
||||
BattleAnimCopyTileMapToVRAM:
|
||||
ld a, h
|
||||
ld [H_AUTOBGTRANSFERDEST + 1], a
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
ld a, l
|
||||
ld [H_AUTOBGTRANSFERDEST], a
|
||||
ld [hAutoBGTransferDest], a
|
||||
jp Delay3
|
||||
|
||||
TossBallAnimation:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
BattleTransition:
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hWY], a
|
||||
|
|
@ -349,7 +349,7 @@ BattleTransition_Shrink:
|
|||
.loop
|
||||
push bc
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 0, 7
|
||||
coord de, 0, 8
|
||||
ld bc, -SCREEN_WIDTH * 2
|
||||
|
|
@ -367,7 +367,7 @@ BattleTransition_Shrink:
|
|||
ld bc, 2
|
||||
call BattleTransition_CopyTiles2
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld c, 6
|
||||
call DelayFrames
|
||||
pop bc
|
||||
|
|
@ -381,7 +381,7 @@ BattleTransition_Shrink:
|
|||
BattleTransition_Split:
|
||||
ld c, SCREEN_HEIGHT / 2
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
coord hl, 0, 16
|
||||
|
|
@ -496,7 +496,7 @@ BattleTransition_VerticalStripes:
|
|||
coord hl, 0, 0
|
||||
coord de, 1, 17
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
|
|
@ -535,7 +535,7 @@ BattleTransition_HorizontalStripes:
|
|||
coord hl, 0, 0
|
||||
coord de, 19, 1
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
|
|
@ -582,7 +582,7 @@ BattleTransition_FlashScreen:
|
|||
ld b, $3
|
||||
call BattleTransition_FlashScreen_
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
BattleTransition_Circle_Sub1:
|
||||
|
|
@ -601,10 +601,10 @@ BattleTransition_Circle_Sub1:
|
|||
|
||||
BattleTransition_TransferDelay3:
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
; used for low level wild non-dungeon battles
|
||||
|
|
|
|||
|
|
@ -101,16 +101,16 @@ PrintSendOutMonMessage:
|
|||
ld hl, GoText
|
||||
jr z, .printText
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld hl, wEnemyMonHP
|
||||
ld a, [hli]
|
||||
ld [wLastSwitchInEnemyMonHP], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [wLastSwitchInEnemyMonHP + 1], a
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, 25
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
|
|
@ -121,9 +121,9 @@ PrintSendOutMonMessage:
|
|||
rr b
|
||||
ld a, b
|
||||
ld b, 4
|
||||
ld [H_DIVISOR], a ; enemy mon max HP divided by 4
|
||||
ld [hDivisor], a ; enemy mon max HP divided by 4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
|
||||
ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
|
||||
ld hl, GoText ; 70% or greater
|
||||
cp 70
|
||||
jr nc, .printText
|
||||
|
|
@ -179,14 +179,14 @@ PlayerMon2Text:
|
|||
dec hl
|
||||
ld a, [de]
|
||||
sub b
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
dec de
|
||||
ld b, [hl]
|
||||
ld a, [de]
|
||||
sbc b
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, 25
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
|
|
@ -197,11 +197,11 @@ PlayerMon2Text:
|
|||
rr b
|
||||
ld a, b
|
||||
ld b, 4
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
call Divide
|
||||
pop bc
|
||||
pop de
|
||||
ld a, [H_QUOTIENT + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
|
||||
ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
|
||||
; Assuming that the enemy mon hasn't gained HP since the last switch in,
|
||||
; a approximates the percentage that the enemy mon's total HP has decreased
|
||||
; since the last switch in.
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
|
|||
ld [wUpdateSpritesEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld b, $70
|
||||
ld c, $90
|
||||
ld a, c
|
||||
|
|
@ -83,7 +83,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
|
|||
dec c
|
||||
jr nz, .slideSilhouettesLoop
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, $31
|
||||
ld [hStartTileID], a
|
||||
coord hl, 1, 5
|
||||
|
|
@ -92,7 +92,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
|
|||
ld [hWY], a
|
||||
ld [rWY], a
|
||||
inc a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
ld b, SET_PAL_BATTLE
|
||||
call RunPaletteCommand
|
||||
|
|
@ -266,7 +266,7 @@ EnemyRan:
|
|||
ld a, SFX_RUN
|
||||
call PlaySoundWaitForCurrent
|
||||
xor a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
jpab AnimationSlideEnemyMonOff
|
||||
|
||||
WildRanText:
|
||||
|
|
@ -412,7 +412,7 @@ MainInBattleLoop:
|
|||
jr .playerMovesFirst
|
||||
.enemyMovesFirst
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
callab TrainerAI
|
||||
jr c, .AIActionUsedEnemyFirst
|
||||
call ExecuteEnemyMove
|
||||
|
|
@ -450,7 +450,7 @@ MainInBattleLoop:
|
|||
jp z, HandlePlayerMonFainted
|
||||
call DrawHUDsAndHPBars
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
callab TrainerAI
|
||||
jr c, .AIActionUsedPlayerFirst
|
||||
call ExecuteEnemyMove
|
||||
|
|
@ -470,7 +470,7 @@ MainInBattleLoop:
|
|||
HandlePoisonBurnLeechSeed:
|
||||
ld hl, wBattleMonHP
|
||||
ld de, wBattleMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playersTurn
|
||||
ld hl, wEnemyMonHP
|
||||
|
|
@ -495,7 +495,7 @@ HandlePoisonBurnLeechSeed:
|
|||
call HandlePoisonBurnLeechSeed_DecreaseOwnHP
|
||||
.notBurnedOrPoisoned
|
||||
ld de, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playersTurn2
|
||||
ld de, wEnemyBattleStatus2
|
||||
|
|
@ -504,16 +504,16 @@ HandlePoisonBurnLeechSeed:
|
|||
add a
|
||||
jr nc, .notLeechSeeded
|
||||
push hl
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
push af
|
||||
xor $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld a, ABSORB
|
||||
call PlayMoveAnimation ; play leech seed animation (from opposing mon)
|
||||
pop af
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
pop hl
|
||||
call HandlePoisonBurnLeechSeed_DecreaseOwnHP
|
||||
call HandlePoisonBurnLeechSeed_IncreaseEnemyHP
|
||||
|
|
@ -571,7 +571,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP:
|
|||
.nonZeroDamage
|
||||
ld hl, wPlayerBattleStatus3
|
||||
ld de, wPlayerToxicCounter
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playersTurn
|
||||
ld hl, wEnemyBattleStatus3
|
||||
|
|
@ -618,7 +618,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP:
|
|||
HandlePoisonBurnLeechSeed_IncreaseEnemyHP:
|
||||
push hl
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playersTurn
|
||||
ld hl, wBattleMonMaxHP
|
||||
|
|
@ -655,19 +655,19 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP:
|
|||
ld [hl], a
|
||||
ld [wHPBarNewHP], a
|
||||
.noOverfullHeal
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
call UpdateCurMonHPBar
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
pop hl
|
||||
ret
|
||||
|
||||
UpdateCurMonHPBar:
|
||||
coord hl, 10, 9 ; tile pointer to player HP bar
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .playersTurn
|
||||
|
|
@ -1177,7 +1177,7 @@ LinkBattleLostText:
|
|||
db "@"
|
||||
|
||||
; slides pic of fainted mon downwards until it disappears
|
||||
; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing
|
||||
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
|
||||
SlideDownFaintedMonPic:
|
||||
ld a, [wd730]
|
||||
push af
|
||||
|
|
@ -1230,7 +1230,7 @@ SevenSpacesText:
|
|||
; slides the player or enemy trainer off screen
|
||||
; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer)
|
||||
; if a is 8, the slide is to the right, else it is to the left
|
||||
; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing
|
||||
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
|
||||
SlideTrainerPicOffScreen:
|
||||
ld [hSlideAmount], a
|
||||
ld c, a
|
||||
|
|
@ -1508,29 +1508,29 @@ TryRunningFromBattle:
|
|||
inc a
|
||||
ld [wNumRunAttempts], a
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [de]
|
||||
ld [hEnemySpeed], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [hEnemySpeed + 1], a
|
||||
call LoadScreenTilesFromBuffer1
|
||||
ld de, H_MULTIPLICAND + 1
|
||||
ld de, hMultiplicand + 1
|
||||
ld hl, hEnemySpeed
|
||||
ld c, 2
|
||||
call StringCmp
|
||||
jr nc, .canEscape ; jump if player speed greater than enemy speed
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld a, 32
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply ; multiply player speed by 32
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld [H_DIVIDEND], a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld a, [hProduct + 2]
|
||||
ld [hDividend], a
|
||||
ld a, [hProduct + 3]
|
||||
ld [hDividend + 1], a
|
||||
ld a, [hEnemySpeed]
|
||||
ld b, a
|
||||
ld a, [hEnemySpeed + 1]
|
||||
|
|
@ -1541,10 +1541,10 @@ TryRunningFromBattle:
|
|||
rr a
|
||||
and a
|
||||
jr z, .canEscape ; jump if enemy speed divided by 4, mod 256 is 0
|
||||
ld [H_DIVISOR], a ; ((enemy speed / 4) % 256)
|
||||
ld [hDivisor], a ; ((enemy speed / 4) % 256)
|
||||
ld b, $2
|
||||
call Divide ; divide (player speed * 32) by ((enemy speed / 4) % 256)
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
and a ; is the quotient greater than 256?
|
||||
jr nz, .canEscape ; if so, the player can escape
|
||||
ld a, [wNumRunAttempts]
|
||||
|
|
@ -1554,15 +1554,15 @@ TryRunningFromBattle:
|
|||
dec c
|
||||
jr z, .compareWithRandomValue
|
||||
ld b, 30
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
add b
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld [hQuotient + 3], a
|
||||
jr c, .canEscape
|
||||
jr .loop
|
||||
.compareWithRandomValue
|
||||
call BattleRandom
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
cp b
|
||||
jr nc, .canEscape ; if the random value was less than or equal to the quotient
|
||||
; plus 30 times the number of attempts, the player can escape
|
||||
|
|
@ -1754,7 +1754,7 @@ SendOutMon:
|
|||
ld hl, wEnemyBattleStatus1
|
||||
res USING_TRAPPING_MOVE, [hl]
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld a, POOF_ANIM
|
||||
call PlayMoveAnimation
|
||||
coord hl, 4, 11
|
||||
|
|
@ -1812,7 +1812,7 @@ DrawHUDsAndHPBars:
|
|||
|
||||
DrawPlayerHUDAndHPBar:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 9, 7
|
||||
lb bc, 5, 11
|
||||
call ClearScreenArea
|
||||
|
|
@ -1845,7 +1845,7 @@ DrawPlayerHUDAndHPBar:
|
|||
coord hl, 10, 9
|
||||
predef DrawHP
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld hl, wPlayerHPBarColor
|
||||
call GetBattleHealthBarColor
|
||||
ld hl, wBattleMonHP
|
||||
|
|
@ -1873,7 +1873,7 @@ DrawPlayerHUDAndHPBar:
|
|||
|
||||
DrawEnemyHUDAndHPBar:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 0, 0
|
||||
lb bc, 4, 12
|
||||
call ClearScreenArea
|
||||
|
|
@ -1895,9 +1895,9 @@ DrawEnemyHUDAndHPBar:
|
|||
.skipPrintLevel
|
||||
ld hl, wEnemyMonHP
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hld]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
or [hl] ; is current HP zero?
|
||||
jr nz, .hpNonzero
|
||||
; current HP is 0
|
||||
|
|
@ -1908,45 +1908,45 @@ DrawEnemyHUDAndHPBar:
|
|||
jp .drawHPBar
|
||||
.hpNonzero
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld a, 48
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply ; multiply current HP by 48
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld a, b
|
||||
and a ; is max HP > 255?
|
||||
jr z, .doDivide
|
||||
; if max HP > 255, scale both (current HP * 48) and max HP by dividing by 4 so that max HP fits in one byte
|
||||
; (it needs to be one byte so it can be used as the divisor for the Divide function)
|
||||
ld a, [H_DIVISOR]
|
||||
ld a, [hDivisor]
|
||||
srl b
|
||||
rr a
|
||||
srl b
|
||||
rr a
|
||||
ld [H_DIVISOR], a
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld [hDivisor], a
|
||||
ld a, [hProduct + 2]
|
||||
ld b, a
|
||||
srl b
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
rr a
|
||||
srl b
|
||||
rr a
|
||||
ld [H_PRODUCT + 3], a
|
||||
ld [hProduct + 3], a
|
||||
ld a, b
|
||||
ld [H_PRODUCT + 2], a
|
||||
ld [hProduct + 2], a
|
||||
.doDivide
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld [H_DIVIDEND], a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld a, [hProduct + 2]
|
||||
ld [hDividend], a
|
||||
ld a, [hProduct + 3]
|
||||
ld [hDividend + 1], a
|
||||
ld a, $2
|
||||
ld b, a
|
||||
call Divide ; divide (current HP * 48) by max HP
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
; set variables for DrawHPBar
|
||||
ld e, a
|
||||
ld a, $6
|
||||
|
|
@ -1958,7 +1958,7 @@ DrawEnemyHUDAndHPBar:
|
|||
coord hl, 2, 2
|
||||
call DrawHPBar
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld hl, wEnemyHPBarColor
|
||||
|
||||
GetBattleHealthBarColor:
|
||||
|
|
@ -2469,13 +2469,13 @@ MoveSelectionMenu:
|
|||
|
||||
.writemoves
|
||||
ld de, wMovesString
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
set 2, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
call PlaceString
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
res 2, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
ret
|
||||
|
||||
.regularmenu
|
||||
|
|
@ -2595,10 +2595,10 @@ SelectMenuItem:
|
|||
call AddNTimes
|
||||
ld [hl], "▷"
|
||||
.select
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 1, [hl]
|
||||
call HandleMenuInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 1, [hl]
|
||||
bit 6, a
|
||||
jp nz, SelectMenuItem_CursorUp ; up
|
||||
|
|
@ -2825,7 +2825,7 @@ SwapMovesInMenu:
|
|||
|
||||
PrintMenuItem:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 0, 8
|
||||
ld b, 3
|
||||
ld c, 9
|
||||
|
|
@ -2847,7 +2847,7 @@ PrintMenuItem:
|
|||
ld hl, wCurrentMenuItem
|
||||
dec [hl]
|
||||
xor a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [wCurrentMenuItem]
|
||||
ld c, a
|
||||
|
|
@ -2891,7 +2891,7 @@ PrintMenuItem:
|
|||
predef PrintMoveType
|
||||
.moveDisabled
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jp Delay3
|
||||
|
||||
DisabledText:
|
||||
|
|
@ -3043,7 +3043,7 @@ LinkBattleExchangeData:
|
|||
|
||||
ExecutePlayerMove:
|
||||
xor a
|
||||
ld [H_WHOSETURN], a ; set player's turn
|
||||
ld [hWhoseTurn], a ; set player's turn
|
||||
ld a, [wPlayerSelectedMove]
|
||||
inc a
|
||||
jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn
|
||||
|
|
@ -3252,7 +3252,7 @@ PrintGhostText:
|
|||
; print the ghost battle messages
|
||||
call IsGhostBattle
|
||||
ret nz
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .Ghost
|
||||
ld a, [wBattleMonStatus] ; player’s turn
|
||||
|
|
@ -3619,7 +3619,7 @@ CantMoveText:
|
|||
PrintMoveIsDisabledText:
|
||||
ld hl, wPlayerSelectedMove
|
||||
ld de, wPlayerBattleStatus1
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .removeChargingUp
|
||||
inc hl
|
||||
|
|
@ -3675,11 +3675,11 @@ HandleSelfConfusionDamage:
|
|||
xor a
|
||||
ld [wAnimationType], a
|
||||
inc a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
call PlayMoveAnimation
|
||||
call DrawPlayerHUDAndHPBar
|
||||
xor a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
jp ApplyDamageToPlayerPokemon
|
||||
|
||||
PrintMonName1Text:
|
||||
|
|
@ -3694,7 +3694,7 @@ PrintMonName1Text:
|
|||
MonName1Text:
|
||||
TX_FAR _MonName1Text
|
||||
TX_ASM
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
ld hl, wPlayerUsedMove
|
||||
|
|
@ -3818,7 +3818,7 @@ INCLUDE "data/moves/grammar.asm"
|
|||
|
||||
PrintMoveFailureText:
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playersTurn
|
||||
ld de, wEnemyMoveEffect
|
||||
|
|
@ -3866,7 +3866,7 @@ PrintMoveFailureText:
|
|||
call PrintText
|
||||
ld b, $4
|
||||
predef PredefShakeScreenHorizontally
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .enemyTurn
|
||||
jp ApplyDamageToPlayerPokemon
|
||||
|
|
@ -4160,9 +4160,9 @@ GetDamageVarsForPlayerAttack:
|
|||
; in the case of a critical hit, reset the player's attack and the enemy's defense to their base values
|
||||
ld c, 3 ; defense stat
|
||||
call GetEnemyMonStat
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
ld b, a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
ld c, a
|
||||
push bc
|
||||
ld hl, wPartyMon1Attack
|
||||
|
|
@ -4192,9 +4192,9 @@ GetDamageVarsForPlayerAttack:
|
|||
; in the case of a critical hit, reset the player's and enemy's specials to their base values
|
||||
ld c, 5 ; special stat
|
||||
call GetEnemyMonStat
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
ld b, a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
ld c, a
|
||||
push bc
|
||||
ld hl, wPartyMon1Special
|
||||
|
|
@ -4281,7 +4281,7 @@ GetDamageVarsForEnemyAttack:
|
|||
push bc
|
||||
ld c, 2 ; attack stat
|
||||
call GetEnemyMonStat
|
||||
ld hl, H_PRODUCT + 2
|
||||
ld hl, hProduct + 2
|
||||
pop bc
|
||||
jr .scaleStats
|
||||
.specialAttack
|
||||
|
|
@ -4313,7 +4313,7 @@ GetDamageVarsForEnemyAttack:
|
|||
push bc
|
||||
ld c, 5 ; special stat
|
||||
call GetEnemyMonStat
|
||||
ld hl, H_PRODUCT + 2
|
||||
ld hl, hProduct + 2
|
||||
pop bc
|
||||
; if either the offensive or defensive stat is too large to store in a byte, scale both stats by dividing them by 4
|
||||
; this allows values with up to 10 bits (values up to 1023) to be handled
|
||||
|
|
@ -4371,9 +4371,9 @@ GetEnemyMonStat:
|
|||
ld bc, wEnemyMon2 - wEnemyMon1
|
||||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
pop bc
|
||||
pop de
|
||||
ret
|
||||
|
|
@ -4404,7 +4404,7 @@ CalculateDamage:
|
|||
; d: base power
|
||||
; e: level
|
||||
|
||||
ld a, [H_WHOSETURN] ; whose turn?
|
||||
ld a, [hWhoseTurn] ; whose turn?
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .effect
|
||||
|
|
@ -4436,7 +4436,7 @@ CalculateDamage:
|
|||
.skipbp
|
||||
|
||||
xor a
|
||||
ld hl, H_DIVIDEND
|
||||
ld hl, hDividend
|
||||
ldi [hl], a
|
||||
ldi [hl], a
|
||||
ld [hl], a
|
||||
|
|
@ -4487,41 +4487,41 @@ CalculateDamage:
|
|||
|
||||
ld hl, wDamage
|
||||
ld b, [hl]
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
add b
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld [hQuotient + 3], a
|
||||
jr nc, .asm_3dfd0
|
||||
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
inc a
|
||||
ld [H_QUOTIENT + 2], a
|
||||
ld [hQuotient + 2], a
|
||||
and a
|
||||
jr z, .asm_3e004
|
||||
|
||||
.asm_3dfd0
|
||||
ld a, [H_QUOTIENT]
|
||||
ld a, [hQuotient]
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 1]
|
||||
ld a, [hQuotient + 1]
|
||||
or a
|
||||
jr nz, .asm_3e004
|
||||
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
cp 998 / $100
|
||||
jr c, .asm_3dfe8
|
||||
cp 998 / $100 + 1
|
||||
jr nc, .asm_3e004
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
cp 998 % $100
|
||||
jr nc, .asm_3e004
|
||||
|
||||
.asm_3dfe8
|
||||
inc hl
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld b, [hl]
|
||||
add b
|
||||
ld [hld], a
|
||||
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld b, [hl]
|
||||
adc b
|
||||
ld [hl], a
|
||||
|
|
@ -4573,7 +4573,7 @@ INCLUDE "data/battle/unused_critical_hit_moves.asm"
|
|||
CriticalHitTest:
|
||||
xor a
|
||||
ld [wCriticalHitOrOHKO], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wEnemyMonSpecies]
|
||||
jr nz, .handleEnemy
|
||||
|
|
@ -4584,7 +4584,7 @@ CriticalHitTest:
|
|||
ld a, [wMonHBaseSpeed]
|
||||
ld b, a
|
||||
srl b ; (effective (base speed/2))
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wPlayerMovePower
|
||||
ld de, wPlayerBattleStatus2
|
||||
|
|
@ -4646,7 +4646,7 @@ HandleCounterMove:
|
|||
; the outcome may be affected by the player's actions in the move selection menu prior to switching the Pokemon.
|
||||
; This might also lead to desync glitches in link battles.
|
||||
|
||||
ld a, [H_WHOSETURN] ; whose turn
|
||||
ld a, [hWhoseTurn] ; whose turn
|
||||
and a
|
||||
; player's turn
|
||||
ld hl, wEnemySelectedMove
|
||||
|
|
@ -4954,7 +4954,7 @@ AttackSubstitute:
|
|||
; values for player turn
|
||||
ld de, wEnemySubstituteHP
|
||||
ld bc, wEnemyBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .applyDamageToSubstitute
|
||||
; values for enemy turn
|
||||
|
|
@ -4979,14 +4979,14 @@ AttackSubstitute:
|
|||
ld hl, SubstituteBrokeText
|
||||
call PrintText
|
||||
; flip whose turn it is for the next function call
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $01
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
callab HideSubstituteShowMonAnim ; animate the substitute breaking
|
||||
; flip the turn back to the way it was
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $01
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld hl, wPlayerMoveEffect ; value for player's turn
|
||||
and a
|
||||
jr z, .nullifyEffect
|
||||
|
|
@ -5010,7 +5010,7 @@ HandleBuildingRage:
|
|||
ld hl, wEnemyBattleStatus2
|
||||
ld de, wEnemyMonStatMods
|
||||
ld bc, wEnemyMoveNum
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next
|
||||
; values for the enemy turn
|
||||
|
|
@ -5023,9 +5023,9 @@ HandleBuildingRage:
|
|||
ld a, [de]
|
||||
cp $0d ; maximum stat modifier value
|
||||
ret z ; return if attack modifier is already maxed
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $01 ; flip turn for the stat modifier raising function
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
; temporarily change the target pokemon's move to $00 and the effect to the one
|
||||
; that causes the attack modifier to go up one stage
|
||||
ld h, b
|
||||
|
|
@ -5042,9 +5042,9 @@ HandleBuildingRage:
|
|||
ldd [hl], a ; null move effect
|
||||
ld a, RAGE
|
||||
ld [hl], a ; restore the target pokemon's move number to Rage
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
xor $01 ; flip turn back to the way it was
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ret
|
||||
|
||||
BuildingRageText:
|
||||
|
|
@ -5060,7 +5060,7 @@ MirrorMoveCopyMove:
|
|||
; wPlayerUsedMove is also set to 0 whenever the player is fast asleep or frozen solid.
|
||||
; wEnemyUsedMove is also set to 0 whenever the enemy is fast asleep or frozen solid.
|
||||
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
; values for player turn
|
||||
ld a, [wEnemyUsedMove]
|
||||
|
|
@ -5113,7 +5113,7 @@ MetronomePickMove:
|
|||
; values for player turn
|
||||
ld de, wPlayerMoveNum
|
||||
ld hl, wPlayerSelectedMove
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .pickMoveLoop
|
||||
; values for enemy turn
|
||||
|
|
@ -5135,7 +5135,7 @@ MetronomePickMove:
|
|||
; it's used to prevent moves that run another move within the same turn
|
||||
; (like Mirror Move and Metronome) from losing 2 PP
|
||||
IncrementMovePP:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
; values for player turn
|
||||
ld hl, wBattleMonPP
|
||||
|
|
@ -5154,7 +5154,7 @@ IncrementMovePP:
|
|||
ld h, d
|
||||
ld l, e
|
||||
add hl, bc
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMonNumber] ; value for player turn
|
||||
jr z, .updatePP
|
||||
|
|
@ -5178,7 +5178,7 @@ AdjustDamageForMoveType:
|
|||
ld e, [hl] ; e = type 2 of defender
|
||||
ld a, [wPlayerMoveType]
|
||||
ld [wMoveType], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next
|
||||
; values for enemy turn
|
||||
|
|
@ -5242,25 +5242,25 @@ AdjustDamageForMoveType:
|
|||
and $80
|
||||
ld b, a
|
||||
ld a, [hl] ; a = damage multiplier
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
add b
|
||||
ld [wDamageMultipliers], a
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld hl, wDamage
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hld]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
call Multiply
|
||||
ld a, 10
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $04
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld [hli], a
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [hl], a
|
||||
or b ; is damage 0?
|
||||
jr nz, .skipTypeImmunity
|
||||
|
|
@ -5325,7 +5325,7 @@ MoveHitTest:
|
|||
ld hl, wEnemyBattleStatus1
|
||||
ld de, wPlayerMoveEffect
|
||||
ld bc, wEnemyMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .dreamEaterCheck
|
||||
; enemy's turn
|
||||
|
|
@ -5354,7 +5354,7 @@ MoveHitTest:
|
|||
.checkForDigOrFlyStatus
|
||||
bit INVULNERABLE, [hl]
|
||||
jp nz, .moveMissed
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .enemyTurn
|
||||
.playerTurn
|
||||
|
|
@ -5408,7 +5408,7 @@ MoveHitTest:
|
|||
call CalcHitChance ; scale the move accuracy according to attacker's accuracy and target's evasion
|
||||
ld a, [wPlayerMoveAccuracy]
|
||||
ld b, a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .doAccuracyCheck
|
||||
ld a, [wEnemyMoveAccuracy]
|
||||
|
|
@ -5427,7 +5427,7 @@ MoveHitTest:
|
|||
ld [hl], a
|
||||
inc a
|
||||
ld [wMoveMissed], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn2
|
||||
.enemyTurn2
|
||||
|
|
@ -5442,7 +5442,7 @@ MoveHitTest:
|
|||
; values for player turn
|
||||
CalcHitChance:
|
||||
ld hl, wPlayerMoveAccuracy
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMonAccuracyMod]
|
||||
ld b, a
|
||||
|
|
@ -5462,10 +5462,10 @@ CalcHitChance:
|
|||
; decreases the hit chance instead of increasing the hit chance)
|
||||
; zero the high bytes of the multiplicand
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [H_MULTIPLICAND + 2], a ; set multiplicand to move accuracy
|
||||
ld [hMultiplicand + 2], a ; set multiplicand to move accuracy
|
||||
push hl
|
||||
ld d, $02 ; loop has two iterations
|
||||
; loop to do the calculations, the first iteration multiplies by the accuracy ratio and
|
||||
|
|
@ -5480,29 +5480,29 @@ CalcHitChance:
|
|||
add hl, bc ; hl = address of stat modifier ratio
|
||||
pop bc
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLIER], a ; set multiplier to the numerator of the ratio
|
||||
ld [hMultiplier], a ; set multiplier to the numerator of the ratio
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [H_DIVISOR], a ; set divisor to the the denominator of the ratio
|
||||
ld [hDivisor], a ; set divisor to the the denominator of the ratio
|
||||
; (the dividend is the product of the previous multiplication)
|
||||
ld b, $04 ; number of bytes in the dividend
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
or b
|
||||
jp nz, .nextCalculation
|
||||
; make sure the result is always at least one
|
||||
ld [H_QUOTIENT + 2], a
|
||||
ld [hQuotient + 2], a
|
||||
ld a, $01
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld [hQuotient + 3], a
|
||||
.nextCalculation
|
||||
ld b, c
|
||||
dec d
|
||||
jr nz, .loop
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
and a ; is the calculated hit chance over 0xFF?
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
jr z, .storeAccuracy
|
||||
; if calculated hit chance over 0xFF
|
||||
ld a, $ff ; set the hit chance to 0xFF
|
||||
|
|
@ -5522,29 +5522,29 @@ RandomizeDamage:
|
|||
ret c ; return if damage is equal to 0 or 1
|
||||
.DamageGreaterThanOne
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
dec hl
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
; loop until a random number greater than or equal to 217 is generated
|
||||
.loop
|
||||
call BattleRandom
|
||||
rrca
|
||||
cp 217
|
||||
jr c, .loop
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply ; multiply damage by the random number, which is in the range [217, 255]
|
||||
ld a, 255
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide ; divide the result by 255
|
||||
; store the modified damage
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld hl, wDamage
|
||||
ld [hli], a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
|
|
@ -5900,11 +5900,11 @@ CheckEnemyStatusConditions:
|
|||
ld [hl], a
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld a, POUND
|
||||
call PlayMoveAnimation
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
call ApplyDamageToEnemyPokemon
|
||||
jr .monHurtItselfOrFullyParalysed
|
||||
.checkIfTriedToUseDisabledMove
|
||||
|
|
@ -6051,7 +6051,7 @@ CheckEnemyStatusConditions:
|
|||
ret
|
||||
|
||||
GetCurrentMove:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .player
|
||||
ld de, wEnemyMoveNum
|
||||
|
|
@ -6257,13 +6257,13 @@ DoBattleTransitionAndInitBattleVariables:
|
|||
predef BattleTransition
|
||||
callab LoadHudAndHpBarAndStatusTilePatterns
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, $ff
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
call ClearSprites
|
||||
call ClearScreen
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld [hWY], a
|
||||
ld [rWY], a
|
||||
ld [hTilesetType], a
|
||||
|
|
@ -6340,7 +6340,7 @@ LoadPlayerBackPic:
|
|||
ld [$4000], a
|
||||
ld hl, vSprites
|
||||
ld de, sSpriteBuffer1
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
ld b, a
|
||||
ld c, 7 * 7
|
||||
call CopyVideoData
|
||||
|
|
@ -6367,12 +6367,12 @@ ApplyBurnAndParalysisPenaltiesToEnemy:
|
|||
xor a
|
||||
|
||||
ApplyBurnAndParalysisPenalties:
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
call QuarterSpeedDueToParalysis
|
||||
jp HalveAttackDueToBurn
|
||||
|
||||
QuarterSpeedDueToParalysis:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
.enemyTurn ; quarter the player's speed
|
||||
|
|
@ -6415,7 +6415,7 @@ QuarterSpeedDueToParalysis:
|
|||
ret
|
||||
|
||||
HalveAttackDueToBurn:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
.enemyTurn ; halve the player's attack
|
||||
|
|
@ -6505,35 +6505,35 @@ CalculateModifiedStat:
|
|||
ld b, 0
|
||||
add hl, bc
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
pop hl
|
||||
ld a, [H_DIVIDEND + 3]
|
||||
ld a, [hDividend + 3]
|
||||
sub 999 % $100
|
||||
ld a, [H_DIVIDEND + 2]
|
||||
ld a, [hDividend + 2]
|
||||
sbc 999 / $100
|
||||
jp c, .storeNewStatValue
|
||||
; cap the stat at 999
|
||||
ld a, 999 / $100
|
||||
ld [H_DIVIDEND + 2], a
|
||||
ld [hDividend + 2], a
|
||||
ld a, 999 % $100
|
||||
ld [H_DIVIDEND + 3], a
|
||||
ld [hDividend + 3], a
|
||||
.storeNewStatValue
|
||||
ld a, [H_DIVIDEND + 2]
|
||||
ld a, [hDividend + 2]
|
||||
ld [hli], a
|
||||
ld b, a
|
||||
ld a, [H_DIVIDEND + 3]
|
||||
ld a, [hDividend + 3]
|
||||
ld [hl], a
|
||||
or b
|
||||
jr nz, .done
|
||||
|
|
@ -6683,7 +6683,7 @@ BattleRandom:
|
|||
|
||||
|
||||
HandleExplodingAnimation:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wEnemyMonType1
|
||||
ld de, wEnemyBattleStatus1
|
||||
|
|
@ -6826,18 +6826,18 @@ _InitBattleCommon:
|
|||
call RunPaletteCommand
|
||||
call SlidePlayerAndEnemySilhouettesOnScreen
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld hl, .emptyString
|
||||
call PrintText
|
||||
call SaveScreenTilesToBuffer1
|
||||
call ClearScreen
|
||||
ld a, $98
|
||||
ld [H_AUTOBGTRANSFERDEST + 1], a
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
ld a, $9c
|
||||
ld [H_AUTOBGTRANSFERDEST + 1], a
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
call LoadScreenTilesFromBuffer1
|
||||
coord hl, 9, 7
|
||||
lb bc, 5, 10
|
||||
|
|
@ -6998,6 +6998,6 @@ LoadMonBackPic:
|
|||
ld hl, vSprites
|
||||
ld de, vBackPic
|
||||
ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
ld b, a
|
||||
jp CopyVideoData
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ JumpMoveEffect:
|
|||
ret
|
||||
|
||||
_JumpMoveEffect:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .next1
|
||||
|
|
@ -26,7 +26,7 @@ INCLUDE "data/moves/effects_pointers.asm"
|
|||
SleepEffect:
|
||||
ld de, wEnemyMonStatus
|
||||
ld bc, wEnemyBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .sleepEffect
|
||||
ld de, wBattleMonStatus
|
||||
|
|
@ -78,7 +78,7 @@ AlreadyAsleepText:
|
|||
PoisonEffect:
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .poisonEffect
|
||||
ld hl, wBattleMonStatus
|
||||
|
|
@ -121,7 +121,7 @@ PoisonEffect:
|
|||
set 3, [hl] ; mon is now poisoned
|
||||
push de
|
||||
dec de
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld b, ANIM_C7
|
||||
ld hl, wPlayerBattleStatus3
|
||||
|
|
@ -175,7 +175,7 @@ DrainHPEffect:
|
|||
ExplodeEffect:
|
||||
ld hl, wBattleMonHP
|
||||
ld de, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .faintUser
|
||||
ld hl, wEnemyMonHP
|
||||
|
|
@ -196,7 +196,7 @@ FreezeBurnParalyzeEffect:
|
|||
ld [wAnimationType], a
|
||||
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
|
||||
ret nz ; return if they have a substitute, can't effect them
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jp nz, opponentAttacker
|
||||
ld a, [wEnemyMonStatus]
|
||||
|
|
@ -308,7 +308,7 @@ CheckDefrost:
|
|||
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
|
||||
and 1 << FRZ ; are they frozen?
|
||||
ret z ; return if so
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .opponent
|
||||
;player [attacker]
|
||||
|
|
@ -346,7 +346,7 @@ FireDefrostedText:
|
|||
StatModifierUpEffect:
|
||||
ld hl, wPlayerMonStatMods
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .statModifierUpEffect
|
||||
ld hl, wEnemyMonStatMods
|
||||
|
|
@ -382,7 +382,7 @@ StatModifierUpEffect:
|
|||
push hl
|
||||
ld hl, wBattleMonAttack + 1
|
||||
ld de, wPlayerMonUnmodifiedAttack
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .pointToStats
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
|
|
@ -417,35 +417,35 @@ StatModifierUpEffect:
|
|||
add hl, bc
|
||||
pop bc
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
pop hl
|
||||
; cap at 999
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
sub 999 % $100
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
sbc 999 / $100
|
||||
jp c, UpdateStat
|
||||
ld a, 999 / $100
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, 999 % $100
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
|
||||
UpdateStat:
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
ld [hli], a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
ld [hl], a
|
||||
pop hl
|
||||
UpdateStatDone:
|
||||
|
|
@ -455,7 +455,7 @@ UpdateStatDone:
|
|||
ld hl, wPlayerBattleStatus2
|
||||
ld de, wPlayerMoveNum
|
||||
ld bc, wPlayerMonMinimized
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .asm_3f4e6
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
@ -488,7 +488,7 @@ UpdateStatDone:
|
|||
pop af
|
||||
call nz, Bankswitch
|
||||
.applyBadgeBoostsAndStatusPenalties
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat,
|
||||
; even to those not affected by the stat-up move (will be boosted further)
|
||||
|
|
@ -511,7 +511,7 @@ MonsStatsRoseText:
|
|||
TX_FAR _MonsStatsRoseText
|
||||
TX_ASM
|
||||
ld hl, GreatlyRoseText
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .playerTurn
|
||||
|
|
@ -534,7 +534,7 @@ StatModifierDownEffect:
|
|||
ld hl, wEnemyMonStatMods
|
||||
ld de, wPlayerMoveEffect
|
||||
ld bc, wEnemyBattleStatus1
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .statModifierDownEffect
|
||||
ld hl, wPlayerMonStatMods
|
||||
|
|
@ -601,7 +601,7 @@ StatModifierDownEffect:
|
|||
push de
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
ld de, wEnemyMonUnmodifiedAttack
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .pointToStat
|
||||
ld hl, wBattleMonAttack + 1
|
||||
|
|
@ -637,33 +637,33 @@ StatModifierDownEffect:
|
|||
add hl, bc
|
||||
pop bc
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
pop hl
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
ld b, a
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
or b
|
||||
jp nz, UpdateLoweredStat
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, $1
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
|
||||
UpdateLoweredStat:
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
ld [hli], a
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop hl
|
||||
|
|
@ -678,7 +678,7 @@ UpdateLoweredStatDone:
|
|||
jr nc, .ApplyBadgeBoostsAndStatusPenalties
|
||||
call PlayCurrentMoveAnimation2
|
||||
.ApplyBadgeBoostsAndStatusPenalties
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
|
||||
; even to those not affected by the stat-up move (will be boosted further)
|
||||
|
|
@ -713,7 +713,7 @@ MonsStatsFellText:
|
|||
TX_FAR _MonsStatsFellText
|
||||
TX_ASM
|
||||
ld hl, FellText
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .playerTurn
|
||||
|
|
@ -759,7 +759,7 @@ BideEffect:
|
|||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerBideAccumulatedDamage
|
||||
ld bc, wPlayerNumAttacksLeft
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .bideEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
|
@ -778,14 +778,14 @@ BideEffect:
|
|||
inc a
|
||||
inc a
|
||||
ld [bc], a ; set Bide counter to 2 or 3 at random
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
add XSTATITEM_ANIM
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
ThrashPetalDanceEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .thrashPetalDanceEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
|
@ -797,12 +797,12 @@ ThrashPetalDanceEffect:
|
|||
inc a
|
||||
inc a
|
||||
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
add ANIM_B0
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
SwitchAndTeleportEffect:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .handleEnemy
|
||||
ld a, [wIsInBattle]
|
||||
|
|
@ -920,7 +920,7 @@ TwoToFiveAttacksEffect:
|
|||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld bc, wPlayerNumHits
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .twoToFiveAttacksEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
|
@ -931,7 +931,7 @@ TwoToFiveAttacksEffect:
|
|||
ret nz
|
||||
set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times
|
||||
ld hl, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .setNumberOfHits
|
||||
ld hl, wEnemyMoveEffect
|
||||
|
|
@ -967,7 +967,7 @@ FlinchSideEffect:
|
|||
ret nz
|
||||
ld hl, wEnemyBattleStatus1
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .flinchSideEffect
|
||||
ld hl, wPlayerBattleStatus1
|
||||
|
|
@ -992,7 +992,7 @@ OneHitKOEffect:
|
|||
ChargeEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld b, XSTATITEM_ANIM
|
||||
jr z, .chargeEffect
|
||||
|
|
@ -1074,7 +1074,7 @@ DugAHoleText:
|
|||
TrappingEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .trappingEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
|
@ -1120,7 +1120,7 @@ ConfusionEffect:
|
|||
jr nz, ConfusionEffectFailed
|
||||
|
||||
ConfusionSideEffectSuccess:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wEnemyBattleStatus1
|
||||
ld bc, wEnemyConfusedCounter
|
||||
|
|
@ -1164,7 +1164,7 @@ SubstituteEffect:
|
|||
|
||||
HyperBeamEffect:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .hyperBeamEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
@ -1175,7 +1175,7 @@ HyperBeamEffect:
|
|||
ClearHyperBeam:
|
||||
push hl
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
|
@ -1186,7 +1186,7 @@ ClearHyperBeam:
|
|||
|
||||
RageEffect:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .player
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
@ -1201,7 +1201,7 @@ MimicEffect:
|
|||
ld a, [wMoveMissed]
|
||||
and a
|
||||
jr nz, .mimicMissed
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [wPlayerBattleStatus1]
|
||||
|
|
@ -1226,7 +1226,7 @@ MimicEffect:
|
|||
and a
|
||||
jr z, .getRandomMove
|
||||
ld d, a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [wPlayerMoveListIndex]
|
||||
|
|
@ -1284,7 +1284,7 @@ DisableEffect:
|
|||
jr nz, .moveMissed
|
||||
ld de, wEnemyDisabledMove
|
||||
ld hl, wEnemyMonMoves
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .disableEffect
|
||||
ld de, wPlayerDisabledMove
|
||||
|
|
@ -1307,7 +1307,7 @@ DisableEffect:
|
|||
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
|
||||
ld [wd11e], a ; store move number
|
||||
push hl
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonPP
|
||||
jr nz, .enemyTurn
|
||||
|
|
@ -1345,7 +1345,7 @@ DisableEffect:
|
|||
ld [de], a
|
||||
call PlayCurrentMoveAnimation2
|
||||
ld hl, wPlayerDisabledMoveNumber
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .printDisableText
|
||||
inc hl ; wEnemyDisabledMoveNumber
|
||||
|
|
@ -1430,7 +1430,7 @@ ParalyzedMayNotAttackText:
|
|||
CheckTargetSubstitute:
|
||||
push hl
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next1
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
|
@ -1442,7 +1442,7 @@ CheckTargetSubstitute:
|
|||
PlayCurrentMoveAnimation2:
|
||||
; animation at MOVENUM will be played unless MOVENUM is 0
|
||||
; plays wAnimationType 3 or 6
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
jr z, .notEnemyTurn
|
||||
|
|
@ -1454,7 +1454,7 @@ PlayCurrentMoveAnimation2:
|
|||
PlayBattleAnimation2:
|
||||
; play animation ID at a and animation type 6 or 3
|
||||
ld [wAnimationID], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $6
|
||||
jr z, .storeAnimationType
|
||||
|
|
@ -1468,7 +1468,7 @@ PlayCurrentMoveAnimation:
|
|||
; resets wAnimationType
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
jr z, .notEnemyTurn
|
||||
|
|
|
|||
|
|
@ -55,15 +55,15 @@ GainExperience:
|
|||
jr .gainStatExpLoop
|
||||
.statExpDone
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [wEnemyMonBaseExp]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [wEnemyMonLevel]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, 7
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
|
||||
|
|
@ -91,12 +91,12 @@ GainExperience:
|
|||
inc hl
|
||||
; add the gained exp to the party mon's exp
|
||||
ld b, [hl]
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [wExpAmountGained + 1], a
|
||||
add b
|
||||
ld [hld], a
|
||||
ld b, [hl]
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld [wExpAmountGained], a
|
||||
adc b
|
||||
ld [hl], a
|
||||
|
|
@ -311,14 +311,14 @@ DivideExpDataByNumMonsGainingExp:
|
|||
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
|
||||
.divideLoop
|
||||
xor a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [hDividend + 1], a
|
||||
ld a, [wd11e]
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $2
|
||||
call Divide ; divide value by number of mons gaining exp
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [hli], a
|
||||
dec c
|
||||
jr nz, .divideLoop
|
||||
|
|
@ -326,17 +326,17 @@ DivideExpDataByNumMonsGainingExp:
|
|||
|
||||
; multiplies exp by 1.5
|
||||
BoostExp:
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld c, a
|
||||
srl b
|
||||
rr c
|
||||
add c
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld [hQuotient + 3], a
|
||||
ld a, [hQuotient + 2]
|
||||
adc b
|
||||
ld [H_QUOTIENT + 2], a
|
||||
ld [hQuotient + 2], a
|
||||
ret
|
||||
|
||||
GainedText:
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ MarowakAnim:
|
|||
call ClearScreenArea
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; disable BG transfer so we don't see the Marowak too soon
|
||||
ld [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
|
||||
; replace ghost pic with Marowak in BG
|
||||
ld a, MAROWAK
|
||||
ld [wChangeMonPicEnemyTurnSpecies], a
|
||||
ld a, $1
|
||||
ld [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
callab ChangeMonPic
|
||||
; alternate between black and light grey 8 times.
|
||||
; this makes the ghost's body appear to flash
|
||||
|
|
@ -44,7 +44,7 @@ MarowakAnim:
|
|||
and a
|
||||
jr nz, .fadeInMarowakLoop
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
|
||||
ld [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
|
||||
call Delay3
|
||||
jp ClearSprites
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ConversionEffect_:
|
||||
ld hl, wEnemyMonType1
|
||||
ld de, wBattleMonType1
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wEnemyBattleStatus1]
|
||||
jr z, .conversionEffect
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ DrainHPEffect_:
|
|||
.getAttackerHP
|
||||
ld hl, wBattleMonHP
|
||||
ld de, wBattleMonMaxHP
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .addDamageToAttackerHP
|
||||
ld hl, wEnemyMonHP
|
||||
|
|
@ -69,7 +69,7 @@ DrainHPEffect_:
|
|||
ld [wHPBarNewHP+1], a
|
||||
inc de
|
||||
.next
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 10, 9
|
||||
ld a, $1
|
||||
|
|
@ -83,7 +83,7 @@ DrainHPEffect_:
|
|||
predef DrawEnemyHUDAndHPBar
|
||||
callab ReadPlayerMonCurHPAndStatus
|
||||
ld hl, SuckedHealthText
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .next3
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
FocusEnergyEffect_:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ HazeEffect_:
|
|||
; cure non-volatile status, but only for the target
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wEnemySelectedMove
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .cureStatuses
|
||||
ld hl, wBattleMonStatus
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
HealEffect_:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld de, wBattleMonHP
|
||||
ld hl, wBattleMonMaxHP
|
||||
|
|
@ -27,7 +27,7 @@ HealEffect_:
|
|||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonStatus
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .restEffect
|
||||
ld hl, wEnemyMonStatus
|
||||
|
|
@ -87,7 +87,7 @@ HealEffect_:
|
|||
.playAnim
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 10, 9
|
||||
ld a, $1
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LeechSeedEffect_:
|
|||
jr nz, .moveMissed
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld de, wEnemyMonType1
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .leechSeedEffect
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
MistEffect_:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .mistEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ OneHitKOEffect_:
|
|||
ld [wCriticalHitOrOHKO], a
|
||||
ld hl, wBattleMonSpeed + 1
|
||||
ld de, wEnemyMonSpeed + 1
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .compareSpeed
|
||||
ld hl, wEnemyMonSpeed + 1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ParalyzeEffect_:
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wPlayerMoveType
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .next
|
||||
ld hl, wBattleMonStatus
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ PayDayEffect_:
|
|||
xor a
|
||||
ld hl, wcd6d
|
||||
ld [hli], a
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wBattleMonLevel]
|
||||
jr z, .payDayEffect
|
||||
|
|
@ -10,28 +10,28 @@ PayDayEffect_:
|
|||
.payDayEffect
|
||||
; level * 2
|
||||
add a
|
||||
ld [H_DIVIDEND + 3], a
|
||||
ld [hDividend + 3], a
|
||||
xor a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [H_DIVIDEND + 2], a
|
||||
ld [hDividend], a
|
||||
ld [hDividend + 1], a
|
||||
ld [hDividend + 2], a
|
||||
; convert to BCD
|
||||
ld a, 100
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [hli], a
|
||||
ld a, [H_REMAINDER]
|
||||
ld [H_DIVIDEND + 3], a
|
||||
ld a, [hRemainder]
|
||||
ld [hDividend + 3], a
|
||||
ld a, 10
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [H_REMAINDER]
|
||||
ld a, [hRemainder]
|
||||
add b
|
||||
ld [hl], a
|
||||
ld de, wTotalPayDayMoney + 2
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
RecoilEffect_:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
ld hl, wBattleMonMaxHP
|
||||
|
|
@ -54,7 +54,7 @@ RecoilEffect_:
|
|||
ld [hl], a
|
||||
.getHPBarCoords
|
||||
coord hl, 10, 9
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .updateHPBar
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ReflectLightScreenEffect_:
|
||||
ld hl, wPlayerBattleStatus3
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .reflectLightScreenEffect
|
||||
ld hl, wEnemyBattleStatus3
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ SubstituteEffect_:
|
|||
ld hl, wBattleMonMaxHP
|
||||
ld de, wPlayerSubstituteHP
|
||||
ld bc, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, wEnemyMonMaxHP
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ TransformEffect_:
|
|||
ld de, wEnemyMonSpecies
|
||||
ld bc, wEnemyBattleStatus3
|
||||
ld a, [wEnemyBattleStatus1]
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .hitTest
|
||||
ld hl, wEnemyMonSpecies
|
||||
|
|
@ -18,7 +18,7 @@ TransformEffect_:
|
|||
push de
|
||||
push bc
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .transformEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
|
@ -64,7 +64,7 @@ TransformEffect_:
|
|||
inc bc
|
||||
inc bc
|
||||
call CopyData
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next
|
||||
; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
|
||||
|
|
@ -128,7 +128,7 @@ TransformEffect_:
|
|||
jp PrintText
|
||||
|
||||
.copyBasedOnTurn
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .gotStatsOrModsToCopy
|
||||
push hl
|
||||
|
|
|
|||
|
|
@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo:
|
|||
|
||||
ScaleLastSpriteColumnByTwo:
|
||||
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
|
||||
ld [H_SPRITEINTERLACECOUNTER], a
|
||||
ld [hSpriteInterlaceCounter], a
|
||||
ld bc, -1
|
||||
.columnInnerLoop
|
||||
ld a, [de]
|
||||
dec de
|
||||
swap a ; only high nybble contains information
|
||||
call ScalePixelsByTwo
|
||||
ld a, [H_SPRITEINTERLACECOUNTER]
|
||||
ld a, [hSpriteInterlaceCounter]
|
||||
dec a
|
||||
ld [H_SPRITEINTERLACECOUNTER], a
|
||||
ld [hSpriteInterlaceCounter], a
|
||||
jr nz, .columnInnerLoop
|
||||
dec de ; skip last 4 rows of new column
|
||||
dec de
|
||||
|
|
|
|||
|
|
@ -655,17 +655,17 @@ AIUseDireHit: ; unused
|
|||
|
||||
AICheckIfHPBelowFraction:
|
||||
; return carry if enemy trainer's current HP is below 1 / a of the maximum
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
ld [H_DIVIDEND], a
|
||||
ld [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [hDividend + 1], a
|
||||
ld b, 2
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld c, a
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
ld b, a
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [hld]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
; does nothing since no stats are ever selected (barring glitches)
|
||||
DoubleSelectedStats:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerStatsToDouble]
|
||||
ld hl, wBattleMonAttack + 1
|
||||
|
|
@ -30,7 +30,7 @@ DoubleSelectedStats:
|
|||
|
||||
; does nothing since no stats are ever selected (barring glitches)
|
||||
HalveSelectedStats:
|
||||
ld a, [H_WHOSETURN]
|
||||
ld a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerStatsToHalve]
|
||||
ld hl, wBattleMonAttack
|
||||
|
|
|
|||
|
|
@ -41,5 +41,5 @@ TestBattle:
|
|||
; do it all again.
|
||||
ld a, 1
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jr .loop
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ DisplayMonFrontSpriteInBox:
|
|||
; Displays a pokemon's front sprite in a pop-up window.
|
||||
; [wcf91] = pokemon internal id number
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hWY], a
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ TownMapText::
|
|||
xor a
|
||||
ld [hWY], a
|
||||
inc a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call LoadFontTilePatterns
|
||||
callba DisplayTownMap
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
ld de, TextScriptEnd
|
||||
push de
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
push af
|
||||
jp CloseTextDisplay
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ HPBarLength:
|
|||
GetHPBarLength:
|
||||
push hl
|
||||
xor a
|
||||
ld hl, H_MULTIPLICAND
|
||||
ld hl, hMultiplicand
|
||||
ld [hli], a
|
||||
ld a, b
|
||||
ld [hli], a
|
||||
|
|
@ -21,22 +21,22 @@ GetHPBarLength:
|
|||
rr e
|
||||
srl d
|
||||
rr e
|
||||
ld a, [H_MULTIPLICAND+1]
|
||||
ld a, [hMultiplicand+1]
|
||||
ld b, a
|
||||
ld a, [H_MULTIPLICAND+2]
|
||||
ld a, [hMultiplicand+2]
|
||||
srl b ; divide multiplication result as well
|
||||
rr a
|
||||
srl b
|
||||
rr a
|
||||
ld [H_MULTIPLICAND+2], a
|
||||
ld [hMultiplicand+2], a
|
||||
ld a, b
|
||||
ld [H_MULTIPLICAND+1], a
|
||||
ld [hMultiplicand+1], a
|
||||
.maxHPSmaller256
|
||||
ld a, e
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_MULTIPLICAND+2]
|
||||
ld a, [hMultiplicand+2]
|
||||
ld e, a ; e = bc * 48 / de (num of pixels of HP bar)
|
||||
pop hl
|
||||
and a
|
||||
|
|
@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber:
|
|||
ld a, [wHPBarOldHP + 1]
|
||||
ld [wHPBarTempHP], a
|
||||
push hl
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
bit 0, a
|
||||
jr z, .asm_fb15
|
||||
ld de, $9
|
||||
|
|
|
|||
|
|
@ -239,14 +239,14 @@ ItemUseBall:
|
|||
|
||||
; Calculate MaxHP * 255.
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [hMultiplicand], a
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, 255
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [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 [H_DIVISOR], a
|
||||
ld [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 [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
|
||||
; If W > 255, store 255 in [H_QUOTIENT + 3].
|
||||
; Let X = min(W, 255) = [H_QUOTIENT + 3].
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
; If W > 255, store 255 in [hQuotient + 3].
|
||||
; Let X = min(W, 255) = [hQuotient + 3].
|
||||
ld a, [hQuotient + 2]
|
||||
and a
|
||||
jr z, .skip3
|
||||
ld a, 255
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld [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, [H_QUOTIENT + 2]
|
||||
ld 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, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
cp b
|
||||
jr c, .failedToCapture
|
||||
|
||||
|
|
@ -318,17 +318,17 @@ ItemUseBall:
|
|||
jr .skipShakeCalculations
|
||||
|
||||
.failedToCapture
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
ld [wPokeBallCaptureCalcTemp], a ; Save X.
|
||||
|
||||
; Calculate CatchRate * 100.
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [wEnemyMonActualCatchRate]
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, 100
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
|
||||
; Determine BallFactor2.
|
||||
|
|
@ -349,26 +349,26 @@ ItemUseBall:
|
|||
.skip4
|
||||
; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y.
|
||||
ld a, b
|
||||
ld [H_DIVISOR], a
|
||||
ld [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, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
and a
|
||||
ld b, $63 ; 3 shakes
|
||||
jr nz, .setAnimData
|
||||
|
||||
; Calculate X * Y.
|
||||
ld a, [wPokeBallCaptureCalcTemp]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
|
||||
; Calculate (X * Y) / 255.
|
||||
ld a, 255
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
|
||||
|
|
@ -386,19 +386,19 @@ ItemUseBall:
|
|||
|
||||
.addAilmentValue
|
||||
; If the Pokémon has a status ailment, add Status2.
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
add b
|
||||
ld [H_QUOTIENT + 3], a
|
||||
ld [hQuotient + 3], a
|
||||
|
||||
.skip5
|
||||
; Finally determine the number of shakes.
|
||||
; Let Z = ((X * Y) / 255) + Status2 = [H_QUOTIENT + 3].
|
||||
; Let Z = ((X * Y) / 255) + Status2 = [hQuotient + 3].
|
||||
; The number of shakes depend on the range Z is in.
|
||||
; 0 ≤ Z < 10: 0 shakes (the ball misses)
|
||||
; 10 ≤ Z < 30: 1 shake
|
||||
; 30 ≤ Z < 70: 2 shakes
|
||||
; 70 ≤ Z: 3 shakes
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld 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 [H_WHOSETURN], a
|
||||
ld [hWhoseTurn], a
|
||||
ld [wAnimationType], a
|
||||
ld [wDamageMultipliers], a
|
||||
ld a, [wWhichPokemon]
|
||||
|
|
@ -1018,18 +1018,18 @@ ItemUseMedicine:
|
|||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld [wHPBarMaxHP + 1], a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP], a
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [hDividend + 1], a
|
||||
ld a, 5
|
||||
ld [H_DIVISOR], a
|
||||
ld [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, [H_QUOTIENT + 3]
|
||||
ld 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, [H_QUOTIENT + 2]
|
||||
ld 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, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
set 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
ld a, $02
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
res 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [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, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
set 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
ld a, $02
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2 ; animate the HP bar lengthening
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
res 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
ld a, REVIVE_MSG
|
||||
ld [wPartyMenuTypeOrMessageID], a
|
||||
ld a, [wcf91]
|
||||
|
|
@ -1224,13 +1224,13 @@ ItemUseMedicine:
|
|||
call PlaySoundWaitForCurrent
|
||||
.showHealingItemMessage
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
dec a
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
call RedrawPartyMenu ; redraws the party menu and displays the message
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
call WaitForTextScrollButtonPress
|
||||
|
|
@ -1459,7 +1459,7 @@ BaitRockCommon:
|
|||
ld [wAnimationID], a
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld [H_WHOSETURN], a
|
||||
ld [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 [H_WHOSETURN], a ; set turn to player's turn
|
||||
ld [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 [H_DIVIDEND + 3], a
|
||||
ld [hDividend + 3], a
|
||||
xor a
|
||||
ld [H_DIVIDEND], a
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [H_DIVIDEND + 2], a
|
||||
ld [hDividend], a
|
||||
ld [hDividend + 1], a
|
||||
ld [hDividend + 2], a
|
||||
ld a, 5
|
||||
ld [H_DIVISOR], a
|
||||
ld [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, [H_QUOTIENT + 3]
|
||||
ld 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
|
||||
|
|
|
|||
|
|
@ -338,10 +338,10 @@ TradeCenter_SelectMon:
|
|||
ld a, 1
|
||||
ld [wTopMenuItemX], a
|
||||
.enemyMonMenu_HandleInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 1, [hl]
|
||||
call HandleMenuInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 1, [hl]
|
||||
and a
|
||||
jp z, .getNewInput
|
||||
|
|
@ -403,10 +403,10 @@ TradeCenter_SelectMon:
|
|||
lb bc, 6, 1
|
||||
call ClearScreenArea
|
||||
.playerMonMenu_HandleInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 1, [hl]
|
||||
call HandleMenuInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 1, [hl]
|
||||
and a ; was anything pressed?
|
||||
jr nz, .playerMonMenu_SomethingPressed
|
||||
|
|
|
|||
|
|
@ -2,142 +2,142 @@ _Multiply::
|
|||
ld a, $8
|
||||
ld b, a
|
||||
xor a
|
||||
ld [H_PRODUCT], a
|
||||
ld [H_MULTIPLYBUFFER], a
|
||||
ld [H_MULTIPLYBUFFER+1], a
|
||||
ld [H_MULTIPLYBUFFER+2], a
|
||||
ld [H_MULTIPLYBUFFER+3], a
|
||||
ld [hProduct], a
|
||||
ld [hMultiplyBuffer], a
|
||||
ld [hMultiplyBuffer+1], a
|
||||
ld [hMultiplyBuffer+2], a
|
||||
ld [hMultiplyBuffer+3], a
|
||||
.loop
|
||||
ld a, [H_MULTIPLIER]
|
||||
ld a, [hMultiplier]
|
||||
srl a
|
||||
ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld [hMultiplier], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
jr nc, .smallMultiplier
|
||||
ld a, [H_MULTIPLYBUFFER+3]
|
||||
ld a, [hMultiplyBuffer+3]
|
||||
ld c, a
|
||||
ld a, [H_MULTIPLICAND+2]
|
||||
ld a, [hMultiplicand+2]
|
||||
add c
|
||||
ld [H_MULTIPLYBUFFER+3], a
|
||||
ld a, [H_MULTIPLYBUFFER+2]
|
||||
ld [hMultiplyBuffer+3], a
|
||||
ld a, [hMultiplyBuffer+2]
|
||||
ld c, a
|
||||
ld a, [H_MULTIPLICAND+1]
|
||||
ld a, [hMultiplicand+1]
|
||||
adc c
|
||||
ld [H_MULTIPLYBUFFER+2], a
|
||||
ld a, [H_MULTIPLYBUFFER+1]
|
||||
ld [hMultiplyBuffer+2], a
|
||||
ld a, [hMultiplyBuffer+1]
|
||||
ld c, a
|
||||
ld a, [H_MULTIPLICAND] ; (aliases: H_MULTIPLICAND)
|
||||
ld a, [hMultiplicand] ; (aliases: hMultiplicand)
|
||||
adc c
|
||||
ld [H_MULTIPLYBUFFER+1], a
|
||||
ld a, [H_MULTIPLYBUFFER]
|
||||
ld [hMultiplyBuffer+1], a
|
||||
ld a, [hMultiplyBuffer]
|
||||
ld c, a
|
||||
ld a, [H_PRODUCT] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
|
||||
ld a, [hProduct] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
|
||||
adc c
|
||||
ld [H_MULTIPLYBUFFER], a
|
||||
ld [hMultiplyBuffer], a
|
||||
.smallMultiplier
|
||||
dec b
|
||||
jr z, .done
|
||||
ld a, [H_MULTIPLICAND+2]
|
||||
ld a, [hMultiplicand+2]
|
||||
sla a
|
||||
ld [H_MULTIPLICAND+2], a
|
||||
ld a, [H_MULTIPLICAND+1]
|
||||
ld [hMultiplicand+2], a
|
||||
ld a, [hMultiplicand+1]
|
||||
rl a
|
||||
ld [H_MULTIPLICAND+1], a
|
||||
ld a, [H_MULTIPLICAND]
|
||||
ld [hMultiplicand+1], a
|
||||
ld a, [hMultiplicand]
|
||||
rl a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld a, [H_PRODUCT]
|
||||
ld [hMultiplicand], a
|
||||
ld a, [hProduct]
|
||||
rl a
|
||||
ld [H_PRODUCT], a
|
||||
ld [hProduct], a
|
||||
jr .loop
|
||||
.done
|
||||
ld a, [H_MULTIPLYBUFFER+3]
|
||||
ld [H_PRODUCT+3], a
|
||||
ld a, [H_MULTIPLYBUFFER+2]
|
||||
ld [H_PRODUCT+2], a
|
||||
ld a, [H_MULTIPLYBUFFER+1]
|
||||
ld [H_PRODUCT+1], a
|
||||
ld a, [H_MULTIPLYBUFFER]
|
||||
ld [H_PRODUCT], a
|
||||
ld a, [hMultiplyBuffer+3]
|
||||
ld [hProduct+3], a
|
||||
ld a, [hMultiplyBuffer+2]
|
||||
ld [hProduct+2], a
|
||||
ld a, [hMultiplyBuffer+1]
|
||||
ld [hProduct+1], a
|
||||
ld a, [hMultiplyBuffer]
|
||||
ld [hProduct], a
|
||||
ret
|
||||
|
||||
_Divide::
|
||||
xor a
|
||||
ld [H_DIVIDEBUFFER], a
|
||||
ld [H_DIVIDEBUFFER+1], a
|
||||
ld [H_DIVIDEBUFFER+2], a
|
||||
ld [H_DIVIDEBUFFER+3], a
|
||||
ld [H_DIVIDEBUFFER+4], a
|
||||
ld [hDivideBuffer], a
|
||||
ld [hDivideBuffer+1], a
|
||||
ld [hDivideBuffer+2], a
|
||||
ld [hDivideBuffer+3], a
|
||||
ld [hDivideBuffer+4], a
|
||||
ld a, $9
|
||||
ld e, a
|
||||
.asm_37db3
|
||||
ld a, [H_DIVIDEBUFFER]
|
||||
ld a, [hDivideBuffer]
|
||||
ld c, a
|
||||
ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND)
|
||||
ld a, [hDividend+1] ; (aliases: hMultiplicand)
|
||||
sub c
|
||||
ld d, a
|
||||
ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
ld c, a
|
||||
ld a, [H_DIVIDEND] ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
|
||||
ld a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
|
||||
sbc c
|
||||
jr c, .asm_37dce
|
||||
ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
|
||||
ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
|
||||
ld a, d
|
||||
ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND)
|
||||
ld a, [H_DIVIDEBUFFER+4]
|
||||
ld [hDividend+1], a ; (aliases: hMultiplicand)
|
||||
ld a, [hDivideBuffer+4]
|
||||
inc a
|
||||
ld [H_DIVIDEBUFFER+4], a
|
||||
ld [hDivideBuffer+4], a
|
||||
jr .asm_37db3
|
||||
.asm_37dce
|
||||
ld a, b
|
||||
cp $1
|
||||
jr z, .asm_37e18
|
||||
ld a, [H_DIVIDEBUFFER+4]
|
||||
ld a, [hDivideBuffer+4]
|
||||
sla a
|
||||
ld [H_DIVIDEBUFFER+4], a
|
||||
ld a, [H_DIVIDEBUFFER+3]
|
||||
ld [hDivideBuffer+4], a
|
||||
ld a, [hDivideBuffer+3]
|
||||
rl a
|
||||
ld [H_DIVIDEBUFFER+3], a
|
||||
ld a, [H_DIVIDEBUFFER+2]
|
||||
ld [hDivideBuffer+3], a
|
||||
ld a, [hDivideBuffer+2]
|
||||
rl a
|
||||
ld [H_DIVIDEBUFFER+2], a
|
||||
ld a, [H_DIVIDEBUFFER+1]
|
||||
ld [hDivideBuffer+2], a
|
||||
ld a, [hDivideBuffer+1]
|
||||
rl a
|
||||
ld [H_DIVIDEBUFFER+1], a
|
||||
ld [hDivideBuffer+1], a
|
||||
dec e
|
||||
jr nz, .asm_37e04
|
||||
ld a, $8
|
||||
ld e, a
|
||||
ld a, [H_DIVIDEBUFFER]
|
||||
ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld a, [hDivideBuffer]
|
||||
ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
xor a
|
||||
ld [H_DIVIDEBUFFER], a
|
||||
ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND)
|
||||
ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
|
||||
ld a, [H_DIVIDEND+2]
|
||||
ld [H_DIVIDEND+1], a ; (aliases: H_MULTIPLICAND)
|
||||
ld a, [H_DIVIDEND+3]
|
||||
ld [H_DIVIDEND+2], a
|
||||
ld [hDivideBuffer], a
|
||||
ld a, [hDividend+1] ; (aliases: hMultiplicand)
|
||||
ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
|
||||
ld a, [hDividend+2]
|
||||
ld [hDividend+1], a ; (aliases: hMultiplicand)
|
||||
ld a, [hDividend+3]
|
||||
ld [hDividend+2], a
|
||||
.asm_37e04
|
||||
ld a, e
|
||||
cp $1
|
||||
jr nz, .asm_37e0a
|
||||
dec b
|
||||
.asm_37e0a
|
||||
ld a, [H_DIVISOR] ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
srl a
|
||||
ld [H_DIVISOR], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld a, [H_DIVIDEBUFFER]
|
||||
ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
ld a, [hDivideBuffer]
|
||||
rr a
|
||||
ld [H_DIVIDEBUFFER], a
|
||||
ld [hDivideBuffer], a
|
||||
jr .asm_37db3
|
||||
.asm_37e18
|
||||
ld a, [H_DIVIDEND+1] ; (aliases: H_MULTIPLICAND)
|
||||
ld [H_REMAINDER], a ; (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
|
||||
ld a, [H_DIVIDEBUFFER+4]
|
||||
ld [H_QUOTIENT+3], a
|
||||
ld a, [H_DIVIDEBUFFER+3]
|
||||
ld [H_QUOTIENT+2], a
|
||||
ld a, [H_DIVIDEBUFFER+2]
|
||||
ld [H_QUOTIENT+1], a ; (aliases: H_MULTIPLICAND)
|
||||
ld a, [H_DIVIDEBUFFER+1]
|
||||
ld [H_DIVIDEND], a ; (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
|
||||
ld a, [hDividend+1] ; (aliases: hMultiplicand)
|
||||
ld [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
|
||||
ld a, [hDivideBuffer+4]
|
||||
ld [hQuotient+3], a
|
||||
ld a, [hDivideBuffer+3]
|
||||
ld [hQuotient+2], a
|
||||
ld a, [hDivideBuffer+2]
|
||||
ld [hQuotient+1], a ; (aliases: hMultiplicand)
|
||||
ld a, [hDivideBuffer+1]
|
||||
ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -74,5 +74,5 @@ DisplayTextIDInit::
|
|||
ld [hWY], a ; put the window on the screen
|
||||
call LoadFontTilePatterns
|
||||
ld a, $01
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; enable continuous WRAM to VRAM transfer each V-blank
|
||||
ld [hAutoBGTransferEnabled], a ; enable continuous WRAM to VRAM transfer each V-blank
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ CableClubOptionsText:
|
|||
|
||||
DisplayContinueGameInfo:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 4, 7
|
||||
ld b, 8
|
||||
ld c, 14
|
||||
|
|
@ -360,13 +360,13 @@ DisplayContinueGameInfo:
|
|||
coord hl, 13, 15
|
||||
call PrintPlayTime
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld c, 30
|
||||
jp DelayFrames
|
||||
|
||||
PrintSaveScreenText:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 4, 0
|
||||
ld b, $8
|
||||
ld c, $e
|
||||
|
|
@ -386,7 +386,7 @@ PrintSaveScreenText:
|
|||
coord hl, 13, 8
|
||||
call PrintPlayTime
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld c, 30
|
||||
jp DelayFrames
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ DisplayOptionMenu:
|
|||
ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
|
||||
ld [wTopMenuItemX], a
|
||||
ld a, $01
|
||||
ld [H_AUTOBGTRANSFERENABLED], a ; enable auto background transfer
|
||||
ld [hAutoBGTransferEnabled], a ; enable auto background transfer
|
||||
call Delay3
|
||||
.loop
|
||||
call PlaceMenuCursor
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ ED_TileEnd:
|
|||
|
||||
PrintAlphabet:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [wAlphabetCase]
|
||||
and a
|
||||
ld de, LowerCaseAlphabet
|
||||
|
|
@ -362,7 +362,7 @@ PrintAlphabet:
|
|||
jr nz, .outerLoop
|
||||
call PlaceString
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jp Delay3
|
||||
|
||||
INCLUDE "data/text/alphabets.asm"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
; f8: leveled up
|
||||
DrawPartyMenu_::
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
call UpdateSprites
|
||||
callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics
|
||||
|
|
@ -88,14 +88,14 @@ RedrawPartyMenu_::
|
|||
pop hl
|
||||
push hl
|
||||
ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
set 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
add hl, bc
|
||||
predef DrawHP2 ; draw HP bar and prints current / max HP
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
res 0, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
call SetPartyMenuHPBarColor ; color the HP bar (on SGB)
|
||||
pop hl
|
||||
jr .printLevel
|
||||
|
|
@ -213,7 +213,7 @@ RedrawPartyMenu_::
|
|||
pop af
|
||||
ld [hl], a
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
jp GBPalNormal
|
||||
.printItemUseMessage
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ HandlePokedexSideMenu:
|
|||
; sets carry flag if player presses A, unsets carry flag if player presses B
|
||||
HandlePokedexListMenu:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
; draw the horizontal line separating the seen and owned amounts from the menu
|
||||
coord hl, 15, 8
|
||||
ld a, "─"
|
||||
|
|
@ -216,7 +216,7 @@ HandlePokedexListMenu:
|
|||
ld [wDexMaxSeenMon], a
|
||||
.loop
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 4, 2
|
||||
lb bc, 14, 10
|
||||
call ClearScreenArea
|
||||
|
|
@ -280,7 +280,7 @@ HandlePokedexListMenu:
|
|||
dec d
|
||||
jr nz, .printPokemonLoop
|
||||
ld a, 01
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
call GBPalNormal
|
||||
call HandleMenuInput
|
||||
|
|
|
|||
|
|
@ -351,10 +351,10 @@ ChangeBox::
|
|||
call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM
|
||||
call DisplayChangeBoxMenu
|
||||
call UpdateSprites
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 1, [hl]
|
||||
call HandleMenuInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 1, [hl]
|
||||
bit 1, a ; pressed b
|
||||
ret nz
|
||||
|
|
@ -420,7 +420,7 @@ CopyBoxToOrFromSRAM:
|
|||
|
||||
DisplayChangeBoxMenu:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, A_BUTTON | B_BUTTON
|
||||
ld [wMenuWatchedKeys], a
|
||||
ld a, 11
|
||||
|
|
@ -445,12 +445,12 @@ DisplayChangeBoxMenu:
|
|||
ld b, 12
|
||||
ld c, 7
|
||||
call TextBoxBorder
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 2, [hl]
|
||||
ld de, BoxNames
|
||||
coord hl, 13, 1
|
||||
call PlaceString
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 2, [hl]
|
||||
ld a, [wCurrentBoxNum]
|
||||
and $7f
|
||||
|
|
@ -486,7 +486,7 @@ DisplayChangeBoxMenu:
|
|||
dec a
|
||||
jr nz, .loop
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
ChooseABoxText:
|
||||
|
|
|
|||
|
|
@ -239,21 +239,21 @@ StartMenu_Pokemon::
|
|||
ld bc, wPartyMon2 - wPartyMon1
|
||||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld [H_DIVIDEND], a
|
||||
ld [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [H_DIVIDEND + 1], a
|
||||
ld [hDividend + 1], a
|
||||
ld a, 5
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, 2 ; number of bytes
|
||||
call Divide
|
||||
ld bc, wPartyMon1HP - wPartyMon1MaxHP
|
||||
add hl, bc
|
||||
ld a, [hld]
|
||||
ld b, a
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
sub b
|
||||
ld b, [hl]
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
sbc b
|
||||
jp nc, .notHealthyEnough
|
||||
ld a, [wPartyAndBillsPCSavedMenuItem]
|
||||
|
|
@ -648,7 +648,7 @@ StartMenu_SaveReset::
|
|||
|
||||
StartMenu_Option::
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
call UpdateSprites
|
||||
callab DisplayOptionMenu
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ FadeInCreditsText:
|
|||
|
||||
DisplayCreditsMon:
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call SaveScreenTilesToBuffer1
|
||||
call FillMiddleOfScreenWithWhite
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ DisplayCreditsMon:
|
|||
ld hl, vBGMap0 + $c
|
||||
call CreditsCopyTileMapToVRAM
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call LoadScreenTilesFromBuffer1
|
||||
ld hl, vBGMap0
|
||||
call CreditsCopyTileMapToVRAM
|
||||
|
|
@ -138,11 +138,11 @@ HoFGBPalettes:
|
|||
|
||||
CreditsCopyTileMapToVRAM:
|
||||
ld a, l
|
||||
ld [H_AUTOBGTRANSFERDEST], a
|
||||
ld [hAutoBGTransferDest], a
|
||||
ld a, h
|
||||
ld [H_AUTOBGTRANSFERDEST + 1], a
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jp Delay3
|
||||
|
||||
ZeroMemory:
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ EvolveMon:
|
|||
ld [wNewSoundID], a
|
||||
call PlaySound
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, SFX_TINK
|
||||
call PlaySound
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld [hTilesetType], a
|
||||
ld a, [wEvoOldSpecies]
|
||||
ld [wWholeScreenPaletteMonSpecies], a
|
||||
|
|
@ -37,7 +37,7 @@ EvolveMon:
|
|||
ld [wd0b5], a
|
||||
call Evolution_LoadPic
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [wEvoOldSpecies]
|
||||
call PlayCry
|
||||
call WaitForSoundToFinish
|
||||
|
|
@ -117,7 +117,7 @@ Evolution_BackAndForthAnim:
|
|||
Evolution_ChangeMonPic:
|
||||
push bc
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 7, 2
|
||||
lb bc, 7, 7
|
||||
ld de, SCREEN_WIDTH - 7
|
||||
|
|
@ -134,7 +134,7 @@ Evolution_ChangeMonPic:
|
|||
dec b
|
||||
jr nz, .loop
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
pop bc
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ AnimateHallOfFame:
|
|||
ld [wLetterPrintingDelayFlags], a ; no delay
|
||||
ld [wHoFMonOrPlayer], a ; mon
|
||||
inc a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld hl, wNumHoFTeams
|
||||
ld a, [hl]
|
||||
inc a
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ PlayIntro:
|
|||
xor a
|
||||
ld [hJoyHeld], a
|
||||
inc a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call PlayShootingStar
|
||||
call PlayIntroScene
|
||||
call GBFadeOutToWhite
|
||||
xor a
|
||||
ld [hSCX], a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearSprites
|
||||
call DelayFrame
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -104,12 +104,12 @@ OakSpeech:
|
|||
ld hl, OakSpeechText3
|
||||
call PrintText
|
||||
.next
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
push af
|
||||
ld a, SFX_SHRINK
|
||||
call PlaySound
|
||||
pop af
|
||||
ld [H_LOADEDROMBANK], a
|
||||
ld [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
ld c, 4
|
||||
call DelayFrames
|
||||
|
|
@ -126,7 +126,7 @@ OakSpeech:
|
|||
lb bc, BANK(ShrinkPic2), $00
|
||||
call IntroDisplayPicCenteredOrUpperRight
|
||||
call ResetPlayerSpriteData
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
push af
|
||||
ld a, BANK(Music_PalletTown)
|
||||
ld [wAudioROMBank], a
|
||||
|
|
@ -137,7 +137,7 @@ OakSpeech:
|
|||
ld [wNewSoundID], a
|
||||
call PlaySound
|
||||
pop af
|
||||
ld [H_LOADEDROMBANK], a
|
||||
ld [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
ld c, 20
|
||||
call DelayFrames
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ OakSpeechSlidePicCommon:
|
|||
ld e, l
|
||||
.loop
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [hSlideDirection]
|
||||
and a
|
||||
jr nz, .slideLeft
|
||||
|
|
@ -134,7 +134,7 @@ OakSpeechSlidePicCommon:
|
|||
ld [hl], a
|
||||
.next3
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
ld a, [hSlidingRegionSize]
|
||||
ld c, a
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ SetDefaultNamesBeforeTitlescreen::
|
|||
DisplayTitleScreen:
|
||||
call GBPalWhiteOut
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
xor a
|
||||
ld [hTilesetType], a
|
||||
ld [hSCX], a
|
||||
|
|
@ -239,7 +239,7 @@ ENDC
|
|||
xor a
|
||||
ld [hWY], a
|
||||
inc a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
ld a, vBGMap0 / $100
|
||||
call TitleScreenCopyTileMapToVRAM
|
||||
|
|
@ -358,7 +358,7 @@ LoadTitleMonSprite:
|
|||
jp LoadFrontSpriteByMonIndex
|
||||
|
||||
TitleScreenCopyTileMapToVRAM:
|
||||
ld [H_AUTOBGTRANSFERDEST + 1], a
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
jp Delay3
|
||||
|
||||
LoadCopyrightAndTextBoxTiles:
|
||||
|
|
|
|||
|
|
@ -137,10 +137,10 @@ Trade_Delay100:
|
|||
|
||||
Trade_CopyTileMapToVRAM:
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
Trade_Delay80:
|
||||
|
|
@ -184,7 +184,7 @@ LoadTradingGFXAndMonNames:
|
|||
ld [rOBP0], a
|
||||
call EnableLCD
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [wTradedPlayerMonSpecies]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
|
|
@ -231,7 +231,7 @@ Trade_ShowPlayerMon:
|
|||
ld [rWX], a
|
||||
ld [hSCX], a
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 4, 0
|
||||
ld b, 6
|
||||
ld c, 10
|
||||
|
|
@ -261,7 +261,7 @@ Trade_ShowPlayerMon:
|
|||
ld a, [wTradedPlayerMonSpecies]
|
||||
call PlayCry
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
Trade_DrawOpenEndOfLinkCable:
|
||||
|
|
@ -336,13 +336,13 @@ Trade_AnimateBallEnteringLinkCable:
|
|||
.ballSpriteReachedEdgeOfScreen
|
||||
call ClearSprites
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
ld b, $98
|
||||
call CopyScreenTileBufferToVRAM
|
||||
call Delay3
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
Trade_BallInsideLinkCableOAM:
|
||||
|
|
@ -360,13 +360,13 @@ Trade_ShowEnemyMon:
|
|||
call Trade_PrintEnemyMonInfoText
|
||||
call Trade_CopyTileMapToVRAM
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [wTradedEnemyMonSpecies]
|
||||
call Trade_LoadMonSprite
|
||||
ld a, TRADE_BALL_POOF_ANIM
|
||||
call Trade_ShowAnimation
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, [wTradedEnemyMonSpecies]
|
||||
call PlayCry
|
||||
call Trade_Delay100
|
||||
|
|
@ -397,7 +397,7 @@ Trade_AnimLeftToRight:
|
|||
ld b, $6
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Trade_DrawCableAcrossScreen
|
||||
ld b, $4
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
|
|
@ -405,7 +405,7 @@ Trade_AnimLeftToRight:
|
|||
ld b, $6
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Trade_AnimMonMoveVertical
|
||||
jp ClearSprites
|
||||
|
||||
|
|
@ -430,7 +430,7 @@ Trade_AnimRightToLeft:
|
|||
ld b, $6
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Trade_DrawCableAcrossScreen
|
||||
ld b, $4
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
|
|
@ -438,16 +438,16 @@ Trade_AnimRightToLeft:
|
|||
ld b, $6
|
||||
call Trade_AnimMonMoveHorizontal
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
jp ClearSprites
|
||||
|
||||
Trade_InitGameboyTransferGfx:
|
||||
; Initialises the graphics for showing a mon moving between gameboys.
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Trade_LoadMonPartySpriteGfx
|
||||
call DelayFrame
|
||||
ld a, %10101011
|
||||
|
|
@ -731,9 +731,9 @@ Trade_LoadMonSprite:
|
|||
ld b, SET_PAL_POKEMON_WHOLE_SCREEN
|
||||
ld c, 0
|
||||
call RunPaletteCommand
|
||||
ld a, [H_AUTOBGTRANSFERENABLED]
|
||||
ld a, [hAutoBGTransferEnabled]
|
||||
xor $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call GetMonHeader
|
||||
coord hl, 7, 2
|
||||
call LoadFlippedFrontSpriteByMonIndex
|
||||
|
|
@ -743,7 +743,7 @@ Trade_LoadMonSprite:
|
|||
Trade_ShowClearedWindow:
|
||||
; clears the window and covers the BG entirely with the window
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
ld a, %11100011
|
||||
ld [rLCDC], a
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ PalletMovementScript_OakMoveLeft:
|
|||
call FillMemory
|
||||
ld [hl], $ff
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
ld de, wNPCMovementDirections2
|
||||
call MoveSprite
|
||||
ld a, $1
|
||||
|
|
@ -282,7 +282,7 @@ FreezeEnemyTrainerSprite::
|
|||
jr .loop
|
||||
.notRival
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
jp SetSpriteMovementBytesToFF
|
||||
|
||||
RivalIDs:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ ClearVariablesOnEnterMap::
|
|||
ld [hWY], a
|
||||
ld [rWY], a
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld [wStepCounter], a
|
||||
ld [wLoneAttackNo], a
|
||||
ld [hJoyPressed], a
|
||||
|
|
|
|||
|
|
@ -31,19 +31,19 @@ LoadMissableObjects:
|
|||
sub d
|
||||
ld h, a
|
||||
ld a, h
|
||||
ld [H_DIVIDEND], a
|
||||
ld [hDividend], a
|
||||
ld a, l
|
||||
ld [H_DIVIDEND+1], a
|
||||
ld [hDividend+1], a
|
||||
xor a
|
||||
ld [H_DIVIDEND+2], a
|
||||
ld [H_DIVIDEND+3], a
|
||||
ld [hDividend+2], a
|
||||
ld [hDividend+3], a
|
||||
ld a, $3
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $2
|
||||
call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours)
|
||||
ld a, [wCurMap]
|
||||
ld b, a
|
||||
ld a, [H_DIVIDEND+3]
|
||||
ld a, [hDividend+3]
|
||||
ld c, a ; store global offset in c
|
||||
ld de, wMissableObjectList
|
||||
pop hl
|
||||
|
|
@ -99,7 +99,7 @@ InitializeMissableObjectsFlags:
|
|||
|
||||
; tests if current sprite is a missable object that is hidden/has been removed
|
||||
IsObjectHidden:
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
swap a
|
||||
ld b, a
|
||||
ld hl, wMissableObjectList
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ UpdatePlayerSprite:
|
|||
ld a, [wd736]
|
||||
bit 7, a ; is the player sprite spinning due to a spin tile?
|
||||
jr nz, .skipSpriteAnim
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $7
|
||||
ld l, a
|
||||
ld a, [hl]
|
||||
|
|
@ -103,7 +103,7 @@ UpdatePlayerSprite:
|
|||
UnusedReadSpriteDataFunction:
|
||||
push bc
|
||||
push af
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
ld c, a
|
||||
pop af
|
||||
add c
|
||||
|
|
@ -112,7 +112,7 @@ UnusedReadSpriteDataFunction:
|
|||
ret
|
||||
|
||||
UpdateNPCSprite:
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
swap a
|
||||
dec a
|
||||
add a
|
||||
|
|
@ -122,7 +122,7 @@ UpdateNPCSprite:
|
|||
ld a, [hl] ; read movement byte 2
|
||||
ld [wCurSpriteMovement2], a
|
||||
ld h, $c1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
ld l, a
|
||||
inc l
|
||||
ld a, [hl] ; c1x1
|
||||
|
|
@ -131,7 +131,7 @@ UpdateNPCSprite:
|
|||
call CheckSpriteAvailability
|
||||
ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking
|
||||
ld h, $c1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
ld l, a
|
||||
inc l
|
||||
ld a, [hl] ; c1x1
|
||||
|
|
@ -151,7 +151,7 @@ UpdateNPCSprite:
|
|||
ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability)
|
||||
call InitializeSpriteScreenPosition
|
||||
ld h, $c2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $6
|
||||
ld l, a
|
||||
ld a, [hl] ; c2x6: movement byte 1
|
||||
|
|
@ -264,11 +264,11 @@ ChangeFacingDirection:
|
|||
TryWalking:
|
||||
push hl
|
||||
ld h, $c1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $9
|
||||
ld l, a
|
||||
ld [hl], c ; c1x9 (update facing direction)
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $3
|
||||
ld l, a
|
||||
ld [hl], d ; c1x3 (update Y movement delta)
|
||||
|
|
@ -282,7 +282,7 @@ TryWalking:
|
|||
pop de
|
||||
ret c ; cannot walk there (reinitialization of delay values already done)
|
||||
ld h, $c2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $4
|
||||
ld l, a
|
||||
ld a, [hl] ; c2x4: Y position
|
||||
|
|
@ -291,7 +291,7 @@ TryWalking:
|
|||
ld a, [hl] ; c2x5: X position
|
||||
add e
|
||||
ld [hl], a ; update X position
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
ld l, a
|
||||
ld [hl], $10 ; c2x0=16: walk animation counter
|
||||
dec h
|
||||
|
|
@ -301,7 +301,7 @@ TryWalking:
|
|||
|
||||
; update the walking animation parameters for a sprite that is currently walking
|
||||
UpdateSpriteInWalkingAnimation:
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $7
|
||||
ld l, a
|
||||
ld a, [hl] ; c1x7 (counter until next walk animation frame)
|
||||
|
|
@ -317,7 +317,7 @@ UpdateSpriteInWalkingAnimation:
|
|||
and $3
|
||||
ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step)
|
||||
.noNextAnimationFrame
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $3
|
||||
ld l, a
|
||||
ld a, [hli] ; c1x3 (movement Y delta)
|
||||
|
|
@ -330,7 +330,7 @@ UpdateSpriteInWalkingAnimation:
|
|||
ld a, [hl] ; c1x6 (screen X position)
|
||||
add b
|
||||
ld [hl], a ; update screen X position
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
ld l, a
|
||||
inc h
|
||||
ld a, [hl] ; c2x0 (walk animation counter)
|
||||
|
|
@ -343,7 +343,7 @@ UpdateSpriteInWalkingAnimation:
|
|||
ld a, [hl] ; c2x6 (movement byte 1)
|
||||
cp $fe
|
||||
jr nc, .initNextMovementCounter ; values $fe and $ff
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
inc a
|
||||
ld l, a
|
||||
dec h
|
||||
|
|
@ -351,14 +351,14 @@ UpdateSpriteInWalkingAnimation:
|
|||
ret
|
||||
.initNextMovementCounter
|
||||
call Random
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $8
|
||||
ld l, a
|
||||
ld a, [hRandomAdd]
|
||||
and $7f
|
||||
ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f]
|
||||
dec h ; note that value 0 actually makes the delay $100 (bug?)
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
inc a
|
||||
ld l, a
|
||||
ld [hl], $2 ; c1x1 = 2 (movement status)
|
||||
|
|
@ -375,7 +375,7 @@ UpdateSpriteInWalkingAnimation:
|
|||
; update delay value (c2x8) for sprites in the delayed state (c1x1)
|
||||
UpdateSpriteMovementDelay:
|
||||
ld h, $c2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $6
|
||||
ld l, a
|
||||
ld a, [hl] ; c2x6: movement byte 1
|
||||
|
|
@ -390,13 +390,13 @@ UpdateSpriteMovementDelay:
|
|||
jr nz, notYetMoving
|
||||
.moving
|
||||
dec h
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
inc a
|
||||
ld l, a
|
||||
ld [hl], $1 ; c1x1 = 1 (mark as ready to move)
|
||||
notYetMoving:
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $8
|
||||
ld l, a
|
||||
ld [hl], $0 ; c1x8 = 0 (walk animation frame)
|
||||
|
|
@ -429,7 +429,7 @@ MakeNPCFacePlayer:
|
|||
.notFacingRight
|
||||
ld c, SPRITE_FACING_LEFT
|
||||
.facingDirectionDetermined
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $9
|
||||
ld l, a
|
||||
ld [hl], c ; c1x9: set facing direction
|
||||
|
|
@ -440,7 +440,7 @@ InitializeSpriteStatus:
|
|||
inc l
|
||||
ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen)
|
||||
inc h
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld a, $8
|
||||
|
|
@ -451,7 +451,7 @@ InitializeSpriteStatus:
|
|||
; calculates the sprite's screen position form its map position and the player position
|
||||
InitializeSpriteScreenPosition:
|
||||
ld h, wSpriteStateData2 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $4
|
||||
ld l, a
|
||||
ld a, [wYCoord]
|
||||
|
|
@ -479,13 +479,13 @@ CheckSpriteAvailability:
|
|||
and a
|
||||
jp nz, .spriteInvisible
|
||||
ld h, wSpriteStateData2 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $6
|
||||
ld l, a
|
||||
ld a, [hl] ; c2x6: movement byte 1
|
||||
cp $fe
|
||||
jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted)
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $4
|
||||
ld l, a
|
||||
ld b, [hl] ; c2x4: Y pos (+4)
|
||||
|
|
@ -527,7 +527,7 @@ CheckSpriteAvailability:
|
|||
jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile)
|
||||
.spriteInvisible
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld [hl], $ff ; c1x2
|
||||
|
|
@ -540,7 +540,7 @@ CheckSpriteAvailability:
|
|||
jr nz, .done ; if player is currently walking, we're done
|
||||
call UpdateSpriteImage
|
||||
inc h
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $7
|
||||
ld l, a
|
||||
ld a, [wGrassTile]
|
||||
|
|
@ -556,7 +556,7 @@ CheckSpriteAvailability:
|
|||
|
||||
UpdateSpriteImage:
|
||||
ld h, $c1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $8
|
||||
ld l, a
|
||||
ld a, [hli] ; c1x8: walk animation frame
|
||||
|
|
@ -567,7 +567,7 @@ UpdateSpriteImage:
|
|||
ld a, [$ff93] ; current sprite offset
|
||||
add b
|
||||
ld b, a
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld [hl], b ; c1x2: sprite to display
|
||||
|
|
@ -581,7 +581,7 @@ UpdateSpriteImage:
|
|||
; set carry on failure, clears carry on success
|
||||
CanWalkOntoTile:
|
||||
ld h, wSpriteStateData2 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $6
|
||||
ld l, a
|
||||
ld a, [hl] ; c2x6 (movement byte 1)
|
||||
|
|
@ -602,14 +602,14 @@ CanWalkOntoTile:
|
|||
cp c
|
||||
jr nz, .tilePassableLoop
|
||||
ld h, $c2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $6
|
||||
ld l, a
|
||||
ld a, [hl] ; $c2x6 (movement byte 1)
|
||||
inc a
|
||||
jr z, .impassable ; if $ff, no movement allowed (however, changing direction is)
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $4
|
||||
ld l, a
|
||||
ld a, [hli] ; c1x4 (screen Y pos)
|
||||
|
|
@ -628,14 +628,14 @@ CanWalkOntoTile:
|
|||
pop bc
|
||||
pop de
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $c
|
||||
ld l, a
|
||||
ld a, [hl] ; c1xc (directions in which sprite collision would occur)
|
||||
and b ; check against chosen direction (1,2,4 or 8)
|
||||
jr nz, .impassable ; collision between sprites, don't go there
|
||||
ld h, wSpriteStateData2 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go)
|
||||
|
|
@ -666,7 +666,7 @@ CanWalkOntoTile:
|
|||
ret
|
||||
.impassable
|
||||
ld h, $c1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
inc a
|
||||
ld l, a
|
||||
ld [hl], $2 ; c1x1 = 2 (set movement status to delayed)
|
||||
|
|
@ -677,7 +677,7 @@ CanWalkOntoTile:
|
|||
inc l
|
||||
ld [hl], a ; c1x5 = 0 (clear X movement delta)
|
||||
inc h
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $8
|
||||
ld l, a
|
||||
call Random
|
||||
|
|
@ -692,7 +692,7 @@ CanWalkOntoTile:
|
|||
; hl: output pointer
|
||||
GetTileSpriteStandsOn:
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $4
|
||||
ld l, a
|
||||
ld a, [hli] ; c1x4: screen Y position
|
||||
|
|
@ -784,7 +784,7 @@ DoScriptedNPCMovement:
|
|||
ld a, [hl]
|
||||
add b
|
||||
ld [hl], a
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $9
|
||||
ld l, a
|
||||
ld a, c
|
||||
|
|
@ -817,7 +817,7 @@ GetSpriteScreenXPointer:
|
|||
|
||||
GetSpriteScreenXYPointerCommon:
|
||||
ld hl, wSpriteStateData1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add l
|
||||
add b
|
||||
ld l, a
|
||||
|
|
@ -825,7 +825,7 @@ GetSpriteScreenXYPointerCommon:
|
|||
|
||||
AnimScriptedNPCMovement:
|
||||
ld hl, wSpriteStateData2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $e
|
||||
ld l, a
|
||||
ld a, [hl] ; VRAM slot
|
||||
|
|
@ -833,7 +833,7 @@ AnimScriptedNPCMovement:
|
|||
swap a
|
||||
ld b, a
|
||||
ld hl, wSpriteStateData1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $9
|
||||
ld l, a
|
||||
ld a, [hl] ; facing direction
|
||||
|
|
@ -852,7 +852,7 @@ AnimScriptedNPCMovement:
|
|||
ld [hSpriteVRAMSlotAndFacing], a
|
||||
call AdvanceScriptedNPCAnimFrameCounter
|
||||
ld hl, wSpriteStateData1
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld a, [hSpriteVRAMSlotAndFacing]
|
||||
|
|
@ -863,7 +863,7 @@ AnimScriptedNPCMovement:
|
|||
ret
|
||||
|
||||
AdvanceScriptedNPCAnimFrameCounter:
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $7
|
||||
ld l, a
|
||||
ld a, [hl] ; intra-animation frame counter
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ DoBoulderDustAnimation::
|
|||
call ResetBoulderPushFlags
|
||||
set 7, [hl]
|
||||
ld a, [wBoulderSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
call GetSpriteMovementByte2Pointer
|
||||
ld [hl], $10
|
||||
ld a, SFX_CUT
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ _UpdateSprites::
|
|||
ld l, a
|
||||
sub $e
|
||||
ld c, a
|
||||
ld [H_CURRENTSPRITEOFFSET], a
|
||||
ld [hCurrentSpriteOffset], a
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .skipSprite ; tests $c2Xe
|
||||
|
|
@ -34,14 +34,14 @@ UpdateNonPlayerSprite:
|
|||
ld [$ff93], a ; $10 * sprite#
|
||||
ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset?
|
||||
ld b, a
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
cp b
|
||||
jr nz, .unequal
|
||||
jp DoScriptedNPCMovement
|
||||
.unequal
|
||||
jp UpdateNPCSprite
|
||||
|
||||
; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET)
|
||||
; This detects if the current sprite (whose offset is at hCurrentSpriteOffset)
|
||||
; is going to collide with another sprite by looping over the other sprites.
|
||||
; The current sprite's offset will be labelled with i (e.g. $c1i0).
|
||||
; The loop sprite's offset will labelled with j (e.g. $c1j0).
|
||||
|
|
@ -54,7 +54,7 @@ DetectCollisionBetweenSprites:
|
|||
nop
|
||||
|
||||
ld h, wSpriteStateData1 / $100
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add wSpriteStateData1 % $100
|
||||
ld l, a
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ DetectCollisionBetweenSprites:
|
|||
ld [$ff8f], a ; store loop counter
|
||||
swap a
|
||||
ld e, a
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
cp e ; does the loop sprite match the current sprite?
|
||||
jp z, .next ; go to the next sprite if they match
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ DetectCollisionBetweenSprites:
|
|||
inc a
|
||||
jp z, .next ; go the next sprite if offscreen
|
||||
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add 10
|
||||
ld l, a
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ _GetSpritePosition1::
|
|||
ld hl, wSpriteStateData1
|
||||
ld de, $4
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
call GetSpriteDataPointer
|
||||
ld a, [hli] ; c1x4 (screen Y pos)
|
||||
ld [$ffeb], a
|
||||
|
|
@ -21,7 +21,7 @@ _GetSpritePosition2::
|
|||
ld hl, wSpriteStateData1
|
||||
ld de, $4
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
call GetSpriteDataPointer
|
||||
ld a, [hli] ; c1x4 (screen Y pos)
|
||||
ld [wSavedSpriteScreenY], a
|
||||
|
|
@ -40,7 +40,7 @@ _SetSpritePosition1::
|
|||
ld hl, wSpriteStateData1
|
||||
ld de, $4
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
call GetSpriteDataPointer
|
||||
ld a, [$ffeb] ; c1x4 (screen Y pos)
|
||||
ld [hli], a
|
||||
|
|
@ -59,7 +59,7 @@ _SetSpritePosition2::
|
|||
ld hl, wSpriteStateData1
|
||||
ld de, 4
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
call GetSpriteDataPointer
|
||||
ld a, [wSavedSpriteScreenY]
|
||||
ld [hli], a ; c1x4 (screen Y pos)
|
||||
|
|
@ -144,7 +144,7 @@ TrainerWalkUpToPlayer::
|
|||
call FillMemory ; write the necessary steps to reach player
|
||||
ld [hl], $ff ; write end of list sentinel
|
||||
ld a, [wSpriteIndex]
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld [hSpriteIndex], a
|
||||
jp MoveSprite_
|
||||
|
||||
; input: de = offset within sprite entry
|
||||
|
|
@ -152,7 +152,7 @@ TrainerWalkUpToPlayer::
|
|||
GetSpriteDataPointer:
|
||||
push de
|
||||
add hl, de
|
||||
ld a, [H_SPRITEINDEX]
|
||||
ld a, [hSpriteIndex]
|
||||
swap a
|
||||
ld d, $0
|
||||
ld e, a
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
UpdateSpriteFacingOffsetAndDelayMovement::
|
||||
ld h, $c2
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $8
|
||||
ld l, a
|
||||
ld a, $7f ; maximum movement delay
|
||||
ld [hl], a ; c2x8 (movement delay)
|
||||
dec h
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $9
|
||||
ld l, a
|
||||
ld a, [hld] ; c1x9 (facing direction)
|
||||
|
|
@ -14,7 +14,7 @@ UpdateSpriteFacingOffsetAndDelayMovement::
|
|||
xor a
|
||||
ld [hld], a
|
||||
ld [hl], a ; c1x8 (walk animation frame)
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
ld a, [hCurrentSpriteOffset]
|
||||
add $2
|
||||
ld l, a
|
||||
ld a, [hl] ; c1x2 (facing and animation table offset)
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ RedrawMapView:
|
|||
ld a, [wIsInBattle]
|
||||
inc a
|
||||
ret z
|
||||
ld a, [H_AUTOBGTRANSFERENABLED]
|
||||
ld a, [hAutoBGTransferEnabled]
|
||||
push af
|
||||
ld a, [hTilesetType]
|
||||
push af
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld [hTilesetType], a ; no flower/water BG tile animations
|
||||
call LoadCurrentMapView
|
||||
call RunDefaultPaletteCommand
|
||||
|
|
@ -114,7 +114,7 @@ RedrawMapView:
|
|||
pop af
|
||||
ld [hTilesetType], a
|
||||
pop af
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
CompareHLWithBC:
|
||||
|
|
|
|||
|
|
@ -129,10 +129,10 @@ _AddPartyMon::
|
|||
xor a
|
||||
ld b, a
|
||||
call CalcStat ; calc HP stat (set cur Hp to max HP)
|
||||
ld a, [H_MULTIPLICAND+1]
|
||||
ld a, [hMultiplicand+1]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [H_MULTIPLICAND+2]
|
||||
ld a, [hMultiplicand+2]
|
||||
ld [de], a
|
||||
inc de
|
||||
xor a
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
DisplayPCMainMenu::
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call SaveScreenTilesToBuffer2
|
||||
ld a, [wNumHoFTeams]
|
||||
and a
|
||||
|
|
@ -82,7 +82,7 @@ DisplayPCMainMenu::
|
|||
ld [wCurrentMenuItem], a
|
||||
ld [wLastMenuItem], a
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
SomeonesPCText: db "SOMEONE's PC@"
|
||||
|
|
@ -168,7 +168,7 @@ BillsPCMenu:
|
|||
ld de, BoxNoPCText
|
||||
call PlaceString
|
||||
ld a, 1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
call HandleMenuInput
|
||||
bit 1, a
|
||||
|
|
|
|||
|
|
@ -120,12 +120,12 @@ Evolution_PartyMonLoop: ; loop over party mons
|
|||
ld c, 50
|
||||
call DelayFrames
|
||||
xor a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 0, 0
|
||||
lb bc, 12, 20
|
||||
call ClearScreenArea
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld a, $ff
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
call ClearSprites
|
||||
|
|
|
|||
|
|
@ -38,58 +38,58 @@ CalcExperience::
|
|||
add hl, bc
|
||||
call CalcDSquared
|
||||
ld a, d
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
and $f0
|
||||
swap a
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hli]
|
||||
and $f
|
||||
ld [H_DIVISOR], a
|
||||
ld [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [H_QUOTIENT + 1]
|
||||
ld a, [hQuotient + 1]
|
||||
push af
|
||||
ld a, [H_QUOTIENT + 2]
|
||||
ld a, [hQuotient + 2]
|
||||
push af
|
||||
ld a, [H_QUOTIENT + 3]
|
||||
ld a, [hQuotient + 3]
|
||||
push af
|
||||
call CalcDSquared
|
||||
ld a, [hl]
|
||||
and $7f
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [H_PRODUCT + 1]
|
||||
ld a, [hProduct + 1]
|
||||
push af
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
push af
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
push af
|
||||
ld a, [hli]
|
||||
push af
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, d
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplier], a
|
||||
call Multiply
|
||||
ld b, [hl]
|
||||
ld a, [H_PRODUCT + 3]
|
||||
ld a, [hProduct + 3]
|
||||
sub b
|
||||
ld [H_PRODUCT + 3], a
|
||||
ld [hProduct + 3], a
|
||||
ld b, $0
|
||||
ld a, [H_PRODUCT + 2]
|
||||
ld a, [hProduct + 2]
|
||||
sbc b
|
||||
ld [H_PRODUCT + 2], a
|
||||
ld a, [H_PRODUCT + 1]
|
||||
ld [hProduct + 2], a
|
||||
ld a, [hProduct + 1]
|
||||
sbc b
|
||||
ld [H_PRODUCT + 1], a
|
||||
ld [hProduct + 1], a
|
||||
; The difference of the linear term and the constant term consists of 3 bytes
|
||||
; starting at H_PRODUCT + 1. Below, hExperience (an alias of that address) will
|
||||
; starting at hProduct + 1. Below, hExperience (an alias of that address) will
|
||||
; be used instead for the further work of adding or subtracting the squared
|
||||
; term and adding the cubed term.
|
||||
pop af
|
||||
|
|
@ -139,11 +139,11 @@ CalcExperience::
|
|||
; calculates d*d
|
||||
CalcDSquared:
|
||||
xor a
|
||||
ld [H_MULTIPLICAND], a
|
||||
ld [H_MULTIPLICAND + 1], a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, d
|
||||
ld [H_MULTIPLICAND + 2], a
|
||||
ld [H_MULTIPLIER], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ld [hMultiplier], a
|
||||
jp Multiply
|
||||
|
||||
INCLUDE "data/growth_rates.asm"
|
||||
|
|
|
|||
|
|
@ -126,13 +126,13 @@ TryingToLearn:
|
|||
call TextBoxBorder
|
||||
coord hl, 6, 8
|
||||
ld de, wMovesString
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
set 2, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
call PlaceString
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
res 2, a
|
||||
ld [hFlags_0xFFF6], a
|
||||
ld [hFlagsFFF6], a
|
||||
ld hl, wTopMenuItemY
|
||||
ld a, 8
|
||||
ld [hli], a ; wTopMenuItemY
|
||||
|
|
@ -146,10 +146,10 @@ TryingToLearn:
|
|||
ld a, A_BUTTON | B_BUTTON
|
||||
ld [hli], a ; wMenuWatchedKeys
|
||||
ld [hl], 0 ; wLastMenuItem
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
set 1, [hl]
|
||||
call HandleMenuInput
|
||||
ld hl, hFlags_0xFFF6
|
||||
ld hl, hFlagsFFF6
|
||||
res 1, [hl]
|
||||
push af
|
||||
call LoadScreenTilesFromBuffer1
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ DrawHP_:
|
|||
push hl
|
||||
call DrawHPBar
|
||||
pop hl
|
||||
ld a, [hFlags_0xFFF6]
|
||||
ld a, [hFlagsFFF6]
|
||||
bit 0, a
|
||||
jr z, .printFractionBelowBar
|
||||
ld bc, $9 ; right of bar
|
||||
|
|
@ -299,7 +299,7 @@ StatusScreen2:
|
|||
push af
|
||||
xor a
|
||||
ld [hTilesetType], a
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ld bc, NUM_MOVES + 1
|
||||
ld hl, wMoves
|
||||
call FillMemory
|
||||
|
|
@ -424,7 +424,7 @@ StatusScreen2:
|
|||
coord hl, 9, 1
|
||||
call PlaceString
|
||||
ld a, $1
|
||||
ld [H_AUTOBGTRANSFERENABLED], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
call WaitForTextScrollButtonPress ; wait for button
|
||||
pop af
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ StartSlotMachine:
|
|||
ld a, 250
|
||||
.next
|
||||
ld [wSlotMachineSevenAndBarModeChance], a
|
||||
ld a, [H_LOADEDROMBANK]
|
||||
ld a, [hLoadedROMBank]
|
||||
ld [wSlotMachineSavedROMBank], a
|
||||
call PromptUserToPlaySlots
|
||||
ret
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue