No more W_

This commit is contained in:
dannye 2015-08-30 21:38:41 -05:00
parent 1ee9fb408c
commit 38065a744d
190 changed files with 2202 additions and 2202 deletions

View file

@ -371,13 +371,13 @@ PlayBattleMusic:: ; 0x90c6
call PlaySound ; stop music call PlaySound ; stop music
call DelayFrame call DelayFrame
ld c, BANK(Music_GymLeaderBattle) ld c, BANK(Music_GymLeaderBattle)
ld a, [W_GYMLEADERNO] ld a, [wGymLeaderNo]
and a and a
jr z, .notGymLeaderBattle jr z, .notGymLeaderBattle
ld a, MUSIC_GYM_LEADER_BATTLE ld a, MUSIC_GYM_LEADER_BATTLE
jr .playSong jr .playSong
.notGymLeaderBattle .notGymLeaderBattle
ld a, [W_CUROPPONENT] ld a, [wCurOpponent]
cp 200 cp 200
jr c, .wildBattle jr c, .wildBattle
cp OPP_SONY3 cp OPP_SONY3

View file

@ -2,7 +2,7 @@
; sprites marked with an X are constants that are never used ; sprites marked with an X are constants that are never used
; because those sprites are not (de)activated in a map's script ; because those sprites are not (de)activated in a map's script
; (they are either items or sprites that deactivate after battle ; (they are either items or sprites that deactivate after battle
; and are detected in W_MISSABLEOBJECTLIST) ; and are detected in wMissableObjectList)
const_value = 0 const_value = 0

View file

@ -1,8 +1,8 @@
SPRITEBUFFERSIZE EQU 7*7 * 8 ; 7 * 7 (tiles) * 8 (bytes per tile) SPRITEBUFFERSIZE EQU 7*7 * 8 ; 7 * 7 (tiles) * 8 (bytes per tile)
; Overload W_GRASSMONS ; Overload wGrassMons
wSerialEnemyDataBlock EQU $d893 ; W_GRASSMONS + 11 wSerialEnemyDataBlock EQU $d893 ; wGrassMons + 11
; Overload enemy party data ; Overload enemy party data
W_WATERRATE EQU $d8a4 ; wEnemyMon1Species W_WATERRATE EQU $d8a4 ; wEnemyMon1Species

View file

@ -263,7 +263,7 @@ MapHSPointers: ; c8f5 (3:48f5)
; a) Map_ID = $FF ; a) Map_ID = $FF
; b) Map_ID ≠ currentMapID ; b) Map_ID ≠ currentMapID
; ;
; This Data is loaded into RAM at wd5ce-$D5F?. (W_MISSABLEOBJECTLIST) ; This Data is loaded into RAM at wd5ce-$D5F?. (wMissableObjectList)
; These constants come from the bytes for Predef functions: ; These constants come from the bytes for Predef functions:
Hide equ $11 Hide equ $11

View file

@ -1,8 +1,8 @@
IF !DEF(YELLOW) IF !DEF(YELLOW)
LoneMoves: ; 39d22 (e:5d22) LoneMoves: ; 39d22 (e:5d22)
; these are used for gym leaders. ; these are used for gym leaders.
; this is not automatic! you have to write the number you want to W_LONEATTACKNO ; this is not automatic! you have to write the number you want to wLoneAttackNo
; first. e.g., erika's script writes 4 to W_LONEATTACKNO to get mega drain, ; first. e.g., erika's script writes 4 to wLoneAttackNo to get mega drain,
; the fourth entry in the list. ; the fourth entry in the list.
; first byte: pokemon in the trainer's party that gets the move ; first byte: pokemon in the trainer's party that gets the move

View file

@ -4,18 +4,18 @@ DrawFrameBlock: ; 78000 (1e:4000)
ld l,c ld l,c
ld h,b ld h,b
ld a,[hli] ld a,[hli]
ld [W_NUMFBTILES],a ld [wNumFBTiles],a
ld a,[W_FBDESTADDR + 1] ld a,[wFBDestAddr + 1]
ld e,a ld e,a
ld a,[W_FBDESTADDR] ld a,[wFBDestAddr]
ld d,a ld d,a
xor a xor a
ld [W_FBTILECOUNTER],a ; loop counter ld [wFBTileCounter],a ; loop counter
.loop .loop
ld a,[W_FBTILECOUNTER] ld a,[wFBTileCounter]
inc a inc a
ld [W_FBTILECOUNTER],a ld [wFBTileCounter],a
ld a,[W_SUBANIMTRANSFORM] ld a,[wSubAnimTransform]
dec a dec a
jr z,.flipHorizontalAndVertical ; 1 jr z,.flipHorizontalAndVertical ; 1
dec a dec a
@ -23,15 +23,15 @@ DrawFrameBlock: ; 78000 (1e:4000)
dec a dec a
jr z,.flipBaseCoords ; 3 jr z,.flipBaseCoords ; 3
.noTransformation .noTransformation
ld a,[W_BASECOORDY] ld a,[wBaseCoordY]
add [hl] add [hl]
ld [de],a ; store Y ld [de],a ; store Y
inc hl inc hl
inc de inc de
ld a,[W_BASECOORDX] ld a,[wBaseCoordX]
jr .finishCopying jr .finishCopying
.flipBaseCoords .flipBaseCoords
ld a,[W_BASECOORDY] ld a,[wBaseCoordY]
ld b,a ld b,a
ld a,136 ld a,136
sub b ; flip Y base coordinate sub b ; flip Y base coordinate
@ -39,11 +39,11 @@ DrawFrameBlock: ; 78000 (1e:4000)
ld [de],a ; store Y ld [de],a ; store Y
inc hl inc hl
inc de inc de
ld a,[W_BASECOORDX] ld a,[wBaseCoordX]
ld b,a ld b,a
ld a,168 ld a,168
sub b ; flip X base coordinate sub b ; flip X base coordinate
.finishCopying ; finish copying values to OAM (when [W_SUBANIMTRANSFORM] not 1 or 2) .finishCopying ; finish copying values to OAM (when [wSubAnimTransform] not 1 or 2)
add [hl] ; X offset add [hl] ; X offset
ld [de],a ; store X ld [de],a ; store X
inc hl inc hl
@ -57,7 +57,7 @@ DrawFrameBlock: ; 78000 (1e:4000)
inc de inc de
jp .nextTile jp .nextTile
.flipHorizontalAndVertical .flipHorizontalAndVertical
ld a,[W_BASECOORDY] ld a,[wBaseCoordY]
add [hl] ; Y offset add [hl] ; Y offset
ld b,a ld b,a
ld a,136 ld a,136
@ -65,7 +65,7 @@ DrawFrameBlock: ; 78000 (1e:4000)
ld [de],a ; store Y ld [de],a ; store Y
inc hl inc hl
inc de inc de
ld a,[W_BASECOORDX] ld a,[wBaseCoordX]
add [hl] ; X offset add [hl] ; X offset
ld b,a ld b,a
ld a,168 ld a,168
@ -95,13 +95,13 @@ DrawFrameBlock: ; 78000 (1e:4000)
inc de inc de
jp .nextTile jp .nextTile
.flipHorizontalTranslateDown .flipHorizontalTranslateDown
ld a,[W_BASECOORDY] ld a,[wBaseCoordY]
add [hl] add [hl]
add a,40 ; translate Y coordinate downwards add a,40 ; translate Y coordinate downwards
ld [de],a ; store Y ld [de],a ; store Y
inc hl inc hl
inc de inc de
ld a,[W_BASECOORDX] ld a,[wBaseCoordX]
add [hl] add [hl]
ld b,a ld b,a
ld a,168 ld a,168
@ -125,47 +125,47 @@ DrawFrameBlock: ; 78000 (1e:4000)
ld [de],a ld [de],a
inc de inc de
.nextTile .nextTile
ld a,[W_FBTILECOUNTER] ld a,[wFBTileCounter]
ld c,a ld c,a
ld a,[W_NUMFBTILES] ld a,[wNumFBTiles]
cp c cp c
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,[W_FBMODE] ld a,[wFBMode]
cp a,2 cp a,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,[W_SUBANIMFRAMEDELAY] ld a,[wSubAnimFrameDelay]
ld c,a ld c,a
call DelayFrames call DelayFrames
ld a,[W_FBMODE] ld a,[wFBMode]
cp a,3 cp a,3
jr z,.advanceFrameBlockDestAddr ; skip cleaning OAM buffer jr z,.advanceFrameBlockDestAddr ; skip cleaning OAM buffer
cp a,4 cp a,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,[W_ANIMATIONID] ld a,[wAnimationID]
cp a,GROWL cp a,GROWL
jr z,.resetFrameBlockDestAddr jr z,.resetFrameBlockDestAddr
call AnimationCleanOAM call AnimationCleanOAM
.resetFrameBlockDestAddr .resetFrameBlockDestAddr
ld hl,wOAMBuffer ; OAM buffer ld hl,wOAMBuffer ; OAM buffer
ld a,l ld a,l
ld [W_FBDESTADDR + 1],a ld [wFBDestAddr + 1],a
ld a,h ld a,h
ld [W_FBDESTADDR],a ; set destination address to beginning of OAM buffer ld [wFBDestAddr],a ; set destination address to beginning of OAM buffer
ret ret
.advanceFrameBlockDestAddr .advanceFrameBlockDestAddr
ld a,e ld a,e
ld [W_FBDESTADDR + 1],a ld [wFBDestAddr + 1],a
ld a,d ld a,d
ld [W_FBDESTADDR],a ld [wFBDestAddr],a
.done .done
ret ret
PlayAnimation: ; 780f1 (1e:40f1) PlayAnimation: ; 780f1 (1e:40f1)
xor a xor a
ld [$FF8B],a ; it looks like nothing reads this ld [$FF8B],a ; it looks like nothing reads this
ld [W_SUBANIMTRANSFORM],a ld [wSubAnimTransform],a
ld a,[W_ANIMATIONID] ; get animation number ld a,[wAnimationID] ; get animation number
dec a dec a
ld l,a ld l,a
ld h,0 ld h,0
@ -217,7 +217,7 @@ PlayAnimation: ; 780f1 (1e:40f1)
.playSubanimation .playSubanimation
ld c,a ld c,a
and a,%00111111 and a,%00111111
ld [W_SUBANIMFRAMEDELAY],a ld [wSubAnimFrameDelay],a
xor a xor a
sla c sla c
rla rla
@ -235,9 +235,9 @@ PlayAnimation: ; 780f1 (1e:40f1)
ld de,SubanimationPointers ld de,SubanimationPointers
add hl,de add hl,de
ld a,l ld a,l
ld [W_SUBANIMADDRPTR],a ld [wSubAnimAddrPtr],a
ld a,h ld a,h
ld [W_SUBANIMADDRPTR + 1],a ld [wSubAnimAddrPtr + 1],a
ld l,c ld l,c
ld h,b ld h,b
push hl push hl
@ -257,9 +257,9 @@ PlayAnimation: ; 780f1 (1e:40f1)
ret ret
LoadSubanimation: ; 7817c (1e:417c) LoadSubanimation: ; 7817c (1e:417c)
ld a,[W_SUBANIMADDRPTR + 1] ld a,[wSubAnimAddrPtr + 1]
ld h,a ld h,a
ld a,[W_SUBANIMADDRPTR] ld a,[wSubAnimAddrPtr]
ld l,a ld l,a
ld a,[hli] ld a,[hli]
ld e,a ld e,a
@ -268,7 +268,7 @@ LoadSubanimation: ; 7817c (1e:417c)
ld a,[de] ld a,[de]
ld b,a ld b,a
and a,31 and a,31
ld [W_SUBANIMCOUNTER],a ; number of frame blocks ld [wSubAnimCounter],a ; number of frame blocks
ld a,b ld a,b
and a,%11100000 and a,%11100000
cp a,5 << 5 ; is subanimation type 5? cp a,5 << 5 ; is subanimation type 5?
@ -282,12 +282,12 @@ LoadSubanimation: ; 7817c (1e:417c)
; place the upper 3 bits of a into bits 0-2 of a before storing ; place the upper 3 bits of a into bits 0-2 of a before storing
srl a srl a
swap a swap a
ld [W_SUBANIMTRANSFORM],a ld [wSubAnimTransform],a
cp a,4 ; is the animation reversed? cp a,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
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
dec a dec a
ld bc,3 ld bc,3
.loop .loop
@ -298,9 +298,9 @@ LoadSubanimation: ; 7817c (1e:417c)
inc de inc de
add hl,de add hl,de
ld a,l ld a,l
ld [W_SUBANIMSUBENTRYADDR],a ld [wSubAnimSubEntryAddr],a
ld a,h ld a,h
ld [W_SUBANIMSUBENTRYADDR + 1],a ld [wSubAnimSubEntryAddr + 1],a
ret ret
; called if the subanimation type is not 5 ; called if the subanimation type is not 5
@ -384,7 +384,7 @@ MoveAnimation: ; 78d5e (1e:4d5e)
push af push af
call WaitForSoundToFinish call WaitForSoundToFinish
call SetAnimationPalette call SetAnimationPalette
ld a,[W_ANIMATIONID] ld a,[wAnimationID]
and a and a
jr z,.AnimationFinished jr z,.AnimationFinished
@ -397,7 +397,7 @@ MoveAnimation: ; 78d5e (1e:4d5e)
.MoveAnimation .MoveAnimation
; check if battle animations are disabled in the options ; check if battle animations are disabled in the options
ld a,[W_OPTIONS] ld a,[wOptions]
bit 7,a bit 7,a
jr nz,.AnimationsDisabled jr nz,.AnimationsDisabled
call ShareMoveAnimations call ShareMoveAnimations
@ -411,9 +411,9 @@ MoveAnimation: ; 78d5e (1e:4d5e)
.AnimationFinished .AnimationFinished
call WaitForSoundToFinish call WaitForSoundToFinish
xor a xor a
ld [W_SUBANIMSUBENTRYADDR],a ld [wSubAnimSubEntryAddr],a
ld [wUnusedD09B],a ld [wUnusedD09B],a
ld [W_SUBANIMTRANSFORM],a ld [wSubAnimTransform],a
dec a dec a
ld [wAnimSoundID],a ld [wAnimSoundID],a
pop af pop af
@ -430,7 +430,7 @@ ShareMoveAnimations: ; 78da6 (1e:4da6)
; opponents turn ; opponents turn
ld a,[W_ANIMATIONID] ld a,[wAnimationID]
cp a,AMNESIA cp a,AMNESIA
ld b,CONF_ANIM ld b,CONF_ANIM
@ -442,7 +442,7 @@ ShareMoveAnimations: ; 78da6 (1e:4da6)
.Replace .Replace
ld a,b ld a,b
ld [W_ANIMATIONID],a ld [wAnimationID],a
ret ret
PlayApplyingAttackAnimation: ; 78dbd (1e:4dbd) PlayApplyingAttackAnimation: ; 78dbd (1e:4dbd)
@ -529,7 +529,7 @@ SetAnimationPalette: ; 78e23 (1e:4e23)
ld a, $f0 ld a, $f0
ld [wAnimPalette], a ld [wAnimPalette], a
ld b, $e4 ld b, $e4
ld a, [W_ANIMATIONID] ld a, [wAnimationID]
cp TRADE_BALL_DROP_ANIM cp TRADE_BALL_DROP_ANIM
jr c, .next jr c, .next
cp TRADE_BALL_POOF_ANIM + 1 cp TRADE_BALL_POOF_ANIM + 1
@ -558,12 +558,12 @@ PlaySubanimation: ; 78e53 (1e:4e53)
.skipPlayingSound .skipPlayingSound
ld hl,wOAMBuffer ; base address of OAM buffer ld hl,wOAMBuffer ; base address of OAM buffer
ld a,l ld a,l
ld [W_FBDESTADDR + 1],a ld [wFBDestAddr + 1],a
ld a,h ld a,h
ld [W_FBDESTADDR],a ld [wFBDestAddr],a
ld a,[W_SUBANIMSUBENTRYADDR + 1] ld a,[wSubAnimSubEntryAddr + 1]
ld h,a ld h,a
ld a,[W_SUBANIMSUBENTRYADDR] ld a,[wSubAnimSubEntryAddr]
ld l,a ld l,a
.loop .loop
push hl push hl
@ -585,24 +585,24 @@ PlaySubanimation: ; 78e53 (1e:4e53)
add hl,de add hl,de
add hl,de add hl,de
ld a,[hli] ld a,[hli]
ld [W_BASECOORDY],a ld [wBaseCoordY],a
ld a,[hl] ld a,[hl]
ld [W_BASECOORDX],a ld [wBaseCoordX],a
pop hl pop hl
inc hl inc hl
ld a,[hl] ; frame block mode ld a,[hl] ; frame block mode
ld [W_FBMODE],a ld [wFBMode],a
call DrawFrameBlock call DrawFrameBlock
call DoSpecialEffectByAnimationId ; run animation-specific function (if there is one) call DoSpecialEffectByAnimationId ; run animation-specific function (if there is one)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
dec a dec a
ld [W_SUBANIMCOUNTER],a ld [wSubAnimCounter],a
ret z ret z
ld a,[W_SUBANIMSUBENTRYADDR + 1] ld a,[wSubAnimSubEntryAddr + 1]
ld h,a ld h,a
ld a,[W_SUBANIMSUBENTRYADDR] ld a,[wSubAnimSubEntryAddr]
ld l,a ld l,a
ld a,[W_SUBANIMTRANSFORM] ld a,[wSubAnimTransform]
cp a,4 ; is the animation reversed? cp a,4 ; is the animation reversed?
ld bc,3 ld bc,3
jr nz,.nextSubanimationSubentry jr nz,.nextSubanimationSubentry
@ -610,9 +610,9 @@ PlaySubanimation: ; 78e53 (1e:4e53)
.nextSubanimationSubentry .nextSubanimationSubentry
add hl,bc add hl,bc
ld a,h ld a,h
ld [W_SUBANIMSUBENTRYADDR + 1],a ld [wSubAnimSubEntryAddr + 1],a
ld a,l ld a,l
ld [W_SUBANIMSUBENTRYADDR],a ld [wSubAnimSubEntryAddr],a
jp .loop jp .loop
AnimationCleanOAM: ; 78ec8 (1e:4ec8) AnimationCleanOAM: ; 78ec8 (1e:4ec8)
@ -634,7 +634,7 @@ DoSpecialEffectByAnimationId: ; 78ed7 (1e:4ed7)
push hl push hl
push de push de
push bc push bc
ld a,[W_ANIMATIONID] ld a,[wAnimationID]
ld hl,AnimationIdSpecialEffects ld hl,AnimationIdSpecialEffects
ld de,3 ld de,3
call IsInArray call IsInArray
@ -737,21 +737,21 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e)
xor a,%00111100 ; complement colors 1 and 2 xor a,%00111100 ; complement colors 1 and 2
ld [rOBP0],a ld [rOBP0],a
.skipFlashingEffect .skipFlashingEffect
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,11 ; is it the beginning of the subanimation? cp a,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,[W_ISINBATTLE] ld a,[wIsInBattle]
cp a,02 ; is it a trainer battle? cp a,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 a,$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,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,3 cp a,3
jr z,.moveGhostMarowakLeft jr z,.moveGhostMarowakLeft
cp a,2 cp a,2
@ -775,15 +775,15 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e)
ld [rNR10],a ; Channel 1 sweep register ld [rNR10],a ; Channel 1 sweep register
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,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,3 cp a,3
ret nz ret nz
dec a dec a
ld [W_SUBANIMCOUNTER],a ld [wSubAnimCounter],a
ret ret
DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) DoBallShakeSpecialEffects: ; 78f96 (1e:4f96)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,4 ; is it the beginning of a shake? cp a,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
@ -792,7 +792,7 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96)
ld c,40 ld c,40
call DelayFrames call DelayFrames
.skipPlayingSound .skipPlayingSound
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
dec a dec a
ret nz ret nz
; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation ; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation
@ -801,30 +801,30 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96)
ld [wNumShakes],a ld [wNumShakes],a
ret z ret z
; if there are shakes left, restart the subanimation ; if there are shakes left, restart the subanimation
ld a,[W_SUBANIMSUBENTRYADDR] ld a,[wSubAnimSubEntryAddr]
ld l,a ld l,a
ld a,[W_SUBANIMSUBENTRYADDR + 1] ld a,[wSubAnimSubEntryAddr + 1]
ld h,a ld h,a
ld de,-(4 * 3) ; 4 subentries and 3 bytes per subentry ld de,-(4 * 3) ; 4 subentries and 3 bytes per subentry
add hl,de add hl,de
ld a,l ld a,l
ld [W_SUBANIMSUBENTRYADDR],a ld [wSubAnimSubEntryAddr],a
ld a,h ld a,h
ld [W_SUBANIMSUBENTRYADDR + 1],a ld [wSubAnimSubEntryAddr + 1],a
ld a,5 ; number of subentries in the ball shaking subanimation plus one ld a,5 ; number of subentries in the ball shaking subanimation plus one
ld [W_SUBANIMCOUNTER],a ld [wSubAnimCounter],a
ret ret
; plays a sound after the second frame of the poof animation ; plays a sound after the second frame of the poof animation
DoPoofSpecialEffects: ; 78fce (1e:4fce) DoPoofSpecialEffects: ; 78fce (1e:4fce)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,5 cp a,5
ret nz ret nz
ld a,SFX_BALL_POOF ld a,SFX_BALL_POOF
jp PlaySound jp PlaySound
DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9) DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,12 cp a,12
ret nc ret nc
cp a,8 cp a,8
@ -840,21 +840,21 @@ DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
predef_jump PredefShakeScreenVertically ; shake vertically predef_jump PredefShakeScreenVertically ; shake vertically
FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7) FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
and a,7 ; is the subanimation counter exactly 8? and a,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: ; 79000 (1e:5000) FlashScreenEveryFourFrameBlocks: ; 79000 (1e:5000)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
and a,3 and a,3
call z,AnimationFlashScreen call z,AnimationFlashScreen
ret ret
; used for Explosion and Selfdestruct ; used for Explosion and Selfdestruct
DoExplodeSpecialEffects: ; 79009 (1e:5009) DoExplodeSpecialEffects: ; 79009 (1e:5009)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,1 ; is it the end of the subanimation? cp a,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
@ -863,7 +863,7 @@ DoExplodeSpecialEffects: ; 79009 (1e:5009)
; flashes the screen when subanimation counter is 1 modulo 4 ; flashes the screen when subanimation counter is 1 modulo 4
DoBlizzardSpecialEffects: ; 79016 (1e:5016) DoBlizzardSpecialEffects: ; 79016 (1e:5016)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,13 cp a,13
jp z,AnimationFlashScreen jp z,AnimationFlashScreen
cp a,9 cp a,9
@ -877,7 +877,7 @@ DoBlizzardSpecialEffects: ; 79016 (1e:5016)
; flashes the screen at 3 points in the subanimation ; flashes the screen at 3 points in the subanimation
; unused ; unused
FlashScreenUnused: ; 7902e (1e:502e) FlashScreenUnused: ; 7902e (1e:502e)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,14 cp a,14
jp z,AnimationFlashScreen jp z,AnimationFlashScreen
cp a,9 cp a,9
@ -888,7 +888,7 @@ FlashScreenUnused: ; 7902e (1e:502e)
; 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: ; 79041 (1e:5041) TradeHidePokemon: ; 79041 (1e:5041)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,6 cp a,6
ret nz ret nz
ld a,2 * SCREEN_WIDTH + 7 ld a,2 * SCREEN_WIDTH + 7
@ -896,7 +896,7 @@ TradeHidePokemon: ; 79041 (1e:5041)
; 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: ; 7904c (1e:504c) TradeShakePokeball: ; 7904c (1e:504c)
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
cp a,1 cp a,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
@ -976,7 +976,7 @@ DoGrowlSpecialEffects: ; 790bc (1e:50bc)
ld de,wOAMBuffer + $10 ld de,wOAMBuffer + $10
ld bc,$10 ld bc,$10
call CopyData ; copy the musical note graphic call CopyData ; copy the musical note graphic
ld a,[W_SUBANIMCOUNTER] ld a,[wSubAnimCounter]
dec a dec a
call z,AnimationCleanOAM ; clean up at the end of the subanimation call z,AnimationCleanOAM ; clean up at the end of the subanimation
ret ret
@ -984,7 +984,7 @@ DoGrowlSpecialEffects: ; 790bc (1e:50bc)
; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations ; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations
TailWhipAnimationUnused: ; 790d0 (1e:50d0) TailWhipAnimationUnused: ; 790d0 (1e:50d0)
ld a,1 ld a,1
ld [W_SUBANIMCOUNTER],a ld [wSubAnimCounter],a
ld c,20 ld c,20
jp DelayFrames jp DelayFrames
@ -1243,17 +1243,17 @@ AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
call LoadAnimationTileset call LoadAnimationTileset
ld d, 32 ld d, 32
ld a, -16 ld a, -16
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, $71 ld a, $71
ld [wDropletTile], a ld [wDropletTile], a
.loop .loop
ld a, 16 ld a, 16
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, 0 ld a, 0
ld [wUnusedD08A], a ld [wUnusedD08A], a
call _AnimationWaterDroplets call _AnimationWaterDroplets
ld a, 24 ld a, 24
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, 32 ld a, 32
ld [wUnusedD08A], a ld [wUnusedD08A], a
call _AnimationWaterDroplets call _AnimationWaterDroplets
@ -1264,24 +1264,24 @@ AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
_AnimationWaterDroplets: ; 79246 (1e:5246) _AnimationWaterDroplets: ; 79246 (1e:5246)
ld hl, wOAMBuffer ld hl, wOAMBuffer
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld [hli], a ; Y ld [hli], a ; Y
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add 27 add 27
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld [hli], a ; X ld [hli], a ; X
ld a, [wDropletTile] ld a, [wDropletTile]
ld [hli], a ; tile ld [hli], a ; tile
xor a xor a
ld [hli], a ; attribute ld [hli], a ; attribute
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
cp 144 cp 144
jr c, .loop jr c, .loop
sub 168 sub 168
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
add 16 add 16
ld [W_BASECOORDY], a ld [wBaseCoordY], a
cp 112 cp 112
jr c, .loop jr c, .loop
call AnimationCleanOAM call AnimationCleanOAM
@ -1387,14 +1387,14 @@ ShakeEnemyHUD_WritePlayerMonPicOAM: ; 792fd (1e:52fd)
; Writes the OAM entries for a copy of the player mon's pic in OAM. ; Writes the OAM entries for a copy of the player mon's pic in OAM.
; The top 5 rows are reproduced in OAM, although only 2 are actually needed. ; The top 5 rows are reproduced in OAM, although only 2 are actually needed.
ld a, $10 ld a, $10
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, $30 ld a, $30
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld d, 0 ld d, 0
ld c, 7 ld c, 7
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld e, a ld e, a
ld b, 5 ld b, 5
.innerLoop .innerLoop
@ -1406,21 +1406,21 @@ ShakeEnemyHUD_WritePlayerMonPicOAM: ; 792fd (1e:52fd)
ret z ret z
inc d inc d
inc d inc d
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add 8 add 8
ld [W_BASECOORDX], a ld [wBaseCoordX], a
jr .loop jr .loop
BattleAnimWriteOAMEntry: ; 79329 (1e:5329) BattleAnimWriteOAMEntry: ; 79329 (1e:5329)
; Y coordinate = e (increased by 8 each call, before the write to OAM) ; Y coordinate = e (increased by 8 each call, before the write to OAM)
; X coordinate = [W_BASECOORDX] ; X coordinate = [wBaseCoordX]
; tile = d ; tile = d
; attributes = 0 ; attributes = 0
ld a, e ld a, e
add 8 add 8
ld e, a ld e, a
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld [hli], a ld [hli], a
ld a, d ld a, d
ld [hli], a ld [hli], a
@ -1749,9 +1749,9 @@ AnimationShootBallsUpward: ; 794f9 (1e:54f9)
lb bc, 6 * 8, 5 * 8 lb bc, 6 * 8, 5 * 8
.next .next
ld a, b ld a, b
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, c ld a, c
ld [W_BASECOORDX], a ld [wBaseCoordX], a
lb bc, 5, 1 lb bc, 5, 1
call _AnimationShootBallsUpward call _AnimationShootBallsUpward
jp AnimationCleanOAM jp AnimationCleanOAM
@ -1765,7 +1765,7 @@ _AnimationShootBallsUpward: ; 79517 (1e:5517)
ld d, $7a ; ball tile ld d, $7a ; ball tile
ld hl, wOAMBuffer ld hl, wOAMBuffer
push bc push bc
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld e, a ld e, a
.initOAMLoop .initOAMLoop
call BattleAnimWriteOAMEntry call BattleAnimWriteOAMEntry
@ -1779,7 +1779,7 @@ _AnimationShootBallsUpward: ; 79517 (1e:5517)
push bc push bc
ld hl, wOAMBuffer ld hl, wOAMBuffer
.innerLoop .innerLoop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
add 8 add 8
ld e, a ld e, a
ld a, [hl] ld a, [hl]
@ -1819,11 +1819,11 @@ AnimationShootManyBallsUpward: ; 79566 (1e:5566)
ld [wSavedY], a ld [wSavedY], a
.loop .loop
ld a, [wSavedY] ld a, [wSavedY]
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, [hli] ld a, [hli]
cp $ff cp $ff
jp z, AnimationCleanOAM jp z, AnimationCleanOAM
ld [W_BASECOORDX], a ld [wBaseCoordX], a
lb bc, 4, 1 lb bc, 4, 1
push hl push hl
call _AnimationShootBallsUpward call _AnimationShootBallsUpward
@ -2096,10 +2096,10 @@ HideSubstituteShowMonAnim: ; 79747 (1e:5747)
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wPlayerMonMinimized ld hl, wPlayerMonMinimized
ld a, [W_PLAYERBATTSTATUS2] ld a, [wPlayerBattleStatus2]
jr z, .next1 jr z, .next1
ld hl, wEnemyMonMinimized ld hl, wEnemyMonMinimized
ld a, [W_ENEMYBATTSTATUS2] ld a, [wEnemyBattleStatus2]
.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
@ -2150,7 +2150,7 @@ ChangeMonPic: ; 79793 (1e:5793)
ld [wcf91], a ld [wcf91], a
ld [wd0b5], a ld [wd0b5], a
xor a xor a
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
call GetMonHeader call GetMonHeader
coord hl, 12, 0 coord hl, 12, 0
call LoadFrontSpriteByMonIndex call LoadFrontSpriteByMonIndex
@ -2196,7 +2196,7 @@ InitMultipleObjectsOAM: ; 797e8 (1e:57e8)
pop bc pop bc
xor a xor a
ld e, a ld e, a
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld hl, wOAMBuffer ld hl, wOAMBuffer
.loop .loop
call BattleAnimWriteOAMEntry call BattleAnimWriteOAMEntry
@ -2354,7 +2354,7 @@ GetMoveSound: ; 7986f (1e:586f)
IsCryMove: ; 798ad (1e:58ad) IsCryMove: ; 798ad (1e:58ad)
; set carry if the move animation involves playing a monster cry ; set carry if the move animation involves playing a monster cry
ld a,[W_ANIMATIONID] ld a,[wAnimationID]
cp a,GROWL cp a,GROWL
jr z,.CryMove jr z,.CryMove
cp a,ROAR cp a,ROAR
@ -2953,7 +2953,7 @@ BattleAnimCopyTileMapToVRAM: ; 79e0d (1e:5e0d)
jp Delay3 jp Delay3
TossBallAnimation: ; 79e16 (1e:5e16) TossBallAnimation: ; 79e16 (1e:5e16)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
cp a,2 cp a,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]
@ -2984,7 +2984,7 @@ TossBallAnimation: ; 79e16 (1e:5e16)
.done .done
ld a,b ld a,b
.PlayNextAnimation .PlayNextAnimation
ld [W_ANIMATIONID],a ld [wAnimationID],a
push bc push bc
push hl push hl
call PlayAnimation call PlayAnimation
@ -3001,12 +3001,12 @@ TossBallAnimation: ; 79e16 (1e:5e16)
.BlockBall ; 5E55 .BlockBall ; 5E55
ld a,TOSS_ANIM ld a,TOSS_ANIM
ld [W_ANIMATIONID],a ld [wAnimationID],a
call PlayAnimation call PlayAnimation
ld a,SFX_FAINT_THUD ld a,SFX_FAINT_THUD
call PlaySound call PlaySound
ld a,BLOCKBALL_ANIM ld a,BLOCKBALL_ANIM
ld [W_ANIMATIONID],a ld [wAnimationID],a
jp PlayAnimation jp PlayAnimation
PlayApplyingAttackSound: ; 79e6a (1e:5e6a) PlayApplyingAttackSound: ; 79e6a (1e:5e6a)

View file

@ -81,7 +81,7 @@ BattleTransitions: ; 709d2 (1c:49d2)
dw BattleTransition_Split ; %111 dw BattleTransition_Split ; %111
GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2) GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2)
ld a, [W_CUROPPONENT] ld a, [wCurOpponent]
cp 200 cp 200
jr nc, .trainer jr nc, .trainer
res 0, c res 0, c
@ -105,7 +105,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef)
ld a, [hl] ld a, [hl]
add $3 add $3
ld e, a ld e, a
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
sub e sub e
jr nc, .highLevelEnemy jr nc, .highLevelEnemy
res 1, c res 1, c
@ -122,7 +122,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef)
; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE ; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE
; and SILPH_CO_[9-11]F as dungeon maps ; and SILPH_CO_[9-11]F as dungeon maps
GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19) GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19)
ld a, [W_CURMAP] ld a, [wCurMap]
ld e, a ld e, a
ld hl, DungeonMaps1 ld hl, DungeonMaps1
.loop1 .loop1
@ -151,7 +151,7 @@ GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19)
res 2, c res 2, c
ret ret
; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP ; GetBattleTransitionID_IsDungeonMap checks if wCurMap
; is equal to one of these maps ; is equal to one of these maps
DungeonMaps1: ; 70a3f (1c:4a3f) DungeonMaps1: ; 70a3f (1c:4a3f)
db VIRIDIAN_FOREST db VIRIDIAN_FOREST
@ -160,7 +160,7 @@ DungeonMaps1: ; 70a3f (1c:4a3f)
db ROCK_TUNNEL_2 db ROCK_TUNNEL_2
db $FF db $FF
; GetBattleTransitionID_IsDungeonMap checks if W_CURMAP ; GetBattleTransitionID_IsDungeonMap checks if wCurMap
; is in between or equal to each pair of maps ; is in between or equal to each pair of maps
DungeonMaps2: ; 70a44 (1c:4a44) DungeonMaps2: ; 70a44 (1c:4a44)
; all MT_MOON maps ; all MT_MOON maps

View file

@ -1,8 +1,8 @@
PrintBeginningBattleText: ; 58d99 (16:4d99) PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
dec a dec a
jr nz, .trainerBattle jr nz, .trainerBattle
ld a, [W_CURMAP] ld a, [wCurMap]
cp POKEMONTOWER_3 cp POKEMONTOWER_3
jr c, .notPokemonTower jr c, .notPokemonTower
cp LAVENDER_HOUSE_1 cp LAVENDER_HOUSE_1
@ -11,7 +11,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, [wEnemyMonSpecies2] ld a, [wEnemyMonSpecies2]
call PlayCry call PlayCry
ld hl, WildMonAppearedText ld hl, WildMonAppearedText
ld a, [W_MOVEMISSED] ld a, [wMoveMissed]
and a and a
jr z, .notFishing jr z, .notFishing
ld hl, HookedMonAttackedText ld hl, HookedMonAttackedText

File diff suppressed because it is too large Load diff

View file

@ -4,9 +4,9 @@ DecrementPP: ; 68000 (1a:4000)
cp a, STRUGGLE cp a, 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, W_PLAYERBATTSTATUS1 ld hl, wPlayerBattleStatus1
ld a, [hli] ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the
; W_PLAYERBATTSTATUS2 status flags later ; wPlayerBattleStatus2 status flags later
and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes) and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes)
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 UsingRage, [hl]
@ -17,7 +17,7 @@ DecrementPP: ; 68000 (1a:4000)
call .DecrementPP call .DecrementPP
; decrement PP in the party struct ; decrement PP in the party struct
ld a, [W_PLAYERBATTSTATUS3] 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

View file

@ -1,7 +1,7 @@
DrawAllPokeballs: ; 3a849 (e:6849) DrawAllPokeballs: ; 3a849 (e:6849)
call LoadPartyPokeballGfx call LoadPartyPokeballGfx
call SetupOwnPartyPokeballs call SetupOwnPartyPokeballs
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
dec a dec a
ret z ; return if wild pokémon ret z ; return if wild pokémon
jp SetupEnemyPartyPokeballs jp SetupEnemyPartyPokeballs
@ -22,7 +22,7 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869)
ld de, wPartyCount ld de, wPartyCount
call SetupPokeballs call SetupPokeballs
ld a, $60 ld a, $60
ld hl, W_BASECOORDX ld hl, wBaseCoordX
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld a, 8 ld a, 8
@ -35,7 +35,7 @@ SetupEnemyPartyPokeballs: ; 3a887 (e:6887)
ld hl, wEnemyMons ld hl, wEnemyMons
ld de, wEnemyPartyCount ld de, wEnemyPartyCount
call SetupPokeballs call SetupPokeballs
ld hl, W_BASECOORDX ld hl, wBaseCoordX
ld a, $48 ld a, $48
ld [hli], a ld [hli], a
ld [hl], $20 ld [hl], $20
@ -98,19 +98,19 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)
ld de, wBuffer ld de, wBuffer
ld c, PARTY_LENGTH ld c, PARTY_LENGTH
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld [hli], a ld [hli], a
ld a, [de] ld a, [de]
ld [hli], a ld [hli], a
xor a xor a
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld b, a ld b, a
ld a, [wHUDPokeballGfxOffsetX] ld a, [wHUDPokeballGfxOffsetX]
add b add b
ld [W_BASECOORDX], a ld [wBaseCoordX], a
inc de inc de
dec c dec c
jr nz, .loop jr nz, .loop
@ -168,7 +168,7 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
ld hl, wPartyMons ld hl, wPartyMons
ld de, wPartyCount ld de, wPartyCount
call SetupPokeballs call SetupPokeballs
ld hl, W_BASECOORDX ld hl, wBaseCoordX
ld a, $50 ld a, $50
ld [hli], a ld [hli], a
ld [hl], $40 ld [hl], $40
@ -179,7 +179,7 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
ld hl, wEnemyMons ld hl, wEnemyMons
ld de, wEnemyPartyCount ld de, wEnemyPartyCount
call SetupPokeballs call SetupPokeballs
ld hl, W_BASECOORDX ld hl, wBaseCoordX
ld a, $50 ld a, $50
ld [hli], a ld [hli], a
ld [hl], $68 ld [hl], $68

