2 * $Logfile: /Freespace2/code/CMeasure/CMeasure.h $
7 * Counter measures. Created by Mike Kulas, May 12, 1997.
10 * Revision 1.1 2002/05/03 03:28:11 root
14 * 3 11/05/98 5:55p Dave
15 * Big pass at reducing #includes
17 * 2 10/07/98 10:52a Dave
20 * 1 10/07/98 10:48a Dave
22 * 20 4/11/98 5:17p Jim
23 * Reduced countermeasure firing rate from 2 times per second to 3 times
26 * 19 4/10/98 11:02p Mike
27 * Make countermeasures less effective against aspect seekers than against
29 * Make AI ships match bank with each other when attacking a faraway
31 * Make ships not do silly loop-de-loop sometimes when attacking a faraway
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.
38 * 17 2/26/98 10:07p Hoffoss
39 * Rewrote state saving and restoring to fix bugs and simplify the code.
41 * 16 2/23/98 4:30p Mike
42 * Make homing missiles detonate after they pass up their target. Make
43 * countermeasures less effective.
45 * 15 2/09/98 8:04p Lawrance
46 * Add objnum to cmeasure struct, correctly set source_objnum
48 * 14 2/05/98 11:20p Lawrance
49 * save/restore countermeasure data
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.
55 * 12 1/16/98 11:43a Mike
56 * Fix countermeasures.
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
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
69 * 9 8/08/97 4:29p Allender
70 * countermeasure stuff for multiplayer
72 * 8 7/09/97 12:04a Mike
73 * Error prevention in matrix_interpolate().
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
80 * 6 5/22/97 5:45p Mike
81 * Better countermeasure firing, key off availability, specify in
84 * 5 5/15/97 5:05p Mike
85 * In the midst of changing subsystem targetnig from type-based to
87 * Also allowed you to view a target while dead.
89 * 4 5/14/97 4:08p Lawrance
90 * removing my_index from game arrays
92 * 3 5/14/97 10:50a Mike
93 * More countermeasure stuff.
95 * 2 5/12/97 5:58p Mike
96 * Add countermeasures.
98 * 1 5/12/97 2:23p Mike
109 #define MAX_CMEASURES 64
111 // Goes in cmeasure.subtype
112 #define CMEASURE_UNUSED -1
114 #define MAX_CMEASURE_TYPES 3
116 #define CMEASURE_WAIT 333 // delay in milliseconds between countermeasure firing.
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.
121 #define CMF_DUD (CMF_DUD_HEAT | CMF_DUD_ASPECT)
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
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
137 typedef struct cmeasure {
138 int flags; // You know, flag type things.
139 int subtype; // See CMEASURE_??? defines
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
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;
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);
161 #endif // _CMEASURE_H