This commit is contained in:
dannye 2022-12-28 17:38:38 -06:00
commit 3f691fcb21
970 changed files with 15106 additions and 11361 deletions

View file

@ -147,7 +147,7 @@ DrawFrameBlock:
jr z, .resetFrameBlockDestAddr
call AnimationCleanOAM
.resetFrameBlockDestAddr
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld a, l
ld [wFBDestAddr + 1], a
ld a, h
@ -176,8 +176,12 @@ PlayAnimation:
ld h, [hl]
ld l, a
.animationLoop
vc_hook Stop_reducing_move_anim_flashing_Thunderbolt
ld a, [hli]
vc_hook_red Stop_reducing_move_anim_flashing_Reflect
vc_hook_blue Stop_reducing_move_anim_flashing_Self_Destruct
cp -1
vc_hook_blue Stop_reducing_move_anim_flashing_Reflect
jr z, .AnimationOver
cp FIRST_SE_ID ; is this subanimation or a special effect?
jr c, .playSubanimation
@ -245,38 +249,58 @@ PlayAnimation:
push af
ld a, [wAnimPalette]
ldh [rOBP0], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
vc_hook Reduce_move_anim_flashing_Mega_Punch_Self_Destruct_Explosion
call LoadSubanimation
call PlaySubanimation
vc_hook_red Stop_reducing_move_anim_flashing_Mega_Punch
vc_hook_blue Stop_reducing_move_anim_flashing_Mega_Punch_Explosion
pop af
vc_hook_red Stop_reducing_move_anim_flashing_Blizzard
ldh [rOBP0], a
.nextAnimationCommand
vc_hook_red Stop_reducing_move_anim_flashing_Hyper_Beam
vc_hook_blue Stop_reducing_move_anim_flashing_Bubblebeam_Hyper_Beam_Blizzard
pop hl
vc_hook Stop_reducing_move_anim_flashing_Guillotine
jr .animationLoop
.AnimationOver
ret
LoadSubanimation:
vc_hook Reduce_move_anim_flashing_Guillotine
ld a, [wSubAnimAddrPtr + 1]
vc_hook Reduce_move_anim_flashing_Mega_Kick
ld h, a
vc_hook_red Reduce_move_anim_flashing_Blizzard
ld a, [wSubAnimAddrPtr]
vc_hook_red Reduce_move_anim_flashing_Self_Destruct
ld l, a
ld a, [hli]
ld e, a
vc_hook Reduce_move_anim_flashing_Explosion
ld a, [hl]
vc_hook Reduce_move_anim_flashing_Thunderbolt
ld d, a ; de = address of subanimation
ld a, [de]
vc_hook_blue Reduce_move_anim_flashing_Rock_Slide
ld b, a
vc_hook Reduce_move_anim_flashing_Spore
and %00011111
vc_hook Reduce_move_anim_flashing_Bubblebeam
ld [wSubAnimCounter], a ; number of frame blocks
vc_hook_red Reduce_move_anim_flashing_Rock_Slide
vc_hook_blue Reduce_move_anim_flashing_Self_Destruct
ld a, b
and %11100000
cp SUBANIMTYPE_ENEMY << 5
vc_hook_blue Reduce_move_anim_flashing_Blizzard
jr nz, .isNotType5
.isType5
call GetSubanimationTransform2
jr .saveTransformation
.isNotType5
vc_hook Reduce_move_anim_flashing_Hyper_Beam
call GetSubanimationTransform1
.saveTransformation
; place the upper 3 bits of a into bits 0-2 of a before storing
@ -307,6 +331,7 @@ LoadSubanimation:
; sets the transform to SUBANIMTYPE_NORMAL if it's the player's turn
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1:
vc_hook Reduce_move_anim_flashing_Reflect
ld b, a
ldh a, [hWhoseTurn]
and a
@ -327,11 +352,11 @@ GetSubanimationTransform2:
ret
; loads tile patterns for battle animations
LoadAnimationTileset:
LoadMoveAnimationTiles:
ld a, [wWhichBattleAnimTileset]
add a
add a
ld hl, AnimationTilesetPointers
ld hl, MoveAnimationTilesPointers
ld e, a
ld d, 0
add hl, de
@ -342,28 +367,29 @@ LoadAnimationTileset:
ld a, [hl]
ld d, a ; de = address of tileset
ld hl, vSprites tile $31
ld b, BANK(AnimationTileset1) ; ROM bank
ld b, BANK(MoveAnimationTiles0) ; ROM bank
ld a, [wTempTilesetNumTiles]
ld c, a ; number of tiles
jp CopyVideoData ; load tileset
anim_tileset: MACRO
MACRO anim_tileset
db \1
dw \2
db -1 ; padding
ENDM
AnimationTilesetPointers:
MoveAnimationTilesPointers:
; number of tiles, gfx pointer
anim_tileset 79, AnimationTileset1
anim_tileset 79, AnimationTileset2
anim_tileset 64, AnimationTileset1
anim_tileset 79, MoveAnimationTiles0
anim_tileset 79, MoveAnimationTiles1
anim_tileset 64, MoveAnimationTiles2
AnimationTileset1:
INCBIN "gfx/battle/attack_anim_1.2bpp"
MoveAnimationTiles0:
MoveAnimationTiles2:
INCBIN "gfx/battle/move_anim_0.2bpp"
AnimationTileset2:
INCBIN "gfx/battle/attack_anim_2.2bpp"
MoveAnimationTiles1:
INCBIN "gfx/battle/move_anim_1.2bpp"
SlotMachineTiles2:
IF DEF(_RED)
@ -395,15 +421,19 @@ MoveAnimation:
.moveAnimation
; check if battle animations are disabled in the options
ld a, [wOptions]
bit 7, a
bit BIT_BATTLE_ANIMATION, a
jr nz, .animationsDisabled
call ShareMoveAnimations
call PlayAnimation
vc_hook_red Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick
vc_hook_blue Stop_reducing_move_anim_flashing_Spore
jr .next4
.animationsDisabled
ld c, 30
call DelayFrames
.next4
vc_hook_red Stop_reducing_move_anim_flashing
vc_hook_blue Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater
call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage)
.animationFinished
call WaitForSoundToFinish
@ -541,6 +571,7 @@ SetAnimationPalette:
.notSGB
ld a, $e4
ld [wAnimPalette], a
vc_hook Reduce_move_anim_flashing_Dream_Eater
ldh [rOBP0], a
ld a, $6c
ldh [rOBP1], a
@ -553,7 +584,7 @@ PlaySubanimation:
call GetMoveSound
call nc, PlayBattleSound
.skipPlayingSound
ld hl, wOAMBuffer ; base address of OAM buffer
ld hl, wShadowOAM
ld a, l
ld [wFBDestAddr + 1], a
ld a, h
@ -653,7 +684,7 @@ INCLUDE "data/battle_anims/special_effects.asm"
DoBallTossSpecialEffects:
ld a, [wcf91]
cp 3 ; is it a Master Ball or Ultra Ball?
cp ULTRA_BALL + 1 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
ldh a, [rOBP0]
@ -668,7 +699,7 @@ DoBallTossSpecialEffects:
call PlaySound
.skipPlayingSound
ld a, [wIsInBattle]
cp 02 ; is it a trainer battle?
cp 2 ; is it a trainer battle?
jr z, .isTrainerBattle
ld a, [wd11e]
cp $10 ; is the enemy pokemon the Ghost Marowak?
@ -825,7 +856,7 @@ TradeShakePokeball:
; if it's the end of the animation, make the ball jump up
ld de, BallMoveDistances1
.loop
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld bc, 4
.innerLoop
ld a, [de]
@ -855,7 +886,7 @@ BallMoveDistances1:
TradeJumpPokeball:
ld de, BallMoveDistances2
.loop
ld hl, wOAMBuffer ; OAM buffer
ld hl, wShadowOAM
ld bc, 4
.innerLoop
ld a, [de]
@ -895,8 +926,8 @@ BallMoveDistances2:
; this function copies the current musical note graphic
; so that there are two musical notes flying towards the defending pokemon
DoGrowlSpecialEffects:
ld hl, wOAMBuffer ; OAM buffer
ld de, wOAMBuffer + $10
ld hl, wShadowOAM
ld de, wShadowOAMSprite04
ld bc, $10
call CopyData ; copy the musical note graphic
ld a, [wSubAnimCounter]
@ -956,6 +987,7 @@ AnimationFlashScreenLong:
ld [wFlashScreenLongCounter], a
pop hl
jr nz, .loop
vc_hook_red Stop_reducing_move_anim_flashing_Psychic
ret
; BG palettes
@ -1083,7 +1115,7 @@ AnimationWaterDropletsEverywhere:
; in Surf/Mist/Toxic.
xor a
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
ld d, 32
ld a, -16
ld [wBaseCoordX], a
@ -1105,7 +1137,7 @@ AnimationWaterDropletsEverywhere:
ret
_AnimationWaterDroplets:
ld hl, wOAMBuffer
ld hl, wShadowOAM
.loop
ld a, [wBaseCoordY]
ld [hli], a ; Y
@ -1233,7 +1265,7 @@ ShakeEnemyHUD_WritePlayerMonPicOAM:
ld [wBaseCoordX], a
ld a, $30
ld [wBaseCoordY], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld d, 0
ld c, 7
.loop
@ -1467,7 +1499,7 @@ AnimationSpiralBallsInward:
.loop
push hl
ld c, 3
ld de, wOAMBuffer
ld de, wShadowOAM
.innerLoop
ld a, [hl]
cp $ff
@ -1603,10 +1635,10 @@ _AnimationShootBallsUpward:
push bc
xor a
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
pop bc
ld d, $7a ; ball tile
ld hl, wOAMBuffer
ld hl, wShadowOAM
push bc
ld a, [wBaseCoordY]
ld e, a
@ -1620,7 +1652,7 @@ _AnimationShootBallsUpward:
ld [wNumShootingBalls], a
.loop
push bc
ld hl, wOAMBuffer
ld hl, wShadowOAM
.innerLoop
ld a, [wBaseCoordY]
add 8
@ -1694,7 +1726,7 @@ AnimationMinimizeMon:
ld bc, 7 * 7 * $10
call FillMemory
pop hl
ld de, $194
ld de, 7 * 3 * $10 + 4 * $10 + 4
add hl, de
ld de, MinimizedMonSprite
ld c, MinimizedMonSpriteEnd - MinimizedMonSprite
@ -1710,7 +1742,15 @@ AnimationMinimizeMon:
jp AnimationShowMonPic
MinimizedMonSprite:
INCBIN "gfx/battle/minimize.1bpp"
; 8x5 partial tile graphic
pusho
opt b.X ; . = 0, X = 1
db %...XX...
db %..XXXX..
db %.XXXXXX.
db %..XXXX..
db %..X..X..
popo
MinimizedMonSpriteEnd:
AnimationSlideMonDownAndHide:
@ -2035,13 +2075,13 @@ InitMultipleObjectsOAM:
push bc
push de
ld [wWhichBattleAnimTileset], a
call LoadAnimationTileset
call LoadMoveAnimationTiles
pop de
pop bc
xor a
ld e, a
ld [wBaseCoordX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
.loop
call BattleAnimWriteOAMEntry
dec c
@ -2316,7 +2356,7 @@ AnimationFallingObjects:
call InitMultipleObjectsOAM
call FallingObjects_InitXCoords
call FallingObjects_InitMovementData
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld [hl], 0
.loop
ld hl, wFallingObjectsMovementData
@ -2343,7 +2383,7 @@ AnimationFallingObjects:
dec c
jr nz, .innerLoop
call Delay3
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld a, [hl] ; Y
cp 104 ; has the top falling object reached 104 yet?
jr nz, .loop ; keep moving the falling objects down until it does
@ -2352,7 +2392,7 @@ AnimationFallingObjects:
FallingObjects_UpdateOAMEntry:
; Increases Y by 2 pixels and adjusts X and X flip based on the falling object's
; movement byte.
ld hl, wOAMBuffer
ld hl, wShadowOAM
add hl, de
ld a, [hl]
inc a
@ -2413,7 +2453,7 @@ FallingObjects_UpdateMovementByte:
ret
FallingObjects_InitXCoords:
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
ld de, FallingObjects_InitialXCoords
ld a, [wNumFallingObjects]
ld c, a

View file

@ -26,7 +26,7 @@ BattleTransition:
jr nz, .loop1
; Clear OAM except for the blocks used by the player and enemy trainer sprites.
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
ld c, 9
.loop2
ld a, b
@ -662,7 +662,7 @@ BattleTransition_Circle_Sub2:
const CIRCLE_LEFT
const CIRCLE_RIGHT
half_circle: MACRO
MACRO half_circle
; quadrant x, circle data, target coord
db \1
dw \2

View file

@ -105,7 +105,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
; instead, the enemy pic is part of the background and uses the scroll register, while the player's head is a sprite and is slid by changing its X coordinates in a loop
SlidePlayerHeadLeft:
push bc
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
ld c, $15 ; number of OAM entries
ld de, $4 ; size of OAM entry
.loop
@ -308,7 +308,7 @@ MainInBattleLoop:
and a
ret nz ; return if pokedoll was used to escape from battle
ld a, [wBattleMonStatus]
and (1 << FRZ) | SLP ; is mon frozen or asleep?
and (1 << FRZ) | SLP_MASK
jr nz, .selectEnemyMove ; if so, jump
ld a, [wPlayerBattleStatus1]
and (1 << STORING_ENERGY) | (1 << USING_TRAPPING_MOVE) ; check player is using Bide or using a multi-turn attack like wrap
@ -402,12 +402,12 @@ MainInBattleLoop:
cp USING_INTERNAL_CLOCK
jr z, .invertOutcome
call BattleRandom
cp $80
cp 50 percent + 1
jr c, .playerMovesFirst
jr .enemyMovesFirst
.invertOutcome
call BattleRandom
cp $80
cp 50 percent + 1
jr c, .enemyMovesFirst
jr .playerMovesFirst
.enemyMovesFirst
@ -790,7 +790,7 @@ FaintEnemyPokemon:
call WaitForSoundToFinish
;.sfxwait
; ld a, [wChannelSoundIDs + Ch5]
; ld a, [wChannelSoundIDs + CHAN5]
; cp SFX_FAINT_FALL
; jr z, .sfxwait
@ -875,7 +875,7 @@ EndLowHealthAlarm:
; the low health alarm and prevents it from reactivating until the next battle.
xor a
ld [wLowHealthAlarm], a ; turn off low health alarm
; ld [wChannelSoundIDs + Ch5], a
; ld [wChannelSoundIDs + CHAN5], a
inc a
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
ret
@ -1328,7 +1328,7 @@ EnemySendOutFirstMon:
ld [wWhichPokemon], a
jr .next3
.next
ld b, $FF
ld b, $ff
.next2
inc b
ld a, [wEnemyMonPartyPos]
@ -1381,7 +1381,7 @@ EnemySendOutFirstMon:
cp LINK_STATE_BATTLING
jr z, .next4
ld a, [wOptions]
bit 6, a
bit BIT_BATTLE_SHIFT, a
jr nz, .next4
ld hl, TrainerAboutToUseText
call PrintText
@ -1873,7 +1873,7 @@ DrawPlayerHUDAndHPBar:
ld [hl], $0
ret z
xor a
; ld [wChannelSoundIDs + Ch5], a
; ld [wChannelSoundIDs + CHAN5], a
ret
.setLowHealthAlarm
ld hl, wLowHealthAlarm
@ -2096,7 +2096,7 @@ DisplayBattleMenu::
ld [hli], a ; wMaxMenuItem
ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
call HandleMenuInput
bit 4, a ; check if right was pressed
bit BIT_D_RIGHT, a
jr nz, .rightColumn
jr .AButtonPressed ; the A button was pressed
.rightColumn ; put cursor in right column of menu
@ -2248,7 +2248,7 @@ UseBagItem:
ld a, [wcf91]
ld [wd11e], a
call GetItemName
call CopyStringToCF4B ; copy name
call CopyToStringBuffer
xor a
ld [wPseudoItemID], a
call UseItem
@ -2359,7 +2359,7 @@ PartyMenuOrRockOrRun:
xor a
ld [hl], a ; wLastMenuItem
call HandleMenuInput
bit 1, a ; was A pressed?
bit BIT_B_BUTTON, a
jr nz, .partyMonDeselected ; if B was pressed, jump
; A was pressed
call PlaceUnfilledArrowMenuCursor
@ -2943,7 +2943,7 @@ SelectEnemyMove:
and (1 << CHARGING_UP) | (1 << THRASHING_ABOUT) ; using a charging move or thrash/petal dance
ret nz
ld a, [wEnemyMonStatus]
and SLP | 1 << FRZ ; sleeping or frozen
and (1 << FRZ) | SLP_MASK
ret nz
ld a, [wEnemyBattleStatus1]
and (1 << USING_TRAPPING_MOVE) | (1 << STORING_ENERGY) ; using a trapping move like wrap or bide
@ -2971,19 +2971,19 @@ SelectEnemyMove:
.chooseRandomMove
push hl
call BattleRandom
ld b, $1
cp $3f ; select move 1, [0,3e] (63/256 chance)
ld b, 1 ; 25% chance to select move 1
cp 25 percent
jr c, .moveChosen
inc hl
inc b
cp $7f ; select move 2, [3f,7e] (64/256 chance)
inc b ; 25% chance to select move 2
cp 50 percent
jr c, .moveChosen
inc hl
inc b
cp $be ; select move 3, [7f,bd] (63/256 chance)
inc b ; 25% chance to select move 3
cp 75 percent - 1
jr c, .moveChosen
inc hl
inc b ; select move 4, [be,ff] (66/256 chance)
inc b ; 25% chance to select move 4
.moveChosen
ld a, b
dec a
@ -3032,6 +3032,7 @@ LinkBattleExchangeData:
ld a, b
.doExchange
ld [wSerialExchangeNybbleSendData], a
vc_hook Wireless_start_exchange
callfar PrintWaitingText
.syncLoop1
call Serial_ExchangeNybble
@ -3039,18 +3040,33 @@ LinkBattleExchangeData:
ld a, [wSerialExchangeNybbleReceiveData]
inc a
jr z, .syncLoop1
vc_hook Wireless_end_exchange
vc_patch Wireless_net_delay_1
IF DEF(_RED_VC) || DEF(_BLUE_VC)
ld b, 26
ELSE
ld b, 10
ENDC
vc_patch_end
.syncLoop2
call DelayFrame
call Serial_ExchangeNybble
dec b
jr nz, .syncLoop2
vc_hook Wireless_start_send_zero_bytes
vc_patch Wireless_net_delay_2
IF DEF(_RED_VC) || DEF(_BLUE_VC)
ld b, 26
ELSE
ld b, 10
ENDC
vc_patch_end
.syncLoop3
call DelayFrame
call Serial_SendZeroByte
dec b
jr nz, .syncLoop3
vc_hook Wireless_end_send_zero_bytes
ret
ExecutePlayerMove:
@ -3268,7 +3284,7 @@ PrintGhostText:
and a
jr nz, .Ghost
ld a, [wBattleMonStatus] ; player's turn
and SLP | (1 << FRZ)
and (1 << FRZ) | SLP_MASK
ret nz
ld hl, ScaredText
call PrintText
@ -3295,7 +3311,7 @@ IsGhostBattle:
ld a, [wCurMap]
cp POKEMON_TOWER_1F
jr c, .next
cp MR_FUJIS_HOUSE
cp POKEMON_TOWER_7F + 1
jr nc, .next
ld b, SILPH_SCOPE
call IsItemInBag
@ -3310,7 +3326,7 @@ IsGhostBattle:
CheckPlayerStatusConditions:
ld hl, wBattleMonStatus
ld a, [hl]
and SLP ; sleep mask
and SLP_MASK
jr z, .FrozenCheck
; sleeping
dec a
@ -3346,7 +3362,7 @@ CheckPlayerStatusConditions:
.HeldInPlaceCheck
ld a, [wEnemyBattleStatus1]
bit USING_TRAPPING_MOVE, a ; is enemy using a mult-turn move like wrap?
bit USING_TRAPPING_MOVE, a ; is enemy using a multi-turn move like wrap?
jp z, .FlinchedCheck
ld hl, CantMoveText
call PrintText
@ -3407,7 +3423,7 @@ CheckPlayerStatusConditions:
ld a, CONF_ANIM - 1
call PlayMoveAnimation
call BattleRandom
cp $80 ; 50% chance to hurt itself
cp 50 percent + 1 ; chance to hurt itself
jr c, .TriedToUseDisabledMoveCheck
ld hl, wPlayerBattleStatus1
ld a, [hl]
@ -3442,7 +3458,7 @@ CheckPlayerStatusConditions:
ld hl, wPlayerBattleStatus1
ld a, [hl]
; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage)
and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
ld [hl], a
ld a, [wPlayerMoveEffect]
cp FLY_EFFECT
@ -3553,7 +3569,7 @@ CheckPlayerStatusConditions:
ld a, RAGE
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
call CopyToStringBuffer
xor a
ld [wPlayerMoveEffect], a
ld hl, PlayerCanExecuteMove
@ -3755,7 +3771,7 @@ PrintMoveName:
ret
_PrintMoveName:
text_far _CF4BText
text_far _MoveNameText
text_asm
ld hl, ExclamationPointPointerTable
ld a, [wd11e] ; exclamation point num
@ -4022,7 +4038,7 @@ CheckForDisobedience:
call BattleRandom
add a
swap a
and SLP ; sleep mask
and SLP_MASK
jr z, .monNaps ; keep trying until we get at least 1 turn of sleep
ld [wBattleMonStatus], a
ld hl, BeganToNapText
@ -4616,7 +4632,7 @@ CriticalHitTest:
dec hl
ld c, [hl] ; read move id
ld a, [de]
bit GETTING_PUMPED, a ; test for focus energy
bit GETTING_PUMPED, a ; test for focus energy
jr nz, .focusEnergyUsed ; bug: using focus energy causes a shift to the right instead of left,
; resulting in 1/4 the usual crit chance
sla b ; (effective (base speed/2)*2)
@ -5117,7 +5133,7 @@ ReloadMoveData:
call IncrementMovePP
; the follow two function calls are used to reload the move name
call GetMoveName
call CopyStringToCF4B
call CopyToStringBuffer
ld a, $01
and a
ret
@ -5137,12 +5153,13 @@ MetronomePickMove:
; values for enemy turn
ld de, wEnemyMoveNum
ld hl, wEnemySelectedMove
; loop to pick a random number in the range [1, $a5) to be the move used by Metronome
; loop to pick a random number in the range of valid moves used by Metronome
.pickMoveLoop
call BattleRandom
and a
jr z, .pickMoveLoop
cp NUM_ATTACKS ; max move number (including Struggle)
cp STRUGGLE
assert NUM_ATTACKS == STRUGGLE ; random numbers greater than STRUGGLE are not moves
jr nc, .pickMoveLoop
cp METRONOME
jr z, .pickMoveLoop
@ -5355,15 +5372,15 @@ MoveHitTest:
cp DREAM_EATER_EFFECT
jr nz, .swiftCheck
ld a, [bc]
and SLP ; is the target pokemon sleeping?
and SLP_MASK
jp z, .moveMissed
.swiftCheck
ld a, [de]
cp SWIFT_EFFECT
ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
ret z ; Swift never misses (this was fixed from the Japanese versions)
call CheckTargetSubstitute ; substitute check (note that this overwrites a)
jr z, .checkForDigOrFlyStatus
; This code is buggy. It's supposed to prevent HP draining moves from working on substitutes.
; The fix for Swift broke this code. It's supposed to prevent HP draining moves from working on Substitutes.
; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works.
cp DRAIN_HP_EFFECT
jp z, .moveMissed
@ -5618,7 +5635,7 @@ EnemyCanExecuteChargingMove:
ld [wNameListType], a
call GetName
ld de, wcd6d
call CopyStringToCF4B
call CopyToStringBuffer
EnemyCanExecuteMove:
xor a
ld [wMonIsDisobedient], a
@ -5789,7 +5806,7 @@ ExecuteEnemyMoveDone:
CheckEnemyStatusConditions:
ld hl, wEnemyMonStatus
ld a, [hl]
and SLP ; sleep mask
and SLP_MASK
jr z, .checkIfFrozen
dec a ; decrement number of turns left
ld [wEnemyMonStatus], a
@ -5941,7 +5958,7 @@ CheckEnemyStatusConditions:
bit PAR, [hl]
jr z, .checkIfUsingBide
call BattleRandom
cp $3f ; 25% to be fully paralysed
cp 25 percent ; chance to be fully paralysed
jr nc, .checkIfUsingBide
ld hl, FullyParalyzedText
call PrintText
@ -5949,7 +5966,7 @@ CheckEnemyStatusConditions:
ld hl, wEnemyBattleStatus1
ld a, [hl]
; clear bide, thrashing about, charging up, and multi-turn moves such as warp
and $ff ^ ((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
and ~((1 << STORING_ENERGY) | (1 << THRASHING_ABOUT) | (1 << CHARGING_UP) | (1 << USING_TRAPPING_MOVE))
ld [hl], a
ld a, [wEnemyMoveEffect]
cp FLY_EFFECT
@ -6055,7 +6072,7 @@ CheckEnemyStatusConditions:
ld a, RAGE
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
call CopyToStringBuffer
xor a
ld [wEnemyMoveEffect], a
ld hl, EnemyCanExecuteMove
@ -6097,7 +6114,7 @@ GetCurrentMove:
ld [wNameListType], a
call GetName
ld de, wcd6d
jp CopyStringToCF4B
jp CopyToStringBuffer
LoadEnemyMonData:
ld a, [wLinkState]
@ -6317,9 +6334,10 @@ LoadPlayerBackPic:
ld de, OldManPicBack
.next
ld a, BANK(RedPicBack)
ASSERT BANK(RedPicBack) == BANK(OldManPicBack)
call UncompressSpriteFromDE
predef ScaleSpriteByTwo
ld hl, wOAMBuffer
ld hl, wShadowOAM
xor a
ldh [hOAMTile], a ; initial tile number
ld b, $7 ; 7 columns
@ -6669,7 +6687,14 @@ BattleRandom:
ld a, [hl]
pop bc
pop hl
vc_hook Unknown_BattleRandom_ret_c
vc_patch BattleRandom_ret
IF DEF(_RED_VC) || DEF(_BLUE_VC)
ret
ELSE
ret c
ENDC
vc_patch_end
; if we picked the last seed, we need to recalculate the nine seeds
push hl
@ -6734,7 +6759,9 @@ HandleExplodingAnimation:
PlayMoveAnimation:
ld [wAnimationID], a
vc_hook_red Reduce_move_anim_flashing_Confusion
call Delay3
vc_hook_red Reduce_move_anim_flashing_Psychic
predef_jump MoveAnimation
InitBattle::
@ -6751,11 +6778,11 @@ InitOpponent:
DetermineWildOpponent:
ld a, [wd732]
bit 1, a
jr z, .asm_3ef2f
jr z, .notDebug
ldh a, [hJoyHeld]
bit 1, a ; B button pressed?
bit BIT_B_BUTTON, a
ret nz
.asm_3ef2f
.notDebug
ld a, [wNumberOfNoRandomBattleStepsLeft]
and a
ret nz
@ -6889,7 +6916,7 @@ _LoadTrainerPic:
ld d, a ; de contains pointer to trainer pic
ld a, [wLinkState]
and a
ld a, BANK(TrainerPics) ; this is where all the trainer pics are (not counting Red's)
ld a, BANK("Pics 6") ; this is where all the trainer pics are (not counting Red's)
jr z, .loadSprite
ld a, BANK(RedPicFront)
.loadSprite
@ -6908,9 +6935,9 @@ ResetCryModifiers:
; animates the mon "growing" out of the pokeball
AnimateSendingOutMon:
ld a, [wPredefRegisters]
ld a, [wPredefHL]
ld h, a
ld a, [wPredefRegisters + 1]
ld a, [wPredefHL + 1]
ld l, a
ldh a, [hStartTileID]
ldh [hBaseTileID], a
@ -6948,9 +6975,9 @@ AnimateSendingOutMon:
jr CopyUncompressedPicToHL
CopyUncompressedPicToTilemap:
ld a, [wPredefRegisters]
ld a, [wPredefHL]
ld h, a
ld a, [wPredefRegisters + 1]
ld a, [wPredefHL + 1]
ld l, a
ldh a, [hStartTileID]
CopyUncompressedPicToHL::

View file

@ -27,7 +27,7 @@ SetupOwnPartyPokeballs:
ld [hl], a
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
jp WritePokeballOAMData
SetupEnemyPartyPokeballs:
@ -41,7 +41,7 @@ SetupEnemyPartyPokeballs:
ld [hl], $20
ld a, -8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer + PARTY_LENGTH * 4
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData
SetupPokeballs:
@ -174,7 +174,7 @@ SetupPlayerAndEnemyPokeballs:
ld [hl], $40
ld a, 8
ld [wHUDPokeballGfxOffsetX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
call WritePokeballOAMData
ld hl, wEnemyMons
ld de, wEnemyPartyCount
@ -183,7 +183,7 @@ SetupPlayerAndEnemyPokeballs:
ld a, $50
ld [hli], a
ld [hl], $68
ld hl, wOAMBuffer + $18
ld hl, wShadowOAMSprite06
jp WritePokeballOAMData
; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (fainted) and pokeball slot (no mon)

View file

@ -98,10 +98,10 @@ PoisonEffect:
jr z, .noEffect
ld a, [de]
cp POISON_SIDE_EFFECT1
ld b, $34 ; ~20% chance of poisoning
ld b, 20 percent + 1 ; chance of poisoning
jr z, .sideEffectTest
cp POISON_SIDE_EFFECT2
ld b, $67 ; ~40% chance of poisoning
ld b, 40 percent + 1 ; chance of poisoning
jr z, .sideEffectTest
push hl
push de
@ -548,7 +548,7 @@ StatModifierDownEffect:
cp LINK_STATE_BATTLING
jr z, .statModifierDownEffect
call BattleRandom
cp $40 ; 1/4 chance to miss by in regular battle
cp 25 percent + 1 ; chance to miss by in regular battle
jp c, MoveMissed
.statModifierDownEffect
call CheckTargetSubstitute ; can't hit through substitute
@ -557,7 +557,7 @@ StatModifierDownEffect:
cp ATTACK_DOWN_SIDE_EFFECT
jr c, .nonSideEffect
call BattleRandom
cp $55 ; 85/256 chance for side effects
cp 33 percent + 1 ; chance for side effects
jp nc, CantLowerAnymore
ld a, [de]
sub ATTACK_DOWN_SIDE_EFFECT ; map each stat to 0-3
@ -751,7 +751,7 @@ PrintStatText:
jr z, .findStatName_outer
jr .findStatName_inner
.foundStatName
ld de, wcf4b
ld de, wStringBuffer
ld bc, $a
jp CopyData
@ -819,14 +819,14 @@ SwitchAndTeleportEffect:
jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed
add b
ld c, a
inc c ; c = sum of player level and enemy level
inc c ; c = playerLevel + enemyLevel + 1
.rejectionSampleLoop1
call BattleRandom
cp c ; get a random number between 0 and c
jr nc, .rejectionSampleLoop1
srl b
srl b ; b = enemyLevel / 4
cp b ; is rand[0, playerLevel + enemyLevel) >= (enemyLevel / 4)?
cp b ; is rand[0, playerLevel + enemyLevel] >= (enemyLevel / 4)?
jr nc, .playerMoveWasSuccessful ; if so, allow teleporting
ld c, 50
call DelayFrames
@ -979,9 +979,9 @@ FlinchSideEffect:
.flinchSideEffect
ld a, [de]
cp FLINCH_SIDE_EFFECT1
ld b, $1a ; ~10% chance of flinch
ld b, 10 percent + 1 ; chance of flinch (FLINCH_SIDE_EFFECT1)
jr z, .gotEffectChance
ld b, $4d ; ~30% chance of flinch
ld b, 30 percent + 1 ; chance of flinch otherwise
.gotEffectChance
call BattleRandom
cp b
@ -1111,7 +1111,7 @@ RecoilEffect:
ConfusionSideEffect:
call BattleRandom
cp $19 ; ~10% chance
cp 10 percent ; chance of confusion
ret nc
jr ConfusionSideEffectSuccess

View file

@ -46,7 +46,7 @@ EndOfBattle:
.resetVariables
xor a
ld [wLowHealthAlarm], a ;disable low health alarm
; ld [wChannelSoundIDs + Ch5], a
; ld [wChannelSoundIDs + CHAN5], a
ld [wIsInBattle], a
ld [wBattleType], a
ld [wMoveMissed], a

View file

@ -58,7 +58,7 @@ CopyMonPicFromBGToSpriteVRAM:
ld [wBaseCoordY], a
ld a, $70
ld [wBaseCoordX], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
lb bc, 6, 6
ld d, $8
.oamLoop

View file

@ -113,7 +113,7 @@ GetMonSpecies:
ld hl, wBoxSpecies
jr .getSpecies
.enemyParty
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
.getSpecies
ld d, 0
add hl, de

View file

@ -24,7 +24,7 @@ HazeEffect_:
.cureStatuses
ld a, [hl]
ld [hl], $0
and SLP | (1 << FRZ)
and (1 << FRZ) | SLP_MASK
jr z, .cureVolatileStatuses
; prevent the Pokemon from executing a move if it was asleep or frozen
ld a, $ff
@ -51,7 +51,7 @@ CureVolatileStatuses:
inc hl ; BATTSTATUS2
ld a, [hl]
; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses
and $ff ^((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
and ~((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
ld [hli], a ; BATTSTATUS3
ld a, [hl]
and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses

View file

@ -45,7 +45,7 @@ SubstituteEffect_:
ld l, c
set HAS_SUBSTITUTE_UP, [hl]
ld a, [wOptions]
bit 7, a ; battle animation is enabled?
bit BIT_BATTLE_ANIMATION, a
ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)
jr z, .animationEnabled

View file

@ -5,7 +5,7 @@ ReadTrainer:
and a
ret nz
; set [wEnemyPartyCount] to 0, [wEnemyPartyMons] to FF
; set [wEnemyPartyCount] to 0, [wEnemyPartySpecies] to FF
; XXX first is total enemy pokemon?
; XXX second is species of first pokemon?
ld hl, wEnemyPartyCount

View file

@ -342,7 +342,10 @@ CooltrainerMAI:
jp AIUseXAttack
CooltrainerFAI:
; The intended 25% chance to consider switching will not apply.
; Uncomment the line below to fix this.
cp 25 percent + 1
; ret nc
ld a, 10
call AICheckIfHPBelowFraction
jp c, AIUseHyperPotion

View file

@ -26,7 +26,7 @@ IF DEF(_DEBUG)
ld de, DebugMenuOptions
call PlaceString
ld a, 3 ; medium speed
ld a, TEXT_DELAY_MEDIUM
ld [wOptions], a
ld a, A_BUTTON | B_BUTTON | START

View file

@ -46,7 +46,7 @@ IF DEF(_DEBUG)
ld [wTownVisitedFlag + 1], a
; Get all badges except Earth Badge.
ld a, $ff ^ (1 << BIT_EARTHBADGE)
ld a, ~(1 << BIT_EARTHBADGE)
ld [wObtainedBadges], a
call SetIshiharaTeam

View file

@ -27,7 +27,7 @@ GiveFossilToCinnabarLab::
ld hl, wd730
res 6, [hl]
call HandleMenuInput
bit 1, a ; pressed B?
bit BIT_B_BUTTON, a
jr nz, .cancelledGivingFossil
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
@ -116,7 +116,7 @@ LoadFossilItemAndMonName::
ld a, [wFossilMon]
ld [wd11e], a
call GetMonName
call CopyStringToCF4B
call CopyToStringBuffer
ld a, [wFossilItem]
ld [wd11e], a
call GetItemName

View file

@ -1,4 +1,4 @@
CIRCLE_TILE_ID EQU $70
DEF CIRCLE_TILE_ID EQU $70
DisplayDiploma::
call SaveScreenTilesToBuffer2
@ -17,9 +17,10 @@ DisplayDiploma::
hlcoord 0, 0
lb bc, 16, 18
predef Diploma_TextBoxBorder
ld hl, DiplomaTextPointersAndCoords
ld c, $5
.asm_56715
.placeTextLoop
push bc
ld a, [hli]
ld e, a
@ -34,7 +35,7 @@ DisplayDiploma::
inc hl
pop bc
dec c
jr nz, .asm_56715
jr nz, .placeTextLoop
hlcoord 10, 4
ld de, wPlayerName
call PlaceString
@ -42,7 +43,7 @@ DisplayDiploma::
; Move the player 33 pixels right and set the priority bit so he appears
; behind the background layer.
ld hl, wOAMBuffer + $01
ld hl, wShadowOAMSprite00XCoord
lb bc, $80, $28
.adjustPlayerGfxLoop
ld a, [hl] ; X
@ -83,7 +84,7 @@ UnusedPlayerNameLengthFunc:
dec c
jr .loop
diploma_text: MACRO
MACRO diploma_text
dw \3
dwcoord \1, \2
ENDM

View file

@ -7,7 +7,7 @@ _GivePokemon::
ld a, [wPartyCount]
cp PARTY_LENGTH
jr c, .addToParty
ld a, [wNumInBox]
ld a, [wBoxCount]
cp MONS_PER_BOX
jr nc, .boxFull
; add to box
@ -18,7 +18,7 @@ _GivePokemon::
callfar LoadEnemyMonData
call SetPokedexOwnedFlag
callfar SendNewMonToBox
ld hl, wcf4b
ld hl, wStringBuffer
ld a, [wCurrentBoxNum]
and $7f
cp 9

View file

@ -79,9 +79,9 @@ SaffronCityPokecenterBenchGuyText::
text_asm
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
ld hl, SaffronCityPokecenterBenchGuyText2
jr nz, .asm_624f2
jr nz, .printText
ld hl, SaffronCityPokecenterBenchGuyText1
.asm_624f2
.printText
call PrintText
jp TextScriptEnd

View file

@ -95,7 +95,7 @@ BillsHousePokemonList::
call PrintText
call SaveScreenTilesToBuffer2
call HandleMenuInput
bit 1, a ; pressed b
bit BIT_B_BUTTON, a
jr nz, .cancel
ld a, [wCurrentMenuItem]
add EEVEE

View file

@ -32,7 +32,7 @@ CinnabarGymQuiz::
call PrintText
ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call CinnabarGymQuiz_1ea92
call CinnabarGymQuiz_AskQuestion
jp TextScriptEnd
CinnabarGymQuizIntroText:
@ -75,7 +75,7 @@ CinnabarGymGateFlagAction:
EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
predef_jump FlagActionPredef
CinnabarGymQuiz_1ea92:
CinnabarGymQuiz_AskQuestion:
call YesNoChoice
ldh a, [hGymGateAnswer]
ld c, a
@ -183,12 +183,12 @@ UpdateCinnabarGymGateTileBlocks_::
jr nz, .loop
ret
gym_gate_coord: MACRO
MACRO gym_gate_coord
db \1, \2, \3, 0
ENDM
HORIZONTAL_GATE_BLOCK EQU $54
VERTICAL_GATE_BLOCK EQU $5f
DEF HORIZONTAL_GATE_BLOCK EQU $54
DEF VERTICAL_GATE_BLOCK EQU $5f
CinnabarGymGateCoords:
; x coord, y coord, block id

View file

@ -39,7 +39,7 @@ SafariZoneGameOver:
call WaitForSoundToFinish
;.waitForMusicToPlay
; ld a, [wChannelSoundIDs + Ch5]
; ld a, [wChannelSoundIDs + CHAN5]
; cp SFX_SAFARI_ZONE_PA
; jr nz, .waitForMusicToPlay

View file

@ -36,7 +36,7 @@ LinkCableHelp::
ld hl, LinkCableHelpText2
call PrintText
call HandleMenuInput
bit 1, a ; pressed b
bit BIT_B_BUTTON, a
jr nz, .exit
ld a, [wCurrentMenuItem]
cp 3 ; pressed a on "STOP READING"
@ -122,9 +122,9 @@ ViridianSchoolBlackboard::
ld hl, ViridianSchoolBlackboardText2
call PrintText
call HandleMenuInput ; pressing up and down is handled in here
bit 1, a ; pressed b
bit BIT_B_BUTTON, a ; pressed b
jr nz, .exitBlackboard
bit 4, a ; pressed right
bit BIT_D_RIGHT, a
jr z, .didNotPressRight
; move cursor to right column
ld a, 2
@ -137,7 +137,7 @@ ViridianSchoolBlackboard::
ld [wMenuItemOffset], a
jr .blackboardLoop
.didNotPressRight
bit 5, a ; pressed left
bit BIT_D_LEFT, a
jr z, .didNotPressLeftOrRight
; move cursor to left column
ld a, 2

View file

@ -8,7 +8,7 @@ PewterGuys:
add hl, de
ld d, h
ld e, l
ld hl, PointerTable_37ce6
ld hl, PewterGuysCoordsTable
ld a, [wWhichPewterGuy]
add a
ld b, 0
@ -48,7 +48,7 @@ PewterGuys:
inc hl
jr .findMatchingCoordsLoop
PointerTable_37ce6:
PewterGuysCoordsTable:
dw PewterMuseumGuyCoords
dw PewterGymGuyCoords

View file

@ -26,7 +26,7 @@ DisplayDexRating:
CheckAndResetEventA EVENT_HALL_OF_FAME_DEX_RATING
jr nz, .hallOfFame
push hl
ld hl, PokedexRatingText_441cc
ld hl, DexCompletionText
call PrintText
pop hl
call PrintText
@ -51,88 +51,88 @@ DisplayDexRating:
ld [de], a
ret
PokedexRatingText_441cc:
text_far _OaksLabText_441cc
DexCompletionText:
text_far _DexCompletionText
text_end
DexRatingsTable:
dbw 10, PokedexRatingText_44201
dbw 20, PokedexRatingText_44206
dbw 30, PokedexRatingText_4420b
dbw 40, PokedexRatingText_44210
dbw 50, PokedexRatingText_44215
dbw 60, PokedexRatingText_4421a
dbw 70, PokedexRatingText_4421f
dbw 80, PokedexRatingText_44224
dbw 90, PokedexRatingText_44229
dbw 100, PokedexRatingText_4422e
dbw 110, PokedexRatingText_44233
dbw 120, PokedexRatingText_44238
dbw 130, PokedexRatingText_4423d
dbw 140, PokedexRatingText_44242
dbw 150, PokedexRatingText_44247
dbw NUM_POKEMON + 1, PokedexRatingText_4424c
dbw 10, DexRatingText_Own0To9
dbw 20, DexRatingText_Own10To19
dbw 30, DexRatingText_Own20To29
dbw 40, DexRatingText_Own30To39
dbw 50, DexRatingText_Own40To49
dbw 60, DexRatingText_Own50To59
dbw 70, DexRatingText_Own60To69
dbw 80, DexRatingText_Own70To79
dbw 90, DexRatingText_Own80To89
dbw 100, DexRatingText_Own90To99
dbw 110, DexRatingText_Own100To109
dbw 120, DexRatingText_Own110To119
dbw 130, DexRatingText_Own120To129
dbw 140, DexRatingText_Own130To139
dbw 150, DexRatingText_Own140To149
dbw NUM_POKEMON + 1, DexRatingText_Own150To151
PokedexRatingText_44201:
text_far _OaksLabText_44201
DexRatingText_Own0To9:
text_far _DexRatingText_Own0To9
text_end
PokedexRatingText_44206:
text_far _OaksLabText_44206
DexRatingText_Own10To19:
text_far _DexRatingText_Own10To19
text_end
PokedexRatingText_4420b:
text_far _OaksLabText_4420b
DexRatingText_Own20To29:
text_far _DexRatingText_Own20To29
text_end
PokedexRatingText_44210:
text_far _OaksLabText_44210
DexRatingText_Own30To39:
text_far _DexRatingText_Own30To39
text_end
PokedexRatingText_44215:
text_far _OaksLabText_44215
DexRatingText_Own40To49:
text_far _DexRatingText_Own40To49
text_end
PokedexRatingText_4421a:
text_far _OaksLabText_4421a
DexRatingText_Own50To59:
text_far _DexRatingText_Own50To59
text_end
PokedexRatingText_4421f:
text_far _OaksLabText_4421f
DexRatingText_Own60To69:
text_far _DexRatingText_Own60To69
text_end
PokedexRatingText_44224:
text_far _OaksLabText_44224
DexRatingText_Own70To79:
text_far _DexRatingText_Own70To79
text_end
PokedexRatingText_44229:
text_far _OaksLabText_44229
DexRatingText_Own80To89:
text_far _DexRatingText_Own80To89
text_end
PokedexRatingText_4422e:
text_far _OaksLabText_4422e
DexRatingText_Own90To99:
text_far _DexRatingText_Own90To99
text_end
PokedexRatingText_44233:
text_far _OaksLabText_44233
DexRatingText_Own100To109:
text_far _DexRatingText_Own100To109
text_end
PokedexRatingText_44238:
text_far _OaksLabText_44238
DexRatingText_Own110To119:
text_far _DexRatingText_Own110To119
text_end
PokedexRatingText_4423d:
text_far _OaksLabText_4423d
DexRatingText_Own120To129:
text_far _DexRatingText_Own120To129
text_end
PokedexRatingText_44242:
text_far _OaksLabText_44242
DexRatingText_Own130To139:
text_far _DexRatingText_Own130To139
text_end
PokedexRatingText_44247:
text_far _OaksLabText_44247
DexRatingText_Own140To149:
text_far _DexRatingText_Own140To149
text_end
PokedexRatingText_4424c:
text_far _OaksLabText_4424c
DexRatingText_Own150To151:
text_far _DexRatingText_Own150To151
text_end

View file

@ -159,7 +159,7 @@ DisplayPokemartDialogue_::
ld a, [wcf91] ; item ID
ld [wd11e], a ; store item ID for GetItemName
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
ld hl, PokemartTellBuyPriceText
call PrintText
hlcoord 14, 7

View file

@ -31,7 +31,7 @@ CeladonPrizeMenu::
ld hl, WhichPrizeTextPtr
call PrintText
call HandleMenuInput ; menu choice handler
bit 1, a ; keypress = B (Cancel)
bit BIT_B_BUTTON, a
jr nz, .noChoice
ld a, [wCurrentMenuItem]
cp 3 ; "NO,THANKS" choice

View file

@ -31,7 +31,7 @@ VendingMachineMenu::
ld hl, wd730
res 6, [hl]
call HandleMenuInput
bit 1, a ; pressed B?
bit BIT_B_BUTTON, a
jr nz, .notThirsty
ld a, [wCurrentMenuItem]
cp 3 ; chose Cancel?

View file

@ -215,10 +215,10 @@ UpdateHPBar_PrintHPNumber:
push hl
ldh a, [hUILayoutFlags]
bit 0, a
jr z, .asm_fb15
jr z, .hpBelowBar
ld de, $9
jr .next
.asm_fb15
.hpBelowBar
ld de, $15
.next
add hl, de

View file

@ -43,7 +43,7 @@ GetAnimationSpeed:
.resetSprites
push bc
ld hl, wMonPartySpritesSavedOAM
ld de, wOAMBuffer
ld de, wShadowOAM
ld bc, $60
call CopyData
pop bc
@ -51,7 +51,7 @@ GetAnimationSpeed:
jr .incTimer
.animateSprite
push bc
ld hl, wOAMBuffer + $02 ; OAM tile id
ld hl, wShadowOAMSprite00TileID
ld bc, $10
ld a, [wCurrentMenuItem]
call AddNTimes
@ -236,7 +236,7 @@ WriteMonPartySpriteOAM:
; make a copy at wMonPartySpritesSavedOAM.
push af
ld c, $10
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
ldh a, [hPartyMonIndex]
swap a
ld l, a
@ -252,7 +252,7 @@ WriteMonPartySpriteOAM:
; Make a copy of the OAM buffer with the first animation frame written so that
; we can flip back to it from the second frame by copying it back.
.makeCopy
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wMonPartySpritesSavedOAM
ld bc, $60
jp CopyData
@ -280,8 +280,8 @@ GetPartyMonSpriteID:
INCLUDE "data/pokemon/menu_icons.asm"
INC_FRAME_1 EQUS "0, $20"
INC_FRAME_2 EQUS "$20, $20"
DEF INC_FRAME_1 EQUS "0, $20"
DEF INC_FRAME_2 EQUS "$20, $20"
BugIconFrame1: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_1
PlantIconFrame1: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_1

View file

@ -16,7 +16,7 @@ DMARoutine:
LOAD "OAM DMA", HRAM
hDMARoutine::
; initiate DMA
ld a, HIGH(wOAMBuffer)
ld a, HIGH(wShadowOAM)
ldh [rDMA], a
; wait for DMA to finish
ld a, $28

View file

@ -443,14 +443,14 @@ PrepareSuperNintendoVRAMTransfer:
.packetPointers
; Only the first packet is needed.
dw MaskEnFreezePacket
dw DataSnd_72548
dw DataSnd_72558
dw DataSnd_72568
dw DataSnd_72578
dw DataSnd_72588
dw DataSnd_72598
dw DataSnd_725a8
dw DataSnd_725b8
dw DataSndPacket1
dw DataSndPacket2
dw DataSndPacket3
dw DataSndPacket4
dw DataSndPacket5
dw DataSndPacket6
dw DataSndPacket7
dw DataSndPacket8
CheckSGB:
; Returns whether the game is running on an SGB in carry.
@ -484,6 +484,7 @@ CheckSGB:
ldh a, [rJOYP]
ldh a, [rJOYP]
call Wait7000
vc_hook Unknown_network_reset
call Wait7000
ld a, $30
ldh [rJOYP], a

View file

@ -1,6 +1,6 @@
PrepareOAMData::
; Determine OAM data for currently visible
; sprites and write it to wOAMBuffer.
; sprites and write it to wShadowOAM.
ld a, [wUpdateSpritesEnabled]
dec a
@ -79,7 +79,7 @@ PrepareOAMData::
ldh a, [hOAMBufferOffset]
ld e, a
ld d, HIGH(wOAMBuffer)
ld d, HIGH(wShadowOAM)
.tileLoop
ldh a, [hSpriteScreenY] ; temp for sprite Y position
@ -147,7 +147,7 @@ PrepareOAMData::
; Clear unused OAM.
ldh a, [hOAMBufferOffset]
ld l, a
ld h, HIGH(wOAMBuffer)
ld h, HIGH(wShadowOAM)
ld de, $4
ld b, $a0
ld a, [wd736]

View file

@ -120,7 +120,7 @@ ItemUseBall:
ld a, [wPartyCount] ; is party full?
cp PARTY_LENGTH
jr nz, .canUseBall
ld a, [wNumInBox] ; is box full?
ld a, [wBoxCount] ; is box full?
cp MONS_PER_BOX
jp z, BoxFullCannotThrowBall
@ -225,7 +225,7 @@ ItemUseBall:
ld a, [wEnemyMonStatus]
and a
jr z, .skipAilmentValueSubtraction ; no ailments
and 1 << FRZ | SLP
and (1 << FRZ) | SLP_MASK
ld c, 12
jr z, .notFrozenOrAsleep
ld c, 25
@ -380,7 +380,7 @@ ItemUseBall:
ld a, [wEnemyMonStatus]
and a
jr z, .skip5
and 1 << FRZ | SLP
and (1 << FRZ) | SLP_MASK
ld b, 5
jr z, .addAilmentValue
ld b, 10
@ -878,7 +878,7 @@ ItemUseMedicine:
lb bc, ICE_HEAL_MSG, 1 << FRZ
cp ICE_HEAL
jr z, .checkMonStatus
lb bc, AWAKENING_MSG, SLP
lb bc, AWAKENING_MSG, SLP_MASK
cp AWAKENING
jr z, .checkMonStatus
lb bc, PARALYZ_HEAL_MSG, 1 << PAR
@ -991,7 +991,7 @@ ItemUseMedicine:
.notFullHP ; if the pokemon's current HP doesn't equal its max HP
xor a
ld [wLowHealthAlarm], a ;disable low health alarm
; ld [wChannelSoundIDs + Ch5], a
; ld [wChannelSoundIDs + CHAN5], a
push hl
push de
ld bc, wPartyMon1MaxHP - (wPartyMon1HP + 1)
@ -1175,7 +1175,7 @@ ItemUseMedicine:
xor a
ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data
.calculateHPBarCoords
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld bc, 2 * SCREEN_WIDTH
inc d
.calculateHPBarCoordsLoop
@ -1307,9 +1307,9 @@ ItemUseMedicine:
jr nz, .statNameInnerLoop
jr .statNameLoop
.gotStatName
ld de, wcf4b
ld de, wStringBuffer
ld bc, 10
call CopyData ; copy the stat's name to wcf4b
call CopyData ; copy the stat's name to wStringBuffer
ld a, SFX_HEAL_AILMENT
call PlaySound
ld hl, VitaminStatRoseText
@ -1700,7 +1700,7 @@ ItemUsePokeflute:
.inBattle
xor a
ld [wWereAnyMonsAsleep], a
ld b, ~SLP & $ff
ld b, ~SLP_MASK
ld hl, wPartyMon1Status
call WakeUpEntireParty
ld a, [wIsInBattle]
@ -1736,7 +1736,7 @@ ItemUsePokeflute:
call WaitForSoundToFinish
; farcall Music_PokeFluteInBattle ; play in-battle pokeflute music
;.musicWaitLoop ; wait for music to finish playing
; ld a, [wChannelSoundIDs + Ch7]
; ld a, [wChannelSoundIDs + CHAN7]
; and a ; music off?
; jr nz, .musicWaitLoop
@ -1757,7 +1757,7 @@ WakeUpEntireParty:
.loop
ld a, [hl]
push af
and SLP ; is pokemon asleep?
and SLP_MASK
jr z, .notAsleep
ld a, 1
ld [wWereAnyMonsAsleep], a ; indicate that a pokemon had to be woken up
@ -1804,7 +1804,7 @@ PlayedFluteHadEffectText:
ld c, 0 ; BANK(SFX_Pokeflute)
call PlaySound
;.musicWaitLoop ; wait for music to finish playing
; ld a, [wChannelSoundIDs + Ch3]
; ld a, [wChannelSoundIDs + CHAN3]
; cp SFX_POKEFLUTE
; jr z, .musicWaitLoop
call PlayDefaultMusic ; start playing normal music again
@ -1989,7 +1989,7 @@ ItemUsePPRestore:
ld a, [hl]
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
pop hl
ld a, [wPPRestoreItem]
cp ETHER
@ -2166,7 +2166,7 @@ ItemUseTMHM:
ld a, [wd11e]
ld [wMoveNum], a
call GetMoveName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
pop af
ld hl, BootedUpTMText
jr nc, .printBootedUpMachineText
@ -2192,7 +2192,7 @@ ItemUseTMHM:
ld a, [wcf91]
push af
.chooseMon
ld hl, wcf4b
ld hl, wStringBuffer
ld de, wTempMoveNameBuffer
ld bc, 14
call CopyData ; save the move name because DisplayPartyMenu will overwrite it
@ -2203,7 +2203,7 @@ ItemUseTMHM:
call DisplayPartyMenu
push af
ld hl, wTempMoveNameBuffer
ld de, wcf4b
ld de, wStringBuffer
ld bc, 14
call CopyData
pop af
@ -2558,7 +2558,7 @@ TossItem_::
ld a, [wcf91]
ld [wd11e], a
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
ld hl, IsItOKToTossItemText
call PrintText
hlcoord 14, 7
@ -2578,7 +2578,7 @@ TossItem_::
ld a, [wcf91]
ld [wd11e], a
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
ld hl, ThrewAwayItemText
call PrintText
pop hl
@ -2619,9 +2619,10 @@ IsKeyItem_::
jr nc, .checkIfItemIsHM
; if the item is not an HM or TM
push af
ld hl, KeyItemBitfield
ld hl, KeyItemFlags
ld de, wBuffer
ld bc, 15 ; only 11 bytes are actually used
ASSERT 15 >= (NUM_ITEMS + 7) / 8
call CopyData
pop af
dec a
@ -2643,14 +2644,14 @@ IsKeyItem_::
INCLUDE "data/items/key_items.asm"
SendNewMonToBox:
ld de, wNumInBox
ld de, wBoxCount
ld a, [de]
inc a
ld [de], a
ld a, [wcf91]
ld [wd0b5], a
ld c, a
.asm_e7b1
.loop
inc de
ld a, [de]
ld b, a
@ -2658,13 +2659,13 @@ SendNewMonToBox:
ld c, b
ld [de], a
cp $ff
jr nz, .asm_e7b1
jr nz, .loop
call GetMonHeader
ld hl, wBoxMonOT
ld bc, NAME_LENGTH
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
jr z, .asm_e7ee
jr z, .skip
dec a
call AddNTimes
push hl
@ -2673,10 +2674,10 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
ld b, a
.asm_e7db
.loop2
push bc
push hl
ld bc, NAME_LENGTH
@ -2688,15 +2689,15 @@ SendNewMonToBox:
add hl, bc
pop bc
dec b
jr nz, .asm_e7db
.asm_e7ee
jr nz, .loop2
.skip
ld hl, wPlayerName
ld de, wBoxMonOT
ld bc, NAME_LENGTH
call CopyData
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
jr z, .asm_e82a
jr z, .skip2
ld hl, wBoxMonNicks
ld bc, NAME_LENGTH
dec a
@ -2707,10 +2708,10 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
ld b, a
.asm_e817
.loop3
push bc
push hl
ld bc, NAME_LENGTH
@ -2722,15 +2723,15 @@ SendNewMonToBox:
add hl, bc
pop bc
dec b
jr nz, .asm_e817
.asm_e82a
jr nz, .loop3
.skip2
ld hl, wBoxMonNicks
ld a, NAME_MON_SCREEN
ld [wNamingScreenType], a
predef AskName
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
jr z, .asm_e867
jr z, .skip3
ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1
dec a
@ -2741,10 +2742,10 @@ SendNewMonToBox:
ld d, h
ld e, l
pop hl
ld a, [wNumInBox]
ld a, [wBoxCount]
dec a
ld b, a
.asm_e854
.loop4
push bc
push hl
ld bc, wBoxMon2 - wBoxMon1
@ -2756,8 +2757,8 @@ SendNewMonToBox:
add hl, bc
pop bc
dec b
jr nz, .asm_e854
.asm_e867
jr nz, .loop4
.skip3
ld a, [wEnemyMonLevel]
ld [wEnemyMonBoxLevel], a
ld hl, wEnemyMon
@ -2787,11 +2788,11 @@ SendNewMonToBox:
inc de
xor a
ld b, NUM_STATS * 2
.asm_e89f
.loop5
ld [de], a
inc de
dec b
jr nz, .asm_e89f
jr nz, .loop5
ld hl, wEnemyMonDVs
ld a, [hli]
ld [de], a
@ -2800,12 +2801,12 @@ SendNewMonToBox:
ld [de], a
ld hl, wEnemyMonPP
ld b, NUM_MOVES
.asm_e8b1
.loop6
ld a, [hli]
inc de
ld [de], a
dec b
jr nz, .asm_e8b1
jr nz, .loop6
ret
; checks if the tile in front of the player is a shore or water tile
@ -2923,7 +2924,7 @@ FindWildLocationsOfMon:
CheckMapForMon:
inc hl
ld b, $a
ld b, NUM_WILDMONS
.loop
ld a, [wd11e]
cp [hl]

View file

@ -1,4 +1,4 @@
NOT_VISITED EQU $fe
DEF NOT_VISITED EQU $fe
DisplayTownMap:
call LoadTownMap
@ -16,7 +16,7 @@ DisplayTownMap:
hlcoord 1, 0
ld de, wcd6d
call PlaceString
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $10
call CopyData
@ -47,7 +47,7 @@ DisplayTownMap:
call TownMapCoordsToOAMCoords
ld a, $4
ld [wOAMBaseTile], a
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
call WriteTownMapSpriteOAM ; town map cursor sprite
pop hl
ld de, wcd6d
@ -60,7 +60,7 @@ DisplayTownMap:
hlcoord 1, 0
ld de, wcd6d
call PlaceString
ld hl, wOAMBuffer + $10
ld hl, wShadowOAMSprite04
ld de, wTileMapBackup + 16
ld bc, $10
call CopyData
@ -249,7 +249,7 @@ ToText:
db "To@"
BuildFlyLocationsList:
ld hl, wFlyLocationsList - 1
ld hl, wFlyAnimUsingCoordList
ld [hl], $ff
inc hl
ld a, [wTownVisitedFlag]
@ -362,7 +362,7 @@ DrawPlayerOrBirdSprite:
inc de
cp "@"
jr nz, .loop
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $a0
jp CopyData
@ -370,7 +370,7 @@ DrawPlayerOrBirdSprite:
DisplayWildLocations:
farcall FindWildLocationsOfMon
call ZeroOutDuplicatesInList
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTownMapCoords
.loop
ld a, [de]
@ -410,7 +410,7 @@ DisplayWildLocations:
ld b, $0
call DrawPlayerOrBirdSprite
.done
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld de, wTileMapBackup
ld bc, $a0
jp CopyData
@ -439,9 +439,9 @@ TownMapCoordsToOAMCoords:
WritePlayerOrBirdSpriteOAM:
ld a, [wOAMBaseTile]
and a
ld hl, wOAMBuffer + $90 ; for player sprite
ld hl, wShadowOAMSprite36 ; for player sprite
jr z, WriteTownMapSpriteOAM
ld hl, wOAMBuffer + $80 ; for bird sprite
ld hl, wShadowOAMSprite32 ; for bird sprite
WriteTownMapSpriteOAM:
push hl
@ -600,13 +600,13 @@ TownMapSpriteBlinkingAnimation::
jr nz, .done
; show sprites when the counter reaches 50
ld hl, wTileMapBackup
ld de, wOAMBuffer
ld de, wShadowOAM
ld bc, $90
call CopyData
xor a
jr .done
.hideSprites
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld b, $24
ld de, $4
.hideSpritesLoop

View file

@ -123,19 +123,22 @@ CableClub_DoBattleOrTradeAgain:
ldh [rIE], a
ld hl, wSerialRandomNumberListBlock
ld de, wSerialOtherGameboyRandomNumberListBlock
ld bc, $11
ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH
vc_hook Wireless_ExchangeBytes_RNG_state_unknown_Type5
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
ld hl, wSerialPlayerDataBlock
ld de, wSerialEnemyDataBlock
ld bc, $1a8
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
vc_hook Wireless_ExchangeBytes_party_structs
call Serial_ExchangeBytes
ld a, SERIAL_NO_DATA_BYTE
ld [de], a
ld hl, wSerialPartyMonsPatchList
ld de, wSerialEnemyMonsPatchList
ld bc, $c8
ld bc, 200
vc_hook Wireless_ExchangeBytes_patch_lists
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ldh [rIE], a
@ -345,7 +348,7 @@ TradeCenter_SelectMon:
res 1, [hl]
and a
jp z, .getNewInput
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr z, .enemyMonMenu_ANotPressed
; if A button pressed
ld a, [wMaxMenuItem]
@ -364,7 +367,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.enemyMonMenu_ANotPressed
bit 5, a ; Left pressed?
bit BIT_D_LEFT, a
jr z, .enemyMonMenu_LeftNotPressed
; if Left pressed, switch back to the player mon menu
xor a ; player mon menu
@ -384,7 +387,7 @@ TradeCenter_SelectMon:
ld [wCurrentMenuItem], a
jr .playerMonMenu
.enemyMonMenu_LeftNotPressed
bit 7, a ; Down pressed?
bit BIT_D_DOWN, a
jp z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.playerMonMenu
@ -412,7 +415,7 @@ TradeCenter_SelectMon:
jr nz, .playerMonMenu_SomethingPressed
jp .getNewInput
.playerMonMenu_SomethingPressed
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr z, .playerMonMenu_ANotPressed
jp .chosePlayerMon ; jump if A button pressed
; unreachable code
@ -422,7 +425,7 @@ TradeCenter_SelectMon:
call TradeCenter_DisplayStats
jp .getNewInput
.playerMonMenu_ANotPressed
bit 4, a ; Right pressed?
bit BIT_D_RIGHT, a
jr z, .playerMonMenu_RightNotPressed
; if Right pressed, switch to the enemy mon menu
ld a, $1 ; enemy mon menu
@ -444,7 +447,7 @@ TradeCenter_SelectMon:
.notPastLastEnemyMon
jp .enemyMonMenu
.playerMonMenu_RightNotPressed
bit 7, a ; Down pressed?
bit BIT_D_DOWN, a
jr z, .getNewInput
jp .selectedCancelMenuItem ; jump if Down pressed
.getNewInput
@ -488,7 +491,7 @@ TradeCenter_SelectMon:
call HandleMenuInput
bit 4, a ; Right pressed?
jr nz, .selectTradeMenuItem
bit 1, a ; B button pressed?
bit BIT_B_BUTTON, a
jr z, .displayPlayerMonStats
.cancelPlayerMonChoice
pop af
@ -503,9 +506,9 @@ TradeCenter_SelectMon:
ld a, 11
ld [wTopMenuItemX], a
call HandleMenuInput
bit 5, a ; Left pressed?
bit BIT_D_LEFT, a
jr nz, .selectStatsMenuItem
bit 1, a ; B button pressed?
bit BIT_B_BUTTON, a
jr nz, .cancelPlayerMonChoice
jr .choseTrade
.displayPlayerMonStats
@ -554,9 +557,9 @@ TradeCenter_SelectMon:
ldh a, [hJoy5]
and a ; pressed anything?
jr z, .cancelMenuItem_JoypadLoop
bit 0, a ; A button pressed?
bit BIT_A_BUTTON, a
jr nz, .cancelMenuItem_APressed
bit 6, a ; Up pressed?
bit BIT_D_UP, a
jr z, .cancelMenuItem_JoypadLoop
; if Up pressed
ld a, " "
@ -648,7 +651,7 @@ TradeCenter_DrawPartyLists:
ld de, wPartySpecies
call TradeCenter_PrintPartyListNames
hlcoord 2, 9
ld de, wEnemyPartyMons
ld de, wEnemyPartySpecies
; fall through
TradeCenter_PrintPartyListNames:
@ -701,7 +704,7 @@ TradeCenter_Trade:
ld bc, NAME_LENGTH
call CopyData
ld a, [wTradingWhichEnemyMon]
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld c, a
ld b, 0
add hl, bc
@ -798,7 +801,7 @@ TradeCenter_Trade:
ld a, [wTradingWhichEnemyMon]
ld c, a
ld [wWhichPokemon], a
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld d, 0
ld e, a
add hl, de
@ -818,7 +821,7 @@ TradeCenter_Trade:
ld a, $1
ld [wForceEvolution], a
ld a, [wTradingWhichEnemyMon]
ld hl, wEnemyPartyMons
ld hl, wEnemyPartySpecies
ld b, 0
ld c, a
add hl, bc
@ -859,6 +862,7 @@ TradeCenter_Trade:
ld de, TradeCompleted
call PlaceString
predef SaveSAVtoSRAM2
vc_hook Trade_save_game_end
ld c, 50
call DelayFrames
xor a

View file

@ -27,6 +27,15 @@ CableClubNPC::
xor a
ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
; This vc_hook causes the Virtual Console to set [hSerialConnectionStatus] to
; USING_INTERNAL_CLOCK, which allows the player to proceed past the link
; receptionist's "Please wait." It assumes that hSerialConnectionStatus is at
; its original address.
vc_hook Link_fake_connection_status
vc_assert hSerialConnectionStatus == $ffaa, \
"hSerialConnectionStatus is no longer located at 00:ffaa"
vc_assert USING_INTERNAL_CLOCK == $02, \
"USING_INTERNAL_CLOCK is no longer equal to $02."
ldh [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
@ -54,6 +63,7 @@ CableClubNPC::
ld a, [wCurrentMenuItem]
and a
jr nz, .choseNo
vc_hook Wireless_TryQuickSave_block_input
callfar SaveSAVtoSRAM
call WaitForSoundToFinish
ld a, SFX_SAVE
@ -66,8 +76,10 @@ CableClubNPC::
xor a
ld [hl], a
ldh [hSerialReceivedNewData], a
vc_hook Wireless_prompt
ld [wSerialExchangeNybbleSendData], a
call Serial_SyncAndExchangeNybble
vc_hook Wireless_net_recheck
ld hl, wUnknownSerialCounter
ld a, [hli]
inc a

View file

@ -68,7 +68,7 @@ _Divide::
ldh [hDivideBuffer+4], a
ld a, $9
ld e, a
.asm_37db3
.loop
ldh a, [hDivideBuffer]
ld c, a
ldh a, [hDividend+1] ; (aliases: hMultiplicand)
@ -78,18 +78,18 @@ _Divide::
ld c, a
ldh a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
sbc c
jr c, .asm_37dce
jr c, .next
ldh [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
ld a, d
ldh [hDividend+1], a ; (aliases: hMultiplicand)
ldh a, [hDivideBuffer+4]
inc a
ldh [hDivideBuffer+4], a
jr .asm_37db3
.asm_37dce
jr .loop
.next
ld a, b
cp $1
jr z, .asm_37e18
jr z, .done
ldh a, [hDivideBuffer+4]
sla a
ldh [hDivideBuffer+4], a
@ -103,7 +103,7 @@ _Divide::
rl a
ldh [hDivideBuffer+1], a
dec e
jr nz, .asm_37e04
jr nz, .next2
ld a, $8
ld e, a
ldh a, [hDivideBuffer]
@ -116,20 +116,20 @@ _Divide::
ldh [hDividend+1], a ; (aliases: hMultiplicand)
ldh a, [hDividend+3]
ldh [hDividend+2], a
.asm_37e04
.next2
ld a, e
cp $1
jr nz, .asm_37e0a
jr nz, .okay
dec b
.asm_37e0a
.okay
ldh a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
srl a
ldh [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
ldh a, [hDivideBuffer]
rr a
ldh [hDivideBuffer], a
jr .asm_37db3
.asm_37e18
jr .loop
.done
ldh a, [hDividend+1] ; (aliases: hMultiplicand)
ldh [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
ldh a, [hDivideBuffer+4]

View file

@ -66,7 +66,7 @@ MainMenu:
ld a, [wSaveFileStatus]
ld [wMaxMenuItem], a
call HandleMenuInput
bit 1, a ; pressed B?
bit BIT_B_BUTTON, a
jp nz, DisplayTitleScreen ; if so, go back to the title screen
ld c, 20
call DelayFrames
@ -125,9 +125,9 @@ MainMenu:
jp SpecialEnterMap
InitOptions:
ld a, 1 ; no delay
ld a, TEXT_DELAY_FAST
ld [wLetterPrintingDelayFlags], a
ld a, 3 ; medium speed
ld a, TEXT_DELAY_MEDIUM
ld [wOptions], a
ret
@ -184,13 +184,13 @@ LinkMenu:
ld b, a
and $f0
cp $d0
jr z, .asm_5c7d
jr z, .checkEnemyMenuSelection
ld a, [wLinkMenuSelectionReceiveBuffer + 1]
ld b, a
and $f0
cp $d0
jr nz, .exchangeMenuSelectionLoop
.asm_5c7d
.checkEnemyMenuSelection
ld a, b
and $c ; did the enemy press A or B?
jr nz, .enemyPressedAOrB
@ -284,9 +284,11 @@ LinkMenu:
.choseCancel
xor a
ld [wMenuJoypadPollCount], a
vc_hook Wireless_net_stop
call Delay3
call CloseLinkConnection
ld hl, LinkCanceledText
vc_hook Wireless_net_end
call PrintText
ld hl, wd72e
res 6, [hl]
@ -477,11 +479,11 @@ DisplayOptionMenu:
ld b, a
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
jr z, .getJoypadStateLoop
bit 1, b ; B button pressed?
bit BIT_B_BUTTON, b
jr nz, .exitMenu
bit 3, b ; Start button pressed?
bit BIT_START, b
jr nz, .exitMenu
bit 0, b ; A button pressed?
bit BIT_A_BUTTON, b
jr z, .checkDirectionKeys
ld a, [wTopMenuItemY]
cp 16 ; is the cursor on Cancel?
@ -496,9 +498,9 @@ DisplayOptionMenu:
jp .loop
.checkDirectionKeys
ld a, [wTopMenuItemY]
bit 7, b ; Down pressed?
bit BIT_D_DOWN, b
jr nz, .downPressed
bit 6, b ; Up pressed?
bit BIT_D_UP, b
jr nz, .upPressed
cp 8 ; cursor in Battle Animation section?
jr z, .cursorInBattleAnimation
@ -507,7 +509,7 @@ DisplayOptionMenu:
cp 16 ; cursor on Cancel?
jr z, .loop
.cursorInTextSpeed
bit 5, b ; Left pressed?
bit BIT_D_LEFT, b
jp nz, .pressedLeftInTextSpeed
jp .pressedRightInTextSpeed
.downPressed
@ -678,11 +680,10 @@ SetCursorPositionsFromOptions:
; 00: X coordinate of menu cursor
; 01: delay after printing a letter (in frames)
TextSpeedOptionData:
db 14, 5 ; Slow
db 7, 3 ; Medium
db 1, 1 ; Fast
db 7 ; default X coordinate (Medium)
db -1 ; end
db 14, TEXT_DELAY_SLOW
db 7, TEXT_DELAY_MEDIUM
db 1, TEXT_DELAY_FAST
db 7, -1 ; end (default X coordinate)
CheckForPlayerNameInSRAM:
; Check if the player name data in SRAM has a string terminator character

View file

@ -39,7 +39,7 @@ AskName:
pop hl
pop af
ld [wUpdateSpritesEnabled], a
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
ret nz
.declinedNickname
@ -63,7 +63,7 @@ DisplayNameRaterScreen::
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
call LoadGBPal
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
jr z, .playerCancelled
ld hl, wPartyMonNicks
@ -109,7 +109,7 @@ DisplayNamingScreen:
ld a, 7
ld [wMaxMenuItem], a
ld a, "@"
ld [wcf4b], a
ld [wStringBuffer], a
xor a
ld hl, wNamingScreenSubmitName
ld [hli], a
@ -157,7 +157,7 @@ DisplayNamingScreen:
.submitNickname
pop de
ld hl, wcf4b
ld hl, wStringBuffer
ld bc, NAME_LENGTH
call CopyData
call GBPalWhiteOutWithDelay3
@ -375,7 +375,7 @@ PrintNicknameAndUnderscores:
lb bc, 1, 10
call ClearScreenArea
hlcoord 10, 2
ld de, wcf4b
ld de, wStringBuffer
call PlaceString
hlcoord 10, 3
ld a, [wNamingScreenType]
@ -437,9 +437,9 @@ DakutensAndHandakutens:
INCLUDE "data/text/dakutens.asm"
; calculates the length of the string at wcf4b and stores it in c
; calculates the length of the string at wStringBuffer and stores it in c
CalcStringLength:
ld hl, wcf4b
ld hl, wStringBuffer
ld c, $0
.loop
ld a, [hl]

View file

@ -131,7 +131,7 @@ RedrawPartyMenu_::
ld l, a
ld de, wEvosMoves
ld a, BANK(EvosMovesPointerTable)
ld bc, wEvosMoves.end - wEvosMoves
ld bc, wEvosMovesEnd - wEvosMoves
call FarCopyData
ld hl, wEvosMoves
ld de, .notAbleToEvolveText

View file

@ -14,7 +14,7 @@ PCMainMenu:
ld hl, wFlags_0xcd60
set 5, [hl]
call HandleMenuInput
bit 1, a ;if player pressed B
bit BIT_B_BUTTON, a
jp nz, LogOff
ld a, [wMaxMenuItem]
cp 2

View file

@ -95,7 +95,7 @@ HandlePokedexSideMenu:
ld [wMenuWatchMovingOutOfBounds], a
.handleMenuInput
call HandleMenuInput
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
ld b, 2
jr nz, .buttonBPressed
ld a, [wCurrentMenuItem]
@ -288,10 +288,10 @@ HandlePokedexListMenu:
call Delay3
call GBPalNormal
call HandleMenuInput
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, .buttonBPressed
.checkIfUpPressed
bit 6, a ; was Up pressed?
bit BIT_D_UP, a
jr z, .checkIfDownPressed
.upPressed ; scroll up one row
ld a, [wListScrollOffset]
@ -301,7 +301,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfDownPressed
bit 7, a ; was Down pressed?
bit BIT_D_DOWN, a
jr z, .checkIfRightPressed
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
@ -316,7 +316,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfRightPressed
bit 4, a ; was Right pressed?
bit BIT_D_RIGHT, a
jr z, .checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
@ -334,7 +334,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfLeftPressed ; scroll up 7 rows
bit 5, a ; was Left pressed?
bit BIT_D_LEFT, a
jr z, .buttonAPressed
.leftPressed
ld a, [wListScrollOffset]

View file

@ -37,20 +37,23 @@ LoadSAV0:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
; This vc_hook does not have to be in any particular location.
; It is defined here because it refers to the same labels as the two lines below.
vc_hook Unknown_save_limit
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp z, .checkSumsMatched
; If the computed checksum didn't match the saved on, try again.
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
@ -84,11 +87,11 @@ LoadSAV1:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jr nz, SAVBadCheckSum
ld hl, sCurBoxData
@ -104,11 +107,11 @@ LoadSAV2:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
ld hl, sPartyData
@ -219,8 +222,8 @@ SaveSAVtoSRAM0:
call CopyData
ldh a, [hTileAnimations]
ld [sTileAnimations], a
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -239,8 +242,8 @@ SaveSAVtoSRAM1:
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -262,8 +265,8 @@ SaveSAVtoSRAM2:
ld de, sMainData
ld bc, wPokedexSeenEnd - wPokedexOwned
call CopyData
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -356,7 +359,7 @@ ChangeBox::
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
bit 1, a ; pressed b
bit BIT_B_BUTTON, a
ret nz
call GetBoxSRAMLocation
ld e, l
@ -580,7 +583,7 @@ GetMonCountsForAllBoxes:
ld c, a
ld b, 0
add hl, bc
ld a, [wNumInBox]
ld a, [wBoxCount]
ld [hl], a
ret
@ -612,8 +615,8 @@ SAVCheckRandomID:
ld a, [sPlayerName]
and a
jr z, .next
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum]

View file

@ -65,7 +65,7 @@ StartMenu_Pokemon::
push af
call LoadScreenTilesFromBuffer1 ; restore saved screen
pop af
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, .loop
; if the B button wasn't pressed
ld a, [wMaxMenuItem]
@ -360,14 +360,14 @@ StartMenu_Item::
ld [hl], a ; old menu item id
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jr z, .useOrTossItem
jp ItemMenuLoop
.useOrTossItem ; if the player made the choice to use or toss the item
ld a, [wcf91]
ld [wd11e], a
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
ld a, [wcf91]
cp BICYCLE
jr nz, .notBicycle2
@ -677,7 +677,7 @@ SwitchPartyMon_ClearGfx:
dec c
jr nz, .clearMonBGLoop
pop af
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld bc, $10
call AddNTimes
ld de, $4

View file

@ -174,9 +174,9 @@ DoBuySellQuitMenu:
ld [wd730], a
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
bit 0, a ; was A pressed?
bit BIT_A_BUTTON, a
jr nz, .pressedA
bit 1, a ; was B pressed? (always true since only A/B are watched)
bit BIT_B_BUTTON, a ; always true since only A/B are watched
jr z, .pressedA
ld a, CANCELLED_MENU
ld [wMenuExitMethod], a
@ -296,8 +296,8 @@ DisplayTwoOptionMenu:
pop hl
.noYesMenuInputLoop
call HandleMenuInput
bit 1, a ; A button pressed?
jr nz, .noYesMenuInputLoop ; try again if A was not pressed
bit BIT_B_BUTTON, a
jr nz, .noYesMenuInputLoop ; try again if B was not pressed
pop af
pop hl
ld [wFlags_0xcd60], a
@ -309,7 +309,7 @@ DisplayTwoOptionMenu:
ld [wTwoOptionMenuID], a
call HandleMenuInput
pop hl
bit 1, a ; A button pressed?
bit BIT_B_BUTTON, a
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
.pressedAButton
ld a, [wCurrentMenuItem]

View file

@ -8,7 +8,7 @@ EvolveMon:
push af
xor a
ld [wLowHealthAlarm], a
; ld [wChannelSoundIDs + Ch5], a
; ld [wChannelSoundIDs + CHAN5], a
dec a ; SFX_STOP_ALL_MUSIC
; ld [wNewSoundID], a
call PlaySound

View file

@ -3,7 +3,7 @@
const MOVE_GENGAR_RIGHT
const MOVE_GENGAR_LEFT
ANIMATION_END EQU 80
DEF ANIMATION_END EQU 80
PlayIntro:
xor a
@ -158,7 +158,7 @@ AnimateIntroNidorino:
jr AnimateIntroNidorino
UpdateIntroNidorinoOAM:
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld a, [wIntroNidorinoBaseTile]
ld d, a
.loop
@ -177,7 +177,7 @@ UpdateIntroNidorinoOAM:
ret
InitIntroNidorinoOAM:
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld d, 0
.loop
push bc

View file

@ -14,14 +14,14 @@ InitPlayerData2:
ld hl, wPartyCount
call InitializeEmptyList
ld hl, wNumInBox
ld hl, wBoxCount
call InitializeEmptyList
ld hl, wNumBagItems
call InitializeEmptyList
ld hl, wNumBoxItems
call InitializeEmptyList
START_MONEY EQU $3000
DEF START_MONEY EQU $3000
ld hl, wPlayerMoney + 1
ld a, HIGH(START_MONEY)
ld [hld], a

View file

@ -15,7 +15,7 @@ ChoosePlayerName:
xor a ; NAME_PLAYER_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
jr z, .customName
call ClearScreen
@ -48,7 +48,7 @@ ChooseRivalName:
ld a, NAME_RIVAL_SCREEN
ld [wNamingScreenType], a
call DisplayNamingScreen
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
jr z, .customName
call ClearScreen
@ -210,7 +210,7 @@ GetDefaultName:
ld h, d
ld l, e
ld de, wcd6d
ld bc, $14
ld bc, NAME_BUFFER_LENGTH
jp CopyData
INCLUDE "data/player_names_list.asm"

View file

@ -3,24 +3,24 @@ LoadShootingStarGraphics:
ldh [rOBP0], a
ld a, $a4
ldh [rOBP1], a
ld de, AnimationTileset2 tile 3 ; star tile (top left quadrant)
ld de, MoveAnimationTiles1 tile 3 ; star tile (top left quadrant)
ld hl, vChars1 tile $20
lb bc, BANK(AnimationTileset2), 1
lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
ld de, AnimationTileset2 tile 19 ; star tile (bottom left quadrant)
ld de, MoveAnimationTiles1 tile 19 ; star tile (bottom left quadrant)
ld hl, vChars1 tile $21
lb bc, BANK(AnimationTileset2), 1
lb bc, BANK(MoveAnimationTiles1), 1
call CopyVideoData
ld de, FallingStar
ld hl, vChars1 tile $22
lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10
call CopyVideoData
ld hl, GameFreakLogoOAMData
ld de, wOAMBuffer + $60
ld de, wShadowOAMSprite24
ld bc, GameFreakLogoOAMDataEnd - GameFreakLogoOAMData
call CopyData
ld hl, GameFreakShootingStarOAMData
ld de, wOAMBuffer
ld de, wShadowOAM
ld bc, GameFreakShootingStarOAMDataEnd - GameFreakShootingStarOAMData
jp CopyData
@ -30,7 +30,7 @@ AnimateShootingStar:
call PlaySound
; Move the big star down and left across the screen.
ld hl, wOAMBuffer
ld hl, wShadowOAM
lb bc, $a0, $4
.bigStarLoop
push hl
@ -60,7 +60,7 @@ AnimateShootingStar:
jr nz, .bigStarLoop
; Clear big star OAM.
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld c, 4
ld de, 4
.clearOAMLoop
@ -83,7 +83,7 @@ AnimateShootingStar:
; Copy 24 instances of the small stars OAM data.
; Note that their coordinates put them off-screen.
ld de, wOAMBuffer
ld de, wShadowOAM
ld a, 24
.initSmallStarsOAMLoop
push af
@ -106,7 +106,7 @@ AnimateShootingStar:
ld d, a
push bc
push hl
ld hl, wOAMBuffer + $50
ld hl, wShadowOAMSprite20
ld c, 4
.smallStarsInnerLoop ; introduce new wave of 4 small stars OAM entries
ld a, [de]
@ -131,8 +131,8 @@ AnimateShootingStar:
push af
; shift the existing OAM entries down to make room for the next wave
ld hl, wOAMBuffer + $10
ld de, wOAMBuffer
ld hl, wShadowOAMSprite04
ld de, wShadowOAM
ld bc, $50
call CopyData
@ -186,7 +186,7 @@ SmallStarsEmptyWave:
MoveDownSmallStars:
ld b, 8
.loop
ld hl, wOAMBuffer + $5c
ld hl, wShadowOAMSprite23
ld a, [wMoveDownSmallStarsOAMCount]
ld de, -4
ld c, a

View file

@ -93,7 +93,7 @@ DisplayTitleScreen:
call DrawPlayerCharacter
; put a pokeball in the player's hand
ld hl, wOAMBuffer + $28
ld hl, wShadowOAMSprite10
ld a, $74
ld [hl], a
@ -322,7 +322,7 @@ DrawPlayerCharacter:
call ClearSprites
xor a
ld [wPlayerCharacterOAMTile], a
ld hl, wOAMBuffer
ld hl, wShadowOAM
lb de, $60, $5a
ld b, 7
.loop

View file

@ -115,6 +115,6 @@ GetTitleBallY:
pop de
and a
ret z
ld [wOAMBuffer + $28], a
ld [wShadowOAMSprite10YCoord], a
inc e
ret

View file

@ -56,12 +56,12 @@ TradeAnimCommon:
ld [wOptions], a
ret
addtradefunc: MACRO
MACRO addtradefunc
\1TradeFunc::
dw \1
ENDM
tradefunc: MACRO
MACRO tradefunc
db (\1TradeFunc - TradeFuncPointerTable) / 2
ENDM
@ -189,7 +189,7 @@ LoadTradingGFXAndMonNames:
ld [wd11e], a
call GetMonName
ld hl, wcd6d
ld de, wcf4b
ld de, wStringBuffer
ld bc, NAME_LENGTH
call CopyData
ld a, [wTradedEnemyMonSpecies]
@ -315,7 +315,7 @@ Trade_AnimateBallEnteringLinkCable:
xor $1
ld [wLinkCableAnimBulgeToggle], a
add $7e
ld hl, wOAMBuffer + $02
ld hl, wShadowOAMSprite00TileID
ld de, 4
ld c, e
.cycleLinkCableBulgeTile
@ -599,7 +599,7 @@ Trade_AnimCircledMon:
ldh a, [rBGP]
xor $3c ; make link cable flash
ldh [rBGP], a
ld hl, wOAMBuffer + $02
ld hl, wShadowOAMSprite00TileID
ld de, $4
ld c, $14
.loop
@ -619,7 +619,7 @@ Trade_WriteCircledMonOAM:
call Trade_WriteCircleOAM
Trade_AddOffsetsToOAMCoords:
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld c, $14
.loop
ld a, [wBaseCoordY]
@ -697,7 +697,7 @@ Trade_WriteCircleOAM:
jr nz, .loop
ret
trade_circle_oam: MACRO
MACRO trade_circle_oam
dw \1
db \2, \3
ENDM

View file

@ -10,7 +10,7 @@ Trade_PrintPlayerMonInfoText:
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber
hlcoord 5, 2
ld de, wcf4b
ld de, wStringBuffer
call PlaceString
hlcoord 8, 4
ld de, wTradedPlayerMonOT

View file

@ -99,7 +99,7 @@ InitCutAnimOAM:
ld hl, vChars1 tile $7f
call LoadCutGrassAnimationTilePattern
call WriteCutOrBoulderDustAnimationOAMBlock
ld hl, wOAMBuffer + $93
ld hl, wShadowOAMSprite36Attributes
ld de, 4
ld a, $30
ld c, e
@ -112,8 +112,8 @@ InitCutAnimOAM:
ret
LoadCutGrassAnimationTilePattern:
ld de, AnimationTileset2 tile 6 ; tile depicting a leaf
lb bc, BANK(AnimationTileset2), 1
ld de, MoveAnimationTiles1 tile 6 ; tile depicting a leaf
lb bc, BANK(MoveAnimationTiles1), 1
jp CopyVideoData
WriteCutOrBoulderDustAnimationOAMBlock:

View file

@ -5,12 +5,12 @@ AnimCut:
ld c, $8
.cutTreeLoop
push bc
ld hl, wOAMBuffer + $91
ld hl, wShadowOAMSprite36XCoord
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 2
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld hl, wShadowOAMSprite38XCoord
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 2
@ -33,7 +33,7 @@ AnimCut:
ld c, $8
call AnimCutGrass_UpdateOAMEntries
call AnimCutGrass_SwapOAMEntries
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36YCoord
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 4
@ -45,22 +45,22 @@ AnimCut:
AnimCutGrass_UpdateOAMEntries:
push bc
ld hl, wOAMBuffer + $91
ld hl, wShadowOAMSprite36XCoord
ld a, 1
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $95
ld hl, wShadowOAMSprite37XCoord
ld a, 2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $99
ld hl, wShadowOAMSprite38XCoord
ld a, -2
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
ld hl, wOAMBuffer + $9d
ld hl, wShadowOAMSprite39XCoord
ld a, -1
ld [wCoordAdjustmentAmount], a
ld c, 1
@ -75,15 +75,15 @@ AnimCutGrass_UpdateOAMEntries:
ret
AnimCutGrass_SwapOAMEntries:
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld de, wBuffer
ld bc, $8
call CopyData
ld hl, wOAMBuffer + $98
ld de, wOAMBuffer + $90
ld hl, wShadowOAMSprite38
ld de, wShadowOAMSprite36
ld bc, $8
call CopyData
ld hl, wBuffer
ld de, wOAMBuffer + $98
ld de, wShadowOAMSprite38
ld bc, $8
jp CopyData

View file

@ -43,7 +43,7 @@ GetMoveBoulderDustFunctionPointer:
ld h, [hl]
ld l, a
push hl
ld hl, wOAMBuffer + $90
ld hl, wShadowOAMSprite36
ld d, $0
add hl, de
ld e, l
@ -51,22 +51,16 @@ GetMoveBoulderDustFunctionPointer:
pop hl
ret
MACRO boulder_dust_adjust
db \1, \2 ; coords
dw \3 ; function
ENDM
MoveBoulderDustFunctionPointerTable:
; facing down
db $FF,$00
dw AdjustOAMBlockYPos
; facing up
db $01,$00
dw AdjustOAMBlockYPos
; facing left
db $01,$01
dw AdjustOAMBlockXPos
; facing right
db $FF,$01
dw AdjustOAMBlockXPos
boulder_dust_adjust -1, 0, AdjustOAMBlockYPos ; down
boulder_dust_adjust 1, 0, AdjustOAMBlockYPos ; up
boulder_dust_adjust 1, 1, AdjustOAMBlockXPos ; left
boulder_dust_adjust -1, 1, AdjustOAMBlockXPos ; right
LoadSmokeTileFourTimes::
ld hl, vChars1 tile $7c

View file

@ -33,7 +33,7 @@ ShakeElevator::
ld a, SFX_SAFARI_ZONE_PA
call PlaySound
;.musicLoop
; ld a, [wChannelSoundIDs + Ch5]
; ld a, [wChannelSoundIDs + CHAN5]
; cp SFX_SAFARI_ZONE_PA
; jr z, .musicLoop
call UpdateSprites

View file

@ -17,11 +17,11 @@ EmotionBubble:
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
ld hl, wShadowOAMSprite35Attributes
ld de, wShadowOAMSprite39Attributes
jr z, .next
ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
ld hl, wShadowOAMSprite31Attributes
ld de, wShadowOAMSprite35Attributes
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.

View file

@ -32,7 +32,7 @@ IsSurfingAllowed:
ret nz
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
ret z
ld hl, CoordsData_cdf7
ld hl, SeafoamIslandsB4FStairsCoords
call ArePlayerCoordsInArray
ret nc
ld hl, wd728
@ -45,7 +45,7 @@ IsSurfingAllowed:
ld hl, CyclingIsFunText
jp PrintText
CoordsData_cdf7:
SeafoamIslandsB4FStairsCoords:
dbmapcoord 7, 11
db -1 ; end

View file

@ -12,7 +12,7 @@ AnimateHealingMachine:
push af
ld a, $e0
ldh [rOBP1], a
ld hl, wOAMBuffer + $84
ld hl, wShadowOAMSprite33
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
@ -96,9 +96,9 @@ FlashSprite8Times:
CopyHealingMachineOAM:
; copy one OAM entry and advance the pointers
REPT 4
REPT 4
ld a, [de]
inc de
ld [hli], a
ENDR
ENDR
ret

View file

@ -11,7 +11,7 @@
InitMapSprites::
call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25)
; if the map is an inside map (i.e. mapID >= FIRST_INDOOR_MAP)
ld hl, wSpritePlayerStateData1PictureID
ld de, wSpritePlayerStateData2PictureID
; Loop to copy picture IDs from [x#SPRITESTATEDATA1_PICTUREID]
@ -19,10 +19,10 @@ InitMapSprites::
.copyPictureIDLoop
ld a, [hl] ; a = [x#SPRITESTATEDATA1_PICTUREID]
ld [de], a ; [x#SPRITESTATEDATA2_PICTUREID] = a
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add e
ld e, a
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add l
ld l, a
jr nz, .copyPictureIDLoop
@ -37,7 +37,7 @@ LoadMapSpriteTilePatterns:
ret
.spritesExist
ld c, a ; c = [wNumSprites]
ld b, $10 ; number of sprite slots
ld b, NUM_SPRITESTATEDATA_STRUCTS
ld hl, wSpritePlayerStateData2PictureID
xor a
ldh [hFourTileSpriteCount], a
@ -47,7 +47,7 @@ LoadMapSpriteTilePatterns:
ld a, [hli] ; a = [x#SPRITESTATEDATA2_PICTUREID]
ld [hld], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET] = a
ld a, l
add $10
add SPRITESTATEDATA1_LENGTH
ld l, a
dec b
jr nz, .copyPictureIDLoop
@ -69,17 +69,17 @@ LoadMapSpriteTilePatterns:
cp [hl] ; do the picture ID's match?
jp z, .alreadyLoaded
ld a, e
add $10
add SPRITESTATEDATA1_LENGTH
ld e, a
jr .checkIfAlreadyLoadedLoop
.notAlreadyLoaded
ld de, wSpritePlayerStateData2ImageBaseOffset
ld b, $01
ld b, 1
; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
; this is done in order to find the first free VRAM slot available
.findNextVRAMSlotLoop
ld a, e
add $10
add SPRITESTATEDATA1_LENGTH
ld e, a
ld a, l
cp e ; reached current slot?
@ -187,7 +187,7 @@ LoadMapSpriteTilePatterns:
jr nz, .loadWhileLCDOn
pop af
pop hl
set 3, h ; add $800 to hl
set 3, h ; add $80 tiles to hl
push hl
ld h, d
ld l, e
@ -200,7 +200,7 @@ LoadMapSpriteTilePatterns:
.loadWhileLCDOn
pop af
pop hl
set 3, h ; add $800 to hl
set 3, h ; add $80 tiles to hl
ld b, a
swap c
call CopyVideoData ; load tile pattern data for sprite when walking
@ -214,18 +214,18 @@ LoadMapSpriteTilePatterns:
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET] = a
.nextSpriteSlot
ld a, l
add $10
add SPRITESTATEDATA2_LENGTH
ld l, a
dec c
jp nz, .loadTilePatternLoop
ld hl, wSpritePlayerStateData2PictureID
ld b, $10
ld b, NUM_SPRITESTATEDATA_STRUCTS
; the pictures IDs stored at [x#SPRITESTATEDATA2_PICTUREID] are no longer needed,
; so zero them
.zeroStoredPictureIDLoop
xor a
ld [hl], a ; [x#SPRITESTATEDATA2_PICTUREID]
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
dec b
@ -264,7 +264,7 @@ InitOutsideMapSprites:
inc h
.noCarry
ld a, [hl] ; a = spriteSetID
cp $f0 ; does the map have 2 sprite sets?
cp FIRST_SPLIT_SET - 1 ; does the map have 2 sprite sets?
call nc, GetSplitMapSpriteSetID ; if so, choose the appropriate one
ld b, a ; b = spriteSetID
ld a, [wFontLoaded]
@ -283,7 +283,7 @@ InitOutsideMapSprites:
sla a
sla a
add c
add b ; a = (spriteSetID - 1) * 11
add b ; a = (spriteSetID - 1) * SPRITE_SET_LENGTH
ld de, SpriteSets
; add a to de to get offset of sprite set
add e
@ -300,7 +300,7 @@ InitOutsideMapSprites:
; with picture IDs. This is done so that LoadMapSpriteTilePatterns will
; load tile patterns for all sprite pictures in the sprite set.
.loadSpriteSetLoop
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
ld a, [de] ; sprite picture ID from sprite set
@ -309,11 +309,11 @@ InitOutsideMapSprites:
inc de
inc bc
ld a, l
cp $bd ; reached 11th sprite slot?
cp 11 * SPRITESTATEDATA2_LENGTH + SPRITESTATEDATA2_PICTUREID ; reached 11th sprite slot?
jr nz, .loadSpriteSetLoop
ld b, 4 ; 4 remaining sprite slots
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
xor a
@ -322,20 +322,20 @@ InitOutsideMapSprites:
jr nz, .zeroRemainingSlotsLoop
ld a, [wNumSprites]
push af ; save number of sprites
ld a, 11 ; 11 sprites in sprite set
ld a, SPRITE_SET_LENGTH ; 11 sprites in sprite set
ld [wNumSprites], a
call LoadMapSpriteTilePatterns
pop af
ld [wNumSprites], a ; restore number of sprites
ld hl, wSprite01StateData2ImageBaseOffset
ld b, $0f
ld b, NUM_SPRITESTATEDATA_STRUCTS - 1
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
; order of the map's sprite set, not the order of the actual sprites loaded
; for the current map. So, they are not needed and are zeroed by this loop.
.zeroVRAMSlotsLoop
xor a
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
ld a, $10
ld a, SPRITESTATEDATA2_LENGTH
add l
ld l, a
dec b
@ -366,14 +366,14 @@ InitOutsideMapSprites:
inc c
.skipGettingPictureIndex
push hl
inc h
ld a, $0e
inc h ; HIGH(wSpriteStateData2)
ld a, SPRITESTATEDATA2_IMAGEBASEOFFSET - SPRITESTATEDATA1_PICTUREID
add l
ld l, a
ld a, c ; a = VRAM slot (zero if sprite slot is not used)
ld [hl], a ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET]
pop hl
ld a, $10
ld a, SPRITESTATEDATA1_LENGTH
add l
ld l, a
and a
@ -384,7 +384,7 @@ InitOutsideMapSprites:
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
GetSplitMapSpriteSetID:
cp $f8
cp SPLITSET_ROUTE_20
jr z, .route20
ld hl, SplitMapSpriteSets
and $0f
@ -396,8 +396,8 @@ GetSplitMapSpriteSetID:
jr nc, .noCarry
inc h
.noCarry
ld a, [hli] ; determines whether the map is split East/West or North/South
cp $01
ld a, [hli] ; whether the map is split EAST_WEST or NORTH_SOUTH
cp EAST_WEST
ld a, [hli] ; position of dividing line
ld b, a
jr z, .eastWestDivide
@ -409,35 +409,39 @@ GetSplitMapSpriteSetID:
.compareCoord
cp b
jr c, .loadSpriteSetID
; if in the East side or South side
; if in the east side or south side
inc hl
.loadSpriteSetID
ld a, [hl]
ret
; Uses sprite set $01 for West side and $0A for East side.
; Uses sprite set SPRITESET_PALLET_VIRIDIAN for west side and SPRITESET_FUCHSIA for east side.
; Route 20 is a special case because the two map sections have a more complex
; shape instead of the map simply being split horizontally or vertically.
.route20
ld hl, wXCoord
; Use SPRITESET_PALLET_VIRIDIAN if X < 43
ld a, [hl]
cp $2b
ld a, $01
cp 43
ld a, SPRITESET_PALLET_VIRIDIAN
ret c
; Use SPRITESET_FUCHSIA if X >= 62.
ld a, [hl]
cp $3e
ld a, $0a
cp 62
ld a, SPRITESET_FUCHSIA
ret nc
; If 55 <= X < 62, split Y at 8; else 43 <= X < 55, so split Y at 13
ld a, [hl]
cp $37
ld b, $08
cp 55
ld b, 8
jr nc, .next
ld b, $0d
ld b, 13
.next
; Use SPRITESET_FUCHSIA if Y < split; else use SPRITESET_PALLET_VIRIDIAN
ld a, [wYCoord]
cp b
ld a, $0a
ld a, SPRITESET_FUCHSIA
ret c
ld a, $01
ld a, SPRITESET_PALLET_VIRIDIAN
ret
INCLUDE "data/maps/sprite_sets.asm"

View file

@ -23,9 +23,9 @@ LoadMissableObjects:
ld de, MissableObjects ; calculate difference between out pointer and the base pointer
ld a, l
sub e
jr nc, .asm_f13c
jr nc, .noCarry
dec h
.asm_f13c
.noCarry
ld l, a
ld a, h
sub d

View file

@ -1,4 +1,4 @@
MAP_TILESET_SIZE EQU $60
DEF MAP_TILESET_SIZE EQU $60
UpdatePlayerSprite:
ld a, [wSpritePlayerStateData2WalkAnimationCounter]

View file

@ -14,22 +14,22 @@ FindPathToPlayer:
call CalcDifference
ld d, a
and a
jr nz, .asm_f8da
jr nz, .stillHasYProgress
ldh a, [hFindPathFlags]
set 0, a ; current end of path matches the player's Y coordinate
ldh [hFindPathFlags], a
.asm_f8da
.stillHasYProgress
ldh a, [hFindPathXProgress]
ld b, a
ldh a, [hNPCPlayerXDistance] ; X distance in steps
call CalcDifference
ld e, a
and a
jr nz, .asm_f8ec
jr nz, .stillHasXProgress
ldh a, [hFindPathFlags]
set 1, a ; current end of path matches the player's X coordinate
ldh [hFindPathFlags], a
.asm_f8ec
.stillHasXProgress
ldh a, [hFindPathFlags]
cp $3 ; has the end of the path reached the player's position?
jr z, .done

View file

@ -205,19 +205,19 @@ LeaveMapThroughHoleAnim:
ld a, $ff
ld [wUpdateSpritesEnabled], a ; disable UpdateSprites
; shift upper half of player's sprite down 8 pixels and hide lower half
ld a, [wOAMBuffer + 0 * 4 + 2]
ld [wOAMBuffer + 2 * 4 + 2], a
ld a, [wOAMBuffer + 1 * 4 + 2]
ld [wOAMBuffer + 3 * 4 + 2], a
ld a, [wShadowOAMSprite00TileID]
ld [wShadowOAMSprite02TileID], a
ld a, [wShadowOAMSprite01TileID]
ld [wShadowOAMSprite03TileID], a
ld a, $a0
ld [wOAMBuffer + 0 * 4], a
ld [wOAMBuffer + 1 * 4], a
ld [wShadowOAMSprite00YCoord], a
ld [wShadowOAMSprite01YCoord], a
ld c, 2
call DelayFrames
; hide upper half of player's sprite
ld a, $a0
ld [wOAMBuffer + 2 * 4], a
ld [wOAMBuffer + 3 * 4], a
ld [wShadowOAMSprite02YCoord], a
ld [wShadowOAMSprite03YCoord], a
call GBFadeOutToWhite
ld a, $1
ld [wUpdateSpritesEnabled], a ; enable UpdateSprites
@ -392,7 +392,7 @@ FishingAnim:
ld b, $0
ld hl, FishingRodOAM
add hl, bc
ld de, wOAMBuffer + $9c
ld de, wShadowOAMSprite39
ld bc, $4
call CopyData
ld c, 100
@ -412,7 +412,7 @@ FishingAnim:
.loop
ld hl, wSpritePlayerStateData1YPixels
call .ShakePlayerSprite
ld hl, wOAMBuffer + $9c
ld hl, wShadowOAMSprite39
call .ShakePlayerSprite
call Delay3
dec b
@ -424,7 +424,7 @@ FishingAnim:
cp SPRITE_FACING_UP
jr nz, .skipHidingFishingRod
ld a, $a0
ld [wOAMBuffer + $9c], a
ld [wShadowOAMSprite39YCoord], a
.skipHidingFishingRod
ld hl, wEmotionBubbleSpriteIndex
@ -438,7 +438,7 @@ FishingAnim:
cp SPRITE_FACING_UP
jr nz, .skipUnhidingFishingRod
ld a, $44
ld [wOAMBuffer + $9c], a
ld [wShadowOAMSprite39YCoord], a
.skipUnhidingFishingRod
ld hl, ItsABiteText
@ -475,7 +475,7 @@ FishingRodOAM:
dbsprite 8, 10, 0, 0, $fe, 0 ; left
dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right
fishing_gfx: MACRO
MACRO fishing_gfx
dw \1
db \2
db BANK(\1)

View file

@ -101,10 +101,10 @@ IsPlayerFacingEdgeOfMap::
ld b, a
ld a, [wXCoord]
ld c, a
ld de, .asm_c41e
ld de, .return
push de
jp hl
.asm_c41e
.return
pop bc
pop de
pop hl
@ -239,11 +239,11 @@ PrintSafariZoneSteps::
call PlaceString
ld a, [wNumSafariBalls]
cp 10
jr nc, .asm_c56d
jr nc, .tenOrMore
hlcoord 5, 3
ld a, " "
ld [hl], a
.asm_c56d
.tenOrMore
hlcoord 6, 3
ld de, wNumSafariBalls
lb bc, 1, 2

View file

@ -11,18 +11,18 @@ LoadSpinnerArrowTiles::
ld a, [wCurMapTileset]
cp FACILITY
ld hl, FacilitySpinnerArrows
jr z, .asm_44ff6
jr z, .gotSpinnerArrows
ld hl, GymSpinnerArrows
.asm_44ff6
.gotSpinnerArrows
ld a, [wSimulatedJoypadStatesIndex]
bit 0, a
jr nz, .asm_45001
ld de, $18
jr nz, .alternateGraphics
ld de, 6 * 4
add hl, de
.asm_45001
.alternateGraphics
ld a, $4
ld bc, $0
.asm_45006
.loop
push af
push hl
push bc
@ -46,7 +46,7 @@ LoadSpinnerArrowTiles::
pop hl
pop af
dec a
jr nz, .asm_45006
jr nz, .loop
ret
INCLUDE "data/tilesets/spinner_tiles.asm"

View file

@ -35,13 +35,13 @@ LoadTilesetHeader:
call IsInArray
pop de
pop hl
jr c, .asm_c797
jr c, .dungeon
ld a, [wCurMapTileset]
ld b, a
ldh a, [hPreviousTileset]
cp b
jr z, .done
.asm_c797
.dungeon
ld a, [wDestinationWarpID]
cp $ff
jr z, .done

View file

@ -39,12 +39,12 @@ TrackPlayTime::
CountDownIgnoreInputBitReset:
ld a, [wIgnoreInputCounter]
and a
jr nz, .asm_18e40
jr nz, .decrement
ld a, $ff
jr .asm_18e41
.asm_18e40
jr .continue
.decrement
dec a
.asm_18e41
.continue
ld [wIgnoreInputCounter], a
and a
ret nz

View file

@ -348,7 +348,7 @@ _MoveMon::
ld hl, wDayCareMon
jr z, .findMonDataSrc
; else it's PARTY_TO_BOX
ld hl, wNumInBox
ld hl, wBoxCount
ld a, [hl]
cp MONS_PER_BOX
jr nz, .partyOrBoxNotFull
@ -385,7 +385,7 @@ _MoveMon::
; if it's PARTY_TO_BOX
ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21
ld a, [wNumInBox]
ld a, [wBoxCount]
.addMonOffset
dec a
call AddNTimes
@ -435,7 +435,7 @@ _MoveMon::
ld a, [wPartyCount]
jr nz, .addOToffset
ld hl, wBoxMonOT
ld a, [wNumInBox]
ld a, [wBoxCount]
.addOToffset
dec a
call SkipFixedLengthTextEntries
@ -466,7 +466,7 @@ _MoveMon::
ld a, [wPartyCount]
jr nz, .addNickOffset
ld hl, wBoxMonNicks
ld a, [wNumInBox]
ld a, [wBoxCount]
.addNickOffset
dec a
call SkipFixedLengthTextEntries

View file

@ -171,8 +171,8 @@ BillsPCMenu:
ldh [hAutoBGTransferEnabled], a
call Delay3
call HandleMenuInput
bit 1, a
jp nz, ExitBillsPC ; b button
bit BIT_B_BUTTON, a
jp nz, ExitBillsPC
call PlaceUnfilledArrowMenuCursor
ld a, [wCurrentMenuItem]
ld [wParentMenuItem], a
@ -212,7 +212,7 @@ BillsPCDeposit:
call PrintText
jp BillsPCMenu
.partyLargeEnough
ld a, [wNumInBox]
ld a, [wBoxCount]
cp MONS_PER_BOX
jr nz, .boxNotFull
ld hl, BoxFullText
@ -257,7 +257,7 @@ BillsPCDeposit:
jp BillsPCMenu
BillsPCWithdraw:
ld a, [wNumInBox]
ld a, [wBoxCount]
and a
jr nz, .boxNotEmpty
ld hl, NoMonText
@ -271,7 +271,7 @@ BillsPCWithdraw:
call PrintText
jp BillsPCMenu
.partyNotFull
ld hl, wNumInBox
ld hl, wBoxCount
call DisplayMonListMenu
jp c, BillsPCMenu
call DisplayDepositWithdrawMenu
@ -297,14 +297,14 @@ BillsPCWithdraw:
jp BillsPCMenu
BillsPCRelease:
ld a, [wNumInBox]
ld a, [wBoxCount]
and a
jr nz, .loop
ld hl, NoMonText
call PrintText
jp BillsPCMenu
.loop
ld hl, wNumInBox
ld hl, wBoxCount
call DisplayMonListMenu
jp c, BillsPCMenu
ld hl, OnceReleasedText
@ -422,7 +422,7 @@ DisplayDepositWithdrawMenu:
ld [wPartyAndBillsPCSavedMenuItem], a
.loop
call HandleMenuInput
bit 1, a ; pressed B?
bit BIT_B_BUTTON, a
jr nz, .exit
ld a, [wCurrentMenuItem]
and a

View file

@ -114,7 +114,7 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
call CopyStringToCF4B
call CopyToStringBuffer
ld hl, IsEvolvingText
call PrintText
ld c, 50
@ -268,7 +268,7 @@ RenameEvolvedMon:
pop af
ld [wd0b5], a
ld hl, wcd6d
ld de, wcf4b
ld de, wStringBuffer
.compareNamesLoop
ld a, [de]
inc de
@ -368,7 +368,7 @@ LearnMoveFromLevelUp:
ld [wMoveNum], a
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
call CopyToStringBuffer
predef LearnMove
.done
ld a, [wcf91]

View file

@ -155,7 +155,7 @@ TryingToLearn:
call LoadScreenTilesFromBuffer1
pop af
pop hl
bit 1, a ; pressed b
bit BIT_B_BUTTON, a
jr nz, .cancel
push hl
ld a, [wCurrentMenuItem]

View file

@ -3,7 +3,7 @@ _RemovePokemon::
ld a, [wRemoveMonFromBox]
and a
jr z, .usePartyCount
ld hl, wNumInBox
ld hl, wBoxCount
.usePartyCount
ld a, [hl]
dec a

View file

@ -8,7 +8,7 @@ PrintStatusAilment::
jr nz, .frz
bit PAR, a
jr nz, .par
and SLP
and SLP_MASK
ret z
ld a, "S"
ld [hli], a

View file

@ -1,20 +1,20 @@
GetPredefPointer::
; Store the contents of the register
; pairs (hl, de, bc) at wPredefRegisters.
; Back up the contents of the registers (hl, de, bc).
; Then put the bank and address of predef
; wPredefID in [wPredefBank] and hl.
ld a, h
ld [wPredefRegisters], a
ld [wPredefHL], a
ld a, l
ld [wPredefRegisters + 1], a
ld [wPredefHL + 1], a
ld hl, wPredefRegisters + 2
ld hl, wPredefDE
ld a, d
ld [hli], a
ld a, e
ld [hli], a
ASSERT wPredefDE + 2 == wPredefBC
ld a, b
ld [hli], a
ld [hl], c

View file

@ -446,7 +446,7 @@ SlotMachine_CheckForMatches:
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wcf4b
ld de, wStringBuffer
ld bc, 4
call CopyData
pop hl
@ -760,7 +760,7 @@ SlotMachine_UpdateBallTiles:
SlotMachine_AnimWheel1:
ld bc, SlotMachineWheel1
ld de, wSlotMachineWheel1Offset
ld hl, wOAMBuffer
ld hl, wShadowOAMSprite00
ld a, $30
ld [wBaseCoordX], a
jr SlotMachine_AnimWheel
@ -768,7 +768,7 @@ SlotMachine_AnimWheel1:
SlotMachine_AnimWheel2:
ld bc, SlotMachineWheel2
ld de, wSlotMachineWheel2Offset
ld hl, wOAMBuffer + $30
ld hl, wShadowOAMSprite12
ld a, $50
ld [wBaseCoordX], a
jr SlotMachine_AnimWheel
@ -776,7 +776,7 @@ SlotMachine_AnimWheel2:
SlotMachine_AnimWheel3:
ld bc, SlotMachineWheel3
ld de, wSlotMachineWheel3Offset
ld hl, wOAMBuffer + $60
ld hl, wShadowOAMSprite24
ld a, $70
ld [wBaseCoordX], a