summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rwxr-xr-xengine/battle/animations.asm269
-rwxr-xr-x[-rw-r--r--]engine/battle/bank_e_misc.asm30
-rw-r--r--engine/battle/battle_transitions.asm8
-rw-r--r--engine/battle/common_text.asm24
-rwxr-xr-xengine/battle/core.asm256
-rw-r--r--engine/battle/decrement_pp.asm16
-rw-r--r--engine/battle/draw_hud_pokeball_gfx.asm38
-rwxr-xr-x[-rw-r--r--]engine/battle/end_of_battle.asm4
-rw-r--r--engine/battle/experience.asm4
-rw-r--r--engine/battle/init_battle_variables.asm4
-rw-r--r--engine/battle/moveEffects/conversion_effect.asm2
-rw-r--r--engine/battle/moveEffects/drain_hp_effect.asm10
-rw-r--r--engine/battle/moveEffects/focus_energy_effect.asm2
-rw-r--r--engine/battle/moveEffects/haze_effect.asm10
-rw-r--r--engine/battle/moveEffects/heal_effect.asm2
-rw-r--r--engine/battle/moveEffects/leech_seed_effect.asm20
-rw-r--r--engine/battle/moveEffects/one_hit_ko_effect.asm8
-rw-r--r--engine/battle/moveEffects/paralyze_effect.asm4
-rw-r--r--engine/battle/moveEffects/pay_day_effect.asm6
-rw-r--r--engine/battle/moveEffects/recoil_effect.asm2
-rw-r--r--engine/battle/moveEffects/reflect_light_screen_effect.asm2
-rw-r--r--engine/battle/moveEffects/substitute_effect.asm26
-rw-r--r--engine/battle/moveEffects/transform_effect.asm14
-rwxr-xr-x[-rw-r--r--]engine/battle/read_trainer_party.asm4
-rw-r--r--engine/battle/scale_sprites.asm8
-rw-r--r--engine/battle/trainer_ai.asm25
-rwxr-xr-x[-rw-r--r--]engine/battle/trainer_pic_money_pointers.asm2
-rw-r--r--engine/battle/wild_encounters.asm16
28 files changed, 416 insertions, 400 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index dc08e0e1..cdd28422 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -170,7 +170,7 @@ PlayAnimation: ; 780f1 (1e:40f1)
ld l,a
ld h,0
add hl,hl
- ld de,AttackAnimationPointers ; $607d ; animation command stream pointers
+ ld de,AttackAnimationPointers ; animation command stream pointers
add hl,de
ld a,[hli]
ld h,[hl]
@@ -199,7 +199,7 @@ PlayAnimation: ; 780f1 (1e:40f1)
ld [wAnimSoundID],a ; store sound
push hl
push de
- call Func_7986f
+ call GetMoveSound
call PlaySound
pop de
pop hl
@@ -383,7 +383,7 @@ MoveAnimation: ; 78d5e (1e:4d5e)
push bc
push af
call WaitForSoundToFinish
- call Func_78e23
+ call SetAnimationPalette
ld a,[W_ANIMATIONID]
and a
jr z,.AnimationFinished
@@ -500,19 +500,19 @@ AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01)
push bc
push bc
.asm_78e03
- ld a, [rWX] ; $ff4b
+ ld a, [rWX]
inc a
- ld [rWX], a ; $ff4b
- ld c, $2
+ ld [rWX], a
+ ld c, 2
call DelayFrames
dec b
jr nz, .asm_78e03
pop bc
.asm_78e11
- ld a, [rWX] ; $ff4b
+ ld a, [rWX]
dec a
- ld [rWX], a ; $ff4b
- ld c, $2
+ ld [rWX], a
+ ld c, 2
call DelayFrames
dec b
jr nz, .asm_78e11
@@ -521,7 +521,7 @@ AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01)
jr nz, AnimationShakeScreenHorizontallySlow
ret
-Func_78e23: ; 78e23 (1e:4e23)
+SetAnimationPalette: ; 78e23 (1e:4e23)
ld a, [wOnSGB]
and a
ld a, $e4
@@ -529,7 +529,7 @@ Func_78e23: ; 78e23 (1e:4e23)
ld a, $f0
ld [wcc79], a
ld b, $e4
- ld a, [W_ANIMATIONID] ; W_ANIMATIONID
+ ld a, [W_ANIMATIONID]
cp TRADE_BALL_DROP_ANIM
jr c, .asm_78e3f
cp TRADE_BALL_POOF_ANIM + 1
@@ -537,24 +537,24 @@ Func_78e23: ; 78e23 (1e:4e23)
ld b, $f0
.asm_78e3f
ld a, b
- ld [rOBP0], a ; $ff48
+ ld [rOBP0], a
ld a, $6c
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
ret
.asm_78e47
ld a, $e4
ld [wcc79], a
- ld [rOBP0], a ; $ff48
+ ld [rOBP0], a
ld a, $6c
- ld [rOBP1], a ; $ff49
+ ld [rOBP1], a
ret
PlaySubanimation: ; 78e53 (1e:4e53)
ld a,[wAnimSoundID]
cp a,$FF
jr z,.skipPlayingSound
- call Func_7986f
- call PlaySound ; play sound effect
+ call GetMoveSound
+ call PlaySound
.skipPlayingSound
ld hl,wOAMBuffer ; base address of OAM buffer
ld a,l
@@ -581,7 +581,7 @@ PlaySubanimation: ; 78e53 (1e:4e53)
push hl
ld e,[hl] ; base coordinate ID
ld d,0
- ld hl,FrameBlockBaseCoords ; $7c85 ; base coordinate table
+ ld hl,FrameBlockBaseCoords ; base coordinate table
add hl,de
add hl,de
ld a,[hli]
@@ -667,7 +667,7 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5)
dw AnimationFlashScreen
db TAIL_WHIP
- dw Func_790d0
+ dw TailWhipAnimationUnused
db GROWL
dw DoGrowlSpecialEffects
@@ -703,13 +703,13 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5)
dw DoRockSlideSpecialEffects
db TRADE_BALL_DROP_ANIM
- dw Func_79041
+ dw TradeHidePokemon
db TRADE_BALL_SHAKE_ANIM
- dw Func_7904c
+ dw TradeShakePokeball
db TRADE_BALL_TILT_ANIM
- dw Func_7907c
+ dw TradeJumpPokeball
db TOSS_ANIM
dw DoBallTossSpecialEffects
@@ -742,7 +742,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e)
jr nz,.skipPlayingSound
; if it is the beginning of the subanimation, play a sound
ld a,(SFX_08_41 - SFX_Headers_08) / 3
- call PlaySound ; play sound
+ call PlaySound
.skipPlayingSound
ld a,[W_ISINBATTLE]
cp a,02 ; is it a trainer battle?
@@ -788,7 +788,7 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96)
jr nz,.skipPlayingSound
; if it is the beginning of a shake, play a sound and wait 2/3 of a second
ld a,(SFX_08_3c - SFX_Headers_08) / 3
- call PlaySound ; play sound
+ call PlaySound
ld c,40
call DelayFrames
.skipPlayingSound
@@ -875,8 +875,8 @@ DoBlizzardSpecialEffects: ; 79016 (1e:5016)
ret
; flashes the screen at 3 points in the subanimation
-; XXX is this unused?
-Func_7902e: ; 7902e (1e:502e)
+; unused
+FlashScreenUnused: ; 7902e (1e:502e)
ld a,[W_SUBANIMCOUNTER]
cp a,14
jp z,AnimationFlashScreen
@@ -887,8 +887,7 @@ Func_7902e: ; 7902e (1e:502e)
ret
; function to make the pokemon disappear at the beginning of the animation
-; XXX probably a trade-related animation
-Func_79041: ; 79041 (1e:5041)
+TradeHidePokemon: ; 79041 (1e:5041)
ld a,[W_SUBANIMCOUNTER]
cp a,6
ret nz
@@ -896,8 +895,7 @@ Func_79041: ; 79041 (1e:5041)
jp Func_7980c ; make pokemon disappear
; function to make a shaking pokeball jump up at the end of the animation
-; XXX probably a trade-related animation
-Func_7904c: ; 7904c (1e:504c)
+TradeShakePokeball: ; 7904c (1e:504c)
ld a,[W_SUBANIMCOUNTER]
cp a,1
ret nz
@@ -924,15 +922,14 @@ Func_7904c: ; 7904c (1e:504c)
.done
call AnimationCleanOAM
ld a,(SFX_02_44 - SFX_Headers_02) / 3
- jp PlaySound ; play sound
+ jp PlaySound
BallMoveDistances1: ; 79078 (1e:5078)
db -12,-12,-8
db $ff ; terminator
; function to make the pokeball jump up
-; XXX probably a trade-related animation
-Func_7907c ; 507C
+TradeJumpPokeball: ; 507C
ld de,BallMoveDistances2
.loop
ld hl,wOAMBuffer ; OAM buffer
@@ -985,7 +982,7 @@ DoGrowlSpecialEffects: ; 790bc (1e:50bc)
ret
; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations
-Func_790d0: ; 790d0 (1e:50d0)
+TailWhipAnimationUnused: ; 790d0 (1e:50d0)
ld a,1
ld [W_SUBANIMCOUNTER],a
ld c,20
@@ -1183,46 +1180,46 @@ AnimationFlashScreen: ; 791be (1e:51be)
AnimationDarkScreenPalette: ; 791d6 (1e:51d6)
; Changes the screen's palette to a dark palette.
ld bc, $6f6f
- jr Func_791fc
+ jr SetAnimationBGPalette
AnimationDarkenMonPalette: ; 791db (1e:51db)
; Darkens the mon sprite's palette.
ld bc, $f9f4
- jr Func_791fc
+ jr SetAnimationBGPalette
-Func_791e0: ; 791e0 (1e:51e0)
+AnimationUnusedPalette1: ; 791e0 (1e:51e0)
ld bc, $fef8
- jr Func_791fc
+ jr SetAnimationBGPalette
-Func_791e5: ; 791e5 (1e:51e5)
+AnimationUnusedPalette2: ; 791e5 (1e:51e5)
ld bc, $ffff
- jr Func_791fc
+ jr SetAnimationBGPalette
AnimationResetScreenPalette: ; 791ea (1e:51ea)
; Restores the screen's palette to the normal palette.
ld bc, $e4e4
- jr Func_791fc
+ jr SetAnimationBGPalette
-Func_791ef: ; 791ef (1e:51ef)
+AnimationUnusedPalette3: ; 791ef (1e:51ef)
ld bc, $0000
- jr Func_791fc
+ jr SetAnimationBGPalette
AnimationLightScreenPalette: ; 791f4 (1e:51f4)
; Changes the screen to use a palette with light colors.
ld bc, $9090
- jr Func_791fc
+ jr SetAnimationBGPalette
-Func_791f9: ; 791f9 (1e:51f9)
+AnimationUnusedPalette4: ; 791f9 (1e:51f9)
ld bc, $4040
-Func_791fc: ; 791fc (1e:51fc)
+SetAnimationBGPalette: ; 791fc (1e:51fc)
ld a, [wOnSGB]
and a
ld a, b
jr z, .asm_79204
ld a, c
.asm_79204
- ld [rBGP], a ; $ff47
+ ld [rBGP], a
ret
ld b, $5
@@ -1246,45 +1243,45 @@ AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
call LoadAnimationTileset
ld d, $20
ld a, $f0
- ld [W_BASECOORDX], a ; wd081
+ ld [W_BASECOORDX], a
ld a, $71
ld [wd09f], a
.asm_79228
ld a, $10
- ld [W_BASECOORDY], a ; wd082
+ ld [W_BASECOORDY], a
ld a, $0
ld [wd08a], a
- call Func_79246
+ call _AnimationWaterDroplets
ld a, $18
- ld [W_BASECOORDY], a ; wd082
+ ld [W_BASECOORDY], a
ld a, $20
ld [wd08a], a
- call Func_79246
+ call _AnimationWaterDroplets
dec d
jr nz, .asm_79228
ret
-Func_79246: ; 79246 (1e:5246)
+_AnimationWaterDroplets: ; 79246 (1e:5246)
ld hl, wOAMBuffer
.asm_79249
- ld a, [W_BASECOORDY] ; wd082
+ ld a, [W_BASECOORDY]
ld [hli], a
- ld a, [W_BASECOORDX] ; wd081
+ ld a, [W_BASECOORDX]
add $1b
- ld [W_BASECOORDX], a ; wd081
+ ld [W_BASECOORDX], a
ld [hli], a
ld a, [wd09f]
ld [hli], a
xor a
ld [hli], a
- ld a, [W_BASECOORDX] ; wd081
+ ld a, [W_BASECOORDX]
cp $90
jr c, .asm_79249
sub $a8
- ld [W_BASECOORDX], a ; wd081
- ld a, [W_BASECOORDY] ; wd082
+ ld [W_BASECOORDX], a
+ ld a, [W_BASECOORDY]
add $10
- ld [W_BASECOORDY], a ; wd082
+ ld [W_BASECOORDY], a
cp $70
jr c, .asm_79249
call AnimationCleanOAM
@@ -1304,7 +1301,7 @@ AnimationSlideMonUp: ; 7927a (1e:527a)
ld a, $ff
.asm_79291
ld [wd09f], a
- jp Func_792bf
+ jp _AnimationSlideMonUp
AnimationSlideMonDown: ; 79297 (1e:5297)
; Slides the mon's sprite down out of the screen.
@@ -1314,7 +1311,7 @@ AnimationSlideMonDown: ; 79297 (1e:5297)
call GetMonSpriteTileMapPointerFromRowCount
push bc
push de
- call Func_79aae
+ call CopyPicTiles
call Delay3
call AnimationHideMonPic
pop de
@@ -1327,15 +1324,15 @@ AnimationSlideMonOut: ; 792af (1e:52af)
; Slides the mon's sprite out of the screen horizontally.
ld e, $8
ld a, $3
- ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM
- jp Func_795f8
+ ld [W_SUBANIMTRANSFORM], a
+ jp AnimationSlideMonLeft
AnimationSlideEnemyMonOut: ; 792b9 (1e:52b9)
; Slides the enemy mon out of the screen horizontally.
- ld hl, AnimationSlideMonOut ; $52af
+ ld hl, AnimationSlideMonOut
jp CallWithTurnFlipped
-Func_792bf: ; 792bf (1e:52bf)
+_AnimationSlideMonUp: ; 792bf (1e:52bf)
push de
push hl
push bc
@@ -1368,16 +1365,16 @@ Func_792bf: ; 792bf (1e:52bf)
add $7
dec c
jr nz, .asm_792eb
- ld c, $2
+ ld c, 2
call DelayFrames
pop bc
pop hl
pop de
dec c
- jr nz, Func_792bf
+ jr nz, _AnimationSlideMonUp
ret
-Func_792fd: ; 792fd (1e:52fd)
+_AnimationShakeEnemyHUD: ; 792fd (1e:52fd)
ld a, $10
ld [W_BASECOORDX], a
ld a, $30
@@ -1390,7 +1387,7 @@ Func_792fd: ; 792fd (1e:52fd)
ld e, a
ld b, $5
.asm_79314
- call Func_79329
+ call Animations_79329
inc d
dec b
jr nz, .asm_79314
@@ -1403,12 +1400,12 @@ Func_792fd: ; 792fd (1e:52fd)
ld [W_BASECOORDX], a
jr .asm_7930e
-Func_79329: ; 79329 (1e:5329)
+Animations_79329: ; 79329 (1e:5329)
ld a, e
add $8
ld e, a
ld [hli], a
- ld a, [W_BASECOORDX] ; wd081
+ ld a, [W_BASECOORDX]
ld [hli], a
ld a, d
ld [hli], a
@@ -1464,7 +1461,7 @@ AdjustOAMBlockYPos2: ; 79352 (1e:5352)
AnimationBlinkEnemyMon: ; 79369 (1e:5369)
; Make the enemy mon's sprite blink on and off for a second or two
- ld hl, AnimationBlinkMon ; $536f
+ ld hl, AnimationBlinkMon
jp CallWithTurnFlipped
AnimationBlinkMon: ; 7936f (1e:536f)
@@ -1474,10 +1471,10 @@ AnimationBlinkMon: ; 7936f (1e:536f)
.asm_79372
push bc
call AnimationHideMonPic
- ld c, $5
+ ld c, 5
call DelayFrames
call AnimationShowMonPic
- ld c, $5
+ ld c, 5
call DelayFrames
pop bc
dec c
@@ -1502,7 +1499,7 @@ AnimationShowMonPic: ; 7939e (1e:539e)
xor a
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
- call Func_79aae
+ call CopyPicTiles
jp Delay3
AnimationShowEnemyMonPic: ; 793ab (1e:53ab)
@@ -1537,7 +1534,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
push hl
call GetTileIDList
pop hl
- call Func_79aae
+ call CopyPicTiles
call Delay3
pop hl
ld bc, $0709
@@ -1545,7 +1542,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
pop af
call GetTileIDList
pop hl
- call Func_79aae
+ call CopyPicTiles
call Delay3
pop hl
ld bc, $0709
@@ -1562,7 +1559,7 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9)
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
; animations like Tackle/Body Slam.
call AnimationHideMonPic
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
hlCoord 2, 5
jr z, .asm_79407
@@ -1572,13 +1569,13 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9)
push hl
call GetTileIDList
pop hl
- call Func_79aae
- ld c, $3
+ call CopyPicTiles
+ ld c, 3
jp DelayFrames
AnimationResetMonPosition: ; 79415 (1e:5415)
; Resets the mon's sprites to be located at the normal coordinates.
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
ld a, $66
jr z, .asm_7941e
@@ -1590,24 +1587,24 @@ AnimationResetMonPosition: ; 79415 (1e:5415)
AnimationSpiralBallsInward: ; 79424 (1e:5424)
; Creates an effect that looks like energy balls sprialing into the
; player mon's sprite. Used in Focus Energy, for example.
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_79435
ld a, $d8
ld [wd08a], a
ld a, $50
- ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM
+ ld [W_SUBANIMTRANSFORM], a
jr .asm_7943c
.asm_79435
xor a
ld [wd08a], a
- ld [W_SUBANIMTRANSFORM], a ; W_SUBANIMTRANSFORM
+ ld [W_SUBANIMTRANSFORM], a
.asm_7943c
ld d, $7a
ld c, $3
xor a
call Func_797e8
- ld hl, SpiralBallAnimationCoordinates ; $5476
+ ld hl, SpiralBallAnimationCoordinates
.asm_79447
push hl
ld c, $3
@@ -1621,7 +1618,7 @@ AnimationSpiralBallsInward: ; 79424 (1e:5424)
ld [de], a
inc de
inc hl
- ld a, [W_SUBANIMTRANSFORM] ; W_SUBANIMTRANSFORM
+ ld a, [W_SUBANIMTRANSFORM]
add [hl]
ld [de], a
inc hl
@@ -1630,7 +1627,7 @@ AnimationSpiralBallsInward: ; 79424 (1e:5424)
inc de
dec c
jr nz, .asm_7944d
- ld c, $5
+ ld c, 5
call DelayFrames
pop hl
inc hl
@@ -1674,7 +1671,7 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1)
ld c, $4
.asm_794a3
push bc
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_794b1
hlCoord 16, 0
@@ -1687,11 +1684,11 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1)
push de
xor a
ld [wd09f], a
- call Func_794d4
+ call _AnimationSquishMonPic
pop hl
ld a, $1
ld [wd09f], a
- call Func_794d4
+ call _AnimationSquishMonPic
pop bc
dec c
jr nz, .asm_794a3
@@ -1699,7 +1696,7 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1)
ld c, $2
jp DelayFrame
-Func_794d4: ; 794d4 (1e:54d4)
+_AnimationSquishMonPic: ; 794d4 (1e:54d4)
ld c, $7
.asm_794d6
push bc
@@ -1727,7 +1724,7 @@ Func_794d4: ; 794d4 (1e:54d4)
AnimationShootBallsUpward: ; 794f9 (1e:54f9)
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
; animations.
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_79503
ld bc, $80
@@ -1736,14 +1733,14 @@ AnimationShootBallsUpward: ; 794f9 (1e:54f9)
ld bc, $3028
.asm_79506
ld a, b
- ld [W_BASECOORDY], a ; wd082
+ ld [W_BASECOORDY], a
ld a, c
- ld [W_BASECOORDX], a ; wd081
+ ld [W_BASECOORDX], a
ld bc, $501
- call Func_79517
+ call _AnimationShootBallsUpward
jp AnimationCleanOAM
-Func_79517: ; 79517 (1e:5517)
+_AnimationShootBallsUpward: ; 79517 (1e:5517)
push bc
xor a
ld [wd09f], a
@@ -1752,10 +1749,10 @@ Func_79517: ; 79517 (1e:5517)
ld d, $7a
ld hl, wOAMBuffer
push bc
- ld a, [W_BASECOORDY] ; wd082
+ ld a, [W_BASECOORDY]
ld e, a
.asm_7952a
- call Func_79329
+ call Animations_79329
dec b
jr nz, .asm_7952a
call DelayFrame
@@ -1766,7 +1763,7 @@ Func_79517: ; 79517 (1e:5517)
push bc
ld hl, wOAMBuffer
.asm_7953c
- ld a, [W_BASECOORDY] ; wd082
+ ld a, [W_BASECOORDY]
add $8
ld e, a
ld a, [hl]
@@ -1812,7 +1809,7 @@ AnimationShootManyBallsUpward: ; 79566 (1e:5566)
ld [W_BASECOORDX], a
ld bc, $0401
push hl
- call Func_79517
+ call _AnimationShootBallsUpward
pop hl
jr .loop
@@ -1839,7 +1836,7 @@ AnimationMinimizeMon: ; 7959f (1e:559f)
pop hl
ld de, $194
add hl, de
- ld de, MinimizedMonSprite ; $55c4
+ ld de, MinimizedMonSprite
ld c, $5
.asm_795b4
ld a, [de]
@@ -1867,8 +1864,8 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9)
push af
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
- call Func_79aae
- ld c, $8
+ call CopyPicTiles
+ ld c, 8
call DelayFrames
pop af
inc a
@@ -1882,8 +1879,8 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9)
call FillMemory
jp Func_79652
-Func_795f8: ; 795f8 (1e:55f8)
- ld a, [H_WHOSETURN] ; $fff3
+AnimationSlideMonLeft: ; 795f8 (1e:55f8)
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_79602
hlCoord 12, 0
@@ -1898,7 +1895,7 @@ Func_795f8: ; 795f8 (1e:55f8)
.asm_7960a
ld c, $8
.asm_7960c
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_79616
call Func_7963c
@@ -1915,7 +1912,7 @@ Func_795f8: ; 795f8 (1e:55f8)
pop de
dec b
jr nz, .asm_7960a
- ld a, [W_SUBANIMTRANSFORM] ; W_SUBANIMTRANSFORM
+ ld a, [W_SUBANIMTRANSFORM]
ld c, a
call DelayFrames
pop hl
@@ -1945,11 +1942,11 @@ AnimationSlideMonHalfLeft: ; 79645 (1e:5645)
ld e, $4
ld a, $4
ld [W_SUBANIMTRANSFORM], a
- call Func_795f8
+ call AnimationSlideMonLeft
jp Delay3
Func_79652: ; 79652 (1e:5652)
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
ld hl, vBackPic
jr z, .asm_7965d
@@ -2028,7 +2025,7 @@ AnimationSubstitute: ; 796e0 (1e:56e0)
call FillMemory
ld a, [$fff3]
and a
- jr z, .asm_79715 ; 0x796ed $26
+ jr z, .asm_79715
ld hl, SlowbroSprite ; facing down sprite
ld de, wTempPic + $120
call CopySlowbroSpriteData
@@ -2065,13 +2062,13 @@ CopySlowbroSpriteData: ; 7973f (1e:573f)
jp FarCopyData2
Func_79747: ; 79747 (1e:5747)
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
ld hl, wccf7
- ld a, [W_PLAYERBATTSTATUS2] ; W_PLAYERBATTSTATUS2
+ ld a, [W_PLAYERBATTSTATUS2]
jr z, .asm_79758
ld hl, wccf3
- ld a, [W_ENEMYBATTSTATUS2] ; W_ENEMYBATTSTATUS2
+ ld a, [W_ENEMYBATTSTATUS2]
.asm_79758
push hl
bit 4, a
@@ -2102,7 +2099,7 @@ AnimationBoundUpAndDown: ; 7977a (1e:577a)
call AnimationSlideMonDown
pop bc
dec c
- jr nz, .asm_7977c ; 0x79782 $f8
+ jr nz, .asm_7977c
jp AnimationShowMonPic
AnimationTransformMon: ; 79787 (1e:5787)
@@ -2114,7 +2111,7 @@ AnimationTransformMon: ; 79787 (1e:5787)
ld [wHPBarMaxHP], a
Func_79793: ; 79793 (1e:5793)
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_797b0
ld a, [wHPBarMaxHP]
@@ -2137,7 +2134,7 @@ Func_79793: ; 79793 (1e:5793)
xor a
call GetTileIDList
call GetMonSpriteTileMapPointerFromRowCount
- call Func_79aae
+ call CopyPicTiles
pop af
ld [wBattleMonSpecies2], a
.asm_797d3
@@ -2147,11 +2144,11 @@ Func_79793: ; 79793 (1e:5793)
AnimationHideEnemyMonPic: ; 797d8 (1e:57d8)
; Hides the enemy mon's sprite
xor a
- ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
- ld hl, AnimationHideMonPic ; $5801
+ ld [H_AUTOBGTRANSFERENABLED], a
+ ld hl, AnimationHideMonPic
call CallWithTurnFlipped
ld a, $1
- ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
+ ld [H_AUTOBGTRANSFERENABLED], a
jp Delay3
Func_797e8: ; 797e8 (1e:57e8)
@@ -2163,17 +2160,17 @@ Func_797e8: ; 797e8 (1e:57e8)
pop bc
xor a
ld e, a
- ld [W_BASECOORDX], a ; wd081
+ ld [W_BASECOORDX], a
ld hl, wOAMBuffer
.asm_797fa
- call Func_79329
+ call Animations_79329
dec c
jr nz, .asm_797fa
ret
AnimationHideMonPic: ; 79801 (1e:5801)
; Hides the mon's sprite.
- ld a, [H_WHOSETURN] ; $fff3
+ ld a, [H_WHOSETURN]
and a
jr z, .asm_7980a
ld a, $c
@@ -2269,13 +2266,15 @@ Func_79862: ; 79862 (1e:5862)
jr nz, Func_79862
ret
-Func_79869: ; 79869 (1e:5869)
+; get the sound of the move id in b
+GetMoveSoundB: ; 79869 (1e:5869)
ld a, b
- call Func_7986f
+ call GetMoveSound
ld b, a
ret
-Func_7986f: ; 7986f (1e:586f)
+; get the sound of the move id in a
+GetMoveSound: ; 7986f (1e:586f)
ld hl,MoveSoundTable
ld e,a
ld d,0
@@ -2496,7 +2495,7 @@ MoveSoundTable: ; 798bc (1e:58bc)
db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80
db (SFX_08_4b - SFX_Headers_08) / 3,$00,$80
-Func_79aae: ; 79aae (1e:5aae)
+CopyPicTiles: ; 79aae (1e:5aae)
ld a, [H_WHOSETURN]
and a
ld a, $31 ; base tile ID of player mon sprite
@@ -2507,15 +2506,17 @@ Func_79aae: ; 79aae (1e:5aae)
ld [hBaseTileID], a
jr asm_79acb
-Func_79aba: ; 79aba (1e:5aba)
+; copy the tiles used when a mon is being sent out
+; and "growing" out of the pokeball
+CopyGrowingMonTiles: ; 79aba (1e:5aba)
call GetPredefRegisters
ld a, [wcd6c]
and a
jr nz, .asm_79ac8
- ld de, Unknown_79b02 ; $5b02
+ ld de, Unknown_79b02 ; 5x5
jr asm_79acb
.asm_79ac8
- ld de, Unknown_79b1b ; $5b1b
+ ld de, Unknown_79b1b ; 3x3
asm_79acb: ; 79acb (1e:5acb)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
@@ -2811,7 +2812,7 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77)
call Func_79e0d
ld a, $38
ld [hWY], a
- call Func_792fd
+ call _AnimationShakeEnemyHUD
ld hl, vBGMap0
call Func_79e0d
call AnimationHideMonPic
@@ -2854,12 +2855,12 @@ Func_79de9: ; 79de9 (1e:5de9)
ld a, [wTrainerSpriteOffset]
add d
ld [hSCX], a
- ld c, $2
+ ld c, 2
call DelayFrames
ld a, [wTrainerSpriteOffset]
sub d
ld [hSCX], a
- ld c, $2
+ ld c, 2
call DelayFrames
dec e
jr nz, .asm_79dee
@@ -2926,7 +2927,7 @@ TossBallAnimation: ; 79e16 (1e:5e16)
ld [W_ANIMATIONID],a
call PlayAnimation
ld a,(SFX_08_43 - SFX_Headers_08) / 3
- call PlaySound ; play sound effect
+ call PlaySound
ld a,BLOCKBALL_ANIM
ld [W_ANIMATIONID],a
jp PlayAnimation
diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm
index 78b27108..80fa971a 100644..100755
--- a/engine/battle/bank_e_misc.asm
+++ b/engine/battle/bank_e_misc.asm
@@ -52,40 +52,40 @@ FormatMovesString: ; 39b87 (e:5b87)
ret
; XXX this is called in a few places, but it doesn't appear to do anything useful
-Func_39bd5: ; 39bd5 (e:5bd5)
+InitList: ; 39bd5 (e:5bd5)
ld a, [wd11b]
cp $1
- jr nz, .asm_39be6
+ jr nz, .notEnemy
ld hl, wEnemyPartyCount
ld de, wEnemyMonOT
ld a, ENEMYOT_NAME
- jr .asm_39c18
-.asm_39be6
+ jr .done
+.notEnemy
cp $4
- jr nz, .calcAttackStat4
+ jr nz, .notPlayer
ld hl, wPartyCount
ld de, wPartyMonOT
ld a, PLAYEROT_NAME
- jr .asm_39c18
-.calcAttackStat4
+ jr .done
+.notPlayer
cp $5
- jr nz, .asm_39c02
+ jr nz, .notMonster
ld hl, wStringBuffer2 + 11
ld de, MonsterNames
ld a, MONSTER_NAME
- jr .asm_39c18
-.asm_39c02
+ jr .done
+.notMonster
cp $2
- jr nz, .asm_39c10
+ jr nz, .notBag
ld hl, wNumBagItems
ld de, ItemNames
ld a, ITEM_NAME
- jr .asm_39c18
-.asm_39c10
+ jr .done
+.notBag
ld hl, wStringBuffer2 + 11
ld de, ItemNames
ld a, ITEM_NAME
-.asm_39c18
+.done
ld [wNameListType], a
ld a, l
ld [wList], a
@@ -119,4 +119,4 @@ GetMonSpecies: ; 39c37 (e:5c37)
add hl, de
ld a, [hl]
ld [wcf91], a
- ret \ No newline at end of file
+ ret
diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm
index f1aa4161..b231459d 100644
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -352,7 +352,7 @@ BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d)
cp $1
jr z, .done
ld [rBGP], a
- ld c, $2
+ ld c, 2
call DelayFrames
jr .loop
.done
@@ -389,13 +389,13 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f)
call BattleTransition_CopyTiles2
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
- ld c, $6
+ ld c, 6
call DelayFrames
pop bc
dec c
jr nz, .loop
call BattleTransition_BlackScreen
- ld c, $a
+ ld c, 10
jp DelayFrames
; used for high level trainer dungeon battles
@@ -427,7 +427,7 @@ BattleTransition_Split: ; 70bca (1c:4bca)
dec c
jr nz, .loop
call BattleTransition_BlackScreen
- ld c, $a
+ ld c, 10
jp DelayFrames
BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)
diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm
index 9a00bd98..11309a86 100644
--- a/engine/battle/common_text.asm
+++ b/engine/battle/common_text.asm
@@ -1,8 +1,8 @@
PrintBeginningBattleText: ; 58d99 (16:4d99)
- ld a, [W_ISINBATTLE] ; W_ISINBATTLE
+ ld a, [W_ISINBATTLE]
dec a
jr nz, .trainerBattle
- ld a, [W_CURMAP] ; W_CURMAP
+ ld a, [W_CURMAP]
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] ; W_MOVEMISSED
+ ld a, [W_MOVEMISSED]
and a
jr z, .notFishing
ld hl, HookedMonAttackedText
@@ -19,7 +19,7 @@ PrintBeginningBattleText: ; 58d99 (16:4d99)
jr .wildBattle
.trainerBattle
call .playSFX
- ld c, $14
+ ld c, 20
call DelayFrames
ld hl, TrainerWantsToFightText
.wildBattle
@@ -139,22 +139,22 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59)
GoText: ; 58eae (16:4eae)
TX_FAR _GoText
- db $08 ; asm
+ TX_ASM
jr PrintPlayerMon1Text
DoItText: ; 58eb5 (16:4eb5)
TX_FAR _DoItText
- db $08 ; asm
+ TX_ASM
jr PrintPlayerMon1Text
GetmText: ; 58ebc (16:4ebc)
TX_FAR _GetmText
- db $08 ; asm
+ TX_ASM
jr PrintPlayerMon1Text
EnemysWeakText: ; 58ec3 (16:4ec3)
TX_FAR _EnemysWeakText
- db $08 ; asm
+ TX_ASM
PrintPlayerMon1Text:
ld hl, PlayerMon1Text
@@ -170,7 +170,7 @@ RetreatMon: ; 58ed1 (16:4ed1)
PlayerMon2Text: ; 58ed7 (16:4ed7)
TX_FAR _PlayerMon2Text
- db $08 ; asm
+ TX_ASM
push de
push bc
ld hl, wEnemyMonHP + 1
@@ -216,17 +216,17 @@ PlayerMon2Text: ; 58ed7 (16:4ed7)
EnoughText: ; 58f25 (16:4f25)
TX_FAR _EnoughText
- db $08 ; asm
+ TX_ASM
jr PrintComeBackText
OKExclamationText: ; 58f2c (16:4f2c)
TX_FAR _OKExclamationText
- db $08 ; asm
+ TX_ASM
jr PrintComeBackText
GoodText: ; 58f33 (16:4f33)
TX_FAR _GoodText
- db $08 ; asm
+ TX_ASM
jr PrintComeBackText
PrintComeBackText: ; 58f3a (16:4f3a)
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 04a6de1c..ec67d094 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -177,7 +177,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c)
ld a, $31
ld [$ffe1], a
hlCoord 1, 5
- predef Func_3f0c6
+ predef CopyUncompressedPicToTilemap
xor a
ld [hWY], a
ld [rWY], a
@@ -620,7 +620,7 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
or [hl]
ret nz ; test if fainted
call DrawHUDsAndHPBars
- ld c, $14
+ ld c, 20
call DelayFrames
xor a
ret
@@ -823,7 +823,7 @@ HandleEnemyMonFainted: ; 3c525 (f:4525)
ld [wcd6a], a
jp MainInBattleLoop
-FaintEnemyPokemon ; 0x3c567
+FaintEnemyPokemon: ; 0x3c567
call ReadPlayerMonCurHPAndStatus
ld a, [W_ISINBATTLE]
dec a
@@ -1020,10 +1020,10 @@ TrainerBattleVictory: ; 3c696 (f:4696)
cp LINK_STATE_BATTLING
ret z
call ScrollTrainerPicAfterBattle
- ld c, $28
+ ld c, 40
call DelayFrames
call PrintEndBattleText
-; win money
+; win money
ld hl, MoneyForWinningText
call PrintText
ld de, wPlayerMoney + 2
@@ -1218,7 +1218,7 @@ HandlePlayerBlackOut: ; 3c837 (f:4837)
ld bc, $815
call ClearScreenArea
call ScrollTrainerPicAfterBattle
- ld c, $28
+ ld c, 40
call DelayFrames
ld hl, Sony1WinText
call PrintText
@@ -1506,7 +1506,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld a,$CF
ld [$FFE1],a
hlCoord 15, 6
- predef Func_3f073
+ predef AnimateSendingOutMon
ld a,[wEnemyMonSpecies2]
call PlayCry
call DrawEnemyHUDAndHPBar
@@ -1642,7 +1642,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
ld b, a
ld a, [H_QUOTIENT + 3]
cp b
- jr nc, .canEscape ; if the random value was less than or equal to the quotient
+ jr nc, .canEscape ; if the random value was less than or equal to the quotient
; plus 30 times the number of attempts, the player can escape
; can't escape
ld a, $1
@@ -1836,7 +1836,7 @@ SendOutMon: ; 3cc91 (f:4c91)
ld a, POOF_ANIM
call PlayMoveAnimation
hlCoord 4, 11
- predef Func_3f073
+ predef AnimateSendingOutMon
ld a, [wcf91]
call PlayCry
call PrintEmptyString
@@ -1852,8 +1852,8 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
xor a
ld [wcd6c], a
ld [H_DOWNARROWBLINKCNT1], a
- predef Func_79aba
- ld c, $4
+ predef CopyGrowingMonTiles
+ ld c, 4
call DelayFrames
call .clearScreenArea
hlCoord 4, 9
@@ -1862,7 +1862,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
ld [wcd6c], a
xor a
ld [H_DOWNARROWBLINKCNT1], a
- predef Func_79aba
+ predef CopyGrowingMonTiles
call Delay3
call .clearScreenArea
ld a, $4c
@@ -2110,12 +2110,12 @@ DisplayBattleMenu: ; 3ceb3 (f:4eb3)
; the following simulates the keystrokes by drawing menus on screen
hlCoord 9, 14
ld [hl], "â–¶"
- ld c, $50
+ ld c, 80
call DelayFrames
ld [hl], $7f
hlCoord 9, 16
ld [hl], "â–¶"
- ld c, $32
+ ld c, 50
call DelayFrames
ld [hl], $ec
ld a, $2 ; select the "ITEM" menu
@@ -2490,7 +2490,7 @@ PartyMenuOrRockOrRun:
SwitchPlayerMon: ; 3d1ba (f:51ba)
callab RetreatMon
- ld c, $32
+ ld c, 50
call DelayFrames
call AnimateRetreatingPlayerMon
ld a, [wWhichPokemon]
@@ -2815,7 +2815,7 @@ AnyMoveToSelect: ; 3d3f5 (f:53f5)
.asm_3d423
ld hl, NoMovesLeftText
call PrintText
- ld c, $3c
+ ld c, 60
call DelayFrames
xor a
ret
@@ -2930,8 +2930,8 @@ PrintMenuItem: ; 3d4b6 (f:54b6)
ld c, a
ld b, $0 ; which item in the menu is the cursor pointing to? (0-3)
add hl, bc ; point to the item (move) in memory
- ld a, [hl]
- ld [wPlayerSelectedMove], a ; update wPlayerSelectedMove even if the move
+ ld a, [hl]
+ ld [wPlayerSelectedMove], a ; update wPlayerSelectedMove even if the move
; isn't actually selected (just pointed to by the cursor)
ld a, [wPlayerMonNumber]
ld [wWhichPokemon], a
@@ -2947,7 +2947,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6)
ld a, [hl]
and $3f
ld [wcd6d], a
-; print TYPE/<type> and <curPP>/<maxPP>
+; print TYPE/<type> and <curPP>/<maxPP>
hlCoord 1, 9
ld de, TypeText
call PlaceString
@@ -2963,7 +2963,7 @@ PrintMenuItem: ; 3d4b6 (f:54b6)
ld de, wd11e
ld bc, $102
call PrintNumber
- call GetCurrentMove
+ call GetCurrentMove
hlCoord 2, 10
predef PrintMoveType
.moveDisabled
@@ -3174,13 +3174,13 @@ PlayerCanExecuteMove: ; 3d6b0 (f:56b0)
ld hl,ResidualEffects1
ld de,1
call IsInArray
- jp c,JumpMoveEffect ; ResidualEffects1 moves skip damage calculation and accuracy tests
- ; unless executed as part of their exclusive effect functions
+ jp c,JumpMoveEffect ; ResidualEffects1 moves skip damage calculation and accuracy tests
+ ; unless executed as part of their exclusive effect functions
ld a,[W_PLAYERMOVEEFFECT]
ld hl,SpecialEffectsCont
ld de,1
call IsInArray
- call c,JumpMoveEffect ; execute the effects of SpecialEffectsCont moves (e.g. Wrap, Thrash) but don't skip anything
+ call c,JumpMoveEffect ; execute the effects of SpecialEffectsCont moves (e.g. Wrap, Thrash) but don't skip anything
PlayerCalcMoveDamage: ; 3d6dc (f:56dc)
ld a,[W_PLAYERMOVEEFFECT]
ld hl,SetDamageEffects
@@ -3203,7 +3203,7 @@ handleIfPlayerMoveMissed
and a
jr z,getPlayerAnimationType
ld a,[W_PLAYERMOVEEFFECT]
- sub a,EXPLODE_EFFECT
+ sub a,EXPLODE_EFFECT
jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
jr playerCheckIfFlyOrChargeEffect
getPlayerAnimationType
@@ -3232,7 +3232,7 @@ playPlayerMoveAnimation
call nz,Bankswitch
jr MirrorMoveCheck
playerCheckIfFlyOrChargeEffect
- ld c,$1E
+ ld c,30
call DelayFrames
ld a,[W_PLAYERMOVEEFFECT]
cp a,FLY_EFFECT
@@ -3298,7 +3298,7 @@ MirrorMoveCheck
ld a,[wPlayerNumAttacksLeft]
dec a
ld [wPlayerNumAttacksLeft],a
- jp nz,getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
+ jp nz,getPlayerAnimationType ; for multi-hit moves, apply attack until PlayerNumAttacksLeft hits 0 or the enemy faints.
; damage calculation and accuracy tests only happen for the first hit
res AttackingMultipleTimes,[hl] ; clear attacking multiple times status when all attacks are over
ld hl,MultiHitText
@@ -3509,8 +3509,8 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
.MonHurtItselfOrFullyParalysed
ld hl,W_PLAYERBATTSTATUS1
ld a,[hl]
- ; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage)
- and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
+ ; clear bide, thrashing, charging up, and trapping moves such as warp (already cleared for confusion damage)
+ and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
ld [hl],a
ld a,[W_PLAYERMOVEEFFECT]
cp a,FLY_EFFECT
@@ -3588,7 +3588,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
ld hl,wPlayerNumAttacksLeft
dec [hl] ; did Thrashing About counter hit 0?
ld hl,PlayerCalcMoveDamage ; skip DecrementPP
- jp nz,.returnToHL
+ jp nz,.returnToHL
push hl
ld hl,W_PLAYERBATTSTATUS1
res ThrashingAbout,[hl] ; no longer thrashing about
@@ -3609,7 +3609,7 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854)
ld a,[wPlayerNumAttacksLeft]
dec a ; did multi-turn move end?
ld [wPlayerNumAttacksLeft],a
- ld hl,getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
+ ld hl,getPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
; DecrementPP and MoveHitTest
jp nz,.returnToHL
jp .returnToHL
@@ -3706,7 +3706,7 @@ PrintMoveIsDisabledText: ; 3da88 (f:5a88)
ld de, W_ENEMYBATTSTATUS1
.removeChargingUp
ld a, [de]
- res ChargingUp, a ; end the pokemon's
+ res ChargingUp, a ; end the pokemon's
ld [de], a
ld a, [hl]
ld [wd11e], a
@@ -3766,9 +3766,14 @@ PrintMonName1Text: ; 3daf5 (f:5af5)
ld hl, MonName1Text
jp PrintText
+; this function wastes time calling DetermineExclamationPointTextNum
+; and choosing between Used1Text and Used2Text, even though
+; those text strings are identical and both continue at PrintInsteadText
+; this likely had to do with Japanese grammar that got translated,
+; but the functionality didn't get removed
MonName1Text: ; 3dafb (f:5afb)
TX_FAR _MonName1Text
- db $08 ; asm
+ TX_ASM
ld a, [H_WHOSETURN]
and a
ld a, [W_PLAYERMOVENUM]
@@ -3779,7 +3784,7 @@ MonName1Text: ; 3dafb (f:5afb)
.asm_3db11
ld [hl], a
ld [wd11e], a
- call Func_3db85
+ call DetermineExclamationPointTextNum
ld a, [wMonIsDisobedient]
and a
ld hl, Used2Text
@@ -3793,33 +3798,35 @@ MonName1Text: ; 3dafb (f:5afb)
Used1Text: ; 3db2d (f:5b2d)
TX_FAR _Used1Text
- db $08 ; asm
+ TX_ASM
jr PrintInsteadText
Used2Text: ; 3db34 (f:5b34)
TX_FAR _Used2Text
- db $08 ; asm
+ TX_ASM
+ ; fall through
PrintInsteadText: ; 3db39 (f:5b39)
ld a, [wMonIsDisobedient]
and a
- jr z, PrintCF4BText
+ jr z, PrintMoveName
ld hl, InsteadText
ret
InsteadText: ; 3db43 (f:5b43)
TX_FAR _InsteadText
- db $08 ; asm
+ TX_ASM
+ ; fall through
-PrintCF4BText: ; 3db48 (f:5b48)
- ld hl, CF4BText
+PrintMoveName: ; 3db48 (f:5b48)
+ ld hl, _PrintMoveName
ret
-CF4BText: ; 3db4c (f:5b4c)
+_PrintMoveName: ; 3db4c (f:5b4c)
TX_FAR _CF4BText
- db $08 ; asm
+ TX_ASM
ld hl, ExclamationPointPointerTable
- ld a, [wd11e]
+ ld a, [wd11e] ; exclamation point num
add a
push bc
ld b, $0
@@ -3858,29 +3865,36 @@ ExclamationPoint5Text: ; 3db80 (f:5b80)
TX_FAR _ExclamationPoint5Text
db "@"
-Func_3db85: ; 3db85 (f:5b85)
+; this function does nothing useful
+; if the move being used is in set [1-4] from ExclamationPointMoveSets,
+; use ExclamationPoint[1-4]Text
+; otherwise, use ExclamationPoint5Text
+; but all five text strings are identical
+; this likely had to do with Japanese grammar that got translated,
+; but the functionality didn't get removed
+DetermineExclamationPointTextNum: ; 3db85 (f:5b85)
push bc
- ld a, [wd11e] ; move number
+ ld a, [wd11e] ; move ID
ld c, a
ld b, $0
- ld hl, UnknownMovesList_3dba3
-.asm_3db8f
+ ld hl, ExclamationPointMoveSets
+.loop
ld a, [hli]
cp $ff
- jr z, .asm_3db9d
+ jr z, .done
cp c
- jr z, .asm_3db9d
+ jr z, .done
and a
- jr nz, .asm_3db8f
+ jr nz, .loop
inc b
- jr .asm_3db8f
-.asm_3db9d
+ jr .loop
+.done
ld a, b
- ld [wd11e], a
+ ld [wd11e], a ; exclamation point num
pop bc
ret
-UnknownMovesList_3dba3: ; 3dba3 (f:5ba3)
+ExclamationPointMoveSets: ; 3dba3 (f:5ba3)
db SWORDS_DANCE, GROWTH
db $00
db RECOVER, BIDE, SELFDESTRUCT, AMNESIA
@@ -3923,7 +3937,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
; if you get here, the mon used jump kick or hi jump kick and missed
ld hl, W_DAMAGE ; since the move missed, W_DAMAGE will always contain 0 at this point.
- ; Thus, recoil damage will always be equal to 1
+ ; Thus, recoil damage will always be equal to 1
; even if it was intended to be potential damage/8.
ld a, [hli]
ld b, [hl]
@@ -3990,7 +4004,7 @@ PrintCriticalOHKOText: ; 3dc5c (f:5c5c)
xor a
ld [wCriticalHitOrOHKO], a
.done
- ld c, $14
+ ld c, 20
jp DelayFrames
CriticalOHKOTextPointers: ; 3dc7a (f:5c7a)
@@ -4677,7 +4691,7 @@ CriticalHitTest: ; 3e023 (f:6023)
jr z, .calcCriticalHitProbability
ld hl, W_ENEMYMOVEPOWER
ld de, W_ENEMYBATTSTATUS2
-.calcCriticalHitProbability ; 0x3e04f
+.calcCriticalHitProbability
ld a, [hld] ; read base power from RAM
and a
ret z ; do nothing if zero
@@ -4776,7 +4790,7 @@ HandleCounterMove: ; 3e093 (f:6093)
ld a,[hli]
or [hl]
ret z ; If we made it here, Counter still misses if the last move used in battle did no damage to its target.
- ; W_DAMAGE is shared by both players, so Counter may strike back damage dealt by the Counter user itself
+ ; W_DAMAGE is shared by both players, so Counter may strike back damage dealt by the Counter user itself
; if the conditions meet, even though 99% of the times damage will come from the target.
; if it did damage, double it
ld a,[hl]
@@ -5037,9 +5051,9 @@ ApplyAttackToPlayerPokemonDone
AttackSubstitute: ; 3e25e (f:625e)
; Unlike the two ApplyAttackToPokemon functions, Attack Substitute is shared by player and enemy.
; Self-confusion damage as well as Hi-Jump Kick and Jump Kick recoil cause a momentary turn swap before being applied.
-; If the user has a Substitute up and would take damage because of that,
+; If the user has a Substitute up and would take damage because of that,
; damage will be applied to the other player's Substitute.
-; Normal recoil such as from Double-Edge isn't affected by this glitch,
+; Normal recoil such as from Double-Edge isn't affected by this glitch,
; because this function is never called in that case.
ld hl,SubstituteTookDamageText
@@ -5064,7 +5078,7 @@ AttackSubstitute: ; 3e25e (f:625e)
ld [de],a
ret nc
.substituteBroke
-; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP
+; If the target's Substitute breaks, W_DAMAGE isn't updated with the amount of HP
; the Substitute had before being attacked.
ld h,b
ld l,c
@@ -5565,7 +5579,7 @@ CalcHitChance: ; 3e624 (f:6624)
; the second iteration multiplies by the evasion ratio
.loop
push bc
- ld hl, StatModifierRatios ; $76cb ; stat modifier ratios
+ ld hl, StatModifierRatios ; stat modifier ratios
dec b
sla b
ld c,b
@@ -5771,7 +5785,7 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1)
call SwapPlayerAndEnemyLevels
- ld c, $1e
+ ld c, 30
call DelayFrames
ld a, [W_ENEMYMOVEEFFECT]
cp FLY_EFFECT
@@ -6023,7 +6037,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
.monHurtItselfOrFullyParalysed
ld hl, W_ENEMYBATTSTATUS1
ld a, [hl]
- ; clear bide, thrashing about, charging up, and multi-turn moves such as warp
+ ; clear bide, thrashing about, charging up, and multi-turn moves such as warp
and $ff ^ ((1 << StoringEnergy) | (1 << ThrashingAbout) | (1 << ChargingUp) | (1 << UsingTrappingMove))
ld [hl], a
ld a, [W_ENEMYMOVEEFFECT]
@@ -6119,7 +6133,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f)
call PrintText
ld hl, wEnemyNumAttacksLeft
dec [hl] ; did multi-turn move end?
- ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
+ ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit),
; DecrementPP and MoveHitTest
jp nz, .enemyReturnToHL
jp .enemyReturnToHL
@@ -6442,7 +6456,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
ld a, $31
ld [$ffe1], a
hlCoord 1, 5
- predef_jump Func_3f0c6
+ predef_jump CopyUncompressedPicToTilemap
; does nothing since no stats are ever selected (barring glitches)
DoubleOrHalveSelectedStats: ; 3ed02 (f:6d02)
@@ -6753,8 +6767,8 @@ BattleRandom:
push hl
push bc
push af
-
-; point to seed 0 so we pick the first number the next time
+
+; point to seed 0 so we pick the first number the next time
xor a
ld [wLinkBattleRandomNumberListIndex], a
@@ -6763,11 +6777,11 @@ BattleRandom:
.loop
ld a, [hl]
ld c, a
-; multiply by 5
+; multiply by 5
add a
add a
add c
-; add 1
+; add 1
inc a
ld [hli], a
dec b
@@ -6782,11 +6796,11 @@ BattleRandom:
HandleExplodingAnimation: ; 3eed3 (f:6ed3)
ld a, [H_WHOSETURN]
and a
- ld hl, wEnemyMonType1 ; wcfea
+ ld hl, wEnemyMonType1
ld de, W_ENEMYBATTSTATUS1
ld a, [W_PLAYERMOVENUM]
jr z, .asm_3eeea
- ld hl, wBattleMonType1 ; wd019
+ ld hl, wBattleMonType1
ld de, W_ENEMYBATTSTATUS1
ld a, [W_ENEMYMOVENUM]
.asm_3eeea
@@ -6818,14 +6832,15 @@ PlayMoveAnimation: ; 3ef07 (f:6f07)
InitBattle: ; 3ef12 (f:6f12)
ld a, [W_CUROPPONENT]
and a
- jr z, asm_3ef23
+ jr z, DetermineWildOpponent
InitOpponent: ; 3ef18 (f:6f18)
ld a, [W_CUROPPONENT]
ld [wcf91], a
ld [wEnemyMonSpecies2], a
- jr asm_3ef3d
-asm_3ef23: ; 3ef23 (f:6f23)
+ jr InitBattleCommon
+
+DetermineWildOpponent: ; 3ef23 (f:6f23)
ld a, [wd732]
bit 1, a
jr z, .asm_3ef2f
@@ -6838,7 +6853,7 @@ asm_3ef23: ; 3ef23 (f:6f23)
ret nz
callab TryDoWildEncounter
ret nz
-asm_3ef3d: ; 3ef3d (f:6f3d)
+InitBattleCommon: ; 3ef3d (f:6f3d)
ld a, [wMapPalOffset]
push af
ld hl, wd358
@@ -6860,7 +6875,7 @@ asm_3ef3d: ; 3ef3d (f:6f3d)
dec a
ld [wAICount], a
hlCoord 12, 0
- predef Func_3f0c6
+ predef CopyUncompressedPicToTilemap
ld a, $ff
ld [wEnemyMonPartyPos], a
ld a, $2
@@ -6914,7 +6929,7 @@ InitWildBattle: ; 3ef8b (f:6f8b)
ld [W_TRAINERCLASS], a
ld [$ffe1], a
hlCoord 12, 0
- predef Func_3f0c6
+ predef CopyUncompressedPicToTilemap
; common code that executes after init battle code specific to trainer or wild battles
InitBattle_Common: ; 3efeb (f:6feb)
@@ -6960,9 +6975,9 @@ InitBattle_Common: ; 3efeb (f:6feb)
_LoadTrainerPic: ; 3f04b (f:704b)
; wd033-wd034 contain pointer to pic
- ld a, [wTrainerPicPointer] ; wd033
+ ld a, [wTrainerPicPointer]
ld e, a
- ld a, [wTrainerPicPointer + 1] ; wd034
+ ld a, [wTrainerPicPointer + 1]
ld d, a ; de contains pointer to trainer pic
ld a, [wLinkState]
and a
@@ -6977,13 +6992,14 @@ _LoadTrainerPic: ; 3f04b (f:704b)
jp LoadUncompressedSpriteData
; unreferenced
-Func_3f069: ; 3f069 (f:7069)
+ResetCryModifiers: ; 3f069 (f:7069)
xor a
ld [wc0f1], a
ld [wc0f2], a
jp PlaySound
-Func_3f073: ; 3f073 (f:7073)
+; animtes the mon "growing" out of the pokeball
+AnimateSendingOutMon: ; 3f073 (f:7073)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
@@ -7002,16 +7018,16 @@ Func_3f073: ; 3f073 (f:7073)
ld a, $1
ld [wcd6c], a
ld bc, $303
- predef Func_79aba
- ld c, $4
+ predef CopyGrowingMonTiles
+ ld c, 4
call DelayFrames
ld bc, -41
add hl, bc
xor a
ld [wcd6c], a
ld bc, $505
- predef Func_79aba
- ld c, $5
+ predef CopyGrowingMonTiles
+ ld c, 5
call DelayFrames
ld bc, -41
jr .asm_3f0bf
@@ -7021,15 +7037,15 @@ Func_3f073: ; 3f073 (f:7073)
add hl, bc
ld a, [H_DOWNARROWBLINKCNT1]
add $31
- jr asm_3f0d0
+ jr CopyUncompressedPicToHL
-Func_3f0c6: ; 3f0c6 (f:70c6)
+CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
ld l, a
ld a, [$ffe1]
-asm_3f0d0: ; 3f0d0 (f:70d0)
+CopyUncompressedPicToHL: ; 3f0d0 (f:70d0)
ld bc, $707
ld de, $14
push af
@@ -7052,7 +7068,7 @@ asm_3f0d0: ; 3f0d0 (f:70d0)
dec b
jr nz, .asm_3f0de
ret
-
+
.asm_3f0ed
push bc
ld b, $0
@@ -7342,7 +7358,7 @@ PoisonEffect: ; 3f24f (f:724f)
cp POISON_EFFECT
ret nz
.didntAffect
- ld c, $32
+ ld c, 50
call DelayFrames
jp PrintDidntAffectText
@@ -7604,17 +7620,17 @@ StatModifierUpEffect: ; 3f428 (f:7428)
add hl, bc
pop bc
xor a
- ld [H_MULTIPLICAND], a
+ ld [H_MULTIPLICAND], a
ld a, [de]
ld [H_MULTIPLICAND + 1], a
inc de
ld a, [de]
ld [H_MULTIPLICAND + 2], a
ld a, [hli]
- ld [H_MULTIPLIER], a
+ ld [H_MULTIPLIER], a
call Multiply
ld a, [hl]
- ld [H_DIVISOR], a
+ ld [H_DIVISOR], a
ld b, $4
call Divide
pop hl
@@ -7638,7 +7654,7 @@ UpdateStat: ; 3f4c3 (f:74c3)
UpdateStatDone: ; 3f4ca (f:74ca)
ld b, c
inc b
- call Func_3f688
+ call PrintStatText
ld hl, W_PLAYERBATTSTATUS2
ld de, W_PLAYERMOVENUM
ld bc, wccf7
@@ -7694,7 +7710,7 @@ PrintNothingHappenedText: ; 3f522 (f:7522)
MonsStatsRoseText: ; 3f528 (f:7528)
TX_FAR _MonsStatsRoseText
- db $08 ; asm
+ TX_ASM
ld hl, GreatlyRoseText
ld a, [H_WHOSETURN]
and a
@@ -7808,7 +7824,7 @@ StatModifierDownEffect: ; 3f54c (f:754c)
jr nz, .recalculateStat
ld a, [hl]
and a
- jp z, Func_3f64d
+ jp z, CantLowerAnymore_Pop
.recalculateStat
; recalculate affected stat
; paralysis and burn penalties, as well as badge boosts are ignored
@@ -7822,17 +7838,17 @@ StatModifierDownEffect: ; 3f54c (f:754c)
add hl, bc
pop bc
xor a
- ld [H_MULTIPLICAND], a
+ ld [H_MULTIPLICAND], a
ld a, [de]
ld [H_MULTIPLICAND + 1], a
inc de
ld a, [de]
ld [H_MULTIPLICAND + 2], a
ld a, [hli]
- ld [H_MULTIPLIER], a
+ ld [H_MULTIPLIER], a
call Multiply
ld a, [hl]
- ld [H_DIVISOR], a
+ ld [H_DIVISOR], a
ld b, $4
call Divide
pop hl
@@ -7856,7 +7872,7 @@ UpdateLoweredStatDone: ; 3f62c (f:762c)
ld b, c
inc b
push de
- call Func_3f688
+ call PrintStatText
pop de
ld a, [de]
cp $44
@@ -7876,7 +7892,7 @@ UpdateLoweredStatDone: ; 3f62c (f:762c)
call QuarterSpeedDueToParalysis
jp HalveAttackDueToBurn
-Func_3f64d: ; 3f64d (f:764d)
+CantLowerAnymore_Pop: ; 3f64d (f:764d)
pop de
pop hl
inc [hl]
@@ -7896,7 +7912,7 @@ MoveMissed: ; 3f65a (f:765a)
MonsStatsFellText: ; 3f661 (f:7661)
TX_FAR _MonsStatsFellText
- db $08 ; asm
+ TX_ASM
ld hl, FellText
ld a, [H_WHOSETURN]
and a
@@ -7919,7 +7935,7 @@ FellText: ; 3f683 (f:7683)
TX_FAR _FellText
db "@"
-Func_3f688: ; 3f688 (f:7688)
+PrintStatText: ; 3f688 (f:7688)
ld hl, StatsTextStrings
ld c, $50
.asm_3f68d
@@ -8028,7 +8044,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
srl b
cp b
jr nc, .asm_3f76e
- ld c, $32
+ ld c, 50
call DelayFrames
ld a, [W_PLAYERMOVENUM]
cp TELEPORT
@@ -8043,7 +8059,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
ld a, [W_PLAYERMOVENUM]
jr .asm_3f7e4
.asm_3f77e
- ld c, $32
+ ld c, 50
call DelayFrames
ld hl, IsUnaffectedText
ld a, [W_PLAYERMOVENUM]
@@ -8070,7 +8086,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
srl b
cp b
jr nc, .asm_3f7c1
- ld c, $32
+ ld c, 50
call DelayFrames
ld a, [W_ENEMYMOVENUM]
cp TELEPORT
@@ -8085,7 +8101,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
ld a, [W_ENEMYMOVENUM]
jr .asm_3f7e4
.asm_3f7d1
- ld c, $32
+ ld c, 50
call DelayFrames
ld hl, IsUnaffectedText
ld a, [W_ENEMYMOVENUM]
@@ -8095,7 +8111,7 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739)
.asm_3f7e4
push af
call PlayBattleAnimation
- ld c, $14
+ ld c, 20
call DelayFrames
pop af
ld hl, RanFromBattleText
@@ -8230,7 +8246,7 @@ ChargeEffect: ; 3f88c (f:788c)
ChargeMoveEffectText: ; 3f8c8 (f:78c8)
TX_FAR _ChargeMoveEffectText
- db $08 ; asm
+ TX_ASM
ld a, [wWhichTrade]
cp RAZOR_WIND
ld hl, MadeWhirlwindText
@@ -8287,8 +8303,8 @@ TrappingEffect: ; 3f917 (f:7917)
.trappingEffect
bit UsingTrappingMove, [hl]
ret nz
- call ClearHyperBeam ; since this effect is called before testing whether the move will hit,
- ; the target won't need to recharge even if the trapping move missed
+ call ClearHyperBeam ; since this effect is called before testing whether the move will hit,
+ ; the target won't need to recharge even if the trapping move missed
set UsingTrappingMove, [hl] ; mon is now using a trapping move
call BattleRandom ; 3/8 chance for 2 and 3 attacks, and 1/8 chance for 4 and 5 attacks
and $3
@@ -8346,7 +8362,7 @@ ConfusionSideEffectSuccess: ; 3f96f (f:796f)
set Confused, [hl] ; mon is now confused
push af
call BattleRandom
- and $3
+ and $3
inc a
inc a
ld [bc], a ; confusion status will last 2-5 turns
@@ -8363,7 +8379,7 @@ BecameConfusedText: ; 3f9a1 (f:79a1)
ConfusionEffectFailed: ; 3f9a6 (f:79a6)
cp CONFUSION_SIDE_EFFECT
ret z
- ld c, $32
+ ld c, 50
call DelayFrames
jp ConditionalPrintButItFailed
@@ -8410,7 +8426,7 @@ RageEffect: ; 3f9df (f:79df)
ret
MimicEffect: ; 3f9ed (f:79ed)
- ld c, $32
+ ld c, 50
call DelayFrames
call MoveHitTest
ld a, [W_MOVEMISSED]
@@ -8527,12 +8543,12 @@ DisableEffect: ; 3fa8a (f:7a8a)
ld a, [H_WHOSETURN]
and a
ld hl, wBattleMonPP
- jr nz, .enemyTurn
+ jr nz, .enemyTurn
ld a, [wLinkState]
cp LINK_STATE_BATTLING
pop hl ; wEnemyMonMoves
jr nz, .playerTurnNotLinkBattle
-; .playerTurnLinkBattle
+; .playerTurnLinkBattle
push hl
ld hl, wEnemyMonPP
.enemyTurn
@@ -8557,7 +8573,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
and $7
inc a ; 1-8 turns disabled
inc c ; move 1-4 will be disabled
- swap c
+ swap c
add c ; map disabled move to high nibble of W_ENEMYDISABLEDMOVE / W_PLAYERDISABLEDMOVE
ld [de], a
call PlayCurrentMoveAnimation2
@@ -8568,7 +8584,7 @@ DisableEffect: ; 3fa8a (f:7a8a)
inc hl ; wEnemyDisabledMoveNumber
.printDisableText
ld a, [wd11e] ; move number
- ld [hl], a
+ ld [hl], a
call GetMoveName
ld hl, MoveWasDisabledText
jp PrintText
@@ -8659,12 +8675,12 @@ ParalyzedMayNotAttackText: ; 3fb74 (f:7b74)
CheckTargetSubstitute: ; 3fb79 (f:7b79)
push hl
ld hl, W_ENEMYBATTSTATUS2
- ld a, [H_WHOSETURN]
+ ld a, [H_WHOSETURN]
and a
jr z, .next1
ld hl, W_PLAYERBATTSTATUS2
.next1
- bit HasSubstituteUp, [hl]
+ bit HasSubstituteUp, [hl]
pop hl
ret
diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm
index ecf5040b..7345c5c1 100644
--- a/engine/battle/decrement_pp.asm
+++ b/engine/battle/decrement_pp.asm
@@ -9,15 +9,15 @@ DecrementPP: ; 68000 (1a:4000)
; W_PLAYERBATTSTATUS2 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]
+ bit UsingRage, [hl]
ret nz ; don't decrement PP either if Pokemon is using Rage
ld hl, wBattleMonPP ; PP of first move (in battle)
-
-; decrement PP in the battle struct
- call .DecrementPP
-
-; decrement PP in the party struct
- ld a, [W_PLAYERBATTSTATUS3]
+
+; decrement PP in the battle struct
+ call .DecrementPP
+
+; decrement PP in the party struct
+ ld a, [W_PLAYERBATTSTATUS3]
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
@@ -31,7 +31,7 @@ DecrementPP: ; 68000 (1a:4000)
ld hl, wPartyMon1PP ; PP of first move (in party)
ld a, [wPlayerMonNumber] ; which mon in party is active
- ld bc, wPartyMon2 - wPartyMon1
+ ld bc, wPartyMon2 - wPartyMon1
call AddNTimes ; calculate address of the mon to modify
.DecrementPP
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm
index fce3701c..ba47d8f3 100644
--- a/engine/battle/draw_hud_pokeball_gfx.asm
+++ b/engine/battle/draw_hud_pokeball_gfx.asm
@@ -1,7 +1,7 @@
DrawAllPokeballs: ; 3a849 (e:6849)
call LoadPartyPokeballGfx
call SetupOwnPartyPokeballs
- ld a, [W_ISINBATTLE] ; W_ISINBATTLE
+ ld a, [W_ISINBATTLE]
dec a
ret z ; return if wild pokémon
jp SetupEnemyPartyPokeballs
@@ -11,7 +11,7 @@ DrawEnemyPokeballs: ; 0x3a857
jp SetupEnemyPartyPokeballs
LoadPartyPokeballGfx: ; 3a85d (e:685d)
- ld de, PokeballTileGraphics ; $697e
+ ld de, PokeballTileGraphics
ld hl, vSprites + $310
ld bc, (BANK(PokeballTileGraphics) << 8) + $04
jp CopyVideoData
@@ -19,10 +19,10 @@ LoadPartyPokeballGfx: ; 3a85d (e:685d)
SetupOwnPartyPokeballs: ; 3a869 (e:6869)
call PlacePlayerHUDTiles
ld hl, wPartyMon1
- ld de, wPartyCount ; wPartyCount
+ ld de, wPartyCount
call SetupPokeballs
ld a, $60
- ld hl, W_BASECOORDX ; wd081
+ ld hl, W_BASECOORDX
ld [hli], a
ld [hl], a
ld a, $8
@@ -33,9 +33,9 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869)
SetupEnemyPartyPokeballs: ; 3a887 (e:6887)
call PlaceEnemyHUDTiles
ld hl, wEnemyMons
- ld de, wEnemyPartyCount ; wEnemyPartyCount
+ ld de, wEnemyPartyCount
call SetupPokeballs
- ld hl, W_BASECOORDX ; wd081
+ ld hl, W_BASECOORDX
ld a, $48
ld [hli], a
ld [hl], $20
@@ -98,31 +98,31 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)
ld de, wBuffer
ld c, PARTY_LENGTH
.loop
- ld a, [W_BASECOORDY] ; wd082
+ ld a, [W_BASECOORDY]
ld [hli], a
- ld a, [W_BASECOORDX] ; wd081
+ ld a, [W_BASECOORDX]
ld [hli], a
ld a, [de]
ld [hli], a
xor a
ld [hli], a
- ld a, [W_BASECOORDX] ; wd081
+ ld a, [W_BASECOORDX]
ld b, a
ld a, [wTrainerEngageDistance]
add b
- ld [W_BASECOORDX], a ; wd081
+ ld [W_BASECOORDX], a
inc de
dec c
jr nz, .loop
ret
PlacePlayerHUDTiles: ; 3a902 (e:6902)
- ld hl, PlayerBattleHUDGraphicsTiles ; $6916
+ ld hl, PlayerBattleHUDGraphicsTiles
ld de, wTrainerFacingDirection
ld bc, $3
call CopyData
hlCoord 18, 10
- ld de, rIE ; $ffff
+ ld de, rIE
jr PlaceHUDTiles
PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
@@ -132,7 +132,7 @@ PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)
db $6F ; lower-left triangle tile of the HUD
PlaceEnemyHUDTiles: ; 3a919 (e:6919)
- ld hl, EnemyBattleHUDGraphicsTiles ; $692d
+ ld hl, EnemyBattleHUDGraphicsTiles
ld de, wTrainerFacingDirection
ld bc, $3
call CopyData
@@ -165,10 +165,10 @@ PlaceHUDTiles: ; 3a930 (e:6930)
SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
call LoadPartyPokeballGfx
- ld hl, wPartyMon1Species ; wPartyMon1Species (aliases: wPartyMon1)
- ld de, wPartyCount ; wPartyCount
+ ld hl, wPartyMons
+ ld de, wPartyCount
call SetupPokeballs
- ld hl, W_BASECOORDX ; wd081
+ ld hl, W_BASECOORDX
ld a, $50
ld [hli], a
ld [hl], $40
@@ -176,10 +176,10 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)
ld [wTrainerEngageDistance], a
ld hl, wOAMBuffer
call WritePokeballOAMData
- ld hl, wEnemyMons ; wEnemyMon1Species
- ld de, wEnemyPartyCount ; wEnemyPartyCount
+ ld hl, wEnemyMons
+ ld de, wEnemyPartyCount
call SetupPokeballs
- ld hl, W_BASECOORDX ; wd081
+ ld hl, W_BASECOORDX
ld a, $50
ld [hli], a
ld [hl], $68
diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm
index f03dd07f..d1452770 100644..100755
--- a/engine/battle/end_of_battle.asm
+++ b/engine/battle/end_of_battle.asm
@@ -21,7 +21,7 @@ EndOfBattle: ; 137aa (4:77aa)
.placeWinOrLoseString
hlCoord 6, 8
call PlaceString
- ld c, $c8
+ ld c, 200
call DelayFrames
jr .evolution
.notLinkBattle
@@ -85,4 +85,4 @@ DrawText: ; 13864 (4:7864)
PickUpPayDayMoneyText: ; 1386b (4:786b)
TX_FAR _PickUpPayDayMoneyText
- db "@" \ No newline at end of file
+ db "@"
diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm
index 9bd67654..4e4d0f3c 100644
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -341,7 +341,7 @@ BoostExp: ; 5549f (15:549f)
GainedText: ; 554b2 (15:54b2)
TX_FAR _GainedText
- db $08 ; asm
+ TX_ASM
ld a, [wBoostExpByExpAll]
ld hl, WithExpAllText
and a
@@ -355,7 +355,7 @@ GainedText: ; 554b2 (15:54b2)
WithExpAllText: ; 554cb (15:54cb)
TX_FAR _WithExpAllText
- db $08 ; asm
+ TX_ASM
ld hl, ExpPointsText
ret
diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm
index 457cc4e1..edb1f13e 100644
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -13,7 +13,7 @@ InitBattleVariables: ; 525af (14:65af)
ld [wCriticalHitOrOHKO], a
ld [wBattleMonSpecies], a
ld [wPartyGainExpFlags], a
- ld [wPlayerMonNumber], a
+ ld [wPlayerMonNumber], a
ld [wEscapedFromBattle], a
ld [wMapPalOffset], a
ld hl, wcf1d
@@ -27,7 +27,7 @@ InitBattleVariables: ; 525af (14:65af)
jr nz, .loop
inc a
ld [wccd9], a
- ld a, [W_CURMAP]
+ ld a, [W_CURMAP]
cp SAFARI_ZONE_EAST
jr c, .notSafariBattle
cp SAFARI_ZONE_REST_HOUSE_1
diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm
index 2f05afb3..e4c5b4bd 100644
--- a/engine/battle/moveEffects/conversion_effect.asm
+++ b/engine/battle/moveEffects/conversion_effect.asm
@@ -13,7 +13,7 @@ ConversionEffect_: ; 139a3 (4:79a3)
.conversionEffect
bit Invulnerable, a ; is mon immune to typical attacks (dig/fly)
jr nz, PrintButItFailedText
-; copy target's types to user
+; copy target's types to user
ld a, [hli]
ld [de], a
inc de
diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm
index 517d53d1..be52e76d 100644
--- a/engine/battle/moveEffects/drain_hp_effect.asm
+++ b/engine/battle/moveEffects/drain_hp_effect.asm
@@ -1,5 +1,5 @@
DrainHPEffect_: ; 783f (1:783f)
- ld hl, W_DAMAGE
+ ld hl, W_DAMAGE
ld a, [hl]
srl a ; divide damage by 2
ld [hli], a
@@ -17,8 +17,8 @@ DrainHPEffect_: ; 783f (1:783f)
ld a, [H_WHOSETURN]
and a
jp z, .addDamageToAttackerHP
- ld hl, wEnemyMonHP
- ld de, wEnemyMonMaxHP
+ ld hl, wEnemyMonHP
+ ld de, wEnemyMonMaxHP
.addDamageToAttackerHP
ld bc, wHPBarOldHP+1
; copy current HP to wHPBarOldHP
@@ -41,7 +41,7 @@ DrainHPEffect_: ; 783f (1:783f)
add b
ld [hld], a
ld [wHPBarNewHP], a
- ld a, [W_DAMAGE]
+ ld a, [W_DAMAGE]
ld b, [hl]
adc b
ld [hli], a
@@ -87,7 +87,7 @@ DrainHPEffect_: ; 783f (1:783f)
and a
ld a, [W_PLAYERMOVEEFFECT]
jr z, .next3
- ld a, [W_ENEMYMOVEEFFECT]
+ ld a, [W_ENEMYMOVEEFFECT]
.next3
cp DREAM_EATER_EFFECT
jr nz, .printText
diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm
index f01e61cc..20a0c07e 100644
--- a/engine/battle/moveEffects/focus_energy_effect.asm
+++ b/engine/battle/moveEffects/focus_energy_effect.asm
@@ -12,7 +12,7 @@ FocusEnergyEffect_: ; 27f86 (9:7f86)
ld hl, GettingPumpedText
jp PrintText
.alreadyUsing
- ld c, $32
+ ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
ld b, BANK(PrintButItFailedText_)
diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm
index 14b5f5dd..5c5443c0 100644
--- a/engine/battle/moveEffects/haze_effect.asm
+++ b/engine/battle/moveEffects/haze_effect.asm
@@ -1,11 +1,11 @@
HazeEffect_: ; 139da (4:79da)
ld a, $7
-; store 7 on every stat mod
+; store 7 on every stat mod
ld hl, wPlayerMonAttackMod
call ResetStatMods
ld hl, wEnemyMonAttackMod
call ResetStatMods
-; copy unmodified stats to battle stats
+; copy unmodified stats to battle stats
ld hl, wPlayerMonUnmodifiedAttack
ld de, wBattleMonAttack
call ResetStats
@@ -25,7 +25,7 @@ HazeEffect_: ; 139da (4:79da)
ld [hl], $0
and SLP | (1 << FRZ)
jr z, .cureVolatileStatuses
-; prevent the Pokemon from executing a move if it was asleep or frozen
+; prevent the Pokemon from executing a move if it was asleep or frozen
ld a, $ff
ld [de], a
@@ -51,7 +51,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37)
inc hl ; BATTSTATUS2
ld a, [hl]
; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses
- and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded))
+ and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded))
ld [hli], a ; BATTSTATUS3
ld a, [hl]
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
@@ -61,7 +61,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37)
ResetStatMods: ; 13a43 (4:7a43)
ld b, $8
.loop
- ld [hli], a
+ ld [hli], a
dec b
jr nz, .loop
ret
diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm
index 862917f7..d9729747 100644
--- a/engine/battle/moveEffects/heal_effect.asm
+++ b/engine/battle/moveEffects/heal_effect.asm
@@ -76,7 +76,7 @@ HealEffect_: ; 3b9ec (e:79ec)
ld a, [de]
sbc [hl]
jr c, .playAnim
-; copy max HP to current HP if an overflow ocurred
+; copy max HP to current HP if an overflow ocurred
ld a, [hli]
ld [de], a
ld [wHPBarNewHP+1], a
diff --git a/engine/battle/moveEffects/leech_seed_effect.asm b/engine/battle/moveEffects/leech_seed_effect.asm
index e29fd7c2..1b0afe4b 100644
--- a/engine/battle/moveEffects/leech_seed_effect.asm
+++ b/engine/battle/moveEffects/leech_seed_effect.asm
@@ -1,20 +1,20 @@
LeechSeedEffect_: ; 2bea9 (a:7ea9)
callab MoveHitTest
- ld a, [W_MOVEMISSED]
+ ld a, [W_MOVEMISSED]
and a
jr nz, .moveMissed
- ld hl, W_ENEMYBATTSTATUS2
- ld de, wEnemyMonType1
- ld a, [H_WHOSETURN]
+ ld hl, W_ENEMYBATTSTATUS2
+ ld de, wEnemyMonType1
+ ld a, [H_WHOSETURN]
and a
jr z, .leechSeedEffect
- ld hl, W_PLAYERBATTSTATUS2
- ld de, wBattleMonType1
+ ld hl, W_PLAYERBATTSTATUS2
+ ld de, wBattleMonType1
.leechSeedEffect
; miss if the target is grass-type or already seeded
ld a, [de]
cp GRASS
- jr z, .moveMissed
+ jr z, .moveMissed
inc de
ld a, [de]
cp GRASS
@@ -23,12 +23,12 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9)
jr nz, .moveMissed
set Seeded, [hl]
callab PlayCurrentMoveAnimation
- ld hl, WasSeededText ; $7ef2
+ ld hl, WasSeededText
jp PrintText
.moveMissed
- ld c, $32
+ ld c, 50
call DelayFrames
- ld hl, EvadedAttackText ; $7ef7
+ ld hl, EvadedAttackText
jp PrintText
WasSeededText: ; 2bef2 (a:7ef2)
diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm
index cc0eca7b..907db80c 100644
--- a/engine/battle/moveEffects/one_hit_ko_effect.asm
+++ b/engine/battle/moveEffects/one_hit_ko_effect.asm
@@ -1,5 +1,5 @@
OneHitKOEffect_: ; 33f57 (c:7f57)
- ld hl, W_DAMAGE
+ ld hl, W_DAMAGE
xor a
ld [hli], a
ld [hl], a ; set the damage output to zero
@@ -7,7 +7,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
- ld a, [H_WHOSETURN]
+ ld a, [H_WHOSETURN]
and a
jr z, .compareSpeed
ld hl, wEnemyMonSpeed + 1
@@ -24,7 +24,7 @@ OneHitKOEffect_: ; 33f57 (c:7f57)
ld a, [hl]
sbc b
jr c, .userIsSlower
- ld hl, W_DAMAGE
+ ld hl, W_DAMAGE
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 [W_MOVEMISSED], a
ret
diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm
index 69acbb01..b88e6479 100644
--- a/engine/battle/moveEffects/paralyze_effect.asm
+++ b/engine/battle/moveEffects/paralyze_effect.asm
@@ -4,7 +4,7 @@ ParalyzeEffect_: ; 52601 (14:6601)
ld a, [H_WHOSETURN]
and a
jp z, .next
- ld hl, wBattleMonStatus
+ ld hl, wBattleMonStatus
ld de, W_ENEMYMOVETYPE
.next
ld a, [hl]
@@ -28,7 +28,7 @@ ParalyzeEffect_: ; 52601 (14:6601)
push hl
callab MoveHitTest
pop hl
- ld a, [W_MOVEMISSED]
+ ld a, [W_MOVEMISSED]
and a
jr nz, .didntAffect
set PAR, [hl]
diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm
index fc937d1b..26e69ef5 100644
--- a/engine/battle/moveEffects/pay_day_effect.asm
+++ b/engine/battle/moveEffects/pay_day_effect.asm
@@ -9,19 +9,19 @@ PayDayEffect_ ; 2feb8 (b:7eb8)
ld a, [wEnemyMonLevel]
.payDayEffect
; level * 2
- add a
+ add a
ld [H_DIVIDEND + 3], a
xor a
ld [H_DIVIDEND], a
ld [H_DIVIDEND + 1], a
ld [H_DIVIDEND + 2], a
-; convert to BCD
+; convert to BCD
ld a, 100
ld [H_DIVISOR], a
ld b, $4
call Divide
ld a, [H_QUOTIENT + 3]
- ld [hli], a
+ ld [hli], a
ld a, [H_REMAINDER]
ld [H_DIVIDEND + 3], a
ld a, 10
diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm
index fe516c03..95b54922 100644
--- a/engine/battle/moveEffects/recoil_effect.asm
+++ b/engine/battle/moveEffects/recoil_effect.asm
@@ -46,7 +46,7 @@ RecoilEffect_: ; 1392c (4:792c)
ld [wHPBarNewHP+1], a
jr nc, .getHPBarCoords
; if recoil damage is higher than the Pokemon's HP, set its HP to 0
- xor a
+ xor a
ld [hli], a
ld [hl], a
ld hl, wHPBarNewHP
diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm
index 7da98699..df34827f 100644
--- a/engine/battle/moveEffects/reflect_light_screen_effect.asm
+++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm
@@ -27,7 +27,7 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97)
pop hl
jp PrintText
.moveFailed
- ld c, $32
+ ld c, 50
call DelayFrames
ld hl, PrintButItFailedText_
jp BankswitchEtoF
diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm
index 8412e281..444c755b 100644
--- a/engine/battle/moveEffects/substitute_effect.asm
+++ b/engine/battle/moveEffects/substitute_effect.asm
@@ -11,15 +11,15 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wEnemySubstituteHP
ld bc, W_ENEMYBATTSTATUS2
.notEnemy
- ld a, [bc]
+ ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute?
- jr nz, .alreadyHasSubstitute
+ jr nz, .alreadyHasSubstitute
; quarter health to remove from user
-; assumes max HP is 1023 or lower
+; assumes max HP is 1023 or lower
push bc
ld a, [hli]
ld b, [hl]
- srl a
+ srl a
rr b
srl a
rr b ; max hp / 4
@@ -27,29 +27,29 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wBattleMonHP - wBattleMonMaxHP
add hl, de ; point hl to current HP low byte
pop de
- ld a, b
+ ld a, b
ld [de], a ; save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has]
ld a, [hld]
-; subtract [max hp / 4] to current HP
- sub b
+; subtract [max hp / 4] to current HP
+ sub b
ld d, a
ld a, [hl]
- sbc 0
+ sbc 0
pop bc
jr c, .notEnoughHP ; underflow means user would be left with negative health
; bug: since it only brances on carry, it will possibly leave user with 0 HP
.userHasZeroOrMoreHP
ldi [hl], a ; save resulting HP after substraction into current HP
- ld [hl], d
+ ld [hl], d
ld h, b
ld l, c
- set HasSubstituteUp, [hl]
- ld a, [W_OPTIONS]
+ set HasSubstituteUp, [hl]
+ ld a, [W_OPTIONS]
bit 7, a ; battle animation is enabled?
- ld hl, PlayCurrentMoveAnimation
+ ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)
jr z, .animationEnabled
- ld hl, AnimationSubstitute
+ ld hl, AnimationSubstitute
ld b, BANK(AnimationSubstitute)
.animationEnabled
call Bankswitch ; jump to routine depending on animation setting
diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm
index 6504bf03..1b992df6 100644
--- a/engine/battle/moveEffects/transform_effect.asm
+++ b/engine/battle/moveEffects/transform_effect.asm
@@ -24,7 +24,7 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld hl, W_ENEMYBATTSTATUS2
.transformEffect
; animation(s) played are different if target has Substitute up
- bit HasSubstituteUp, [hl]
+ bit HasSubstituteUp, [hl]
push af
ld hl, Func_79747
ld b, BANK(Func_79747)
@@ -49,13 +49,13 @@ TransformEffect_: ; 3bab1 (e:7ab1)
pop de
pop hl
push hl
-; transform user into opposing Pokemon
+; transform user into opposing Pokemon
; species
- ld a, [hl]
+ ld a, [hl]
ld [de], a
-; type 1, type 2, catch rate, and moves
+; type 1, type 2, catch rate, and moves
ld bc, $5
- add hl, bc
+ add hl, bc
inc de
inc de
inc de
@@ -82,7 +82,7 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld a, [hli]
ld [de], a
inc de
-; Attack, Defense, Speed, and Special stats
+; Attack, Defense, Speed, and Special stats
inc hl
inc hl
inc hl
@@ -91,7 +91,7 @@ TransformEffect_: ; 3bab1 (e:7ab1)
inc de
ld bc, $8
call CopyData
- ld bc, wBattleMonMoves - wBattleMonPP
+ ld bc, wBattleMonMoves - wBattleMonPP
add hl, bc ; ld hl, wBattleMonMoves
ld b, NUM_MOVES
.copyPPLoop
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index 3cdfb5cb..e373ef93 100644..100755
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -143,7 +143,7 @@ ReadTrainer: ; 39c53 (e:5c53)
ld [wEnemyMon6Moves + 2],a
.FinishUp
; clear wAmountMoneyWon addresses
- xor a
+ xor a
ld de,wAmountMoneyWon
ld [de],a
inc de
@@ -163,4 +163,4 @@ ReadTrainer: ; 39c53 (e:5c53)
inc de
dec b
jr nz,.LastLoop ; repeat W_CURENEMYLVL times
- ret \ No newline at end of file
+ ret
diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm
index dae4ad42..ed227984 100644
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d)
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
- ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b
- ld bc, -1 ; $ffff
+ ld [H_SPRITEINTERLACECOUNTER], a
+ ld bc, -1
.columnInnerLoop
ld a, [de]
dec de
swap a ; only high nybble contains information
call ScalePixelsByTwo
- ld a, [H_SPRITEINTERLACECOUNTER] ; $ff8b
+ ld a, [H_SPRITEINTERLACECOUNTER]
dec a
- ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b
+ ld [H_SPRITEINTERLACECOUNTER], a
jr nz, .columnInnerLoop
dec de ; skip last 4 rows of new column
dec de
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm
index 191cfd5e..59611ef1 100644
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -40,7 +40,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
and a
jr z, .loopFindMinimumEntries
push hl
- ld hl, AIMoveChoiceModificationFunctionPointers ; $57a3
+ ld hl, AIMoveChoiceModificationFunctionPointers
dec a
add a
ld c, a
@@ -81,7 +81,7 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
.filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0)
ld a, [de]
and a
- jr nz, .moveExisting ; 0x3978a $1
+ jr nz, .moveExisting
ld [hl], a
.moveExisting
ld a, [hl]
@@ -145,7 +145,7 @@ AIMoveChoiceModification1: ; 397ab (e:57ab)
ld [hl], a
jr .nextMove
-StatusAilmentMoveEffects ; 57e2
+StatusAilmentMoveEffects: ; 57e2
db $01 ; unused sleep effect
db SLEEP_EFFECT
db POISON_EFFECT
@@ -157,7 +157,7 @@ StatusAilmentMoveEffects ; 57e2
; that fall in-bewteen
AIMoveChoiceModification2: ; 397e7 (e:57e7)
ld a, [wAILayer2Encouragement]
- cp $1
+ cp $1
ret nz
ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset)
ld de, wEnemyMonMoves ; enemy moves
@@ -325,8 +325,8 @@ TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
db 1,3,0 ; LANCE
INCLUDE "engine/battle/trainer_pic_money_pointers.asm"
-
-INCLUDE "text/trainer_names.asm"
+
+INCLUDE "text/trainer_names.asm"
INCLUDE "engine/battle/bank_e_misc.asm"
@@ -337,7 +337,6 @@ INCLUDE "data/trainer_moves.asm"
INCLUDE "data/trainer_parties.asm"
TrainerAI: ; 3a52e (e:652e)
-;XXX called at 34964, 3c342, 3c398
and a
ld a,[W_ISINBATTLE]
dec a
@@ -553,7 +552,7 @@ DecrementAICount: ; 3a695 (e:6695)
scf
ret
-Func_3a69b: ; 3a69b (e:669b)
+AIPlayRestoringSFX: ; 3a69b (e:669b)
ld a,(SFX_08_3e - SFX_Headers_08) / 3
jp PlaySoundWaitForCurrent
@@ -712,7 +711,7 @@ AIBattleWithdrawText: ; 3a781 (e:6781)
db "@"
AIUseFullHeal: ; 3a786 (e:6786)
- call Func_3a69b
+ call AIPlayRestoringSFX
call AICureStatus
ld a,FULL_HEAL
jp AIPrintItemUse
@@ -731,21 +730,21 @@ AICureStatus: ; 3a791 (e:6791)
ret
AIUseXAccuracy: ; 0x3a7a8 unused
- call Func_3a69b
+ call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
set 0,[hl]
ld a,X_ACCURACY
jp AIPrintItemUse
AIUseGuardSpec: ; 3a7b5 (e:67b5)
- call Func_3a69b
+ call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
set 1,[hl]
ld a,GUARD_SPEC_
jp AIPrintItemUse
AIUseDireHit: ; 0x3a7c2 unused
- call Func_3a69b
+ call AIPlayRestoringSFX
ld hl,W_ENEMYBATTSTATUS2
set 2,[hl]
ld a,DIRE_HIT
@@ -808,7 +807,7 @@ AIIncreaseStat: ; 3a808 (e:6808)
ld a,[hl]
push af
push hl
- ld a,$AF
+ ld a,ANIM_AF
ld [hli],a
ld [hl],b
callab StatModifierUpEffect
diff --git a/engine/battle/trainer_pic_money_pointers.asm b/engine/battle/trainer_pic_money_pointers.asm
index 3d32eb00..3f684db3 100644..100755
--- a/engine/battle/trainer_pic_money_pointers.asm
+++ b/engine/battle/trainer_pic_money_pointers.asm
@@ -140,4 +140,4 @@ TrainerPicAndMoneyPointers: ; 39914 (e:5914)
money 9900
dw LancePic
- money 9900 \ No newline at end of file
+ money 9900
diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm
index 03119b90..87512583 100644
--- a/engine/battle/wild_encounters.asm
+++ b/engine/battle/wild_encounters.asm
@@ -23,7 +23,7 @@ TryDoWildEncounter: ; 13870 (4:7870)
jr z, .lastRepelStep
ld [wRepelRemainingSteps], a
.asm_1389e
-; determine if wild pokémon can appear in the half-block we’re standing in
+; determine if wild pokemon can appear in the half-block we're standing in
; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile?
hlCoord 9, 9
ld c, [hl]
@@ -35,9 +35,9 @@ TryDoWildEncounter: ; 13870 (4:7870)
cp c
ld a, [W_WATERRATE]
jr z, .CanEncounter
-; even if not in grass/water, standing anywhere we can encounter pokémon
-; so long as the map is “indoor” and has wild pokémon defined.
-; …as long as it’s not Viridian Forest or Safari Zone.
+; 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]
cp REDS_HOUSE_1F ; is this an indoor map?
jr c, .CantEncounter2
@@ -61,15 +61,15 @@ TryDoWildEncounter: ; 13870 (4:7870)
inc hl
jr .determineEncounterSlot
.gotEncounterSlot
-; determine which wild pokémon (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 hl, W_GRASSMONS
- aCoord 8, 9
- cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
+ 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
ld hl, W_WATERMONS
; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not,
-; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
+; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
.gotWildEncounterType
ld b, $0
add hl, bc