Cleanup (removing unused variables & other redundancies, rethrowing exceptions instead of wrapping them in a new exception instance)
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
using FarseerPhysics.Common;
|
||||
using FarseerPhysics.Common.PolygonManipulation;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Voronoi2;
|
||||
|
||||
namespace Barotrauma.RuinGeneration
|
||||
|
||||
@@ -239,15 +239,15 @@ namespace Barotrauma.Lights
|
||||
|
||||
private void CalculateDimensions()
|
||||
{
|
||||
float? minX = null, minY = null, maxX = null, maxY = null;
|
||||
float minX = vertices[0].Pos.X, minY = vertices[0].Pos.Y, maxX = vertices[0].Pos.X, maxY = vertices[0].Pos.Y;
|
||||
|
||||
for (int i = 0; i < vertices.Length; i++)
|
||||
for (int i = 1; i < vertices.Length; i++)
|
||||
{
|
||||
if (minX == null || vertices[i].Pos.X < minX) minX = vertices[i].Pos.X;
|
||||
if (minY == null || vertices[i].Pos.Y < minY) minY = vertices[i].Pos.Y;
|
||||
if (vertices[i].Pos.X < minX) minX = vertices[i].Pos.X;
|
||||
if (vertices[i].Pos.Y < minY) minY = vertices[i].Pos.Y;
|
||||
|
||||
if (maxX == null || vertices[i].Pos.X > maxX) maxX = vertices[i].Pos.X;
|
||||
if (maxY == null || vertices[i].Pos.Y > minY) maxY = vertices[i].Pos.Y;
|
||||
if (vertices[i].Pos.X > maxX) maxX = vertices[i].Pos.X;
|
||||
if (vertices[i].Pos.Y > minY) maxY = vertices[i].Pos.Y;
|
||||
}
|
||||
|
||||
boundingBox = new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace Barotrauma.Lights
|
||||
|
||||
private Texture2D visionCircle;
|
||||
|
||||
private Dictionary<Hull, Color> hullAmbientLights = new Dictionary<Hull, Color>();
|
||||
private Dictionary<Hull, Color> smoothedHullAmbientLights = new Dictionary<Hull, Color>();
|
||||
private Dictionary<Hull, Color> hullAmbientLights;
|
||||
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
||||
|
||||
private float ambientLightUpdateTimer;
|
||||
|
||||
@@ -133,10 +133,7 @@ namespace Barotrauma.Lights
|
||||
public void UpdateLightMap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Effect blur)
|
||||
{
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
Matrix shadowTransform = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
|
||||
graphics.SetRenderTarget(lightMap);
|
||||
|
||||
Rectangle viewRect = cam.WorldView;
|
||||
@@ -337,20 +334,12 @@ namespace Barotrauma.Lights
|
||||
|
||||
return hullAmbientLight;
|
||||
}
|
||||
|
||||
private void ClearAlphaToOne(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.WriteToAlpha);
|
||||
spriteBatch.Draw(alphaClearTexture, new Rectangle(0, 0,graphics.Viewport.Width, graphics.Viewport.Height), Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
|
||||
public void DrawLightMap(SpriteBatch spriteBatch, Effect effect)
|
||||
{
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||
//effect.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
||||
if (type.HasHireableCharacters)
|
||||
{
|
||||
hireManager = new HireManager();
|
||||
hireManager.GenerateCharacters(this, 10);
|
||||
hireManager.GenerateCharacters(this, HireManager.MaxAvailableCharacters);
|
||||
}
|
||||
|
||||
Connections = new List<LocationConnection>();
|
||||
@@ -62,9 +62,9 @@ namespace Barotrauma
|
||||
|
||||
private string RandomName(LocationType type)
|
||||
{
|
||||
string name = ToolBox.GetRandomLine("Content/Map/locationNames.txt");
|
||||
string randomName = ToolBox.GetRandomLine("Content/Map/locationNames.txt");
|
||||
int nameFormatIndex = Rand.Int(type.NameFormats.Count, false);
|
||||
return type.NameFormats[nameFormatIndex].Replace("[name]", name);
|
||||
return type.NameFormats[nameFormatIndex].Replace("[name]", randomName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,9 +362,7 @@ namespace Barotrauma
|
||||
linkedTo.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
static Dictionary<string, float> timeElapsed = new Dictionary<string, float>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Call Update() on every object in Entity.list
|
||||
/// </summary>
|
||||
|
||||
@@ -872,7 +872,7 @@ namespace Barotrauma
|
||||
|
||||
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
||||
{
|
||||
for (int i = 0; i < sections.Count(); i++)
|
||||
for (int i = 0; i < sections.Length; i++)
|
||||
{
|
||||
float damage = msg.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user