Skip to Content
The Alchemy Project

src/field/script_commands_internal.h

What every part of script_commands.c shares: its includes and the macros and types more than one part uses. More…

Included by script_commands.c, script_commands_actor_commands.c, script_commands_arcs.c, script_commands_avoid.c, script_commands_camera.c, script_commands_carry.c, script_commands_catch.c, script_commands_climbing.c, script_commands_cloak.c, script_commands_djinni.c, script_commands_douse.c, script_commands_exit_animations.c, script_commands_field_particles.c, script_commands_field_psynergy.c, script_commands_field_psynergy_state.c, script_commands_force.c, script_commands_frost.c, script_commands_ground_particles.c, script_commands_growth.c, script_commands_halt.c, script_commands_jupiter.c, script_commands_lift.c, script_commands_line_scroll.c, script_commands_map_screen.c, script_commands_mars.c, script_commands_mercury.c, script_commands_messages.c, script_commands_mind_read.c, script_commands_motes.c, script_commands_move.c, script_commands_movement_types.c, script_commands_ply.c, script_commands_requests.c, script_commands_retreat.c, script_commands_reveal.c, script_commands_scripts.c, script_commands_venus.c, script_commands_view.c, script_commands_weather.c and script_commands_whirlwind.c.

Structures

NameDescription
structWAVE_EFFECT_SPRRead set on it; each member says which Sprite fields it covers.

Macros

NameDescription
#definePSYNERGY_EFFECT_SLOT_COUNT 24The field effect sprites of a field Psynergy (FIELD_EFFECT_STATE.particles).
#defineDJINNI_BATTLE_SCRIPT_FIRST 300A pending Djinni battle's script (MainRoutineStateWork.pendingDjinni, script_commands_requests.c, script_commands_djinni.c): this plus the Djinni's id (DJINN_PER_ELEMENT to an element), with DJINN_NO_HOP beside it.
#defineDJINN_PENDING_KIND_MASK 0xf000MainRoutineStateWork.pendingDjinni's parts, as fdDjinnResolvePending reads them. bits: 15..12 kind (PENDING_BATTLE_KIND) | 11..0 script or flag.
#defineDJINN_PENDING_SCRIPT_MASK 0xfff
#defineDJINN_PENDING_BATTLE_SCRIPT_MASK 0x7ffA Djinni battle's script without DJINN_NO_HOP.
#defineGROW_STEPS 10The steps, one a tick, in which an object grows out of the caster on its way to the target or shrinks back into it: fdEffectInterpolate's tenths.
#defineAFTERIMAGE_SCALE (toFIXED(15) / 16)The trailing copies of a moving Djinni or Force's hand are drawn a little smaller than what they follow.
#defineDEFINE_SHRINK_AND_DESTROY (name, step)Defines a per-tick update that spins an actor 1/8 turn a tick while its scale changes by step, releasing the actor once the scale falls below toFIXED(1) * 3 / 16. step is negative: from full size the actor lasts (toFIXED(13) / 16) / -step ticks, rounded down, plus one.
#defineCLAP_SPARKLE_COUNT 24The sparkles DEFINE_CLAPPING_HANDS_CAST's casts scatter.
#defineDEFINE_CLAPPING_HANDS_CAST (name, spawn)Defines Lift's or Carry's cast with no target: spawn makes a hand 16 pixels above the cast's position and 32 pixels to either side, each facing the middle; the two move 24 pixels inward and clap, and 24 sparkles scatter 8 to 32 pixels.
#definePSYNERGY_EFFECT_HEIGHT toFIXED(16)16 pixels up

Enumerations

