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

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

View file

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

View file

@ -1,8 +1,8 @@
PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, [W_ISINBATTLE]
ld a, [wIsInBattle]
dec a
jr nz, .trainerBattle
ld a, [W_CURMAP]
ld a, [wCurMap]
cp POKEMONTOWER_3
jr c, .notPokemonTower
cp LAVENDER_HOUSE_1
@ -11,7 +11,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99)
ld a, [wEnemyMonSpecies2]
call PlayCry
ld hl, WildMonAppearedText
ld a, [W_MOVEMISSED]
ld a, [wMoveMissed]
and a
jr z, .notFishing
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
ret z ; if the pokemon is using "struggle", there's nothing to do
; we don't decrement PP for "struggle"
ld hl, W_PLAYERBATTSTATUS1
ld a, [hli] ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the
; W_PLAYERBATTSTATUS2 status flags later
ld hl, wPlayerBattleStatus1
ld a, [hli] ; load the wPlayerBattleStatus1 pokemon status flags and increment hl to load the
; wPlayerBattleStatus2 status flags later
and a, (1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << AttackingMultipleTimes)
ret nz ; if any of these statuses are true, don't decrement PP
bit UsingRage, [hl]
@ -17,7 +17,7 @@ DecrementPP: ; 68000 (1a:4000)
call .DecrementPP
; decrement PP in the party struct
ld a, [W_PLAYERBATTSTATUS3]
ld a, [wPlayerBattleStatus3]
bit Transformed, a
ret nz ; Return if transformed. Pokemon Red stores the "current pokemon's" PP
; separately from the "Pokemon in your party's" PP. This is

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,13 +3,13 @@ ConversionEffect_: ; 139a3 (4:79a3)
ld de, wBattleMonType1
ld a, [H_WHOSETURN]
and a
ld a, [W_ENEMYBATTSTATUS1]
ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect
push hl
ld h, d
ld l, e
pop de
ld a, [W_PLAYERBATTSTATUS1]
ld a, [wPlayerBattleStatus1]
.conversionEffect
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
jr nz, PrintButItFailedText

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,27 +1,27 @@
TransformEffect_: ; 3bab1 (e:7ab1)
ld hl, wBattleMonSpecies
ld de, wEnemyMonSpecies
ld bc, W_ENEMYBATTSTATUS3
ld a, [W_ENEMYBATTSTATUS1]
ld bc, wEnemyBattleStatus3
ld a, [wEnemyBattleStatus1]
ld a, [H_WHOSETURN]
and a
jr nz, .hitTest
ld hl, wEnemyMonSpecies
ld de, wBattleMonSpecies
ld bc, W_PLAYERBATTSTATUS3
ld bc, wPlayerBattleStatus3
ld [wPlayerMoveListIndex], a
ld a, [W_PLAYERBATTSTATUS1]
ld a, [wPlayerBattleStatus1]
.hitTest
bit Invulnerable, a ; is mon invulnerable to typical attacks? (fly/dig)
jp nz, .failed
push hl
push de
push bc
ld hl, W_PLAYERBATTSTATUS2
ld hl, wPlayerBattleStatus2
ld a, [H_WHOSETURN]
and a
jr z, .transformEffect
ld hl, W_ENEMYBATTSTATUS2
ld hl, wEnemyBattleStatus2
.transformEffect
; animation(s) played are different if target has Substitute up
bit HasSubstituteUp, [hl]
@ -29,7 +29,7 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld hl, HideSubstituteShowMonAnim
ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch
ld a, [W_OPTIONS]
ld a, [wOptions]
add a
ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)

View file

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

View file

