Merge pull request #1909 from GriffinRichards/stat-anim

Document stat change animation
This commit is contained in:
GriffinR 2023-08-20 14:29:11 -04:00 committed by GitHub
commit 4941e2602a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 202 additions and 149 deletions

View File

Before

Width:  |  Height:  |  Size: 430 B

After

Width:  |  Height:  |  Size: 430 B

View File

@ -192,14 +192,26 @@ u8 GetBattlerSpriteDefault_Y(u8 battlerId);
u8 GetSubstituteSpriteDefault_Y(u8 battlerId);
// battle_anim_status_effects.c
#define STAT_ANIM_PLUS1 15
#define STAT_ANIM_PLUS2 39
#define STAT_ANIM_MINUS1 22
#define STAT_ANIM_MINUS2 46
#define STAT_ANIM_PLUS1 14
#define STAT_ANIM_PLUS2 38
#define STAT_ANIM_MINUS1 21
#define STAT_ANIM_MINUS2 45
#define STAT_ANIM_MULTIPLE_PLUS1 55
#define STAT_ANIM_MULTIPLE_PLUS2 56
#define STAT_ANIM_MULTIPLE_MINUS1 57
#define STAT_ANIM_MULTIPLE_MINUS2 58
enum {
STAT_ANIM_PAL_ATK,
STAT_ANIM_PAL_DEF,
STAT_ANIM_PAL_ACC,
STAT_ANIM_PAL_SPEED,
STAT_ANIM_PAL_EVASION,
STAT_ANIM_PAL_SPATK,
STAT_ANIM_PAL_SPDEF,
STAT_ANIM_PAL_MULTIPLE = 0xFF
};
void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId);
// battle_anim_ground.c

View File

@ -4769,17 +4769,18 @@ extern const u32 gMetalShineTilemap[];
extern const u32 gBattleAnimMaskImage_Curse[];
extern const u32 gBattleAnimMaskTilemap_Curse[];
extern const u32 gBattleStatMask_Gfx[];
extern const u32 gBattleStatMask1_Tilemap[];
extern const u32 gBattleStatMask2_Tilemap[];
extern const u32 gBattleStatMask1_Pal[];
extern const u32 gBattleStatMask2_Pal[];
extern const u32 gBattleStatMask3_Pal[];
extern const u32 gBattleStatMask4_Pal[];
extern const u32 gBattleStatMask5_Pal[];
extern const u32 gBattleStatMask6_Pal[];
extern const u32 gBattleStatMask7_Pal[];
extern const u32 gBattleStatMask8_Pal[];
extern const u32 gStatAnim_Gfx[];
extern const u32 gStatAnim_Increase_Tilemap[];
extern const u32 gStatAnim_Decrease_Tilemap[];
extern const u32 gStatAnim_Defense_Pal[];
extern const u32 gStatAnim_Attack_Pal[];
extern const u32 gStatAnim_Accuracy_Pal[];
extern const u32 gStatAnim_Speed_Pal[];
extern const u32 gStatAnim_Multiple_Pal[];
extern const u32 gStatAnim_Evasion_Pal[];
extern const u32 gStatAnim_SpAttack_Pal[];
extern const u32 gStatAnim_SpDefense_Pal[];
extern const u32 gContestInterfaceGfx[];
extern const u32 gContestAudienceGfx[];

View File

