2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Header for cntrlcen.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-19 04:18:51 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-04-19 04:18:51 +00:00
|
|
|
#include <physfs.h>
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#ifdef __cplusplus
|
2015-10-10 03:44:14 +00:00
|
|
|
#include "fwd-object.h"
|
2014-06-21 23:55:24 +00:00
|
|
|
#include "pack.h"
|
2013-12-29 04:28:07 +00:00
|
|
|
#include "segnum.h"
|
2012-11-11 22:12:51 +00:00
|
|
|
|
2015-02-28 19:36:01 +00:00
|
|
|
#include "fwd-partial_range.h"
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
#define MAX_CONTROLCEN_LINKS 10
|
|
|
|
|
2014-06-21 23:55:24 +00:00
|
|
|
struct control_center_triggers : public prohibit_void_ptr<control_center_triggers>
|
2013-12-22 22:03:07 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
short num_links;
|
2013-12-29 04:28:07 +00:00
|
|
|
array<segnum_t, MAX_CONTROLCEN_LINKS> seg;
|
2014-01-18 18:02:02 +00:00
|
|
|
array<short, MAX_CONTROLCEN_LINKS> side;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
extern control_center_triggers ControlCenterTriggers;
|
|
|
|
|
2016-01-09 16:38:15 +00:00
|
|
|
#ifdef dsx
|
2015-04-19 04:18:51 +00:00
|
|
|
#include "vecmat.h"
|
2013-12-22 22:03:07 +00:00
|
|
|
struct reactor {
|
2013-04-20 23:56:13 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
int model_num;
|
2013-04-20 23:56:13 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
int n_guns;
|
2013-03-23 19:09:44 +00:00
|
|
|
/* Location of the gun on the reactor model */
|
2014-11-01 03:08:27 +00:00
|
|
|
array<vms_vector, MAX_CONTROLCEN_GUNS> gun_points;
|
2013-03-23 19:09:44 +00:00
|
|
|
/* Orientation of the gun on the reactor model */
|
2014-11-01 03:08:27 +00:00
|
|
|
array<vms_vector, MAX_CONTROLCEN_GUNS> gun_dirs;
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-11-01 03:08:27 +00:00
|
|
|
// fills in arrays gun_points & gun_dirs, returns the number of guns read
|
2015-07-25 23:10:48 +00:00
|
|
|
void read_model_guns(const char *filename, reactor &);
|
2014-11-01 03:08:27 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2016-12-10 17:51:08 +00:00
|
|
|
constexpr unsigned MAX_REACTORS = 1;
|
2016-07-23 04:10:42 +00:00
|
|
|
constexpr unsigned Num_reactors = 1;
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2016-12-10 17:51:08 +00:00
|
|
|
constexpr unsigned MAX_REACTORS = 7;
|
2013-03-03 01:03:33 +00:00
|
|
|
#define DEFAULT_CONTROL_CENTER_EXPLOSION_TIME 30 // Note: Usually uses Alan_pavlish_reactor_times, but can be overridden in editor.
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-02-28 19:36:01 +00:00
|
|
|
extern unsigned Num_reactors;
|
2013-03-03 01:03:33 +00:00
|
|
|
extern int Base_control_center_explosion_time; // how long to blow up on insane
|
|
|
|
extern int Reactor_strength;
|
|
|
|
|
|
|
|
/*
|
2016-01-09 16:38:14 +00:00
|
|
|
* reads n reactor structs from a PHYSFS_File
|
2013-03-03 01:03:33 +00:00
|
|
|
*/
|
2016-01-09 16:38:14 +00:00
|
|
|
void reactor_read_n(PHYSFS_File *fp, partial_range_t<reactor *> r);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-02-28 19:36:01 +00:00
|
|
|
extern array<reactor, MAX_REACTORS> Reactors;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-03-23 20:03:11 +00:00
|
|
|
static inline int get_reactor_model_number(int id)
|
|
|
|
{
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
return id;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-03-23 20:03:11 +00:00
|
|
|
return Reactors[id].model_num;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-03-23 20:03:11 +00:00
|
|
|
}
|
|
|
|
|
2015-08-26 03:15:10 +00:00
|
|
|
static inline reactor &get_reactor_definition(int id)
|
2013-03-31 15:04:41 +00:00
|
|
|
{
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
(void)id;
|
2015-08-26 03:15:10 +00:00
|
|
|
return Reactors[0];
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2015-08-26 03:15:10 +00:00
|
|
|
return Reactors[id];
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-03-31 15:04:41 +00:00
|
|
|
}
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2013-03-31 15:04:41 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2006-03-20 17:12:09 +00:00
|
|
|
//@@extern int N_controlcen_guns;
|
|
|
|
extern int Control_center_been_hit;
|
|
|
|
extern int Control_center_player_been_seen;
|
|
|
|
extern int Control_center_next_fire_time;
|
|
|
|
extern int Control_center_present;
|
2013-12-29 04:28:07 +00:00
|
|
|
extern objnum_t Dead_controlcen_object_num;
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2006-03-20 17:12:09 +00:00
|
|
|
// do whatever this thing does in a frame
|
2014-08-16 23:18:17 +00:00
|
|
|
void do_controlcen_frame(vobjptridx_t obj);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// Initialize control center for a level.
|
|
|
|
// Call when a new level is started.
|
2015-12-22 04:18:50 +00:00
|
|
|
void init_controlcen_for_level();
|
2016-04-23 17:59:47 +00:00
|
|
|
void calc_controlcen_gun_point(object &obj);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-01-11 22:52:00 +00:00
|
|
|
void do_controlcen_destroyed_stuff(objptridx_t objp);
|
2015-12-22 04:18:50 +00:00
|
|
|
void do_controlcen_dead_frame();
|
|
|
|
}
|
2015-11-26 02:56:55 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2006-03-20 17:12:09 +00:00
|
|
|
extern fix Countdown_timer;
|
2011-03-28 22:35:41 +00:00
|
|
|
extern int Control_center_destroyed, Countdown_seconds_left, Total_countdown_time;
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2009-10-05 02:51:37 +00:00
|
|
|
/*
|
2016-01-09 16:38:14 +00:00
|
|
|
* reads n control_center_triggers structs from a PHYSFS_File
|
2009-10-05 02:51:37 +00:00
|
|
|
*/
|
2016-01-09 16:38:14 +00:00
|
|
|
void control_center_triggers_read(control_center_triggers *cct, PHYSFS_File *fp);
|
|
|
|
void control_center_triggers_write(const control_center_triggers *cct, PHYSFS_File *fp);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-11-11 22:12:51 +00:00
|
|
|
#endif
|