Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 3351)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 3370)
@@ -20,5 +20,4 @@
 SET_SOURCE_FILES(ORXONOX_SRC_FILES
   CameraManager.cc
-  GraphicsManager.cc
   LevelManager.cc
   Main.cc
@@ -27,5 +26,4 @@
 )
 ADD_SUBDIRECTORY(gamestates)
-ADD_SUBDIRECTORY(gui)
 ADD_SUBDIRECTORY(interfaces)
 ADD_SUBDIRECTORY(objects)
@@ -43,5 +41,4 @@
   TOLUA_FILES
     LevelManager.h
-    gui/GUIManager.h
     objects/pickup/BaseItem.h
     objects/pickup/PickupInventory.h
@@ -53,9 +50,9 @@
   ${ORXONOX_WIN32}
   LINK_LIBRARIES
+    ${Boost_FILESYSTEM_LIBRARY}
+    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
+    ${Boost_THREAD_LIBRARY}
+    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
     ${OGRE_LIBRARY}
-    ${CEGUI_LIBRARY}
-    ${LUA_LIBRARIES}
-    ${CEGUILUA_LIBRARY}
-    ${Boost_SYSTEM_LIBRARY}
     ${OPENAL_LIBRARY}
     ${ALUT_LIBRARY}
@@ -63,5 +60,4 @@
     ${VORBIS_LIBRARY}
     ${OGG_LIBRARY}
-    ogreceguirenderer_orxonox
     tinyxml++_orxonox
     tolua++_orxonox
Index: code/trunk/src/orxonox/CameraManager.cc
===================================================================
--- code/trunk/src/orxonox/CameraManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/CameraManager.cc	(revision 3370)
@@ -34,20 +34,17 @@
 #include "util/StringUtils.h"
 #include "core/GameMode.h"
+#include "core/GUIManager.h"
 #include "core/ObjectList.h"
 #include "tools/Shader.h"
 #include "objects/worldentities/Camera.h"
 #include "objects/Scene.h"
