home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / ai.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  8KB  |  222 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/ai.h $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:33:07 $
  18.  * 
  19.  * Header file for AI system.
  20.  * 
  21.  * $Log: ai.h $
  22.  * Revision 2.0  1995/02/27  11:33:07  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.57  1995/02/04  17:28:31  mike
  27.  * make station guys return better.
  28.  * 
  29.  * Revision 1.56  1995/02/04  10:03:23  mike
  30.  * Fly to exit cheat.
  31.  * 
  32.  * Revision 1.55  1995/02/01  19:23:52  rob
  33.  * Externed a boss var.
  34.  * 
  35.  * Revision 1.54  1995/01/30  13:00:58  mike
  36.  * Make robots fire at player other than one they are controlled by sometimes.
  37.  * 
  38.  * Revision 1.53  1995/01/26  15:09:16  rob
  39.  * Changed robot gating to accomodate multiplayer.
  40.  * 
  41.  * Revision 1.52  1995/01/26  12:23:12  rob
  42.  * Added new externs needed for multiplayer.
  43.  * 
  44.  * Revision 1.51  1995/01/21  21:22:14  mike
  45.  * Kill prototype of init_boss_segments, which didn't need to be public
  46.  * and had changed.
  47.  * 
  48.  * Revision 1.50  1995/01/16  19:24:29  mike
  49.  * Publicize BOSS_GATE_MATCEN_NUM and Boss_been_hit.
  50.  * 
  51.  * Revision 1.49  1995/01/02  16:17:35  mike
  52.  * prototype some super boss function for gameseq.
  53.  * 
  54.  * Revision 1.48  1994/12/19  17:08:06  mike
  55.  * deal with new ai_multiplayer_awareness which returns a value saying whether this object can be moved by this player.
  56.  * 
  57.  * Revision 1.47  1994/12/12  17:18:04  mike
  58.  * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful.
  59.  * 
  60.  * Revision 1.46  1994/12/08  15:46:16  mike
  61.  * better robot behavior.
  62.  * 
  63.  * Revision 1.45  1994/11/27  23:16:08  matt
  64.  * Made debug code go away when debugging turned off
  65.  * 
  66.  * Revision 1.44  1994/11/16  23:38:41  mike
  67.  * new improved boss teleportation behavior.
  68.  * 
  69.  * Revision 1.43  1994/11/10  17:45:11  mike
  70.  * debugging.
  71.  * 
  72.  * Revision 1.42  1994/11/07  10:37:42  mike
  73.  * hooks for rob's network code.
  74.  * 
  75.  * Revision 1.41  1994/11/06  15:10:50  mike
  76.  * prototype a debug function for dumping ai info.
  77.  * 
  78.  * Revision 1.40  1994/11/02  17:57:30  rob
  79.  * Added extern of Believe_player_pos needed to get control centers
  80.  * locating people.
  81.  * 
  82.  * Revision 1.39  1994/10/28  19:43:39  mike
  83.  * Prototype Boss_cloak_start_time, Boss_cloak_end_time.
  84.  * 
  85.  * Revision 1.38  1994/10/22  14:14:42  mike
  86.  * Prototype ai_reset_all_paths.
  87.  * 
  88.  * Revision 1.37  1994/10/21  20:42:01  mike
  89.  * Define MAX_PATH_LENGTH: maximum allowed length of a path.
  90.  * 
  91.  * Revision 1.36  1994/10/20  09:49:18  mike
  92.  * Prototype something.
  93.  * 
  94.  * 
  95.  * Revision 1.35  1994/10/18  15:37:52  mike
  96.  * Define ROBOT_BOSS1.
  97.  * 
  98.  * Revision 1.34  1994/10/13  11:12:25  mike
  99.  * Prototype some door functions.
  100.  * 
  101.  * Revision 1.33  1994/10/12  21:28:51  mike
  102.  * Prototype create_n_segment_path_to_door
  103.  * Prototype ai_open_doors_in_segment
  104.  * Prototype ai_door_is_openable.
  105.  * 
  106.  * Revision 1.32  1994/10/11  15:59:41  mike
  107.  * Prototype Robot_firing_enabled.
  108.  * 
  109.  * Revision 1.31  1994/10/09  22:02:48  mike
  110.  * Adapt create_path_points and create_n_segment_path prototypes to use avoid_seg for player evasion.
  111.  * 
  112.  * Revision 1.30  1994/09/18  18:07:44  mike
  113.  * Update prototypes for create_path_points and create_path_to_player.
  114.  * 
  115.  * Revision 1.29  1994/09/15  16:34:08  mike
  116.  * Prototype do_ai_robot_hit_attack.
  117.  * 
  118.  * Revision 1.28  1994/09/12  19:12:35  mike
  119.  * Prototype attempt_to_resume_path.
  120.  * 
  121.  * Revision 1.27  1994/08/25  21:55:32  mike
  122.  * Add some prototypes.
  123.  * 
  124.  * Revision 1.26  1994/08/10  19:53:24  mike
  125.  * Prototype create_path_to_player and init_robots_for_level.
  126.  * 
  127.  * Revision 1.25  1994/08/04  16:32:58  mike
  128.  * prototype create_path_to_player.
  129.  * 
  130.  * Revision 1.24  1994/08/03  15:17:20  mike
  131.  * Prototype make_random_vector.
  132.  * 
  133.  * Revision 1.23  1994/07/31  18:10:34  mike
  134.  * Update prototype for create_path_points.
  135.  * 
  136.  * Revision 1.22  1994/07/28  12:36:14  matt
  137.  * Cleaned up object bumping code
  138.  * 
  139.  */
  140.  
  141.  
  142. #ifndef _AI_H
  143. #define _AI_H
  144.  
  145. #include "object.h"
  146.  
  147. #define    PLAYER_AWARENESS_INITIAL_TIME        (3*F1_0)
  148. #define    MAX_PATH_LENGTH                        30            //    Maximum length of path in ai path following.
  149. #define    MAX_DEPTH_TO_SEARCH_FOR_PLAYER    10
  150. #define    BOSS_GATE_MATCEN_NUM                    -1
  151. #define    MAX_BOSS_TELEPORT_SEGS    100
  152. #define    BOSS_ECLIP_NUM                        53
  153.  
  154. #define    ROBOT_BRAIN    7
  155. #define    ROBOT_BOSS1    17
  156.  
  157. extern fix Boss_cloak_start_time, Boss_cloak_end_time;
  158. extern    int    Boss_hit_this_frame;
  159. extern int    Num_boss_teleport_segs;
  160. extern short    Boss_teleport_segs[MAX_BOSS_TELEPORT_SEGS];
  161. extern fix    Last_teleport_time;
  162. extern fix     Boss_cloak_duration;
  163. extern int Boss_dying;
  164.  
  165. extern ai_local    Ai_local_info[MAX_OBJECTS];
  166. extern vms_vector    Believed_player_pos;
  167.  
  168. extern void move_towards_segment_center(object *objp);
  169. extern int gate_in_robot(int type, int segnum);
  170. extern void do_ai_movement(object *objp);
  171. extern void ai_move_to_new_segment( object * obj, short newseg, int first_time );
  172. // extern void ai_follow_path( object * obj, short newseg, int first_time );
  173. extern void ai_recover_from_wall_hit(object *obj, int segnum);
  174. extern void ai_move_one(object *objp);
  175. extern void do_ai_frame(object *objp);
  176. extern void init_ai_object(int objnum, int initial_mode, int hide_segment);
  177. extern void update_player_awareness(object *objp, fix new_awareness);
  178. extern void create_awareness_event(object *objp, int type);            // object *objp can create awareness of player, amount based on "type"
  179. extern void do_ai_frame_all(void);
  180. extern void init_ai_system(void);
  181. extern void reset_ai_states(object *objp);
  182. extern int create_path_points(object *objp, int start_seg, int end_seg, point_seg *point_segs, short *num_points, int max_depth, int random_flag, int safety_flag, int avoid_seg);
  183. extern void create_all_paths(void);
  184. extern void create_path_to_station(object *objp, int max_length);
  185. extern void ai_follow_path(object *objp, int player_visibility);
  186. extern void ai_turn_towards_vector(vms_vector *vec_to_player, object *obj, fix rate);
  187. extern void ai_turn_towards_vel_vec(object *objp, fix rate);
  188. extern void init_ai_objects(void);
  189. extern void do_ai_robot_hit(object *robot, int type);
  190. extern void create_n_segment_path(object *objp, int path_length, int avoid_seg);
  191. extern void create_n_segment_path_to_door(object *objp, int path_length, int avoid_seg);
  192. extern void make_random_vector(vms_vector *vec);
  193. extern void init_robots_for_level(void);
  194. extern int ai_behavior_to_mode(int behavior);
  195. extern int Robot_firing_enabled;
  196.  
  197. //    max_length is maximum depth of path to create.
  198. //    If -1, use default:    MAX_DEPTH_TO_SEARCH_FOR_PLAYER
  199. extern void create_path_to_player(object *objp, int max_length, int safety_flag);
  200. extern void attempt_to_resume_path(object *objp);
  201.  
  202. //    When a robot and a player collide, some robots attack!
  203. extern void do_ai_robot_hit_attack(object *robot, object *player, vms_vector *collision_point);
  204. extern void ai_open_doors_in_segment(object *robot);
  205. extern int ai_door_is_openable(object *objp, segment *segp, int sidenum);
  206. extern int player_is_visible_from_object(object *objp, vms_vector *pos, fix field_of_view, vms_vector *vec_to_player);
  207. extern void ai_reset_all_paths(void);    //    Reset all paths.  Call at the start of a level.
  208. extern int ai_multiplayer_awareness(object *objp, int awareness_level);
  209.  
  210. #ifndef NDEBUG
  211. extern void force_dump_ai_objects_all(char *msg);
  212. #else
  213. #define force_dump_ai_objects_all(msg)
  214. #endif
  215.  
  216. extern void start_boss_death_sequence(object *objp);
  217. extern void ai_init_boss_for_ship(void);
  218. extern int Boss_been_hit;
  219. extern fix AI_proc_time;
  220.  
  221. #endif
  222.