Alchemy

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.

FieldDeclared as
scripts32 *scriptthe object script it runs; null when the object is free
steps16 stepthe script cursor, in words
angleu16 angle1/65536 turns
xs32 x16.16 fixed-point pixels
ys32 y16.16 fixed-point pixels
zs32 z16.16 fixed-point pixels
terrainHeights32 terrainHeight16.16 fixed-point pixels
unk18u8 unk18[0x08]the x and y scales, FieldActor.scaleX and scaleY
radiusu16 radiuscollision radius in pixels
terrainIdu8 terrainIdthe map layer its ground height is read from
priorityFlagsu8 priorityFlagsFieldActor.priorityFlags: 1 for placed actors, 2 for footprints.
velocityXs32 velocityX16.16 fixed-point pixels per frame
velocityYs32 velocityY16.16 fixed-point pixels per frame
velocityZs32 velocityZ16.16 fixed-point pixels per frame
speedLimits32 speedLimit16.16 fixed-point pixels per frame
accelerations32 accelerationAdded 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.
targetXs32 targetX16.16 fixed-point pixels; 0x80000000 when unset
targetYs32 targetY16.16 fixed-point pixels; 0x80000000 when unset
targetZs32 targetZ16.16 fixed-point pixels; 0x80000000 when unset
unk44u8 unk44[0x0c]FieldActor's bounce and gravity, and a word FieldObject_Create zeroes.
animationvoid *animationits sprite, or its list of four, by animationKind
animationKindu8 animationKindLow four bits: 0 no sprite, 1 one sprite, 2 a group of up to four.
flagsu8 flagsFieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in 3D.
arrivalAxisu8 arrivalAxisthe ARRIVAL_AXIS_* that decides arrival
conditionResultu8 conditionResultthe object script's last flag test
snapToTargetu8 snapToTargetnonzero lands it exactly on its target
collisionFlagsu8 collisionFlagsFieldActor.collisionFlags: bit 0 solid, bit 1 the player pushes it, bits 2 to 4 for talk and Psynergy targets; placed actors take 1.
actionFlagsu8 actionFlagsFieldActor.steeringFlags: bit 0 faces its motion
movementStateu8 movementStatenonzero skips its script and motion (paused)
unk5cu8 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.
waitu16 waitthe object script's wait, in frames
callbackvoid *callbackNot 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.
actions16 actionThe parameter its action script reads (a follow distance or an angle), or the player's frames to its next footprint.
footprintSides16 footprintSidethe side of the player's next footprint (2 after a stop)
linkedObjectstruct ObjectRuntime *linkedObjectThe object its action script follows or faces.
unk6cu8 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.

Line 14

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.

FieldDeclared as
slotsu8 slots[OBJECT_SNAPSHOT_CAPACITY]actor numbers, or OBJECT_SNAPSHOT_EMPTY
actorsstruct ObjectRuntime actors[OBJECT_SNAPSHOT_CAPACITY]copied by DMA
animationsu8 animations[OBJECT_SNAPSHOT_CAPACITY]each sprite's lastNo
spriteFlagsu8 spriteFlags[OBJECT_SNAPSHOT_CAPACITY]restored through the dispatcher
prioritiesu8 priorities[OBJECT_SNAPSHOT_CAPACITY]both image and shadow priority

Used by gObjectSnapshots.

Line 88

Globals, without a comment: gObjectSnapshots.

On this page