1 /* $Id: fuelcen.h,v 1.8 2004-08-28 23:17:45 schaffner Exp $ */
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.
17 * Definitions for fueling centers.
27 //------------------------------------------------------------
28 // A refueling center is one segment... to identify it in the
29 // segment structure, the "special" field is set to
30 // SEGMENT_IS_FUELCEN. The "value" field is then used for how
31 // much fuel the center has left, with a maximum value of 100.
33 //-------------------------------------------------------------
34 // To hook into Inferno:
35 // * When all segents are deleted or before a new mine is created
36 // or loaded, call fuelcen_reset().
37 // * Add call to fuelcen_create(segment * segp) to make a segment
38 // which isn't a fuel center be a fuel center.
39 // * When a mine is loaded call fuelcen_activate(segp) with each
40 // new segment as it loads. Always do this.
41 // * When a segment is deleted, always call fuelcen_delete(segp).
42 // * Call fuelcen_replentish_all() to fill 'em all up, like when
43 // a new game is started.
44 // * When an object that needs to be refueled is in a segment, call
45 // fuelcen_give_fuel(segp) to get fuel. (Call once for any refueling
46 // object once per frame with the object's current segment.) This
47 // will return a value between 0 and 100 that tells how much fuel
51 // Destroys all fuel centers, clears segment backpointer array.
53 // Create materialization center
54 int create_matcen( segment * segp );
55 // Makes a segment a fuel center.
56 void fuelcen_create( segment * segp);
57 // Makes a fuel center active... needs to be called when
58 // a segment is loaded from disk.
59 void fuelcen_activate( segment * segp, int station_type );
60 // Deletes a segment as a fuel center.
61 void fuelcen_delete( segment * segp );
63 // Charges all fuel centers to max capacity.
64 void fuelcen_replentish_all();
66 // Create a matcen robot
67 extern object *create_morph_robot(segment *segp, vms_vector *object_pos, int object_id);
69 // Returns the amount of fuel/shield this segment can give up.
70 // Can be from 0 to 100.
71 fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake );
72 fix repaircen_give_shields(segment *segp, fix MaxAmountCanTake );
74 // Call once per frame.
75 void fuelcen_update_all();
77 // Called when hit by laser.
78 void fuelcen_damage(segment *segp, fix AmountOfDamage );
80 // Called to repair an object
81 //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg );
83 #define MAX_NUM_FUELCENS 70
85 extern char Special_names[MAX_CENTER_TYPES][11];
87 //--repair-- //do the repair center for this frame
88 //--repair-- void do_repair_sequence(object *obj);
90 //--repair-- //see if we should start the repair center
91 //--repair-- void check_start_repair_center(object *obj);
93 //--repair-- //if repairing, cut it short
94 //--repair-- abort_repair_center();
96 // An array of pointers to segments with fuel centers.
97 typedef struct FuelCenter {
102 sbyte Lives; // Number of times this can be enabled.
106 fix Timer; // used in matcen for when next robot comes out
107 fix Disable_time; // Time until center disabled.
108 //object *last_created_obj;
109 //int last_created_sig;
111 } __pack__ FuelCenter;
113 // The max number of robot centers per mine.
114 #define MAX_ROBOT_CENTERS 20
116 extern int Num_robot_centers;
119 int robot_flags; // Up to 32 different robots
120 fix hit_points; // How hard it is to destroy this particular matcen
121 fix interval; // Interval between materialogrifizations
122 short segnum; // Segment this is attached to.
123 short fuelcen_num; // Index in fuelcen array.
124 } __pack__ old_matcen_info;
126 typedef struct matcen_info {
127 int robot_flags[2]; // Up to 64 different robots
128 fix hit_points; // How hard it is to destroy this particular matcen
129 fix interval; // Interval between materialogrifizations
130 short segnum; // Segment this is attached to.
131 short fuelcen_num; // Index in fuelcen array.
132 } __pack__ matcen_info;
134 extern matcen_info RobotCenters[MAX_ROBOT_CENTERS];
136 //--repair-- extern object *RepairObj; // which object getting repaired, or NULL
138 // Called when a materialization center gets triggered by the player
139 // flying through some trigger!
140 extern void trigger_matcen(int segnum);
142 extern void disable_matcens(void);
144 extern FuelCenter Station[MAX_NUM_FUELCENS];
145 extern int Num_fuelcenters;
147 extern void init_all_matcens(void);
149 extern fix EnergyToCreateOneRobot;
151 void fuelcen_check_for_hoard_goal(segment *segp);
154 #define old_matcen_info_read(mi, fp) cfread(mi, sizeof(old_matcen_info), 1, fp)
155 #define matcen_info_read(mi, fp) cfread(mi, sizeof(matcen_info), 1, fp)
158 * reads an old_matcen_info structure from a CFILE
160 void old_matcen_info_read(old_matcen_info *mi, CFILE *fp);
163 * reads a matcen_info structure from a CFILE
165 void matcen_info_read(matcen_info *ps, CFILE *fp);