SuperTuxKart
Loading...
Searching...
No Matches
user_config.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2006-2015 SuperTuxKart-Team
4// Modelled after Supertux's configfile.h
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU General Public License
8// as published by the Free Software Foundation; either version 3
9// of the License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20#ifndef HEADER_USER_CONFIG_HPP
21#define HEADER_USER_CONFIG_HPP
22
23/* The following config versions are currently used:
24 0: the 0.2 release config file, without config-version number
25 (so that defaults to 0)
26 1: Removed singleWindowMenu, newKeyboardStyle, oldStatusDisplay,
27 added config-version number
28 Version 1 can read version 0 without any problems, so
29 SUPPORTED_CONFIG_VERSION is 0.
30 2: Changed to SDL keyboard bindings
31 3: Added username (userid was used for ALL players)
32 4: Added username per player
33 5: Enabled jumping, which might cause a problem with old
34 config files (which have an unused entry for jump defined
35 --> if a kart control for (say) player 2 uses the same key as
36 jump for player 1, this problem is not noticed in 0.3, but will
37 cause an undefined game action now
38 6: Added stick configurations.
39*/
40#include <array>
41#include <iterator>
42#include <string>
43#include <map>
44#include <vector>
45#include <sstream>
46
47#include <irrString.h>
48#include <IrrCompileConfig.h>
49
50using irr::core::stringc;
51using irr::core::stringw;
52
53#include "utils/constants.hpp"
54#include "utils/no_copy.hpp"
55#include "utils/ptr_vector.hpp"
56#include "utils/time.hpp"
57
58class PlayerProfile;
59class SavedGrandPrix;
60class XMLNode;
61class UTFWriter;
62
68{
69 friend class GroupUserConfigParam;
70protected:
71 bool m_can_be_deleted = true;
72 std::string m_param_name;
73 std::string m_comment;
74public:
75 virtual ~UserConfigParam();
76 virtual void write(std::stringstream & stream) const = 0;
77 virtual void writeInner(std::stringstream & stream, int level = 0) const;
78 virtual void findYourDataInAChildOf(const XMLNode* node) = 0;
79 virtual void findYourDataInAnAttributeOf(const XMLNode* node) = 0;
80 virtual irr::core::stringc toString() const = 0;
81}; // UserConfigParam
82
83// ============================================================================
85{
86 std::vector<UserConfigParam*> m_attributes;
87 std::vector<GroupUserConfigParam*> m_children;
88public:
89 GroupUserConfigParam(const char* name, const char* comment=NULL);
90 GroupUserConfigParam(const char* param_name,
92 const char* comment = NULL);
93 void write(std::stringstream& stream) const;
94 void writeInner(std::stringstream& stream, int level = 0) const;
95 void findYourDataInAChildOf(const XMLNode* node);
96 void findYourDataInAnAttributeOf(const XMLNode* node);
97
98 void addChild(UserConfigParam* child);
99 void addChild(GroupUserConfigParam* child);
100 void clearChildren();
101
102 irr::core::stringc toString() const;
103}; // GroupUserConfigParam
104
105// ============================================================================
108template<typename T, typename U>
110{
111protected:
112 std::array<std::string, 3> m_key_names;
113 std::map<T, U> m_elements;
114 MapUserConfigParam(const char* param_name,
115 const char* comment)
116 {
117 m_param_name = param_name;
118 if (comment != NULL)
119 m_comment = comment;
120 }
121
122public:
123 MapUserConfigParam(const char* param_name,
124 const char* comment,
125 std::array<std::string, 3> key_names,
126 std::map<T, U> default_value);
127 MapUserConfigParam(const char* param_name,
129 const char* comment = NULL);
130 MapUserConfigParam(const char* param_name,
132 const char* comment, std::array<std::string, 3> key_names,
133 std::map<T, U> default_value);
134
135 void write(std::stringstream& stream) const;
136 void findYourDataInAChildOf(const XMLNode* node);
137 void findYourDataInAnAttributeOf(const XMLNode* node);
138
139 void addElement(T element, U value);
140
141 irr::core::stringc toString() const;
142
143 operator std::map<T, U>&()
144 {
145 return m_elements;
146 }
147 typename std::map<T, U>::iterator begin()
148 {
149 return m_elements.begin();
150 }
151 typename std::map<T, U>::iterator end()
152 {
153 return m_elements.end();
154 }
155 typename std::map<T, U>::iterator find(const T& key)
156 {
157 return m_elements.find(key);
158 }
159 size_t erase(const T& key)
160 {
161 return m_elements.erase(key);
162 }
163 bool empty() const
164 {
165 return m_elements.empty();
166 }
167 std::map<T, U>& operator=(const std::map<T, U>& v)
168 {
169 m_elements = std::map<T, U>(v);
170 return m_elements;
171 }
172 std::map<T, U>& operator=(const MapUserConfigParam& v)
173 {
174 m_elements = std::map<T,U>(v);
175 return m_elements;
176 }
177 size_t size() const
178 {
179 return m_elements.size();
180 }
181 U& operator[] (const T key)
182 {
183 return m_elements[key];
184 }
185 U& at(const T key)
186 {
187 return m_elements.at(key);
188 }
189}; // MapUserConfigParam
192// ============================================================================
194{
195protected:
196 int m_value;
197 int m_default_value;
198 IntUserConfigParam(const char* param_name, const char* comment)
199 {
200 m_param_name = param_name;
201 if (comment != NULL)
202 m_comment = comment;
203 }
204
205public:
206
207 IntUserConfigParam(int default_value, const char* param_name,
208 const char* comment = NULL);
209 IntUserConfigParam(int default_value, const char* param_name,
211 const char* comment = NULL);
212
213 void write(std::stringstream& stream) const;
214 void findYourDataInAChildOf(const XMLNode* node);
215 void findYourDataInAnAttributeOf(const XMLNode* node);
216
217 irr::core::stringc toString() const;
218 void setDefaultValue(int v) { m_value = m_default_value = v; }
219 void revertToDefaults() { m_value = m_default_value; }
220 int getDefaultValue() { return m_default_value; }
221 operator int() const { return m_value; }
222 int& operator++(int dummy) { m_value++; return m_value; }
223 int& operator=(const int& v) { m_value = v; return m_value; }
224 int& operator=(const IntUserConfigParam& v)
225 { m_value = (int)v; return m_value; }
226}; // IntUserConfigParam
227
228// ============================================================================
230{
231 StkTime::TimeType m_value;
232 StkTime::TimeType m_default_value;
233
234public:
235
236 TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name,
237 const char* comment = NULL);
238 TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name,
239 GroupUserConfigParam* group, const char* comment=NULL);
240
241 void write(std::stringstream& stream) const;
242 void findYourDataInAChildOf(const XMLNode* node);
243 void findYourDataInAnAttributeOf(const XMLNode* node);
244
245 irr::core::stringc toString() const;
246 void revertToDefaults() { m_value = m_default_value; }
247 operator StkTime::TimeType() const { return m_value; }
248 StkTime::TimeType& operator=(const StkTime::TimeType& v)
249 { m_value = v; return m_value; }
250 StkTime::TimeType& operator=(const TimeUserConfigParam& v)
251 { m_value = (int)v; return m_value; }
252}; // TimeUserConfigParam
253
254// ============================================================================
256{
257protected:
258 std::string m_value;
259 std::string m_default_value;
260 StringUserConfigParam(const char* param_name, const char* comment)
261 {
262 m_param_name = param_name;
263 if (comment != NULL)
264 m_comment = comment;
265 }
266
267public:
268
269 StringUserConfigParam(const char* default_value, const char* param_name,
270 const char* comment);
271 StringUserConfigParam(const char* default_value, const char* param_name,
273 const char* comment = NULL);
274
275 void write(std::stringstream& stream) const;
276 void findYourDataInAChildOf(const XMLNode* node);
277 void findYourDataInAnAttributeOf(const XMLNode* node);
278
279 void revertToDefaults() { m_value = m_default_value; }
280
281 std::string getDefaultValue() const { return m_default_value; }
282
283 irr::core::stringc toString() const { return m_value.c_str(); }
284
285 operator std::string() const { return m_value; }
286 std::string& operator=(const std::string& v)
287 { m_value = v; return m_value; }
288 std::string& operator=(const StringUserConfigParam& v)
289 { m_value = (std::string)v; return m_value; }
290
291 const char* c_str() const { return m_value.c_str(); }
292}; // StringUserConfigParam
293
294// ============================================================================
296{
297protected:
298 bool m_value;
299 bool m_default_value;
300 BoolUserConfigParam(const char* param_name, const char* comment)
301 {
302 m_param_name = param_name;
303 if (comment != NULL)
304 m_comment = comment;
305 }
306
307public:
308 BoolUserConfigParam(bool default_value, const char* param_name,
309 const char* comment = NULL);
310 BoolUserConfigParam(bool default_value, const char* param_name,
312 const char* comment = NULL);
313 void write(std::stringstream& stream) const;
314 void findYourDataInAChildOf(const XMLNode* node);
315 void findYourDataInAnAttributeOf(const XMLNode* node);
316
317 irr::core::stringc toString() const;
318 void revertToDefaults() { m_value = m_default_value; }
319 void setDefaultValue(bool v) { m_value = m_default_value = v; }
320
321 operator bool() const { return m_value; }
322 bool& operator=(const bool& v) { m_value = v; return m_value; }
323 bool& operator=(const BoolUserConfigParam& v)
324 { m_value = (bool)v; return m_value; }
325}; // BoolUserConfigParam
326
327// ============================================================================
329{
330protected:
331 float m_value;
332 float m_default_value;
333 FloatUserConfigParam(const char* param_name, const char* comment)
334 {
335 m_param_name = param_name;
336 if (comment != NULL)
337 m_comment = comment;
338 }
339
340public:
341 FloatUserConfigParam(float default_value, const char* param_name,
342 const char* comment = NULL);
343 FloatUserConfigParam(float default_value, const char* param_name,
345 const char* comment = NULL);
346
347 void write(std::stringstream& stream) const;
348 void findYourDataInAChildOf(const XMLNode* node);
349 void findYourDataInAnAttributeOf(const XMLNode* node);
350
351 irr::core::stringc toString() const;
352 void revertToDefaults() { m_value = m_default_value; }
353 void setDefaultValue(float v) { m_value = m_default_value = v; }
354
355 operator float() const { return m_value; }
356 float& operator=(const float& v) { m_value = v; return m_value; }
357 float& operator=(const FloatUserConfigParam& v)
358 { m_value = (float)v; return m_value; }
359}; // FloatUserConfigParam
360
361// ============================================================================
362enum AnimType {ANIMS_NONE = 0,
363 ANIMS_PLAYERS_ONLY = 1,
364 ANIMS_ALL = 2 };
365
366enum GeometryLevel
367{
369 GEOLEVEL_0 = 0,
371 GEOLEVEL_1 = 1,
373 GEOLEVEL_2 = 2
374};
375
376enum MultitouchControls
377{
378 MULTITOUCH_CONTROLS_UNDEFINED = 0,
379 MULTITOUCH_CONTROLS_STEERING_WHEEL = 1,
380 MULTITOUCH_CONTROLS_ACCELEROMETER = 2,
381 MULTITOUCH_CONTROLS_GYROSCOPE = 3,
382};
383
391#ifndef PARAM_PREFIX
392#define PARAM_PREFIX extern
393#endif
394
395#ifndef PARAM_DEFAULT
396#define PARAM_DEFAULT(X)
397#endif
398
399// ============================================================================
404{
405
406 // ---- Audio
407 PARAM_PREFIX GroupUserConfigParam m_audio_group
408 PARAM_DEFAULT( GroupUserConfigParam("Audio", "Audio Settings") );
409
410 PARAM_PREFIX BoolUserConfigParam m_sfx
411 PARAM_DEFAULT( BoolUserConfigParam(true, "sfx_on", &m_audio_group,
412 "Whether sound effects are enabled or not (true or false)") );
413 PARAM_PREFIX BoolUserConfigParam m_music
414 PARAM_DEFAULT( BoolUserConfigParam(true, "music_on",
415 &m_audio_group,
416 "Whether musics are enabled or not (true or false)") );
417 PARAM_PREFIX FloatUserConfigParam m_sfx_volume
418 PARAM_DEFAULT( FloatUserConfigParam(0.6f, "sfx_volume",
419 &m_audio_group, "Volume for sound effects, see openal AL_GAIN "
420 "for interpretation") );
421 PARAM_PREFIX FloatUserConfigParam m_music_volume
422 PARAM_DEFAULT( FloatUserConfigParam(0.5f, "music_volume",
423 &m_audio_group, "Music volume from 0.0 to 1.0") );
424
425 PARAM_PREFIX IntUserConfigParam m_volume_denominator
426 PARAM_DEFAULT( IntUserConfigParam(10, "volume_denominator",
427 &m_audio_group,
428 "Number of steps for volume adjustment") );
429
430 // ---- Race setup
431 PARAM_PREFIX GroupUserConfigParam m_race_setup_group
432 PARAM_DEFAULT( GroupUserConfigParam("RaceSetup",
433 "Race Setup Settings") );
434
435 PARAM_PREFIX IntUserConfigParam m_default_num_karts
436 PARAM_DEFAULT( IntUserConfigParam(4, "numkarts",
437 &m_race_setup_group,
438 "Default number of karts. -1 means use all") );
439 PARAM_PREFIX IntUserConfigParam m_num_laps
440 PARAM_DEFAULT( IntUserConfigParam(4, "numlaps",
441 &m_race_setup_group, "Default number of laps.") );
442 PARAM_PREFIX IntUserConfigParam m_gp_reverse
443 PARAM_DEFAULT( IntUserConfigParam(0, "gp-reverse",
444 &m_race_setup_group, "Default direction of GP tracks. 0=default, 1=no reverse, 2=all reverse, 3=Random") );
445 PARAM_PREFIX IntUserConfigParam m_rand_gp_num_tracks
446 PARAM_DEFAULT( IntUserConfigParam(1, "random-gp-num-tracks",
447 &m_race_setup_group, "Default number of tracks for random GP.") );
448 PARAM_PREFIX IntUserConfigParam m_ffa_time_limit
449 PARAM_DEFAULT(IntUserConfigParam(3, "ffa-time-limit",
450 &m_race_setup_group, "Time limit in ffa mode."));
451 PARAM_PREFIX BoolUserConfigParam m_use_ffa_mode
452 PARAM_DEFAULT(BoolUserConfigParam(false, "use-ffa-mode",
453 &m_race_setup_group, "Use ffa mode instead of 3 strikes battle."));
454 PARAM_PREFIX IntUserConfigParam m_lap_trial_time_limit
455 PARAM_DEFAULT(IntUserConfigParam(3, "lap-trial-time-limit",
456 &m_race_setup_group, "Time limit in lap trial mode."));
457 PARAM_PREFIX IntUserConfigParam m_num_goals
458 PARAM_DEFAULT( IntUserConfigParam(3, "numgoals",
459 &m_race_setup_group, "Default number of goals in soccer mode.") );
460 PARAM_PREFIX IntUserConfigParam m_soccer_default_team
461 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-default-team",
462 &m_race_setup_group, "Default team in soccer mode for single player.") );
463 PARAM_PREFIX IntUserConfigParam m_soccer_time_limit
464 PARAM_DEFAULT( IntUserConfigParam(3, "soccer-time-limit",
465 &m_race_setup_group, "Time limit in soccer mode.") );
466 PARAM_PREFIX BoolUserConfigParam m_soccer_use_time_limit
467 PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-use-time-limit",
468 &m_race_setup_group, "Enable time limit in soccer mode.") );
469 PARAM_PREFIX BoolUserConfigParam m_random_arena_item
470 PARAM_DEFAULT( BoolUserConfigParam(false, "random-arena-item",
471 &m_race_setup_group, "Enable random location of items in an arena.") );
472 PARAM_PREFIX IntUserConfigParam m_difficulty
473 PARAM_DEFAULT( IntUserConfigParam(0, "difficulty",
474 &m_race_setup_group,
475 "Default race difficulty. 0=easy, 1=medium, 2=hard, 3=supertux") );
476 PARAM_PREFIX IntUserConfigParam m_game_mode
477 PARAM_DEFAULT( IntUserConfigParam(0, "game_mode",
478 &m_race_setup_group,
479 "Game mode. 0=standard, 1=time trial, 2=follow "
480 "the leader, 3=3 strikes, 4=easter egg hunt, "
481 "5=soccer, 6=ghost replay") );
482 PARAM_PREFIX StringUserConfigParam m_default_kart
483 PARAM_DEFAULT( StringUserConfigParam("tux", "kart",
484 "Kart to select by default (the last used kart)") );
485 PARAM_PREFIX StringUserConfigParam m_last_used_kart_group
486 PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
487 "Last selected kart group") );
488 PARAM_PREFIX IntUserConfigParam m_soccer_red_ai_num
489 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-red-ai-num",
490 &m_race_setup_group, "Number of red AI karts in soccer mode.") );
491 PARAM_PREFIX IntUserConfigParam m_soccer_blue_ai_num
492 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-blue-ai-num",
493 &m_race_setup_group, "Number of blue AI karts in soccer mode.") );
494 PARAM_PREFIX BoolUserConfigParam m_karts_powerup_gui
495 PARAM_DEFAULT( BoolUserConfigParam(false, "karts-powerup-gui",
496 &m_race_setup_group, "Show other karts' held powerups in race gui.") );
497 PARAM_PREFIX BoolUserConfigParam m_soccer_player_list
498 PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-player-list",
499 &m_race_setup_group, "Show player list icon in soccer mode.") );
500 PARAM_PREFIX BoolUserConfigParam m_addon_tux_online
501 PARAM_DEFAULT( BoolUserConfigParam(false, "addon-tux-online",
502 &m_race_setup_group, "Always show online addon karts as tux when live join is on.") );
503 PARAM_PREFIX BoolUserConfigParam m_random_player_pos
504 PARAM_DEFAULT( BoolUserConfigParam(false, "random-player-pos",
505 &m_race_setup_group, "Randomize the position of the players at the start of a race. Doesn't apply to story mode.") );
506
507 // ---- Wiimote data
508 PARAM_PREFIX GroupUserConfigParam m_wiimote_group
509 PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
510 "Settings for the wiimote") );
511 PARAM_PREFIX FloatUserConfigParam m_wiimote_raw_max
512 PARAM_DEFAULT( FloatUserConfigParam(20.0f, "wiimote-raw-max",
513 &m_wiimote_group,
514 "At what raw input value maximum steering is reached (between 1 and 25).") );
515
516 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
517 PARAM_DEFAULT( FloatUserConfigParam(1.0f, "wiimote-weight-linear",
518 &m_wiimote_group,
519 "A weight applied to the linear component of mapping wiimote angle to steering angle"));
520
521 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_square
522 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-square",
523 &m_wiimote_group,
524 "A weight applied to the square component of mapping wiimote angle to steering angle"));
525
526 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_asin
527 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-asin",
528 &m_wiimote_group,
529 "A weight applied to the asin component of mapping wiimote angle to steering angle"));
530
531 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_sin
532 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-sin",
533 &m_wiimote_group,
534 "A weight applied to the sin component of mapping wiimote angle to steering angle"));
535
536 // ---- Multitouch device
537 PARAM_PREFIX GroupUserConfigParam m_multitouch_group
538 PARAM_DEFAULT( GroupUserConfigParam("Multitouch",
539 "Settings for the multitouch device") );
540
541 PARAM_PREFIX IntUserConfigParam m_multitouch_active
542 PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_active",
543 &m_multitouch_group,
544 "Enable multitouch support: 0 = disabled, 1 = if available, 2 = enabled") );
545
546 PARAM_PREFIX BoolUserConfigParam m_multitouch_draw_gui
547 PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_draw_gui",
548 &m_multitouch_group,
549 "Enable multitouch race GUI"));
550
551 PARAM_PREFIX BoolUserConfigParam m_multitouch_inverted
552 PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_inverted",
553 &m_multitouch_group,
554 "Draw steering wheel on right side.") );
555
556 PARAM_PREFIX BoolUserConfigParam m_multitouch_auto_acceleration
557 PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_auto_acceleration",
558 &m_multitouch_group,
559 "Auto acceleration for multitouch controls.") );
560
561 PARAM_PREFIX IntUserConfigParam m_multitouch_controls
562 PARAM_DEFAULT( IntUserConfigParam(0, "multitouch_controls",
563 &m_multitouch_group,
564 "Multitouch mode: 0 = undefined, 1 = steering wheel, 2 = accelerometer, 3 = gyroscope"));
565
566 PARAM_PREFIX FloatUserConfigParam m_multitouch_deadzone
567 PARAM_DEFAULT( FloatUserConfigParam(0.1f, "multitouch_deadzone",
568 &m_multitouch_group,
569 "A parameter in range [0, 0.5] that determines the zone that is "
570 "considered as centered in steering button."));
571
572 PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_x
573 PARAM_DEFAULT( FloatUserConfigParam(0.2f, "multitouch_sensitivity_x",
574 &m_multitouch_group,
575 "A parameter in range [0, 1.0] that determines the sensitivity for x axis."));
576
577 PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_y
578 PARAM_DEFAULT( FloatUserConfigParam(0.65f, "multitouch_sensitivity_y",
579 &m_multitouch_group,
580 "A parameter in range [0, 1.0] that determines the sensitivity for y axis."));
581
582 PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor
583 PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor",
584 &m_multitouch_group,
585 "A parameter that determines general accelerometer sensitivity."));
586
587 PARAM_PREFIX FloatUserConfigParam m_multitouch_scale
588 PARAM_DEFAULT( FloatUserConfigParam(1.2f, "multitouch_scale",
589 &m_multitouch_group,
590 "A parameter in range [0.5, 1.5] that determines the scale of the "
591 "multitouch interface."));
592
593 PARAM_PREFIX IntUserConfigParam m_screen_keyboard
594 PARAM_DEFAULT( IntUserConfigParam(0, "screen_keyboard_status",
595 &m_multitouch_group,
596 "STK screen keyboard status: 0 = disabled, 1 = enabled") );
597
598 // ---- GP start order
599 PARAM_PREFIX GroupUserConfigParam m_gp_start_order
600 PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
601 "Order karts start in GP") );
602 PARAM_PREFIX BoolUserConfigParam m_gp_most_points_first
603 PARAM_DEFAULT( BoolUserConfigParam(true, "most_points_first",
604 &m_gp_start_order,
605 "Starting order from most to least points (true) or other "
606 "way around (false)") );
607 PARAM_PREFIX BoolUserConfigParam m_gp_player_last
608 PARAM_DEFAULT( BoolUserConfigParam(false, "player_last",
609 &m_gp_start_order,
610 "Always put the player at the back or not (Bully mode).") );
611 PARAM_PREFIX StringUserConfigParam m_additional_gp_directory
612 PARAM_DEFAULT( StringUserConfigParam("", "additional_gp_directory",
613 "Directory with additional GP's."));
614
615 // ---- Video
616 PARAM_PREFIX GroupUserConfigParam m_video_group
617 PARAM_DEFAULT( GroupUserConfigParam("Video", "Video Settings") );
618
619 PARAM_PREFIX IntUserConfigParam m_real_width
620 PARAM_DEFAULT( IntUserConfigParam(1024, "real_width", &m_video_group,
621 "Screen/window real width in pixels before high dpi is applied") );
622 PARAM_PREFIX IntUserConfigParam m_real_height
623 PARAM_DEFAULT( IntUserConfigParam(768, "real_height", &m_video_group,
624 "Screen/window real height in pixels before high dpi is applied") );
625 PARAM_PREFIX IntUserConfigParam m_width
626 PARAM_DEFAULT( IntUserConfigParam(1024, "width", &m_video_group,
627 "Screen/window width in pixels, this value should not be edited") );
628 PARAM_PREFIX IntUserConfigParam m_height
629 PARAM_DEFAULT( IntUserConfigParam(768, "height", &m_video_group,
630 "Screen/window height in pixels, this value should not be edited") );
631 PARAM_PREFIX BoolUserConfigParam m_fullscreen
632 PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen",
633 &m_video_group) );
634 PARAM_PREFIX IntUserConfigParam m_prev_real_width
635 PARAM_DEFAULT( IntUserConfigParam(1024, "prev_real_width",
636 &m_video_group, "Previous real screen/window width") );
637 PARAM_PREFIX IntUserConfigParam m_prev_real_height
638 PARAM_DEFAULT( IntUserConfigParam(768, "prev_real_height",
639 &m_video_group,"Previous real screen/window height") );
640 PARAM_PREFIX BoolUserConfigParam m_prev_fullscreen
641 PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen",
642 &m_video_group) );
643
644
645 PARAM_PREFIX BoolUserConfigParam m_remember_window_location
646 PARAM_DEFAULT( BoolUserConfigParam(false, "remember_window_location",
647 &m_video_group) );
648 PARAM_PREFIX IntUserConfigParam m_window_x
649 PARAM_DEFAULT( IntUserConfigParam(-1, "window_x",
650 &m_video_group,"If remember_window_location is true") );
651 PARAM_PREFIX IntUserConfigParam m_window_y
652 PARAM_DEFAULT( IntUserConfigParam(-1, "window_y",
653 &m_video_group,"If remember_window_location is true") );
654
655 PARAM_PREFIX BoolUserConfigParam m_display_fps
656 PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps",
657 &m_video_group, "Display frame per seconds") );
658 PARAM_PREFIX BoolUserConfigParam m_display_story_mode_timer
659 PARAM_DEFAULT( BoolUserConfigParam(true, "show_story_mode_timer",
660 &m_video_group, "Display the story mode timer") );
661 PARAM_PREFIX BoolUserConfigParam m_speedrun_mode
662 PARAM_DEFAULT( BoolUserConfigParam(false, "show_speedrun_timer",
663 &m_video_group, "Display the speedrun timer") );
664 PARAM_PREFIX IntUserConfigParam m_max_fps
665 PARAM_DEFAULT( IntUserConfigParam(120, "max_fps",
666 &m_video_group, "Maximum fps, should be at least 60") );
667 PARAM_PREFIX BoolUserConfigParam m_force_legacy_device
668 PARAM_DEFAULT(BoolUserConfigParam(false, "force_legacy_device",
669 &m_video_group, "Force OpenGL 2 context, even if OpenGL 3 is available."));
670 PARAM_PREFIX BoolUserConfigParam split_screen_horizontally
671 PARAM_DEFAULT(BoolUserConfigParam(true, "split_screen_horizontally",
672 &m_video_group, "When playing a non-square amount of players (e.g. 2),"
673 " should it split horizontally (top/bottom)"));
674 PARAM_PREFIX BoolUserConfigParam m_texture_compression
675 PARAM_DEFAULT(BoolUserConfigParam(true, "enable_texture_compression",
676 &m_video_group, "Enable Texture Compression"));
681 PARAM_PREFIX IntUserConfigParam m_high_definition_textures
682 PARAM_DEFAULT(IntUserConfigParam(1, "enable_high_definition_textures",
683 &m_video_group, "Enable high definition textures. Bit flag: "
684 "bit 0 = enabled/disabled; bit 1 = set by user/set as default"));
685 PARAM_PREFIX BoolUserConfigParam m_glow
686 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_glow",
687 &m_video_group, "Enable Glow"));
688 PARAM_PREFIX BoolUserConfigParam m_bloom
689 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_bloom",
690 &m_video_group, "Enable Bloom"));
691 PARAM_PREFIX BoolUserConfigParam m_light_shaft
692 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_light_shaft",
693 &m_video_group, "Enable Light Shafts"));
694 PARAM_PREFIX BoolUserConfigParam m_dynamic_lights
695 PARAM_DEFAULT(BoolUserConfigParam(true, "enable_dynamic_lights",
696 &m_video_group, "Enable Dynamic Lights"));
697 PARAM_PREFIX BoolUserConfigParam m_dof
698 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_dof",
699 &m_video_group, "Enable Depth of Field"));
700 PARAM_PREFIX BoolUserConfigParam m_old_driver_popup
701 PARAM_DEFAULT(BoolUserConfigParam(true, "old_driver_popup",
702 &m_video_group, "Determines if popup message about too old drivers should be displayed."));
703 PARAM_PREFIX FloatUserConfigParam m_scale_rtts_factor
704 PARAM_DEFAULT(FloatUserConfigParam(1.0f, "scale_rtts_factor",
705 &m_video_group, "Custom value for RTTs resolution. "
706 "Value should be smaller or equal to 1.0"));
707 PARAM_PREFIX IntUserConfigParam m_max_texture_size
708 PARAM_DEFAULT(IntUserConfigParam(512, "max_texture_size",
709 &m_video_group, "Max texture size when high definition textures are "
710 "disabled"));
711
712 PARAM_PREFIX BoolUserConfigParam m_hq_mipmap
713 PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap",
714 &m_video_group, "Generate mipmap for textures using "
715 "high quality method with SSE"));
716 PARAM_PREFIX FloatUserConfigParam m_font_size
717 PARAM_DEFAULT( FloatUserConfigParam(3, "font_size",
718 &m_video_group, "The size of fonts. 0 is the smallest and 6 is the biggest") );
719
720#if defined(_IRR_COMPILE_WITH_DIRECT3D_9_) && defined(_M_ARM)
721 PARAM_PREFIX StringUserConfigParam m_render_driver
722 PARAM_DEFAULT( StringUserConfigParam("directx9", "render_driver",
723 &m_video_group, "Render video driver to use, at the moment gl, vulkan or directx9 is supported.") );
724#else
725 PARAM_PREFIX StringUserConfigParam m_render_driver
726 PARAM_DEFAULT( StringUserConfigParam("gl", "render_driver",
727 &m_video_group, "Render video driver to use, at the moment gl, vulkan or directx9 is supported.") );
728#endif
729
730#if defined(MOBILE_STK)
731 PARAM_PREFIX BoolUserConfigParam m_vulkan_fullscreen_desktop
732 PARAM_DEFAULT(BoolUserConfigParam(false, "vulkan_fullscreen_desktop",
733 &m_video_group, "Use SDL_WINDOW_FULLSCREEN_DESKTOP for vulkan device"));
734#else
735 PARAM_PREFIX BoolUserConfigParam m_vulkan_fullscreen_desktop
736 PARAM_DEFAULT(BoolUserConfigParam(true, "vulkan_fullscreen_desktop",
737 &m_video_group, "Use SDL_WINDOW_FULLSCREEN_DESKTOP for vulkan device"));
738#endif
739
740 PARAM_PREFIX BoolUserConfigParam m_non_ge_fullscreen_desktop
741 PARAM_DEFAULT(BoolUserConfigParam(false, "non_ge_fullscreen_desktop",
742 &m_video_group, "Use SDL_WINDOW_FULLSCREEN_DESKTOP for non-ge device"));
743
744 // ---- Recording
745 PARAM_PREFIX GroupUserConfigParam m_recording_group
746 PARAM_DEFAULT(GroupUserConfigParam("Recording",
747 "Recording Settings"));
748
749 PARAM_PREFIX BoolUserConfigParam m_limit_game_fps
750 PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps",
751 &m_recording_group, "Limit game framerate not beyond the fps of"
752 " recording video."));
753 PARAM_PREFIX IntUserConfigParam m_video_format
754 PARAM_DEFAULT(IntUserConfigParam(0, "video_format",
755 &m_recording_group, "Specify the video for record, which is the enum"
756 " of VideoFormat in libopenglrecorder. It will"
757 " auto fallback to MJPEG if libopenglrecorder was"
758 " not compiled with such video encoder."));
759
760 PARAM_PREFIX IntUserConfigParam m_audio_bitrate
761 PARAM_DEFAULT(IntUserConfigParam(112000, "audio_bitrate",
762 &m_recording_group, "Specify the bitrate for audio"));
763
764 PARAM_PREFIX IntUserConfigParam m_video_bitrate
765 PARAM_DEFAULT(IntUserConfigParam(20000, "video_bitrate",
766 &m_recording_group, "Specify the bitrate for video"));
767
768 PARAM_PREFIX IntUserConfigParam m_recorder_jpg_quality
769 PARAM_DEFAULT(IntUserConfigParam(90, "recorder_jpg_quality",
770 &m_recording_group, "Specify the jpg compression level of recorder"));
771
772 PARAM_PREFIX IntUserConfigParam m_record_fps
773 PARAM_DEFAULT(IntUserConfigParam(30, "record_fps",
774 &m_recording_group, "Specify the fps of recording video"));
775
776 // ---- Debug - not saved to config file
778 PARAM_PREFIX bool m_no_high_scores PARAM_DEFAULT(false);
779
781 PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false);
782
784 PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
785
787 PARAM_PREFIX bool m_keyboard_debug PARAM_DEFAULT(false);
788
790 PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false );
791
793 PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
794
797 PARAM_PREFIX bool m_material_debug PARAM_DEFAULT( false );
798
800 PARAM_PREFIX int m_track_debug PARAM_DEFAULT( false );
801
803 PARAM_PREFIX bool m_check_debug PARAM_DEFAULT( false );
804
806 PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );
807
809 PARAM_PREFIX bool m_fps_debug PARAM_DEFAULT(false);
810
812 PARAM_PREFIX bool m_arena_ai_stats PARAM_DEFAULT(false);
813
815 PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );
816
818 PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false );
819
821 PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false );
822
825 PARAM_PREFIX int m_verbosity PARAM_DEFAULT( 0 );
826
827 PARAM_PREFIX bool m_no_start_screen PARAM_DEFAULT( false );
828
829 PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false );
830
831 PARAM_PREFIX bool m_enforce_current_player PARAM_DEFAULT( false );
832
833 PARAM_PREFIX bool m_enable_sound PARAM_DEFAULT( true );
834
837 PARAM_PREFIX bool m_rendering_debug PARAM_DEFAULT( false );
838
840 PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false );
841
842 PARAM_PREFIX bool m_disable_addon_karts PARAM_DEFAULT( false );
843
844 PARAM_PREFIX bool m_disable_addon_tracks PARAM_DEFAULT( false );
845
846 // ---- Networking
847 PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks
848 PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks",
849 "Wan server bookmarks",
850 {{ "server-bookmarks", "server-name", "last-online" }}, {}));
851
852 PARAM_PREFIX StringToUIntUserConfigParam m_address_history
853 PARAM_DEFAULT(StringToUIntUserConfigParam("address-history",
854 "Last 5 IP addresses that user entered",
855 {{ "server-address", "address", "last-connection" }}, {}));
856
857 // These stk domains have only a record to each ipv6 stun below,
858 // so we can use this to know ipv4 address of nat64 gateway (if any)
859 PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers_v4
860 PARAM_DEFAULT(StringToUIntUserConfigParam("ipv4-stun-servers",
861 "The stun servers that will be used to know the public address "
862 "(ipv4 only) with port", {{ "stun-server", "address", "ping" }},
863 {
864 { "stunv4.linuxreviews.org:3478", 0u },
865 { "stunv4.7.supertuxkart.net:3478", 0u },
866 { "stunv4.8.supertuxkart.net:3478", 0u }
867 }
868 ));
869
870 PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers
871 PARAM_DEFAULT(StringToUIntUserConfigParam("ipv6-stun-servers",
872 "The stun servers that will be used to know the public address "
873 "(including ipv6) with port", {{ "stun-server", "address", "ping" }},
874 {
875 { "stun.linuxreviews.org:3478", 0u },
876 { "stun.supertuxkart.net:3478", 0u },
877 { "stun.stunprotocol.org:3478", 0u }
878 }
879 ));
880
881 PARAM_PREFIX GroupUserConfigParam m_network_group
882 PARAM_DEFAULT(GroupUserConfigParam("Network", "Network Settings"));
883 PARAM_PREFIX BoolUserConfigParam m_enable_network_splitscreen
884 PARAM_DEFAULT(BoolUserConfigParam(false, "enable-network-splitscreen",
885 &m_network_group, "The default value of enable splitscreen checkbox "
886 "in online screen."));
887 PARAM_PREFIX BoolUserConfigParam m_log_packets
888 PARAM_DEFAULT(BoolUserConfigParam(false, "log-network-packets",
889 &m_network_group, "If all network packets should be logged"));
890 PARAM_PREFIX BoolUserConfigParam m_random_client_port
891 PARAM_DEFAULT(BoolUserConfigParam(true, "random-client-port",
892 &m_network_group, "Use random port for client connection "
893 "(check stk_config.xml for default value)"));
894 PARAM_PREFIX BoolUserConfigParam m_random_server_port
895 PARAM_DEFAULT(BoolUserConfigParam(false, "random-server-port",
896 &m_network_group, "Use random port for server connection "
897 "(check stk_config.xml for default value)"));
898 PARAM_PREFIX BoolUserConfigParam m_lobby_chat
899 PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat",
900 &m_network_group, "Enable chatting in networking lobby, if off than "
901 "no chat message will be displayed from any players."));
902 PARAM_PREFIX BoolUserConfigParam m_race_chat
903 PARAM_DEFAULT(BoolUserConfigParam(true, "race-chat",
904 &m_network_group, "Enable chatting during races."));
905 PARAM_PREFIX BoolUserConfigParam m_ipv6_lan
906 PARAM_DEFAULT(BoolUserConfigParam(true, "ipv6-lan",
907 &m_network_group, "Enable IPv6 LAN server discovery."));
908 PARAM_PREFIX IntUserConfigParam m_max_players
909 PARAM_DEFAULT(IntUserConfigParam(8, "max-players",
910 &m_network_group, "Maximum number of players on the server "
911 "(for gui server creation."));
912 PARAM_PREFIX IntUserConfigParam m_timer_sync_difference_tolerance
913 PARAM_DEFAULT(IntUserConfigParam(5, "timer-sync-difference-tolerance",
914 &m_network_group, "Max time difference tolerance (in ms) to "
915 "synchronize timer with server."));
916 PARAM_PREFIX IntUserConfigParam m_default_ip_type
917 PARAM_DEFAULT(IntUserConfigParam(0, "default-ip-type",
918 &m_network_group, "Default IP type of this machine, "
919 "0 detect every time, 1 IPv4, 2 IPv6, 3 IPv6 NAT64, 4 Dual stack."));
920 PARAM_PREFIX BoolUserConfigParam m_lan_server_gp
921 PARAM_DEFAULT(BoolUserConfigParam(false, "lan-server-gp",
922 &m_network_group, "Show grand prix option in create LAN server "
923 "screen, false will show AI option."));
924 PARAM_PREFIX BoolUserConfigParam m_wan_server_gp
925 PARAM_DEFAULT(BoolUserConfigParam(true, "wan-server-gp",
926 &m_network_group, "Show grand prix option in create WAN server "
927 "screen, false will show AI option."));
928
929 // ---- Gamemode setup
930 PARAM_PREFIX UIntToUIntUserConfigParam m_num_karts_per_gamemode
931 PARAM_DEFAULT(UIntToUIntUserConfigParam("num-karts-per-gamemode",
932 "The Number of karts per gamemode.",
933 {{ "gamemode-list", "gamemode", "num-karts" }},
934 {
935 { 0u, 4u },
936 { 1002u, 5u },
937 { 1100u, 4u },
938 { 1101u, 4u },
939 { 2000u, 4u },
940 { 2001u, 4u }
941 }
942 ));
943
944 // ---- Graphic Quality
945 PARAM_PREFIX GroupUserConfigParam m_graphics_quality
946 PARAM_DEFAULT( GroupUserConfigParam("GFX",
947 "Graphics Quality Settings") );
948
949 PARAM_PREFIX IntUserConfigParam m_particles_effects
950 PARAM_DEFAULT( IntUserConfigParam(2, "particles-effecs",
951 &m_graphics_quality, "Particles effects: 0 disabled, 1 only important, 2 enabled") );
952
953 // This saves the actual user preference.
954 PARAM_PREFIX IntUserConfigParam m_xmas_mode
955 PARAM_DEFAULT( IntUserConfigParam(0, "christmas-mode",
956 &m_graphics_quality, "Christmas hats: 0 use current date, 1 always on, 2 always off") );
957
958 // This saves the actual user preference.
959 PARAM_PREFIX IntUserConfigParam m_easter_ear_mode
960 PARAM_DEFAULT(IntUserConfigParam(0, "easter-ear-mode",
961 &m_graphics_quality, "Easter Bunny Ears: 0 use current date, 1 always on, 2 always off"));
962
963 PARAM_PREFIX BoolUserConfigParam m_animated_characters
964 PARAM_DEFAULT( BoolUserConfigParam(true,
965 "animated-characters", &m_graphics_quality,
966 "Whether to display animated characters") );
967
968 PARAM_PREFIX IntUserConfigParam m_geometry_level
969 PARAM_DEFAULT( IntUserConfigParam(GEOLEVEL_0,
970 "geometry_level", &m_graphics_quality,
971 "Geometry quality 0=everything is displayed; "
972 "1=a few details are displayed; 2=lowest level, no details") );
973
974 PARAM_PREFIX IntUserConfigParam m_anisotropic
975 PARAM_DEFAULT( IntUserConfigParam(4, "anisotropic",
976 &m_graphics_quality,
977 "Quality of anisotropic filtering (usual values include 2-4-8-16; 0 to disable)") );
978
979 PARAM_PREFIX IntUserConfigParam m_swap_interval
980 PARAM_DEFAULT( IntUserConfigParam(0, "swap-interval",
981 &m_graphics_quality,
982 "Swap interval for vsync: 0 = disabled, 1 = full") );
983 PARAM_PREFIX BoolUserConfigParam m_motionblur
984 PARAM_DEFAULT( BoolUserConfigParam(false,
985 "motionblur_enabled", &m_graphics_quality,
986 "Whether motion blur should be enabled") );
987 PARAM_PREFIX BoolUserConfigParam m_mlaa
988 PARAM_DEFAULT( BoolUserConfigParam(false,
989 "mlaa", &m_graphics_quality,
990 "Whether MLAA anti-aliasing should be enabled") );
991 PARAM_PREFIX BoolUserConfigParam m_ssao
992 PARAM_DEFAULT(BoolUserConfigParam(false,
993 "ssao", &m_graphics_quality,
994 "Enable Screen Space Ambient Occlusion") );
995 PARAM_PREFIX BoolUserConfigParam m_light_scatter
996 PARAM_DEFAULT(BoolUserConfigParam(true,
997 "light_scatter", &m_graphics_quality,
998 "Enable light scattering shaders") );
999 PARAM_PREFIX IntUserConfigParam m_shadows_resolution
1000 PARAM_DEFAULT( IntUserConfigParam(0,
1001 "shadows_resolution", &m_graphics_quality,
1002 "Shadow resolution (0 = disabled") );
1003 PARAM_PREFIX BoolUserConfigParam m_degraded_IBL
1004 PARAM_DEFAULT(BoolUserConfigParam(true,
1005 "Degraded_IBL", &m_graphics_quality,
1006 "Disable specular IBL"));
1007
1008 // ---- Misc
1009 PARAM_PREFIX BoolUserConfigParam m_cache_overworld
1010 PARAM_DEFAULT( BoolUserConfigParam(true, "cache-overworld") );
1011
1012 // TODO : is this used with new code? does it still work?
1013 PARAM_PREFIX BoolUserConfigParam m_crashed
1014 PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") );
1015
1016 // ---- Camera
1017 PARAM_PREFIX GroupUserConfigParam m_camera_normal
1018 PARAM_DEFAULT( GroupUserConfigParam(
1019 "camera-normal",
1020 "Camera settings for player.") );
1021
1022 PARAM_PREFIX FloatUserConfigParam m_camera_distance
1023 PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
1024 &m_camera_normal,
1025 "Distance between kart and camera"));
1026
1027 PARAM_PREFIX FloatUserConfigParam m_camera_forward_up_angle
1028 PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1029 &m_camera_normal,
1030 "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1031
1032 PARAM_PREFIX BoolUserConfigParam m_camera_forward_smoothing
1033 PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1034 &m_camera_normal,
1035 "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1036
1037 PARAM_PREFIX FloatUserConfigParam m_camera_backward_distance
1038 PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1039 &m_camera_normal,
1040 "Distance between kart and camera (reverse)"));
1041
1042 PARAM_PREFIX FloatUserConfigParam m_camera_backward_up_angle
1043 PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1044 &m_camera_normal,
1045 "Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
1046
1047 PARAM_PREFIX IntUserConfigParam m_camera_fov
1048 PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1049 &m_camera_normal,
1050 "Focal distance (single player)"));
1051
1052 PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
1053 PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1054 "Use ball camera in soccer mode, instead of reverse") );
1055
1056 // ---- The present camera (default: Standard)
1057 PARAM_PREFIX IntUserConfigParam m_camera_present
1058 PARAM_DEFAULT( IntUserConfigParam(1, "camera-present",
1059 "The current used camera. 0=Custom; 1=Standard; 2=Drone chase") );
1060
1061 // ---- Standard camera settings
1062 PARAM_PREFIX GroupUserConfigParam m_standard_camera_settings
1063 PARAM_DEFAULT( GroupUserConfigParam(
1064 "standard-camera-settings",
1065 "Standard camera settings for player.") );
1066
1067 PARAM_PREFIX FloatUserConfigParam m_standard_camera_distance
1068 PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
1069 &m_standard_camera_settings,
1070 "Distance between kart and camera"));
1071
1072 PARAM_PREFIX FloatUserConfigParam m_standard_camera_forward_up_angle
1073 PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1074 &m_standard_camera_settings,
1075 "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1076
1077 PARAM_PREFIX BoolUserConfigParam m_standard_camera_forward_smoothing
1078 PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1079 &m_standard_camera_settings,
1080 "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1081
1082 PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_distance
1083 PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1084 &m_standard_camera_settings,
1085 "Distance between kart and camera (reverse)"));
1086
1087 PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_up_angle
1088 PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1089 &m_standard_camera_settings,
1090 "Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
1091
1092 PARAM_PREFIX IntUserConfigParam m_standard_camera_fov
1093 PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1094 &m_standard_camera_settings,
1095 "Focal distance (single player)"));
1096
1097 PARAM_PREFIX BoolUserConfigParam m_standard_reverse_look_use_soccer_cam
1098 PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1099 &m_standard_camera_settings,
1100 "Use ball camera in soccer mode, instead of reverse"));
1101
1102 // ---- Drone chase camera settings
1103 PARAM_PREFIX GroupUserConfigParam m_drone_camera_settings
1104 PARAM_DEFAULT( GroupUserConfigParam(
1105 "drone-camera-settings",
1106 "Drone chase camera settings for player.") );
1107
1108 PARAM_PREFIX FloatUserConfigParam m_drone_camera_distance
1109 PARAM_DEFAULT( FloatUserConfigParam(2.6, "distance",
1110 &m_drone_camera_settings,
1111 "Distance between kart and camera"));
1112
1113 PARAM_PREFIX FloatUserConfigParam m_drone_camera_forward_up_angle
1114 PARAM_DEFAULT( FloatUserConfigParam(33, "forward-up-angle",
1115 &m_drone_camera_settings,
1116 "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1117
1118 PARAM_PREFIX BoolUserConfigParam m_drone_camera_forward_smoothing
1119 PARAM_DEFAULT( BoolUserConfigParam(false, "forward-smoothing",
1120 &m_drone_camera_settings,
1121 "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1122
1123 PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_distance
1124 PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1125 &m_drone_camera_settings,
1126 "Distance between kart and camera (reverse)"));
1127
1128 PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_up_angle
1129 PARAM_DEFAULT( FloatUserConfigParam(10, "backward-up-angle",
1130 &m_drone_camera_settings,
1131 "Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
1132
1133 PARAM_PREFIX IntUserConfigParam m_drone_camera_fov
1134 PARAM_DEFAULT( IntUserConfigParam(100, "fov",
1135 &m_drone_camera_settings,
1136 "Focal distance (single player)"));
1137
1138 PARAM_PREFIX BoolUserConfigParam m_drone_reverse_look_use_soccer_cam
1139 PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1140 &m_drone_camera_settings,
1141 "Use ball camera in soccer mode, instead of reverse"));
1142
1143 // ---- Custom camera settings
1144 PARAM_PREFIX GroupUserConfigParam m_saved_camera_settings
1145 PARAM_DEFAULT( GroupUserConfigParam(
1146 "saved-camera-settings",
1147 "Saved custom camera settings for player.") );
1148
1149 PARAM_PREFIX FloatUserConfigParam m_saved_camera_distance
1150 PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
1151 &m_saved_camera_settings,
1152 "Distance between kart and camera"));
1153
1154 PARAM_PREFIX FloatUserConfigParam m_saved_camera_forward_up_angle
1155 PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1156 &m_saved_camera_settings,
1157 "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1158
1159 PARAM_PREFIX BoolUserConfigParam m_saved_camera_forward_smoothing
1160 PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1161 &m_saved_camera_settings,
1162 "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1163
1164 PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_distance
1165 PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1166 &m_saved_camera_settings,
1167 "Distance between kart and camera (reverse)"));
1168
1169 PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_up_angle
1170 PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1171 &m_saved_camera_settings,
1172 "Angle between camera and plane of kart (pitch) when the camera is pointing backwards. This is usually larger than the forward-up-angle, since the kart itself otherwise obstricts too much of the view"));
1173
1174 PARAM_PREFIX IntUserConfigParam m_saved_camera_fov
1175 PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1176 &m_saved_camera_settings,
1177 "Focal distance (single player)"));
1178
1179 PARAM_PREFIX BoolUserConfigParam m_saved_reverse_look_use_soccer_cam
1180 PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1181 &m_saved_camera_settings,
1182 "Use ball camera in soccer mode, instead of reverse"));
1183
1184 // camera in artist mode
1185 PARAM_PREFIX GroupUserConfigParam m_camera
1186 PARAM_DEFAULT( GroupUserConfigParam("camera",
1187 "(Debug) camera settings.") );
1188
1189 PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold
1190 PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold",
1191 &m_camera,
1192 "If the kart is driving backwards faster than this value,\n"
1193 "switch automatically to reverse camera (set to 0 to disable).") );
1194
1195 PARAM_PREFIX FloatUserConfigParam m_fpscam_direction_speed
1196 PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fpscam_rotation_speed",
1197 &m_camera,
1198 "How fast the first person camera's direction speed changes when\n"
1199 "moving the mouse (means acceleration).") );
1200
1201 PARAM_PREFIX FloatUserConfigParam m_fpscam_smooth_direction_max_speed
1202 PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fpscam_smooth_rotation_max_speed",
1203 &m_camera,
1204 "How fast the first person camera's direction can change.") );
1205
1206 PARAM_PREFIX FloatUserConfigParam m_fpscam_angular_velocity
1207 PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fpscam_angular_velocity",
1208 &m_camera,
1209 "How fast the first person camera's rotation speed changes.") );
1210
1211 PARAM_PREFIX FloatUserConfigParam m_fpscam_max_angular_velocity
1212 PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fpscam_max_angular_velocity",
1213 &m_camera,
1214 "How fast the first person camera can rotate.") );
1215
1216 PARAM_PREFIX StringUserConfigParam m_item_style
1217 PARAM_DEFAULT( StringUserConfigParam("items", "item_style",
1218 "Name of the .items file to use.") );
1219
1220 PARAM_PREFIX StringUserConfigParam m_last_track
1221 PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track",
1222 "Name of the last track used.") );
1223 PARAM_PREFIX StringUserConfigParam m_last_used_track_group
1224 PARAM_DEFAULT( StringUserConfigParam("all", "last_track_group",
1225 "Last selected track group") );
1226
1227 PARAM_PREFIX StringUserConfigParam m_discord_client_id
1228 PARAM_DEFAULT( StringUserConfigParam("817760324983324753", "discord_client_id",
1229 "Discord Client ID (Set to -1 to disable)") );
1230
1231 PARAM_PREFIX BoolUserConfigParam m_rich_presence_debug
1232 PARAM_DEFAULT( BoolUserConfigParam(false, "rich_presence_debug",
1233 "If debug logging should be enabled for rich presence") );
1234
1235 PARAM_PREFIX StringUserConfigParam m_skin_file
1236 PARAM_DEFAULT( StringUserConfigParam("peach", "skin_name",
1237 "Name of the skin to use") );
1238
1239 // ---- settings for minimap display
1240 PARAM_PREFIX GroupUserConfigParam m_minimap_setup_group
1241 PARAM_DEFAULT( GroupUserConfigParam("Minimap",
1242 "Minimap Setup Settings") );
1243
1244 PARAM_PREFIX IntUserConfigParam m_minimap_display
1245 PARAM_DEFAULT(IntUserConfigParam(0, "display",
1246 &m_minimap_setup_group, "display: 0 bottom-left, 1 middle-right, 2 hidden, 3 center"));
1247
1248 PARAM_PREFIX FloatUserConfigParam m_minimap_size
1249 PARAM_DEFAULT( FloatUserConfigParam(180.0f, "size",
1250 &m_minimap_setup_group, "Size of the the minimap (480 = full screen height; scaled afterwards)") );
1251
1252 PARAM_PREFIX FloatUserConfigParam m_minimap_ai_icon_size
1253 PARAM_DEFAULT( FloatUserConfigParam(16.0f, "ai-icon",
1254 &m_minimap_setup_group, "The size of the icons for the AI karts on the minimap.") );
1255
1256 PARAM_PREFIX FloatUserConfigParam m_minimap_player_icon_size
1257 PARAM_DEFAULT( FloatUserConfigParam(20.0f, "player-icon",
1258 &m_minimap_setup_group, "The size of the icons for the player kart.") );
1259
1260 // ---- settings for powerup display
1261 PARAM_PREFIX GroupUserConfigParam m_powerup_setup_group
1262 PARAM_DEFAULT( GroupUserConfigParam("PowerUp",
1263 "PowerUp Setup Settings") );
1264
1265 PARAM_PREFIX IntUserConfigParam m_powerup_display
1266 PARAM_DEFAULT(IntUserConfigParam(0, "display",
1267 &m_powerup_setup_group, "display: 0 center, 1 right side, 2 hidden (see karts' held powerups)"));
1268 PARAM_PREFIX FloatUserConfigParam m_powerup_size
1269 PARAM_DEFAULT( FloatUserConfigParam(64.0f, "powerup-icon-size",
1270 &m_powerup_setup_group, "Size of the powerup icon (scaled afterwards)") );
1271
1272 // ---- Settings for spectator camera
1273 PARAM_PREFIX GroupUserConfigParam m_spectator
1274 PARAM_DEFAULT( GroupUserConfigParam("Spectator",
1275 "Everything related to spectator mode.") );
1276
1277 PARAM_PREFIX FloatUserConfigParam m_spectator_camera_distance
1278 PARAM_DEFAULT( FloatUserConfigParam(6.75, "camera-distance", &m_spectator,
1279 "Distance between kart and camera.") );
1280 PARAM_PREFIX FloatUserConfigParam m_spectator_camera_angle
1281 PARAM_DEFAULT( FloatUserConfigParam(40.0, "camera-angle", &m_spectator,
1282 "Angle between ground, kart and camera.") );
1283
1284 // ---- Handicap
1285 PARAM_PREFIX GroupUserConfigParam m_handicap
1286 PARAM_DEFAULT( GroupUserConfigParam("Handicap",
1287 "Everything related to handicaps.") );
1288
1289 PARAM_PREFIX BoolUserConfigParam m_per_player_difficulty
1290 PARAM_DEFAULT( BoolUserConfigParam(false, "per_player_difficulty",
1291 &m_handicap,
1292 "If handicapped users can be selected") );
1293
1294 // ---- Internet related
1295
1296 PARAM_PREFIX IntUserConfigParam m_internet_status
1297 PARAM_DEFAULT( IntUserConfigParam(0, "enable_internet",
1298 "Status of internet: 0 user "
1299 "wasn't asked, 1: allowed, 2: "
1300 "not allowed") );
1301
1302 PARAM_PREFIX GroupUserConfigParam m_hw_report_group
1303 PARAM_DEFAULT( GroupUserConfigParam("HWReport",
1304 "Everything related to hardware configuration.") );
1305
1306 PARAM_PREFIX IntUserConfigParam m_last_hw_report_version
1307 PARAM_DEFAULT( IntUserConfigParam(0, "report-version", &m_hw_report_group,
1308 "Version of hardware report "
1309 "that was reported last") );
1310 PARAM_PREFIX IntUserConfigParam m_random_identifier
1311 PARAM_DEFAULT( IntUserConfigParam(0, "random-identifier", &m_hw_report_group,
1312 "A random number to avoid duplicated reports.") );
1313
1314 PARAM_PREFIX BoolUserConfigParam m_hw_report_enable
1315 PARAM_DEFAULT( BoolUserConfigParam( false,
1316 "hw-report-enabled",
1317 &m_hw_report_group,
1318 "If HW reports are enabled."));
1319
1320 // ---- User management
1321
1322 PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen
1323 PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen",
1324 "Always show the login screen even if last player's session was saved."));
1325
1326
1327 // ---- Addon server related entries
1328 PARAM_PREFIX GroupUserConfigParam m_addon_group
1329 PARAM_DEFAULT( GroupUserConfigParam("AddonServer",
1330 "Addon and news related settings") );
1331
1332 PARAM_PREFIX TimeUserConfigParam m_news_last_updated
1333 PARAM_DEFAULT( TimeUserConfigParam(0, "news_last_updated",
1334 &m_addon_group,
1335 "Time news was updated last.") );
1336
1337 PARAM_PREFIX IntUserConfigParam m_news_frequency
1338 PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency",
1339 &m_addon_group,
1340 "How often news should be updated.") );
1341
1342 PARAM_PREFIX StringUserConfigParam m_display_count
1343 PARAM_DEFAULT( StringUserConfigParam("", "news_display_count",
1344 &m_addon_group,
1345 "How often all news messages "
1346 "have been displayed") );
1347
1348 PARAM_PREFIX IntUserConfigParam m_last_important_message_id
1349 PARAM_DEFAULT( IntUserConfigParam(-1, "last_important_message_id",
1350 &m_addon_group,
1351 "Don't show important message "
1352 "with this or a lower id again") );
1353
1354 PARAM_PREFIX TimeUserConfigParam m_addons_last_updated
1355 PARAM_DEFAULT( TimeUserConfigParam(0, "addon_last_updated",
1356 &m_addon_group,
1357 "Time addon-list was updated last.") );
1358
1359 PARAM_PREFIX TimeUserConfigParam m_latest_addon_time
1360 PARAM_DEFAULT( TimeUserConfigParam(0, "latest_addon_time",
1361 &m_addon_group,
1362 "Latest approved addon time.") );
1363
1364 PARAM_PREFIX StringUserConfigParam m_language
1365 PARAM_DEFAULT( StringUserConfigParam("system", "language",
1366 "Which language to use (language code or 'system')") );
1367
1368 PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode
1369 PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
1370 "Whether to enable track debugging features") );
1371
1372 PARAM_PREFIX BoolUserConfigParam m_hide_gui
1373 PARAM_DEFAULT(BoolUserConfigParam(false, "debug_hide_gui",
1374 "Whether to hide the GUI (artist debug mode)"));
1375
1376 PARAM_PREFIX IntUserConfigParam m_unlock_everything
1377 PARAM_DEFAULT( IntUserConfigParam(0, "unlock_everything",
1378 "Enable all karts and tracks: 0 = disabled, "
1379 "1 = everything except final race, 2 = everything") );
1380
1381 PARAM_PREFIX StringUserConfigParam m_commandline
1382 PARAM_DEFAULT( StringUserConfigParam("", "commandline",
1383 "Allows one to set commandline args in config file") );
1384
1385 // TODO? implement blacklist for new irrlicht device and GUI
1386 PARAM_PREFIX std::vector<std::string> m_blacklist_res;
1387
1390
1392 enum { LOG_MEMORY = 0x0001,
1393 LOG_GUI = 0x0002,
1394 LOG_ADDONS = 0x0004,
1395 LOG_MISC = 0x0008,
1396 LOG_FLYABLE = 0x0010,
1397 LOG_ALL = 0xffff };
1398
1400 bool logMemory();
1402 bool logGUI ();
1404 bool logAddons();
1406 bool logFlyable();
1408 bool logMisc ();
1409
1410
1411}
1412#undef PARAM_PREFIX
1413#undef PARAM_SUFFIX
1414
1415// ============================================================================
1420class UserConfig : public NoCopy
1421{
1422private:
1423
1425 std::string m_filename;
1426 irr::core::stringw m_warning;
1427
1428 static const int m_current_config_version;
1429
1430public:
1433 UserConfig();
1434 ~UserConfig();
1435
1436 bool loadConfig();
1437 void saveConfig();
1438
1439 const irr::core::stringw& getWarning() { return m_warning; }
1440 void resetWarning() { m_warning=""; }
1441 void setWarning(irr::core::stringw& warning) { m_warning=warning; }
1442
1443}; // UserConfig
1444
1445
1446extern UserConfig *user_config;
1447
1448#endif
1449
1450/*EOF*/
Definition: user_config.hpp:296
Definition: user_config.hpp:329
Definition: user_config.hpp:85
void writeInner(std::stringstream &stream, int level=0) const
Writes an inner node.
Definition: user_config.cpp:129
Definition: user_config.hpp:194
ATM only map with 1 key and 1 value is supported.
Definition: user_config.hpp:110
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Class for managing player profiles (name, usage frequency, etc.).
Definition: player_profile.hpp:54
Definition: ptr_vector.hpp:44
Class for managing saved Grand-Prix's A list of all possible resumable GP's is stored in the user con...
Definition: saved_grand_prix.hpp:39
Definition: user_config.hpp:256
Definition: user_config.hpp:230
utility class used to write wide (UTF-16 or UTF-32, depending of size of wchar_t) XML files
Definition: utf_writer.hpp:35
The base of a set of small utilities to enable quickly adding/removing stuff to/from config painlessl...
Definition: user_config.hpp:68
virtual void writeInner(std::stringstream &stream, int level=0) const
Writes an inner node.
Definition: user_config.cpp:72
Class for managing general STK user configuration data.
Definition: user_config.hpp:1421
std::string m_filename
Filename of the user config file.
Definition: user_config.hpp:1425
void saveConfig()
Write settings to config file.
Definition: user_config.cpp:729
UserConfig()
Create the user config object; does not actually load it, UserConfig::loadConfig needs to be called.
Definition: user_config.cpp:653
bool loadConfig()
Load configuration values from file.
Definition: user_config.cpp:669
utility class used to parse XML files
Definition: xml_node.hpp:48
Contains all parameters that are stored in the user's config file.
Definition: user_config.hpp:404
bool logAddons()
Returns true if the user want additional messages related to addons.
Definition: user_config.cpp:770
bool logFlyable()
Returns true if the user want additional debug info for flyables.
Definition: user_config.cpp:774
bool logGUI()
Returns true if the user want additional messages related to GUI.
Definition: user_config.cpp:766
PARAM_PREFIX PtrVector< SavedGrandPrix > m_saved_grand_prix_list
List of all saved GPs.
Definition: user_config.hpp:1389
bool logMemory()
Returns true if the user want additional messages for memory usage.
Definition: user_config.cpp:762
bool logMisc()
Returns true if the user want additional messages for general items.
Definition: user_config.cpp:778