diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index c6d092253..6a186b92e 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("Meshes\\bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF + cellRender.insertMesh("Meshes\\joker\\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 93bde48e3..5b5ff6511 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -36,12 +36,42 @@ using namespace Mangle::Stream; /// An OGRE Archive wrapping a BSAFile archive class DirArchive: public Ogre::FileSystemArchive { - //FileSystemArchive* arc; + + boost::filesystem::path currentdir; + std::map > m; + public: DirArchive(const String& name) : FileSystemArchive(name, "Dir") - { mType = "Dir";} + { mType = "Dir"; + currentdir = name; + + populateMap(currentdir); + + } + void populateMap(boost::filesystem::path d){ + //need to cut off first + boost::filesystem::directory_iterator dir_iter(d), dir_end; + std::vector filesind; + boost::filesystem::path f; + for(;dir_iter != dir_end; dir_iter++) + { + if(boost::filesystem::is_directory(*dir_iter)) + populateMap(*dir_iter); + else + { + + f = *dir_iter; + std::string s = f.string(); + filesind.push_back(s); + //std::cout << "File: " << s << "\n"; + } + } + m[d.string()] = filesind; + std::cout << "Directory: " << d.string() << filesind.size() << "\n"; + + } bool isCaseSensitive() const { return false; } @@ -50,6 +80,11 @@ class DirArchive: public Ogre::FileSystemArchive void unload() {} bool exists(const String& filename) { + //String s = filename; + //FileSystemArchive::findFiles(s, true, false, filenames.getPointer(), f.getPointer()); + // std::cout << "Filenames" << filenames.useCount() << "\n"; + + std::string copy = filename; if(OGRE_PLATFORM != OGRE_PLATFORM_WIN32) { @@ -61,6 +96,23 @@ class DirArchive: public Ogre::FileSystemArchive } } } + boost::filesystem::path p = copy; + + int last = copy.size() - 1; + int i = last; + + for (;last >= 0; i--) + { + if(copy.at(i) == '/' || copy.at(i) == '\\') + break; + } + std::string folder; + + folder = copy.substr(0, i); + + boost::filesystem::path folderpath = folder; + std::cout << "\nFull:" << p.string() << "\n"<< "Part:" << folderpath.string(); + return FileSystemArchive::exists(copy); } @@ -227,7 +279,7 @@ static void insertDirFactory() if(!init2) { ArchiveManager::getSingleton().addArchiveFactory( new DirArchiveFactory ); - init = true; + init2 = true; } } diff --git a/components/bsa/bsa_archive.hpp b/components/bsa/bsa_archive.hpp index 91fd2fe98..405856e8c 100644 --- a/components/bsa/bsa_archive.hpp +++ b/components/bsa/bsa_archive.hpp @@ -22,6 +22,7 @@ */ #include +#include #ifndef _BSA_ARCHIVE_H_ #define _BSA_ARCHIVE_H_