Skip to Content
The Alchemy Project

include/field/script_commands.h

What script_commands.c declares for the files that use it: the commands scripts run, moving on the field, weather and line scrolls, Djinn joining the party, each field Psynergy and its effects, and the map screen.

Included by battle_effect_internal.h, actor_scripts.c, field_engine_tables.c, map_screen_markers.c, script.h, script_inline.h and system_call.h.

Structures

NameDescription
structSPARKLE_PICTUREOne picture of a sparkle: its height offset and tile (field_engine_tables.c).

Macros

NameDescription
#defineDJINN_NO_HOP 0x800fdRequestDjinnBattle's actorAndHop: the Djinni does not hop first.
#defineCAMERA_KEEP (-1)A camera move's axis that stays where the camera is.
#defineDPAD_ANGLE_NONE 65535What fdInputGetDpadAngle returns when no direction, or a diagonal, is held: the blank entries of InputDpadAngles.

Enumerations

NameDescription
enumFIELD_PSYNERGY_HANDLER { FIELD_PSYNERGY_HANDLER_UNTARGETED, FIELD_PSYNERGY_HANDLER_ON … }A step of the current field Psynergy (fdPsynergyRunHandler).
enumFIELD_PSY { FIELD_PSYNERGY_MOVE, FIELD_PSYNERGY_MIND_READ, FIELD_PSYNERG … }A field Psynergy, as the field kind: the type column of games/tbs/src/game/ability_table.c, named for the abilities that have it.
enumMAP_SCREEN_MARKER_TILE { MAP_SCREEN_MARKER_PARTY, MAP_SCREEN_MARKER_AREA, MAP_SCREEN_ … }The map screen's marker tiles: the party's dot, the two kinds of area a MAP_SCREEN_MARKER row (AREA_MARKER or LIGHTHOUSE_MARKER) asks for (a town or a place on the way; a lighthouse or Sol Sanctum), and the larger dot that blinks over the marker nearest the cursor.

Functions

