]> icculus.org git repositories - taylor/freespace2.git/blob - include/weapon.h
added copyright header
[taylor/freespace2.git] / include / weapon.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Weapon/Weapon.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * <insert description of file here>
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:15  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:12  root
22  * Initial import.
23  *
24  * 
25  * 34    9/06/99 12:46a Andsager
26  * Add weapon_explosion_ani LOD
27  * 
28  * 33    8/27/99 1:34a Andsager
29  * Modify damage by shockwaves for BIG|HUGE ships.  Modify shockwave damge
30  * when weapon blows up.
31  * 
32  * 32    8/24/99 10:47a Jefff
33  * tech room weapon anims.  added tech anim field to weapons.tbl
34  * 
35  * 31    8/10/99 5:30p Jefff
36  * Added tech_title string to weapon_info.  Changed parser accordingly.
37  * 
38  * 30    8/02/99 5:16p Dave
39  * Bumped up weapon title string length from 32 to 48
40  * 
41  * 29    7/15/99 9:20a Andsager
42  * FS2_DEMO initial checkin
43  * 
44  * 28    6/30/99 5:53p Dave
45  * Put in new anti-camper code.
46  * 
47  * 27    6/21/99 7:25p Dave
48  * netplayer pain packet. Added type E unmoving beams.
49  * 
50  * 26    6/14/99 10:45a Dave
51  * Made beam weapons specify accuracy by skill level in the weapons.tbl
52  * 
53  * 25    6/04/99 2:16p Dave
54  * Put in shrink effect for beam weapons.
55  * 
56  * 24    6/01/99 8:35p Dave
57  * Finished lockarm weapons. Added proper supercap weapons/damage. Added
58  * awacs-set-radius sexpression.
59  * 
60  * 23    5/27/99 6:17p Dave
61  * Added in laser glows.
62  * 
63  * 22    5/20/99 7:00p Dave
64  * Added alternate type names for ships. Changed swarm missile table
65  * entries.
66  * 
67  * 21    4/28/99 11:13p Dave
68  * Temporary checkin of artillery code.
69  * 
70  * 20    4/28/99 3:11p Andsager
71  * Stagger turret weapon fire times.  Make turrets smarter when target is
72  * protected or beam protected.  Add weaopn range to weapon info struct.
73  * 
74  * 19    4/22/99 11:06p Dave
75  * Final pass at beam weapons. Solidified a lot of stuff. All that remains
76  * now is to tweak and fix bugs as they come up. No new beam weapon
77  * features.
78  * 
79  * 18    4/19/99 11:01p Dave
80  * More sophisticated targeting laser support. Temporary checkin.
81  * 
82  * 17    4/16/99 5:54p Dave
83  * Support for on/off style "stream" weapons. Real early support for
84  * target-painting lasers.
85  * 
86  * 16    4/02/99 9:55a Dave
87  * Added a few more options in the weapons.tbl for beam weapons. Attempt
88  * at putting "pain" packets into multiplayer.
89  * 
90  * 15    3/31/99 8:24p Dave
91  * Beefed up all kinds of stuff, incluging beam weapons, nebula effects
92  * and background nebulae. Added per-ship non-dimming pixel colors.
93  * 
94  * 14    3/23/99 11:03a Dave
95  * Added a few new fields and fixed parsing code for new weapon stuff.
96  * 
97  * 13    3/19/99 9:52a Dave
98  * Checkin to repair massive source safe crash. Also added support for
99  * pof-style nebulae, and some new weapons code.
100  * 
101  * 12    1/29/99 12:47a Dave
102  * Put in sounds for beam weapon. A bunch of interface screens (tech
103  * database stuff).
104  * 
105  * 11    1/27/99 9:56a Dave
106  * Temporary checkin of beam weapons for Dan to make cool sounds.
107  * 
108  * 10    1/25/99 5:03a Dave
109  * First run of stealth, AWACS and TAG missile support. New mission type
110  * :)
111  * 
112  * 9     1/24/99 11:37p Dave
113  * First full rev of beam weapons. Very customizable. Removed some bogus
114  * Int3()'s in low level net code.
115  * 
116  * 8     1/21/99 10:45a Dave
117  * More beam weapon stuff. Put in warmdown time.
118  * 
119  * 7     1/08/99 2:08p Dave
120  * Fixed software rendering for pofview. Super early support for AWACS and
121  * beam weapons.
122  * 
123  * 6     11/14/98 5:33p Dave
124  * Lots of nebula work. Put in ship contrails.
125  * 
126  * 5     10/26/98 9:42a Dave
127  * Early flak gun support.
128  * 
129  * 4     10/16/98 3:42p Andsager
130  * increase MAX_WEAPONS and MAX_SHIPS and som header files
131  * 
132  * 3     10/07/98 6:27p Dave
133  * Globalized mission and campaign file extensions. Removed Silent Threat
134  * special code. Moved \cache \players and \multidata into the \data
135  * directory.
136  * 
137  * 2     10/07/98 10:54a Dave
138  * Initial checkin.
139  * 
140  * 1     10/07/98 10:51a Dave
141  * 
142  * 100   9/04/98 3:52p Dave
143  * Put in validated mission updating and application during stats
144  * updating.
145  * 
146  * 99    9/01/98 4:25p Dave
147  * Put in total (I think) backwards compatibility between mission disk
148  * freespace and non mission disk freespace, including pilot files and
149  * campaign savefiles.
150  * 
151  * 98    8/28/98 3:29p Dave
152  * EMP effect done. AI effects may need some tweaking as required.
153  * 
154  * 97    8/25/98 1:49p Dave
155  * First rev of EMP effect. Player side stuff basically done. Next comes
156  * AI code.
157  * 
158  * 96    8/18/98 10:15a Dave
159  * Touchups on the corkscrew missiles. Added particle spewing weapons.
160  * 
161  * 95    8/17/98 5:07p Dave
162  * First rev of corkscrewing missiles.
163  * 
164  * 94    5/18/98 1:58a Mike
165  * Make Phoenix not be fired at fighters (but yes bombers).
166  * Improve positioning of ships in guard mode.
167  * Make turrets on player ship not fire near end of support ship docking.
168  * 
169  * 93    5/15/98 5:37p Hoffoss
170  * Added new 'tech description' fields to ship and weapon tables, and
171  * added usage of it in tech room.
172  * 
173  * 92    5/06/98 8:06p Dave
174  * Made standalone reset properly under weird conditions. Tweak
175  * optionsmulti screen. Upped MAX_WEAPONS to 350. Put in new launch
176  * countdown anim. Minro ui fixes/tweaks.
177  * 
178  * 91    5/05/98 11:15p Lawrance
179  * Optimize weapon flyby sound determination
180  * 
181  * 90    5/05/98 4:08p Hoffoss
182  * Added WIF_PLAYER_ALLOWED to check what is valid for the weaponry pool
183  * in Fred.
184  * 
185  * 89    4/23/98 5:50p Hoffoss
186  * Added tracking of techroom database list info in pilot files, added
187  * sexp to add more to list, made mouse usable on ship listing in tech
188  * room.
189  * 
190  * 88    4/19/98 9:21p Sandeep
191  * 
192  * 87    4/13/98 5:11p Mike
193  * More improvement to countermeasure code.
194  * 
195  * 86    4/10/98 11:02p Mike
196  * Make countermeasures less effective against aspect seekers than against
197  * heat seekers.
198  * Make AI ships match bank with each other when attacking a faraway
199  * target.
200  * Make ships not do silly loop-de-loop sometimes when attacking a faraway
201  * target.
202  * 
203  * 85    4/10/98 4:52p Hoffoss
204  * Made several changes related to tooltips.
205  * 
206  * 84    4/02/98 11:40a Lawrance
207  * check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
208  * 
209  * 83    4/01/98 5:35p John
210  * Made only the used POFs page in for a level.   Reduced some interp
211  * arrays.    Made custom detail level work differently.
212  * 
213  * 82    3/21/98 3:37p Mike
214  * Fix/optimize attacking of big ships.
215  * 
216  * 81    3/15/98 9:44p Lawrance
217  * Get secondary weapons for turrets working
218  * 
219  * 79    3/12/98 1:24p Mike
220  * When weapons linked, increase firing delay.
221  * Free up weapon slots for AI ships, if necessary.
222  * Backside render shield effect.
223  * Remove shield hit triangle if offscreen.
224  * 
225  * 78    3/11/98 4:34p John
226  * Made weapons have glow & thrusters.
227  * 
228  * 77    3/04/98 8:51a Mike
229  * Working on making ships better about firing Synaptic.
230  * 
231  * 76    3/03/98 5:12p Dave
232  * 50% done with team vs. team interface issues. Added statskeeping to
233  * secondary weapon blasts. Numerous multiplayer ui bug fixes.
234  * 
235  * 75    3/02/98 10:00a Sandeep
236  * 
237  * 74    2/15/98 11:28p Allender
238  * allow increase in MAX_WEAPON_TYPES by chaning all bitfield references
239  * 
240  * 73    2/11/98 1:52p Sandeep
241  * 
242  * 72    2/02/98 8:47a Andsager
243  * Ship death area damage applied as instantaneous damage for small ships
244  * and shockwaves for large (>50 radius) ships.
245  * 
246  * 71    1/29/98 11:48a John
247  * Added new counter measure rendering as model code.   Made weapons be
248  * able to have impact explosion.
249  * 
250  * 70    1/23/98 5:08p John
251  * Took L out of vertex structure used B (blue) instead.   Took all small
252  * fireballs out of fireball types and used particles instead.  Fixed some
253  * debris explosion things.  Restructured fireball code.   Restructured
254  * some lighting code.   Made dynamic lighting on by default. Made groups
255  * of lasers only cast one light.  Made fireballs not cast light.
256  * 
257  * 69    1/21/98 7:20p Lawrance
258  * removed unused mount_size member
259  * 
260  * 68    1/19/98 10:01p Lawrance
261  * Implement "Electronics" missiles
262  * 
263  * 67    1/17/98 10:04p Lawrance
264  * Implementing "must lock to fire" missiles.  Fix couple bugs with rearm
265  * time display.
266  * 
267  * 66    1/17/98 4:45p Mike
268  * Better support for AI selection of secondary weapons.
269  * 
270  * 65    1/16/98 11:43a Mike
271  * Fix countermeasures.
272  * 
273  * 64    1/15/98 11:13a John
274  * Added code for specifying weapon trail bitmaps in weapons.tbl
275  * 
276  * 63    1/06/98 6:58p Lawrance
277  * Add wp->turret_subsys, which gets set when a turret fires a weapon.
278  * 
279  * $NoKeywords: $
280  */
281
282 #ifndef _WEAPON_H
283 #define _WEAPON_H
284
285 // define moved to before includes so that we can have it available when ship.h is included below
286 #define MAX_WEAPON_TYPES                                200
287
288 // define to compile corkscrew missiles in
289
290 #include "object.h"
291 #include "parselo.h"
292 #include "ship.h"               /* needed for ship_subsys* */
293 #include "2d.h"         // needed for color
294 #include "shockwave.h"
295 #include "trails.h"
296 #include "ai.h"
297
298 #define WP_UNUSED       -1
299 #define WP_LASER                0
300 #define WP_MISSILE      1
301 #define WP_BEAM         2
302
303 #define WRT_LASER       1
304 #define WRT_POF         2
305
306 //      Bitflags controlling weapon behavior
307 #define MAX_WEAPON_FLAGS        18                                              //      Maximum number of different bit flags legal to specify in a single weapons.tbl Flags line
308
309 #define WIF_HOMING_HEAT (1 << 0)                                //      if set, this weapon homes via seeking heat
310 #define WIF_HOMING_ASPECT       (1 << 1)                                //      if set, this weapon homes via chasing aspect
311 #define WIF_ELECTRONICS (1 << 2)                                //      Takes out electronics systems.
312 #define WIF_SPAWN                       (1 << 3)                                //      Spawns projectiles on detonation.
313 #define WIF_REMOTE                      (1 << 4)                                //      Can be remotely detonated by parent.
314 #define WIF_PUNCTURE            (1 << 5)                                //      Punctures armor, damaging subsystems.
315 #define WIF_SUPERCAP            (1 << 6)                                //      This is a weapon which does supercap class damage (meaning, it applies real damage to supercap ships)
316 #define WIF_AREA_EFFECT (1 << 7)                                //      Explosion has an area effect
317 #define WIF_SHOCKWAVE           (1 << 8)                                //      Explosion has a shockwave
318 #define  WIF_TURNS                      (1 << 9)                                // Set this if the weapon ever changes heading.  If you
319                                                                                                                         // don't set this and the weapon turns, collision detection
320                                                                                                                         // won't work, I promise!
321 #define WIF_SWARM                       (1 << 10)                       // Missile "swarms".. ie changes heading and twists on way to target
322 #define WIF_TRAIL                       (1 << 11)                       //      Has a trail
323 #define WIF_BIG_ONLY            (1 << 12)                       //      Only big ships (cruiser, capital, etc.) can arm this weapon
324 #define WIF_CHILD                       (1 << 13)                       //      No ship can have this weapon.  It gets created by weapon detonations.
325 #define WIF_BOMB                                (1 << 14)                       // Bomb-type missile, can be targeted
326 #define WIF_HUGE                                (1 << 15)                       //      Huge damage (generally 500+), probably only fired at huge ships.
327 #define WIF_NO_DUMBFIRE (1      <<      16)                     // Missile cannot be fired dumbfire (ie requires aspect lock)
328 #define  WIF_THRUSTER           (1 << 17)                       // Has thruster cone and/or glow
329 #define WIF_IN_TECH_DATABASE            (1 << 18)
330 #define WIF_PLAYER_ALLOWED              (1 << 19)   // allowed to be on starting wing ships/in weaponry pool
331 #define WIF_BOMBER_PLUS (1 << 20)                       //      Fire this missile only at a bomber or big ship.  But not a fighter.
332
333 #define WIF_CORKSCREW           (1 << 21)                       // corkscrew style missile
334 #define WIF_PARTICLE_SPEW       (1 << 22)                       // spews particles as it travels
335 #define WIF_EMP                         (1 << 23)                       // weapon explodes with a serious EMP effect
336 #define  WIF_ENERGY_SUCK        (1 << 24)                       // energy suck primary (impact effect)
337 #define WIF_FLAK                                (1 << 25)                       // use for big-ship turrets - flak gun
338 #define WIF_BEAM                                (1 << 26)                       // if this is a beam weapon : NOTE - VERY SPECIAL CASE
339 #define WIF_TAG                         (1 << 27)                       // this weapon has a tag effect when it hits
340 #define WIF_SHUDDER                     (1 << 28)                       // causes the weapon to shudder. shudder is proportional to the mass and damage of the weapon
341 #define WIF_MFLASH                      (1 << 29)                       // has muzzle flash
342 #define WIF_LOCKARM                     (1 << 30)                       // if the missile was fired without a lock, it does significanlty less damage on impact
343 #define  WIF_STREAM                     (1 << 31)                       // handled by "trigger down/trigger up" instead of "fire - wait - fire - wait"
344
345 #define WIF_HOMING                                      (WIF_HOMING_HEAT | WIF_HOMING_ASPECT)
346 #define  WIF_HURTS_BIG_SHIPS            (WIF_BOMB | WIF_BEAM | WIF_HUGE | WIF_BIG_ONLY)
347
348 #define WEAPON_EXHAUST_DELTA_TIME       75              //      Delay in milliseconds between exhaust blobs
349
350 #define WF_LOCK_WARNING_PLAYED          (1<<0)          // set when a lock warning sound is played for the player
351                                                                                                                                 //      (needed since we don't want to play multiple lock sounds)
352 #define WF_ALREADY_APPLIED_STATS                (1<<1)          // for use in ship_apply_local and ship_apply_global damage functions
353                                                                                                                                 // so that we don't record multiple hits (stats) for one impact
354 #define WF_PLAYED_FLYBY_SOUND                   (1<<2)          // flyby sound has been played for this weapon
355 #define WF_CONSIDER_FOR_FLYBY_SOUND     (1<<3)          // consider for flyby
356 #define WF_DEAD_IN_WATER                                (1<<4)          // a missiles engines have died
357 #define WF_LOCKED_WHEN_FIRED                    (1<<5)          // fired with a lock
358 #define WF_DESTROYED_BY_WEAPON          (1<<6)          // destroyed by damage from other weapon
359
360 typedef struct weapon {
361         int             weapon_info_index;                      // index into weapon_info array
362         int             objnum;                                                 // object number for this weapon
363         int             team;                                                           // The team of the ship that fired this
364         int             species;                                                        // The species of the ship that fired this
365         float           lifeleft;                                               // life left on this weapon     
366         int             target_num;                                             //      Object index of target
367         int             target_sig;                                             //      So we know if the target is the same one we've been tracking
368         float           nearest_dist;                                   //      nearest distance yet attained to target
369         fix             creation_time;                                  //      time at which created, stuffed Missiontime
370         int             weapon_flags;                                   //      bit flags defining behavior, see WF_xxxx
371         object* homing_object;                                  //      object this weapon is homing on.
372         ship_subsys*    homing_subsys;                  // subsystem this weapon is homing on
373         vector  homing_pos;                                             // world position missile is homing on
374         short           swarm_index;                                    // index into swarm missile info, -1 if not WIF_SWARM
375         int             missile_list_index;                     // index for missiles into Missile_obj_list, -1 weapon not missile
376         int             trail_num;                                              // -1 if no trail, else index into Trails array
377         ship_subsys *turret_subsys;                     // points to turret that fired weapon, otherwise NULL
378         int             group_id;                                               // Which group this is in.
379
380         // Stuff for thruster glows
381         int             thruster_bitmap;                                        // What frame the current thruster bitmap is at for this weapon
382         float           thruster_frame;                                 // Used to keep track of which frame the animation should be on.
383         int             thruster_glow_bitmap;                   // What frame the current thruster engine glow bitmap is at for this weapon
384         float           thruster_glow_frame;                            // Used to keep track of which frame the engine glow animation should be on.
385         float           thruster_glow_noise;                            // Noise for current frame
386
387         int             pick_big_attack_point_timestamp;        //      Timestamp at which to pick a new point to attack.
388         vector  big_attack_point;                               //      Target-relative location of attack point.
389
390         int             cmeasure_ignore_objnum;         //      Ignoring this countermeasure.  It's failed to attract this weapon.
391         int             cmeasure_chase_objnum;          //      Chasing this countermeasure.  Don't maybe ignore in future.
392
393         // corkscrew info (taken out for now)
394         short   cscrew_index;                                           // corkscrew info index
395
396         // particle spew info
397         int             particle_spew_time;                     // time to spew next bunch of particles 
398
399         // flak info
400         short flak_index;                                                       // flak info index
401 } weapon;
402
403
404 #ifdef FS2_DEMO
405         #define MAX_WEAPONS     100
406 #else
407         // upped 5/6/98 from 200 - DB
408         #define MAX_WEAPONS     350
409 #endif
410
411 // info specific to beam weapons
412 #define MAX_BEAM_SECTIONS                               5
413 typedef struct beam_weapon_section_info {
414         float width;                                                    // width of the section
415         int texture;                                                    // texture bitmap
416         ubyte rgba_inner[4];                                    // for non-textured beams
417         ubyte rgba_outer[4];                                    // for non-textured beams
418         float flicker;                                                  // how much it flickers (0.0 to 1.0)
419         float z_add;                                                    // is this necessary?
420 } beam_weapon_section_info;
421
422 typedef struct beam_weapon_info {
423         int     beam_type;                                              // beam type
424         float   beam_life;                                              // how long it lasts
425         int     beam_warmup;                                    // how long it takes to warmup (in ms)
426         int     beam_warmdown;                                  // how long it takes to warmdown (in ms)
427         float   beam_muzzle_radius;                     // muzzle glow radius
428         int     beam_particle_count;                    // beam spew particle count
429         float   beam_particle_radius;           // radius of beam particles
430         float   beam_particle_angle;                    // angle of beam particle spew cone
431         int     beam_particle_ani;                      // particle ani
432         float   beam_miss_factor[NUM_SKILL_LEVELS];                             // magic # which makes beams miss more. by skill level
433         int     beam_loop_sound;                                // looping beam sound
434         int     beam_warmup_sound;                      // warmup sound
435         int     beam_warmdown_sound;                    // warmdown sound
436         int     beam_num_sections;                      // the # of visible "sections" on the beam
437         int     beam_glow_bitmap;                               // muzzle glow bitmap
438         int     beam_shots;                                             // # of shots the beam takes
439         float   beam_shrink_factor;                     // what percentage of total beam lifetime when the beam starts shrinking
440         float beam_shrink_pct;                          // what percent/second the beam shrinks at
441         beam_weapon_section_info sections[MAX_BEAM_SECTIONS];                   // info on the visible sections of the beam     
442 } beam_weapon_info;
443
444 extern weapon Weapons[MAX_WEAPONS];
445
446 #define WEAPON_TITLE_LEN                        48
447
448 typedef struct weapon_info {
449         char    name[NAME_LENGTH];                              // name of this weapon
450         char    title[WEAPON_TITLE_LEN];                // official title of weapon (used by tooltips)
451         char    *desc;                                                          // weapon's description (used by tooltips)
452         int     subtype;                                                                // one of the WP_* macros above
453         int     render_type;                                            //      rendering method, laser, pof, avi
454         char    pofbitmap_name[NAME_LENGTH];    // Name of the pof representing this if POF, or bitmap filename if bitmap
455         int     model_num;                                                      // modelnum of weapon -- -1 if no model
456
457         char    *tech_desc;                                                             // weapon's description (in tech database)
458         char    tech_anim_filename[NAME_LENGTH];        // weapon's tech room animation
459         char    tech_title[NAME_LENGTH];                        // weapon's name (in tech database)
460
461         int     laser_bitmap;                                           // Which bitmap renders for laser, -1 if none
462         int     laser_glow_bitmap;                              // optional bitmap for laser glow
463         float laser_length;
464         color   laser_color_1;                                          // for cycling between glow colors
465         color   laser_color_2;                                          // for cycling between glow colors
466         float   laser_head_radius, laser_tail_radius;
467
468         float   max_speed;                                                      // initial speed of the weapon
469         float mass;                                                                     // mass of the weapon
470         float fire_wait;                                                        // fire rate -- amount of time before you can refire the weapon
471         float   blast_force;                                            // force this weapon exhibits when hitting an object
472         float   damage;                                                         //      damage of weapon (for missile, damage within inner radius)
473         float   inner_radius, outer_radius;     // damage radii for missiles (0 means impact only)
474         float   shockwave_speed;                                        // speed of shockwave ( 0 means none )
475         float   armor_factor, shield_factor, subsystem_factor;  //      in 0.0..2.0, scale of damage done to type of thing
476         float   lifetime;                                                       //      How long this thing lives.
477         float energy_consumed;                                  // Energy used up when weapon is fired
478         int     wi_flags;                                                       //      bit flags defining behavior, see WIF_xxxx
479         float turn_time;
480         float   cargo_size;                                                     // cargo space taken up by individual weapon (missiles only)
481         float rearm_rate;                                                       // rate per second at which secondary weapons are loaded during rearming
482         float   weapon_range;                                           // max range weapon can be effectively fired.  (May be less than life * speed)
483
484         // spawn weapons
485         short   spawn_type;                                                     //      Type of weapon to spawn when detonated.
486         short   spawn_count;                                            //      Number of weapons of spawn_type to spawn.
487
488         // swarm count
489         short swarm_count;                                              // how many swarm missiles are fired for this weapon
490
491         //      Specific to ASPECT homing missiles.
492         float   min_lock_time;                                          // minimum time (in seconds) to achieve lock
493         int     lock_pixels_per_sec;                            // pixels/sec moved while locking
494         int     catchup_pixels_per_sec;                 // pixels/sec moved while catching-up for a lock                                
495         int     catchup_pixel_penalty;                  // number of extra pixels to move while locking as a penalty for catching up for a lock                 
496
497         //      Specific to HEAT homing missiles.
498         float   fov;
499
500         int     launch_snd;
501         int     impact_snd;
502         int     flyby_snd;                                                      //      whizz-by sound, transmitted through weapon's portable atmosphere.
503         
504         // Specific to weapons with TRAILS:
505         trail_info tr_info;                     
506
507         char    icon_filename[NAME_LENGTH];     // filename for icon that is displayed in weapon selection
508         char    anim_filename[NAME_LENGTH];     // filename for animation that plays in weapon selection
509
510         int     impact_weapon_expl_index;               // Index into Weapon_expl_info of which ANI should play when this thing impacts something
511         float   impact_explosion_radius;                // How big the explosion should be
512
513         // EMP effect
514         float emp_intensity;                                    // intensity of the EMP effect
515         float emp_time;                                         // time of the EMP effect
516
517         // Energy suck effect
518         float weapon_reduce;                                    // how much energy removed from weapons systems
519         float afterburner_reduce;                       // how much energy removed from weapons systems
520
521         // Beam weapon effect   
522         beam_weapon_info        b_info;                 // this must be valid if the weapon is a beam weapon WIF_BEAM or WIF_BEAM_SMALL
523
524         // tag stuff
525         float   tag_time;                                               // how long the tag lasts               
526         int tag_level;                                                  // tag level (1 - 3)
527
528         // muzzle flash
529         int muzzle_flash;                                               // muzzle flash stuff
530 } weapon_info;
531
532 // Data structure to track the active missiles
533 typedef struct missile_obj {
534         missile_obj *next, *prev;
535         int                     flags, objnum;
536 } missile_obj;
537 extern missile_obj Missile_obj_list;
538
539 extern weapon_info Weapon_info[MAX_WEAPON_TYPES];
540
541 extern int Num_weapon_types;                    // number of weapons in the game
542 extern int First_secondary_index;
543 extern int Num_weapons;
544
545 extern int Num_player_weapon_precedence;                                // Number of weapon types in Player_weapon_precedence
546 extern int Player_weapon_precedence[MAX_WEAPON_TYPES];  // Array of weapon types, precedence list for player weapon selection
547 extern char     *Weapon_names[MAX_WEAPON_TYPES];
548
549 #define WEAPON_INDEX(wp)                                (wp-Weapons)
550 #define WEAPON_INFO_INDEX(wip)          (wip-Weapon_info)
551
552
553 int weapon_info_lookup(char *name);
554 void weapon_init();                                     // called at game startup
555 void weapon_level_init();                       // called before the start of each level
556 void weapon_render(object * obj);
557 void weapon_delete( object * obj );
558 void weapon_process_pre( object *obj, float frame_time);
559 void weapon_process_post( object *obj, float frame_time);
560
561 // Group_id:  If you should quad lasers, they should all have the same group id.  
562 // This will be used to optimize lighting, since each group only needs to cast one light.
563 // Call this to get a new group id, then pass it to each weapon_create call for all the
564 // weapons in the group.   Number will be between 0 and WEAPON_MAX_GROUP_IDS and will
565 // get reused.
566 int weapon_create_group_id();
567
568 // How many unique groups of weapons there can be at one time. 
569 #define WEAPON_MAX_GROUP_IDS 256
570
571 // Passing a group_id of -1 means it isn't in a group.  See weapon_create_group_id for more 
572 // help on weapon groups.
573 int weapon_create( vector * pos, matrix * orient, int weapon_type, int parent_obj, int secondary_flag, int group_id=-1, int is_locked = 0);
574 void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_objnum, int target_is_locked = 0, ship_subsys *target_subsys = NULL);
575
576 // for weapons flagged as particle spewers, spew particles. wheee
577 void weapon_maybe_spew_particle(object *obj);
578
579
580 void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos );
581 int weapon_name_lookup(char *name);
582 void spawn_child_weapons( object *objp );
583
584 // call to detonate a weapon. essentially calls weapon_hit() with other_obj as NULL, and sends a packet in multiplayer
585 void weapon_detonate(object *objp);
586
587 void    weapon_area_apply_blast(vector *force_apply_pos, object *ship_objp, vector *blast_pos, float blast, int make_shockwave);
588 int     weapon_area_calc_damage(object *objp, vector *pos, float inner_rad, float outer_rad, float max_blast, float max_damage,
589                                                                                 float *blast, float *damage, float limit);
590
591 void    missile_obj_list_rebuild();     // called by save/restore code only
592 missile_obj *missile_obj_return_address(int index);
593 void find_homing_object_cmeasures();
594
595 // THE FOLLOWING FUNCTION IS IN SHIP.CPP!!!!
596 // JAS - figure out which thruster bitmap will get rendered next
597 // time around.  ship_render needs to have shipp->thruster_bitmap set to
598 // a valid bitmap number, or -1 if we shouldn't render thrusters.
599 // This does basically the same thing as ship_do_thruster_frame, except it
600 // operates on a weapon.   This is in the ship code because it needs
601 // the same thruster animation info as the ship stuff, and I would
602 // rather extern this one function than all the thruster animation stuff.
603 void ship_do_weapon_thruster_frame( weapon *weaponp, object *objp, float frametime );
604
605 // call to get the "color" of the laser at the given moment (since glowing lasers can cycle colors)
606 void weapon_get_laser_color(color *c, object *objp);
607
608 void weapon_hit_do_sound(object *hit_obj, weapon_info *wip, vector *hitpos);
609
610 // return a scale factor for damage which should be applied for 2 collisions
611 float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target);
612
613 // return handle to explosion ani
614 int weapon_get_expl_handle(int weapon_expl_index, vector *pos, float size);
615
616 #endif
617