Artist debug features are now enabled even in release builds, but disabled in config by default

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7780 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-02 00:04:13 +00:00
parent 230de5728d
commit 3a3619750a
6 changed files with 45 additions and 66 deletions

View File

@ -381,9 +381,11 @@ namespace UserConfigParams
PARAM_PREFIX StringUserConfigParam m_server_addons
PARAM_DEFAULT( StringUserConfigParam("http://download.tuxfamily.org/stkaddons/0.7/", "server_addons", "The server used for addon.") );
PARAM_PREFIX StringUserConfigParam m_language
PARAM_PREFIX StringUserConfigParam m_language
PARAM_DEFAULT( StringUserConfigParam("system", "language", "Which language to use (language code or 'system')") );
PARAM_PREFIX BoolUserConfigParam m_artist_debug_mode
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode", "Whether to enable track debugging features") );
// TODO? implement blacklist for new irrlicht device and GUI
PARAM_PREFIX std::vector<std::string> m_blacklist_res;

View File

@ -972,9 +972,8 @@ void IrrDriver::update(float dt)
// the bullet debug view, since otherwise the camera
// is not set up properly. This is only used for
// the bullet debug view.
#ifdef DEBUG
World::getWorld()->getPhysics()->draw();
#endif
if (UserConfigParams::m_artist_debug_mode)
World::getWorld()->getPhysics()->draw();
} // if kart->Camera
} // for i<world->getNumKarts()
// To draw the race gui we set the viewport back to the full

View File

