Changeset 3370 for code/trunk/src/orxonox
- Timestamp:
- Jul 30, 2009, 2:10:44 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 3 deleted
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource (added) merged: 3328,3336-3340,3342-3350,3352-3366
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/CMakeLists.txt
r3280 r3370 20 20 SET_SOURCE_FILES(ORXONOX_SRC_FILES 21 21 CameraManager.cc 22 GraphicsManager.cc23 22 LevelManager.cc 24 23 Main.cc … … 27 26 ) 28 27 ADD_SUBDIRECTORY(gamestates) 29 ADD_SUBDIRECTORY(gui)30 28 ADD_SUBDIRECTORY(interfaces) 31 29 ADD_SUBDIRECTORY(objects) … … 43 41 TOLUA_FILES 44 42 LevelManager.h 45 gui/GUIManager.h46 43 objects/pickup/BaseItem.h 47 44 objects/pickup/PickupInventory.h … … 53 50 ${ORXONOX_WIN32} 54 51 LINK_LIBRARIES 52 ${Boost_FILESYSTEM_LIBRARY} 53 ${Boost_SYSTEM_LIBRARY} # Filesystem dependency 54 ${Boost_THREAD_LIBRARY} 55 ${Boost_DATE_TIME_LIBRARY} # Thread dependency 55 56 ${OGRE_LIBRARY} 56 ${CEGUI_LIBRARY}57 ${LUA_LIBRARIES}58 ${CEGUILUA_LIBRARY}59 ${Boost_SYSTEM_LIBRARY}60 57 ${OPENAL_LIBRARY} 61 58 ${ALUT_LIBRARY} … … 63 60 ${VORBIS_LIBRARY} 64 61 ${OGG_LIBRARY} 65 ogreceguirenderer_orxonox66 62 tinyxml++_orxonox 67 63 tolua++_orxonox -
code/trunk/src/orxonox/CameraManager.cc
r3280 r3370 34 34 #include "util/StringUtils.h" 35 35 #include "core/GameMode.h" 36 #include "core/GUIManager.h" 36 37 #include "core/ObjectList.h" 37 38 #include "tools/Shader.h" 38 39 #include "objects/worldentities/Camera.h" 39 40 #include "objects/Scene.h" 40 #include "gui/GUIManager.h"41 41 42 42 namespace orxonox 43 43 { 44 CameraManager* CameraManager::singleton Ref_s = 0;44 CameraManager* CameraManager::singletonPtr_s = 0; 45 45 46 46 CameraManager::CameraManager(Ogre::Viewport* viewport) 47 47 : viewport_(viewport) 48 48 { 49 assert(singletonRef_s == 0);50 singletonRef_s = this;51 52 49 this->fallbackCamera_ = 0; 53 50 } … … 55 52 CameraManager::~CameraManager() 56 53 { 57 assert(singletonRef_s != 0);58 singletonRef_s = 0;59 60 54 if (this->fallbackCamera_) 61 55 this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_); -
code/trunk/src/orxonox/CameraManager.h
r3196 r3370 41 41 #include <list> 42 42 #include "util/OgreForwardRefs.h" 43 #include "util/Singleton.h" 43 44 44 45 namespace orxonox 45 46 { 46 class _OrxonoxExport CameraManager 47 class _OrxonoxExport CameraManager : public Singleton<CameraManager> 47 48 { 49 friend class Singleton<CameraManager>; 48 50 public: 49 51 CameraManager(Ogre::Viewport* viewport); … … 57 59 void useCamera(Ogre::Camera* camera); 58 60 59 static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 60 static CameraManager* getInstancePtr() { return singletonRef_s; } 61 static CameraManager* getInstancePtr() { return singletonPtr_s; } 61 62 62 63 private: … … 67 68 Ogre::Camera* fallbackCamera_; 68 69 69 static CameraManager* singleton Ref_s;70 static CameraManager* singletonPtr_s; 70 71 }; 71 72 } -
code/trunk/src/orxonox/LevelManager.cc
r3280 r3370 30 30 31 31 #include <map> 32 #include <boost/filesystem.hpp> 32 33 33 34 #include "core/CommandLine.h" 34 35 #include "core/ConfigValueIncludes.h" 36 #include "core/Core.h" 35 37 #include "core/CoreIncludes.h" 38 #include "core/Loader.h" 36 39 #include "PlayerManager.h" 37 40 #include "objects/Level.h" … … 42 45 SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)"); 43 46 44 LevelManager* LevelManager::singleton Ref_s = 0;47 LevelManager* LevelManager::singletonPtr_s = 0; 45 48 46 49 LevelManager::LevelManager() 47 50 { 48 assert(singletonRef_s == 0);49 singletonRef_s = this;50 51 51 RegisterRootObject(LevelManager); 52 52 this->setConfigValues(); … … 61 61 LevelManager::~LevelManager() 62 62 { 63 assert(singletonRef_s != 0);64 singletonRef_s = 0;65 63 } 66 64 … … 120 118 } 121 119 122 const std::string& LevelManager::getDefaultLevel() 120 const std::string& LevelManager::getDefaultLevel() const 123 121 { 124 122 return defaultLevelName_; 125 123 } 124 125 std::string LevelManager::getAvailableLevelListItem(unsigned int index) const 126 { 127 if (index >= availableLevels_.size()) 128 return std::string(); 129 else 130 return availableLevels_[index]; 131 } 132 133 void LevelManager::compileAvailableLevelList() 134 { 135 availableLevels_.clear(); 136 137 boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels"); 138 boost::filesystem::directory_iterator end; 139 140 while (file != end) 141 { 142 if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~') 143 { 144 std::string filename = file->path().leaf(); 145 if (filename.length() > 4) 146 availableLevels_.push_back(filename.substr(0,filename.length()-4)); 147 } 148 ++file; 149 } 150 } 126 151 } -
code/trunk/src/orxonox/LevelManager.h
r3304 r3370 35 35 #include <list> 36 36 #include <string> 37 38 #include "util/Singleton.h" 37 39 #include "core/OrxonoxClass.h" 38 40 … … 42 44 class _OrxonoxExport LevelManager 43 45 // tolua_end 44 : public OrxonoxClass46 : public Singleton<LevelManager>, public OrxonoxClass 45 47 { // tolua_export 48 friend class Singleton<LevelManager>; 46 49 public: 47 50 LevelManager(); … … 55 58 56 59 void setDefaultLevel(const std::string& levelName); //tolua_export 57 const std::string& getDefaultLevel(); //tolua_export 60 const std::string& getDefaultLevel() const; //tolua_export 61 void compileAvailableLevelList(); //tolua_export 62 std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export 58 63 59 static LevelManager* getInstancePtr() { return singleton Ref_s; }60 static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export64 static LevelManager* getInstancePtr() { return singletonPtr_s; } 65 static LevelManager& getInstance() { return Singleton<LevelManager>::getInstance(); } // tolua_export 61 66 62 67 private: … … 66 71 67 72 std::list<Level*> levels_s; 73 std::vector<std::string> availableLevels_; 68 74 69 75 // config values 70 76 std::string defaultLevelName_; 71 77 72 static LevelManager* singleton Ref_s;78 static LevelManager* singletonPtr_s; 73 79 }; // tolua_export 74 80 } // tolua_export -
code/trunk/src/orxonox/Main.cc
r3323 r3370 46 46 #include "util/Debug.h" 47 47 #include "util/Exception.h" 48 #include "core/CommandLine.h" 48 49 #include "core/Game.h" 50 51 SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); 52 // Shortcuts for easy direct loading 53 SetCommandLineSwitch(server).information("Start in server mode"); 54 SetCommandLineSwitch(client).information("Start in client mode"); 55 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); 56 SetCommandLineSwitch(standalone).information("Start in standalone mode"); 49 57 50 58 /* … … 86 94 87 95 game->requestState("root"); 96 97 // Some development hacks (not really, but in the future, this calls won't make sense anymore) 98 if (CommandLine::getValue("standalone").getBool()) 99 Game::getInstance().requestStates("graphics, standalone, level"); 100 else if (CommandLine::getValue("server").getBool()) 101 Game::getInstance().requestStates("graphics, server, level"); 102 else if (CommandLine::getValue("client").getBool()) 103 Game::getInstance().requestStates("graphics, client, level"); 104 else if (CommandLine::getValue("dedicated").getBool()) 105 Game::getInstance().requestStates("dedicated, level"); 106 else if (CommandLine::getValue("console").getBool()) 107 Game::getInstance().requestStates("ioConsole"); 108 else 109 Game::getInstance().requestStates("graphics, mainMenu"); 88 110 } 89 111 catch (const std::exception& ex) -
code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h
r3322 r3370 90 90 //#include "core/ConfigValueIncludes.h" // 19 91 91 //#include "core/ConsoleCommand.h" // 15 92 #include "core/Core.h" 92 //#include "core/Core.h" // ?, but not many times 93 93 #include "core/CoreIncludes.h" 94 #include "core/GameMode.h"95 94 #include "core/XMLPort.h" 96 95 -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r3327 r3370 73 73 }; 74 74 } 75 76 class GraphicsManager;77 class OgreWindowEventListener;78 class Settings;79 75 80 76 class RadarViewable; … … 277 273 class Map; 278 274 279 //gui280 class GUIManager;281 282 275 //sound 283 276 class SoundBase; … … 293 286 } 294 287 295 namespace CEGUI296 {297 class DefaultLogger;298 class Logger;299 class LuaScriptModule;300 301 class OgreCEGUIRenderer;302 class OgreCEGUIResourceProvider;303 class OgreCEGUITexture;304 }305 306 288 // Bullet Physics Engine 307 289 class btTransform; … … 330 312 typedef int ALint; 331 313 332 // Lua333 struct lua_State;334 335 314 #endif /* _OrxonoxPrereqs_H__ */ -
code/trunk/src/orxonox/PawnManager.cc
r3196 r3370 34 34 namespace orxonox 35 35 { 36 PawnManager* PawnManager::singleton Ref_s = 0;36 PawnManager* PawnManager::singletonPtr_s = 0; 37 37 38 38 PawnManager::PawnManager() 39 39 { 40 40 RegisterRootObject(PawnManager); 41 42 assert(PawnManager::singletonRef_s == 0);43 PawnManager::singletonRef_s = this;44 41 } 45 42 46 43 PawnManager::~PawnManager() 47 44 { 48 assert(PawnManager::singletonRef_s != 0);49 PawnManager::singletonRef_s = 0;50 45 } 51 46 52 47 void PawnManager::touch() 53 48 { 54 if (!PawnManager::singleton Ref_s)49 if (!PawnManager::singletonPtr_s) 55 50 new PawnManager(); 56 51 } -
code/trunk/src/orxonox/PawnManager.h
r3196 r3370 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include "util/Singleton.h" 33 35 #include "interfaces/Tickable.h" 34 36 35 37 namespace orxonox 36 38 { 37 class _OrxonoxExport PawnManager : p ublic Tickable39 class _OrxonoxExport PawnManager : protected Singleton<PawnManager>, public Tickable 38 40 { 41 friend class Singleton<PawnManager>; 39 42 public: 40 43 static void touch(); … … 46 49 virtual ~PawnManager(); 47 50 48 static PawnManager* singleton Ref_s;51 static PawnManager* singletonPtr_s; 49 52 }; 50 53 } -
code/trunk/src/orxonox/PlayerManager.cc
r3297 r3370 37 37 namespace orxonox 38 38 { 39 PlayerManager* PlayerManager::singleton Ref_s = 0;39 PlayerManager* PlayerManager::singletonPtr_s = 0; 40 40 41 41 PlayerManager::PlayerManager() 42 42 { 43 43 RegisterRootObject(PlayerManager); 44 45 assert(singletonRef_s == 0);46 singletonRef_s = this;47 44 48 45 this->getConnectedClients(); … … 51 48 PlayerManager::~PlayerManager() 52 49 { 53 assert(singletonRef_s);54 singletonRef_s = 0;55 50 } 56 51 -
code/trunk/src/orxonox/PlayerManager.h
r3196 r3370 34 34 #include <cassert> 35 35 #include <map> 36 #include "util/Singleton.h" 36 37 #include "network/ClientConnectionListener.h" 37 38 38 39 namespace orxonox 39 40 { 40 class _OrxonoxExport PlayerManager : public ClientConnectionListener41 class _OrxonoxExport PlayerManager : public Singleton<PlayerManager>, public ClientConnectionListener 41 42 { 43 friend class Singleton<PlayerManager>; 42 44 public: 43 45 PlayerManager(); 44 46 virtual ~PlayerManager(); 45 46 inline static PlayerManager& getInstance()47 { assert(singletonRef_s); return *singletonRef_s; }48 47 49 48 PlayerInfo* getClient(unsigned int clientID) const; … … 57 56 std::map<unsigned int, PlayerInfo*> clients_; 58 57 59 static PlayerManager* singleton Ref_s;58 static PlayerManager* singletonPtr_s; 60 59 }; 61 60 } -
code/trunk/src/orxonox/gamestates/GSClient.cc
r3280 r3370 42 42 SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#"); 43 43 44 GSClient::GSClient(const GameState ConstrParams& params)45 : GameState( params)44 GSClient::GSClient(const GameStateInfo& info) 45 : GameState(info) 46 46 , client_(0) 47 47 { -
code/trunk/src/orxonox/gamestates/GSClient.h
r3280 r3370 40 40 { 41 41 public: 42 GSClient(const GameState ConstrParams& params);42 GSClient(const GameStateInfo& info); 43 43 ~GSClient(); 44 44 -
code/trunk/src/orxonox/gamestates/GSDedicated.cc
r3351 r3370 55 55 termios* GSDedicated::originalTerminalSettings_; 56 56 57 GSDedicated::GSDedicated(const GameState ConstrParams& params)58 : GameState( params)57 GSDedicated::GSDedicated(const GameStateInfo& info) 58 : GameState(info) 59 59 , server_(0) 60 60 , closeThread_(false) -
code/trunk/src/orxonox/gamestates/GSDedicated.h
r3304 r3370 48 48 { 49 49 public: 50 GSDedicated(const GameState ConstrParams& params);50 GSDedicated(const GameStateInfo& info); 51 51 ~GSDedicated(); 52 52 -
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r3327 r3370 35 35 #include "GSGraphics.h" 36 36 37 #include <boost/filesystem.hpp>38 #include <OgreRenderWindow.h>39 40 37 #include "util/Convert.h" 41 38 #include "core/Clock.h" … … 44 41 #include "core/Core.h" 45 42 #include "core/Game.h" 46 #include "core/G ameMode.h"43 #include "core/GUIManager.h" 47 44 #include "core/input/InputManager.h" 48 45 #include "core/input/KeyBinder.h" … … 51 48 #include "core/XMLFile.h" 52 49 #include "overlays/console/InGameConsole.h" 53 #include "gui/GUIManager.h"54 50 #include "sound/SoundManager.h" 55 #include "GraphicsManager.h" 51 52 // HACK: 53 #include "overlays/map/Map.h" 56 54 57 55 namespace orxonox 58 56 { 59 DeclareGameState(GSGraphics, "graphics", true, true);57 DeclareGameState(GSGraphics, "graphics", false, true); 60 58 61 GSGraphics::GSGraphics(const GameStateConstrParams& params) 62 : GameState(params) 63 , inputManager_(0) 59 GSGraphics::GSGraphics(const GameStateInfo& info) 60 : GameState(info) 64 61 , console_(0) 65 , guiManager_(0)66 , graphicsManager_(0)67 62 , soundManager_(0) 68 63 , masterKeyBinder_(0) … … 70 65 , debugOverlay_(0) 71 66 { 67 // load master key bindings 68 masterInputState_ = InputManager::getInstance().createInputState("master", true); 69 masterKeyBinder_ = new KeyBinder(); 70 masterInputState_->setKeyHandler(masterKeyBinder_); 72 71 } 73 72 74 73 GSGraphics::~GSGraphics() 75 74 { 75 InputManager::getInstance().destroyState("master"); 76 delete this->masterKeyBinder_; 76 77 } 77 78 … … 93 94 void GSGraphics::activate() 94 95 { 95 GameMode::setShowsGraphics(true);96 97 // Load OGRE including the render window98 this->graphicsManager_ = new GraphicsManager();99 100 96 // load debug overlay 101 97 COUT(3) << "Loading Debug Overlay..." << std::endl; 102 this->debugOverlay_ = new XMLFile( (Core::getMediaPath() / "overlay" / "debug.oxo").string());98 this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo"); 103 99 Loader::open(debugOverlay_); 104 100 105 // The render window width and height are used to set up the mouse movement.106 size_t windowHnd = 0;107 Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();108 renderWindow->getCustomAttribute("WINDOW", &windowHnd);109 110 // Calls the InputManager which sets up the input devices.111 inputManager_ = new InputManager(windowHnd);112 113 // load master key bindings114 masterInputState_ = InputManager::getInstance().createInputState("master", true);115 masterKeyBinder_ = new KeyBinder();116 101 masterKeyBinder_->loadBindings("masterKeybindings.ini"); 117 masterInputState_->setKeyHandler(masterKeyBinder_);118 102 119 103 // Load the SoundManager … … 123 107 console_ = new InGameConsole(); 124 108 console_->initialise(); 125 126 // load the CEGUI interface127 guiManager_ = new GUIManager();128 guiManager_->initialise(renderWindow);129 109 130 110 // add console command to toggle GUI … … 154 134 */ 155 135 156 masterInputState_->setHandler(0);157 InputManager::getInstance().destroyState("master");158 delete this->masterKeyBinder_;159 160 delete this->guiManager_;161 136 delete this->console_; 162 137 … … 166 141 delete this->soundManager_; 167 142 168 delete this->inputManager_; 169 this->inputManager_ = 0; 170 171 delete graphicsManager_; 172 173 GameMode::setShowsGraphics(false); 143 // HACK: (destroys a resource smart pointer) 144 Map::hackDestroyMap(); 174 145 } 175 146 … … 203 174 } 204 175 205 uint64_t timeBeforeTick = time.getRealMicroseconds();206 207 this->inputManager_->update(time);208 176 this->console_->update(time); 209 210 uint64_t timeAfterTick = time.getRealMicroseconds();211 212 // Also add our tick time213 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);214 215 // Process gui events216 this->guiManager_->update(time);217 // Render218 this->graphicsManager_->update(time);219 177 } 220 178 } -
code/trunk/src/orxonox/gamestates/GSGraphics.h
r3327 r3370 50 50 { 51 51 public: 52 GSGraphics(const GameState ConstrParams& params);52 GSGraphics(const GameStateInfo& info); 53 53 ~GSGraphics(); 54 54 … … 61 61 private: 62 62 // managed singletons 63 InputManager* inputManager_; //!< Reference to input management64 63 InGameConsole* console_; 65 GUIManager* guiManager_; //!< Interface to GUI66 GraphicsManager* graphicsManager_; //!< Interface to Ogre67 64 SoundManager* soundManager_; //!< Keeps track of SoundBase objects 68 65 -
code/trunk/src/orxonox/gamestates/GSIOConsole.cc
r3280 r3370 38 38 DeclareGameState(GSIOConsole, "ioConsole", false, false); 39 39 40 GSIOConsole::GSIOConsole(const GameState ConstrParams& params)41 : GameState( params)40 GSIOConsole::GSIOConsole(const GameStateInfo& info) 41 : GameState(info) 42 42 { 43 43 } -
code/trunk/src/orxonox/gamestates/GSIOConsole.h
r3280 r3370 38 38 { 39 39 public: 40 GSIOConsole(const GameState ConstrParams& params);40 GSIOConsole(const GameStateInfo& info); 41 41 ~GSIOConsole(); 42 42 -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r3327 r3370 40 40 #include "core/GameMode.h" 41 41 #include "core/Core.h" 42 #include "core/GraphicsManager.h" 43 #include "core/GUIManager.h" 42 44 #include "core/Loader.h" 43 45 #include "core/XMLFile.h" … … 47 49 #include "objects/quest/QuestManager.h" 48 50 #include "overlays/notifications/NotificationManager.h" 49 #include "gui/GUIManager.h"50 51 #include "CameraManager.h" 51 #include "GraphicsManager.h"52 52 #include "LevelManager.h" 53 53 #include "PlayerManager.h" … … 55 55 namespace orxonox 56 56 { 57 DeclareGameState(GSLevel, "level", false, true);57 DeclareGameState(GSLevel, "level", false, false); 58 58 SetConsoleCommand(GSLevel, showIngameGUI, true); 59 59 60 60 XMLFile* GSLevel::startFile_s = NULL; 61 61 62 GSLevel::GSLevel(const GameState ConstrParams& params)63 : GameState( params)62 GSLevel::GSLevel(const GameStateInfo& info) 63 : GameState(info) 64 64 , keyBinder_(0) 65 65 , gameInputState_(0) -
code/trunk/src/orxonox/gamestates/GSLevel.h
r3327 r3370 41 41 { 42 42 public: 43 GSLevel(const GameState ConstrParams& params);43 GSLevel(const GameStateInfo& info); 44 44 ~GSLevel(); 45 45 void setConfigValues(); -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r3327 r3370 36 36 #include "core/Clock.h" 37 37 #include "core/ConsoleCommand.h" 38 #include "core/GraphicsManager.h" 39 #include "core/GUIManager.h" 38 40 #include "objects/Scene.h" 39 #include "gui/GUIManager.h"40 41 #include "sound/SoundMainMenu.h" 41 #include "GraphicsManager.h"42 42 43 43 namespace orxonox … … 45 45 DeclareGameState(GSMainMenu, "mainMenu", false, true); 46 46 47 GSMainMenu::GSMainMenu(const GameState ConstrParams& params)48 : GameState( params)47 GSMainMenu::GSMainMenu(const GameStateInfo& info) 48 : GameState(info) 49 49 , inputState_(0) 50 {51 }52 53 GSMainMenu::~GSMainMenu()54 {55 }56 57 void GSMainMenu::activate()58 50 { 59 51 inputState_ = InputManager::getInstance().createInputState("mainMenu"); … … 65 57 // and a Camera 66 58 this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera"); 59 } 67 60 61 GSMainMenu::~GSMainMenu() 62 { 63 InputManager::getInstance().destroyState("mainMenu"); 64 65 this->scene_->getSceneManager()->destroyCamera(this->camera_); 66 delete this->scene_; 67 } 68 69 void GSMainMenu::activate() 70 { 68 71 // show main menu 69 GUIManager::getInstance().showGUI("mainmenu_ 3");72 GUIManager::getInstance().showGUI("mainmenu_4"); 70 73 GUIManager::getInstance().setCamera(this->camera_); 71 74 GraphicsManager::getInstance().setCamera(this->camera_); … … 107 110 108 111 InputManager::getInstance().leaveState("mainMenu"); 109 InputManager::getInstance().destroyState("mainMenu");110 112 111 113 GUIManager::getInstance().setCamera(0); 112 114 GraphicsManager::getInstance().setCamera(0); 113 this->scene_->getSceneManager()->destroyCamera(this->camera_);114 delete this->scene_;115 115 116 116 /* -
code/trunk/src/orxonox/gamestates/GSMainMenu.h
r3327 r3370 40 40 { 41 41 public: 42 GSMainMenu(const GameState ConstrParams& params);42 GSMainMenu(const GameStateInfo& info); 43 43 ~GSMainMenu(); 44 44 -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r3304 r3370 30 30 31 31 #include "core/Clock.h" 32 #include "core/CommandLine.h"33 32 #include "core/ConsoleCommand.h" 34 33 #include "core/Game.h" 35 34 #include "core/GameMode.h" 35 #include "core/LuaBind.h" 36 36 #include "network/NetworkFunction.h" 37 #include "ToluaBindCore.h" 38 #include "ToluaBindOrxonox.h" 37 39 #include "tools/Timer.h" 38 40 #include "interfaces/TimeFactorListener.h" … … 42 44 namespace orxonox 43 45 { 44 DeclareGameState(GSRoot, "root", true, false); 45 SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); 46 // Shortcuts for easy direct loading 47 SetCommandLineSwitch(server).information("Start in server mode"); 48 SetCommandLineSwitch(client).information("Start in client mode"); 49 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); 50 SetCommandLineSwitch(standalone).information("Start in standalone mode"); 46 DeclareGameState(GSRoot, "root", false, false); 51 47 52 GSRoot::GSRoot(const GameState ConstrParams& params)53 : GameState( params)48 GSRoot::GSRoot(const GameStateInfo& info) 49 : GameState(info) 54 50 , timeFactor_(1.0f) 55 51 , bPaused_(false) … … 58 54 this->ccSetTimeFactor_ = 0; 59 55 this->ccPause_ = 0; 56 57 // Tell LuaBind about all tolua interfaces 58 LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core"); 59 LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox"); 60 60 } 61 61 … … 88 88 // create the global LevelManager 89 89 this->levelManager_ = new LevelManager(); 90 91 // Load level directly?92 bool loadLevel = false;93 if (CommandLine::getValue("standalone").getBool())94 {95 Game::getInstance().requestStates("graphics, standalone, level");96 loadLevel = true;97 }98 if (CommandLine::getValue("server").getBool())99 {100 Game::getInstance().requestStates("graphics, server, level");101 loadLevel = true;102 }103 if (CommandLine::getValue("client").getBool())104 {105 Game::getInstance().requestStates("graphics, client, level");106 loadLevel = true;107 }108 if (CommandLine::getValue("dedicated").getBool())109 {110 Game::getInstance().requestStates("dedicated, level");111 loadLevel = true;112 }113 114 // Determine where to start otherwise115 if (!loadLevel && !CommandLine::getValue("console").getBool())116 {117 // Also load graphics118 Game::getInstance().requestState("graphics");119 }120 90 } 121 91 … … 148 118 } 149 119 150 uint64_t timeBeforeTick = time.getRealMicroseconds();151 152 120 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it) 153 121 it->tick(time); … … 164 132 it->tick(leveldt * this->timeFactor_); 165 133 /*** HACK *** HACK ***/ 166 167 uint64_t timeAfterTick = time.getRealMicroseconds();168 169 // Also add our tick time170 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);171 134 } 172 135 … … 174 137 @brief 175 138 Changes the speed of Orxonox 139 @remark 140 This function is a hack when placed here! 141 Timefactor should be related to the scene (level or so), not the game 176 142 */ 177 143 void GSRoot::setTimeFactor(float factor) -
code/trunk/src/orxonox/gamestates/GSRoot.h
r3280 r3370 38 38 { 39 39 public: 40 GSRoot(const GameState ConstrParams& params);40 GSRoot(const GameStateInfo& info); 41 41 ~GSRoot(); 42 42 -
code/trunk/src/orxonox/gamestates/GSServer.cc
r3280 r3370 41 41 SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)"); 42 42 43 GSServer::GSServer(const GameState ConstrParams& params)44 : GameState( params)43 GSServer::GSServer(const GameStateInfo& info) 44 : GameState(info) 45 45 , server_(0) 46 46 { -
code/trunk/src/orxonox/gamestates/GSServer.h
r3280 r3370 40 40 { 41 41 public: 42 GSServer(const GameState ConstrParams& params);42 GSServer(const GameStateInfo& info); 43 43 ~GSServer(); 44 44 -
code/trunk/src/orxonox/gamestates/GSStandalone.cc
r3280 r3370 36 36 DeclareGameState(GSStandalone, "standalone", false, true); 37 37 38 GSStandalone::GSStandalone(const GameState ConstrParams& params)39 : GameState( params)38 GSStandalone::GSStandalone(const GameStateInfo& info) 39 : GameState(info) 40 40 { 41 41 } -
code/trunk/src/orxonox/gamestates/GSStandalone.h
r3280 r3370 38 38 { 39 39 public: 40 GSStandalone(const GameState ConstrParams& params);40 GSStandalone(const GameStateInfo& info); 41 41 ~GSStandalone(); 42 42 -
code/trunk/src/orxonox/objects/pickup/BaseItem.h
r3196 r3370 51 51 Daniel 'Huty' Haggenmueller 52 52 */ 53 class _OrxonoxExport BaseItem 54 // tolua_end 55 : public BaseObject 56 // tolua_begin 53 class _OrxonoxExport BaseItem : public BaseObject 57 54 { 58 55 // tolua_end -
code/trunk/src/orxonox/objects/pickup/PickupInventory.cc
r3327 r3370 37 37 38 38 #include "core/ConsoleCommand.h" 39 #include "core/GUIManager.h" 39 40 #include "core/input/InputManager.h" 40 #include "gui/GUIManager.h"41 41 #include "objects/controllers/HumanController.h" 42 42 #include "objects/worldentities/pawns/Pawn.h" -
code/trunk/src/orxonox/objects/pickup/PickupInventory.h
r3196 r3370 43 43 namespace orxonox 44 44 { 45 // tolua_end46 45 /** 47 46 @brief Static class for the inventory GUI window. 48 47 @author Daniel 'Huty' Haggenmueller 49 48 */ 50 // tolua_begin51 49 class _OrxonoxExport PickupInventory 52 50 { -
code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc
r3325 r3370 37 37 38 38 #include "core/CoreIncludes.h" 39 #include "core/GUIManager.h" // HACK; see below 39 40 #include "core/Template.h" 40 41 #include "core/XMLPort.h" 41 #include "gui/GUIManager.h" // HACK; see below42 42 #include "objects/worldentities/pawns/Pawn.h" 43 43 #include "PickupInventory.h" // HACK; Only for hack, remove later -
code/trunk/src/orxonox/objects/quest/QuestDescription.h
r3196 r3370 54 54 Damian 'Mozork' Frick 55 55 */ 56 class _OrxonoxExport QuestDescription 56 class _OrxonoxExport QuestDescription : public BaseObject 57 { 57 58 // tolua_end 58 : public BaseObject59 { // tolua_export60 59 public: 61 60 QuestDescription(BaseObject* creator); -
code/trunk/src/orxonox/objects/quest/QuestListener.cc
r3280 r3370 81 81 /** 82 82 @brief 83 Makes all QuestListener in the list aware that a certain status change has occur ed and executes them if the status change affects them.83 Makes all QuestListener in the list aware that a certain status change has occurred and executes them if the status change affects them. 84 84 @param listeners 85 85 The list of QuestListeners that have to be made aware of the status change. … … 182 182 else 183 183 { 184 COUT(1) << "An unforseen, never to happen, Error has occur ed. This is impossible!" << std::endl;184 COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl; 185 185 return ""; 186 186 } -
code/trunk/src/orxonox/objects/quest/QuestManager.cc
r3325 r3370 36 36 #include "util/Exception.h" 37 37 #include "core/CoreIncludes.h" 38 #include "gui/GUIManager.h"39 38 40 39 #include "objects/infos/PlayerInfo.h" … … 48 47 { 49 48 //! Pointer to the current (and single) instance of this class. 50 /*static*/ QuestManager* QuestManager::singleton Ref_s = NULL;49 /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL; 51 50 52 51 /** … … 59 58 { 60 59 RegisterRootObject(QuestManager); 61 62 assert(singletonRef_s == 0);63 singletonRef_s = this;64 60 } 65 61 … … 71 67 { 72 68 73 }74 75 /**76 @brief77 Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.78 @return79 Returns a reference to the single instance of the Quest Manager.80 */81 /*static*/ QuestManager & QuestManager::getInstance()82 {83 assert(singletonRef_s);84 return *singletonRef_s;85 69 } 86 70 … … 225 209 QuestContainer* QuestManager::getQuestTree(std::string & name) 226 210 { 227 GUIOverlay* gui = GUIManager::getInstance().getOverlay(name); 211 GUIOverlay* gui = NULL; 212 for (ObjectList<GUIOverlay>::iterator it = ObjectList<GUIOverlay>::begin(); it != ObjectList<GUIOverlay>::end(); ++it) 213 if (it->getGUIName() == name) 214 gui = *it; 228 215 229 216 PlayerInfo* player; … … 321 308 { 322 309 container->status = ""; 323 COUT(1) << "An error occur ed. A Quest of un-specified status wanted to be displayed." << std::endl;310 COUT(1) << "An error occurred. A Quest of un-specified status wanted to be displayed." << std::endl; 324 311 } 325 312 -
code/trunk/src/orxonox/objects/quest/QuestManager.h
r3196 r3370 40 40 #include <map> 41 41 #include <string> 42 43 #include "util/Singleton.h" 42 44 #include "core/OrxonoxClass.h" 43 45 … … 71 73 Damian 'Mozork' Frick 72 74 */ 73 class _OrxonoxExport QuestManager 74 // tolua_end 75 : public OrxonoxClass 76 // tolua_begin 75 class _OrxonoxExport QuestManager : public Singleton<QuestManager>, public orxonox::OrxonoxClass 77 76 { 78 77 // tolua_end 78 friend class Singleton<QuestManager>; 79 79 public: 80 80 QuestManager(); 81 81 virtual ~QuestManager(); 82 82 83 static QuestManager& getInstance(); // tolua_export //!< Returns a reference to the single instance of the Quest Manager. 83 //! Returns a reference to the single instance of the Quest Manager. 84 static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export 84 85 85 86 bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager. … … 92 93 93 94 private: 94 static QuestManager* singleton Ref_s;95 static QuestManager* singletonPtr_s; 95 96 96 97 std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's. -
code/trunk/src/orxonox/overlays/GUIOverlay.cc
r3327 r3370 34 34 #include "core/input/InputManager.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/GUIManager.h" 36 37 #include "core/XMLPort.h" 37 #include "gui/GUIManager.h"38 38 39 39 namespace orxonox … … 55 55 56 56 XMLPortParam(GUIOverlay, "guiname", setGUIName, getGUIName, xmlElement, mode); 57 58 GUIManager::getInstance().registerOverlay(this->guiName_, this);59 57 } 60 58 -
code/trunk/src/orxonox/overlays/console/InGameConsole.cc
r3327 r3370 60 60 SetConsoleCommand(InGameConsole, closeConsole, true); 61 61 62 InGameConsole* InGameConsole::singleton Ref_s = 0;62 InGameConsole* InGameConsole::singletonPtr_s = 0; 63 63 64 64 /** … … 76 76 RegisterObject(InGameConsole); 77 77 78 assert(singletonRef_s == 0);79 singletonRef_s = this;80 81 78 this->bActive_ = false; 82 79 this->cursor_ = 0.0f; … … 131 128 if (this->consoleOverlay_) 132 129 Ogre::OverlayManager::getSingleton().destroy(consoleOverlay_); 133 134 singletonRef_s = 0;135 130 } 136 131 -
code/trunk/src/orxonox/overlays/console/InGameConsole.h
r3327 r3370 34 34 35 35 #include <string> 36 36 37 #include "util/OgreForwardRefs.h" 38 #include "util/Singleton.h" 37 39 #include "core/Shell.h" 38 40 #include "core/WindowEventListener.h" … … 40 42 namespace orxonox 41 43 { 42 class _OrxonoxExport InGameConsole : public S hellListener, public WindowEventListener44 class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener 43 45 { 46 friend class Singleton<InGameConsole>; 44 47 public: // functions 45 48 InGameConsole(); … … 51 54 52 55 void update(const Clock& time); 53 54 static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }55 static InGameConsole* getInstancePtr() { return singletonRef_s; }56 56 57 57 static void openConsole(); … … 112 112 bool bHidesAllInput_; 113 113 114 static InGameConsole* singleton Ref_s;114 static InGameConsole* singletonPtr_s; 115 115 }; 116 116 } -
code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc
r3196 r3370 46 46 const std::string NotificationManager::NONE = "none"; 47 47 48 NotificationManager* NotificationManager::singleton Ref_s = NULL;48 NotificationManager* NotificationManager::singletonPtr_s = NULL; 49 49 50 50 /** … … 55 55 { 56 56 RegisterRootObject(NotificationManager); 57 58 assert(singletonRef_s == 0);59 singletonRef_s = this;60 57 61 58 this->highestIndex_ = 0; … … 70 67 } 71 68 72 /**73 @brief74 Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.75 @return76 Returns a reference to the single instance of the NotificationManager.77 */78 /*static*/ NotificationManager & NotificationManager::getInstance()79 {80 assert(singletonRef_s);81 return *singletonRef_s;82 }83 84 69 /** 85 70 @brief -
code/trunk/src/orxonox/overlays/notifications/NotificationManager.h
r3196 r3370 40 40 #include <map> 41 41 #include <string> 42 43 #include "util/Singleton.h" 42 44 #include "core/OrxonoxClass.h" 43 45 … … 52 54 Damian 'Mozork' Frick 53 55 */ 54 class _OrxonoxExport NotificationManager : public OrxonoxClass56 class _OrxonoxExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass 55 57 { 58 friend class Singleton<NotificationManager>; 56 59 public: 57 60 NotificationManager(); … … 60 63 static const std::string ALL; 61 64 static const std::string NONE; 62 63 static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.64 65 65 66 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. … … 88 89 89 90 private: 90 static NotificationManager* singleton Ref_s;91 static NotificationManager* singletonPtr_s; 91 92 92 93 int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice. -
code/trunk/src/orxonox/sound/SoundBase.cc
r3196 r3370 65 65 void SoundBase::update() { 66 66 if(this->entity_ != NULL && alIsSource(this->source_)) { 67 Vector3pos = this->entity_->getPosition();67 const Vector3& pos = this->entity_->getPosition(); 68 68 alSource3f(this->source_, AL_POSITION, pos.x, pos.y, pos.z); 69 69 ALenum error = alGetError(); … … 71 71 COUT(2) << "Sound: OpenAL: Invalid sound position" << std::endl; 72 72 73 Vector3vel = this->entity_->getVelocity();73 const Vector3& vel = this->entity_->getVelocity(); 74 74 alSource3f(this->source_, AL_VELOCITY, vel.x, vel.y, vel.z); 75 75 error = alGetError(); … … 77 77 COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl; 78 78 79 Quaternionorient = this->entity_->getOrientation();79 const Quaternion& orient = this->entity_->getOrientation(); 80 80 Vector3 at = orient.zAxis(); 81 81 alSource3f(this->source_, AL_DIRECTION, at.x, at.y, at.z); … … 190 190 if(ov_open(f, &vf, NULL, 0) < 0) 191 191 { 192 COUT(2) << "Sound: libvorbisfile: File seems notto be an Ogg Vorbis bitstream" << std::endl;192 COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl; 193 193 ov_clear(&vf); 194 194 return AL_NONE; -
code/trunk/src/orxonox/sound/SoundManager.cc
r3280 r3370 38 38 namespace orxonox 39 39 { 40 SoundManager* SoundManager::singleton Ref_s = NULL;40 SoundManager* SoundManager::singletonPtr_s = NULL; 41 41 42 42 /** … … 45 45 SoundManager::SoundManager() 46 46 { 47 assert(singletonRef_s == NULL);48 singletonRef_s = this;49 50 47 this->device_ = NULL; 51 48 this->soundavailable_ = true; … … 93 90 SoundManager::~SoundManager() 94 91 { 95 assert(singletonRef_s != NULL);96 singletonRef_s = NULL;97 98 92 alcDestroyContext(this->context_); 99 93 alcCloseDevice(this->device_); … … 148 142 149 143 // update listener orientation 150 Quaternionorient = camera->getOrientation();144 const Quaternion& orient = camera->getOrientation(); 151 145 Vector3 up = orient.xAxis(); // just a wild guess 152 146 Vector3 at = orient.zAxis(); -
code/trunk/src/orxonox/sound/SoundManager.h
r3280 r3370 32 32 #include <cassert> 33 33 #include <list> 34 #include "util/Singleton.h" 34 35 #include "interfaces/Tickable.h" 35 36 … … 42 43 * 43 44 */ 44 class _OrxonoxExport SoundManager : public Tickable45 class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable 45 46 { 47 friend class Singleton<SoundManager>; 46 48 public: 47 49 SoundManager(); … … 52 54 bool isSoundAvailable(); 53 55 54 static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }55 56 56 private: 57 57 ALCdevice* device_; … … 60 60 bool soundavailable_; 61 61 62 static SoundManager* singleton Ref_s;62 static SoundManager* singletonPtr_s; 63 63 }; // class SoundManager 64 64 } // namespace orxonox -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r3301 r3370 43 43 #include "util/Math.h" 44 44 #include "core/CoreIncludes.h" 45 #include "core/ConfigValueIncludes.h" 45 46 #include "core/GameMode.h" 46 #include "GraphicsManager.h"47 47 48 48 namespace orxonox … … 91 91 } 92 92 93 void ParticleInterface::setConfigValues() 94 { 95 SetConfigValue(globalDetailLevel_, 2) 96 .description("O: off, 1: low, 2: normal, 3: high").callback(this, &ParticleInterface::detailLevelChanged); 97 } 98 93 99 Ogre::ParticleEmitter* ParticleInterface::createNewEmitter() 94 100 { … … 180 186 this->detaillevel_ = level; 181 187 if (GameMode::showsGraphics()) 182 this->detailLevelChanged( GraphicsManager::getInstance().getDetailLevelParticle());183 } 184 185 void ParticleInterface::detailLevelChanged( unsigned int newlevel)186 { 187 if ( newlevel >= static_cast<unsigned int>(this->detaillevel_))188 this->detailLevelChanged(); 189 } 190 191 void ParticleInterface::detailLevelChanged() 192 { 193 if (this->globalDetailLevel_ >= this->detaillevel_) 188 194 this->bAllowedByLOD_ = true; 189 195 else -
code/trunk/src/orxonox/tools/ParticleInterface.h
r3280 r3370 47 47 ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel); 48 48 virtual ~ParticleInterface(); 49 void setConfigValues(); 49 50 50 51 inline Ogre::ParticleSystem* getParticleSystem() … … 77 78 { return this->bVisible_; } 78 79 79 void detailLevelChanged(unsigned int newlevel);80 80 void setDetailLevel(unsigned int level); 81 81 … … 90 90 private: 91 91 void updateVisibility(); 92 void detailLevelChanged(); 92 93 93 94 Ogre::ParticleSystem* particleSystem_; … … 96 97 bool bEnabled_; 97 98 bool bAllowedByLOD_; 98 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)99 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 99 100 float speedFactor_; 101 102 // config values 103 unsigned int globalDetailLevel_; //!< Global maximum detail level of particle effects (0: off, 1: low, 2: normal, 3: high) 100 104 101 105 static ParticleInterface* currentParticleInterface_s; -
code/trunk/src/orxonox/tools/Shader.cc
r3301 r3370 41 41 #include "core/CoreIncludes.h" 42 42 #include "core/GameMode.h" 43 #include " GraphicsManager.h"43 #include "core/GraphicsManager.h" 44 44 45 45 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.