Skip to Content
The Alchemy Project

include/field/field_effect.h

Field effects, their scripts and the flags that spawn them.

Included by field_effect_tables.c, alpine_crossing_lama_temple.c, altin.c, altin_peak.c, cottage_rooms_b.c, crossbone_isle_keys.c, goma_cave_pillar.c, gondowan_cave.c, imil.c, imil_fuchin_falls.c, kolima_forest_tree.c, lacquer_rooms_b.c, lalivero.c, lunpa.c, mercury_lighthouse_entrance.c, mogall_forest.c, sanctum.c, field_effect_spawn.c, sol_sanctum_eruption.c, tolbi.c, vale.c, vale_cave.c, vale_plaza.c, vale_prologue.c and world_map.c.

Structures

NameDescription
structFIELD_EFFECTA field effect: a small actor on the field that moves at its velocity and grows and spins at its rates, run by its script and update function.
unionACTOR_OR_EFFECTAn actor read as an actor and as a field effect at once, as Babi Lighthouse's scInit writes one.
structEFFECT_DURATION_SCRIPTSThe three scripts a scene's own effect spawner picks from by EFFECT_SCRIPT_MASK, wrapped so that the spawner can copy them into its tick whole.
structEFFECT_OPTIONSThe options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET) is set.

Macros

NameDescription
#defineEFFECT_OPTION_MASK 0xffff0000The spawn flags that pick one of EFFECT_OPTIONS' fields (EFFECT_USE_PALETTE and up), above the script number.
#defineEFFECT_DEFAULT_TYPE SPRITE_DUST_PUFFThe sprite an effect takes unless EFFECT_USE_TYPE gives another (sprite_ids.h).
#defineEFFECT_SCRIPT_REPEAT_COUNT 3The word of a duration script that holds its repeat count, the ticks EFFECT_SCALE_TO_TARGET grows over.

Enumerations

NameDescription
enumEFFECT_SPAWN_FLAGS { EFFECT_SCRIPT_MASK, EFFECT_USE_PALETTE, EFFECT_USE_PRIORITY, … }The flags of a scene's effect spawner (EFFECT_SPAWN in scene/shared/field_effect_spawn.c): a script number in the low bits and which of EFFECT_OPTIONS' fields to use.
enumEFFECT_DURATION { EFFECT_SCRIPT_SHORT, EFFECT_SCRIPT_MEDIUM, EFFECT_SCRIPT_LON … }The scripts EFFECT_SCRIPT_MASK picks from FieldEffectDurationScripts, in a scene's spawner and the resident one alike: each holds the effect for a while, then releases it.

Functions

NameDescription
voidfdEffectSpawnResident (Sint32 x, Sint32 y, Sint32 z, Sint32 velocityX, Sint32 velocityY, Sint32 velocityZ, Uint32 flags, const EFFECT_OPTIONS *options)

Variables

NameDescription
extern const Sint32FieldEffectShortEffectScript []The resident scripts, by EFFECT_DURATION (field_engine_tables.c).
extern const Sint32FieldEffectMediumEffectScript []
extern const Sint32FieldEffectLongEffectScript []

Description

Field effects, their scripts and the flags that spawn them.

Macros in detail

EFFECT_OPTION_MASK

#define EFFECT_OPTION_MASK 0xffff0000

The spawn flags that pick one of EFFECT_OPTIONS' fields (EFFECT_USE_PALETTE and up), above the script number.

Referenced by scImilFuchinFallsSpawnDust().

Definition at line 123 of file field_effect.h.

EFFECT_DEFAULT_TYPE

#define EFFECT_DEFAULT_TYPE SPRITE_DUST_PUFF

The sprite an effect takes unless EFFECT_USE_TYPE gives another (sprite_ids.h).

Definition at line 126 of file field_effect.h.

EFFECT_SCRIPT_REPEAT_COUNT

#define EFFECT_SCRIPT_REPEAT_COUNT 3

The word of a duration script that holds its repeat count, the ticks EFFECT_SCALE_TO_TARGET grows over.

Referenced by scImilFuchinFallsSpawnDust().

Definition at line 141 of file field_effect.h.

Enumerations in detail

EFFECT_SPAWN_FLAGS

enum EFFECT_SPAWN_FLAGS

The flags of a scene's effect spawner (EFFECT_SPAWN in scene/shared/field_effect_spawn.c): a script number in the low bits and which of EFFECT_OPTIONS' fields to use.

EnumeratorValueDescription
EFFECT_SCRIPT_MASK0x0fAn EFFECT_DURATION, picking one of FieldEffectDurationScripts; the actor's mode is this plus 1.
EFFECT_USE_PALETTE0x10000options.palette, as its group child value.
EFFECT_USE_PRIORITY0x20000options.priority, as the sprite's priority.
EFFECT_SCALE_TO_TARGET0x40000Grows from the start scale, or full size, to the target scale over the script's repeat count.
EFFECT_USE_START_SCALE0x80000options.startScaleX and startScaleY.
EFFECT_USE_TYPE0x100000options.type, else EFFECT_DEFAULT_TYPE.
EFFECT_USE_SCRIPT0x200000options.script, run in mode 1.
EFFECT_USE_ROTATION0x400000options.rotation, as the sprite's.
EFFECT_USE_SPIN0x800000options.spin.
EFFECT_USE_UPDATE0x1000000options.update.

Definition at line 99 of file field_effect.h.

EFFECT_DURATION

enum EFFECT_DURATION

The scripts EFFECT_SCRIPT_MASK picks from FieldEffectDurationScripts, in a scene's spawner and the resident one alike: each holds the effect for a while, then releases it.

EnumeratorValueDescription
EFFECT_SCRIPT_SHORT022 one-tick repeats in a scene, 24 ticks resident
EFFECT_SCRIPT_MEDIUM144 repeats in a scene, 46 ticks resident
EFFECT_SCRIPT_LONG2126 repeats in a scene, 128 ticks resident

Definition at line 131 of file field_effect.h.

Functions in detail

fdEffectSpawnResident

void fdEffectSpawnResident(Sint32 x, Sint32 y, Sint32 z, Sint32 velocityX, Sint32 velocityY, Sint32 velocityZ, Uint32 flags, const EFFECT_OPTIONS *options)

Referenced by fdEffectSpawnRadialParticleRing().

Definition at line 185 of file field_effect.h.