Alchemy

script_motion.h

games/tbs/include/script_motion.h on GitHub

Structures

ScriptMotionWords

struct ScriptMotionWords

The words of an object's script, as its script pointer reads them.

FieldDeclared as
words32 word[1]

Used by Object_UpdateAllThumb.

Line 19

ScriptMotionObject

struct ScriptMotionObject

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.

FieldDeclared as
scriptconst ScriptMotionWords *scriptnull when the object is free
scriptCursoru16 scriptCursorin words; read signed
facingu16 facing1/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[0x0a]the x and y scales and the radius; not named here
terrainIdu8 terrainIdthe map layer whose ground height it follows
unk23u8 unk23FieldActor.priorityFlags; not named here
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.
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
bounce, phase, verticalunion { /// The share of the falling speed kept on landing, 16.16 fixed point. s32 bounce; /// A floating object's step along gScriptObject_CycleTable, low six bits. s32 phase; } vertical
gravitys32 gravityTaken off velocityY each frame above the ground, 16.16 fixed-point pixels per frame; also scales a floating object's bob.
unk4cu8 unk4c[9]A spare word, the sprite pointer and the sprite kind; not named here.
motionFlagsu8 motionFlagsbits: 4 no slowdown on slopes | 3 bigger float | 2 floats | 1 falls | 0 follows the terrain; zero is free flight in 3D
arrivalAxisu8 arrivalAxisthe ARRIVAL_AXIS_* that decides arrival
unk57u8 unk57the object script's last flag test; not named here
snapToTargetu8 snapToTargetnonzero lands it exactly on its target
collisionFlagsu8 collisionFlagsbit 7: a solid object refuses its move
steeringFlagsu8 steeringFlagsbit 0: turns toward its velocity, 1/16 turn a frame
pausedu8 pausednonzero skips its script and motion, not its hook
unk5cu8 unk5c[2]The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.
waits16 waitframes left before its script runs again
refusedu8 refusedframes in a row a solid object refused its move
frozenu8 frozennonzero skips steering, terrain, gravity and floating
unk62u8 unk62[10]Two bytes scene code uses, the action parameter, the footprint side and the linked object; not named here.
hookvoid (*hook)(union FieldObject *object)Called each frame before its script.

Used by BattleEffect_CleanupSceneObjects, BattleFx_SetupObjectPair, BattleFx_ShrinkObjectScaleUntilHalf, EffectRuntime_StopCurrentObject, FieldFx_EndCloak, FieldFx_RunForce, FieldFx_StartCloak, FieldObject_Create, ObjectGroup_ConfigureChildValue, Object_UpdateAll, Object_UpdateAllMotion, Object_UpdateAllThumb, gObjectSlots.

Line 27

On this page