-#include "gui/GUIManager.h"
 
 namespace orxonox
 {
-    CameraManager* CameraManager::singletonRef_s = 0;
+    CameraManager* CameraManager::singletonPtr_s = 0;
 
     CameraManager::CameraManager(Ogre::Viewport* viewport)
         : viewport_(viewport)
     {
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
-
         this->fallbackCamera_ = 0;
     }
@@ -55,7 +52,4 @@
     CameraManager::~CameraManager()
     {
-        assert(singletonRef_s != 0);
-        singletonRef_s = 0;
-
         if (this->fallbackCamera_)
             this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
Index: code/trunk/src/orxonox/CameraManager.h
===================================================================
--- code/trunk/src/orxonox/CameraManager.h	(revision 3351)
+++ code/trunk/src/orxonox/CameraManager.h	(revision 3370)
@@ -41,9 +41,11 @@
 #include <list>
 #include "util/OgreForwardRefs.h"
+#include "util/Singleton.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport CameraManager
+    class _OrxonoxExport CameraManager : public Singleton<CameraManager>
     {
+            friend class Singleton<CameraManager>;
         public:
             CameraManager(Ogre::Viewport* viewport);
@@ -57,6 +59,5 @@
             void useCamera(Ogre::Camera* camera);
 
-            static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
-            static CameraManager* getInstancePtr() { return singletonRef_s; }
+            static CameraManager* getInstancePtr() { return singletonPtr_s; }
 
         private:
@@ -67,5 +68,5 @@
             Ogre::Camera*         fallbackCamera_;
 
-            static CameraManager* singletonRef_s;
+            static CameraManager* singletonPtr_s;
     };
 }
Index: code/trunk/src/orxonox/GraphicsManager.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsManager.cc	(revision 3351)
+++ 	(revision )
@@ -1,426 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-/**
-@file
-@brief
-    Implementation of an partial interface to Ogre.
-*/
-
-#include "GraphicsManager.h"
-
-#include <fstream>
-#include <boost/filesystem.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <OgreCompositorManager.h>
-#include <OgreConfigFile.h>
-#include <OgreFrameListener.h>
-#include <OgreRoot.h>
-#include <OgreLogManager.h>
-#include <OgreException.h>
-#include <OgreRenderWindow.h>
-#include <OgreRenderSystem.h>
-#include <OgreTextureManager.h>
-#include <OgreViewport.h>
-#include <OgreWindowEventUtilities.h>
-
-#include "SpecialConfig.h"
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "util/SubString.h"
-#include "core/Clock.h"
-#include "core/ConsoleCommand.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CoreIncludes.h"
-#include "core/Core.h"
-#include "core/Game.h"
-#include "core/GameMode.h"
-#include "core/WindowEventListener.h"
-#include "tools/ParticleInterface.h"
-
-// HACK!
-#include "overlays/map/Map.h"
-
-namespace orxonox
-{
-    using boost::shared_ptr;
-
-    class OgreWindowEventListener : public Ogre::WindowEventListener
-    {
-    public:
-        void windowResized     (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
-        void windowFocusChange (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::changeWindowFocus(); }
-        void windowClosed      (Ogre::RenderWindow* rw)
-            { orxonox::Game::getInstance().stop(); }
-        void windowMoved       (Ogre::RenderWindow* rw)
-            { orxonox::WindowEventListener::moveWindow(); }
-    };
-
-    GraphicsManager* GraphicsManager::singletonRef_s = 0;
-
-    /**
-    @brief
-        Non-initialising constructor.
-    */
-    GraphicsManager::GraphicsManager()
-        : ogreRoot_(0)
-        , ogreLogger_(0)
-        , renderWindow_(0)
-        , viewport_(0)
-        , ogreWindowEventListener_(new OgreWindowEventListener())
-    {
-        RegisterObject(GraphicsManager);
-
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
-
-        this->setConfigValues();
-
-        // Ogre setup procedure
-        setupOgre();
-
-        try
-        {
-            // load all the required plugins for Ogre
-            loadOgrePlugins();
-            // read resource declaration file
-            this->declareResources();
-            // Reads ogre config and creates the render window
-            this->loadRenderer();
-
-            // TODO: Spread this
-            this->initialiseResources();
-
-            // add console commands
-            FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
-            functor1->setObject(this);
-            ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
-            CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
-        }
-        catch (...)
-        {
-            // clean up
-            delete this->ogreRoot_;
-            delete this->ogreLogger_;
-            delete this->ogreWindowEventListener_;
-            throw;
-        }
-    }
-
-    /**
-    @brief
-        Destroys all the Ogre related objects
-    */
-    GraphicsManager::~GraphicsManager()
-    {
-/*
-        delete this->ccPrintScreen_;
-*/
-
-        // HACK! This fixes an exit crash
-        Map::hackDestroyMap();
-        // unload all compositors (this is only necessary because we don't yet destroy all resources!)
-        Ogre::CompositorManager::getSingleton().removeAll();
-
-        // Delete OGRE main control organ
-        delete this->ogreRoot_;
-
-        // delete the logManager (since we have created it in the first place).
-        delete this->ogreLogger_;
-
-        delete this->ogreWindowEventListener_;
-
-        assert(singletonRef_s);
-        singletonRef_s = 0;
-    }
-
-    void GraphicsManager::setConfigValues()
-    {
-        SetConfigValue(resourceFile_,    "resources.cfg")
-            .description("Location of the resources file in the data path.");
-        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
-            .description("Location of the Ogre config file");
-        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
-            .description("Folder where the Ogre plugins are located.");
-        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
-            .description("Comma separated list of all plugins to load.");
-        SetConfigValue(ogreLogFile_,     "ogre.log")
-            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
-        SetConfigValue(ogreLogLevelTrivial_ , 5)
-            .description("Corresponding orxonox debug level for ogre Trivial");
-        SetConfigValue(ogreLogLevelNormal_  , 4)
-            .description("Corresponding orxonox debug level for ogre Normal");
-        SetConfigValue(ogreLogLevelCritical_, 2)
-            .description("Corresponding orxonox debug level for ogre Critical");
-        SetConfigValue(detailLevelParticle_, 2)
-            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &GraphicsManager::detailLevelParticleChanged);
-    }
-
-    void GraphicsManager::detailLevelParticleChanged()
-    {
-        for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it)
-            it->detailLevelChanged(this->detailLevelParticle_);
-    }
-
-    void GraphicsManager::update(const Clock& time)
-    {
-        Ogre::FrameEvent evt;
-        evt.timeSinceLastFrame = time.getDeltaTime();
-        evt.timeSinceLastEvent = time.getDeltaTime(); // note: same time, but shouldn't matter anyway
-
-        // don't forget to call _fireFrameStarted to OGRE to make sure
-        // everything goes smoothly
-        ogreRoot_->_fireFrameStarted(evt);
-
-        // Pump messages in all registered RenderWindows
-        // This calls the WindowEventListener objects.
-        Ogre::WindowEventUtilities::messagePump();
-        // make sure the window stays active even when not focused
-        // (probably only necessary on windows)
-        this->renderWindow_->setActive(true);
-
-        // render
-        ogreRoot_->_updateAllRenderTargets();
-
-        // again, just to be sure OGRE works fine
-        ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
-    }
-
-    void GraphicsManager::setCamera(Ogre::Camera* camera)
-    {
-        this->viewport_->setCamera(camera);
-    }
-
-    /**
-    @brief
-        Creates the Ogre Root object and sets up the ogre log.
-    */
-    void GraphicsManager::setupOgre()
-    {
-        COUT(3) << "Setting up Ogre..." << std::endl;
-
-        if (ogreConfigFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
-            ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
-        }
-        if (ogreLogFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
-            ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
-        }
-
-        boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
-        boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
-
-        // create a new logManager
-        // Ogre::Root will detect that we've already created a Log
-        std::auto_ptr<Ogre::LogManager> logger(new Ogre::LogManager());
-        COUT(4) << "Ogre LogManager created" << std::endl;
-
-        // create our own log that we can listen to
-        Ogre::Log *myLog;
-        myLog = logger->createLog(ogreLogFilepath.string(), true, false, false);
-        COUT(4) << "Ogre Log created" << std::endl;
-
-        myLog->setLogDetail(Ogre::LL_BOREME);
-        myLog->addListener(this);
-
-        COUT(4) << "Creating Ogre Root..." << std::endl;
-
-        // check for config file existence because Ogre displays (caught) exceptions if not
-        if (!boost::filesystem::exists(ogreConfigFilepath))
-        {
-            // create a zero sized file
-            std::ofstream creator;
-            creator.open(ogreConfigFilepath.string().c_str());
-            creator.close();
-        }
-
-        // Leave plugins file empty. We're going to do that part manually later
-        ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string());
-        // In case that new Root failed the logger gets destroyed because of the std::auto_ptr
-        ogreLogger_ = logger.release();
-
-        COUT(3) << "Ogre set up done." << std::endl;
-    }
-
-    void GraphicsManager::loadOgrePlugins()
-    {
-        // just to make sure the next statement doesn't segfault
-        if (ogrePluginsFolder_ == "")
-            ogrePluginsFolder_ = ".";
-
-        boost::filesystem::path folder(ogrePluginsFolder_);
-        // Do some SubString magic to get the comma separated list of plugins
-        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0');
-        // Use backslash paths on Windows! file_string() already does that though.
-        for (unsigned int i = 0; i < plugins.size(); ++i)
-            ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
-    }
-
-    void GraphicsManager::declareResources()
-    {
-        CCOUT(4) << "Declaring Resources" << std::endl;
-        //TODO: Specify layout of data file and maybe use xml-loader
-        //TODO: Work with ressource groups (should be generated by a special loader)
-
-        if (resourceFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre resource file set to \"\". Defaulting to resources.cfg" << std::endl;
-            ModifyConfigValue(resourceFile_, tset, "resources.cfg");
-        }
-
-        // Load resource paths from data file using configfile ressource type
-        Ogre::ConfigFile cf;
-        try
-        {
-            cf.load((Core::getMediaPath() / resourceFile_).string());
-        }
-        catch (...)
-        {
-            //COUT(1) << ex.getFullDescription() << std::endl;
-            COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl;
-            throw;
-        }
-
-        // Go through all sections & settings in the file
-        Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
-        std::string secName, typeName, archName;
-        while (seci.hasMoreElements())
-        {
-            try
-            {
-                secName = seci.peekNextKey();
-                Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
-                Ogre::ConfigFile::SettingsMultiMap::iterator i;
-                for (i = settings->begin(); i != settings->end(); ++i)
-                {
-                    typeName = i->first; // for instance "FileSystem" or "Zip"
-                    archName = i->second; // name (and location) of archive
-
-                    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
-                        (Core::getMediaPath() / archName).string(), typeName, secName);
-                }
-            }
-            catch (Ogre::Exception& ex)
-            {
-                COUT(1) << ex.getFullDescription() << std::endl;
-            }
-        }
-    }
-
-    void GraphicsManager::loadRenderer()
-    {
-        CCOUT(4) << "Configuring Renderer" << std::endl;
-
-        if (!ogreRoot_->restoreConfig())
-            if (!ogreRoot_->showConfigDialog())
-                ThrowException(InitialisationFailed, "OGRE graphics configuration dialogue failed.");
-
-        CCOUT(4) << "Creating render window" << std::endl;
-
-        this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
-        this->ogreWindowEventListener_->windowResized(renderWindow_);
-
-        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_);
-
-        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0);
-
-        // create a full screen default viewport
-        this->viewport_ = this->renderWindow_->addViewport(0, 0);
-    }
-
-    void GraphicsManager::initialiseResources()
-    {
-        CCOUT(4) << "Initialising resources" << std::endl;
-        //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
-        //try
-        //{
-            Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-            /*Ogre::StringVector str = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
-            for (unsigned int i = 0; i < str.size(); i++)
-            {
-            Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(str[i]);
-            }*/
-        //}
-        //catch (...)
-        //{
-        //    CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl;
-        //    throw;
-        //}
-    }
-
-    /**
-    @brief
-        Method called by the LogListener interface from Ogre.
-        We use it to capture Ogre log messages and handle it ourselves.
-    @param message
-        The message to be logged
-    @param lml
-        The message level the log is using
-    @param maskDebug
-        If we are printing to the console or not
-    @param logName
-        The name of this log (so you can have several listeners
-        for different logs, and identify them)
-    */
-    void GraphicsManager::messageLogged(const std::string& message,
-        Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName)
-    {
-        int orxonoxLevel;
-        switch (lml)
-        {
-        case Ogre::LML_TRIVIAL:
-            orxonoxLevel = this->ogreLogLevelTrivial_;
-            break;
-        case Ogre::LML_NORMAL:
-            orxonoxLevel = this->ogreLogLevelNormal_;
-            break;
-        case Ogre::LML_CRITICAL:
-            orxonoxLevel = this->ogreLogLevelCritical_;
-            break;
-        default:
-            orxonoxLevel = 0;
-        }
-        OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
-            << "Ogre: " << message << std::endl;
-    }
-
-    void GraphicsManager::printScreen()
-    {
-        assert(this->renderWindow_);
-       
-        this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
-    }
-}
Index: code/trunk/src/orxonox/GraphicsManager.h
===================================================================
--- code/trunk/src/orxonox/GraphicsManager.h	(revision 3351)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
- *   Co-authors:
- *      Felix Schulthess
- *
- */
-
-/**
-@file
-@brief
-    Declaration of GraphicsManager Singleton.
- */
-
-#ifndef _GraphicsManager_H__
-#define _GraphicsManager_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <cassert>
-#include <string>
-#include <OgreLog.h>
-#include "core/OrxonoxClass.h"
-
-namespace orxonox
-{
-    /**
-    @brief
-        Graphics engine manager class
-    */
-    class _OrxonoxExport GraphicsManager : public OrxonoxClass, public Ogre::LogListener
-    {
-    public:
-        GraphicsManager();
-        ~GraphicsManager();
-
-        void setConfigValues();
-
-        void update(const Clock& time);
-
-        void detailLevelParticleChanged();
-        inline unsigned int getDetailLevelParticle() const
-            { return this->detailLevelParticle_; }
-
-        inline Ogre::Viewport* getViewport()
-            { return this->viewport_; }
-        inline Ogre::RenderWindow* getRenderWindow()
-            { return this->renderWindow_; }
-
-        void setCamera(Ogre::Camera* camera);
-
-        inline static GraphicsManager& getInstance()
-            { assert(singletonRef_s); return *singletonRef_s; }
-
-    private:
-        GraphicsManager(GraphicsManager&); // don't mess with singletons
-
-        // OGRE initialisation
-        void setupOgre();
-        void loadOgrePlugins();
-        void declareResources();
-        void loadRenderer();
-        void initialiseResources();
-
-        // event from Ogre::LogListener
-        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
-            bool maskDebug, const std::string& logName);
-
-        // console commands
-        void printScreen();
-
-    private:
-        Ogre::Root*         ogreRoot_;                 //!< Ogre's root
-        Ogre::LogManager*   ogreLogger_;
-        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
-        Ogre::Viewport*     viewport_;                 //!< default full size viewport
-        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
-
-        // config values
-        unsigned int        detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
-        std::string         resourceFile_;             //!< resources file name
-        std::string         ogreConfigFile_;           //!< ogre config file name
-        std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
-        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
-        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
-        int                 ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
-        int                 ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
-        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
-
-        // console commands
-        ConsoleCommand*     ccPrintScreen_;
-
-        static GraphicsManager* singletonRef_s;        //!< Pointer to the Singleton
-    };
-}
-
-#endif /* _GraphicsManager_H__ */
Index: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/LevelManager.cc	(revision 3370)
@@ -30,8 +30,11 @@
 
 #include <map>
