Debian Codegraph @

Descent3/aistruct_external.h

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 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/aistruct_external.h $
21 * $Revision: 29 $
22 * $Date: 10/23/99 2:43a $
23 * $Author: Chris $
24 *
25 * Description goes here
26 *
27 * $Log: /DescentIII/main/aistruct_external.h $
28 *
29 * 29 10/23/99 2:43a Chris
30 * Added the PutObjectOnObject AI Goal
31 *
32 * 28 10/17/99 11:58p Chris
33 * Improved the hearing/seeing code, Added AIN_FIRED_WEAPON notify, and
34 * added a *hack* so that the final boss could fire his weapons during a
35 * cutscene... (usually this is a no-no).
36 *
37 * 27 5/05/99 4:56p Chris
38 * Added the RType powerup for the GB
39 *
40 * 26 5/01/99 2:21a Chris
41 * Use the GF_SPEED_XXX stuff
42 *
43 * 25 4/30/99 2:47p Chris
44 * Added the GF_SPEED stuff
45 *
46 * 24 4/28/99 5:33a Chris
47 * Further improved the BNode system. (It actually works inside and
48 * outside now)
49 *
50 * 23 4/24/99 2:20a Chris
51 * Added the Neutral_till_hit flag
52 *
53 * 22 4/18/99 7:27a Chris
54 * Added AIAF_IMMEDIATE to force non-tiling and instant anim loop changes
55 *
56 * 21 4/09/99 10:33a Chris
57 * Improvements to Freud
58 *
59 * 20 3/30/99 4:32p Chris
60 * Moved subtype to the main goal sturct (from goal_info). Made move
61 * relative object vec finishable. (Like get behind player)
62 *
63 * 19 3/27/99 3:25p Chris
64 * Added comment headers
65 *
66 * $NoKeywords: $
67 */
68
69 #ifndef _AISTRUCT_EXTERNAL_H_
70 #define _AISTRUCT_EXTERNAL_H_
71
72 // AI Type -- make sure to update MAX_AI_TYPES if you add a new class
73
74 #define AIT_FLYLANDER 0
75 #define AIT_STALKER 1
76 #define AIT_EVADER1 2
77 #define AIT_EVADER2 3
78 #define AIT_STATIONARY_TURRET 4
79 #define AIT_AIS 5
80 #define AIT_MELEE1 6
81 #define AIT_BIRD_FLOCK1 7
82 #define AIT_HERD1 8
83
84 // AI Movement flying types
85
86 #define AIMF_NORMAL 0
87 #define AIMF_PATH 1
88 #define AIMF_HELICOPTER 2
89 #define AIMF_HOVERCRAFT 3
90 #define AIMF_JET 4
91 #define AIMF_PLAYERLIKE 5 // For NPC ships
92 #define AIMF_BUDDYLIKE 6 // For theif/buddy bots
93
94 //-------------------------------------------------
95 // AI Movement Information
96 //-------------------------------------------------
97
98 // AI Movement walking types
99
100 #define AIMW_RESTRICTED_FLAT \
101 0 // Specify a min/max angle of incline (so we can restrict movement -- i.e we can even do
102 // ceiling only robots)
103 #define AIMW_RESTRICTED_LOW_ANGLE 1
104 #define AIMW_RESTRICTED_HIGH_ANGLE 2
105 #define AIMW_NON_RESTRICTED 3
106 #define AIMW_UNDERWATERONLY 4 // Stays in water
107 #define AIMW_WATERSURFACE 5
108
109 //-------------------------------------------------
110 // AI Animation Info
111 //-------------------------------------------------
112
113 // animation flags
114
115 #define AIAF_LOOPING 1
116 #define AIAF_NOTIFY 2
117 #define AIAF_UPDATE_WBS 4
118 #define AIAF_USE_SPEED 8
119 #define AIAF_IMMEDIATE 16 // Force to not tile and set immediately
120
121 #define AIPM_ORIENT 0x00000018 // Masks for Orientation
122 #define AIPF_NEXT_NODE 0x00000000 // Orientate to velocity
123 #define AIPF_VELOCITY 0x00000008 // No automatic updating of orientation
124 #define AIPF_NODE_ORIENT 0x00000010 // Node orientate
125 #define AIPF_USER_DEFINED 0x00000018 // Always face the next node
126
127 //-------------------------------------------------
128 // AI Goal Enders
129 //-------------------------------------------------
130
131 #define MAX_ENABLERS_PER_GOAL 5 // We might malloc this depending of space and varitions between AIs
132
133 // Ender types
134
135 /*
136 #define AIE_NOT_USED 0
137 #define AIE_PLAYER_DEAD 1
138 #define AIE_PLAYER_AWAY 2
139 #define AIE_SEE_OBJ 3
140 #define AIE_TOUCH_OBJ 5
141 #define AIE_HIDE_FROM_OBJ 6
142 #define AIE_NOT_COLLIDE_VECTOR 7 // OBJ and sig. make sure the dead/new objects are not avoided.
143 #define AIE_TIME_TILL_GOAL_KILL 8
144 #define AIE_MOVEMENT_TYPE 9
145 #define AIE_AFTER_TASK 10 // Endable goals (like touch obj, fire on obj)
146 #define AIE_POSITION 11
147 #define AIE_VELOCITY 12
148 #define AIE_NOT_MOVEMENT_TYPE 13
149 #define AIE_ADD_GOAL_TYPE 14
150 #define AIE_FUZZY_TIME 15
151 #define AIE_DIFF_ROOM 16 // On the terrain it means a distance of more than ???
152 #define AIE_SAME_ROOM 18
153 */
154
155 #define AIE_NEAR 1
156 #define AIE_FAR 2
157 #define AIE_LTE_AWARENESS 3
158 #define AIE_GT_AWARENESS 4
159 #define AIE_LTE_LAST_SEE_TARGET_INTERVAL 5
160 #define AIE_GT_LAST_SEE_TARGET_INTERVAL 6
161 #define AIE_AI_STATUS_FLAG 7
162 #define AIE_SCRIPTED 8
163 #define AIE_FEAR 9
164 #define AIE_ANGRY 10
165 #define AIE_CURIOUS 11
166 #define AIE_FRUSTRATED 12
167 #define AIE_DELAY_TIME 13
168 #define AIE_CLEAR_TIME 14
169
170 // How are the ending conditions related (BOOLEAN INFO)
171
172 #define ENABLER_AND_NEXT 0
173 #define ENABLER_OR_NEXT 1
174 #define ENABLER_XOR_NEXT 3
175 #define ENABLER_NEW_BOOL_NEXT 4
176
177 // Maximum goals a robot can have at any given time
178 #define MAX_GOALS 10
179
180 // AI Goal Types
181 #define AIG_GET_AWAY_FROM_OBJ 0x00000001 // Distance
182 #define AIG_HIDE_FROM_OBJ 0x00000002 // Line of sight
183 #define AIG_GET_TO_OBJ 0x00000004 // Butt up to an object
184 #define AIG_ATTACH_TO_OBJ 0x00000008 // Within a distance from obj
185 #define AIG_FIRE_AT_OBJ 0x00000010
186 #define AIG_MELEE_TARGET 0x00000020
187 #define AIG_WANDER_AROUND 0x00000040
188 #define AIG_USE_MOVEMENT_TYPE 0x00000080
189 #define AIG_PLACE_OBJ_ON_OBJ 0x00000100
190 #define AIG_GUARD_OBJ 0x00000200
191 #define AIG_GUARD_AREA 0x00000400
192 #define AIG_BLANK3 0x00000800
193 #define AIG_FACE_DIR 0x00001000
194 #define AIG_DODGE_OBJ 0x00002000
195 #define AIG_FOLLOW_PATH 0x00004000
196 #define AIG_SET_ANIM 0x00008000
197 #define AIG_SCRIPTED 0x00010000
198 #define AIG_MOVE_AROUND_OBJ 0x00020000
199 #define AIG_MOVE_RELATIVE_OBJ_VEC 0x00040000
200 #define AIG_MOVE_RELATIVE_OBJ 0x00080000
201 #define AIG_GET_TO_POS 0x00100000
202 #define AIG_DO_MELEE_ANIM 0x00200000
203 #define AIG_GET_AROUND_OBJ 0x00400000
204 #define AIG_GET_AROUND_POS 0x00800000
205 #define AIG_ALIGNMENT 0x01000000
206 #define AIG_AVOID_OBJ 0x02000000
207 #define AIG_COHESION_OBJ 0x04000000
208 #define AIG_ALIGN_OBJ 0x08000000
209
210 // Goal end types (Not used yet)
211 #define AIGE_HANDLE_INVALID 0
212 #define AIGE_SUCESSFUL 1
213 #define AIGE_OVERLOAD 2
214
215 // Goal Flags
216 #define GF_NONFLUSHABLE 0x00000001 // A perminent goal
217 #define GF_HAS_PATH 0x00000002 // This goal has a path (not used yet)
218 #define GF_KEEP_AT_COMPLETION 0x00000004 // Keeps the goal as long at it is valid
219 #define GF_NOTIFIES 0x00000008 // By default, goals do not notify (unless an error occurs)
220 #define GF_OBJ_IS_TARGET 0x00000010
221 #define GF_CIRCLE_OBJ 0x00000020
222 #define GF_CIRCLE_POS 0x00000040
223 #define GF_USE_BLINE_IF_SEES_GOAL 0x00000080
224 #define GF_FORCE_AWARENESS 0x00000100
225 #define GF_OBJS_ARE_FRIENDS 0x00000200
226 #define GF_OBJS_ARE_SPECIES 0x00000400
227 #define GF_OBJS_ARE_ENEMIES 0x00000800
228 #define GF_ORIENT_VELOCITY \
229 0x00001000 // Defaults to target if there is one (otherwise, to velocity) This flag forces velocity.
230 #define GF_RAMPED_INFLUENCE 0x00002000 // By default, distance based goals are (less dist = more influence)
231 #define GF_MIN_MAX_INFLUENCE 0x00004000
232 #define GF_SCRIPTED_INFLUENCE 0x00008000
233 #define GF_ORIENT_TARGET 0x00010000
234 #define GF_ORIENT_SCRIPTED 0x00020000
235 #define GF_ORIENT_GOAL_OBJ 0x00040000
236 #define GF_ORIENT_FOR_ATTACH 0x00080000
237 #define GF_ORIENT_PATH_NODE 0x00100000
238 #define GF_PATH_FOLLOW_EXACTLY 0x00200000
239 #define GF_PATH_REVERSE_AT_END 0x00400000
240 #define GF_PATH_CIRCLE_AT_END 0x00800000
241 #define GFM_END_OF_PATH (GF_PATH_REVERSE_AT_END | GF_PATH_CIRCLE_AT_END)
242 #define GF_PATH_MOVE_REVERSE_DIR 0x01000000
243 #define GF_IN_CLEAR 0x02000000 // (Internal flag) Accounts for new goals overriding old goals within a GoalClearGoal
244 #define GF_IS_ATTACH_CHILD 0x04000000 // The moving object (for the attach goal) is actually the child
245 #define GF_CLEAR_IF_NOT_CURRENT_GOAL 0x08000000 // Removes the goal if it isn't the current one
246 #define GF_ORIENT_SET_FVEC 0x10000000 // Face the direction of the fvec
247 #define GF_ORIENT_SET_FVEC_UVEC 0x20000000 // Face the fvec and uvec
248 #define GF_SPEED_MASK (0x40000000 | 0x80000000)
249 #define GF_SPEED_NORMAL 0x00000000
250 #define GF_SPEED_DODGE 0x40000000
251 #define GF_SPEED_FLEE 0x80000000
252 #define GF_SPEED_ATTACK (0x40000000 | 0x80000000)
253
254 #define GWF_ONLY_IN_CUR_MINE 0x00
255 #define GWF_ONLY_MINES 0x01
256 #define GWF_ONLY_TERRAIN 0x02
257
258 #define ISORIENTGOAL(x) \
259 ((x)->flags & (GF_ORIENT_VELOCITY | GF_ORIENT_TARGET | GF_ORIENT_SCRIPTED | GF_ORIENT_GOAL_OBJ | \
260 GF_ORIENT_FOR_ATTACH | GF_ORIENT_PATH_NODE | GF_ORIENT_SET_FVEC | GF_ORIENT_SET_FVEC_UVEC))
261 #define ISTRACKGOAL(x) ((x)->flags & (GF_OBJS_ARE_FRIENDS | GF_OBJS_ARE_SPECIES | GF_OBJS_ARE_ENEMIES))
262
263 // Goal Sub-Types -- game.consts
264 #define GST_FVEC 0
265 #define GST_NEG_FVEC 1
266 #define GST_RVEC 2
267 #define GST_NEG_RVEC 3
268 #define GST_UVEC 4
269 #define GST_NEG_UVEC 5
270
271 // Influence constants
272 #define MAX_INFLUENCE 10000.0f
273 #define HIGH_INFLUENCE 10.0f
274 #define NORMAL_INFLUENCE 1.0f
275 #define LOW_INFLUENCE 0.5f
276
277 #define MAX_INFLUENCE_DELTA_CONSIDER 100.0f
278
279 #define NUM_ACTIVATION_LEVELS 4
280 #define ACTIVATION_BLEND_LEVEL 100
281
282 //-------------------------------------------------
283 // AI notification of events
284 //-------------------------------------------------
285
286 #define AIN_NEW_MOVEMENT 1
287 #define AIN_OBJ_KILLED 2
288 #define AIN_WHIT_BY_OBJ 3
289 #define AIN_SEE_TARGET 4
290 #define AIN_PLAYER_SEES_YOU 5
291 #define AIN_WHIT_OBJECT 6
292 #define AIN_TARGET_DIED 7 // In code, it only notifies if the target is gone
293 #define AIN_OBJ_FIRED 8
294 #define AIN_GOAL_COMPLETE 9
295 #define AIN_GOAL_FAIL 10
296 #define AIN_GOAL_ERROR 11
297 #define AIN_HEAR_NOISE 12
298 #define AIN_NEAR_TARGET 13
299 #define AIN_HIT_BY_WEAPON 14
300 #define AIN_NEAR_WALL 15
301 #define AIN_USER_DEFINED 16 // Processed in script
302 #define AIN_TARGET_INVALID 17 // Goal is killed
303 #define AIN_GOAL_INVALID 18
304 #define AIN_SCRIPTED_GOAL 19
305 #define AIN_SCRIPTED_ENABLER 20
306 #define AIN_ANIM_COMPLETE 21
307 #define AIN_BUMPED_OBJ 22
308 #define AIN_MELEE_HIT 23
309 #define AIN_MELEE_ATTACK_FRAME 24
310 #define AIN_SCRIPTED_INFLUENCE 25
311 #define AIN_SCRIPTED_ORIENT 26
312 #define AIN_MOVIE_START 27
313 #define AIN_MOVIE_END 28
314 #define AIN_FIRED_WEAPON 29
315
316 #define AI_NOTIFIES_ALWAYS_ON \
317 ((0x00000001 << AIN_ANIM_COMPLETE) | (0x00000001 << AIN_NEW_MOVEMENT) | (0x00000001 << AIN_PLAYER_SEES_YOU) | \
318 (0x00000001 << AIN_GOAL_COMPLETE) | (0x00000001 << AIN_GOAL_FAIL) | (0x00000001 << AIN_GOAL_ERROR) | \
319 (0x00000001 << AIN_USER_DEFINED) | (0x00000001 << AIN_TARGET_DIED) | (0x00000001 << AIN_TARGET_INVALID) | \
320 (0x00000001 << AIN_BUMPED_OBJ) | (0x00000001 << AIN_MELEE_HIT) | (0x00000001 << AIN_MELEE_ATTACK_FRAME) | \
321 (0x00000001 << AIN_TARGET_INVALID))
322
323 #define AWARE_FULLY 100.0f
324 #define AWARE_MOSTLY 60.0f
325 #define AWARE_PARTIALLY 30.0f
326 #define AWARE_BARELY 15.0f
327 #define AWARE_NONE 0.0f
328
329 #define MAX_AWARE_TIME 5.0f
330 #define MAX_RENDER_RECENTLY_TIME 120.0f
331
332 #define AWARENESS_RENDER_RECENTLY_INTERVAL 20.0f
333 #define AWARENESS_SEE_TARGET_RECENTLY_INTERVAL 25.0f
334
335 #define AWARE_FALLOFF (AWARE_FULLY / MAX_AWARE_TIME)
336 #define AWARE_RENDER_RECENTLY_FALLOFF (AWARE_FULLY / MAX_RENDER_RECENTLY_TIME)
337
338 #define MIN_NEXT_PATH_INTERVAL 2.0f
339
340 //-------------------------------------------------
341 // AI flags
342 //-------------------------------------------------
343
344 // Flags for AI info
345 #define AIF_WEAPON1 0x00000001
346 #define AIF_WEAPON2 0x00000002
347 #define AIF_MELEE1 0x00000004
348 #define AIF_MELEE2 0x00000008
349 #define AIF_STAYS_INOUT 0x00000010
350
351 #define AIF_GB_MIMIC_PLAYER_FIRING_HACK 0x00000010
352
353 #define AIF_ACT_AS_NEUTRAL_UNTIL_SHOT 0x00000020
354 #define AIF_PERSISTANT 0x00000040
355 #define AIF_DODGE 0x00000080
356 #define AIF_FIRE 0x00000100
357 #define AIF_FLINCH 0x00000200
358 #define AIF_DETERMINE_TARGET 0x00000400
359 #define AIF_AIM 0x00000800
360 #define AIF_ONLY_TAUNT_AT_DEATH 0x00001000
361 #define AIF_AVOID_WALLS 0x00002000
362 #define AIF_DISABLED 0x00004000
363 #define AIF_FLUCTUATE_SPEED_PROPERTIES 0x00008000
364 #define AIF_TEAM_MASK 0x00030000
365 #define AIF_TEAM_PTMC 0x00000000
366 #define AIF_TEAM_REBEL 0x00010000
367 #define AIF_TEAM_HOSTILE 0x00020000
368 #define AIF_TEAM_NEUTRAL 0x00030000
369 #define AIF_ORDERED_WB_FIRING 0x00040000
370 #define AIF_ORIENT_TO_VEL 0x00080000
371 #define AIF_XZ_DIST 0x00100000
372 #define AIF_REPORT_NEW_ORIENT 0x00200000
373 #define AIF_TARGET_BY_DIST 0x00400000
374 #define AIF_DISABLE_FIRING 0x00800000
375 #define AIF_DISABLE_MELEE 0x01000000
376 #define AIF_AUTO_AVOID_FRIENDS 0x02000000
377 #define AIF_TRACK_CLOSEST_2_FRIENDS 0x04000000
378 #define AIF_TRACK_CLOSEST_2_ENEMIES 0x08000000
379 #define AIF_BIASED_FLIGHT_HEIGHT 0x10000000
380 #define AIF_FORCE_AWARENESS 0x20000000
381 #define AIF_UVEC_FOV 0x40000000
382 #define AIF_AIM_PNT_FOV 0x80000000
383
384 #define AI_ATTACK_SOUND 0
385 #define AI_SEE_SOUND 1
386 #define AI_FLEE_SOUND 2
387 #define AI_ANGRY_SOUND 3
388 #define AI_TURRET_SOUND 4
389
390 //-------------------------------------------------
391 // AI Status Registers
392 //-------------------------------------------------
393
394 #define AISR_FLEE 0x00000001
395 #define AISR_ATTACKING 0x00000002
396 #define AISR_CIRCLE_DIST 0x00000004
397 #define AISR_PATH 0x00000008
398 #define AISR_MELEE 0x00000010
399 #define AISR_RANGED_ATTACK 0x00000020 // Full body stuff
400 #define AISR_SEES_GOAL 0x00000040
401 #define AISR_OK_TO_FIRE_DURING_CINEMATICS \
402 0x00000080 // Chrishack - this should be a flag and not an SR, but we are out of flag space and time is critical for
403 // the mission pack
404
405 //-------------------------------------------------
406 // AI Anim states
407 //-------------------------------------------------
408
409 #define AS_ALERT 0
410 #define AS_DEATH 1
411 #define AS_BIRTH 2
412 #define AS_MISSILE1_RECOIL 3
413 #define AS_MISSILE2 4
414 #define AS_MISSILE2_RECOIL 5
415 #define AS_MELEE1 6
416 #define AS_MELEE1_RECOIL 7
417 #define AS_MELEE2 8
418 #define AS_MELEE2_RECOIL 9
419 #define AS_IDLE 10
420 #define AS_QUIRK 11
421 #define AS_FLINCH 12
422 #define AS_TAUNT 13
423 #define AS_GOTO_IDLE_STANDING 14
424 #define AS_GOTO_IDLE_FLYING 15
425 #define AS_GOTO_IDLE_ROLLING 16
426 #define AS_GOTO_IDLE_WALKING 17
427 #define AS_GOTO_IDLE_JUMPING 18
428 #define AS_GOTO_ALERT_STANDING 19
429 #define AS_GOTO_ALERT_FLYING 20
430 #define AS_GOTO_ALERT_ROLLING 21
431 #define AS_GOTO_ALERT_WALKING 22
432 #define AS_GOTO_ALERT_JUMPING 23
433 #define AS_TO_SIDE_STEP 24
434 #define AS_SIDE_STEP 25
435 #define AS_FROM_SIDE_STEP 26
436
437 // These are for ease of coding
438 #define AS_GOTO_IDLE_OFFSET 14
439 #define AS_GOTO_ALERT_OFFSET 19
440
441 // Special -- not on Animation dialog
442 #define AS_RANGED_ATTACK 27
443 #define AS_RANGED_RECOIL 28
444
445 #define AS_CUSTOM 29
446
447 #endif