Add r_noVoid dvar to hide red fxs

This commit is contained in:
momo5502 2016-10-31 17:15:24 +01:00
parent 6d60d4050a
commit 4f4d4855e6

View File

@ -121,14 +121,6 @@ namespace Components
{ {
asset.material->sortKey = 0xE; asset.material->sortKey = 0xE;
} }
#ifdef DEBUG
// This is bad! We still want to see red-fxs in release mode
if (type == Game::XAssetType::ASSET_TYPE_XMODEL && name == "void")
{
asset.model->numLods = 0;
}
#endif
} }
bool AssetHandler::IsAssetEligible(Game::XAssetType type, Game::XAssetHeader *asset) bool AssetHandler::IsAssetEligible(Game::XAssetType type, Game::XAssetHeader *asset)
@ -320,6 +312,8 @@ namespace Components
AssetHandler::AssetHandler() AssetHandler::AssetHandler()
{ {
Dvar::Register<bool>("r_noVoid", false, Game::DVAR_FLAG_SAVED, "Disable void model (red fx)");
AssetHandler::ClearTemporaryAssets(); AssetHandler::ClearTemporaryAssets();
// DB_FindXAssetHeader // DB_FindXAssetHeader
@ -348,6 +342,14 @@ namespace Components
} }
}); });
AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool*)
{
if (Dvar::Var("r_noVoid").Get<bool>() && type == Game::XAssetType::ASSET_TYPE_XMODEL && name == "void")
{
asset.model->numLods = 0;
}
});
// Register asset interfaces // Register asset interfaces
if (ZoneBuilder::IsEnabled()) if (ZoneBuilder::IsEnabled())
{ {