]> icculus.org git repositories - btb/d2x.git/blob - main/fuelcen.h
opengl hardware super-transparency support using GL_NV_register_combiners (d1x r1...
[btb/d2x.git] / main / fuelcen.h
1 /* $Id: fuelcen.h,v 1.7 2004-05-15 17:24:17 schaffner Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Definitions for fueling centers.
18  *
19  * Old Log:
20  * Revision 1.1  1995/05/16  15:56:31  allender
21  * Initial revision
22  *
23  * Revision 2.0  1995/02/27  11:28:43  john
24  * New version 2.0, which has no anonymous unions, builds with
25  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
26  *
27  * Revision 1.26  1995/01/26  12:19:16  rob
28  * Added externs of things needed for multiplayer.
29  *
30  * Revision 1.25  1994/10/30  14:11:10  mike
31  * rip out repair center stuff.
32  *
33  * Revision 1.24  1994/10/03  23:36:36  mike
34  * Add segnum and fuelcen_num (renaming dest_seg and *path) in matcen_info struct.
35  *
36  * Revision 1.23  1994/09/30  00:37:44  mike
37  * Change FuelCenter struct.
38  *
39  * Revision 1.22  1994/09/27  15:42:49  mike
40  * Kill some obsolete matcen constants, Prototype Special_names.
41  *
42  * Revision 1.21  1994/09/27  00:04:30  mike
43  * Moved FuelCenter struct here from fuelcen.c
44  *
45  * Revision 1.20  1994/09/25  15:55:37  mike
46  * Prototype function disable_matcens.
47  *
48  * Revision 1.19  1994/09/24  17:41:34  mike
49  * Prototype trigger_matcen.
50  *
51  * Revision 1.18  1994/08/03  17:52:19  matt
52  * Tidied up repair centers a bit
53  *
54  * Revision 1.17  1994/08/02  12:16:01  mike
55  * *** empty log message ***
56  *
57  * Revision 1.16  1994/08/01  11:04:03  yuan
58  * New materialization centers.
59  *
60  * Revision 1.15  1994/07/21  19:02:15  mike
61  * break repair centers.
62  *
63  * Revision 1.14  1994/07/14  11:25:22  john
64  * Made control centers destroy better; made automap use Tab key.
65  *
66  * Revision 1.13  1994/07/13  10:45:33  john
67  * Made control center object switch when dead.
68  *
69  * Revision 1.12  1994/07/09  17:36:44  mike
70  * Add extern for find_connected_repair_seg.
71  *
72  * Revision 1.11  1994/06/15  19:00:32  john
73  * Show timer in on top of 3d with mine destroyed...
74  *
75  * Revision 1.10  1994/05/31  16:49:46  john
76  * Begin to add robot materialization centers.
77  *
78  * Revision 1.9  1994/05/30  20:22:03  yuan
79  * New triggers.
80  *
81  * Revision 1.8  1994/05/05  16:41:14  matt
82  * Cleaned up repair center code, and moved some from object.c to fuelcen.c
83  *
84  * Revision 1.7  1994/04/21  20:41:21  yuan
85  * Added extern.
86  *
87  * Revision 1.6  1994/04/21  20:28:32  john
88  * Added flag for Yuan to tell when a fuel center is destroyed.
89  *
90  * Revision 1.5  1994/04/14  17:00:59  john
91  * Made repair cen's work properly; added reset_all_fuelcens.
92  *
93  * Revision 1.4  1994/04/12  20:28:04  john
94  * Added control center.
95  *
96  * Revision 1.3  1994/04/08  15:37:10  john
97  * Added repair centers.
98  *
99  * Revision 1.2  1994/04/06  19:10:38  john
100  * NEw version.
101  *
102  *
103  * Revision 1.1  1994/04/06  12:39:02  john
104  * Initial revision
105  *
106  *
107  */
108
109 #ifndef _FUELCEN_H
110 #define _FUELCEN_H
111
112 #include "segment.h"
113 #include "object.h"
114
115 //------------------------------------------------------------
116 // A refueling center is one segment... to identify it in the
117 // segment structure, the "special" field is set to
118 // SEGMENT_IS_FUELCEN.  The "value" field is then used for how
119 // much fuel the center has left, with a maximum value of 100.
120
121 //-------------------------------------------------------------
122 // To hook into Inferno:
123 // * When all segents are deleted or before a new mine is created
124 //   or loaded, call fuelcen_reset().
125 // * Add call to fuelcen_create(segment * segp) to make a segment
126 //   which isn't a fuel center be a fuel center.
127 // * When a mine is loaded call fuelcen_activate(segp) with each
128 //   new segment as it loads. Always do this.
129 // * When a segment is deleted, always call fuelcen_delete(segp).
130 // * Call fuelcen_replentish_all() to fill 'em all up, like when
131 //   a new game is started.
132 // * When an object that needs to be refueled is in a segment, call
133 //   fuelcen_give_fuel(segp) to get fuel. (Call once for any refueling
134 //   object once per frame with the object's current segment.) This
135 //   will return a value between 0 and 100 that tells how much fuel
136 //   he got.
137
138
139 // Destroys all fuel centers, clears segment backpointer array.
140 void fuelcen_reset();
141 // Create materialization center
142 int create_matcen( segment * segp );
143 // Makes a segment a fuel center.
144 void fuelcen_create( segment * segp);
145 // Makes a fuel center active... needs to be called when
146 // a segment is loaded from disk.
147 void fuelcen_activate( segment * segp, int station_type );
148 // Deletes a segment as a fuel center.
149 void fuelcen_delete( segment * segp );
150
151 // Charges all fuel centers to max capacity.
152 void fuelcen_replentish_all();
153
154 // Create a matcen robot
155 extern object *create_morph_robot(segment *segp, vms_vector *object_pos, int object_id);
156
157 // Returns the amount of fuel/shield this segment can give up.
158 // Can be from 0 to 100.
159 fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake );
160 fix repaircen_give_shields(segment *segp, fix MaxAmountCanTake );
161
162 // Call once per frame.
163 void fuelcen_update_all();
164
165 // Called when hit by laser.
166 void fuelcen_damage(segment *segp, fix AmountOfDamage );
167
168 // Called to repair an object
169 //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg );
170
171 #define MAX_NUM_FUELCENS    70
172
173 extern char Special_names[MAX_CENTER_TYPES][11];
174
175 //--repair-- //do the repair center for this frame
176 //--repair-- void do_repair_sequence(object *obj);
177 //--repair--
178 //--repair-- //see if we should start the repair center
179 //--repair-- void check_start_repair_center(object *obj);
180 //--repair--
181 //--repair-- //if repairing, cut it short
182 //--repair-- abort_repair_center();
183
184 // An array of pointers to segments with fuel centers.
185 typedef struct FuelCenter {
186         int     Type;
187         int     segnum;
188         sbyte   Flag;
189         sbyte   Enabled;
190         sbyte   Lives;          // Number of times this can be enabled.
191         sbyte   dum1;
192         fix     Capacity;
193         fix     MaxCapacity;
194         fix     Timer;          // used in matcen for when next robot comes out
195         fix     Disable_time;   // Time until center disabled.
196         //object  *last_created_obj;
197         //int     last_created_sig;
198         vms_vector Center;
199 } __pack__ FuelCenter;
200
201 // The max number of robot centers per mine.
202 #define MAX_ROBOT_CENTERS  20
203
204 extern int Num_robot_centers;
205
206 typedef struct  {
207         int     robot_flags;    // Up to 32 different robots
208         fix     hit_points;     // How hard it is to destroy this particular matcen
209         fix     interval;       // Interval between materialogrifizations
210         short   segnum;         // Segment this is attached to.
211         short   fuelcen_num;    // Index in fuelcen array.
212 } __pack__ old_matcen_info;
213
214 typedef struct matcen_info {
215         int     robot_flags[2]; // Up to 64 different robots
216         fix     hit_points;     // How hard it is to destroy this particular matcen
217         fix     interval;       // Interval between materialogrifizations
218         short   segnum;         // Segment this is attached to.
219         short   fuelcen_num;    // Index in fuelcen array.
220 } __pack__ matcen_info;
221
222 extern matcen_info RobotCenters[MAX_ROBOT_CENTERS];
223
224 //--repair-- extern object *RepairObj;  // which object getting repaired, or NULL
225
226 // Called when a materialization center gets triggered by the player
227 // flying through some trigger!
228 extern void trigger_matcen(int segnum);
229
230 extern void disable_matcens(void);
231
232 extern FuelCenter Station[MAX_NUM_FUELCENS];
233 extern int Num_fuelcenters;
234
235 extern void init_all_matcens(void);
236
237 extern fix EnergyToCreateOneRobot;
238
239 void fuelcen_check_for_hoard_goal(segment *segp);
240
241 #ifdef FAST_FILE_IO
242 #define old_matcen_info_read(mi, fp) cfread(mi, sizeof(old_matcen_info), 1, fp)
243 #define matcen_info_read(mi, fp) cfread(mi, sizeof(matcen_info), 1, fp)
244 #else
245 /*
246  * reads an old_matcen_info structure from a CFILE
247  */
248 void old_matcen_info_read(old_matcen_info *mi, CFILE *fp);
249
250 /*
251  * reads a matcen_info structure from a CFILE
252  */
253 void matcen_info_read(matcen_info *ps, CFILE *fp);
254 #endif
255
256 #endif