Move battle anim arrays to C (#5306)
* move battle anim arrays to c * use ARRAY_COUNT instead * remove B_ANIM_STATUS_WRAPPED * move anim rename * rename battle anims status/general/special
This commit is contained in:
parent
720bc6464d
commit
6e3ce9db2f
7 changed files with 3150 additions and 3073 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -528,7 +528,7 @@
|
|||
#define BG_CHLOROBLAST 80
|
||||
#define BG_RAINBOW 81
|
||||
|
||||
// table ids for general animations (gBattleAnims_General)
|
||||
// table ids for general animations (sBattleAnims_General)
|
||||
#define B_ANIM_STATS_CHANGE 0
|
||||
#define B_ANIM_SUBSTITUTE_FADE 1
|
||||
#define B_ANIM_SUBSTITUTE_APPEAR 2
|
||||
|
@ -583,7 +583,9 @@
|
|||
#define B_ANIM_TERA_ACTIVATE 51
|
||||
#define B_ANIM_SIMPLE_HEAL 52
|
||||
|
||||
// special animations table (gBattleAnims_Special)
|
||||
#define NUM_B_ANIMS_GENERAL 53
|
||||
|
||||
// special animations table (sBattleAnims_Special)
|
||||
#define B_ANIM_LVL_UP 0
|
||||
#define B_ANIM_SWITCH_OUT_PLAYER_MON 1
|
||||
#define B_ANIM_SWITCH_OUT_OPPONENT_MON 2
|
||||
|
@ -593,7 +595,9 @@
|
|||
#define B_ANIM_MON_TO_SUBSTITUTE 6
|
||||
#define B_ANIM_CRITICAL_CAPTURE_THROW 7
|
||||
|
||||
// status animation table (gBattleAnims_StatusConditions)
|
||||
#define NUM_B_ANIMS_SPECIAL 8
|
||||
|
||||
// status animation table (sBattleAnims_StatusConditions)
|
||||
#define B_ANIM_STATUS_PSN 0
|
||||
#define B_ANIM_STATUS_CONFUSION 1
|
||||
#define B_ANIM_STATUS_BRN 2
|
||||
|
@ -603,7 +607,8 @@
|
|||
#define B_ANIM_STATUS_FRZ 6
|
||||
#define B_ANIM_STATUS_CURSED 7
|
||||
#define B_ANIM_STATUS_NIGHTMARE 8
|
||||
#define B_ANIM_STATUS_WRAPPED 9 // does not actually exist
|
||||
|
||||
#define NUM_B_ANIMS_STATUS 9
|
||||
|
||||
// Tasks with return values often assign them to gBattleAnimArgs[7].
|
||||
#define ARG_RET_ID 7
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_anim_scripts.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
#include "battle_util.h"
|
||||
|
@ -29,11 +30,6 @@
|
|||
|
||||
#define ANIM_SPRITE_INDEX_COUNT 8
|
||||
|
||||
extern const u16 gMovesWithQuietBGM[];
|
||||
extern const u8 *const gBattleAnims_General[];
|
||||
extern const u8 *const gBattleAnims_Special[];
|
||||
extern const u8 *const gBattleAnims_StatusConditions[];
|
||||
|
||||
static void Cmd_loadspritegfx(void);
|
||||
static void Cmd_unloadspritegfx(void);
|
||||
static void Cmd_createsprite(void);
|
||||
|
@ -182,6 +178,93 @@ static void (* const sScriptCmdTable[])(void) =
|
|||
Cmd_createdragondartsprite, // 0x34
|
||||
};
|
||||
|
||||
static const u16 sMovesWithQuietBGM[] =
|
||||
{
|
||||
MOVE_SING, MOVE_PERISH_SONG, MOVE_GRASS_WHISTLE
|
||||
};
|
||||
|
||||
static const u8* const sBattleAnims_StatusConditions[NUM_B_ANIMS_STATUS] =
|
||||
{
|
||||
[B_ANIM_STATUS_PSN] = gBattleAnimStatus_Poison,
|
||||
[B_ANIM_STATUS_CONFUSION] = gBattleAnimStatus_Confusion,
|
||||
[B_ANIM_STATUS_BRN] = gBattleAnimStatus_Burn,
|
||||
[B_ANIM_STATUS_INFATUATION] = gBattleAnimStatus_Infatuation,
|
||||
[B_ANIM_STATUS_SLP] = gBattleAnimStatus_Sleep,
|
||||
[B_ANIM_STATUS_PRZ] = gBattleAnimStatus_Paralysis,
|
||||
[B_ANIM_STATUS_FRZ] = gBattleAnimStatus_Freeze,
|
||||
[B_ANIM_STATUS_CURSED] = gBattleAnimStatus_Curse,
|
||||
[B_ANIM_STATUS_NIGHTMARE] = gBattleAnimStatus_Nightmare,
|
||||
};
|
||||
|
||||
static const u8* const sBattleAnims_General[NUM_B_ANIMS_GENERAL] =
|
||||
{
|
||||
[B_ANIM_STATS_CHANGE] = gBattleAnimGeneral_StatsChange,
|
||||
[B_ANIM_SUBSTITUTE_FADE] = gBattleAnimGeneral_SubstituteFade,
|
||||
[B_ANIM_SUBSTITUTE_APPEAR] = gBattleAnimGeneral_SubstituteAppear,
|
||||
[B_ANIM_POKEBLOCK_THROW] = gBattleAnimGeneral_PokeblockThrow,
|
||||
[B_ANIM_ITEM_KNOCKOFF] = gBattleAnimGeneral_ItemKnockoff,
|
||||
[B_ANIM_TURN_TRAP] = gBattleAnimGeneral_TurnTrap,
|
||||
[B_ANIM_HELD_ITEM_EFFECT] = gBattleAnimGeneral_HeldItemEffect,
|
||||
[B_ANIM_SMOKEBALL_ESCAPE] = gBattleAnimGeneral_SmokeballEscape,
|
||||
[B_ANIM_HANGED_ON] = gBattleAnimGeneral_HangedOn,
|
||||
[B_ANIM_RAIN_CONTINUES] = gBattleAnimGeneral_Rain,
|
||||
[B_ANIM_SUN_CONTINUES] = gBattleAnimGeneral_Sun,
|
||||
[B_ANIM_SANDSTORM_CONTINUES] = gBattleAnimGeneral_Sandstorm,
|
||||
[B_ANIM_HAIL_CONTINUES] = gBattleAnimGeneral_Hail,
|
||||
[B_ANIM_LEECH_SEED_DRAIN] = gBattleAnimGeneral_LeechSeedDrain,
|
||||
[B_ANIM_MON_HIT] = gBattleAnimGeneral_MonHit,
|
||||
[B_ANIM_ITEM_STEAL] = gBattleAnimGeneral_ItemSteal,
|
||||
[B_ANIM_SNATCH_MOVE] = gBattleAnimGeneral_SnatchMove,
|
||||
[B_ANIM_FUTURE_SIGHT_HIT] = gBattleAnimGeneral_FutureSightHit,
|
||||
[B_ANIM_DOOM_DESIRE_HIT] = gBattleAnimGeneral_DoomDesireHit,
|
||||
[B_ANIM_FOCUS_PUNCH_SETUP] = gBattleAnimGeneral_FocusPunchSetUp,
|
||||
[B_ANIM_INGRAIN_HEAL] = gBattleAnimGeneral_IngrainHeal,
|
||||
[B_ANIM_WISH_HEAL] = gBattleAnimGeneral_WishHeal,
|
||||
[B_ANIM_MEGA_EVOLUTION] = gBattleAnimGeneral_MegaEvolution,
|
||||
[B_ANIM_ILLUSION_OFF] = gBattleAnimGeneral_IllusionOff,
|
||||
[B_ANIM_FORM_CHANGE] = gBattleAnimGeneral_FormChange,
|
||||
[B_ANIM_SLIDE_OFFSCREEN] = gBattleAnimGeneral_SlideOffScreen,
|
||||
[B_ANIM_RESTORE_BG] = gBattleAnimGeneral_RestoreBg,
|
||||
[B_ANIM_TOTEM_FLARE] = gBattleAnimGeneral_TotemFlare,
|
||||
[B_ANIM_GULP_MISSILE] = gBattleAnimGeneral_GulpMissile,
|
||||
[B_ANIM_STRONG_WINDS] = gBattleAnimGeneral_StrongWinds,
|
||||
[B_ANIM_PRIMAL_REVERSION] = gBattleAnimGeneral_PrimalReversion,
|
||||
[B_ANIM_AQUA_RING_HEAL] = gBattleAnimGeneral_AquaRingHeal,
|
||||
[B_ANIM_BEAK_BLAST_SETUP] = gBattleAnimGeneral_BeakBlastSetUp,
|
||||
[B_ANIM_SHELL_TRAP_SETUP] = gBattleAnimGeneral_ShellTrapSetUp,
|
||||
[B_ANIM_ZMOVE_ACTIVATE] = gBattleAnimGeneral_ZMoveActivate,
|
||||
[B_ANIM_AFFECTION_HANGED_ON] = gBattleAnimGeneral_AffectionHangedOn,
|
||||
[B_ANIM_SNOW_CONTINUES] = gBattleAnimGeneral_Snow,
|
||||
[B_ANIM_ULTRA_BURST] = gBattleAnimGeneral_UltraBurst,
|
||||
[B_ANIM_SALT_CURE_DAMAGE] = gBattleAnimGeneral_SaltCureDamage,
|
||||
[B_ANIM_DYNAMAX_GROWTH] = gBattleAnimGeneral_DynamaxGrowth,
|
||||
[B_ANIM_MAX_SET_WEATHER] = gBattleAnimGeneral_SetWeather,
|
||||
[B_ANIM_SYRUP_BOMB_SPEED_DROP] = gBattleAnimGeneral_SyrupBombSpeedDrop,
|
||||
[B_ANIM_RAINBOW] = gBattleAnimGeneral_Rainbow,
|
||||
[B_ANIM_SEA_OF_FIRE] = gBattleAnimGeneral_SeaOfFire,
|
||||
[B_ANIM_SWAMP] = gBattleAnimGeneral_Swamp,
|
||||
[B_ANIM_TRICK_ROOM] = gBattleAnimGeneral_TrickRoom,
|
||||
[B_ANIM_WONDER_ROOM] = gBattleAnimGeneral_WonderRoom,
|
||||
[B_ANIM_MAGIC_ROOM] = gBattleAnimGeneral_MagicRoom,
|
||||
[B_ANIM_TAILWIND] = gBattleAnimGeneral_Tailwind,
|
||||
[B_ANIM_FOG_CONTINUES] = gBattleAnimGeneral_Fog,
|
||||
[B_ANIM_TERA_CHARGE] = gBattleAnimGeneral_TeraCharge,
|
||||
[B_ANIM_TERA_ACTIVATE] = gBattleAnimGeneral_TeraActivate,
|
||||
[B_ANIM_SIMPLE_HEAL] = gBattleAnimGeneral_SimpleHeal,
|
||||
};
|
||||
|
||||
static const u8* const sBattleAnims_Special[NUM_B_ANIMS_SPECIAL] =
|
||||
{
|
||||
[B_ANIM_LVL_UP] = gBattleAnimSpecial_LevelUp,
|
||||
[B_ANIM_SWITCH_OUT_PLAYER_MON] = gBattleAnimSpecial_SwitchOutPlayerMon,
|
||||
[B_ANIM_SWITCH_OUT_OPPONENT_MON] = gBattleAnimSpecial_SwitchOutOpponentMon,
|
||||
[B_ANIM_BALL_THROW] = gBattleAnimSpecial_BallThrow,
|
||||
[B_ANIM_BALL_THROW_WITH_TRAINER] = gBattleAnimSpecial_BallThrowWithTrainer,
|
||||
[B_ANIM_SUBSTITUTE_TO_MON] = gBattleAnimSpecial_SubstituteToMon,
|
||||
[B_ANIM_MON_TO_SUBSTITUTE] = gBattleAnimSpecial_MonToSubstitute,
|
||||
[B_ANIM_CRITICAL_CAPTURE_THROW] = gBattleAnimSpecial_CriticalCaptureBallThrow,
|
||||
};
|
||||
|
||||
void ClearBattleAnimationVars(void)
|
||||
{
|
||||
s32 i;
|
||||
|
@ -314,16 +397,16 @@ void LaunchBattleAnimation(u32 animType, u32 animId)
|
|||
{
|
||||
case ANIM_TYPE_GENERAL:
|
||||
default:
|
||||
sBattleAnimScriptPtr = gBattleAnims_General[animId];
|
||||
sBattleAnimScriptPtr = sBattleAnims_General[animId];
|
||||
break;
|
||||
case ANIM_TYPE_MOVE:
|
||||
sBattleAnimScriptPtr = GetMoveAnimationScript(animId);
|
||||
break;
|
||||
case ANIM_TYPE_STATUS:
|
||||
sBattleAnimScriptPtr = gBattleAnims_StatusConditions[animId];
|
||||
sBattleAnimScriptPtr = sBattleAnims_StatusConditions[animId];
|
||||
break;
|
||||
case ANIM_TYPE_SPECIAL:
|
||||
sBattleAnimScriptPtr = gBattleAnims_Special[animId];
|
||||
sBattleAnimScriptPtr = sBattleAnims_Special[animId];
|
||||
break;
|
||||
}
|
||||
gAnimScriptActive = TRUE;
|
||||
|
@ -335,9 +418,9 @@ void LaunchBattleAnimation(u32 animType, u32 animId)
|
|||
|
||||
if (animType == ANIM_TYPE_MOVE)
|
||||
{
|
||||
for (i = 0; gMovesWithQuietBGM[i] != 0xFFFF; i++)
|
||||
for (i = 0; i < ARRAY_COUNT(sMovesWithQuietBGM); i++)
|
||||
{
|
||||
if (animId == gMovesWithQuietBGM[i])
|
||||
if (animId == sMovesWithQuietBGM[i])
|
||||
{
|
||||
m4aMPlayVolumeControl(&gMPlayInfo_BGM, TRACKS_ALL, 128);
|
||||
break;
|
||||
|
|
|
@ -436,8 +436,6 @@ void InitAndLaunchChosenStatusAnimation(u32 battler, bool32 isStatus2, u32 statu
|
|||
LaunchStatusAnimation(battler, B_ANIM_STATUS_CURSED);
|
||||
else if (status & STATUS2_NIGHTMARE)
|
||||
LaunchStatusAnimation(battler, B_ANIM_STATUS_NIGHTMARE);
|
||||
else if (status & STATUS2_WRAPPED)
|
||||
LaunchStatusAnimation(battler, B_ANIM_STATUS_WRAPPED); // this animation doesn't actually exist
|
||||
else // no animation
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].statusAnimActive = 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6902,7 +6902,7 @@ const u8 *GetMoveAnimationScript(u16 moveId)
|
|||
if (gMovesInfo[moveId].battleAnimScript == NULL)
|
||||
{
|
||||
DebugPrintfLevel(MGBA_LOG_WARN, "No animation for moveId=%u", moveId);
|
||||
return Move_TACKLE;
|
||||
return gMovesInfo[MOVE_NONE].battleAnimScript;
|
||||
}
|
||||
return gMovesInfo[moveId].battleAnimScript;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue