Add space between arguments in assembly instructions and remove redundant a in instructions like add a, x

This commit is contained in:
xCrystal 2017-12-30 01:54:27 +01:00
parent 94b9a86c8b
commit 237aeb8fbd
50 changed files with 7221 additions and 7221 deletions

View file

@ -49,7 +49,7 @@ DrawFrameBlock:
inc hl
inc de
ld a, [hli]
add a,$31 ; base tile ID for battle animations
add $31 ; base tile ID for battle animations
ld [de], a ; store tile ID
inc de
ld a, [hli]
@ -74,7 +74,7 @@ DrawFrameBlock:
inc hl
inc de
ld a, [hli]
add a,$31 ; base tile ID for battle animations
add $31 ; base tile ID for battle animations
ld [de], a ; store tile ID
inc de
; toggle horizontal and vertical flip
@ -82,10 +82,10 @@ DrawFrameBlock:
and a
ld b, OAM_VFLIP | OAM_HFLIP
jr z, .storeFlags1
cp a,OAM_HFLIP
cp OAM_HFLIP
ld b, OAM_VFLIP
jr z, .storeFlags1
cp a,OAM_VFLIP
cp OAM_VFLIP
ld b, OAM_HFLIP
jr z, .storeFlags1
ld b, 0
@ -97,7 +97,7 @@ DrawFrameBlock:
.flipHorizontalTranslateDown
ld a, [wBaseCoordY]
add [hl]
add a,40 ; translate Y coordinate downwards
add 40 ; translate Y coordinate downwards
ld [de], a ; store Y
inc hl
inc de
@ -110,7 +110,7 @@ DrawFrameBlock:
inc hl
inc de
ld a, [hli]
add a,$31 ; base tile ID for battle animations
add $31 ; base tile ID for battle animations
ld [de], a ; store tile ID
inc de
ld a, [hli]
@ -132,18 +132,18 @@ DrawFrameBlock:
jp nz, .loop ; go back up if there are more tiles to draw
.afterDrawingTiles
ld a, [wFBMode]
cp a,2
cp 2
jr z, .advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
ld a, [wSubAnimFrameDelay]
ld c, a
call DelayFrames
ld a, [wFBMode]
cp a,3
cp 3
jr z, .advanceFrameBlockDestAddr ; skip cleaning OAM buffer
cp a,4
cp 4
jr z, .done ; skip cleaning OAM buffer and don't advance the frame block destination address
ld a, [wAnimationID]
cp a,GROWL
cp GROWL
jr z, .resetFrameBlockDestAddr
call AnimationCleanOAM
.resetFrameBlockDestAddr
@ -177,9 +177,9 @@ PlayAnimation:
ld l, a
.animationLoop
ld a, [hli]
cp a,$FF
cp $FF
jr z, .AnimationOver
cp a,$C0 ; is this subanimation or a special effect?
cp $C0 ; is this subanimation or a special effect?
jr c, .playSubanimation
.doSpecialEffect
ld c, a
@ -194,7 +194,7 @@ PlayAnimation:
jr .searchSpecialEffectTableLoop
.foundMatch
ld a, [hli]
cp a,$FF ; is there a sound to play?
cp $FF ; is there a sound to play?
jr z, .skipPlayingSound
ld [wAnimSoundID], a ; store sound
push hl
@ -216,7 +216,7 @@ PlayAnimation:
jp hl ; jump to special effect function
.playSubanimation
ld c, a
and a,%00111111
and %00111111
ld [wSubAnimFrameDelay], a
xor a
sla c
@ -267,11 +267,11 @@ LoadSubanimation:
ld d, a ; de = address of subanimation
ld a, [de]
ld b, a
and a,31
and 31
ld [wSubAnimCounter], a ; number of frame blocks
ld a, b
and a,%11100000
cp a,5 << 5 ; is subanimation type 5?
and %11100000
cp 5 << 5 ; is subanimation type 5?
jr nz, .isNotType5
.isType5
call GetSubanimationTransform2
@ -283,7 +283,7 @@ LoadSubanimation:
srl a
swap a
ld [wSubAnimTransform], a
cp a,4 ; is the animation reversed?
cp 4 ; is the animation reversed?
ld hl, 0
jr nz, .storeSubentryAddr
; if the animation is reversed, then place the initial subentry address at the end of the list of subentries
@ -386,7 +386,7 @@ MoveAnimation:
jr z, .animationFinished
; if throwing a Poké Ball, skip the regular animation code
cp a,TOSS_ANIM
cp TOSS_ANIM
jr nz, .moveAnimation
ld de, .animationFinished
push de
@ -429,11 +429,11 @@ ShareMoveAnimations:
ld a, [wAnimationID]
cp a,AMNESIA
cp AMNESIA
ld b, CONF_ANIM
jr z, .replaceAnim
cp a,REST
cp REST
ld b, SLP_ANIM
ret nz
@ -548,7 +548,7 @@ SetAnimationPalette:
PlaySubanimation:
ld a, [wAnimSoundID]
cp a,$FF
cp $FF
jr z, .skipPlayingSound
call GetMoveSound
call PlaySound
@ -600,7 +600,7 @@ PlaySubanimation:
ld a, [wSubAnimSubEntryAddr]
ld l, a
ld a, [wSubAnimTransform]
cp a,4 ; is the animation reversed?
cp 4 ; is the animation reversed?
ld bc, 3
jr nz, .nextSubanimationSubentry
ld bc, -3
@ -727,33 +727,33 @@ AnimationIdSpecialEffects:
DoBallTossSpecialEffects:
ld a, [wcf91]
cp a,3 ; is it a Master Ball or Ultra Ball?
cp 3 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
ld a, [rOBP0]
xor a,%00111100 ; complement colors 1 and 2
xor %00111100 ; complement colors 1 and 2
ld [rOBP0], a
.skipFlashingEffect
ld a, [wSubAnimCounter]
cp a,11 ; is it the beginning of the subanimation?
cp 11 ; is it the beginning of the subanimation?
jr nz, .skipPlayingSound
; if it is the beginning of the subanimation, play a sound
ld a, SFX_BALL_TOSS
call PlaySound
.skipPlayingSound
ld a, [wIsInBattle]
cp a,02 ; is it a trainer battle?
cp 02 ; is it a trainer battle?
jr z, .isTrainerBattle
ld a, [wd11e]
cp a,$10 ; is the enemy pokemon the Ghost Marowak?
cp $10 ; is the enemy pokemon the Ghost Marowak?
ret nz
; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames
ld a, [wSubAnimCounter]
cp a,3
cp 3
jr z, .moveGhostMarowakLeft
cp a,2
cp 2
jr z, .moveGhostMarowakLeft
cp a,1
cp 1
ret nz
.moveGhostMarowakLeft
coord hl, 17, 0
@ -773,7 +773,7 @@ DoBallTossSpecialEffects:
ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
ld a, [wSubAnimCounter]
cp a,3
cp 3
ret nz
dec a
ld [wSubAnimCounter], a
@ -781,7 +781,7 @@ DoBallTossSpecialEffects:
DoBallShakeSpecialEffects:
ld a, [wSubAnimCounter]
cp a,4 ; is it the beginning of a shake?
cp 4 ; is it the beginning of a shake?
jr nz, .skipPlayingSound
; if it is the beginning of a shake, play a sound and wait 2/3 of a second
ld a, SFX_TINK
@ -815,18 +815,18 @@ DoBallShakeSpecialEffects:
; plays a sound after the second frame of the poof animation
DoPoofSpecialEffects:
ld a, [wSubAnimCounter]
cp a,5
cp 5
ret nz
ld a, SFX_BALL_POOF
jp PlaySound
DoRockSlideSpecialEffects:
ld a, [wSubAnimCounter]
cp a,12
cp 12
ret nc
cp a,8
cp 8
jr nc, .shakeScreen
cp a,1
cp 1
jp z, AnimationFlashScreen ; if it's the end of the subanimation, flash the screen
ret
; if the subanimation counter is between 8 and 11, shake the screen horizontally and vertically
@ -838,21 +838,21 @@ DoRockSlideSpecialEffects:
FlashScreenEveryEightFrameBlocks:
ld a, [wSubAnimCounter]
and a,7 ; is the subanimation counter exactly 8?
and 7 ; is the subanimation counter exactly 8?
call z, AnimationFlashScreen ; if so, flash the screen
ret
; flashes the screen if the subanimation counter is divisible by 4
FlashScreenEveryFourFrameBlocks:
ld a, [wSubAnimCounter]
and a,3
and 3
call z, AnimationFlashScreen
ret
; used for Explosion and Selfdestruct
DoExplodeSpecialEffects:
ld a, [wSubAnimCounter]
cp a,1 ; is it the end of the subanimation?
cp 1 ; is it the end of the subanimation?
jr nz, FlashScreenEveryFourFrameBlocks
; if it's the end of the subanimation, make the attacking pokemon disappear
coord hl, 1, 5
@ -861,13 +861,13 @@ DoExplodeSpecialEffects:
; flashes the screen when subanimation counter is 1 modulo 4
DoBlizzardSpecialEffects:
ld a, [wSubAnimCounter]
cp a,13
cp 13
jp z, AnimationFlashScreen
cp a,9
cp 9
jp z, AnimationFlashScreen
cp a,5
cp 5
jp z, AnimationFlashScreen
cp a,1
cp 1
jp z, AnimationFlashScreen
ret
@ -875,18 +875,18 @@ DoBlizzardSpecialEffects:
; unused
FlashScreenUnused:
ld a, [wSubAnimCounter]
cp a,14
cp 14
jp z, AnimationFlashScreen
cp a,9
cp 9
jp z, AnimationFlashScreen
cp a,2
cp 2
jp z, AnimationFlashScreen
ret
; function to make the pokemon disappear at the beginning of the animation
TradeHidePokemon:
ld a, [wSubAnimCounter]
cp a,6
cp 6
ret nz
ld a, 2 * SCREEN_WIDTH + 7
jp ClearMonPicFromTileMap ; make pokemon disappear
@ -894,7 +894,7 @@ TradeHidePokemon:
; function to make a shaking pokeball jump up at the end of the animation
TradeShakePokeball:
ld a, [wSubAnimCounter]
cp a,1
cp 1
ret nz
; if it's the end of the animation, make the ball jump up
ld de, BallMoveDistances1
@ -903,13 +903,13 @@ TradeShakePokeball:
ld bc, 4
.innerLoop
ld a, [de]
cp a,$ff
cp $ff
jr z, .done
add [hl] ; add to Y value of OAM entry
ld [hl], a
add hl, bc
ld a, l
cp a,4 * 4 ; there are 4 entries, each 4 bytes
cp 4 * 4 ; there are 4 entries, each 4 bytes
jr nz, .innerLoop
inc de
push bc
@ -933,20 +933,20 @@ TradeJumpPokeball:
ld bc, 4
.innerLoop
ld a, [de]
cp a,$ff
cp $ff
jp z, ClearScreen
add [hl]
ld [hl], a
add hl, bc
ld a, l
cp a,4 * 4 ; there are 4 entries, each 4 bytes
cp 4 * 4 ; there are 4 entries, each 4 bytes
jr nz, .innerLoop
inc de
push de
ld a, [de]
cp a,12
cp 12
jr z, .playSound
cp a,$ff
cp $ff
jr nz, .skipPlayingSound
.playSound ; play sound if next move distance is 12 or this is the last one
ld a, SFX_BATTLE_18
@ -957,7 +957,7 @@ TradeJumpPokeball:
call DelayFrames
pop bc
ld a, [hSCX] ; background scroll X
sub a,8 ; scroll to the left
sub 8 ; scroll to the left
ld [hSCX], a
pop de
jr .loop
@ -1076,7 +1076,7 @@ AnimationDelay10:
CallWithTurnFlipped:
ld a, [H_WHOSETURN]
push af
xor a,1
xor 1
ld [H_WHOSETURN], a
ld de, .returnAddress
push de
@ -1099,7 +1099,7 @@ AnimationFlashScreenLong:
push hl
.innerLoop
ld a, [hli]
cp a,$01 ; is it the end of the palettes?
cp $01 ; is it the end of the palettes?
jr z, .endOfPalettes
ld [rBGP], a
call FlashScreenLongDelay
@ -1148,13 +1148,13 @@ FlashScreenLongSGB:
; causes a delay of 1 frame for the second and third cycles
FlashScreenLongDelay:
ld a, [wFlashScreenLongCounter]
cp a,4 ; never true since [wFlashScreenLongCounter] starts at 3
cp 4 ; never true since [wFlashScreenLongCounter] starts at 3
ld c, 4
jr z, .delayFrames
cp a,3
cp 3
ld c, 2
jr z, .delayFrames
cp a,2 ; nothing is done with this
cp 2 ; nothing is done with this
ld c, 1
.delayFrames
jp DelayFrames
@ -2352,9 +2352,9 @@ GetMoveSound:
IsCryMove:
; set carry if the move animation involves playing a monster cry
ld a, [wAnimationID]
cp a,GROWL
cp GROWL
jr z, .CryMove
cp a,ROAR
cp ROAR
jr z, .CryMove
and a ; clear carry
ret
@ -2952,30 +2952,30 @@ BattleAnimCopyTileMapToVRAM:
TossBallAnimation:
ld a, [wIsInBattle]
cp a,2
cp 2
jr z, .BlockBall ; if in trainer battle, play different animation
ld a, [wPokeBallAnimData]
ld b, a
; upper nybble: how many animations (from PokeBallAnimations) to play
; this will be 4 for successful capture, 6 for breakout
and a,$F0
and $F0
swap a
ld c, a
; lower nybble: number of shakes
; store these for later
ld a, b
and a,$F
and $F
ld [wNumShakes], a
ld hl, .PokeBallAnimations
; choose which toss animation to use
ld a, [wcf91]
cp a,POKE_BALL
cp POKE_BALL
ld b, TOSS_ANIM
jr z, .done
cp a,GREAT_BALL
cp GREAT_BALL
ld b, GREATTOSS_ANIM
jr z, .done
ld b, ULTRATOSS_ANIM