View file

@ -47,10 +47,10 @@ EndOfBattle: ; 137aa (4:77aa)
xor a xor a
ld [wLowHealthAlarm], a ;disable low health alarm ld [wLowHealthAlarm], a ;disable low health alarm
ld [wChannelSoundIDs + CH4], a ld [wChannelSoundIDs + CH4], a
ld [W_ISINBATTLE], a ld [wIsInBattle], a
ld [W_BATTLETYPE], a ld [wBattleType], a
ld [W_MOVEMISSED], a ld [wMoveMissed], a
ld [W_CUROPPONENT], a ld [wCurOpponent], a
ld [wForcePlayerToChooseMon], a ld [wForcePlayerToChooseMon], a
ld [wNumRunAttempts], a ld [wNumRunAttempts], a
ld [wEscapedFromBattle], a ld [wEscapedFromBattle], a

View file

@ -83,7 +83,7 @@ GainExperience: ; 5524f (15:524f)
ld a, 1 ld a, 1
.next .next
ld [wGainBoostedExp], a ld [wGainBoostedExp], a
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
dec a ; is it a trainer battle? dec a ; is it a trainer battle?
call nz, BoostExp ; if so, boost exp call nz, BoostExp ; if so, boost exp
inc hl inc hl
@ -160,11 +160,11 @@ GainExperience: ; 5524f (15:524f)
ld a, [hl] ; current level ld a, [hl] ; current level
cp d cp d
jp z, .nextMon ; if level didn't change, go to next mon jp z, .nextMon ; if level didn't change, go to next mon
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
push af push af
push hl push hl
ld a, d ld a, d
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ld [hl], a ld [hl], a
ld bc, wPartyMon1Species - wPartyMon1Level ld bc, wPartyMon1Species - wPartyMon1Level
add hl, bc add hl, bc
@ -223,7 +223,7 @@ GainExperience: ; 5524f (15:524f)
ld bc, 1 + NUM_STATS * 2 ; size of stats ld bc, 1 + NUM_STATS * 2 ; size of stats
call CopyData call CopyData
pop hl pop hl
ld a, [W_PLAYERBATTSTATUS3] ld a, [wPlayerBattleStatus3]
bit 3, a ; is the mon transformed? bit 3, a ; is the mon transformed?
jr nz, .recalcStatChanges jr nz, .recalcStatChanges
; the mon is not transformed, so update the unmodified stats ; the mon is not transformed, so update the unmodified stats
@ -261,7 +261,7 @@ GainExperience: ; 5524f (15:524f)
predef FlagActionPredef predef FlagActionPredef
pop hl pop hl
pop af pop af
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
.nextMon .nextMon
ld a, [wPartyCount] ld a, [wPartyCount]

View file

@ -1,10 +1,10 @@
GetTrainerName_: ; 13a58 (4:7a58) GetTrainerName_: ; 13a58 (4:7a58)
ld hl, W_GRASSRATE ld hl, wGrassRate
ld a, [wLinkState] ld a, [wLinkState]
and a and a
jr nz, .rival jr nz, .rival
ld hl, W_RIVALNAME ld hl, wRivalName
ld a, [W_TRAINERCLASS] ld a, [wTrainerClass]
cp SONY1 cp SONY1
jr z, .rival jr z, .rival
cp SONY2 cp SONY2
@ -19,6 +19,6 @@ GetTrainerName_: ; 13a58 (4:7a58)
call GetName call GetName
ld hl, wcd6d ld hl, wcd6d
.rival .rival
ld de, W_TRAINERNAME ld de, wTrainerName
ld bc, $d ld bc, $d
jp CopyData jp CopyData

View file

@ -55,22 +55,22 @@ CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a)
ld bc, 7 * 7 ld bc, 7 * 7
call CopyVideoData call CopyVideoData
ld a, $10 ld a, $10
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, $70 ld a, $70
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld hl, wOAMBuffer ld hl, wOAMBuffer
lb bc, 6, 6 lb bc, 6, 6
ld d, $8 ld d, $8
.oamLoop .oamLoop
push bc push bc
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld e, a ld e, a
.oamInnerLoop .oamInnerLoop
ld a, e ld a, e
add $8 add $8
ld e, a ld e, a
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld [hli], a ld [hli], a
ld a, d ld a, d
ld [hli], a ld [hli], a
@ -80,9 +80,9 @@ CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a)
dec c dec c
jr nz, .oamInnerLoop jr nz, .oamInnerLoop
inc d inc d
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add $8 add $8
ld [W_BASECOORDX], a ld [wBaseCoordX], a
pop bc pop bc
dec b dec b
jr nz, .oamLoop jr nz, .oamLoop

View file

@ -27,12 +27,12 @@ InitBattleVariables: ; 525af (14:65af)
jr nz, .loop jr nz, .loop
inc a ; POUND inc a ; POUND
ld [wTestBattlePlayerSelectedMove], a ld [wTestBattlePlayerSelectedMove], a
ld a, [W_CURMAP] ld a, [wCurMap]
cp SAFARI_ZONE_EAST cp SAFARI_ZONE_EAST
jr c, .notSafariBattle jr c, .notSafariBattle
cp SAFARI_ZONE_REST_HOUSE_1 cp SAFARI_ZONE_REST_HOUSE_1
jr nc, .notSafariBattle jr nc, .notSafariBattle
ld a, BATTLE_TYPE_SAFARI ld a, BATTLE_TYPE_SAFARI
ld [W_BATTLETYPE], a ld [wBattleType], a
.notSafariBattle .notSafariBattle
jpab PlayBattleMusic jpab PlayBattleMusic

View file

@ -3,13 +3,13 @@ ConversionEffect_: ; 139a3 (4:79a3)
ld de, wBattleMonType1 ld de, wBattleMonType1
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [W_ENEMYBATTSTATUS1] ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect jr z, .conversionEffect
push hl push hl
ld h, d ld h, d
ld l, e ld l, e
pop de pop de
ld a, [W_PLAYERBATTSTATUS1] 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

View file

@ -1,5 +1,5 @@
DrainHPEffect_: ; 783f (1:783f) DrainHPEffect_: ; 783f (1:783f)
ld hl, W_DAMAGE ld hl, wDamage
ld a, [hl] ld a, [hl]
srl a ; divide damage by 2 srl a ; divide damage by 2
ld [hli], a ld [hli], a
@ -36,12 +36,12 @@ DrainHPEffect_: ; 783f (1:783f)
dec bc dec bc
ld [bc], a ld [bc], a
; add damage to attacker's HP and copy new HP to wHPBarNewHP ; add damage to attacker's HP and copy new HP to wHPBarNewHP
ld a, [W_DAMAGE + 1] ld a, [wDamage + 1]
ld b, [hl] ld b, [hl]
add b add b
ld [hld], a ld [hld], a
ld [wHPBarNewHP], a ld [wHPBarNewHP], a
ld a, [W_DAMAGE] ld a, [wDamage]
ld b, [hl] ld b, [hl]
adc b adc b
ld [hli], a ld [hli], a
@ -85,9 +85,9 @@ DrainHPEffect_: ; 783f (1:783f)
ld hl, SuckedHealthText ld hl, SuckedHealthText
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [W_PLAYERMOVEEFFECT] ld a, [wPlayerMoveEffect]
jr z, .next3 jr z, .next3
ld a, [W_ENEMYMOVEEFFECT] ld a, [wEnemyMoveEffect]
.next3 .next3
cp DREAM_EATER_EFFECT cp DREAM_EATER_EFFECT
jr nz, .printText jr nz, .printText

View file

@ -1,9 +1,9 @@
FocusEnergyEffect_: ; 27f86 (9:7f86) FocusEnergyEffect_: ; 27f86 (9:7f86)
ld hl, W_PLAYERBATTSTATUS2 ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .notEnemy jr z, .notEnemy
ld hl, W_ENEMYBATTSTATUS2 ld hl, wEnemyBattleStatus2
.notEnemy .notEnemy
bit GettingPumped, [hl] ; is mon already using focus energy? bit GettingPumped, [hl] ; is mon already using focus energy?
jr nz, .alreadyUsing jr nz, .alreadyUsing

View file

@ -31,14 +31,14 @@ HazeEffect_: ; 139da (4:79da)
.cureVolatileStatuses .cureVolatileStatuses
xor a xor a
ld [W_PLAYERDISABLEDMOVE], a ld [wPlayerDisabledMove], a
ld [W_ENEMYDISABLEDMOVE], a ld [wEnemyDisabledMove], a
ld hl, wPlayerDisabledMoveNumber ld hl, wPlayerDisabledMoveNumber
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld hl, W_PLAYERBATTSTATUS1 ld hl, wPlayerBattleStatus1
call CureVolatileStatuses call CureVolatileStatuses
ld hl, W_ENEMYBATTSTATUS1 ld hl, wEnemyBattleStatus1
call CureVolatileStatuses call CureVolatileStatuses
ld hl, PlayCurrentMoveAnimation ld hl, PlayCurrentMoveAnimation
call CallBankF call CallBankF

View file

@ -3,11 +3,11 @@ HealEffect_: ; 3b9ec (e:79ec)
and a and a
ld de, wBattleMonHP ld de, wBattleMonHP
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
ld a, [W_PLAYERMOVENUM] ld a, [wPlayerMoveNum]
jr z, .healEffect jr z, .healEffect
ld de, wEnemyMonHP ld de, wEnemyMonHP
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld a, [W_ENEMYMOVENUM] ld a, [wEnemyMoveNum]
.healEffect .healEffect
ld b, a ld b, a
ld a, [de] ld a, [de]

View file

@ -1,14 +1,14 @@
LeechSeedEffect_: ; 2bea9 (a:7ea9) LeechSeedEffect_: ; 2bea9 (a:7ea9)
callab MoveHitTest callab MoveHitTest
ld a, [W_MOVEMISSED] ld a, [wMoveMissed]
and a and a
jr nz, .moveMissed jr nz, .moveMissed
ld hl, W_ENEMYBATTSTATUS2 ld hl, wEnemyBattleStatus2
ld de, wEnemyMonType1 ld de, wEnemyMonType1
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .leechSeedEffect jr z, .leechSeedEffect
ld hl, W_PLAYERBATTSTATUS2 ld hl, wPlayerBattleStatus2
ld de, wBattleMonType1 ld de, wBattleMonType1
.leechSeedEffect .leechSeedEffect
; miss if the target is grass-type or already seeded ; miss if the target is grass-type or already seeded

View file

@ -1,9 +1,9 @@
MistEffect_: ; 33f2b (c:7f2b) MistEffect_: ; 33f2b (c:7f2b)
ld hl, W_PLAYERBATTSTATUS2 ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .mistEffect jr z, .mistEffect
ld hl, W_ENEMYBATTSTATUS2 ld hl, wEnemyBattleStatus2
.mistEffect .mistEffect
bit ProtectedByMist, [hl] ; is mon protected by mist? bit ProtectedByMist, [hl] ; is mon protected by mist?
jr nz, .mistAlreadyInUse jr nz, .mistAlreadyInUse

View file

@ -1,5 +1,5 @@
OneHitKOEffect_: ; 33f57 (c:7f57) OneHitKOEffect_: ; 33f57 (c:7f57)
ld hl, W_DAMAGE ld hl, wDamage
xor a xor a
ld [hli], a ld [hli], a
ld [hl], a ; set the damage output to zero ld [hl], a ; set the damage output to zero
@ -24,7 +24,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld a, [hl] ld a, [hl]
sbc b sbc b
jr c, .userIsSlower jr c, .userIsSlower
ld hl, W_DAMAGE ld hl, wDamage
ld a, $ff ld a, $ff
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
@ -34,5 +34,5 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
.userIsSlower .userIsSlower
; keep damage at 0 and set move missed flag if target's current speed is higher instead ; keep damage at 0 and set move missed flag if target's current speed is higher instead
ld a, $1 ld a, $1
ld [W_MOVEMISSED], a ld [wMoveMissed], a
ret ret

View file

@ -1,11 +1,11 @@
ParalyzeEffect_: ; 52601 (14:6601) ParalyzeEffect_: ; 52601 (14:6601)
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
ld de, W_PLAYERMOVETYPE ld de, wPlayerMoveType
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jp z, .next jp z, .next
ld hl, wBattleMonStatus ld hl, wBattleMonStatus
ld de, W_ENEMYMOVETYPE ld de, wEnemyMoveType
.next .next
ld a, [hl] ld a, [hl]
and a ; does the target already have a status ailment? and a ; does the target already have a status ailment?
@ -28,7 +28,7 @@ ParalyzeEffect_: ; 52601 (14:6601)
push hl push hl
callab MoveHitTest callab MoveHitTest
pop hl pop hl
ld a, [W_MOVEMISSED] ld a, [wMoveMissed]
and a and a
jr nz, .didntAffect jr nz, .didntAffect
set PAR, [hl] set PAR, [hl]

View file

@ -1,16 +1,16 @@
RecoilEffect_: ; 1392c (4:792c) RecoilEffect_: ; 1392c (4:792c)
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [W_PLAYERMOVENUM] ld a, [wPlayerMoveNum]
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
jr z, .recoilEffect jr z, .recoilEffect
ld a, [W_ENEMYMOVENUM] ld a, [wEnemyMoveNum]
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
.recoilEffect .recoilEffect
ld d, a ld d, a
ld a, [W_DAMAGE] ld a, [wDamage]
ld b, a ld b, a
ld a, [W_DAMAGE + 1] ld a, [wDamage + 1]
ld c, a ld c, a
srl b srl b
rr c rr c

View file

@ -1,11 +1,11 @@
ReflectLightScreenEffect_: ; 3bb97 (e:7b97) ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
ld hl, W_PLAYERBATTSTATUS3 ld hl, wPlayerBattleStatus3
ld de, W_PLAYERMOVEEFFECT ld de, wPlayerMoveEffect
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .reflectLightScreenEffect jr z, .reflectLightScreenEffect
ld hl, W_ENEMYBATTSTATUS3 ld hl, wEnemyBattleStatus3
ld de, W_ENEMYMOVEEFFECT ld de, wEnemyMoveEffect
.reflectLightScreenEffect .reflectLightScreenEffect
ld a, [de] ld a, [de]
cp LIGHT_SCREEN_EFFECT cp LIGHT_SCREEN_EFFECT

View file

@ -3,13 +3,13 @@ SubstituteEffect_: ; 17dad (5:7dad)
call DelayFrames call DelayFrames
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP ld de, wPlayerSubstituteHP
ld bc, W_PLAYERBATTSTATUS2 ld bc, wPlayerBattleStatus2
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .notEnemy jr z, .notEnemy
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld de, wEnemySubstituteHP ld de, wEnemySubstituteHP
ld bc, W_ENEMYBATTSTATUS2 ld bc, wEnemyBattleStatus2
.notEnemy .notEnemy
ld a, [bc] ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute? bit HasSubstituteUp, a ; user already has substitute?
@ -44,7 +44,7 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld h, b ld h, b
ld l, c ld l, c
set HasSubstituteUp, [hl] set HasSubstituteUp, [hl]
ld a, [W_OPTIONS] ld a, [wOptions]
bit 7, a ; battle animation is enabled? bit 7, a ; battle animation is enabled?
ld hl, PlayCurrentMoveAnimation ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation) ld b, BANK(PlayCurrentMoveAnimation)

View file

@ -1,27 +1,27 @@
TransformEffect_: ; 3bab1 (e:7ab1) TransformEffect_: ; 3bab1 (e:7ab1)
ld hl, wBattleMonSpecies ld hl, wBattleMonSpecies
ld de, wEnemyMonSpecies ld de, wEnemyMonSpecies
ld bc, W_ENEMYBATTSTATUS3 ld bc, wEnemyBattleStatus3
ld a, [W_ENEMYBATTSTATUS1] ld a, [wEnemyBattleStatus1]
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr nz, .hitTest jr nz, .hitTest
ld hl, wEnemyMonSpecies ld hl, wEnemyMonSpecies
ld de, wBattleMonSpecies ld de, wBattleMonSpecies
ld bc, W_PLAYERBATTSTATUS3 ld bc, wPlayerBattleStatus3
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
ld a, [W_PLAYERBATTSTATUS1] 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
push bc push bc
ld hl, W_PLAYERBATTSTATUS2 ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .transformEffect jr z, .transformEffect
ld hl, W_ENEMYBATTSTATUS2 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 HasSubstituteUp, [hl]
@ -29,7 +29,7 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld hl, HideSubstituteShowMonAnim ld hl, HideSubstituteShowMonAnim
ld b, BANK(HideSubstituteShowMonAnim) ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch call nz, Bankswitch
ld a, [W_OPTIONS] ld a, [wOptions]
add a add a
ld hl, PlayCurrentMoveAnimation ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation) ld b, BANK(PlayCurrentMoveAnimation)

View file

@ -6,11 +6,11 @@ PrintMonType: ; 27d6b (9:7d6b)
call GetMonHeader call GetMonHeader
pop hl pop hl
push hl push hl
ld a, [W_MONHTYPE1] ld a, [wMonHType1]
call PrintType call PrintType
ld a, [W_MONHTYPE1] ld a, [wMonHType1]
ld b, a ld b, a
ld a, [W_MONHTYPE2] ld a, [wMonHType2]
cp b cp b
pop hl pop hl
jr z, EraseType2Text jr z, EraseType2Text
@ -34,7 +34,7 @@ EraseType2Text: ; 27d8c (9:7d8c)
PrintMoveType: ; 27d98 (9:7d98) PrintMoveType: ; 27d98 (9:7d98)
call GetPredefRegisters call GetPredefRegisters
push hl push hl
ld a, [W_PLAYERMOVETYPE] ld a, [wPlayerMoveType]
; fall through ; fall through
PrintType_: ; 27d9f (9:7d9f) PrintType_: ; 27d9f (9:7d9f)

View file

@ -15,7 +15,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [hl],a ld [hl],a
; get the pointer to trainer data for this class ; get the pointer to trainer data for this class
ld a,[W_CUROPPONENT] ld a,[wCurOpponent]
sub $C9 ; convert value from pokemon to trainer sub $C9 ; convert value from pokemon to trainer
add a,a add a,a
ld hl,TrainerDataPointers ld hl,TrainerDataPointers
@ -25,7 +25,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
ld a,[W_TRAINERNO] ld a,[wTrainerNo]
ld b,a ld b,a
; At this point b contains the trainer number, ; At this point b contains the trainer number,
; and hl points to the trainer class. ; and hl points to the trainer class.
@ -43,13 +43,13 @@ ReadTrainer: ; 39c53 (e:5c53)
; if the first byte of trainer data is FF, ; if the first byte of trainer data is FF,
; - each pokemon has a specific level ; - each pokemon has a specific level
; (as opposed to the whole team being of the same level) ; (as opposed to the whole team being of the same level)
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move ; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move
; else the first byte is the level of every pokemon on the team ; else the first byte is the level of every pokemon on the team
.IterateTrainer .IterateTrainer
ld a,[hli] ld a,[hli]
cp $FF ; is the trainer special? cp $FF ; is the trainer special?
jr z,.SpecialTrainer ; if so, check for special moves jr z,.SpecialTrainer ; if so, check for special moves
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
.LoopTrainerData .LoopTrainerData
ld a,[hli] ld a,[hli]
and a ; have we reached the end of the trainer data? and a ; have we reached the end of the trainer data?
@ -65,11 +65,11 @@ ReadTrainer: ; 39c53 (e:5c53)
; if this code is being run: ; if this code is being run:
; - each pokemon has a specific level ; - each pokemon has a specific level
; (as opposed to the whole team being of the same level) ; (as opposed to the whole team being of the same level)
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move ; - if [wLoneAttackNo] != 0, one pokemon on the team has a special move
ld a,[hli] ld a,[hli]
and a ; have we reached the end of the trainer data? and a ; have we reached the end of the trainer data?
jr z,.AddLoneMove jr z,.AddLoneMove
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
ld a,[hli] ld a,[hli]
ld [wcf91],a ld [wcf91],a
ld a,ENEMY_PARTY_DATA ld a,ENEMY_PARTY_DATA
@ -80,7 +80,7 @@ ReadTrainer: ; 39c53 (e:5c53)
jr .SpecialTrainer jr .SpecialTrainer
.AddLoneMove .AddLoneMove
; does the trainer have a single monster with a different move ; does the trainer have a single monster with a different move
ld a,[W_LONEATTACKNO] ; Brock is 01, Misty is 02, Erika is 04, etc ld a,[wLoneAttackNo] ; Brock is 01, Misty is 02, Erika is 04, etc
and a and a
jr z,.AddTeamMove jr z,.AddTeamMove
dec a dec a
@ -100,7 +100,7 @@ ReadTrainer: ; 39c53 (e:5c53)
; check if our trainer's team has special moves ; check if our trainer's team has special moves
; get trainer class number ; get trainer class number
ld a,[W_CUROPPONENT] ld a,[wCurOpponent]
sub 200 sub 200
ld b,a ld b,a
ld hl,TeamMoves ld hl,TeamMoves
@ -130,7 +130,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [wEnemyMon1Moves + 2],a ld [wEnemyMon1Moves + 2],a
; starter ; starter
ld a,[W_RIVALSTARTER] ld a,[wRivalStarter]
cp STARTER3 cp STARTER3
ld b,MEGA_DRAIN ld b,MEGA_DRAIN
jr z,.GiveStarterMove jr z,.GiveStarterMove
@ -150,7 +150,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [de],a ld [de],a
inc de inc de
ld [de],a ld [de],a
ld a,[W_CURENEMYLVL] ld a,[wCurEnemyLVL]
ld b,a ld b,a
.LastLoop .LastLoop
; update wAmountMoneyWon addresses (money to win) based on enemy's level ; update wAmountMoneyWon addresses (money to win) based on enemy's level
@ -162,5 +162,5 @@ ReadTrainer: ; 39c53 (e:5c53)
inc de inc de
inc de inc de
dec b dec b
jr nz,.LastLoop ; repeat W_CURENEMYLVL times jr nz,.LastLoop ; repeat wCurEnemyLVL times
ret ret

View file

@ -18,7 +18,7 @@ PrintSafariZoneBattleText: ; 4277 (1:4277)
ld a, [wEnemyMonSpecies] ld a, [wEnemyMonSpecies]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld a, [W_MONHCATCHRATE] ld a, [wMonHCatchRate]
ld [wEnemyMonCatchRate], a ld [wEnemyMonCatchRate], a
pop hl pop hl
.asm_429f .asm_429f

View file

@ -1,6 +1,6 @@
SaveTrainerName: ; 27e4a (9:7e4a) SaveTrainerName: ; 27e4a (9:7e4a)
ld hl,TrainerNamePointers ld hl,TrainerNamePointers
ld a,[W_TRAINERCLASS] ld a,[wTrainerClass]
dec a dec a
ld c,a ld c,a
ld b,0 ld b,0
@ -23,50 +23,50 @@ TrainerNamePointers: ; 27e64 (9:7e64)
dw YoungsterName dw YoungsterName
dw BugCatcherName dw BugCatcherName
dw LassName dw LassName
dw W_TRAINERNAME dw wTrainerName
dw JrTrainerMName dw JrTrainerMName
dw JrTrainerFName dw JrTrainerFName
dw PokemaniacName dw PokemaniacName
dw SuperNerdName dw SuperNerdName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw BurglarName dw BurglarName
dw EngineerName dw EngineerName
dw JugglerXName dw JugglerXName
dw W_TRAINERNAME dw wTrainerName
dw SwimmerName dw SwimmerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw BeautyName dw BeautyName
dw W_TRAINERNAME dw wTrainerName
dw RockerName dw RockerName
dw JugglerName dw JugglerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw BlackbeltName dw BlackbeltName
dw W_TRAINERNAME dw wTrainerName
dw ProfOakName dw ProfOakName
dw ChiefName dw ChiefName
dw ScientistName dw ScientistName
dw W_TRAINERNAME dw wTrainerName
dw RocketName dw RocketName
dw CooltrainerMName dw CooltrainerMName
dw CooltrainerFName dw CooltrainerFName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
dw W_TRAINERNAME dw wTrainerName
YoungsterName: ; 27ec2 (9:7ec2) YoungsterName: ; 27ec2 (9:7ec2)
db "YOUNGSTER@" db "YOUNGSTER@"

View file

@ -7,7 +7,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld [hli], a ; move 2 ld [hli], a ; move 2
ld [hli], a ; move 3 ld [hli], a ; move 3
ld [hl], a ; move 4 ld [hl], a ; move 4
ld a, [W_ENEMYDISABLEDMOVE] ; forbid disabled move (if any) ld a, [wEnemyDisabledMove] ; forbid disabled move (if any)
swap a swap a
and $f and $f
jr z, .noMoveDisabled jr z, .noMoveDisabled
@ -19,7 +19,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld [hl], $50 ; forbid (highly discourage) disabled move ld [hl], $50 ; forbid (highly discourage) disabled move
.noMoveDisabled .noMoveDisabled
ld hl, TrainerClassMoveChoiceModifications ld hl, TrainerClassMoveChoiceModifications
ld a, [W_TRAINERCLASS] ld a, [wTrainerClass]
ld b, a ld b, a
.loopTrainerClasses .loopTrainerClasses
dec b dec b
@ -126,10 +126,10 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
ret z ; no more moves in move set ret z ; no more moves in move set
inc de inc de
call ReadMove call ReadMove
ld a, [W_ENEMYMOVEPOWER] ld a, [wEnemyMovePower]
and a and a
jr nz, .nextMove jr nz, .nextMove
ld a, [W_ENEMYMOVEEFFECT] ld a, [wEnemyMoveEffect]
push hl push hl
push de push de
push bc push bc
@ -171,7 +171,7 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7)
ret z ; no more moves in move set ret z ; no more moves in move set
inc de inc de
call ReadMove call ReadMove
ld a, [W_ENEMYMOVEEFFECT] ld a, [wEnemyMoveEffect]
cp ATTACK_UP1_EFFECT cp ATTACK_UP1_EFFECT
jr c, .nextMove jr c, .nextMove
cp BIDE_EFFECT cp BIDE_EFFECT
@ -218,7 +218,7 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
push hl push hl
push de push de
push bc push bc
ld a, [W_ENEMYMOVETYPE] ld a, [wEnemyMoveType]
ld d, a ld d, a
ld hl, wEnemyMonMoves ; enemy moves ld hl, wEnemyMonMoves ; enemy moves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
@ -230,17 +230,17 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
and a and a
jr z, .done jr z, .done
call ReadMove call ReadMove
ld a, [W_ENEMYMOVEEFFECT] ld a, [wEnemyMoveEffect]
cp SUPER_FANG_EFFECT cp SUPER_FANG_EFFECT
jr z, .betterMoveFound ; Super Fang is considered to be a better move jr z, .betterMoveFound ; Super Fang is considered to be a better move
cp SPECIAL_DAMAGE_EFFECT cp SPECIAL_DAMAGE_EFFECT
jr z, .betterMoveFound ; any special damage moves are considered to be better moves jr z, .betterMoveFound ; any special damage moves are considered to be better moves
cp FLY_EFFECT cp FLY_EFFECT
jr z, .betterMoveFound ; Fly is considered to be a better move jr z, .betterMoveFound ; Fly is considered to be a better move
ld a, [W_ENEMYMOVETYPE] ld a, [wEnemyMoveType]
cp d cp d
jr z, .loopMoves jr z, .loopMoves
ld a, [W_ENEMYMOVEPOWER] ld a, [wEnemyMovePower]
and a and a
jr nz, .betterMoveFound ; damaging moves of a different type are considered to be better moves jr nz, .betterMoveFound ; damaging moves of a different type are considered to be better moves
jr .loopMoves jr .loopMoves
@ -266,7 +266,7 @@ ReadMove: ; 39884 (e:5884)
ld hl,Moves ld hl,Moves
ld bc,MoveEnd - Moves ld bc,MoveEnd - Moves
call AddNTimes call AddNTimes
ld de,W_ENEMYMOVENUM ld de,wEnemyMoveNum
call CopyData call CopyData
pop bc pop bc
pop de pop de
@ -338,13 +338,13 @@ INCLUDE "data/trainer_parties.asm"
TrainerAI: ; 3a52e (e:652e) TrainerAI: ; 3a52e (e:652e)
and a and a
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
dec a dec a
ret z ; if not a trainer, we're done here ret z ; if not a trainer, we're done here
ld a,[wLinkState] ld a,[wLinkState]
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
ret z ret z
ld a,[W_TRAINERCLASS] ; what trainer class is this? ld a,[wTrainerClass] ; what trainer class is this?
dec a dec a
ld c,a ld c,a
ld b,0 ld b,0
@ -727,27 +727,27 @@ AICureStatus: ; 3a791 (e:6791)
xor a xor a
ld [hl],a ; clear status in enemy team roster ld [hl],a ; clear status in enemy team roster
ld [wEnemyMonStatus],a ; clear status of active enemy ld [wEnemyMonStatus],a ; clear status of active enemy
ld hl,W_ENEMYBATTSTATUS3 ld hl,wEnemyBattleStatus3
res 0,[hl] res 0,[hl]
ret ret
AIUseXAccuracy: ; 0x3a7a8 unused AIUseXAccuracy: ; 0x3a7a8 unused
call AIPlayRestoringSFX call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2 ld hl,wEnemyBattleStatus2
set 0,[hl] set 0,[hl]
ld a,X_ACCURACY ld a,X_ACCURACY
jp AIPrintItemUse jp AIPrintItemUse
AIUseGuardSpec: ; 3a7b5 (e:67b5) AIUseGuardSpec: ; 3a7b5 (e:67b5)
call AIPlayRestoringSFX call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2 ld hl,wEnemyBattleStatus2
set 1,[hl] set 1,[hl]
ld a,GUARD_SPEC_ ld a,GUARD_SPEC_
jp AIPrintItemUse jp AIPrintItemUse
AIUseDireHit: ; 0x3a7c2 unused AIUseDireHit: ; 0x3a7c2 unused
call AIPlayRestoringSFX call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2 ld hl,wEnemyBattleStatus2
set 2,[hl] set 2,[hl]
ld a,DIRE_HIT ld a,DIRE_HIT
jp AIPrintItemUse jp AIPrintItemUse
@ -803,7 +803,7 @@ AIIncreaseStat: ; 3a808 (e:6808)
push bc push bc
call AIPrintItemUse_ call AIPrintItemUse_
pop bc pop bc
ld hl,W_ENEMYMOVEEFFECT ld hl,wEnemyMoveEffect
ld a,[hld] ld a,[hld]
push af push af
ld a,[hl] ld a,[hl]

View file

@ -27,9 +27,9 @@ TryDoWildEncounter: ; 13870 (4:7870)
; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? ; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile?
coord hl, 9, 9 coord hl, 9, 9
ld c, [hl] ld c, [hl]
ld a, [W_GRASSTILE] ld a, [wGrassTile]
cp c cp c
ld a, [W_GRASSRATE] ld a, [wGrassRate]
jr z, .CanEncounter jr z, .CanEncounter
ld a, $14 ; in all tilesets with a water tile, this is its id ld a, $14 ; in all tilesets with a water tile, this is its id
cp c cp c
@ -38,13 +38,13 @@ TryDoWildEncounter: ; 13870 (4:7870)
; even if not in grass/water, standing anywhere we can encounter pokemon ; even if not in grass/water, standing anywhere we can encounter pokemon
; so long as the map is "indoor" and has wild pokemon defined. ; so long as the map is "indoor" and has wild pokemon defined.
; ...as long as it's not Viridian Forest or Safari Zone. ; ...as long as it's not Viridian Forest or Safari Zone.
ld a, [W_CURMAP] ld a, [wCurMap]
cp REDS_HOUSE_1F ; is this an indoor map? cp REDS_HOUSE_1F ; is this an indoor map?
jr c, .CantEncounter2 jr c, .CantEncounter2
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
cp FOREST ; Viridian Forest/Safari Zone cp FOREST ; Viridian Forest/Safari Zone
jr z, .CantEncounter2 jr z, .CantEncounter2
ld a, [W_GRASSRATE] ld a, [wGrassRate]
.CanEncounter .CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter ; compare encounter chance with a random number to determine if there will be an encounter
ld b, a ld b, a
@ -63,7 +63,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
.gotEncounterSlot .gotEncounterSlot
; determine which wild pokemon (grass or water) can appear in the half-block we're standing in ; determine which wild pokemon (grass or water) can appear in the half-block we're standing in
ld c, [hl] ld c, [hl]
ld hl, W_GRASSMONS ld hl, wGrassMons
aCoord 8, 9 aCoord 8, 9
cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
@ -74,7 +74,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ld a, [hl] ld a, [hl]
ld [wcf91], a ld [wcf91], a
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
@ -83,7 +83,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr z, .willEncounter jr z, .willEncounter
ld a, [wPartyMon1Level] ld a, [wPartyMon1Level]
ld b, a ld b, a
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
cp b cp b
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
jr .willEncounter jr .willEncounter

View file

@ -57,8 +57,8 @@ CableClub_DoBattleOrTradeAgain: ; 5345
ld [hli], a ld [hli], a
dec b dec b
jr nz, .zeroPlayerDataPatchListLoop jr nz, .zeroPlayerDataPatchListLoop
ld hl, W_GRASSRATE ld hl, wGrassRate
ld bc, W_TRAINERHEADERPTR - W_GRASSRATE ld bc, wTrainerHeaderPtr - wGrassRate
.zeroEnemyPartyLoop .zeroEnemyPartyLoop
xor a xor a
ld [hli], a ld [hli], a
@ -186,7 +186,7 @@ CableClub_DoBattleOrTradeAgain: ; 5345
dec c dec c
jr nz, .copyEnemyNameLoop jr nz, .copyEnemyNameLoop
ld de, wEnemyPartyCount ld de, wEnemyPartyCount
ld bc, W_TRAINERHEADERPTR - wEnemyPartyCount ld bc, wTrainerHeaderPtr - wEnemyPartyCount
.copyEnemyPartyLoop .copyEnemyPartyLoop
ld a, [hli] ld a, [hli]
cp SERIAL_NO_DATA_BYTE cp SERIAL_NO_DATA_BYTE
@ -275,10 +275,10 @@ CableClub_DoBattleOrTradeAgain: ; 5345
ld a, LINK_STATE_BATTLING ld a, LINK_STATE_BATTLING
ld [wLinkState], a ld [wLinkState], a
ld a, OPP_SONY1 ld a, OPP_SONY1
ld [W_CUROPPONENT], a ld [wCurOpponent], a
call ClearScreen call ClearScreen
call Delay3 call Delay3
ld hl, W_OPTIONS ld hl, wOptions
res 7, [hl] res 7, [hl]
predef InitOpponent predef InitOpponent
predef HealParty predef HealParty
@ -900,18 +900,18 @@ CableClub_Run: ; 5a5f (1:5a5f)
call CableClub_DoBattleOrTrade call CableClub_DoBattleOrTrade
ld hl, Club_GFX ld hl, Club_GFX
ld a, h ld a, h
ld [W_TILESETGFXPTR + 1], a ld [wTileSetGFXPtr + 1], a
ld a, l ld a, l
ld [W_TILESETGFXPTR], a ld [wTileSetGFXPtr], a
ld a, Bank(Club_GFX) ld a, Bank(Club_GFX)
ld [W_TILESETBANK], a ld [wTileSetBank], a
ld hl, Club_Coll ld hl, Club_Coll
ld a, h ld a, h
ld [W_TILESETCOLLISIONPTR + 1], a ld [wTileSetCollisionPtr + 1], a
ld a, l ld a, l
ld [W_TILESETCOLLISIONPTR], a ld [wTileSetCollisionPtr], a
xor a xor a
ld [W_GRASSRATE], a ld [wGrassRate], a
inc a ; LINK_STATE_IN_CABLE_CLUB inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a ld [wLinkState], a
ld [$ffb5], a ld [$ffb5], a

View file

@ -105,7 +105,7 @@ Evolution_PartyMonLoop: ; loop over party mons
cp b ; is the mon's level greater than the evolution requirement? cp b ; is the mon's level greater than the evolution requirement?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.doEvolution .doEvolution
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ld a, 1 ld a, 1
ld [wEvolutionOccurred], a ld [wEvolutionOccurred], a
push hl push hl
@ -163,10 +163,10 @@ Evolution_PartyMonLoop: ; loop over party mons
ld hl, BaseStats ld hl, BaseStats
ld bc, MonBaseStatsEnd - MonBaseStats ld bc, MonBaseStatsEnd - MonBaseStats
call AddNTimes call AddNTimes
ld de, W_MONHEADER ld de, wMonHeader
call CopyData call CopyData
ld a, [wd0b5] ld a, [wd0b5]
ld [W_MONHINDEX], a ld [wMonHIndex], a
pop af pop af
ld [wd11e], a ld [wd11e], a
ld hl, wLoadedMonHPExp - 1 ld hl, wLoadedMonHPExp - 1
@ -210,7 +210,7 @@ Evolution_PartyMonLoop: ; loop over party mons
call LearnMoveFromLevelUp call LearnMoveFromLevelUp
pop hl pop hl
predef SetPartyMonTypes predef SetPartyMonTypes
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
call z, Evolution_ReloadTilesetTilePatterns call z, Evolution_ReloadTilesetTilePatterns
predef IndexToPokedex predef IndexToPokedex
@ -249,7 +249,7 @@ Evolution_PartyMonLoop: ; loop over party mons
ld a, [wLinkState] ld a, [wLinkState]
cp LINK_STATE_TRADING cp LINK_STATE_TRADING
ret z ret z
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
ret nz ret nz
ld a, [wEvolutionOccurred] ld a, [wEvolutionOccurred]
@ -262,7 +262,7 @@ RenameEvolvedMon: ; 3aef7 (e:6ef7)
; nickname, in which case the nickname is kept. ; nickname, in which case the nickname is kept.
ld a, [wd0b5] ld a, [wd0b5]
push af push af
ld a, [W_MONHINDEX] ld a, [wMonHIndex]
ld [wd0b5], a ld [wd0b5], a
call GetName call GetName
pop af pop af
@ -340,7 +340,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b)
and a ; have we reached the end of the learn set? and a ; have we reached the end of the learn set?
jr z, .done ; if we've reached the end of the learn set, jump jr z, .done ; if we've reached the end of the learn set, jump
ld b, a ; level the move is learnt at ld b, a ; level the move is learnt at
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
cp b ; is the move learnt at the mon's current level? cp b ; is the move learnt at the mon's current level?
ld a, [hli] ; move ID ld a, [hli] ; move ID
jr nz, .learnSetLoop jr nz, .learnSetLoop
@ -375,7 +375,7 @@ LearnMoveFromLevelUp: ; 3af5b (e:6f5b)
ld [wd11e], a ld [wd11e], a
ret ret
; writes the moves a mon has at level [W_CURENEMYLVL] to [de] ; writes the moves a mon has at level [wCurEnemyLVL] to [de]
; move slots are being filled up sequentially and shifted if all slots are full ; move slots are being filled up sequentially and shifted if all slots are full
WriteMonMoves: ; 3afb8 (e:6fb8) WriteMonMoves: ; 3afb8 (e:6fb8)
call GetPredefRegisters call GetPredefRegisters
@ -407,7 +407,7 @@ WriteMonMoves: ; 3afb8 (e:6fb8)
and a and a
jp z, .done ; end of list jp z, .done ; end of list
ld b, a ld b, a
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
cp b cp b
jp c, .done ; mon level < move level (assumption: learnset is sorted by level) jp c, .done ; mon level < move level (assumption: learnset is sorted by level)
ld a, [wLearningMovesFromDayCare] ld a, [wLearningMovesFromDayCare]

