Skip to Content
The Alchemy Project

include/field/field_effect.h

Field effects, the small objects on the field that move, grow and spin by their scripts, the flags of a scene's effect spawner, and the tints a field Psynergy washes the screen in.

Included by field_effect_advance_motion.c, field_effect_move.c, field_effect_spawn_resident.c, field_engine_actor_commands.c, field_psynergy_internal.h, script_commands_field_psynergy.c, jupiter_lighthouse_aerie.c, jupiter_lighthouse_aerie_beacon.c, jupiter_lighthouse_basement.c, jupiter_lighthouse_central_room.c, jupiter_lighthouse_cracked_floor.c, jupiter_lighthouse_entrance.c, jupiter_lighthouse_ground_floor.c, jupiter_lighthouse_left_tower_lower.c, jupiter_lighthouse_locked_doors.c, jupiter_lighthouse_right_tower_lower.c, jupiter_lighthouse_right_tower_upper.c, jupiter_lighthouse_side_halls.c, jupiter_lighthouse_terraces.c, jupiter_lighthouse_upper_hall.c, mars_lighthouse_entrance.c, mars_lighthouse_towers.c, sea_of_time.c, field_effect_advance_motion_priority.c, field_effect_advance_spin.c, field_effect_spawn.c, trial_road.c and tundaria_tower.h.

Structures

NameDescription
structFIELD_EFFECTA field effect: a small object on the field that moves at its velocity and grows and spins at its rates, run by its script and update hook.
unionFIELD_OBJECTAn object on the field, read as an actor or as an effect.
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 an option, above the script number.
#defineEFFECT_DEFAULT_TYPE SPRITE_DUST_CLOUDThe 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.
#defineEFFECT_SPAWN scFieldEffectSpawnThe names scene/shared/field_effect_spawn.c compiles a scene's copy of the effect spawner under, the same in every scene that includes it: the spawner, the import that creates its actor, and the duration scripts EFFECT_SCRIPT_MASK picks from.
#defineEFFECT_CREATE syImportActorCreate
#defineEFFECT_SCRIPTS FieldEffectDurationScripts
#defineFIELD_EFFECT_DRAG_X 18A drifting effect loses a FIELD_EFFECT_DRAG_X-th of its x speed and a FIELD_EFFECT_DRAG_Z-th of its z speed each tick.
#defineFIELD_EFFECT_DRAG_Z 16
#defineDUST_RING_PUFFS 16Sixteen puffs of dust in a ring round the leader as he lands from above, the first thrown twice.

Enumerations

NameDescription
enumEFFECT_SPAWN_FLAGS { EFFECT_SCRIPT_MASK, EFFECT_USE_PALETTE, EFFECT_USE_PRIORITY, … }The flags of a scene's effect spawner (scFieldEffectSpawn): a script number in the low bits and which of the spawn options' fields to use.
enumEFFECT_DURATION { EFFECT_SCRIPT_SHORT, EFFECT_SCRIPT_MEDIUM, EFFECT_SCRIPT_LON … }The scripts EFFECT_SCRIPT_MASK picks from FieldEffectDurationScripts: each holds the effect for a while, then releases it.
enumPSYNERGY_TINT { PSYNERGY_TINT_BLUE, PSYNERGY_TINT_GREEN, PSYNERGY_TINT_RED, … }The eight tints a field Psynergy washes the screen in, by their index in FieldPsynergyCastColors and FLAG_PSYNERGY_TINT.

Functions

NameDescription
voidfdEffectAdvanceMotion (union FIELD_OBJECT *object)An effect's update function: move by its velocity, which loses an eighteenth of its x and a sixteenth of its z each tick, and grow and spin at its rates.
voidscEffectAdvanceMotionAtLeaderPriority (union FIELD_OBJECT *object)fdEffectAdvanceMotion, then gives the effect's sprite the leader's sprite priority, so the effect is drawn at the leader's depth.
voidfdEffectUpdateMotionScaleAndSpin (FIELD_OBJECT *object)An effect's update function: moves the effect by its velocity, which keeps its speed, grows it at its rates and turns its sprite by its spin.
voidfdEffectSpawnResident (Sint32 x, Sint32 y, Sint32 z, Sint32 velocityX, Sint32 velocityY, Sint32 velocityZ, Uint32 flags, const EFFECT_OPTIONS *options)Places a small effect at (x, y, z) moving at a velocity: a dust cloud, or options' type when EFFECT_USE_TYPE asks for it, its script one of FieldEffectDurationScripts and its options chosen by the EFFECT_USE_ flags.

Variables

NameDescription
extern const Uint32FieldPsynergyCastColors [PSYNERGY_TINT_COUNT]Each tint's colour (field_effect_data.c).

Description

Field effects, the small objects on the field that move, grow and spin by their scripts, the flags of a scene's effect spawner, and the tints a field Psynergy washes the screen in.

Macros in detail

EFFECT_OPTION_MASK

#define EFFECT_OPTION_MASK 0xffff0000

The spawn flags that pick an option, above the script number.