NameDescription
voidfdScriptNoOperationUpdateA (void)
voidfdScriptNoOperationUpdate (void)An empty hook; it does nothing in the released game.
Sint32fdPartyCheckShortcut (Uint32 shortcut)Checks an L or R button shortcut, packed as a field Psynergy use is: the party member (ACT_UNIT) and the Psynergy (ABILITY_ID).
Sint32fdPartyCheckItemLimit (Sint32 item)Checks whether the party can carry one more of item: each party member carries at most INVENTORY_STACK_MAX of one item.
voidfdInventoryNoOperationCallback (void)An empty function; nothing in The Broken Seal calls it.
voidfdInventoryReservedNoOperation (void)An empty function; nothing in The Broken Seal calls it.
voidfdActorWaitForAnimationEnd (Sint32 actorId, Sint32 animation)Waits, at most 90 ticks, for an actor's animation to stop being animation: the actor has finished a one-off animation such as a nod.
voidfdEffectUpdateDustPuff (struct ACTOR *actor)Moves a dust puff of fdEffectSpawnDustPuff: it drifts with its x and z velocity (kept in speed and acceleration), which drag slows each tick, and rises 1/64 pixel a tick.
voidfdEffectSpawnDustPuff (struct ACTOR *src, Sint32 color)Kicks up a dust puff (SPRITE_DUST_PUFF) where source stands: it flies off toward the back at 0.5 to 1.4 pixels a tick and sideways at up to 1.4, with one of two animations, in the colour mode color.
voidfdActorTurnPairToFaceEachOther (struct ACTOR *first, struct ACTOR *second)Turns two actors to face each other, at most 1/16 turn a tick each, until both do (at most 60 ticks).
voidfdActorReleaseNoOperation (void)
voidfdActorUpdateBlink (struct ACTOR *actor)Per-tick update function of a blinking actor: sets its sprite parts' colour mode from ActorBlinkSpriteColors (SPRITE_COLOR_WHITE for two ticks out of eight, otherwise SPRITE_COLOR_NORMAL).
Sint32fdActorStepAngle (struct ACTOR *actor)SC_CALL function that turns an actor toward the angle kept in its timer: the whole way when within 1/16 turn, otherwise 1/32 turn.
voidfdActorReservedNoOperation (void)
voidfdCameraFollow (struct ACTOR *target, Sint32 keepCurrentPos)Unused: makes the camera follow target; unless keepCurrentPos is set it jumps there at once.
UNREAD_RESULTfdWorldMapStepZoom (void)Event: moves the zoom one step from its previous value toward its target, and removes itself on the last step.
UNREAD_RESULTfdEffectCopyWatchedActorPos (struct ACTOR *actor)Per-tick update of an emote bubble or attached effect: keeps it on the actor it rides (its watched actor, whose id is its hostActorId), raised by that actor's sprite height (its metadata's spriteTop) and 8 pixels.
Sint32fdActorClearSpriteAndCollisionFlags (struct ACTOR *actor)The SC_CALL function of MOVEMENT_TYPE_RESET_ACTION: clears an actor's sprite flags, so it has no shadow, and its collision flags, so nothing collides with it.
Sint32fdActorMoveTowardTarget (struct ACTOR *actor)The SC_CALL function of MOVEMENT_TYPE_FOLLOW_WATCHED: follows the watched actor.
Sint32fdActorTurnTowardWatchedActor (struct ACTOR *actor)The SC_CALL function of MOVEMENT_TYPE_FACE_LEADER: turns the actor toward its watched actor, at most FACING_STEP a tick.
struct ACTOR *fdActorFindNearestFacingTarget (struct ACTOR *self, Sint32 sprite)Finds the nearest animated actor to self within FACING_TARGET_REACH pixels and under FACING_TARGET_HEIGHT of height, ignoring actors more than FACING_TARGET_ANGLE to either side once they are over FACING_TARGET_NEAR pixels away; returns it if its sprite is sprite (an SPR_ID), else NULL.
voidfdExitNoOperation (void)
UNREAD_RESULTfdStartEncounterTransition (Sint32 unused)Starts the transition into a random battle: plays the scene's battle music and the encounter sounds, closes the screen and flashes the backdrop white, fading it to black.
voidfdExitPrepareAnimation (Sint32 animation)Starts the leader's animation for leaving through an exit: centres it on its metatile, at the metatile's south edge, stops it and plays animation over 18 ticks.
voidfdExitStartStairsUp (void)Leaves through an EXIT_STYLE_STAIRS_UP exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival).
voidfdExitStartStairsDown (void)Leaves through an EXIT_STYLE_STAIRS_DOWN exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN.
voidfdEntrancePlayArrivalAnimation (Sint32 animation)Plays the leader's arrival animation through an exit: centred on its metatile at the metatile's north edge, the leader plays animation for 30 ticks, loses the hidden doorway part and walks 8 pixels south.
Sint32fdEntrancePlayArrival (void)Plays the leader's arrival for the way the last scene was left: through a EXIT_STYLE_STAIRS_UP exit (FLAG_ARRIVAL_STAIRS_UP, ANIM_LEADER_ARRIVE, returns 1) or a EXIT_STYLE_STAIRS_DOWN one (FLAG_ARRIVAL_STAIRS_DOWN, ANIM_LEADER_ARRIVE_ALTERNATE, returns 2), or falling in from 160 pixels above (FLAG_ARRIVE_FALLING, returns 3).
voidfdLineScrollArmDMA (void)VBlank-pass event for the line scroll: restarts DMA 0 each VBlank to copy the current page's BG1 to BG3 scroll offsets into the scroll registers one scanline at a time.
voidfdLineScrollBuildPage (void)Event for the line scroll: fills the hidden page with each scanline's BG3, BG2 and BG1 offsets, the scroll plus a sine wave for x and for y (an axis with no step stays flat), then shows that page.
voidfdWeatherUpdateRain (void)Event of the rain: each drop splashes on the ground and starts again at a new spot within 128 pixels of the leader.
voidfdWeatherUpdateLightning (void)Event for the storm: lightning flashes the BG colours three times, 5 ticks apart.
voidfdMotesUpdate (void)Event of the motes of light: each rises and shrinks for 120 ticks, then starts again within 128 pixels of the leader, eight new ones a tick at most.
voidfdEffectUpdateSparkles (void)Event of the sparkles: now and then a burst of up to four twinkles on one spot within 128 pixels of the leader.
voidfdActorMoveHalfwayTowardTarget (struct ACTOR *actor)Update function shared by the Djinni battle-start and Mercury afterimages.
voidfdDjinnRunBattleStartHop (Sint32 djinniId)A Djinni's battle start: the Djinni (actor id) bounces twice, turns to face the leader, hops back 16 pixels three times, then leaps 64 pixels at the party trailing eight afterimages tinted for its element.
voidfdDjinnRestoreActorAfterBattle (void)Puts a Djinni's actor back where its battle started from: for a pending Djinni battle (pendingDjinni DJINNI_BATTLE_SCRIPT_FIRST plus the Djinni's number, FLAG_KEEP_PARTY_POSITION set, the battle over) the scene's actor placed for that Djinni (condition = its flag) goes back to its placement's position, or 32 pixels north of the leader when the script has DJINN_NO_HOP set, and stands.
voidfdDjinnResolvePending ()Declared without a prototype: fdEngineRun calls it with one argument and with two.
voidfdEffectUpdateAllSlots (void)Event: updates the 24 field effect sprites.
voidfdEffectAdvanceSpinAngle (struct ACTOR *actor)Per-tick update: spins an actor 1/8 turn a tick.
voidfdEffectRunAngledApproachPhases (FIELD_PARTICLE *particle)Field effect sprite callback of a Jupiter Djinni's light particles, the ring of coloured lights a joining Jupiter Djinni bursts into: each circles its centre while it widens, circles, drifts toward a point 20 pixels over the leader and closes in on it, and is freed.
voidfdDjinnRunJupiterJoinEffect (Sint32 djinniId)A Jupiter Djinni joins the party: it bounces three times, spins, leaps out of sight and bursts into a light particle for each of the effect state's, which circle and close in on the leader, who turns to the camera and raises its arms (ANIM_LEADER_ARMS_RAISED).
voidfdEffectPulseActorScale (struct ACTOR *actor)Per-tick update: makes an actor pulse, switching its scale between the two values of FieldEffectPulseScales every 4 ticks.
voidfdEffectAdvanceAngleWithRamp (struct ACTOR *actor)Per-tick update: spins an actor ever faster, from 1/16 turn a tick up to just over 1/8 (DEGtoANG(45) + 64), 80 more each tick for 52 ticks.
voidfdEffectUpdateMarsSpark (FIELD_PARTICLE *effect)Field effect sprite callback of a Mars Djinni's sparks (enum MARS_SPARK_STATE): the spark flies 120 pixels up the screen (give or take 3/32 turn) from its origin at up to 5 pixels a tick and starts over, until it stops where it arrives, hidden; 40 ticks later it swarms to points within 4 pixels of one 20 pixels over the leader, until it is freed once it arrives.
voidfdDjinnRunMarsJoinEffect (Sint32 djinniId)A Mars Djinni joins the party: it turns to the camera, bounces three times, spins ever faster and shrinks away in a fountain of 24 sparks (fdEffectUpdateMarsSpark).
voidfdEffectUpdateDescendingOrbitActor (struct ACTOR *actor)Per-tick update of a Venus Djinni's falling motes: each circles the leader a 32nd of a turn a tick on a shrinking spiral (0.4 pixels of radius for each tick left) while it sinks a pixel a tick, and is released 20 pixels above the leader's feet.
voidfdEffectUpdateRadialSpread (FIELD_PARTICLE *effect)Field effect sprite callback of a Venus Djinni's particles: each starts on screen at a random point 10 to 20 pixels round the leader and flies 120 pixels up the screen, over and over, until it is set to VENUS_PARTICLE_LAST_RISE and freed once it arrives.
voidfdDjinnRunVenusJoinEffect (Sint32 djinniId)A Venus Djinni joins the party: on a green screen it hops twice, spins and leaps, then shrinks away; the leader turns to the camera and raises both arms as green particles rise and 24 motes circle down onto him, and a burst of sparks ends it.
voidfdEffectUpdateRandomTargetParticle (FIELD_PARTICLE *effect)Field effect sprite callback of a Mercury Djinni's droplets: each falls from 100 pixels above (on screen) to a random point 2 to 8 pixels round a spot 15 to 20 pixels over the leader, at 3 to 6 pixels a tick, and where it lands splashes 12 pixels in a random direction, at half size, with SE_CRACK.
voidfdEffectHalveDistanceToTarget (struct ACTOR *actor)Per-tick update of an afterimage: closes half the distance to the actor it watches.
voidfdDjinnRunMercuryJoinEffect (Sint32 djinniId)A Mercury Djinni joins the party: the screen is tinted blue, the Djinni bounces twice and hops three times ever higher, then rises 120 pixels out of sight trailing eight afterimages; the leader raises its arms as droplets rain round it.
voidfdPsynergyRun (void)Casts the current field Psynergy with no target: runs the body of its kind (effectState->fieldPsynergy).
voidfdPsynergyDispatch (void)Casts the current field Psynergy on its target (secondActorId): runs the handler of its kind.
voidfdPsynergyFinishMindRead (void)Finishes the current field Psynergy when it is Mind Read: ends it and lets its target move again, unless the target is the actor kept stopped.
voidfdPsynergyRunEnd (void)Ends the current field Psynergy when it is Reveal, Cloak or Avoid: what each does as it wears off.
voidfdActorCycleSpriteColors (struct ACTOR *actor)Per-tick update: cycles an actor's colours through its own and the five with channels swapped, a new colour mode every tick.
struct ACTOR *fdActorSpawn (Sint32 kind, Sint32 x, Sint32 y, Sint32 z)Creates an actor for a field Psynergy, at the caster's ground height, with sprite priority 0 and animation 1.
voidfdActorSetOthersPaused (struct ACTOR *except, Sint32 paused, Sint32 animationSpeed)Pauses or resumes every actor but the player's and except, and sets their animations' speed.
voidfdEffectUpdateScaledArcActorA (struct ACTOR *actor)Per-tick update of a ring's back half (arc A): over CAST_RING_TICKS it swells and shrinks again while it rises a pixel a tick on the actor it follows, 9 pixels in front of it and up to 5 pixels further while small.
voidfdEffectUpdateScaledArcActorB (struct ACTOR *actor)Per-tick update of a ring's front half (arc B): the back half's arc upside down, 16 pixels in front of the actor and up to 5 pixels nearer while small.
voidfdEffectSpawnScaledArcActors (struct ACTOR *watched)Spawns a ring on an actor, its two halves (arcs A and B of SPRITE_GOLDEN_RINGS, B upside down); they follow it for CAST_RING_TICKS, then release themselves.
voidfdEffectFlickerActorAndSpawnArcs (struct ACTOR *actor)Per-tick update: flashes an actor white two ticks in four and sets off a ring around it every CAST_RING_INTERVAL ticks.
voidfdEffectCycleActorAndSpawnArcs (struct ACTOR *actor)Per-tick update: cycles an actor through its own colours and the five with channels swapped, a new one every two ticks, and sets off a ring around it every CAST_RING_INTERVAL ticks.
voidfdEffectUpdateAllEffectSlots (void)Event: updates the field Psynergy sprites.
voidfdPsynergyUpdateMindReadWave (void)Event of the wave effect: once its delay has run out, writes the next page of scanline offsets (a sine wave of 4 pixels either way), steps the colour fade and the hue every other tick, keeps the caster's colours cycling, and at the start of each 61-tick cycle sends three particles (SPRITE_CRESCENT), 8 ticks apart, from the target to the caster, with SE_PSYNERGY_START.
voidfdMindReadStartRipple (void)Event: restarts the HBlank DMA that writes BG0's horizontal scroll for each scanline from the wave's shown page.
voidfdMindReadAdvanceTint (void)Moves the wave's hue on 4 degrees and works out its colour, each channel 4 to 11.
voidfdEffectCalculateHueChannels (FIXED hue, FIXED *r, FIXED *g, FIXED *b)Works out red, green and blue (0 to 31 each, 16.16) for a hue in degrees (16.16).
Sint32fdEffectHueChannelRamp (Sint32 angle, Sint32 low, FIXED high)One colour channel's strength at a hue angle: rising from 0 to 60 degrees, high from 60 to 180, falling from 180 to 240, low elsewhere.
FIXEDfdFixedPointRemainder (FIXED value, FIXED divisor)The 16.16 remainder of value divided by divisor (0 for a zero divisor).
voidfdMindReadUpdateCrescent (struct ACTOR *actor)Per-tick update: once the actor has arrived (no destination left on any axis), releases it: FieldEffectUntargetedActorScript is a lone SC_RELEASE.
Sint32fdInputGetDpadAngle (Uint32 unused)Returns the direction of the d-pad (TRIG_TURN a full turn): right FACING_EAST, down FACING_SOUTH, left FACING_WEST, up FACING_NORTH; DPAD_ANGLE_NONE when none or a diagonal is held.
voidfdEffectUpdateMoveHand (struct ACTOR *actor)Per-tick update of Move's hand (fdEffectSpawnMoveHand): turns it toward the actor it watches, at most 1/16 turn a tick, and sheds a particle (SPRITE_SPARKLE) round it.
voidfdEffectUpdateOutAndBack (FIELD_PARTICLE *effect)Field effect sprite callback of a particle that flies 30 pixels out from where it started, comes back and is freed.
voidfdPsynergyMove (void)When Move is cast with no target, the hand appears beside the caster for 30 ticks and then bursts into sparkles.
voidfdActorSetRevealSpriteColor (Sint32 value)Draws every live actor whose sprite shows a rock (SPRITE_ROCK) in the colour mode value: Reveal greys the rocks with the backgrounds as it starts (SPRITE_COLOR_GREY) and gives them back their colours as it ends (SPRITE_COLOR_NORMAL).
voidfdPsynergyWatchLeaderDistance (void)Event of the timed Psynergy (FIELD_PSYNERGY_REVEAL): asks for it to end once the leader is REVEAL_RADIUS from its centre or its time has run out.
voidfdPsynergyReveal (void)Reveal: the backgrounds turn grey and show only within a rippling ellipse round the leader; runs the scene's Reveal script if there is one, puts markers round the leader and watches how far the leader walks.
voidfdPsynergyEndReveal (void)Ends Reveal if it is running: stops its watch, brings the colours back from black over 30 ticks and runs the scene's PSYNERGY_PHASE_FADES script.
voidfdPsynergyGrowthOnTarget (Sint32 unused)When Growth is cast on a target, particles fly from in front of the caster to points round the target, which then takes the sprite priority of the ground under it.
voidfdPsynergyGrowth (void)When Growth is cast with no target, particles fly out from in front of the caster, and then five bits of vine (SPRITE_VINE) fall 4 to 10 pixels round the Psynergy's position.
voidfdEffectSpawnBurstParticleField (void)Sends GROWTH_PARTICLE_MAX green sparks, one every 2 ticks, from in front of the caster to points round the Psynergy's position.
voidfdPsynergyLiftOnTarget (Sint32 unused)A hand appears 32 pixels to either side, each moves 14 pixels in, and they lift the target 32 pixels with them.
struct ACTOR *fdEffectSpawnLiftHand (Sint32 x, Sint32 y, Sint32 z, Sint32 angle)Spawns a hand (SPRITE_MOVE_HAND) and grows it, spinning, from a quarter to full size over 24 ticks; angle is the way it faces once grown.
voidfdEffectUpdateRadialBurst (FIELD_PARTICLE *effect)Field effect sprite callback of a particle that scatters 25 pixels from its origin in a random direction, then gathers in front of the caster and is freed: each of Force's FORCE_FLASHES flashes (script_commands_force.c).
Sint32fdEffectSpawnHeavyImpact (struct ACTOR *interpreter)A heavy impact: places a star burst (SPRITE_STAR_BURST) 32 pixels below the source for 20 ticks and scatters HEAVY_IMPACT_SPARKLES sparkles (SPRITE_SPARKLE) from it.
voidfdPsynergyForceOnTarget (Sint32 unused)Runs Force cast on a target, through fdPsynergyForce.
voidfdPsynergyForce (void)Flashes burst from over the caster's head, then a fist (SPRITE_MOVE_HAND) appears in front of it, grows and flies forward with three afterimages; what it hits (effectState->target) is pushed 16 pixels.
voidfdEffectUpdateOrbitingParticleFade (struct ACTOR *actor)Frost's glint on its target.
voidfdEffectUpdateOrbitingParticleLeft (struct ACTOR *actor)Per-tick update of a snowflake: spirals anticlockwise in to the target point (targetX to targetZ), at twice the ticks left in pixels, a 32nd of a turn further round for each, then fades.
voidfdEffectUpdateOrbitingParticleRight (struct ACTOR *actor)Per-tick update: as fdEffectUpdateOrbitingParticleLeft, clockwise.
voidfdPsynergyFrostOnTarget (Sint32 unused)Runs Frost cast on a target.
voidfdPsynergyFrost (void)FROST_SNOWFLAKES snowflakes spiral in on the Psynergy's position and make the target flash FROST_FLASHES times; without sceneVariant the target freezes.
voidfdEffectSwayParticle (struct ACTOR *actor)Per-tick update: sways 4 pixels either side of anchorX, once every 128 ticks.
voidfdEffectUpdateShrinkingOrbitActor (struct ACTOR *actor)Per-tick update: spirals in on a point 10 pixels above the Psynergy's position, at a radius of as many pixels as ticks are left; released when timer reaches 0.
voidfdEffectRunSparkEmitter (struct ACTOR *actor)Per-tick update: sways 6 pixels either side (a 64-tick cycle) 16 pixels above the Psynergy's position, and every 3 ticks sheds a spark that sways as it slowly falls.
voidfdPsynergyPlyOnTarget (Sint32 unused)Ply cast on a target, which stops the caster's update once it is done.
voidfdPsynergyPly (void)Eight particles spiral into the centre, where one appears, sheds sparks and flies far away.
voidfdPsynergyCheckCloakTile (void)Event of Cloak: when the metatile under the leader is not METATILE_BEHAVIOR_CLOAK, requests CLOAK_END.
voidfdPsynergyEndCloak (void)Ends Cloak: stops the metatile check and makes the leader blink back into sight, clearing cloaked.
voidfdPsynergyResumeCloakCheck (void)Starts the Cloak metatile check if the leader is hidden.
voidfdEffectUpdateDouseDrop (struct ACTOR *drop)Per-tick update of a falling drop: on reaching its ground height it is released 2 ticks later and scatters three half-size splashes, which hop toward points 32 pixels away and are released after 6 ticks.
voidfdEffectUpdateDriftingFallActor (struct ACTOR *actor)Per-tick update: drifts from side to side, up to a pixel a tick, as it falls 0.3 pixels a tick, and is released on reaching its ground height.
voidfdPsynergyDouseOnTarget (Sint32 unused)Runs Douse cast on a target, through fdPsynergyDouse.
voidfdPsynergyDouse (void)A rain cloud rises from 16 pixels above the caster to 32 pixels above the destination (80 with sceneVariant) over GROW_STEPS ticks, growing as it goes, rains drops, and returns.
voidfdEffectSpawnFallingParticles (void)Event while Carry holds its target: drops one particle a tick round the lifted actor, 8 to 24 pixels above it and 0 to 48 pixels away in a random direction (fdEffectInitFallingFragment).
voidfdPsynergySteerLiftedTarget (Sint32 targetId)When Carry is cast on a target, two hands lift it to 24 pixels above the ground; the d-pad moves it 16 pixels at a time and A, B, L or R drops it where it is.
struct ACTOR *fdEffectSpawnCarryHand (Sint32 x, Sint32 y, Sint32 z, Sint32 angle)Spawns a hand (SPRITE_MOVE_HAND) with the item break sound and grows it, spinning 1/8 turn a tick, from a quarter to full size over 24 ticks; angle is the way it faces once grown.
voidfdEffectSpawnRadialParticleRing (struct ACTOR *origin)Spawns 17 particles that spread from origin in a flat ring, their x velocity 1.5 times their z velocity, so the ring is wider than deep as the field is drawn.
voidfdEffectWanderAroundAnchor (struct ACTOR *actor)Per-tick update: wanders away from the anchor, 2 to 3 pixels a tick, now and then turning sharply; after 101 ticks it hands over to the shared particle script.
voidfdEffectCircleAnchor (struct ACTOR *actor)Per-tick update: circles the anchor at 8 pixels; after 121 ticks it starts to wander (fdEffectWanderAroundAnchor).
voidfdWhirlwindUpdateTarget (struct ACTOR *actor)Shrinks an event-selected Whirlwind target each tick; below half size, moves it to the origin, stops it and removes the update.
voidfdPsynergyWhirlwindOnTarget (Sint32 unused)Runs Whirlwind cast on a target, using the target already stored in the field effect.
voidfdPsynergyWhirlwind (void)Whirlwind: an orb grows as it flies from the caster to 4 pixels below the Psynergy's position in 10 ticks, swells and gusts; cast at a target a cue names, it shrinks the target away and sends 16 leaves circling, then it whooshes off.
voidfdEffectUpdateHaltParticle (FIELD_PARTICLE *effect)Field effect sprite callback of a Halt sparkle (OUT_AND_BACK_STATE): it heads for a point 40 to 70 pixels from where it appeared, then for a point 4 pixels round 8 pixels above the Psynergy's position on screen, and is freed on arrival.
voidfdPsynergyHaltOnTarget (Sint32 unused)Pauses the target (effectState->target) and runs fdPsynergyHalt.
voidfdPsynergyHalt (void)A stopwatch (SPRITE_STOPWATCH) flies from over the caster to the Psynergy's position over GROW_STEPS ticks, growing, sounds three low tones and a high one, and bursts into HALT_SPARKLES sparkles that fly out and back.
voidfdPsynergyUpdateHaltedActor (struct ACTOR *actor)Per-tick update of a halted actor: gives its sprite one of eight colour modes (HaltFlickerColorModes) at random, so it flickers.
Sint32fdPsynergyFilterHaltTarget (Sint32 id)Returns id, or -1 (no target) when Halt passes actor id's sprite over (SPEAKER_HALTED_LINES_NONE in SpeakerDefinitions): the talking monsters and the things, the 20 rows before the default.
voidfdPsynergyCatchOnTarget (Sint32 unused)Runs Catch cast on a target, through fdPsynergyCatch.
voidfdPsynergyCatch (void)A hand (SPRITE_MOVE_HAND) reaches from 16 pixels above the caster to the target over GROW_STEPS ticks, growing from a quarter to full size, clenches and presses down 20 pixels, taking what it caught off the map, then rises 19.5 pixels and shrinks back into the caster.
voidfdEffectUpdateSpinAngle (struct ACTOR *actor)Per-tick update: spins by FACING_STEP + timer * 80 a tick, speeding up (timer counts up) until timer * 80 reaches FACING_STEP: from 1/16 turn a tick to just over 1/8 in 52 ticks, as fdEffectAdvanceAngleWithRamp.
voidfdEffectUpdateRetreatCaster (struct ACTOR *actor)Per-tick update: spins 1/8 turn a tick as it shrinks by 5/512 of its full size, rising a pixel a tick; once its scale falls below 3/16 (84 ticks from full size) its sprites are hidden, but it is not released.
voidfdRetreatUpdateSpark (FIELD_PARTICLE *effect)Field effect sprite callback: a particle flies 120 pixels from the main actor's screen position (8 pixels lower) in a direction within 1/8 turn of up the screen, at up to 5 pixels a tick, and starts again from the main actor on arrival until it takes its last flight.
voidfdPsynergyRetreat (void)Spins the main actor and shrinks it while 24 particles fly out, one a tick.
voidfdEffectUpdateDescendingParticlePositiveArc (struct ACTOR *actor)Per-tick update of a falling arc: grows toward full size (3/64 a tick) as it falls 2 pixels a tick on the actor it follows, 9 pixels in front of it and up to 5 pixels further while small; released 10 pixels above the ground (4 on the World Map, MAP_INDEX_WORLD).
voidfdEffectUpdateDescendingParticleNegativeArc (struct ACTOR *actor)As fdEffectUpdateDescendingParticlePositiveArc for the arc drawn upside down, 16 pixels in front of the actor and up to 5 pixels nearer.
voidfdEffectSpawnDescendingArcParticles (struct ACTOR *src)Avoid's rings: a pair of falling arcs (one upside down) 64 pixels above source, at 0.4 of full size, drawn with the tiles in effectState->arcTileSlot.
voidfdEffectBlinkAvoidCaster (void)End of the Psynergy: switches the caster's sprite between SPRITE_FLAG_SHADOW | SPRITE_FLAG_OUTLINED and SPRITE_FLAG_SHADOW on a 5-tick cycle, so it flashes as a dark outline.
voidfdEffectUpdateAvoidCaster (struct ACTOR *actor)The caster during the Psynergy: sheds a pair of falling arcs every 5 ticks (7 on the World Map), and spins in phase 1, 3/64 turn a tick.
voidfdPsynergyShowAvoidWoreOff (void)Says that Avoid, or the Sacred Feather, has worn off: "Avoid's effects wore off." Clears MainRoutineStateWork.avoidDistance.
voidfdPsynergyAvoid (void)The caster spins among falling arcs and flashes white, then flashes as an outline, and encounters are kept away until Avoid wears off.
voidfdParticleDraw (FIELD_PARTICLE *object)Draws a field effect sprite at its screen position and scale, when it is near the screen: x from -32 to 272 pixels and z from -32 to 224, both exclusive.
voidfdParticleUpdateMotion (FIELD_PARTICLE *effect)Moves a field effect sprite toward its target, turning at most turnStepMax a tick when turnStepLimited is set and speeding up by acceleration to speedMax.
voidfdMapScreenInit (void)Sets up the map screen: the marker tiles and their OAM entries, the cursor where the leader is on the map (or mid-screen when the area is not on it), and the name window.
voidfdMapScreenRelease (void)Closes the map screen: returns its VRAM blocks and removes the name window.
voidfdMapScreenUpdateMarkers (void)Event of the map screen: shows a marker at each area whose flag is set, moves the cursor with the d-pad (to the current area while L or R is held) and shows the name of the marker nearest the cursor.
voidfdMapScreenShow (Sint32 image)The map screen, shown over the World Map when the player presses R, until A or B closes it; it borrows the map-metatile buffer for its pixels.
voidfdUpdateActorVisibilityBounds (void)On the World Map, shows only the scene's actors within 320 pixels sideways, 600 above and 400 below the camera.
voidfdWorldMapZoomOutWhileLHeld (void)On the World Map, zooms the view out to toFIXED(1) * 8 / 13 while L is held, then back.

