Alchemy
Loading...
Searching...
No Matches

objcmd.h

Go to the documentation of this file.
1#ifndef ALCHEMY_OBJCMD_H
2#define ALCHEMY_OBJCMD_H
3
4/// @file
5/// Field object scripts: one s32 command word, then its operands, as
6/// gScriptObject_CommandTable runs them. Each macro expands to the words of
7/// one command. Coordinates are 16.16 fixed point (PIXELS).
8
9#include "types.h"
10
11#define SC_LABEL(n) (s32)(0x80000000 | (n) << 16) ///< Branch destination
12#define SC_TO(n) (s32)(0xc0000000 | (n) << 16)
13#define SC_TOP 0 ///< Script start
14#define SC_FOREVER 0xffff
15
16#define SC_WAIT(n) 0x00, (n) ///< Wait n frames.
17#define SC_SYNC 0x01 ///< Wait for arrival.
18#define SC_POS(x, y, z) 0x02, (x), (y), (z) ///< Set position.
19#define SC_MOVE(x, y, z) 0x03, (x), (y), (z) ///< Move toward the target.
20#define SC_MOVE_BY(x, y, z) 0x04, (x), (y), (z) ///< Move by a relative offset.
21#define SC_FACE_LINK 0x05 ///< Face the linked object.
22#define SC_MOVE_LINK 0x06 ///< Move to the linked object.
23#define SC_MOVE_LOCAL(a, b) 0x07, (a), (b)
24#define SC_WANDER(a, b, c) 0x08, (a), (b), (c) ///< Wander.
25#define SC_WANDER_HOME(a, b, c) 0x09, (a), (b), (c)
26#define SC_APPROACH_LINK 0x0a
27#define SC_CAMERA 0x0b ///< Follow the leader.
28#define SC_LOOP(n, to) 0x0c, (n), (to) ///< Repeat up to n times.
29#define SC_JUMP(to) 0x0d, (to)
30#define SC_IF(to) 0x0e, (to) ///< Branch if the result is true.
31#define SC_IFNOT(to) 0x0f, (to) ///< Branch if the result is false.
32#define SC_END 0x10 ///< Return to the main script.
33#define SC_FLAG_CHECK(f) 0x11, (f)
34#define SC_FLAG_ON(f) 0x12, (f)
35#define SC_FLAG_OFF(f) 0x13, (f)
36#define SC_FLAG_REV(f) 0x14, (f)
37#define SC_SET(w, v) 0x15, (w), (v) ///< Write a work value.
38#define SC_ADD(w, v) 0x16, (w), (v)
39#define SC_CMP(w, v) 0x17, (w), (v)
40#define SC_PLAYER 0x18 ///< Player input control
41#define SC_KEYS 0x19
42#define SC_WORLD 0x1a ///< World map control
43#define SC_FREE 0x1b ///< Release
44#define SC_ARG(v) 0x1c, (v)
45#define SC_NOP(v) 0x1d, (v)
46#define SC_SE(n) 0x1e, (n) ///< Sound effect
47#define SC_BASE 0x1f ///< Restart from the next word.
48#define SC_B54_OFF 0x20
49#define SC_B54_ON 0x21
50#define SC_CALL(fn) 0x22, (s32)(fn)
51#define SC_KEY_COUNT 0x23
52
53/// Script work values for SC_SET, SC_ADD and SC_CMP
55 SW_SCRIPT = 0x00,
56 SW_CURSOR = 0x01,
57 SW_FACING = 0x03,
58 SW_X = 0x05,
59 SW_Y = 0x06,
60 SW_Z = 0x07,
61 SW_RADIUS = 0x08,
62 SW_SCALE_X = 0x09,
63 SW_SCALE_Y = 0x0a,
67 SW_SPEED = 0x0f,
68 SW_ACCEL = 0x10,
72 SW_BOUNCE = 0x14,
73 SW_GRAVITY = 0x15,
74 SW_GROUND = 0x16,
75 SW_MOTION = 0x1a,
76 SW_ARRIVAL = 0x1b,
77 SW_RESULT = 0x1c,
78 SW_SNAP = 0x1d,
81 SW_PAUSED = 0x20,
82 SW_REPEAT = 0x21,
83 SW_WAIT = 0x22,
84 SW_HOOK = 0x26
85};
86
87#endif
ScriptWork
Script work values for SC_SET, SC_ADD and SC_CMP.
Definition objcmd.h:54
@ SW_PAUSED
Definition objcmd.h:81
@ SW_VELOCITY_X
Definition objcmd.h:64
@ SW_TARGET_Y
Definition objcmd.h:70
@ SW_TARGET_Z
Definition objcmd.h:71
@ SW_VELOCITY_Z
Definition objcmd.h:66
@ SW_ACCEL
Definition objcmd.h:68
@ SW_TARGET_X
Definition objcmd.h:69
@ SW_BOUNCE
Definition objcmd.h:72
@ SW_ARRIVAL
Definition objcmd.h:76
@ SW_SCALE_Y
Definition objcmd.h:63
@ SW_COLLISION
Definition objcmd.h:79
@ SW_REPEAT
Definition objcmd.h:82
@ SW_WAIT
Definition objcmd.h:83
@ SW_RESULT
Definition objcmd.h:77
@ SW_SNAP
Definition objcmd.h:78
@ SW_SPEED
Definition objcmd.h:67
@ SW_Z
Definition objcmd.h:60
@ SW_MOTION
Definition objcmd.h:75
@ SW_CURSOR
Definition objcmd.h:56
@ SW_GRAVITY
Definition objcmd.h:73
@ SW_STEERING
Definition objcmd.h:80
@ SW_FACING
Definition objcmd.h:57
@ SW_X
Definition objcmd.h:58
@ SW_Y
Definition objcmd.h:59
@ SW_SCALE_X
Definition objcmd.h:62
@ SW_VELOCITY_Y
Definition objcmd.h:65
@ SW_SCRIPT
Definition objcmd.h:55
@ SW_RADIUS
Definition objcmd.h:61
@ SW_GROUND
Definition objcmd.h:74
@ SW_HOOK
Definition objcmd.h:84
The integer types, TRUE, UNUSED and the fixed-address macros.