mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-19 04:49:28 +00:00
Add precacher for mods
This commit is contained in:
parent
f7740eb6e8
commit
0611568d3e
5 changed files with 38 additions and 3 deletions
|
@ -2334,6 +2334,8 @@ void DSQ::playPositionalSfx(const std::string &name, const Vector &position, flo
|
|||
|
||||
void DSQ::shutdown()
|
||||
{
|
||||
mod.stop();
|
||||
|
||||
Network::shutdown();
|
||||
|
||||
scriptInterface.shutdown();
|
||||
|
|
|
@ -257,6 +257,7 @@ class Mod
|
|||
{
|
||||
public:
|
||||
Mod();
|
||||
~Mod();
|
||||
void clear();
|
||||
void setActive(bool v);
|
||||
void start();
|
||||
|
@ -297,6 +298,7 @@ protected:
|
|||
|
||||
std::string name;
|
||||
std::string path;
|
||||
Precacher modcache;
|
||||
};
|
||||
|
||||
class AquariaScreenTransition : public ScreenTransition
|
||||
|
|
|
@ -39,6 +39,11 @@ Mod::Mod()
|
|||
shuttingDown = false;
|
||||
}
|
||||
|
||||
Mod::~Mod()
|
||||
{
|
||||
modcache.clean();
|
||||
}
|
||||
|
||||
/*
|
||||
queue for actual stop and recache
|
||||
which happens in game::applystate
|
||||
|
@ -182,6 +187,23 @@ void Mod::recache()
|
|||
|
||||
core->resetTimer();
|
||||
}
|
||||
|
||||
if(active)
|
||||
{
|
||||
modcache.setBaseDir(dsq->secondaryTexturePath);
|
||||
std::string fname = path;
|
||||
if(fname[fname.length() - 1] != '/')
|
||||
fname += '/';
|
||||
fname += "precache.txt";
|
||||
fname = localisePath(fname, dsq->mod.getPath());
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
modcache.precacheList(fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
modcache.clean();
|
||||
}
|
||||
}
|
||||
|
||||
void Mod::start()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue