home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / robot.h < prev    next >
Text File  |  1998-06-08  |  8KB  |  225 lines

  1. /*
  2.  * $Source: f:/miner/source/main/rcs/robot.h $
  3.  * $Revision: 2.1 $
  4.  * $Author: john $
  5.  * $Date: 1995/03/07 16:52:00 $
  6.  * 
  7.  * Header for robot.c
  8.  * 
  9.  * $Log: robot.h $
  10.  * Revision 2.1  1995/03/07  16:52:00  john
  11.  * Fixed robots not moving without edtiro bug.
  12.  * 
  13.  * Revision 2.0  1995/02/27  11:30:59  john
  14.  * New version 2.0, which has no anonymous unions, builds with
  15.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  16.  * 
  17.  * Revision 1.25  1994/11/30  14:02:44  mike
  18.  * fields for see/attack/claw sounds.
  19.  * 
  20.  * Revision 1.24  1994/10/27  15:55:41  adam
  21.  * *** empty log message ***
  22.  * 
  23.  * Revision 1.23  1994/10/20  15:17:03  mike
  24.  * Add boss flag.
  25.  * 
  26.  * Revision 1.22  1994/10/20  09:51:00  adam
  27.  * *** empty log message ***
  28.  * 
  29.  * Revision 1.21  1994/10/18  10:52:54  mike
  30.  * Support robots lunging as an attack_type.
  31.  * 
  32.  * Revision 1.20  1994/10/17  21:19:02  mike
  33.  * robot cloaking.
  34.  * 
  35.  * Revision 1.19  1994/09/27  00:03:39  mike
  36.  * Add score_value to robot_info struct.
  37.  * 
  38.  * Revision 1.18  1994/09/22  19:01:12  mike
  39.  * Move NDL from here to game.h
  40.  * 
  41.  * Revision 1.17  1994/09/22  15:46:55  mike
  42.  * Add default contained objects for robots.
  43.  * 
  44.  * Revision 1.16  1994/09/22  10:46:57  mike
  45.  * Add difficulty levels.
  46.  * 
  47.  * Revision 1.15  1994/09/15  16:34:16  mike
  48.  * Change rapidfire_count to a byte, add evade_speed, dum1, dum2.
  49.  * 
  50.  * Revision 1.14  1994/09/09  14:21:58  matt
  51.  * Increased maximum number of games
  52.  * 
  53.  * Revision 1.13  1994/08/25  18:12:13  matt
  54.  * Made player's weapons and flares fire from the positions on the 3d model.
  55.  * Also added support for quad lasers.
  56.  * 
  57.  * Revision 1.12  1994/08/23  16:37:24  mike
  58.  * Add rapidfire_count to robot_info.
  59.  * 
  60.  * Revision 1.11  1994/07/27  19:45:01  mike
  61.  * Objects containing objects.
  62.  * 
  63.  * Revision 1.10  1994/07/12  12:40:01  matt
  64.  * Revamped physics system
  65.  * 
  66.  * Revision 1.9  1994/06/21  12:17:12  mike
  67.  * Add circle_distance to robot_info.
  68.  * 
  69.  * Revision 1.8  1994/06/09  16:22:28  matt
  70.  * Moved header for calc_gun_point() here, where it belongs
  71.  * 
  72.  * Revision 1.7  1994/06/08  18:16:23  john
  73.  * Bunch of new stuff that basically takes constants out of the code
  74.  * and puts them into bitmaps.tbl.
  75.  * 
  76.  * Revision 1.6  1994/06/03  11:38:09  john
  77.  * Made robots get their strength for RobotInfo->strength, which
  78.  * is read in from bitmaps.tbl
  79.  * 
  80.  * Revision 1.5  1994/05/30  19:43:31  mike
  81.  * Add voluminous comment for robot_get_anim_state.
  82.  * 
  83.  * Revision 1.4  1994/05/30  00:03:18  matt
  84.  * Got rid of robot render type, and generally cleaned up polygon model
  85.  * render objects.
  86.  * 
  87.  * Revision 1.3  1994/05/29  18:46:37  matt
  88.  * Added stuff for getting robot animation info for different states
  89.  * 
  90.  * Revision 1.2  1994/05/26  21:09:18  matt
  91.  * Moved robot stuff out of polygon model and into robot_info struct
  92.  * Made new file, robot.c, to deal with robots
  93.  * 
  94.  * Revision 1.1  1994/05/26  18:02:12  matt
  95.  * Initial revision
  96.  * 
  97.  * 
  98.  */
  99.  
  100.  
  101.  
  102. #ifndef _ROBOT_H
  103. #define _ROBOT_H
  104.  
  105. #include "vecmat.h"
  106. #include "object.h"
  107. #include "game.h"
  108.  
  109. #define MAX_GUNS 8        //should be multiple of 4 for ubyte array
  110.  
  111. //Animation states
  112. #define AS_REST            0
  113. #define AS_ALERT            1
  114. #define AS_FIRE            2
  115. #define AS_RECOIL            3
  116. #define AS_FLINCH            4
  117. #define N_ANIM_STATES    5
  118.  
  119. #define    RI_CLOAKED_NEVER                    0
  120. #define    RI_CLOAKED_ALWAYS                    1
  121. #define    RI_CLOAKED_EXCEPT_FIRING        2
  122.  
  123. //describes the position of a certain joint
  124. typedef struct jointpos {
  125.     short jointnum;
  126.     vms_angvec angles;
  127. } jointpos;
  128.  
  129. //describes a list of joint positions
  130. typedef struct jointlist {
  131.     short n_joints;
  132.     short offset;
  133. } jointlist;
  134.  
  135. //    Robot information
  136. typedef struct robot_info {
  137.     int            model_num;                            // which polygon model?
  138.     int            n_guns;                                // how many different gun positions
  139.     vms_vector    gun_points[MAX_GUNS];            // where each gun model is
  140.     ubyte            gun_submodels[MAX_GUNS];        // which submodel is each gun in?
  141.     short         exp1_vclip_num;
  142.     short            exp1_sound_num;
  143.     short         exp2_vclip_num;
  144.     short            exp2_sound_num;
  145.     short            weapon_type;
  146.     byte            contains_id;                        //    ID of powerup this robot can contain.
  147.     byte            contains_count;                    //    Max number of things this instance can contain.
  148.     byte            contains_prob;                        //    Probability that this instance will contain something in N/16
  149.     byte            contains_type;                        //    Type of thing contained, robot or powerup, in bitmaps.tbl, !0=robot, 0=powerup
  150.     int            score_value;                        //    Score from this robot.
  151.     fix            lighting;                            // should this be here or with polygon model?
  152.     fix            strength;                            // Initial shields of robot
  153.  
  154.     fix        mass;                                        // how heavy is this thing?
  155.     fix        drag;                                        // how much drag does it have?
  156.  
  157.     fix        field_of_view[NDL];                    // compare this value with forward_vector.dot.vector_to_player, if field_of_view <, then robot can see player
  158.     fix        firing_wait[NDL];                        //    time in seconds between shots
  159.     fix        turn_time[NDL];                        // time in seconds to rotate 360 degrees in a dimension
  160.     fix        fire_power[NDL];                        //    damage done by a hit from this robot
  161.     fix        shield[NDL];                            //    shield strength of this robot
  162.     fix        max_speed[NDL];                        //    maximum speed attainable by this robot
  163.     fix        circle_distance[NDL];                //    distance at which robot circles player
  164.  
  165.     byte        rapidfire_count[NDL];                //    number of shots fired rapidly
  166.     byte        evade_speed[NDL];                        //    rate at which robot can evade shots, 0=none, 4=very fast
  167.     byte        cloak_type;                                //    0=never, 1=always, 2=except-when-firing
  168.     byte        attack_type;                            //    0=firing, 1=charge (like green guy)
  169.     byte        boss_flag;                                //    0 = not boss, 1 = boss.  Is that surprising?
  170.     ubyte        see_sound;                                //    sound robot makes when it first sees the player
  171.     ubyte        attack_sound;                            //    sound robot makes when it attacks the player
  172.     ubyte        claw_sound;                                //    sound robot makes as it claws you (attack_type should be 1)
  173.  
  174.     //animation info
  175.     jointlist anim_states[MAX_GUNS+1][N_ANIM_STATES];
  176.  
  177.     int        always_0xabcd;                            // debugging
  178.  
  179. } robot_info;
  180.  
  181.  
  182. #define    MAX_ROBOT_TYPES    30                // maximum number of robot types
  183.  
  184. #define    ROBOT_NAME_LENGTH    16
  185. extern char    Robot_names[MAX_ROBOT_TYPES][ROBOT_NAME_LENGTH];
  186.  
  187. //the array of robots types
  188. extern robot_info Robot_info[];            // Robot info for AI system, loaded from bitmaps.tbl.
  189.  
  190. //how many kinds of robots
  191. extern    int    N_robot_types;        // Number of robot types.  We used to assume this was the same as N_polygon_models.
  192.  
  193. //test data for one robot
  194. #define MAX_ROBOT_JOINTS 600
  195. extern jointpos Robot_joints[MAX_ROBOT_JOINTS];
  196. extern int    N_robot_joints;
  197.  
  198. //given an object and a gun number, return position in 3-space of gun
  199. //fills in gun_point
  200. void calc_gun_point(vms_vector *gun_point,object *obj,int gun_num);
  201. //void calc_gun_point(vms_vector *gun_point,int objnum,int gun_num);
  202.  
  203. //    Tells joint positions for a gun to be in a specified state.
  204. //    A gun can have associated with it any number of joints.  In order to tell whether a gun is a certain
  205. //    state (such as FIRE or ALERT), you should call this function and check the returned joint positions
  206. //    against the robot's gun's joint positions.  This function should also be called to determine how to
  207. //    move a gun into a desired position.
  208. //    For now (May 30, 1994), it is assumed that guns will linearly interpolate from one joint position to another.
  209. //    There is no ordering of joint movement, so it's impossible to guarantee that a strange starting position won't
  210. //    cause a gun to move through a robot's body, for example.
  211.  
  212. //    Given:
  213. //        jp_list_ptr        pointer to list of joint angles, on exit, this is pointing at a static array
  214. //        robot_type        type of robot for which to get joint information.  A particular type, not an instance of a robot.
  215. //        gun_num            gun number.  If in 0..Robot_info[robot_type].n_guns-1, then it is a gun, else it refers to non-animating parts of robot.
  216. //        state                state about which to get information.  Legal states in range 0..N_ANIM_STATES-1, defined in robot.h, are:
  217. //                                AS_REST, AS_ALERT, AS_FIRE, AS_RECOIL, AS_FLINCH
  218.  
  219. //    On exit:
  220. //        Returns number of joints in list.
  221. //        jp_list_ptr is stuffed with a pointer to a static array of joint positions.  This pointer is valid forever.
  222. extern int robot_get_anim_state(jointpos **jp_list_ptr,int robot_type,int gun_num,int state);
  223.  
  224. #endif
  225.