src/field/field_script_commands.c
Actor script commands: waits, jumps, flags, moves and work values. More…
Included by field.c.
Macros
| Name | Description | |
|---|---|---|
#define | SCRIPT_LABEL_KEY_MASK 0xbfffffff | SC_LABEL and SC_TO differ only in bit 30; a jump searches for the label. |
#define | DISTANCE (a, b) ((a) - (b) < 0 ? (b) - (a) : (a) - (b)) | How far apart a and b are. |
#define | SCRIPT_DEFINE_OPERAND_WORD (name, field) | Defines the handler for a 32-bit work value: set it, add to it, or compare it (into conditionResult). |
#define | SCRIPT_DEFINE_OPERAND_ADDRESS (name, field) | The same for an address: an add steps by value words (value * 4 bytes). |
#define | SCRIPT_DEFINE_OPERAND_NARROW (name, field, type) | The same for an 8- or 16-bit value: a compare narrows value to its type. |
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { SCRIPT_LABEL_SEARCH_WORDS, SCRIPT_BLOCKED_MOVE_TICKS, SCRIPT … } | The actor script commands' limits, angles and distances. |
enum | SCRIPT_OPERAND_OPERATION { SCRIPT_OPERAND_SET, SCRIPT_OPERAND_ADD, SCRIPT_OPERAND_COMPA … } | What a work value handler does with its value, for SC_SET, SC_ADD and SC_CMP in turn. |
Functions
| Name | Description | |
|---|---|---|
void | fdActorUpdateAllMotion (void) | Advances the motion of those of the first RUNNING_LIST_SLOTS actors whose script is running by one tick, without running their scripts: steering towards a target or braking, gravity and bouncing, arrival, and turning to face the direction of travel. |
Sint32 | fdActorScriptWait (ACTOR *interpreter) | SC_WAIT(n): waits n ticks; this tick counts as the first. |
Bool | fdActorScriptWaitForArrival (ACTOR *interpreter) | SC_SYNC: waits until the actor arrives at its target, or until a solid actor has blocked it for SCRIPT_BLOCKED_MOVE_TICKS ticks (refused is the blocked count, which fdActorUpdateAllOnField raises), when its target is cleared. |
Bool | fdActorScriptInvokeCallback (ACTOR *interpreter) | SC_CALL(fn): calls fn with the actor. |
Sint32 | fdActorScriptFindLabel (ACTOR *interpreter, Uint32 labelKey) | Returns the cursor just past the script's label key (SC_LABEL or SC_TO, matched without the bit that tells them apart), searching its first SCRIPT_LABEL_SEARCH_WORDS words, or 0 (the start) when key is 0 or not found, so a missing label restarts the script. |
Sint32 | fdActorScriptRepeatOrJump (ACTOR *interpreter) | SC_LOOP(n, to): jumps to label to until it has done so n - 1 times, then moves on; with n = SC_FOREVER it always jumps. |
Sint32 | fdActorScriptJumpToLabel (ACTOR *interpreter) | SC_JUMP(to): jumps to label to. |
Sint32 | fdActorScriptJumpIfTrue (ACTOR *interpreter) | SC_IF(to): jumps to label to when the last test was true. |
Sint32 | fdActorScriptJumpIfFalse (ACTOR *interpreter) | SC_IFNOT(to): jumps to label to when the last test was false. |
Sint32 | fdActorScriptEnd (ACTOR *interpreter) | SC_END: hands the actor back to the idle script, ActorScriptIdleScript, whose lone SC_END runs again each tick. |
Sint32 | fdActorScriptTestFlag (ACTOR *interpreter) | SC_FLAG_CHECK(f): tests game flag f. |
Sint32 | fdActorScriptSetFlagAndTest (ACTOR *interpreter) | SC_FLAG_ON(f): tests game flag f, then sets it. |
Sint32 | fdActorScriptClearFlagAndTest (ACTOR *interpreter) | SC_FLAG_OFF(f): tests game flag f, then clears it. |
Sint32 | fdActorScriptToggleFlagAndTest (ACTOR *interpreter) | SC_FLAG_REV(f): tests game flag f, then flips it. |
Sint32 | fdActorScriptSetAnimation (ACTOR *interpreter) | SC_ANIMATION(v): switches the actor's sprites to animation v. |
Sint32 | fdActorScriptRelease (ACTOR *interpreter) | SC_RELEASE: releases the actor through fdActorRelease, which releases its sprites and zeroes its slot. |
Sint32 | fdActorScriptNoOperation (ACTOR *interpreter) | SC_NOP(v): does nothing with its operand. |
Sint32 | fdActorScriptPlaySound (ACTOR *interpreter) | SC_SE(n): sends sound command n. |
Sint32 | fdActorScriptPlaySoundInView (ACTOR *interpreter) | SC_SE_IN_VIEW(n): plays sound n when the actor is in view of the camera (fdActorPlaySoundInView). |
Sint32 | fdActorScriptCheckOverlap (ACTOR *actor, Sint32 *pos) | Returns -1 when an actor at pos would overlap a solid actor, each radius less 2 pixels; otherwise 0. |
ACTOR * | fdActorScriptFindOverlappingActor (ACTOR *actor, Sint32 *pos) | Returns the first solid actor that an actor at pos would overlap, as fdActorScriptCheckOverlap tests, or NULL. |
Sint32 | fdActorScriptSetPosAndResetMotion (ACTOR *actor) | SC_POSITION(x, y, z): places the actor at (x, y, z) and stops it; with y -1 an actor that follows the ground is raised by the ground height there. |
Sint32 | fdActorScriptResetToOrigin (ACTOR *actor) | SC_POSITION_ORIGIN: puts the actor at x and z 0, keeping its height, with no destination or speed; one that follows the ground then takes the ground height there. |
Sint32 | fdActorScriptMove (ACTOR *actor) | SC_MOVE(x, y, z): sends the actor towards (x, y, z). |
Sint32 | fdActorScriptMoveXZ (ACTOR *actor) | SC_MOVE_XZ(x, z): sends the actor towards (x, z), keeping its height. |
Sint32 | fdActorScriptMoveBy (ACTOR *actor) | SC_MOVE_BY(x, y, z): sends the actor towards its position plus (x, y, z). |
Sint32 | fdActorScriptFaceWatched (ACTOR *actor) | SC_FACE_WATCHED: turns the actor to face its watched actor, on the ground plane (x and z). |
Sint32 | fdActorScriptMoveToWatched (ACTOR *actor) | SC_MOVE_TO_WATCHED: sends the actor towards its watched actor. |
Sint32 | fdActorScriptMoveLocal (ACTOR *actor) | SC_MOVE_LOCAL(a, b): sends the actor towards its position plus an offset that is never filled in; the operands are skipped unread. |
Sint32 | fdCameraFollowLeaderInBounds (ACTOR *interpreter) | SC_CAMERA: keeps the camera actor on its leader (watchedActor), clamped so the view stays on the map, and pushed out of the map's camera boxes, which the view may not show. |
Sint32 | fdCameraFollowWatchedInBounds (ACTOR *camera) | SC_CAMERA_IN_BOUNDS: as SC_CAMERA, clamped to the map alone, without its camera boxes. |
Bool | fdActorApproachWatchedActor (ACTOR *actor) | SC_APPROACH_WATCHED: follows the watched actor at its speed. |
Bool | fdActorWander (ACTOR *actor) | SC_WANDER(base, range, limit): walks to a random point base to base + range away, within SCRIPT_WANDER_SIDE_ANGLE either side of its facing, that no solid actor or wall blocks, with clear ground SCRIPT_WANDER_PROBE_DISTANCE further at SCRIPT_WANDER_DIAGONAL_ANGLE either side, and within limit pixels of home. |
Sint32 | fdActorScriptWanderNearHome (ACTOR *actor) | SC_WANDER_HOME(base, range, limit): wanders as SC_WANDER does, testing more ground around the point, while it is within limit pixels of home; outside that, or when no point works, it heads back towards home. |
void | fdActorScriptSetOrCompareCursor (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value) | Work value SW_CURSOR: sets, adds to or compares the script cursor. |
void | fdActorScriptSetOrCompareRadius (SCRIPT_OPERANDS *state, Sint32 operation, Sint32 value) | Work value SW_RADIUS: sets, adds to or compares the actor's radius. |
static __inline__ Sint32 | fdActorScriptApplyOperandCommand (SCRIPT_OPERANDS *operands, Sint32 operation) | Reads the two words after the command (a work value number and a value) and passes operation to that value's handler. |
Sint32 | fdActorScriptApplyOperandSet (ACTOR *interpreter) | SC_SET(w, v): sets work value w to v. |
Sint32 | fdActorScriptApplyOperandAdd (ACTOR *interpreter) | SC_ADD(w, v): adds v to work value w. |
Sint32 | fdActorScriptApplyOperandCompare (ACTOR *interpreter) | SC_CMP(w, v): tests whether work value w equals v. |
void | fdActorSetUpdate (ACTOR *actor, void (*update)(void)) | Unused: sets an actor's update function, when there is an actor. |
Bool | fdActorUpdateHoverControl (ACTOR *actor) | SC_HOVER: the leader hovering (the Hover Psynergy), moved by the direction pad over what lies below. |
Variables
| Name | Description | |
|---|---|---|
extern const Sint16 | WorldMapKeyHeadings [16] | The heading of each direction-pad combination (facing.c), read here and by the leader's controls after this file in field.c, on foot as on the World Map. |
Description
Actor script commands: waits, jumps, flags, moves and work values.
Each SC_ handler here is reached through ActorScriptCommandTable
(map_grid_data.c), which fdActorUpdateAllOnField calls for each live actor;
each returns 1 to run the actor's next command at once and 0 to end the
actor's tick. Part of field.c.
Macros in detail
SCRIPT_LABEL_KEY_MASK
#define SCRIPT_LABEL_KEY_MASK 0xbfffffff
SC_LABEL and SC_TO differ only in bit 30; a jump searches for the label.
Referenced by fdActorScriptFindLabel().
Definition at line 48 of file field_script_commands.c.
DISTANCE
#define DISTANCE(a, b) ((a) - (b) < 0 ? (b) - (a) : (a) - (b))
How far apart a and b are.
Referenced by fdCameraFollowLeaderInBounds().
Definition at line 681 of file field_script_commands.c.
SCRIPT_DEFINE_OPERAND_WORD
#define SCRIPT_DEFINE_OPERAND_WORD(name, field)
Defines the handler for a 32-bit work value: set it, add to it, or compare it (into conditionResult).
Definition at line 1204 of file field_script_commands.c.
SCRIPT_DEFINE_OPERAND_ADDRESS
#define SCRIPT_DEFINE_OPERAND_ADDRESS(name, field)
The same for an address: an add steps by value words (value * 4 bytes).
Definition at line 1221 of file field_script_commands.c.
SCRIPT_DEFINE_OPERAND_NARROW
#define SCRIPT_DEFINE_OPERAND_NARROW(name, field, type)
The same for an 8- or 16-bit value: a compare narrows value to its type.
Definition at line 1238 of file field_script_commands.c.
Enumerations in detail
anonymous enum
enum { SCRIPT_LABEL_SEARCH_WORDS, SCRIPT_BLOCKED_MOVE_TICKS, SCRIPT_WANDER_TRIES, SCRIPT_WANDER_PROBE_DISTANCE, … }
The actor script commands' limits, angles and distances.
| Enumerator | Value | Description |
|---|---|---|
SCRIPT_LABEL_SEARCH_WORDS | 1024 | Script words a jump searches. |
SCRIPT_BLOCKED_MOVE_TICKS | 60 | Refused ticks SC_SYNC waits through. |
SCRIPT_WANDER_TRIES | 7 | Random points a wander tries a tick. |
SCRIPT_WANDER_PROBE_DISTANCE | toFIXED(8) | The wander probes' distance, 8 pixels in 16.16: past the point for ground, and along the heading for solid actors (SC_WANDER_HOME). |
SCRIPT_WANDER_DIAGONAL_ANGLE | DEGtoANG(45) | One eighth of a turn. |
SCRIPT_WANDER_SIDE_ANGLE | DEGtoANG(90) | One quarter of a turn. |
SCRIPT_HALF_TURN | DEGtoANG(180) | |
SCRIPT_APPROACH_DISTANCE | 16 | Whole pixels SC_APPROACH_WATCHED stays short of its watched actor. |
CAMERA_FOLLOW_FINE_DISTANCE | toFIXED(64) | Under 64 pixels (16.16) SC_CAMERA measures its distance in 16.16. |
CAMERA_FOLLOW_SNAP_DISTANCE | toFIXED(1) / 4 | Within a quarter pixel (16.16) SC_CAMERA lands on its point. |
CAMERA_FOLLOW_HEIGHT_SNAP | toFIXED(1) / 2 | Within half a pixel (16.16) SC_CAMERA takes the leader's height at once. |
Definition at line 16 of file field_script_commands.c.
SCRIPT_OPERAND_OPERATION
enum SCRIPT_OPERAND_OPERATION
What a work value handler does with its value, for SC_SET, SC_ADD and SC_CMP
in turn.
| Enumerator | Value | Description |
|---|---|---|
SCRIPT_OPERAND_SET | ||
SCRIPT_OPERAND_ADD | ||
SCRIPT_OPERAND_COMPARE | sets conditionResult to 1 when equal, else 0 |
Definition at line 1195 of file field_script_commands.c.
Functions in detail
fdActorUpdateAllMotion
void fdActorUpdateAllMotion(void)
Advances the motion of those of the first RUNNING_LIST_SLOTS actors whose
script is running by one tick, without running their scripts: steering
towards a target or braking, gravity and bouncing, arrival, and turning to
face the direction of travel.
References fdActorListRunning(), Sint32, syAtan(), syDivFX() and sySquartIWRAM().
Referenced by fdActorSystemInit().
Definition at line 54 of file field_script_commands.c.
fdActorScriptWait
Sint32 fdActorScriptWait(ACTOR *interpreter)
SC_WAIT(n): waits n ticks; this tick counts as the first.
References Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 245 of file field_script_commands.c.
fdActorScriptWaitForArrival
Bool fdActorScriptWaitForArrival(ACTOR *interpreter)
SC_SYNC: waits until the actor arrives at its target, or until a solid actor
has blocked it for SCRIPT_BLOCKED_MOVE_TICKS ticks (refused is the blocked
count, which fdActorUpdateAllOnField raises), when its target is cleared.
References fdActorIsTargetUnset().
Referenced by ActorScriptCommandTable.
Definition at line 257 of file field_script_commands.c.
fdActorScriptInvokeCallback
Bool fdActorScriptInvokeCallback(ACTOR *interpreter)
SC_CALL(fn): calls fn with the actor.
Referenced by ActorScriptCommandTable.
Definition at line 280 of file field_script_commands.c.
fdActorScriptFindLabel
Sint32 fdActorScriptFindLabel(ACTOR *interpreter, Uint32 labelKey)
Returns the cursor just past the script's label key (SC_LABEL or SC_TO,
matched without the bit that tells them apart), searching its first
SCRIPT_LABEL_SEARCH_WORDS words, or 0 (the start) when key is 0 or not found,
so a missing label restarts the script. Clears the wait.
References Sint32.
Referenced by fdActorScriptJumpIfFalse(), fdActorScriptJumpIfTrue(), fdActorScriptJumpToLabel() and fdActorScriptRepeatOrJump().
Definition at line 297 of file field_script_commands.c.
fdActorScriptRepeatOrJump
Sint32 fdActorScriptRepeatOrJump(ACTOR *interpreter)
SC_LOOP(n, to): jumps to label to until it has done so n - 1 times, then
moves on; with n = SC_FOREVER it always jumps.
References fdActorScriptFindLabel() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 322 of file field_script_commands.c.
fdActorScriptJumpToLabel
Sint32 fdActorScriptJumpToLabel(ACTOR *interpreter)
SC_JUMP(to): jumps to label to.
References fdActorScriptFindLabel() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 358 of file field_script_commands.c.
fdActorScriptJumpIfTrue
Sint32 fdActorScriptJumpIfTrue(ACTOR *interpreter)
SC_IF(to): jumps to label to when the last test was true.
References fdActorScriptFindLabel() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 366 of file field_script_commands.c.
fdActorScriptJumpIfFalse
Sint32 fdActorScriptJumpIfFalse(ACTOR *interpreter)
SC_IFNOT(to): jumps to label to when the last test was false.
References fdActorScriptFindLabel() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 385 of file field_script_commands.c.
fdActorScriptEnd
Sint32 fdActorScriptEnd(ACTOR *interpreter)
SC_END: hands the actor back to the idle script, ActorScriptIdleScript, whose
lone SC_END runs again each tick. Returns 0.
References ActorScriptIdleScript, result and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 405 of file field_script_commands.c.
fdActorScriptTestFlag
Sint32 fdActorScriptTestFlag(ACTOR *interpreter)
SC_FLAG_CHECK(f): tests game flag f.
References Sint32 and syGameFlagGet().
Referenced by ActorScriptCommandTable.
Definition at line 415 of file field_script_commands.c.
fdActorScriptSetFlagAndTest
Sint32 fdActorScriptSetFlagAndTest(ACTOR *interpreter)
SC_FLAG_ON(f): tests game flag f, then sets it.
References Sint32, syGameFlagGet() and syGameFlagSet().
Referenced by ActorScriptCommandTable.
Definition at line 427 of file field_script_commands.c.
fdActorScriptClearFlagAndTest
Sint32 fdActorScriptClearFlagAndTest(ACTOR *interpreter)
SC_FLAG_OFF(f): tests game flag f, then clears it.
References Sint32, syGameFlagClear() and syGameFlagGet().
Referenced by ActorScriptCommandTable.
Definition at line 439 of file field_script_commands.c.
fdActorScriptToggleFlagAndTest
Sint32 fdActorScriptToggleFlagAndTest(ACTOR *interpreter)
SC_FLAG_REV(f): tests game flag f, then flips it.
References Sint32, syGameFlagClear(), syGameFlagGet() and syGameFlagSet().
Referenced by ActorScriptCommandTable.
Definition at line 451 of file field_script_commands.c.
fdActorScriptSetAnimation
Sint32 fdActorScriptSetAnimation(ACTOR *interpreter)
SC_ANIMATION(v): switches the actor's sprites to animation v.
References fdActorSelectAnimation() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 466 of file field_script_commands.c.
fdActorScriptRelease
Sint32 fdActorScriptRelease(ACTOR *interpreter)
SC_RELEASE: releases the actor through fdActorRelease, which releases its
sprites and zeroes its slot.
References fdActorRelease() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 476 of file field_script_commands.c.
fdActorScriptNoOperation
Sint32 fdActorScriptNoOperation(ACTOR *interpreter)
SC_NOP(v): does nothing with its operand.
References Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 483 of file field_script_commands.c.
fdActorScriptPlaySound
Sint32 fdActorScriptPlaySound(ACTOR *interpreter)
SC_SE(n): sends sound command n.
References Sint32 and sySoundPlayStub().
Referenced by ActorScriptCommandTable.
Definition at line 490 of file field_script_commands.c.
fdActorScriptPlaySoundInView
Sint32 fdActorScriptPlaySoundInView(ACTOR *interpreter)
SC_SE_IN_VIEW(n): plays sound n when the actor is in view of the camera
(fdActorPlaySoundInView).
References fdActorPlaySoundInViewStub() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 499 of file field_script_commands.c.
fdActorScriptCheckOverlap
Sint32 fdActorScriptCheckOverlap(ACTOR *actor, Sint32 *pos)
Returns -1 when an actor at pos would overlap a solid actor, each radius less 2 pixels; otherwise 0.
References fdCheckSpheresOverlap() and Sint32.
Referenced by fdActorSailOnMap(), fdActorScriptWanderNearHome(), fdActorUpdateAllOnField(), fdActorUpdatePlayerControl(), fdActorUpdateWalkingControl() and fdActorWander().
Definition at line 509 of file field_script_commands.c.
fdActorScriptFindOverlappingActor
ACTOR *fdActorScriptFindOverlappingActor(ACTOR *actor, Sint32 *pos)
Returns the first solid actor that an actor at pos would overlap, as
fdActorScriptCheckOverlap tests, or NULL.
References fdCheckSpheresOverlap() and Sint32.
Definition at line 532 of file field_script_commands.c.
fdActorScriptSetPosAndResetMotion
Sint32 fdActorScriptSetPosAndResetMotion(ACTOR *actor)
SC_POSITION(x, y, z): places the actor at (x, y, z) and stops it; with y -1
an actor that follows the ground is raised by the ground height there.
References fdActorSetPosAndResetMotion(), fdMapGridGetTerrainHeight() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 555 of file field_script_commands.c.
fdActorScriptResetToOrigin
Sint32 fdActorScriptResetToOrigin(ACTOR *actor)
SC_POSITION_ORIGIN: puts the actor at x and z 0, keeping its height, with no
destination or speed; one that follows the ground then takes the ground
height there.
References fdActorSetPosAndResetMotion(), fdMapGridGetTerrainHeight() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 578 of file field_script_commands.c.
fdActorScriptMove
Sint32 fdActorScriptMove(ACTOR *actor)
SC_MOVE(x, y, z): sends the actor towards (x, y, z).
References fdActorSetMoveTarget() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 595 of file field_script_commands.c.
fdActorScriptMoveXZ
Sint32 fdActorScriptMoveXZ(ACTOR *actor)
SC_MOVE_XZ(x, z): sends the actor towards (x, z), keeping its height.
References fdActorSetMoveTarget() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 608 of file field_script_commands.c.
fdActorScriptMoveBy
Sint32 fdActorScriptMoveBy(ACTOR *actor)
SC_MOVE_BY(x, y, z): sends the actor towards its position plus (x, y, z).
References fdActorSetMoveTarget() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 620 of file field_script_commands.c.
fdActorScriptFaceWatched
Sint32 fdActorScriptFaceWatched(ACTOR *actor)
SC_FACE_WATCHED: turns the actor to face its watched actor, on the ground
plane (x and z).
References Sint32 and syAtan().
Referenced by ActorScriptCommandTable.
Definition at line 638 of file field_script_commands.c.
fdActorScriptMoveToWatched
Sint32 fdActorScriptMoveToWatched(ACTOR *actor)
SC_MOVE_TO_WATCHED: sends the actor towards its watched actor.
References fdActorSetMoveTarget() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 650 of file field_script_commands.c.
fdActorScriptMoveLocal
Sint32 fdActorScriptMoveLocal(ACTOR *actor)
SC_MOVE_LOCAL(a, b): sends the actor towards its position plus an offset that
is never filled in; the operands are skipped unread.
References fdActorSetMoveTarget() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 663 of file field_script_commands.c.
fdCameraFollowLeaderInBounds
Sint32 fdCameraFollowLeaderInBounds(ACTOR *interpreter)
SC_CAMERA: keeps the camera actor on its leader (watchedActor), clamped so
the view stays on the map, and pushed out of the map's camera boxes, which
the view may not show.
References Sint32, syDivFX(), syIWRAMMulFX(), sySquartFX() and sySquartIWRAM().
Referenced by ActorScriptCommandTable.
Definition at line 686 of file field_script_commands.c.
fdCameraFollowWatchedInBounds
Sint32 fdCameraFollowWatchedInBounds(ACTOR *camera)
SC_CAMERA_IN_BOUNDS: as SC_CAMERA, clamped to the map alone, without its
camera boxes. Its approach is SC_CAMERA's written out again: its bounds
ignore the leader's height and it scales the step by syMulFX, not the IWRAM
copy, so no one body serves both.
References Sint32, syDivFX(), sySquartFX() and sySquartIWRAM().
Referenced by ActorScriptCommandTable.
Definition at line 823 of file field_script_commands.c.
fdActorApproachWatchedActor
Bool fdActorApproachWatchedActor(ACTOR *actor)
SC_APPROACH_WATCHED: follows the watched actor at its speed. Further than
SCRIPT_APPROACH_DISTANCE away it walks to that distance short of it and runs
on; nearer, it stands and waits for the next tick.
References fdActorSelectAnimation(), fdActorSetMoveTarget(), Sint32 and sySquartIWRAM().
Referenced by ActorScriptCommandTable.
Definition at line 913 of file field_script_commands.c.
fdActorWander
Bool fdActorWander(ACTOR *actor)
SC_WANDER(base, range, limit): walks to a random point base to base + range
away, within SCRIPT_WANDER_SIDE_ANGLE either side of its facing, that no
solid actor or wall blocks, with clear ground SCRIPT_WANDER_PROBE_DISTANCE
further at SCRIPT_WANDER_DIAGONAL_ANGLE either side, and within limit pixels
of home. After SCRIPT_WANDER_TRIES failed tries it turns around and waits for
the next tick.
References fdActorScriptCheckOverlap(), fdActorSetMoveTarget(), fdMapGridCheckCollision(), Sint32, syRandom() and syVectorAddPolarOffset().
Referenced by ActorScriptCommandTable.
Definition at line 957 of file field_script_commands.c.
fdActorScriptWanderNearHome
Sint32 fdActorScriptWanderNearHome(ACTOR *actor)
SC_WANDER_HOME(base, range, limit): wanders as SC_WANDER does, testing more
ground around the point, while it is within limit pixels of home; outside
that, or when no point works, it heads back towards home.
References fdActorScriptCheckOverlap(), fdActorSetMoveTarget(), fdMapGridCheckCollision(), Sint32, syAtan(), syRandom() and syVectorAddPolarOffset().
Referenced by ActorScriptCommandTable.
Definition at line 1045 of file field_script_commands.c.
fdActorScriptSetOrCompareCursor
void fdActorScriptSetOrCompareCursor(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
Work value SW_CURSOR: sets, adds to or compares the script cursor.
References Sint32.
Referenced by ActorScriptOperandHandlerTable.
Definition at line 1261 of file field_script_commands.c.
fdActorScriptSetOrCompareRadius
void fdActorScriptSetOrCompareRadius(SCRIPT_OPERANDS *state, Sint32 operation, Sint32 value)
Work value SW_RADIUS: sets, adds to or compares the actor's radius.
References Sint32.
Referenced by ActorScriptOperandHandlerTable.
Definition at line 1285 of file field_script_commands.c.
fdActorScriptApplyOperandCommand
static __inline__ Sint32 fdActorScriptApplyOperandCommand(SCRIPT_OPERANDS *operands, Sint32 operation)
Reads the two words after the command (a work value number and a value) and passes operation to that value's handler.
References ActorScriptOperandHandlerTable and Sint32.
Referenced by fdActorScriptApplyOperandAdd(), fdActorScriptApplyOperandCompare() and fdActorScriptApplyOperandSet().
Definition at line 1359 of file field_script_commands.c.
fdActorScriptApplyOperandSet
Sint32 fdActorScriptApplyOperandSet(ACTOR *interpreter)
SC_SET(w, v): sets work value w to v.
References fdActorScriptApplyOperandCommand() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 1374 of file field_script_commands.c.
fdActorScriptApplyOperandAdd
Sint32 fdActorScriptApplyOperandAdd(ACTOR *interpreter)
SC_ADD(w, v): adds v to work value w.
References fdActorScriptApplyOperandCommand() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 1382 of file field_script_commands.c.
fdActorScriptApplyOperandCompare
Sint32 fdActorScriptApplyOperandCompare(ACTOR *interpreter)
SC_CMP(w, v): tests whether work value w equals v.
References fdActorScriptApplyOperandCommand() and Sint32.
Referenced by ActorScriptCommandTable.
Definition at line 1390 of file field_script_commands.c.
fdActorSetUpdate
void fdActorSetUpdate(ACTOR *actor, void (*update)(void))
Unused: sets an actor's update function, when there is an actor.
Definition at line 1398 of file field_script_commands.c.
fdActorUpdateHoverControl
Bool fdActorUpdateHoverControl(ACTOR *actor)
SC_HOVER: the leader hovering (the Hover Psynergy), moved by the direction
pad over what lies below.
References DebugMode, fdActorSelectAnimation(), fdActorSetMoveTarget(), fdCheckSpheresOverlap(), fdMapGridCheckCollisionAbove(), fdMapGridGetTerrainHeight(), gmUnitGet(), MainRoutineStateWork, PerWork, Sint32, sySoundPlayStub(), syVectorAddPolarOffset() and WorldMapKeyHeadings.
Referenced by ActorScriptCommandTable.
Definition at line 1406 of file field_script_commands.c.