View file

@ -29,7 +29,7 @@ CalcLevelFromExperience: ; 58f43 (16:4f43)
; calculates the amount of experience needed for level d ; calculates the amount of experience needed for level d
CalcExperience: ; 58f6a (16:4f6a) CalcExperience: ; 58f6a (16:4f6a)
ld a, [W_MONHGROWTHRATE] ld a, [wMonHGrowthRate]
add a add a
add a add a
ld c, a ld c, a

View file

@ -7,12 +7,12 @@ _GivePokemon: ; 4fda5 (13:7da5)
ld a, [wPartyCount] ld a, [wPartyCount]
cp PARTY_LENGTH cp PARTY_LENGTH
jr c, .addToParty jr c, .addToParty
ld a, [W_NUMINBOX] ld a, [wNumInBox]
cp MONS_PER_BOX cp MONS_PER_BOX
jr nc, .boxFull jr nc, .boxFull
; add to box ; add to box
xor a xor a
ld [W_ENEMYBATTSTATUS3], a ld [wEnemyBattleStatus3], a
ld a, [wcf91] ld a, [wcf91]
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
callab LoadEnemyMonData callab LoadEnemyMonData

View file

@ -20,7 +20,7 @@ AnimateHallOfFame: ; 701a0 (1c:41a0)
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld [hTilesetType], a ld [hTilesetType], a
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
ld [wLetterPrintingDelayFlags], a ; no delay ld [wLetterPrintingDelayFlags], a ; no delay
ld [wHoFMonOrPlayer], a ; mon ld [wHoFMonOrPlayer], a ; mon
inc a inc a
@ -224,12 +224,12 @@ HoFDisplayPlayerStats: ; 70377 (1c:4377)
ld de, HoFPlayTimeText ld de, HoFPlayTimeText
call PlaceString call PlaceString
coord hl, 5, 7 coord hl, 5, 7
ld de, W_PLAYTIMEHOURS + 1 ld de, wPlayTimeHours + 1
lb bc, 1, 3 lb bc, 1, 3
call PrintNumber call PrintNumber
ld [hl], $6d ld [hl], $6d
inc hl inc hl
ld de, W_PLAYTIMEMINUTES + 1 ld de, wPlayTimeMinutes + 1
lb bc, LEADING_ZEROES | 1, 2 lb bc, LEADING_ZEROES | 1, 2
call PrintNumber call PrintNumber
coord hl, 1, 9 coord hl, 1, 9

View file

@ -7,7 +7,7 @@ GymStatues: ; 62419 (18:6419)
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
ld hl, .BadgeFlags ld hl, .BadgeFlags
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
.loop .loop
ld a, [hli] ld a, [hli]
@ -50,7 +50,7 @@ GymStatueText2: ; 62458 (18:6458)
PrintBenchGuyText: ; 6245d (18:645d) PrintBenchGuyText: ; 6245d (18:645d)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, BenchGuyTextPointers ld hl, BenchGuyTextPointers
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
.loop .loop
ld a, [hli] ld a, [hli]

View file

@ -4,7 +4,7 @@ PrintBookshelfText: ; fb50 (3:7b50)
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .noMatch jr nz, .noMatch
; facing up ; facing up
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld b, a ld b, a
aCoord 8, 7 aCoord 8, 7
ld c, a ld c, a
@ -78,7 +78,7 @@ IndigoPlateauStatues: ; fbbf (3:7bbf)
TX_ASM TX_ASM
ld hl, IndigoPlateauStatuesText1 ld hl, IndigoPlateauStatuesText1
call PrintText call PrintText
ld a, [W_XCOORD] ld a, [wXCoord]
bit 0, a bit 0, a
ld hl, IndigoPlateauStatuesText2 ld hl, IndigoPlateauStatuesText2
jr nz, .asm_fbd3 jr nz, .asm_fbd3
@ -102,7 +102,7 @@ IndigoPlateauStatuesText3: ; fbe3 (3:7be3)
BookOrSculptureText: ; fbe8 (3:7be8) BookOrSculptureText: ; fbe8 (3:7be8)
TX_ASM TX_ASM
ld hl, PokemonBooksText ld hl, PokemonBooksText
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
cp MANSION ; Celadon Mansion tileset cp MANSION ; Celadon Mansion tileset
jr nz, .asm_fbfd jr nz, .asm_fbfd
aCoord 8, 6 aCoord 8, 6

View file

@ -38,7 +38,7 @@ StrengthsAndWeaknessesText: ; 1e983 (7:6983)
SafariZoneCheck: ; 1e988 (7:6988) SafariZoneCheck: ; 1e988 (7:6988)
CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone, CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone,
jr z, SafariZoneGameStillGoing ; don't bother printing game over text jr z, SafariZoneGameStillGoing ; don't bother printing game over text
ld a, [W_NUMSAFARIBALLS] ld a, [wNumSafariBalls]
and a and a
jr z, SafariZoneGameOver jr z, SafariZoneGameOver
jr SafariZoneGameStillGoing jr SafariZoneGameStillGoing
@ -83,7 +83,7 @@ SafariZoneGameOver: ; 1e9b0 (7:69b0)
ld a, $3 ld a, $3
ld [wDestinationWarpID], a ld [wDestinationWarpID], a
ld a, $5 ld a, $5
ld [W_SAFARIZONEENTRANCECURSCRIPT], a ld [wSafariZoneEntranceCurScript], a
SetEvent EVENT_SAFARI_GAME_OVER SetEvent EVENT_SAFARI_GAME_OVER
ld a, 1 ld a, 1
ld [wSafariZoneGameOver], a ld [wSafariZoneGameOver], a
@ -97,7 +97,7 @@ PrintSafariGameOverText: ; 1e9ed (7:69ed)
SafariGameOverText: ; 1e9f7 (7:69f7) SafariGameOverText: ; 1e9f7 (7:69f7)
TX_ASM TX_ASM
ld a, [W_NUMSAFARIBALLS] ld a, [wNumSafariBalls]
and a and a
jr z, .asm_1ea04 jr z, .asm_1ea04
ld hl, TimesUpText ld hl, TimesUpText

View file

@ -108,7 +108,7 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07)
ld bc, wPartyMon2 - wPartyMon1 ld bc, wPartyMon2 - wPartyMon1
call AddNTimes call AddNTimes
ld a,[hl] ld a,[hl]
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
ld hl,wCompletedInGameTradeFlags ld hl,wCompletedInGameTradeFlags
ld a,[wWhichTrade] ld a,[wWhichTrade]
ld c,a ld c,a
@ -118,13 +118,13 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07)
call PrintText call PrintText
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
push af push af
ld a,[W_CURENEMYLVL] ld a,[wCurEnemyLVL]
push af push af
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
call InGameTrade_PrepareTradeData call InGameTrade_PrepareTradeData
predef InternalClockTradeAnim predef InternalClockTradeAnim
pop af pop af
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
pop af pop af
ld [wWhichPokemon],a ld [wWhichPokemon],a
ld a,[wInGameTradeReceiveMonSpecies] ld a,[wInGameTradeReceiveMonSpecies]

View file

@ -29,9 +29,9 @@ PlayIntroScene: ; 4169d (10:569d)
ld b, $3 ; Gengar tiles ld b, $3 ; Gengar tiles
call IntroCopyTiles call IntroCopyTiles
ld a, 0 ld a, 0
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, 80 ld a, 80
ld [W_BASECOORDY], a ld [wBaseCoordY], a
lb bc, 6, 6 lb bc, 6, 6
call InitIntroNidorinoOAM call InitIntroNidorinoOAM
lb de, 80 / 2, MOVE_NIDORINO_RIGHT lb de, 80 / 2, MOVE_NIDORINO_RIGHT
@ -141,10 +141,10 @@ AnimateIntroNidorino: ; 41793 (10:5793)
ld a, [de] ld a, [de]
cp $50 cp $50
ret z ret z
ld [W_BASECOORDY], a ld [wBaseCoordY], a
inc de inc de
ld a, [de] ld a, [de]
ld [W_BASECOORDX], a ld [wBaseCoordX], a
push de push de
ld c, 6 * 6 ld c, 6 * 6
call UpdateIntroNidorinoOAM call UpdateIntroNidorinoOAM
@ -159,10 +159,10 @@ UpdateIntroNidorinoOAM: ; 417ae (10:57ae)
ld a, [wIntroNidorinoBaseTile] ld a, [wIntroNidorinoBaseTile]
ld d, a ld d, a
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
add [hl] add [hl]
ld [hli], a ; Y ld [hli], a ; Y
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add [hl] add [hl]
ld [hli], a ; X ld [hli], a ; X
ld a, d ld a, d
@ -178,14 +178,14 @@ InitIntroNidorinoOAM: ; 417c7 (10:57c7)
ld d, 0 ld d, 0
.loop .loop
push bc push bc
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld e, a ld e, a
.innerLoop .innerLoop
ld a, e ld a, e
add 8 add 8
ld e, a ld e, a
ld [hli], a ; Y ld [hli], a ; Y
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld [hli], a ; X ld [hli], a ; X
ld a, d ld a, d
ld [hli], a ; tile ld [hli], a ; tile
@ -194,9 +194,9 @@ InitIntroNidorinoOAM: ; 417c7 (10:57c7)
inc d inc d
dec c dec c
jr nz, .innerLoop jr nz, .innerLoop
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add 8 add 8
ld [W_BASECOORDX], a ld [wBaseCoordX], a
pop bc pop bc
dec b dec b
jr nz, .loop jr nz, .loop
@ -245,9 +245,9 @@ IntroMoveMon: ; 4180e (10:580e)
.moveNidorinoRight .moveNidorinoRight
push de push de
ld a, 2 ld a, 2
ld [W_BASECOORDX], a ld [wBaseCoordX], a
xor a xor a
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld c, 6 * 6 ld c, 6 * 6
call UpdateIntroNidorinoOAM call UpdateIntroNidorinoOAM
pop de pop de
@ -312,7 +312,7 @@ PlayShootingStar: ; 4188a (10:588a)
call ClearScreen call ClearScreen
call DisableLCD call DisableLCD
xor a xor a
ld [W_CUROPPONENT], a ld [wCurOpponent], a
call IntroDrawBlackBars call IntroDrawBlackBars
call LoadIntroGraphics call LoadIntroGraphics
call EnableLCD call EnableLCD

View file

@ -3,7 +3,7 @@ HiddenItemNear: ; 7481f (1d:481f)
ld b, 0 ld b, 0
.loop .loop
ld de, 3 ld de, 3
ld a, [W_CURMAP] ld a, [wCurMap]
call IsInRestOfArray call IsInRestOfArray
ret nc ; return if current map has no hidden items ret nc ; return if current map has no hidden items
push bc push bc
@ -24,19 +24,19 @@ HiddenItemNear: ; 7481f (1d:481f)
inc hl inc hl
jr nz, .loop ; if the item has already been obtained jr nz, .loop ; if the item has already been obtained
; check if the item is within 4-5 tiles (depending on the direction of item) ; check if the item is within 4-5 tiles (depending on the direction of item)
ld a, [W_YCOORD] ld a, [wYCoord]
call Sub5ClampTo0 call Sub5ClampTo0
cp d cp d
jr nc, .loop jr nc, .loop
ld a, [W_YCOORD] ld a, [wYCoord]
add 4 add 4
cp d cp d
jr c, .loop jr c, .loop
ld a, [W_XCOORD] ld a, [wXCoord]
call Sub5ClampTo0 call Sub5ClampTo0
cp e cp e
jr nc, .loop jr nc, .loop
ld a, [W_XCOORD] ld a, [wXCoord]
add 5 add 5
cp e cp e
jr c, .loop jr c, .loop

View file

@ -103,7 +103,7 @@ ItemUsePtrTable: ; d5e1 (3:55e1)
ItemUseBall: ; d687 (3:5687) ItemUseBall: ; d687 (3:5687)
; Balls can't be used out of battle. ; Balls can't be used out of battle.
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp z,ItemUseNotTime jp z,ItemUseNotTime
@ -112,14 +112,14 @@ ItemUseBall: ; d687 (3:5687)
jp nz,ThrowBallAtTrainerMon jp nz,ThrowBallAtTrainerMon
; If this is for the old man battle, skip checking if the party & box are full. ; If this is for the old man battle, skip checking if the party & box are full.
ld a,[W_BATTLETYPE] ld a,[wBattleType]
dec a dec a
jr z,.canUseBall jr z,.canUseBall
ld a,[wPartyCount] ; is party full? ld a,[wPartyCount] ; is party full?
cp a,PARTY_LENGTH cp a,PARTY_LENGTH
jr nz,.canUseBall jr nz,.canUseBall
ld a,[W_NUMINBOX] ; is box full? ld a,[wNumInBox] ; is box full?
cp a,MONS_PER_BOX cp a,MONS_PER_BOX
jp z,BoxFullCannotThrowBall jp z,BoxFullCannotThrowBall
@ -127,12 +127,12 @@ ItemUseBall: ; d687 (3:5687)
xor a xor a
ld [wCapturedMonSpecies],a ld [wCapturedMonSpecies],a
ld a,[W_BATTLETYPE] ld a,[wBattleType]
cp a,BATTLE_TYPE_SAFARI cp a,BATTLE_TYPE_SAFARI
jr nz,.skipSafariZoneCode jr nz,.skipSafariZoneCode
.safariZone .safariZone
ld hl,W_NUMSAFARIBALLS ld hl,wNumSafariBalls
dec [hl] ; remove a Safari Ball dec [hl] ; remove a Safari Ball
.skipSafariZoneCode .skipSafariZoneCode
@ -151,12 +151,12 @@ ItemUseBall: ; d687 (3:5687)
ld b,$10 ; can't be caught value ld b,$10 ; can't be caught value
jp z,.setAnimData jp z,.setAnimData
ld a,[W_BATTLETYPE] ld a,[wBattleType]
dec a dec a
jr nz,.notOldManBattle jr nz,.notOldManBattle
.oldManBattle .oldManBattle
ld hl,W_GRASSRATE ld hl,wGrassRate
ld de,wPlayerName ld de,wPlayerName
ld bc,NAME_LENGTH ld bc,NAME_LENGTH
call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch) call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno. glitch)
@ -165,7 +165,7 @@ ItemUseBall: ; d687 (3:5687)
.notOldManBattle .notOldManBattle
; 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,[W_CURMAP] ld a,[wCurMap]
cp a,POKEMONTOWER_6 cp a,POKEMONTOWER_6
jr nz,.loop jr nz,.loop
ld a,[wEnemyMonSpecies2] ld a,[wEnemyMonSpecies2]
@ -420,7 +420,7 @@ ItemUseBall: ; d687 (3:5687)
; Do the animation. ; Do the animation.
ld a,TOSS_ANIM ld a,TOSS_ANIM
ld [W_ANIMATIONID],a ld [wAnimationID],a
xor a xor a
ld [H_WHOSETURN],a ld [H_WHOSETURN],a
ld [wAnimationType],a ld [wAnimationType],a
@ -470,7 +470,7 @@ ItemUseBall: ; d687 (3:5687)
; If the Pokémon is transformed, the Pokémon is assumed to be a Ditto. ; If the Pokémon is transformed, the Pokémon is assumed to be a Ditto.
; 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,W_ENEMYBATTSTATUS3 ld hl,wEnemyBattleStatus3
bit Transformed,[hl] bit Transformed,[hl]
jr z,.notTransformed jr z,.notTransformed
ld a,DITTO ld a,DITTO
@ -494,7 +494,7 @@ ItemUseBall: ; d687 (3:5687)
ld a,[wEnemyMonSpecies2] ld a,[wEnemyMonSpecies2]
ld [wcf91],a ld [wcf91],a
ld a,[wEnemyMonLevel] ld a,[wEnemyMonLevel]
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
callab LoadEnemyMonData callab LoadEnemyMonData
pop af pop af
ld [wcf91],a ld [wcf91],a
@ -510,7 +510,7 @@ ItemUseBall: ; d687 (3:5687)
ld [wCapturedMonSpecies],a ld [wCapturedMonSpecies],a
ld [wcf91],a ld [wcf91],a
ld [wd11e],a ld [wd11e],a
ld a,[W_BATTLETYPE] ld a,[wBattleType]
dec a ; is this the old man battle? dec a ; is this the old man battle?
jr z,.oldManCaughtMon ; if so, don't give the player the caught Pokémon jr z,.oldManCaughtMon ; if so, don't give the player the caught Pokémon
@ -573,7 +573,7 @@ ItemUseBall: ; d687 (3:5687)
call ClearSprites call ClearSprites
.done .done
ld a,[W_BATTLETYPE] ld a,[wBattleType]
and a ; is this the old man battle? and a ; is this the old man battle?
ret nz ; if so, don't remove a ball from the bag ret nz ; if so, don't remove a ball from the bag
@ -627,13 +627,13 @@ ItemUseBallText06: ; d961 (3:5961)
db "@" db "@"
ItemUseTownMap: ; d968 (3:5968) ItemUseTownMap: ; d968 (3:5968)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
jpba DisplayTownMap jpba DisplayTownMap
ItemUseBicycle: ; d977 (3:5977) ItemUseBicycle: ; d977 (3:5977)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld a,[wWalkBikeSurfState] ld a,[wWalkBikeSurfState]
@ -695,7 +695,7 @@ ItemUseSurfboard: ; d9b4 (3:59b4)
ld hl,TilePairCollisionsWater ld hl,TilePairCollisionsWater
call CheckForTilePairCollisions call CheckForTilePairCollisions
jr c,.cannotStopSurfing jr c,.cannotStopSurfing
ld hl,W_TILESETCOLLISIONPTR ; pointer to list of passable tiles ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ; hl now points to passable tiles ld l,a ; hl now points to passable tiles
@ -754,7 +754,7 @@ ItemUsePokedex: ; da56 (3:5a56)
predef_jump ShowPokedexMenu predef_jump ShowPokedexMenu
ItemUseEvoStone: ; da5b (3:5a5b) ItemUseEvoStone: ; da5b (3:5a5b)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
@ -795,7 +795,7 @@ ItemUseEvoStone: ; da5b (3:5a5b)
ret ret
ItemUseVitamin: ; dab4 (3:5ab4) ItemUseVitamin: ; dab4 (3:5ab4)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
@ -898,7 +898,7 @@ ItemUseMedicine: ; dabb (3:5abb)
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
push hl push hl
ld hl,W_PLAYERBATTSTATUS3 ld hl,wPlayerBattleStatus3
res BadlyPoisoned,[hl] ; heal Toxic status res BadlyPoisoned,[hl] ; heal Toxic status
pop hl pop hl
ld bc,wPartyMon1Stats - wPartyMon1Status ld bc,wPartyMon1Stats - wPartyMon1Status
@ -926,7 +926,7 @@ ItemUseMedicine: ; dabb (3:5abb)
jr z,.updateInBattleFaintedData jr z,.updateInBattleFaintedData
jp .healingItemNoEffect jp .healingItemNoEffect
.updateInBattleFaintedData .updateInBattleFaintedData
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr z,.compareCurrentHPToMaxHP jr z,.compareCurrentHPToMaxHP
push hl push hl
@ -1244,7 +1244,7 @@ ItemUseMedicine: ; dabb (3:5abb)
ret nz ; if so, return ret nz ; if so, return
call GBPalWhiteOut call GBPalWhiteOut
call z,RunDefaultPaletteCommand call z,RunDefaultPaletteCommand
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
ret nz ret nz
jp ReloadMapData jp ReloadMapData
@ -1256,7 +1256,7 @@ ItemUseMedicine: ; dabb (3:5abb)
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
ld [W_CURENEMYLVL],a ; store level ld [wCurEnemyLVL],a ; store level
call GetMonHeader call GetMonHeader
push de push de
ld a,d ld a,d
@ -1335,7 +1335,7 @@ ItemUseMedicine: ; dabb (3:5abb)
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
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
push hl push hl
push de push de
ld d,a ld d,a
@ -1454,7 +1454,7 @@ ItemUseRock: ; df67 (3:5f67)
ld de,wSafariBaitFactor ; bait factor ld de,wSafariBaitFactor ; bait factor
BaitRockCommon: ; df7f (3:5f7f) BaitRockCommon: ; df7f (3:5f7f)
ld [W_ANIMATIONID],a ld [wAnimationID],a
xor a xor a
ld [wAnimationType],a ld [wAnimationType],a
ld [H_WHOSETURN],a ld [H_WHOSETURN],a
@ -1486,13 +1486,13 @@ ThrewRockText: ; dfaa (3:5faa)
; also used for Dig out-of-battle effect ; also used for Dig out-of-battle effect
ItemUseEscapeRope: ; dfaf (3:5faf) ItemUseEscapeRope: ; dfaf (3:5faf)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr nz,.notUsable jr nz,.notUsable
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,AGATHAS_ROOM cp a,AGATHAS_ROOM
jr z,.notUsable jr z,.notUsable
ld a,[W_CURMAPTILESET] ld a,[wCurMapTileset]
ld b,a ld b,a
ld hl,EscapeRopeTilesets ld hl,EscapeRopeTilesets
.loop .loop
@ -1508,8 +1508,8 @@ ItemUseEscapeRope: ; dfaf (3:5faf)
res 4,[hl] res 4,[hl]
ResetEvent EVENT_IN_SAFARI_ZONE ResetEvent EVENT_IN_SAFARI_ZONE
xor a xor a
ld [W_NUMSAFARIBALLS],a ld [wNumSafariBalls],a
ld [W_SAFARIZONEENTRANCECURSCRIPT],a ld [wSafariZoneEntranceCurScript],a
inc a inc a
ld [wEscapedFromBattle],a ld [wEscapedFromBattle],a
ld [wActionResultOrTookBattleTurn],a ; item used ld [wActionResultOrTookBattleTurn],a ; item used
@ -1531,7 +1531,7 @@ ItemUseRepel: ; e003 (3:6003)
ld b,100 ld b,100
ItemUseRepelCommon: ; e005 (3:6005) ItemUseRepelCommon: ; e005 (3:6005)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld a,b ld a,b
@ -1540,10 +1540,10 @@ ItemUseRepelCommon: ; e005 (3:6005)
; handles X Accuracy item ; handles X Accuracy item
ItemUseXAccuracy: ; e013 (3:6013) ItemUseXAccuracy: ; e013 (3:6013)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp z,ItemUseNotTime jp z,ItemUseNotTime
ld hl,W_PLAYERBATTSTATUS2 ld hl,wPlayerBattleStatus2
set UsingXAccuracy,[hl] ; X Accuracy bit set UsingXAccuracy,[hl] ; X Accuracy bit
jp PrintItemUseTextAndRemoveItem jp PrintItemUseTextAndRemoveItem
@ -1568,7 +1568,7 @@ ItemUseCardKey: ; e022 (3:6022)
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld hl,CardKeyTable3 ld hl,CardKeyTable3
.next1 .next1
ld a,[W_CURMAP] ld a,[wCurMap]
ld b,a ld b,a
.loop .loop
ld a,[hli] ld a,[hli]
@ -1641,7 +1641,7 @@ CardKeyTable3: ; e0c4 (3:60c4)
db $ff db $ff
ItemUsePokedoll: ; e0cd (3:60cd) ItemUsePokedoll: ; e0cd (3:60cd)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
dec a dec a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld a,$01 ld a,$01
@ -1649,10 +1649,10 @@ ItemUsePokedoll: ; e0cd (3:60cd)
jp PrintItemUseTextAndRemoveItem jp PrintItemUseTextAndRemoveItem
ItemUseGuardSpec: ; e0dc (3:60dc) ItemUseGuardSpec: ; e0dc (3:60dc)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp z,ItemUseNotTime jp z,ItemUseNotTime
ld hl,W_PLAYERBATTSTATUS2 ld hl,wPlayerBattleStatus2
set ProtectedByMist,[hl] ; Mist bit set ProtectedByMist,[hl] ; Mist bit
jp PrintItemUseTextAndRemoveItem jp PrintItemUseTextAndRemoveItem
@ -1665,15 +1665,15 @@ ItemUseMaxRepel: ; e0f0 (3:60f0)
jp ItemUseRepelCommon jp ItemUseRepelCommon
ItemUseDireHit: ; e0f5 (3:60f5) ItemUseDireHit: ; e0f5 (3:60f5)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp z,ItemUseNotTime jp z,ItemUseNotTime
ld hl,W_PLAYERBATTSTATUS2 ld hl,wPlayerBattleStatus2
set GettingPumped,[hl] ; Focus Energy bit set GettingPumped,[hl] ; Focus Energy bit
jp PrintItemUseTextAndRemoveItem jp PrintItemUseTextAndRemoveItem
ItemUseXStat: ; e104 (3:6104) ItemUseXStat: ; e104 (3:6104)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr nz,.inBattle jr nz,.inBattle
call ItemUseNotTime call ItemUseNotTime
@ -1681,18 +1681,18 @@ ItemUseXStat: ; e104 (3:6104)
ld [wActionResultOrTookBattleTurn],a ; item not used ld [wActionResultOrTookBattleTurn],a ; item not used
ret ret
.inBattle .inBattle
ld hl,W_PLAYERMOVENUM ld hl,wPlayerMoveNum
ld a,[hli] ld a,[hli]
push af ; save [W_PLAYERMOVENUM] push af ; save [wPlayerMoveNum]
ld a,[hl] ld a,[hl]
push af ; save [W_PLAYERMOVEEFFECT] push af ; save [wPlayerMoveEffect]
push hl push hl
ld a,[wcf91] ld a,[wcf91]
sub a,X_ATTACK - ATTACK_UP1_EFFECT sub a,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
ld [W_PLAYERMOVENUM],a ld [wPlayerMoveNum],a
call LoadScreenTilesFromBuffer1 ; restore saved screen call LoadScreenTilesFromBuffer1 ; restore saved screen
call Delay3 call Delay3
xor a xor a
@ -1700,18 +1700,18 @@ ItemUseXStat: ; e104 (3:6104)
callba StatModifierUpEffect ; do stat increase move callba StatModifierUpEffect ; do stat increase move
pop hl pop hl
pop af pop af
ld [hld],a ; restore [W_PLAYERMOVEEFFECT] ld [hld],a ; restore [wPlayerMoveEffect]
pop af pop af
ld [hl],a ; restore [W_PLAYERMOVENUM] ld [hl],a ; restore [wPlayerMoveNum]
ret ret
ItemUsePokeflute: ; e140 (3:6140) ItemUsePokeflute: ; e140 (3:6140)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr nz,.inBattle jr nz,.inBattle
; if not in battle ; if not in battle
call ItemUseReloadOverworldData call ItemUseReloadOverworldData
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,ROUTE_12 cp a,ROUTE_12
jr nz,.notRoute12 jr nz,.notRoute12
CheckEvent EVENT_BEAT_ROUTE12_SNORLAX CheckEvent EVENT_BEAT_ROUTE12_SNORLAX
@ -1746,7 +1746,7 @@ ItemUsePokeflute: ; e140 (3:6140)
ld b,~SLP & $ff ld b,~SLP & $ff
ld hl,wPartyMon1Status ld hl,wPartyMon1Status
call WakeUpEntireParty call WakeUpEntireParty
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
dec a ; is it a trainer battle? dec a ; is it a trainer battle?
jr z,.skipWakingUpEnemyParty jr z,.skipWakingUpEnemyParty
; if it's a trainer battle ; if it's a trainer battle
@ -1838,7 +1838,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215)
TX_FAR _PlayedFluteHadEffectText TX_FAR _PlayedFluteHadEffectText
db $06 db $06
TX_ASM TX_ASM
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr nz,.done jr nz,.done
; play out-of-battle pokeflute music ; play out-of-battle pokeflute music
@ -1856,7 +1856,7 @@ PlayedFluteHadEffectText: ; e215 (3:6215)
jp TextScriptEnd ; end text jp TextScriptEnd ; end text
ItemUseCoinCase: ; e23a (3:623a) ItemUseCoinCase: ; e23a (3:623a)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld hl,CoinCaseNumCoinsText ld hl,CoinCaseNumCoinsText
@ -1913,11 +1913,11 @@ RodResponse: ; e28d (3:628d)
jr nz, .next jr nz, .next
; if yes, store level and species data ; if yes, store level and species data
ld a, 1 ld a, 1
ld [W_MOVEMISSED], a ld [wMoveMissed], a
ld a, b ; level ld a, b ; level
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ld a, c ; species ld a, c ; species
ld [W_CUROPPONENT], a ld [wCurOpponent], a
.next .next
ld hl, wWalkBikeSurfState ld hl, wWalkBikeSurfState
@ -1934,7 +1934,7 @@ RodResponse: ; e28d (3:628d)
; checks if fishing is possible and if so, runs initialization code common to all rods ; checks if fishing is possible and if so, runs initialization code common to all rods
; unsets carry if fishing is possible, sets carry if not ; unsets carry if fishing is possible, sets carry if not
FishingInit: ; e2b4 (3:62b4) FishingInit: ; e2b4 (3:62b4)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jr z,.notInBattle jr z,.notInBattle
scf ; can't fish during battle scf ; can't fish during battle
@ -1962,7 +1962,7 @@ ItemUseOaksParcel: ; e2de (3:62de)
jp ItemUseNotYoursToUse jp ItemUseNotYoursToUse
ItemUseItemfinder: ; e2e1 (3:62e1) ItemUseItemfinder: ; e2e1 (3:62e1)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
call ItemUseReloadOverworldData call ItemUseReloadOverworldData
@ -1990,7 +1990,7 @@ ItemfinderFoundNothingText: ; e312 (3:6312)
db "@" db "@"
ItemUsePPUp: ; e317 (3:6317) ItemUsePPUp: ; e317 (3:6317)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
@ -2195,7 +2195,7 @@ UnusableItem: ; e476 (3:6476)
jp ItemUseNotTime jp ItemUseNotTime
ItemUseTMHM: ; e479 (3:6479) ItemUseTMHM: ; e479 (3:6479)
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,ItemUseNotTime jp nz,ItemUseNotTime
ld a,[wcf91] ld a,[wcf91]
@ -2337,7 +2337,7 @@ ThrowBallAtTrainerMon: ; e58b (3:658b)
call LoadScreenTilesFromBuffer1 ; restore saved screen call LoadScreenTilesFromBuffer1 ; restore saved screen
call Delay3 call Delay3
ld a,TOSS_ANIM ld a,TOSS_ANIM
ld [W_ANIMATIONID],a ld [wAnimationID],a
predef MoveAnimation ; do animation predef MoveAnimation ; do animation
ld hl,ThrowBallAtTrainerMonText1 ld hl,ThrowBallAtTrainerMonText1
call PrintText call PrintText
@ -2687,7 +2687,7 @@ IsKeyItem_: ; e764 (3:6764)
INCLUDE "data/key_items.asm" INCLUDE "data/key_items.asm"
SendNewMonToBox: ; e7a4 (3:67a4) SendNewMonToBox: ; e7a4 (3:67a4)
ld de, W_NUMINBOX ld de, wNumInBox
ld a, [de] ld a, [de]
inc a inc a
ld [de], a ld [de], a
@ -2706,7 +2706,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
call GetMonHeader call GetMonHeader
ld hl, wBoxMonOT ld hl, wBoxMonOT
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
jr z, .asm_e7ee jr z, .asm_e7ee
dec a dec a
@ -2717,7 +2717,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
ld b, a ld b, a
.asm_e7db .asm_e7db
@ -2738,7 +2738,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld de, wBoxMonOT ld de, wBoxMonOT
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyData call CopyData
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
jr z, .asm_e82a jr z, .asm_e82a
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
@ -2751,7 +2751,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
ld b, a ld b, a
.asm_e817 .asm_e817
@ -2772,7 +2772,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld a, NAME_MON_SCREEN ld a, NAME_MON_SCREEN
ld [wNamingScreenType], a ld [wNamingScreenType], a
predef AskName predef AskName
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
jr z, .asm_e867 jr z, .asm_e867
ld hl, wBoxMons ld hl, wBoxMons
@ -2785,7 +2785,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld d, h ld d, h
ld e, l ld e, l
pop hl pop hl
ld a, [W_NUMINBOX] ld a, [wNumInBox]
dec a dec a
ld b, a ld b, a
.asm_e854 .asm_e854
@ -2816,7 +2816,7 @@ SendNewMonToBox: ; e7a4 (3:67a4)
ld [de], a ld [de], a
inc de inc de
push de push de
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
ld d, a ld d, a
callab CalcExperience callab CalcExperience
pop de pop de
@ -2856,12 +2856,12 @@ SendNewMonToBox: ; e7a4 (3:67a4)
; used for surfing and fishing ; used for surfing and fishing
; unsets carry if it is, sets carry if not ; unsets carry if it is, sets carry if not
IsNextTileShoreOrWater: ; e8b8 (3:68b8) IsNextTileShoreOrWater: ; e8b8 (3:68b8)
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld hl, WaterTilesets ld hl, WaterTilesets
ld de,1 ld de,1
call IsInArray call IsInArray
jr nc, .notShoreOrWater jr nc, .notShoreOrWater
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
cp SHIP_PORT ; Vermilion Dock tileset cp SHIP_PORT ; Vermilion Dock tileset
ld a, [wTileInFrontOfPlayer] ; tile in front of player ld a, [wTileInFrontOfPlayer] ; tile in front of player
jr z, .skipShoreTiles ; if it's the Vermilion Dock tileset jr z, .skipShoreTiles ; if it's the Vermilion Dock tileset
@ -2888,7 +2888,7 @@ ReadSuperRodData: ; e8ea (3:68ea)
; return e = 2 if no fish on this map ; return e = 2 if no fish on this map
; return e = 1 if a bite, bc = level,species ; return e = 1 if a bite, bc = level,species
; return e = 0 if no bite ; return e = 0 if no bite
ld a, [W_CURMAP] ld a, [wCurMap]
ld de, 3 ; each fishing group is three bytes wide ld de, 3 ; each fishing group is three bytes wide
ld hl, SuperRodData ld hl, SuperRodData
call IsInArray call IsInArray

View file

@ -3,7 +3,7 @@ CanLearnTM: ; 1373e (4:773e)
ld a, [wcf91] ld a, [wcf91]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld hl, W_MONHLEARNSET ld hl, wMonHLearnset
push hl push hl
ld a, [wMoveNum] ld a, [wMoveNum]
ld b, a ld b, a

View file

@ -53,7 +53,7 @@ DontAbandonLearning: ; 6e5b (1:6e5b)
pop de pop de
pop hl pop hl
ld [hl], a ld [hl], a
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
jp z, PrintLearnedMove jp z, PrintLearnedMove
ld a, [wWhichPokemon] ld a, [wWhichPokemon]

View file

@ -212,7 +212,7 @@ BillsPCDeposit: ; 215ac (8:55ac)
call PrintText call PrintText
jp BillsPCMenu jp BillsPCMenu
.partyLargeEnough .partyLargeEnough
ld a, [W_NUMINBOX] ld a, [wNumInBox]
cp MONS_PER_BOX cp MONS_PER_BOX
jr nz, .boxNotFull jr nz, .boxNotFull
ld hl, BoxFullText ld hl, BoxFullText
@ -254,7 +254,7 @@ BillsPCDeposit: ; 215ac (8:55ac)
jp BillsPCMenu jp BillsPCMenu
BillsPCWithdraw: ; 21618 (8:5618) BillsPCWithdraw: ; 21618 (8:5618)
ld a, [W_NUMINBOX] ld a, [wNumInBox]
and a and a
jr nz, .boxNotEmpty jr nz, .boxNotEmpty
ld hl, NoMonText ld hl, NoMonText
@ -268,7 +268,7 @@ BillsPCWithdraw: ; 21618 (8:5618)
call PrintText call PrintText
jp BillsPCMenu jp BillsPCMenu
.partyNotFull .partyNotFull
ld hl, W_NUMINBOX ld hl, wNumInBox
call DisplayMonListMenu call DisplayMonListMenu
jp c, BillsPCMenu jp c, BillsPCMenu
call DisplayDepositWithdrawMenu call DisplayDepositWithdrawMenu
@ -291,14 +291,14 @@ BillsPCWithdraw: ; 21618 (8:5618)
jp BillsPCMenu jp BillsPCMenu
BillsPCRelease: ; 21673 (8:5673) BillsPCRelease: ; 21673 (8:5673)
ld a, [W_NUMINBOX] ld a, [wNumInBox]
and a and a
jr nz, .loop jr nz, .loop
ld hl, NoMonText ld hl, NoMonText
call PrintText call PrintText
jp BillsPCMenu jp BillsPCMenu
.loop .loop
ld hl, W_NUMINBOX ld hl, wNumInBox
call DisplayMonListMenu call DisplayMonListMenu
jp c, BillsPCMenu jp c, BillsPCMenu
ld hl, OnceReleasedText ld hl, OnceReleasedText
@ -515,7 +515,7 @@ CableClubLeftGameboy:: ; 5824 (8:5825)
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
ret nz ret nz
ld a, [W_CURMAP] ld a, [wCurMap]
cp TRADE_CENTER cp TRADE_CENTER
ld a, LINK_STATE_START_TRADE ld a, LINK_STATE_START_TRADE
jr z, .next jr z, .next
@ -532,7 +532,7 @@ CableClubRightGameboy:: ; 5845 (8:5845)
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT
ret nz ret nz
ld a, [W_CURMAP] ld a, [wCurMap]
cp TRADE_CENTER cp TRADE_CENTER
ld a, LINK_STATE_START_TRADE ld a, LINK_STATE_START_TRADE
jr z, .next jr z, .next

View file

@ -10,7 +10,7 @@ PKMNLeaguePC: ; 0x7657e
push af push af
xor a xor a
ld [hTilesetType], a ld [hTilesetType], a
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld [wHoFTeamIndex2], a ld [wHoFTeamIndex2], a
ld [wHoFTeamNo], a ld [wHoFTeamNo], a

View file

