2007-05-27 12:01:53 -04:00
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2006 SuperTuxKart-Team
|
|
|
|
// Modelled after Supertux's configfile.h
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-06-12 20:53:52 -04:00
|
|
|
// as published by the Free Software Foundation; either version 3
|
2007-05-27 12:01:53 -04:00
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
2009-01-22 07:02:40 -05:00
|
|
|
#ifndef HEADER_USER_CONFIG_HPP
|
|
|
|
#define HEADER_USER_CONFIG_HPP
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
/* The following config versions are currently used:
|
2008-03-30 11:18:19 -04:00
|
|
|
0: the 0.2 release config file, without config-version number
|
2007-05-27 12:01:53 -04:00
|
|
|
(so that defaults to 0)
|
|
|
|
1: Removed singleWindowMenu, newKeyboardStyle, oldStatusDisplay,
|
|
|
|
added config-version number
|
|
|
|
Version 1 can read version 0 without any problems, so
|
|
|
|
SUPPORTED_CONFIG_VERSION is 0.
|
|
|
|
2: Changed to SDL keyboard bindings
|
2008-01-16 19:09:23 -05:00
|
|
|
3: Added username (userid was used for ALL players)
|
|
|
|
4: Added username per player
|
|
|
|
5: Enabled jumping, which might cause a problem with old
|
|
|
|
config files (which have an unused entry for jump defined
|
|
|
|
--> if a kart control for (say) player 2 uses the same key as
|
|
|
|
jump for player 1, this problem is not noticed in 0.3, but will
|
|
|
|
cause an undefined game action now
|
2008-03-31 19:15:33 -04:00
|
|
|
6: Added stick configurations.
|
2007-05-27 12:01:53 -04:00
|
|
|
*/
|
2010-03-21 21:21:49 -04:00
|
|
|
const int CURRENT_CONFIG_VERSION = 8;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
#include <string>
|
2009-01-04 18:03:37 -05:00
|
|
|
#include <map>
|
2008-01-12 17:33:24 -05:00
|
|
|
#include <vector>
|
2009-06-20 21:10:43 -04:00
|
|
|
#include <fstream>
|
2009-06-11 06:00:43 -04:00
|
|
|
|
2011-05-22 15:29:52 -04:00
|
|
|
#include <irrString.h>
|
2010-12-27 20:29:36 -05:00
|
|
|
using irr::core::stringc;
|
|
|
|
using irr::core::stringw;
|
2010-11-11 15:59:49 -05:00
|
|
|
|
2011-02-20 10:21:35 -05:00
|
|
|
#include "graphics/camera.hpp"
|
2010-05-01 19:40:50 -04:00
|
|
|
#include "utils/constants.hpp"
|
2010-09-08 07:39:19 -04:00
|
|
|
#include "utils/no_copy.hpp"
|
2009-06-21 14:55:12 -04:00
|
|
|
#include "utils/ptr_vector.hpp"
|
2011-03-22 23:57:49 -04:00
|
|
|
#include "utils/time.hpp"
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
class XMLNode;
|
2010-12-27 20:29:36 -05:00
|
|
|
class XMLWriter;
|
2009-07-18 11:32:54 -04:00
|
|
|
class PlayerProfile;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
/**
|
2011-04-04 01:22:32 -04:00
|
|
|
* The base of a set of small utilities to enable quickly adding/removing
|
|
|
|
* stuff to/from config painlessly.
|
|
|
|
*/
|
2010-09-08 11:22:22 -04:00
|
|
|
class UserConfigParam
|
2007-05-27 12:01:53 -04:00
|
|
|
{
|
2009-06-21 12:15:27 -04:00
|
|
|
friend class GroupUserConfigParam;
|
2009-06-20 21:10:43 -04:00
|
|
|
protected:
|
2011-04-04 01:22:32 -04:00
|
|
|
std::string m_param_name;
|
|
|
|
std::string m_comment;
|
2008-03-31 19:15:33 -04:00
|
|
|
public:
|
2011-04-04 01:22:32 -04:00
|
|
|
virtual ~UserConfigParam();
|
2010-12-27 20:29:36 -05:00
|
|
|
virtual void write(XMLWriter& stream) const = 0;
|
2010-03-26 21:35:11 -04:00
|
|
|
virtual void findYourDataInAChildOf(const XMLNode* node) = 0;
|
|
|
|
virtual void findYourDataInAnAttributeOf(const XMLNode* node) = 0;
|
2010-12-27 20:29:36 -05:00
|
|
|
virtual irr::core::stringw toString() const = 0;
|
2011-04-04 01:22:32 -04:00
|
|
|
}; // UserConfigParam
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2009-06-21 12:15:27 -04:00
|
|
|
class GroupUserConfigParam : public UserConfigParam
|
|
|
|
{
|
|
|
|
std::vector<UserConfigParam*> m_children;
|
|
|
|
public:
|
|
|
|
GroupUserConfigParam(const char* name, const char* comment=NULL);
|
2010-12-27 20:29:36 -05:00
|
|
|
void write(XMLWriter& stream) const;
|
2010-03-26 21:35:11 -04:00
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2009-06-21 12:15:27 -04:00
|
|
|
void addChild(UserConfigParam* child);
|
2010-12-27 20:29:36 -05:00
|
|
|
irr::core::stringw toString() const;
|
2011-04-04 01:22:32 -04:00
|
|
|
}; // GroupUserConfigParam
|
2009-01-12 04:05:03 -05:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2009-06-20 21:10:43 -04:00
|
|
|
class IntUserConfigParam : public UserConfigParam
|
|
|
|
{
|
2010-05-15 14:10:55 -04:00
|
|
|
int m_value;
|
|
|
|
int m_default_value;
|
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
public:
|
2010-05-15 14:10:55 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
IntUserConfigParam(int default_value, const char* param_name,
|
|
|
|
const char* comment = NULL);
|
|
|
|
IntUserConfigParam(int default_value, const char* param_name,
|
|
|
|
GroupUserConfigParam* group,
|
|
|
|
const char* comment = NULL);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
void write(XMLWriter& stream) const;
|
2010-03-26 21:35:11 -04:00
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
irr::core::stringw toString() const;
|
2011-04-04 01:22:32 -04:00
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
2010-05-15 14:10:55 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
operator int() const { return m_value; }
|
|
|
|
int& operator++(int dummy) { m_value++; return m_value; }
|
|
|
|
int& operator=(const int& v) { m_value = v; return m_value; }
|
|
|
|
int& operator=(const IntUserConfigParam& v)
|
|
|
|
{ m_value = (int)v; return m_value; }
|
|
|
|
}; // IntUserConfigParam
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2011-03-22 23:57:49 -04:00
|
|
|
class TimeUserConfigParam : public UserConfigParam
|
|
|
|
{
|
|
|
|
Time::TimeType m_value;
|
|
|
|
Time::TimeType m_default_value;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
TimeUserConfigParam(Time::TimeType default_value, const char* param_name,
|
2011-03-22 23:57:49 -04:00
|
|
|
const char* comment = NULL);
|
2011-04-04 01:22:32 -04:00
|
|
|
TimeUserConfigParam(Time::TimeType default_value, const char* param_name,
|
2011-03-22 23:57:49 -04:00
|
|
|
GroupUserConfigParam* group, const char* comment=NULL);
|
|
|
|
|
|
|
|
void write(XMLWriter& stream) const;
|
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
|
|
|
|
|
|
|
irr::core::stringw toString() const;
|
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
|
|
|
operator Time::TimeType() const { return m_value; }
|
|
|
|
Time::TimeType& operator=(const Time::TimeType& v)
|
|
|
|
{ m_value = v; return m_value; }
|
|
|
|
Time::TimeType& operator=(const TimeUserConfigParam& v)
|
|
|
|
{ m_value = (int)v; return m_value; }
|
2011-04-04 01:22:32 -04:00
|
|
|
}; // TimeUserConfigParam
|
2011-03-22 23:57:49 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2009-06-20 21:10:43 -04:00
|
|
|
class StringUserConfigParam : public UserConfigParam
|
|
|
|
{
|
2010-05-15 14:10:55 -04:00
|
|
|
std::string m_value;
|
|
|
|
std::string m_default_value;
|
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
public:
|
2010-05-15 14:10:55 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
StringUserConfigParam(const char* default_value, const char* param_name,
|
|
|
|
const char* comment = NULL);
|
|
|
|
StringUserConfigParam(const char* default_value, const char* param_name,
|
|
|
|
GroupUserConfigParam* group,
|
|
|
|
const char* comment = NULL);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
void write(XMLWriter& stream) const;
|
2010-03-26 21:35:11 -04:00
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-05-15 14:10:55 -04:00
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
2011-04-04 01:22:32 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
irr::core::stringw toString() const { return m_value.c_str(); }
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
operator std::string() const { return m_value; }
|
|
|
|
std::string& operator=(const std::string& v)
|
|
|
|
{ m_value = v; return m_value; }
|
|
|
|
std::string& operator=(const StringUserConfigParam& v)
|
|
|
|
{ m_value = (std::string)v; return m_value; }
|
2009-06-22 20:46:13 -04:00
|
|
|
|
2010-05-15 14:10:55 -04:00
|
|
|
const char* c_str() const { return m_value.c_str(); }
|
2011-04-04 01:22:32 -04:00
|
|
|
}; // StringUserConfigParam
|
2008-03-31 19:15:33 -04:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2010-12-27 20:29:36 -05:00
|
|
|
class WStringUserConfigParam : public UserConfigParam
|
|
|
|
{
|
|
|
|
stringw m_value;
|
|
|
|
stringw m_default_value;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
WStringUserConfigParam(const stringw& default_value,
|
|
|
|
const char* param_name,
|
|
|
|
const char* comment = NULL);
|
|
|
|
WStringUserConfigParam(const stringw& default_value,
|
|
|
|
const char* param_name,
|
|
|
|
GroupUserConfigParam* group,
|
|
|
|
const char* comment = NULL);
|
2010-12-27 20:29:36 -05:00
|
|
|
|
|
|
|
void write(XMLWriter& stream) const;
|
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
|
|
|
|
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
|
|
|
|
|
|
|
irr::core::stringw toString() const { return m_value; }
|
|
|
|
|
|
|
|
operator stringw() const { return m_value; }
|
2011-04-04 01:22:32 -04:00
|
|
|
stringw& operator=(const stringw& v) { m_value = v; return m_value; }
|
|
|
|
stringw& operator=(const WStringUserConfigParam& v)
|
|
|
|
{ m_value = (stringw)v; return m_value; }
|
2010-12-27 20:29:36 -05:00
|
|
|
const wchar_t* c_str() const { return m_value.c_str(); }
|
2011-04-04 01:22:32 -04:00
|
|
|
}; // WStringUserConfigParam
|
2010-12-27 20:29:36 -05:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2009-06-20 21:10:43 -04:00
|
|
|
class BoolUserConfigParam : public UserConfigParam
|
|
|
|
{
|
2010-05-15 14:10:55 -04:00
|
|
|
bool m_value;
|
|
|
|
bool m_default_value;
|
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
public:
|
2011-04-04 01:22:32 -04:00
|
|
|
BoolUserConfigParam(bool default_value, const char* param_name,
|
|
|
|
const char* comment = NULL);
|
|
|
|
BoolUserConfigParam(bool default_value, const char* param_name,
|
|
|
|
GroupUserConfigParam* group,
|
|
|
|
const char* comment = NULL);
|
2010-12-27 20:29:36 -05:00
|
|
|
void write(XMLWriter& stream) const;
|
2010-03-26 21:35:11 -04:00
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
irr::core::stringw toString() const;
|
2010-05-15 14:10:55 -04:00
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2010-05-15 14:10:55 -04:00
|
|
|
operator bool() const { return m_value; }
|
|
|
|
bool& operator=(const bool& v) { m_value = v; return m_value; }
|
2011-04-04 01:22:32 -04:00
|
|
|
bool& operator=(const BoolUserConfigParam& v)
|
|
|
|
{ m_value = (bool)v; return m_value; }
|
|
|
|
}; // BoolUserConfigParam
|
2009-01-04 18:03:37 -05:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2009-06-20 21:10:43 -04:00
|
|
|
class FloatUserConfigParam : public UserConfigParam
|
|
|
|
{
|
2010-05-15 14:10:55 -04:00
|
|
|
float m_value;
|
|
|
|
float m_default_value;
|
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
public:
|
2011-04-04 01:22:32 -04:00
|
|
|
FloatUserConfigParam(float default_value, const char* param_name,
|
|
|
|
const char* comment = NULL);
|
|
|
|
FloatUserConfigParam(float default_value, const char* param_name,
|
|
|
|
GroupUserConfigParam* group,
|
|
|
|
const char* comment = NULL);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
void write(XMLWriter& stream) const;
|
2010-03-26 21:35:11 -04:00
|
|
|
void findYourDataInAChildOf(const XMLNode* node);
|
|
|
|
void findYourDataInAnAttributeOf(const XMLNode* node);
|
2009-06-21 12:15:27 -04:00
|
|
|
|
2010-12-27 20:29:36 -05:00
|
|
|
irr::core::stringw toString() const;
|
2010-05-15 14:10:55 -04:00
|
|
|
void revertToDefaults() { m_value = m_default_value; }
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2010-05-15 14:10:55 -04:00
|
|
|
operator float() const { return m_value; }
|
|
|
|
float& operator=(const float& v) { m_value = v; return m_value; }
|
2011-04-04 01:22:32 -04:00
|
|
|
float& operator=(const FloatUserConfigParam& v)
|
|
|
|
{ m_value = (float)v; return m_value; }
|
|
|
|
}; // FloatUserConfigParam
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
enum AnimType {ANIMS_NONE = 0,
|
|
|
|
ANIMS_PLAYERS_ONLY = 1,
|
|
|
|
ANIMS_ALL = 2 };
|
|
|
|
|
|
|
|
/** Using X-macros for setting-possible values is not very pretty, but it's a
|
|
|
|
* no-maintenance case :
|
|
|
|
* when you want to add a new parameter, just add one signle line below and
|
|
|
|
* everything else automagically works (including default value, saving to
|
|
|
|
* file, loading from file)
|
|
|
|
*/
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
#ifndef PARAM_PREFIX
|
|
|
|
#define PARAM_PREFIX extern
|
|
|
|
#endif
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
#ifndef PARAM_DEFAULT
|
|
|
|
#define PARAM_DEFAULT(X)
|
|
|
|
#endif
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
|
|
|
/** \brief Contains all parameters that are stored in the user's config file
|
|
|
|
* \ingroup config
|
|
|
|
*/
|
2009-06-20 21:10:43 -04:00
|
|
|
namespace UserConfigParams
|
|
|
|
{
|
2011-04-27 08:47:47 -04:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
// ---- Audio
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_PREFIX GroupUserConfigParam m_audio_group
|
|
|
|
PARAM_DEFAULT( GroupUserConfigParam("Audio", "Audio Settings") );
|
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_sfx
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "sfx_on", &m_audio_group, "Whether sound effects are enabled or not (true or false)") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_music
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "music_on", &m_audio_group, "Whether musics are enabled or not (true or false)") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX FloatUserConfigParam m_sfx_volume
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( FloatUserConfigParam(1.0, "sfx_volume", &m_audio_group, "Volume for sound effects, see openal AL_GAIN for interpretation") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX FloatUserConfigParam m_music_volume
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( FloatUserConfigParam(0.7f, "music_volume", &m_audio_group, "Music volume from 0.0 to 1.0") );
|
2009-06-21 11:44:02 -04:00
|
|
|
|
|
|
|
// ---- Race setup
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_PREFIX GroupUserConfigParam m_race_setup_group
|
|
|
|
PARAM_DEFAULT( GroupUserConfigParam("RaceSetup", "Race Setup Settings") );
|
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_num_karts
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(4, "numkarts", &m_race_setup_group, "Default number of karts. -1 means use all") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_num_laps
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(4, "numlaps", &m_race_setup_group, "Default number of laps.") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_difficulty
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "difficulty", &m_race_setup_group, "Default race difficulty. 0=easy, 1=medium, 2=hard") );
|
2010-10-23 21:53:50 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_game_mode
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "game_mode", &m_race_setup_group, "Game mode. 0=standard, 1=time trial, 2=follow the leader, 3=3 strikes") );
|
2010-10-27 16:10:16 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_default_kart
|
|
|
|
PARAM_DEFAULT( StringUserConfigParam("tux", "kart", "Kart to select by default (the last used kart)") );
|
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
// ---- Video
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_PREFIX GroupUserConfigParam m_video_group
|
|
|
|
PARAM_DEFAULT( GroupUserConfigParam("Video", "Video Settings") );
|
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_width
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(800, "width", &m_video_group, "Screen/window width in pixels") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_height
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(600, "height", &m_video_group, "Screen/window height in pixels") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_fullscreen
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen", &m_video_group) );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_prev_width
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(800, "prev_width", &m_video_group, "Previous screen/window width") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_prev_height
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(600, "prev_height", &m_video_group,"Previous screen/window height") );
|
2010-02-03 19:45:24 -05:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_prev_fullscreen
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "prev_fullscreen", &m_video_group) );
|
2011-03-20 13:39:05 -04:00
|
|
|
|
2010-06-09 19:33:06 -04:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_display_fps
|
2009-06-21 12:15:27 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "show_fps", &m_video_group, "Display frame per seconds") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_max_fps
|
2009-06-22 18:34:42 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(120, "max_fps", &m_video_group, "Maximum fps, should be at least 60") );
|
2009-06-21 11:44:02 -04:00
|
|
|
|
2009-09-15 00:48:14 -04:00
|
|
|
// Renderer type (OpenGL, Direct3D9, Direct3D8, Software, etc)
|
|
|
|
PARAM_PREFIX IntUserConfigParam m_renderer
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "renderer", &m_video_group,
|
|
|
|
"Type of the renderer.") );
|
|
|
|
|
2010-03-24 19:52:41 -04:00
|
|
|
// ---- Debug - not saved to config file
|
2010-04-19 08:37:45 -04:00
|
|
|
/** If gamepad debugging is enabled. */
|
2010-03-24 19:52:41 -04:00
|
|
|
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
|
2011-01-10 11:49:34 -05:00
|
|
|
|
|
|
|
PARAM_PREFIX bool m_gamepad_visualisation PARAM_DEFAULT( false );
|
|
|
|
|
2010-10-26 05:57:26 -04:00
|
|
|
/** If material debugging (printing terrain specific slowdown) is enabled. */
|
|
|
|
PARAM_PREFIX bool m_material_debug PARAM_DEFAULT( false );
|
2010-03-24 19:52:41 -04:00
|
|
|
|
2010-04-19 08:37:45 -04:00
|
|
|
/** If track debugging is enabled. */
|
2010-03-24 19:52:41 -04:00
|
|
|
PARAM_PREFIX int m_track_debug PARAM_DEFAULT( false );
|
|
|
|
|
2010-04-19 08:37:45 -04:00
|
|
|
/** True if check structures should be debugged. */
|
|
|
|
PARAM_PREFIX bool m_check_debug PARAM_DEFAULT( false );
|
|
|
|
|
2010-04-26 19:28:11 -04:00
|
|
|
/** Special debug camera being high over the kart. */
|
|
|
|
PARAM_PREFIX bool m_camera_debug PARAM_DEFAULT( false );
|
2010-11-24 00:57:06 -05:00
|
|
|
|
|
|
|
/** True if slipstream debugging is activated. */
|
|
|
|
PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );
|
2010-12-10 00:54:04 -05:00
|
|
|
|
2011-03-21 02:15:39 -04:00
|
|
|
/** True if follow-the-leader debug information should be printed. */
|
|
|
|
PARAM_PREFIX bool m_ftl_debug PARAM_DEFAULT( false );
|
|
|
|
|
2010-12-10 00:54:04 -05:00
|
|
|
/** True if currently developed tutorial debugging is enabled. */
|
|
|
|
PARAM_PREFIX bool m_tutorial_debug PARAM_DEFAULT( false );
|
2010-04-26 19:28:11 -04:00
|
|
|
|
2010-03-24 19:52:41 -04:00
|
|
|
/** Verbosity level for debug messages. Note that error and important warnings
|
|
|
|
* must always be printed. */
|
|
|
|
PARAM_PREFIX int m_verbosity PARAM_DEFAULT( 0 );
|
|
|
|
|
2011-02-13 21:07:04 -05:00
|
|
|
PARAM_PREFIX bool m_no_start_screen PARAM_DEFAULT( false );
|
|
|
|
|
|
|
|
/** True to test funky ambient/diffuse/specularity in RGB & all anisotropic */
|
|
|
|
PARAM_PREFIX bool m_rendering_debug PARAM_DEFAULT( false );
|
|
|
|
|
|
|
|
// not saved to file
|
2011-01-15 16:49:15 -05:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
// ---- Networking
|
|
|
|
PARAM_PREFIX StringUserConfigParam m_server_address
|
|
|
|
PARAM_DEFAULT( StringUserConfigParam("localhost", "server_adress", "Information about last server used") );
|
|
|
|
PARAM_PREFIX IntUserConfigParam m_server_port
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(2305, "server_port", "Information about last server used") );
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2010-03-01 17:56:32 -05:00
|
|
|
// ---- Graphic Quality
|
|
|
|
PARAM_PREFIX GroupUserConfigParam m_graphics_quality
|
|
|
|
PARAM_DEFAULT( GroupUserConfigParam("GFX", "Graphics Quality Settings") );
|
2011-04-30 18:58:05 -04:00
|
|
|
|
|
|
|
// On OSX 10.4 and before there may be driver issues with FBOs, so to be safe disable them by default
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
|
|
#define FBO_DEFAULT false
|
|
|
|
#else
|
|
|
|
#define FBO_DEFAULT true
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define FBO_DEFAULT true
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PARAM_PREFIX BoolUserConfigParam m_fbo
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(FBO_DEFAULT, "fbo", &m_graphics_quality, "Use frame buffer objects (FBOs)") );
|
2010-03-01 17:56:32 -05:00
|
|
|
|
2011-03-20 13:39:05 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_graphical_effects
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "anim_gfx", &m_graphics_quality, "Scenery animations") );
|
|
|
|
|
|
|
|
PARAM_PREFIX BoolUserConfigParam m_weather_effects
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "weather_gfx", &m_graphics_quality, "Weather effects") );
|
|
|
|
PARAM_PREFIX IntUserConfigParam m_show_steering_animations
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(ANIMS_ALL, "steering_animations", &m_graphics_quality,
|
|
|
|
"Whether to display kart animations (0=disabled for all; "
|
|
|
|
"1=enabled for humans, disabled for AIs; 2=enabled for all") );
|
2010-03-01 17:56:32 -05:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_anisotropic
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "anisotropic", &m_graphics_quality,
|
|
|
|
"Whether anisotropic filtering is allowed to be used (true or false)") );
|
|
|
|
PARAM_PREFIX BoolUserConfigParam m_trilinear
|
2011-03-20 13:39:05 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(true, "trilinear", &m_graphics_quality,
|
|
|
|
"Whether trilinear filtering is allowed to be used (true or false)") );
|
2011-03-17 19:13:33 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_fullscreen_antialiasing
|
2011-03-20 13:39:05 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "fullscreen_antialiasing", &m_graphics_quality,
|
|
|
|
"Whether fullscreen antialiasing is enabled") );
|
2011-03-18 11:39:52 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_vsync
|
2011-03-20 13:39:05 -04:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "vsync", &m_graphics_quality,
|
|
|
|
"Whether vertical sync is enabled") );
|
2011-03-18 11:39:52 -04:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
// ---- Misc
|
2011-02-08 07:59:32 -05:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_minimal_race_gui
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "minimal-race-gui") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_crashed
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "crashed") ); // TODO : is this used with new code? does it still work?
|
|
|
|
PARAM_PREFIX BoolUserConfigParam m_log_errors
|
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "log_errors", "Enable logging of stdout and stderr to logfile") );
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2010-01-04 20:13:53 -05:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_reverse_look_threshold
|
2010-03-24 19:52:41 -04:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "reverse_look_threshold",
|
|
|
|
"If the kart is driving backwards faster than this value,\n"
|
|
|
|
"switch automatically to reverse camera (set to 0 to disable).") );
|
2011-02-20 00:11:26 -05:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_camera_style
|
2011-02-20 10:21:35 -05:00
|
|
|
PARAM_DEFAULT( IntUserConfigParam(Camera::CS_MODERN, "camera_style", "Camera Style") );
|
2011-02-20 00:11:26 -05:00
|
|
|
|
2010-01-04 20:13:53 -05:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_item_style
|
|
|
|
PARAM_DEFAULT( StringUserConfigParam("items", "item_style", "Name of the .items file to use.") );
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_kart_group
|
2010-05-01 19:40:50 -04:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam(DEFAULT_GROUP_NAME, "kart_group", "Last selected kart group") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_track_group
|
2010-05-01 19:40:50 -04:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam(DEFAULT_GROUP_NAME, "track_group", "Last selected track group") );
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_last_track
|
2011-03-01 19:16:58 -05:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam("olivermath", "last_track", "Name of the last track used.") );
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2009-06-21 11:44:02 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_skin_file
|
2010-11-29 11:42:55 -05:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam("Peach.stkskin", "skin_file", "Name of the skin to use") );
|
2010-06-30 14:40:55 -04:00
|
|
|
|
2011-03-22 23:57:49 -04:00
|
|
|
// ---- Addon server related entries
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX GroupUserConfigParam m_addon_group
|
2011-03-22 23:57:49 -04:00
|
|
|
PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews",
|
|
|
|
"Addon and news related settings") );
|
|
|
|
|
2010-06-30 14:40:55 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_server_addons
|
2011-03-31 22:49:29 -04:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam("http://stkaddons.net/dl/xml",
|
2011-03-22 23:57:49 -04:00
|
|
|
"server_addons",
|
|
|
|
&m_addon_group,
|
|
|
|
"The server used for addon.") );
|
|
|
|
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX TimeUserConfigParam m_news_last_updated
|
2011-03-23 08:07:16 -04:00
|
|
|
PARAM_DEFAULT( TimeUserConfigParam(0, "news_last_updated",
|
2011-03-22 23:57:49 -04:00
|
|
|
&m_addon_group,
|
|
|
|
"Time news was updated last.") );
|
|
|
|
|
|
|
|
PARAM_PREFIX IntUserConfigParam m_news_frequency
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "news_frequency",
|
|
|
|
&m_addon_group,
|
|
|
|
"How often news should be updated.") );
|
2009-06-21 11:44:02 -04:00
|
|
|
|
2011-03-24 23:20:21 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_display_count
|
|
|
|
PARAM_DEFAULT( StringUserConfigParam("", "news_display_count",
|
|
|
|
&m_addon_group,
|
|
|
|
"How often all news messages have been displayed") );
|
|
|
|
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_ignore_message_id
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(-1, "ignore_message_id",
|
|
|
|
&m_addon_group,
|
|
|
|
"Ignore all messages with this id and lower") );
|
|
|
|
|
2011-03-31 01:10:45 -04:00
|
|
|
PARAM_PREFIX IntUserConfigParam m_internet_status
|
|
|
|
PARAM_DEFAULT( IntUserConfigParam(0, "enable_internet",
|
2011-03-25 07:23:17 -04:00
|
|
|
&m_addon_group,
|
2011-03-31 21:59:32 -04:00
|
|
|
"Status of internet: 0 user wasn't asked, 1: allowed, 2: not allowed") );
|
2011-03-25 07:23:17 -04:00
|
|
|
|
|
|
|
PARAM_PREFIX TimeUserConfigParam m_addons_last_updated
|
2011-03-23 08:07:16 -04:00
|
|
|
PARAM_DEFAULT( TimeUserConfigParam(0, "addon_last_updated",
|
|
|
|
&m_addon_group,
|
|
|
|
"Time addon-list was updated last.") );
|
|
|
|
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX StringUserConfigParam m_language
|
2011-01-15 16:49:15 -05:00
|
|
|
PARAM_DEFAULT( StringUserConfigParam("system", "language", "Which language to use (language code or 'system')") );
|
|
|
|
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode
|
2011-03-01 19:04:13 -05:00
|
|
|
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode", "Whether to enable track debugging features") );
|
2009-08-02 13:56:59 -04:00
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
// TODO? implement blacklist for new irrlicht device and GUI
|
|
|
|
PARAM_PREFIX std::vector<std::string> m_blacklist_res;
|
|
|
|
|
2011-03-25 07:23:17 -04:00
|
|
|
PARAM_PREFIX PtrVector<PlayerProfile> m_all_players;
|
2010-03-01 17:56:32 -05:00
|
|
|
|
2011-04-28 00:25:58 -04:00
|
|
|
/** Some constants to bitmask to enable various messages to be printed. */
|
|
|
|
enum { LOG_MEMORY = 0x0001,
|
|
|
|
LOG_GUI = 0x0002,
|
|
|
|
LOG_ADDONS = 0x0004,
|
2011-04-28 23:42:47 -04:00
|
|
|
LOG_MISC = 0x0008,
|
|
|
|
LOG_ALL = 0xffff };
|
2011-04-28 00:25:58 -04:00
|
|
|
|
|
|
|
/** Returns true if the user want additional messages for memory usage. */
|
2011-04-28 13:47:02 -04:00
|
|
|
bool logMemory();
|
2011-04-28 00:25:58 -04:00
|
|
|
/** Returns true if the user want additional messages related to GUI. */
|
2011-04-28 13:47:02 -04:00
|
|
|
bool logGUI ();
|
2011-04-28 00:25:58 -04:00
|
|
|
/** Returns true if the user want additional messages related to addons. */
|
2011-04-28 13:47:02 -04:00
|
|
|
bool logAddons();
|
2011-04-28 00:25:58 -04:00
|
|
|
/** Returns true if the user want additional messages for general items. */
|
2011-04-28 13:47:02 -04:00
|
|
|
bool logMisc ();
|
2011-04-28 00:25:58 -04:00
|
|
|
|
|
|
|
|
2009-06-20 21:10:43 -04:00
|
|
|
}
|
|
|
|
#undef PARAM_PREFIX
|
|
|
|
#undef PARAM_SUFFIX
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2011-04-04 01:22:32 -04:00
|
|
|
// ============================================================================
|
2010-04-23 16:36:13 -04:00
|
|
|
/**
|
|
|
|
* \brief Class for managing general STK user configuration data.
|
|
|
|
* \ingroup config
|
|
|
|
*/
|
2010-09-08 07:39:19 -04:00
|
|
|
class UserConfig : public NoCopy
|
2009-06-20 21:10:43 -04:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
/** Filename of the user config file. */
|
2010-01-14 20:46:03 -05:00
|
|
|
std::string m_filename;
|
|
|
|
irr::core::stringw m_warning;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
public:
|
2011-04-04 01:22:32 -04:00
|
|
|
/** Create the user config object; does not actually load it,
|
|
|
|
* UserConfig::loadConfig needs to be called. */
|
2010-01-14 20:46:03 -05:00
|
|
|
UserConfig();
|
|
|
|
~UserConfig();
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2009-06-21 14:55:12 -04:00
|
|
|
bool loadConfig();
|
2010-01-14 20:46:03 -05:00
|
|
|
void saveConfig();
|
2009-06-20 21:10:43 -04:00
|
|
|
|
2009-08-30 14:21:59 -04:00
|
|
|
const irr::core::stringw& getWarning() { return m_warning; }
|
|
|
|
void resetWarning() { m_warning=""; }
|
|
|
|
void setWarning(irr::core::stringw& warning) { m_warning=warning; }
|
2009-01-22 07:02:40 -05:00
|
|
|
|
2011-01-16 11:56:21 -05:00
|
|
|
void addDefaultPlayer();
|
|
|
|
|
2010-01-14 20:46:03 -05:00
|
|
|
}; // UserConfig
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
extern UserConfig *user_config;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*EOF*/
|