Skip to Content
The Alchemy Project

struct ACTOR

An actor: one of the ACTOR_COUNT people and things on the field (ActorsWork, HEAP_SLOT_ACTORS), with its actor script, position, motion toward a target, sprites and update function.

Declared in actor.h.

Fields

NameDescription
const Sint32 *scriptThe actor script it runs; null when its slot is free.
Sint16scriptCursorThe script cursor, in words.
Uint16facing1/65536 turns.
FIELD_COORDINATEx16.16 fixed-point pixels.
FIELD_COORDINATEy16.16 fixed-point pixels.
FIELD_COORDINATEz16.16 fixed-point pixels.
FIXEDgroundHeight16.16 fixed-point pixels.
FIXEDscaleX16.16 fixed point, toFIXED(1) full size.
FIXEDscaleY16.16 fixed point, toFIXED(1) full size.
Uint16radiusCollision radius in pixels: 16, or half the sprite metadata's footprint, when created; the overlap checks use it less 2.
Uint8layerThe map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the metatile under it; the fixed camera passes it as the sprite's draw slot.
Uint8priorityFlagsACTOR_PRIORITY_FLAG bits, read by the scrolling camera: ACTOR_PRIORITY_AUTOMATIC for placed actors, ACTOR_PRIORITY_UNDERFOOT for footprints.
FIXEDvelocityX16.16 fixed-point pixels per tick.
FIXEDvelocityY16.16 fixed-point pixels per tick.
FIXEDvelocityZ16.16 fixed-point pixels per tick.
FIXEDspeedLimit16.16 fixed-point pixels per tick.
FIXEDaccelerationAdded toward the target each tick, or taken off the speed when there is none, in 16.16 fixed-point pixels per tick; toFIXED(1) when created.
FIXEDtargetX16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.
FIXEDtargetY16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.
FIXEDtargetZ16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.
FIXEDbounceThe share of its falling speed kept as it bounces on landing, 16.16 fixed point (a quarter when created); a floating actor's phase instead.
FIXEDgravityTaken off velocityY each tick while it is above the ground, in 16.16 fixed-point pixels per tick (toFIXED(1) when created); also scales a floating actor's bob.
Sint32sceneWordZeroed by scFieldActorCreate and not read by the field engine; scene code keeps a resting height, a sway or a countdown here.
SPR *spriteIts sprite, by spriteStorageKind: one sprite for ACTOR_SPRITE_ONE; for ACTOR_SPRITE_GROUP four, empty ones null, read as void **.
Uint8spriteStorageKindAn ACTOR_SPR_KIND in its low four bits (ACTOR_SPRITE_KIND_MASK): what sprite holds.
Uint8motionFlagsACTOR_MOTION_FLAG bits; none is free flight in 3D, and ACTOR_FOLLOWS_TERRAIN and ACTOR_FALLS are set on creation.
Uint8arrivalAxisThe ARRIVAL_AXIS_* watched for arrival.
Uint8conditionResultThe actor script's last flag test.
Uint8snapToTargetNonzero lands it exactly on its target on arrival.
Uint8collisionFlagsACTOR_COLLISION_FLAG bits; placed actors take ACTOR_SOLID.
Uint8steeringFlagsACTOR_STEERING_FLAG bits.
Uint8pausedNonzero skips its script and motion, not its update.
Uint8retainSpriteCacheNonzero keeps its sprite's VRAM cache entry while sprites are suspended or it is off screen (fdActorSystemPlaceSprites).
Uint8repeatCountThe actor script's SC_LOOP count.
Sint16waitThe actor script's wait, in ticks.
Uint8refusedTicks in a row a solid actor has refused its move; SC_SYNC stops waiting after 60.
Uint8frozenNonzero skips steering, terrain, gravity and floating; its velocity still moves it.
Uint8sceneCountNot read by the field engine; scene code's own counter.
Uint8sceneByteNot read by the field engine; scene code's own state.
union { struct { Sint16timer, userValue, faceAngle, followDistance, unusedBeforeHostActorId, hostActorId, footprintTicks, footprintSide, runningChildFlags, circleAngle, circleTurn, villagerFlags, routeSpot, balanceWeight, restsOnActorId, faceActorId, prizeActorId, colorMark, homeX, homeZ, arcPhase, arcTicks, orbitTicks, orbitAngle, swirlTicks, turnTicks, spinRampTicks ; Sint16 userValue; }; struct { Sint16 faceAngle; }; struct { Sint16 followDistance; }; struct { Sint16 unusedBeforeHostActorId; Sint16 hostActorId; }; struct { Sint16 footprintTicks; Sint16 footprintSide; }; struct { Sint16 runningChildFlags; }; struct { Sint16 circleAngle; Sint16 circleTurn; }; struct { Sint16 villagerFlags; }; struct { Sint16 routeSpot; }; struct { Sint16 balanceWeight; }; struct { Sint16 restsOnActorId; }; struct { Sint16 faceActorId; }; struct { Sint16 prizeActorId; }; struct { Sint16 colorMark; }; struct { Sint16 homeX; Sint16 homeZ; }; struct { Sint16 arcPhase; Sint16 arcTicks; }; struct { Uint16 orbitTicks; Sint16 orbitAngle; }; struct { Uint16 swirlTicks; Sint16 turnTicks; }; struct { Sint16 spinRampTicks; }; }Two halfwords whose meaning depends
union ACTOR_OR_EFFECT *watchedActorThe object (an actor or a field effect) its actor script follows or faces; field code also keeps an actor handle here.
void (*update )(struct ACTOR *actor)Called each tick before its script, while the actor is live.