@ -114,7 +114,7 @@ MainMenu: ; 5af2 (1:5af2)
ld a,[wNumHoFTeams] ld a,[wNumHoFTeams]
and a and a
jp z,SpecialEnterMap jp z,SpecialEnterMap
ld a,[W_CURMAP] ; map ID ld a,[wCurMap] ; map ID
cp a,HALL_OF_FAME cp a,HALL_OF_FAME
jp nz,SpecialEnterMap jp nz,SpecialEnterMap
xor a xor a
@ -128,7 +128,7 @@ InitOptions: ; 5bff (1:5bff)
ld a,1 ; no delay ld a,1 ; no delay
ld [wLetterPrintingDelayFlags],a ld [wLetterPrintingDelayFlags],a
ld a,3 ; medium speed ld a,3 ; medium speed
ld [W_OPTIONS],a ld [wOptions],a
ret ret
LinkMenu: ; 5c0a (1:5c0a) LinkMenu: ; 5c0a (1:5c0a)
@ -392,7 +392,7 @@ PrintSaveScreenText: ; 5def (1:5def)
PrintNumBadges: ; 5e2f (1:5e2f) PrintNumBadges: ; 5e2f (1:5e2f)
push hl push hl
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
ld b, $1 ld b, $1
call CountSetBits call CountSetBits
pop hl pop hl
@ -411,12 +411,12 @@ PrintNumOwnedMons: ; 5e42 (1:5e42)
jp PrintNumber jp PrintNumber
PrintPlayTime: ; 5e55 (1:5e55) PrintPlayTime: ; 5e55 (1:5e55)
ld de, W_PLAYTIMEHOURS + 1 ld de, wPlayTimeHours + 1
lb bc, 1, 3 lb bc, 1, 3
call PrintNumber call PrintNumber
ld [hl], $6d ld [hl], $6d
inc hl inc hl
ld de, W_PLAYTIMEMINUTES + 1 ld de, wPlayTimeMinutes + 1
lb bc, LEADING_ZEROES | 1, 2 lb bc, LEADING_ZEROES | 1, 2
jp PrintNumber jp PrintNumber
@ -626,13 +626,13 @@ SetOptionsFromCursorPositions: ; 601f (1:601f)
res 6,d res 6,d
.storeOptions .storeOptions
ld a,d ld a,d
ld [W_OPTIONS],a ld [wOptions],a
ret ret
; reads the options variable and places menu cursors in the correct positions within the options menu ; reads the options variable and places menu cursors in the correct positions within the options menu
SetCursorPositionsFromOptions: ; 604c (1:604c) SetCursorPositionsFromOptions: ; 604c (1:604c)
ld hl,TextSpeedOptionData + 1 ld hl,TextSpeedOptionData + 1
ld a,[W_OPTIONS] ld a,[wOptions]
ld c,a ld c,a
and a,$3f and a,$3f
push bc push bc

View file

@ -2,7 +2,7 @@ AskName: ; 64eb (1:64eb)
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
call GetPredefRegisters call GetPredefRegisters
push hl push hl
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
dec a dec a
coord hl, 0, 0 coord hl, 0, 0
ld b, 4 ld b, 4
@ -30,7 +30,7 @@ AskName: ; 64eb (1:64eb)
ld a, NAME_MON_SCREEN ld a, NAME_MON_SCREEN
ld [wNamingScreenType], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
jr nz, .inBattle jr nz, .inBattle
call ReloadMapSpriteTilePatterns call ReloadMapSpriteTilePatterns
@ -169,7 +169,7 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld [wAnimCounter], a ld [wAnimCounter], a
ld hl, wd730 ld hl, wd730
res 6, [hl] res 6, [hl]
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
jp z, LoadTextBoxTilePatterns jp z, LoadTextBoxTilePatterns
jpab LoadHudTilePatterns jpab LoadHudTilePatterns

View file

@ -78,7 +78,7 @@ GetPrizeMenuId: ; 5278e (14:678e)
ld e,a ld e,a
inc hl inc hl
push hl push hl
ld hl,W_PRIZE1 ld hl,wPrize1
call CopyString call CopyString
pop hl pop hl
ld a,[hli] ld a,[hli]
@ -90,34 +90,34 @@ GetPrizeMenuId: ; 5278e (14:678e)
ld a,[wWhichPrizeWindow] ld a,[wWhichPrizeWindow]
cp a,$02 ;is TM_menu? cp a,$02 ;is TM_menu?
jr nz,.putMonName jr nz,.putMonName
ld a,[W_PRIZE1] ld a,[wPrize1]
ld [wd11e],a ld [wd11e],a
call GetItemName call GetItemName
coord hl, 2, 4 coord hl, 2, 4
call PlaceString call PlaceString
ld a,[W_PRIZE2] ld a,[wPrize2]
ld [wd11e],a ld [wd11e],a
call GetItemName call GetItemName
coord hl, 2, 6 coord hl, 2, 6
call PlaceString call PlaceString
ld a,[W_PRIZE3] ld a,[wPrize3]
ld [wd11e],a ld [wd11e],a
call GetItemName call GetItemName
coord hl, 2, 8 coord hl, 2, 8
call PlaceString call PlaceString
jr .putNoThanksText jr .putNoThanksText
.putMonName .putMonName
ld a,[W_PRIZE1] ld a,[wPrize1]
ld [wd11e],a ld [wd11e],a
call GetMonName call GetMonName
coord hl, 2, 4 coord hl, 2, 4
call PlaceString call PlaceString
ld a,[W_PRIZE2] ld a,[wPrize2]
ld [wd11e],a ld [wd11e],a
call GetMonName call GetMonName
coord hl, 2, 6 coord hl, 2, 6
call PlaceString call PlaceString
ld a,[W_PRIZE3] ld a,[wPrize3]
ld [wd11e],a ld [wd11e],a
call GetMonName call GetMonName
coord hl, 2, 8 coord hl, 2, 8
@ -191,7 +191,7 @@ HandlePrizeChoice: ; 528c6 (14:68c6)
ld [wWhichPrize],a ld [wWhichPrize],a
ld d,0 ld d,0
ld e,a ld e,a
ld hl,W_PRIZE1 ld hl,wPrize1
add hl,de add hl,de
ld a,[hl] ld a,[hl]
ld [wd11e],a ld [wd11e],a
@ -300,7 +300,7 @@ GetPrizeMonLevel: ; 52977 (14:6977)
jr .loop jr .loop
.matchFound .matchFound
ld a,[hl] ld a,[hl]
ld [W_CURENEMYLVL],a ld [wCurEnemyLVL],a
ret ret
INCLUDE "data/prize_mon_levels.asm" INCLUDE "data/prize_mon_levels.asm"

View file

@ -117,7 +117,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
ld a,[W_OBTAINEDBADGES] ; badges obtained ld a,[wObtainedBadges] ; badges obtained
jp [hl] jp [hl]
.outOfBattleMovePointers .outOfBattleMovePointers
dw .cut dw .cut
@ -601,12 +601,12 @@ DrawTrainerInfo: ; 1349a (4:749a)
ld c,$e3 ld c,$e3
call PrintBCDNumber call PrintBCDNumber
coord hl, 9, 6 coord hl, 9, 6
ld de,W_PLAYTIMEHOURS + 1 ; hours ld de,wPlayTimeHours + 1 ; hours
lb bc, LEFT_ALIGN | 1, 3 lb bc, LEFT_ALIGN | 1, 3
call PrintNumber call PrintNumber
ld [hl],$d6 ; colon tile ID ld [hl],$d6 ; colon tile ID
inc hl inc hl
ld de,W_PLAYTIMEMINUTES + 1 ; minutes ld de,wPlayTimeMinutes + 1 ; minutes
lb bc, LEADING_ZEROES | 1, 2 lb bc, LEADING_ZEROES | 1, 2
jp PrintNumber jp PrintNumber

View file

@ -71,7 +71,7 @@ StatusScreen: ; 12953 (4:6953)
; mon is in a box or daycare ; mon is in a box or daycare
ld a, [wLoadedMonBoxLevel] ld a, [wLoadedMonBoxLevel]
ld [wLoadedMonLevel], a ld [wLoadedMonLevel], a
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ld hl, wLoadedMonHPExp - 1 ld hl, wLoadedMonHPExp - 1
ld de, wLoadedMonStats ld de, wLoadedMonStats
ld b, $1 ld b, $1
@ -138,7 +138,7 @@ StatusScreen: ; 12953 (4:6953)
call PlaceString ; "STATUS/" call PlaceString ; "STATUS/"
coord hl, 14, 2 coord hl, 14, 2
call PrintLevel ; Pokémon level call PrintLevel ; Pokémon level
ld a, [W_MONHINDEX] ld a, [wMonHIndex]
ld [wd11e], a ld [wd11e], a
ld [wd0b5], a ld [wd0b5], a
predef IndexToPokedex predef IndexToPokedex
@ -196,13 +196,13 @@ OTPointers: ; 12a95 (4:6a95)
dw wPartyMonOT dw wPartyMonOT
dw wEnemyMonOT dw wEnemyMonOT
dw wBoxMonOT dw wBoxMonOT
dw W_DAYCAREMONOT dw wDayCareMonOT
NamePointers2: ; 12a9d (4:6a9d) NamePointers2: ; 12a9d (4:6a9d)
dw wPartyMonNicks dw wPartyMonNicks
dw wEnemyMonNicks dw wEnemyMonNicks
dw wBoxMonNicks dw wBoxMonNicks
dw W_DAYCAREMONNAME dw wDayCareMonName
Type1Text: ; 12aa5 (4:6aa5) Type1Text: ; 12aa5 (4:6aa5)
db "TYPE1/", $4e db "TYPE1/", $4e
@ -417,7 +417,7 @@ StatusScreen2: ; 12b57 (4:6b57)
call StatusScreen_ClearName call StatusScreen_ClearName
coord hl, 9, 1 coord hl, 9, 1
call StatusScreen_ClearName call StatusScreen_ClearName
ld a, [W_MONHINDEX] ld a, [wMonHIndex]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
coord hl, 9, 1 coord hl, 9, 1

View file

@ -1,7 +1,7 @@
SetDefaultNames: ; 60ca (1:60ca) SetDefaultNames: ; 60ca (1:60ca)
ld a, [wLetterPrintingDelayFlags] ld a, [wLetterPrintingDelayFlags]
push af push af
ld a, [W_OPTIONS] ld a, [wOptions]
push af push af
ld a, [wd732] ld a, [wd732]
push af push af
@ -16,7 +16,7 @@ SetDefaultNames: ; 60ca (1:60ca)
pop af pop af
ld [wd732], a ld [wd732], a
pop af pop af
ld [W_OPTIONS], a ld [wOptions], a
pop af pop af
ld [wLetterPrintingDelayFlags], a ld [wLetterPrintingDelayFlags], a
ld a, [wOptionsInitialized] ld a, [wOptionsInitialized]
@ -27,7 +27,7 @@ SetDefaultNames: ; 60ca (1:60ca)
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyData call CopyData
ld hl, SonyText ld hl, SonyText
ld de, W_RIVALNAME ld de, wRivalName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
jp CopyData jp CopyData

View file

@ -40,11 +40,11 @@ ChooseRivalName: ; 69a4 (1:69a4)
jr z, .customName jr z, .customName
ld hl, DefaultNamesRivalList ld hl, DefaultNamesRivalList
call GetDefaultName call GetDefaultName
ld de, W_RIVALNAME ld de, wRivalName
call OakSpeechSlidePicLeft call OakSpeechSlidePicLeft
jr .done jr .done
.customName .customName
ld hl, W_RIVALNAME ld hl, wRivalName
ld a, NAME_RIVAL_SCREEN ld a, NAME_RIVAL_SCREEN
ld [wNamingScreenType], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen

View file

@ -1,6 +1,6 @@
PrintCardKeyText: ; 52673 (14:6673) PrintCardKeyText: ; 52673 (14:6673)
ld hl, SilphCoMapList ld hl, SilphCoMapList
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
.silphCoMapListLoop .silphCoMapListLoop
ld a, [hli] ld a, [hli]
@ -15,7 +15,7 @@ PrintCardKeyText: ; 52673 (14:6673)
cp $24 cp $24
jr z, .cardKeyDoorInFrontOfPlayer jr z, .cardKeyDoorInFrontOfPlayer
ld b, a ld b, a
ld a, [W_CURMAP] ld a, [wCurMap]
cp SILPH_CO_11F cp SILPH_CO_11F
ret nz ret nz
ld a, b ld a, b
@ -39,7 +39,7 @@ PrintCardKeyText: ; 52673 (14:6673)
ld a, e ld a, e
ld c, a ld c, a
ld [wCardKeyDoorX], a ld [wCardKeyDoorX], a
ld a, [W_CURMAP] ld a, [wCurMap]
cp SILPH_CO_11F cp SILPH_CO_11F
jr nz, .notSilphCo11F jr nz, .notSilphCo11F
ld a, $3 ld a, $3
@ -84,9 +84,9 @@ CardKeyFailText: ; 526f8 (14:66f8)
; d = Y ; d = Y
; e = X ; e = X
GetCoordsInFrontOfPlayer: ; 526fd (14:66fd) GetCoordsInFrontOfPlayer: ; 526fd (14:66fd)
ld a, [W_YCOORD] ld a, [wYCoord]
ld d, a ld d, a
ld a, [W_XCOORD] ld a, [wXCoord]
ld e, a ld e, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
and a and a

View file

@ -48,9 +48,9 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
.choseDomeFossil .choseDomeFossil
ld b, KABUTO ld b, KABUTO
.fossilSelected .fossilSelected
ld [W_FOSSILITEM], a ld [wFossilItem], a
ld a, b ld a, b
ld [W_FOSSILMON], a ld [wFossilMon], a
call LoadFossilItemAndMonName call LoadFossilItemAndMonName
ld hl, LabFossil_610ae ld hl, LabFossil_610ae
call PrintText call PrintText
@ -60,7 +60,7 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
jr nz, .cancelledGivingFossil jr nz, .cancelledGivingFossil
ld hl, LabFossil_610b3 ld hl, LabFossil_610b3
call PrintText call PrintText
ld a, [W_FOSSILITEM] ld a, [wFossilItem]
ld [hItemToRemoveID], a ld [hItemToRemoveID], a
callba RemoveItemByID callba RemoveItemByID
ld hl, LabFossil_610b8 ld hl, LabFossil_610b8
@ -113,11 +113,11 @@ PrintFossilsInBag: ; 610c2 (18:50c2)
; loads the names of the fossil item and the resulting mon ; loads the names of the fossil item and the resulting mon
LoadFossilItemAndMonName: ; 610eb (18:50eb) LoadFossilItemAndMonName: ; 610eb (18:50eb)
ld a, [W_FOSSILMON] ld a, [wFossilMon]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
call CopyStringToCF4B call CopyStringToCF4B
ld a, [W_FOSSILITEM] ld a, [wFossilItem]
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
ret ret

View file

@ -1,7 +1,7 @@
UsedCut: ; ef54 (3:6f54) UsedCut: ; ef54 (3:6f54)
xor a xor a
ld [wActionResultOrTookBattleTurn], a ; initialise to failure value ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
and a ; OVERWORLD and a ; OVERWORLD
jr z, .overworld jr z, .overworld
cp GYM cp GYM
@ -177,7 +177,7 @@ ReplaceTreeTileBlock: ; f09f (3:709f)
; player (i.e. where the tree is) and replace it with the corresponding tile ; player (i.e. where the tree is) and replace it with the corresponding tile
; block that doesn't have the tree. ; block that doesn't have the tree.
push de push de
ld a, [W_CURMAPWIDTH] ld a, [wCurMapWidth]
add 6 add 6
ld c, a ld c, a
ld b, 0 ld b, 0
@ -195,22 +195,22 @@ ReplaceTreeTileBlock: ; f09f (3:709f)
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT
jr z, .left jr z, .left
; right ; right
ld a, [W_XBLOCKCOORD] ld a, [wXBlockCoord]
and a and a
jr z, .centerTileBlock jr z, .centerTileBlock
jr .rightOfCenter jr .rightOfCenter
.down .down
ld a, [W_YBLOCKCOORD] ld a, [wYBlockCoord]
and a and a
jr z, .centerTileBlock jr z, .centerTileBlock
jr .belowCenter jr .belowCenter
.up .up
ld a, [W_YBLOCKCOORD] ld a, [wYBlockCoord]
and a and a
jr z, .aboveCenter jr z, .aboveCenter
jr .centerTileBlock jr .centerTileBlock
.left .left
ld a, [W_XBLOCKCOORD] ld a, [wXBlockCoord]
and a and a
jr z, .leftOfCenter jr z, .leftOfCenter
jr .centerTileBlock jr .centerTileBlock

View file

@ -2,7 +2,7 @@
IsPlayerStandingOnDoorTile: ; 1a609 (6:6609) IsPlayerStandingOnDoorTile: ; 1a609 (6:6609)
push de push de
ld hl, DoorTileIDPointers ld hl, DoorTileIDPointers
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld de, $3 ld de, $3
call IsInArray call IsInArray
pop de pop de

View file

@ -135,7 +135,7 @@ FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857)
ld d, a ld d, a
ld a, [wHiddenObjectX] ld a, [wHiddenObjectX]
ld e, a ld e, a
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
ld c, -1 ld c, -1
.loop .loop

View file

@ -29,7 +29,7 @@ CheckForHiddenObject: ; 469a0 (11:69a0)
ld b, a ld b, a
cp $ff cp $ff
jr z, .noMatch jr z, .noMatch
ld a, [W_CURMAP] ld a, [wCurMap]
cp b cp b
jr z, .foundMatchingMap jr z, .foundMatchingMap
inc de inc de
@ -95,30 +95,30 @@ CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
jr z, .facingRight jr z, .facingRight
; facing down ; facing down
ld a, [W_YCOORD] ld a, [wYCoord]
inc a inc a
jr .upDownCommon jr .upDownCommon
.facingUp .facingUp
ld a, [W_YCOORD] ld a, [wYCoord]
dec a dec a
.upDownCommon .upDownCommon
cp b cp b
jr nz, .didNotMatch jr nz, .didNotMatch
ld a, [W_XCOORD] ld a, [wXCoord]
cp c cp c
jr nz, .didNotMatch jr nz, .didNotMatch
jr .matched jr .matched
.facingLeft .facingLeft
ld a, [W_XCOORD] ld a, [wXCoord]
dec a dec a
jr .leftRightCommon jr .leftRightCommon
.facingRight .facingRight
ld a, [W_XCOORD] ld a, [wXCoord]
inc a inc a
.leftRightCommon .leftRightCommon
cp c cp c
jr nz, .didNotMatch jr nz, .didNotMatch
ld a, [W_YCOORD] ld a, [wYCoord]
cp b cp b
jr nz, .didNotMatch jr nz, .didNotMatch
.matched .matched

View file

@ -1,13 +1,13 @@
; returns whether the player is one tile outside the map in Z ; returns whether the player is one tile outside the map in Z
IsPlayerJustOutsideMap: ; 128d8 (4:68d8) IsPlayerJustOutsideMap: ; 128d8 (4:68d8)
ld a, [W_YCOORD] ld a, [wYCoord]
ld b, a ld b, a
ld a, [W_CURMAPHEIGHT] ld a, [wCurMapHeight]
call .compareCoordWithMapDimension call .compareCoordWithMapDimension
ret z ret z
ld a, [W_XCOORD] ld a, [wXCoord]
ld b, a ld b, a
ld a, [W_CURMAPWIDTH] ld a, [wCurMapWidth]
.compareCoordWithMapDimension .compareCoordWithMapDimension
add a add a
cp b cp b

View file

@ -3,7 +3,7 @@ PickUpItem:
ld a, [hSpriteIndexOrTextID] ld a, [hSpriteIndexOrTextID]
ld b, a ld b, a
ld hl, W_MISSABLEOBJECTLIST ld hl, wMissableObjectList
.missableObjectsListLoop .missableObjectsListLoop
ld a, [hli] ld a, [hli]
cp $ff cp $ff
@ -17,7 +17,7 @@ PickUpItem:
ld a, [hl] ld a, [hl]
ld [$ffdb], a ld [$ffdb], a
ld hl, W_MAPSPRITEEXTRADATA ld hl, wMapSpriteExtraData
ld a, [hSpriteIndexOrTextID] ld a, [hSpriteIndexOrTextID]
dec a dec a
add a add a

View file

@ -2,7 +2,7 @@ HandleLedges: ; 1a672 (6:6672)
ld a, [wd736] ld a, [wd736]
bit 6, a ; already jumping down ledge bit 6, a ; already jumping down ledge
ret nz ret nz
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
and a ; OVERWORLD and a ; OVERWORLD
ret nz ret nz
predef GetTileAndCoordsInFrontOfPlayer predef GetTileAndCoordsInFrontOfPlayer

View file

@ -30,12 +30,12 @@ InitMapSprites: ; 1785b (5:785b)
; InitOutsideMapSprites. ; InitOutsideMapSprites.
; Loads tile pattern data for sprites into VRAM. ; Loads tile pattern data for sprites into VRAM.
LoadMapSpriteTilePatterns: ; 17871 (5:7871) LoadMapSpriteTilePatterns: ; 17871 (5:7871)
ld a,[W_NUMSPRITES] ld a,[wNumSprites]
and a ; are there any sprites? and a ; are there any sprites?
jr nz,.spritesExist jr nz,.spritesExist
ret ret
.spritesExist .spritesExist
ld c,a ; c = [W_NUMSPRITES] ld c,a ; c = [wNumSprites]
ld b,$10 ; number of sprite slots ld b,$10 ; number of sprite slots
ld hl,wSpriteStateData2 + $0d ld hl,wSpriteStateData2 + $0d
xor a xor a
@ -251,7 +251,7 @@ ReadSpriteSheetData: ; 17971 (5:7971)
; Loads sprite set for outside maps (cities and routes) and sets VRAM slots. ; Loads sprite set for outside maps (cities and routes) and sets VRAM slots.
; 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: ; 1797b (5:797b) InitOutsideMapSprites: ; 1797b (5:797b)
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)? cp a,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
@ -267,12 +267,12 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld a,[wFontLoaded] ld a,[wFontLoaded]
bit 0,a ; reloading upper half of tile patterns after displaying text? bit 0,a ; reloading upper half of tile patterns after displaying text?
jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set
ld a,[W_SPRITESETID] ld a,[wSpriteSetID]
cp b ; has the sprite set ID changed? cp b ; has the sprite set ID changed?
jr z,.skipLoadingSpriteSet ; if not, don't load it again jr z,.skipLoadingSpriteSet ; if not, don't load it again
.loadSpriteSet .loadSpriteSet
ld a,b ld a,b
ld [W_SPRITESETID],a ld [wSpriteSetID],a
dec a dec a
ld b,a ld b,a
sla a sla a
@ -291,7 +291,7 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld hl,wSpriteStateData2 + $0d ld hl,wSpriteStateData2 + $0d
ld a,SPRITE_RED ld a,SPRITE_RED
ld [hl],a ld [hl],a
ld bc,W_SPRITESET ld bc,wSpriteSet
; Load the sprite set into RAM. ; Load the sprite set into RAM.
; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A ; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A
; with picture ID's. This is done so that LoadMapSpriteTilePatterns will ; with picture ID's. This is done so that LoadMapSpriteTilePatterns will
@ -317,13 +317,13 @@ InitOutsideMapSprites: ; 1797b (5:797b)
ld [hl],a ; $C2XD (sprite picture ID) ld [hl],a ; $C2XD (sprite picture ID)
dec b dec b
jr nz,.zeroRemainingSlotsLoop jr nz,.zeroRemainingSlotsLoop
ld a,[W_NUMSPRITES] ld a,[wNumSprites]
push af ; save number of sprites push af ; save number of sprites
ld a,11 ; 11 sprites in sprite set ld a,11 ; 11 sprites in sprite set
ld [W_NUMSPRITES],a ld [wNumSprites],a
call LoadMapSpriteTilePatterns call LoadMapSpriteTilePatterns
pop af pop af
ld [W_NUMSPRITES],a ; restore number of sprites ld [wNumSprites],a ; restore number of sprites
ld hl,wSpriteStateData2 + $1e ld hl,wSpriteStateData2 + $1e
ld b,$0f ld b,$0f
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the ; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
@ -352,7 +352,7 @@ InitOutsideMapSprites: ; 1797b (5:797b)
and a ; is the sprite slot used? and a ; is the sprite slot used?
jr z,.skipGettingPictureIndex ; if the sprite slot is not used jr z,.skipGettingPictureIndex ; if the sprite slot is not used
ld b,a ; b = picture ID ld b,a ; b = picture ID
ld de,W_SPRITESET ld de,wSpriteSet
; Loop to find the index of the sprite's picture ID within the sprite set. ; Loop to find the index of the sprite's picture ID within the sprite set.
.getPictureIndexLoop .getPictureIndexLoop
inc c inc c
@ -399,10 +399,10 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
ld b,a ld b,a
jr z,.eastWestDivide jr z,.eastWestDivide
.northSouthDivide .northSouthDivide
ld a,[W_YCOORD] ld a,[wYCoord]
jr .compareCoord jr .compareCoord
.eastWestDivide .eastWestDivide
ld a,[W_XCOORD] ld a,[wXCoord]
.compareCoord .compareCoord
cp b cp b
jr c,.loadSpriteSetID jr c,.loadSpriteSetID
@ -415,7 +415,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
; Route 20 is a special case because the two map sections have a more complex ; 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. ; shape instead of the map simply being split horizontally or vertically.
.route20 .route20
ld hl,W_XCOORD ld hl,wXCoord
ld a,[hl] ld a,[hl]
cp a,$2b cp a,$2b
ld a,$01 ld a,$01
@ -430,7 +430,7 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
jr nc,.next jr nc,.next
ld b,$0d ld b,$0d
.next .next
ld a,[W_YCOORD] ld a,[wYCoord]
cp b cp b
ld a,$0a ld a,$0a
ret c ret c

View file

@ -89,7 +89,7 @@ UpdatePlayerSprite: ; 4e31 (1:4e31)
; bit set by later logic. ; bit set by later logic.
ld a, [hTilePlayerStandingOn] ld a, [hTilePlayerStandingOn]
ld c, a ld c, a
ld a, [W_GRASSTILE] ld a, [wGrassTile]
cp c cp c
ld a, $0 ld a, $0
jr nz, .next2 jr nz, .next2
@ -114,7 +114,7 @@ UpdateNPCSprite: ; 4ed1 (1:4ed1)
swap a swap a
dec a dec a
add a add a
ld hl, W_MAPSPRITEDATA ld hl, wMapSpriteData
add l add l
ld l, a ld l, a
ld a, [hl] ; read movement byte 2 ld a, [hl] ; read movement byte 2
@ -453,7 +453,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd)
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $4 add $4
ld l, a ld l, a
ld a, [W_YCOORD] ld a, [wYCoord]
ld b, a ld b, a
ld a, [hl] ; c2x4 (Y position + 4) ld a, [hl] ; c2x4 (Y position + 4)
sub b ; relative to player position sub b ; relative to player position
@ -462,7 +462,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd)
dec h dec h
ld [hli], a ; c1x4 (screen Y position) ld [hli], a ; c1x4 (screen Y position)
inc h inc h
ld a, [W_XCOORD] ld a, [wXCoord]
ld b, a ld b, a
ld a, [hli] ; c2x6 (X position + 4) ld a, [hli] ; c2x6 (X position + 4)
sub b ; relative to player position sub b ; relative to player position
@ -488,7 +488,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
add $4 add $4
ld l, a ld l, a
ld b, [hl] ; c2x4: Y pos (+4) ld b, [hl] ; c2x4: Y pos (+4)
ld a, [W_YCOORD] ld a, [wYCoord]
cp b cp b
jr z, .skipYVisibilityTest jr z, .skipYVisibilityTest
jr nc, .spriteInvisible ; above screen region jr nc, .spriteInvisible ; above screen region
@ -498,7 +498,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
.skipYVisibilityTest .skipYVisibilityTest
inc l inc l
ld b, [hl] ; c2x5: X pos (+4) ld b, [hl] ; c2x5: X pos (+4)
ld a, [W_XCOORD] ld a, [wXCoord]
cp b cp b
jr z, .skipXVisibilityTest jr z, .skipXVisibilityTest
jr nc, .spriteInvisible ; left of screen region jr nc, .spriteInvisible ; left of screen region
@ -542,7 +542,7 @@ CheckSpriteAvailability: ; 50dc (1:50dc)
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $7 add $7
ld l, a ld l, a
ld a, [W_GRASSTILE] ld a, [wGrassTile]
cp c cp c
ld a, $0 ld a, $0
jr nz, .notInGrass jr nz, .notInGrass
@ -590,9 +590,9 @@ CanWalkOntoTile: ; 516e (1:516e)
and a and a
ret ret
.notScripted .notScripted
ld a, [W_TILESETCOLLISIONPTR] ld a, [wTileSetCollisionPtr]
ld l, a ld l, a
ld a, [W_TILESETCOLLISIONPTR+1] ld a, [wTileSetCollisionPtr+1]
ld h, a ld h, a
.tilePassableLoop .tilePassableLoop
ld a, [hli] ld a, [hli]

View file

@ -52,7 +52,7 @@ PalletMovementScriptPointerTable: ; 1a442 (6:6442)
dw PalletMovementScript_Done dw PalletMovementScript_Done
PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c) PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
ld a, [W_XCOORD] ld a, [wXCoord]
sub $a sub $a
ld [wNumStepsToTake], a ld [wNumStepsToTake], a
jr z, .playerOnLeftTile jr z, .playerOnLeftTile
@ -79,7 +79,7 @@ PalletMovementScript_OakMoveLeft: ; 1a44c (6:644c)
ld a, $3 ld a, $3
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
.done .done
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
set 1, [hl] set 1, [hl]
ld a, $fc ld a, $fc
ld [wJoyIgnore], a ld [wJoyIgnore], a
@ -267,7 +267,7 @@ RLEList_PewterGymGuy: ; 1a5da (6:65da)
db $FF db $FF
FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7) FreezeEnemyTrainerSprite: ; 1a5e7 (6:65e7)
ld a, [W_CURMAP] ld a, [wCurMap]
cp POKEMONTOWER_7 cp POKEMONTOWER_7
ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them ret z ; the Rockets on Pokemon Tower 7F leave after battling, so don't freeze them
ld hl, RivalIDs ld hl, RivalIDs

View file

@ -17,9 +17,9 @@ PewterGuys: ; 37ca1 (d:7ca1)
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [W_YCOORD] ld a, [wYCoord]
ld b, a ld b, a
ld a, [W_XCOORD] ld a, [wXCoord]
ld c, a ld c, a
.findMatchingCoordsLoop .findMatchingCoordsLoop
ld a, [hli] ld a, [hli]

View file

@ -5,7 +5,7 @@ EnterMapAnim: ; 70510 (1c:4510)
call Delay3 call Delay3
push hl push hl
call GBFadeInFromWhite call GBFadeInFromWhite
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
bit 7, [hl] ; used fly out of battle? bit 7, [hl] ; used fly out of battle?
res 7, [hl] res 7, [hl]
jr nz, .flyAnimation jr nz, .flyAnimation
@ -350,7 +350,7 @@ GetPlayerTeleportAnimFrameDelay: ; 7077f (1c:477f)
IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787) IsPlayerStandingOnWarpPadOrHole: ; 70787 (1c:4787)
ld b, 0 ld b, 0
ld hl, .warpPadAndHoleData ld hl, .warpPadAndHoleData
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld c, a ld c, a
.loop .loop
ld a, [hli] ld a, [hli]

View file

@ -291,7 +291,7 @@ CheckSpriteCanSeePlayer: ; 569af (15:69af)
; tests if the player is in front of the sprite (rather than behind it) ; tests if the player is in front of the sprite (rather than behind it)
CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3) CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3)
ld a, [W_CURMAP] ld a, [wCurMap]
cp POWER_PLANT cp POWER_PLANT
jp z, .engage ; bypass this for power plant to get voltorb fake items to work jp z, .engage ; bypass this for power plant to get voltorb fake items to work
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]

View file

@ -30,11 +30,11 @@ SetPal_Battle: ; 71e06 (1c:5e06)
ld de, wPalPacket ld de, wPalPacket
ld bc, $10 ld bc, $10
call CopyData call CopyData
ld a, [W_PLAYERBATTSTATUS3] ld a, [wPlayerBattleStatus3]
ld hl, wBattleMonSpecies ld hl, wBattleMonSpecies
call DeterminePaletteID call DeterminePaletteID
ld b, a ld b, a
ld a, [W_ENEMYBATTSTATUS3] ld a, [wEnemyBattleStatus3]
ld hl, wEnemyMonSpecies2 ld hl, wEnemyMonSpecies2
call DeterminePaletteID call DeterminePaletteID
ld c, a ld c, a
@ -139,12 +139,12 @@ SetPal_Overworld: ; 71ec7 (1c:5ec7)
ld de, wPalPacket ld de, wPalPacket
ld bc, $10 ld bc, $10
call CopyData call CopyData
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
cp CEMETERY cp CEMETERY
jr z, .PokemonTowerOrAgatha jr z, .PokemonTowerOrAgatha
cp CAVERN cp CAVERN
jr z, .caveOrBruno jr z, .caveOrBruno
ld a, [W_CURMAP] ld a, [wCurMap]
cp REDS_HOUSE_1F cp REDS_HOUSE_1F
jr c, .townOrRoute jr c, .townOrRoute
cp UNKNOWN_DUNGEON_2 cp UNKNOWN_DUNGEON_2
@ -207,7 +207,7 @@ SetPal_TrainerCard: ; 71f3b (1c:5f3b)
call CopyData call CopyData
ld de, BadgeBlkDataLengths ld de, BadgeBlkDataLengths
ld hl, wTrainerCardBlkPacket + 2 ld hl, wTrainerCardBlkPacket + 2
ld a, [W_OBTAINEDBADGES] ld a, [wObtainedBadges]
ld c, 8 ld c, 8
.badgeLoop .badgeLoop
srl a srl a

View file

@ -3,37 +3,37 @@ TrackPlayTime: ; 18dee (6:4dee)
ld a, [wd732] ld a, [wd732]
bit 0, a bit 0, a
ret z ret z
ld a, [W_PLAYTIMEMINUTES] ld a, [wPlayTimeMinutes]
and a and a
ret nz ret nz
ld a, [W_PLAYTIMEFRAMES] ld a, [wPlayTimeFrames]
inc a inc a
ld [W_PLAYTIMEFRAMES], a ld [wPlayTimeFrames], a
cp 60 cp 60
ret nz ret nz
xor a xor a
ld [W_PLAYTIMEFRAMES], a ld [wPlayTimeFrames], a
ld a, [W_PLAYTIMESECONDS] ld a, [wPlayTimeSeconds]
inc a inc a
ld [W_PLAYTIMESECONDS], a ld [wPlayTimeSeconds], a
cp 60 cp 60
ret nz ret nz
xor a xor a
ld [W_PLAYTIMESECONDS], a ld [wPlayTimeSeconds], a
ld a, [W_PLAYTIMEMINUTES + 1] ld a, [wPlayTimeMinutes + 1]
inc a inc a
ld [W_PLAYTIMEMINUTES + 1], a ld [wPlayTimeMinutes + 1], a
cp 60 cp 60
ret nz ret nz
xor a xor a
ld [W_PLAYTIMEMINUTES + 1], a ld [wPlayTimeMinutes + 1], a
ld a, [W_PLAYTIMEHOURS + 1] ld a, [wPlayTimeHours + 1]
inc a inc a
ld [W_PLAYTIMEHOURS + 1], a ld [wPlayTimeHours + 1], a
cp $ff cp $ff
ret nz ret nz
ld a, $ff ld a, $ff
ld [W_PLAYTIMEMINUTES], a ld [wPlayTimeMinutes], a
ret ret
CountDownIgnoreInputBitReset: ; 18e36 (6:4e36) CountDownIgnoreInputBitReset: ; 18e36 (6:4e36)

View file

@ -8,8 +8,8 @@ SetPartyMonTypes: ; 5db5e (17:5b5e)
push hl push hl
call GetMonHeader call GetMonHeader
pop hl pop hl
ld a, [W_MONHTYPE1] ld a, [wMonHType1]
ld [hli], a ld [hli], a
ld a, [W_MONHTYPE2] ld a, [wMonHType2]
ld [hl], a ld [hl], a
ret ret

View file

@ -63,7 +63,7 @@ LoadSAV0: ; 73623 (1c:7623)
ld de, wMainDataStart ld de, wMainDataStart
ld bc, wMainDataEnd - wMainDataStart ld bc, wMainDataEnd - wMainDataStart
call CopyData call CopyData
ld hl, W_CURMAPTILESET ld hl, wCurMapTileset
set 7, [hl] set 7, [hl]
ld hl, sSpriteData ld hl, sSpriteData
ld de, wSpriteDataStart ld de, wSpriteDataStart
@ -369,7 +369,7 @@ ChangeBox:: ; 738a1 (1c:78a1)
call GetBoxSRAMLocation call GetBoxSRAMLocation
ld de, wBoxDataStart ld de, wBoxDataStart
call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM
ld hl, W_MAPTEXTPTR ld hl, wMapTextPtr
ld de, wChangeBoxSavedMapTextPointer ld de, wChangeBoxSavedMapTextPointer
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -580,7 +580,7 @@ GetMonCountsForAllBoxes: ; 73a84 (1c:7a84)
ld c, a ld c, a
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld a, [W_NUMINBOX] ld a, [wNumInBox]
ld [hl], a ld [hl], a
ret ret

View file

@ -758,7 +758,7 @@ SlotMachine_AnimWheel1: ; 37813 (d:7813)
ld de, wSlotMachineWheel1Offset ld de, wSlotMachineWheel1Offset
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld a, $30 ld a, $30
ld [W_BASECOORDX], a ld [wBaseCoordX], a
jr SlotMachine_AnimWheel jr SlotMachine_AnimWheel
SlotMachine_AnimWheel2: ; 37823 (d:7823) SlotMachine_AnimWheel2: ; 37823 (d:7823)
@ -766,7 +766,7 @@ SlotMachine_AnimWheel2: ; 37823 (d:7823)
ld de, wSlotMachineWheel2Offset ld de, wSlotMachineWheel2Offset
ld hl, wOAMBuffer + $30 ld hl, wOAMBuffer + $30
ld a, $50 ld a, $50
ld [W_BASECOORDX], a ld [wBaseCoordX], a
jr SlotMachine_AnimWheel jr SlotMachine_AnimWheel
SlotMachine_AnimWheel3: ; 37833 (d:7833) SlotMachine_AnimWheel3: ; 37833 (d:7833)
@ -774,11 +774,11 @@ SlotMachine_AnimWheel3: ; 37833 (d:7833)
ld de, wSlotMachineWheel3Offset ld de, wSlotMachineWheel3Offset
ld hl, wOAMBuffer + $60 ld hl, wOAMBuffer + $60
ld a, $70 ld a, $70
ld [W_BASECOORDX], a ld [wBaseCoordX], a
SlotMachine_AnimWheel: ; 37841 (d:7841) SlotMachine_AnimWheel: ; 37841 (d:7841)
ld a, $58 ld a, $58
ld [W_BASECOORDY], a ld [wBaseCoordY], a
push de push de
ld a, [de] ld a, [de]
ld d, b ld d, b
@ -787,17 +787,17 @@ SlotMachine_AnimWheel: ; 37841 (d:7841)
jr nc, .loop jr nc, .loop
inc d inc d
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
ld [hli], a ld [hli], a
ld a, [de] ld a, [de]
ld [hli], a ld [hli], a
ld a, $80 ld a, $80
ld [hli], a ld [hli], a
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add $8 add $8
ld [hli], a ld [hli], a
ld a, [de] ld a, [de]
@ -806,9 +806,9 @@ SlotMachine_AnimWheel: ; 37841 (d:7841)
ld a, $80 ld a, $80
ld [hli], a ld [hli], a
inc de inc de
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
sub $8 sub $8
ld [W_BASECOORDY], a ld [wBaseCoordY], a
cp $28 cp $28
jr nz, .loop jr nz, .loop
pop de pop de

