[IWeapon] More writer fixes for weapons
This commit is contained in:
parent
a2b90deefe
commit
5eb9996aea
@ -6,7 +6,15 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
void IWeapon::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
void IWeapon::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||||
{
|
{
|
||||||
return;
|
// Try loading raw weapon
|
||||||
|
if (Components::FileSystem::File(Utils::String::VA("weapons/mp/%s", name.data())).exists())
|
||||||
|
{
|
||||||
|
// let the function see temporary assets when calling DB_FindXAssetHeader during the loading function
|
||||||
|
// otherwise it fails to link things properly
|
||||||
|
Components::AssetHandler::ExposeTemporaryAssets(true);
|
||||||
|
header->data = Game::BG_LoadWeaponDef_LoadObj(name.data());
|
||||||
|
Components::AssetHandler::ExposeTemporaryAssets(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IWeapon::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
void IWeapon::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
@ -14,35 +22,50 @@ namespace Assets
|
|||||||
Game::WeaponCompleteDef* asset = header.weapon;
|
Game::WeaponCompleteDef* asset = header.weapon;
|
||||||
|
|
||||||
// convert all script strings
|
// convert all script strings
|
||||||
|
if (asset->hideTags)
|
||||||
|
{
|
||||||
for (char i = 0; i < 32; ++i)
|
for (char i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
if (asset->hideTags[i] == NULL) break; // no more strings
|
if (asset->hideTags[i] == NULL) break; // no more strings
|
||||||
builder->addScriptString(asset->hideTags[i]);
|
builder->addScriptString(asset->hideTags[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->weapDef->notetrackSoundMapKeys)
|
||||||
|
{
|
||||||
for (char i = 0; i < 16; ++i)
|
for (char i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->notetrackSoundMapKeys[i] == NULL) break; // no more strings
|
if (asset->weapDef->notetrackSoundMapKeys[i] == NULL) break; // no more strings
|
||||||
builder->addScriptString(asset->weapDef->notetrackSoundMapKeys[i]);
|
builder->addScriptString(asset->weapDef->notetrackSoundMapKeys[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->weapDef->notetrackSoundMapValues)
|
||||||
|
{
|
||||||
for (char i = 0; i < 16; ++i)
|
for (char i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->notetrackSoundMapValues[i] == NULL) break; // no more strings
|
if (asset->weapDef->notetrackSoundMapValues[i] == NULL) break; // no more strings
|
||||||
builder->addScriptString(asset->weapDef->notetrackSoundMapValues[i]);
|
builder->addScriptString(asset->weapDef->notetrackSoundMapValues[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->weapDef->notetrackRumbleMapKeys)
|
||||||
|
{
|
||||||
for (char i = 0; i < 16; ++i)
|
for (char i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->notetrackRumbleMapKeys[i] == NULL) break; // no more strings
|
if (asset->weapDef->notetrackRumbleMapKeys[i] == NULL) break; // no more strings
|
||||||
builder->addScriptString(asset->weapDef->notetrackRumbleMapKeys[i]);
|
builder->addScriptString(asset->weapDef->notetrackRumbleMapKeys[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asset->weapDef->notetrackRumbleMapValues)
|
||||||
|
{
|
||||||
for (char i = 0; i < 16; ++i)
|
for (char i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->notetrackRumbleMapValues[i] == NULL) break; // no more strings
|
if (asset->weapDef->notetrackRumbleMapValues[i] == NULL) break; // no more strings
|
||||||
builder->addScriptString(asset->weapDef->notetrackRumbleMapValues[i]);
|
builder->addScriptString(asset->weapDef->notetrackRumbleMapValues[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// now load all sub-assets properly
|
// now load all sub-assets properly
|
||||||
@ -58,17 +81,23 @@ namespace Assets
|
|||||||
if (asset->weapDef->overlayMaterialEMP) builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->weapDef->overlayMaterialEMP);
|
if (asset->weapDef->overlayMaterialEMP) builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->weapDef->overlayMaterialEMP);
|
||||||
if (asset->weapDef->overlayMaterialEMPLowRes) builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->weapDef->overlayMaterialEMPLowRes);
|
if (asset->weapDef->overlayMaterialEMPLowRes) builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->weapDef->overlayMaterialEMPLowRes);
|
||||||
|
|
||||||
|
if (asset->weapDef->gunXModel)
|
||||||
|
{
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->gunXModel[i]) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->gunXModel[i]);
|
if (asset->weapDef->gunXModel[i]) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->gunXModel[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->handXModel);
|
if (asset->weapDef->handXModel) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->handXModel);
|
||||||
|
|
||||||
|
if (asset->weapDef->worldModel)
|
||||||
|
{
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (asset->weapDef->worldModel[i]) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->worldModel[i]);
|
if (asset->weapDef->worldModel[i]) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->worldModel[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (asset->weapDef->worldClipModel) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->worldClipModel);
|
if (asset->weapDef->worldClipModel) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->worldClipModel);
|
||||||
if (asset->weapDef->rocketModel) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->rocketModel);
|
if (asset->weapDef->rocketModel) builder->loadAsset(Game::XAssetType::ASSET_TYPE_XMODEL, asset->weapDef->rocketModel);
|
||||||
|
Loading…
Reference in New Issue
Block a user