View file

@ -3213,7 +3213,7 @@ handleIfPlayerMoveMissed:
and a
jr z, getPlayerAnimationType
ld a, [wPlayerMoveEffect]
sub a,EXPLODE_EFFECT
sub EXPLODE_EFFECT
jr z, playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
jr playerCheckIfFlyOrChargeEffect
getPlayerAnimationType:
@ -3245,9 +3245,9 @@ playerCheckIfFlyOrChargeEffect:
ld c, 30
call DelayFrames
ld a, [wPlayerMoveEffect]
cp a,FLY_EFFECT
cp FLY_EFFECT
jr z, .playAnim
cp a,CHARGE_EFFECT
cp CHARGE_EFFECT
jr z, .playAnim
jr MirrorMoveCheck
.playAnim
@ -3257,7 +3257,7 @@ playerCheckIfFlyOrChargeEffect:
call PlayMoveAnimation
MirrorMoveCheck:
ld a, [wPlayerMoveEffect]
cp a,MIRROR_MOVE_EFFECT
cp MIRROR_MOVE_EFFECT
jr nz, .metronomeCheck
call MirrorMoveCopyMove
jp z, ExecutePlayerMoveDone
@ -3265,7 +3265,7 @@ MirrorMoveCheck:
ld [wMonIsDisobedient], a
jp CheckIfPlayerNeedsToChargeUp ; if Mirror Move was successful go back to damage calculation for copied move
.metronomeCheck
cp a,METRONOME_EFFECT
cp METRONOME_EFFECT
jr nz, .next
call MetronomePickMove
jp CheckIfPlayerNeedsToChargeUp ; Go back to damage calculation for the move picked by Metronome
@ -3280,7 +3280,7 @@ MirrorMoveCheck:
jr z, .moveDidNotMiss
call PrintMoveFailureText
ld a, [wPlayerMoveEffect]
cp a,EXPLODE_EFFECT ; even if Explosion or Selfdestruct missed, its effect still needs to be activated
cp EXPLODE_EFFECT ; even if Explosion or Selfdestruct missed, its effect still needs to be activated
jr z, .notDone
jp ExecutePlayerMoveDone ; otherwise, we're done if the move missed
.moveDidNotMiss
@ -3346,7 +3346,7 @@ PrintGhostText:
and a
jr nz, .Ghost
ld a, [wBattleMonStatus] ; players turn
and a,SLP | (1 << FRZ)
and SLP | (1 << FRZ)
ret nz
ld hl, ScaredText
call PrintText
@ -3371,9 +3371,9 @@ IsGhostBattle:
dec a
ret nz
ld a, [wCurMap]
cp a,POKEMONTOWER_1
cp POKEMONTOWER_1
jr c, .next
cp a,LAVENDER_HOUSE_1
cp LAVENDER_HOUSE_1
jr nc, .next
ld b, SILPH_SCOPE
call IsItemInBag
@ -3388,7 +3388,7 @@ IsGhostBattle:
CheckPlayerStatusConditions:
ld hl, wBattleMonStatus
ld a, [hl]
and a,SLP ; sleep mask
and SLP ; sleep mask
jr z, .FrozenCheck
; sleeping
dec a
@ -3485,11 +3485,11 @@ CheckPlayerStatusConditions:
ld a, CONF_ANIM - 1
call PlayMoveAnimation
call BattleRandom
cp a,$80 ; 50% chance to hurt itself
cp $80 ; 50% chance to hurt itself
jr c, .TriedToUseDisabledMoveCheck
ld hl, wPlayerBattleStatus1
ld a, [hl]
and a, 1 << CONFUSED ; if mon hurts itself, clear every other status from wPlayerBattleStatus1
and 1 << CONFUSED ; if mon hurts itself, clear every other status from wPlayerBattleStatus1
ld [hl], a
call HandleSelfConfusionDamage
jr .MonHurtItselfOrFullyParalysed
@ -3511,7 +3511,7 @@ CheckPlayerStatusConditions:
bit PAR, [hl]
jr z, .BideCheck
call BattleRandom
cp a,$3F ; 25% to be fully paralyzed
cp $3F ; 25% to be fully paralyzed
jr nc, .BideCheck
ld hl, FullyParalyzedText
call PrintText
@ -3523,9 +3523,9 @@ CheckPlayerStatusConditions:
and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
ld [hl], a
ld a, [wPlayerMoveEffect]
cp a,FLY_EFFECT
cp FLY_EFFECT
jr z, .FlyOrChargeEffect
cp a,CHARGE_EFFECT
cp CHARGE_EFFECT
jr z, .FlyOrChargeEffect
jr .NotFlyOrChargeEffect
@ -3604,7 +3604,7 @@ CheckPlayerStatusConditions:
res THRASHING_ABOUT, [hl] ; no longer thrashing about
set CONFUSED, [hl] ; confused
call BattleRandom
and a,3
and 3
inc a
inc a ; confused for 2-5 turns
ld [wPlayerConfusedCounter], a
@ -4515,7 +4515,7 @@ CalculateDamage:
.effect
; EXPLODE_EFFECT halves defense.
cp a, EXPLODE_EFFECT
cp EXPLODE_EFFECT
jr nz, .ok
srl c
jr nz, .ok
@ -4523,13 +4523,13 @@ CalculateDamage:
.ok
; Multi-hit attacks may or may not have 0 bp.
cp a, TWO_TO_FIVE_ATTACKS_EFFECT
cp TWO_TO_FIVE_ATTACKS_EFFECT
jr z, .skipbp
cp a, $1e
cp $1e
jr z, .skipbp
; Calculate OHKO damage based on remaining HP.
cp a, OHKO_EFFECT
cp OHKO_EFFECT
jp z, JumpToOHKOMoveEffect
; Don't calculate damage for moves that don't do any.
@ -4774,12 +4774,12 @@ HandleCounterMove:
ld de, wPlayerMovePower
ld a, [wEnemySelectedMove]
.next
cp a,COUNTER
cp COUNTER
ret nz ; return if not using Counter
ld a, $01
ld [wMoveMissed], a ; initialize the move missed variable to true (it is set to false below if the move hits)
ld a, [hl]
cp a,COUNTER
cp COUNTER
ret z ; miss if the opponent's last selected move is Counter.
ld a, [de]
and a
@ -4789,7 +4789,7 @@ HandleCounterMove:
ld a, [de]
and a ; normal type
jr z, .counterableType
cp a,FIGHTING
cp FIGHTING
jr z, .counterableType
; if the move wasn't Normal or Fighting type, miss
xor a
@ -4822,11 +4822,11 @@ HandleCounterMove:
ApplyAttackToEnemyPokemon:
ld a, [wPlayerMoveEffect]
cp a,OHKO_EFFECT
cp OHKO_EFFECT
jr z, ApplyDamageToEnemyPokemon
cp a,SUPER_FANG_EFFECT
cp SUPER_FANG_EFFECT
jr z, .superFangEffect
cp a,SPECIAL_DAMAGE_EFFECT
cp SPECIAL_DAMAGE_EFFECT
jr z, .specialDamage
ld a, [wPlayerMovePower]
and a
@ -4855,15 +4855,15 @@ ApplyAttackToEnemyPokemon:
ld a, [hl]
ld b, a ; Seismic Toss deals damage equal to the user's level
ld a, [wPlayerMoveNum]
cp a,SEISMIC_TOSS
cp SEISMIC_TOSS
jr z, .storeDamage
cp a,NIGHT_SHADE
cp NIGHT_SHADE
jr z, .storeDamage
ld b, SONICBOOM_DAMAGE ; 20
cp a,SONICBOOM
cp SONICBOOM
jr z, .storeDamage
ld b, DRAGON_RAGE_DAMAGE ; 40
cp a,DRAGON_RAGE
cp DRAGON_RAGE
jr z, .storeDamage
; Psywave
ld a, [hl]
@ -4941,11 +4941,11 @@ ApplyAttackToEnemyPokemonDone:
ApplyAttackToPlayerPokemon:
ld a, [wEnemyMoveEffect]
cp a,OHKO_EFFECT
cp OHKO_EFFECT
jr z, ApplyDamageToPlayerPokemon
cp a,SUPER_FANG_EFFECT
cp SUPER_FANG_EFFECT
jr z, .superFangEffect
cp a,SPECIAL_DAMAGE_EFFECT
cp SPECIAL_DAMAGE_EFFECT
jr z, .specialDamage
ld a, [wEnemyMovePower]
and a
@ -4974,15 +4974,15 @@ ApplyAttackToPlayerPokemon:
ld a, [hl]
ld b, a
ld a, [wEnemyMoveNum]
cp a,SEISMIC_TOSS
cp SEISMIC_TOSS
jr z, .storeDamage
cp a,NIGHT_SHADE
cp NIGHT_SHADE
jr z, .storeDamage
ld b, SONICBOOM_DAMAGE
cp a,SONICBOOM
cp SONICBOOM
jr z, .storeDamage
ld b, DRAGON_RAGE_DAMAGE
cp a,DRAGON_RAGE
cp DRAGON_RAGE
jr z, .storeDamage
; Psywave
ld a, [hl]
@ -5096,12 +5096,12 @@ AttackSubstitute:
call PrintText
; flip whose turn it is for the next function call
ld a, [H_WHOSETURN]
xor a,$01
xor $01
ld [H_WHOSETURN], a
callab HideSubstituteShowMonAnim ; animate the substitute breaking
; flip the turn back to the way it was
ld a, [H_WHOSETURN]
xor a,$01
xor $01
ld [H_WHOSETURN], a
ld hl, wPlayerMoveEffect ; value for player's turn
and a
@ -5137,10 +5137,10 @@ HandleBuildingRage:
bit USING_RAGE, [hl] ; is the pokemon being attacked under the effect of Rage?
ret z ; return if not
ld a, [de]
cp a,$0d ; maximum stat modifier value
cp $0d ; maximum stat modifier value
ret z ; return if attack modifier is already maxed
ld a, [H_WHOSETURN]
xor a,$01 ; flip turn for the stat modifier raising function
xor $01 ; flip turn for the stat modifier raising function
ld [H_WHOSETURN], 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
@ -5159,7 +5159,7 @@ HandleBuildingRage:
ld a, RAGE
ld [hl], a ; restore the target pokemon's move number to Rage
ld a, [H_WHOSETURN]
xor a,$01 ; flip turn back to the way it was
xor $01 ; flip turn back to the way it was
ld [H_WHOSETURN], a
ret
@ -5189,7 +5189,7 @@ MirrorMoveCopyMove:
ld hl, wEnemySelectedMove
.next
ld [hl], a
cp a,MIRROR_MOVE ; did the target Pokemon last use Mirror Move, and miss?
cp MIRROR_MOVE ; did the target Pokemon last use Mirror Move, and miss?
jr z, .mirrorMoveFailed
and a ; has the target selected any move yet?
jr nz, ReloadMoveData
@ -5240,9 +5240,9 @@ MetronomePickMove:
call BattleRandom
and a
jr z, .pickMoveLoop
cp a,NUM_ATTACKS + 1 ; max normal move number + 1 (this is Struggle's move number)
cp NUM_ATTACKS + 1 ; max normal move number + 1 (this is Struggle's move number)
jr nc, .pickMoveLoop
cp a,METRONOME
cp METRONOME
jr z, .pickMoveLoop
ld [hl], a
jr ReloadMoveData
@ -5339,7 +5339,7 @@ AdjustDamageForMoveType:
ld hl, TypeEffects
.loop
ld a, [hli] ; a = "attacking type" of the current type pair
cp a,$ff
cp $ff
jr z, .done
cp b ; does move type match "attacking type"?
jr nz, .nextTypePair
@ -5355,7 +5355,7 @@ AdjustDamageForMoveType:
push bc
inc hl
ld a, [wDamageMultipliers]
and a,$80
and $80
ld b, a
ld a, [hl] ; a = damage multiplier
ld [H_MULTIPLIER], a
@ -5413,7 +5413,7 @@ AIGetTypeEffectiveness:
ld hl, TypeEffects
.loop
ld a, [hli]
cp a,$ff
cp $ff
ret z
cp d ; match the type of the move
jr nz, .nextTypePair1
@ -5450,22 +5450,22 @@ MoveHitTest:
ld bc, wBattleMonStatus
.dreamEaterCheck
ld a, [de]
cp a,DREAM_EATER_EFFECT
cp DREAM_EATER_EFFECT
jr nz, .swiftCheck
ld a, [bc]
and a,SLP ; is the target pokemon sleeping?
and SLP ; is the target pokemon sleeping?
jp z, .moveMissed
.swiftCheck
ld a, [de]
cp a,SWIFT_EFFECT
cp SWIFT_EFFECT
ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
jr z, .checkForDigOrFlyStatus
; this code is buggy. it's supposed to prevent HP draining moves from working on substitutes.
; since $7b79 overwrites a with either $00 or $01, it never works.
cp a,DRAIN_HP_EFFECT
cp DRAIN_HP_EFFECT
jp z, .moveMissed
cp a,DREAM_EATER_EFFECT
cp DREAM_EATER_EFFECT
jp z, .moveMissed
.checkForDigOrFlyStatus
bit INVULNERABLE, [hl]
@ -5476,13 +5476,13 @@ MoveHitTest:
.playerTurn
; this checks if the move effect is disallowed by mist
ld a, [wPlayerMoveEffect]
cp a,ATTACK_DOWN1_EFFECT
cp ATTACK_DOWN1_EFFECT
jr c, .skipEnemyMistCheck
cp a,HAZE_EFFECT + 1
cp HAZE_EFFECT + 1
jr c, .enemyMistCheck
cp a,ATTACK_DOWN2_EFFECT
cp ATTACK_DOWN2_EFFECT
jr c, .skipEnemyMistCheck
cp a,REFLECT_EFFECT + 1
cp REFLECT_EFFECT + 1
jr c, .enemyMistCheck
jr .skipEnemyMistCheck
.enemyMistCheck
@ -5502,13 +5502,13 @@ MoveHitTest:
jr .calcHitChance
.enemyTurn
ld a, [wEnemyMoveEffect]
cp a,ATTACK_DOWN1_EFFECT
cp ATTACK_DOWN1_EFFECT
jr c, .skipPlayerMistCheck
cp a,HAZE_EFFECT + 1
cp HAZE_EFFECT + 1
jr c, .playerMistCheck
cp a,ATTACK_DOWN2_EFFECT
cp ATTACK_DOWN2_EFFECT
jr c, .skipPlayerMistCheck
cp a,REFLECT_EFFECT + 1
cp REFLECT_EFFECT + 1
jr c, .playerMistCheck
jr .skipPlayerMistCheck
.playerMistCheck
@ -7417,11 +7417,11 @@ FreezeBurnParalyzeEffect:
cp b ; do target type 2 and move type match?
ret z ; return if they match
ld a, [wPlayerMoveEffect]
cp a, PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those
cp PARALYZE_SIDE_EFFECT1 + 1 ; 10% status effects are 04, 05, 06 so 07 will set carry for those
ld b, $1a ; 0x1A/0x100 or 26/256 = 10.2%~ chance
jr c, .next1 ; branch ahead if this is a 10% chance effect..
ld b, $4d ; else use 0x4D/0x100 or 77/256 = 30.1%~ chance
sub a, $1e ; subtract $1E to map to equivalent 10% chance effects
sub $1e ; subtract $1E to map to equivalent 10% chance effects
.next1
push af
call BattleRandom ; get random 8bit value for probability test
@ -7429,9 +7429,9 @@ FreezeBurnParalyzeEffect:
pop bc
ret nc ; do nothing if random value is >= 1A or 4D [no status applied]
ld a, b ; what type of effect is this?
cp a, BURN_SIDE_EFFECT1
cp BURN_SIDE_EFFECT1
jr z, .burn
cp a, FREEZE_SIDE_EFFECT
cp FREEZE_SIDE_EFFECT
jr z, .freeze
; .paralyze
ld a, 1 << PAR
@ -7469,11 +7469,11 @@ opponentAttacker:
cp b
ret z
ld a, [wEnemyMoveEffect]
cp a, PARALYZE_SIDE_EFFECT1 + 1
cp PARALYZE_SIDE_EFFECT1 + 1
ld b, $1a
jr c, .next1
ld b, $4d
sub a, $1e
sub $1e
.next1
push af
call BattleRandom
@ -7481,9 +7481,9 @@ opponentAttacker:
pop bc
ret nc
ld a, b
cp a, BURN_SIDE_EFFECT1
cp BURN_SIDE_EFFECT1
jr z, .burn
cp a, FREEZE_SIDE_EFFECT
cp FREEZE_SIDE_EFFECT
jr z, .freeze
ld a, 1 << PAR
ld [wBattleMonStatus], a
@ -7512,14 +7512,14 @@ FrozenText:
CheckDefrost:
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
and a, 1 << FRZ ; are they frozen?
and 1 << FRZ ; are they frozen?
ret z ; return if so
ld a, [H_WHOSETURN]
and a
jr nz, .opponent
;player [attacker]
ld a, [wPlayerMoveType]
sub a, FIRE
sub FIRE
ret nz ; return if type of move used isn't fire
ld [wEnemyMonStatus], a ; set opponent status to 00 ["defrost" a frozen monster]
ld hl, wEnemyMon1Status
@ -7532,7 +7532,7 @@ CheckDefrost:
jr .common
.opponent
ld a, [wEnemyMoveType] ; same as above with addresses swapped
sub a, FIRE
sub FIRE
ret nz
ld [wBattleMonStatus], a
ld hl, wPartyMon1Status

View file

@ -1,13 +1,13 @@
DecrementPP:
; after using a move, decrement pp in battle and (if not transformed?) in party
ld a, [de]
cp a, STRUGGLE
cp STRUGGLE
ret z ; if the pokemon is using "struggle", there's nothing to do
; we don't decrement PP for "struggle"
ld hl, wPlayerBattleStatus1
ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the
; wPlayerBattleStatus2 status flags later
and a, (1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << ATTACKING_MULTIPLE_TIMES)
and (1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << ATTACKING_MULTIPLE_TIMES)
ret nz ; if any of these statuses are true, don't decrement PP
bit USING_RAGE, [hl]
ret nz ; don't decrement PP either if Pokemon is using Rage

View file

@ -1,7 +1,7 @@
DisplayEffectiveness:
ld a, [wDamageMultipliers]
and a, $7F
cp a, $0A
and $7F
cp $0A
ret z
ld hl, SuperEffectiveText
jr nc, .done

View file

@ -17,7 +17,7 @@ ReadTrainer:
; get the pointer to trainer data for this class
ld a, [wCurOpponent]
sub $C9 ; convert value from pokemon to trainer
add a,a
add a
ld hl, TrainerDataPointers
ld c, a
ld b, 0
@ -84,7 +84,7 @@ ReadTrainer:
and a
jr z, .AddTeamMove
dec a
add a,a
add a
ld c, a
ld b, 0
ld hl, LoneMoves

View file

@ -59,10 +59,10 @@ DisplayTextIDInit:
ld c, e
.spriteStandStillLoop
ld a, [hl]
cp a,$ff ; is the sprite visible?
cp $ff ; is the sprite visible?
jr z, .nextSprite
; if it is visible
and a,$fc
and $fc
ld [hl], a
.nextSprite
add hl, de

View file

@ -35,7 +35,7 @@ AddItemToInventory_:
jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
ld a, [hl]
cp a,$ff ; is it the end of the table?
cp $ff ; is it the end of the table?
jr nz, .loop
.addNewItem ; add an item not yet in the inventory
pop hl
@ -61,11 +61,11 @@ AddItemToInventory_:
ld b, a ; b = quantity to add
ld a, [hl] ; a = existing item quantity
add b ; a = new item quantity
cp a,100
cp 100
jp c, .storeNewQuantity ; if the new quantity is less than 100, store it
; if the new quantity is greater than or equal to 100,
; try to max out the current slot and add the rest in a new slot
sub a,99
sub 99
ld [wItemQuantity], a ; a = amount left over (to put in the new slot)
ld a, d
and a ; is there room for a new item slot?
@ -127,7 +127,7 @@ RemoveItemFromInventory_:
ld a, [de]
inc de
ld [hli], a
cp a,$ff
cp $ff
jr nz, .loop
; update menu info
xor a
@ -140,7 +140,7 @@ RemoveItemFromInventory_:
dec a ; decrement the number of items
ld [hl], a ; store new number of items
ld [wListCount], a
cp a,2
cp 2
jr c, .done
ld [wMaxMenuItem], a
jr .done

View file

@ -2,7 +2,7 @@ UseItem_:
ld a, 1
ld [wActionResultOrTookBattleTurn], a ; initialise to success value
ld a, [wcf91] ;contains item_ID
cp a,HM_01
cp HM_01
jp nc, ItemUseTMHM
ld hl, ItemUsePtrTable
dec a
@ -117,10 +117,10 @@ ItemUseBall:
jr z, .canUseBall
ld a, [wPartyCount] ; is party full?
cp a,PARTY_LENGTH
cp PARTY_LENGTH
jr nz, .canUseBall
ld a, [wNumInBox] ; is box full?
cp a,MONS_PER_BOX
cp MONS_PER_BOX
jp z, BoxFullCannotThrowBall
.canUseBall
@ -128,7 +128,7 @@ ItemUseBall:
ld [wCapturedMonSpecies], a
ld a, [wBattleType]
cp a,BATTLE_TYPE_SAFARI
cp BATTLE_TYPE_SAFARI
jr nz, .skipSafariZoneCode
.safariZone
@ -166,10 +166,10 @@ ItemUseBall:
; If the player is fighting the ghost Marowak, set the value that indicates the
; Pokémon can't be caught and skip the capture calculations.
ld a, [wCurMap]
cp a,POKEMONTOWER_6
cp POKEMONTOWER_6
jr nz, .loop
ld a, [wEnemyMonSpecies2]
cp a,MAROWAK
cp MAROWAK
ld b, $10 ; can't be caught value
jp z, .setAnimData
@ -190,11 +190,11 @@ ItemUseBall:
ld a, [hl]
; The Master Ball always succeeds.
cp a,MASTER_BALL
cp MASTER_BALL
jp z, .captured
; Anything will do for the basic Poké Ball.
cp a,POKE_BALL
cp POKE_BALL
jr z, .checkForAilments
; If it's a Great/Ultra/Safari Ball and Rand1 is greater than 200, try again.
@ -204,7 +204,7 @@ ItemUseBall:
; Less than or equal to 200 is good enough for a Great Ball.
ld a, [hl]
cp a,GREAT_BALL
cp GREAT_BALL
jr z, .checkForAilments
; If it's an Ultra/Safari Ball and Rand1 is greater than 150, try again.
@ -224,7 +224,7 @@ ItemUseBall:
ld a, [wEnemyMonStatus]
and a
jr z, .skipAilmentValueSubtraction ; no ailments
and a, 1 << FRZ | SLP
and 1 << FRZ | SLP
ld c, 12
jr z, .notFrozenOrAsleep
ld c, 25
@ -251,7 +251,7 @@ ItemUseBall:
; Determine BallFactor. It's 8 for Great Balls and 12 for the others.
ld a, [wcf91]
cp a,GREAT_BALL
cp GREAT_BALL
ld a, 12
jr nz, .skip1
ld a, 8
@ -337,13 +337,13 @@ ItemUseBall:
; Ultra/Safari Ball: BallFactor2 = 150
ld a, [wcf91]
ld b, 255
cp a,POKE_BALL
cp POKE_BALL
jr z, .skip4
ld b, 200
cp a,GREAT_BALL
cp GREAT_BALL
jr z, .skip4
ld b, 150
cp a,ULTRA_BALL
cp ULTRA_BALL
jr z, .skip4
.skip4
@ -379,7 +379,7 @@ ItemUseBall:
ld a, [wEnemyMonStatus]
and a
jr z, .skip5
and a, 1 << FRZ | SLP
and 1 << FRZ | SLP
ld b, 5
jr z, .addAilmentValue
ld b, 10
@ -399,13 +399,13 @@ ItemUseBall:
; 30 ≤ Z < 70: 2 shakes
; 70 ≤ Z: 3 shakes
ld a, [H_QUOTIENT + 3]
cp a,10
cp 10
ld b, $20
jr c, .setAnimData
cp a,30
cp 30
ld b, $61
jr c, .setAnimData
cp a,70
cp 70
ld b, $62
jr c, .setAnimData
ld b, $63
@ -437,19 +437,19 @@ ItemUseBall:
; Determine the message to display from the animation.
ld a, [wPokeBallAnimData]
cp a,$10
cp $10
ld hl, ItemUseBallText00
jp z, .printMessage
cp a,$20
cp $20
ld hl, ItemUseBallText01
jp z, .printMessage
cp a,$61
cp $61
ld hl, ItemUseBallText02
jp z, .printMessage
cp a,$62
cp $62
ld hl, ItemUseBallText03
jp z, .printMessage
cp a,$63
cp $63
ld hl, ItemUseBallText04
jp z, .printMessage
@ -546,7 +546,7 @@ ItemUseBall:
.skipShowingPokedexData
ld a, [wPartyCount]
cp a,PARTY_LENGTH ; is party full?
cp PARTY_LENGTH ; is party full?
jr z, .sendToBox
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
@ -640,7 +640,7 @@ ItemUseBicycle:
jp nz, ItemUseNotTime
ld a, [wWalkBikeSurfState]
ld [wWalkBikeSurfStateCopy], a
cp a,2 ; is the player surfing?
cp 2 ; is the player surfing?
jp z, ItemUseNotTime
dec a ; is player already bicycling?
jr nz, .tryToGetOnBike
@ -668,7 +668,7 @@ ItemUseBicycle:
ItemUseSurfboard:
ld a, [wWalkBikeSurfState]
ld [wWalkBikeSurfStateCopy], a
cp a,2 ; is the player already surfing?
cp 2 ; is the player already surfing?
jr z, .tryToStopSurfing
.tryToSurf
call IsNextTileShoreOrWater
@ -707,7 +707,7 @@ ItemUseSurfboard:
ld a, [hli]
cp b
jr z, .stopSurfing
cp a,$ff
cp $ff
jr nz, .passableTileLoop
.cannotStopSurfing
ld hl, SurfingNoPlaceToGetOffText
@ -855,13 +855,13 @@ ItemUseMedicine:
jr z, ItemUseMedicine ; if so, force another choice
.checkItemType
ld a, [wcf91]
cp a,REVIVE
cp REVIVE
jr nc, .healHP ; if it's a Revive or Max Revive
cp a,FULL_HEAL
cp FULL_HEAL
jr z, .cureStatusAilment ; if it's a Full Heal
cp a,HP_UP
cp HP_UP
jp nc, .useVitamin ; if it's a vitamin or Rare Candy
cp a,FULL_RESTORE
cp FULL_RESTORE
jr nc, .healHP ; if it's a Full Restore or one of the potions
; fall through if it's one of the status-specific healing items
.cureStatusAilment
@ -869,19 +869,19 @@ ItemUseMedicine:
add hl, bc ; hl now points to status
ld a, [wcf91]
lb bc, ANTIDOTE_MSG, 1 << PSN
cp a,ANTIDOTE
cp ANTIDOTE
jr z, .checkMonStatus
lb bc, BURN_HEAL_MSG, 1 << BRN
cp a,BURN_HEAL
cp BURN_HEAL
jr z, .checkMonStatus
lb bc, ICE_HEAL_MSG, 1 << FRZ
cp a,ICE_HEAL
cp ICE_HEAL
jr z, .checkMonStatus
lb bc, AWAKENING_MSG, SLP
cp a,AWAKENING
cp AWAKENING
jr z, .checkMonStatus
lb bc, PARALYZ_HEAL_MSG, 1 << PAR
cp a,PARLYZ_HEAL
cp PARLYZ_HEAL
jr z, .checkMonStatus
lb bc, FULL_HEAL_MSG, $ff ; Full Heal
.checkMonStatus
@ -922,9 +922,9 @@ ItemUseMedicine:
jr nz, .notFainted
.fainted
ld a, [wcf91]
cp a,REVIVE
cp REVIVE
jr z, .updateInBattleFaintedData
cp a,MAX_REVIVE
cp MAX_REVIVE
jr z, .updateInBattleFaintedData
jp .healingItemNoEffect
.updateInBattleFaintedData
@ -954,9 +954,9 @@ ItemUseMedicine:
jr .compareCurrentHPToMaxHP
.notFainted
ld a, [wcf91]
cp a,REVIVE
cp REVIVE
jp z, .healingItemNoEffect
cp a,MAX_REVIVE
cp MAX_REVIVE
jp z, .healingItemNoEffect
.compareCurrentHPToMaxHP
push hl
@ -974,7 +974,7 @@ ItemUseMedicine:
jr nz, .notFullHP
.fullHP ; if the pokemon's current HP equals its max HP
ld a, [wcf91]
cp a,FULL_RESTORE
cp FULL_RESTORE
jp nz, .healingItemNoEffect
inc hl
inc hl
@ -1073,15 +1073,15 @@ ItemUseMedicine:
jr .addHealAmount
.notUsingSoftboiled2
ld a, [wcf91]
cp a,SODA_POP
cp SODA_POP
ld b, 60 ; Soda Pop heal amount
jr z, .addHealAmount
ld b, 80 ; Lemonade heal amount
jr nc, .addHealAmount
cp a,FRESH_WATER
cp FRESH_WATER
ld b, 50 ; Fresh Water heal amount
jr z, .addHealAmount
cp a,SUPER_POTION
cp SUPER_POTION
ld b, 200 ; Hyper Potion heal amount
jr c, .addHealAmount
ld b, 50 ; Super Potion heal amount
@ -1108,7 +1108,7 @@ ItemUseMedicine:
ld hl, (wPartyMon1MaxHP + 1) - (wPartyMon1HP + 1)
add hl, de ; hl now points to max HP
ld a, [wcf91]
cp a,REVIVE
cp REVIVE
jr z, .setCurrentHPToHalfMaxHP
ld a, [hld]
ld b, a
@ -1120,9 +1120,9 @@ ItemUseMedicine:
sbc b
jr nc, .setCurrentHPToMaxHp ; if current HP exceeds max HP after healing
ld a, [wcf91]
cp a,HYPER_POTION
cp HYPER_POTION
jr c, .setCurrentHPToMaxHp ; if using a Full Restore or Max Potion
cp a,MAX_REVIVE
cp MAX_REVIVE
jr z, .setCurrentHPToMaxHp ; if using a Max Revive
jr .updateInBattleData
.setCurrentHPToHalfMaxHP
@ -1150,7 +1150,7 @@ ItemUseMedicine:
dec de
.doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure
ld a, [wcf91]
cp a,FULL_RESTORE
cp FULL_RESTORE
jr nz, .updateInBattleData
ld bc, wPartyMon1Status - (wPartyMon1MaxHP + 1)
add hl, bc
@ -1169,7 +1169,7 @@ ItemUseMedicine:
ld a, [hld]
ld [wBattleMonHP + 1], a
ld a, [wcf91]
cp a,FULL_RESTORE
cp FULL_RESTORE
jr nz, .calculateHPBarCoords
xor a
ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data
@ -1194,9 +1194,9 @@ ItemUseMedicine:
pop hl
.skipRemovingItem
ld a, [wcf91]
cp a,FULL_RESTORE
cp FULL_RESTORE
jr c, .playStatusAilmentCuringSound
cp a,FULL_HEAL
cp FULL_HEAL
jr z, .playStatusAilmentCuringSound
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
@ -1212,9 +1212,9 @@ ItemUseMedicine:
ld a, REVIVE_MSG
ld [wPartyMenuTypeOrMessageID], a
ld a, [wcf91]
cp a,REVIVE
cp REVIVE
jr z, .showHealingItemMessage
cp a,MAX_REVIVE
cp MAX_REVIVE
jr z, .showHealingItemMessage
ld a, POTION_MSG
ld [wPartyMenuTypeOrMessageID], a
@ -1267,10 +1267,10 @@ ItemUseMedicine:
pop de
pop hl
ld a, [wcf91]
cp a,RARE_CANDY
cp RARE_CANDY
jp z, .useRareCandy
push hl
sub a,HP_UP
sub HP_UP
add a
ld bc, wPartyMon1HPExp - wPartyMon1
add hl, bc
@ -1282,7 +1282,7 @@ ItemUseMedicine:
ld a, 10
ld b, a
ld a, [hl] ; a = MSB of stat experience of the appropriate stat
cp a,100 ; is there already at least 25600 (256 * 100) stat experience?
cp 100 ; is there already at least 25600 (256 * 100) stat experience?
jr nc, .vitaminNoEffect ; if so, vitamins can't add any more
add b ; add 2560 (256 * 10) stat experience
jr nc, .noCarry3 ; a carry should be impossible here, so this will always jump
@ -1293,7 +1293,7 @@ ItemUseMedicine:
call .recalculateStats
ld hl, VitaminText
ld a, [wcf91]
sub a,HP_UP - 1
sub HP_UP - 1
ld c, a
.statNameLoop ; loop to get the address of the name of the stat the vitamin increases
dec c
@ -1333,7 +1333,7 @@ ItemUseMedicine:
ld bc, wPartyMon1Level - wPartyMon1
add hl, bc ; hl now points to level
ld a, [hl] ; a = level
cp a, MAX_LEVEL
cp MAX_LEVEL
jr z, .vitaminNoEffect ; can't raise level above 100
inc a
ld [hl], a ; store incremented level
@ -1463,8 +1463,8 @@ BaitRockCommon:
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
and a,7
cp a,5
and 7
cp 5
jr nc, .randomLoop
inc a ; increment the random number, giving a range from 1 to 5 inclusive
ld b, a
@ -1492,14 +1492,14 @@ ItemUseEscapeRope:
and a
jr nz, .notUsable
ld a, [wCurMap]
cp a,AGATHAS_ROOM
cp AGATHAS_ROOM
jr z, .notUsable
ld a, [wCurMapTileset]
ld b, a
ld hl, EscapeRopeTilesets
.loop
ld a, [hli]
cp a,$ff
cp $ff
jr z, .notUsable
cp b
jr nz, .loop
@ -1556,17 +1556,17 @@ ItemUseCardKey:
ld [wUnusedD71F], a
call GetTileAndCoordsInFrontOfPlayer
ld a, [GetTileAndCoordsInFrontOfPlayer]
cp a,$18
cp $18
jr nz, .next0
ld hl, CardKeyTable1
jr .next1
.next0
cp a,$24
cp $24
jr nz, .next2
ld hl, CardKeyTable2
jr .next1
.next2
cp a,$5e
cp $5e
jp nz, ItemUseNotTime
ld hl, CardKeyTable3
.next1
@ -1574,7 +1574,7 @@ ItemUseCardKey:
ld b, a
.loop
ld a, [hli]
cp a,$ff
cp $ff
jp z, ItemUseNotTime
cp b
jr nz, .nextEntry1
@ -1690,7 +1690,7 @@ ItemUseXStat:
push af ; save [wPlayerMoveEffect]
push hl
ld a, [wcf91]
sub a,X_ATTACK - ATTACK_UP1_EFFECT
sub X_ATTACK - ATTACK_UP1_EFFECT
ld [hl], a ; store player move effect
call PrintItemUseTextAndRemoveItem
ld a, XSTATITEM_ANIM ; X stat item animation ID
@ -1714,7 +1714,7 @@ ItemUsePokeflute:
; if not in battle
call ItemUseReloadOverworldData
ld a, [wCurMap]
cp a,ROUTE_12
cp ROUTE_12
jr nz, .notRoute12
CheckEvent EVENT_BEAT_ROUTE12_SNORLAX
jr nz, .noSnorlaxToWakeUp
@ -1727,7 +1727,7 @@ ItemUsePokeflute:
SetEvent EVENT_FIGHT_ROUTE12_SNORLAX
ret
.notRoute12
cp a,ROUTE_16
cp ROUTE_16
jr nz, .noSnorlaxToWakeUp
CheckEvent EVENT_BEAT_ROUTE16_SNORLAX
jr nz, .noSnorlaxToWakeUp
@ -1772,7 +1772,7 @@ ItemUsePokeflute:
ld hl, PlayedFluteHadEffectText
call PrintText
ld a, [wLowHealthAlarm]
and a,$80
and $80
jr nz, .skipMusic
call WaitForSoundToFinish ; wait for sound to end
callba Music_PokeFluteInBattle ; play in-battle pokeflute music
@ -1797,7 +1797,7 @@ WakeUpEntireParty:
.loop
ld a, [hl]
push af
and a,SLP ; is pokemon asleep?
and SLP ; is pokemon asleep?
jr z, .notAsleep
ld a, 1
ld [wWereAnyMonsAsleep], a ; indicate that a pokemon had to be woken up
@ -1851,7 +1851,7 @@ PlayedFluteHadEffectText:
call PlayMusic
.musicWaitLoop ; wait for music to finish playing
ld a, [wChannelSoundIDs + Ch2]
cp a, SFX_POKEFLUTE
cp SFX_POKEFLUTE
jr z, .musicWaitLoop
call PlayDefaultMusic ; start playing normal music again
.done
@ -1887,7 +1887,7 @@ ItemUseGoodRod:
jr nc, .RandomLoop
; choose which monster appears
ld hl, GoodRodMons
add a,a
add a
ld c, a
ld b, 0
add hl, bc
@ -1945,7 +1945,7 @@ FishingInit:
call IsNextTileShoreOrWater
ret c
ld a, [wWalkBikeSurfState]
cp a,2 ; Surfing?
cp 2 ; Surfing?
jr z, .surfing
call ItemUseReloadOverworldData
ld hl, ItemUseText00
@ -2011,13 +2011,13 @@ ItemUsePPRestore:
jp .itemNotUsed
.chooseMove
ld a, [wPPRestoreItem]
cp a,ELIXER
cp ELIXER
jp nc, .useElixir ; if Elixir or Max Elixir
ld a, $02
ld [wMoveMenuType], a
ld hl, RaisePPWhichTechniqueText
ld a, [wPPRestoreItem]
cp a,ETHER ; is it a PP Up?
cp ETHER ; is it a PP Up?
jr c, .printWhichTechniqueMessage ; if so, print the raise PP message
ld hl, RestorePPWhichTechniqueText ; otherwise, print the restore PP message
.printWhichTechniqueMessage
@ -2038,20 +2038,20 @@ ItemUsePPRestore:
call CopyStringToCF4B ; copy name to wcf4b
pop hl
ld a, [wPPRestoreItem]
cp a,ETHER
cp ETHER
jr nc, .useEther ; if Ether or Max Ether
.usePPUp
ld bc, wPartyMon1PP - wPartyMon1Moves
add hl, bc
ld a, [hl] ; move PP
cp a,3 << 6 ; have 3 PP Ups already been used?
cp 3 << 6 ; have 3 PP Ups already been used?
jr c, .PPNotMaxedOut
ld hl, PPMaxedOutText
call PrintText
jr .chooseMove
.PPNotMaxedOut
ld a, [hl]
add a,1 << 6 ; increase PP Up count by 1
add 1 << 6 ; increase PP Up count by 1
ld [hl], a
ld a, 1 ; 1 PP Up used
ld [wd11e], a
@ -2100,13 +2100,13 @@ ItemUsePPRestore:
ld a, [wMaxPP]
ld b, a
ld a, [wPPRestoreItem]
cp a,MAX_ETHER
cp MAX_ETHER
jr z, .fullyRestorePP
ld a, [hl] ; move PP
and a,%00111111 ; lower 6 bit bits store current PP
and %00111111 ; lower 6 bit bits store current PP
cp b ; does current PP equal max PP?
ret z ; if so, return
add a,10 ; increase current PP by 10
add 10 ; increase current PP by 10
; b holds the max PP amount and b will hold the new PP amount.
; So, if the new amount meets or exceeds the max amount,
; cap the amount to the max amount by leaving b unchanged.
@ -2116,7 +2116,7 @@ ItemUsePPRestore:
ld b, a
.storeNewAmount
ld a, [hl] ; move PP
and a,%11000000 ; PP Up counter bits
and %11000000 ; PP Up counter bits
add b
ld [hl], a
ret
@ -2201,10 +2201,10 @@ ItemUseTMHM:
and a
jp nz, ItemUseNotTime
ld a, [wcf91]
sub a,TM_01
sub TM_01
push af
jr nc, .skipAdding
add a,55 ; if item is an HM, add 55
add 55 ; if item is an HM, add 55
.skipAdding
inc a
ld [wd11e], a
@ -2436,7 +2436,7 @@ RestoreBonusPP:
.loop
inc b
ld a, b
cp a,5 ; reached the end of the pokemon's moves?
cp 5 ; reached the end of the pokemon's moves?
ret z ; if so, return
ld a, [wUsingPPUp]
dec a ; using a PP Up?
@ -2448,7 +2448,7 @@ RestoreBonusPP:
jr nz, .nextMove
.skipMenuItemIDCheck
ld a, [hl]
and a,%11000000 ; have any PP Ups been used?
and %11000000 ; have any PP Ups been used?
call nz, AddBonusPP ; if so, add bonus PP
.nextMove
inc hl
@ -2475,13 +2475,13 @@ AddBonusPP:
ld a, [hl] ; move PP
ld b, a
swap a
and a,%00001111
and %00001111
srl a
srl a
ld c, a ; c = number of PP Ups used
.loop
ld a, [H_QUOTIENT + 3]
cp a,8 ; is the amount greater than or equal to 8?
cp 8 ; is the amount greater than or equal to 8?
jr c, .addAmount
ld a, 7 ; cap the amount at 7
.addAmount
@ -2548,13 +2548,13 @@ GetMaxPP:
push bc
ld bc, wPartyMon1PP - wPartyMon1Moves ; PP offset if not player's in-battle pokemon data
ld a, [wMonDataLocation]
cp a,4 ; player's in-battle pokemon?
cp 4 ; player's in-battle pokemon?
jr nz, .addPPOffset
ld bc, wBattleMonPP - wBattleMonMoves ; PP offset if player's in-battle pokemon data
.addPPOffset
add hl, bc
ld a, [hl] ; a = current PP
and a,%11000000 ; get PP Up count
and %11000000 ; get PP Up count
pop bc
or b ; place normal max PP in 6 lower bits of a
ld h, d
@ -2565,7 +2565,7 @@ GetMaxPP:
ld [wUsingPPUp], a
call AddBonusPP ; add bonus PP from PP Ups
ld a, [hl]
and a,%00111111 ; mask out the PP Up count
and %00111111 ; mask out the PP Up count
ld [wMaxPP], a ; store max PP
ret
@ -2613,7 +2613,7 @@ TossItem_:
ld [wTextBoxID], a
call DisplayTextBoxID ; yes/no menu
ld a, [wMenuExitMethod]
cp a,CHOSE_SECOND_ITEM
cp CHOSE_SECOND_ITEM
pop hl
scf
ret z ; return if the player chose No
@ -2661,7 +2661,7 @@ IsKeyItem_:
ld a, $01
ld [wIsKeyItem], a
ld a, [wcf91]
cp a,HM_01 ; is the item an HM or TM?
cp HM_01 ; is the item an HM or TM?
jr nc, .checkIfItemIsHM
; if the item is not an HM or TM
push af

View file

@ -30,7 +30,7 @@ MainMenu:
ld hl, wd730
set 6, [hl]
ld a, [wSaveFileStatus]
cp a,1
cp 1
jr z, .noSaveFile
; there's a save file
coord hl, 0, 0
@ -73,7 +73,7 @@ MainMenu:
ld a, [wCurrentMenuItem]
ld b, a
ld a, [wSaveFileStatus]
cp a,2
cp 2
jp z, .skipInc
; If there's no save file, increment the current menu item so that the numbers
; are the same whether or not there's a save file.
@ -82,7 +82,7 @@ MainMenu:
ld a, b
and a
jr z, .choseContinue
cp a,1
cp 1
jp z, StartNewGame
call DisplayOptionMenu
ld a, 1
@ -115,7 +115,7 @@ MainMenu:
and a
jp z, SpecialEnterMap
ld a, [wCurMap] ; map ID
cp a,HALL_OF_FAME
cp HALL_OF_FAME
jp nz, SpecialEnterMap
xor a
ld [wDestinationMap], a
@ -472,7 +472,7 @@ DisplayOptionMenu:
call JoypadLowSensitivity
ld a, [hJoy5]
ld b, a
and a,A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
jr z, .getJoypadStateLoop
bit 1, b ; B button pressed?
jr nz, .exitMenu
@ -481,7 +481,7 @@ DisplayOptionMenu:
bit 0, b ; A button pressed?
jr z, .checkDirectionKeys
ld a, [wTopMenuItemY]
cp a,16 ; is the cursor on Cancel?
cp 16 ; is the cursor on Cancel?
jr nz, .loop
.exitMenu
ld a, SFX_PRESS_AB
@ -497,40 +497,40 @@ DisplayOptionMenu:
jr nz, .downPressed
bit 6, b ; Up pressed?
jr nz, .upPressed
cp a,8 ; cursor in Battle Animation section?
cp 8 ; cursor in Battle Animation section?
jr z, .cursorInBattleAnimation
cp a,13 ; cursor in Battle Style section?
cp 13 ; cursor in Battle Style section?
jr z, .cursorInBattleStyle
cp a,16 ; cursor on Cancel?
cp 16 ; cursor on Cancel?
jr z, .loop
.cursorInTextSpeed
bit 5, b ; Left pressed?
jp nz, .pressedLeftInTextSpeed
jp .pressedRightInTextSpeed
.downPressed
cp a,16
cp 16
ld b, -13
ld hl, wOptionsTextSpeedCursorX
jr z, .updateMenuVariables
ld b, 5
cp a,3
cp 3
inc hl
jr z, .updateMenuVariables
cp a,8
cp 8
inc hl
jr z, .updateMenuVariables
ld b, 3
inc hl
jr .updateMenuVariables
.upPressed
cp a,8
cp 8
ld b, -5
ld hl, wOptionsTextSpeedCursorX
jr z, .updateMenuVariables
cp a,13
cp 13
inc hl
jr z, .updateMenuVariables
cp a,16
cp 16
ld b, -3
inc hl
jr z, .updateMenuVariables
@ -545,35 +545,35 @@ DisplayOptionMenu:
jp .loop
.cursorInBattleAnimation
ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate
xor a,$0b ; toggle between 1 and 10
xor $0b ; toggle between 1 and 10
ld [wOptionsBattleAnimCursorX], a
jp .eraseOldMenuCursor
.cursorInBattleStyle
ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate
xor a,$0b ; toggle between 1 and 10
xor $0b ; toggle between 1 and 10
ld [wOptionsBattleStyleCursorX], a
jp .eraseOldMenuCursor
.pressedLeftInTextSpeed
ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
cp a,1
cp 1
jr z, .updateTextSpeedXCoord
cp a,7
cp 7
jr nz, .fromSlowToMedium
sub a,6
sub 6
jr .updateTextSpeedXCoord
.fromSlowToMedium
sub a,7
sub 7
jr .updateTextSpeedXCoord
.pressedRightInTextSpeed
ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
cp a,14
cp 14
jr z, .updateTextSpeedXCoord
cp a,7
cp 7
jr nz, .fromFastToMedium
add a,7
add 7
jr .updateTextSpeedXCoord
.fromFastToMedium
add a,6
add 6
.updateTextSpeedXCoord
ld [wOptionsTextSpeedCursorX], a ; text speed cursor X coordinate
jp .eraseOldMenuCursor
@ -634,7 +634,7 @@ SetCursorPositionsFromOptions:
ld hl, TextSpeedOptionData + 1
ld a, [wOptions]
ld c, a
and a,$3f
and $3f
push bc
ld de, 2
call IsInArray

View file

@ -26,7 +26,7 @@ DrawPartyMenu_:
RedrawPartyMenu_:
ld a, [wPartyMenuTypeOrMessageID]
cp a,SWAP_MONS_PARTY_MENU
cp SWAP_MONS_PARTY_MENU
jp z, .printMessage
call ErasePartyMenuCursors
callba InitPartyMenuBlkPacket
@ -38,7 +38,7 @@ RedrawPartyMenu_:
ld [wWhichPartyMenuHPBar], a
.loop
ld a, [de]
cp a,$FF ; reached the terminator?
cp $FF ; reached the terminator?
jp z, .afterDrawingMonEntries
push bc
push de
@ -76,9 +76,9 @@ RedrawPartyMenu_:
inc hl
.skipUnfilledRightArrow
ld a, [wPartyMenuTypeOrMessageID] ; menu type
cp a,TMHM_PARTY_MENU
cp TMHM_PARTY_MENU
jr z, .teachMoveMenu
cp a,EVO_STONE_PARTY_MENU
cp EVO_STONE_PARTY_MENU
jr z, .evolutionStoneMenu
push hl
ld bc, 14 ; 14 columns to the right
@ -161,7 +161,7 @@ RedrawPartyMenu_:
jr z, .placeEvolutionStoneString ; if so, place the "NOT ABLE" string
inc hl
inc hl
cp a,EV_ITEM
cp EV_ITEM
jr nz, .checkEvolutionsLoop
; if it's a stone evolution entry
dec hl
@ -197,7 +197,7 @@ RedrawPartyMenu_:
push hl
set 6, [hl] ; turn off letter printing delay
ld a, [wPartyMenuTypeOrMessageID] ; message ID
cp a,$F0
cp $F0
jr nc, .printItemUseMessage
add a
ld hl, PartyMenuMessagePointers
@ -217,7 +217,7 @@ RedrawPartyMenu_:
call Delay3
jp GBPalNormal
.printItemUseMessage
and a,$0F
and $0F
ld hl, PartyMenuItemUseMessagePointers
add a
ld c, a

View file

@ -17,34 +17,34 @@ PCMainMenu:
bit 1, a ;if player pressed B
jp nz, LogOff
ld a, [wMaxMenuItem]
cp a, 2
cp 2
jr nz, .next ;if not 2 menu items (not counting log off) (2 occurs before you get the pokedex)
ld a, [wCurrentMenuItem]
and a
jp z, BillsPC ;if current menu item id is 0, it's bills pc
cp a, 1
cp 1
jr z, .playersPC ;if current menu item id is 1, it's players pc
jp LogOff ;otherwise, it's 2, and you're logging off
.next
cp a, 3
cp 3
jr nz, .next2 ;if not 3 menu items (not counting log off) (3 occurs after you get the pokedex, before you beat the pokemon league)
ld a, [wCurrentMenuItem]
and a
jp z, BillsPC ;if current menu item id is 0, it's bills pc
cp a, 1
cp 1
jr z, .playersPC ;if current menu item id is 1, it's players pc
cp a, 2
cp 2
jp z, OaksPC ;if current menu item id is 2, it's oaks pc
jp LogOff ;otherwise, it's 3, and you're logging off
.next2
ld a, [wCurrentMenuItem]
and a
jp z, BillsPC ;if current menu item id is 0, it's bills pc
cp a, 1
cp 1
jr z, .playersPC ;if current menu item id is 1, it's players pc
cp a, 2
cp 2
jp z, OaksPC ;if current menu item id is 2, it's oaks pc
cp a, 3
cp 3
jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague
jp LogOff ;otherwise, it's 4, and you're logging off
.playersPC

View file

@ -225,7 +225,7 @@ HandlePokedexListMenu:
ld [wd11e], a
ld d, 7
ld a, [wDexMaxSeenMon]
cp a,7
cp 7
jr nc, .printPokemonLoop
ld d, a
dec a
@ -301,9 +301,9 @@ HandlePokedexListMenu:
jr z, .checkIfRightPressed
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
cp a,7
cp 7
jp c, .loop ; can't if the list is shorter than 7
sub a,7
sub 7
ld b, a
ld a, [wListScrollOffset]
cp b
@ -316,12 +316,12 @@ HandlePokedexListMenu:
jr z, .checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
cp a,7
cp 7
jp c, .loop ; can't if the list is shorter than 7
sub a,6
sub 6
ld b, a
ld a, [wListScrollOffset]
add a,7
add 7
ld [wListScrollOffset], a
cp b
jp c, .loop
@ -334,7 +334,7 @@ HandlePokedexListMenu:
jr z, .buttonAPressed
.leftPressed
ld a, [wListScrollOffset]
sub a,7
sub 7
ld [wListScrollOffset], a
jp nc, .loop
xor a
@ -354,7 +354,7 @@ DrawPokedexVerticalLine:
.loop
ld [hl], a
add hl, de
xor a,1 ; toggle between vertical line tile and box tile
xor 1 ; toggle between vertical line tile and box tile
dec c
jr nz, .loop
ret
@ -549,9 +549,9 @@ ShowPokedexDataInternal:
call PrintNumber ; print weight
coord hl, 14, 8
ld a, [hDexWeight + 1]
sub a,10
sub 10
ld a, [hDexWeight]
sbc a,0
sbc 0
jr nc, .next
ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point
.next
@ -574,7 +574,7 @@ ShowPokedexDataInternal:
.waitForButtonPress
call JoypadLowSensitivity
ld a, [hJoy5]
and a,A_BUTTON | B_BUTTON
and A_BUTTON | B_BUTTON
jr z, .waitForButtonPress
pop af
ld [hTilesetType], a

View file

@ -54,7 +54,7 @@ RedisplayStartMenu::
ld a, [wCurrentMenuItem]
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
ld a, b
and a,%00001010 ; was the Start button or B button pressed?
and %00001010 ; was the Start button or B button pressed?
jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
CheckEvent EVENT_GOT_POKEDEX
@ -62,17 +62,17 @@ RedisplayStartMenu::
jr nz, .displayMenuItem
inc a ; adjust position to account for missing pokedex menu item
.displayMenuItem
cp a,0
cp 0
jp z, StartMenu_Pokedex
cp a,1
cp 1
jp z, StartMenu_Pokemon
cp a,2
cp 2
jp z, StartMenu_Item
cp a,3
cp 3
jp z, StartMenu_TrainerInfo
cp a,4
cp 4
jp z, StartMenu_SaveReset
cp a,5
cp 5
jp z, StartMenu_Option
; EXIT falls through to here

View file

@ -86,7 +86,7 @@ StartMenu_Pokemon:
jp .choseOutOfBattleMove
.choseSwitch
ld a, [wPartyCount]
cp a,2 ; is there more than one pokemon in the party?
cp 2 ; is there more than one pokemon in the party?
jp c, StartMenu_Pokemon ; if not, no switching
call SwitchPartyMon_InitVarOrSwapData ; init [wMenuItemToSwap]
ld a, SWAP_MONS_PARTY_MENU
@ -338,7 +338,7 @@ StartMenu_Item:
xor a
ld [wMenuItemToSwap], a
ld a, [wcf91]
cp a,BICYCLE
cp BICYCLE
jp z, .useOrTossItem
.notBicycle1
ld a, USE_TOSS_MENU_TEMPLATE
@ -369,7 +369,7 @@ StartMenu_Item:
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
ld a, [wcf91]
cp a,BICYCLE
cp BICYCLE
jr nz, .notBicycle2
ld a, [wd732]
bit 5, a
@ -384,7 +384,7 @@ StartMenu_Item:
; use item
ld [wPseudoItemID], a ; a must be 0 due to above conditional jump
ld a, [wcf91]
cp a,HM_01
cp HM_01
jr nc, .useItem_partyMenu
ld hl, UsableItems_CloseMenu
ld de, 1
@ -410,7 +410,7 @@ StartMenu_Item:
push af
call UseItem
ld a, [wActionResultOrTookBattleTurn]
cp a,$02
cp $02
jp z, .partyMenuNotDisplayed
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns

View file

@ -1,6 +1,6 @@
HandleItemListSwapping:
ld a, [wListMenuID]
cp a,ITEMLISTMENU
cp ITEMLISTMENU
jp nz, DisplayListMenuIDLoop ; only rearrange item list menus
push hl
ld hl, wListPointer
@ -101,10 +101,10 @@ HandleItemListSwapping:
ld b, a
ld a, [de]
add b ; a = sum of both item quantities
cp a,100 ; is the sum too big for one item slot?
cp 100 ; is the sum too big for one item slot?
jr c, .combineItemSlots
; swap enough items from the first slot to max out the second slot if they can't be combined
sub a,99
sub 99
ld [de], a
ld a, 99
ld [hl], a
@ -118,7 +118,7 @@ HandleItemListSwapping:
dec [hl] ; decrease the number of items
ld a, [hl]
ld [wListCount], a ; update number of items variable
cp a,1
cp 1
jr nz, .skipSettingMaxMenuItemID
ld [wMaxMenuItem], a ; if the number of items is only one now, update the max menu item ID
.skipSettingMaxMenuItemID

View file

@ -1,7 +1,7 @@
; function to draw various text boxes
DisplayTextBoxID_:
ld a, [wTextBoxID]
cp a,TWO_OPTION_MENU
cp TWO_OPTION_MENU
jp z, DisplayTwoOptionMenu
ld c, a
ld hl, TextBoxFunctionTable
@ -54,7 +54,7 @@ SearchTextBoxTable:
dec de
.loop
ld a, [hli]
cp a,$ff
cp $ff
jr z, .notFound
cp c
jr z, .found

View file

@ -44,7 +44,7 @@ LoadMapSpriteTilePatterns:
ld a, [hli] ; $C2XD (sprite picture ID)
ld [hld], a ; $C2XE
ld a, l
add a,$10
add $10
ld l, a
dec b
jr nz, .copyPictureIDLoop
@ -56,17 +56,17 @@ LoadMapSpriteTilePatterns:
; their picture ID's match that of the current sprite slot.
.checkIfAlreadyLoadedLoop
ld a, e
and a,$f0
and $f0
ld b, a ; b = offset of the wSpriteStateData2 sprite slot being checked against
ld a, l
and a,$f0 ; a = offset of current wSpriteStateData2 sprite slot
and $f0 ; a = offset of current wSpriteStateData2 sprite slot
cp b ; done checking all previous sprite slots?
jr z, .notAlreadyLoaded
ld a, [de] ; picture ID of the wSpriteStateData2 sprite slot being checked against
cp [hl] ; do the picture ID's match?
jp z, .alreadyLoaded
ld a, e
add a,$10
add $10
ld e, a
jr .checkIfAlreadyLoadedLoop
.notAlreadyLoaded
@ -76,13 +76,13 @@ LoadMapSpriteTilePatterns:
; this is done in order to find the first free VRAM slot available
.findNextVRAMSlotLoop
ld a, e
add a,$10
add $10
ld e, a
ld a, l
cp e ; reached current slot?
jr z, .foundNextVRAMSlot
ld a, [de] ; $C2YE (VRAM slot)
cp a,11 ; is it one of the first 10 slots?
cp 11 ; is it one of the first 10 slots?
jr nc, .findNextVRAMSlotLoop
cp b ; compare the slot being checked to the current max
jr c, .findNextVRAMSlotLoop ; if the slot being checked is less than the current max
@ -95,11 +95,11 @@ LoadMapSpriteTilePatterns:
push af
ld a, [hl] ; $C2XE (sprite picture ID)
ld b, a ; b = current sprite picture ID
cp a,SPRITE_BALL ; is it a 4-tile sprite?
cp SPRITE_BALL ; is it a 4-tile sprite?
jr c, .notFourTileSprite
pop af
ld a, [hFourTileSpriteCount]
add a,11
add 11
jr .storeVRAMSlot
.notFourTileSprite
pop af
@ -129,7 +129,7 @@ LoadMapSpriteTilePatterns:
ld hl, vNPCSprites ; VRAM base address
ld bc, $c0 ; number of bytes per VRAM slot
ld a, [hVRAMSlot]
cp a,11 ; is it a 4-tile sprite?
cp 11 ; is it a 4-tile sprite?
jr nc, .fourTileSpriteVRAMAddr
ld d, a
dec d
@ -169,7 +169,7 @@ LoadMapSpriteTilePatterns:
pop de
pop hl
ld a, [hVRAMSlot]
cp a,11 ; is it a 4-tile sprite?
cp 11 ; is it a 4-tile sprite?
jr nc, .skipSecondLoad ; if so, there is no second block
push de
call ReadSpriteSheetData
@ -212,7 +212,7 @@ LoadMapSpriteTilePatterns:
ld [hl], a ; store VRAM slot in current wSpriteStateData2 sprite slot (at $C2XE)
.nextSpriteSlot
ld a, l
add a,$10
add $10
ld l, a
dec c
jp nz, .loadTilePatternLoop
@ -252,7 +252,7 @@ ReadSpriteSheetData:
; sets carry if the map is a city or route, unsets carry if not
InitOutsideMapSprites:
ld a, [wCurMap]
cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)?
cp REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)?
ret nc ; if not, return
ld hl, MapSpriteSets
add l
@ -261,7 +261,7 @@ InitOutsideMapSprites:
inc h
.noCarry
ld a, [hl] ; a = spriteSetID
cp a,$f0 ; does the map have 2 sprite sets?
cp $f0 ; does the map have 2 sprite sets?
call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one
ld b, a ; b = spriteSetID
ld a, [wFontLoaded]
@ -306,7 +306,7 @@ InitOutsideMapSprites:
inc de
inc bc
ld a, l
cp a,$bd ; reached 11th sprite slot?
cp $bd ; reached 11th sprite slot?
jr nz, .loadSpriteSetLoop
ld b, 4 ; 4 remaining sprite slots
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
@ -381,10 +381,10 @@ InitOutsideMapSprites:
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
GetSplitMapSpriteSetID:
cp a,$f8
cp $f8
jr z, .route20
ld hl, SplitMapSpriteSets
and a,$0f
and $0f
dec a
sla a
sla a
@ -394,7 +394,7 @@ GetSplitMapSpriteSetID:
inc h
.noCarry
ld a, [hli] ; determines whether the map is split East/West or North/South
cp a,$01
cp $01
ld a, [hli] ; position of dividing line
ld b, a
jr z, .eastWestDivide
@ -417,15 +417,15 @@ GetSplitMapSpriteSetID:
.route20
ld hl, wXCoord
ld a, [hl]
cp a,$2b
cp $2b
ld a, $01
ret c
ld a, [hl]
cp a,$3e
cp $3e
ld a, $0a
ret nc
ld a, [hl]
cp a,$37
cp $37
ld b, $08
jr nc, .next
ld b, $0d