View file

@ -8,7 +8,7 @@ SetDefaultNamesBeforeTitlescreen: ; 42b7 (1:42b7)
ld de, wPlayerName ld de, wPlayerName
call CopyFixedLengthText call CopyFixedLengthText
ld hl, SonyText ld hl, SonyText
ld de, W_RIVALNAME ld de, wRivalName
call CopyFixedLengthText call CopyFixedLengthText
xor a xor a
ld [hWY], a ld [hWY], a

View file

@ -7,7 +7,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
push hl push hl
ld a, $1 ld a, $1
ld [hJoy7], a ld [hJoy7], a
ld a, [W_CURMAP] ld a, [wCurMap]
push af push af
ld b, $0 ld b, $0
call DrawPlayerOrBirdSprite ; player sprite call DrawPlayerOrBirdSprite ; player sprite
@ -156,7 +156,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
coord hl, 0, 0 coord hl, 0, 0
ld de, ToText ld de, ToText
call PlaceString call PlaceString
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, $0 ld b, $0
call DrawPlayerOrBirdSprite call DrawPlayerOrBirdSprite
ld hl, wFlyLocationsList ld hl, wFlyLocationsList
@ -250,9 +250,9 @@ BuildFlyLocationsList: ; 71070 (1c:5070)
ld hl, wFlyLocationsList - 1 ld hl, wFlyLocationsList - 1
ld [hl], $ff ld [hl], $ff
inc hl inc hl
ld a, [W_TOWNVISITEDFLAG] ld a, [wTownVisitedFlag]
ld e, a ld e, a
ld a, [W_TOWNVISITEDFLAG + 1] ld a, [wTownVisitedFlag + 1]
ld d, a ld d, a
ld bc, SAFFRON_CITY + 1 ld bc, SAFFRON_CITY + 1
.loop .loop
@ -405,7 +405,7 @@ DisplayWildLocations: ; 711ef (1c:51ef)
call PlaceString call PlaceString
jr .done jr .done
.drawPlayerSprite .drawPlayerSprite
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, $0 ld b, $0
call DrawPlayerOrBirdSprite call DrawPlayerOrBirdSprite
.done .done

View file

@ -18,14 +18,14 @@ ExternalClockTradeAnim: ; 410f3 (10:50f3)
ld de, ExternalClockTradeFuncSequence ld de, ExternalClockTradeFuncSequence
TradeAnimCommon: ; 41102 (10:5102) TradeAnimCommon: ; 41102 (10:5102)
ld a, [W_OPTIONS] ld a, [wOptions]
push af push af
ld a, [hSCY] ld a, [hSCY]
push af push af
ld a, [hSCX] ld a, [hSCX]
push af push af
xor a xor a
ld [W_OPTIONS], a ld [wOptions], a
ld [hSCY], a ld [hSCY], a
ld [hSCX], a ld [hSCX], a
push de push de
@ -53,7 +53,7 @@ TradeAnimCommon: ; 41102 (10:5102)
pop af pop af
ld [hSCY], a ld [hSCY], a
pop af pop af
ld [W_OPTIONS], a ld [wOptions], a
ret ret
addtradefunc: MACRO addtradefunc: MACRO
@ -383,9 +383,9 @@ Trade_AnimLeftToRight: ; 41376 (10:5376)
ld a, $e4 ld a, $e4
ld [rOBP0], a ld [rOBP0], a
ld a, $54 ld a, $54
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, $1c ld a, $1c
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, [wLeftGBMonSpecies] ld a, [wLeftGBMonSpecies]
ld [wMonPartySpriteSpecies], a ld [wMonPartySpriteSpecies], a
call Trade_WriteCircledMonOAM call Trade_WriteCircledMonOAM
@ -415,9 +415,9 @@ Trade_AnimRightToLeft: ; 413c6 (10:53c6)
xor a xor a
ld [wTradedMonMovingRight], a ld [wTradedMonMovingRight], a
ld a, $64 ld a, $64
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, $44 ld a, $44
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld a, [wRightGBMonSpecies] ld a, [wRightGBMonSpecies]
ld [wMonPartySpriteSpecies], a ld [wMonPartySpriteSpecies], a
call Trade_WriteCircledMonOAM call Trade_WriteCircledMonOAM
@ -622,10 +622,10 @@ Trade_AddOffsetsToOAMCoords: ; 41510 (10:5510)
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld c, $14 ld c, $14
.loop .loop
ld a, [W_BASECOORDY] ld a, [wBaseCoordY]
add [hl] add [hl]
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [wBaseCoordX]
add [hl] add [hl]
ld [hli], a ld [hli], a
inc hl inc hl
@ -657,9 +657,9 @@ Trade_AnimMonMoveVertical: ; 41525 (10:5525)
lb bc, -4, 0 ; move left lb bc, -4, 0 ; move left
.doAnim .doAnim
ld a, b ld a, b
ld [W_BASECOORDX], a ld [wBaseCoordX], a
ld a, c ld a, c
ld [W_BASECOORDY], a ld [wBaseCoordY], a
ld d, $4 ld d, $4
.loop .loop
call Trade_AddOffsetsToOAMCoords call Trade_AddOffsetsToOAMCoords
@ -847,7 +847,7 @@ TradeforText: ; 41671 (10:5671)
db "@" db "@"
Trade_ShowAnimation: ; 41676 (10:5676) Trade_ShowAnimation: ; 41676 (10:5676)
ld [W_ANIMATIONID], a ld [wAnimationID], a
xor a xor a
ld [wAnimationType], a ld [wAnimationType], a
predef_jump MoveAnimation predef_jump MoveAnimation

128
home.asm
View file

@ -240,7 +240,7 @@ DrawHPBar:: ; 1336 (0:1336)
; loads pokemon data from one of multiple sources to wLoadedMon ; loads pokemon data from one of multiple sources to wLoadedMon
; loads base stats to W_MONHEADER ; loads base stats to wMonHeader
; INPUT: ; INPUT:
; [wWhichPokemon] = index of pokemon within party/box ; [wWhichPokemon] = index of pokemon within party/box
; [wMonDataLocation] = source ; [wMonDataLocation] = source
@ -251,7 +251,7 @@ DrawHPBar:: ; 1336 (0:1336)
; OUTPUT: ; OUTPUT:
; [wcf91] = pokemon ID ; [wcf91] = pokemon ID
; wLoadedMon = base address of pokemon data ; wLoadedMon = base address of pokemon data
; W_MONHEADER = base address of base stats ; wMonHeader = base address of base stats
LoadMonData:: ; 1372 (0:1372) LoadMonData:: ; 1372 (0:1372)
jpab LoadMonData_ jpab LoadMonData_
@ -268,7 +268,7 @@ OverwritewMoves:: ; 137a (0:137a)
LoadFlippedFrontSpriteByMonIndex:: ; 1384 (0:1384) LoadFlippedFrontSpriteByMonIndex:: ; 1384 (0:1384)
ld a, 1 ld a, 1
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
LoadFrontSpriteByMonIndex:: ; 1389 (0:1389) LoadFrontSpriteByMonIndex:: ; 1389 (0:1389)
push hl push hl
@ -304,7 +304,7 @@ LoadFrontSpriteByMonIndex:: ; 1389 (0:1389)
ld [hStartTileID], a ld [hStartTileID], a
call CopyUncompressedPicToHL call CopyUncompressedPicToHL
xor a xor a
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
pop af pop af
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
@ -551,7 +551,7 @@ GetwMoves:: ; 152e (0:152e)
ld a,[hl] ld a,[hl]
ret ret
; copies the base stat data of a pokemon to W_MONHEADER ; copies the base stat data of a pokemon to wMonHeader
; INPUT: ; INPUT:
; [wd0b5] = pokemon ID ; [wd0b5] = pokemon ID
GetMonHeader:: ; 1537 (0:1537) GetMonHeader:: ; 1537 (0:1537)
@ -586,12 +586,12 @@ GetMonHeader:: ; 1537 (0:1537)
ld bc,MonBaseStatsEnd - MonBaseStats ld bc,MonBaseStatsEnd - MonBaseStats
ld hl,BaseStats ld hl,BaseStats
call AddNTimes call AddNTimes
ld de,W_MONHEADER ld de,wMonHeader
ld bc,MonBaseStatsEnd - MonBaseStats ld bc,MonBaseStatsEnd - MonBaseStats
call CopyData call CopyData
jr .done jr .done
.specialID .specialID
ld hl,W_MONHSPRITEDIM ld hl,wMonHSpriteDim
ld [hl],b ; write sprite dimensions ld [hl],b ; write sprite dimensions
inc hl inc hl
ld [hl],e ; write front sprite pointer ld [hl],e ; write front sprite pointer
@ -600,13 +600,13 @@ GetMonHeader:: ; 1537 (0:1537)
jr .done jr .done
.mew .mew
ld hl,MewBaseStats ld hl,MewBaseStats
ld de,W_MONHEADER ld de,wMonHeader
ld bc,MonBaseStatsEnd - MonBaseStats ld bc,MonBaseStatsEnd - MonBaseStats
ld a,BANK(MewBaseStats) ld a,BANK(MewBaseStats)
call FarCopyData call FarCopyData
.done .done
ld a,[wd0b5] ld a,[wd0b5]
ld [W_MONHINDEX],a ld [wMonHIndex],a
pop af pop af
ld [wd11e],a ld [wd11e],a
pop hl pop hl
@ -718,12 +718,12 @@ PrintBCDDigit:: ; 1604 (0:1604)
; assumes the corresponding mon header is already loaded ; assumes the corresponding mon header is already loaded
; hl contains offset to sprite pointer ($b for front or $d for back) ; hl contains offset to sprite pointer ($b for front or $d for back)
UncompressMonSprite:: ; 1627 (0:1627) UncompressMonSprite:: ; 1627 (0:1627)
ld bc,W_MONHEADER ld bc,wMonHeader
add hl,bc add hl,bc
ld a,[hli] ld a,[hli]
ld [W_SPRITEINPUTPTR],a ; fetch sprite input pointer ld [wSpriteInputPtr],a ; fetch sprite input pointer
ld a,[hl] ld a,[hl]
ld [W_SPRITEINPUTPTR+1],a ld [wSpriteInputPtr+1],a
; define (by index number) the bank that a pokemon's image is in ; define (by index number) the bank that a pokemon's image is in
; index = Mew, bank 1 ; index = Mew, bank 1
; index = Kabutops fossil, bank $B ; index = Kabutops fossil, bank $B
@ -764,9 +764,9 @@ UncompressMonSprite:: ; 1627 (0:1627)
; de: destination location ; de: destination location
LoadMonFrontSprite:: ; 1665 (0:1665) LoadMonFrontSprite:: ; 1665 (0:1665)
push de push de
ld hl, W_MONHFRONTSPRITE - W_MONHEADER ld hl, wMonHFrontSprite - wMonHeader
call UncompressMonSprite call UncompressMonSprite
ld hl, W_MONHSPRITEDIM ld hl, wMonHSpriteDim
ld a, [hli] ld a, [hli]
ld c, a ld c, a
pop de pop de
@ -891,7 +891,7 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
dec a dec a
ld [H_SPRITEINTERLACECOUNTER], a ld [H_SPRITEINTERLACECOUNTER], a
jr nz, .interlaceLoop jr nz, .interlaceLoop
ld a, [W_SPRITEFLIPPED] ld a, [wSpriteFlipped]
and a and a
jr z, .notFlipped jr z, .notFlipped
ld bc, 2*SPRITEBUFFERSIZE ld bc, 2*SPRITEBUFFERSIZE
@ -1057,12 +1057,12 @@ DisplayTextID:: ; 2920 (0:2920)
bit 0,[hl] bit 0,[hl]
res 0,[hl] res 0,[hl]
jr nz,.skipSwitchToMapBank jr nz,.skipSwitchToMapBank
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank call SwitchToMapRomBank
.skipSwitchToMapBank .skipSwitchToMapBank
ld a,30 ; half a second ld a,30 ; half a second
ld [H_FRAMECOUNTER],a ; used as joypad poll timer ld [H_FRAMECOUNTER],a ; used as joypad poll timer
ld hl,W_MAPTEXTPTR ld hl,wMapTextPtr
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ; hl = map text pointer ld l,a ; hl = map text pointer
@ -1079,7 +1079,7 @@ DisplayTextID:: ; 2920 (0:2920)
jp z,DisplayPlayerBlackedOutText jp z,DisplayPlayerBlackedOutText
cp a,TEXT_REPEL_WORE_OFF cp a,TEXT_REPEL_WORE_OFF
jp z,DisplayRepelWoreOffText jp z,DisplayRepelWoreOffText
ld a,[W_NUMSPRITES] ld a,[wNumSprites]
ld e,a ld e,a
ld a,[hSpriteIndexOrTextID] ; sprite ID ld a,[hSpriteIndexOrTextID] ; sprite ID
cp e cp e
@ -1093,7 +1093,7 @@ DisplayTextID:: ; 2920 (0:2920)
callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction)
pop bc pop bc
pop de pop de
ld hl,W_MAPSPRITEDATA ; NPC text entries ld hl,wMapSpriteData ; NPC text entries
ld a,[hSpriteIndexOrTextID] ld a,[hSpriteIndexOrTextID]
dec a dec a
add a add a
@ -1157,7 +1157,7 @@ HoldTextDisplayOpen:: ; 29df (0:29df)
jr nz,HoldTextDisplayOpen jr nz,HoldTextDisplayOpen
CloseTextDisplay:: ; 29e8 (0:29e8) CloseTextDisplay:: ; 29e8 (0:29e8)
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,$90 ld a,$90
ld [hWY],a ; move the window off the screen ld [hWY],a ; move the window off the screen
@ -1376,7 +1376,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer
ld a,1 ld a,1
ld [hJoy7],a ; joypad state update flag ld [hJoy7],a ; joypad state update flag
ld a,[W_BATTLETYPE] ld a,[wBattleType]
and a ; is it the Old Man battle? and a ; is it the Old Man battle?
jr nz,.specialBattleType jr nz,.specialBattleType
ld a,$01 ; hardcoded bank ld a,$01 ; hardcoded bank
@ -1432,7 +1432,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
ld a,1 ld a,1
ld [H_AUTOBGTRANSFERENABLED],a ; enable transfer ld [H_AUTOBGTRANSFERENABLED],a ; enable transfer
call Delay3 call Delay3
ld a,[W_BATTLETYPE] ld a,[wBattleType]
and a ; is it the Old Man battle? and a ; is it the Old Man battle?
jr z,.notOldManBattle jr z,.notOldManBattle
.oldManBattle .oldManBattle
@ -2043,7 +2043,7 @@ GetMoveName:: ; 3058 (0:3058)
ReloadMapData:: ; 3071 (0:3071) ReloadMapData:: ; 3071 (0:3071)
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank call SwitchToMapRomBank
call DisableLCD call DisableLCD
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
@ -2059,7 +2059,7 @@ ReloadMapData:: ; 3071 (0:3071)
ReloadTilesetTilePatterns:: ; 3090 (0:3090) ReloadTilesetTilePatterns:: ; 3090 (0:3090)
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank call SwitchToMapRomBank
call DisableLCD call DisableLCD
call LoadTilesetTilePatternData call LoadTilesetTilePatternData
@ -2202,12 +2202,12 @@ EndNPCMovementScript:: ; 314e (0:314e)
EmptyFunc2:: ; 3156 (0:3156) EmptyFunc2:: ; 3156 (0:3156)
ret ret
; stores hl in [W_TRAINERHEADERPTR] ; stores hl in [wTrainerHeaderPtr]
StoreTrainerHeaderPointer:: ; 3157 (0:3157) StoreTrainerHeaderPointer:: ; 3157 (0:3157)
ld a, h ld a, h
ld [W_TRAINERHEADERPTR], a ld [wTrainerHeaderPtr], a
ld a, l ld a, l
ld [W_TRAINERHEADERPTR+1], a ld [wTrainerHeaderPtr+1], a
ret ret
; executes the current map script from the function pointer array provided in hl. ; executes the current map script from the function pointer array provided in hl.
@ -2219,16 +2219,16 @@ ExecuteCurMapScriptInTable:: ; 3160 (0:3160)
pop hl pop hl
pop af pop af
push hl push hl
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
bit 4, [hl] bit 4, [hl]
res 4, [hl] res 4, [hl]
jr z, .useProvidedIndex ; test if map script index was overridden manually jr z, .useProvidedIndex ; test if map script index was overridden manually
ld a, [W_CURMAPSCRIPT] ld a, [wCurMapScript]
.useProvidedIndex .useProvidedIndex
pop hl pop hl
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
call CallFunctionInTable call CallFunctionInTable
ld a, [W_CURMAPSCRIPT] ld a, [wCurMapScript]
ret ret
LoadGymLeaderAndCityName:: ; 317f (0:317f) LoadGymLeaderAndCityName:: ; 317f (0:317f)
@ -2241,7 +2241,7 @@ LoadGymLeaderAndCityName:: ; 317f (0:317f)
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
jp CopyData ; load gym leader name jp CopyData ; load gym leader name
; reads specific information from trainer header (pointed to at W_TRAINERHEADERPTR) ; reads specific information from trainer header (pointed to at wTrainerHeaderPtr)
; a: offset in header data ; a: offset in header data
; 0 -> flag's bit (into wTrainerHeaderFlagBit) ; 0 -> flag's bit (into wTrainerHeaderFlagBit)
; 2 -> flag's byte ptr (into hl) ; 2 -> flag's byte ptr (into hl)
@ -2253,7 +2253,7 @@ ReadTrainerHeaderInfo:: ; 3193 (0:3193)
push af push af
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, W_TRAINERHEADERPTR ld hl, wTrainerHeaderPtr
ld a, [hli] ld a, [hli]
ld l, [hl] ld l, [hl]
ld h, a ld h, a
@ -2317,14 +2317,14 @@ TalkToTrainer:: ; 31cc (0:31cc)
call ReadTrainerHeaderInfo ; read end battle text call ReadTrainerHeaderInfo ; read end battle text
pop de pop de
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
set 4, [hl] ; activate map script index override (index is set below) set 4, [hl] ; activate map script index override (index is set below)
ld hl, wFlags_0xcd60 ld hl, wFlags_0xcd60
bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player)
ret nz ret nz
; if the player talked to the trainer of his own volition ; if the player talked to the trainer of his own volition
call EngageMapTrainer call EngageMapTrainer
ld hl, W_CURMAPSCRIPT ld hl, wCurMapScript
inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle)
jp StartTrainerBattle jp StartTrainerBattle
@ -2339,7 +2339,7 @@ CheckFightingMapTrainers:: ; 3219 (0:3219)
ld [wTrainerHeaderFlagBit], a ld [wTrainerHeaderFlagBit], a
ret ret
.trainerEngaging .trainerEngaging
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
set 3, [hl] set 3, [hl]
ld [wEmotionBubbleSpriteIndex], a ld [wEmotionBubbleSpriteIndex], a
xor a ; EXCLAMATION_BUBBLE xor a ; EXCLAMATION_BUBBLE
@ -2350,7 +2350,7 @@ CheckFightingMapTrainers:: ; 3219 (0:3219)
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
call TrainerWalkUpToPlayer_Bank0 call TrainerWalkUpToPlayer_Bank0
ld hl, W_CURMAPSCRIPT ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle)
ret ret
@ -2374,7 +2374,7 @@ StartTrainerBattle:: ; 325d (0:325d)
set 7, [hl] set 7, [hl]
ld hl, wd72e ld hl, wd72e
set 1, [hl] set 1, [hl]
ld hl, W_CURMAPSCRIPT ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) inc [hl] ; increment map script index (next script function is usually EndTrainerBattle)
ret ret
@ -2386,7 +2386,7 @@ EndTrainerBattle:: ; 3275 (0:3275)
res 7, [hl] res 7, [hl]
ld hl, wFlags_0xcd60 ld hl, wFlags_0xcd60
res 0, [hl] ; player is no longer engaged by any trainer res 0, [hl] ; player is no longer engaged by any trainer
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, ResetButtonPressedAndMapScript jp z, ResetButtonPressedAndMapScript
ld a, $2 ld a, $2
@ -2395,10 +2395,10 @@ EndTrainerBattle:: ; 3275 (0:3275)
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
call TrainerFlagAction ; flag trainer as fought call TrainerFlagAction ; flag trainer as fought
ld a, [W_ENEMYMONORTRAINERCLASS] ld a, [wEnemyMonOrTrainerClass]
cp 200 cp 200
jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite)
ld hl, W_MISSABLEOBJECTLIST ld hl, wMissableObjectList
ld de, $2 ld de, $2
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
call IsInArray ; search for sprite ID call IsInArray ; search for sprite ID
@ -2418,7 +2418,7 @@ ResetButtonPressedAndMapScript:: ; 32c1 (0:32c1)
ld [hJoyHeld], a ld [hJoyHeld], a
ld [hJoyPressed], a ld [hJoyPressed], a
ld [hJoyReleased], a ld [hJoyReleased], a
ld [W_CURMAPSCRIPT], a ; reset battle status ld [wCurMapScript], a ; reset battle status
ret ret
; calls TrainerWalkUpToPlayer ; calls TrainerWalkUpToPlayer
@ -2428,15 +2428,15 @@ TrainerWalkUpToPlayer_Bank0:: ; 32cf (0:32cf)
; sets opponent type and mon set/lvl based on the engaging trainer data ; sets opponent type and mon set/lvl based on the engaging trainer data
InitBattleEnemyParameters:: ; 32d7 (0:32d7) InitBattleEnemyParameters:: ; 32d7 (0:32d7)
ld a, [wEngagedTrainerClass] ld a, [wEngagedTrainerClass]
ld [W_CUROPPONENT], a ld [wCurOpponent], a
ld [W_ENEMYMONORTRAINERCLASS], a ld [wEnemyMonOrTrainerClass], a
cp 200 cp 200
ld a, [wEngagedTrainerSet] ld a, [wEngagedTrainerSet]
jr c, .noTrainer jr c, .noTrainer
ld [W_TRAINERNO], a ld [wTrainerNo], a
ret ret
.noTrainer .noTrainer
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
ret ret
GetSpritePosition1:: ; 32ef (0:32ef) GetSpritePosition1:: ; 32ef (0:32ef)
@ -2521,7 +2521,7 @@ SaveEndBattleTextPointers:: ; 3354 (0:3354)
; loads data of some trainer on the current map and plays pre-battle music ; loads data of some trainer on the current map and plays pre-battle music
; [wSpriteIndex]: sprite ID of trainer who is engaged ; [wSpriteIndex]: sprite ID of trainer who is engaged
EngageMapTrainer:: ; 336a (0:336a) EngageMapTrainer:: ; 336a (0:336a)
ld hl, W_MAPSPRITEEXTRADATA ld hl, wMapSpriteExtraData
ld d, $0 ld d, $0
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
dec a dec a
@ -2600,7 +2600,7 @@ PlayTrainerMusic:: ; 33e8 (0:33e8)
ret z ret z
cp OPP_SONY3 cp OPP_SONY3
ret z ret z
ld a, [W_GYMLEADERNO] ld a, [wGymLeaderNo]
and a and a
ret nz ret nz
xor a xor a
@ -2741,9 +2741,9 @@ SetSpriteImageIndexAfterSettingFacingDirection:: ; 34b9 (0:34b9)
; [wCoordIndex] = if there is match, the matching array index ; [wCoordIndex] = if there is match, the matching array index
; sets carry if the coordinates are in the array, clears carry if not ; sets carry if the coordinates are in the array, clears carry if not
ArePlayerCoordsInArray:: ; 34bf (0:34bf) ArePlayerCoordsInArray:: ; 34bf (0:34bf)
ld a,[W_YCOORD] ld a,[wYCoord]
ld b,a ld b,a
ld a,[W_XCOORD] ld a,[wXCoord]
ld c,a ld c,a
; fallthrough ; fallthrough
@ -2878,7 +2878,7 @@ GetSpriteMovementByte1Pointer:: ; 354e (0:354e)
; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl ; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl
GetSpriteMovementByte2Pointer:: ; 3558 (0:3558) GetSpriteMovementByte2Pointer:: ; 3558 (0:3558)
push de push de
ld hl,W_MAPSPRITEDATA ld hl,wMapSpriteData
ld a,[H_SPRITEINDEX] ld a,[H_SPRITEINDEX]
dec a dec a
add a add a
@ -2895,7 +2895,7 @@ GetTrainerInformation:: ; 3566 (0:3566)
jr nz, .linkBattle jr nz, .linkBattle
ld a, Bank(TrainerPicAndMoneyPointers) ld a, Bank(TrainerPicAndMoneyPointers)
call BankswitchHome call BankswitchHome
ld a, [W_TRAINERCLASS] ld a, [wTrainerClass]
dec a dec a
ld hl, TrainerPicAndMoneyPointers ld hl, TrainerPicAndMoneyPointers
ld bc, $5 ld bc, $5
@ -3151,7 +3151,7 @@ FillMemory::
UncompressSpriteFromDE:: ; 36eb (0:36eb) UncompressSpriteFromDE:: ; 36eb (0:36eb)
; Decompress pic at a:de. ; Decompress pic at a:de.
ld hl, W_SPRITEINPUTPTR ld hl, wSpriteInputPtr
ld [hl], e ld [hl], e
inc hl inc hl
ld [hl], d ld [hl], d
@ -3537,7 +3537,7 @@ PrintLetterDelay:: ; 38d3 (0:38d3)
ld a,[wLetterPrintingDelayFlags] ld a,[wLetterPrintingDelayFlags]
bit 0,a bit 0,a
jr z,.waitOneFrame jr z,.waitOneFrame
ld a,[W_OPTIONS] ld a,[wOptions]
and $f and $f
ld [H_FRAMECOUNTER],a ld [H_FRAMECOUNTER],a
jr .checkButtons jr .checkButtons
@ -3627,7 +3627,7 @@ CalcStat:: ; 394a (0:394a)
ld a, b ld a, b
ld d, a ld d, a
push hl push hl
ld hl, W_MONHEADER ld hl, wMonHeader
ld b, $0 ld b, $0
add hl, bc add hl, bc
ld a, [hl] ; read base value of stat ld a, [hl] ; read base value of stat
@ -3741,7 +3741,7 @@ CalcStat:: ; 394a (0:394a)
ld [H_MULTIPLICAND+1], a ld [H_MULTIPLICAND+1], a
xor a xor a
ld [H_MULTIPLICAND], a ld [H_MULTIPLICAND], a
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
ld [H_MULTIPLIER], a ld [H_MULTIPLIER], a
call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level
ld a, [H_MULTIPLICAND] ld a, [H_MULTIPLICAND]
@ -3759,7 +3759,7 @@ CalcStat:: ; 394a (0:394a)
cp $1 cp $1
ld a, 5 ; + 5 for non-HP stat ld a, 5 ; + 5 for non-HP stat
jr nz, .notHPStat jr nz, .notHPStat
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
ld b, a ld b, a
ld a, [H_MULTIPLICAND+2] ld a, [H_MULTIPLICAND+2]
add b add b
@ -4531,7 +4531,7 @@ ReloadMapSpriteTilePatterns:: ; 3e08 (0:3e08)
res 0, [hl] res 0, [hl]
push hl push hl
xor a xor a
ld [W_SPRITESETID], a ld [wSpriteSetID], a
call DisableLCD call DisableLCD
callba InitMapSprites callba InitMapSprites
call EnableLCD call EnableLCD
@ -4565,7 +4565,7 @@ GivePokemon::
ld a, b ld a, b
ld [wcf91], a ld [wcf91], a
ld a, c ld a, c
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
xor a ; PLAYER_PARTY_DATA xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a ld [wMonDataLocation], a
jpba _GivePokemon jpba _GivePokemon
@ -4637,7 +4637,7 @@ PrintPredefTextID:: ; 3ef5 (0:3ef5)
call DisplayTextID call DisplayTextID
RestoreMapTextPointer:: ; 3f05 (0:3f05) RestoreMapTextPointer:: ; 3f05 (0:3f05)
ld hl, W_MAPTEXTPTR ld hl, wMapTextPtr
ld a, [$ffec] ld a, [$ffec]
ld [hli], a ld [hli], a
ld a, [$ffec + 1] ld a, [$ffec + 1]
@ -4645,14 +4645,14 @@ RestoreMapTextPointer:: ; 3f05 (0:3f05)
ret ret
SetMapTextPointer:: ; 3f0f (0:3f0f) SetMapTextPointer:: ; 3f0f (0:3f0f)
ld a, [W_MAPTEXTPTR] ld a, [wMapTextPtr]
ld [$ffec], a ld [$ffec], a
ld a, [W_MAPTEXTPTR + 1] ld a, [wMapTextPtr + 1]
ld [$ffec + 1], a ld [$ffec + 1], a
ld a, l ld a, l
ld [W_MAPTEXTPTR], a ld [wMapTextPtr], a
ld a, h ld a, h
ld [W_MAPTEXTPTR + 1], a ld [wMapTextPtr + 1], a
ret ret
TextPredefs:: TextPredefs::

View file

