Alchemy
Loading...
Searching...
No Matches

battle_effect_argument.h

Go to the documentation of this file.
1#ifndef ALCHEMY_BATTLE_EFFECT_ARGUMENT_H
2#define ALCHEMY_BATTLE_EFFECT_ARGUMENT_H
3
4/// @file
5/// BattleEffectArgument, the command an effect's caller, dispatcher and
6/// handlers share, and the macros that define effect kinds.
7
8#include "types.h"
9#include "static_assert.h"
10
11/// The command shared by an effect's caller, dispatcher and handlers.
13 s32 kind; ///< handler table index; 200 more for a critical hit
14 s32 side; ///< 1 when the targets are the party, 0 for enemies
15 s32 actor; ///< the user's unit id
16 s32 firstTarget; ///< the action's first target, standing or not
17 s32 range; ///< forwarded action range, otherwise initialized to 1
18 s32 count; ///< targets in actors, at least 1
19 s32 variant; ///< the ability's size, from 0 (Quake, then Earthquake)
20 s32 prelude; ///< 1 plays a prelude: in some effects a Djinni appears
21 s32 unk0020; ///< not named by TBS code
22 s16 actors[8]; ///< the targets' unit ids, count of them
23};
24
25STATIC_ASSERT(sizeof(struct BattleEffectArgument) == 0x34);
28
29/// Defines the battle effect kind `name` as a call of a shared runner with one
30/// fixed argument, its style or variant. The strike, volley, shower, mote and
31/// stat-change families each have one runner and a kind like this for each
32/// ability that uses it.
33#define DEFINE_EFFECT_KIND(name, runner, arg) \
34 void name(struct BattleEffectArgument *effect) { runner(effect, arg); }
35
36/// Loops `i` over the effect's targets, effect->actors[0] to
37/// effect->actors[effect->count - 1]: the loops that flash, shake, strike or
38/// aim at each target in turn.
39#define EFFECT_FOR_EACH_TARGET(i, effect) \
40 for ((i) = 0; (i) != (effect)->count; (i)++)
41
42#endif
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
The command shared by an effect's caller, dispatcher and handlers.
s32 range
forwarded action range, otherwise initialized to 1
s32 actor
the user's unit id
s32 side
1 when the targets are the party, 0 for enemies
s32 kind
handler table index; 200 more for a critical hit
s16 actors[8]
the targets' unit ids, count of them
s32 variant
the ability's size, from 0 (Quake, then Earthquake)
s32 count
targets in actors, at least 1
s32 prelude
1 plays a prelude: in some effects a Djinni appears
s32 firstTarget
the action's first target, standing or not
s32 unk0020
not named by TBS code
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
signed short s16
Definition types.h:12