View file

@ -26,7 +26,7 @@ DisplayPokemartDialogue_:
ld h, a
ld a, [wMenuExitMethod]
cp a,CANCELLED_MENU
cp CANCELLED_MENU
jp z, .done
ld a, [wChosenMenuItem]
and a ; buying?
@ -90,7 +90,7 @@ DisplayPokemartDialogue_:
ld [wTextBoxID], a
call DisplayTextBoxID ; yes/no menu
ld a, [wMenuExitMethod]
cp a,CHOSE_SECOND_ITEM
cp CHOSE_SECOND_ITEM
jr z, .sellMenuLoop ; if the player chose No or pressed the B button
; The following code is supposed to check if the player chose No, but the above
@ -168,7 +168,7 @@ DisplayPokemartDialogue_:
ld [wTextBoxID], a
call DisplayTextBoxID ; yes/no menu
ld a, [wMenuExitMethod]
cp a,CHOSE_SECOND_ITEM
cp CHOSE_SECOND_ITEM
jp z, .buyMenuLoop ; if the player chose No or pressed the B button
; The following code is supposed to check if the player chose No, but the above

View file

@ -326,7 +326,7 @@ UpdatePartyMenuBlkPacket:
SendSGBPacket:
;check number of packets
ld a, [hl]
and a,$07
and $07
ret z
; store number of packets in B
ld b, a

