diff options
Diffstat (limited to 'engine/battle_anims/functions.asm')
-rw-r--r-- | engine/battle_anims/functions.asm | 1375 |
1 files changed, 766 insertions, 609 deletions
diff --git a/engine/battle_anims/functions.asm b/engine/battle_anims/functions.asm index dab616788..8ea3ef99a 100644 --- a/engine/battle_anims/functions.asm +++ b/engine/battle_anims/functions.asm @@ -13,86 +13,86 @@ DoBattleAnimFrame: .Jumptable: ; entries correspond to BATTLEANIMFUNC_* constants - dw BattleAnimFunction_Null ; 00 - dw BattleAnimFunction_01 ; 01 - dw BattleAnimFunction_02 ; 02 - dw BattleAnimFunction_03 ; 03 - dw BattleAnimFunction_04 ; 04 - dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05 - dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06 - dw BattleAnimFunction_07 ; 07 - dw BattleAnimFunction_08 ; 08 - dw BattleAnimFunction_09 ; 09 - dw BattleAnimFunction_0A ; 0a - dw BattleAnimFunction_RazorLeaf ; 0b - dw BattleAnimFunction_0C ; 0c - dw BattleAnimFunction_0D ; 0d - dw BattleAnimFunction_0E ; 0e - dw BattleAnimFunction_0F ; 0f - dw BattleAnimFunction_10 ; 10 - dw BattleAnimFunction_11 ; 11 - dw BattleAnimFunction_PokeBall ; 12 - dw BattleAnimFunction_PokeBallBlocked ; 13 - dw BattleAnimFunction_14 ; 14 - dw BattleAnimFunction_15 ; 15 - dw BattleAnimFunction_16 ; 16 - dw BattleAnimFunction_17 ; 17 - dw BattleAnimFunction_18 ; 18 - dw BattleAnimFunction_19 ; 19 - dw BattleAnimFunction_1A ; 1a - dw BattleAnimFunction_1B ; 1b - dw BattleAnimFunction_1C ; 1c - dw BattleAnimFunction_1D ; 1d - dw BattleAnimFunction_1E ; 1e - dw BattleAnimFunction_1F ; 1f - dw BattleAnimFunction_LeechSeed ; 20 - dw BattleAnimFunction_21 ; 21 - dw BattleAnimFunction_22 ; 22 - dw BattleAnimFunction_23 ; 23 - dw BattleAnimFunction_24 ; 24 - dw BattleAnimFunction_25 ; 25 - dw BattleAnimFunction_26 ; 26 - dw BattleAnimFunction_27 ; 27 - dw BattleAnimFunction_28 ; 28 - dw BattleAnimFunction_SpiralDescent ; 29 - dw BattleAnimFunction_PoisonGas ; 2a - dw BattleAnimFunction_Horn ; 2b - dw BattleAnimFunction_2C ; 2c - dw BattleAnimFunction_2D ; 2d - dw BattleAnimFunction_2E ; 2e - dw BattleAnimFunction_2F ; 2f - dw BattleAnimFunction_30 ; 30 - dw BattleAnimFunction_31 ; 31 - dw BattleAnimFunction_32 ; 32 - dw BattleAnimFunction_33 ; 33 - dw BattleAnimFunction_34 ; 34 - dw BattleAnimFunction_35 ; 35 - dw BattleAnimFunction_36 ; 36 - dw BattleAnimFunction_37 ; 37 - dw BattleAnimFunction_38 ; 38 - dw BattleAnimFunction_39 ; 39 - dw BattleAnimFunction_3A ; 3a - dw BattleAnimFunction_3B ; 3b - dw BattleAnimFunction_3C ; 3c - dw BattleAnimFunction_3D ; 3d - dw BattleAnimFunction_3E ; 3e - dw BattleAnimFunction_3F ; 3f - dw BattleAnimFunction_40 ; 40 - dw BattleAnimFunction_41 ; 41 - dw BattleAnimFunction_42 ; 42 - dw BattleAnimFunction_43 ; 43 - dw BattleAnimFunction_44 ; 44 - dw BattleAnimFunction_45 ; 45 - dw BattleAnimFunction_46 ; 46 - dw BattleAnimFunction_47 ; 47 - dw BattleAnimFunction_48 ; 48 - dw BattleAnimFunction_49 ; 49 - dw BattleAnimFunction_4A ; 4a - dw BattleAnimFunction_4B ; 4b - dw BattleAnimFunction_4C ; 4c - dw BattleAnimFunction_4D ; 4d - dw BattleAnimFunction_4E ; 4e - dw BattleAnimFunction_4F ; 4f + dw BattleAnimFunction_Null + dw BattleAnimFunction_MoveFromUserToTarget + dw BattleAnimFunction_MoveFromUserToTargetAndDisappear + dw BattleAnimFunction_MoveInCircle + dw BattleAnimFunction_MoveWaveToTarget + dw BattleAnimFunction_ThrowFromUserToTarget + dw BattleAnimFunction_ThrowFromUserToTargetAndDisappear + dw BattleAnimFunction_Drop + dw BattleAnimFunction_MoveFromUserToTargetSpinAround + dw BattleAnimFunction_Shake + dw BattleAnimFunction_FireBlast + dw BattleAnimFunction_RazorLeaf + dw BattleAnimFunction_Bubble + dw BattleAnimFunction_Surf + dw BattleAnimFunction_Sing + dw BattleAnimFunction_WaterGun + dw BattleAnimFunction_Ember + dw BattleAnimFunction_Powder + dw BattleAnimFunction_PokeBall + dw BattleAnimFunction_PokeBallBlocked + dw BattleAnimFunction_Recover + dw BattleAnimFunction_ThunderWave + dw BattleAnimFunction_Clamp_Encore + dw BattleAnimFunction_Bite + dw BattleAnimFunction_SolarBeam + dw BattleAnimFunction_Gust + dw BattleAnimFunction_RazorWind + dw BattleAnimFunction_Kick + dw BattleAnimFunction_Absorb + dw BattleAnimFunction_Egg + dw BattleAnimFunction_MoveUp + dw BattleAnimFunction_Wrap + dw BattleAnimFunction_LeechSeed + dw BattleAnimFunction_Sound + dw BattleAnimFunction_ConfuseRay + dw BattleAnimFunction_Dizzy + dw BattleAnimFunction_Amnesia + dw BattleAnimFunction_FloatUp + dw BattleAnimFunction_Dig + dw BattleAnimFunction_String + dw BattleAnimFunction_Paralyzed + dw BattleAnimFunction_SpiralDescent + dw BattleAnimFunction_PoisonGas + dw BattleAnimFunction_Horn + dw BattleAnimFunction_Needle + dw BattleAnimFunction_PetalDance + dw BattleAnimFunction_ThiefPayday + dw BattleAnimFunction_AbsorbCircle + dw BattleAnimFunction_Bonemerang + dw BattleAnimFunction_Shiny + dw BattleAnimFunction_SkyAttack + dw BattleAnimFunction_GrowthSwordsDance + dw BattleAnimFunction_SmokeFlameWheel + dw BattleAnimFunction_PresentSmokescreen + dw BattleAnimFunction_StrengthSeismicToss + dw BattleAnimFunction_SpeedLine + dw BattleAnimFunction_Sludge + dw BattleAnimFunction_MetronomeHand + dw BattleAnimFunction_MetronomeSparkleSketch + dw BattleAnimFunction_Agility + dw BattleAnimFunction_SacredFire + dw BattleAnimFunction_SafeguardProtect + dw BattleAnimFunction_LockOnMindReader + dw BattleAnimFunction_Spikes + dw BattleAnimFunction_HealBellNotes + dw BattleAnimFunction_BatonPass + dw BattleAnimFunction_Conversion + dw BattleAnimFunction_EncoreBellyDrum + dw BattleAnimFunction_SwaggerMorningSun + dw BattleAnimFunction_HiddenPower + dw BattleAnimFunction_Curse + dw BattleAnimFunction_PerishSong + dw BattleAnimFunction_RapidSpin + dw BattleAnimFunction_BetaPursuit + dw BattleAnimFunction_RainSandstorm + dw BattleAnimFunction_AnimObjB0 + dw BattleAnimFunction_PsychUp + dw BattleAnimFunction_AncientPower + dw BattleAnimFunction_RockSmash + dw BattleAnimFunction_Cotton BattleAnimFunction_Null: call BattleAnim_AnonJumptable @@ -104,13 +104,13 @@ BattleAnimFunction_Null: .zero ret -BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: - call BattleAnimFunction_ThrowFromPlayerToEnemy +BattleAnimFunction_ThrowFromUserToTargetAndDisappear: + call BattleAnimFunction_ThrowFromUserToTarget ret c call DeinitBattleAnimation ret -BattleAnimFunction_ThrowFromPlayerToEnemy: +BattleAnimFunction_ThrowFromUserToTarget: ; If x coord at $88 or beyond, abort. ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc @@ -142,16 +142,17 @@ BattleAnimFunction_ThrowFromPlayerToEnemy: scf ret -BattleAnimFunction_04: +BattleAnimFunction_MoveWaveToTarget: +; Wave motion from one mon to another. Obj is cleared when it reaches x coord $88. Examples: Shadow Ball, Dragon Rage ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $88 - jr c, .asm_cd0b3 + jr c, .move call DeinitBattleAnimation ret -.asm_cd0b3 +.move add $2 ld [hl], a ld hl, BATTLEANIMSTRUCT_YCOORD @@ -183,7 +184,9 @@ BattleAnimFunction_04: ld [hl], a ret -BattleAnimFunction_03: +BattleAnimFunction_MoveInCircle: +; Slow circular motion. Examples: Thundershock, Flamethrower +; Obj Param: Distance from center (masked with $7F). Bit 7 causes object to start on other side of the circle call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -194,9 +197,9 @@ BattleAnimFunction_03: add hl, bc bit 7, [hl] ld a, $0 - jr z, .asm_cd0f9 + jr z, .got_starting_position ld a, $20 -.asm_cd0f9 +.got_starting_position ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], a @@ -229,7 +232,8 @@ BattleAnimFunction_03: inc [hl] ret -BattleAnimFunction_01: +BattleAnimFunction_MoveFromUserToTarget: +; Moves object diagonally at a ~30° angle towards opponent and stops when it reaches x coord $84. Obj Param changes the speed call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -247,22 +251,23 @@ BattleAnimFunction_01: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - call Functionce70a + call BattleAnim_StepToTarget ret -BattleAnimFunction_02: +BattleAnimFunction_MoveFromUserToTargetAndDisappear: +; Same as BattleAnimFunction_01 but objs are cleared when they reach x coord $84 ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $84 - jr nc, .asm_cd158 + jr nc, .done ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - call Functionce70a + call BattleAnim_StepToTarget ret -.asm_cd158 +.done call DeinitBattleAnimation ret @@ -287,7 +292,7 @@ BattleAnimFunction_PokeBall: ret .one - call BattleAnimFunction_ThrowFromPlayerToEnemy + call BattleAnimFunction_ThrowFromUserToTarget ret c ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -400,7 +405,7 @@ BattleAnimFunction_PokeBallBlocked: ld a, [hl] cp $70 jr nc, .next - call BattleAnimFunction_ThrowFromPlayerToEnemy + call BattleAnimFunction_ThrowFromUserToTarget ret .next @@ -451,7 +456,7 @@ GetBallAnimPal: INCLUDE "data/battle_anims/ball_colors.asm" -BattleAnimFunction_10: +BattleAnimFunction_Ember: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -479,7 +484,7 @@ BattleAnimFunction_10: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - call Functionce70a + call BattleAnim_StepToTarget ret .two @@ -493,7 +498,8 @@ BattleAnimFunction_10: .four ret -BattleAnimFunction_07: +BattleAnimFunction_Drop: +; Drops obj. The Obj Param dictates how fast it is (lower value is faster) and how long it stays bouncing (lower value is longer). Example: Rock Slide call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -540,7 +546,8 @@ BattleAnimFunction_07: call DeinitBattleAnimation ret -BattleAnimFunction_08: +BattleAnimFunction_MoveFromUserToTargetSpinAround: +; Object moves from user to target target and spins around it once. Example: Fire Spin, Swift call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -652,7 +659,9 @@ BattleAnimFunction_08: jr nz, .loop ret -BattleAnimFunction_09: +BattleAnimFunction_Shake: +; Object switches position side to side. Obj Param defines how far to move it. Example: Dynamic Punch +; Some objects use this function with a Param of 0 call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -700,7 +709,7 @@ BattleAnimFunction_09: call DeinitBattleAnimation ret -BattleAnimFunction_0A: +BattleAnimFunction_FireBlast: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -769,27 +778,32 @@ BattleAnimFunction_0A: call DeinitBattleAnimation ret -.one +.one + ; Flame that moves upward ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc dec [hl] ret .four + ; Flame that moves down and left ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc inc [hl] .two + ; Flame that moves left ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc dec [hl] ret .five + ; Flame that moves down and right ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc inc [hl] .three + ; Flame that moves right ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc inc [hl] @@ -940,10 +954,11 @@ BattleAnimFunction_RazorLeaf: cp $c0 ret nc ld a, $8 - call Functionce70a + call BattleAnim_StepToTarget ret Functioncd557: +; Affects sine movement based on bit 7 of Obj Param ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -981,7 +996,11 @@ Functioncd557: ld de, -$100 ret -BattleAnimFunction_4E: +BattleAnimFunction_RockSmash: +; Object moves at an arc +; Obj Param: Bit 7 makes arc flip horizontally +; Bit 6 defines offset from base frameset FRAMESET_19 +; Rest defines arc radius call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -993,7 +1012,7 @@ BattleAnimFunction_4E: and $40 rlca rlca - add $19 + add BATTLEANIMFRAMESET_19 ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc ld [hl], a @@ -1043,7 +1062,7 @@ BattleAnimFunction_4E: ld [hl], e ret -BattleAnimFunction_0C: +BattleAnimFunction_Bubble: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -1064,7 +1083,7 @@ BattleAnimFunction_0C: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - call Functionce70a + call BattleAnim_StepToTarget ret .next @@ -1127,7 +1146,7 @@ BattleAnimFunction_0C: ld [hl], d ret -BattleAnimFunction_0D: +BattleAnimFunction_Surf: call BattleAnim_AnonJumptable .anon_dw dw .zero @@ -1153,13 +1172,13 @@ BattleAnimFunction_0D: add hl, bc ld a, [hl] cp e - jr nc, .asm_cd69b + jr nc, .move call BattleAnim_IncAnonJumptableIndex xor a ldh [hLYOverrideStart], a ret -.asm_cd69b +.move dec a ld [hl], a ld hl, BATTLEANIMSTRUCT_VAR1 @@ -1194,7 +1213,7 @@ BattleAnimFunction_0D: add hl, bc ld a, [hl] cp $70 - jr c, asm_cd6da + jr c, .move_down xor a ldh [hLCDCPointer], a ldh [hLYOverrideStart], a @@ -1203,7 +1222,7 @@ BattleAnimFunction_0D: call DeinitBattleAnimation ret -asm_cd6da: +.move_down inc a inc a ld [hl], a @@ -1212,13 +1231,13 @@ asm_cd6da: ldh [hLYOverrideStart], a ret -BattleAnimFunction_0E: +BattleAnimFunction_Sing: call BattleAnim_AnonJumptable .anon_dw - dw Functioncd6ea - dw Functioncd6f7 + dw .zero + dw .one -Functioncd6ea: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -1226,18 +1245,18 @@ Functioncd6ea: add [hl] ; BATTLEANIMFRAMESET_25 BATTLEANIMFRAMESET_26 call ReinitBattleAnimFrameset -Functioncd6f7: +.one ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $b8 - jr c, .asm_cd704 + jr c, .move call DeinitBattleAnimation ret -.asm_cd704 +.move ld a, $2 - call Functionce70a + call BattleAnim_StepToTarget ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1249,24 +1268,24 @@ Functioncd6f7: ld [hl], a ret -BattleAnimFunction_0F: +BattleAnimFunction_WaterGun: call BattleAnim_AnonJumptable .anon_dw - dw Functioncd725 - dw Functioncd728 - dw Functioncd763 - dw Functioncd776 + dw .zero + dw .one + dw .two + dw .three -Functioncd725: +.zero call BattleAnim_IncAnonJumptableIndex -Functioncd728: +.one ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] cp $30 - jr c, .asm_cd747 + jr c, .run_down ld a, $2 - call Functionce70a + call BattleAnim_StepToTarget ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1278,7 +1297,7 @@ Functioncd728: ld [hl], a ret -.asm_cd747 +.run_down call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_28 call ReinitBattleAnimFrameset @@ -1293,32 +1312,33 @@ Functioncd728: ld a, [hl] and $1 ld [hl], a -Functioncd763: +.two ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $18 - jr nc, .asm_cd76e + jr nc, .splash inc [hl] ret -.asm_cd76e +.splash call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_29 call ReinitBattleAnimFrameset -Functioncd776: +.three ret -BattleAnimFunction_11: +BattleAnimFunction_Powder: +; Obj moves down and disappears at x coord $38 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $38 - jr c, .asm_cd784 + jr c, .move call DeinitBattleAnimation ret -.asm_cd784 +.move ld a, [hl] ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -1334,6 +1354,7 @@ BattleAnimFunction_11: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], d + ; Shakes object back and forth 16 pixels ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] @@ -1341,13 +1362,14 @@ BattleAnimFunction_11: ld [hl], a ret -BattleAnimFunction_14: +BattleAnimFunction_Recover: +; Obj moves in an ever shrinking circle. Obj Param defines initial position in the circle call BattleAnim_AnonJumptable .anon_dw - dw Functioncd7ab - dw Functioncd7d2 + dw .zero + dw .one -Functioncd7ab: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -1369,16 +1391,16 @@ Functioncd7ab: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld [hl], $1 -Functioncd7d2: +.one ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] and a - jr nz, .asm_cd7de + jr nz, .move call DeinitBattleAnimation ret -.asm_cd7de +.move ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1409,37 +1431,41 @@ Functioncd7d2: dec [hl] ret -BattleAnimFunction_15: +BattleAnimFunction_ThunderWave: call BattleAnim_AnonJumptable .anon_dw - dw Functioncd81f - dw Functioncd817 - dw Functioncd81f - dw Functioncd820 + dw .zero + dw .one + dw .two + dw .three -Functioncd817: +.one call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_35 call ReinitBattleAnimFrameset -Functioncd81f: +.zero +.two ret -Functioncd820: +.three call DeinitBattleAnimation ret -BattleAnimFunction_16: +BattleAnimFunction_Clamp_Encore: +; Claps two objects together, twice. Also used by Encore +; Second object's frameset and position relative to first are both defined via this function +; Obj Param: Distance from center (masked with $7F). Bit 7 flips object horizontally by switching to a different frameset call BattleAnim_AnonJumptable .anon_dw - dw Functioncd835 - dw Functioncd860 - dw Functioncd88f - dw Functioncd88f - dw Functioncd88f - dw Functioncd88f - dw Functioncd893 - -Functioncd835: + dw .zero + dw .one + dw .two + dw .three + dw .four + dw .five + dw .six + +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -1450,23 +1476,23 @@ Functioncd835: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc bit 7, [hl] - jr nz, .asm_cd852 + jr nz, .flipped ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $10 - jr .asm_cd858 + jr .got_sine_start -.asm_cd852 +.flipped ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $30 -.asm_cd858 +.got_sine_start ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] and $7f ld [hl], a -Functioncd860: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1482,15 +1508,15 @@ Functioncd860: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] - inc a ; BATTLEANIMFRAMESET_3B - ; BATTLEANIMFRAMESET_A1 + inc a ; BATTLEANIMFRAMESET_3B (Clamp Flipped) + ; BATTLEANIMFRAMESET_A1 (Hands Flipped) jr .reinit .load_no_inc ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc - ld a, [hl] ; BATTLEANIMFRAMESET_3A - ; BATTLEANIMFRAMESET_A0 + ld a, [hl] ; BATTLEANIMFRAMESET_3A (Clamp) + ; BATTLEANIMFRAMESET_A0 (Hands) .reinit call ReinitBattleAnimFrameset ld hl, BATTLEANIMSTRUCT_VAR1 @@ -1499,50 +1525,56 @@ Functioncd860: ld a, [hl] and $1f ret nz -Functioncd88f: +.two +.three +.four +.five call BattleAnim_IncAnonJumptableIndex ret -Functioncd893: +.six ld hl, BATTLEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld [hl], $1 ret -BattleAnimFunction_17: +BattleAnimFunction_Bite: +; Claps two objects together (vertically), twice +; Second object's frameset and position relative to first are both defined via this function +; Obj Param: Distance from center (masked with $7F). Bit 7 flips object vertically by switching to a different frameset call BattleAnim_AnonJumptable .anon_dw - dw Functioncd8ab - dw Functioncd8cc - dw Functioncd8f5 - dw Functioncd8f5 - dw Functioncd8f5 - dw Functioncd8f5 - dw Functioncd8f9 - -Functioncd8ab: + dw .zero + dw .one + dw .two + dw .three + dw .four + dw .five + dw .six + +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc bit 7, [hl] - jr nz, .asm_cd8be + jr nz, .flipped ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $10 - jr .asm_cd8c4 + jr .got_sine_start -.asm_cd8be +.flipped ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $30 -.asm_cd8c4 +.got_sine_start ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] and $7f ld [hl], a -Functioncd8cc: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1554,13 +1586,13 @@ Functioncd8cc: add hl, bc ld [hl], a bit 7, a - jr nz, .asm_cd8e6 + jr nz, .flipped2 ld a, BATTLEANIMFRAMESET_3D - jr .asm_cd8e8 + jr .got_frameset -.asm_cd8e6 +.flipped2 ld a, BATTLEANIMFRAMESET_3C -.asm_cd8e8 +.got_frameset call ReinitBattleAnimFrameset ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -1570,30 +1602,34 @@ Functioncd8cc: and $1f ret nz -Functioncd8f5: +.two +.three +.four +.five call BattleAnim_IncAnonJumptableIndex ret -Functioncd8f9: +.six ld hl, BATTLEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld [hl], $1 ret -BattleAnimFunction_18: +BattleAnimFunction_SolarBeam: +; Solar Beam charge up animation call BattleAnim_AnonJumptable .anon_dw - dw Functioncd907 - dw Functioncd913 + dw .zero + dw .one -Functioncd907: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $28 inc hl ld [hl], $0 -Functioncd913: +.one ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -1616,7 +1652,7 @@ Functioncd913: add hl, bc ld a, [hl] and a - jr z, .asm_cd950 + jr z, .zero_radius ld d, a ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc @@ -1633,52 +1669,55 @@ Functioncd913: ld [hl], d ret -.asm_cd950 +.zero_radius call DeinitBattleAnimation ret -BattleAnimFunction_19: +BattleAnimFunction_Gust: call BattleAnim_AnonJumptable .anon_dw - dw Functioncd961 - dw Functioncd96a - dw Functioncd96e - dw Functioncd96a - dw Functioncd97b + dw .zero + dw .one + dw .two + dw .three + dw .four -Functioncd961: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld [hl], $0 -Functioncd96a: - call Functioncd99a +.one +.three + call .GustWobble ret -Functioncd96e: +.two ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $88 - jr c, asm_cd988 + jr c, .move call BattleAnim_IncAnonJumptableIndex ret -Functioncd97b: +.four ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $b8 - jr c, asm_cd988 + jr c, .move call DeinitBattleAnimation ret -asm_cd988: - call Functioncd99a +.move + call .GustWobble + ; Move horizontally every frame ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc inc [hl] ld a, [hl] + ; Move in the vertically every other frame and $1 ret nz ld hl, BATTLEANIMSTRUCT_YCOORD @@ -1686,8 +1725,9 @@ asm_cd988: dec [hl] ret -Functioncd99a: - call Functioncd9f4 +.GustWobble: + ; Circular movement where width is retrieved from a list, and height is 1/16 of that + call .GetGustRadius ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1746,29 +1786,31 @@ Functioncd99a: ld [hl], a ret -Functioncd9f4: +.GetGustRadius: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld e, [hl] ld d, 0 - ld hl, Unknown_cda01 + ld hl, .GustOffsets add hl, de ld d, [hl] ret -Unknown_cda01: +.GustOffsets: db 8, 6, 5, 4, 5, 6, 8, 12, 16 -BattleAnimFunction_1C: +BattleAnimFunction_Absorb: +; Moves object from target to user and disappears when reaches x coord $30. Example: Absorb, Mega Drain, Leech Seed status +; Obj Param: Speed in the X axis ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $30 - jr nc, .asm_cda17 + jr nc, .move call DeinitBattleAnimation ret -.asm_cda17 +.move ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -1782,20 +1824,21 @@ BattleAnimFunction_1C: srl e ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc -.asm_cda2c +.loop inc [hl] dec e - jr nz, .asm_cda2c + jr nz, .loop ret -BattleAnimFunction_1F: +BattleAnimFunction_Wrap: +; Plays out object Frameset. Use anim_incobj to move to next frameset call BattleAnim_AnonJumptable .anon_dw - dw Functioncda4c - dw Functioncda3a - dw Functioncda4c + dw .zero + dw .one + dw .two -Functioncda3a: +.one ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc ld a, [hl] @@ -1803,10 +1846,11 @@ Functioncda3a: ; BATTLEANIMFRAMESET_55 call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex - ld hl, BATTLEANIMSTRUCT_VAR1 + ld hl, BATTLEANIMSTRUCT_VAR1 ; Unused? add hl, bc ld [hl], $8 -Functioncda4c: +.zero +.two ret BattleAnimFunction_LeechSeed: @@ -1816,20 +1860,20 @@ BattleAnimFunction_LeechSeed: dw .one dw .two dw .three -.zero: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], $40 ret -.one: +.one ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] cp $20 jr c, .sprout - call Functioncda8d + call BattleAnim_StepThrownToTarget ret .sprout @@ -1839,7 +1883,7 @@ BattleAnimFunction_LeechSeed: call BattleAnim_IncAnonJumptableIndex ret -.two: +.two ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] @@ -1852,17 +1896,18 @@ BattleAnimFunction_LeechSeed: call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_58 call ReinitBattleAnimFrameset -.three: +.three ret -Functioncda8d: +BattleAnim_StepThrownToTarget: +; Inches object towards the opponent's side in a parabola arc defined by the lower and upper nybble of Obj Param dec [hl] ld d, $20 call BattleAnim_Sine ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a - ld hl, BATTLEANIMSTRUCT_02 + ld hl, BATTLEANIMSTRUCT_FIX_Y add hl, bc ld a, [hl] add $2 @@ -1903,36 +1948,38 @@ Functioncda8d: dec [hl] ret -BattleAnimFunction_3F: +BattleAnimFunction_Spikes: +; Object is thrown at target. After $20 frames it stops and waits another $20 frames then disappear call BattleAnim_AnonJumptable .anon_dw - dw Functioncdadf - dw Functioncdae9 - dw Functioncdaf9 + dw .zero + dw .one + dw .two -Functioncdadf: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], $40 ret -Functioncdae9: +.one ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] cp $20 - jr c, .asm_cdaf6 - call Functioncda8d + jr c, .wait + call BattleAnim_StepThrownToTarget ret -.asm_cdaf6 +.wait call BattleAnim_IncAnonJumptableIndex -Functioncdaf9: +.two ret -BattleAnimFunction_1A: - call BattleAnimFunction_03 +BattleAnimFunction_RazorWind: + call BattleAnimFunction_MoveInCircle + ; Causes object to skip ahead the circular motion every frame ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -1940,35 +1987,36 @@ BattleAnimFunction_1A: ld [hl], a ret -BattleAnimFunction_1B: +BattleAnimFunction_Kick: +; Uses anim_setobj for different kick types call BattleAnim_AnonJumptable .anon_dw - dw Functioncdb13 - dw Functioncdb14 - dw Functioncdb28 - dw Functioncdb50 - dw Functioncdb65 + dw .zero + dw .one + dw .two ; Jump Kick, Hi Jump Kick + dw .three ; Rolling Kick + dw .four -Functioncdb13: +.zero ret -Functioncdb14: +.one ; Unused? ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] cp $30 - jr c, .asm_cdb24 + jr c, .unknown_cdb24 ld hl, BATTLEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld [hl], $0 ret -.asm_cdb24 +.unknown_cdb24 add $4 ld [hl], a ret -Functioncdb28: +.two ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -1979,7 +2027,7 @@ Functioncdb28: ld hl, BATTLEANIMSTRUCT_OAMFLAGS add hl, bc set 0, [hl] - ld hl, BATTLEANIMSTRUCT_02 + ld hl, BATTLEANIMSTRUCT_FIX_Y add hl, bc ld [hl], $90 ld hl, BATTLEANIMSTRUCT_FRAME @@ -1993,7 +2041,7 @@ Functioncdb28: dec [hl] ret -Functioncdb50: +.three call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -2004,7 +2052,7 @@ Functioncdb50: ld hl, BATTLEANIMSTRUCT_DURATION add hl, bc ld [hl], $80 -Functioncdb65: +.four ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2023,29 +2071,32 @@ Functioncdb65: ld [hl], a ret -BattleAnimFunction_1D: +BattleAnimFunction_Egg: +; Used by Egg Bomb and Softboiled +; Obj Param: Defines jumptable starting index call BattleAnim_AnonJumptable .anon_dw - dw Functioncdb9f - dw Functioncdbb3 - dw Functioncdbcf - dw Functioncdbeb - dw Functioncdc74 - dw Functioncdc1a - dw Functioncdbc1 - dw Functioncdc1e - dw Functioncdc27 - dw Functioncdc39 - dw Functioncdc74 - dw Functioncdc48 - dw Functioncdc57 - dw Functioncdc74 - -Functioncdb9f: + dw .zero + dw .one ; Egg Bomb start + dw .two + dw .three + dw .four ; ret + dw .five + dw .six ; Softboiled obj 1 start + dw .seven + dw .eight + dw .nine + dw .ten ; ret + dw .eleven ; Softboiled obj 2 start + dw .twelve + dw .thirteen ; ret + +.zero + ; Object starts here then jumps to the jumptable index defined by the Obj Param ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $28 - inc hl + inc hl ; BATTLEANIMSTRUCT_VAR2 ld [hl], $10 ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -2055,61 +2106,67 @@ Functioncdb9f: ld [hl], a ret -Functioncdbb3: +.one + ; Initial Egg Bomb arc movement to x coord $40 ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $40 - jr nc, .asm_cdbbd + jr nc, .egg_bomb_vertical_wave inc [hl] -.asm_cdbbd - call Functioncdc75 +.egg_bomb_vertical_wave + call .EggVerticalWaveMotion ret -Functioncdbc1: +.six + ; Initial Softboiled arc movement to x coord $4b ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $4b - jr nc, .asm_cdbcb + jr nc, .softboiled_vertical_wave inc [hl] -.asm_cdbcb - call Functioncdc75 +.softboiled_vertical_wave + call .EggVerticalWaveMotion ret -Functioncdbcf: +.two + ; Compares the egg's x coord to determine whether to move, wait or end animation ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $88 - jr nc, .asm_cdbe6 + jr nc, .egg_bomb_done and $f - jr nz, asm_cdbfa + jr nz, .egg_bomb_step ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], $10 - call BattleAnim_IncAnonJumptableIndex + call BattleAnim_IncAnonJumptableIndex ; jumps to three ret -.asm_cdbe6 +.egg_bomb_done + ; Increases jumptable index twice to four call BattleAnim_IncAnonJumptableIndex inc [hl] ret -Functioncdbeb: +.three + ; Waits in place ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] and a - jr z, .asm_cdbf5 + jr z, .done_waiting dec [hl] ret -.asm_cdbf5 +.done_waiting ld hl, BATTLEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc dec [hl] -asm_cdbfa: +.egg_bomb_step + ; Moves towards the target ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc inc [hl] @@ -2131,17 +2188,20 @@ asm_cdbfa: ld [hl], e ret -Functioncdc1a: +.five + ; Clears Egg Bomb object via anim_incobj call DeinitBattleAnimation ret -Functioncdc1e: - ld a, BATTLEANIMFRAMESET_4E +.seven + ; Switches Softboiled frameset to egg wobbling + ld a, BATTLEANIMFRAMESET_4E ; Egg wobbling call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex ret -Functioncdc27: +.eight + ; Softboiled object waves slightly side to side ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2154,8 +2214,9 @@ Functioncdc27: ld [hl], a ret -Functioncdc39: - ld a, BATTLEANIMFRAMESET_50 +.nine + ; First Softboiled ANIM_OBJ_EGG turns into the bottom half frameset + ld a, BATTLEANIMFRAMESET_50 ; Cracked egg bottom call ReinitBattleAnimFrameset ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -2163,8 +2224,9 @@ Functioncdc39: call BattleAnim_IncAnonJumptableIndex ret -Functioncdc48: - ld a, BATTLEANIMFRAMESET_4F +.eleven + ; Second Softboiled ANIM_OBJ_EGG + ld a, BATTLEANIMFRAMESET_4F ; Cracked egg top call ReinitBattleAnimFrameset call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 @@ -2172,7 +2234,8 @@ Functioncdc48: ld [hl], $40 ret -Functioncdc57: +.twelve + ; Top half of egg moves upward for $30 frames ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2185,20 +2248,22 @@ Functioncdc57: add hl, bc ld a, [hl] cp $30 - jr c, .asm_cdc71 + jr c, .done_top_shell dec [hl] ret -.asm_cdc71 +.done_top_shell call BattleAnim_IncAnonJumptableIndex -Functioncdc74: +.four +.ten +.thirteen ret -Functioncdc75: +.EggVerticalWaveMotion: ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hli] - ld d, [hl] + ld d, [hl] ; BATTLEANIMSTRUCT_VAR2 call BattleAnim_Sine ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc @@ -2207,7 +2272,7 @@ Functioncdc75: add hl, bc inc [hl] ld a, [hl] - and $3f + and $3f ; cp 64 ret nz ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -2226,18 +2291,20 @@ Functioncdc75: call BattleAnim_IncAnonJumptableIndex ret -BattleAnimFunction_1E: +BattleAnimFunction_MoveUp: +; Moves object up for 41 frames +; Obj Param: Movement speed ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] and a - jr z, .asm_cdcb6 + jr z, .move cp $d8 - jr nc, .asm_cdcb6 + jr nc, .move call DeinitBattleAnimation ret -.asm_cdcb6 +.move ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld d, [hl] @@ -2248,27 +2315,30 @@ BattleAnimFunction_1E: ld [hl], a ret -BattleAnimFunction_21: +BattleAnimFunction_Sound: +; Moves object back and forth in one of three angles using a sine behavior and disappear after 8 frames. Used in Growl, Snore and Kinesis +; Obj Param: Used to define object angle. How much to increase from base frameset, which is hardcoded as BATTLEANIMFRAMESET_59 call BattleAnim_AnonJumptable .anon_dw - dw Functioncdcca - dw Functioncdced + dw .zero + dw .one -Functioncdcca: +.zero ldh a, [hBattleTurn] and a - jr z, .asm_cdcd9 + jr z, .got_turn + ; enemy ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] xor $ff add $3 ld [hl], a -.asm_cdcd9 +.got_turn call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc - ld [hl], $8 + ld [hl], $8 ; duration ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, BATTLEANIMFRAMESET_59 @@ -2276,21 +2346,21 @@ Functioncdcca: call ReinitBattleAnimFrameset ret -Functioncdced: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] and a - jr z, .asm_cdcfa + jr z, .done_anim dec [hl] - call Functioncdcfe + call .SoundWaveMotion ret -.asm_cdcfa +.done_anim call DeinitBattleAnimation ret -Functioncdcfe: +.SoundWaveMotion: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] @@ -2306,15 +2376,17 @@ Functioncdcfe: add hl, bc ld a, [hl] and a - jr z, .asm_cdd20 + jr z, .negative dec a ret z + ; Obj Param 2 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], d ret -.asm_cdd20 +.negative + ; Obj Param 0 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, d @@ -2323,13 +2395,15 @@ Functioncdcfe: ld [hl], a ret -BattleAnimFunction_22: +BattleAnimFunction_ConfuseRay: +; Creates the Confuse Ray object and moves it across the screen until x coord $80 +; Moves horizontally every frame and vertically every 3 frames call BattleAnim_AnonJumptable .anon_dw - dw Functioncdd31 - dw Functioncdd4f + dw .zero + dw .one -Functioncdd31: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -2348,7 +2422,7 @@ Functioncdd31: call ReinitBattleAnimFrameset ret -Functioncdd4f: +.one ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2379,11 +2453,11 @@ Functioncdd4f: add hl, bc ld a, [hl] and $3 - jr nz, .asm_cdd87 + jr nz, .skip_vertical_movement ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc dec [hl] -.asm_cdd87 +.skip_vertical_movement and $1 ret nz ld hl, BATTLEANIMSTRUCT_XCOORD @@ -2391,13 +2465,15 @@ Functioncdd4f: inc [hl] ret -BattleAnimFunction_23: +BattleAnimFunction_Dizzy: +; Moves object in a circle where the height is 1/4 the width, with the next frameset from base whether moving left or right. Also used for Nightmare +; Obj Param: Defines starting position in the circle (masked with $80). Bit 7 flips it at the start call BattleAnim_AnonJumptable .anon_dw - dw Functioncdd97 - dw Functioncddbc + dw .zero + dw .one -Functioncdd97: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_FRAMESET_ID add hl, bc @@ -2420,7 +2496,7 @@ Functioncdd97: ld a, [hl] and $7f ld [hl], a -Functioncddbc: +.one ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2444,7 +2520,7 @@ Functioncddbc: ld a, [hl] inc [hl] and $3f - jr z, .asm_cddf0 + jr z, .not_flipped and $1f ret nz ld hl, BATTLEANIMSTRUCT_VAR1 @@ -2452,25 +2528,28 @@ Functioncddbc: ld a, [hl] inc a ; BATTLEANIMFRAMESET_62 ; BATTLEANIMFRAMESET_9D - jr .asm_cddf5 + jr .got_frameset -.asm_cddf0 +.not_flipped ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] ; BATTLEANIMFRAMESET_61 ; BATTLEANIMFRAMESET_9C -.asm_cddf5 +.got_frameset call ReinitBattleAnimFrameset ret -BattleAnimFunction_24: +BattleAnimFunction_Amnesia: +; Creates 3 objects based on Obj Param +; Obj Param: How much to increase from base frameset, which is hardcoded as BATTLEANIMFRAMESET_63 +; anim_incobj is used to DeInit object (used by Present) call BattleAnim_AnonJumptable .anon_dw - dw Functioncde02 - dw Functioncde20 - dw Functioncde21 + dw .zero + dw .one + dw .two -Functioncde02: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -2481,23 +2560,25 @@ Functioncde02: add hl, bc ld e, [hl] ld d, 0 - ld hl, Unknown_cde25 + ld hl, .AmnesiaOffsets add hl, de ld a, [hl] ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a -Functioncde20: +.one ret -Functioncde21: +.two + ; anim_incobj forces obj to deinit call DeinitBattleAnimation ret -Unknown_cde25: +.AmnesiaOffsets: ; Hardcoded Y Offsets for each Obj Param db $ec, $f8, $00 -BattleAnimFunction_25: +BattleAnimFunction_FloatUp: +; Object moves horizontally in a sine wave, while also moving up. Also used by Charm and the Nightmare status ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2526,7 +2607,8 @@ BattleAnimFunction_25: ld [hl], e ret -BattleAnimFunction_26: +BattleAnimFunction_Dig: +; Object moves up then down with a wave motion, while also moving away from the user 1 pixel per frame ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2542,35 +2624,38 @@ BattleAnimFunction_26: inc [hl] ret -BattleAnimFunction_27: +BattleAnimFunction_String: call BattleAnim_AnonJumptable .anon_dw - dw Functioncde72 - dw Functioncde88 + dw .zero + dw .one -Functioncde72: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] and a - jr nz, .asm_cde83 + jr nz, .not_param_zero + ; Obj Param 0 flips when used by enemy ld hl, BATTLEANIMSTRUCT_OAMFLAGS add hl, bc - set 6, [hl] -.asm_cde83 + set OAM_Y_FLIP, [hl] +.not_param_zero add BATTLEANIMFRAMESET_6A ; BATTLEANIMFRAMESET_6B BATTLEANIMFRAMESET_6C call ReinitBattleAnimFrameset -Functioncde88: +.one ret -BattleAnimFunction_28: +BattleAnimFunction_Paralyzed: +; Also used by Disable +; Obj Param: When bit 7 is set, frameset is replaced with flipped version. This bit is discarded and object then moves back and forth between position in lower nybble and upper nybble of Param every other frame call BattleAnim_AnonJumptable .anon_dw - dw Functioncde90 - dw Functioncdebf + dw .zero + dw .one -Functioncde90: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -2586,13 +2671,13 @@ Functioncde90: add hl, bc ld a, e and $80 - jr nz, .asm_cdeb2 + jr nz, .right ld a, e and $f ld [hl], a ret -.asm_cdeb2 +.right ld a, e and $f xor $ff @@ -2602,16 +2687,16 @@ Functioncde90: call ReinitBattleAnimFrameset ret -Functioncdebf: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] and a - jr z, .asm_cdec9 + jr z, .var1_zero dec [hl] ret -.asm_cdec9 +.var1_zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2667,7 +2752,8 @@ BattleAnimFunction_SpiralDescent: call DeinitBattleAnimation ret -BattleAnimFunction_2D: +BattleAnimFunction_PetalDance: +; Object moves downwards in a spiral around the user. Object disappears at y coord $28 ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2700,21 +2786,21 @@ BattleAnimFunction_2D: add hl, bc ld a, [hl] cp $28 - jr nc, .asm_cdf55 + jr nc, .end inc [hl] ret -.asm_cdf55 +.end call DeinitBattleAnimation ret BattleAnimFunction_PoisonGas: call BattleAnim_AnonJumptable .anon_dw - dw Functioncdf60 + dw .zero dw BattleAnimFunction_SpiralDescent -Functioncdf60: +.zero: ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -2744,7 +2830,9 @@ Functioncdf60: call BattleAnim_IncAnonJumptableIndex ret -BattleAnimFunction_34: +BattleAnimFunction_SmokeFlameWheel: +; Object spins around target while also moving upward until it disappears at x coord $e8 +; Obj Param: Defines where the object starts in the circle ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2778,15 +2866,17 @@ BattleAnimFunction_34: add hl, bc ld a, [hl] cp $e8 - jr z, .asm_cdfc7 + jr z, .done dec [hl] ret -.asm_cdfc7 +.done call DeinitBattleAnimation ret -BattleAnimFunction_3C: +BattleAnimFunction_SacredFire: +; Moves object in a circle where the height is 1/8 the width, while also moving upward 2 pixels per frame for 24 frames after which it disappears +; Obj Param: Is used internally only ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2820,23 +2910,25 @@ BattleAnimFunction_3C: add hl, bc ld a, [hl] cp $d0 - jr z, .asm_ce007 + jr z, .done dec [hl] dec [hl] ret -.asm_ce007 +.done call DeinitBattleAnimation ret -BattleAnimFunction_35: +BattleAnimFunction_PresentSmokescreen: +; Object bounces from user to target and stops at x coord $6c. Uses anim_incobj to clear object +; Obj Param: Defined but not used call BattleAnim_AnonJumptable .anon_dw - dw Functionce014 - dw Functionce023 - dw Functionce05f + dw .zero + dw .one + dw .two -Functionce014: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -2844,17 +2936,17 @@ Functionce014: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], $10 -Functionce023: +.one ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $6c - jr c, .asm_ce02d + jr c, .do_move ret -.asm_ce02d +.do_move ld a, $2 - call Functionce70a + call BattleAnim_StepToTarget ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2863,10 +2955,10 @@ Functionce023: ld d, [hl] call BattleAnim_Sine bit 7, a - jr nz, .asm_ce046 + jr nz, .negative xor $ff inc a -.asm_ce046 +.negative ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a @@ -2883,7 +2975,7 @@ Functionce023: srl [hl] ret -Functionce05f: +.two call DeinitBattleAnimation ret @@ -2893,8 +2985,9 @@ BattleAnimFunction_Horn: dw .zero dw .one dw .two - dw Functionce09e -.zero: + dw .three + +.zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2909,26 +3002,26 @@ BattleAnimFunction_Horn: ld [hl], a ret -.one: +.one ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $58 ret nc ld a, $2 - call Functionce70a + call BattleAnim_StepToTarget ret -.two: +.two ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] cp $20 - jr c, Functionce09e + jr c, .three call DeinitBattleAnimation ret -Functionce09e: +.three ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] @@ -2953,14 +3046,16 @@ Functionce09e: ld [hl], a ret -BattleAnimFunction_2C: +BattleAnimFunction_Needle: +; Moves object towards target, either in a straight line or arc. Stops at x coord $84 +; Obj Param: Upper nybble defines the index of the jumptable. Lower nybble defines the speed. call BattleAnim_AnonJumptable .anon_dw - dw Functionce0ce - dw Functionce0f8 - dw Functionce0dd + dw .zero + dw .one + dw .two -Functionce0ce: +.zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -2971,7 +3066,8 @@ Functionce0ce: ld [hl], a ret -Functionce0dd: +.two + ; Pin Missile needle (arc) ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -2980,37 +3076,40 @@ Functionce0dd: ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc bit 7, a - jr z, .asm_ce0f0 + jr z, .negative ld [hl], a -.asm_ce0f0 +.negative ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] sub $4 ld [hl], a -Functionce0f8: +.one + ; Normal needle (line) ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $84 - jr c, .asm_ce105 + jr c, .move_to_target call DeinitBattleAnimation ret -.asm_ce105 +.move_to_target ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - call Functionce70a + call BattleAnim_StepToTarget ret -BattleAnimFunction_2E: +BattleAnimFunction_ThiefPayday: +; Object drops off target and bounces once on the floor +; Obj Param: Defines every how many frames the object moves horizontally call BattleAnim_AnonJumptable .anon_dw - dw Functionce115 - dw Functionce12a + dw .zero + dw .one -Functionce115: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -3022,7 +3121,7 @@ Functionce115: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], a -Functionce12a: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hli] @@ -3037,11 +3136,11 @@ Functionce12a: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc and [hl] - jr nz, .asm_ce149 + jr nz, .var_doesnt_equal_param ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc dec [hl] -.asm_ce149 +.var_doesnt_equal_param ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc inc [hl] @@ -3055,7 +3154,9 @@ Functionce12a: srl [hl] ret -BattleAnimFunction_2F: +BattleAnimFunction_AbsorbCircle: +; A circle of objects that starts at the target and moves to the user. It expands until x coord $5a and then shrinks. Once radius reaches 0, the object disappears. Also used by Mimic and Conversion2 +; Obj Param: Defines the position in the circle the object starts at ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3079,42 +3180,44 @@ BattleAnimFunction_2F: inc [hl] ld a, [hl] and $1 - jr nz, .asm_ce189 + jr nz, .dont_move_x ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc dec [hl] -.asm_ce189 +.dont_move_x ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] and $3 - jr nz, .asm_ce197 + jr nz, .dont_move_y ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc inc [hl] -.asm_ce197 +.dont_move_y ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc cp $5a - jr nc, .asm_ce1aa + jr nc, .increase_radius ld a, [hl] and a - jr z, .asm_ce1ac - dec [hl] + jr z, .end + dec [hl] ; decreases radius ret -.asm_ce1aa +.increase_radius inc [hl] ret -.asm_ce1ac +.end call DeinitBattleAnimation ret -BattleAnimFunction_42: +BattleAnimFunction_Conversion: +; A rotating circle of objects centered at a position. It expands for $40 frames and then shrinks. Once radius reaches 0, the object disappears. +; Obj Param: Defines starting point in the circle ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3141,11 +3244,11 @@ BattleAnimFunction_42: ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc cp $40 - jr nc, .asm_ce1df + jr nc, .shrink inc [hl] ret -.asm_ce1df +.shrink ld a, [hl] dec [hl] and a @@ -3153,13 +3256,15 @@ BattleAnimFunction_42: call DeinitBattleAnimation ret -BattleAnimFunction_30: +BattleAnimFunction_Bonemerang: +; Boomerang-like movement from user to target +; Obj Param: Defines position to start at in the circle call BattleAnim_AnonJumptable .anon_dw - dw Functionce1ee - dw Functionce1fb + dw .zero + dw .one -Functionce1ee: +.zero: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc @@ -3167,7 +3272,7 @@ Functionce1ee: ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld [hl], a -Functionce1fb: +.one: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3193,13 +3298,15 @@ Functionce1fb: inc [hl] ret -BattleAnimFunction_31: +BattleAnimFunction_Shiny: +; Puts object in a circle formation of radius $10. Also used by Flash and Light Screen +; Obj Param: Defines where the object starts in the circle call BattleAnim_AnonJumptable .anon_dw - dw Functionce22d - dw Functionce254 + dw .zero + dw .one -Functionce22d: +.zero: call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -3217,67 +3324,71 @@ Functionce22d: ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc ld [hl], a - ld hl, BATTLEANIMSTRUCT_VAR2 + ld hl, BATTLEANIMSTRUCT_VAR2 ; unused? add hl, bc ld [hl], $f -Functionce254: +.one: ret -BattleAnimFunction_32: +BattleAnimFunction_SkyAttack: +; Uses anim_incobj to move to next step call BattleAnim_AnonJumptable .anon_dw - dw Functionce260 - dw Functionce274 - dw Functionce278 - dw Functionce289 + dw .zero + dw .one + dw .two + dw .three -Functionce260: +.zero call BattleAnim_IncAnonJumptableIndex ldh a, [hBattleTurn] and a - jr nz, .asm_ce26c + jr nz, .enemy_turn ld a, $f0 - jr .asm_ce26e + jr .got_var1 -.asm_ce26c +.enemy_turn ld a, $cc -.asm_ce26e +.got_var1 ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], a ret -Functionce274: - call Functionce29f +.one + call .SkyAttack_CyclePalette ret -Functionce278: - call Functionce29f +.two +; Moves towards target and stops at x coord $84 + call .SkyAttack_CyclePalette ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $84 ret nc ld a, $4 - call Functionce70a + call BattleAnim_StepToTarget ret -Functionce289: - call Functionce29f +.three +; Moves towards target and disappears at x coord $d0 + call .SkyAttack_CyclePalette ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $d0 - jr nc, .asm_ce29b + jr nc, .done ld a, $4 - call Functionce70a + call BattleAnim_StepToTarget ret -.asm_ce29b +.done call DeinitBattleAnimation ret -Functionce29f: +.SkyAttack_CyclePalette: +; Cycles wOBP0 pallete ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] @@ -3288,13 +3399,13 @@ Functionce29f: ld d, $0 ldh a, [hSGB] and a - jr nz, .asm_ce2b6 - ld hl, Unknown_ce2c4 - jr .asm_ce2b9 + jr nz, .sgb + ld hl, .GBCPals + jr .got_pals -.asm_ce2b6 - ld hl, Unknown_ce2c8 -.asm_ce2b9 +.sgb + ld hl, .SGBPals +.got_pals add hl, de ld a, [hl] ld hl, BATTLEANIMSTRUCT_VAR1 @@ -3303,12 +3414,14 @@ Functionce29f: ld [wOBP0], a ret -Unknown_ce2c4: +.GBCPals: db $ff, $aa, $55, $aa -Unknown_ce2c8: +.SGBPals: db $ff, $ff, $00, $00 -BattleAnimFunction_33: +BattleAnimFunction_GrowthSwordsDance: +; Moves object in a circle where the height is 1/8 the width, while also moving upward 2 pixels per frame +; Obj Param: Defines where the object starts in the circle ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3338,26 +3451,28 @@ BattleAnimFunction_33: dec [hl] ret -BattleAnimFunction_36: +BattleAnimFunction_StrengthSeismicToss: +; Moves object up for $e0 frames, then shakes it vertically and throws it at the target. Uses anim_incobj to move to final phase +; Obj Param: Defined but not used call BattleAnim_AnonJumptable .anon_dw - dw Functionce306 - dw Functionce330 - dw Functionce34c + dw .zero + dw .one + dw .two -Functionce306: +.zero ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $e0 - jr nz, .asm_ce319 + jr nz, .move_up call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $2 ret -.asm_ce319 +.move_up ld d, a ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -3374,16 +3489,16 @@ Functionce306: ld [hl], e ret -Functionce330: +.one ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc ld a, [hl] and a - jr z, .asm_ce33a + jr z, .switch_position dec [hl] ret -.asm_ce33a +.switch_position ld [hl], $4 ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -3397,27 +3512,28 @@ Functionce330: ld [hl], a ret -Functionce34c: +.two ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $84 - jr nc, .asm_ce35b + jr nc, .done ld a, $4 - call Functionce70a + call BattleAnim_StepToTarget ret -.asm_ce35b +.done call DeinitBattleAnimation ret -BattleAnimFunction_37: +BattleAnimFunction_SpeedLine: +; Used in moves where the user disappears for a speed-based attack such as Quick Attack, Mach Punch and Extremespeed call BattleAnim_AnonJumptable .anon_dw - dw Functionce366 - dw Functionce375 + dw .zero + dw .one -Functionce366: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -3425,56 +3541,58 @@ Functionce366: and $7f add BATTLEANIMFRAMESET_81 ; BATTLEANIMFRAMESET_82 BATTLEANIMFRAMESET_83 call ReinitBattleAnimFrameset -Functionce375: +.one ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc bit 7, [hl] - jr nz, .asm_ce383 + jr nz, .inverted ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc inc [hl] ret -.asm_ce383 +.inverted ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc dec [hl] ret -BattleAnimFunction_38: +BattleAnimFunction_Sludge: +; Object moves upward for $c frames and switches to FRAMESET_20 call BattleAnim_AnonJumptable .anon_dw - dw Functionce392 - dw Functionce39c - dw Functionce3ae + dw .zero + dw .one + dw .two -Functionce392: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $c ret -Functionce39c: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] and a - jr z, .asm_ce3a6 + jr z, .done dec [hl] ret -.asm_ce3a6 +.done call BattleAnim_IncAnonJumptableIndex ld a, BATTLEANIMFRAMESET_20 call ReinitBattleAnimFrameset -Functionce3ae: +.two ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc dec [hl] ret -BattleAnimFunction_39: +BattleAnimFunction_MetronomeHand: +; Fast circular motion with an x radius of $8 and y radius of $2 ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -3494,16 +3612,18 @@ BattleAnimFunction_39: ld [hl], a ret -BattleAnimFunction_3A: +BattleAnimFunction_MetronomeSparkleSketch: +; Sideways wave motion while also moving downward until it disappears at y coord $20 +; Obj Param: Is used internally only ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $20 - jr c, .asm_ce3df + jr c, .do_move call DeinitBattleAnimation ret -.asm_ce3df +.do_move ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3524,13 +3644,14 @@ BattleAnimFunction_3A: inc [hl] ret -BattleAnimFunction_3B: +BattleAnimFunction_Agility: +; Object moves sideways at a speed determined by Obj Param. Can use anim_incobj to make it disappear call BattleAnim_AnonJumptable .anon_dw - dw Functionce406 - dw Functionce412 + dw .zero + dw .one -Functionce406: +.zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3540,11 +3661,13 @@ Functionce406: ld [hl], a ret -Functionce412: +.one call DeinitBattleAnimation ret -BattleAnimFunction_3D: +BattleAnimFunction_SafeguardProtect: +; Moves object in a circle where the width is 1/2 the height +; Obj Param: Defines starting point in circle ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3568,14 +3691,16 @@ BattleAnimFunction_3D: inc [hl] ret -BattleAnimFunction_3E: +BattleAnimFunction_LockOnMindReader: +; Moves objects towards a center position +; Obj Param: Used to define object angle from 0 to 3. Lower nybble defines how much to increase from base frameset while upper nybble defines angle of movement. The object moves for $28 frames, then waits for $10 frames and disappears call BattleAnim_AnonJumptable .anon_dw - dw Functionce443 - dw Functionce465 - dw Functionce490 + dw .zero + dw .one + dw .two -Functionce443: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -3595,12 +3720,12 @@ Functionce443: and $f0 or $8 ld [hl], a -Functionce465: +.one ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] and a - jr z, .asm_ce48b + jr z, .done dec [hl] add $8 ld d, a @@ -3621,10 +3746,10 @@ Functionce465: ld [hl], a ret -.asm_ce48b +.done ld [hl], $10 call BattleAnim_IncAnonJumptableIndex -Functionce490: +.two ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] @@ -3634,25 +3759,27 @@ Functionce490: call DeinitBattleAnimation ret -BattleAnimFunction_40: +BattleAnimFunction_HealBellNotes: +; Object moves horizontally in a sine wave, while also moving left every other frame and downwards for $38 frames after which it disappears +; Obj Param: Defines a frameset offset from FRAMESET_24 call BattleAnim_AnonJumptable .anon_dw - dw Functionce4a3 - dw Functionce4b0 + dw .zero + dw .one -Functionce4a3: +.zero call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, BATTLEANIMFRAMESET_24 add [hl] ; BATTLEANIMFRAMESET_25 BATTLEANIMFRAMESET_26 call ReinitBattleAnimFrameset -Functionce4b0: +.one ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $38 - jr nc, .asm_ce4d8 + jr nc, .done inc [hl] ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc @@ -3673,11 +3800,13 @@ Functionce4b0: dec [hl] ret -.asm_ce4d8 +.done call DeinitBattleAnimation ret -BattleAnimFunction_41: +BattleAnimFunction_BatonPass: +; Object falls vertially and bounces on the ground +; Obj Param: Defines speed and duration ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3690,10 +3819,10 @@ BattleAnimFunction_41: inc [hl] call BattleAnim_Sine bit 7, a - jr nz, .asm_ce4f4 + jr nz, .negative xor $ff inc a -.asm_ce4f4 +.negative ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a @@ -3707,12 +3836,14 @@ BattleAnimFunction_41: srl [hl] ret -BattleAnimFunction_43: +BattleAnimFunction_EncoreBellyDrum: +; Object moves at an arc for 8 frames and disappears +; Obj Param: Defines startging position in the arc ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] cp $10 - jr nc, .asm_ce52e + jr nc, .done inc [hl] inc [hl] ld d, a @@ -3733,11 +3864,13 @@ BattleAnimFunction_43: ld [hl], a ret -.asm_ce52e +.done call DeinitBattleAnimation ret -BattleAnimFunction_44: +BattleAnimFunction_SwaggerMorningSun: +; Moves object at an angle +; Obj Param: Lower 6 bits define angle of movement and upper 2 bits define speed ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld e, [hl] @@ -3766,60 +3899,63 @@ BattleAnimFunction_44: ld [hl], a ret -BattleAnimFunction_45: +BattleAnimFunction_HiddenPower: +; Moves object in a ring around position. Uses anim_incobj to move to second phase, where it expands the radius 8 pixels at a time for 13 frames and then disappears +; Obj Param: Defines starting position in circle call BattleAnim_AnonJumptable .anon_dw - dw Functionce564 - dw Functionce56e - dw Functionce577 + dw .zero + dw .one + dw .two -Functionce564: +.zero ld d, $18 ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] inc [hl] - jr asm_ce58f + jr .step_circle -Functionce56e: +.one call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld [hl], $18 -Functionce577: +.two ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] cp $80 - jr nc, .asm_ce58b + jr nc, .done ld d, a add $8 ld [hl], a ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] - jr asm_ce58f + jr .step_circle -.asm_ce58b +.done call DeinitBattleAnimation ret -asm_ce58f: - call Functionce6f1 +.step_circle + call BattleAnim_StepCircle ret -BattleAnimFunction_46: +BattleAnimFunction_Curse: +; Object moves down and to the left 2 pixels at a time until it reaches x coord $30 and disappears call BattleAnim_AnonJumptable .anon_dw - dw Functionce5b3 - dw Functionce59a + dw .zero + dw .one -Functionce59a: +.one ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] cp $30 - jr c, .asm_ce5b0 + jr c, .done ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc dec [hl] @@ -3830,12 +3966,14 @@ Functionce59a: inc [hl] ret -.asm_ce5b0 +.done call DeinitBattleAnimation -Functionce5b3: +.zero: ret -BattleAnimFunction_47: +BattleAnimFunction_PerishSong: +; Moves object in a large circle with a x radius of $50 and a y radius 1/4 or that, while also moving downwards +; Obj Param: Defines starting position in the circle ld d, $50 ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -3862,60 +4000,64 @@ BattleAnimFunction_47: ld [hl], a ret -BattleAnimFunction_48: +BattleAnimFunction_RapidSpin: +; Object moves upwards 4 pixels per frame until it disappears at y coord $d0 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $d0 - jr z, .disappear + jr z, .done dec [hl] dec [hl] dec [hl] dec [hl] ret -.disappear +.done call DeinitBattleAnimation ret -BattleAnimFunction_49: +BattleAnimFunction_BetaPursuit: +; Working but unused animation +; Object moves either down or up 4 pixels per frame, depending on Obj Param. Object disappears after 23 frames when going down, or at y coord $d8 when going up +; Obj Param: 0 moves downwards, 1 moves upwards call BattleAnim_AnonJumptable .anon_dw - dw Functionce5f9 - dw Functionce60a - dw Functionce622 - dw Functionce618 + dw .zero + dw .one + dw .two + dw .three -Functionce5f9: +.zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] and a - jr nz, asm_ce61c + jr nz, .move_up call BattleAnim_IncAnonJumptableIndex ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld [hl], $ec -Functionce60a: +.one ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] cp $4 - jr z, Functionce618 + jr z, .three inc [hl] inc [hl] inc [hl] inc [hl] ret -Functionce618: +.three call DeinitBattleAnimation ret -asm_ce61c: +.move_up call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex -Functionce622: +.two ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] @@ -3927,15 +4069,20 @@ Functionce622: dec [hl] ret -BattleAnimFunction_4A: +BattleAnimFunction_RainSandstorm: +; Object moves down 4 pixels at a time and right a variable distance +; Obj Param: Defines variation in the movement +; $0: 2 pixels horizontal movement +; $1: 8 pixels horizontal movement +; $2: 4 pixels horizontal movement call BattleAnim_AnonJumptable .anon_dw - dw Functionce63a - dw Functionce648 - dw Functionce65c - dw Functionce672 + dw .zero + dw .one + dw .two + dw .three -Functionce63a: +.zero ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] @@ -3945,15 +4092,15 @@ Functionce63a: call BattleAnim_IncAnonJumptableIndex ret -Functionce648: +.one ; Obj Param 0 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] add $4 cp $70 - jr c, .asm_ce654 + jr c, .dont_reset_y_offset_one xor a -.asm_ce654 +.dont_reset_y_offset_one ld [hl], a ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc @@ -3961,15 +4108,15 @@ Functionce648: inc [hl] ret -Functionce65c: +.two ; Obj Param 1 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] add $4 cp $70 - jr c, .asm_ce668 + jr c, .dont_reset_y_offset_two xor a -.asm_ce668 +.dont_reset_y_offset_two ld [hl], a ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc @@ -3978,15 +4125,15 @@ Functionce65c: ld [hl], a ret -Functionce672: +.three ; Obj Param 2 ld hl, BATTLEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] add $4 cp $70 - jr c, .asm_ce67e + jr c, .dont_reset_y_offset_three xor a -.asm_ce67e +.dont_reset_y_offset_three ld [hl], a ld hl, BATTLEANIMSTRUCT_XOFFSET add hl, bc @@ -3995,7 +4142,9 @@ Functionce672: ld [hl], a ret -BattleAnimFunction_4B: +BattleAnimFunction_AnimObjB0: ; unused +; Used by object ANIM_OBJ_B0, with itself is not used in any animation +; Obj Param: Lower nybble is added to VAR1 while upper nybble is added to XCOORD ld hl, BATTLEANIMSTRUCT_XCOORD add hl, bc ld d, [hl] @@ -4026,16 +4175,20 @@ BattleAnimFunction_4B: ld [hl], e ret -BattleAnimFunction_4C: +BattleAnimFunction_PsychUp: +; Object moves in a circle +; Obj Param: Defines starting position in the circle ld d, $18 ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc ld a, [hl] inc [hl] - call Functionce6f1 + call BattleAnim_StepCircle ret -BattleAnimFunction_4F: +BattleAnimFunction_Cotton: +; Object moves in a circle slowly +; Obj Param: Defines starting position in the circle ld d, $18 ld hl, BATTLEANIMSTRUCT_VAR2 add hl, bc @@ -4045,15 +4198,17 @@ BattleAnimFunction_4F: ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc add [hl] - call Functionce6f1 + call BattleAnim_StepCircle ret -BattleAnimFunction_4D: +BattleAnimFunction_AncientPower: +; Object moves up and down in an arc for $20 frames and then disappear +; Obj Param: Defines range of arc motion ld hl, BATTLEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] cp $20 - jr nc, .asm_ce6ed + jr nc, .done inc [hl] ld hl, BATTLEANIMSTRUCT_PARAM add hl, bc @@ -4066,11 +4221,12 @@ BattleAnimFunction_4D: ld [hl], a ret -.asm_ce6ed +.done call DeinitBattleAnimation ret -Functionce6f1: +BattleAnim_StepCircle: +; Inches object in a circular movement where its height is 1/4 the width push af push de call BattleAnim_Sine @@ -4087,7 +4243,8 @@ Functionce6f1: ld [hl], a ret -Functionce70a: +BattleAnim_StepToTarget: +; Inches object towards the opponent's side, moving half as much in the Y axis as it did in the X axis. Uses lower nybble of A and $f ld e, a ld hl, BATTLEANIMSTRUCT_XCOORD @@ -4097,10 +4254,10 @@ Functionce70a: srl e ld hl, BATTLEANIMSTRUCT_YCOORD add hl, bc -.asm_ce719 +.loop dec [hl] dec e - jr nz, .asm_ce719 + jr nz, .loop ret BattleAnim_AnonJumptable: |