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
|
2014-11-23 04:36:58 +00:00
|
|
|
#include "fwdobject.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;
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
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
|
|
|
|
int read_model_guns(const char *filename,array<vms_vector, MAX_CONTROLCEN_GUNS> &gun_points, array<vms_vector, MAX_CONTROLCEN_GUNS> &gun_dirs);
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
#define MAX_REACTORS 1
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
#define 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;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* reads n reactor structs from a PHYSFS_file
|
|
|
|
*/
|
2015-02-28 19:36:01 +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_num_reactor_models()
|
|
|
|
{
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
return 1;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-03-23 20:03:11 +00:00
|
|
|
return Num_reactors;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
|
2013-03-31 15:04:41 +00:00
|
|
|
static inline reactor *get_reactor_definition(int id)
|
|
|
|
{
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
(void)id;
|
|
|
|
return &Reactors[0];
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-03-31 15:04:41 +00:00
|
|
|
return &Reactors[id];
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-03-31 15:04:41 +00:00
|
|
|
}
|
2013-12-21 23:16:19 +00:00
|
|
|
#else
|
|
|
|
struct reactor;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-03-31 15:04:41 +00:00
|
|
|
|
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;
|
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.
|
|
|
|
extern void init_controlcen_for_level(void);
|
2014-10-02 03:02:34 +00:00
|
|
|
void calc_controlcen_gun_point(reactor *reactor, vobjptr_t obj,int gun_num);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2014-01-11 22:52:00 +00:00
|
|
|
void do_controlcen_destroyed_stuff(objptridx_t objp);
|
2006-03-20 17:12:09 +00:00
|
|
|
extern void do_controlcen_dead_frame(void);
|
|
|
|
|
|
|
|
extern fix Countdown_timer;
|
2011-03-28 22:35:41 +00:00
|
|
|
extern int Control_center_destroyed, Countdown_seconds_left, Total_countdown_time;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
/*
|
2013-12-23 21:00:20 +00:00
|
|
|
* reads n control_center_triggers structs from a PHYSFS_file and swaps if specified
|
2006-03-20 17:12:09 +00:00
|
|
|
*/
|
2013-12-23 21:00:20 +00:00
|
|
|
void control_center_triggers_read_swap(control_center_triggers *cct, int swap, PHYSFS_file *fp);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2009-10-05 02:51:37 +00:00
|
|
|
/*
|
2013-12-23 21:00:20 +00:00
|
|
|
* reads n control_center_triggers structs from a PHYSFS_file
|
2009-10-05 02:51:37 +00:00
|
|
|
*/
|
2013-12-23 21:00:20 +00:00
|
|
|
static inline void control_center_triggers_read(control_center_triggers *cct, PHYSFS_file *fp)
|
|
|
|
{
|
|
|
|
control_center_triggers_read_swap(cct, 0, fp);
|
|
|
|
}
|
2009-10-05 02:51:37 +00:00
|
|
|
|
2013-12-24 03:14:12 +00:00
|
|
|
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
|