home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / fuelcen.h < prev    next >
Text File  |  1998-06-08  |  8KB  |  254 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/fuelcen.h $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:28:43 $
  18.  * 
  19.  * Definitions for fueling centers.
  20.  * 
  21.  * $Log: fuelcen.h $
  22.  * Revision 2.0  1995/02/27  11:28:43  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.26  1995/01/26  12:19:16  rob
  27.  * Added externs of things needed for multiplayer.
  28.  * 
  29.  * Revision 1.25  1994/10/30  14:11:10  mike
  30.  * rip out repair center stuff.
  31.  * 
  32.  * Revision 1.24  1994/10/03  23:36:36  mike
  33.  * Add segnum and fuelcen_num (renaming dest_seg and *path) in matcen_info struct.
  34.  * 
  35.  * Revision 1.23  1994/09/30  00:37:44  mike
  36.  * Change FuelCenter struct.
  37.  * 
  38.  * Revision 1.22  1994/09/27  15:42:49  mike
  39.  * Kill some obsolete matcen constants, Prototype Special_names.
  40.  * 
  41.  * Revision 1.21  1994/09/27  00:04:30  mike
  42.  * Moved FuelCenter struct here from fuelcen.c
  43.  * 
  44.  * Revision 1.20  1994/09/25  15:55:37  mike
  45.  * Prototype function disable_matcens.
  46.  * 
  47.  * Revision 1.19  1994/09/24  17:41:34  mike
  48.  * Prototype trigger_matcen.
  49.  * 
  50.  * Revision 1.18  1994/08/03  17:52:19  matt
  51.  * Tidied up repair centers a bit
  52.  * 
  53.  * Revision 1.17  1994/08/02  12:16:01  mike
  54.  * *** empty log message ***
  55.  * 
  56.  * Revision 1.16  1994/08/01  11:04:03  yuan
  57.  * New materialization centers.
  58.  * 
  59.  * Revision 1.15  1994/07/21  19:02:15  mike
  60.  * break repair centers.
  61.  * 
  62.  * Revision 1.14  1994/07/14  11:25:22  john
  63.  * Made control centers destroy better; made automap use Tab key.
  64.  * 
  65.  * Revision 1.13  1994/07/13  10:45:33  john
  66.  * Made control center object switch when dead.
  67.  * 
  68.  * Revision 1.12  1994/07/09  17:36:44  mike
  69.  * Add extern for find_connected_repair_seg.
  70.  * 
  71.  * Revision 1.11  1994/06/15  19:00:32  john
  72.  * Show timer in on top of 3d with mine destroyed...
  73.  * 
  74.  * Revision 1.10  1994/05/31  16:49:46  john
  75.  * Begin to add robot materialization centers.
  76.  * 
  77.  * Revision 1.9  1994/05/30  20:22:03  yuan
  78.  * New triggers.
  79.  * 
  80.  * Revision 1.8  1994/05/05  16:41:14  matt
  81.  * Cleaned up repair center code, and moved some from object.c to fuelcen.c
  82.  * 
  83.  * Revision 1.7  1994/04/21  20:41:21  yuan
  84.  * Added extern.
  85.  * 
  86.  * Revision 1.6  1994/04/21  20:28:32  john
  87.  * Added flag for Yuan to tell when a fuel center is destroyed.
  88.  * 
  89.  * Revision 1.5  1994/04/14  17:00:59  john
  90.  * Made repair cen's work properly; added reset_all_fuelcens.
  91.  * 
  92.  * Revision 1.4  1994/04/12  20:28:04  john
  93.  * Added control center.
  94.  * 
  95.  * Revision 1.3  1994/04/08  15:37:10  john
  96.  * Added repair centers.
  97.  * 
  98.  * Revision 1.2  1994/04/06  19:10:38  john
  99.  * NEw version.
  100.  * 
  101.  * 
  102.  * Revision 1.1  1994/04/06  12:39:02  john
  103.  * Initial revision
  104.  * 
  105.  * 
  106.  */
  107.  
  108. #ifndef _FUELCEN_H
  109. #define _FUELCEN_H
  110.  
  111. #include "segment.h"
  112. #include "object.h"
  113. #include "switch.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 this segment can give up.
  158. // Can be from 0 to 100.
  159. fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake );
  160.  
  161. // Call once per frame.
  162. void fuelcen_update_all();
  163.  
  164. // Called when hit by laser.
  165. void fuelcen_damage(segment *segp, fix AmountOfDamage );
  166.  
  167. // Called to repair an object
  168. //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg );
  169.  
  170. #define MAX_NUM_FUELCENS    50
  171.  
  172. #define SEGMENT_IS_NOTHING            0
  173. #define SEGMENT_IS_FUELCEN            1
  174. #define SEGMENT_IS_REPAIRCEN        2
  175. #define SEGMENT_IS_CONTROLCEN        3
  176. #define SEGMENT_IS_ROBOTMAKER        4
  177. #define MAX_CENTER_TYPES            5
  178.  
  179. extern char Special_names[MAX_CENTER_TYPES][11];
  180.  
  181. // Set to 1 after control center is destroyed.
  182. // Clear by calling fuelcen_reset();
  183. extern int Fuelcen_control_center_destroyed;
  184. extern int Fuelcen_seconds_left;        
  185.  
  186. //--repair-- //do the repair center for this frame
  187. //--repair-- void do_repair_sequence(object *obj);
  188. //--repair-- 
  189. //--repair-- //see if we should start the repair center
  190. //--repair-- void check_start_repair_center(object *obj);
  191. //--repair-- 
  192. //--repair-- //if repairing, cut it short
  193. //--repair-- abort_repair_center();
  194.  
  195. typedef struct control_center_triggers {
  196.     short        num_links;
  197.     short     seg[MAX_WALLS_PER_LINK];
  198.     short        side[MAX_WALLS_PER_LINK];
  199. } control_center_triggers;
  200.  
  201. // An array of pointers to segments with fuel centers.
  202. typedef struct FuelCenter {
  203.     int            Type;
  204.     int            segnum;
  205.     byte            Flag;
  206.     byte            Enabled;
  207.     byte            Lives;            //    Number of times this can be enabled.
  208.     byte            dum1;
  209.     fix             Capacity;
  210.     fix            MaxCapacity;
  211.     fix            Timer;
  212.     fix            Disable_time;        //    Time until center disabled.
  213. //    object *        last_created_obj;
  214. //    int             last_created_sig;
  215.     vms_vector    Center;
  216. } FuelCenter;
  217.  
  218. extern control_center_triggers ControlCenterTriggers;
  219.  
  220. // The max number of robot centers per mine.
  221. #define MAX_ROBOT_CENTERS  20    
  222.  
  223. extern int Num_robot_centers;
  224.  
  225. typedef struct matcen_info {
  226.     int            robot_flags;        // Up to 32 different robots
  227.     fix            hit_points;            // How hard it is to destroy this particular matcen
  228.     fix            interval;            // Interval between materialogrifizations
  229.     short            segnum;                // Segment this is attached to.
  230.     short            fuelcen_num;        // Index in fuelcen array.
  231. } matcen_info;
  232.  
  233. extern matcen_info RobotCenters[MAX_ROBOT_CENTERS];
  234.  
  235. extern int Fuelcen_control_center_dead_modelnum;
  236. extern fix Fuelcen_control_center_strength;
  237.  
  238. //--repair-- extern object *RepairObj;            //which object getting repaired, or NULL
  239.  
  240. //    Called when a materialization center gets triggered by the player flying through some trigger!
  241. extern void trigger_matcen(int segnum);
  242.  
  243. extern void disable_matcens(void);
  244.  
  245. extern FuelCenter Station[MAX_NUM_FUELCENS];
  246. extern int Num_fuelcenters;
  247.  
  248. extern void init_all_matcens(void);
  249.  
  250. extern fix EnergyToCreateOneRobot;
  251.  
  252. #endif
  253. 
  254.