NameDescription
enumPENDING_BATTLE_KIND { PENDING_DJINNI_BATTLE, PENDING_MIMIC_CHEST }What waits in MainRoutineStateWork.pendingDjinni through a battle.
enumOUT_AND_BACK_STATE { OUT_AND_BACK_AIM_OUT, OUT_AND_BACK_FLYING_OUT, OUT_AND_BACK_ … }The states of a particle that flies out and back: Halt's, Force's and Move's (fdEffectUpdateHaltParticle, fdEffectUpdateRadialBurst, fdEffectUpdateOutAndBack).
enumVENUS_PARTICLE_STATE { VENUS_PARTICLE_AIM, VENUS_PARTICLE_RISING, VENUS_PARTICLE_LA … }The states of a Venus Djinni's rising particle (fdEffectUpdateRadialSpread), which fdDjinnRunVenusJoinEffect moves on to VENUS_PARTICLE_LAST_RISE.
enumMERCURY_DROPLET_STATE { MERCURY_DROPLET_AIM, MERCURY_DROPLET_FALLING, MERCURY_DROPLE … }The states of a Mercury Djinni's droplet (fdEffectUpdateRandomTargetParticle), which fdDjinnRunMercuryJoinEffect moves on to MERCURY_DROPLET_LAST_FALL.
enumMARS_SPARK_STATE { MARS_SPARK_AIM, MARS_SPARK_RISING, MARS_SPARK_STOPPING, MARS … }The states of a Mars Djinni's spark (fdEffectUpdateMarsSpark), which fdDjinnRunMarsJoinEffect moves on to MARS_SPARK_STOPPING and then MARS_SPARK_LEAVING.

Functions

NameDescription
voidfdActorSetTargetPosFromMagnitudeAngle (ACTOR *actor, Sint32 magnitude, Sint32 angle)Sends an actor toward the point magnitude (16.16 pixels) away from it in direction angle (actor_polar_target.h).
static inline voidfdEffectMoveAfterimageHalfway (ACTOR *afterimage)Per-tick update of an afterimage: closes half the distance to the actor it watches, on all three axes.
static __inline__ voidfdEffectUpdateEffectSlots (void)Runs the update of each of the 24 field effect sprites.
static inline voidfdEffectInitFallingFragment (ACTOR *fragment)Move's hand and Carry shed the same short-lived falling particle: it falls under a gravity of 0.1 pixel a tick, each tick, and is freed after 12 ticks.

Description

What every part of script_commands.c shares: its includes and the macros and types more than one part uses. script_commands.c includes it before the parts, and each part includes it too, so that a part read on its own resolves. It places no bytes.

Macros in detail

PSYNERGY_EFFECT_SLOT_COUNT

#define PSYNERGY_EFFECT_SLOT_COUNT 24

The field effect sprites of a field Psynergy (FIELD_EFFECT_STATE.particles).

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdEffectReleaseSlots(), fdEffectUpdateEffectSlots(), fdPsynergyEnd() and fdPsynergyRetreat().

Definition at line 35 of file script_commands_internal.h.

DJINNI_BATTLE_SCRIPT_FIRST

#define DJINNI_BATTLE_SCRIPT_FIRST 300

A pending Djinni battle's script (MainRoutineStateWork.pendingDjinni, script_commands_requests.c, script_commands_djinni.c): this plus the Djinni's id (DJINN_PER_ELEMENT to an element), with DJINN_NO_HOP beside it.

Referenced by fdDjinnResolvePending(), fdDjinnRestoreActorAfterBattle() and fdRequestDjinnBattle().

Definition at line 40 of file script_commands_internal.h.

DJINN_PENDING_KIND_MASK

#define DJINN_PENDING_KIND_MASK 0xf000

MainRoutineStateWork.pendingDjinni's parts, as fdDjinnResolvePending reads them. bits: 15..12 kind (PENDING_BATTLE_KIND) | 11..0 script or flag.

Referenced by fdDjinnResolvePending() and fdDjinnRestoreActorAfterBattle().

Definition at line 44 of file script_commands_internal.h.

DJINN_PENDING_SCRIPT_MASK

#define DJINN_PENDING_SCRIPT_MASK 0xfff

Referenced by fdDjinnResolvePending() and fdDjinnRestoreActorAfterBattle().

Definition at line 56 of file script_commands_internal.h.

