diff options
Diffstat (limited to 'engine/battle')
38 files changed, 702 insertions, 702 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index be8d2b18..ea5738bc 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1,6 +1,6 @@ ; Draws a "frame block". Frame blocks are blocks of tiles that are put ; together to form frames in battle animations. -DrawFrameBlock: ; 78000 (1e:4000) +DrawFrameBlock: ld l,c ld h,b ld a,[hli] @@ -161,7 +161,7 @@ DrawFrameBlock: ; 78000 (1e:4000) .done ret -PlayAnimation: ; 780f1 (1e:40f1) +PlayAnimation: xor a ld [$FF8B],a ; it looks like nothing reads this ld [wSubAnimTransform],a @@ -256,7 +256,7 @@ PlayAnimation: ; 780f1 (1e:40f1) .AnimationOver ; 417B ret -LoadSubanimation: ; 7817c (1e:417c) +LoadSubanimation: ld a,[wSubAnimAddrPtr + 1] ld h,a ld a,[wSubAnimAddrPtr] @@ -306,7 +306,7 @@ LoadSubanimation: ; 7817c (1e:417c) ; called if the subanimation type is not 5 ; sets the transform to 0 (i.e. no transform) if it's the player's turn ; sets the transform to the subanimation type if it's the enemy's turn -GetSubanimationTransform1: ; 781c2 (1e:41c2) +GetSubanimationTransform1: ld b,a ld a,[H_WHOSETURN] and a @@ -318,7 +318,7 @@ GetSubanimationTransform1: ; 781c2 (1e:41c2) ; called if the subanimation type is 5 ; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn ; sets the transform to 0 (i.e. no transform) if it's the enemy's turn -GetSubanimationTransform2: ; 781ca (1e:41ca) +GetSubanimationTransform2: ld a,[H_WHOSETURN] and a ld a,2 << 5 @@ -327,7 +327,7 @@ GetSubanimationTransform2: ; 781ca (1e:41ca) ret ; loads tile patterns for battle animations -LoadAnimationTileset: ; 781d2 (1e:41d2) +LoadAnimationTileset: ld a,[wWhichBattleAnimTileset] add a add a @@ -347,7 +347,7 @@ LoadAnimationTileset: ; 781d2 (1e:41d2) ld c,a ; number of tiles jp CopyVideoData ; load tileset -AnimationTilesetPointers: ; 781f2 (1e:41f2) +AnimationTilesetPointers: db 79 ; number of tiles dw AnimationTileset1 db $FF @@ -360,13 +360,13 @@ AnimationTilesetPointers: ; 781f2 (1e:41f2) dw AnimationTileset1 db $FF -AnimationTileset1: ; 781fe (1e:41fe) +AnimationTileset1: INCBIN "gfx/attack_anim_1.2bpp" -AnimationTileset2: ; 786ee (1e:46ee) +AnimationTileset2: INCBIN "gfx/attack_anim_2.2bpp" -SlotMachineTiles2: ; 78bde (1e:4bde) +SlotMachineTiles2: IF DEF(_RED) INCBIN "gfx/red/slotmachine2.2bpp" ENDC @@ -374,7 +374,7 @@ IF DEF(_BLUE) INCBIN "gfx/blue/slotmachine2.2bpp" ENDC -MoveAnimation: ; 78d5e (1e:4d5e) +MoveAnimation: push hl push de push bc @@ -419,7 +419,7 @@ MoveAnimation: ; 78d5e (1e:4d5e) pop hl ret -ShareMoveAnimations: ; 78da6 (1e:4da6) +ShareMoveAnimations: ; some moves just reuse animations from status conditions ld a,[H_WHOSETURN] and a @@ -442,7 +442,7 @@ ShareMoveAnimations: ; 78da6 (1e:4da6) ld [wAnimationID],a ret -PlayApplyingAttackAnimation: ; 78dbd (1e:4dbd) +PlayApplyingAttackAnimation: ; Generic animation that shows after the move's individual animation ; Different animation depending on whether the move has an additional effect and on whose turn it is ld a,[wAnimationType] @@ -459,7 +459,7 @@ PlayApplyingAttackAnimation: ; 78dbd (1e:4dbd) ld l,a jp [hl] -AnimationTypePointerTable: ; 78dcf (1e:4dcf) +AnimationTypePointerTable: dw ShakeScreenVertically ; enemy mon has used a damaging move without a side effect dw ShakeScreenHorizontallyHeavy ; enemy mon has used a damaging move with a side effect dw ShakeScreenHorizontallySlow ; enemy mon has used a non-damaging move @@ -467,33 +467,33 @@ AnimationTypePointerTable: ; 78dcf (1e:4dcf) dw ShakeScreenHorizontallyLight ; player mon has used a damaging move with a side effect dw ShakeScreenHorizontallySlow2 ; player mon has used a non-damaging move -ShakeScreenVertically: ; 78ddb (1e:4ddb) +ShakeScreenVertically: call PlayApplyingAttackSound ld b, 8 jp AnimationShakeScreenVertically -ShakeScreenHorizontallyHeavy: ; 78de3 (1e:4de3) +ShakeScreenHorizontallyHeavy: call PlayApplyingAttackSound ld b, 8 jp AnimationShakeScreenHorizontallyFast -ShakeScreenHorizontallySlow: ; 78deb (1e:4deb) +ShakeScreenHorizontallySlow: lb bc, 6, 2 jr AnimationShakeScreenHorizontallySlow -BlinkEnemyMonSprite: ; 78df0 (1e:4df0) +BlinkEnemyMonSprite: call PlayApplyingAttackSound jp AnimationBlinkEnemyMon -ShakeScreenHorizontallyLight: ; 78df6 (1e:4df6) +ShakeScreenHorizontallyLight: call PlayApplyingAttackSound ld b, 2 jp AnimationShakeScreenHorizontallyFast -ShakeScreenHorizontallySlow2: ; 78dfe (1e:4dfe) +ShakeScreenHorizontallySlow2: lb bc, 3, 2 -AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01) +AnimationShakeScreenHorizontallySlow: push bc push bc .loop1 @@ -518,7 +518,7 @@ AnimationShakeScreenHorizontallySlow: ; 78e01 (1e:4e01) jr nz, AnimationShakeScreenHorizontallySlow ret -SetAnimationPalette: ; 78e23 (1e:4e23) +SetAnimationPalette: ld a, [wOnSGB] and a ld a, $e4 @@ -546,7 +546,7 @@ SetAnimationPalette: ; 78e23 (1e:4e23) ld [rOBP1], a ret -PlaySubanimation: ; 78e53 (1e:4e53) +PlaySubanimation: ld a,[wAnimSoundID] cp a,$FF jr z,.skipPlayingSound @@ -612,7 +612,7 @@ PlaySubanimation: ; 78e53 (1e:4e53) ld [wSubAnimSubEntryAddr],a jp .loop -AnimationCleanOAM: ; 78ec8 (1e:4ec8) +AnimationCleanOAM: push hl push de push bc @@ -627,7 +627,7 @@ AnimationCleanOAM: ; 78ec8 (1e:4ec8) ; this runs after each frame block is drawn in a subanimation ; it runs a particular special effect based on the animation ID -DoSpecialEffectByAnimationId: ; 78ed7 (1e:4ed7) +DoSpecialEffectByAnimationId: push hl push de push bc @@ -650,7 +650,7 @@ DoSpecialEffectByAnimationId: ; 78ed7 (1e:4ed7) ret ; Format: Animation ID (1 byte), Address (2 bytes) -AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5) +AnimationIdSpecialEffects: db MEGA_PUNCH dw AnimationFlashScreen @@ -725,7 +725,7 @@ AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5) db $FF ; terminator -DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) +DoBallTossSpecialEffects: ld a,[wcf91] cp a,3 ; is it a Master Ball or Ultra Ball? jr nc,.skipFlashingEffect @@ -779,7 +779,7 @@ DoBallTossSpecialEffects: ; 78f3e (1e:4f3e) ld [wSubAnimCounter],a ret -DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) +DoBallShakeSpecialEffects: ld a,[wSubAnimCounter] cp a,4 ; is it the beginning of a shake? jr nz,.skipPlayingSound @@ -813,14 +813,14 @@ DoBallShakeSpecialEffects: ; 78f96 (1e:4f96) ret ; plays a sound after the second frame of the poof animation -DoPoofSpecialEffects: ; 78fce (1e:4fce) +DoPoofSpecialEffects: ld a,[wSubAnimCounter] cp a,5 ret nz ld a,SFX_BALL_POOF jp PlaySound -DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9) +DoRockSlideSpecialEffects: ld a,[wSubAnimCounter] cp a,12 ret nc @@ -836,21 +836,21 @@ DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9) ld b,1 predef_jump PredefShakeScreenVertically ; shake vertically -FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7) +FlashScreenEveryEightFrameBlocks: 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) +FlashScreenEveryFourFrameBlocks: ld a,[wSubAnimCounter] and a,3 call z,AnimationFlashScreen ret ; used for Explosion and Selfdestruct -DoExplodeSpecialEffects: ; 79009 (1e:5009) +DoExplodeSpecialEffects: ld a,[wSubAnimCounter] cp a,1 ; is it the end of the subanimation? jr nz,FlashScreenEveryFourFrameBlocks @@ -859,7 +859,7 @@ DoExplodeSpecialEffects: ; 79009 (1e:5009) jp AnimationHideMonPic ; make pokemon disappear ; flashes the screen when subanimation counter is 1 modulo 4 -DoBlizzardSpecialEffects: ; 79016 (1e:5016) +DoBlizzardSpecialEffects: ld a,[wSubAnimCounter] cp a,13 jp z,AnimationFlashScreen @@ -873,7 +873,7 @@ DoBlizzardSpecialEffects: ; 79016 (1e:5016) ; flashes the screen at 3 points in the subanimation ; unused -FlashScreenUnused: ; 7902e (1e:502e) +FlashScreenUnused: ld a,[wSubAnimCounter] cp a,14 jp z,AnimationFlashScreen @@ -884,7 +884,7 @@ FlashScreenUnused: ; 7902e (1e:502e) ret ; function to make the pokemon disappear at the beginning of the animation -TradeHidePokemon: ; 79041 (1e:5041) +TradeHidePokemon: ld a,[wSubAnimCounter] cp a,6 ret nz @@ -892,7 +892,7 @@ TradeHidePokemon: ; 79041 (1e:5041) jp ClearMonPicFromTileMap ; make pokemon disappear ; function to make a shaking pokeball jump up at the end of the animation -TradeShakePokeball: ; 7904c (1e:504c) +TradeShakePokeball: ld a,[wSubAnimCounter] cp a,1 ret nz @@ -921,7 +921,7 @@ TradeShakePokeball: ; 7904c (1e:504c) ld a,SFX_TRADE_MACHINE jp PlaySound -BallMoveDistances1: ; 79078 (1e:5078) +BallMoveDistances1: db -12,-12,-8 db $ff ; terminator @@ -962,13 +962,13 @@ TradeJumpPokeball: ; 507C pop de jr .loop -BallMoveDistances2: ; 790b3 (1e:50b3) +BallMoveDistances2: db 11,12,-12,-7,7,12,-8,8 db $ff ; terminator ; this function copies the current musical note graphic ; so that there are two musical notes flying towards the defending pokemon -DoGrowlSpecialEffects: ; 790bc (1e:50bc) +DoGrowlSpecialEffects: ld hl,wOAMBuffer ; OAM buffer ld de,wOAMBuffer + $10 ld bc,$10 @@ -979,14 +979,14 @@ DoGrowlSpecialEffects: ; 790bc (1e:50bc) ret ; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations -TailWhipAnimationUnused: ; 790d0 (1e:50d0) +TailWhipAnimationUnused: ld a,1 ld [wSubAnimCounter],a ld c,20 jp DelayFrames ; Format: Special Effect ID (1 byte), Address (2 bytes) -SpecialEffectPointers: ; 790da (1e:50da) +SpecialEffectPointers: db SE_DARK_SCREEN_FLASH ; $FE dw AnimationFlashScreen db SE_DARK_SCREEN_PALETTE ; $FD @@ -1067,13 +1067,13 @@ SpecialEffectPointers: ; 790da (1e:50da) dw AnimationWavyScreen db $FF -AnimationDelay10: ; 79150 (1e:5150) +AnimationDelay10: ld c,10 jp DelayFrames ; calls a function with the turn flipped from player to enemy or vice versa ; input - hl - address of function to call -CallWithTurnFlipped: ; 79155 (1e:5155) +CallWithTurnFlipped: ld a,[H_WHOSETURN] push af xor a,1 @@ -1087,7 +1087,7 @@ CallWithTurnFlipped: ; 79155 (1e:5155) ret ; flashes the screen for an extended period (48 frames) -AnimationFlashScreenLong: ; 79165 (1e:5165) +AnimationFlashScreenLong: ld a,3 ; cycle through the palettes 3 times ld [wFlashScreenLongCounter],a ld a,[wOnSGB] ; running on SGB? @@ -1113,7 +1113,7 @@ AnimationFlashScreenLong: ; 79165 (1e:5165) ret ; BG palettes -FlashScreenLongMonochrome: ; 7918e (1e:518e) +FlashScreenLongMonochrome: db %11111001 ; 3, 3, 2, 1 db %11111110 ; 3, 3, 3, 2 db %11111111 ; 3, 3, 3, 3 @@ -1129,7 +1129,7 @@ FlashScreenLongMonochrome: ; 7918e (1e:518e) db $01 ; terminator ; BG palettes -FlashScreenLongSGB: ; 7919b (1e:519b) +FlashScreenLongSGB: db %11111000 ; 3, 3, 2, 0 db %11111100 ; 3, 3, 3, 0 db %11111111 ; 3, 3, 3, 3 @@ -1146,7 +1146,7 @@ FlashScreenLongSGB: ; 7919b (1e:519b) ; causes a delay of 2 frames for the first cycle ; causes a delay of 1 frame for the second and third cycles -FlashScreenLongDelay: ; 791a8 (1e:51a8) +FlashScreenLongDelay: ld a,[wFlashScreenLongCounter] cp a,4 ; never true since [wFlashScreenLongCounter] starts at 3 ld c,4 @@ -1159,7 +1159,7 @@ FlashScreenLongDelay: ; 791a8 (1e:51a8) .delayFrames jp DelayFrames -AnimationFlashScreen: ; 791be (1e:51be) +AnimationFlashScreen: ld a,[rBGP] push af ; save initial palette ld a,%00011011 ; 0, 1, 2, 3 (inverted colors) @@ -1174,42 +1174,42 @@ AnimationFlashScreen: ; 791be (1e:51be) ld [rBGP],a ; restore initial palette ret -AnimationDarkScreenPalette: ; 791d6 (1e:51d6) +AnimationDarkScreenPalette: ; Changes the screen's palette to a dark palette. lb bc, $6f, $6f jr SetAnimationBGPalette -AnimationDarkenMonPalette: ; 791db (1e:51db) +AnimationDarkenMonPalette: ; Darkens the mon sprite's palette. lb bc, $f9, $f4 jr SetAnimationBGPalette -AnimationUnusedPalette1: ; 791e0 (1e:51e0) +AnimationUnusedPalette1: lb bc, $fe, $f8 jr SetAnimationBGPalette -AnimationUnusedPalette2: ; 791e5 (1e:51e5) +AnimationUnusedPalette2: lb bc, $ff, $ff jr SetAnimationBGPalette -AnimationResetScreenPalette: ; 791ea (1e:51ea) +AnimationResetScreenPalette: ; Restores the screen's palette to the normal palette. lb bc, $e4, $e4 jr SetAnimationBGPalette -AnimationUnusedPalette3: ; 791ef (1e:51ef) +AnimationUnusedPalette3: lb bc, $00, $00 jr SetAnimationBGPalette -AnimationLightScreenPalette: ; 791f4 (1e:51f4) +AnimationLightScreenPalette: ; Changes the screen to use a palette with light colors. lb bc, $90, $90 jr SetAnimationBGPalette -AnimationUnusedPalette4: ; 791f9 (1e:51f9) +AnimationUnusedPalette4: lb bc, $40, $40 -SetAnimationBGPalette: ; 791fc (1e:51fc) +SetAnimationBGPalette: ld a, [wOnSGB] and a ld a, b @@ -1221,17 +1221,17 @@ SetAnimationBGPalette: ; 791fc (1e:51fc) ld b, $5 -AnimationShakeScreenVertically: ; 79209 (1e:5209) +AnimationShakeScreenVertically: predef_jump PredefShakeScreenVertically -AnimationShakeScreen: ; 7920e (1e:520e) +AnimationShakeScreen: ; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations. ld b, $8 -AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210) +AnimationShakeScreenHorizontallyFast: predef_jump PredefShakeScreenHorizontally -AnimationWaterDropletsEverywhere: ; 79215 (1e:5215) +AnimationWaterDropletsEverywhere: ; Draws water droplets all over the screen and makes them ; scroll. It's hard to describe, but it's the main animation ; in Surf/Mist/Toxic. @@ -1258,7 +1258,7 @@ AnimationWaterDropletsEverywhere: ; 79215 (1e:5215) jr nz, .loop ret -_AnimationWaterDroplets: ; 79246 (1e:5246) +_AnimationWaterDroplets: ld hl, wOAMBuffer .loop ld a, [wBaseCoordY] @@ -1284,7 +1284,7 @@ _AnimationWaterDroplets: ; 79246 (1e:5246) call AnimationCleanOAM jp DelayFrame -AnimationSlideMonUp: ; 7927a (1e:527a) +AnimationSlideMonUp: ; Slides the mon's sprite upwards. ld c, 7 ld a, [H_WHOSETURN] @@ -1300,7 +1300,7 @@ AnimationSlideMonUp: ; 7927a (1e:527a) ld [wSlideMonUpBottomRowLeftTile], a jp _AnimationSlideMonUp -AnimationSlideMonDown: ; 79297 (1e:5297) +AnimationSlideMonDown: ; Slides the mon's sprite down out of the screen. xor a call GetTileIDList @@ -1317,19 +1317,19 @@ AnimationSlideMonDown: ; 79297 (1e:5297) jr nz, .loop ret -AnimationSlideMonOff: ; 792af (1e:52af) +AnimationSlideMonOff: ; Slides the mon's sprite off the screen horizontally. ld e, 8 ld a, 3 ld [wSlideMonDelay], a jp _AnimationSlideMonOff -AnimationSlideEnemyMonOff: ; 792b9 (1e:52b9) +AnimationSlideEnemyMonOff: ; Slides the enemy mon off the screen horizontally. ld hl, AnimationSlideMonOff jp CallWithTurnFlipped -_AnimationSlideMonUp: ; 792bf (1e:52bf) +_AnimationSlideMonUp: push de push hl push bc @@ -1380,7 +1380,7 @@ _AnimationSlideMonUp: ; 792bf (1e:52bf) jr nz, _AnimationSlideMonUp ret -ShakeEnemyHUD_WritePlayerMonPicOAM: ; 792fd (1e:52fd) +ShakeEnemyHUD_WritePlayerMonPicOAM: ; 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 @@ -1408,7 +1408,7 @@ ShakeEnemyHUD_WritePlayerMonPicOAM: ; 792fd (1e:52fd) ld [wBaseCoordX], a jr .loop -BattleAnimWriteOAMEntry: ; 79329 (1e:5329) +BattleAnimWriteOAMEntry: ; Y coordinate = e (increased by 8 each call, before the write to OAM) ; X coordinate = [wBaseCoordX] ; tile = d @@ -1425,11 +1425,11 @@ BattleAnimWriteOAMEntry: ; 79329 (1e:5329) ld [hli], a ret -AdjustOAMBlockXPos: ; 79337 (1e:5337) +AdjustOAMBlockXPos: ld l, e ld h, d -AdjustOAMBlockXPos2: ; 79339 (1e:5339) +AdjustOAMBlockXPos2: ld de, 4 .loop ld a, [wCoordAdjustmentAmount] @@ -1449,11 +1449,11 @@ AdjustOAMBlockXPos2: ; 79339 (1e:5339) jr nz, .loop ret -AdjustOAMBlockYPos: ; 79350 (1e:5350) +AdjustOAMBlockYPos: ld l, e ld h, d -AdjustOAMBlockYPos2: ; 79352 (1e:5352) +AdjustOAMBlockYPos2: ld de, 4 .loop ld a, [wCoordAdjustmentAmount] @@ -1472,12 +1472,12 @@ AdjustOAMBlockYPos2: ; 79352 (1e:5352) jr nz, .loop ret -AnimationBlinkEnemyMon: ; 79369 (1e:5369) +AnimationBlinkEnemyMon: ; Make the enemy mon's sprite blink on and off for a second or two ld hl, AnimationBlinkMon jp CallWithTurnFlipped -AnimationBlinkMon: ; 7936f (1e:536f) +AnimationBlinkMon: ; Make the mon's sprite blink on and off for a second or two. push af ld c, 6 @@ -1495,7 +1495,7 @@ AnimationBlinkMon: ; 7936f (1e:536f) pop af ret -AnimationFlashMonPic: ; 79389 (1e:5389) +AnimationFlashMonPic: ; Flashes the mon's sprite on and off ld a, [wBattleMonSpecies] ld [wChangeMonPicPlayerTurnSpecies], a @@ -1503,25 +1503,25 @@ AnimationFlashMonPic: ; 79389 (1e:5389) ld [wChangeMonPicEnemyTurnSpecies], a jp ChangeMonPic -AnimationFlashEnemyMonPic: ; 79398 (1e:5398) +AnimationFlashEnemyMonPic: ; Flashes the enemy mon's sprite on and off ld hl, AnimationFlashMonPic jp CallWithTurnFlipped -AnimationShowMonPic: ; 7939e (1e:539e) +AnimationShowMonPic: xor a call GetTileIDList call GetMonSpriteTileMapPointerFromRowCount call CopyPicTiles jp Delay3 -AnimationShowEnemyMonPic: ; 793ab (1e:53ab) +AnimationShowEnemyMonPic: ; Shows the emenmy mon's front sprite. Used in animations like Seismic Toss ; to make the mon's sprite reappear after disappears offscreen. ld hl, AnimationShowMonPic jp CallWithTurnFlipped -AnimationShakeBackAndForth: ; 793b1 (1e:53b1) +AnimationShakeBackAndForth: ; Shakes the mon's sprite back and forth rapidly. This is used in Double Team. ; The mon's sprite disappears after this animation. ld a, [H_WHOSETURN] @@ -1568,7 +1568,7 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1) jr nz, .loop ret -AnimationMoveMonHorizontally: ; 793f9 (1e:53f9) +AnimationMoveMonHorizontally: ; Shifts the mon's sprite horizontally to a fixed location. Used by lots of ; animations like Tackle/Body Slam. call AnimationHideMonPic @@ -1586,7 +1586,7 @@ AnimationMoveMonHorizontally: ; 793f9 (1e:53f9) ld c, 3 jp DelayFrames -AnimationResetMonPosition: ; 79415 (1e:5415) +AnimationResetMonPosition: ; Resets the mon's sprites to be located at the normal coordinates. ld a, [H_WHOSETURN] and a @@ -1597,7 +1597,7 @@ AnimationResetMonPosition: ; 79415 (1e:5415) call ClearMonPicFromTileMap jp AnimationShowMonPic -AnimationSpiralBallsInward: ; 79424 (1e:5424) +AnimationSpiralBallsInward: ; Creates an effect that looks like energy balls spiralling into the ; player mon's sprite. Used in Focus Energy, for example. ld a, [H_WHOSETURN] @@ -1651,7 +1651,7 @@ AnimationSpiralBallsInward: ; 79424 (1e:5424) call AnimationCleanOAM jp AnimationFlashScreen -SpiralBallAnimationCoordinates: ; 79476 (1e:5476) +SpiralBallAnimationCoordinates: ; y, x pairs ; This is the sequence of screen coordinates that the spiralling ; balls are positioned at. @@ -1678,7 +1678,7 @@ SpiralBallAnimationCoordinates: ; 79476 (1e:5476) db $50, $28 db $FF ; list terminator -AnimationSquishMonPic: ; 794a1 (1e:54a1) +AnimationSquishMonPic: ; Squishes the mon's sprite horizontally making it ; disappear. Used by Teleport/Sky Attack animations. ld c, 4 @@ -1709,7 +1709,7 @@ AnimationSquishMonPic: ; 794a1 (1e:54a1) ld c, 2 jp DelayFrame -_AnimationSquishMonPic: ; 794d4 (1e:54d4) +_AnimationSquishMonPic: ld c, 7 .loop push bc @@ -1734,7 +1734,7 @@ _AnimationSquishMonPic: ; 794d4 (1e:54d4) jr nz, .loop jp Delay3 -AnimationShootBallsUpward: ; 794f9 (1e:54f9) +AnimationShootBallsUpward: ; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack ; animations. ld a, [H_WHOSETURN] @@ -1753,7 +1753,7 @@ AnimationShootBallsUpward: ; 794f9 (1e:54f9) call _AnimationShootBallsUpward jp AnimationCleanOAM -_AnimationShootBallsUpward: ; 79517 (1e:5517) +_AnimationShootBallsUpward: push bc xor a ld [wWhichBattleAnimTileset], a @@ -1803,7 +1803,7 @@ _AnimationShootBallsUpward: ; 79517 (1e:5517) jr nz, .loop ret -AnimationShootManyBallsUpward: ; 79566 (1e:5566) +AnimationShootManyBallsUpward: ; Shoots several pillars of "energy" balls upward. ld a, [H_WHOSETURN] and a @@ -1827,19 +1827,19 @@ AnimationShootManyBallsUpward: ; 79566 (1e:5566) pop hl jr .loop -UpwardBallsAnimXCoordinatesPlayerTurn: ; 79591 (1e:5591) +UpwardBallsAnimXCoordinatesPlayerTurn: ; List of x coordinates for each pillar of "energy" balls in the ; AnimationShootManyBallsUpward animation. It's unused in the game. db $10, $40, $28, $18, $38, $30 db $FF ; list terminator -UpwardBallsAnimXCoordinatesEnemyTurn: ; 79598 (1e:5598) +UpwardBallsAnimXCoordinatesEnemyTurn: ; List of x coordinates for each pillar of "energy" balls in the ; AnimationShootManyBallsUpward animation. It's unused in the game. db $60, $90, $78, $68, $88, $80 db $FF ; list terminator -AnimationMinimizeMon: ; 7959f (1e:559f) +AnimationMinimizeMon: ; Changes the mon's sprite to a mini black sprite. Used by the ; Minimize animation. ld hl, wTempPic @@ -1863,10 +1863,10 @@ AnimationMinimizeMon: ; 7959f (1e:559f) call Delay3 jp AnimationShowMonPic -MinimizedMonSprite: ; 795c4 (1e:55c4) +MinimizedMonSprite: INCBIN "gfx/minimized_mon_sprite.1bpp" -AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9) +AnimationSlideMonDownAndHide: ; Slides the mon's sprite down and disappears. Used in Acid Armor. ld a, $1 ld c, $2 @@ -1893,7 +1893,7 @@ AnimationSlideMonDownAndHide: ; 795c9 (1e:55c9) call FillMemory jp CopyTempPicToMonPic -_AnimationSlideMonOff: ; 795f8 (1e:55f8) +_AnimationSlideMonOff: ; Slides the mon's sprite off the screen horizontally by e tiles and waits ; [wSlideMonDelay] V-blanks each time the pic is slid by one tile. ld a, [H_WHOSETURN] @@ -1965,7 +1965,7 @@ _AnimationSlideMonOff: ; 795f8 (1e:55f8) ld a, " " ret -AnimationSlideMonHalfOff: ; 79645 (1e:5645) +AnimationSlideMonHalfOff: ; Slides the mon's sprite halfway off the screen. It's used in Softboiled. ld e, 4 ld a, 4 @@ -1973,7 +1973,7 @@ AnimationSlideMonHalfOff: ; 79645 (1e:5645) call _AnimationSlideMonOff jp Delay3 -CopyTempPicToMonPic: ; 79652 (1e:5652) +CopyTempPicToMonPic: ld a, [H_WHOSETURN] and a ld hl, vBackPic ; player turn @@ -1984,7 +1984,7 @@ CopyTempPicToMonPic: ; 79652 (1e:5652) ld bc, 7 * 7 jp CopyVideoData -AnimationWavyScreen: ; 79666 (1e:5666) +AnimationWavyScreen: ; used in Psywave/Psychic etc. ld hl, vBGMap0 call BattleAnimCopyTileMapToVRAM @@ -2025,7 +2025,7 @@ AnimationWavyScreen: ; 79666 (1e:5666) call BattleAnimCopyTileMapToVRAM ret -WavyScreen_SetSCX: ; 796ae (1e:56ae) +WavyScreen_SetSCX: ld a, [rSTAT] and $3 ; is it H-blank? jr nz, WavyScreen_SetSCX ; wait until it's H-blank @@ -2038,14 +2038,14 @@ WavyScreen_SetSCX: ; 796ae (1e:56ae) ld hl, WavyScreenLineOffsets ; go back to the beginning if so ret -WavyScreenLineOffsets: ; 796bf (1e:56bf) +WavyScreenLineOffsets: ; Sequence of horizontal line pixel offsets for the wavy screen animation. ; This sequence vaguely resembles a sine wave. db 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1 db 0, 0, 0, 0, 0, -1, -1, -1, -2, -2, -2, -2, -2, -1, -1, -1 db $80 ; terminator -AnimationSubstitute: ; 796e0 (1e:56e0) +AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a @@ -2084,12 +2084,12 @@ AnimationSubstitute: ; 796e0 (1e:56e0) call CopyTempPicToMonPic jp AnimationShowMonPic -CopySlowbroSpriteData: ; 7973f (1e:573f) +CopySlowbroSpriteData: ld bc, $0010 ld a, BANK(SlowbroSprite) jp FarCopyData2 -HideSubstituteShowMonAnim: ; 79747 (1e:5747) +HideSubstituteShowMonAnim: ld a, [H_WHOSETURN] and a ld hl, wPlayerMonMinimized @@ -2114,12 +2114,12 @@ HideSubstituteShowMonAnim: ; 79747 (1e:5747) call AnimationFlashMonPic jp AnimationShowMonPic -ReshowSubstituteAnim: ; 79771 (1e:5771) +ReshowSubstituteAnim: call AnimationSlideMonOff call AnimationSubstitute jp AnimationShowMonPic -AnimationBoundUpAndDown: ; 7977a (1e:577a) +AnimationBoundUpAndDown: ; Bounces the mon's sprite up and down several times. It is used ; by Splash's animation. ld c, 5 @@ -2131,7 +2131,7 @@ AnimationBoundUpAndDown: ; 7977a (1e:577a) jr nz, .loop jp AnimationShowMonPic -AnimationTransformMon: ; 79787 (1e:5787) +AnimationTransformMon: ; Redraws this mon's sprite as the back/front sprite of the opposing mon. ; Used in Transform. ld a, [wEnemyMonSpecies] @@ -2139,7 +2139,7 @@ AnimationTransformMon: ; 79787 (1e:5787) ld a, [wBattleMonSpecies] ld [wChangeMonPicEnemyTurnSpecies], a -ChangeMonPic: ; 79793 (1e:5793) +ChangeMonPic: ld a, [H_WHOSETURN] and a jr z, .playerTurn @@ -2170,7 +2170,7 @@ ChangeMonPic: ; 79793 (1e:5793) ld b, SET_PAL_BATTLE jp RunPaletteCommand -AnimationHideEnemyMonPic: ; 797d8 (1e:57d8) +AnimationHideEnemyMonPic: ; Hides the enemy mon's sprite xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -2180,7 +2180,7 @@ AnimationHideEnemyMonPic: ; 797d8 (1e:57d8) ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 -InitMultipleObjectsOAM: ; 797e8 (1e:57e8) +InitMultipleObjectsOAM: ; Writes c OAM entries with tile d. ; Sets their Y coordinates to sequential multiples of 8, starting from 0. ; Sets their X coordinates to 0. @@ -2201,7 +2201,7 @@ InitMultipleObjectsOAM: ; 797e8 (1e:57e8) jr nz, .loop ret -AnimationHideMonPic: ; 79801 (1e:5801) +AnimationHideMonPic: ; Hides the mon's sprite. ld a, [H_WHOSETURN] and a @@ -2211,7 +2211,7 @@ AnimationHideMonPic: ; 79801 (1e:5801) .playerTurn ld a, 5 * SCREEN_WIDTH + 1 -ClearMonPicFromTileMap: ; 7980c (1e:580c) +ClearMonPicFromTileMap: push hl push de push bc @@ -2229,7 +2229,7 @@ ClearMonPicFromTileMap: ; 7980c (1e:580c) ; puts the tile map destination address of a mon sprite in hl, given the row count in b ; The usual row count is 7, but it may be smaller when sliding a mon sprite in/out, ; in order to show only a portion of the mon sprite. -GetMonSpriteTileMapPointerFromRowCount: ; 79820 (1e:5820) +GetMonSpriteTileMapPointerFromRowCount: push de ld a, [H_WHOSETURN] and a @@ -2262,7 +2262,7 @@ GetMonSpriteTileMapPointerFromRowCount: ; 79820 (1e:5820) ; de = tile ID list pointer ; b = number of rows ; c = number of columns -GetTileIDList: ; 79842 (1e:5842) +GetTileIDList: ld hl, TileIDListPointerTable ld e, a ld d, 0 @@ -2283,7 +2283,7 @@ GetTileIDList: ; 79842 (1e:5842) ld b, a ret -AnimCopyRowLeft: ; 7985b (1e:585b) +AnimCopyRowLeft: ; copy a row of c tiles 1 tile left ld a, [hld] ld [hli], a @@ -2292,7 +2292,7 @@ AnimCopyRowLeft: ; 7985b (1e:585b) jr nz, AnimCopyRowLeft ret -AnimCopyRowRight: ; 79862 (1e:5862) +AnimCopyRowRight: ; copy a row of c tiles 1 tile right ld a, [hli] ld [hld], a @@ -2302,14 +2302,14 @@ AnimCopyRowRight: ; 79862 (1e:5862) ret ; get the sound of the move id in b -GetMoveSoundB: ; 79869 (1e:5869) +GetMoveSoundB: ld a, b call GetMoveSound ld b, a ret ; get the sound of the (move id - 1) in a -GetMoveSound: ; 7986f (1e:586f) +GetMoveSound: ld hl,MoveSoundTable ld e,a ld d,0 @@ -2349,7 +2349,7 @@ GetMoveSound: ; 7986f (1e:586f) ld a,b ret -IsCryMove: ; 798ad (1e:58ad) +IsCryMove: ; set carry if the move animation involves playing a monster cry ld a,[wAnimationID] cp a,GROWL @@ -2362,7 +2362,7 @@ IsCryMove: ; 798ad (1e:58ad) scf ret -MoveSoundTable: ; 798bc (1e:58bc) +MoveSoundTable: db SFX_POUND, $00,$80 ; POUND db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP @@ -2530,7 +2530,7 @@ MoveSoundTable: ; 798bc (1e:58bc) db SFX_BATTLE_0B, $00,$80 ; STRUGGLE db SFX_BATTLE_0B, $00,$80 -CopyPicTiles: ; 79aae (1e:5aae) +CopyPicTiles: ld a, [H_WHOSETURN] and a ld a, $31 ; base tile ID of player mon sprite @@ -2542,7 +2542,7 @@ CopyPicTiles: ; 79aae (1e:5aae) jr CopyTileIDs_NoBGTransfer ; copy the tiles used when a mon is being sent out of or into a pokeball -CopyDownscaledMonTiles: ; 79aba (1e:5aba) +CopyDownscaledMonTiles: call GetPredefRegisters ld a, [wDownscaledMonSize] and a @@ -2553,14 +2553,14 @@ CopyDownscaledMonTiles: ; 79aba (1e:5aba) ld de, DownscaledMonTiles_3x3 ; fall through -CopyTileIDs_NoBGTransfer: ; 79acb (1e:5acb) +CopyTileIDs_NoBGTransfer: xor a ld [H_AUTOBGTRANSFERENABLED], a ; fall through ; b = number of rows ; c = number of columns -CopyTileIDs: ; 79ace (1e:5ace) +CopyTileIDs: push hl .rowLoop push bc @@ -2585,7 +2585,7 @@ CopyTileIDs: ; 79ace (1e:5ace) pop hl ret -TileIDListPointerTable: ; 79aea (1e:5aea) +TileIDListPointerTable: dw Unknown_79b24 db $77 dw Unknown_79b55 @@ -2603,19 +2603,19 @@ TileIDListPointerTable: ; 79aea (1e:5aea) dw Unknown_79c50 db $3C -DownscaledMonTiles_5x5: ; 79b02 (1e:5b02) +DownscaledMonTiles_5x5: db $31,$38,$46,$54,$5B db $32,$39,$47,$55,$5C db $34,$3B,$49,$57,$5E db $36,$3D,$4B,$59,$60 db $37,$3E,$4C,$5A,$61 -DownscaledMonTiles_3x3: ; 79b1b (1e:5b1b) +DownscaledMonTiles_3x3: db $31,$46,$5B db $34,$49,$5E db $37,$4C,$61 -Unknown_79b24: ; 79b24 (1e:5b24) +Unknown_79b24: db $00,$07,$0E,$15,$1C,$23,$2A db $01,$08,$0F,$16,$1D,$24,$2B db $02,$09,$10,$17,$1E,$25,$2C @@ -2624,19 +2624,19 @@ Unknown_79b24: ; 79b24 (1e:5b24) db $05,$0C,$13,$1A,$21,$28,$2F db $06,$0D,$14,$1B,$22,$29,$30 -Unknown_79b55: ; 79b55 (1e:5b55) +Unknown_79b55: db $00,$07,$0E,$15,$1C,$23,$2A db $01,$08,$0F,$16,$1D,$24,$2B db $03,$0A,$11,$18,$1F,$26,$2D db $04,$0B,$12,$19,$20,$27,$2E db $05,$0C,$13,$1A,$21,$28,$2F -Unknown_79b78: ; 79b78 (1e:5b78) +Unknown_79b78: db $00,$07,$0E,$15,$1C,$23,$2A db $02,$09,$10,$17,$1E,$25,$2C db $04,$0B,$12,$19,$20,$27,$2E -Unknown_79b8d: ; 79b8d (1e:5b8d) +Unknown_79b8d: db $00,$00,$00,$00,$00,$00,$00 db $00,$00,$00,$00,$00,$19,$00 db $02,$06,$0B,$10,$14,$1A,$00 @@ -2645,7 +2645,7 @@ Unknown_79b8d: ; 79b8d (1e:5b8d) db $04,$09,$0E,$13,$17,$1D,$1F db $05,$0A,$0F,$01,$18,$1E,$20 -Unknown_79bbe: ; 79bbe (1e:5bbe) +Unknown_79bbe: db $00,$00,$00,$30,$00,$37,$00 db $00,$00,$2B,$31,$34,$38,$3D db $21,$26,$2C,$01,$35,$39,$3E @@ -2654,7 +2654,7 @@ Unknown_79bbe: ; 79bbe (1e:5bbe) db $24,$29,$2F,$01,$01,$3B,$00 db $25,$2A,$01,$01,$01,$3C,$00 -Unknown_79bef: ; 79bef (1e:5bef) +Unknown_79bef: db $00,$00,$00,$00,$00,$00,$00 db $00,$00,$47,$4D,$00,$00,$00 db $00,$00,$48,$4E,$52,$56,$5B @@ -2663,7 +2663,7 @@ Unknown_79bef: ; 79bef (1e:5bef) db $41,$45,$4B,$51,$4C,$59,$5D db $42,$46,$4C,$4C,$55,$5A,$5E -Unknown_79c20: ; 79c20 (1e:5c20) +Unknown_79c20: db $31,$32,$32,$32,$32,$33 db $34,$35,$36,$36,$37,$38 db $34,$39,$3A,$3A,$3B,$38 @@ -2673,12 +2673,12 @@ Unknown_79c20: ; 79c20 (1e:5c20) db $41,$43,$4B,$4C,$4D,$4E db $4F,$50,$50,$50,$51,$52 -Unknown_79c50: ; 79c50 (1e:5c50) +Unknown_79c50: db $43,$55,$56,$53,$53,$53,$53,$53,$53,$53,$53,$53 db $43,$57,$58,$54,$54,$54,$54,$54,$54,$54,$54,$54 db $43,$59,$5A,$43,$43,$43,$43,$43,$43,$43,$43,$43 -AnimationLeavesFalling: ; 79c74 (1e:5c74) +AnimationLeavesFalling: ; Makes leaves float down from the top of the screen. This is used ; in Razor Leaf's animation. ld a, [rOBP0] @@ -2693,7 +2693,7 @@ AnimationLeavesFalling: ; 79c74 (1e:5c74) ld [rOBP0], a ret -AnimationPetalsFalling: ; 79c8a (1e:5c8a) +AnimationPetalsFalling: ; Makes lots of petals fall down from the top of the screen. It's used in ; the animation for Petal Dance. ld d, $71 ; petal tile @@ -2702,7 +2702,7 @@ AnimationPetalsFalling: ; 79c8a (1e:5c8a) call AnimationFallingObjects jp ClearSprites -AnimationFallingObjects: ; 79c97 (1e:5c97) +AnimationFallingObjects: ld c, a ld a, 1 call InitMultipleObjectsOAM @@ -2741,7 +2741,7 @@ AnimationFallingObjects: ; 79c97 (1e:5c97) jr nz, .loop ; keep moving the falling objects down until it does ret -FallingObjects_UpdateOAMEntry: ; 79cdb (1e:5cdb) +FallingObjects_UpdateOAMEntry: ; Increases Y by 2 pixels and adjusts X and X flip based on the falling object's ; movement byte. ld hl, wOAMBuffer @@ -2785,10 +2785,10 @@ FallingObjects_UpdateOAMEntry: ; 79cdb (1e:5cdb) ld [hl], a ; attribute ret -FallingObjects_DeltaXs: ; 79d0d (1e:5d0d) +FallingObjects_DeltaXs: db 0, 1, 3, 5, 7, 9, 11, 13, 15 -FallingObjects_UpdateMovementByte: ; 79d16 (1e:5d16) +FallingObjects_UpdateMovementByte: ld a, [wFallingObjectMovementByte] inc a ld b, a @@ -2804,7 +2804,7 @@ FallingObjects_UpdateMovementByte: ; 79d16 (1e:5d16) ld [wFallingObjectMovementByte], a ret -FallingObjects_InitXCoords: ; 79d2a (1e:5d2a) +FallingObjects_InitXCoords: ld hl, wOAMBuffer + $01 ld de, FallingObjects_InitialXCoords ld a, [wNumFallingObjects] @@ -2820,10 +2820,10 @@ FallingObjects_InitXCoords: ; 79d2a (1e:5d2a) jr nz, .loop ret -FallingObjects_InitialXCoords: ; 79d3e (1e:5d3e) +FallingObjects_InitialXCoords: db $38,$40,$50,$60,$70,$88,$90,$56,$67,$4A,$77,$84,$98,$32,$22,$5C,$6C,$7D,$8E,$99 -FallingObjects_InitMovementData: ; 79d52 (1e:5d52) +FallingObjects_InitMovementData: ld hl, wFallingObjectsMovementData ld de, FallingObjects_InitialMovementData ld a, [wNumFallingObjects] @@ -2836,10 +2836,10 @@ FallingObjects_InitMovementData: ; 79d52 (1e:5d52) jr nz, .loop ret -FallingObjects_InitialMovementData: ; 79d63 (1e:5d63) +FallingObjects_InitialMovementData: db $00,$84,$06,$81,$02,$88,$01,$83,$05,$89,$09,$80,$07,$87,$03,$82,$04,$85,$08,$86 -AnimationShakeEnemyHUD: ; 79d77 (1e:5d77) +AnimationShakeEnemyHUD: ; Shakes the enemy HUD. ; Make a copy of the back pic's tile patterns in sprite tile pattern VRAM. @@ -2912,7 +2912,7 @@ AnimationShakeEnemyHUD: ; 79d77 (1e:5d77) ; b = tile ID list index ; c = base tile ID -CopyTileIDsFromList: ; 79dda (1e:5dda) +CopyTileIDsFromList: call GetPredefRegisters ld a, c ld [hBaseTileID], a @@ -2922,7 +2922,7 @@ CopyTileIDsFromList: ; 79dda (1e:5dda) pop hl jp CopyTileIDs -ShakeEnemyHUD_ShakeBG: ; 79de9 (1e:5de9) +ShakeEnemyHUD_ShakeBG: ld a, [hSCX] ld [wTempSCX], a .loop @@ -2942,14 +2942,14 @@ ShakeEnemyHUD_ShakeBG: ; 79de9 (1e:5de9) ld [hSCX], a ret -BattleAnimCopyTileMapToVRAM: ; 79e0d (1e:5e0d) +BattleAnimCopyTileMapToVRAM: ld a, h ld [H_AUTOBGTRANSFERDEST + 1], a ld a, l ld [H_AUTOBGTRANSFERDEST], a jp Delay3 -TossBallAnimation: ; 79e16 (1e:5e16) +TossBallAnimation: ld a,[wIsInBattle] cp a,2 jr z,.BlockBall ; if in trainer battle, play different animation @@ -2992,7 +2992,7 @@ TossBallAnimation: ; 79e16 (1e:5e16) jr nz,.PlayNextAnimation ret -.PokeBallAnimations: ; 79e50 (1e:5e50) +.PokeBallAnimations: ; sequence of animations that make up the Poké Ball toss db POOF_ANIM,HIDEPIC_ANIM,SHAKE_ANIM,POOF_ANIM,SHOWPIC_ANIM @@ -3006,7 +3006,7 @@ TossBallAnimation: ; 79e16 (1e:5e16) ld [wAnimationID],a jp PlayAnimation -PlayApplyingAttackSound: ; 79e6a (1e:5e6a) +PlayApplyingAttackSound: ; play a different sound depending if move is not very effective, neutral, or super-effective ; don't play any sound at all if move is ineffective call WaitForSoundToFinish diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm index dc766f23..33af6f6f 100755 --- a/engine/battle/bank_e_misc.asm +++ b/engine/battle/bank_e_misc.asm @@ -1,5 +1,5 @@ ; formats a string at wMovesString that lists the moves at wMoves -FormatMovesString: ; 39b87 (e:5b87) +FormatMovesString: ld hl, wMoves ld de, wMovesString ld b, $0 @@ -52,7 +52,7 @@ FormatMovesString: ; 39b87 (e:5b87) ret ; XXX this is called in a few places, but it doesn't appear to do anything useful -InitList: ; 39bd5 (e:5bd5) +InitList: ld a, [wInitListType] cp INIT_ENEMYOT_LIST jr nz, .notEnemy @@ -103,7 +103,7 @@ InitList: ; 39bd5 (e:5bd5) ret ; get species of mon e in list [wMonDataLocation] for LoadMonData -GetMonSpecies: ; 39c37 (e:5c37) +GetMonSpecies: ld hl, wPartySpecies ld a, [wMonDataLocation] and a diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 545273ee..9e02c56f 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -1,4 +1,4 @@ -BattleTransition: ; 7096d (1c:496d) +BattleTransition: ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 @@ -70,7 +70,7 @@ BattleTransition: ; 7096d (1c:496d) ; bit 0: set if trainer battle ; bit 1: set if enemy is at least 3 levels higher than player ; bit 2: set if dungeon map -BattleTransitions: ; 709d2 (1c:49d2) +BattleTransitions: dw BattleTransition_DoubleCircle ; %000 dw BattleTransition_Spiral ; %001 dw BattleTransition_Circle ; %010 @@ -80,7 +80,7 @@ BattleTransitions: ; 709d2 (1c:49d2) dw BattleTransition_VerticalStripes ; %110 dw BattleTransition_Split ; %111 -GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2) +GetBattleTransitionID_WildOrTrainer: ld a, [wCurOpponent] cp 200 jr nc, .trainer @@ -90,7 +90,7 @@ GetBattleTransitionID_WildOrTrainer: ; 709e2 (1c:49e2) set 0, c ret -GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef) +GetBattleTransitionID_CompareLevels: ld hl, wPartyMon1HP .faintedLoop ld a, [hli] @@ -121,7 +121,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef) ; fails to recognize VICTORY_ROAD_2, VICTORY_ROAD_3, all ROCKET_HIDEOUT maps, ; MANSION_1, SEAFOAM_ISLANDS_[2-5], POWER_PLANT, DIGLETTS_CAVE ; and SILPH_CO_[9-11]F as dungeon maps -GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19) +GetBattleTransitionID_IsDungeonMap: ld a, [wCurMap] ld e, a ld hl, DungeonMaps1 @@ -153,7 +153,7 @@ GetBattleTransitionID_IsDungeonMap: ; 70a19 (1c:4a19) ; GetBattleTransitionID_IsDungeonMap checks if wCurMap ; is equal to one of these maps -DungeonMaps1: ; 70a3f (1c:4a3f) +DungeonMaps1: db VIRIDIAN_FOREST db ROCK_TUNNEL_1 db SEAFOAM_ISLANDS_1 @@ -162,7 +162,7 @@ DungeonMaps1: ; 70a3f (1c:4a3f) ; GetBattleTransitionID_IsDungeonMap checks if wCurMap ; is in between or equal to each pair of maps -DungeonMaps2: ; 70a44 (1c:4a44) +DungeonMaps2: ; all MT_MOON maps db MT_MOON_1 db MT_MOON_3 @@ -181,17 +181,17 @@ DungeonMaps2: ; 70a44 (1c:4a44) db UNKNOWN_DUNGEON_1 db $FF -LoadBattleTransitionTile: ; 70a4d (1c:4a4d) +LoadBattleTransitionTile: ld hl, vChars1 + $7f0 ld de, BattleTransitionTile lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10 jp CopyVideoData -BattleTransitionTile: ; 70a59 (1c:4a59) +BattleTransitionTile: INCBIN "gfx/battle_transition.2bpp" BattleTransitionTileEnd: -BattleTransition_BlackScreen: ; 70a69 (1c:4a69) +BattleTransition_BlackScreen: ld a, $ff ld [rBGP], a ld [rOBP0], a @@ -202,7 +202,7 @@ BattleTransition_BlackScreen: ; 70a69 (1c:4a69) ; called regardless of mon levels, but does an ; outward spiral if enemy is at least 3 levels ; higher than player and does an inward spiral otherwise -BattleTransition_Spiral: ; 70a72 (1c:4a72) +BattleTransition_Spiral: ld a, [wBattleTransitionSpiralDirection] and a jr z, .outwardSpiral @@ -235,7 +235,7 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72) ld [wOutwardSpiralTileMapPointer], a ret -BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) +BattleTransition_InwardSpiral: ld a, 7 ld [wInwardSpiralUpdateScreenCounter], a coord hl, 0, 0 @@ -265,7 +265,7 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) jr nz, .loop ret -BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0) +BattleTransition_InwardSpiral_: push bc .loop ld [hl], $ff @@ -284,7 +284,7 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0) pop bc ret -BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9) +BattleTransition_OutwardSpiral_: ld bc, -SCREEN_WIDTH ld de, SCREEN_WIDTH ld a, [wOutwardSpiralTileMapPointer + 1] @@ -352,7 +352,7 @@ BattleTransition_OutwardSpiral_: ; 70af9 (1c:4af9) jr .done FlashScreen: -BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d) +BattleTransition_FlashScreen_: ld hl, BattleTransition_FlashScreenPalettes .loop ld a, [hli] @@ -367,12 +367,12 @@ BattleTransition_FlashScreen_: ; 70b5d (1c:4b5d) jr nz, BattleTransition_FlashScreen_ ret -BattleTransition_FlashScreenPalettes: ; 70b72 (1c:4b72) +BattleTransition_FlashScreenPalettes: db $F9,$FE,$FF,$FE,$F9,$E4,$90,$40,$00,$40,$90,$E4 db $01 ; terminator ; used for low level trainer dungeon battles -BattleTransition_Shrink: ; 70b7f (1c:4b7f) +BattleTransition_Shrink: ld c, SCREEN_HEIGHT / 2 .loop push bc @@ -406,7 +406,7 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f) jp DelayFrames ; used for high level trainer dungeon battles -BattleTransition_Split: ; 70bca (1c:4bca) +BattleTransition_Split: ld c, SCREEN_HEIGHT / 2 xor a ld [H_AUTOBGTRANSFERENABLED], a @@ -437,7 +437,7 @@ BattleTransition_Split: ; 70bca (1c:4bca) ld c, 10 jp DelayFrames -BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) +BattleTransition_CopyTiles1: ld a, c ld [wBattleTransitionCopyTilesOffset], a ld a, b @@ -469,7 +469,7 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12) jr nz, .loop2 ret -BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) +BattleTransition_CopyTiles2: ld a, c ld [wBattleTransitionCopyTilesOffset], a ld a, b @@ -519,7 +519,7 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f) ret ; used for high level wild dungeon battles -BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) +BattleTransition_VerticalStripes: ld c, SCREEN_HEIGHT coord hl, 0, 0 coord de, 1, 17 @@ -547,7 +547,7 @@ BattleTransition_VerticalStripes: ; 70c7e (1c:4c7e) jr nz, .loop jp BattleTransition_BlackScreen -BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) +BattleTransition_VerticalStripes_: ld c, SCREEN_WIDTH / 2 .loop ld [hl], $ff @@ -558,7 +558,7 @@ BattleTransition_VerticalStripes_: ; 70caa (1c:4caa) ret ; used for low level wild dungeon battles -BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) +BattleTransition_HorizontalStripes: ld c, SCREEN_WIDTH coord hl, 0, 0 coord de, 19, 1 @@ -582,7 +582,7 @@ BattleTransition_HorizontalStripes: ; 70cb4 (1c:4cb4) jr nz, .loop jp BattleTransition_BlackScreen -BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) +BattleTransition_HorizontalStripes_: ld c, SCREEN_HEIGHT / 2 ld de, SCREEN_WIDTH * 2 .loop @@ -595,7 +595,7 @@ BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8) ; used for high level wild non-dungeon battles ; makes one full circle around the screen ; by animating each half circle one at a time -BattleTransition_Circle: ; 70ce4 (1c:4ce4) +BattleTransition_Circle: call BattleTransition_FlashScreen lb bc, 0, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 @@ -606,14 +606,14 @@ BattleTransition_Circle: ; 70ce4 (1c:4ce4) call BattleTransition_Circle_Sub1 jp BattleTransition_BlackScreen -BattleTransition_FlashScreen: ; 70cfd (1c:4cfd) +BattleTransition_FlashScreen: ld b, $3 call BattleTransition_FlashScreen_ xor a ld [H_AUTOBGTRANSFERENABLED], a ret -BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06) +BattleTransition_Circle_Sub1: push bc push hl ld a, b @@ -627,7 +627,7 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06) jr nz, BattleTransition_Circle_Sub1 ret -BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) +BattleTransition_TransferDelay3: ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a call Delay3 @@ -638,7 +638,7 @@ BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) ; used for low level wild non-dungeon battles ; makes two half circles around the screen ; by animating both half circles at the same time -BattleTransition_DoubleCircle: ; 70d24 (1c:4d24) +BattleTransition_DoubleCircle: call BattleTransition_FlashScreen ld c, SCREEN_WIDTH / 2 ld hl, BattleTransition_HalfCircle1 @@ -666,7 +666,7 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24) jr nz, .loop jp BattleTransition_BlackScreen -BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50) +BattleTransition_Circle_Sub2: ld [wBattleTransitionCircleScreenQuadrantY], a ld a, [hli] ld [wBattleTransitionCircleScreenQuadrantX], a @@ -679,7 +679,7 @@ BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50) ld l, a jp BattleTransition_Circle_Sub3 -BattleTransition_HalfCircle1: ; 70d61 (1c:4d61) +BattleTransition_HalfCircle1: db $01 dw BattleTransition_CircleData1 dwCoord 18, 6 @@ -720,7 +720,7 @@ BattleTransition_HalfCircle1: ; 70d61 (1c:4d61) dw BattleTransition_CircleData1 dwCoord 1, 6 -BattleTransition_HalfCircle2: ; 70d93 (1c:4d93) +BattleTransition_HalfCircle2: db $00 dw BattleTransition_CircleData1 dwCoord 1, 11 @@ -761,7 +761,7 @@ BattleTransition_HalfCircle2: ; 70d93 (1c:4d93) dw BattleTransition_CircleData1 dwCoord 18, 11 -BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5) +BattleTransition_Circle_Sub3: push hl ld a, [de] ld c, a @@ -806,17 +806,17 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5) jr nz, .loop2 jr BattleTransition_Circle_Sub3 -BattleTransition_CircleData1: ; 70dfe (1c:4dfe) +BattleTransition_CircleData1: db $02,$03,$05,$04,$09,$FF -BattleTransition_CircleData2: ; 70e04 (1c:4e04) +BattleTransition_CircleData2: db $01,$01,$02,$02,$04,$02,$04,$02,$03,$FF -BattleTransition_CircleData3: ; 70e0e (1c:4e0e) +BattleTransition_CircleData3: db $02,$01,$03,$01,$04,$01,$04,$01,$04,$01,$03,$01,$02,$01,$01,$01,$01,$FF -BattleTransition_CircleData4: ; 70e20 (1c:4e20) +BattleTransition_CircleData4: db $04,$01,$04,$00,$03,$01,$03,$00,$02,$01,$02,$00,$01,$FF -BattleTransition_CircleData5: ; 70e2e (1c:4e2e) +BattleTransition_CircleData5: db $04,$00,$03,$00,$03,$00,$02,$00,$02,$00,$01,$00,$01,$00,$01,$FF diff --git a/engine/battle/common_text.asm b/engine/battle/common_text.asm index 476284f0..3d46c947 100644 --- a/engine/battle/common_text.asm +++ b/engine/battle/common_text.asm @@ -1,4 +1,4 @@ -PrintBeginningBattleText: ; 58d99 (16:4d99) +PrintBeginningBattleText: ld a, [wIsInBattle] dec a jr nz, .trainerBattle @@ -70,31 +70,31 @@ PrintBeginningBattleText: ; 58d99 (16:4d99) .done ret -WildMonAppearedText: ; 58e3b (16:4e3b) +WildMonAppearedText: TX_FAR _WildMonAppearedText db "@" -HookedMonAttackedText: ; 58e40 (16:4e40) +HookedMonAttackedText: TX_FAR _HookedMonAttackedText db "@" -EnemyAppearedText: ; 58e45 (16:4e45) +EnemyAppearedText: TX_FAR _EnemyAppearedText db "@" -TrainerWantsToFightText: ; 58e4a (16:4e4a) +TrainerWantsToFightText: TX_FAR _TrainerWantsToFightText db "@" -UnveiledGhostText: ; 58e4f (16:4e4f) +UnveiledGhostText: TX_FAR _UnveiledGhostText db "@" -GhostCantBeIDdText: ; 58e54 (16:4e54) +GhostCantBeIDdText: TX_FAR _GhostCantBeIDdText db "@" -PrintSendOutMonMessage: ; 58e59 (16:4e59) +PrintSendOutMonMessage: ld hl, wEnemyMonHP ld a, [hli] or [hl] @@ -137,22 +137,22 @@ PrintSendOutMonMessage: ; 58e59 (16:4e59) .printText jp PrintText -GoText: ; 58eae (16:4eae) +GoText: TX_FAR _GoText TX_ASM jr PrintPlayerMon1Text -DoItText: ; 58eb5 (16:4eb5) +DoItText: TX_FAR _DoItText TX_ASM jr PrintPlayerMon1Text -GetmText: ; 58ebc (16:4ebc) +GetmText: TX_FAR _GetmText TX_ASM jr PrintPlayerMon1Text -EnemysWeakText: ; 58ec3 (16:4ec3) +EnemysWeakText: TX_FAR _EnemysWeakText TX_ASM @@ -160,15 +160,15 @@ PrintPlayerMon1Text: ld hl, PlayerMon1Text ret -PlayerMon1Text: ; 58ecc (16:4ecc) +PlayerMon1Text: TX_FAR _PlayerMon1Text db "@" -RetreatMon: ; 58ed1 (16:4ed1) +RetreatMon: ld hl, PlayerMon2Text jp PrintText -PlayerMon2Text: ; 58ed7 (16:4ed7) +PlayerMon2Text: TX_FAR _PlayerMon2Text TX_ASM push de @@ -219,25 +219,25 @@ PlayerMon2Text: ; 58ed7 (16:4ed7) ld hl, GoodText ; HP went down 70% or more ret -EnoughText: ; 58f25 (16:4f25) +EnoughText: TX_FAR _EnoughText TX_ASM jr PrintComeBackText -OKExclamationText: ; 58f2c (16:4f2c) +OKExclamationText: TX_FAR _OKExclamationText TX_ASM jr PrintComeBackText -GoodText: ; 58f33 (16:4f33) +GoodText: TX_FAR _GoodText TX_ASM jr PrintComeBackText -PrintComeBackText: ; 58f3a (16:4f3a) +PrintComeBackText: ld hl, ComeBackText ret -ComeBackText: ; 58f3e (16:4f3e) +ComeBackText: TX_FAR _ComeBackText db "@" diff --git a/engine/battle/core.asm b/engine/battle/core.asm index fce78717..f8053a9e 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1,7 +1,7 @@ BattleCore: ; These are move effects (second value from the Moves table in bank $E). -ResidualEffects1: ; 3c000 (f:4000) +ResidualEffects1: ; most non-side effects db CONVERSION_EFFECT db HAZE_EFFECT @@ -20,13 +20,13 @@ ResidualEffects1: ; 3c000 (f:4000) db LEECH_SEED_EFFECT db SPLASH_EFFECT db -1 -SetDamageEffects: ; 3c011 (f:4011) +SetDamageEffects: ; moves that do damage but not through normal calculations ; e.g., Super Fang, Psywave db SUPER_FANG_EFFECT db SPECIAL_DAMAGE_EFFECT db -1 -ResidualEffects2: ; 3c014 (f:4014) +ResidualEffects2: ; non-side effects not included in ResidualEffects1 ; stat-affecting moves, sleep-inflicting moves, and Bide ; e.g., Meditate, Bide, Hypnosis @@ -58,7 +58,7 @@ ResidualEffects2: ; 3c014 (f:4014) db ACCURACY_DOWN2_EFFECT db EVASION_DOWN2_EFFECT db -1 -AlwaysHappenSideEffects: ; 3c030 (f:4030) +AlwaysHappenSideEffects: ; Attacks that aren't finished after they faint the opponent. db DRAIN_HP_EFFECT db EXPLODE_EFFECT @@ -71,7 +71,7 @@ AlwaysHappenSideEffects: ; 3c030 (f:4030) db TWINEEDLE_EFFECT db RAGE_EFFECT db -1 -SpecialEffects: ; 3c03b (f:403b) +SpecialEffects: ; Effects from arrays 2, 4, and 5B, minus Twineedle and Rage. ; Includes all effects that do not need to be called at the end of ; ExecutePlayerMove (or ExecuteEnemyMove), because they have already been handled @@ -90,13 +90,13 @@ SpecialEffects: ; 3c03b (f:403b) db JUMP_KICK_EFFECT db RECOIL_EFFECT ; fallthrough to Next EffectsArray -SpecialEffectsCont: ; 3c049 (f:4049) +SpecialEffectsCont: ; damaging moves whose effect is executed prior to damage calculation db THRASH_PETAL_DANCE_EFFECT db TRAPPING_EFFECT db -1 -SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) +SlidePlayerAndEnemySilhouettesOnScreen: call LoadPlayerBackPic ld a, MESSAGE_BOX ; the usual text box at the bottom of the screen ld [wTextBoxID], a @@ -193,7 +193,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; 3c04c (f:404c) ; the lower of the player's pic (his body) is part of the background, but his head is a sprite ; the reason for this is that it shares Y coordinates with the lower part of the enemy pic, so background scrolling wouldn't work for both pics ; instead, the enemy pic is part of the background and uses the scroll register, while the player's head is a sprite and is slid by changing its X coordinates in a loop -SlidePlayerHeadLeft: ; 3c0ff (f:40ff) +SlidePlayerHeadLeft: push bc ld hl, wOAMBuffer + $01 ld c, $15 ; number of OAM entries @@ -207,7 +207,7 @@ SlidePlayerHeadLeft: ; 3c0ff (f:40ff) pop bc ret -SetScrollXForSlidingPlayerBodyLeft: ; 3c110 (f:4110) +SetScrollXForSlidingPlayerBodyLeft: ld a, [rLY] cp l jr nz, SetScrollXForSlidingPlayerBodyLeft @@ -219,7 +219,7 @@ SetScrollXForSlidingPlayerBodyLeft: ; 3c110 (f:4110) jr z, .loop ret -StartBattle: ; 3c11e (f:411e) +StartBattle: xor a ld [wPartyGainExpFlags], a ld [wPartyFoughtCurrentEnemyFlags], a @@ -341,7 +341,7 @@ StartBattle: ; 3c11e (f:411e) jr MainInBattleLoop ; wild mon or link battle enemy ran from battle -EnemyRan: ; 3c202 (f:4202) +EnemyRan: call LoadScreenTilesFromBuffer1 ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -359,15 +359,15 @@ EnemyRan: ; 3c202 (f:4202) ld [H_WHOSETURN], a jpab AnimationSlideEnemyMonOff -WildRanText: ; 3c229 (f:4229) +WildRanText: TX_FAR _WildRanText db "@" -EnemyRanText: ; 3c22e (f:422e) +EnemyRanText: TX_FAR _EnemyRanText db "@" -MainInBattleLoop: ; 3c233 (f:4233) +MainInBattleLoop: call ReadPlayerMonCurHPAndStatus ld hl, wBattleMonHP ld a, [hli] @@ -557,7 +557,7 @@ MainInBattleLoop: ; 3c233 (f:4233) call CheckNumAttacksLeft jp MainInBattleLoop -HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd) +HandlePoisonBurnLeechSeed: ld hl, wBattleMonHP ld de, wBattleMonStatus ld a, [H_WHOSETURN] @@ -621,15 +621,15 @@ HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd) xor a ret -HurtByPoisonText: ; 3c42e (f:442e) +HurtByPoisonText: TX_FAR _HurtByPoisonText db "@" -HurtByBurnText: ; 3c433 (f:4433) +HurtByBurnText: TX_FAR _HurtByBurnText db "@" -HurtByLeechSeedText: ; 3c438 (f:4438) +HurtByLeechSeedText: TX_FAR _HurtByLeechSeedText db "@" @@ -637,7 +637,7 @@ HurtByLeechSeedText: ; 3c438 (f:4438) ; note that the toxic ticks are considered even if the damage is not poison (hence the Leech Seed glitch) ; hl: HP pointer ; bc (out): total damage -HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d) +HandlePoisonBurnLeechSeed_DecreaseOwnHP: push hl push hl ld bc, $e ; skip to max HP @@ -705,7 +705,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d) ; adds bc to enemy HP ; bc isn't updated if HP substracted was capped to prevent overkill -HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3) +HandlePoisonBurnLeechSeed_IncreaseEnemyHP: push hl ld hl, wEnemyMonMaxHP ld a, [H_WHOSETURN] @@ -755,7 +755,7 @@ HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3) pop hl ret -UpdateCurMonHPBar: ; 3c4f6 (f:44f6) +UpdateCurMonHPBar: coord hl, 10, 9 ; tile pointer to player HP bar ld a, [H_WHOSETURN] and a @@ -770,7 +770,7 @@ UpdateCurMonHPBar: ; 3c4f6 (f:44f6) pop bc ret -CheckNumAttacksLeft: ; 3c50f (f:450f) +CheckNumAttacksLeft: ld a, [wPlayerNumAttacksLeft] and a jr nz, .checkEnemy @@ -786,7 +786,7 @@ CheckNumAttacksLeft: ; 3c50f (f:450f) res UsingTrappingMove, [hl] ; enemy not using multi-turn attack like wrap any more ret -HandleEnemyMonFainted: ; 3c525 (f:4525) +HandleEnemyMonFainted: xor a ld [wInHandlePlayerMonFainted], a call FaintEnemyPokemon @@ -949,7 +949,7 @@ EnemyMonFaintedText: ; 0x3c63e TX_FAR _EnemyMonFaintedText db "@" -EndLowHealthAlarm: ; 3c643 (f:4643) +EndLowHealthAlarm: ; This function is called when the player has the won the battle. It turns off ; the low health alarm and prevents it from reactivating until the next battle. xor a @@ -959,7 +959,7 @@ EndLowHealthAlarm: ; 3c643 (f:4643) ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating ret -AnyEnemyPokemonAliveCheck: ; 3c64f (f:464f) +AnyEnemyPokemonAliveCheck: ld a, [wEnemyPartyCount] ld b, a xor a @@ -977,7 +977,7 @@ AnyEnemyPokemonAliveCheck: ; 3c64f (f:464f) ret ; stores whether enemy ran in Z flag -ReplaceFaintedEnemyMon: ; 3c664 (f:4664) +ReplaceFaintedEnemyMon: ld hl, wEnemyHPBarColor ld e, $30 call GetBattleHealthBarColor @@ -1000,7 +1000,7 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664) inc a ; reset Z flag ret -TrainerBattleVictory: ; 3c696 (f:4696) +TrainerBattleVictory: call EndLowHealthAlarm ld b, MUSIC_DEFEATED_GYM_LEADER ld a, [wGymLeaderNo] @@ -1036,15 +1036,15 @@ TrainerBattleVictory: ; 3c696 (f:4696) ld c, $3 predef_jump AddBCDPredef -MoneyForWinningText: ; 3c6e4 (f:46e4) +MoneyForWinningText: TX_FAR _MoneyForWinningText db "@" -TrainerDefeatedText: ; 3c6e9 (f:46e9) +TrainerDefeatedText: TX_FAR _TrainerDefeatedText db "@" -PlayBattleVictoryMusic: ; 3c6ee (f:46ee) +PlayBattleVictoryMusic: push af ld a, $ff ld [wNewSoundID], a @@ -1054,7 +1054,7 @@ PlayBattleVictoryMusic: ; 3c6ee (f:46ee) call PlayMusic jp Delay3 -HandlePlayerMonFainted: ; 3c700 (f:4700) +HandlePlayerMonFainted: ld a, 1 ld [wInHandlePlayerMonFainted], a call RemoveFaintedPlayerMon @@ -1088,7 +1088,7 @@ HandlePlayerMonFainted: ; 3c700 (f:4700) jp MainInBattleLoop ; resets flags, slides mon's pic down, plays cry, and prints fainted message -RemoveFaintedPlayerMon: ; 3c741 (f:4741) +RemoveFaintedPlayerMon: ld a, [wPlayerMonNumber] ld c, a ld hl, wPartyGainExpFlags @@ -1131,13 +1131,13 @@ RemoveFaintedPlayerMon: ; 3c741 (f:4741) ld hl, PlayerMonFaintedText jp PrintText -PlayerMonFaintedText: ; 3c796 (f:4796) +PlayerMonFaintedText: TX_FAR _PlayerMonFaintedText db "@" ; asks if you want to use next mon ; stores whether you ran in C flag -DoUseNextMonDialogue: ; 3c79b (f:479b) +DoUseNextMonDialogue: call PrintEmptyString call SaveScreenTilesToBuffer1 ld a, [wIsInBattle] @@ -1165,13 +1165,13 @@ DoUseNextMonDialogue: ; 3c79b (f:479b) ld de, wEnemyMonSpeed jp TryRunningFromBattle -UseNextMonText: ; 3c7d3 (f:47d3) +UseNextMonText: TX_FAR _UseNextMonText db "@" ; choose next player mon to send out ; stores whether enemy mon has no HP left in Z flag -ChooseNextMon: ; 3c7d8 (f:47d8) +ChooseNextMon: ld a, BATTLE_PARTY_MENU ld [wPartyMenuTypeOrMessageID], a call DisplayPartyMenu @@ -1217,7 +1217,7 @@ ChooseNextMon: ; 3c7d8 (f:47d8) ; called when player is out of usable mons. ; prints approriate lose message, sets carry flag if player blacked out (special case for initial rival fight) -HandlePlayerBlackOut: ; 3c837 (f:4837) +HandlePlayerBlackOut: ld a, [wLinkState] cp LINK_STATE_BATTLING jr z, .notSony1Battle @@ -1252,21 +1252,21 @@ HandlePlayerBlackOut: ; 3c837 (f:4837) scf ret -Sony1WinText: ; 3c884 (f:4884) +Sony1WinText: TX_FAR _Sony1WinText db "@" -PlayerBlackedOutText2: ; 3c889 (f:4889) +PlayerBlackedOutText2: TX_FAR _PlayerBlackedOutText2 db "@" -LinkBattleLostText: ; 3c88e (f:488e) +LinkBattleLostText: TX_FAR _LinkBattleLostText db "@" ; slides pic of fainted mon downwards until it disappears ; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing -SlideDownFaintedMonPic: ; 3c893 (f:4893) +SlideDownFaintedMonPic: ld a, [wd730] push af set 6, a @@ -1312,14 +1312,14 @@ SlideDownFaintedMonPic: ; 3c893 (f:4893) ld [wd730], a ret -SevenSpacesText: ; 3c8d7 (f:48d7) +SevenSpacesText: db " @" ; slides the player or enemy trainer off screen ; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer) ; if a is 8, the slide is to the right, else it is to the left ; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing -SlideTrainerPicOffScreen: ; 3c8df (f:48df) +SlideTrainerPicOffScreen: ld [hSlideAmount], a ld c, a .slideStepLoop ; each iteration, the trainer pic is slid one tile left/right @@ -1360,7 +1360,7 @@ SlideTrainerPicOffScreen: ; 3c8df (f:48df) ret ; send out a trainer's mon -EnemySendOut: ; 3c90e (f:490e) +EnemySendOut: ld hl,wPartyGainExpFlags xor a ld [hl],a @@ -1376,7 +1376,7 @@ EnemySendOut: ; 3c90e (f:490e) predef FlagActionPredef ; don't change wPartyGainExpFlags or wPartyFoughtCurrentEnemyFlags -EnemySendOutFirstMon: ; 3c92a (f:492a) +EnemySendOutFirstMon: xor a ld hl,wEnemyStatsToDouble ; clear enemy statuses ld [hli],a @@ -1529,17 +1529,17 @@ EnemySendOutFirstMon: ; 3c92a (f:492a) call SaveScreenTilesToBuffer1 jp SwitchPlayerMon -TrainerAboutToUseText: ; 3ca79 (f:4a79) +TrainerAboutToUseText: TX_FAR _TrainerAboutToUseText db "@" -TrainerSentOutText: ; 3ca7e (f:4a7e) +TrainerSentOutText: TX_FAR _TrainerSentOutText db "@" ; tests if the player has any pokemon that are not fainted ; sets d = 0 if all fainted, d != 0 if some mons are still alive -AnyPartyAlive: ; 3ca83 (f:4a83) +AnyPartyAlive: ld a, [wPartyCount] ld e, a xor a @@ -1557,7 +1557,7 @@ AnyPartyAlive: ; 3ca83 (f:4a83) ; tests if player mon has fainted ; stores whether mon has fainted in Z flag -HasMonFainted: ; 3ca97 (f:4a97) +HasMonFainted: ld a, [wWhichPokemon] ld hl, wPartyMon1HP ld bc, wPartyMon2 - wPartyMon1 @@ -1574,13 +1574,13 @@ HasMonFainted: ; 3ca97 (f:4a97) xor a ret -NoWillText: ; 3cab4 (f:4ab4) +NoWillText: TX_FAR _NoWillText db "@" ; try to run from battle (hl = player speed, de = enemy speed) ; stores whether the attempt was successful in carry flag -TryRunningFromBattle: ; 3cab9 (f:4ab9) +TryRunningFromBattle: call IsGhostBattle jp z, .canEscape ; jump if it's a ghost battle ld a, [wBattleType] @@ -1697,20 +1697,20 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9) scf ; set carry ret -CantEscapeText: ; 3cb97 (f:4b97) +CantEscapeText: TX_FAR _CantEscapeText db "@" -NoRunningText: ; 3cb9c (f:4b9c) +NoRunningText: TX_FAR _NoRunningText db "@" -GotAwayText: ; 3cba1 (f:4ba1) +GotAwayText: TX_FAR _GotAwayText db "@" ; copies from party data to battle mon data when sending out a new player mon -LoadBattleMonFromParty: ; 3cba6 (f:4ba6) +LoadBattleMonFromParty: ld a, [wWhichPokemon] ld bc, wPartyMon2 - wPartyMon1 ld hl, wPartyMon1Species @@ -1754,7 +1754,7 @@ LoadBattleMonFromParty: ; 3cba6 (f:4ba6) ret ; copies from enemy party data to current enemy mon data when sending out a new enemy mon -LoadEnemyMonFromParty: ; 3cc13 (f:4c13) +LoadEnemyMonFromParty: ld a, [wWhichPokemon] ld bc, wEnemyMon2 - wEnemyMon1 ld hl, wEnemyMons @@ -1807,7 +1807,7 @@ LoadEnemyMonFromParty: ; 3cc13 (f:4c13) ld [wEnemyMonPartyPos], a ret -SendOutMon: ; 3cc91 (f:4c91) +SendOutMon: callab PrintSendOutMonMessage ld hl, wEnemyMonHP ld a, [hli] @@ -1853,7 +1853,7 @@ SendOutMon: ; 3cc91 (f:4c91) jp SaveScreenTilesToBuffer1 ; show 2 stages of the player mon getting smaller before disappearing -AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) +AnimateRetreatingPlayerMon: coord hl, 1, 5 lb bc, 7, 7 call ClearScreenArea @@ -1883,7 +1883,7 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) jp ClearScreenArea ; reads player's current mon's HP into wBattleMonHP -ReadPlayerMonCurHPAndStatus: ; 3cd43 (f:4d43) +ReadPlayerMonCurHPAndStatus: ld a, [wPlayerMonNumber] ld hl, wPartyMon1HP ld bc, wPartyMon2 - wPartyMon1 @@ -1894,11 +1894,11 @@ ReadPlayerMonCurHPAndStatus: ; 3cd43 (f:4d43) ld bc, $4 ; 2 bytes HP, 1 byte unknown (unused?), 1 byte status jp CopyData -DrawHUDsAndHPBars: ; 3cd5a (f:4d5a) +DrawHUDsAndHPBars: call DrawPlayerHUDAndHPBar jp DrawEnemyHUDAndHPBar -DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) +DrawPlayerHUDAndHPBar: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 9, 7 @@ -1959,7 +1959,7 @@ DrawPlayerHUDAndHPBar: ; 3cd60 (f:4d60) set 7, [hl] ;enable low health alarm ret -DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) +DrawEnemyHUDAndHPBar: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 0 @@ -2049,7 +2049,7 @@ DrawEnemyHUDAndHPBar: ; 3cdec (f:4dec) ld [H_AUTOBGTRANSFERENABLED], a ld hl, wEnemyHPBarColor -GetBattleHealthBarColor: ; 3ce90 (f:4e90) +GetBattleHealthBarColor: ld b, [hl] call GetHealthBarColor ld a, [hl] @@ -2063,7 +2063,7 @@ GetBattleHealthBarColor: ; 3ce90 (f:4e90) ; (i.e. for names longer than 4 letters) ; if the name is 3 or 4 letters long, it is printed 1 space more to the right than usual ; (i.e. for names longer than 4 letters) -CenterMonName: ; 3ce9c (f:4e9c) +CenterMonName: push de inc hl inc hl @@ -2084,7 +2084,7 @@ CenterMonName: ; 3ce9c (f:4e9c) pop de ret -DisplayBattleMenu: ; 3ceb3 (f:4eb3) +DisplayBattleMenu: call LoadScreenTilesFromBuffer1 ; restore saved screen ld a, [wBattleType] and a @@ -2498,7 +2498,7 @@ PartyMenuOrRockOrRun: call GBPalNormal ; fall through to SwitchPlayerMon -SwitchPlayerMon: ; 3d1ba (f:51ba) +SwitchPlayerMon: callab RetreatMon ld c, 50 call DelayFrames @@ -2521,11 +2521,11 @@ SwitchPlayerMon: ; 3d1ba (f:51ba) and a ret -AlreadyOutText: ; 3d1f5 (f:51f5) +AlreadyOutText: TX_FAR _AlreadyOutText db "@" -BattleMenu_RunWasSelected: ; 3d1fa (f:51fa) +BattleMenu_RunWasSelected: call LoadScreenTilesFromBuffer1 ld a, $3 ld [wCurrentMenuItem], a @@ -2540,7 +2540,7 @@ BattleMenu_RunWasSelected: ; 3d1fa (f:51fa) ret nz ; return if the player couldn't escape jp DisplayBattleMenu -MoveSelectionMenu: ; 3d219 (f:5219) +MoveSelectionMenu: ld a, [wMoveMenuType] dec a jr z, .mimicmenu @@ -2658,7 +2658,7 @@ MoveSelectionMenu: ; 3d219 (f:5219) ld [hl], a ; fallthrough -SelectMenuItem: ; 3d2fe (f:52fe) +SelectMenuItem: ld a, [wMoveMenuType] and a jr z, .battleselect @@ -2753,18 +2753,18 @@ SelectMenuItem: ; 3d2fe (f:52fe) call LoadScreenTilesFromBuffer1 jp MoveSelectionMenu -MoveNoPPText: ; 3d3ae (f:53ae) +MoveNoPPText: TX_FAR _MoveNoPPText db "@" -MoveDisabledText: ; 3d3b3 (f:53b3) +MoveDisabledText: TX_FAR _MoveDisabledText db "@" -WhichTechniqueString: ; 3d3b8 (f:53b8) +WhichTechniqueString: db "WHICH TECHNIQUE?@" -CursorUp: ; 3d3c9 (f:53c9) +CursorUp: ld a, [wCurrentMenuItem] and a jp nz, SelectMenuItem @@ -2774,7 +2774,7 @@ CursorUp: ; 3d3c9 (f:53c9) ld [wCurrentMenuItem], a jp SelectMenuItem -CursorDown: ; 3d3dd (f:53dd) +CursorDown: ld a, [wCurrentMenuItem] ld b, a ld a, [wNumMovesMinusOne] @@ -2787,7 +2787,7 @@ CursorDown: ; 3d3dd (f:53dd) ld [wCurrentMenuItem], a jp SelectMenuItem -AnyMoveToSelect: ; 3d3f5 (f:53f5) +AnyMoveToSelect: ; return z and Struggle as the selected move if all moves have 0 PP and/or are disabled ld a, STRUGGLE ld [wPlayerSelectedMove], a @@ -2830,11 +2830,11 @@ AnyMoveToSelect: ; 3d3f5 (f:53f5) xor a ret -NoMovesLeftText: ; 3d430 (f:5430) +NoMovesLeftText: TX_FAR _NoMovesLeftText db "@" -SwapMovesInMenu: ; 3d435 (f:5435) +SwapMovesInMenu: ld a, [wMenuItemToSwap] and a jr z, .noMenuItemSelected @@ -2910,7 +2910,7 @@ SwapMovesInMenu: ; 3d435 (f:5435) ld [wMenuItemToSwap], a ; select the current menu item for swapping jp MoveSelectionMenu -PrintMenuItem: ; 3d4b6 (f:54b6) +PrintMenuItem: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 8 @@ -2981,13 +2981,13 @@ PrintMenuItem: ; 3d4b6 (f:54b6) ld [H_AUTOBGTRANSFERENABLED], a jp Delay3 -DisabledText: ; 3d555 (f:5555) +DisabledText: db "disabled!@" -TypeText: ; 3d55f (f:555f) +TypeText: db "TYPE@" -SelectEnemyMove: ; 3d564 (f:5564) +SelectEnemyMove: ld a, [wLinkState] sub LINK_STATE_BATTLING jr nz, .noLinkBattle @@ -3080,7 +3080,7 @@ SelectEnemyMove: ; 3d564 (f:5564) jr .done ; this appears to exchange data with the other gameboy during link battles -LinkBattleExchangeData: ; 3d605 (f:5605) +LinkBattleExchangeData: ld a, $ff ld [wSerialExchangeNybbleReceiveData], a ld a, [wPlayerMoveListIndex] @@ -3128,7 +3128,7 @@ LinkBattleExchangeData: ; 3d605 (f:5605) jr nz, .syncLoop3 ret -ExecutePlayerMove: ; 3d65e (f:565e) +ExecutePlayerMove: xor a ld [H_WHOSETURN], a ; set player's turn ld a, [wPlayerSelectedMove] @@ -3156,7 +3156,7 @@ ExecutePlayerMove: ; 3d65e (f:565e) call CheckForDisobedience jp z, ExecutePlayerMoveDone -CheckIfPlayerNeedsToChargeUp: ; 3d69a (f:569a) +CheckIfPlayerNeedsToChargeUp: ld a, [wPlayerMoveEffect] cp CHARGE_EFFECT jp z, JumpMoveEffect @@ -3165,13 +3165,13 @@ CheckIfPlayerNeedsToChargeUp: ; 3d69a (f:569a) jr PlayerCanExecuteMove ; in-battle stuff -PlayerCanExecuteChargingMove: ; 3d6a9 (f:56a9) +PlayerCanExecuteChargingMove: ld hl,wPlayerBattleStatus1 res ChargingUp,[hl] ; reset charging up and invulnerability statuses if mon was charging up for an attack ; being fully paralyzed or hurting oneself in confusion removes charging up status ; resulting in the Pokemon being invulnerable for the whole battle res Invulnerable,[hl] -PlayerCanExecuteMove: ; 3d6b0 (f:56b0) +PlayerCanExecuteMove: call PrintMonName1Text ld hl,DecrementPP ld de,wPlayerSelectedMove ; pointer to the move just used @@ -3188,7 +3188,7 @@ PlayerCanExecuteMove: ; 3d6b0 (f:56b0) ld de,1 call IsInArray call c,JumpMoveEffect ; execute the effects of SpecialEffectsCont moves (e.g. Wrap, Thrash) but don't skip anything -PlayerCalcMoveDamage: ; 3d6dc (f:56dc) +PlayerCalcMoveDamage: ld a,[wPlayerMoveEffect] ld hl,SetDamageEffects ld de,1 @@ -3325,17 +3325,17 @@ MirrorMoveCheck ; Responsible for executing Twineedle's second side effect (poison). jp ExecutePlayerMoveDone -MultiHitText: ; 3d805 (f:5805) +MultiHitText: TX_FAR _MultiHitText db "@" -ExecutePlayerMoveDone: ; 3d80a (f:580a) +ExecutePlayerMoveDone: xor a ld [wActionResultOrTookBattleTurn],a ld b,1 ret -PrintGhostText: ; 3d811 (f:5811) +PrintGhostText: ; print the ghost battle messages call IsGhostBattle ret nz @@ -3355,15 +3355,15 @@ PrintGhostText: ; 3d811 (f:5811) xor a ret -ScaredText: ; 3d830 (f:5830) +ScaredText: TX_FAR _ScaredText db "@" -GetOutText: ; 3d835 (f:5835) +GetOutText: TX_FAR _GetOutText db "@" -IsGhostBattle: ; 3d83a (f:583a) +IsGhostBattle: ld a,[wIsInBattle] dec a ret nz @@ -3382,7 +3382,7 @@ IsGhostBattle: ; 3d83a (f:583a) ; checks for various status conditions affecting the player mon ; stores whether the mon cannot use a move this turn in Z flag -CheckPlayerStatusConditions: ; 3d854 (f:5854) +CheckPlayerStatusConditions: ld hl,wBattleMonStatus ld a,[hl] and a,SLP ; sleep mask @@ -3643,67 +3643,67 @@ CheckPlayerStatusConditions: ; 3d854 (f:5854) and a ret -FastAsleepText: ; 3da3d (f:5a3d) +FastAsleepText: TX_FAR _FastAsleepText db "@" -WokeUpText: ; 3da42 (f:5a42) +WokeUpText: TX_FAR _WokeUpText db "@" -IsFrozenText: ; 3da47 (f:5a47) +IsFrozenText: TX_FAR _IsFrozenText db "@" -FullyParalyzedText: ; 3da4c (f:5a4c) +FullyParalyzedText: TX_FAR _FullyParalyzedText db "@" -FlinchedText: ; 3da51 (f:5a51) +FlinchedText: TX_FAR _FlinchedText db "@" -MustRechargeText: ; 3da56 (f:5a56) +MustRechargeText: TX_FAR _MustRechargeText db "@" -DisabledNoMoreText: ; 3da5b (f:5a5b) +DisabledNoMoreText: TX_FAR _DisabledNoMoreText db "@" -IsConfusedText: ; 3da60 (f:5a60) +IsConfusedText: TX_FAR _IsConfusedText db "@" -HurtItselfText: ; 3da65 (f:5a65) +HurtItselfText: TX_FAR _HurtItselfText db "@" -ConfusedNoMoreText: ; 3da6a (f:5a6a) +ConfusedNoMoreText: TX_FAR _ConfusedNoMoreText db "@" -SavingEnergyText: ; 3da6f (f:5a6f) +SavingEnergyText: TX_FAR _SavingEnergyText db "@" -UnleashedEnergyText: ; 3da74 (f:5a74) +UnleashedEnergyText: TX_FAR _UnleashedEnergyText db "@" -ThrashingAboutText: ; 3da79 (f:5a79) +ThrashingAboutText: TX_FAR _ThrashingAboutText db "@" -AttackContinuesText: ; 3da7e (f:5a7e) +AttackContinuesText: TX_FAR _AttackContinuesText db "@" -CantMoveText: ; 3da83 (f:5a83) +CantMoveText: TX_FAR _CantMoveText db "@" -PrintMoveIsDisabledText: ; 3da88 (f:5a88) +PrintMoveIsDisabledText: ld hl, wPlayerSelectedMove ld de, wPlayerBattleStatus1 ld a, [H_WHOSETURN] @@ -3721,11 +3721,11 @@ PrintMoveIsDisabledText: ; 3da88 (f:5a88) ld hl, MoveIsDisabledText jp PrintText -MoveIsDisabledText: ; 3daa8 (f:5aa8) +MoveIsDisabledText: TX_FAR _MoveIsDisabledText db "@" -HandleSelfConfusionDamage: ; 3daad (f:5aad) +HandleSelfConfusionDamage: ld hl, HurtItselfText call PrintText ld hl, wEnemyMonDefense @@ -3769,7 +3769,7 @@ HandleSelfConfusionDamage: ; 3daad (f:5aad) ld [H_WHOSETURN], a jp ApplyDamageToPlayerPokemon -PrintMonName1Text: ; 3daf5 (f:5af5) +PrintMonName1Text: ld hl, MonName1Text jp PrintText @@ -3778,7 +3778,7 @@ PrintMonName1Text: ; 3daf5 (f:5af5) ; 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) +MonName1Text: TX_FAR _MonName1Text TX_ASM ld a, [H_WHOSETURN] @@ -3803,33 +3803,33 @@ MonName1Text: ; 3dafb (f:5afb) ld hl, Used1Text ret -Used1Text: ; 3db2d (f:5b2d) +Used1Text: TX_FAR _Used1Text TX_ASM jr PrintInsteadText -Used2Text: ; 3db34 (f:5b34) +Used2Text: TX_FAR _Used2Text TX_ASM ; fall through -PrintInsteadText: ; 3db39 (f:5b39) +PrintInsteadText: ld a, [wMonIsDisobedient] and a jr z, PrintMoveName ld hl, InsteadText ret -InsteadText: ; 3db43 (f:5b43) +InsteadText: TX_FAR _InsteadText TX_ASM ; fall through -PrintMoveName: ; 3db48 (f:5b48) +PrintMoveName: ld hl, _PrintMoveName ret -_PrintMoveName: ; 3db4c (f:5b4c) +_PrintMoveName: TX_FAR _CF4BText TX_ASM ld hl, ExclamationPointPointerTable @@ -3845,30 +3845,30 @@ _PrintMoveName: ; 3db4c (f:5b4c) ld l, a ret -ExclamationPointPointerTable: ; 3db62 (f:5b62) +ExclamationPointPointerTable: dw ExclamationPoint1Text dw ExclamationPoint2Text dw ExclamationPoint3Text dw ExclamationPoint4Text dw ExclamationPoint5Text -ExclamationPoint1Text: ; 3db6c (f:5b6c) +ExclamationPoint1Text: TX_FAR _ExclamationPoint1Text db "@" -ExclamationPoint2Text: ; 3db71 (f:5b71) +ExclamationPoint2Text: TX_FAR _ExclamationPoint2Text db "@" -ExclamationPoint3Text: ; 3db76 (f:5b76) +ExclamationPoint3Text: TX_FAR _ExclamationPoint3Text db "@" -ExclamationPoint4Text: ; 3db7b (f:5b7b) +ExclamationPoint4Text: TX_FAR _ExclamationPoint4Text db "@" -ExclamationPoint5Text: ; 3db80 (f:5b80) +ExclamationPoint5Text: TX_FAR _ExclamationPoint5Text db "@" @@ -3879,7 +3879,7 @@ ExclamationPoint5Text: ; 3db80 (f:5b80) ; 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) +DetermineExclamationPointTextNum: push bc ld a, [wd11e] ; move ID ld c, a @@ -3901,7 +3901,7 @@ DetermineExclamationPointTextNum: ; 3db85 (f:5b85) pop bc ret -ExclamationPointMoveSets: ; 3dba3 (f:5ba3) +ExclamationPointMoveSets: db SWORDS_DANCE, GROWTH db $00 db RECOVER, BIDE, SELFDESTRUCT, AMNESIA @@ -3916,7 +3916,7 @@ ExclamationPointMoveSets: ; 3dba3 (f:5ba3) db $00 db $FF ; terminator -PrintMoveFailureText: ; 3dbe2 (f:5be2) +PrintMoveFailureText: ld de, wPlayerMoveEffect ld a, [H_WHOSETURN] and a @@ -3973,28 +3973,28 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2) .enemyTurn jp ApplyDamageToEnemyPokemon -AttackMissedText: ; 3dc42 (f:5c42) +AttackMissedText: TX_FAR _AttackMissedText db "@" -KeptGoingAndCrashedText: ; 3dc47 (f:5c47) +KeptGoingAndCrashedText: TX_FAR _KeptGoingAndCrashedText db "@" -UnaffectedText: ; 3dc4c (f:5c4c) +UnaffectedText: TX_FAR _UnaffectedText db "@" -PrintDoesntAffectText: ; 3dc51 (f:5c51) +PrintDoesntAffectText: ld hl, DoesntAffectMonText jp PrintText -DoesntAffectMonText: ; 3dc57 (f:5c57) +DoesntAffectMonText: TX_FAR _DoesntAffectMonText db "@" ; if there was a critical hit or an OHKO was successful, print the corresponding text -PrintCriticalOHKOText: ; 3dc5c (f:5c5c) +PrintCriticalOHKOText: ld a, [wCriticalHitOrOHKO] and a jr z, .done ; do nothing if there was no critical hit or successful OHKO @@ -4014,21 +4014,21 @@ PrintCriticalOHKOText: ; 3dc5c (f:5c5c) ld c, 20 jp DelayFrames -CriticalOHKOTextPointers: ; 3dc7a (f:5c7a) +CriticalOHKOTextPointers: dw CriticalHitText dw OHKOText -CriticalHitText: ; 3dc7e (f:5c7e) +CriticalHitText: TX_FAR _CriticalHitText db "@" -OHKOText: ; 3dc83 (f:5c83) +OHKOText: TX_FAR _OHKOText db "@" ; checks if a traded mon will disobey due to lack of badges ; stores whether the mon will use a move in Z flag -CheckForDisobedience: ; 3dc88 (f:5c88) +CheckForDisobedience: xor a ld [wMonIsDisobedient], a ld a, [wLinkState] @@ -4207,28 +4207,28 @@ CheckForDisobedience: ; 3dc88 (f:5c88) xor a ; set Z flag ret -LoafingAroundText: ; 3ddb6 (f:5db6) +LoafingAroundText: TX_FAR _LoafingAroundText db "@" -BeganToNapText: ; 3ddbb (f:5dbb) +BeganToNapText: TX_FAR _BeganToNapText db "@" -WontObeyText: ; 3ddc0 (f:5dc0) +WontObeyText: TX_FAR _WontObeyText db "@" -TurnedAwayText: ; 3ddc5 (f:5dc5) +TurnedAwayText: TX_FAR _TurnedAwayText db "@" -IgnoredOrdersText: ; 3ddca (f:5dca) +IgnoredOrdersText: TX_FAR _IgnoredOrdersText db "@" ; sets b, c, d, and e for the CalculateDamage routine in the case of an attack by the player mon -GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf) +GetDamageVarsForPlayerAttack: xor a ld hl, wDamage ; damage to eventually inflict, initialise to zero ldi [hl], a @@ -4341,7 +4341,7 @@ GetDamageVarsForPlayerAttack: ; 3ddcf (f:5dcf) ret ; sets b, c, d, and e for the CalculateDamage routine in the case of an attack by the enemy mon -GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75) +GetDamageVarsForEnemyAttack: ld hl, wDamage ; damage to eventually inflict, initialise to zero xor a ld [hli], a @@ -4456,7 +4456,7 @@ GetDamageVarsForEnemyAttack: ; 3de75 (f:5e75) ; get stat c of enemy mon ; c: stat to get (HP=1,Attack=2,Defense=3,Speed=4,Special=5) -GetEnemyMonStat: ; 3df1c (f:5f1c) +GetEnemyMonStat: push de push bc ld a, [wLinkState] @@ -4497,7 +4497,7 @@ GetEnemyMonStat: ; 3df1c (f:5f1c) pop de ret -CalculateDamage: ; 3df65 (f:5f65) +CalculateDamage: ; input: ; b: attack ; c: opponent defense @@ -4659,14 +4659,14 @@ CalculateDamage: ; 3df65 (f:5f65) and a ret -JumpToOHKOMoveEffect: ; 3e016 (f:6016) +JumpToOHKOMoveEffect: call JumpMoveEffect ld a, [wMoveMissed] dec a ret -UnusedHighCriticalMoves: ; 3e01e (f:601e) +UnusedHighCriticalMoves: db KARATE_CHOP db RAZOR_LEAF db CRABHAMMER @@ -4677,7 +4677,7 @@ UnusedHighCriticalMoves: ; 3e01e (f:601e) ; determines if attack is a critical hit ; azure heights claims "the fastest pokémon (who are,not coincidentally, ; among the most popular) tend to CH about 20 to 25% of the time." -CriticalHitTest: ; 3e023 (f:6023) +CriticalHitTest: xor a ld [wCriticalHitOrOHKO], a ld a, [H_WHOSETURN] @@ -4744,7 +4744,7 @@ CriticalHitTest: ; 3e023 (f:6023) ret ; high critical hit moves -HighCriticalMoves: ; 3e08e (f:608e) +HighCriticalMoves: db KARATE_CHOP db RAZOR_LEAF db CRABHAMMER @@ -4753,7 +4753,7 @@ HighCriticalMoves: ; 3e08e (f:608e) ; function to determine if Counter hits and if so, how much damage it does -HandleCounterMove: ; 3e093 (f:6093) +HandleCounterMove: ; The variables checked by Counter are updated whenever the cursor points to a new move in the battle selection menu. ; This is irrelevant for the opponent's side outside of link battles, since the move selection is controlled by the AI. ; However, in the scenario where the player switches out and the opponent uses Counter, @@ -4818,7 +4818,7 @@ HandleCounterMove: ; 3e093 (f:6093) xor a ret -ApplyAttackToEnemyPokemon: ; 3e0df (f:60df) +ApplyAttackToEnemyPokemon: ld a,[wPlayerMoveEffect] cp a,OHKO_EFFECT jr z,ApplyDamageToEnemyPokemon @@ -4884,7 +4884,7 @@ ApplyAttackToEnemyPokemon: ; 3e0df (f:60df) ld a,b ld [hl],a -ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) +ApplyDamageToEnemyPokemon: ld hl,wDamage ld a,[hli] ld b,a @@ -4934,10 +4934,10 @@ ApplyDamageToEnemyPokemon: ; 3e142 (f:6142) xor a ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening -ApplyAttackToEnemyPokemonDone: ; 3e19d (f:619d) +ApplyAttackToEnemyPokemonDone: jp DrawHUDsAndHPBars -ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0) +ApplyAttackToPlayerPokemon: ld a,[wEnemyMoveEffect] cp a,OHKO_EFFECT jr z,ApplyDamageToPlayerPokemon @@ -5003,7 +5003,7 @@ ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0) ld a,b ld [hl],a -ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) +ApplyDamageToPlayerPokemon: ld hl,wDamage ld a,[hli] ld b,a @@ -5055,7 +5055,7 @@ ApplyDamageToPlayerPokemon: ; 3e200 (f:6200) ApplyAttackToPlayerPokemonDone jp DrawHUDsAndHPBars -AttackSubstitute: ; 3e25e (f:625e) +AttackSubstitute: ; 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, @@ -5110,16 +5110,16 @@ AttackSubstitute: ; 3e25e (f:625e) ld [hl],a ; zero the effect of the attacker's move jp DrawHUDsAndHPBars -SubstituteTookDamageText: ; 3e2ac (f:62ac) +SubstituteTookDamageText: TX_FAR _SubstituteTookDamageText db "@" -SubstituteBrokeText: ; 3e2b1 (f:62b1) +SubstituteBrokeText: TX_FAR _SubstituteBrokeText db "@" ; this function raises the attack modifier of a pokemon using Rage when that pokemon is attacked -HandleBuildingRage: ; 3e2b6 (f:62b6) +HandleBuildingRage: ; values for the player turn ld hl,wEnemyBattleStatus2 ld de,wEnemyMonStatMods @@ -5161,13 +5161,13 @@ HandleBuildingRage: ; 3e2b6 (f:62b6) ld [H_WHOSETURN],a ret -BuildingRageText: ; 3e2f8 (f:62f8) +BuildingRageText: TX_FAR _BuildingRageText db "@" ; copy last move for Mirror Move ; sets zero flag on failure and unsets zero flag on success -MirrorMoveCopyMove: ; 3e2fd (f:62fd) +MirrorMoveCopyMove: ; Mirror Move makes use of ccf1 (wPlayerUsedMove) and ccf2 (wEnemyUsedMove) addresses, ; which are mainly used to print the "[Pokemon] used [Move]" text. ; Both are set to 0 whenever a new Pokemon is sent out @@ -5197,12 +5197,12 @@ MirrorMoveCopyMove: ; 3e2fd (f:62fd) xor a ret -MirrorMoveFailedText: ; 3e324 (f:6324) +MirrorMoveFailedText: TX_FAR _MirrorMoveFailedText db "@" ; function used to reload move data for moves like Mirror Move and Metronome -ReloadMoveData: ; 3e329 (f:6329) +ReloadMoveData: ld [wd11e],a dec a ld hl,Moves @@ -5219,7 +5219,7 @@ ReloadMoveData: ; 3e329 (f:6329) ret ; function that picks a random move for metronome -MetronomePickMove: ; 3e348 (f:6348) +MetronomePickMove: xor a ld [wAnimationType],a ld a,METRONOME @@ -5248,7 +5248,7 @@ MetronomePickMove: ; 3e348 (f:6348) ; this function increments the current move's PP ; it's used to prevent moves that run another move within the same turn ; (like Mirror Move and Metronome) from losing 2 PP -IncrementMovePP: ; 3e373 (f:6373) +IncrementMovePP: ld a,[H_WHOSETURN] and a ; values for player turn @@ -5280,7 +5280,7 @@ IncrementMovePP: ; 3e373 (f:6373) ret ; function to adjust the base damage of an attack to account for type effectiveness -AdjustDamageForMoveType: ; 3e3a5 (f:63a5) +AdjustDamageForMoveType: ; values for player turn ld hl,wBattleMonType ld a,[hli] @@ -5399,7 +5399,7 @@ AdjustDamageForMoveType: ; 3e3a5 (f:63a5) ; the result is stored in [wTypeEffectiveness] ; ($05 is not very effective, $10 is neutral, $14 is super effective) ; as far is can tell, this is only used once in some AI code to help decide which move to use -AIGetTypeEffectiveness: ; 3e449 (f:6449) +AIGetTypeEffectiveness: ld a,[wEnemyMoveType] ld d,a ; d = type of enemy move ld hl,wBattleMonType @@ -5434,7 +5434,7 @@ AIGetTypeEffectiveness: ; 3e449 (f:6449) INCLUDE "data/type_effects.asm" ; some tests that need to pass for a move to hit -MoveHitTest: ; 3e56b (f:656b) +MoveHitTest: ; player's turn ld hl,wEnemyBattleStatus1 ld de,wPlayerMoveEffect @@ -5554,7 +5554,7 @@ MoveHitTest: ; 3e56b (f:656b) ret ; values for player turn -CalcHitChance: ; 3e624 (f:6624) +CalcHitChance: ld hl,wPlayerMoveAccuracy ld a,[H_WHOSETURN] and a @@ -5626,7 +5626,7 @@ CalcHitChance: ; 3e624 (f:6624) ret ; multiplies damage by a random percentage from ~85% to 100% -RandomizeDamage: ; 3e687 (f:6687) +RandomizeDamage: ld hl, wDamage ld a, [hli] and a @@ -5663,7 +5663,7 @@ RandomizeDamage: ; 3e687 (f:6687) ret ; for more detailed commentary, see equivalent function for player side (ExecutePlayerMove) -ExecuteEnemyMove: ; 3e6bc (f:66bc) +ExecuteEnemyMove: ld a, [wEnemySelectedMove] inc a jp z, ExecuteEnemyMoveDone @@ -5695,14 +5695,14 @@ ExecuteEnemyMove: ; 3e6bc (f:66bc) jr nz, EnemyCanExecuteChargingMove ; if so, jump call GetCurrentMove -CheckIfEnemyNeedsToChargeUp: ; 3e6fc (f:66fc) +CheckIfEnemyNeedsToChargeUp: ld a, [wEnemyMoveEffect] cp CHARGE_EFFECT jp z, JumpMoveEffect cp FLY_EFFECT jp z, JumpMoveEffect jr EnemyCanExecuteMove -EnemyCanExecuteChargingMove: ; 3e70b (f:670b) +EnemyCanExecuteChargingMove: ld hl, wEnemyBattleStatus1 res ChargingUp, [hl] ; no longer charging up for attack res Invulnerable, [hl] ; no longer invulnerable to typical attacks @@ -5715,7 +5715,7 @@ EnemyCanExecuteChargingMove: ; 3e70b (f:670b) call GetName ld de, wcd6d call CopyStringToCF4B -EnemyCanExecuteMove: ; 3e72b (f:672b) +EnemyCanExecuteMove: xor a ld [wMonIsDisobedient], a call PrintMonName1Text @@ -5729,7 +5729,7 @@ EnemyCanExecuteMove: ; 3e72b (f:672b) ld de, $1 call IsInArray call c, JumpMoveEffect -EnemyCalcMoveDamage: ; 3e750 (f:6750) +EnemyCalcMoveDamage: call SwapPlayerAndEnemyLevels ld a, [wEnemyMoveEffect] ld hl, SetDamageEffects @@ -5747,9 +5747,9 @@ EnemyCalcMoveDamage: ; 3e750 (f:6750) call AdjustDamageForMoveType call RandomizeDamage -EnemyMoveHitTest: ; 3e77f (f:677f) +EnemyMoveHitTest: call MoveHitTest -handleIfEnemyMoveMissed: ; 3e782 (f:6782) +handleIfEnemyMoveMissed: ld a, [wMoveMissed] and a jr z, .asm_3e791 @@ -5760,17 +5760,17 @@ handleIfEnemyMoveMissed: ; 3e782 (f:6782) .asm_3e791 call SwapPlayerAndEnemyLevels -GetEnemyAnimationType: ; 3e794 (f:6794) +GetEnemyAnimationType: ld a, [wEnemyMoveEffect] and a ld a, $1 jr z, playEnemyMoveAnimation ld a, $2 jr playEnemyMoveAnimation -asm_3e7a0: ; 3e7a0 (f:67a0) +asm_3e7a0: call SwapPlayerAndEnemyLevels xor a -playEnemyMoveAnimation: ; 3e7a4 (f:67a4) +playEnemyMoveAnimation: push af ld a, [wEnemyBattleStatus2] bit HasSubstituteUp, a ; does mon have a substitute? @@ -5790,7 +5790,7 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4) call nz, Bankswitch ; slide the substitute's sprite out jr EnemyCheckIfMirrorMoveEffect -EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1) +EnemyCheckIfFlyOrChargeEffect: call SwapPlayerAndEnemyLevels ld c, 30 call DelayFrames @@ -5805,7 +5805,7 @@ EnemyCheckIfFlyOrChargeEffect: ; 3e7d1 (f:67d1) ld [wAnimationType], a ld a,STATUS_AFFECTED_ANIM call PlayMoveAnimation -EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef) +EnemyCheckIfMirrorMoveEffect: ld a, [wEnemyMoveEffect] cp MIRROR_MOVE_EFFECT jr nz, .notMirrorMoveEffect @@ -5872,17 +5872,17 @@ EnemyCheckIfMirrorMoveEffect: ; 3e7ef (f:67ef) call nc, JumpMoveEffect jr ExecuteEnemyMoveDone -HitXTimesText: ; 3e887 (f:6887) +HitXTimesText: TX_FAR _HitXTimesText db "@" -ExecuteEnemyMoveDone: ; 3e88c (f:688c) +ExecuteEnemyMoveDone: ld b, $1 ret ; checks for various status conditions affecting the enemy mon ; stores whether the mon cannot use a move this turn in Z flag -CheckEnemyStatusConditions: ; 3e88f (f:688f) +CheckEnemyStatusConditions: ld hl, wEnemyMonStatus ld a, [hl] and SLP ; sleep mask @@ -6164,7 +6164,7 @@ CheckEnemyStatusConditions: ; 3e88f (f:688f) and a ; clear Z flag ret -GetCurrentMove: ; 3eabe (f:6abe) +GetCurrentMove: ld a, [H_WHOSETURN] and a jp z, .player @@ -6195,7 +6195,7 @@ GetCurrentMove: ; 3eabe (f:6abe) ld de, wcd6d jp CopyStringToCF4B -LoadEnemyMonData: ; 3eb01 (f:6b01) +LoadEnemyMonData: ld a, [wLinkState] cp LINK_STATE_BATTLING jp z, LoadEnemyMonFromParty @@ -6355,7 +6355,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01) ret ; calls BattleTransition to show the battle transition animation and initializes some battle variables -DoBattleTransitionAndInitBattleVariables: ; 3ec32 (f:6c32) +DoBattleTransitionAndInitBattleVariables: ld a, [wLinkState] cp LINK_STATE_BATTLING jr nz, .next @@ -6391,7 +6391,7 @@ DoBattleTransitionAndInitBattleVariables: ; 3ec32 (f:6c32) ret ; swaps the level values of the BattleMon and EnemyMon structs -SwapPlayerAndEnemyLevels: ; 3ec81 (f:6c81) +SwapPlayerAndEnemyLevels: push bc ld a, [wBattleMonLevel] ld b, a @@ -6405,7 +6405,7 @@ SwapPlayerAndEnemyLevels: ; 3ec81 (f:6c81) ; loads either red back pic or old man back pic ; also writes OAM data and loads tile patterns for the Red or Old Man back sprite's head ; (for use when scrolling the player sprite and enemy's silhouettes on screen) -LoadPlayerBackPic: ; 3ec92 (f:6c92) +LoadPlayerBackPic: ld a, [wBattleType] dec a ; is it the old man tutorial? ld de, RedPicBack @@ -6466,26 +6466,26 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92) predef_jump CopyUncompressedPicToTilemap ; does nothing since no stats are ever selected (barring glitches) -DoubleOrHalveSelectedStats: ; 3ed02 (f:6d02) +DoubleOrHalveSelectedStats: callab DoubleSelectedStats jpab HalveSelectedStats -ScrollTrainerPicAfterBattle: ; 3ed12 (f:6d12) +ScrollTrainerPicAfterBattle: jpab _ScrollTrainerPicAfterBattle -ApplyBurnAndParalysisPenaltiesToPlayer: ; 3ed1a (f:6d1a) +ApplyBurnAndParalysisPenaltiesToPlayer: ld a, $1 jr ApplyBurnAndParalysisPenalties -ApplyBurnAndParalysisPenaltiesToEnemy: ; 3ed1e (f:6d1e) +ApplyBurnAndParalysisPenaltiesToEnemy: xor a -ApplyBurnAndParalysisPenalties: ; 3ed1f (f:6d1f) +ApplyBurnAndParalysisPenalties: ld [H_WHOSETURN], a call QuarterSpeedDueToParalysis jp HalveAttackDueToBurn -QuarterSpeedDueToParalysis: ; 3ed27 (f:6d27) +QuarterSpeedDueToParalysis: ld a, [H_WHOSETURN] and a jr z, .playerTurn @@ -6528,7 +6528,7 @@ QuarterSpeedDueToParalysis: ; 3ed27 (f:6d27) ld [hl], b ret -HalveAttackDueToBurn: ; 3ed64 (f:6d64) +HalveAttackDueToBurn: ld a, [H_WHOSETURN] and a jr z, .playerTurn @@ -6567,7 +6567,7 @@ HalveAttackDueToBurn: ; 3ed64 (f:6d64) ld [hl], b ret -CalculateModifiedStats: ; 3ed99 (f:6d99) +CalculateModifiedStats: ld c, 0 .loop call CalculateModifiedStat @@ -6578,7 +6578,7 @@ CalculateModifiedStats: ; 3ed99 (f:6d99) ret ; calculate modified stat for stat c (0 = attack, 1 = defense, 2 = speed, 3 = special) -CalculateModifiedStat: ; 3eda5 (f:6da5) +CalculateModifiedStat: push bc push bc ld a, [wCalculateWhoseStats] @@ -6656,7 +6656,7 @@ CalculateModifiedStat: ; 3eda5 (f:6da5) pop bc ret -ApplyBadgeStatBoosts: ; 3ee19 (f:6e19) +ApplyBadgeStatBoosts: ld a, [wLinkState] cp LINK_STATE_BATTLING ret z ; return if link battle @@ -6709,10 +6709,10 @@ ApplyBadgeStatBoosts: ; 3ee19 (f:6e19) ld [hld], a ret -LoadHudAndHpBarAndStatusTilePatterns: ; 3ee58 (f:6e58) +LoadHudAndHpBarAndStatusTilePatterns: call LoadHpBarAndStatusTilePatterns -LoadHudTilePatterns: ; 3ee5b (f:6e5b) +LoadHudTilePatterns: ld a, [rLCDC] add a ; is LCD disabled? jr c, .lcdEnabled @@ -6737,7 +6737,7 @@ LoadHudTilePatterns: ; 3ee5b (f:6e5b) lb bc, BANK(BattleHudTiles2), (BattleHudTiles3End - BattleHudTiles2) / $8 jp CopyVideoDataDouble -PrintEmptyString: ; 3ee94 (f:6e94) +PrintEmptyString: ld hl, .emptyString jp PrintText .emptyString @@ -6796,7 +6796,7 @@ BattleRandom: ret -HandleExplodingAnimation: ; 3eed3 (f:6ed3) +HandleExplodingAnimation: ld a, [H_WHOSETURN] and a ld hl, wEnemyMonType1 @@ -6827,23 +6827,23 @@ HandleExplodingAnimation: ; 3eed3 (f:6ed3) ld a, 5 ld [wAnimationType], a -PlayMoveAnimation: ; 3ef07 (f:6f07) +PlayMoveAnimation: ld [wAnimationID],a call Delay3 predef_jump MoveAnimation -InitBattle: ; 3ef12 (f:6f12) +InitBattle: ld a, [wCurOpponent] and a jr z, DetermineWildOpponent -InitOpponent: ; 3ef18 (f:6f18) +InitOpponent: ld a, [wCurOpponent] ld [wcf91], a ld [wEnemyMonSpecies2], a jr InitBattleCommon -DetermineWildOpponent: ; 3ef23 (f:6f23) +DetermineWildOpponent: ld a, [wd732] bit 1, a jr z, .asm_3ef2f @@ -6856,7 +6856,7 @@ DetermineWildOpponent: ; 3ef23 (f:6f23) ret nz callab TryDoWildEncounter ret nz -InitBattleCommon: ; 3ef3d (f:6f3d) +InitBattleCommon: ld a, [wMapPalOffset] push af ld hl, wLetterPrintingDelayFlags @@ -6885,7 +6885,7 @@ InitBattleCommon: ; 3ef3d (f:6f3d) ld [wIsInBattle], a jp _InitBattleCommon -InitWildBattle: ; 3ef8b (f:6f8b) +InitWildBattle: ld a, $1 ld [wIsInBattle], a call LoadEnemyMonData @@ -6935,7 +6935,7 @@ InitWildBattle: ; 3ef8b (f:6f8b) predef CopyUncompressedPicToTilemap ; common code that executes after init battle code specific to trainer or wild battles -_InitBattleCommon: ; 3efeb (f:6feb) +_InitBattleCommon: ld b, SET_PAL_BATTLE_BLACK call RunPaletteCommand call SlidePlayerAndEnemySilhouettesOnScreen @@ -6976,7 +6976,7 @@ _InitBattleCommon: ; 3efeb (f:6feb) .emptyString db "@" -_LoadTrainerPic: ; 3f04b (f:704b) +_LoadTrainerPic: ; wd033-wd034 contain pointer to pic ld a, [wTrainerPicPointer] ld e, a @@ -6995,14 +6995,14 @@ _LoadTrainerPic: ; 3f04b (f:704b) jp LoadUncompressedSpriteData ; unreferenced -ResetCryModifiers: ; 3f069 (f:7069) +ResetCryModifiers: xor a ld [wFrequencyModifier], a ld [wTempoModifier], a jp PlaySound ; animates the mon "growing" out of the pokeball -AnimateSendingOutMon: ; 3f073 (f:7073) +AnimateSendingOutMon: ld a, [wPredefRegisters] ld h, a ld a, [wPredefRegisters + 1] @@ -7042,13 +7042,13 @@ AnimateSendingOutMon: ; 3f073 (f:7073) add $31 jr CopyUncompressedPicToHL -CopyUncompressedPicToTilemap: ; 3f0c6 (f:70c6) +CopyUncompressedPicToTilemap: ld a, [wPredefRegisters] ld h, a ld a, [wPredefRegisters + 1] ld l, a ld a, [hStartTileID] -CopyUncompressedPicToHL: ; 3f0d0 (f:70d0) +CopyUncompressedPicToHL: lb bc, 7, 7 ld de, SCREEN_WIDTH push af @@ -7095,7 +7095,7 @@ CopyUncompressedPicToHL: ; 3f0d0 (f:70d0) jr nz, .flippedLoop ret -LoadMonBackPic: ; 3f103 (f:7103) +LoadMonBackPic: ; Assumes the monster's attributes have ; been loaded with GetMonHeader. ld a, [wBattleMonSpecies2] @@ -7116,12 +7116,12 @@ LoadMonBackPic: ; 3f103 (f:7103) ld b, a jp CopyVideoData -JumpMoveEffect: ; 3f132 (f:7132) +JumpMoveEffect: call _JumpMoveEffect ld b, $1 ret -_JumpMoveEffect: ; 3f138 (f:7138) +_JumpMoveEffect: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveEffect] @@ -7139,7 +7139,7 @@ _JumpMoveEffect: ; 3f138 (f:7138) ld l, a jp [hl] ; jump to special effect handler -MoveEffectPointerTable: ; 3f150 (f:7150) +MoveEffectPointerTable: dw SleepEffect ; unused effect dw PoisonEffect ; POISON_SIDE_EFFECT1 dw DrainHPEffect ; DRAIN_HP_EFFECT @@ -7227,7 +7227,7 @@ MoveEffectPointerTable: ; 3f150 (f:7150) dw SplashEffect ; SPLASH_EFFECT dw DisableEffect ; DISABLE_EFFECT -SleepEffect: ; 3f1fc (f:71fc) +SleepEffect: ld de, wEnemyMonStatus ld bc, wEnemyBattleStatus2 ld a, [H_WHOSETURN] @@ -7271,15 +7271,15 @@ SleepEffect: ; 3f1fc (f:71fc) .didntAffect jp PrintDidntAffectText -FellAsleepText: ; 3f245 (f:7245) +FellAsleepText: TX_FAR _FellAsleepText db "@" -AlreadyAsleepText: ; 3f24a (f:724a) +AlreadyAsleepText: TX_FAR _AlreadyAsleepText db "@" -PoisonEffect: ; 3f24f (f:724f) +PoisonEffect: ld hl, wEnemyMonStatus ld de, wPlayerMoveEffect ld a, [H_WHOSETURN] @@ -7365,18 +7365,18 @@ PoisonEffect: ; 3f24f (f:724f) call DelayFrames jp PrintDidntAffectText -PoisonedText: ; 3f2df (f:72df) +PoisonedText: TX_FAR _PoisonedText db "@" -BadlyPoisonedText: ; 3f2e4 (f:72e4) +BadlyPoisonedText: TX_FAR _BadlyPoisonedText db "@" -DrainHPEffect: ; 3f2e9 (f:72e9) +DrainHPEffect: jpab DrainHPEffect_ -ExplodeEffect: ; 3f2f1 (f:72f1) +ExplodeEffect: ld hl, wBattleMonHP ld de, wPlayerBattleStatus2 ld a, [H_WHOSETURN] @@ -7395,7 +7395,7 @@ ExplodeEffect: ; 3f2f1 (f:72f1) ld [de], a ret -FreezeBurnParalyzeEffect: ; 3f30c (f:730c) +FreezeBurnParalyzeEffect: xor a ld [wAnimationType], a call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] @@ -7454,7 +7454,7 @@ FreezeBurnParalyzeEffect: ; 3f30c (f:730c) call PlayBattleAnimation ld hl, FrozenText jp PrintText -opponentAttacker: ; 3f382 (f:7382) +opponentAttacker: ld a, [wBattleMonStatus] ; mostly same as above with addresses swapped for opponent and a jp nz, CheckDefrost @@ -7500,15 +7500,15 @@ opponentAttacker: ; 3f382 (f:7382) ld hl, FrozenText jp PrintText -BurnedText: ; 3f3d8 (f:73d8) +BurnedText: TX_FAR _BurnedText db "@" -FrozenText: ; 3f3dd (f:73dd) +FrozenText: TX_FAR _FrozenText db "@" -CheckDefrost: ; 3f3e2 (f:73e2) +CheckDefrost: ; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target and a, 1 << FRZ ; are they frozen? ret z ; return if so @@ -7543,11 +7543,11 @@ CheckDefrost: ; 3f3e2 (f:73e2) .common jp PrintText -FireDefrostedText: ; 3f423 (f:7423) +FireDefrostedText: TX_FAR _FireDefrostedText db "@" -StatModifierUpEffect: ; 3f428 (f:7428) +StatModifierUpEffect: ld hl, wPlayerMonStatMods ld de, wPlayerMoveEffect ld a, [H_WHOSETURN] @@ -7646,13 +7646,13 @@ StatModifierUpEffect: ; 3f428 (f:7428) ld a, 999 % $100 ld [H_MULTIPLICAND + 2], a -UpdateStat: ; 3f4c3 (f:74c3) +UpdateStat: ld a, [H_PRODUCT + 2] ld [hli], a ld a, [H_PRODUCT + 3] ld [hl], a pop hl -UpdateStatDone: ; 3f4ca (f:74ca) +UpdateStatDone: ld b, c inc b call PrintStatText @@ -7703,15 +7703,15 @@ UpdateStatDone: ; 3f4ca (f:74ca) call QuarterSpeedDueToParalysis ; apply speed penalty to the player whose turn is not, if it's paralyzed jp HalveAttackDueToBurn ; apply attack penalty to the player whose turn is not, if it's burned -RestoreOriginalStatModifier: ; 3f520 (f:7520) +RestoreOriginalStatModifier: pop hl dec [hl] -PrintNothingHappenedText: ; 3f522 (f:7522) +PrintNothingHappenedText: ld hl, NothingHappenedText jp PrintText -MonsStatsRoseText: ; 3f528 (f:7528) +MonsStatsRoseText: TX_FAR _MonsStatsRoseText TX_ASM ld hl, GreatlyRoseText @@ -7726,15 +7726,15 @@ MonsStatsRoseText: ; 3f528 (f:7528) ld hl, RoseText ret -GreatlyRoseText: ; 3f542 (f:7542) +GreatlyRoseText: db $0a TX_FAR _GreatlyRoseText -RoseText: ; 3f547 (f:7547) +RoseText: TX_FAR _RoseText db "@" -StatModifierDownEffect: ; 3f54c (f:754c) +StatModifierDownEffect: ld hl, wEnemyMonStatMods ld de, wPlayerMoveEffect ld bc, wEnemyBattleStatus1 @@ -7864,14 +7864,14 @@ StatModifierDownEffect: ; 3f54c (f:754c) ld a, $1 ld [H_MULTIPLICAND + 2], a -UpdateLoweredStat: ; 3f624 (f:7624) +UpdateLoweredStat: ld a, [H_PRODUCT + 2] ld [hli], a ld a, [H_PRODUCT + 3] ld [hl], a pop de pop hl -UpdateLoweredStatDone: ; 3f62c (f:762c) +UpdateLoweredStatDone: ld b, c inc b push de @@ -7895,25 +7895,25 @@ UpdateLoweredStatDone: ; 3f62c (f:762c) call QuarterSpeedDueToParalysis jp HalveAttackDueToBurn -CantLowerAnymore_Pop: ; 3f64d (f:764d) +CantLowerAnymore_Pop: pop de pop hl inc [hl] -CantLowerAnymore: ; 3f650 (f:7650) +CantLowerAnymore: ld a, [de] cp ATTACK_DOWN_SIDE_EFFECT ret nc ld hl, NothingHappenedText jp PrintText -MoveMissed: ; 3f65a (f:765a) +MoveMissed: ld a, [de] cp $44 ret nc jp ConditionalPrintButItFailed -MonsStatsFellText: ; 3f661 (f:7661) +MonsStatsFellText: TX_FAR _MonsStatsFellText TX_ASM ld hl, FellText @@ -7930,15 +7930,15 @@ MonsStatsFellText: ; 3f661 (f:7661) ld hl, GreatlyFellText ret -GreatlyFellText: ; 3f67e (f:767e) +GreatlyFellText: db $0a TX_FAR _GreatlyFellText -FellText: ; 3f683 (f:7683) +FellText: TX_FAR _FellText db "@" -PrintStatText: ; 3f688 (f:7688) +PrintStatText: ld hl, StatsTextStrings ld c, "@" .asm_3f68d @@ -7954,7 +7954,7 @@ PrintStatText: ; 3f688 (f:7688) ld bc, $a jp CopyData -StatsTextStrings: ; 3f69f (f:769f) +StatsTextStrings: db "ATTACK@" db "DEFENSE@" db "SPEED@" @@ -7962,7 +7962,7 @@ StatsTextStrings: ; 3f69f (f:769f) db "ACCURACY@" db "EVADE@" -StatModifierRatios: ; 3f6cb (f:76cb) +StatModifierRatios: ; first byte is numerator, second byte is denominator db 25, 100 ; 0.25 db 28, 100 ; 0.28 @@ -7978,7 +7978,7 @@ StatModifierRatios: ; 3f6cb (f:76cb) db 35, 10 ; 3.50 db 4, 1 ; 4.00 -BideEffect: ; 3f6e5 (f:76e5) +BideEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerBideAccumulatedDamage ld bc, wPlayerNumAttacksLeft @@ -8005,7 +8005,7 @@ BideEffect: ; 3f6e5 (f:76e5) add XSTATITEM_ANIM jp PlayBattleAnimation2 -ThrashPetalDanceEffect: ; 3f717 (f:7717) +ThrashPetalDanceEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft ld a, [H_WHOSETURN] @@ -8024,7 +8024,7 @@ ThrashPetalDanceEffect: ; 3f717 (f:7717) add ANIM_B0 jp PlayBattleAnimation2 -SwitchAndTeleportEffect: ; 3f739 (f:7739) +SwitchAndTeleportEffect: ld a, [H_WHOSETURN] and a jr nz, .asm_3f791 @@ -8127,19 +8127,19 @@ SwitchAndTeleportEffect: ; 3f739 (f:7739) .asm_3f7ff jp PrintText -RanFromBattleText: ; 3f802 (f:7802) +RanFromBattleText: TX_FAR _RanFromBattleText db "@" -RanAwayScaredText: ; 3f807 (f:7807) +RanAwayScaredText: TX_FAR _RanAwayScaredText db "@" -WasBlownAwayText: ; 3f80c (f:780c) +WasBlownAwayText: TX_FAR _WasBlownAwayText db "@" -TwoToFiveAttacksEffect: ; 3f811 (f:7811) +TwoToFiveAttacksEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft ld bc, wPlayerNumHits @@ -8184,7 +8184,7 @@ TwoToFiveAttacksEffect: ; 3f811 (f:7811) ld [hl], a ; set Twineedle's effect to poison effect jr .saveNumberOfHits -FlinchSideEffect: ; 3f85b (f:785b) +FlinchSideEffect: call CheckTargetSubstitute ret nz ld hl, wEnemyBattleStatus1 @@ -8208,10 +8208,10 @@ FlinchSideEffect: ; 3f85b (f:785b) call ClearHyperBeam ret -OneHitKOEffect: ; 3f884 (f:7884) +OneHitKOEffect: jpab OneHitKOEffect_ -ChargeEffect: ; 3f88c (f:788c) +ChargeEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerMoveEffect ld a, [H_WHOSETURN] @@ -8245,7 +8245,7 @@ ChargeEffect: ; 3f88c (f:788c) ld hl, ChargeMoveEffectText jp PrintText -ChargeMoveEffectText: ; 3f8c8 (f:78c8) +ChargeMoveEffectText: TX_FAR _ChargeMoveEffectText TX_ASM ld a, [wChargeMoveNum] @@ -8269,31 +8269,31 @@ ChargeMoveEffectText: ; 3f8c8 (f:78c8) .asm_3f8f8 ret -MadeWhirlwindText: ; 3f8f9 (f:78f9) +MadeWhirlwindText: TX_FAR _MadeWhirlwindText db "@" -TookInSunlightText: ; 3f8fe (f:78fe) +TookInSunlightText: TX_FAR _TookInSunlightText db "@" -LoweredItsHeadText: ; 3f903 (f:7903) +LoweredItsHeadText: TX_FAR _LoweredItsHeadText db "@" -SkyAttackGlowingText: ; 3f908 (f:7908) +SkyAttackGlowingText: TX_FAR _SkyAttackGlowingText db "@" -FlewUpHighText: ; 3f90d (f:790d) +FlewUpHighText: TX_FAR _FlewUpHighText db "@" -DugAHoleText: ; 3f912 (f:7912) +DugAHoleText: TX_FAR _DugAHoleText db "@" -TrappingEffect: ; 3f917 (f:7917) +TrappingEffect: ld hl, wPlayerBattleStatus1 ld de, wPlayerNumAttacksLeft ld a, [H_WHOSETURN] @@ -8318,22 +8318,22 @@ TrappingEffect: ; 3f917 (f:7917) ld [de], a ret -MistEffect: ; 3f941 (f:7941) +MistEffect: jpab MistEffect_ -FocusEnergyEffect: ; 3f949 (f:7949) +FocusEnergyEffect: jpab FocusEnergyEffect_ -RecoilEffect: ; 3f951 (f:7951) +RecoilEffect: jpab RecoilEffect_ -ConfusionSideEffect: ; 3f959 (f:7959) +ConfusionSideEffect: call BattleRandom cp $19 ret nc jr ConfusionSideEffectSuccess -ConfusionEffect: ; 3f961 (f:7961) +ConfusionEffect: call CheckTargetSubstitute jr nz, ConfusionEffectFailed call MoveHitTest @@ -8341,7 +8341,7 @@ ConfusionEffect: ; 3f961 (f:7961) and a jr nz, ConfusionEffectFailed -ConfusionSideEffectSuccess: ; 3f96f (f:796f) +ConfusionSideEffectSuccess: ld a, [H_WHOSETURN] and a ld hl, wEnemyBattleStatus1 @@ -8367,24 +8367,24 @@ ConfusionSideEffectSuccess: ; 3f96f (f:796f) ld hl, BecameConfusedText jp PrintText -BecameConfusedText: ; 3f9a1 (f:79a1) +BecameConfusedText: TX_FAR _BecameConfusedText db "@" -ConfusionEffectFailed: ; 3f9a6 (f:79a6) +ConfusionEffectFailed: cp CONFUSION_SIDE_EFFECT ret z ld c, 50 call DelayFrames jp ConditionalPrintButItFailed -ParalyzeEffect: ; 3f9b1 (f:79b1) +ParalyzeEffect: jpab ParalyzeEffect_ -SubstituteEffect: ; 3f9b9 (f:79b9) +SubstituteEffect: jpab SubstituteEffect_ -HyperBeamEffect: ; 3f9c1 (f:79c1) +HyperBeamEffect: ld hl, wPlayerBattleStatus2 ld a, [H_WHOSETURN] and a @@ -8394,7 +8394,7 @@ HyperBeamEffect: ; 3f9c1 (f:79c1) set NeedsToRecharge, [hl] ; mon now needs to recharge ret -ClearHyperBeam: ; 3f9cf (f:79cf) +ClearHyperBeam: push hl ld hl, wEnemyBattleStatus2 ld a, [H_WHOSETURN] @@ -8406,7 +8406,7 @@ ClearHyperBeam: ; 3f9cf (f:79cf) pop hl ret -RageEffect: ; 3f9df (f:79df) +RageEffect: ld hl, wPlayerBattleStatus2 ld a, [H_WHOSETURN] and a @@ -8416,7 +8416,7 @@ RageEffect: ; 3f9df (f:79df) set UsingRage, [hl] ; mon is now in "rage" mode ret -MimicEffect: ; 3f9ed (f:79ed) +MimicEffect: ld c, 50 call DelayFrames call MoveHitTest @@ -8488,18 +8488,18 @@ MimicEffect: ; 3f9ed (f:79ed) .asm_3fa74 jp PrintButItFailedText_ -MimicLearnedMoveText: ; 3fa77 (f:7a77) +MimicLearnedMoveText: TX_FAR _MimicLearnedMoveText db "@" -LeechSeedEffect: ; 3fa7c (f:7a7c) +LeechSeedEffect: jpab LeechSeedEffect_ -SplashEffect: ; 3fa84 (f:7a84) +SplashEffect: call PlayCurrentMoveAnimation jp PrintNoEffectText -DisableEffect: ; 3fa8a (f:7a8a) +DisableEffect: call MoveHitTest ld a, [wMoveMissed] and a @@ -8582,74 +8582,74 @@ DisableEffect: ; 3fa8a (f:7a8a) .moveMissed jp PrintButItFailedText_ -MoveWasDisabledText: ; 3fb09 (f:7b09) +MoveWasDisabledText: TX_FAR _MoveWasDisabledText db "@" -PayDayEffect: ; 3fb0e (f:7b0e) +PayDayEffect: jpab PayDayEffect_ -ConversionEffect: ; 3fb16 (f:7b16) +ConversionEffect: jpab ConversionEffect_ -HazeEffect: ; 3fb1e (f:7b1e) +HazeEffect: jpab HazeEffect_ -HealEffect: ; 3fb26 (f:7b26) +HealEffect: jpab HealEffect_ -TransformEffect: ; 3fb2e (f:7b2e) +TransformEffect: jpab TransformEffect_ -ReflectLightScreenEffect: ; 3fb36 (f:7b36) +ReflectLightScreenEffect: jpab ReflectLightScreenEffect_ -NothingHappenedText: ; 3fb3e (f:7b3e) +NothingHappenedText: TX_FAR _NothingHappenedText db "@" -PrintNoEffectText: ; 3fb43 (f:7b43) +PrintNoEffectText: ld hl, NoEffectText jp PrintText -NoEffectText: ; 3fb49 (f:7b49) +NoEffectText: TX_FAR _NoEffectText db "@" -ConditionalPrintButItFailed: ; 3fb4e (f:7b4e) +ConditionalPrintButItFailed: ld a, [wMoveDidntMiss] and a ret nz ; return if the side effect failed, yet the attack was successful -PrintButItFailedText_: ; 3fb53 (f:7b53) +PrintButItFailedText_: ld hl, ButItFailedText jp PrintText -ButItFailedText: ; 3fb59 (f:7b59) +ButItFailedText: TX_FAR _ButItFailedText db "@" -PrintDidntAffectText: ; 3fb5e (f:7b5e) +PrintDidntAffectText: ld hl, DidntAffectText jp PrintText -DidntAffectText: ; 3fb64 (f:7b64) +DidntAffectText: TX_FAR _DidntAffectText db "@" -IsUnaffectedText: ; 3fb69 (f:7b69) +IsUnaffectedText: TX_FAR _IsUnaffectedText db "@" -PrintMayNotAttackText: ; 3fb6e (f:7b6e) +PrintMayNotAttackText: ld hl, ParalyzedMayNotAttackText jp PrintText -ParalyzedMayNotAttackText: ; 3fb74 (f:7b74) +ParalyzedMayNotAttackText: TX_FAR _ParalyzedMayNotAttackText db "@" -CheckTargetSubstitute: ; 3fb79 (f:7b79) +CheckTargetSubstitute: push hl ld hl, wEnemyBattleStatus2 ld a, [H_WHOSETURN] @@ -8661,7 +8661,7 @@ CheckTargetSubstitute: ; 3fb79 (f:7b79) pop hl ret -PlayCurrentMoveAnimation2: ; 3fb89 (f:7b89) +PlayCurrentMoveAnimation2: ; animation at MOVENUM will be played unless MOVENUM is 0 ; plays wAnimationType 3 or 6 ld a, [H_WHOSETURN] @@ -8673,7 +8673,7 @@ PlayCurrentMoveAnimation2: ; 3fb89 (f:7b89) and a ret z -PlayBattleAnimation2: ; 3fb96 (f:7b96) +PlayBattleAnimation2: ; play animation ID at a and animation type 6 or 3 ld [wAnimationID], a ld a, [H_WHOSETURN] @@ -8685,7 +8685,7 @@ PlayBattleAnimation2: ; 3fb96 (f:7b96) ld [wAnimationType], a jp PlayBattleAnimationGotID -PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8) +PlayCurrentMoveAnimation: ; animation at MOVENUM will be played unless MOVENUM is 0 ; resets wAnimationType xor a @@ -8699,11 +8699,11 @@ PlayCurrentMoveAnimation: ; 3fba8 (f:7ba8) and a ret z -PlayBattleAnimation: ; 3fbb9 (f:7bb9) +PlayBattleAnimation: ; play animation ID at a and predefined animation type ld [wAnimationID], a -PlayBattleAnimationGotID: ; 3fbbc (f:7bbc) +PlayBattleAnimationGotID: ; play animation at wAnimationID push hl push de diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index f1a0dd58..984af087 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -1,4 +1,4 @@ -DecrementPP: ; 68000 (1a:4000) +DecrementPP: ; after using a move, decrement pp in battle and (if not transformed?) in party ld a, [de] cp a, STRUGGLE diff --git a/engine/battle/display_effectiveness.asm b/engine/battle/display_effectiveness.asm index 17f0bd5b..85f2bc3e 100644 --- a/engine/battle/display_effectiveness.asm +++ b/engine/battle/display_effectiveness.asm @@ -1,4 +1,4 @@ -DisplayEffectiveness: ; 2fb7b (b:7b7b) +DisplayEffectiveness: ld a, [wDamageMultipliers] and a, $7F cp a, $0A @@ -9,10 +9,10 @@ DisplayEffectiveness: ; 2fb7b (b:7b7b) .done jp PrintText -SuperEffectiveText: ; 2fb8e (b:7b8e) +SuperEffectiveText: TX_FAR _SuperEffectiveText db "@" -NotVeryEffectiveText: ; 2fb93 (b:7b93) +NotVeryEffectiveText: TX_FAR _NotVeryEffectiveText db "@" diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 8cfd30af..d477ffdf 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -1,4 +1,4 @@ -DrawAllPokeballs: ; 3a849 (e:6849) +DrawAllPokeballs: call LoadPartyPokeballGfx call SetupOwnPartyPokeballs ld a, [wIsInBattle] @@ -6,17 +6,17 @@ DrawAllPokeballs: ; 3a849 (e:6849) ret z ; return if wild pokémon jp SetupEnemyPartyPokeballs -DrawEnemyPokeballs: ; 3a857 (e:6857) +DrawEnemyPokeballs: call LoadPartyPokeballGfx jp SetupEnemyPartyPokeballs -LoadPartyPokeballGfx: ; 3a85d (e:685d) +LoadPartyPokeballGfx: ld de, PokeballTileGraphics ld hl, vSprites + $310 lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10 jp CopyVideoData -SetupOwnPartyPokeballs: ; 3a869 (e:6869) +SetupOwnPartyPokeballs: call PlacePlayerHUDTiles ld hl, wPartyMon1 ld de, wPartyCount @@ -30,7 +30,7 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869) ld hl, wOAMBuffer jp WritePokeballOAMData -SetupEnemyPartyPokeballs: ; 3a887 (e:6887) +SetupEnemyPartyPokeballs: call PlaceEnemyHUDTiles ld hl, wEnemyMons ld de, wEnemyPartyCount @@ -66,7 +66,7 @@ SetupPokeballs: ; 0x3a8a6 jr nz, .monloop ret -PickPokeball: ; 3a8c2 (e:68c2) +PickPokeball: inc hl ld a, [hli] and a @@ -94,7 +94,7 @@ PickPokeball: ; 3a8c2 (e:68c2) add hl, bc ; next mon struct ret -WritePokeballOAMData: ; 3a8e1 (e:68e1) +WritePokeballOAMData: ld de, wBuffer ld c, PARTY_LENGTH .loop @@ -116,7 +116,7 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1) jr nz, .loop ret -PlacePlayerHUDTiles: ; 3a902 (e:6902) +PlacePlayerHUDTiles: ld hl, PlayerBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles ld bc, $3 @@ -125,13 +125,13 @@ PlacePlayerHUDTiles: ; 3a902 (e:6902) ld de, -1 jr PlaceHUDTiles -PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916) +PlayerBattleHUDGraphicsTiles: ; The tile numbers for specific parts of the battle display for the player's pokemon db $73 ; unused ($73 is hardcoded into the routine that uses these bytes) db $77 ; lower-right corner tile of the HUD db $6F ; lower-left triangle tile of the HUD -PlaceEnemyHUDTiles: ; 3a919 (e:6919) +PlaceEnemyHUDTiles: ld hl, EnemyBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles ld bc, $3 @@ -140,13 +140,13 @@ PlaceEnemyHUDTiles: ; 3a919 (e:6919) ld de, $1 jr PlaceHUDTiles -EnemyBattleHUDGraphicsTiles: ; 3a92d (e:692d) +EnemyBattleHUDGraphicsTiles: ; The tile numbers for specific parts of the battle display for the enemy db $73 ; unused ($73 is hardcoded in the routine that uses these bytes) db $74 ; lower-left corner tile of the HUD db $78 ; lower-right triangle tile of the HUD -PlaceHUDTiles: ; 3a930 (e:6930) +PlaceHUDTiles: ld [hl], $73 ld bc, SCREEN_WIDTH add hl, bc @@ -163,7 +163,7 @@ PlaceHUDTiles: ; 3a930 (e:6930) ld [hl], a ret -SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) +SetupPlayerAndEnemyPokeballs: call LoadPartyPokeballGfx ld hl, wPartyMons ld de, wPartyCount @@ -187,6 +187,6 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948) jp WritePokeballOAMData ; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon) -PokeballTileGraphics:: ; 3a97e (e:697e) +PokeballTileGraphics:: INCBIN "gfx/pokeball.2bpp" PokeballTileGraphicsEnd: diff --git a/engine/battle/end_of_battle.asm b/engine/battle/end_of_battle.asm index 34bc3119..2d6ab2e9 100755 --- a/engine/battle/end_of_battle.asm +++ b/engine/battle/end_of_battle.asm @@ -1,4 +1,4 @@ -EndOfBattle: ; 137aa (4:77aa) +EndOfBattle: ld a, [wLinkState] cp LINK_STATE_BATTLING jr nz, .notLinkBattle @@ -74,15 +74,15 @@ EndOfBattle: ; 137aa (4:77aa) ld [wDestinationWarpID], a ret -YouWinText: ; 13853 (4:7853) +YouWinText: db "YOU WIN@" -YouLoseText: ; 1385b (4:785b) +YouLoseText: db "YOU LOSE@" -DrawText: ; 13864 (4:7864) +DrawText: db " DRAW@" -PickUpPayDayMoneyText: ; 1386b (4:786b) +PickUpPayDayMoneyText: TX_FAR _PickUpPayDayMoneyText db "@" diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 0480bfcb..c1914806 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -1,4 +1,4 @@ -GainExperience: ; 5524f (15:524f) +GainExperience: ld a, [wLinkState] cp LINK_STATE_BATTLING ret z ; return if link battle @@ -291,7 +291,7 @@ GainExperience: ; 5524f (15:524f) predef_jump FlagActionPredef ; set the fought current enemy flag for the mon that is currently out ; divide enemy base stats, catch rate, and base exp by the number of mons gaining exp -DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c) +DivideExpDataByNumMonsGainingExp: ld a, [wPartyGainExpFlags] ld b, a xor a @@ -325,7 +325,7 @@ DivideExpDataByNumMonsGainingExp: ; 5546c (15:546c) ret ; multiplies exp by 1.5 -BoostExp: ; 5549f (15:549f) +BoostExp: ld a, [H_QUOTIENT + 2] ld b, a ld a, [H_QUOTIENT + 3] @@ -339,7 +339,7 @@ BoostExp: ; 5549f (15:549f) ld [H_QUOTIENT + 2], a ret -GainedText: ; 554b2 (15:54b2) +GainedText: TX_FAR _GainedText TX_ASM ld a, [wBoostExpByExpAll] @@ -353,20 +353,20 @@ GainedText: ; 554b2 (15:54b2) ld hl, BoostedText ret -WithExpAllText: ; 554cb (15:54cb) +WithExpAllText: TX_FAR _WithExpAllText TX_ASM ld hl, ExpPointsText ret -BoostedText: ; 554d4 (15:54d4) +BoostedText: TX_FAR _BoostedText -ExpPointsText: ; 554d8 (15:54d8) +ExpPointsText: TX_FAR _ExpPointsText db "@" -GrewLevelText: ; 554dd (15:54dd) +GrewLevelText: TX_FAR _GrewLevelText db $0b db "@" diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index 36492292..deed8e95 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -1,4 +1,4 @@ -GetTrainerName_: ; 13a58 (4:7a58) +GetTrainerName_: ld hl, wGrassRate ld a, [wLinkState] and a diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 6702589d..7adb20d8 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -1,4 +1,4 @@ -MarowakAnim: ; 708ca (1c:48ca) +MarowakAnim: ; animate the ghost being unveiled as a Marowak ld a, $e4 ld [rOBP1], a @@ -49,7 +49,7 @@ MarowakAnim: ; 708ca (1c:48ca) jp ClearSprites ; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM -CopyMonPicFromBGToSpriteVRAM: ; 7092a (1c:492a) +CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites ld bc, 7 * 7 diff --git a/engine/battle/init_battle_variables.asm b/engine/battle/init_battle_variables.asm index 9372a786..bdd5d8f4 100644 --- a/engine/battle/init_battle_variables.asm +++ b/engine/battle/init_battle_variables.asm @@ -1,4 +1,4 @@ -InitBattleVariables: ; 525af (14:65af) +InitBattleVariables: ld a, [hTilesetType] ld [wSavedTilesetType], a xor a diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index dfb2fe35..57e7f1bb 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -1,5 +1,5 @@ ; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names -DisplayLinkBattleVersusTextBox: ; 372d6 (d:72d6) +DisplayLinkBattleVersusTextBox: call LoadTextBoxTilePatterns coord hl, 3, 4 ld b, $7 diff --git a/engine/battle/moveEffects/conversion_effect.asm b/engine/battle/moveEffects/conversion_effect.asm index 8e895361..9c347876 100644 --- a/engine/battle/moveEffects/conversion_effect.asm +++ b/engine/battle/moveEffects/conversion_effect.asm @@ -1,4 +1,4 @@ -ConversionEffect_: ; 139a3 (4:79a3) +ConversionEffect_: ld hl, wEnemyMonType1 ld de, wBattleMonType1 ld a, [H_WHOSETURN] @@ -24,12 +24,12 @@ ConversionEffect_: ; 139a3 (4:79a3) ld hl, ConvertedTypeText jp PrintText -ConvertedTypeText: ; 139cd (4:79cd) +ConvertedTypeText: TX_FAR _ConvertedTypeText db "@" -PrintButItFailedText: ; 139d2 (4:79d2) +PrintButItFailedText: ld hl, PrintButItFailedText_ -CallBankF: ; 139d5 (4:79d5) +CallBankF: ld b, BANK(PrintButItFailedText_) jp Bankswitch diff --git a/engine/battle/moveEffects/drain_hp_effect.asm b/engine/battle/moveEffects/drain_hp_effect.asm index ffa75c13..e5f4681a 100644 --- a/engine/battle/moveEffects/drain_hp_effect.asm +++ b/engine/battle/moveEffects/drain_hp_effect.asm @@ -1,4 +1,4 @@ -DrainHPEffect_: ; 783f (1:783f) +DrainHPEffect_: ld hl, wDamage ld a, [hl] srl a ; divide damage by 2 @@ -95,10 +95,10 @@ DrainHPEffect_: ; 783f (1:783f) .printText jp PrintText -SuckedHealthText: ; 78dc (1:78dc) +SuckedHealthText: TX_FAR _SuckedHealthText db "@" -DreamWasEatenText: ; 78e1 (1:78e1) +DreamWasEatenText: TX_FAR _DreamWasEatenText db "@" diff --git a/engine/battle/moveEffects/focus_energy_effect.asm b/engine/battle/moveEffects/focus_energy_effect.asm index b1cd03f3..9ba0ade0 100644 --- a/engine/battle/moveEffects/focus_energy_effect.asm +++ b/engine/battle/moveEffects/focus_energy_effect.asm @@ -1,4 +1,4 @@ -FocusEnergyEffect_: ; 27f86 (9:7f86) +FocusEnergyEffect_: ld hl, wPlayerBattleStatus2 ld a, [H_WHOSETURN] and a @@ -16,7 +16,7 @@ FocusEnergyEffect_: ; 27f86 (9:7f86) call DelayFrames jpab PrintButItFailedText_ -GettingPumpedText: ; 27fb3 (9:7fb3) +GettingPumpedText: db $0a TX_FAR _GettingPumpedText db "@" diff --git a/engine/battle/moveEffects/haze_effect.asm b/engine/battle/moveEffects/haze_effect.asm index 8c759cce..bd20f231 100644 --- a/engine/battle/moveEffects/haze_effect.asm +++ b/engine/battle/moveEffects/haze_effect.asm @@ -1,4 +1,4 @@ -HazeEffect_: ; 139da (4:79da) +HazeEffect_: ld a, $7 ; store 7 on every stat mod ld hl, wPlayerMonAttackMod @@ -45,7 +45,7 @@ HazeEffect_: ; 139da (4:79da) ld hl, StatusChangesEliminatedText jp PrintText -CureVolatileStatuses: ; 13a37 (4:7a37) +CureVolatileStatuses: ; only cures statuses of the Pokemon not using Haze res Confused, [hl] inc hl ; BATTSTATUS2 @@ -58,7 +58,7 @@ CureVolatileStatuses: ; 13a37 (4:7a37) ld [hl], a ret -ResetStatMods: ; 13a43 (4:7a43) +ResetStatMods: ld b, $8 .loop ld [hli], a @@ -66,7 +66,7 @@ ResetStatMods: ; 13a43 (4:7a43) jr nz, .loop ret -ResetStats: ; 13a4a (4:7a4a) +ResetStats: ld b, $8 .loop ld a, [hli] @@ -76,6 +76,6 @@ ResetStats: ; 13a4a (4:7a4a) jr nz, .loop ret -StatusChangesEliminatedText: ; 13a53 (4:7a53) +StatusChangesEliminatedText: TX_FAR _StatusChangesEliminatedText db "@" diff --git a/engine/battle/moveEffects/heal_effect.asm b/engine/battle/moveEffects/heal_effect.asm index 4b8f83bd..b7d8283f 100644 --- a/engine/battle/moveEffects/heal_effect.asm +++ b/engine/battle/moveEffects/heal_effect.asm @@ -1,4 +1,4 @@ -HealEffect_: ; 3b9ec (e:79ec) +HealEffect_: ld a, [H_WHOSETURN] and a ld de, wBattleMonHP @@ -107,14 +107,14 @@ HealEffect_: ; 3b9ec (e:79ec) ld hl, PrintButItFailedText_ jp BankswitchEtoF -StartedSleepingEffect: ; 3baa2 (e:7aa2) +StartedSleepingEffect: TX_FAR _StartedSleepingEffect db "@" -FellAsleepBecameHealthyText: ; 3baa7 (e:7aa7) +FellAsleepBecameHealthyText: TX_FAR _FellAsleepBecameHealthyText db "@" -RegainedHealthText: ; 3baac (e:7aac) +RegainedHealthText: TX_FAR _RegainedHealthText db "@" diff --git a/engine/battle/moveEffects/leech_seed_effect.asm b/engine/battle/moveEffects/leech_seed_effect.asm index ea7ceb30..0f3a2666 100644 --- a/engine/battle/moveEffects/leech_seed_effect.asm +++ b/engine/battle/moveEffects/leech_seed_effect.asm @@ -1,4 +1,4 @@ -LeechSeedEffect_: ; 2bea9 (a:7ea9) +LeechSeedEffect_: callab MoveHitTest ld a, [wMoveMissed] and a @@ -31,10 +31,10 @@ LeechSeedEffect_: ; 2bea9 (a:7ea9) ld hl, EvadedAttackText jp PrintText -WasSeededText: ; 2bef2 (a:7ef2) +WasSeededText: TX_FAR _WasSeededText db "@" -EvadedAttackText: ; 2bef7 (a:7ef7) +EvadedAttackText: TX_FAR _EvadedAttackText db "@" diff --git a/engine/battle/moveEffects/mist_effect.asm b/engine/battle/moveEffects/mist_effect.asm index fcdb4b28..b92777de 100644 --- a/engine/battle/moveEffects/mist_effect.asm +++ b/engine/battle/moveEffects/mist_effect.asm @@ -1,4 +1,4 @@ -MistEffect_: ; 33f2b (c:7f2b) +MistEffect_: ld hl, wPlayerBattleStatus2 ld a, [H_WHOSETURN] and a @@ -14,6 +14,6 @@ MistEffect_: ; 33f2b (c:7f2b) .mistAlreadyInUse jpab PrintButItFailedText_ -ShroudedInMistText: ; 33f52 (c:7f52) +ShroudedInMistText: TX_FAR _ShroudedInMistText db "@" diff --git a/engine/battle/moveEffects/one_hit_ko_effect.asm b/engine/battle/moveEffects/one_hit_ko_effect.asm index efba0b79..827e2197 100644 --- a/engine/battle/moveEffects/one_hit_ko_effect.asm +++ b/engine/battle/moveEffects/one_hit_ko_effect.asm @@ -1,4 +1,4 @@ -OneHitKOEffect_: ; 33f57 (c:7f57) +OneHitKOEffect_: ld hl, wDamage xor a ld [hli], a diff --git a/engine/battle/moveEffects/paralyze_effect.asm b/engine/battle/moveEffects/paralyze_effect.asm index eac42a90..95979ae6 100644 --- a/engine/battle/moveEffects/paralyze_effect.asm +++ b/engine/battle/moveEffects/paralyze_effect.asm @@ -1,4 +1,4 @@ -ParalyzeEffect_: ; 52601 (14:6601) +ParalyzeEffect_: ld hl, wEnemyMonStatus ld de, wPlayerMoveType ld a, [H_WHOSETURN] diff --git a/engine/battle/moveEffects/pay_day_effect.asm b/engine/battle/moveEffects/pay_day_effect.asm index eb228615..e5daf014 100644 --- a/engine/battle/moveEffects/pay_day_effect.asm +++ b/engine/battle/moveEffects/pay_day_effect.asm @@ -1,4 +1,4 @@ -PayDayEffect_: ; 2feb8 (b:7eb8) +PayDayEffect_: xor a ld hl, wcd6d ld [hli], a @@ -40,6 +40,6 @@ PayDayEffect_: ; 2feb8 (b:7eb8) ld hl, CoinsScatteredText jp PrintText -CoinsScatteredText: ; 2ff04 (b:7f04) +CoinsScatteredText: TX_FAR _CoinsScatteredText db "@" diff --git a/engine/battle/moveEffects/recoil_effect.asm b/engine/battle/moveEffects/recoil_effect.asm index 43bf8d5f..7fc90c44 100644 --- a/engine/battle/moveEffects/recoil_effect.asm +++ b/engine/battle/moveEffects/recoil_effect.asm @@ -1,4 +1,4 @@ -RecoilEffect_: ; 1392c (4:792c) +RecoilEffect_: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveNum] @@ -65,6 +65,6 @@ RecoilEffect_: ; 1392c (4:792c) predef UpdateHPBar2 ld hl, HitWithRecoilText jp PrintText -HitWithRecoilText: ; 1399e (4:799e) +HitWithRecoilText: TX_FAR _HitWithRecoilText db "@" diff --git a/engine/battle/moveEffects/reflect_light_screen_effect.asm b/engine/battle/moveEffects/reflect_light_screen_effect.asm index 45f785a4..b45fbe20 100644 --- a/engine/battle/moveEffects/reflect_light_screen_effect.asm +++ b/engine/battle/moveEffects/reflect_light_screen_effect.asm @@ -1,4 +1,4 @@ -ReflectLightScreenEffect_: ; 3bb97 (e:7b97) +ReflectLightScreenEffect_: ld hl, wPlayerBattleStatus3 ld de, wPlayerMoveEffect ld a, [H_WHOSETURN] @@ -32,14 +32,14 @@ ReflectLightScreenEffect_: ; 3bb97 (e:7b97) ld hl, PrintButItFailedText_ jp BankswitchEtoF -LightScreenProtectedText: ; 3bbd7 (e:7bd7) +LightScreenProtectedText: TX_FAR _LightScreenProtectedText db "@" -ReflectGainedArmorText: ; 3bbdc (e:7bdc) +ReflectGainedArmorText: TX_FAR _ReflectGainedArmorText db "@" -BankswitchEtoF: ; 3bbe1 (e:7be1) +BankswitchEtoF: ld b, BANK(BattleCore) jp Bankswitch diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm index 7cac9f62..03314ebf 100644 --- a/engine/battle/moveEffects/substitute_effect.asm +++ b/engine/battle/moveEffects/substitute_effect.asm @@ -1,4 +1,4 @@ -SubstituteEffect_: ; 17dad (5:7dad) +SubstituteEffect_: ld c, 50 call DelayFrames ld hl, wBattleMonMaxHP @@ -64,14 +64,14 @@ SubstituteEffect_: ; 17dad (5:7dad) .printText jp PrintText -SubstituteText: ; 17e1d (5:7e1d) +SubstituteText: TX_FAR _SubstituteText db "@" -HasSubstituteText: ; 17e22 (5:7e22) +HasSubstituteText: TX_FAR _HasSubstituteText db "@" -TooWeakSubstituteText: ; 17e27 (5:7e27) +TooWeakSubstituteText: TX_FAR _TooWeakSubstituteText db "@" diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm index 097a0d3a..45f8c910 100644 --- a/engine/battle/moveEffects/transform_effect.asm +++ b/engine/battle/moveEffects/transform_effect.asm @@ -1,4 +1,4 @@ -TransformEffect_: ; 3bab1 (e:7ab1) +TransformEffect_: ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies ld bc, wEnemyBattleStatus3 @@ -143,6 +143,6 @@ TransformEffect_: ; 3bab1 (e:7ab1) ld hl, PrintButItFailedText_ jp BankswitchEtoF -TransformedText: ; 3bb92 (e:7b92) +TransformedText: TX_FAR _TransformedText db "@" diff --git a/engine/battle/print_type.asm b/engine/battle/print_type.asm index deca2426..f717f871 100644 --- a/engine/battle/print_type.asm +++ b/engine/battle/print_type.asm @@ -1,6 +1,6 @@ ; [wd0b5] = pokemon ID ; hl = dest addr -PrintMonType: ; 27d6b (9:7d6b) +PrintMonType: call GetPredefRegisters push hl call GetMonHeader @@ -19,25 +19,25 @@ PrintMonType: ; 27d6b (9:7d6b) ; a = type ; hl = dest addr -PrintType: ; 27d89 (9:7d89) +PrintType: push hl jr PrintType_ ; erase "TYPE2/" if the mon only has 1 type -EraseType2Text: ; 27d8c (9:7d8c) +EraseType2Text: ld a, " " ld bc, $13 add hl, bc ld bc, $6 jp FillMemory -PrintMoveType: ; 27d98 (9:7d98) +PrintMoveType: call GetPredefRegisters push hl ld a, [wPlayerMoveType] ; fall through -PrintType_: ; 27d9f (9:7d9f) +PrintType_: add a ld hl, TypeNames ld e, a diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm index 4a5657b2..3672d8dc 100755 --- a/engine/battle/read_trainer_party.asm +++ b/engine/battle/read_trainer_party.asm @@ -1,4 +1,4 @@ -ReadTrainer: ; 39c53 (e:5c53) +ReadTrainer: ; don't change any moves in a link battle ld a,[wLinkState] diff --git a/engine/battle/safari_zone.asm b/engine/battle/safari_zone.asm index 344e2309..1eb1a615 100755 --- a/engine/battle/safari_zone.asm +++ b/engine/battle/safari_zone.asm @@ -1,4 +1,4 @@ -PrintSafariZoneBattleText: ; 4277 (1:4277) +PrintSafariZoneBattleText: ld hl, wSafariBaitFactor ld a, [hl] and a @@ -27,10 +27,10 @@ PrintSafariZoneBattleText: ; 4277 (1:4277) pop hl jp PrintText -SafariZoneEatingText: ; 42a7 (1:42a7) +SafariZoneEatingText: TX_FAR _SafariZoneEatingText db "@" -SafariZoneAngryText: ; 42ac (1:42ac) +SafariZoneAngryText: TX_FAR _SafariZoneAngryText db "@" diff --git a/engine/battle/save_trainer_name.asm b/engine/battle/save_trainer_name.asm index ceba63bd..7e2c911c 100644 --- a/engine/battle/save_trainer_name.asm +++ b/engine/battle/save_trainer_name.asm @@ -1,4 +1,4 @@ -SaveTrainerName: ; 27e4a (9:7e4a) +SaveTrainerName: ld hl,TrainerNamePointers ld a,[wTrainerClass] dec a @@ -18,7 +18,7 @@ SaveTrainerName: ; 27e4a (9:7e4a) jr nz,.CopyCharacter ret -TrainerNamePointers: ; 27e64 (9:7e64) +TrainerNamePointers: ; what is the point of these? dw YoungsterName dw BugCatcherName @@ -68,45 +68,45 @@ TrainerNamePointers: ; 27e64 (9:7e64) dw wTrainerName dw wTrainerName -YoungsterName: ; 27ec2 (9:7ec2) +YoungsterName: db "YOUNGSTER@" -BugCatcherName: ; 27ecc (9:7ecc) +BugCatcherName: db "BUG CATCHER@" -LassName: ; 27ed8 (9:7ed8) +LassName: db "LASS@" -JrTrainerMName: ; 27edd (9:7edd) +JrTrainerMName: db "JR.TRAINER♂@" -JrTrainerFName: ; 27ee9 (9:7ee9) +JrTrainerFName: db "JR.TRAINER♀@" -PokemaniacName: ; 27ef5 (9:7ef5) +PokemaniacName: db "POKéMANIAC@" -SuperNerdName: ; 27f00 (9:7f00) +SuperNerdName: db "SUPER NERD@" -BurglarName: ; 27f0b (9:7f0b) +BurglarName: db "BURGLAR@" -EngineerName: ; 27f13 (9:7f13) +EngineerName: db "ENGINEER@" -JugglerXName: ; 27f1c (9:7f1c) +JugglerXName: db "JUGGLER@" -SwimmerName: ; 27f24 (9:7f24) +SwimmerName: db "SWIMMER@" -BeautyName: ; 27f2c (9:7f2c) +BeautyName: db "BEAUTY@" -RockerName: ; 27f33 (9:7f33) +RockerName: db "ROCKER@" -JugglerName: ; 27f3a (9:7f3a) +JugglerName: db "JUGGLER@" -BlackbeltName: ; 27f42 (9:7f42) +BlackbeltName: db "BLACKBELT@" -ProfOakName: ; 27f4c (9:7f4c) +ProfOakName: db "PROF.OAK@" -ChiefName: ; 27f55 (9:7f55) +ChiefName: db "CHIEF@" -ScientistName: ; 27f5b (9:7f5b) +ScientistName: db "SCIENTIST@" -RocketName: ; 27f65 (9:7f65) +RocketName: db "ROCKET@" -CooltrainerMName: ; 27f6c (9:7f6c) +CooltrainerMName: db "COOLTRAINER♂@" -CooltrainerFName: ; 27f79 (9:7f79) +CooltrainerFName: db "COOLTRAINER♀@" diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 6a8d43a9..98521528 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -1,7 +1,7 @@ ; scales both uncompressed sprite chunks by two in every dimension (creating 2x2 output pixels per input pixel) ; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored ; resulting in a 7*7 tile output sprite chunk -ScaleSpriteByTwo: ; 2fe40 (b:7e40) +ScaleSpriteByTwo: ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case @@ -10,7 +10,7 @@ ScaleSpriteByTwo: ; 2fe40 (b:7e40) ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case -ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55) +ScaleFirstThreeSpriteColumnsByTwo: ld b, $3 ; 3 tile columns .columnLoop ld c, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows @@ -39,7 +39,7 @@ ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55) jr nz, .columnLoop ret -ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d) +ScaleLastSpriteColumnByTwo: ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows ld [H_SPRITEINTERLACECOUNTER], a ld bc, -1 @@ -61,7 +61,7 @@ ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d) ; scales the given 4 bits in a (4x1 pixels) to 2 output bytes (8x2 pixels) ; hl: destination pointer ; bc: destination pointer offset (added after the two bytes have been written) -ScalePixelsByTwo: ; 2fe97 (b:7e97) +ScalePixelsByTwo: push hl and $f ld hl, DuplicateBitsTable @@ -78,7 +78,7 @@ ScalePixelsByTwo: ; 2fe97 (b:7e97) ret ; repeats each input bit twice -DuplicateBitsTable: ; 2fea8 (b:7ea8) +DuplicateBitsTable: db $00, $03, $0c, $0f db $30, $33, $3c, $3f db $c0, $c3, $cc, $cf diff --git a/engine/battle/scroll_draw_trainer_pic.asm b/engine/battle/scroll_draw_trainer_pic.asm index 5949208c..98893dcf 100644 --- a/engine/battle/scroll_draw_trainer_pic.asm +++ b/engine/battle/scroll_draw_trainer_pic.asm @@ -1,4 +1,4 @@ -_ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) +_ScrollTrainerPicAfterBattle: ; Load the enemy trainer's pic and scrolls it into ; the screen from the right. xor a @@ -32,7 +32,7 @@ _ScrollTrainerPicAfterBattle: ; 396d3 (e:56d3) jr .scrollLoop ; write one 7-tile column of the trainer pic to the tilemap -DrawTrainerPicColumn: ; 39707 (e:5707) +DrawTrainerPicColumn: push hl push de push bc diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index bab4c253..385cdd1b 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -1,6 +1,6 @@ ; creates a set of moves that may be used and returns its address in hl ; unused slots are filled with 0, all used slots may be chosen with equal probability -AIEnemyTrainerChooseMoves: ; 39719 (e:5719) +AIEnemyTrainerChooseMoves: ld a, $a ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end ld [hli], a ; move 1 @@ -103,14 +103,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) ld hl, wEnemyMonMoves ; use original move set ret -AIMoveChoiceModificationFunctionPointers: ; 397a3 (e:57a3) +AIMoveChoiceModificationFunctionPointers: dw AIMoveChoiceModification1 dw AIMoveChoiceModification2 dw AIMoveChoiceModification3 dw AIMoveChoiceModification4 ; unused, does nothing ; discourages moves that cause no damage but only a status ailment if player's mon already has one -AIMoveChoiceModification1: ; 397ab (e:57ab) +AIMoveChoiceModification1: ld a, [wBattleMonStatus] and a ret z ; return if no status ailment on player's mon @@ -155,7 +155,7 @@ StatusAilmentMoveEffects: ; 57e2 ; slightly encourage moves with specific effects. ; in particular, stat-modifying moves and other move effects ; that fall in-bewteen -AIMoveChoiceModification2: ; 397e7 (e:57e7) +AIMoveChoiceModification2: ld a, [wAILayer2Encouragement] cp $1 ret nz @@ -188,7 +188,7 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7) ; encourages moves that are effective against the player's mon (even if non-damaging). ; discourage damaging moves that are ineffective or not very effective against the player's mon, ; unless there's no damaging move that deals at least neutral damage -AIMoveChoiceModification3: ; 39817 (e:5817) +AIMoveChoiceModification3: ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset) ld de, wEnemyMonMoves ; enemy moves ld b, NUM_MOVES + 1 @@ -255,10 +255,10 @@ AIMoveChoiceModification3: ; 39817 (e:5817) jr z, .nextMove inc [hl] ; sligthly discourage this move jr .nextMove -AIMoveChoiceModification4: ; 39883 (e:5883) +AIMoveChoiceModification4: ret -ReadMove: ; 39884 (e:5884) +ReadMove: push hl push de push bc @@ -275,7 +275,7 @@ ReadMove: ; 39884 (e:5884) ; move choice modification methods that are applied for each trainer class ; 0 is sentinel value -TrainerClassMoveChoiceModifications: ; 3989b (e:589b) +TrainerClassMoveChoiceModifications: db 0 ; YOUNGSTER db 1,0 ; BUG CATCHER db 1,0 ; LASS @@ -336,7 +336,7 @@ INCLUDE "data/trainer_moves.asm" INCLUDE "data/trainer_parties.asm" -TrainerAI: ; 3a52e (e:652e) +TrainerAI: and a ld a,[wIsInBattle] dec a @@ -368,7 +368,7 @@ TrainerAI: ; 3a52e (e:652e) call Random jp [hl] -TrainerAIPointers: ; 3a55c (e:655c) +TrainerAIPointers: ; one entry per trainer class ; first byte, number of times (per Pokémon) it can occur ; next two bytes, pointer to AI subroutine for trainer class @@ -420,27 +420,27 @@ TrainerAIPointers: ; 3a55c (e:655c) dbw 2,AgathaAI ; agatha dbw 1,LanceAI ; lance -JugglerAI: ; 3a5e9 (e:65e9) +JugglerAI: cp $40 ret nc jp AISwitchIfEnoughMons -BlackbeltAI: ; 3a5ef (e:65ef) +BlackbeltAI: cp $20 ret nc jp AIUseXAttack -GiovanniAI: ; 3a5f5 (e:65f5) +GiovanniAI: cp $40 ret nc jp AIUseGuardSpec -CooltrainerMAI: ; 3a5fb (e:65fb) +CooltrainerMAI: cp $40 ret nc jp AIUseXAttack -CooltrainerFAI: ; 3a601 (e:6601) +CooltrainerFAI: cp $40 ld a,$A call AICheckIfHPBelowFraction @@ -450,24 +450,24 @@ CooltrainerFAI: ; 3a601 (e:6601) ret nc jp AISwitchIfEnoughMons -BrockAI: ; 3a614 (e:6614) +BrockAI: ; if his active monster has a status condition, use a full heal ld a,[wEnemyMonStatus] and a ret z jp AIUseFullHeal -MistyAI: ; 3a61c (e:661c) +MistyAI: cp $40 ret nc jp AIUseXDefend -LtSurgeAI: ; 3a622 (e:6622) +LtSurgeAI: cp $40 ret nc jp AIUseXSpeed -ErikaAI: ; 3a628 (e:6628) +ErikaAI: cp $80 ret nc ld a,$A @@ -475,17 +475,17 @@ ErikaAI: ; 3a628 (e:6628) ret nc jp AIUseSuperPotion -KogaAI: ; 3a634 (e:6634) +KogaAI: cp $40 ret nc jp AIUseXAttack -BlaineAI: ; 3a63a (e:663a) +BlaineAI: cp $40 ret nc jp AIUseSuperPotion -SabrinaAI: ; 3a640 (e:6640) +SabrinaAI: cp $40 ret nc ld a,$A @@ -493,7 +493,7 @@ SabrinaAI: ; 3a640 (e:6640) ret nc jp AIUseHyperPotion -Sony2AI: ; 3a64c (e:664c) +Sony2AI: cp $20 ret nc ld a,5 @@ -501,7 +501,7 @@ Sony2AI: ; 3a64c (e:664c) ret nc jp AIUsePotion -Sony3AI: ; 3a658 (e:6658) +Sony3AI: cp $20 ret nc ld a,5 @@ -509,7 +509,7 @@ Sony3AI: ; 3a658 (e:6658) ret nc jp AIUseFullRestore -LoreleiAI: ; 3a664 (e:6664) +LoreleiAI: cp $80 ret nc ld a,5 @@ -517,12 +517,12 @@ LoreleiAI: ; 3a664 (e:6664) ret nc jp AIUseSuperPotion -BrunoAI: ; 3a670 (e:6670) +BrunoAI: cp $40 ret nc jp AIUseXDefend -AgathaAI: ; 3a676 (e:6676) +AgathaAI: cp $14 jp c,AISwitchIfEnoughMons cp $80 @@ -532,7 +532,7 @@ AgathaAI: ; 3a676 (e:6676) ret nc jp AIUseSuperPotion -LanceAI: ; 3a687 (e:6687) +LanceAI: cp $80 ret nc ld a,5 @@ -540,23 +540,23 @@ LanceAI: ; 3a687 (e:6687) ret nc jp AIUseHyperPotion -GenericAI: ; 3a693 (e:6693) +GenericAI: and a ; clear carry ret ; end of individual trainer AI routines -DecrementAICount: ; 3a695 (e:6695) +DecrementAICount: ld hl,wAICount dec [hl] scf ret -AIPlayRestoringSFX: ; 3a69b (e:669b) +AIPlayRestoringSFX: ld a,SFX_HEAL_AILMENT jp PlaySoundWaitForCurrent -AIUseFullRestore: ; 3a6a0 (e:66a0) +AIUseFullRestore: call AICureStatus ld a,FULL_RESTORE ld [wAIItem],a @@ -580,25 +580,25 @@ AIUseFullRestore: ; 3a6a0 (e:66a0) ld [wEnemyMonHP],a jr AIPrintItemUseAndUpdateHPBar -AIUsePotion: ; 3a6ca (e:66ca) +AIUsePotion: ; enemy trainer heals his monster with a potion ld a,POTION ld b,20 jr AIRecoverHP -AIUseSuperPotion: ; 3a6d0 (e:66d0) +AIUseSuperPotion: ; enemy trainer heals his monster with a super potion ld a,SUPER_POTION ld b,50 jr AIRecoverHP -AIUseHyperPotion: ; 3a6d6 (e:66d6) +AIUseHyperPotion: ; enemy trainer heals his monster with a hyper potion ld a,HYPER_POTION ld b,200 ; fallthrough -AIRecoverHP: ; 3a6da (e:66da) +AIRecoverHP: ; heal b HP and print "trainer used $(a) on pokemon!" ld [wAIItem],a ld hl,wEnemyMonHP + 1 @@ -639,7 +639,7 @@ AIRecoverHP: ; 3a6da (e:66da) ld [wHPBarNewHP+1],a ; fallthrough -AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) +AIPrintItemUseAndUpdateHPBar: call AIPrintItemUse_ coord hl, 2, 2 xor a @@ -647,7 +647,7 @@ AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) predef UpdateHPBar2 jp DecrementAICount -AISwitchIfEnoughMons: ; 3a72a (e:672a) +AISwitchIfEnoughMons: ; enemy trainer switches if there are 3 or more unfainted mons in party ld a,[wEnemyPartyCount] ld c,a @@ -677,7 +677,7 @@ AISwitchIfEnoughMons: ; 3a72a (e:672a) and a ret -SwitchEnemyMon: ; 3a74b (e:674b) +SwitchEnemyMon: ; prepare to withdraw the active monster: copy hp, number, and status to roster @@ -708,17 +708,17 @@ SwitchEnemyMon: ; 3a74b (e:674b) scf ret -AIBattleWithdrawText: ; 3a781 (e:6781) +AIBattleWithdrawText: TX_FAR _AIBattleWithdrawText db "@" -AIUseFullHeal: ; 3a786 (e:6786) +AIUseFullHeal: call AIPlayRestoringSFX call AICureStatus ld a,FULL_HEAL jp AIPrintItemUse -AICureStatus: ; 3a791 (e:6791) +AICureStatus: ; cures the status of enemy's active pokemon ld a,[wEnemyMonPartyPos] ld hl,wEnemyMon1Status @@ -738,7 +738,7 @@ AIUseXAccuracy: ; 0x3a7a8 unused ld a,X_ACCURACY jp AIPrintItemUse -AIUseGuardSpec: ; 3a7b5 (e:67b5) +AIUseGuardSpec: call AIPlayRestoringSFX ld hl,wEnemyBattleStatus2 set 1,[hl] @@ -752,7 +752,7 @@ AIUseDireHit: ; 0x3a7c2 unused ld a,DIRE_HIT jp AIPrintItemUse -AICheckIfHPBelowFraction: ; 3a7cf (e:67cf) +AICheckIfHPBelowFraction: ; return carry if enemy trainer's current HP is below 1 / a of the maximum ld [H_DIVISOR],a ld hl,wEnemyMonMaxHP @@ -778,27 +778,27 @@ AICheckIfHPBelowFraction: ; 3a7cf (e:67cf) sub c ret -AIUseXAttack: ; 3a7f2 (e:67f2) +AIUseXAttack: ld b,$A ld a,X_ATTACK jr AIIncreaseStat -AIUseXDefend: ; 3a7f8 (e:67f8) +AIUseXDefend: ld b,$B ld a,X_DEFEND jr AIIncreaseStat -AIUseXSpeed: ; 3a7fe (e:67fe) +AIUseXSpeed: ld b,$C ld a,X_SPEED jr AIIncreaseStat -AIUseXSpecial: ; 3a804 (e:6804) +AIUseXSpecial: ld b,$D ld a,X_SPECIAL ; fallthrough -AIIncreaseStat: ; 3a808 (e:6808) +AIIncreaseStat: ld [wAIItem],a push bc call AIPrintItemUse_ @@ -820,12 +820,12 @@ AIIncreaseStat: ; 3a808 (e:6808) ld [hl],a jp DecrementAICount -AIPrintItemUse: ; 3a82c (e:682c) +AIPrintItemUse: ld [wAIItem],a call AIPrintItemUse_ jp DecrementAICount -AIPrintItemUse_: ; 3a835 (e:6835) +AIPrintItemUse_: ; print "x used [wAIItem] on z!" ld a,[wAIItem] ld [wd11e],a @@ -833,6 +833,6 @@ AIPrintItemUse_: ; 3a835 (e:6835) ld hl, AIBattleUseItemText jp PrintText -AIBattleUseItemText: ; 3a844 (e:6844) +AIBattleUseItemText: TX_FAR _AIBattleUseItemText db "@" diff --git a/engine/battle/trainer_pic_money_pointers.asm b/engine/battle/trainer_pic_money_pointers.asm index 3f684db3..37678e74 100755 --- a/engine/battle/trainer_pic_money_pointers.asm +++ b/engine/battle/trainer_pic_money_pointers.asm @@ -1,4 +1,4 @@ -TrainerPicAndMoneyPointers: ; 39914 (e:5914) +TrainerPicAndMoneyPointers: ; trainer pic pointers and base money. ; money received after battle = base money × level of highest-level enemy mon dw YoungsterPic diff --git a/engine/battle/unused_stats_functions.asm b/engine/battle/unused_stats_functions.asm index 23ddbc20..55f78fd3 100644 --- a/engine/battle/unused_stats_functions.asm +++ b/engine/battle/unused_stats_functions.asm @@ -1,5 +1,5 @@ ; does nothing since no stats are ever selected (barring glitches) -DoubleSelectedStats: ; 39680 (e:5680) +DoubleSelectedStats: ld a, [H_WHOSETURN] and a ld a, [wPlayerStatsToDouble] @@ -29,7 +29,7 @@ DoubleSelectedStats: ; 39680 (e:5680) ret ; does nothing since no stats are ever selected (barring glitches) -HalveSelectedStats: ; 396a7 (e:56a7) +HalveSelectedStats: ld a, [H_WHOSETURN] and a ld a, [wPlayerStatsToHalve] diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 044f7ea5..231c46e7 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -1,6 +1,6 @@ ; try to initiate a wild pokemon encounter ; returns success in Z -TryDoWildEncounter: ; 13870 (4:7870) +TryDoWildEncounter: ld a, [wNPCMovementScriptPointerTableNum] and a ret nz @@ -101,7 +101,7 @@ TryDoWildEncounter: ; 13870 (4:7870) xor a ret -WildMonEncounterSlotChances: ; 13918 (4:7918) +WildMonEncounterSlotChances: ; There are 10 slots for wild pokemon, and this is the table that defines how common each of ; those 10 slots is. A random number is generated and then the first byte of each pair in this ; table is compared against that random number. If the random number is less than or equal |