Debian Codegraph @

scripts/aigame2.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 // aigame2.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 #include "DallasFuncs.cpp"cxx . . $ `<file>/scripts/DallasFuncs.cpp`/
28
29 #include "module.h"cxx . . $ `<file>/lib/module.h`/
30
31 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
32 extern "C" {
33 #endif
34 DLLEXPORTcxx . . $ `lib/module.h:114:9`! char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLL(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list);
35 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLL(void);
36 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptID(const char *name, uint8_tcxx . . $ uint8_t# isdoor);
37 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstance(int id);
38 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstance(int id, void *ptr);
39 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
40 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreState(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state);
41 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
42 }
43 #endif
44
45 static int String_table_sizecxx . . $ String_table_size. = 0;
46 static char **String_tablecxx . . $ String_table. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
47 static const char *_Error_stringcxx . . $ _Error_string. = "!!ERROR MISSING STRING!!";
48 static const char *_Empty_stringcxx . . $ _Empty_string. = "";
49 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int index) {
50 if ((index < 0) || (index >= String_table_sizecxx . . $ String_table_size.))
51 return _Error_stringcxx . . $ _Error_string.;
52 if (!String_tablecxx . . $ String_table.[index])
53 return _Empty_stringcxx . . $ _Empty_string.;
54 return String_tablecxx . . $ String_table.[index];
55 }
56 #define TXTcxx . . $ `scripts/aigame2.cpp:56:9`!(x) GetStringFromTable(x)
57
58 ///////////////////////////////////////////////////////////////////////////////
59 // Script IDs
60
61 #define NUM_IDScxx . . $ `scripts/aigame2.cpp:61:9`! 5 // maximum number of IDs
62 #define FIRST_IDcxx . . $ `scripts/aigame2.cpp:62:9`! 50
63
64 #define ID_SAMIRPESTcxx . . $ `scripts/aigame2.cpp:64:9`! 50 // Samir's test pest.
65 #define ID_BLACKSTORMTROOPcxx . . $ `scripts/aigame2.cpp:65:9`! 51 // The CED Black Stormtrooper
66 #define ID_CREEPERcxx . . $ `scripts/aigame2.cpp:66:9`! 52 // The CREEPER
67 #define ID_LUKETURRETcxx . . $ `scripts/aigame2.cpp:67:9`! 53 // Luke's nifty security turret
68 #define ID_STBLACKBARRELcxx . . $ `scripts/aigame2.cpp:68:9`! 54 // The Black Stormtrooper's barrel pack
69
70 ///////////////////////////////////////////////////////////////////////////////
71 // Script names
72
73 static const char *const Script_namescxx . . $ Script_names.[NUM_IDScxx . . $ `scripts/aigame2.cpp:61:9`!] = {"Samir's Pest", "StormTrooperBlack", "Creeper", "LukeTurret",
74 "STBlackBarrel"};
75
76 // Class definitions
77
78 #define N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`! 3
79
80 #define GOAL_UID_GETTOPOScxx . . $ `scripts/aigame2.cpp:80:9`! 0x100
81
82 // ai base class
83 class aiObjScriptcxx . . $ aiObjScript# {
84 public:
85 int16_t CallEventcxx . . $ aiObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
86
87 protected:
88 // Handles all possible OSIRIS events.
89 virtual void OnInitcxx . . $ aiObjScript#OnInit(d4f767463ce0a6b3).(int me_handle){}; // EVT_AI_INIT
90 virtual void OnDestroycxx . . $ aiObjScript#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt){}; // EVT_DESTROY
91 virtual void OnIntervalcxx . . $ aiObjScript#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data){}; // EVT_AI_FRAME
92 virtual void OnCollidecxx . . $ aiObjScript#OnCollide(3e454b8ccf442868).(int me_handle, int it_handle){}; // EVT_COLLIDE
93 virtual bool OnNotifycxx . . $ aiObjScript#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data) { return true; }; // EVT_AI_NOTIFY
94 virtual void OnDamagedcxx . . $ aiObjScript#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt){}; // EVT_DAMAGED
95 virtual void OnMemRestorecxx . . $ aiObjScript#OnMemRestore(5d22bdacc48458e8).(void *ptr){}; // EVT_MEMRESTORE
96 };
97
98 // ai base class
99 #define PEST_STATE_ROAMcxx . . $ `scripts/aigame2.cpp:99:9`! 0
100 #define PEST_STATE_HIVEcxx . . $ `scripts/aigame2.cpp:100:9`! 1
101
102 class aiSamirPestcxx . . $ aiSamirPest# : public aiObjScriptcxx . . $ aiObjScript# {
103 public:
104 aiSamirPestcxx . . $ aiSamirPest#aiSamirPest(49f6e7a06ebc5aa8).();
105 ~cxx . . $ aiSamirPest#`~aiSamirPest`(ced63f7c635d850d).aiSamirPestcxx . . $ aiSamirPest#();
106
107 private:
108 struct t_pest_memorycxx . . $ aiSamirPest#t_pest_memory# {
109 int tail_handlecxx . . $ aiSamirPest#t_pest_memory#tail_handle.;
110 float last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame.;
111 int foot_soundscxx . . $ aiSamirPest#t_pest_memory#foot_sounds.[3];
112 int statecxx . . $ aiSamirPest#t_pest_memory#state.;
113 };
114
115 t_pest_memorycxx . . $ aiSamirPest#t_pest_memory# *memorycxx . . $ aiSamirPest#memory.;
116
117 protected:
118 // Handles all possible OSIRIS events.
119 virtual void OnInitcxx . . $ aiSamirPest#OnInit(d4f767463ce0a6b3).(int me_handle);
120 virtual void OnDestroycxx . . $ aiSamirPest#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt);
121 virtual void OnIntervalcxx . . $ aiSamirPest#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
122 virtual void OnCollidecxx . . $ aiSamirPest#OnCollide(3e454b8ccf442868).(int me_handle, int it_handle);
123 virtual bool OnNotifycxx . . $ aiSamirPest#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data);
124 virtual void OnMemRestorecxx . . $ aiSamirPest#OnMemRestore(5d22bdacc48458e8).(void *ptr) { memorycxx . . $ aiSamirPest#memory. = (t_pest_memorycxx . . $ aiSamirPest#t_pest_memory# *)ptr; };
125 };
126
127 #define STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`! 0 // waiting state
128 #define STATE_INITcxx . . $ `scripts/aigame2.cpp:128:9`! 1 // initial state
129 #define STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`! 2 // sentry state.
130 #define STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`! 3 // hiding, waiting...
131 #define STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`! 4 // will attack player briefly.
132 #define STATE_ATTACKcxx . . $ `scripts/aigame2.cpp:132:9`! 5 // regular attack
133 #define STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`! 6 // stalks player
134
135 class aiBlackStormTroopercxx . . $ aiBlackStormTrooper# : public aiObjScriptcxx . . $ aiObjScript# {
136 public:
137 aiBlackStormTroopercxx . . $ aiBlackStormTrooper#aiBlackStormTrooper(49f6e7a06ebc5aa8).();
138 ~cxx . . $ aiBlackStormTrooper#`~aiBlackStormTrooper`(ced63f7c635d850d).aiBlackStormTroopercxx . . $ aiBlackStormTrooper#();
139
140 private:
141 struct t_bst_memorycxx . . $ aiBlackStormTrooper#t_bst_memory# {
142 float timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer.;
143 float snipe_timercxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_timer.;
144 float last_framecxx . . $ aiBlackStormTrooper#t_bst_memory#last_frame.;
145 float laser_timercxx . . $ aiBlackStormTrooper#t_bst_memory#laser_timer.;
146 int target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle.;
147 int ammo_barrelcxx . . $ aiBlackStormTrooper#t_bst_memory#ammo_barrel.;
148 int gun_sight_objcxx . . $ aiBlackStormTrooper#t_bst_memory#gun_sight_obj.;
149 int camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj.;
150 int8_tcxx . . $ int8_t# statecxx . . $ aiBlackStormTrooper#t_bst_memory#state.;
151 int8_tcxx . . $ int8_t# snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.;
152 int8_tcxx . . $ int8_t# cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point.;
153 int8_tcxx . . $ int8_t# laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted.;
154 int16_t backpack_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#backpack_hp.; // points before destroy backpack.
155 int16_t flee_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#flee_hp.;
156
157 // a Nx(N-1) array with a extra int for number of VALID connecting snipe points per snipe point.
158 // note: obvious cases ignored (ptA->ptA)
159 // used to create a quick map of snipe points for sniper to use.
160 int snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!];
161 int8_tcxx . . $ int8_t# access_arraycxx . . $ aiBlackStormTrooper#t_bst_memory#access_array.[N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!][N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!];
162
163 // used to keep track of targets black storm trooper knows about. storm trooper must
164 // SEE the target first before storing the target in memory.
165 int snipe_target_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_target_handles.[N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!];
166 };
167
168 t_bst_memorycxx . . $ aiBlackStormTrooper#t_bst_memory# *memorycxx . . $ aiBlackStormTrooper#memory.;
169
170 void set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(int me_handle, int state);
171
172 protected:
173 // Handles all possible OSIRIS events.
174 virtual void OnInitcxx . . $ aiBlackStormTrooper#OnInit(d4f767463ce0a6b3).(int me_handle);
175 virtual void OnDestroycxx . . $ aiBlackStormTrooper#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt);
176 virtual void OnIntervalcxx . . $ aiBlackStormTrooper#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
177 virtual bool OnNotifycxx . . $ aiBlackStormTrooper#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data);
178 virtual void OnDamagedcxx . . $ aiBlackStormTrooper#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt);
179 virtual void OnMemRestorecxx . . $ aiBlackStormTrooper#OnMemRestore(5d22bdacc48458e8).(void *ptr) { memorycxx . . $ aiBlackStormTrooper#memory. = (t_bst_memorycxx . . $ aiBlackStormTrooper#t_bst_memory# *)ptr; };
180
181 private:
182 void find_targetscxx . . $ aiBlackStormTrooper#find_targets(918ebd27a9ddbad3).(int me_handle, bool new_snipe_point);
183 };
184
185 class aiCreepercxx . . $ aiCreeper# : public aiObjScriptcxx . . $ aiObjScript# {
186 public:
187 aiCreepercxx . . $ aiCreeper#aiCreeper(49f6e7a06ebc5aa8).();
188 ~cxx . . $ aiCreeper#`~aiCreeper`(ced63f7c635d850d).aiCreepercxx . . $ aiCreeper#();
189
190 private:
191 struct t_creep_memorycxx . . $ aiCreeper#t_creep_memory# {
192 float timercxx . . $ aiCreeper#t_creep_memory#timer.;
193 float eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer.;
194 int8_tcxx . . $ int8_t# statecxx . . $ aiCreeper#t_creep_memory#state.;
195 uint8_tcxx . . $ uint8_t# melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags.;
196 int16_t energycxx . . $ aiCreeper#t_creep_memory#energy.;
197 int16_t hitscxx . . $ aiCreeper#t_creep_memory#hits.;
198 int eye_objcxx . . $ aiCreeper#t_creep_memory#eye_obj.;
199 };
200
201 t_creep_memorycxx . . $ aiCreeper#t_creep_memory# *memorycxx . . $ aiCreeper#memory.;
202
203 void set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(int me_handle, int state);
204
205 protected:
206 // Handles all possible OSIRIS events.
207 virtual void OnInitcxx . . $ aiCreeper#OnInit(d4f767463ce0a6b3).(int me_handle);
208 virtual void OnDestroycxx . . $ aiCreeper#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt);
209 virtual void OnIntervalcxx . . $ aiCreeper#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
210 virtual bool OnNotifycxx . . $ aiCreeper#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data);
211 virtual void OnDamagedcxx . . $ aiCreeper#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt);
212 virtual void OnMemRestorecxx . . $ aiCreeper#OnMemRestore(5d22bdacc48458e8).(void *ptr) { memorycxx . . $ aiCreeper#memory. = (t_creep_memorycxx . . $ aiCreeper#t_creep_memory# *)ptr; };
213 };
214
215 class aiLukeTurretcxx . . $ aiLukeTurret# : public aiObjScriptcxx . . $ aiObjScript# {
216 struct t_lturret_memorycxx . . $ aiLukeTurret#t_lturret_memory# {
217 float timercxx . . $ aiLukeTurret#t_lturret_memory#timer.;
218 };
219
220 t_lturret_memorycxx . . $ aiLukeTurret#t_lturret_memory# *memorycxx . . $ aiLukeTurret#memory.;
221
222 public:
223 aiLukeTurretcxx . . $ aiLukeTurret#aiLukeTurret(49f6e7a06ebc5aa8).(){};
224 ~cxx . . $ aiLukeTurret#`~aiLukeTurret`(ced63f7c635d850d).aiLukeTurretcxx . . $ aiLukeTurret#(){};
225
226 protected:
227 virtual void OnInitcxx . . $ aiLukeTurret#OnInit(d4f767463ce0a6b3).(int me_handle);
228 virtual bool OnNotifycxx . . $ aiLukeTurret#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data);
229 virtual void OnIntervalcxx . . $ aiLukeTurret#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
230 virtual void OnMemRestorecxx . . $ aiLukeTurret#OnMemRestore(5d22bdacc48458e8).(void *ptr) { memorycxx . . $ aiLukeTurret#memory. = (t_lturret_memorycxx . . $ aiLukeTurret#t_lturret_memory# *)ptr; };
231 };
232
233 class aiSTBlackBarrelcxx . . $ aiSTBlackBarrel# : public aiObjScriptcxx . . $ aiObjScript# {
234 struct t_stblackbarrel_memorycxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory# {
235 matrixcxx . . $ matrix# orientcxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory#orient.;
236 };
237
238 t_stblackbarrel_memorycxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory# *memorycxx . . $ aiSTBlackBarrel#memory.;
239
240 public:
241 aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#aiSTBlackBarrel(49f6e7a06ebc5aa8).(){};
242 ~cxx . . $ aiSTBlackBarrel#`~aiSTBlackBarrel`(ced63f7c635d850d).aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#(){};
243
244 protected:
245 virtual void OnInitcxx . . $ aiSTBlackBarrel#OnInit(d4f767463ce0a6b3).(int me_handle);
246 virtual void OnDestroycxx . . $ aiSTBlackBarrel#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt);
247 virtual void OnDamagedcxx . . $ aiSTBlackBarrel#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt);
248 virtual void OnMemRestorecxx . . $ aiSTBlackBarrel#OnMemRestore(5d22bdacc48458e8).(void *ptr) { memorycxx . . $ aiSTBlackBarrel#memory. = (t_stblackbarrel_memorycxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory# *)ptr; };
249 };
250
251 ///////////////////////////////////////////////////////////////////////////////
252 // InitializeDLL
253 // Purpose:
254 // This function gets called when the DLL first gets loaded. It will only be called once (until the
255 // DLL is unloaded). Passed in is a struct of data passed from the game needed for the DLL to interact
256 // with D3. Usually this function will just call osicommon_Initialize(), which sets up the imported
257 // functions. However, you can alloc some memory or whatever in this function, and free it in ShutdownDLL().
258 // Note: You cannot call any imported functions until osicommon_Initialize() is called.
259 // Returns 1 if initialization went ok, 0 if there was an error and the DLL should not be loaded.
260 char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) {
261 osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list);
262 String_table_sizecxx . . $ String_table_size. = func_list->string_countcxx . . $ tOSIRISModuleInit#string_count.;
263 String_tablecxx . . $ String_table. = func_list->string_tablecxx . . $ tOSIRISModuleInit#string_table.;
264 if (func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum. != CHECKSUMcxx . . $ `<built-in>:476:9`!) {
265 mprintfcxx . . $ mprintf.(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum., CHECKSUMcxx . . $ `<built-in>:476:9`!);
266 mprintfcxx . . $ mprintf.(0, "RECOMPILE YOUR SCRIPTS!!!\n");
267 return 0;
268 }
269 return 1;
270 }
271
272 // ShutdownDLL
273 // Purpose:
274 // This function is called right before a DLL is about to be unloaded from memory. You can free
275 // any unfree'd memory, or anything else you need to do. Don't worry about destroying any instances
276 // of scripts, as they will all be automatically destroyed before this function is called. The
277 // same goes for any memory allocated with Scrpt_MemAlloc(), as this will automatically be freed
278 // when a scripts instance is destroyed.
279 void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) {}
280
281 // GetGOScriptID
282 // Purpose:
283 // Given the name of the object (from it's pagename), this function will search through it's
284 // list of General Object Scripts for a script with a matching name (to see if there is a script
285 // for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID
286 // is to be returned back to Descent 3. This ID will be used from here on out for all future
287 // interaction with the DLL. Since doors are not part of the generic object's, it's possible
288 // for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER
289 // or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a
290 // door, else it is a 0. The return value is the unique identifier, else -1 if the script
291 // does not exist in the DLL.
292 int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) {
293 int i;
294 for (i = 0; i < NUM_IDScxx . . $ `scripts/aigame2.cpp:61:9`!; i++) {
295 if (strcmp(name, Script_namescxx . . $ Script_names.[i]) == 0) {
296 return (FIRST_IDcxx . . $ `scripts/aigame2.cpp:62:9`! + i);
297 }
298 }
299
300 return -1;
301 }
302
303 // CreateInstance
304 // Purpose:
305 // Given an ID from a call to GetGOScriptID(), this function will create a new instance for that
306 // particular script (by allocating and initializing memory, etc.). A pointer to this instance
307 // is to be returned back to Descent 3. This pointer will be passed around, along with the ID
308 // for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error.
309 void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) {
310 switch (id) {
311 case ID_SAMIRPESTcxx . . $ `scripts/aigame2.cpp:64:9`!:
312 return new aiSamirPestcxx . . $ aiSamirPest#;
313 case ID_BLACKSTORMTROOPcxx . . $ `scripts/aigame2.cpp:65:9`!:
314 return new aiBlackStormTroopercxx . . $ aiBlackStormTrooper#;
315 case ID_CREEPERcxx . . $ `scripts/aigame2.cpp:66:9`!:
316 return new aiCreepercxx . . $ aiCreeper#;
317 case ID_LUKETURRETcxx . . $ `scripts/aigame2.cpp:67:9`!:
318 return new aiLukeTurretcxx . . $ aiLukeTurret#;
319 case ID_STBLACKBARRELcxx . . $ `scripts/aigame2.cpp:68:9`!:
320 return new aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#;
321 }
322
323 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
324 }
325
326 // DestroyInstance
327 // Purpose:
328 // Given an ID, and a pointer to a particular instance of a script, this function will delete and
329 // destruct all information associated with that script, so it will no longer exist.
330 void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) {
331 switch (id) {
332 case ID_SAMIRPESTcxx . . $ `scripts/aigame2.cpp:64:9`!:
333 delete ((aiSamirPestcxx . . $ aiSamirPest# *)ptr);
334 break;
335 case ID_BLACKSTORMTROOPcxx . . $ `scripts/aigame2.cpp:65:9`!:
336 delete ((aiBlackStormTroopercxx . . $ aiBlackStormTrooper# *)ptr);
337 break;
338 case ID_CREEPERcxx . . $ `scripts/aigame2.cpp:66:9`!:
339 delete ((aiCreepercxx . . $ aiCreeper# *)ptr);
340 break;
341 case ID_LUKETURRETcxx . . $ `scripts/aigame2.cpp:67:9`!:
342 delete ((aiLukeTurretcxx . . $ aiLukeTurret# *)ptr);
343 break;
344 case ID_STBLACKBARRELcxx . . $ `scripts/aigame2.cpp:68:9`!:
345 delete ((aiSTBlackBarrelcxx . . $ aiSTBlackBarrel# *)ptr);
346 break;
347 }
348 }
349
350 // CallInstanceEvent
351 // Purpose:
352 // Given an ID, a pointer to a script instance, an event and a pointer to the struct of
353 // information about the event, this function will translate who this event belongs to and
354 // passes the event to that instance of the script to be handled. Return a combination of
355 // CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the
356 // event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level
357 // script, mission script, and finally default script). If CONTINUE_CHAIN is not specified,
358 // than the chain is broken and those scripts of lower priority will never get the event. Return
359 // CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into
360 // the game for that event. This only pertains to certain events. If the chain continues
361 // after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority
362 // scripts return value.
363 int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
364 return ((aiObjScriptcxx . . $ aiObjScript# *)ptr)->CallEventcxx . . $ aiObjScript#CallEvent(585a6502c7945bab).(event, data);
365 }
366
367 // SaveRestoreState
368 // Purpose:
369 // This function is called when Descent 3 is saving or restoring the game state. In this function
370 // you should save/restore any global data that you want preserved through load/save (which includes
371 // demos). You must be very careful with this function, corrupting the file (reading or writing too
372 // much or too little) may be hazardous to the game (possibly making it impossible to restore the
373 // state). It would be best to use version information to keep older versions of saved states still
374 // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE
375 // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should
376 // write data to the file_ptr, 0 when you should read in the data.
377 int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) { return 0; }
378
379 static int CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(int me, const char *child_name, uint8_tcxx . . $ uint8_t# child_type, char parent_ap, char child_ap,
380 bool f_aligned = true, bool f_set_parent = false);
381 static void FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(int me_handle, int goal_priority);
382 static void SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(int obj_handle);
383 static void AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(int obj_handle, int ai_type);
384 static int TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(int objref, int gunpoint, int effect_type, float mass, float drag, int gravity_type, uint8_tcxx . . $ uint8_t# isreal,
385 float lifetime, float interval, float longevity, float size, float speed, uint8_tcxx . . $ uint8_t# random);
386
387 //////////////////////////////////////////////////////////////////////////////
388 // HELPER FUNCTIONS
389
390 // Returns the new child's handle
391 int CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(int me, const char *child_name, uint8_tcxx . . $ uint8_t# child_type, char parent_ap, char child_ap, bool f_aligned,
392 bool f_set_parent) {
393 int child_handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
394 int child_id = Obj_FindIDcxx . . $ Obj_FindID.(child_name);
395 msafe_structcxx . . $ msafe_struct# m;
396 m.objhandlecxx . . $ msafe_struct#objhandle. = me;
397 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_POScxx . . $ `scripts/osiris_common.h:820:9`!, &m);
398 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_ROOMNUMcxx . . $ `scripts/osiris_common.h:822:9`!, &m);
399
400 if (child_id >= 0) {
401 int parent;
402 if (f_set_parent)
403 parent = me;
404 else
405 parent = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
406
407 child_handle = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(child_type, child_id, m.roomnumcxx . . $ msafe_struct#roomnum., &m.poscxx . . $ msafe_struct#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, parent);
408 if (child_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
409 if (!Obj_AttachObjectAPcxx . . $ Obj_AttachObjectAP.(me, parent_ap, child_handle, child_ap, f_aligned)) {
410 // chrishack (we need a way to instantly kill scripted objects)
411 }
412 }
413 }
414
415 return child_handle;
416 }
417
418 void FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(int me_handle, int goal_priority) {
419 bool used;
420
421 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me_handle, goal_priority, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIGV_B_USEDcxx . . $ `scripts/osiris_common.h:618:9`!, &used);
422 if (used) {
423 int flags;
424 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me_handle, 3, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIGV_I_FLAGScxx . . $ `scripts/osiris_common.h:602:9`!, &flags);
425
426 if (!(flags & GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!)) {
427 AI_ClearGoalcxx . . $ AI_ClearGoal.(me_handle, goal_priority);
428 }
429 }
430 }
431
432 #define DALLAS_LOW_PRIORITY_GOAL_SLOTcxx . . $ `scripts/aigame2.cpp:432:9`! 0
433 #define DALLAS_HIGH_PRIORITY_GOAL_SLOTcxx . . $ `scripts/aigame2.cpp:433:9`! 3
434
435 // Wipes out all goals except slots 0 and 3 (used by Dallas)
436 void SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(int obj_handle) {
437 int i;
438
439 for (i = 0; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) {
440 if (i != DALLAS_LOW_PRIORITY_GOAL_SLOTcxx . . $ `scripts/aigame2.cpp:432:9`! && i != DALLAS_HIGH_PRIORITY_GOAL_SLOTcxx . . $ `scripts/aigame2.cpp:433:9`!) {
441 AI_ClearGoalcxx . . $ AI_ClearGoal.(obj_handle, i);
442 }
443 }
444 }
445
446 // Works like AI_SetType(), but won't clear out Dallas' goal slots 0 or 3
447 void AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(int obj_handle, int ai_type) {
448 float aware = AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!;
449 float time = 25.0f;
450
451 SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(obj_handle);
452
453 switch (ai_type) {
454 case AIT_STALKERcxx . . $ `Descent3/aistruct_external.h:75:9`!: {
455 vectorcxx . . $ vector# goal_pos;
456 int goal_room;
457
458 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &goal_pos);
459 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &goal_room);
460
461 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, 1, 1.0f, -1, GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &goal_pos,
462 goal_room);
463 } break;
464
465 case AIT_EVADER2cxx . . $ `Descent3/aistruct_external.h:77:9`!: {
466 vectorcxx . . $ vector# goal_pos;
467 int goal_room;
468 float size, circle_distance;
469
470 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &goal_pos);
471 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &goal_room);
472 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SIZEcxx . . $ `scripts/osiris_common.h:636:9`!, &size);
473 AI_Valuecxx . . $ AI_Value.(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:512:9`!, &circle_distance);
474
475 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!, 1, 1.0f, -1, GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!, &goal_pos, goal_room);
476 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, 1, size * 2.0f);
477 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
478 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
479
480 int gi = AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 3.0f, -1,
481 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
482 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, 1.0, 0.0, &circle_distance);
483 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, gi, circle_distance);
484 } break;
485
486 case AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!: {
487 float circle_distance;
488 AI_Valuecxx . . $ AI_Value.(obj_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:512:9`!, &circle_distance);
489
490 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 1, 1.0f, -1, GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_SPEED_ATTACKcxx . . $ `Descent3/aistruct_external.h:252:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!,
491 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
492 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
493 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
494
495 if (circle_distance > 0.0f) {
496 int gi = AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 3.0f, -1,
497 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
498
499 float temp = circle_distance * 0.55f;
500 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, 1.0, 0.0, &temp);
501 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, gi, circle_distance * 0.55f);
502 }
503 } break;
504
505 case AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!: {
506 int flags = AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!;
507 int m_goal;
508
509 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 1, 1.0f, -1,
510 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
511 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
512 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
513
514 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, 2, 1.0f, -1,
515 GF_SPEED_ATTACKcxx . . $ `Descent3/aistruct_external.h:252:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_USE_BLINE_IF_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:223:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!,
516 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
517 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_AI_STATUS_FLAGcxx . . $ `Descent3/aistruct_external.h:161:9`!, 1.0, 0.0, &flags);
518 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, 2, -100.0f);
519 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
520 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
521
522 m_goal = AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_MELEE_TARGETcxx . . $ `Descent3/aistruct_external.h:186:9`!, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 1.0f, -1,
523 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
524 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, m_goal, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
525 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, m_goal, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
526 } break;
527
528 case AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!: {
529 } break;
530
531 case AIT_HERD1cxx . . $ `Descent3/aistruct_external.h:82:9`!: {
532 } break;
533
534 case AIT_STATIONARY_TURRETcxx . . $ `Descent3/aistruct_external.h:78:9`!:
535 break;
536
537 case AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!:
538 break;
539
540 case AIT_FLYLANDERcxx . . $ `Descent3/aistruct_external.h:74:9`!:
541 break;
542
543 default: {
544 mprintfcxx . . $ mprintf.(0, "Invalid AI type passed into AI_SafeSetType()\n");
545 }
546 }
547 }
548
549 int TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(int objref, int gunpoint, int effect_type, float mass, float drag, int gravity_type, uint8_tcxx . . $ uint8_t# isreal,
550 float lifetime, float interval, float longevity, float size, float speed, uint8_tcxx . . $ uint8_t# random) {
551 msafe_structcxx . . $ msafe_struct# mstruct;
552
553 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = objref;
554 mstruct.gunpointcxx . . $ msafe_struct#gunpoint. = gunpoint;
555 mstruct.effect_typecxx . . $ msafe_struct#effect_type. = effect_type;
556 mstruct.masscxx . . $ msafe_struct#mass. = mass;
557 mstruct.dragcxx . . $ msafe_struct#drag. = drag;
558 mstruct.phys_infocxx . . $ msafe_struct#phys_info. = gravity_type;
559 mstruct.is_realcxx . . $ msafe_struct#is_real. = isreal;
560 mstruct.lifetimecxx . . $ msafe_struct#lifetime. = lifetime;
561 mstruct.intervalcxx . . $ msafe_struct#interval. = interval;
562 mstruct.longevitycxx . . $ msafe_struct#longevity. = longevity;
563 mstruct.sizecxx . . $ msafe_struct#size. = size;
564 mstruct.speedcxx . . $ msafe_struct#speed. = speed;
565 mstruct.randomcxx . . $ msafe_struct#random. = (random) ? SPEW_RAND_SIZEcxx . . $ `scripts/osiris_common.h:442:9`! | SPEW_RAND_LIFETIMEcxx . . $ `scripts/osiris_common.h:443:9`! | SPEW_RAND_SPEEDcxx . . $ `scripts/osiris_common.h:441:9`! : 0;
566
567 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_START_SPEWcxx . . $ `scripts/osiris_common.h:815:9`!, &mstruct);
568
569 return mstruct.idcxx . . $ msafe_struct#id.;
570 }
571
572 //////////////////////////////////////////////////////////////////////////////
573 // aiObjScript
574 // all ai scripts will have this as a base function.
575 int16_t aiObjScriptcxx . . $ aiObjScript#::CallEventcxx . . $ aiObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
576 switch (event) {
577 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
578 OnInitcxx . . $ aiObjScript#OnInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
579 break;
580 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
581 OnIntervalcxx . . $ aiObjScript#OnInterval(67333b58276f6108).(data);
582 break;
583 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
584 if (!OnNotifycxx . . $ aiObjScript#OnNotify(4ce66e6d2248ca63).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify.))
585 return 0;
586 break;
587 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
588 OnDestroycxx . . $ aiObjScript#OnDestroy(2e83fcfe4732ba14).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_destroycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_destroy.);
589 break;
590 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
591 OnCollidecxx . . $ aiObjScript#OnCollide(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide..it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.);
592 break;
593 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
594 OnDamagedcxx . . $ aiObjScript#OnDamaged(1a3e688ec82e7ded).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged.);
595 break;
596 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
597 OnMemRestorecxx . . $ aiObjScript#OnMemRestore(5d22bdacc48458e8).(data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.);
598 break;
599 }
600
601 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
602 };
603
604 //////////////////////////////////////////////////////////////////////////////
605 // aiSamirPest
606 // The Samir Pest
607
608 // ai base class
609 aiSamirPestcxx . . $ aiSamirPest#::aiSamirPestcxx . . $ aiSamirPest#aiSamirPest(49f6e7a06ebc5aa8).() { memorycxx . . $ aiSamirPest#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; }
610
611 aiSamirPestcxx . . $ aiSamirPest#::~cxx . . $ aiSamirPest#`~aiSamirPest`(ced63f7c635d850d).aiSamirPestcxx . . $ aiSamirPest#() {}
612
613 void aiSamirPestcxx . . $ aiSamirPest#::OnInitcxx . . $ aiSamirPest#OnInit(d4f767463ce0a6b3).(int me_handle) {
614 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
615
616 mprintfcxx . . $ mprintf.(0, "OnInit\n");
617
618 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
619 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(aiSamirPestcxx . . $ aiSamirPest#::t_pest_memorycxx . . $ aiSamirPest#t_pest_memory#);
620 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
621 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me_handle;
622
623 memorycxx . . $ aiSamirPest#memory. = (aiSamirPestcxx . . $ aiSamirPest#::t_pest_memorycxx . . $ aiSamirPest#t_pest_memory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
624
625 memorycxx . . $ aiSamirPest#memory.->tail_handlecxx . . $ aiSamirPest#t_pest_memory#tail_handle. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me_handle, "Pesttail", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 0, 0);
626 memorycxx . . $ aiSamirPest#memory.->last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame. = 0;
627
628 memorycxx . . $ aiSamirPest#memory.->foot_soundscxx . . $ aiSamirPest#t_pest_memory#foot_sounds.[0] = Sound_FindIdcxx . . $ Sound_FindId.("RbtPestFoot1");
629 memorycxx . . $ aiSamirPest#memory.->foot_soundscxx . . $ aiSamirPest#t_pest_memory#foot_sounds.[1] = Sound_FindIdcxx . . $ Sound_FindId.("RbtPestFoot2");
630 memorycxx . . $ aiSamirPest#memory.->foot_soundscxx . . $ aiSamirPest#t_pest_memory#foot_sounds.[2] = Sound_FindIdcxx . . $ Sound_FindId.("RbtPestFoot3");
631
632 memorycxx . . $ aiSamirPest#memory.->statecxx . . $ aiSamirPest#t_pest_memory#state. = PEST_STATE_ROAMcxx . . $ `scripts/aigame2.cpp:99:9`!;
633
634 AI_SetTypecxx . . $ AI_SetType.(me_handle, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
635 }
636
637 void aiSamirPestcxx . . $ aiSamirPest#::OnDestroycxx . . $ aiSamirPest#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt) {
638 mprintfcxx . . $ mprintf.(0, "OnDestroy\n");
639
640 msafe_structcxx . . $ msafe_struct# mstruct;
641
642 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiSamirPest#memory.->tail_handlecxx . . $ aiSamirPest#t_pest_memory#tail_handle.;
643 mstruct.killer_handlecxx . . $ msafe_struct#killer_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
644 mstruct.damage_typecxx . . $ msafe_struct#damage_type. = GD_SCRIPTEDcxx . . $ `Descent3/damage_external.h:32:9`!;
645 mstruct.amountcxx . . $ msafe_struct#amount. = 1000.0f;
646
647 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_DAMAGE_OBJECTcxx . . $ `scripts/osiris_common.h:811:9`!, &mstruct);
648 }
649
650 void aiSamirPestcxx . . $ aiSamirPest#::OnIntervalcxx . . $ aiSamirPest#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
651 float frame;
652 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &frame);
653 if ((frame > 9 && memorycxx . . $ aiSamirPest#memory.->last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame. <= 9) || (frame > 10 && memorycxx . . $ aiSamirPest#memory.->last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame. <= 10) ||
654 (frame > 13 && memorycxx . . $ aiSamirPest#memory.->last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame. <= 13)) {
655 int index = randcxx . . $ rand(9efc7249d839d30e).() % 3;
656
657 Sound_Play3dcxx . . $ Sound_Play3d(1df3af30621f6c78).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., memorycxx . . $ aiSamirPest#memory.->foot_soundscxx . . $ aiSamirPest#t_pest_memory#foot_sounds.[index]);
658 }
659
660 memorycxx . . $ aiSamirPest#memory.->last_anim_framecxx . . $ aiSamirPest#t_pest_memory#last_anim_frame. = frame;
661 }
662
663 void aiSamirPestcxx . . $ aiSamirPest#::OnCollidecxx . . $ aiSamirPest#OnCollide(3e454b8ccf442868).(int me_handle, int it_handle) {
664 int type;
665
666 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(it_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
667
668 if (type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && memorycxx . . $ aiSamirPest#memory.->statecxx . . $ aiSamirPest#t_pest_memory#state. != PEST_STATE_HIVEcxx . . $ `scripts/aigame2.cpp:100:9`!) {
669 // tell pest to return to hive.
670 int id = Scrpt_FindObjectNamecxx . . $ Scrpt_FindObjectName.("Hive");
671 int room_index;
672 vectorcxx . . $ vector# pos;
673
674 // force scripting for this.
675 AI_SetTypecxx . . $ AI_SetType.(me_handle, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
676
677 // go to hive location!
678 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
679 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_index);
680 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 1, 1.0, -1, GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_NOTIFIEScxx . . $ `Descent3/aistruct_external.h:219:9`!, &pos, room_index);
681 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me_handle, 1, 10.0f);
682
683 memorycxx . . $ aiSamirPest#memory.->statecxx . . $ aiSamirPest#t_pest_memory#state. = PEST_STATE_HIVEcxx . . $ `scripts/aigame2.cpp:100:9`!;
684 }
685 }
686
687 bool aiSamirPestcxx . . $ aiSamirPest#::OnNotifycxx . . $ aiSamirPest#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data) { return true; }
688
689 //////////////////////////////////////////////////////////////////////////////
690 // aiBlackStormTrooper
691 // CED Black Stormtrooper
692
693 // ai base class
694 aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::aiBlackStormTroopercxx . . $ aiBlackStormTrooper#aiBlackStormTrooper(49f6e7a06ebc5aa8).() { memorycxx . . $ aiBlackStormTrooper#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; }
695
696 aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::~cxx . . $ aiBlackStormTrooper#`~aiBlackStormTrooper`(ced63f7c635d850d).aiBlackStormTroopercxx . . $ aiBlackStormTrooper#() {}
697
698 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::OnInitcxx . . $ aiBlackStormTrooper#OnInit(d4f767463ce0a6b3).(int me_handle) {
699 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
700 int n_pts, j, i;
701
702 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
703 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::t_bst_memorycxx . . $ aiBlackStormTrooper#t_bst_memory#);
704 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
705 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me_handle;
706
707 memorycxx . . $ aiBlackStormTrooper#memory. = (aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::t_bst_memorycxx . . $ aiBlackStormTrooper#t_bst_memory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
708
709 // reset timer for robot.
710 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = 0;
711
712 for (i = 0; i < N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!; i++) {
713 memorycxx . . $ aiBlackStormTrooper#memory.->snipe_target_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_target_handles.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
714 }
715
716 // get sniper points available for trooper.
717 memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. = -1;
718 for (memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points. = 0; memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points. < N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!; memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.++) {
719 char buf[64];
720 char name[48];
721 int id;
722 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_S_NAMEcxx . . $ `scripts/osiris_common.h:649:9`!, name);
723 snprintf(buf, sizeof(buf), "Snipe%s-%c", name, 'A' + memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.);
724 id = Scrpt_FindObjectNamecxx . . $ Scrpt_FindObjectName.(buf);
725 if (id == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
726 break;
727 }
728 memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.] = id;
729 }
730
731 // determine reachable snipe points for each snipe point!
732 for (i = 0; i < memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.; i++) {
733 for (j = 0, n_pts = 0; j < memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.; j++) {
734 if (i != j) {
735 if (AI_IsObjReachablecxx . . $ AI_IsObjReachable.(memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[i], memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[j])) {
736 memorycxx . . $ aiBlackStormTrooper#memory.->access_arraycxx . . $ aiBlackStormTrooper#t_bst_memory#access_array.[i][n_pts++] = (int8_tcxx . . $ int8_t#)j;
737 }
738 }
739 }
740 memorycxx . . $ aiBlackStormTrooper#memory.->access_arraycxx . . $ aiBlackStormTrooper#t_bst_memory#access_array.[i][N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`! - 1] = (int8_tcxx . . $ int8_t#)n_pts;
741 }
742
743 // initialize miscellaneous stuff
744 memorycxx . . $ aiBlackStormTrooper#memory.->backpack_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#backpack_hp. = 200;
745 memorycxx . . $ aiBlackStormTrooper#memory.->flee_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#flee_hp. = 50;
746 memorycxx . . $ aiBlackStormTrooper#memory.->gun_sight_objcxx . . $ aiBlackStormTrooper#t_bst_memory#gun_sight_obj. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me_handle, "STEmitter", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 0, 0, true, true);
747 memorycxx . . $ aiBlackStormTrooper#memory.->ammo_barrelcxx . . $ aiBlackStormTrooper#t_bst_memory#ammo_barrel. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me_handle, "StormTrooperBlackBarrel", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 1, 0, true, true);
748 memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
749
750 memorycxx . . $ aiBlackStormTrooper#memory.->last_framecxx . . $ aiBlackStormTrooper#t_bst_memory#last_frame. = 0.0f;
751 memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
752 memorycxx . . $ aiBlackStormTrooper#memory.->laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted. = false;
753
754 // just wait for a target.
755 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(me_handle, STATE_INITcxx . . $ `scripts/aigame2.cpp:128:9`!);
756 }
757
758 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::find_targetscxx . . $ aiBlackStormTrooper#find_targets(918ebd27a9ddbad3).(int me_handle, bool new_snipe_point) {
759 vectorcxx . . $ vector# pos; // position of trooper
760 int room; // room of trooper
761
762 int nearby_objs[32]; // objhandles for nearby players (or robots)
763 int player_objs[8]; // nearby players.
764 int nobjs, np; // number of objects and players
765 int closest_player = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; // handle of closest player
766 float closest_player_dist = 10000.0f; // distance of closest player from trooper.
767 float current_player_dist = 10000.0f; // used to store distance of current targeted player
768 int i, j;
769
770 // now determine target, closest player?
771 // get nearby objects within 1000 units of trooper. our substitution for FOV check, since troopers
772 // are usually behind walls.
773 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
774 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
775
776 nobjs = AI_GetNearbyObjscxx . . $ AI_GetNearbyObjs(9d0c65cbff229ccc).(&pos, room, 500.0f, nearby_objs, 32,
777 false, // lightmaps, no.
778 true, // players and robots
779 false, // don't include non collide objects
780 true); // stop at doors, don't check behind them.
781
782 // get only players.
783 for (i = 0, np = 0; i < nobjs && np < 8; i++) {
784 int objtype = -1;
785
786 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(nearby_objs[i], VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &objtype);
787 if (objtype == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
788 // if a player, check if it's in the target list
789 // (the trooper must have seen the target at least once before to keep track of it)
790 for (j = 0; j < N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`!; j++) {
791 if (nearby_objs[i] == memorycxx . . $ aiBlackStormTrooper#memory.->snipe_target_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_target_handles.[j]) {
792 float dist;
793 player_objs[np++] = nearby_objs[i];
794 dist = AI_GetDistToObjcxx . . $ AI_GetDistToObj.(me_handle, nearby_objs[i]);
795 if (memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. == nearby_objs[i]) {
796 current_player_dist = dist;
797 }
798 if (closest_player_dist > dist) {
799 closest_player_dist = dist;
800 closest_player = nearby_objs[i];
801 }
802 }
803 }
804 }
805 }
806
807 //// lost all targets, go back into idle state.
808 if (closest_player == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
809 memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
810 return;
811 }
812
813 // if we don't have a target yet, make this player a target.
814 if (np && (memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! ||
815 (current_player_dist > closest_player_dist && memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. != closest_player))) {
816 memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. = closest_player;
817 AI_Valuecxx . . $ AI_Value.(me_handle, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle.);
818 mprintfcxx . . $ mprintf.(0, "BStorm: acquired new target through clairvoyance.\n");
819 }
820
821 // do something with snipe point if new_snipe_point is true (like find an ideal one)
822 }
823
824 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::OnDestroycxx . . $ aiBlackStormTrooper#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt) {
825 msafe_structcxx . . $ msafe_struct# mstruct;
826
827 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->ammo_barrelcxx . . $ aiBlackStormTrooper#t_bst_memory#ammo_barrel.;
828 mstruct.killer_handlecxx . . $ msafe_struct#killer_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
829 mstruct.damage_typecxx . . $ msafe_struct#damage_type. = GD_SCRIPTEDcxx . . $ `Descent3/damage_external.h:32:9`!;
830 mstruct.amountcxx . . $ msafe_struct#amount. = 1000.0f;
831
832 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_DAMAGE_OBJECTcxx . . $ `scripts/osiris_common.h:811:9`!, &mstruct);
833
834 if (memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
835 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj.;
836 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mstruct);
837 }
838
839 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->gun_sight_objcxx . . $ aiBlackStormTrooper#t_bst_memory#gun_sight_obj.;
840 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mstruct);
841 }
842
843 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::OnIntervalcxx . . $ aiBlackStormTrooper#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
844 msafe_structcxx . . $ msafe_struct# mstruct;
845 int me_handle = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
846 float anim_frame;
847 vectorcxx . . $ vector# pos;
848 int room;
849
850 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &anim_frame);
851 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
852 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
853
854 // laser gunsight
855 if (memorycxx . . $ aiBlackStormTrooper#memory.->laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted.) {
856 ray_infocxx . . $ ray_info# ray;
857 matrixcxx . . $ matrix# orient;
858
859 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
860
861 // Determine real start pos - room
862 vectorcxx . . $ vector# end_pos = pos;
863 end_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 2000.0f;
864
865 int fvi_flags = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`! | FQ_IGNORE_MOVING_OBJECTScxx . . $ `lib/findintersection_external.h:67:9`! |
866 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
867 int fate = FVI_RayCastcxx . . $ FVI_RayCast.(me_handle, &pos, &end_pos, room, 0.0f, fvi_flags, &ray);
868
869 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj., VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &ray.hit_roomcxx . . $ ray_info#hit_room.);
870 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj., VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &ray.hit_pointcxx . . $ ray_info#hit_point.);
871
872 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ aiBlackStormTrooper#memory.->laser_timercxx . . $ aiBlackStormTrooper#t_bst_memory#laser_timer.) {
873 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj.;
874 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mstruct);
875
876 memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
877 memorycxx . . $ aiBlackStormTrooper#memory.->laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted. = false;
878 }
879 }
880
881 // check if the pack is gone
882 int attached_handle = Obj_GetAttachChildHandlecxx . . $ Obj_GetAttachChildHandle.(me_handle, 1);
883 if (attached_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
884 aObjDestroycxx . . $ aObjDestroy(d4f767463ce0a6b3).(me_handle);
885 return;
886 }
887
888 // state code.
889 switch (memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state.) {
890 case STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!:
891 // we didn't find a valid snipe point? try to find one after a certain amount of time.
892 // this will ensure that every so often, if there is no valid snipe point specified,
893 // we will try to find one.
894 if (memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points. == 0) {
895 if (Game_GetTimecxx . . $ Game_GetTime.() > memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer.) {
896 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`!);
897 }
898 } else if (memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. == -1) {
899 if (Game_GetTimecxx . . $ Game_GetTime.() > memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer.) {
900 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!);
901 }
902 }
903 break;
904
905 case STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`!:
906 // snipe for a certain amount of time, then return to base.
907 if (memorycxx . . $ aiBlackStormTrooper#memory.->laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted. == false) {
908 int type;
909
910 memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj. = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, Obj_FindIDcxx . . $ Obj_FindID.("Invisiblepowerup"), room, &pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, me_handle);
911 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj.;
912 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
913
914 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &mstruct.roomnumcxx . . $ msafe_struct#roomnum.);
915 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &mstruct.poscxx . . $ msafe_struct#pos.);
916 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &mstruct.pos2cxx . . $ msafe_struct#pos2.);
917
918 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiBlackStormTrooper#memory.->gun_sight_objcxx . . $ aiBlackStormTrooper#t_bst_memory#gun_sight_obj.;
919 mstruct.ithandlecxx . . $ msafe_struct#ithandle. = memorycxx . . $ aiBlackStormTrooper#memory.->camera_objcxx . . $ aiBlackStormTrooper#t_bst_memory#camera_obj.;
920 mstruct.lifetimecxx . . $ msafe_struct#lifetime. = 5.0f;
921 mstruct.sizecxx . . $ msafe_struct#size. = 1.0f;
922
923 mstruct.intervalcxx . . $ msafe_struct#interval. = 1.0f;
924 mstruct.countcxx . . $ msafe_struct#count. = 2;
925 mstruct.indexcxx . . $ msafe_struct#index. = 1;
926 mstruct.texnumcxx . . $ msafe_struct#texnum. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.("Stlaser");
927 mstruct.colorcxx . . $ msafe_struct#color. = ((128 >> 3) << 10) | ((128 >> 3) << 5) | (128 >> 3);
928
929 mstruct.statecxx . . $ msafe_struct#state. = 0;
930 mstruct.flagscxx . . $ msafe_struct#flags. = 0;
931
932 memorycxx . . $ aiBlackStormTrooper#memory.->laser_timercxx . . $ aiBlackStormTrooper#t_bst_memory#laser_timer. = Game_GetTimecxx . . $ Game_GetTime.() + mstruct.lifetimecxx . . $ msafe_struct#lifetime.;
933 memorycxx . . $ aiBlackStormTrooper#memory.->laser_targetedcxx . . $ aiBlackStormTrooper#t_bst_memory#laser_targeted. = true;
934
935 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_WEATHER_LIGHTNING_BOLTcxx . . $ `scripts/osiris_common.h:863:9`!, &mstruct);
936 // mprintf(0, "BStorm: TARGETING!!!\n");
937 }
938
939 if (Game_GetTimecxx . . $ Game_GetTime.() > memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer.) {
940 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!);
941 }
942 break;
943
944 case STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`!:
945 if (Game_GetTimecxx . . $ Game_GetTime.() > memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer.) {
946 if (memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
947 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!);
948 } else {
949 int roll = (randcxx . . $ rand(9efc7249d839d30e).() % 100);
950 if (roll <= 50) {
951 find_targetscxx . . $ aiBlackStormTrooper#find_targets(918ebd27a9ddbad3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., false);
952 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + ((memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) ? 5.0f : 2.0f);
953 }
954 }
955 }
956 if (Game_GetTimecxx . . $ Game_GetTime.() > memorycxx . . $ aiBlackStormTrooper#memory.->snipe_timercxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_timer.) {
957 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`!);
958 memorycxx . . $ aiBlackStormTrooper#memory.->snipe_timercxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_timer. = Game_GetTimecxx . . $ Game_GetTime.() + 3.0f + (randcxx . . $ rand(9efc7249d839d30e).() % 7) * 0.5f;
959 }
960 break;
961 }
962
963 memorycxx . . $ aiBlackStormTrooper#memory.->last_framecxx . . $ aiBlackStormTrooper#t_bst_memory#last_frame. = anim_frame;
964 }
965
966 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::OnDamagedcxx . . $ aiBlackStormTrooper#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt) {
967 if (memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state. == STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`! || memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state. == STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`!) {
968 memorycxx . . $ aiBlackStormTrooper#memory.->flee_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#flee_hp. -= (int16_t)evt->damagecxx . . $ tOSIRISEVTDAMAGED#damage.;
969 if (memorycxx . . $ aiBlackStormTrooper#memory.->flee_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#flee_hp. <= 0) {
970 memorycxx . . $ aiBlackStormTrooper#memory.->flee_hpcxx . . $ aiBlackStormTrooper#t_bst_memory#flee_hp. = 50;
971 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(me_handle, STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!);
972 }
973 }
974 }
975
976 bool aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::OnNotifycxx . . $ aiBlackStormTrooper#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data) {
977 switch (data->notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type.) {
978 case AIN_FIRED_WEAPONcxx . . $ `Descent3/aistruct_external.h:314:9`!:
979 // Create gun barrel smoke
980 TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(me_handle, 0, 7, 0.0f, 0.0f, 65536, false, 0.5f, 0.1f, 0.7f, 1.0f, 15.0f, true);
981 break;
982
983 case AIN_SEE_TARGETcxx . . $ `Descent3/aistruct_external.h:289:9`!:
984 memorycxx . . $ aiBlackStormTrooper#memory.->snipe_target_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_target_handles.[0] = data->it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle.;
985 // mprintf(0, "BStorm: See target!!\n");
986 if (memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state. == STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!) {
987 // mprintf(0, "BStorm: Found target!!\n");
988 memorycxx . . $ aiBlackStormTrooper#memory.->target_handlecxx . . $ aiBlackStormTrooper#t_bst_memory#target_handle. = memorycxx . . $ aiBlackStormTrooper#memory.->snipe_target_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_target_handles.[0];
989 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(me_handle, STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!);
990
991 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper Saw target!\n");
992 }
993 break;
994
995 //@@ case AIN_SEE_TARGET:
996 //@@ // snipe!!
997 //@@ if (memory->state == STATE_IDLE) {
998 //@@ mprintf(0, "Acquired!\n");
999 //@@ set_state(me_handle, STATE_HIDE);
1000 //@@ }
1001 //@@ else if (memory->state == STATE_BASE && memory->timer < Game_GetTime()) {
1002 //@@ if ((rand() % 100) < 60) {
1003 //@@ set_state(me_handle, STATE_SNIPE);
1004 //@@ }
1005 //@@ memory->timer = Game_GetTime() + 2.0f + (rand() % 6)*0.5f;
1006 //// use timer to switch states.
1007 //@@ }
1008 break;
1009
1010 case AIN_NEAR_TARGETcxx . . $ `Descent3/aistruct_external.h:298:9`!:
1011 if (memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state. == STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`!) {
1012 // mprintf(0, "BStorm: Near target, must flee.\n");
1013 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(me_handle, STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!);
1014 }
1015 break;
1016
1017 case AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!:
1018 if (data->goal_uidcxx . . $ tOSIRISEVTAINOTIFY#goal_uid. == GOAL_UID_GETTOPOScxx . . $ `scripts/aigame2.cpp:80:9`!) {
1019 // mprintf(0, "BStorm: At hiding position %d.\n", memory->cur_snipe_point);
1020 set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(me_handle, STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`!);
1021 }
1022 break;
1023
1024 case AIN_HIT_BY_WEAPONcxx . . $ `Descent3/aistruct_external.h:299:9`!:
1025 // check if backpack hit. if so, deduct hitpoints, if 0, frag it.
1026 // also, if hit enough, force another hide action.
1027 break;
1028 }
1029
1030 return true;
1031 }
1032
1033 void aiBlackStormTroopercxx . . $ aiBlackStormTrooper#::set_statecxx . . $ aiBlackStormTrooper#set_state(3e454b8ccf442868).(int me_handle, int state) {
1034 int room_number, id, i;
1035 vectorcxx . . $ vector# pos;
1036 char buf[64];
1037 char name[48];
1038 float dist;
1039
1040 // SafeGoalClearAll(me_handle);
1041
1042 retry_set_state:
1043 switch (state) {
1044 case STATE_INITcxx . . $ `scripts/aigame2.cpp:128:9`!:
1045 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper set to init mode.\n");
1046 state = STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!;
1047 goto retry_set_state;
1048
1049 case STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!:
1050 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper set to idle mode.\n");
1051
1052 // AI_SafeSetType(me_handle, AIT_EVADER2);
1053 ///*
1054 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 1);
1055 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1056 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1057 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1058
1059 dist = 10.0f;
1060 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!, 0, 1.0f, -1, GF_NOTIFIEScxx . . $ `Descent3/aistruct_external.h:219:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &pos, room_number);
1061 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me_handle, 0, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
1062 //*/
1063
1064 // mprintf(0, "BStorm: Idling around.\n");
1065 break;
1066
1067 case STATE_BASEcxx . . $ `scripts/aigame2.cpp:129:9`!:
1068 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper set to base mode.\n");
1069
1070 // AI_SafeSetType(me_handle, AIT_EVADER2);
1071 ///*
1072 // okay, we will stand still, wait to snipe, face target, try to acquire targets, etc.
1073 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 1);
1074 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1075 if (memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. == -1) {
1076 // mprintf(0, "BStorm: Eek! We should be hiding, not basing!");
1077 state = STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!;
1078 goto retry_set_state;
1079 }
1080 id = memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point.];
1081 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1082 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1083
1084 dist = 0.0f;
1085 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!, 2, 1.0f, -1, GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &pos, room_number);
1086 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me_handle, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
1087 //*/
1088
1089 /*
1090 AI_AddGoal(me_handle, AIG_FIRE_AT_OBJ, ACTIVATION_BLEND_LEVEL, 1.0f, -1, GF_ORIENT_TARGET |
1091 GF_SPEED_ATTACK |
1092 GF_KEEP_AT_COMPLETION |
1093 GF_OBJ_IS_TARGET,
1094 NULL, GST_NEG_FVEC);
1095 */
1096
1097 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 2.0f; // use timer to reacquire targets.
1098 memorycxx . . $ aiBlackStormTrooper#memory.->snipe_timercxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_timer. = Game_GetTimecxx . . $ Game_GetTime.() + 2.0f + (randcxx . . $ rand(9efc7249d839d30e).() % 7) * 0.5f;
1099
1100 find_targetscxx . . $ aiBlackStormTrooper#find_targets(918ebd27a9ddbad3).(me_handle, false);
1101 // mprintf(0, "BStorm: Base\n");
1102 break;
1103
1104 case STATE_HIDEcxx . . $ `scripts/aigame2.cpp:130:9`!:
1105 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper set to hide mode.\n");
1106 // find a snipe point that's different from current one.
1107 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 1);
1108 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1109 if (memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.) {
1110 if (memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. == -1) {
1111 // find a snipe point now!
1112 // bot is either fresh or has been wandering, looking for a place to snipe
1113 for (i = 0; i < memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.; i++) {
1114 if (AI_IsObjReachablecxx . . $ AI_IsObjReachable.(me_handle, memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[i])) {
1115 break;
1116 }
1117 }
1118 if (i == memorycxx . . $ aiBlackStormTrooper#memory.->snipe_pointscxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_points.) {
1119 // hmm, the bot is not in a good place. have him wander until he finds a snipe point.
1120 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 4.0f;
1121 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1122 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1123 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, 1, 1.0f, -1, GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`! | GF_NOTIFIEScxx . . $ `Descent3/aistruct_external.h:219:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!,
1124 &pos, room_number);
1125 mprintfcxx . . $ mprintf.(0, "BStorm: WARNING-0 no valid snipe point nearby. Design problem?\n");
1126 } else {
1127 memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. = i;
1128 }
1129 } else {
1130 // this will get an index into the reachable snipe points.
1131 int n_valid_pts = memorycxx . . $ aiBlackStormTrooper#memory.->access_arraycxx . . $ aiBlackStormTrooper#t_bst_memory#access_array.[memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point.][N_SNIPE_POINTScxx . . $ `scripts/aigame2.cpp:78:9`! - 1];
1132
1133 if (n_valid_pts > 0) {
1134 i = randcxx . . $ rand(9efc7249d839d30e).() % n_valid_pts;
1135 memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. = memorycxx . . $ aiBlackStormTrooper#memory.->access_arraycxx . . $ aiBlackStormTrooper#t_bst_memory#access_array.[memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point.][i];
1136 } else {
1137 memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. = -1; // force a periodic check for a snipe point.
1138 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 4.0f;
1139 mprintfcxx . . $ mprintf.(0, "BStorm: WARNING-1 no valid snipe point nearby. Design problem?\n");
1140 }
1141 }
1142
1143 // by now, we either have a new valid snipe point, or no snipe point.
1144 if (memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point. != -1) {
1145 id = memorycxx . . $ aiBlackStormTrooper#memory.->snipe_point_handlescxx . . $ aiBlackStormTrooper#t_bst_memory#snipe_point_handles.[memorycxx . . $ aiBlackStormTrooper#memory.->cur_snipe_pointcxx . . $ aiBlackStormTrooper#t_bst_memory#cur_snipe_point.];
1146 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1147 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(id, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1148 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, 1.0, GOAL_UID_GETTOPOScxx . . $ `scripts/aigame2.cpp:80:9`!, GF_NOTIFIEScxx . . $ `Descent3/aistruct_external.h:219:9`! | GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!,
1149 &pos, room_number);
1150 /*
1151 AI_AddGoal(me_handle, AIG_FIRE_AT_OBJ, ACTIVATION_BLEND_LEVEL, 1.0f, -1, GF_ORIENT_TARGET |
1152 GF_SPEED_ATTACK |
1153 GF_KEEP_AT_COMPLETION |
1154 GF_OBJ_IS_TARGET,
1155 NULL, GST_NEG_FVEC);
1156 */
1157
1158 // mprintf(0, "BStorm: Hide to point %d\n", memory->cur_snipe_point+1);
1159 }
1160 } else {
1161 // bot will track you with no snipe points..
1162 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 3.0f;
1163 dist = 80.0f + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!) * 10.0f;
1164 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 1, 1.0f, -1, GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!,
1165 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
1166 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me_handle, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
1167 }
1168 break;
1169
1170 case STATE_SNIPEcxx . . $ `scripts/aigame2.cpp:131:9`!:
1171 mprintfcxx . . $ mprintf.(0, "Black Stormtrooper set to snipe mode.\n");
1172
1173 // AI_SafeSetType(me_handle, AIT_EVADER1);
1174 ///*
1175 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1176
1177 // dist = 80.0f + ((float)rand()/(float)RAND_MAX)*10.0f;
1178 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 1, 1.0f, -1, GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!,
1179 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
1180 // AI_GoalValue(me_handle, 1, VF_SET, AIGV_F_CIRCLE_DIST, &dist);
1181 //*/
1182
1183 /*
1184 AI_AddGoal(me_handle, AIG_FIRE_AT_OBJ, ACTIVATION_BLEND_LEVEL, 1.0f, -1, GF_ORIENT_TARGET |
1185 GF_SPEED_ATTACK |
1186 GF_KEEP_AT_COMPLETION |
1187 GF_OBJ_IS_TARGET,
1188 NULL, GST_NEG_FVEC);
1189 */
1190
1191 memorycxx . . $ aiBlackStormTrooper#memory.->timercxx . . $ aiBlackStormTrooper#t_bst_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 8.0f;
1192 // mprintf(0, "BStorm: Snipe!\n");
1193 break;
1194 }
1195
1196 memorycxx . . $ aiBlackStormTrooper#memory.->statecxx . . $ aiBlackStormTrooper#t_bst_memory#state. = state;
1197 }
1198
1199 //////////////////////////////////////////////////////////////////////////////
1200 // aiCreeper
1201
1202 // ai base class
1203 aiCreepercxx . . $ aiCreeper#::aiCreepercxx . . $ aiCreeper#aiCreeper(49f6e7a06ebc5aa8).() { memorycxx . . $ aiCreeper#memory. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; }
1204
1205 aiCreepercxx . . $ aiCreeper#::~cxx . . $ aiCreeper#`~aiCreeper`(ced63f7c635d850d).aiCreepercxx . . $ aiCreeper#() {}
1206
1207 void aiCreepercxx . . $ aiCreeper#::OnInitcxx . . $ aiCreeper#OnInit(d4f767463ce0a6b3).(int me_handle) {
1208 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
1209 int flags;
1210
1211 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
1212 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(aiCreepercxx . . $ aiCreeper#::t_creep_memorycxx . . $ aiCreeper#t_creep_memory#);
1213 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
1214 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me_handle;
1215
1216 memorycxx . . $ aiCreeper#memory. = (aiCreepercxx . . $ aiCreeper#::t_creep_memorycxx . . $ aiCreeper#t_creep_memory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
1217
1218 // reset timer for robot.
1219 memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. = 0;
1220
1221 // initialize the creeper eye
1222 memorycxx . . $ aiCreeper#memory.->eye_objcxx . . $ aiCreeper#t_creep_memory#eye_obj. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me_handle, "CreeperEye", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 0, 0);
1223 memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer. = 0.0f;
1224
1225 // get sniper points available for trooper. n
1226 memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. = -1;
1227 memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. = 10;
1228 memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. = 50;
1229
1230 AI_Valuecxx . . $ AI_Value.(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1231 memorycxx . . $ aiCreeper#memory.->melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags. = (uint8_tcxx . . $ uint8_t#)(flags & (AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`! | AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!));
1232
1233 // set initial state of creeper
1234 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(me_handle, STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!);
1235 }
1236
1237 void aiCreepercxx . . $ aiCreeper#::OnDamagedcxx . . $ aiCreeper#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt) {
1238 if (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_ATTACKcxx . . $ `scripts/aigame2.cpp:132:9`!) {
1239 if (memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. > -25) {
1240 memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. = memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. - (int8_tcxx . . $ int8_t#)evt->damagecxx . . $ tOSIRISEVTDAMAGED#damage.;
1241 // mprintf(0, "[Creeper] hits = %d\n", memory->hits);
1242 }
1243 if (memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. < 0) {
1244 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(me_handle, STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!);
1245 }
1246 }
1247 }
1248
1249 void aiCreepercxx . . $ aiCreeper#::OnDestroycxx . . $ aiCreeper#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt) {
1250 msafe_structcxx . . $ msafe_struct# mstruct;
1251
1252 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiCreeper#memory.->eye_objcxx . . $ aiCreeper#t_creep_memory#eye_obj.;
1253 mstruct.killer_handlecxx . . $ msafe_struct#killer_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1254 mstruct.damage_typecxx . . $ msafe_struct#damage_type. = GD_SCRIPTEDcxx . . $ `Descent3/damage_external.h:32:9`!;
1255 mstruct.amountcxx . . $ msafe_struct#amount. = 1000.0f;
1256
1257 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_DAMAGE_OBJECTcxx . . $ `scripts/osiris_common.h:811:9`!, &mstruct);
1258 }
1259
1260 void aiCreepercxx . . $ aiCreeper#::OnIntervalcxx . . $ aiCreeper#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
1261 int flags;
1262
1263 switch (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state.) {
1264 case STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!:
1265 case STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!:
1266 if (memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. < Game_GetTimecxx . . $ Game_GetTime.()) {
1267 if (memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. < 10) {
1268 memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. += (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!) ? 2 : 1;
1269 memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 1.0f;
1270 if (memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. > 10) {
1271 memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. = 10;
1272 }
1273 }
1274 if (memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. < 25) {
1275 memorycxx . . $ aiCreeper#memory.->hitscxx . . $ aiCreeper#t_creep_memory#hits. += (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!) ? 10 : 7;
1276 }
1277
1278 if (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`! && memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer. != 0.0f) {
1279 // now cloak rest of body 1 sec after eye cloaked.
1280 msafe_structcxx . . $ msafe_struct# m;
1281 m.objhandlecxx . . $ msafe_struct#objhandle. = data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.;
1282 m.lifetimecxx . . $ msafe_struct#lifetime. = memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer.;
1283 m.statecxx . . $ msafe_struct#state. = 1;
1284
1285 memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer. = 0.0f;
1286
1287 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_CLOAKcxx . . $ `scripts/osiris_common.h:837:9`!, &m);
1288 }
1289 }
1290
1291 if (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`! && memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer. == 0.0f) {
1292 if (!Obj_IsEffectcxx . . $ Obj_IsEffect.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., EF_FADING_OUTcxx . . $ `Descent3/object_external.h:207:9`! | EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)) {
1293 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_ATTACKcxx . . $ `scripts/aigame2.cpp:132:9`!);
1294 }
1295 }
1296 break;
1297
1298 case STATE_ATTACKcxx . . $ `scripts/aigame2.cpp:132:9`!:
1299 if (memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. < Game_GetTimecxx . . $ Game_GetTime.()) {
1300 // recloak and recharge.
1301 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!);
1302 } else {
1303 flags = AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
1304 if (memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. <= 5 && (memorycxx . . $ aiCreeper#memory.->melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags. & AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!)) {
1305 AI_Valuecxx . . $ AI_Value.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1306 memorycxx . . $ aiCreeper#memory.->melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags. &= (~AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!);
1307 } else if (memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. > 5 && !(memorycxx . . $ aiCreeper#memory.->melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags. & AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!)) {
1308 AI_Valuecxx . . $ AI_Value.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1309 memorycxx . . $ aiCreeper#memory.->melee_flagscxx . . $ aiCreeper#t_creep_memory#melee_flags. |= AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
1310 }
1311 }
1312 }
1313 }
1314
1315 bool aiCreepercxx . . $ aiCreeper#::OnNotifycxx . . $ aiCreeper#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data) {
1316 vectorcxx . . $ vector# pos;
1317 int room_number;
1318
1319 switch (data->notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type.) {
1320 case AIN_SEE_TARGETcxx . . $ `Descent3/aistruct_external.h:289:9`!:
1321 case AIN_NEAR_TARGETcxx . . $ `Descent3/aistruct_external.h:298:9`!:
1322 // rules: leave's base state if recharged enough-->cloaks
1323 if (memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. == STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!) {
1324 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(me_handle, STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!);
1325 }
1326 // mprintf(0, "[Creeper] see notify %d\n", data->notify_type);
1327 break;
1328
1329 case AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!:
1330 case AIN_PLAYER_SEES_YOUcxx . . $ `Descent3/aistruct_external.h:290:9`!:
1331 case AIN_ANIM_COMPLETEcxx . . $ `Descent3/aistruct_external.h:306:9`!:
1332 case AIN_BUMPED_OBJcxx . . $ `Descent3/aistruct_external.h:307:9`!:
1333 break;
1334
1335 case AIN_MELEE_ATTACK_FRAMEcxx . . $ `Descent3/aistruct_external.h:309:9`!:
1336 // reduce energy accordingly depending on attack.
1337 if (data->attack_numcxx . . $ tOSIRISEVTAINOTIFY#$anonymous_type_0#attack_num. == 1) {
1338 // blast ring attack
1339 int wpnid;
1340
1341 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1342 Obj_GetGunPoscxx . . $ Obj_GetGunPos(acebd7a68d406969).(me_handle, 0, &pos);
1343
1344 wpnid = Wpn_FindIDcxx . . $ Wpn_FindID.("CreeperBlastRing");
1345 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, wpnid, room_number, &pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, me_handle);
1346
1347 memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. -= 5;
1348 // mprintf(0, "[Creeper] Special attack.\n");
1349 } else {
1350 // standard attack
1351 memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. -= 3;
1352 }
1353
1354 if (memorycxx . . $ aiCreeper#memory.->energycxx . . $ aiCreeper#t_creep_memory#energy. < 3) {
1355 set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(me_handle, STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!);
1356 }
1357 break;
1358
1359 // default:
1360 // mprintf(0, "[Creeper] notify %d\n", data->notify_type);
1361 }
1362
1363 return true;
1364 }
1365
1366 void aiCreepercxx . . $ aiCreeper#::set_statecxx . . $ aiCreeper#set_state(3e454b8ccf442868).(int me_handle, int state) {
1367 int room_number = 0, id, i, flags;
1368 vectorcxx . . $ vector# pos;
1369 char buf[64];
1370 char name[48];
1371 msafe_structcxx . . $ msafe_struct# m;
1372 float circle_dist;
1373 char cenable;
1374
1375 retry_set_state:
1376 switch (state) {
1377 case STATE_IDLEcxx . . $ `scripts/aigame2.cpp:127:9`!:
1378 // stay at one position until ready. note that if attacked , it will flee in this state.
1379 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1380
1381 memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 1.0f;
1382
1383 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1384 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room_number);
1385
1386 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 1, 1.0f, -1, GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &pos, room_number);
1387 // mprintf(0, "[Creeper] Idle\n");
1388 break;
1389
1390 case STATE_STALKcxx . . $ `scripts/aigame2.cpp:133:9`!:
1391 // cloak and stalk player.
1392 // FlushGoal(me_handle, 3); // take out any priority goals set.
1393 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2); // take out any goals previously set
1394
1395 memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 1.0f; // set timer for recharge!
1396 // memory->timer = Game_GetTime() + 1.0f + (rand()%4) * 0.5f;
1397
1398 m.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ aiCreeper#memory.->eye_objcxx . . $ aiCreeper#t_creep_memory#eye_obj.;
1399 m.lifetimecxx . . $ msafe_struct#lifetime. = 5.0f + (randcxx . . $ rand(9efc7249d839d30e).() % 20) * 0.5f;
1400 m.statecxx . . $ msafe_struct#state. = 1;
1401
1402 memorycxx . . $ aiCreeper#memory.->eye_timercxx . . $ aiCreeper#t_creep_memory#eye_timer. = m.lifetimecxx . . $ msafe_struct#lifetime.;
1403
1404 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_CLOAKcxx . . $ `scripts/osiris_common.h:837:9`!, &m);
1405
1406 circle_dist = 40.0f;
1407 AI_Valuecxx . . $ AI_Value.(me_handle, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:512:9`!, &circle_dist);
1408 // AI_AddGoal(me_handle, AIG_WANDER_AROUND, 3, 1.0f, -1, GF_ORIENT_VELOCITY | GF_NOTIFIES |
1409 // GF_KEEP_AT_COMPLETION, &pos, room_number);
1410 AI_AddGoalcxx . . $ AI_AddGoal.(me_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 2, 1.0f, -1, GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0);
1411
1412 flags = AIF_DISABLE_MELEEcxx . . $ `Descent3/aistruct_external.h:375:9`!;
1413 AI_Valuecxx . . $ AI_Value.(me_handle, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1414
1415 cenable = 1;
1416 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_NEGATIVE_LIGHTcxx . . $ `scripts/osiris_common.h:651:9`!, &cenable);
1417 // mprintf(0, "[Creeper] Stalk\n");
1418 break;
1419
1420 case STATE_ATTACKcxx . . $ `scripts/aigame2.cpp:132:9`!:
1421 // FlushGoal(me_handle, 3); // we've decloaked, attack.
1422 FlushGoalcxx . . $ FlushGoal(3e454b8ccf442868).(me_handle, 2);
1423
1424 memorycxx . . $ aiCreeper#memory.->timercxx . . $ aiCreeper#t_creep_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 4.0f + (float)(randcxx . . $ rand(9efc7249d839d30e).() % 3);
1425 flags = AIF_DISABLE_MELEEcxx . . $ `Descent3/aistruct_external.h:375:9`!;
1426 AI_Valuecxx . . $ AI_Value.(me_handle, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1427
1428 cenable = 1;
1429 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_NEGATIVE_LIGHTcxx . . $ `scripts/osiris_common.h:651:9`!, &cenable);
1430 // mprintf(0, "[Creeper] Attack\n");
1431 break;
1432 }
1433
1434 memorycxx . . $ aiCreeper#memory.->statecxx . . $ aiCreeper#t_creep_memory#state. = state;
1435 }
1436
1437 // aiLukeTurret
1438 // Luke's funky turret
1439
1440 void aiLukeTurretcxx . . $ aiLukeTurret#::OnInitcxx . . $ aiLukeTurret#OnInit(d4f767463ce0a6b3).(int me_handle) {
1441 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
1442
1443 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
1444 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(aiLukeTurretcxx . . $ aiLukeTurret#::t_lturret_memorycxx . . $ aiLukeTurret#t_lturret_memory#);
1445 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
1446 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me_handle;
1447
1448 memorycxx . . $ aiLukeTurret#memory. = (aiLukeTurretcxx . . $ aiLukeTurret#::t_lturret_memorycxx . . $ aiLukeTurret#t_lturret_memory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
1449 memorycxx . . $ aiLukeTurret#memory.->timercxx . . $ aiLukeTurret#t_lturret_memory#timer. = -1.0f;
1450
1451 // turrets only activate when they 'hear' a player fire a weapon.
1452 int flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
1453
1454 AI_SetTypecxx . . $ AI_SetType.(me_handle, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
1455 AI_Valuecxx . . $ AI_Value.(me_handle, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1456 }
1457
1458 bool aiLukeTurretcxx . . $ aiLukeTurret#::OnNotifycxx . . $ aiLukeTurret#OnNotify(4ce66e6d2248ca63).(int me_handle, tOSIRISEVTAINOTIFYcxx . . $ tOSIRISEVTAINOTIFY# *data) {
1459 int flags;
1460
1461 switch (data->notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type.) {
1462 case AIN_OBJ_FIREDcxx . . $ `Descent3/aistruct_external.h:293:9`!:
1463 // set 5 seconds for turret awareness before it becomes inert.
1464 memorycxx . . $ aiLukeTurret#memory.->timercxx . . $ aiLukeTurret#t_lturret_memory#timer. = Game_GetTimecxx . . $ Game_GetTime.() + 12.0f;
1465 AI_SetTypecxx . . $ AI_SetType.(me_handle, AIT_STATIONARY_TURRETcxx . . $ `Descent3/aistruct_external.h:78:9`!);
1466 flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
1467 AI_Valuecxx . . $ AI_Value.(me_handle, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1468 break;
1469 }
1470
1471 return true;
1472 }
1473
1474 void aiLukeTurretcxx . . $ aiLukeTurret#::OnIntervalcxx . . $ aiLukeTurret#OnInterval(67333b58276f6108).(tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
1475 if (memorycxx . . $ aiLukeTurret#memory.->timercxx . . $ aiLukeTurret#t_lturret_memory#timer. == -1.0f)
1476 return;
1477
1478 if (memorycxx . . $ aiLukeTurret#memory.->timercxx . . $ aiLukeTurret#t_lturret_memory#timer. < Game_GetTimecxx . . $ Game_GetTime.()) {
1479 int flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
1480 AI_SetTypecxx . . $ AI_SetType.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
1481 AI_Valuecxx . . $ AI_Value.(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
1482 memorycxx . . $ aiLukeTurret#memory.->timercxx . . $ aiLukeTurret#t_lturret_memory#timer. = -1.0f;
1483 }
1484 }
1485
1486 // aiSTBlackBarrel
1487 // Black Stormtrooper's ammo pack
1488
1489 void aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#::OnInitcxx . . $ aiSTBlackBarrel#OnInit(d4f767463ce0a6b3).(int me_handle) {
1490 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
1491
1492 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = 4;
1493 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#::t_stblackbarrel_memorycxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory#);
1494 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
1495 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me_handle;
1496
1497 memorycxx . . $ aiSTBlackBarrel#memory. = (aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#::t_stblackbarrel_memorycxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
1498
1499 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &memorycxx . . $ aiSTBlackBarrel#memory.->orientcxx . . $ aiSTBlackBarrel#t_stblackbarrel_memory#orient.);
1500 }
1501
1502 void aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#::OnDestroycxx . . $ aiSTBlackBarrel#OnDestroy(2e83fcfe4732ba14).(int me_handle, tOSIRISEVTDESTROYcxx . . $ tOSIRISEVTDESTROY# *evt) {
1503 // Create a frag burst effect
1504 vectorcxx . . $ vector# pos, new_dir;
1505 int room;
1506 matrixcxx . . $ matrix# orient, new_orient;
1507
1508 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
1509 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
1510 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
1511
1512 new_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).orient.fveccxx . . $ matrix#fvec.;
1513 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&new_orient, &new_dir, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1514
1515 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, Wpn_FindIDcxx . . $ Wpn_FindID.("AlienBossFragBurst"), room, &pos, &new_orient, me_handle);
1516
1517 // mprintf(0,"Barrel destroyed.\n");
1518 }
1519
1520 void aiSTBlackBarrelcxx . . $ aiSTBlackBarrel#::OnDamagedcxx . . $ aiSTBlackBarrel#OnDamaged(1a3e688ec82e7ded).(int me_handle, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *evt) {
1521 // mprintf(0,"Barrel damaged...\n");
1522 }