refactor: physpreset codestyle (#928)

* chore: adjust phys preset code to use similar code style

* fix: infinity friction for t6

* fix: t6 phys preset canFloat qboolean

* chore: move iw5 phys preset enum strings to enum strings header

* chore: add phys preset tests for all games

* chore: rename PhysPresetFields headers
This commit is contained in:
Jan Laupetin
2026-07-22 21:08:36 +02:00
committed by GitHub
parent 37bb67a3a5
commit 04b6b5b4bf
33 changed files with 916 additions and 329 deletions
@@ -1,9 +0,0 @@
#pragma once
namespace IW5
{
inline const char* szPhysPresetScalingNames[]{
"linear",
"quadratic",
};
} // namespace IW5
@@ -23,4 +23,10 @@ namespace IW5
{"tempDefaultToCylinder", offsetof(PhysPresetInfo, tempDefaultToCylinder), CSPFT_QBOOLEAN},
{"perSurfaceSndAlias", offsetof(PhysPresetInfo, perSurfaceSndAlias), CSPFT_QBOOLEAN},
};
}
inline const char* szPhysPresetScalingNames[]{
"linear",
"quadratic",
};
static_assert(std::extent_v<decltype(szPhysPresetScalingNames)> == PHYSPRESET_SCALING_COUNT);
} // namespace IW5
+1 -1
View File
@@ -11,5 +11,5 @@ namespace T5
static constexpr auto GDF_FILENAME_PHYS_PRESET = "physpreset.gdf";
static constexpr auto GDF_FILENAME_WEAPON = "weapon.gdf";
static constexpr float MAX_FRICTION = 1e+10;
static constexpr float PHYS_PRESET_MAX_FRICTION = 1e+10;
} // namespace T5
+2
View File
@@ -20,4 +20,6 @@ namespace T6
static constexpr auto GDF_FILENAME_WEAPON_ATTACHMENT = "attachment.gdf";
static constexpr auto GDF_FILENAME_WEAPON_ATTACHMENT_UNIQUE = "attachmentunique.gdf";
static constexpr auto GDF_FILENAME_ZBARRIER = "zbarrier.gdf";
static constexpr float PHYS_PRESET_MAX_FRICTION = 1e+10;
} // namespace T6
@@ -12,7 +12,7 @@ namespace T6
{"explosiveForceScale", offsetof(PhysPresetInfo, explosiveForceScale), CSPFT_FLOAT },
{"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT },
{"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT },
{"canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_INT },
{"canFloat", offsetof(PhysPresetInfo, canFloat), CSPFT_QBOOLEAN},
{"gravityScale", offsetof(PhysPresetInfo, gravityScale), CSPFT_FLOAT },
{"massOffsetX", offsetof(PhysPresetInfo, centerOfMassOffset.x), CSPFT_FLOAT },
{"massOffsetY", offsetof(PhysPresetInfo, centerOfMassOffset.y), CSPFT_FLOAT },