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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Constants & prototypes which pertain to the game only
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-19 04:18:51 +00:00
|
|
|
#pragma once
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-12-26 04:18:28 +00:00
|
|
|
#include <physfs.h>
|
2015-04-19 04:18:51 +00:00
|
|
|
#include "maths.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-04-19 20:47:07 +00:00
|
|
|
#include <chrono>
|
2013-12-31 00:11:05 +00:00
|
|
|
#include <cstdint>
|
2014-06-26 02:24:32 +00:00
|
|
|
#include "pack.h"
|
2015-10-10 03:44:14 +00:00
|
|
|
#include "fwd-object.h"
|
2017-02-08 23:34:41 +00:00
|
|
|
#include "fwd-player.h"
|
2015-10-10 03:44:14 +00:00
|
|
|
#include "fwd-segment.h"
|
2020-08-28 00:18:45 +00:00
|
|
|
#include "window.h"
|
2020-08-10 03:45:13 +00:00
|
|
|
#include "d_array.h"
|
2020-10-12 03:28:26 +00:00
|
|
|
#include "kconfig.h"
|
2020-04-04 19:30:22 +00:00
|
|
|
#include "wall.h"
|
2021-09-12 16:20:52 +00:00
|
|
|
#include "d_underlying_value.h"
|
2012-11-11 22:12:51 +00:00
|
|
|
|
2013-08-08 20:07:29 +00:00
|
|
|
#define DESIGNATED_GAME_FPS 30 // assuming the original intended Framerate was 30
|
|
|
|
#define DESIGNATED_GAME_FRAMETIME (F1_0/DESIGNATED_GAME_FPS)
|
2012-11-11 22:12:51 +00:00
|
|
|
|
2008-09-30 00:07:07 +00:00
|
|
|
#ifdef NDEBUG
|
2013-08-08 20:07:29 +00:00
|
|
|
#define MINIMUM_FPS DESIGNATED_GAME_FPS
|
2008-09-30 00:07:07 +00:00
|
|
|
#define MAXIMUM_FPS 200
|
|
|
|
#else
|
2013-08-08 20:07:29 +00:00
|
|
|
#define MINIMUM_FPS 1
|
2008-09-30 00:07:07 +00:00
|
|
|
#define MAXIMUM_FPS 1000
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// from mglobal.c
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2020-04-19 20:47:07 +00:00
|
|
|
using d_time_fix = std::chrono::duration<uint32_t, std::ratio<1, F1_0>>;
|
2008-09-30 00:07:07 +00:00
|
|
|
extern fix FrameTime; // time in seconds since last frame
|
2010-12-22 00:17:59 +00:00
|
|
|
extern fix64 GameTime64; // time in game (sum of FrameTime)
|
2013-08-08 20:07:29 +00:00
|
|
|
extern int d_tick_count; // increments according to DESIGNATED_GAME_FRAMETIME
|
|
|
|
extern int d_tick_step; // true once in interval of DESIGNATED_GAME_FRAMETIME
|
2021-02-05 12:54:08 +00:00
|
|
|
enum class gauge_inset_window_view : unsigned;
|
2021-09-12 16:20:52 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2010-02-07 07:28:49 +00:00
|
|
|
extern struct object *Missile_viewer;
|
2015-03-22 18:49:21 +00:00
|
|
|
extern object_signature_t Missile_viewer_sig;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2020-08-10 03:45:13 +00:00
|
|
|
extern enumerated_array<unsigned, 2, gauge_inset_window_view> Coop_view_player; // left & right
|
|
|
|
extern enumerated_array<game_marker_index, 2, gauge_inset_window_view> Marker_viewer_num; // left & right
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#define NDL 5 // Number of difficulty levels.
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2021-09-12 16:20:52 +00:00
|
|
|
|
|
|
|
enum class game_mode_flag : uint16_t
|
|
|
|
{
|
|
|
|
normal = 0,
|
|
|
|
network = 1u << 2,
|
|
|
|
multi_robots = 1u << 3,
|
|
|
|
multi_coop = 1u << 4,
|
|
|
|
unknown = 1u << 6,
|
|
|
|
team = 1u << 8,
|
|
|
|
bounty = 1u << 9,
|
2021-11-01 03:37:20 +00:00
|
|
|
/* if DXX_BUILD_DESCENT_II */
|
2021-09-12 16:20:52 +00:00
|
|
|
capture = 1u << 10,
|
|
|
|
hoard = 1u << 11,
|
2021-11-01 03:37:20 +00:00
|
|
|
/* endif */
|
2021-09-12 16:20:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class game_mode_flags : uint16_t
|
|
|
|
{
|
|
|
|
normal = 0,
|
|
|
|
anarchy_no_robots = static_cast<uint16_t>(game_mode_flag::network),
|
|
|
|
team_anarchy_no_robots = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::team),
|
|
|
|
anarchy_with_robots = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::multi_robots),
|
|
|
|
cooperative = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::multi_robots) | static_cast<uint16_t>(game_mode_flag::multi_coop),
|
|
|
|
bounty = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::bounty),
|
2021-11-01 03:37:20 +00:00
|
|
|
/* if DXX_BUILD_DESCENT_II */
|
2021-09-12 16:20:52 +00:00
|
|
|
capture_flag = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::team) | static_cast<uint16_t>(game_mode_flag::capture),
|
|
|
|
hoard = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::hoard),
|
|
|
|
team_hoard = static_cast<uint16_t>(game_mode_flag::network) | static_cast<uint16_t>(game_mode_flag::team) | static_cast<uint16_t>(game_mode_flag::hoard),
|
2021-11-01 03:37:20 +00:00
|
|
|
/* endif */
|
2021-09-12 16:20:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// The following bits define the game modes.
|
|
|
|
#define GM_NETWORK game_mode_flag::network // You are in network mode
|
|
|
|
#define GM_MULTI_ROBOTS game_mode_flag::multi_robots // You are in a multiplayer mode with robots.
|
|
|
|
#define GM_MULTI_COOP game_mode_flag::multi_coop // You are in a multiplayer mode and can't hurt other players.
|
|
|
|
#define GM_UNKNOWN game_mode_flag::unknown // You are not in any mode, kind of dangerous...
|
|
|
|
#define GM_TEAM game_mode_flag::team // Team mode for network play
|
|
|
|
#define GM_BOUNTY game_mode_flag::bounty // New bounty mode by Matt1360
|
|
|
|
#define GM_CAPTURE game_mode_flag::capture // Capture the flag mode for D2
|
|
|
|
#define GM_HOARD game_mode_flag::hoard // New hoard mode for D2 Christmas
|
|
|
|
#define GM_NORMAL game_mode_flags::normal // You are in normal play mode, no multiplayer stuff
|
|
|
|
#define GM_MULTI GM_NETWORK // You are in some type of multiplayer game (GM_NETWORK /* | GM_SERIAL | GM_MODEM */)
|
|
|
|
extern game_mode_flags Game_mode;
|
|
|
|
extern game_mode_flags Newdemo_game_mode;
|
2015-05-14 02:23:13 +00:00
|
|
|
extern screen_mode Game_screen_mode;
|
2021-09-12 16:20:52 +00:00
|
|
|
|
|
|
|
static constexpr auto operator&(const game_mode_flags game_mode, const game_mode_flag f)
|
|
|
|
{
|
|
|
|
return underlying_value(game_mode) & underlying_value(f);
|
|
|
|
}
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#ifndef NDEBUG // if debugging, these are variables
|
|
|
|
|
|
|
|
extern int Slew_on; // in slew or sim mode?
|
|
|
|
|
|
|
|
#else // if not debugging, these are constants
|
|
|
|
|
|
|
|
#define Slew_on 0 // no slewing in real game
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Suspend flags
|
|
|
|
|
|
|
|
#define SUSP_ROBOTS 1 // Robot AI doesn't move
|
|
|
|
|
2009-07-01 11:35:33 +00:00
|
|
|
#define SHOW_EXIT_PATH 1
|
|
|
|
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
// from game.c
|
|
|
|
void close_game(void);
|
|
|
|
void calc_frame_time(void);
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2012-05-14 17:06:28 +00:00
|
|
|
void calc_d_tick();
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
extern int Game_suspended; // if non-zero, nothing moves but player
|
|
|
|
|
2019-11-17 23:27:13 +00:00
|
|
|
/* This must be a signed type. Some sites, such as `bump_this_object`,
|
|
|
|
* use Difficulty_level_type in arithmetic expressions, and those
|
|
|
|
* expressions must be signed to produce the correct result.
|
|
|
|
*/
|
|
|
|
enum Difficulty_level_type : signed int
|
2018-05-12 18:24:19 +00:00
|
|
|
{
|
|
|
|
Difficulty_0,
|
|
|
|
Difficulty_1,
|
|
|
|
Difficulty_2,
|
|
|
|
Difficulty_3,
|
|
|
|
Difficulty_4,
|
|
|
|
};
|
|
|
|
|
2019-06-27 03:26:20 +00:00
|
|
|
constexpr Difficulty_level_type DEFAULT_DIFFICULTY = Difficulty_1;
|
2018-05-12 18:24:19 +00:00
|
|
|
|
|
|
|
static inline Difficulty_level_type cast_clamp_difficulty(const unsigned d)
|
|
|
|
{
|
|
|
|
return (d <= Difficulty_4) ? static_cast<Difficulty_level_type>(d) : Difficulty_4;
|
|
|
|
}
|
|
|
|
|
2020-04-04 19:30:22 +00:00
|
|
|
struct d_game_shared_state
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2019-06-27 03:26:20 +00:00
|
|
|
struct d_game_unique_state
|
|
|
|
{
|
2020-05-02 21:18:42 +00:00
|
|
|
using savegame_file_path = std::array<char, PATH_MAX>;
|
2019-07-28 21:09:07 +00:00
|
|
|
/* 20 is required by the save game ABI and the multiplayer
|
|
|
|
* save/restore command ABI.
|
|
|
|
*/
|
2020-05-02 21:18:42 +00:00
|
|
|
using savegame_description = std::array<char, 20>;
|
2020-04-26 17:26:23 +00:00
|
|
|
static constexpr std::integral_constant<unsigned, 11> MAXIMUM_SAVE_SLOTS{};
|
|
|
|
enum class save_slot : unsigned
|
|
|
|
{
|
|
|
|
_0,
|
|
|
|
_1,
|
|
|
|
_2,
|
|
|
|
_3,
|
|
|
|
_4,
|
|
|
|
_5,
|
|
|
|
_6,
|
|
|
|
_7,
|
|
|
|
_8,
|
|
|
|
_9,
|
|
|
|
_autosave,
|
|
|
|
secret_save_filename_override = MAXIMUM_SAVE_SLOTS + 1,
|
|
|
|
None = UINT32_MAX
|
|
|
|
};
|
2019-06-27 03:26:20 +00:00
|
|
|
Difficulty_level_type Difficulty_level; // Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
|
2019-07-13 22:28:57 +00:00
|
|
|
fix Boss_gate_interval;
|
2019-07-16 04:00:50 +00:00
|
|
|
unsigned accumulated_robots;
|
2019-07-16 04:00:50 +00:00
|
|
|
unsigned total_hostages;
|
2020-04-19 20:47:07 +00:00
|
|
|
std::chrono::steady_clock::time_point Next_autosave;
|
2020-04-26 17:26:23 +00:00
|
|
|
save_slot quicksave_selection = save_slot::None;
|
|
|
|
static constexpr unsigned valid_save_slot(const save_slot s)
|
|
|
|
{
|
|
|
|
return static_cast<unsigned>(s) < static_cast<unsigned>(save_slot::_autosave);
|
|
|
|
}
|
|
|
|
static constexpr unsigned valid_load_slot(const save_slot s)
|
|
|
|
{
|
|
|
|
return static_cast<unsigned>(s) <= static_cast<unsigned>(save_slot::_autosave);
|
|
|
|
}
|
2019-06-27 03:26:20 +00:00
|
|
|
};
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
extern int Global_missile_firing_count;
|
|
|
|
|
|
|
|
extern int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
|
2021-03-15 18:32:10 +00:00
|
|
|
|
|
|
|
// Stereo viewport formats
|
2021-09-12 16:20:52 +00:00
|
|
|
enum class StereoFormat : uint8_t {
|
|
|
|
None = 0,
|
|
|
|
AboveBelow,
|
|
|
|
SideBySideFullHeight,
|
|
|
|
SideBySideHalfHeight,
|
|
|
|
AboveBelowSync,
|
|
|
|
HighestFormat = AboveBelowSync
|
2021-03-15 18:32:10 +00:00
|
|
|
};
|
|
|
|
|
2021-09-12 16:20:52 +00:00
|
|
|
extern StereoFormat VR_stereo;
|
2021-03-15 18:32:10 +00:00
|
|
|
extern fix VR_eye_width;
|
|
|
|
extern int VR_eye_offset;
|
2021-03-27 21:18:11 +00:00
|
|
|
extern int VR_sync_width;
|
2021-09-04 12:17:14 +00:00
|
|
|
extern grs_subcanvas VR_hud_left;
|
|
|
|
extern grs_subcanvas VR_hud_right;
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#define MAX_PALETTE_ADD 30
|
|
|
|
|
2015-12-13 18:00:48 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
2015-12-13 18:00:49 +00:00
|
|
|
namespace dsx {
|
2020-08-28 00:18:45 +00:00
|
|
|
|
|
|
|
struct game_window : window
|
|
|
|
{
|
|
|
|
using window::window;
|
|
|
|
virtual window_event_result event_handler(const d_event &) override;
|
|
|
|
};
|
|
|
|
extern game_window *Game_wind;
|
|
|
|
|
2016-01-09 16:38:12 +00:00
|
|
|
void game();
|
2015-12-22 04:18:50 +00:00
|
|
|
void init_game();
|
2021-03-12 18:07:45 +00:00
|
|
|
void init_stereo();
|
2015-12-22 04:18:50 +00:00
|
|
|
void init_cockpit();
|
2006-03-20 17:12:09 +00:00
|
|
|
extern void PALETTE_FLASH_ADD(int dr, int dg, int db);
|
2019-08-06 02:59:40 +00:00
|
|
|
|
2020-04-04 19:30:22 +00:00
|
|
|
struct d_game_shared_state : ::dcx::d_game_shared_state
|
|
|
|
{
|
|
|
|
wall_animations_array WallAnims;
|
|
|
|
};
|
|
|
|
|
2019-08-06 02:59:40 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
|
|
|
struct d_game_unique_state : ::dcx::d_game_unique_state
|
|
|
|
{
|
2019-08-06 02:59:40 +00:00
|
|
|
fix Final_boss_countdown_time;
|
2019-08-06 02:59:40 +00:00
|
|
|
};
|
2019-08-06 02:59:40 +00:00
|
|
|
|
2019-08-06 02:59:41 +00:00
|
|
|
struct d_level_shared_seismic_state
|
|
|
|
{
|
|
|
|
fix Level_shake_frequency;
|
2019-08-06 02:59:41 +00:00
|
|
|
fix Level_shake_duration;
|
2019-08-06 02:59:41 +00:00
|
|
|
};
|
|
|
|
|
2019-08-06 02:59:40 +00:00
|
|
|
struct d_level_unique_seismic_state
|
|
|
|
{
|
|
|
|
fix64 Seismic_disturbance_end_time;
|
2019-08-06 02:59:41 +00:00
|
|
|
fix64 Next_seismic_sound_time;
|
2019-08-06 02:59:41 +00:00
|
|
|
int Seismic_tremor_volume;
|
2019-08-06 02:59:41 +00:00
|
|
|
fix Seismic_tremor_magnitude;
|
2020-05-02 21:18:42 +00:00
|
|
|
std::array<fix64, 4> Earthshaker_detonate_times;
|
2019-08-06 02:59:40 +00:00
|
|
|
};
|
|
|
|
|
2019-08-06 02:59:41 +00:00
|
|
|
extern d_level_shared_seismic_state LevelSharedSeismicState;
|
2019-08-06 02:59:40 +00:00
|
|
|
extern d_level_unique_seismic_state LevelUniqueSeismicState;
|
2019-08-06 02:59:40 +00:00
|
|
|
#endif
|
|
|
|
|
2020-04-04 19:30:22 +00:00
|
|
|
extern d_game_shared_state GameSharedState;
|
2019-08-06 02:59:40 +00:00
|
|
|
extern d_game_unique_state GameUniqueState;
|
2020-10-12 03:28:26 +00:00
|
|
|
void game_render_frame(const control_info &Controls);
|
2015-12-13 18:00:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//sets the rgb values for palette flash
|
|
|
|
#define PALETTE_FLASH_SET(_r,_g,_b) PaletteRedAdd=(_r), PaletteGreenAdd=(_g), PaletteBlueAdd=(_b)
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2007-04-01 02:14:38 +00:00
|
|
|
extern int last_drawn_cockpit;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2015-10-09 02:46:09 +00:00
|
|
|
class pause_game_world_time
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
pause_game_world_time();
|
|
|
|
~pause_game_world_time();
|
|
|
|
};
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
void stop_time();
|
|
|
|
void start_time();
|
|
|
|
void reset_time(); // called when starting level
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2018-06-16 04:13:37 +00:00
|
|
|
#if DXX_USE_SCREENSHOT
|
2015-12-13 18:00:48 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2015-12-13 18:00:48 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
// If automap_flag == 1, then call automap routine to write message.
|
2018-02-18 00:42:42 +00:00
|
|
|
#if DXX_USE_SCREENSHOT_FORMAT_LEGACY
|
|
|
|
void write_bmp(PHYSFS_File *, unsigned w, unsigned h);
|
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
extern void save_screen_shot(int automap_flag);
|
|
|
|
|
2015-12-13 18:00:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
2018-06-16 04:13:37 +00:00
|
|
|
#endif
|
2015-12-13 18:00:48 +00:00
|
|
|
|
2012-07-15 03:51:54 +00:00
|
|
|
enum cockpit_mode_t
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
//valid modes for cockpit
|
2012-07-15 03:51:54 +00:00
|
|
|
CM_FULL_COCKPIT, // normal screen with cockpit
|
|
|
|
CM_REAR_VIEW, // looking back with bitmap
|
|
|
|
CM_STATUS_BAR, // small status bar, w/ reticle
|
|
|
|
CM_FULL_SCREEN, // full screen, no cockpit (w/ reticle)
|
|
|
|
CM_LETTERBOX // half-height window (for cutscenes)
|
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
extern int Rear_view; // if true, looking back.
|
|
|
|
|
2016-01-09 16:38:15 +00:00
|
|
|
#ifdef dsx
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2020-10-12 03:28:26 +00:00
|
|
|
void game_flush_respawn_inputs(control_info &Controls);
|
|
|
|
void game_flush_inputs(control_info &Controls); // clear all inputs
|
2006-03-20 17:12:09 +00:00
|
|
|
// initalize flying
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2015-11-26 02:56:55 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// selects a given cockpit (or lack of one).
|
2012-07-15 03:51:54 +00:00
|
|
|
void select_cockpit(cockpit_mode_t mode);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// force cockpit redraw next time. call this if you've trashed the screen
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2016-09-11 18:49:13 +00:00
|
|
|
void fly_init(object_base &obj);
|
2015-12-22 04:18:50 +00:00
|
|
|
void reset_cockpit(); // called if you've trashed the screen
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// functions to save, clear, and resture palette flash effects
|
|
|
|
void reset_palette_add(void);
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2016-08-25 04:05:32 +00:00
|
|
|
#ifdef dsx
|
|
|
|
namespace dsx {
|
2006-03-20 17:12:09 +00:00
|
|
|
void palette_restore(void);
|
2020-09-11 03:08:02 +00:00
|
|
|
void show_help();
|
|
|
|
void show_netgame_help();
|
|
|
|
|
|
|
|
// put up the help message
|
|
|
|
void show_newdemo_help();
|
2016-08-25 04:05:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
2013-10-28 03:41:44 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2015-12-04 03:36:31 +00:00
|
|
|
void palette_save();
|
2013-10-28 03:41:44 +00:00
|
|
|
static inline void full_palette_save(void)
|
|
|
|
{
|
|
|
|
palette_save();
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// show a message in a nice little box
|
2021-09-12 16:20:52 +00:00
|
|
|
void show_boxed_message(grs_canvas &, const char *msg);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// turns off rear view & rear view cockpit
|
|
|
|
void reset_rear_view(void);
|
|
|
|
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2021-09-12 16:20:52 +00:00
|
|
|
void game_init_render_sub_buffers(grs_canvas &, int x, int y, int w, int h);
|
2013-09-24 01:46:10 +00:00
|
|
|
// Sets up the canvases we will be rendering to
|
2012-11-11 00:14:30 +00:00
|
|
|
|
|
|
|
extern int netplayerinfo_on;
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2012-11-11 00:14:30 +00:00
|
|
|
|
2016-01-09 16:38:15 +00:00
|
|
|
#ifdef dsx
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
2013-08-11 16:03:47 +00:00
|
|
|
static inline int game_mode_capture_flag()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2013-08-11 16:03:47 +00:00
|
|
|
static inline int game_mode_hoard()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2020-09-11 03:08:02 +00:00
|
|
|
void full_palette_save(); // all of the above plus gr_palette_load(gr_palette)
|
2013-08-11 16:03:47 +00:00
|
|
|
static inline int game_mode_capture_flag()
|
|
|
|
{
|
|
|
|
return (Game_mode & GM_CAPTURE);
|
|
|
|
}
|
2013-08-11 16:03:47 +00:00
|
|
|
static inline int game_mode_hoard()
|
|
|
|
{
|
|
|
|
return (Game_mode & GM_HOARD);
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//Flickering light system
|
2013-12-22 22:03:07 +00:00
|
|
|
struct flickering_light {
|
2013-12-29 04:28:07 +00:00
|
|
|
segnum_t segnum;
|
2016-12-24 22:44:08 +00:00
|
|
|
uint8_t sidenum;
|
2013-12-31 00:11:05 +00:00
|
|
|
uint32_t mask; // determines flicker pattern
|
2006-03-20 17:12:09 +00:00
|
|
|
fix timer; // time until next change
|
|
|
|
fix delay; // time between changes
|
2013-12-22 22:03:07 +00:00
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2018-03-31 21:53:01 +00:00
|
|
|
struct d_flickering_light_state
|
|
|
|
{
|
2020-05-02 21:18:42 +00:00
|
|
|
using Flickering_light_array_t = std::array<flickering_light, 100>;
|
2018-03-31 21:53:01 +00:00
|
|
|
unsigned Num_flickering_lights;
|
|
|
|
Flickering_light_array_t Flickering_lights;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern d_flickering_light_state Flickering_light_state;
|
|
|
|
|
2012-11-11 00:14:30 +00:00
|
|
|
extern int BigWindowSwitch;
|
2015-05-17 20:37:59 +00:00
|
|
|
void compute_slide_segs();
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// turn flickering off (because light has been turned off)
|
2018-03-31 21:53:01 +00:00
|
|
|
void disable_flicker(d_flickering_light_state &fls, vmsegidx_t segnum, unsigned sidenum);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
// turn flickering off (because light has been turned on)
|
2018-03-31 21:53:01 +00:00
|
|
|
void enable_flicker(d_flickering_light_state &fls, vmsegidx_t segnum, unsigned sidenum);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
/*
|
2016-01-09 16:38:14 +00:00
|
|
|
* reads a flickering_light structure from a PHYSFS_File
|
2006-03-20 17:12:09 +00:00
|
|
|
*/
|
2018-03-27 03:49:34 +00:00
|
|
|
void flickering_light_read(flickering_light &fl, PHYSFS_File *fp);
|
|
|
|
void flickering_light_write(const flickering_light &fl, PHYSFS_File *fp);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2008-05-21 13:58:27 +00:00
|
|
|
|
2020-10-12 03:28:26 +00:00
|
|
|
void game_render_frame_mono(const control_info &Controls);
|
|
|
|
static inline void game_render_frame_mono(int skip_flip, const control_info &Controls)
|
2014-10-16 02:44:43 +00:00
|
|
|
{
|
2020-10-12 03:28:26 +00:00
|
|
|
game_render_frame_mono(Controls);
|
2015-12-24 04:01:28 +00:00
|
|
|
if (!skip_flip)
|
2014-10-16 02:44:43 +00:00
|
|
|
gr_flip();
|
|
|
|
}
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
|
|
|
#endif
|
2010-01-31 07:45:26 +00:00
|
|
|
void game_leave_menus(void);
|
2011-02-14 21:27:07 +00:00
|
|
|
|
|
|
|
//Cheats
|
2016-01-09 16:38:15 +00:00
|
|
|
#ifdef dsx
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dsx {
|
2014-06-26 02:24:32 +00:00
|
|
|
struct game_cheats : prohibit_void_ptr<game_cheats>
|
2011-02-14 21:27:07 +00:00
|
|
|
{
|
|
|
|
int enabled;
|
|
|
|
int wowie;
|
|
|
|
int allkeys;
|
|
|
|
int invul;
|
|
|
|
int shields;
|
|
|
|
int killreactor;
|
|
|
|
int exitpath;
|
|
|
|
int levelwarp;
|
|
|
|
int fullautomap;
|
|
|
|
int ghostphysics;
|
|
|
|
int rapidfire;
|
|
|
|
int turbo;
|
|
|
|
int robotfiringsuspended;
|
2013-03-03 01:03:33 +00:00
|
|
|
int acid;
|
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
int wowie2;
|
|
|
|
int cloak;
|
|
|
|
int extralife;
|
|
|
|
int baldguy;
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
|
|
|
int lamer;
|
|
|
|
int accessory;
|
|
|
|
int bouncyfire;
|
2017-01-29 21:02:48 +00:00
|
|
|
int homingfire;
|
2011-02-14 21:27:07 +00:00
|
|
|
int killallrobots;
|
|
|
|
int robotskillrobots;
|
|
|
|
int monsterdamage;
|
|
|
|
int buddyclone;
|
|
|
|
int buddyangry;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2014-06-26 02:24:32 +00:00
|
|
|
};
|
2011-02-14 21:27:07 +00:00
|
|
|
extern game_cheats cheats;
|
2015-11-26 02:56:55 +00:00
|
|
|
|
2020-08-28 00:18:45 +00:00
|
|
|
game_window *game_setup();
|
2020-10-12 03:28:26 +00:00
|
|
|
window_event_result ReadControls(const d_event &event, control_info &Controls);
|
2017-02-08 23:34:41 +00:00
|
|
|
bool allowed_to_fire_laser(const player_info &);
|
2019-06-27 03:26:20 +00:00
|
|
|
void reset_globals_for_new_game();
|
2020-10-12 03:28:26 +00:00
|
|
|
void check_rear_view(control_info &Controls);
|
|
|
|
int create_special_path();
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2015-07-18 03:49:47 +00:00
|
|
|
#endif
|
|
|
|
int cheats_enabled();
|
2011-02-14 21:27:07 +00:00
|
|
|
void game_disable_cheats();
|
2012-11-11 00:14:30 +00:00
|
|
|
void toggle_cockpit(void);
|
|
|
|
extern fix Show_view_text_timer;
|
2020-04-19 20:47:07 +00:00
|
|
|
extern d_time_fix ThisLevelTime;
|
2015-12-22 04:18:50 +00:00
|
|
|
namespace dcx {
|
2012-11-11 00:14:30 +00:00
|
|
|
extern int force_cockpit_redraw;
|
2015-12-22 04:18:50 +00:00
|
|
|
}
|
2015-12-13 18:00:48 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2015-12-13 18:00:49 +00:00
|
|
|
namespace dsx {
|
2015-12-22 04:18:50 +00:00
|
|
|
extern ubyte DemoDoingRight,DemoDoingLeft;
|
2012-11-11 00:14:30 +00:00
|
|
|
extern fix64 Time_flash_last_played;
|
2021-09-12 16:20:52 +00:00
|
|
|
|
|
|
|
playernum_t get_marker_owner(game_mode_flags, game_marker_index, unsigned max_numplayers);
|
2015-12-13 18:00:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
2012-11-11 00:14:30 +00:00
|
|
|
|
2016-09-11 18:49:16 +00:00
|
|
|
#if DXX_USE_EDITOR
|
2016-08-25 04:05:32 +00:00
|
|
|
#ifdef dsx
|
|
|
|
namespace dsx {
|
2012-11-11 00:14:30 +00:00
|
|
|
void dump_used_textures_all();
|
2018-12-30 00:43:57 +00:00
|
|
|
void move_player_2_segment(vmsegptridx_t seg, unsigned side);
|
2016-08-25 04:05:32 +00:00
|
|
|
}
|
|
|
|
#endif
|
2012-11-11 00:14:30 +00:00
|
|
|
#endif
|