]> icculus.org git repositories - taylor/freespace2.git/blob - include/cmeasure.h
Initial revision
[taylor/freespace2.git] / include / cmeasure.h
1 /*
2  * $Logfile: /Freespace2/code/CMeasure/CMeasure.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Counter measures.  Created by Mike Kulas, May 12, 1997.
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:11  root
11  * Initial revision
12  *
13  * 
14  * 3     11/05/98 5:55p Dave
15  * Big pass at reducing #includes
16  * 
17  * 2     10/07/98 10:52a Dave
18  * Initial checkin.
19  * 
20  * 1     10/07/98 10:48a Dave
21  * 
22  * 20    4/11/98 5:17p Jim
23  * Reduced countermeasure firing rate from 2 times per second to 3 times
24  * per second.
25  * 
26  * 19    4/10/98 11:02p Mike
27  * Make countermeasures less effective against aspect seekers than against
28  * heat seekers.
29  * Make AI ships match bank with each other when attacking a faraway
30  * target.
31  * Make ships not do silly loop-de-loop sometimes when attacking a faraway
32  * target.
33  * 
34  * 18    4/01/98 5:34p John
35  * Made only the used POFs page in for a level.   Reduced some interp
36  * arrays.    Made custom detail level work differently.
37  * 
38  * 17    2/26/98 10:07p Hoffoss
39  * Rewrote state saving and restoring to fix bugs and simplify the code.
40  * 
41  * 16    2/23/98 4:30p Mike
42  * Make homing missiles detonate after they pass up their target.  Make
43  * countermeasures less effective.
44  * 
45  * 15    2/09/98 8:04p Lawrance
46  * Add objnum to cmeasure struct, correctly set source_objnum
47  * 
48  * 14    2/05/98 11:20p Lawrance
49  * save/restore countermeasure data
50  * 
51  * 13    1/29/98 11:48a John
52  * Added new counter measure rendering as model code.   Made weapons be
53  * able to have impact explosion.
54  * 
55  * 12    1/16/98 11:43a Mike
56  * Fix countermeasures.
57  * 
58  * 11    8/13/97 9:50p Allender
59  * split *_move into *_process_pre and *_process_post functions.
60  * process_pre functions called before object is moved.  _process_post
61  * functions called after object is moved.  Reordered code in ship_post
62  * and weapon_post for multiplayer
63  * 
64  * 10    8/13/97 4:45p Allender
65  * fixed ship_fire_primary and fire_secondary to not take parameter for
66  * determining whether to count ammo or not.  Fixed countermeasure firing
67  * for multiplayer
68  * 
69  * 9     8/08/97 4:29p Allender
70  * countermeasure stuff for multiplayer
71  * 
72  * 8     7/09/97 12:04a Mike
73  * Error prevention in matrix_interpolate().
74  * 
75  * 7     6/24/97 10:04a Allender
76  * major multiplayer improvements.  Better sequencing before game.
77  * Dealing with weapon/fireball/counter measure objects between
78  * client/host.  
79  * 
80  * 6     5/22/97 5:45p Mike
81  * Better countermeasure firing, key off availability, specify in
82  * weapons.tbl
83  * 
84  * 5     5/15/97 5:05p Mike
85  * In the midst of changing subsystem targetnig from type-based to
86  * pointer-based.
87  * Also allowed you to view a target while dead.
88  * 
89  * 4     5/14/97 4:08p Lawrance
90  * removing my_index from game arrays
91  * 
92  * 3     5/14/97 10:50a Mike
93  * More countermeasure stuff.
94  * 
95  * 2     5/12/97 5:58p Mike
96  * Add countermeasures.
97  * 
98  * 1     5/12/97 2:23p Mike
99  *
100  * $NoKeywords: $
101  */
102
103 #ifndef _CMEASURE_H
104 #define _CMEASURE_H
105
106 #include "parselo.h"
107 #include "object.h"
108
109 #define MAX_CMEASURES 64
110
111 //      Goes in cmeasure.subtype
112 #define CMEASURE_UNUSED                 -1
113
114 #define MAX_CMEASURE_TYPES              3
115
116 #define CMEASURE_WAIT                           333                     //      delay in milliseconds between countermeasure firing.
117
118 #define CMF_DUD_HEAT                            0x01                    //      If set, this cmeasure is a dud to heat seekers.  Set at create time.
119 #define CMF_DUD_ASPECT                          0x02                    //      If set, this cmeasure is a dud to aspect seekers.  Set at create time.
120
121 #define CMF_DUD (CMF_DUD_HEAT | CMF_DUD_ASPECT)
122
123 //      Maximum distance at which a countermeasure can be tracked
124 //      If this value is too large, missiles will always be tracking countermeasures.
125 #define MAX_CMEASURE_TRACK_DIST 300.0f
126
127 typedef struct cmeasure_info {
128         char    cmeasure_name[NAME_LENGTH];
129         float   max_speed;                                                              // launch speed, relative to ship
130         float   fire_wait;                                                              //      time between launches
131         float   life_min, life_max;                                     //      lifetime will be in range min..max.
132         int     launch_sound;                                                   //      Sound played when launched.
133         char    pof_name[NAME_LENGTH];
134         int     model_num;                                                              // What this renders as
135 } cmeasure_info;
136
137 typedef struct cmeasure {
138         int             flags;                          //      You know, flag type things.
139         int             subtype;                                // See CMEASURE_??? defines
140         int             objnum;
141         int             source_objnum;          // What object this came from
142         int             source_sig;                     // Signature of the source object
143         int             team;                                   // Team of the ship where the cmeasure came from
144         float           lifeleft;                       // When 0 or less object dies
145 } cmeasure;
146
147 extern cmeasure_info Cmeasure_info[MAX_CMEASURE_TYPES];
148 extern cmeasure Cmeasures[MAX_CMEASURES];
149 extern int Num_cmeasure_types;
150 extern int Num_cmeasures;
151 extern int Cmeasures_homing_check;
152
153 extern void cmeasure_init();
154 extern void cmeasure_render( object * obj );
155 extern void cmeasure_delete( object * obj );
156 extern void cmeasure_process_pre( object * obj, float frame_time);
157 extern void cmeasure_process_post( object * obj, float frame_time);
158 extern int cmeasure_create( object * source_obj, vector *pos, int cm_type, int rand_val = -1 );
159 extern void cmeasure_select_next(object *objp);
160
161 #endif // _CMEASURE_H
162