ROBOT.H 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. #ifndef _ROBOT_H
  100. #define _ROBOT_H
  101. #include "vecmat.h"
  102. #include "object.h"
  103. #include "game.h"
  104. #define MAX_GUNS 8 //should be multiple of 4 for ubyte array
  105. //Animation states
  106. #define AS_REST 0
  107. #define AS_ALERT 1
  108. #define AS_FIRE 2
  109. #define AS_RECOIL 3
  110. #define AS_FLINCH 4
  111. #define N_ANIM_STATES 5
  112. #define RI_CLOAKED_NEVER 0
  113. #define RI_CLOAKED_ALWAYS 1
  114. #define RI_CLOAKED_EXCEPT_FIRING 2
  115. //describes the position of a certain joint
  116. typedef struct jointpos {
  117. short jointnum;
  118. vms_angvec angles;
  119. } jointpos;
  120. //describes a list of joint positions
  121. typedef struct jointlist {
  122. short n_joints;
  123. short offset;
  124. } jointlist;
  125. // Robot information
  126. typedef struct robot_info {
  127. int model_num; // which polygon model?
  128. int n_guns; // how many different gun positions
  129. vms_vector gun_points[MAX_GUNS]; // where each gun model is
  130. ubyte gun_submodels[MAX_GUNS]; // which submodel is each gun in?
  131. short exp1_vclip_num;
  132. short exp1_sound_num;
  133. short exp2_vclip_num;
  134. short exp2_sound_num;
  135. short weapon_type;
  136. byte contains_id; // ID of powerup this robot can contain.
  137. byte contains_count; // Max number of things this instance can contain.
  138. byte contains_prob; // Probability that this instance will contain something in N/16
  139. byte contains_type; // Type of thing contained, robot or powerup, in bitmaps.tbl, !0=robot, 0=powerup
  140. int score_value; // Score from this robot.
  141. fix lighting; // should this be here or with polygon model?
  142. fix strength; // Initial shields of robot
  143. fix mass; // how heavy is this thing?
  144. fix drag; // how much drag does it have?
  145. fix field_of_view[NDL]; // compare this value with forward_vector.dot.vector_to_player, if field_of_view <, then robot can see player
  146. fix firing_wait[NDL]; // time in seconds between shots
  147. fix turn_time[NDL]; // time in seconds to rotate 360 degrees in a dimension
  148. fix fire_power[NDL]; // damage done by a hit from this robot
  149. fix shield[NDL]; // shield strength of this robot
  150. fix max_speed[NDL]; // maximum speed attainable by this robot
  151. fix circle_distance[NDL]; // distance at which robot circles player
  152. byte rapidfire_count[NDL]; // number of shots fired rapidly
  153. byte evade_speed[NDL]; // rate at which robot can evade shots, 0=none, 4=very fast
  154. byte cloak_type; // 0=never, 1=always, 2=except-when-firing
  155. byte attack_type; // 0=firing, 1=charge (like green guy)
  156. byte boss_flag; // 0 = not boss, 1 = boss. Is that surprising?
  157. ubyte see_sound; // sound robot makes when it first sees the player
  158. ubyte attack_sound; // sound robot makes when it attacks the player
  159. ubyte claw_sound; // sound robot makes as it claws you (attack_type should be 1)
  160. //animation info
  161. jointlist anim_states[MAX_GUNS+1][N_ANIM_STATES];
  162. int always_0xabcd; // debugging
  163. } robot_info;
  164. #define MAX_ROBOT_TYPES 30 // maximum number of robot types
  165. #define ROBOT_NAME_LENGTH 16
  166. extern char Robot_names[MAX_ROBOT_TYPES][ROBOT_NAME_LENGTH];
  167. //the array of robots types
  168. extern robot_info Robot_info[]; // Robot info for AI system, loaded from bitmaps.tbl.
  169. //how many kinds of robots
  170. extern int N_robot_types; // Number of robot types. We used to assume this was the same as N_polygon_models.
  171. //test data for one robot
  172. #define MAX_ROBOT_JOINTS 600
  173. extern jointpos Robot_joints[MAX_ROBOT_JOINTS];
  174. extern int N_robot_joints;
  175. //given an object and a gun number, return position in 3-space of gun
  176. //fills in gun_point
  177. void calc_gun_point(vms_vector *gun_point,object *obj,int gun_num);
  178. //void calc_gun_point(vms_vector *gun_point,int objnum,int gun_num);
  179. // Tells joint positions for a gun to be in a specified state.
  180. // A gun can have associated with it any number of joints. In order to tell whether a gun is a certain
  181. // state (such as FIRE or ALERT), you should call this function and check the returned joint positions
  182. // against the robot's gun's joint positions. This function should also be called to determine how to
  183. // move a gun into a desired position.
  184. // For now (May 30, 1994), it is assumed that guns will linearly interpolate from one joint position to another.
  185. // There is no ordering of joint movement, so it's impossible to guarantee that a strange starting position won't
  186. // cause a gun to move through a robot's body, for example.
  187. // Given:
  188. // jp_list_ptr pointer to list of joint angles, on exit, this is pointing at a static array
  189. // robot_type type of robot for which to get joint information. A particular type, not an instance of a robot.
  190. // 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.
  191. // state state about which to get information. Legal states in range 0..N_ANIM_STATES-1, defined in robot.h, are:
  192. // AS_REST, AS_ALERT, AS_FIRE, AS_RECOIL, AS_FLINCH
  193. // On exit:
  194. // Returns number of joints in list.
  195. // jp_list_ptr is stuffed with a pointer to a static array of joint positions. This pointer is valid forever.
  196. extern int robot_get_anim_state(jointpos **jp_list_ptr,int robot_type,int gun_num,int state);
  197. #endif
  198.