Changeset 8079 for code/trunk/src/orxonox/gamestates
- Timestamp:
- Mar 15, 2011, 9:47:11 PM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSLevel.cc
r7879 r8079 46 46 #include "LevelManager.h" 47 47 #include "PlayerManager.h" 48 #include "GSRoot.h" 48 49 49 50 namespace orxonox … … 55 56 56 57 SetConsoleCommand(__CC_startMainMenu_name, &GSLevel::startMainMenu).deactivate(); 57 SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues( BLANKSTRING).deactivate();58 SetConsoleCommand(__CC_changeGame_name, &GSLevel::changeGame).defaultValues("").deactivate(); 58 59 59 60 GSLevel::GSLevel(const GameStateInfo& info) … … 156 157 COUT(0) << "Loading level..." << std::endl; 157 158 startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel()); 158 Loader::open(startFile_);159 bool loaded = Loader::open(startFile_); 159 160 160 161 Core::getInstance().updateLastLevelTimestamp(); 162 if(!loaded) 163 GSRoot::delayedStartMainMenu(); 161 164 } 162 165 … … 202 205 /*static*/ void GSLevel::changeGame(const std::string& level) 203 206 { 204 if(level != BLANKSTRING)207 if(level != "") 205 208 LevelManager::getInstance().setDefaultLevel(level); 206 209 -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r7876 r8079 57 57 static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath"; 58 58 59 SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).defaultValues( BLANKSTRING).deactivate();60 SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).defaultValues( BLANKSTRING).deactivate();61 SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).defaultValues( BLANKSTRING).deactivate();62 SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).defaultValues( BLANKSTRING).deactivate();59 SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).defaultValues("").deactivate(); 60 SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).defaultValues("").deactivate(); 61 SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).defaultValues("").deactivate(); 62 SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).defaultValues("").deactivate(); 63 63 SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide(); 64 64 … … 96 96 { 97 97 // show main menu 98 GraphicsManager::getInstance().setCamera(this->camera_); 98 99 GUIManager::getInstance().showGUI("MainMenu", true); 99 GUIManager::getInstance().setCamera(this->camera_);100 100 GUIManager::getInstance().setBackgroundImage("MainMenuBackground", "Background"); 101 GraphicsManager::getInstance().setCamera(this->camera_);102 101 103 102 InputManager::getInstance().enterState("MainMenuHackery"); … … 129 128 InputManager::getInstance().leaveState("MainMenuHackery"); 130 129 131 G UIManager::getInstance().setCamera(0);130 GraphicsManager::getInstance().setCamera(0); 132 131 GUIManager::getInstance().setBackgroundImage(""); 133 132 GUIManager::hideGUI("MainMenu"); 134 GraphicsManager::getInstance().setCamera(0);135 133 136 134 ModifyConsoleCommand(__CC_startStandalone_name).deactivate(); … … 178 176 void GSMainMenu::startStandalone(const std::string& level) 179 177 { 180 if(level != BLANKSTRING)178 if(level != "") 181 179 LevelManager::getInstance().setDefaultLevel(level); 182 180 … … 194 192 void GSMainMenu::startServer(const std::string& level) 195 193 { 196 if(level != BLANKSTRING)194 if(level != "") 197 195 LevelManager::getInstance().setDefaultLevel(level); 198 196 … … 210 208 void GSMainMenu::startClient(const std::string& destination) 211 209 { 212 if(destination != BLANKSTRING)210 if(destination != "") 213 211 Client::getInstance()->setDestination(destination, NETWORK_PORT); 214 212 … … 226 224 void GSMainMenu::startDedicated(const std::string& level) 227 225 { 228 if(level != BLANKSTRING)226 if(level != "") 229 227 LevelManager::getInstance().setDefaultLevel(level); 230 228 -
code/trunk/src/orxonox/gamestates/GSMainMenu.h
r7876 r8079 53 53 void setMainMenuSoundPath(const std::string& path); 54 54 55 static void startStandalone(const std::string& level = BLANKSTRING); //!< Start a level in standalone mode.56 static void startServer(const std::string& level = BLANKSTRING); //!< Start a level in server mode.57 static void startClient(const std::string& destination = BLANKSTRING); //!< Connect to a game as client.58 static void startDedicated(const std::string& level = BLANKSTRING); //!< Start a level in dedicated mode.55 static void startStandalone(const std::string& level = ""); //!< Start a level in standalone mode. 56 static void startServer(const std::string& level = ""); //!< Start a level in server mode. 57 static void startClient(const std::string& destination = ""); //!< Connect to a game as client. 58 static void startDedicated(const std::string& level = ""); //!< Start a level in dedicated mode. 59 59 static void startIOConsole(); 60 60 -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r7284 r8079 38 38 #include "tools/interfaces/Tickable.h" 39 39 40 #include "GSLevel.h" 41 40 42 namespace orxonox 41 43 { … … 43 45 44 46 static const std::string __CC_setTimeFactor_name = "setTimeFactor"; 47 static const std::string __CC_setPause_name = "setPause"; 45 48 static const std::string __CC_pause_name = "pause"; 49 50 /*static*/ bool GSRoot::startMainMenu_s = false; 46 51 47 52 SetConsoleCommand("printObjects", &GSRoot::printObjects).hide(); 48 53 SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0); 54 SetConsoleCommand(__CC_setPause_name, &GSRoot::setPause ).accessLevel(AccessLevel::Master).hide(); 49 55 SetConsoleCommand(__CC_pause_name, &GSRoot::pause ).accessLevel(AccessLevel::Master); 50 56 … … 83 89 84 90 ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this); 91 ModifyConsoleCommand(__CC_setPause_name).setObject(this); 85 92 ModifyConsoleCommand(__CC_pause_name).setObject(this); 86 93 } … … 89 96 { 90 97 ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0); 98 ModifyConsoleCommand(__CC_setPause_name).setObject(0); 91 99 ModifyConsoleCommand(__CC_pause_name).setObject(0); 92 100 } … … 94 102 void GSRoot::update(const Clock& time) 95 103 { 104 if(startMainMenu_s) 105 { 106 delayedStartMainMenu(); 107 startMainMenu_s = false; 108 } 109 96 110 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 97 111 { … … 157 171 } 158 172 173 void GSRoot::setPause(bool pause) 174 { 175 if (GameMode::isMaster()) 176 { 177 if (pause != this->bPaused_) 178 this->pause(); 179 } 180 } 181 159 182 void GSRoot::changedTimeFactor(float factor_new, float factor_old) 160 183 { … … 162 185 callStaticNetworkFunction(&TimeFactorListener::setTimeFactor, CLIENTID_UNKNOWN, factor_new); 163 186 } 187 188 /*static*/ void GSRoot::delayedStartMainMenu(void) 189 { 190 if(!startMainMenu_s) 191 startMainMenu_s = true; 192 else 193 GSLevel::startMainMenu(); 194 } 195 164 196 } -
code/trunk/src/orxonox/gamestates/GSRoot.h
r7172 r8079 51 51 // when taking the function address. 52 52 void setTimeFactor(float factor); 53 void setPause(bool pause); 53 54 void pause(); 55 56 static void delayedStartMainMenu(void); 54 57 55 58 protected: … … 59 62 bool bPaused_; 60 63 float timeFactorPauseBackup_; 64 static bool startMainMenu_s; 61 65 }; 62 66 }
Note: See TracChangeset
for help on using the changeset viewer.