@ -15,7 +15,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [hl],a
; get the pointer to trainer data for this class
ld a,[W_CUROPPONENT]
ld a,[wCurOpponent]
sub $C9 ; convert value from pokemon to trainer
add a,a
ld hl,TrainerDataPointers
@ -25,7 +25,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld a,[hli]
ld h,[hl]
ld l,a
ld a,[W_TRAINERNO]
ld a,[wTrainerNo]
ld b,a
; At this point b contains the trainer number,
; and hl points to the trainer class.
@ -43,13 +43,13 @@ ReadTrainer: ; 39c53 (e:5c53)
; if the first byte of trainer data is FF,
; - each pokemon has a specific 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
.IterateTrainer
ld a,[hli]
cp $FF ; is the trainer special?
jr z,.SpecialTrainer ; if so, check for special moves
ld [W_CURENEMYLVL],a
ld [wCurEnemyLVL],a
.LoopTrainerData
ld a,[hli]
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:
; - each pokemon has a specific 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]
and a ; have we reached the end of the trainer data?
jr z,.AddLoneMove
ld [W_CURENEMYLVL],a
ld [wCurEnemyLVL],a
ld a,[hli]
ld [wcf91],a
ld a,ENEMY_PARTY_DATA
@ -80,7 +80,7 @@ ReadTrainer: ; 39c53 (e:5c53)
jr .SpecialTrainer
.AddLoneMove
; 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
jr z,.AddTeamMove
dec a
@ -100,7 +100,7 @@ ReadTrainer: ; 39c53 (e:5c53)
; check if our trainer's team has special moves
; get trainer class number
ld a,[W_CUROPPONENT]
ld a,[wCurOpponent]
sub 200
ld b,a
ld hl,TeamMoves
@ -130,7 +130,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [wEnemyMon1Moves + 2],a
; starter
ld a,[W_RIVALSTARTER]
ld a,[wRivalStarter]
cp STARTER3
ld b,MEGA_DRAIN
jr z,.GiveStarterMove
@ -150,7 +150,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [de],a
inc de
ld [de],a
ld a,[W_CURENEMYLVL]
ld a,[wCurEnemyLVL]
ld b,a
.LastLoop
; update wAmountMoneyWon addresses (money to win) based on enemy's level
@ -162,5 +162,5 @@ ReadTrainer: ; 39c53 (e:5c53)
inc de
inc de
dec b
jr nz,.LastLoop ; repeat W_CURENEMYLVL times
jr nz,.LastLoop ; repeat wCurEnemyLVL times
ret

View file

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

View file

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

View file

