Removed fixed timestep logic from GameScreen (redundant now because the logic is handled in GameMain)

This commit is contained in:
Regalis
2016-10-04 19:21:05 +03:00
parent ff326bdc00
commit 050f7ffc83
19 changed files with 112 additions and 128 deletions

View File

@@ -20,33 +20,6 @@ namespace Barotrauma
public static float DisplayToRealWorldRatio = 1.0f / 80.0f;
public static double accumulator;
public static double step = 1.0/60.0;
public const float DisplayToSimRation = 100.0f;
public static double Alpha
{
get { return alpha; }
set { alpha = Math.Min(Math.Max(value, 0.0), 1.0); }
}
public static double Interpolate(double previous, double current)
{
return current * alpha + previous * (1.0 - alpha);
}
public static float Interpolate(float previous, float current)
{
return current * (float)alpha + previous * (1.0f - (float)alpha);
}
public static Vector2 Interpolate(Vector2 previous, Vector2 current)
{
return new Vector2(
Interpolate(previous.X, current.X),
Interpolate(previous.Y, current.Y));
}
public const float DisplayToSimRation = 100.0f;
}
}

View File

@@ -339,10 +339,10 @@ namespace Barotrauma
public void UpdateDrawPosition()
{
drawPosition = Physics.Interpolate(prevPosition, body.Position) - offsetFromTargetPos;
drawPosition = Timing.Interpolate(prevPosition, body.Position) - offsetFromTargetPos;
drawPosition = ConvertUnits.ToDisplayUnits(drawPosition);
drawRotation = Physics.Interpolate(prevRotation, body.Rotation);
drawRotation = Timing.Interpolate(prevRotation, body.Rotation);
if (offsetFromTargetPos == Vector2.Zero) return;
@@ -379,7 +379,7 @@ namespace Barotrauma
/// </summary>
public void SmoothRotate(float targetRotation, float force = 10.0f)
{
float nextAngle = body.Rotation + body.AngularVelocity * (float)Physics.step;
float nextAngle = body.Rotation + body.AngularVelocity * (float)Timing.Step;
float angle = MathUtils.GetShortestAngle(nextAngle, targetRotation);