CGroundMovement: Make use of designated initializers

Same behavior, less duplication of variable names.
This commit is contained in:
Lioncash 2020-08-02 22:54:31 -04:00
parent d9dde388f5
commit b88dd6b373
1 changed files with 39 additions and 37 deletions

View File

@ -348,25 +348,26 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
SMoveObjectResult result; SMoveObjectResult result;
if (!applyJump) { if (!applyJump) {
SMovementOptions opts; const SMovementOptions opts{
opts.x0_setWaterLandingForce = false; .x0_setWaterLandingForce = false,
opts.x4_waterLandingForceCoefficient = 0.f; .x4_waterLandingForceCoefficient = 0.f,
opts.x8_minimumWaterLandingForce = 0.f; .x8_minimumWaterLandingForce = 0.f,
opts.xc_anyZThreshold = 0.37f; .xc_anyZThreshold = 0.37f,
opts.x10_downwardZThreshold = 0.25f; .x10_downwardZThreshold = 0.25f,
opts.x14_waterLandingVelocityReduction = 0.f; .x14_waterLandingVelocityReduction = 0.f,
opts.x18_dampForceAndMomentum = true; .x18_dampForceAndMomentum = true,
opts.x19_alwaysClip = false; .x19_alwaysClip = false,
opts.x1a_disableClipForFloorOnly = noJump; .x1a_disableClipForFloorOnly = noJump,
opts.x1c_maxCollisionCycles = 4; .x1c_maxCollisionCycles = 4,
opts.x20_minimumTranslationDelta = 0.002f; .x20_minimumTranslationDelta = 0.002f,
opts.x24_dampedNormalCoefficient = 0.f; .x24_dampedNormalCoefficient = 0.f,
opts.x28_dampedDeltaCoefficient = 1.f; .x28_dampedDeltaCoefficient = 1.f,
opts.x2c_floorElasticForce = 0.f; .x2c_floorElasticForce = 0.f,
opts.x30_wallElasticConstant = 0.02f; .x30_wallElasticConstant = 0.02f,
opts.x3c_floorPlaneNormal = player.GetLastFloorPlaneNormal(); .x34_wallElasticLinear = 0.2f,
opts.x34_wallElasticLinear = 0.2f; .x38_maxPositiveVerticalVelocity = player.GetMaximumPlayerPositiveVerticalVelocity(mgr),
opts.x38_maxPositiveVerticalVelocity = player.GetMaximumPlayerPositiveVerticalVelocity(mgr); .x3c_floorPlaneNormal = player.GetLastFloorPlaneNormal(),
};
if (noJump) { if (noJump) {
zeus::CVector3f vel = player.GetVelocity(); zeus::CVector3f vel = player.GetVelocity();
@ -473,24 +474,25 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
} }
} }
} else { } else {
SMovementOptions opts; const SMovementOptions opts{
opts.x0_setWaterLandingForce = true; .x0_setWaterLandingForce = true,
opts.x4_waterLandingForceCoefficient = dampUnderwater ? 35.f : 1.f; .x4_waterLandingForceCoefficient = dampUnderwater ? 35.f : 1.f,
opts.x8_minimumWaterLandingForce = dampUnderwater ? 5.f : 0.f; .x8_minimumWaterLandingForce = dampUnderwater ? 5.f : 0.f,
opts.xc_anyZThreshold = dampUnderwater ? 0.05f : 0.37f; .xc_anyZThreshold = dampUnderwater ? 0.05f : 0.37f,
opts.x10_downwardZThreshold = dampUnderwater ? 0.01f : 0.25f; .x10_downwardZThreshold = dampUnderwater ? 0.01f : 0.25f,
opts.x14_waterLandingVelocityReduction = dampUnderwater ? 0.2f : 0.f; .x14_waterLandingVelocityReduction = dampUnderwater ? 0.2f : 0.f,
opts.x18_dampForceAndMomentum = false; .x18_dampForceAndMomentum = false,
opts.x19_alwaysClip = false; .x19_alwaysClip = false,
opts.x1a_disableClipForFloorOnly = false; .x1a_disableClipForFloorOnly = false,
opts.x1c_maxCollisionCycles = 4; .x1c_maxCollisionCycles = 4,
opts.x20_minimumTranslationDelta = 0.002f; .x20_minimumTranslationDelta = 0.002f,
opts.x24_dampedNormalCoefficient = 0.f; .x24_dampedNormalCoefficient = 0.f,
opts.x28_dampedDeltaCoefficient = 1.f; .x28_dampedDeltaCoefficient = 1.f,
opts.x2c_floorElasticForce = 0.1f; .x2c_floorElasticForce = 0.1f,
opts.x30_wallElasticConstant = 0.2f; .x30_wallElasticConstant = 0.2f,
opts.x3c_floorPlaneNormal = player.GetLastFloorPlaneNormal(); .x38_maxPositiveVerticalVelocity = player.GetMaximumPlayerPositiveVerticalVelocity(mgr),
opts.x38_maxPositiveVerticalVelocity = player.GetMaximumPlayerPositiveVerticalVelocity(mgr); .x3c_floorPlaneNormal = player.GetLastFloorPlaneNormal(),
};
material = MoveObjectAnalytical(mgr, actor, dt, useNearList, cache, opts, result); material = MoveObjectAnalytical(mgr, actor, dt, useNearList, cache, opts, result);
} }