+#include <boost/filesystem.hpp>
 
 #include "core/CommandLine.h"
 #include "core/ConfigValueIncludes.h"
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
+#include "core/Loader.h"
 #include "PlayerManager.h"
 #include "objects/Level.h"
@@ -42,11 +45,8 @@
     SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
 
-    LevelManager* LevelManager::singletonRef_s = 0;
+    LevelManager* LevelManager::singletonPtr_s = 0;
 
     LevelManager::LevelManager()
     {
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
-
         RegisterRootObject(LevelManager);
         this->setConfigValues();
@@ -61,6 +61,4 @@
     LevelManager::~LevelManager()
     {
-        assert(singletonRef_s != 0);
-        singletonRef_s = 0;
     }
 
@@ -120,7 +118,34 @@
     }
 
-    const std::string& LevelManager::getDefaultLevel()
+    const std::string& LevelManager::getDefaultLevel() const
     {
         return defaultLevelName_;
     }
+
+    std::string LevelManager::getAvailableLevelListItem(unsigned int index) const
+    {
+        if (index >= availableLevels_.size())
+            return std::string();
+        else
+            return availableLevels_[index];
+    }
+
+    void LevelManager::compileAvailableLevelList()
+    {
+        availableLevels_.clear();
+
+        boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");
+        boost::filesystem::directory_iterator end;
+
+        while (file != end)
+        {
+            if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~')
+            {
+                std::string filename = file->path().leaf();
+                if (filename.length() > 4)
+                    availableLevels_.push_back(filename.substr(0,filename.length()-4));
+            }
+            ++file;
+        }
+    }
 }
