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