Merge pull request #171 from xCrystal/master

Misc style fixes
This commit is contained in:
Daniel Harding 2018-02-05 11:13:02 -06:00 committed by GitHub
commit 37ded1d150
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 7342 additions and 7342 deletions

View file

@ -6,27 +6,27 @@ FRZ EQU 5
PAR EQU 6 PAR EQU 6
; volatile statuses 1 ; volatile statuses 1
StoringEnergy EQU 0 ; Bide STORING_ENERGY EQU 0 ; Bide
ThrashingAbout EQU 1 ; e.g. Thrash THRASHING_ABOUT EQU 1 ; e.g. Thrash
AttackingMultipleTimes EQU 2 ; e.g. Double Kick, Fury Attack ATTACKING_MULTIPLE_TIMES EQU 2 ; e.g. Double Kick, Fury Attack
Flinched EQU 3 FLINCHED EQU 3
ChargingUp EQU 4 ; e.g. Solar Beam, Fly CHARGING_UP EQU 4 ; e.g. Solar Beam, Fly
UsingTrappingMove EQU 5 ; e.g. Wrap USING_TRAPPING_MOVE EQU 5 ; e.g. Wrap
Invulnerable EQU 6 ; charging up Fly/Dig INVULNERABLE EQU 6 ; charging up Fly/Dig
Confused EQU 7 CONFUSED EQU 7
; volatile statuses 2 ; volatile statuses 2
UsingXAccuracy EQU 0 USING_X_ACCURACY EQU 0
ProtectedByMist EQU 1 PROTECTED_BY_MIST EQU 1
GettingPumped EQU 2 ; Focus Energy GETTING_PUMPED EQU 2 ; Focus Energy
; EQU 3 ; unused? ; EQU 3 ; unused
HasSubstituteUp EQU 4 HAS_SUBSTITUTE_UP EQU 4
NeedsToRecharge EQU 5 ; Hyper Beam NEEDS_TO_RECHARGE EQU 5 ; Hyper Beam
UsingRage EQU 6 USING_RAGE EQU 6
Seeded EQU 7 SEEDED EQU 7
; volatile statuses 3 ; volatile statuses 3
BadlyPoisoned EQU 0 BADLY_POISONED EQU 0
HasLightScreenUp EQU 1 HAS_LIGHT_SCREEN_UP EQU 1
HasReflectUp EQU 2 HAS_REFLECT_UP EQU 2
Transformed EQU 3 TRANSFORMED EQU 3

View file

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

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,15 @@
DecrementPP: DecrementPP:
; after using a move, decrement pp in battle and (if not transformed?) in party ; after using a move, decrement pp in battle and (if not transformed?) in party
ld a, [de] ld a, [de]
cp a, STRUGGLE cp STRUGGLE
ret z ; if the pokemon is using "struggle", there's nothing to do ret z ; if the pokemon is using "struggle", there's nothing to do
; we don't decrement PP for "struggle" ; we don't decrement PP for "struggle"
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the
; wPlayerBattleStatus2 status flags later ; wPlayerBattleStatus2 status flags later
and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes) and (1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << ATTACKING_MULTIPLE_TIMES)
ret nz ; if any of these statuses are true, don't decrement PP ret nz ; if any of these statuses are true, don't decrement PP
bit UsingRage, [hl] bit USING_RAGE, [hl]
ret nz ; don't decrement PP either if Pokemon is using Rage ret nz ; don't decrement PP either if Pokemon is using Rage
ld hl, wBattleMonPP ; PP of first move (in battle) ld hl, wBattleMonPP ; PP of first move (in battle)
@ -18,7 +18,7 @@ DecrementPP:
; decrement PP in the party struct ; decrement PP in the party struct
ld a, [wPlayerBattleStatus3] ld a, [wPlayerBattleStatus3]
bit Transformed, a bit TRANSFORMED, a
ret nz ; Return if transformed. Pokemon Red stores the "current pokemon's" PP ret nz ; Return if transformed. Pokemon Red stores the "current pokemon's" PP
; separately from the "Pokemon in your party's" PP. This is ; separately from the "Pokemon in your party's" PP. This is
; duplication -- in all cases *other* than Pokemon with Transform. ; duplication -- in all cases *other* than Pokemon with Transform.

View file

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

View file

@ -11,7 +11,7 @@ ConversionEffect_:
pop de pop de
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
.conversionEffect .conversionEffect
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly) bit INVULNERABLE, a ; is mon immune to typical attacks (dig/fly)
jr nz, PrintButItFailedText jr nz, PrintButItFailedText
; copy target's types to user ; copy target's types to user
ld a, [hli] ld a, [hli]

View file

