Debian Codegraph @

scripts/Geodomes.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /////////////////////////////////////////////////////////////////////
20 // D.A.L.L.A.S. Generated Level Script - DLL Source File
21 //
22 // Filename: Geodomes.cpp
23 // Version: 3
24 /////////////////////////////////////////////////////////////////////
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <ctype.h>
29 #include "osiris_import.h"
30 #include "osiris_common.h"
31 #include "DallasFuncs.cpp"
32
33 #include "module.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 DLLEXPORT char STDCALL InitializeDLL(tOSIRISModuleInit *func_list);
39 DLLEXPORT void STDCALL ShutdownDLL(void);
40 DLLEXPORT int STDCALL GetGOScriptID(const char *name, uint8_t is_door);
41 DLLEXPORT void STDCALLPTR CreateInstance(int id);
42 DLLEXPORT void STDCALL DestroyInstance(int id, void *ptr);
43 DLLEXPORT int16_t STDCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data);
44 DLLEXPORT int STDCALL GetTriggerScriptID(int trigger_room, int trigger_face);
45 DLLEXPORT int STDCALL GetCOScriptList(int **list, int **id_list);
46 DLLEXPORT int STDCALL SaveRestoreState(void *file_ptr, uint8_t saving_state);
47 #ifdef __cplusplus
48 }
49 #endif
50
51 // =================
52 // Script ID Numbers
53 // =================
54 #define ID_LEVEL_0000 0x000
55
56 #define ID_CUSTOM_OBJECT_1081 0x001
57 #define ID_CUSTOM_OBJECT_1080 0x002
58 #define ID_CUSTOM_OBJECT_107A 0x003
59 #define ID_CUSTOM_OBJECT_107B 0x004
60
61 // ========================
62 // Script Class Definitions
63 // ========================
64
65 class BaseScript {
66 public:
67 BaseScript();
68 ~BaseScript();
69 virtual int16_t CallEvent(int event, tOSIRISEventInfo *data);
70 };
71
72 class LevelScript_0000 : public BaseScript {
73 public:
74 int16_t CallEvent(int event, tOSIRISEventInfo *data);
75 };
76
77 class CustomObjectScript_1081 : public BaseScript {
78 public:
79 int16_t CallEvent(int event, tOSIRISEventInfo *data);
80 };
81
82 class CustomObjectScript_1080 : public BaseScript {
83 public:
84 int16_t CallEvent(int event, tOSIRISEventInfo *data);
85 };
86
87 class CustomObjectScript_107A : public BaseScript {
88 public:
89 int16_t CallEvent(int event, tOSIRISEventInfo *data);
90 };
91
92 class CustomObjectScript_107B : public BaseScript {
93 public:
94 int16_t CallEvent(int event, tOSIRISEventInfo *data);
95 };
96
97 // ======================
98 // Global Action Counters
99 // ======================
100
101 #define MAX_ACTION_CTR_VALUE 100000
102
103 int ScriptActionCtr_000 = 0;
104 int ScriptActionCtr_001 = 0;
105 int ScriptActionCtr_005 = 0;
106 int ScriptActionCtr_004 = 0;
107 int ScriptActionCtr_003 = 0;
108 int ScriptActionCtr_002 = 0;
109
110 // ========================================
111 // Function to Clear Global Action Counters
112 // ========================================
113 void ClearGlobalActionCtrs(void) {
114 ScriptActionCtr_000 = 0;
115 ScriptActionCtr_001 = 0;
116 ScriptActionCtr_005 = 0;
117 ScriptActionCtr_004 = 0;
118 ScriptActionCtr_003 = 0;
119 ScriptActionCtr_002 = 0;
120 }
121
122 // ========================================
123 // Function to Save Global Action Counters
124 // ========================================
125 void SaveGlobalActionCtrs(void *file_ptr) {
126 File_WriteInt(ScriptActionCtr_000, file_ptr);
127 File_WriteInt(ScriptActionCtr_001, file_ptr);
128 File_WriteInt(ScriptActionCtr_005, file_ptr);
129 File_WriteInt(ScriptActionCtr_004, file_ptr);
130 File_WriteInt(ScriptActionCtr_003, file_ptr);
131 File_WriteInt(ScriptActionCtr_002, file_ptr);
132 }
133
134 // ===========================================
135 // Function to Restore Global Action Counters
136 // ===========================================
137 void RestoreGlobalActionCtrs(void *file_ptr) {
138 ScriptActionCtr_000 = File_ReadInt(file_ptr);
139 ScriptActionCtr_001 = File_ReadInt(file_ptr);
140 ScriptActionCtr_005 = File_ReadInt(file_ptr);
141 ScriptActionCtr_004 = File_ReadInt(file_ptr);
142 ScriptActionCtr_003 = File_ReadInt(file_ptr);
143 ScriptActionCtr_002 = File_ReadInt(file_ptr);
144 }
145
146 // ===============================================================
147 // Start of Custom Script Block - DO NOT EDIT ANYTHING BEFORE THIS
148 // ===============================================================
149 /**{CUSTOM_SCRIPT_BLOCK_START}** DO NOT EDIT! **/
150
151 // Enter your custom script code here
152
153 /**{CUSTOM_SCRIPT_BLOCK_END}**** DO NOT EDIT! **/
154 // ============================================================
155 // End of Custom Script Block - DO NOT EDIT ANYTHING AFTER THIS
156 // ============================================================
157
158 // =================
159 // Message File Data
160 // =================
161
162 #define MAX_SCRIPT_MESSAGES 256
163 #define MAX_MSG_FILEBUF_LEN 1024
164 #define NO_MESSAGE_STRING "*Message Not Found*"
165 #define INV_MSGNAME_STRING "*Message Name Invalid*"
166 #define WHITESPACE_CHARS " \t\r\n"
167
168 // Structure for storing a script message
169 struct tScriptMessage {
170 char *name; // the name of the message
171 char *message; // the actual message text
172 };
173
174 // Global storage for level script messages
175 tScriptMessage *message_list[MAX_SCRIPT_MESSAGES];
176 int num_messages;
177
178 // ======================
179 // Message File Functions
180 // ======================
181
182 // Initializes the Message List
183 void InitMessageList(void) {
184 for (int j = 0; j < MAX_SCRIPT_MESSAGES; j++)
185 message_list[j] = NULL;
186 num_messages = 0;
187 }
188
189 // Clear the Message List
190 void ClearMessageList(void) {
191 for (int j = 0; j < num_messages; j++) {
192 free(message_list[j]->name);
193 free(message_list[j]->message);
194 free(message_list[j]);
195 message_list[j] = NULL;
196 }
197 num_messages = 0;
198 }
199
200 // Adds a message to the list
201 int AddMessageToList(char *name, char *msg) {
202 int pos;
203
204 // Make sure there is room in the list
205 if (num_messages >= MAX_SCRIPT_MESSAGES)
206 return false;
207
208 // Allocate memory for this message entry
209 pos = num_messages;
210 message_list[pos] = (tScriptMessage *)malloc(sizeof(tScriptMessage));
211 if (message_list[pos] == NULL)
212 return false;
213
214 // Allocate memory for the message name
215 message_list[pos]->name = (char *)malloc(strlen(name) + 1);
216 if (message_list[pos]->name == NULL) {
217 free(message_list[pos]);
218 return false;
219 }
220 strcpy(message_list[pos]->name, name);
221
222 // Allocate memory for the message name
223 message_list[pos]->message = (char *)malloc(strlen(msg) + 1);
224 if (message_list[pos]->message == NULL) {
225 free(message_list[pos]->name);
226 free(message_list[pos]);
227 return false;
228 }
229 strcpy(message_list[pos]->message, msg);
230 num_messages++;
231
232 return true;
233 }
234
235 // Removes any whitespace padding from the end of a string
236 void RemoveTrailingWhitespace(char *s) {
237 int last_char_pos;
238
239 last_char_pos = strlen(s) - 1;
240 while (last_char_pos >= 0 && isspace(s[last_char_pos])) {
241 s[last_char_pos] = '\0';
242 last_char_pos--;
243 }
244 }
245
246 // Returns a pointer to the first non-whitespace char in given string
247 char *SkipInitialWhitespace(char *s) {
248 while ((*s) != '\0' && isspace(*s))
249 s++;
250
251 return (s);
252 }
253
254 // Read in the Messages
255 int ReadMessageFile(const char *filename) {
256 void *infile;
257 char filebuffer[MAX_MSG_FILEBUF_LEN + 1];
258 char *line, *msg_start;
259 int line_num;
260 bool next_msgid_found;
261
262 // Try to open the file for loading
263 infile = File_Open(filename, "rt");
264 if (!infile)
265 return false;
266
267 line_num = 0;
268 next_msgid_found = true;
269
270 // Clear the message list
271 ClearMessageList();
272
273 // Read in and parse each line of the file
274 while (!File_eof(infile)) {
275
276 // Clear the buffer
277 strcpy(filebuffer, "");
278
279 // Read in a line from the file
280 File_ReadString(filebuffer, MAX_MSG_FILEBUF_LEN, infile);
281 line_num++;
282
283 // Remove whitespace padding at start and end of line
284 RemoveTrailingWhitespace(filebuffer);
285 line = SkipInitialWhitespace(filebuffer);
286
287 // If line is a comment, or empty, discard it
288 if (strlen(line) == 0 || strncmp(line, "//", 2) == 0)
289 continue;
290
291 if (!next_msgid_found) { // Parse out the last message ID number
292
293 // Grab the first keyword, make sure it's valid
294 line = strtok(line, WHITESPACE_CHARS);
295 if (line == NULL)
296 continue;
297
298 // Grab the second keyword, and assign it as the next message ID
299 line = strtok(NULL, WHITESPACE_CHARS);
300 if (line == NULL)
301 continue;
302
303 next_msgid_found = true;
304 } else { // Parse line as a message line
305
306 // Find the start of message, and mark it
307 msg_start = strchr(line, '=');
308 if (msg_start == NULL)
309 continue;
310 msg_start[0] = '\0';
311 msg_start++;
312
313 // Add the message to the list
314 AddMessageToList(line, msg_start);
315 }
316 }
317 File_Close(infile);
318
319 return true;
320 }
321
322 // Find a message
323 const char *GetMessage(const char *name) {
324 // Make sure given name is valid
325 if (name == NULL)
326 return INV_MSGNAME_STRING;
327
328 // Search message list for name
329 for (int j = 0; j < num_messages; j++)
330 if (strcmp(message_list[j]->name, name) == 0)
331 return (message_list[j]->message);
332
333 // Couldn't find it
334 return NO_MESSAGE_STRING;
335 }
336
337 //======================
338 // Name List Arrays
339 //======================
340
341 #define NUM_DOOR_NAMES 0
342 const char **Door_names = NULL;
343 int *Door_handles = NULL;
344
345 #define NUM_OBJECT_NAMES 6
346 const char *Object_names[NUM_OBJECT_NAMES] = {"SmokeA", "SmokeB", "JawsD", "JawsC", "JawsB", "JawsA"};
347 int Object_handles[NUM_OBJECT_NAMES];
348
349 #define NUM_ROOM_NAMES 0
350 const char **Room_names = NULL;
351 int *Room_indexes = NULL;
352
353 #define NUM_TRIGGER_NAMES 0
354 const char **Trigger_names = NULL;
355 int *Trigger_indexes = NULL;
356 int *Trigger_faces = NULL;
357 int *Trigger_rooms = NULL;
358
359 #define NUM_SOUND_NAMES 0
360 const char **Sound_names = NULL;
361 int *Sound_indexes = NULL;
362
363 #define NUM_TEXTURE_NAMES 0
364 const char **Texture_names = NULL;
365 int *Texture_indexes = NULL;
366
367 #define NUM_PATH_NAMES 0
368 const char **Path_names = NULL;
369 int *Path_indexes = NULL;
370
371 #define NUM_MATCEN_NAMES 0
372 const char **Matcen_names = NULL;
373 int *Matcen_indexes = NULL;
374
375 #define NUM_GOAL_NAMES 0
376 const char **Goal_names = NULL;
377 int *Goal_indexes = NULL;
378
379 #define NUM_MESSAGE_NAMES 0
380 const char **Message_names = NULL;
381 const char **Message_strings = NULL;
382
383 // ===============
384 // InitializeDLL()
385 // ===============
386 char STDCALL InitializeDLL(tOSIRISModuleInit *func_list) {
387 osicommon_Initialize((tOSIRISModuleInit *)func_list);
388 if (func_list->game_checksum != CHECKSUM) {
389 mprintf(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksum, CHECKSUM);
390 mprintf(0, "RECOMPILE YOUR SCRIPTS!!!\n");
391 return 0;
392 }
393
394 ClearGlobalActionCtrs();
395 dfInit();
396 InitMessageList();
397
398 // Build the filename of the message file
399 char filename[_MAX_PATH + 32];
400 int lang_type;
401 if (func_list->script_identifier != NULL) {
402 _splitpath(func_list->script_identifier, NULL, NULL, filename, NULL);
403 lang_type = Game_GetLanguage();
404 if (lang_type == LANGUAGE_FRENCH)
405 strcat(filename, "_FRN");
406 else if (lang_type == LANGUAGE_GERMAN)
407 strcat(filename, "_GER");
408 else if (lang_type == LANGUAGE_ITALIAN)
409 strcat(filename, "_ITN");
410 else if (lang_type == LANGUAGE_SPANISH)
411 strcat(filename, "_SPN");
412 strcat(filename, ".msg");
413 } else {
414 strcpy(filename, "Geodomes.msg");
415 lang_type = LANGUAGE_ENGLISH;
416 }
417 if (!ReadMessageFile(filename)) {
418 mprintf(0, "ERROR: Could not load message file - %s\n", filename);
419 }
420
421 int j;
422
423 // Do Door Index lookups
424 for (j = 0; j < NUM_DOOR_NAMES; j++)
425 Door_handles[j] = Scrpt_FindDoorName(Door_names[j]);
426
427 // Do Object Index lookups
428 for (j = 0; j < NUM_OBJECT_NAMES; j++)
429 Object_handles[j] = Scrpt_FindObjectName(Object_names[j]);
430
431 // Do Room Index lookups
432 for (j = 0; j < NUM_ROOM_NAMES; j++)
433 Room_indexes[j] = Scrpt_FindRoomName(Room_names[j]);
434
435 // Do Trigger Index lookups
436 for (j = 0; j < NUM_TRIGGER_NAMES; j++) {
437 Trigger_indexes[j] = Scrpt_FindTriggerName(Trigger_names[j]);
438 Trigger_faces[j] = Scrpt_GetTriggerFace(Trigger_indexes[j]);
439 Trigger_rooms[j] = Scrpt_GetTriggerRoom(Trigger_indexes[j]);
440 }
441
442 // Do Sound Index lookups
443 for (j = 0; j < NUM_SOUND_NAMES; j++)
444 Sound_indexes[j] = Scrpt_FindSoundName(Sound_names[j]);
445
446 // Do Texture Index lookups
447 for (j = 0; j < NUM_TEXTURE_NAMES; j++)
448 Texture_indexes[j] = Scrpt_FindTextureName(Texture_names[j]);
449
450 // Do Path Index lookups
451 for (j = 0; j < NUM_PATH_NAMES; j++)
452 Path_indexes[j] = Scrpt_FindPathName(Path_names[j]);
453
454 // Do Matcen Index lookups
455 for (j = 0; j < NUM_MATCEN_NAMES; j++)
456 Matcen_indexes[j] = Scrpt_FindMatcenName(Matcen_names[j]);
457
458 // Do Goal Index lookups
459 for (j = 0; j < NUM_GOAL_NAMES; j++)
460 Goal_indexes[j] = Scrpt_FindLevelGoalName(Goal_names[j]);
461
462 // Do Message Name lookups
463 for (j = 0; j < NUM_MESSAGE_NAMES; j++)
464 Message_strings[j] = GetMessage(Message_names[j]);
465
466 return 1;
467 }
468
469 // =============
470 // ShutdownDLL()
471 // =============
472 void STDCALL ShutdownDLL(void) { ClearMessageList(); }
473
474 // ===============
475 // GetGOScriptID()
476 // ===============
477 int STDCALL GetGOScriptID(const char *name, uint8_t isdoor) { return -1; }
478
479 // ================
480 // CreateInstance()
481 // ================
482 void STDCALLPTR CreateInstance(int id) {
483 switch (id) {
484 case ID_LEVEL_0000:
485 return new LevelScript_0000;
486 break;
487 case ID_CUSTOM_OBJECT_1081:
488 return new CustomObjectScript_1081;
489 break;
490 case ID_CUSTOM_OBJECT_1080:
491 return new CustomObjectScript_1080;
492 break;
493 case ID_CUSTOM_OBJECT_107A:
494 return new CustomObjectScript_107A;
495 break;
496 case ID_CUSTOM_OBJECT_107B:
497 return new CustomObjectScript_107B;
498 break;
499 default:
500 mprintf(0, "SCRIPT: Illegal ID (%d)\n", id);
501 break;
502 }
503 return NULL;
504 }
505
506 // =================
507 // DestroyInstance()
508 // =================
509 void STDCALL DestroyInstance(int id, void *ptr) {
510 switch (id) {
511 case ID_LEVEL_0000:
512 delete ((LevelScript_0000 *)ptr);
513 break;
514 case ID_CUSTOM_OBJECT_1081:
515 delete ((CustomObjectScript_1081 *)ptr);
516 break;
517 case ID_CUSTOM_OBJECT_1080:
518 delete ((CustomObjectScript_1080 *)ptr);
519 break;
520 case ID_CUSTOM_OBJECT_107A:
521 delete ((CustomObjectScript_107A *)ptr);
522 break;
523 case ID_CUSTOM_OBJECT_107B:
524 delete ((CustomObjectScript_107B *)ptr);
525 break;
526 default:
527 mprintf(0, "SCRIPT: Illegal ID (%d)\n", id);
528 break;
529 }
530 }
531
532 // ===================
533 // CallInstanceEvent()
534 // ===================
535 int16_t STDCALL CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfo *data) {
536 switch (id) {
537 case ID_LEVEL_0000:
538 case ID_CUSTOM_OBJECT_1081:
539 case ID_CUSTOM_OBJECT_1080:
540 case ID_CUSTOM_OBJECT_107A:
541 case ID_CUSTOM_OBJECT_107B:
542 return ((BaseScript *)ptr)->CallEvent(event, data);
543 break;
544 default:
545 mprintf(0, "SCRIPT: Illegal ID (%d)\n", id);
546 break;
547 }
548 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
549 }
550
551 // ==================
552 // SaveRestoreState()
553 // ==================
554 int STDCALL SaveRestoreState(void *file_ptr, uint8_t saving_state) { return 0; }
555
556 // ====================
557 // GetTriggerScriptID()
558 // ====================
559 int STDCALL GetTriggerScriptID(int trigger_room, int trigger_face) { return -1; }
560
561 // =================
562 // GetCOScriptList()
563 // =================
564 int STDCALL GetCOScriptList(int **list, int **id_list) {
565 static int cust_handle_list[4];
566 static int cust_id_list[4] = {ID_CUSTOM_OBJECT_1081, ID_CUSTOM_OBJECT_1080, ID_CUSTOM_OBJECT_107A,
567 ID_CUSTOM_OBJECT_107B};
568
569 // Fill in the custom handle list
570 cust_handle_list[0] = Object_handles[2];
571 cust_handle_list[1] = Object_handles[3];
572 cust_handle_list[2] = Object_handles[4];
573 cust_handle_list[3] = Object_handles[5];
574
575 *list = cust_handle_list;
576 *id_list = cust_id_list;
577
578 return 4;
579 }
580
581 //=======================
582 // Script Implementation
583 //=======================
584
585 BaseScript::BaseScript() {}
586
587 BaseScript::~BaseScript() {}
588
589 int16_t BaseScript::CallEvent(int event, tOSIRISEventInfo *data) {
590 mprintf(0, "BaseScript::CallEvent()\n");
591 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
592 }
593
594 int16_t LevelScript_0000::CallEvent(int event, tOSIRISEventInfo *data) {
595 switch (event) {
596 case EVT_SAVESTATE: {
597 tOSIRISEVTSAVESTATE *event_data = &data->evt_savestate;
598
599 SaveGlobalActionCtrs(event_data->fileptr);
600 dfSave(event_data->fileptr);
601 } break;
602 case EVT_RESTORESTATE: {
603 tOSIRISEVTRESTORESTATE *event_data = &data->evt_restorestate;
604
605 RestoreGlobalActionCtrs(event_data->fileptr);
606 dfRestore(event_data->fileptr);
607 } break;
608 case EVT_LEVELSTART: {
609 tOSIRISEVTLEVELSTART *event_data = &data->evt_levelstart;
610
611 ClearGlobalActionCtrs();
612 dfInit();
613
614 // Script 000: Start Weather
615 if (1) {
616 aLightningTurnOn(5.000000f, 0.500000f);
617
618 // Increment the script action counter
619 if (ScriptActionCtr_000 < MAX_ACTION_CTR_VALUE)
620 ScriptActionCtr_000++;
621 }
622
623 // Script 001: Steam Starts
624 if (1) {
625 aTurnOnSpew(Object_handles[0], -1, 7, 0.000000f, 0.000000f, 65536, 0, 1.500000f, 0.150000f, 30.000000f, 4.000000f,
626 20.000000f, 1, 0);
627 aTurnOnSpew(Object_handles[1], -1, 7, 0.000000f, 0.000000f, 65536, 0, 1.500000f, 0.150000f, 30.000000f, 4.000000f,
628 20.000000f, 1, 1);
629
630 // Increment the script action counter
631 if (ScriptActionCtr_001 < MAX_ACTION_CTR_VALUE)
632 ScriptActionCtr_001++;
633 }
634 } break;
635 }
636 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
637 }
638
639 int16_t CustomObjectScript_1081::CallEvent(int event, tOSIRISEventInfo *data) {
640 switch (event) {
641 case EVT_COLLIDE: {
642 tOSIRISEVTCOLLIDE *event_data = &data->evt_collide;
643
644 // Script 005: Jaws D Damage
645 if (qObjIsPlayer(event_data->it_handle) == true) {
646 aObjApplyDamage(event_data->it_handle, 0.500000f);
647
648 // Increment the script action counter
649 if (ScriptActionCtr_005 < MAX_ACTION_CTR_VALUE)
650 ScriptActionCtr_005++;
651 }
652 } break;
653 }
654 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
655 }
656
657 int16_t CustomObjectScript_1080::CallEvent(int event, tOSIRISEventInfo *data) {
658 switch (event) {
659 case EVT_COLLIDE: {
660 tOSIRISEVTCOLLIDE *event_data = &data->evt_collide;
661
662 // Script 004: Jaws C Damage
663 if (qObjIsPlayer(event_data->it_handle) == true) {
664 aObjApplyDamage(event_data->it_handle, 0.500000f);
665
666 // Increment the script action counter
667 if (ScriptActionCtr_004 < MAX_ACTION_CTR_VALUE)
668 ScriptActionCtr_004++;
669 }
670 } break;
671 }
672 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
673 }
674
675 int16_t CustomObjectScript_107A::CallEvent(int event, tOSIRISEventInfo *data) {
676 switch (event) {
677 case EVT_COLLIDE: {
678 tOSIRISEVTCOLLIDE *event_data = &data->evt_collide;
679
680 // Script 003: Jaws B Damage
681 if (qObjIsPlayer(event_data->it_handle) == true) {
682 aObjApplyDamage(event_data->it_handle, 0.500000f);
683
684 // Increment the script action counter
685 if (ScriptActionCtr_003 < MAX_ACTION_CTR_VALUE)
686 ScriptActionCtr_003++;
687 }
688 } break;
689 }
690 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
691 }
692
693 int16_t CustomObjectScript_107B::CallEvent(int event, tOSIRISEventInfo *data) {
694 switch (event) {
695 case EVT_COLLIDE: {
696 tOSIRISEVTCOLLIDE *event_data = &data->evt_collide;
697
698 // Script 002: Jaws A Damage
699 if (qObjIsPlayer(event_data->it_handle) == true) {
700 aObjApplyDamage(event_data->it_handle, 0.500000f);
701
702 // Increment the script action counter
703 if (ScriptActionCtr_002 < MAX_ACTION_CTR_VALUE)
704 ScriptActionCtr_002++;
705 }
706 } break;
707 }
708 return CONTINUE_CHAIN | CONTINUE_DEFAULT;
709 }
710
711 /*********************************************************
712 Script Save Block: DO NOT TOUCH ANYTHING IN THIS BLOCK!!!
713 **********************************************************
714 $$SCRIPT_BLOCK_START
715
716 VERSION 3
717 NEXT_ID 6
718
719 // UserType value blocks
720 $$UTYPE_VALS_START UserVar
721 $$UTYPE_VALS_END
722
723 $$UTYPE_VALS_START UserFlag
724 $$UTYPE_VALS_END
725
726 $$UTYPE_VALS_START SpewHandle
727 0:SteamA
728 1:SteamB
729 $$UTYPE_VALS_END
730
731 $$UTYPE_VALS_START TimerID
732 $$UTYPE_VALS_END
733
734 $$UTYPE_VALS_START SavedObjectSlot
735 $$UTYPE_VALS_END
736
737 $$UTYPE_VALS_START GoalID
738 $$UTYPE_VALS_END
739
740
741 // Name Lists
742 $$DOOR_LIST_START
743 $$DOOR_LIST_END
744
745 $$OBJECT_LIST_START
746 SmokeA
747 SmokeB
748 JawsD
749 JawsC
750 JawsB
751 JawsA
752 $$OBJECT_LIST_END
753
754 $$ROOM_LIST_START
755 $$ROOM_LIST_END
756
757 $$TRIGGER_LIST_START
758 $$TRIGGER_LIST_END
759
760 $$SOUND_LIST_START
761 $$SOUND_LIST_END
762
763 $$TEXTURE_LIST_START
764 $$TEXTURE_LIST_END
765
766 $$SPECNAME_LIST_START
767 $$SPECNAME_LIST_END
768
769 $$PATH_LIST_START
770 $$PATH_LIST_END
771
772 $$MATCEN_LIST_START
773 $$MATCEN_LIST_END
774
775 $$GOAL_LIST_START
776 $$GOAL_LIST_END
777
778 $$STRM_AUDIO_LIST_START
779 $$STRM_AUDIO_LIST_END
780
781
782 // Script Tree Dump
783 00:0:Start Weather
784 $$CHILD_BLOCK_START
785 01:2:0
786 02:6
787 03:0
788 $$CHILD_BLOCK_START
789 05:0
790 $$CHILD_BLOCK_END
791 04:0:0:0
792 $$CHILD_BLOCK_START
793 08:aLightningTurnOn
794 $$CHILD_BLOCK_START
795 10:6:5.000000:Seconds
796 10:9:0.500000:Probability
797 $$CHILD_BLOCK_END
798 $$CHILD_BLOCK_END
799 $$CHILD_BLOCK_END
800 00:1:Steam Starts
801 $$CHILD_BLOCK_START
802 01:2:0
803 02:6
804 03:0
805 $$CHILD_BLOCK_START
806 05:0
807 $$CHILD_BLOCK_END
808 04:0:0:0
809 $$CHILD_BLOCK_START
810 08:aTurnOnSpew
811 $$CHILD_BLOCK_START
812 10:1:0:0:Object
813 10:4:-1:GunNum
814 10:10:0:7:SpewType
815 10:6:0.000000:Mass
816 10:6:0.000000:Drag
817 10:15:65536:PhysicsFlags
818 10:5:0:IsRealObject
819 10:6:1.500000:BlobLifetime
820 10:6:0.150000:BlobInterval
821 10:6:30.000000:SpewLife
822 10:6:4.000000:BlobSize
823 10:6:20.000000:BlobSpeed
824 10:5:1:Randomize
825 10:10:0:0:SpewHandle
826 $$CHILD_BLOCK_END
827 08:aTurnOnSpew
828 $$CHILD_BLOCK_START
829 10:1:0:1:Object
830 10:4:-1:GunNum
831 10:10:0:7:SpewType
832 10:6:0.000000:Mass
833 10:6:0.000000:Drag
834 10:15:65536:PhysicsFlags
835 10:5:0:IsRealObject
836 10:6:1.500000:BlobLifetime
837 10:6:0.150000:BlobInterval
838 10:6:30.000000:SpewLife
839 10:6:4.000000:BlobSize
840 10:6:20.000000:BlobSpeed
841 10:5:1:Randomize
842 10:10:0:1:SpewHandle
843 $$CHILD_BLOCK_END
844 $$CHILD_BLOCK_END
845 $$CHILD_BLOCK_END
846 00:5:Jaws D Damage
847 $$CHILD_BLOCK_START
848 01:1:2
849 02:0
850 03:0
851 $$CHILD_BLOCK_START
852 05:1
853 $$CHILD_BLOCK_START
854 06:qObjIsPlayer:Bool
855 $$CHILD_BLOCK_START
856 10:1:1:-1:Object
857 $$CHILD_BLOCK_END
858 07:0:6
859 $$CHILD_BLOCK_END
860 $$CHILD_BLOCK_END
861 04:0:0:0
862 $$CHILD_BLOCK_START
863 08:aObjApplyDamage
864 $$CHILD_BLOCK_START
865 10:1:1:-1:Object
866 10:6:0.500000:DamageAmount
867 $$CHILD_BLOCK_END
868 $$CHILD_BLOCK_END
869 $$CHILD_BLOCK_END
870 00:4:Jaws C Damage
871 $$CHILD_BLOCK_START
872 01:1:3
873 02:0
874 03:0
875 $$CHILD_BLOCK_START
876 05:1
877 $$CHILD_BLOCK_START
878 06:qObjIsPlayer:Bool
879 $$CHILD_BLOCK_START
880 10:1:1:-1:Object
881 $$CHILD_BLOCK_END
882 07:0:6
883 $$CHILD_BLOCK_END
884 $$CHILD_BLOCK_END
885 04:0:0:0
886 $$CHILD_BLOCK_START
887 08:aObjApplyDamage
888 $$CHILD_BLOCK_START
889 10:1:1:-1:Object
890 10:6:0.500000:DamageAmount
891 $$CHILD_BLOCK_END
892 $$CHILD_BLOCK_END
893 $$CHILD_BLOCK_END
894 00:3:Jaws B Damage
895 $$CHILD_BLOCK_START
896 01:1:4
897 02:0
898 03:0
899 $$CHILD_BLOCK_START
900 05:1
901 $$CHILD_BLOCK_START
902 06:qObjIsPlayer:Bool
903 $$CHILD_BLOCK_START
904 10:1:1:-1:Object
905 $$CHILD_BLOCK_END
906 07:0:6
907 $$CHILD_BLOCK_END
908 $$CHILD_BLOCK_END
909 04:0:0:0
910 $$CHILD_BLOCK_START
911 08:aObjApplyDamage
912 $$CHILD_BLOCK_START
913 10:1:1:-1:Object
914 10:6:0.500000:DamageAmount
915 $$CHILD_BLOCK_END
916 $$CHILD_BLOCK_END
917 $$CHILD_BLOCK_END
918 00:2:Jaws A Damage
919 $$CHILD_BLOCK_START
920 01:1:5
921 02:0
922 03:0
923 $$CHILD_BLOCK_START
924 05:1
925 $$CHILD_BLOCK_START
926 06:qObjIsPlayer:Bool
927 $$CHILD_BLOCK_START
928 10:1:1:-1:Object
929 $$CHILD_BLOCK_END
930 07:0:6
931 $$CHILD_BLOCK_END
932 $$CHILD_BLOCK_END
933 04:0:0:0
934 $$CHILD_BLOCK_START
935 08:aObjApplyDamage
936 $$CHILD_BLOCK_START
937 10:1:1:-1:Object
938 10:6:0.500000:DamageAmount
939 $$CHILD_BLOCK_END
940 $$CHILD_BLOCK_END
941 $$CHILD_BLOCK_END
942
943 $$SCRIPT_BLOCK_END
944 *********************************************************/