Index: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 3370)
@@ -42,6 +42,6 @@
     SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#");
 
-    GSClient::GSClient(const GameStateConstrParams& params)
-        : GameState(params)
+    GSClient::GSClient(const GameStateInfo& info)
+        : GameState(info)
         , client_(0)
     {
Index: code/trunk/src/orxonox/gamestates/GSClient.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSClient.h	(revision 3370)
@@ -40,5 +40,5 @@
     {
     public:
-        GSClient(const GameStateConstrParams& params);
+        GSClient(const GameStateInfo& info);
         ~GSClient();
 
Index: code/trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3370)
@@ -55,6 +55,6 @@
     termios* GSDedicated::originalTerminalSettings_;
 
-    GSDedicated::GSDedicated(const GameStateConstrParams& params)
-        : GameState(params)
+    GSDedicated::GSDedicated(const GameStateInfo& info)
+        : GameState(info)
         , server_(0)
         , closeThread_(false)
Index: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3370)
@@ -48,5 +48,5 @@
     {
     public:
-        GSDedicated(const GameStateConstrParams& params);
+        GSDedicated(const GameStateInfo& info);
         ~GSDedicated();
 
Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 3370)
@@ -35,7 +35,4 @@
 #include "GSGraphics.h"
 
-#include <boost/filesystem.hpp>
-#include <OgreRenderWindow.h>
-
 #include "util/Convert.h"
 #include "core/Clock.h"
@@ -44,5 +41,5 @@
 #include "core/Core.h"
 #include "core/Game.h"
-#include "core/GameMode.h"
+#include "core/GUIManager.h"
 #include "core/input/InputManager.h"
 #include "core/input/KeyBinder.h"
@@ -51,18 +48,16 @@
 #include "core/XMLFile.h"
 #include "overlays/console/InGameConsole.h"
-#include "gui/GUIManager.h"
 #include "sound/SoundManager.h"
-#include "GraphicsManager.h"
+
+// HACK:
+#include "overlays/map/Map.h"
 
 namespace orxonox
 {
-    DeclareGameState(GSGraphics, "graphics", true, true);
+    DeclareGameState(GSGraphics, "graphics", false, true);
 
-    GSGraphics::GSGraphics(const GameStateConstrParams& params)
-        : GameState(params)
-        , inputManager_(0)
+    GSGraphics::GSGraphics(const GameStateInfo& info)
+        : GameState(info)
         , console_(0)
-        , guiManager_(0)
-        , graphicsManager_(0)
         , soundManager_(0)
         , masterKeyBinder_(0)
@@ -70,8 +65,14 @@
         , debugOverlay_(0)
     {
+        // load master key bindings
+        masterInputState_ = InputManager::getInstance().createInputState("master", true);
+        masterKeyBinder_ = new KeyBinder();
+        masterInputState_->setKeyHandler(masterKeyBinder_);
     }
 
     GSGraphics::~GSGraphics()
     {
+        InputManager::getInstance().destroyState("master");
+        delete this->masterKeyBinder_;
     }
 
@@ -93,27 +94,10 @@
     void GSGraphics::activate()
     {
-        GameMode::setShowsGraphics(true);
-
-        // Load OGRE including the render window
-        this->graphicsManager_ = new GraphicsManager();
-
         // load debug overlay
         COUT(3) << "Loading Debug Overlay..." << std::endl;
-        this->debugOverlay_ = new XMLFile((Core::getMediaPath() / "overlay" / "debug.oxo").string());
+        this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo");
         Loader::open(debugOverlay_);
 
-        // The render window width and height are used to set up the mouse movement.
-        size_t windowHnd = 0;
-        Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();
-        renderWindow->getCustomAttribute("WINDOW", &windowHnd);
-
-        // Calls the InputManager which sets up the input devices.
-        inputManager_ = new InputManager(windowHnd);
-
-        // load master key bindings
-        masterInputState_ = InputManager::getInstance().createInputState("master", true);
-        masterKeyBinder_ = new KeyBinder();
         masterKeyBinder_->loadBindings("masterKeybindings.ini");
-        masterInputState_->setKeyHandler(masterKeyBinder_);
 
         // Load the SoundManager
@@ -123,8 +107,4 @@
         console_ = new InGameConsole();
         console_->initialise();
-
-        // load the CEGUI interface
-        guiManager_ = new GUIManager();
-        guiManager_->initialise(renderWindow);
 
         // add console command to toggle GUI
@@ -154,9 +134,4 @@
 */
 
-        masterInputState_->setHandler(0);
-        InputManager::getInstance().destroyState("master");
-        delete this->masterKeyBinder_;
-
-        delete this->guiManager_;
         delete this->console_;
 
@@ -166,10 +141,6 @@
         delete this->soundManager_;
 
-        delete this->inputManager_;
-        this->inputManager_ = 0;
-
-        delete graphicsManager_;
-
-        GameMode::setShowsGraphics(false);
+        // HACK: (destroys a resource smart pointer)
+        Map::hackDestroyMap();
     }
 
@@ -203,18 +174,5 @@
         }
 
