Allow loading assets from disk even if they're already in memory

This commit is contained in:
Louvenarde 2021-09-06 00:20:16 +02:00
parent 14dc718ef2
commit 27e9a22e43
3 changed files with 7 additions and 2 deletions

View File

@ -84,13 +84,14 @@ namespace Assets
void IXModel::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
{
if (!builder->isPrimaryAsset())
Components::FileSystem::File modelFile(Utils::String::VA("xmodel/%s.iw4xModel", name.data()));
if (!builder->isPrimaryAsset() && (Components::ZoneBuilder::MatchTechsetsDvar.get<bool>() || !modelFile.exists()))
{
header->model = Components::AssetHandler::FindOriginalAsset(this->getType(), name.data()).model;
if (header->model) return;
}
Components::FileSystem::File modelFile(Utils::String::VA("xmodel/%s.iw4xModel", name.data()));
if (modelFile.exists())
{

View File

@ -10,6 +10,9 @@ namespace Components
bool ZoneBuilder::Terminate;
std::thread ZoneBuilder::CommandThread;
Dvar::Var ZoneBuilder::MatchTechsetsDvar;
Dvar::Var ZoneBuilder::PreferDiskAssetsDvar;
ZoneBuilder::Zone::Zone(const std::string& name) : indexStart(0), externalSize(0),
// Reserve 100MB by default.

View File

@ -130,6 +130,7 @@ namespace Components
static std::vector<std::pair<Game::XAssetType, std::string>> EndAssetTrace();
static Game::XAssetHeader GetEmptyAssetIfCommon(Game::XAssetType type, const std::string& name, Zone* builder);
static Dvar::Var PreferDiskAssetsDvar;
private:
static int StoreTexture(Game::GfxImageLoadDef **loadDef, Game::GfxImage *image);