Object script commands: waits, jumps, flags, moves and work values. More...
Go to the source code of this file.
Macros | |
| #define | SCRIPT_LABEL_KEY_MASK 0xbfffffff |
| SC_LABEL and SC_TO differ only in bit 30; a jump searches for the label. | |
| #define | SCRIPT_DEFINE_FLAG_COMMAND(name, change) |
| Defines a flag command: stores the flag's current value in conditionResult, then changes the flag with change. | |
| #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 | |
| enum | { SCRIPT_LABEL_SEARCH_WORDS = 1024 , SCRIPT_BLOCKED_MOVE_FRAMES = 60 , SCRIPT_WANDER_TRIES = 7 , SCRIPT_WANDER_PROBE_DISTANCE = 8 * Q16_ONE , SCRIPT_WANDER_DIAGONAL_ANGLE = 0x2000 , SCRIPT_WANDER_SIDE_ANGLE = 0x4000 , SCRIPT_HALF_TURN = 0x8000 , SCRIPT_APPROACH_DISTANCE = 16 , CAMERA_FOLLOW_FINE_DISTANCE = 64 * Q16_ONE , CAMERA_FOLLOW_SNAP_DISTANCE = Q16_ONE / 4 , CAMERA_FOLLOW_HEIGHT_SNAP = Q16_ONE / 2 } |
| enum | ScriptOperandOperation { SCRIPT_OPERAND_SET , SCRIPT_OPERAND_ADD , SCRIPT_OPERAND_COMPARE } |
Functions | |
| s32 | Script_Wait (struct ScriptInterpreter *interpreter) |
| SC_WAIT(n): waits n frames; this frame counts as the first. | |
| s32 | Script_WaitForArrival (struct ScriptInterpreter *interpreter) |
| SC_SYNC: waits until the object arrives at its target, or until a solid object has blocked it for 60 frames (refused is the blocked count, which Object_UpdateAllThumb raises). | |
| s32 | Script_InvokeCallback (struct ScriptInterpreter *interpreter) |
| SC_CALL(fn): calls fn with the object. | |
| s32 | Script_FindLabel (struct ScriptInterpreter *interpreter, u32 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 1024 words, or 0 (the start) when key is 0 or not found. | |
| s32 | Script_RepeatOrJump (struct ScriptInterpreter *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. | |
| s32 | Script_JumpToLabel (struct ScriptInterpreter *interpreter) |
| SC_JUMP(to): jumps to label to. | |
| s32 | Script_JumpIfTrue (struct ScriptInterpreter *interpreter) |
| SC_IF(to): jumps to label to when the last test was true. | |
| s32 | Script_JumpIfFalse (struct ScriptInterpreter *interpreter) |
| SC_IFNOT(to): jumps to label to when the last test was false. | |
| s32 | Script_End (struct ScriptInterpreter *interpreter) |
| SC_END: hands the object back to the idle script, gScript_MainScript, whose lone SC_END runs again each frame. | |
| s32 | Script_TestFlag (struct ScriptInterpreter *interpreter) |
| SC_FLAG_CHECK(f): tests game flag f. | |
| s32 | Script_SetFlagAndTest (struct ScriptInterpreter *interpreter) |
| SC_FLAG_ON(f) and SC_FLAG_OFF(f): test game flag f, then set or clear it. | |
| s32 | Script_ClearFlagAndTest (struct ScriptInterpreter *interpreter) |
| s32 | Script_ToggleFlagAndTest (struct ScriptInterpreter *interpreter) |
| SC_FLAG_REV(f): tests game flag f, then flips it. | |
| s32 | Script_SetAnimation (struct ScriptInterpreter *interpreter) |
| SC_ARG(v): switches the object's sprites to animation v. | |
| s32 | Script_FreeObject (struct ScriptInterpreter *interpreter) |
| SC_FREE: releases the object through ObjectDispatch_Release, which releases its sprites and zeroes its slot. | |
| s32 | Script_Nop (struct ScriptInterpreter *interpreter) |
| SC_NOP(v): does nothing with its operand. | |
| s32 | Script_PlaySound (struct ScriptInterpreter *interpreter) |
| SC_SE(n): sends sound command n (a sound effect). | |
| s32 | ScriptObject_CheckOverlap (struct ScriptObjectEntry *object, s32 *values) |
| Returns -1 when an object at position values would overlap a solid object (bit 0 of collisionFlags), each radius less 2 pixels; otherwise 0. | |
| struct ScriptObjectEntry * | ScriptObject_FindOverlappingEntry (struct ScriptObjectEntry *object, s32 *values) |
| Returns the first solid object that an object at position values would overlap, as ScriptObject_CheckOverlap tests, or NULL. | |
| static __inline__ s32 | Script_ApplyPositionCommand (struct ScriptInterpreter *interpreter, void(*applyPosition)(struct ObjectRuntime *object, s32 x, s32 y, s32 z)) |
| Reads three coordinate words and applies the selected positioning operation. | |
| s32 | Script_SetPositionAndResetMotion (struct ScriptInterpreter *interpreter) |
| SC_POS(x, y, z): places the object at (x, y, z) and stops it. | |
| s32 | Script_ApplyAbsolutePosition (struct ScriptInterpreter *interpreter) |
| SC_MOVE(x, y, z): sends the object towards (x, y, z). | |
| s32 | Script_ApplyRelativePosition (struct ScriptInterpreter *interpreter) |
| SC_MOVE_BY(x, y, z): sends the object towards its position plus (x, y, z). | |
| s32 | Script_StoreAngleToLinkedObject (struct ScriptInterpreter *interpreter) |
| SC_FACE_LINK: stores the angle from the object to its linked object in scriptValue, measured on the ground plane (x and z). | |
| s32 | Script_ApplyLinkedObjectPosition (struct ScriptInterpreter *interpreter) |
| SC_MOVE_LINK: sends the object towards its linked object. | |
| s32 | Script_ApplyLocalOffsetPosition (struct ScriptInterpreter *interpreter) |
| SC_MOVE_LOCAL(a, b): sends the object towards its position plus an offset that is never filled in; the operands are skipped unread. | |
| s32 | Camera_FollowLeaderInBounds (struct ScriptInterpreter *interpreter) |
| SC_CAMERA: keeps the camera object on its leader (linkedObject), clamped so the view stays on the map. | |
| s32 | _call_via_r3 (s32, s32, s32, s32) |
| s32 | Object_ApproachLinkedObject (struct ScriptInterpreter *interpreter) |
| SC_APPROACH_LINK: follows the linked object at its speed. | |
| s32 | Object_Wander (struct ScriptInterpreter *interpreter) |
| SC_WANDER(base, range, limit): walks to a random point base to base + range away, within 90 degrees either side of its heading (scriptValue), that no solid object or wall blocks, with clear ground 8 pixels further at 45 degrees either side, and within limit pixels of home. | |
| s32 | ScriptObject_WanderNearHome (struct ScriptInterpreter *interpreter) |
| 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 | Script_SetOrCompareAddress (struct ScriptOperands *operands, s32 operation, s32 value) |
| The work value handlers, one for each entry of enum ScriptWork (see gScript_OperandHandlerTable in operand.c); each names the object field it sets, adds to or compares. | |
| void | Script_SetOrCompareCursor (struct ScriptOperands *operands, s32 operation, s32 value) |
| Work value SW_CURSOR: sets, adds to or compares the script cursor. | |
| void | Script_SetOrCompareUnsignedHalfword (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareX (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareY (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareZ (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareRadius (struct ScriptOperands *state, s32 operation, s32 value) |
| Work value SW_RADIUS: sets, adds to or compares the object's radius. | |
| void | Script_SetOrCompareScaleX (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareScaleY (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareVelocityX (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareVelocityY (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareVelocityZ (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareSpeedLimit (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareAcceleration (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareTargetX (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareTargetY (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareTargetZ (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareVerticalMotion (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareGravity (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareTerrainHeight (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareWord4c (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareAddress50 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareByte54 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareMotionFlags (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareArrivalAxis (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareComparisonResult (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareSnapToTarget (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareCollisionFlags (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareSteeringFlags (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrComparePaused (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareRepeatCount (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareHalfword5e (struct ScriptOperands *work, s32 operation, s32 value) |
| Work value SW_WAIT: sets, adds to or compares the wait counter. | |
| void | Script_SetOrCompareSignedHalfword64 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareSignedHalfword66 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareWord68 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareUpdateAddress (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareByte62 (struct ScriptOperands *operands, s32 operation, s32 value) |
| void | Script_SetOrCompareByte63 (struct ScriptOperands *operands, s32 operation, s32 value) |
| static __inline__ s32 | Script_ApplyOperandCommand (struct ScriptOperands *operands, s32 operation) |
| Reads the two words after the command (a work value number and a value) and passes operation to that value's handler. | |
| s32 | Script_ApplyOperandSet (struct ScriptInterpreter *interpreter) |
| SC_SET(w, v): sets work value w to v. | |
| s32 | Script_ApplyOperandAdd (struct ScriptInterpreter *interpreter) |
| SC_ADD(w, v): adds v to work value w. | |
| s32 | Script_ApplyOperandCompare (struct ScriptInterpreter *interpreter) |
| SC_CMP(w, v): tests whether work value w equals v. | |
Variables | |
| u8 | IwramSqrt [] |
Object script commands: waits, jumps, flags, moves and work values.
Part of field.c, the field object, compiled only through it.
Each SC_ handler here is reached through gScriptObject_CommandTable (object_script.c), which Object_UpdateAll and Object_UpdateAllThumb call for each live object; each returns 1 to run on and 0 to end the object's frame (the protocol is in this folder's README).
Definition in file script_commands.c.
| #define SCRIPT_LABEL_KEY_MASK 0xbfffffff |
SC_LABEL and SC_TO differ only in bit 30; a jump searches for the label.
Definition at line 27 of file script_commands.c.
Referenced by Script_FindLabel().
| #define SCRIPT_DEFINE_FLAG_COMMAND | ( | name, | |
| change ) |
Defines a flag command: stores the flag's current value in conditionResult, then changes the flag with change.
Definition at line 187 of file script_commands.c.
Referenced by Script_ClearFlagAndTest(), and Script_SetFlagAndTest().
| #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 784 of file script_commands.c.
Referenced by Script_SetOrCompareAcceleration(), Script_SetOrCompareGravity(), Script_SetOrCompareScaleX(), Script_SetOrCompareScaleY(), Script_SetOrCompareSpeedLimit(), Script_SetOrCompareTargetX(), Script_SetOrCompareTargetY(), Script_SetOrCompareTargetZ(), Script_SetOrCompareTerrainHeight(), Script_SetOrCompareUpdateAddress(), Script_SetOrCompareVelocityX(), Script_SetOrCompareVelocityY(), Script_SetOrCompareVelocityZ(), Script_SetOrCompareVerticalMotion(), Script_SetOrCompareWord4c(), Script_SetOrCompareWord68(), Script_SetOrCompareX(), Script_SetOrCompareY(), and Script_SetOrCompareZ().
| #define SCRIPT_DEFINE_OPERAND_ADDRESS | ( | name, | |
| field ) |
The same for an address: an add steps by value words (value * 4 bytes).
Definition at line 798 of file script_commands.c.
Referenced by Script_SetOrCompareAddress(), and Script_SetOrCompareAddress50().
| #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 812 of file script_commands.c.
Referenced by Script_SetOrCompareArrivalAxis(), Script_SetOrCompareByte54(), Script_SetOrCompareByte62(), Script_SetOrCompareByte63(), Script_SetOrCompareCollisionFlags(), Script_SetOrCompareMotionFlags(), Script_SetOrComparePaused(), Script_SetOrCompareRepeatCount(), Script_SetOrCompareSignedHalfword64(), Script_SetOrCompareSnapToTarget(), and Script_SetOrCompareUnsignedHalfword().
| anonymous enum |
Definition at line 12 of file script_commands.c.
| Enumerator | |
|---|---|
| SCRIPT_OPERAND_SET | |
| SCRIPT_OPERAND_ADD | |
| SCRIPT_OPERAND_COMPARE | |
Definition at line 776 of file script_commands.c.
| s32 Script_Wait | ( | struct ScriptInterpreter * | interpreter | ) |
SC_WAIT(n): waits n frames; this frame counts as the first.
Sets interpreter->wait to n - 1, which the update loops count down, and moves past its operand. Returns 0 to end the object's commands for this frame.
Definition at line 32 of file script_commands.c.
Referenced by Script_Wait().
| s32 Script_WaitForArrival | ( | struct ScriptInterpreter * | interpreter | ) |
SC_SYNC: waits until the object arrives at its target, or until a solid object has blocked it for 60 frames (refused is the blocked count, which Object_UpdateAllThumb raises).
Returns 1 (run on) once it has, clearing refused when it gave up, and 0 (wait) until then.
Definition at line 44 of file script_commands.c.
Referenced by Script_WaitForArrival().
| s32 Script_InvokeCallback | ( | struct ScriptInterpreter * | interpreter | ) |
SC_CALL(fn): calls fn with the object.
A non-zero result waits and calls it again next frame; zero moves on, past the command unless fn moved the cursor itself. Scene scripts and the field effect scripts of fxdata.c use it to run their own per-object steps.
Definition at line 61 of file script_commands.c.
Referenced by Script_InvokeCallback().
| s32 Script_FindLabel | ( | struct ScriptInterpreter * | interpreter, |
| u32 | 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 1024 words, or 0 (the start) when key is 0 or not found.
Clears the wait. Called by the jumps: SC_JUMP, SC_LOOP, SC_IF and SC_IFNOT.
Definition at line 77 of file script_commands.c.
Referenced by Script_FindLabel(), Script_JumpIfFalse(), Script_JumpIfTrue(), Script_JumpToLabel(), and Script_RepeatOrJump().
| s32 Script_RepeatOrJump | ( | struct ScriptInterpreter * | 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.
Counts in interpreter->repeatCount and clears it when the loop ends, so loops do not nest. The engine's own scripts (object_script.c) end with SC_LOOP(SC_FOREVER, SC_TOP).
Definition at line 105 of file script_commands.c.
Referenced by Script_RepeatOrJump().
| s32 Script_JumpToLabel | ( | struct ScriptInterpreter * | interpreter | ) |
SC_JUMP(to): jumps to label to.
Definition at line 132 of file script_commands.c.
Referenced by Script_JumpToLabel().
| s32 Script_JumpIfTrue | ( | struct ScriptInterpreter * | interpreter | ) |
SC_IF(to): jumps to label to when the last test was true.
Definition at line 139 of file script_commands.c.
Referenced by Script_JumpIfTrue().
| s32 Script_JumpIfFalse | ( | struct ScriptInterpreter * | interpreter | ) |
SC_IFNOT(to): jumps to label to when the last test was false.
Definition at line 153 of file script_commands.c.
Referenced by Script_JumpIfFalse().
| s32 Script_End | ( | struct ScriptInterpreter * | interpreter | ) |
SC_END: hands the object back to the idle script, gScript_MainScript, whose lone SC_END runs again each frame.
Returns 0. The table's unused command numbers from 0x24 also point here.
Definition at line 169 of file script_commands.c.
Referenced by Script_End().
| s32 Script_TestFlag | ( | struct ScriptInterpreter * | interpreter | ) |
SC_FLAG_CHECK(f): tests game flag f.
Definition at line 178 of file script_commands.c.
Referenced by Script_TestFlag().
| s32 Script_SetFlagAndTest | ( | struct ScriptInterpreter * | interpreter | ) |
SC_FLAG_ON(f) and SC_FLAG_OFF(f): test game flag f, then set or clear it.
Definition at line 199 of file script_commands.c.
Referenced by Script_SetFlagAndTest().
| s32 Script_ClearFlagAndTest | ( | struct ScriptInterpreter * | interpreter | ) |
Definition at line 200 of file script_commands.c.
Referenced by Script_ClearFlagAndTest().
| s32 Script_ToggleFlagAndTest | ( | struct ScriptInterpreter * | interpreter | ) |
SC_FLAG_REV(f): tests game flag f, then flips it.
Definition at line 203 of file script_commands.c.
Referenced by Script_ToggleFlagAndTest().
| s32 Script_SetAnimation | ( | struct ScriptInterpreter * | interpreter | ) |
SC_ARG(v): switches the object's sprites to animation v.
Definition at line 221 of file script_commands.c.
Referenced by Script_SetAnimation().
| s32 Script_FreeObject | ( | struct ScriptInterpreter * | interpreter | ) |
SC_FREE: releases the object through ObjectDispatch_Release, which releases its sprites and zeroes its slot.
Returns 0.
Definition at line 230 of file script_commands.c.
Referenced by Script_FreeObject().
| s32 Script_Nop | ( | struct ScriptInterpreter * | interpreter | ) |
SC_NOP(v): does nothing with its operand.
Definition at line 236 of file script_commands.c.
Referenced by Script_Nop().
| s32 Script_PlaySound | ( | struct ScriptInterpreter * | interpreter | ) |
SC_SE(n): sends sound command n (a sound effect).
Definition at line 242 of file script_commands.c.
Referenced by Script_PlaySound().
| s32 ScriptObject_CheckOverlap | ( | struct ScriptObjectEntry * | object, |
| s32 * | values ) |
Returns -1 when an object at position values would overlap a solid object (bit 0 of collisionFlags), each radius less 2 pixels; otherwise 0.
The object itself is skipped. Called by SC_WANDER and SC_WANDER_HOME, the player's control (player_control.c), the motion loop's solid test (object_motion.c), and the carry and Force effects through ScriptObject_CheckOverlapFar.
Definition at line 254 of file script_commands.c.
Referenced by FieldObject_UpdatePlayerControl(), Object_UpdateAllThumb(), Object_Wander(), ScriptObject_CheckOverlap(), and ScriptObject_WanderNearHome().
| struct ScriptObjectEntry * ScriptObject_FindOverlappingEntry | ( | struct ScriptObjectEntry * | object, |
| s32 * | values ) |
Returns the first solid object that an object at position values would overlap, as ScriptObject_CheckOverlap tests, or NULL.
Called by the Move effect (move.c) through ScriptObject_FindOverlappingEntryFar.
Definition at line 277 of file script_commands.c.
Referenced by ScriptObject_FindOverlappingEntry().
|
static |
Reads three coordinate words and applies the selected positioning operation.
Definition at line 298 of file script_commands.c.
Referenced by Script_ApplyAbsolutePosition(), Script_ApplyPositionCommand(), and Script_SetPositionAndResetMotion().
| s32 Script_SetPositionAndResetMotion | ( | struct ScriptInterpreter * | interpreter | ) |
SC_POS(x, y, z): places the object at (x, y, z) and stops it.
Definition at line 319 of file script_commands.c.
Referenced by Script_SetPositionAndResetMotion().
| s32 Script_ApplyAbsolutePosition | ( | struct ScriptInterpreter * | interpreter | ) |
SC_MOVE(x, y, z): sends the object towards (x, y, z).
Definition at line 325 of file script_commands.c.
Referenced by Script_ApplyAbsolutePosition().
| s32 Script_ApplyRelativePosition | ( | struct ScriptInterpreter * | interpreter | ) |
SC_MOVE_BY(x, y, z): sends the object towards its position plus (x, y, z).
Definition at line 330 of file script_commands.c.
Referenced by Script_ApplyRelativePosition().
| s32 Script_StoreAngleToLinkedObject | ( | struct ScriptInterpreter * | interpreter | ) |
SC_FACE_LINK: stores the angle from the object to its linked object in scriptValue, measured on the ground plane (x and z).
Definition at line 348 of file script_commands.c.
Referenced by Script_StoreAngleToLinkedObject().
| s32 Script_ApplyLinkedObjectPosition | ( | struct ScriptInterpreter * | interpreter | ) |
SC_MOVE_LINK: sends the object towards its linked object.
Definition at line 362 of file script_commands.c.
Referenced by Script_ApplyLinkedObjectPosition().
| s32 Script_ApplyLocalOffsetPosition | ( | struct ScriptInterpreter * | interpreter | ) |
SC_MOVE_LOCAL(a, b): sends the object towards its position plus an offset that is never filled in; the operands are skipped unread.
Definition at line 377 of file script_commands.c.
Referenced by Script_ApplyLocalOffsetPosition().
| s32 Camera_FollowLeaderInBounds | ( | struct ScriptInterpreter * | interpreter | ) |
SC_CAMERA: keeps the camera object on its leader (linkedObject), clamped so the view stays on the map.
It closes an eighth of the distance a frame, at most its speed limit, and a quarter of a large height difference; when action is set it jumps there at once.
Run each frame by gObjectDispatch_CameraScript, which ObjectDispatch_StartCamera starts. Clears the camera's flags and target, moves its position, and counts its step.
Definition at line 403 of file script_commands.c.
Referenced by Camera_FollowLeaderInBounds().
| s32 Object_ApproachLinkedObject | ( | struct ScriptInterpreter * | interpreter | ) |
SC_APPROACH_LINK: follows the linked object at its speed.
More than 16 pixels away it walks to 16 pixels short of it (animation 2) and runs on; within 16 it stands (animation 1) and waits for the next frame.
Run each frame by gObjectDispatch_ApproachLinkScript, which ObjectDispatch_StartApproachLink starts. Copies the linked object's speed limit and acceleration, and sets the move target.
Definition at line 506 of file script_commands.c.
Referenced by Object_ApproachLinkedObject().
| s32 Object_Wander | ( | struct ScriptInterpreter * | interpreter | ) |
SC_WANDER(base, range, limit): walks to a random point base to base + range away, within 90 degrees either side of its heading (scriptValue), that no solid object or wall blocks, with clear ground 8 pixels further at 45 degrees either side, and within limit pixels of home.
After seven failed tries it turns around (turnedBack) and waits for the next frame. No script in games/tbs names SC_WANDER; scenes use SC_WANDER_HOME.
Definition at line 555 of file script_commands.c.
Referenced by Object_Wander().
| s32 ScriptObject_WanderNearHome | ( | struct ScriptInterpreter * | interpreter | ) |
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.
Used by scripts in Vault and Vale (vault.c, vale_home.c). Sets bit 1 of flags59 while it roams and clears it on the way home, sets the move target, and always moves on to the next command.
Definition at line 654 of file script_commands.c.
Referenced by ScriptObject_WanderNearHome().
| void Script_SetOrCompareAddress | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
The work value handlers, one for each entry of enum ScriptWork (see gScript_OperandHandlerTable in operand.c); each names the object field it sets, adds to or compares.
Definition at line 826 of file script_commands.c.
Referenced by Script_SetOrCompareAddress().
| void Script_SetOrCompareCursor | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Work value SW_CURSOR: sets, adds to or compares the script cursor.
Definition at line 829 of file script_commands.c.
Referenced by Script_SetOrCompareCursor().
| void Script_SetOrCompareUnsignedHalfword | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 840 of file script_commands.c.
Referenced by Script_SetOrCompareUnsignedHalfword().
| void Script_SetOrCompareX | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 841 of file script_commands.c.
Referenced by Script_SetOrCompareX().
| void Script_SetOrCompareY | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 842 of file script_commands.c.
Referenced by Script_SetOrCompareY().
| void Script_SetOrCompareZ | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 843 of file script_commands.c.
Referenced by Script_SetOrCompareZ().
| void Script_SetOrCompareRadius | ( | struct ScriptOperands * | state, |
| s32 | operation, | ||
| s32 | value ) |
Work value SW_RADIUS: sets, adds to or compares the object's radius.
Definition at line 846 of file script_commands.c.
Referenced by Script_SetOrCompareRadius().
| void Script_SetOrCompareScaleX | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 859 of file script_commands.c.
Referenced by Script_SetOrCompareScaleX().
| void Script_SetOrCompareScaleY | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 860 of file script_commands.c.
Referenced by Script_SetOrCompareScaleY().
| void Script_SetOrCompareVelocityX | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 861 of file script_commands.c.
Referenced by Script_SetOrCompareVelocityX().
| void Script_SetOrCompareVelocityY | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 862 of file script_commands.c.
Referenced by Script_SetOrCompareVelocityY().
| void Script_SetOrCompareVelocityZ | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 863 of file script_commands.c.
Referenced by Script_SetOrCompareVelocityZ().
| void Script_SetOrCompareSpeedLimit | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 864 of file script_commands.c.
Referenced by Script_SetOrCompareSpeedLimit().
| void Script_SetOrCompareAcceleration | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 865 of file script_commands.c.
Referenced by Script_SetOrCompareAcceleration().
| void Script_SetOrCompareTargetX | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 866 of file script_commands.c.
Referenced by Script_SetOrCompareTargetX().
| void Script_SetOrCompareTargetY | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 867 of file script_commands.c.
Referenced by Script_SetOrCompareTargetY().
| void Script_SetOrCompareTargetZ | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 868 of file script_commands.c.
Referenced by Script_SetOrCompareTargetZ().
| void Script_SetOrCompareVerticalMotion | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 869 of file script_commands.c.
Referenced by Script_SetOrCompareVerticalMotion().
| void Script_SetOrCompareGravity | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 870 of file script_commands.c.
Referenced by Script_SetOrCompareGravity().
| void Script_SetOrCompareTerrainHeight | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 871 of file script_commands.c.
Referenced by Script_SetOrCompareTerrainHeight().
| void Script_SetOrCompareWord4c | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 872 of file script_commands.c.
Referenced by Script_SetOrCompareWord4c().
| void Script_SetOrCompareAddress50 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 873 of file script_commands.c.
Referenced by Script_SetOrCompareAddress50().
| void Script_SetOrCompareByte54 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 874 of file script_commands.c.
Referenced by Script_SetOrCompareByte54().
| void Script_SetOrCompareMotionFlags | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 875 of file script_commands.c.
Referenced by Script_SetOrCompareMotionFlags().
| void Script_SetOrCompareArrivalAxis | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 876 of file script_commands.c.
Referenced by Script_SetOrCompareArrivalAxis().
| void Script_SetOrCompareComparisonResult | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 878 of file script_commands.c.
Referenced by Script_SetOrCompareArrivalAxis().
| void Script_SetOrCompareSnapToTarget | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 879 of file script_commands.c.
Referenced by Script_SetOrCompareSnapToTarget().
| void Script_SetOrCompareCollisionFlags | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 881 of file script_commands.c.
Referenced by Script_SetOrCompareSnapToTarget().
| void Script_SetOrCompareSteeringFlags | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 883 of file script_commands.c.
Referenced by Script_SetOrCompareCollisionFlags().
| void Script_SetOrComparePaused | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 884 of file script_commands.c.
Referenced by Script_SetOrComparePaused().
| void Script_SetOrCompareRepeatCount | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 885 of file script_commands.c.
Referenced by Script_SetOrCompareRepeatCount().
| void Script_SetOrCompareHalfword5e | ( | struct ScriptOperands * | work, |
| s32 | operation, | ||
| s32 | value ) |
Work value SW_WAIT: sets, adds to or compares the wait counter.
Definition at line 888 of file script_commands.c.
Referenced by Script_SetOrCompareHalfword5e().
| void Script_SetOrCompareSignedHalfword64 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 902 of file script_commands.c.
| void Script_SetOrCompareSignedHalfword66 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 904 of file script_commands.c.
Referenced by Script_SetOrCompareSignedHalfword64().
| void Script_SetOrCompareWord68 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 905 of file script_commands.c.
Referenced by Script_SetOrCompareWord68().
| void Script_SetOrCompareUpdateAddress | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 906 of file script_commands.c.
Referenced by Script_SetOrCompareUpdateAddress().
| void Script_SetOrCompareByte62 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 907 of file script_commands.c.
Referenced by Script_SetOrCompareByte62().
| void Script_SetOrCompareByte63 | ( | struct ScriptOperands * | operands, |
| s32 | operation, | ||
| s32 | value ) |
Definition at line 908 of file script_commands.c.
Referenced by Script_SetOrCompareByte63().
|
static |
Reads the two words after the command (a work value number and a value) and passes operation to that value's handler.
Definition at line 913 of file script_commands.c.
Referenced by Script_ApplyOperandAdd(), Script_ApplyOperandCommand(), Script_ApplyOperandCompare(), and Script_ApplyOperandSet().
| s32 Script_ApplyOperandSet | ( | struct ScriptInterpreter * | interpreter | ) |
SC_SET(w, v): sets work value w to v.
Definition at line 926 of file script_commands.c.
Referenced by Script_ApplyOperandSet().
| s32 Script_ApplyOperandAdd | ( | struct ScriptInterpreter * | interpreter | ) |
SC_ADD(w, v): adds v to work value w.
Definition at line 933 of file script_commands.c.
Referenced by Script_ApplyOperandAdd().
| s32 Script_ApplyOperandCompare | ( | struct ScriptInterpreter * | interpreter | ) |
SC_CMP(w, v): tests whether work value w equals v.
Definition at line 940 of file script_commands.c.
Referenced by Script_ApplyOperandCompare().
|
extern |