-        uint64_t timeBeforeTick = time.getRealMicroseconds();
-
-        this->inputManager_->update(time);
         this->console_->update(time);
-
-        uint64_t timeAfterTick = time.getRealMicroseconds();
-
-        // Also add our tick time
-        Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
-
-        // Process gui events
-        this->guiManager_->update(time);
-        // Render
-        this->graphicsManager_->update(time);
     }
 }
Index: code/trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 3370)
@@ -50,5 +50,5 @@
     {
     public:
-        GSGraphics(const GameStateConstrParams& params);
+        GSGraphics(const GameStateInfo& info);
         ~GSGraphics();
 
@@ -61,8 +61,5 @@
     private:
         // managed singletons
-        InputManager*         inputManager_;        //!< Reference to input management
         InGameConsole*        console_;
-        GUIManager*           guiManager_;          //!< Interface to GUI
-        GraphicsManager*      graphicsManager_;     //!< Interface to Ogre
         SoundManager*         soundManager_;        //!< Keeps track of SoundBase objects
 
Index: code/trunk/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 3370)
@@ -38,6 +38,6 @@
     DeclareGameState(GSIOConsole, "ioConsole", false, false);
 
-    GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
-        : GameState(params)
+    GSIOConsole::GSIOConsole(const GameStateInfo& info)
+        : GameState(info)
     {
     }
Index: code/trunk/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.h	(revision 3370)
@@ -38,5 +38,5 @@
     {
     public:
-        GSIOConsole(const GameStateConstrParams& params);
+        GSIOConsole(const GameStateInfo& info);
         ~GSIOConsole();
 
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 3370)
@@ -40,4 +40,6 @@
 #include "core/GameMode.h"
 #include "core/Core.h"
+#include "core/GraphicsManager.h"
+#include "core/GUIManager.h"
 #include "core/Loader.h"
 #include "core/XMLFile.h"
@@ -47,7 +49,5 @@
 #include "objects/quest/QuestManager.h"
 #include "overlays/notifications/NotificationManager.h"
-#include "gui/GUIManager.h"
 #include "CameraManager.h"
-#include "GraphicsManager.h"
 #include "LevelManager.h"
 #include "PlayerManager.h"
@@ -55,11 +55,11 @@
 namespace orxonox
 {
-    DeclareGameState(GSLevel, "level", false, true);
+    DeclareGameState(GSLevel, "level", false, false);
     SetConsoleCommand(GSLevel, showIngameGUI, true);
 
     XMLFile* GSLevel::startFile_s = NULL;
 
-    GSLevel::GSLevel(const GameStateConstrParams& params)
-        : GameState(params)
+    GSLevel::GSLevel(const GameStateInfo& info)
+        : GameState(info)
         , keyBinder_(0)
         , gameInputState_(0)
Index: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 3370)
@@ -41,5 +41,5 @@
     {
     public:
-        GSLevel(const GameStateConstrParams& params);
+        GSLevel(const GameStateInfo& info);
         ~GSLevel();
         void setConfigValues();
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 3370)
@@ -36,8 +36,8 @@
 #include "core/Clock.h"
 #include "core/ConsoleCommand.h"
+#include "core/GraphicsManager.h"
+#include "core/GUIManager.h"
 #include "objects/Scene.h"
-#include "gui/GUIManager.h"
 #include "sound/SoundMainMenu.h"
-#include "GraphicsManager.h"
 
 namespace orxonox
@@ -45,15 +45,7 @@
     DeclareGameState(GSMainMenu, "mainMenu", false, true);
 
-    GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
-        : GameState(params)
+    GSMainMenu::GSMainMenu(const GameStateInfo& info)
+        : GameState(info)
         , inputState_(0)
-    {
-    }
-
-    GSMainMenu::~GSMainMenu()
-    {
-    }
-
-    void GSMainMenu::activate()
     {
         inputState_ = InputManager::getInstance().createInputState("mainMenu");
@@ -65,7 +57,18 @@
         // and a Camera
         this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
+    }
 
