Alchemy
Loading...
Searching...
No Matches

ObjectRuntime Struct Reference

One of the 64 field objects in the object pool (heap slot 5): its script, position, motion toward a target, animation and update callback. More...

#include <object_runtime.h>

Data Fields

s32 * script
 the object script it runs; null when the object is free
s16 step
 the script cursor, in words
u16 angle
 1/65536 turns
s32 x
 16.16 fixed-point pixels
s32 y
 16.16 fixed-point pixels
s32 z
 16.16 fixed-point pixels
s32 terrainHeight
 16.16 fixed-point pixels
u8 unk18 [0x08]
 the x and y scales, FieldActor.scaleX and scaleY
u16 radius
 collision radius in pixels
u8 terrainId
 the map layer its ground height is read from
u8 priorityFlags
 FieldActor.priorityFlags: 1 for placed actors, 2 for footprints.
s32 velocityX
 16.16 fixed-point pixels per frame
s32 velocityY
 16.16 fixed-point pixels per frame
s32 velocityZ
 16.16 fixed-point pixels per frame
s32 speedLimit
 16.16 fixed-point pixels per frame
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.
s32 targetX
 16.16 fixed-point pixels; 0x80000000 when unset
s32 targetY
 16.16 fixed-point pixels; 0x80000000 when unset
s32 targetZ
 16.16 fixed-point pixels; 0x80000000 when unset
u8 unk44 [0x0c]
 FieldActor's bounce and gravity, and a word FieldObject_Create zeroes.
void * animation
 its sprite, or its list of four, by animationKind
u8 animationKind
 Low four bits: 0 no sprite, 1 one sprite, 2 a group of up to four.
u8 flags
 FieldActor.motionFlags: 3 when created, 4 for a placed actor above the ground; zero is free flight in 3D.
u8 arrivalAxis
 the ARRIVAL_AXIS_* that decides arrival
u8 conditionResult
 the object script's last flag test
u8 snapToTarget
 nonzero lands it exactly on its target
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.
u8 actionFlags
 FieldActor.steeringFlags: bit 0 faces its motion.
u8 movementState
 nonzero skips its script and motion (paused)
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.
u16 wait
 the object script's wait, in frames
void * callback
 Not named by TBS code through this struct.
s16 action
 The parameter its action script reads (a follow distance or an angle), or the player's frames to its next footprint.
s16 footprintSide
 the side of the player's next footprint (2 after a stop)
struct ObjectRuntime * linkedObject
 The object its action script follows or faces.
u8 unk6c [0x04]
 The update hook (FieldActor.update), which the unused ObjectDispatch_SetUpdateValue sets as a word.

Detailed Description

One of the 64 field objects in the object pool (heap slot 5): its script, position, motion toward a target, animation and update callback.

Definition at line 14 of file object_runtime.h.

Field Documentation

◆ script

◆ step

s16 ObjectRuntime::step

the script cursor, in words

Definition at line 16 of file object_runtime.h.

Referenced by Camera_FollowLeaderInBounds(), ObjectMotion_MoveTowardTarget(), and Scene_TalkToActor().

◆ angle

◆ x

s32 ObjectRuntime::x

16.16 fixed-point pixels

Definition at line 18 of file object_runtime.h.

