Alchemy
Loading...
Searching...
No Matches

ScriptObjectRuntime Struct Reference

A field object as its object script commands see it: the script and its place, position, motion toward a target, and the home it wanders around. More...

#include <field/script_object_runtime.h>

Data Fields

const s32 * script
 null when the object is free
u16 scriptCursor
 in words
u16 scriptValue
 The object's facing, 1/65536 turns: the heading SC_WANDER and SC_WANDER_HOME wander around, and where SC_FACE_LINK stores the angle to the linked object.
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 [0x0a]
 the x and y scales and the radius; not named here
u8 terrainId
 the map layer its ground height is read from
u8 unk23
 FieldActor.priorityFlags; not named here.
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
 16.16 fixed-point pixels per frame, per frame
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]
 bounce, gravity and a spare word; not named here
void * animation
 its sprite, or its list of four, by animationKind
u8 animationKind
 low four bits: 0 no sprite, 1 one, 2 up to four
u8 flags
 FieldActor.motionFlags.
u8 unk56 [0x03]
 The arrival axis, the last flag test and the snap flag; not named here.
u8 flags59
 FieldActor.collisionFlags.
u8 actionFlags
 FieldActor.steeringFlags.
u8 movementState
 nonzero skips its script and motion (paused)
u8 unk5c [0x02]
 The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.
u16 turnedBack
 The object script's wait, in frames (ScriptMotionObject.wait).
void * callback
 Not named by TBS code through this struct: the refusal count, the frozen flag and two bytes scene code uses.
struct ScriptObjectRuntime * linkedObject
 The object SC_FACE_LINK and SC_MOVE_LINK aim at.
u8 unk6c [0x04]
 the update hook (FieldActor.update); not named here
s16 homeX
 Its home, in pixels: where it was created or placed.
s16 homeZ

Detailed Description

A field object as its object script commands see it: the script and its place, position, motion toward a target, and the home it wanders around.

Definition at line 12 of file script_object_runtime.h.

Field Documentation

◆ script

const s32* ScriptObjectRuntime::script

null when the object is free

Definition at line 13 of file script_object_runtime.h.

Referenced by ObjectDispatch_Initialize(), and Script_ApplyRelativePosition().

◆ scriptCursor

u16 ScriptObjectRuntime::scriptCursor

◆ scriptValue

u16 ScriptObjectRuntime::scriptValue

The object's facing, 1/65536 turns: the heading SC_WANDER and SC_WANDER_HOME wander around, and where SC_FACE_LINK stores the angle to the linked object.

Definition at line 18 of file script_object_runtime.h.

Referenced by Script_StoreAngleToLinkedObject().

◆ x

◆ y

◆ z

◆ terrainHeight

s32 ScriptObjectRuntime::terrainHeight

16.16 fixed-point pixels

Definition at line 22 of file script_object_runtime.h.

◆ unk18

u8 ScriptObjectRuntime::unk18[0x0a]

the x and y scales and the radius; not named here

Definition at line 23 of file script_object_runtime.h.

◆ terrainId

u8 ScriptObjectRuntime::terrainId

the map layer its ground height is read from

Definition at line 24 of file script_object_runtime.h.

◆ unk23

u8 ScriptObjectRuntime::unk23

FieldActor.priorityFlags; not named here.

Definition at line 25 of file script_object_runtime.h.

◆ velocityX

s32 ScriptObjectRuntime::velocityX

16.16 fixed-point pixels per frame

Definition at line 26 of file script_object_runtime.h.

◆ velocityY

s32 ScriptObjectRuntime::velocityY

16.16 fixed-point pixels per frame

Definition at line 27 of file script_object_runtime.h.

◆ velocityZ

s32 ScriptObjectRuntime::velocityZ

16.16 fixed-point pixels per frame

Definition at line 28 of file script_object_runtime.h.

◆ speedLimit

s32 ScriptObjectRuntime::speedLimit

16.16 fixed-point pixels per frame

Definition at line 29 of file script_object_runtime.h.

◆ acceleration

s32 ScriptObjectRuntime::acceleration

16.16 fixed-point pixels per frame, per frame

Definition at line 30 of file script_object_runtime.h.

◆ targetX

s32 ScriptObjectRuntime::targetX

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 31 of file script_object_runtime.h.

◆ targetY

s32 ScriptObjectRuntime::targetY

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 32 of file script_object_runtime.h.

◆ targetZ

s32 ScriptObjectRuntime::targetZ

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 33 of file script_object_runtime.h.

◆ unk44

u8 ScriptObjectRuntime::unk44[0x0c]

bounce, gravity and a spare word; not named here

Definition at line 34 of file script_object_runtime.h.

◆ animation

void* ScriptObjectRuntime::animation

its sprite, or its list of four, by animationKind

Definition at line 35 of file script_object_runtime.h.

Referenced by ObjectDispatch_SetAnimationAndSpeed().

◆ animationKind

u8 ScriptObjectRuntime::animationKind

low four bits: 0 no sprite, 1 one, 2 up to four

Definition at line 36 of file script_object_runtime.h.

◆ flags

u8 ScriptObjectRuntime::flags

FieldActor.motionFlags.

Definition at line 37 of file script_object_runtime.h.

◆ unk56

u8 ScriptObjectRuntime::unk56[0x03]

The arrival axis, the last flag test and the snap flag; not named here.

Definition at line 39 of file script_object_runtime.h.

◆ flags59

u8 ScriptObjectRuntime::flags59

FieldActor.collisionFlags.

SC_WANDER_HOME sets bit 1 while it roams inside its home radius and clears it on heading home.

Definition at line 42 of file script_object_runtime.h.

Referenced by Object_ClearChildAndCollisionFlags().

◆ actionFlags

u8 ScriptObjectRuntime::actionFlags

FieldActor.steeringFlags.

Definition at line 43 of file script_object_runtime.h.

◆ movementState

u8 ScriptObjectRuntime::movementState

nonzero skips its script and motion (paused)

Definition at line 44 of file script_object_runtime.h.

◆ unk5c

u8 ScriptObjectRuntime::unk5c[0x02]

The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.

Definition at line 47 of file script_object_runtime.h.

◆ turnedBack

u16 ScriptObjectRuntime::turnedBack

The object script's wait, in frames (ScriptMotionObject.wait).

SC_WANDER sets 1 when it turns back, to wait a frame.

Definition at line 50 of file script_object_runtime.h.

◆ callback

void* ScriptObjectRuntime::callback

Not named by TBS code through this struct: the refusal count, the frozen flag and two bytes scene code uses.

Definition at line 53 of file script_object_runtime.h.

◆ homeX

s16 ScriptObjectRuntime::homeX

Its home, in pixels: where it was created or placed.

The bytes are ObjectRuntime's action and footprintSide too.

Definition at line 57 of file script_object_runtime.h.

Referenced by Event_SpawnObjectTable(), and FieldObject_Create().

◆ homeZ

s16 ScriptObjectRuntime::homeZ

Definition at line 58 of file script_object_runtime.h.

Referenced by Event_SpawnObjectTable(), and FieldObject_Create().

◆ linkedObject

struct ScriptObjectRuntime* ScriptObjectRuntime::linkedObject

The object SC_FACE_LINK and SC_MOVE_LINK aim at.

Definition at line 61 of file script_object_runtime.h.

Referenced by Script_ApplyLinkedObjectPosition(), and Script_StoreAngleToLinkedObject().

◆ unk6c

u8 ScriptObjectRuntime::unk6c[0x04]

the update hook (FieldActor.update); not named here

Definition at line 62 of file script_object_runtime.h.