diff options
Diffstat (limited to 'engine/battle/animations.asm')
-rwxr-xr-x | engine/battle/animations.asm | 203 |
1 files changed, 102 insertions, 101 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 78301b2e..4e836510 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -163,7 +163,7 @@ DrawFrameBlock: PlayAnimation: xor a - ld [hROMBankTemp], a ; it looks like nothing reads this + ldh [hROMBankTemp], a ; it looks like nothing reads this ld [wSubAnimTransform], a ld a, [wAnimationID] ; get animation number dec a @@ -241,15 +241,15 @@ PlayAnimation: ld l, c ld h, b push hl - ld a, [rOBP0] + ldh a, [rOBP0] push af ld a, [wAnimPalette] - ld [rOBP0], a + ldh [rOBP0], a call LoadAnimationTileset call LoadSubanimation call PlaySubanimation pop af - ld [rOBP0], a + ldh [rOBP0], a .nextAnimationCommand pop hl jr .animationLoop @@ -308,7 +308,7 @@ LoadSubanimation: ; sets the transform to the subanimation type if it's the enemy's turn GetSubanimationTransform1: ld b, a - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld a, b ret nz @@ -319,7 +319,7 @@ GetSubanimationTransform1: ; 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: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld a, 2 << 5 ret z @@ -341,7 +341,7 @@ LoadAnimationTileset: ld e, a ld a, [hl] ld d, a ; de = address of tileset - ld hl, vSprites + $310 + ld hl, vSprites tile $31 ld b, BANK(AnimationTileset1) ; ROM bank ld a, [wTempTilesetNumTiles] ld c, a ; number of tiles @@ -373,6 +373,7 @@ ENDC IF DEF(_BLUE) INCBIN "gfx/slots/blue_slots_2.2bpp" ENDC +SlotMachineTiles2End: MoveAnimation: push hl @@ -421,11 +422,11 @@ MoveAnimation: ShareMoveAnimations: ; some moves just reuse animations from status conditions - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ret z - ; opponent’s turn + ; opponent's turn ld a, [wAnimationID] @@ -497,18 +498,18 @@ AnimationShakeScreenHorizontallySlow: push bc push bc .loop1 - ld a, [rWX] + ldh a, [rWX] inc a - ld [rWX], a + ldh [rWX], a ld c, 2 call DelayFrames dec b jr nz, .loop1 pop bc .loop2 - ld a, [rWX] + ldh a, [rWX] dec a - ld [rWX], a + ldh [rWX], a ld c, 2 call DelayFrames dec b @@ -534,16 +535,16 @@ SetAnimationPalette: ld b, $f0 .next ld a, b - ld [rOBP0], a + ldh [rOBP0], a ld a, $6c - ld [rOBP1], a + ldh [rOBP1], a ret .notSGB ld a, $e4 ld [wAnimPalette], a - ld [rOBP0], a + ldh [rOBP0], a ld a, $6c - ld [rOBP1], a + ldh [rOBP1], a ret PlaySubanimation: @@ -656,9 +657,9 @@ DoBallTossSpecialEffects: cp 3 ; is it a Master Ball or Ultra Ball? jr nc, .skipFlashingEffect .flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball - ld a, [rOBP0] + ldh a, [rOBP0] xor %00111100 ; complement colors 1 and 2 - ld [rOBP0], a + ldh [rOBP0], a .skipFlashingEffect ld a, [wSubAnimCounter] cp 11 ; is it the beginning of the subanimation? @@ -682,7 +683,7 @@ DoBallTossSpecialEffects: cp 1 ret nz .moveGhostMarowakLeft - coord hl, 17, 0 + hlcoord 17, 0 ld de, 20 lb bc, 7, 7 .loop @@ -695,7 +696,7 @@ DoBallTossSpecialEffects: dec b jr nz, .loop ld a, %00001000 - ld [rNR10], a ; Channel 1 sweep register + ldh [rNR10], a ; Channel 1 sweep register ret .isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame ld a, [wSubAnimCounter] @@ -781,7 +782,7 @@ DoExplodeSpecialEffects: cp 1 ; is it the end of the subanimation? jr nz, FlashScreenEveryFourFrameBlocks ; if it's the end of the subanimation, make the attacking pokemon disappear - coord hl, 1, 5 + hlcoord 1, 5 jp AnimationHideMonPic ; make pokemon disappear ; flashes the screen when subanimation counter is 1 modulo 4 @@ -882,9 +883,9 @@ TradeJumpPokeball: ld c, 5 call DelayFrames pop bc - ld a, [hSCX] ; background scroll X + ldh a, [hSCX] ; background scroll X sub 8 ; scroll to the left - ld [hSCX], a + ldh [hSCX], a pop de jr .loop @@ -920,16 +921,16 @@ AnimationDelay10: ; calls a function with the turn flipped from player to enemy or vice versa ; input - hl - address of function to call CallWithTurnFlipped: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] push af xor 1 - ld [hWhoseTurn], a + ldh [hWhoseTurn], a ld de, .returnAddress push de jp hl .returnAddress pop af - ld [hWhoseTurn], a + ldh [hWhoseTurn], a ret ; flashes the screen for an extended period (48 frames) @@ -947,7 +948,7 @@ AnimationFlashScreenLong: ld a, [hli] cp $01 ; is it the end of the palettes? jr z, .endOfPalettes - ld [rBGP], a + ldh [rBGP], a call FlashScreenLongDelay jr .innerLoop .endOfPalettes @@ -1006,18 +1007,18 @@ FlashScreenLongDelay: jp DelayFrames AnimationFlashScreen: - ld a, [rBGP] + ldh a, [rBGP] push af ; save initial palette ld a, %00011011 ; 0, 1, 2, 3 (inverted colors) - ld [rBGP], a + ldh [rBGP], a ld c, 2 call DelayFrames xor a ; white out background - ld [rBGP], a + ldh [rBGP], a ld c, 2 call DelayFrames pop af - ld [rBGP], a ; restore initial palette + ldh [rBGP], a ; restore initial palette ret AnimationDarkScreenPalette: @@ -1062,7 +1063,7 @@ SetAnimationBGPalette: jr z, .next ld a, c .next - ld [rBGP], a + ldh [rBGP], a ret ld b, $5 @@ -1133,14 +1134,14 @@ _AnimationWaterDroplets: AnimationSlideMonUp: ; Slides the mon's sprite upwards. ld c, 7 - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a - coord hl, 1, 6 - coord de, 1, 5 + hlcoord 1, 6 + decoord 1, 5 ld a, $30 jr z, .next - coord hl, 12, 1 - coord de, 12, 0 + hlcoord 12, 1 + decoord 12, 0 ld a, $ff .next ld [wSlideMonUpBottomRowLeftTile], a @@ -1201,11 +1202,11 @@ _AnimationSlideMonUp: jr nz, .slideLoop ; Fill in the bottom row of the mon pic with the next row's tile IDs. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a - coord hl, 1, 11 + hlcoord 1, 11 jr z, .next - coord hl, 12, 6 + hlcoord 12, 6 .next ld a, [wSlideMonUpBottomRowLeftTile] inc a @@ -1370,13 +1371,13 @@ AnimationShowEnemyMonPic: 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, [hWhoseTurn] + ldh a, [hWhoseTurn] and a - coord hl, 0, 5 - coord de, 2, 5 + hlcoord 0, 5 + decoord 2, 5 jr z, .next - coord hl, 11, 0 - coord de, 13, 0 + hlcoord 11, 0 + decoord 13, 0 .next xor a @@ -1418,11 +1419,11 @@ AnimationMoveMonHorizontally: ; Shifts the mon's sprite horizontally to a fixed location. Used by lots of ; animations like Tackle/Body Slam. call AnimationHideMonPic - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a - coord hl, 2, 5 + hlcoord 2, 5 jr z, .next - coord hl, 11, 0 + hlcoord 11, 0 .next xor a push hl @@ -1434,7 +1435,7 @@ AnimationMoveMonHorizontally: AnimationResetMonPosition: ; Resets the mon's sprites to be located at the normal coordinates. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld a, 5 * SCREEN_WIDTH + 2 jr z, .next @@ -1446,7 +1447,7 @@ AnimationResetMonPosition: AnimationSpiralBallsInward: ; Creates an effect that looks like energy balls spiralling into the ; player mon's sprite. Used in Focus Energy, for example. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn ld a, -40 @@ -1530,15 +1531,15 @@ AnimationSquishMonPic: ld c, 4 .loop push bc - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn - coord hl, 16, 0 - coord de, 14, 0 + hlcoord 16, 0 + decoord 14, 0 jr .next .playerTurn - coord hl, 5, 5 - coord de, 3, 5 + hlcoord 5, 5 + decoord 3, 5 .next push de xor a ; left @@ -1583,7 +1584,7 @@ _AnimationSquishMonPic: AnimationShootBallsUpward: ; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack ; animations. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn lb bc, 0, 16 * 8 @@ -1651,7 +1652,7 @@ _AnimationShootBallsUpward: AnimationShootManyBallsUpward: ; Shoots several pillars of "energy" balls upward. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld hl, UpwardBallsAnimXCoordinatesPlayerTurn ld a, $50 ; y coordinate for "energy" ball pillar @@ -1743,13 +1744,13 @@ AnimationSlideMonDownAndHide: _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, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn - coord hl, 12, 0 + hlcoord 12, 0 jr .next .playerTurn - coord hl, 0, 5 + hlcoord 0, 5 .next ld d, 8 ; d's value is unused .slideLoop ; iterates once for each time the pic slides by one tile @@ -1758,7 +1759,7 @@ _AnimationSlideMonOff: .rowLoop ; iterates once for each row ld c, 8 .tileLoop ; iterates once for each tile in the row - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn2 call .EnemyNextTile @@ -1821,7 +1822,7 @@ AnimationSlideMonHalfOff: jp Delay3 CopyTempPicToMonPic: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld hl, vBackPic ; player turn jr z, .next @@ -1837,9 +1838,9 @@ AnimationWavyScreen: call BattleAnimCopyTileMapToVRAM call Delay3 xor a - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a ld a, SCREEN_HEIGHT_PX - ld [hWY], a + ldh [hWY], a ld d, $80 ; terminator ld e, SCREEN_HEIGHT_PX - 1 ld c, $ff @@ -1848,7 +1849,7 @@ AnimationWavyScreen: push hl .innerLoop call WavyScreen_SetSCX - ld a, [rLY] + ldh a, [rLY] cp e ; is it the last visible line in the frame? jr nz, .innerLoop ; keep going if not pop hl @@ -1861,11 +1862,11 @@ AnimationWavyScreen: dec c jr nz, .loop xor a - ld [hWY], a + ldh [hWY], a call SaveScreenTilesToBuffer2 call ClearScreen ld a, 1 - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a call Delay3 call LoadScreenTilesFromBuffer2 ld hl, vBGMap1 @@ -1873,11 +1874,11 @@ AnimationWavyScreen: ret WavyScreen_SetSCX: - ld a, [rSTAT] + ldh a, [rSTAT] and $3 ; is it H-blank? jr nz, WavyScreen_SetSCX ; wait until it's H-blank ld a, [hl] - ld [rSCX], a + ldh [rSCX], a inc hl ld a, [hl] cp d ; have we reached the end? @@ -1898,7 +1899,7 @@ AnimationSubstitute: xor a ld bc, $310 call FillMemory - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn ld hl, SlowbroSprite ; facing down sprite @@ -1937,7 +1938,7 @@ CopySlowbroSpriteData: jp FarCopyData2 HideSubstituteShowMonAnim: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld hl, wPlayerMonMinimized ld a, [wPlayerBattleStatus2] @@ -1987,7 +1988,7 @@ AnimationTransformMon: ld [wChangeMonPicEnemyTurnSpecies], a ChangeMonPic: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn ld a, [wChangeMonPicEnemyTurnSpecies] @@ -1996,7 +1997,7 @@ ChangeMonPic: xor a ld [wSpriteFlipped], a call GetMonHeader - coord hl, 12, 0 + hlcoord 12, 0 call LoadFrontSpriteByMonIndex jr .done .playerTurn @@ -2020,11 +2021,11 @@ ChangeMonPic: AnimationHideEnemyMonPic: ; Hides the enemy mon's sprite xor a - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a ld hl, AnimationHideMonPic call CallWithTurnFlipped ld a, $1 - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a jp Delay3 InitMultipleObjectsOAM: @@ -2050,7 +2051,7 @@ InitMultipleObjectsOAM: AnimationHideMonPic: ; Hides the mon's sprite. - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr z, .playerTurn ld a, 12 @@ -2064,7 +2065,7 @@ ClearMonPicFromTileMap: push bc ld e, a ld d, 0 - coord hl, 0, 0 + hlcoord 0, 0 add hl, de lb bc, 7, 7 call ClearScreenArea @@ -2078,7 +2079,7 @@ ClearMonPicFromTileMap: ; in order to show only a portion of the mon sprite. GetMonSpriteTileMapPointerFromRowCount: push de - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr nz, .enemyTurn ld a, 20 * 5 + 1 @@ -2086,7 +2087,7 @@ GetMonSpriteTileMapPointerFromRowCount: .enemyTurn ld a, 12 .next - coord hl, 0, 0 + hlcoord 0, 0 ld e, a ld d, 0 add hl, de @@ -2166,7 +2167,7 @@ GetMoveSound: ld b, a call IsCryMove jr nc, .NotCryMove - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a jr nz, .next ld a, [wBattleMonSpecies] ; get number of current monster @@ -2211,14 +2212,14 @@ IsCryMove: INCLUDE "data/moves/sfx.asm" CopyPicTiles: - ld a, [hWhoseTurn] + ldh a, [hWhoseTurn] and a ld a, $31 ; base tile ID of player mon sprite jr z, .next ; enemy turn xor a ; base tile ID of enemy mon sprite .next - ld [hBaseTileID], a + ldh [hBaseTileID], a jr CopyTileIDs_NoBGTransfer ; copy the tiles used when a mon is being sent out of or into a pokeball @@ -2235,7 +2236,7 @@ CopyDownscaledMonTiles: CopyTileIDs_NoBGTransfer: xor a - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a ; fall through ; b = number of rows @@ -2245,7 +2246,7 @@ CopyTileIDs: .rowLoop push bc push hl - ld a, [hBaseTileID] + ldh a, [hBaseTileID] ld b, a .columnLoop ld a, [de] @@ -2261,7 +2262,7 @@ CopyTileIDs: dec b jr nz, .rowLoop ld a, $1 - ld [hAutoBGTransferEnabled], a + ldh [hAutoBGTransferEnabled], a pop hl ret @@ -2361,16 +2362,16 @@ Unknown_79c50: AnimationLeavesFalling: ; Makes leaves float down from the top of the screen. This is used ; in Razor Leaf's animation. - ld a, [rOBP0] + ldh a, [rOBP0] push af ld a, [wAnimPalette] - ld [rOBP0], a + ldh [rOBP0], a ld d, $37 ; leaf tile ld a, 3 ; number of leaves ld [wNumFallingObjects], a call AnimationFallingObjects pop af - ld [rOBP0], a + ldh [rOBP0], a ret AnimationPetalsFalling: @@ -2529,7 +2530,7 @@ AnimationShakeEnemyHUD: call CopyVideoData xor a - ld [hSCX], a + ldh [hSCX], a ; Copy wTileMap to BG map 0. The regular BG (not the window) is set to use ; map 0 and can be scrolled with SCX, which allows a shaking effect. @@ -2539,7 +2540,7 @@ AnimationShakeEnemyHUD: ; Now that the regular BG is showing the same thing the window was, move the ; window off the screen so that we can modify its contents below. ld a, SCREEN_HEIGHT_PX - ld [hWY], a + ldh [hWY], a ; Copy wTileMap to VRAM such that the row below the enemy HUD (in wTileMap) is ; lined up with row 0 of the window. @@ -2551,7 +2552,7 @@ AnimationShakeEnemyHUD: ; covers everything below the enemy HD with a copy that looks just like what ; was there before. ld a, 7 * 8 - ld [hWY], a + ldh [hWY], a ; Write OAM entries so that the copy of the back pic from the top of this ; function shows up on screen. We need this because the back pic's Y coordinates @@ -2576,11 +2577,11 @@ AnimationShakeEnemyHUD: call AnimationShowMonPic call ClearSprites ld a, SCREEN_HEIGHT_PX - ld [hWY], a + ldh [hWY], a ld hl, vBGMap1 call BattleAnimCopyTileMapToVRAM xor a - ld [hWY], a + ldh [hWY], a call SaveScreenTilesToBuffer1 ld hl, vBGMap0 call BattleAnimCopyTileMapToVRAM @@ -2595,7 +2596,7 @@ AnimationShakeEnemyHUD: CopyTileIDsFromList: call GetPredefRegisters ld a, c - ld [hBaseTileID], a + ldh [hBaseTileID], a ld a, b push hl call GetTileIDList @@ -2603,30 +2604,30 @@ CopyTileIDsFromList: jp CopyTileIDs ShakeEnemyHUD_ShakeBG: - ld a, [hSCX] + ldh a, [hSCX] ld [wTempSCX], a .loop ld a, [wTempSCX] add d - ld [hSCX], a + ldh [hSCX], a ld c, 2 call DelayFrames ld a, [wTempSCX] sub d - ld [hSCX], a + ldh [hSCX], a ld c, 2 call DelayFrames dec e jr nz, .loop ld a, [wTempSCX] - ld [hSCX], a + ldh [hSCX], a ret BattleAnimCopyTileMapToVRAM: ld a, h - ld [hAutoBGTransferDest + 1], a + ldh [hAutoBGTransferDest + 1], a ld a, l - ld [hAutoBGTransferDest], a + ldh [hAutoBGTransferDest], a jp Delay3 TossBallAnimation: |