@ -83,21 +83,20 @@ InputManager::~InputManager()
//-----------------------------------------------------------------------------
void InputManager::handleStaticAction(int key, int value)
{
static bool control_is_pressed=false;
World *world=World::getWorld();
static bool control_is_pressed = false;
World *world = World::getWorld();
switch (key)
{
#ifdef DEBUG
case KEY_CONTROL:
case KEY_RCONTROL:
case KEY_LCONTROL:
control_is_pressed = value!=0;
break;
case KEY_KEY_I:
{
if (world == NULL) break;
if (world == NULL || !UserConfigParams::m_artist_debug_mode) break;
Kart* kart = world->getLocalPlayerKart(0);
if (kart == NULL) break;
@ -107,7 +106,7 @@ void InputManager::handleStaticAction(int key, int value)
}
case KEY_KEY_K:
{
if (world == NULL) break;
if (world == NULL || !UserConfigParams::m_artist_debug_mode) break;
Kart* kart = world->getLocalPlayerKart(0);
if (kart == NULL) break;
@ -116,7 +115,7 @@ void InputManager::handleStaticAction(int key, int value)
break;
}
case KEY_F1:
if (world && race_manager->getNumPlayers() ==1 )
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() ==1 )
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
@ -128,50 +127,50 @@ void InputManager::handleStaticAction(int key, int value)
}
break;
case KEY_F2:
if (world && race_manager->getNumPlayers() ==1 )
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() ==1 )
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_PLUNGER, 10000);
}
break;
case KEY_F3:
if (world && race_manager->getNumPlayers() ==1 )
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() ==1 )
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_CAKE, 10000);
}
break;
case KEY_F4:
if (world && race_manager->getNumPlayers() ==1 )
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() ==1 )
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_SWITCH, 10000);
}
break;
case KEY_F5:
if (world && race_manager->getNumPlayers() ==1 )
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() ==1 )
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_BOWLING, 10000);
}
break;
case KEY_F6:
if (world && race_manager->getNumPlayers() == 1)
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() == 1)
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_PARACHUTE, 10000);
}
break;
case KEY_F7:
if (world && race_manager->getNumPlayers() == 1)
if (UserConfigParams::m_artist_debug_mode && world && race_manager->getNumPlayers() == 1)
{
Kart* kart = world->getLocalPlayerKart(0);
kart->setPowerup(PowerupManager::POWERUP_ZIPPER, 10000);
}
break;
case KEY_F8:
if(value)
if (UserConfigParams::m_artist_debug_mode && value)
{
if (control_is_pressed)
{
@ -193,12 +192,12 @@ void InputManager::handleStaticAction(int key, int value)
break;
case KEY_F11:
if(value && control_is_pressed)
if (UserConfigParams::m_artist_debug_mode && value && control_is_pressed)
{
world->getPhysics()->nextDebugMode();
}
break;
#endif
case KEY_F12:
if(value)
UserConfigParams::m_display_fps = !UserConfigParams::m_display_fps;

View File

@ -415,7 +415,7 @@ int handleCmdLine(int argc, char **argv)
{
UserConfigParams::m_material_debug = true;
}
else if(!strcmp(argv[i], "--camera-debug"))
else if(UserConfigParams::m_artist_debug_mode && !strcmp(argv[i], "--camera-debug"))
{
UserConfigParams::m_camera_debug=1;
}
@ -434,7 +434,7 @@ int handleCmdLine(int argc, char **argv)
km->getMasterKartModel().getModel()->getMeshBufferCount());
}
}
else if(!strcmp(argv[i], "--check-debug"))
else if(UserConfigParams::m_artist_debug_mode && !strcmp(argv[i], "--check-debug"))
{
UserConfigParams::m_check_debug=true;
}
@ -618,16 +618,6 @@ int handleCmdLine(int argc, char **argv)
//} else if ( !strcmp(argv[i], "--reverse") ) {
//fprintf ( stdout, "Enabling reverse mode.\n" ) ;
//raceSetup.reverse = 1;
}
else if ( !strcmp(argv[i], "--mirror") )
{
#ifdef SSG_BACKFACE_COLLISIONS_SUPPORTED
fprintf ( stdout, "Enabling mirror mode.\n" ) ;
//raceSetup.mirror = 1;
#else
//raceSetup.mirror = 0 ;
#endif
}
else if ( !strcmp(argv[i], "--laps") && i+1<argc )
{
@ -635,21 +625,6 @@ int handleCmdLine(int argc, char **argv)
race_manager->setNumLaps(atoi(argv[i+1]));
i++;
}
/* TODO: add back --players" switch
else if ( !strcmp(argv[i], "--players") && i+1<argc ) {
raceSetup.numPlayers = atoi(argv[i+1]);
if ( raceSetup.numPlayers < 0 || raceSetup.numPlayers > 4) {
fprintf ( stderr,
"You choose an invalid number of players: %d.\n",
raceSetup.numPlayers );
cmdLineHelp(argv[0]);
return 0;
}
fprintf ( stdout, "You choose to have %d players.\n", atoi(argv[i+1]) ) ;
i++;
}
*/
else if( !strcmp(argv[i], "--log=terminal"))
{
UserConfigParams::m_log_errors=false;

View File

@ -413,13 +413,16 @@ void World::resetAllKarts()
{
fprintf(stderr, "ERROR: no valid starting position for kart %d on track %s.\n",
(int)(i-m_karts.begin()), m_track->getIdent().c_str());
#ifdef DEBUG
fprintf(stderr, "Activating fly mode.\n");
(*i)->flyUp();
continue;
#else
exit(-1);
#endif
if (UserConfigParams::m_artist_debug_mode)
{
fprintf(stderr, "Activating fly mode.\n");
(*i)->flyUp();
continue;
}
else
{
exit(-1);
}
}
}
@ -460,13 +463,16 @@ void World::resetAllKarts()
{
fprintf(stderr, "ERROR: no valid starting position for kart %d on track %s.\n",
(int)(i-m_karts.begin()), m_track->getIdent().c_str());
#ifdef DEBUG
fprintf(stderr, "Activating fly mode.\n");
(*i)->flyUp();
continue;
#else
exit(-1);
#endif
if (UserConfigParams::m_artist_debug_mode)
{
fprintf(stderr, "Activating fly mode.\n");
(*i)->flyUp();
continue;
}
else
{
exit(-1);
}
}
all_finished=false;
break;

View File

@ -467,12 +467,10 @@ bool OptionsScreenInput2::onEscapePressed()
void OptionsScreenInput2::onConfirm()
{
#ifdef DEBUG
const bool success = input_manager->getDeviceList()->deleteConfig(m_config);
assert(success);
#else
input_manager->getDeviceList()->deleteConfig(m_config);
#endif
if (!success) fprintf(stderr, "Failed to delete config!\n");
m_config = NULL;
input_manager->getDeviceList()->serialize();
ModalDialog::dismiss();