Alchemy
Loading...
Searching...
No Matches

classes.c

Go to the documentation of this file.
1/// @file
2/// The enemy classes' battle sprite table, gSummon_EntryTable.
3/// Part of battle.c, the battle object, compiled only through it.
4
6
7/// Returns the class's defeat-sound kind, 0 to 4, or -1 for none; a fallen
8/// enemy's sound is SE_146 plus it.
9/// Called by BattleEvent_Playback as an enemy falls. Reads any index
10/// unchecked.
12 u32 kind = gSummon_EntryTable[index].layoutKind;
13
14 if ((s32)kind > 4)
15 kind = -1U;
16 return kind;
17}
18
19/// The last class with a row in gSummon_EntryTable (sprites.tsv).
20#define ENEMY_CLASS_LAST 171
21
22/// Returns the class's battle sprite, row 0's for a class out of range.
23/// Called by BattleObjMake and SummonSlot_RegisterActorSprites.
25 if (index < 0 || index > ENEMY_CLASS_LAST)
27 return gSummon_EntryTable[index].animation;
28}
29
30/// Returns the class's sprite palette.
31/// For a class out of range it returns row 0's sprite, not a palette.
32/// XXX: likely a slip copied from BattleClass_GetSprite, because no other
33/// getter here returns another column for a bad index. Called by
34/// BattleObjMake and SummonSlot_RegisterActorSprites.
36 if (index < 0 || index > ENEMY_CLASS_LAST)
38 return gSummon_EntryTable[index].layoutBits1;
39}
40
41/// Returns 1 for a small class, which takes one enemy sprite slot instead of
42/// two and stands closer to its neighbours; 0 out of range.
43/// Called by the formation and placement code (BattleFormation_BuildEnemyList,
44/// Summon_LayoutPositions) and by motion.c.
46 s32 result;
47
48 if (index < 0 || index > ENEMY_CLASS_LAST)
49 return 0;
50 result = 0;
51 if (gSummon_EntryTable[index].spriteBit0)
52 result = 1;
53 return result;
54}
55
56/// Returns the effect a class's plain attack shows, 1 for none or out of
57/// range.
58/// Called by BattleCommand_BuildPlan, which stages it by id range
59/// (STAGING_BY_ID_RANGE).
61 u16 value;
62
63 if (index > ENEMY_CLASS_LAST)
64 return 1;
65 value = gSummon_EntryTable[index].spriteBits1;
66 return value ? value : 1;
67}
68
69/// Returns how high a class hops as it runs up to attack, in pixels; 0 out
70/// of range.
71/// Called by BattlePres_RunAttack, which passes it to
72/// BattleMotion_ApproachTarget, and reached through FarCall_BattleTable.
74 u16 value;
75
76 if (index > ENEMY_CLASS_LAST)
77 return 0;
78 value = gSummon_EntryTable[index].spriteBits5;
79 return value ? value : 0;
80}
81
82/// Returns 1 for a class whose blow lands with SE_HEAVY_IMPACT instead of
83/// SE_133; 0 out of range.
84/// Called by the beam effects (beams.c) through its far stub.
86 if (index < 0 || index > ENEMY_CLASS_LAST)
87 return 0;
88 return gSummon_EntryTable[index].layoutBit0;
89}
90
91/// Returns the height an effect is drawn at over a class, in pixels, or 0
92/// for its size's default; 0 out of range.
93/// Called by BattleUnit_GetEffectHeight, and reached through
94/// FarCall_BattleTable.
96 if (index < 0 || index > ENEMY_CLASS_LAST)
97 return 0;
98 return gSummon_EntryTable[index].unk04[0];
99}
u32 BattleClass_GetAttackEffect(u32 index)
Returns the effect a class's plain attack shows, 1 for none or out of range.
Definition classes.c:60
s32 BattleClass_GetPalette(s32 index)
Returns the class's sprite palette.
Definition classes.c:35
u32 BattleClass_GetAttackHop(u32 index)
Returns how high a class hops as it runs up to attack, in pixels; 0 out of range.
Definition classes.c:73
s32 BattleClass_IsSmall(s32 index)
Returns 1 for a small class, which takes one enemy sprite slot instead of two and stands closer to it...
Definition classes.c:45
s32 BattleClass_GetEffectHeight(s32 index)
Returns the height an effect is drawn at over a class, in pixels, or 0 for its size's default; 0 out ...
Definition classes.c:95
s32 BattleClass_GetSprite(s32 index)
Returns the class's battle sprite, row 0's for a class out of range.
Definition classes.c:24
s32 Summon_IsEntrySecondaryFlagged(s32 index)
Returns 1 for a class whose blow lands with SE_HEAVY_IMPACT instead of SE_133; 0 out of range.
Definition classes.c:85
#define ENEMY_CLASS_LAST
The last class with a row in gSummon_EntryTable (sprites.tsv).
Definition classes.c:20
u32 BattleClass_GetDefeatSoundKind(s32 index)
Returns the class's defeat-sound kind, 0 to 4, or -1 for none; a fallen enemy's sound is SE_146 plus ...
Definition classes.c:11
What every part of the battle object shares: its includes, in their original order,...
struct BattleSpriteDefinition gSummon_EntryTable[]
u8 layoutBit0
The byte at 3.
u8 spriteBits1
the attack-effect kind; 0 reads as 1
u16 animation
the class's battle sprite
u8 layoutBits1
the sprite's palette
u8 layoutKind
the defeat-sound kind; above 4 reads as none
u8 unk04[4]
[0] is the effect height (BattleClass_GetEffectHeight)
u8 spriteBits5
the attack-hop height
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13