Debian Codegraph @

common/main/playsave.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Header for playsave.c
23 *
24 */
25
26 #pragma once
27
28 #ifdef DXX_BUILD_DESCENT
29 #if DXX_BUILD_DESCENT == 1
30 #include "pstypes.h"
31 #include "player.h"
32 #elif DXX_BUILD_DESCENT == 2
33 #include "escort.h"
34
35 enum class MissileViewMode : uint8_t
36 {
37 None,
38 EnabledSelfOnly,
39 EnabledSelfAndAllies,
40 };
41
42 enum class cockpit_3d_view : uint8_t
43 {
44 None,
45 Escort,
46 Rear,
47 Coop,
48 Marker,
49 };
50 #endif
51
52 #include "gameplayopt.h"
53 #include <cstdint>
54
55 #define N_SAVE_SLOTS 10
56 #define GAME_NAME_LEN 25 // +1 for terminating zero = 26
57
58 #ifdef DXX_BUILD_DESCENT
59 #if DXX_BUILD_DESCENT == 1
60 namespace dsx {
61 // NOTE: Obsolete structure - only kept for compability of shareware plr file
62 struct saved_game_sw
63 {
64 char name[GAME_NAME_LEN+1]; //extra char for terminating zero
65 struct player_rw sg_player;
66 int difficulty_level; //which level game is played at
67 int primary_weapon; //which weapon selected
68 int secondary_weapon; //which weapon selected
69 int cockpit_mode; //which cockpit mode selected
70 int window_w,window_h; //size of player's window
71 int next_level_num; //which level we're going to
72 int auto_leveling_on; //does player have autoleveling on?
73 } __pack__;
74
75 void plyr_save_stats(const char *callsign, int kills, int deaths);
76 }
77 #endif
78 #endif
79
80 struct hli
81 {
82 std::array<char, 9> Shortname;
83 uint8_t LevelNum;
84 };
85
86 #ifdef DXX_BUILD_DESCENT
87 #include "kconfig.h"
88 #include "multi.h"
89 #include "fwd-game.h"
90 #include "fwd-weapon.h"
91 #include "d_array.h"
92 #include "mission.h"
93
94 namespace dcx {
95
96 enum class reticle_type : uint8_t;
97
98 enum class FiringAutoselectMode : uint8_t
99 {
100 Immediate,
101 Never,
102 Delayed,
103 };
104
105 enum class HudType : uint8_t
106 {
107 Standard,
108 Alternate1,
109 Alternate2,
110 Hidden,
111 };
112
113 enum class RespawnPress : bool
114 {
115 Any,
116 Fire,
117 };
118
119 enum MouselookMode : uint8_t
120 {
121 Singleplayer = 1,
122 MPCoop = 2,
123 MPAnarchy = 4,
124 };
125
126 enum class player_config_keyboard_index : std::size_t
127 {
128 turn_lr,
129 pitch_ud,
130 slide_lr,
131 slide_ud,
132 bank_lr,
133 };
134
135 enum class player_config_mouse_index : std::size_t
136 {
137 turn_lr,
138 pitch_ud,
139 slide_lr,
140 slide_ud,
141 bank_lr,
142 throttle,
143 };
144
145 enum class player_config_joystick_index : std::size_t
146 {
147 turn_lr,
148 pitch_ud,
149 slide_lr,
150 slide_ud,
151 bank_lr,
152 throttle,
153 };
154
155 }
156
157 namespace dsx {
158
159 struct player_config : prohibit_void_ptr<player_config>
160 {
161 ubyte ControlType;
162 HudType HudMode;
163 RespawnPress RespawnMode;
164 uint8_t MouselookFlags;
165 uint8_t PitchLockFlags;
166 using primary_weapon_order = std::array<primary_weapon_index_t, MAX_PRIMARY_WEAPONS + 1>;
167 using secondary_weapon_order = std::array<secondary_weapon_index_t, MAX_SECONDARY_WEAPONS + 1>;
168 primary_weapon_order PrimaryOrder;
169 secondary_weapon_order SecondaryOrder;
170 struct KeySettings {
171 enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_keyboard> Keyboard;
172 #if DXX_MAX_JOYSTICKS
173 enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_joystick> Joystick;
174 #endif
175 enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_mouse> Mouse;
176 } KeySettings;
177 std::array<uint8_t, MAX_DXX_REBIRTH_CONTROLS> KeySettingsRebirth;
178 Difficulty_level_type DefaultDifficulty;
179 int AutoLeveling;
180 uint16_t NHighestLevels;
181 std::array<hli, MAX_MISSIONS> HighestLevels;
182 enumerated_array<int, 5, player_config_keyboard_index> KeyboardSens;
183 enumerated_array<int, 6, player_config_joystick_index> JoystickSens;
184 enumerated_array<int, 6, player_config_joystick_index> JoystickDead;
185 enumerated_array<int, 6, player_config_joystick_index> JoystickLinear;
186 enumerated_array<int, 6, player_config_joystick_index> JoystickSpeed;
187 ubyte MouseFlightSim;
188 enumerated_array<int, 6, player_config_mouse_index> MouseSens;
189 enumerated_array<int, 6, player_config_mouse_index> MouseOverrun;
190 int MouseFSDead;
191 int MouseFSIndicator;
192 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.
193 #if DXX_BUILD_DESCENT == 2
194 enumerated_array<cockpit_3d_view, 2, gauge_inset_window_view> Cockpit3DView = {{{
195 cockpit_3d_view::None,
196 cockpit_3d_view::None,
197 }}};
198 #endif
199 enumerated_array<ntstring<MAX_MESSAGE_LEN - 1>, 4, multi_macro_message_index> NetworkMessageMacro;
200 int NetlifeKills;
201 int NetlifeKilled;
202 std::array<int, 4> ReticleRGBA;
203 int ReticleSize;
204 reticle_type ReticleType;
205 #if DXX_BUILD_DESCENT == 2
206 MissileViewMode MissileViewEnabled;
207 uint8_t ThiefModifierFlags;
208 bool HeadlightActiveDefault;
209 bool GuidedInBigWindow;
210 ntstring<GUIDEBOT_NAME_LEN> GuidebotName, GuidebotNameReal;
211 bool EscortHotKeys;
212 #endif
213 bool PersistentDebris;
214 bool PRShot;
215 ubyte NoRedundancy;
216 ubyte MultiMessages;
217 ubyte MultiPingHud;
218 ubyte NoRankings;
219 #if DXX_BUILD_DESCENT == 1
220 ubyte BombGauge;
221 #endif
222 ubyte AutomapFreeFlight;
223 FiringAutoselectMode NoFireAutoselect;
224 ubyte CycleAutoselectOnly;
225 uint8_t CloakInvulTimer;
226 union {
227 /* For now, manage all these choices in a single variable, but
228 * give them separate names to make them easier to find.
229 */
230 int AlphaEffects;
231 int AlphaBlendMineExplosion;
232 int AlphaBlendMarkers;
233 int AlphaBlendFireballs;
234 int AlphaBlendPowerups;
235 int AlphaBlendLasers;
236 int AlphaBlendWeapons;
237 int AlphaBlendEClips;
238 };
239 int DynLightColor;
240 d_sp_gameplay_options SPGameplayOptions;
241 };
242
243 }
244 #endif
245
246 extern struct player_config PlayerCfg;
247
248 #ifndef EZERO
249 #define EZERO 0
250 #endif
251
252 // Used to save kconfig values to disk.
253 #ifdef DXX_BUILD_DESCENT
254 namespace dsx {
255
256 extern const struct player_config::KeySettings DefaultKeySettings;
257
258 void write_player_file();
259
260 void new_player_config();
261
262 int read_player_file();
263
264 // set a new highest level for player for this mission
265 }
266 #endif
267 void set_highest_level(uint8_t levelnum);
268
269 // gets the player's highest level from the file for this mission
270 int get_highest_level(void);
271
272 #if DXX_USE_MULTIPLAYER
273 namespace dsx {
274 struct netgame_info;
275 void read_netgame_profile(netgame_info *ng);
276 void write_netgame_profile(const netgame_info *ng);
277 }
278 #endif
279
280 #endif