SuperTuxKart
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 
50 using irr::core::stringc;
51 using 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 
58 class PlayerProfile;
59 class SavedGrandPrix;
60 class XMLNode;
61 class UTFWriter;
62 
68 {
69  friend class GroupUserConfigParam;
70 protected:
71  bool m_can_be_deleted = true;
72  std::string m_param_name;
73  std::string m_comment;
74 public:
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;
88 public:
89  GroupUserConfigParam(const char* name, const char* comment=NULL);
90  GroupUserConfigParam(const char* param_name,
91  GroupUserConfigParam* group,
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 // ============================================================================
108 template<typename T, typename U>
110 {
111 protected:
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 
122 public:
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,
128  GroupUserConfigParam* group,
129  const char* comment = NULL);
130  MapUserConfigParam(const char* param_name,
131  GroupUserConfigParam* group,
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 {
195 protected:
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 
205 public:
206 
207  IntUserConfigParam(int default_value, const char* param_name,
208  const char* comment = NULL);
209  IntUserConfigParam(int default_value, const char* param_name,
210  GroupUserConfigParam* group,
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 
234 public:
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 {
257 protected:
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 
267 public:
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,
272  GroupUserConfigParam* group,
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 {
297 protected:
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 
307 public:
308  BoolUserConfigParam(bool default_value, const char* param_name,
309  const char* comment = NULL);
310  BoolUserConfigParam(bool default_value, const char* param_name,
311  GroupUserConfigParam* group,
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 {
330 protected:
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 
340 public:
341  FloatUserConfigParam(float default_value, const char* param_name,
342  const char* comment = NULL);
343  FloatUserConfigParam(float default_value, const char* param_name,
344  GroupUserConfigParam* group,
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 // ============================================================================
362 enum AnimType {ANIMS_NONE = 0,
363  ANIMS_PLAYERS_ONLY = 1,
364  ANIMS_ALL = 2 };
365 
366 enum GeometryLevel
367 {
369  GEOLEVEL_0 = 0,
371  GEOLEVEL_1 = 1,
373  GEOLEVEL_2 = 2
374 };
375 
376 enum 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  // ---- Race setup
426  PARAM_PREFIX GroupUserConfigParam m_race_setup_group
427  PARAM_DEFAULT( GroupUserConfigParam("RaceSetup",
428  "Race Setup Settings") );
429 
430  PARAM_PREFIX IntUserConfigParam m_default_num_karts
431  PARAM_DEFAULT( IntUserConfigParam(4, "numkarts",
432  &m_race_setup_group,
433  "Default number of karts. -1 means use all") );
434  PARAM_PREFIX IntUserConfigParam m_num_laps
435  PARAM_DEFAULT( IntUserConfigParam(4, "numlaps",
436  &m_race_setup_group, "Default number of laps.") );
437  PARAM_PREFIX IntUserConfigParam m_gp_reverse
438  PARAM_DEFAULT( IntUserConfigParam(0, "gp-reverse",
439  &m_race_setup_group, "Default direction of GP tracks. 0=default, 1=no reverse, 2=all reverse, 3=Random") );
440  PARAM_PREFIX IntUserConfigParam m_rand_gp_num_tracks
441  PARAM_DEFAULT( IntUserConfigParam(1, "random-gp-num-tracks",
442  &m_race_setup_group, "Default number of tracks for random GP.") );
443  PARAM_PREFIX IntUserConfigParam m_ffa_time_limit
444  PARAM_DEFAULT(IntUserConfigParam(3, "ffa-time-limit",
445  &m_race_setup_group, "Time limit in ffa mode."));
446  PARAM_PREFIX BoolUserConfigParam m_use_ffa_mode
447  PARAM_DEFAULT(BoolUserConfigParam(false, "use-ffa-mode",
448  &m_race_setup_group, "Use ffa mode instead of 3 strikes battle."));
449  PARAM_PREFIX IntUserConfigParam m_lap_trial_time_limit
450  PARAM_DEFAULT(IntUserConfigParam(3, "lap-trial-time-limit",
451  &m_race_setup_group, "Time limit in lap trial mode."));
452  PARAM_PREFIX IntUserConfigParam m_num_goals
453  PARAM_DEFAULT( IntUserConfigParam(3, "numgoals",
454  &m_race_setup_group, "Default number of goals in soccer mode.") );
455  PARAM_PREFIX IntUserConfigParam m_soccer_default_team
456  PARAM_DEFAULT( IntUserConfigParam(0, "soccer-default-team",
457  &m_race_setup_group, "Default team in soccer mode for single player.") );
458  PARAM_PREFIX IntUserConfigParam m_soccer_time_limit
459  PARAM_DEFAULT( IntUserConfigParam(3, "soccer-time-limit",
460  &m_race_setup_group, "Time limit in soccer mode.") );
461  PARAM_PREFIX BoolUserConfigParam m_soccer_use_time_limit
462  PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-use-time-limit",
463  &m_race_setup_group, "Enable time limit in soccer mode.") );
464  PARAM_PREFIX BoolUserConfigParam m_random_arena_item
465  PARAM_DEFAULT( BoolUserConfigParam(false, "random-arena-item",
466  &m_race_setup_group, "Enable random location of items in an arena.") );
467  PARAM_PREFIX IntUserConfigParam m_difficulty
468  PARAM_DEFAULT( IntUserConfigParam(0, "difficulty",
469  &m_race_setup_group,
470  "Default race difficulty. 0=easy, 1=medium, 2=hard, 3=supertux") );
471  PARAM_PREFIX IntUserConfigParam m_game_mode
472  PARAM_DEFAULT( IntUserConfigParam(0, "game_mode",
473  &m_race_setup_group,
474  "Game mode. 0=standard, 1=time trial, 2=follow "
475  "the leader, 3=3 strikes, 4=easter egg hunt, "
476  "5=soccer, 6=ghost replay") );
477  PARAM_PREFIX StringUserConfigParam m_default_kart
478  PARAM_DEFAULT( StringUserConfigParam("tux", "kart",
479  "Kart to select by default (the last used kart)") );
480  PARAM_PREFIX StringUserConfigParam m_last_used_kart_group
481  PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
482  "Last selected kart group") );
483  PARAM_PREFIX IntUserConfigParam m_soccer_red_ai_num
484  PARAM_DEFAULT( IntUserConfigParam(0, "soccer-red-ai-num",
485  &m_race_setup_group, "Number of red AI karts in soccer mode.") );
486  PARAM_PREFIX IntUserConfigParam m_soccer_blue_ai_num
487  PARAM_DEFAULT( IntUserConfigParam(0, "soccer-blue-ai-num",
488  &m_race_setup_group, "Number of blue AI karts in soccer mode.") );
489  PARAM_PREFIX BoolUserConfigParam m_karts_powerup_gui
490  PARAM_DEFAULT( BoolUserConfigParam(false, "karts-powerup-gui",
491  &m_race_setup_group, "Show other karts' held powerups in race gui.") );
492  PARAM_PREFIX BoolUserConfigParam m_soccer_player_list
493  PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-player-list",
494  &m_race_setup_group, "Show player list icon in soccer mode.") );
495  PARAM_PREFIX BoolUserConfigParam m_addon_tux_online
496  PARAM_DEFAULT( BoolUserConfigParam(false, "addon-tux-online",
497  &m_race_setup_group, "Always show online addon karts as tux when live join is on.") );
498  PARAM_PREFIX BoolUserConfigParam m_random_player_pos
499  PARAM_DEFAULT( BoolUserConfigParam(false, "random-player-pos",
500  &m_race_setup_group, "Randomize the position of the players at the start of a race. Doesn't apply to story mode.") );
501 
502  // ---- Wiimote data
503  PARAM_PREFIX GroupUserConfigParam m_wiimote_group
504  PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
505  "Settings for the wiimote") );
506  PARAM_PREFIX FloatUserConfigParam m_wiimote_raw_max
507  PARAM_DEFAULT( FloatUserConfigParam(20.0f, "wiimote-raw-max",
508  &m_wiimote_group,
509  "At what raw input value maximum steering is reached (between 1 and 25).") );
510 
511  PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
512  PARAM_DEFAULT( FloatUserConfigParam(1.0f, "wiimote-weight-linear",
513  &m_wiimote_group,
514  "A weight applied to the linear component of mapping wiimote angle to steering angle"));
515 
516  PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_square
517  PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-square",
518  &m_wiimote_group,
519  "A weight applied to the square component of mapping wiimote angle to steering angle"));
520 
521  PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_asin
522  PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-asin",
523  &m_wiimote_group,
524  "A weight applied to the asin component of mapping wiimote angle to steering angle"));
525 
526  PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_sin
527  PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-sin",
528  &m_wiimote_group,
529  "A weight applied to the sin component of mapping wiimote angle to steering angle"));
530 
531  // ---- Multitouch device
532  PARAM_PREFIX GroupUserConfigParam m_multitouch_group
533  PARAM_DEFAULT( GroupUserConfigParam("Multitouch",
534  "Settings for the multitouch device") );
535 
536  PARAM_PREFIX IntUserConfigParam m_multitouch_active
537  PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_active",
538  &m_multitouch_group,
539  "Enable multitouch support: 0 = disabled, 1 = if available, 2 = enabled") );
540 
541  PARAM_PREFIX BoolUserConfigParam m_multitouch_draw_gui
542  PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_draw_gui",
543  &m_multitouch_group,
544  "Enable multitouch race GUI"));
545 
546  PARAM_PREFIX BoolUserConfigParam m_multitouch_inverted
547  PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_inverted",
548  &m_multitouch_group,
549  "Draw steering wheel on right side.") );
550 
551  PARAM_PREFIX BoolUserConfigParam m_multitouch_auto_acceleration
552  PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_auto_acceleration",
553  &m_multitouch_group,
554  "Auto acceleration for multitouch controls.") );
555 
556  PARAM_PREFIX IntUserConfigParam m_multitouch_controls
557  PARAM_DEFAULT( IntUserConfigParam(0, "multitouch_controls",
558  &m_multitouch_group,
559  "Multitouch mode: 0 = undefined, 1 = steering wheel, 2 = accelerometer, 3 = gyroscope"));
560 
561  PARAM_PREFIX FloatUserConfigParam m_multitouch_deadzone
562  PARAM_DEFAULT( FloatUserConfigParam(0.1f, "multitouch_deadzone",
563  &m_multitouch_group,
564  "A parameter in range [0, 0.5] that determines the zone that is "
565  "considered as centered in steering button."));
566 
567  PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_x
568  PARAM_DEFAULT( FloatUserConfigParam(0.2f, "multitouch_sensitivity_x",
569  &m_multitouch_group,
570  "A parameter in range [0, 1.0] that determines the sensitivity for x axis."));
571 
572  PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_y
573  PARAM_DEFAULT( FloatUserConfigParam(0.65f, "multitouch_sensitivity_y",
574  &m_multitouch_group,
575  "A parameter in range [0, 1.0] that determines the sensitivity for y axis."));
576 
577  PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor
578  PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor",
579  &m_multitouch_group,
580  "A parameter that determines general accelerometer sensitivity."));
581 
582  PARAM_PREFIX FloatUserConfigParam m_multitouch_scale
583  PARAM_DEFAULT( FloatUserConfigParam(1.2f, "multitouch_scale",
584  &m_multitouch_group,
585  "A parameter in range [0.5, 1.5] that determines the scale of the "
586  "multitouch interface."));
587 
588  PARAM_PREFIX IntUserConfigParam m_screen_keyboard
589  PARAM_DEFAULT( IntUserConfigParam(0, "screen_keyboard_status",
590  &m_multitouch_group,
591  "STK screen keyboard status: 0 = disabled, 1 = enabled") );
592 
593  // ---- GP start order
594  PARAM_PREFIX GroupUserConfigParam m_gp_start_order
595  PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder",
596  "Order karts start in GP") );
597  PARAM_PREFIX BoolUserConfigParam m_gp_most_points_first
598  PARAM_DEFAULT( BoolUserConfigParam(true, "most_points_first",
599  &m_gp_start_order,
600  "Starting order from most to least points (true) or other "
601  "way around (false)") );
602  PARAM_PREFIX BoolUserConfigParam m_gp_player_last
603  PARAM_DEFAULT( BoolUserConfigParam(false, "player_last",
604  &m_gp_start_order,
605  "Always put the player at the back or not (Bully mode).") );
606  PARAM_PREFIX StringUserConfigParam m_additional_gp_directory
607  PARAM_DEFAULT( StringUserConfigParam("", "additional_gp_directory",
608  "Directory with additional GP's."));
609 
610  // ---- Video
611  PARAM_PREFIX GroupUserConfigParam m_video_group
612  PARAM_DEFAULT( GroupUserConfigParam("Video", "Video Settings") );
613 
614  PARAM_PREFIX IntUserConfigParam m_width
615  PARAM_DEFAULT( IntUserConfigParam(1024, "width", &m_video_group,
616  "Screen/window width in pixels") );
617  PARAM_PREFIX IntUserConfigParam m_height
618  PARAM_DEFAULT( IntUserConfigParam(768, "height", &m_video_group,
619  "Screen/window height in pixels") );
620  PARAM_PREFIX BoolUserConfigParam m_fullscreen
621  PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen",
622  &m_video_group) );
623  PARAM_PREFIX IntUserConfigParam m_prev_width
624  PARAM_DEFAULT( IntUserConfigParam(1024, "prev_width",
625  &m_video_group, "Previous screen/window width") );
626  PARAM_PREFIX IntUserConfigParam m_prev_height
627  PARAM_DEFAULT( IntUserConfigParam(768, "prev_height",
628  &m_video_group,"Previous screen/window height") );
629  PARAM_PREFIX BoolUserConfigParam m_prev_fullscreen
630  PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen",
631  &m_video_group) );
632 
633 
634  PARAM_PREFIX BoolUserConfigParam m_remember_window_location
635  PARAM_DEFAULT( BoolUserConfigParam(false, "remember_window_location",
636  &m_video_group) );
637  PARAM_PREFIX IntUserConfigParam m_window_x
638  PARAM_DEFAULT( IntUserConfigParam(-1, "window_x",
639  &m_video_group,"If remember_window_location is true") );
640  PARAM_PREFIX IntUserConfigParam m_window_y
641  PARAM_DEFAULT( IntUserConfigParam(-1, "window_y",
642  &m_video_group,"If remember_window_location is true") );
643 
644  PARAM_PREFIX BoolUserConfigParam m_display_fps
645  PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps",
646  &m_video_group, "Display frame per seconds") );
647  PARAM_PREFIX BoolUserConfigParam m_display_story_mode_timer
648  PARAM_DEFAULT( BoolUserConfigParam(true, "show_story_mode_timer",
649  &m_video_group, "Display the story mode timer") );
650  PARAM_PREFIX BoolUserConfigParam m_speedrun_mode
651  PARAM_DEFAULT( BoolUserConfigParam(false, "show_speedrun_timer",
652  &m_video_group, "Display the speedrun timer") );
653  PARAM_PREFIX IntUserConfigParam m_max_fps
654  PARAM_DEFAULT( IntUserConfigParam(120, "max_fps",
655  &m_video_group, "Maximum fps, should be at least 60") );
656  PARAM_PREFIX BoolUserConfigParam m_force_legacy_device
657  PARAM_DEFAULT(BoolUserConfigParam(false, "force_legacy_device",
658  &m_video_group, "Force OpenGL 2 context, even if OpenGL 3 is available."));
659  PARAM_PREFIX BoolUserConfigParam split_screen_horizontally
660  PARAM_DEFAULT(BoolUserConfigParam(true, "split_screen_horizontally",
661  &m_video_group, "When playing a non-square amount of players (e.g. 2),"
662  " should it split horizontally (top/bottom)"));
663  PARAM_PREFIX BoolUserConfigParam m_texture_compression
664  PARAM_DEFAULT(BoolUserConfigParam(true, "enable_texture_compression",
665  &m_video_group, "Enable Texture Compression"));
670  PARAM_PREFIX IntUserConfigParam m_high_definition_textures
671  PARAM_DEFAULT(IntUserConfigParam(1, "enable_high_definition_textures",
672  &m_video_group, "Enable high definition textures. Bit flag: "
673  "bit 0 = enabled/disabled; bit 1 = set by user/set as default"));
674  PARAM_PREFIX BoolUserConfigParam m_glow
675  PARAM_DEFAULT(BoolUserConfigParam(false, "enable_glow",
676  &m_video_group, "Enable Glow"));
677  PARAM_PREFIX BoolUserConfigParam m_bloom
678  PARAM_DEFAULT(BoolUserConfigParam(false, "enable_bloom",
679  &m_video_group, "Enable Bloom"));
680  PARAM_PREFIX BoolUserConfigParam m_light_shaft
681  PARAM_DEFAULT(BoolUserConfigParam(false, "enable_light_shaft",
682  &m_video_group, "Enable Light Shafts"));
683  PARAM_PREFIX BoolUserConfigParam m_dynamic_lights
684  PARAM_DEFAULT(BoolUserConfigParam(true, "enable_dynamic_lights",
685  &m_video_group, "Enable Dynamic Lights"));
686  PARAM_PREFIX BoolUserConfigParam m_dof
687  PARAM_DEFAULT(BoolUserConfigParam(false, "enable_dof",
688  &m_video_group, "Enable Depth of Field"));
689  PARAM_PREFIX BoolUserConfigParam m_old_driver_popup
690  PARAM_DEFAULT(BoolUserConfigParam(true, "old_driver_popup",
691  &m_video_group, "Determines if popup message about too old drivers should be displayed."));
692  PARAM_PREFIX FloatUserConfigParam m_scale_rtts_factor
693  PARAM_DEFAULT(FloatUserConfigParam(1.0f, "scale_rtts_factor",
694  &m_video_group, "Custom value for RTTs resolution. "
695  "Value should be smaller or equal to 1.0"));
696  PARAM_PREFIX IntUserConfigParam m_max_texture_size
697  PARAM_DEFAULT(IntUserConfigParam(512, "max_texture_size",
698  &m_video_group, "Max texture size when high definition textures are "
699  "disabled"));
700 
701  PARAM_PREFIX BoolUserConfigParam m_hq_mipmap
702  PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap",
703  &m_video_group, "Generate mipmap for textures using "
704  "high quality method with SSE"));
705  PARAM_PREFIX FloatUserConfigParam m_font_size
706  PARAM_DEFAULT( FloatUserConfigParam(3, "font_size",
707  &m_video_group, "The size of fonts. 0 is the smallest and 6 is the biggest") );
708 
709 #if defined(_IRR_COMPILE_WITH_DIRECT3D_9_) && defined(_M_ARM64)
710  PARAM_PREFIX StringUserConfigParam m_render_driver
711  PARAM_DEFAULT( StringUserConfigParam("directx9", "render_driver",
712  &m_video_group, "Render video driver to use, at the moment gl or directx9 is supported.") );
713 #else
714  PARAM_PREFIX StringUserConfigParam m_render_driver
715  PARAM_DEFAULT( StringUserConfigParam("gl", "render_driver",
716  &m_video_group, "Render video driver to use, at the moment gl or directx9 is supported.") );
717 #endif
718 
719  // ---- Recording
720  PARAM_PREFIX GroupUserConfigParam m_recording_group
721  PARAM_DEFAULT(GroupUserConfigParam("Recording",
722  "Recording Settings"));
723 
724  PARAM_PREFIX BoolUserConfigParam m_limit_game_fps
725  PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps",
726  &m_recording_group, "Limit game framerate not beyond the fps of"
727  " recording video."));
728  PARAM_PREFIX IntUserConfigParam m_video_format
729  PARAM_DEFAULT(IntUserConfigParam(0, "video_format",
730  &m_recording_group, "Specify the video for record, which is the enum"
731  " of VideoFormat in libopenglrecorder. It will"
732  " auto fallback to MJPEG if libopenglrecorder was"
733  " not compiled with such video encoder."));
734 
735  PARAM_PREFIX IntUserConfigParam m_audio_bitrate
736  PARAM_DEFAULT(IntUserConfigParam(112000, "audio_bitrate",
737  &m_recording_group, "Specify the bitrate for audio"));
738 
739  PARAM_PREFIX IntUserConfigParam m_video_bitrate
740  PARAM_DEFAULT(IntUserConfigParam(20000, "video_bitrate",
741  &m_recording_group, "Specify the bitrate for video"));
742 
743  PARAM_PREFIX IntUserConfigParam m_recorder_jpg_quality
744  PARAM_DEFAULT(IntUserConfigParam(90, "recorder_jpg_quality",
745  &m_recording_group, "Specify the jpg compression level of recorder"));
746 
747  PARAM_PREFIX IntUserConfigParam m_record_fps
748  PARAM_DEFAULT(IntUserConfigParam(30, "record_fps",
749  &m_recording_group, "Specify the fps of recording video"));
750 
751  // ---- Debug - not saved to config file
753  PARAM_PREFIX bool m_no_high_scores PARAM_DEFAULT(false);
754 
756  PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false);
757 
759  PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
760 
762  PARAM_PREFIX bool m_keyboard_debug PARAM_DEFAULT(false);
763 
765  PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false );
766 
768  PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
769 
772  PARAM_PREFIX bool m_material_debug PARAM_DEFAULT( false );
773 
775  PARAM_PREFIX int m_track_debug PARAM_DEFAULT( false );
776 
778  PARAM_PREFIX bool m_check_debug PARAM_DEFAULT( false );
779 
781  PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );
782 
784  PARAM_PREFIX bool m_fps_debug PARAM_DEFAULT(false);
785 
787  PARAM_PREFIX bool m_arena_ai_stats PARAM_DEFAULT(false);
788 
790  PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );
791 
793  PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false );
794 
796  PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false );
797 
800  PARAM_PREFIX int m_verbosity PARAM_DEFAULT( 0 );
801 
802  PARAM_PREFIX bool m_no_start_screen PARAM_DEFAULT( false );
803 
804  PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false );
805 
806  PARAM_PREFIX bool m_enforce_current_player PARAM_DEFAULT( false );
807 
808  PARAM_PREFIX bool m_enable_sound PARAM_DEFAULT( true );
809 
812  PARAM_PREFIX bool m_rendering_debug PARAM_DEFAULT( false );
813 
815  PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false );
816 
817  PARAM_PREFIX bool m_disable_addon_karts PARAM_DEFAULT( false );
818 
819  PARAM_PREFIX bool m_disable_addon_tracks PARAM_DEFAULT( false );
820 
821  // ---- Networking
822  PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks
823  PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks",
824  "Wan server bookmarks",
825  {{ "server-bookmarks", "server-name", "last-online" }}, {}));
826 
827  PARAM_PREFIX StringToUIntUserConfigParam m_address_history
828  PARAM_DEFAULT(StringToUIntUserConfigParam("address-history",
829  "Last 5 IP addresses that user entered",
830  {{ "server-address", "address", "last-connection" }}, {}));
831 
832  // These stk domains have only a record to each ipv6 stun below,
833  // so we can use this to know ipv4 address of nat64 gateway (if any)
834  PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers_v4
835  PARAM_DEFAULT(StringToUIntUserConfigParam("ipv4-stun-servers",
836  "The stun servers that will be used to know the public address "
837  "(ipv4 only) with port", {{ "stun-server", "address", "ping" }},
838  {
839  { "stunv4.linuxreviews.org:3478", 0u },
840  { "stunv4.7.supertuxkart.net:3478", 0u },
841  { "stunv4.8.supertuxkart.net:3478", 0u }
842  }
843  ));
844 
845  PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers
846  PARAM_DEFAULT(StringToUIntUserConfigParam("ipv6-stun-servers",
847  "The stun servers that will be used to know the public address "
848  "(including ipv6) with port", {{ "stun-server", "address", "ping" }},
849  {
850  { "stun.linuxreviews.org:3478", 0u },
851  { "stun.supertuxkart.net:3478", 0u },
852  { "stun.stunprotocol.org:3478", 0u }
853  }
854  ));
855 
856  PARAM_PREFIX GroupUserConfigParam m_network_group
857  PARAM_DEFAULT(GroupUserConfigParam("Network", "Network Settings"));
858  PARAM_PREFIX BoolUserConfigParam m_enable_network_splitscreen
859  PARAM_DEFAULT(BoolUserConfigParam(false, "enable-network-splitscreen",
860  &m_network_group, "The default value of enable splitscreen checkbox "
861  "in online screen."));
862  PARAM_PREFIX BoolUserConfigParam m_log_packets
863  PARAM_DEFAULT(BoolUserConfigParam(false, "log-network-packets",
864  &m_network_group, "If all network packets should be logged"));
865  PARAM_PREFIX BoolUserConfigParam m_random_client_port
866  PARAM_DEFAULT(BoolUserConfigParam(true, "random-client-port",
867  &m_network_group, "Use random port for client connection "
868  "(check stk_config.xml for default value)"));
869  PARAM_PREFIX BoolUserConfigParam m_random_server_port
870  PARAM_DEFAULT(BoolUserConfigParam(false, "random-server-port",
871  &m_network_group, "Use random port for server connection "
872  "(check stk_config.xml for default value)"));
873  PARAM_PREFIX BoolUserConfigParam m_lobby_chat
874  PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat",
875  &m_network_group, "Enable chatting in networking lobby, if off than "
876  "no chat message will be displayed from any players."));
877  PARAM_PREFIX BoolUserConfigParam m_race_chat
878  PARAM_DEFAULT(BoolUserConfigParam(true, "race-chat",
879  &m_network_group, "Enable chatting during races."));
880  PARAM_PREFIX BoolUserConfigParam m_ipv6_lan
881  PARAM_DEFAULT(BoolUserConfigParam(true, "ipv6-lan",
882  &m_network_group, "Enable IPv6 LAN server discovery."));
883  PARAM_PREFIX IntUserConfigParam m_max_players
884  PARAM_DEFAULT(IntUserConfigParam(8, "max-players",
885  &m_network_group, "Maximum number of players on the server "
886  "(for gui server creation."));
887  PARAM_PREFIX IntUserConfigParam m_timer_sync_difference_tolerance
888  PARAM_DEFAULT(IntUserConfigParam(5, "timer-sync-difference-tolerance",
889  &m_network_group, "Max time difference tolerance (in ms) to "
890  "synchronize timer with server."));
891  PARAM_PREFIX IntUserConfigParam m_default_ip_type
892  PARAM_DEFAULT(IntUserConfigParam(0, "default-ip-type",
893  &m_network_group, "Default IP type of this machine, "
894  "0 detect every time, 1 IPv4, 2 IPv6, 3 IPv6 NAT64, 4 Dual stack."));
895  PARAM_PREFIX BoolUserConfigParam m_lan_server_gp
896  PARAM_DEFAULT(BoolUserConfigParam(false, "lan-server-gp",
897  &m_network_group, "Show grand prix option in create LAN server "
898  "screen, false will show AI option."));
899  PARAM_PREFIX BoolUserConfigParam m_wan_server_gp
900  PARAM_DEFAULT(BoolUserConfigParam(true, "wan-server-gp",
901  &m_network_group, "Show grand prix option in create WAN server "
902  "screen, false will show AI option."));
903 
904  // ---- Gamemode setup
905  PARAM_PREFIX UIntToUIntUserConfigParam m_num_karts_per_gamemode
906  PARAM_DEFAULT(UIntToUIntUserConfigParam("num-karts-per-gamemode",
907  "The Number of karts per gamemode.",
908  {{ "gamemode-list", "gamemode", "num-karts" }},
909  {
910  { 0u, 4u },
911  { 1002u, 5u },
912  { 1100u, 4u },
913  { 1101u, 4u },
914  { 2000u, 4u },
915  { 2001u, 4u }
916  }
917  ));
918 
919  // ---- Graphic Quality
920  PARAM_PREFIX GroupUserConfigParam m_graphics_quality
921  PARAM_DEFAULT( GroupUserConfigParam("GFX",
922  "Graphics Quality Settings") );
923 
924  PARAM_PREFIX IntUserConfigParam m_particles_effects
925  PARAM_DEFAULT( IntUserConfigParam(2, "particles-effecs",
926  &m_graphics_quality, "Particles effects: 0 disabled, 1 only important, 2 enabled") );
927 
928  // This saves the actual user preference.
929  PARAM_PREFIX IntUserConfigParam m_xmas_mode
930  PARAM_DEFAULT( IntUserConfigParam(0, "christmas-mode",
931  &m_graphics_quality, "Christmas hats: 0 use current date, 1 always on, 2 always off") );
932 
933  // This saves the actual user preference.
934  PARAM_PREFIX IntUserConfigParam m_easter_ear_mode
935  PARAM_DEFAULT(IntUserConfigParam(0, "easter-ear-mode",
936  &m_graphics_quality, "Easter Bunny Ears: 0 use current date, 1 always on, 2 always off"));
937 
938  PARAM_PREFIX BoolUserConfigParam m_animated_characters
939  PARAM_DEFAULT( BoolUserConfigParam(true,
940  "animated-characters", &m_graphics_quality,
941  "Whether to display animated characters") );
942 
943  PARAM_PREFIX IntUserConfigParam m_geometry_level
944  PARAM_DEFAULT( IntUserConfigParam(GEOLEVEL_0,
945  "geometry_level", &m_graphics_quality,
946  "Geometry quality 0=everything is displayed; "
947  "1=a few details are displayed; 2=lowest level, no details") );
948 
949  PARAM_PREFIX IntUserConfigParam m_anisotropic
950  PARAM_DEFAULT( IntUserConfigParam(4, "anisotropic",
951  &m_graphics_quality,
952  "Quality of anisotropic filtering (usual values include 2-4-8-16; 0 to disable)") );
953 
954  PARAM_PREFIX IntUserConfigParam m_swap_interval
955  PARAM_DEFAULT( IntUserConfigParam(0, "swap-interval",
956  &m_graphics_quality,
957  "Swap interval for vsync: 0 = disabled, 1 = full") );
958  PARAM_PREFIX BoolUserConfigParam m_motionblur
959  PARAM_DEFAULT( BoolUserConfigParam(false,
960  "motionblur_enabled", &m_graphics_quality,
961  "Whether motion blur should be enabled") );
962  PARAM_PREFIX BoolUserConfigParam m_mlaa
963  PARAM_DEFAULT( BoolUserConfigParam(false,
964  "mlaa", &m_graphics_quality,
965  "Whether MLAA anti-aliasing should be enabled") );
966  PARAM_PREFIX BoolUserConfigParam m_ssao
967  PARAM_DEFAULT(BoolUserConfigParam(false,
968  "ssao", &m_graphics_quality,
969  "Enable Screen Space Ambient Occlusion") );
970  PARAM_PREFIX BoolUserConfigParam m_light_scatter
971  PARAM_DEFAULT(BoolUserConfigParam(true,
972  "light_scatter", &m_graphics_quality,
973  "Enable light scattering shaders") );
974  PARAM_PREFIX IntUserConfigParam m_shadows_resolution
975  PARAM_DEFAULT( IntUserConfigParam(0,
976  "shadows_resolution", &m_graphics_quality,
977  "Shadow resolution (0 = disabled") );
978  PARAM_PREFIX BoolUserConfigParam m_degraded_IBL
979  PARAM_DEFAULT(BoolUserConfigParam(true,
980  "Degraded_IBL", &m_graphics_quality,
981  "Disable specular IBL"));
982 
983  // ---- Misc
984  PARAM_PREFIX BoolUserConfigParam m_cache_overworld
985  PARAM_DEFAULT( BoolUserConfigParam(true, "cache-overworld") );
986 
987  // TODO : is this used with new code? does it still work?
988  PARAM_PREFIX BoolUserConfigParam m_crashed
989  PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") );
990 
991  // ---- Camera
992  PARAM_PREFIX GroupUserConfigParam m_camera_normal
993  PARAM_DEFAULT( GroupUserConfigParam(
994  "camera-normal",
995  "Camera settings for player.") );
996 
997  PARAM_PREFIX FloatUserConfigParam m_camera_distance
998  PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
999  &m_camera_normal,
1000  "Distance between kart and camera"));
1001 
1002  PARAM_PREFIX FloatUserConfigParam m_camera_forward_up_angle
1003  PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1004  &m_camera_normal,
1005  "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1006 
1007  PARAM_PREFIX BoolUserConfigParam m_camera_forward_smoothing
1008  PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1009  &m_camera_normal,
1010  "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1011 
1012  PARAM_PREFIX FloatUserConfigParam m_camera_backward_distance
1013  PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1014  &m_camera_normal,
1015  "Distance between kart and camera (reverse)"));
1016 
1017  PARAM_PREFIX FloatUserConfigParam m_camera_backward_up_angle
1018  PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1019  &m_camera_normal,
1020  "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"));
1021 
1022  PARAM_PREFIX IntUserConfigParam m_camera_fov
1023  PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1024  &m_camera_normal,
1025  "Focal distance (single player)"));
1026 
1027  PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam
1028  PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1029  "Use ball camera in soccer mode, instead of reverse") );
1030 
1031  // ---- The present camera (default: Standard)
1032  PARAM_PREFIX IntUserConfigParam m_camera_present
1033  PARAM_DEFAULT( IntUserConfigParam(1, "camera-present",
1034  "The current used camera. 0=Custom; 1=Standard; 2=Drone chase") );
1035 
1036  // ---- Standard camera settings
1037  PARAM_PREFIX GroupUserConfigParam m_standard_camera_settings
1038  PARAM_DEFAULT( GroupUserConfigParam(
1039  "standard-camera-settings",
1040  "Standard camera settings for player.") );
1041 
1042  PARAM_PREFIX FloatUserConfigParam m_standard_camera_distance
1043  PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
1044  &m_standard_camera_settings,
1045  "Distance between kart and camera"));
1046 
1047  PARAM_PREFIX FloatUserConfigParam m_standard_camera_forward_up_angle
1048  PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1049  &m_standard_camera_settings,
1050  "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1051 
1052  PARAM_PREFIX BoolUserConfigParam m_standard_camera_forward_smoothing
1053  PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1054  &m_standard_camera_settings,
1055  "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1056 
1057  PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_distance
1058  PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1059  &m_standard_camera_settings,
1060  "Distance between kart and camera (reverse)"));
1061 
1062  PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_up_angle
1063  PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1064  &m_standard_camera_settings,
1065  "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"));
1066 
1067  PARAM_PREFIX IntUserConfigParam m_standard_camera_fov
1068  PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1069  &m_standard_camera_settings,
1070  "Focal distance (single player)"));
1071 
1072  PARAM_PREFIX BoolUserConfigParam m_standard_reverse_look_use_soccer_cam
1073  PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1074  &m_standard_camera_settings,
1075  "Use ball camera in soccer mode, instead of reverse"));
1076 
1077  // ---- Drone chase camera settings
1078  PARAM_PREFIX GroupUserConfigParam m_drone_camera_settings
1079  PARAM_DEFAULT( GroupUserConfigParam(
1080  "drone-camera-settings",
1081  "Drone chase camera settings for player.") );
1082 
1083  PARAM_PREFIX FloatUserConfigParam m_drone_camera_distance
1084  PARAM_DEFAULT( FloatUserConfigParam(2.6, "distance",
1085  &m_drone_camera_settings,
1086  "Distance between kart and camera"));
1087 
1088  PARAM_PREFIX FloatUserConfigParam m_drone_camera_forward_up_angle
1089  PARAM_DEFAULT( FloatUserConfigParam(33, "forward-up-angle",
1090  &m_drone_camera_settings,
1091  "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1092 
1093  PARAM_PREFIX BoolUserConfigParam m_drone_camera_forward_smoothing
1094  PARAM_DEFAULT( BoolUserConfigParam(false, "forward-smoothing",
1095  &m_drone_camera_settings,
1096  "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1097 
1098  PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_distance
1099  PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1100  &m_drone_camera_settings,
1101  "Distance between kart and camera (reverse)"));
1102 
1103  PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_up_angle
1104  PARAM_DEFAULT( FloatUserConfigParam(10, "backward-up-angle",
1105  &m_drone_camera_settings,
1106  "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"));
1107 
1108  PARAM_PREFIX IntUserConfigParam m_drone_camera_fov
1109  PARAM_DEFAULT( IntUserConfigParam(100, "fov",
1110  &m_drone_camera_settings,
1111  "Focal distance (single player)"));
1112 
1113  PARAM_PREFIX BoolUserConfigParam m_drone_reverse_look_use_soccer_cam
1114  PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1115  &m_drone_camera_settings,
1116  "Use ball camera in soccer mode, instead of reverse"));
1117 
1118  // ---- Custom camera settings
1119  PARAM_PREFIX GroupUserConfigParam m_saved_camera_settings
1120  PARAM_DEFAULT( GroupUserConfigParam(
1121  "saved-camera-settings",
1122  "Saved custom camera settings for player.") );
1123 
1124  PARAM_PREFIX FloatUserConfigParam m_saved_camera_distance
1125  PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance",
1126  &m_saved_camera_settings,
1127  "Distance between kart and camera"));
1128 
1129  PARAM_PREFIX FloatUserConfigParam m_saved_camera_forward_up_angle
1130  PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle",
1131  &m_saved_camera_settings,
1132  "Angle between camera and plane of kart (pitch) when the camera is pointing forward"));
1133 
1134  PARAM_PREFIX BoolUserConfigParam m_saved_camera_forward_smoothing
1135  PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing",
1136  &m_saved_camera_settings,
1137  "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
1138 
1139  PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_distance
1140  PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
1141  &m_saved_camera_settings,
1142  "Distance between kart and camera (reverse)"));
1143 
1144  PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_up_angle
1145  PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
1146  &m_saved_camera_settings,
1147  "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"));
1148 
1149  PARAM_PREFIX IntUserConfigParam m_saved_camera_fov
1150  PARAM_DEFAULT( IntUserConfigParam(80, "fov",
1151  &m_saved_camera_settings,
1152  "Focal distance (single player)"));
1153 
1154  PARAM_PREFIX BoolUserConfigParam m_saved_reverse_look_use_soccer_cam
1155  PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam",
1156  &m_saved_camera_settings,
1157  "Use ball camera in soccer mode, instead of reverse"));
1158 
1159  // camera in artist mode
1160  PARAM_PREFIX GroupUserConfigParam m_camera
1161  PARAM_DEFAULT( GroupUserConfigParam("camera",
1162  "(Debug) camera settings.") );
1163 
1164  PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold
1165  PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold",
1166  &m_camera,
1167  "If the kart is driving backwards faster than this value,\n"
1168  "switch automatically to reverse camera (set to 0 to disable).") );
1169 
1170  PARAM_PREFIX FloatUserConfigParam m_fpscam_direction_speed
1171  PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fpscam_rotation_speed",
1172  &m_camera,
1173  "How fast the first person camera's direction speed changes when\n"
1174  "moving the mouse (means acceleration).") );
1175 
1176  PARAM_PREFIX FloatUserConfigParam m_fpscam_smooth_direction_max_speed
1177  PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fpscam_smooth_rotation_max_speed",
1178  &m_camera,
1179  "How fast the first person camera's direction can change.") );
1180 
1181  PARAM_PREFIX FloatUserConfigParam m_fpscam_angular_velocity
1182  PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fpscam_angular_velocity",
1183  &m_camera,
1184  "How fast the first person camera's rotation speed changes.") );
1185 
1186  PARAM_PREFIX FloatUserConfigParam m_fpscam_max_angular_velocity
1187  PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fpscam_max_angular_velocity",
1188  &m_camera,
1189  "How fast the first person camera can rotate.") );
1190 
1191  PARAM_PREFIX StringUserConfigParam m_item_style
1192  PARAM_DEFAULT( StringUserConfigParam("items", "item_style",
1193  "Name of the .items file to use.") );
1194 
1195  PARAM_PREFIX StringUserConfigParam m_last_track
1196  PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track",
1197  "Name of the last track used.") );
1198  PARAM_PREFIX StringUserConfigParam m_last_used_track_group
1199  PARAM_DEFAULT( StringUserConfigParam("all", "last_track_group",
1200  "Last selected track group") );
1201 
1202  PARAM_PREFIX StringUserConfigParam m_discord_client_id
1203  PARAM_DEFAULT( StringUserConfigParam("817760324983324753", "discord_client_id",
1204  "Discord Client ID (Set to -1 to disable)") );
1205 
1206  PARAM_PREFIX BoolUserConfigParam m_rich_presence_debug
1207  PARAM_DEFAULT( BoolUserConfigParam(false, "rich_presence_debug",
1208  "If debug logging should be enabled for rich presence") );
1209 
1210  PARAM_PREFIX StringUserConfigParam m_skin_file
1211  PARAM_DEFAULT( StringUserConfigParam("peach", "skin_name",
1212  "Name of the skin to use") );
1213 
1214  // ---- settings for minimap display
1215  PARAM_PREFIX GroupUserConfigParam m_minimap_setup_group
1216  PARAM_DEFAULT( GroupUserConfigParam("Minimap",
1217  "Minimap Setup Settings") );
1218 
1219  PARAM_PREFIX IntUserConfigParam m_minimap_display
1220  PARAM_DEFAULT(IntUserConfigParam(0, "display",
1221  &m_minimap_setup_group, "display: 0 bottom-left, 1 middle-right, 2 hidden, 3 center"));
1222 
1223  PARAM_PREFIX FloatUserConfigParam m_minimap_size
1224  PARAM_DEFAULT( FloatUserConfigParam(180.0f, "size",
1225  &m_minimap_setup_group, "Size of the the minimap (480 = full screen height; scaled afterwards)") );
1226 
1227  PARAM_PREFIX FloatUserConfigParam m_minimap_ai_icon_size
1228  PARAM_DEFAULT( FloatUserConfigParam(16.0f, "ai-icon",
1229  &m_minimap_setup_group, "The size of the icons for the AI karts on the minimap.") );
1230 
1231  PARAM_PREFIX FloatUserConfigParam m_minimap_player_icon_size
1232  PARAM_DEFAULT( FloatUserConfigParam(20.0f, "player-icon",
1233  &m_minimap_setup_group, "The size of the icons for the player kart.") );
1234 
1235  // ---- settings for powerup display
1236  PARAM_PREFIX GroupUserConfigParam m_powerup_setup_group
1237  PARAM_DEFAULT( GroupUserConfigParam("PowerUp",
1238  "PowerUp Setup Settings") );
1239 
1240  PARAM_PREFIX IntUserConfigParam m_powerup_display
1241  PARAM_DEFAULT(IntUserConfigParam(0, "display",
1242  &m_powerup_setup_group, "display: 0 center, 1 right side, 2 hidden (see karts' held powerups)"));
1243  PARAM_PREFIX FloatUserConfigParam m_powerup_size
1244  PARAM_DEFAULT( FloatUserConfigParam(64.0f, "powerup-icon-size",
1245  &m_powerup_setup_group, "Size of the powerup icon (scaled afterwards)") );
1246 
1247  // ---- Settings for spectator camera
1248  PARAM_PREFIX GroupUserConfigParam m_spectator
1249  PARAM_DEFAULT( GroupUserConfigParam("Spectator",
1250  "Everything related to spectator mode.") );
1251 
1252  PARAM_PREFIX FloatUserConfigParam m_spectator_camera_distance
1253  PARAM_DEFAULT( FloatUserConfigParam(6.75, "camera-distance", &m_spectator,
1254  "Distance between kart and camera.") );
1255  PARAM_PREFIX FloatUserConfigParam m_spectator_camera_angle
1256  PARAM_DEFAULT( FloatUserConfigParam(40.0, "camera-angle", &m_spectator,
1257  "Angle between ground, kart and camera.") );
1258 
1259  // ---- Handicap
1260  PARAM_PREFIX GroupUserConfigParam m_handicap
1261  PARAM_DEFAULT( GroupUserConfigParam("Handicap",
1262  "Everything related to handicaps.") );
1263 
1264  PARAM_PREFIX BoolUserConfigParam m_per_player_difficulty
1265  PARAM_DEFAULT( BoolUserConfigParam(false, "per_player_difficulty",
1266  &m_handicap,
1267  "If handicapped users can be selected") );
1268 
1269  // ---- Internet related
1270 
1271  PARAM_PREFIX IntUserConfigParam m_internet_status
1272  PARAM_DEFAULT( IntUserConfigParam(0, "enable_internet",
1273  "Status of internet: 0 user "
1274  "wasn't asked, 1: allowed, 2: "
1275  "not allowed") );
1276 
1277  PARAM_PREFIX GroupUserConfigParam m_hw_report_group
1278  PARAM_DEFAULT( GroupUserConfigParam("HWReport",
1279  "Everything related to hardware configuration.") );
1280 
1281  PARAM_PREFIX IntUserConfigParam m_last_hw_report_version
1282  PARAM_DEFAULT( IntUserConfigParam(0, "report-version", &m_hw_report_group,
1283  "Version of hardware report "
1284  "that was reported last") );
1285  PARAM_PREFIX IntUserConfigParam m_random_identifier
1286  PARAM_DEFAULT( IntUserConfigParam(0, "random-identifier", &m_hw_report_group,
1287  "A random number to avoid duplicated reports.") );
1288 
1289  PARAM_PREFIX BoolUserConfigParam m_hw_report_enable
1290  PARAM_DEFAULT( BoolUserConfigParam( false,
1291  "hw-report-enabled",
1292  &m_hw_report_group,
1293  "If HW reports are enabled."));
1294 
1295  // ---- User management
1296 
1297  PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen
1298  PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen",
1299  "Always show the login screen even if last player's session was saved."));
1300 
1301 
1302  // ---- Addon server related entries
1303  PARAM_PREFIX GroupUserConfigParam m_addon_group
1304  PARAM_DEFAULT( GroupUserConfigParam("AddonServer",
1305  "Addon and news related settings") );
1306 
1307  PARAM_PREFIX TimeUserConfigParam m_news_last_updated
1308  PARAM_DEFAULT( TimeUserConfigParam(0, "news_last_updated",
1309  &m_addon_group,
1310  "Time news was updated last.") );
1311 
1312  PARAM_PREFIX IntUserConfigParam m_news_frequency
1313  PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency",
1314  &m_addon_group,
1315  "How often news should be updated.") );
1316 
1317  PARAM_PREFIX StringUserConfigParam m_display_count
1318  PARAM_DEFAULT( StringUserConfigParam("", "news_display_count",
1319  &m_addon_group,
1320  "How often all news messages "
1321  "have been displayed") );
1322 
1323  PARAM_PREFIX IntUserConfigParam m_last_important_message_id
1324  PARAM_DEFAULT( IntUserConfigParam(-1, "last_important_message_id",
1325  &m_addon_group,
1326  "Don't show important message "
1327  "with this or a lower id again") );
1328 
1329  PARAM_PREFIX TimeUserConfigParam m_addons_last_updated
1330  PARAM_DEFAULT( TimeUserConfigParam(0, "addon_last_updated",
1331  &m_addon_group,
1332  "Time addon-list was updated last.") );
1333 
1334  PARAM_PREFIX TimeUserConfigParam m_latest_addon_time
1335  PARAM_DEFAULT( TimeUserConfigParam(0, "latest_addon_time",
1336  &m_addon_group,
1337  "Latest approved addon time.") );
1338 
1339  PARAM_PREFIX StringUserConfigParam m_language
1340  PARAM_DEFAULT( StringUserConfigParam("system", "language",
1341  "Which language to use (language code or 'system')") );
1342 
1343  PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode
1344  PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
1345  "Whether to enable track debugging features") );
1346 
1347  PARAM_PREFIX BoolUserConfigParam m_hide_gui
1348  PARAM_DEFAULT(BoolUserConfigParam(false, "debug_hide_gui",
1349  "Whether to hide the GUI (artist debug mode)"));
1350 
1351  PARAM_PREFIX IntUserConfigParam m_unlock_everything
1352  PARAM_DEFAULT( IntUserConfigParam(0, "unlock_everything",
1353  "Enable all karts and tracks: 0 = disabled, "
1354  "1 = everything except final race, 2 = everything") );
1355 
1356  PARAM_PREFIX StringUserConfigParam m_commandline
1357  PARAM_DEFAULT( StringUserConfigParam("", "commandline",
1358  "Allows one to set commandline args in config file") );
1359 
1360  // TODO? implement blacklist for new irrlicht device and GUI
1361  PARAM_PREFIX std::vector<std::string> m_blacklist_res;
1362 
1365 
1367  enum { LOG_MEMORY = 0x0001,
1368  LOG_GUI = 0x0002,
1369  LOG_ADDONS = 0x0004,
1370  LOG_MISC = 0x0008,
1371  LOG_FLYABLE = 0x0010,
1372  LOG_ALL = 0xffff };
1373 
1375  bool logMemory();
1377  bool logGUI ();
1379  bool logAddons();
1381  bool logFlyable();
1383  bool logMisc ();
1384 
1385 
1386 }
1387 #undef PARAM_PREFIX
1388 #undef PARAM_SUFFIX
1389 
1390 // ============================================================================
1395 class UserConfig : public NoCopy
1396 {
1397 private:
1398 
1400  std::string m_filename;
1401  irr::core::stringw m_warning;
1402 
1403  static const int m_current_config_version;
1404 
1405 public:
1408  UserConfig();
1409  ~UserConfig();
1410 
1411  bool loadConfig();
1412  void saveConfig();
1413 
1414  const irr::core::stringw& getWarning() { return m_warning; }
1415  void resetWarning() { m_warning=""; }
1416  void setWarning(irr::core::stringw& warning) { m_warning=warning; }
1417 
1418 }; // UserConfig
1419 
1420 
1421 extern UserConfig *user_config;
1422 
1423 #endif
1424 
1425 /*EOF*/
Class for managing general STK user configuration data.
Definition: user_config.hpp:1395
std::string m_filename
Filename of the user config file.
Definition: user_config.hpp:1400
utility class used to write wide (UTF-16 or UTF-32, depending of size of wchar_t) XML files ...
Definition: utf_writer.hpp:34
Definition: user_config.hpp:229
Definition: user_config.hpp:193
Definition: user_config.hpp:328
bool logMemory()
Returns true if the user want additional messages for memory usage.
Definition: user_config.cpp:762
ATM only map with 1 key and 1 value is supported.
Definition: user_config.hpp:109
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:1364
Definition: user_config.hpp:84
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:25
The base of a set of small utilities to enable quickly adding/removing stuff to/from config painlessl...
Definition: user_config.hpp:67
Class for managing player profiles (name, usage frequency, etc.).
Definition: player_profile.hpp:53
virtual void writeInner(std::stringstream &stream, int level=0) const
Writes an inner node.
Definition: user_config.cpp:72
Contains all parameters that are stored in the user&#39;s config file.
Definition: user_config.hpp:403
bool logFlyable()
Returns true if the user want additional debug info for flyables.
Definition: user_config.cpp:774
bool logAddons()
Returns true if the user want additional messages related to addons.
Definition: user_config.cpp:770
Definition: ptr_vector.hpp:43
utility class used to parse XML files
Definition: xml_node.hpp:47
Definition: user_config.hpp:295
bool logMisc()
Returns true if the user want additional messages for general items.
Definition: user_config.cpp:778
Definition: user_config.hpp:255
Class for managing saved Grand-Prix&#39;s A list of all possible resumable GP&#39;s is stored in the user con...
Definition: saved_grand_prix.hpp:38