+    GSMainMenu::~GSMainMenu()
+    {
+        InputManager::getInstance().destroyState("mainMenu");
+
+        this->scene_->getSceneManager()->destroyCamera(this->camera_);
+        delete this->scene_;
+    }
+
+    void GSMainMenu::activate()
+    {
         // show main menu
-        GUIManager::getInstance().showGUI("mainmenu_3");
+        GUIManager::getInstance().showGUI("mainmenu_4");
         GUIManager::getInstance().setCamera(this->camera_);
         GraphicsManager::getInstance().setCamera(this->camera_);
@@ -107,10 +110,7 @@
 
         InputManager::getInstance().leaveState("mainMenu");
-        InputManager::getInstance().destroyState("mainMenu");
 
         GUIManager::getInstance().setCamera(0);
         GraphicsManager::getInstance().setCamera(0);
-        this->scene_->getSceneManager()->destroyCamera(this->camera_);
-        delete this->scene_;
 
 /*
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.h	(revision 3370)
@@ -40,5 +40,5 @@
     {
     public:
-        GSMainMenu(const GameStateConstrParams& params);
+        GSMainMenu(const GameStateInfo& info);
         ~GSMainMenu();
 
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3370)
@@ -30,9 +30,11 @@
 
 #include "core/Clock.h"
-#include "core/CommandLine.h"
 #include "core/ConsoleCommand.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
+#include "core/LuaBind.h"
 #include "network/NetworkFunction.h"
+#include "ToluaBindCore.h"
+#include "ToluaBindOrxonox.h"
 #include "tools/Timer.h"
 #include "interfaces/TimeFactorListener.h"
@@ -42,14 +44,8 @@
 namespace orxonox
 {
-    DeclareGameState(GSRoot, "root", true, false);
-    SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
-    // Shortcuts for easy direct loading
-    SetCommandLineSwitch(server).information("Start in server mode");
-    SetCommandLineSwitch(client).information("Start in client mode");
-    SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
-    SetCommandLineSwitch(standalone).information("Start in standalone mode");
+    DeclareGameState(GSRoot, "root", false, false);
 
-    GSRoot::GSRoot(const GameStateConstrParams& params)
-        : GameState(params)
+    GSRoot::GSRoot(const GameStateInfo& info)
+        : GameState(info)
         , timeFactor_(1.0f)
         , bPaused_(false)
@@ -58,4 +54,8 @@
         this->ccSetTimeFactor_ = 0;
         this->ccPause_ = 0;
+
+        // Tell LuaBind about all tolua interfaces
+        LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core");
+        LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox");
     }
 
@@ -88,34 +88,4 @@
         // create the global LevelManager
         this->levelManager_ = new LevelManager();
-
-        // Load level directly?
-        bool loadLevel = false;
-        if (CommandLine::getValue("standalone").getBool())
-        {
-            Game::getInstance().requestStates("graphics, standalone, level");
-            loadLevel = true;
-        }
-        if (CommandLine::getValue("server").getBool())
-        {
-            Game::getInstance().requestStates("graphics, server, level");
-            loadLevel = true;
-        }
-        if (CommandLine::getValue("client").getBool())
-        {
-            Game::getInstance().requestStates("graphics, client, level");
-            loadLevel = true;
-        }
-        if (CommandLine::getValue("dedicated").getBool())
-        {
-            Game::getInstance().requestStates("dedicated, level");
-            loadLevel = true;
-        }
-        
-        // Determine where to start otherwise
-        if (!loadLevel && !CommandLine::getValue("console").getBool())
-        {
-            // Also load graphics
-            Game::getInstance().requestState("graphics");
-        }
     }
 
@@ -148,6 +118,4 @@
         }
 
-        uint64_t timeBeforeTick = time.getRealMicroseconds();
-
         for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)
             it->tick(time);
@@ -164,9 +132,4 @@
             it->tick(leveldt * this->timeFactor_);
         /*** HACK *** HACK ***/
-
-        uint64_t timeAfterTick = time.getRealMicroseconds();
-
-        // Also add our tick time
-        Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
     }
 
@@ -174,4 +137,7 @@
     @brief
         Changes the speed of Orxonox
+    @remark
+        This function is a hack when placed here!
+        Timefactor should be related to the scene (level or so), not the game
     */
     void GSRoot::setTimeFactor(float factor)
Index: code/trunk/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 3370)
@@ -38,5 +38,5 @@
     {
     public:
-        GSRoot(const GameStateConstrParams& params);
+        GSRoot(const GameStateInfo& info);
         ~GSRoot();
 
Index: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 3370)
@@ -41,6 +41,6 @@
     SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
 
-    GSServer::GSServer(const GameStateConstrParams& params)
-        : GameState(params)
+    GSServer::GSServer(const GameStateInfo& info)
+        : GameState(info)
         , server_(0)
     {
Index: code/trunk/src/orxonox/gamestates/GSServer.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSServer.h	(revision 3370)
@@ -40,5 +40,5 @@
     {
     public:
-        GSServer(const GameStateConstrParams& params);
+        GSServer(const GameStateInfo& info);
         ~GSServer();
 
Index: code/trunk/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 3370)
@@ -36,6 +36,6 @@
     DeclareGameState(GSStandalone, "standalone", false, true);
 
-    GSStandalone::GSStandalone(const GameStateConstrParams& params)
-        : GameState(params)
+    GSStandalone::GSStandalone(const GameStateInfo& info)
+        : GameState(info)
     {
     }
Index: code/trunk/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 3351)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 3370)
@@ -38,5 +38,5 @@
     {
     public:
-        GSStandalone(const GameStateConstrParams& params);
+        GSStandalone(const GameStateInfo& info);
         ~GSStandalone();
 