Description

An actor: one of the ACTOR_COUNT people and things on the field (ActorsWork, HEAP_SLOT_ACTORS), with its actor script, position, motion toward a target, sprites and update function.

struct ACTOR

Referenced by btActorDetachSpriteScripts(), btActorGetSprite(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btCameraSetViewAtPairMidpoint(), btEffectHopBackToSpot(), btEffectRunAnnihilation(), btEffectRunAstralBlast(), btEffectRunAttackSlash(), btEffectRunBind(), btEffectRunBreak(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunCriticalHit(), btEffectRunCybele(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunDrain(), btEffectRunFire(), btEffectRunFlurry(), btEffectRunFroth(), btEffectRunGatheringLights(), btEffectRunGround(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunHelmSplitter(), btEffectRunLobbedShells(), btEffectRunMoteFountain(), btEffectRunNereid(), btEffectRunOrbitingSkulls(), btEffectRunPlanetDiver(), btEffectRunProcne(), btEffectRunProjectileVolley(), btEffectRunQuake(), btEffectRunRagnarok(), btEffectRunRushingStrike(), btEffectRunShiningStar(), btEffectRunSleep(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStatReduction(), btEffectRunStreakVolley(), btEffectRunSwirlSwipe(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunUnusedOrbitingSpirals(), btEffectRunUnusedTriangleStrike() and 1179 more.

Definition at line 98 of file actor.h.

Fields in detail

script

const Sint32 *script

The actor script it runs; null when its slot is free.

scriptCursor

Sint16 scriptCursor

The script cursor, in words.

facing

Uint16 facing

1/65536 turns.

x

FIELD_COORDINATE x

16.16 fixed-point pixels.

y

FIELD_COORDINATE y

16.16 fixed-point pixels.

z

FIELD_COORDINATE z

16.16 fixed-point pixels.

groundHeight

FIXED groundHeight

16.16 fixed-point pixels.

scaleX

FIXED scaleX

16.16 fixed point, toFIXED(1) full size.

scaleY

FIXED scaleY

16.16 fixed point, toFIXED(1) full size.

radius

Uint16 radius

Collision radius in pixels: 16, or half the sprite metadata's footprint, when created; the overlap checks use it less 2.

layer

Uint8 layer

The map layer (0 to 3) its ground height is read from, which the scrolling camera updates from the metatile under it; the fixed camera passes it as the sprite's draw slot.

priorityFlags

Uint8 priorityFlags

ACTOR_PRIORITY_FLAG bits, read by the scrolling camera: ACTOR_PRIORITY_AUTOMATIC for placed actors, ACTOR_PRIORITY_UNDERFOOT for footprints.

velocityX

FIXED velocityX

16.16 fixed-point pixels per tick.

velocityY

FIXED velocityY

16.16 fixed-point pixels per tick.

velocityZ

FIXED velocityZ

16.16 fixed-point pixels per tick.

speedLimit

FIXED speedLimit

16.16 fixed-point pixels per tick.

acceleration

FIXED acceleration

Added toward the target each tick, or taken off the speed when there is none, in 16.16 fixed-point pixels per tick; toFIXED(1) when created.

targetX

FIXED targetX

16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.

targetY

FIXED targetY

16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.

targetZ

FIXED targetZ

16.16 fixed-point pixels; ACTOR_NO_TARGET when unset.

bounce

FIXED bounce

The share of its falling speed kept as it bounces on landing, 16.16 fixed point (a quarter when created); a floating actor's phase instead.

gravity

FIXED gravity

Taken off velocityY each tick while it is above the ground, in 16.16 fixed-point pixels per tick (toFIXED(1) when created); also scales a floating actor's bob.

sceneWord

Sint32 sceneWord

Zeroed by scFieldActorCreate and not read by the field engine; scene code keeps a resting height, a sway or a countdown here.

sprite

SPR *sprite

Its sprite, by spriteStorageKind: one sprite for ACTOR_SPRITE_ONE; for ACTOR_SPRITE_GROUP four, empty ones null, read as void **.

spriteStorageKind

Uint8 spriteStorageKind

An ACTOR_SPR_KIND in its low four bits (ACTOR_SPRITE_KIND_MASK): what sprite holds.

motionFlags

Uint8 motionFlags

ACTOR_MOTION_FLAG bits; none is free flight in 3D, and ACTOR_FOLLOWS_TERRAIN and ACTOR_FALLS are set on creation.

arrivalAxis

Uint8 arrivalAxis

The ARRIVAL_AXIS_* watched for arrival.

conditionResult

Uint8 conditionResult

The actor script's last flag test.

snapToTarget

Uint8 snapToTarget

Nonzero lands it exactly on its target on arrival.

collisionFlags

Uint8 collisionFlags

ACTOR_COLLISION_FLAG bits; placed actors take ACTOR_SOLID.

steeringFlags

Uint8 steeringFlags

ACTOR_STEERING_FLAG bits.

paused

Uint8 paused

Nonzero skips its script and motion, not its update.

retainSpriteCache

Uint8 retainSpriteCache

Nonzero keeps its sprite's VRAM cache entry while sprites are suspended or it is off screen (fdActorSystemPlaceSprites).

repeatCount

Uint8 repeatCount

The actor script's SC_LOOP count.

wait

Sint16 wait

The actor script's wait, in ticks.

refused

Uint8 refused

Ticks in a row a solid actor has refused its move; SC_SYNC stops waiting after 60.

frozen

Uint8 frozen

Nonzero skips steering, terrain, gravity and floating; its velocity still moves it.

sceneCount

Uint8 sceneCount

Not read by the field engine; scene code's own counter.

sceneByte

Uint8 sceneByte

Not read by the field engine; scene code's own state.

timer, userValue, faceAngle, followDistance, unusedBeforeHostActorId, hostActorId, footprintTicks, footprintSide, runningChildFlags, circleAngle, circleTurn, villagerFlags, routeSpot, balanceWeight, restsOnActorId, faceActorId, prizeActorId, colorMark, homeX, homeZ, arcPhase, arcTicks, orbitTicks, orbitAngle, swirlTicks, turnTicks, spinRampTicks

union { struct { Sint16 timer; Sint16 userValue; }; struct { Sint16 faceAngle; }; struct { Sint16 followDistance; }; struct { Sint16 unusedBeforeHostActorId; Sint16 hostActorId; }; struct { Sint16 footprintTicks; Sint16 footprintSide; }; struct { Sint16 runningChildFlags; }; struct { Sint16 circleAngle; Sint16 circleTurn; }; struct { Sint16 villagerFlags; }; struct { Sint16 routeSpot; }; struct { Sint16 balanceWeight; }; struct { Sint16 restsOnActorId; }; struct { Sint16 faceActorId; }; struct { Sint16 prizeActorId; }; struct { Sint16 colorMark; }; struct { Sint16 homeX; Sint16 homeZ; }; struct { Sint16 arcPhase; Sint16 arcTicks; }; struct { Uint16 orbitTicks; Sint16 orbitAngle; }; struct { Uint16 swirlTicks; Sint16 turnTicks; }; struct { Sint16 spinRampTicks; }; }

Two halfwords whose meaning depends

on what runs the actor.

A tick count its update or script keeps (SW_TIMER).

(SW_TIMER).

A value a script or scene keeps for itself (SW_USER_VALUE).

(SW_USER_VALUE).

What an actor script steers by: the angle fdActorStepAngle

turns it to, in 1/65536 turns, or the distance in pixels it

keeps behind the actor it follows.

An emote bubble or attached effect riding an actor

(fdEffectCopyWatchedActorPos): the id of the actor it rides.

The player's footprints, and the splashes that take their

place in shallow water.

ticks until the next footprint or splash may be left

may be left

the foot that leaves the next one, FOOTPRINT_BOTH_FEET after a stop

FOOTPRINT_BOTH_FEET after a stop

A child running after another (Tolbi's children:

KID_CHASES_YOUNGER, KID_TALKING).

Something circling a centre (a spark round an Adept, an orb, a

flame round a beacon): its angle round it and, where it turns

by its own speed, its turn each tick, in 1/65536 turns.

A child round Vault's well: VILLAGER_IS_BOY,

VILLAGER_TALKED_TO.

A suspect in the inn's rooms (Log Rooms A): the spot he stands

at, by the party's or his own numbering (LEADER_SPOT_,

THIEF_SPOT_, LEADER_ROUTE_, THIEF_ROUTE_).

A balance platform: its weight, which sets its height

(BalancePlatformHeights).

A stone or pillar set on a balance: the platform or stone it

rests on, which it rides.

An actor that keeps turned toward another

(scSanctumKeepFacingActor).

A Colosso warrior at his finish: the prize he raises.

An actor Venus Lighthouse draws in a colour again after a

battle: VENUS_COLOR_MARK.

Where SC_WANDER_HOME wanders around, in pixels: where it was

created or placed.

Avoid's caster (fdEffectUpdateAvoidCaster).

1 spins the caster 3/64 turn a tick

ticks since the arcs started

A particle on a spiral that shrinks as its ticks run out: a

Venus Djinni's falling motes

(fdEffectUpdateDescendingOrbitActor), Frost's and Ply's

particles.

ticks left of the spiral

its start on the circle, 1/65536 turns

A Whirlwind particle (fdEffectCircleAnchor,

fdEffectWanderAroundAnchor).

ticks it has circled or wandered so far

ticks left of a sharp turn

A spin that speeds up (fdEffectAdvanceAngleWithRamp).

ticks the spin has been speeding up for

watchedActor

union ACTOR_OR_EFFECT *watchedActor

The object (an actor or a field effect) its actor script follows or faces; field code also keeps an actor handle here.

update

void (*update)(struct ACTOR *actor)

Called each tick before its script, while the actor is live.