Referenced by EFFECT_SPAWN, fdEffectSpawnResident(), scFieldEffectSpawn() and scFieldEffectSpawnLocal().

Definition at line 114 of file field_effect.h.

EFFECT_DEFAULT_TYPE

#define EFFECT_DEFAULT_TYPE SPRITE_DUST_CLOUD

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

Referenced by EFFECT_SPAWN and fdEffectSpawnResident().

Definition at line 118 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 EFFECT_SPAWN, fdEffectSpawnResident(), scFieldEffectSpawn() and scFieldEffectSpawnLocal().

Definition at line 131 of file field_effect.h.

EFFECT_SPAWN

#define EFFECT_SPAWN scFieldEffectSpawn

The names scene/shared/field_effect_spawn.c compiles a scene's copy of the effect spawner under, the same in every scene that includes it: the spawner, the import that creates its actor, and the duration scripts EFFECT_SCRIPT_MASK picks from. The scene names EFFECT_SET_MODE and EFFECT_SET_SCRIPT itself.

Definition at line 138 of file field_effect.h.

EFFECT_CREATE

#define EFFECT_CREATE syImportActorCreate

Definition at line 139 of file field_effect.h.

EFFECT_SCRIPTS

#define EFFECT_SCRIPTS FieldEffectDurationScripts

Referenced by EFFECT_SPAWN.

Definition at line 140 of file field_effect.h.

FIELD_EFFECT_DRAG_X

#define FIELD_EFFECT_DRAG_X 18

A drifting effect loses a FIELD_EFFECT_DRAG_X-th of its x speed and a FIELD_EFFECT_DRAG_Z-th of its z speed each tick.

Referenced by fdEffectAdvanceMotion(), fdEffectUpdateDustPuff(), scEffectAdvanceMotionAndSpin(), scEffectAdvanceMotionAtLeaderPriority(), scEffectAdvanceMotionLocal(), scKandoreanTempleUpdateStreamSteam(), scKandoreanTempleUpdateVentSteam() and scTrialRoadDriftDust().

Definition at line 144 of file field_effect.h.

FIELD_EFFECT_DRAG_Z

#define FIELD_EFFECT_DRAG_Z 16

Referenced by fdEffectAdvanceMotion(), fdEffectUpdateDustPuff(), scEffectAdvanceMotionAndSpin(), scEffectAdvanceMotionAtLeaderPriority(), scEffectAdvanceMotionLocal(), scKandoreanTempleUpdateStreamSteam(), scKandoreanTempleUpdateVentSteam() and scTrialRoadDriftDust().

Definition at line 145 of file field_effect.h.

DUST_RING_PUFFS

#define DUST_RING_PUFFS 16

Sixteen puffs of dust in a ring round the leader as he lands from above, the first thrown twice.

Referenced by scAnkohlRuinsLandFromFall(), scCavernsFinishMovingAngaraBlock(), scContigoForceFreesDjinni(), scCrackedTileDropIn(), scDustBurst(), scGabombaStatueLandFromFall(), scGaiaRockInsideRaiseDust(), scGarohScatterDustRing(), scKandoreanTempleLandFromAbove(), scMagmaRockDropLeaderFromSummit(), scMagmaRockInsideSpawnDustRing(), scMagmaRockSpawnDustRing() and scTundariaTowerLandFromSlide().

Definition at line 149 of file field_effect.h.

Enumerations in detail

EFFECT_SPAWN_FLAGS

enum EFFECT_SPAWN_FLAGS

The flags of a scene's effect spawner (scFieldEffectSpawn): a script number in the low bits and which of the spawn options' fields to use.

EnumeratorValueDescription
EFFECT_SCRIPT_MASK0x0fpicks spawner's effect script; object's mode is this + 1
EFFECT_USE_PALETTE0x10000options.palette
EFFECT_USE_PRIORITY0x20000options.priority, as the sprite's priority
EFFECT_SCALE_TO_TARGET0x40000grows start (or full) to target over script 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 96 of file field_effect.h.

EFFECT_DURATION

enum EFFECT_DURATION

The scripts EFFECT_SCRIPT_MASK picks from FieldEffectDurationScripts: each holds the effect for a while, then releases it.

EnumeratorValueDescription
EFFECT_SCRIPT_SHORT0held 24 ticks
EFFECT_SCRIPT_MEDIUM1held 46 ticks
EFFECT_SCRIPT_LONG2held 128 ticks

Definition at line 122 of file field_effect.h.

PSYNERGY_TINT

enum PSYNERGY_TINT

The eight tints a field Psynergy washes the screen in, by their index in FieldPsynergyCastColors and FLAG_PSYNERGY_TINT.

EnumeratorValueDescription
PSYNERGY_TINT_BLUE0
PSYNERGY_TINT_GREEN1
PSYNERGY_TINT_RED2
PSYNERGY_TINT_CYAN3
PSYNERGY_TINT_MAGENTA4
PSYNERGY_TINT_YELLOW5
PSYNERGY_TINT_DARK_GREY6
PSYNERGY_TINT_GREY7
PSYNERGY_TINT_COUNT8

Definition at line 173 of file field_effect.h.