Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 30, 2009, 2:22:00 AM (15 years ago)
Author:
rgrieder
Message:

Merged resource2 branch back to trunk.

IMPORTANT NOTE:
Upon this merge you need to specifically call your data directory "data_extern" when checking it out (when you don't provide a name, it will be just called 'trunk').
The new CMake variable is EXTERNAL_DATA_DIRECTORY. DATA_DIRECTORY now points to the one the source part of the repository.
UPDATE YOUR DATA DIRECTORY AS WELL!!!

Location:
code/trunk
Files:
16 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/LevelManager.cc

    r3370 r5695  
    3030
    3131#include <map>
    32 #include <boost/filesystem.hpp>
     32#include <OgreResourceGroupManager.h>
    3333
    3434#include "core/CommandLine.h"
     
    135135        availableLevels_.clear();
    136136
    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");
    139139
    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
    143144            {
    144                 std::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;
    147148            }
    148             ++file;
    149         }
    150149    }
    151150}
  • code/trunk/src/orxonox/Main.cc

    r5693 r5695  
    4040#include "core/CommandLine.h"
    4141#include "core/Game.h"
     42#include "core/LuaState.h"
     43#include "ToluaBindOrxonox.h"
    4244#include "Main.h"
    4345
     
    4850SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
    4951SetCommandLineSwitch(standalone).information("Start in standalone mode");
     52
     53DeclareToluaInterface(Orxonox);
    5054
    5155namespace orxonox
  • code/trunk/src/orxonox/gamestates/GSDedicated.cc

    r3370 r5695  
    2828
    2929#include "GSDedicated.h"
     30
     31#include <iomanip>
     32#include <iostream>
     33#include <boost/bind.hpp>
    3034
    3135#include "util/Debug.h"
     
    3741#include "core/GameMode.h"
    3842#include "network/Server.h"
    39 
    40 #include <iostream>
    41 #include <iomanip>
    42 #include <boost/bind.hpp>
    4343
    4444#ifdef ORXONOX_PLATFORM_UNIX
  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r5693 r5695  
    9696        // load debug overlay
    9797        COUT(3) << "Loading Debug Overlay..." << std::endl;
    98         this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo");
     98        this->debugOverlay_ = new XMLFile("debug.oxo");
    9999        Loader::open(debugOverlay_);
    100100
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r5693 r5695  
    2929
    3030#include "GSLevel.h"
     31
     32#include <OgreCompositorManager.h>
    3133
    3234#include "core/input/InputManager.h"
     
    166168*/
    167169
     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        }
    168175
    169176        // this call will delete every BaseObject!
     
    229236        // call the loader
    230237        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());
    232239        Loader::open(startFile_s);
    233240    }
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r3370 r5695  
    5252        inputState_->setHandler(GUIManager::getInstancePtr());
    5353        inputState_->setJoyStickHandler(&InputHandler::EMPTY);
     54        inputState_->setIsExclusiveMouse(false);
    5455
    5556        // create an empty Scene
     
    7071    {
    7172        // show main menu
    72         GUIManager::getInstance().showGUI("mainmenu_4");
     73        GUIManager::getInstance().showGUI("MainMenu");
    7374        GUIManager::getInstance().setCamera(this->camera_);
    7475        GraphicsManager::getInstance().setCamera(this->camera_);
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r5693 r5695  
    3333#include "core/Game.h"
    3434#include "core/GameMode.h"
    35 #include "core/LuaBind.h"
    3635#include "network/NetworkFunction.h"
    37 #include "ToluaBindCore.h"
    38 #include "ToluaBindOrxonox.h"
    3936#include "tools/Timer.h"
    4037#include "tools/interfaces/TimeFactorListener.h"
     
    5451        this->ccSetTimeFactor_ = 0;
    5552        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");
    6053    }
    6154
     
    8679        }
    8780
    88         // create the global LevelManager
     81        // create the LevelManager
    8982        this->levelManager_ = new LevelManager();
    9083    }
  • code/trunk/src/orxonox/objects/Level.cc

    r3325 r5695  
    5353        this->registerVariables();
    5454        this->xmlfilename_ = this->getFilename();
    55 
    56         if (this->xmlfilename_.length() >= Core::getMediaPathString().length())
    57             this->xmlfilename_ = this->xmlfilename_.substr(Core::getMediaPathString().length());
    5855    }
    5956
     
    10198        mask.include(Class(OverlayGroup)); // HACK to include the ChatOverlay
    10299
    103         this->xmlfile_ = new XMLFile(Core::getMediaPathString() + this->xmlfilename_, mask);
     100        this->xmlfile_ = new XMLFile(mask, this->xmlfilename_);
    104101
    105102        Loader::open(this->xmlfile_);
  • code/trunk/src/orxonox/objects/Script.cc

    r3196 r5695  
    2929#include "Script.h"
    3030
    31 #include <tinyxml/ticpp.h>
    3231#include "core/CoreIncludes.h"
    33 #include "core/LuaBind.h"
     32#include "core/LuaState.h"
     33#include "core/XMLPort.h"
    3434
    3535namespace orxonox
    3636{
    37   CreateFactory(Script);
     37    CreateFactory(Script);
    3838
    39   Script::Script(BaseObject* creator) : BaseObject(creator)
    40   {
    41     RegisterObject(Script);
     39    Script::Script(BaseObject* creator) : BaseObject(creator)
     40    {
     41        RegisterObject(Script);
    4242
    43     code_ = "";
    44   }
     43        // Get a new LuaState
     44        luaState_ = new LuaState();
     45    }
    4546
    46   Script::~Script()
    47   {
    48   }
     47    Script::~Script()
     48    {
     49        if (this->isInitialized())
     50            delete luaState_;
     51    }
    4952
    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);
    5856
    59     code_ = xmlelement.GetText(false);
    60   }
     57        XMLPortParam(Script, "code", setCode, getCode, xmlelement, mode);
     58    }
    6159
    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    }
    6864}
  • code/trunk/src/orxonox/objects/Script.h

    r3196 r5695  
    3737namespace orxonox
    3838{
    39   class _OrxonoxExport Script : public BaseObject
    40   {
     39    class _OrxonoxExport Script : public BaseObject
     40    {
    4141    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_; }
    4649
    4750    private:
    48       std::string code_;
    49   };
     51        std::string code_;
     52        LuaState* luaState_;
     53    };
    5054}
    5155
  • code/trunk/src/orxonox/orxonox-main.vcproj.user.in

    r5693 r5695  
    1111                        <DebugSettings
    1212                                WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
    13                                 Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
     13                                Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
    1414                                EnvironmentMerge="true"
    1515                        />
     
    2020                        <DebugSettings
    2121                                WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
    22                                 Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
     22                                Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
    2323                                EnvironmentMerge="true"
    2424                        />
     
    2929                        <DebugSettings
    3030                                WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
    31                                 Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
     31                                Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
    3232                                EnvironmentMerge="true"
    3333                        />
     
    3838                        <DebugSettings
    3939                                WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
    40                                 Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
     40                                Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
    4141                                EnvironmentMerge="true"
    4242                        />
  • code/trunk/src/orxonox/sound/SoundBase.cc

    r3370 r5695  
    3636#include "util/Math.h"
    3737#include "core/Core.h"
     38#include "core/Resource.h"
    3839#include "orxonox/objects/worldentities/WorldEntity.h"
    3940#include "SoundManager.h"
     
    134135    }
    135136
    136     bool SoundBase::loadFile(std::string filename) {
    137         filename = Core::getMediaPathString() + "/audio/" + filename;
    138 
     137    bool SoundBase::loadFile(const std::string& filename) {
    139138        if(!SoundManager::getInstance().isSoundAvailable())
    140139        {
     
    144143
    145144        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
    147159        if(this->buffer_ == AL_NONE) {
    148160            COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
  • code/trunk/src/orxonox/sound/SoundBase.h

    r5693 r5695  
    5555        bool isStopped();
    5656
    57         bool loadFile(std::string filename);
     57        bool loadFile(const std::string& filename);
    5858
    5959    private:
  • code/trunk/src/orxonox/tools/CMakeLists.txt

    r5693 r5695  
    55  Mesh.cc
    66  ParticleInterface.cc
     7  ResourceCollection.cc
     8  ResourceLocation.cc
    79  Shader.cc
    810  TextureGenerator.cc
  • code/trunk/src/orxonox/tools/Mesh.cc

    r3280 r5695  
    7171                this->entity_->setCastShadows(this->bCastShadows_);
    7272
     73#if OGRE_VERSION < 0x010600
    7374                this->entity_->setNormaliseNormals(true);
    7475                /*
     
    7980                    I don't know exactly what this means, but I put this here if there will be problems with shaders.
    8081                */
     82#endif
    8183            }
    8284            catch (...)
  • code/trunk/src/orxonox/tools/ResourceCollection.h

    r5694 r5695  
    3030#define _ResourceCollection_H__
    3131
    32 #include "OrxonoxPrereqs.h"
     32#include "tools/ToolsPrereqs.h"
    3333
    3434#include <string>
     
    4040    class ResourceLocation;
    4141
    42     class _OrxonoxExport ResourceCollection : public BaseObject
     42    class _ToolsExport ResourceCollection : public BaseObject
    4343    {
    4444    public:
  • code/trunk/src/orxonox/tools/ResourceLocation.h

    r5694 r5695  
    3030#define _ResourceLocation_H__
    3131
    32 #include "OrxonoxPrereqs.h"
     32#include "tools/ToolsPrereqs.h"
    3333
    3434#include <string>
     
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ResourceLocation : public BaseObject
     39    class _ToolsExport ResourceLocation : public BaseObject
    4040    {
    4141        // for load/unload
Note: See TracChangeset for help on using the changeset viewer.