mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
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:
parent
ec343cef02
commit
4b64433816
@ -271,6 +271,50 @@
|
||||
.byte 0x2f
|
||||
.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
|
||||
.macro jumpreteq value:req, ptr:req
|
||||
jumpargeq ARG_RET_ID, \value, \ptr
|
||||
|
@ -1492,22 +1492,22 @@ Move_HEAL_BLOCK:
|
||||
loadspritegfx ANIM_TAG_BLUE_STAR
|
||||
monbg ANIM_TARGET
|
||||
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
|
||||
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, -15, 10, 1, 0
|
||||
createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, -15, 10, ANIM_TARGET, 0
|
||||
delay 7
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, 1 | 4, 4, 2, 12, 0, RGB_BLACK
|
||||
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 0, -5, 1, 0
|
||||
createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_DEF_SIDE, 4, 2, 12, 0, RGB_BLACK
|
||||
createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, 0, -5, ANIM_TARGET, 0
|
||||
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
|
||||
createsprite gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, -15, -15, 1, 0
|
||||
createspriteontargets_onpos gHealingBlueStarSpriteTemplate, ANIM_TARGET, 2, 2, -15, -15, ANIM_TARGET, 0
|
||||
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
|
||||
waitforvisualfinish
|
||||
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
|
||||
clearmonbg ANIM_TARGET
|
||||
end
|
||||
@ -6405,11 +6405,7 @@ Move_ELECTROWEB:
|
||||
clearmonbg ANIM_DEF_PARTNER
|
||||
delay 1
|
||||
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK
|
||||
|
||||
@ ElectricityEffect looks ugly against both opponents, to do later
|
||||
jumpifdoublebattle Move_ELECTROWEB_Wait
|
||||
|
||||
call ElectricityEffect
|
||||
call ElectricityEffect_OnTargets
|
||||
Move_ELECTROWEB_Wait:
|
||||
waitforvisualfinish
|
||||
end
|
||||
@ -9278,16 +9274,16 @@ Move_EERIE_IMPULSE::
|
||||
Move_VENOM_DRENCH::
|
||||
loadspritegfx ANIM_TAG_POISON_BUBBLE
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
delay 0x2
|
||||
call AcidDrench
|
||||
@ -9296,28 +9292,28 @@ Move_VENOM_DRENCH::
|
||||
clearmonbg ANIM_DEF_PARTNER
|
||||
end
|
||||
AcidDrench:
|
||||
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 0x0
|
||||
launchtemplate gVenomDrenchAcidTemplate 0x82, 0x4, 0xffec 0x0 0xfff6 1
|
||||
playsewithpan SE_M_BUBBLE3, SOUND_PAN_TARGET
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
delay 0x2
|
||||
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 0xFFDA 0xFF94 0x10 @between up and upper left
|
||||
waitforvisualfinish
|
||||
createvisualtaskontargets AnimTask_ShakeMon2, 5, 0, ANIM_TARGET, 2, 0, 18, 1
|
||||
monbg ANIM_DEF_PARTNER
|
||||
launchtemplate gOriginPulseBasicSplatTemplate 0x83 0x4 0xffb0 0xfff0 0x1 0x1
|
||||
stopsound
|
||||
@ -23375,15 +23372,15 @@ Move_OVERHEAT:
|
||||
waitforvisualfinish
|
||||
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, -5, 3, ANIM_TARGET, 0
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
createvisualtask AnimTask_CopyPalFadedToUnfaded, 5, 1
|
||||
delay 1
|
||||
@ -24209,21 +24206,40 @@ WaterBubblesEffectLong:
|
||||
ElectricityEffect:
|
||||
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET
|
||||
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
|
||||
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET
|
||||
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1, ANIM_TARGET
|
||||
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
|
||||
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET
|
||||
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0, ANIM_TARGET
|
||||
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
|
||||
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET
|
||||
createspriteontargets gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2, ANIM_TARGET
|
||||
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
|
||||
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
|
||||
|
||||
ConfusionEffect:
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
#include "battle_util.h"
|
||||
#include "bg.h"
|
||||
#include "contest.h"
|
||||
#include "decompress.h"
|
||||
@ -81,7 +82,9 @@ static void Cmd_visible(void);
|
||||
static void Cmd_teamattack_moveback(void);
|
||||
static void Cmd_teamattack_movefwd(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 Task_UpdateMonBg(u8 taskId);
|
||||
static void FlipBattlerBgTiles(void);
|
||||
@ -169,6 +172,9 @@ static void (* const sScriptCmdTable[])(void) =
|
||||
Cmd_teamattack_moveback, // 0x2D
|
||||
Cmd_teamattack_movefwd, // 0x2E
|
||||
Cmd_stopsound, // 0x2F
|
||||
Cmd_createvisualtaskontargets, // 0x30
|
||||
Cmd_createspriteontargets, // 0x31
|
||||
Cmd_createspriteontargets_onpos, // 0x32
|
||||
};
|
||||
|
||||
void ClearBattleAnimationVars(void)
|
||||
@ -425,29 +431,46 @@ static void Cmd_unloadspritegfx(void)
|
||||
ClearSpriteIndex(GET_TRUE_SPRITE_INDEX(index));
|
||||
}
|
||||
|
||||
static void Cmd_createsprite(void)
|
||||
static u8 GetBattleAnimMoveTargets(u8 battlerArgIndex, u8 *targets)
|
||||
{
|
||||
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++)
|
||||
u8 numTargets = 1;
|
||||
switch (GetBattlerMoveTargetType(gBattleAnimAttacker, gAnimMoveIndex))
|
||||
{
|
||||
gBattleAnimArgs[i] = T1_READ_16(sBattleAnimScriptPtr);
|
||||
sBattleAnimScriptPtr += 2;
|
||||
case MOVE_TARGET_BOTH:
|
||||
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)
|
||||
{
|
||||
argVar ^= ANIMSPRITE_IS_TARGET;
|
||||
@ -471,6 +494,34 @@ static void Cmd_createsprite(void)
|
||||
if (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(
|
||||
template,
|
||||
GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2),
|
||||
@ -479,6 +530,85 @@ static void Cmd_createsprite(void)
|
||||
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)
|
||||
{
|
||||
TaskFunc taskFunc;
|
||||
@ -509,6 +639,48 @@ static void Cmd_createvisualtask(void)
|
||||
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)
|
||||
{
|
||||
sBattleAnimScriptPtr++;
|
||||
|
@ -4806,8 +4806,8 @@ void AnimTask_CycleMagicalLeafPal(u8 taskId)
|
||||
|
||||
void AnimNeedleArmSpike(struct Sprite *sprite)
|
||||
{
|
||||
u8 a;
|
||||
u8 b;
|
||||
s16 a;
|
||||
s16 b;
|
||||
u16 c;
|
||||
u16 x;
|
||||
u16 y;
|
||||
@ -4820,13 +4820,27 @@ void AnimNeedleArmSpike(struct Sprite *sprite)
|
||||
{
|
||||
if (gBattleAnimArgs[0] == 0)
|
||||
{
|
||||
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
||||
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
SetAverageBattlerPositions(gBattleAnimAttacker, TRUE, &a, &b);
|
||||
}
|
||||
else
|
||||
{
|
||||
a = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
|
||||
b = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
|
||||
b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
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];
|
||||
|
@ -6833,7 +6833,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
.accuracy = 100,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_SELECTED,
|
||||
.target = MOVE_TARGET_BOTH,
|
||||
.priority = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
.zMovePower = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user