Alchemy
Loading...
Searching...
No Matches

script_object_runtime.h

Go to the documentation of this file.
1#ifndef ALCHEMY_SCRIPT_OBJECT_RUNTIME_H
2#define ALCHEMY_SCRIPT_OBJECT_RUNTIME_H
3
4/// @file
5/// ScriptObjectRuntime, the work of an object a script moves.
6
7#include "types.h"
8#include "static_assert.h"
9
10/// A field object as its object script commands see it: the script and its
11/// place, position, motion toward a target, and the home it wanders around.
13 const s32 *script; ///< null when the object is free
14 u16 scriptCursor; ///< in words
15 /// The object's facing, 1/65536 turns: the heading SC_WANDER and
16 /// SC_WANDER_HOME wander around, and where SC_FACE_LINK stores the angle to
17 /// the linked object.
19 s32 x; ///< 16.16 fixed-point pixels
20 s32 y; ///< 16.16 fixed-point pixels
21 s32 z; ///< 16.16 fixed-point pixels
22 s32 terrainHeight; ///< 16.16 fixed-point pixels
23 u8 unk18[0x0a]; ///< the x and y scales and the radius; not named here
24 u8 terrainId; ///< the map layer its ground height is read from
25 u8 unk23; ///< FieldActor.priorityFlags; not named here
26 s32 velocityX; ///< 16.16 fixed-point pixels per frame
27 s32 velocityY; ///< 16.16 fixed-point pixels per frame
28 s32 velocityZ; ///< 16.16 fixed-point pixels per frame
29 s32 speedLimit; ///< 16.16 fixed-point pixels per frame
30 s32 acceleration; ///< 16.16 fixed-point pixels per frame, per frame
31 s32 targetX; ///< 16.16 fixed-point pixels; 0x80000000 when unset
32 s32 targetY; ///< 16.16 fixed-point pixels; 0x80000000 when unset
33 s32 targetZ; ///< 16.16 fixed-point pixels; 0x80000000 when unset
34 u8 unk44[0x0c]; ///< bounce, gravity and a spare word; not named here
35 void *animation; ///< its sprite, or its list of four, by animationKind
36 u8 animationKind; ///< low four bits: 0 no sprite, 1 one, 2 up to four
37 u8 flags; ///< FieldActor.motionFlags
38 /// The arrival axis, the last flag test and the snap flag; not named here.
39 u8 unk56[0x03];
40 /// FieldActor.collisionFlags. SC_WANDER_HOME sets bit 1 while it roams
41 /// inside its home radius and clears it on heading home.
43 u8 actionFlags; ///< FieldActor.steeringFlags
44 u8 movementState; ///< nonzero skips its script and motion (paused)
45 /// The flag that keeps its sprite's VRAM, and the object script's SC_LOOP
46 /// count; not named here.
47 u8 unk5c[0x02];
48 /// The object script's wait, in frames (ScriptMotionObject.wait). SC_WANDER
49 /// sets 1 when it turns back, to wait a frame.
51 /// Not named by TBS code through this struct: the refusal count, the
52 /// frozen flag and two bytes scene code uses.
53 void *callback;
54 /// Its home, in pixels: where it was created or placed. The bytes are
55 /// ObjectRuntime's action and footprintSide too.
56 ///@{
59 ///@}
60 /// The object SC_FACE_LINK and SC_MOVE_LINK aim at.
62 u8 unk6c[0x04]; ///< the update hook (FieldActor.update); not named here
63};
64
65STATIC_ASSERT(sizeof(struct ScriptObjectRuntime) == 0x70);
72
73#endif
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A field object as its object script commands see it: the script and its place, position,...
s32 velocityY
16.16 fixed-point pixels per frame
u8 unk56[0x03]
The arrival axis, the last flag test and the snap flag; not named here.
s16 homeX
Its home, in pixels: where it was created or placed.
u8 animationKind
low four bits: 0 no sprite, 1 one, 2 up to four
u8 movementState
nonzero skips its script and motion (paused)
struct ScriptObjectRuntime * linkedObject
The object SC_FACE_LINK and SC_MOVE_LINK aim at.
u8 flags59
FieldActor.collisionFlags.
u8 unk23
FieldActor.priorityFlags; not named here.
s32 targetZ
16.16 fixed-point pixels; 0x80000000 when unset
s32 terrainHeight
16.16 fixed-point pixels
void * callback
Not named by TBS code through this struct: the refusal count, the frozen flag and two bytes scene cod...
s32 targetX
16.16 fixed-point pixels; 0x80000000 when unset
s32 x
16.16 fixed-point pixels
s32 speedLimit
16.16 fixed-point pixels per frame
u8 unk5c[0x02]
The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.
s32 y
16.16 fixed-point pixels
u8 terrainId
the map layer its ground height is read from
u8 unk44[0x0c]
bounce, gravity and a spare word; not named here
s32 velocityZ
16.16 fixed-point pixels per frame
s32 acceleration
16.16 fixed-point pixels per frame, per frame
s32 velocityX
16.16 fixed-point pixels per frame
const s32 * script
null when the object is free
s32 z
16.16 fixed-point pixels
u8 unk6c[0x04]
the update hook (FieldActor.update); not named here
u8 flags
FieldActor.motionFlags.
void * animation
its sprite, or its list of four, by animationKind
u16 scriptValue
The object's facing, 1/65536 turns: the heading SC_WANDER and SC_WANDER_HOME wander around,...
u8 unk18[0x0a]
the x and y scales and the radius; not named here
s32 targetY
16.16 fixed-point pixels; 0x80000000 when unset
u8 actionFlags
FieldActor.steeringFlags.
u16 turnedBack
The object script's wait, in frames (ScriptMotionObject.wait).
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11