Changeset 7876 for code/trunk/src/orxonox/gamestates/GSMainMenu.cc
- Timestamp:
- Feb 13, 2011, 5:49:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r7854 r7876 31 31 #include <OgreSceneManager.h> 32 32 33 #include "core/input/KeyBinderManager.h"34 #include "core/Game.h"35 33 #include "core/ConfigValueIncludes.h" 36 34 #include "core/CoreIncludes.h" 35 #include "core/Game.h" 37 36 #include "core/GraphicsManager.h" 38 37 #include "core/GUIManager.h" 39 38 #include "core/command/ConsoleCommand.h" 39 #include "core/input/KeyBinderManager.h" 40 #include "network/Client.h" 41 #include "util/StringUtils.h" 42 #include "LevelManager.h" 40 43 #include "Scene.h" 41 44 #include "sound/AmbientSound.h" … … 52 55 static const std::string __CC_startClient_name = "startClient"; 53 56 static const std::string __CC_startDedicated_name = "startDedicated"; 54 static const std::string __CC_startMainMenu_name = "startMainMenu";55 57 static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath"; 56 58 57 SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).deactivate(); 58 SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).deactivate(); 59 SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).deactivate(); 60 SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).deactivate(); 61 SetConsoleCommand(__CC_startMainMenu_name, &GSMainMenu::startMainMenu ).deactivate(); 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(); 62 63 SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide(); 63 64 … … 106 107 ModifyConsoleCommand(__CC_startClient_name ).activate(); 107 108 ModifyConsoleCommand(__CC_startDedicated_name ).activate(); 108 ModifyConsoleCommand(__CC_startMainMenu_name ).activate();109 109 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(this); 110 110 … … 138 138 ModifyConsoleCommand(__CC_startClient_name ).deactivate(); 139 139 ModifyConsoleCommand(__CC_startDedicated_name ).deactivate(); 140 ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate();141 140 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0); 142 141 } … … 171 170 } 172 171 173 void GSMainMenu::startStandalone() 174 { 175 // HACK - HACK 172 /** 173 @brief 174 Start a level in standalone mode. 175 @param level 176 The filename of the level to be started. If empty, the default level is started. 177 */ 178 void GSMainMenu::startStandalone(const std::string& level) 179 { 180 if(level != BLANKSTRING) 181 LevelManager::getInstance().setDefaultLevel(level); 182 183 // HACK 176 184 Game::getInstance().popState(); 177 185 Game::getInstance().requestStates("standalone, level"); 178 186 } 179 187 180 void GSMainMenu::startServer() 181 { 182 // HACK - HACK 188 /** 189 @brief 190 Start a level in server mode. 191 @param level 192 The filename of the level to be started. If empty, the default level is started. 193 */ 194 void GSMainMenu::startServer(const std::string& level) 195 { 196 if(level != BLANKSTRING) 197 LevelManager::getInstance().setDefaultLevel(level); 198 199 // HACK 183 200 Game::getInstance().popState(); 184 201 Game::getInstance().requestStates("server, level"); 185 202 } 186 203 187 void GSMainMenu::startClient() 188 { 189 // HACK - HACK 204 /** 205 @brief 206 Connect to a game as client. 207 @param destination 208 The destination to connect to. If empty, the client connects to the default destination. 209 */ 210 void GSMainMenu::startClient(const std::string& destination) 211 { 212 if(destination != BLANKSTRING) 213 Client::getInstance()->setDestination(destination, NETWORK_PORT); 214 215 // HACK 190 216 Game::getInstance().popState(); 191 217 Game::getInstance().requestStates("client, level"); 192 218 } 193 219 194 void GSMainMenu::startDedicated() 195 { 196 // HACK - HACK 220 /** 221 @brief 222 Start a level in dedicated mode. 223 @param level 224 The filename of the level to be started. If empty, the default level is started. 225 */ 226 void GSMainMenu::startDedicated(const std::string& level) 227 { 228 if(level != BLANKSTRING) 229 LevelManager::getInstance().setDefaultLevel(level); 230 231 // HACK 197 232 Game::getInstance().popState(); 198 233 Game::getInstance().popState(); 199 234 Game::getInstance().requestStates("server, level"); 200 235 } 201 void GSMainMenu::startMainMenu() 202 { 203 // HACK - HACK 204 Game::getInstance().popState(); 205 Game::getInstance().popState(); 206 Game::getInstance().requestStates("mainmenu"); 207 } 236 208 237 }
Note: See TracChangeset
for help on using the changeset viewer.