View file

@ -42,7 +42,7 @@ DisplayDexRating:
inc de
.copyRatingTextLoop
ld a, [hli]
cp a, "@"
cp "@"
jr z, .doneCopying
ld [de], a
inc de

View file

@ -576,7 +576,7 @@ GetMonHeader::
ld b, $77 ; size of Aerodactyl fossil sprite
cp FOSSIL_AERODACTYL ; Aerodactyl fossil
jr z, .specialID
cp a,MEW
cp MEW
jr z, .mew
predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number
ld a, [wd11e]
@ -4045,7 +4045,7 @@ PlaceMenuCursor::
jr nz, .oldMenuItemLoop
.checkForArrow1
ld a, [hl]
cp a,"▶" ; was an arrow next to the previously selected menu item?
cp "▶" ; was an arrow next to the previously selected menu item?
jr nz, .skipClearingArrow
.clearArrow
ld a, [wTileBehindCursor]

View file

@ -199,25 +199,25 @@ OverworldLoopLessDelay::
; direction is set for V-blank to occur while the direction is still set.
swap a ; put old direction in upper half
or b ; put new direction in lower half
cp a,(PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up
cp (PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up
jr nz, .notDownToUp
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
jr .holdIntermediateDirectionLoop
.notDownToUp
cp a,(PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down
cp (PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down
jr nz, .notUpToDown
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
jr .holdIntermediateDirectionLoop
.notUpToDown
cp a,(PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left
cp (PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left
jr nz, .notRightToLeft
ld a, PLAYER_DIR_DOWN
ld [wPlayerMovingDirection], a
jr .holdIntermediateDirectionLoop
.notRightToLeft
cp a,(PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right
cp (PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right
jr nz, .holdIntermediateDirectionLoop
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
@ -1199,7 +1199,7 @@ IsSpriteInFrontOfPlayer2::
.nextSprite
pop hl
ld a, l
add a,$10
add $10
ld l, a
inc e
dec d
@ -1208,7 +1208,7 @@ IsSpriteInFrontOfPlayer2::
.foundSpriteInFrontOfPlayer
pop hl
ld a, l
and a,$f0
and $f0
inc a
ld l, a ; hl = $c1x1
set 7, [hl] ; set flag to make the sprite face the player
@ -1268,7 +1268,7 @@ CheckTilePassable::
ld l, a ; hl now points to passable tiles
.loop
ld a, [hli]
cp a,$ff
cp $ff
jr z, .tileNotPassable
cp c
ret z
@ -1478,64 +1478,64 @@ AdvancePlayerSprite::
ld [wXCoord], a
.afterUpdateMapCoords
ld a, [wWalkCounter] ; walking animation counter
cp a,$07
cp $07
jp nz, .scrollBackgroundAndSprites
; if this is the first iteration of the animation
ld a, c
cp a,$01
cp $01
jr nz, .checkIfMovingWest
; moving east
ld a, [wMapViewVRAMPointer]
ld e, a
and a,$e0
and $e0
ld d, a
ld a, e
add a,$02
and a,$1f
add $02
and $1f
or d
ld [wMapViewVRAMPointer], a
jr .adjustXCoordWithinBlock
.checkIfMovingWest
cp a,$ff
cp $ff
jr nz, .checkIfMovingSouth
; moving west
ld a, [wMapViewVRAMPointer]
ld e, a
and a,$e0
and $e0
ld d, a
ld a, e
sub a,$02
and a,$1f
sub $02
and $1f
or d
ld [wMapViewVRAMPointer], a
jr .adjustXCoordWithinBlock
.checkIfMovingSouth
ld a, b
cp a,$01
cp $01
jr nz, .checkIfMovingNorth
; moving south
ld a, [wMapViewVRAMPointer]
add a,$40
add $40
ld [wMapViewVRAMPointer], a
jr nc, .adjustXCoordWithinBlock
ld a, [wMapViewVRAMPointer + 1]
inc a
and a,$03
or a,$98
and $03
or $98
ld [wMapViewVRAMPointer + 1], a
jr .adjustXCoordWithinBlock
.checkIfMovingNorth
cp a,$ff
cp $ff
jr nz, .adjustXCoordWithinBlock
; moving north
ld a, [wMapViewVRAMPointer]
sub a,$40
sub $40
ld [wMapViewVRAMPointer], a
jr nc, .adjustXCoordWithinBlock
ld a, [wMapViewVRAMPointer + 1]
dec a
and a,$03
or a,$98
and $03
or $98
ld [wMapViewVRAMPointer + 1], a
.adjustXCoordWithinBlock
ld a, c
@ -1546,7 +1546,7 @@ AdvancePlayerSprite::
ld a, [hl]
add c
ld [hl], a
cp a,$02
cp $02
jr nz, .checkForMoveToWestBlock
; moved into the tile block to the east
xor a
@ -1557,7 +1557,7 @@ AdvancePlayerSprite::
call MoveTileBlockMapPointerEast
jr .updateMapView
.checkForMoveToWestBlock
cp a,$ff
cp $ff
jr nz, .adjustYCoordWithinBlock
; moved into the tile block to the west
ld a, $01
@ -1572,7 +1572,7 @@ AdvancePlayerSprite::
ld a, [hl]
add b
ld [hl], a
cp a,$02
cp $02
jr nz, .checkForMoveToNorthBlock
; moved into the tile block to the south
xor a
@ -1584,7 +1584,7 @@ AdvancePlayerSprite::
call MoveTileBlockMapPointerSouth
jr .updateMapView
.checkForMoveToNorthBlock
cp a,$ff
cp $ff
jr nz, .updateMapView
; moved into the tile block to the north
ld a, $01
@ -1597,26 +1597,26 @@ AdvancePlayerSprite::
.updateMapView
call LoadCurrentMapView
ld a, [wSpriteStateData1 + 3] ; delta Y
cp a,$01
cp $01
jr nz, .checkIfMovingNorth2
; if moving south
call ScheduleSouthRowRedraw
jr .scrollBackgroundAndSprites
.checkIfMovingNorth2
cp a,$ff
cp $ff
jr nz, .checkIfMovingEast2
; if moving north
call ScheduleNorthRowRedraw
jr .scrollBackgroundAndSprites
.checkIfMovingEast2
ld a, [wSpriteStateData1 + 5] ; delta X
cp a,$01
cp $01
jr nz, .checkIfMovingWest2
; if moving east
call ScheduleEastColumnRedraw
jr .scrollBackgroundAndSprites
.checkIfMovingWest2
cp a,$ff
cp $ff
jr nz, .scrollBackgroundAndSprites
; if moving west
call ScheduleWestColumnRedraw
@ -1661,7 +1661,7 @@ AdvancePlayerSprite::
MoveTileBlockMapPointerEast::
ld a, [de]
add a,$01
add $01
ld [de], a
ret nc
inc de
@ -1672,7 +1672,7 @@ MoveTileBlockMapPointerEast::
MoveTileBlockMapPointerWest::
ld a, [de]
sub a,$01
sub $01
ld [de], a
ret nc
inc de
@ -1682,7 +1682,7 @@ MoveTileBlockMapPointerWest::
ret
MoveTileBlockMapPointerSouth::
add a,MAP_BORDER * 2
add MAP_BORDER * 2
ld b, a
ld a, [de]
add b
@ -1695,7 +1695,7 @@ MoveTileBlockMapPointerSouth::
ret
MoveTileBlockMapPointerNorth::
add a,MAP_BORDER * 2
add MAP_BORDER * 2
ld b, a
ld a, [de]
sub b
@ -1873,7 +1873,7 @@ JoypadOverworld::
ld hl, wSimulatedJoypadStatesIndex
dec [hl]
ld a, [hl]
cp a,$ff
cp $ff
jr z, .doneSimulating ; if the end of the simulated button presses has been reached
ld hl, wSimulatedJoypadStatesEnd
add l
@ -1928,11 +1928,11 @@ CollisionCheckOnWater::
jr c, .collision
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player (puts it in c and [wTileInFrontOfPlayer])
ld a, [wTileInFrontOfPlayer] ; tile in front of player
cp a,$14 ; water tile
cp $14 ; water tile
jr z, .noCollision ; keep surfing if it's a water tile
cp a,$32 ; either the left tile of the S.S. Anne boarding platform or the tile on eastern coastlines (depending on the current tileset)
cp $32 ; either the left tile of the S.S. Anne boarding platform or the tile on eastern coastlines (depending on the current tileset)
jr z, .checkIfVermilionDockTileset
cp a,$48 ; tile on right on coast lines in Safari Zone
cp $48 ; tile on right on coast lines in Safari Zone
jr z, .noCollision ; keep surfing
; check if the [land] tile in front of the player is passable
.checkIfNextTileIsPassable
@ -1942,7 +1942,7 @@ CollisionCheckOnWater::
ld l, a
.loop
ld a, [hli]
cp a,$ff
cp $ff
jr z, .collision
cp c
jr z, .stopSurfing ; stop surfing if the tile is passable
@ -2224,7 +2224,7 @@ LoadMapHeader::
ld [hl], a ; this appears pointless, since the value is overwritten immediately after
ld a, [hLoadSpriteTemp2]
ld [hLoadSpriteTemp1], a
and a,$3f
and $3f
ld [hl], a ; store text ID in byte 1 of sprite entry
pop hl
ld a, [hLoadSpriteTemp1]
@ -2368,7 +2368,7 @@ LoadMapData::
call RunPaletteCommand
call LoadPlayerSpriteGraphics
ld a, [wd732]
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
jr nz, .restoreRomBank
ld a, [wFlags_D733]
bit 1, a

View file

@ -375,16 +375,16 @@ TextCommandProcessor::
NextTextCommand::
ld a, [hli]
cp a, "@" ; terminator
cp "@" ; terminator
jr nz, .doTextCommand
pop af
ld [wLetterPrintingDelayFlags], a
ret
.doTextCommand
push hl
cp a, $17
cp $17
jp z, TextCommand17
cp a, $0e
cp $0e
jp nc, TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB
; if a < 0xE, use a jump table
ld hl, TextCommandJumpTable
@ -500,7 +500,7 @@ TextCommand05::
; (no arguments)
TextCommand06::
ld a, [wLinkState]
cp a,LINK_STATE_BATTLING
cp LINK_STATE_BATTLING
jp z, TextCommand0D
ld a, "▼"
Coorda 18, 16 ; place down arrow in lower right corner of dialogue text box
@ -549,10 +549,10 @@ TextCommand09::
ld h, b
ld l, c
ld b, a
and a,$0f
and $0f
ld c, a
ld a, b
and a,$f0
and $f0
swap a
set BIT_LEFT_ALIGN,a
ld b, a
@ -569,7 +569,7 @@ TextCommand0A::
push bc
call Joypad
ld a, [hJoyHeld]
and a,A_BUTTON | B_BUTTON
and A_BUTTON | B_BUTTON
jr nz, .skipDelay
ld c, 30
call DelayFrames
@ -596,11 +596,11 @@ TextCommand0B::
inc hl
jr .loop
.matchFound
cp a,$14
cp $14
jr z, .pokemonCry
cp a,$15
cp $15
jr z, .pokemonCry
cp a,$16
cp $16
jr z, .pokemonCry
ld a, [hl]
call PlaySound
@ -647,7 +647,7 @@ TextCommand0C::
call Joypad
pop de
ld a, [hJoyHeld] ; joypad state
and a,A_BUTTON | B_BUTTON
and A_BUTTON | B_BUTTON
jr nz, .skipDelay ; if so, skip the delay
ld c, 10
call DelayFrames

View file

@ -69,8 +69,8 @@ RedrawRowOrColumn::
.noCarry
; the following 4 lines wrap us from bottom to top if necessary
ld a, d
and a,$03
or a,$98
and $03
or $98
ld d, a
dec c
jr nz, .loop1
@ -102,10 +102,10 @@ RedrawRowOrColumn::
ld a, e
inc a
; the following 6 lines wrap us from the right edge to the left edge if necessary
and a,$1f
and $1f
ld b, a
ld a, e
and a,$e0
and $e0
or b
ld e, a
dec c