1 /* $Id: weapon.h,v 1.6 2003-10-11 09:28:38 btb Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Protypes for weapon stuff.
20 * Revision 1.2 1995/09/14 14:07:10 allender
21 * fixed prototypes to have return value
23 * Revision 1.1 1995/05/16 16:05:22 allender
26 * Revision 2.0 1995/02/27 11:31:10 john
27 * New version 2.0, which has no anonymous unions, builds with
28 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
30 * Revision 1.44 1995/01/30 17:14:18 mike
31 * halve rate of vulcan ammo consumption.
33 * Revision 1.43 1995/01/19 17:45:04 mike
34 * damage_force removed, that information coming from strength field.
36 * Revision 1.42 1995/01/05 15:46:11 john
37 * Made weapons not rearm when starting a saved game.
39 * Revision 1.41 1995/01/04 12:20:27 john
40 * Declearations to work better with game state save.
43 * Revision 1.40 1994/12/13 12:54:16 mike
44 * fix proximity, homing flags, backwards!
46 * Revision 1.39 1994/12/11 16:17:57 mike
47 * change default weapon life so shots from ctrlcen on level 6 won't evaporate before they hit you.
49 * Revision 1.38 1994/12/09 19:55:26 matt
50 * Added weapon name in "not available in shareware" message
52 * Revision 1.37 1994/12/07 12:55:27 mike
53 * tweak vulcan amounts.
55 * Revision 1.36 1994/12/03 19:03:56 matt
56 * Fixed vulcan ammo HUD message
58 * Revision 1.35 1994/12/02 15:05:02 matt
59 * Fixed bogus weapon constants and arrays
61 * Revision 1.34 1994/11/29 14:26:05 john
64 * Revision 1.33 1994/11/29 14:13:47 adam
65 * Changed the byte flash sound to short.
67 * Revision 1.32 1994/11/12 16:36:55 mike
70 * Revision 1.31 1994/10/21 10:55:24 adam
71 * upped MAX_WEAPON_TYPES to 30
73 * Revision 1.30 1994/10/19 11:16:37 mike
76 * Revision 1.29 1994/10/12 08:05:04 mike
77 * Clean up homing/proximity mess.
79 * Revision 1.28 1994/10/08 23:37:53 matt
80 * Don't pick up weapons you already have; also fixed auto_select bug
81 * for seconary weapons
83 * Revision 1.27 1994/10/07 23:37:56 matt
84 * Made weapons select when pick up better one
86 * Revision 1.26 1994/10/07 16:02:17 matt
87 * Fixed problem with weapon auto-select
89 * Revision 1.25 1994/10/05 17:07:44 matt
90 * Made player_has_weapon() public and moved constants to header file
92 * Revision 1.24 1994/09/30 21:50:49 mike
93 * Add homing_flag and 3 dummy bytes to weapon_info.
95 * Revision 1.23 1994/09/30 13:47:41 mike
96 * Make speed and strength be difficulty level based.
98 * Revision 1.22 1994/09/20 16:10:13 mike
99 * Prototype Primary_weapon_names and Secondary_weapon_names.
101 * Revision 1.21 1994/09/20 12:17:21 adam
104 * Revision 1.20 1994/09/13 16:40:29 mike
105 * Define REARM_TIME -- time it takes until you can fire a newly armed weapon.
107 * Revision 1.19 1994/09/13 14:43:03 matt
108 * Added cockpit weapon displays
110 * Revision 1.18 1994/09/11 15:50:34 mike
111 * Add matter and bounce to weapon_info.
113 * Revision 1.17 1994/09/10 17:32:17 mike
114 * Add thrust to weapon_info.
116 * Revision 1.16 1994/09/09 20:04:54 mike
117 * Add vclips for weapons.
119 * Revision 1.15 1994/09/07 15:59:14 mike
120 * Add default lifetimes to weapons, destroyable, lifetime, damage_radius, damage_force fields to weapons.
122 * Revision 1.14 1994/09/03 15:18:06 mike
123 * Add prototype for auto_select_weapon.
125 * Revision 1.13 1994/09/02 16:38:33 mike
126 * Move data from global arrays to Weapon_info.
128 * Revision 1.12 1994/09/02 11:54:59 mike
129 * Add a whole slew of constants for the whole slew of new weapons.
131 * Revision 1.11 1994/08/23 16:39:15 mike
132 * Add light to weapon struct
146 #define WIF_PLACABLE 1 // can be placed by level designer
148 typedef struct weapon_info {
149 sbyte render_type; // How to draw 0=laser, 1=blob, 2=object
150 sbyte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon)
151 short model_num; // Model num if rendertype==2.
152 short model_num_inner; // Model num of inner part if rendertype==2.
154 sbyte flash_vclip; // What vclip to use for muzzle flash
155 sbyte robot_hit_vclip; // What vclip for impact with robot
156 short flash_sound; // What sound to play when fired
158 sbyte wall_hit_vclip; // What vclip for impact with wall
159 sbyte 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.
160 short robot_hit_sound; // What sound for impact with robot
162 sbyte ammo_usage; // How many units of ammunition it uses.
163 sbyte weapon_vclip; // Vclip to render for the weapon, itself.
164 short wall_hit_sound; // What sound for impact with wall
166 sbyte destroyable; // If !0, this weapon can be destroyed by another weapon.
167 sbyte matter; // Flag: set if this object is matter (as opposed to energy)
168 sbyte bounce; // 1==always bounces, 2=bounces twice
169 sbyte homing_flag; // Set if this weapon can home in on a target.
171 ubyte speedvar; // allowed variance in speed below average, /128: 64 = 50% meaning if speed = 100, can be 50..100
173 ubyte flags; // see values above
175 sbyte flash; // Flash effect
176 sbyte afterburner_size; // Size of blobs in F1_0/16 units, specify in bitmaps.tbl as floating point. Player afterburner size = 2.5.
178 /* not present in shareware datafiles */
179 sbyte children; // ID of weapon to drop if this contains children. -1 means no children.
181 fix energy_usage; // How much fuel is consumed to fire this weapon.
182 fix fire_wait; // Time until this weapon can be fired again.
184 /* not present in shareware datafiles */
185 fix multi_damage_scale; // Scale damage by this amount when applying to player in multiplayer. F1_0 means no change.
187 bitmap_index bitmap; // Pointer to bitmap if rendertype==0 or 1.
189 fix blob_size; // Size of blob if blob type
190 fix flash_size; // How big to draw the flash
191 fix impact_size; // How big of an impact
192 fix strength[NDL]; // How much damage it can inflict
193 fix speed[NDL]; // How fast it can move, difficulty level based.
194 fix mass; // How much mass it has
195 fix drag; // How much drag it has
196 fix thrust; // How much thrust it has
197 fix po_len_to_width_ratio; // For polyobjects, the ratio of len/width. (10 maybe?)
198 fix light; // Amount of light this weapon casts.
199 fix lifetime; // Lifetime in seconds of this weapon.
200 fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit
201 //-- 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
202 // 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
203 bitmap_index picture; // a picture of the weapon for the cockpit
204 /* not present in shareware datafiles */
205 bitmap_index hires_picture; // a hires picture of the above
206 } __pack__ weapon_info;
208 #define REARM_TIME (F1_0)
210 #define WEAPON_DEFAULT_LIFETIME (F1_0*12) // Lifetime of an object if a bozo forgets to define it.
212 #define WEAPON_TYPE_WEAK_LASER 0
213 #define WEAPON_TYPE_STRONG_LASER 1
214 #define WEAPON_TYPE_CANNON_BALL 2
215 #define WEAPON_TYPE_MISSILE 3
217 #define MAX_WEAPON_TYPES 70
219 #define WEAPON_RENDER_NONE -1
220 #define WEAPON_RENDER_LASER 0
221 #define WEAPON_RENDER_BLOB 1
222 #define WEAPON_RENDER_POLYMODEL 2
223 #define WEAPON_RENDER_VCLIP 3
225 #define MAX_PRIMARY_WEAPONS 10
226 #define MAX_SECONDARY_WEAPONS 10
228 //given a weapon index, return the flag value
229 #define HAS_FLAG(index) (1<<(index))
231 // Weapon flags, if player->weapon_flags & WEAPON_FLAG is set, then the player has this weapon
232 #define HAS_LASER_FLAG HAS_FLAG(LASER_INDEX)
233 #define HAS_VULCAN_FLAG HAS_FLAG(VULCAN_INDEX)
234 #define HAS_SPREADFIRE_FLAG HAS_FLAG(SPREADFIRE_INDEX)
235 #define HAS_PLASMA_FLAG HAS_FLAG(PLASMA_INDEX)
236 #define HAS_FUSION_FLAG HAS_FLAG(FUSION_INDEX)
238 #define HAS_CONCUSSION_FLAG HAS_FLAG(CONCUSSION_INDEX)
239 #define HAS_HOMING_FLAG HAS_FLAG(HOMING_INDEX)
240 #define HAS_PROXIMITY_FLAG HAS_FLAG(PROXIMITY_INDEX)
241 #define HAS_SMART_FLAG HAS_FLAG(SMART_INDEX)
242 #define HAS_MEGA_FLAG HAS_FLAG(MEGA_INDEX)
244 #define CLASS_PRIMARY 0
245 #define CLASS_SECONDARY 1
247 #define LASER_INDEX 0
248 #define VULCAN_INDEX 1
249 #define SPREADFIRE_INDEX 2
250 #define PLASMA_INDEX 3
251 #define FUSION_INDEX 4
252 #define SUPER_LASER_INDEX 5
253 #define GAUSS_INDEX 6
254 #define HELIX_INDEX 7
255 #define PHOENIX_INDEX 8
256 #define OMEGA_INDEX 9
258 #define CONCUSSION_INDEX 0
259 #define HOMING_INDEX 1
260 #define PROXIMITY_INDEX 2
261 #define SMART_INDEX 3
263 #define SMISSILE1_INDEX 5
264 #define GUIDED_INDEX 6
265 #define SMART_MINE_INDEX 7
266 #define SMISSILE4_INDEX 8
267 #define SMISSILE5_INDEX 9
269 #define SUPER_WEAPON 5
271 #define VULCAN_AMMO_SCALE 0xcc163 //(0x198300/2) //multiply ammo by this before displaying
273 #define NUM_SMART_CHILDREN 6 // Number of smart children created by default.
275 extern weapon_info Weapon_info[];
276 extern int N_weapon_types;
277 extern void do_weapon_select(int weapon_num, int secondary_flag);
278 extern void show_weapon_status(void);
280 extern sbyte Primary_weapon, Secondary_weapon;
282 extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS];
283 extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS];
285 //for each Secondary weapon, which gun it fires out of
286 extern ubyte Secondary_weapon_to_gun_num[MAX_SECONDARY_WEAPONS];
288 //for each primary weapon, what kind of powerup gives weapon
289 extern ubyte Primary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
291 //for each Secondary weapon, what kind of powerup gives weapon
292 extern ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS];
294 //flags whether the last time we use this weapon, it was the 'super' version
295 extern ubyte Primary_last_was_super[MAX_PRIMARY_WEAPONS];
296 extern ubyte Secondary_last_was_super[MAX_SECONDARY_WEAPONS];
298 extern void auto_select_weapon(int weapon_type); //parm is primary or secondary
299 extern void select_weapon(int weapon_num, int secondary_flag, int print_message,int wait_for_rearm);
301 extern char *Primary_weapon_names_short[];
302 extern char *Secondary_weapon_names_short[];
303 extern char *Primary_weapon_names[];
304 extern char *Secondary_weapon_names[];
305 extern int Primary_ammo_max[MAX_PRIMARY_WEAPONS];
306 extern ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS];
307 extern sbyte Weapon_is_energy[MAX_WEAPON_TYPES];
309 #define HAS_WEAPON_FLAG 1
310 #define HAS_ENERGY_FLAG 2
311 #define HAS_AMMO_FLAG 4
312 #define HAS_ALL (HAS_WEAPON_FLAG|HAS_ENERGY_FLAG|HAS_AMMO_FLAG)
314 //-----------------------------------------------------------------------------
321 extern int player_has_weapon(int weapon_num, int secondary_flag);
323 //called when one of these weapons is picked up
324 //when you pick up a secondary, you always get the weapon & ammo for it
325 int pick_up_secondary(int weapon_index,int count);
327 //called when a primary weapon is picked up
328 //returns true if actually picked up
329 int pick_up_primary(int weapon_index);
331 //called when ammo (for the vulcan cannon) is picked up
332 int pick_up_ammo(int class_flag,int weapon_index,int ammo_count);
334 extern int attempt_to_steal_item(object *objp, int player_num);
336 //this function is for when the player intentionally drops a powerup
337 extern int spit_powerup(object *spitter, int id, int seed);
341 extern void rock_the_mine_frame(void);
342 extern void smega_rock_stuff(void);
343 extern void init_smega_detonates(void);
344 extern void tactile_set_button_jolt (void);
347 * reads n weapon_info structs from a CFILE
349 extern int weapon_info_read_n(weapon_info *wi, int n, CFILE *fp, int file_version);