Referenced by Actor_JumpDownLedge(), BattleEffect_ClearOutOfBoundsObjects(), BattleFx_RunCondemn(), BattleFx_RunPlanetDiver(), BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), BattleFx_UpdateDriftingFallObject(), BattleFx_UpdateRadialSpread(), BattleFx_UpdateRandomTargetParticle(), Camera_FollowActor(), Camera_FollowLeaderInBounds(), Camera_FollowObject(), Camera_MoveWithinMapBounds(), DisplayTransition_UpdateScanlineTable(), Event_ShowSpeakerMessage(), Event_SpawnObjectTable(), FacingObject_TurnPairToFaceEachOther(), Field_ClimbDown(), Field_ClimbUp(), Field_FindNearbyPsynergyTarget(), Field_FindNearbyTalkTarget(), Field_GetCollisionAheadOfLeader(), Field_ProcessStep(), Field_RequestBattleFromEncounterTable(), Field_RequestDjinnBattle(), Field_TryJumpForward(), Field_UpdateObjectVisibilityBounds(), FieldEffect_SpawnNearbyMarkers(), FieldEffect_WatchLeaderDistance(), FieldFx_CheckCloakTile(), FieldObject_PlaceSceneActors(), FieldObject_UpdatePlayerControl(), ItemDisplay_EmitSparkles(), ItemDisplay_RaiseAboveLeader(), Marker_MoveLeaderAway(), Marker_SetActorPosition(), Motion_LaunchFromFocusedObject(), Motion_SetTargetPositionFromMagnitudeAngle(), Object_ApproachLinkedObject(), Object_FindNearestFacingTarget(), Object_MoveByKeys(), Object_MoveOnWorldMap(), Object_PlaceCurrentWithinCameraBounds(), Object_SetMoveTarget(), Object_Spawn(), ObjectEffect_EndContextEffect(), ObjectMotion_MoveTowardTarget(), ObjectMotion_ResetAndSetPosition(), ObjectMotion_ResetAndSetPositionInMode2(), ObjectMotion_SetAngleToward(), ObjectMotion_SetHorizontalPositionWithTerrain(), ObjectMotion_SetPositionAndCommit(), ObjectMotion_SetPositionAndReset(), ObjectMotion_SetPositionWithTerrain(), ObjectMotion_SnapToTerrain(), ObjectMotion_TurnTowardLinkedTarget(), ObjectTable_ResetForObject(), Scene_TalkToActor(), Script_ApplyPositionCommand(), ScriptObject_CheckOverlap(), ScriptObject_FindOverlappingEntry(), and UiText_OpenMessageAtObject().

◆ y

◆ z

s32 ObjectRuntime::z

16.16 fixed-point pixels

Definition at line 20 of file object_runtime.h.

Referenced by BattleEffect_ClearOutOfBoundsObjects(), BattleFx_RunCondemn(), BattleFx_RunPlanetDiver(), BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), BattleFx_UpdateRadialSpread(), BattleFx_UpdateRandomTargetParticle(), Camera_FollowLeaderInBounds(), Camera_FollowObject(), Camera_MoveWithinMapBounds(), DisplayTransition_UpdateScanlineTable(), Event_SpawnObjectTable(), FacingObject_TurnPairToFaceEachOther(), Field_ClimbDown(), Field_ClimbUp(), Field_FindNearbyPsynergyTarget(), Field_FindNearbyTalkTarget(), Field_GetCollisionAheadOfLeader(), Field_TryJumpForward(), FieldEffect_SpawnNearbyMarkers(), FieldEffect_WatchLeaderDistance(), FieldFx_CheckCloakTile(), FieldObject_PlaceSceneActors(), FieldObject_UpdatePlayerControl(), ItemDisplay_EmitSparkles(), ItemDisplay_RaiseAboveLeader(), Marker_MoveLeaderAway(), Marker_SetActorPosition(), Motion_LaunchFromFocusedObject(), Motion_SetTargetPositionFromMagnitudeAngle(), Object_ApproachLinkedObject(), Object_FindNearestFacingTarget(), Object_MoveOnWorldMap(), Object_PlaceCurrentWithinCameraBounds(), Object_SetMoveTarget(), Object_Spawn(), ObjectEffect_EndContextEffect(), ObjectMotion_MoveTowardTarget(), ObjectMotion_ResetAndSetPosition(), ObjectMotion_ResetAndSetPositionInMode2(), ObjectMotion_SetAngleToward(), ObjectMotion_SetHorizontalPositionWithTerrain(), ObjectMotion_SetPositionAndCommit(), ObjectMotion_SetPositionAndReset(), ObjectMotion_SetPositionWithTerrain(), ObjectMotion_SnapToTerrain(), ObjectMotion_TurnTowardLinkedTarget(), ObjectTable_ResetForObject(), Scene_TalkToActor(), and Script_ApplyPositionCommand().

◆ terrainHeight

◆ unk18

u8 ObjectRuntime::unk18[0x08]

the x and y scales, FieldActor.scaleX and scaleY

Definition at line 22 of file object_runtime.h.

◆ radius

u16 ObjectRuntime::radius

collision radius in pixels

Definition at line 23 of file object_runtime.h.

Referenced by FieldObject_UpdatePlayerControl().

◆ terrainId

u8 ObjectRuntime::terrainId

◆ priorityFlags

u8 ObjectRuntime::priorityFlags

FieldActor.priorityFlags: 1 for placed actors, 2 for footprints.

Definition at line 26 of file object_runtime.h.

◆ velocityX

s32 ObjectRuntime::velocityX

16.16 fixed-point pixels per frame

Definition at line 27 of file object_runtime.h.

