mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-23 14:35:02 +00:00
_mods/x/locales/y/* now works
This commit is contained in:
parent
e8872b09e5
commit
636c069403
5 changed files with 29 additions and 7 deletions
|
@ -98,6 +98,8 @@ void Mod::load(const std::string &p)
|
|||
name = p;
|
||||
path = baseModPath + p + "/";
|
||||
|
||||
setLocalisationModPath(path);
|
||||
|
||||
setActive(true);
|
||||
|
||||
TiXmlDocument d;
|
||||
|
@ -138,11 +140,7 @@ void Mod::load(const std::string &p)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(BBGE_BUILD_UNIX)
|
||||
dsq->secondaryTexturePath = path + "graphics/";
|
||||
#else
|
||||
dsq->secondaryTexturePath = "./" + path + "graphics/";
|
||||
#endif
|
||||
|
||||
dsq->sound->audioPath2 = path + "audio/";
|
||||
dsq->sound->setVoicePath2(path + "audio/");
|
||||
|
@ -250,6 +248,7 @@ void Mod::setActive(bool a)
|
|||
{
|
||||
if (!active)
|
||||
{
|
||||
setLocalisationModPath("");
|
||||
name = path = "";
|
||||
dsq->secondaryTexturePath = "";
|
||||
dsq->sound->audioPath2 = "";
|
||||
|
|
|
@ -26,6 +26,7 @@ static std::string _CFToStdString(CFStringRef cs)
|
|||
#endif
|
||||
|
||||
static std::string s_locale;
|
||||
static std::string s_modpath;
|
||||
|
||||
void setUsedLocale(const std::string& s)
|
||||
{
|
||||
|
@ -37,6 +38,26 @@ const char *getUsedLocale()
|
|||
return s_locale.c_str();
|
||||
}
|
||||
|
||||
void setLocalisationModPath(const std::string& s)
|
||||
{
|
||||
s_modpath = s;
|
||||
stringToLower(s_modpath);
|
||||
}
|
||||
|
||||
// hackish
|
||||
// intended to be used only for paths which are known to start with the mod path,
|
||||
// but can deal with it if this is not the case
|
||||
std::string localisePathInternalModpath(const std::string &path)
|
||||
{
|
||||
std::string tmp = path;
|
||||
stringToLower(tmp);
|
||||
|
||||
if(!strncmp(tmp.c_str(), s_modpath.c_str(), s_modpath.length()))
|
||||
return localisePath(path, s_modpath);
|
||||
|
||||
return localisePath(path);
|
||||
}
|
||||
|
||||
std::string localisePath(const std::string &path, const std::string& modpath /* = "" */)
|
||||
{
|
||||
if (s_locale.empty())
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
void setUsedLocale(const std::string& s);
|
||||
const char *getUsedLocale();
|
||||
void setLocalisationModPath(const std::string& s);
|
||||
std::string localisePath(const std::string &path, const std::string& modpath = "");
|
||||
std::string localisePathInternalModpath(const std::string &path);
|
||||
std::string getSystemLocale();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -927,7 +927,7 @@ bool SoundManager::playVoice(const std::string &name, SoundVoiceType svt, float
|
|||
if (!voicePath2.empty())
|
||||
{
|
||||
fn = voicePath2 + name + fileType;
|
||||
fn = localisePath(fn);
|
||||
fn = localisePathInternalModpath(fn);
|
||||
fn = core->adjustFilenameCase(fn);
|
||||
if (exists(fn)) checkOther = false;
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ Buffer SoundManager::loadSoundIntoBank(const std::string &filename, const std::s
|
|||
if (slt == SFXLOAD_LOCAL && !audioPath2.empty())
|
||||
{
|
||||
f = audioPath2 + filename + format;
|
||||
f = localisePath(f);
|
||||
f = localisePathInternalModpath(f);
|
||||
f = core->adjustFilenameCase(f);
|
||||
if (!exists(f))
|
||||
{
|
||||
|
|
|
@ -318,7 +318,7 @@ void Texture::load(std::string file)
|
|||
|
||||
if (found)
|
||||
{
|
||||
file = localisePath(file);
|
||||
file = localisePathInternalModpath(file);
|
||||
file = core->adjustFilenameCase(file);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue