| 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 | // clutter.cpp |
| 20 | // 0.1 |
| 21 | #include <stdio.h> |
| 22 | #include <stdlib.h> |
| 23 | #include <string.h> |
| 24 | #include "osiris_import.h"cxx . . $ `<file>/scripts/osiris_import.h`/ |
| 25 | #include "osiris_common.h"cxx . . $ `<file>/scripts/osiris_common.h`/ |
| 26 | #include "osiris_vector.h"cxx . . $ `<file>/scripts/osiris_vector.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 | static int String_table_sizecxx . . $ String_table_size. = 0; |
| 45 | static char **String_tablecxx . . $ String_table. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 46 | static const char *_Error_stringcxx . . $ _Error_string. = "!!ERROR MISSING STRING!!"; |
| 47 | static const char *_Empty_stringcxx . . $ _Empty_string. = ""; |
| 48 | static 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/clutter.cpp:55:9`!(x) GetStringFromTable(x) |
| 56 | |
| 57 | #define ID_FRAGCRATEcxx . . $ `scripts/clutter.cpp:57:9`! 0 |
| 58 | #define ID_NAPALMBARRELcxx . . $ `scripts/clutter.cpp:58:9`! 1 |
| 59 | #define ID_ALIENCUPLINKcxx . . $ `scripts/clutter.cpp:59:9`! 2 |
| 60 | #define ID_TNTHIGHYIELDcxx . . $ `scripts/clutter.cpp:60:9`! 3 |
| 61 | #define ID_TNTMEDYIELDcxx . . $ `scripts/clutter.cpp:61:9`! 4 |
| 62 | #define ID_FALLINGROCKcxx . . $ `scripts/clutter.cpp:62:9`! 5 |
| 63 | #define ID_LAVAROCKcxx . . $ `scripts/clutter.cpp:63:9`! 6 |
| 64 | |
| 65 | struct tScriptInfocxx . . $ tScriptInfo# { |
| 66 | int idcxx . . $ tScriptInfo#id.; |
| 67 | const char *namecxx . . $ tScriptInfo#name.; |
| 68 | }; |
| 69 | |
| 70 | static tScriptInfocxx . . $ tScriptInfo# ScriptIDscxx . . $ ScriptIDs.[] = {{ID_FRAGCRATEcxx . . $ `scripts/clutter.cpp:57:9`!, "fragcrate"}, |
| 71 | {ID_NAPALMBARRELcxx . . $ `scripts/clutter.cpp:58:9`!, "napalmbarrel"}, |
| 72 | {ID_ALIENCUPLINKcxx . . $ `scripts/clutter.cpp:59:9`!, "Aliencuplink"}, |
| 73 | {ID_TNTHIGHYIELDcxx . . $ `scripts/clutter.cpp:60:9`!, "TNTCrateHighYield"}, |
| 74 | {ID_TNTMEDYIELDcxx . . $ `scripts/clutter.cpp:61:9`!, "TNTCrateMediumYield"}, |
| 75 | {ID_FALLINGROCKcxx . . $ `scripts/clutter.cpp:62:9`!, "FallingRock"}, |
| 76 | {ID_LAVAROCKcxx . . $ `scripts/clutter.cpp:63:9`!, "LavaRock"}}; |
| 77 | |
| 78 | static int NumScriptIDscxx . . $ NumScriptIDs. = sizeof(ScriptIDscxx . . $ ScriptIDs.) / sizeof(tScriptInfocxx . . $ tScriptInfo#); |
| 79 | |
| 80 | class ClutterScriptcxx . . $ ClutterScript# { |
| 81 | public: |
| 82 | virtual int16_t CallEventcxx . . $ ClutterScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; } |
| 83 | }; |
| 84 | |
| 85 | class FragCratecxx . . $ FragCrate# : public ClutterScriptcxx . . $ ClutterScript# { |
| 86 | public: |
| 87 | int16_t CallEventcxx . . $ FragCrate#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 88 | }; |
| 89 | |
| 90 | class NapalmBarrelcxx . . $ NapalmBarrel# : public ClutterScriptcxx . . $ ClutterScript# { |
| 91 | public: |
| 92 | int16_t CallEventcxx . . $ NapalmBarrel#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 93 | }; |
| 94 | |
| 95 | class AliencuplinkScriptcxx . . $ AliencuplinkScript# : public ClutterScriptcxx . . $ ClutterScript# { |
| 96 | public: |
| 97 | int16_t CallEventcxx . . $ AliencuplinkScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 98 | }; |
| 99 | |
| 100 | struct tTNTHighYieldcxx . . $ tTNTHighYield# { |
| 101 | vectorcxx . . $ vector# last_velcxx . . $ tTNTHighYield#last_vel.; |
| 102 | float lifetimecxx . . $ tTNTHighYield#lifetime.; |
| 103 | }; |
| 104 | class TNTHighYieldcxx . . $ TNTHighYield# : public ClutterScriptcxx . . $ ClutterScript# { |
| 105 | public: |
| 106 | TNTHighYieldcxx . . $ TNTHighYield#TNTHighYield(49f6e7a06ebc5aa8).() { memorycxx . . $ TNTHighYield#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 107 | int16_t CallEventcxx . . $ TNTHighYield#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 108 | tTNTHighYieldcxx . . $ tTNTHighYield# *memorycxx . . $ TNTHighYield#memory.; |
| 109 | }; |
| 110 | |
| 111 | class TNTMedYieldcxx . . $ TNTMedYield# : public ClutterScriptcxx . . $ ClutterScript# { |
| 112 | public: |
| 113 | TNTMedYieldcxx . . $ TNTMedYield#TNTMedYield(49f6e7a06ebc5aa8).() { memorycxx . . $ TNTMedYield#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 114 | int16_t CallEventcxx . . $ TNTMedYield#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 115 | float *memorycxx . . $ TNTMedYield#memory.; |
| 116 | }; |
| 117 | |
| 118 | struct tFallingRockcxx . . $ tFallingRock# { |
| 119 | float lifeleftcxx . . $ tFallingRock#lifeleft.; |
| 120 | }; |
| 121 | class FallingRockcxx . . $ FallingRock# : public ClutterScriptcxx . . $ ClutterScript# { |
| 122 | public: |
| 123 | FallingRockcxx . . $ FallingRock#FallingRock(49f6e7a06ebc5aa8).() { memorycxx . . $ FallingRock#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 124 | int16_t CallEventcxx . . $ FallingRock#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 125 | tFallingRockcxx . . $ tFallingRock# *memorycxx . . $ FallingRock#memory.; |
| 126 | }; |
| 127 | class LavaRockcxx . . $ LavaRock# : public ClutterScriptcxx . . $ ClutterScript# { |
| 128 | public: |
| 129 | LavaRockcxx . . $ LavaRock#LavaRock(49f6e7a06ebc5aa8).() { memorycxx . . $ LavaRock#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 130 | int16_t CallEventcxx . . $ LavaRock#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 131 | tFallingRockcxx . . $ tFallingRock# *memorycxx . . $ LavaRock#memory.; |
| 132 | }; |
| 133 | |
| 134 | // InitializeDLL |
| 135 | // Purpose: |
| 136 | // This function gets called when the DLL first gets loaded. It will only be called once (until the |
| 137 | // DLL is unloaded). Passed in is a struct of data passed from the game needed for the DLL to interact |
| 138 | // with D3. Usually this function will just call osicommon_Initialize(), which sets up the imported |
| 139 | // functions. However, you can alloc some memory or whatever in this function, and free it in ShutdownDLL(). |
| 140 | // Note: You cannot call any imported functions until osicommon_Initialize() is called. |
| 141 | // Returns 1 if initialization went ok, 0 if there was an error and the DLL should not be loaded. |
| 142 | char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) { |
| 143 | osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list); |
| 144 | String_table_sizecxx . . $ String_table_size. = func_list->string_countcxx . . $ tOSIRISModuleInit#string_count.; |
| 145 | String_tablecxx . . $ String_table. = func_list->string_tablecxx . . $ tOSIRISModuleInit#string_table.; |
| 146 | if (func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum. != CHECKSUMcxx . . $ `<built-in>:476:9`!) { |
| 147 | mprintfcxx . . $ mprintf.(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum., CHECKSUMcxx . . $ `<built-in>:476:9`!); |
| 148 | mprintfcxx . . $ mprintf.(0, "RECOMPILE YOUR SCRIPTS!!!\n"); |
| 149 | return 0; |
| 150 | } |
| 151 | return 1; |
| 152 | } |
| 153 | |
| 154 | // ShutdownDLL |
| 155 | // Purpose: |
| 156 | // This function is called right before a DLL is about to be unloaded from memory. You can free |
| 157 | // any unfree'd memory, or anything else you need to do. Don't worry about destroying any instances |
| 158 | // of scripts, as they will all be automatically destroyed before this function is called. The |
| 159 | // same goes for any memory allocated with Scrpt_MemAlloc(), as this will automatically be freed |
| 160 | // when a scripts instance is destroyed. |
| 161 | void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) {} |
| 162 | |
| 163 | // GetGOScriptID |
| 164 | // Purpose: |
| 165 | // Given the name of the object (from it's pagename), this function will search through it's |
| 166 | // list of General Object Scripts for a script with a matching name (to see if there is a script |
| 167 | // for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID |
| 168 | // is to be returned back to Descent 3. This ID will be used from here on out for all future |
| 169 | // interaction with the DLL. Since doors are not part of the generic object's, it's possible |
| 170 | // for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER |
| 171 | // or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a |
| 172 | // door, else it is a 0. The return value is the unique identifier, else -1 if the script |
| 173 | // does not exist in the DLL. |
| 174 | int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) { |
| 175 | if (!isdoor) { |
| 176 | for (int i = 0; i < NumScriptIDscxx . . $ NumScriptIDs.; i++) { |
| 177 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(name, ScriptIDs[i].name)) |
| 178 | return ScriptIDscxx . . $ ScriptIDs.[i].idcxx . . $ tScriptInfo#id.; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | return -1; |
| 183 | } |
| 184 | |
| 185 | // CreateInstance |
| 186 | // Purpose: |
| 187 | // Given an ID from a call to GetGOScriptID(), this function will create a new instance for that |
| 188 | // particular script (by allocating and initializing memory, etc.). A pointer to this instance |
| 189 | // is to be returned back to Descent 3. This pointer will be passed around, along with the ID |
| 190 | // for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error. |
| 191 | void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) { |
| 192 | switch (id) { |
| 193 | case ID_FRAGCRATEcxx . . $ `scripts/clutter.cpp:57:9`!: |
| 194 | return new FragCratecxx . . $ FragCrate#; |
| 195 | break; |
| 196 | case ID_NAPALMBARRELcxx . . $ `scripts/clutter.cpp:58:9`!: |
| 197 | return new NapalmBarrelcxx . . $ NapalmBarrel#; |
| 198 | break; |
| 199 | case ID_ALIENCUPLINKcxx . . $ `scripts/clutter.cpp:59:9`!: |
| 200 | return new AliencuplinkScriptcxx . . $ AliencuplinkScript#; |
| 201 | break; |
| 202 | case ID_TNTHIGHYIELDcxx . . $ `scripts/clutter.cpp:60:9`!: |
| 203 | return new TNTHighYieldcxx . . $ TNTHighYield#; |
| 204 | break; |
| 205 | case ID_TNTMEDYIELDcxx . . $ `scripts/clutter.cpp:61:9`!: |
| 206 | return new TNTMedYieldcxx . . $ TNTMedYield#; |
| 207 | break; |
| 208 | case ID_FALLINGROCKcxx . . $ `scripts/clutter.cpp:62:9`!: |
| 209 | return new FallingRockcxx . . $ FallingRock#; |
| 210 | break; |
| 211 | case ID_LAVAROCKcxx . . $ `scripts/clutter.cpp:63:9`!: |
| 212 | return new LavaRockcxx . . $ LavaRock#; |
| 213 | break; |
| 214 | }; |
| 215 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 216 | } |
| 217 | |
| 218 | // DestroyInstance |
| 219 | // Purpose: |
| 220 | // Given an ID, and a pointer to a particular instance of a script, this function will delete and |
| 221 | // destruct all information associated with that script, so it will no longer exist. |
| 222 | void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) { |
| 223 | switch (id) { |
| 224 | case ID_FRAGCRATEcxx . . $ `scripts/clutter.cpp:57:9`!: |
| 225 | delete ((FragCratecxx . . $ FragCrate# *)ptr); |
| 226 | break; |
| 227 | case ID_NAPALMBARRELcxx . . $ `scripts/clutter.cpp:58:9`!: |
| 228 | delete ((NapalmBarrelcxx . . $ NapalmBarrel# *)ptr); |
| 229 | break; |
| 230 | case ID_ALIENCUPLINKcxx . . $ `scripts/clutter.cpp:59:9`!: |
| 231 | delete ((AliencuplinkScriptcxx . . $ AliencuplinkScript# *)ptr); |
| 232 | break; |
| 233 | case ID_TNTHIGHYIELDcxx . . $ `scripts/clutter.cpp:60:9`!: |
| 234 | delete ((TNTHighYieldcxx . . $ TNTHighYield# *)ptr); |
| 235 | break; |
| 236 | case ID_TNTMEDYIELDcxx . . $ `scripts/clutter.cpp:61:9`!: |
| 237 | delete ((TNTMedYieldcxx . . $ TNTMedYield# *)ptr); |
| 238 | break; |
| 239 | case ID_FALLINGROCKcxx . . $ `scripts/clutter.cpp:62:9`!: |
| 240 | delete ((FallingRockcxx . . $ FallingRock# *)ptr); |
| 241 | break; |
| 242 | case ID_LAVAROCKcxx . . $ `scripts/clutter.cpp:63:9`!: |
| 243 | delete ((LavaRockcxx . . $ LavaRock# *)ptr); |
| 244 | break; |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | // CallInstanceEvent |
| 249 | // Purpose: |
| 250 | // Given an ID, a pointer to a script instance, an event and a pointer to the struct of |
| 251 | // information about the event, this function will translate who this event belongs to and |
| 252 | // passes the event to that instance of the script to be handled. Return a combination of |
| 253 | // CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the |
| 254 | // event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level |
| 255 | // script, mission script, and finally default script). If CONTINUE_CHAIN is not specified, |
| 256 | // than the chain is broken and those scripts of lower priority will never get the event. Return |
| 257 | // CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into |
| 258 | // the game for that event. This only pertains to certain events. If the chain continues |
| 259 | // after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority |
| 260 | // scripts return value. |
| 261 | int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 262 | return ((ClutterScriptcxx . . $ ClutterScript# *)ptr)->CallEventcxx . . $ ClutterScript#CallEvent(585a6502c7945bab).(event, data); |
| 263 | } |
| 264 | |
| 265 | // SaveRestoreState |
| 266 | // Purpose: |
| 267 | // This function is called when Descent 3 is saving or restoring the game state. In this function |
| 268 | // you should save/restore any global data that you want preserved through load/save (which includes |
| 269 | // demos). You must be very careful with this function, corrupting the file (reading or writing too |
| 270 | // much or too little) may be hazardous to the game (possibly making it impossible to restore the |
| 271 | // state). It would be best to use version information to keep older versions of saved states still |
| 272 | // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE |
| 273 | // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should |
| 274 | // write data to the file_ptr, 0 when you should read in the data. |
| 275 | int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) { return 0; } |
| 276 | |
| 277 | int GetObjectTypecxx . . $ GetObjectType(7864480464b09eea).(int object) { |
| 278 | msafe_structcxx . . $ msafe_struct# ms; |
| 279 | ms.objhandlecxx . . $ msafe_struct#objhandle. = object; |
| 280 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &ms); |
| 281 | |
| 282 | return ms.typecxx . . $ msafe_struct#type.; |
| 283 | } |
| 284 | |
| 285 | int GetObjectIDcxx . . $ GetObjectID(7864480464b09eea).(int object) { |
| 286 | msafe_structcxx . . $ msafe_struct# ms; |
| 287 | ms.objhandlecxx . . $ msafe_struct#objhandle. = object; |
| 288 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &ms); |
| 289 | |
| 290 | return ms.idcxx . . $ msafe_struct#id.; |
| 291 | } |
| 292 | |
| 293 | int16_t FragCratecxx . . $ FragCrate#::CallEventcxx . . $ FragCrate#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 294 | switch (event) { |
| 295 | case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!: |
| 296 | vectorcxx . . $ vector# pos; |
| 297 | float mag; |
| 298 | int weapon_id; |
| 299 | int handle; |
| 300 | int i; |
| 301 | int room; |
| 302 | |
| 303 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room); |
| 304 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos); |
| 305 | weapon_id = Wpn_FindIDcxx . . $ Wpn_FindID.("fragbarrel"); |
| 306 | |
| 307 | handle = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, weapon_id, room, &pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.); |
| 308 | |
| 309 | break; |
| 310 | } |
| 311 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 312 | } |
| 313 | |
| 314 | int16_t NapalmBarrelcxx . . $ NapalmBarrel#::CallEventcxx . . $ NapalmBarrel#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 315 | switch (event) { |
| 316 | case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!: |
| 317 | vectorcxx . . $ vector# pos; |
| 318 | float mag; |
| 319 | int weapon_id; |
| 320 | int handle; |
| 321 | int i; |
| 322 | int room; |
| 323 | matrixcxx . . $ matrix# o, orient; |
| 324 | |
| 325 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &o); |
| 326 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room); |
| 327 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos); |
| 328 | |
| 329 | orient.uveccxx . . $ matrix#uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). o.fveccxx . . $ matrix#fvec.; |
| 330 | orient.rveccxx . . $ matrix#rvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). o.rveccxx . . $ matrix#rvec.; |
| 331 | orient.fveccxx . . $ matrix#fvec. =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).o.uveccxx . . $ matrix#uvec.; |
| 332 | |
| 333 | weapon_id = Wpn_FindIDcxx . . $ Wpn_FindID.("napalmbarrel"); |
| 334 | // weapon_id = Wpn_FindID("napalmrocket"); |
| 335 | |
| 336 | handle = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, weapon_id, room, &pos, &orient, data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.); |
| 337 | |
| 338 | // Set direction |
| 339 | vectorcxx . . $ vector# v; |
| 340 | float amount_r, amount_u; |
| 341 | amount_r = (float(randcxx . . $ rand(9efc7249d839d30e).()) - float(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!) / 2.0f) / float(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!); |
| 342 | amount_u = (float(randcxx . . $ rand(9efc7249d839d30e).()) - float(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!) / 2.0f) / float(RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!); |
| 343 | v =cxx . . $ vector#`operator=`(c0842353a20857d). amount_r *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.rveccxx . . $ matrix#rvec. +cxx . . $ operator+(b77b703cd1e43e33). amount_u *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec.; |
| 344 | vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&v); |
| 345 | v *=cxx . . $ `operator*=`(f132838b2cd11d6). 30.0f; |
| 346 | // v = orient.fvec*30.0f; |
| 347 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(handle, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &v); |
| 348 | |
| 349 | break; |
| 350 | } |
| 351 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 352 | } |
| 353 | |
| 354 | int16_t AliencuplinkScriptcxx . . $ AliencuplinkScript#::CallEventcxx . . $ AliencuplinkScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 355 | switch (event) { |
| 356 | case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!: |
| 357 | int handle, id, room; |
| 358 | vectorcxx . . $ vector# pos; |
| 359 | id = Obj_FindIDcxx . . $ Obj_FindID.("Aliencuplinkhousing"); |
| 360 | |
| 361 | if (id != -1) { |
| 362 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room); |
| 363 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos); |
| 364 | |
| 365 | handle = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`!, id, room, &pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.); |
| 366 | |
| 367 | Obj_AttachObjectAPcxx . . $ Obj_AttachObjectAP.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., 0, handle, 0, 1); |
| 368 | } |
| 369 | break; |
| 370 | } |
| 371 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 372 | } |
| 373 | |
| 374 | void ObjectDamagecxx . . $ ObjectDamage(d6d7ce2c0b3115db).(int object, float amount, int killer = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 375 | void ObjectDamagecxx . . $ ObjectDamage(d6d7ce2c0b3115db).(int object, float amount, int killer) { |
| 376 | msafe_structcxx . . $ msafe_struct# mstruct; |
| 377 | |
| 378 | mstruct.objhandlecxx . . $ msafe_struct#objhandle. = object; |
| 379 | mstruct.killer_handlecxx . . $ msafe_struct#killer_handle. = killer; |
| 380 | mstruct.damage_typecxx . . $ msafe_struct#damage_type. = GD_SCRIPTEDcxx . . $ `Descent3/damage_external.h:32:9`!; |
| 381 | mstruct.amountcxx . . $ msafe_struct#amount. = amount; |
| 382 | |
| 383 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_DAMAGE_OBJECTcxx . . $ `scripts/osiris_common.h:811:9`!, &mstruct); |
| 384 | } |
| 385 | |
| 386 | float GetObjectShieldscxx . . $ GetObjectShields(5cde91ea12d43f46).(int object) { |
| 387 | msafe_structcxx . . $ msafe_struct# mstruct; |
| 388 | |
| 389 | mstruct.objhandlecxx . . $ msafe_struct#objhandle. = object; |
| 390 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_SHIELDScxx . . $ `scripts/osiris_common.h:802:9`!, &mstruct); |
| 391 | |
| 392 | return mstruct.shieldscxx . . $ msafe_struct#shields.; |
| 393 | } |
| 394 | |
| 395 | int16_t TNTMedYieldcxx . . $ TNTMedYield#::CallEventcxx . . $ TNTMedYield#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 396 | switch (event) { |
| 397 | case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: { |
| 398 | int i; |
| 399 | tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch; |
| 400 | ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4; |
| 401 | ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(float); |
| 402 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.; |
| 403 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 404 | |
| 405 | memorycxx . . $ TNTMedYield#memory. = (float *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch); |
| 406 | *memorycxx . . $ TNTMedYield#memory. = -1.0f; |
| 407 | } break; |
| 408 | |
| 409 | case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: { |
| 410 | memorycxx . . $ TNTMedYield#memory. = (float *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.; |
| 411 | } break; |
| 412 | |
| 413 | case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: { |
| 414 | vectorcxx . . $ vector# vel; |
| 415 | float vel_val; |
| 416 | float last_vel; |
| 417 | float delta_vel; |
| 418 | float frametime; |
| 419 | float accel; |
| 420 | |
| 421 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel); |
| 422 | vel_val = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&vel); |
| 423 | |
| 424 | frametime = Game_GetFrameTimecxx . . $ Game_GetFrameTime.(); |
| 425 | last_vel = *memorycxx . . $ TNTMedYield#memory.; |
| 426 | |
| 427 | if (last_vel != -1.0f) { |
| 428 | delta_vel = vel_val - last_vel; |
| 429 | accel = delta_vel / frametime; |
| 430 | |
| 431 | if (accel <= 0.0002f) { |
| 432 | // blow him up |
| 433 | Obj_Killcxx . . $ Obj_Kill.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!, 1000.0f, |
| 434 | DF_BLAST_RINGcxx . . $ `Descent3/deathinfo_external.h:79:9`! | DF_LOSES_ANTIGRAVcxx . . $ `Descent3/deathinfo_external.h:81:9`! | DF_EXPL_MEDIUMcxx . . $ `Descent3/deathinfo_external.h:86:9`! | DF_FIREBALLcxx . . $ `Descent3/deathinfo_external.h:77:9`! | DF_BREAKS_APARTcxx . . $ `Descent3/deathinfo_external.h:78:9`! | DF_DEBRIS_SMOKEScxx . . $ `Descent3/deathinfo_external.h:98:9`!, |
| 435 | 0.0f, 0.0f); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | *memorycxx . . $ TNTMedYield#memory. = vel_val; |
| 440 | } break; |
| 441 | } |
| 442 | |
| 443 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 444 | } |
| 445 | |
| 446 | int16_t TNTHighYieldcxx . . $ TNTHighYield#::CallEventcxx . . $ TNTHighYield#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 447 | switch (event) { |
| 448 | case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: { |
| 449 | int i; |
| 450 | tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch; |
| 451 | ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4; |
| 452 | ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(tTNTHighYieldcxx . . $ tTNTHighYield#); |
| 453 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.; |
| 454 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 455 | |
| 456 | memorycxx . . $ TNTHighYield#memory. = (tTNTHighYieldcxx . . $ tTNTHighYield# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch); |
| 457 | vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&memorycxx . . $ TNTHighYield#memory.->last_velcxx . . $ tTNTHighYield#last_vel.); |
| 458 | memorycxx . . $ TNTHighYield#memory.->lifetimecxx . . $ tTNTHighYield#lifetime. = 0; |
| 459 | |
| 460 | } break; |
| 461 | |
| 462 | case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: { |
| 463 | memorycxx . . $ TNTHighYield#memory. = (tTNTHighYieldcxx . . $ tTNTHighYield# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.; |
| 464 | } break; |
| 465 | |
| 466 | case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: { |
| 467 | vectorcxx . . $ vector# vel; |
| 468 | vectorcxx . . $ vector# diff_vel; |
| 469 | float vel_val; |
| 470 | float delta_vel; |
| 471 | float frametime; |
| 472 | float accel; |
| 473 | |
| 474 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel); |
| 475 | vel_val = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&vel); |
| 476 | |
| 477 | frametime = Game_GetFrameTimecxx . . $ Game_GetFrameTime.(); |
| 478 | diff_vel =cxx . . $ vector#`operator=`(c0842353a20857d). vel -cxx . . $ operator-(b77b703cd1e43e33). (memorycxx . . $ TNTHighYield#memory.->last_velcxx . . $ tTNTHighYield#last_vel.); |
| 479 | memorycxx . . $ TNTHighYield#memory.->lifetimecxx . . $ tTNTHighYield#lifetime. += frametime; |
| 480 | |
| 481 | delta_vel = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&diff_vel); |
| 482 | |
| 483 | accel = fabs(delta_vel / frametime); |
| 484 | |
| 485 | bool case1 = (accel >= 40.0f && vel_val > 35.0f && memorycxx . . $ TNTHighYield#memory.->last_velcxx . . $ tTNTHighYield#last_vel..ycxx . . $ vector#y. < -6.0f) ? true : false; |
| 486 | bool case2 = (accel > 100.0f && vel_val > 50.0f) ? true : false; |
| 487 | bool case3 = (accel > 1500.0f && memorycxx . . $ TNTHighYield#memory.->last_velcxx . . $ tTNTHighYield#last_vel..ycxx . . $ vector#y. < -5.0f) ? true : false; |
| 488 | |
| 489 | if (case1 || case2 || case3) { |
| 490 | if (case1) |
| 491 | mprintfcxx . . $ mprintf.(0, "Case 1\n"); |
| 492 | if (case2) |
| 493 | mprintfcxx . . $ mprintf.(0, "Case 2\n"); |
| 494 | if (case3) |
| 495 | mprintfcxx . . $ mprintf.(0, "Case 3\n"); |
| 496 | |
| 497 | // blow him up |
| 498 | mprintfcxx . . $ mprintf.(0, "accel: %.2f vel: %.2f\n", accel, vel_val); |
| 499 | if (memorycxx . . $ TNTHighYield#memory.->lifetimecxx . . $ tTNTHighYield#lifetime. >= 7.0f) { |
| 500 | Obj_Killcxx . . $ Obj_Kill.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!, 1000.0f, |
| 501 | DF_BLAST_RINGcxx . . $ `Descent3/deathinfo_external.h:79:9`! | DF_LOSES_ANTIGRAVcxx . . $ `Descent3/deathinfo_external.h:81:9`! | DF_EXPL_MEDIUMcxx . . $ `Descent3/deathinfo_external.h:86:9`! | DF_FIREBALLcxx . . $ `Descent3/deathinfo_external.h:77:9`! | DF_BREAKS_APARTcxx . . $ `Descent3/deathinfo_external.h:78:9`! | DF_DEBRIS_SMOKEScxx . . $ `Descent3/deathinfo_external.h:98:9`!, |
| 502 | 0.0f, 0.0f); |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | memorycxx . . $ TNTHighYield#memory.->last_velcxx . . $ tTNTHighYield#last_vel. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). vel; |
| 507 | } break; |
| 508 | |
| 509 | case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!: { |
| 510 | // see if we are within distance of the rock pile to destroy |
| 511 | int close_obj_list[32]; |
| 512 | int roomnum; |
| 513 | int rockpile_id; |
| 514 | float amount; |
| 515 | vectorcxx . . $ vector# pos; |
| 516 | |
| 517 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &roomnum); |
| 518 | Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos); |
| 519 | int num_objects = AI_GetNearbyObjscxx . . $ AI_GetNearbyObjs(9d0c65cbff229ccc).(&pos, roomnum, 30.0f, close_obj_list, 32, false, false, false, true); |
| 520 | |
| 521 | rockpile_id = Obj_FindIDcxx . . $ Obj_FindID.("TNTrockwall"); |
| 522 | |
| 523 | for (int i = 0; i < num_objects; i++) { |
| 524 | int type, id; |
| 525 | |
| 526 | type = GetObjectTypecxx . . $ GetObjectType(7864480464b09eea).(close_obj_list[i]); |
| 527 | id = GetObjectIDcxx . . $ GetObjectID(7864480464b09eea).(close_obj_list[i]); |
| 528 | |
| 529 | if (type == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! && id == rockpile_id) { |
| 530 | // destroy the wall |
| 531 | Obj_Killcxx . . $ Obj_Kill.(close_obj_list[i], data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., 1000.0f, |
| 532 | DF_BLAST_RINGcxx . . $ `Descent3/deathinfo_external.h:79:9`! | DF_LOSES_ANTIGRAVcxx . . $ `Descent3/deathinfo_external.h:81:9`! | DF_EXPL_MEDIUMcxx . . $ `Descent3/deathinfo_external.h:86:9`! | DF_FIREBALLcxx . . $ `Descent3/deathinfo_external.h:77:9`! | DF_BREAKS_APARTcxx . . $ `Descent3/deathinfo_external.h:78:9`! | DF_DEBRIS_SMOKEScxx . . $ `Descent3/deathinfo_external.h:98:9`!, |
| 533 | 0.0f, 0.0f); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | } break; |
| 538 | } |
| 539 | |
| 540 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 541 | } |
| 542 | |
| 543 | int16_t FallingRockcxx . . $ FallingRock#::CallEventcxx . . $ FallingRock#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 544 | switch (event) { |
| 545 | case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: { |
| 546 | int i; |
| 547 | tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch; |
| 548 | ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4; |
| 549 | ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(tFallingRockcxx . . $ tFallingRock#); |
| 550 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.; |
| 551 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 552 | |
| 553 | memorycxx . . $ FallingRock#memory. = (tFallingRockcxx . . $ tFallingRock# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch); |
| 554 | memorycxx . . $ FallingRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. = 10.0f; |
| 555 | } break; |
| 556 | |
| 557 | case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: { |
| 558 | memorycxx . . $ FallingRock#memory. = (tFallingRockcxx . . $ tFallingRock# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.; |
| 559 | } break; |
| 560 | |
| 561 | case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: { |
| 562 | if (memorycxx . . $ FallingRock#memory.) { |
| 563 | memorycxx . . $ FallingRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. -= data->evt_intervalcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_interval..frame_timecxx . . $ tOSIRISEVTINTERVAL#frame_time.; |
| 564 | |
| 565 | if (memorycxx . . $ FallingRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. <= 0) { |
| 566 | // destroy the wall |
| 567 | Obj_Killcxx . . $ Obj_Kill.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!, 1000.0f, DF_EXPL_SMALLcxx . . $ `Descent3/deathinfo_external.h:85:9`! | DF_FIREBALLcxx . . $ `Descent3/deathinfo_external.h:77:9`! | DF_DEBRIS_SMOKEScxx . . $ `Descent3/deathinfo_external.h:98:9`!, 0.0f, |
| 568 | 0.0f); |
| 569 | } |
| 570 | } |
| 571 | } break; |
| 572 | } |
| 573 | |
| 574 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 575 | } |
| 576 | |
| 577 | int16_t LavaRockcxx . . $ LavaRock#::CallEventcxx . . $ LavaRock#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 578 | switch (event) { |
| 579 | case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: { |
| 580 | int i; |
| 581 | tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch; |
| 582 | ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4; |
| 583 | ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(tFallingRockcxx . . $ tFallingRock#); |
| 584 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.; |
| 585 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 586 | |
| 587 | memorycxx . . $ LavaRock#memory. = (tFallingRockcxx . . $ tFallingRock# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch); |
| 588 | memorycxx . . $ LavaRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. = 20.0f; |
| 589 | |
| 590 | // Set it on fire! |
| 591 | msafe_structcxx . . $ msafe_struct# mstruct; |
| 592 | mstruct.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 593 | mstruct.longevitycxx . . $ msafe_struct#longevity. = 25.0f; |
| 594 | mstruct.intervalcxx . . $ msafe_struct#interval. = 0.0f; |
| 595 | mstruct.ithandlecxx . . $ msafe_struct#ithandle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 596 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_SETONFIREcxx . . $ `scripts/osiris_common.h:849:9`!, &mstruct); |
| 597 | |
| 598 | } break; |
| 599 | |
| 600 | case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: { |
| 601 | memorycxx . . $ LavaRock#memory. = (tFallingRockcxx . . $ tFallingRock# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.; |
| 602 | } break; |
| 603 | |
| 604 | case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: { |
| 605 | // Set it on fire! |
| 606 | msafe_structcxx . . $ msafe_struct# mstruct; |
| 607 | mstruct.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.; |
| 608 | mstruct.longevitycxx . . $ msafe_struct#longevity. = 2.0f; |
| 609 | mstruct.intervalcxx . . $ msafe_struct#interval. = 2.0f; |
| 610 | mstruct.ithandlecxx . . $ msafe_struct#ithandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 611 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_SETONFIREcxx . . $ `scripts/osiris_common.h:849:9`!, &mstruct); |
| 612 | |
| 613 | } break; |
| 614 | |
| 615 | case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: { |
| 616 | if (memorycxx . . $ LavaRock#memory.) { |
| 617 | memorycxx . . $ LavaRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. -= data->evt_intervalcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_interval..frame_timecxx . . $ tOSIRISEVTINTERVAL#frame_time.; |
| 618 | |
| 619 | if (memorycxx . . $ LavaRock#memory.->lifeleftcxx . . $ tFallingRock#lifeleft. <= 0) { |
| 620 | // destroy the wall |
| 621 | Obj_Killcxx . . $ Obj_Kill.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!, 1000.0f, DF_EXPL_SMALLcxx . . $ `Descent3/deathinfo_external.h:85:9`! | DF_FIREBALLcxx . . $ `Descent3/deathinfo_external.h:77:9`! | DF_DEBRIS_SMOKEScxx . . $ `Descent3/deathinfo_external.h:98:9`!, 0.0f, |
| 622 | 0.0f); |
| 623 | } |
| 624 | } |
| 625 | } break; |
| 626 | } |
| 627 | |
| 628 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 629 | } |