@ -7,7 +7,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld [hli], a ; move 2
ld [hli], a ; move 3
ld [hl], a ; move 4
ld a, [W_ENEMYDISABLEDMOVE] ; forbid disabled move (if any)
ld a, [wEnemyDisabledMove] ; forbid disabled move (if any)
swap a
and $f
jr z, .noMoveDisabled
@ -19,7 +19,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
ld [hl], $50 ; forbid (highly discourage) disabled move
.noMoveDisabled
ld hl, TrainerClassMoveChoiceModifications
ld a, [W_TRAINERCLASS]
ld a, [wTrainerClass]
ld b, a
.loopTrainerClasses
dec b
@ -126,10 +126,10 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
ret z ; no more moves in move set
inc de
call ReadMove
ld a, [W_ENEMYMOVEPOWER]
ld a, [wEnemyMovePower]
and a
jr nz, .nextMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
push hl
push de
push bc
@ -171,7 +171,7 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7)
ret z ; no more moves in move set
inc de
call ReadMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp ATTACK_UP1_EFFECT
jr c, .nextMove
cp BIDE_EFFECT
@ -218,7 +218,7 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
push hl
push de
push bc
ld a, [W_ENEMYMOVETYPE]
ld a, [wEnemyMoveType]
ld d, a
ld hl, wEnemyMonMoves ; enemy moves
ld b, NUM_MOVES + 1
@ -230,17 +230,17 @@ AIMoveChoiceModification3: ; 39817 (e:5817)
and a
jr z, .done
call ReadMove
ld a, [W_ENEMYMOVEEFFECT]
ld a, [wEnemyMoveEffect]
cp SUPER_FANG_EFFECT
jr z, .betterMoveFound ; Super Fang is considered to be a better move
cp SPECIAL_DAMAGE_EFFECT
jr z, .betterMoveFound ; any special damage moves are considered to be better moves
cp FLY_EFFECT
jr z, .betterMoveFound ; Fly is considered to be a better move
ld a, [W_ENEMYMOVETYPE]
ld a, [wEnemyMoveType]
cp d
jr z, .loopMoves
ld a, [W_ENEMYMOVEPOWER]
ld a, [wEnemyMovePower]
and a
jr nz, .betterMoveFound ; damaging moves of a different type are considered to be better moves
jr .loopMoves
@ -266,7 +266,7 @@ ReadMove: ; 39884 (e:5884)
ld hl,Moves
ld bc,MoveEnd - Moves
call AddNTimes
ld de,W_ENEMYMOVENUM
ld de,wEnemyMoveNum
call CopyData
pop bc
pop de
@ -338,13 +338,13 @@ INCLUDE "data/trainer_parties.asm"
TrainerAI: ; 3a52e (e:652e)
and a
ld a,[W_ISINBATTLE]
ld a,[wIsInBattle]
dec a
ret z ; if not a trainer, we're done here
ld a,[wLinkState]
cp LINK_STATE_BATTLING
ret z
ld a,[W_TRAINERCLASS] ; what trainer class is this?
ld a,[wTrainerClass] ; what trainer class is this?
dec a
ld c,a
ld b,0
@ -727,27 +727,27 @@ AICureStatus: ; 3a791 (e:6791)
xor a
ld [hl],a ; clear status in enemy team roster
ld [wEnemyMonStatus],a ; clear status of active enemy
ld hl,W_ENEMYBATTSTATUS3
ld hl,wEnemyBattleStatus3
res 0,[hl]
ret
AIUseXAccuracy: ; 0x3a7a8 unused
call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
ld hl,wEnemyBattleStatus2
set 0,[hl]
ld a,X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec: ; 3a7b5 (e:67b5)
call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
ld hl,wEnemyBattleStatus2
set 1,[hl]
ld a,GUARD_SPEC_
jp AIPrintItemUse
AIUseDireHit: ; 0x3a7c2 unused
call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
ld hl,wEnemyBattleStatus2
set 2,[hl]
ld a,DIRE_HIT
jp AIPrintItemUse
@ -803,7 +803,7 @@ AIIncreaseStat: ; 3a808 (e:6808)
push bc
call AIPrintItemUse_
pop bc
ld hl,W_ENEMYMOVEEFFECT
ld hl,wEnemyMoveEffect
ld a,[hld]
push af
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?
coord hl, 9, 9
ld c, [hl]
ld a, [W_GRASSTILE]
ld a, [wGrassTile]
cp c
ld a, [W_GRASSRATE]
ld a, [wGrassRate]
jr z, .CanEncounter
ld a, $14 ; in all tilesets with a water tile, this is its id
cp c
@ -38,13 +38,13 @@ TryDoWildEncounter: ; 13870 (4:7870)
; even if not in grass/water, standing anywhere we can encounter pokemon
; so long as the map is "indoor" and has wild pokemon defined.
; ...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?
jr c, .CantEncounter2
ld a, [W_CURMAPTILESET]
ld a, [wCurMapTileset]
cp FOREST ; Viridian Forest/Safari Zone
jr z, .CantEncounter2
ld a, [W_GRASSRATE]
ld a, [wGrassRate]
.CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter
ld b, a
@ -63,7 +63,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
.gotEncounterSlot
; determine which wild pokemon (grass or water) can appear in the half-block we're standing in
ld c, [hl]
ld hl, W_GRASSMONS
ld hl, wGrassMons
aCoord 8, 9
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
@ -74,7 +74,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
ld b, 0
add hl, bc
ld a, [hli]
ld [W_CURENEMYLVL], a
ld [wCurEnemyLVL], a
ld a, [hl]
ld [wcf91], a
ld [wEnemyMonSpecies2], a
@ -83,7 +83,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr z, .willEncounter
ld a, [wPartyMon1Level]
ld b, a
ld a, [W_CURENEMYLVL]
ld a, [wCurEnemyLVL]
cp b
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
jr .willEncounter