@ -480,8 +480,6 @@ static void AnimTask_FrozenIceCube_Step4(u8 taskId)
}
}
#define CASE(by, stat) case (STAT_ANIM_##by + stat - 1)
void AnimTask_StatsChange(u8 taskId)
{
bool16 goesDown = FALSE;
@ -490,42 +488,42 @@ void AnimTask_StatsChange(u8 taskId)
switch (gBattleSpritesDataPtr->animationData->animArg)
{
CASE(PLUS1, STAT_ATK): goesDown = FALSE; animStatId = 0; break;
CASE(PLUS1, STAT_DEF): goesDown = FALSE; animStatId = 1; break;
CASE(PLUS1, STAT_SPEED): goesDown = FALSE; animStatId = 3; break;
CASE(PLUS1, STAT_SPATK): goesDown = FALSE; animStatId = 5; break;
CASE(PLUS1, STAT_SPDEF): goesDown = FALSE; animStatId = 6; break;
CASE(PLUS1, STAT_ACC): goesDown = FALSE; animStatId = 2; break;
CASE(PLUS1, STAT_EVASION): goesDown = FALSE; animStatId = 4; break;
case STAT_ANIM_PLUS1 + STAT_ATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ATK; break;
case STAT_ANIM_PLUS1 + STAT_DEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_DEF; break;
case STAT_ANIM_PLUS1 + STAT_SPEED: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPEED; break;
case STAT_ANIM_PLUS1 + STAT_SPATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPATK; break;
case STAT_ANIM_PLUS1 + STAT_SPDEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPDEF; break;
case STAT_ANIM_PLUS1 + STAT_ACC: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ACC; break;
case STAT_ANIM_PLUS1 + STAT_EVASION: goesDown = FALSE; animStatId = STAT_ANIM_PAL_EVASION; break;
CASE(MINUS1, STAT_ATK): goesDown = TRUE; animStatId = 0; break;
CASE(MINUS1, STAT_DEF): goesDown = TRUE; animStatId = 1; break;
CASE(MINUS1, STAT_SPEED): goesDown = TRUE; animStatId = 3; break;
CASE(MINUS1, STAT_SPATK): goesDown = TRUE; animStatId = 5; break;
CASE(MINUS1, STAT_SPDEF): goesDown = TRUE; animStatId = 6; break;
CASE(MINUS1, STAT_ACC): goesDown = TRUE; animStatId = 2; break;
CASE(MINUS1, STAT_EVASION): goesDown = TRUE; animStatId = 4; break;
case STAT_ANIM_MINUS1 + STAT_ATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ATK; break;
case STAT_ANIM_MINUS1 + STAT_DEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_DEF; break;
case STAT_ANIM_MINUS1 + STAT_SPEED: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPEED; break;
case STAT_ANIM_MINUS1 + STAT_SPATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPATK; break;
case STAT_ANIM_MINUS1 + STAT_SPDEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPDEF; break;
case STAT_ANIM_MINUS1 + STAT_ACC: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ACC; break;
case STAT_ANIM_MINUS1 + STAT_EVASION: goesDown = TRUE; animStatId = STAT_ANIM_PAL_EVASION; break;
CASE(PLUS2, STAT_ATK): goesDown = FALSE; animStatId = 0; sharply = TRUE; break;
CASE(PLUS2, STAT_DEF): goesDown = FALSE; animStatId = 1; sharply = TRUE; break;
CASE(PLUS2, STAT_SPEED): goesDown = FALSE; animStatId = 3; sharply = TRUE; break;
CASE(PLUS2, STAT_SPATK): goesDown = FALSE; animStatId = 5; sharply = TRUE; break;
CASE(PLUS2, STAT_SPDEF): goesDown = FALSE; animStatId = 6; sharply = TRUE; break;
CASE(PLUS2, STAT_ACC): goesDown = FALSE; animStatId = 2; sharply = TRUE; break;
CASE(PLUS2, STAT_EVASION): goesDown = FALSE; animStatId = 4; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_ATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ATK; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_DEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_DEF; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_SPEED: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPEED; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_SPATK: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPATK; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_SPDEF: goesDown = FALSE; animStatId = STAT_ANIM_PAL_SPDEF; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_ACC: goesDown = FALSE; animStatId = STAT_ANIM_PAL_ACC; sharply = TRUE; break;
case STAT_ANIM_PLUS2 + STAT_EVASION: goesDown = FALSE; animStatId = STAT_ANIM_PAL_EVASION; sharply = TRUE; break;
CASE(MINUS2, STAT_ATK): goesDown = TRUE; animStatId = 0; sharply = TRUE; break;
CASE(MINUS2, STAT_DEF): goesDown = TRUE; animStatId = 1; sharply = TRUE; break;
CASE(MINUS2, STAT_SPEED): goesDown = TRUE; animStatId = 3; sharply = TRUE; break;
CASE(MINUS2, STAT_SPATK): goesDown = TRUE; animStatId = 5; sharply = TRUE; break;
CASE(MINUS2, STAT_SPDEF): goesDown = TRUE; animStatId = 6; sharply = TRUE; break;
CASE(MINUS2, STAT_ACC): goesDown = TRUE; animStatId = 2; sharply = TRUE; break;
CASE(MINUS2, STAT_EVASION): goesDown = TRUE; animStatId = 4; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_ATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ATK; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_DEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_DEF; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_SPEED: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPEED; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_SPATK: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPATK; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_SPDEF: goesDown = TRUE; animStatId = STAT_ANIM_PAL_SPDEF; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_ACC: goesDown = TRUE; animStatId = STAT_ANIM_PAL_ACC; sharply = TRUE; break;
case STAT_ANIM_MINUS2 + STAT_EVASION: goesDown = TRUE; animStatId = STAT_ANIM_PAL_EVASION; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = 0xFF; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = 0xFF; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = 0xFF; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = 0xFF; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = STAT_ANIM_PAL_MULTIPLE; sharply = TRUE; break;
default:
DestroyAnimVisualTask(taskId);
@ -534,11 +532,11 @@ void AnimTask_StatsChange(u8 taskId)
gBattleAnimArgs[0] = goesDown;
gBattleAnimArgs[1] = animStatId;
gBattleAnimArgs[2] = 0;
gBattleAnimArgs[3] = 0;
gBattleAnimArgs[2] = FALSE; // Whether it's the target, rather than attacker
gBattleAnimArgs[3] = FALSE; // Whether it hits multiple battlers
gBattleAnimArgs[4] = sharply;
gTasks[taskId].func = InitStatsChangeAnimation;
InitStatsChangeAnimation(taskId);
gTasks[taskId].func(taskId);
}
#undef CASE

View File

@ -16,7 +16,7 @@ struct AnimStatsChangeData
{
u8 battler1;
u8 battler2;
u8 higherPriority;
bool8 hidBattler2;
s16 data[8];
u16 species;
};
@ -388,12 +388,33 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId)
}
}
// Defines for data array in sAnimStatsChangeData
#define aDecrease data[0]
#define aAnimStatId data[1]
#define aIsTarget data[2]
#define aMultipleBattlers data[3] // Always false. Changes for multiple battlers are instead run sequentially.
#define aSharply data[4]
// Task data defines for InitStatsChangeAnimation
#define tAnimSpriteId1 data[0]
#define tVelocity data[1]
#define tMultipleBattlers data[2]
#define tAnimSpriteId2 data[3]
#define tTargetBlend data[4]
#define tWaitTime data[5]
#define tHidBattler2 data[6]
#define tBattler2SpriteId data[7]
#define tWaitTimer data[10]
#define tFadeTimer data[11]
#define tBlend data[12]
#define tState data[15]
void InitStatsChangeAnimation(u8 taskId)
{
u8 i;
sAnimStatsChangeData = AllocZeroed(sizeof(struct AnimStatsChangeData));
for (i = 0; i < 8; i++)
for (i = 0; i < ARRAY_COUNT(sAnimStatsChangeData->data); i++)
sAnimStatsChangeData->data[i] = gBattleAnimArgs[i];
gTasks[taskId].func = StatsChangeAnimation_Step1;
@ -401,21 +422,19 @@ void InitStatsChangeAnimation(u8 taskId)
static void StatsChangeAnimation_Step1(u8 taskId)
{
if (sAnimStatsChangeData->data[2] == 0)
if (!sAnimStatsChangeData->aIsTarget)
sAnimStatsChangeData->battler1 = gBattleAnimAttacker;
else
sAnimStatsChangeData->battler1 = gBattleAnimTarget;
sAnimStatsChangeData->battler2 = BATTLE_PARTNER(sAnimStatsChangeData->battler1);
if (IsContest() || (sAnimStatsChangeData->data[3] && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2)))
sAnimStatsChangeData->data[3] = 0;
if (IsContest() || (sAnimStatsChangeData->aMultipleBattlers && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2)))
sAnimStatsChangeData->aMultipleBattlers = FALSE;
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL);
SetGpuReg(REG_OFFSET_WINOUT, (WINOUT_WIN01_ALL & ~WINOUT_WIN01_BG1) | WINOUT_WINOBJ_ALL);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
@ -424,16 +443,17 @@ static void StatsChangeAnimation_Step1(u8 taskId)
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
if (IsDoubleBattle() && sAnimStatsChangeData->data[3] == 0)
if (IsDoubleBattle() && !sAnimStatsChangeData->aMultipleBattlers)
{
if (GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_OPPONENT_RIGHT
|| GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_PLAYER_LEFT)
{
if (IsBattlerSpriteVisible(sAnimStatsChangeData->battler2) == TRUE)
{
gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority -= 1;
// Push the battler not being animated back so it doesn't receive the animation.
gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority--;
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
sAnimStatsChangeData->higherPriority = 1;
sAnimStatsChangeData->hidBattler2 = TRUE;
}
}
}
@ -462,79 +482,80 @@ static void StatsChangeAnimation_Step2(u8 taskId)
spriteId2 = 0;
battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler1];
spriteId = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species);
if (sAnimStatsChangeData->data[3])
if (sAnimStatsChangeData->aMultipleBattlers)
{
battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
spriteId2 = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species);
}
GetBattleAnimBg1Data(&animBgData);
if (sAnimStatsChangeData->data[0] == 0)
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask1_Tilemap, FALSE);
if (!sAnimStatsChangeData->aDecrease)
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gStatAnim_Increase_Tilemap, FALSE);
else
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask2_Tilemap, FALSE);
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gStatAnim_Decrease_Tilemap, FALSE);
AnimLoadCompressedBgGfx(animBgData.bgId, gBattleStatMask_Gfx, animBgData.tilesOffset);
switch (sAnimStatsChangeData->data[1])
AnimLoadCompressedBgGfx(animBgData.bgId, gStatAnim_Gfx, animBgData.tilesOffset);
switch (sAnimStatsChangeData->aAnimStatId)
{
case 0:
LoadCompressedPalette(gBattleStatMask2_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_ATK:
LoadCompressedPalette(gStatAnim_Attack_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 1:
LoadCompressedPalette(gBattleStatMask1_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_DEF:
LoadCompressedPalette(gStatAnim_Defense_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 2:
LoadCompressedPalette(gBattleStatMask3_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_ACC:
LoadCompressedPalette(gStatAnim_Accuracy_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 3:
LoadCompressedPalette(gBattleStatMask4_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_SPEED:
LoadCompressedPalette(gStatAnim_Speed_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 4:
LoadCompressedPalette(gBattleStatMask6_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_EVASION:
LoadCompressedPalette(gStatAnim_Evasion_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 5:
LoadCompressedPalette(gBattleStatMask7_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_SPATK:
LoadCompressedPalette(gStatAnim_SpAttack_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 6:
LoadCompressedPalette(gBattleStatMask8_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
case STAT_ANIM_PAL_SPDEF:
LoadCompressedPalette(gStatAnim_SpDefense_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
default:
LoadCompressedPalette(gBattleStatMask5_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
// case STAT_ANIM_PAL_MULTIPLE:
LoadCompressedPalette(gStatAnim_Multiple_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
}
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
if (sAnimStatsChangeData->data[0] == 1)
if (sAnimStatsChangeData->aDecrease == TRUE)
{
gBattle_BG1_X = 64;
gTasks[taskId].data[1] = -3;
gTasks[taskId].tVelocity = -3;
}
else
{
gTasks[taskId].data[1] = 3;
gTasks[taskId].tVelocity = 3;
}
if (sAnimStatsChangeData->data[4] == 0)
if (!sAnimStatsChangeData->aSharply)
{
gTasks[taskId].data[4] = 10;
gTasks[taskId].data[5] = 20;
gTasks[taskId].tTargetBlend = 10;
gTasks[taskId].tWaitTime = 20;
}
else
{
gTasks[taskId].data[4] = 13;
gTasks[taskId].data[5] = 30;
gTasks[taskId].tTargetBlend = 13;
gTasks[taskId].tWaitTime = 30;
}
gTasks[taskId].data[0] = spriteId;
gTasks[taskId].data[2] = sAnimStatsChangeData->data[3];
gTasks[taskId].data[3] = spriteId2;
gTasks[taskId].data[6] = sAnimStatsChangeData->higherPriority;
gTasks[taskId].data[7] = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
gTasks[taskId].tAnimSpriteId1 = spriteId;
gTasks[taskId].tMultipleBattlers = sAnimStatsChangeData->aMultipleBattlers;
gTasks[taskId].tAnimSpriteId2 = spriteId2;
gTasks[taskId].tHidBattler2 = sAnimStatsChangeData->hidBattler2;
gTasks[taskId].tBattler2SpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
gTasks[taskId].func = StatsChangeAnimation_Step3;
if (sAnimStatsChangeData->data[0] == 0)
if (!sAnimStatsChangeData->aDecrease)
PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
else
PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
@ -542,44 +563,46 @@ static void StatsChangeAnimation_Step2(u8 taskId)
static void StatsChangeAnimation_Step3(u8 taskId)
{
gBattle_BG1_Y += gTasks[taskId].data[1];
gBattle_BG1_Y += gTasks[taskId].tVelocity;
switch (gTasks[taskId].data[15])
switch (gTasks[taskId].tState)
{
case 0:
if (gTasks[taskId].data[11]++ > 0)
// Fade in
if (gTasks[taskId].tFadeTimer++ > 0)
{
gTasks[taskId].data[11] = 0;
gTasks[taskId].data[12]++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
if (gTasks[taskId].data[12] == gTasks[taskId].data[4])
gTasks[taskId].data[15]++;
gTasks[taskId].tFadeTimer = 0;
gTasks[taskId].tBlend++;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend));
if (gTasks[taskId].tBlend == gTasks[taskId].tTargetBlend)
gTasks[taskId].tState++;
}
break;
case 1:
if (++gTasks[taskId].data[10] == gTasks[taskId].data[5])
gTasks[taskId].data[15]++;
// Wait
if (++gTasks[taskId].tWaitTimer == gTasks[taskId].tWaitTime)
gTasks[taskId].tState++;
break;
case 2:
if (gTasks[taskId].data[11]++ > 0)
// Fade out
if (gTasks[taskId].tFadeTimer++ > 0)
{
gTasks[taskId].data[11] = 0;
gTasks[taskId].data[12]--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
if (gTasks[taskId].data[12] == 0)
gTasks[taskId].tFadeTimer = 0;
gTasks[taskId].tBlend--;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].tBlend, 16 - gTasks[taskId].tBlend));
if (gTasks[taskId].tBlend == 0)
{
ResetBattleAnimBg(FALSE);
gTasks[taskId].data[15]++;
gTasks[taskId].tState++;
}
}
break;
case 3:
// Reset
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_ALL | WININ_WIN1_ALL);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_ALL | WINOUT_WINOBJ_ALL);
if (!IsContest())
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
@ -587,12 +610,14 @@ static void StatsChangeAnimation_Step3(u8 taskId)
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroySprite(&gSprites[gTasks[taskId].data[0]]);
if (gTasks[taskId].data[2])
DestroySprite(&gSprites[gTasks[taskId].data[3]]);
if (gTasks[taskId].data[6] == 1)
gSprites[gTasks[taskId].data[7]].oam.priority++;
DestroySprite(&gSprites[gTasks[taskId].tAnimSpriteId1]);
if (gTasks[taskId].tMultipleBattlers)
DestroySprite(&gSprites[gTasks[taskId].tAnimSpriteId2]);
// Restore battler 2's priority
if (gTasks[taskId].tHidBattler2 == TRUE)
gSprites[gTasks[taskId].tBattler2SpriteId].oam.priority++;
FREE_AND_SET_NULL(sAnimStatsChangeData);
DestroyAnimVisualTask(taskId);
@ -600,6 +625,24 @@ static void StatsChangeAnimation_Step3(u8 taskId)
}
}
#undef aDecrease
#undef aAnimStatId
#undef aIsTarget
#undef aMultipleBattlers
#undef aSharply
#undef tAnimSpriteId1
#undef tVelocity
#undef tMultipleBattlers
#undef tAnimSpriteId2
#undef tTargetBlend
#undef tWaitTime
#undef tHidBattler2
#undef tBattler2SpriteId
#undef tWaitTimer
#undef tFadeTimer
#undef tBlend
#undef tState
void AnimTask_Flash(u8 taskId)
{
u32 selectedPalettes = GetBattleMonSpritePalettesMask(1, 1, 1, 1);

View File

@ -4061,16 +4061,16 @@ static void Cmd_setgraphicalstatchangevalues(void)
switch (GET_STAT_BUFF_VALUE2(gBattleScripting.statChanger))
{
case SET_STAT_BUFF_VALUE(1): // +1
value = STAT_ANIM_PLUS1;
value = STAT_ANIM_PLUS1 + 1;
break;
case SET_STAT_BUFF_VALUE(2): // +2
value = STAT_ANIM_PLUS2;
value = STAT_ANIM_PLUS2 + 1;
break;
case SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE: // -1
value = STAT_ANIM_MINUS1;
value = STAT_ANIM_MINUS1 + 1;
break;
case SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE: // -2
value = STAT_ANIM_MINUS2;
value = STAT_ANIM_MINUS2 + 1;
break;
}
gBattleScripting.animArg1 = GET_STAT_BUFF_ID(gBattleScripting.statChanger) + value - 1;
@ -4092,9 +4092,9 @@ static void Cmd_playstatchangeanimation(void)
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
startingStatAnimId = STAT_ANIM_MINUS2 - 1;
startingStatAnimId = STAT_ANIM_MINUS2;
else
startingStatAnimId = STAT_ANIM_MINUS1 - 1;
startingStatAnimId = STAT_ANIM_MINUS1;
while (statsToCheck != 0)
{
@ -4136,9 +4136,9 @@ static void Cmd_playstatchangeanimation(void)
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_BY_TWO)
startingStatAnimId = STAT_ANIM_PLUS2 - 1;
startingStatAnimId = STAT_ANIM_PLUS2;
else
startingStatAnimId = STAT_ANIM_PLUS1 - 1;
startingStatAnimId = STAT_ANIM_PLUS1;
while (statsToCheck != 0)
{

View File

@ -378,7 +378,7 @@ void HandleAction_UseItem(void)
gBattleTextBuff1[2]++;
}
gBattleScripting.animArg1 = gBattleTextBuff1[2] + 14;
gBattleScripting.animArg1 = gBattleTextBuff1[2] + STAT_ANIM_PLUS1;
gBattleScripting.animArg2 = 0;
}
break;
@ -2629,7 +2629,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gBattleMons[battler].statStages[STAT_SPEED] < MAX_STAT_STAGE && gDisableStructs[battler].isFirstTurn != 2)
{
gBattleMons[battler].statStages[STAT_SPEED]++;
gBattleScripting.animArg1 = 14 + STAT_SPEED;
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_SPEED;
gBattleScripting.animArg2 = 0;
BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates);
gBattleScripting.battler = battler;
@ -3233,7 +3233,7 @@ enum
PREPARE_STAT_BUFFER(gBattleTextBuff1, stat); \
gEffectBattler = battlerId; \
SET_STATCHANGER(stat, 1, FALSE); \
gBattleScripting.animArg1 = 14 + (stat); \
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + (stat); \
gBattleScripting.animArg2 = 0; \
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); \
effect = ITEM_STATS_CHANGE; \
@ -3419,7 +3419,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); // Only the Attack stat-up berry has this
gEffectBattler = battlerId;
SET_STATCHANGER(STAT_ATK, 1, FALSE);
gBattleScripting.animArg1 = 14 + STAT_ATK;
gBattleScripting.animArg1 = STAT_ANIM_PLUS1 + STAT_ATK;
gBattleScripting.animArg2 = 0;
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
@ -3474,7 +3474,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gEffectBattler = battlerId;
SET_STATCHANGER(i + 1, 2, FALSE);
gBattleScripting.animArg1 = 0x21 + i + 6;
gBattleScripting.animArg1 = STAT_ANIM_PLUS2 + (i + 1);
gBattleScripting.animArg2 = 0;
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;

View File

@ -865,18 +865,17 @@ const u32 gBattleAnimSpritePal_PinkCloud[] = INCBIN_U32("graphics/battle_anims/s
const u32 gBattleAnimSpriteGfx_SweatDrop[] = INCBIN_U32("graphics/battle_anims/sprites/sweat_drop.4bpp.lz");
const u32 gBattleAnimSpritePal_SweatDrop[] = INCBIN_U32("graphics/battle_anims/sprites/sweat_drop.gbapal.lz");
const u32 gBattleStatMask_Gfx[] = INCBIN_U32("graphics/battle_anims/masks/stat.4bpp.lz");
const u32 gBattleStatMask1_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_1.bin.lz");
const u32 gBattleStatMask2_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_2.bin.lz");
const u32 gBattleStatMask1_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat1.gbapal.lz");
const u32 gBattleStatMask2_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat2.gbapal.lz");
const u32 gBattleStatMask3_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat3.gbapal.lz");
const u32 gBattleStatMask4_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat4.gbapal.lz");
const u32 gBattleStatMask5_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat5.gbapal.lz");
const u32 gBattleStatMask6_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat6.gbapal.lz");
const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz");
const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz");
const u32 gStatAnim_Gfx[] = INCBIN_U32("graphics/battle_anims/stat_change/tiles.4bpp.lz");
const u32 gStatAnim_Increase_Tilemap[] = INCBIN_U32("graphics/battle_anims/stat_change/increase.bin.lz");
const u32 gStatAnim_Decrease_Tilemap[] = INCBIN_U32("graphics/battle_anims/stat_change/decrease.bin.lz");
const u32 gStatAnim_Defense_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/defense.gbapal.lz");
const u32 gStatAnim_Attack_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/attack.gbapal.lz");
const u32 gStatAnim_Accuracy_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/accuracy.gbapal.lz");
const u32 gStatAnim_Speed_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/speed.gbapal.lz");
const u32 gStatAnim_Multiple_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/multiple.gbapal.lz");
const u32 gStatAnim_Evasion_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/evasion.gbapal.lz");
const u32 gStatAnim_SpAttack_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/sp_attack.gbapal.lz");
const u32 gStatAnim_SpDefense_Pal[] = INCBIN_U32("graphics/battle_anims/stat_change/sp_defense.gbapal.lz");
const u32 gCureBubblesGfx[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.4bpp.lz");
const u32 gCureBubblesPal[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.gbapal.lz");