Referenced by BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), FieldObject_UpdatePlayerControl(), and Object_MoveOnWorldMap().

◆ velocityY

s32 ObjectRuntime::velocityY

16.16 fixed-point pixels per frame

Definition at line 28 of file object_runtime.h.

Referenced by Field_ProcessStep(), Field_TryJumpForward(), ItemDisplay_EmitSparkles(), and ObjectEffect_RunPendingFlagEvent().

◆ velocityZ

s32 ObjectRuntime::velocityZ

16.16 fixed-point pixels per frame

Definition at line 29 of file object_runtime.h.

Referenced by BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), FieldObject_UpdatePlayerControl(), and Object_MoveOnWorldMap().

◆ speedLimit

◆ acceleration

s32 ObjectRuntime::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.

Definition at line 33 of file object_runtime.h.

Referenced by BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), Camera_SetSpeedParameters(), Field_TryJumpForward(), FieldFx_RunForce(), Object_ApproachLinkedObject(), Object_SetMoveTarget(), Object_SetTargetAndCallback(), ObjectEffect_EndContextEffect(), and ObjectMotion_SetSpeedParameters().

◆ targetX

s32 ObjectRuntime::targetX

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 34 of file object_runtime.h.

Referenced by BattleFx_SetCallbackWhenTargetUnset(), Camera_FollowLeaderInBounds(), Field_ProcessStep(), Marker_MoveLeaderAway(), and Scene_TalkToActor().

◆ targetY

s32 ObjectRuntime::targetY

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 35 of file object_runtime.h.

Referenced by BattleFx_SetCallbackWhenTargetUnset(), Camera_FollowLeaderInBounds(), Marker_MoveLeaderAway(), and Scene_TalkToActor().

◆ targetZ

s32 ObjectRuntime::targetZ

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 36 of file object_runtime.h.

Referenced by BattleFx_SetCallbackWhenTargetUnset(), Camera_FollowLeaderInBounds(), Marker_MoveLeaderAway(), Object_IsTargetUnset(), and Scene_TalkToActor().

◆ unk44

u8 ObjectRuntime::unk44[0x0c]

FieldActor's bounce and gravity, and a word FieldObject_Create zeroes.

Definition at line 38 of file object_runtime.h.

◆ animation

◆ animationKind

◆ flags

◆ arrivalAxis

u8 ObjectRuntime::arrivalAxis

the ARRIVAL_AXIS_* that decides arrival

Definition at line 45 of file object_runtime.h.

◆ conditionResult

u8 ObjectRuntime::conditionResult

the object script's last flag test

Definition at line 46 of file object_runtime.h.

◆ snapToTarget

u8 ObjectRuntime::snapToTarget

nonzero lands it exactly on its target

Definition at line 47 of file object_runtime.h.

Referenced by Object_SetMoveTarget().

◆ collisionFlags

u8 ObjectRuntime::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.

Definition at line 50 of file object_runtime.h.

Referenced by Field_FindNearbyPsynergyTarget(), Field_FindNearbyTalkTarget(), FieldObject_UpdatePlayerControl(), Object_SetTargetAndCallback(), ScriptObject_CheckOverlap(), and ScriptObject_FindOverlappingEntry().

◆ actionFlags

u8 ObjectRuntime::actionFlags

FieldActor.steeringFlags: bit 0 faces its motion.

Definition at line 51 of file object_runtime.h.

Referenced by Scene_TalkToActor().

◆ movementState

u8 ObjectRuntime::movementState

◆ unk5c

u8 ObjectRuntime::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.

Definition at line 56 of file object_runtime.h.

◆ wait

u16 ObjectRuntime::wait

the object script's wait, in frames

Definition at line 57 of file object_runtime.h.

Referenced by Object_LinkPair(), ObjectMotion_ArmCallback(), ObjectMotion_SetAngleToward(), and SpawnHeavyImpactEffect().

◆ callback

void* ObjectRuntime::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.

Definition at line 62 of file object_runtime.h.

◆ action

◆ footprintSide

s16 ObjectRuntime::footprintSide

the side of the player's next footprint (2 after a stop)

Definition at line 66 of file object_runtime.h.

Referenced by FieldObject_UpdatePlayerControl().

◆ linkedObject

◆ unk6c

u8 ObjectRuntime::unk6c[0x04]

The update hook (FieldActor.update), which the unused ObjectDispatch_SetUpdateValue sets as a word.

Definition at line 72 of file object_runtime.h.

Referenced by ObjectDispatch_SetUpdateValue().