WIP CrashReporter, misc refactoring
This commit is contained in:
@@ -53,15 +53,15 @@ namespace Subsurface
|
||||
{
|
||||
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(simPosition);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("shockwave", displayPosition,
|
||||
GameMain.ParticleManager.CreateParticle("shockwave", displayPosition,
|
||||
Vector2.Zero, 0.0f);
|
||||
|
||||
for (int i = 0; i < range * 10; i++)
|
||||
{
|
||||
Game1.ParticleManager.CreateParticle("spark", displayPosition,
|
||||
GameMain.ParticleManager.CreateParticle("spark", displayPosition,
|
||||
Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("explosionfire", displayPosition + Rand.Vector(50f),
|
||||
GameMain.ParticleManager.CreateParticle("explosionfire", displayPosition + Rand.Vector(50f),
|
||||
Rand.Vector(Rand.Range(50f, 100.0f)), 0.0f);
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace Subsurface
|
||||
light = new LightSource(displayPosition, displayRange, Color.LightYellow);
|
||||
CoroutineManager.StartCoroutine(DimLight());
|
||||
|
||||
float cameraDist = Vector2.Distance(Game1.GameScreen.Cam.Position, displayPosition)/2.0f;
|
||||
Game1.GameScreen.Cam.Shake = CameraShake * Math.Max((displayRange - cameraDist)/displayRange, 0.0f);
|
||||
float cameraDist = Vector2.Distance(GameMain.GameScreen.Cam.Position, displayPosition)/2.0f;
|
||||
GameMain.GameScreen.Cam.Shake = CameraShake * Math.Max((displayRange - cameraDist)/displayRange, 0.0f);
|
||||
|
||||
if (structureDamage > 0.0f)
|
||||
{
|
||||
@@ -111,11 +111,11 @@ namespace Subsurface
|
||||
|
||||
float distFactor = 1.0f - dist / range;
|
||||
|
||||
foreach (Limb limb in c.AnimController.limbs)
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
distFactor = 1.0f - Vector2.Distance(limb.SimPosition, simPosition)/range;
|
||||
|
||||
c.AddDamage(limb.SimPosition, DamageType.None, damage / c.AnimController.limbs.Length * distFactor, 0.0f, stun * distFactor);
|
||||
c.AddDamage(limb.SimPosition, DamageType.None, damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor);
|
||||
|
||||
if (force>0.0f)
|
||||
{
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace Subsurface
|
||||
{
|
||||
pos.Y = MathHelper.Clamp(lowerSurface, rect.Y - rect.Height, rect.Y);
|
||||
|
||||
var particle = Game1.ParticleManager.CreateParticle("watersplash",
|
||||
var particle = GameMain.ParticleManager.CreateParticle("watersplash",
|
||||
new Vector2(pos.X, pos.Y - Rand.Range(0.0f, 10.0f)),
|
||||
new Vector2(
|
||||
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f),
|
||||
@@ -273,7 +273,7 @@ namespace Subsurface
|
||||
|
||||
pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
GameMain.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -281,12 +281,12 @@ namespace Subsurface
|
||||
for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100))
|
||||
{
|
||||
pos.X = Rand.Range(rect.X, rect.X + rect.Width);
|
||||
Subsurface.Particles.Particle splash = Game1.ParticleManager.CreateParticle("watersplash", pos,
|
||||
Subsurface.Particles.Particle splash = GameMain.ParticleManager.CreateParticle("watersplash", pos,
|
||||
new Vector2(0, Math.Max(flowForce.Y * Rand.Range(0.5f, 0.8f), 0.0f)));
|
||||
|
||||
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 2.0f);
|
||||
GameMain.ParticleManager.CreateParticle("bubbles", pos, flowForce / 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Subsurface
|
||||
float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i]));
|
||||
if (maxDelta > Rand.Range(0.2f,10.0f))
|
||||
{
|
||||
Game1.ParticleManager.CreateParticle("mist",
|
||||
GameMain.ParticleManager.CreateParticle("mist",
|
||||
new Vector2(rect.X + WaveWidth * i,surface + waveY[i]),
|
||||
new Vector2(0.0f, -50.0f));
|
||||
}
|
||||
@@ -276,7 +276,7 @@ namespace Subsurface
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
if (!editing && !Game1.DebugDraw) return;
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Vector2(rect.X, -rect.Y),
|
||||
@@ -313,7 +313,7 @@ namespace Subsurface
|
||||
//interpolate the position of the rendered surface towards the "target surface"
|
||||
surface = surface + (surfaceY - surface) / 10.0f;
|
||||
|
||||
Matrix transform = cam.Transform * Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
if (bottom > cam.WorldView.Y || top < cam.WorldView.Y - cam.WorldView.Height) return;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Subsurface
|
||||
if (basicEffect==null)
|
||||
{
|
||||
|
||||
basicEffect = new BasicEffect(Game1.CurrGraphicsDevice);
|
||||
basicEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
basicEffect.VertexColorEnabled = false;
|
||||
|
||||
basicEffect.TextureEnabled = true;
|
||||
@@ -354,7 +354,7 @@ namespace Subsurface
|
||||
Debug.WriteLine("Generatelevel: " + sw2.ElapsedMilliseconds + " ms");
|
||||
sw2.Restart();
|
||||
|
||||
vertexBuffer = new VertexBuffer(Game1.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
vertexBuffer = new VertexBuffer(GameMain.CurrGraphicsDevice, VertexPositionTexture.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
|
||||
vertexBuffer.SetData(vertices);
|
||||
|
||||
if (mirror)
|
||||
@@ -639,7 +639,7 @@ int currentTargetIndex = 1;
|
||||
|
||||
triangles = MathUtils.TriangulateConvexHull(bodyPoints, cell.Center);
|
||||
|
||||
Body edgeBody = new Body(Game1.World);
|
||||
Body edgeBody = new Body(GameMain.World);
|
||||
|
||||
for (int i = 0; i < triangles.Count; i++)
|
||||
{
|
||||
@@ -661,7 +661,7 @@ int currentTargetIndex = 1;
|
||||
|
||||
for (int i = 0; i < 2; i++ )
|
||||
{
|
||||
Body shaftBody = BodyFactory.CreateRectangle(Game1.World, 100.0f, 10.0f, 5.0f);
|
||||
Body shaftBody = BodyFactory.CreateRectangle(GameMain.World, 100.0f, 10.0f, 5.0f);
|
||||
shaftBody.BodyType = BodyType.Kinematic;
|
||||
shaftBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel;
|
||||
shaftBody.SetTransform(ConvertUnits.ToSimUnits((i==0) ? startPosition : endPosition), 0.0f);
|
||||
@@ -720,7 +720,7 @@ int currentTargetIndex = 1;
|
||||
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
foreach (Limb limb in character.AnimController.limbs)
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
if (character.AnimController.CurrentHull != null) continue;
|
||||
|
||||
@@ -762,7 +762,7 @@ int currentTargetIndex = 1;
|
||||
{
|
||||
if (character.AnimController.CurrentHull != null) continue;
|
||||
|
||||
foreach (Limb limb in character.AnimController.limbs)
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
limb.body.LinearVelocity -= prevVelocity;
|
||||
}
|
||||
@@ -949,7 +949,7 @@ int currentTargetIndex = 1;
|
||||
if (vertices.Length <= 0) return;
|
||||
|
||||
basicEffect.World = Matrix.CreateTranslation(new Vector3(Position, 0.0f)) * cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace Subsurface.Lights
|
||||
{
|
||||
if (shadowEffect == null)
|
||||
{
|
||||
shadowEffect = new BasicEffect(Game1.CurrGraphicsDevice);
|
||||
shadowEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
shadowEffect.VertexColorEnabled = true;
|
||||
}
|
||||
if (penumbraEffect == null)
|
||||
{
|
||||
penumbraEffect = new BasicEffect(Game1.CurrGraphicsDevice);
|
||||
penumbraEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
penumbraEffect.TextureEnabled = true;
|
||||
//shadowEffect.VertexColorEnabled = true;
|
||||
penumbraEffect.LightingEnabled = false;
|
||||
@@ -225,7 +225,7 @@ namespace Subsurface.Lights
|
||||
}
|
||||
|
||||
shadowEffect.World = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
shadowEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, shadowVertices, 0, shadowVertexCount * 2 - 2);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Subsurface.Lights
|
||||
|
||||
var pp = graphics.PresentationParameters;
|
||||
|
||||
lightMap = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight, false,
|
||||
lightMap = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
||||
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
||||
RenderTargetUsage.DiscardContents);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Subsurface.Lights
|
||||
|
||||
texture = lightTexture;
|
||||
|
||||
Game1.LightManager.AddLight(this);
|
||||
GameMain.LightManager.AddLight(this);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
@@ -59,7 +59,7 @@ namespace Subsurface.Lights
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
Game1.LightManager.RemoveLight(this);
|
||||
GameMain.LightManager.RemoveLight(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Subsurface
|
||||
{
|
||||
selectedConnection = connection;
|
||||
selectedLocation = highlightedLocation;
|
||||
Game1.LobbyScreen.SelectLocation(highlightedLocation, connection);
|
||||
GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Subsurface
|
||||
bodies = new List<Body>();
|
||||
//gaps = new List<Gap>();
|
||||
|
||||
Body newBody = BodyFactory.CreateRectangle(Game1.World,
|
||||
Body newBody = BodyFactory.CreateRectangle(GameMain.World,
|
||||
ConvertUnits.ToSimUnits(rect.Width),
|
||||
ConvertUnits.ToSimUnits(rect.Height),
|
||||
1.5f);
|
||||
@@ -206,7 +206,7 @@ namespace Subsurface
|
||||
{
|
||||
bodies = new List<Body>();
|
||||
|
||||
Body newBody = BodyFactory.CreateRectangle(Game1.World,
|
||||
Body newBody = BodyFactory.CreateRectangle(GameMain.World,
|
||||
ConvertUnits.ToSimUnits(rect.Width * Math.Sqrt(2.0) + Submarine.GridSize.X*3.0f),
|
||||
ConvertUnits.ToSimUnits(10),
|
||||
1.5f);
|
||||
@@ -273,7 +273,7 @@ namespace Subsurface
|
||||
if (bodies != null)
|
||||
{
|
||||
foreach (Body b in bodies)
|
||||
Game1.World.RemoveBody(b);
|
||||
GameMain.World.RemoveBody(b);
|
||||
}
|
||||
|
||||
if (convexHull != null) convexHull.Remove();
|
||||
@@ -381,7 +381,7 @@ namespace Subsurface
|
||||
{
|
||||
if (!prefab.HasBody || prefab.IsPlatform) return;
|
||||
|
||||
if (Game1.Client==null)
|
||||
if (GameMain.Client==null)
|
||||
SetDamage(sectionIndex, sections[sectionIndex].damage + damage);
|
||||
|
||||
}
|
||||
@@ -419,7 +419,7 @@ namespace Subsurface
|
||||
int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position));
|
||||
if (i == -1) return new AttackResult(0.0f, 0.0f);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f);
|
||||
GameMain.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f);
|
||||
|
||||
if (playSound && !SectionHasHole(i))
|
||||
{
|
||||
@@ -477,7 +477,7 @@ namespace Subsurface
|
||||
{
|
||||
foreach (Body b in bodies)
|
||||
{
|
||||
Game1.World.RemoveBody(b);
|
||||
GameMain.World.RemoveBody(b);
|
||||
}
|
||||
bodies.Clear();
|
||||
|
||||
@@ -531,7 +531,7 @@ namespace Subsurface
|
||||
|
||||
private Body CreateRectBody(Rectangle rect)
|
||||
{
|
||||
Body newBody = BodyFactory.CreateRectangle(Game1.World,
|
||||
Body newBody = BodyFactory.CreateRectangle(GameMain.World,
|
||||
ConvertUnits.ToSimUnits(rect.Width),
|
||||
ConvertUnits.ToSimUnits(rect.Height),
|
||||
1.5f);
|
||||
|
||||
@@ -152,8 +152,8 @@ namespace Subsurface
|
||||
|
||||
sprite.DrawTiled(spriteBatch, new Vector2(newRect.X, -newRect.Y), new Vector2(newRect.Width, newRect.Height), Color.White);
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X - Game1.GraphicsWidth, -newRect.Y, newRect.Width + Game1.GraphicsWidth*2, newRect.Height), Color.White);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X, -newRect.Y - Game1.GraphicsHeight, newRect.Width, newRect.Height + Game1.GraphicsHeight*2), Color.White);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X - GameMain.GraphicsWidth, -newRect.Y, newRect.Width + GameMain.GraphicsWidth*2, newRect.Height), Color.White);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(newRect.X, -newRect.Y - GameMain.GraphicsHeight, newRect.Width, newRect.Height + GameMain.GraphicsHeight*2), Color.White);
|
||||
|
||||
if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ namespace Subsurface
|
||||
|
||||
float closestFraction = 1.0f;
|
||||
Body closestBody = null;
|
||||
Game1.World.RayCast((fixture, point, normal, fraction) =>
|
||||
GameMain.World.RayCast((fixture, point, normal, fraction) =>
|
||||
{
|
||||
if (fixture == null || fixture.CollisionCategories == Category.None) return -1;
|
||||
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
|
||||
@@ -363,7 +363,7 @@ namespace Subsurface
|
||||
return null;
|
||||
}
|
||||
|
||||
Game1.World.RayCast((fixture, point, normal, fraction) =>
|
||||
GameMain.World.RayCast((fixture, point, normal, fraction) =>
|
||||
{
|
||||
if (fixture == null || fixture.CollisionCategories != Physics.CollisionWall) return -1;
|
||||
|
||||
@@ -395,7 +395,7 @@ namespace Subsurface
|
||||
Body foundBody = null;
|
||||
AABB aabb = new AABB(point, point);
|
||||
|
||||
Game1.World.QueryAABB(p =>
|
||||
GameMain.World.QueryAABB(p =>
|
||||
{
|
||||
foundBody = p.Body;
|
||||
|
||||
@@ -406,16 +406,16 @@ namespace Subsurface
|
||||
return foundBody;
|
||||
}
|
||||
|
||||
public static bool InsideWall(Vector2 point)
|
||||
{
|
||||
Body foundBody = PickBody(point);
|
||||
if (foundBody==null) return false;
|
||||
//public static bool InsideWall(Vector2 point)
|
||||
//{
|
||||
// Body foundBody = PickBody(point);
|
||||
// if (foundBody==null) return false;
|
||||
|
||||
Structure wall = foundBody.UserData as Structure;
|
||||
if (wall == null || wall.IsPlatform) return false;
|
||||
// Structure wall = foundBody.UserData as Structure;
|
||||
// if (wall == null || wall.IsPlatform) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
//}
|
||||
|
||||
//movement ----------------------------------------------------
|
||||
|
||||
@@ -436,8 +436,10 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
Translate(translateAmount);
|
||||
|
||||
//-------------------------
|
||||
|
||||
ApplyForce(CalculateBuoyancy());
|
||||
Vector2 totalForce = CalculateBuoyancy();
|
||||
|
||||
float dragCoefficient = 0.00001f;
|
||||
|
||||
@@ -446,8 +448,11 @@ namespace Subsurface
|
||||
|
||||
if (speed != Vector2.Zero)
|
||||
{
|
||||
ApplyForce(-Vector2.Normalize(speed) * drag);
|
||||
totalForce += -Vector2.Normalize(speed) * drag;
|
||||
}
|
||||
|
||||
ApplyForce(totalForce);
|
||||
|
||||
//hullBodies[0].body.LinearVelocity = -hullBodies[0].body.Position;
|
||||
|
||||
//hullBody.SetTransform(Vector2.Zero , 0.0f);
|
||||
@@ -462,8 +467,8 @@ namespace Subsurface
|
||||
foreach (GraphEdge ge in collidingCell.edges)
|
||||
{
|
||||
Body body = PickBody(
|
||||
ConvertUnits.ToSimUnits(ge.point1+ Game1.GameSession.Level.Position),
|
||||
ConvertUnits.ToSimUnits(ge.point2 + Game1.GameSession.Level.Position), new List<Body>(){collidingCell.body});
|
||||
ConvertUnits.ToSimUnits(ge.point1+ GameMain.GameSession.Level.Position),
|
||||
ConvertUnits.ToSimUnits(ge.point2 + GameMain.GameSession.Level.Position), new List<Body>(){collidingCell.body});
|
||||
if (body == null || body.UserData == null) continue;
|
||||
|
||||
Structure structure = body.UserData as Structure;
|
||||
@@ -471,6 +476,8 @@ namespace Subsurface
|
||||
structure.AddDamage(lastPickedPosition, DamageType.Blunt, 50.0f, 0.0f, 0.0f, true);
|
||||
}
|
||||
|
||||
collidingCell = null;
|
||||
|
||||
//hullBodies[0].body.SetTransform(Vector2.Zero, 0.0f);
|
||||
|
||||
//position = hullBodies[0].body.Position;
|
||||
@@ -528,15 +535,41 @@ namespace Subsurface
|
||||
VoronoiCell cell = f2.Body.UserData as VoronoiCell;
|
||||
if (cell==null) return true;
|
||||
|
||||
Vector2 normal = -contact.Manifold.LocalNormal;
|
||||
Vector2 normal = contact.Manifold.LocalNormal;
|
||||
Vector2 simSpeed = ConvertUnits.ToSimUnits(speed);
|
||||
float impact = -Vector2.Dot(simSpeed, normal);
|
||||
float impact = Vector2.Dot(simSpeed, normal);
|
||||
|
||||
Vector2 u = Vector2.Dot(simSpeed, normal)*normal;
|
||||
Vector2 u = Vector2.Dot(simSpeed, -normal)*-normal;
|
||||
Vector2 w = simSpeed - u;
|
||||
|
||||
Vector2 limbForce = normal * impact;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("IMPACT:"+impact);
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
if (c.AnimController.CurrentHull == null) continue;
|
||||
|
||||
if (impact > 2.0f) c.AnimController.StunTimer = (impact - 2.0f) * 0.1f;
|
||||
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
limb.body.ApplyLinearImpulse(limb.Mass * limbForce);
|
||||
}
|
||||
}
|
||||
|
||||
if (impact >= 1.0f)
|
||||
{
|
||||
AmbientSoundManager.PlayDamageSound(DamageSoundType.StructureBlunt, impact * 10.0f, cell.body);
|
||||
|
||||
FixedArray2<Vector2> worldPoints;
|
||||
contact.GetWorldManifold(out normal, out worldPoints);
|
||||
|
||||
|
||||
AmbientSoundManager.PlayDamageSound(DamageSoundType.StructureBlunt, impact * 10.0f, ConvertUnits.ToDisplayUnits(worldPoints[0]));
|
||||
|
||||
GameMain.GameScreen.Cam.Shake = impact*2.0f;
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("IMPACT: "+impact + " normal: "+normal+" simspeed: "+simSpeed+" u: "+u+" w: " +w);
|
||||
if (impact < 4.0f)
|
||||
{
|
||||
speed = ConvertUnits.ToDisplayUnits(w * 0.9f - u * 0.2f);
|
||||
@@ -547,13 +580,6 @@ namespace Subsurface
|
||||
speed = ConvertUnits.ToDisplayUnits(w * 0.9f + u * 0.5f);
|
||||
}
|
||||
|
||||
if (contact.Manifold.PointCount >= 1)
|
||||
{
|
||||
FixedArray2<Vector2> worldPoints;
|
||||
contact.GetWorldManifold(out normal, out worldPoints);
|
||||
|
||||
Game1.GameScreen.Cam.Shake = impact;
|
||||
}
|
||||
|
||||
collisionRigidness = 0.8f;
|
||||
|
||||
@@ -828,7 +854,7 @@ namespace Subsurface
|
||||
|
||||
var triangulatedVertices = Triangulate.ConvexPartition(shapevertices, TriangulationAlgorithm.Bayazit);
|
||||
|
||||
hullBody = BodyFactory.CreateCompoundPolygon(Game1.World, triangulatedVertices, 5.0f);
|
||||
hullBody = BodyFactory.CreateCompoundPolygon(GameMain.World, triangulatedVertices, 5.0f);
|
||||
hullBody.BodyType = BodyType.Dynamic;
|
||||
|
||||
hullBody.CollisionCategories = Physics.CollisionMisc;
|
||||
@@ -880,7 +906,7 @@ namespace Subsurface
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
if (Game1.GameScreen.Cam != null) Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
if (GameMain.GameScreen.Cam != null) GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
|
||||
Entity.RemoveAll();
|
||||
|
||||
@@ -888,7 +914,7 @@ namespace Subsurface
|
||||
|
||||
Ragdoll.list.Clear();
|
||||
|
||||
Game1.World.Clear();
|
||||
GameMain.World.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Subsurface
|
||||
|
||||
if (basicEffect==null)
|
||||
{
|
||||
basicEffect = new BasicEffect(Game1.CurrGraphicsDevice);
|
||||
basicEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
basicEffect.VertexColorEnabled = false;
|
||||
|
||||
basicEffect.TextureEnabled = true;
|
||||
@@ -58,7 +58,7 @@ namespace Subsurface
|
||||
wavePos.X += 0.0001f;
|
||||
wavePos.Y += 0.0001f;
|
||||
|
||||
spriteBatch.Draw(waterTexture, new Rectangle(0,0,Game1.GraphicsWidth, Game1.GraphicsHeight), Color.White);
|
||||
spriteBatch.Draw(waterTexture, new Rectangle(0,0,GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Subsurface
|
||||
|
||||
basicEffect.View = Matrix.Identity;
|
||||
basicEffect.World = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Subsurface
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
if (!editing && !Game1.DebugDraw) return;
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
Point pos = new Point((int)Position.X, (int)Position.Y);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Subsurface
|
||||
private GUIComponent CreateEditingHUD(bool inGame = false)
|
||||
{
|
||||
int width = 500;
|
||||
int x = Game1.GraphicsWidth / 2 - width / 2, y = 10;
|
||||
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
|
||||
|
||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, 150), Color.Black * 0.5f);
|
||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user