Variables

NameDescription
extern const SPARKLE_PICTUREFieldEffectSparklePictures [32]{dy, tile} of a sparkle (script_commands_weather.c): dy in screen pixels from its spot, a row every two ticks.
extern const Sint32MapScreenAreaMarkers []The World Map's area markers, {tile << 16 | flag, area} for each area's actor id from 11, ended by -1; a zero row reserves an actor id with no marker.
extern const Uint8MessageSpeedVoiceRates []The message voice's rate by message speed option: 1, 3, then 10 (fdMessageSetVoiceFromActor).

Description

What script_commands.c declares for the files that use it: the commands scripts run, moving on the field, weather and line scrolls, Djinn joining the party, each field Psynergy and its effects, and the map screen.

Macros in detail

DJINN_NO_HOP

#define DJINN_NO_HOP 0x800

fdRequestDjinnBattle's actorAndHop: the Djinni does not hop first.

Referenced by fdDjinnRestoreActorAfterBattle(), fdRequestDjinnBattle(), scWorldMapMeetCorona(), scWorldMapMeetHail() and scWorldMapMeetVine().

Definition at line 74 of file script_commands.h.

CAMERA_KEEP

#define CAMERA_KEEP (-1)

A camera move's axis that stays where the camera is.

Referenced by fdCameraMoveToActorById(), fdCameraMoveWithinMapBounds(), fdEntrancePlayArrival(), fdPsynergyRetreat(), scAlpineCrossingFeizhiArrives(), scAltinPeakRunBoulderChase(), scAltinPeakShowFirstBeastRoute(), scAltinPeakStartHydrosBattle(), scAltinScareOffBeast(), scAltmillerCaveMeetInvisibleBabi(), scAltmillerCaveRestoreBabiAndInviteParty(), scBabiLighthouseExplainTruthDoor(), scBabiLighthouseFallToExit(), scBabiLighthouseFaranAsksPartyToOpenDoor(), scBabiLighthouseJumpIntoPit(), scBabiLighthouseLandWithParticles(), scBabiPalaceHearSoldiersReport(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalaceRestInPalaceBeds(), scBilibinJillGivesHardNut(), scColosseumAzartMatchDousePipe(), scColosseumAzartMatchExplainFinalsRules(), scColosseumAzartMatchPushPipeworksPipe(), scColosseumAzartMatchTalkToBridgeAttendant(), scColosseumAzartMatchTalkToLumberAttendant(), scColosseumAzartMatchTalkToPipeworksAttendant(), scColosseumAzartMatchTalkToRockAttendant(), scColosseumEntranceCrowdRecognizesIsaac(), scColosseumEntranceExplainPartySupport(), scColosseumEntranceFinalsStart(), scColosseumEntranceFollowEscortOut(), scColosseumEntranceShowClearedTrial(), scColosseumEntranceShowFailedTrial(), scColosseumEntranceTalkToTrialAttendant(), scColosseumNavampaMatchTalkToFreeClimbAttendant(), scColosseumNavampaMatchTalkToLogRollingAttendant(), scColosseumNavampaMatchTalkToMovingSidewalkAttendant(), scColosseumNavampaMatchTalkToScalesAttendant(), scColosseumNavampaMatchTalkToSteppingStoneAttendant(), scColosseumNavampaMatchTalkToWallWedgeAttendant(), scColosseumSatrageMatchTalkToBoardWalkAttendant(), scColosseumSatrageMatchTalkToLogRollingAttendant(), scColosseumSatrageMatchTalkToMiniMazeAttendant(), scColosseumSatrageMatchTalkToShiftingFloorAttendant(), scColosseumSatrageMatchTalkToWallAttendant(), scCottageRoomsAGaretComesHome(), scCottageRoomsBHurryToThePlaza(), scCottageRoomsBShowMythrilBag(), scCrossboneIsleSteppingStonesFlipWaterSwitch(), scCrossboneIsleSteppingStonesFreezeThirdPuddle() and 144 more.

Definition at line 87 of file script_commands.h.

DPAD_ANGLE_NONE

#define DPAD_ANGLE_NONE 65535

What fdInputGetDpadAngle returns when no direction, or a diagonal, is held: the blank entries of InputDpadAngles.

Referenced by fdMapScreenUpdateMarkers(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget(), InputDpadAngles and WorldMapCursorDirectionAngles.

Definition at line 161 of file script_commands.h.

Enumerations in detail

FIELD_PSYNERGY_HANDLER

enum FIELD_PSYNERGY_HANDLER

A step of the current field Psynergy (fdPsynergyRunHandler).

EnumeratorValueDescription
FIELD_PSYNERGY_HANDLER_UNTARGETED0Casts it with no target (fdPsynergyRun).
FIELD_PSYNERGY_HANDLER_ON_TARGET1Casts it on its target, secondActorId (fdPsynergyDispatch).
FIELD_PSYNERGY_HANDLER_END_MIND_READ2Ends it, when it is Mind Read (fdPsynergyFinishMindRead).
FIELD_PSYNERGY_HANDLER_END3Ends a lasting one, Reveal, Cloak or Avoid, as it wears off (fdPsynergyRunEnd).

Definition at line 20 of file script_commands.h.

FIELD_PSY

enum FIELD_PSY

A field Psynergy, as the field kind: the type column of games/tbs/src/game/ability_table.c, named for the abilities that have it.

EnumeratorValueDescription
FIELD_PSYNERGY_MOVE1
FIELD_PSYNERGY_MIND_READ2
FIELD_PSYNERGY_PLY3Ply, Ply Well and Pure Ply.
FIELD_PSYNERGY_FORCE4
FIELD_PSYNERGY_DOUSE5
FIELD_PSYNERGY_FROST6
FIELD_PSYNERGY_LIFT7
FIELD_PSYNERGY_REVEAL8
FIELD_PSYNERGY_HALT9
FIELD_PSYNERGY_CLOAK10
FIELD_PSYNERGY_CARRY11
FIELD_PSYNERGY_GROWTH12
FIELD_PSYNERGY_CATCH13
FIELD_PSYNERGY_WHIRLWIND14Whirlwind and Gale.
FIELD_PSYNERGY_RETREAT15
FIELD_PSYNERGY_AVOID16

Definition at line 36 of file script_commands.h.

MAP_SCREEN_MARKER_TILE

enum MAP_SCREEN_MARKER_TILE

The map screen's marker tiles: the party's dot, the two kinds of area a MAP_SCREEN_MARKER row (AREA_MARKER or LIGHTHOUSE_MARKER) asks for (a town or a place on the way; a lighthouse or Sol Sanctum), and the larger dot that blinks over the marker nearest the cursor.

EnumeratorValueDescription
MAP_SCREEN_MARKER_PARTY
MAP_SCREEN_MARKER_AREA
MAP_SCREEN_MARKER_LIGHTHOUSE
MAP_SCREEN_MARKER_NEAREST

Definition at line 232 of file script_commands.h.