mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
STAT_ANIM constant usage
This commit is contained in:
parent
da238562f0
commit
41847cd5aa
@ -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
|
||||
|
@ -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);
|
||||
@ -538,7 +536,7 @@ void AnimTask_StatsChange(u8 taskId)
|
||||
gBattleAnimArgs[3] = 0;
|
||||
gBattleAnimArgs[4] = sharply;
|
||||
gTasks[taskId].func = InitStatsChangeAnimation;
|
||||
InitStatsChangeAnimation(taskId);
|
||||
gTasks[taskId].func(taskId);
|
||||
}
|
||||
|
||||
#undef CASE
|
||||
|
@ -393,7 +393,7 @@ 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;
|
||||
@ -477,28 +477,29 @@ static void StatsChangeAnimation_Step2(u8 taskId)
|
||||
AnimLoadCompressedBgGfx(animBgData.bgId, gBattleStatMask_Gfx, animBgData.tilesOffset);
|
||||
switch (sAnimStatsChangeData->data[1])
|
||||
{
|
||||
case 0:
|
||||
case STAT_ANIM_PAL_ATK:
|
||||
LoadCompressedPalette(gBattleStatMask2_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 1:
|
||||
case STAT_ANIM_PAL_DEF:
|
||||
LoadCompressedPalette(gBattleStatMask1_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 2:
|
||||
case STAT_ANIM_PAL_ACC:
|
||||
LoadCompressedPalette(gBattleStatMask3_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 3:
|
||||
case STAT_ANIM_PAL_SPEED:
|
||||
LoadCompressedPalette(gBattleStatMask4_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 4:
|
||||
case STAT_ANIM_PAL_EVASION:
|
||||
LoadCompressedPalette(gBattleStatMask6_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 5:
|
||||
case STAT_ANIM_PAL_SPATK:
|
||||
LoadCompressedPalette(gBattleStatMask7_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
case 6:
|
||||
case STAT_ANIM_PAL_SPDEF:
|
||||
LoadCompressedPalette(gBattleStatMask8_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
default:
|
||||
// case STAT_ANIM_PAL_MULTIPLE:
|
||||
LoadCompressedPalette(gBattleStatMask5_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
|
||||
break;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ void HandleAction_UseItem(void)
|
||||
gBattleTextBuff1[2]++;
|
||||
}
|
||||
|
||||
gBattleScripting.animArg1 = gBattleTextBuff1[2] + 14;
|
||||
gBattleScripting.animArg1 = gBattleTextBuff1[2] + STAT_ANIM_PLUS1;
|
||||
gBattleScripting.animArg2 = 0;
|
||||
}
|
||||
break;
|
||||
@ -2625,7 +2625,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;
|
||||
@ -3229,7 +3229,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; \
|
||||
@ -3415,7 +3415,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;
|
||||
@ -3470,7 +3470,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;
|
||||
|
Loading…
Reference in New Issue
Block a user