/
Config.h
253 lines (195 loc) · 4.9 KB
/
Config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/*
* Copyright 2011-2017 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Arx Libertatis is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ARX_CORE_CONFIG_H
#define ARX_CORE_CONFIG_H
#include <string>
#include "audio/AudioTypes.h"
#include "input/InputKey.h"
#include "io/fs/FilePath.h"
#include "math/Types.h"
#include "math/Vector.h"
//! Enum for all the controlling actions
enum ControlAction {
CONTROLS_CUST_JUMP = 0,
CONTROLS_CUST_MAGICMODE,
CONTROLS_CUST_STEALTHMODE,
CONTROLS_CUST_WALKFORWARD,
CONTROLS_CUST_WALKBACKWARD,
CONTROLS_CUST_STRAFELEFT,
CONTROLS_CUST_STRAFERIGHT,
CONTROLS_CUST_LEANLEFT,
CONTROLS_CUST_LEANRIGHT,
CONTROLS_CUST_CROUCH,
CONTROLS_CUST_USE,
CONTROLS_CUST_ACTION,
CONTROLS_CUST_INVENTORY,
CONTROLS_CUST_BOOK,
CONTROLS_CUST_BOOKCHARSHEET,
CONTROLS_CUST_BOOKSPELL,
CONTROLS_CUST_BOOKMAP,
CONTROLS_CUST_BOOKQUEST,
CONTROLS_CUST_DRINKPOTIONLIFE,
CONTROLS_CUST_DRINKPOTIONMANA,
CONTROLS_CUST_DRINKPOTIONCURE,
CONTROLS_CUST_TORCH,
CONTROLS_CUST_PRECAST1,
CONTROLS_CUST_PRECAST2,
CONTROLS_CUST_PRECAST3,
CONTROLS_CUST_WEAPON,
CONTROLS_CUST_QUICKLOAD,
CONTROLS_CUST_QUICKSAVE,
CONTROLS_CUST_TURNLEFT,
CONTROLS_CUST_TURNRIGHT,
CONTROLS_CUST_LOOKUP,
CONTROLS_CUST_LOOKDOWN,
CONTROLS_CUST_STRAFE,
CONTROLS_CUST_CENTERVIEW,
CONTROLS_CUST_FREELOOK,
CONTROLS_CUST_PREVIOUS,
CONTROLS_CUST_NEXT,
CONTROLS_CUST_CROUCHTOGGLE,
CONTROLS_CUST_UNEQUIPWEAPON,
CONTROLS_CUST_CANCELCURSPELL,
CONTROLS_CUST_MINIMAP,
CONTROLS_CUST_TOGGLE_FULLSCREEN,
CONTROLS_CUST_CONSOLE,
NUM_ACTION_KEY
};
enum CinematicWidescreenMode {
CinematicLetterbox = 0,
CinematicHardEdges = 1,
CinematicFadeEdges = 2
};
enum UIScaleFilter {
UIFilterNearest = 0,
UIFilterBilinear = 1
};
enum QuickLevelTransition {
NoQuickLevelTransition = 0,
JumpToChangeLevel = 1,
ChangeLevelImmediately = 2,
};
enum AutoReadyWeapon {
NeverAutoReadyWeapon = 0,
AutoReadyWeaponNearEnemies = 1,
AlwaysAutoReadyWeapon = 2,
};
struct ActionKey {
explicit ActionKey(InputKeyId key_0 = UNUSED,
InputKeyId key_1 = UNUSED) {
if(key_0 != UNUSED && key_0 == key_1) {
key_1 = UNUSED;
}
key[0] = key_0;
key[1] = key_1;
}
InputKeyId key[2];
static const InputKeyId UNUSED = -1;
};
class Config {
public:
// section 'language'
std::string language;
// section 'video'
struct {
std::string renderer;
Vec2i resolution;
bool fullscreen;
int levelOfDetail;
float fogDistance;
float gamma;
bool antialiasing;
int vsync;
int fpsLimit;
int maxAnisotropicFiltering;
bool colorkeyAntialiasing;
int alphaCutoutAntialiasing;
int bufferSize;
std::string bufferUpload;
} video;
// section 'interface'
struct {
bool showCrosshair;
bool limitSpeechWidth;
CinematicWidescreenMode cinematicWidescreenMode;
float hudScale;
bool hudScaleInteger;
bool scaleCursorWithHud;
UIScaleFilter hudScaleFilter;
Vec2i thumbnailSize;
} interface;
// section 'window'
struct {
Vec2i size;
bool minimizeOnFocusLost;
} window;
// section 'audio'
struct {
std::string backend;
std::string device;
float volume;
float sfxVolume;
float speechVolume;
float ambianceVolume;
bool eax;
audio::HRTFAttribute hrtf;
bool muteOnFocusLost;
} audio;
// section 'input'
struct {
bool invertMouse;
AutoReadyWeapon autoReadyWeapon;
bool mouseLookToggle;
bool autoDescription;
int mouseSensitivity;
int mouseAcceleration;
bool rawMouseInput;
bool borderTurning;
bool useAltRuneRecognition;
QuickLevelTransition quickLevelTransition;
bool allowConsole;
} input;
// section 'key'
ActionKey actions[NUM_ACTION_KEY];
enum MigrationStatus {
OriginalAssets = 0,
CaseSensitiveFilenames = 1
};
// section 'misc'
struct {
bool forceToggle; // should be in input?
MigrationStatus migration;
int quicksaveSlots;
std::string debug; //!< Logger debug levels.
} misc;
public:
void setActionKey(ControlAction action, size_t index, InputKeyId key);
void setDefaultActionKeys();
/*!
* Saves all config entries to a file.
* \return true if the config was saved successfully.
*/
bool save();
bool init(const fs::path & file);
void setOutputFile(const fs::path & _file);
private:
fs::path file;
};
extern Config config;
#endif // ARX_CORE_CONFIG_H