Debian Codegraph @

scripts/Y2K.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: BathroomJungle.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"cxx . . $ `<file>/scripts/osiris_import.h`/
30 #include "osiris_common.h"cxx . . $ `<file>/scripts/osiris_common.h`/
31 #include "DallasFuncs.cpp"cxx . . $ `<file>/scripts/DallasFuncs.cpp`/
32
33 #include "module.h"cxx . . $ `<file>/lib/module.h`/
34
35 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
36 extern "C" {
37 #endif
38 DLLEXPORTcxx . . $ `lib/module.h:114:9`! char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLL(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list);
39 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLL(void);
40 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptID(const char *name, uint8_tcxx . . $ uint8_t# is_door);
41 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstance(int id);
42 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstance(int id, void *ptr);
43 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
44 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetTriggerScriptID(int trigger_room, int trigger_face);
45 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetCOScriptList(int **list, int **id_list);
46 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreState(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state);
47 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
48 }
49 #endif
50
51 // =================
52 // Script ID Numbers
53 // =================
54 #define ID_LEVEL_0000cxx . . $ `scripts/Y2K.cpp:54:9`! 0x000
55
56 // ========================
57 // Script Class Definitions
58 // ========================
59
60 class BaseScriptcxx . . $ BaseScript# {
61 public:
62 BaseScriptcxx . . $ BaseScript#BaseScript(49f6e7a06ebc5aa8).();
63 ~cxx . . $ BaseScript#`~BaseScript`(ced63f7c635d850d).BaseScriptcxx . . $ BaseScript#();
64 virtual int16_t CallEventcxx . . $ BaseScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
65 };
66
67 class LevelScript_0000cxx . . $ LevelScript_0000# : public BaseScriptcxx . . $ BaseScript# {
68 public:
69 int16_t CallEventcxx . . $ LevelScript_0000#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
70 };
71
72 // ======================
73 // Global Action Counters
74 // ======================
75
76 #define MAX_ACTION_CTR_VALUEcxx . . $ `scripts/Y2K.cpp:76:9`! 100000
77
78 int ScriptActionCtr_002cxx . . $ ScriptActionCtr_002. = 0;
79 int ScriptActionCtr_001cxx . . $ ScriptActionCtr_001. = 0;
80
81 // ========================================
82 // Function to Clear Global Action Counters
83 // ========================================
84 void ClearGlobalActionCtrscxx . . $ ClearGlobalActionCtrs(49f6e7a06ebc5aa8).(void) {
85 ScriptActionCtr_002cxx . . $ ScriptActionCtr_002. = 0;
86 ScriptActionCtr_001cxx . . $ ScriptActionCtr_001. = 0;
87 }
88
89 // ========================================
90 // Function to Save Global Action Counters
91 // ========================================
92 void SaveGlobalActionCtrscxx . . $ SaveGlobalActionCtrs(5d22bdacc48458e8).(void *file_ptr) {
93 File_WriteIntcxx . . $ File_WriteInt.(ScriptActionCtr_002cxx . . $ ScriptActionCtr_002., file_ptr);
94 File_WriteIntcxx . . $ File_WriteInt.(ScriptActionCtr_001cxx . . $ ScriptActionCtr_001., file_ptr);
95 }
96
97 // ===========================================
98 // Function to Restore Global Action Counters
99 // ===========================================
100 void RestoreGlobalActionCtrscxx . . $ RestoreGlobalActionCtrs(5d22bdacc48458e8).(void *file_ptr) {
101 ScriptActionCtr_002cxx . . $ ScriptActionCtr_002. = File_ReadIntcxx . . $ File_ReadInt.(file_ptr);
102 ScriptActionCtr_001cxx . . $ ScriptActionCtr_001. = File_ReadIntcxx . . $ File_ReadInt.(file_ptr);
103 }
104
105 // ===============================================================
106 // Start of Custom Script Block - DO NOT EDIT ANYTHING BEFORE THIS
107 // ===============================================================
108 /**{CUSTOM_SCRIPT_BLOCK_START}** DO NOT EDIT! **/
109
110 // Enter your custom script code here
111
112 /**{CUSTOM_SCRIPT_BLOCK_END}**** DO NOT EDIT! **/
113 // ============================================================
114 // End of Custom Script Block - DO NOT EDIT ANYTHING AFTER THIS
115 // ============================================================
116
117 // =================
118 // Message File Data
119 // =================
120
121 #define MAX_SCRIPT_MESSAGEScxx . . $ `scripts/Y2K.cpp:121:9`! 256
122 #define MAX_MSG_FILEBUF_LENcxx . . $ `scripts/Y2K.cpp:122:9`! 1024
123 #define NO_MESSAGE_STRINGcxx . . $ `scripts/Y2K.cpp:123:9`! "*Message Not Found*"
124 #define INV_MSGNAME_STRINGcxx . . $ `scripts/Y2K.cpp:124:9`! "*Message Name Invalid*"
125 #define WHITESPACE_CHARScxx . . $ `scripts/Y2K.cpp:125:9`! " \t\r\n"
126
127 // Structure for storing a script message
128 struct tScriptMessagecxx . . $ tScriptMessage# {
129 char *namecxx . . $ tScriptMessage#name.; // the name of the message
130 char *messagecxx . . $ tScriptMessage#message.; // the actual message text
131 };
132
133 // Global storage for level script messages
134 tScriptMessagecxx . . $ tScriptMessage# *message_listcxx . . $ message_list.[MAX_SCRIPT_MESSAGEScxx . . $ `scripts/Y2K.cpp:121:9`!];
135 int num_messagescxx . . $ num_messages.;
136
137 // ======================
138 // Message File Functions
139 // ======================
140
141 // Initializes the Message List
142 void InitMessageListcxx . . $ InitMessageList(49f6e7a06ebc5aa8).(void) {
143 for (int j = 0; j < MAX_SCRIPT_MESSAGEScxx . . $ `scripts/Y2K.cpp:121:9`!; j++)
144 message_listcxx . . $ message_list.[j] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
145 num_messagescxx . . $ num_messages. = 0;
146 }
147
148 // Clear the Message List
149 void ClearMessageListcxx . . $ ClearMessageList(49f6e7a06ebc5aa8).(void) {
150 for (int j = 0; j < num_messagescxx . . $ num_messages.; j++) {
151 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[j]->namecxx . . $ tScriptMessage#name.);
152 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[j]->messagecxx . . $ tScriptMessage#message.);
153 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[j]);
154 message_listcxx . . $ message_list.[j] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
155 }
156 num_messagescxx . . $ num_messages. = 0;
157 }
158
159 // Adds a message to the list
160 int AddMessageToListcxx . . $ AddMessageToList(e99f026884c896d5).(char *name, char *msg) {
161 int pos;
162
163 // Make sure there is room in the list
164 if (num_messagescxx . . $ num_messages. >= MAX_SCRIPT_MESSAGEScxx . . $ `scripts/Y2K.cpp:121:9`!)
165 return false;
166
167 // Allocate memory for this message entry
168 pos = num_messagescxx . . $ num_messages.;
169 message_listcxx . . $ message_list.[pos] = (tScriptMessagecxx . . $ tScriptMessage# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(tScriptMessagecxx . . $ tScriptMessage#));
170 if (message_listcxx . . $ message_list.[pos] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
171 return false;
172
173 // Allocate memory for the message name
174 message_listcxx . . $ message_list.[pos]->namecxx . . $ tScriptMessage#name. = (char *)malloccxx . . $ malloc(9f008b2a9698428b).(strlen(name) + 1);
175 if (message_listcxx . . $ message_list.[pos]->namecxx . . $ tScriptMessage#name. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
176 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[pos]);
177 return false;
178 }
179 strcpy(message_listcxx . . $ message_list.[pos]->namecxx . . $ tScriptMessage#name., name);
180
181 // Allocate memory for the message name
182 message_listcxx . . $ message_list.[pos]->messagecxx . . $ tScriptMessage#message. = (char *)malloccxx . . $ malloc(9f008b2a9698428b).(strlen(msg) + 1);
183 if (message_listcxx . . $ message_list.[pos]->messagecxx . . $ tScriptMessage#message. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
184 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[pos]->namecxx . . $ tScriptMessage#name.);
185 freecxx . . $ free(bd21765a0afc8e3c).(message_listcxx . . $ message_list.[pos]);
186 return false;
187 }
188 strcpy(message_listcxx . . $ message_list.[pos]->messagecxx . . $ tScriptMessage#message., msg);
189 num_messagescxx . . $ num_messages.++;
190
191 return true;
192 }
193
194 // Removes any whitespace padding from the end of a string
195 void RemoveTrailingWhitespacecxx . . $ RemoveTrailingWhitespace(fda57c8427c60377).(char *s) {
196 int last_char_pos;
197
198 last_char_pos = strlen(s) - 1;
199 while (last_char_pos >= 0 && isspace(s[last_char_pos])) {
200 s[last_char_pos] = '\0';
201 last_char_pos--;
202 }
203 }
204
205 // Returns a pointer to the first non-whitespace char in given string
206 char *SkipInitialWhitespacecxx . . $ SkipInitialWhitespace(7a9722d75b371431).(char *s) {
207 while ((*s) != '\0' && isspace(*s))
208 s++;
209
210 return (s);
211 }
212
213 // Read in the Messages
214 int ReadMessageFilecxx . . $ ReadMessageFile(5c4306d8553b3696).(const char *filename) {
215 void *infile;
216 char filebuffer[MAX_MSG_FILEBUF_LENcxx . . $ `scripts/Y2K.cpp:122:9`! + 1];
217 char *line, *msg_start;
218 int line_num;
219 bool next_msgid_found;
220
221 // Try to open the file for loading
222 infile = File_Opencxx . . $ File_Open.(filename, "rt");
223 if (!infile)
224 return false;
225
226 line_num = 0;
227 next_msgid_found = true;
228
229 // Clear the message list
230 ClearMessageListcxx . . $ ClearMessageList(49f6e7a06ebc5aa8).();
231
232 // Read in and parse each line of the file
233 while (!File_eofcxx . . $ File_eof.(infile)) {
234
235 // Clear the buffer
236 strcpy(filebuffer, "");
237
238 // Read in a line from the file
239 File_ReadStringcxx . . $ File_ReadString.(filebuffer, MAX_MSG_FILEBUF_LENcxx . . $ `scripts/Y2K.cpp:122:9`!, infile);
240 line_num++;
241
242 // Remove whitespace padding at start and end of line
243 RemoveTrailingWhitespacecxx . . $ RemoveTrailingWhitespace(fda57c8427c60377).(filebuffer);
244 line = SkipInitialWhitespacecxx . . $ SkipInitialWhitespace(7a9722d75b371431).(filebuffer);
245
246 // If line is a comment, or empty, discard it
247 if (strlen(line) == 0 || strncmp(line, "//", 2) == 0)
248 continue;
249
250 if (!next_msgid_found) { // Parse out the last message ID number
251
252 // Grab the first keyword, make sure it's valid
253 line = strtok(line, WHITESPACE_CHARScxx . . $ `scripts/Y2K.cpp:125:9`!);
254 if (line == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
255 continue;
256
257 // Grab the second keyword, and assign it as the next message ID
258 line = strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, WHITESPACE_CHARScxx . . $ `scripts/Y2K.cpp:125:9`!);
259 if (line == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
260 continue;
261
262 next_msgid_found = true;
263 } else { // Parse line as a message line
264
265 // Find the start of message, and mark it
266 msg_start = strchr(line, '=');
267 if (msg_start == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
268 continue;
269 msg_start[0] = '\0';
270 msg_start++;
271
272 // Add the message to the list
273 AddMessageToListcxx . . $ AddMessageToList(e99f026884c896d5).(line, msg_start);
274 }
275 }
276 File_Closecxx . . $ File_Close.(infile);
277
278 return true;
279 }
280
281 // Find a message
282 const char *GetMessagecxx . . $ GetMessage(fb58d2e09a2a1ce6).(const char *name) {
283 // Make sure given name is valid
284 if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
285 return INV_MSGNAME_STRINGcxx . . $ `scripts/Y2K.cpp:124:9`!;
286
287 // Search message list for name
288 for (int j = 0; j < num_messagescxx . . $ num_messages.; j++)
289 if (strcmp(message_listcxx . . $ message_list.[j]->namecxx . . $ tScriptMessage#name., name) == 0)
290 return (message_listcxx . . $ message_list.[j]->messagecxx . . $ tScriptMessage#message.);
291
292 // Couldn't find it
293 return NO_MESSAGE_STRINGcxx . . $ `scripts/Y2K.cpp:123:9`!;
294 }
295
296 //======================
297 // Name List Arrays
298 //======================
299
300 #define NUM_DOOR_NAMEScxx . . $ `scripts/Y2K.cpp:300:9`! 0
301 const char **Door_namescxx . . $ Door_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
302 int *Door_handlescxx . . $ Door_handles. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
303
304 #define NUM_OBJECT_NAMEScxx . . $ `scripts/Y2K.cpp:304:9`! 2
305 const char *Object_namescxx . . $ Object_names.[NUM_OBJECT_NAMEScxx . . $ `scripts/Y2K.cpp:304:9`!] = {"Swamp", "Forest"};
306 int Object_handlescxx . . $ Object_handles.[NUM_OBJECT_NAMEScxx . . $ `scripts/Y2K.cpp:304:9`!];
307
308 #define NUM_ROOM_NAMEScxx . . $ `scripts/Y2K.cpp:308:9`! 0
309 const char **Room_namescxx . . $ Room_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
310 int *Room_indexescxx . . $ Room_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
311
312 #define NUM_TRIGGER_NAMEScxx . . $ `scripts/Y2K.cpp:312:9`! 0
313 const char **Trigger_namescxx . . $ Trigger_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
314 int *Trigger_indexescxx . . $ Trigger_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
315 int *Trigger_facescxx . . $ Trigger_faces. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
316 int *Trigger_roomscxx . . $ Trigger_rooms. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
317
318 #define NUM_SOUND_NAMEScxx . . $ `scripts/Y2K.cpp:318:9`! 2
319 const char *Sound_namescxx . . $ Sound_names.[NUM_SOUND_NAMEScxx . . $ `scripts/Y2K.cpp:318:9`!] = {"AmbIslandFroggies", "AmbBugsGroundB"};
320 int Sound_indexescxx . . $ Sound_indexes.[NUM_SOUND_NAMEScxx . . $ `scripts/Y2K.cpp:318:9`!];
321
322 #define NUM_TEXTURE_NAMEScxx . . $ `scripts/Y2K.cpp:322:9`! 0
323 const char **Texture_namescxx . . $ Texture_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
324 int *Texture_indexescxx . . $ Texture_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
325
326 #define NUM_PATH_NAMEScxx . . $ `scripts/Y2K.cpp:326:9`! 0
327 const char **Path_namescxx . . $ Path_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
328 int *Path_indexescxx . . $ Path_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
329
330 #define NUM_MATCEN_NAMEScxx . . $ `scripts/Y2K.cpp:330:9`! 0
331 const char **Matcen_namescxx . . $ Matcen_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
332 int *Matcen_indexescxx . . $ Matcen_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
333
334 #define NUM_GOAL_NAMEScxx . . $ `scripts/Y2K.cpp:334:9`! 0
335 const char **Goal_namescxx . . $ Goal_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
336 int *Goal_indexescxx . . $ Goal_indexes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
337
338 #define NUM_MESSAGE_NAMEScxx . . $ `scripts/Y2K.cpp:338:9`! 0
339 const char **Message_namescxx . . $ Message_names. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
340 const char **Message_stringscxx . . $ Message_strings. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
341
342 // ===============
343 // InitializeDLL()
344 // ===============
345 char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) {
346 osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list);
347 if (func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum. != CHECKSUMcxx . . $ `<built-in>:476:9`!) {
348 mprintfcxx . . $ mprintf.(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum., CHECKSUMcxx . . $ `<built-in>:476:9`!);
349 mprintfcxx . . $ mprintf.(0, "RECOMPILE YOUR SCRIPTS!!!\n");
350 return 0;
351 }
352
353 ClearGlobalActionCtrscxx . . $ ClearGlobalActionCtrs(49f6e7a06ebc5aa8).();
354 dfInitcxx . . $ dfInit(49f6e7a06ebc5aa8).();
355 InitMessageListcxx . . $ InitMessageList(49f6e7a06ebc5aa8).();
356
357 // Build the filename of the message file
358 char filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`! + 32];
359 char english_filename[(_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`! + 32) * 2];
360 int lang_type;
361 if (func_list->script_identifiercxx . . $ tOSIRISModuleInit#script_identifier. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
362 _splitpathcxx . . $ _splitpath(f70bbbea1d7ce513).(func_list->script_identifiercxx . . $ tOSIRISModuleInit#script_identifier., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
363 snprintf(english_filename, sizeof(english_filename), "%s.msg", filename);
364 lang_type = Game_GetLanguagecxx . . $ Game_GetLanguage.();
365 if (lang_type == LANGUAGE_FRENCHcxx . . $ `scripts/osiris_common.h:416:9`!)
366 strcat(filename, "_FRN");
367 else if (lang_type == LANGUAGE_GERMANcxx . . $ `scripts/osiris_common.h:413:9`!)
368 strcat(filename, "_GER");
369 else if (lang_type == LANGUAGE_ITALIANcxx . . $ `scripts/osiris_common.h:415:9`!)
370 strcat(filename, "_ITN");
371 else if (lang_type == LANGUAGE_SPANISHcxx . . $ `scripts/osiris_common.h:414:9`!)
372 strcat(filename, "_SPN");
373 else if (lang_type == LANGUAGE_POLISHcxx . . $ `scripts/osiris_common.h:417:9`!)
374 strcat(filename, "_POL");
375 strcat(filename, ".msg");
376 } else {
377 strcpy(filename, "BathroomJungle.msg");
378 lang_type = LANGUAGE_ENGLISHcxx . . $ `scripts/osiris_common.h:412:9`!;
379 }
380 if (!ReadMessageFilecxx . . $ ReadMessageFile(5c4306d8553b3696).(filename)) {
381 if (lang_type == LANGUAGE_ENGLISHcxx . . $ `scripts/osiris_common.h:412:9`!) {
382 mprintfcxx . . $ mprintf.(0, "ERROR: Could not load message file - %s\n", filename);
383 } else if (!ReadMessageFilecxx . . $ ReadMessageFile(5c4306d8553b3696).(english_filename)) {
384 mprintfcxx . . $ mprintf.(0, "ERROR: Could not load message file - %s\n", english_filename);
385 }
386 }
387
388 int j;
389
390 // Do Door Index lookups
391 for (j = 0; j < NUM_DOOR_NAMEScxx . . $ `scripts/Y2K.cpp:300:9`!; j++)
392 Door_handlescxx . . $ Door_handles.[j] = Scrpt_FindDoorNamecxx . . $ Scrpt_FindDoorName.(Door_namescxx . . $ Door_names.[j]);
393
394 // Do Object Index lookups
395 for (j = 0; j < NUM_OBJECT_NAMEScxx . . $ `scripts/Y2K.cpp:304:9`!; j++)
396 Object_handlescxx . . $ Object_handles.[j] = Scrpt_FindObjectNamecxx . . $ Scrpt_FindObjectName.(Object_namescxx . . $ Object_names.[j]);
397
398 // Do Room Index lookups
399 for (j = 0; j < NUM_ROOM_NAMEScxx . . $ `scripts/Y2K.cpp:308:9`!; j++)
400 Room_indexescxx . . $ Room_indexes.[j] = Scrpt_FindRoomNamecxx . . $ Scrpt_FindRoomName.(Room_namescxx . . $ Room_names.[j]);
401
402 // Do Trigger Index lookups
403 for (j = 0; j < NUM_TRIGGER_NAMEScxx . . $ `scripts/Y2K.cpp:312:9`!; j++) {
404 Trigger_indexescxx . . $ Trigger_indexes.[j] = Scrpt_FindTriggerNamecxx . . $ Scrpt_FindTriggerName.(Trigger_namescxx . . $ Trigger_names.[j]);
405 Trigger_facescxx . . $ Trigger_faces.[j] = Scrpt_GetTriggerFacecxx . . $ Scrpt_GetTriggerFace.(Trigger_indexescxx . . $ Trigger_indexes.[j]);
406 Trigger_roomscxx . . $ Trigger_rooms.[j] = Scrpt_GetTriggerRoomcxx . . $ Scrpt_GetTriggerRoom.(Trigger_indexescxx . . $ Trigger_indexes.[j]);
407 }
408
409 // Do Sound Index lookups
410 for (j = 0; j < NUM_SOUND_NAMEScxx . . $ `scripts/Y2K.cpp:318:9`!; j++)
411 Sound_indexescxx . . $ Sound_indexes.[j] = Scrpt_FindSoundNamecxx . . $ Scrpt_FindSoundName.(Sound_namescxx . . $ Sound_names.[j]);
412
413 // Do Texture Index lookups
414 for (j = 0; j < NUM_TEXTURE_NAMEScxx . . $ `scripts/Y2K.cpp:322:9`!; j++)
415 Texture_indexescxx . . $ Texture_indexes.[j] = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.(Texture_namescxx . . $ Texture_names.[j]);
416
417 // Do Path Index lookups
418 for (j = 0; j < NUM_PATH_NAMEScxx . . $ `scripts/Y2K.cpp:326:9`!; j++)
419 Path_indexescxx . . $ Path_indexes.[j] = Scrpt_FindPathNamecxx . . $ Scrpt_FindPathName.(Path_namescxx . . $ Path_names.[j]);
420
421 // Do Matcen Index lookups
422 for (j = 0; j < NUM_MATCEN_NAMEScxx . . $ `scripts/Y2K.cpp:330:9`!; j++)
423 Matcen_indexescxx . . $ Matcen_indexes.[j] = Scrpt_FindMatcenNamecxx . . $ Scrpt_FindMatcenName.(Matcen_namescxx . . $ Matcen_names.[j]);
424
425 // Do Goal Index lookups
426 for (j = 0; j < NUM_GOAL_NAMEScxx . . $ `scripts/Y2K.cpp:334:9`!; j++)
427 Goal_indexescxx . . $ Goal_indexes.[j] = Scrpt_FindLevelGoalNamecxx . . $ Scrpt_FindLevelGoalName.(Goal_namescxx . . $ Goal_names.[j]);
428
429 // Do Message Name lookups
430 for (j = 0; j < NUM_MESSAGE_NAMEScxx . . $ `scripts/Y2K.cpp:338:9`!; j++)
431 Message_stringscxx . . $ Message_strings.[j] = GetMessagecxx . . $ GetMessage(fb58d2e09a2a1ce6).(Message_namescxx . . $ Message_names.[j]);
432
433 return 1;
434 }
435
436 // =============
437 // ShutdownDLL()
438 // =============
439 void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) { ClearMessageListcxx . . $ ClearMessageList(49f6e7a06ebc5aa8).(); }
440
441 // ===============
442 // GetGOScriptID()
443 // ===============
444 int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) { return -1; }
445
446 // ================
447 // CreateInstance()
448 // ================
449 void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) {
450 switch (id) {
451 case ID_LEVEL_0000cxx . . $ `scripts/Y2K.cpp:54:9`!:
452 return new LevelScript_0000cxx . . $ LevelScript_0000#;
453 break;
454 default:
455 mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id);
456 break;
457 }
458 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
459 }
460
461 // =================
462 // DestroyInstance()
463 // =================
464 void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) {
465 switch (id) {
466 case ID_LEVEL_0000cxx . . $ `scripts/Y2K.cpp:54:9`!:
467 delete ((LevelScript_0000cxx . . $ LevelScript_0000# *)ptr);
468 default:
469 mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id);
470 break;
471 }
472 }
473
474 // ===================
475 // CallInstanceEvent()
476 // ===================
477 int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
478 switch (id) {
479 case ID_LEVEL_0000cxx . . $ `scripts/Y2K.cpp:54:9`!:
480 return ((BaseScriptcxx . . $ BaseScript# *)ptr)->CallEventcxx . . $ BaseScript#CallEvent(585a6502c7945bab).(event, data);
481 break;
482 default:
483 mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id);
484 break;
485 }
486 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
487 }
488
489 // ==================
490 // SaveRestoreState()
491 // ==================
492 int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) { return 0; }
493
494 // ====================
495 // GetTriggerScriptID()
496 // ====================
497 int STDCALLcxx . . $ `lib/module.h:88:11`! GetTriggerScriptIDcxx . . $ GetTriggerScriptID(9b79fb6aee4c0440).(int trigger_room, int trigger_face) { return -1; }
498
499 // =================
500 // GetCOScriptList()
501 // =================
502 int STDCALLcxx . . $ `lib/module.h:88:11`! GetCOScriptListcxx . . $ GetCOScriptList(4454eefbcea844d6).(int **list, int **id_list) {
503 static int *cust_handle_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
504 static int *cust_id_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
505
506 *list = cust_handle_list;
507 *id_list = cust_id_list;
508
509 return 0;
510 }
511
512 //=======================
513 // Script Implementation
514 //=======================
515
516 BaseScriptcxx . . $ BaseScript#::BaseScriptcxx . . $ BaseScript#BaseScript(49f6e7a06ebc5aa8).() {}
517
518 BaseScriptcxx . . $ BaseScript#::~cxx . . $ BaseScript#`~BaseScript`(ced63f7c635d850d).BaseScriptcxx . . $ BaseScript#() {}
519
520 int16_t BaseScriptcxx . . $ BaseScript#::CallEventcxx . . $ BaseScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
521 mprintfcxx . . $ mprintf.(0, "BaseScript::CallEvent()\n");
522 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
523 }
524
525 int16_t LevelScript_0000cxx . . $ LevelScript_0000#::CallEventcxx . . $ LevelScript_0000#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
526 switch (event) {
527 case EVT_SAVESTATEcxx . . $ `scripts/osiris_common.h:376:9`!: {
528 tOSIRISEVTSAVESTATEcxx . . $ tOSIRISEVTSAVESTATE# *event_data = &data->evt_savestatecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_savestate.;
529
530 SaveGlobalActionCtrscxx . . $ SaveGlobalActionCtrs(5d22bdacc48458e8).(event_data->fileptrcxx . . $ tOSIRISEVTSAVESTATE#fileptr.);
531 dfSavecxx . . $ dfSave(5d22bdacc48458e8).(event_data->fileptrcxx . . $ tOSIRISEVTSAVESTATE#fileptr.);
532 #ifdef ENABLE_CUSTOM_SAVE_AND_RESTORE
533 dsCustomSave(event_data->fileptr);
534 #endif
535 } break;
536 case EVT_RESTORESTATEcxx . . $ `scripts/osiris_common.h:377:9`!: {
537 tOSIRISEVTRESTORESTATEcxx . . $ tOSIRISEVTRESTORESTATE# *event_data = &data->evt_restorestatecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_restorestate.;
538
539 RestoreGlobalActionCtrscxx . . $ RestoreGlobalActionCtrs(5d22bdacc48458e8).(event_data->fileptrcxx . . $ tOSIRISEVTRESTORESTATE#fileptr.);
540 dfRestorecxx . . $ dfRestore(5d22bdacc48458e8).(event_data->fileptrcxx . . $ tOSIRISEVTRESTORESTATE#fileptr.);
541 #ifdef ENABLE_CUSTOM_SAVE_AND_RESTORE
542 dsCustomRestore(event_data->fileptr);
543 #endif
544 } break;
545 case EVT_LEVELSTARTcxx . . $ `scripts/osiris_common.h:373:9`!: {
546 tOSIRISEVTLEVELSTARTcxx . . $ tOSIRISEVTLEVELSTART# *event_data = &data->evt_levelstartcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_levelstart.;
547
548 ClearGlobalActionCtrscxx . . $ ClearGlobalActionCtrs(49f6e7a06ebc5aa8).();
549 dfInitcxx . . $ dfInit(49f6e7a06ebc5aa8).();
550
551 // Script 002: Frogs
552 if (1) {
553 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(Sound_indexescxx . . $ Sound_indexes.[0], Object_handlescxx . . $ Object_handles.[0], 1.000000f);
554
555 // Increment the script action counter
556 if (ScriptActionCtr_002cxx . . $ ScriptActionCtr_002. < MAX_ACTION_CTR_VALUEcxx . . $ `scripts/Y2K.cpp:76:9`!)
557 ScriptActionCtr_002cxx . . $ ScriptActionCtr_002.++;
558 }
559
560 // Script 001: Insects
561 if (1) {
562 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(Sound_indexescxx . . $ Sound_indexes.[1], Object_handlescxx . . $ Object_handles.[1], 1.000000f);
563
564 // Increment the script action counter
565 if (ScriptActionCtr_001cxx . . $ ScriptActionCtr_001. < MAX_ACTION_CTR_VALUEcxx . . $ `scripts/Y2K.cpp:76:9`!)
566 ScriptActionCtr_001cxx . . $ ScriptActionCtr_001.++;
567 }
568 } break;
569 }
570 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
571 }
572
573 /*********************************************************
574 Script Save Block: DO NOT TOUCH ANYTHING IN THIS BLOCK!!!
575 **********************************************************
576 $$SCRIPT_BLOCK_START
577
578 VERSION 3
579 NEXT_ID 3
580
581 // UserType value blocks
582 $$UTYPE_VALS_START UserVar
583 $$UTYPE_VALS_END
584
585 $$UTYPE_VALS_START UserFlag
586 $$UTYPE_VALS_END
587
588 $$UTYPE_VALS_START SpewHandle
589 $$UTYPE_VALS_END
590
591 $$UTYPE_VALS_START TimerID
592 $$UTYPE_VALS_END
593
594 $$UTYPE_VALS_START SavedObjectSlot
595 $$UTYPE_VALS_END
596
597 $$UTYPE_VALS_START GoalID
598 $$UTYPE_VALS_END
599
600
601 // Name Lists
602 $$DOOR_LIST_START
603 $$DOOR_LIST_END
604
605 $$OBJECT_LIST_START
606 Swamp
607 Forest
608 $$OBJECT_LIST_END
609
610 $$ROOM_LIST_START
611 $$ROOM_LIST_END
612
613 $$TRIGGER_LIST_START
614 $$TRIGGER_LIST_END
615
616 $$SOUND_LIST_START
617 AmbIslandFroggies
618 AmbBugsGroundB
619 $$SOUND_LIST_END
620
621 $$TEXTURE_LIST_START
622 $$TEXTURE_LIST_END
623
624 $$SPECNAME_LIST_START
625 $$SPECNAME_LIST_END
626
627 $$PATH_LIST_START
628 $$PATH_LIST_END
629
630 $$MATCEN_LIST_START
631 $$MATCEN_LIST_END
632
633 $$GOAL_LIST_START
634 $$GOAL_LIST_END
635
636 $$STRM_AUDIO_LIST_START
637 $$STRM_AUDIO_LIST_END
638
639
640 // Script Tree Dump
641 00:2:Frogs
642 $$CHILD_BLOCK_START
643 01:2:0
644 02:6
645 03:0
646 $$CHILD_BLOCK_START
647 05:0
648 $$CHILD_BLOCK_END
649 04:0:0:0
650 $$CHILD_BLOCK_START
651 08:aSoundPlayObject
652 $$CHILD_BLOCK_START
653 10:12:0:Sound
654 10:1:0:0:Object
655 10:9:1.000000:Volume
656 $$CHILD_BLOCK_END
657 $$CHILD_BLOCK_END
658 $$CHILD_BLOCK_END
659 00:1:Insects
660 $$CHILD_BLOCK_START
661 01:2:0
662 02:6
663 03:0
664 $$CHILD_BLOCK_START
665 05:0
666 $$CHILD_BLOCK_END
667 04:0:0:0
668 $$CHILD_BLOCK_START
669 08:aSoundPlayObject
670 $$CHILD_BLOCK_START
671 10:12:1:Sound
672 10:1:0:1:Object
673 10:9:1.000000:Volume
674 $$CHILD_BLOCK_END
675 $$CHILD_BLOCK_END
676 $$CHILD_BLOCK_END
677
678 $$SCRIPT_BLOCK_END
679 *********************************************************/