Changeset 5695 for code/trunk/src/orxonox
- Timestamp:
- Aug 30, 2009, 2:22:00 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 16 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource2 (added) merged: 3373-3374,5594,5597,5610-5611,5614,5624,5641,5644-5646,5650-5664,5667-5672,5682-5684,5688-5691,5694
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/LevelManager.cc
r3370 r5695 30 30 31 31 #include <map> 32 #include < boost/filesystem.hpp>32 #include <OgreResourceGroupManager.h> 33 33 34 34 #include "core/CommandLine.h" … … 135 135 availableLevels_.clear(); 136 136 137 boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");138 boost::filesystem::directory_iterator end;137 availableLevels_ = *Ogre::ResourceGroupManager::getSingleton().findResourceNames( 138 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, "*.oxw"); 139 139 140 while (file != end) 141 { 142 if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~') 140 for (std::vector<std::string>::iterator it = availableLevels_.begin(); it != availableLevels_.end();) 141 if (it->find("old/") == 0) 142 it = availableLevels_.erase(it); 143 else 143 144 { 144 s td::string filename = file->path().leaf();145 if (filename.length() > 4)146 availableLevels_.push_back(filename.substr(0,filename.length()-4));145 size_t pos = it->find(".oxw"); 146 *it = it->substr(0, pos); 147 ++it; 147 148 } 148 ++file;149 }150 149 } 151 150 } -
code/trunk/src/orxonox/Main.cc
r5693 r5695 40 40 #include "core/CommandLine.h" 41 41 #include "core/Game.h" 42 #include "core/LuaState.h" 43 #include "ToluaBindOrxonox.h" 42 44 #include "Main.h" 43 45 … … 48 50 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); 49 51 SetCommandLineSwitch(standalone).information("Start in standalone mode"); 52 53 DeclareToluaInterface(Orxonox); 50 54 51 55 namespace orxonox -
code/trunk/src/orxonox/gamestates/GSDedicated.cc
r3370 r5695 28 28 29 29 #include "GSDedicated.h" 30 31 #include <iomanip> 32 #include <iostream> 33 #include <boost/bind.hpp> 30 34 31 35 #include "util/Debug.h" … … 37 41 #include "core/GameMode.h" 38 42 #include "network/Server.h" 39 40 #include <iostream>41 #include <iomanip>42 #include <boost/bind.hpp>43 43 44 44 #ifdef ORXONOX_PLATFORM_UNIX -
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r5693 r5695 96 96 // load debug overlay 97 97 COUT(3) << "Loading Debug Overlay..." << std::endl; 98 this->debugOverlay_ = new XMLFile( Core::getMediaPathString() + "overlay/debug.oxo");98 this->debugOverlay_ = new XMLFile("debug.oxo"); 99 99 Loader::open(debugOverlay_); 100 100 -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r5693 r5695 29 29 30 30 #include "GSLevel.h" 31 32 #include <OgreCompositorManager.h> 31 33 32 34 #include "core/input/InputManager.h" … … 166 168 */ 167 169 170 if (GameMode::showsGraphics()) 171 { 172 // unload all compositors (this is only necessary because we don't yet destroy all resources!) 173 Ogre::CompositorManager::getSingleton().removeAll(); 174 } 168 175 169 176 // this call will delete every BaseObject! … … 229 236 // call the loader 230 237 COUT(0) << "Loading level..." << std::endl; 231 startFile_s = new XMLFile( Core::getMediaPathString() + "levels" + '/' +LevelManager::getInstance().getDefaultLevel());238 startFile_s = new XMLFile(LevelManager::getInstance().getDefaultLevel()); 232 239 Loader::open(startFile_s); 233 240 } -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r3370 r5695 52 52 inputState_->setHandler(GUIManager::getInstancePtr()); 53 53 inputState_->setJoyStickHandler(&InputHandler::EMPTY); 54 inputState_->setIsExclusiveMouse(false); 54 55 55 56 // create an empty Scene … … 70 71 { 71 72 // show main menu 72 GUIManager::getInstance().showGUI(" mainmenu_4");73 GUIManager::getInstance().showGUI("MainMenu"); 73 74 GUIManager::getInstance().setCamera(this->camera_); 74 75 GraphicsManager::getInstance().setCamera(this->camera_); -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r5693 r5695 33 33 #include "core/Game.h" 34 34 #include "core/GameMode.h" 35 #include "core/LuaBind.h"36 35 #include "network/NetworkFunction.h" 37 #include "ToluaBindCore.h"38 #include "ToluaBindOrxonox.h"39 36 #include "tools/Timer.h" 40 37 #include "tools/interfaces/TimeFactorListener.h" … … 54 51 this->ccSetTimeFactor_ = 0; 55 52 this->ccPause_ = 0; 56 57 // Tell LuaBind about all tolua interfaces58 LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core");59 LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox");60 53 } 61 54 … … 86 79 } 87 80 88 // create the globalLevelManager81 // create the LevelManager 89 82 this->levelManager_ = new LevelManager(); 90 83 } -
code/trunk/src/orxonox/objects/Level.cc
r3325 r5695 53 53 this->registerVariables(); 54 54 this->xmlfilename_ = this->getFilename(); 55 56 if (this->xmlfilename_.length() >= Core::getMediaPathString().length())57 this->xmlfilename_ = this->xmlfilename_.substr(Core::getMediaPathString().length());58 55 } 59 56 … … 101 98 mask.include(Class(OverlayGroup)); // HACK to include the ChatOverlay 102 99 103 this->xmlfile_ = new XMLFile( Core::getMediaPathString() + this->xmlfilename_, mask);100 this->xmlfile_ = new XMLFile(mask, this->xmlfilename_); 104 101 105 102 Loader::open(this->xmlfile_); -
code/trunk/src/orxonox/objects/Script.cc
r3196 r5695 29 29 #include "Script.h" 30 30 31 #include <tinyxml/ticpp.h>32 31 #include "core/CoreIncludes.h" 33 #include "core/LuaBind.h" 32 #include "core/LuaState.h" 33 #include "core/XMLPort.h" 34 34 35 35 namespace orxonox 36 36 { 37 CreateFactory(Script);37 CreateFactory(Script); 38 38 39 Script::Script(BaseObject* creator) : BaseObject(creator)40 {41 RegisterObject(Script);39 Script::Script(BaseObject* creator) : BaseObject(creator) 40 { 41 RegisterObject(Script); 42 42 43 code_ = ""; 44 } 43 // Get a new LuaState 44 luaState_ = new LuaState(); 45 } 45 46 46 Script::~Script() 47 { 48 } 47 Script::~Script() 48 { 49 if (this->isInitialized()) 50 delete luaState_; 51 } 49 52 50 /** 51 @brief XML loading and saving. 52 @param xmlelement The XML-element 53 @param loading Loading (true) or saving (false) 54 */ 55 void Script::XMLPort(Element& xmlelement, XMLPort::Mode mode) 56 { 57 BaseObject::XMLPort(xmlelement, mode); 53 void Script::XMLPort(Element& xmlelement, XMLPort::Mode mode) 54 { 55 BaseObject::XMLPort(xmlelement, mode); 58 56 59 code_ = xmlelement.GetText(false);60 }57 XMLPortParam(Script, "code", setCode, getCode, xmlelement, mode); 58 } 61 59 62 void Script::execute() 63 { 64 LuaBind& lua = LuaBind::getInstance(); 65 lua.loadString(this->code_); 66 lua.run(); 67 } 60 void Script::execute() 61 { 62 luaState_->doString(code_); 63 } 68 64 } -
code/trunk/src/orxonox/objects/Script.h
r3196 r5695 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Script : public BaseObject40 {39 class _OrxonoxExport Script : public BaseObject 40 { 41 41 public: 42 Script(BaseObject* creator); 43 ~Script(); 44 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 void execute(); 42 Script(BaseObject* creator); 43 ~Script(); 44 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 void execute(); 46 47 void setCode(const std::string& code) { code_ = code; } 48 const std::string& getCode() const { return code_; } 46 49 47 50 private: 48 std::string code_; 49 }; 51 std::string code_; 52 LuaState* luaState_; 53 }; 50 54 } 51 55 -
code/trunk/src/orxonox/orxonox-main.vcproj.user.in
r5693 r5695 11 11 <DebugSettings 12 12 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 13 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"13 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 14 14 EnvironmentMerge="true" 15 15 /> … … 20 20 <DebugSettings 21 21 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 22 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"22 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 23 23 EnvironmentMerge="true" 24 24 /> … … 29 29 <DebugSettings 30 30 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 31 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"31 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 32 32 EnvironmentMerge="true" 33 33 /> … … 38 38 <DebugSettings 39 39 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 40 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"40 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 41 41 EnvironmentMerge="true" 42 42 /> -
code/trunk/src/orxonox/sound/SoundBase.cc
r3370 r5695 36 36 #include "util/Math.h" 37 37 #include "core/Core.h" 38 #include "core/Resource.h" 38 39 #include "orxonox/objects/worldentities/WorldEntity.h" 39 40 #include "SoundManager.h" … … 134 135 } 135 136 136 bool SoundBase::loadFile(std::string filename) { 137 filename = Core::getMediaPathString() + "/audio/" + filename; 138 137 bool SoundBase::loadFile(const std::string& filename) { 139 138 if(!SoundManager::getInstance().isSoundAvailable()) 140 139 { … … 144 143 145 144 COUT(3) << "Sound: OpenAL ALUT: loading file " << filename << std::endl; 146 this->buffer_ = alutCreateBufferFromFile(filename.c_str()); 145 // Get DataStream from the resources 146 shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 147 if (fileInfo == NULL) { 148 COUT(2) << "Warning: Sound file '" << filename << "' not found" << std::endl; 149 return false; 150 } 151 DataStreamPtr stream = Resource::open(filename); 152 // Read everything into a temporary buffer 153 char* buffer = new char[fileInfo->size]; 154 stream->read(buffer, fileInfo->size); 155 156 this->buffer_ = alutCreateBufferFromFileImage(buffer, fileInfo->size); 157 delete[] buffer; 158 147 159 if(this->buffer_ == AL_NONE) { 148 160 COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl; -
code/trunk/src/orxonox/sound/SoundBase.h
r5693 r5695 55 55 bool isStopped(); 56 56 57 bool loadFile( std::stringfilename);57 bool loadFile(const std::string& filename); 58 58 59 59 private: -
code/trunk/src/orxonox/tools/CMakeLists.txt
r5693 r5695 5 5 Mesh.cc 6 6 ParticleInterface.cc 7 ResourceCollection.cc 8 ResourceLocation.cc 7 9 Shader.cc 8 10 TextureGenerator.cc -
code/trunk/src/orxonox/tools/Mesh.cc
r3280 r5695 71 71 this->entity_->setCastShadows(this->bCastShadows_); 72 72 73 #if OGRE_VERSION < 0x010600 73 74 this->entity_->setNormaliseNormals(true); 74 75 /* … … 79 80 I don't know exactly what this means, but I put this here if there will be problems with shaders. 80 81 */ 82 #endif 81 83 } 82 84 catch (...) -
code/trunk/src/orxonox/tools/ResourceCollection.h
r5694 r5695 30 30 #define _ResourceCollection_H__ 31 31 32 #include " OrxonoxPrereqs.h"32 #include "tools/ToolsPrereqs.h" 33 33 34 34 #include <string> … … 40 40 class ResourceLocation; 41 41 42 class _ OrxonoxExport ResourceCollection : public BaseObject42 class _ToolsExport ResourceCollection : public BaseObject 43 43 { 44 44 public: -
code/trunk/src/orxonox/tools/ResourceLocation.h
r5694 r5695 30 30 #define _ResourceLocation_H__ 31 31 32 #include " OrxonoxPrereqs.h"32 #include "tools/ToolsPrereqs.h" 33 33 34 34 #include <string> … … 37 37 namespace orxonox 38 38 { 39 class _ OrxonoxExport ResourceLocation : public BaseObject39 class _ToolsExport ResourceLocation : public BaseObject 40 40 { 41 41 // for load/unload
Note: See TracChangeset
for help on using the changeset viewer.