[ZoneBuilder] Load native XModels when not explicitly specified in the csv
aka 'primary asset'
This commit is contained in:
parent
001939166b
commit
e1c85f81d6
@ -332,6 +332,8 @@ namespace Components
|
||||
|
||||
Game::XAssetHeader AssetHandler::FindAssetForZone(Game::XAssetType type, std::string filename, ZoneBuilder::Zone* builder, bool isSubAsset)
|
||||
{
|
||||
ZoneBuilder::Zone::AssetRecursionMarker _(builder);
|
||||
|
||||
Game::XAssetHeader header = { nullptr };
|
||||
if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header;
|
||||
|
||||
|
@ -7,7 +7,7 @@ namespace Assets
|
||||
void IFxEffectDef::load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
if (!header->data) this->loadEfx(header, name, builder); // Check if we have an editor fx
|
||||
if (!header->data) this->loadNative(header, name, builder); // Check if there is a native one
|
||||
if (!header->data /*&& !builder->isPrimaryAsset()*/) this->loadNative(header, name, builder); // Check if there is a native one
|
||||
if (!header->data) this->loadBinary(header, name, builder); // Check if we need to import a new one into the game
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,12 @@ namespace Assets
|
||||
|
||||
void IXModel::load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
if(!builder->isPrimaryAsset())
|
||||
{
|
||||
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())
|
||||
|
@ -18,11 +18,11 @@ namespace Components
|
||||
// Side note: if you need a fastfile larger than 100MB, you're doing it wrong-
|
||||
// Well, decompressed maps can get way larger than 100MB, so let's increase that.
|
||||
buffer(0xC800000),
|
||||
zoneName(name), dataMap("zone_source/" + name + ".csv"), branding{ nullptr }
|
||||
zoneName(name), dataMap("zone_source/" + name + ".csv"), branding{ nullptr }, assetDepth(0)
|
||||
{}
|
||||
|
||||
ZoneBuilder::Zone::Zone() : indexStart(0), externalSize(0), buffer(0xC800000),
|
||||
zoneName("null_zone"), dataMap(), branding{ nullptr }
|
||||
ZoneBuilder::Zone::Zone() : indexStart(0), externalSize(0), buffer(0xC800000), zoneName("null_zone"),
|
||||
dataMap(), branding{ nullptr }, assetDepth(0)
|
||||
{}
|
||||
|
||||
ZoneBuilder::Zone::~Zone()
|
||||
|
@ -14,6 +14,23 @@ namespace Components
|
||||
class Zone
|
||||
{
|
||||
public:
|
||||
class AssetRecursionMarker
|
||||
{
|
||||
public:
|
||||
AssetRecursionMarker(Zone* _builder) : builder(_builder)
|
||||
{
|
||||
this->builder->increaseAssetDepth();
|
||||
}
|
||||
|
||||
~AssetRecursionMarker()
|
||||
{
|
||||
this->builder->decreaseAssetDepth();
|
||||
}
|
||||
|
||||
private:
|
||||
Zone* builder;
|
||||
};
|
||||
|
||||
Zone(std::string zoneName);
|
||||
Zone();
|
||||
~Zone();
|
||||
@ -52,6 +69,10 @@ namespace Components
|
||||
|
||||
void incrementExternalSize(unsigned int size);
|
||||
|
||||
void increaseAssetDepth() { ++this->assetDepth; }
|
||||
void decreaseAssetDepth() { --this->assetDepth; }
|
||||
bool isPrimaryAsset() { return this->assetDepth <= 1; }
|
||||
|
||||
private:
|
||||
void loadFastFiles();
|
||||
|
||||
@ -89,6 +110,8 @@ namespace Components
|
||||
std::vector<std::pair<Game::XAsset, uint32_t>> aliasList;
|
||||
|
||||
Game::RawFile branding;
|
||||
|
||||
size_t assetDepth;
|
||||
};
|
||||
|
||||
ZoneBuilder();
|
||||
|
Loading…
Reference in New Issue
Block a user