@ -61,7 +61,7 @@ OverworldLoopLessDelay::
ld a,[wd732] ld a,[wd732]
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
jp nz,HandleFlyWarpOrDungeonWarp jp nz,HandleFlyWarpOrDungeonWarp
ld a,[W_CUROPPONENT] ld a,[wCurOpponent]
and a and a
jp nz,.newBattle jp nz,.newBattle
ld a,[wd730] ld a,[wd730]
@ -115,17 +115,17 @@ OverworldLoopLessDelay::
jr z,.changeMap jr z,.changeMap
; XXX can this code be reached? ; XXX can this code be reached?
predef LoadSAV predef LoadSAV
ld a,[W_CURMAP] ld a,[wCurMap]
ld [wDestinationMap],a ld [wDestinationMap],a
call SpecialWarpIn call SpecialWarpIn
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank ; switch to the ROM bank of the current map call SwitchToMapRomBank ; switch to the ROM bank of the current map
ld hl,W_CURMAPTILESET ld hl,wCurMapTileset
set 7,[hl] set 7,[hl]
.changeMap .changeMap
jp EnterMap jp EnterMap
.checkForOpponent .checkForOpponent
ld a,[W_CUROPPONENT] ld a,[wCurOpponent]
and a and a
jp nz,.newBattle jp nz,.newBattle
jp OverworldLoop jp OverworldLoop
@ -300,7 +300,7 @@ OverworldLoopLessDelay::
and a and a
jp nz,WarpFound2 jp nz,WarpFound2
.notSafariZone .notSafariZone
ld a,[W_ISINBATTLE] ld a,[wIsInBattle]
and a and a
jp nz,CheckWarpsNoCollision jp nz,CheckWarpsNoCollision
predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp
@ -315,21 +315,21 @@ OverworldLoopLessDelay::
.battleOccurred .battleOccurred
ld hl,wd72d ld hl,wd72d
res 6,[hl] res 6,[hl]
ld hl,W_FLAGS_D733 ld hl,wFlags_D733
res 3,[hl] res 3,[hl]
ld hl,wd126 ld hl,wd126
set 5,[hl] set 5,[hl]
set 6,[hl] set 6,[hl]
xor a xor a
ld [hJoyHeld],a ld [hJoyHeld],a
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,CINNABAR_GYM cp a,CINNABAR_GYM
jr nz,.notCinnabarGym jr nz,.notCinnabarGym
SetEvent EVENT_2A7 SetEvent EVENT_2A7
.notCinnabarGym .notCinnabarGym
ld hl,wd72e ld hl,wd72e
set 5,[hl] set 5,[hl]
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,OAKS_LAB cp a,OAKS_LAB
jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
callab AnyPartyAlive callab AnyPartyAlive
@ -342,7 +342,7 @@ OverworldLoopLessDelay::
jp EnterMap jp EnterMap
.allPokemonFainted .allPokemonFainted
ld a,$ff ld a,$ff
ld [W_ISINBATTLE],a ld [wIsInBattle],a
call RunMapScript call RunMapScript
jp HandleBlackOut jp HandleBlackOut
@ -367,7 +367,7 @@ BikeSpeedup:: ; 06a0 (0:06a0)
ld a,[wNPCMovementScriptPointerTableNum] ld a,[wNPCMovementScriptPointerTableNum]
and a and a
ret nz ret nz
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,ROUTE_17 ; Cycling Road cp a,ROUTE_17 ; Cycling Road
jr nz,.goFaster jr nz,.goFaster
ld a,[hJoyHeld] ld a,[hJoyHeld]
@ -384,9 +384,9 @@ CheckWarpsNoCollision:: ; 06b4 (0:06b4)
ld a,[wNumberOfWarps] ld a,[wNumberOfWarps]
ld b,0 ld b,0
ld c,a ld c,a
ld a,[W_YCOORD] ld a,[wYCoord]
ld d,a ld d,a
ld a,[W_XCOORD] ld a,[wXCoord]
ld e,a ld e,a
ld hl,wWarpEntries ld hl,wWarpEntries
CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc) CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc)
@ -412,7 +412,7 @@ CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc)
pop hl pop hl
jr nc,CheckWarpsNoCollisionRetry2 jr nc,CheckWarpsNoCollisionRetry2
; if the extra check passed ; if the extra check passed
ld a,[W_FLAGS_D733] ld a,[wFlags_D733]
bit 2,a bit 2,a
jr nz,WarpFound1 jr nz,WarpFound1
push de push de
@ -433,12 +433,12 @@ CheckWarpsCollision:: ; 0706 (0:0706)
.loop .loop
ld a,[hli] ; Y coordinate of warp ld a,[hli] ; Y coordinate of warp
ld b,a ld b,a
ld a,[W_YCOORD] ld a,[wYCoord]
cp b cp b
jr nz,.retry1 jr nz,.retry1
ld a,[hli] ; X coordinate of warp ld a,[hli] ; X coordinate of warp
ld b,a ld b,a
ld a,[W_XCOORD] ld a,[wXCoord]
cp b cp b
jr nz,.retry2 jr nz,.retry2
ld a,[hli] ld a,[hli]
@ -472,17 +472,17 @@ WarpFound2:: ; 073c (0:073c)
ld a,[wNumberOfWarps] ld a,[wNumberOfWarps]
sub c sub c
ld [wWarpedFromWhichWarp],a ; save ID of used warp ld [wWarpedFromWhichWarp],a ; save ID of used warp
ld a,[W_CURMAP] ld a,[wCurMap]
ld [wWarpedFromWhichMap],a ld [wWarpedFromWhichMap],a
call CheckIfInOutsideMap call CheckIfInOutsideMap
jr nz,.indoorMaps jr nz,.indoorMaps
; this is for handling "outside" maps that can't have the 0xFF destination map ; this is for handling "outside" maps that can't have the 0xFF destination map
ld a,[W_CURMAP] ld a,[wCurMap]
ld [wLastMap],a ld [wLastMap],a
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
ld [wUnusedD366],a ; not read ld [wUnusedD366],a ; not read
ld a,[hWarpDestinationMap] ld a,[hWarpDestinationMap]
ld [W_CURMAP],a ld [wCurMap],a
cp a,ROCK_TUNNEL_1 cp a,ROCK_TUNNEL_1
jr nz,.notRockTunnel jr nz,.notRockTunnel
ld a,$06 ld a,$06
@ -497,7 +497,7 @@ WarpFound2:: ; 073c (0:073c)
cp a,$ff cp a,$ff
jr z,.goBackOutside jr z,.goBackOutside
; if not going back to the previous map ; if not going back to the previous map
ld [W_CURMAP],a ld [wCurMap],a
callba IsPlayerStandingOnWarpPadOrHole callba IsPlayerStandingOnWarpPadOrHole
ld a,[wStandingOnWarpPadOrHole] ld a,[wStandingOnWarpPadOrHole]
dec a ; is the player on a warp pad? dec a ; is the player on a warp pad?
@ -516,7 +516,7 @@ WarpFound2:: ; 073c (0:073c)
jr .done jr .done
.goBackOutside .goBackOutside
ld a,[wLastMap] ld a,[wLastMap]
ld [W_CURMAP],a ld [wCurMap],a
call PlayMapChangeSound call PlayMapChangeSound
xor a xor a
ld [wMapPalOffset],a ld [wMapPalOffset],a
@ -534,19 +534,19 @@ ContinueCheckWarpsNoCollisionLoop:: ; 07b5 (0:07b5)
; if no matching warp was found ; if no matching warp was found
CheckMapConnections:: ; 07ba (0:07ba) CheckMapConnections:: ; 07ba (0:07ba)
.checkWestMap .checkWestMap
ld a,[W_XCOORD] ld a,[wXCoord]
cp a,$ff cp a,$ff
jr nz,.checkEastMap jr nz,.checkEastMap
ld a,[W_MAPCONN3PTR] ld a,[wMapConn3Ptr]
ld [W_CURMAP],a ld [wCurMap],a
ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map
ld [W_XCOORD],a ld [wXCoord],a
ld a,[W_YCOORD] ld a,[wYCoord]
ld c,a ld c,a
ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map
add c add c
ld c,a ld c,a
ld [W_YCOORD],a ld [wYCoord],a
ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
ld l,a ld l,a
ld a,[wWestConnectedMapViewPointer + 1] ld a,[wWestConnectedMapViewPointer + 1]
@ -573,16 +573,16 @@ CheckMapConnections:: ; 07ba (0:07ba)
ld a,[wCurrentMapWidth2] ; map width ld a,[wCurrentMapWidth2] ; map width
cp b cp b
jr nz,.checkNorthMap jr nz,.checkNorthMap
ld a,[W_MAPCONN4PTR] ld a,[wMapConn4Ptr]
ld [W_CURMAP],a ld [wCurMap],a
ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map
ld [W_XCOORD],a ld [wXCoord],a
ld a,[W_YCOORD] ld a,[wYCoord]
ld c,a ld c,a
ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map
add c add c
ld c,a ld c,a
ld [W_YCOORD],a ld [wYCoord],a
ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position
ld l,a ld l,a
ld a,[wEastConnectedMapViewPointer + 1] ld a,[wEastConnectedMapViewPointer + 1]
@ -605,19 +605,19 @@ CheckMapConnections:: ; 07ba (0:07ba)
ld [wCurrentTileBlockMapViewPointer + 1],a ld [wCurrentTileBlockMapViewPointer + 1],a
jp .loadNewMap jp .loadNewMap
.checkNorthMap .checkNorthMap
ld a,[W_YCOORD] ld a,[wYCoord]
cp a,$ff cp a,$ff
jr nz,.checkSouthMap jr nz,.checkSouthMap
ld a,[W_MAPCONN1PTR] ld a,[wMapConn1Ptr]
ld [W_CURMAP],a ld [wCurMap],a
ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map
ld [W_YCOORD],a ld [wYCoord],a
ld a,[W_XCOORD] ld a,[wXCoord]
ld c,a ld c,a
ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map
add c add c
ld c,a ld c,a
ld [W_XCOORD],a ld [wXCoord],a
ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
ld l,a ld l,a
ld a,[wNorthConnectedMapViewPointer + 1] ld a,[wNorthConnectedMapViewPointer + 1]
@ -635,16 +635,16 @@ CheckMapConnections:: ; 07ba (0:07ba)
ld a,[wCurrentMapHeight2] ld a,[wCurrentMapHeight2]
cp b cp b
jr nz,.didNotEnterConnectedMap jr nz,.didNotEnterConnectedMap
ld a,[W_MAPCONN2PTR] ld a,[wMapConn2Ptr]
ld [W_CURMAP],a ld [wCurMap],a
ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map
ld [W_YCOORD],a ld [wYCoord],a
ld a,[W_XCOORD] ld a,[wXCoord]
ld c,a ld c,a
ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map
add c add c
ld c,a ld c,a
ld [W_XCOORD],a ld [wXCoord],a
ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position
ld l,a ld l,a
ld a,[wSouthConnectedMapViewPointer + 1] ld a,[wSouthConnectedMapViewPointer + 1]
@ -687,7 +687,7 @@ PlayMapChangeSound:: ; 08c9 (0:08c9)
CheckIfInOutsideMap:: ; 08e1 (0:08e1) CheckIfInOutsideMap:: ; 08e1 (0:08e1)
; If the player is in an outside map (a town or route), set the z flag ; If the player is in an outside map (a town or route), set the z flag
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
and a ; most towns/routes have tileset 0 (OVERWORLD) and a ; most towns/routes have tileset 0 (OVERWORLD)
ret z ret z
cp PLATEAU ; Route 23 / Indigo Plateau cp PLATEAU ; Route 23 / Indigo Plateau
@ -700,7 +700,7 @@ CheckIfInOutsideMap:: ; 08e1 (0:08e1)
; "function 2" passes when the the tile in front of the player is among a certain set ; "function 2" passes when the the tile in front of the player is among a certain set
; sets carry if the check passes, otherwise clears carry ; sets carry if the check passes, otherwise clears carry
ExtraWarpCheck:: ; 08e9 (0:08e9) ExtraWarpCheck:: ; 08e9 (0:08e9)
ld a, [W_CURMAP] ld a, [wCurMap]
cp SS_ANNE_3 cp SS_ANNE_3
jr z, .useFunction1 jr z, .useFunction1
cp ROCKET_HIDEOUT_1 cp ROCKET_HIDEOUT_1
@ -711,7 +711,7 @@ ExtraWarpCheck:: ; 08e9 (0:08e9)
jr z, .useFunction2 jr z, .useFunction2
cp ROCK_TUNNEL_1 cp ROCK_TUNNEL_1
jr z, .useFunction2 jr z, .useFunction2
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
and a ; outside tileset (OVERWORLD) and a ; outside tileset (OVERWORLD)
jr z, .useFunction2 jr z, .useFunction2
cp SHIP ; S.S. Anne tileset cp SHIP ; S.S. Anne tileset
@ -770,7 +770,7 @@ HandleFlyWarpOrDungeonWarp::
xor a xor a
ld [wBattleResult], a ld [wBattleResult], a
ld [wWalkBikeSurfState], a ld [wWalkBikeSurfState], a
ld [W_ISINBATTLE], a ld [wIsInBattle], a
ld [wMapPalOffset], a ld [wMapPalOffset], a
ld hl, wd732 ld hl, wd732
set 2, [hl] ; fly warp or dungeon warp set 2, [hl] ; fly warp or dungeon warp
@ -828,13 +828,13 @@ IsBikeRidingAllowed::
; or maps with tilesets in BikeRidingTilesets. ; or maps with tilesets in BikeRidingTilesets.
; Return carry if biking is allowed. ; Return carry if biking is allowed.
ld a, [W_CURMAP] ld a, [wCurMap]
cp ROUTE_23 cp ROUTE_23
jr z, .allowed jr z, .allowed
cp INDIGO_PLATEAU cp INDIGO_PLATEAU
jr z, .allowed jr z, .allowed
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld b, a ld b, a
ld hl, BikeRidingTilesets ld hl, BikeRidingTilesets
.loop .loop
@ -854,13 +854,13 @@ INCLUDE "data/bike_riding_tilesets.asm"
; load the tile pattern data of the current tileset into VRAM ; load the tile pattern data of the current tileset into VRAM
LoadTilesetTilePatternData:: ; 09e8 (0:09e8) LoadTilesetTilePatternData:: ; 09e8 (0:09e8)
ld a,[W_TILESETGFXPTR] ld a,[wTileSetGFXPtr]
ld l,a ld l,a
ld a,[W_TILESETGFXPTR + 1] ld a,[wTileSetGFXPtr + 1]
ld h,a ld h,a
ld de,vTileset ld de,vTileset
ld bc,$600 ld bc,$600
ld a,[W_TILESETBANK] ld a,[wTileSetBank]
jp FarCopyData2 jp FarCopyData2
; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
@ -881,7 +881,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
; load tile map of current map (made of tile block IDs) ; load tile map of current map (made of tile block IDs)
; a 3-byte border at the edges of the map is kept so that there is space for map connections ; a 3-byte border at the edges of the map is kept so that there is space for map connections
ld hl,wOverworldMap ld hl,wOverworldMap
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
ld [hMapWidth],a ld [hMapWidth],a
add a,MAP_BORDER * 2 ; east and west add a,MAP_BORDER * 2 ; east and west
ld [hMapStride],a ; map width + border ld [hMapStride],a ; map width + border
@ -893,11 +893,11 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
add hl,bc add hl,bc
ld c,MAP_BORDER ld c,MAP_BORDER
add hl,bc ; this puts us past the (west) border add hl,bc ; this puts us past the (west) border
ld a,[W_MAPDATAPTR] ; tile map pointer ld a,[wMapDataPtr] ; tile map pointer
ld e,a ld e,a
ld a,[W_MAPDATAPTR + 1] ld a,[wMapDataPtr + 1]
ld d,a ; de = tile map pointer ld d,a ; de = tile map pointer
ld a,[W_CURMAPHEIGHT] ld a,[wCurMapHeight]
ld b,a ld b,a
.rowLoop ; copy one row each iteration .rowLoop ; copy one row each iteration
push hl push hl
@ -920,7 +920,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
dec b dec b
jr nz,.rowLoop jr nz,.rowLoop
.northConnection .northConnection
ld a,[W_MAPCONN1PTR] ld a,[wMapConn1Ptr]
cp a,$ff cp a,$ff
jr z,.southConnection jr z,.southConnection
call SwitchToMapRomBank call SwitchToMapRomBank
@ -938,7 +938,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
ld [hNorthSouthConnectedMapWidth],a ld [hNorthSouthConnectedMapWidth],a
call LoadNorthSouthConnectionsTileMap call LoadNorthSouthConnectionsTileMap
.southConnection .southConnection
ld a,[W_MAPCONN2PTR] ld a,[wMapConn2Ptr]
cp a,$ff cp a,$ff
jr z,.westConnection jr z,.westConnection
call SwitchToMapRomBank call SwitchToMapRomBank
@ -956,7 +956,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
ld [hNorthSouthConnectedMapWidth],a ld [hNorthSouthConnectedMapWidth],a
call LoadNorthSouthConnectionsTileMap call LoadNorthSouthConnectionsTileMap
.westConnection .westConnection
ld a,[W_MAPCONN3PTR] ld a,[wMapConn3Ptr]
cp a,$ff cp a,$ff
jr z,.eastConnection jr z,.eastConnection
call SwitchToMapRomBank call SwitchToMapRomBank
@ -974,7 +974,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
ld [hEastWestConnectedMapWidth],a ld [hEastWestConnectedMapWidth],a
call LoadEastWestConnectionsTileMap call LoadEastWestConnectionsTileMap
.eastConnection .eastConnection
ld a,[W_MAPCONN4PTR] ld a,[wMapConn4Ptr]
cp a,$ff cp a,$ff
jr z,.done jr z,.done
call SwitchToMapRomBank call SwitchToMapRomBank
@ -1015,7 +1015,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
jr nc,.noCarry1 jr nc,.noCarry1
inc h inc h
.noCarry1 .noCarry1
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add a,MAP_BORDER * 2
add e add e
ld e,a ld e,a
@ -1044,7 +1044,7 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
jr nc,.noCarry1 jr nc,.noCarry1
inc h inc h
.noCarry1 .noCarry1
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add a,MAP_BORDER * 2
add e add e
ld e,a ld e,a
@ -1100,7 +1100,7 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC ; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
.extendRangeOverCounter .extendRangeOverCounter
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
ld hl,W_TILESETTALKINGOVERTILES ; list of tiles that extend talking range (counter tiles) ld hl,wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
ld b,3 ld b,3
ld d,$20 ; talking range in pixels (long range) ld d,$20 ; talking range in pixels (long range)
.counterTilesLoop .counterTilesLoop
@ -1152,7 +1152,7 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
ld a,PLAYER_DIR_LEFT ld a,PLAYER_DIR_LEFT
.doneCheckingDirection .doneCheckingDirection
ld [wPlayerDirection],a ld [wPlayerDirection],a
ld a,[W_NUMSPRITES] ; number of sprites ld a,[wNumSprites] ; number of sprites
and a and a
ret z ret z
; if there are sprites ; if there are sprites
@ -1242,7 +1242,7 @@ CheckTilePassable:: ; 0c10 (0:0c10)
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player
ld a,[wTileInFrontOfPlayer] ; tile in front of player ld a,[wTileInFrontOfPlayer] ; tile in front of player
ld c,a ld c,a
ld hl,W_TILESETCOLLISIONPTR ; pointer to list of passable tiles ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ; hl now points to passable tiles ld l,a ; hl now points to passable tiles
@ -1284,7 +1284,7 @@ CheckForTilePairCollisions:: ; 0c4a (0:0c4a)
ld a,[wTileInFrontOfPlayer] ld a,[wTileInFrontOfPlayer]
ld c,a ld c,a
.tilePairCollisionLoop .tilePairCollisionLoop
ld a,[W_CURMAPTILESET] ; tileset number ld a,[wCurMapTileset] ; tileset number
ld b,a ld b,a
ld a,[hli] ld a,[hli]
cp a,$ff cp a,$ff
@ -1354,7 +1354,7 @@ TilePairCollisionsWater:: ; 0ca0 (0:0ca0)
LoadCurrentMapView:: ; 0caa (0:0caa) LoadCurrentMapView:: ; 0caa (0:0caa)
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
ld a,[W_TILESETBANK] ; tile data ROM bank ld a,[wTileSetBank] ; tile data ROM bank
ld [H_LOADEDROMBANK],a ld [H_LOADEDROMBANK],a
ld [MBC1RomBank],a ; switch to ROM bank that contains tile data ld [MBC1RomBank],a ; switch to ROM bank that contains tile data
ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
@ -1386,7 +1386,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
jr nz,.rowInnerLoop jr nz,.rowInnerLoop
; update tile block map pointer to next row's address ; update tile block map pointer to next row's address
pop de pop de
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add a,MAP_BORDER * 2
add e add e
ld e,a ld e,a
@ -1406,13 +1406,13 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
ld hl,wTileMapBackup ld hl,wTileMapBackup
ld bc,$0000 ld bc,$0000
.adjustForYCoordWithinTileBlock .adjustForYCoordWithinTileBlock
ld a,[W_YBLOCKCOORD] ld a,[wYBlockCoord]
and a and a
jr z,.adjustForXCoordWithinTileBlock jr z,.adjustForXCoordWithinTileBlock
ld bc,$0030 ld bc,$0030
add hl,bc add hl,bc
.adjustForXCoordWithinTileBlock .adjustForXCoordWithinTileBlock
ld a,[W_XBLOCKCOORD] ld a,[wXBlockCoord]
and a and a
jr z,.copyToVisibleAreaBuffer jr z,.copyToVisibleAreaBuffer
ld bc,$0002 ld bc,$0002
@ -1450,12 +1450,12 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
dec [hl] dec [hl]
jr nz,.afterUpdateMapCoords jr nz,.afterUpdateMapCoords
; if it's the end of the animation, update the player's map coordinates ; if it's the end of the animation, update the player's map coordinates
ld a,[W_YCOORD] ld a,[wYCoord]
add b add b
ld [W_YCOORD],a ld [wYCoord],a
ld a,[W_XCOORD] ld a,[wXCoord]
add c add c
ld [W_XCOORD],a ld [wXCoord],a
.afterUpdateMapCoords .afterUpdateMapCoords
ld a,[wWalkCounter] ; walking animation counter ld a,[wWalkCounter] ; walking animation counter
cp a,$07 cp a,$07
@ -1522,7 +1522,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
and a and a
jr z,.pointlessJump ; mistake? jr z,.pointlessJump ; mistake?
.pointlessJump .pointlessJump
ld hl,W_XBLOCKCOORD ld hl,wXBlockCoord
ld a,[hl] ld a,[hl]
add c add c
ld [hl],a ld [hl],a
@ -1548,7 +1548,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
call MoveTileBlockMapPointerWest call MoveTileBlockMapPointerWest
jr .updateMapView jr .updateMapView
.adjustYCoordWithinBlock .adjustYCoordWithinBlock
ld hl,W_YBLOCKCOORD ld hl,wYBlockCoord
ld a,[hl] ld a,[hl]
add b add b
ld [hl],a ld [hl],a
@ -1560,7 +1560,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
ld hl,wYOffsetSinceLastSpecialWarp ld hl,wYOffsetSinceLastSpecialWarp
inc [hl] inc [hl]
ld de,wCurrentTileBlockMapViewPointer ld de,wCurrentTileBlockMapViewPointer
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
call MoveTileBlockMapPointerSouth call MoveTileBlockMapPointerSouth
jr .updateMapView jr .updateMapView
.checkForMoveToNorthBlock .checkForMoveToNorthBlock
@ -1572,7 +1572,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
ld hl,wYOffsetSinceLastSpecialWarp ld hl,wYOffsetSinceLastSpecialWarp
dec [hl] dec [hl]
ld de,wCurrentTileBlockMapViewPointer ld de,wCurrentTileBlockMapViewPointer
ld a,[W_CURMAPWIDTH] ld a,[wCurMapWidth]
call MoveTileBlockMapPointerNorth call MoveTileBlockMapPointerNorth
.updateMapView .updateMapView
call LoadCurrentMapView call LoadCurrentMapView
@ -1616,7 +1616,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
; shift all the sprites in the direction opposite of the player's motion ; shift all the sprites in the direction opposite of the player's motion
; so that the player appears to move relative to them ; so that the player appears to move relative to them
ld hl,wSpriteStateData1 + $14 ld hl,wSpriteStateData1 + $14
ld a,[W_NUMSPRITES] ; number of sprites ld a,[wNumSprites] ; number of sprites
and a ; are there any sprites? and a ; are there any sprites?
jr z,.done jr z,.done
ld e,a ld e,a
@ -1784,9 +1784,9 @@ ScheduleWestColumnRedraw:: ; 0f08 (0:0f08)
; Input: c = tile block ID, hl = destination address ; Input: c = tile block ID, hl = destination address
DrawTileBlock:: ; 0f1d (0:0f1d) DrawTileBlock:: ; 0f1d (0:0f1d)
push hl push hl
ld a,[W_TILESETBLOCKSPTR] ; pointer to tiles ld a,[wTileSetBlocksPtr] ; pointer to tiles
ld l,a ld l,a
ld a,[W_TILESETBLOCKSPTR + 1] ld a,[wTileSetBlocksPtr + 1]
ld h,a ld h,a
ld a,c ld a,c
swap a swap a
@ -1829,10 +1829,10 @@ JoypadOverworld:: ; 0f4d (0:0f4d)
ld [wSpriteStateData1 + 5],a ld [wSpriteStateData1 + 5],a
call RunMapScript call RunMapScript
call Joypad call Joypad
ld a,[W_FLAGS_D733] ld a,[wFlags_D733]
bit 3,a ; check if a trainer wants a challenge bit 3,a ; check if a trainer wants a challenge
jr nz,.notForcedDownwards jr nz,.notForcedDownwards
ld a,[W_CURMAP] ld a,[wCurMap]
cp a,ROUTE_17 ; Cycling Road cp a,ROUTE_17 ; Cycling Road
jr nz,.notForcedDownwards jr nz,.notForcedDownwards
ld a,[hJoyHeld] ld a,[hJoyHeld]
@ -1915,7 +1915,7 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7)
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
ld hl,W_TILESETCOLLISIONPTR ; pointer to list of passable tiles ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -1946,7 +1946,7 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7)
call PlayDefaultMusic call PlayDefaultMusic
jr .noCollision jr .noCollision
.checkIfVermilionDockTileset .checkIfVermilionDockTileset
ld a, [W_CURMAPTILESET] ; tileset ld a, [wCurMapTileset] ; tileset
cp SHIP_PORT ; Vermilion Dock tileset cp SHIP_PORT ; Vermilion Dock tileset
jr nz, .noCollision ; keep surfing if it's not the boarding platform tile jr nz, .noCollision ; keep surfing if it's not the boarding platform tile
jr .stopSurfing ; if it is the boarding platform tile, stop surfing jr .stopSurfing ; if it is the boarding platform tile, stop surfing
@ -1966,9 +1966,9 @@ RunMapScript:: ; 101b (0:101b)
pop de pop de
pop hl pop hl
call RunNPCMovementScript call RunNPCMovementScript
ld a,[W_CURMAP] ; current map number ld a,[wCurMap] ; current map number
call SwitchToMapRomBank ; change to the ROM bank the map's data is in call SwitchToMapRomBank ; change to the ROM bank the map's data is in
ld hl,W_MAPSCRIPTPTR ld hl,wMapScriptPtr
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -2012,19 +2012,19 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063)
; function to load data from the map header ; function to load data from the map header
LoadMapHeader:: ; 107c (0:107c) LoadMapHeader:: ; 107c (0:107c)
callba MarkTownVisitedAndLoadMissableObjects callba MarkTownVisitedAndLoadMissableObjects
ld a,[W_CURMAPTILESET] ld a,[wCurMapTileset]
ld [wUnusedD119],a ld [wUnusedD119],a
ld a,[W_CURMAP] ld a,[wCurMap]
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,[W_CURMAPTILESET] ld a,[wCurMapTileset]
ld b,a ld b,a
res 7,a res 7,a
ld [W_CURMAPTILESET],a ld [wCurMapTileset],a
ld [hPreviousTileset],a ld [hPreviousTileset],a
bit 7,b bit 7,b
ret nz ret nz
ld hl,MapHeaderPointers ld hl,MapHeaderPointers
ld a,[W_CURMAP] ld a,[wCurMap]
sla a sla a
jr nc,.noCarry1 jr nc,.noCarry1
inc h inc h
@ -2038,7 +2038,7 @@ LoadMapHeader:: ; 107c (0:107c)
ld h,[hl] ld h,[hl]
ld l,a ; hl = base of map header ld l,a ; hl = base of map header
; copy the first 10 bytes (the fixed area) of the map data to D367-D370 ; copy the first 10 bytes (the fixed area) of the map data to D367-D370
ld de,W_CURMAPTILESET ld de,wCurMapTileset
ld c,$0a ld c,$0a
.copyFixedHeaderLoop .copyFixedHeaderLoop
ld a,[hli] ld a,[hli]
@ -2048,32 +2048,32 @@ LoadMapHeader:: ; 107c (0:107c)
jr nz,.copyFixedHeaderLoop jr nz,.copyFixedHeaderLoop
; initialize all the connected maps to disabled at first, before loading the actual values ; initialize all the connected maps to disabled at first, before loading the actual values
ld a,$ff ld a,$ff
ld [W_MAPCONN1PTR],a ld [wMapConn1Ptr],a
ld [W_MAPCONN2PTR],a ld [wMapConn2Ptr],a
ld [W_MAPCONN3PTR],a ld [wMapConn3Ptr],a
ld [W_MAPCONN4PTR],a ld [wMapConn4Ptr],a
; copy connection data (if any) to WRAM ; copy connection data (if any) to WRAM
ld a,[W_MAPCONNECTIONS] ld a,[wMapConnections]
ld b,a ld b,a
.checkNorth .checkNorth
bit 3,b bit 3,b
jr z,.checkSouth jr z,.checkSouth
ld de,W_MAPCONN1PTR ld de,wMapConn1Ptr
call CopyMapConnectionHeader call CopyMapConnectionHeader
.checkSouth .checkSouth
bit 2,b bit 2,b
jr z,.checkWest jr z,.checkWest
ld de,W_MAPCONN2PTR ld de,wMapConn2Ptr
call CopyMapConnectionHeader call CopyMapConnectionHeader
.checkWest .checkWest
bit 1,b bit 1,b
jr z,.checkEast jr z,.checkEast
ld de,W_MAPCONN3PTR ld de,wMapConn3Ptr
call CopyMapConnectionHeader call CopyMapConnectionHeader
.checkEast .checkEast
bit 0,b bit 0,b
jr z,.getObjectDataPointer jr z,.getObjectDataPointer
ld de,W_MAPCONN4PTR ld de,wMapConn4Ptr
call CopyMapConnectionHeader call CopyMapConnectionHeader
.getObjectDataPointer .getObjectDataPointer
ld a,[hli] ld a,[hli]
@ -2144,7 +2144,7 @@ LoadMapHeader:: ; 107c (0:107c)
bit 5,a ; did a battle happen immediately before this? bit 5,a ; did a battle happen immediately before this?
jp nz,.finishUp ; if so, skip this because battles don't destroy this data jp nz,.finishUp ; if so, skip this because battles don't destroy this data
ld a,[hli] ld a,[hli]
ld [W_NUMSPRITES],a ; save the number of sprites ld [wNumSprites],a ; save the number of sprites
push hl push hl
; zero C110-C1FF and C210-C2FF ; zero C110-C1FF and C210-C2FF
ld hl,wSpriteStateData1 + $10 ld hl,wSpriteStateData1 + $10
@ -2168,7 +2168,7 @@ LoadMapHeader:: ; 107c (0:107c)
jr nz,.disableSpriteEntriesLoop jr nz,.disableSpriteEntriesLoop
pop hl pop hl
ld de,wSpriteStateData1 + $10 ld de,wSpriteStateData1 + $10
ld a,[W_NUMSPRITES] ; number of sprites ld a,[wNumSprites] ; number of sprites
and a ; are there any sprites? and a ; are there any sprites?
jp z,.finishUp ; if there are no sprites, skip the rest jp z,.finishUp ; if there are no sprites, skip the rest
ld b,a ld b,a
@ -2195,7 +2195,7 @@ LoadMapHeader:: ; 107c (0:107c)
push bc push bc
push hl push hl
ld b,$00 ld b,$00
ld hl,W_MAPSPRITEDATA ld hl,wMapSpriteData
add hl,bc add hl,bc
ld a,[hLoadSpriteTemp1] ld a,[hLoadSpriteTemp1]
ld [hli],a ; store movement byte 2 in byte 0 of sprite entry ld [hli],a ; store movement byte 2 in byte 0 of sprite entry
@ -2218,7 +2218,7 @@ LoadMapHeader:: ; 107c (0:107c)
ld a,[hli] ld a,[hli]
ld [hLoadSpriteTemp2],a ; save trainer number (within class) ld [hLoadSpriteTemp2],a ; save trainer number (within class)
push hl push hl
ld hl,W_MAPSPRITEEXTRADATA ld hl,wMapSpriteExtraData
add hl,bc add hl,bc
ld a,[hLoadSpriteTemp1] ld a,[hLoadSpriteTemp1]
ld [hli],a ; store trainer class in byte 0 of the entry ld [hli],a ; store trainer class in byte 0 of the entry
@ -2230,7 +2230,7 @@ LoadMapHeader:: ; 107c (0:107c)
ld a,[hli] ld a,[hli]
ld [hLoadSpriteTemp1],a ; save item number ld [hLoadSpriteTemp1],a ; save item number
push hl push hl
ld hl,W_MAPSPRITEEXTRADATA ld hl,wMapSpriteExtraData
add hl,bc add hl,bc
ld a,[hLoadSpriteTemp1] ld a,[hLoadSpriteTemp1]
ld [hli],a ; store item number in byte 0 of the entry ld [hli],a ; store item number in byte 0 of the entry
@ -2240,7 +2240,7 @@ LoadMapHeader:: ; 107c (0:107c)
jr .nextSprite jr .nextSprite
.regularSprite .regularSprite
push hl push hl
ld hl,W_MAPSPRITEEXTRADATA ld hl,wMapSpriteExtraData
add hl,bc add hl,bc
; zero both bytes, since regular sprites don't use this extra space ; zero both bytes, since regular sprites don't use this extra space
xor a xor a
@ -2261,13 +2261,13 @@ LoadMapHeader:: ; 107c (0:107c)
predef LoadTilesetHeader predef LoadTilesetHeader
callab LoadWildData callab LoadWildData
pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose) pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks ld a,[wCurMapHeight] ; map height in 4x4 tile blocks
add a ; double it add a ; double it
ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks
ld a,[W_CURMAPWIDTH] ; map width in 4x4 tile blocks ld a,[wCurMapWidth] ; map width in 4x4 tile blocks
add a ; double it add a ; double it
ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks
ld a,[W_CURMAP] ld a,[wCurMap]
ld c,a ld c,a
ld b,$00 ld b,$00
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
@ -2313,7 +2313,7 @@ LoadMapData:: ; 1241 (0:1241)
ld [wWalkCounter],a ld [wWalkCounter],a
ld [wUnusedD119],a ld [wUnusedD119],a
ld [wWalkBikeSurfStateCopy],a ld [wWalkBikeSurfStateCopy],a
ld [W_SPRITESETID],a ld [wSpriteSetID],a
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
call LoadMapHeader call LoadMapHeader
callba InitMapSprites ; load tile pattern data for sprites callba InitMapSprites ; load tile pattern data for sprites
@ -2349,7 +2349,7 @@ LoadMapData:: ; 1241 (0:1241)
ld a,[wd732] ld a,[wd732]
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
jr nz,.restoreRomBank jr nz,.restoreRomBank
ld a,[W_FLAGS_D733] ld a,[wFlags_D733]
bit 1,a bit 1,a
jr nz,.restoreRomBank jr nz,.restoreRomBank
call UpdateMusic6Times call UpdateMusic6Times

View file

@ -1,5 +1,5 @@
; bankswitches and runs _UncompressSpriteData ; bankswitches and runs _UncompressSpriteData
; bank is given in a, sprite input stream is pointed to in W_SPRITEINPUTPTR ; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr
UncompressSpriteData:: ; 24fd (0:24fd) UncompressSpriteData:: ; 24fd (0:24fd)
ld b, a ld b, a
ld a, [H_LOADEDROMBANK] ld a, [H_LOADEDROMBANK]
@ -25,29 +25,29 @@ _UncompressSpriteData:: ; 251a (0:251a)
xor a xor a
call FillMemory ; clear sprite buffer 1 and 2 call FillMemory ; clear sprite buffer 1 and 2
ld a, $1 ld a, $1
ld [W_SPRITEINPUTBITCOUNTER], a ld [wSpriteInputBitCounter], a
ld a, $3 ld a, $3
ld [W_SPRITEOUTPUTBITOFFSET], a ld [wSpriteOutputBitOffset], a
xor a xor a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ld [W_SPRITELOADFLAGS], a ld [wSpriteLoadFlags], a
call ReadNextInputByte ; first byte of input determines sprite width (high nybble) and height (low nybble) in tiles (8x8 pixels) call ReadNextInputByte ; first byte of input determines sprite width (high nybble) and height (low nybble) in tiles (8x8 pixels)
ld b, a ld b, a
and $f and $f
add a add a
add a add a
add a add a
ld [W_SPRITEHEIGHT], a ld [wSpriteHeight], a
ld a, b ld a, b
swap a swap a
and $f and $f
add a add a
add a add a
add a add a
ld [W_SPRITEWITDH], a ld [wSpriteWidth], a
call ReadNextInputBit call ReadNextInputBit
ld [W_SPRITELOADFLAGS], a ; initialite bit1 to 0 and bit0 to the first input bit ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit
; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2 ; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2
; bit 0 decides in which one the first chunk is placed ; bit 0 decides in which one the first chunk is placed
; fall through ; fall through
@ -57,13 +57,13 @@ _UncompressSpriteData:: ; 251a (0:251a)
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack ; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
UncompressSpriteDataLoop:: ; 2556 (0:2556) UncompressSpriteDataLoop:: ; 2556 (0:2556)
ld hl, S_SPRITEBUFFER1 ld hl, S_SPRITEBUFFER1
ld a, [W_SPRITELOADFLAGS] ld a, [wSpriteLoadFlags]
bit 0, a bit 0, a
jr z, .useSpriteBuffer1 ; check which buffer to use jr z, .useSpriteBuffer1 ; check which buffer to use
ld hl, S_SPRITEBUFFER2 ld hl, S_SPRITEBUFFER2
.useSpriteBuffer1 .useSpriteBuffer1
call StoreSpriteOutputPointer call StoreSpriteOutputPointer
ld a, [W_SPRITELOADFLAGS] ld a, [wSpriteLoadFlags]
bit 1, a bit 1, a
jr z, .startDecompression ; check if last iteration jr z, .startDecompression ; check if last iteration
call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode
@ -72,7 +72,7 @@ UncompressSpriteDataLoop:: ; 2556 (0:2556)
call ReadNextInputBit ; 1 0 -> mode 1 call ReadNextInputBit ; 1 0 -> mode 1
inc a ; 1 1 -> mode 2 inc a ; 1 1 -> mode 2
.unpackingMode0 .unpackingMode0
ld [W_SPRITEUNPACKMODE], a ld [wSpriteUnpackMode], a
.startDecompression .startDecompression
call ReadNextInputBit call ReadNextInputBit
and a and a
@ -146,69 +146,69 @@ UncompressSpriteDataLoop:: ; 2556 (0:2556)
; also cancels the calling function if the all output is done (by removing the return pointer from stack) ; also cancels the calling function if the all output is done (by removing the return pointer from stack)
; and calls postprocessing functions according to the unpack mode ; and calls postprocessing functions according to the unpack mode
MoveToNextBufferPosition:: ; 25d8 (0:25d8) MoveToNextBufferPosition:: ; 25d8 (0:25d8)
ld a, [W_SPRITEHEIGHT] ld a, [wSpriteHeight]
ld b, a ld b, a
ld a, [W_SPRITECURPOSY] ld a, [wSpriteCurPosY]
inc a inc a
cp b cp b
jr z, .curColumnDone jr z, .curColumnDone
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ld a, [W_SPRITEOUTPUTPTR] ld a, [wSpriteOutputPtr]
inc a inc a
ld [W_SPRITEOUTPUTPTR], a ld [wSpriteOutputPtr], a
ret nz ret nz
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
inc a inc a
ld [W_SPRITEOUTPUTPTR+1], a ld [wSpriteOutputPtr+1], a
ret ret
.curColumnDone .curColumnDone
xor a xor a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ld a, [W_SPRITEOUTPUTBITOFFSET] ld a, [wSpriteOutputBitOffset]
and a and a
jr z, .bitOffsetsDone jr z, .bitOffsetsDone
dec a dec a
ld [W_SPRITEOUTPUTBITOFFSET], a ld [wSpriteOutputBitOffset], a
ld hl, W_SPRITEOUTPUTPTRCACHED ld hl, wSpriteOutputPtrCached
ld a, [hli] ld a, [hli]
ld [W_SPRITEOUTPUTPTR], a ld [wSpriteOutputPtr], a
ld a, [hl] ld a, [hl]
ld [W_SPRITEOUTPUTPTR+1], a ld [wSpriteOutputPtr+1], a
ret ret
.bitOffsetsDone .bitOffsetsDone
ld a, $3 ld a, $3
ld [W_SPRITEOUTPUTBITOFFSET], a ld [wSpriteOutputBitOffset], a
ld a, [W_SPRITECURPOSX] ld a, [wSpriteCurPosX]
add $8 add $8
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld b, a ld b, a
ld a, [W_SPRITEWITDH] ld a, [wSpriteWidth]
cp b cp b
jr z, .allColumnsDone jr z, .allColumnsDone
ld a, [W_SPRITEOUTPUTPTR] ld a, [wSpriteOutputPtr]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
inc hl inc hl
jp StoreSpriteOutputPointer jp StoreSpriteOutputPointer
.allColumnsDone .allColumnsDone
pop hl pop hl
xor a xor a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld a, [W_SPRITELOADFLAGS] ld a, [wSpriteLoadFlags]
bit 1, a bit 1, a
jr nz, .done ; test if there is one more sprite to go jr nz, .done ; test if there is one more sprite to go
xor $1 xor $1
set 1, a set 1, a
ld [W_SPRITELOADFLAGS], a ld [wSpriteLoadFlags], a
jp UncompressSpriteDataLoop jp UncompressSpriteDataLoop
.done .done
jp UnpackSprite jp UnpackSprite
; writes 2 bits (from a) to the output buffer (pointed to from W_SPRITEOUTPUTPTR) ; writes 2 bits (from a) to the output buffer (pointed to from wSpriteOutputPtr)
WriteSpriteBitsToBuffer:: ; 2649 (0:2649) WriteSpriteBitsToBuffer:: ; 2649 (0:2649)
ld e, a ld e, a
ld a, [W_SPRITEOUTPUTBITOFFSET] ld a, [wSpriteOutputBitOffset]
and a and a
jr z, .offset0 jr z, .offset0
cp $2 cp $2
@ -224,9 +224,9 @@ WriteSpriteBitsToBuffer:: ; 2649 (0:2649)
.offset2 .offset2
swap e swap e
.offset0 .offset0
ld a, [W_SPRITEOUTPUTPTR] ld a, [wSpriteOutputPtr]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
ld a, [hl] ld a, [hl]
or e or e
@ -235,32 +235,32 @@ WriteSpriteBitsToBuffer:: ; 2649 (0:2649)
; reads next bit from input stream and returns it in a ; reads next bit from input stream and returns it in a
ReadNextInputBit:: ; 2670 (0:2670) ReadNextInputBit:: ; 2670 (0:2670)
ld a, [W_SPRITEINPUTBITCOUNTER] ld a, [wSpriteInputBitCounter]
dec a dec a
jr nz, .curByteHasMoreBitsToRead jr nz, .curByteHasMoreBitsToRead
call ReadNextInputByte call ReadNextInputByte
ld [W_SPRITEINPUTCURBYTE], a ld [wSpriteInputCurByte], a
ld a, $8 ld a, $8
.curByteHasMoreBitsToRead .curByteHasMoreBitsToRead
ld [W_SPRITEINPUTBITCOUNTER], a ld [wSpriteInputBitCounter], a
ld a, [W_SPRITEINPUTCURBYTE] ld a, [wSpriteInputCurByte]
rlca rlca
ld [W_SPRITEINPUTCURBYTE], a ld [wSpriteInputCurByte], a
and $1 and $1
ret ret
; reads next byte from input stream and returns it in a ; reads next byte from input stream and returns it in a
ReadNextInputByte:: ; 268b (0:268b) ReadNextInputByte:: ; 268b (0:268b)
ld a, [W_SPRITEINPUTPTR] ld a, [wSpriteInputPtr]
ld l, a ld l, a
ld a, [W_SPRITEINPUTPTR+1] ld a, [wSpriteInputPtr+1]
ld h, a ld h, a
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld a, l ld a, l
ld [W_SPRITEINPUTPTR], a ld [wSpriteInputPtr], a
ld a, h ld a, h
ld [W_SPRITEINPUTPTR+1], a ld [wSpriteInputPtr+1], a
ld a, b ld a, b
ret ret
@ -285,7 +285,7 @@ LengthEncodingOffsetList:: ; 269f (0:269f)
; unpacks the sprite data depending on the unpack mode ; unpacks the sprite data depending on the unpack mode
UnpackSprite:: ; 26bf (0:26bf) UnpackSprite:: ; 26bf (0:26bf)
ld a, [W_SPRITEUNPACKMODE] ld a, [wSpriteUnpackMode]
cp $2 cp $2
jp z, UnpackSpriteMode2 jp z, UnpackSpriteMode2
and a and a
@ -299,10 +299,10 @@ UnpackSprite:: ; 26bf (0:26bf)
; input bit value 0 preserves the current bit value and input bit value 1 toggles it (starting from initial value 0). ; input bit value 0 preserves the current bit value and input bit value 1 toggles it (starting from initial value 0).
SpriteDifferentialDecode:: ; 26d4 (0:26d4) SpriteDifferentialDecode:: ; 26d4 (0:26d4)
xor a xor a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
call StoreSpriteOutputPointer call StoreSpriteOutputPointer
ld a, [W_SPRITEFLIPPED] ld a, [wSpriteFlipped]
and a and a
jr z, .notFlipped jr z, .notFlipped
ld hl, DecodeNybble0TableFlipped ld hl, DecodeNybble0TableFlipped
@ -313,18 +313,18 @@ SpriteDifferentialDecode:: ; 26d4 (0:26d4)
ld de, DecodeNybble1Table ld de, DecodeNybble1Table
.storeDecodeTablesPointers .storeDecodeTablesPointers
ld a, l ld a, l
ld [W_SPRITEDECODETABLE0PTR], a ld [wSpriteDecodeTable0Ptr], a
ld a, h ld a, h
ld [W_SPRITEDECODETABLE0PTR+1], a ld [wSpriteDecodeTable0Ptr+1], a
ld a, e ld a, e
ld [W_SPRITEDECODETABLE1PTR], a ld [wSpriteDecodeTable1Ptr], a
ld a, d ld a, d
ld [W_SPRITEDECODETABLE1PTR+1], a ld [wSpriteDecodeTable1Ptr+1], a
ld e, $0 ; last decoded nybble, initialized to 0 ld e, $0 ; last decoded nybble, initialized to 0
.decodeNextByteLoop .decodeNextByteLoop
ld a, [W_SPRITEOUTPUTPTR] ld a, [wSpriteOutputPtr]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
ld a, [hl] ld a, [hl]
ld b, a ld b, a
@ -338,47 +338,47 @@ SpriteDifferentialDecode:: ; 26d4 (0:26d4)
call DifferentialDecodeNybble ; decode low nybble call DifferentialDecodeNybble ; decode low nybble
or d or d
ld b, a ld b, a
ld a, [W_SPRITEOUTPUTPTR] ld a, [wSpriteOutputPtr]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
ld a, b ld a, b
ld [hl], a ; write back decoded data ld [hl], a ; write back decoded data
ld a, [W_SPRITEHEIGHT] ld a, [wSpriteHeight]
add l ; move on to next column add l ; move on to next column
jr nc, .noCarry jr nc, .noCarry
inc h inc h
.noCarry .noCarry
ld [W_SPRITEOUTPUTPTR], a ld [wSpriteOutputPtr], a
ld a, h ld a, h
ld [W_SPRITEOUTPUTPTR+1], a ld [wSpriteOutputPtr+1], a
ld a, [W_SPRITECURPOSX] ld a, [wSpriteCurPosX]
add $8 add $8
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld b, a ld b, a
ld a, [W_SPRITEWITDH] ld a, [wSpriteWidth]
cp b cp b
jr nz, .decodeNextByteLoop ; test if current row is done jr nz, .decodeNextByteLoop ; test if current row is done
xor a xor a
ld e, a ld e, a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld a, [W_SPRITECURPOSY] ; move on to next row ld a, [wSpriteCurPosY] ; move on to next row
inc a inc a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ld b, a ld b, a
ld a, [W_SPRITEHEIGHT] ld a, [wSpriteHeight]
cp b cp b
jr z, .done ; test if all rows finished jr z, .done ; test if all rows finished
ld a, [W_SPRITEOUTPUTPTRCACHED] ld a, [wSpriteOutputPtrCached]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTRCACHED+1] ld a, [wSpriteOutputPtrCached+1]
ld h, a ld h, a
inc hl inc hl
call StoreSpriteOutputPointer call StoreSpriteOutputPointer
jr .decodeNextByteLoop jr .decodeNextByteLoop
.done .done
xor a xor a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ret ret
; decodes the nybble stored in a. Last decoded data is assumed to be in e (needed to determine if initial value is 0 or 1) ; decodes the nybble stored in a. Last decoded data is assumed to be in e (needed to determine if initial value is 0 or 1)
@ -389,7 +389,7 @@ DifferentialDecodeNybble:: ; 276d (0:276d)
ld c, $1 ld c, $1
.evenNumber .evenNumber
ld l, a ld l, a
ld a, [W_SPRITEFLIPPED] ld a, [wSpriteFlipped]
and a and a
jr z, .notFlipped ; determine if initial value is 0 or one jr z, .notFlipped ; determine if initial value is 0 or one
bit 3, e ; if flipped, consider MSB of last data bit 3, e ; if flipped, consider MSB of last data
@ -399,14 +399,14 @@ DifferentialDecodeNybble:: ; 276d (0:276d)
.selectLookupTable .selectLookupTable
ld e, l ld e, l
jr nz, .initialValue1 ; load the appropriate table jr nz, .initialValue1 ; load the appropriate table
ld a, [W_SPRITEDECODETABLE0PTR] ld a, [wSpriteDecodeTable0Ptr]
ld l, a ld l, a
ld a, [W_SPRITEDECODETABLE0PTR+1] ld a, [wSpriteDecodeTable0Ptr+1]
jr .tableLookup jr .tableLookup
.initialValue1 .initialValue1
ld a, [W_SPRITEDECODETABLE1PTR] ld a, [wSpriteDecodeTable1Ptr]
ld l, a ld l, a
ld a, [W_SPRITEDECODETABLE1PTR+1] ld a, [wSpriteDecodeTable1Ptr+1]
.tableLookup .tableLookup
ld h, a ld h, a
ld a, e ld a, e
@ -464,25 +464,25 @@ DecodeNybble1TableFlipped:: ; 27bf (0:27bf)
; combines the two loaded chunks with xor (the chunk loaded second is the destination). The source chunk is differeintial decoded beforehand. ; combines the two loaded chunks with xor (the chunk loaded second is the destination). The source chunk is differeintial decoded beforehand.
XorSpriteChunks:: ; 27c7 (0:27c7) XorSpriteChunks:: ; 27c7 (0:27c7)
xor a xor a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
call ResetSpriteBufferPointers call ResetSpriteBufferPointers
ld a, [W_SPRITEOUTPUTPTR] ; points to buffer 1 or 2, depending on flags ld a, [wSpriteOutputPtr] ; points to buffer 1 or 2, depending on flags
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
call SpriteDifferentialDecode ; decode buffer 1 or 2, depending on flags call SpriteDifferentialDecode ; decode buffer 1 or 2, depending on flags
call ResetSpriteBufferPointers call ResetSpriteBufferPointers
ld a, [W_SPRITEOUTPUTPTR] ; source buffer, points to buffer 1 or 2, depending on flags ld a, [wSpriteOutputPtr] ; source buffer, points to buffer 1 or 2, depending on flags
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTR+1] ld a, [wSpriteOutputPtr+1]
ld h, a ld h, a
ld a, [W_SPRITEOUTPUTPTRCACHED] ; destination buffer, points to buffer 2 or 1, depending on flags ld a, [wSpriteOutputPtrCached] ; destination buffer, points to buffer 2 or 1, depending on flags
ld e, a ld e, a
ld a, [W_SPRITEOUTPUTPTRCACHED+1] ld a, [wSpriteOutputPtrCached+1]
ld d, a ld d, a
.xorChunksLoop .xorChunksLoop
ld a, [W_SPRITEFLIPPED] ld a, [wSpriteFlipped]
and a and a
jr z, .notFlipped jr z, .notFlipped
push de push de
@ -506,24 +506,24 @@ XorSpriteChunks:: ; 27c7 (0:27c7)
xor b xor b
ld [de], a ld [de], a
inc de inc de
ld a, [W_SPRITECURPOSY] ld a, [wSpriteCurPosY]
inc a inc a
ld [W_SPRITECURPOSY], a ; go to next row ld [wSpriteCurPosY], a ; go to next row
ld b, a ld b, a
ld a, [W_SPRITEHEIGHT] ld a, [wSpriteHeight]
cp b cp b
jr nz, .xorChunksLoop ; test if column finished jr nz, .xorChunksLoop ; test if column finished
xor a xor a
ld [W_SPRITECURPOSY], a ld [wSpriteCurPosY], a
ld a, [W_SPRITECURPOSX] ld a, [wSpriteCurPosX]
add $8 add $8
ld [W_SPRITECURPOSX], a ; go to next column ld [wSpriteCurPosX], a ; go to next column
ld b, a ld b, a
ld a, [W_SPRITEWITDH] ld a, [wSpriteWidth]
cp b cp b
jr nz, .xorChunksLoop ; test if all columns finished jr nz, .xorChunksLoop ; test if all columns finished
xor a xor a
ld [W_SPRITECURPOSX], a ld [wSpriteCurPosX], a
ret ret
; reverses the bits in the nybble given in register a ; reverses the bits in the nybble given in register a
@ -537,9 +537,9 @@ ReverseNybble:: ; 2837 (0:2837)
ld a, [de] ld a, [de]
ret ret
; resets sprite buffer pointers to buffer 1 and 2, depending on W_SPRITELOADFLAGS ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags
ResetSpriteBufferPointers:: ; 2841 (0:2841) ResetSpriteBufferPointers:: ; 2841 (0:2841)
ld a, [W_SPRITELOADFLAGS] ld a, [wSpriteLoadFlags]
bit 0, a bit 0, a
jr nz, .buffer2Selected jr nz, .buffer2Selected
ld de, S_SPRITEBUFFER1 ld de, S_SPRITEBUFFER1
@ -550,13 +550,13 @@ ResetSpriteBufferPointers:: ; 2841 (0:2841)
ld hl, S_SPRITEBUFFER1 ld hl, S_SPRITEBUFFER1
.storeBufferPointers .storeBufferPointers
ld a, l ld a, l
ld [W_SPRITEOUTPUTPTR], a ld [wSpriteOutputPtr], a
ld a, h ld a, h
ld [W_SPRITEOUTPUTPTR+1], a ld [wSpriteOutputPtr+1], a
ld a, e ld a, e
ld [W_SPRITEOUTPUTPTRCACHED], a ld [wSpriteOutputPtrCached], a
ld a, d ld a, d
ld [W_SPRITEOUTPUTPTRCACHED+1], a ld [wSpriteOutputPtrCached+1], a
ret ret
; maps each nybble to its reverse ; maps each nybble to its reverse
@ -566,26 +566,26 @@ NybbleReverseTable:: ; 2867 (0:2867)
; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand. ; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand.
UnpackSpriteMode2:: ; 2877 (0:2877) UnpackSpriteMode2:: ; 2877 (0:2877)
call ResetSpriteBufferPointers call ResetSpriteBufferPointers
ld a, [W_SPRITEFLIPPED] ld a, [wSpriteFlipped]
push af push af
xor a xor a
ld [W_SPRITEFLIPPED], a ; temporarily clear flipped flag for decoding the destination chunk ld [wSpriteFlipped], a ; temporarily clear flipped flag for decoding the destination chunk
ld a, [W_SPRITEOUTPUTPTRCACHED] ld a, [wSpriteOutputPtrCached]
ld l, a ld l, a
ld a, [W_SPRITEOUTPUTPTRCACHED+1] ld a, [wSpriteOutputPtrCached+1]
ld h, a ld h, a
call SpriteDifferentialDecode call SpriteDifferentialDecode
call ResetSpriteBufferPointers call ResetSpriteBufferPointers
pop af pop af
ld [W_SPRITEFLIPPED], a ld [wSpriteFlipped], a
jp XorSpriteChunks jp XorSpriteChunks
; stores hl into the output pointers ; stores hl into the output pointers
StoreSpriteOutputPointer:: ; 2897 (0:2897) StoreSpriteOutputPointer:: ; 2897 (0:2897)
ld a, l ld a, l
ld [W_SPRITEOUTPUTPTR], a ld [wSpriteOutputPtr], a
ld [W_SPRITEOUTPUTPTRCACHED], a ld [wSpriteOutputPtrCached], a
ld a, h ld a, h
ld [W_SPRITEOUTPUTPTR+1], a ld [wSpriteOutputPtr+1], a
ld [W_SPRITEOUTPUTPTRCACHED+1], a ld [wSpriteOutputPtrCached+1], a
ret ret

