object_runtime.h
games/tbs/include/object_runtime.h on GitHub
Structures
ObjectRuntime
struct ObjectRuntime
One of the 64 field objects in the object pool (heap slot 5): its script, position, motion toward a target, animation and update callback.
| Field | Declared as | |
|---|---|---|
script | s32 *script | the object script it runs; null when the object is free |
step | s16 step | the script cursor, in words |
angle | u16 angle | 1/65536 turns |
x | s32 x | 16.16 fixed-point pixels |
y | s32 y | 16.16 fixed-point pixels |
z | s32 z | 16.16 fixed-point pixels |
terrainHeight | s32 terrainHeight | 16.16 fixed-point pixels |
unk18 | u8 unk18[0x08] | the x and y scales, FieldActor.scaleX and scaleY |
radius | u16 radius | collision radius in pixels |
terrainId | u8 terrainId | the map layer its ground height is read from |
priorityFlags | u8 priorityFlags | FieldActor.priorityFlags: 1 for placed actors, 2 for footprints. |
velocityX | s32 velocityX | 16.16 fixed-point pixels per frame |
velocityY | s32 velocityY | 16.16 fixed-point pixels per frame |
velocityZ | s32 velocityZ | 16.16 fixed-point pixels per frame |
speedLimit | s32 speedLimit | 16.16 fixed-point pixels per frame |
acceleration | s32 acceleration | Added toward the target each frame, or taken off the speed when there is none, in 16.16 fixed-point pixels per frame; 0x10000 when created. |
targetX | s32 targetX | 16.16 fixed-point pixels; 0x80000000 when unset |
targetY | s32 targetY | 16.16 fixed-point pixels; 0x80000000 when unset |
targetZ | s32 targetZ | 16.16 fixed-point pixels; 0x80000000 when unset |
unk44 | u8 unk44[0x0c] | FieldActor's bounce and gravity, and a word FieldObject_Create zeroes. |
animation | void *animation | its sprite, or its list of four, by animationKind |
animationKind | u8 animationKind | Low four bits: 0 no sprite, 1 one sprite, 2 a group of up to four. |
flags | u8 flags | FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in 3D. |
arrivalAxis | u8 arrivalAxis | the ARRIVAL_AXIS_* that decides arrival |
conditionResult | u8 conditionResult | the object script's last flag test |
snapToTarget | u8 snapToTarget | nonzero lands it exactly on its target |
collisionFlags | u8 collisionFlags | FieldActor.collisionFlags: bit 0 solid, bit 1 the player pushes it, bits 2 to 4 for talk and Psynergy targets; placed actors take 1. |
actionFlags | u8 actionFlags | FieldActor.steeringFlags: bit 0 faces its motion |
movementState | u8 movementState | nonzero skips its script and motion (paused) |
unk5c | u8 unk5c[0x02] | Byte 0, when nonzero, keeps its sprite's VRAM cache entry while sprites are suspended or it is off screen; byte 1 is the object script's SC_LOOP count. |
wait | u16 wait | the object script's wait, in frames |
callback | void *callback | Not named by TBS code through this struct. Its bytes are the frames a solid object has refused the object's move and the frozen flag (ScriptMotionObject's refused and frozen), then two bytes scene code uses. |
action | s16 action | The parameter its action script reads (a follow distance or an angle), or the player's frames to its next footprint. |
footprintSide | s16 footprintSide | the side of the player's next footprint (2 after a stop) |
linkedObject | struct ObjectRuntime *linkedObject | The object its action script follows or faces. |
unk6c | u8 unk6c[0x04] | The update hook (FieldActor.update), which the unused ObjectDispatch_SetUpdateValue sets as a word. |
Used by Actor_JumpDownLedge, Actor_WaitForAnimationEnd, BattleEffect_ClearOutOfBoundsObjects, BattleEffect_SpawnBurstParticleField, BattleFx_CheckRaisedTargetCollision, BattleFx_ClearChildValueOnMismatch, BattleFx_DispatchRequestKind, BattleFx_InitializeRisingObject, BattleFx_RunAstralBlast, BattleFx_RunCondemn, BattleFx_RunDeathPlunge, BattleFx_RunHelmSplitter, BattleFx_RunPlanetDiver, BattleFx_RunVenusDjinnCapture, BattleFx_SetApproachMotion, BattleFx_SetCallbackWhenTargetUnset, BattleFx_SetupObjectPair, BattleFx_ShrinkObjectScaleUntilHalf, BattleFx_StartEffectObject22, BattleFx_StartItemBreak, BattleFx_SteerLiftedTarget, BattleFx_SteerPushedTarget, BattleFx_UpdateDriftingFallObject, BattleFx_UpdateRadialSpread, BattleFx_UpdateRandomTargetParticle, BattleMotion_ApplyVariantMotion, BattleMotion_ApproachTarget, BattleMotion_InitializeObject, BattleMotion_InterpolatePosition, BattleMotion_ResetObjectAtScaledAnchor, BattleMotion_SetObjectPosition, BattleMotion_SetupEscapeObject, Camera_FollowActor, Camera_FollowLeaderInBounds, Camera_FollowObject, Camera_MoveWithinMapBounds, Colosso_RestoreCompetitor, DisplayTransition_UpdateScanlineTable, Djinn_RunBattleStartHop, EventObject_Initialize and 119 more.
ObjectTableSnapshot
struct ObjectTableSnapshot
Actors kept across a battle or a saved scene, with parallel sprite state. The slot list ends in OBJECT_SNAPSHOT_EMPTY unless every entry is filled.
| Field | Declared as | |
|---|---|---|
slots | u8 slots[OBJECT_SNAPSHOT_CAPACITY] | actor numbers, or OBJECT_SNAPSHOT_EMPTY |
actors | struct ObjectRuntime actors[OBJECT_SNAPSHOT_CAPACITY] | copied by DMA |
animations | u8 animations[OBJECT_SNAPSHOT_CAPACITY] | each sprite's lastNo |
spriteFlags | u8 spriteFlags[OBJECT_SNAPSHOT_CAPACITY] | restored through the dispatcher |
priorities | u8 priorities[OBJECT_SNAPSHOT_CAPACITY] | both image and shadow priority |
Used by gObjectSnapshots.
Globals, without a comment: gObjectSnapshots.