Enable loading modules from MOD files
This commit is contained in:
parent
b72ab32248
commit
f006d0ea1a
2 changed files with 14 additions and 10 deletions
|
@ -144,13 +144,11 @@ void Game::loadModuleNames() {
|
||||||
|
|
||||||
for (auto &entry : fs::directory_iterator(modules)) {
|
for (auto &entry : fs::directory_iterator(modules)) {
|
||||||
string filename(boost::to_lower_copy(entry.path().filename().string()));
|
string filename(boost::to_lower_copy(entry.path().filename().string()));
|
||||||
if (!boost::ends_with(filename, ".rim") || boost::ends_with(filename, "_s.rim")) continue;
|
if (boost::ends_with(filename, ".mod") || (boost::ends_with(filename, ".rim") && !boost::ends_with(filename, "_s.rim"))) {
|
||||||
|
string moduleName(boost::to_lower_copy(filename.substr(0, filename.size() - 4)));
|
||||||
string moduleName(boost::to_lower_copy(filename.substr(0, filename.size() - 4)));
|
_moduleNames.insert(move(moduleName));
|
||||||
_moduleNames.push_back(move(moduleName));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(_moduleNames.begin(), _moduleNames.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::setCursorType(CursorType type) {
|
void Game::setCursorType(CursorType type) {
|
||||||
|
@ -308,8 +306,13 @@ void Game::loadModuleResources(const string &moduleName) {
|
||||||
Resources::instance().clearTransientProviders();
|
Resources::instance().clearTransientProviders();
|
||||||
|
|
||||||
fs::path modulesPath(getPathIgnoreCase(_path, kModulesDirectoryName));
|
fs::path modulesPath(getPathIgnoreCase(_path, kModulesDirectoryName));
|
||||||
Resources::instance().indexRimFile(getPathIgnoreCase(modulesPath, moduleName + ".rim"), true);
|
fs::path modPath(getPathIgnoreCase(modulesPath, moduleName + ".mod"));
|
||||||
Resources::instance().indexRimFile(getPathIgnoreCase(modulesPath, moduleName + "_s.rim"), true);
|
if (fs::exists(modPath)) {
|
||||||
|
Resources::instance().indexErfFile(getPathIgnoreCase(modulesPath, moduleName + ".mod", false), true);
|
||||||
|
} else {
|
||||||
|
Resources::instance().indexRimFile(getPathIgnoreCase(modulesPath, moduleName + ".rim"), true);
|
||||||
|
Resources::instance().indexRimFile(getPathIgnoreCase(modulesPath, moduleName + "_s.rim"), true);
|
||||||
|
}
|
||||||
|
|
||||||
fs::path lipsPath(getPathIgnoreCase(_path, kLipsDirectoryName));
|
fs::path lipsPath(getPathIgnoreCase(_path, kLipsDirectoryName));
|
||||||
Resources::instance().indexErfFile(getPathIgnoreCase(lipsPath, moduleName + "_loc.mod"), true);
|
Resources::instance().indexErfFile(getPathIgnoreCase(lipsPath, moduleName + "_loc.mod"), true);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
|
@ -119,7 +120,7 @@ public:
|
||||||
CameraType cameraType() const { return _cameraType; }
|
CameraType cameraType() const { return _cameraType; }
|
||||||
ScriptRunner &scriptRunner() { return _scriptRunner; }
|
ScriptRunner &scriptRunner() { return _scriptRunner; }
|
||||||
Conversation &conversation() { return *_conversation; }
|
Conversation &conversation() { return *_conversation; }
|
||||||
const std::vector<std::string> &moduleNames() const { return _moduleNames; }
|
const std::set<std::string> &moduleNames() const { return _moduleNames; }
|
||||||
Combat &combat() { return _combat; }
|
Combat &combat() { return _combat; }
|
||||||
|
|
||||||
void setCursorType(CursorType type);
|
void setCursorType(CursorType type);
|
||||||
|
@ -231,7 +232,7 @@ private:
|
||||||
bool _paused { false };
|
bool _paused { false };
|
||||||
Conversation *_conversation { nullptr }; /**< pointer to either DialogGUI or ComputerGUI */
|
Conversation *_conversation { nullptr }; /**< pointer to either DialogGUI or ComputerGUI */
|
||||||
ProfileOverlay _profileOverlay;
|
ProfileOverlay _profileOverlay;
|
||||||
std::vector<std::string> _moduleNames;
|
std::set<std::string> _moduleNames;
|
||||||
Combat _combat;
|
Combat _combat;
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
|
|
Loading…
Reference in a new issue