Index: code/trunk/src/orxonox/LevelManager.h
===================================================================
--- code/trunk/src/orxonox/LevelManager.h	(revision 3351)
+++ code/trunk/src/orxonox/LevelManager.h	(revision 3370)
@@ -35,4 +35,6 @@
 #include <list>
 #include <string>
+
+#include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
 
@@ -42,6 +44,7 @@
     class _OrxonoxExport LevelManager
     // tolua_end
-        : public OrxonoxClass
+        : public Singleton<LevelManager>, public OrxonoxClass
     { // tolua_export
+            friend class Singleton<LevelManager>;
         public:
             LevelManager();
@@ -55,8 +58,10 @@
 
             void setDefaultLevel(const std::string& levelName); //tolua_export
-            const std::string& getDefaultLevel(); //tolua_export
+            const std::string& getDefaultLevel() const; //tolua_export
+            void compileAvailableLevelList(); //tolua_export
+            std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export
 
-            static LevelManager* getInstancePtr() { return singletonRef_s; }
-            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
+            static LevelManager* getInstancePtr() { return singletonPtr_s; }
+            static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
 
         private:
@@ -66,9 +71,10 @@
 
             std::list<Level*> levels_s;
+            std::vector<std::string> availableLevels_;
 
             // config values
             std::string defaultLevelName_;
 
-            static LevelManager* singletonRef_s;
+            static LevelManager* singletonPtr_s;
     }; // tolua_export
 } // tolua_export
Index: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 3351)
+++ code/trunk/src/orxonox/Main.cc	(revision 3370)
@@ -46,5 +46,13 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
+#include "core/CommandLine.h"
 #include "core/Game.h"
