-
+
+
-
-
-
+
diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp
index 7c9ef79c3..102604dc4 100644
--- a/src/config/user_config.hpp
+++ b/src/config/user_config.hpp
@@ -461,7 +461,8 @@ namespace UserConfigParams
PARAM_DEFAULT( IntUserConfigParam(0, "game_mode",
&m_race_setup_group,
"Game mode. 0=standard, 1=time trial, 2=follow "
- "the leader, 3=3 strikes") );
+ "the leader, 3=3 strikes, 4=easter egg hunt, "
+ "5=soccer, 6=ghost replay") );
PARAM_PREFIX StringUserConfigParam m_default_kart
PARAM_DEFAULT( StringUserConfigParam("tux", "kart",
"Kart to select by default (the last used kart)") );
@@ -727,13 +728,13 @@ namespace UserConfigParams
/** If high scores will not be saved. For repeated testing on tracks. */
PARAM_PREFIX bool m_no_high_scores PARAM_DEFAULT(false);
- /** If gamepad debugging is enabled. */
+ /** If unit testing is enabled. */
PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false);
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );
- /** If gamepad debugging is enabled. */
+ /** If keyboard debugging is enabled. */
PARAM_PREFIX bool m_keyboard_debug PARAM_DEFAULT(false);
/** Wiimote debugging. */
@@ -755,7 +756,7 @@ namespace UserConfigParams
/** True if physics debugging should be enabled. */
PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );
- /** True if fps should be printed each frame. */
+ /** True if FPS should be printed each frame. */
PARAM_PREFIX bool m_fps_debug PARAM_DEFAULT(false);
/** True if arena (battle/soccer) ai profiling. */
diff --git a/src/graphics/camera_debug.cpp b/src/graphics/camera_debug.cpp
index 9f1ae0096..1e6af945f 100644
--- a/src/graphics/camera_debug.cpp
+++ b/src/graphics/camera_debug.cpp
@@ -74,6 +74,8 @@ void CameraDebug::getCameraSettings(float *above_kart, float *cam_angle,
*distance = -m_kart->getKartModel()->getLength()-1.0f;
break;
case CM_DEBUG_SIDE_OF_KART:
+ case CM_DEBUG_INV_SIDE_OF_KART:
+ case CM_DEBUG_FRONT_OF_KART:
case CM_DEBUG_TOP_OF_KART:
*above_kart = 0.75f;
*cam_angle = UserConfigParams::m_camera_forward_up_angle * DEGREE_TO_RAD;
@@ -122,6 +124,22 @@ void CameraDebug::update(float dt)
m_camera->setTarget(xyz);
m_camera->setPosition(offset.toIrrVector());
}
+ else if (m_default_debug_Type==CM_DEBUG_INV_SIDE_OF_KART)
+ {
+ core::vector3df xyz = m_kart->getSmoothedXYZ().toIrrVector();
+ Vec3 offset(-3, 0, 0);
+ offset = m_kart->getSmoothedTrans()(offset);
+ m_camera->setTarget(xyz);
+ m_camera->setPosition(offset.toIrrVector());
+ }
+ else if (m_default_debug_Type==CM_DEBUG_FRONT_OF_KART)
+ {
+ core::vector3df xyz = m_kart->getSmoothedXYZ().toIrrVector();
+ Vec3 offset(0, 1, 2);
+ offset = m_kart->getSmoothedTrans()(offset);
+ m_camera->setTarget(xyz);
+ m_camera->setPosition(offset.toIrrVector());
+ }
// If an explosion is happening, stop moving the camera,
// but keep it target on the kart.
else if (dynamic_cast
(m_kart->getKartAnimation()))
diff --git a/src/graphics/camera_debug.hpp b/src/graphics/camera_debug.hpp
index f2d173ff4..d0ad128f2 100644
--- a/src/graphics/camera_debug.hpp
+++ b/src/graphics/camera_debug.hpp
@@ -38,6 +38,8 @@ public:
CM_DEBUG_GROUND, //!< Camera at ground level, wheel debugging
CM_DEBUG_BEHIND_KART, //!< Camera straight behind kart
CM_DEBUG_SIDE_OF_KART, //!< Camera to the right of the kart
+ CM_DEBUG_INV_SIDE_OF_KART, //!< Camera to the left of the kart
+ CM_DEBUG_FRONT_OF_KART, //!< Camera to the front of the kart
}; // CameraDebugType
private:
diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp
index 94f518dd1..0a59c721e 100644
--- a/src/graphics/irr_driver.cpp
+++ b/src/graphics/irr_driver.cpp
@@ -1762,14 +1762,18 @@ video::SColorf IrrDriver::getAmbientLight() const
void IrrDriver::displayFPS()
{
#ifndef SERVER_ONLY
- gui::IGUIFont* font = GUIEngine::getSmallFont();
+ gui::ScalableFont* font = GUIEngine::getSmallFont();
+ font->setScale(0.7f);
core::rect position;
const int fheight = font->getHeightPerLine();
+ const int rwidth = irr_driver->getActualScreenSize().Width / 6;
+ const int swidth = irr_driver->getActualScreenSize().Width / 3;
+
if (UserConfigParams::m_artist_debug_mode)
- position = core::rect(51, 0, 30*fheight+51, 2*fheight + fheight / 3);
+ position = core::rect(rwidth - 20, 0, int(rwidth * 4.25), 2 * fheight + (fheight / 5));
else
- position = core::rect(75, 0, 18*fheight+75 , fheight + fheight / 5);
+ position = core::rect(swidth, 0, swidth * 2, fheight + (fheight / 5));
GL32_draw2DRectangle(video::SColor(150, 96, 74, 196), position, NULL);
// We will let pass some time to let things settle before trusting FPS counter
// even if we also ignore fps = 1, which tends to happen in first checks
@@ -1805,12 +1809,15 @@ void IrrDriver::displayFPS()
{
no_trust--;
- static video::SColor fpsColor = video::SColor(255, 0, 0, 0);
+ static video::SColor fpsColor = video::SColor(255, 255, 255, 255);
fps_string = _("FPS: %d/%d/%d - %d KTris, Ping: %dms", "-", "-",
"-", SP::sp_solid_poly_count / 1000, ping);
- font->drawQuick(fps_string,
- core::rect< s32 >(100,0,400,50), fpsColor, false);
+ font->setBlackBorder(true);
+ font->setThinBorder(true);
+ font->drawQuick(fps_string, position, fpsColor, false);
+ font->setThinBorder(false);
+ font->setBlackBorder(false);
return;
}
@@ -1828,9 +1835,8 @@ void IrrDriver::displayFPS()
if ((UserConfigParams::m_artist_debug_mode)&&(CVS->isGLSL()))
{
fps_string = StringUtils::insertValues
- (L"FPS: %d/%d/%d - PolyCount: %d Solid, "
- "%d Shadows - LightDist : %d\nComplexity %d, Total skinning joints: %d, "
- "Ping: %dms",
+ (L"FPS: %d/%d/%d - PolyCount: %d Solid, %d Shadows - LightDist: %d\n"
+ "Complexity %d, Total skinning joints: %d, Ping: %dms",
min, fps, max, SP::sp_solid_poly_count,
SP::sp_shadow_poly_count, m_last_light_bucket_distance, irr_driver->getSceneComplexity(),
m_skinning_joint, ping);
@@ -1849,9 +1855,14 @@ void IrrDriver::displayFPS()
}
}
- static video::SColor fpsColor = video::SColor(255, 0, 0, 0);
+ static video::SColor fpsColor = video::SColor(255, 255, 255, 255);
+
+ font->setBlackBorder(true);
+ font->setThinBorder(true);
+ font->drawQuick(fps_string.c_str(), position, fpsColor, false);
+ font->setThinBorder(false);
+ font->setBlackBorder(false);
- font->drawQuick( fps_string.c_str(), position, fpsColor, false );
#endif
} // updateFPS
diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp
index 41165a764..a3301d7c6 100644
--- a/src/input/input_manager.cpp
+++ b/src/input/input_manager.cpp
@@ -253,21 +253,17 @@ void InputManager::handleStaticAction(int key, int value)
// When no players... a cutscene
if (RaceManager::get() &&
RaceManager::get()->getNumPlayers() == 0 && world != NULL && value > 0 &&
- (key == IRR_KEY_SPACE || key == IRR_KEY_RETURN ||
+ (key == IRR_KEY_SPACE || key == IRR_KEY_RETURN ||
key == IRR_KEY_BUTTON_A))
{
world->onFirePressed(NULL);
}
-
- if (world != NULL && UserConfigParams::m_artist_debug_mode &&
- control_is_pressed && value > 0)
+ if (world != NULL && UserConfigParams::m_artist_debug_mode)
{
- if (Debug::handleStaticAction(key))
- return;
+ Debug::handleStaticAction(key, value, control_is_pressed, shift_is_pressed);
}
- // TODO: move debug shortcuts to Debug::handleStaticAction
switch (key)
{
#ifdef DEBUG
@@ -285,137 +281,31 @@ void InputManager::handleStaticAction(int key, int value)
{
if(!ProfileWorld::isProfileMode() || !world) break;
int kart_id = key - IRR_KEY_1;
- if(kart_id<0 || kart_id>=(int)world->getNumKarts()) break;
+ if(kart_id < 0 || kart_id >= (int)world->getNumKarts()) break;
Camera::getCamera(0)->setKart(world->getKart(kart_id));
break;
}
#endif
-
case IRR_KEY_CONTROL:
case IRR_KEY_RCONTROL:
case IRR_KEY_LCONTROL:
case IRR_KEY_RMENU:
case IRR_KEY_LMENU:
case IRR_KEY_LWIN:
- control_is_pressed = value!=0;
+ {
+ control_is_pressed = value != 0;
break;
+ }
case IRR_KEY_LSHIFT:
case IRR_KEY_RSHIFT:
case IRR_KEY_SHIFT:
- shift_is_pressed = value!=0; break;
-
- // Flying up and down
- case IRR_KEY_I:
{
- if (!world || !UserConfigParams::m_artist_debug_mode) break;
-
- AbstractKart* kart = world->getLocalPlayerKart(0);
- if (kart == NULL) break;
-
- kart->flyUp();
+ shift_is_pressed = value != 0;
break;
}
- case IRR_KEY_K:
- {
- if (!world || !UserConfigParams::m_artist_debug_mode) break;
-
- AbstractKart* kart = world->getLocalPlayerKart(0);
- if (kart == NULL) break;
-
- kart->flyDown();
- break;
- }
- // Moving the first person camera
- case IRR_KEY_W:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam )
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.Z = value ? cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- case IRR_KEY_S:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam)
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.Z = value ? -cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- case IRR_KEY_D:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && !UserConfigParams::m_artist_debug_mode && cam)
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.X = value ? -cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- case IRR_KEY_A:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam)
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.X = value ? cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- case IRR_KEY_R:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam)
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.Y = value ? cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- case IRR_KEY_F:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam)
- {
- core::vector3df vel(cam->getLinearVelocity());
- vel.Y = value ? -cam->getMaximumVelocity() : 0;
- cam->setLinearVelocity(vel);
- }
- break;
- }
- // Rotating the first person camera
- case IRR_KEY_Q:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam )
- {
- cam->setAngularVelocity(value ?
- UserConfigParams::m_fpscam_max_angular_velocity : 0.0f);
- }
- break;
- }
- case IRR_KEY_E:
- {
- CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
- if (world && UserConfigParams::m_artist_debug_mode && cam)
- {
- cam->setAngularVelocity(value ?
- -UserConfigParams::m_fpscam_max_angular_velocity : 0);
- }
- break;
- }
-
case IRR_KEY_SNAPSHOT:
case IRR_KEY_PRINT:
+ {
// on windows we don't get a press event, only release. So
// save on release only (to avoid saving twice on other platforms)
if (value == 0)
@@ -431,139 +321,56 @@ void InputManager::handleStaticAction(int key, int value)
}
}
break;
+ }
case IRR_KEY_F11:
- if(value && shift_is_pressed)
- {
-#ifndef SERVER_ONLY
- ShaderBasedRenderer* sbr = SP::getRenderer();
- if (sbr)
- sbr->dumpRTT();
-#endif
- }
- break;
-
- /*
- else if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
-
- if (control_is_pressed)
- kart->setPowerup(PowerupManager::POWERUP_SWATTER, 10000);
- else
- kart->setPowerup(PowerupManager::POWERUP_RUBBERBALL, 10000);
-
-#ifdef FORCE_RESCUE_ON_FIRST_KART
- // Can be useful for debugging places where the AI gets into
- // a rescue loop: rescue, drive, crash, rescue to same place
- world->getKart(0)->forceRescue();
-#endif
- }
- break;
- case IRR_KEY_F2:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
-
- kart->setPowerup(PowerupManager::POWERUP_PLUNGER, 10000);
- }
- break;
- case IRR_KEY_F3:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setPowerup(PowerupManager::POWERUP_CAKE, 10000);
- }
- break;
- case IRR_KEY_F4:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setPowerup(PowerupManager::POWERUP_SWITCH, 10000);
- }
- break;
- case IRR_KEY_F5:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setPowerup(PowerupManager::POWERUP_BOWLING, 10000);
- }
- break;
- case IRR_KEY_F6:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setPowerup(PowerupManager::POWERUP_BUBBLEGUM, 10000);
- }
- break;
- case IRR_KEY_F7:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setPowerup(PowerupManager::POWERUP_ZIPPER, 10000);
- }
- break;
- case IRR_KEY_F8:
- if (UserConfigParams::m_artist_debug_mode && value && world)
+ {
+ if (value && world)
{
if (control_is_pressed)
{
- RaceGUIBase* gui = world->getRaceGUI();
- if (gui != NULL) gui->m_enabled = !gui->m_enabled;
-
- const int count = World::getWorld()->getNumKarts();
- for (int n=0; ngetKart(n)->getController()->isPlayerController())
- World::getWorld()->getKart(n)->getNode()
- ->setVisible(gui->m_enabled);
- }
- }
- else
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- kart->setEnergy(100.0f);
- }
- }
- break;
- case IRR_KEY_F9:
- if (UserConfigParams::m_artist_debug_mode && world)
- {
- AbstractKart* kart = world->getLocalPlayerKart(0);
- if(control_is_pressed && RaceManager::get()->getMinorMode()!=
- RaceManager::MINOR_MODE_3_STRIKES)
- kart->setPowerup(PowerupManager::POWERUP_RUBBERBALL,
- 10000);
- else
- kart->setPowerup(PowerupManager::POWERUP_SWATTER, 10000);
- }
- break;
- */
- case IRR_KEY_F10:
- if(world && value)
- {
- if(control_is_pressed)
- ReplayRecorder::get()->save();
- else
history->Save();
+ }
+ else if (shift_is_pressed)
+ {
+#ifndef SERVER_ONLY
+ ShaderBasedRenderer* sbr = SP::getRenderer();
+ if (sbr)
+ {
+ sbr->dumpRTT();
+ }
+#endif
+ }
+ else
+ {
+ ReplayRecorder::get()->save();
+ }
}
break;
- /*
- case IRR_KEY_F11:
- if (UserConfigParams::m_artist_debug_mode && value &&
- control_is_pressed && world)
- {
- world->getPhysics()->nextDebugMode();
- }
- break;
- */
+ }
case IRR_KEY_F12:
- if(value)
- UserConfigParams::m_display_fps =
+ {
+ if (value)
+ {
+ if (control_is_pressed)
+ {
+ UserConfigParams::m_karts_powerup_gui =
+ !UserConfigParams::m_karts_powerup_gui;
+ }
+ else if (shift_is_pressed)
+ {
+ UserConfigParams::m_soccer_player_list =
+ !UserConfigParams::m_soccer_player_list;
+ }
+ else
+ {
+ UserConfigParams::m_display_fps =
!UserConfigParams::m_display_fps;
+ }
+ }
break;
- default:
- break;
- } // switch
+ }
+ default : break;
+ }
} // handleStaticAction
//-----------------------------------------------------------------------------
@@ -740,15 +547,15 @@ int InputManager::getPlayerKeyboardID() const
}
//-----------------------------------------------------------------------------
/** Handles the conversion from some input to a GameAction and its distribution
- * to the currently active menu.
- * It also handles whether the game is currently sensing input. It does so by
- * suppressing the distribution of the input as a GameAction. Instead the
- * input is stored in 'm_sensed_input' and GA_SENSE_COMPLETE is distributed. If
- * however the input in question has resolved to GA_LEAVE this is treated as
- * an attempt of the user to cancel the sensing. In that case GA_SENSE_CANCEL
- * is distributed.
+ * to the currently active menu.
+ * It also handles whether the game is currently sensing input. It does so by
+ * suppressing the distribution of the input as a GameAction. Instead the
+ * input is stored in 'm_sensed_input' and GA_SENSE_COMPLETE is distributed. If
+ * however the input in question has resolved to GA_LEAVE this is treated as
+ * an attempt of the user to cancel the sensing. In that case GA_SENSE_CANCEL
+ * is distributed.
*
- * Note: It is the obligation of the called menu to switch of the sense mode.
+ * Note: It is the obligation of the called menu to switch of the sense mode.
*
*/
void InputManager::dispatchInput(Input::InputType type, int deviceID,
@@ -780,8 +587,10 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
return;
}
- // Abort demo mode if a key is pressed during the race in demo mode
- if(dynamic_cast(World::getWorld()))
+ // Abort demo mode if a key is pressed during the race in demo mode,
+ // if a dialog is not active
+ if(dynamic_cast(World::getWorld()) &&
+ !GUIEngine::ModalDialog::isADialogActive())
{
RaceManager::get()->exitRace();
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
@@ -796,7 +605,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
&player, &action);
// in menus, some keyboard keys are standard (before each player selected
- // his device). So if a key could not be mapped to any known binding,
+ // their device). So if a key could not be mapped to any known binding,
// fall back to check the defaults.
if (!action_found &&
StateManager::get()->getGameState() != GUIEngine::GAME &&
@@ -1166,7 +975,7 @@ EventPropagation InputManager::input(const SEvent& event)
// single letter). Same for spacebar. Same for letters.
if (GUIEngine::isWithinATextBox())
{
- if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
+ if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
key == IRR_KEY_SHIFT)
{
return EVENT_LET;
@@ -1199,7 +1008,7 @@ EventPropagation InputManager::input(const SEvent& event)
// single letter). Same for spacebar. Same for letters.
if (GUIEngine::isWithinATextBox())
{
- if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
+ if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE ||
key == IRR_KEY_SHIFT)
{
return EVENT_LET;
@@ -1322,18 +1131,18 @@ EventPropagation InputManager::input(const SEvent& event)
}
// Simulate touch events if there is no real device
- if (UserConfigParams::m_multitouch_active > 1 &&
+ if (UserConfigParams::m_multitouch_active > 1 &&
!irr_driver->getDevice()->supportsTouchDevice())
{
MultitouchDevice* device = m_device_manager->getMultitouchDevice();
-
+
if (device != NULL && (type == EMIE_LMOUSE_PRESSED_DOWN ||
type == EMIE_LMOUSE_LEFT_UP || type == EMIE_MOUSE_MOVED))
{
device->m_events[0].id = 0;
device->m_events[0].x = event.MouseInput.X;
device->m_events[0].y = event.MouseInput.Y;
-
+
if (type == EMIE_LMOUSE_PRESSED_DOWN)
{
device->m_events[0].touched = true;
@@ -1342,7 +1151,7 @@ EventPropagation InputManager::input(const SEvent& event)
{
device->m_events[0].touched = false;
}
-
+
m_device_manager->updateMultitouchDevice();
device->updateDeviceState(0);
}
@@ -1368,7 +1177,7 @@ EventPropagation InputManager::input(const SEvent& event)
if (device && device->isAccelerometerActive())
{
m_device_manager->updateMultitouchDevice();
-
+
float factor = UserConfigParams::m_multitouch_tilt_factor;
factor = std::max(factor, 0.1f);
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_GYROSCOPE)
diff --git a/src/items/powerup.cpp b/src/items/powerup.cpp
index 4c8931382..ef92cbd50 100644
--- a/src/items/powerup.cpp
+++ b/src/items/powerup.cpp
@@ -198,6 +198,18 @@ void Powerup::set(PowerupManager::PowerupType type, int n)
} // set
+//-----------------------------------------------------------------------------
+/** Sets the amount of the current collected item.
+ * \param n Number of items.
+ */
+void Powerup::setNum(int n)
+{
+ // Limit to 255 (save space in network state saving)
+ if(n>255) n = 255;
+
+ m_number=n;
+}
+
//-----------------------------------------------------------------------------
/** Returns the icon for the currently collected powerup. Used in the
* race_gui to display the collected item.
diff --git a/src/items/powerup.hpp b/src/items/powerup.hpp
index 54d6d3bbb..816835ffb 100644
--- a/src/items/powerup.hpp
+++ b/src/items/powerup.hpp
@@ -54,7 +54,8 @@ private:
public:
Powerup (AbstractKart* kart_);
~Powerup ();
- void set (PowerupManager::PowerupType _type, int n=1);
+ void set (PowerupManager::PowerupType _type, int n = 1);
+ void setNum (int n = 1);
void reset ();
Material* getIcon () const;
void adjustSound ();
diff --git a/src/karts/controller/skidding_ai.cpp b/src/karts/controller/skidding_ai.cpp
index 06b303ff6..b1b1d2691 100644
--- a/src/karts/controller/skidding_ai.cpp
+++ b/src/karts/controller/skidding_ai.cpp
@@ -1251,6 +1251,9 @@ void SkiddingAI::handleItems(const float dt, const Vec3 *aim_point, int last_nod
break;
}// POWERUP_PARACHUTE
+ case PowerupManager::POWERUP_ANVIL:
+ break; // POWERUP_ANVIL
+
case PowerupManager::POWERUP_SWATTER:
{
// if the kart has a shield, do not break it by using a swatter.
diff --git a/src/main.cpp b/src/main.cpp
index 541fb99e5..08420249c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -590,6 +590,10 @@ void cmdLineHelp()
"seconds.\n"
" --unlock-all Permanently unlock all karts and tracks for testing.\n"
" --no-unlock-all Disable unlock-all (i.e. base unlocking on player achievement).\n"
+ " --xmas=n Toggle Xmas/Christmas mode. n=0 Use current date, n=1, Always enable,\n"
+ " n=2, Always disable.\n"
+ " --easter=n Toggle Easter ears mode. n=0 Use current date, n=1, Always enable,\n"
+ " n=2, Always disable.\n"
" --no-graphics Do not display the actual race.\n"
" --sp-shader-debug Enables debug in sp shader, it will print all unavailable uniforms.\n"
" --demo-mode=t Enables demo mode after t seconds of idle time in "
@@ -598,13 +602,7 @@ void cmdLineHelp()
" spaces are allowed in the track names.\n"
" --demo-laps=n Number of laps to use in a demo.\n"
" --demo-karts=n Number of karts to use in a demo.\n"
- // " --history Replay history file 'history.dat'.\n"
- // " --test-ai=n Use the test-ai for every n-th AI kart.\n"
- // " (so n=1 means all Ais will be the test ai)\n"
- // "
- // " --disable-item-collection Disable item collection. Useful for\n"
- // " debugging client/server item management.\n"
- // " --network-item-debugging Print item handling debug information.\n"
+ " --history Replay history file 'history.dat'.\n"
" --server-config=file Specify the server_config.xml for server hosting, it will create\n"
" one if not found.\n"
" --network-console Enable network console.\n"
@@ -646,6 +644,7 @@ void cmdLineHelp()
" --no-console-log Does not write messages in the console but to\n"
" stdout.log.\n"
" -h, --help Show this help.\n"
+ " --help-debug Show help for debugging options.\n"
" --log=N Set the verbosity to a value between\n"
" 0 (Debug) and 5 (Only Fatal messages)\n"
" --logbuffer=N Buffers up to N lines log lines before writing.\n"
@@ -687,6 +686,9 @@ void cmdLineHelp()
" --apitrace This will disable buffer storage and\n"
" writing gpu query strings to opengl, which\n"
" can be seen later in apitrace.\n"
+#ifdef ENABLE_WIIUSE
+ " --wii Enable usage of Wii Remotes.\n"
+#endif
#if defined(__linux__) || defined(__FreeBSD__)
"\n"
"Environment variables:\n"
@@ -702,6 +704,51 @@ void cmdLineHelp()
);
} // cmdLineHelp
+void cmdDebugHelp()
+{
+ fprintf(stdout,
+ "Usage: %s [OPTIONS]\n\n"
+ "Run SuperTuxKart, a go-kart racing game that features "
+ "Tux and friends.\n\n"
+ "Debug options (some work only if artist debug mode is enabled):\n"
+ " --debug=s s=all Log everything, s=addons Log addons management,\n"
+ " s=gui Log GUI events, s=flyable Log flyables,\n"
+ " s=memory Log memory usage, s=misc Log other events.\n"
+ " --gamepad-visuals Debug gamepads by visualising their values.\n"
+ " --no-high-scores Disable writing high scores.\n"
+ " --unit-testing Run unit tests and exit.\n"
+ " --gamepad-debug Enable verbose logging of gamepad button presses.\n"
+ " --keyboard-debug Enable verbose logging of keyboard key presses.\n"
+ " --wiimote-debug Enable verbose logging of Wii Remote button presses.\n"
+ " --tutorial-debug Enable verbose logging of the tutorial mode.\n"
+ " --track-debug Enable displaying the driveline in tracks.\n"
+ " --check-debug Enable displaying the checklines in tracks.\n"
+ " --kartsize-debug Enable verbose logging of kart dimensions\n"
+ " and mesh buffer counts.\n"
+ " --physics-debug Enable verbose logging of the physics system.\n"
+ " --material-debug Enable verbose logging of terrain specific slowdowns.\n"
+ " --ftl-debug Enable verbose logging in follow-the-leader mode.\n"
+ " --slipstream-debug Enable displaying of slipstreams more prominently.\n"
+ " --rendering-debug Enable displaying of ambient/diffuse/specularity\n"
+ " in RGB & all anisotropic.\n"
+ " --ai-debug Enable displaying of AI controllers as on-screen text.\n"
+ " Makes it easier to distingush between different AI controllers.\n"
+ " --fps-debug Enable verbose logging of the FPS counter on every frame.\n"
+ " --rewind Enable the rewind manager.\n"
+ " --battle-ai-stats Enable verbose logging of AI karts in battle modes.\n"
+ " --soccer-ai-stats Enable verbose logging of AI karts in soccer mode.\n"
+ " --test-ai=n Use the test-ai for every n-th AI kart.\n"
+ " (so n=1 means all Ais will be the test ai)\n"
+ " --disable-item-collection Disable item collection. Useful for\n"
+ " debugging client/server item management.\n"
+ " --network-item-debugging Print item handling debug information.\n"
+ "\n"
+ "You can visit SuperTuxKart's homepage at "
+ "https://supertuxkart.net\n\n",
+ CommandLine::getExecName().c_str()
+ );
+} // cmdDebugHelp
+
//=============================================================================
/** For base options that modify the output (loglevel/color) or exit right
* after being processed (version/help).
@@ -716,6 +763,13 @@ int handleCmdLineOutputModifier()
exit(0);
}
+ if (CommandLine::has("--help-debug"))
+ {
+ cmdDebugHelp();
+ cleanUserConfig();
+ exit(0);
+ }
+
if(CommandLine::has("--version") || CommandLine::has("-v"))
{
Log::info("main", "==============================");
@@ -752,8 +806,7 @@ int handleCmdLineOutputModifier()
*/
int handleCmdLinePreliminary()
{
- if(CommandLine::has("--gamepad-visualisation") || // only BE
- CommandLine::has("--gamepad-visualization") ) // both AE and BE
+ if(CommandLine::has("--gamepad-visuals"))
UserConfigParams::m_gamepad_visualisation=true;
if(CommandLine::has("--debug=memory"))
UserConfigParams::m_verbosity |= UserConfigParams::LOG_MEMORY;
@@ -956,10 +1009,10 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
irr::core::stringw login, password;
- if (CommandLine::has("--unit-testing"))
- UserConfigParams::m_unit_testing = true;
if (CommandLine::has("--no-high-scores"))
UserConfigParams::m_no_high_scores=true;
+ if (CommandLine::has("--unit-testing"))
+ UserConfigParams::m_unit_testing = true;
if (CommandLine::has("--gamepad-debug"))
UserConfigParams::m_gamepad_debug=true;
if (CommandLine::has("--keyboard-debug"))
@@ -1027,21 +1080,6 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
if (UserConfigParams::m_artist_debug_mode)
{
- if (CommandLine::has("--camera-wheel-debug"))
- {
- Camera::setDefaultCameraType(Camera::CM_TYPE_DEBUG);
- CameraDebug::setDebugType(CameraDebug::CM_DEBUG_GROUND);
- }
- if(CommandLine::has("--camera-debug"))
- {
- Camera::setDefaultCameraType(Camera::CM_TYPE_DEBUG);
- CameraDebug::setDebugType(CameraDebug::CM_DEBUG_TOP_OF_KART);
- }
- if(CommandLine::has("--camera-kart-debug"))
- {
- Camera::setDefaultCameraType(Camera::CM_TYPE_DEBUG);
- CameraDebug::setDebugType(CameraDebug::CM_DEBUG_BEHIND_KART);
- }
if(CommandLine::has("--physics-debug"))
UserConfigParams::m_physics_debug=1;
if(CommandLine::has("--check-debug"))
diff --git a/src/states_screens/dialogs/debug_slider.cpp b/src/states_screens/dialogs/debug_slider.cpp
index f30980ea5..2315d7171 100644
--- a/src/states_screens/dialogs/debug_slider.cpp
+++ b/src/states_screens/dialogs/debug_slider.cpp
@@ -32,7 +32,7 @@ using namespace GUIEngine;
// ------------------------------------------------------------------------------------------------------
-DebugSliderDialog::DebugSliderDialog() : ModalDialog(0.85f, 0.4f, MODAL_DIALOG_LOCATION_BOTTOM)
+DebugSliderDialog::DebugSliderDialog() : ModalDialog(0.85f, 0.45f, MODAL_DIALOG_LOCATION_BOTTOM)
{
m_fade_background = false;
@@ -56,6 +56,13 @@ void DebugSliderDialog::changeLabel(std::string id, std::string new_label)
// ------------------------------------------------------------------------------------------------------
+void DebugSliderDialog::toggleSlider(std::string id, bool option)
+{
+ getWidget(id.c_str())->setActive(option);
+}
+
+// ------------------------------------------------------------------------------------------------------
+
void DebugSliderDialog::onEnterPressedInternal()
{
}
@@ -64,6 +71,12 @@ void DebugSliderDialog::onEnterPressedInternal()
GUIEngine::EventPropagation DebugSliderDialog::processEvent(const std::string& eventSource)
{
+ if (eventSource == "close")
+ {
+ ModalDialog::dismiss();
+ return GUIEngine::EVENT_BLOCK;
+ }
+
if (Setters.find(eventSource) == Setters.end())
return GUIEngine::EVENT_LET;
diff --git a/src/states_screens/dialogs/debug_slider.hpp b/src/states_screens/dialogs/debug_slider.hpp
index 36b5dba84..efe0d9052 100644
--- a/src/states_screens/dialogs/debug_slider.hpp
+++ b/src/states_screens/dialogs/debug_slider.hpp
@@ -41,6 +41,7 @@ public:
~DebugSliderDialog() {};
void setSliderHook(std::string id, unsigned min, unsigned max, std::function G, std::function S);
void changeLabel(std::string id, std::string new_label);
+ void toggleSlider(std::string id, bool option);
virtual void onEnterPressedInternal() OVERRIDE;
virtual void onUpdate(float dt) OVERRIDE;
diff --git a/src/states_screens/dialogs/tutorial_message_dialog.cpp b/src/states_screens/dialogs/tutorial_message_dialog.cpp
index 0e53155f1..3761ff102 100644
--- a/src/states_screens/dialogs/tutorial_message_dialog.cpp
+++ b/src/states_screens/dialogs/tutorial_message_dialog.cpp
@@ -31,7 +31,7 @@ using namespace GUIEngine;
// ------------------------------------------------------------------------------------------------------
TutorialMessageDialog::TutorialMessageDialog(irr::core::stringw msg, bool stopGame) :
- ModalDialog(0.85f, 0.25f, MODAL_DIALOG_LOCATION_BOTTOM)
+ ModalDialog(0.85f, 0.95f, MODAL_DIALOG_LOCATION_CENTER)
{
m_stop_game = stopGame;
@@ -47,10 +47,8 @@ TutorialMessageDialog::TutorialMessageDialog(irr::core::stringw msg, bool stopGa
LabelWidget* message = getWidget("title");
message->setText( msg.c_str(), false );
- ButtonWidget* cancelbtn = getWidget("continue");
- cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
-
- World::getWorld()->getKart(0)->getControls().reset();
+ ButtonWidget* continuebtn = getWidget("continue");
+ continuebtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
// ------------------------------------------------------------------------------------------------------
diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp
index 2938016a2..3eb5173ba 100644
--- a/src/utils/debug.cpp
+++ b/src/utils/debug.cpp
@@ -25,6 +25,8 @@
#include "font/regular_face.hpp"
#include "graphics/camera_debug.hpp"
#include "graphics/camera_fps.hpp"
+#include "graphics/shader_based_renderer.hpp"
+#include "graphics/sp/sp_base.hpp"
#include "graphics/stk_text_billboard.hpp"
#include "karts/explosion_animation.hpp"
#include "graphics/irr_driver.hpp"
@@ -39,11 +41,13 @@
#include "guiengine/screen_keyboard.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/text_box_widget.hpp"
+#include "items/powerup.hpp"
#include "items/powerup_manager.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_properties.hpp"
#include "karts/controller/controller.hpp"
+#include "karts/rescue_animation.hpp"
#include "modes/cutscene_world.hpp"
#include "modes/world.hpp"
#include "physics/irr_debug_drawer.hpp"
@@ -54,11 +58,13 @@
#include "scriptengine/script_engine.hpp"
#include "states_screens/dialogs/debug_slider.hpp"
#include "states_screens/dialogs/general_text_field_dialog.hpp"
+#include "states_screens/dialogs/tutorial_message_dialog.hpp"
#include "tracks/track_manager.hpp"
#include "utils/constants.hpp"
#include "utils/log.hpp"
#include "utils/profiler.hpp"
#include "utils/string_utils.hpp"
+#include "utils/translation.hpp"
#include
#include
@@ -79,14 +85,15 @@ static bool g_debug_menu_visible = false;
// Commands for the debug menu
enum DebugMenuCommand
{
- //! graphics commands
DEBUG_GRAPHICS_RELOAD_SHADERS,
+ DEBUG_GRAPHICS_RELOAD_TEXTURES,
DEBUG_GRAPHICS_RESET,
DEBUG_GRAPHICS_SSAO_VIZ,
DEBUG_GRAPHICS_SHADOW_VIZ,
DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ,
DEBUG_GRAPHICS_BULLET_1,
DEBUG_GRAPHICS_BULLET_2,
+ DEBUG_RENDER_NW_DEBUG,
DEBUG_PROFILER,
DEBUG_PROFILER_WRITE_REPORT,
DEBUG_FONT_DUMP_GLYPH_PAGE,
@@ -102,6 +109,9 @@ enum DebugMenuCommand
DEBUG_FPS,
DEBUG_SAVE_REPLAY,
DEBUG_SAVE_HISTORY,
+ DEBUG_SAVE_SCREENSHOT,
+ DEBUG_DUMP_RTT,
+ DEBUG_POWERUP_ANVIL,
DEBUG_POWERUP_BOWLING,
DEBUG_POWERUP_BUBBLEGUM,
DEBUG_POWERUP_CAKE,
@@ -112,10 +122,16 @@ enum DebugMenuCommand
DEBUG_POWERUP_SWITCH,
DEBUG_POWERUP_ZIPPER,
DEBUG_POWERUP_NITRO,
+ DEBUG_POWERUP_NOTHING,
+ DEBUG_NITRO_CLEAR,
+ DEBUG_POWERUP_SLIDER,
DEBUG_ATTACHMENT_PARACHUTE,
DEBUG_ATTACHMENT_BOMB,
DEBUG_ATTACHMENT_ANVIL,
+ DEBUG_ATTACHMENT_SQUASH,
+ DEBUG_ATTACHMENT_PLUNGER,
DEBUG_ATTACHMENT_EXPLOSION,
+ DEBUG_ATTACHMENT_NOTHING,
DEBUG_GUI_TOGGLE,
DEBUG_GUI_HIDE_KARTS,
DEBUG_GUI_CAM_FREE,
@@ -123,10 +139,13 @@ enum DebugMenuCommand
DEBUG_GUI_CAM_WHEEL,
DEBUG_GUI_CAM_BEHIND_KART,
DEBUG_GUI_CAM_SIDE_OF_KART,
+ DEBUG_GUI_CAM_INV_SIDE_OF_KART,
+ DEBUG_GUI_CAM_FRONT_OF_KART,
DEBUG_GUI_CAM_NORMAL,
DEBUG_GUI_CAM_SMOOTH,
DEBUG_GUI_CAM_ATTACH,
DEBUG_VIEW_KART_PREVIOUS,
+ DEBUG_VIEW_KART_NEXT,
DEBUG_VIEW_KART_ONE,
DEBUG_VIEW_KART_TWO,
DEBUG_VIEW_KART_THREE,
@@ -135,8 +154,12 @@ enum DebugMenuCommand
DEBUG_VIEW_KART_SIX,
DEBUG_VIEW_KART_SEVEN,
DEBUG_VIEW_KART_EIGHT,
- DEBUG_VIEW_KART_NEXT,
+ DEBUG_VIEW_KART_NINE,
+ DEBUG_VIEW_KART_LAST,
+ DEBUG_VIEW_KART_SLIDER,
DEBUG_HIDE_KARTS,
+ DEBUG_RESCUE_KART,
+ DEBUG_PAUSE,
DEBUG_THROTTLE_FPS,
DEBUG_VISUAL_VALUES,
DEBUG_PRINT_START_POS,
@@ -144,24 +167,38 @@ enum DebugMenuCommand
DEBUG_SCRIPT_CONSOLE,
DEBUG_RUN_CUTSCENE,
DEBUG_TEXTURE_CONSOLE,
- DEBUG_RENDER_NW_DEBUG,
DEBUG_START_RECORDING,
- DEBUG_STOP_RECORDING
+ DEBUG_STOP_RECORDING,
+ DEBUG_HELP
}; // DebugMenuCommand
// -----------------------------------------------------------------------------
/** Add powerup selected from debug menu for all player karts */
-void addPowerup(PowerupManager::PowerupType powerup)
+void addPowerup(PowerupManager::PowerupType powerup, int amount)
{
World* world = World::getWorld();
if (!world) return;
for(unsigned int i = 0; i < RaceManager::get()->getNumLocalPlayers(); i++)
{
AbstractKart* kart = world->getLocalPlayerKart(i);
- kart->setPowerup(powerup, 10000);
+ kart->setPowerup(powerup, amount);
}
} // addPowerup
+// ----------------------------------------------------------------------------
+void setNitro(int amount)
+{
+ World* world = World::getWorld();
+ if (!world) return;
+ const unsigned int num_local_players =
+ RaceManager::get()->getNumLocalPlayers();
+ for (unsigned int i = 0; i < num_local_players; i++)
+ {
+ AbstractKart* kart = world->getLocalPlayerKart(i);
+ kart->setEnergy(amount);
+ }
+} // setNitro
+
// ----------------------------------------------------------------------------
void addAttachment(Attachment::AttachmentType type)
{
@@ -169,13 +206,15 @@ void addAttachment(Attachment::AttachmentType type)
if (world == NULL) return;
for (unsigned int i = 0; i < world->getNumKarts(); i++)
{
- AbstractKart *kart = world->getKart(i);
- if (!kart->getController()->isLocalPlayerController())
- continue;
+ AbstractKart *kart = world->getLocalPlayerKart(i);
+ if (kart == NULL)
+ continue;
+ //if (!kart->getController()->isLocalPlayerController())
+ // continue;
if (type == Attachment::ATTACH_ANVIL)
{
kart->getAttachment()
- ->set(type,
+ ->set(type,
stk_config->time2Ticks(kart->getKartProperties()
->getAnvilDuration()) );
kart->adjustSpeed(kart->getKartProperties()->getAnvilSpeedFactor());
@@ -191,8 +230,12 @@ void addAttachment(Attachment::AttachmentType type)
kart->getAttachment()
->set(type, stk_config->time2Ticks(stk_config->m_bomb_time) );
}
+ else if (type == Attachment::ATTACH_NOTHING)
+ {
+ kart->getAttachment()
+ ->reset();
+ }
}
-
} // addAttachment
// ----------------------------------------------------------------------------
@@ -209,7 +252,6 @@ void changeCameraTarget(u32 num)
cam->setMode(Camera::CM_NORMAL);
cam->setKart(kart);
}
-
} // changeCameraTarget
// -----------------------------------------------------------------------------
@@ -243,7 +285,6 @@ LightNode* findNearestLight()
nearest_dist = cam_pos.getDistanceFrom(light_pos);
}
}
-
return nearest;
}
@@ -280,6 +321,11 @@ bool handleContextMenuAction(s32 cmd_id)
ShaderBase::killShaders();
ShaderFilesManager::getInstance()->removeAllShaderFiles();
SP::SPShaderManager::get()->initAll();
+#endif
+ break;
+ case DEBUG_GRAPHICS_RELOAD_TEXTURES:
+#ifndef SERVER_ONLY
+ SP::SPTextureManager::get()->reloadTexture("");
#endif
break;
case DEBUG_GRAPHICS_RESET:
@@ -483,52 +529,82 @@ bool handleContextMenuAction(s32 cmd_id)
#endif
break;
case DEBUG_FPS:
- UserConfigParams::m_display_fps =
- !UserConfigParams::m_display_fps;
+ UserConfigParams::m_display_fps = !UserConfigParams::m_display_fps;
break;
case DEBUG_SAVE_REPLAY:
+ if (!world) return false;
ReplayRecorder::get()->save();
break;
case DEBUG_SAVE_HISTORY:
+ if (!world) return false;
history->Save();
break;
+ case DEBUG_POWERUP_ANVIL:
+ addPowerup(PowerupManager::POWERUP_ANVIL, 255);
+ break;
case DEBUG_POWERUP_BOWLING:
- addPowerup(PowerupManager::POWERUP_BOWLING);
+ addPowerup(PowerupManager::POWERUP_BOWLING, 255);
break;
case DEBUG_POWERUP_BUBBLEGUM:
- addPowerup(PowerupManager::POWERUP_BUBBLEGUM);
+ addPowerup(PowerupManager::POWERUP_BUBBLEGUM, 255);
break;
case DEBUG_POWERUP_CAKE:
- addPowerup(PowerupManager::POWERUP_CAKE);
+ addPowerup(PowerupManager::POWERUP_CAKE, 255);
break;
case DEBUG_POWERUP_PARACHUTE:
- addPowerup(PowerupManager::POWERUP_PARACHUTE);
+ addPowerup(PowerupManager::POWERUP_PARACHUTE, 255);
break;
case DEBUG_POWERUP_PLUNGER:
- addPowerup(PowerupManager::POWERUP_PLUNGER);
+ addPowerup(PowerupManager::POWERUP_PLUNGER, 255);
break;
case DEBUG_POWERUP_RUBBERBALL:
- addPowerup(PowerupManager::POWERUP_RUBBERBALL);
+ addPowerup(PowerupManager::POWERUP_RUBBERBALL, 255);
break;
case DEBUG_POWERUP_SWATTER:
- addPowerup(PowerupManager::POWERUP_SWATTER);
+ addPowerup(PowerupManager::POWERUP_SWATTER, 255);
break;
case DEBUG_POWERUP_SWITCH:
- addPowerup(PowerupManager::POWERUP_SWITCH);
+ addPowerup(PowerupManager::POWERUP_SWITCH, 255);
break;
case DEBUG_POWERUP_ZIPPER:
- addPowerup(PowerupManager::POWERUP_ZIPPER);
+ addPowerup(PowerupManager::POWERUP_ZIPPER, 255);
break;
case DEBUG_POWERUP_NITRO:
+ {
+ setNitro(100.0f);
+ break;
+ }
+ case DEBUG_POWERUP_NOTHING:
+ addPowerup(PowerupManager::POWERUP_NOTHING, 0);
+ break;
+ case DEBUG_NITRO_CLEAR:
+ {
+ setNitro(0.0f);
+ break;
+ }
+ case DEBUG_POWERUP_SLIDER:
{
if (!world) return false;
- const unsigned int num_local_players =
- RaceManager::get()->getNumLocalPlayers();
- for (unsigned int i = 0; i < num_local_players; i++)
- {
- AbstractKart* kart = world->getLocalPlayerKart(i);
- kart->setEnergy(100.0f);
- }
+ DebugSliderDialog *dsd = new DebugSliderDialog();
+ dsd->changeLabel("Red", "Powerup count");
+ dsd->setSliderHook("red_slider", 0, 255,
+ [](){ return Camera::getActiveCamera()->getKart()->getNumPowerup(); },
+ [](int new_pw_amt){Camera::getActiveCamera()->getKart()->
+ getPowerup()->setNum(new_pw_amt); }
+ );
+ dsd->changeLabel("Green", "Nitro amount");
+ dsd->setSliderHook("green_slider", 0, 100,
+ [](){ return Camera::getActiveCamera()->getKart()->getEnergy(); },
+ [](float new_nit_amt){Camera::getActiveCamera()->getKart()->setEnergy(new_nit_amt); }
+ );
+ dsd->changeLabel("Blue", "[None]");
+ dsd->toggleSlider("blue_slider", false);
+ dsd->changeLabel("SSAO radius", "[None]");
+ dsd->toggleSlider("ssao_radius", false);
+ dsd->changeLabel("SSAO k", "[None]");
+ dsd->toggleSlider("ssao_k", false);
+ dsd->changeLabel("SSAO Sigma", "[None]");
+ dsd->toggleSlider("ssao_sigma", false);
break;
}
case DEBUG_ATTACHMENT_ANVIL:
@@ -540,6 +616,21 @@ bool handleContextMenuAction(s32 cmd_id)
case DEBUG_ATTACHMENT_PARACHUTE:
addAttachment(Attachment::ATTACH_PARACHUTE);
break;
+ case DEBUG_ATTACHMENT_SQUASH:
+ for (unsigned int i = 0; i < RaceManager::get()->getNumLocalPlayers(); i++)
+ {
+ AbstractKart* kart = world->getLocalPlayerKart(i);
+ const KartProperties *kp = kart->getKartProperties();
+ kart->setSquash(kp->getSwatterSquashDuration(), kp->getSwatterSquashSlowdown());
+ }
+ break;
+ case DEBUG_ATTACHMENT_PLUNGER:
+ for (unsigned int i = 0; i < RaceManager::get()->getNumLocalPlayers(); i++)
+ {
+ AbstractKart* kart = world->getLocalPlayerKart(i);
+ kart->blockViewWithPlunger();
+ }
+ break;
case DEBUG_ATTACHMENT_EXPLOSION:
for (unsigned int i = 0; i < RaceManager::get()->getNumLocalPlayers(); i++)
{
@@ -547,6 +638,9 @@ bool handleContextMenuAction(s32 cmd_id)
ExplosionAnimation::create(kart, kart->getXYZ(), true);
}
break;
+ case DEBUG_ATTACHMENT_NOTHING:
+ addAttachment(Attachment::ATTACH_NOTHING);
+ break;
case DEBUG_GUI_TOGGLE:
{
if (!world) return false;
@@ -563,6 +657,18 @@ bool handleContextMenuAction(s32 cmd_id)
kart->getNode()->setVisible(false);
}
break;
+ case DEBUG_RESCUE_KART:
+ if (!world) return false;
+ for (unsigned int i = 0; i < RaceManager::get()->getNumLocalPlayers(); i++)
+ {
+ AbstractKart* kart = world->getLocalPlayerKart(i);
+ RescueAnimation::create(kart);
+ }
+ break;
+ case DEBUG_PAUSE:
+ if (!world) return false;
+ world->escapePressed();
+ break;
case DEBUG_GUI_CAM_TOP:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_TOP_OF_KART);
Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
@@ -570,10 +676,13 @@ bool handleContextMenuAction(s32 cmd_id)
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
case DEBUG_GUI_CAM_WHEEL:
- CameraDebug::setDebugType(CameraDebug::CM_DEBUG_GROUND);
- Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
- Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
- irr_driver->getDevice()->getCursorControl()->setVisible(true);
+ if (!(World::getWorld()->getKart(kart_num)->isGhostKart()))
+ {
+ CameraDebug::setDebugType(CameraDebug::CM_DEBUG_GROUND);
+ Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
+ Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
+ irr_driver->getDevice()->getCursorControl()->setVisible(true);
+ }
break;
case DEBUG_GUI_CAM_BEHIND_KART:
CameraDebug::setDebugType(CameraDebug::CM_DEBUG_BEHIND_KART);
@@ -587,6 +696,18 @@ bool handleContextMenuAction(s32 cmd_id)
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
irr_driver->getDevice()->getCursorControl()->setVisible(true);
break;
+ case DEBUG_GUI_CAM_INV_SIDE_OF_KART:
+ CameraDebug::setDebugType(CameraDebug::CM_DEBUG_INV_SIDE_OF_KART);
+ Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
+ Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
+ irr_driver->getDevice()->getCursorControl()->setVisible(true);
+ break;
+ case DEBUG_GUI_CAM_FRONT_OF_KART:
+ CameraDebug::setDebugType(CameraDebug::CM_DEBUG_FRONT_OF_KART);
+ Camera::changeCamera(0, Camera::CM_TYPE_DEBUG);
+ Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
+ irr_driver->getDevice()->getCursorControl()->setVisible(true);
+ break;
case DEBUG_GUI_CAM_FREE:
{
Camera *camera = Camera::getActiveCamera();
@@ -664,6 +785,13 @@ bool handleContextMenuAction(s32 cmd_id)
case DEBUG_VIEW_KART_EIGHT:
changeCameraTarget(8);
break;
+ case DEBUG_VIEW_KART_NINE:
+ changeCameraTarget(9);
+ break;
+ case DEBUG_VIEW_KART_LAST:
+ if (!world) return false;
+ changeCameraTarget(World::getWorld()->getNumKarts());
+ break;
case DEBUG_VIEW_KART_NEXT:
{
if (kart_num == World::getWorld()->getNumKarts() - 1)
@@ -677,13 +805,35 @@ bool handleContextMenuAction(s32 cmd_id)
Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
break;
}
+ case DEBUG_VIEW_KART_SLIDER:
+ {
+ if (!world) return false;
+ DebugSliderDialog *dsd = new DebugSliderDialog();
+ dsd->changeLabel("Red", "Kart number");
+ dsd->setSliderHook("red_slider", 0, World::getWorld()->getNumKarts() - 1,
+ [](){ return Camera::getActiveCamera()->getKart()->getWorldKartId(); },
+ [](int new_kart_num){Camera::getActiveCamera()->
+ setKart(World::getWorld()->getKart(new_kart_num)); }
+ );
+ dsd->changeLabel("Green", "[None]");
+ dsd->toggleSlider("green_slider", false);
+ dsd->changeLabel("Blue", "[None]");
+ dsd->toggleSlider("blue_slider", false);
+ dsd->changeLabel("SSAO radius", "[None]");
+ dsd->toggleSlider("ssao_radius", false);
+ dsd->changeLabel("SSAO k", "[None]");
+ dsd->toggleSlider("ssao_k", false);
+ dsd->changeLabel("SSAO Sigma", "[None]");
+ dsd->toggleSlider("ssao_sigma", false);
+ break;
+ }
case DEBUG_PRINT_START_POS:
if (!world) return false;
for (unsigned int i = 0; igetNumKarts(); i++)
{
AbstractKart *kart = world->getKart(i);
- Log::warn(kart->getIdent().c_str(),
+ Log::info(kart->getIdent().c_str(),
"",
i, kart->getXYZ().getX(), kart->getXYZ().getY(),
kart->getXYZ().getZ(), kart->getHeading()*RAD_TO_DEGREE
@@ -784,6 +934,7 @@ bool handleContextMenuAction(s32 cmd_id)
[](int v){ findNearestLight()->setRadius(float(v)); }
);
dsd->changeLabel("SSAO Sigma", "[None]");
+ dsd->toggleSlider("ssao_sigma", false);
break;
}
case DEBUG_SCRIPT_CONSOLE:
@@ -836,7 +987,7 @@ bool handleContextMenuAction(s32 cmd_id)
((CutsceneWorld*)World::getWorld())->setParts(parts);
});
break;
- case DEBUG_TEXTURE_CONSOLE:
+ case DEBUG_TEXTURE_CONSOLE:
new GeneralTextFieldDialog(
L"Enter the texture filename(s) (separate names by ;)"
" to be reloaded (empty to reload all)\n"
@@ -858,16 +1009,54 @@ bool handleContextMenuAction(s32 cmd_id)
return false;
});
break;
- case DEBUG_RENDER_NW_DEBUG:
- irr_driver->toggleRenderNetworkDebug();
+ case DEBUG_RENDER_NW_DEBUG:
+ irr_driver->toggleRenderNetworkDebug();
break;
- case DEBUG_START_RECORDING:
- irr_driver->setRecording(true);
+ case DEBUG_DUMP_RTT:
+ {
+ if (!world) return false;
+#ifndef SERVER_ONLY
+ ShaderBasedRenderer* sbr = SP::getRenderer();
+ if (sbr)
+ {
+ sbr->dumpRTT();
+ }
+#endif
break;
- case DEBUG_STOP_RECORDING:
- irr_driver->setRecording(false);
+ }
+ case DEBUG_SAVE_SCREENSHOT:
+ irr_driver->requestScreenshot();
break;
- } // switch
+ case DEBUG_START_RECORDING:
+ irr_driver->setRecording(true);
+ break;
+ case DEBUG_STOP_RECORDING:
+ irr_driver->setRecording(false);
+ break;
+ case DEBUG_HELP:
+ new TutorialMessageDialog(_("Debug keyboard shortcuts (can conflict with user-defined shortcuts):\n"
+ "* <~> - Show this help dialog | + - Adjust lights | + - Adjust visuals\n"
+ "* - Anvil powerup | + - Normal view | + - Bomb attachment\n"
+ "* - Basketball powerup | + - First person view | + - Anvil attachment\n"
+ "* - Bowling ball powerup | + - Top view | + - Parachute attachment\n"
+ "* - Bubblegum powerup | + - Behind wheel view | + - Flatten kart\n"
+ "* - Cake powerup | + - Behind kart view | + - Send plunger to kart front\n"
+ "* - Parachute powerup | + - Right side of kart view | + - Explode kart\n"
+ "* - Plunger powerup | + - Left side of kart view | + - Scripting console\n"
+ "* - Swatter powerup | + - Front of kart view | + - Texture console\n"
+ "* - Switch powerup | + - Kart number slider | + - Run cutscene(s)\n"
+ "* - Zipper powerup | + - Powerup amount slider | + - Toggle GUI\n"
+ "* - Save replay | + - Save history | + - Dump RTT\n"
+ "* - Show FPS | + - Show other karts' powerups | + - Show soccer player list\n"
+ "* - Overfilled nitro\n"
+ "* - Clear kart items\n"
+ "* - First kart\n"
+ "* - Last kart\n"
+ "* - Previous kart\n"
+ "* - Next kart"
+ ), true);
+ break;
+ }
return false;
}
@@ -884,104 +1073,190 @@ bool onEvent(const SEvent &event)
if (GUIEngine::ModalDialog::isADialogActive() ||
GUIEngine::ScreenKeyboard::isActive())
return true;
-
+
// Create the menu (only one menu at a time)
#ifdef MOBILE_STK
int x = 10 * irr_driver->getActualScreenSize().Height / 480;
int y = 30 * irr_driver->getActualScreenSize().Height / 480;
if (event.MouseInput.X < x && event.MouseInput.Y < y &&
#else
- if (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
+ if ((event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN ||
+ event.MouseInput.Event == EMIE_MMOUSE_PRESSED_DOWN) &&
#endif
!g_debug_menu_visible)
{
irr_driver->getDevice()->getCursorControl()->setVisible(true);
// root menu
+ const int mwidth = 400;
+ const int mheight = 600;
+
+ // Adapt the position boundaries of the debug menu based on the
+ // current screen and font sizes
+ int boundx, boundy;
+ float scalex, scaley;
+ switch (int(UserConfigParams::m_font_size))
+ {
+ case 0: // Extremely small font
+ {
+ scalex = 8.5;
+ scaley = 2.62;
+ break;
+ }
+ case 1: // Very small font
+ {
+ scalex = 6.75;
+ scaley = 2.1;
+ break;
+ }
+ case 2: // Small font
+ {
+ scalex = 5.75;
+ scaley = 1.7;
+ break;
+ }
+ case 3: // Medium font
+ {
+ scalex = 5.0;
+ scaley = 1.5;
+ break;
+ }
+ case 4: // Large font
+ {
+ scalex = 4.5;
+ scaley = 1.31;
+ break;
+ }
+ case 5: // Very large font
+ {
+ scalex = 4.0;
+ scaley = 1.14;
+ break;
+ }
+ case 6: // Extremely large font
+ {
+ scalex = 3.6;
+ scaley = 1.01;
+ break;
+ }
+ default: // Medium font
+ {
+ scalex = 5.0;
+ scaley = 1.5;
+ break;
+ }
+ }
+
+ boundx = irr_driver->getActualScreenSize().Width -
+ int(irr_driver->getActualScreenSize().Width / scalex);
+ boundy = irr_driver->getActualScreenSize().Height -
+ int(irr_driver->getActualScreenSize().Height / scaley);
+
gui::IGUIEnvironment* guienv = irr_driver->getGUI();
- core::rect r(100, 50, 150, 500);
- IGUIContextMenu* mnu = guienv->addContextMenu(r, NULL);
+ core::rect position;
+ if (event.MouseInput.X > boundx && event.MouseInput.Y > boundy)
+ {
+ position = core::rect(boundx, boundy, mwidth, mheight);
+ }
+ else if (event.MouseInput.X > boundx)
+ {
+ position = core::rect(boundx, event.MouseInput.Y, mwidth, mheight);
+ }
+ else if (event.MouseInput.Y > boundy)
+ {
+ position = core::rect(event.MouseInput.X, boundy, mwidth, mheight);
+ }
+ else
+ {
+ position = core::rect(event.MouseInput.X, event.MouseInput.Y, mwidth, mheight);
+ }
+ IGUIContextMenu* mnu = guienv->addContextMenu(position, NULL);
+
int graphicsMenuIndex = mnu->addItem(L"Graphics >",-1,true,true);
- // graphics menu
IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex);
sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS);
+ sub->addItem(L"Reload textures", DEBUG_GRAPHICS_RELOAD_TEXTURES);
+ sub->addSeparator();
sub->addItem(L"SSAO viz", DEBUG_GRAPHICS_SSAO_VIZ);
sub->addItem(L"Shadow viz", DEBUG_GRAPHICS_SHADOW_VIZ);
sub->addItem(L"Bounding Boxes viz", DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ);
sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1);
sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2);
+ sub->addItem(L"Network debugging", DEBUG_RENDER_NW_DEBUG);
+ sub->addSeparator();
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET);
- mnu->addItem(L"Items >",-1,true,true);
+ mnu->addItem(L"Set camera target >",-1,true, true);
sub = mnu->getSubMenu(1);
- sub->addItem(L"Basketball", DEBUG_POWERUP_RUBBERBALL );
- sub->addItem(L"Bowling", DEBUG_POWERUP_BOWLING );
- sub->addItem(L"Bubblegum", DEBUG_POWERUP_BUBBLEGUM );
- sub->addItem(L"Cake", DEBUG_POWERUP_CAKE );
- sub->addItem(L"Parachute", DEBUG_POWERUP_PARACHUTE );
- sub->addItem(L"Plunger", DEBUG_POWERUP_PLUNGER );
- sub->addItem(L"Swatter", DEBUG_POWERUP_SWATTER );
- sub->addItem(L"Switch", DEBUG_POWERUP_SWITCH );
- sub->addItem(L"Zipper", DEBUG_POWERUP_ZIPPER );
- sub->addItem(L"Nitro", DEBUG_POWERUP_NITRO );
-
- mnu->addItem(L"Attachments >",-1,true, true);
- sub = mnu->getSubMenu(2);
- sub->addItem(L"Bomb", DEBUG_ATTACHMENT_BOMB);
- sub->addItem(L"Anvil", DEBUG_ATTACHMENT_ANVIL);
- sub->addItem(L"Parachute", DEBUG_ATTACHMENT_PARACHUTE);
- sub->addItem(L"Explosion", DEBUG_ATTACHMENT_EXPLOSION);
+ sub->addItem(L"Pick kart from slider (Ctrl + F9)", DEBUG_VIEW_KART_SLIDER);
+ sub->addSeparator();
+ sub->addItem(L"To previous kart (Page Up)", DEBUG_VIEW_KART_PREVIOUS);
+ sub->addItem(L"To next kart (Page Down)", DEBUG_VIEW_KART_NEXT);
+ sub->addSeparator();
+ sub->addItem(L"To kart 1 (Home)", DEBUG_VIEW_KART_ONE);
+ sub->addItem(L"To kart 2", DEBUG_VIEW_KART_TWO);
+ sub->addItem(L"To kart 3", DEBUG_VIEW_KART_THREE);
+ sub->addItem(L"To kart 4", DEBUG_VIEW_KART_FOUR);
+ sub->addItem(L"To kart 5", DEBUG_VIEW_KART_FIVE);
+ sub->addItem(L"To kart 6", DEBUG_VIEW_KART_SIX);
+ sub->addItem(L"To kart 7", DEBUG_VIEW_KART_SEVEN);
+ sub->addItem(L"To kart 8", DEBUG_VIEW_KART_EIGHT);
+ sub->addItem(L"To kart 9", DEBUG_VIEW_KART_NINE);
+ sub->addItem(L"To last kart (End)", DEBUG_VIEW_KART_LAST);
mnu->addItem(L"GUI >",-1,true, true);
- sub = mnu->getSubMenu(3);
- sub->addItem(L"Toggle GUI", DEBUG_GUI_TOGGLE);
+ sub = mnu->getSubMenu(2);
+ sub->addItem(L"Toggle GUI (Shift + F10)", DEBUG_GUI_TOGGLE);
sub->addItem(L"Hide karts", DEBUG_GUI_HIDE_KARTS);
- sub->addItem(L"Top view", DEBUG_GUI_CAM_TOP);
- sub->addItem(L"Behind wheel view", DEBUG_GUI_CAM_WHEEL);
- sub->addItem(L"Behind kart view", DEBUG_GUI_CAM_BEHIND_KART);
- sub->addItem(L"Side of kart view", DEBUG_GUI_CAM_SIDE_OF_KART);
- sub->addItem(L"First person view (Ctrl + F1)", DEBUG_GUI_CAM_FREE);
- sub->addItem(L"Normal view (Ctrl + F2)", DEBUG_GUI_CAM_NORMAL);
+ sub->addSeparator();
+ sub->addItem(L"Normal view (Ctrl + F1)", DEBUG_GUI_CAM_NORMAL);
+ sub->addItem(L"First person view (Ctrl + F2)", DEBUG_GUI_CAM_FREE);
+ sub->addItem(L"Top view (Ctrl + F3)", DEBUG_GUI_CAM_TOP);
+ sub->addItem(L"Behind wheel view (Ctrl + F4)", DEBUG_GUI_CAM_WHEEL);
+ sub->addItem(L"Behind kart view (Ctrl + F5)", DEBUG_GUI_CAM_BEHIND_KART);
+ sub->addItem(L"Right side of kart view (Ctrl + F6)", DEBUG_GUI_CAM_SIDE_OF_KART);
+ sub->addItem(L"Left side of kart view (Ctrl + F7)", DEBUG_GUI_CAM_INV_SIDE_OF_KART);
+ sub->addItem(L"Front of kart view (Ctrl + F8)", DEBUG_GUI_CAM_FRONT_OF_KART);
+
+ sub->addSeparator();
sub->addItem(L"Toggle smooth camera", DEBUG_GUI_CAM_SMOOTH);
sub->addItem(L"Attach fps camera to kart", DEBUG_GUI_CAM_ATTACH);
- mnu->addItem(L"Recording >",-1,true, true);
+ mnu->addItem(L"Items >",-1,true,true);
+ sub = mnu->getSubMenu(3);
+ sub->addItem(L"Anvil (F1)", DEBUG_POWERUP_ANVIL );
+ sub->addItem(L"Basketball (F2)", DEBUG_POWERUP_RUBBERBALL );
+ sub->addItem(L"Bowling (F3)", DEBUG_POWERUP_BOWLING );
+ sub->addItem(L"Bubblegum (F4)", DEBUG_POWERUP_BUBBLEGUM );
+ sub->addItem(L"Cake (F5)", DEBUG_POWERUP_CAKE );
+ sub->addItem(L"Parachute (F6)", DEBUG_POWERUP_PARACHUTE );
+ sub->addItem(L"Plunger (F7)", DEBUG_POWERUP_PLUNGER );
+ sub->addItem(L"Swatter (F8)", DEBUG_POWERUP_SWATTER );
+ sub->addItem(L"Switch (F9)", DEBUG_POWERUP_SWITCH );
+ sub->addItem(L"Zipper (F10)", DEBUG_POWERUP_ZIPPER );
+ sub->addItem(L"Nitro (Insert)", DEBUG_POWERUP_NITRO );
+
+ mnu->addItem(L"Attachments >",-1,true, true);
sub = mnu->getSubMenu(4);
- //
-#ifdef ENABLE_RECORDER
- sub->addItem(L"Start recording", DEBUG_START_RECORDING);
- sub->addItem(L"Stop recording", DEBUG_STOP_RECORDING);
-#else
- sub->addItem(L"Recording unavailable, STK was compiled without\n"
- "recording support. Please re-compile STK with\n"
- "libopenglrecorder to enable recording. If you got\n"
- "SuperTuxKart from your distribution's repositories,\n"
- "please use the official binaries, or contact your\n"
- "distributions's package mantainer.");
-#endif
+ sub->addItem(L"Bomb (Shift + F1)", DEBUG_ATTACHMENT_BOMB);
+ sub->addItem(L"Anvil (Shift + F2)", DEBUG_ATTACHMENT_ANVIL);
+ sub->addItem(L"Parachute (Shift + F3)", DEBUG_ATTACHMENT_PARACHUTE);
+ sub->addItem(L"Flatten (Shift + F4)", DEBUG_ATTACHMENT_SQUASH);
+ sub->addItem(L"Plunger (Shift + F5)", DEBUG_ATTACHMENT_PLUNGER);
+ sub->addItem(L"Explosion (Shift + F6)", DEBUG_ATTACHMENT_EXPLOSION);
- mnu->addItem(L"Change camera target >",-1,true, true);
+ mnu->addItem(L"Modify kart items >",-1,true, true);
sub = mnu->getSubMenu(5);
- sub->addItem(L"To previous kart (Ctrl + F5)", DEBUG_VIEW_KART_PREVIOUS);
- sub->addItem(L"To kart one", DEBUG_VIEW_KART_ONE);
- sub->addItem(L"To kart two", DEBUG_VIEW_KART_TWO);
- sub->addItem(L"To kart three", DEBUG_VIEW_KART_THREE);
- sub->addItem(L"To kart four", DEBUG_VIEW_KART_FOUR);
- sub->addItem(L"To kart five", DEBUG_VIEW_KART_FIVE);
- sub->addItem(L"To kart six", DEBUG_VIEW_KART_SIX);
- sub->addItem(L"To kart seven", DEBUG_VIEW_KART_SEVEN);
- sub->addItem(L"To kart eight", DEBUG_VIEW_KART_EIGHT);
- sub->addItem(L"To next kart (Ctrl + F6)", DEBUG_VIEW_KART_NEXT);
-
- mnu->addItem(L"Font >",-1,true, true);
- sub = mnu->getSubMenu(6);
- sub->addItem(L"Dump glyph pages of fonts", DEBUG_FONT_DUMP_GLYPH_PAGE);
- sub->addItem(L"Reload all fonts", DEBUG_FONT_RELOAD);
+ sub->addItem(L"Adjust with slider (Ctrl + F10)", DEBUG_POWERUP_SLIDER);
+ sub->addSeparator();
+ sub->addItem(L"Clear powerup (Delete)", DEBUG_POWERUP_NOTHING );
+ sub->addItem(L"Clear nitro (Delete)", DEBUG_NITRO_CLEAR );
+ sub->addItem(L"Clear attachment (Delete)", DEBUG_ATTACHMENT_NOTHING);
mnu->addItem(L"SP debug >",-1,true, true);
- sub = mnu->getSubMenu(7);
+ sub = mnu->getSubMenu(6);
sub->addItem(L"Reset SP debug", DEBUG_SP_RESET);
sub->addItem(L"Toggle culling", DEBUG_SP_TOGGLE_CULLING);
sub->addItem(L"Draw world normal in texture", DEBUG_SP_WN_VIZ);
@@ -991,22 +1266,64 @@ bool onEvent(const SEvent &event)
sub->addItem(L"Toggle wireframe visualization", DEBUG_SP_WIREFRAME_VIZ);
sub->addItem(L"Toggle triangle normals visualization", DEBUG_SP_TN_VIZ);
- mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES);
+ mnu->addItem(L"Keypress actions >",-1,true, true);
+ sub = mnu->getSubMenu(7);
+ sub->addItem(L"Rescue", DEBUG_RESCUE_KART);
+ sub->addItem(L"Pause", DEBUG_PAUSE);
- mnu->addItem(L"Profiler", DEBUG_PROFILER);
+ mnu->addItem(L"Output >",-1,true, true);
+ sub = mnu->getSubMenu(8);
+ sub->addItem(L"Print kart positions", DEBUG_PRINT_START_POS);
+ sub->addSeparator();
+ sub->addItem(L"Save screenshot (Print Screen)", DEBUG_SAVE_SCREENSHOT);
+ sub->addItem(L"Save replay (Ctrl + F11)", DEBUG_SAVE_REPLAY);
+ sub->addItem(L"Save history (F11)", DEBUG_SAVE_HISTORY);
+ sub->addItem(L"Dump RTT (Shift + F11)", DEBUG_DUMP_RTT);
+ sub->addSeparator();
+ sub->addItem(L"Profiler", DEBUG_PROFILER);
if (UserConfigParams::m_profiler_enabled)
- mnu->addItem(L"Save profiler report",
- DEBUG_PROFILER_WRITE_REPORT);
- mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS);
- mnu->addItem(L"Toggle FPS", DEBUG_FPS);
- mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY);
- mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY);
- mnu->addItem(L"Print position", DEBUG_PRINT_START_POS);
- mnu->addItem(L"Adjust Lights", DEBUG_ADJUST_LIGHTS);
- mnu->addItem(L"Scripting console", DEBUG_SCRIPT_CONSOLE);
- mnu->addItem(L"Run cutscene(s)", DEBUG_RUN_CUTSCENE);
- mnu->addItem(L"Texture console", DEBUG_TEXTURE_CONSOLE);
- mnu->addItem(L"Network debugging", DEBUG_RENDER_NW_DEBUG);
+ {
+ sub->addItem(L"Save profiler report", DEBUG_PROFILER_WRITE_REPORT);
+ }
+
+ mnu->addItem(L"Recording >",-1,true, true);
+ sub = mnu->getSubMenu(9);
+
+#ifdef ENABLE_RECORDER
+ sub->addItem(L"Start recording (Ctrl + Print Screen)", DEBUG_START_RECORDING);
+ sub->addItem(L"Stop recording (Ctrl + Print Screen)", DEBUG_STOP_RECORDING);
+#else
+ sub->addItem(L"Recording unavailable, STK was compiled without\n"
+ "recording support. Please re-compile STK with\n"
+ "libopenglrecorder to enable recording. If you got\n"
+ "SuperTuxKart from your distribution's repositories,\n"
+ "please use the official binaries, or contact your\n"
+ "distributions's package mantainer.");
+#endif
+
+ mnu->addItem(L"Consoles >",-1,true, true);
+ sub = mnu->getSubMenu(10);
+ sub->addItem(L"Run cutscene(s) (Shift + F7)", DEBUG_RUN_CUTSCENE);
+ sub->addItem(L"Scripting console (Shift + F8)", DEBUG_SCRIPT_CONSOLE);
+ sub->addItem(L"Texture console (Shift + F9)", DEBUG_TEXTURE_CONSOLE);
+
+ mnu->addItem(L"Font >",-1,true, true);
+ sub = mnu->getSubMenu(11);
+ sub->addItem(L"Dump glyph pages of fonts", DEBUG_FONT_DUMP_GLYPH_PAGE);
+ sub->addItem(L"Reload all fonts", DEBUG_FONT_RELOAD);
+
+ mnu->addItem(L"Lighting >",-1,true, true);
+ sub = mnu->getSubMenu(12);
+ sub->addItem(L"Adjust values (Shift + ~)", DEBUG_VISUAL_VALUES);
+ sub->addItem(L"Adjust lights (Ctrl + ~)", DEBUG_ADJUST_LIGHTS);
+
+ mnu->addItem(L"FPS >",-1,true, true);
+ sub = mnu->getSubMenu(13);
+ sub->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS);
+ sub->addItem(L"Toggle FPS (F12)", DEBUG_FPS);
+
+ mnu->addItem(L"Debug keys (~)", DEBUG_HELP);
+
g_debug_menu_visible = true;
irr_driver->showPointer();
}
@@ -1036,72 +1353,336 @@ bool onEvent(const SEvent &event)
return false;
}
}
-
+
// continue event handling if menu is not opened
- return !g_debug_menu_visible;
+ return !g_debug_menu_visible;
} // onEvent
// ----------------------------------------------------------------------------
-bool handleStaticAction(int key)
+void handleStaticAction(int key, int value, bool control_pressed, bool shift_pressed)
{
- Camera* camera = Camera::getActiveCamera();
- unsigned int kart_num = 0;
- if (camera != NULL && camera->getKart() != NULL)
+ World* world = World::getWorld();
+ CameraFPS *cam = dynamic_cast(Camera::getActiveCamera());
+
+ if (value)
{
- kart_num = camera->getKart()->getWorldKartId();
+ switch (key)
+ {
+ case IRR_KEY_OEM_3:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_ADJUST_LIGHTS);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_VISUAL_VALUES);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_HELP);
+ }
+ break;
+ }
+ // Function key actions
+ case IRR_KEY_F1:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_NORMAL);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_BOMB);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_ANVIL);
+ }
+ break;
+ }
+ case IRR_KEY_F2:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_FREE);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_ANVIL);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_RUBBERBALL);
+ }
+ break;
+ }
+ case IRR_KEY_F3:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_TOP);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_PARACHUTE);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_BOWLING);
+ }
+ break;
+ }
+ case IRR_KEY_F4:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_WHEEL);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_SQUASH);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_BUBBLEGUM);
+ }
+ break;
+ }
+ case IRR_KEY_F5:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_BEHIND_KART);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_PLUNGER);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_CAKE);
+ }
+ break;
+ }
+ case IRR_KEY_F6:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_SIDE_OF_KART);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_ATTACHMENT_EXPLOSION);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_PARACHUTE);
+ }
+ break;
+ }
+ case IRR_KEY_F7:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_INV_SIDE_OF_KART);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_SCRIPT_CONSOLE);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_PLUNGER);
+ }
+ break;
+ }
+ case IRR_KEY_F8:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_CAM_FRONT_OF_KART);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_TEXTURE_CONSOLE);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_SWATTER);
+ }
+ break;
+ }
+ case IRR_KEY_F9:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_VIEW_KART_SLIDER);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_RUN_CUTSCENE);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_SWITCH);
+ }
+ break;
+ }
+ case IRR_KEY_F10:
+ {
+ if (control_pressed)
+ {
+ handleContextMenuAction(DEBUG_POWERUP_SLIDER);
+ }
+ else if (shift_pressed)
+ {
+ handleContextMenuAction(DEBUG_GUI_TOGGLE);
+ }
+ else
+ {
+ handleContextMenuAction(DEBUG_POWERUP_ZIPPER);
+ }
+ break;
+ }
+ case IRR_KEY_INSERT:
+ {
+ handleContextMenuAction(DEBUG_POWERUP_NITRO);
+ break;
+ }
+ case IRR_KEY_DELETE:
+ {
+ handleContextMenuAction(DEBUG_POWERUP_NOTHING);
+ handleContextMenuAction(DEBUG_ATTACHMENT_NOTHING);
+ handleContextMenuAction(DEBUG_NITRO_CLEAR);
+ break;
+ }
+ case IRR_KEY_HOME:
+ {
+ handleContextMenuAction(DEBUG_VIEW_KART_ONE);
+ break;
+ }
+ case IRR_KEY_END:
+ {
+ handleContextMenuAction(DEBUG_VIEW_KART_LAST);
+ break;
+ }
+ case IRR_KEY_NEXT:
+ {
+ handleContextMenuAction(DEBUG_VIEW_KART_NEXT);
+ break;
+ }
+ case IRR_KEY_PRIOR:
+ {
+ handleContextMenuAction(DEBUG_VIEW_KART_PREVIOUS);
+ break;
+ }
+ default : break;
+ }
}
- if (key == IRR_KEY_F1)
+ switch (key)
{
- handleContextMenuAction(DEBUG_GUI_CAM_FREE);
- }
- else if (key == IRR_KEY_F2)
- {
- handleContextMenuAction(DEBUG_GUI_CAM_NORMAL);
- }
- else if (key == IRR_KEY_F3)
- {
-#ifndef SERVER_ONLY
- SP::SPTextureManager::get()->reloadTexture("");
-#endif
- return true;
- }
- else if (key == IRR_KEY_F5)
- {
- if (kart_num == 0)
+ // Flying up and down
+ case IRR_KEY_I:
{
- kart_num += World::getWorld()->getNumKarts() - 1;
- }
- else
- {
- kart_num--;
- }
- Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
- return true;
- }
- else if (key == IRR_KEY_F6)
- {
- if (kart_num == World::getWorld()->getNumKarts() - 1)
- {
- kart_num = 0;
- }
- else
- {
- kart_num++;
- }
- Camera::getActiveCamera()->setKart(World::getWorld()->getKart(kart_num));
- return true;
- }
- else if (key == IRR_KEY_F7)
- {
- bool prev_val = UserConfigParams::m_soccer_player_list;
- UserConfigParams::m_soccer_player_list = !prev_val;
- return true;
- }
- // TODO: create more keyboard shortcuts
+ AbstractKart* kart = world->getLocalPlayerKart(0);
+ if (kart == NULL) break;
- return false;
+ kart->flyUp();
+ break;
+ }
+ case IRR_KEY_K:
+ {
+ AbstractKart* kart = world->getLocalPlayerKart(0);
+ if (kart == NULL) break;
+
+ kart->flyDown();
+ break;
+ }
+ // Moving the first person camera
+ case IRR_KEY_W:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.Z = value ? cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ case IRR_KEY_S:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.Z = value ? -cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ case IRR_KEY_D:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.X = value ? -cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ case IRR_KEY_A:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.X = value ? cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ case IRR_KEY_E:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.Y = value ? cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ case IRR_KEY_Q:
+ {
+ if (cam)
+ {
+ core::vector3df vel(cam->getLinearVelocity());
+ vel.Y = value ? -cam->getMaximumVelocity() : 0;
+ cam->setLinearVelocity(vel);
+ }
+ break;
+ }
+ // Rotating the first person camera
+ case IRR_KEY_R:
+ {
+ if (cam)
+ {
+ cam->setAngularVelocity(value ?
+ UserConfigParams::m_fpscam_max_angular_velocity : 0.0f);
+ }
+ break;
+ }
+ case IRR_KEY_F:
+ {
+ if (cam)
+ {
+ cam->setAngularVelocity(value ?
+ -UserConfigParams::m_fpscam_max_angular_velocity : 0);
+ }
+ break;
+ }
+ default : break;
+ }
}
// ----------------------------------------------------------------------------
diff --git a/src/utils/debug.hpp b/src/utils/debug.hpp
index 03b99f6fd..aa9fd0690 100644
--- a/src/utils/debug.hpp
+++ b/src/utils/debug.hpp
@@ -28,7 +28,8 @@ namespace Debug
bool onEvent(const irr::SEvent &event);
bool isOpen();
void closeDebugMenu();
- bool handleStaticAction(int key);
+ void handleStaticAction(int key, int value,
+ bool control_pressed, bool shift_pressed);
}