dxx-rebirth/common/main/playsave.h

276 lines
6.6 KiB
C
Raw Normal View History

2006-03-20 16:43:15 +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 16:43:15 +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.
2006-03-20 16:43:15 +00:00
*/
2006-03-20 16:43:15 +00:00
/*
*
* Header for playsave.c
2006-03-20 16:43:15 +00:00
*
*/
2015-01-12 00:26:02 +00:00
#pragma once
2006-03-20 16:43:15 +00:00
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
#if defined(DXX_BUILD_DESCENT_I)
#include "pstypes.h"
2008-04-24 14:27:54 +00:00
#include "player.h"
#elif defined(DXX_BUILD_DESCENT_II)
#include "escort.h"
enum class MissileViewMode : uint8_t
{
None,
EnabledSelfOnly,
EnabledSelfAndAllies,
};
2021-01-25 00:45:07 +00:00
enum class cockpit_3d_view : uint8_t
{
None,
Escort,
Rear,
Coop,
Marker,
};
#endif
#include "gameplayopt.h"
2015-07-25 23:10:45 +00:00
#include <cstdint>
#define N_SAVE_SLOTS 10
#define GAME_NAME_LEN 25 // +1 for terminating zero = 26
2006-03-20 16:43:15 +00:00
2016-10-02 19:35:34 +00:00
#ifdef dsx
#if defined(DXX_BUILD_DESCENT_I)
2016-10-02 19:35:34 +00:00
namespace dsx {
// NOTE: Obsolete structure - only kept for compability of shareware plr file
struct saved_game_sw
{
char name[GAME_NAME_LEN+1]; //extra char for terminating zero
struct player_rw sg_player;
int difficulty_level; //which level game is played at
int primary_weapon; //which weapon selected
int secondary_weapon; //which weapon selected
int cockpit_mode; //which cockpit mode selected
int window_w,window_h; //size of player's window
int next_level_num; //which level we're going to
int auto_leveling_on; //does player have autoleveling on?
} __pack__;
void plyr_save_stats();
2016-10-02 19:35:34 +00:00
}
#endif
#endif
struct hli
{
2020-05-02 21:18:42 +00:00
std::array<char, 9> Shortname;
2015-07-25 23:10:45 +00:00
uint8_t LevelNum;
};
2022-02-12 18:57:12 +00:00
#ifdef dsx
#include "kconfig.h"
#include "multi.h"
2022-02-12 18:57:12 +00:00
#include "fwd-game.h"
#include "fwd-weapon.h"
#include "d_array.h"
namespace dcx {
enum class FiringAutoselectMode : uint8_t
{
Immediate,
Never,
Delayed,
};
2015-11-14 18:17:22 +00:00
enum class HudType : uint8_t
{
Standard,
Alternate1,
Alternate2,
Hidden,
};
enum class RespawnPress : uint8_t
{
Any,
Fire,
};
2017-03-25 19:34:02 +00:00
enum MouselookMode : uint8_t
{
Singleplayer = 1,
MPCoop = 2,
MPAnarchy = 4,
};
enum class player_config_keyboard_index : std::size_t
{
turn_lr,
pitch_ud,
slide_lr,
slide_ud,
bank_lr,
};
enum class player_config_mouse_index : std::size_t
{
turn_lr,
pitch_ud,
slide_lr,
slide_ud,
bank_lr,
throttle,
};
enum class player_config_joystick_index : std::size_t
{
turn_lr,
pitch_ud,
slide_lr,
slide_ud,
bank_lr,
throttle,
};
}
namespace dsx {
struct player_config : prohibit_void_ptr<player_config>
{
ubyte ControlType;
2015-11-14 18:17:22 +00:00
HudType HudMode;
RespawnPress RespawnMode;
2017-03-25 19:34:02 +00:00
uint8_t MouselookFlags;
2022-08-21 00:32:38 +00:00
uint8_t PitchLockFlags;
2020-05-02 21:18:42 +00:00
using primary_weapon_order = std::array<uint8_t, MAX_PRIMARY_WEAPONS + 1>;
using secondary_weapon_order = std::array<uint8_t, MAX_SECONDARY_WEAPONS + 1>;
primary_weapon_order PrimaryOrder;
secondary_weapon_order SecondaryOrder;
struct KeySettings {
enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_keyboard> Keyboard;
#if DXX_MAX_JOYSTICKS
enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_joystick> Joystick;
#endif
enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_mouse> Mouse;
} KeySettings;
std::array<uint8_t, MAX_DXX_REBIRTH_CONTROLS> KeySettingsRebirth;
2018-05-12 18:24:19 +00:00
Difficulty_level_type DefaultDifficulty;
int AutoLeveling;
uint16_t NHighestLevels;
2020-05-02 21:18:42 +00:00
std::array<hli, MAX_MISSIONS> HighestLevels;
enumerated_array<int, 5, player_config_keyboard_index> KeyboardSens;
enumerated_array<int, 6, player_config_joystick_index> JoystickSens;
enumerated_array<int, 6, player_config_joystick_index> JoystickDead;
enumerated_array<int, 6, player_config_joystick_index> JoystickLinear;
enumerated_array<int, 6, player_config_joystick_index> JoystickSpeed;
ubyte MouseFlightSim;
enumerated_array<int, 6, player_config_mouse_index> MouseSens;
enumerated_array<int, 6, player_config_mouse_index> MouseOverrun;
int MouseFSDead;
int MouseFSIndicator;
2020-05-02 21:18:42 +00:00
std::array<cockpit_mode_t, 2> CockpitMode; // 0 saves the "real" cockpit, 1 also saves letterbox and rear. Used to properly switch between modes and restore the real one.
#if defined(DXX_BUILD_DESCENT_II)
2021-01-25 00:45:07 +00:00
enumerated_array<cockpit_3d_view, 2, gauge_inset_window_view> Cockpit3DView = {{{
cockpit_3d_view::None,
cockpit_3d_view::None,
}}};
#endif
2020-05-02 21:18:42 +00:00
std::array<ntstring<MAX_MESSAGE_LEN - 1>, 4> NetworkMessageMacro;
int NetlifeKills;
int NetlifeKilled;
ubyte ReticleType;
2020-05-02 21:18:42 +00:00
std::array<int, 4> ReticleRGBA;
int ReticleSize;
#if defined(DXX_BUILD_DESCENT_II)
MissileViewMode MissileViewEnabled;
Allow players to remove thief at level start Commit f4b21088a039 ("Track vulcan ammo explicitly") fixed an original retail bug that prevented the thief from stealing energy weapons, because the thief could only steal weapons for which the player had ammo and energy weapons never have ammo. This went unremarked for several years, until a recent report of the new semantics as a game-breaking regression because the thief is now "ridiculously potent". Address this report, as well as an intermittently raised issue from various users over time, by adding two new knobs to both the single player "Gameplay" menu and the multiplayer setup screen: "Remove Thief at level start" and "Prevent Thief Stealing Energy Weapons". "Remove Thief" deletes the thief object during level load. It has no impact on save games, and changing it after entering a level has no effect on any thief already in the level. "Prevent Thief Stealing" is checked at the moment of theft and, when enabled, prevents stealing primary weapons other than Vulcan/Gauss. This can be changed at will in single player and is immediately effective. In multiplayer, this option can only be changed by the game host in the pre-game setup. For both knobs, there is one pair of checkboxes to control this as a player preference, which applies in single player games. There is a second pair of checkboxes in the multiplayer setup, which applies only to multiplayer games. Therefore, in multiplayer, the host chooses thief settings and all clients use the host's choice. The host may configure the thief differently in multiplayer from how the host plays in single player. For users who wanted to remove the thief, no specific tally has been kept for who requested it or when. Now that the code is being updated, this is thrown in as an easy addition. Reported-by: MegaDescent <http://forum.dxx-rebirth.com/showthread.php?tid=980> (for the thief stealing energy weapons as a game-breaking regression)
2017-08-26 19:47:52 +00:00
uint8_t ThiefModifierFlags;
int HeadlightActiveDefault;
int GuidedInBigWindow;
2015-01-12 00:26:02 +00:00
ntstring<GUIDEBOT_NAME_LEN> GuidebotName, GuidebotNameReal;
int EscortHotKeys;
#endif
int PersistentDebris;
int PRShot;
ubyte NoRedundancy;
ubyte MultiMessages;
ubyte MultiPingHud;
ubyte NoRankings;
#if defined(DXX_BUILD_DESCENT_I)
ubyte BombGauge;
#endif
ubyte AutomapFreeFlight;
FiringAutoselectMode NoFireAutoselect;
ubyte CycleAutoselectOnly;
2015-10-03 17:17:49 +00:00
uint8_t CloakInvulTimer;
union {
/* For now, manage all these choices in a single variable, but
* give them separate names to make them easier to find.
*/
int AlphaEffects;
int AlphaBlendMineExplosion;
int AlphaBlendMarkers;
int AlphaBlendFireballs;
int AlphaBlendPowerups;
int AlphaBlendLasers;
int AlphaBlendWeapons;
int AlphaBlendEClips;
};
int DynLightColor;
d_sp_gameplay_options SPGameplayOptions;
};
}
#endif
extern struct player_config PlayerCfg;
2006-03-20 16:43:15 +00:00
#ifndef EZERO
#define EZERO 0
#endif
// Used to save kconfig values to disk.
#ifdef dsx
namespace dsx {
extern const struct player_config::KeySettings DefaultKeySettings;
2013-10-06 17:47:56 +00:00
void write_player_file();
2006-03-20 16:43:15 +00:00
void new_player_config();
2006-03-20 16:43:15 +00:00
int read_player_file();
// set a new highest level for player for this mission
}
#endif
void set_highest_level(uint8_t levelnum);
2006-03-20 16:43:15 +00:00
// gets the player's highest level from the file for this mission
2006-03-20 16:43:15 +00:00
int get_highest_level(void);
2015-12-13 18:00:49 +00:00
namespace dsx {
struct netgame_info;
void read_netgame_profile(struct netgame_info *ng);
void write_netgame_profile(struct netgame_info *ng);
}
#endif