Debian Codegraph @

Descent3/aistruct.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.h $
21 * $Revision: 112 $
22 * $Date: 10/23/99 2:43a $
23 * $Author: Chris $
24 *
25 * This header is for AI structures
26 *
27 * $Log: /DescentIII/main/aistruct.h $
28 *
29 * 112 10/23/99 2:43a Chris
30 * Added the PutObjectOnObject AI Goal
31 *
32 * 111 5/09/99 8:11p Chris
33 * Made the whole see/hear distintion work (mostly)
34 *
35 * 110 5/08/99 4:12p Chris
36 * Added AI hearing noises... version 1
37 *
38 * 109 4/10/99 6:39p Matt
39 * Only save the designer-editable AI data in the Object_info array,
40 * instead of the whole ai_frame structure. This saves 3200 bytes per
41 * Object_info entry, which is about 2 MB overall.
42 *
43 * 108 4/09/99 10:33a Chris
44 * Improvements to Freud
45 *
46 * 107 4/08/99 3:35p Chris
47 * Improved the Fear factor in Freud
48 *
49 * 106 4/06/99 11:05p Chris
50 * Goal unique id's
51 *
52 * 105 4/02/99 10:18a Chris
53 * We can now mess with the Object_info anim stuff
54 *
55 * 104 3/30/99 4:32p Chris
56 * Moved subtype to the main goal sturct (from goal_info). Made move
57 * relative object vec finishable. (Like get behind player)
58 *
59 * 103 3/27/99 12:29p Chris
60 * Fixed problems with assigned lower priority goals that used paths (it
61 * would confuse the bot because the .path field was getting updated for
62 * the new goal even though it was lower priority)
63 *
64 * 102 3/22/99 10:58a Chris
65 * Awareness code was tweaked. Multisafe stuff added for objects.
66 *
67 * 101 3/17/99 5:23p Chris
68 * Fixed problems with low-priority paths
69 *
70 * 100 3/03/99 7:20p Jeff
71 * save/restore some ai path information
72 *
73 * 99 3/03/99 10:51a Chris
74 * Got rid of goal_ptr
75 *
76 * 98 2/17/99 1:21a Chris
77 * Updated the AI movement algorithm, fixed many bugs, added the
78 * last_dodge_dir vector so that robots can dodge the vauss and the like
79 *
80 * 97 2/15/99 9:03p Chris
81 * Added the base FOV off UVEC code and converted all the turrets
82 *
83 * 96 2/09/99 9:58a Chris
84 * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy
85 * now.
86 *
87 * 95 1/25/99 7:43a Chris
88 * Added the GUID (Goal Unique Id) and added the ability for weapon
89 * batteries to always fire exactly forward.
90 *
91 * 94 1/24/99 8:17p Chris
92 * Updated AI and OSIRIS. Externalized fireball constants for spew and
93 * sparks. Added CreateRandomSparks to OSIRIS, renamed a bunch of AI
94 * Notify names to use underscores. Fixed a memory access leak in the
95 * matcen effect code.
96 *
97 * 93 1/22/99 6:53p Chris
98 * Fixed LoadandBind Aux notify problems, fixed static path problems,
99 * fixed AIF_FORCE_AWARE Problems, improved path code
100 *
101 * 92 1/18/99 9:05a Chris
102 * Improved OSIRIS, AI, and ATTACH system, changed wiggle code, changed
103 * attach code for rad attaches, and added the AIG_ATTACH_OBJ goal
104 *
105 * 91 1/15/99 5:58p Chris
106 *
107 * 90 1/11/99 2:14p Chris
108 * Massive work on OSIRIS and AI
109 *
110 * 89 12/28/98 3:28p Chris
111 * Added aistruct_external.h
112 *
113 * 88 12/16/98 3:55p Chris
114 * Improved the sickles
115 *
116 * 87 12/14/98 12:03a Chris
117 * Turning and orientation are done in one (minus a few hacks) spot
118 *
119 * 86 12/13/98 9:18p Chris
120 * Improved influence values for in-code goals (10000 to 1.0). Added
121 * GF_ORIENT stuff. :)
122 *
123 * 85 12/11/98 1:57p Chris
124 * Improved wall walking code
125 *
126 * 84 12/03/98 5:45p Chris
127 * I just added full code support for OSIRIS/DLL controlled goals,
128 * enablers, and influence levels. :)
129 *
130 * 83 12/03/98 12:04p Chris
131 * Further de-hacked flocking and other major AI systems
132 *
133 * 82 12/02/98 5:51p Chris
134 * Added the start of scripted goals and scripted influence
135 *
136 * 81 12/01/98 6:04p Chris
137 * Made the goal flags look like a short (as the data element is a short)
138 *
139 * 80 12/01/98 4:31p Chris
140 * Checked in a massive amount of AI work. Improved flocking code. :)
141 * (Still hacked lightly). In addition, I am moving toward using the
142 * composite dir. :)
143 *
144 * 79 11/19/98 8:26p Chris
145 * Starting to add generic team avoidance code
146 *
147 * 78 11/18/98 3:59p Chris
148 * I added the avoid goal. I also improved the AIs for Evader1 and
149 * Evader2 by utilizing this goal when the target is well within the
150 * circle distance.
151 *
152 * 77 11/11/98 6:31p Chris
153 * AIF_DISABLE_FIRING and AIF_DISABLE_MELEE are now functional
154 *
155 * 76 11/06/98 11:39a Chris
156 * Robots with flamethrowers and Omega cannons work in single player
157 *
158 * 75 10/14/98 6:55p Chris
159 * Added turret change direction sounds and level goal ability to toggle
160 * auto level end
161 *
162 * 74 10/13/98 1:08p Chris
163 * Greatly improved the AI's use of paths. Improved visability checking
164 * algorithm. Probably needs a second pass for further cleanup.
165 *
166 * 73 10/09/98 7:47p Chris
167 * Added ObjSetDeadFlag
168 *
169 * 72 9/16/98 4:31p Chris
170 * Added target by distance
171 *
172 * 71 8/19/98 6:24p Chris
173 * Added more unused water support
174 *
175 * 70 8/17/98 4:56p Chris
176 * Added a new goal flag
177 *
178 * 69 8/15/98 6:11p Chris
179 * Added 13 new fields. AI fire spread works.
180 *
181 * 68 7/28/98 5:04p Chris
182 * Added some new multiplayer support (for dodging and targetting)
183 *
184 * 67 7/24/98 6:06p Chris
185 * Initial robot leading code -- needs multiple wb support
186 *
187 * 66 7/01/98 4:35p Chris
188 * More multiplayer sync issues
189 *
190 * 65 7/01/98 10:58a Chris
191 * Working on multiplayer AI stuff
192 *
193 * 64 6/30/98 6:36p Chris
194 * Added rev .1 of multiplayer animations - BTW It is totally not done.
195 *
196 * 63 6/26/98 2:52p Chris
197 * AI now reports when it updates its orientation
198 *
199 * 62 5/26/98 9:34a Chris
200 * Added XZ distances for circle dist. :)
201 *
202 * 61 5/18/98 8:06p Chris
203 * Made melee attacks closer to what I want in terms of functionality
204 *
205 * 60 5/18/98 12:40p Chris
206 * Added a new flag (F_BLINE_IF_SEE_GOAL)
207 *
208 * 59 5/17/98 9:07p Chris
209 * Fixed melee attacks. Thanks to Ala. :)
210 *
211 * 58 5/17/98 7:54p Chris
212 * Correctly integrated the goal system and circle distance stuff. Added
213 * support for "target goals".
214 *
215 * 57 5/15/98 2:58p Chris
216 * More on the big AI update
217 *
218 * 56 5/14/98 3:01p Chris
219 * More new AI code
220 *
221 * 55 5/14/98 12:21p Chris
222 * Updating AI system... Incomplete
223 *
224 * 54 5/12/98 3:51p Chris
225 * Oops
226 *
227 * 53 5/12/98 3:46p Chris
228 * Added some notify/goal system stuff and orientation to velocity
229 *
230 * 52 5/11/98 4:39p Chris
231 * Improved AI system (goals have notifies and are more flexable).
232 *
233 * 51 5/07/98 6:01p Chris
234 * More AI/OSIRIS stuff...
235 *
236 * 50 5/04/98 4:04p Chris
237 * Minestone checkin' -- energy effect and more AI functionality
238 *
239 * 49 5/03/98 7:02p Chris
240 * Improved sound support for AI system
241 *
242 * 48 5/03/98 6:03p Chris
243 * Added sound support to the animation system
244 *
245 * 47 5/01/98 3:41p Chris
246 *
247 * 46 5/31/98 3:05p Chris
248 * Allowed death anims (fixed problem with ctype union of CT_DEBRIS and
249 * CT_AI)
250 *
251 * 45 4/30/98 11:31a Chris
252 * Massive upgrades to the AI system
253 *
254 * 44 4/22/98 9:43p Chris
255 * More AI improvements
256 *
257 * 43 4/21/98 11:25a Chris
258 * Improving GET_TO_OBJ goal
259 *
260 * 42 4/19/98 9:56p Chris
261 * AI system is integrated with OSIRIS. Path system is integrated with
262 * the AI system. Bugs will ensue.
263 *
264 * 41 4/16/98 2:56p Chris
265 * Updated buddy support and intergrated scripting and AI
266 *
267 * 40 4/13/98 7:38p Chris
268 * Added more support for a 'real' AI.
269 *
270 * 39 3/31/98 4:23p Chris
271 * Added a new AIpath system
272 *
273 * 38 3/25/98 11:02a Chris
274 * version 1.0 of the new AI ranged firing code.
275 *
276 * 37 3/23/98 10:03a Chris
277 * Added independant wb animations
278 *
279 * 36 3/17/98 12:14p Chris
280 * Fixed bug with bumping player causing awareness
281 *
282 * 35 3/17/98 11:27a Chris
283 * Added object bump notifies for AI
284 *
285 * 34 3/03/98 5:02p Chris
286 * Added a status register to the ai_frame. Also, I enabled a bunch of
287 * the fields from the AI Dialog. In addiition, I tweaked how melee
288 * attacks work and animate.
289 *
290 * 33 3/02/98 6:56p Chris
291 * Changed melee_dist to melee_damage
292 *
293 * 32 3/02/98 4:16p Chris
294 * Added 14 new fields to the AI Settings Dialog/page.
295 *
296 * 31 2/27/98 7:23p Chris
297 * Started to add new AI fields -- no way near complete
298 *
299 * 30 2/16/98 11:19p Chris
300 * Added support for melee robots
301 *
302 * 29 2/16/98 1:05p Chris
303 * Added some Flinch support
304 *
305 * 28 2/16/98 2:47a Chris
306 * Massive improvements to the animation system and the AI
307 *
308 * 27 2/11/98 7:00p Chris
309 * Removed priority (changed to influence) and added activation_level
310 *
311 * 26 2/10/98 4:45p Chris
312 * Incremental changes: Made a new node_orient heuristic. Removed some
313 * bad fields from the ai_info struct.
314 *
315 * 25 2/10/98 12:14a Chris
316 * Improving the awareness system. Re-enabled super dodging. Added the
317 * auto-fluctuate speed flag (allows some diversity). Enabled FOV
318 * information.
319 *
320 * 24 2/06/98 5:51p Chris
321 * Added the ability turn robots on and off
322 *
323 * 23 2/06/98 4:19p Chris
324 * Added a boat load of path stuff
325 *
326 * 22 2/06/98 2:15a Chris
327 * Activated the max_velocity, max_delta_velocity, and max_turn_rate
328 * fields for AI objects.
329 *
330 * 21 2/02/98 8:15p Chris
331 * Updated the AI system
332 *
333 * 20 1/30/98 2:19p Chris
334 * More improvements (target vis stuff and setting of the AIN_ALWAYS_ON is
335 * now done correctly)
336 *
337 * 19 1/29/98 3:29p Chris
338 * Major update to the AI system.
339 *
340 * 18 1/20/98 4:40p Chris
341 * Fixed some visability stuff.
342 *
343 * 17 1/19/98 10:04a Matt
344 * Added new object handle system
345 *
346 * 16 1/14/98 7:57p Chris
347 * Improving the awareness system
348 *
349 * 15 11/17/97 5:59p Chris
350 * Allowed some thief stuff
351 *
352 * 14 11/14/97 11:55p Chris
353 * Dodge goals are semi-functional
354 *
355 * 13 11/12/97 5:47p Chris
356 * Incremental improvements
357 *
358 * 12 10/28/97 12:25p Chris
359 * Added support for initial class, type, and movement types. Starting to
360 * flush out the AI structure
361 *
362 * 11 10/05/97 5:29a Chris
363 * Fixed problems at ubytes cause when setting then to -1 (made them
364 * chars)
365 *
366 * 10 9/18/97 1:26p Matt
367 * Moved next_movement from object struct to ai_frame
368 *
369 * 9 8/05/97 12:17p Chris
370 *
371 * 8 7/30/97 1:31p Chris
372 * Made helicopters slightly more interesting.
373 *
374 * 7 7/29/97 12:20p Chris
375 * Incremental improvements. Fixed a memory bug.
376 *
377 * 6 7/28/97 1:19p Chris
378 * Expanding the AI system
379 *
380 * 5 7/15/97 7:29p Chris
381 * Added a sound for helicopter blades.
382 *
383 * 4 7/15/97 5:35p Chris
384 * New AI code
385 *
386 * 3 7/15/97 4:59p Chris
387 * added support for AI and animations
388 *
389 * $NoKeywords: $
390 */
391
392 #ifndef AISTRUCT_H_
393 #define AISTRUCT_H_
394
395 #include "pstypes.h"
396 #include "vecmat.h"
397 #include "aistruct_external.h"
398 #include "room.h"
399
400 //-------------------------------------------------
401 // GLOBAL Info and Constants for AI
402 //-------------------------------------------------
403
404 #define AI_INVALID_INDEX -1
405
406 // AI system state.
407
408 #define AISTAT_ENABLED 1
409 #define AISTAT_DISABLED 2
410
411 extern char AI_Status;
412
413 // Last know player info -- might make it a [MAX_PLAYERS]
414
415 extern vector ai_lkplayer_pos;
416 extern vector ai_lkplayer_velocity;
417 extern float ai_lkplayer_time;
418
419 #define MAX_AI_INIT_CLASSES 3
420 extern const char *const Ai_class_strings[MAX_AI_INIT_CLASSES];
421
422 #define MAX_AI_INIT_TYPES 9
423 extern const char *const Ai_type_strings[MAX_AI_INIT_TYPES];
424
425 #define MAX_AI_INIT_MOVEMENT_TYPES 4
426 extern const char *const Ai_movement_type_strings[MAX_AI_INIT_MOVEMENT_TYPES];
427
428 #define MAX_AI_INIT_MOVEMENT_SUBTYPES 7
429 extern const char *const Ai_movement_subtype_flying_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES];
430 extern const char *const Ai_movement_subtype_walking_strings[MAX_AI_INIT_MOVEMENT_SUBTYPES];
431
432 extern float AI_last_time_room_noise_alert_time[MAX_ROOMS + 8];
433
434 //-------------------------------------------------
435 // AI Class, Type, and Action indices
436 //-------------------------------------------------
437
438 // AI Class -- make sure to update MAX_AI_CLASSES if you add a new class
439
440 #define AIC_STATIC 0
441 #define AIC_PURE_PATH 1
442 #define AIC_AIS_FULL 2
443 // #define AIC_DYNAMIC 3
444 // #define AIC_AIS_MOVEMENT 4
445 // #define AIC_AIS_FIRING 5
446
447 // AI Action -- What is it doing?
448
449 #define AID_SLEEPING 0
450 #define AID_ATTACKING_OBJ 1
451 #define AID_WANDERING 2
452 #define AID_NOT_THINKING 3
453 #define AID_CHASE_OBJECT 4
454 #define AID_RUN_FROM_OBJECT 5
455 #define AID_HIDE 6
456 #define AID_FOLLOW_PATH 7
457 #define AID_OPEN_DOOR 8
458
459 //-------------------------------------------------
460 // Notification structures
461 //-------------------------------------------------
462
463 struct ain_see {
464 bool f_use_fov;
465 float max_dist;
466 };
467
468 struct ain_hear {
469 bool f_directly_player;
470 float max_dist;
471 float hostile_level; // 0 - 1
472 float curiosity_level;
473 };
474
475 //-------------------------------------------------
476 // Path Structures
477 //-------------------------------------------------
478
479 #define MAX_JOINED_PATHS 5
480
481 // Allow for linked paths
482
483 #define AIP_STATIC 0
484 #define AIP_DYNAMIC 1
485 #define AIP_MOVE_LIST 2
486
487 struct ai_path_info {
488 uint16_t cur_path;
489 uint16_t cur_node;
490
491 uint16_t num_paths;
492
493 int goal_uid; // which goal generated this path
494 int goal_index;
495
496 // Used by all paths
497 uint8_t path_id[MAX_JOINED_PATHS];
498 uint8_t path_type[MAX_JOINED_PATHS];
499
500 // Used for static game paths
501 uint16_t path_start_node[MAX_JOINED_PATHS];
502 uint16_t path_end_node[MAX_JOINED_PATHS];
503 uint16_t path_flags[MAX_JOINED_PATHS];
504 };
505
506 // Used for predefined move lists (off of normal static paths)
507 struct ai_move_path {
508 vector pos;
509 matrix orient;
510
511 int16_t path_id;
512 };
513
514 struct path_information {
515 int path_id;
516 int start_node;
517 int next_node;
518 int end_node;
519 };
520
521 // Goal Ender Structure
522
523 struct goal_enabler {
524 char enabler_type;
525
526 union {
527 float float_value;
528 float time;
529 char movement_type;
530 int flags; // Flags that enable/disable this goal
531 float dist;
532 int awareness;
533 };
534
535 float percent_enable;
536 float check_interval;
537 float last_check_time;
538
539 char bool_next_enabler_op;
540
541 };
542
543 //-------------------------------------------------
544 // Goal Structures
545 //-------------------------------------------------
546
547 // MAX of 32 goal types unless the bitfield is made wider.
548
549 // I wonder if goals can be classified. If so, we could reserve X goal for class a, and Y goal slots for class b
550 // plus it would make sure the our slots do not fill up in bad or degenerate ways.
551
552 struct gi_fire {
553 int16_t cur_wb; // for ranged attack
554 uint8_t cur_mask; // for ranged attack
555 uint8_t melee_number; // this could be union'ed but it makes this struct word aligned
556 };
557
558 struct g_steer {
559 float min_dist;
560 float max_dist;
561 float max_strength;
562 };
563
564 struct g_floats {
565 float fp1;
566 float fp2;
567 float fp3;
568 };
569
570 struct g_wander_extra {
571 int avoid_handle;
572 char min_rooms;
573 char max_rooms;
574 char flags;
575 char mine_index; // Used for if this object accidently goes on to the terrain
576 };
577
578 #define GAF_ALIGNED 0x01
579 #define GAF_SPHERE 0x02
580 #define GAF_TEMP_CLEAR_AUTOLEVEL 0x04
581 #define GAF_TEMP_CLEAR_ROBOT_COLLISIONS 0x08
582 #define GAF_TEMP_POINT_COLLIDE_WALLS 0x10
583
584 struct g_attach {
585 float rad;
586 int16_t flags;
587 char parent_ap;
588 char child_ap;
589 };
590
591 struct g_static_path {
592 int16_t start_node;
593 int16_t end_node;
594 int16_t cur_node;
595 };
596
597 struct goal_info {
598 union {
599 int handle;
600 int roomnum;
601 int f_actions;
602 int id; // Type of CUSTOM -- Id determines which one it was
603 // Also used as the Path ID for static path followers
604 };
605
606 union {
607 float time;
608 vector vec;
609 vector pos;
610 g_floats fs; // goal floats or a vector
611 };
612
613 union {
614 g_steer dist_info;
615 g_attach attach_info;
616 g_wander_extra wander_extra_info;
617 g_static_path static_path_info;
618 void *scripted_data_ptr;
619 };
620
621 };
622
623 // Goal structure
624 struct goal {
625 uint32_t type;
626 char subtype;
627 uint8_t activation_level;
628 float creation_time;
629
630 float min_influence;
631 union {
632 float influence;
633 float max_influence;
634 };
635
636 float ramp_influence_dists[4]; // Sorted by distance
637
638 goal_info g_info;
639
640 char num_enablers;
641 goal_enabler enabler[MAX_ENABLERS_PER_GOAL];
642
643 float circle_distance;
644 int status_reg;
645
646 float start_time;
647 float next_path_time; // used of goals with paths associated with them
648
649 float dist_to_goal;
650
651 vector vec_to_target;
652 float next_check_see_target_time;
653 vector last_see_target_pos;
654 float last_see_target_time;
655 float next_target_update_time;
656
657 int flags;
658 int guid; // Designer assigned
659
660 int goal_uid; // used by the AI system for paths
661
662 vector set_fvec;
663 vector set_uvec;
664
665 bool used;
666 };
667
668 #define OBJGOAL(x) \
669 (((goal *)x)->type & (AIG_GET_AWAY_FROM_OBJ | AIG_HIDE_FROM_OBJ | AIG_GET_TO_OBJ | AIG_ATTACH_TO_OBJ | \
670 AIG_FIRE_AT_OBJ | AIG_MELEE_TARGET | AIG_GUARD_OBJ | AIG_DODGE_OBJ | AIG_MOVE_AROUND_OBJ | \
671 AIG_MOVE_RELATIVE_OBJ_VEC | AIG_MOVE_RELATIVE_OBJ | AIG_GET_AROUND_OBJ | AIG_AVOID_OBJ | \
672 AIG_COHESION_OBJ | AIG_ALIGN_OBJ | AIG_PLACE_OBJ_ON_OBJ))
673 #define COMPLETEATOBJ(x) (((goal *)x)->type & (AIG_GET_TO_OBJ))
674 #define POSGOAL(x) (((goal *)x)->type & (AIG_WANDER_AROUND | AIG_GUARD_AREA | AIG_GET_TO_POS | AIG_GET_AROUND_POS))
675 #define TARGETONLYGOAL(x) (((goal *)x)->type & (AIG_MELEE_TARGET))
676 #define COMPLETEATPOS(x) (((goal *)x)->type & (AIG_WANDER_AROUND | AIG_GET_TO_POS))
677
678 struct notify {
679 union {
680 int obj_handle;
681 int goal_num;
682 };
683
684 union {
685 vector pos;
686 int movement_type;
687 int anim_type;
688 int attack_num;
689 int enabler_num;
690 };
691
692 float time;
693 };
694
695 struct ain_weapon_hit_info {
696 int parent_handle;
697 int weapon_handle;
698 int hit_face;
699 int hit_subobject;
700 float hit_damage;
701 vector hit_pnt;
702 };
703
704 //-------------------------------------------------
705 // AI awareness scale
706 //-------------------------------------------------
707
708 //-------------------------------------------------
709 // AI Sounds
710 //-------------------------------------------------
711
712 #define MAX_AI_SOUNDS 5
713
714 #define AI_MEM_DEPTH 5
715
716 struct ai_mem {
717 // Computed at end of memory frame
718 float shields;
719 int16_t num_enemies;
720 int16_t num_friends;
721
722 // Incremented during the memory frame
723 int16_t num_times_hit;
724 int16_t num_enemy_shots_fired;
725 int16_t num_hit_enemy;
726 int16_t num_enemy_shots_dodged;
727 };
728
729 //-------------------------------------------------
730 // AI tracking information
731 //-------------------------------------------------
732
733 //-------------------------------------------------
734 // AI framework per robot
735 //-------------------------------------------------
736
737 struct ai_frame {
738 char ai_class; // Static, DLL, Soar, Flock, and other will be here -- chrishack
739 char ai_type; // Used for some coded types
740
741 ai_path_info path;
742
743 float max_velocity;
744 float max_delta_velocity;
745 float max_turn_rate;
746 float max_delta_turn_rate;
747
748 float attack_vel_percent;
749 float flee_vel_percent;
750 float dodge_vel_percent;
751
752 float circle_distance;
753 float dodge_percent;
754
755 float melee_damage[2];
756 float melee_latency[2];
757
758 int sound[MAX_AI_SOUNDS]; // AI sounds,
759 float last_sound_time[MAX_AI_SOUNDS];
760 int16_t last_played_sound_index;
761
762 char movement_type;
763 char movement_subtype;
764
765 char animation_type;
766 char next_animation_type;
767
768 char next_movement; // For queueing actions :)
769 char current_wb_firing;
770 char last_special_wb_firing;
771
772 goal goals[MAX_GOALS];
773
774 // Standard memory
775 int target_handle;
776 float next_target_update_time;
777
778 float dist_to_target_actual;
779 float dist_to_target_perceived;
780 vector vec_to_target_actual;
781 vector vec_to_target_perceived;
782
783 float next_check_see_target_time;
784 vector last_see_target_pos;
785 float last_see_target_time;
786 float last_hear_target_time;
787
788 // int rand_val;
789 // float next_rand_time;
790
791 float weapon_speed;
792
793 float next_melee_time;
794 float last_render_time; // Last time I was rendered -- BAD IN MULTIPLAYER -- chrisnote
795 float next_flinch_time; // Next valid time to flinch
796
797 int status_reg;
798
799 int flags;
800 int notify_flags; // Agent is only notified of some event types
801
802 // Normalized movement and facing information
803 vector movement_dir;
804 vector rot_thrust_vector;
805
806 float fov;
807
808 int anim_sound_handle; // Goes with Animation sounds which can loop -- not for AI sounds
809
810 float avoid_friends_distance;
811
812 float frustration;
813 float curiousity;
814 float life_preservation;
815 float agression;
816
817 // Current emotional levels
818 float cur_frustration;
819 float cur_curiousity;
820 float cur_life_preservation;
821 float cur_agression;
822
823 // X Second memory
824 float mem_time_till_next_update;
825 ai_mem memory[AI_MEM_DEPTH];
826
827 float fire_spread;
828 float night_vision;
829 float fog_vision;
830 float lead_accuracy;
831 float lead_varience;
832 float fight_team;
833 float fight_same;
834 float hearing;
835 float roaming;
836 float leadership;
837 float coop_same;
838 float coop_team;
839
840 float biased_flight_importance;
841 float biased_flight_min;
842 float biased_flight_max;
843
844 vector last_dodge_dir;
845 float dodge_till_time;
846
847 float awareness;
848
849 matrix saved_orient;
850
851 };
852
853 // Etern'ed functions that depend of aistruct stuff
854
855 #include "object_external.h"
856 #include "room.h"
857
858 #define MAX_DYNAMIC_PATHS 50
859 #define MAX_NODES 50
860
861 class ai_dynamic_path {
862 public:
863 ai_dynamic_path() {
864 num_nodes = 0;
865 use_count = 0;
866 owner_handle = OBJECT_HANDLE_NONE;
867 };
868
869 vector pos[MAX_NODES];
870 int roomnum[MAX_NODES];
871
872 int16_t num_nodes;
873 int16_t use_count;
874
875 int owner_handle;
876 };
877
878 extern ai_dynamic_path AIDynamicPath[MAX_DYNAMIC_PATHS];
879 extern int AIAltPath[MAX_ROOMS];
880 extern int AIAltPathNumNodes;
881
882 #endif