DJINN_PENDING_BATTLE_SCRIPT_MASK

#define DJINN_PENDING_BATTLE_SCRIPT_MASK 0x7ff

A Djinni battle's script without DJINN_NO_HOP.

Referenced by fdDjinnResolvePending() and fdDjinnRestoreActorAfterBattle().

Definition at line 58 of file script_commands_internal.h.

GROW_STEPS

#define GROW_STEPS 10

The steps, one a tick, in which an object grows out of the caster on its way to the target or shrinks back into it: fdEffectInterpolate's tenths.

Referenced by fdPsynergyCatch(), fdPsynergyDouse() and fdPsynergyHalt().

Definition at line 62 of file script_commands_internal.h.

AFTERIMAGE_SCALE

#define AFTERIMAGE_SCALE (toFIXED(15) / 16)

The trailing copies of a moving Djinni or Force's hand are drawn a little smaller than what they follow.

Referenced by fdDjinnRunBattleStartHop(), fdDjinnRunMercuryJoinEffect() and fdPsynergyForce().

Definition at line 66 of file script_commands_internal.h.

DEFINE_SHRINK_AND_DESTROY

#define DEFINE_SHRINK_AND_DESTROY(name, step)

Defines a per-tick update that spins an actor 1/8 turn a tick while its scale changes by step, releasing the actor once the scale falls below toFIXED(1) * 3 / 16. step is negative: from full size the actor lasts (toFIXED(13) / 16) / -step ticks, rounded down, plus one.

Definition at line 94 of file script_commands_internal.h.

CLAP_SPARKLE_COUNT

#define CLAP_SPARKLE_COUNT 24

The sparkles DEFINE_CLAPPING_HANDS_CAST's casts scatter.

Definition at line 138 of file script_commands_internal.h.

DEFINE_CLAPPING_HANDS_CAST

#define DEFINE_CLAPPING_HANDS_CAST(name, spawn)

Defines Lift's or Carry's cast with no target: spawn makes a hand 16 pixels above the cast's position and 32 pixels to either side, each facing the middle; the two move 24 pixels inward and clap, and 24 sparkles scatter 8 to 32 pixels.

Definition at line 144 of file script_commands_internal.h.

PSYNERGY_EFFECT_HEIGHT

#define PSYNERGY_EFFECT_HEIGHT toFIXED(16)

16 pixels up

Referenced by fdEffectGetPosAboveActor(), fdEffectRunSparkEmitter() and fdPsynergyForce().

Definition at line 194 of file script_commands_internal.h.

Enumerations in detail

PENDING_BATTLE_KIND

enum PENDING_BATTLE_KIND

What waits in MainRoutineStateWork.pendingDjinni through a battle.

EnumeratorValueDescription
PENDING_DJINNI_BATTLE0A Djinni battle, by its DJINNI_BATTLE_SCRIPT_FIRST script.
PENDING_MIMIC_CHESTCONDITION_FLAG_SETA mimic chest's battle, by the chest's flag, which the field engine stores with CONDITION_FLAG_SET (field_engine_cues.c).

Definition at line 47 of file script_commands_internal.h.

OUT_AND_BACK_STATE

enum OUT_AND_BACK_STATE

The states of a particle that flies out and back: Halt's, Force's and Move's (fdEffectUpdateHaltParticle, fdEffectUpdateRadialBurst, fdEffectUpdateOutAndBack).

EnumeratorValueDescription
OUT_AND_BACK_AIM_OUT0picks the point it flies out to
OUT_AND_BACK_FLYING_OUT1waits to arrive there
OUT_AND_BACK_AIM_BACK2picks the point it comes back to
OUT_AND_BACK_FLYING_BACK3frees its slot once it arrives

Definition at line 199 of file script_commands_internal.h.

VENUS_PARTICLE_STATE

enum VENUS_PARTICLE_STATE

The states of a Venus Djinni's rising particle (fdEffectUpdateRadialSpread), which fdDjinnRunVenusJoinEffect moves on to VENUS_PARTICLE_LAST_RISE.

