102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
control_commands.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
11#include "pcdogs/script/types.h"
12#include <math.h>
13#include <stdarg.h>
14#include <string.h>
15
16// Original pcdogs.exe: 0x404040
17// Polls a signal identifier and branches when it is absent or its type does not match. Type 0xfd accepts any matched signal type; other requested types 0x80 through 0xff cannot match because the returned event byte is sign-extended.
18void Script_OpPollSignal(struct Entity *entity, uint8_t **script_cursor_inout)
19{
20 (void)entity;
21 uint32_t branch_displacement = 0;
22 uint8_t *operand_cursor = &(*script_cursor_inout)[2];
23
24 *script_cursor_inout = operand_cursor;
25 branch_displacement = (uint32_t)(operand_cursor[-2]) << 8;
26 branch_displacement |= operand_cursor[-1];
27 *script_cursor_inout = &operand_cursor[1];
28
29 uint8_t wanted_event_type = *(uint8_t *)operand_cursor;
30
31 *script_cursor_inout = &operand_cursor[5];
32
33 char unused_operand_byte = operand_cursor[2];
34 struct Signal_QueueEntry event_buffer;
35
36 event_buffer.event_type = wanted_event_type;
37 (void)unused_operand_byte;
38
39 int16_t wanted_signal_id = (uint32_t)(operand_cursor[3]) << 8;
40
41 wanted_signal_id |= operand_cursor[4];
42 event_buffer.payload_06 = 0;
43 event_buffer.payload_04 = 0;
44 event_buffer.signal_id = wanted_signal_id;
45
46 if (!Signal_Poll(&event_buffer, 1))
47 *script_cursor_inout = &operand_cursor[branch_displacement];
48 else if (wanted_event_type != SIG_WILDCARD && (int8_t)event_buffer.event_type != wanted_event_type)
49 *script_cursor_inout = &operand_cursor[branch_displacement];
50}
51
52// Original pcdogs.exe: 0x40f720
53// Handles terminators 1 through 4, including behavior selection, forward-copy stack updates, and skipping nested prefix blocks. It ends the invocation by clearing the cursor and does not save an instruction pointer.
54void Script_OpCheckTerminator(struct Entity *entity, uint8_t **script_cursor_inout)
55{
56 int32_t terminator_opcode = 0;
57 uint8_t *current_cursor = *script_cursor_inout;
58
59 *script_cursor_inout = current_cursor;
60 terminator_opcode = (uint8_t)(current_cursor[-1]);
61
62 if (terminator_opcode - 1 > 3)
63 return;
64
65 switch (terminator_opcode)
66 {
67 case SCRIPT_TERM_END:
68 {
69 *script_cursor_inout = NULL;
70
71 break;
72 }
73
75 {
76 uint8_t *script_base_ptr = entity->script_base_ptr;
77 int32_t default_behavior_offset = (uint32_t)(script_base_ptr[4]) << 24;
78
79 default_behavior_offset |= (uint32_t)(script_base_ptr[6]) << 8;
80 default_behavior_offset |= (uint32_t)(script_base_ptr[5]) << 16;
81 default_behavior_offset |= script_base_ptr[7];
82
83 if (current_cursor != (default_behavior_offset) + script_base_ptr)
84 {
85 while (true)
86 {
87 uint8_t *nested_operand_cursor = &(*script_cursor_inout)[1];
88 char nested_opcode = *(uint8_t *)((char *)nested_operand_cursor - 1);
89
90 if (nested_opcode == SCRIPT_OP_CALL_INDIRECT)
91 {
92 uint32_t nested_block_delta = (uint32_t)(*(uint8_t *)((char *)nested_operand_cursor + 1)) << 8;
93
94 nested_block_delta |= *(uint8_t *)((char *)nested_operand_cursor + 2);
95 *script_cursor_inout = nested_block_delta + (uint8_t *)nested_operand_cursor + 3;
96 }
97 else
98 {
99 if (nested_opcode != SCRIPT_OP_SKIP_BYTES)
100 break;
101
102 uint32_t skip_block_delta = (uint32_t)(*(uint8_t *)nested_operand_cursor) << 8;
103
104 skip_block_delta |= *(uint8_t *)((char *)nested_operand_cursor + 1);
105 *script_cursor_inout = skip_block_delta + (uint8_t *)nested_operand_cursor + 2;
106 }
107 }
108 }
109 else
110 {
112 {
113 int32_t entry_offset = (uint32_t)(*(uint8_t *)script_base_ptr) << 24;
114
115 entry_offset |= (uint32_t)(script_base_ptr[2]) << 8;
116 entry_offset |= (uint32_t)(script_base_ptr[1]) << 16;
117 entry_offset |= script_base_ptr[3];
118
119 if ((entry_offset) != 8)
120 {
121 if (!entity->behavior_index)
122 entity->behavior_index = 1;
123
124 int32_t behavior_index = (uint8_t)(entity->behavior_index);
125
126 *script_cursor_inout = &script_base_ptr[(behavior_index << 2) + 4];
127
128 int32_t behavior_offset = (uint32_t)(script_base_ptr[behavior_index << 2]) << 24;
129
130 behavior_offset |= (uint32_t)(script_base_ptr[(behavior_index << 2) + 2]) << 8;
131 behavior_offset |= (uint32_t)(script_base_ptr[(behavior_index << 2) + 1]) << 16;
132 behavior_offset |= script_base_ptr[(behavior_index << 2) + 3];
133 *script_cursor_inout =
134 (behavior_offset) + entity->script_base_ptr;
135
136 return;
137 }
138 }
139
140 *script_cursor_inout = NULL;
141 }
142
143 break;
144 }
145
147 {
148 entity->behavior_stack[1] = entity->behavior_stack[0];
149 entity->behavior_stack[2] = entity->behavior_stack[1];
151 *script_cursor_inout = NULL;
152
153 break;
154 }
155
157 {
158 entity->behavior_index = entity->behavior_stack[0];
159 entity->behavior_stack[0] = entity->behavior_stack[1];
160 entity->behavior_stack[1] = entity->behavior_stack[2];
161 entity->behavior_stack[2] = 0;
162 *script_cursor_inout = NULL;
163
164 break;
165 }
166 }
167}
168
169// Original pcdogs.exe: 0x40f8b0
170// Branches when the decoded selector differs from the entity's behavior index, treating index zero as one. Selector 0xff continues without testing.
171void Script_OpJumpConditional(struct Entity *entity, uint8_t **script_cursor_inout)
172{
173 int32_t selector_value = 0; /* Only the decoded selector byte is live. */
174 uint32_t branch_delta = 0;
175 // Read 2-byte jump offset and 1-byte room condition from bytecode
176 uint8_t *operand_cursor = &(*script_cursor_inout)[2];
177
178 *script_cursor_inout = operand_cursor;
179 branch_delta = (uint32_t)(operand_cursor[-2]) << 8;
180 branch_delta |= operand_cursor[-1];
181 *script_cursor_inout = &operand_cursor[1];
182
183 uint8_t selector_byte = *operand_cursor;
184
185 selector_value = (uint8_t)(selector_byte);
186
187 // Room 0xFF = always continue, otherwise check actor room at +0x140
188 if (selector_byte == SCRIPT_BEHAVIOR_ANY)
189 return;
190
191 uint8_t behavior_index = entity->behavior_index;
192 // Room mismatch: jump by signed offset
193 uint32_t effective_behavior_index;
194
195 effective_behavior_index = !behavior_index ? 1 : (uint32_t)behavior_index;
196
197 if ((uint32_t)(uint8_t)selector_value != effective_behavior_index)
198 *script_cursor_inout = &operand_cursor[branch_delta];
199}
200
201// Original pcdogs.exe: 0x40f9d0
202// Resolves script operands, optionally combines them arithmetically, and conditionally installs the relative branch target. Comparison and arithmetic selectors follow the encoded unsigned operations and existing zero-divisor handling.
203void Script_OpBranchConditional(struct Entity *entity, uint8_t **script_cursor_inout)
204{
205 uint8_t **cursor_inout = script_cursor_inout;
206 int32_t *resolved_storage;
207 int32_t **value_storage_inout = &resolved_storage;
208 uint32_t branch_delta = 0;
209 uint8_t *operand_cursor = (*cursor_inout + 2);
210
211 *cursor_inout = (operand_cursor);
212 branch_delta = (uint32_t)(operand_cursor[-2]) << 8;
213 branch_delta |= operand_cursor[-1];
214
215 uint8_t *fail_target = &operand_cursor[branch_delta];
216
217 *cursor_inout = (&operand_cursor[1]);
218
219 char reference_or_arithmetic_opcode = *(uint8_t *)operand_cursor;
220
221 *cursor_inout = (&operand_cursor[2]);
222
223 char lhs_ref_id = reference_or_arithmetic_opcode;
224 uint8_t compare_opcode = operand_cursor[1];
225
226 *cursor_inout = (&operand_cursor[3]);
227
228 uint8_t rhs_reference_id = operand_cursor[2];
229
230 resolved_storage = (int32_t *)(((uintptr_t)script_cursor_inout & ~UINT32_C(0xff)) | rhs_reference_id);
231 *cursor_inout = (&operand_cursor[4]);
232 reference_or_arithmetic_opcode = operand_cursor[3];
233 *cursor_inout = (&operand_cursor[8]);
234
235 /* Native 0x40fa20..0x40fa32 reads all four bytes even for comparison 6. */
236 int32_t rhs = (uint32_t)(((const volatile uint8_t *)operand_cursor)[4]) << 24;
237
238 rhs |= (uint32_t)(((const volatile uint8_t *)operand_cursor)[5]) << 16;
239 rhs |= (uint32_t)(((const volatile uint8_t *)operand_cursor)[6]) << 8;
240 rhs |= ((const volatile uint8_t *)operand_cursor)[7];
241
242 int32_t rhs_encoded = rhs;
243
244 if (compare_opcode == SCRIPT_CMP_ALWAYS_CONTINUE)
245 return;
246
247 uint32_t rhs_value;
248
249 if (rhs_reference_id == (int32_t)SCRIPT_VALUE_IMMEDIATE_U24)
250 rhs_value = (uint32_t)rhs_encoded >> 8;
251 else if (rhs_reference_id == (int32_t)SCRIPT_VALUE_RANDOM_MOD_U24)
252 rhs_value = Math_GenerateRandom(((uint32_t)rhs_encoded >> 8) + 1);
253 else if (rhs_reference_id == (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P0 || rhs_reference_id == (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P1)
254 rhs_value = Input_CheckButtonState(rhs_reference_id - (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P0,
255 (const struct Input_State *)(uintptr_t)&g_inputStateCurrentP1, rhs_encoded & SCRIPT_VALUE_BYTE_MASK, 0xffffffff);
256 else
257 {
258 uint32_t lhs_value = Script_ResolveVariableRef(entity, value_storage_inout,
259 rhs_reference_id);
260
261 if ((uint8_t)rhs_encoded != (int32_t)SCRIPT_VALUE_IMMEDIATE_U24)
262 {
263 int32_t rhs_value_1;
264
265 if ((uint8_t)rhs_encoded != (int32_t)SCRIPT_VALUE_RANDOM_MOD_U24)
266 rhs_value_1 =
267 Script_ResolveVariableRef(entity, value_storage_inout, rhs_encoded & SCRIPT_VALUE_BYTE_MASK);
268 else
269 rhs_value_1 = Math_GenerateRandom(((uint32_t)rhs_encoded >> 8) + 1);
270
271 rhs_value = rhs_value_1;
272 }
273 else
274 rhs_value = (uint32_t)rhs_encoded >> 8;
275
276 switch ((uint32_t)reference_or_arithmetic_opcode)
277 {
278 case SCRIPT_ARITH_ADD:
279 {
280 rhs_value += lhs_value;
281
282 break;
283 }
284
286 {
287 rhs_value = rhs_value < lhs_value ? lhs_value - rhs_value : 0;
288
289 break;
290 }
291
292 case SCRIPT_ARITH_MUL:
293 {
294 rhs_value *= lhs_value;
295
296 break;
297 }
298
299 case SCRIPT_ARITH_DIV:
300 {
301 if (rhs_value)
302 rhs_value = (uint32_t)lhs_value / rhs_value;
303
304 break;
305 }
306 }
307 }
308
309 uint32_t lhs_value_final =
310 Script_ResolveVariableRef(entity, value_storage_inout, lhs_ref_id & SCRIPT_VALUE_BYTE_MASK);
311 uint32_t compare_opcode_1 = (uint32_t)compare_opcode;
312
313 if (compare_opcode_1 > SCRIPT_CMP_NE)
314 {
315 *cursor_inout = (fail_target);
316
317 return;
318 }
319
320 switch (compare_opcode_1)
321 {
322 case SCRIPT_CMP_LT:
323 {
324 if (lhs_value_final >= rhs_value)
325 *cursor_inout = (fail_target);
326
327 break;
328 }
329
330 case SCRIPT_CMP_LE:
331 {
332 if (lhs_value_final > rhs_value)
333 *cursor_inout = (fail_target);
334
335 break;
336 }
337
338 case SCRIPT_CMP_EQ:
339 {
340 if (lhs_value_final != rhs_value)
341 *cursor_inout = (fail_target);
342
343 break;
344 }
345
346 case SCRIPT_CMP_GE:
347 {
348 if (lhs_value_final < rhs_value)
349 *cursor_inout = (fail_target);
350
351 break;
352 }
353
354 case SCRIPT_CMP_GT:
355 {
356 if (lhs_value_final <= rhs_value)
357 *cursor_inout = (fail_target);
358
359 break;
360 }
361
362 case SCRIPT_CMP_NE:
363 {
364 if (lhs_value_final == rhs_value)
365 *cursor_inout = (fail_target);
366
367 break;
368 }
369 }
370}
371
372// Original pcdogs.exe: 0x40fbf0
373// Assigns immediate, random, input, or combined variable values to resolved script storage. Subtraction clamps at zero, division by zero leaves the destination unchanged, and addition and multiplication wrap to 32 bits.
374void Script_OpSetVariable(struct Entity *entity, uint8_t **script_cursor_inout)
375{
376 const uint8_t *operands = *script_cursor_inout;
377 uint8_t destination_ref = operands[0], source_ref = operands[1], operation = operands[2];
378 uint32_t encoded = ((uint32_t)operands[3] << 24) | ((uint32_t)operands[4] << 16) | ((uint32_t)operands[5] << 8) | operands[6];
379 // Native resolver slots reuse the arguments; only the destination slot's low byte changes.
380 // Special references may retain these pointers instead of selecting new storage.
381 int32_t *destination = (int32_t *)(((uintptr_t)script_cursor_inout & ~(uintptr_t)SCRIPT_VALUE_BYTE_MASK) | destination_ref);
382 int32_t *source = (int32_t *)entity;
383
384 *script_cursor_inout += 7;
385
386 Script_ResolveVariableRef(entity, &destination, destination_ref);
387
388 if (source_ref == (int32_t)SCRIPT_VALUE_IMMEDIATE_U24)
389 {
390 *destination = encoded >> 8;
391
392 return;
393 }
394
395 if (source_ref == (int32_t)SCRIPT_VALUE_RANDOM_MOD_U24)
396 {
397 *destination = Math_GenerateRandom((encoded >> 8) + 1);
398
399 return;
400 }
401
402 if (source_ref == (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P0 || source_ref == (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P1)
403 {
404 *destination = Input_CheckButtonState(source_ref - (int32_t)SCRIPT_VALUE_INPUT_BUTTON_P0, g_inputStateCurrentP1, encoded & SCRIPT_VALUE_BYTE_MASK, -1);
405
406 return;
407 }
408
409 uint32_t left = Script_ResolveVariableRef(entity, &source, source_ref), right;
410
411 if ((uint8_t)encoded == (int32_t)SCRIPT_VALUE_IMMEDIATE_U24)
412 right = encoded >> 8;
413 else if ((uint8_t)encoded == (int32_t)SCRIPT_VALUE_RANDOM_MOD_U24)
414 right = Math_GenerateRandom((encoded >> 8) + 1);
415 else
416 right = Script_ResolveVariableRef(entity, &source, encoded & SCRIPT_VALUE_BYTE_MASK);
417
418 switch (operation)
419 {
420 case SCRIPT_ARITH_ADD: *destination = left + right; break;
421 case SCRIPT_ARITH_SUB_CLAMP_ZERO: *destination = right < left ? left - right : 0; break;
422 case SCRIPT_ARITH_MUL: *destination = left * right; break;
423 case SCRIPT_ARITH_DIV:
424 if (right)
425 *destination = left / right;
426
427 break;
428 }
429}
430
431// Original pcdogs.exe: 0x40fdb0
432// Consumes a variable reference and increments its resolved 32-bit value with wraparound.
433void Script_OpIncrementVariable(struct Entity *entity, uint8_t **script_cursor_inout)
434{
435 uint8_t **cursor_inout = script_cursor_inout;
436 uint8_t *operand_cursor = (*cursor_inout + 1);
437
438 *cursor_inout = (operand_cursor);
439
440 int32_t ref_id = (uint8_t)(operand_cursor[-1]);
441 int32_t *resolved_storage = (int32_t *)script_cursor_inout;
442 int32_t **value_storage_inout = &resolved_storage;
443
444 Script_ResolveVariableRef(entity, value_storage_inout, ref_id);
445
446 int32_t *value_storage = *value_storage_inout;
447
448 *(uint32_t *)value_storage += 1;
449}
450
451// Original pcdogs.exe: 0x40fde0
452// Consumes a variable reference and decrements its resolved value only when it is nonzero, including negative values.
453void Script_OpDecrementVariable(struct Entity *entity, uint8_t **script_cursor_inout)
454{
455 uint8_t **cursor_inout = script_cursor_inout;
456 uint8_t *operand_cursor = (*cursor_inout + 1);
457
458 *cursor_inout = operand_cursor;
459
460 int32_t ref_id = (uint8_t)(operand_cursor[-1]);
461 int32_t *resolved_storage = (int32_t *)script_cursor_inout;
462 int32_t **value_storage_inout = &resolved_storage;
463
464 Script_ResolveVariableRef(entity, value_storage_inout, ref_id);
465
466 int32_t *value_storage = *value_storage_inout;
467 int32_t current_value = *(uint32_t *)value_storage;
468
469 if (current_value)
470 *(uint32_t *)value_storage = current_value - 1;
471}
472
473// Original pcdogs.exe: 0x40fe20
474// Consumes a nested opcode and dispatches it through the actor opcode table. The byte is not bounds checked and slot zero is null, so bytecode must supply a valid callable entry.
475void Script_OpCallIndirect(struct Entity *entity, uint8_t **script_cursor_inout)
476{
477 uint8_t *operand_cursor = (*script_cursor_inout + 1);
478
479 *script_cursor_inout = (operand_cursor);
480
481 enum ScriptActorOpcode nested_opcode = SCRIPT_OP_NULL;
482
483 nested_opcode = (uint8_t)(operand_cursor[-1]);
484
485 Script_ActorOpcodeDispatchTable[nested_opcode](entity, script_cursor_inout);
486}
487
488// Original pcdogs.exe: 0x40fe50
489// Advances the script cursor by two bytes without reading their contents.
490void Script_OpSkipBytes(struct Entity *entity, uint8_t **script_cursor_inout)
491{
492 (void)entity;
493 *script_cursor_inout = ((*script_cursor_inout + 2));
494}
495
496// Original pcdogs.exe: 0x410ca0
497// Decodes a signal identifier and type and appends it with payload_06 set to 5. Types 3 through 7 resolve the value stored in payload_04; other types consume the same operand bytes and emit zero in that field.
498void Script_OpEmitSignal(struct Entity *entity, uint8_t **script_cursor_inout)
499{
500 int16_t signal_id = 0;
501 uint8_t *operand_cursor = (*script_cursor_inout + 1);
502
503 *script_cursor_inout = operand_cursor;
504
505 char signal_type = operand_cursor[-1];
506
507 *script_cursor_inout = &operand_cursor[2];
508 signal_id = (uint32_t)(*(uint8_t *)operand_cursor) << 8;
509 signal_id |= operand_cursor[1];
510
511 if (signal_type < SIG_PLAY_ANIM_FWD || signal_type > SIG_SET_ANIM_SPEED)
512 {
513 *script_cursor_inout = &operand_cursor[6];
515
516 return;
517 }
518
519 *script_cursor_inout = &operand_cursor[6];
520
521 int32_t payload = (uint32_t)(operand_cursor[2]) << 24;
522
523 payload |= (uint32_t)(operand_cursor[4]) << 8;
524 payload |= (uint32_t)(operand_cursor[3]) << 16;
525 payload |= operand_cursor[5];
526
527 uint32_t value_encoded = payload;
528 uint16_t signal_value;
529
530 if ((uint8_t)value_encoded == (int32_t)SCRIPT_VALUE_IMMEDIATE_U24)
531 signal_value = (int16_t)(value_encoded >> 8);
532 else if ((uint8_t)value_encoded != (int32_t)SCRIPT_VALUE_RANDOM_MOD_U24)
533 {
534 int32_t **value_storage_inout = (int32_t **)(&entity);
535
536 signal_value = Script_ResolveVariableRef(entity, value_storage_inout, value_encoded & SCRIPT_VALUE_BYTE_MASK);
537 }
538 else
539 signal_value = Math_GenerateRandom((value_encoded >> 8) + 1);
540
541 Signal_Emit(signal_id, signal_type, SCRIPT_DEFAULT_SIGNAL_PAYLOAD, signal_value);
542}
void Script_OpBranchConditional(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpEmitSignal(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpDecrementVariable(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpCheckTerminator(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpSetVariable(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpJumpConditional(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpPollSignal(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpCallIndirect(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpIncrementVariable(struct Entity *entity, uint8_t **script_cursor_inout)
void Script_OpSkipBytes(struct Entity *entity, uint8_t **script_cursor_inout)
#define ENTITY_FLAG_ACTIVATION_REQUEST
Definition constants.h:17
int32_t Input_CheckButtonState(int32_t state_index, struct Input_State const *state_table, int32_t control_code, int32_t mode_or_threshold)
Definition state.c:27
#define g_inputStateCurrentP1
Definition globals.h:72
uint32_t Math_GenerateRandom(uint32_t range)
#define SCRIPT_VALUE_BYTE_MASK
Definition constants.h:17
#define SCRIPT_DEFAULT_SIGNAL_PAYLOAD
Definition constants.h:19
@ SCRIPT_CMP_ALWAYS_CONTINUE
Definition constants.h:29
@ SCRIPT_BEHAVIOR_ANY
Definition constants.h:102
ScriptActorOpcode
Definition enums.h:149
@ SCRIPT_OP_NULL
Definition enums.h:152
@ SCRIPT_OP_CALL_INDIRECT
Definition enums.h:170
@ SCRIPT_OP_SKIP_BYTES
Definition enums.h:173
@ SCRIPT_ARITH_SUB_CLAMP_ZERO
Definition enums.h:297
@ SCRIPT_ARITH_DIV
Definition enums.h:303
@ SCRIPT_ARITH_MUL
Definition enums.h:300
@ SCRIPT_ARITH_ADD
Definition enums.h:294
@ SCRIPT_VALUE_INPUT_BUTTON_P0
Definition enums.h:338
@ SCRIPT_VALUE_INPUT_BUTTON_P1
Definition enums.h:341
@ SCRIPT_VALUE_IMMEDIATE_U24
Definition enums.h:344
@ SCRIPT_VALUE_RANDOM_MOD_U24
Definition enums.h:347
@ SIG_SET_ANIM_SPEED
Definition enums.h:397
@ SIG_WILDCARD
Definition enums.h:412
@ SCRIPT_CMP_LT
Definition enums.h:313
@ SCRIPT_CMP_NE
Definition enums.h:328
@ SCRIPT_CMP_GE
Definition enums.h:322
@ SCRIPT_CMP_LE
Definition enums.h:316
@ SCRIPT_CMP_GT
Definition enums.h:325
@ SCRIPT_CMP_EQ
Definition enums.h:319
@ SCRIPT_TERM_SKIP_NESTED_BLOCK
Definition enums.h:360
@ SCRIPT_TERM_POP_ENTITY_SLOT
Definition enums.h:366
@ SCRIPT_TERM_END
Definition enums.h:357
@ SCRIPT_TERM_PUSH_ENTITY_SLOT
Definition enums.h:363
uint8_t Signal_Poll(struct Signal_QueueEntry *event_buffer, int32_t max_events)
Definition signals.c:37
void Signal_Emit(int16_t signal_id, uint8_t event_type, int16_t payload_06, int16_t payload_04)
Definition signals.c:14
int32_t Script_ResolveVariableRef(struct Entity *entity, int32_t **value_storage_inout, int32_t ref_id)
Definition interpreter.c:16
#define Script_ActorOpcodeDispatchTable
Definition globals.h:20
#define g_scriptEntityIndex
Definition globals.h:35
Definition types.h:22
uint8_t flags_high_byte
Definition types.h:30
uint8_t behavior_index
Definition types.h:110
uint8_t * script_base_ptr
Definition types.h:45
uint8_t behavior_stack[0x3]
Definition types.h:111
int16_t signal_id
Definition types.h:60
int16_t payload_04
Definition types.h:63
uint8_t event_type
Definition types.h:61
int16_t payload_06
Definition types.h:64