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…
#include "ability_ids.h"#include "flags.h"#include "item_ids.h"#include "macros.h"#include "resource_ids.h"#include "battle/battle.h"#include "field/script.h"#include "field/field_blend.h"#include "field/field_effect_scripts.h"#include "field/field_psynergy_state.h"#include "field/ground_mask.h"#include "field/map_grid.h"#include "field/stubs.h"#include "game/stubs.h"#include "graphics/display_transition.h"#include "shop/stubs.h"#include "window/stubs.h"#include "text/msg_ids.h"
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
| Name | Description | |
|---|---|---|
struct | WAVE_EFFECT_SPR | Read set on it; each member says which Sprite fields it covers. |
Macros
| Name | Description | |
|---|---|---|
#define | PSYNERGY_EFFECT_SLOT_COUNT 24 | The field effect sprites of a field Psynergy (FIELD_EFFECT_STATE.particles). |
#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. |
#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. |
#define | DJINN_PENDING_SCRIPT_MASK 0xfff | |
#define | DJINN_PENDING_BATTLE_SCRIPT_MASK 0x7ff | A Djinni battle's script without DJINN_NO_HOP. |
#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. |
#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. |
#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. |
#define | CLAP_SPARKLE_COUNT 24 | The sparkles DEFINE_CLAPPING_HANDS_CAST's casts scatter. |
#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. |
#define | PSYNERGY_EFFECT_HEIGHT toFIXED(16) | 16 pixels up |
Enumerations
| Name | Description | |
|---|---|---|
enum | PENDING_BATTLE_KIND { PENDING_DJINNI_BATTLE, PENDING_MIMIC_CHEST } | What waits in MainRoutineStateWork.pendingDjinni through a battle. |
enum | OUT_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). |
enum | VENUS_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. |
enum | MERCURY_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. |
enum | MARS_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
| Name | Description | |
|---|---|---|
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). |
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. |
static __inline__ void | fdEffectUpdateEffectSlots (void) | Runs the update of each of the 24 field effect sprites. |
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. |
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.
| Enumerator | Value | Description |
|---|---|---|
PENDING_DJINNI_BATTLE | 0 | A Djinni battle, by its DJINNI_BATTLE_SCRIPT_FIRST script. |
PENDING_MIMIC_CHEST | CONDITION_FLAG_SET | A 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).
| Enumerator | Value | Description |
|---|---|---|
OUT_AND_BACK_AIM_OUT | 0 | picks the point it flies out to |
OUT_AND_BACK_FLYING_OUT | 1 | waits to arrive there |
OUT_AND_BACK_AIM_BACK | 2 | picks the point it comes back to |
OUT_AND_BACK_FLYING_BACK | 3 | frees 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.
| Enumerator | Value | Description |
|---|---|---|
VENUS_PARTICLE_AIM | 0 | starts round the leader, aimed up the screen |
VENUS_PARTICLE_RISING | 1 | back to VENUS_PARTICLE_AIM once it arrives |
VENUS_PARTICLE_LAST_RISE | 2 | freed 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.
| Enumerator | Value | Description |
|---|---|---|
MERCURY_DROPLET_AIM | 0 | placed above the leader, aimed at a spot by it |
MERCURY_DROPLET_FALLING | 1 | Splashes where it lands, then falls again (MERCURY_DROPLET_AIM). |
MERCURY_DROPLET_LAST_FALL | 2 | Splashes where it lands, for the last time. |
MERCURY_DROPLET_DONE | 3 | frees 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.
| Enumerator | Value | Description |
|---|---|---|
MARS_SPARK_AIM | 0 | aimed 120 pixels up the screen from its origin |
MARS_SPARK_RISING | 1 | back to MARS_SPARK_AIM once it arrives |
MARS_SPARK_STOPPING | 2 | Stops where it arrives, hidden, and waits 40 ticks |
MARS_SPARK_AIM_LEADER | 3 | aimed at a point by the leader |
MARS_SPARK_SWARMING | 4 | back to MARS_SPARK_AIM_LEADER on arrival |
MARS_SPARK_LEAVING | 5 | freed 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.