2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-04-29 15:09:38 +00:00

Add IW3 PhysPreset dump logic (#744)

* Copied template from font.

* Create PhysPreset writer from Font dumper template.

* Completely refactor to match previous implementation.

* Remove files from previous implementation.

* Fix PhysPresetFields.

* Add missing fields and correct order.

* Add static infinity check as builtin does not work.

* Wasn't clang formatted.

* Remove unused 'perSurfaceSndAlias' field.

* Removed unsupported vals (tracer & vehicle) and un-needed vals (material).

* Make order match struct and mark 'tempDefaultToCylinder' as QBOOLEAN.

* Make order match struct and clamp vals for 'mass' and 'tempDefaultToCylinder'.

* Remove un-needed includes and add limits for float max.

* Remove clamping of mass.

* Use float max to determine if friction is infinite.

* Clang format.

* chore: formatting

* chore: do not use classes for obj constants

---------

Co-authored-by: njohnson <gitea.nicholasjohnson.info>
Co-authored-by: Jan Laupetin <jan@laupetin.net>
This commit is contained in:
Paging Red
2026-04-23 17:27:34 -04:00
committed by GitHub
parent 7a0109ab2e
commit 010ac3ad3e
48 changed files with 405 additions and 115 deletions
+14
View File
@@ -165,6 +165,20 @@ namespace IW3
bool tempDefaultToCylinder; bool tempDefaultToCylinder;
}; };
struct PhysPresetInfo
{
float mass;
float bounce;
float friction;
int isFrictionInfinity;
float bulletForceScale;
float explosiveForceScale;
const char* sndAliasPrefix;
float piecesSpreadFraction;
float piecesUpwardVelocity;
int tempDefaultToCylinder;
};
union XAnimIndices union XAnimIndices
{ {
char* _1; char* _1;
+10
View File
@@ -0,0 +1,10 @@
#pragma once
namespace IW3
{
static constexpr auto INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC";
static constexpr auto INFO_STRING_PREFIX_WEAPON = "WEAPONFILE";
static constexpr auto GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr auto GDF_FILENAME_WEAPON = "weapon.gdf";
} // namespace IW3
@@ -0,0 +1,19 @@
#pragma once
#include "Game/IW3/IW3.h"
namespace IW3
{
inline cspField_t phys_preset_fields[]{
{"mass", offsetof(PhysPresetInfo, mass), CSPFT_FLOAT },
{"bounce", offsetof(PhysPresetInfo, bounce), CSPFT_FLOAT },
{"friction", offsetof(PhysPresetInfo, friction), CSPFT_FLOAT },
{"isFrictionInfinity", offsetof(PhysPresetInfo, isFrictionInfinity), CSPFT_QBOOLEAN},
{"bulletForceScale", offsetof(PhysPresetInfo, bulletForceScale), CSPFT_FLOAT },
{"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT },
{"sndAliasPrefix", offsetof(PhysPresetInfo, sndAliasPrefix), CSPFT_STRING },
{"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT },
{"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT },
{"tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN},
};
}
+9 -15
View File
@@ -2,20 +2,14 @@
namespace IW4 namespace IW4
{ {
class ObjConstants static constexpr auto INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC";
{ static constexpr auto INFO_STRING_PREFIX_TRACER = "TRACER";
ObjConstants() = default; static constexpr auto INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE";
static constexpr auto INFO_STRING_PREFIX_WEAPON = "WEAPONFILE";
public: static constexpr auto GDF_FILENAME_MATERIAL = "material.gdf";
static constexpr const char* INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC"; static constexpr auto GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* INFO_STRING_PREFIX_TRACER = "TRACER"; static constexpr auto GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE"; static constexpr auto GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* INFO_STRING_PREFIX_WEAPON = "WEAPONFILE"; static constexpr auto GDF_FILENAME_WEAPON = "weapon.gdf";
static constexpr const char* GDF_FILENAME_MATERIAL = "material.gdf";
static constexpr const char* GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf";
};
} // namespace IW4 } // namespace IW4
+8 -14
View File
@@ -2,19 +2,13 @@
namespace IW5 namespace IW5
{ {
class ObjConstants static constexpr auto INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC";
{ static constexpr auto INFO_STRING_PREFIX_TRACER = "TRACER";
ObjConstants() = default; static constexpr auto INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE";
static constexpr auto INFO_STRING_PREFIX_WEAPON = "WEAPONFILE";
public: static constexpr auto GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC"; static constexpr auto GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* INFO_STRING_PREFIX_TRACER = "TRACER"; static constexpr auto GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE"; static constexpr auto GDF_FILENAME_WEAPON = "weapon.gdf";
static constexpr const char* INFO_STRING_PREFIX_WEAPON = "WEAPONFILE";
static constexpr const char* GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf";
};
} // namespace IW5 } // namespace IW5
+16 -22
View File
@@ -2,27 +2,21 @@
namespace T6 namespace T6
{ {
class ObjConstants static constexpr auto INFO_STRING_PREFIX_PHYS_CONSTRAINTS = "PHYSCONSTRAINTS";
{ static constexpr auto INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC";
ObjConstants() = default; static constexpr auto INFO_STRING_PREFIX_TRACER = "TRACER";
static constexpr auto INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE";
static constexpr auto INFO_STRING_PREFIX_WEAPON = "WEAPONFILE";
static constexpr auto INFO_STRING_PREFIX_WEAPON_ATTACHMENT = "ATTACHMENTFILE";
static constexpr auto INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE = "ATTACHMENTUNIQUEFILE";
static constexpr auto INFO_STRING_PREFIX_ZBARRIER = "ZBARRIER";
public: static constexpr auto GDF_FILENAME_PHYS_CONSTRAINTS = "physconstraints.gdf";
static constexpr const char* INFO_STRING_PREFIX_PHYS_CONSTRAINTS = "PHYSCONSTRAINTS"; static constexpr auto GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* INFO_STRING_PREFIX_PHYS_PRESET = "PHYSIC"; static constexpr auto GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* INFO_STRING_PREFIX_TRACER = "TRACER"; static constexpr auto GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* INFO_STRING_PREFIX_VEHICLE = "VEHICLEFILE"; static constexpr auto GDF_FILENAME_WEAPON = "weapon.gdf";
static constexpr const char* INFO_STRING_PREFIX_WEAPON = "WEAPONFILE"; static constexpr auto GDF_FILENAME_WEAPON_ATTACHMENT = "attachment.gdf";
static constexpr const char* INFO_STRING_PREFIX_WEAPON_ATTACHMENT = "ATTACHMENTFILE"; static constexpr auto GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE = "attachmentunique.gdf";
static constexpr const char* INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE = "ATTACHMENTUNIQUEFILE"; static constexpr auto GDF_FILENAME_ZBARRIER = "zbarrier.gdf";
static constexpr const char* INFO_STRING_PREFIX_ZBARRIER = "ZBARRIER";
static constexpr const char* GDF_FILENAME_PHYS_CONSTRAINTS = "physconstraints.gdf";
static constexpr const char* GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr const char* GDF_FILENAME_TRACER = "tracer.gdf";
static constexpr const char* GDF_FILENAME_VEHICLE = "vehicle.gdf";
static constexpr const char* GDF_FILENAME_WEAPON = "weapon.gdf";
static constexpr const char* GDF_FILENAME_WEAPON_ATTACHMENT = "attachment.gdf";
static constexpr const char* GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE = "attachmentunique.gdf";
static constexpr const char* GDF_FILENAME_ZBARRIER = "zbarrier.gdf";
};
} // namespace T6 } // namespace T6
@@ -1342,7 +1342,7 @@ namespace
{ {
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
/* /*
const auto* entry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_MATERIAL, assetName); const auto* entry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_MATERIAL, assetName);
if (!entry) if (!entry)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -24,7 +24,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_PHYS_PRESET, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_PHYS_PRESET, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -31,7 +31,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -33,7 +33,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_PHYS_CONSTRAINTS, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_PHYS_PRESET, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_PHYS_PRESET, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_PHYS_PRESET, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_TRACER, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_TRACER, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_TRACER, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_TRACER, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_VEHICLE, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_VEHICLE, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_VEHICLE, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_VEHICLE, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON_ATTACHMENT, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -33,7 +33,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_WEAPON_ATTACHMENT, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_WEAPON, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_WEAPON, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -25,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{ {
const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(ObjConstants::GDF_FILENAME_ZBARRIER, assetName); const auto* gdtEntry = m_gdt.GetGdtEntryByGdfAndName(GDF_FILENAME_ZBARRIER, assetName);
if (gdtEntry == nullptr) if (gdtEntry == nullptr)
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
@@ -32,7 +32,7 @@ namespace
return AssetCreationResult::NoAction(); return AssetCreationResult::NoAction();
InfoString infoString; InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, *file.m_stream)) if (!infoString.FromStream(INFO_STRING_PREFIX_ZBARRIER, *file.m_stream))
{ {
con::error("Could not parse as info string file: \"{}\"", fileName); con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure(); return AssetCreationResult::Failure();
@@ -0,0 +1,123 @@
#include "InfoStringFromStructConverter.h"
#include <cassert>
using namespace IW3;
void InfoStringFromStructConverter::FillFromBaseField(const cspField_t& field)
{
switch (static_cast<csParseFieldType_t>(field.iFieldType))
{
case CSPFT_STRING:
FillFromString(std::string(field.szName), field.iOffset);
break;
case CSPFT_STRING_MAX_STRING_CHARS:
FillFromStringBuffer(std::string(field.szName), field.iOffset, 1024);
break;
case CSPFT_STRING_MAX_QPATH:
FillFromStringBuffer(std::string(field.szName), field.iOffset, 64);
break;
case CSPFT_STRING_MAX_OSPATH:
FillFromStringBuffer(std::string(field.szName), field.iOffset, 256);
break;
case CSPFT_INT:
FillFromInt(std::string(field.szName), field.iOffset);
break;
case CSPFT_QBOOLEAN:
FillFromQBoolean(std::string(field.szName), field.iOffset);
break;
case CSPFT_FLOAT:
FillFromFloat(std::string(field.szName), field.iOffset);
break;
case CSPFT_MILLISECONDS:
FillFromMilliseconds(std::string(field.szName), field.iOffset);
break;
case CSPFT_FX:
{
const auto* fx = *reinterpret_cast<FxEffectDef**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (fx)
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(fx->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
case CSPFT_XMODEL:
{
const auto* model = *reinterpret_cast<XModel**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (model)
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(model->name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
case CSPFT_MATERIAL:
{
const auto* material = *reinterpret_cast<Material**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (material)
m_info_string.SetValueForKey(std::string(field.szName), std::string(AssetName(material->info.name)));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
case CSPFT_SOUND:
{
const auto* sndAlias = reinterpret_cast<SndAliasCustom*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
if (sndAlias->name)
m_info_string.SetValueForKey(std::string(field.szName), std::string(sndAlias->name->soundName));
else
m_info_string.SetValueForKey(std::string(field.szName), "");
break;
}
case CSPFT_NUM_BASE_FIELD_TYPES:
default:
assert(false);
break;
}
}
void InfoStringFromStructConverter::FillInfoString()
{
for (auto fieldIndex = 0u; fieldIndex < m_field_count; fieldIndex++)
{
const auto& field = m_fields[fieldIndex];
assert(field.iFieldType >= 0);
if (field.iFieldType < CSPFT_NUM_BASE_FIELD_TYPES)
FillFromBaseField(field);
else
FillFromExtensionField(field);
}
}
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure, const cspField_t* fields, const size_t fieldCount)
: InfoStringFromStructConverterBase(structure),
m_fields(fields),
m_field_count(fieldCount)
{
}
InfoStringFromStructConverter::InfoStringFromStructConverter(const void* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverterBase(structure, std::move(scriptStringValueCallback)),
m_fields(fields),
m_field_count(fieldCount)
{
}
@@ -0,0 +1,24 @@
#pragma once
#include "Game/IW3/IW3.h"
#include "InfoString/InfoStringFromStructConverterBase.h"
namespace IW3
{
class InfoStringFromStructConverter : public InfoStringFromStructConverterBase
{
protected:
const cspField_t* m_fields;
size_t m_field_count;
virtual void FillFromExtensionField(const cspField_t& field) = 0;
void FillFromBaseField(const cspField_t& field);
void FillInfoString() override;
public:
InfoStringFromStructConverter(const void* structure, const cspField_t* fields, size_t fieldCount);
InfoStringFromStructConverter(const void* structure,
const cspField_t* fields,
size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback);
};
} // namespace IW3
+2 -1
View File
@@ -6,6 +6,7 @@
#include "Image/ImageDumperIW3.h" #include "Image/ImageDumperIW3.h"
#include "Localize/LocalizeDumperIW3.h" #include "Localize/LocalizeDumperIW3.h"
#include "Maps/MapEntsDumperIW3.h" #include "Maps/MapEntsDumperIW3.h"
#include "PhysPreset/PhysPresetInfoStringDumperIW3.h"
#include "RawFile/RawFileDumperIW3.h" #include "RawFile/RawFileDumperIW3.h"
#include "Sound/LoadedSoundDumperIW3.h" #include "Sound/LoadedSoundDumperIW3.h"
#include "StringTable/StringTableDumperIW3.h" #include "StringTable/StringTableDumperIW3.h"
@@ -14,7 +15,7 @@ using namespace IW3;
void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context) void ObjWriter::RegisterAssetDumpers(AssetDumpingContext& context)
{ {
// REGISTER_DUMPER(AssetDumperPhysPreset) RegisterAssetDumper(std::make_unique<phys_preset::InfoStringDumperIW3>());
// REGISTER_DUMPER(AssetDumperXAnimParts) // REGISTER_DUMPER(AssetDumperXAnimParts)
RegisterAssetDumper(std::make_unique<xmodel::DumperIW3>()); RegisterAssetDumper(std::make_unique<xmodel::DumperIW3>());
RegisterAssetDumper(std::make_unique<material::JsonDumperIW3>()); RegisterAssetDumper(std::make_unique<material::JsonDumperIW3>());
@@ -0,0 +1,104 @@
#include "PhysPresetInfoStringDumperIW3.h"
#include "Game/IW3/InfoString/InfoStringFromStructConverter.h"
#include "Game/IW3/ObjConstantsIW3.h"
#include "Game/IW3/PhysPreset/PhysPresetFields.h"
#include "PhysPreset/PhysPresetCommon.h"
#include <cassert>
#include <limits>
#include <type_traits>
using namespace IW3;
namespace
{
class InfoStringFromPhysPresetConverter final : public InfoStringFromStructConverter
{
protected:
void FillFromExtensionField(const cspField_t& field) override
{
assert(false);
}
public:
InfoStringFromPhysPresetConverter(const PhysPresetInfo* structure,
const cspField_t* fields,
const size_t fieldCount,
std::function<std::string(scr_string_t)> scriptStringValueCallback)
: InfoStringFromStructConverter(structure, fields, fieldCount, std::move(scriptStringValueCallback))
{
}
};
void CopyToPhysPresetInfo(const PhysPreset* physPreset, PhysPresetInfo* physPresetInfo)
{
physPresetInfo->mass = physPreset->mass;
physPresetInfo->bounce = physPreset->bounce;
if (physPreset->friction >= std::numeric_limits<float>::max())
{
physPresetInfo->isFrictionInfinity = 1;
physPresetInfo->friction = 0;
}
else
{
physPresetInfo->isFrictionInfinity = 0;
physPresetInfo->friction = physPreset->friction;
}
physPresetInfo->bulletForceScale = physPreset->bulletForceScale;
physPresetInfo->explosiveForceScale = physPreset->explosiveForceScale;
physPresetInfo->sndAliasPrefix = physPreset->sndAliasPrefix;
physPresetInfo->piecesSpreadFraction = physPreset->piecesSpreadFraction;
physPresetInfo->piecesUpwardVelocity = physPreset->piecesUpwardVelocity;
physPresetInfo->tempDefaultToCylinder = physPreset->tempDefaultToCylinder ? 1 : 0;
}
InfoString CreateInfoString(const XAssetInfo<PhysPreset>& asset)
{
auto* physPresetInfo = new PhysPresetInfo;
CopyToPhysPresetInfo(asset.Asset(), physPresetInfo);
InfoStringFromPhysPresetConverter converter(physPresetInfo,
phys_preset_fields,
std::extent_v<decltype(phys_preset_fields)>,
[asset](const scr_string_t scrStr) -> std::string
{
assert(scrStr < asset.m_zone->m_script_strings.Count());
if (scrStr >= asset.m_zone->m_script_strings.Count())
return "";
return asset.m_zone->m_script_strings[scrStr];
});
return converter.Convert();
}
} // namespace
namespace phys_preset
{
void InfoStringDumperIW3::DumpAsset(AssetDumpingContext& context, const XAssetInfo<AssetPhysPreset::Type>& asset)
{
// Only dump raw when no gdt available
if (context.m_gdt)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_PHYS_PRESET);
infoString.ToGdtProperties(INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry);
}
else
{
const auto assetFile = context.OpenAssetFile(GetFileNameForAssetName(asset.m_name));
if (!assetFile)
return;
auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_PHYS_PRESET);
stream.write(stringValue.c_str(), stringValue.size());
}
}
} // namespace phys_preset
@@ -0,0 +1,13 @@
#pragma once
#include "Dumping/AbstractAssetDumper.h"
#include "Game/IW3/IW3.h"
namespace phys_preset
{
class InfoStringDumperIW3 final : public AbstractAssetDumper<IW3::AssetPhysPreset>
{
protected:
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<IW3::AssetPhysPreset::Type>& asset) override;
};
} // namespace phys_preset
@@ -168,7 +168,7 @@ namespace
GdtEntry& CreateGdtEntry() GdtEntry& CreateGdtEntry()
{ {
m_entry = GdtEntry(); m_entry = GdtEntry();
m_entry.m_gdf_name = ObjConstants::GDF_FILENAME_MATERIAL; m_entry.m_gdf_name = GDF_FILENAME_MATERIAL;
m_entry.m_name = m_material.info.name; m_entry.m_name = m_material.info.name;
SetCommonValues(); SetCommonValues();
@@ -86,8 +86,8 @@ namespace phys_preset
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_PHYS_PRESET); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_PHYS_PRESET);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -99,7 +99,7 @@ namespace phys_preset
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_PHYS_PRESET);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -58,8 +58,8 @@ namespace tracer
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_TRACER); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_TRACER);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_TRACER, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_TRACER, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -71,7 +71,7 @@ namespace tracer
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_TRACER); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_TRACER);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -99,8 +99,8 @@ namespace vehicle
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_VEHICLE); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_VEHICLE);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_VEHICLE, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_VEHICLE, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -112,7 +112,7 @@ namespace vehicle
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_VEHICLE); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_VEHICLE);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -411,8 +411,8 @@ namespace weapon
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -424,7 +424,7 @@ namespace weapon
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_WEAPON);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
@@ -741,8 +741,8 @@ namespace weapon
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -754,7 +754,7 @@ namespace weapon
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_WEAPON);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
@@ -67,8 +67,8 @@ namespace phys_constraints
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_PHYS_CONSTRAINTS); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_PHYS_CONSTRAINTS);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_PHYS_CONSTRAINTS, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -80,7 +80,7 @@ namespace phys_constraints
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_CONSTRAINTS); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_PHYS_CONSTRAINTS);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -88,8 +88,8 @@ namespace phys_preset
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_PHYS_PRESET); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_PHYS_PRESET);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -101,7 +101,7 @@ namespace phys_preset
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_PHYS_PRESET);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -66,8 +66,8 @@ namespace tracer
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_TRACER); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_TRACER);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_TRACER, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_TRACER, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -79,7 +79,7 @@ namespace tracer
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_TRACER); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_TRACER);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -117,8 +117,8 @@ namespace vehicle
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_VEHICLE); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_VEHICLE);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_VEHICLE, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_VEHICLE, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -130,7 +130,7 @@ namespace vehicle
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_VEHICLE); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_VEHICLE);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -73,8 +73,8 @@ namespace attachment
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON_ATTACHMENT);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON_ATTACHMENT, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -86,7 +86,7 @@ namespace attachment
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_WEAPON_ATTACHMENT);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -137,8 +137,8 @@ namespace attachment_unique
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -150,7 +150,7 @@ namespace attachment_unique
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }
@@ -467,8 +467,8 @@ namespace weapon
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -480,7 +480,7 @@ namespace weapon
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_WEAPON); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_WEAPON);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
@@ -56,8 +56,8 @@ namespace z_barrier
if (context.m_gdt) if (context.m_gdt)
{ {
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_ZBARRIER); GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_ZBARRIER);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_ZBARRIER, gdtEntry); infoString.ToGdtProperties(INFO_STRING_PREFIX_ZBARRIER, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry); context.m_gdt->WriteEntry(gdtEntry);
} }
else else
@@ -69,7 +69,7 @@ namespace z_barrier
auto& stream = *assetFile; auto& stream = *assetFile;
const auto infoString = CreateInfoString(asset); const auto infoString = CreateInfoString(asset);
const auto stringValue = infoString.ToString(ObjConstants::INFO_STRING_PREFIX_ZBARRIER); const auto stringValue = infoString.ToString(INFO_STRING_PREFIX_ZBARRIER);
stream.write(stringValue.c_str(), stringValue.size()); stream.write(stringValue.c_str(), stringValue.size());
} }
} }