Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 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
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
29
#if defined(DXX_BUILD_DESCENT_I)
30
#include "pstypes.h"
31
#include "player.h"
32
#elif defined(DXX_BUILD_DESCENT_II)
33
#include "escort.h"
34
 
35
enum class MissileViewMode : uint8_t
36
{
37
        None,
38
        EnabledSelfOnly,
39
        EnabledSelfAndAllies,
40
};
41
#endif
42
 
43
#include "gameplayopt.h"
44
#include <cstdint>
45
 
46
#define N_SAVE_SLOTS    10
47
#define GAME_NAME_LEN   25      // +1 for terminating zero = 26
48
 
49
#ifdef dsx
50
#if defined(DXX_BUILD_DESCENT_I)
51
namespace dsx {
52
// NOTE: Obsolete structure - only kept for compability of shareware plr file
53
struct saved_game_sw
54
{
55
        char            name[GAME_NAME_LEN+1];          //extra char for terminating zero
56
        struct player_rw sg_player;
57
        int             difficulty_level;               //which level game is played at
58
        int             primary_weapon;         //which weapon selected
59
        int             secondary_weapon;               //which weapon selected
60
        int             cockpit_mode;                   //which cockpit mode selected
61
        int             window_w,window_h;      //size of player's window
62
        int             next_level_num;         //which level we're going to
63
        int             auto_leveling_on;               //does player have autoleveling on?
64
} __pack__;
65
 
66
void plyr_save_stats();
67
}
68
#endif
69
#endif
70
 
71
struct hli
72
{
73
        std::array<char, 9> Shortname;
74
        uint8_t LevelNum;
75
};
76
 
77
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
78
#include "kconfig.h"
79
#include "multi.h"
80
#include "fwd-weapon.h"
81
#include "d_array.h"
82
 
83
enum class FiringAutoselectMode : uint8_t
84
{
85
        Immediate,
86
        Never,
87
        Delayed,
88
};
89
 
90
enum class HudType : uint8_t
91
{
92
        Standard,
93
        Alternate1,
94
        Alternate2,
95
        Hidden,
96
};
97
 
98
enum class RespawnPress : uint8_t
99
{
100
        Any,
101
        Fire,
102
};
103
 
104
enum MouselookMode : uint8_t
105
{
106
        Singleplayer = 1,
107
        MPCoop = 2,
108
        MPAnarchy = 4,
109
};
110
 
111
struct player_config : prohibit_void_ptr<player_config>
112
{
113
        ubyte ControlType;
114
        HudType HudMode;
115
        RespawnPress RespawnMode;
116
        uint8_t MouselookFlags;
117
        using primary_weapon_order = std::array<uint8_t, MAX_PRIMARY_WEAPONS + 1>;
118
        using secondary_weapon_order = std::array<uint8_t, MAX_SECONDARY_WEAPONS + 1>;
119
        primary_weapon_order PrimaryOrder;
120
        secondary_weapon_order SecondaryOrder;
121
        struct KeySettings {
122
                enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_keyboard> Keyboard;
123
#if DXX_MAX_JOYSTICKS
124
                enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_joystick> Joystick;
125
#endif
126
                enumerated_array<uint8_t, MAX_CONTROLS, dxx_kconfig_ui_kc_mouse> Mouse;
127
        } KeySettings;
128
        std::array<uint8_t, MAX_DXX_REBIRTH_CONTROLS> KeySettingsRebirth;
129
        Difficulty_level_type DefaultDifficulty;
130
        int AutoLeveling;
131
        uint16_t NHighestLevels;
132
        std::array<hli, MAX_MISSIONS> HighestLevels;
133
        std::array<int, 5> KeyboardSens;
134
        std::array<int, 6> JoystickSens;
135
        std::array<int, 6> JoystickDead;
136
        std::array<int, 6> JoystickLinear;
137
        std::array<int, 6> JoystickSpeed;
138
        ubyte MouseFlightSim;
139
        std::array<int, 6> MouseSens;
140
        std::array<int, 6> MouseOverrun;
141
        int MouseFSDead;
142
        int MouseFSIndicator;
143
        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.
144
#if defined(DXX_BUILD_DESCENT_II)
145
        std::array<int, 2> Cockpit3DView;
146
#endif
147
        std::array<ntstring<MAX_MESSAGE_LEN - 1>, 4> NetworkMessageMacro;
148
        int NetlifeKills;
149
        int NetlifeKilled;
150
        ubyte ReticleType;
151
        std::array<int, 4> ReticleRGBA;
152
        int ReticleSize;
153
#if defined(DXX_BUILD_DESCENT_II)
154
        MissileViewMode MissileViewEnabled;
155
        uint8_t ThiefModifierFlags;
156
        int HeadlightActiveDefault;
157
        int GuidedInBigWindow;
158
        ntstring<GUIDEBOT_NAME_LEN> GuidebotName, GuidebotNameReal;
159
        int EscortHotKeys;
160
#endif
161
        int PersistentDebris;
162
        int PRShot;
163
        ubyte NoRedundancy;
164
        ubyte MultiMessages;
165
        ubyte MultiPingHud;
166
        ubyte NoRankings;
167
#if defined(DXX_BUILD_DESCENT_I)
168
        ubyte BombGauge;
169
#endif
170
        ubyte AutomapFreeFlight;
171
        FiringAutoselectMode NoFireAutoselect;
172
        ubyte CycleAutoselectOnly;
173
        uint8_t CloakInvulTimer;
174
        union {
175
                /* For now, manage all these choices in a single variable, but
176
                 * give them separate names to make them easier to find.
177
                 */
178
                int AlphaEffects;
179
                int AlphaBlendMineExplosion;
180
                int AlphaBlendMarkers;
181
                int AlphaBlendFireballs;
182
                int AlphaBlendPowerups;
183
                int AlphaBlendLasers;
184
                int AlphaBlendWeapons;
185
                int AlphaBlendEClips;
186
        };
187
        int DynLightColor;
188
        d_sp_gameplay_options SPGameplayOptions;
189
};
190
#endif
191
 
192
extern struct player_config PlayerCfg;
193
 
194
#ifndef EZERO
195
#define EZERO 0
196
#endif
197
 
198
// Used to save kconfig values to disk.
199
#ifdef dsx
200
namespace dsx {
201
 
202
extern const struct player_config::KeySettings DefaultKeySettings;
203
 
204
void write_player_file();
205
 
206
int new_player_config();
207
 
208
int read_player_file();
209
 
210
// set a new highest level for player for this mission
211
}
212
#endif
213
void set_highest_level(uint8_t levelnum);
214
 
215
// gets the player's highest level from the file for this mission
216
int get_highest_level(void);
217
 
218
namespace dsx {
219
struct netgame_info;
220
void read_netgame_profile(struct netgame_info *ng);
221
void write_netgame_profile(struct netgame_info *ng);
222
}
223
 
224
#endif