Alchemy
Loading...
Searching...
No Matches

ScriptMotionObject Struct Reference

A field object as the motion code sees it: its script, position, motion toward a target, bounce and gravity, motion flags and wait, and its hook. More...

#include <script_motion.h>

Data Structures

union  [union].vertical

Data Fields

const ScriptMotionWords * script
 null when the object is free
u16 scriptCursor
 in words; read signed
u16 facing
 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 [0x0a]
 the x and y scales and the radius; not named here
u8 terrainId
 the map layer whose ground height it follows
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
 Added toward the target each frame, or taken off the speed when there is none, in 16.16 fixed-point pixels 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
union  vertical
s32 gravity
 Taken off velocityY each frame above the ground, 16.16 fixed-point pixels per frame; also scales a floating object's bob.
u8 unk4c [9]
 A spare word, the sprite pointer and the sprite kind; not named here.
u8 motionFlags
 bits: 4 no slowdown on slopes | 3 bigger float | 2 floats | 1 falls | 0 follows the terrain; zero is free flight in 3D
u8 arrivalAxis
 the ARRIVAL_AXIS_* that decides arrival
u8 unk57
 the object script's last flag test; not named here
u8 snapToTarget
 nonzero lands it exactly on its target
u8 collisionFlags
 bit 7: a solid object refuses its move
u8 steeringFlags
 bit 0: turns toward its velocity, 1/16 turn a frame
u8 paused
 nonzero skips its script and motion, not its hook
u8 unk5c [2]
 The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.
s16 wait
 frames left before its script runs again
u8 refused
 frames in a row a solid object refused its move
u8 frozen
 nonzero skips steering, terrain, gravity and floating
u8 unk62 [10]
 Two bytes scene code uses, the action parameter, the footprint side and the linked object; not named here.
void(*) hook (union FieldObject *object)
 Called each frame before its script.

Detailed Description

A field object as the motion code sees it: its script, position, motion toward a target, bounce and gravity, motion flags and wait, and its hook.

Definition at line 27 of file script_motion.h.

Field Documentation

◆ script

const ScriptMotionWords* ScriptMotionObject::script

null when the object is free

Definition at line 28 of file script_motion.h.

Referenced by BattleFx_SetupObjectPair(), Object_UpdateAll(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ scriptCursor

u16 ScriptMotionObject::scriptCursor

in words; read signed

Definition at line 29 of file script_motion.h.

Referenced by Object_UpdateAllThumb().

◆ facing

u16 ScriptMotionObject::facing

1/65536 turns

Definition at line 30 of file script_motion.h.

Referenced by BattleFx_SetupObjectPair(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ x

◆ y

◆ z

◆ terrainHeight

s32 ScriptMotionObject::terrainHeight

16.16 fixed-point pixels

Definition at line 34 of file script_motion.h.

Referenced by Object_UpdateAllMotion().

◆ unk18

u8 ScriptMotionObject::unk18[0x0a]

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

Definition at line 35 of file script_motion.h.

◆ terrainId

u8 ScriptMotionObject::terrainId

the map layer whose ground height it follows

Definition at line 36 of file script_motion.h.

Referenced by Object_UpdateAllThumb().

◆ unk23

u8 ScriptMotionObject::unk23

FieldActor.priorityFlags; not named here.

Definition at line 37 of file script_motion.h.

◆ velocityX

s32 ScriptMotionObject::velocityX

16.16 fixed-point pixels per frame

Definition at line 38 of file script_motion.h.

Referenced by Object_UpdateAll(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ velocityY

s32 ScriptMotionObject::velocityY

16.16 fixed-point pixels per frame

Definition at line 39 of file script_motion.h.

Referenced by Object_UpdateAll(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ velocityZ

s32 ScriptMotionObject::velocityZ

16.16 fixed-point pixels per frame

Definition at line 40 of file script_motion.h.

Referenced by Object_UpdateAll(), and Object_UpdateAllThumb().

◆ speedLimit

s32 ScriptMotionObject::speedLimit

16.16 fixed-point pixels per frame

Definition at line 41 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ acceleration

s32 ScriptMotionObject::acceleration

Added toward the target each frame, or taken off the speed when there is none, in 16.16 fixed-point pixels per frame.

Definition at line 44 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ targetX

s32 ScriptMotionObject::targetX

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 45 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ targetY

s32 ScriptMotionObject::targetY

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 46 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ targetZ

s32 ScriptMotionObject::targetZ

16.16 fixed-point pixels; 0x80000000 when unset

Definition at line 47 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ vertical

◆ gravity

s32 ScriptMotionObject::gravity

Taken off velocityY each frame above the ground, 16.16 fixed-point pixels per frame; also scales a floating object's bob.

Definition at line 56 of file script_motion.h.

Referenced by FieldObject_Create(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ unk4c

u8 ScriptMotionObject::unk4c[9]

A spare word, the sprite pointer and the sprite kind; not named here.

Definition at line 58 of file script_motion.h.

◆ motionFlags

u8 ScriptMotionObject::motionFlags

bits: 4 no slowdown on slopes | 3 bigger float | 2 floats | 1 falls | 0 follows the terrain; zero is free flight in 3D

Definition at line 61 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ arrivalAxis

u8 ScriptMotionObject::arrivalAxis

the ARRIVAL_AXIS_* that decides arrival

Definition at line 62 of file script_motion.h.

Referenced by Object_SetMoveTarget(), Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ unk57

u8 ScriptMotionObject::unk57

the object script's last flag test; not named here

Definition at line 63 of file script_motion.h.

◆ snapToTarget

u8 ScriptMotionObject::snapToTarget

nonzero lands it exactly on its target

Definition at line 64 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ collisionFlags

u8 ScriptMotionObject::collisionFlags

bit 7: a solid object refuses its move

Definition at line 65 of file script_motion.h.

Referenced by FieldObject_Create(), and Object_UpdateAllThumb().

◆ steeringFlags

u8 ScriptMotionObject::steeringFlags

bit 0: turns toward its velocity, 1/16 turn a frame

Definition at line 66 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ paused

u8 ScriptMotionObject::paused

nonzero skips its script and motion, not its hook

Definition at line 67 of file script_motion.h.

Referenced by Object_UpdateAllThumb().

◆ unk5c

u8 ScriptMotionObject::unk5c[2]

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

Definition at line 70 of file script_motion.h.

◆ wait

s16 ScriptMotionObject::wait

frames left before its script runs again

Definition at line 71 of file script_motion.h.

Referenced by Object_UpdateAllThumb().

◆ refused

u8 ScriptMotionObject::refused

frames in a row a solid object refused its move

Definition at line 72 of file script_motion.h.

◆ frozen

u8 ScriptMotionObject::frozen

nonzero skips steering, terrain, gravity and floating

Definition at line 73 of file script_motion.h.

Referenced by Object_UpdateAllMotion(), and Object_UpdateAllThumb().

◆ unk62

u8 ScriptMotionObject::unk62[10]

Two bytes scene code uses, the action parameter, the footprint side and the linked object; not named here.

Definition at line 76 of file script_motion.h.

◆ hook