]> icculus.org git repositories - taylor/freespace2.git/blob - include/cmeasure.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / cmeasure.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/CMeasure/CMeasure.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Counter measures.  Created by Mike Kulas, May 12, 1997.
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:12  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:11  root
22  * Initial import.
23  *
24  * 
25  * 3     11/05/98 5:55p Dave
26  * Big pass at reducing #includes
27  * 
28  * 2     10/07/98 10:52a Dave
29  * Initial checkin.
30  * 
31  * 1     10/07/98 10:48a Dave
32  * 
33  * 20    4/11/98 5:17p Jim
34  * Reduced countermeasure firing rate from 2 times per second to 3 times
35  * per second.
36  * 
37  * 19    4/10/98 11:02p Mike
38  * Make countermeasures less effective against aspect seekers than against
39  * heat seekers.
40  * Make AI ships match bank with each other when attacking a faraway
41  * target.
42  * Make ships not do silly loop-de-loop sometimes when attacking a faraway
43  * target.
44  * 
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.
48  * 
49  * 17    2/26/98 10:07p Hoffoss
50  * Rewrote state saving and restoring to fix bugs and simplify the code.
51  * 
52  * 16    2/23/98 4:30p Mike
53  * Make homing missiles detonate after they pass up their target.  Make
54  * countermeasures less effective.
55  * 
56  * 15    2/09/98 8:04p Lawrance
57  * Add objnum to cmeasure struct, correctly set source_objnum
58  * 
59  * 14    2/05/98 11:20p Lawrance
60  * save/restore countermeasure data
61  * 
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.
65  * 
66  * 12    1/16/98 11:43a Mike
67  * Fix countermeasures.
68  * 
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
74  * 
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
78  * for multiplayer
79  * 
80  * 9     8/08/97 4:29p Allender
81  * countermeasure stuff for multiplayer
82  * 
83  * 8     7/09/97 12:04a Mike
84  * Error prevention in matrix_interpolate().
85  * 
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
89  * client/host.  
90  * 
91  * 6     5/22/97 5:45p Mike
92  * Better countermeasure firing, key off availability, specify in
93  * weapons.tbl
94  * 
95  * 5     5/15/97 5:05p Mike
96  * In the midst of changing subsystem targetnig from type-based to
97  * pointer-based.
98  * Also allowed you to view a target while dead.
99  * 
100  * 4     5/14/97 4:08p Lawrance
101  * removing my_index from game arrays
102  * 
103  * 3     5/14/97 10:50a Mike
104  * More countermeasure stuff.
105  * 
106  * 2     5/12/97 5:58p Mike
107  * Add countermeasures.
108  * 
109  * 1     5/12/97 2:23p Mike
110  *
111  * $NoKeywords: $
112  */
113
114 #ifndef _CMEASURE_H
115 #define _CMEASURE_H
116
117 #include "parselo.h"
118 #include "object.h"
119
120 #define MAX_CMEASURES 64
121
122 //      Goes in cmeasure.subtype
123 #define CMEASURE_UNUSED                 -1
124
125 #define MAX_CMEASURE_TYPES              3
126
127 #define CMEASURE_WAIT                           333                     //      delay in milliseconds between countermeasure firing.
128
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.
131
132 #define CMF_DUD (CMF_DUD_HEAT | CMF_DUD_ASPECT)
133
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
137
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
146 } cmeasure_info;
147
148 typedef struct cmeasure {
149         int             flags;                          //      You know, flag type things.
150         int             subtype;                                // See CMEASURE_??? defines
151         int             objnum;
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
156 } cmeasure;
157
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;
163
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);
171
172 #endif // _CMEASURE_H
173