+
+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");
 
 /*
@@ -86,4 +94,18 @@
 
         game->requestState("root");
+
+        // Some development hacks (not really, but in the future, this calls won't make sense anymore)
+        if (CommandLine::getValue("standalone").getBool())
+            Game::getInstance().requestStates("graphics, standalone, level");
+        else if (CommandLine::getValue("server").getBool())
+            Game::getInstance().requestStates("graphics, server, level");
+        else if (CommandLine::getValue("client").getBool())
+            Game::getInstance().requestStates("graphics, client, level");
+        else if (CommandLine::getValue("dedicated").getBool())
+            Game::getInstance().requestStates("dedicated, level");
+        else if (CommandLine::getValue("console").getBool())
+            Game::getInstance().requestStates("ioConsole");
+        else
+            Game::getInstance().requestStates("graphics, mainMenu");
     }
     catch (const std::exception& ex)
Index: code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h	(revision 3351)
+++ code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h	(revision 3370)
@@ -90,7 +90,6 @@
 //#include "core/ConfigValueIncludes.h" // 19
 //#include "core/ConsoleCommand.h" // 15
-#include "core/Core.h"
+//#include "core/Core.h" // ?, but not many times
 #include "core/CoreIncludes.h"
-#include "core/GameMode.h"
 #include "core/XMLPort.h"
 
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3351)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3370)
@@ -73,8 +73,4 @@
         };
     }
-
-    class GraphicsManager;
-    class OgreWindowEventListener;
-    class Settings;
 
     class RadarViewable;
@@ -277,7 +273,4 @@
     class Map;
 
-    //gui
-    class GUIManager;
-
     //sound
     class SoundBase;
@@ -293,15 +286,4 @@
 }
 
-namespace CEGUI
-{
-    class DefaultLogger;
-    class Logger;
-    class LuaScriptModule;
-
-    class OgreCEGUIRenderer;
-    class OgreCEGUIResourceProvider;
-    class OgreCEGUITexture;
-}
-
 // Bullet Physics Engine
 class btTransform;
@@ -330,6 +312,3 @@
 typedef int ALint;
 
-// Lua
-struct lua_State;
-
 #endif /* _OrxonoxPrereqs_H__ */
Index: code/trunk/src/orxonox/PawnManager.cc
===================================================================
--- code/trunk/src/orxonox/PawnManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/PawnManager.cc	(revision 3370)
@@ -34,23 +34,18 @@
 namespace orxonox
 {
-    PawnManager* PawnManager::singletonRef_s = 0;
+    PawnManager* PawnManager::singletonPtr_s = 0;
 
     PawnManager::PawnManager()
     {
         RegisterRootObject(PawnManager);
-
-        assert(PawnManager::singletonRef_s == 0);
-        PawnManager::singletonRef_s = this;
     }
 
     PawnManager::~PawnManager()
     {
-        assert(PawnManager::singletonRef_s != 0);
-        PawnManager::singletonRef_s = 0;
     }
 
     void PawnManager::touch()
     {
-        if (!PawnManager::singletonRef_s)
+        if (!PawnManager::singletonPtr_s)
             new PawnManager();
     }
Index: code/trunk/src/orxonox/PawnManager.h
===================================================================
--- code/trunk/src/orxonox/PawnManager.h	(revision 3351)
+++ code/trunk/src/orxonox/PawnManager.h	(revision 3370)
@@ -31,10 +31,13 @@
 
 #include "OrxonoxPrereqs.h"
+
+#include "util/Singleton.h"
 #include "interfaces/Tickable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport PawnManager : public Tickable
+    class _OrxonoxExport PawnManager : protected Singleton<PawnManager>, public Tickable
     {
+            friend class Singleton<PawnManager>;
         public:
             static void touch();
@@ -46,5 +49,5 @@
             virtual ~PawnManager();
 
-            static PawnManager* singletonRef_s;
+            static PawnManager* singletonPtr_s;
     };
 }
