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 using irr::core::stringc; 49 using irr::core::stringw; 50 51 #include "utils/constants.hpp" 52 #include "utils/no_copy.hpp" 53 #include "utils/ptr_vector.hpp" 54 #include "utils/time.hpp" 55 56 class PlayerProfile; 57 class SavedGrandPrix; 58 class XMLNode; 59 class UTFWriter; 60 61 /** 62 * The base of a set of small utilities to enable quickly adding/removing 63 * stuff to/from config painlessly. 64 */ 65 class UserConfigParam 66 { 67 friend class GroupUserConfigParam; 68 protected: 69 bool m_can_be_deleted = true; 70 std::string m_param_name; 71 std::string m_comment; 72 public: 73 virtual ~UserConfigParam(); 74 virtual void write(std::stringstream & stream) const = 0; 75 virtual void writeInner(std::stringstream & stream, int level = 0) const; 76 virtual void findYourDataInAChildOf(const XMLNode* node) = 0; 77 virtual void findYourDataInAnAttributeOf(const XMLNode* node) = 0; 78 virtual irr::core::stringc toString() const = 0; 79 }; // UserConfigParam 80 81 // ============================================================================ 82 class GroupUserConfigParam : public UserConfigParam 83 { 84 std::vector<UserConfigParam*> m_attributes; 85 std::vector<GroupUserConfigParam*> m_children; 86 public: 87 GroupUserConfigParam(const char* name, const char* comment=NULL); 88 GroupUserConfigParam(const char* param_name, 89 GroupUserConfigParam* group, 90 const char* comment = NULL); 91 void write(std::stringstream& stream) const; 92 void writeInner(std::stringstream& stream, int level = 0) const; 93 void findYourDataInAChildOf(const XMLNode* node); 94 void findYourDataInAnAttributeOf(const XMLNode* node); 95 96 void addChild(UserConfigParam* child); 97 void addChild(GroupUserConfigParam* child); 98 void clearChildren(); 99 100 irr::core::stringc toString() const; 101 }; // GroupUserConfigParam 102 103 // ============================================================================ 104 /** ATM only map with 1 key and 1 value is supported 105 */ 106 template<typename T, typename U> 107 class MapUserConfigParam : public UserConfigParam 108 { 109 protected: 110 std::array<std::string, 3> m_key_names; 111 std::map<T, U> m_elements; MapUserConfigParam(const char * param_name,const char * comment)112 MapUserConfigParam(const char* param_name, 113 const char* comment) 114 { 115 m_param_name = param_name; 116 if (comment != NULL) 117 m_comment = comment; 118 } 119 120 public: 121 MapUserConfigParam(const char* param_name, 122 const char* comment, 123 std::array<std::string, 3> key_names, 124 std::map<T, U> default_value); 125 MapUserConfigParam(const char* param_name, 126 GroupUserConfigParam* group, 127 const char* comment = NULL); 128 MapUserConfigParam(const char* param_name, 129 GroupUserConfigParam* group, 130 const char* comment, std::array<std::string, 3> key_names, 131 std::map<T, U> default_value); 132 133 void write(std::stringstream& stream) const; 134 void findYourDataInAChildOf(const XMLNode* node); 135 void findYourDataInAnAttributeOf(const XMLNode* node); 136 137 void addElement(T element, U value); 138 139 irr::core::stringc toString() const; 140 operator std::map<T,U>&() const141 operator std::map<T, U>&() const 142 { 143 return m_elements; 144 } begin()145 typename std::map<T, U>::iterator begin() 146 { 147 return m_elements.begin(); 148 } end()149 typename std::map<T, U>::iterator end() 150 { 151 return m_elements.end(); 152 } find(const T & key)153 typename std::map<T, U>::iterator find(const T& key) 154 { 155 return m_elements.find(key); 156 } erase(const T & key)157 size_t erase(const T& key) 158 { 159 return m_elements.erase(key); 160 } empty() const161 bool empty() const 162 { 163 return m_elements.empty(); 164 } operator =(const std::map<T,U> & v)165 std::map<T, U>& operator=(const std::map<T, U>& v) 166 { 167 m_elements = std::map<T, U>(v); 168 return m_elements; 169 } operator =(const MapUserConfigParam & v)170 std::map<T, U>& operator=(const MapUserConfigParam& v) 171 { 172 m_elements = std::map<T,U>(v); 173 return m_elements; 174 } size() const175 size_t size() const 176 { 177 return m_elements.size(); 178 } operator [](const T key)179 U& operator[] (const T key) 180 { 181 return m_elements[key]; 182 } at(const T key)183 U& at(const T key) 184 { 185 return m_elements.at(key); 186 } 187 }; // MapUserConfigParam 188 typedef MapUserConfigParam<uint32_t, uint32_t> UIntToUIntUserConfigParam; 189 typedef MapUserConfigParam<std::string, uint32_t> StringToUIntUserConfigParam; 190 // ============================================================================ 191 class IntUserConfigParam : public UserConfigParam 192 { 193 protected: 194 int m_value; 195 int m_default_value; IntUserConfigParam(const char * param_name,const char * comment)196 IntUserConfigParam(const char* param_name, const char* comment) 197 { 198 m_param_name = param_name; 199 if (comment != NULL) 200 m_comment = comment; 201 } 202 203 public: 204 205 IntUserConfigParam(int default_value, const char* param_name, 206 const char* comment = NULL); 207 IntUserConfigParam(int default_value, const char* param_name, 208 GroupUserConfigParam* group, 209 const char* comment = NULL); 210 211 void write(std::stringstream& stream) const; 212 void findYourDataInAChildOf(const XMLNode* node); 213 void findYourDataInAnAttributeOf(const XMLNode* node); 214 215 irr::core::stringc toString() const; setDefaultValue(int v)216 void setDefaultValue(int v) { m_value = m_default_value = v; } revertToDefaults()217 void revertToDefaults() { m_value = m_default_value; } getDefaultValue()218 int getDefaultValue() { return m_default_value; } operator int() const219 operator int() const { return m_value; } operator ++(int dummy)220 int& operator++(int dummy) { m_value++; return m_value; } operator =(const int & v)221 int& operator=(const int& v) { m_value = v; return m_value; } operator =(const IntUserConfigParam & v)222 int& operator=(const IntUserConfigParam& v) 223 { m_value = (int)v; return m_value; } 224 }; // IntUserConfigParam 225 226 // ============================================================================ 227 class TimeUserConfigParam : public UserConfigParam 228 { 229 StkTime::TimeType m_value; 230 StkTime::TimeType m_default_value; 231 232 public: 233 234 TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, 235 const char* comment = NULL); 236 TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, 237 GroupUserConfigParam* group, const char* comment=NULL); 238 239 void write(std::stringstream& stream) const; 240 void findYourDataInAChildOf(const XMLNode* node); 241 void findYourDataInAnAttributeOf(const XMLNode* node); 242 243 irr::core::stringc toString() const; revertToDefaults()244 void revertToDefaults() { m_value = m_default_value; } operator StkTime::TimeType() const245 operator StkTime::TimeType() const { return m_value; } operator =(const StkTime::TimeType & v)246 StkTime::TimeType& operator=(const StkTime::TimeType& v) 247 { m_value = v; return m_value; } operator =(const TimeUserConfigParam & v)248 StkTime::TimeType& operator=(const TimeUserConfigParam& v) 249 { m_value = (int)v; return m_value; } 250 }; // TimeUserConfigParam 251 252 // ============================================================================ 253 class StringUserConfigParam : public UserConfigParam 254 { 255 protected: 256 std::string m_value; 257 std::string m_default_value; StringUserConfigParam(const char * param_name,const char * comment)258 StringUserConfigParam(const char* param_name, const char* comment) 259 { 260 m_param_name = param_name; 261 if (comment != NULL) 262 m_comment = comment; 263 } 264 265 public: 266 267 StringUserConfigParam(const char* default_value, const char* param_name, 268 const char* comment); 269 StringUserConfigParam(const char* default_value, const char* param_name, 270 GroupUserConfigParam* group, 271 const char* comment = NULL); 272 273 void write(std::stringstream& stream) const; 274 void findYourDataInAChildOf(const XMLNode* node); 275 void findYourDataInAnAttributeOf(const XMLNode* node); 276 revertToDefaults()277 void revertToDefaults() { m_value = m_default_value; } 278 getDefaultValue() const279 std::string getDefaultValue() const { return m_default_value; } 280 toString() const281 irr::core::stringc toString() const { return m_value.c_str(); } 282 operator std::string() const283 operator std::string() const { return m_value; } operator =(const std::string & v)284 std::string& operator=(const std::string& v) 285 { m_value = v; return m_value; } operator =(const StringUserConfigParam & v)286 std::string& operator=(const StringUserConfigParam& v) 287 { m_value = (std::string)v; return m_value; } 288 c_str() const289 const char* c_str() const { return m_value.c_str(); } 290 }; // StringUserConfigParam 291 292 // ============================================================================ 293 class BoolUserConfigParam : public UserConfigParam 294 { 295 protected: 296 bool m_value; 297 bool m_default_value; BoolUserConfigParam(const char * param_name,const char * comment)298 BoolUserConfigParam(const char* param_name, const char* comment) 299 { 300 m_param_name = param_name; 301 if (comment != NULL) 302 m_comment = comment; 303 } 304 305 public: 306 BoolUserConfigParam(bool default_value, const char* param_name, 307 const char* comment = NULL); 308 BoolUserConfigParam(bool default_value, const char* param_name, 309 GroupUserConfigParam* group, 310 const char* comment = NULL); 311 void write(std::stringstream& stream) const; 312 void findYourDataInAChildOf(const XMLNode* node); 313 void findYourDataInAnAttributeOf(const XMLNode* node); 314 315 irr::core::stringc toString() const; revertToDefaults()316 void revertToDefaults() { m_value = m_default_value; } setDefaultValue(bool v)317 void setDefaultValue(bool v) { m_value = m_default_value = v; } 318 operator bool() const319 operator bool() const { return m_value; } operator =(const bool & v)320 bool& operator=(const bool& v) { m_value = v; return m_value; } operator =(const BoolUserConfigParam & v)321 bool& operator=(const BoolUserConfigParam& v) 322 { m_value = (bool)v; return m_value; } 323 }; // BoolUserConfigParam 324 325 // ============================================================================ 326 class FloatUserConfigParam : public UserConfigParam 327 { 328 protected: 329 float m_value; 330 float m_default_value; FloatUserConfigParam(const char * param_name,const char * comment)331 FloatUserConfigParam(const char* param_name, const char* comment) 332 { 333 m_param_name = param_name; 334 if (comment != NULL) 335 m_comment = comment; 336 } 337 338 public: 339 FloatUserConfigParam(float default_value, const char* param_name, 340 const char* comment = NULL); 341 FloatUserConfigParam(float default_value, const char* param_name, 342 GroupUserConfigParam* group, 343 const char* comment = NULL); 344 345 void write(std::stringstream& stream) const; 346 void findYourDataInAChildOf(const XMLNode* node); 347 void findYourDataInAnAttributeOf(const XMLNode* node); 348 349 irr::core::stringc toString() const; revertToDefaults()350 void revertToDefaults() { m_value = m_default_value; } setDefaultValue(float v)351 void setDefaultValue(float v) { m_value = m_default_value = v; } 352 operator float() const353 operator float() const { return m_value; } operator =(const float & v)354 float& operator=(const float& v) { m_value = v; return m_value; } operator =(const FloatUserConfigParam & v)355 float& operator=(const FloatUserConfigParam& v) 356 { m_value = (float)v; return m_value; } 357 }; // FloatUserConfigParam 358 359 // ============================================================================ 360 enum AnimType {ANIMS_NONE = 0, 361 ANIMS_PLAYERS_ONLY = 1, 362 ANIMS_ALL = 2 }; 363 364 enum GeometryLevel 365 { 366 /** Display everything */ 367 GEOLEVEL_0 = 0, 368 /** a few details are displayed */ 369 GEOLEVEL_1 = 1, 370 /** Lowest level, no details are displayed. */ 371 GEOLEVEL_2 = 2 372 }; 373 374 enum MultitouchControls 375 { 376 MULTITOUCH_CONTROLS_UNDEFINED = 0, 377 MULTITOUCH_CONTROLS_STEERING_WHEEL = 1, 378 MULTITOUCH_CONTROLS_ACCELEROMETER = 2, 379 MULTITOUCH_CONTROLS_GYROSCOPE = 3, 380 }; 381 382 /** Using X-macros for setting-possible values is not very pretty, but it's a 383 * no-maintenance case : 384 * when you want to add a new parameter, just add one signle line below and 385 * everything else automagically works (including default value, saving to 386 * file, loading from file) 387 */ 388 389 #ifndef PARAM_PREFIX 390 #define PARAM_PREFIX extern 391 #endif 392 393 #ifndef PARAM_DEFAULT 394 #define PARAM_DEFAULT(X) 395 #endif 396 397 // ============================================================================ 398 /** \brief Contains all parameters that are stored in the user's config file 399 * \ingroup config 400 */ 401 namespace UserConfigParams 402 { 403 404 // ---- Audio 405 PARAM_PREFIX GroupUserConfigParam m_audio_group 406 PARAM_DEFAULT( GroupUserConfigParam("Audio", "Audio Settings") ); 407 408 PARAM_PREFIX BoolUserConfigParam m_sfx 409 PARAM_DEFAULT( BoolUserConfigParam(true, "sfx_on", &m_audio_group, 410 "Whether sound effects are enabled or not (true or false)") ); 411 PARAM_PREFIX BoolUserConfigParam m_music 412 PARAM_DEFAULT( BoolUserConfigParam(true, "music_on", 413 &m_audio_group, 414 "Whether musics are enabled or not (true or false)") ); 415 PARAM_PREFIX FloatUserConfigParam m_sfx_volume 416 PARAM_DEFAULT( FloatUserConfigParam(0.6f, "sfx_volume", 417 &m_audio_group, "Volume for sound effects, see openal AL_GAIN " 418 "for interpretation") ); 419 PARAM_PREFIX FloatUserConfigParam m_music_volume 420 PARAM_DEFAULT( FloatUserConfigParam(0.5f, "music_volume", 421 &m_audio_group, "Music volume from 0.0 to 1.0") ); 422 423 // ---- Race setup 424 PARAM_PREFIX GroupUserConfigParam m_race_setup_group 425 PARAM_DEFAULT( GroupUserConfigParam("RaceSetup", 426 "Race Setup Settings") ); 427 428 PARAM_PREFIX IntUserConfigParam m_default_num_karts 429 PARAM_DEFAULT( IntUserConfigParam(4, "numkarts", 430 &m_race_setup_group, 431 "Default number of karts. -1 means use all") ); 432 PARAM_PREFIX IntUserConfigParam m_num_laps 433 PARAM_DEFAULT( IntUserConfigParam(4, "numlaps", 434 &m_race_setup_group, "Default number of laps.") ); 435 PARAM_PREFIX IntUserConfigParam m_ffa_time_limit 436 PARAM_DEFAULT(IntUserConfigParam(3, "ffa-time-limit", 437 &m_race_setup_group, "Time limit in ffa mode.")); 438 PARAM_PREFIX BoolUserConfigParam m_use_ffa_mode 439 PARAM_DEFAULT(BoolUserConfigParam(false, "use-ffa-mode", 440 &m_race_setup_group, "Use ffa mode instead of 3 strikes battle.")); 441 PARAM_PREFIX IntUserConfigParam m_num_goals 442 PARAM_DEFAULT( IntUserConfigParam(3, "numgoals", 443 &m_race_setup_group, "Default number of goals in soccer mode.") ); 444 PARAM_PREFIX IntUserConfigParam m_soccer_default_team 445 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-default-team", 446 &m_race_setup_group, "Default team in soccer mode for single player.") ); 447 PARAM_PREFIX IntUserConfigParam m_soccer_time_limit 448 PARAM_DEFAULT( IntUserConfigParam(3, "soccer-time-limit", 449 &m_race_setup_group, "Time limit in soccer mode.") ); 450 PARAM_PREFIX BoolUserConfigParam m_soccer_use_time_limit 451 PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-use-time-limit", 452 &m_race_setup_group, "Enable time limit in soccer mode.") ); 453 PARAM_PREFIX BoolUserConfigParam m_random_arena_item 454 PARAM_DEFAULT( BoolUserConfigParam(false, "random-arena-item", 455 &m_race_setup_group, "Enable random location of items in an arena.") ); 456 PARAM_PREFIX IntUserConfigParam m_difficulty 457 PARAM_DEFAULT( IntUserConfigParam(0, "difficulty", 458 &m_race_setup_group, 459 "Default race difficulty. 0=easy, 1=medium, 2=hard") ); 460 PARAM_PREFIX IntUserConfigParam m_game_mode 461 PARAM_DEFAULT( IntUserConfigParam(0, "game_mode", 462 &m_race_setup_group, 463 "Game mode. 0=standard, 1=time trial, 2=follow " 464 "the leader, 3=3 strikes") ); 465 PARAM_PREFIX StringUserConfigParam m_default_kart 466 PARAM_DEFAULT( StringUserConfigParam("tux", "kart", 467 "Kart to select by default (the last used kart)") ); 468 PARAM_PREFIX StringUserConfigParam m_last_used_kart_group 469 PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group", 470 "Last selected kart group") ); 471 PARAM_PREFIX IntUserConfigParam m_soccer_red_ai_num 472 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-red-ai-num", 473 &m_race_setup_group, "Number of red AI karts in soccer mode.") ); 474 PARAM_PREFIX IntUserConfigParam m_soccer_blue_ai_num 475 PARAM_DEFAULT( IntUserConfigParam(0, "soccer-blue-ai-num", 476 &m_race_setup_group, "Number of blue AI karts in soccer mode.") ); 477 PARAM_PREFIX BoolUserConfigParam m_karts_powerup_gui 478 PARAM_DEFAULT( BoolUserConfigParam(false, "karts-powerup-gui", 479 &m_race_setup_group, "Show other karts' held powerups in race gui.") ); 480 PARAM_PREFIX BoolUserConfigParam m_soccer_player_list 481 PARAM_DEFAULT( BoolUserConfigParam(false, "soccer-player-list", 482 &m_race_setup_group, "Show player list icon in soccer mode.") ); 483 PARAM_PREFIX BoolUserConfigParam m_addon_tux_online 484 PARAM_DEFAULT( BoolUserConfigParam(false, "addon-tux-online", 485 &m_race_setup_group, "Always show online addon karts as tux when live join is on.") ); 486 487 // ---- Wiimote data 488 PARAM_PREFIX GroupUserConfigParam m_wiimote_group 489 PARAM_DEFAULT( GroupUserConfigParam("WiiMote", 490 "Settings for the wiimote") ); 491 PARAM_PREFIX FloatUserConfigParam m_wiimote_raw_max 492 PARAM_DEFAULT( FloatUserConfigParam(20.0f, "wiimote-raw-max", 493 &m_wiimote_group, 494 "At what raw input value maximum steering is reached (between 1 and 25).") ); 495 496 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear 497 PARAM_DEFAULT( FloatUserConfigParam(1.0f, "wiimote-weight-linear", 498 &m_wiimote_group, 499 "A weight applied to the linear component of mapping wiimote angle to steering angle")); 500 501 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_square 502 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-square", 503 &m_wiimote_group, 504 "A weight applied to the square component of mapping wiimote angle to steering angle")); 505 506 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_asin 507 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-asin", 508 &m_wiimote_group, 509 "A weight applied to the asin component of mapping wiimote angle to steering angle")); 510 511 PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_sin 512 PARAM_DEFAULT( FloatUserConfigParam(0.0f, "wiimote-weight-sin", 513 &m_wiimote_group, 514 "A weight applied to the sin component of mapping wiimote angle to steering angle")); 515 516 // ---- Multitouch device 517 PARAM_PREFIX GroupUserConfigParam m_multitouch_group 518 PARAM_DEFAULT( GroupUserConfigParam("Multitouch", 519 "Settings for the multitouch device") ); 520 521 PARAM_PREFIX IntUserConfigParam m_multitouch_active 522 PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_active", 523 &m_multitouch_group, 524 "Enable multitouch support: 0 = disabled, 1 = if available, 2 = enabled") ); 525 526 PARAM_PREFIX BoolUserConfigParam m_multitouch_draw_gui 527 PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_draw_gui", 528 &m_multitouch_group, 529 "Enable multitouch race GUI")); 530 531 PARAM_PREFIX BoolUserConfigParam m_multitouch_inverted 532 PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_inverted", 533 &m_multitouch_group, 534 "Draw steering wheel on right side.") ); 535 536 PARAM_PREFIX IntUserConfigParam m_multitouch_controls 537 PARAM_DEFAULT( IntUserConfigParam(0, "multitouch_controls", 538 &m_multitouch_group, 539 "Multitouch mode: 0 = undefined, 1 = steering wheel, 2 = accelerometer, 3 = gyroscope")); 540 541 PARAM_PREFIX FloatUserConfigParam m_multitouch_deadzone 542 PARAM_DEFAULT( FloatUserConfigParam(0.1f, "multitouch_deadzone", 543 &m_multitouch_group, 544 "A parameter in range [0, 0.5] that determines the zone that is " 545 "considered as centered in steering button.")); 546 547 PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_x 548 PARAM_DEFAULT( FloatUserConfigParam(0.2f, "multitouch_sensitivity_x", 549 &m_multitouch_group, 550 "A parameter in range [0, 1.0] that determines the sensitivity for x axis.")); 551 552 PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_y 553 PARAM_DEFAULT( FloatUserConfigParam(0.65f, "multitouch_sensitivity_y", 554 &m_multitouch_group, 555 "A parameter in range [0, 1.0] that determines the sensitivity for y axis.")); 556 557 PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor 558 PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor", 559 &m_multitouch_group, 560 "A parameter that determines general accelerometer sensitivity.")); 561 562 PARAM_PREFIX FloatUserConfigParam m_multitouch_scale 563 PARAM_DEFAULT( FloatUserConfigParam(1.2f, "multitouch_scale", 564 &m_multitouch_group, 565 "A parameter in range [0.5, 1.5] that determines the scale of the " 566 "multitouch interface.")); 567 568 PARAM_PREFIX IntUserConfigParam m_screen_keyboard 569 PARAM_DEFAULT( IntUserConfigParam(0, "screen_keyboard_status", 570 &m_multitouch_group, 571 "STK screen keyboard status: 0 = disabled, 1 = enabled") ); 572 573 // ---- GP start order 574 PARAM_PREFIX GroupUserConfigParam m_gp_start_order 575 PARAM_DEFAULT( GroupUserConfigParam("GpStartOrder", 576 "Order karts start in GP") ); 577 PARAM_PREFIX BoolUserConfigParam m_gp_most_points_first 578 PARAM_DEFAULT( BoolUserConfigParam(true, "most_points_first", 579 &m_gp_start_order, 580 "Starting order from most to least points (true) or other " 581 "way around (false)") ); 582 PARAM_PREFIX BoolUserConfigParam m_gp_player_last 583 PARAM_DEFAULT( BoolUserConfigParam(false, "player_last", 584 &m_gp_start_order, 585 "Always put the player at the back or not (Bully mode).") ); 586 PARAM_PREFIX StringUserConfigParam m_additional_gp_directory 587 PARAM_DEFAULT( StringUserConfigParam("", "additional_gp_directory", 588 "Directory with additional GP's.")); 589 590 // ---- Video 591 PARAM_PREFIX GroupUserConfigParam m_video_group 592 PARAM_DEFAULT( GroupUserConfigParam("Video", "Video Settings") ); 593 594 PARAM_PREFIX IntUserConfigParam m_width 595 PARAM_DEFAULT( IntUserConfigParam(1024, "width", &m_video_group, 596 "Screen/window width in pixels") ); 597 PARAM_PREFIX IntUserConfigParam m_height 598 PARAM_DEFAULT( IntUserConfigParam(768, "height", &m_video_group, 599 "Screen/window height in pixels") ); 600 PARAM_PREFIX BoolUserConfigParam m_fullscreen 601 PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen", 602 &m_video_group) ); 603 PARAM_PREFIX IntUserConfigParam m_prev_width 604 PARAM_DEFAULT( IntUserConfigParam(1024, "prev_width", 605 &m_video_group, "Previous screen/window width") ); 606 PARAM_PREFIX IntUserConfigParam m_prev_height 607 PARAM_DEFAULT( IntUserConfigParam(768, "prev_height", 608 &m_video_group,"Previous screen/window height") ); 609 PARAM_PREFIX BoolUserConfigParam m_prev_fullscreen 610 PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen", 611 &m_video_group) ); 612 613 614 PARAM_PREFIX BoolUserConfigParam m_remember_window_location 615 PARAM_DEFAULT( BoolUserConfigParam(false, "remember_window_location", 616 &m_video_group) ); 617 PARAM_PREFIX IntUserConfigParam m_window_x 618 PARAM_DEFAULT( IntUserConfigParam(-1, "window_x", 619 &m_video_group,"If remember_window_location is true") ); 620 PARAM_PREFIX IntUserConfigParam m_window_y 621 PARAM_DEFAULT( IntUserConfigParam(-1, "window_y", 622 &m_video_group,"If remember_window_location is true") ); 623 624 PARAM_PREFIX BoolUserConfigParam m_display_fps 625 PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps", 626 &m_video_group, "Display frame per seconds") ); 627 PARAM_PREFIX BoolUserConfigParam m_display_story_mode_timer 628 PARAM_DEFAULT( BoolUserConfigParam(true, "show_story_mode_timer", 629 &m_video_group, "Display the story mode timer") ); 630 PARAM_PREFIX BoolUserConfigParam m_speedrun_mode 631 PARAM_DEFAULT( BoolUserConfigParam(false, "show_speedrun_timer", 632 &m_video_group, "Display the speedrun timer") ); 633 PARAM_PREFIX IntUserConfigParam m_max_fps 634 PARAM_DEFAULT( IntUserConfigParam(120, "max_fps", 635 &m_video_group, "Maximum fps, should be at least 60") ); 636 PARAM_PREFIX BoolUserConfigParam m_force_legacy_device 637 PARAM_DEFAULT(BoolUserConfigParam(false, "force_legacy_device", 638 &m_video_group, "Force OpenGL 2 context, even if OpenGL 3 is available.")); 639 PARAM_PREFIX BoolUserConfigParam split_screen_horizontally 640 PARAM_DEFAULT(BoolUserConfigParam(true, "split_screen_horizontally", 641 &m_video_group, "When playing a non-square amount of players (e.g. 2)," 642 " should it split horizontally (top/bottom)")); 643 PARAM_PREFIX BoolUserConfigParam m_texture_compression 644 PARAM_DEFAULT(BoolUserConfigParam(true, "enable_texture_compression", 645 &m_video_group, "Enable Texture Compression")); 646 /** This is a bit flag: bit 0: enabled (1) or disabled(0). 647 * Bit 1: setting done by default(0), or by user choice (2). This allows 648 * to e.g. disable h.d. textures on hd3000 as default, but still allow the 649 * user to enable it. */ 650 PARAM_PREFIX IntUserConfigParam m_high_definition_textures 651 PARAM_DEFAULT(IntUserConfigParam(1, "enable_high_definition_textures", 652 &m_video_group, "Enable high definition textures. Bit flag: " 653 "bit 0 = enabled/disabled; bit 1 = set by user/set as default")); 654 PARAM_PREFIX BoolUserConfigParam m_glow 655 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_glow", 656 &m_video_group, "Enable Glow")); 657 PARAM_PREFIX BoolUserConfigParam m_bloom 658 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_bloom", 659 &m_video_group, "Enable Bloom")); 660 PARAM_PREFIX BoolUserConfigParam m_light_shaft 661 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_light_shaft", 662 &m_video_group, "Enable Light Shafts")); 663 PARAM_PREFIX BoolUserConfigParam m_dynamic_lights 664 PARAM_DEFAULT(BoolUserConfigParam(true, "enable_dynamic_lights", 665 &m_video_group, "Enable Dynamic Lights")); 666 PARAM_PREFIX BoolUserConfigParam m_dof 667 PARAM_DEFAULT(BoolUserConfigParam(false, "enable_dof", 668 &m_video_group, "Enable Depth of Field")); 669 PARAM_PREFIX BoolUserConfigParam m_old_driver_popup 670 PARAM_DEFAULT(BoolUserConfigParam(true, "old_driver_popup", 671 &m_video_group, "Determines if popup message about too old drivers should be displayed.")); 672 PARAM_PREFIX FloatUserConfigParam m_scale_rtts_factor 673 PARAM_DEFAULT(FloatUserConfigParam(1.0f, "scale_rtts_factor", 674 &m_video_group, "Allows one to increase performance by setting lower RTTs " 675 "resolution. Value should be smaller or equal to 1.0")); 676 PARAM_PREFIX IntUserConfigParam m_max_texture_size 677 PARAM_DEFAULT(IntUserConfigParam(512, "max_texture_size", 678 &m_video_group, "Max texture size when high definition textures are " 679 "disabled")); 680 681 PARAM_PREFIX BoolUserConfigParam m_hq_mipmap 682 PARAM_DEFAULT(BoolUserConfigParam(false, "hq_mipmap", 683 &m_video_group, "Generate mipmap for textures using " 684 "high quality method with SSE")); 685 PARAM_PREFIX FloatUserConfigParam m_font_size 686 PARAM_DEFAULT( FloatUserConfigParam(3, "font_size", 687 &m_video_group,"The size of fonts. 0 is the smallest and 6 is the biggest") ); 688 689 // ---- Recording 690 PARAM_PREFIX GroupUserConfigParam m_recording_group 691 PARAM_DEFAULT(GroupUserConfigParam("Recording", 692 "Recording Settings")); 693 694 PARAM_PREFIX BoolUserConfigParam m_limit_game_fps 695 PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps", 696 &m_recording_group, "Limit game framerate not beyond the fps of" 697 " recording video.")); 698 PARAM_PREFIX IntUserConfigParam m_video_format 699 PARAM_DEFAULT(IntUserConfigParam(0, "video_format", 700 &m_recording_group, "Specify the video for record, which is the enum" 701 " of VideoFormat in libopenglrecorder. It will" 702 " auto fallback to MJPEG if libopenglrecorder was" 703 " not compiled with such video encoder.")); 704 705 PARAM_PREFIX IntUserConfigParam m_audio_bitrate 706 PARAM_DEFAULT(IntUserConfigParam(112000, "audio_bitrate", 707 &m_recording_group, "Specify the bitrate for audio")); 708 709 PARAM_PREFIX IntUserConfigParam m_video_bitrate 710 PARAM_DEFAULT(IntUserConfigParam(20000, "video_bitrate", 711 &m_recording_group, "Specify the bitrate for video")); 712 713 PARAM_PREFIX IntUserConfigParam m_recorder_jpg_quality 714 PARAM_DEFAULT(IntUserConfigParam(90, "recorder_jpg_quality", 715 &m_recording_group, "Specify the jpg compression level of recorder")); 716 717 PARAM_PREFIX IntUserConfigParam m_record_fps 718 PARAM_DEFAULT(IntUserConfigParam(30, "record_fps", 719 &m_recording_group, "Specify the fps of recording video")); 720 721 // ---- Debug - not saved to config file 722 /** If gamepad debugging is enabled. */ 723 PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false); 724 725 /** If gamepad debugging is enabled. */ 726 PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false ); 727 728 /** If gamepad debugging is enabled. */ 729 PARAM_PREFIX bool m_keyboard_debug PARAM_DEFAULT(false); 730 731 /** Wiimote debugging. */ 732 PARAM_PREFIX bool m_wiimote_debug PARAM_DEFAULT( false ); 733 734 /** Debug gamepads by visualising their values. */ 735 PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false ); 736 737 /** If material debugging (printing terrain specific slowdown) 738 * is enabled. */ 739 PARAM_PREFIX bool m_material_debug PARAM_DEFAULT( false ); 740 741 /** If track debugging is enabled. */ 742 PARAM_PREFIX int m_track_debug PARAM_DEFAULT( false ); 743 744 /** True if check structures should be debugged. */ 745 PARAM_PREFIX bool m_check_debug PARAM_DEFAULT( false ); 746 747 /** True if physics debugging should be enabled. */ 748 PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false ); 749 750 /** True if fps should be printed each frame. */ 751 PARAM_PREFIX bool m_fps_debug PARAM_DEFAULT(false); 752 753 /** True if arena (battle/soccer) ai profiling. */ 754 PARAM_PREFIX bool m_arena_ai_stats PARAM_DEFAULT(false); 755 756 /** True if slipstream debugging is activated. */ 757 PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false ); 758 759 /** True if follow-the-leader debug information should be printed. */ 760 PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false ); 761 762 /** True if currently developed tutorial debugging is enabled. */ 763 PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false ); 764 765 /** Verbosity level for debug messages. Note that error and 766 * important warnings must always be printed. */ 767 PARAM_PREFIX int m_verbosity PARAM_DEFAULT( 0 ); 768 769 PARAM_PREFIX bool m_no_start_screen PARAM_DEFAULT( false ); 770 771 PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false ); 772 773 PARAM_PREFIX bool m_enforce_current_player PARAM_DEFAULT( false ); 774 775 PARAM_PREFIX bool m_enable_sound PARAM_DEFAULT( true ); 776 777 /** True to test funky ambient/diffuse/specularity in RGB & 778 * all anisotropic */ 779 PARAM_PREFIX bool m_rendering_debug PARAM_DEFAULT( false ); 780 781 /** True if graphical profiler should be displayed */ 782 PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false ); 783 784 // ---- Networking 785 // These stk domains have only a record to each ipv6 stun below, 786 // so we can use this to know ipv4 address of nat64 gateway (if any) 787 PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers_v4 788 PARAM_DEFAULT(StringToUIntUserConfigParam("stun-servers-ipv4", 789 "The stun servers that will be used to know the public address " 790 "(ipv4 only) with port", {{ "stun-server", "address", "ping" }}, 791 { 792 { "stunv4.linuxreviews.org:3478", 0u }, 793 { "stunv4.7.supertuxkart.net:3478", 0u }, 794 { "stunv4.8.supertuxkart.net:3478", 0u } 795 } 796 )); 797 798 PARAM_PREFIX StringToUIntUserConfigParam m_stun_servers 799 PARAM_DEFAULT(StringToUIntUserConfigParam("stun-servers-ipv6", 800 "The stun servers that will be used to know the public address " 801 "(including ipv6) with port", {{ "stun-server", "address", "ping" }}, 802 { 803 { "stunv6.linuxreviews.org:3478", 0u }, 804 { "stun.l.google.com:19302", 0u }, 805 { "stun1.l.google.com:19302", 0u }, 806 { "stun2.l.google.com:19302", 0u }, 807 { "stun3.l.google.com:19302", 0u }, 808 { "stun4.l.google.com:19302", 0u } 809 } 810 )); 811 812 PARAM_PREFIX GroupUserConfigParam m_network_group 813 PARAM_DEFAULT(GroupUserConfigParam("Network", "Network Settings")); 814 PARAM_PREFIX BoolUserConfigParam m_enable_network_splitscreen 815 PARAM_DEFAULT(BoolUserConfigParam(false, "enable-network-splitscreen", 816 &m_network_group, "The default value of enable splitscreen checkbox " 817 "in online screen.")); 818 PARAM_PREFIX BoolUserConfigParam m_log_packets 819 PARAM_DEFAULT(BoolUserConfigParam(false, "log-network-packets", 820 &m_network_group, "If all network packets should be logged")); 821 PARAM_PREFIX BoolUserConfigParam m_random_client_port 822 PARAM_DEFAULT(BoolUserConfigParam(true, "random-client-port", 823 &m_network_group, "Use random port for client connection " 824 "(check stk_config.xml for default value)")); 825 PARAM_PREFIX BoolUserConfigParam m_random_server_port 826 PARAM_DEFAULT(BoolUserConfigParam(false, "random-server-port", 827 &m_network_group, "Use random port for server connection " 828 "(check stk_config.xml for default value)")); 829 PARAM_PREFIX BoolUserConfigParam m_lobby_chat 830 PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat", 831 &m_network_group, "Enable chatting in networking lobby, if off than " 832 "no chat message will be displayed from any players.")); 833 PARAM_PREFIX BoolUserConfigParam m_race_chat 834 PARAM_DEFAULT(BoolUserConfigParam(true, "race-chat", 835 &m_network_group, "Enable chatting during races.")); 836 PARAM_PREFIX BoolUserConfigParam m_ipv6_lan 837 PARAM_DEFAULT(BoolUserConfigParam(true, "ipv6-lan", 838 &m_network_group, "Enable IPv6 LAN server discovery.")); 839 PARAM_PREFIX IntUserConfigParam m_max_players 840 PARAM_DEFAULT(IntUserConfigParam(8, "max-players", 841 &m_network_group, "Maximum number of players on the server " 842 "(for gui server creation.")); 843 PARAM_PREFIX IntUserConfigParam m_timer_sync_difference_tolerance 844 PARAM_DEFAULT(IntUserConfigParam(5, "timer-sync-difference-tolerance", 845 &m_network_group, "Max time difference tolerance (in ms) to synchronize timer with server.")); 846 PARAM_PREFIX IntUserConfigParam m_default_ip_type 847 PARAM_DEFAULT(IntUserConfigParam(0, "default-ip-type", 848 &m_network_group, "Default IP type of this machine, " 849 "0 detect every time, 1 IPv4, 2 IPv6, 3 IPv6 NAT64, 4 Dual stack.")); 850 851 // ---- Gamemode setup 852 PARAM_PREFIX UIntToUIntUserConfigParam m_num_karts_per_gamemode 853 PARAM_DEFAULT(UIntToUIntUserConfigParam("num-karts-per-gamemode", 854 "The Number of karts per gamemode.", 855 {{ "gamemode-list", "gamemode", "num-karts" }}, 856 { 857 { 0u, 4u }, 858 { 1002u, 5u }, 859 { 1100u, 4u }, 860 { 1101u, 4u }, 861 { 2000u, 4u }, 862 { 2001u, 4u } 863 } 864 )); 865 866 // ---- Graphic Quality 867 PARAM_PREFIX GroupUserConfigParam m_graphics_quality 868 PARAM_DEFAULT( GroupUserConfigParam("GFX", 869 "Graphics Quality Settings") ); 870 871 PARAM_PREFIX IntUserConfigParam m_particles_effects 872 PARAM_DEFAULT( IntUserConfigParam(2, "particles-effecs", 873 &m_graphics_quality, "Particles effects: 0 disabled, 1 only important, 2 enabled") ); 874 875 // This saves the actual user preference. 876 PARAM_PREFIX IntUserConfigParam m_xmas_mode 877 PARAM_DEFAULT( IntUserConfigParam(0, "christmas-mode", 878 &m_graphics_quality, "Christmas hats: 0 use current date, 1 always on, 2 always off") ); 879 880 // This saves the actual user preference. 881 PARAM_PREFIX IntUserConfigParam m_easter_ear_mode 882 PARAM_DEFAULT(IntUserConfigParam(0, "easter-ear-mode", 883 &m_graphics_quality, "Easter Bunny Ears: 0 use current date, 1 always on, 2 always off")); 884 885 PARAM_PREFIX BoolUserConfigParam m_animated_characters 886 PARAM_DEFAULT( BoolUserConfigParam(true, 887 "animated-characters", &m_graphics_quality, 888 "Whether to display animated characters") ); 889 890 PARAM_PREFIX IntUserConfigParam m_geometry_level 891 PARAM_DEFAULT( IntUserConfigParam(GEOLEVEL_0, 892 "geometry_level", &m_graphics_quality, 893 "Geometry quality 0=everything is displayed; " 894 "1=a few details are displayed; 2=lowest level, no details") ); 895 896 PARAM_PREFIX IntUserConfigParam m_anisotropic 897 PARAM_DEFAULT( IntUserConfigParam(4, "anisotropic", 898 &m_graphics_quality, 899 "Quality of anisotropic filtering (usual values include 2-4-8-16; 0 to disable)") ); 900 901 PARAM_PREFIX IntUserConfigParam m_swap_interval 902 PARAM_DEFAULT( IntUserConfigParam(0, "swap_interval", 903 &m_graphics_quality, 904 "Swap interval for vsync: 0 = disabled, 1 = full") ); 905 PARAM_PREFIX BoolUserConfigParam m_motionblur 906 PARAM_DEFAULT( BoolUserConfigParam(false, 907 "motionblur_enabled", &m_graphics_quality, 908 "Whether motion blur should be enabled") ); 909 PARAM_PREFIX BoolUserConfigParam m_mlaa 910 PARAM_DEFAULT( BoolUserConfigParam(false, 911 "mlaa", &m_graphics_quality, 912 "Whether MLAA anti-aliasing should be enabled") ); 913 PARAM_PREFIX BoolUserConfigParam m_ssao 914 PARAM_DEFAULT(BoolUserConfigParam(false, 915 "ssao", &m_graphics_quality, 916 "Enable Screen Space Ambient Occlusion") ); 917 PARAM_PREFIX BoolUserConfigParam m_light_scatter 918 PARAM_DEFAULT(BoolUserConfigParam(true, 919 "light_scatter", &m_graphics_quality, 920 "Enable light scattering shaders") ); 921 PARAM_PREFIX IntUserConfigParam m_shadows_resolution 922 PARAM_DEFAULT( IntUserConfigParam(0, 923 "shadows_resolution", &m_graphics_quality, 924 "Shadow resolution (0 = disabled") ); 925 PARAM_PREFIX BoolUserConfigParam m_degraded_IBL 926 PARAM_DEFAULT(BoolUserConfigParam(true, 927 "Degraded_IBL", &m_graphics_quality, 928 "Disable specular IBL")); 929 930 // ---- Misc 931 PARAM_PREFIX BoolUserConfigParam m_cache_overworld 932 PARAM_DEFAULT( BoolUserConfigParam(true, "cache-overworld") ); 933 934 // TODO : is this used with new code? does it still work? 935 PARAM_PREFIX BoolUserConfigParam m_crashed 936 PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") ); 937 938 // ---- Camera 939 PARAM_PREFIX GroupUserConfigParam m_camera_normal 940 PARAM_DEFAULT( GroupUserConfigParam( 941 "camera-normal", 942 "Camera settings for player.") ); 943 944 PARAM_PREFIX FloatUserConfigParam m_camera_distance 945 PARAM_DEFAULT( FloatUserConfigParam(1.0, "distance", 946 &m_camera_normal, 947 "Distance between kart and camera")); 948 949 PARAM_PREFIX FloatUserConfigParam m_camera_forward_up_angle 950 PARAM_DEFAULT( FloatUserConfigParam(0, "forward-up-angle", 951 &m_camera_normal, 952 "Angle between camera and plane of kart (pitch) when the camera is pointing forward")); 953 954 PARAM_PREFIX BoolUserConfigParam m_camera_forward_smoothing 955 PARAM_DEFAULT( BoolUserConfigParam(true, "forward-smoothing", 956 &m_camera_normal, 957 "if true, use smoothing (forward-up-angle become relative to speed) when pointing forward")); 958 959 PARAM_PREFIX FloatUserConfigParam m_camera_backward_up_angle 960 PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle", 961 &m_camera_normal, 962 "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")); 963 964 PARAM_PREFIX IntUserConfigParam m_camera_fov 965 PARAM_DEFAULT( IntUserConfigParam(80, "fov", 966 &m_camera_normal, 967 "Focal distance (single player)")); 968 969 970 // camera in artist mode 971 PARAM_PREFIX GroupUserConfigParam m_camera 972 PARAM_DEFAULT( GroupUserConfigParam("camera", 973 "(Debug) camera settings.") ); 974 975 PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold 976 PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold", 977 &m_camera, 978 "If the kart is driving backwards faster than this value,\n" 979 "switch automatically to reverse camera (set to 0 to disable).") ); 980 981 PARAM_PREFIX FloatUserConfigParam m_fpscam_direction_speed 982 PARAM_DEFAULT( FloatUserConfigParam(0.003f, "fpscam_rotation_speed", 983 &m_camera, 984 "How fast the first person camera's direction speed changes when\n" 985 "moving the mouse (means acceleration).") ); 986 987 PARAM_PREFIX FloatUserConfigParam m_fpscam_smooth_direction_max_speed 988 PARAM_DEFAULT( FloatUserConfigParam(0.04f, "fpscam_smooth_rotation_max_speed", 989 &m_camera, 990 "How fast the first person camera's direction can change.") ); 991 992 PARAM_PREFIX FloatUserConfigParam m_fpscam_angular_velocity 993 PARAM_DEFAULT( FloatUserConfigParam(0.02f, "fpscam_angular_velocity", 994 &m_camera, 995 "How fast the first person camera's rotation speed changes.") ); 996 997 PARAM_PREFIX FloatUserConfigParam m_fpscam_max_angular_velocity 998 PARAM_DEFAULT( FloatUserConfigParam(1.0f, "fpscam_max_angular_velocity", 999 &m_camera, 1000 "How fast the first person camera can rotate.") ); 1001 1002 PARAM_PREFIX StringUserConfigParam m_item_style 1003 PARAM_DEFAULT( StringUserConfigParam("items", "item_style", 1004 "Name of the .items file to use.") ); 1005 1006 PARAM_PREFIX StringUserConfigParam m_last_track 1007 PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track", 1008 "Name of the last track used.") ); 1009 PARAM_PREFIX StringUserConfigParam m_last_used_track_group 1010 PARAM_DEFAULT( StringUserConfigParam("all", "last_track_group", 1011 "Last selected track group") ); 1012 1013 PARAM_PREFIX StringUserConfigParam m_skin_file 1014 PARAM_DEFAULT( StringUserConfigParam("peach", "skin_name", 1015 "Name of the skin to use") ); 1016 1017 PARAM_PREFIX IntUserConfigParam m_minimap_display 1018 PARAM_DEFAULT(IntUserConfigParam(0, "minimap_display", 1019 "Minimap: 0 bottom-left, 1 middle-right, 2 hidden, 3 center")); 1020 1021 // ---- Settings for spectator camera 1022 PARAM_PREFIX GroupUserConfigParam m_spectator 1023 PARAM_DEFAULT( GroupUserConfigParam("Spectator", 1024 "Everything related to spectator mode.") ); 1025 1026 PARAM_PREFIX FloatUserConfigParam m_spectator_camera_distance 1027 PARAM_DEFAULT( FloatUserConfigParam(6.75, "camera-distance", &m_spectator, 1028 "Distance between kart and camera.") ); 1029 PARAM_PREFIX FloatUserConfigParam m_spectator_camera_angle 1030 PARAM_DEFAULT( FloatUserConfigParam(40.0, "camera-angle", &m_spectator, 1031 "Angle between ground, kart and camera.") ); 1032 1033 // ---- Special settings for soccer mode 1034 PARAM_PREFIX BoolUserConfigParam m_reverse_look_use_soccer_cam 1035 PARAM_DEFAULT( BoolUserConfigParam(false, "reverse-look-use-soccer-cam", 1036 "Use ball camera in soccer mode, instead of reverse") ); 1037 1038 // ---- Handicap 1039 PARAM_PREFIX GroupUserConfigParam m_handicap 1040 PARAM_DEFAULT( GroupUserConfigParam("Handicap", 1041 "Everything related to handicaps.") ); 1042 1043 PARAM_PREFIX BoolUserConfigParam m_per_player_difficulty 1044 PARAM_DEFAULT( BoolUserConfigParam(false, "per_player_difficulty", 1045 &m_handicap, 1046 "If handicapped users can be selected") ); 1047 1048 // ---- Internet related 1049 1050 PARAM_PREFIX IntUserConfigParam m_internet_status 1051 PARAM_DEFAULT( IntUserConfigParam(0, "enable_internet", 1052 "Status of internet: 0 user " 1053 "wasn't asked, 1: allowed, 2: " 1054 "not allowed") ); 1055 1056 PARAM_PREFIX GroupUserConfigParam m_hw_report_group 1057 PARAM_DEFAULT( GroupUserConfigParam("HWReport", 1058 "Everything related to hardware configuration.") ); 1059 1060 PARAM_PREFIX IntUserConfigParam m_last_hw_report_version 1061 PARAM_DEFAULT( IntUserConfigParam(0, "report-version", &m_hw_report_group, 1062 "Version of hardware report " 1063 "that was reported last") ); 1064 PARAM_PREFIX IntUserConfigParam m_random_identifier 1065 PARAM_DEFAULT( IntUserConfigParam(0, "random-identifier", &m_hw_report_group, 1066 "A random number to avoid duplicated reports.") ); 1067 1068 PARAM_PREFIX BoolUserConfigParam m_hw_report_enable 1069 PARAM_DEFAULT( BoolUserConfigParam( false, 1070 "hw-report-enabled", 1071 &m_hw_report_group, 1072 "If HW reports are enabled.")); 1073 1074 // ---- User management 1075 1076 PARAM_PREFIX BoolUserConfigParam m_always_show_login_screen 1077 PARAM_DEFAULT( BoolUserConfigParam(false, "always_show_login_screen", 1078 "Always show the login screen even if last player's session was saved.")); 1079 1080 1081 // ---- Addon server related entries 1082 PARAM_PREFIX GroupUserConfigParam m_addon_group 1083 PARAM_DEFAULT( GroupUserConfigParam("AddonServer", 1084 "Addon and news related settings") ); 1085 1086 PARAM_PREFIX TimeUserConfigParam m_news_last_updated 1087 PARAM_DEFAULT( TimeUserConfigParam(0, "news_last_updated", 1088 &m_addon_group, 1089 "Time news was updated last.") ); 1090 1091 PARAM_PREFIX IntUserConfigParam m_news_frequency 1092 PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency", 1093 &m_addon_group, 1094 "How often news should be updated.") ); 1095 1096 PARAM_PREFIX StringUserConfigParam m_display_count 1097 PARAM_DEFAULT( StringUserConfigParam("", "news_display_count", 1098 &m_addon_group, 1099 "How often all news messages " 1100 "have been displayed") ); 1101 1102 PARAM_PREFIX IntUserConfigParam m_last_important_message_id 1103 PARAM_DEFAULT( IntUserConfigParam(-1, "last_important_message_id", 1104 &m_addon_group, 1105 "Don't show important message " 1106 "with this or a lower id again") ); 1107 1108 PARAM_PREFIX TimeUserConfigParam m_addons_last_updated 1109 PARAM_DEFAULT( TimeUserConfigParam(0, "addon_last_updated", 1110 &m_addon_group, 1111 "Time addon-list was updated last.") ); 1112 1113 PARAM_PREFIX StringUserConfigParam m_language 1114 PARAM_DEFAULT( StringUserConfigParam("system", "language", 1115 "Which language to use (language code or 'system')") ); 1116 1117 PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode 1118 PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode", 1119 "Whether to enable track debugging features") ); 1120 1121 PARAM_PREFIX BoolUserConfigParam m_hide_gui 1122 PARAM_DEFAULT(BoolUserConfigParam(false, "debug_hide_gui", 1123 "Whether to hide the GUI (artist debug mode)")); 1124 1125 PARAM_PREFIX IntUserConfigParam m_unlock_everything 1126 PARAM_DEFAULT( IntUserConfigParam(0, "unlock_everything", 1127 "Enable all karts and tracks: 0 = disabled, " 1128 "1 = everything except final race, 2 = everything") ); 1129 1130 PARAM_PREFIX StringUserConfigParam m_commandline 1131 PARAM_DEFAULT( StringUserConfigParam("", "commandline", 1132 "Allows one to set commandline args in config file") ); 1133 1134 // TODO? implement blacklist for new irrlicht device and GUI 1135 PARAM_PREFIX std::vector<std::string> m_blacklist_res; 1136 1137 /** List of all saved GPs. */ 1138 PARAM_PREFIX PtrVector<SavedGrandPrix> m_saved_grand_prix_list; 1139 1140 /** Some constants to bitmask to enable various messages to be printed. */ 1141 enum { LOG_MEMORY = 0x0001, 1142 LOG_GUI = 0x0002, 1143 LOG_ADDONS = 0x0004, 1144 LOG_MISC = 0x0008, 1145 LOG_FLYABLE = 0x0010, 1146 LOG_ALL = 0xffff }; 1147 1148 /** Returns true if the user want additional messages for memory usage. */ 1149 bool logMemory(); 1150 /** Returns true if the user want additional messages related to GUI. */ 1151 bool logGUI (); 1152 /** Returns true if the user want additional messages related to addons. */ 1153 bool logAddons(); 1154 /** Returns true if the user want additional debug info for flyables */ 1155 bool logFlyable(); 1156 /** Returns true if the user want additional messages for general items. */ 1157 bool logMisc (); 1158 1159 1160 } 1161 #undef PARAM_PREFIX 1162 #undef PARAM_SUFFIX 1163 1164 // ============================================================================ 1165 /** 1166 * \brief Class for managing general STK user configuration data. 1167 * \ingroup config 1168 */ 1169 class UserConfig : public NoCopy 1170 { 1171 private: 1172 1173 /** Filename of the user config file. */ 1174 std::string m_filename; 1175 irr::core::stringw m_warning; 1176 1177 static const int m_current_config_version; 1178 1179 public: 1180 /** Create the user config object; does not actually load it, 1181 * UserConfig::loadConfig needs to be called. */ 1182 UserConfig(); 1183 ~UserConfig(); 1184 1185 bool loadConfig(); 1186 void saveConfig(); 1187 getWarning()1188 const irr::core::stringw& getWarning() { return m_warning; } resetWarning()1189 void resetWarning() { m_warning=""; } setWarning(irr::core::stringw & warning)1190 void setWarning(irr::core::stringw& warning) { m_warning=warning; } 1191 1192 }; // UserConfig 1193 1194 1195 extern UserConfig *user_config; 1196 1197 #endif 1198 1199 /*EOF*/ 1200