| 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 | // testscript.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 | |
| 27 | #include "module.h"cxx . . $ `<file>/lib/module.h`/ |
| 28 | |
| 29 | #ifdef __cpluspluscxx . . $ `<built-in>:467:9`! |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLL(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list); |
| 33 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLL(void); |
| 34 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptID(const char *name, uint8_tcxx . . $ uint8_t# isdoor); |
| 35 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstance(int id); |
| 36 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstance(int id, void *ptr); |
| 37 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 38 | DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreState(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state); |
| 39 | #ifdef __cpluspluscxx . . $ `<built-in>:467:9`! |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | // ========================== |
| 44 | // Script class definitions// |
| 45 | // ========================== |
| 46 | #define ID_SHIELD_ORBcxx . . $ `scripts/testscript.cpp:46:9`! 0x00 // shield id |
| 47 | #define ID_ENERGY_ORBcxx . . $ `scripts/testscript.cpp:47:9`! 0x01 // energy id |
| 48 | #define MAX_IDScxx . . $ `scripts/testscript.cpp:48:9`! 0x02 // maximum number of IDs |
| 49 | struct tScriptInfocxx . . $ tScriptInfo# { |
| 50 | int idcxx . . $ tScriptInfo#id.; |
| 51 | const char *namecxx . . $ tScriptInfo#name.; |
| 52 | }; |
| 53 | |
| 54 | tScriptInfocxx . . $ tScriptInfo# ScriptInfocxx . . $ ScriptInfo.[MAX_IDScxx . . $ `scripts/testscript.cpp:48:9`!] = {{ID_SHIELD_ORBcxx . . $ `scripts/testscript.cpp:46:9`!, "Shield"}, {ID_ENERGY_ORBcxx . . $ `scripts/testscript.cpp:47:9`!, "Energy"}}; |
| 55 | |
| 56 | class BaseObjScriptcxx . . $ BaseObjScript# { |
| 57 | public: |
| 58 | BaseObjScriptcxx . . $ BaseObjScript#BaseObjScript(49f6e7a06ebc5aa8).(); |
| 59 | ~cxx . . $ BaseObjScript#`~BaseObjScript`(ced63f7c635d850d).BaseObjScriptcxx . . $ BaseObjScript#(); |
| 60 | virtual int16_t CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 61 | |
| 62 | protected: |
| 63 | bool calledcxx . . $ BaseObjScript#called.; |
| 64 | }; |
| 65 | |
| 66 | struct tShieldOrbInfocxx . . $ tShieldOrbInfo# { |
| 67 | int hitcountcxx . . $ tShieldOrbInfo#hitcount.; |
| 68 | }; |
| 69 | //------------------ |
| 70 | // Shield orb script |
| 71 | //------------------ |
| 72 | class ShieldOrbcxx . . $ ShieldOrb# : public BaseObjScriptcxx . . $ BaseObjScript# { |
| 73 | public: |
| 74 | ShieldOrbcxx . . $ ShieldOrb#ShieldOrb(49f6e7a06ebc5aa8).() { infocxx . . $ ShieldOrb#info. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; } |
| 75 | int16_t CallEventcxx . . $ ShieldOrb#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 76 | |
| 77 | private: |
| 78 | tShieldOrbInfocxx . . $ tShieldOrbInfo# *infocxx . . $ ShieldOrb#info.; |
| 79 | }; |
| 80 | |
| 81 | //------------------ |
| 82 | // Energy orb script |
| 83 | //------------------ |
| 84 | class EnergyOrbcxx . . $ EnergyOrb# : public BaseObjScriptcxx . . $ BaseObjScript# { |
| 85 | public: |
| 86 | int16_t CallEventcxx . . $ EnergyOrb#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data); |
| 87 | }; |
| 88 | |
| 89 | char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) { |
| 90 | osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list); |
| 91 | |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) {} |
| 96 | |
| 97 | int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) { |
| 98 | for (int i = 0; i < MAX_IDScxx . . $ `scripts/testscript.cpp:48:9`!; i++) { |
| 99 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(name, ScriptInfo[i].name)) { |
| 100 | return ScriptInfocxx . . $ ScriptInfo.[i].idcxx . . $ tScriptInfo#id.; |
| 101 | } |
| 102 | } |
| 103 | return -1; |
| 104 | } |
| 105 | |
| 106 | void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) { |
| 107 | switch (id) { |
| 108 | case ID_SHIELD_ORBcxx . . $ `scripts/testscript.cpp:46:9`!: |
| 109 | return new ShieldOrbcxx . . $ ShieldOrb#; |
| 110 | break; |
| 111 | case ID_ENERGY_ORBcxx . . $ `scripts/testscript.cpp:47:9`!: |
| 112 | return new EnergyOrbcxx . . $ EnergyOrb#; |
| 113 | break; |
| 114 | default: |
| 115 | mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id); |
| 116 | break; |
| 117 | }; |
| 118 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 119 | } |
| 120 | |
| 121 | void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) { |
| 122 | switch (id) { |
| 123 | case ID_SHIELD_ORBcxx . . $ `scripts/testscript.cpp:46:9`!: |
| 124 | delete ((ShieldOrbcxx . . $ ShieldOrb# *)ptr); |
| 125 | break; |
| 126 | case ID_ENERGY_ORBcxx . . $ `scripts/testscript.cpp:47:9`!: |
| 127 | delete ((EnergyOrbcxx . . $ EnergyOrb# *)ptr); |
| 128 | break; |
| 129 | default: |
| 130 | mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id); |
| 131 | break; |
| 132 | }; |
| 133 | } |
| 134 | |
| 135 | int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 136 | switch (id) { |
| 137 | case ID_SHIELD_ORBcxx . . $ `scripts/testscript.cpp:46:9`!: |
| 138 | case ID_ENERGY_ORBcxx . . $ `scripts/testscript.cpp:47:9`!: |
| 139 | return ((BaseObjScriptcxx . . $ BaseObjScript# *)ptr)->CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(event, data); |
| 140 | break; |
| 141 | default: |
| 142 | mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id); |
| 143 | break; |
| 144 | }; |
| 145 | |
| 146 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 147 | } |
| 148 | |
| 149 | // SaveRestoreState |
| 150 | // Purpose: |
| 151 | // This function is called when Descent 3 is saving or restoring the game state. In this function |
| 152 | // you should save/restore any global data that you want preserved through load/save (which includes |
| 153 | // demos). You must be very careful with this function, corrupting the file (reading or writing too |
| 154 | // much or too little) may be hazardous to the game (possibly making it impossible to restore the |
| 155 | // state). It would be best to use version information to keep older versions of saved states still |
| 156 | // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE |
| 157 | // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should |
| 158 | // write data to the file_ptr, 0 when you should read in the data. |
| 159 | int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) { return 0; } |
| 160 | |
| 161 | //============================================ |
| 162 | // Script Implementation |
| 163 | //============================================ |
| 164 | BaseObjScriptcxx . . $ BaseObjScript#::BaseObjScriptcxx . . $ BaseObjScript#BaseObjScript(49f6e7a06ebc5aa8).() { calledcxx . . $ BaseObjScript#called. = false; } |
| 165 | |
| 166 | BaseObjScriptcxx . . $ BaseObjScript#::~cxx . . $ BaseObjScript#`~BaseObjScript`(ced63f7c635d850d).BaseObjScriptcxx . . $ BaseObjScript#() {} |
| 167 | |
| 168 | int16_t BaseObjScriptcxx . . $ BaseObjScript#::CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 169 | switch (event) { |
| 170 | case EVT_INTERVALcxx . . $ `scripts/osiris_common.h:363:9`!: |
| 171 | mprintfcxx . . $ mprintf.(0, "."); |
| 172 | break; |
| 173 | case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!: |
| 174 | mprintfcxx . . $ mprintf.(0, "*"); |
| 175 | break; |
| 176 | case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!: |
| 177 | mprintfcxx . . $ mprintf.(0, "EVT_DAMAGED "); |
| 178 | break; |
| 179 | case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: |
| 180 | mprintfcxx . . $ mprintf.(0, "EVT_COLLIDE "); |
| 181 | break; |
| 182 | case EVT_CREATEDcxx . . $ `scripts/osiris_common.h:367:9`!: |
| 183 | mprintfcxx . . $ mprintf.(0, "EVT_CREATED "); |
| 184 | break; |
| 185 | case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!: |
| 186 | mprintfcxx . . $ mprintf.(0, "EVT_DESTROY "); |
| 187 | break; |
| 188 | case EVT_TIMERcxx . . $ `scripts/osiris_common.h:369:9`!: |
| 189 | mprintfcxx . . $ mprintf.(0, "EVT_TIMER "); |
| 190 | break; |
| 191 | case EVT_USEcxx . . $ `scripts/osiris_common.h:370:9`!: |
| 192 | mprintfcxx . . $ mprintf.(0, "EVT_USE "); |
| 193 | break; |
| 194 | case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!: |
| 195 | mprintfcxx . . $ mprintf.(0, "EVT_AI_NOTIFY "); |
| 196 | break; |
| 197 | case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!: |
| 198 | mprintfcxx . . $ mprintf.(0, "EVT_AI_INIT "); |
| 199 | break; |
| 200 | case EVT_CHANGESEGcxx . . $ `scripts/osiris_common.h:375:9`!: |
| 201 | mprintfcxx . . $ mprintf.(0, "EVT_CHANGESEG "); |
| 202 | break; |
| 203 | }; |
| 204 | |
| 205 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 206 | } |
| 207 | |
| 208 | // -------------- |
| 209 | // Shield orb |
| 210 | // -------------- |
| 211 | int16_t ShieldOrbcxx . . $ ShieldOrb#::CallEventcxx . . $ ShieldOrb#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 212 | switch (event) { |
| 213 | case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: |
| 214 | if (!calledcxx . . $ BaseObjScript#called.) { |
| 215 | mprintfcxx . . $ mprintf.(0, "Collide with shield\n"); |
| 216 | msafe_structcxx . . $ msafe_struct# mo; |
| 217 | |
| 218 | mo.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.; |
| 219 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &mo); |
| 220 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &mo); |
| 221 | |
| 222 | if (mo.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) { |
| 223 | |
| 224 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_SHIELDScxx . . $ `scripts/osiris_common.h:802:9`!, &mo); |
| 225 | if (mo.shieldscxx . . $ msafe_struct#shields. < 200) { |
| 226 | mo.shieldscxx . . $ msafe_struct#shields. += 15; |
| 227 | if (mo.shieldscxx . . $ msafe_struct#shields. > 200) |
| 228 | mo.shieldscxx . . $ msafe_struct#shields. = 200; |
| 229 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_SHIELDScxx . . $ `scripts/osiris_common.h:802:9`!, &mo); |
| 230 | |
| 231 | mo.slotcxx . . $ msafe_struct#slot. = mo.idcxx . . $ msafe_struct#id.; |
| 232 | mo.colorcxx . . $ msafe_struct#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0); |
| 233 | snprintf(mo.messagecxx . . $ msafe_struct#message., sizeof(mo.messagecxx . . $ msafe_struct#message.), "Shields boosted to %d", (int)mo.shieldscxx . . $ msafe_struct#shields.); |
| 234 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_MISC_HUD_MESSAGEcxx . . $ `scripts/osiris_common.h:881:9`!, &mo); |
| 235 | calledcxx . . $ BaseObjScript#called. = true; |
| 236 | } |
| 237 | |
| 238 | tOSIRISTIMERcxx . . $ tOSIRISTIMER# ti; |
| 239 | ti.flagscxx . . $ tOSIRISTIMER#flags. = 0; |
| 240 | ti.idcxx . . $ tOSIRISTIMER#id. = 0; |
| 241 | ti.repeat_countcxx . . $ tOSIRISTIMER#repeat_count. = -1; |
| 242 | ti.object_handlecxx . . $ tOSIRISTIMER#$anonymous_type_2#object_handle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 243 | ti.timer_intervalcxx . . $ tOSIRISTIMER#timer_interval. = 10.0f; |
| 244 | Scrpt_CreateTimercxx . . $ Scrpt_CreateTimer.(&ti); |
| 245 | } |
| 246 | |
| 247 | tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch; |
| 248 | ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4; |
| 249 | ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(tShieldOrbInfocxx . . $ tShieldOrbInfo#); |
| 250 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.; |
| 251 | ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 252 | infocxx . . $ ShieldOrb#info. = (tShieldOrbInfocxx . . $ tShieldOrbInfo# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch); |
| 253 | if (infocxx . . $ ShieldOrb#info.) { |
| 254 | infocxx . . $ ShieldOrb#info.->hitcountcxx . . $ tShieldOrbInfo#hitcount. = 1; |
| 255 | } |
| 256 | } else { |
| 257 | if (infocxx . . $ ShieldOrb#info.) { |
| 258 | infocxx . . $ ShieldOrb#info.->hitcountcxx . . $ tShieldOrbInfo#hitcount.++; |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | if (infocxx . . $ ShieldOrb#info.) { |
| 263 | mprintfcxx . . $ mprintf.(0, "HIT(%d)\n", infocxx . . $ ShieldOrb#info.->hitcountcxx . . $ tShieldOrbInfo#hitcount.); |
| 264 | } |
| 265 | break; |
| 266 | |
| 267 | case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!: { |
| 268 | infocxx . . $ ShieldOrb#info. = (tShieldOrbInfocxx . . $ tShieldOrbInfo# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.; |
| 269 | mprintfcxx . . $ mprintf.(0, "MEM RESTORE!!! -- %d(%d)\n", data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..idcxx . . $ tOSIRISEVTMEMRESTORE#id., infocxx . . $ ShieldOrb#info.->hitcountcxx . . $ tShieldOrbInfo#hitcount.); |
| 270 | } break; |
| 271 | |
| 272 | case EVT_TIMERcxx . . $ `scripts/osiris_common.h:369:9`!: { |
| 273 | msafe_structcxx . . $ msafe_struct# mo; |
| 274 | mo.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.; |
| 275 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &mo); |
| 276 | mo.slotcxx . . $ msafe_struct#slot. = mo.idcxx . . $ msafe_struct#id.; |
| 277 | mo.colorcxx . . $ msafe_struct#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0); |
| 278 | snprintf(mo.messagecxx . . $ msafe_struct#message., sizeof(mo.messagecxx . . $ msafe_struct#message.), "TIMER: HIT COUNT %d", (infocxx . . $ ShieldOrb#info.) ? infocxx . . $ ShieldOrb#info.->hitcountcxx . . $ tShieldOrbInfo#hitcount. : -1); |
| 279 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_MISC_HUD_MESSAGEcxx . . $ `scripts/osiris_common.h:881:9`!, &mo); |
| 280 | } break; |
| 281 | } |
| 282 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; // BaseObjScript::CallEvent(event,data); |
| 283 | } |
| 284 | |
| 285 | // -------------- |
| 286 | // Energy orb |
| 287 | // -------------- |
| 288 | int16_t EnergyOrbcxx . . $ EnergyOrb#::CallEventcxx . . $ EnergyOrb#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { |
| 289 | switch (event) { |
| 290 | case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!: |
| 291 | if (!calledcxx . . $ BaseObjScript#called.) { |
| 292 | mprintfcxx . . $ mprintf.(0, "Collide with energy\n"); |
| 293 | msafe_structcxx . . $ msafe_struct# mo; |
| 294 | |
| 295 | mo.objhandlecxx . . $ msafe_struct#objhandle. = data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.; |
| 296 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_TYPEcxx . . $ `scripts/osiris_common.h:812:9`!, &mo); |
| 297 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_IDcxx . . $ `scripts/osiris_common.h:813:9`!, &mo); |
| 298 | |
| 299 | if (mo.typecxx . . $ msafe_struct#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) { |
| 300 | |
| 301 | MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_ENERGYcxx . . $ `scripts/osiris_common.h:803:9`!, &mo); |
| 302 | if (mo.energycxx . . $ msafe_struct#energy. < 200) { |
| 303 | mo.energycxx . . $ msafe_struct#energy. += 15; |
| 304 | if (mo.energycxx . . $ msafe_struct#energy. > 200) |
| 305 | mo.energycxx . . $ msafe_struct#energy. = 200; |
| 306 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_ENERGYcxx . . $ `scripts/osiris_common.h:803:9`!, &mo); |
| 307 | |
| 308 | mo.slotcxx . . $ msafe_struct#slot. = mo.idcxx . . $ msafe_struct#id.; |
| 309 | mo.colorcxx . . $ msafe_struct#color. = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0); |
| 310 | snprintf(mo.messagecxx . . $ msafe_struct#message., sizeof(mo.messagecxx . . $ msafe_struct#message.), "Energy boosted to %d", (int)mo.energycxx . . $ msafe_struct#energy.); |
| 311 | MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_MISC_HUD_MESSAGEcxx . . $ `scripts/osiris_common.h:881:9`!, &mo); |
| 312 | calledcxx . . $ BaseObjScript#called. = true; |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | break; |
| 317 | } |
| 318 | return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; |
| 319 | } |