Debian Codegraph @

scripts/generic.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 // generic.cpp
20 // 0.1
21 #include <cstdio>
22 #include <cstdlib>
23 #include <cstring>
24 #include <cstdarg>
25 #include "osiris_import.h"cxx . . $ `<file>/scripts/osiris_import.h`/
26 #include "osiris_common.h"cxx . . $ `<file>/scripts/osiris_common.h`/
27
28 #include "module.h"cxx . . $ `<file>/lib/module.h`/
29
30 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
31 extern "C" {
32 #endif
33 DLLEXPORTcxx . . $ `lib/module.h:114:9`! char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLL(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list);
34 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLL(void);
35 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptID(const char *name, uint8_tcxx . . $ uint8_t# isdoor);
36 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstance(int id);
37 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstance(int id, void *ptr);
38 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
39 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreState(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state);
40 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
41 }
42 #endif
43
44 int String_table_sizecxx . . $ String_table_size. = 0;
45 char **String_tablecxx . . $ String_table. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
46 static const char *_Error_stringcxx . . $ _Error_string. = "!!ERROR MISSING STRING!!";
47 static const char *_Empty_stringcxx . . $ _Empty_string. = "";
48 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int index) {
49 if ((index < 0) || (index >= String_table_sizecxx . . $ String_table_size.))
50 return _Error_stringcxx . . $ _Error_string.;
51 if (!String_tablecxx . . $ String_table.[index])
52 return _Empty_stringcxx . . $ _Empty_string.;
53 return String_tablecxx . . $ String_table.[index];
54 }
55 #define TXTcxx . . $ `scripts/generic.cpp:55:9`!(x) GetStringFromTable(x)
56 #define TXT_DOORLOCKEDcxx . . $ `scripts/generic.cpp:56:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(0) //"Door Locked!"
57 #define TXT_RAPIDFIREcxx . . $ `scripts/generic.cpp:57:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(1) //"Rapid Fire!"
58 #define TXT_FORCEWALLcxx . . $ `scripts/generic.cpp:58:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(2) //"Force Wall!"
59 #define TXT_FORCEWALLEJECTcxx . . $ `scripts/generic.cpp:59:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(3) //"Force Wall Ejected!"
60 #define TXT_FORCEWALLDONEcxx . . $ `scripts/generic.cpp:60:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(4) //"Force Wall Done!"
61 #define TXT_WINGNUTcxx . . $ `scripts/generic.cpp:61:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(5) //"WingNut!"
62 #define TXT_RAPIDFIREOFFcxx . . $ `scripts/generic.cpp:62:9`! TXTcxx . . $ `scripts/generic.cpp:55:9`!(6) //"Rapid Fire Off!"
63 // ================
64 // Helper Functions
65 // ================
66 void AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(int player_objhandle, int color, const char *format, ...);
67
68 #define ID_RAPIDFIREcxx . . $ `scripts/generic.cpp:68:9`! 0
69 #define ID_FORCEWALLcxx . . $ `scripts/generic.cpp:69:9`! 1
70 #define ID_WINGNUTcxx . . $ `scripts/generic.cpp:70:9`! 2
71 #define NUM_IDScxx . . $ `scripts/generic.cpp:71:9`! 3
72
73 // Common Powerups
74 // Weapon Powerups
75 // Ammo Powerups
76 #define GENERIC_POWERUP_SCRIPTIDcxx . . $ `scripts/generic.cpp:76:9`! NUM_IDScxx . . $ `scripts/generic.cpp:71:9`!
77 // Generic Door Script
78 #define GENERIC_DOOR_SCRIPTIDcxx . . $ `scripts/generic.cpp:78:9`! NUM_IDScxx . . $ `scripts/generic.cpp:71:9`! + 1
79
80 struct tScriptIDInfocxx . . $ tScriptIDInfo# {
81 int idcxx . . $ tScriptIDInfo#id.;
82 const char *namecxx . . $ tScriptIDInfo#name.;
83 };
84
85 tScriptIDInfocxx . . $ tScriptIDInfo# ScriptIDInfocxx . . $ ScriptIDInfo.[NUM_IDScxx . . $ `scripts/generic.cpp:71:9`!] = {
86 {ID_RAPIDFIREcxx . . $ `scripts/generic.cpp:68:9`!, "RapidFire"}, {ID_FORCEWALLcxx . . $ `scripts/generic.cpp:69:9`!, "Forcewall"}, {ID_WINGNUTcxx . . $ `scripts/generic.cpp:70:9`!, "GoWingNut"}};
87
88 class GenericScriptcxx . . $ GenericScript# {
89 public:
90 GenericScriptcxx . . $ GenericScript#GenericScript(49f6e7a06ebc5aa8).() {}
91 virtual int16_t CallEventcxx . . $ GenericScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
92
93 protected:
94 };
95
96 class GenericDoorcxx . . $ GenericDoor# : public GenericScriptcxx . . $ GenericScript# {
97 public:
98 GenericDoorcxx . . $ GenericDoor#GenericDoor(49f6e7a06ebc5aa8).() {}
99 int16_t CallEventcxx . . $ GenericDoor#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
100 };
101
102 struct forcewallmemorycxx . . $ forcewallmemory# {
103 int object_handlecxx . . $ forcewallmemory#object_handle.;
104 };
105
106 class ForceWallScriptcxx . . $ ForceWallScript# : public GenericScriptcxx . . $ GenericScript# {
107 public:
108 ForceWallScriptcxx . . $ ForceWallScript#ForceWallScript(49f6e7a06ebc5aa8).();
109 int16_t CallEventcxx . . $ ForceWallScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
110 forcewallmemorycxx . . $ forcewallmemory# *memorycxx . . $ ForceWallScript#memory.;
111 };
112
113 class WingNutScriptcxx . . $ WingNutScript# : public GenericScriptcxx . . $ GenericScript# {
114 public:
115 WingNutScriptcxx . . $ WingNutScript#WingNutScript(49f6e7a06ebc5aa8).() {}
116 int16_t CallEventcxx . . $ WingNutScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
117 };
118
119 struct tPlayerTimerInfocxx . . $ tPlayerTimerInfo# {
120 int timer_handlecxx . . $ tPlayerTimerInfo#timer_handle.;
121 };
122 tPlayerTimerInfocxx . . $ tPlayerTimerInfo# RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[MAX_PLAYERScxx . . $ `scripts/osiris_common.h:927:9`!];
123
124 struct rapidfirememorycxx . . $ rapidfirememory# {
125 int collided_objectcxx . . $ rapidfirememory#collided_object.;
126 uint8_tcxx . . $ uint8_t# collided_pnumcxx . . $ rapidfirememory#collided_pnum.;
127 };
128
129 class RapidFireScriptcxx . . $ RapidFireScript# : public GenericScriptcxx . . $ GenericScript# {
130 public:
131 RapidFireScriptcxx . . $ RapidFireScript#RapidFireScript(49f6e7a06ebc5aa8).();
132
133 int16_t CallEventcxx . . $ RapidFireScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
134 rapidfirememorycxx . . $ rapidfirememory# *memorycxx . . $ RapidFireScript#memory.;
135 };
136
137 // InitializeDLL
138 // Purpose:
139 // This function gets called when the DLL first gets loaded. It will only be called once (until the
140 // DLL is unloaded). Passed in is a struct of data passed from the game needed for the DLL to interact
141 // with D3. Usually this function will just call osicommon_Initialize(), which sets up the imported
142 // functions. However, you can alloc some memory or whatever in this function, and free it in ShutdownDLL().
143 // Note: You cannot call any imported functions until osicommon_Initialize() is called.
144 // Returns 1 if initialization went ok, 0 if there was an error and the DLL should not be loaded.
145 char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) {
146 osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list);
147 if (func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum. != CHECKSUMcxx . . $ `<built-in>:476:9`!) {
148 mprintfcxx . . $ mprintf.(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum., CHECKSUMcxx . . $ `<built-in>:476:9`!);
149 mprintfcxx . . $ mprintf.(0, "RECOMPILE YOUR SCRIPTS!!!\n");
150 return 0;
151 }
152
153 String_table_sizecxx . . $ String_table_size. = func_list->string_countcxx . . $ tOSIRISModuleInit#string_count.;
154 String_tablecxx . . $ String_table. = func_list->string_tablecxx . . $ tOSIRISModuleInit#string_table.;
155
156 int i;
157
158 // initialize rapid fire script data
159 for (i = 0; i < MAX_PLAYERScxx . . $ `scripts/osiris_common.h:927:9`!; i++) {
160 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[i].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = -1;
161 }
162
163 return 1;
164 }
165
166 // ShutdownDLL
167 // Purpose:
168 // This function is called right before a DLL is about to be unloaded from memory. You can free
169 // any unfree'd memory, or anything else you need to do. Don't worry about destroying any instances
170 // of scripts, as they will all be automatically destroyed before this function is called. The
171 // same goes for any memory allocated with Scrpt_MemAlloc(), as this will automatically be freed
172 // when a scripts instance is destroyed.
173 void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) {}
174
175 // GetGOScriptID
176 // Purpose:
177 // Given the name of the object (from it's pagename), this function will search through it's
178 // list of General Object Scripts for a script with a matching name (to see if there is a script
179 // for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID
180 // is to be returned back to Descent 3. This ID will be used from here on out for all future
181 // interaction with the DLL. Since doors are not part of the generic object's, it's possible
182 // for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER
183 // or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a
184 // door, else it is a 0. The return value is the unique identifier, else -1 if the script
185 // does not exist in the DLL.
186 int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) {
187 if (!isdoor) {
188 for (int i = 0; i < NUM_IDScxx . . $ `scripts/generic.cpp:71:9`!; i++) {
189 if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(ScriptIDInfo[i].name, name))
190 return ScriptIDInfocxx . . $ ScriptIDInfo.[i].idcxx . . $ tScriptIDInfo#id.;
191 }
192 }
193
194 return (isdoor) ? GENERIC_DOOR_SCRIPTIDcxx . . $ `scripts/generic.cpp:78:9`! : GENERIC_POWERUP_SCRIPTIDcxx . . $ `scripts/generic.cpp:76:9`!;
195 }
196
197 // CreateInstance
198 // Purpose:
199 // Given an ID from a call to GetGOScriptID(), this function will create a new instance for that
200 // particular script (by allocating and initializing memory, etc.). A pointer to this instance
201 // is to be returned back to Descent 3. This pointer will be passed around, along with the ID
202 // for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error.
203 void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) {
204 switch (id) {
205 case GENERIC_POWERUP_SCRIPTIDcxx . . $ `scripts/generic.cpp:76:9`!:
206 return new GenericScriptcxx . . $ GenericScript#;
207 break;
208 case GENERIC_DOOR_SCRIPTIDcxx . . $ `scripts/generic.cpp:78:9`!:
209 return new GenericDoorcxx . . $ GenericDoor#;
210 break;
211 case ID_RAPIDFIREcxx . . $ `scripts/generic.cpp:68:9`!:
212 return new RapidFireScriptcxx . . $ RapidFireScript#;
213 break;
214 case ID_WINGNUTcxx . . $ `scripts/generic.cpp:70:9`!:
215 return new WingNutScriptcxx . . $ WingNutScript#;
216 break;
217 case ID_FORCEWALLcxx . . $ `scripts/generic.cpp:69:9`!:
218 return new ForceWallScriptcxx . . $ ForceWallScript#;
219 break;
220 };
221
222 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
223 }
224
225 // DestroyInstance
226 // Purpose:
227 // Given an ID, and a pointer to a particular instance of a script, this function will delete and
228 // destruct all information associated with that script, so it will no longer exist.
229 void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) {
230 switch (id) {
231 case GENERIC_POWERUP_SCRIPTIDcxx . . $ `scripts/generic.cpp:76:9`!:
232 delete ((GenericScriptcxx . . $ GenericScript# *)ptr);
233 break;
234 case GENERIC_DOOR_SCRIPTIDcxx . . $ `scripts/generic.cpp:78:9`!:
235 delete ((GenericDoorcxx . . $ GenericDoor# *)ptr);
236 break;
237 case ID_RAPIDFIREcxx . . $ `scripts/generic.cpp:68:9`!:
238 delete ((RapidFireScriptcxx . . $ RapidFireScript# *)ptr);
239 break;
240 case ID_WINGNUTcxx . . $ `scripts/generic.cpp:70:9`!:
241 delete ((WingNutScriptcxx . . $ WingNutScript# *)ptr);
242 break;
243 case ID_FORCEWALLcxx . . $ `scripts/generic.cpp:69:9`!:
244 delete ((ForceWallScriptcxx . . $ ForceWallScript# *)ptr);
245 break;
246 };
247 }
248
249 // CallInstanceEvent
250 // Purpose:
251 // Given an ID, a pointer to a script instance, an event and a pointer to the struct of
252 // information about the event, this function will translate who this event belongs to and
253 // passes the event to that instance of the script to be handled. Return a combination of
254 // CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the
255 // event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level
256 // script, mission script, and finally default script). If CONTINUE_CHAIN is not specified,
257 // than the chain is broken and those scripts of lower priority will never get the event. Return
258 // CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into
259 // the game for that event. This only pertains to certain events. If the chain continues
260 // after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority
261 // scripts return value.
262 int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
263 switch (id) {
264 case GENERIC_POWERUP_SCRIPTIDcxx . . $ `scripts/generic.cpp:76:9`!:
265 case GENERIC_DOOR_SCRIPTIDcxx . . $ `scripts/generic.cpp:78:9`!:
266 case ID_RAPIDFIREcxx . . $ `scripts/generic.cpp:68:9`!:
267 case ID_FORCEWALLcxx . . $ `scripts/generic.cpp:69:9`!:
268 case ID_WINGNUTcxx . . $ `scripts/generic.cpp:70:9`!:
269 return ((GenericScriptcxx . . $ GenericScript# *)ptr)->CallEventcxx . . $ GenericScript#CallEvent(585a6502c7945bab).(event, data);
270 break;
271 };
272
273 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
274 }
275
276 // SaveRestoreState
277 // Purpose:
278 // This function is called when Descent 3 is saving or restoring the game state. In this function
279 // you should save/restore any global data that you want preserved through load/save (which includes
280 // demos). You must be very careful with this function, corrupting the file (reading or writing too
281 // much or too little) may be hazardous to the game (possibly making it impossible to restore the
282 // state). It would be best to use version information to keep older versions of saved states still
283 // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE
284 // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should
285 // write data to the file_ptr, 0 when you should read in the data.
286 #define VERSIONcxx . . $ `scripts/generic.cpp:286:9`! 0x01
287 int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) {
288 int size = 0;
289
290 int i;
291 int version = VERSIONcxx . . $ `scripts/generic.cpp:286:9`!;
292
293 if (saving_state) {
294 File_WriteBytecxx . . $ File_WriteByte.(VERSIONcxx . . $ `scripts/generic.cpp:286:9`!, file_ptr);
295 size++;
296
297 // save out rapid fire data
298 for (i = 0; i < MAX_PLAYERScxx . . $ `scripts/osiris_common.h:927:9`!; i++) {
299 File_WriteIntcxx . . $ File_WriteInt.(RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[i].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle., file_ptr);
300 size += sizeof(int);
301 }
302 } else {
303 version = File_ReadBytecxx . . $ File_ReadByte.(file_ptr);
304 size++;
305
306 // restore rapid fire data
307 for (i = 0; i < MAX_PLAYERScxx . . $ `scripts/osiris_common.h:927:9`!; i++) {
308 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[i].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = File_ReadIntcxx . . $ File_ReadInt.(file_ptr);
309 size += sizeof(int);
310 }
311 }
312
313 return size;
314 }
315
316 int16_t GenericScriptcxx . . $ GenericScript#::CallEventcxx . . $ GenericScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
317 switch (event) {
318 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: {
319 msafe_structcxx . . $ msafe_struct# ms;
320 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
321 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
322 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
323 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
324 ms.ithandlecxx . . $ msafe_struct#ithandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
325 ms.playsoundcxx . . $ msafe_struct#playsound. = 1;
326 MSafe_DoPowerupcxx . . $ MSafe_DoPowerup.(&ms);
327 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
328 }
329 } break;
330 }
331 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
332 }
333
334 int16_t GenericDoorcxx . . $ GenericDoor#::CallEventcxx . . $ GenericDoor#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
335 switch (event) {
336 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: {
337 msafe_structcxx . . $ msafe_struct# ms;
338 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
339 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
340 if (ms.typecxx . . $ msafe_struct#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) {
341 msafe_structcxx . . $ msafe_struct# mit;
342
343 mit.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
344 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &mit);
345
346 if (mit.typecxx . . $ msafe_struct#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!) {
347 break;
348 }
349
350 // See if door is openable
351 ms.ithandlecxx . . $ msafe_struct#ithandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
352 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_DOOR_OPENABLEcxx . . $ `scripts/osiris_common.h:877:9`!, &ms);
353
354 if (ms.statecxx . . $ msafe_struct#state.) {
355 // openable door
356 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_DOOR_ACTIVATEcxx . . $ `scripts/osiris_common.h:874:9`!, &ms);
357 } else {
358 // non-openable door. If locked, give a message
359 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_DOOR_LOCK_STATEcxx . . $ `scripts/osiris_common.h:873:9`!, &ms);
360 if (ms.statecxx . . $ msafe_struct#state.) { // locked!
361 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
362
363 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_PARENTcxx . . $ `scripts/osiris_common.h:834:9`!, &ms);
364 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
365
366 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
367 strcpy(ms.messagecxx . . $ msafe_struct#message., TXT_DOORLOCKEDcxx . . $ `scripts/generic.cpp:56:9`!);
368 ms.colorcxx . . $ msafe_struct#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0);
369 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_MISC_FILTERED_HUD_MESSAGEcxx . . $ `scripts/osiris_common.h:891:9`!, &ms);
370
371 ms.statecxx . . $ msafe_struct#state. = 1; // specific player
372 ms.indexcxx . . $ msafe_struct#index. = Scrpt_FindSoundNamecxx . . $ Scrpt_FindSoundName.("DoorIsLocked");
373 ms.volumecxx . . $ msafe_struct#volume. = 0.80f;
374 if (ms.indexcxx . . $ msafe_struct#index. != -1)
375 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_SOUND_2Dcxx . . $ `scripts/osiris_common.h:866:9`!, &ms);
376 }
377 }
378 }
379 }
380 } break;
381 }
382 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
383 }
384
385 RapidFireScriptcxx . . $ RapidFireScript#::RapidFireScriptcxx . . $ RapidFireScript#RapidFireScript(49f6e7a06ebc5aa8).() { memorycxx . . $ RapidFireScript#memory. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; }
386
387 #define RAPIDFIRE_RECHARGEcxx . . $ `scripts/generic.cpp:387:9`! 0.7f
388 int16_t RapidFireScriptcxx . . $ RapidFireScript#::CallEventcxx . . $ RapidFireScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
389 switch (event) {
390 case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: {
391 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
392 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
393 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(rapidfirememorycxx . . $ rapidfirememory#);
394 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
395 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
396
397 memorycxx . . $ RapidFireScript#memory. = (rapidfirememorycxx . . $ rapidfirememory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
398 memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum. = 255;
399 memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
400
401 } break;
402
403 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: {
404 memorycxx . . $ RapidFireScript#memory. = (rapidfirememorycxx . . $ rapidfirememory# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
405 } break;
406
407 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: {
408 if (!memorycxx . . $ RapidFireScript#memory.)
409 break;
410
411 msafe_structcxx . . $ msafe_struct# ms;
412 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
413 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
414
415 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
416
417 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_RAPIDFIREcxx . . $ `scripts/generic.cpp:57:9`!);
418 int sound_id = Sound_FindIdcxx . . $ Sound_FindId.("RapidFireOn");
419 Sound_Play3dcxx . . $ Sound_Play3d(1df3af30621f6c78).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., sound_id);
420
421 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
422 memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum. = ms.idcxx . . $ msafe_struct#id.;
423 memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
424
425 if (RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. != -1) {
426
427 // check to see if the player currently has rapid fire
428 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_RECHARGE_SCALARcxx . . $ `scripts/osiris_common.h:807:9`!, &ms);
429 if (ms.scalarcxx . . $ msafe_struct#scalar. == RAPIDFIRE_RECHARGEcxx . . $ `scripts/generic.cpp:387:9`!) {
430 // the player currently has rapid fire
431 // the player possibly has rapid fire set, check to make sure
432 if (Scrpt_TimerExistscxx . . $ Scrpt_TimerExists.(RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle.)) {
433 // cancel the old timer so we can create a new timer (give them more time)
434 Scrpt_CancelTimercxx . . $ Scrpt_CancelTimer.(RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle.);
435 }
436
437 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = -1;
438 } else {
439 // rapid fire was stolen from the player
440 }
441 }
442
443 memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum. = ms.idcxx . . $ msafe_struct#id.;
444 tOSIRISTIMERcxx . . $ tOSIRISTIMER# ti;
445 ti.flagscxx . . $ tOSIRISTIMER#flags. = OTF_CANCELONDEADcxx . . $ `scripts/osiris_common.h:1171:9`!;
446 ti.idcxx . . $ tOSIRISTIMER#id. = 31;
447 ti.object_handlecxx . . $ tOSIRISTIMER#$anonymous_type_2#object_handle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
448 ti.object_handle_detonatorcxx . . $ tOSIRISTIMER#object_handle_detonator. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
449 ti.timer_intervalcxx . . $ tOSIRISTIMER#timer_interval. = 30;
450 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = Scrpt_CreateTimercxx . . $ Scrpt_CreateTimer.(&ti);
451
452 // ghost the object
453 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
454 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_GHOSTcxx . . $ `scripts/osiris_common.h:817:9`!, &ms);
455
456 // set player scalar
457 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
458 ms.scalarcxx . . $ msafe_struct#scalar. = RAPIDFIRE_RECHARGEcxx . . $ `scripts/generic.cpp:387:9`!;
459 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_RECHARGE_SCALARcxx . . $ `scripts/osiris_common.h:807:9`!, &ms);
460 }
461
462 } break;
463 case EVT_TIMERcxx . . $ `scripts/osiris_common.h:369:9`!: {
464 if (!memorycxx . . $ RapidFireScript#memory.)
465 break;
466
467 msafe_structcxx . . $ msafe_struct# ms;
468 ms.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object.;
469 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_RECHARGE_SCALARcxx . . $ `scripts/osiris_common.h:807:9`!, &ms);
470
471 if (ms.scalarcxx . . $ msafe_struct#scalar. == RAPIDFIRE_RECHARGEcxx . . $ `scripts/generic.cpp:387:9`!) {
472 // reset recharge scalar
473 ms.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object.;
474 ms.scalarcxx . . $ msafe_struct#scalar. = 1.0f;
475 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_RECHARGE_SCALARcxx . . $ `scripts/osiris_common.h:807:9`!, &ms);
476 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = -1;
477 }
478
479 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_RAPIDFIREOFFcxx . . $ `scripts/generic.cpp:62:9`!);
480 int sound_id = Sound_FindIdcxx . . $ Sound_FindId.("RapidFireOff");
481 Sound_Play3dcxx . . $ Sound_Play3d(1df3af30621f6c78).(memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object., sound_id);
482
483 // destroy the powerup
484 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
485 ms.playsoundcxx . . $ msafe_struct#playsound. = 0;
486 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &ms);
487
488 } break;
489 case EVT_TIMERCANCELcxx . . $ `scripts/osiris_common.h:380:9`!: {
490 msafe_structcxx . . $ msafe_struct# ms;
491
492 // destroy the powerup
493 ms.playsoundcxx . . $ msafe_struct#playsound. = 0;
494 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
495 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &ms);
496 } break;
497 case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: {
498 // check (if we are ghosted...meaning picked up) if the player
499 // that picked us up still has rapid fire
500 if (memorycxx . . $ RapidFireScript#memory. && memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum. != 255) {
501 // check the player to make sure he is still charged up
502 msafe_structcxx . . $ msafe_struct# ms;
503 ms.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object.;
504 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_RECHARGE_SCALARcxx . . $ `scripts/osiris_common.h:807:9`!, &ms);
505
506 if (ms.scalarcxx . . $ msafe_struct#scalar. != RAPIDFIRE_RECHARGEcxx . . $ `scripts/generic.cpp:387:9`!) {
507 // player no longer recharged! cancel timer
508 if (Scrpt_TimerExistscxx . . $ Scrpt_TimerExists.(RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle.)) {
509 // cancel the timer
510 mprintfcxx . . $ mprintf.(0, "CANCELING RAPID FIRE TIMER FOR PLAYER %d\n", memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.);
511 Scrpt_CancelTimercxx . . $ Scrpt_CancelTimer.(RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle.);
512
513 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_RAPIDFIREOFFcxx . . $ `scripts/generic.cpp:62:9`!);
514 int sound_id = Sound_FindIdcxx . . $ Sound_FindId.("RapidFireOff");
515 Sound_Play3dcxx . . $ Sound_Play3d(1df3af30621f6c78).(memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object., sound_id);
516 }
517
518 RapidFirePlayerTimerscxx . . $ RapidFirePlayerTimers.[memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum.].timer_handlecxx . . $ tPlayerTimerInfo#timer_handle. = -1;
519 memorycxx . . $ RapidFireScript#memory.->collided_pnumcxx . . $ rapidfirememory#collided_pnum. = 255;
520 memorycxx . . $ RapidFireScript#memory.->collided_objectcxx . . $ rapidfirememory#collided_object. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
521 }
522 }
523
524 } break;
525 }
526
527 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
528 }
529
530 ForceWallScriptcxx . . $ ForceWallScript#::ForceWallScriptcxx . . $ ForceWallScript#ForceWallScript(49f6e7a06ebc5aa8).() { memorycxx . . $ ForceWallScript#memory. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; }
531
532 int16_t ForceWallScriptcxx . . $ ForceWallScript#::CallEventcxx . . $ ForceWallScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
533 switch (event) {
534
535 case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: {
536 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
537 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
538 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(forcewallmemorycxx . . $ forcewallmemory#);
539 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
540 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
541
542 memorycxx . . $ ForceWallScript#memory. = (forcewallmemorycxx . . $ forcewallmemory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
543 memorycxx . . $ ForceWallScript#memory.->object_handlecxx . . $ forcewallmemory#object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
544
545 } break;
546
547 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: {
548 memorycxx . . $ ForceWallScript#memory. = (forcewallmemorycxx . . $ forcewallmemory# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
549 } break;
550
551 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: {
552 if (!memorycxx . . $ ForceWallScript#memory.)
553 break;
554
555 msafe_structcxx . . $ msafe_struct# ms;
556 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
557 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
558 int pnum;
559
560 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
561 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
562 pnum = ms.idcxx . . $ msafe_struct#id.;
563
564 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_FORCEWALLcxx . . $ `scripts/generic.cpp:58:9`!);
565
566 // add a force wall to the inventory
567 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
568 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
569 ms.slotcxx . . $ msafe_struct#slot. = pnum;
570 ms.typecxx . . $ msafe_struct#type. = OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!;
571 ms.flagscxx . . $ msafe_struct#flags. = INVAF_TIMEOUTONSPEWcxx . . $ `scripts/osiris_common.h:766:9`!;
572 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_INVEN_ADD_TYPE_IDcxx . . $ `scripts/osiris_common.h:896:9`!, &ms);
573
574 // pickit up
575 ms.playsoundcxx . . $ msafe_struct#playsound. = 1;
576 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &ms);
577 }
578 } break;
579 case EVT_USEcxx . . $ `scripts/osiris_common.h:370:9`!: {
580 if (!memorycxx . . $ ForceWallScript#memory.)
581 break;
582
583 msafe_structcxx . . $ msafe_struct# ms;
584
585 // Eject a ForceWall and make it last for 60 seconds
586 memorycxx . . $ ForceWallScript#memory.->object_handlecxx . . $ forcewallmemory#object_handle. = data->evt_usecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_use..it_handlecxx . . $ tOSIRISEVTUSE#it_handle.; // save the player for when the timer is up
587
588 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(memorycxx . . $ ForceWallScript#memory.->object_handlecxx . . $ forcewallmemory#object_handle., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_FORCEWALLEJECTcxx . . $ `scripts/generic.cpp:59:9`!);
589
590 // ghost the object and set a timer
591 tOSIRISTIMERcxx . . $ tOSIRISTIMER# ti;
592 ti.flagscxx . . $ tOSIRISTIMER#flags. = 0; // not a volatile object when dropped
593 ti.idcxx . . $ tOSIRISTIMER#id. = 32;
594 ti.object_handlecxx . . $ tOSIRISTIMER#$anonymous_type_2#object_handle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
595 ti.timer_intervalcxx . . $ tOSIRISTIMER#timer_interval. = 60;
596 Scrpt_CreateTimercxx . . $ Scrpt_CreateTimer.(&ti);
597
598 // ghost the object
599 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
600 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_GHOSTcxx . . $ `scripts/osiris_common.h:817:9`!, &ms);
601
602 // Do the Force Wall stuff here
603
604 } break;
605 case EVT_TIMERcxx . . $ `scripts/osiris_common.h:369:9`!: {
606 if (!memorycxx . . $ ForceWallScript#memory.)
607 break;
608
609 msafe_structcxx . . $ msafe_struct# ms;
610
611 // End Force Wall stuff here
612
613 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(memorycxx . . $ ForceWallScript#memory.->object_handlecxx . . $ forcewallmemory#object_handle., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_FORCEWALLDONEcxx . . $ `scripts/generic.cpp:60:9`!);
614
615 // UnGhost the object
616 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
617 //@@MSafe_CallFunction(MSAFE_OBJECT_UNGHOST,&ms);
618
619 // destroy the powerup
620 ms.playsoundcxx . . $ msafe_struct#playsound. = 0;
621 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &ms);
622
623 } break;
624 }
625
626 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
627 }
628
629 int16_t WingNutScriptcxx . . $ WingNutScript#::CallEventcxx . . $ WingNutScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
630 switch (event) {
631 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: {
632 msafe_structcxx . . $ msafe_struct# ms;
633 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.;
634 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
635 int pnum;
636
637 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
638 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
639 pnum = ms.idcxx . . $ msafe_struct#id.;
640
641 AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle., GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0), TXT_WINGNUTcxx . . $ `scripts/generic.cpp:61:9`!);
642
643 // add a wing nut to the inventory
644 ms.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
645 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
646 ms.slotcxx . . $ msafe_struct#slot. = pnum;
647 ms.typecxx . . $ msafe_struct#type. = OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!;
648 ms.flagscxx . . $ msafe_struct#flags. = INVAF_TIMEOUTONSPEWcxx . . $ `scripts/osiris_common.h:766:9`!;
649 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_INVEN_ADD_TYPE_IDcxx . . $ `scripts/osiris_common.h:896:9`!, &ms);
650
651 // pickit up
652 ms.playsoundcxx . . $ msafe_struct#playsound. = 1;
653 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &ms);
654 }
655 } break;
656 case EVT_USEcxx . . $ `scripts/osiris_common.h:370:9`!: {
657 } break;
658 }
659
660 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
661 }
662
663 void AddHudMessagecxx . . $ AddHudMessage(9514e36549094170).(int player_objhandle, int color, const char *format, ...) {
664 msafe_structcxx . . $ msafe_struct# ms;
665 ms.objhandlecxx . . $ msafe_struct#objhandle. = player_objhandle;
666 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms);
667 if (ms.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
668 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms);
669 ms.slotcxx . . $ msafe_struct#slot. = ms.idcxx . . $ msafe_struct#id.;
670 ms.colorcxx . . $ msafe_struct#color. = color;
671 char big_buffer[1024];
672 va_list marker;
673 va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(marker, format);
674 stdcxx . . $ std/::vsnprintfcxx . . $ std/vsnprintf(348eb892742d8727).(big_buffer, sizeof(big_buffer), format, marker);
675 va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(marker);
676 strncpy(ms.messagecxx . . $ msafe_struct#message., big_buffer, MSAFE_MESSAGE_LENGTHcxx . . $ `scripts/osiris_common.h:1219:9`! - 1);
677 ms.messagecxx . . $ msafe_struct#message.[MSAFE_MESSAGE_LENGTHcxx . . $ `scripts/osiris_common.h:1219:9`! - 1] = '\0';
678
679 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_MISC_FILTERED_HUD_MESSAGEcxx . . $ `scripts/osiris_common.h:891:9`!, &ms);
680 }
681 }