Esempio n. 1
0
void OMW::Engine::loadBSA()
{
    const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa");

    for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter)
    {
        std::cout << "Adding " << iter->second.string() << std::endl;
        Bsa::addBSA(iter->second.string());
    }

    const Files::PathContainer& dataDirs = mFileCollections.getPaths();
    std::string dataDirectory;
    for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
    {
        dataDirectory = iter->string();
        std::cout << "Data dir " << dataDirectory << std::endl;
        Bsa::addDir(dataDirectory, mFSStrict);
    }
}
Esempio n. 2
0
void OMW::Engine::loadBSA()
{
    // We use separate resource groups to handle location priority.
    const Files::PathContainer& dataDirs = mFileCollections.getPaths();

    int i=0;
    for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
    {
        // Last data dir has the highest priority
        std::string groupName = "Data" + Ogre::StringConverter::toString(dataDirs.size()-i, 8, '0');
        Ogre::ResourceGroupManager::getSingleton ().createResourceGroup (groupName);

        std::string dataDirectory = iter->string();
        std::cout << "Data dir " << dataDirectory << std::endl;
        Bsa::addDir(dataDirectory, mFSStrict, groupName);
        ++i;
    }

    i=0;
    for (std::vector<std::string>::const_iterator archive = mArchives.begin(); archive != mArchives.end(); ++archive)
    {
        if (mFileCollections.doesExist(*archive))
        {
            // Last BSA has the highest priority
            std::string groupName = "DataBSA" + Ogre::StringConverter::toString(mArchives.size()-i, 8, '0');

            Ogre::ResourceGroupManager::getSingleton ().createResourceGroup (groupName);

            const std::string archivePath = mFileCollections.getPath(*archive).string();
            std::cout << "Adding BSA archive " << archivePath << std::endl;
            Bsa::addBSA(archivePath, groupName);
            ++i;
        }
        else
        {
            std::stringstream message;
            message << "Archive '" << *archive << "' not found";
            throw std::runtime_error(message.str());
        }
    }
}
Esempio n. 3
0
void OMW::Engine::loadBSA()
{
    const Files::MultiDirCollection& bsa = mFileCollections.getCollection (".bsa");

    for (Files::MultiDirCollection::TIter iter(bsa.begin()); iter!=bsa.end(); ++iter)
    {
        std::cout << "Adding " << iter->second.string() << std::endl;
        Bsa::addBSA(iter->second.string());
    }

    const Files::PathContainer& dataDirs = mFileCollections.getPaths();
    std::string dataDirectory;
    for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
    {
        dataDirectory = iter->string();
        std::cout << "Data dir " << dataDirectory << std::endl;
        Bsa::addDir(dataDirectory, mFSStrict);

        // Workaround until resource listing capabilities are added to DirArchive, we need those to list available splash screens
        addResourcesDirectory (dataDirectory);
    }
}
Esempio n. 4
0
  void SoundManager::startRandomTitle()
  {
    if(mCurrentPlaylist && !mCurrentPlaylist->empty())
    {
        Files::PathContainer::const_iterator fileIter = mCurrentPlaylist->begin();
        srand( time(NULL) );
        int r = rand() % mCurrentPlaylist->size() + 1;        //old random code

        std::advance(fileIter, r - 1);
        std::string music = fileIter->string();
        std::cout << "Playing " << music << "\n";

        try
        {
            streamMusicFull(music);
        }
        catch (std::exception &e)
        {
            std::cout << "  Music Error: " << e.what() << "\n";
        }
    }
  }