EnumeratorValueDescription
VENUS_PARTICLE_AIM0starts round the leader, aimed up the screen
VENUS_PARTICLE_RISING1back to VENUS_PARTICLE_AIM once it arrives
VENUS_PARTICLE_LAST_RISE2freed once it arrives

Definition at line 209 of file script_commands_internal.h.

MERCURY_DROPLET_STATE

enum MERCURY_DROPLET_STATE

The states of a Mercury Djinni's droplet (fdEffectUpdateRandomTargetParticle), which fdDjinnRunMercuryJoinEffect moves on to MERCURY_DROPLET_LAST_FALL.

EnumeratorValueDescription
MERCURY_DROPLET_AIM0placed above the leader, aimed at a spot by it
MERCURY_DROPLET_FALLING1Splashes where it lands, then falls again (MERCURY_DROPLET_AIM).
MERCURY_DROPLET_LAST_FALL2Splashes where it lands, for the last time.
MERCURY_DROPLET_DONE3frees its slot

Definition at line 220 of file script_commands_internal.h.

MARS_SPARK_STATE

enum MARS_SPARK_STATE

The states of a Mars Djinni's spark (fdEffectUpdateMarsSpark), which fdDjinnRunMarsJoinEffect moves on to MARS_SPARK_STOPPING and then MARS_SPARK_LEAVING.

EnumeratorValueDescription
MARS_SPARK_AIM0aimed 120 pixels up the screen from its origin
MARS_SPARK_RISING1back to MARS_SPARK_AIM once it arrives
MARS_SPARK_STOPPING2Stops where it arrives, hidden, and waits 40 ticks
MARS_SPARK_AIM_LEADER3aimed at a point by the leader
MARS_SPARK_SWARMING4back to MARS_SPARK_AIM_LEADER on arrival
MARS_SPARK_LEAVING5freed once it arrives

Definition at line 234 of file script_commands_internal.h.

Functions in detail

fdActorSetTargetPosFromMagnitudeAngle

void fdActorSetTargetPosFromMagnitudeAngle(ACTOR *actor, Sint32 magnitude, Sint32 angle)

Sends an actor toward the point magnitude (16.16 pixels) away from it in direction angle (actor_polar_target.h).

Referenced by fdDjinnRunBattleStartHop(), fdDjinnRunVenusJoinEffect(), fdEffectBurstHand(), fdEffectSpawnHeavyImpact(), fdEffectSpawnMoveHand(), fdEffectUpdateDouseDrop(), fdPsynergyLiftOnTarget(), fdPsynergyPly(), fdPsynergySteerLiftedTarget() and scValeVanishMoveHand().

Definition at line 30 of file script_commands_internal.h.

fdEffectMoveAfterimageHalfway

static inline void fdEffectMoveAfterimageHalfway(ACTOR *afterimage)

Per-tick update of an afterimage: closes half the distance to the actor it watches, on all three axes.

Referenced by fdActorMoveHalfwayTowardTarget() and fdEffectHalveDistanceToTarget().

Definition at line 70 of file script_commands_internal.h.

fdEffectUpdateEffectSlots

static __inline__ void fdEffectUpdateEffectSlots(void)

Runs the update of each of the 24 field effect sprites.

References fdParticleUpdate() and Sint32.

Referenced by fdEffectUpdateAllEffectSlots() and fdEffectUpdateAllSlots().

Definition at line 80 of file script_commands_internal.h.

fdEffectInitFallingFragment

static inline void fdEffectInitFallingFragment(ACTOR *fragment)

Move's hand and Carry shed the same short-lived falling particle: it falls under a gravity of 0.1 pixel a tick, each tick, and is freed after 12 ticks.

References fdActorSelectAnimationStub(), fdActorStartScriptStub() and FieldEffectSharedParticleScript.

Referenced by fdEffectSpawnFallingParticles() and fdEffectUpdateMoveHand().

Definition at line 124 of file script_commands_internal.h.