Timing.Alpha isn't updated when the game is paused (-> no "twitching" when the pause menu is open), moved water scrolling and surface lerping from draw method to update
This commit is contained in:
@@ -292,6 +292,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Timing.Accumulator += gameTime.ElapsedGameTime.TotalSeconds;
|
Timing.Accumulator += gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
|
|
||||||
|
bool paused = false;
|
||||||
|
|
||||||
while (Timing.Accumulator >= Timing.Step)
|
while (Timing.Accumulator >= Timing.Step)
|
||||||
{
|
{
|
||||||
fixedTime.IsRunningSlowly = gameTime.IsRunningSlowly;
|
fixedTime.IsRunningSlowly = gameTime.IsRunningSlowly;
|
||||||
@@ -302,8 +304,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
PlayerInput.Update(Timing.Step);
|
PlayerInput.Update(Timing.Step);
|
||||||
|
|
||||||
bool paused = false;
|
|
||||||
|
|
||||||
if (titleScreenOpen)
|
if (titleScreenOpen)
|
||||||
{
|
{
|
||||||
if (TitleScreen.LoadState >= 100.0f &&
|
if (TitleScreen.LoadState >= 100.0f &&
|
||||||
@@ -342,7 +342,7 @@ namespace Barotrauma
|
|||||||
Timing.Accumulator -= Timing.Step;
|
Timing.Accumulator -= Timing.Step;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timing.Alpha = Timing.Accumulator / Timing.Step;
|
if (!paused) Timing.Alpha = Timing.Accumulator / Timing.Step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -403,17 +403,7 @@ namespace Barotrauma
|
|||||||
foreach (Gap gap in ConnectedGaps)
|
foreach (Gap gap in ConnectedGaps)
|
||||||
{
|
{
|
||||||
float gapFlow = gap.LerpedFlowForce.Length();
|
float gapFlow = gap.LerpedFlowForce.Length();
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
var asd = MapEntity.FindEntityByID(gap.ID);
|
|
||||||
|
|
||||||
if (asd != gap)
|
|
||||||
{
|
|
||||||
int adslkmfdlasfk = 9;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (gapFlow > strongestFlow)
|
if (gapFlow > strongestFlow)
|
||||||
{
|
{
|
||||||
strongestFlow = gapFlow;
|
strongestFlow = gapFlow;
|
||||||
@@ -492,11 +482,9 @@ namespace Barotrauma
|
|||||||
waveVel[i] = waveVel[i] * -0.5f;
|
waveVel[i] = waveVel[i] * -0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//acceleration
|
//acceleration
|
||||||
float a = -WaveStiffness * waveY[i] - waveVel[i] * WaveDampening;
|
float a = -WaveStiffness * waveY[i] - waveVel[i] * WaveDampening;
|
||||||
waveVel[i] = waveVel[i] + a;
|
waveVel[i] = waveVel[i] + a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 2; j++)
|
||||||
@@ -517,6 +505,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//interpolate the position of the rendered surface towards the "target surface"
|
||||||
|
surface = MathHelper.Lerp(surface, surfaceY, deltaTime*10.0f);
|
||||||
|
|
||||||
if (volume < FullVolume)
|
if (volume < FullVolume)
|
||||||
{
|
{
|
||||||
LethalPressure -= 10.0f * deltaTime;
|
LethalPressure -= 10.0f * deltaTime;
|
||||||
@@ -608,15 +599,7 @@ namespace Barotrauma
|
|||||||
isHighlighted ? Color.LightBlue*0.5f : Color.Red*0.5f, true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
|
isHighlighted ? Color.LightBlue*0.5f : Color.Red*0.5f, true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetSurfaceY()
|
|
||||||
{
|
|
||||||
float top = rect.Y + Submarine.DrawPosition.Y;
|
|
||||||
float bottom = top - rect.Height;
|
|
||||||
|
|
||||||
return bottom + Volume / rect.Width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Render(GraphicsDevice graphicsDevice, Camera cam)
|
public void Render(GraphicsDevice graphicsDevice, Camera cam)
|
||||||
{
|
{
|
||||||
if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return;
|
if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return;
|
||||||
@@ -626,10 +609,7 @@ namespace Barotrauma
|
|||||||
//calculate where the surface should be based on the water volume
|
//calculate where the surface should be based on the water volume
|
||||||
float top = rect.Y + submarinePos.Y;
|
float top = rect.Y + submarinePos.Y;
|
||||||
float bottom = top - rect.Height;
|
float bottom = top - rect.Height;
|
||||||
float surfaceY = bottom + Volume / rect.Width;
|
|
||||||
|
|
||||||
//interpolate the position of the rendered surface towards the "target surface"
|
|
||||||
surface = surface + ((surfaceY - submarinePos.Y) - surface) / 10.0f;
|
|
||||||
float drawSurface = surface + submarinePos.Y;
|
float drawSurface = surface + submarinePos.Y;
|
||||||
|
|
||||||
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
|
|||||||
@@ -814,6 +814,11 @@ namespace Barotrauma
|
|||||||
WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls);
|
WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Hull.renderer != null)
|
||||||
|
{
|
||||||
|
Hull.renderer.ScrollWater((float)deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
renderer.Update(deltaTime);
|
renderer.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,13 +166,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
cam.UpdateTransform(true);
|
cam.UpdateTransform(true);
|
||||||
|
|
||||||
if (Hull.renderer != null)
|
|
||||||
{
|
|
||||||
Hull.renderer.ScrollWater((float)deltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
//damageStencil = TextureLoader.FromFile("Content/Map/background.png");
|
|
||||||
|
|
||||||
DrawMap(graphics, spriteBatch);
|
DrawMap(graphics, spriteBatch);
|
||||||
|
|
||||||
spriteBatch.Begin();
|
spriteBatch.Begin();
|
||||||
|
|||||||
Reference in New Issue
Block a user