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
@@ -0,0 +1,27 @@
#pragma once
#include "Game/T5/T5.h"
namespace T5
{
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 },
{"piecesSpreadFraction", offsetof(PhysPresetInfo, piecesSpreadFraction), CSPFT_FLOAT },
{"piecesUpwardVelocity", offsetof(PhysPresetInfo, piecesUpwardVelocity), CSPFT_FLOAT },
{"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 },
{"massOffsetZ", offsetof(PhysPresetInfo, centerOfMassOffset.z), CSPFT_FLOAT },
{"buoyancyMinX", offsetof(PhysPresetInfo, buoyancyBoxMin.x), CSPFT_FLOAT },
{"buoyancyMinY", offsetof(PhysPresetInfo, buoyancyBoxMin.y), CSPFT_FLOAT },
{"buoyancyMinZ", offsetof(PhysPresetInfo, buoyancyBoxMin.z), CSPFT_FLOAT },
{"buoyancyMaxX", offsetof(PhysPresetInfo, buoyancyBoxMax.x), CSPFT_FLOAT },
{"buoyancyMaxY", offsetof(PhysPresetInfo, buoyancyBoxMax.y), CSPFT_FLOAT },
{"buoyancyMaxZ", offsetof(PhysPresetInfo, buoyancyBoxMax.z), CSPFT_FLOAT },
};
}