1) Replaced m_wiimote_max with m_wiimote_raw_maw (default
needs to be changed from 90 to 25 for r14301 to work properly). 2) Some code cleanup (removed global constant). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14305 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ca23d7623d
commit
00018ebe68
@ -46,6 +46,9 @@ static PtrVector<UserConfigParam, REF> all_params;
|
|||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
const int UserConfig::m_current_config_version = 8;
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
UserConfigParam::~UserConfigParam()
|
UserConfigParam::~UserConfigParam()
|
||||||
{
|
{
|
||||||
@ -649,13 +652,14 @@ bool UserConfig::loadConfig()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---- Read config file version
|
// ---- Read config file version
|
||||||
int configFileVersion = CURRENT_CONFIG_VERSION;
|
int config_file_version = m_current_config_version;
|
||||||
if(root->get("version", &configFileVersion) < 1)
|
if(root->get("version", &config_file_version) < 1)
|
||||||
{
|
{
|
||||||
GUIEngine::showMessage( _("Your config file was malformed, so it was deleted and a new one will be created."), 10.0f);
|
GUIEngine::showMessage( _("Your config file was malformed, so it was deleted and a new one will be created."), 10.0f);
|
||||||
std::cerr << "Warning, malformed user config file! Contains no version\n";
|
Log::error("UserConfig",
|
||||||
|
"Warning, malformed user config file! Contains no version");
|
||||||
}
|
}
|
||||||
if (configFileVersion < CURRENT_CONFIG_VERSION)
|
if (config_file_version < m_current_config_version)
|
||||||
{
|
{
|
||||||
// current version (8) is 100% incompatible with other versions (which were lisp)
|
// current version (8) is 100% incompatible with other versions (which were lisp)
|
||||||
// so we just delete the old config. in the future, for smaller updates, we can
|
// so we just delete the old config. in the future, for smaller updates, we can
|
||||||
@ -713,7 +717,6 @@ bool UserConfig::loadConfig()
|
|||||||
return true;
|
return true;
|
||||||
} // loadConfig
|
} // loadConfig
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Write settings to config file. */
|
/** Write settings to config file. */
|
||||||
void UserConfig::saveConfig()
|
void UserConfig::saveConfig()
|
||||||
@ -732,7 +735,8 @@ void UserConfig::saveConfig()
|
|||||||
XMLWriter configfile(filename.c_str());
|
XMLWriter configfile(filename.c_str());
|
||||||
|
|
||||||
configfile << L"<?xml version=\"1.0\"?>\n";
|
configfile << L"<?xml version=\"1.0\"?>\n";
|
||||||
configfile << L"<stkconfig version=\"" << CURRENT_CONFIG_VERSION << L"\" >\n\n";
|
configfile << L"<stkconfig version=\"" << m_current_config_version
|
||||||
|
<< L"\" >\n\n";
|
||||||
|
|
||||||
const int paramAmount = all_params.size();
|
const int paramAmount = all_params.size();
|
||||||
for(int i=0; i<paramAmount; i++)
|
for(int i=0; i<paramAmount; i++)
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
cause an undefined game action now
|
cause an undefined game action now
|
||||||
6: Added stick configurations.
|
6: Added stick configurations.
|
||||||
*/
|
*/
|
||||||
const int CURRENT_CONFIG_VERSION = 8;
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -351,10 +349,10 @@ namespace UserConfigParams
|
|||||||
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
|
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
|
||||||
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
|
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
|
||||||
"Settings for the wiimote") );
|
"Settings for the wiimote") );
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_max
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_raw_max
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(90.0f, "wiimote-max",
|
PARAM_DEFAULT( FloatUserConfigParam(25.0f, "wiimote-raw-max",
|
||||||
&m_wiimote_group,
|
&m_wiimote_group,
|
||||||
"At what angle (0-128) maximum steering is reached.") );
|
"At what raw input value maximum steering is reached (between 1 and 25).") );
|
||||||
|
|
||||||
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
|
PARAM_PREFIX FloatUserConfigParam m_wiimote_weight_linear
|
||||||
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "wiimote-weight-linear",
|
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "wiimote-weight-linear",
|
||||||
@ -704,6 +702,8 @@ private:
|
|||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
irr::core::stringw m_warning;
|
irr::core::stringw m_warning;
|
||||||
|
|
||||||
|
static const int m_current_config_version;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Create the user config object; does not actually load it,
|
/** Create the user config object; does not actually load it,
|
||||||
* UserConfig::loadConfig needs to be called. */
|
* UserConfig::loadConfig needs to be called. */
|
||||||
|
@ -77,7 +77,7 @@ void Wiimote::resetIrrEvent()
|
|||||||
void Wiimote::update()
|
void Wiimote::update()
|
||||||
{
|
{
|
||||||
float normalized_angle = -(m_wiimote_handle->accel.y-128)
|
float normalized_angle = -(m_wiimote_handle->accel.y-128)
|
||||||
/ UserConfigParams::m_wiimote_max;
|
/ UserConfigParams::m_wiimote_raw_max;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(UserConfigParams::m_wiimote_debug)
|
if(UserConfigParams::m_wiimote_debug)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user