View file

@ -146,7 +146,7 @@ Char52:: ; 0x19f9 players name
Char53:: ; 19ff (0:19ff) ; rivals name Char53:: ; 19ff (0:19ff) ; rivals name
push de push de
ld de,W_RIVALNAME ld de,wRivalName
jr FinishDTE jr FinishDTE
Char5D:: ; 1a05 (0:1a05) ; TRAINER Char5D:: ; 1a05 (0:1a05) ; TRAINER

176
main.asm
View file

@ -24,7 +24,7 @@ ResetStatusAndHalveMoneyOnBlackout::
xor a xor a
ld [wBattleResult], a ld [wBattleResult], a
ld [wWalkBikeSurfState], a ld [wWalkBikeSurfState], a
ld [W_ISINBATTLE], a ld [wIsInBattle], a
ld [wMapPalOffset], a ld [wMapPalOffset], a
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ld [hJoyHeld], a ld [hJoyHeld], a
@ -86,7 +86,7 @@ LoadMonData_:
; 2: boxmon ; 2: boxmon
; 3: daycaremon ; 3: daycaremon
; Return monster id at wcf91 and its data at wLoadedMon. ; Return monster id at wcf91 and its data at wLoadedMon.
; Also load base stats at W_MONHEADER for convenience. ; Also load base stats at wMonHeader for convenience.
ld a, [wDayCareMonSpecies] ld a, [wDayCareMonSpecies]
ld [wcf91], a ld [wcf91], a
@ -161,7 +161,7 @@ PrintWaitingText:
coord hl, 3, 10 coord hl, 3, 10
ld b, $1 ld b, $1
ld c, $b ld c, $b
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a and a
jr z, .asm_4c17 jr z, .asm_4c17
call TextBoxBorder call TextBoxBorder
@ -545,9 +545,9 @@ TestBattle:
; Don't mess around ; Don't mess around
; with obedience. ; with obedience.
ld a, %10000000 ; EARTHBADGE ld a, %10000000 ; EARTHBADGE
ld [W_OBTAINEDBADGES], a ld [wObtainedBadges], a
ld hl, W_FLAGS_D733 ld hl, wFlags_D733
set BIT_TEST_BATTLE, [hl] set BIT_TEST_BATTLE, [hl]
; Reset the party. ; Reset the party.
@ -562,16 +562,16 @@ TestBattle:
ld a, RHYDON ld a, RHYDON
ld [wcf91], a ld [wcf91], a
ld a, 20 ld a, 20
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
xor a xor a
ld [wMonDataLocation], a ld [wMonDataLocation], a
ld [W_CURMAP], a ld [wCurMap], a
call AddPartyMon call AddPartyMon
; Fight against a ; Fight against a
; level 20 Rhydon. ; level 20 Rhydon.
ld a, RHYDON ld a, RHYDON
ld [W_CUROPPONENT], a ld [wCurOpponent], a
predef InitOpponent predef InitOpponent
@ -655,7 +655,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
jr nz, .notFirstMap jr nz, .notFirstMap
ld hl, FirstMapSpec ld hl, FirstMapSpec
.copyWarpData .copyWarpData
ld de, W_CURMAP ld de, wCurMap
ld c, $7 ld c, $7
.copyWarpDataLoop .copyWarpDataLoop
ld a, [hli] ld a, [hli]
@ -664,7 +664,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
dec c dec c
jr nz, .copyWarpDataLoop jr nz, .copyWarpDataLoop
ld a, [hli] ld a, [hli]
ld [W_CURMAPTILESET], a ld [wCurMapTileset], a
xor a xor a
jr .done jr .done
.notFirstMap .notFirstMap
@ -683,7 +683,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
res 4, [hl] res 4, [hl]
ld a, [wDungeonWarpDestinationMap] ld a, [wDungeonWarpDestinationMap]
ld b, a ld b, a
ld [W_CURMAP], a ld [wCurMap], a
ld a, [wWhichDungeonWarp] ld a, [wWhichDungeonWarp]
ld c, a ld c, a
ld hl, DungeonWarpList ld hl, DungeonWarpList
@ -713,7 +713,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
ld a, [wDestinationMap] ld a, [wDestinationMap]
.usedFlyWarp .usedFlyWarp
ld b, a ld b, a
ld [W_CURMAP], a ld [wCurMap], a
ld hl, FlyWarpDataPtr ld hl, FlyWarpDataPtr
.flyWarpDataPtrLoop .flyWarpDataPtrLoop
ld a, [hli] ld a, [hli]
@ -737,7 +737,7 @@ LoadSpecialWarpData: ; 62ff (1:62ff)
dec c dec c
jr nz, .copyWarpDataLoop2 jr nz, .copyWarpDataLoop2
xor a ; OVERWORLD xor a ; OVERWORLD
ld [W_CURMAPTILESET], a ld [wCurMapTileset], a
.done .done
ld [wYOffsetSinceLastSpecialWarp], a ld [wYOffsetSinceLastSpecialWarp], a
ld [wXOffsetSinceLastSpecialWarp], a ld [wXOffsetSinceLastSpecialWarp], a
@ -765,7 +765,7 @@ SetIshiharaTeam: ; 64ca (1:64ca)
ld [wcf91], a ld [wcf91], a
inc de inc de
ld a, [de] ld a, [de]
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
inc de inc de
call AddPartyMon call AddPartyMon
jr .loop jr .loop
@ -966,7 +966,7 @@ SetLastBlackoutMap:
push hl push hl
ld hl, SafariZoneRestHouses ld hl, SafariZoneRestHouses
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
.loop .loop
ld a, [hli] ld a, [hli]
@ -1931,7 +1931,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
ld a, [wRemoveMonFromBox] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7b74 jr z, .asm_7b74
ld hl, W_NUMINBOX ld hl, wNumInBox
.asm_7b74 .asm_7b74
ld a, [hl] ld a, [hl]
dec a dec a
@ -2058,7 +2058,7 @@ ClearVariablesAfterLoadingMapData: ; c335 (3:4335)
xor a xor a
ld [H_AUTOBGTRANSFERENABLED], a ld [H_AUTOBGTRANSFERENABLED], a
ld [wStepCounter], a ld [wStepCounter], a
ld [W_LONEATTACKNO], a ld [wLoneAttackNo], a
ld [hJoyPressed], a ld [hJoyPressed], a
ld [hJoyReleased], a ld [hJoyReleased], a
ld [hJoyHeld], a ld [hJoyHeld], a
@ -2080,11 +2080,11 @@ IsPlayerStandingOnWarp: ; c35f (3:435f)
ld c, a ld c, a
ld hl, wWarpEntries ld hl, wWarpEntries
.loop .loop
ld a, [W_YCOORD] ld a, [wYCoord]
cp [hl] cp [hl]
jr nz, .nextWarp1 jr nz, .nextWarp1
inc hl inc hl
ld a, [W_XCOORD] ld a, [wXCoord]
cp [hl] cp [hl]
jr nz, .nextWarp2 jr nz, .nextWarp2
inc hl inc hl
@ -2110,11 +2110,11 @@ CheckForceBikeOrSurf: ; c38b (3:438b)
bit 5, [hl] bit 5, [hl]
ret nz ret nz
ld hl, ForcedBikeOrSurfMaps ld hl, ForcedBikeOrSurfMaps
ld a, [W_YCOORD] ld a, [wYCoord]
ld b, a ld b, a
ld a, [W_XCOORD] ld a, [wXCoord]
ld c, a ld c, a
ld a, [W_CURMAP] ld a, [wCurMap]
ld d, a ld d, a
.loop .loop
ld a, [hli] ld a, [hli]
@ -2128,15 +2128,15 @@ CheckForceBikeOrSurf: ; c38b (3:438b)
ld a, [hli] ld a, [hli]
cp c ;compare x-coord cp c ;compare x-coord
jr nz, .loop ; incorrect x-coord, check next item jr nz, .loop ; incorrect x-coord, check next item
ld a, [W_CURMAP] ld a, [wCurMap]
cp SEAFOAM_ISLANDS_4 cp SEAFOAM_ISLANDS_4
ld a, $2 ld a, $2
ld [W_SEAFOAMISLANDS4CURSCRIPT], a ld [wSeafoamIslands4CurScript], a
jr z, .forceSurfing jr z, .forceSurfing
ld a, [W_CURMAP] ld a, [wCurMap]
cp SEAFOAM_ISLANDS_5 cp SEAFOAM_ISLANDS_5
ld a, $2 ld a, $2
ld [W_SEAFOAMISLANDS5CURSCRIPT], a ld [wSeafoamIslands5CurScript], a
jr z, .forceSurfing jr z, .forceSurfing
;force bike riding ;force bike riding
ld hl, wd732 ld hl, wd732
@ -2171,9 +2171,9 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [W_YCOORD] ld a, [wYCoord]
ld b, a ld b, a
ld a, [W_XCOORD] ld a, [wXCoord]
ld c, a ld c, a
ld de, .asm_c41e ld de, .asm_c41e
push de push de
@ -2191,7 +2191,7 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
dw .facingRight dw .facingRight
.facingDown .facingDown
ld a, [W_CURMAPHEIGHT] ld a, [wCurMapHeight]
add a add a
dec a dec a
cp b cp b
@ -2211,7 +2211,7 @@ IsPlayerFacingEdgeOfMap: ; c3ff (3:43ff)
jr .resetCarry jr .resetCarry
.facingRight .facingRight
ld a, [W_CURMAPWIDTH] ld a, [wCurMapWidth]
add a add a
dec a dec a
cp c cp c
@ -2229,7 +2229,7 @@ IsWarpTileInFrontOfPlayer: ; c44e (3:444e)
push de push de
push bc push bc
call _GetTileAndCoordsInFrontOfPlayer call _GetTileAndCoordsInFrontOfPlayer
ld a, [W_CURMAP] ld a, [wCurMap]
cp SS_ANNE_5 cp SS_ANNE_5
jr z, .ssAnne5 jr z, .ssAnne5
ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
@ -2284,7 +2284,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c49d (3:449d)
push bc push bc
callba IsPlayerStandingOnDoorTile callba IsPlayerStandingOnDoorTile
jr c, .done jr c, .done
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
add a add a
ld c, a ld c, a
ld b, $0 ld b, $0
@ -2308,7 +2308,7 @@ IsPlayerStandingOnDoorTileOrWarpTile: ; c49d (3:449d)
INCLUDE "data/warp_tile_ids.asm" INCLUDE "data/warp_tile_ids.asm"
PrintSafariZoneSteps: ; c52f (3:452f) PrintSafariZoneSteps: ; c52f (3:452f)
ld a, [W_CURMAP] ld a, [wCurMap]
cp SAFARI_ZONE_EAST cp SAFARI_ZONE_EAST
ret c ret c
cp UNKNOWN_DUNGEON_2 cp UNKNOWN_DUNGEON_2
@ -2327,7 +2327,7 @@ PrintSafariZoneSteps: ; c52f (3:452f)
coord hl, 1, 3 coord hl, 1, 3
ld de, SafariBallText ld de, SafariBallText
call PlaceString call PlaceString
ld a, [W_NUMSAFARIBALLS] ld a, [wNumSafariBalls]
cp 10 cp 10
jr nc, .asm_c56d jr nc, .asm_c56d
coord hl, 5, 3 coord hl, 5, 3
@ -2335,7 +2335,7 @@ PrintSafariZoneSteps: ; c52f (3:452f)
ld [hl], a ld [hl], a
.asm_c56d .asm_c56d
coord hl, 6, 3 coord hl, 6, 3
ld de, W_NUMSAFARIBALLS ld de, wNumSafariBalls
lb bc, 1, 2 lb bc, 1, 2
jp PrintNumber jp PrintNumber
@ -2349,9 +2349,9 @@ GetTileAndCoordsInFrontOfPlayer: ; c586 (3:4586)
call GetPredefRegisters call GetPredefRegisters
_GetTileAndCoordsInFrontOfPlayer: ; c589 (3:4589) _GetTileAndCoordsInFrontOfPlayer: ; c589 (3:4589)
ld a, [W_YCOORD] ld a, [wYCoord]
ld d, a ld d, a
ld a, [W_XCOORD] ld a, [wXCoord]
ld e, a ld e, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
@ -2388,7 +2388,7 @@ _GetTileAndCoordsInFrontOfPlayer: ; c589 (3:4589)
GetTileTwoStepsInFrontOfPlayer: ; c5be (3:45be) GetTileTwoStepsInFrontOfPlayer: ; c5be (3:45be)
xor a xor a
ld [$ffdb], a ld [$ffdb], a
ld hl, W_YCOORD ld hl, wYCoord
ld a, [hli] ld a, [hli]
ld d, a ld d, a
ld e, [hl] ld e, [hl]
@ -2435,7 +2435,7 @@ GetTileTwoStepsInFrontOfPlayer: ; c5be (3:45be)
CheckForCollisionWhenPushingBoulder: ; c60b (3:460b) CheckForCollisionWhenPushingBoulder: ; c60b (3:460b)
call GetTileTwoStepsInFrontOfPlayer call GetTileTwoStepsInFrontOfPlayer
ld hl, W_TILESETCOLLISIONPTR ld hl, wTileSetCollisionPtr
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -2471,7 +2471,7 @@ CheckForBoulderCollisionWithSprites: ; c636 (3:4636)
ld [$ffdc], a ld [$ffdc], a
ld a, [hl] ; map X position ld a, [hl] ; map X position
ld [$ffdd], a ld [$ffdd], a
ld a, [W_NUMSPRITES] ld a, [wNumSprites]
ld c, a ld c, a
ld de, $f ld de, $f
ld hl, wSpriteStateData2 + $14 ld hl, wSpriteStateData2 + $14
@ -2653,7 +2653,7 @@ LoadTilesetHeader: ; c754 (3:4754)
call GetPredefRegisters call GetPredefRegisters
push hl push hl
ld d, 0 ld d, 0
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
add a add a
add a add a
ld b, a ld b, a
@ -2665,7 +2665,7 @@ LoadTilesetHeader: ; c754 (3:4754)
ld e, a ld e, a
ld hl, Tilesets ld hl, Tilesets
add hl, de add hl, de
ld de, W_TILESETBANK ld de, wTileSetBank
ld c, $b ld c, $b
.copyTilesetHeaderLoop .copyTilesetHeaderLoop
ld a, [hli] ld a, [hli]
@ -2678,7 +2678,7 @@ LoadTilesetHeader: ; c754 (3:4754)
xor a xor a
ld [$ffd8], a ld [$ffd8], a
pop hl pop hl
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
push hl push hl
push de push de
ld hl, DungeonTilesets ld hl, DungeonTilesets
@ -2687,7 +2687,7 @@ LoadTilesetHeader: ; c754 (3:4754)
pop de pop de
pop hl pop hl
jr c, .asm_c797 jr c, .asm_c797
ld a, [W_CURMAPTILESET] ld a, [wCurMapTileset]
ld b, a ld b, a
ld a, [hPreviousTileset] ld a, [hPreviousTileset]
cp b cp b
@ -2697,12 +2697,12 @@ LoadTilesetHeader: ; c754 (3:4754)
cp $ff cp $ff
jr z, .done jr z, .done
call LoadDestinationWarpPosition call LoadDestinationWarpPosition
ld a, [W_YCOORD] ld a, [wYCoord]
and $1 and $1
ld [W_YBLOCKCOORD], a ld [wYBlockCoord], a
ld a, [W_XCOORD] ld a, [wXCoord]
and $1 and $1
ld [W_XBLOCKCOORD], a ld [wXBlockCoord], a
.done .done
ret ret
@ -2711,7 +2711,7 @@ INCLUDE "data/dungeon_tilesets.asm"
INCLUDE "data/tileset_headers.asm" INCLUDE "data/tileset_headers.asm"
IncrementDayCareMonExp: ; c8de (3:48de) IncrementDayCareMonExp: ; c8de (3:48de)
ld a, [W_DAYCARE_IN_USE] ld a, [wDayCareInUse]
and a and a
ret z ret z
ld hl, wDayCareMonExp + 2 ld hl, wDayCareMonExp + 2
@ -2760,7 +2760,7 @@ IsSurfingAllowed: ; cdc0 (3:4dc0)
ld a, [wd732] ld a, [wd732]
bit 5, a bit 5, a
jr nz, .forcedToRideBike jr nz, .forcedToRideBike
ld a, [W_CURMAP] ld a, [wCurMap]
cp SEAFOAM_ISLANDS_5 cp SEAFOAM_ISLANDS_5
ret nz ret nz
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
@ -2944,7 +2944,7 @@ RemoveItemFromInventory_: ; ce74 (3:4e74)
LoadWildData: ; ceb8 (3:4eb8) LoadWildData: ; ceb8 (3:4eb8)
ld hl,WildDataPointers ld hl,WildDataPointers
ld a,[W_CURMAP] ld a,[wCurMap]
; get wild data for current map ; get wild data for current map
ld c,a ld c,a
@ -2955,11 +2955,11 @@ LoadWildData: ; ceb8 (3:4eb8)
ld h,[hl] ld h,[hl]
ld l,a ; hl now points to wild data for current map ld l,a ; hl now points to wild data for current map
ld a,[hli] ld a,[hli]
ld [W_GRASSRATE],a ld [wGrassRate],a
and a and a
jr z,.NoGrassData ; if no grass data, skip to surfing data jr z,.NoGrassData ; if no grass data, skip to surfing data
push hl push hl
ld de,W_GRASSMONS ; otherwise, load grass data ld de,wGrassMons ; otherwise, load grass data
ld bc,$0014 ld bc,$0014
call CopyData call CopyData
pop hl pop hl
@ -3000,7 +3000,7 @@ DrawBadges: ; ea03 (3:6a03)
; Alter these based on owned badges. ; Alter these based on owned badges.
ld de, wTempObtainedBadgesBooleans ld de, wTempObtainedBadgesBooleans
ld hl, wBadgeOrFaceTiles ld hl, wBadgeOrFaceTiles
ld a, [W_OBTAINEDBADGES] ld a, [wObtainedBadges]
ld b, a ld b, a
ld c, 8 ld c, 8
.CheckBadge .CheckBadge
@ -3106,7 +3106,7 @@ GymLeaderFaceAndBadgeTileGraphics: ; ea9e (3:6a9e)
ReplaceTileBlock: ; ee9e (3:6e9e) ReplaceTileBlock: ; ee9e (3:6e9e)
call GetPredefRegisters call GetPredefRegisters
ld hl, wOverworldMap ld hl, wOverworldMap
ld a, [W_CURMAPWIDTH] ld a, [wCurMapWidth]
add $6 add $6
ld e, a ld e, a
ld d, $0 ld d, $0
@ -3148,7 +3148,7 @@ ReplaceTileBlock: ; ee9e (3:6e9e)
ret c ; return if the replaced tile block is above the map view in memory ret c ; return if the replaced tile block is above the map view in memory
RedrawMapView: ; eedc (3:6edc) RedrawMapView: ; eedc (3:6edc)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
inc a inc a
ret z ret z
ld a, [H_AUTOBGTRANSFERENABLED] ld a, [H_AUTOBGTRANSFERENABLED]
@ -3229,16 +3229,16 @@ CompareHLWithBC: ; ef4e (3:6f4e)
INCLUDE "engine/overworld/cut.asm" INCLUDE "engine/overworld/cut.asm"
MarkTownVisitedAndLoadMissableObjects: ; f113 (3:7113) MarkTownVisitedAndLoadMissableObjects: ; f113 (3:7113)
ld a, [W_CURMAP] ld a, [wCurMap]
cp ROUTE_1 cp ROUTE_1
jr nc, .notInTown jr nc, .notInTown
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
ld hl, W_TOWNVISITEDFLAG ; mark town as visited (for flying) ld hl, wTownVisitedFlag ; mark town as visited (for flying)
predef FlagActionPredef predef FlagActionPredef
.notInTown .notInTown
ld hl, MapHSPointers ld hl, MapHSPointers
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, $0 ld b, $0
ld c, a ld c, a
add hl, bc add hl, bc
@ -3271,11 +3271,11 @@ LoadMissableObjects: ; f132 (3:7132)
ld [H_DIVISOR], a ld [H_DIVISOR], a
ld b, $2 ld b, $2
call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours)
ld a, [W_CURMAP] ld a, [wCurMap]
ld b, a ld b, a
ld a, [H_DIVIDEND+3] ld a, [H_DIVIDEND+3]
ld c, a ; store global offset in c ld c, a ; store global offset in c
ld de, W_MISSABLEOBJECTLIST ld de, wMissableObjectList
pop hl pop hl
.writeMissableObjectsListLoop .writeMissableObjectsListLoop
ld a, [hli] ld a, [hli]
@ -3298,8 +3298,8 @@ LoadMissableObjects: ; f132 (3:7132)
ret ret
InitializeMissableObjectsFlags: ; f175 (3:7175) InitializeMissableObjectsFlags: ; f175 (3:7175)
ld hl, W_MISSABLEOBJECTFLAGS ld hl, wMissableObjectFlags
ld bc, wMissableObjectFlagsEnd - W_MISSABLEOBJECTFLAGS ld bc, wMissableObjectFlagsEnd - wMissableObjectFlags
xor a xor a
call FillMemory ; clear missable objects flags call FillMemory ; clear missable objects flags
ld hl, MapHS00 ld hl, MapHS00
@ -3314,7 +3314,7 @@ InitializeMissableObjectsFlags: ; f175 (3:7175)
ld a, [hl] ld a, [hl]
cp Hide cp Hide
jr nz, .skip jr nz, .skip
ld hl, W_MISSABLEOBJECTFLAGS ld hl, wMissableObjectFlags
ld a, [wMissableObjectCounter] ld a, [wMissableObjectCounter]
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
@ -3332,7 +3332,7 @@ IsObjectHidden: ; f1a6 (3:71a6)
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
swap a swap a
ld b, a ld b, a
ld hl, W_MISSABLEOBJECTLIST ld hl, wMissableObjectList
.loop .loop
ld a, [hli] ld a, [hli]
cp $ff cp $ff
@ -3342,7 +3342,7 @@ IsObjectHidden: ; f1a6 (3:71a6)
jr nz, .loop jr nz, .loop
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST
ld hl, W_MISSABLEOBJECTFLAGS ld hl, wMissableObjectFlags
call MissableObjectFlagAction call MissableObjectFlagAction
ld a, c ld a, c
and a and a
@ -3357,7 +3357,7 @@ IsObjectHidden: ; f1a6 (3:71a6)
; [wMissableObjectIndex]: index of the missable object to be added (global index) ; [wMissableObjectIndex]: index of the missable object to be added (global index)
ShowObject: ; f1c8 (3:71c8) ShowObject: ; f1c8 (3:71c8)
ShowObject2: ShowObject2:
ld hl, W_MISSABLEOBJECTFLAGS ld hl, wMissableObjectFlags
ld a, [wMissableObjectIndex] ld a, [wMissableObjectIndex]
ld c, a ld c, a
ld b, FLAG_RESET ld b, FLAG_RESET
@ -3367,7 +3367,7 @@ ShowObject2:
; removes missable object (items, leg. pokemon, etc.) from the map ; removes missable object (items, leg. pokemon, etc.) from the map
; [wMissableObjectIndex]: index of the missable object to be removed (global index) ; [wMissableObjectIndex]: index of the missable object to be removed (global index)
HideObject: ; f1d7 (3:71d7) HideObject: ; f1d7 (3:71d7)
ld hl, W_MISSABLEOBJECTFLAGS ld hl, wMissableObjectFlags
ld a, [wMissableObjectIndex] ld a, [wMissableObjectIndex]
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
@ -3619,7 +3619,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
ld a, [wcf91] ld a, [wcf91]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld hl, W_MONHEADER ld hl, wMonHeader
ld a, [hli] ld a, [hli]
ld [de], a ; species ld [de], a ; species
inc de inc de
@ -3658,7 +3658,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
pop hl pop hl
push hl push hl
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
and a ; is this a wild mon caught in battle? and a ; is this a wild mon caught in battle?
jr nz, .copyEnemyMonData jr nz, .copyEnemyMonData
@ -3713,7 +3713,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
ld [de], a ld [de], a
inc de inc de
.copyMonTypesAndMoves .copyMonTypesAndMoves
ld hl, W_MONHTYPES ld hl, wMonHTypes
ld a, [hli] ; type 1 ld a, [hli] ; type 1
ld [de], a ld [de], a
inc de inc de
@ -3722,7 +3722,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
inc de inc de
ld a, [hli] ; catch rate (held item in gen 2) ld a, [hli] ; catch rate (held item in gen 2)
ld [de], a ld [de], a
ld hl, W_MONHMOVES ld hl, wMonHMoves
ld a, [hli] ld a, [hli]
inc de inc de
push de push de
@ -3751,7 +3751,7 @@ _AddPartyMon: ; f2e5 (3:72e5)
inc de inc de
ld [de], a ld [de], a
push de push de
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
ld d, a ld d, a
callab CalcExperience callab CalcExperience
pop de pop de
@ -3776,10 +3776,10 @@ _AddPartyMon: ; f2e5 (3:72e5)
pop hl pop hl
call AddPartyMon_WriteMovePP call AddPartyMon_WriteMovePP
inc de inc de
ld a, [W_CURENEMYLVL] ld a, [wCurEnemyLVL]
ld [de], a ld [de], a
inc de inc de
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
dec a dec a
jr nz, .calcFreshStats jr nz, .calcFreshStats
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
@ -3899,7 +3899,7 @@ _MoveMon: ; f51e (3:751e)
cp PARTY_TO_DAYCARE cp PARTY_TO_DAYCARE
ld hl, wDayCareMon ld hl, wDayCareMon
jr z, .asm_f575 jr z, .asm_f575
ld hl, W_NUMINBOX ld hl, wNumInBox
ld a, [hl] ld a, [hl]
cp MONS_PER_BOX cp MONS_PER_BOX
jr nz, .partyOrBoxNotFull jr nz, .partyOrBoxNotFull
@ -3934,7 +3934,7 @@ _MoveMon: ; f51e (3:751e)
jr nz, .skipToNewMonEntry jr nz, .skipToNewMonEntry
ld hl, wBoxMons ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21 ld bc, wBoxMon2 - wBoxMon1 ; $21
ld a, [W_NUMINBOX] ld a, [wNumInBox]
.skipToNewMonEntry .skipToNewMonEntry
dec a dec a
call AddNTimes call AddNTimes
@ -3977,14 +3977,14 @@ _MoveMon: ; f51e (3:751e)
.asm_f5b4 .asm_f5b4
ld a, [wMoveMonType] ld a, [wMoveMonType]
cp PARTY_TO_DAYCARE cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONOT ld de, wDayCareMonOT
jr z, .asm_f5d3 jr z, .asm_f5d3
dec a dec a
ld hl, wPartyMonOT ld hl, wPartyMonOT
ld a, [wPartyCount] ld a, [wPartyCount]
jr nz, .asm_f5cd jr nz, .asm_f5cd
ld hl, wBoxMonOT ld hl, wBoxMonOT
ld a, [W_NUMINBOX] ld a, [wNumInBox]
.asm_f5cd .asm_f5cd
dec a dec a
call SkipFixedLengthTextEntries call SkipFixedLengthTextEntries
@ -3995,7 +3995,7 @@ _MoveMon: ; f51e (3:751e)
ld a, [wMoveMonType] ld a, [wMoveMonType]
and a and a
jr z, .asm_f5e6 jr z, .asm_f5e6
ld hl, W_DAYCAREMONOT ld hl, wDayCareMonOT
cp DAYCARE_TO_PARTY cp DAYCARE_TO_PARTY
jr z, .asm_f5ec jr z, .asm_f5ec
ld hl, wPartyMonOT ld hl, wPartyMonOT
@ -4007,14 +4007,14 @@ _MoveMon: ; f51e (3:751e)
call CopyData call CopyData
ld a, [wMoveMonType] ld a, [wMoveMonType]
cp PARTY_TO_DAYCARE cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONNAME ld de, wDayCareMonName
jr z, .asm_f611 jr z, .asm_f611
dec a dec a
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
ld a, [wPartyCount] ld a, [wPartyCount]
jr nz, .asm_f60b jr nz, .asm_f60b
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
ld a, [W_NUMINBOX] ld a, [wNumInBox]
.asm_f60b .asm_f60b
dec a dec a
call SkipFixedLengthTextEntries call SkipFixedLengthTextEntries
@ -4025,7 +4025,7 @@ _MoveMon: ; f51e (3:751e)
ld a, [wMoveMonType] ld a, [wMoveMonType]
and a and a
jr z, .asm_f624 jr z, .asm_f624
ld hl, W_DAYCAREMONNAME ld hl, wDayCareMonName
cp DAYCARE_TO_PARTY cp DAYCARE_TO_PARTY
jr z, .asm_f62a jr z, .asm_f62a
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
@ -4048,7 +4048,7 @@ _MoveMon: ; f51e (3:751e)
call LoadMonData call LoadMonData
callba CalcLevelFromExperience callba CalcLevelFromExperience
ld a, d ld a, d
ld [W_CURENEMYLVL], a ld [wCurEnemyLVL], a
pop hl pop hl
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
add hl, bc add hl, bc
@ -4470,7 +4470,7 @@ InitPlayerData2:
ld hl, wPartyCount ld hl, wPartyCount
call InitializeEmptyList call InitializeEmptyList
ld hl, W_NUMINBOX ld hl, wNumInBox
call InitializeEmptyList call InitializeEmptyList
ld hl, wNumBagItems ld hl, wNumBagItems
call InitializeEmptyList call InitializeEmptyList
@ -4488,7 +4488,7 @@ START_MONEY EQU $3000
ld [wMonDataLocation], a ld [wMonDataLocation], a
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
@ -4497,8 +4497,8 @@ START_MONEY EQU $3000
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld hl, W_GAMEPROGRESSFLAGS ld hl, wGameProgressFlags
ld bc, wGameProgressFlagsEnd - W_GAMEPROGRESSFLAGS ld bc, wGameProgressFlagsEnd - wGameProgressFlags
call FillMemory ; clear all game progress flags call FillMemory ; clear all game progress flags
jp InitializeMissableObjectsFlags jp InitializeMissableObjectsFlags

