Only enable Christmas mode in December, except --xmas=1 is given in the command line

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12465 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
funto66 2013-02-09 15:01:58 +00:00
parent a9220a3a5c
commit 43a37aee1b
4 changed files with 39 additions and 4 deletions

View File

@ -455,6 +455,9 @@ namespace UserConfigParams
/** True if hardware skinning should be enabled */
PARAM_PREFIX bool m_hw_skinning_enabled PARAM_DEFAULT( false );
/** True if Christmas Mode should be enabled */
PARAM_PREFIX bool m_xmas_enabled PARAM_DEFAULT( false );
// not saved to file

View File

@ -384,7 +384,15 @@ void WiimoteManager::threadFunc()
// TODO: this should only be done once, but there have been reports that it didn't
// work for some people -> need to find a better fix
wiiuse_motion_sensing(m_wiimotes[i].getWiimoteHandle(), 1);
/*
if(WIIUSE_USING_EXP(m_wiimotes[i].getWiimoteHandle()))
{
if(WIIUSE_USING_EXP(wm))
wiiuse_set_motion_plus(m_wiimotes[i].getWiimoteHandle(), 2); // nunchuck pass-through
else
wiiuse_set_motion_plus(m_wiimotes[i].getWiimoteHandle(), 1); // standalone
}
*/
switch (m_all_wiimote_handles[i]->event)
{
case WIIUSE_EVENT:

View File

@ -133,8 +133,9 @@ void KartModel::loadInfo(const XMLNode &node)
{
if(hat_node->get("offset", &m_hat_offset))
{
// For now simply hardcode a mesh name if an offset is defined.
setHatMeshName("christmas_hat.b3d");
// Xmas mode handling :)
if(UserConfigParams::m_xmas_enabled)
setHatMeshName("christmas_hat.b3d");
}
}
else

View File

@ -125,11 +125,11 @@
# ifdef _MSC_VER
# include <io.h>
# include <direct.h>
# include <time.h>
# endif
#else
# include <unistd.h>
#endif
#include <time.h>
#include <stdexcept>
#include <cstdio>
#include <string>
@ -469,6 +469,17 @@ int handleCmdLinePreliminary(int argc, char **argv)
{
UserConfigParams::m_verbosity |= UserConfigParams::LOG_MISC;
}
else if ( sscanf(argv[i], "--xmas=%d", &n) )
{
if (n)
{
UserConfigParams::m_xmas_enabled = true;
}
else
{
UserConfigParams::m_xmas_enabled = false;
}
}
else if( !strcmp(argv[i], "--log=terminal"))
{
UserConfigParams::m_log_errors=false;
@ -1028,6 +1039,7 @@ int handleCmdLine(int argc, char **argv)
else if( !strcmp(argv[i], "--debug=flyable") ) {}
else if( !strcmp(argv[i], "--debug=misc" ) ) {}
else if( !strcmp(argv[i], "--debug=all" ) ) {}
else if ( sscanf(argv[i], "--xmas=%d", &n) ) {}
else if( !strcmp(argv[i], "--log=terminal" ) ) {}
else if( !strcmp(argv[i], "--log=nocolor" ) ) {}
else if( !strcmp(argv[i], "--log=file" ) ) {}
@ -1226,6 +1238,14 @@ bool ShowDumpResults(const wchar_t* dump_path,
}
#endif
static bool checkXmasTime()
{
time_t rawtime;
struct tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
return (timeinfo->tm_mon == 12-1); // Xmas mode happens in December
}
int main(int argc, char *argv[] )
{
@ -1241,6 +1261,9 @@ int main(int argc, char *argv[] )
// not have) other managers initialised:
initUserConfig(argv); // argv passed so config file can be
// found more reliably
UserConfigParams::m_xmas_enabled = checkXmasTime();
handleCmdLinePreliminary(argc, argv);
initRest();