Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 11:53:04 PM (15 years ago)
Author:
rgrieder
Message:
  • Started working on cleaning up the GameState mess ;)
  • Cleaned out GUIManager
  • Renamed GSGUI to GSMainMenu
  • "—state blah" has been changed to —server, —client, —standalone, —dedicated
  • —console starts the game in the console (no level loading there yet, but "loadMenu")
  • adjusted run scripts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r2848 r2850  
    4444{
    4545    AddGameState(GSRoot, "root");
    46     SetCommandLineSwitch(startWithConsole);
     46    SetCommandLineSwitch(console);
     47    // Shortcuts for easy direct loading
     48    SetCommandLineSwitch(server);
     49    SetCommandLineSwitch(client);
     50    SetCommandLineSwitch(dedicated);
     51    SetCommandLineSwitch(standalone);
    4752
    4853    GSRoot::GSRoot(const std::string& name)
     
    6368    {
    6469        // reset game speed to normal
    65         timeFactor_ = 1.0f;
     70        this->timeFactor_ = 1.0f;
    6671
    6772        {
     
    8186        }
    8287
     88        // Load level directly?
     89        bool loadLevel = false;
     90        if (CommandLine::getValue("standalone").getBool())
     91        {
     92            Game::getInstance().requestStates("graphics, standalone, level");
     93            loadLevel = true;
     94        }
     95        if (CommandLine::getValue("server").getBool())
     96        {
     97            Game::getInstance().requestStates("graphics, server, level");
     98            loadLevel = true;
     99        }
     100        if (CommandLine::getValue("client").getBool())
     101        {
     102            Game::getInstance().requestStates("graphics, standalone, level");
     103            loadLevel = true;
     104        }
     105        if (CommandLine::getValue("dedicated").getBool())
     106        {
     107            Game::getInstance().requestStates("dedicated, level");
     108            loadLevel = true;
     109        }
     110       
    83111        // Determine where to start
    84         if (CommandLine::getValue("startWithConsole").getBool())
    85         {
    86             // Start the game in the console
    87             Game::getInstance().requestState("ioConsole");
    88         }
    89         else
    90         {
    91             // Start in GUI main menu
    92             Game::getInstance().requestState("graphics");
    93             Game::getInstance().requestState("mainMenu");
    94         }
    95 
     112        if (!loadLevel)
     113        {
     114            if (CommandLine::getValue("console").getBool())
     115            {
     116                // Start the game in the console without 3D graphics
     117                Game::getInstance().requestState("ioConsole");
     118            }
     119            else
     120            {
     121                // Start in GUI mode
     122                Game::getInstance().requestStates("graphics, mainMenu");
     123            }
     124        }
    96125    }
    97126
     
    113142    void GSRoot::update(const Clock& time)
    114143    {
     144        if (this->getActivity().topState)
     145        {
     146            // This state can not 'survive' on its own.
     147            // Load a user interface therefore
     148            Game::getInstance().requestState("ioConsole");
     149        }
     150
    115151        uint64_t timeBeforeTick = time.getRealMicroseconds();
    116152
     
    132168        uint64_t timeAfterTick = time.getRealMicroseconds();
    133169
    134         // Also add our tick time to the list in GSRoot
     170        // Also add our tick time
    135171        Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
    136172    }
Note: See TracChangeset for help on using the changeset viewer.