Add Battle Anim cmds for dynamic Task, Sprite creation + Misc. Anim Fixes (#2649)

* add createvisualtaskontargets, createspriteontargets to fix electroweb, fiery wrath anims

* add missing semicolon

* add Cmd_createspriteontargets_onpos for heal block, fix heal block targeting

* remove duplicate func

* improve origin pulse anim

* fix IsDoubleBattle call

* venom drench acid uses average battler positions

* add GetSubpriorityForMoveAnim

* add GetBattleAnimMoveTargets for CreateSpriteOnTargets and Cmd_createvisualtaskontargets

---------

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2023-02-19 05:48:12 -05:00 committed by GitHub
parent ec343cef02
commit 4b64433816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 310 additions and 64 deletions

View File

@ -270,6 +270,50 @@
.macro stopsound .macro stopsound
.byte 0x2f .byte 0x2f
.endm .endm
@ same as createvisualtask except takes in battlerargindex, which is the battle anim arg index of the battler to loop through
.macro createvisualtaskontargets addr:req, priority:req, battlerargindex:req, argv:vararg
.byte 0x30
.4byte \addr
.byte \priority
.byte \battlerargindex
.byte (.Lcreatetask_\@_2 - .Lcreatetask_\@_1) / 2 @ num_args
.Lcreatetask_\@_1:
.2byte \argv
.Lcreatetask_\@_2:
.endm
@ same as createsprite except takes in battlerargindex, which is the battle anim arg index of the battler to loop through
.macro createspriteontargets template:req, anim_battler:req, subpriority_offset:req, battlerargindex:req, argv:vararg
.byte 0x31
.4byte \template
.if \anim_battler == ANIM_TARGET
.byte 0x80 | (\subpriority_offset & 0x7F)
.else
.byte (\subpriority_offset & 0x7F)
.endif
.byte \battlerargindex
.byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
.Lsprite_\@_1:
.2byte \argv
.Lsprite_\@_2:
.endm
@ does not overwrite gBattleAnimArgs[battlerargindex], some sprite templates are too dependent on the value (e.g. heal block)
.macro createspriteontargets_onpos template:req, anim_battler:req, subpriority_offset:req, battlerargindex:req, argv:vararg
.byte 0x32
.4byte \template
.if \anim_battler == ANIM_TARGET
.byte 0x80 | (\subpriority_offset & 0x7F)
.else
.byte (\subpriority_offset & 0x7F)
.endif
.byte \battlerargindex
.byte (.Lsprite_\@_2 - .Lsprite_\@_1) / 2
.Lsprite_\@_1:
.2byte \argv
.Lsprite_\@_2:
.endm
@ useful macros @ useful macros
.macro jumpreteq value:req, ptr:req .macro jumpreteq value:req, ptr:req

View File

@ -1492,22 +1492,22 @@ Move_HEAL_BLOCK:
loadspritegfx ANIM_TAG_BLUE_STAR loadspritegfx ANIM_TAG_BLUE_STAR
monbg ANIM_TARGET monbg ANIM_TARGET
createsoundtask SoundTask_PlaySeChangingVolume, SE_M_ABSORB_2, SOUND_PAN_TARGET, 256, -16, 0, 2 createsoundtask SoundTask_PlaySeChangingVolume, SE_M_ABSORB_2, SOUND_PAN_TARGET, 256, -16, 0, 2
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 0, -5, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, 0, -5, ANIM_TARGET, 0
delay 7 delay 7
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, -15, 10, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, -15, 10, ANIM_TARGET, 0
delay 7 delay 7
createvisualtask AnimTask_BlendBattleAnimPal, 10, 1 | 4, 4, 2, 12, 0, RGB_BLACK createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_DEF_SIDE, 4, 2, 12, 0, RGB_BLACK
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 0, -5, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, 0, -5, ANIM_TARGET, 0
delay 7 delay 7
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, -15, 10, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, -15, 10, ANIM_TARGET, 0
delay 7 delay 7
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, -15, -15, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, -15, -15, ANIM_TARGET, 0
delay 7 delay 7
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 10, -5, 1, 0 createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, 10, -5, ANIM_TARGET, 0
delay 7 delay 7
waitforvisualfinish waitforvisualfinish
delay 11 delay 11
createvisualtask AnimTask_BlendBattleAnimPal, 10, 1 | 4, 4, 2, 0, 12, RGB_BLACK createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_DEF_SIDE, 4, 2, 0, 12, RGB_BLACK
waitforvisualfinish waitforvisualfinish
clearmonbg ANIM_TARGET clearmonbg ANIM_TARGET
end end
@ -6405,11 +6405,7 @@ Move_ELECTROWEB:
clearmonbg ANIM_DEF_PARTNER clearmonbg ANIM_DEF_PARTNER
delay 1 delay 1
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK
call ElectricityEffect_OnTargets
@ ElectricityEffect looks ugly against both opponents, to do later
jumpifdoublebattle Move_ELECTROWEB_Wait
call ElectricityEffect
Move_ELECTROWEB_Wait: Move_ELECTROWEB_Wait:
waitforvisualfinish waitforvisualfinish
end end
@ -9278,16 +9274,16 @@ Move_EERIE_IMPULSE::
Move_VENOM_DRENCH:: Move_VENOM_DRENCH::
loadspritegfx ANIM_TAG_POISON_BUBBLE loadspritegfx ANIM_TAG_POISON_BUBBLE
monbg ANIM_DEF_PARTNER monbg ANIM_DEF_PARTNER
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xfffb 0x1 0xfffb 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xfffb 0x1 0xfffb 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x5 0x0 0x6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x5 0x0 0x6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x13 0x1 0xa 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x13 0x1 0xa 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffe9 0x2 0xfff6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffe9 0x2 0xfff6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
call AcidDrench call AcidDrench
@ -9296,28 +9292,28 @@ Move_VENOM_DRENCH::
clearmonbg ANIM_DEF_PARTNER clearmonbg ANIM_DEF_PARTNER
end end
AcidDrench: AcidDrench:
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x1c 0x1 0xa 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x1c 0x1 0xa 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xfff6 0x1 0xfffb 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xfff6 0x1 0xfffb 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xa 0x0 0x6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xa 0x0 0x6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x18 0x1 0xa 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x18 0x1 0xa 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffe0 0x2 0xfff6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffe0 0x2 0xfff6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x1e 0x2 0xa 0x0 launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0x1e 0x2 0xa 1
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
delay 0x2 delay 0x2
return return
@ -10175,6 +10171,7 @@ Move_ORIGIN_PULSE::
launchtemplate gOriginPulseOrbInwardTemplate 0x82 0x5 0x1 0x0 0xFF2A 0xFFAA 0x10 @between left and upper left launchtemplate gOriginPulseOrbInwardTemplate 0x82 0x5 0x1 0x0 0xFF2A 0xFFAA 0x10 @between left and upper left
launchtemplate gOriginPulseOrbInwardTemplate 0x82 0x5 0x1 0x0 0xFFDA 0xFF94 0x10 @between up and upper left launchtemplate gOriginPulseOrbInwardTemplate 0x82 0x5 0x1 0x0 0xFFDA 0xFF94 0x10 @between up and upper left
waitforvisualfinish waitforvisualfinish
createvisualtaskontargets AnimTask_ShakeMon2, 5, 0, ANIM_TARGET, 2, 0, 18, 1
monbg ANIM_DEF_PARTNER monbg ANIM_DEF_PARTNER
launchtemplate gOriginPulseBasicSplatTemplate 0x83 0x4 0xffb0 0xfff0 0x1 0x1 launchtemplate gOriginPulseBasicSplatTemplate 0x83 0x4 0xffb0 0xfff0 0x1 0x1
stopsound stopsound
@ -23375,15 +23372,15 @@ Move_OVERHEAT:
waitforvisualfinish waitforvisualfinish
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, -5, 3, ANIM_TARGET, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, -5, 3, ANIM_TARGET, 0
playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 10, 0, 25, 1 createvisualtaskontargets AnimTask_ShakeMon, 2, 0, ANIM_TARGET, 10, 0, 25, 1
delay 6 delay 6
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 8, -5, ANIM_TARGET, 0 createspriteontargets gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 2, 8, -5, ANIM_TARGET, 0
playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET
delay 8 delay 8
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 10, 10, ANIM_TARGET, 0 createspriteontargets gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 2, 10, 10, ANIM_TARGET, 0
playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET
delay 8 delay 8
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, ANIM_TARGET, 0 createspriteontargets gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 2, 0, 0, ANIM_TARGET, 0
playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET playsewithpan SE_M_FLAMETHROWER, SOUND_PAN_TARGET
createvisualtask AnimTask_CopyPalFadedToUnfaded, 5, 1 createvisualtask AnimTask_CopyPalFadedToUnfaded, 5, 1
delay 1 delay 1
@ -24209,21 +24206,40 @@ WaterBubblesEffectLong:
ElectricityEffect: ElectricityEffect:
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET
ElectricityEffectNoSound: ElectricityEffectNoSound:
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0, ANIM_TARGET
delay 2 delay 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_TARGET createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1, ANIM_TARGET
return
ElectricityEffect_OnTargets:
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, 5, 0, 5, 0, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, -5, 10, 5, 1, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, 15, 20, 5, 2, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, -15, -10, 5, 0, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, 25, 0, 5, 1, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, -8, 8, 5, 2, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, 2, -8, 5, 0, ANIM_TARGET
delay 2
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, 4, -20, 15, 5, 1, ANIM_TARGET
return return
ConfusionEffect: ConfusionEffect:

View File

@ -3,6 +3,7 @@
#include "battle_anim.h" #include "battle_anim.h"
#include "battle_controllers.h" #include "battle_controllers.h"
#include "battle_interface.h" #include "battle_interface.h"
#include "battle_util.h"
#include "bg.h" #include "bg.h"
#include "contest.h" #include "contest.h"
#include "decompress.h" #include "decompress.h"
@ -81,7 +82,9 @@ static void Cmd_visible(void);
static void Cmd_teamattack_moveback(void); static void Cmd_teamattack_moveback(void);
static void Cmd_teamattack_movefwd(void); static void Cmd_teamattack_movefwd(void);
static void Cmd_stopsound(void); static void Cmd_stopsound(void);
static void Cmd_createvisualtaskontargets(void);
static void Cmd_createspriteontargets(void);
static void Cmd_createspriteontargets_onpos(void);
static void RunAnimScriptCommand(void); static void RunAnimScriptCommand(void);
static void Task_UpdateMonBg(u8 taskId); static void Task_UpdateMonBg(u8 taskId);
static void FlipBattlerBgTiles(void); static void FlipBattlerBgTiles(void);
@ -169,6 +172,9 @@ static void (* const sScriptCmdTable[])(void) =
Cmd_teamattack_moveback, // 0x2D Cmd_teamattack_moveback, // 0x2D
Cmd_teamattack_movefwd, // 0x2E Cmd_teamattack_movefwd, // 0x2E
Cmd_stopsound, // 0x2F Cmd_stopsound, // 0x2F
Cmd_createvisualtaskontargets, // 0x30
Cmd_createspriteontargets, // 0x31
Cmd_createspriteontargets_onpos, // 0x32
}; };
void ClearBattleAnimationVars(void) void ClearBattleAnimationVars(void)
@ -425,29 +431,46 @@ static void Cmd_unloadspritegfx(void)
ClearSpriteIndex(GET_TRUE_SPRITE_INDEX(index)); ClearSpriteIndex(GET_TRUE_SPRITE_INDEX(index));
} }
static void Cmd_createsprite(void) static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets)
{ {
s32 i; u8 numTargets = 1;
const struct SpriteTemplate *template; switch (GetBattlerMoveTargetType(gBattleAnimAttacker, gAnimMoveIndex))
u8 argVar;
u8 argsCount;
s16 subpriority;
sBattleAnimScriptPtr++;
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
sBattleAnimScriptPtr += 4;
argVar = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
argsCount = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
for (i = 0; i < argsCount; i++)
{ {
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr); case MOVE_TARGET_BOTH:
sBattleAnimScriptPtr += 2; targets[0] = gBattleAnimArgs[battlerArgIndex];
numTargets = 1;
if (IsBattlerAlive(targets[0] ^ BIT_FLANK)) {
targets[1] = targets[0] ^ BIT_FLANK;
numTargets++;
}
break;
case MOVE_TARGET_FOES_AND_ALLY:
targets[0] = gBattleAnimArgs[battlerArgIndex];
numTargets = 1;
if (IsBattlerAlive(targets[0] ^ BIT_FLANK)) {
targets[1] = targets[0] ^ BIT_FLANK;
numTargets++;
}
if (IsBattlerAlive(gBattleAnimAttacker ^ BIT_FLANK)) {
targets[2] = gBattleAnimAttacker ^ BIT_FLANK;
numTargets++;
}
break;
default:
targets[0] = gBattleAnimArgs[battlerArgIndex]; // original
numTargets = 1;
break;
} }
return numTargets;
}
static s16 GetSubpriorityForMoveAnim(u8 argVar)
{
s16 subpriority;
if (argVar & ANIMSPRITE_IS_TARGET) if (argVar & ANIMSPRITE_IS_TARGET)
{ {
argVar ^= ANIMSPRITE_IS_TARGET; argVar ^= ANIMSPRITE_IS_TARGET;
@ -470,6 +493,34 @@ static void Cmd_createsprite(void)
if (subpriority < 3) if (subpriority < 3)
subpriority = 3; subpriority = 3;
return subpriority;
}
static void Cmd_createsprite(void)
{
s32 i;
const struct SpriteTemplate *template;
u8 argVar;
u8 argsCount;
s16 subpriority;
sBattleAnimScriptPtr++;
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
sBattleAnimScriptPtr += 4;
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);
CreateSpriteAndAnimate( CreateSpriteAndAnimate(
template, template,
@ -479,6 +530,85 @@ static void Cmd_createsprite(void)
gAnimVisualTaskCount++; gAnimVisualTaskCount++;
} }
static void CreateSpriteOnTargets(const struct SpriteTemplate *template, u8 argVar, u8 battlerArgIndex, u8 argsCount, bool32 overwriteAnimTgt)
{
u32 i;
u8 targets[MAX_BATTLERS_COUNT];
int ntargets;
s16 subpriority;
for (i = 0; i < argsCount; i++)
{
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
sBattleAnimScriptPtr += 2;
}
subpriority = GetSubpriorityForMoveAnim(argVar);
ntargets = GetBattleAnimMoveTargets(battlerArgIndex, targets);
for (i = 0; i < ntargets; i++) {
if (overwriteAnimTgt)
gBattleAnimArgs[battlerArgIndex] = targets[i];
CreateSpriteAndAnimate(
template,
GetBattlerSpriteCoord(targets[i], BATTLER_COORD_X_2),
GetBattlerSpriteCoord(targets[i], BATTLER_COORD_Y_PIC_OFFSET),
subpriority);
gAnimVisualTaskCount++;
}
}
// will NOT overwrite gBattleAnimArgs
static void Cmd_createspriteontargets_onpos(void)
{
const struct SpriteTemplate *template;
u8 argVar;
u8 argsCount;
u8 battlerArgIndex;
sBattleAnimScriptPtr++;
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
sBattleAnimScriptPtr += 4;
argVar = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
battlerArgIndex = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
argsCount = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
CreateSpriteOnTargets(template, argVar, battlerArgIndex, argsCount, FALSE);
}
// DOES overwrite gBattleAnimArgs
static void Cmd_createspriteontargets(void)
{
const struct SpriteTemplate *template;
u8 argVar;
u8 argsCount;
u8 battlerArgIndex;
sBattleAnimScriptPtr++;
template = (const struct SpriteTemplate *)(T2_READ_32(sBattleAnimScriptPtr));
sBattleAnimScriptPtr += 4;
argVar = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
battlerArgIndex = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
argsCount = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
CreateSpriteOnTargets(template, argVar, battlerArgIndex, argsCount, TRUE);
}
static void Cmd_createvisualtask(void) static void Cmd_createvisualtask(void)
{ {
TaskFunc taskFunc; TaskFunc taskFunc;
@ -509,6 +639,48 @@ static void Cmd_createvisualtask(void)
gAnimVisualTaskCount++; gAnimVisualTaskCount++;
} }
static void Cmd_createvisualtaskontargets(void)
{
TaskFunc taskFunc;
u8 taskPriority;
u8 taskId;
u8 numArgs;
u8 battlerArgIndex; // index in gBattleAnimArgs that has the battlerId
s32 i;
u8 targets[MAX_BATTLERS_COUNT] = {0};
sBattleAnimScriptPtr++;
taskFunc = (TaskFunc)T2_READ_32(sBattleAnimScriptPtr);
sBattleAnimScriptPtr += 4;
taskPriority = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
battlerArgIndex = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
numArgs = sBattleAnimScriptPtr[0];
sBattleAnimScriptPtr++;
// copy task arguments
for (i = 0; i < numArgs; i++) {
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
sBattleAnimScriptPtr += 2;
}
numArgs = GetBattleAnimMoveTargets(battlerArgIndex, targets);
for (i = 0; i < numArgs; i++)
{
gBattleAnimArgs[battlerArgIndex] = targets[i];
taskId = CreateTask(taskFunc, taskPriority);
taskFunc(taskId);
gAnimVisualTaskCount++;
}
}
static void Cmd_delay(void) static void Cmd_delay(void)
{ {
sBattleAnimScriptPtr++; sBattleAnimScriptPtr++;

View File

@ -4806,8 +4806,8 @@ void AnimTask_CycleMagicalLeafPal(u8 taskId)
void AnimNeedleArmSpike(struct Sprite *sprite) void AnimNeedleArmSpike(struct Sprite *sprite)
{ {
u8 a; s16 a;
u8 b; s16 b;
u16 c; u16 c;
u16 x; u16 x;
u16 y; u16 y;
@ -4820,13 +4820,27 @@ void AnimNeedleArmSpike(struct Sprite *sprite)
{ {
if (gBattleAnimArgs[0] == 0) if (gBattleAnimArgs[0] == 0)
{ {
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); if (IsDoubleBattle())
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); {
SetAverageBattlerPositions(gBattleAnimAttacker, TRUE, &a, &b);
}
else
{
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
}
} }
else else
{ {
a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); if (IsDoubleBattle())
b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); {
SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &a, &b);
}
else
{
a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
}
} }
sprite->data[0] = gBattleAnimArgs[4]; sprite->data[0] = gBattleAnimArgs[4];

View File

@ -6833,7 +6833,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.accuracy = 100, .accuracy = 100,
.pp = 15, .pp = 15,
.secondaryEffectChance = 0, .secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED, .target = MOVE_TARGET_BOTH,
.priority = 0, .priority = 0,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
.zMovePower = 0, .zMovePower = 0,