Animation for Tupsy Toruvy

This commit is contained in:
DizzyEggg 2020-04-16 16:52:25 +02:00
parent 81617eb577
commit 90486324c6
3 changed files with 81 additions and 1 deletions

View File

@ -4372,6 +4372,20 @@ Move_PARTING_SHOT:
end
Move_TOPSY_TURVY:
loadspritegfx ANIM_TAG_SWEAT_DROP
setalpha 12, 8
createsprite gSimplePaletteBlendSpriteTemplate ANIM_TARGET, 2, 1, 2, 0, 4, RGB_BLACK
waitforvisualfinish
createvisualtask AnimTask_RotateVertically, 2, ANIM_TARGET, 768
createsprite gSimplePaletteBlendSpriteTemplate ANIM_TARGET, 2, 4, 5, 0, 8, RGB(9, 0, 16)
playsewithpan SE_HI_TURUN, SOUND_PAN_TARGET
delay 116
createsprite gSimplePaletteBlendSpriteTemplate ANIM_TARGET, 2, 4, 5, 8, 0, RGB(9, 0, 16)
playsewithpan SE_RU_HYUU, SOUND_PAN_TARGET
waitforvisualfinish
createsprite gSimplePaletteBlendSpriteTemplate ANIM_TARGET, 2, 1, 2, 4, 0, RGB_BLACK
waitforvisualfinish
blendoff
end
Move_DRAINING_KISS:

View File

@ -27,6 +27,7 @@ static void AnimTask_ScaleMonAndRestore_Step(u8 taskId);
static void AnimTask_RotateMonSpriteToSide_Step(u8 taskId);
static void AnimTask_ShakeTargetBasedOnMovePowerOrDmg_Step(u8 taskId);
static void AnimTask_SlideOffScreen_Step(u8 taskId);
static void AnimTask_RotateVerticallyStep(u8 taskId);
const struct SpriteTemplate gHorizontalLungeSpriteTemplate =
{
@ -1062,3 +1063,68 @@ static void AnimTask_ShakeTargetBasedOnMovePowerOrDmg_Step(u8 taskId)
}
}
}
#define tSpriteId data[0]
#define tRotSpeed data[1]
#define tRotCurr data[2]
#define tPhase data[3]
#define tFrames data[4]
#define tPlayerSide data[5]
#define tRotMax data[6] // Can't fully flip back sprites
void AnimTask_RotateVertically(u8 taskId)
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
gTasks[taskId].tSpriteId = spriteId;
gTasks[taskId].tRotCurr = 0;
gTasks[taskId].tPlayerSide = ((GetBattlerSide(GetAnimBattlerId(gBattleAnimArgs[0]))) == B_SIDE_PLAYER);
gTasks[taskId].tRotMax = gTasks[taskId].tPlayerSide ? 0x1FFF : 0x7FFE;
gTasks[taskId].tRotSpeed = gBattleAnimArgs[1];
gTasks[taskId].func = AnimTask_RotateVerticallyStep;
}
static void AnimTask_RotateVerticallyStep(u8 taskId)
{
switch (gTasks[taskId].tPhase)
{
case 0: // flip upside-down
gTasks[taskId].tRotCurr = min(abs(gTasks[taskId].tRotCurr + gTasks[taskId].tRotSpeed), gTasks[taskId].tRotMax);
SetSpriteRotScale(gTasks[taskId].tSpriteId, 0x100, 0x100, gTasks[taskId].tRotCurr);
if (gTasks[taskId].tPlayerSide)
SetBattlerSpriteYOffsetFromRotation(gTasks[taskId].tSpriteId);
if (gTasks[taskId].tRotCurr == gTasks[taskId].tRotMax)
gTasks[taskId].tPhase++;
break;
case 1: // Wait a bit
if (++gTasks[taskId].tFrames >= 75)
gTasks[taskId].tPhase++;
break;
case 2: // rotate back
if (gTasks[taskId].tRotCurr < gTasks[taskId].tRotSpeed)
gTasks[taskId].tRotCurr = 0;
else
gTasks[taskId].tRotCurr = gTasks[taskId].tRotCurr - gTasks[taskId].tRotSpeed;
SetSpriteRotScale(gTasks[taskId].tSpriteId, 0x100, 0x100, gTasks[taskId].tRotCurr);
if (gTasks[taskId].tPlayerSide)
SetBattlerSpriteYOffsetFromRotation(gTasks[taskId].tSpriteId);
if (gTasks[taskId].tRotCurr == 0)
gTasks[taskId].tPhase++;
break;
case 3: // end
ResetSpriteRotScale(gTasks[taskId].tSpriteId);
DestroyAnimVisualTask(taskId);
break;
}
}
#undef tSpriteId
#undef tRotSpeed
#undef tRotCurr
#undef tPhase
#undef tFrames
#undef tPlayerSide
#undef tRotMax

View File

@ -617,7 +617,7 @@ static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} bl
static const u8 sText_StickyWebUsed[] = _("A sticky web spreads out on the\nground around {B_DEF_TEAM2} team!");
static const u8 sText_QuashSuccess[] = _("The opposing {B_ATK_NAME_WITH_PREFIX}'s move was postponed!");
static const u8 sText_IonDelugeOn[] = _("A deluge of ions showers\nthe battlefield!");
static const u8 sText_TopsyTurvySwitchedStats[] = _("{B_ATK_NAME_WITH_PREFIX}'s stat changes were\nall reversed!");
static const u8 sText_TopsyTurvySwitchedStats[] = _("{B_DEF_NAME_WITH_PREFIX}'s stat changes were\nall reversed!");
static const u8 sText_TerrainBecomesMisty[] = _("Mist swirled about\nthe battlefield!");
static const u8 sText_TerrainBecomesGrassy[] = _("Grass grew to cover\nthe battlefield!");
static const u8 sText_TerrainBecomesElectric[] = _("An electric current runs across\nthe battlefield!");