NXEngine v1.0.0.6
[NXEngine.git] / tsc.h
blobf465dc2d4df6500a09e62bb9152b6abaf59309f6
2 #ifndef _TSC_H
3 #define _TSC_H
5 // TSC running script instance; there is only ever one running at once
6 // but I generalized it as if there might be more just for good style.
7 struct ScriptInstance
9 const uint8_t *program; // compiled script code
10 uint32_t ip; // instruction pointer
11 bool running;
13 int scriptno; // script # of active script
14 int pageno; // ScriptPage/namespace # script is in
16 int delaytimer; // time left on a <WAI delay
18 // used with <NOD
19 bool waitforkey;
20 bool lastjump, lastfire;
21 int nod_delay;
23 int ynj_jump; // if != -1, a Yes/No choice is up, and this is the event # to jump to if they pick No.
25 bool wait_standing; // if 1 pauses script until player touches ground
28 // script "pages", like namespaces, for the different tsc files
29 enum ScriptPages
31 SP_HEAD, // head.tsc common scripts
32 SP_MAP, // map scripts
33 SP_ARMSITEM, // inventory screen
34 SP_STAGESELECT, // scripts for Arthur's House teleporter
36 NUM_SCRIPT_PAGES
39 ScriptInstance *StartScript(int scriptno, int pageno=SP_MAP);
40 void StopScript(ScriptInstance *s);
41 bool JumpScript(int newscriptno, int pageno=-1);
44 // globally-accessible scripts in head.tsc
45 #define SCRIPT_NULL 0
46 #define SCRIPT_EMPTY 1 // displays a textbox that says "Empty."
47 #define SCRIPT_SAVE 16 // save-game script
48 #define SCRIPT_REFILL 17 // health refill script
49 #define SCRIPT_REST 19 // "Do you want to rest?"
50 #define SCRIPT_MISSILE_LAUNCHER 30 // spiel about missile launcher when you first get it
51 #define SCRIPT_DIED 40 // "You have died. Would you like to retry?"
52 #define SCRIPT_DROWNED 41 // "You have drowned. Would you like to retry?"
53 #define SCRIPT_NEVERSEENAGAIN 42 // "You were never seen again. Would you like to retry?"
56 #define OP_AEPLUS 0 // 0, 0,
57 #define OP_AMPLUS 1 // 2, 0,
58 #define OP_AMMINUS 2 // 1, 0,
59 #define OP_AMJ 3 // 2, 0,
60 #define OP_ANP 4 // 3, 0,
61 #define OP_BOA 5 // 1, 0,
62 #define OP_BSL 6 // 1, 0,
63 #define OP_CAT 7 // 0, 0,
64 #define OP_CIL 8 // 0, 0,
65 #define OP_CLO 9 // 0, 0,
66 #define OP_CLR 10 // 0, 0,
67 #define OP_CMP 11 // 3, 0,
68 #define OP_CMU 12 // 1, 0,
69 #define OP_CNP 13 // 3, 0,
70 #define OP_CPS 14 // 0, 0,
71 #define OP_CRE 15 // 0, 0,
72 #define OP_CSS 16 // 0, 0,
73 #define OP_DNA 17 // 1, 0,
74 #define OP_DNP 18 // 1, 0,
75 #define OP_ECJ 19 // 2, 0,
76 #define OP_END 20 // 0, 0,
77 #define OP_EQPLUS 21 // 1, 0,
78 #define OP_EQMINUS 22 // 1, 0,
79 #define OP_ESC 23 // 0, 0,
80 #define OP_EVE 24 // 1, 0,
81 #define OP_FAC 25 // 1, 0,
82 #define OP_FAI 26 // 1, 0,
83 #define OP_FAO 27 // 1, 0,
84 #define OP_FLPLUS 28 // 1, 0,
85 #define OP_FLMINUS 29 // 1, 0,
86 #define OP_FLA 30 // 0, 0,
87 #define OP_FLJ 31 // 2, 0,
88 #define OP_FMU 32 // 0, 0,
89 #define OP_FOB 33 // 2, 0,
90 #define OP_FOM 34 // 1, 0,
91 #define OP_FON 35 // 2, 0,
92 #define OP_FRE 36 // 0, 0,
93 #define OP_GIT 37 // 1, 0,
94 #define OP_HMC 38 // 0, 0,
95 #define OP_INI 39 // 0, 0,
96 #define OP_INP 40 // 3, 0,
97 #define OP_ITPLUS 41 // 1, 0,
98 #define OP_ITMINUS 42 // 1, 0,
99 #define OP_ITJ 43 // 2, 0,
100 #define OP_KEY 44 // 0, 0,
101 #define OP_LDP 45 // 0, 0,
102 #define OP_LIPLUS 46 // 1, 0,
103 #define OP_MLPLUS 47 // 1, 0,
104 #define OP_MLP 48 // 0, 0,
105 #define OP_MM0 49 // 0, 0,
106 #define OP_MNA 50 // 0, 0,
107 #define OP_MNP 51 // 4, 0,
108 #define OP_MOV 52 // 2, 0,
109 #define OP_MPPLUS 53 // 1, 0,
110 #define OP_MPJ 54 // 1, 0,
111 #define OP_MS2 55 // 0, 0,
112 #define OP_MS3 56 // 0, 0,
113 #define OP_MSG 57 // 0, 0,
114 #define OP_MYB 58 // 1, 0,
115 #define OP_MYD 59 // 1, 0,
116 #define OP_NCJ 60 // 2, 0,
117 #define OP_NOD 61 // 0, 0,
118 #define OP_NUM 62 // 1, 0,
119 #define OP_PRI 63 // 0, 0,
120 #define OP_PSPLUS 64 // 2, 0,
121 #define OP_QUA 65 // 1, 0,
122 #define OP_RMU 66 // 0, 0,
123 #define OP_SAT 67 // 0, 0,
124 #define OP_SIL 68 // 1, 0,
125 #define OP_SKPLUS 69 // 1, 0,
126 #define OP_SKMINUS 70 // 1, 0,
127 #define OP_SKJ 71 // 2, 0,
128 #define OP_SLP 72 // 0, 0,
129 #define OP_SMC 73 // 0, 0,
130 #define OP_SMP 74 // 2, 0,
131 #define OP_SNP 75 // 4, 0,
132 #define OP_SOU 76 // 1, 0,
133 #define OP_SPS 77 // 0, 0,
134 #define OP_SSS 78 // 1, 0,
135 #define OP_STC 79 // 0, 0,
136 #define OP_SVP 80 // 0, 0,
137 #define OP_TAM 81 // 3, 0,
138 #define OP_TRA 82 // 4, 0,
139 #define OP_TUR 83 // 0, 0,
140 #define OP_UNI 84 // 1, 0,
141 #define OP_UNJ 85 // 1, 0,
142 #define OP_WAI 86 // 1, 0,
143 #define OP_WAS 87 // 0, 0,
144 #define OP_XX1 88 // 1, 0,
145 #define OP_YNJ 89 // 1, 0,
146 #define OP_ZAM 90 // 0, 0
148 #define OP_COUNT 91
151 #define OP_TEXT 0xfa // mine, denotes start of text
153 int CVTDir(int csdir);
155 #endif