LASER.H 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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/laser.h $
  15. * $Revision: 2.0 $
  16. * $Author: john $
  17. * $Date: 1995/02/27 11:32:27 $
  18. *
  19. * Definitions for the laser code.
  20. *
  21. * $Log: laser.h $
  22. * Revision 2.0 1995/02/27 11:32:27 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.50 1995/02/01 21:03:44 john
  27. * Lintified.
  28. *
  29. * Revision 1.49 1995/02/01 16:34:11 john
  30. * Linted.
  31. *
  32. * Revision 1.48 1995/01/31 16:16:16 mike
  33. * Separate smart blobs for robot and player.
  34. *
  35. * Revision 1.47 1995/01/27 17:02:55 mike
  36. * Add LASER_ID -- why wasn't this added in June?
  37. *
  38. * Revision 1.46 1995/01/25 10:53:27 mike
  39. * make badass damage go through grates.
  40. *
  41. * Revision 1.45 1994/12/12 17:17:32 mike
  42. * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful.
  43. *
  44. * Revision 1.44 1994/12/04 16:17:23 mike
  45. * spruce up homing missile behavior.
  46. *
  47. * Revision 1.43 1994/12/03 12:48:30 mike
  48. * make homing missile tracking not frame rate dependent (more-or-less)
  49. *
  50. * Revision 1.42 1994/10/12 08:04:54 mike
  51. * Clean up proximity/homing mess.
  52. *
  53. * Revision 1.41 1994/10/09 20:07:04 rob
  54. * Change prototype for do_laser_firing
  55. *
  56. * Revision 1.40 1994/10/09 00:15:48 mike
  57. * Add constants for super mech missile, regular mech missile, silent spreadfire.
  58. *
  59. * Revision 1.39 1994/10/08 19:52:09 rob
  60. * Added new weapon fire flags.
  61. *
  62. * Revision 1.38 1994/10/07 15:31:12 mike
  63. * Prototypes for new laser functions which don't necessarily make sound.
  64. *
  65. * Revision 1.37 1994/10/05 17:08:29 matt
  66. * Fixed a couple of small bugs, and made homing missiles alternate sides
  67. *
  68. * Revision 1.36 1994/09/28 14:28:55 rob
  69. * Added firing of missiles on networks/serial.
  70. *
  71. * Revision 1.35 1994/09/24 14:17:02 mike
  72. * Prototype do_laser_firing.
  73. *
  74. * Revision 1.34 1994/09/23 11:36:49 mike
  75. * Prototype Laser_create_new_easy.
  76. *
  77. * Revision 1.33 1994/09/20 11:55:01 mike
  78. * Fix bug.
  79. *
  80. * Revision 1.32 1994/09/20 11:48:34 mike
  81. * Change spreadfire laser to use new bitmap. (Define SPREADFIRE_ID)
  82. *
  83. * Revision 1.31 1994/09/15 16:31:28 mike
  84. * Prototype object_to_object_visibility.
  85. *
  86. * Revision 1.30 1994/09/10 17:31:40 mike
  87. * Add thrust to weapons.
  88. *
  89. * Revision 1.29 1994/09/08 14:49:44 mike
  90. * Bunch of IDs for new weapon types.
  91. *
  92. * Revision 1.28 1994/09/07 19:16:40 mike
  93. * Homing missile.
  94. *
  95. * Revision 1.27 1994/09/07 15:59:47 mike
  96. * Kill FLARE_MAX_TIME (now defined in bitmaps.tbl), add PROXIMITY_ID (shame!), prototype do_laser_firing, do_missile_firing.
  97. *
  98. * Revision 1.26 1994/09/03 15:22:41 mike
  99. * Kill Projectile_player_fire prototype.
  100. *
  101. * Revision 1.25 1994/09/02 16:39:00 mike
  102. * IDs for primary weapons.
  103. *
  104. * Revision 1.24 1994/09/02 11:55:54 mike
  105. * Define some illegal constants.
  106. *
  107. * Revision 1.23 1994/08/25 18:12:06 matt
  108. * Made player's weapons and flares fire from the positions on the 3d model.
  109. * Also added support for quad lasers.
  110. *
  111. * Revision 1.22 1994/08/19 15:22:28 mike
  112. * Define constant for MAX_LASER_LEVEL.
  113. *
  114. * Revision 1.21 1994/08/13 12:20:47 john
  115. * Made the networking uise the Players array.
  116. *
  117. * Revision 1.20 1994/08/10 10:44:05 john
  118. * Made net players fire..
  119. *
  120. * Revision 1.19 1994/06/27 18:30:57 mike
  121. * Add flares.
  122. *
  123. * Revision 1.18 1994/06/09 15:32:37 mike
  124. * Muzzle flash
  125. *
  126. * Revision 1.17 1994/05/19 09:09:00 mike
  127. * Move a bunch of laser variables to bm.h, I think.
  128. * Also, added Robot_laser_speed, instead of hard-coding Laser_speed/4.
  129. *
  130. * Revision 1.16 1994/05/14 17:16:20 matt
  131. * Got rid of externs in source (non-header) files
  132. *
  133. * Revision 1.15 1994/05/13 20:27:39 john
  134. * Version II of John's new object code.
  135. *
  136. * Revision 1.14 1994/04/20 15:06:47 john
  137. * Neatend laser code and fixed some laser bugs.
  138. *
  139. * Revision 1.13 1994/04/01 13:35:15 matt
  140. * Cleaned up laser code a bit; moved some code here object.c to laser.c
  141. *
  142. * Revision 1.12 1994/04/01 11:14:24 yuan
  143. * Added multiple bitmap functionality to all objects...
  144. * (hostages, powerups, lasers, etc.)
  145. * Hostages and powerups are implemented in the object system,
  146. * just need to finish function call to "affect" player.
  147. *
  148. * Revision 1.11 1994/03/31 09:10:09 matt
  149. * Added #define to turn crosshair off
  150. *
  151. * Revision 1.10 1994/02/17 11:33:15 matt
  152. * Changes in object system
  153. *
  154. * Revision 1.9 1994/01/06 11:56:01 john
  155. * Made lasers be lines, not purple blobs
  156. *
  157. * Revision 1.8 1994/01/05 10:53:35 john
  158. * New object code by John.
  159. *
  160. * Revision 1.7 1993/12/08 14:21:36 john
  161. * Added ExplodeObject
  162. *
  163. * Revision 1.6 1993/12/08 11:28:54 john
  164. * Made lasers look like bolts.
  165. *
  166. * Revision 1.5 1993/12/01 13:12:40 john
  167. * made lasers frame-rate independant
  168. *
  169. * Revision 1.4 1993/11/30 19:00:42 john
  170. * lasers working kinda
  171. *
  172. * Revision 1.3 1993/11/29 19:44:53 john
  173. * *** empty log message ***
  174. *
  175. * Revision 1.2 1993/11/29 17:44:55 john
  176. * *** empty log message ***
  177. *
  178. * Revision 1.1 1993/11/29 17:19:19 john
  179. * Initial revision
  180. *
  181. *
  182. */
  183. #ifndef _LASER_H
  184. #define _LASER_H
  185. #define CONCUSSION_ID 8
  186. #define FLARE_ID 9 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
  187. #define LASER_ID 10
  188. #define VULCAN_ID 11 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
  189. #define XSPREADFIRE_ID 12 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
  190. #define PLASMA_ID 13 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
  191. #define FUSION_ID 14 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
  192. #define HOMING_ID 15
  193. #define PROXIMITY_ID 16
  194. #define SMART_ID 17
  195. #define MEGA_ID 18
  196. #define PLAYER_SMART_HOMING_ID 19
  197. #define SPREADFIRE_ID 20
  198. #define SUPER_MECH_MISS 21
  199. #define REGULAR_MECH_MISS 22
  200. #define SILENT_SPREADFIRE_ID 23
  201. #define ROBOT_SMART_HOMING_ID 29
  202. // These are new defines for the value of 'flags' passed to do_laser_firing.
  203. // The purpose is to collect other flags like QUAD_LASER and Spreadfire_toggle
  204. // into a single 8-bit quantity so it can be easily used in network mode.
  205. #define LASER_QUAD 1
  206. #define LASER_SPREADFIRE_TOGGLED 2
  207. #define MAX_LASER_LEVEL 3 // Note, laser levels are numbered from 0.
  208. #define MAX_LASER_BITMAPS 6
  209. // For muzzle firing casting light.
  210. #define MUZZLE_QUEUE_MAX 8
  211. // Constants governing homing missile behavior.
  212. // MIN_TRACKABLE_DOT gets inversely scaled by FrameTime and stuffed in Min_trackable_dot
  213. #define MIN_TRACKABLE_DOT (3*F1_0/4)
  214. #define MAX_TRACKABLE_DIST (F1_0*250)
  215. #define HOMING_MISSILE_STRAIGHT_TIME (F1_0/8) // Changed as per request of John, Adam, Yuan, but mostly John
  216. extern fix Min_trackable_dot; // MIN_TRACKABLE_DOT inversely scaled by FrameTime
  217. void Laser_render( object *obj );
  218. void Laser_player_fire( object * obj, int type, int gun_num, int make_sound, int harmless_flag );
  219. void Laser_player_fire_spread(object *obj, int laser_type, int gun_num, fix spreadr, fix spreadu, int make_sound, int harmless);
  220. void Laser_do_weapon_sequence( object *obj );
  221. void Flare_create(object *obj);
  222. int laser_are_related( int o1, int o2 );
  223. extern int do_laser_firing_player(void);
  224. extern void do_missile_firing(void);
  225. extern void net_missile_firing(int player, int weapon, int flags);
  226. int Laser_create_new( vms_vector * direction, vms_vector * position, int segnum, int parent, int type, int make_sound );
  227. // Fires a laser-type weapon (a Primary weapon)
  228. // Fires from object objnum, weapon type weapon_id.
  229. // Assumes that it is firing from a player object, so it knows which gun to fire from.
  230. // Returns the number of shots actually fired, which will typically be 1, but could be
  231. // higher for low frame rates when rapidfire weapons, such as vulcan or plasma are fired.
  232. extern int do_laser_firing(int objnum, int weapon_id, int level, int flags, int nfires);
  233. // Easier to call than Laser_create_new because it determines the segment containing the firing point
  234. // and deals with it being stuck in an object or through a wall.
  235. // Fires a laser of type "weapon_type" from an object (parent) in the direction "direction" from the position "position"
  236. // Returns object number of laser fired or -1 if not possible to fire laser.
  237. int Laser_create_new_easy( vms_vector * direction, vms_vector * position, int parent, int weapon_type, int make_sound );
  238. extern void create_smart_children(object *objp);
  239. extern int object_to_object_visibility(object *obj1, object *obj2, int trans_type);
  240. extern int Muzzle_queue_index;
  241. typedef struct muzzle_info {
  242. fix create_time;
  243. short segnum;
  244. vms_vector pos;
  245. } muzzle_info;
  246. extern muzzle_info Muzzle_data[MUZZLE_QUEUE_MAX];
  247. #endif
  248.