@ -5,9 +5,9 @@ FocusEnergyEffect_:
jr z, .notEnemy jr z, .notEnemy
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
.notEnemy .notEnemy
bit GettingPumped, [hl] ; is mon already using focus energy? bit GETTING_PUMPED, [hl] ; is mon already using focus energy?
jr nz, .alreadyUsing jr nz, .alreadyUsing
set GettingPumped, [hl] ; mon is now using focus energy set GETTING_PUMPED, [hl] ; mon is now using focus energy
callab PlayCurrentMoveAnimation callab PlayCurrentMoveAnimation
ld hl, GettingPumpedText ld hl, GettingPumpedText
jp PrintText jp PrintText

View file

@ -47,14 +47,14 @@ HazeEffect_:
jp PrintText jp PrintText
CureVolatileStatuses: CureVolatileStatuses:
res Confused, [hl] res CONFUSED, [hl]
inc hl ; BATTSTATUS2 inc hl ; BATTSTATUS2
ld a, [hl] ld a, [hl]
; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses ; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses
and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded)) and $ff ^((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
ld [hli], a ; BATTSTATUS3 ld [hli], a ; BATTSTATUS3
ld a, [hl] ld a, [hl]
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses
ld [hl], a ld [hl], a
ret ret

View file

@ -19,9 +19,9 @@ LeechSeedEffect_:
ld a, [de] ld a, [de]
cp GRASS cp GRASS
jr z, .moveMissed jr z, .moveMissed
bit Seeded, [hl] bit SEEDED, [hl]
jr nz, .moveMissed jr nz, .moveMissed
set Seeded, [hl] set SEEDED, [hl]
callab PlayCurrentMoveAnimation callab PlayCurrentMoveAnimation
ld hl, WasSeededText ld hl, WasSeededText
jp PrintText jp PrintText

View file

@ -5,9 +5,9 @@ MistEffect_:
jr z, .mistEffect jr z, .mistEffect
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
.mistEffect .mistEffect
bit ProtectedByMist, [hl] ; is mon protected by mist? bit PROTECTED_BY_MIST, [hl] ; is mon protected by mist?
jr nz, .mistAlreadyInUse jr nz, .mistAlreadyInUse
set ProtectedByMist, [hl] ; mon is now protected by mist set PROTECTED_BY_MIST, [hl] ; mon is now protected by mist
callab PlayCurrentMoveAnimation callab PlayCurrentMoveAnimation
ld hl, ShroudedInMistText ld hl, ShroudedInMistText
jp PrintText jp PrintText

View file

@ -10,15 +10,15 @@ ReflectLightScreenEffect_:
ld a, [de] ld a, [de]
cp LIGHT_SCREEN_EFFECT cp LIGHT_SCREEN_EFFECT
jr nz, .reflect jr nz, .reflect
bit HasLightScreenUp, [hl] ; is mon already protected by light screen? bit HAS_LIGHT_SCREEN_UP, [hl] ; is mon already protected by light screen?
jr nz, .moveFailed jr nz, .moveFailed
set HasLightScreenUp, [hl] ; mon is now protected by light screen set HAS_LIGHT_SCREEN_UP, [hl] ; mon is now protected by light screen
ld hl, LightScreenProtectedText ld hl, LightScreenProtectedText
jr .playAnim jr .playAnim
.reflect .reflect
bit HasReflectUp, [hl] ; is mon already protected by reflect? bit HAS_REFLECT_UP, [hl] ; is mon already protected by reflect?
jr nz, .moveFailed jr nz, .moveFailed
set HasReflectUp, [hl] ; mon is now protected by reflect set HAS_REFLECT_UP, [hl] ; mon is now protected by reflect
ld hl, ReflectGainedArmorText ld hl, ReflectGainedArmorText
.playAnim .playAnim
push hl push hl

View file

@ -12,7 +12,7 @@ SubstituteEffect_:
ld bc, wEnemyBattleStatus2 ld bc, wEnemyBattleStatus2
.notEnemy .notEnemy
ld a, [bc] ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute? bit HAS_SUBSTITUTE_UP, a ; user already has substitute?
jr nz, .alreadyHasSubstitute jr nz, .alreadyHasSubstitute
; quarter health to remove from user ; quarter health to remove from user
; assumes max HP is 1023 or lower ; assumes max HP is 1023 or lower
@ -43,7 +43,7 @@ SubstituteEffect_:
ld [hl], d ld [hl], d
ld h, b ld h, b
ld l, c ld l, c
set HasSubstituteUp, [hl] set HAS_SUBSTITUTE_UP, [hl]
ld a, [wOptions] ld a, [wOptions]
bit 7, a ; battle animation is enabled? bit 7, a ; battle animation is enabled?
ld hl, PlayCurrentMoveAnimation ld hl, PlayCurrentMoveAnimation

View file

@ -12,7 +12,7 @@ TransformEffect_:
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
.hitTest .hitTest
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig) bit INVULNERABLE, a ; is mon invulnerable to typical attacks? (fly/dig)
jp nz, .failed jp nz, .failed
push hl push hl
push de push de
@ -24,7 +24,7 @@ TransformEffect_:
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
.transformEffect .transformEffect
; animation(s) played are different if target has Substitute up ; animation(s) played are different if target has Substitute up
bit HasSubstituteUp, [hl] bit HAS_SUBSTITUTE_UP, [hl]
push af push af
ld hl, HideSubstituteShowMonAnim ld hl, HideSubstituteShowMonAnim
ld b, BANK(HideSubstituteShowMonAnim) ld b, BANK(HideSubstituteShowMonAnim)
@ -44,7 +44,7 @@ TransformEffect_:
call nz, Bankswitch call nz, Bankswitch
pop bc pop bc
ld a, [bc] ld a, [bc]
set Transformed, a ; mon is now Transformed set TRANSFORMED, a ; mon is now transformed
ld [bc], a ld [bc], a
pop de pop de
pop hl pop hl

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -54,7 +54,7 @@ RedisplayStartMenu::
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
ld a, b 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 jp nz, CloseStartMenu
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2 call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
CheckEvent EVENT_GOT_POKEDEX CheckEvent EVENT_GOT_POKEDEX
@ -62,17 +62,17 @@ RedisplayStartMenu::
jr nz, .displayMenuItem jr nz, .displayMenuItem
inc a ; adjust position to account for missing pokedex menu item inc a ; adjust position to account for missing pokedex menu item
.displayMenuItem .displayMenuItem
cp a,0 cp 0
jp z, StartMenu_Pokedex jp z, StartMenu_Pokedex
cp a,1 cp 1
jp z, StartMenu_Pokemon jp z, StartMenu_Pokemon
cp a,2 cp 2
jp z, StartMenu_Item jp z, StartMenu_Item
cp a,3 cp 3
jp z, StartMenu_TrainerInfo jp z, StartMenu_TrainerInfo
cp a,4 cp 4
jp z, StartMenu_SaveReset jp z, StartMenu_SaveReset
cp a,5 cp 5
jp z, StartMenu_Option jp z, StartMenu_Option
; EXIT falls through to here ; EXIT falls through to here

View file

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

View file

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

View file

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

View file

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

View file

@ -26,7 +26,7 @@ DisplayPokemartDialogue_:
ld h, a ld h, a
ld a, [wMenuExitMethod] ld a, [wMenuExitMethod]
cp a,CANCELLED_MENU cp CANCELLED_MENU
jp z, .done jp z, .done
ld a, [wChosenMenuItem] ld a, [wChosenMenuItem]
and a ; buying? and a ; buying?
@ -90,7 +90,7 @@ DisplayPokemartDialogue_:
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu
ld a, [wMenuExitMethod] 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 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 ; The following code is supposed to check if the player chose No, but the above
@ -168,7 +168,7 @@ DisplayPokemartDialogue_:
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu
ld a, [wMenuExitMethod] 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 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 ; The following code is supposed to check if the player chose No, but the above

View file

@ -269,7 +269,7 @@ BadgeBlkDataLengths:
db 6 ; Earth Badge db 6 ; Earth Badge
DeterminePaletteID: DeterminePaletteID:
bit Transformed, a ; a is battle status 3 bit TRANSFORMED, a ; a is battle status 3
ld a, PAL_GREYMON ; if the mon has used Transform, use Ditto's palette ld a, PAL_GREYMON ; if the mon has used Transform, use Ditto's palette
ret nz ret nz
ld a, [hl] ld a, [hl]
@ -326,7 +326,7 @@ UpdatePartyMenuBlkPacket:
SendSGBPacket: SendSGBPacket:
;check number of packets ;check number of packets
ld a, [hl] ld a, [hl]
and a,$07 and $07
ret z ret z
; store number of packets in B ; store number of packets in B
ld b, a ld b, a

View file

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

View file

@ -576,7 +576,7 @@ GetMonHeader::
ld b, $77 ; size of Aerodactyl fossil sprite ld b, $77 ; size of Aerodactyl fossil sprite
cp FOSSIL_AERODACTYL ; Aerodactyl fossil cp FOSSIL_AERODACTYL ; Aerodactyl fossil
jr z, .specialID jr z, .specialID
cp a,MEW cp MEW
jr z, .mew jr z, .mew
predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number
ld a, [wd11e] ld a, [wd11e]
@ -4045,7 +4045,7 @@ PlaceMenuCursor::
jr nz, .oldMenuItemLoop jr nz, .oldMenuItemLoop
.checkForArrow1 .checkForArrow1
ld a, [hl] 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 jr nz, .skipClearingArrow
.clearArrow .clearArrow
ld a, [wTileBehindCursor] ld a, [wTileBehindCursor]

View file

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

View file

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

View file

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