From d999092689d5b42de44e7fc59c8fe649f3f636d2 Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Tue, 28 May 2024 10:17:52 +0200 Subject: [PATCH] Upgraded Dragon Darts Animation (#4620) * Upgraded Dragon Darts Animation * Fixed Dragon Darts not workin in link battles * Apply suggestions from code review Co-authored-by: Bassoonian --------- Co-authored-by: Hedara Co-authored-by: Bassoonian --- asm/macros/battle_anim_script.inc | 13 ++++ data/battle_anim_scripts.s | 4 +- .../battle_anims/sprites/dreepy_missile.pal | 19 ++++++ .../battle_anims/sprites/dreepy_missile.png | Bin 281 -> 4400 bytes .../sprites/dreepy_missile_shiny.pal | 19 ++++++ include/battle_anim.h | 3 + include/constants/battle_anim.h | 1 + include/graphics.h | 2 + src/battle_anim.c | 61 ++++++++++++++++++ src/battle_anim_dragon.c | 33 ++++++++++ src/battle_anim_new.c | 34 +++++++++- src/data/battle_anim.h | 2 + src/graphics.c | 2 + 13 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 graphics/battle_anims/sprites/dreepy_missile.pal create mode 100644 graphics/battle_anims/sprites/dreepy_missile_shiny.pal diff --git a/asm/macros/battle_anim_script.inc b/asm/macros/battle_anim_script.inc index 742cdb2f26..ecfea5c197 100644 --- a/asm/macros/battle_anim_script.inc +++ b/asm/macros/battle_anim_script.inc @@ -315,6 +315,19 @@ .Lsprite_\@_2: .endm +.macro createdragondartsprite anim_battler:req, subpriority_offset:req, argv:vararg + .byte 0x33 + .if \anim_battler == ANIM_TARGET + .byte ANIMSPRITE_IS_TARGET | (\subpriority_offset & 0x7F) + .else + .byte (\subpriority_offset & 0x7F) + .endif + .byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2 +.Lsprite_\@_1: + .2byte \argv +.Lsprite_\@_2: + .endm + @ useful macros .macro jumpreteq value:req, ptr:req jumpargeq ARG_RET_ID, \value, \ptr diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 13982a59f9..2bef0a0858 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -13865,10 +13865,12 @@ Move_MAGIC_POWDER:: end Move_DRAGON_DARTS:: + loadspritegfx ANIM_TAG_DREEPY_SHINY loadspritegfx ANIM_TAG_DREEPY + loadspritegfx ANIM_TAG_AIR_WAVE loadspritegfx ANIM_TAG_EXPLOSION playsewithpan SE_FALL, SOUND_PAN_ATTACKER - createsprite gDreepyMissileTemplate, ANIM_TARGET, 2, 0x0, 0x0, 0x19 + createdragondartsprite ANIM_TARGET, 2, 0x0, 0x0, 0x19 delay 0x19 playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 16, 1 diff --git a/graphics/battle_anims/sprites/dreepy_missile.pal b/graphics/battle_anims/sprites/dreepy_missile.pal new file mode 100644 index 0000000000..906cfa8a24 --- /dev/null +++ b/graphics/battle_anims/sprites/dreepy_missile.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +153 217 234 +254 87 103 +77 119 117 +62 67 67 +170 237 211 +138 189 179 +121 163 146 +77 119 117 +251 234 137 +195 97 109 +78 52 54 +222 214 198 +173 146 118 +151 135 135 +122 105 94 +0 4 1 diff --git a/graphics/battle_anims/sprites/dreepy_missile.png b/graphics/battle_anims/sprites/dreepy_missile.png index 73fe2d2f2144eb891d34487d77043a35dc87dad1..49333681cf21a928b9fd0b486fa7d32ac01f17e7 100644 GIT binary patch literal 4400 zcmeHKe{dAl9p6g=iAO^Uq@5Jetm_QM(7oN;+r7Kp<^tg^kds`9$)&`|2z$HlE<3qj zx!oj}Gzd~9k~lD+)PaeLrNs^dR0Ex%O@&s5;3x%Ks!m%Q6`4V(1c^GL(WKwqyZmaM z>13wRj_;GlpTg-U?3*^tj%#GU4wd{?J+I-az%< zpx0ZB<-h|VO<9;p$3Qbpu`^7WnC`U=+Cs2(jNTTT<{14GVBem$p8~rmjmZGpYRbTJ zq3?ypfSnKhA!tfhYORxC>z^Fs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6^7X4kA-Gg4qi;Mwf@zsY5ue4Rp3_!ZO!FH2Vr{HzRKwCL(efBD|OT^n5&^0l>; zy4{DaU+jMQSo?w9@Hld9`)M&!#o7no8aT4M_35sz4&@;%%M|_Opa8zN#Va0AF>Kx< zy_v9my#+9st$BUr*&og+SYW#6wV&)DVCaC?Q|2$aAZ;w@+%lGFzA@IdbGYL7WAFZD zxbS4xyw3dmHEVwqdS_?#&HHKc*nyAcyz<@A$CN!^U%y)T-oWNt;q`4lcOAL&m9YyO zHk7Era6>~wsi*W)HSy9*H~rEl$Jxi9{q-62%cju2Z3AOtd4C?}jvv;ZZvJrdi95b} zeqgDkc(mgD=-AiCdU_W2t-bX{U2pFP_ji8z?yH4$Ti$=YE3fep>x<1MYW%%d6nnr%8gt94FP=f3IG5A delta 253 zcmVLx- z_AAt#gw{{R18UaEAtvNN(CZtVZ^Q0vOha<~8k!?(<|)X;K-Mf@|< z(&Fd;M=1CnHZAi5vUk3Jn~Ee2(!!sQ9wz8PLT>;7{1!wDh(5nQ00000NkvXXu0mjf D?T>|H diff --git a/graphics/battle_anims/sprites/dreepy_missile_shiny.pal b/graphics/battle_anims/sprites/dreepy_missile_shiny.pal new file mode 100644 index 0000000000..718b2d2400 --- /dev/null +++ b/graphics/battle_anims/sprites/dreepy_missile_shiny.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +153 217 234 +222 223 109 +77 119 117 +62 67 67 +170 237 211 +138 189 179 +77 171 225 +53 110 226 +251 234 137 +195 97 109 +78 52 54 +222 214 198 +173 146 118 +151 135 135 +122 105 94 +0 4 1 diff --git a/include/battle_anim.h b/include/battle_anim.h index fafde10c5b..c17de9180c 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -537,6 +537,9 @@ extern const union AnimCmd *const gAnims_WillOWispOrb[]; extern const union AnimCmd *const gAnims_FirePlume[]; // battle_anim_dragon.c +extern const union AnimCmd *const gAnims_DreepyMissilePlayer[]; +extern const union AnimCmd *const gAnims_DreepyMissileOpponent[]; +extern const union AnimCmd *const gAnims_DreepyMissileOpponentNotDrag[]; extern const union AnimCmd *const gAnims_DragonBreathFire[]; extern const union AnimCmd *const gAnims_DragonRageFirePlume[]; extern const union AffineAnimCmd *const gAffineAnims_DragonRageFire[]; diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index bde2458508..613f39098f 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -407,6 +407,7 @@ #define ANIM_TAG_SYRUP_SPLAT_YELLOW (ANIM_SPRITES_START + 393) #define ANIM_TAG_TERA_CRYSTAL (ANIM_SPRITES_START + 394) #define ANIM_TAG_TERA_SHATTER (ANIM_SPRITES_START + 395) +#define ANIM_TAG_DREEPY_SHINY (ANIM_SPRITES_START + 396) // battlers #define ANIM_ATTACKER 0 diff --git a/include/graphics.h b/include/graphics.h index a563cb064a..488f9f5616 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2752,6 +2752,8 @@ extern const u32 gBattleAnimSpriteGfx_DragonPulseRing[]; extern const u32 gBattleAnimSpritePal_DragonPulseRing[]; extern const u32 gBattleAnimSpriteGfx_DreepyMissile[]; extern const u32 gBattleAnimSpritePal_DreepyMissile[]; +extern const u32 gBattleAnimSpriteGfx_DreepyMissileShiny[]; +extern const u32 gBattleAnimSpritePal_DreepyMissileShiny[]; extern const u32 gBattleAnimSpriteGfx_Drill[]; extern const u32 gBattleAnimSpritePal_Drill[]; extern const u32 gBattleAnimSpriteGfx_NewEmbers[]; diff --git a/src/battle_anim.c b/src/battle_anim.c index deb56db036..d944aac562 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -85,6 +85,7 @@ static void Cmd_stopsound(void); static void Cmd_createvisualtaskontargets(void); static void Cmd_createspriteontargets(void); static void Cmd_createspriteontargets_onpos(void); +static void Cmd_createdragondartsprite(void); static void RunAnimScriptCommand(void); static void Task_UpdateMonBg(u8 taskId); static void FlipBattlerBgTiles(void); @@ -176,6 +177,7 @@ static void (* const sScriptCmdTable[])(void) = Cmd_createvisualtaskontargets, // 0x30 Cmd_createspriteontargets, // 0x31 Cmd_createspriteontargets_onpos, // 0x32 + Cmd_createdragondartsprite, // 0x33 }; void ClearBattleAnimationVars(void) @@ -2133,3 +2135,62 @@ static void Cmd_stopsound(void) m4aMPlayStop(&gMPlayInfo_SE2); sBattleAnimScriptPtr++; } + +static void Cmd_createdragondartsprite(void) +{ + s32 i; + struct SpriteTemplate template; + u8 argVar; + u8 argsCount; + s16 subpriority; + struct Pokemon *party = GetBattlerParty(gBattleAnimAttacker); + + sBattleAnimScriptPtr++; + + argVar = sBattleAnimScriptPtr[0]; + sBattleAnimScriptPtr++; + argsCount = sBattleAnimScriptPtr[0]; + sBattleAnimScriptPtr++; + + for (i = 0; i < argsCount; i++) + { + gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr); + sBattleAnimScriptPtr += 2; + } + + subpriority = GetSubpriorityForMoveAnim(argVar); + + if (GetMonData(&party[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES) == SPECIES_DRAGAPULT) + { + template.tileTag = ANIM_TAG_DREEPY; + if (IsMonShiny(&party[gBattlerPartyIndexes[gBattleAnimAttacker]]) == TRUE) + template.paletteTag = ANIM_TAG_DREEPY_SHINY; + else + template.paletteTag = ANIM_TAG_DREEPY; + template.oam = &gOamData_AffineOff_ObjNormal_32x32; + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + template.anims = gAnims_DreepyMissileOpponent; + else + template.anims = gAnims_DreepyMissilePlayer; + } + else + { + template.tileTag = ANIM_TAG_AIR_WAVE; + template.paletteTag = ANIM_TAG_DREEPY; + template.oam = &gOamData_AffineOff_ObjNormal_32x16; + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) + template.anims = gAnims_DreepyMissileOpponentNotDrag; + else + template.anims = gAnims_DreepyMissilePlayer; + } + + template.images = NULL; + template.affineAnims = gDummySpriteAffineAnimTable; + template.callback = AnimShadowBall; + + if (CreateSpriteAndAnimate(&template, + GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2), + GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET), + subpriority) != MAX_SPRITES) // Don't increment the task count if the sprite couldn't be created(i.e. there are too many created sprites atm). + gAnimVisualTaskCount++; +} diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 1398d899b3..4191c42585 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -42,6 +42,39 @@ const struct SpriteTemplate gOutrageFlameSpriteTemplate = .callback = AnimOutrageFlame, }; +static const union AnimCmd sAnim_DreepyMissileOpponent_0[] = +{ + ANIMCMD_FRAME(0, 0, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gAnims_DreepyMissileOpponent[] = +{ + sAnim_DreepyMissileOpponent_0, +}; + +static const union AnimCmd sAnim_DreepyMissilePlayer_0[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END, +}; + +const union AnimCmd *const gAnims_DreepyMissilePlayer[] = +{ + sAnim_DreepyMissilePlayer_0, +}; + +static const union AnimCmd sAnim_DreepyMissileNotDrag_0[] = +{ + ANIMCMD_FRAME(0, 0, .hFlip = TRUE, .vFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gAnims_DreepyMissileOpponentNotDrag[] = +{ + sAnim_DreepyMissileNotDrag_0, +}; + static const union AnimCmd sAnim_DragonBreathFire_0[] = { ANIMCMD_FRAME(16, 3), diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index fed928e747..98af6c22ba 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -3712,12 +3712,42 @@ const struct SpriteTemplate gMagicPowderBluePowderTemplate = }; //dreepy missile -const struct SpriteTemplate gDreepyMissileTemplate = +const struct SpriteTemplate gDreepyMissilePlayerTemplate = { .tileTag = ANIM_TAG_DREEPY, .paletteTag = ANIM_TAG_DREEPY, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gDummySpriteAnimTable, + .anims = gAnims_DreepyMissilePlayer, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimShadowBall +}; +const struct SpriteTemplate gDreepyMissileOpponentTemplate = +{ + .tileTag = ANIM_TAG_DREEPY, + .paletteTag = ANIM_TAG_DREEPY, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_DreepyMissileOpponent, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimShadowBall +}; +const struct SpriteTemplate gDreepyMissilePlayerShinyTemplate = +{ + .tileTag = ANIM_TAG_DREEPY, + .paletteTag = ANIM_TAG_DREEPY_SHINY, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_DreepyMissilePlayer, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimShadowBall +}; +const struct SpriteTemplate gDreepyMissileOpponentShinyTemplate = +{ + .tileTag = ANIM_TAG_DREEPY, + .paletteTag = ANIM_TAG_DREEPY_SHINY, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = gAnims_DreepyMissileOpponent, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimShadowBall diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index 6b29a7c9ef..485519cdc5 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1456,6 +1456,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_SyrupSplat, 0x400, ANIM_TAG_SYRUP_SPLAT_YELLOW}, {gBattleAnimSpriteGfx_TeraCrystal, 0x800, ANIM_TAG_TERA_CRYSTAL}, {gBattleAnimSpriteGfx_TeraShatter, 0x0180, ANIM_TAG_TERA_SHATTER}, + {gBattleAnimSpriteGfx_DreepyMissile, 0x200, ANIM_TAG_DREEPY_SHINY}, }; const struct CompressedSpritePalette gBattleAnimPaletteTable[] = @@ -1913,6 +1914,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_SyrupYellow, ANIM_TAG_SYRUP_SPLAT_YELLOW}, {gBattleAnimSpritePal_TeraCrystal, ANIM_TAG_TERA_CRYSTAL}, {gBattleAnimSpritePal_TeraShatter, ANIM_TAG_TERA_SHATTER}, + {gBattleAnimSpritePal_DreepyMissileShiny, ANIM_TAG_DREEPY_SHINY}, }; const struct BattleAnimBackground gBattleAnimBackgroundTable[] = diff --git a/src/graphics.c b/src/graphics.c index 0d25ef7805..72e9925599 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -126,6 +126,8 @@ const u32 gBattleAnimSpritePal_DragonPulseRing[] = INCBIN_U32("graphics/battle_a const u32 gBattleAnimSpriteGfx_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.4bpp.lz"); const u32 gBattleAnimSpritePal_DreepyMissile[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.gbapal.lz"); +const u32 gBattleAnimSpriteGfx_DreepyMissileShiny[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile.4bpp.lz"); +const u32 gBattleAnimSpritePal_DreepyMissileShiny[] = INCBIN_U32("graphics/battle_anims/sprites/dreepy_missile_shiny.gbapal.lz"); const u32 gBattleAnimSpriteGfx_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.4bpp.lz"); const u32 gBattleAnimSpritePal_Drill[] = INCBIN_U32("graphics/battle_anims/sprites/drill.gbapal.lz");