Alchemy
Loading...
Searching...
No Matches

fx_scene.h

Go to the documentation of this file.
1#ifndef ALCHEMY_FX_SCENE_H
2#define ALCHEMY_FX_SCENE_H
3
4/// @file
5/// BattleFxScene, the work of a battle or field Psynergy effect scene, and its
6/// arc objects.
7
8#include "types.h"
9#include "static_assert.h"
10#include "effect_slot.h"
11
12struct AnimationObject;
13union FieldObject;
14
15/// A field object as Avoid's caster: its facing, its animation records and
16/// the phase and frame count of its per-frame callback.
18 u8 unk00[6]; ///< not named through this view
19 u16 angle; ///< 1/65536 turns
20 u8 unk08[0x48]; ///< not named through this view
21 struct AnimationObject *records; ///< the caster's sprite
22 u8 unk54[0x10]; ///< not named through this view
23 s16 phase; ///< 1 spins the caster 0xc00 a frame
24 s16 step; ///< frames since the arcs started
26 void (*callback)(union FieldObject *object); ///< run each frame
27};
28
29/// The work of a Psynergy effect scene: its caster and target, where it takes
30/// place, the map state it restores and its 24 effect slots.
32 s32 angle; ///< 1/65536 turns
33 s32 x; ///< 16.16 fixed-point pixels
34 s32 y; ///< 16.16 fixed-point pixels
35 s32 z; ///< 16.16 fixed-point pixels
36 void *mainObject; ///< the caster's object
37 void *child; ///< the target's object, or NULL
38 s16 firstObjectId; ///< the caster's object id
39 s16 secondObjectId; ///< the target's object id, -1 for none
40 u16 action; ///< the ability id
41 s16 fieldKind; ///< the ability's field kind (FIELD_KIND_)
42 /// Set at the start: Force then aims in front of the caster; cleared once
43 /// the target has been dispatched.
45 u8 mode; ///< where the effect runs; MODE_WORLD_MAP on the world map
46 s8 visible; ///< set at the start: the caster flashes with a sound
47 s8 active; ///< set at the start: the ability's name is announced
48 void (*finishCallback)(void); ///< run, when set, as Ply's effect ends
49 u8 unk28[0x0c]; ///< not named by TBS code
50 /// Set by some scenes before an effect; Carry, Frost, Force and Reveal
51 /// treat the target differently with it.
53 s8 childMode; ///< set by some scenes: Frost and Force leave the target be
54 u8 unk36[2]; ///< not named by TBS code
55 /// The target's update hook and script, saved at the start and restored
56 /// when Move or Carry lets it go.
57 ///@{
58 void (*savedCallback)(union FieldObject *object);
60 ///@}
61 u8 unk40[4]; ///< not named by TBS code
62 u8 savedPalette; ///< the target's first sprite's param, saved likewise
63 u8 lit; ///< set in two Mercury Lighthouse maps; not read by name
64 u16 tileSlot; ///< resource entry holding the spark tiles
65 u16 unk48; ///< not named by TBS code
66 u16 freeBlocks; ///< 512 less the free resource blocks at the start
67 /// The map's shake and its decay, restored when the effect ends.
68 ///@{
72 ///@}
73 struct EffectSlot slots[24];
74 u8 unk718[2]; ///< not named by TBS code
75 s16 arcTileSlot; ///< resource entry of Avoid's and Retreat's arcs
76 s8 messageMode; ///< the announcement's box mode: 1, a scene adds 8
77 u8 unk71d[3]; ///< not named by TBS code
78};
79
80STATIC_ASSERT(sizeof(struct BattleFxScene) == 0x720);
81STATIC_ASSERT(offsetof(struct BattleFxScene, mainObject) == 0x10);
82STATIC_ASSERT(offsetof(struct BattleFxScene, action) == 0x1c);
83STATIC_ASSERT(offsetof(struct BattleFxScene, savedCallback) == 0x38);
84STATIC_ASSERT(offsetof(struct BattleFxScene, tileSlot) == 0x46);
85STATIC_ASSERT(offsetof(struct BattleFxScene, savedShakeX) == 0x4c);
86STATIC_ASSERT(offsetof(struct BattleFxScene, slots) == 0x58);
87STATIC_ASSERT(offsetof(struct BattleFxScene, arcTileSlot) == 0x71a);
88STATIC_ASSERT(offsetof(struct BattleFxScene, messageMode) == 0x71c);
89
90static __inline__ s32 BattleFx_Interpolate(s32 to, s32 from, s32 step) {
91 return from + (to - from) * step / 10;
92}
93
94#endif
Effect slots: the particles Psynergy effects move and draw.
static __inline__ s32 BattleFx_Interpolate(s32 to, s32 from, s32 step)
Definition fx_scene.h:90
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
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
Definition animspr.h:108
A field object as Avoid's caster: its facing, its animation records and the phase and frame count of ...
Definition fx_scene.h:17
void(*) callback(union FieldObject *object)
run each frame
Definition fx_scene.h:26
u8 unk00[6]
not named through this view
Definition fx_scene.h:18
s16 phase
1 spins the caster 0xc00 a frame
Definition fx_scene.h:23
struct AnimationObject * records
the caster's sprite
Definition fx_scene.h:21
u8 unk54[0x10]
not named through this view
Definition fx_scene.h:22
u8 unk08[0x48]
not named through this view
Definition fx_scene.h:20
s16 step
frames since the arcs started
Definition fx_scene.h:24
u16 angle
1/65536 turns
Definition fx_scene.h:19
struct FieldActor * linkedObject
Definition fx_scene.h:25
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
Definition fx_scene.h:31
u16 freeBlocks
512 less the free resource blocks at the start
Definition fx_scene.h:66
u8 mode
where the effect runs; MODE_WORLD_MAP on the world map
Definition fx_scene.h:45
s16 arcTileSlot
resource entry of Avoid's and Retreat's arcs
Definition fx_scene.h:75
s32 y
16.16 fixed-point pixels
Definition fx_scene.h:34
s32 savedShakeDecay
Definition fx_scene.h:71
u8 unk718[2]
not named by TBS code
Definition fx_scene.h:74
s16 firstObjectId
the caster's object id
Definition fx_scene.h:38
u16 action
the ability id
Definition fx_scene.h:40
void(*) savedCallback(union FieldObject *object)
The target's update hook and script, saved at the start and restored when Move or Carry lets it go.
Definition fx_scene.h:58
s8 childOption
Set by some scenes before an effect; Carry, Frost, Force and Reveal treat the target differently with...
Definition fx_scene.h:52
s8 visible
set at the start: the caster flashes with a sound
Definition fx_scene.h:46
u8 savedPalette
the target's first sprite's param, saved likewise
Definition fx_scene.h:62
void(*) finishCallback(void)
run, when set, as Ply's effect ends
Definition fx_scene.h:48
s32 angle
1/65536 turns
Definition fx_scene.h:32
u16 unk48
not named by TBS code
Definition fx_scene.h:65
struct EffectSlot slots[24]
Definition fx_scene.h:73
const s32 * savedScript
Definition fx_scene.h:59
u8 unk40[4]
not named by TBS code
Definition fx_scene.h:61
u16 tileSlot
resource entry holding the spark tiles
Definition fx_scene.h:64
s8 childMode
set by some scenes: Frost and Force leave the target be
Definition fx_scene.h:53
void * mainObject
the caster's object
Definition fx_scene.h:36
s32 savedShakeX
The map's shake and its decay, restored when the effect ends.
Definition fx_scene.h:69
u8 lit
set in two Mercury Lighthouse maps; not read by name
Definition fx_scene.h:63
s16 fieldKind
the ability's field kind (FIELD_KIND_)
Definition fx_scene.h:41
s8 messageMode
the announcement's box mode: 1, a scene adds 8
Definition fx_scene.h:76
void * child
the target's object, or NULL
Definition fx_scene.h:37
s8 enabled
Set at the start: Force then aims in front of the caster; cleared once the target has been dispatched...
Definition fx_scene.h:44
s32 savedShakeY
Definition fx_scene.h:70
u8 unk28[0x0c]
not named by TBS code
Definition fx_scene.h:49
s32 x
16.16 fixed-point pixels
Definition fx_scene.h:33
s8 active
set at the start: the ability's name is announced
Definition fx_scene.h:47
s32 z
16.16 fixed-point pixels
Definition fx_scene.h:35
u8 unk71d[3]
not named by TBS code
Definition fx_scene.h:77
s16 secondObjectId
the target's object id, -1 for none
Definition fx_scene.h:39
u8 unk36[2]
not named by TBS code
Definition fx_scene.h:54
A particle a Psynergy effect moves and draws: its sprite, its position and target,...
Definition effect_slot.h:18
A field actor: a person or thing on the field with a position, motion toward a target,...
Definition field_obj.h:30
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
signed char s8
Definition types.h:10
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
An object on the field, read as an actor or as an effect.