Skip to Content
The Alchemy Project

include/field/script_operands.h

The actor script interpreter and the operands its commands read.

Included by field_actors.c and map_grid_data.c.

Structures

NameDescription
structSCRIPT_OPERANDSACTOR as the actor script's SC_SET, SC_ADD and SC_CMP commands reach it, every field a plain number (ACTOR_SCRIPT_VALUE numbers them).

Typedefs

NameDescription
typedef Sint32 (*SCRIPT_COMMAND )(struct ACTOR *);An actor script command's handler: it reads its operands at the actor's script cursor, moves the cursor past them and returns 1 to run the next command this tick or 0 to wait.
typedef void (*OPERAND_FUNC )(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value);A work value's handler: operation 0 sets the value, 1 adds to it and 2 compares it, into conditionResult.

Functions

NameDescription
voidfdActorScriptSetOrCompareScriptAddress (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)The work value handlers of ActorScriptOperandHandlerTable, one an SW_ value: each sets, adds to or compares (into conditionResult) the actor field it names; positions, targets, velocities and gravity are 16.16 pixels.
voidfdActorScriptSetOrCompareCursor (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)Work value SW_CURSOR: sets, adds to or compares the script cursor.
voidfdActorScriptSetOrCompareFacing (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareX (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareY (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareZ (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareRadius (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)Work value SW_RADIUS: sets, adds to or compares the actor's radius.
voidfdActorScriptSetOrCompareScaleX (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareScaleY (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareVelocityX (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareVelocityY (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareVelocityZ (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSpeedLimit (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareAcceleration (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareTargetX (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareTargetY (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareTargetZ (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareBounce (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareGravity (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareTerrainHeight (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSceneWord (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSprite (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSpriteStorageKind (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareMotionFlags (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareArrivalAxis (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareConditionResult (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSnapToTarget (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareCollisionFlags (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSteeringFlags (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrComparePaused (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareRepeatCount (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareWait (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareTimer (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareUserValue (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareWatchedActor (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareUpdateAddress (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSceneCount (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
voidfdActorScriptSetOrCompareSceneByte (SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)
Sint32fdActorScriptGoto (struct ACTOR *interpreter)SC_GOTO(script): goes on in script, from its first command, this tick.
Sint32fdActorScriptHideSprites (struct ACTOR *interpreter)SC_HIDE_SPRITES: clears spriteStorageKind, hiding the sprites, and moves on to the next command.
Sint32fdActorScriptShowSprite (struct ACTOR *interpreter)SC_SHOW_SPRITE: shows the actor's one sprite again (ACTOR_SPRITE_ONE) and moves on to the next command.

Variables

NameDescription
extern const OPERAND_FUNCActorScriptOperandHandlerTable [41]The handler for each work value number (map_grid_data.c).

Description

The actor script interpreter and the operands its commands read.

Typedefs in detail

SCRIPT_COMMAND

typedef Sint32 (*SCRIPT_COMMAND)(struct ACTOR *);

An actor script command's handler: it reads its operands at the actor's script cursor, moves the cursor past them and returns 1 to run the next command this tick or 0 to wait.

Referenced by fdActorScriptInvokeCallback().

Definition at line 15 of file script_operands.h.

OPERAND_FUNC

typedef void (*OPERAND_FUNC)(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value);

A work value's handler: operation 0 sets the value, 1 adds to it and 2 compares it, into conditionResult.

Referenced by ActorScriptOperandHandlerTable and fdActorScriptApplyOperandCommand().

Definition at line 84 of file script_operands.h.

Functions in detail

fdActorScriptSetOrCompareScriptAddress

void fdActorScriptSetOrCompareScriptAddress(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

The work value handlers of ActorScriptOperandHandlerTable, one an SW_ value: each sets, adds to or compares (into conditionResult) the actor field it names; positions, targets, velocities and gravity are 16.16 pixels.

Referenced by ActorScriptOperandHandlerTable.

Definition at line 94 of file script_operands.h.

fdActorScriptSetOrCompareFacing

void fdActorScriptSetOrCompareFacing(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 100 of file script_operands.h.

fdActorScriptSetOrCompareX

void fdActorScriptSetOrCompareX(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 103 of file script_operands.h.

fdActorScriptSetOrCompareY

void fdActorScriptSetOrCompareY(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 106 of file script_operands.h.

fdActorScriptSetOrCompareZ

void fdActorScriptSetOrCompareZ(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 109 of file script_operands.h.

fdActorScriptSetOrCompareScaleX

void fdActorScriptSetOrCompareScaleX(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 115 of file script_operands.h.

fdActorScriptSetOrCompareScaleY

void fdActorScriptSetOrCompareScaleY(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 118 of file script_operands.h.

fdActorScriptSetOrCompareVelocityX

void fdActorScriptSetOrCompareVelocityX(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 121 of file script_operands.h.

fdActorScriptSetOrCompareVelocityY

void fdActorScriptSetOrCompareVelocityY(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 124 of file script_operands.h.

fdActorScriptSetOrCompareVelocityZ

void fdActorScriptSetOrCompareVelocityZ(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 127 of file script_operands.h.

fdActorScriptSetOrCompareSpeedLimit

void fdActorScriptSetOrCompareSpeedLimit(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 130 of file script_operands.h.

fdActorScriptSetOrCompareAcceleration

void fdActorScriptSetOrCompareAcceleration(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 133 of file script_operands.h.

fdActorScriptSetOrCompareTargetX

void fdActorScriptSetOrCompareTargetX(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 136 of file script_operands.h.

fdActorScriptSetOrCompareTargetY

void fdActorScriptSetOrCompareTargetY(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 139 of file script_operands.h.

fdActorScriptSetOrCompareTargetZ

void fdActorScriptSetOrCompareTargetZ(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 142 of file script_operands.h.

fdActorScriptSetOrCompareBounce

void fdActorScriptSetOrCompareBounce(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 145 of file script_operands.h.

fdActorScriptSetOrCompareGravity

void fdActorScriptSetOrCompareGravity(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 148 of file script_operands.h.

fdActorScriptSetOrCompareTerrainHeight

void fdActorScriptSetOrCompareTerrainHeight(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 151 of file script_operands.h.

fdActorScriptSetOrCompareSceneWord

void fdActorScriptSetOrCompareSceneWord(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 154 of file script_operands.h.

fdActorScriptSetOrCompareSprite

void fdActorScriptSetOrCompareSprite(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 157 of file script_operands.h.

fdActorScriptSetOrCompareSpriteStorageKind

void fdActorScriptSetOrCompareSpriteStorageKind(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 160 of file script_operands.h.

fdActorScriptSetOrCompareMotionFlags

void fdActorScriptSetOrCompareMotionFlags(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 163 of file script_operands.h.

fdActorScriptSetOrCompareArrivalAxis

void fdActorScriptSetOrCompareArrivalAxis(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 166 of file script_operands.h.

fdActorScriptSetOrCompareConditionResult

void fdActorScriptSetOrCompareConditionResult(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 169 of file script_operands.h.

fdActorScriptSetOrCompareSnapToTarget

void fdActorScriptSetOrCompareSnapToTarget(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 172 of file script_operands.h.

fdActorScriptSetOrCompareCollisionFlags

void fdActorScriptSetOrCompareCollisionFlags(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 175 of file script_operands.h.

fdActorScriptSetOrCompareSteeringFlags

void fdActorScriptSetOrCompareSteeringFlags(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 178 of file script_operands.h.

fdActorScriptSetOrComparePaused

void fdActorScriptSetOrComparePaused(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 181 of file script_operands.h.

fdActorScriptSetOrCompareRepeatCount

void fdActorScriptSetOrCompareRepeatCount(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 184 of file script_operands.h.

fdActorScriptSetOrCompareWait

void fdActorScriptSetOrCompareWait(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 187 of file script_operands.h.

fdActorScriptSetOrCompareTimer

void fdActorScriptSetOrCompareTimer(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 190 of file script_operands.h.

fdActorScriptSetOrCompareUserValue

void fdActorScriptSetOrCompareUserValue(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 193 of file script_operands.h.

fdActorScriptSetOrCompareWatchedActor

void fdActorScriptSetOrCompareWatchedActor(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 196 of file script_operands.h.

fdActorScriptSetOrCompareUpdateAddress

void fdActorScriptSetOrCompareUpdateAddress(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 199 of file script_operands.h.

fdActorScriptSetOrCompareSceneCount

void fdActorScriptSetOrCompareSceneCount(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 202 of file script_operands.h.

fdActorScriptSetOrCompareSceneByte

void fdActorScriptSetOrCompareSceneByte(SCRIPT_OPERANDS *operands, Sint32 operation, Sint32 value)

Referenced by ActorScriptOperandHandlerTable.

Definition at line 205 of file script_operands.h.