WEAPON.H 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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/weapon.h $
  15. * $Revision: 2.0 $
  16. * $Author: john $
  17. * $Date: 1995/02/27 11:31:10 $
  18. *
  19. * Protypes for weapon stuff.
  20. *
  21. * $Log: weapon.h $
  22. * Revision 2.0 1995/02/27 11:31:10 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.44 1995/01/30 17:14:18 mike
  27. * halve rate of vulcan ammo consumption.
  28. *
  29. * Revision 1.43 1995/01/19 17:45:04 mike
  30. * damage_force removed, that information coming from strength field.
  31. *
  32. * Revision 1.42 1995/01/05 15:46:11 john
  33. * Made weapons not rearm when starting a saved game.
  34. *
  35. * Revision 1.41 1995/01/04 12:20:27 john
  36. * Declearations to work better with game state save.
  37. *
  38. *
  39. * Revision 1.40 1994/12/13 12:54:16 mike
  40. * fix proximity, homing flags, backwards!
  41. *
  42. * Revision 1.39 1994/12/11 16:17:57 mike
  43. * change default weapon life so shots from ctrlcen on level 6 won't evaporate before they hit you.
  44. *
  45. * Revision 1.38 1994/12/09 19:55:26 matt
  46. * Added weapon name in "not available in shareware" message
  47. *
  48. * Revision 1.37 1994/12/07 12:55:27 mike
  49. * tweak vulcan amounts.
  50. *
  51. * Revision 1.36 1994/12/03 19:03:56 matt
  52. * Fixed vulcan ammo HUD message
  53. *
  54. * Revision 1.35 1994/12/02 15:05:02 matt
  55. * Fixed bogus weapon constants and arrays
  56. *
  57. * Revision 1.34 1994/11/29 14:26:05 john
  58. * Again.
  59. *
  60. * Revision 1.33 1994/11/29 14:13:47 adam
  61. * Changed the byte flash sound to short.
  62. *
  63. * Revision 1.32 1994/11/12 16:36:55 mike
  64. * default ammo stuff.
  65. *
  66. * Revision 1.31 1994/10/21 10:55:24 adam
  67. * upped MAX_WEAPON_TYPES to 30
  68. *
  69. * Revision 1.30 1994/10/19 11:16:37 mike
  70. * Limit ammo amounts.
  71. *
  72. * Revision 1.29 1994/10/12 08:05:04 mike
  73. * Clean up homing/proximity mess.
  74. *
  75. * Revision 1.28 1994/10/08 23:37:53 matt
  76. * Don't pick up weapons you already have; also fixed auto_select bug
  77. * for seconary weapons
  78. *
  79. * Revision 1.27 1994/10/07 23:37:56 matt
  80. * Made weapons select when pick up better one
  81. *
  82. * Revision 1.26 1994/10/07 16:02:17 matt
  83. * Fixed problem with weapon auto-select
  84. *
  85. * Revision 1.25 1994/10/05 17:07:44 matt
  86. * Made player_has_weapon() public and moved constants to header file
  87. *
  88. * Revision 1.24 1994/09/30 21:50:49 mike
  89. * Add homing_flag and 3 dummy bytes to weapon_info.
  90. *
  91. * Revision 1.23 1994/09/30 13:47:41 mike
  92. * Make speed and strength be difficulty level based.
  93. *
  94. * Revision 1.22 1994/09/20 16:10:13 mike
  95. * Prototype Primary_weapon_names and Secondary_weapon_names.
  96. *
  97. * Revision 1.21 1994/09/20 12:17:21 adam
  98. * upped weapon types
  99. *
  100. * Revision 1.20 1994/09/13 16:40:29 mike
  101. * Define REARM_TIME -- time it takes until you can fire a newly armed weapon.
  102. *
  103. * Revision 1.19 1994/09/13 14:43:03 matt
  104. * Added cockpit weapon displays
  105. *
  106. * Revision 1.18 1994/09/11 15:50:34 mike
  107. * Add matter and bounce to weapon_info.
  108. *
  109. * Revision 1.17 1994/09/10 17:32:17 mike
  110. * Add thrust to weapon_info.
  111. *
  112. * Revision 1.16 1994/09/09 20:04:54 mike
  113. * Add vclips for weapons.
  114. *
  115. * Revision 1.15 1994/09/07 15:59:14 mike
  116. * Add default lifetimes to weapons, destroyable, lifetime, damage_radius, damage_force fields to weapons.
  117. *
  118. * Revision 1.14 1994/09/03 15:18:06 mike
  119. * Add prototype for auto_select_weapon.
  120. *
  121. * Revision 1.13 1994/09/02 16:38:33 mike
  122. * Move data from global arrays to Weapon_info.
  123. *
  124. * Revision 1.12 1994/09/02 11:54:59 mike
  125. * Add a whole slew of constants for the whole slew of new weapons.
  126. *
  127. * Revision 1.11 1994/08/23 16:39:15 mike
  128. * Add light to weapon struct
  129. *
  130. */
  131. #ifndef _WEAPON_H
  132. #define _WEAPON_H
  133. #include "inferno.h"
  134. #include "gr.h"
  135. #include "game.h"
  136. #include "piggy.h"
  137. typedef struct weapon_info {
  138. byte render_type; // How to draw 0=laser, 1=blob, 2=object
  139. byte model_num; // Model num if rendertype==2.
  140. byte model_num_inner; // Model num of inner part if rendertype==2.
  141. byte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon)
  142. byte flash_vclip; // What vclip to use for muzzle flash
  143. short flash_sound; // What sound to play when fired
  144. byte robot_hit_vclip; // What vclip for impact with robot
  145. short robot_hit_sound; // What sound for impact with robot
  146. byte wall_hit_vclip; // What vclip for impact with wall
  147. short wall_hit_sound; // What sound for impact with wall
  148. byte fire_count; // Number of bursts fired from EACH GUN per firing. For weapons which fire from both sides, 3*fire_count shots will be fired.
  149. byte ammo_usage; // How many units of ammunition it uses.
  150. byte weapon_vclip; // Vclip to render for the weapon, itself.
  151. byte destroyable; // If !0, this weapon can be destroyed by another weapon.
  152. byte matter; // Flag: set if this object is matter (as opposed to energy)
  153. byte bounce; // Flag: set if this object bounces off walls
  154. byte homing_flag; // Set if this weapon can home in on a target.
  155. byte dum1, dum2, dum3;
  156. fix energy_usage; // How much fuel is consumed to fire this weapon.
  157. fix fire_wait; // Time until this weapon can be fired again.
  158. bitmap_index bitmap; // Pointer to bitmap if rendertype==0 or 1.
  159. fix blob_size; // Size of blob if blob type
  160. fix flash_size; // How big to draw the flash
  161. fix impact_size; // How big of an impact
  162. fix strength[NDL]; // How much damage it can inflict
  163. fix speed[NDL]; // How fast it can move, difficulty level based.
  164. fix mass; // How much mass it has
  165. fix drag; // How much drag it has
  166. fix thrust; // How much thrust it has
  167. fix po_len_to_width_ratio; // For polyobjects, the ratio of len/width. (10 maybe?)
  168. fix light; // Amount of light this weapon casts.
  169. fix lifetime; // Lifetime in seconds of this weapon.
  170. fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit
  171. //-- unused-- fix damage_force; // Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit
  172. // damage_force was a real mess. Wasn't Difficulty_level based, and was being applied instead of weapon's actual strength. Now use 2*strength instead. --MK, 01/19/95
  173. bitmap_index picture; // a picture of the weapon for the cockpit
  174. } weapon_info;
  175. #define REARM_TIME (F1_0)
  176. #define WEAPON_DEFAULT_LIFETIME (F1_0*12) // Lifetime of an object if a bozo forgets to define it.
  177. #define WEAPON_TYPE_WEAK_LASER 0
  178. #define WEAPON_TYPE_STRONG_LASER 1
  179. #define WEAPON_TYPE_CANNON_BALL 2
  180. #define WEAPON_TYPE_MISSILE 3
  181. #define MAX_WEAPON_TYPES 30
  182. #define WEAPON_RENDER_NONE -1
  183. #define WEAPON_RENDER_LASER 0
  184. #define WEAPON_RENDER_BLOB 1
  185. #define WEAPON_RENDER_POLYMODEL 2
  186. #define WEAPON_RENDER_VCLIP 3
  187. #define MAX_PRIMARY_WEAPONS 5
  188. #define MAX_SECONDARY_WEAPONS 5
  189. // Weapon flags, if player->weapon_flags & WEAPON_FLAG is set, then the player has this weapon
  190. #define HAS_LASER_FLAG 0x001
  191. #define HAS_VULCAN_FLAG 0x002
  192. #define HAS_SPREADFIRE_FLAG 0x004
  193. #define HAS_PLASMA_FLAG 0x008
  194. #define HAS_FUSION_FLAG 0x010
  195. #define HAS_CONCUSSION_FLAG 0x001
  196. #define HAS_HOMING_FLAG 0x002
  197. #define HAS_PROXIMITY_FLAG 0x004
  198. #define HAS_SMART_FLAG 0x008
  199. #define HAS_MEGA_FLAG 0x010
  200. #define CLASS_PRIMARY 0
  201. #define CLASS_SECONDARY 1
  202. #define LASER_INDEX 0
  203. #define VULCAN_INDEX 1
  204. #define SPREADFIRE_INDEX 2
  205. #define PLASMA_INDEX 3
  206. #define FUSION_INDEX 4
  207. #define CONCUSSION_INDEX 0
  208. #define HOMING_INDEX 1
  209. #define PROXIMITY_INDEX 2
  210. #define SMART_INDEX 3
  211. #define MEGA_INDEX 4
  212. #define NUM_SHAREWARE_WEAPONS 3 //in shareware, old get first 3 of each
  213. #define VULCAN_AMMO_SCALE (0x198300/2) //multiply ammo by this before displaying
  214. extern weapon_info Weapon_info[];
  215. extern int N_weapon_types;
  216. extern void do_weapon_select(int weapon_num, int secondary_flag);
  217. extern void show_weapon_status(void);
  218. extern byte Primary_weapon, Secondary_weapon;
  219. extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS];
  220. extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS];
  221. extern void auto_select_weapon(int weapon_type); //parm is primary or secondary
  222. extern select_weapon(int weapon_num, int secondary_flag, int print_message,int wait_for_rearm);
  223. extern char *Primary_weapon_names_short[];
  224. extern char *Secondary_weapon_names_short[];
  225. extern char *Primary_weapon_names[];
  226. extern char *Secondary_weapon_names[];
  227. extern int Primary_ammo_max[MAX_PRIMARY_WEAPONS];
  228. extern ubyte Secondary_ammo_max[MAX_PRIMARY_WEAPONS];
  229. #define HAS_WEAPON_FLAG 1
  230. #define HAS_ENERGY_FLAG 2
  231. #define HAS_AMMO_FLAG 4
  232. #define HAS_ALL (HAS_WEAPON_FLAG|HAS_ENERGY_FLAG|HAS_AMMO_FLAG)
  233. // ------------------------------------------------------------------------------------
  234. // Return:
  235. // Bits set:
  236. // HAS_WEAPON_FLAG
  237. // HAS_ENERGY_FLAG
  238. // HAS_AMMO_FLAG
  239. extern int player_has_weapon(int weapon_num, int secondary_flag);
  240. //called when one of these weapons is picked up
  241. //when you pick up a secondary, you always get the weapon & ammo for it
  242. pick_up_secondary(int weapon_index,int count);
  243. //called when a primary weapon is picked up
  244. //returns true if actually picked up
  245. int pick_up_primary(int weapon_index);
  246. //called when ammo (for the vulcan cannon) is picked up
  247. pick_up_ammo(int class_flag,int weapon_index,int ammo_count);
  248. #endif
  249.