bool handleContextMenuAction(s32 cmd_id) { World *world = World::getWorld(); Physics *physics = world ? world->getPhysics() : NULL; switch(cmd_id) { case DEBUG_GRAPHICS_RELOAD_SHADERS: Log::info("Debug", "Reloading shaders..."); ShaderBase::updateShaders(); break; case DEBUG_GRAPHICS_RESET: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); break; case DEBUG_GRAPHICS_WIREFRAME: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleWireframe(); break; case DEBUG_GRAPHICS_MIPMAP_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleMipVisualization(); break; case DEBUG_GRAPHICS_NORMALS_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleNormals(); break; case DEBUG_GRAPHICS_SSAO_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleSSAOViz(); break; case DEBUG_GRAPHICS_RSM_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleRSM(); break; case DEBUG_GRAPHICS_RH_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleRH(); break; case DEBUG_GRAPHICS_GI_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleGI(); break; case DEBUG_GRAPHICS_SHADOW_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleShadowViz(); break; case DEBUG_GRAPHICS_LIGHT_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleLightViz(); break; case DEBUG_GRAPHICS_DISTORT_VIZ: if (physics) physics->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleDistortViz(); break; case DEBUG_GRAPHICS_BULLET_1: irr_driver->resetDebugModes(); if (!world) return false; physics->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS); break; case DEBUG_GRAPHICS_BULLET_2: { irr_driver->resetDebugModes(); if (!world) return false; Physics *physics = world->getPhysics(); physics->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS); break; } case DEBUG_GRAPHICS_BOUNDING_BOXES_VIZ: irr_driver->resetDebugModes(); irr_driver->toggleBoundingBoxesViz(); break; case DEBUG_PROFILER: UserConfigParams::m_profiler_enabled = !UserConfigParams::m_profiler_enabled; break; case DEBUG_PROFILER_GENERATE_REPORT: profiler.setCaptureReport(!profiler.getCaptureReport()); break; case DEBUG_THROTTLE_FPS: main_loop->setThrottleFPS(false); break; case DEBUG_FONT_DUMP_GLYPH_PAGE: font_manager->getFont<BoldFace>()->dumpGlyphPage("bold"); font_manager->getFont<DigitFace>()->dumpGlyphPage("digit"); font_manager->getFont<RegularFace>()->dumpGlyphPage("regular"); case DEBUG_FONT_RELOAD: font_manager->getFont<BoldFace>()->reset(); font_manager->getFont<DigitFace>()->reset(); font_manager->getFont<RegularFace>()->reset(); break; case DEBUG_FPS: UserConfigParams::m_display_fps = !UserConfigParams::m_display_fps; break; case DEBUG_SAVE_REPLAY: ReplayRecorder::get()->save(); break; case DEBUG_SAVE_HISTORY: history->Save(); break; case DEBUG_POWERUP_BOWLING: addPowerup(PowerupManager::POWERUP_BOWLING); break; case DEBUG_POWERUP_BUBBLEGUM: addPowerup(PowerupManager::POWERUP_BUBBLEGUM); break; case DEBUG_POWERUP_CAKE: addPowerup(PowerupManager::POWERUP_CAKE); break; case DEBUG_POWERUP_PARACHUTE: addPowerup(PowerupManager::POWERUP_PARACHUTE); break; case DEBUG_POWERUP_PLUNGER: addPowerup(PowerupManager::POWERUP_PLUNGER); break; case DEBUG_POWERUP_RUBBERBALL: addPowerup(PowerupManager::POWERUP_RUBBERBALL); break; case DEBUG_POWERUP_SWATTER: addPowerup(PowerupManager::POWERUP_SWATTER); break; case DEBUG_POWERUP_SWITCH: addPowerup(PowerupManager::POWERUP_SWITCH); break; case DEBUG_POWERUP_ZIPPER: addPowerup(PowerupManager::POWERUP_ZIPPER); break; case DEBUG_POWERUP_NITRO: { if (!world) return false; const unsigned int num_local_players = race_manager->getNumLocalPlayers(); for (unsigned int i = 0; i < num_local_players; i++) { AbstractKart* kart = world->getLocalPlayerKart(i); kart->setEnergy(100.0f); } break; } case DEBUG_ATTACHMENT_ANVIL: addAttachment(Attachment::ATTACH_ANVIL); break; case DEBUG_ATTACHMENT_BOMB: addAttachment(Attachment::ATTACH_BOMB); break; case DEBUG_ATTACHMENT_PARACHUTE: addAttachment(Attachment::ATTACH_PARACHUTE); break; case DEBUG_GUI_TOGGLE: { if (!world) return false; RaceGUIBase* gui = world->getRaceGUI(); if (gui != NULL) gui->m_enabled = !gui->m_enabled; break; } case DEBUG_GUI_HIDE_KARTS: if (!world) return false; for (unsigned int n = 0; n<world->getNumKarts(); n++) { AbstractKart* kart = world->getKart(n); if (kart->getController()->isPlayerController()) kart->getNode()->setVisible(false); } break; case DEBUG_GUI_CAM_TOP: CameraDebug::setDebugType(CameraDebug::CM_DEBUG_TOP_OF_KART); Camera::changeCamera(0, Camera::CM_TYPE_DEBUG); 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); irr_driver->getDevice()->getCursorControl()->setVisible(true); break; case DEBUG_GUI_CAM_BEHIND_KART: CameraDebug::setDebugType(CameraDebug::CM_DEBUG_BEHIND_KART); Camera::changeCamera(0, Camera::CM_TYPE_DEBUG); irr_driver->getDevice()->getCursorControl()->setVisible(true); break; case DEBUG_GUI_CAM_SIDE_OF_KART: CameraDebug::setDebugType(CameraDebug::CM_DEBUG_SIDE_OF_KART); Camera::changeCamera(0, Camera::CM_TYPE_DEBUG); irr_driver->getDevice()->getCursorControl()->setVisible(true); break; case DEBUG_GUI_CAM_FREE: { Camera *camera = Camera::getActiveCamera(); Camera::changeCamera(camera->getIndex(), Camera::CM_TYPE_FPS); irr_driver->getDevice()->getCursorControl()->setVisible(false); // Reset camera rotation CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera()); if(cam) { cam->setDirection(vector3df(0, 0, 1)); cam->setUpVector(vector3df(0, 1, 0)); } break; } case DEBUG_GUI_CAM_NORMAL: { Camera *camera = Camera::getActiveCamera(); Camera::changeCamera(camera->getIndex(), Camera::CM_TYPE_NORMAL); irr_driver->getDevice()->getCursorControl()->setVisible(true); break; } case DEBUG_GUI_CAM_SMOOTH: { CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera()); if(cam) { cam->setSmoothMovement(!cam->getSmoothMovement()); } break; } case DEBUG_GUI_CAM_ATTACH: { CameraFPS *cam = dynamic_cast<CameraFPS*>(Camera::getActiveCamera()); if(cam) { cam->setAttachedFpsCam(!cam->getAttachedFpsCam()); } break; } case DEBUG_VIEW_KART_ONE: changeCameraTarget(1); break; case DEBUG_VIEW_KART_TWO: changeCameraTarget(2); break; case DEBUG_VIEW_KART_THREE: changeCameraTarget(3); break; case DEBUG_VIEW_KART_FOUR: changeCameraTarget(4); break; case DEBUG_VIEW_KART_FIVE: changeCameraTarget(5); break; case DEBUG_VIEW_KART_SIX: changeCameraTarget(6); break; case DEBUG_VIEW_KART_SEVEN: changeCameraTarget(7); break; case DEBUG_VIEW_KART_EIGHT: changeCameraTarget(8); break; case DEBUG_PRINT_START_POS: if (!world) return false; for (unsigned int i = 0; i<world->getNumKarts(); i++) { AbstractKart *kart = world->getKart(i); Log::warn(kart->getIdent().c_str(), "<start position=\"%d\" x=\"%f\" y=\"%f\" z=\"%f\" h=\"%f\"/>", i, kart->getXYZ().getX(), kart->getXYZ().getY(), kart->getXYZ().getZ(), kart->getHeading()*RAD_TO_DEGREE ); } break; case DEBUG_VISUAL_VALUES: { #if !defined(__APPLE__) DebugSliderDialog *dsd = new DebugSliderDialog(); dsd->setSliderHook("red_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().r * 255.f); }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(0, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("green_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().g * 255.f); }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(1, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("blue_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().b * 255.f); }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(2, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("ssao_radius", 0, 100, [](){ return int(irr_driver->getSSAORadius() * 10.f); }, [](int v){irr_driver->setSSAORadius(v / 10.f); } ); dsd->setSliderHook("ssao_k", 0, 100, [](){ return int(irr_driver->getSSAOK() * 10.f); }, [](int v){irr_driver->setSSAOK(v / 10.f); } ); dsd->setSliderHook("ssao_sigma", 0, 100, [](){ return int(irr_driver->getSSAOSigma() * 10.f); }, [](int v){irr_driver->setSSAOSigma(v / 10.f); } ); #endif } break; case DEBUG_ADJUST_LIGHTS: { #if !defined(__APPLE__) // Some sliders use multipliers because the spinner widget // only supports integers DebugSliderDialog *dsd = new DebugSliderDialog(); dsd->changeLabel("Red", "Red (x10)"); dsd->setSliderHook("red_slider", 0, 100, []() { return int(findNearestLight()->getColor().X * 100); }, [](int intensity) { LightNode* nearest = findNearestLight(); core::vector3df color = nearest->getColor(); nearest->setColor(intensity / 100.0f, color.Y, color.Z); } ); dsd->changeLabel("Green", "Green (x10)"); dsd->setSliderHook("green_slider", 0, 100, []() { return int(findNearestLight()->getColor().Y * 100); }, [](int intensity) { LightNode* nearest = findNearestLight(); core::vector3df color = nearest->getColor(); nearest->setColor(color.X, intensity / 100.0f, color.Z); } ); dsd->changeLabel("Blue", "Blue (x10)"); dsd->setSliderHook("blue_slider", 0, 100, []() { return int(findNearestLight()->getColor().Z * 100); }, [](int intensity) { LightNode* nearest = findNearestLight(); core::vector3df color = nearest->getColor(); nearest->setColor(color.X, color.Y, intensity / 100.0f); } ); dsd->changeLabel("SSAO radius", "energy (x10)"); dsd->setSliderHook("ssao_radius", 0, 100, []() { return int(findNearestLight()->getEnergy() * 10); }, [](int v){ findNearestLight()->setEnergy(v / 10.0f); } ); dsd->changeLabel("SSAO k", "radius"); dsd->setSliderHook("ssao_k", 0, 100, []() { return int(findNearestLight()->getRadius()); }, [](int v){ findNearestLight()->setRadius(float(v)); } ); dsd->changeLabel("SSAO Sigma", "[None]"); #endif break; } case DEBUG_SCRIPT_CONSOLE: new ScriptingConsole(); break; } // switch return false; }
// ----------------------------------------------------------------------------- // Debug menu handling bool onEvent(const SEvent &event) { // Only activated in artist debug mode if(!UserConfigParams::m_artist_debug_mode) return true; // keep handling the events if(event.EventType == EET_MOUSE_INPUT_EVENT) { // Create the menu (only one menu at a time) if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && !g_debug_menu_visible) { // root menu gui::IGUIEnvironment* guienv = irr_driver->getGUI(); IGUIContextMenu* mnu = guienv->addContextMenu( core::rect<s32>(event.MouseInput.X, event.MouseInput.Y, event.MouseInput.Y+100, event.MouseInput.Y+100),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"Reset debug views", DEBUG_GRAPHICS_RESET ); sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME ); sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ ); sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ ); sub->addItem(L"SSAO viz", DEBUG_GRAPHICS_SSAO_VIZ ); sub->addItem(L"RSM viz", DEBUG_GRAPHICS_RSM_VIZ); sub->addItem(L"RH viz", DEBUG_GRAPHICS_RH_VIZ); sub->addItem(L"GI viz", DEBUG_GRAPHICS_GI_VIZ); sub->addItem(L"Shadow viz", DEBUG_GRAPHICS_SHADOW_VIZ ); sub->addItem(L"Light viz", DEBUG_GRAPHICS_LIGHT_VIZ ); sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ ); sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1); sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2); mnu->addItem(L"Items >",-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); mnu->addItem(L"Adjust values", DEBUG_VISUAL_VALUES); mnu->addItem(L"Profiler",DEBUG_PROFILER); if (UserConfigParams::m_profiler_enabled) mnu->addItem(L"Toggle capture profiler report", DEBUG_PROFILER_GENERATE_REPORT); mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS); mnu->addItem(L"FPS",DEBUG_FPS); mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY); mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY); mnu->addItem(L"Toggle GUI", DEBUG_TOGGLE_GUI); mnu->addItem(L"Hide karts", DEBUG_HIDE_KARTS); g_debug_menu_visible = true; irr_driver->showPointer(); } // Let Irrlicht handle the event while the menu is visible - otherwise in a race the GUI events won't be generated if(g_debug_menu_visible) return false; } if (event.EventType == EET_GUI_EVENT) { if (event.GUIEvent.Caller != NULL && event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU ) { IGUIContextMenu *menu = (IGUIContextMenu*)event.GUIEvent.Caller; s32 cmdID = menu->getItemCommandId(menu->getSelectedItem()); if(event.GUIEvent.EventType == EGET_ELEMENT_CLOSED) { g_debug_menu_visible = false; } if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED) { if(cmdID == DEBUG_GRAPHICS_RELOAD_SHADERS) { Log::info("Debug", "Reloading shaders..."); irr_driver->updateShaders(); } else if (cmdID == DEBUG_GRAPHICS_RESET) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); } else if (cmdID == DEBUG_GRAPHICS_WIREFRAME) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleWireframe(); } else if (cmdID == DEBUG_GRAPHICS_MIPMAP_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleMipVisualization(); } else if (cmdID == DEBUG_GRAPHICS_NORMALS_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleNormals(); } else if (cmdID == DEBUG_GRAPHICS_SSAO_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleSSAOViz(); } else if (cmdID == DEBUG_GRAPHICS_RSM_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleRSM(); } else if (cmdID == DEBUG_GRAPHICS_RH_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleRH(); } else if (cmdID == DEBUG_GRAPHICS_GI_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleGI(); } else if (cmdID == DEBUG_GRAPHICS_SHADOW_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleShadowViz(); } else if (cmdID == DEBUG_GRAPHICS_LIGHT_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleLightViz(); } else if (cmdID == DEBUG_GRAPHICS_DISTORT_VIZ) { World* world = World::getWorld(); if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE); irr_driver->resetDebugModes(); irr_driver->toggleDistortViz(); } else if (cmdID == DEBUG_GRAPHICS_BULLET_1) { irr_driver->resetDebugModes(); World* world = World::getWorld(); if (world == NULL) return false; world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS); } else if (cmdID == DEBUG_GRAPHICS_BULLET_2) { irr_driver->resetDebugModes(); World* world = World::getWorld(); if (world == NULL) return false; world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS); } else if (cmdID == DEBUG_PROFILER) { UserConfigParams::m_profiler_enabled = !UserConfigParams::m_profiler_enabled; } else if (cmdID == DEBUG_PROFILER_GENERATE_REPORT) { profiler.setCaptureReport(!profiler.getCaptureReport()); } else if (cmdID == DEBUG_THROTTLE_FPS) { main_loop->setThrottleFPS(false); } else if (cmdID == DEBUG_FPS) { UserConfigParams::m_display_fps = !UserConfigParams::m_display_fps; } else if (cmdID == DEBUG_SAVE_REPLAY) { ReplayRecorder::get()->Save(); } else if (cmdID == DEBUG_SAVE_HISTORY) { history->Save(); } else if (cmdID == DEBUG_POWERUP_BOWLING) { addPowerup(PowerupManager::POWERUP_BOWLING); } else if (cmdID == DEBUG_POWERUP_BUBBLEGUM) { addPowerup(PowerupManager::POWERUP_BUBBLEGUM); } else if (cmdID == DEBUG_POWERUP_CAKE) { addPowerup(PowerupManager::POWERUP_CAKE); } else if (cmdID == DEBUG_POWERUP_PARACHUTE) { addPowerup(PowerupManager::POWERUP_PARACHUTE); } else if (cmdID == DEBUG_POWERUP_PLUNGER) { addPowerup(PowerupManager::POWERUP_PLUNGER); } else if (cmdID == DEBUG_POWERUP_RUBBERBALL) { addPowerup(PowerupManager::POWERUP_RUBBERBALL); } else if (cmdID == DEBUG_POWERUP_SWATTER) { addPowerup(PowerupManager::POWERUP_SWATTER); } else if (cmdID == DEBUG_POWERUP_SWITCH) { addPowerup(PowerupManager::POWERUP_SWITCH); } else if (cmdID == DEBUG_POWERUP_ZIPPER) { addPowerup(PowerupManager::POWERUP_ZIPPER); } else if (cmdID == DEBUG_POWERUP_NITRO) { World* world = World::getWorld(); if (world == NULL) return false; for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++) { AbstractKart* kart = world->getLocalPlayerKart(i); kart->setEnergy(100.0f); } } else if (cmdID == DEBUG_ATTACHMENT_ANVIL) { addAttachment(Attachment::ATTACH_ANVIL); } else if (cmdID == DEBUG_ATTACHMENT_BOMB) { addAttachment(Attachment::ATTACH_BOMB); } else if (cmdID == DEBUG_ATTACHMENT_PARACHUTE) { addAttachment(Attachment::ATTACH_PARACHUTE); } else if (cmdID == DEBUG_TOGGLE_GUI) { World* world = World::getWorld(); if (world == NULL) return false; RaceGUIBase* gui = world->getRaceGUI(); if (gui != NULL) gui->m_enabled = !gui->m_enabled; } else if (cmdID == DEBUG_HIDE_KARTS) { World* world = World::getWorld(); if (world == NULL) return false; const int count = World::getWorld()->getNumKarts(); for (int n = 0; n<count; n++) { AbstractKart* kart = world->getKart(n); if (kart->getController()->isPlayerController()) kart->getNode()->setVisible(false); } } else if (cmdID == DEBUG_VISUAL_VALUES) { #if !defined(__APPLE__) DebugSliderDialog *dsd = new DebugSliderDialog(); dsd->setSliderHook( "red_slider", 0, 255, [](){ return irr_driver->getAmbientLight().r * 255.f; }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(0, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("green_slider", 0, 255, [](){ return irr_driver->getAmbientLight().g * 255.f; }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(1, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("blue_slider", 0, 255, [](){ return irr_driver->getAmbientLight().b * 255.f; }, [](int v){ video::SColorf ambient = irr_driver->getAmbientLight(); ambient.setColorComponentValue(2, v / 255.f); irr_driver->setAmbientLight(ambient); } ); dsd->setSliderHook("ssao_radius", 0, 100, [](){ return irr_driver->getSSAORadius() * 10.f; }, [](int v){irr_driver->setSSAORadius(v / 10.f); } ); dsd->setSliderHook("ssao_k", 0, 100, [](){ return irr_driver->getSSAOK() * 10.f; }, [](int v){irr_driver->setSSAOK(v / 10.f); } ); dsd->setSliderHook("ssao_sigma", 0, 100, [](){ return irr_driver->getSSAOSigma() * 10.f; }, [](int v){irr_driver->setSSAOSigma(v / 10.f); } ); #endif } } return false; // event has been handled } } return true; // continue event handling }