Debian Codegraph @

scripts/AIGame3.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 // AIGame3.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 "AIGame3_External.h"cxx . . $ `<file>/scripts/AIGame3_External.h`/
30
31 #include "module.h"cxx . . $ `<file>/lib/module.h`/
32 #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/
33
34 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
35 extern "C" {
36 #endif
37 DLLEXPORTcxx . . $ `lib/module.h:114:9`! char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLL(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list);
38 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLL(void);
39 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptID(const char *name, uint8_tcxx . . $ uint8_t# isdoor);
40 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstance(int id);
41 DLLEXPORTcxx . . $ `lib/module.h:114:9`! void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstance(int id, void *ptr);
42 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEvent(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
43 DLLEXPORTcxx . . $ `lib/module.h:114:9`! int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreState(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state);
44 #ifdef __cpluspluscxx . . $ `<built-in>:467:9`!
45 }
46 #endif
47
48 static int String_table_sizecxx . . $ String_table_size. = 0;
49 static char **String_tablecxx . . $ String_table. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
50 static const char *_Error_stringcxx . . $ _Error_string. = "!!ERROR MISSING STRING!!";
51 static const char *_Empty_stringcxx . . $ _Empty_string. = "";
52 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int index) {
53 if ((index < 0) || (index >= String_table_sizecxx . . $ String_table_size.))
54 return _Error_stringcxx . . $ _Error_string.;
55 if (!String_tablecxx . . $ String_table.[index])
56 return _Empty_stringcxx . . $ _Empty_string.;
57 return String_tablecxx . . $ String_table.[index];
58 }
59 #define TXTcxx . . $ `scripts/AIGame3.cpp:59:9`!(x) GetStringFromTable(x)
60
61 //-------------------
62 // Function prototypes
63 //-------------------
64
65 static int TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(int objref, int gunpoint, int effect_type, float mass, float drag, int gravity_type, uint8_tcxx . . $ uint8_t# isreal,
66 float lifetime, float interval, float longevity, float size, float speed, uint8_tcxx . . $ uint8_t# random);
67 // Returns the new child's handle
68 static int CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(int me, const char *child_name, uint8_tcxx . . $ uint8_t# child_type, char parent_ap, char child_ap,
69 bool f_aligned = true, bool f_set_parent = false);
70
71 static int FindClosestPlayercxx . . $ FindClosestPlayer(7864480464b09eea).(int objhandle);
72
73 // Returns true if object current has an active Dallas low priority goal
74 static bool HasLowPriorityGoalcxx . . $ HasLowPriorityGoal(83c267b20bac841a).(int obj_handle);
75
76 // Returns true if object current has an active Dallas high priority goal
77 static bool HasHighPriorityGoalcxx . . $ HasHighPriorityGoal(83c267b20bac841a).(int obj_handle);
78
79 // Wipes out all goals except slots 0 and 3 (used by Dallas)
80 static void SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(int obj_handle);
81
82 static void AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(int obj_handle, int ai_type);
83
84 //----------------
85 // Name lookups
86 //----------------
87
88 // Name lookup globals
89 static uint16_tcxx . . $ uint16_t# energy_effect_idcxx . . $ energy_effect_id.; // weapon ID for the energy charge effect
90 static uint16_tcxx . . $ uint16_t# frag_burst_effect_idcxx . . $ frag_burst_effect_id.; // weapon ID for the frag burst effect
91 static uint16_tcxx . . $ uint16_t# boss_frag_burst_idcxx . . $ boss_frag_burst_id.; // weapon ID for the boss frag burst effect
92 static uint16_tcxx . . $ uint16_t# transfer_effect_idcxx . . $ transfer_effect_id.; // texture ID for the energy transfer lightning effect
93 static uint16_tcxx . . $ uint16_t# heal_effect_idcxx . . $ heal_effect_id.; // texture ID for the heal lightning effect
94 static uint16_tcxx . . $ uint16_t# boss_heal_effect_idcxx . . $ boss_heal_effect_id.; // texture ID for the boss heal lightning effect
95 static uint16_tcxx . . $ uint16_t# tractor_beam_effect_idcxx . . $ tractor_beam_effect_id.; // texture ID for the tractor beam effect
96 static uint16_tcxx . . $ uint16_t# alien_organism_idcxx . . $ alien_organism_id.; // object type ID for the alien organism robot
97 static uint16_tcxx . . $ uint16_t# shield_blast_idcxx . . $ shield_blast_id.; // weapon ID for the HT shield blast effect
98 static uint16_tcxx . . $ uint16_t# ht_grenade_idcxx . . $ ht_grenade_id.; // weapon ID for the HT grenade
99 static uint16_tcxx . . $ uint16_t# ht_grenade_effect_idcxx . . $ ht_grenade_effect_id.; // weapon ID for the HT grenade launch effect
100 static uint16_tcxx . . $ uint16_t# lifter_blast_effect_idcxx . . $ lifter_blast_effect_id.; // weapon ID for the lifter blast effect
101 static uint16_tcxx . . $ uint16_t# lifter_stick_effect_idcxx . . $ lifter_stick_effect_id.; // texture ID for lifter's night-stick lightning effect
102 static uint16_tcxx . . $ uint16_t# teleport_effect_idcxx . . $ teleport_effect_id.; // weapon ID for teleporting effect
103
104 static uint16_tcxx . . $ uint16_t# ht_grenade_sound_idcxx . . $ ht_grenade_sound_id.; // sound ID for firing the grenade
105
106 static uint16_tcxx . . $ uint16_t# powerup_idcxx . . $ powerup_id.; // invisible powerup id
107
108 static uint16_tcxx . . $ uint16_t# boss_flapping_idcxx . . $ boss_flapping_id.; // flapping sound id
109 static uint16_tcxx . . $ uint16_t# boss_turf_idcxx . . $ boss_turf_id.; // turf id
110 static uint16_tcxx . . $ uint16_t# boss_see_idcxx . . $ boss_see_id.;
111 static uint16_tcxx . . $ uint16_t# boss_hurt_idcxx . . $ boss_hurt_id.;
112
113 static uint16_tcxx . . $ uint16_t# lifter_pull_sound_idcxx . . $ lifter_pull_sound_id.;
114 static uint16_tcxx . . $ uint16_t# lifter_amb_sound_idcxx . . $ lifter_amb_sound_id.;
115
116 // ==========================
117 // AI Goal Related Functions
118 // ==========================
119
120 #define DALLAS_LOW_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:120:9`! 0
121 #define DALLAS_HIGH_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:121:9`! 3
122
123 // Returns true if object current has an active Dallas low priority goal
124 bool HasLowPriorityGoalcxx . . $ HasLowPriorityGoal(83c267b20bac841a).(int obj_handle) {
125 bool used;
126 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(obj_handle, DALLAS_LOW_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:120:9`!, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIGV_B_USEDcxx . . $ `scripts/osiris_common.h:618:9`!, &used);
127
128 return used;
129 }
130
131 // Returns true if object current has an active Dallas high priority goal
132 bool HasHighPriorityGoalcxx . . $ HasHighPriorityGoal(83c267b20bac841a).(int obj_handle) {
133 bool used;
134 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(obj_handle, DALLAS_HIGH_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:121:9`!, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIGV_B_USEDcxx . . $ `scripts/osiris_common.h:618:9`!, &used);
135
136 return used;
137 }
138
139 // Returns True if given index implies that a goal is finished
140 static inline bool IsGoalFinishedNotifycxx . . $ IsGoalFinishedNotify(83c267b20bac841a).(int index) {
141 return (index == AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`! || index == AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`! || index == AIN_GOAL_FAILcxx . . $ `Descent3/aistruct_external.h:295:9`! || index == AIN_GOAL_ERRORcxx . . $ `Descent3/aistruct_external.h:296:9`!);
142 }
143
144 // Wipes out all goals except slots 0 and 3 (used by Dallas)
145 void SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(int obj_handle) {
146 int i;
147
148 for (i = 0; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) {
149 if (i != DALLAS_LOW_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:120:9`! && i != DALLAS_HIGH_PRIORITY_GOAL_SLOTcxx . . $ `scripts/AIGame3.cpp:121:9`!) {
150 AI_ClearGoalcxx . . $ AI_ClearGoal.(obj_handle, i);
151 }
152 }
153 }
154
155 // Works like AI_SetType(), but won't clear out Dallas' goal slots 0 or 3
156 void AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(int obj_handle, int ai_type) {
157 float aware = AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!;
158 float time = 25.0f;
159
160 SafeGoalClearAllcxx . . $ SafeGoalClearAll(d4f767463ce0a6b3).(obj_handle);
161
162 switch (ai_type) {
163 case AIT_STALKERcxx . . $ `Descent3/aistruct_external.h:75:9`!: {
164 vectorcxx . . $ vector# goal_pos;
165 int goal_room;
166
167 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);
168 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);
169
170 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,
171 goal_room);
172 } break;
173
174 case AIT_EVADER2cxx . . $ `Descent3/aistruct_external.h:77:9`!: {
175 vectorcxx . . $ vector# goal_pos;
176 int goal_room;
177 float size, circle_distance;
178
179 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);
180 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);
181 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);
182 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);
183
184 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);
185 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, 1, size * 2.0f);
186 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
187 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
188
189 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,
190 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`!);
191 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, 1.0, 0.0, &circle_distance);
192 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, gi, circle_distance);
193 } break;
194
195 case AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!: {
196 float circle_distance;
197 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);
198
199 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`!,
200 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
201 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
202 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
203
204 if (circle_distance > 0.0f) {
205 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,
206 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`!);
207
208 float temp = circle_distance * 0.55f;
209 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, 1.0, 0.0, &temp);
210 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, gi, circle_distance * 0.55f);
211 }
212 } break;
213
214 case AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!: {
215 int flags = AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!;
216 int m_goal;
217
218 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, 1, 1.0f, -1,
219 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`!);
220 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
221 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
222
223 AI_AddGoalcxx . . $ AI_AddGoal.(obj_handle, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, 2, 1.0f, -1,
224 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`!,
225 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
226 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_AI_STATUS_FLAGcxx . . $ `Descent3/aistruct_external.h:161:9`!, 1.0, 0.0, &flags);
227 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(obj_handle, 2, -100.0f);
228 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
229 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, 2, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, 1.0, 0.0, &time);
230
231 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,
232 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`!);
233 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(obj_handle, m_goal, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, 1.0, 0.0, &aware);
234 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);
235 } break;
236
237 case AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!: {
238 } break;
239
240 case AIT_HERD1cxx . . $ `Descent3/aistruct_external.h:82:9`!: {
241 } break;
242
243 case AIT_STATIONARY_TURRETcxx . . $ `Descent3/aistruct_external.h:78:9`!:
244 break;
245
246 case AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!:
247 break;
248
249 case AIT_FLYLANDERcxx . . $ `Descent3/aistruct_external.h:74:9`!:
250 break;
251
252 default: {
253 mprintfcxx . . $ mprintf.(0, "Invalid AI type passed into AI_SafeSetType()\n");
254 }
255 }
256 }
257
258 // ============================
259 // Miscellaneous Utility Funcs
260 // ============================
261
262 int TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(int objref, int gunpoint, int effect_type, float mass, float drag, int gravity_type, uint8_tcxx . . $ uint8_t# isreal,
263 float lifetime, float interval, float longevity, float size, float speed, uint8_tcxx . . $ uint8_t# random) {
264 msafe_structcxx . . $ msafe_struct# mstruct;
265
266 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = objref;
267 mstruct.gunpointcxx . . $ msafe_struct#gunpoint. = gunpoint;
268 mstruct.effect_typecxx . . $ msafe_struct#effect_type. = effect_type;
269 mstruct.masscxx . . $ msafe_struct#mass. = mass;
270 mstruct.dragcxx . . $ msafe_struct#drag. = drag;
271 mstruct.phys_infocxx . . $ msafe_struct#phys_info. = gravity_type;
272 mstruct.is_realcxx . . $ msafe_struct#is_real. = isreal;
273 mstruct.lifetimecxx . . $ msafe_struct#lifetime. = lifetime;
274 mstruct.intervalcxx . . $ msafe_struct#interval. = interval;
275 mstruct.longevitycxx . . $ msafe_struct#longevity. = longevity;
276 mstruct.sizecxx . . $ msafe_struct#size. = size;
277 mstruct.speedcxx . . $ msafe_struct#speed. = speed;
278 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;
279
280 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_START_SPEWcxx . . $ `scripts/osiris_common.h:815:9`!, &mstruct);
281
282 return mstruct.idcxx . . $ msafe_struct#id.;
283 }
284
285 // Returns the new child's handle
286 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,
287 bool f_set_parent) {
288 int child_handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
289 int child_id = Obj_FindIDcxx . . $ Obj_FindID.(child_name);
290 msafe_structcxx . . $ msafe_struct# m;
291 m.objhandlecxx . . $ msafe_struct#objhandle. = me;
292 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_POScxx . . $ `scripts/osiris_common.h:820:9`!, &m);
293 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_ROOMNUMcxx . . $ `scripts/osiris_common.h:822:9`!, &m);
294
295 if (child_id >= 0) {
296 int parent;
297 if (f_set_parent)
298 parent = me;
299 else
300 parent = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
301
302 child_handle = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(child_type, child_id, m.roomnumcxx . . $ msafe_struct#roomnum., &m.poscxx . . $ msafe_struct#pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, parent);
303 if (child_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
304 if (!Obj_AttachObjectAPcxx . . $ Obj_AttachObjectAP.(me, parent_ap, child_handle, child_ap, f_aligned)) {
305 // chrishack (we need a way to instantly kill scripted objects)
306 }
307 }
308 }
309
310 return child_handle;
311 }
312
313 int FindClosestPlayercxx . . $ FindClosestPlayer(7864480464b09eea).(int objhandle) {
314 vectorcxx . . $ vector# objpos, playerpos;
315 float closest_dist = FLT_MAXcxx . . $ `<external>/18143172452841944454/float.h:104:9`!;
316 int closest_player = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
317 msafe_structcxx . . $ msafe_struct# mstruct;
318
319 // Get the object position
320 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = objhandle;
321 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_POScxx . . $ `scripts/osiris_common.h:820:9`!, &mstruct);
322 objpos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). mstruct.poscxx . . $ msafe_struct#pos.;
323
324 // Loop though all possible players and compute distance
325 for (int p = 0; p < MAX_PLAYERScxx . . $ `scripts/osiris_common.h:927:9`!; p++) {
326
327 // Get player position
328 mstruct.slotcxx . . $ msafe_struct#slot. = p;
329 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_PLAYER_HANDLEcxx . . $ `scripts/osiris_common.h:838:9`!, &mstruct);
330
331 // See if this player active
332 if (mstruct.objhandlecxx . . $ msafe_struct#objhandle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
333 continue;
334
335 // Get the target position
336 MSafe_GetValuecxx . . $ MSafe_GetValue.(MSAFE_OBJECT_POScxx . . $ `scripts/osiris_common.h:820:9`!, &mstruct);
337
338 // Get the normalized vector from the source to the target
339 float dist = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&objpos, &mstruct.poscxx . . $ msafe_struct#pos.);
340
341 if (dist < closest_dist) {
342 closest_dist = dist;
343 closest_player = mstruct.objhandlecxx . . $ msafe_struct#objhandle.;
344 }
345 }
346
347 return closest_player;
348 }
349
350 // ==================
351 // Clear Shot System
352 // ==================
353
354 // Clear shot constants
355 #define MAX_SCAN_SHOT_OBJECTScxx . . $ `scripts/AIGame3.cpp:355:9`! 30
356 #define MAX_SHOT_PATH_POSITIONScxx . . $ `scripts/AIGame3.cpp:356:9`! 256
357
358 // Reasons why not a clear shot
359 #define CS_ALL_CLEARcxx . . $ `scripts/AIGame3.cpp:359:9`! 0
360 #define CS_SHOOTER_IN_WAYcxx . . $ `scripts/AIGame3.cpp:360:9`! 1
361 #define CS_FRIEND_IN_WAYcxx . . $ `scripts/AIGame3.cpp:361:9`! 2
362 #define CS_NO_ENEMYcxx . . $ `scripts/AIGame3.cpp:362:9`! 3
363 #define CS_NO_PATHcxx . . $ `scripts/AIGame3.cpp:363:9`! 4
364
365 // Shot data structure
366 struct tShotDatacxx . . $ tShotData# {
367 int object_handlecxx . . $ tShotData#object_handle.; // IN: the object taking the shot
368 vectorcxx . . $ vector# start_pointcxx . . $ tShotData#start_point.; // IN: the starting point of the shot
369 int start_roomcxx . . $ tShotData#start_room.; // IN: the room that the starting point is in
370 vectorcxx . . $ vector# dircxx . . $ tShotData#dir.; // IN: the direction the shot is aimed
371 float max_distcxx . . $ tShotData#max_dist.; // IN: the maximum distance of the shot
372 float shot_radiuscxx . . $ tShotData#shot_radius.; // IN: the radius of the projectile (used for the ray thickness)
373 float danger_radiuscxx . . $ tShotData#danger_radius.; // IN: the initial danger radius for the scans
374 float radius_inccxx . . $ tShotData#radius_inc.; // IN: the danger radius increase multiplier
375 float risk_factorcxx . . $ tShotData#risk_factor.; // IN: the amount of risk a robot is willing to take
376 };
377
378 // Shot scan position data structure
379 struct tShotPathPositionDatacxx . . $ tShotPathPositionData# {
380 int num_friendscxx . . $ tShotPathPositionData#num_friends.; // Number of friends found at this path position
381 int num_enemiescxx . . $ tShotPathPositionData#num_enemies.; // Number of enemies found at this path position
382 int num_neutralscxx . . $ tShotPathPositionData#num_neutrals.; // Number of neutrals found at this path position
383 bool contains_shootercxx . . $ tShotPathPositionData#contains_shooter.; // Whether or not this path position contains the shooter
384 float path_distcxx . . $ tShotPathPositionData#path_dist.; // The shot path distance of this scan position from the start
385 float scan_radiuscxx . . $ tShotPathPositionData#scan_radius.; // The radius of the scan that was done at this shot position
386 };
387
388 // Clear shot globals
389 static tShotPathPositionDatacxx . . $ tShotPathPositionData# ShotPathPositionscxx . . $ ShotPathPositions.[MAX_SHOT_PATH_POSITIONScxx . . $ `scripts/AIGame3.cpp:356:9`!];
390 static int num_shot_path_positionscxx . . $ num_shot_path_positions.;
391
392 static bool ScanShotPathPositioncxx . . $ ScanShotPathPosition(2bee5f36dd05922c).(int obj_handle, vectorcxx . . $ vector# *pos, int room, float radius, float dist);
393 static float TraverseShotPathcxx . . $ TraverseShotPath(65ce5d19730039b1).(tShotDatacxx . . $ tShotData# *shot_data);
394 static int ShotIsClearcxx . . $ ShotIsClear(1bb0578f3efdc255).(float risk_factor);
395 static int HasClearShotcxx . . $ HasClearShot(9af2993f90940be2).(tShotDatacxx . . $ tShotData# *shot_data);
396
397 // Scans area around given shot position for object data
398 bool ScanShotPathPositioncxx . . $ ScanShotPathPosition(2bee5f36dd05922c).(int obj_handle, vectorcxx . . $ vector# *pos, int room, float radius, float dist) {
399 int scan_objs[MAX_SCAN_SHOT_OBJECTScxx . . $ `scripts/AIGame3.cpp:355:9`!];
400 int n_scan;
401 int n, i;
402 int type;
403
404 // Make sure there is still a shot scan position available
405 if (num_shot_path_positionscxx . . $ num_shot_path_positions. >= MAX_SHOT_PATH_POSITIONScxx . . $ `scripts/AIGame3.cpp:356:9`!) {
406 return false;
407 }
408
409 // Init this shot path position's data
410 n = num_shot_path_positionscxx . . $ num_shot_path_positions.;
411 ShotPathPositionscxx . . $ ShotPathPositions.[n].contains_shootercxx . . $ tShotPathPositionData#contains_shooter. = false;
412 ShotPathPositionscxx . . $ ShotPathPositions.[n].path_distcxx . . $ tShotPathPositionData#path_dist. = dist;
413 ShotPathPositionscxx . . $ ShotPathPositions.[n].scan_radiuscxx . . $ tShotPathPositionData#scan_radius. = radius;
414 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_enemiescxx . . $ tShotPathPositionData#num_enemies. = 0;
415 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_friendscxx . . $ tShotPathPositionData#num_friends. = 0;
416 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_neutralscxx . . $ tShotPathPositionData#num_neutrals. = 0;
417
418 // Scan for any nearby objects
419 // NOTE: check the func below to see what other params do!!!
420 n_scan = AI_GetNearbyObjscxx . . $ AI_GetNearbyObjs(9d0c65cbff229ccc).(pos, room, radius, scan_objs, MAX_SCAN_SHOT_OBJECTScxx . . $ `scripts/AIGame3.cpp:355:9`!, false, true, false, true);
421
422 // Go through the objects that have been found and store tallies
423 for (i = 0; i < n_scan; i++) {
424 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(scan_objs[i], VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
425 if (type == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
426 // Make sure it's not cloaked
427 if (qObjectCloakTimecxx . . $ qObjectCloakTime(5cde91ea12d43f46).(scan_objs[i]) == 0.0f) {
428 // Tallie the object accordingly
429 if (scan_objs[i] == obj_handle) {
430 // It's the shooter
431 ShotPathPositionscxx . . $ ShotPathPositions.[n].contains_shootercxx . . $ tShotPathPositionData#contains_shooter. = true;
432 } else if (AI_IsObjEnemycxx . . $ AI_IsObjEnemy.(obj_handle, scan_objs[i])) {
433 // It's an enemy
434 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_enemiescxx . . $ tShotPathPositionData#num_enemies.++;
435 } else if (AI_IsObjFriendcxx . . $ AI_IsObjFriend.(obj_handle, scan_objs[i])) {
436 // It's a friend
437 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_friendscxx . . $ tShotPathPositionData#num_friends.++;
438 } else {
439 // It's a neutral
440 ShotPathPositionscxx . . $ ShotPathPositions.[n].num_neutralscxx . . $ tShotPathPositionData#num_neutrals.++;
441 }
442 }
443 }
444 }
445 num_shot_path_positionscxx . . $ num_shot_path_positions.++;
446
447 return true;
448 }
449
450 // Traverses the straight-line shot path and gathers object data
451 float TraverseShotPathcxx . . $ TraverseShotPath(65ce5d19730039b1).(tShotDatacxx . . $ tShotData# *shot_data) {
452 float next_scan_dist, scan_radius;
453 float current_path_dist, dist;
454 vectorcxx . . $ vector# start_pos, end_pos, target_pos;
455 vectorcxx . . $ vector# shot_dir;
456 int start_room, end_room;
457 int flags, fate;
458 ray_infocxx . . $ ray_info# ray;
459 bool done, max_distance_reached;
460
461 // Clear out any existing shot scan positions
462 num_shot_path_positionscxx . . $ num_shot_path_positions. = 0;
463
464 // Setup the shot's starting data
465 start_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). shot_data->start_pointcxx . . $ tShotData#start_point.;
466 start_room = shot_data->start_roomcxx . . $ tShotData#start_room.;
467 shot_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). shot_data->dircxx . . $ tShotData#dir.;
468 next_scan_dist = shot_data->danger_radiuscxx . . $ tShotData#danger_radius.;
469 scan_radius = shot_data->danger_radiuscxx . . $ tShotData#danger_radius.;
470
471 // Start scanning
472 current_path_dist = 0.0f;
473 max_distance_reached = false;
474 done = false;
475
476 while (!done) {
477 // Check the max shot distance
478 if ((current_path_dist + next_scan_dist) >= shot_data->max_distcxx . . $ tShotData#max_dist.) {
479 next_scan_dist = shot_data->max_distcxx . . $ tShotData#max_dist. - current_path_dist;
480 max_distance_reached = true;
481 }
482
483 // Calculate shot's target position
484 target_pos =cxx . . $ vector#`operator=`(c0842353a20857d). start_pos +cxx . . $ operator+(b77b703cd1e43e33). (shot_dir *cxx . . $ `operator*`(252247219a31502c). next_scan_dist);
485
486 // Cast a ray to see if a wall or any clutter objects lie in the target path
487 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`! |
488 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
489 fate =
490 FVI_RayCastcxx . . $ FVI_RayCast.(shot_data->object_handlecxx . . $ tShotData#object_handle., &start_pos, &target_pos, start_room, shot_data->shot_radiuscxx . . $ tShotData#shot_radius., flags, &ray);
491
492 // Store the ray hit point and room
493 end_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
494 end_room = ray.hit_roomcxx . . $ ray_info#hit_room.;
495
496 // If necessary, calculate the distance from start point to the hit point
497 if (fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) {
498 dist = next_scan_dist;
499 } else {
500 dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&start_pos, &end_pos);
501 }
502
503 // Add the new distance to our total shot path distance
504 current_path_dist += dist;
505
506 // If it hit a wall, change the direction (perfect reflection)
507 if (fate == HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`!) {
508 // Calculate the bounce dir from the current dir and face normal
509 vectorcxx . . $ vector# new_dir = (-2.0f * (shot_dir *cxx . . $ `operator*`(4a721543d64e126a). ray.hit_wallnormcxx . . $ ray_info#hit_wallnorm.)) *cxx . . $ `operator*`(9d6577ff3e9faa29). ray.hit_wallnormcxx . . $ ray_info#hit_wallnorm. +cxx . . $ operator+(b77b703cd1e43e33). shot_dir;
510 shot_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). new_dir;
511
512 // Now, if necessary, cast another ray to finish off the scan dist
513 next_scan_dist -= dist;
514 if (next_scan_dist > 0.0f) {
515 start_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). end_pos;
516 start_room = end_room;
517 continue;
518 }
519 }
520
521 // Do an object scan at this point
522 if (!ScanShotPathPositioncxx . . $ ScanShotPathPosition(2bee5f36dd05922c).(shot_data->object_handlecxx . . $ tShotData#object_handle., &end_pos, end_room, scan_radius, current_path_dist)) {
523 done = true;
524 continue;
525 }
526
527 // Obj_Create(OBJ_WEAPON, energy_effect_id, end_room, &end_pos, NULL, shot_data->object_handle);
528
529 // If max distance was reached or we hit a clutter object, we're done
530 if (max_distance_reached || fate == HIT_OBJECTcxx . . $ `lib/findintersection_external.h:47:9`!) {
531 done = true;
532 continue;
533 }
534
535 // Update data for next run
536 next_scan_dist = scan_radius * 2.0f;
537 scan_radius *= shot_data->radius_inccxx . . $ tShotData#radius_inc.;
538 start_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). end_pos;
539 start_room = end_room;
540 }
541
542 return true;
543 }
544
545 // Analyzes data to determine if shot is clear
546 int ShotIsClearcxx . . $ ShotIsClear(1bb0578f3efdc255).(float risk_factor) {
547 int j;
548
549 if (num_shot_path_positionscxx . . $ num_shot_path_positions. == 0)
550 return CS_NO_PATHcxx . . $ `scripts/AIGame3.cpp:363:9`!;
551
552 // If final shot path position contains shooter, don't shoot!
553 if (ShotPathPositionscxx . . $ ShotPathPositions.[num_shot_path_positionscxx . . $ num_shot_path_positions. - 1].contains_shootercxx . . $ tShotPathPositionData#contains_shooter.)
554 return CS_SHOOTER_IN_WAYcxx . . $ `scripts/AIGame3.cpp:360:9`!;
555
556 for (j = 0; j < num_shot_path_positionscxx . . $ num_shot_path_positions.; j++) {
557 // Check and see if shooter is in the way (ok if it's the first position)
558 if (ShotPathPositionscxx . . $ ShotPathPositions.[j].contains_shootercxx . . $ tShotPathPositionData#contains_shooter. && j != 0)
559 return CS_SHOOTER_IN_WAYcxx . . $ `scripts/AIGame3.cpp:360:9`!;
560
561 // Check if there are any friendlies or neutrals in the way
562 if ((ShotPathPositionscxx . . $ ShotPathPositions.[j].num_friendscxx . . $ tShotPathPositionData#num_friends. + ShotPathPositionscxx . . $ ShotPathPositions.[j].num_neutralscxx . . $ tShotPathPositionData#num_neutrals.) > 0)
563 return CS_FRIEND_IN_WAYcxx . . $ `scripts/AIGame3.cpp:361:9`!;
564
565 // Check if any enemies are in the way
566 if (ShotPathPositionscxx . . $ ShotPathPositions.[j].num_enemiescxx . . $ tShotPathPositionData#num_enemies. > 0 && !ShotPathPositionscxx . . $ ShotPathPositions.[j].contains_shootercxx . . $ tShotPathPositionData#contains_shooter.)
567 return CS_ALL_CLEARcxx . . $ `scripts/AIGame3.cpp:359:9`!;
568 }
569
570 return CS_NO_ENEMYcxx . . $ `scripts/AIGame3.cpp:362:9`!;
571 }
572
573 // Checks to see if object has a clear shot
574 int HasClearShotcxx . . $ HasClearShot(9af2993f90940be2).(tShotDatacxx . . $ tShotData# *shot_data) {
575 // Traverse the shot trajectory, gathering data
576 TraverseShotPathcxx . . $ TraverseShotPath(65ce5d19730039b1).(shot_data);
577
578 // Analyze the shot data
579 return (ShotIsClearcxx . . $ ShotIsClear(1bb0578f3efdc255).(shot_data->risk_factorcxx . . $ tShotData#risk_factor.));
580 }
581
582 // ==========================
583 // Script class definitions
584 // ==========================
585 #define NUM_IDScxx . . $ `scripts/AIGame3.cpp:585:9`! 6 // maximum number of IDs
586
587 #define ID_ALIENORGANISMcxx . . $ `scripts/AIGame3.cpp:587:9`! 1 // Alien organism robot
588 #define ID_HEAVYTROOPERcxx . . $ `scripts/AIGame3.cpp:588:9`! 2 // CED Heavy Trooper robot
589 #define ID_LIFTERcxx . . $ `scripts/AIGame3.cpp:589:9`! 3 // Lifter robot
590 #define ID_ALIENBOSScxx . . $ `scripts/AIGame3.cpp:590:9`! 4 // Alien Mini-boss
591 #define ID_SECURITYCAMERAcxx . . $ `scripts/AIGame3.cpp:591:9`! 5 // Security Camera
592 #define ID_CROWDCONTROLcxx . . $ `scripts/AIGame3.cpp:592:9`! 6 // Crowd Control for Merc6 Barges
593
594 struct tScriptInfocxx . . $ tScriptInfo# {
595 int idcxx . . $ tScriptInfo#id.;
596 const char *namecxx . . $ tScriptInfo#name.;
597 };
598
599 static tScriptInfocxx . . $ tScriptInfo# ScriptInfocxx . . $ ScriptInfo.[NUM_IDScxx . . $ `scripts/AIGame3.cpp:585:9`!] = {
600 {ID_ALIENORGANISMcxx . . $ `scripts/AIGame3.cpp:587:9`!, "AlienOrganism"}, {ID_HEAVYTROOPERcxx . . $ `scripts/AIGame3.cpp:588:9`!, "HeavyTrooper"}, {ID_LIFTERcxx . . $ `scripts/AIGame3.cpp:589:9`!, "Lifter"},
601 {ID_ALIENBOSScxx . . $ `scripts/AIGame3.cpp:590:9`!, "AlienBoss"}, {ID_SECURITYCAMERAcxx . . $ `scripts/AIGame3.cpp:591:9`!, "SecurityCamera"}, {ID_CROWDCONTROLcxx . . $ `scripts/AIGame3.cpp:592:9`!, "CrowdControl"}};
602
603 class BaseObjScriptcxx . . $ BaseObjScript# {
604 public:
605 BaseObjScriptcxx . . $ BaseObjScript#BaseObjScript(49f6e7a06ebc5aa8).();
606 ~cxx . . $ BaseObjScript#`~BaseObjScript`(ced63f7c635d850d).BaseObjScriptcxx . . $ BaseObjScript#();
607 virtual int16_t CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
608 };
609
610 // Priority Constants
611 #define LOW_PRIORITYcxx . . $ `scripts/AIGame3.cpp:611:9`! 0
612 #define MEDIUM_PRIORITYcxx . . $ `scripts/AIGame3.cpp:612:9`! 1
613 #define HIGH_PRIORITYcxx . . $ `scripts/AIGame3.cpp:613:9`! 2
614
615 //---------------------
616 // AlienOrganism class
617 //---------------------
618
619 // Alien Mode Types
620 #define ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`! 0
621 #define ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! 1
622 #define ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! 2
623 #define ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`! 3
624 #define ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`! 4
625
626 #define ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`! 10
627 #define ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`! 11
628 #define ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`! 12
629 #define ALIEN_FINDING_BIRTHPLACEcxx . . $ `scripts/AIGame3.cpp:629:9`! 13
630 #define ALIEN_GIVING_BIRTHcxx . . $ `scripts/AIGame3.cpp:630:9`! 14
631
632 #define ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`! 20
633 #define ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`! 21
634
635 #define ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`! 31
636 #define ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`! 32
637
638 #define ALIEN_MODE_NONEcxx . . $ `scripts/AIGame3.cpp:638:9`! 50
639
640 // General Alien Constants
641 #define ALIEN_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:641:9`! 4
642 #define ALIEN_TYPE_NAMEcxx . . $ `scripts/AIGame3.cpp:642:9`! "AlienOrganism"
643
644 #define ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`! 20.0f
645 #define ALIEN_ENERGY_SUCK_CHARGEcxx . . $ `scripts/AIGame3.cpp:645:9`! 20.0f
646 #define ALIEN_ENERGY_BOLT_COSTcxx . . $ `scripts/AIGame3.cpp:646:9`! 2.0f
647
648 #define ALIEN_HEAL_PERCENTAGEcxx . . $ `scripts/AIGame3.cpp:648:9`! 0.50f
649 #define ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`! 2.0f
650
651 #define ALIEN_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:651:9`! 0.5f
652 #define ALIEN_SQUAD_RECRUIT_RADIUScxx . . $ `scripts/AIGame3.cpp:652:9`! 100.0f
653
654 #define ALIEN_MAX_TAKEOFF_TIMEcxx . . $ `scripts/AIGame3.cpp:654:9`! 0.7f
655
656 // Alien Lookup Names
657 #define ALIEN_ENERGY_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:657:9`! "AlienEnergyEffect"
658 #define ALIEN_TRANSFER_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:658:9`! "FunkyEffect1"
659 #define ALIEN_HEAL_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:659:9`! "FunkyEffectGreen"
660
661 // Alien Flee Constants
662 #define ALIEN_ON_FIRE_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:662:9`! 80
663 #define ALIEN_NEAR_FIRE_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:663:9`! 25
664 #define ALIEN_SQUADIE_FLEE_SAVING_THROWcxx . . $ `scripts/AIGame3.cpp:664:9`! 5
665 #define ALIEN_LEADER_FLEE_SAVING_THROWcxx . . $ `scripts/AIGame3.cpp:665:9`! 10
666
667 // Alien goal complete IDs
668 #define ALIEN_GUID_GOT_HOMEcxx . . $ `scripts/AIGame3.cpp:668:9`! 0x10100001
669 #define ALIEN_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:669:9`! 0x10100002
670 #define ALIEN_GUID_FOUND_BIRTHPLACEcxx . . $ `scripts/AIGame3.cpp:670:9`! 0x10100003
671 #define ALIEN_GUID_RAN_AWAYcxx . . $ `scripts/AIGame3.cpp:671:9`! 0x10100004
672 #define ALIEN_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:672:9`! 0x10100005
673
674 // Alien Communication IDs
675 #define ALIEN_COM_JOIN_MEcxx . . $ `scripts/AIGame3.cpp:675:9`! 0
676 #define ALIEN_COM_LEAVE_MEcxx . . $ `scripts/AIGame3.cpp:676:9`! 1
677 #define ALIEN_COM_PROTECT_MEcxx . . $ `scripts/AIGame3.cpp:677:9`! 2
678 #define ALIEN_COM_BREAK_AND_ATTACKcxx . . $ `scripts/AIGame3.cpp:678:9`! 3
679 #define ALIEN_COM_REGROUPcxx . . $ `scripts/AIGame3.cpp:679:9`! 4
680 #define ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`! 5
681 #define ALIEN_COM_SET_PENDING_MODEcxx . . $ `scripts/AIGame3.cpp:681:9`! 6
682 #define ALIEN_COM_GET_MODEcxx . . $ `scripts/AIGame3.cpp:682:9`! 7
683 #define ALIEN_COM_SET_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:683:9`! 8
684 #define ALIEN_COM_CLEAR_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:684:9`! 9
685
686 #define ALIEN_COM_REQUEST_LEAVEcxx . . $ `scripts/AIGame3.cpp:686:9`! 10
687 #define ALIEN_COM_LEAVING_YOUcxx . . $ `scripts/AIGame3.cpp:687:9`! 11
688 #define ALIEN_COM_GET_GOAL_POScxx . . $ `scripts/AIGame3.cpp:688:9`! 12
689 #define ALIEN_COM_GET_GOAL_ROOMcxx . . $ `scripts/AIGame3.cpp:689:9`! 13
690 #define ALIEN_COM_I_WAS_HITcxx . . $ `scripts/AIGame3.cpp:690:9`! 14
691 #define ALIEN_COM_CAN_YOU_SEE_MEcxx . . $ `scripts/AIGame3.cpp:691:9`! 15
692 #define ALIEN_COM_LEAVE_ME_FOR_MODEcxx . . $ `scripts/AIGame3.cpp:692:9`! 16
693
694 // Squad Constants
695 #define ALIEN_MAX_TEAMMATEScxx . . $ `scripts/AIGame3.cpp:695:9`! 2
696 #define ALIEN_CATCHUP_DISTcxx . . $ `scripts/AIGame3.cpp:696:9`! 4.0f
697 #define ALIEN_APPROACH_DISTcxx . . $ `scripts/AIGame3.cpp:697:9`! 10.0f
698 #define ALIEN_ENGAGE_DISTcxx . . $ `scripts/AIGame3.cpp:698:9`! 200.0f
699 #define ALIEN_BREAKUP_DISTcxx . . $ `scripts/AIGame3.cpp:699:9`! 50.0f
700 #define ALIEN_REGROUP_DISTcxx . . $ `scripts/AIGame3.cpp:700:9`! 120.0f
701
702 // Alien Squad Flags
703 #define ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`! 0x01
704 #define ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`! 0x02
705 #define ALIEN_CATCHUPcxx . . $ `scripts/AIGame3.cpp:705:9`! 0x04
706 #define ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`! 0x08
707
708 // Energy Beam Flags
709 #define ALIEN_BEAM1cxx . . $ `scripts/AIGame3.cpp:709:9`! 0x01
710 #define ALIEN_BEAM2cxx . . $ `scripts/AIGame3.cpp:710:9`! 0x02
711 #define ALIEN_BEAM3cxx . . $ `scripts/AIGame3.cpp:711:9`! 0x04
712
713 // Auto avoid friends distances
714 #define ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`! 4.0f
715 #define ALIEN_SQUAD_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:715:9`! 0.0f
716
717 // Circle Distance (also for avoiding friends)
718 #define ALIEN_SQUAD_CIRC_DIST_MODcxx . . $ `scripts/AIGame3.cpp:718:9`! 0.4f
719
720 // Formation Offset Constants
721 #define ALIEN_FO_HUNT_RVECcxx . . $ `scripts/AIGame3.cpp:721:9`! 8.0f
722 #define ALIEN_FO_HUNT_FVECcxx . . $ `scripts/AIGame3.cpp:722:9`! 10.0f
723 #define ALIEN_FO_SCAV_RVECcxx . . $ `scripts/AIGame3.cpp:723:9`! 3.0f
724 #define ALIEN_FO_SCAV_FVECcxx . . $ `scripts/AIGame3.cpp:724:9`! 15.0f
725 #define ALIEN_FO_ATTK_RVECcxx . . $ `scripts/AIGame3.cpp:725:9`! 7.0f
726 #define ALIEN_FO_ATTK_UVECPcxx . . $ `scripts/AIGame3.cpp:726:9`! 7.0f
727 #define ALIEN_FO_ATTK_UVECNcxx . . $ `scripts/AIGame3.cpp:727:9`! 5.0f
728 #define ALIEN_FO_ATTK_FVECcxx . . $ `scripts/AIGame3.cpp:728:9`! 3.0f
729
730 // Speed Modifier Constants
731 #define ALIEN_ENGAGE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:731:9`! 1.4f
732 #define ALIEN_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:732:9`! 1.8f
733 #define ALIEN_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:733:9`! 1.0f
734 #define ALIEN_LAND_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:734:9`! 0.5f
735 #define ALIEN_HUNT_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:735:9`! 1.0f
736 #define ALIEN_SCAV_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:736:9`! 0.7f
737 #define ALIEN_FLEE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:737:9`! 2.0f
738
739 #define ALIEN_CATCHUP_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:739:9`! 0.23f
740 #define ALIEN_SQUADIE_INTERVALcxx . . $ `scripts/AIGame3.cpp:740:9`! 0.25f
741
742 // Teammate data struct
743 struct teammate_datacxx . . $ teammate_data# {
744 int handlecxx . . $ teammate_data#handle.; // the object handle for this teammate
745 bool is_visiblecxx . . $ teammate_data#is_visible.; // whether this teammate can see me or not
746 };
747
748 // Alien memory data structure
749 struct alienorganism_datacxx . . $ alienorganism_data# {
750 // Mode Data
751 int modecxx . . $ alienorganism_data#mode.; // indicates what mode alien is currently in
752 int pending_modecxx . . $ alienorganism_data#pending_mode.; // mode to switch to when current task(s) are completed
753 int previous_modecxx . . $ alienorganism_data#previous_mode.; // mode alien was in before starting current task(s)
754
755 float mode_timecxx . . $ alienorganism_data#mode_time.; // time spent in current mode
756 float next_activity_timecxx . . $ alienorganism_data#next_activity_time.; // next time resting alien should think about doing something
757 float max_wander_timecxx . . $ alienorganism_data#max_wander_time.; // maximum time to be spent out hunting/scavenging before returning
758 float next_update_squad_timecxx . . $ alienorganism_data#next_update_squad_time.; // the next time to do a squad update
759 float next_update_energy_timecxx . . $ alienorganism_data#next_update_energy_time.; // the next time to update the energy effect
760 float next_update_beam_timecxx . . $ alienorganism_data#next_update_beam_time.; // the next time to update the energy beams
761 float next_generic_check_timecxx . . $ alienorganism_data#next_generic_check_time.; // the next time to do generic checks
762 float next_squadie_update_timecxx . . $ alienorganism_data#next_squadie_update_time.; // the next time to update the squadie's catchup speed
763 float next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time.; // the next time alien can take special damage
764 float next_vis_check_timecxx . . $ alienorganism_data#next_vis_check_time.; // the next time to do a squad visibility check
765
766 // General Information
767 float base_speedcxx . . $ alienorganism_data#base_speed.; // the robot's base speed
768 float base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.; // the robot's base circle distance
769 float base_shieldscxx . . $ alienorganism_data#base_shields.; // the robot's base shields
770
771 float energy_chargescxx . . $ alienorganism_data#energy_charges.; // the number of energy charges currently stored
772 float ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit.; // indicates whether alien is allowed to deposit charge
773
774 float takeoff_timecxx . . $ alienorganism_data#takeoff_time.; // time since takeoff (used for clearing axes lock, etc.)
775
776 int dest_object_handlecxx . . $ alienorganism_data#dest_object_handle.; // destination handle for object to go to instead of wander
777
778 // Indicators
779 bool done_turningcxx . . $ alienorganism_data#done_turning.;
780 bool done_movingcxx . . $ alienorganism_data#done_moving.;
781 bool hit_by_playercxx . . $ alienorganism_data#hit_by_player.;
782 bool energy_beams_oncxx . . $ alienorganism_data#energy_beams_on.;
783
784 // Home Data
785 vectorcxx . . $ vector# home_poscxx . . $ alienorganism_data#home_pos.;
786 int home_roomcxx . . $ alienorganism_data#home_room.;
787 vectorcxx . . $ vector# home_fveccxx . . $ alienorganism_data#home_fvec.;
788 vectorcxx . . $ vector# home_uveccxx . . $ alienorganism_data#home_uvec.;
789
790 // Energy effect props
791 int pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
792 int pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
793 int pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
794 int enabled_beamscxx . . $ alienorganism_data#enabled_beams.;
795
796 // Squad Data
797 int squad_flagscxx . . $ alienorganism_data#squad_flags.;
798 int leader_handlecxx . . $ alienorganism_data#leader_handle.;
799 int num_teammatescxx . . $ alienorganism_data#num_teammates.;
800 teammate_datacxx . . $ teammate_data# teammatecxx . . $ alienorganism_data#teammate.[ALIEN_MAX_TEAMMATEScxx . . $ `scripts/AIGame3.cpp:695:9`!];
801 vectorcxx . . $ vector# squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.;
802 int squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.;
803
804 };
805
806 // Alien Organism class definition
807 class AlienOrganismcxx . . $ AlienOrganism# : public BaseObjScriptcxx . . $ BaseObjScript# {
808 private:
809 alienorganism_datacxx . . $ alienorganism_data# *memorycxx . . $ AlienOrganism#memory.;
810
811 void SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(int me, char mode);
812 void DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(int me, float takeoff_speed, float speed_variance);
813
814 void DoInitcxx . . $ AlienOrganism#DoInit(d4f767463ce0a6b3).(int me_handle);
815 void DoFramecxx . . $ AlienOrganism#DoFrame(d4f767463ce0a6b3).(int me_handle);
816 bool DoNotifycxx . . $ AlienOrganism#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
817 void DoDamagecxx . . $ AlienOrganism#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data);
818 void DoCollidecxx . . $ AlienOrganism#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data);
819
820 bool SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
821 bool ReceiveCommandcxx . . $ AlienOrganism#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
822
823 bool IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(int leader_handle, char command, void *ptr);
824
825 bool IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(int mode);
826 bool IsEnergyRelatedLandedModecxx . . $ AlienOrganism#IsEnergyRelatedLandedMode(83c267b20bac841a).(int mode);
827 bool ModeIsAttackSensitivecxx . . $ AlienOrganism#ModeIsAttackSensitive(cf9ef193275fa6d8).(int mode, int pending_mode);
828 bool ModeSupportsSquadEnlistmentcxx . . $ AlienOrganism#ModeSupportsSquadEnlistment(1432650661211742).(int mode, int pending_mode, int recruiter_mode);
829 bool ModeSupportsSquadRecruitmentcxx . . $ AlienOrganism#ModeSupportsSquadRecruitment(83c267b20bac841a).(int mode);
830 bool ModeSupportsSquadMovementcxx . . $ AlienOrganism#ModeSupportsSquadMovement(83c267b20bac841a).(int mode);
831 void DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(int me);
832 void DisperseSquadToModecxx . . $ AlienOrganism#DisperseSquadToMode(3e454b8ccf442868).(int me, int mode);
833 bool LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(int me);
834
835 bool Fleecxx . . $ AlienOrganism#Flee(9609253e83e89946).(int me, bool force_flee = false);
836 bool Healcxx . . $ AlienOrganism#Heal(83c267b20bac841a).(int me);
837 bool MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(int me, bool force_attack = false);
838 bool RangedAttackcxx . . $ AlienOrganism#RangedAttack(83c267b20bac841a).(int me);
839 bool Depositcxx . . $ AlienOrganism#Deposit(83c267b20bac841a).(int me);
840 bool Withdrawcxx . . $ AlienOrganism#Withdraw(83c267b20bac841a).(int me);
841
842 bool WillJoinLeadercxx . . $ AlienOrganism#WillJoinLeader(1432650661211742).(int me, int leader_handle, int priority);
843
844 int FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(int tm_handle);
845 int CalcFormationPositioncxx . . $ AlienOrganism#CalcFormationPosition(dce807ad13d96105).(int me, int tm_ID, vectorcxx . . $ vector# *pos);
846 void SetSquadieFormationGoalcxx . . $ AlienOrganism#SetSquadieFormationGoal(d4f767463ce0a6b3).(int me);
847 void UpdateSquadieFormationGoalcxx . . $ AlienOrganism#UpdateSquadieFormationGoal(d4f767463ce0a6b3).(int me);
848 void SetWanderGoalcxx . . $ AlienOrganism#SetWanderGoal(d4f767463ce0a6b3).(int me);
849 void RemoveTeammatecxx . . $ AlienOrganism#RemoveTeammate(d4f767463ce0a6b3).(int tm_id);
850
851 bool IsNearFirecxx . . $ AlienOrganism#IsNearFire(83c267b20bac841a).(int me);
852 bool IsOnFirecxx . . $ AlienOrganism#IsOnFire(83c267b20bac841a).(int me);
853
854 bool FindHomecxx . . $ AlienOrganism#FindHome(83c267b20bac841a).(int me);
855 void ProjectBeamcxx . . $ AlienOrganism#ProjectBeam(a16672ec5cbc060d).(int me, int pos_handle, vectorcxx . . $ vector# *start_pos, int start_room, vectorcxx . . $ vector# *beam_dir, matrixcxx . . $ matrix# *orient,
856 int beam_flag);
857 void CalcEnergyBeamPositionscxx . . $ AlienOrganism#CalcEnergyBeamPositions(d4f767463ce0a6b3).(int me);
858 void UpdateEnergyBeamscxx . . $ AlienOrganism#UpdateEnergyBeams(d4f767463ce0a6b3).(int me);
859 void UpdateEnergyEffectcxx . . $ AlienOrganism#UpdateEnergyEffect(d4f767463ce0a6b3).(int me);
860 void SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed);
861 void SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(int me, float dist);
862
863 void UpdateSquadListcxx . . $ AlienOrganism#UpdateSquadList(d4f767463ce0a6b3).(int me);
864 void UpdateSquadcxx . . $ AlienOrganism#UpdateSquad(d4f767463ce0a6b3).(int me);
865 void UpdateSquadVisibilitycxx . . $ AlienOrganism#UpdateSquadVisibility(d4f767463ce0a6b3).(int me);
866 void DoSquadieFramecxx . . $ AlienOrganism#DoSquadieFrame(d4f767463ce0a6b3).(int me);
867
868 public:
869 AlienOrganismcxx . . $ AlienOrganism#AlienOrganism(49f6e7a06ebc5aa8).() {}
870 int16_t CallEventcxx . . $ AlienOrganism#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
871 };
872
873 //---------------------
874 // Heavy Trooper class
875 //---------------------
876
877 // Heavy Trooper Mode Types
878 #define HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`! 0
879 #define HT_PREPARING_GRENADEcxx . . $ `scripts/AIGame3.cpp:879:9`! 1
880 #define HT_FIRING_GRENADEcxx . . $ `scripts/AIGame3.cpp:880:9`! 2
881 #define HT_RECOVERINGcxx . . $ `scripts/AIGame3.cpp:881:9`! 3
882
883 #define HT_PREPARING_FOR_CURLcxx . . $ `scripts/AIGame3.cpp:883:9`! 10
884 #define HT_CURLING_UPcxx . . $ `scripts/AIGame3.cpp:884:9`! 11
885 #define HT_UNCURLINGcxx . . $ `scripts/AIGame3.cpp:885:9`! 12
886 #define HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`! 13
887 #define HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`! 14
888
889 // General Heavy Trooper Constants
890 #define HT_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:890:9`! 4
891
892 #define HT_PARTICLE_SPEW_TIMEcxx . . $ `scripts/AIGame3.cpp:892:9`! 0.4f
893 #define HT_MAX_PARTICLE_TIMEcxx . . $ `scripts/AIGame3.cpp:893:9`! 0.5f
894
895 #define HT_CURLUP_DISTcxx . . $ `scripts/AIGame3.cpp:895:9`! 10.0f
896 #define HT_CURLUP_DIST_VARIANCEcxx . . $ `scripts/AIGame3.cpp:896:9`! 20.0f
897 #define HT_CURLUP_DAMAGEcxx . . $ `scripts/AIGame3.cpp:897:9`! 0.2f
898
899 #define HT_GRENADE_DISTcxx . . $ `scripts/AIGame3.cpp:899:9`! 40.0f
900 #define HT_GRENADE_DIST_MAXcxx . . $ `scripts/AIGame3.cpp:900:9`! 130.0f
901
902 #define HT_RECHARGE_TIMEcxx . . $ `scripts/AIGame3.cpp:902:9`! 1.0f
903 #define HT_DECHARGE_TIMEcxx . . $ `scripts/AIGame3.cpp:903:9`! 0.8f
904 #define HT_MAX_CHARGEcxx . . $ `scripts/AIGame3.cpp:904:9`! 8.0f
905 #define HT_MAX_CHARGE_VARIANCEcxx . . $ `scripts/AIGame3.cpp:905:9`! 6.0f
906 #define HT_CHARGE_INCcxx . . $ `scripts/AIGame3.cpp:906:9`! 1.0f
907
908 #define HT_CIRCLE_BACK_TIMEcxx . . $ `scripts/AIGame3.cpp:908:9`! 1.0f
909
910 #define HT_SHIELD_BLAST_DELAYcxx . . $ `scripts/AIGame3.cpp:910:9`! 1.5f
911 #define HT_ARMOR_DAMAGED_MODcxx . . $ `scripts/AIGame3.cpp:911:9`! 0.02f
912 #define HT_CURLING_DAMAGED_MODcxx . . $ `scripts/AIGame3.cpp:912:9`! 0.2f
913
914 #define HT_GRENADE_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:914:9`! 1.0f
915 #define HT_GRENADE_CHECK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:915:9`! 1.5f
916 #define HT_GRENADE_RELOAD_TIMEcxx . . $ `scripts/AIGame3.cpp:916:9`! 3.0f
917
918 #define HT_GRENADE_GUNPOINTcxx . . $ `scripts/AIGame3.cpp:918:9`! 2
919
920 // Heavy Trooper Custom Anim Frames
921 #define HT_CURLUP_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:921:9`! 202.0f
922 #define HT_CURLUP_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:922:9`! 216.0f
923 #define HT_CURLUP_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:923:9`! 2.0f
924
925 #define HT_UNCURL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:925:9`! 146.0f
926 #define HT_UNCURL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:926:9`! 173.0f
927 #define HT_UNCURL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:927:9`! 3.5f
928
929 #define HT_ROLL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:929:9`! 185.0f
930 #define HT_ROLL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:930:9`! 195.0f
931 #define HT_ROLL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:931:9`! 0.7f
932
933 #define HT_GUNFIRE_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:933:9`! 95.0f
934 #define HT_GUNFIRE_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:934:9`! 105.0f
935
936 #define HT_GRENADE_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:936:9`! 105.0f
937 #define HT_GRENADE_FIRE_FRAMEcxx . . $ `scripts/AIGame3.cpp:937:9`! 119.0f
938 #define HT_GRENADE_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:938:9`! 126.0f
939
940 #define HT_GRENADE_FIRE_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:940:9`! 1.2f
941 #define HT_GRENADE_RECOIL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:941:9`! 1.3f
942 #define HT_GRENADE_MISFIRE_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:942:9`! 1.0f
943
944 // Heavy Trooper Speed modifiers
945 #define HT_GRENADE_FIRING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:945:9`! 0.2f
946 #define HT_GRENADE_AIMING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:946:9`! 0.6f
947 #define HT_CURLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:947:9`! 0.8f
948 #define HT_RAMMING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:948:9`! 2.5f
949 #define HT_CIRCLE_BACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:949:9`! 2.5f
950
951 #define HT_RAMMING_DELTA_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:951:9`! 3.0f
952
953 #define HT_RAMMING_TURN_RATE_MODcxx . . $ `scripts/AIGame3.cpp:953:9`! 1.1f
954 #define HT_RAMMING_DELTA_TURN_RATE_MODcxx . . $ `scripts/AIGame3.cpp:954:9`! 3.0f
955
956 // Heavy Trooper ID's
957 #define HT_SHIELD_BLAST_NAMEcxx . . $ `scripts/AIGame3.cpp:957:9`! "HTShieldBlast"
958 #define HT_GRENADE_NAMEcxx . . $ `scripts/AIGame3.cpp:958:9`! "Impact Mortar"
959 #define HT_GRENADE_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:959:9`! "AlienEnergyEffect"
960
961 // Heavy Trooper memory data structure
962 struct heavytrooper_datacxx . . $ heavytrooper_data# {
963 // Mode Data
964 int modecxx . . $ heavytrooper_data#mode.; // indicates what mode trooper is currently in
965 float mode_timecxx . . $ heavytrooper_data#mode_time.; // time spent in current mode
966
967 float base_shieldscxx . . $ heavytrooper_data#base_shields.; // original shields
968 float base_speedcxx . . $ heavytrooper_data#base_speed.; // original max speed
969 float base_delta_speedcxx . . $ heavytrooper_data#base_delta_speed.; // original max delta speed
970 float base_turn_ratecxx . . $ heavytrooper_data#base_turn_rate.; // original turn rate
971 float base_delta_turn_ratecxx . . $ heavytrooper_data#base_delta_turn_rate.; // original delta turn rate
972
973 float chargecxx . . $ heavytrooper_data#charge.; // stores energy used by curl-up mode
974
975 float curlup_distcxx . . $ heavytrooper_data#curlup_dist.; // stores this robot's max curlup dist
976 float max_chargecxx . . $ heavytrooper_data#max_charge.; // stores this robot's max charge
977
978 float last_grenade_timecxx . . $ heavytrooper_data#last_grenade_time.; // last time a grenade was fired
979 float next_grenade_check_timecxx . . $ heavytrooper_data#next_grenade_check_time.; // next time to check if we have a clear grenade shot
980 float next_charge_timecxx . . $ heavytrooper_data#next_charge_time.; // next time to re-charge or deplete charge
981 float next_blast_timecxx . . $ heavytrooper_data#next_blast_time.; // next time a shield collision blast can be created
982 float next_particle_timecxx . . $ heavytrooper_data#next_particle_time.; // next time to create a casing particle spew
983
984 };
985
986 // Heavy Trooper class definition
987 class HeavyTroopercxx . . $ HeavyTrooper# : public BaseObjScriptcxx . . $ BaseObjScript# {
988 private:
989 heavytrooper_datacxx . . $ heavytrooper_data# *memorycxx . . $ HeavyTrooper#memory.;
990
991 void SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(int me, char mode);
992
993 void DoInitcxx . . $ HeavyTrooper#DoInit(d4f767463ce0a6b3).(int me_handle);
994 void DoFramecxx . . $ HeavyTrooper#DoFrame(d4f767463ce0a6b3).(int me_handle);
995 bool DoNotifycxx . . $ HeavyTrooper#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
996 void DoDamagecxx . . $ HeavyTrooper#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data);
997 void DoCollidecxx . . $ HeavyTrooper#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data);
998
999 void LaunchGrenadecxx . . $ HeavyTrooper#LaunchGrenade(d4f767463ce0a6b3).(int me);
1000 bool HasAClearGrenadeShotcxx . . $ HeavyTrooper#HasAClearGrenadeShot(9609253e83e89946).(int me, bool use_grenade_gunpoint = false);
1001
1002 void SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(int me, float speed, bool accel_faster = false);
1003 void EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(int me, bool enable = true);
1004
1005 public:
1006 HeavyTroopercxx . . $ HeavyTrooper#HeavyTrooper(49f6e7a06ebc5aa8).() {}
1007 int16_t CallEventcxx . . $ HeavyTrooper#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1008 };
1009
1010 //---------------------
1011 // Lifter class
1012 //---------------------
1013
1014 // Lifter Mode Types
1015 #define LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`! 0
1016 #define LIFTER_AGITATEDcxx . . $ `scripts/AIGame3.cpp:1016:9`! 1
1017 #define LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`! 2
1018 #define LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`! 3
1019 #define LIFTER_PASSIFYINGcxx . . $ `scripts/AIGame3.cpp:1019:9`! 4
1020
1021 // General Lifter Constants
1022 #define LIFTER_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1022:9`! 4
1023
1024 #define LIFTER_MAX_PULL_TIMEcxx . . $ `scripts/AIGame3.cpp:1024:9`! 8.0f
1025 #define LIFTER_PULL_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1025:9`! 0.5f
1026 #define LIFTER_PULL_VALIDATE_INTERVALcxx . . $ `scripts/AIGame3.cpp:1026:9`! 0.25f
1027 #define LIFTER_PULL_TARGET_INTERVALcxx . . $ `scripts/AIGame3.cpp:1027:9`! 0.15f
1028
1029 #define LIFTER_NEXT_PULL_DELAYcxx . . $ `scripts/AIGame3.cpp:1029:9`! 3.0f
1030 #define LIFTER_NEXT_PULL_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1030:9`! 5.0f
1031
1032 #define LIFTER_MAX_PULLING_DISTcxx . . $ `scripts/AIGame3.cpp:1032:9`! 250.0f
1033 #define LIFTER_MIN_PULLING_DISTcxx . . $ `scripts/AIGame3.cpp:1033:9`! 20.0f
1034
1035 #define LIFTER_MIN_HOSTILE_MODE_TIMEcxx . . $ `scripts/AIGame3.cpp:1035:9`! 8.0f
1036 #define LIFTER_MIN_AGITATED_MODE_TIMEcxx . . $ `scripts/AIGame3.cpp:1036:9`! 2.0f
1037
1038 #define LIFTER_AGITATED_INTEREST_TIMEcxx . . $ `scripts/AIGame3.cpp:1038:9`! 8.0f
1039 #define LIFTER_HOSTILE_INTEREST_TIMEcxx . . $ `scripts/AIGame3.cpp:1039:9`! 18.0f
1040
1041 #define LIFTER_AGITATED_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1041:9`! 0.95f
1042 #define LIFTER_HOSTILE_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1042:9`! 0.85f
1043
1044 #define LIFTER_LOSE_PULL_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1044:9`! 0.20f
1045
1046 #define LIFTER_TARGET_PULL_SPEEDcxx . . $ `scripts/AIGame3.cpp:1046:9`! 35.0f
1047
1048 #define LIFTER_LIFT_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:1048:9`! 0.25f
1049
1050 // Lifter speed constants
1051 #define LIFTER_AGITATED_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1051:9`! 1.2f
1052 #define LIFTER_HOSTILE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1052:9`! 2.0f
1053 #define LIFTER_PULLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1053:9`! 0.6f
1054
1055 // Lifter memory data structure
1056 struct lifter_datacxx . . $ lifter_data# {
1057 // Mode Data
1058 int modecxx . . $ lifter_data#mode.; // indicates what mode lifter is currently in
1059 float mode_timecxx . . $ lifter_data#mode_time.; // time spent in current mode
1060
1061 float base_shieldscxx . . $ lifter_data#base_shields.; // original shields
1062 float base_speedcxx . . $ lifter_data#base_speed.; // original max speed
1063
1064 float shield_loss_margincxx . . $ lifter_data#shield_loss_margin.; // amount of shields that must be lost before pull is lost
1065 float shields_at_pull_startcxx . . $ lifter_data#shields_at_pull_start.; // shield total at start of pull
1066
1067 int pull_targetcxx . . $ lifter_data#pull_target.; // the target being pulled
1068 int pull_target_propcxx . . $ lifter_data#pull_target_prop.; // invisible powerup target pos
1069 int pull_source_propcxx . . $ lifter_data#pull_source_prop.; // invisible powerup source pos
1070
1071 bool not_hostile_yetcxx . . $ lifter_data#not_hostile_yet.; // whether or not it's been in hostile mode yet
1072
1073 float last_damaged_timecxx . . $ lifter_data#last_damaged_time.; // last time we were damaged
1074 float next_pull_check_timecxx . . $ lifter_data#next_pull_check_time.; // the next time we can check if a pull can be done
1075 float last_target_pull_timecxx . . $ lifter_data#last_target_pull_time.; // the last time the target was pulled
1076
1077 float next_lift_beam_timecxx . . $ lifter_data#next_lift_beam_time.; // the next time to update the lift beam
1078
1079 };
1080
1081 // Lifter class definition
1082 class Liftercxx . . $ Lifter# : public BaseObjScriptcxx . . $ BaseObjScript# {
1083 private:
1084 lifter_datacxx . . $ lifter_data# *memorycxx . . $ Lifter#memory.;
1085
1086 void SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(int me, char mode);
1087
1088 void DoInitcxx . . $ Lifter#DoInit(d4f767463ce0a6b3).(int me_handle);
1089 void DoFramecxx . . $ Lifter#DoFrame(d4f767463ce0a6b3).(int me_handle);
1090 bool DoNotifycxx . . $ Lifter#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1091 void DoDamagecxx . . $ Lifter#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data);
1092 void DoCollidecxx . . $ Lifter#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data);
1093 void DoCleanUpcxx . . $ Lifter#DoCleanUp(d4f767463ce0a6b3).(int me);
1094
1095 void SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed);
1096 bool OkToPullcxx . . $ Lifter#OkToPull(9609253e83e89946).(int me, bool initial_check = true);
1097 void PullTargetcxx . . $ Lifter#PullTarget(d4f767463ce0a6b3).(int me);
1098 void UpdateTractorBeamcxx . . $ Lifter#UpdateTractorBeam(d4f767463ce0a6b3).(int me);
1099
1100 void ConfineTargetcxx . . $ Lifter#ConfineTarget(d4f767463ce0a6b3).(int me);
1101 void ReleaseTargetcxx . . $ Lifter#ReleaseTarget(d4f767463ce0a6b3).(int me);
1102 void StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(int me);
1103 void MoveTargetPropcxx . . $ Lifter#MoveTargetProp(d4f767463ce0a6b3).(int target_handle);
1104 void SwitchToAlertcxx . . $ Lifter#SwitchToAlert(d4f767463ce0a6b3).(int me);
1105 void UpdateLiftBeamcxx . . $ Lifter#UpdateLiftBeam(d4f767463ce0a6b3).(int me);
1106
1107 public:
1108 Liftercxx . . $ Lifter#Lifter(49f6e7a06ebc5aa8).() {}
1109 int16_t CallEventcxx . . $ Lifter#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1110 };
1111
1112 //---------------------
1113 // AlienBoss class
1114 //---------------------
1115
1116 // Alien Boss Mode Types
1117 #define AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`! 0
1118 #define AB_HUNTINGcxx . . $ `scripts/AIGame3.cpp:1118:9`! 1
1119 #define AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`! 2
1120 #define AB_PREPARE_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1120:9`! 3
1121 #define AB_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1121:9`! 4
1122 #define AB_SPECIAL_ATTACK_RECOILcxx . . $ `scripts/AIGame3.cpp:1122:9`! 5
1123 #define AB_MELEE_ATTACKcxx . . $ `scripts/AIGame3.cpp:1123:9`! 6
1124
1125 #define AB_GOING_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1125:9`! 10
1126 #define AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`! 11
1127 #define AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`! 12
1128 #define AB_FLEEINGcxx . . $ `scripts/AIGame3.cpp:1128:9`! 13
1129
1130 #define AB_HIDING_FROM_THRUSTERcxx . . $ `scripts/AIGame3.cpp:1130:9`! 20
1131 #define AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`! 21
1132 #define AB_DYINGcxx . . $ `scripts/AIGame3.cpp:1132:9`! 22
1133 #define AB_WAITINGcxx . . $ `scripts/AIGame3.cpp:1133:9`! 23
1134 #define AB_TELEPORTINGcxx . . $ `scripts/AIGame3.cpp:1134:9`! 24
1135
1136 // Alien Boss State Types
1137 #define AB_NORMALcxx . . $ `scripts/AIGame3.cpp:1137:9`! 0
1138 #define AB_PROTECTIVEcxx . . $ `scripts/AIGame3.cpp:1138:9`! 1
1139 #define AB_ANGRYcxx . . $ `scripts/AIGame3.cpp:1139:9`! 2
1140
1141 // General Alien Boss Constants
1142 #define AB_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1142:9`! 4
1143
1144 #define AB_HEALING_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:1144:9`! 1.0f
1145 #define AB_HEAL_AMOUNT_PERCENTcxx . . $ `scripts/AIGame3.cpp:1145:9`! 0.05f
1146 #define AB_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:1146:9`! 0.25f
1147
1148 #define AB_NORMAL_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1148:9`! 0.25f
1149 #define AB_PROTECTIVE_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1149:9`! 0.4f
1150 #define AB_ANGRY_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1150:9`! 0.6f
1151
1152 #define AB_MAX_FLEE_TIMEcxx . . $ `scripts/AIGame3.cpp:1152:9`! 10.0f
1153 #define AB_STARTING_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:1153:9`! 90
1154 #define AB_FLEE_CHANCE_DECREMENTcxx . . $ `scripts/AIGame3.cpp:1154:9`! 10
1155
1156 #define AB_ATTACK_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1156:9`! 0.5f
1157
1158 #define AB_DAMAGE_EFFECT_INTERVALcxx . . $ `scripts/AIGame3.cpp:1158:9`! 0.5f
1159 #define AB_MAX_DAMAGE_SPARK_RATEcxx . . $ `scripts/AIGame3.cpp:1159:9`! 20.0f
1160
1161 #define AB_MAX_SPECIAL_ATTACK_DISTcxx . . $ `scripts/AIGame3.cpp:1161:9`! 70.0f
1162 #define AB_MAX_STING_DISTcxx . . $ `scripts/AIGame3.cpp:1162:9`! 40.0f
1163
1164 #define AB_STING_DAMAGEcxx . . $ `scripts/AIGame3.cpp:1164:9`! 20.0f
1165
1166 #define AB_SPECIAL_ATTACK_DELAYcxx . . $ `scripts/AIGame3.cpp:1166:9`! 6.0f
1167 #define AB_SPECIAL_ATTACK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1167:9`! 14.0f
1168
1169 #define AB_MELEE_ATTACK_DELAYcxx . . $ `scripts/AIGame3.cpp:1169:9`! 5.0f
1170 #define AB_MELEE_ATTACK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1170:9`! 5.0f
1171 #define AB_MELEE_DISTcxx . . $ `scripts/AIGame3.cpp:1171:9`! 40.0f
1172 #define AB_MAX_MELEE_TIMEcxx . . $ `scripts/AIGame3.cpp:1172:9`! 5.0f
1173
1174 #define AB_CHECK_IF_STUCK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1174:9`! 10.0f
1175 #define AB_CHECK_IF_STUCK_DISTcxx . . $ `scripts/AIGame3.cpp:1175:9`! 10.0f
1176
1177 // Alien Boss goal complete IDs
1178 #define AB_GUID_GOT_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1178:9`! 0x10100001
1179 #define AB_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:1179:9`! 0x10100002
1180 #define AB_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:1180:9`! 0x10100003
1181 #define AB_GUID_GOT_TO_WANDER_ROOMcxx . . $ `scripts/AIGame3.cpp:1181:9`! 0x10100004
1182 #define AB_GUID_GOT_TO_NEST_ROOMcxx . . $ `scripts/AIGame3.cpp:1182:9`! 0x10100005
1183 #define AB_GUID_GOT_TO_HIDE_ROOMcxx . . $ `scripts/AIGame3.cpp:1183:9`! 0x10100006
1184
1185 // Alien Boss Custom Anim Frames
1186 #define AB_HEALING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1186:9`! 1.0f
1187 #define AB_HEALING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1187:9`! 10.0f
1188 #define AB_HEALING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1188:9`! 2.0f
1189
1190 #define AB_LANDING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1190:9`! 50.0f
1191 #define AB_LANDING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1191:9`! 53.0f
1192 #define AB_LANDING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1192:9`! 1.0f
1193
1194 #define AB_TAKEOFF_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1194:9`! 10.0f
1195 #define AB_TAKEOFF_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1195:9`! 25.0f
1196 #define AB_TAKEOFF_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1196:9`! 1.0f
1197
1198 #define AB_ATTACK_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1198:9`! 36.0f
1199 #define AB_ATTACK_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1199:9`! 45.0f
1200 #define AB_ATTACK_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1200:9`! 0.5f
1201
1202 #define AB_RECOIL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1202:9`! 45.0f
1203 #define AB_RECOIL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1203:9`! 50.0f
1204 #define AB_RECOIL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1204:9`! 0.5f
1205
1206 // Speed Modifier Constants
1207 #define AB_WANDER_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1207:9`! 1.0f
1208 #define AB_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1208:9`! 0.9f
1209 #define AB_MELEE_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1209:9`! 1.1f
1210 #define AB_SPEC_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1210:9`! 0.3f
1211 #define AB_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1211:9`! 1.2f
1212 #define AB_LAND_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1212:9`! 0.4f
1213 #define AB_FLEE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1213:9`! 1.0f
1214 #define AB_GUARD_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1214:9`! 0.9f
1215 #define AB_HIDE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1215:9`! 1.0f
1216 #define AB_DIE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1216:9`! 1.0f
1217
1218 // Alien Boss Lookup Globals
1219 #define AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`! 11
1220
1221 static const char *const AB_WanderRoomNamescxx . . $ AB_WanderRoomNames.[AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`!] = {
1222 "BossRoomA", "BossTunnelAB", "BossRoomB", "BossTunnelBC", "BossRoomC", "BossTunnelCE",
1223 "BossRoomD", "BossTunnelAE", "BossRoomE", "BossTunnelCE", "BossRoomD"};
1224
1225 // Alien Boss memory data structure
1226 struct alienboss_datacxx . . $ alienboss_data# {
1227 // Mode Data
1228 int modecxx . . $ alienboss_data#mode.; // indicates what mode alien boss is currently in
1229 int statecxx . . $ alienboss_data#state.; // indicates the boss's current state
1230
1231 float mode_timecxx . . $ alienboss_data#mode_time.; // time spent in current mode
1232 float next_activity_timecxx . . $ alienboss_data#next_activity_time.; // next time to do something
1233 float max_wander_timecxx . . $ alienboss_data#max_wander_time.; // maximum time to be spent wandering
1234 float next_update_beam_timecxx . . $ alienboss_data#next_update_beam_time.; // the next time to update the energy beams
1235 float next_generic_check_timecxx . . $ alienboss_data#next_generic_check_time.; // the next time to do generic checks
1236 float next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time.; // the next time alien boss can take special damage
1237 float next_special_attack_timecxx . . $ alienboss_data#next_special_attack_time.; // the next time boss can do a special attack
1238 float next_melee_attack_timecxx . . $ alienboss_data#next_melee_attack_time.; // the next time boss can do a melee attack
1239 float next_damage_effect_timecxx . . $ alienboss_data#next_damage_effect_time.; // the next time to do the damage effect
1240 float intro_end_timecxx . . $ alienboss_data#intro_end_time.; // the time intro ends
1241
1242 // General Information
1243 float base_speedcxx . . $ alienboss_data#base_speed.; // the robot's base speed
1244 float base_shieldscxx . . $ alienboss_data#base_shields.; // the robot's base shields
1245 int dest_object_handlecxx . . $ alienboss_data#dest_object_handle.; // destination handle for object to go to instead of wander
1246 float damagecxx . . $ alienboss_data#damage.; // the amount of damage currently sustained
1247 float damage_thresholdcxx . . $ alienboss_data#damage_threshold.; // the damage that can be sustained before returning to heal
1248 int fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance.; // the chance to flee when caught on fire
1249
1250 int wander_roomscxx . . $ alienboss_data#wander_rooms.[AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`!]; // the rooms alien wanders through
1251 int curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index.; // the room currently wandering to
1252 bool wander_forwardcxx . . $ alienboss_data#wander_forward.; // whether to follow list normally or in reverse
1253 bool waiting_effect_enabledcxx . . $ alienboss_data#waiting_effect_enabled.; // whether waiting effect should be done yet
1254 bool intro_endedcxx . . $ alienboss_data#intro_ended.; // whether intro is over yet
1255
1256 // Indicators
1257 bool done_turningcxx . . $ alienboss_data#done_turning.;
1258 bool done_movingcxx . . $ alienboss_data#done_moving.;
1259 bool hit_by_playercxx . . $ alienboss_data#hit_by_player.;
1260 bool protected_nestcxx . . $ alienboss_data#protected_nest.;
1261
1262 // Home Data
1263 vectorcxx . . $ vector# home_poscxx . . $ alienboss_data#home_pos.;
1264 int home_roomcxx . . $ alienboss_data#home_room.;
1265 vectorcxx . . $ vector# home_fveccxx . . $ alienboss_data#home_fvec.;
1266 vectorcxx . . $ vector# home_uveccxx . . $ alienboss_data#home_uvec.;
1267
1268 // Energy effect props
1269 int pos1_handlecxx . . $ alienboss_data#pos1_handle.;
1270 int pos2_handlecxx . . $ alienboss_data#pos2_handle.;
1271 int pos3_handlecxx . . $ alienboss_data#pos3_handle.;
1272
1273 int tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle.;
1274
1275 // Scenario objects
1276 int nest_handlecxx . . $ alienboss_data#nest_handle.;
1277
1278 // Hiding from thruster rooms
1279 int left_hide_roomcxx . . $ alienboss_data#left_hide_room.;
1280 int right_hide_roomcxx . . $ alienboss_data#right_hide_room.;
1281
1282 // Teleport values
1283 vectorcxx . . $ vector# dest_poscxx . . $ alienboss_data#dest_pos.;
1284 int dest_roomcxx . . $ alienboss_data#dest_room.;
1285 int mode_prior_teleportingcxx . . $ alienboss_data#mode_prior_teleporting.;
1286 bool did_transfercxx . . $ alienboss_data#did_transfer.;
1287
1288 // Getting Stuck Prevention
1289 float squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved.;
1290 float next_check_if_stuck_timecxx . . $ alienboss_data#next_check_if_stuck_time.;
1291 vectorcxx . . $ vector# last_poscxx . . $ alienboss_data#last_pos.;
1292
1293 };
1294
1295 // Alien Boss class definition
1296 class AlienBosscxx . . $ AlienBoss# : public BaseObjScriptcxx . . $ BaseObjScript# {
1297 private:
1298 alienboss_datacxx . . $ alienboss_data# *memorycxx . . $ AlienBoss#memory.;
1299
1300 void SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(int me, char mode);
1301 void DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(int me, float takeoff_speed, float speed_variance);
1302
1303 void DoInitcxx . . $ AlienBoss#DoInit(d4f767463ce0a6b3).(int me_handle);
1304 void DoFramecxx . . $ AlienBoss#DoFrame(d4f767463ce0a6b3).(int me_handle);
1305 bool DoNotifycxx . . $ AlienBoss#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1306 void DoDamagecxx . . $ AlienBoss#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data);
1307 void DoCollidecxx . . $ AlienBoss#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data);
1308 void DoCleanUpcxx . . $ AlienBoss#DoCleanUp(d4f767463ce0a6b3).(int me);
1309
1310 bool SendCommandcxx . . $ AlienBoss#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1311 bool ReceiveCommandcxx . . $ AlienBoss#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1312
1313 bool IsOnFirecxx . . $ AlienBoss#IsOnFire(83c267b20bac841a).(int me);
1314 void SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed);
1315 void SetWanderGoalcxx . . $ AlienBoss#SetWanderGoal(d4f767463ce0a6b3).(int me);
1316 void SetWanderRoomGoalcxx . . $ AlienBoss#SetWanderRoomGoal(d4f767463ce0a6b3).(int me);
1317 int DetermineClosestRoomcxx . . $ AlienBoss#DetermineClosestRoom(7864480464b09eea).(int me);
1318 void SetProtectNestGoalcxx . . $ AlienBoss#SetProtectNestGoal(d4f767463ce0a6b3).(int me);
1319 void SetHideRoomGoalcxx . . $ AlienBoss#SetHideRoomGoal(d4f767463ce0a6b3).(int me);
1320
1321 bool OkToStartSpecialAttackcxx . . $ AlienBoss#OkToStartSpecialAttack(83c267b20bac841a).(int me);
1322 bool DoStingAttackcxx . . $ AlienBoss#DoStingAttack(83c267b20bac841a).(int me);
1323 void AbortCurrentModecxx . . $ AlienBoss#AbortCurrentMode(d4f767463ce0a6b3).(int me);
1324 void UpdateHealingEnergyBeamscxx . . $ AlienBoss#UpdateHealingEnergyBeams(d4f767463ce0a6b3).(int me);
1325 void UpdateDamageEffectcxx . . $ AlienBoss#UpdateDamageEffect(d4f767463ce0a6b3).(int me);
1326 void StartHealingcxx . . $ AlienBoss#StartHealing(d4f767463ce0a6b3).(int me);
1327 void StopHealingcxx . . $ AlienBoss#StopHealing(d4f767463ce0a6b3).(int me);
1328
1329 bool ModeIsStuckSensitivecxx . . $ AlienBoss#ModeIsStuckSensitive(83c267b20bac841a).(int mode);
1330
1331 void DoCustomLookupscxx . . $ AlienBoss#DoCustomLookups(49f6e7a06ebc5aa8).(void);
1332
1333 public:
1334 AlienBosscxx . . $ AlienBoss#AlienBoss(49f6e7a06ebc5aa8).() {}
1335 int16_t CallEventcxx . . $ AlienBoss#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1336 };
1337
1338 //---------------------
1339 // Security Camera class
1340 //---------------------
1341
1342 // Security Camera Mode Types
1343 #define SC_PANNINGcxx . . $ `scripts/AIGame3.cpp:1343:9`! 0
1344 #define SC_TRACKINGcxx . . $ `scripts/AIGame3.cpp:1344:9`! 1
1345
1346 // Security Camera Panning types
1347 #define SC_LOOPINGcxx . . $ `scripts/AIGame3.cpp:1347:9`! 0
1348 #define SC_WARMING_UPcxx . . $ `scripts/AIGame3.cpp:1348:9`! 1
1349
1350 // General Security Camera Constants
1351 #define SC_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1351:9`! 4
1352
1353 #define SC_TRACK_TIME_TO_ALERTcxx . . $ `scripts/AIGame3.cpp:1353:9`! 3.0f
1354 #define SC_TIME_TO_LOSE_TARGETcxx . . $ `scripts/AIGame3.cpp:1354:9`! 1.0f
1355 #define SC_TIME_TO_GAIN_TARGETcxx . . $ `scripts/AIGame3.cpp:1355:9`! 1.0f
1356
1357 #define SC_PAN_SPEEDcxx . . $ `scripts/AIGame3.cpp:1357:9`! 26.0f // frames per second
1358 #define SC_TRACK_SPEEDcxx . . $ `scripts/AIGame3.cpp:1358:9`! 52.0f // frames per second
1359
1360 #define SC_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1360:9`! 0.0f
1361 #define SC_MID_FRAMEcxx . . $ `scripts/AIGame3.cpp:1361:9`! 90.0f
1362 #define SC_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1362:9`! 180.0f
1363 #define SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! 360.0f // end frame to max frame are reverse of start to end
1364 #define SC_MAX_FRAME_OFFSETcxx . . $ `scripts/AIGame3.cpp:1364:9`! 90.0f
1365
1366 #define SC_FRAME_DELTA_ERRORcxx . . $ `scripts/AIGame3.cpp:1366:9`! 1.5f
1367
1368 #define SC_TRACK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1368:9`! 0.25f
1369
1370 // Security camera memory data structure
1371 struct securitycamera_datacxx . . $ securitycamera_data# {
1372 // Mode Data
1373 int modecxx . . $ securitycamera_data#mode.; // indicates what mode security camera is currently in
1374 float mode_timecxx . . $ securitycamera_data#mode_time.; // time spent in current mode
1375
1376 bool alertedcxx . . $ securitycamera_data#alerted.; // whether camera is on alert
1377
1378 int panning_statecxx . . $ securitycamera_data#panning_state.; // whether it is looping or warming up
1379
1380 float next_activity_timecxx . . $ securitycamera_data#next_activity_time.; // the next time to do tracking
1381 float last_update_anim_timecxx . . $ securitycamera_data#last_update_anim_time.; // the last time tracking was done
1382 float curr_track_anim_framecxx . . $ securitycamera_data#curr_track_anim_frame.; // the current tracking animation frame
1383
1384 };
1385
1386 // Security Camera class definition
1387 class SecurityCameracxx . . $ SecurityCamera# : public BaseObjScriptcxx . . $ BaseObjScript# {
1388 private:
1389 securitycamera_datacxx . . $ securitycamera_data# *memorycxx . . $ SecurityCamera#memory.;
1390
1391 void SetModecxx . . $ SecurityCamera#SetMode(5016a63d0a5aceb0).(int me, char mode);
1392
1393 void DoInitcxx . . $ SecurityCamera#DoInit(d4f767463ce0a6b3).(int me_handle);
1394 void DoFramecxx . . $ SecurityCamera#DoFrame(d4f767463ce0a6b3).(int me_handle);
1395 bool DoNotifycxx . . $ SecurityCamera#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1396 void DoDamagecxx . . $ SecurityCamera#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data);
1397 void DoCollidecxx . . $ SecurityCamera#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data);
1398
1399 bool SendCommandcxx . . $ SecurityCamera#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1400 bool ReceiveCommandcxx . . $ SecurityCamera#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1401
1402 public:
1403 SecurityCameracxx . . $ SecurityCamera#SecurityCamera(49f6e7a06ebc5aa8).() {}
1404 int16_t CallEventcxx . . $ SecurityCamera#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1405 };
1406
1407 //---------------------
1408 // CrowdControl Class
1409 //---------------------
1410
1411 // General Crowd Control Constants
1412 #define CC_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1412:9`! 4
1413
1414 #define CC_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1414:9`! 0.2f
1415 #define CC_MIN_STOPPING_SPEEDcxx . . $ `scripts/AIGame3.cpp:1415:9`! 0.0000001f // we want to preserve the direction of velocity
1416
1417 // Crowd Control memory data structure
1418 struct crowdcontrol_datacxx . . $ crowdcontrol_data# {
1419 int follow_handlecxx . . $ crowdcontrol_data#follow_handle.; // handle of object to not crowd
1420 float stop_distcxx . . $ crowdcontrol_data#stop_dist.; // dist at which to stop completely
1421 float slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset.; // dist at which to start slowing down (added to stop dist)
1422
1423 bool disable_checkcxx . . $ crowdcontrol_data#disable_check.; // allows slowdown check to be turned on/off dynamically
1424
1425 float base_speedcxx . . $ crowdcontrol_data#base_speed.; // the base speed of the object
1426 float next_check_timecxx . . $ crowdcontrol_data#next_check_time.; // the next time to do closeness check
1427
1428 };
1429
1430 // Security Camera class definition
1431 class CrowdControlcxx . . $ CrowdControl# : public BaseObjScriptcxx . . $ BaseObjScript# {
1432 private:
1433 crowdcontrol_datacxx . . $ crowdcontrol_data# *memorycxx . . $ CrowdControl#memory.;
1434
1435 void DoInitcxx . . $ CrowdControl#DoInit(d4f767463ce0a6b3).(int me_handle);
1436 void DoFramecxx . . $ CrowdControl#DoFrame(d4f767463ce0a6b3).(int me_handle);
1437 bool DoNotifycxx . . $ CrowdControl#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1438
1439 bool SendCommandcxx . . $ CrowdControl#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1440 bool ReceiveCommandcxx . . $ CrowdControl#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr);
1441
1442 public:
1443 CrowdControlcxx . . $ CrowdControl#CrowdControl(49f6e7a06ebc5aa8).() {}
1444 int16_t CallEventcxx . . $ CrowdControl#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data);
1445 };
1446
1447 //-----------------------
1448 // Name lookup functions
1449 //-----------------------
1450
1451 // Looks up any names and stores the returned ID's
1452 void DoNameLookupscxx . . $ DoNameLookups(49f6e7a06ebc5aa8).(void) {
1453 energy_effect_idcxx . . $ energy_effect_id. = Wpn_FindIDcxx . . $ Wpn_FindID.(ALIEN_ENERGY_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:657:9`!);
1454 frag_burst_effect_idcxx . . $ frag_burst_effect_id. = Wpn_FindIDcxx . . $ Wpn_FindID.("FragBurstEffect");
1455 boss_frag_burst_idcxx . . $ boss_frag_burst_id. = Wpn_FindIDcxx . . $ Wpn_FindID.("AlienBossFragBurst");
1456 transfer_effect_idcxx . . $ transfer_effect_id. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.(ALIEN_TRANSFER_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:658:9`!);
1457 heal_effect_idcxx . . $ heal_effect_id. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.(ALIEN_HEAL_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:659:9`!);
1458 boss_heal_effect_idcxx . . $ boss_heal_effect_id. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.("FunkyEffect4");
1459 tractor_beam_effect_idcxx . . $ tractor_beam_effect_id. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.("FunkyEffectGreen");
1460 alien_organism_idcxx . . $ alien_organism_id. = Obj_FindIDcxx . . $ Obj_FindID.(ALIEN_TYPE_NAMEcxx . . $ `scripts/AIGame3.cpp:642:9`!);
1461 shield_blast_idcxx . . $ shield_blast_id. = Wpn_FindIDcxx . . $ Wpn_FindID.(HT_SHIELD_BLAST_NAMEcxx . . $ `scripts/AIGame3.cpp:957:9`!);
1462 ht_grenade_idcxx . . $ ht_grenade_id. = Wpn_FindIDcxx . . $ Wpn_FindID.(HT_GRENADE_NAMEcxx . . $ `scripts/AIGame3.cpp:958:9`!);
1463 ht_grenade_effect_idcxx . . $ ht_grenade_effect_id. = Wpn_FindIDcxx . . $ Wpn_FindID.(HT_GRENADE_EFFECT_NAMEcxx . . $ `scripts/AIGame3.cpp:959:9`!);
1464 lifter_blast_effect_idcxx . . $ lifter_blast_effect_id. = Wpn_FindIDcxx . . $ Wpn_FindID.("LifterHitBlast");
1465 lifter_stick_effect_idcxx . . $ lifter_stick_effect_id. = Scrpt_FindTextureNamecxx . . $ Scrpt_FindTextureName.("FunkyEffect2");
1466 teleport_effect_idcxx . . $ teleport_effect_id. = Wpn_FindIDcxx . . $ Wpn_FindID.("TeleportEffect");
1467
1468 ht_grenade_sound_idcxx . . $ ht_grenade_sound_id. = Sound_FindIdcxx . . $ Sound_FindId.("Drop weapon");
1469
1470 powerup_idcxx . . $ powerup_id. = Obj_FindIDcxx . . $ Obj_FindID.("Invisiblepowerup");
1471
1472 boss_flapping_idcxx . . $ boss_flapping_id. = Sound_FindIdcxx . . $ Sound_FindId.("Merc4BossBuzz");
1473 boss_turf_idcxx . . $ boss_turf_id. = Sound_FindIdcxx . . $ Sound_FindId.("Merc4BossTurf");
1474 boss_see_idcxx . . $ boss_see_id. = Sound_FindIdcxx . . $ Sound_FindId.("Merc4BossSee");
1475 boss_hurt_idcxx . . $ boss_hurt_id. = Sound_FindIdcxx . . $ Sound_FindId.("Merc4BossHurt");
1476
1477 lifter_pull_sound_idcxx . . $ lifter_pull_sound_id. = Sound_FindIdcxx . . $ Sound_FindId.("RbtLifterBeam");
1478 lifter_amb_sound_idcxx . . $ lifter_amb_sound_id. = Sound_FindIdcxx . . $ Sound_FindId.("RbtLifterAmb1");
1479 }
1480
1481 //----------------
1482 // Standard stuff
1483 //----------------
1484
1485 // InitializeDLL
1486 // Purpose:
1487 // This function gets called when the DLL first gets loaded. It will only be called once (until the
1488 // DLL is unloaded). Passed in is a struct of data passed from the game needed for the DLL to interact
1489 // with D3. Usually this function will just call osicommon_Initialize(), which sets up the imported
1490 // functions. However, you can alloc some memory or whatever in this function, and free it in ShutdownDLL().
1491 // Note: You cannot call any imported functions until osicommon_Initialize() is called.
1492 // Returns 1 if initialization went ok, 0 if there was an error and the DLL should not be loaded.
1493 char STDCALLcxx . . $ `lib/module.h:88:11`! InitializeDLLcxx . . $ InitializeDLL(f9aae224659b2173).(tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *func_list) {
1494 osicommon_Initializecxx . . $ osicommon_Initialize(5a9437a4d944b175).((tOSIRISModuleInitcxx . . $ tOSIRISModuleInit# *)func_list);
1495 String_table_sizecxx . . $ String_table_size. = func_list->string_countcxx . . $ tOSIRISModuleInit#string_count.;
1496 String_tablecxx . . $ String_table. = func_list->string_tablecxx . . $ tOSIRISModuleInit#string_table.;
1497
1498 // Do name lookups
1499 DoNameLookupscxx . . $ DoNameLookups(49f6e7a06ebc5aa8).();
1500
1501 InitMathTablescxx . . $ InitMathTables(49f6e7a06ebc5aa8).();
1502
1503 if (func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum. != CHECKSUMcxx . . $ `<built-in>:477:9`!) {
1504 mprintfcxx . . $ mprintf.(0, "Game-Checksum FAIL!!! (%ul!=%ul)\n", func_list->game_checksumcxx . . $ tOSIRISModuleInit#game_checksum., CHECKSUMcxx . . $ `<built-in>:477:9`!);
1505 mprintfcxx . . $ mprintf.(0, "RECOMPILE YOUR SCRIPTS!!!\n");
1506 return 0;
1507 }
1508 return 1;
1509 }
1510
1511 // ShutdownDLL
1512 // Purpose:
1513 // This function is called right before a DLL is about to be unloaded from memory. You can free
1514 // any unfree'd memory, or anything else you need to do. Don't worry about destroying any instances
1515 // of scripts, as they will all be automatically destroyed before this function is called. The
1516 // same goes for any memory allocated with Scrpt_MemAlloc(), as this will automatically be freed
1517 // when a scripts instance is destroyed.
1518 void STDCALLcxx . . $ `lib/module.h:88:11`! ShutdownDLLcxx . . $ ShutdownDLL(49f6e7a06ebc5aa8).(void) {}
1519
1520 // GetGOScriptID
1521 // Purpose:
1522 // Given the name of the object (from it's pagename), this function will search through it's
1523 // list of General Object Scripts for a script with a matching name (to see if there is a script
1524 // for that type/id of object within this DLL). If a matching scriptname is found, a UNIQUE ID
1525 // is to be returned back to Descent 3. This ID will be used from here on out for all future
1526 // interaction with the DLL. Since doors are not part of the generic object's, it's possible
1527 // for a door to have the same name as a generic object (OBJ_POWERUP, OBJ_BUILDING, OBJ_CLUTTER
1528 // or OBJ_ROBOT), therefore, a 1 is passed in for isdoor if the given object name refers to a
1529 // door, else it is a 0. The return value is the unique identifier, else -1 if the script
1530 // does not exist in the DLL.
1531 int STDCALLcxx . . $ `lib/module.h:88:11`! GetGOScriptIDcxx . . $ GetGOScriptID(a2648ab7e2ef960e).(const char *name, uint8_tcxx . . $ uint8_t# isdoor) {
1532 for (int i = 0; i < NUM_IDScxx . . $ `scripts/AIGame3.cpp:585:9`!; i++) {
1533 if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(name, ScriptInfo[i].name)) {
1534 return ScriptInfocxx . . $ ScriptInfo.[i].idcxx . . $ tScriptInfo#id.;
1535 }
1536 }
1537 return -1;
1538 }
1539
1540 // CreateInstance
1541 // Purpose:
1542 // Given an ID from a call to GetGOScriptID(), this function will create a new instance for that
1543 // particular script (by allocating and initializing memory, etc.). A pointer to this instance
1544 // is to be returned back to Descent 3. This pointer will be passed around, along with the ID
1545 // for CallInstanceEvent() and DestroyInstance(). Return NULL if there was an error.
1546 void STDCALLPTRcxx . . $ `lib/module.h:90:10`! CreateInstancecxx . . $ CreateInstance(d1680a912d714170).(int id) {
1547 switch (id) {
1548 case ID_ALIENORGANISMcxx . . $ `scripts/AIGame3.cpp:587:9`!:
1549 return new AlienOrganismcxx . . $ AlienOrganism#;
1550 break;
1551 case ID_HEAVYTROOPERcxx . . $ `scripts/AIGame3.cpp:588:9`!:
1552 return new HeavyTroopercxx . . $ HeavyTrooper#;
1553 break;
1554 case ID_LIFTERcxx . . $ `scripts/AIGame3.cpp:589:9`!:
1555 return new Liftercxx . . $ Lifter#;
1556 break;
1557 case ID_ALIENBOSScxx . . $ `scripts/AIGame3.cpp:590:9`!:
1558 return new AlienBosscxx . . $ AlienBoss#;
1559 break;
1560 case ID_SECURITYCAMERAcxx . . $ `scripts/AIGame3.cpp:591:9`!:
1561 return new SecurityCameracxx . . $ SecurityCamera#;
1562 break;
1563 case ID_CROWDCONTROLcxx . . $ `scripts/AIGame3.cpp:592:9`!:
1564 return new CrowdControlcxx . . $ CrowdControl#;
1565 break;
1566 default:
1567 mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id);
1568 break;
1569 };
1570 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
1571 }
1572
1573 // DestroyInstance
1574 // Purpose:
1575 // Given an ID, and a pointer to a particular instance of a script, this function will delete and
1576 // destruct all information associated with that script, so it will no longer exist.
1577 void STDCALLcxx . . $ `lib/module.h:88:11`! DestroyInstancecxx . . $ DestroyInstance(6ca3d68f5c5f0975).(int id, void *ptr) {
1578 switch (id) {
1579 case ID_ALIENORGANISMcxx . . $ `scripts/AIGame3.cpp:587:9`!:
1580 delete ((AlienOrganismcxx . . $ AlienOrganism# *)ptr);
1581 break;
1582 case ID_HEAVYTROOPERcxx . . $ `scripts/AIGame3.cpp:588:9`!:
1583 delete ((HeavyTroopercxx . . $ HeavyTrooper# *)ptr);
1584 break;
1585 case ID_LIFTERcxx . . $ `scripts/AIGame3.cpp:589:9`!:
1586 delete ((Liftercxx . . $ Lifter# *)ptr);
1587 break;
1588 case ID_ALIENBOSScxx . . $ `scripts/AIGame3.cpp:590:9`!:
1589 delete ((AlienBosscxx . . $ AlienBoss# *)ptr);
1590 break;
1591 case ID_SECURITYCAMERAcxx . . $ `scripts/AIGame3.cpp:591:9`!:
1592 delete ((SecurityCameracxx . . $ SecurityCamera# *)ptr);
1593 break;
1594 case ID_CROWDCONTROLcxx . . $ `scripts/AIGame3.cpp:592:9`!:
1595 delete ((CrowdControlcxx . . $ CrowdControl# *)ptr);
1596 break;
1597 default:
1598 mprintfcxx . . $ mprintf.(0, "SCRIPT: Illegal ID (%d)\n", id);
1599 break;
1600 }
1601 }
1602
1603 // CallInstanceEvent
1604 // Purpose:
1605 // Given an ID, a pointer to a script instance, an event and a pointer to the struct of
1606 // information about the event, this function will translate who this event belongs to and
1607 // passes the event to that instance of the script to be handled. Return a combination of
1608 // CONTINUE_CHAIN and CONTINUE_DEFAULT, to give instructions on what to do based on the
1609 // event. CONTINUE_CHAIN means to continue through the chain of scripts (custom script, level
1610 // script, mission script, and finally default script). If CONTINUE_CHAIN is not specified,
1611 // than the chain is broken and those scripts of lower priority will never get the event. Return
1612 // CONTINUE_DEFAULT in order to tell D3 if you want process the normal action that is built into
1613 // the game for that event. This only pertains to certain events. If the chain continues
1614 // after this script, than the CONTINUE_DEFAULT setting will be overridden by lower priority
1615 // scripts return value.
1616 int16_t STDCALLcxx . . $ `lib/module.h:88:11`! CallInstanceEventcxx . . $ CallInstanceEvent(79be2a5a01598f29).(int id, void *ptr, int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
1617 return ((BaseObjScriptcxx . . $ BaseObjScript# *)ptr)->CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(event, data);
1618 }
1619
1620 // SaveRestoreState
1621 // Purpose:
1622 // This function is called when Descent 3 is saving or restoring the game state. In this function
1623 // you should save/restore any global data that you want preserved through load/save (which includes
1624 // demos). You must be very careful with this function, corrupting the file (reading or writing too
1625 // much or too little) may be hazardous to the game (possibly making it impossible to restore the
1626 // state). It would be best to use version information to keep older versions of saved states still
1627 // able to be used. IT IS VERY IMPORTANT WHEN SAVING THE STATE TO RETURN THE NUMBER OF _BYTES_ WROTE
1628 // TO THE FILE. When restoring the data, the return value is ignored. saving_state is 1 when you should
1629 // write data to the file_ptr, 0 when you should read in the data.
1630 int STDCALLcxx . . $ `lib/module.h:88:11`! SaveRestoreStatecxx . . $ SaveRestoreState(5276b51c10b71c09).(void *file_ptr, uint8_tcxx . . $ uint8_t# saving_state) { return 0; }
1631
1632 //============================================
1633 // Script Implementation
1634 //============================================
1635 BaseObjScriptcxx . . $ BaseObjScript#::BaseObjScriptcxx . . $ BaseObjScript#BaseObjScript(49f6e7a06ebc5aa8).() {}
1636
1637 BaseObjScriptcxx . . $ BaseObjScript#::~cxx . . $ BaseObjScript#`~BaseObjScript`(ced63f7c635d850d).BaseObjScriptcxx . . $ BaseObjScript#() {}
1638
1639 int16_t BaseObjScriptcxx . . $ BaseObjScript#::CallEventcxx . . $ BaseObjScript#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!; }
1640
1641 //---------------------
1642 // AlienOrganism class
1643 //---------------------
1644
1645 // Sends a command out to another alien
1646 bool AlienOrganismcxx . . $ AlienOrganism#::SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
1647 bot_comcxx . . $ bot_com# com;
1648
1649 com.actioncxx . . $ bot_com#action. = command;
1650 com.ptrcxx . . $ bot_com#ptr. = ptr;
1651
1652 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
1653
1654 ei.me_handlecxx . . $ tOSIRISEventInfo#me_handle. = it;
1655 ei.extra_infocxx . . $ tOSIRISEventInfo#extra_info. = (void *)&com;
1656 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!;
1657 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = me;
1658
1659 return Obj_CallEventcxx . . $ Obj_CallEvent.(it, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei);
1660 }
1661
1662 // Processes a command from another alien
1663 bool AlienOrganismcxx . . $ AlienOrganism#::ReceiveCommandcxx . . $ AlienOrganism#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
1664 switch (command) {
1665 // Leader is asking alien to join squad
1666 case ALIEN_COM_JOIN_MEcxx . . $ `scripts/AIGame3.cpp:675:9`!:
1667 if (WillJoinLeadercxx . . $ AlienOrganism#WillJoinLeader(1432650661211742).(me, it, *(int *)ptr)) {
1668 return true;
1669 }
1670 break;
1671
1672 // Leader is telling squadie to leave the squad
1673 case ALIEN_COM_LEAVE_MEcxx . . $ `scripts/AIGame3.cpp:676:9`!:
1674 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1675 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1676 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
1677 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
1678 return true;
1679 break;
1680
1681 // Leader is telling squadie to leave the squad for the given mode
1682 case ALIEN_COM_LEAVE_ME_FOR_MODEcxx . . $ `scripts/AIGame3.cpp:692:9`!:
1683 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1684 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1685 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
1686 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, *(int *)ptr);
1687 return true;
1688 break;
1689
1690 case ALIEN_COM_PROTECT_MEcxx . . $ `scripts/AIGame3.cpp:677:9`!:
1691 break;
1692
1693 // Leader is telling squadie to break formation and attack
1694 case ALIEN_COM_BREAK_AND_ATTACKcxx . . $ `scripts/AIGame3.cpp:678:9`!:
1695 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. |= ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
1696 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
1697 return true;
1698 break;
1699
1700 // Leader is telling squadie to resume formation
1701 case ALIEN_COM_REGROUPcxx . . $ `scripts/AIGame3.cpp:679:9`!:
1702 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
1703 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
1704 return true;
1705 break;
1706
1707 // Leader is telling squadie to switch to given mode
1708 case ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!:
1709 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, *(int *)ptr);
1710 return true;
1711 break;
1712
1713 // Leader is telling squadie to set pending mode
1714 case ALIEN_COM_SET_PENDING_MODEcxx . . $ `scripts/AIGame3.cpp:681:9`!:
1715 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = *(int *)ptr;
1716 return true;
1717 break;
1718
1719 // Alien is asked to return current mode
1720 case ALIEN_COM_GET_MODEcxx . . $ `scripts/AIGame3.cpp:682:9`!:
1721 *(int *)ptr = memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.;
1722 return true;
1723 break;
1724
1725 // Alien is told to set the given squad flags
1726 case ALIEN_COM_SET_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:683:9`!: {
1727 int flags = *(int *)ptr;
1728 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. |= flags;
1729 return true;
1730 } break;
1731
1732 // Alien is told to clear the given squad flags
1733 case ALIEN_COM_CLEAR_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:684:9`!: {
1734 int flags = *(int *)ptr;
1735 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~flags;
1736 return true;
1737 } break;
1738
1739 // Squadie is asking leader if it can leave
1740 case ALIEN_COM_REQUEST_LEAVEcxx . . $ `scripts/AIGame3.cpp:686:9`!:
1741 break;
1742
1743 // Squadie is telling leader that he's leaving
1744 case ALIEN_COM_LEAVING_YOUcxx . . $ `scripts/AIGame3.cpp:687:9`!: {
1745 int tm_id = FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(it);
1746 if (tm_id >= 0) {
1747 RemoveTeammatecxx . . $ AlienOrganism#RemoveTeammate(d4f767463ce0a6b3).(tm_id);
1748 if (memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. == 0) {
1749 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1750 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
1751 }
1752 return true;
1753 }
1754 } break;
1755
1756 // Squadie is asking for it's formation position
1757 case ALIEN_COM_GET_GOAL_POScxx . . $ `scripts/AIGame3.cpp:688:9`!: {
1758 int tm_id = FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(it);
1759 if (tm_id >= 0) {
1760 CalcFormationPositioncxx . . $ AlienOrganism#CalcFormationPosition(dce807ad13d96105).(me, tm_id, (vectorcxx . . $ vector# *)ptr);
1761 return true;
1762 }
1763 } break;
1764
1765 // Squadie is asking for it's formation goal room
1766 case ALIEN_COM_GET_GOAL_ROOMcxx . . $ `scripts/AIGame3.cpp:689:9`!: {
1767 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, (int *)ptr);
1768 return true;
1769 } break;
1770
1771 // I'm being informed that a squadmate has been hit
1772 case ALIEN_COM_I_WAS_HITcxx . . $ `scripts/AIGame3.cpp:690:9`!: {
1773 // mprintf(0,"I was hit message received!\n");
1774
1775 if (MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(me)) {
1776 return true;
1777 }
1778 } break;
1779
1780 // I'm being asked if I can see a squadie or not
1781 case ALIEN_COM_CAN_YOU_SEE_MEcxx . . $ `scripts/AIGame3.cpp:691:9`!: {
1782 int tm_id = FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(it);
1783 if (tm_id >= 0) {
1784 *(bool *)ptr = memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[tm_id].is_visiblecxx . . $ teammate_data#is_visible.;
1785 return true;
1786 }
1787 } break;
1788
1789 // I'm being told to go hunt to a certain object
1790 case ALIEN_COM_HUNT_TO_OBJcxx . . $ `scripts/AIGame3_External.h:33:9`!: {
1791 // Make sure we're in a mode that is ok to switch from
1792 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!)
1793 return false;
1794
1795 // If we're a squadie, forward this to the leader and let him take care of it
1796 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
1797 return SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_HUNT_TO_OBJcxx . . $ `scripts/AIGame3_External.h:33:9`!, ptr);
1798 }
1799
1800 // Otherwise, set the destination object
1801 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. = *(int *)ptr;
1802
1803 // Switch to hunting mode
1804 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!);
1805
1806 // If leading, tell the squad to do the same
1807 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
1808 int mode = ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!;
1809 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!, &mode);
1810 }
1811
1812 return true;
1813 } break;
1814
1815 // I'm being told to go hunt to a certain object
1816 case ALIEN_COM_SCAV_TO_OBJcxx . . $ `scripts/AIGame3_External.h:34:9`!: {
1817 // Make sure we're in a mode that is ok to switch from
1818 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!)
1819 return false;
1820
1821 // If we're a squadie, forward this to the leader and let him take care of it
1822 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
1823 return SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_SCAV_TO_OBJcxx . . $ `scripts/AIGame3_External.h:34:9`!, ptr);
1824 }
1825
1826 // Otherwise, set the destination object
1827 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. = *(int *)ptr;
1828
1829 // Switch to hunting mode
1830 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!);
1831
1832 // If leading, tell the squad to do the same
1833 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
1834 int mode = ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!;
1835 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!, &mode);
1836 }
1837
1838 return true;
1839 } break;
1840 }
1841
1842 // mprintf(0, "AlienOrganism action %d failed\n");
1843 return false;
1844 }
1845
1846 // Sends a command (rhetorical) to all of a leader's teammates
1847 bool AlienOrganismcxx . . $ AlienOrganism#::IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(int leader_handle, char command, void *ptr) {
1848 for (int j = 0; j < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; j++)
1849 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(leader_handle, memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[j].handlecxx . . $ teammate_data#handle., command, ptr);
1850
1851 return true;
1852 }
1853
1854 // Returns true if mode is one of the landed modes
1855 bool AlienOrganismcxx . . $ AlienOrganism#::IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(int mode) {
1856 if (mode == ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`! || mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! || mode == ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! ||
1857 mode == ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`! || mode == ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!)
1858 return true;
1859
1860 return false;
1861 }
1862
1863 // Returns true if mode is one of the energy related landed modes
1864 bool AlienOrganismcxx . . $ AlienOrganism#::IsEnergyRelatedLandedModecxx . . $ AlienOrganism#IsEnergyRelatedLandedMode(83c267b20bac841a).(int mode) {
1865 if (mode == ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! || mode == ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`! || mode == ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!)
1866 return true;
1867
1868 return false;
1869 }
1870
1871 // Returns true if current mode warrants fighting back when hit by player
1872 bool AlienOrganismcxx . . $ AlienOrganism#::ModeIsAttackSensitivecxx . . $ AlienOrganism#ModeIsAttackSensitive(cf9ef193275fa6d8).(int mode, int pending_mode) {
1873 // Make sure we're not already in an attack mode
1874 if (mode != ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`! && mode != ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`!) {
1875 // Make sure we're not healing, giving birth, or fleeing
1876 if (mode != ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`! && mode != ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`! && mode != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! &&
1877 (mode != ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`! || randcxx . . $ rand(9efc7249d839d30e).() % 100 < 2) &&
1878 (mode != ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`! || randcxx . . $ rand(9efc7249d839d30e).() % 100 < 5) && pending_mode != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! &&
1879 pending_mode != ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`! && pending_mode != ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`! &&
1880 mode != ALIEN_FINDING_BIRTHPLACEcxx . . $ `scripts/AIGame3.cpp:629:9`! && mode != ALIEN_GIVING_BIRTHcxx . . $ `scripts/AIGame3.cpp:630:9`!) {
1881 return true;
1882 }
1883 }
1884
1885 return false;
1886 }
1887
1888 // These are the modes from which a leader may attempt to recruit squadies
1889 bool AlienOrganismcxx . . $ AlienOrganism#::ModeSupportsSquadRecruitmentcxx . . $ AlienOrganism#ModeSupportsSquadRecruitment(83c267b20bac841a).(int mode) {
1890 if (mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! || mode == ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`! || mode == ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`! ||
1891 mode == ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!)
1892 return true;
1893
1894 return false;
1895 }
1896
1897 // These are the modes from which an alien may enlist in a squad
1898 bool AlienOrganismcxx . . $ AlienOrganism#::ModeSupportsSquadEnlistmentcxx . . $ AlienOrganism#ModeSupportsSquadEnlistment(1432650661211742).(int mode, int pending_mode, int recruiter_mode) {
1899 // If recruiter is landed resting, only join if we are too
1900 if (recruiter_mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! && mode != ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!)
1901 return false;
1902
1903 if (mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! || (mode == ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`! && pending_mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!) ||
1904 mode == ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`! || mode == ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`! || mode == ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!)
1905 return true;
1906
1907 return false;
1908 }
1909
1910 // These are the modes in which a squadie may follow formation movement
1911 bool AlienOrganismcxx . . $ AlienOrganism#::ModeSupportsSquadMovementcxx . . $ AlienOrganism#ModeSupportsSquadMovement(83c267b20bac841a).(int mode) {
1912 if (mode == ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`! || mode == ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`! || mode == ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!)
1913 return true;
1914
1915 return false;
1916 }
1917
1918 // Tells all current teammates that they are on their own again
1919 void AlienOrganismcxx . . $ AlienOrganism#::DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(int me) {
1920 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!))
1921 return;
1922
1923 for (int i = 0; i < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; i++) {
1924 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].handlecxx . . $ teammate_data#handle., ALIEN_COM_LEAVE_MEcxx . . $ `scripts/AIGame3.cpp:676:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
1925 }
1926
1927 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1928 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1929 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
1930 }
1931
1932 // Tells all current teammates that they are to leave the squad and enter the given mode
1933 void AlienOrganismcxx . . $ AlienOrganism#::DisperseSquadToModecxx . . $ AlienOrganism#DisperseSquadToMode(3e454b8ccf442868).(int me, int mode) {
1934 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!))
1935 return;
1936
1937 for (int i = 0; i < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; i++) {
1938 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].handlecxx . . $ teammate_data#handle., ALIEN_COM_LEAVE_ME_FOR_MODEcxx . . $ `scripts/AIGame3.cpp:692:9`!, &mode);
1939 }
1940
1941 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1942 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1943 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
1944 }
1945
1946 bool AlienOrganismcxx . . $ AlienOrganism#::LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(int me) {
1947 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!))
1948 return true;
1949
1950 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_LEAVING_YOUcxx . . $ `scripts/AIGame3.cpp:687:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
1951 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
1952 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1953 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
1954
1955 return true;
1956 }
1957
1958 // Attempts to make an alien flee (returns true if it does, false otherwise)
1959 bool AlienOrganismcxx . . $ AlienOrganism#::Fleecxx . . $ AlienOrganism#Flee(9609253e83e89946).(int me, bool force_flee /*=false*/) {
1960 // If we're a squadie, tell the leader we are leaving
1961 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
1962 if (!force_flee) {
1963 // do squadie saving throw
1964 if ((randcxx . . $ rand(9efc7249d839d30e).() % 100) < ALIEN_SQUADIE_FLEE_SAVING_THROWcxx . . $ `scripts/AIGame3.cpp:664:9`!)
1965 return false;
1966 }
1967
1968 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
1969 }
1970
1971 // If we're a leader, disperse the squad
1972 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
1973 if (!force_flee) {
1974 // do leader saving throw
1975 if ((randcxx . . $ rand(9efc7249d839d30e).() % 100) < ALIEN_LEADER_FLEE_SAVING_THROWcxx . . $ `scripts/AIGame3.cpp:665:9`!)
1976 return false;
1977 }
1978
1979 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
1980 }
1981
1982 // Ok, let's flee
1983 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`!);
1984 // mprintf(0,"Alien is fleeing!\n");
1985
1986 return true;
1987 }
1988
1989 // Attempts to make an alien attack (and his squad if leading one)
1990 bool AlienOrganismcxx . . $ AlienOrganism#::MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(int me, bool force_attack /*=false*/) {
1991 // If leading squad, tell squad to switch to melee mode
1992 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
1993 int mode = ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!;
1994 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!, &mode);
1995 }
1996
1997 // Attack target!
1998 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!);
1999
2000 // mprintf(0,"Alien is switching to Melee Attack mode!\n");
2001
2002 return true;
2003 }
2004
2005 // Makes an alien go into ranged attack mode
2006 bool AlienOrganismcxx . . $ AlienOrganism#::RangedAttackcxx . . $ AlienOrganism#RangedAttack(83c267b20bac841a).(int me) {
2007 // If we're a squadie, tell the leader we are leaving
2008 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
2009 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
2010 }
2011
2012 // If we're a leader, disperse the squad
2013 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2014 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
2015 }
2016
2017 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`!);
2018 // mprintf(0,"Alien is switching to ranged attack mode!\n");
2019
2020 return true;
2021 }
2022
2023 // Makes an alien go into ranged attack mode
2024 bool AlienOrganismcxx . . $ AlienOrganism#::Healcxx . . $ AlienOrganism#Heal(83c267b20bac841a).(int me) {
2025
2026 // If we're a squadie, tell the leader we are leaving
2027 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
2028 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
2029 }
2030
2031 // If we're a leader, disperse the squad
2032 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2033 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
2034 }
2035
2036 // mprintf(0,"Heading home to heal...\n");
2037
2038 // Ok, let's go home and heal
2039 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!;
2040 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!);
2041
2042 return true;
2043 }
2044
2045 // Makes an alien go into ranged attack mode
2046 bool AlienOrganismcxx . . $ AlienOrganism#::Depositcxx . . $ AlienOrganism#Deposit(83c267b20bac841a).(int me) {
2047 // If we're a squadie, tell the leader we are leaving
2048 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
2049 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
2050 }
2051
2052 // If we're a leader, disperse the squad
2053 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2054 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
2055 }
2056
2057 // mprintf(0,"Alien is going home to deposit...\n");
2058
2059 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!;
2060 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!);
2061
2062 return true;
2063 }
2064
2065 // Makes an alien go into ranged attack mode
2066 bool AlienOrganismcxx . . $ AlienOrganism#::Withdrawcxx . . $ AlienOrganism#Withdraw(83c267b20bac841a).(int me) {
2067 // If we're a squadie, tell the leader we are leaving
2068 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
2069 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
2070 }
2071
2072 // If we're a leader, disperse the squad
2073 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2074 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
2075 }
2076
2077 // mprintf(0,"Alien is going home to withdraw...\n");
2078
2079 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!;
2080 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!);
2081
2082 return true;
2083 }
2084
2085 // Checks to see if we can join the leader
2086 bool AlienOrganismcxx . . $ AlienOrganism#::WillJoinLeadercxx . . $ AlienOrganism#WillJoinLeader(1432650661211742).(int me, int leader_handle, int priority) {
2087 // Get the recruiter's current mode
2088 int recruiter_mode;
2089 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, leader_handle, ALIEN_COM_GET_MODEcxx . . $ `scripts/AIGame3.cpp:682:9`!, &recruiter_mode);
2090
2091 // If can't join a squad in current mode, decline offer
2092 if (!ModeSupportsSquadEnlistmentcxx . . $ AlienOrganism#ModeSupportsSquadEnlistment(1432650661211742).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode., memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode., recruiter_mode))
2093 return false;
2094
2095 // If not currently in a squad, possibly join up
2096 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. == 0) {
2097 // Only join 60% of the time (to help prevent mass join slowdowns)
2098 if (randcxx . . $ rand(9efc7249d839d30e).() % 100 > 60)
2099 return false;
2100
2101 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = leader_handle;
2102 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. |= ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!;
2103 return true;
2104 }
2105
2106 return false;
2107 }
2108
2109 // Returns the Teammate ID for a given handle (returns -1 if not on team)
2110 int AlienOrganismcxx . . $ AlienOrganism#::FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(int tm_handle) {
2111 for (int i = 0; i < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; i++) {
2112 if (memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].handlecxx . . $ teammate_data#handle. == tm_handle)
2113 return i;
2114 }
2115
2116 return -1;
2117 }
2118
2119 // Calculates a squad position for given teammate based on leader's mode
2120 int AlienOrganismcxx . . $ AlienOrganism#::CalcFormationPositioncxx . . $ AlienOrganism#CalcFormationPosition(dce807ad13d96105).(int me, int tm_ID, vectorcxx . . $ vector# *pos) {
2121 vectorcxx . . $ vector# me_pos, goal_pos;
2122 matrixcxx . . $ matrix# orient;
2123
2124 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &me_pos);
2125 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
2126
2127 goal_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). me_pos;
2128
2129 switch (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.) {
2130 // When hunting, form a horizontal diamond
2131 case ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!: {
2132 switch (tm_ID) {
2133 case 0:
2134 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_HUNT_FVECcxx . . $ `scripts/AIGame3.cpp:722:9`!;
2135 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_HUNT_RVECcxx . . $ `scripts/AIGame3.cpp:721:9`!;
2136 break;
2137 case 1:
2138 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_HUNT_FVECcxx . . $ `scripts/AIGame3.cpp:722:9`!;
2139 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_HUNT_RVECcxx . . $ `scripts/AIGame3.cpp:721:9`!;
2140 break;
2141 case 2:
2142 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_HUNT_FVECcxx . . $ `scripts/AIGame3.cpp:722:9`! *cxx . . $ `operator*`(252247219a31502c). 2.0f;
2143 break;
2144 }
2145 } break;
2146
2147 // When scavenging, form a scavenge line
2148 case ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!: {
2149 switch (tm_ID) {
2150 case 0:
2151 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_SCAV_FVECcxx . . $ `scripts/AIGame3.cpp:724:9`!;
2152 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_SCAV_RVECcxx . . $ `scripts/AIGame3.cpp:723:9`!;
2153 break;
2154 case 1:
2155 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_SCAV_FVECcxx . . $ `scripts/AIGame3.cpp:724:9`! *cxx . . $ `operator*`(252247219a31502c). 2.0f;
2156 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_SCAV_RVECcxx . . $ `scripts/AIGame3.cpp:723:9`!;
2157 break;
2158 case 2:
2159 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_SCAV_FVECcxx . . $ `scripts/AIGame3.cpp:724:9`! *cxx . . $ `operator*`(252247219a31502c). 3.0f;
2160 break;
2161 }
2162 } break;
2163
2164 // When attacking, form a vertical triangle
2165 case ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!:
2166 case ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`!: {
2167 switch (tm_ID) {
2168 case 0:
2169 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_FVECcxx . . $ `scripts/AIGame3.cpp:728:9`!;
2170 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_UVECNcxx . . $ `scripts/AIGame3.cpp:727:9`!;
2171 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_RVECcxx . . $ `scripts/AIGame3.cpp:725:9`!;
2172 break;
2173 case 1:
2174 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_FVECcxx . . $ `scripts/AIGame3.cpp:728:9`!;
2175 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_UVECNcxx . . $ `scripts/AIGame3.cpp:727:9`!;
2176 goal_pos -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_RVECcxx . . $ `scripts/AIGame3.cpp:725:9`!;
2177 break;
2178 case 2:
2179 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_FVECcxx . . $ `scripts/AIGame3.cpp:728:9`!;
2180 goal_pos +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). ALIEN_FO_ATTK_UVECPcxx . . $ `scripts/AIGame3.cpp:726:9`!;
2181 break;
2182 }
2183 } break;
2184 }
2185
2186 // Return the goal position
2187 (*pos) =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). goal_pos;
2188 return true;
2189 }
2190
2191 void AlienOrganismcxx . . $ AlienOrganism#::SetSquadieFormationGoalcxx . . $ AlienOrganism#SetSquadieFormationGoal(d4f767463ce0a6b3).(int me) {
2192 float cd = .1f;
2193 float temp = 0.0f;
2194
2195 // Do the get to position goal for when squadie can't see leader
2196 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_GET_GOAL_POScxx . . $ `scripts/AIGame3.cpp:688:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
2197 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_V_POScxx . . $ `scripts/osiris_common.h:578:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
2198
2199 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_GET_GOAL_ROOMcxx . . $ `scripts/AIGame3.cpp:689:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.);
2200 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:572:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.);
2201
2202 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 1, 1.0f, -1, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.,
2203 memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.);
2204 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &cd);
2205
2206 // Do the custom goal for when squadie can see leader (similar to use bline when sees goal)
2207 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:197:9`!, 2, 1.0f, -1, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
2208 AI_GoalAddEnablercxx . . $ AI_GoalAddEnabler.(me, 2, AIE_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:162:9`!, 1.0, 0.0, &temp);
2209 }
2210
2211 void AlienOrganismcxx . . $ AlienOrganism#::UpdateSquadieFormationGoalcxx . . $ AlienOrganism#UpdateSquadieFormationGoal(d4f767463ce0a6b3).(int me) {
2212 // Update the squadie positions
2213 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_GET_GOAL_POScxx . . $ `scripts/AIGame3.cpp:688:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
2214 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_V_POScxx . . $ `scripts/osiris_common.h:578:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
2215
2216 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_GET_GOAL_ROOMcxx . . $ `scripts/AIGame3.cpp:689:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.);
2217 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:572:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room.);
2218 }
2219
2220 void AlienOrganismcxx . . $ AlienOrganism#::SetWanderGoalcxx . . $ AlienOrganism#SetWanderGoal(d4f767463ce0a6b3).(int me) {
2221 vectorcxx . . $ vector# pos;
2222 int room = 0;
2223 float dist = 15.0f;
2224
2225 // If the destination object is valid, set the goals to go to that object
2226 if (memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
2227 int type;
2228 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
2229 if (type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
2230 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, 2, 1.0f, ALIEN_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:672:9`!,
2231 GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_USE_BLINE_IF_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:223:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!,
2232 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle.);
2233 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
2234
2235 return;
2236 }
2237 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2238 }
2239
2240 // Set the goal to wander
2241 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, 2, 1.0f, -1, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, room, room);
2242 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
2243 }
2244
2245 // Removes a teammate from the squad
2246 void AlienOrganismcxx . . $ AlienOrganism#::RemoveTeammatecxx . . $ AlienOrganism#RemoveTeammate(d4f767463ce0a6b3).(int tm_id) {
2247 for (int j = tm_id; j < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. - 1; j++) {
2248 memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[j] =cxx . . $ teammate_data#`operator=`(29d774b8dabc1ffd). memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[j + 1];
2249 }
2250
2251 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.--;
2252 }
2253
2254 // Called by a leader to update his squad list (removes any that have died)
2255 void AlienOrganismcxx . . $ AlienOrganism#::UpdateSquadListcxx . . $ AlienOrganism#UpdateSquadList(d4f767463ce0a6b3).(int me) {
2256 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!))
2257 return;
2258
2259 for (int i = 0; i < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; i++) {
2260 int type;
2261 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].handlecxx . . $ teammate_data#handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
2262 if (type == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
2263 RemoveTeammatecxx . . $ AlienOrganism#RemoveTeammate(d4f767463ce0a6b3).(i);
2264 i--;
2265 }
2266 }
2267 }
2268
2269 // Updates the squad (recruitment, etc.)
2270 void AlienOrganismcxx . . $ AlienOrganism#::UpdateSquadcxx . . $ AlienOrganism#UpdateSquad(d4f767463ce0a6b3).(int me) {
2271 // If me's a squadie, get outta here
2272 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!)
2273 return;
2274
2275 // Remove any dead teammates
2276 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2277 UpdateSquadListcxx . . $ AlienOrganism#UpdateSquadList(d4f767463ce0a6b3).(me);
2278
2279 if (memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. == 0)
2280 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
2281
2282 if (memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. >= ALIEN_MAX_TEAMMATEScxx . . $ `scripts/AIGame3.cpp:695:9`!)
2283 return;
2284 }
2285
2286 // If can't recruit in current mode get outta here
2287 if (!ModeSupportsSquadRecruitmentcxx . . $ AlienOrganism#ModeSupportsSquadRecruitment(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.))
2288 return;
2289
2290 // Try to recruit some teammates
2291 int scan_objs[25];
2292 int n_scan;
2293 int room;
2294 vectorcxx . . $ vector# pos;
2295 int i;
2296
2297 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
2298 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
2299
2300 n_scan = AI_GetNearbyObjscxx . . $ AI_GetNearbyObjs(9d0c65cbff229ccc).(&pos, room, ALIEN_SQUAD_RECRUIT_RADIUScxx . . $ `scripts/AIGame3.cpp:652:9`!, scan_objs, 25, false, true, false, true);
2301
2302 for (i = 0; i < n_scan; i++) {
2303 uint16_tcxx . . $ uint16_t# id;
2304 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(scan_objs[i], VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_US_IDcxx . . $ `scripts/osiris_common.h:627:9`!, &id);
2305
2306 // this is more rare than the types matching; so, do it first
2307 if (id == alien_organism_idcxx . . $ alien_organism_id.) {
2308 int type;
2309 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(scan_objs[i], VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
2310 if (type == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && scan_objs[i] != me) {
2311 // Make sure this guy isn't already a squadmate
2312 bool already_on_team = false;
2313 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
2314 if (FindTeammateIDcxx . . $ AlienOrganism#FindTeammateID(7864480464b09eea).(scan_objs[i]) >= 0)
2315 already_on_team = true;
2316 }
2317
2318 if (!already_on_team) {
2319 // Try and recruit him
2320 int priority = MEDIUM_PRIORITYcxx . . $ `scripts/AIGame3.cpp:612:9`!;
2321 if (SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, scan_objs[i], ALIEN_COM_JOIN_MEcxx . . $ `scripts/AIGame3.cpp:675:9`!, &priority)) {
2322 // If not currently a leader, it's time to become one
2323 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!)) {
2324 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!;
2325 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
2326
2327 // Reset the current mode to take squad grouping into account
2328 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
2329 }
2330 memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.++].handlecxx . . $ teammate_data#handle. = scan_objs[i];
2331
2332 // Tell squadie whether he should be in formation or not
2333 int sflags = ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2334 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)
2335 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, scan_objs[i], ALIEN_COM_SET_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:683:9`!, &sflags);
2336 else
2337 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, scan_objs[i], ALIEN_COM_CLEAR_SQUAD_FLAGScxx . . $ `scripts/AIGame3.cpp:684:9`!, &sflags);
2338
2339 // Tell squadie to set his mode to the leader's mode
2340 int mode = memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.;
2341 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, scan_objs[i], ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!, &mode);
2342 }
2343 }
2344 }
2345 }
2346
2347 // If squad is full get outta here
2348 if (memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. >= ALIEN_MAX_TEAMMATEScxx . . $ `scripts/AIGame3.cpp:695:9`!)
2349 return;
2350 }
2351 }
2352
2353 // Checks which of my boys I can see
2354 void AlienOrganismcxx . . $ AlienOrganism#::UpdateSquadVisibilitycxx . . $ AlienOrganism#UpdateSquadVisibility(d4f767463ce0a6b3).(int me) {
2355 int i, flags, fate;
2356 vectorcxx . . $ vector# start_pos, end_pos;
2357 int start_room;
2358 ray_infocxx . . $ ray_info# ray;
2359
2360 // First, remove any dead squadies
2361 UpdateSquadListcxx . . $ AlienOrganism#UpdateSquadList(d4f767463ce0a6b3).(me);
2362
2363 // Get my room and position
2364 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
2365 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
2366
2367 // Do the visibility check for each teammate
2368 for (i = 0; i < memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates.; i++) {
2369 // Get teammate's position
2370 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].handlecxx . . $ teammate_data#handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &end_pos);
2371
2372 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`! |
2373 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2374 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &start_pos, &end_pos, start_room, 1.0f, flags, &ray);
2375
2376 // Set whether or not this guy is visible
2377 memorycxx . . $ AlienOrganism#memory.->teammatecxx . . $ alienorganism_data#teammate.[i].is_visiblecxx . . $ teammate_data#is_visible. = (fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) ? true : false;
2378 }
2379 }
2380
2381 // Checks to see if any fire blobs are nearby
2382 bool AlienOrganismcxx . . $ AlienOrganism#::IsNearFirecxx . . $ AlienOrganism#IsNearFire(83c267b20bac841a).(int me) { return false; }
2383
2384 // Checks to see if alien is currently on fire
2385 bool AlienOrganismcxx . . $ AlienOrganism#::IsOnFirecxx . . $ AlienOrganism#IsOnFire(83c267b20bac841a).(int me) { return (Obj_IsEffectcxx . . $ Obj_IsEffect.(me, EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)); }
2386
2387 #define ALIEN_MAX_BEAM_DISTcxx . . $ `scripts/AIGame3.cpp:2387:9`! 30.0f
2388 #define ALIEN_ATTEMPT_BEAM_DISTcxx . . $ `scripts/AIGame3.cpp:2388:9`! 40.0f
2389
2390 void AlienOrganismcxx . . $ AlienOrganism#::ProjectBeamcxx . . $ AlienOrganism#ProjectBeam(a16672ec5cbc060d).(int me, int pos_handle, vectorcxx . . $ vector# *start_pos, int start_room, vectorcxx . . $ vector# *beam_dir,
2391 matrixcxx . . $ matrix# *orient, int beam_flag) {
2392 ray_infocxx . . $ ray_info# ray;
2393 int flags, fate;
2394 vectorcxx . . $ vector# end_pos, landing_pos;
2395 int landing_room;
2396 float dist;
2397
2398 // Calculate beam's destination
2399 end_pos =cxx . . $ vector#`operator=`(c0842353a20857d). (*start_pos) +cxx . . $ operator+(b77b703cd1e43e33). ((*beam_dir) *cxx . . $ `operator*`(252247219a31502c). ALIEN_ATTEMPT_BEAM_DISTcxx . . $ `scripts/AIGame3.cpp:2388:9`!);
2400
2401 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`! |
2402 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2403 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, start_pos, &end_pos, start_room, 0.0f, flags, &ray);
2404
2405 landing_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
2406 landing_room = ray.hit_roomcxx . . $ ray_info#hit_room.;
2407
2408 // If beam is within certain distance, move the destination object to destination position
2409 dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(start_pos, &landing_pos);
2410 if (dist < ALIEN_MAX_BEAM_DISTcxx . . $ `scripts/AIGame3.cpp:2387:9`!) {
2411 msafe_structcxx . . $ msafe_struct# mstruct;
2412 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = pos_handle;
2413 mstruct.poscxx . . $ msafe_struct#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). landing_pos;
2414 mstruct.orientcxx . . $ msafe_struct#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). (*orient);
2415 mstruct.roomnumcxx . . $ msafe_struct#roomnum. = landing_room;
2416 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_WORLD_POSITIONcxx . . $ `scripts/osiris_common.h:846:9`!, &mstruct);
2417
2418 // Mark this beam as enabled
2419 memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. |= beam_flag;
2420 }
2421 }
2422
2423 // Calculates positions and moves invisible powerups to them
2424 void AlienOrganismcxx . . $ AlienOrganism#::CalcEnergyBeamPositionscxx . . $ AlienOrganism#CalcEnergyBeamPositions(d4f767463ce0a6b3).(int me) {
2425 int start_room;
2426 vectorcxx . . $ vector# beam1_dir, beam2_dir, beam3_dir;
2427 vectorcxx . . $ vector# start_pos;
2428 matrixcxx . . $ matrix# orient;
2429
2430 // Get our object's pos and orientation
2431 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
2432 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
2433 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
2434
2435 // If we're in a beam mode, get the appropriate beam directions
2436 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!) {
2437 beam1_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.40f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec.;
2438 // beam1_dir += orient.rvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2439 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam1_dir);
2440
2441 beam2_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.40f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec.;
2442 // beam2_dir += orient.fvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2443 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam2_dir);
2444
2445 beam3_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.40f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec.;
2446 // beam3_dir += orient.fvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2447 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam3_dir);
2448 } else if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!) {
2449 beam1_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.3f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec.;
2450 // beam1_dir += orient.rvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2451 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam1_dir);
2452
2453 beam2_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.3f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec.;
2454 // beam2_dir -= orient.fvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2455 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam2_dir);
2456
2457 beam3_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.3f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.fveccxx . . $ matrix#fvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec.;
2458 // beam3_dir -= orient.fvec*(0.5f-((float)rand()/(float)D3_RAND_MAX)*1.0f);
2459 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam3_dir);
2460 } else if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!) {
2461 beam2_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.4f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. +cxx . . $ operator+(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). 2.0f;
2462 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam2_dir);
2463
2464 beam3_dir =cxx . . $ vector#`operator=`(c0842353a20857d). -0.4f *cxx . . $ `operator*`(9d6577ff3e9faa29). orient.uveccxx . . $ matrix#uvec. -cxx . . $ operator-(b77b703cd1e43e33). orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). 2.0f;
2465 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&beam3_dir);
2466 } else {
2467 return;
2468 }
2469
2470 // All beams off initially
2471 memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. = 0;
2472
2473 // Project the three beams
2474 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!) {
2475 ProjectBeamcxx . . $ AlienOrganism#ProjectBeam(a16672ec5cbc060d).(me, memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle., &start_pos, start_room, &beam1_dir, &orient, ALIEN_BEAM1cxx . . $ `scripts/AIGame3.cpp:709:9`!);
2476 }
2477 ProjectBeamcxx . . $ AlienOrganism#ProjectBeam(a16672ec5cbc060d).(me, memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle., &start_pos, start_room, &beam2_dir, &orient, ALIEN_BEAM2cxx . . $ `scripts/AIGame3.cpp:710:9`!);
2478 ProjectBeamcxx . . $ AlienOrganism#ProjectBeam(a16672ec5cbc060d).(me, memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle., &start_pos, start_room, &beam3_dir, &orient, ALIEN_BEAM3cxx . . $ `scripts/AIGame3.cpp:711:9`!);
2479
2480 // Set flag so that this calculation is only done once
2481 memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on. = true;
2482 }
2483
2484 // Creates the different lightning beam effects
2485 void AlienOrganismcxx . . $ AlienOrganism#::UpdateEnergyBeamscxx . . $ AlienOrganism#UpdateEnergyBeams(d4f767463ce0a6b3).(int me) {
2486 int b1_obj1, b1_obj2;
2487 int b2_obj1, b2_obj2;
2488 int b3_obj1, b3_obj2;
2489 int b1_texture_id;
2490 int b2_texture_id;
2491 int b3_texture_id;
2492
2493 if (!memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on.)
2494 return;
2495
2496 // See if it's time to create the next energy effect
2497 if (memorycxx . . $ AlienOrganism#memory.->next_update_beam_timecxx . . $ alienorganism_data#next_update_beam_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
2498 float next_duration = ALIEN_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:651:9`! /*+ ((float)rand()/(float)D3_RAND_MAX)*0.2f*/;
2499 memorycxx . . $ AlienOrganism#memory.->next_update_beam_timecxx . . $ alienorganism_data#next_update_beam_time. = Game_GetTimecxx . . $ Game_GetTime.() + next_duration;
2500
2501 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!) {
2502 b1_obj1 = memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
2503 b1_obj2 = me;
2504 b1_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2505
2506 b2_obj1 = memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
2507 b2_obj2 = me;
2508 b2_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2509
2510 b3_obj1 = memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
2511 b3_obj2 = me;
2512 b3_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2513 } else if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!) {
2514 b1_obj1 = me;
2515 b1_obj2 = memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
2516 b1_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2517
2518 b2_obj1 = me;
2519 b2_obj2 = memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
2520 b2_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2521
2522 b3_obj1 = me;
2523 b3_obj2 = memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
2524 b3_texture_id = transfer_effect_idcxx . . $ transfer_effect_id.;
2525 } else if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!) {
2526 b1_obj1 = memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
2527 b1_obj2 = me;
2528 b1_texture_id = heal_effect_idcxx . . $ heal_effect_id.;
2529
2530 b2_obj1 = me;
2531 b2_obj2 = memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
2532 b2_texture_id = heal_effect_idcxx . . $ heal_effect_id.;
2533
2534 b3_obj1 = me;
2535 b3_obj2 = memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
2536 b3_texture_id = heal_effect_idcxx . . $ heal_effect_id.;
2537 } else {
2538 mprintfcxx . . $ mprintf.(0, "Invalid energy beam effect mode!\n");
2539 return;
2540 }
2541
2542 // Now create the beams
2543 if (memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. & ALIEN_BEAM1cxx . . $ `scripts/AIGame3.cpp:709:9`!) {
2544 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(b1_obj1, b1_obj2, next_duration, 1.0f, 2, b1_texture_id, next_duration, 1, 255, 255, 255, false);
2545 }
2546
2547 if (memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. & ALIEN_BEAM2cxx . . $ `scripts/AIGame3.cpp:710:9`!) {
2548 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(b2_obj1, b2_obj2, next_duration, 1.0f, 2, b2_texture_id, next_duration, 1, 255, 255, 255, false);
2549 }
2550
2551 if (memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. & ALIEN_BEAM3cxx . . $ `scripts/AIGame3.cpp:711:9`!) {
2552 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(b3_obj1, b3_obj2, next_duration, 1.0f, 2, b3_texture_id, next_duration, 1, 255, 255, 255, false);
2553 }
2554 }
2555 }
2556
2557 // Sets the correct energy effect for an alien
2558 void AlienOrganismcxx . . $ AlienOrganism#::UpdateEnergyEffectcxx . . $ AlienOrganism#UpdateEnergyEffect(d4f767463ce0a6b3).(int me) {
2559 int room;
2560 vectorcxx . . $ vector# pos;
2561 int weapon_id;
2562
2563 // See if this object has an energy charge
2564 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. > 0.0f) {
2565 // See if it's time to create the next energy effect
2566 if (memorycxx . . $ AlienOrganism#memory.->next_update_energy_timecxx . . $ alienorganism_data#next_update_energy_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
2567 float slow_down = 0.5f * (ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`! - memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges.) / ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!;
2568 memorycxx . . $ AlienOrganism#memory.->next_update_energy_timecxx . . $ alienorganism_data#next_update_energy_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.1f + 0.05f + slow_down;
2569
2570 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
2571 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
2572
2573 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, energy_effect_idcxx . . $ energy_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
2574 }
2575 }
2576 }
2577
2578 // Sets the alien's max speed
2579 void AlienOrganismcxx . . $ AlienOrganism#::SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed) { AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &speed); }
2580
2581 // Sets the alien's circle distance
2582 void AlienOrganismcxx . . $ AlienOrganism#::SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(int me, float dist) { AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:512:9`!, &dist); }
2583
2584 // Sets the Current Mode
2585 void AlienOrganismcxx . . $ AlienOrganism#::SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(int me, char mode) {
2586 // mprintf(0, "From mode %d, ",memory->mode);
2587
2588 int flags;
2589 char movement_type;
2590 vectorcxx . . $ vector# vel;
2591
2592 // Clear out any goals
2593 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
2594
2595 // Set FOV to 360
2596 float fov = -1.0f;
2597 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
2598
2599 // Turn off ranged firing
2600 flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
2601 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2602
2603 // Make it persistant
2604 flags = AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!;
2605 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2606
2607 // Turn off the energy beams
2608 memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on. = false;
2609
2610 // Do mode specific setups
2611 switch (mode) {
2612 case ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!: {
2613 // mprintf(0,"Going home mode set.\n");
2614
2615 ray_infocxx . . $ ray_info# ray;
2616 int fate;
2617 vectorcxx . . $ vector# end_pos, landing_pos;
2618 int end_room, landing_room;
2619
2620 // If currently landed, set take off velocity
2621 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2622
2623 // Turn on friend avoidance
2624 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2625 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2626
2627 // Set friend avoidance distance
2628 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
2629 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2630 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2631
2632 // Make it aware
2633 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2634 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2635
2636 // Clear wall point collision and axes lock
2637 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
2638 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2639
2640 // Set movement type back to physics for flying around
2641 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2642 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2643
2644 // Make sure squad broken flag isn't set
2645 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2646
2647 // Calculate destination home point a int16_t distance from actual landing point
2648 end_pos =cxx . . $ vector#`operator=`(c0842353a20857d). memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos. +cxx . . $ operator+(b77b703cd1e43e33). (memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec. *cxx . . $ `operator*`(252247219a31502c). 20.0f);
2649
2650 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`! |
2651 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2652 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., &end_pos, memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room., 0.0f, flags, &ray);
2653
2654 landing_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
2655 landing_room = ray.hit_roomcxx . . $ ray_info#hit_room.;
2656
2657 // Set goal to head home
2658 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, 1.0f, ALIEN_GUID_GOT_HOMEcxx . . $ `scripts/AIGame3.cpp:668:9`!, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`!, &landing_pos, landing_room);
2659 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me, 2, 2.0f);
2660
2661 // Set returning home speed
2662 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:733:9`!);
2663
2664 // Clear the next activity time
2665 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = 0.0f;
2666
2667 // Clear the next wander time
2668 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
2669 } break;
2670
2671 case ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`!: {
2672 // mprintf(0,"Landing at home mode set.\n");
2673
2674 // If currently landed, set take off velocity
2675 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2676
2677 // Turn off dodging
2678 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
2679 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2680
2681 // Turn off friend avoidance
2682 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2683 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2684 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2685
2686 // Turn on point-collide-walls and lock axes
2687 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`! | PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!;
2688 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2689
2690 // Turn off auto-level
2691 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
2692 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2693
2694 // Make it aware
2695 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2696 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2697
2698 // Set movement type back to physics for flying around
2699 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2700 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2701
2702 // Make sure squad broken flag isn't set
2703 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2704
2705 // Make him land at his home point
2706 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, 100.0f, ALIEN_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:669:9`!,
2707 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_ORIENT_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:234:9`!, &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room.);
2708 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me, 2, 0.0f);
2709
2710 // Play his landing animation
2711 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 50, 72, 2.5f, 0, -1, -1);
2712
2713 // Set landing speed
2714 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_LAND_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:734:9`!);
2715
2716 // Clear the next activity time
2717 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = 0.0f;
2718
2719 // Clear the next wander time
2720 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
2721 } break;
2722
2723 case ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`!:
2724 case ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!:
2725 case ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!:
2726 case ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!:
2727 case ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!: {
2728 // mprintf(0,"Landed mode set.\n");
2729
2730 // Turn off dodging
2731 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
2732 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2733
2734 // Turn off friend avoidance
2735 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2736 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2737 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2738
2739 // Turn off auto-level
2740 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
2741 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2742
2743 // Turn on point-collide-walls and lock axes
2744 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`! | PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!;
2745 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2746
2747 // Get rid of forced awareness
2748 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2749 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2750
2751 // Get rid of persistance
2752 flags = AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!;
2753 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2754
2755 // Set to barely aware
2756 float awareness = AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!;
2757 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AWARENESScxx . . $ `scripts/osiris_common.h:555:9`!, &awareness);
2758
2759 // No movement allowed
2760 movement_type = MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!;
2761 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2762
2763 // Set FOV to nearly 0
2764 // float sleep_fov = 1.0f;
2765 // AI_Value(me, VF_SET, AIV_F_FOV, &sleep_fov);
2766
2767 // Make sure squad broken flag isn't set
2768 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2769
2770 // If just landed, set it to the pending landed mode, and play looping idle anim
2771 if (mode == ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`!) {
2772 mode = memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode.;
2773 if (!IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(mode)) {
2774 mode = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
2775 }
2776
2777 // Play his landed animation
2778 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 1, 10, 1, 0, -1, -1);
2779 }
2780 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
2781 memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode. = ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!;
2782
2783 // Set landed speed
2784 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, 0.0f);
2785
2786 // Set the next activity time
2787 if (mode == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!) {
2788 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 3.0f + 2.0f;
2789 memorycxx . . $ AlienOrganism#memory.->ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit. = true;
2790 } else {
2791 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`!;
2792 }
2793
2794 // Clear the next wander time
2795 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
2796 } break;
2797
2798 case ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!: {
2799 // mprintf(0,"Hunting mode set.\n");
2800
2801 // If currently landed, set take off velocity
2802 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2803
2804 // Turn on friend avoidance
2805 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2806 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2807
2808 // Only avoid friends alot if not in a squad
2809 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. == 0) {
2810 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
2811 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2812 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2813 } else {
2814 float avoid_dist = ALIEN_SQUAD_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:715:9`!;
2815 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2816 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance. * ALIEN_SQUAD_CIRC_DIST_MODcxx . . $ `scripts/AIGame3.cpp:718:9`!);
2817 }
2818
2819 // Make it aware
2820 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2821 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2822
2823 // Clear wall point collision and axes lock
2824 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
2825 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2826
2827 // Set movement type back to physics for flying around
2828 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2829 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2830
2831 // Make sure squad broken flag isn't set
2832 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2833
2834 // Only set goals if not currently in squad formation
2835 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!)) {
2836 SetWanderGoalcxx . . $ AlienOrganism#SetWanderGoal(d4f767463ce0a6b3).(me);
2837 }
2838
2839 // Set previous mode so alien can return to this if it needs to
2840 memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode. = ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!;
2841
2842 // Set returning home speed
2843 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_HUNT_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:735:9`!);
2844
2845 // Set the next activity check to happen within .4 to .8 seconds
2846 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = 0.0f;
2847
2848 // Set the max time to wander between 20 and 40 seconds
2849 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 20.0f + 40.0f;
2850 } break;
2851
2852 case ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!: {
2853 // mprintf(0,"Scavenge mode set.\n");
2854
2855 // If currently landed, set take off velocity
2856 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2857
2858 // Turn on friend avoidance
2859 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2860 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2861
2862 // Only avoid friends alot if not in a squad
2863 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. == 0) {
2864 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
2865 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2866 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2867 } else {
2868 float avoid_dist = ALIEN_SQUAD_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:715:9`!;
2869 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2870 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance. * ALIEN_SQUAD_CIRC_DIST_MODcxx . . $ `scripts/AIGame3.cpp:718:9`!);
2871 }
2872
2873 // Make it aware
2874 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2875 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2876
2877 // Clear wall point collision and axes lock
2878 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
2879 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2880
2881 // Set movement type back to physics for flying around
2882 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2883 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2884
2885 // Make sure squad broken flag isn't set
2886 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2887
2888 // Only set goals if not currently in squad formation
2889 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!)) {
2890 SetWanderGoalcxx . . $ AlienOrganism#SetWanderGoal(d4f767463ce0a6b3).(me);
2891 }
2892
2893 // Set previous mode so alien can return to this if it needs to
2894 memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode. = ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!;
2895
2896 // Set returning home speed
2897 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_SCAV_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:736:9`!);
2898
2899 // Set the next activity check to happen within .4 to .8 seconds
2900 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 3.0f + 3.0f;
2901
2902 // Set the max time to wander between 20 and 40 seconds
2903 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 10.0f + 10.0f;
2904 } break;
2905
2906 case ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!: {
2907 // mprintf(0,"Melee mode set.\n");
2908
2909 // If currently landed, set take off velocity
2910 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2911
2912 // Turn on friend avoidance
2913 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2914 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2915
2916 // Only avoid friends alot if not in a squad or if in a broken squad
2917 if ((memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. == 0) || (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)) {
2918 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
2919 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2920 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2921 } else {
2922 float avoid_dist = ALIEN_SQUAD_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:715:9`!;
2923 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2924 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance. * ALIEN_SQUAD_CIRC_DIST_MODcxx . . $ `scripts/AIGame3.cpp:718:9`!);
2925 }
2926
2927 // Make it aware
2928 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2929 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2930
2931 // Clear wall point collision and axes lock
2932 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
2933 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2934
2935 // Set movement type back to physics for flying around
2936 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2937 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2938
2939 // Only set goals if not currently in squad formation
2940 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) || (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)) {
2941 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!);
2942 }
2943
2944 // Set Engage and Attack Speeds
2945 if ((memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. == 0) || (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)) {
2946 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:732:9`!);
2947 } else {
2948 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_ENGAGE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:731:9`!);
2949 }
2950
2951 // Clear the next activity time
2952 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.5f + 0.7f;
2953
2954 // Clear the next wander time
2955 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
2956 } break;
2957
2958 case ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`!: {
2959 // mprintf(0,"Ranged mode set.\n");
2960
2961 // If currently landed, set take off velocity
2962 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
2963
2964 // Turn on friend avoidance
2965 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
2966 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2967
2968 // Set friend avoidance distance
2969 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
2970 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
2971 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
2972
2973 // Make it aware
2974 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
2975 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2976
2977 // Clear wall point collision and axes lock
2978 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
2979 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
2980
2981 // Set movement type back to physics for flying around
2982 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
2983 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
2984
2985 // Make sure squad broken flag isn't set
2986 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
2987
2988 // Enable ranged firing
2989 flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
2990 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
2991
2992 // Only set goals if not currently in squad formation
2993 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
2994
2995 // Set Engage and Attack Speeds
2996 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:732:9`!);
2997
2998 // Clear the next activity time
2999 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = 0.0f;
3000
3001 // Clear the next wander time
3002 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
3003 } break;
3004
3005 case ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`!: {
3006 // mprintf(0,"Fleeing mode set.\n");
3007
3008 // If currently landed, set take off velocity
3009 DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
3010
3011 // avoid friends while fleeing
3012 flags = AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!;
3013 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
3014
3015 // Set friend avoidance distance
3016 float avoid_dist = ALIEN_NORMAL_AVOID_DISTcxx . . $ `scripts/AIGame3.cpp:714:9`!;
3017 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_AVOID_FRIENDS_DISTcxx . . $ `scripts/osiris_common.h:538:9`!, &avoid_dist);
3018 SetCircleDistcxx . . $ AlienOrganism#SetCircleDist(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
3019
3020 // Make it aware
3021 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
3022 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
3023
3024 // Clear wall point collision and axes lock
3025 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
3026 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
3027
3028 // Set movement type back to physics for flying around
3029 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
3030 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
3031
3032 // Make sure squad broken flag isn't set
3033 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
3034
3035 // Set Goal to go somewhere else
3036 SetWanderGoalcxx . . $ AlienOrganism#SetWanderGoal(d4f767463ce0a6b3).(me);
3037
3038 // Set Fleeing Speed
3039 SetMaxSpeedcxx . . $ AlienOrganism#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed. * ALIEN_FLEE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:737:9`!);
3040
3041 // Clear the next activity time
3042 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = 0.0f;
3043
3044 // Set the max time to flee (base time somewhat off of damage)
3045 float curr_shields, percent_damaged;
3046 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &curr_shields);
3047 percent_damaged = (memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields. - curr_shields) / memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields.;
3048
3049 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 3.0f + 3.0f + (percent_damaged * 6.0f);
3050 } break;
3051
3052 default:
3053 mprintfcxx . . $ mprintf.(0, "AlienOrganism is all messed up!\n");
3054 }
3055
3056 // If following leader in formation and mode supports squads, assign follow goals
3057 if ((memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) && !(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!) &&
3058 ModeSupportsSquadMovementcxx . . $ AlienOrganism#ModeSupportsSquadMovement(83c267b20bac841a).(mode)) {
3059 SetSquadieFormationGoalcxx . . $ AlienOrganism#SetSquadieFormationGoal(d4f767463ce0a6b3).(me);
3060 }
3061
3062 // Reset the landing flags
3063 memorycxx . . $ AlienOrganism#memory.->done_movingcxx . . $ alienorganism_data#done_moving. = false;
3064 memorycxx . . $ AlienOrganism#memory.->done_turningcxx . . $ alienorganism_data#done_turning. = false;
3065
3066 // Set the current mode and reset the mode time
3067 memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. = mode;
3068 memorycxx . . $ AlienOrganism#memory.->mode_timecxx . . $ alienorganism_data#mode_time. = 0.0f;
3069 }
3070
3071 // Handles alien takeoffs
3072 void AlienOrganismcxx . . $ AlienOrganism#::DoTakeoffcxx . . $ AlienOrganism#DoTakeoff(3b3943b4e4191a93).(int me, float takeoff_speed, float speed_variance) {
3073 // If currently landed, set take off velocity
3074 if (IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.)) {
3075 vectorcxx . . $ vector# vel;
3076
3077 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel);
3078 vel +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec. *cxx . . $ `operator*`(252247219a31502c). (takeoff_speed + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * speed_variance));
3079 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel);
3080
3081 // Play the takeoff anim and tell it to go to alert next
3082 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 10, 31, 1, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
3083
3084 // Reset the takeoff time
3085 memorycxx . . $ AlienOrganism#memory.->takeoff_timecxx . . $ alienorganism_data#takeoff_time. = 0.0f;
3086 }
3087 }
3088
3089 // Processes the AI Initialize event
3090 void AlienOrganismcxx . . $ AlienOrganism#::DoInitcxx . . $ AlienOrganism#DoInit(d4f767463ce0a6b3).(int me) {
3091 int flags;
3092 msafe_structcxx . . $ msafe_struct# m;
3093 m.objhandlecxx . . $ msafe_struct#objhandle. = me;
3094
3095 // Setup memory data
3096 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
3097 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = ALIEN_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:641:9`!;
3098 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(alienorganism_datacxx . . $ alienorganism_data#);
3099 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
3100 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
3101
3102 memorycxx . . $ AlienOrganism#memory. = (alienorganism_datacxx . . $ alienorganism_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
3103
3104 // Init base values
3105 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ AlienOrganism#memory.->base_speedcxx . . $ alienorganism_data#base_speed.);
3106 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:512:9`!, &memorycxx . . $ AlienOrganism#memory.->base_circle_distancecxx . . $ alienorganism_data#base_circle_distance.);
3107 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields.);
3108
3109 // Init energy charge
3110 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. = 0.0f;
3111 memorycxx . . $ AlienOrganism#memory.->ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit. = true;
3112
3113 // All beams off initially
3114 memorycxx . . $ AlienOrganism#memory.->enabled_beamscxx . . $ alienorganism_data#enabled_beams. = 0;
3115
3116 // Clear the destination object handle
3117 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
3118
3119 // Alien hasn't been hit by player yet
3120 memorycxx . . $ AlienOrganism#memory.->hit_by_playercxx . . $ alienorganism_data#hit_by_player. = false;
3121
3122 // Alien hasn't taken off yet
3123 memorycxx . . $ AlienOrganism#memory.->takeoff_timecxx . . $ alienorganism_data#takeoff_time. = ALIEN_MAX_TAKEOFF_TIMEcxx . . $ `scripts/AIGame3.cpp:654:9`!;
3124
3125 // Setup Squad Information
3126 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
3127 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
3128 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
3129
3130 // .1 to 1.1 seconds into the level, do the first squad matching
3131 memorycxx . . $ AlienOrganism#memory.->next_update_squad_timecxx . . $ alienorganism_data#next_update_squad_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f + 0.1f;
3132
3133 // Update the energy effect as soon as charge exists
3134 memorycxx . . $ AlienOrganism#memory.->next_update_energy_timecxx . . $ alienorganism_data#next_update_energy_time. = Game_GetTimecxx . . $ Game_GetTime.();
3135 memorycxx . . $ AlienOrganism#memory.->next_update_beam_timecxx . . $ alienorganism_data#next_update_beam_time. = Game_GetTimecxx . . $ Game_GetTime.();
3136
3137 // Update the squadie catchup speed as soon as possible
3138 memorycxx . . $ AlienOrganism#memory.->next_squadie_update_timecxx . . $ alienorganism_data#next_squadie_update_time. = Game_GetTimecxx . . $ Game_GetTime.();
3139
3140 // Do special damage as soon as relevant
3141 memorycxx . . $ AlienOrganism#memory.->next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.();
3142
3143 // Set the next generic check time
3144 memorycxx . . $ AlienOrganism#memory.->next_generic_check_timecxx . . $ alienorganism_data#next_generic_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.0f + 0.5f;
3145 memorycxx . . $ AlienOrganism#memory.->next_vis_check_timecxx . . $ alienorganism_data#next_vis_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f + 1.0f;
3146
3147 // Init other times
3148 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.();
3149 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = 0.0f;
3150
3151 // Store Home Information
3152 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos.);
3153 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room.);
3154
3155 matrixcxx . . $ matrix# orient;
3156 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
3157 memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). orient.fveccxx . . $ matrix#fvec.;
3158 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec.);
3159 memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). orient.uveccxx . . $ matrix#uvec.;
3160 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec.);
3161
3162 // Check and see whether we've been spawned from a matcen or not
3163 bool spawned_from_matcen = false;
3164 char type;
3165 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
3166 if (type == AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!) {
3167 mprintfcxx . . $ mprintf.(0, "Alien organism produced by matcen.\n");
3168 // Note that we came from a matcen
3169 spawned_from_matcen = true;
3170
3171 // Find a new home
3172 FindHomecxx . . $ AlienOrganism#FindHome(83c267b20bac841a).(me);
3173 }
3174
3175 // Init squadie goal positions
3176 memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos.;
3177 memorycxx . . $ AlienOrganism#memory.->squad_goal_roomcxx . . $ alienorganism_data#squad_goal_room. = memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room.;
3178
3179 // Create and setup the energy effect props
3180 msafe_structcxx . . $ msafe_struct# mstruct;
3181
3182 memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle. = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, powerup_idcxx . . $ powerup_id., memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room., &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
3183 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
3184 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
3185
3186 memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle. = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, powerup_idcxx . . $ powerup_id., memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room., &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
3187 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
3188 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
3189
3190 memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle. = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, powerup_idcxx . . $ powerup_id., memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room., &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
3191 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
3192 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
3193
3194 // Set starting mode
3195 if (spawned_from_matcen) {
3196 // Set our starting mode to landed-resting
3197 memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode. = ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!;
3198 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3199 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!);
3200 } else {
3201 // Set our starting mode to landed-resting
3202 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3203 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`!);
3204 }
3205 }
3206
3207 // Tries to find a home for an alien (returns false if this fails)
3208 #define MAX_HOME_FINDING_ATTEMPTScxx . . $ `scripts/AIGame3.cpp:3208:9`! 20
3209 #define MAX_HOME_FINDING_DISTcxx . . $ `scripts/AIGame3.cpp:3209:9`! 1000
3210 #define HOME_LOOK_OFFSETcxx . . $ `scripts/AIGame3.cpp:3210:9`! 0.18f // for a 40 degree search pyramid
3211 #define HOME_PLACE_DISTANCEcxx . . $ `scripts/AIGame3.cpp:3211:9`! 1.0f
3212 bool AlienOrganismcxx . . $ AlienOrganism#::FindHomecxx . . $ AlienOrganism#FindHome(83c267b20bac841a).(int me) {
3213 int num_attempts;
3214 bool home_found;
3215 vectorcxx . . $ vector# start_pos, target_pos, landed_pos, home_dir;
3216 int start_room, landed_room;
3217 matrixcxx . . $ matrix# start_orient;
3218 int flags, fate;
3219 ray_infocxx . . $ ray_info# ray;
3220 float size;
3221
3222 // Find start point
3223 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
3224 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
3225 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &start_orient);
3226 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SIZEcxx . . $ `scripts/osiris_common.h:636:9`!, &size);
3227
3228 home_found = false;
3229 num_attempts = 0;
3230 while (!home_found && num_attempts < MAX_HOME_FINDING_ATTEMPTScxx . . $ `scripts/AIGame3.cpp:3208:9`!) {
3231 // Determine ray angle
3232 home_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). start_orient.fveccxx . . $ matrix#fvec.;
3233 home_dir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). start_orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). (HOME_LOOK_OFFSETcxx . . $ `scripts/AIGame3.cpp:3210:9`! - ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f * HOME_LOOK_OFFSETcxx . . $ `scripts/AIGame3.cpp:3210:9`!);
3234 home_dir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). start_orient.rveccxx . . $ matrix#rvec. *cxx . . $ `operator*`(252247219a31502c). (HOME_LOOK_OFFSETcxx . . $ `scripts/AIGame3.cpp:3210:9`! - ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f * HOME_LOOK_OFFSETcxx . . $ `scripts/AIGame3.cpp:3210:9`!);
3235
3236 // Cast home-finding ray
3237 target_pos =cxx . . $ vector#`operator=`(c0842353a20857d). start_pos +cxx . . $ operator+(b77b703cd1e43e33). (home_dir *cxx . . $ `operator*`(252247219a31502c). MAX_HOME_FINDING_DISTcxx . . $ `scripts/AIGame3.cpp:3209:9`!);
3238 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`! |
3239 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
3240 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &start_pos, &target_pos, start_room, size, flags, &ray);
3241
3242 // Check if it hit a face
3243 if (fate == HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`!) {
3244 matrixcxx . . $ matrix# temp;
3245
3246 memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_face_pntcxx . . $ ray_info#hit_face_pnt.;
3247 memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room. = ray.hit_face_roomcxx . . $ ray_info#hit_face_room.;
3248 memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_wallnormcxx . . $ ray_info#hit_wallnorm.;
3249
3250 vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&temp, &memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3251 if (randcxx . . $ rand(9efc7249d839d30e).() % 100 > 50) {
3252 memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). temp.uveccxx . . $ matrix#uvec.;
3253 } else {
3254 memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). temp.rveccxx . . $ matrix#rvec.;
3255 }
3256 if (randcxx . . $ rand(9efc7249d839d30e).() % 100 > 50)
3257 memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec. =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec.;
3258
3259 // Place the object a little away from the wall
3260 target_pos =cxx . . $ vector#`operator=`(c0842353a20857d). memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos. +cxx . . $ operator+(b77b703cd1e43e33). (memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec. *cxx . . $ `operator*`(252247219a31502c). HOME_PLACE_DISTANCEcxx . . $ `scripts/AIGame3.cpp:3211:9`!);
3261 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`! |
3262 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
3263 FVI_RayCastcxx . . $ FVI_RayCast.(me, &memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos., &target_pos, memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room., 0.0f, flags, &ray);
3264
3265 memorycxx . . $ AlienOrganism#memory.->home_poscxx . . $ alienorganism_data#home_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
3266 memorycxx . . $ AlienOrganism#memory.->home_roomcxx . . $ alienorganism_data#home_room. = ray.hit_roomcxx . . $ ray_info#hit_room.;
3267
3268 home_found = true;
3269 }
3270
3271 num_attempts++;
3272 }
3273
3274 return home_found;
3275 }
3276
3277 void AlienOrganismcxx . . $ AlienOrganism#::DoSquadieFramecxx . . $ AlienOrganism#DoSquadieFrame(d4f767463ce0a6b3).(int me) {
3278 vectorcxx . . $ vector# my_pos;
3279 int type;
3280
3281 // Check if the leader is still alive
3282 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
3283 if (type == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
3284 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. = 0;
3285 memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
3286 memorycxx . . $ AlienOrganism#memory.->num_teammatescxx . . $ alienorganism_data#num_teammates. = 0;
3287
3288 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
3289 return;
3290 }
3291
3292 // If current mode disallows formation following, get outta here
3293 if (!ModeSupportsSquadMovementcxx . . $ AlienOrganism#ModeSupportsSquadMovement(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.))
3294 return;
3295
3296 // If squad is currently broken, get outta here
3297 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)
3298 return;
3299
3300 // The leader is alive, so set new goal pos
3301 UpdateSquadieFormationGoalcxx . . $ AlienOrganism#UpdateSquadieFormationGoal(d4f767463ce0a6b3).(me);
3302
3303 // Check if it's time to update the catchup speed
3304 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_squadie_update_timecxx . . $ alienorganism_data#next_squadie_update_time.) {
3305 memorycxx . . $ AlienOrganism#memory.->next_squadie_update_timecxx . . $ alienorganism_data#next_squadie_update_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_SQUADIE_INTERVALcxx . . $ `scripts/AIGame3.cpp:740:9`!;
3306
3307 // Get the distance to leader
3308 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
3309 float dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&my_pos, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
3310
3311 // If squadie is in leader's path, slow down until leader passes
3312 float slowdown = 1.0f;
3313 if (dist <= ALIEN_APPROACH_DISTcxx . . $ `scripts/AIGame3.cpp:697:9`!) {
3314 matrixcxx . . $ matrix# leader_orient;
3315 vectorcxx . . $ vector# dir, leader_pos;
3316
3317 // See if we are in front of leader
3318 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &leader_orient);
3319 dir =cxx . . $ vector#`operator=`(c0842353a20857d). my_pos -cxx . . $ operator-(b77b703cd1e43e33). memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.;
3320 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&dir);
3321 float dot_prod;
3322 if ((dot_prod = leader_orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). dir) < 0.0f) {
3323 slowdown = dist / ALIEN_APPROACH_DISTcxx . . $ `scripts/AIGame3.cpp:697:9`!;
3324 }
3325 }
3326
3327 // If squadie is falling behind, let him speed up so he can catch up to the squad
3328 if (dist <= ALIEN_CATCHUP_DISTcxx . . $ `scripts/AIGame3.cpp:696:9`!) {
3329 float catchup_speed;
3330 AI_Valuecxx . . $ AI_Value.(memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &catchup_speed);
3331
3332 float scaled_speed = dist / ALIEN_CATCHUP_DISTcxx . . $ `scripts/AIGame3.cpp:696:9`! * ALIEN_CATCHUP_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:739:9`! * catchup_speed;
3333 catchup_speed += scaled_speed;
3334 catchup_speed *= slowdown;
3335
3336 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &catchup_speed);
3337 } else if (dist > ALIEN_CATCHUP_DISTcxx . . $ `scripts/AIGame3.cpp:696:9`!) {
3338 float catchup_speed;
3339 AI_Valuecxx . . $ AI_Value.(memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &catchup_speed);
3340
3341 float scaled_speed = ALIEN_CATCHUP_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:739:9`! * catchup_speed;
3342 catchup_speed += scaled_speed;
3343 catchup_speed *= slowdown;
3344
3345 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &catchup_speed);
3346 }
3347 }
3348 }
3349
3350 // Processes the AI Frame Interval Event
3351 void AlienOrganismcxx . . $ AlienOrganism#::DoFramecxx . . $ AlienOrganism#DoFrame(d4f767463ce0a6b3).(int me) {
3352 vectorcxx . . $ vector# uvec;
3353 int flags;
3354 float anim_frame;
3355 int new_mode;
3356 vectorcxx . . $ vector# vel;
3357 float last_see_time, last_see_game_time;
3358 float last_hear_time, last_hear_game_time;
3359 float last_perceive_time;
3360
3361 /*
3362 float shields;
3363 Obj_Value(me, VF_GET, OBJV_F_SHIELDS, &shields);
3364 mprintf(0,"Shields: %.2f\n",shields);
3365 */
3366
3367 // Get the last see and hear time
3368 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_SEE_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:530:9`!, &last_see_game_time);
3369 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_HEAR_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:558:9`!, &last_hear_game_time);
3370
3371 // Calculate the time since target was seen and heard
3372 last_hear_time = Game_GetTimecxx . . $ Game_GetTime.() - last_hear_game_time;
3373 last_see_time = Game_GetTimecxx . . $ Game_GetTime.() - last_see_game_time;
3374
3375 // Perceive time is last time target was seen or heard (whichever is smalled)
3376 if (last_hear_time <= last_see_time) {
3377 last_perceive_time = last_hear_time;
3378 } else {
3379 last_perceive_time = last_see_time;
3380 }
3381
3382 // Check if takeoff time is active
3383 if (memorycxx . . $ AlienOrganism#memory.->takeoff_timecxx . . $ alienorganism_data#takeoff_time. < ALIEN_MAX_TAKEOFF_TIMEcxx . . $ `scripts/AIGame3.cpp:654:9`!) {
3384 memorycxx . . $ AlienOrganism#memory.->takeoff_timecxx . . $ alienorganism_data#takeoff_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
3385
3386 // If the time is up, clear the landing lock flags
3387 if (memorycxx . . $ AlienOrganism#memory.->takeoff_timecxx . . $ alienorganism_data#takeoff_time. >= ALIEN_MAX_TAKEOFF_TIMEcxx . . $ `scripts/AIGame3.cpp:654:9`!) {
3388 // Make sure we're in a mode that wants these flags cleared
3389 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`! && !IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.)) {
3390 // Clear wall point collision and axes lock
3391 flags = PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`! | PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
3392 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
3393
3394 // Turn on dodging
3395 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
3396 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
3397
3398 // enable auto-leveling
3399 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
3400 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
3401
3402 // mprintf(0,"Alien landing flags cleared...\n");
3403 }
3404 }
3405 }
3406
3407 // If alien was hit by player, take action if necessary
3408 if (memorycxx . . $ AlienOrganism#memory.->hit_by_playercxx . . $ alienorganism_data#hit_by_player.) {
3409 // See if the mode we're in is sensitive to attacks
3410 if (ModeIsAttackSensitivecxx . . $ AlienOrganism#ModeIsAttackSensitive(cf9ef193275fa6d8).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode., memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode.)) {
3411 // mprintf(0,"Sensitive to Attack!\n");
3412 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
3413 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_I_WAS_HITcxx . . $ `scripts/AIGame3.cpp:690:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3414 } else {
3415 MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(me);
3416 }
3417 }
3418
3419 // reset the hit by player flag
3420 memorycxx . . $ AlienOrganism#memory.->hit_by_playercxx . . $ alienorganism_data#hit_by_player. = false;
3421 }
3422
3423 // Periodically update the squad information (remove dead teammates and/or recruit new ones)
3424 if (memorycxx . . $ AlienOrganism#memory.->next_update_squad_timecxx . . $ alienorganism_data#next_update_squad_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
3425 memorycxx . . $ AlienOrganism#memory.->next_update_squad_timecxx . . $ alienorganism_data#next_update_squad_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 3.0f + 3.0f;
3426 UpdateSquadcxx . . $ AlienOrganism#UpdateSquad(d4f767463ce0a6b3).(me);
3427 }
3428
3429 // Periodically update the squad visibility information
3430 if (memorycxx . . $ AlienOrganism#memory.->next_vis_check_timecxx . . $ alienorganism_data#next_vis_check_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
3431 memorycxx . . $ AlienOrganism#memory.->next_vis_check_timecxx . . $ alienorganism_data#next_vis_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.0f + 1.0f;
3432
3433 // If we're leading, update the squad's visibility flags
3434 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3435 UpdateSquadVisibilitycxx . . $ AlienOrganism#UpdateSquadVisibility(d4f767463ce0a6b3).(me);
3436 }
3437 }
3438
3439 // Update squadies
3440 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
3441 DoSquadieFramecxx . . $ AlienOrganism#DoSquadieFrame(d4f767463ce0a6b3).(me);
3442 }
3443
3444 // Get the current animation frame
3445 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &anim_frame);
3446
3447 // Handle generic checks (pertains to more than 1 mode)
3448 if (memorycxx . . $ AlienOrganism#memory.->next_generic_check_timecxx . . $ alienorganism_data#next_generic_check_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
3449 memorycxx . . $ AlienOrganism#memory.->next_generic_check_timecxx . . $ alienorganism_data#next_generic_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.4f + 0.6f;
3450
3451 // If we're not already landed, or heading home to heal, see if we should
3452 if (!IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.) && memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`! &&
3453 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!) {
3454 float current_shields;
3455 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &current_shields);
3456
3457 // If we're pretty heavily damaged, see if we should return home to heal
3458 if ((current_shields < memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields. * ALIEN_HEAL_PERCENTAGEcxx . . $ `scripts/AIGame3.cpp:648:9`!) && (randcxx . . $ rand(9efc7249d839d30e).() % 100 < 80)) {
3459 Healcxx . . $ AlienOrganism#Heal(83c267b20bac841a).(me);
3460 }
3461 }
3462
3463 // If we're not already fleeing or going home to heal, check to see if we should flee
3464 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`! && memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`! &&
3465 memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`! && memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. != ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!) {
3466 if (IsOnFirecxx . . $ AlienOrganism#IsOnFire(83c267b20bac841a).(me)) {
3467 // If we're on fire, there's a good chance that we will try to flee
3468 if ((randcxx . . $ rand(9efc7249d839d30e).() % 100) < ALIEN_ON_FIRE_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:662:9`!)
3469 Fleecxx . . $ AlienOrganism#Flee(9609253e83e89946).(me);
3470 } else if (IsNearFirecxx . . $ AlienOrganism#IsNearFire(83c267b20bac841a).(me)) {
3471 // If we're near fire, there's a chance that we will try to flee
3472 if ((randcxx . . $ rand(9efc7249d839d30e).() % 100) < ALIEN_NEAR_FIRE_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:663:9`!)
3473 Fleecxx . . $ AlienOrganism#Flee(9609253e83e89946).(me);
3474 }
3475 }
3476
3477 // If we're landed, see if we want to play the landed animation
3478 if (IsLandedModecxx . . $ AlienOrganism#IsLandedMode(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.) && anim_frame == 10 && (randcxx . . $ rand(9efc7249d839d30e).() % 100) < 15) {
3479 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 1, 10, 1, 0, -1, -1);
3480 }
3481 }
3482
3483 // Handle mode specific operations
3484 switch (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.) {
3485 case ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!: {
3486 // See if it should consider doing something spontaneously
3487 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time.) {
3488 // Set the next time to think about doing something (4-6 seconds)
3489 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.0f + 0.5f;
3490
3491 // If alien has a target, decide whether it should go hunt it down
3492 if (last_perceive_time < 3.0f) {
3493 int target_handle;
3494 int die_roll = 0;
3495
3496 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
3497 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
3498 die_roll = (randcxx . . $ rand(9efc7249d839d30e).() % 90) + 1;
3499
3500 float dist;
3501 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
3502
3503 // Adjust the random value by distance to target
3504 // (ie the closer the target, the more likely it will be attacked)
3505 if (dist > 300.0f)
3506 die_roll -= 50;
3507 else if (dist > 200.0f)
3508 die_roll -= 45;
3509 else if (dist > 100.0f)
3510 die_roll -= 40;
3511 else if (dist > 70.0f)
3512 die_roll -= 30;
3513 else if (dist > 50.0f)
3514 die_roll -= 20;
3515 else if (dist > 25.0f)
3516 die_roll += 5;
3517 else
3518 die_roll += 50;
3519
3520 // Grant bonuses for recent seeing and hearing
3521 if (last_see_time < 3.0)
3522 die_roll += 5;
3523
3524 if (last_hear_time < 4.0f)
3525 die_roll += 50;
3526
3527 // mprintf(0,"hear: %.1f, see: %.1f, perceive: %.1f\n",last_hear_time,last_see_time,last_perceive_time);
3528 // mprintf(0,"Doing check...%d - %.1f\n",die_roll,dist);
3529 }
3530
3531 if (die_roll > 70) {
3532 // If we're a squadie, lie and tell the leader we got hit (so he orders the attack)
3533 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
3534 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_I_WAS_HITcxx . . $ `scripts/AIGame3.cpp:690:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3535 } else {
3536 if (MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(me))
3537 break;
3538 }
3539 }
3540 }
3541
3542 // If we currently have any charges, go ahead and deposit them
3543 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. > 0.0f) {
3544 // If we're a squadie, tell the leader we are leaving
3545 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) {
3546 LeaveLeadercxx . . $ AlienOrganism#LeaveLeader(83c267b20bac841a).(me);
3547 }
3548
3549 // If we're a leader, disperse the squad
3550 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3551 DisperseSquadcxx . . $ AlienOrganism#DisperseSquad(d4f767463ce0a6b3).(me);
3552 }
3553
3554 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!);
3555 break;
3556 }
3557
3558 /*
3559 // Only think if it's not a squadie (its leader will decide when/whether to do something)
3560 if(!(memory->squad_flags & ALIEN_SQUADIE))
3561 {
3562 int die_roll = (rand()%100) + 1;
3563
3564 // See what to do
3565 if(die_roll <= 20) // Go hunting
3566 {
3567 // Start hunting
3568 SetMode(me, ALIEN_HUNTING);
3569
3570 // If it's a leader, order squad to switch to hunting mode
3571 if(memory->squad_flags & ALIEN_LEADER) {
3572 int mode=ALIEN_HUNTING;
3573 IssueSquadOrder(me, ALIEN_COM_SET_MODE, &mode);
3574 }
3575 }
3576 else if(die_roll <= 30) // Go scavenging
3577 {
3578 // Start scavenging
3579 SetMode(me, ALIEN_SCAVENGING);
3580
3581 // If it's a leader, order squad to switch to scavenging mode
3582 if(memory->squad_flags & ALIEN_LEADER) {
3583 int mode=ALIEN_SCAVENGING;
3584 IssueSquadOrder(me, ALIEN_COM_SET_MODE, &mode);
3585 }
3586 }
3587 }
3588 */
3589 }
3590 } break;
3591
3592 case ALIEN_LANDED_HEALINGcxx . . $ `scripts/AIGame3.cpp:622:9`!: {
3593 // See if we should do a round of healing
3594 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time.) {
3595 // Set the next time to do something
3596 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`!;
3597
3598 // Restore some shields
3599 float current_shields;
3600 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &current_shields);
3601 current_shields += (memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields. * 0.2f);
3602
3603 bool done_healing = false;
3604 if (current_shields >= memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields.) {
3605 current_shields = memorycxx . . $ AlienOrganism#memory.->base_shieldscxx . . $ alienorganism_data#base_shields.;
3606 done_healing = true;
3607 }
3608
3609 // Set the current shields
3610 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &current_shields);
3611 // mprintf(0,"Healing...\n");
3612
3613 // If we're all healed up, go to landed resting
3614 if (done_healing) {
3615 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!);
3616 // mprintf(0,"Done healing.\n");
3617 }
3618 }
3619
3620 // Handle the energy beam effects
3621 if (!memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on.)
3622 CalcEnergyBeamPositionscxx . . $ AlienOrganism#CalcEnergyBeamPositions(d4f767463ce0a6b3).(me);
3623 UpdateEnergyBeamscxx . . $ AlienOrganism#UpdateEnergyBeams(d4f767463ce0a6b3).(me);
3624 } break;
3625
3626 case ALIEN_LANDED_DEPOSITINGcxx . . $ `scripts/AIGame3.cpp:623:9`!: {
3627 // See if we should do a round of energy depositing
3628 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time.) {
3629 // Set the next time to do something
3630 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`!;
3631
3632 // Deposit some charges
3633 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. -= (ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`! * 0.25f);
3634
3635 bool done_depositing = false;
3636 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. <= 0.0f) {
3637 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. = 0.0f;
3638 done_depositing = true;
3639 }
3640
3641 // mprintf(0,"Depositing...\n");
3642
3643 // If we're all healed up, go to landed resting
3644 if (done_depositing) {
3645 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!);
3646 // mprintf(0,"Done depositing.\n");
3647 }
3648 }
3649
3650 // Handle the energy beam effects
3651 if (!memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on.)
3652 CalcEnergyBeamPositionscxx . . $ AlienOrganism#CalcEnergyBeamPositions(d4f767463ce0a6b3).(me);
3653 UpdateEnergyBeamscxx . . $ AlienOrganism#UpdateEnergyBeams(d4f767463ce0a6b3).(me);
3654 } break;
3655
3656 case ALIEN_LANDED_WITHDRAWINGcxx . . $ `scripts/AIGame3.cpp:624:9`!: {
3657 // See if we should do a round of energy withdrawing
3658 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time.) {
3659 // Set the next time to do something
3660 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`!;
3661
3662 // Deposit some charges
3663 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. += (ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`! * 0.25f);
3664
3665 bool done_withdrawing = false;
3666 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. >= ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!) {
3667 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. = ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!;
3668 done_withdrawing = true;
3669 }
3670
3671 // mprintf(0,"Withdrawing...\n");
3672
3673 // If we're all healed up, go to melee mode
3674 if (done_withdrawing) {
3675 memorycxx . . $ AlienOrganism#memory.->ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit. = false;
3676 memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode. = ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!;
3677 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3678 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!);
3679 // mprintf(0,"Done withdrawing.\n");
3680 }
3681 }
3682
3683 // Handle the energy beam effects
3684 if (!memorycxx . . $ AlienOrganism#memory.->energy_beams_oncxx . . $ alienorganism_data#energy_beams_on.)
3685 CalcEnergyBeamPositionscxx . . $ AlienOrganism#CalcEnergyBeamPositions(d4f767463ce0a6b3).(me);
3686 UpdateEnergyBeamscxx . . $ AlienOrganism#UpdateEnergyBeams(d4f767463ce0a6b3).(me);
3687 } break;
3688
3689 case ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`!: {
3690 // mprintf(0, "AlienOrganism Landed at Home\n");
3691 if (memorycxx . . $ AlienOrganism#memory.->done_turningcxx . . $ alienorganism_data#done_turning. == true && memorycxx . . $ AlienOrganism#memory.->done_movingcxx . . $ alienorganism_data#done_moving. == true) {
3692 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDEDcxx . . $ `scripts/AIGame3.cpp:620:9`!);
3693 }
3694 } break;
3695
3696 case ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!: {
3697 char type, next_type;
3698
3699 // If we're simply going home to rest, and a target is present, attack it!
3700 if (memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. == ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`! && last_perceive_time < 3.0f) {
3701 if (MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(me))
3702 break;
3703 }
3704
3705 // mprintf(0, "AlienOrganism going home\n");
3706
3707 // If we're in alert, or the next anim mode is alert, and we're done moving, land at home
3708 if (memorycxx . . $ AlienOrganism#memory.->done_movingcxx . . $ alienorganism_data#done_moving. == true) {
3709 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
3710 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_NEXT_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:521:9`!, &next_type);
3711
3712 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || type == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`! || next_type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || next_type == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) {
3713 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`!);
3714 }
3715 }
3716 } break;
3717
3718 case ALIEN_FLEEINGcxx . . $ `scripts/AIGame3.cpp:628:9`!: {
3719 // See if it is time to stop running
3720 if (memorycxx . . $ AlienOrganism#memory.->mode_timecxx . . $ alienorganism_data#mode_time. >= memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time.) {
3721 // Go back to melee mode for now
3722 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!);
3723 }
3724 } break;
3725
3726 case ALIEN_FINDING_BIRTHPLACEcxx . . $ `scripts/AIGame3.cpp:629:9`!:
3727 break;
3728
3729 case ALIEN_GIVING_BIRTHcxx . . $ `scripts/AIGame3.cpp:630:9`!:
3730 break;
3731
3732 case ALIEN_HUNTINGcxx . . $ `scripts/AIGame3.cpp:632:9`!: {
3733 // If a target has been spotted, attack it
3734 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) && last_perceive_time < 3.0f) {
3735 if (MeleeAttackcxx . . $ AlienOrganism#MeleeAttack(9609253e83e89946).(me))
3736 break;
3737 }
3738
3739 // See if it is time to go home
3740 if (memorycxx . . $ AlienOrganism#memory.->mode_timecxx . . $ alienorganism_data#mode_time. >= memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time.) {
3741 // Set the next max wander time
3742 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 10.0f + 10.0f;
3743
3744 // If not a squadie, decide to go home
3745 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!)) {
3746 // If leading squad, tell squad to go home and rest
3747 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3748 int pending_mode = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3749 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_PENDING_MODEcxx . . $ `scripts/AIGame3.cpp:681:9`!, &pending_mode);
3750
3751 int mode = ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!;
3752 DisperseSquadToModecxx . . $ AlienOrganism#DisperseSquadToMode(3e454b8ccf442868).(me, mode);
3753 }
3754
3755 // Go home and rest
3756 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3757 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!);
3758 break;
3759 }
3760 }
3761 } break;
3762
3763 case ALIEN_SCAVENGINGcxx . . $ `scripts/AIGame3.cpp:633:9`!: {
3764 // See if it is time to go home
3765 if (memorycxx . . $ AlienOrganism#memory.->mode_timecxx . . $ alienorganism_data#mode_time. >= memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time.) {
3766 // Set the next max wander time
3767 memorycxx . . $ AlienOrganism#memory.->max_wander_timecxx . . $ alienorganism_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 10.0f + 10.0f;
3768
3769 // If not a squadie, decide to go home
3770 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!)) {
3771 // If leading squad, tell squad to go home and rest
3772 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3773 int pending_mode = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3774 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_PENDING_MODEcxx . . $ `scripts/AIGame3.cpp:681:9`!, &pending_mode);
3775
3776 int mode = ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!;
3777 DisperseSquadToModecxx . . $ AlienOrganism#DisperseSquadToMode(3e454b8ccf442868).(me, mode);
3778 }
3779
3780 // Go home and rest
3781 memorycxx . . $ AlienOrganism#memory.->pending_modecxx . . $ alienorganism_data#pending_mode. = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3782 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!);
3783 break;
3784 }
3785 }
3786 } break;
3787
3788 case ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!: {
3789 // If a target hasn't been spotted for a while, return to previous task
3790 if (!(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_SQUADIEcxx . . $ `scripts/AIGame3.cpp:704:9`!) && last_perceive_time > 7.0f) {
3791 int mode = memorycxx . . $ AlienOrganism#memory.->previous_modecxx . . $ alienorganism_data#previous_mode.;
3792
3793 // If leading squad, tell squad to return to previous task's mode
3794 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3795 // If leader is going home, disperse the squad
3796 if (mode == ALIEN_GOING_HOMEcxx . . $ `scripts/AIGame3.cpp:627:9`!) {
3797 int pending_mode = ALIEN_LANDED_RESTINGcxx . . $ `scripts/AIGame3.cpp:621:9`!;
3798 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_PENDING_MODEcxx . . $ `scripts/AIGame3.cpp:681:9`!, &pending_mode);
3799 DisperseSquadToModecxx . . $ AlienOrganism#DisperseSquadToMode(3e454b8ccf442868).(me, mode);
3800 } else {
3801 // Otherwise just tell them to switch to the new mode (hunt or scavenge)
3802 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_SET_MODEcxx . . $ `scripts/AIGame3.cpp:680:9`!, &mode);
3803 }
3804 }
3805
3806 // Return to previous mode
3807 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, mode);
3808 break;
3809 }
3810
3811 // If leading, check target distance for grouping orders
3812 if (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_LEADERcxx . . $ `scripts/AIGame3.cpp:703:9`!) {
3813 int target_handle;
3814 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
3815 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
3816 float dist;
3817 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
3818
3819 // See if we need to regroup or break up and attack
3820 if ((dist >= ALIEN_REGROUP_DISTcxx . . $ `scripts/AIGame3.cpp:700:9`!) && (memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)) {
3821 // Tell Squad to regroup
3822 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_REGROUPcxx . . $ `scripts/AIGame3.cpp:679:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3823
3824 // Set up leader for regrouping
3825 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. &= ~ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
3826 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
3827 break;
3828 } else if ((dist <= ALIEN_BREAKUP_DISTcxx . . $ `scripts/AIGame3.cpp:699:9`!) && !(memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. & ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!)) {
3829 // Tell Squad to breakup and attack!
3830 IssueSquadOrdercxx . . $ AlienOrganism#IssueSquadOrder(cc8108ff4e8c6431).(me, ALIEN_COM_BREAK_AND_ATTACKcxx . . $ `scripts/AIGame3.cpp:678:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!);
3831
3832 // Set up leader for regrouping
3833 memorycxx . . $ AlienOrganism#memory.->squad_flagscxx . . $ alienorganism_data#squad_flags. |= ALIEN_BROKENcxx . . $ `scripts/AIGame3.cpp:706:9`!;
3834 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
3835 break;
3836 }
3837 }
3838 }
3839
3840 /*
3841 // If we're a non-broken squadie, and target is closer than leader, break on our own
3842 if(memory->squad_flags & ALIEN_SQUADIE && !(memory->squad_flags & ALIEN_BROKEN))
3843 {
3844 int target_handle;
3845 AI_Value(me, VF_GET, AIV_I_TARGET_HANDLE, &target_handle);
3846 if(target_handle != OBJECT_HANDLE_NONE)
3847 {
3848 }
3849 }
3850 */
3851
3852 // See if we should decide whether to do any charge related activities
3853 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time.) {
3854 // Set the next time to do something
3855 memorycxx . . $ AlienOrganism#memory.->next_activity_timecxx . . $ alienorganism_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.6f + 0.8f;
3856
3857 // If we have some charges, see if we should do something with it
3858 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. > 0.0f) {
3859 int die_roll = randcxx . . $ rand(9efc7249d839d30e).() % 100;
3860 if (die_roll < 70) {
3861 // Switch to ranged mode
3862 RangedAttackcxx . . $ AlienOrganism#RangedAttack(83c267b20bac841a).(me);
3863 break;
3864 } else if (die_roll < 90 && memorycxx . . $ AlienOrganism#memory.->ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit.) {
3865 // Return home and deposit it
3866 Depositcxx . . $ AlienOrganism#Deposit(83c267b20bac841a).(me);
3867 break;
3868 }
3869 } else {
3870 // See if we want to return home and withdrawal some
3871 int die_roll = randcxx . . $ rand(9efc7249d839d30e).() % 1000;
3872 // mprintf(0,"Doing withdrawal check... %d\n",die_roll);
3873 if (die_roll < 5) // 0.5% chance
3874 {
3875 // Possibly factor in a distance to home check here?
3876
3877 Withdrawcxx . . $ AlienOrganism#Withdraw(83c267b20bac841a).(me);
3878 break;
3879 }
3880 }
3881 }
3882 } break;
3883
3884 case ALIEN_ATTACKING_RANGEDcxx . . $ `scripts/AIGame3.cpp:636:9`!: {
3885 // If we've lost target, or if we're out of charges, go back to melee mode
3886 if (last_perceive_time > 6.0f || memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. <= 0.0f) {
3887 // Return to melee mode
3888 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, ALIEN_ATTACKING_MELEEcxx . . $ `scripts/AIGame3.cpp:635:9`!);
3889 break;
3890 }
3891 } break;
3892 }
3893
3894 // Update the energy effect
3895 UpdateEnergyEffectcxx . . $ AlienOrganism#UpdateEnergyEffect(d4f767463ce0a6b3).(me);
3896
3897 // Increment the current mode time
3898 memorycxx . . $ AlienOrganism#memory.->mode_timecxx . . $ alienorganism_data#mode_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
3899
3900 /*
3901 char type, next_type;
3902 AI_Value(me, VF_GET, AIV_C_ANIMATION_TYPE, &type);
3903 AI_Value(me, VF_GET, AIV_C_NEXT_ANIMATION_TYPE, &next_type);
3904 mprintf(0,"Curr anim type: %d, Next anim type: %d\n",type,next_type);
3905 if(next_type==AS_CUSTOM) mprintf(0,"NEXT TYPE IS CUSTOM!\n\n\n\n\n\n\n");
3906 */
3907 }
3908
3909 // Process all AI Notify events
3910 bool AlienOrganismcxx . . $ AlienOrganism#::DoNotifycxx . . $ AlienOrganism#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
3911 if (IsGoalFinishedNotifycxx . . $ IsGoalFinishedNotify(83c267b20bac841a).(data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type.)) {
3912 // Handle goal complete events
3913 switch (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_uidcxx . . $ tOSIRISEVTAINOTIFY#goal_uid.) {
3914 case ALIEN_GUID_GOT_HOMEcxx . . $ `scripts/AIGame3.cpp:668:9`!:
3915 memorycxx . . $ AlienOrganism#memory.->done_movingcxx . . $ alienorganism_data#done_moving. = true;
3916 break;
3917 case ALIEN_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:669:9`!:
3918 memorycxx . . $ AlienOrganism#memory.->done_movingcxx . . $ alienorganism_data#done_moving. = true;
3919 break;
3920 case ALIEN_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:672:9`!:
3921 memorycxx . . $ AlienOrganism#memory.->dest_object_handlecxx . . $ alienorganism_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
3922 SetModecxx . . $ AlienOrganism#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.);
3923 mprintfcxx . . $ mprintf.(0, "Alien got to destination object.\n");
3924 break;
3925 }
3926 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_SCRIPTED_ORIENTcxx . . $ `Descent3/aistruct_external.h:311:9`!) {
3927 // Handle custom orientation events
3928 if (memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode. == ALIEN_LANDING_AT_HOMEcxx . . $ `scripts/AIGame3.cpp:626:9`!) {
3929 memorycxx . . $ AlienOrganism#memory.->done_turningcxx . . $ alienorganism_data#done_turning. = (AI_TurnTowardsVectorscxx . . $ AI_TurnTowardsVectors.(me, &memorycxx . . $ AlienOrganism#memory.->home_fveccxx . . $ alienorganism_data#home_fvec., &memorycxx . . $ AlienOrganism#memory.->home_uveccxx . . $ alienorganism_data#home_uvec.) != 0);
3930 }
3931 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_FIRED_WEAPONcxx . . $ `Descent3/aistruct_external.h:314:9`!) {
3932 mprintfcxx . . $ mprintf.(0, "Energy weapon fired...\n");
3933
3934 // Subtract energy it took to fire energy bolt
3935 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. -= ALIEN_ENERGY_BOLT_COSTcxx . . $ `scripts/AIGame3.cpp:646:9`!;
3936 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. < 0.0f)
3937 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. = 0.0f;
3938 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_SCRIPTED_GOALcxx . . $ `Descent3/aistruct_external.h:304:9`!) {
3939 // mprintf(0,"Custom goal called.\n");
3940 vectorcxx . . $ vector# my_pos, dir;
3941
3942 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
3943 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_GET_GOAL_POScxx . . $ `scripts/AIGame3.cpp:688:9`!, &memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos.);
3944 dir =cxx . . $ vector#`operator=`(c0842353a20857d). memorycxx . . $ AlienOrganism#memory.->squad_goal_poscxx . . $ alienorganism_data#squad_goal_pos. -cxx . . $ operator-(b77b703cd1e43e33). my_pos;
3945 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&dir);
3946
3947 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_V_MOVEMENT_DIRcxx . . $ `scripts/osiris_common.h:535:9`!, &dir);
3948 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_SCRIPTED_ENABLERcxx . . $ `Descent3/aistruct_external.h:305:9`!) {
3949 // mprintf(0,"Custom enabler called.\n");
3950 bool is_visible;
3951
3952 // Ask leader if he can see me
3953 SendCommandcxx . . $ AlienOrganism#SendCommand(1fae7c3a3935cb04).(me, memorycxx . . $ AlienOrganism#memory.->leader_handlecxx . . $ alienorganism_data#leader_handle., ALIEN_COM_CAN_YOU_SEE_MEcxx . . $ `scripts/AIGame3.cpp:691:9`!, &is_visible);
3954
3955 // If I'm visible, do straight line to position, otherwise deactivate this goal
3956 return is_visible;
3957 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_MELEE_HITcxx . . $ `Descent3/aistruct_external.h:308:9`!) {
3958 // Make sure we are doing the energy suck attack
3959 if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..attack_numcxx . . $ tOSIRISEVTAINOTIFY#$anonymous_type_0#attack_num. == 0) {
3960 int target = data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle.;
3961
3962 // Check if target has energy (if not a player, assume it does have energy)
3963 bool target_has_energy = true;
3964 int type;
3965 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
3966 if (type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
3967 if (qObjEnergycxx . . $ qObjEnergy(5cde91ea12d43f46).(target) <= 0.0f) {
3968 target_has_energy = false;
3969 }
3970 }
3971
3972 // If target still has energy, give alien an energy charge
3973 if (target_has_energy && memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. < ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!) {
3974 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. += ALIEN_ENERGY_SUCK_CHARGEcxx . . $ `scripts/AIGame3.cpp:645:9`!;
3975 if (memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. > ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!) {
3976 memorycxx . . $ AlienOrganism#memory.->energy_chargescxx . . $ alienorganism_data#energy_charges. = ALIEN_MAX_ENERGY_CHARGEScxx . . $ `scripts/AIGame3.cpp:644:9`!;
3977 }
3978 memorycxx . . $ AlienOrganism#memory.->ok_to_depositcxx . . $ alienorganism_data#ok_to_deposit. = true;
3979 }
3980 }
3981 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!) {
3982 bot_comcxx . . $ bot_com# *com = (bot_comcxx . . $ bot_com# *)data->extra_infocxx . . $ tOSIRISEventInfo#extra_info.;
3983
3984 return ReceiveCommandcxx . . $ AlienOrganism#ReceiveCommand(1fae7c3a3935cb04).(me, data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle., com->actioncxx . . $ bot_com#action., com->ptrcxx . . $ bot_com#ptr.);
3985 }
3986
3987 return true;
3988 }
3989
3990 // Handles application of damage to an alien
3991 void AlienOrganismcxx . . $ AlienOrganism#::DoDamagecxx . . $ AlienOrganism#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data) {
3992 /*
3993 int wpn_handle=damage_data->weapon_handle;
3994 int type;
3995 uint16_t id;
3996
3997 wpn_handle=damage_data->weapon_handle;
3998 Obj_Value(wpn_handle, VF_GET, OBJV_US_ID, &id);
3999 Obj_Value(wpn_handle, VF_GET, OBJV_I_TYPE, &type);
4000
4001 if(type == OBJ_WEAPON && (id == Wpn_FindID("Napalm") || id == Wpn_FindID("NapalmBlob")))
4002 */
4003
4004 // Handle fire damage
4005 if (damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_FIREcxx . . $ `Descent3/damage_external.h:35:9`!) {
4006 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= 0.7f;
4007 // mprintf(0, "Damaged by fire!\n");
4008
4009 return;
4010 }
4011
4012 // Handle damage by matter weapons
4013 if (damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_MATTERcxx . . $ `Descent3/damage_external.h:36:9`!) {
4014 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= 0.9f;
4015
4016 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time.) {
4017 memorycxx . . $ AlienOrganism#memory.->next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.() + 0.8f + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.5f;
4018
4019 // Create a frag burst effect
4020 vectorcxx . . $ vector# pos;
4021 int room;
4022 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
4023 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
4024 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, frag_burst_effect_idcxx . . $ frag_burst_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
4025 }
4026
4027 return;
4028 }
4029
4030 // Handle damage by energy weapons
4031 if ((damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_ENERGYcxx . . $ `Descent3/damage_external.h:37:9`! || damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_ELECTRICcxx . . $ `Descent3/damage_external.h:33:9`!) &&
4032 Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienOrganism#memory.->next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time.) {
4033 // Check if we're currently doing energy transfer or healing
4034 if (IsEnergyRelatedLandedModecxx . . $ AlienOrganism#IsEnergyRelatedLandedMode(83c267b20bac841a).(memorycxx . . $ AlienOrganism#memory.->modecxx . . $ alienorganism_data#mode.)) {
4035 memorycxx . . $ AlienOrganism#memory.->next_special_damage_timecxx . . $ alienorganism_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.() + 0.1f + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.2f;
4036
4037 // Do double damage
4038 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= 3.0f;
4039
4040 // Create sparks
4041 int room;
4042 vectorcxx . . $ vector# pos;
4043 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
4044 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
4045 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(30 + int(((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 10.0f), &pos, room);
4046
4047 return;
4048 }
4049 }
4050
4051 // Just make it do little damage
4052 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= 0.15f;
4053 // mprintf(0, "Not damaged!\n");
4054 }
4055
4056 // Handles attacks on aliens
4057 void AlienOrganismcxx . . $ AlienOrganism#::DoCollidecxx . . $ AlienOrganism#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data) {
4058 // See if it's a player or player weapon that hit us
4059 if (qObjIsPlayerOrPlayerWeaponcxx . . $ qObjIsPlayerOrPlayerWeapon(83c267b20bac841a).(collide_data->it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.)) {
4060 // mprintf(0,"Hit by player!\n");
4061 memorycxx . . $ AlienOrganism#memory.->hit_by_playercxx . . $ alienorganism_data#hit_by_player. = true;
4062 }
4063 }
4064
4065 // Receives all basic events and calls processesing functions
4066 int16_t AlienOrganismcxx . . $ AlienOrganism#::CallEventcxx . . $ AlienOrganism#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
4067 switch (event) {
4068 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
4069 DoInitcxx . . $ AlienOrganism#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
4070 break;
4071 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
4072 DoFramecxx . . $ AlienOrganism#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
4073 break;
4074 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
4075 return (DoNotifycxx . . $ AlienOrganism#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
4076 break;
4077 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
4078 DoDamagecxx . . $ AlienOrganism#DoDamage(1a3e688ec82e7ded).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged.);
4079 break;
4080 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
4081 msafe_structcxx . . $ msafe_struct# mo;
4082 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos1_handlecxx . . $ alienorganism_data#pos1_handle.;
4083 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
4084 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos2_handlecxx . . $ alienorganism_data#pos2_handle.;
4085 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
4086 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienOrganism#memory.->pos3_handlecxx . . $ alienorganism_data#pos3_handle.;
4087 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
4088 break;
4089 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
4090 DoCollidecxx . . $ AlienOrganism#DoCollide(bbb8461685d7aa69).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide.);
4091 break;
4092 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
4093 memorycxx . . $ AlienOrganism#memory. = (alienorganism_datacxx . . $ alienorganism_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
4094 break;
4095 }
4096
4097 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
4098 }
4099
4100 //---------------------
4101 // Heavy Trooper class
4102 //---------------------
4103
4104 // Sets the trooper's max speed
4105 void HeavyTroopercxx . . $ HeavyTrooper#::SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(int me, float speed, bool accel_faster /*=false*/) {
4106 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &speed);
4107
4108 float delta_speed = memorycxx . . $ HeavyTrooper#memory.->base_delta_speedcxx . . $ heavytrooper_data#base_delta_speed.;
4109 float turn_rate = memorycxx . . $ HeavyTrooper#memory.->base_turn_ratecxx . . $ heavytrooper_data#base_turn_rate.;
4110 float delta_turn_rate = memorycxx . . $ HeavyTrooper#memory.->base_delta_turn_ratecxx . . $ heavytrooper_data#base_delta_turn_rate.;
4111 if (accel_faster) {
4112 delta_speed *= HT_RAMMING_DELTA_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:951:9`!;
4113 turn_rate *= HT_RAMMING_TURN_RATE_MODcxx . . $ `scripts/AIGame3.cpp:953:9`!;
4114 delta_turn_rate *= HT_RAMMING_DELTA_TURN_RATE_MODcxx . . $ `scripts/AIGame3.cpp:954:9`!;
4115 }
4116 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_DELTA_SPEEDcxx . . $ `scripts/osiris_common.h:506:9`!, &delta_speed);
4117 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_TURN_RATEcxx . . $ `scripts/osiris_common.h:507:9`!, &turn_rate);
4118 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_DELTA_TURN_RATEcxx . . $ `scripts/osiris_common.h:508:9`!, &delta_turn_rate);
4119 }
4120
4121 // Enable the trooper's gun attack
4122 void HeavyTroopercxx . . $ HeavyTrooper#::EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(int me, bool enable /*=true*/) {
4123 int flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
4124 if (enable) {
4125 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4126 } else {
4127 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4128 }
4129 }
4130
4131 // Launches a grenade
4132 void HeavyTroopercxx . . $ HeavyTrooper#::LaunchGrenadecxx . . $ HeavyTrooper#LaunchGrenade(d4f767463ce0a6b3).(int me) {
4133 msafe_structcxx . . $ msafe_struct# mstruct;
4134
4135 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = me;
4136 mstruct.indexcxx . . $ msafe_struct#index. = ht_grenade_idcxx . . $ ht_grenade_id.;
4137 if (mstruct.indexcxx . . $ msafe_struct#index. == -1)
4138 return;
4139 mstruct.gunpointcxx . . $ msafe_struct#gunpoint. = HT_GRENADE_GUNPOINTcxx . . $ `scripts/AIGame3.cpp:918:9`!;
4140 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_FIRE_WEAPONcxx . . $ `scripts/osiris_common.h:857:9`!, &mstruct);
4141
4142 // Play the impact mortar launch sound
4143 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(ht_grenade_sound_idcxx . . $ ht_grenade_sound_id., me, 1.0f);
4144
4145 /*
4146 // Create blast effect
4147 vector pos;
4148 int room;
4149 Obj_Value(me, VF_GET, OBJV_I_ROOMNUM, &room);
4150 Obj_GetGunPos(me, HT_GRENADE_GUNPOINT, &pos);
4151 Obj_Create(OBJ_WEAPON, ht_grenade_effect_id, room, &pos, NULL, me);
4152 */
4153
4154 // Create smoke spew
4155 TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(me, 2, 7, 0.0f, 0.0f, 65536, false, 0.5f, 0.1f, 0.7f, 1.0f, 15.0f, true);
4156 TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(me, 2, 3, 0.0f, 0.0f, 65536, false, 0.2f, 0.05f, 0.3f, 2.0f, 40.0f, true);
4157 }
4158
4159 // Checks whether the trooper has a clear shot
4160 bool HeavyTroopercxx . . $ HeavyTrooper#::HasAClearGrenadeShotcxx . . $ HeavyTrooper#HasAClearGrenadeShot(9609253e83e89946).(int me, bool use_grenade_gunpoint /*=false*/) {
4161 vectorcxx . . $ vector# pos, dir;
4162 matrixcxx . . $ matrix# orient;
4163 int room;
4164
4165 // Get the current object's room number
4166 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
4167
4168 // See where we should aim from
4169 if (use_grenade_gunpoint) {
4170 // aim directly from the grenade launcher's gunpoint
4171 Obj_GetGunPoscxx . . $ Obj_GetGunPos(acebd7a68d406969).(me, HT_GRENADE_GUNPOINTcxx . . $ `scripts/AIGame3.cpp:918:9`!, &pos, &dir);
4172 } else {
4173 // since we don't want to aim with the gunpoint, just use the forward vector
4174 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
4175 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
4176 dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). orient.fveccxx . . $ matrix#fvec.;
4177 }
4178
4179 // See if should check for a clear shot
4180 tShotDatacxx . . $ tShotData# shot_data;
4181
4182 shot_data.object_handlecxx . . $ tShotData#object_handle. = me;
4183 shot_data.danger_radiuscxx . . $ tShotData#danger_radius. = 20.0f;
4184 shot_data.radius_inccxx . . $ tShotData#radius_inc. = 1.2f;
4185 shot_data.max_distcxx . . $ tShotData#max_dist. = 120.0f;
4186 shot_data.risk_factorcxx . . $ tShotData#risk_factor. = 0.0f;
4187 shot_data.start_pointcxx . . $ tShotData#start_point. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos;
4188 shot_data.start_roomcxx . . $ tShotData#start_room. = room;
4189 shot_data.dircxx . . $ tShotData#dir. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dir;
4190 shot_data.shot_radiuscxx . . $ tShotData#shot_radius. = 5.0f;
4191
4192 /*
4193 // If we're not checking during actual launch, make check a little bigger
4194 if(!use_grenade_gunpoint)
4195 {
4196 shot_data.danger_radius *= 1.3f;
4197 }
4198 */
4199
4200 int result = HasClearShotcxx . . $ HasClearShot(9af2993f90940be2).(&shot_data);
4201
4202 if (result == CS_ALL_CLEARcxx . . $ `scripts/AIGame3.cpp:359:9`!) {
4203 return true;
4204 } else {
4205 mprintfcxx . . $ mprintf.(0, "Didn't shoot because: %d\n", result);
4206 return false;
4207 }
4208 }
4209
4210 // Sets the Current Mode
4211 void HeavyTroopercxx . . $ HeavyTrooper#::SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(int me, char mode) {
4212 int flags;
4213
4214 // mprintf(0, "From mode %d, ",memory->mode);
4215
4216 // Clear out any non-Dallas assigned goals
4217 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
4218
4219 // Turn on dodging (only off when curled up)
4220 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
4221 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4222
4223 // Do mode specific setups
4224 switch (mode) {
4225 case HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`!: {
4226 mprintfcxx . . $ mprintf.(0, "Normal attack mode set.\n");
4227
4228 // Set firing capabilities
4229 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me);
4230
4231 // Set speed
4232 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed.);
4233
4234 // Set to default ranged attack goals
4235 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4236 } break;
4237
4238 case HT_PREPARING_GRENADEcxx . . $ `scripts/AIGame3.cpp:879:9`!: {
4239 mprintfcxx . . $ mprintf.(0, "Preparing grenade mode set.\n");
4240
4241 // Disable firing capabilities
4242 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4243
4244 // Set speed
4245 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_GRENADE_AIMING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:946:9`!);
4246
4247 // Set to default ranged attack goals
4248 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4249 } break;
4250
4251 case HT_FIRING_GRENADEcxx . . $ `scripts/AIGame3.cpp:880:9`!: {
4252 mprintfcxx . . $ mprintf.(0, "Firing grenade mode set.\n");
4253
4254 // Disable firing capabilities
4255 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4256
4257 // Set speed
4258 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_GRENADE_FIRING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:945:9`!);
4259
4260 // Set to default ranged attack goals
4261 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4262
4263 // Play the fire grenade anim
4264 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, HT_GRENADE_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:936:9`!, HT_GRENADE_FIRE_FRAMEcxx . . $ `scripts/AIGame3.cpp:937:9`!, HT_GRENADE_FIRE_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:940:9`!, 0, -1, -1);
4265 } break;
4266
4267 case HT_RECOVERINGcxx . . $ `scripts/AIGame3.cpp:881:9`!: {
4268 mprintfcxx . . $ mprintf.(0, "Recovering mode set.\n");
4269
4270 // Disable firing capabilities
4271 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4272
4273 // Set speed
4274 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_GRENADE_AIMING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:946:9`!);
4275
4276 // Set to default ranged attack goals
4277 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4278 } break;
4279
4280 case HT_PREPARING_FOR_CURLcxx . . $ `scripts/AIGame3.cpp:883:9`!: {
4281 mprintfcxx . . $ mprintf.(0, "Preparing for curl mode set.\n");
4282
4283 // Disable firing capabilities
4284 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4285
4286 // Set speed
4287 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_CURLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:947:9`!);
4288
4289 // Set to default ranged attack goals
4290 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4291 } break;
4292
4293 case HT_CURLING_UPcxx . . $ `scripts/AIGame3.cpp:884:9`!: {
4294 mprintfcxx . . $ mprintf.(0, "Curling up mode set.\n");
4295
4296 // Disable firing capabilities
4297 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4298
4299 // Set speed
4300 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_CURLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:947:9`!);
4301
4302 // Play the curling up animation
4303 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, HT_CURLUP_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:921:9`!, HT_CURLUP_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:922:9`!, HT_CURLUP_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:923:9`!, 0, -1, -1);
4304
4305 // Set to default ranged attack goals
4306 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4307 } break;
4308
4309 case HT_UNCURLINGcxx . . $ `scripts/AIGame3.cpp:885:9`!: {
4310 mprintfcxx . . $ mprintf.(0, "Uncurling mode set.\n");
4311
4312 // Disable firing capabilities
4313 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4314
4315 // Set speed
4316 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_CURLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:947:9`!);
4317
4318 // Play the uncurling animation and then switch back to alert
4319 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, HT_UNCURL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:925:9`!, HT_UNCURL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:926:9`!, HT_UNCURL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:927:9`!, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
4320
4321 // Set to default ranged attack goals
4322 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
4323 } break;
4324
4325 case HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`!: {
4326 mprintfcxx . . $ mprintf.(0, "Armored mode set.\n");
4327
4328 // Disable firing capabilities
4329 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4330
4331 // Turn off dodging
4332 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
4333 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4334
4335 // Set speed
4336 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_RAMMING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:948:9`!, true);
4337
4338 // Set goal to ram into player
4339 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, 1, 1.0f, -1,
4340 GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228: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`! |
4341 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!,
4342 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
4343 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me, 1, 0.1f);
4344 } break;
4345
4346 case HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`!: {
4347 mprintfcxx . . $ mprintf.(0, "Armored circle-back mode set.\n");
4348
4349 vectorcxx . . $ vector# pos;
4350 int room;
4351
4352 // Disable firing capabilities
4353 EnableGunAttackcxx . . $ HeavyTrooper#EnableGunAttack(918ebd27a9ddbad3).(me, false);
4354
4355 // Turn off dodging
4356 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
4357 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4358
4359 // Set speed
4360 SetMaxSpeedcxx . . $ HeavyTrooper#SetMaxSpeed(a421cb528a2d8d2f).(me, memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed. * HT_CIRCLE_BACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:949:9`!, true);
4361
4362 // Set the goal to wander away for a few seconds
4363 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
4364 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
4365
4366 float dist = 10.0f;
4367
4368 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, 1, 1.0f, -1, GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!, &pos, room);
4369 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 1, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
4370
4371 int g_index = AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 1.0f, -1,
4372 GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
4373 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, g_index, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
4374 } break;
4375
4376 default:
4377 mprintfcxx . . $ mprintf.(0, "Heavy Trooper is all messed up!\n");
4378 break;
4379 }
4380
4381 // Set the current mode and reset the mode time
4382 memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. = mode;
4383 memorycxx . . $ HeavyTrooper#memory.->mode_timecxx . . $ heavytrooper_data#mode_time. = 0.0f;
4384 }
4385
4386 // Processes the AI Initialize event
4387 void HeavyTroopercxx . . $ HeavyTrooper#::DoInitcxx . . $ HeavyTrooper#DoInit(d4f767463ce0a6b3).(int me) {
4388 // Setup memory data
4389 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
4390 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = HT_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:890:9`!;
4391 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(heavytrooper_datacxx . . $ heavytrooper_data#);
4392 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
4393 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
4394
4395 memorycxx . . $ HeavyTrooper#memory. = (heavytrooper_datacxx . . $ heavytrooper_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
4396
4397 // Init base values
4398 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ HeavyTrooper#memory.->base_speedcxx . . $ heavytrooper_data#base_speed.);
4399 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_DELTA_SPEEDcxx . . $ `scripts/osiris_common.h:506:9`!, &memorycxx . . $ HeavyTrooper#memory.->base_delta_speedcxx . . $ heavytrooper_data#base_delta_speed.);
4400 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_TURN_RATEcxx . . $ `scripts/osiris_common.h:507:9`!, &memorycxx . . $ HeavyTrooper#memory.->base_turn_ratecxx . . $ heavytrooper_data#base_turn_rate.);
4401 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_DELTA_TURN_RATEcxx . . $ `scripts/osiris_common.h:508:9`!, &memorycxx . . $ HeavyTrooper#memory.->base_delta_turn_ratecxx . . $ heavytrooper_data#base_delta_turn_rate.);
4402 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ HeavyTrooper#memory.->base_shieldscxx . . $ heavytrooper_data#base_shields.);
4403
4404 // Init to no charge
4405 memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. = 0.0f;
4406
4407 memorycxx . . $ HeavyTrooper#memory.->max_chargecxx . . $ heavytrooper_data#max_charge. = HT_MAX_CHARGEcxx . . $ `scripts/AIGame3.cpp:904:9`! + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * HT_MAX_CHARGE_VARIANCEcxx . . $ `scripts/AIGame3.cpp:905:9`!;
4408 memorycxx . . $ HeavyTrooper#memory.->curlup_distcxx . . $ heavytrooper_data#curlup_dist. = HT_CURLUP_DISTcxx . . $ `scripts/AIGame3.cpp:895:9`! + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * HT_CURLUP_DIST_VARIANCEcxx . . $ `scripts/AIGame3.cpp:896:9`!;
4409
4410 // Check for a grenade shot as soon as possible
4411 memorycxx . . $ HeavyTrooper#memory.->next_grenade_check_timecxx . . $ heavytrooper_data#next_grenade_check_time. = Game_GetTimecxx . . $ Game_GetTime.();
4412 memorycxx . . $ HeavyTrooper#memory.->last_grenade_timecxx . . $ heavytrooper_data#last_grenade_time. = Game_GetTimecxx . . $ Game_GetTime.();
4413
4414 memorycxx . . $ HeavyTrooper#memory.->next_charge_timecxx . . $ heavytrooper_data#next_charge_time. = Game_GetTimecxx . . $ Game_GetTime.();
4415 memorycxx . . $ HeavyTrooper#memory.->next_blast_timecxx . . $ heavytrooper_data#next_blast_time. = Game_GetTimecxx . . $ Game_GetTime.();
4416
4417 // Do next particle effect as soon as possible
4418 memorycxx . . $ HeavyTrooper#memory.->next_particle_timecxx . . $ heavytrooper_data#next_particle_time. = Game_GetTimecxx . . $ Game_GetTime.();
4419
4420 // Start out in normal attack mode
4421 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`!);
4422 }
4423
4424 // Processes the AI Frame Interval Event
4425 void HeavyTroopercxx . . $ HeavyTrooper#::DoFramecxx . . $ HeavyTrooper#DoFrame(d4f767463ce0a6b3).(int me) {
4426 float last_see_time, last_see_game_time;
4427 float last_hear_time, last_hear_game_time;
4428 float curr_anim_frame;
4429
4430 // Get the last see and hear time
4431 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_SEE_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:530:9`!, &last_see_game_time);
4432 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_HEAR_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:558:9`!, &last_hear_game_time);
4433
4434 // Calculate the time since target was seen or heard
4435 last_hear_time = Game_GetTimecxx . . $ Game_GetTime.() - last_hear_game_time;
4436 last_see_time = Game_GetTimecxx . . $ Game_GetTime.() - last_see_game_time;
4437
4438 // Get the current animation frame
4439 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &curr_anim_frame);
4440
4441 // Handle charge increase and decrease
4442 if (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`! || memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_PREPARING_GRENADEcxx . . $ `scripts/AIGame3.cpp:879:9`! || memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_FIRING_GRENADEcxx . . $ `scripts/AIGame3.cpp:880:9`! ||
4443 memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_RECOVERINGcxx . . $ `scripts/AIGame3.cpp:881:9`!) {
4444 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ HeavyTrooper#memory.->next_charge_timecxx . . $ heavytrooper_data#next_charge_time.) {
4445 // Set the next recharge time
4446 memorycxx . . $ HeavyTrooper#memory.->next_charge_timecxx . . $ heavytrooper_data#next_charge_time. = Game_GetTimecxx . . $ Game_GetTime.() + HT_RECHARGE_TIMEcxx . . $ `scripts/AIGame3.cpp:902:9`!;
4447
4448 // Increment the charge
4449 memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. += HT_CHARGE_INCcxx . . $ `scripts/AIGame3.cpp:906:9`!;
4450 if (memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. > memorycxx . . $ HeavyTrooper#memory.->max_chargecxx . . $ heavytrooper_data#max_charge.) {
4451 memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. = memorycxx . . $ HeavyTrooper#memory.->max_chargecxx . . $ heavytrooper_data#max_charge.;
4452 }
4453 }
4454 } else if (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`! || memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`!) {
4455 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ HeavyTrooper#memory.->next_charge_timecxx . . $ heavytrooper_data#next_charge_time.) {
4456 // Set the next decharge time
4457 memorycxx . . $ HeavyTrooper#memory.->next_charge_timecxx . . $ heavytrooper_data#next_charge_time. = Game_GetTimecxx . . $ Game_GetTime.() + HT_DECHARGE_TIMEcxx . . $ `scripts/AIGame3.cpp:903:9`!;
4458
4459 // Decrement the charge
4460 memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. -= HT_CHARGE_INCcxx . . $ `scripts/AIGame3.cpp:906:9`!;
4461 if (memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. < 0.0f) {
4462 memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. = 0.0f;
4463 }
4464 }
4465 }
4466
4467 // mprintf(0,"Charge: %.1f\n",memory->charge);
4468
4469 // Do mode specific checks
4470 switch (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode.) {
4471 case HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`!: {
4472 // Get the current target handle
4473 int target_handle;
4474 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
4475
4476 ///*
4477 // If we are fully charged, decide if we should curl up
4478 if (memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. >= memorycxx . . $ HeavyTrooper#memory.->max_chargecxx . . $ heavytrooper_data#max_charge.) {
4479 // If low on hitpoints
4480 float shields;
4481 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &shields);
4482 if (shields < (memorycxx . . $ HeavyTrooper#memory.->base_shieldscxx . . $ heavytrooper_data#base_shields. * HT_CURLUP_DAMAGEcxx . . $ `scripts/AIGame3.cpp:897:9`!)) {
4483 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_PREPARING_FOR_CURLcxx . . $ `scripts/AIGame3.cpp:883:9`!);
4484 break;
4485 }
4486
4487 // If close to target
4488 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
4489 float dist;
4490 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
4491 if (dist < memorycxx . . $ HeavyTrooper#memory.->curlup_distcxx . . $ heavytrooper_data#curlup_dist.) {
4492 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_PREPARING_FOR_CURLcxx . . $ `scripts/AIGame3.cpp:883:9`!);
4493 break;
4494 }
4495 }
4496 }
4497 //*/
4498
4499 // Decide if we should switch into grenade mode
4500 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ HeavyTrooper#memory.->next_grenade_check_timecxx . . $ heavytrooper_data#next_grenade_check_time.) {
4501 memorycxx . . $ HeavyTrooper#memory.->next_grenade_check_timecxx . . $ heavytrooper_data#next_grenade_check_time. =
4502 Game_GetTimecxx . . $ Game_GetTime.() + HT_GRENADE_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:914:9`! + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * HT_GRENADE_CHECK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:915:9`!;
4503
4504 // Make sure enough time has gone by since we last fired
4505 if ((Game_GetTimecxx . . $ Game_GetTime.() - memorycxx . . $ HeavyTrooper#memory.->last_grenade_timecxx . . $ heavytrooper_data#last_grenade_time.) >= HT_GRENADE_RELOAD_TIMEcxx . . $ `scripts/AIGame3.cpp:916:9`!) {
4506 // Make sure we have a target
4507 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
4508 float dist;
4509 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
4510
4511 // Make sure the target is within range
4512 if (dist > HT_GRENADE_DISTcxx . . $ `scripts/AIGame3.cpp:899:9`! && dist < HT_GRENADE_DIST_MAXcxx . . $ `scripts/AIGame3.cpp:900:9`!) {
4513 // Make sure we currently have a clear shot
4514 if (HasAClearGrenadeShotcxx . . $ HeavyTrooper#HasAClearGrenadeShot(9609253e83e89946).(me, false)) {
4515 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_PREPARING_GRENADEcxx . . $ `scripts/AIGame3.cpp:879:9`!);
4516 break;
4517 }
4518 }
4519 }
4520 }
4521 }
4522
4523 // See if we're currently in the firing animation
4524 if (curr_anim_frame > HT_GUNFIRE_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:933:9`! && curr_anim_frame < HT_GUNFIRE_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:934:9`!) {
4525 // Check the time to see if we need to generate a new particle spew
4526 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ HeavyTrooper#memory.->next_particle_timecxx . . $ heavytrooper_data#next_particle_time.) {
4527 memorycxx . . $ HeavyTrooper#memory.->next_particle_timecxx . . $ heavytrooper_data#next_particle_time. = Game_GetTimecxx . . $ Game_GetTime.() + HT_MAX_PARTICLE_TIMEcxx . . $ `scripts/AIGame3.cpp:893:9`!;
4528
4529 // Create the casing particle effect
4530 TurnOnSpewcxx . . $ TurnOnSpew(ed9f931f2bdfbeb2).(me, 3, 15, 2.0f, 0.0f, 65536 | 128, false, 0.1f, 0.15f, HT_PARTICLE_SPEW_TIMEcxx . . $ `scripts/AIGame3.cpp:892:9`!, 0.2f, 50, true);
4531
4532 /*
4533 msafe_struct mstruct;
4534 mstruct.objhandle = me;
4535 mstruct.index = Wpn_FindID("ChaffSpark") ;
4536 if (mstruct.index == -1)
4537 return;
4538 mstruct.gunpoint = 3;
4539 MSafe_CallFunction(MSAFE_OBJECT_FIRE_WEAPON,&mstruct);
4540 */
4541 }
4542 }
4543 } break;
4544
4545 case HT_PREPARING_GRENADEcxx . . $ `scripts/AIGame3.cpp:879:9`!: {
4546 char type, next_type;
4547 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
4548 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_NEXT_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:521:9`!, &next_type);
4549
4550 // Wait until the current or next anim type is alert, then try and fire grenade
4551 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || next_type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
4552 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_FIRING_GRENADEcxx . . $ `scripts/AIGame3.cpp:880:9`!);
4553 break;
4554 }
4555 } break;
4556
4557 case HT_FIRING_GRENADEcxx . . $ `scripts/AIGame3.cpp:880:9`!: {
4558 // Wait until the fire frame is up
4559 if (curr_anim_frame == HT_GRENADE_FIRE_FRAMEcxx . . $ `scripts/AIGame3.cpp:937:9`!) {
4560 float anim_time;
4561
4562 // Start the last grenade time count now
4563 memorycxx . . $ HeavyTrooper#memory.->last_grenade_timecxx . . $ heavytrooper_data#last_grenade_time. = Game_GetTimecxx . . $ Game_GetTime.();
4564
4565 // Do another aim check, but this time from the actual grenade gunpoint
4566 if (HasAClearGrenadeShotcxx . . $ HeavyTrooper#HasAClearGrenadeShot(9609253e83e89946).(me, true)) {
4567 // Fire grenade from gunpoint
4568 LaunchGrenadecxx . . $ HeavyTrooper#LaunchGrenade(d4f767463ce0a6b3).(me);
4569
4570 // Set anim time to recoil
4571 anim_time = HT_GRENADE_RECOIL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:941:9`!;
4572 } else {
4573 // Set time to misfire
4574 anim_time = HT_GRENADE_MISFIRE_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:942:9`!;
4575 }
4576
4577 // Play the recover animation
4578 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, HT_GRENADE_FIRE_FRAMEcxx . . $ `scripts/AIGame3.cpp:937:9`!, HT_GRENADE_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:938:9`!, anim_time, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
4579
4580 // Go to recover mode
4581 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_RECOVERINGcxx . . $ `scripts/AIGame3.cpp:881:9`!);
4582 break;
4583 }
4584 } break;
4585
4586 case HT_RECOVERINGcxx . . $ `scripts/AIGame3.cpp:881:9`!: {
4587 char type;
4588 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
4589
4590 // Wait until the current anim type is alert, then return to normal
4591 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
4592 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`!);
4593 break;
4594 }
4595 } break;
4596
4597 case HT_PREPARING_FOR_CURLcxx . . $ `scripts/AIGame3.cpp:883:9`!: {
4598 char type, next_type;
4599 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
4600 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_NEXT_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:521:9`!, &next_type);
4601
4602 // Wait until the current or next anim type is alert, then curl up
4603 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || next_type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
4604 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_CURLING_UPcxx . . $ `scripts/AIGame3.cpp:884:9`!);
4605 break;
4606 }
4607 } break;
4608
4609 case HT_CURLING_UPcxx . . $ `scripts/AIGame3.cpp:884:9`!: {
4610 // If we're done curling up, switch into armored attack mode
4611 if (curr_anim_frame == HT_CURLUP_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:922:9`!) {
4612 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, HT_ROLL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:929:9`!, HT_ROLL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:930:9`!, HT_ROLL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:931:9`!, AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, -1, -1);
4613 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`!);
4614 break;
4615 }
4616 } break;
4617
4618 case HT_UNCURLINGcxx . . $ `scripts/AIGame3.cpp:885:9`!: {
4619 char type;
4620 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
4621
4622 // Wait until the current anim type is alert, then return to normal
4623 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
4624 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ATTACK_NORMALcxx . . $ `scripts/AIGame3.cpp:878:9`!);
4625 break;
4626 }
4627 } break;
4628
4629 case HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`!: {
4630 // If we're out of charge time to uncurl
4631 if (memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. <= 0.0f) {
4632 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_UNCURLINGcxx . . $ `scripts/AIGame3.cpp:885:9`!);
4633 break;
4634 }
4635 } break;
4636
4637 case HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`!: {
4638 // If we're out of charge or have circled back long enough, get outta here
4639 if (memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. <= 0.0f || memorycxx . . $ HeavyTrooper#memory.->mode_timecxx . . $ heavytrooper_data#mode_time. >= HT_CIRCLE_BACK_TIMEcxx . . $ `scripts/AIGame3.cpp:908:9`!) {
4640 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`!);
4641 break;
4642 }
4643 } break;
4644
4645 default:
4646 mprintfcxx . . $ mprintf.(0, "Heavy Trooper is all messed up!\n");
4647 break;
4648 }
4649
4650 // Increment the current mode time
4651 memorycxx . . $ HeavyTrooper#memory.->mode_timecxx . . $ heavytrooper_data#mode_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
4652 }
4653
4654 // Process all AI Notify events
4655 bool HeavyTroopercxx . . $ HeavyTrooper#::DoNotifycxx . . $ HeavyTrooper#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) { return true; }
4656
4657 // Processes incoming damage reports
4658 void HeavyTroopercxx . . $ HeavyTrooper#::DoDamagecxx . . $ HeavyTrooper#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data) {
4659 // If trooper is currently in armored mode, reduce damage significantly
4660 if (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`! || memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`!) {
4661 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= HT_ARMOR_DAMAGED_MODcxx . . $ `scripts/AIGame3.cpp:911:9`!;
4662 } else if (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_CURLING_UPcxx . . $ `scripts/AIGame3.cpp:884:9`! || memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_UNCURLINGcxx . . $ `scripts/AIGame3.cpp:885:9`!) {
4663 damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. *= HT_CURLING_DAMAGED_MODcxx . . $ `scripts/AIGame3.cpp:912:9`!;
4664 }
4665 }
4666
4667 // Handle smashing into target in armored mode
4668 void HeavyTroopercxx . . $ HeavyTrooper#::DoCollidecxx . . $ HeavyTrooper#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data) {
4669 vectorcxx . . $ vector# pos;
4670 int room;
4671
4672 // Make sure we're in armored attack mode and still have charge left
4673 if (memorycxx . . $ HeavyTrooper#memory.->modecxx . . $ heavytrooper_data#mode. == HT_ARMORED_ATTACKcxx . . $ `scripts/AIGame3.cpp:886:9`! && memorycxx . . $ HeavyTrooper#memory.->chargecxx . . $ heavytrooper_data#charge. > 0.0f) {
4674 // Make sure it's ok to create the attack if necessary
4675 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ HeavyTrooper#memory.->next_blast_timecxx . . $ heavytrooper_data#next_blast_time.) {
4676 // Make sure we have a target
4677 int target_handle;
4678 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
4679 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
4680 // See if the object we collided with is the target
4681 if (collide_data->it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle. == target_handle) {
4682 // Create the shield blast
4683 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
4684 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
4685 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, shield_blast_idcxx . . $ shield_blast_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
4686
4687 // Set the next valid shield blast time
4688 memorycxx . . $ HeavyTrooper#memory.->next_blast_timecxx . . $ heavytrooper_data#next_blast_time. = Game_GetTimecxx . . $ Game_GetTime.() + HT_SHIELD_BLAST_DELAYcxx . . $ `scripts/AIGame3.cpp:910:9`!;
4689
4690 // Tell him to run away
4691 SetModecxx . . $ HeavyTrooper#SetMode(5016a63d0a5aceb0).(me, HT_ARMORED_CIRCLE_BACKcxx . . $ `scripts/AIGame3.cpp:887:9`!);
4692 }
4693 }
4694 }
4695 }
4696 }
4697
4698 // Receives all basic events and calls processesing functions
4699 int16_t HeavyTroopercxx . . $ HeavyTrooper#::CallEventcxx . . $ HeavyTrooper#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
4700 switch (event) {
4701 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
4702 DoInitcxx . . $ HeavyTrooper#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
4703 break;
4704 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
4705 DoFramecxx . . $ HeavyTrooper#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
4706 break;
4707 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
4708 return (DoNotifycxx . . $ HeavyTrooper#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
4709 break;
4710 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
4711 DoDamagecxx . . $ HeavyTrooper#DoDamage(1a3e688ec82e7ded).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged.);
4712 break;
4713 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
4714 break;
4715 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
4716 DoCollidecxx . . $ HeavyTrooper#DoCollide(bbb8461685d7aa69).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide.);
4717 break;
4718 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
4719 memorycxx . . $ HeavyTrooper#memory. = (heavytrooper_datacxx . . $ heavytrooper_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
4720 break;
4721 }
4722
4723 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
4724 }
4725
4726 //--------------
4727 // Lifter class
4728 //--------------
4729
4730 // Sets the trooper's max speed
4731 void Liftercxx . . $ Lifter#::SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed) { AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &speed); }
4732
4733 // Checks to see if tractor beam pulling can commence/continue
4734 bool Liftercxx . . $ Lifter#::OkToPullcxx . . $ Lifter#OkToPull(9609253e83e89946).(int me, bool initial_check /*=true*/) {
4735 matrixcxx . . $ matrix# orient;
4736 vectorcxx . . $ vector# vec_to_target;
4737 int target_handle;
4738 float fov_angle;
4739
4740 // If it's the initial check, make sure we're in alert mode
4741 if (initial_check) {
4742 char type;
4743 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
4744
4745 // Wait until the current anim type is alert, then return to normal
4746 if (type != AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!)
4747 return false;
4748 }
4749
4750 // Make sure we still have a target
4751 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
4752 if (target_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
4753 return false;
4754
4755 // Make sure it's a pullable target
4756 int type;
4757 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
4758 if (type != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!)
4759 return false;
4760
4761 // If it's not the initial pull, make sure the target hasn't changed
4762 if (!initial_check && target_handle != memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.)
4763 return false;
4764
4765 // Make sure the target isn't cloaked
4766 if (qObjectCloakTimecxx . . $ qObjectCloakTime(5cde91ea12d43f46).(target_handle) != 0.0f)
4767 return false;
4768
4769 // check distance to target
4770 float dist;
4771 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
4772 if (dist > LIFTER_MAX_PULLING_DISTcxx . . $ `scripts/AIGame3.cpp:1032:9`!)
4773 return false;
4774
4775 // Only check min distance if it's the initial decision check (whether to start pulling)
4776 if (initial_check && dist < LIFTER_MIN_PULLING_DISTcxx . . $ `scripts/AIGame3.cpp:1033:9`!)
4777 return false;
4778
4779 // check FOV position of target (greater than 45 degrees is too much)
4780 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
4781
4782 // NOTE: do my own vec to target here! (chris' doesn't update quick enough)
4783 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_V_VEC_TO_TARGETcxx . . $ `scripts/osiris_common.h:527:9`!, &vec_to_target);
4784 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&vec_to_target);
4785 fov_angle = orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). vec_to_target;
4786 if (fov_angle < 0.7f)
4787 return false;
4788
4789 // see if anything is in the way
4790 ray_infocxx . . $ ray_info# ray;
4791 int flags, fate;
4792 vectorcxx . . $ vector# start_pos, end_pos, landing_pos;
4793 int start_room, landing_room;
4794 float target_size;
4795
4796 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
4797 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
4798 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &end_pos);
4799 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SIZEcxx . . $ `scripts/osiris_common.h:636:9`!, &target_size);
4800
4801 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`! |
4802 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
4803 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &start_pos, &end_pos, start_room, target_size, flags, &ray);
4804 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)
4805 return false;
4806
4807 return true;
4808 }
4809
4810 // Attempts to pull the target towards us
4811 void Liftercxx . . $ Lifter#::PullTargetcxx . . $ Lifter#PullTarget(d4f767463ce0a6b3).(int me) {
4812 // see if anything is in the way
4813 ray_infocxx . . $ ray_info# ray;
4814 int flags, fate;
4815 vectorcxx . . $ vector# dir, start_pos, my_pos, end_pos, landing_pos;
4816 int start_room, landing_room;
4817 float target_size, dist;
4818 int target_handle;
4819 matrixcxx . . $ matrix# target_orient;
4820 msafe_structcxx . . $ msafe_struct# mstruct;
4821
4822 // Make sure we still have a target
4823 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
4824 if (target_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! || target_handle != memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.)
4825 return;
4826
4827 // get the target's info
4828 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
4829 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
4830 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &target_orient);
4831 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
4832 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SIZEcxx . . $ `scripts/osiris_common.h:636:9`!, &target_size);
4833
4834 // Calc the direction to pull the target
4835 dir =cxx . . $ vector#`operator=`(c0842353a20857d). my_pos -cxx . . $ operator-(b77b703cd1e43e33). start_pos;
4836 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&dir);
4837
4838 // Calc the distance to pull the target
4839 dist = (Game_GetTimecxx . . $ Game_GetTime.() - memorycxx . . $ Lifter#memory.->last_target_pull_timecxx . . $ lifter_data#last_target_pull_time.) * LIFTER_TARGET_PULL_SPEEDcxx . . $ `scripts/AIGame3.cpp:1046:9`!;
4840
4841 // Calc the point to move to
4842 end_pos =cxx . . $ vector#`operator=`(c0842353a20857d). start_pos +cxx . . $ operator+(b77b703cd1e43e33). (dir *cxx . . $ `operator*`(252247219a31502c). dist);
4843
4844 // See where it is safe to move to
4845 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`!;
4846 fate = FVI_RayCastcxx . . $ FVI_RayCast.(target_handle, &start_pos, &end_pos, start_room, target_size, flags, &ray);
4847 landing_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
4848 landing_room = ray.hit_roomcxx . . $ ray_info#hit_room.;
4849
4850 // Now move the target to this position
4851 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = target_handle;
4852 mstruct.poscxx . . $ msafe_struct#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). landing_pos;
4853 mstruct.orientcxx . . $ msafe_struct#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). target_orient;
4854 mstruct.roomnumcxx . . $ msafe_struct#roomnum. = landing_room;
4855 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_WORLD_POSITIONcxx . . $ `scripts/osiris_common.h:846:9`!, &mstruct);
4856
4857 // Move the invisible target powerup to its appropriate position
4858 MoveTargetPropcxx . . $ Lifter#MoveTargetProp(d4f767463ce0a6b3).(target_handle);
4859
4860 // Set the last pull time
4861 memorycxx . . $ Lifter#memory.->last_target_pull_timecxx . . $ lifter_data#last_target_pull_time. = Game_GetTimecxx . . $ Game_GetTime.();
4862 }
4863
4864 // Moves the target prop to the appropriate
4865 void Liftercxx . . $ Lifter#::MoveTargetPropcxx . . $ Lifter#MoveTargetProp(d4f767463ce0a6b3).(int target_handle) {
4866 vectorcxx . . $ vector# target_pos;
4867 int target_room;
4868 matrixcxx . . $ matrix# target_orient;
4869 msafe_structcxx . . $ msafe_struct# mstruct;
4870
4871 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &target_pos);
4872 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &target_room);
4873 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &target_orient);
4874
4875 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ Lifter#memory.->pull_target_propcxx . . $ lifter_data#pull_target_prop.;
4876 mstruct.poscxx . . $ msafe_struct#pos. =cxx . . $ vector#`operator=`(c0842353a20857d). target_pos -cxx . . $ operator-(b77b703cd1e43e33). (target_orient.uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). 1.4f);
4877 mstruct.orientcxx . . $ msafe_struct#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). target_orient;
4878 mstruct.roomnumcxx . . $ msafe_struct#roomnum. = target_room;
4879 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_WORLD_POSITIONcxx . . $ `scripts/osiris_common.h:846:9`!, &mstruct);
4880 }
4881
4882 // Creates the beam between me and the target
4883 void Liftercxx . . $ Lifter#::UpdateTractorBeamcxx . . $ Lifter#UpdateTractorBeam(d4f767463ce0a6b3).(int me) {
4884 float next_duration = LIFTER_PULL_VALIDATE_INTERVALcxx . . $ `scripts/AIGame3.cpp:1026:9`!;
4885 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(memorycxx . . $ Lifter#memory.->pull_source_propcxx . . $ lifter_data#pull_source_prop., memorycxx . . $ Lifter#memory.->pull_target_propcxx . . $ lifter_data#pull_target_prop., next_duration, 1.0f, 4, tractor_beam_effect_idcxx . . $ tractor_beam_effect_id.,
4886 next_duration, 1, 255, 255, 255, false);
4887 }
4888
4889 // All the controls that will be taken away while being force pulled
4890 #define PLAYER_CONTROL_MASKcxx . . $ `scripts/AIGame3.cpp:4890:9`! \
4891 (PLYV_CMASK_FORWARDcxx . . $ `scripts/osiris_common.h:485:9`! | PLYV_CMASK_REVERSEcxx . . $ `scripts/osiris_common.h:486:9`! | PLYV_CMASK_LEFTcxx . . $ `scripts/osiris_common.h:487:9`! | PLYV_CMASK_RIGHTcxx . . $ `scripts/osiris_common.h:488:9`! | PLYV_CMASK_UPcxx . . $ `scripts/osiris_common.h:489:9`! | PLYV_CMASK_DOWNcxx . . $ `scripts/osiris_common.h:490:9`! | \
4892 PLYV_CMASK_AFTERBURNERcxx . . $ `scripts/osiris_common.h:499:9`!)
4893
4894 // Takes away the target's movement
4895 void Liftercxx . . $ Lifter#::ConfineTargetcxx . . $ Lifter#ConfineTarget(d4f767463ce0a6b3).(int me) {
4896 int target_handle;
4897
4898 // Make sure we still have a target
4899 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
4900 if (target_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
4901 return;
4902
4903 // Save the current target handle
4904 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.);
4905
4906 // Make sure it's a pullable target
4907 int type;
4908 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
4909 if (type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
4910 aTogglePlayerObjControlcxx . . $ aTogglePlayerObjControl(b1146eedae1e1d0b).(0, PLAYER_CONTROL_MASKcxx . . $ `scripts/AIGame3.cpp:4890:9`!, memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.);
4911 }
4912
4913 // Store our start-of-pull shield level
4914 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ Lifter#memory.->shields_at_pull_startcxx . . $ lifter_data#shields_at_pull_start.);
4915
4916 // Clear the next pull check time
4917 memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time. = Game_GetTimecxx . . $ Game_GetTime.();
4918
4919 mprintfcxx . . $ mprintf.(0, "Target confined...\n");
4920 }
4921
4922 // Restores the target's movement
4923 void Liftercxx . . $ Lifter#::ReleaseTargetcxx . . $ Lifter#ReleaseTarget(d4f767463ce0a6b3).(int me) {
4924 // Make sure we still have a target
4925 if (memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && qObjExistscxx . . $ qObjExists(83c267b20bac841a).(memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.)) {
4926 // Check the type
4927 int type;
4928 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
4929 if (type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
4930 aTogglePlayerObjControlcxx . . $ aTogglePlayerObjControl(b1146eedae1e1d0b).(1, PLAYER_CONTROL_MASKcxx . . $ `scripts/AIGame3.cpp:4890:9`!, memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.);
4931 }
4932 }
4933
4934 // Release the pull target
4935 memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
4936
4937 // Set the next pull check time for a nice delay
4938 memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time. =
4939 Game_GetTimecxx . . $ Game_GetTime.() + LIFTER_NEXT_PULL_DELAYcxx . . $ `scripts/AIGame3.cpp:1029:9`! + (((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * LIFTER_NEXT_PULL_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1030:9`!);
4940
4941 mprintfcxx . . $ mprintf.(0, "Target released.\n");
4942 }
4943
4944 // Stops pulling and returns to hostile mode
4945 void Liftercxx . . $ Lifter#::StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(int me) {
4946 ReleaseTargetcxx . . $ Lifter#ReleaseTarget(d4f767463ce0a6b3).(me);
4947 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`!);
4948 }
4949
4950 // Switches lifter to alert animation from idle
4951 void Liftercxx . . $ Lifter#::SwitchToAlertcxx . . $ Lifter#SwitchToAlert(d4f767463ce0a6b3).(int me) { Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 10, 12, 0.3f, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!); }
4952
4953 // Sets the Current Mode
4954 void Liftercxx . . $ Lifter#::SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(int me, char mode) {
4955 int flags;
4956
4957 // mprintf(0, "From mode %d, ",memory->mode);
4958
4959 // Clear out any non-Dallas assigned goals
4960 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
4961
4962 // Do mode specific setups
4963 switch (mode) {
4964 case LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`!: {
4965 mprintfcxx . . $ mprintf.(0, "Passive mode set.\n");
4966
4967 // Disable auto-targeting
4968 flags = AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!;
4969 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4970
4971 // Set to team neutral
4972 aAISetTeamcxx . . $ aAISetTeam(3e454b8ccf442868).(AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!, me);
4973
4974 // Set speed for this mode
4975 SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed.);
4976
4977 // Play the looping idle animation
4978 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 1, 10, 1.6f, AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, lifter_amb_sound_idcxx . . $ lifter_amb_sound_id., -1);
4979 } break;
4980
4981 case LIFTER_AGITATEDcxx . . $ `scripts/AIGame3.cpp:1016:9`!: {
4982 mprintfcxx . . $ mprintf.(0, "Agitated mode set.\n");
4983
4984 // Disable auto-targeting
4985 flags = AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!;
4986 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
4987
4988 // Set to team neutral
4989 aAISetTeamcxx . . $ aAISetTeam(3e454b8ccf442868).(AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!, me);
4990
4991 // Set speed for this mode
4992 SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed. * LIFTER_AGITATED_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1051:9`!);
4993 } break;
4994
4995 case LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`!: {
4996 mprintfcxx . . $ mprintf.(0, "Hostile mode set.\n");
4997
4998 // Set hostile melee attack
4999 flags = AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`!;
5000 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5001 flags = AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
5002 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5003
5004 // Enable auto-targeting
5005 flags = AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!;
5006 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5007
5008 // Set to team PTMC
5009 aAISetTeamcxx . . $ aAISetTeam(3e454b8ccf442868).(AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!, me);
5010
5011 // Set melee mode
5012 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!);
5013
5014 // Set speed for this mode
5015 SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed. * LIFTER_HOSTILE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1052:9`!);
5016
5017 // Set the hostile flag
5018 memorycxx . . $ Lifter#memory.->not_hostile_yetcxx . . $ lifter_data#not_hostile_yet. = false;
5019 } break;
5020
5021 case LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!: {
5022 mprintfcxx . . $ mprintf.(0, "Pulling mode set.\n");
5023
5024 // Set pull melee attack
5025 flags = AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
5026 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5027 flags = AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`!;
5028 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5029
5030 // Disable auto-targeting so it can't acquire a new target
5031 flags = AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!;
5032 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5033
5034 // NOTE: don't change teams here (needs to keep current target)!
5035
5036 // Set melee mode
5037 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!);
5038
5039 // Set speed for this mode
5040 SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed. * LIFTER_PULLING_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1053:9`!);
5041
5042 // Confine the target's movement
5043 ConfineTargetcxx . . $ Lifter#ConfineTarget(d4f767463ce0a6b3).(me);
5044
5045 // Move the target prop
5046 MoveTargetPropcxx . . $ Lifter#MoveTargetProp(d4f767463ce0a6b3).(memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.);
5047
5048 // Clear the last pull time
5049 memorycxx . . $ Lifter#memory.->last_target_pull_timecxx . . $ lifter_data#last_target_pull_time. = Game_GetTimecxx . . $ Game_GetTime.();
5050 } break;
5051
5052 case LIFTER_PASSIFYINGcxx . . $ `scripts/AIGame3.cpp:1019:9`!: {
5053 mprintfcxx . . $ mprintf.(0, "Passifying mode set.\n");
5054
5055 // Disable auto-targeting
5056 flags = AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!;
5057 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5058
5059 // Set to team neutral
5060 aAISetTeamcxx . . $ aAISetTeam(3e454b8ccf442868).(AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!, me);
5061
5062 // Set speed for this mode
5063 SetMaxSpeedcxx . . $ Lifter#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed.);
5064
5065 // Play the to idle animation
5066 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, 50, 52, 1.0f, 0, -1, -1);
5067 } break;
5068
5069 default:
5070 mprintfcxx . . $ mprintf.(0, "Lifter is all messed up!\n");
5071 break;
5072 }
5073
5074 // Set the current mode and reset the mode time
5075 memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. = mode;
5076 memorycxx . . $ Lifter#memory.->mode_timecxx . . $ lifter_data#mode_time. = 0.0f;
5077 }
5078
5079 // Processes the AI Initialize event
5080 void Liftercxx . . $ Lifter#::DoInitcxx . . $ Lifter#DoInit(d4f767463ce0a6b3).(int me) {
5081 // Setup memory data
5082 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
5083 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = HT_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:890:9`!;
5084 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(lifter_datacxx . . $ lifter_data#);
5085 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
5086 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
5087
5088 memorycxx . . $ Lifter#memory. = (lifter_datacxx . . $ lifter_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
5089
5090 // Init base values
5091 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ Lifter#memory.->base_speedcxx . . $ lifter_data#base_speed.);
5092 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ Lifter#memory.->base_shieldscxx . . $ lifter_data#base_shields.);
5093 memorycxx . . $ Lifter#memory.->shield_loss_margincxx . . $ lifter_data#shield_loss_margin. = memorycxx . . $ Lifter#memory.->base_shieldscxx . . $ lifter_data#base_shields. * LIFTER_LOSE_PULL_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1044:9`!;
5094
5095 memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
5096
5097 // Create and setup the beam pulling target prop object
5098 msafe_structcxx . . $ msafe_struct# mstruct;
5099 vectorcxx . . $ vector# pos;
5100 int room;
5101
5102 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
5103 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
5104
5105 memorycxx . . $ Lifter#memory.->pull_target_propcxx . . $ lifter_data#pull_target_prop. = Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, powerup_idcxx . . $ powerup_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
5106 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ Lifter#memory.->pull_target_propcxx . . $ lifter_data#pull_target_prop.;
5107 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
5108
5109 // Create the source tractor beam prop
5110 memorycxx . . $ Lifter#memory.->pull_source_propcxx . . $ lifter_data#pull_source_prop. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me, "STEmitter", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 1, 0, true, true);
5111
5112 // Init time values
5113 memorycxx . . $ Lifter#memory.->last_damaged_timecxx . . $ lifter_data#last_damaged_time. = Game_GetTimecxx . . $ Game_GetTime.();
5114 memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time. = Game_GetTimecxx . . $ Game_GetTime.();
5115 memorycxx . . $ Lifter#memory.->last_target_pull_timecxx . . $ lifter_data#last_target_pull_time. = Game_GetTimecxx . . $ Game_GetTime.();
5116 memorycxx . . $ Lifter#memory.->next_lift_beam_timecxx . . $ lifter_data#next_lift_beam_time. = Game_GetTimecxx . . $ Game_GetTime.();
5117
5118 // Set the attacked flag
5119 memorycxx . . $ Lifter#memory.->not_hostile_yetcxx . . $ lifter_data#not_hostile_yet. = true;
5120
5121 // Create the lifter's stick effect
5122 aLightningCreateGunpointscxx . . $ aLightningCreateGunpoints(fefaa2133ec6ef6d).(0, 1, me, 1000000000.0f, 2.0f, 2, lifter_stick_effect_idcxx . . $ lifter_stick_effect_id., 0.5f, 1, 255, 255, 255, false);
5123
5124 // Start out in normal attack mode
5125 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`!);
5126 }
5127
5128 // Process all AI Notify events
5129 bool Liftercxx . . $ Lifter#::DoNotifycxx . . $ Lifter#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
5130 if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_TARGET_DIEDcxx . . $ `Descent3/aistruct_external.h:292:9`!) {
5131 if (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. == LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!) {
5132 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(me);
5133 }
5134 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_MELEE_HITcxx . . $ `Descent3/aistruct_external.h:308:9`!) {
5135 // If we are pulling
5136 if (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. == LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!) {
5137 // Create hit sparks
5138 int room;
5139 vectorcxx . . $ vector# pos;
5140 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
5141 Obj_GetGunPoscxx . . $ Obj_GetGunPos(acebd7a68d406969).(me, 1, &pos);
5142 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(20, &pos, room);
5143
5144 // Stop pulling
5145 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(me);
5146
5147 // Create the concussive hit blast
5148 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
5149 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
5150 // Obj_GetGunPos(me, 2, &pos);
5151 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, lifter_blast_effect_idcxx . . $ lifter_blast_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
5152 }
5153 }
5154
5155 return true;
5156 }
5157
5158 // Processes the AI Frame Interval Event
5159 void Liftercxx . . $ Lifter#::DoFramecxx . . $ Lifter#DoFrame(d4f767463ce0a6b3).(int me) {
5160 float last_see_time, last_see_game_time;
5161 float last_hear_time, last_hear_game_time;
5162 float last_perceive_time;
5163 float curr_anim_frame;
5164
5165 // Get the last see and hear time
5166 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_SEE_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:530:9`!, &last_see_game_time);
5167 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_HEAR_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:558:9`!, &last_hear_game_time);
5168
5169 // Calculate the time since target was seen or heard
5170 last_hear_time = Game_GetTimecxx . . $ Game_GetTime.() - last_hear_game_time;
5171 last_see_time = Game_GetTimecxx . . $ Game_GetTime.() - last_see_game_time;
5172
5173 // Perceive time is last time target was seen or heard (whichever is smalled)
5174 if (last_hear_time <= last_see_time) {
5175 last_perceive_time = last_hear_time;
5176 } else {
5177 last_perceive_time = last_see_time;
5178 }
5179
5180 // Get the current animation frame
5181 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &curr_anim_frame);
5182
5183 // Do mode specific checks
5184 switch (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode.) {
5185 case LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`!: {
5186 } break;
5187
5188 case LIFTER_AGITATEDcxx . . $ `scripts/AIGame3.cpp:1016:9`!: {
5189 // If we've been agitated for a little while, and are damaged enough, switch to hostile
5190 if (memorycxx . . $ Lifter#memory.->mode_timecxx . . $ lifter_data#mode_time. > LIFTER_MIN_AGITATED_MODE_TIMEcxx . . $ `scripts/AIGame3.cpp:1036:9`!) {
5191 float curr_shields;
5192 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &curr_shields);
5193 if (curr_shields < (memorycxx . . $ Lifter#memory.->base_shieldscxx . . $ lifter_data#base_shields. * LIFTER_HOSTILE_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1042:9`!)) {
5194 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`!);
5195 break;
5196 }
5197
5198 // If we haven't been damaged in a while, become passive again
5199 float time_since_damaged;
5200 time_since_damaged = Game_GetTimecxx . . $ Game_GetTime.() - memorycxx . . $ Lifter#memory.->last_damaged_timecxx . . $ lifter_data#last_damaged_time.;
5201 if (time_since_damaged >= LIFTER_AGITATED_INTEREST_TIMEcxx . . $ `scripts/AIGame3.cpp:1038:9`!) {
5202 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_PASSIFYINGcxx . . $ `scripts/AIGame3.cpp:1019:9`!);
5203 break;
5204 }
5205 }
5206 } break;
5207
5208 case LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`!: {
5209 // If hostile for a while, and haven't been damaged in a while, become passive
5210 if (memorycxx . . $ Lifter#memory.->mode_timecxx . . $ lifter_data#mode_time. > LIFTER_MIN_HOSTILE_MODE_TIMEcxx . . $ `scripts/AIGame3.cpp:1035:9`!) {
5211 float time_since_damaged;
5212
5213 time_since_damaged = Game_GetTimecxx . . $ Game_GetTime.() - memorycxx . . $ Lifter#memory.->last_damaged_timecxx . . $ lifter_data#last_damaged_time.;
5214 if (time_since_damaged >= LIFTER_HOSTILE_INTEREST_TIMEcxx . . $ `scripts/AIGame3.cpp:1039:9`!) {
5215 char type;
5216 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
5217
5218 // Wait until the current anim type is alert, then return to passive
5219 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
5220 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_PASSIFYINGcxx . . $ `scripts/AIGame3.cpp:1019:9`!);
5221 break;
5222 }
5223 }
5224 }
5225
5226 // See if we should do a tractor beam pull
5227 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time.) {
5228 memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + LIFTER_PULL_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1025:9`!;
5229
5230 // See if it's possible to start pulling target
5231 if (OkToPullcxx . . $ Lifter#OkToPull(9609253e83e89946).(me)) {
5232 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(lifter_pull_sound_idcxx . . $ lifter_pull_sound_id., me, 1.0f);
5233
5234 // Switch to pulling mode
5235 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!);
5236 break;
5237 }
5238 }
5239 } break;
5240
5241 case LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!: {
5242 // See if we should update the tractor beam and validate the current pull situation
5243 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time.) {
5244 memorycxx . . $ Lifter#memory.->next_pull_check_timecxx . . $ lifter_data#next_pull_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + LIFTER_PULL_VALIDATE_INTERVALcxx . . $ `scripts/AIGame3.cpp:1026:9`!;
5245
5246 // See if the pulling operation is still valid
5247 if (OkToPullcxx . . $ Lifter#OkToPull(9609253e83e89946).(me, false)) {
5248 UpdateTractorBeamcxx . . $ Lifter#UpdateTractorBeam(d4f767463ce0a6b3).(me);
5249 } else {
5250 // Otherwise, quit pulling
5251 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(me);
5252 break;
5253 }
5254 }
5255
5256 // Pull the target forward
5257 bool not_multiplayer = true;
5258 if (not_multiplayer || (Game_GetTimecxx . . $ Game_GetTime.() - memorycxx . . $ Lifter#memory.->last_target_pull_timecxx . . $ lifter_data#last_target_pull_time.) >= LIFTER_PULL_TARGET_INTERVALcxx . . $ `scripts/AIGame3.cpp:1027:9`!) {
5259 PullTargetcxx . . $ Lifter#PullTarget(d4f767463ce0a6b3).(me);
5260 }
5261
5262 // Have we reached the maximum pulling time?
5263 if (memorycxx . . $ Lifter#memory.->mode_timecxx . . $ lifter_data#mode_time. > LIFTER_MAX_PULL_TIMEcxx . . $ `scripts/AIGame3.cpp:1024:9`!) {
5264 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(me);
5265 break;
5266 }
5267 } break;
5268
5269 case LIFTER_PASSIFYINGcxx . . $ `scripts/AIGame3.cpp:1019:9`!: {
5270 float curr_anim_frame;
5271
5272 // Get the current animation frame
5273 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &curr_anim_frame);
5274
5275 // See if we can return to passive yet
5276 if (curr_anim_frame == 52) {
5277 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`!);
5278 break;
5279 }
5280 } break;
5281
5282 default:
5283 mprintfcxx . . $ mprintf.(0, "Lifter is all messed up!\n");
5284 break;
5285 }
5286
5287 // If we're carrying anything, display the carry beam
5288 UpdateLiftBeamcxx . . $ Lifter#UpdateLiftBeam(d4f767463ce0a6b3).(me);
5289
5290 // Increment the current mode time
5291 memorycxx . . $ Lifter#memory.->mode_timecxx . . $ lifter_data#mode_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
5292 }
5293
5294 // Handles the healing effects
5295 void Liftercxx . . $ Lifter#::UpdateLiftBeamcxx . . $ Lifter#UpdateLiftBeam(d4f767463ce0a6b3).(int me) {
5296 // See if it's time to create the next energy effect
5297 if (memorycxx . . $ Lifter#memory.->next_lift_beam_timecxx . . $ lifter_data#next_lift_beam_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
5298 float next_duration = LIFTER_LIFT_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:1048:9`!;
5299
5300 memorycxx . . $ Lifter#memory.->next_lift_beam_timecxx . . $ lifter_data#next_lift_beam_time. = Game_GetTimecxx . . $ Game_GetTime.() + next_duration;
5301
5302 // See if we're carrying an object
5303 int attached_handle = Obj_GetAttachChildHandlecxx . . $ Obj_GetAttachChildHandle.(me, 0);
5304 if (attached_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
5305 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(me, attached_handle, next_duration, 2.0f, 2, boss_heal_effect_idcxx . . $ boss_heal_effect_id., next_duration, 1, 255, 255,
5306 255, false);
5307 }
5308 }
5309 }
5310
5311 // Processes incoming damage reports
5312 void Liftercxx . . $ Lifter#::DoDamagecxx . . $ Lifter#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data) {
5313 memorycxx . . $ Lifter#memory.->last_damaged_timecxx . . $ lifter_data#last_damaged_time. = Game_GetTimecxx . . $ Game_GetTime.();
5314
5315 if (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. == LIFTER_PASSIVEcxx . . $ `scripts/AIGame3.cpp:1015:9`!) {
5316 if (memorycxx . . $ Lifter#memory.->not_hostile_yetcxx . . $ lifter_data#not_hostile_yet.) {
5317 // If not hostile yet, check to see if we should be agitated
5318 float curr_shields;
5319 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &curr_shields);
5320 if (curr_shields < (memorycxx . . $ Lifter#memory.->base_shieldscxx . . $ lifter_data#base_shields. * LIFTER_AGITATED_SHIELD_PERCENTcxx . . $ `scripts/AIGame3.cpp:1041:9`!)) {
5321 SwitchToAlertcxx . . $ Lifter#SwitchToAlert(d4f767463ce0a6b3).(me);
5322 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_AGITATEDcxx . . $ `scripts/AIGame3.cpp:1016:9`!);
5323 return;
5324 }
5325 } else {
5326 // If we've been hostile already, just switch right back into hostile mode
5327 SwitchToAlertcxx . . $ Lifter#SwitchToAlert(d4f767463ce0a6b3).(me);
5328 SetModecxx . . $ Lifter#SetMode(5016a63d0a5aceb0).(me, LIFTER_HOSTILEcxx . . $ `scripts/AIGame3.cpp:1017:9`!);
5329 return;
5330 }
5331 } else if (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. == LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`!) {
5332 float curr_shields, damage_done_during_pull;
5333
5334 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &curr_shields);
5335 damage_done_during_pull = memorycxx . . $ Lifter#memory.->shields_at_pull_startcxx . . $ lifter_data#shields_at_pull_start. - curr_shields;
5336 if (damage_done_during_pull >= memorycxx . . $ Lifter#memory.->shield_loss_margincxx . . $ lifter_data#shield_loss_margin.) {
5337 // Create tractor beam device sparks
5338 int room;
5339 vectorcxx . . $ vector# pos;
5340 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ Lifter#memory.->pull_source_propcxx . . $ lifter_data#pull_source_prop., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
5341 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ Lifter#memory.->pull_source_propcxx . . $ lifter_data#pull_source_prop., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
5342 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(15, &pos, room);
5343
5344 // Stop pulling
5345 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(me);
5346 }
5347 }
5348 }
5349
5350 // Something collided with lifter
5351 void Liftercxx . . $ Lifter#::DoCollidecxx . . $ Lifter#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data) {}
5352
5353 // Does any final cleanup when object is destroyed
5354 void Liftercxx . . $ Lifter#::DoCleanUpcxx . . $ Lifter#DoCleanUp(d4f767463ce0a6b3).(int me) {
5355 // remove the powerup props
5356 msafe_structcxx . . $ msafe_struct# mo;
5357 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ Lifter#memory.->pull_source_propcxx . . $ lifter_data#pull_source_prop.;
5358 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
5359 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ Lifter#memory.->pull_target_propcxx . . $ lifter_data#pull_target_prop.;
5360 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
5361
5362 // if we're pulling a target, release it
5363 if (memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
5364 ReleaseTargetcxx . . $ Lifter#ReleaseTarget(d4f767463ce0a6b3).(me);
5365 }
5366 }
5367
5368 // Receives all basic events and calls processesing functions
5369 int16_t Liftercxx . . $ Lifter#::CallEventcxx . . $ Lifter#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
5370 switch (event) {
5371 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
5372 DoInitcxx . . $ Lifter#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
5373 break;
5374 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
5375 DoFramecxx . . $ Lifter#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
5376 break;
5377 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
5378 return (DoNotifycxx . . $ Lifter#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
5379 break;
5380 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
5381 DoDamagecxx . . $ Lifter#DoDamage(1a3e688ec82e7ded).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged.);
5382 break;
5383 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
5384 DoCleanUpcxx . . $ Lifter#DoCleanUp(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
5385 break;
5386 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
5387 DoCollidecxx . . $ Lifter#DoCollide(bbb8461685d7aa69).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide.);
5388 break;
5389 case EVT_PLAYER_DIEScxx . . $ `scripts/osiris_common.h:400:9`!:
5390 if (memorycxx . . $ Lifter#memory.->modecxx . . $ lifter_data#mode. == LIFTER_PULLINGcxx . . $ `scripts/AIGame3.cpp:1018:9`! && data->evt_player_diescxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_player_dies..it_handlecxx . . $ tOSIRISEVTPLAYERDIES#it_handle. == memorycxx . . $ Lifter#memory.->pull_targetcxx . . $ lifter_data#pull_target.) {
5391 StopPullingcxx . . $ Lifter#StopPulling(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
5392 }
5393 break;
5394 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
5395 memorycxx . . $ Lifter#memory. = (lifter_datacxx . . $ lifter_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
5396 break;
5397 }
5398
5399 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
5400 }
5401
5402 //-----------------
5403 // AlienBoss class
5404 //-----------------
5405
5406 // Sends a command out to alien boss
5407 bool AlienBosscxx . . $ AlienBoss#::SendCommandcxx . . $ AlienBoss#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
5408 bot_comcxx . . $ bot_com# com;
5409
5410 com.actioncxx . . $ bot_com#action. = command;
5411 com.ptrcxx . . $ bot_com#ptr. = ptr;
5412
5413 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
5414
5415 ei.me_handlecxx . . $ tOSIRISEventInfo#me_handle. = it;
5416 ei.extra_infocxx . . $ tOSIRISEventInfo#extra_info. = (void *)&com;
5417 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!;
5418 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = me;
5419
5420 return Obj_CallEventcxx . . $ Obj_CallEvent.(it, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei);
5421 }
5422
5423 // Processes a command from another alien
5424 bool AlienBosscxx . . $ AlienBoss#::ReceiveCommandcxx . . $ AlienBoss#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
5425 switch (command) {
5426 case AB_COM_THRUSTER_IS_FIRINGcxx . . $ `scripts/AIGame3_External.h:37:9`!: {
5427 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!) {
5428 // Set to the death mode for final dallas-controlled cinematic
5429 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_DYINGcxx . . $ `scripts/AIGame3.cpp:1132:9`!);
5430
5431 // Let dallas know that we were healing
5432 *(bool *)ptr = true;
5433 } else {
5434 // Run away from flame if necessary
5435 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_HIDING_FROM_THRUSTERcxx . . $ `scripts/AIGame3.cpp:1130:9`!);
5436
5437 // Let dallas know that we weren't healing
5438 *(bool *)ptr = false;
5439 }
5440 } break;
5441
5442 case AB_COM_THRUSTER_MISFIREDcxx . . $ `scripts/AIGame3_External.h:38:9`!: {
5443 // Time to go protect the nest
5444 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!);
5445 } break;
5446
5447 case AB_COM_ITS_SHOWTIMEcxx . . $ `scripts/AIGame3_External.h:42:9`!: {
5448 // Make it start out in reverse
5449 memorycxx . . $ AlienBoss#memory.->wander_forwardcxx . . $ alienboss_data#wander_forward. = false;
5450
5451 // Set the intro end time
5452 memorycxx . . $ AlienBoss#memory.->intro_end_timecxx . . $ alienboss_data#intro_end_time. = *(float *)ptr;
5453 memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended. = false;
5454
5455 // Time to go protect the nest
5456 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`!);
5457 } break;
5458
5459 case AB_COM_START_WAITING_EFFECTcxx . . $ `scripts/AIGame3_External.h:43:9`!: {
5460 // Make it start out in reverse
5461 memorycxx . . $ AlienBoss#memory.->waiting_effect_enabledcxx . . $ alienboss_data#waiting_effect_enabled. = true;
5462 } break;
5463
5464 case AB_COM_THRUSTER_IGNITEDcxx . . $ `scripts/AIGame3_External.h:41:9`!: {
5465 // This makes us angry
5466 memorycxx . . $ AlienBoss#memory.->statecxx . . $ alienboss_data#state. = AB_ANGRYcxx . . $ `scripts/AIGame3.cpp:1139:9`!;
5467
5468 // Set the new damage level
5469 memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold. = AB_ANGRY_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1150:9`! * memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields.;
5470
5471 // Make it slightly faster
5472 memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. *= 1.05f;
5473
5474 mprintfcxx . . $ mprintf.(0, "Alien Boss is now angry.\n");
5475 } break;
5476
5477 case AB_COM_SET_SCENARIO_IDScxx . . $ `scripts/AIGame3_External.h:39:9`!: {
5478 ab_scenario_idscxx . . $ ab_scenario_ids# *ids = (ab_scenario_idscxx . . $ ab_scenario_ids# *)ptr;
5479
5480 memorycxx . . $ AlienBoss#memory.->nest_handlecxx . . $ alienboss_data#nest_handle. = ids->nest_handlecxx . . $ ab_scenario_ids#nest_handle.;
5481 memorycxx . . $ AlienBoss#memory.->left_hide_roomcxx . . $ alienboss_data#left_hide_room. = ids->left_hide_roomcxx . . $ ab_scenario_ids#left_hide_room.;
5482 memorycxx . . $ AlienBoss#memory.->right_hide_roomcxx . . $ alienboss_data#right_hide_room. = ids->right_hide_roomcxx . . $ ab_scenario_ids#right_hide_room.;
5483
5484 mprintfcxx . . $ mprintf.(0, "Set scenario ids.\n");
5485 } break;
5486
5487 case AB_COM_IS_NESTINGcxx . . $ `scripts/AIGame3_External.h:40:9`!: {
5488 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!) {
5489 *(bool *)ptr = true;
5490 } else {
5491 *(bool *)ptr = false;
5492 }
5493 } break;
5494 }
5495
5496 // mprintf(0, "AlienOrganism action %d failed\n");
5497 return false;
5498 }
5499
5500 // Sets the alien boss's max speed
5501 void AlienBosscxx . . $ AlienBoss#::SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(int me, float speed) { AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &speed); }
5502
5503 // Checks to see if alien is currently on fire
5504 bool AlienBosscxx . . $ AlienBoss#::IsOnFirecxx . . $ AlienBoss#IsOnFire(83c267b20bac841a).(int me) { return (Obj_IsEffectcxx . . $ Obj_IsEffect.(me, EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)); }
5505
5506 // Sets wandering destination goal for boss
5507 void AlienBosscxx . . $ AlienBoss#::SetWanderGoalcxx . . $ AlienBoss#SetWanderGoal(d4f767463ce0a6b3).(int me) {
5508 vectorcxx . . $ vector# pos;
5509 int room = 0;
5510 float dist = 15.0f;
5511
5512 // If the destination object is valid, set the goals to go to that object
5513 if (memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
5514 int type;
5515 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_TYPEcxx . . $ `scripts/osiris_common.h:626:9`!, &type);
5516 if (type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) {
5517 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, 2, 1.0f, ALIEN_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:672:9`!,
5518 GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_USE_BLINE_IF_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:223:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!,
5519 memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle.);
5520 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
5521
5522 return;
5523 }
5524 memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
5525 }
5526
5527 // Set the goal to wander
5528 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, 2, 1.0f, -1, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, room, room);
5529 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
5530 }
5531
5532 // Sets goal to go to the current wander room
5533 void AlienBosscxx . . $ AlienBoss#::SetWanderRoomGoalcxx . . $ AlienBoss#SetWanderRoomGoal(d4f767463ce0a6b3).(int me) {
5534 vectorcxx . . $ vector# pos;
5535 int roomnum;
5536
5537 roomnum = memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index.];
5538
5539 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(roomnum, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &pos, 0);
5540 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, DEFAULT_INFLUENCEcxx . . $ `scripts/DallasFuncs.cpp:3464:9`!, AB_GUID_GOT_TO_WANDER_ROOMcxx . . $ `scripts/AIGame3.cpp:1181:9`!, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`!, &pos, roomnum);
5541
5542 // Save values for teleport
5543 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos;
5544 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = roomnum;
5545
5546 float dist = 35.0f;
5547 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
5548 }
5549
5550 // Sets goal to go to the current wander room
5551 void AlienBosscxx . . $ AlienBoss#::SetProtectNestGoalcxx . . $ AlienBoss#SetProtectNestGoal(d4f767463ce0a6b3).(int me) {
5552 vectorcxx . . $ vector# pos;
5553 int roomnum;
5554
5555 // Go to the nest room (first room is list)
5556 roomnum = memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0];
5557
5558 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(roomnum, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &pos, 0);
5559 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, DEFAULT_INFLUENCEcxx . . $ `scripts/DallasFuncs.cpp:3464:9`!, AB_GUID_GOT_TO_NEST_ROOMcxx . . $ `scripts/AIGame3.cpp:1182:9`!, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`!, &pos, roomnum);
5560
5561 // Save values for teleport
5562 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos;
5563 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = roomnum;
5564
5565 float dist = 35.0f;
5566 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
5567 }
5568
5569 // Sets goal to go to the current wander room
5570 void AlienBosscxx . . $ AlienBoss#::SetHideRoomGoalcxx . . $ AlienBoss#SetHideRoomGoal(d4f767463ce0a6b3).(int me) {
5571 vectorcxx . . $ vector# pos, left_room_pos, right_room_pos, my_pos;
5572 int roomnum;
5573 float left_room_dist;
5574 float right_room_dist;
5575
5576 // Get current position
5577 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
5578
5579 // Get positions of hide rooms
5580 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->left_hide_roomcxx . . $ alienboss_data#left_hide_room., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &left_room_pos, 0);
5581 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->right_hide_roomcxx . . $ alienboss_data#right_hide_room., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &right_room_pos, 0);
5582
5583 // Get the distance to each hide room
5584 left_room_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&my_pos, &left_room_pos);
5585 right_room_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&my_pos, &right_room_pos);
5586
5587 // Determine the closest hide room, and go to it
5588 if (left_room_dist < right_room_dist) {
5589 roomnum = memorycxx . . $ AlienBoss#memory.->left_hide_roomcxx . . $ alienboss_data#left_hide_room.;
5590 pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). left_room_pos;
5591 } else {
5592 roomnum = memorycxx . . $ AlienBoss#memory.->right_hide_roomcxx . . $ alienboss_data#right_hide_room.;
5593 pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). right_room_pos;
5594 }
5595
5596 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(roomnum, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &pos, 0);
5597 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, DEFAULT_INFLUENCEcxx . . $ `scripts/DallasFuncs.cpp:3464:9`!, AB_GUID_GOT_TO_HIDE_ROOMcxx . . $ `scripts/AIGame3.cpp:1183:9`!,
5598 GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!, &pos, roomnum);
5599
5600 // Save values for teleport
5601 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos;
5602 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = roomnum;
5603
5604 float dist = 30.0f;
5605 AI_GoalValuecxx . . $ AI_GoalValue(bf765428094b1867).(me, 2, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIGV_F_CIRCLE_DISTcxx . . $ `scripts/osiris_common.h:592:9`!, &dist);
5606 }
5607
5608 // Returns the index of the wander room closest to current position
5609 int AlienBosscxx . . $ AlienBoss#::DetermineClosestRoomcxx . . $ AlienBoss#DetermineClosestRoom(7864480464b09eea).(int me) {
5610 int j, closest_room;
5611 float closest_dist, dist;
5612 vectorcxx . . $ vector# my_pos, room_pos;
5613
5614 // Get current position
5615 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
5616
5617 // Find the room closest to
5618 closest_room = 0;
5619 closest_dist = 10000;
5620 for (j = 0; j < AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`!; j++) {
5621 // Get room's position
5622 Room_Valuecxx . . $ Room_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[j], VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, RMSV_V_PATH_PNTcxx . . $ `scripts/osiris_common.h:689:9`!, &room_pos, 0);
5623
5624 // Get the distance to this room
5625 dist = vm_VectorDistanceQuickcxx . . $ vm_VectorDistanceQuick(a0b9c8659ecc16b8).(&my_pos, &room_pos);
5626
5627 // See if this room is closer than the currently closest room
5628 if (dist < closest_dist) {
5629 closest_room = j;
5630 closest_dist = dist;
5631 }
5632 }
5633
5634 mprintfcxx . . $ mprintf.(0, "Alien Boss - Determined closest wander room: %d\n", closest_room);
5635
5636 return closest_room;
5637 }
5638
5639 // Returns any current animations to alert
5640 void AlienBosscxx . . $ AlienBoss#::AbortCurrentModecxx . . $ AlienBoss#AbortCurrentMode(d4f767463ce0a6b3).(int me) {
5641 switch (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.) {
5642 case AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!: {
5643 // Stop the healing fog protection
5644 StopHealingcxx . . $ AlienBoss#StopHealing(d4f767463ce0a6b3).(me);
5645 } break;
5646
5647 case AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`!: {
5648 // Play the takeoff anim and tell it to go to alert next
5649 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_TAKEOFF_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1194:9`!, AB_TAKEOFF_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1195:9`!, AB_TAKEOFF_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1196:9`!, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1,
5650 AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
5651 } break;
5652
5653 case AB_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1121:9`!: {
5654 // Play rest of attack animation and return to alert
5655 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_RECOIL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1202:9`!, AB_RECOIL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1203:9`!, AB_RECOIL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1204:9`!, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
5656 } break;
5657 }
5658 }
5659
5660 // Handles the healing effects
5661 void AlienBosscxx . . $ AlienBoss#::UpdateHealingEnergyBeamscxx . . $ AlienBoss#UpdateHealingEnergyBeams(d4f767463ce0a6b3).(int me) {
5662 // See if it's time to create the next energy effect
5663 if (memorycxx . . $ AlienBoss#memory.->next_update_beam_timecxx . . $ alienboss_data#next_update_beam_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
5664 float next_duration = AB_BEAM_UPDATE_TIMEcxx . . $ `scripts/AIGame3.cpp:1146:9`!;
5665
5666 memorycxx . . $ AlienBoss#memory.->next_update_beam_timecxx . . $ alienboss_data#next_update_beam_time. = Game_GetTimecxx . . $ Game_GetTime.() + next_duration;
5667
5668 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle., memorycxx . . $ AlienBoss#memory.->nest_handlecxx . . $ alienboss_data#nest_handle., next_duration, 1.0f, 2, boss_heal_effect_idcxx . . $ boss_heal_effect_id.,
5669 next_duration, 1, 255, 255, 255, false);
5670
5671 // Create healing sparks
5672 int room;
5673 vectorcxx . . $ vector# pos;
5674 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
5675 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
5676 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(5, &pos, room);
5677 }
5678 }
5679
5680 // Handles the healing effects
5681 void AlienBosscxx . . $ AlienBoss#::UpdateDamageEffectcxx . . $ AlienBoss#UpdateDamageEffect(d4f767463ce0a6b3).(int me) {
5682 // See if it's time to create the next energy effect
5683 if (memorycxx . . $ AlienBoss#memory.->next_damage_effect_timecxx . . $ alienboss_data#next_damage_effect_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
5684 memorycxx . . $ AlienBoss#memory.->next_damage_effect_timecxx . . $ alienboss_data#next_damage_effect_time. = Game_GetTimecxx . . $ Game_GetTime.() + AB_DAMAGE_EFFECT_INTERVALcxx . . $ `scripts/AIGame3.cpp:1158:9`!;
5685
5686 float curr_damage;
5687 curr_damage = memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage.;
5688 if (curr_damage > memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold.)
5689 curr_damage = memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold.;
5690
5691 if (curr_damage > 0.0f && memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold. != 0.0f) {
5692 float spark_rate;
5693
5694 spark_rate = (curr_damage / memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold.) * AB_MAX_DAMAGE_SPARK_RATEcxx . . $ `scripts/AIGame3.cpp:1159:9`!;
5695 aObjSparkcxx . . $ aObjSpark(3b3943b4e4191a93).(me, spark_rate, AB_DAMAGE_EFFECT_INTERVALcxx . . $ `scripts/AIGame3.cpp:1158:9`!);
5696 }
5697
5698 // do the following for debugging purposes
5699 // Obj_Create(OBJ_WEAPON, teleport_effect_id, memory->dest_room, &memory->dest_pos, NULL, me);
5700 }
5701 }
5702
5703 // Start healing fog protection
5704 void AlienBosscxx . . $ AlienBoss#::StartHealingcxx . . $ AlienBoss#StartHealing(d4f767463ce0a6b3).(int me) {
5705 // Set the green healing fog
5706 aRoomChangeFogcxx . . $ aRoomChangeFog(1b654de4a593e534).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1.0f, 0.0f, 800.0f, 2.0f);
5707
5708 // Set the room damage
5709 aRoomSetDamagecxx . . $ aRoomSetDamage(d6d7ce2c0b3115db).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 5.0f, 1);
5710 }
5711
5712 // End healing fog protection
5713 void AlienBosscxx . . $ AlienBoss#::StopHealingcxx . . $ AlienBoss#StopHealing(d4f767463ce0a6b3).(int me) {
5714 // Set the green healing fog
5715 aRoomChangeFogcxx . . $ aRoomChangeFog(1b654de4a593e534).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1.0f, 0.0f, 9000.0f, 4.0f);
5716
5717 // Set the room damage
5718 aRoomSetDamagecxx . . $ aRoomSetDamage(d6d7ce2c0b3115db).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1);
5719 }
5720
5721 // Checks if the given mode should do stuck prevention
5722 bool AlienBosscxx . . $ AlienBoss#::ModeIsStuckSensitivecxx . . $ AlienBoss#ModeIsStuckSensitive(83c267b20bac841a).(int mode) {
5723 if (mode == AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`! || mode == AB_GOING_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1125:9`! || mode == AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`! ||
5724 mode == AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!) {
5725 return true;
5726 }
5727
5728 return false;
5729 }
5730
5731 // Sets the Current Mode
5732 void AlienBosscxx . . $ AlienBoss#::SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(int me, char mode) {
5733 mprintfcxx . . $ mprintf.(0, "From mode %d, ", memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.);
5734
5735 int flags;
5736 char movement_type;
5737 vectorcxx . . $ vector# vel;
5738
5739 // Clear out any goals
5740 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!);
5741
5742 // Set normal FOV to 360
5743 float fov = -1.0f;
5744 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
5745
5746 // Turn off ranged firing
5747 flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
5748 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5749
5750 // Turn off melee attacks
5751 flags = AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`! | AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
5752 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5753
5754 // Make it always aware
5755 flags = AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!;
5756 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5757
5758 // Do mode specific setups
5759 switch (mode) {
5760 case AB_GOING_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1125:9`!: {
5761 mprintfcxx . . $ mprintf.(0, "Going to Nest mode set.\n");
5762
5763 ray_infocxx . . $ ray_info# ray;
5764 int fate;
5765 vectorcxx . . $ vector# end_pos, landing_pos;
5766 int end_room, landing_room;
5767
5768 // If currently landed, set take off velocity
5769 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
5770
5771 // Set movement type back to physics for flying around
5772 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
5773 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5774
5775 // Calculate destination home point a int16_t distance from actual landing point
5776 end_pos =cxx . . $ vector#`operator=`(c0842353a20857d). memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos. +cxx . . $ operator+(b77b703cd1e43e33). (memorycxx . . $ AlienBoss#memory.->home_uveccxx . . $ alienboss_data#home_uvec. *cxx . . $ `operator*`(252247219a31502c). 20.0f);
5777
5778 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`! |
5779 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
5780 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos., &end_pos, memorycxx . . $ AlienBoss#memory.->home_roomcxx . . $ alienboss_data#home_room., 0.0f, flags, &ray);
5781
5782 landing_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ray.hit_pointcxx . . $ ray_info#hit_point.;
5783 landing_room = ray.hit_roomcxx . . $ ray_info#hit_room.;
5784
5785 // Set goal to head home
5786 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, 1.0f, AB_GUID_GOT_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1178:9`!, GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`!, &landing_pos, landing_room);
5787 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me, 2, 2.0f);
5788
5789 // Save values for teleport
5790 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). landing_pos;
5791 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = landing_room;
5792
5793 // Set returning home speed
5794 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1211:9`!);
5795
5796 // Clear the next activity time
5797 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = 0.0f;
5798
5799 // Clear the next wander time
5800 memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time. = 0.0f;
5801 } break;
5802
5803 case AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`!: {
5804 mprintfcxx . . $ mprintf.(0, "Landing at Nest mode set.\n");
5805
5806 // If currently landed, set take off velocity
5807 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
5808
5809 // Turn off dodging
5810 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
5811 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5812
5813 // Turn on point-collide-walls and lock axes
5814 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`! | PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!;
5815 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5816
5817 // Turn off auto-level
5818 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
5819 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5820
5821 // Set movement type back to physics for flying around
5822 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
5823 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5824
5825 // Make him land at his home point
5826 AI_AddGoalcxx . . $ AI_AddGoal.(me, AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!, 2, 100.0f, AB_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:1179:9`!,
5827 GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`! | GF_ORIENT_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:234:9`!, &memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos., memorycxx . . $ AlienBoss#memory.->home_roomcxx . . $ alienboss_data#home_room.);
5828 AI_SetGoalCircleDistcxx . . $ AI_SetGoalCircleDist.(me, 2, 0.0f);
5829
5830 // Save values for teleport
5831 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos.;
5832 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = memorycxx . . $ AlienBoss#memory.->home_roomcxx . . $ alienboss_data#home_room.;
5833
5834 // Play his landing animation
5835 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_LANDING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1190:9`!, AB_LANDING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1191:9`!, AB_LANDING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1192:9`!, 0, -1, -1);
5836
5837 // Set landing speed
5838 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_LAND_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1212:9`!);
5839
5840 // Clear the next activity time
5841 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = 0.0f;
5842
5843 // Clear the next wander time
5844 memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time. = 0.0f;
5845 } break;
5846
5847 case AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!: {
5848 mprintfcxx . . $ mprintf.(0, "Healing mode set.\n");
5849
5850 // Turn off dodging
5851 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
5852 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5853
5854 // Turn off auto-level
5855 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
5856 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5857
5858 // Turn on point-collide-walls and lock axes
5859 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`! | PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!;
5860 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5861
5862 // No movement allowed
5863 movement_type = MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!;
5864 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5865
5866 // Play his landing animation
5867 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_HEALING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1186:9`!, AB_HEALING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1187:9`!, AB_HEALING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1188:9`!, AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, -1, -1);
5868
5869 // Set landed speed
5870 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, 0.0f);
5871
5872 // Set the next activity time
5873 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ALIEN_LANDED_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:649:9`!;
5874
5875 // Start healing protection
5876 StartHealingcxx . . $ AlienBoss#StartHealing(d4f767463ce0a6b3).(me);
5877 } break;
5878
5879 case AB_WAITINGcxx . . $ `scripts/AIGame3.cpp:1133:9`!: {
5880 mprintfcxx . . $ mprintf.(0, "Waiting mode set.\n");
5881
5882 // Turn off dodging
5883 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
5884 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5885
5886 // Turn off auto-level
5887 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
5888 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5889
5890 // Turn on point-collide-walls and lock axes
5891 flags = PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`! | PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`!;
5892 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
5893
5894 // No movement allowed
5895 movement_type = MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!;
5896 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5897
5898 // Play his landing animation
5899 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_HEALING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1186:9`!, AB_HEALING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1187:9`!, AB_HEALING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1188:9`!, AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, -1, -1);
5900
5901 // Set landed speed
5902 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, 0.0f);
5903 } break;
5904
5905 case AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`!: {
5906 mprintfcxx . . $ mprintf.(0, "Wandering mode set.\n");
5907
5908 // If currently landed, set take off velocity
5909 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
5910
5911 // Set movement type back to physics for flying around
5912 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
5913 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5914
5915 // Get Closest wander room
5916 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. = DetermineClosestRoomcxx . . $ AlienBoss#DetermineClosestRoom(7864480464b09eea).(me);
5917 SetWanderRoomGoalcxx . . $ AlienBoss#SetWanderRoomGoal(d4f767463ce0a6b3).(me);
5918
5919 // Set wander speed
5920 if (memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended.) {
5921 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_WANDER_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1207:9`!);
5922 } else {
5923 // wander at fixed speed for the intro
5924 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, 30.0f);
5925 }
5926
5927 // Set the next activity check to happen within .4 to .8 seconds
5928 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 3.0f + 3.0f;
5929 } break;
5930
5931 case AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!: {
5932 mprintfcxx . . $ mprintf.(0, "Attacking mode set.\n");
5933
5934 // If currently landed, set take off velocity
5935 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
5936
5937 // Set attack FOV to 360
5938 float fov = -1.0f;
5939 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
5940
5941 // Set movement type back to physics for flying around
5942 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
5943 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
5944
5945 // Only set goals if not currently in squad formation
5946 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
5947
5948 // Turn on ranged firing
5949 flags = AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!;
5950 AI_Valuecxx . . $ AI_Value.(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5951
5952 // Turn on melee attacks
5953 flags = AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`! | AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
5954 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5955
5956 // Set Engage and Attack Speeds
5957 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1208:9`!);
5958
5959 // Set the next activity time
5960 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.0f;
5961
5962 // Clear the next wander time
5963 memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time. = 0.0f;
5964 } break;
5965
5966 case AB_MELEE_ATTACKcxx . . $ `scripts/AIGame3.cpp:1123:9`!: {
5967 mprintfcxx . . $ mprintf.(0, "Melee Attack mode set.\n");
5968
5969 // Set attack FOV to 360
5970 float fov = -1.0f;
5971 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
5972
5973 // Turn on melee attacks
5974 flags = AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`! | AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!;
5975 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
5976
5977 // Only set goals if not currently in squad formation
5978 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!);
5979
5980 // Set Engage and Attack Speeds
5981 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_MELEE_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1209:9`!);
5982 } break;
5983
5984 case AB_PREPARE_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1120:9`!: {
5985 mprintfcxx . . $ mprintf.(0, "Prepare Special Attack mode set.\n");
5986
5987 // Set attack FOV to 360
5988 float fov = -1.0f;
5989 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
5990
5991 // Only set goals if not currently in squad formation
5992 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
5993
5994 // Set Engage and Attack Speeds
5995 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_SPEC_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1210:9`!);
5996 } break;
5997
5998 case AB_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1121:9`!: {
5999 mprintfcxx . . $ mprintf.(0, "Special Attack mode set.\n");
6000
6001 // Set attack FOV to 360
6002 float fov = -1.0f;
6003 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
6004
6005 // Only set goals if not currently in squad formation
6006 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
6007
6008 // Play special attack animation
6009 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_ATTACK_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1198:9`!, AB_ATTACK_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1199:9`!, AB_ATTACK_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1200:9`!, 0, -1, -1);
6010
6011 // Set Engage and Attack Speeds
6012 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_SPEC_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1210:9`!);
6013 } break;
6014
6015 case AB_SPECIAL_ATTACK_RECOILcxx . . $ `scripts/AIGame3.cpp:1122:9`!: {
6016 mprintfcxx . . $ mprintf.(0, "Special Attack Recoil mode set.\n");
6017
6018 // Set attack FOV to 360
6019 float fov = -1.0f;
6020 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_FOVcxx . . $ `scripts/osiris_common.h:537:9`!, &fov);
6021
6022 // Only set goals if not currently in squad formation
6023 AI_SafeSetTypecxx . . $ AI_SafeSetType(3e454b8ccf442868).(me, AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!);
6024
6025 // Play special attack animation
6026 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_RECOIL_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1202:9`!, AB_RECOIL_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1203:9`!, AB_RECOIL_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1204:9`!, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1, AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
6027
6028 // Set Engage and Attack Speeds
6029 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_SPEC_ATTACK_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1210:9`!);
6030 } break;
6031
6032 case AB_FLEEINGcxx . . $ `scripts/AIGame3.cpp:1128:9`!: {
6033 mprintfcxx . . $ mprintf.(0, "Fleeing mode set.\n");
6034
6035 // If currently landed, set take off velocity
6036 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
6037
6038 // Set movement type back to physics for flying around
6039 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
6040 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
6041
6042 // Set Goal to go somewhere else
6043 SetWanderGoalcxx . . $ AlienBoss#SetWanderGoal(d4f767463ce0a6b3).(me);
6044
6045 // Set Fleeing Speed
6046 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_FLEE_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1213:9`!);
6047
6048 // Set the max time to flee (base time somewhat off of damage)
6049 float time_percent = (float(memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance.) / 100.0f);
6050 memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time. = ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f + AB_MAX_FLEE_TIMEcxx . . $ `scripts/AIGame3.cpp:1152:9`! * time_percent;
6051
6052 // Decrease the flee chance for next time
6053 memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance. -= AB_FLEE_CHANCE_DECREMENTcxx . . $ `scripts/AIGame3.cpp:1154:9`!;
6054 if (memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance. < 0.0f)
6055 memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance. = 0.0f;
6056 } break;
6057
6058 case AB_HIDING_FROM_THRUSTERcxx . . $ `scripts/AIGame3.cpp:1130:9`!: {
6059 mprintfcxx . . $ mprintf.(0, "Hiding from Thruster mode set.\n");
6060
6061 // Abort whatever mode we are in
6062 AbortCurrentModecxx . . $ AlienBoss#AbortCurrentMode(d4f767463ce0a6b3).(me);
6063
6064 // If currently landed, set take off velocity
6065 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
6066
6067 // Set movement type back to physics for flying around
6068 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
6069 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
6070
6071 // Determine closest hide room and go to it
6072 SetHideRoomGoalcxx . . $ AlienBoss#SetHideRoomGoal(d4f767463ce0a6b3).(me);
6073
6074 // Set returning home speed
6075 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1211:9`!);
6076
6077 } break;
6078
6079 case AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!: {
6080 mprintfcxx . . $ mprintf.(0, "Going to Protect Nest mode set.\n");
6081
6082 // Abort whatever mode we are in
6083 AbortCurrentModecxx . . $ AlienBoss#AbortCurrentMode(d4f767463ce0a6b3).(me);
6084
6085 // Set to protective state
6086 memorycxx . . $ AlienBoss#memory.->statecxx . . $ alienboss_data#state. = AB_PROTECTIVEcxx . . $ `scripts/AIGame3.cpp:1138:9`!;
6087
6088 // Set the new damage level
6089 memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold. = AB_PROTECTIVE_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1149:9`! * memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields.;
6090
6091 // If currently landed, set take off velocity
6092 DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(me, 8.0f, 3.0f);
6093
6094 // Set movement type back to physics for flying around
6095 movement_type = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!;
6096 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_C_MOVEMENT_TYPEcxx . . $ `scripts/osiris_common.h:638:9`!, &movement_type);
6097
6098 // Return to nest room
6099 SetProtectNestGoalcxx . . $ AlienBoss#SetProtectNestGoal(d4f767463ce0a6b3).(me);
6100
6101 // Set returning home speed
6102 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_RETURN_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1211:9`!);
6103 } break;
6104
6105 case AB_DYINGcxx . . $ `scripts/AIGame3.cpp:1132:9`!: {
6106 mprintfcxx . . $ mprintf.(0, "Dying mode set.\n");
6107
6108 // Set Engage and Attack Speeds
6109 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed.);
6110
6111 // Stop the healing room effects
6112 aRoomChangeFogcxx . . $ aRoomChangeFog(1b654de4a593e534).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1.0f, 0.0f, 9000.0f, 6.0f);
6113
6114 // Set the room damage
6115 aRoomSetDamagecxx . . $ aRoomSetDamage(d6d7ce2c0b3115db).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1);
6116 } break;
6117
6118 case AB_TELEPORTINGcxx . . $ `scripts/AIGame3.cpp:1134:9`!: {
6119 mprintfcxx . . $ mprintf.(0, "Teleporting mode set.\n");
6120
6121 // Start cloaking
6122 aCloakObjectcxx . . $ aCloakObject(43c79ee2f1b9aefe).(me, 0.0f);
6123
6124 // Save current mode so we can return to it once teleport is done
6125 memorycxx . . $ AlienBoss#memory.->mode_prior_teleportingcxx . . $ alienboss_data#mode_prior_teleporting. = memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.;
6126
6127 // set transfer flag
6128 memorycxx . . $ AlienBoss#memory.->did_transfercxx . . $ alienboss_data#did_transfer. = false;
6129 } break;
6130
6131 default:
6132 mprintfcxx . . $ mprintf.(0, "Alien Boss is all messed up!\n");
6133 }
6134
6135 // Reset the landing flags
6136 memorycxx . . $ AlienBoss#memory.->done_movingcxx . . $ alienboss_data#done_moving. = false;
6137 memorycxx . . $ AlienBoss#memory.->done_turningcxx . . $ alienboss_data#done_turning. = false;
6138
6139 // Set the current mode and reset the mode time
6140 memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. = mode;
6141 memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. = 0.0f;
6142
6143 // If we just switched to a stuck sensitive mode, clear out the values
6144 if (ModeIsStuckSensitivecxx . . $ AlienBoss#ModeIsStuckSensitive(83c267b20bac841a).(memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.)) {
6145 memorycxx . . $ AlienBoss#memory.->next_check_if_stuck_timecxx . . $ alienboss_data#next_check_if_stuck_time. = Game_GetTimecxx . . $ Game_GetTime.() + AB_CHECK_IF_STUCK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1174:9`!;
6146 memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved. = 0.0f;
6147 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &memorycxx . . $ AlienBoss#memory.->last_poscxx . . $ alienboss_data#last_pos.);
6148 }
6149 }
6150
6151 // Handles alien takeoffs
6152 void AlienBosscxx . . $ AlienBoss#::DoTakeoffcxx . . $ AlienBoss#DoTakeoff(3b3943b4e4191a93).(int me, float takeoff_speed, float speed_variance) {
6153 // If currently landed, set take off velocity
6154 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`! || memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_WAITINGcxx . . $ `scripts/AIGame3.cpp:1133:9`!) {
6155 vectorcxx . . $ vector# vel;
6156 int flags;
6157
6158 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel);
6159 vel +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (memorycxx . . $ AlienBoss#memory.->home_uveccxx . . $ alienboss_data#home_uvec. *cxx . . $ `operator*`(252247219a31502c). (takeoff_speed + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * speed_variance));
6160 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &vel);
6161
6162 // Play the takeoff anim and tell it to go to alert next
6163 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_TAKEOFF_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1194:9`!, AB_TAKEOFF_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1195:9`!, AB_TAKEOFF_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1196:9`!, AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!, -1,
6164 AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!);
6165
6166 // Clear wall point collision and axes lock
6167 flags = PF_LOCK_MASKcxx . . $ `Descent3/object_external.h:344:9`! | PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!;
6168 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_CLEAR_FLAGScxx . . $ `scripts/osiris_common.h:452:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
6169
6170 // Turn on dodging
6171 flags = AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!;
6172 AI_Valuecxx . . $ AI_Value.(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, AIV_I_FLAGScxx . . $ `scripts/osiris_common.h:556:9`!, &flags);
6173
6174 // enable auto-leveling
6175 flags = PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!;
6176 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SET_FLAGScxx . . $ `scripts/osiris_common.h:451:9`!, OBJV_I_PHYSICS_FLAGScxx . . $ `scripts/osiris_common.h:641:9`!, &flags);
6177 }
6178 }
6179
6180 // Processes the AI Initialize event
6181 void AlienBosscxx . . $ AlienBoss#::DoInitcxx . . $ AlienBoss#DoInit(d4f767463ce0a6b3).(int me) {
6182 int flags;
6183 msafe_structcxx . . $ msafe_struct# m;
6184 m.objhandlecxx . . $ msafe_struct#objhandle. = me;
6185
6186 // Setup memory data
6187 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
6188 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = ALIEN_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:641:9`!;
6189 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(alienboss_datacxx . . $ alienboss_data#);
6190 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
6191 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
6192
6193 memorycxx . . $ AlienBoss#memory. = (alienboss_datacxx . . $ alienboss_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
6194
6195 // Init base values
6196 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed.);
6197 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields.);
6198
6199 // Clear the destination object handle
6200 memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6201
6202 // Alien hasn't been hit by player yet
6203 memorycxx . . $ AlienBoss#memory.->hit_by_playercxx . . $ alienboss_data#hit_by_player. = false;
6204 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. = 0.0f;
6205 memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold. = AB_NORMAL_DAMAGE_LEVELcxx . . $ `scripts/AIGame3.cpp:1148:9`! * memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields.;
6206 memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance. = AB_STARTING_FLEE_CHANCEcxx . . $ `scripts/AIGame3.cpp:1153:9`!;
6207
6208 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. = 0;
6209 memorycxx . . $ AlienBoss#memory.->wander_forwardcxx . . $ alienboss_data#wander_forward. = true;
6210 memorycxx . . $ AlienBoss#memory.->protected_nestcxx . . $ alienboss_data#protected_nest. = false;
6211 memorycxx . . $ AlienBoss#memory.->waiting_effect_enabledcxx . . $ alienboss_data#waiting_effect_enabled. = false;
6212 memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended. = false;
6213
6214 // Update the energy effect as soon as charge exists
6215 memorycxx . . $ AlienBoss#memory.->next_update_beam_timecxx . . $ alienboss_data#next_update_beam_time. = Game_GetTimecxx . . $ Game_GetTime.();
6216
6217 // Do special damage as soon as relevant
6218 memorycxx . . $ AlienBoss#memory.->next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.();
6219 memorycxx . . $ AlienBoss#memory.->next_damage_effect_timecxx . . $ alienboss_data#next_damage_effect_time. = Game_GetTimecxx . . $ Game_GetTime.();
6220
6221 // Do special attack as soon as relevant
6222 memorycxx . . $ AlienBoss#memory.->next_special_attack_timecxx . . $ alienboss_data#next_special_attack_time. = Game_GetTimecxx . . $ Game_GetTime.();
6223 memorycxx . . $ AlienBoss#memory.->next_melee_attack_timecxx . . $ alienboss_data#next_melee_attack_time. = Game_GetTimecxx . . $ Game_GetTime.();
6224
6225 // Set the next generic check time
6226 memorycxx . . $ AlienBoss#memory.->next_generic_check_timecxx . . $ alienboss_data#next_generic_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 1.0f + 0.5f;
6227
6228 // Init other times
6229 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.();
6230 memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time. = 0.0f;
6231
6232 // Store Home Information
6233 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos.);
6234 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &memorycxx . . $ AlienBoss#memory.->home_roomcxx . . $ alienboss_data#home_room.);
6235
6236 matrixcxx . . $ matrix# orient;
6237 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
6238 memorycxx . . $ AlienBoss#memory.->home_fveccxx . . $ alienboss_data#home_fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). orient.fveccxx . . $ matrix#fvec.;
6239 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&memorycxx . . $ AlienBoss#memory.->home_fveccxx . . $ alienboss_data#home_fvec.);
6240 memorycxx . . $ AlienBoss#memory.->home_uveccxx . . $ alienboss_data#home_uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). orient.uveccxx . . $ matrix#uvec.;
6241 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&memorycxx . . $ AlienBoss#memory.->home_uveccxx . . $ alienboss_data#home_uvec.);
6242
6243 // Save values for teleport
6244 memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos.;
6245 memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room. = memorycxx . . $ AlienBoss#memory.->home_roomcxx . . $ alienboss_data#home_room.;
6246
6247 // stuck check stuff
6248 memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved. = 0.0f;
6249 memorycxx . . $ AlienBoss#memory.->next_check_if_stuck_timecxx . . $ alienboss_data#next_check_if_stuck_time. = Game_GetTimecxx . . $ Game_GetTime.();
6250 memorycxx . . $ AlienBoss#memory.->last_poscxx . . $ alienboss_data#last_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). memorycxx . . $ AlienBoss#memory.->home_poscxx . . $ alienboss_data#home_pos.;
6251
6252 // Init the props
6253 memorycxx . . $ AlienBoss#memory.->pos1_handlecxx . . $ alienboss_data#pos1_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6254 memorycxx . . $ AlienBoss#memory.->pos2_handlecxx . . $ alienboss_data#pos2_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6255 memorycxx . . $ AlienBoss#memory.->pos3_handlecxx . . $ alienboss_data#pos3_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6256
6257 // Create and setup the energy effect props
6258 msafe_structcxx . . $ msafe_struct# mstruct;
6259 memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle. = CreateAndAttachcxx . . $ CreateAndAttach(89febe1abf2bb0cc).(me, "STEmitter", OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, 0, 0, true, true);
6260 mstruct.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle.;
6261 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_NO_RENDERcxx . . $ `scripts/osiris_common.h:840:9`!, &mstruct);
6262
6263 // Init the scenario ID's
6264 memorycxx . . $ AlienBoss#memory.->nest_handlecxx . . $ alienboss_data#nest_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6265 memorycxx . . $ AlienBoss#memory.->left_hide_roomcxx . . $ alienboss_data#left_hide_room. = -1;
6266 memorycxx . . $ AlienBoss#memory.->right_hide_roomcxx . . $ alienboss_data#right_hide_room. = -1;
6267
6268 // Do Lookups
6269 DoCustomLookupscxx . . $ AlienBoss#DoCustomLookups(49f6e7a06ebc5aa8).();
6270
6271 // Set the healing fog in room
6272 aRoomSetFogcxx . . $ aRoomSetFog(c31bc224e645f73e).(memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0], 0.0f, 1.0f, 0.0f, 9000.0f);
6273
6274 // Set to normal state
6275 memorycxx . . $ AlienBoss#memory.->statecxx . . $ alienboss_data#state. = AB_NORMALcxx . . $ `scripts/AIGame3.cpp:1137:9`!;
6276
6277 // Set starting mode
6278 // SetMode(me, AB_GOING_TO_NEST); // for debugging
6279 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_WAITINGcxx . . $ `scripts/AIGame3.cpp:1133:9`!);
6280
6281 // Play looping boss sound
6282 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_flapping_idcxx . . $ boss_flapping_id., me, 1.0f);
6283
6284 mprintfcxx . . $ mprintf.(0, "Alien boss initialized.\n");
6285 }
6286
6287 // Does custom name lookups
6288 void AlienBosscxx . . $ AlienBoss#::DoCustomLookupscxx . . $ AlienBoss#DoCustomLookups(49f6e7a06ebc5aa8).(void) {
6289 int j;
6290
6291 // Lookup the wander room names
6292 for (j = 0; j < AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`!; j++) {
6293 memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[j] = Scrpt_FindRoomNamecxx . . $ Scrpt_FindRoomName.(AB_WanderRoomNamescxx . . $ AB_WanderRoomNames.[j]);
6294
6295 if (memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[j] < 0)
6296 mprintfcxx . . $ mprintf.(0, "Alien Boss Error: Room not found - %s", AB_WanderRoomNamescxx . . $ AB_WanderRoomNames.[j]);
6297 }
6298 }
6299
6300 // Checks to see if tractor beam pulling can commence/continue
6301 bool AlienBosscxx . . $ AlienBoss#::OkToStartSpecialAttackcxx . . $ AlienBoss#OkToStartSpecialAttack(83c267b20bac841a).(int me) {
6302 matrixcxx . . $ matrix# orient;
6303 vectorcxx . . $ vector# vec_to_target;
6304 int target_handle;
6305 float fov_angle;
6306
6307 // Make sure we still have a target
6308 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
6309 if (target_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
6310 return false;
6311
6312 // Make sure the target isn't cloaked
6313 if (qObjectCloakTimecxx . . $ qObjectCloakTime(5cde91ea12d43f46).(target_handle) != 0.0f)
6314 return false;
6315
6316 // check distance to target
6317 float dist;
6318 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
6319 if (dist > AB_MAX_SPECIAL_ATTACK_DISTcxx . . $ `scripts/AIGame3.cpp:1161:9`!)
6320 return false;
6321
6322 // check FOV position of target (greater than 45 degrees is too much)
6323 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
6324
6325 // NOTE: do my own vec to target here! (chris' doesn't update quick enough)
6326 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_V_VEC_TO_TARGETcxx . . $ `scripts/osiris_common.h:527:9`!, &vec_to_target);
6327 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&vec_to_target);
6328 fov_angle = orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). vec_to_target;
6329 if (fov_angle < 0.7f)
6330 return false;
6331
6332 return true;
6333 }
6334
6335 // Checks to see if tractor beam pulling can commence/continue
6336 bool AlienBosscxx . . $ AlienBoss#::DoStingAttackcxx . . $ AlienBoss#DoStingAttack(83c267b20bac841a).(int me) {
6337 matrixcxx . . $ matrix# orient;
6338 vectorcxx . . $ vector# vec_to_target;
6339 int target_handle;
6340 float fov_angle;
6341
6342 // Make sure we still have a target
6343 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
6344 if (target_handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
6345 return false;
6346
6347 // check distance to target
6348 float dist;
6349 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
6350 if (dist > AB_MAX_STING_DISTcxx . . $ `scripts/AIGame3.cpp:1162:9`!)
6351 return false;
6352
6353 // check FOV position of target (greater than 45 degrees is too much)
6354 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
6355
6356 // NOTE: do my own vec to target here! (chris' doesn't update quick enough)
6357 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_V_VEC_TO_TARGETcxx . . $ `scripts/osiris_common.h:527:9`!, &vec_to_target);
6358 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&vec_to_target);
6359 fov_angle = orient.fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). vec_to_target;
6360 if (fov_angle < 0.7f)
6361 return false;
6362
6363 // see if anything is in the way
6364 ray_infocxx . . $ ray_info# ray;
6365 int flags, fate;
6366 vectorcxx . . $ vector# start_pos, end_pos, landing_pos;
6367 int start_room, landing_room;
6368 float target_size;
6369
6370 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &start_pos);
6371 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &start_room);
6372 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &end_pos);
6373 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(target_handle, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SIZEcxx . . $ `scripts/osiris_common.h:636:9`!, &target_size);
6374
6375 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`! |
6376 FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
6377 fate = FVI_RayCastcxx . . $ FVI_RayCast.(me, &start_pos, &end_pos, start_room, target_size, flags, &ray);
6378 if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)
6379 return false;
6380
6381 // Create the lightning effect for the sting attack
6382 aLightningCreatecxx . . $ aLightningCreate(485de53fc2b521b2).(target_handle, memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle., 0.4f, 1.0f, 3, transfer_effect_idcxx . . $ transfer_effect_id., 0.4f, 1, 255, 255, 255,
6383 false);
6384
6385 // Damage the target
6386 aObjApplyDamagecxx . . $ aObjApplyDamage(43c79ee2f1b9aefe).(target_handle, AB_STING_DAMAGEcxx . . $ `scripts/AIGame3.cpp:1164:9`!);
6387
6388 // Play damaged sound for target
6389
6390 mprintfcxx . . $ mprintf.(0, "Did sting attack.\n");
6391
6392 return true;
6393 }
6394
6395 // Processes the AI Frame Interval Event
6396 void AlienBosscxx . . $ AlienBoss#::DoFramecxx . . $ AlienBoss#DoFrame(d4f767463ce0a6b3).(int me) {
6397 int flags;
6398 float anim_frame;
6399 float last_see_time, last_see_game_time;
6400 float last_hear_time, last_hear_game_time;
6401 float last_perceive_time;
6402
6403 // If we're waiting, bail outta here
6404 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_WAITINGcxx . . $ `scripts/AIGame3.cpp:1133:9`!) {
6405 // display healing effects for intro
6406 if (memorycxx . . $ AlienBoss#memory.->waiting_effect_enabledcxx . . $ alienboss_data#waiting_effect_enabled.) {
6407 // Handle the healing energy beam effects
6408 UpdateHealingEnergyBeamscxx . . $ AlienBoss#UpdateHealingEnergyBeams(d4f767463ce0a6b3).(me);
6409 }
6410 return;
6411 }
6412
6413 // Get the last see and hear time
6414 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_SEE_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:530:9`!, &last_see_game_time);
6415 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_HEAR_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:558:9`!, &last_hear_game_time);
6416
6417 // Calculate the time since target was seen and heard
6418 last_hear_time = Game_GetTimecxx . . $ Game_GetTime.() - last_hear_game_time;
6419 last_see_time = Game_GetTimecxx . . $ Game_GetTime.() - last_see_game_time;
6420
6421 // Perceive time is last time target was seen or heard (whichever is smalled)
6422 if (last_hear_time <= last_see_time) {
6423 last_perceive_time = last_hear_time;
6424 } else {
6425 last_perceive_time = last_see_time;
6426 }
6427
6428 // If alien boss was hit by player, take action if necessary
6429 if (memorycxx . . $ AlienBoss#memory.->hit_by_playercxx . . $ alienboss_data#hit_by_player.) {
6430 // reset the hit by player flag
6431 memorycxx . . $ AlienBoss#memory.->hit_by_playercxx . . $ alienboss_data#hit_by_player. = false;
6432 }
6433
6434 // Get the current animation frame
6435 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &anim_frame);
6436
6437 // Handle generic checks (pertains to more than 1 mode)
6438 if (memorycxx . . $ AlienBoss#memory.->next_generic_check_timecxx . . $ alienboss_data#next_generic_check_time. <= Game_GetTimecxx . . $ Game_GetTime.()) {
6439 }
6440
6441 // Handle mode specific operations
6442 switch (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.) {
6443
6444 case AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!: {
6445 // See if we should do a round of healing
6446 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time.) {
6447 // Set the next time to do something
6448 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + AB_HEALING_ACTION_TIMEcxx . . $ `scripts/AIGame3.cpp:1144:9`!;
6449
6450 // Heal Some Damage
6451 float heal_amount = memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields. * AB_HEAL_AMOUNT_PERCENTcxx . . $ `scripts/AIGame3.cpp:1145:9`!;
6452 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. -= heal_amount;
6453
6454 mprintfcxx . . $ mprintf.(0, "Healing %.1f by %.1f...\n", memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage., heal_amount);
6455
6456 bool done_healing = false;
6457 if (memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. <= 0.0f) {
6458 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. = 0.0f;
6459 done_healing = true;
6460 }
6461
6462 // If we're all healed up, return to attack mode
6463 if (done_healing) {
6464 StopHealingcxx . . $ AlienBoss#StopHealing(d4f767463ce0a6b3).(me);
6465
6466 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6467 break;
6468 }
6469 }
6470
6471 // Handle the healing energy beam effects
6472 UpdateHealingEnergyBeamscxx . . $ AlienBoss#UpdateHealingEnergyBeams(d4f767463ce0a6b3).(me);
6473 } break;
6474
6475 case AB_DYINGcxx . . $ `scripts/AIGame3.cpp:1132:9`!: {
6476 // Allow the healing effects to play for a few seconds
6477 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. < 4.5f) {
6478 UpdateHealingEnergyBeamscxx . . $ AlienBoss#UpdateHealingEnergyBeams(d4f767463ce0a6b3).(me);
6479 }
6480 } break;
6481
6482 case AB_HIDING_FROM_THRUSTERcxx . . $ `scripts/AIGame3.cpp:1130:9`!: {
6483 // Don't hide for more than a few seconds at most
6484 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. > 6.0f) {
6485 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6486 break;
6487 }
6488 } break;
6489
6490 case AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!: {
6491 // If we've seen a target, switch into attack mode
6492 if (memorycxx . . $ AlienBoss#memory.->protected_nestcxx . . $ alienboss_data#protected_nest. && last_perceive_time <= 2.0f) {
6493 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6494 break;
6495 }
6496 } break;
6497
6498 case AB_TELEPORTINGcxx . . $ `scripts/AIGame3.cpp:1134:9`!: {
6499 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. > 2.0f) {
6500 // Set to previous mode
6501 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienBoss#memory.->mode_prior_teleportingcxx . . $ alienboss_data#mode_prior_teleporting.);
6502 break;
6503 } else if (!memorycxx . . $ AlienBoss#memory.->did_transfercxx . . $ alienboss_data#did_transfer. && memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. > 1.0f) {
6504 vectorcxx . . $ vector# pos;
6505 int room;
6506
6507 // Do effect before
6508 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6509 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6510 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, teleport_effect_idcxx . . $ teleport_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
6511
6512 // Move self
6513 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &memorycxx . . $ AlienBoss#memory.->dest_poscxx . . $ alienboss_data#dest_pos.);
6514 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &memorycxx . . $ AlienBoss#memory.->dest_roomcxx . . $ alienboss_data#dest_room.);
6515
6516 // Do effect after
6517 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6518 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6519 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, teleport_effect_idcxx . . $ teleport_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
6520
6521 memorycxx . . $ AlienBoss#memory.->did_transfercxx . . $ alienboss_data#did_transfer. = true;
6522 }
6523 } break;
6524
6525 case AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`!: {
6526 // Play his landed animation if done with landing anim
6527 if (anim_frame == AB_LANDING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1191:9`!) {
6528 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, AB_HEALING_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1186:9`!, AB_HEALING_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1187:9`!, AB_HEALING_ANIM_TIMEcxx . . $ `scripts/AIGame3.cpp:1188:9`!, AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, -1, -1);
6529 }
6530
6531 if (memorycxx . . $ AlienBoss#memory.->done_turningcxx . . $ alienboss_data#done_turning. == true && memorycxx . . $ AlienBoss#memory.->done_movingcxx . . $ alienboss_data#done_moving. == true) {
6532 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_HEALINGcxx . . $ `scripts/AIGame3.cpp:1127:9`!);
6533 break;
6534 }
6535 } break;
6536
6537 case AB_GOING_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1125:9`!: {
6538 char type, next_type;
6539
6540 // If we're in alert, or the next anim mode is alert, and we're done moving, land at home
6541 if (memorycxx . . $ AlienBoss#memory.->done_movingcxx . . $ alienboss_data#done_moving. == true) {
6542 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
6543 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_NEXT_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:521:9`!, &next_type);
6544
6545 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || type == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`! || next_type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || next_type == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) {
6546 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`!);
6547 break;
6548 }
6549 }
6550 } break;
6551
6552 case AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`!: {
6553 // If we've seen a target, switch into attack mode
6554 if (memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended. && last_perceive_time <= 2.0f) {
6555 // Play the saw player shriek
6556 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_see_idcxx . . $ boss_see_id., me, 1.0f);
6557
6558 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6559 break;
6560 }
6561
6562 // See if intro has ended yet
6563 if (!memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended.) {
6564 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. > memorycxx . . $ AlienBoss#memory.->intro_end_timecxx . . $ alienboss_data#intro_end_time.) {
6565 // Set the normal wander speed
6566 SetMaxSpeedcxx . . $ AlienBoss#SetMaxSpeed(43c79ee2f1b9aefe).(me, memorycxx . . $ AlienBoss#memory.->base_speedcxx . . $ alienboss_data#base_speed. * AB_WANDER_SPEED_MODcxx . . $ `scripts/AIGame3.cpp:1207:9`!);
6567
6568 // set the intro ended flag
6569 memorycxx . . $ AlienBoss#memory.->intro_endedcxx . . $ alienboss_data#intro_ended. = true;
6570
6571 mprintfcxx . . $ mprintf.(0, "Intro ended for alien boss.\n");
6572 }
6573 }
6574 } break;
6575
6576 case AB_FLEEINGcxx . . $ `scripts/AIGame3.cpp:1128:9`!: {
6577 // See if it is time to stop running
6578 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. >= memorycxx . . $ AlienBoss#memory.->max_wander_timecxx . . $ alienboss_data#max_wander_time.) {
6579 // Go back to attack mode for now
6580 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6581 }
6582 } break;
6583
6584 case AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!: {
6585 // Do we need to heal?
6586 if (memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. > memorycxx . . $ AlienBoss#memory.->damage_thresholdcxx . . $ alienboss_data#damage_threshold.) {
6587 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_hurt_idcxx . . $ boss_hurt_id., me, 1.0f);
6588
6589 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_GOING_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1125:9`!);
6590 break;
6591 }
6592
6593 // See if we should do a round of healing
6594 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time.) {
6595 // Set the next time to do something
6596 memorycxx . . $ AlienBoss#memory.->next_activity_timecxx . . $ alienboss_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + AB_ATTACK_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1156:9`!;
6597
6598 // Should we flee?
6599 if (memorycxx . . $ AlienBoss#memory.->statecxx . . $ alienboss_data#state. == AB_NORMALcxx . . $ `scripts/AIGame3.cpp:1137:9`! && IsOnFirecxx . . $ AlienBoss#IsOnFire(83c267b20bac841a).(me) && (randcxx . . $ rand(9efc7249d839d30e).() % 100) < memorycxx . . $ AlienBoss#memory.->fire_flee_chancecxx . . $ alienboss_data#fire_flee_chance.) {
6600 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_hurt_idcxx . . $ boss_hurt_id., me, 1.0f);
6601
6602 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_FLEEINGcxx . . $ `scripts/AIGame3.cpp:1128:9`!);
6603 break;
6604 }
6605
6606 // Should we do a special attack?
6607 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_special_attack_timecxx . . $ alienboss_data#next_special_attack_time.) {
6608 if (OkToStartSpecialAttackcxx . . $ AlienBoss#OkToStartSpecialAttack(83c267b20bac841a).(me)) {
6609 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_see_idcxx . . $ boss_see_id., me, 1.0f);
6610
6611 memorycxx . . $ AlienBoss#memory.->next_special_attack_timecxx . . $ alienboss_data#next_special_attack_time. =
6612 Game_GetTimecxx . . $ Game_GetTime.() + AB_SPECIAL_ATTACK_DELAYcxx . . $ `scripts/AIGame3.cpp:1166:9`! + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * AB_SPECIAL_ATTACK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1167:9`!;
6613
6614 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_PREPARE_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1120:9`!);
6615 break;
6616 }
6617 }
6618
6619 // Should we switch to melee mode?
6620 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_melee_attack_timecxx . . $ alienboss_data#next_melee_attack_time.) {
6621 int target_handle;
6622
6623 // Make sure we still have a target
6624 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_I_TARGET_HANDLEcxx . . $ `scripts/osiris_common.h:524:9`!, &target_handle);
6625 if (target_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) {
6626 // check distance to target
6627 float dist;
6628 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_DIST_TO_TARGETcxx . . $ `scripts/osiris_common.h:526:9`!, &dist);
6629 if (dist < AB_MELEE_DISTcxx . . $ `scripts/AIGame3.cpp:1171:9`!) {
6630 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_MELEE_ATTACKcxx . . $ `scripts/AIGame3.cpp:1123:9`!);
6631 break;
6632 }
6633 }
6634 }
6635 }
6636
6637 // If haven't perceived target for a while, return to wander mode
6638 if (last_perceive_time >= 10.0f) {
6639 // If we're not in a protective state, go ahead and wander
6640 if (memorycxx . . $ AlienBoss#memory.->statecxx . . $ alienboss_data#state. == AB_PROTECTIVEcxx . . $ `scripts/AIGame3.cpp:1138:9`!) {
6641 // See if we're in the nest room
6642 int curr_room;
6643 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &curr_room);
6644 if (curr_room != memorycxx . . $ AlienBoss#memory.->wander_roomscxx . . $ alienboss_data#wander_rooms.[0]) {
6645 // Go protect nest
6646 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!);
6647 break;
6648 }
6649 } else {
6650 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`!);
6651 break;
6652 }
6653 }
6654 } break;
6655
6656 case AB_MELEE_ATTACKcxx . . $ `scripts/AIGame3.cpp:1123:9`!: {
6657 // Wait until the melee attack time has expired
6658 if (memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. > AB_MAX_MELEE_TIMEcxx . . $ `scripts/AIGame3.cpp:1172:9`!) {
6659 memorycxx . . $ AlienBoss#memory.->next_melee_attack_timecxx . . $ alienboss_data#next_melee_attack_time. =
6660 Game_GetTimecxx . . $ Game_GetTime.() + AB_MELEE_ATTACK_DELAYcxx . . $ `scripts/AIGame3.cpp:1169:9`! + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * AB_MELEE_ATTACK_VARIANCEcxx . . $ `scripts/AIGame3.cpp:1170:9`!;
6661
6662 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6663 break;
6664 }
6665 } break;
6666
6667 case AB_PREPARE_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1120:9`!: {
6668 char type, next_type;
6669 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
6670 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_NEXT_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:521:9`!, &next_type);
6671
6672 // Wait until the current or next anim type is alert, then try special attack
6673 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || next_type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
6674 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1121:9`!);
6675 break;
6676 }
6677 } break;
6678
6679 case AB_SPECIAL_ATTACKcxx . . $ `scripts/AIGame3.cpp:1121:9`!: {
6680 // Wait until the fire frame is up
6681 if (anim_frame == AB_ATTACK_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1199:9`!) {
6682 // Create a frag burst effect
6683 vectorcxx . . $ vector# pos;
6684 int room;
6685 matrixcxx . . $ matrix# orient;
6686
6687 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6688 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6689 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
6690 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, boss_frag_burst_idcxx . . $ boss_frag_burst_id., room, &pos, &orient, me);
6691
6692 // Go to recover mode
6693 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_SPECIAL_ATTACK_RECOILcxx . . $ `scripts/AIGame3.cpp:1122:9`!);
6694 break;
6695 }
6696 } break;
6697
6698 case AB_SPECIAL_ATTACK_RECOILcxx . . $ `scripts/AIGame3.cpp:1122:9`!: {
6699 char type;
6700 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_C_ANIMATION_TYPEcxx . . $ `scripts/osiris_common.h:520:9`!, &type);
6701
6702 // Wait until the current anim type is alert, then return to normal
6703 if (type == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) {
6704 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6705 break;
6706 }
6707 } break;
6708 }
6709
6710 // Do the damage effect if necessary
6711 UpdateDamageEffectcxx . . $ AlienBoss#UpdateDamageEffect(d4f767463ce0a6b3).(me);
6712
6713 // If necessary, check if we're stuck
6714 if (ModeIsStuckSensitivecxx . . $ AlienBoss#ModeIsStuckSensitive(83c267b20bac841a).(memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.)) {
6715 vectorcxx . . $ vector# curr_pos, dist_vec;
6716
6717 // Update the values
6718 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &curr_pos);
6719 dist_vec =cxx . . $ vector#`operator=`(c0842353a20857d). curr_pos -cxx . . $ operator-(b77b703cd1e43e33). memorycxx . . $ AlienBoss#memory.->last_poscxx . . $ alienboss_data#last_pos.;
6720 memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved. += (dist_vec.xcxx . . $ vector#x. * dist_vec.xcxx . . $ vector#x. + dist_vec.ycxx . . $ vector#y. * dist_vec.ycxx . . $ vector#y. + dist_vec.zcxx . . $ vector#z. * dist_vec.zcxx . . $ vector#z.);
6721 memorycxx . . $ AlienBoss#memory.->last_poscxx . . $ alienboss_data#last_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). curr_pos;
6722
6723 // See if we need to do a stuck check
6724 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_check_if_stuck_timecxx . . $ alienboss_data#next_check_if_stuck_time.) {
6725 // Calc the next time to check for stuckitude
6726 memorycxx . . $ AlienBoss#memory.->next_check_if_stuck_timecxx . . $ alienboss_data#next_check_if_stuck_time. = Game_GetTimecxx . . $ Game_GetTime.() + AB_CHECK_IF_STUCK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1174:9`!;
6727
6728 mprintfcxx . . $ mprintf.(0, "Checking to see if Alien Boss is stuck (dist*dist=%f)...\n", memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved.);
6729
6730 // Check if the distance moved indicates being stuck
6731 if (memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved. < (AB_CHECK_IF_STUCK_DISTcxx . . $ `scripts/AIGame3.cpp:1175:9`! * AB_CHECK_IF_STUCK_DISTcxx . . $ `scripts/AIGame3.cpp:1175:9`!)) {
6732 mprintfcxx . . $ mprintf.(0, "Alien Boss is stuck... now teleporting to destination.\n");
6733
6734 // Teleport boss to new location
6735 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_TELEPORTINGcxx . . $ `scripts/AIGame3.cpp:1134:9`!);
6736 } else {
6737 // Clear the distance moved
6738 memorycxx . . $ AlienBoss#memory.->squared_dist_movedcxx . . $ alienboss_data#squared_dist_moved. = 0.0f;
6739 }
6740 }
6741 }
6742
6743 // Increment the current mode time
6744 memorycxx . . $ AlienBoss#memory.->mode_timecxx . . $ alienboss_data#mode_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
6745 }
6746
6747 // Process all AI Notify events
6748 bool AlienBosscxx . . $ AlienBoss#::DoNotifycxx . . $ AlienBoss#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
6749 if (IsGoalFinishedNotifycxx . . $ IsGoalFinishedNotify(83c267b20bac841a).(data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type.)) {
6750 // Handle goal complete events
6751 switch (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_uidcxx . . $ tOSIRISEVTAINOTIFY#goal_uid.) {
6752 case AB_GUID_GOT_TO_NESTcxx . . $ `scripts/AIGame3.cpp:1178:9`!:
6753 memorycxx . . $ AlienBoss#memory.->done_movingcxx . . $ alienboss_data#done_moving. = true;
6754 break;
6755
6756 case AB_GUID_LANDEDcxx . . $ `scripts/AIGame3.cpp:1179:9`!:
6757 memorycxx . . $ AlienBoss#memory.->done_movingcxx . . $ alienboss_data#done_moving. = true;
6758 break;
6759
6760 case AB_GUID_GOT_TO_NEST_ROOMcxx . . $ `scripts/AIGame3.cpp:1182:9`!: {
6761 // if we're going to protect nest, switch into attack mode
6762 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_GOING_TO_PROTECT_NESTcxx . . $ `scripts/AIGame3.cpp:1131:9`!) {
6763 mprintfcxx . . $ mprintf.(0, "Alien Boss got to nest room.\n");
6764
6765 // If we haven't protected nest yet, do special stuff
6766 if (!memorycxx . . $ AlienBoss#memory.->protected_nestcxx . . $ alienboss_data#protected_nest.) {
6767 int minion1_handle, minion2_handle, player_handle;
6768
6769 minion1_handle = Scrpt_FindObjectNamecxx . . $ Scrpt_FindObjectName.("BossMinion1");
6770 minion2_handle = Scrpt_FindObjectNamecxx . . $ Scrpt_FindObjectName.("BossMinion2");
6771
6772 // Unghost the minions
6773 aObjGhostSetcxx . . $ aObjGhostSet(3e454b8ccf442868).(0, minion1_handle);
6774 aObjGhostSetcxx . . $ aObjGhostSet(3e454b8ccf442868).(0, minion2_handle);
6775
6776 // Turn on their AI
6777 aAISetStatecxx . . $ aAISetState(3e454b8ccf442868).(1, minion1_handle);
6778 aAISetStatecxx . . $ aAISetState(3e454b8ccf442868).(1, minion2_handle);
6779
6780 // Send them to get the closest player
6781 player_handle = FindClosestPlayercxx . . $ FindClosestPlayer(7864480464b09eea).(minion1_handle);
6782 SendCommandcxx . . $ AlienBoss#SendCommand(1fae7c3a3935cb04).(minion1_handle, minion1_handle, ALIEN_COM_HUNT_TO_OBJcxx . . $ `scripts/AIGame3_External.h:33:9`!, &player_handle);
6783 SendCommandcxx . . $ AlienBoss#SendCommand(1fae7c3a3935cb04).(minion2_handle, minion2_handle, ALIEN_COM_HUNT_TO_OBJcxx . . $ `scripts/AIGame3_External.h:33:9`!, &player_handle);
6784
6785 // Play Shriek
6786 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_see_idcxx . . $ boss_see_id., me, 1.0f);
6787
6788 // Set the protected nest flag
6789 memorycxx . . $ AlienBoss#memory.->protected_nestcxx . . $ alienboss_data#protected_nest. = true;
6790 }
6791
6792 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, AB_ATTACKINGcxx . . $ `scripts/AIGame3.cpp:1119:9`!);
6793 break;
6794 }
6795 } break;
6796
6797 case AB_GUID_GOT_TO_HIDE_ROOMcxx . . $ `scripts/AIGame3.cpp:1183:9`!: {
6798 // if we're going to protect nest, switch into attack mode
6799 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_HIDING_FROM_THRUSTERcxx . . $ `scripts/AIGame3.cpp:1130:9`!) {
6800 mprintfcxx . . $ mprintf.(0, "Alien boss got to hide room.\n");
6801 // SetMode(me,AB_ATTACKING);
6802 // break;
6803 }
6804 } break;
6805
6806 case AB_GUID_GOT_TO_WANDER_ROOMcxx . . $ `scripts/AIGame3.cpp:1181:9`!: {
6807 // Make sure we're in wander mode
6808 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_WANDERINGcxx . . $ `scripts/AIGame3.cpp:1117:9`!) {
6809 // Decide whether or not to reverse directions
6810 if ((randcxx . . $ rand(9efc7249d839d30e).() % 100) < 4) {
6811 memorycxx . . $ AlienBoss#memory.->wander_forwardcxx . . $ alienboss_data#wander_forward. = (memorycxx . . $ AlienBoss#memory.->wander_forwardcxx . . $ alienboss_data#wander_forward.) ? false : true;
6812
6813 mprintfcxx . . $ mprintf.(0, "Alien Boss - Reversing wander direction\n");
6814 }
6815
6816 // Check whether to follow list in reverse or not
6817 if (memorycxx . . $ AlienBoss#memory.->wander_forwardcxx . . $ alienboss_data#wander_forward.) {
6818 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index.++;
6819 if (memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. >= AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`!) {
6820 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. = 0;
6821 }
6822 } else {
6823 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index.--;
6824 if (memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. < 0) {
6825 memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index. = AB_NUM_WANDER_ROOMScxx . . $ `scripts/AIGame3.cpp:1219:9`! - 1;
6826 }
6827 }
6828
6829 // Set the goal to go to the next room
6830 SetWanderRoomGoalcxx . . $ AlienBoss#SetWanderRoomGoal(d4f767463ce0a6b3).(me);
6831
6832 // Play the wandering sound
6833 aSoundPlayObjectcxx . . $ aSoundPlayObject(c2f439e40e2f19ed).(boss_turf_idcxx . . $ boss_turf_id., me, 1.0f);
6834
6835 mprintfcxx . . $ mprintf.(0, "Alien Boss - Wandering to room: %d\n", memorycxx . . $ AlienBoss#memory.->curr_wander_room_indexcxx . . $ alienboss_data#curr_wander_room_index.);
6836 }
6837 } break;
6838
6839 case AB_GUID_GOT_TO_DEST_OBJcxx . . $ `scripts/AIGame3.cpp:1180:9`!:
6840 memorycxx . . $ AlienBoss#memory.->dest_object_handlecxx . . $ alienboss_data#dest_object_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
6841 SetModecxx . . $ AlienBoss#SetMode(5016a63d0a5aceb0).(me, memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode.);
6842 mprintfcxx . . $ mprintf.(0, "Alien Boss got to destination object.\n");
6843 break;
6844 }
6845 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_SCRIPTED_ORIENTcxx . . $ `Descent3/aistruct_external.h:311:9`!) {
6846 // Handle custom orientation events
6847 if (memorycxx . . $ AlienBoss#memory.->modecxx . . $ alienboss_data#mode. == AB_LANDING_AT_NESTcxx . . $ `scripts/AIGame3.cpp:1126:9`!) {
6848 memorycxx . . $ AlienBoss#memory.->done_turningcxx . . $ alienboss_data#done_turning. = (AI_TurnTowardsVectorscxx . . $ AI_TurnTowardsVectors.(me, &memorycxx . . $ AlienBoss#memory.->home_fveccxx . . $ alienboss_data#home_fvec., &memorycxx . . $ AlienBoss#memory.->home_uveccxx . . $ alienboss_data#home_uvec.) != 0);
6849 }
6850 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_MELEE_HITcxx . . $ `Descent3/aistruct_external.h:308:9`!) {
6851 // Create hit sparks
6852 int room;
6853 vectorcxx . . $ vector# pos;
6854 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6855 Obj_GetGunPoscxx . . $ Obj_GetGunPos(acebd7a68d406969).(me, 0, &pos);
6856 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(30, &pos, room);
6857
6858 // Create the concussive hit blast
6859 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6860 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6861 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, lifter_blast_effect_idcxx . . $ lifter_blast_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
6862 } else if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!) {
6863 bot_comcxx . . $ bot_com# *com = (bot_comcxx . . $ bot_com# *)data->extra_infocxx . . $ tOSIRISEventInfo#extra_info.;
6864
6865 return ReceiveCommandcxx . . $ AlienBoss#ReceiveCommand(1fae7c3a3935cb04).(me, data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle., com->actioncxx . . $ bot_com#action., com->ptrcxx . . $ bot_com#ptr.);
6866 }
6867
6868 return true;
6869 }
6870
6871 // Handles application of damage to an alien
6872 void AlienBosscxx . . $ AlienBoss#::DoDamagecxx . . $ AlienBoss#DoDamage(1a3e688ec82e7ded).(int me, tOSIRISEVTDAMAGEDcxx . . $ tOSIRISEVTDAMAGED# *damage_data) {
6873 // Handle fire damage
6874 if (damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_FIREcxx . . $ `Descent3/damage_external.h:35:9`!) {
6875 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. += (damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. * 0.6f);
6876 return;
6877 }
6878
6879 // Handle damage by matter weapons
6880 if (damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_MATTERcxx . . $ `Descent3/damage_external.h:36:9`!) {
6881 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. += (damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. * 0.7f);
6882
6883 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time.) {
6884 memorycxx . . $ AlienBoss#memory.->next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.() + 0.8f + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.5f;
6885
6886 // Create a frag burst effect
6887 vectorcxx . . $ vector# pos;
6888 int room;
6889 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6890 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6891 Obj_Createcxx . . $ Obj_Create(fa124986c2825aef).(OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!, frag_burst_effect_idcxx . . $ frag_burst_effect_id., room, &pos, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, me);
6892 }
6893
6894 return;
6895 }
6896
6897 // Handle damage by energy weapons
6898 if ((damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_ENERGYcxx . . $ `Descent3/damage_external.h:37:9`! || damage_data->damage_typecxx . . $ tOSIRISEVTDAMAGED#damage_type. == GD_ELECTRICcxx . . $ `Descent3/damage_external.h:33:9`!) &&
6899 Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ AlienBoss#memory.->next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time.) {
6900 // Check if we're currently susceptible to energy damage
6901 if (false) {
6902 memorycxx . . $ AlienBoss#memory.->next_special_damage_timecxx . . $ alienboss_data#next_special_damage_time. = Game_GetTimecxx . . $ Game_GetTime.() + 0.1f + ((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 0.2f;
6903
6904 // Do double damage
6905 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. += (damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. * 1.5f);
6906
6907 // Create sparks
6908 int room;
6909 vectorcxx . . $ vector# pos;
6910 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &pos);
6911 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_I_ROOMNUMcxx . . $ `scripts/osiris_common.h:630:9`!, &room);
6912 Game_CreateRandomSparkscxx . . $ Game_CreateRandomSparks(3e6b82e54d72ee3b).(30 + int(((float)randcxx . . $ rand(9efc7249d839d30e).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 10.0f), &pos, room);
6913
6914 return;
6915 } else {
6916 // Do standard energy damage
6917 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. += (damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. * 0.3f);
6918 return;
6919 }
6920 }
6921
6922 // Apply standard damage mod
6923 memorycxx . . $ AlienBoss#memory.->damagecxx . . $ alienboss_data#damage. += (damage_data->damagecxx . . $ tOSIRISEVTDAMAGED#damage. * 0.1f);
6924 }
6925
6926 // Handles attacks on aliens
6927 void AlienBosscxx . . $ AlienBoss#::DoCollidecxx . . $ AlienBoss#DoCollide(bbb8461685d7aa69).(int me, tOSIRISEVTCOLLIDEcxx . . $ tOSIRISEVTCOLLIDE# *collide_data) {
6928 // See if it's a player or player weapon that hit us
6929 if (qObjIsPlayerOrPlayerWeaponcxx . . $ qObjIsPlayerOrPlayerWeapon(83c267b20bac841a).(collide_data->it_handlecxx . . $ tOSIRISEVTCOLLIDE#it_handle.)) {
6930 // mprintf(0,"Hit by player!\n");
6931 memorycxx . . $ AlienBoss#memory.->hit_by_playercxx . . $ alienboss_data#hit_by_player. = true;
6932 }
6933 }
6934
6935 // Does any final cleanup when object is destroyed
6936 void AlienBosscxx . . $ AlienBoss#::DoCleanUpcxx . . $ AlienBoss#DoCleanUp(d4f767463ce0a6b3).(int me) {
6937 // remove the powerup props
6938 msafe_structcxx . . $ msafe_struct# mo;
6939 mo.objhandlecxx . . $ msafe_struct#objhandle. = memorycxx . . $ AlienBoss#memory.->tail_pos_handlecxx . . $ alienboss_data#tail_pos_handle.;
6940 MSafe_CallFunctioncxx . . $ MSafe_CallFunction.(MSAFE_OBJECT_REMOVEcxx . . $ `scripts/osiris_common.h:819:9`!, &mo);
6941 }
6942
6943 // Receives all basic events and calls processesing functions
6944 int16_t AlienBosscxx . . $ AlienBoss#::CallEventcxx . . $ AlienBoss#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
6945 switch (event) {
6946 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
6947 DoInitcxx . . $ AlienBoss#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
6948 break;
6949 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
6950 DoFramecxx . . $ AlienBoss#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
6951 break;
6952 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
6953 return (DoNotifycxx . . $ AlienBoss#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
6954 break;
6955 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!: {
6956 DoDamagecxx . . $ AlienBoss#DoDamage(1a3e688ec82e7ded).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged.);
6957
6958 // If boss is slightly damaged, restore it's hitpoints (so it can never die!)
6959 float curr_shields;
6960 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &curr_shields);
6961 if (curr_shields < memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields. * 0.75f) {
6962 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, OBJV_F_SHIELDScxx . . $ `scripts/osiris_common.h:625:9`!, &memorycxx . . $ AlienBoss#memory.->base_shieldscxx . . $ alienboss_data#base_shields.);
6963 }
6964
6965 // Only allow it to take very little damage (must take some or it doesn't catch on fire)
6966 data->evt_damagedcxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_damaged..damagecxx . . $ tOSIRISEVTDAMAGED#damage. = 0.000001f;
6967 } break;
6968 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
6969 DoCleanUpcxx . . $ AlienBoss#DoCleanUp(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
6970 break;
6971 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
6972 DoCollidecxx . . $ AlienBoss#DoCollide(bbb8461685d7aa69).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., &data->evt_collidecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_collide.);
6973 break;
6974 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
6975 memorycxx . . $ AlienBoss#memory. = (alienboss_datacxx . . $ alienboss_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
6976 DoCustomLookupscxx . . $ AlienBoss#DoCustomLookups(49f6e7a06ebc5aa8).();
6977 break;
6978 }
6979
6980 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
6981 }
6982
6983 //-----------------------
6984 // Security Camera class
6985 //-----------------------
6986
6987 // Sends a command out to another alien
6988 bool SecurityCameracxx . . $ SecurityCamera#::SendCommandcxx . . $ SecurityCamera#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
6989 bot_comcxx . . $ bot_com# com;
6990
6991 com.actioncxx . . $ bot_com#action. = command;
6992 com.ptrcxx . . $ bot_com#ptr. = ptr;
6993
6994 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
6995
6996 ei.me_handlecxx . . $ tOSIRISEventInfo#me_handle. = it;
6997 ei.extra_infocxx . . $ tOSIRISEventInfo#extra_info. = (void *)&com;
6998 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!;
6999 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = me;
7000
7001 return Obj_CallEventcxx . . $ Obj_CallEvent.(it, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei);
7002 }
7003
7004 // Processes a command from another alien
7005 bool SecurityCameracxx . . $ SecurityCamera#::ReceiveCommandcxx . . $ SecurityCamera#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
7006 switch (command) {
7007 // Alien is asked to return current mode
7008 case SC_COM_GET_ALERT_STATUScxx . . $ `scripts/AIGame3_External.h:46:9`!:
7009 *(bool *)ptr = memorycxx . . $ SecurityCamera#memory.->alertedcxx . . $ securitycamera_data#alerted.;
7010 return true;
7011 break;
7012 }
7013
7014 return false;
7015 }
7016
7017 // Sets the Current Mode
7018 void SecurityCameracxx . . $ SecurityCamera#::SetModecxx . . $ SecurityCamera#SetMode(5016a63d0a5aceb0).(int me, char mode) {
7019 int flags;
7020 float curr_anim_frame;
7021
7022 // Get the current animation frame
7023 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &curr_anim_frame);
7024
7025 // mprintf(0, "From mode %d, ",memory->mode);
7026
7027 // Do mode specific setups
7028 switch (mode) {
7029 case SC_PANNINGcxx . . $ `scripts/AIGame3.cpp:1343:9`!: {
7030 float time;
7031
7032 // Get the camera ready for looping
7033 memorycxx . . $ SecurityCamera#memory.->panning_statecxx . . $ securitycamera_data#panning_state. = SC_WARMING_UPcxx . . $ `scripts/AIGame3.cpp:1348:9`!;
7034 if (curr_anim_frame > SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`!)
7035 curr_anim_frame = SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`!;
7036
7037 time = (SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! - curr_anim_frame) / SC_PAN_SPEEDcxx . . $ `scripts/AIGame3.cpp:1357:9`!;
7038 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, curr_anim_frame, SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`!, time, AIAF_IMMEDIATEcxx . . $ `Descent3/aistruct_external.h:119:9`!, -1, -1);
7039 mprintfcxx . . $ mprintf.(0, "Warming up...\n");
7040 } break;
7041
7042 case SC_TRACKINGcxx . . $ `scripts/AIGame3.cpp:1344:9`!: {
7043 memorycxx . . $ SecurityCamera#memory.->next_activity_timecxx . . $ securitycamera_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.();
7044 // memory->last_update_anim_time = Game_GetTime();
7045
7046 mprintfcxx . . $ mprintf.(0, "Camera spotted you!\n");
7047 } break;
7048
7049 default:
7050 mprintfcxx . . $ mprintf.(0, "Security Camera is all messed up!\n");
7051 break;
7052 }
7053
7054 // Set the current mode and reset the mode time
7055 memorycxx . . $ SecurityCamera#memory.->modecxx . . $ securitycamera_data#mode. = mode;
7056 memorycxx . . $ SecurityCamera#memory.->mode_timecxx . . $ securitycamera_data#mode_time. = 0.0f;
7057 }
7058
7059 // Processes the AI Initialize event
7060 void SecurityCameracxx . . $ SecurityCamera#::DoInitcxx . . $ SecurityCamera#DoInit(d4f767463ce0a6b3).(int me) {
7061 // Setup memory data
7062 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
7063 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = SC_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1351:9`!;
7064 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(securitycamera_datacxx . . $ securitycamera_data#);
7065 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
7066 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
7067
7068 memorycxx . . $ SecurityCamera#memory. = (securitycamera_datacxx . . $ securitycamera_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
7069
7070 memorycxx . . $ SecurityCamera#memory.->alertedcxx . . $ securitycamera_data#alerted. = false;
7071
7072 SetModecxx . . $ SecurityCamera#SetMode(5016a63d0a5aceb0).(me, SC_PANNINGcxx . . $ `scripts/AIGame3.cpp:1343:9`!);
7073 }
7074
7075 // Processes the AI Frame Interval Event
7076 void SecurityCameracxx . . $ SecurityCamera#::DoFramecxx . . $ SecurityCamera#DoFrame(d4f767463ce0a6b3).(int me) {
7077 float last_see_time, last_see_game_time;
7078 float curr_anim_frame;
7079
7080 // Get the last see time
7081 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_LAST_SEE_TARGET_TIMEcxx . . $ `scripts/osiris_common.h:530:9`!, &last_see_game_time);
7082
7083 // Calculate the time since target was seen or heard
7084 last_see_time = Game_GetTimecxx . . $ Game_GetTime.() - last_see_game_time;
7085
7086 // Get the current animation frame
7087 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_F_ANIM_FRAMEcxx . . $ `scripts/osiris_common.h:643:9`!, &curr_anim_frame);
7088
7089 // Do mode specific checks
7090 switch (memorycxx . . $ SecurityCamera#memory.->modecxx . . $ securitycamera_data#mode.) {
7091 case SC_PANNINGcxx . . $ `scripts/AIGame3.cpp:1343:9`!: {
7092 // If we have a target switch to tracking mode
7093 if (last_see_time < SC_TIME_TO_GAIN_TARGETcxx . . $ `scripts/AIGame3.cpp:1355:9`!) {
7094 SetModecxx . . $ SecurityCamera#SetMode(5016a63d0a5aceb0).(me, SC_TRACKINGcxx . . $ `scripts/AIGame3.cpp:1344:9`!);
7095 break;
7096 }
7097
7098 // If we're warming up, see if we should start looping yet
7099 if (memorycxx . . $ SecurityCamera#memory.->panning_statecxx . . $ securitycamera_data#panning_state. == SC_WARMING_UPcxx . . $ `scripts/AIGame3.cpp:1348:9`!) {
7100 // See if we're at the final frame
7101 if (curr_anim_frame >= SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`!) {
7102 memorycxx . . $ SecurityCamera#memory.->panning_statecxx . . $ securitycamera_data#panning_state. = SC_LOOPINGcxx . . $ `scripts/AIGame3.cpp:1347:9`!;
7103
7104 float time = (SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! - SC_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1360:9`!) / SC_PAN_SPEEDcxx . . $ `scripts/AIGame3.cpp:1357:9`!;
7105 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, SC_START_FRAMEcxx . . $ `scripts/AIGame3.cpp:1360:9`!, SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`!, time, AIAF_IMMEDIATEcxx . . $ `Descent3/aistruct_external.h:119:9`! | AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!, -1, -1);
7106 mprintfcxx . . $ mprintf.(0, "Looping pan started...\n");
7107 }
7108 }
7109 } break;
7110
7111 case SC_TRACKINGcxx . . $ `scripts/AIGame3.cpp:1344:9`!: {
7112 // If we haven't seen target for a while, return to panning
7113 if (last_see_time > SC_TIME_TO_LOSE_TARGETcxx . . $ `scripts/AIGame3.cpp:1354:9`!) {
7114 SetModecxx . . $ SecurityCamera#SetMode(5016a63d0a5aceb0).(me, SC_PANNINGcxx . . $ `scripts/AIGame3.cpp:1343:9`!);
7115 break;
7116 }
7117
7118 // If we've been tracking target long enough, switch to alert mode
7119 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ SecurityCamera#memory.->next_activity_timecxx . . $ securitycamera_data#next_activity_time.) {
7120 memorycxx . . $ SecurityCamera#memory.->next_activity_timecxx . . $ securitycamera_data#next_activity_time. = Game_GetTimecxx . . $ Game_GetTime.() + SC_TRACK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1368:9`!;
7121
7122 // Track the current target
7123 vectorcxx . . $ vector# local_vec_to_target, world_vec_to_target, dir, local_fvec;
7124 matrixcxx . . $ matrix# orient;
7125 double theta;
7126 float frame_offset, dot, curr_frame, dest_frame, anim_time, next_frame;
7127
7128 // Get the vec to target in local security camera space
7129 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &orient);
7130 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_V_VEC_TO_TARGETcxx . . $ `scripts/osiris_common.h:527:9`!, &world_vec_to_target);
7131 local_vec_to_target =cxx . . $ vector#`operator=`(c0842353a20857d). world_vec_to_target *cxx . . $ `operator*`(14b8f9ac5c1e7b85). orient;
7132
7133 // Make it track target on a 2D plane
7134 dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). local_vec_to_target;
7135 dir.ycxx . . $ vector#y. = 0.0f;
7136 if ((dir.xcxx . . $ vector#x. + dir.ycxx . . $ vector#y. + dir.zcxx . . $ vector#z.) == 0.0f)
7137 break;
7138 vm_VectorNormalizecxx . . $ vm_VectorNormalize(4939a7e530383cd4).(&dir);
7139
7140 local_fvec.xcxx . . $ vector#x. = 0.0f;
7141 local_fvec.ycxx . . $ vector#y. = 0.0f;
7142 local_fvec.zcxx . . $ vector#z. = 1.0f;
7143 dot = dir *cxx . . $ `operator*`(4a721543d64e126a). local_fvec;
7144 if (dot < -1.0f)
7145 dot = -1.0f;
7146 if (dot > 1.0f)
7147 dot = 1.0f;
7148 theta = acoscxx . . $ acos(fbcf3211dfe1bfd1).(dot);
7149 theta = theta / PIcxx . . $ `fix/fix.h:73:9`! * 4.0;
7150
7151 frame_offset = float(theta) * SC_MAX_FRAME_OFFSETcxx . . $ `scripts/AIGame3.cpp:1364:9`!;
7152 if (frame_offset > SC_MAX_FRAME_OFFSETcxx . . $ `scripts/AIGame3.cpp:1364:9`!)
7153 frame_offset = SC_MAX_FRAME_OFFSETcxx . . $ `scripts/AIGame3.cpp:1364:9`!;
7154
7155 // mprintf(0,"x=%.3f, y=%.3f, z=%.3f - dot=%.3f, theta=%.1f\n",dir.x,dir.y,dir.z,dot,theta);
7156 // mprintf(0,"Frame offset: %.1f\n",frame_offset);
7157
7158 // Get the dest frame between start and end frames for reference
7159 if (dir.xcxx . . $ vector#x. < 0.0f)
7160 frame_offset = -frame_offset;
7161 dest_frame = SC_MID_FRAMEcxx . . $ `scripts/AIGame3.cpp:1361:9`! + frame_offset;
7162
7163 // Get the current frame between start and end frames for reference
7164 curr_frame = curr_anim_frame;
7165 if (curr_frame > SC_END_FRAMEcxx . . $ `scripts/AIGame3.cpp:1362:9`!)
7166 curr_frame = SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! - curr_frame;
7167
7168 // Prevent wobbling between two frames
7169 if (abscxx . . $ abs(fbcf3211dfe1bfd1).(dest_frame - curr_frame) <= SC_FRAME_DELTA_ERRORcxx . . $ `scripts/AIGame3.cpp:1366:9`!) {
7170 dest_frame = curr_frame;
7171 }
7172
7173 // Check if frames are reversed, and adjust accordingly
7174 if (dest_frame < curr_frame) {
7175 dest_frame = SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! - dest_frame;
7176 curr_frame = SC_MAX_FRAMEcxx . . $ `scripts/AIGame3.cpp:1363:9`! - curr_frame;
7177 }
7178
7179 // Calculate the animation time to go from curr_frame to dest_frame
7180 anim_time = (dest_frame - curr_frame) / SC_TRACK_SPEEDcxx . . $ `scripts/AIGame3.cpp:1358:9`!;
7181 /*
7182 // Calculate the max distance we can move it this frame
7183 anim_time = Game_GetTime() - memory->last_update_anim_time;
7184 next_frame = curr_frame + (anim_time*SC_PAN_SPEED);
7185 if(next_frame > dest_frame) next_frame=dest_frame;
7186 Obj_SetCustomAnim(me, next_frame, next_frame, 0.0f, AIAF_IMMEDIATE, -1, -1);
7187 */
7188
7189 // Set the next custom animation
7190 Obj_SetCustomAnimcxx . . $ Obj_SetCustomAnim(d2ce4cea4bbae452).(me, curr_frame, dest_frame, anim_time, AIAF_IMMEDIATEcxx . . $ `Descent3/aistruct_external.h:119:9`!, -1, -1);
7191 // mprintf(0,"Curr frame: %.6f, Dest frame: %.6f, Anim time: %.1f\n",curr_frame,dest_frame,anim_time);
7192
7193 // Record the last update anim time
7194 // memory->last_update_anim_time = Game_GetTime();
7195 }
7196
7197 // If we've successfully tracked target for a while, then we are alerted
7198 if (memorycxx . . $ SecurityCamera#memory.->mode_timecxx . . $ securitycamera_data#mode_time. >= SC_TRACK_TIME_TO_ALERTcxx . . $ `scripts/AIGame3.cpp:1353:9`! && !memorycxx . . $ SecurityCamera#memory.->alertedcxx . . $ securitycamera_data#alerted.) {
7199 memorycxx . . $ SecurityCamera#memory.->alertedcxx . . $ securitycamera_data#alerted. = true;
7200 mprintfcxx . . $ mprintf.(0, "Alerted!\n");
7201 }
7202 } break;
7203 }
7204
7205 // mprintf(0,"Anim frame: %.2f\n",curr_anim_frame);
7206
7207 // if(last_see_time < 3.0f)
7208 // mprintf(0,"Camera saw target %.2f seconds ago!\n",last_see_time);
7209
7210 // Increment the current mode time
7211 memorycxx . . $ SecurityCamera#memory.->mode_timecxx . . $ securitycamera_data#mode_time. += Game_GetFrameTimecxx . . $ Game_GetFrameTime.();
7212 }
7213
7214 // Process all AI Notify events
7215 bool SecurityCameracxx . . $ SecurityCamera#::DoNotifycxx . . $ SecurityCamera#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
7216 if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!) {
7217 bot_comcxx . . $ bot_com# *com = (bot_comcxx . . $ bot_com# *)data->extra_infocxx . . $ tOSIRISEventInfo#extra_info.;
7218
7219 return ReceiveCommandcxx . . $ SecurityCamera#ReceiveCommand(1fae7c3a3935cb04).(me, data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle., com->actioncxx . . $ bot_com#action., com->ptrcxx . . $ bot_com#ptr.);
7220 }
7221
7222 return true;
7223 }
7224
7225 // Receives all basic events and calls processesing functions
7226 int16_t SecurityCameracxx . . $ SecurityCamera#::CallEventcxx . . $ SecurityCamera#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
7227 switch (event) {
7228 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
7229 DoInitcxx . . $ SecurityCamera#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
7230 break;
7231 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
7232 DoFramecxx . . $ SecurityCamera#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
7233 break;
7234 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
7235 return (DoNotifycxx . . $ SecurityCamera#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
7236 break;
7237 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
7238 // DoDamage(data->me_handle, &data->evt_damaged);
7239 break;
7240 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
7241 break;
7242 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
7243 // DoCollide(data->me_handle, &data->evt_collide);
7244 break;
7245 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
7246 memorycxx . . $ SecurityCamera#memory. = (securitycamera_datacxx . . $ securitycamera_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
7247 break;
7248 }
7249
7250 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
7251 }
7252
7253 //-----------------------
7254 // Crowd Control class
7255 //-----------------------
7256
7257 // Sends a command out to another alien
7258 bool CrowdControlcxx . . $ CrowdControl#::SendCommandcxx . . $ CrowdControl#SendCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
7259 bot_comcxx . . $ bot_com# com;
7260
7261 com.actioncxx . . $ bot_com#action. = command;
7262 com.ptrcxx . . $ bot_com#ptr. = ptr;
7263
7264 tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei;
7265
7266 ei.me_handlecxx . . $ tOSIRISEventInfo#me_handle. = it;
7267 ei.extra_infocxx . . $ tOSIRISEventInfo#extra_info. = (void *)&com;
7268 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!;
7269 ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = me;
7270
7271 return Obj_CallEventcxx . . $ Obj_CallEvent.(it, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei);
7272 }
7273
7274 // Processes a command from another alien
7275 bool CrowdControlcxx . . $ CrowdControl#::ReceiveCommandcxx . . $ CrowdControl#ReceiveCommand(1fae7c3a3935cb04).(int me, int it, char command, void *ptr) {
7276 switch (command) {
7277 // Alien is asked to return current mode
7278 case CC_COM_SET_DATAcxx . . $ `scripts/AIGame3_External.h:49:9`!: {
7279 cc_packetcxx . . $ cc_packet# *data = (cc_packetcxx . . $ cc_packet# *)ptr;
7280
7281 memorycxx . . $ CrowdControl#memory.->follow_handlecxx . . $ crowdcontrol_data#follow_handle. = data->follow_handlecxx . . $ cc_packet#follow_handle.;
7282 memorycxx . . $ CrowdControl#memory.->stop_distcxx . . $ crowdcontrol_data#stop_dist. = data->stop_distcxx . . $ cc_packet#stop_dist.;
7283 memorycxx . . $ CrowdControl#memory.->slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset. = data->slowdown_offsetcxx . . $ cc_packet#slowdown_offset.;
7284
7285 mprintfcxx . . $ mprintf.(0, "Set Crowd Control Data.\n");
7286 return true;
7287 } break;
7288
7289 case CC_COM_DISABLE_CHECKcxx . . $ `scripts/AIGame3_External.h:50:9`!: {
7290 memorycxx . . $ CrowdControl#memory.->disable_checkcxx . . $ crowdcontrol_data#disable_check. = *(bool *)ptr;
7291
7292 mprintfcxx . . $ mprintf.(0, "Crowd control disable check set to: %d\n", memorycxx . . $ CrowdControl#memory.->disable_checkcxx . . $ crowdcontrol_data#disable_check.);
7293 } break;
7294 }
7295
7296 return false;
7297 }
7298
7299 // Processes the AI Initialize event
7300 void CrowdControlcxx . . $ CrowdControl#::DoInitcxx . . $ CrowdControl#DoInit(d4f767463ce0a6b3).(int me) {
7301 // Setup memory data
7302 tOSIRISMEMCHUNKcxx . . $ tOSIRISMEMCHUNK# ch;
7303 ch.idcxx . . $ tOSIRISMEMCHUNK#id. = CC_MEMORY_IDcxx . . $ `scripts/AIGame3.cpp:1412:9`!;
7304 ch.sizecxx . . $ tOSIRISMEMCHUNK#size. = sizeof(crowdcontrol_datacxx . . $ crowdcontrol_data#);
7305 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..typecxx . . $ tOSIRISSCRIPTID#type. = OBJECT_SCRIPTcxx . . $ OBJECT_SCRIPT.;
7306 ch.my_idcxx . . $ tOSIRISMEMCHUNK#my_id..objhandlecxx . . $ tOSIRISSCRIPTID#$anonymous_type_3#objhandle. = me;
7307
7308 memorycxx . . $ CrowdControl#memory. = (crowdcontrol_datacxx . . $ crowdcontrol_data# *)Scrpt_MemAlloccxx . . $ Scrpt_MemAlloc.(&ch);
7309
7310 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ CrowdControl#memory.->base_speedcxx . . $ crowdcontrol_data#base_speed.);
7311
7312 memorycxx . . $ CrowdControl#memory.->follow_handlecxx . . $ crowdcontrol_data#follow_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
7313 memorycxx . . $ CrowdControl#memory.->stop_distcxx . . $ crowdcontrol_data#stop_dist. = 0.0f;
7314 memorycxx . . $ CrowdControl#memory.->slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset. = 0.0f;
7315
7316 memorycxx . . $ CrowdControl#memory.->disable_checkcxx . . $ crowdcontrol_data#disable_check. = false;
7317
7318 memorycxx . . $ CrowdControl#memory.->next_check_timecxx . . $ crowdcontrol_data#next_check_time. = Game_GetTimecxx . . $ Game_GetTime.();
7319
7320 mprintfcxx . . $ mprintf.(0, "CrowdControl Initialized.\n");
7321 }
7322
7323 // Processes the AI Frame Interval Event
7324 void CrowdControlcxx . . $ CrowdControl#::DoFramecxx . . $ CrowdControl#DoFrame(d4f767463ce0a6b3).(int me) {
7325 // If data hasn't been set yet, just bail
7326 if (memorycxx . . $ CrowdControl#memory.->follow_handlecxx . . $ crowdcontrol_data#follow_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
7327 return;
7328
7329 // See if we need to do a distance check yet
7330 if (Game_GetTimecxx . . $ Game_GetTime.() >= memorycxx . . $ CrowdControl#memory.->next_check_timecxx . . $ crowdcontrol_data#next_check_time.) {
7331 memorycxx . . $ CrowdControl#memory.->next_check_timecxx . . $ crowdcontrol_data#next_check_time. = Game_GetTimecxx . . $ Game_GetTime.() + CC_CHECK_INTERVALcxx . . $ `scripts/AIGame3.cpp:1414:9`!;
7332
7333 float my_max_speed;
7334 bool ok_to_move_normally = false;
7335
7336 // Get my current max speed
7337 AI_Valuecxx . . $ AI_Value.(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &my_max_speed);
7338
7339 // Make sure the object we're following still exists
7340 if (!memorycxx . . $ CrowdControl#memory.->disable_checkcxx . . $ crowdcontrol_data#disable_check. && qObjExistscxx . . $ qObjExists(83c267b20bac841a).(memorycxx . . $ CrowdControl#memory.->follow_handlecxx . . $ crowdcontrol_data#follow_handle.)) {
7341 vectorcxx . . $ vector# my_vel, my_pos, leader_pos, leader_dir;
7342 matrixcxx . . $ matrix# my_orient;
7343 float my_max_speed, dist, new_speed;
7344
7345 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_VELOCITYcxx . . $ `scripts/osiris_common.h:631:9`!, &my_vel);
7346 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &my_pos);
7347 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(me, VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_M_ORIENTcxx . . $ `scripts/osiris_common.h:629:9`!, &my_orient);
7348 Obj_Valuecxx . . $ Obj_Value(504a19c195c7574e).(memorycxx . . $ CrowdControl#memory.->follow_handlecxx . . $ crowdcontrol_data#follow_handle., VF_GETcxx . . $ `scripts/osiris_common.h:450:9`!, OBJV_V_POScxx . . $ `scripts/osiris_common.h:628:9`!, &leader_pos);
7349
7350 // It's ok to move in reverse, or away from leader
7351 ok_to_move_normally = ((my_vel *cxx . . $ `operator*`(4a721543d64e126a). my_orient.fveccxx . . $ matrix#fvec.) <= 0.0f) ? true : false;
7352 if (!ok_to_move_normally) {
7353 leader_dir =cxx . . $ vector#`operator=`(c0842353a20857d). leader_pos -cxx . . $ operator-(b77b703cd1e43e33). my_pos;
7354 ok_to_move_normally = ((my_vel *cxx . . $ `operator*`(4a721543d64e126a). leader_dir) <= 0.0f) ? true : false;
7355 }
7356
7357 // Check to see if we're too close to leader (so we can slow down and stop)
7358 dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&my_pos, &leader_pos);
7359 if (!ok_to_move_normally && dist < (memorycxx . . $ CrowdControl#memory.->stop_distcxx . . $ crowdcontrol_data#stop_dist. + memorycxx . . $ CrowdControl#memory.->slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset.)) {
7360 if (dist <= memorycxx . . $ CrowdControl#memory.->stop_distcxx . . $ crowdcontrol_data#stop_dist. || memorycxx . . $ CrowdControl#memory.->slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset. == 0.0f) {
7361 new_speed = CC_MIN_STOPPING_SPEEDcxx . . $ `scripts/AIGame3.cpp:1415:9`!;
7362 } else {
7363 float curr_diff;
7364 curr_diff = dist - memorycxx . . $ CrowdControl#memory.->stop_distcxx . . $ crowdcontrol_data#stop_dist.;
7365
7366 new_speed = CC_MIN_STOPPING_SPEEDcxx . . $ `scripts/AIGame3.cpp:1415:9`! + ((curr_diff / memorycxx . . $ CrowdControl#memory.->slowdown_offsetcxx . . $ crowdcontrol_data#slowdown_offset.) * memorycxx . . $ CrowdControl#memory.->base_speedcxx . . $ crowdcontrol_data#base_speed.);
7367 }
7368
7369 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &new_speed);
7370 }
7371 } else {
7372 ok_to_move_normally = true;
7373 }
7374
7375 // Restore the max speed to the original value if necessary
7376 if (ok_to_move_normally && my_max_speed != memorycxx . . $ CrowdControl#memory.->base_speedcxx . . $ crowdcontrol_data#base_speed.) {
7377 AI_Valuecxx . . $ AI_Value.(me, VF_SETcxx . . $ `scripts/osiris_common.h:449:9`!, AIV_F_MAX_SPEEDcxx . . $ `scripts/osiris_common.h:505:9`!, &memorycxx . . $ CrowdControl#memory.->base_speedcxx . . $ crowdcontrol_data#base_speed.);
7378 }
7379 }
7380 }
7381
7382 // Process all AI Notify events
7383 bool CrowdControlcxx . . $ CrowdControl#::DoNotifycxx . . $ CrowdControl#DoNotify(a880c8b99cdc05b4).(int me, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
7384 if (data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. == AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!) {
7385 bot_comcxx . . $ bot_com# *com = (bot_comcxx . . $ bot_com# *)data->extra_infocxx . . $ tOSIRISEventInfo#extra_info.;
7386
7387 return ReceiveCommandcxx . . $ CrowdControl#ReceiveCommand(1fae7c3a3935cb04).(me, data->evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle., com->actioncxx . . $ bot_com#action., com->ptrcxx . . $ bot_com#ptr.);
7388 }
7389
7390 return true;
7391 }
7392
7393 // Receives all basic events and calls processesing functions
7394 int16_t CrowdControlcxx . . $ CrowdControl#::CallEventcxx . . $ CrowdControl#CallEvent(585a6502c7945bab).(int event, tOSIRISEventInfocxx . . $ tOSIRISEventInfo# *data) {
7395 switch (event) {
7396 case EVT_AI_INITcxx . . $ `scripts/osiris_common.h:372:9`!:
7397 DoInitcxx . . $ CrowdControl#DoInit(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
7398 break;
7399 case EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!:
7400 DoFramecxx . . $ CrowdControl#DoFrame(d4f767463ce0a6b3).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle.);
7401 break;
7402 case EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!:
7403 return (DoNotifycxx . . $ CrowdControl#DoNotify(a880c8b99cdc05b4).(data->me_handlecxx . . $ tOSIRISEventInfo#me_handle., data) != false) ? CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`! : 0;
7404 break;
7405 case EVT_DAMAGEDcxx . . $ `scripts/osiris_common.h:365:9`!:
7406 // DoDamage(data->me_handle, &data->evt_damaged);
7407 break;
7408 case EVT_DESTROYcxx . . $ `scripts/osiris_common.h:368:9`!:
7409 break;
7410 case EVT_COLLIDEcxx . . $ `scripts/osiris_common.h:366:9`!:
7411 // DoCollide(data->me_handle, &data->evt_collide);
7412 break;
7413 case EVT_MEMRESTOREcxx . . $ `scripts/osiris_common.h:378:9`!:
7414 memorycxx . . $ CrowdControl#memory. = (crowdcontrol_datacxx . . $ crowdcontrol_data# *)data->evt_memrestorecxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_memrestore..memory_ptrcxx . . $ tOSIRISEVTMEMRESTORE#memory_ptr.;
7415 break;
7416 }
7417
7418 return CONTINUE_CHAINcxx . . $ `scripts/osiris_common.h:357:9`! | CONTINUE_DEFAULTcxx . . $ `scripts/osiris_common.h:358:9`!;
7419 }