Index: code/trunk/src/orxonox/PlayerManager.cc
===================================================================
--- code/trunk/src/orxonox/PlayerManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/PlayerManager.cc	(revision 3370)
@@ -37,12 +37,9 @@
 namespace orxonox
 {
-    PlayerManager* PlayerManager::singletonRef_s = 0;
+    PlayerManager* PlayerManager::singletonPtr_s = 0;
 
     PlayerManager::PlayerManager()
     {
         RegisterRootObject(PlayerManager);
-
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
 
         this->getConnectedClients();
@@ -51,6 +48,4 @@
     PlayerManager::~PlayerManager()
     {
-        assert(singletonRef_s);
-        singletonRef_s = 0;
     }
 
Index: code/trunk/src/orxonox/PlayerManager.h
===================================================================
--- code/trunk/src/orxonox/PlayerManager.h	(revision 3351)
+++ code/trunk/src/orxonox/PlayerManager.h	(revision 3370)
@@ -34,16 +34,15 @@
 #include <cassert>
 #include <map>
+#include "util/Singleton.h"
 #include "network/ClientConnectionListener.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport PlayerManager : public ClientConnectionListener
+    class _OrxonoxExport PlayerManager : public Singleton<PlayerManager>, public ClientConnectionListener
     {
+            friend class Singleton<PlayerManager>;
         public:
             PlayerManager();
             virtual ~PlayerManager();
-
-            inline static PlayerManager& getInstance()
-                { assert(singletonRef_s); return *singletonRef_s; }
 
             PlayerInfo* getClient(unsigned int clientID) const;
@@ -57,5 +56,5 @@
             std::map<unsigned int, PlayerInfo*> clients_;
 
-            static PlayerManager* singletonRef_s;
+            static PlayerManager* singletonPtr_s;
     };
 }
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();
 
Index: code/trunk/src/orxonox/objects/pickup/BaseItem.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/BaseItem.h	(revision 3351)
+++ code/trunk/src/orxonox/objects/pickup/BaseItem.h	(revision 3370)
@@ -51,8 +51,5 @@
             Daniel 'Huty' Haggenmueller
     */
-    class _OrxonoxExport BaseItem
-// tolua_end
-        : public BaseObject
-// tolua_begin
+    class _OrxonoxExport BaseItem : public BaseObject
     {
 // tolua_end
Index: code/trunk/src/orxonox/objects/pickup/PickupInventory.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupInventory.cc	(revision 3351)
+++ code/trunk/src/orxonox/objects/pickup/PickupInventory.cc	(revision 3370)
@@ -37,6 +37,6 @@
 
 #include "core/ConsoleCommand.h"
+#include "core/GUIManager.h"
 #include "core/input/InputManager.h"
-#include "gui/GUIManager.h"
 #include "objects/controllers/HumanController.h"
 #include "objects/worldentities/pawns/Pawn.h"
Index: code/trunk/src/orxonox/objects/pickup/PickupInventory.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupInventory.h	(revision 3351)
+++ code/trunk/src/orxonox/objects/pickup/PickupInventory.h	(revision 3370)
@@ -43,10 +43,8 @@
 namespace orxonox
 {
-// tolua_end
     /**
         @brief Static class for the inventory GUI window.
         @author Daniel 'Huty' Haggenmueller
     */
-// tolua_begin
     class _OrxonoxExport PickupInventory
     {
Index: code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc	(revision 3351)
+++ code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc	(revision 3370)
@@ -37,7 +37,7 @@
 
 #include "core/CoreIncludes.h"
+#include "core/GUIManager.h"     // HACK; see below
 #include "core/Template.h"
 #include "core/XMLPort.h"
-#include "gui/GUIManager.h"     // HACK; see below
 #include "objects/worldentities/pawns/Pawn.h"
 #include "PickupInventory.h"    // HACK; Only for hack, remove later
Index: code/trunk/src/orxonox/objects/quest/QuestDescription.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestDescription.h	(revision 3351)
+++ code/trunk/src/orxonox/objects/quest/QuestDescription.h	(revision 3370)
@@ -54,8 +54,7 @@
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestDescription
+    class _OrxonoxExport QuestDescription : public BaseObject
+    {
 // tolua_end
-        : public BaseObject
-    { // tolua_export
         public:
             QuestDescription(BaseObject* creator);
Index: code/trunk/src/orxonox/objects/quest/QuestListener.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 3351)
+++ code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 3370)
@@ -81,5 +81,5 @@
     /**
     @brief
-        Makes all QuestListener in the list aware that a certain status change has occured and executes them if the status change affects them.
+        Makes all QuestListener in the list aware that a certain status change has occurred and executes them if the status change affects them.
     @param listeners
         The list of QuestListeners that have to be made aware of the status change.
@@ -182,5 +182,5 @@
         else
         {
-            COUT(1) << "An unforseen, never to happen, Error has occured. This is impossible!" << std::endl;
+            COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
         return "";
         }
Index: code/trunk/src/orxonox/objects/quest/QuestManager.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/objects/quest/QuestManager.cc	(revision 3370)
@@ -36,5 +36,4 @@
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
-#include "gui/GUIManager.h"
 
 #include "objects/infos/PlayerInfo.h"
@@ -48,5 +47,5 @@
 {
     //! Pointer to the current (and single) instance of this class.
-    /*static*/ QuestManager* QuestManager::singletonRef_s = NULL;
+    /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL;
 
     /**
@@ -59,7 +58,4 @@
     {
         RegisterRootObject(QuestManager);
-
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
     }
 
@@ -71,16 +67,4 @@
     {
 
-    }
-
-    /**
-    @brief
-        Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.
-    @return
-        Returns a reference to the single instance of the Quest Manager.
-    */
-    /*static*/ QuestManager & QuestManager::getInstance()
-    {
-        assert(singletonRef_s);
-        return *singletonRef_s;
     }
 
@@ -225,5 +209,8 @@
     QuestContainer* QuestManager::getQuestTree(std::string & name)
     {
-        GUIOverlay* gui = GUIManager::getInstance().getOverlay(name);
+        GUIOverlay* gui = NULL;
+        for (ObjectList<GUIOverlay>::iterator it = ObjectList<GUIOverlay>::begin(); it != ObjectList<GUIOverlay>::end(); ++it)
+            if (it->getGUIName() == name)
+                gui = *it;
 
         PlayerInfo* player;
@@ -321,5 +308,5 @@
         {
             container->status = "";
-            COUT(1) << "An error occured. A Quest of un-specified status wanted to be displayed." << std::endl;
+            COUT(1) << "An error occurred. A Quest of un-specified status wanted to be displayed." << std::endl;
         }
         
Index: code/trunk/src/orxonox/objects/quest/QuestManager.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestManager.h	(revision 3351)
+++ code/trunk/src/orxonox/objects/quest/QuestManager.h	(revision 3370)
@@ -40,4 +40,6 @@
 #include <map>
 #include <string>
+
+#include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
 
@@ -71,15 +73,14 @@
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport QuestManager
-// tolua_end
-        : public OrxonoxClass
-// tolua_begin
+    class _OrxonoxExport QuestManager : public Singleton<QuestManager>, public orxonox::OrxonoxClass
     {
 // tolua_end
+            friend class Singleton<QuestManager>;
         public:
             QuestManager();
             virtual ~QuestManager();
 
-            static QuestManager& getInstance(); // tolua_export //!< Returns a reference to the single instance of the Quest Manager.
+            //! Returns a reference to the single instance of the Quest Manager.
+            static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
 
             bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
@@ -92,5 +93,5 @@
 
         private:
-            static QuestManager* singletonRef_s;
+            static QuestManager* singletonPtr_s;
 
             std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
Index: code/trunk/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/GUIOverlay.cc	(revision 3351)
+++ code/trunk/src/orxonox/overlays/GUIOverlay.cc	(revision 3370)
@@ -34,6 +34,6 @@
 #include "core/input/InputManager.h"
 #include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
 #include "core/XMLPort.h"
-#include "gui/GUIManager.h"
 
 namespace orxonox
@@ -55,6 +55,4 @@
 
         XMLPortParam(GUIOverlay, "guiname", setGUIName, getGUIName, xmlElement, mode);
-        
-        GUIManager::getInstance().registerOverlay(this->guiName_, this);
     }
 
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 3351)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 3370)
@@ -60,5 +60,5 @@
     SetConsoleCommand(InGameConsole, closeConsole, true);
 
-    InGameConsole* InGameConsole::singletonRef_s = 0;
+    InGameConsole* InGameConsole::singletonPtr_s = 0;
 
     /**
@@ -76,7 +76,4 @@
         RegisterObject(InGameConsole);
 
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
-
         this->bActive_ = false;
         this->cursor_ = 0.0f;
@@ -131,6 +128,4 @@
         if (this->consoleOverlay_)
             Ogre::OverlayManager::getSingleton().destroy(consoleOverlay_);
-
-        singletonRef_s = 0;
     }
 
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 3351)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 3370)
@@ -34,5 +34,7 @@
 
 #include <string>
+
 #include "util/OgreForwardRefs.h"
+#include "util/Singleton.h"
 #include "core/Shell.h"
 #include "core/WindowEventListener.h"
@@ -40,6 +42,7 @@
 namespace orxonox
 {
-    class _OrxonoxExport InGameConsole : public ShellListener, public WindowEventListener
+    class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener
     {
+        friend class Singleton<InGameConsole>;
     public: // functions
         InGameConsole();
@@ -51,7 +54,4 @@
 
         void update(const Clock& time);
-
-        static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
-        static InGameConsole* getInstancePtr() { return singletonRef_s; }
 
         static void openConsole();
@@ -112,5 +112,5 @@
         bool bHidesAllInput_;
 
-        static InGameConsole* singletonRef_s;
+        static InGameConsole* singletonPtr_s;
     };
 }
Index: code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc	(revision 3370)
@@ -46,5 +46,5 @@
     const std::string NotificationManager::NONE = "none";
 
-    NotificationManager* NotificationManager::singletonRef_s = NULL;
+    NotificationManager* NotificationManager::singletonPtr_s = NULL;
 
     /**
@@ -55,7 +55,4 @@
     {
         RegisterRootObject(NotificationManager);
-
-        assert(singletonRef_s == 0);
-        singletonRef_s = this;
 
         this->highestIndex_ = 0;
@@ -70,16 +67,4 @@
     }
 
-    /**
-    @brief
-        Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.
-    @return
-        Returns a reference to the single instance of the NotificationManager.
-    */
-    /*static*/ NotificationManager & NotificationManager::getInstance()
-    {
-        assert(singletonRef_s);
-        return *singletonRef_s;
-    }
-    
     /**
     @brief
Index: code/trunk/src/orxonox/overlays/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/orxonox/overlays/notifications/NotificationManager.h	(revision 3351)
+++ code/trunk/src/orxonox/overlays/notifications/NotificationManager.h	(revision 3370)
@@ -40,4 +40,6 @@
 #include <map>
 #include <string>
+
+#include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
 
@@ -52,6 +54,7 @@
         Damian 'Mozork' Frick
     */
-    class _OrxonoxExport NotificationManager : public OrxonoxClass
+    class _OrxonoxExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass
     {
+            friend class Singleton<NotificationManager>;
         public:
             NotificationManager();
@@ -60,6 +63,4 @@
             static const std::string ALL;
             static const std::string NONE;
-
-            static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.
 
             bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
@@ -88,5 +89,5 @@
 
         private:
-            static NotificationManager* singletonRef_s;
+            static NotificationManager* singletonPtr_s;
 
             int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
Index: code/trunk/src/orxonox/sound/SoundBase.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundBase.cc	(revision 3351)
+++ code/trunk/src/orxonox/sound/SoundBase.cc	(revision 3370)
@@ -65,5 +65,5 @@
     void SoundBase::update() {
         if(this->entity_ != NULL && alIsSource(this->source_)) {
-            Vector3 pos = this->entity_->getPosition();
+            const Vector3& pos = this->entity_->getPosition();
             alSource3f(this->source_, AL_POSITION, pos.x, pos.y, pos.z);
             ALenum error = alGetError();
@@ -71,5 +71,5 @@
                 COUT(2) << "Sound: OpenAL: Invalid sound position" << std::endl;
 
-            Vector3 vel = this->entity_->getVelocity();
+            const Vector3& vel = this->entity_->getVelocity();
             alSource3f(this->source_, AL_VELOCITY, vel.x, vel.y, vel.z);
             error = alGetError();
@@ -77,5 +77,5 @@
                 COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl;
 
-            Quaternion orient = this->entity_->getOrientation();
+            const Quaternion& orient = this->entity_->getOrientation();
             Vector3 at = orient.zAxis();
             alSource3f(this->source_, AL_DIRECTION, at.x, at.y, at.z);
@@ -190,5 +190,5 @@
         if(ov_open(f, &vf, NULL, 0) < 0)
         {
-            COUT(2) << "Sound: libvorbisfile: File seems not to be an Ogg Vorbis bitstream" << std::endl;
+            COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl;
             ov_clear(&vf);
             return AL_NONE;
Index: code/trunk/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.cc	(revision 3351)
+++ code/trunk/src/orxonox/sound/SoundManager.cc	(revision 3370)
@@ -38,5 +38,5 @@
 namespace orxonox
 {
-    SoundManager* SoundManager::singletonRef_s = NULL;
+    SoundManager* SoundManager::singletonPtr_s = NULL;
 
     /**
@@ -45,7 +45,4 @@
     SoundManager::SoundManager()
     {
-        assert(singletonRef_s == NULL);
-        singletonRef_s = this;
-
         this->device_ = NULL;
         this->soundavailable_ = true;
@@ -93,7 +90,4 @@
     SoundManager::~SoundManager()
     {
-        assert(singletonRef_s != NULL);
-        singletonRef_s = NULL;
-
         alcDestroyContext(this->context_);
         alcCloseDevice(this->device_);
@@ -148,5 +142,5 @@
 
         // update listener orientation
-        Quaternion orient = camera->getOrientation();
+        const Quaternion& orient = camera->getOrientation();
         Vector3 up = orient.xAxis(); // just a wild guess
         Vector3 at = orient.zAxis();
Index: code/trunk/src/orxonox/sound/SoundManager.h
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.h	(revision 3351)
+++ code/trunk/src/orxonox/sound/SoundManager.h	(revision 3370)
@@ -32,4 +32,5 @@
 #include <cassert>
 #include <list>
+#include "util/Singleton.h"
 #include "interfaces/Tickable.h"
 
@@ -42,6 +43,7 @@
      *
      */
-    class _OrxonoxExport SoundManager : public Tickable 
+    class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable
     {
+        friend class Singleton<SoundManager>;
     public:
         SoundManager();
@@ -52,6 +54,4 @@
         bool isSoundAvailable();
 
-        static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
-
     private:
         ALCdevice* device_;
@@ -60,5 +60,5 @@
         bool soundavailable_;
 
-        static SoundManager* singletonRef_s;
+        static SoundManager* singletonPtr_s;
     }; // class SoundManager
 } // namespace orxonox
Index: code/trunk/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 3351)
+++ code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 3370)
@@ -43,6 +43,6 @@
 #include "util/Math.h"
 #include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
 #include "core/GameMode.h"
-#include "GraphicsManager.h"
 
 namespace orxonox
@@ -91,4 +91,10 @@
     }
 
+    void ParticleInterface::setConfigValues()
+    {
+        SetConfigValue(globalDetailLevel_, 2)
+            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &ParticleInterface::detailLevelChanged);
+    }
+
     Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
     {
@@ -180,10 +186,10 @@
         this->detaillevel_ = level;
         if (GameMode::showsGraphics())
-            this->detailLevelChanged(GraphicsManager::getInstance().getDetailLevelParticle());
-    }
-
-    void ParticleInterface::detailLevelChanged(unsigned int newlevel)
-    {
-        if (newlevel >= static_cast<unsigned int>(this->detaillevel_))
+            this->detailLevelChanged();
+    }
+
+    void ParticleInterface::detailLevelChanged()
+    {
+        if (this->globalDetailLevel_ >= this->detaillevel_)
             this->bAllowedByLOD_ = true;
         else
Index: code/trunk/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 3351)
+++ code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 3370)
@@ -47,4 +47,5 @@
             ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel);
             virtual ~ParticleInterface();
+            void setConfigValues();
 
             inline Ogre::ParticleSystem* getParticleSystem()
@@ -77,5 +78,4 @@
                 { return this->bVisible_; }
 
-            void detailLevelChanged(unsigned int newlevel);
             void setDetailLevel(unsigned int level);
 
@@ -90,4 +90,5 @@
         private:
             void updateVisibility();
+            void detailLevelChanged();
 
             Ogre::ParticleSystem*     particleSystem_;
@@ -96,6 +97,9 @@
             bool                      bEnabled_;
             bool                      bAllowedByLOD_;
-            unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
+            unsigned int              detaillevel_;       //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
             float                     speedFactor_;
+
+            // config values
+            unsigned int              globalDetailLevel_; //!< Global maximum detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
 
             static ParticleInterface* currentParticleInterface_s;
Index: code/trunk/src/orxonox/tools/Shader.cc
===================================================================
--- code/trunk/src/orxonox/tools/Shader.cc	(revision 3351)
+++ code/trunk/src/orxonox/tools/Shader.cc	(revision 3370)
@@ -41,5 +41,5 @@
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
-#include "GraphicsManager.h"
+#include "core/GraphicsManager.h"
 
 namespace orxonox
