2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-06-06 16:52:35 +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
@@ -168,7 +168,7 @@ namespace
GdtEntry& CreateGdtEntry()
{
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;
SetCommonValues();
@@ -86,8 +86,8 @@ namespace phys_preset
if (context.m_gdt)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_PHYS_PRESET);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry);
GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_PHYS_PRESET);
infoString.ToGdtProperties(INFO_STRING_PREFIX_PHYS_PRESET, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry);
}
else
@@ -99,7 +99,7 @@ namespace phys_preset
auto& stream = *assetFile;
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());
}
}
@@ -58,8 +58,8 @@ namespace tracer
if (context.m_gdt)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_TRACER);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_TRACER, gdtEntry);
GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_TRACER);
infoString.ToGdtProperties(INFO_STRING_PREFIX_TRACER, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry);
}
else
@@ -71,7 +71,7 @@ namespace tracer
auto& stream = *assetFile;
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());
}
}
@@ -99,8 +99,8 @@ namespace vehicle
if (context.m_gdt)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_VEHICLE);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_VEHICLE, gdtEntry);
GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_VEHICLE);
infoString.ToGdtProperties(INFO_STRING_PREFIX_VEHICLE, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry);
}
else
@@ -112,7 +112,7 @@ namespace vehicle
auto& stream = *assetFile;
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());
}
}
@@ -411,8 +411,8 @@ namespace weapon
if (context.m_gdt)
{
const auto infoString = CreateInfoString(asset);
GdtEntry gdtEntry(asset.m_name, ObjConstants::GDF_FILENAME_WEAPON);
infoString.ToGdtProperties(ObjConstants::INFO_STRING_PREFIX_WEAPON, gdtEntry);
GdtEntry gdtEntry(asset.m_name, GDF_FILENAME_WEAPON);
infoString.ToGdtProperties(INFO_STRING_PREFIX_WEAPON, gdtEntry);
context.m_gdt->WriteEntry(gdtEntry);
}
else
@@ -424,7 +424,7 @@ namespace weapon
auto& stream = *assetFile;
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());
}