FUELCEN.H 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. #ifndef _FUELCEN_H
  108. #define _FUELCEN_H
  109. #include "segment.h"
  110. #include "object.h"
  111. #include "switch.h"
  112. //------------------------------------------------------------
  113. // A refueling center is one segment... to identify it in the
  114. // segment structure, the "special" field is set to
  115. // SEGMENT_IS_FUELCEN. The "value" field is then used for how
  116. // much fuel the center has left, with a maximum value of 100.
  117. //-------------------------------------------------------------
  118. // To hook into Inferno:
  119. // * When all segents are deleted or before a new mine is created
  120. // or loaded, call fuelcen_reset().
  121. // * Add call to fuelcen_create(segment * segp) to make a segment
  122. // which isn't a fuel center be a fuel center.
  123. // * When a mine is loaded call fuelcen_activate(segp) with each
  124. // new segment as it loads. Always do this.
  125. // * When a segment is deleted, always call fuelcen_delete(segp).
  126. // * Call fuelcen_replentish_all() to fill 'em all up, like when
  127. // a new game is started.
  128. // * When an object that needs to be refueled is in a segment, call
  129. // fuelcen_give_fuel(segp) to get fuel. (Call once for any refueling
  130. // object once per frame with the object's current segment.) This
  131. // will return a value between 0 and 100 that tells how much fuel
  132. // he got.
  133. // Destroys all fuel centers, clears segment backpointer array.
  134. void fuelcen_reset();
  135. // Create materialization center
  136. int create_matcen( segment * segp );
  137. // Makes a segment a fuel center.
  138. void fuelcen_create( segment * segp);
  139. // Makes a fuel center active... needs to be called when
  140. // a segment is loaded from disk.
  141. void fuelcen_activate( segment * segp, int station_type );
  142. // Deletes a segment as a fuel center.
  143. void fuelcen_delete( segment * segp );
  144. // Charges all fuel centers to max capacity.
  145. void fuelcen_replentish_all();
  146. // Create a matcen robot
  147. extern object *create_morph_robot(segment *segp, vms_vector *object_pos, int object_id);
  148. // Returns the amount of fuel this segment can give up.
  149. // Can be from 0 to 100.
  150. fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake );
  151. // Call once per frame.
  152. void fuelcen_update_all();
  153. // Called when hit by laser.
  154. void fuelcen_damage(segment *segp, fix AmountOfDamage );
  155. // Called to repair an object
  156. //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg );
  157. #define MAX_NUM_FUELCENS 50
  158. #define SEGMENT_IS_NOTHING 0
  159. #define SEGMENT_IS_FUELCEN 1
  160. #define SEGMENT_IS_REPAIRCEN 2
  161. #define SEGMENT_IS_CONTROLCEN 3
  162. #define SEGMENT_IS_ROBOTMAKER 4
  163. #define MAX_CENTER_TYPES 5
  164. extern char Special_names[MAX_CENTER_TYPES][11];
  165. // Set to 1 after control center is destroyed.
  166. // Clear by calling fuelcen_reset();
  167. extern int Fuelcen_control_center_destroyed;
  168. extern int Fuelcen_seconds_left;
  169. //--repair-- //do the repair center for this frame
  170. //--repair-- void do_repair_sequence(object *obj);
  171. //--repair--
  172. //--repair-- //see if we should start the repair center
  173. //--repair-- void check_start_repair_center(object *obj);
  174. //--repair--
  175. //--repair-- //if repairing, cut it short
  176. //--repair-- abort_repair_center();
  177. typedef struct control_center_triggers {
  178. short num_links;
  179. short seg[MAX_WALLS_PER_LINK];
  180. short side[MAX_WALLS_PER_LINK];
  181. } control_center_triggers;
  182. // An array of pointers to segments with fuel centers.
  183. typedef struct FuelCenter {
  184. int Type;
  185. int segnum;
  186. byte Flag;
  187. byte Enabled;
  188. byte Lives; // Number of times this can be enabled.
  189. byte dum1;
  190. fix Capacity;
  191. fix MaxCapacity;
  192. fix Timer;
  193. fix Disable_time; // Time until center disabled.
  194. // object * last_created_obj;
  195. // int last_created_sig;
  196. vms_vector Center;
  197. } FuelCenter;
  198. extern control_center_triggers ControlCenterTriggers;
  199. // The max number of robot centers per mine.
  200. #define MAX_ROBOT_CENTERS 20
  201. extern int Num_robot_centers;
  202. typedef struct matcen_info {
  203. int robot_flags; // Up to 32 different robots
  204. fix hit_points; // How hard it is to destroy this particular matcen
  205. fix interval; // Interval between materialogrifizations
  206. short segnum; // Segment this is attached to.
  207. short fuelcen_num; // Index in fuelcen array.
  208. } matcen_info;
  209. extern matcen_info RobotCenters[MAX_ROBOT_CENTERS];
  210. extern int Fuelcen_control_center_dead_modelnum;
  211. extern fix Fuelcen_control_center_strength;
  212. //--repair-- extern object *RepairObj; //which object getting repaired, or NULL
  213. // Called when a materialization center gets triggered by the player flying through some trigger!
  214. extern void trigger_matcen(int segnum);
  215. extern void disable_matcens(void);
  216. extern FuelCenter Station[MAX_NUM_FUELCENS];
  217. extern int Num_fuelcenters;
  218. extern void init_all_matcens(void);
  219. extern fix EnergyToCreateOneRobot;
  220. #endif
  221.