diff --git a/src/guiengine/abstract_state_manager.cpp b/src/guiengine/abstract_state_manager.cpp index 5fabb71be..724a8b4a5 100644 --- a/src/guiengine/abstract_state_manager.cpp +++ b/src/guiengine/abstract_state_manager.cpp @@ -20,11 +20,9 @@ #include -#include "audio/sfx_manager.hpp" #include "guiengine/engine.hpp" #include "guiengine/screen.hpp" #include "input/device_manager.hpp" -#include "input/input_manager.hpp" using namespace GUIEngine; @@ -49,8 +47,6 @@ void AbstractStateManager::enterGameState() setGameState(GAME); GUIEngine::cleanForGame(); - //FIXME: this probably doesn't belong in the *abstract* state manager - input_manager->setMode(InputManager::INGAME); } // ----------------------------------------------------------------------------- @@ -90,7 +86,6 @@ void AbstractStateManager::pushMenu(std::string name) // Send tear-down event to previous menu if (m_menu_stack.size() > 0 && m_game_mode != GAME) getCurrentScreen()->tearDown(); - input_manager->setMode(InputManager::MENU); m_menu_stack.push_back(name); if (m_game_mode == GAME) { @@ -173,9 +168,6 @@ void AbstractStateManager::popMenu() setGameState(GAME); GUIEngine::cleanForGame(); - - //FIXME: this doesn't go in the *abstract* state manager - input_manager->setMode(InputManager::INGAME); } else { @@ -196,16 +188,10 @@ void AbstractStateManager::resetAndGoToScreen(Screen* screen) if (m_game_mode != GAME) getCurrentScreen()->tearDown(); m_menu_stack.clear(); - - //FIXME: this doesn't go in the *abstract* state manager - input_manager->setMode(InputManager::MENU); m_menu_stack.push_back(name); setGameState(MENU); - //FIXME: this doesn't go in the *abstract* state manager - sfx_manager->positionListener( Vec3(0,0,0), Vec3(0,1,0) ); - switchToScreen(name.c_str()); getCurrentScreen()->init(); } @@ -217,9 +203,6 @@ void AbstractStateManager::resetAndSetStack(Screen* screens[]) assert(screens != NULL); assert(screens[0] != NULL); - //FIXME: this doesn't go in the *abstract* state manager - input_manager->setMode(InputManager::MENU); - if (m_game_mode != GAME) getCurrentScreen()->tearDown(); m_menu_stack.clear(); @@ -230,9 +213,6 @@ void AbstractStateManager::resetAndSetStack(Screen* screens[]) setGameState(MENU); - //FIXME: this doesn't go in the *abstract* state manager - sfx_manager->positionListener( Vec3(0,0,0), Vec3(0,1,0) ); - switchToScreen(m_menu_stack[m_menu_stack.size()-1].c_str()); getCurrentScreen()->init(); } diff --git a/src/states_screens/state_manager.cpp b/src/states_screens/state_manager.cpp index 51a7c587e..c063a436f 100644 --- a/src/states_screens/state_manager.cpp +++ b/src/states_screens/state_manager.cpp @@ -18,6 +18,7 @@ #include "states_screens/state_manager.hpp" +#include "audio/sfx_manager.hpp" #include "audio/music_manager.hpp" #include "config/stk_config.hpp" #include "guiengine/engine.hpp" @@ -181,7 +182,8 @@ void StateManager::onGameStateChange(GameState previousState, GameState newState if (newState == GAME) { irr_driver->hidePointer(); - + input_manager->setMode(InputManager::INGAME); + if (previousState == INGAME_MENU) { // unpause the world @@ -191,6 +193,8 @@ void StateManager::onGameStateChange(GameState previousState, GameState newState else // menu (including in-game menu) { irr_driver->showPointer(); + input_manager->setMode(InputManager::MENU); + sfx_manager->positionListener( Vec3(0,0,0), Vec3(0,1,0) ); if (newState == MENU) {