View file

@ -3,9 +3,9 @@ AgathaScript: ; 7642d (1d:642d)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, AgathaTrainerHeaders ld hl, AgathaTrainerHeaders
ld de, AgathaScriptPointers ld de, AgathaScriptPointers
ld a, [W_AGATHACURSCRIPT] ld a, [wAgathaCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_AGATHACURSCRIPT], a ld [wAgathaCurScript], a
ret ret
AgathaScript_76443: ; 76443 (1d:6443) AgathaScript_76443: ; 76443 (1d:6443)
@ -27,7 +27,7 @@ AgathaScript_76459: ; 76459 (1d:6459)
AgathaScript_76464: ; 76464 (1d:6464) AgathaScript_76464: ; 76464 (1d:6464)
xor a xor a
ld [W_AGATHACURSCRIPT], a ld [wAgathaCurScript], a
ret ret
AgathaScriptPointers: ; 76469 (1d:6469) AgathaScriptPointers: ; 76469 (1d:6469)
@ -53,8 +53,8 @@ AgathaScript_76474: ; 76474 (1d:6474)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $3 ld a, $3
ld [W_AGATHACURSCRIPT], a ld [wAgathaCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
AgathaScript0: ; 76490 (1d:6490) AgathaScript0: ; 76490 (1d:6490)
@ -81,8 +81,8 @@ AgathaScript0: ; 76490 (1d:6490)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $3 ld a, $3
ld [W_AGATHACURSCRIPT], a ld [wAgathaCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CoordsData_764d1: ; 764d1 (1d:64d1) CoordsData_764d1: ; 764d1 (1d:64d1)
@ -99,20 +99,20 @@ AgathaScript3: ; 764da (1d:64da)
call Delay3 call Delay3
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_AGATHACURSCRIPT], a ld [wAgathaCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
AgathaScript2: ; 764ed (1d:64ed) AgathaScript2: ; 764ed (1d:64ed)
call EndTrainerBattle call EndTrainerBattle
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, AgathaScript_76464 jp z, AgathaScript_76464
ld a, $1 ld a, $1
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld a, $1 ld a, $1
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
AgathaTextPointers: ; 76505 (1d:6505) AgathaTextPointers: ; 76505 (1d:6505)

View file

@ -1,6 +1,6 @@
BillsHouseScript: ; 1e76a (7:676a) BillsHouseScript: ; 1e76a (7:676a)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [W_BILLSHOUSECURSCRIPT] ld a, [wBillsHouseCurScript]
ld hl, BillsHouseScriptPointers ld hl, BillsHouseScriptPointers
jp CallFunctionInTable jp CallFunctionInTable
@ -26,7 +26,7 @@ BillsHouseScript1: ; 1e783 (7:6783)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call MoveSprite call MoveSprite
ld a, $2 ld a, $2
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
ret ret
MovementData_1e79c: ; 1e79c (7:679c) MovementData_1e79c: ; 1e79c (7:679c)
@ -55,7 +55,7 @@ BillsHouseScript2: ; 1e7a6 (7:67a6)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, $3 ld a, $3
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
ret ret
BillsHouseScript3: ; 1e7c5 (7:67c5) BillsHouseScript3: ; 1e7c5 (7:67c5)
@ -84,7 +84,7 @@ BillsHouseScript3: ; 1e7c5 (7:67c5)
ld de, MovementData_1e807 ld de, MovementData_1e807
call MoveSprite call MoveSprite
ld a, $4 ld a, $4
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
ret ret
MovementData_1e807: ; 1e807 (7:6807) MovementData_1e807: ; 1e807 (7:6807)
@ -104,7 +104,7 @@ BillsHouseScript4: ; 1e80d (7:680d)
SetEvent EVENT_MET_BILL_2 ; this event seems redundant SetEvent EVENT_MET_BILL_2 ; this event seems redundant
SetEvent EVENT_MET_BILL SetEvent EVENT_MET_BILL
ld a, $0 ld a, $0
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
ret ret
BillsHouseScript5: ; 1e827 (7:6827) BillsHouseScript5: ; 1e827 (7:6827)
@ -112,7 +112,7 @@ BillsHouseScript5: ; 1e827 (7:6827)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld a, $0 ld a, $0
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
ret ret
BillsHouseTextPointers: ; 1e834 (7:6834) BillsHouseTextPointers: ; 1e834 (7:6834)
@ -136,7 +136,7 @@ BillsHouseText1: ; 1e83d (7:683d)
ld hl, BillsHouseText_1e86a ld hl, BillsHouseText_1e86a
call PrintText call PrintText
ld a, $1 ld a, $1
ld [W_BILLSHOUSECURSCRIPT], a ld [wBillsHouseCurScript], a
jr .asm_1e862 jr .asm_1e862
.asm_1e85a .asm_1e85a
ld hl, BillsHouseText_1e86f ld hl, BillsHouseText_1e86f

View file

@ -1,7 +1,7 @@
BluesHouseScript: ; 19b3b (6:5b3b) BluesHouseScript: ; 19b3b (6:5b3b)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl,BluesHouseScriptPointers ld hl,BluesHouseScriptPointers
ld a,[W_BLUESHOUSECURSCRIPT] ld a,[wBluesHouseCurScript]
jp CallFunctionInTable jp CallFunctionInTable
BluesHouseScriptPointers: ; 19b47 (6:5b47) BluesHouseScriptPointers: ; 19b47 (6:5b47)
@ -13,7 +13,7 @@ BluesHouseScript0: ; 19b4b (6:5b4b)
; trigger the next script ; trigger the next script
ld a,1 ld a,1
ld [W_BLUESHOUSECURSCRIPT],a ld [wBluesHouseCurScript],a
ret ret
BluesHouseScript1: ; 19b56 (6:5b56) BluesHouseScript1: ; 19b56 (6:5b56)

View file

@ -3,9 +3,9 @@ BrunoScript: ; 762d6 (1d:62d6)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, BrunoTrainerHeaders ld hl, BrunoTrainerHeaders
ld de, BrunoScriptPointers ld de, BrunoScriptPointers
ld a, [W_BRUNOCURSCRIPT] ld a, [wBrunoCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_BRUNOCURSCRIPT], a ld [wBrunoCurScript], a
ret ret
BrunoScript_762ec: ; 762ec (1d:62ec) BrunoScript_762ec: ; 762ec (1d:62ec)
@ -27,7 +27,7 @@ BrunoScript_76302: ; 76302 (1d:6302)
BrunoScript_7630d: ; 7630d (1d:630d) BrunoScript_7630d: ; 7630d (1d:630d)
xor a xor a
ld [W_BRUNOCURSCRIPT], a ld [wBrunoCurScript], a
ret ret
BrunoScriptPointers: ; 76312 (1d:6312) BrunoScriptPointers: ; 76312 (1d:6312)
@ -53,8 +53,8 @@ BrunoScript_7631d: ; 7631d (1d:631d)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $3 ld a, $3
ld [W_BRUNOCURSCRIPT], a ld [wBrunoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
BrunoScript0: ; 76339 (1d:6339) BrunoScript0: ; 76339 (1d:6339)
@ -81,8 +81,8 @@ BrunoScript0: ; 76339 (1d:6339)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $3 ld a, $3
ld [W_BRUNOCURSCRIPT], a ld [wBrunoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CoordsData_7637a: ; 7637a (1d:637a) CoordsData_7637a: ; 7637a (1d:637a)
@ -99,13 +99,13 @@ BrunoScript3: ; 76383 (1d:6383)
call Delay3 call Delay3
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_BRUNOCURSCRIPT], a ld [wBrunoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
BrunoScript2: ; 76396 (1d:6396) BrunoScript2: ; 76396 (1d:6396)
call EndTrainerBattle call EndTrainerBattle
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, BrunoScript_7630d jp z, BrunoScript_7630d
ld a, $1 ld a, $1

View file

@ -3,7 +3,7 @@ CeladonGameCornerScript: ; 48bbd (12:4bbd)
call CeladonGameCornerScript_48bec call CeladonGameCornerScript_48bec
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, CeladonGameCornerScriptPointers ld hl, CeladonGameCornerScriptPointers
ld a, [W_CELADONGAMECORNERCURSCRIPT] ld a, [wCeladonGameCornerCurScript]
jp CallFunctionInTable jp CallFunctionInTable
CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf) CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
@ -38,8 +38,8 @@ CeladonGameCornerScript_48bec: ; 48bec (12:4bec)
CeladonGameCornerScript_48c07: ; 48c07 (12:4c07) CeladonGameCornerScript_48c07: ; 48c07 (12:4c07)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CELADONGAMECORNERCURSCRIPT], a ld [wCeladonGameCornerCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CeladonGameCornerScriptPointers: ; 48c12 (12:4c12) CeladonGameCornerScriptPointers: ; 48c12 (12:4c12)
@ -51,7 +51,7 @@ CeladonGameCornerScript0: ; 48c18 (12:4c18)
ret ret
CeladonGameCornerScript1: ; 48c19 (12:4c19) CeladonGameCornerScript1: ; 48c19 (12:4c19)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CeladonGameCornerScript_48c07 jp z, CeladonGameCornerScript_48c07
ld a, $f0 ld a, $f0
@ -63,13 +63,13 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call SetSpriteMovementBytesToFF call SetSpriteMovementBytesToFF
ld de, MovementData_48c5a ld de, MovementData_48c5a
ld a, [W_YCOORD] ld a, [wYCoord]
cp $6 cp $6
jr nz, .asm_48c43 jr nz, .asm_48c43
ld de, MovementData_48c63 ld de, MovementData_48c63
jr .asm_48c4d jr .asm_48c4d
.asm_48c43 .asm_48c43
ld a, [W_XCOORD] ld a, [wXCoord]
cp $8 cp $8
jr nz, .asm_48c4d jr nz, .asm_48c4d
ld de, MovementData_48c63 ld de, MovementData_48c63
@ -78,7 +78,7 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call MoveSprite call MoveSprite
ld a, $2 ld a, $2
ld [W_CELADONGAMECORNERCURSCRIPT], a ld [wCeladonGameCornerCurScript], a
ret ret
MovementData_48c5a: ; 48c5a (12:4c5a) MovementData_48c5a: ; 48c5a (12:4c5a)
@ -113,7 +113,7 @@ CeladonGameCornerScript2: ; 48c69 (12:4c69)
set 5, [hl] set 5, [hl]
set 6, [hl] set 6, [hl]
ld a, $0 ld a, $0
ld [W_CELADONGAMECORNERCURSCRIPT], a ld [wCeladonGameCornerCurScript], a
ret ret
CeladonGameCornerTextPointers: ; 48c8a (12:4c8a) CeladonGameCornerTextPointers: ; 48c8a (12:4c8a)
@ -424,7 +424,7 @@ CeladonGameCornerText11: ; 48e9d (12:4e9d)
ld [hJoyPressed], a ld [hJoyPressed], a
ld [hJoyReleased], a ld [hJoyReleased], a
ld a, $1 ld a, $1
ld [W_CELADONGAMECORNERCURSCRIPT], a ld [wCeladonGameCornerCurScript], a
jp TextScriptEnd jp TextScriptEnd
CeladonGameCornerText_48ece: ; 48ece (12:4ece) CeladonGameCornerText_48ece: ; 48ece (12:4ece)

View file

@ -6,9 +6,9 @@ CeladonGymScript: ; 4890a (12:490a)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, CeladonGymTrainerHeaders ld hl, CeladonGymTrainerHeaders
ld de, CeladonGymScriptPointers ld de, CeladonGymScriptPointers
ld a, [W_CELADONGYMCURSCRIPT] ld a, [wCeladonGymCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_CELADONGYMCURSCRIPT], a ld [wCeladonGymCurScript], a
ret ret
CeladonGymScript_48927: ; 48927 (12:4927) CeladonGymScript_48927: ; 48927 (12:4927)
@ -25,8 +25,8 @@ Gym4LeaderName: ; 4893d (12:493d)
CeladonGymText_48943: ; 48943 (12:4943) CeladonGymText_48943: ; 48943 (12:4943)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CELADONGYMCURSCRIPT], a ld [wCeladonGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CeladonGymScriptPointers: ; 4894e (12:494e) CeladonGymScriptPointers: ; 4894e (12:494e)
@ -36,7 +36,7 @@ CeladonGymScriptPointers: ; 4894e (12:494e)
dw CeladonGymScript3 dw CeladonGymScript3
CeladonGymScript3: ; 48956 (12:4956) CeladonGymScript3: ; 48956 (12:4956)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CeladonGymText_48943 jp z, CeladonGymText_48943
ld a, $f0 ld a, $f0
@ -60,7 +60,7 @@ CeladonGymText_48963: ; 48963 (12:4963)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
.asm_4898c .asm_4898c
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
set 3, [hl] set 3, [hl]
ld hl, wBeatGymFlags ld hl, wBeatGymFlags
set 3, [hl] set 3, [hl]
@ -176,10 +176,10 @@ CeladonGymText1: ; 48a11 (12:4a11)
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld a, $4 ld a, $4
ld [W_GYMLEADERNO], a ld [wGymLeaderNo], a
ld a, $3 ld a, $3
ld [W_CELADONGYMCURSCRIPT], a ld [wCeladonGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
.asm_48a5b .asm_48a5b
jp TextScriptEnd jp TextScriptEnd

View file

@ -1,13 +1,13 @@
CeruleanCityScript: ; 19480 (6:5480) CeruleanCityScript: ; 19480 (6:5480)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, CeruleanCityScriptPointers ld hl, CeruleanCityScriptPointers
ld a, [W_CERULEANCITYCURSCRIPT] ld a, [wCeruleanCityCurScript]
jp CallFunctionInTable jp CallFunctionInTable
CeruleanCityScript_1948c: ; 1948c (6:548c) CeruleanCityScript_1948c: ; 1948c (6:548c)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ld a, HS_CERULEAN_RIVAL ld a, HS_CERULEAN_RIVAL
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef_jump HideObject predef_jump HideObject
@ -20,7 +20,7 @@ CeruleanCityScriptPointers: ; 1949d (6:549d)
dw CeruleanCityScript4 dw CeruleanCityScript4
CeruleanCityScript4: ; 194a7 (6:54a7) CeruleanCityScript4: ; 194a7 (6:54a7)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CeruleanCityScript_1948c jp z, CeruleanCityScript_1948c
ld a, $f0 ld a, $f0
@ -31,7 +31,7 @@ CeruleanCityScript4: ; 194a7 (6:54a7)
call DisplayTextID call DisplayTextID
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ret ret
CeruleanCityScript0: ; 194c8 (6:54c8) CeruleanCityScript0: ; 194c8 (6:54c8)
@ -75,7 +75,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, $f0 ld a, $f0
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [W_XCOORD] ld a, [wXCoord]
cp $14 cp $14
jr z, .asm_19535 jr z, .asm_19535
ld a, $1 ld a, $1
@ -93,7 +93,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call MoveSprite call MoveSprite
ld a, $1 ld a, $1
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ret ret
CeruleanCityCoords1: ; 1954f (6:554f) CeruleanCityCoords1: ; 1954f (6:554f)
@ -135,10 +135,10 @@ CeruleanCityScript1: ; 19567 (6:5567)
ld de, CeruleanCityText_19672 ld de, CeruleanCityText_19672
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
ld a, OPP_SONY1 ld a, OPP_SONY1
ld [W_CUROPPONENT], a ld [wCurOpponent], a
; select which team to use during the encounter ; select which team to use during the encounter
ld a, [W_RIVALSTARTER] ld a, [wRivalStarter]
cp STARTER2 cp STARTER2
jr nz, .NotSquirtle jr nz, .NotSquirtle
ld a, $7 ld a, $7
@ -151,17 +151,17 @@ CeruleanCityScript1: ; 19567 (6:5567)
.Charmander .Charmander
ld a, $9 ld a, $9
.done .done
ld [W_TRAINERNO], a ld [wTrainerNo], a
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
call CeruleanCityScript_1955d call CeruleanCityScript_1955d
ld a, $2 ld a, $2
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ret ret
CeruleanCityScript2: ; 195b1 (6:55b1) CeruleanCityScript2: ; 195b1 (6:55b1)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CeruleanCityScript_1948c jp z, CeruleanCityScript_1948c
call CeruleanCityScript_1955d call CeruleanCityScript_1955d
@ -178,7 +178,7 @@ CeruleanCityScript2: ; 195b1 (6:55b1)
ld a, $1 ld a, $1
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call SetSpriteMovementBytesToFF call SetSpriteMovementBytesToFF
ld a, [W_XCOORD] ld a, [wXCoord]
cp $14 cp $14
jr nz, .asm_195f0 jr nz, .asm_195f0
ld de, CeruleanCityMovement4 ld de, CeruleanCityMovement4
@ -190,7 +190,7 @@ CeruleanCityScript2: ; 195b1 (6:55b1)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call MoveSprite call MoveSprite
ld a, $3 ld a, $3
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ret ret
CeruleanCityMovement3: ; 19600 (6:5600) CeruleanCityMovement3: ; 19600 (6:5600)
@ -224,7 +224,7 @@ CeruleanCityScript3: ; 19610 (6:5610)
ld [wJoyIgnore], a ld [wJoyIgnore], a
call PlayDefaultMusic call PlayDefaultMusic
ld a, $0 ld a, $0
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
ret ret
CeruleanCityTextPointers: ; 1962d (6:562d) CeruleanCityTextPointers: ; 1962d (6:562d)
@ -294,7 +294,7 @@ CeruleanCityText2: ; 1967c (6:567c)
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld a, $4 ld a, $4
ld [W_CERULEANCITYCURSCRIPT], a ld [wCeruleanCityCurScript], a
jp TextScriptEnd jp TextScriptEnd
.asm_4ca20 .asm_4ca20
ld hl, CeruleanCityText_196f3 ld hl, CeruleanCityText_196f3

View file

@ -6,9 +6,9 @@ CeruleanGymScript: ; 5c6b3 (17:46b3)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, CeruleanGymTrainerHeaders ld hl, CeruleanGymTrainerHeaders
ld de, CeruleanGymScriptPointers ld de, CeruleanGymScriptPointers
ld a, [W_CERULEANGYMCURSCRIPT] ld a, [wCeruleanGymCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_CERULEANGYMCURSCRIPT], a ld [wCeruleanGymCurScript], a
ret ret
CeruleanGymScript_5c6d0: ; 5c6d0 (17:46d0) CeruleanGymScript_5c6d0: ; 5c6d0 (17:46d0)
@ -25,8 +25,8 @@ Gym2LeaderName: ; 5c6e7 (17:46e7)
CeruleanGymScript_5c6ed: ; 5c6ed (17:46ed) CeruleanGymScript_5c6ed: ; 5c6ed (17:46ed)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CERULEANGYMCURSCRIPT], a ld [wCeruleanGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CeruleanGymScriptPointers: ; 5c6f8 (17:46f8) CeruleanGymScriptPointers: ; 5c6f8 (17:46f8)
@ -36,7 +36,7 @@ CeruleanGymScriptPointers: ; 5c6f8 (17:46f8)
dw CeruleanGymScript3 dw CeruleanGymScript3
CeruleanGymScript3: ; 5c700 (17:4700) CeruleanGymScript3: ; 5c700 (17:4700)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CeruleanGymScript_5c6ed jp z, CeruleanGymScript_5c6ed
ld a, $f0 ld a, $f0
@ -60,7 +60,7 @@ CeruleanGymScript_5c70d: ; 5c70d (17:470d)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
.asm_5c736 .asm_5c736
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
set 1, [hl] set 1, [hl]
ld hl, wBeatGymFlags ld hl, wBeatGymFlags
set 1, [hl] set 1, [hl]
@ -127,11 +127,11 @@ CeruleanGymText1: ; 5c771 (17:4771)
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld a, $2 ld a, $2
ld [W_GYMLEADERNO], a ld [wGymLeaderNo], a
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, $3 ld a, $3
ld [W_CERULEANGYMCURSCRIPT], a ld [wCeruleanGymCurScript], a
.asm_5c7bb .asm_5c7bb
jp TextScriptEnd jp TextScriptEnd

View file

@ -2,7 +2,7 @@ CinnabarGymScript: ; 7574a (1d:574a)
call CinnabarGymScript_75759 call CinnabarGymScript_75759
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, CinnabarGymScriptPointers ld hl, CinnabarGymScriptPointers
ld a, [W_CINNABARGYMCURSCRIPT] ld a, [wCinnabarGymCurScript]
jp CallFunctionInTable jp CallFunctionInTable
CinnabarGymScript_75759: ; 75759 (1d:5759) CinnabarGymScript_75759: ; 75759 (1d:5759)
@ -30,8 +30,8 @@ Gym7LeaderName: ; 7578b (1d:578b)
CinnabarGymScript_75792: ; 75792 (1d:5792) CinnabarGymScript_75792: ; 75792 (1d:5792)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_CINNABARGYMCURSCRIPT], a ld [wCinnabarGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ld [wOpponentAfterWrongAnswer], a ld [wOpponentAfterWrongAnswer], a
ret ret
@ -64,8 +64,8 @@ CinnabarGymScript0: ; 757ae (1d:57ae)
.asm_757cb .asm_757cb
call MoveSprite call MoveSprite
ld a, $1 ld a, $1
ld [W_CINNABARGYMCURSCRIPT], a ld [wCinnabarGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
MovementData_757d7: ; 757d7 (1d:57d7) MovementData_757d7: ; 757d7 (1d:57d7)
@ -92,7 +92,7 @@ CinnabarGymFlagAction: ; 757f1 (1d:57f1)
predef_jump FlagActionPredef predef_jump FlagActionPredef
CinnabarGymScript2: ; 757f6 (1d:57f6) CinnabarGymScript2: ; 757f6 (1d:57f6)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CinnabarGymScript_75792 jp z, CinnabarGymScript_75792
ld a, [wTrainerHeaderFlagBit] ld a, [wTrainerHeaderFlagBit]
@ -129,12 +129,12 @@ CinnabarGymScript2: ; 757f6 (1d:57f6)
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [wOpponentAfterWrongAnswer], a ld [wOpponentAfterWrongAnswer], a
ld a, $0 ld a, $0
ld [W_CINNABARGYMCURSCRIPT], a ld [wCinnabarGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
CinnabarGymScript3: ; 7584a (1d:584a) CinnabarGymScript3: ; 7584a (1d:584a)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, CinnabarGymScript_75792 jp z, CinnabarGymScript_75792
ld a, $f0 ld a, $f0
@ -157,7 +157,7 @@ CinnabarGymScript3_75857: ; 75857 (1d:5857)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
.asm_75880 .asm_75880
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
set 6, [hl] set 6, [hl]
ld hl, wBeatGymFlags ld hl, wBeatGymFlags
set 6, [hl] set 6, [hl]
@ -200,8 +200,8 @@ CinnabarGymScript_758b7: ; 758b7 (1d:58b7)
.asm_758d4 .asm_758d4
ld a, $3 ld a, $3
.asm_758d6 .asm_758d6
ld [W_CINNABARGYMCURSCRIPT], a ld [wCinnabarGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
jp TextScriptEnd jp TextScriptEnd
CinnabarGymText1: ; 758df (1d:58df) CinnabarGymText1: ; 758df (1d:58df)
@ -224,7 +224,7 @@ CinnabarGymText1: ; 758df (1d:58df)
ld de, BlaineEndBattleText ld de, BlaineEndBattleText
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
ld a, $7 ld a, $7
ld [W_GYMLEADERNO], a ld [wGymLeaderNo], a
jp CinnabarGymScript_758b7 jp CinnabarGymScript_758b7
BlaineBattleText: ; 75914 (1d:5914) BlaineBattleText: ; 75914 (1d:5914)

View file

@ -5,7 +5,7 @@ CinnabarIslandScript: ; 1ca19 (7:4a19)
ResetEvent EVENT_MANSION_SWITCH_ON ResetEvent EVENT_MANSION_SWITCH_ON
ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL ResetEvent EVENT_LAB_STILL_REVIVING_FOSSIL
ld hl, CinnabarIslandScriptPointers ld hl, CinnabarIslandScriptPointers
ld a, [W_CINNABARISLANDCURSCRIPT] ld a, [wCinnabarIslandCurScript]
jp CallFunctionInTable jp CallFunctionInTable
CinnabarIslandScriptPointers: ; 1ca34 (7:4a34) CinnabarIslandScriptPointers: ; 1ca34 (7:4a34)
@ -16,10 +16,10 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)
ld b, SECRET_KEY ld b, SECRET_KEY
call IsItemInBag call IsItemInBag
ret nz ret nz
ld a, [W_YCOORD] ld a, [wYCoord]
cp $4 cp $4
ret nz ret nz
ld a, [W_XCOORD] ld a, [wXCoord]
cp $12 cp $12
ret nz ret nz
ld a, PLAYER_DIR_UP ld a, PLAYER_DIR_UP
@ -38,7 +38,7 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)
ld [wSpriteStateData1 + 9], a ld [wSpriteStateData1 + 9], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, $1 ld a, $1
ld [W_CINNABARISLANDCURSCRIPT], a ld [wCinnabarIslandCurScript], a
ret ret
CinnabarIslandScript1: ; 1ca73 (7:4a73) CinnabarIslandScript1: ; 1ca73 (7:4a73)
@ -47,7 +47,7 @@ CinnabarIslandScript1: ; 1ca73 (7:4a73)
ret nz ret nz
call Delay3 call Delay3
ld a, $0 ld a, $0
ld [W_CINNABARISLANDCURSCRIPT], a ld [wCinnabarIslandCurScript], a
ret ret
CinnabarIslandTextPointers: ; 1ca81 (7:4a81) CinnabarIslandTextPointers: ; 1ca81 (7:4a81)

View file

@ -7,7 +7,7 @@ DayCareMTextPointers: ; 56252 (15:6252)
DayCareMText1: ; 56254 (15:6254) DayCareMText1: ; 56254 (15:6254)
TX_ASM TX_ASM
call SaveScreenTilesToBuffer2 call SaveScreenTilesToBuffer2
ld a, [W_DAYCARE_IN_USE] ld a, [wDayCareInUse]
and a and a
jp nz, .daycareInUse jp nz, .daycareInUse
ld hl, DayCareIntroText ld hl, DayCareIntroText
@ -46,7 +46,7 @@ DayCareMText1: ; 56254 (15:6254)
ld hl, DayCareWillLookAfterMonText ld hl, DayCareWillLookAfterMonText
call PrintText call PrintText
ld a, 1 ld a, 1
ld [W_DAYCARE_IN_USE], a ld [wDayCareInUse], a
ld a, PARTY_TO_DAYCARE ld a, PARTY_TO_DAYCARE
ld [wMoveMonType], a ld [wMoveMonType], a
call MoveMon call MoveMon
@ -60,7 +60,7 @@ DayCareMText1: ; 56254 (15:6254)
.daycareInUse .daycareInUse
xor a xor a
ld hl, W_DAYCAREMONNAME ld hl, wDayCareMonName
call GetPartyMonName call GetPartyMonName
ld a, DAYCARE_DATA ld a, DAYCARE_DATA
ld [wMonDataLocation], a ld [wMonDataLocation], a
@ -150,7 +150,7 @@ DayCareMText1: ; 56254 (15:6254)
.enoughMoney .enoughMoney
xor a xor a
ld [W_DAYCARE_IN_USE], a ld [wDayCareInUse], a
ld hl, wDayCareNumLevelsGrown ld hl, wDayCareNumLevelsGrown
ld [hli], a ld [hli], a
inc hl inc hl

View file

@ -2,16 +2,16 @@ FightingDojoScript: ; 5cd5d (17:4d5d)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, FightingDojoTrainerHeaders ld hl, FightingDojoTrainerHeaders
ld de, FightingDojoScriptPointers ld de, FightingDojoScriptPointers
ld a, [W_FIGHTINGDOJOCURSCRIPT] ld a, [wFightingDojoCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_FIGHTINGDOJOCURSCRIPT], a ld [wFightingDojoCurScript], a
ret ret
FightingDojoScript_5cd70: ; 5cd70 (17:4d70) FightingDojoScript_5cd70: ; 5cd70 (17:4d70)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_FIGHTINGDOJOCURSCRIPT], a ld [wFightingDojoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
FightingDojoScriptPointers: ; 5cd7b (17:4d7b) FightingDojoScriptPointers: ; 5cd7b (17:4d7b)
@ -32,10 +32,10 @@ FightingDojoScript1: ; 5cd83 (17:4d83)
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
ld [wcf0d], a ld [wcf0d], a
ld a, [W_YCOORD] ld a, [wYCoord]
cp $3 cp $3
ret nz ret nz
ld a, [W_XCOORD] ld a, [wXCoord]
cp $4 cp $4
ret nz ret nz
ld a, $1 ld a, $1
@ -53,7 +53,7 @@ FightingDojoScript1: ; 5cd83 (17:4d83)
ret ret
FightingDojoScript3: ; 5cdc6 (17:4dc6) FightingDojoScript3: ; 5cdc6 (17:4dc6)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, FightingDojoScript_5cd70 jp z, FightingDojoScript_5cd70
ld a, [wcf0d] ld a, [wcf0d]
@ -76,8 +76,8 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)
call DisplayTextID call DisplayTextID
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_FIGHTINGDOJOCURSCRIPT], a ld [wFightingDojoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
FightingDojoTextPointers: ; 5ce03 (17:4e03) FightingDojoTextPointers: ; 5ce03 (17:4e03)
@ -148,8 +148,8 @@ FightingDojoText1: ; 5ce44 (17:4e44)
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld a, $3 ld a, $3
ld [W_FIGHTINGDOJOCURSCRIPT], a ld [wFightingDojoCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
jr .asm_9dba4 jr .asm_9dba4
.continue1 .continue1
ld hl, FightingDojoText_5ce9d ld hl, FightingDojoText_5ce9d

View file

@ -3,9 +3,9 @@ FuchsiaGymScript: ; 7543d (1d:543d)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, FuchsiaGymTrainerHeaders ld hl, FuchsiaGymTrainerHeaders
ld de, FuchsiaGymScriptPointers ld de, FuchsiaGymScriptPointers
ld a, [W_FUCHSIAGYMCURSCRIPT] ld a, [wFuchsiaGymCurScript]
call ExecuteCurMapScriptInTable call ExecuteCurMapScriptInTable
ld [W_FUCHSIAGYMCURSCRIPT], a ld [wFuchsiaGymCurScript], a
ret ret
FuchsiaGymScript_75453: ; 75453 (1d:5453) FuchsiaGymScript_75453: ; 75453 (1d:5453)
@ -26,8 +26,8 @@ Gym5LeaderName: ; 75472 (1d:5472)
FuchsiaGymScript_75477: ; 75477 (1d:5477) FuchsiaGymScript_75477: ; 75477 (1d:5477)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_FUCHSIAGYMCURSCRIPT], a ld [wFuchsiaGymCurScript], a
ld [W_CURMAPSCRIPT], a ld [wCurMapScript], a
ret ret
FuchsiaGymScriptPointers: ; 75482 (1d:5482) FuchsiaGymScriptPointers: ; 75482 (1d:5482)
@ -37,7 +37,7 @@ FuchsiaGymScriptPointers: ; 75482 (1d:5482)
dw FuchsiaGymScript3 dw FuchsiaGymScript3
FuchsiaGymScript3: ; 7548a (1d:548a) FuchsiaGymScript3: ; 7548a (1d:548a)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, FuchsiaGymScript_75477 jp z, FuchsiaGymScript_75477
ld a, $f0 ld a, $f0
@ -60,7 +60,7 @@ FuchsiaGymScript3_75497: ; 75497 (1d:5497)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
.asm_754c0 .asm_754c0
ld hl, W_OBTAINEDBADGES ld hl, wObtainedBadges
set 4, [hl] set 4, [hl]
ld hl, wBeatGymFlags ld hl, wBeatGymFlags
set 4, [hl] set 4, [hl]
@ -167,11 +167,11 @@ FuchsiaGymText1: ; 75534 (1d:5534)
call EngageMapTrainer call EngageMapTrainer
call InitBattleEnemyParameters call InitBattleEnemyParameters
ld a, $5 ld a, $5
ld [W_GYMLEADERNO], a ld [wGymLeaderNo], a
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, $3 ld a, $3
ld [W_FUCHSIAGYMCURSCRIPT], a ld [wFuchsiaGymCurScript], a
.asm_e84c6 .asm_e84c6
jp TextScriptEnd jp TextScriptEnd

View file

@ -1,13 +1,13 @@
GaryScript: ; 75f1d (1d:5f1d) GaryScript: ; 75f1d (1d:5f1d)
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld hl, GaryScriptPointers ld hl, GaryScriptPointers
ld a, [W_GARYCURSCRIPT] ld a, [wGaryCurScript]
jp CallFunctionInTable jp CallFunctionInTable
GaryScript_75f29: ; 75f29 (1d:5f29) GaryScript_75f29: ; 75f29 (1d:5f29)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScriptPointers: ; 75f31 (1d:5f31) GaryScriptPointers: ; 75f31 (1d:5f31)
@ -36,7 +36,7 @@ GaryScript1: ; 75f48 (1d:5f48)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $2 ld a, $2
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
RLEMovement75f63: ; 75f63 (1d:5f63) RLEMovement75f63: ; 75f63 (1d:5f63)
@ -52,7 +52,7 @@ GaryScript2: ; 75f6a (1d:5f6a)
call Delay3 call Delay3
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld hl, W_OPTIONS ld hl, wOptions
res 7, [hl] res 7, [hl]
ld a, $1 ld a, $1
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
@ -65,10 +65,10 @@ GaryScript2: ; 75f6a (1d:5f6a)
ld de, GaryText_760fe ld de, GaryText_760fe
call SaveEndBattleTextPointers call SaveEndBattleTextPointers
ld a, OPP_SONY3 ld a, OPP_SONY3
ld [W_CUROPPONENT], a ld [wCurOpponent], a
; select which team to use during the encounter ; select which team to use during the encounter
ld a, [W_RIVALSTARTER] ld a, [wRivalStarter]
cp STARTER2 cp STARTER2
jr nz, .NotSquirtle jr nz, .NotSquirtle
ld a, $1 ld a, $1
@ -81,16 +81,16 @@ GaryScript2: ; 75f6a (1d:5f6a)
.Charmander .Charmander
ld a, $3 ld a, $3
.done .done
ld [W_TRAINERNO], a ld [wTrainerNo], a
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, $3 ld a, $3
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript3: ; 75fbb (1d:5fbb) GaryScript3: ; 75fbb (1d:5fbb)
ld a, [W_ISINBATTLE] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, GaryScript_75f29 jp z, GaryScript_75f29
call UpdateSprites call UpdateSprites
@ -104,7 +104,7 @@ GaryScript3: ; 75fbb (1d:5fbb)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call SetSpriteMovementBytesToFF call SetSpriteMovementBytesToFF
ld a, $4 ld a, $4
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript4: ; 75fe4 (1d:5fe4) GaryScript4: ; 75fe4 (1d:5fe4)
@ -123,7 +123,7 @@ GaryScript4: ; 75fe4 (1d:5fe4)
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef ShowObject predef ShowObject
ld a, $5 ld a, $5
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
MovementData_76014: ; 76014 (1d:6014) MovementData_76014: ; 76014 (1d:6014)
@ -154,7 +154,7 @@ GaryScript5: ; 7601a (1d:601a)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call GaryScript_760c8 call GaryScript_760c8
ld a, $6 ld a, $6
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript6: ; 76047 (1d:6047) GaryScript6: ; 76047 (1d:6047)
@ -167,7 +167,7 @@ GaryScript6: ; 76047 (1d:6047)
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call GaryScript_760c8 call GaryScript_760c8
ld a, $7 ld a, $7
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript7: ; 7605f (1d:605f) GaryScript7: ; 7605f (1d:605f)
@ -184,7 +184,7 @@ GaryScript7: ; 7605f (1d:605f)
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call MoveSprite call MoveSprite
ld a, $8 ld a, $8
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
MovementData_76080: ; 76080 (1d:6080) MovementData_76080: ; 76080 (1d:6080)
@ -200,7 +200,7 @@ GaryScript8: ; 76083 (1d:6083)
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef HideObject predef HideObject
ld a, $9 ld a, $9
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript9: ; 76099 (1d:6099) GaryScript9: ; 76099 (1d:6099)
@ -213,7 +213,7 @@ GaryScript9: ; 76099 (1d:6099)
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ld a, $a ld a, $a
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
RLEMovement760b4: ; 760b4 (1d:60b4) RLEMovement760b4: ; 760b4 (1d:60b4)
@ -228,7 +228,7 @@ GaryScript10: ; 760b9 (1d:60b9)
xor a xor a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, $0 ld a, $0
ld [W_GARYCURSCRIPT], a ld [wGaryCurScript], a
ret ret
GaryScript_760c8: ; 760c8 (1d:60c8) GaryScript_760c8: ; 760c8 (1d:60c8)
@ -278,7 +278,7 @@ GaryText2: ; 76108 (1d:6108)
GaryText3: ; 7610d (1d:610d) GaryText3: ; 7610d (1d:610d)
TX_ASM TX_ASM
ld a, [W_PLAYERSTARTER] ld a, [wPlayerStarter]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
ld hl, GaryText_76120 ld hl, GaryText_76120

Some files were not shown because too many files have changed in this diff Show more