diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 6725497c1..5c51ab513 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -111,16 +111,16 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt) mAnimationState->setLoop(true); //npcmodel->getSkeleton()-> - mAnimationState->setEnabled(true); - + mAnimationState->setEnabled(true); + + + - - Ogre::AnimationState *mAnimationState2 = creaturemodel->getAnimationState("WholeThing2"); mAnimationState2->setLoop(true); mAnimationState2->setWeight(.5); - mAnimationState2->setEnabled(true); - + mAnimationState2->setEnabled(true); + mAnimationState2->createBlendMask(creaturemodel->getSkeleton()->getNumBones(),1); mAnimationState->createBlendMask(creaturemodel->getSkeleton()->getNumBones(),1); for(int j = 2; j < creaturemodel->getSkeleton()->getNumBones(); j++) @@ -130,11 +130,11 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt) } // set skeleton std::cout << "TimePosition:" << mAnimationState->getTimePosition() << "\n"; - + mAnimationState->addTime(evt.timeSinceLastFrame); mAnimationState2->addTime(evt.timeSinceLastFrame); //npcmodel->_updateAnimation(); - //mAnimationState2->setEnabled(true); + //mAnimationState2->setEnabled(true); creaturedataiter++; }*/ @@ -297,6 +297,10 @@ void OMW::Engine::loadBSA() addBSA (iter->second.string()); } + std::string m = mDataDir.string(); + std::cout << "Data dir" << m << "\n"; + addDir(m); + } // add resources directory @@ -394,8 +398,8 @@ void OMW::Engine::go() mOgre.configure(!isFile(ogreCfg.c_str()), cfgUserDir, plugCfg, false); - addResourcesDirectory (mDataDir / "Meshes"); - addResourcesDirectory (mDataDir / "Textures"); + //addResourcesDirectory (mDataDir / "Meshes"); + //addResourcesDirectory (mDataDir / "Textures"); // This has to be added BEFORE MyGUI is initialized, as it needs // to find core.xml here. diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 2b5bbbc4d..6fab8841a 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -118,7 +118,7 @@ namespace MWClass Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75); if (groin){ - cellRender.insertMesh("bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF + //cellRender.insertMesh("Meshes/bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF //bald_MJ_hat.NIF cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers); addresses2[numbers] = npcName + "groin"; diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 643845e25..552084c41 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -23,6 +23,7 @@ #include "bsa_archive.hpp" +#include #include #include #include @@ -33,6 +34,29 @@ using namespace Ogre; using namespace Mangle::Stream; /// An OGRE Archive wrapping a BSAFile archive +class DirArchive: public Ogre::FileSystemArchive +{ + //FileSystemArchive* arc; + public: + + DirArchive(const String& name) + : FileSystemArchive(name, "Dir") + { mType = "Dir";} + + bool isCaseSensitive() const { return false; } + + // The archive is loaded in the constructor, and never unloaded. + void load() {} + void unload() {} + + DataStreamPtr open(const String& filename, bool readonly = true) const + { + std::string copy = filename; + return FileSystemArchive::open(copy, readonly); + } + +}; + class BSAArchive : public Archive { BSAFile arc; @@ -145,8 +169,26 @@ public: void destroyInstance( Archive* arch) { delete arch; } }; +class DirArchiveFactory : public FileSystemArchiveFactory +{ +public: + const String& getType() const + { + static String name = "Dir"; + return name; + } + + Archive *createInstance( const String& name ) + { + return new DirArchive(name); + } + + void destroyInstance( Archive* arch) { delete arch; } +}; + static bool init = false; +static bool init2 = false; static void insertBSAFactory() { if(!init) @@ -156,6 +198,15 @@ static void insertBSAFactory() } } +static void insertDirFactory() +{ + if(!init2) + { + ArchiveManager::getSingleton().addArchiveFactory( new DirArchiveFactory ); + init = true; + } +} + // The function below is the only publicly exposed part of this file void addBSA(const std::string& name, const std::string& group) @@ -166,6 +217,7 @@ void addBSA(const std::string& name, const std::string& group) } void addDir(const std::string& name, const std::string& group) { + insertDirFactory(); ResourceGroupManager::getSingleton(). - addResourceLocation(name, "FileSystem", group); + addResourceLocation(name, "Dir", group); }