2006-03-20 17:12:09 +00:00
|
|
|
/*
|
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Definitions for fueling centers.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FUELCEN_H
|
|
|
|
#define _FUELCEN_H
|
|
|
|
|
|
|
|
#include "segment.h"
|
|
|
|
#include "object.h"
|
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
//------------------------------------------------------------
|
|
|
|
// A refueling center is one segment... to identify it in the
|
|
|
|
// segment structure, the "special" field is set to
|
|
|
|
// SEGMENT_IS_FUELCEN. The "value" field is then used for how
|
|
|
|
// much fuel the center has left, with a maximum value of 100.
|
|
|
|
|
|
|
|
//-------------------------------------------------------------
|
|
|
|
// To hook into Inferno:
|
|
|
|
// * When all segents are deleted or before a new mine is created
|
|
|
|
// or loaded, call fuelcen_reset().
|
|
|
|
// * Add call to fuelcen_create(segment * segp) to make a segment
|
|
|
|
// which isn't a fuel center be a fuel center.
|
|
|
|
// * When a mine is loaded call fuelcen_activate(segp) with each
|
|
|
|
// new segment as it loads. Always do this.
|
|
|
|
// * When a segment is deleted, always call fuelcen_delete(segp).
|
|
|
|
// * Call fuelcen_replentish_all() to fill 'em all up, like when
|
|
|
|
// a new game is started.
|
|
|
|
// * When an object that needs to be refueled is in a segment, call
|
|
|
|
// fuelcen_give_fuel(segp) to get fuel. (Call once for any refueling
|
|
|
|
// object once per frame with the object's current segment.) This
|
|
|
|
// will return a value between 0 and 100 that tells how much fuel
|
|
|
|
// he got.
|
|
|
|
|
|
|
|
|
|
|
|
// Destroys all fuel centers, clears segment backpointer array.
|
|
|
|
void fuelcen_reset();
|
|
|
|
// Create materialization center
|
|
|
|
int create_matcen( segment * segp );
|
|
|
|
// Makes a segment a fuel center.
|
|
|
|
void fuelcen_create( segment * segp);
|
|
|
|
// Makes a fuel center active... needs to be called when
|
|
|
|
// a segment is loaded from disk.
|
|
|
|
void fuelcen_activate( segment * segp, int station_type );
|
|
|
|
// Deletes a segment as a fuel center.
|
|
|
|
void fuelcen_delete( segment * segp );
|
|
|
|
|
|
|
|
// Charges all fuel centers to max capacity.
|
|
|
|
void fuelcen_replentish_all();
|
|
|
|
|
|
|
|
// Create a matcen robot
|
2014-01-05 05:17:34 +00:00
|
|
|
objptridx_t create_morph_robot(segment *segp, vms_vector *object_pos, int object_id);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2010-07-27 11:41:43 +00:00
|
|
|
// Returns the amount of fuel/shields this segment can give up.
|
2006-03-20 17:12:09 +00:00
|
|
|
// Can be from 0 to 100.
|
|
|
|
fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake );
|
|
|
|
|
|
|
|
// Call once per frame.
|
|
|
|
void fuelcen_update_all();
|
|
|
|
|
|
|
|
// Called when hit by laser.
|
|
|
|
void fuelcen_damage(segment *segp, fix AmountOfDamage );
|
|
|
|
|
|
|
|
// Called to repair an object
|
|
|
|
//--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg );
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
#define MAX_NUM_FUELCENS 50
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
|
|
|
fix repaircen_give_shields(segment *segp, fix MaxAmountCanTake );
|
2006-03-20 17:12:09 +00:00
|
|
|
#define MAX_NUM_FUELCENS 70
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//--repair-- //do the repair center for this frame
|
|
|
|
//--repair-- void do_repair_sequence(object *obj);
|
|
|
|
//--repair--
|
|
|
|
//--repair-- //see if we should start the repair center
|
|
|
|
//--repair-- void check_start_repair_center(object *obj);
|
|
|
|
//--repair--
|
|
|
|
//--repair-- //if repairing, cut it short
|
|
|
|
//--repair-- abort_repair_center();
|
|
|
|
|
|
|
|
// An array of pointers to segments with fuel centers.
|
2013-12-22 22:03:07 +00:00
|
|
|
struct FuelCenter
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
int Type;
|
|
|
|
int segnum;
|
|
|
|
sbyte Flag;
|
|
|
|
sbyte Enabled;
|
|
|
|
sbyte Lives; // Number of times this can be enabled.
|
|
|
|
sbyte dum1;
|
|
|
|
fix Capacity;
|
|
|
|
fix MaxCapacity;
|
|
|
|
fix Timer; // used in matcen for when next robot comes out
|
|
|
|
fix Disable_time; // Time until center disabled.
|
2014-01-20 00:23:12 +00:00
|
|
|
fix __obsolete_pad_center[3];
|
2013-12-22 22:03:07 +00:00
|
|
|
} __pack__;
|
2014-01-20 00:23:12 +00:00
|
|
|
static_assert(sizeof(FuelCenter) == 40, "sizeof(FuelCenter) is wrong");
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// The max number of robot centers per mine.
|
|
|
|
#define MAX_ROBOT_CENTERS 20
|
|
|
|
|
|
|
|
extern int Num_robot_centers;
|
|
|
|
|
2013-12-22 22:03:07 +00:00
|
|
|
struct d1_matcen_info
|
|
|
|
{
|
2013-03-23 21:15:14 +00:00
|
|
|
int robot_flags[1]; // Up to 32 different robots
|
2006-03-20 17:12:09 +00:00
|
|
|
fix hit_points; // How hard it is to destroy this particular matcen
|
|
|
|
fix interval; // Interval between materialogrifizations
|
|
|
|
short segnum; // Segment this is attached to.
|
|
|
|
short fuelcen_num; // Index in fuelcen array.
|
2013-12-22 22:03:07 +00:00
|
|
|
} __pack__;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-21 23:16:19 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
typedef d1_matcen_info matcen_info;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-12-22 22:03:07 +00:00
|
|
|
struct matcen_info
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
int robot_flags[2]; // Up to 64 different robots
|
|
|
|
fix hit_points; // How hard it is to destroy this particular matcen
|
|
|
|
fix interval; // Interval between materialogrifizations
|
|
|
|
short segnum; // Segment this is attached to.
|
|
|
|
short fuelcen_num; // Index in fuelcen array.
|
2013-12-22 22:03:07 +00:00
|
|
|
} __pack__;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-21 23:16:19 +00:00
|
|
|
extern const char Special_names[MAX_CENTER_TYPES][11];
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
extern matcen_info RobotCenters[MAX_ROBOT_CENTERS];
|
2013-12-21 23:16:19 +00:00
|
|
|
extern FuelCenter Station[MAX_NUM_FUELCENS];
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//--repair-- extern object *RepairObj; // which object getting repaired, or NULL
|
|
|
|
|
|
|
|
// Called when a materialization center gets triggered by the player
|
|
|
|
// flying through some trigger!
|
|
|
|
extern void trigger_matcen(int segnum);
|
|
|
|
|
|
|
|
extern void disable_matcens(void);
|
|
|
|
|
|
|
|
extern int Num_fuelcenters;
|
|
|
|
|
|
|
|
extern void init_all_matcens(void);
|
|
|
|
|
2013-06-08 22:24:17 +00:00
|
|
|
extern const fix EnergyToCreateOneRobot;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-21 23:16:19 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
/*
|
|
|
|
* reads a matcen_info structure from a PHYSFS_file
|
|
|
|
*/
|
|
|
|
void matcen_info_read(matcen_info *ps, PHYSFS_file *fp, int version);
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
void fuelcen_check_for_hoard_goal(segment *segp);
|
|
|
|
|
|
|
|
/*
|
2013-03-23 21:31:49 +00:00
|
|
|
* reads an d1_matcen_info structure from a PHYSFS_file
|
2006-03-20 17:12:09 +00:00
|
|
|
*/
|
2013-03-23 21:31:49 +00:00
|
|
|
void d1_matcen_info_read(d1_matcen_info *mi, PHYSFS_file *fp);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
/*
|
2011-06-01 07:59:55 +00:00
|
|
|
* reads a matcen_info structure from a PHYSFS_file
|
2006-03-20 17:12:09 +00:00
|
|
|
*/
|
2011-06-01 07:59:55 +00:00
|
|
|
void matcen_info_read(matcen_info *ps, PHYSFS_file *fp);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2009-10-05 02:51:37 +00:00
|
|
|
/*
|
2011-06-01 07:59:55 +00:00
|
|
|
* reads n matcen_info structs from a PHYSFS_file and swaps if specified
|
2009-10-05 02:51:37 +00:00
|
|
|
*/
|
2011-06-01 07:59:55 +00:00
|
|
|
void matcen_info_read_n_swap(matcen_info *mi, int n, int swap, PHYSFS_file *fp);
|
2009-10-05 02:51:37 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
void matcen_info_write(matcen_info *mi, short version, PHYSFS_file *fp);
|
2013-12-21 23:16:19 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2009-10-05 02:51:37 +00:00
|
|
|
/*
|
2011-06-01 07:59:55 +00:00
|
|
|
* reads n Station structs from a PHYSFS_file and swaps if specified
|
2009-10-05 02:51:37 +00:00
|
|
|
*/
|
2011-06-01 07:59:55 +00:00
|
|
|
void fuelcen_read_n_swap(FuelCenter *fc, int n, int swap, PHYSFS_file *fp);
|
2009-10-05 02:51:37 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#endif
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
#endif
|