new doors
This commit is contained in:
+960
-963
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,41 @@
|
|||||||
<Items>
|
<Items>
|
||||||
<Item
|
<Item
|
||||||
name="Door"
|
name="Door"
|
||||||
linkable="true"
|
linkable="true"
|
||||||
pickdistance="150.0">
|
pickdistance="150.0">
|
||||||
|
|
||||||
<Sprite texture ="doorframe.png" depth="0.8" origin="0.5,0.5"/>
|
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.8" origin="0.5,0.5"/>
|
||||||
|
|
||||||
<Door>
|
<Door>
|
||||||
<Sprite texture ="door.png" depth="0.4" origin="0.5,0.0"/>
|
<Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.4" origin="0.5,0.0"/>
|
||||||
</Door>
|
</Door>
|
||||||
|
|
||||||
<ConnectionPanel canbeselected = "true">
|
<ConnectionPanel canbeselected = "true">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
<input name="set_state"/>
|
<input name="set_state"/>
|
||||||
<output name="state_out"/>
|
<output name="state_out"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
<Item
|
<Item
|
||||||
name="Windowed Door"
|
name="Windowed Door"
|
||||||
linkable="true"
|
linkable="true"
|
||||||
pickdistance="150.0">
|
pickdistance="150.0">
|
||||||
|
|
||||||
<Sprite texture ="doorframe.png" depth="0.8" origin="0.5,0.5"/>
|
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.8" origin="0.5,0.5"/>
|
||||||
|
|
||||||
<Door window="0,-18,10,89">
|
<Door window="0,-18,10,89">
|
||||||
<Sprite texture ="windowedDoor.png" depth="0.4" origin="0.5,0.0"/>
|
<Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.4" origin="0.5,0.0"/>
|
||||||
</Door>
|
</Door>
|
||||||
|
|
||||||
<ConnectionPanel canbeselected = "true">
|
<ConnectionPanel canbeselected = "true">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
<input name="set_state"/>
|
<input name="set_state"/>
|
||||||
<output name="state_out"/>
|
<output name="state_out"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|
||||||
</Item>
|
</Item>
|
||||||
</Items>
|
</Items>
|
||||||
@@ -1,73 +1,73 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<prefabs>
|
<prefabs>
|
||||||
<watersplash sprite="Content/Particles/spatter.png"
|
<watersplash sprite="Content/Particles/spatter.png"
|
||||||
startsizemin="0.15,0.15" startsizemax="0.3,0.3"
|
startsizemin="0.15,0.15" startsizemax="0.3,0.3"
|
||||||
sizechangemin="0.9,0.9" sizechangemax="1.2,1.2"
|
sizechangemin="0.9,0.9" sizechangemax="1.2,1.2"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="6.28"
|
||||||
startcolor="1.0, 1.0, 1.0" startalpha="0.8"
|
startcolor="1.0, 1.0, 1.0" startalpha="0.8"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.25"
|
colorchange="0.0, 0.0, 0.0, -0.25"
|
||||||
lifetime="3"
|
lifetime="3"
|
||||||
deleteonhit="true"
|
deleteonhit="true"
|
||||||
velocitychange="0.0, -9.8"/>
|
velocitychange="0.0, -9.8"/>
|
||||||
|
|
||||||
<mist sprite="Content/Particles/spatter.png"
|
<mist sprite="Content/Particles/spatter.png"
|
||||||
startsizemin="0.2,0.2" startsizemax="0.3,0.3"
|
startsizemin="0.4,0.4" startsizemax="0.5,0.5"
|
||||||
sizechangemin="0.5,0.5" sizechangemax="0.5,0.5"
|
sizechangemin="0.25,0.25" sizechangemax="0.3,0.3"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="6.28"
|
||||||
startcolor="1.0, 1.0, 1.0" startalpha="0.5"
|
startcolor="1.0, 1.0, 1.0" startalpha="0.5"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.25"
|
colorchange="0.0, 0.0, 0.0, -0.25"
|
||||||
lifetime="3"
|
lifetime="3"
|
||||||
velocitychange="0.0, -0.05"/>
|
velocitychange="0.0, -0.05"/>
|
||||||
|
|
||||||
<dustcloud sprite="Content/Particles/spatter.png"
|
<dustcloud sprite="Content/Particles/spatter.png"
|
||||||
startsizemin="0.8,0.8" startsizemax="1.0,1.0"
|
startsizemin="0.8,0.8" startsizemax="1.0,1.0"
|
||||||
sizechangemin="0.0,0.0" sizechangemax="0.0,0.0"
|
sizechangemin="0.0,0.0" sizechangemax="0.0,0.0"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="6.28"
|
||||||
startcolor="0.2, 0.2, 0.2" startalpha="0.5"
|
startcolor="0.2, 0.2, 0.2" startalpha="0.5"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.3"
|
colorchange="0.0, 0.0, 0.0, -0.3"
|
||||||
lifetime="3"
|
lifetime="3"
|
||||||
velocitychange="0.0, -5.0"/>
|
velocitychange="0.0, -5.0"/>
|
||||||
|
|
||||||
<bubbles sprite="Content/Particles/bubbles.png"
|
<bubbles sprite="Content/Particles/bubbles.png"
|
||||||
startsizemin="0.4,0.4" startsizemax="0.5,0.5"
|
startsizemin="0.4,0.4" startsizemax="0.5,0.5"
|
||||||
sizechangemin="0.0,0.0" sizechangemax="0.1,0.1"
|
sizechangemin="0.0,0.0" sizechangemax="0.1,0.1"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="3.14"
|
||||||
startcolor="1.0, 1.0, 1.0" startalpha="0.8"
|
startcolor="1.0, 1.0, 1.0" startalpha="0.8"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.5"
|
colorchange="0.0, 0.0, 0.0, -0.5"
|
||||||
lifetime="3"
|
lifetime="3"
|
||||||
deleteonhit="true"
|
deleteonhit="true"
|
||||||
inwater="true"
|
inwater="true"
|
||||||
velocitychange="0.0, 0.1"/>
|
velocitychange="0.0, 0.1"/>
|
||||||
|
|
||||||
<blood sprite="Content/Particles/blood.png"
|
<blood sprite="Content/Particles/blood.png"
|
||||||
startsizemin="0.05,0.05" startsizemax="0.6,0.6"
|
startsizemin="0.05,0.05" startsizemax="0.6,0.6"
|
||||||
sizechangemin="0.3,0.2" sizechangemax="0.4,0.2"
|
sizechangemin="0.3,0.2" sizechangemax="0.4,0.2"
|
||||||
startrotationmin ="0.0" startrotationmax="0.0"
|
startrotationmin ="0.0" startrotationmax="0.0"
|
||||||
startcolor="0.5, 0.0, 0.0" startalpha="1.0"
|
startcolor="0.5, 0.0, 0.0" startalpha="1.0"
|
||||||
colorchange="0.0, 0.0, 0.0, -1.0"
|
colorchange="0.0, 0.0, 0.0, -1.0"
|
||||||
lifetime="2"
|
lifetime="2"
|
||||||
deleteonhit="true"
|
deleteonhit="true"
|
||||||
rotatetodirection="true"
|
rotatetodirection="true"
|
||||||
velocitychange="0.0, -9.8"/>
|
velocitychange="0.0, -9.8"/>
|
||||||
|
|
||||||
<waterblood sprite="Content/Particles/spatter.png"
|
<waterblood sprite="Content/Particles/spatter.png"
|
||||||
startsizemin="0.1,0.1" startsizemax="0.1,0.1"
|
startsizemin="0.1,0.1" startsizemax="0.1,0.1"
|
||||||
sizechangemin="0.15,0.15" sizechangemax="0.2,0.2"
|
sizechangemin="0.15,0.15" sizechangemax="0.2,0.2"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="6.28"
|
||||||
startcolor="0.5, 0.0, 0.0" startalpha="1.0"
|
startcolor="0.5, 0.0, 0.0" startalpha="1.0"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.25"
|
colorchange="0.0, 0.0, 0.0, -0.25"
|
||||||
lifetime="5.0"
|
lifetime="5.0"
|
||||||
inwater="true"
|
inwater="true"
|
||||||
velocitychange="0.0, 0.0"/>
|
velocitychange="0.0, 0.0"/>
|
||||||
|
|
||||||
<explosionfire sprite="Content/Particles/explosion.png"
|
<explosionfire sprite="Content/Particles/explosion.png"
|
||||||
startsizemin="1.5,1.5" startsizemax="3.0,3.0"
|
startsizemin="1.5,1.5" startsizemax="3.0,3.0"
|
||||||
sizechangemin="0.5,0.5" sizechangemax="0.6,0.6"
|
sizechangemin="0.5,0.5" sizechangemax="0.6,0.6"
|
||||||
startrotationmin ="0.0" startrotationmax="3.14"
|
startrotationmin ="0.0" startrotationmax="6.28"
|
||||||
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
||||||
colorchange="-0.4, -0.4, -0.4, -0.3"
|
colorchange="-0.4, -0.4, -0.4, -0.3"
|
||||||
lifetime="5.0"
|
lifetime="5.0"
|
||||||
inwater="false"
|
inwater="false"
|
||||||
deleteonhit="true"
|
deleteonhit="true"
|
||||||
velocitychange="0.0, 0.5"/>
|
velocitychange="0.0, 0.5"/>
|
||||||
</prefabs>
|
</prefabs>
|
||||||
|
|||||||
+304
-267
@@ -1,267 +1,304 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using FarseerPhysics.Dynamics;
|
using FarseerPhysics.Dynamics;
|
||||||
using FarseerPhysics.Factories;
|
using FarseerPhysics.Factories;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Subsurface.Lights;
|
using Subsurface.Lights;
|
||||||
|
|
||||||
namespace Subsurface.Items.Components
|
namespace Subsurface.Items.Components
|
||||||
{
|
{
|
||||||
class Door : ItemComponent
|
class Door : ItemComponent
|
||||||
{
|
{
|
||||||
Gap linkedGap;
|
Gap linkedGap;
|
||||||
|
|
||||||
Rectangle window;
|
Rectangle window;
|
||||||
|
|
||||||
ConvexHull convexHull;
|
ConvexHull convexHull;
|
||||||
ConvexHull convexHull2;
|
ConvexHull convexHull2;
|
||||||
|
|
||||||
Gap LinkedGap
|
Gap LinkedGap
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (linkedGap != null) return linkedGap;
|
if (linkedGap != null) return linkedGap;
|
||||||
foreach (MapEntity e in item.linkedTo)
|
foreach (MapEntity e in item.linkedTo)
|
||||||
{
|
{
|
||||||
linkedGap = e as Gap;
|
linkedGap = e as Gap;
|
||||||
if (linkedGap != null) return linkedGap;
|
if (linkedGap != null) return linkedGap;
|
||||||
}
|
}
|
||||||
linkedGap = new Gap(item.Rect);
|
linkedGap = new Gap(item.Rect);
|
||||||
linkedGap.Open = openState;
|
linkedGap.Open = openState;
|
||||||
item.linkedTo.Add(linkedGap);
|
item.linkedTo.Add(linkedGap);
|
||||||
return linkedGap;
|
return linkedGap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isOpen;
|
bool isOpen;
|
||||||
float openState;
|
float openState;
|
||||||
|
|
||||||
[HasDefaultValue("0.0,0.0,0.0,0.0", false)]
|
[HasDefaultValue("0.0,0.0,0.0,0.0", false)]
|
||||||
public string Window
|
public string Window
|
||||||
{
|
{
|
||||||
get { return ToolBox.Vector4ToString(new Vector4(window.X, window.Y, window.Width, window.Height)); }
|
get { return ToolBox.Vector4ToString(new Vector4(window.X, window.Y, window.Width, window.Height)); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Vector4 vector = ToolBox.ParseToVector4(value);
|
Vector4 vector = ToolBox.ParseToVector4(value);
|
||||||
if (vector.Z!=0.0f || vector.W !=0.0f)
|
if (vector.Z!=0.0f || vector.W !=0.0f)
|
||||||
{
|
{
|
||||||
window = new Rectangle((int)vector.X, (int)vector.Y, (int)vector.Z, (int)vector.W);
|
window = new Rectangle((int)vector.X, (int)vector.Y, (int)vector.Z, (int)vector.W);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Editable, HasDefaultValue(false, true)]
|
[Editable, HasDefaultValue(false, true)]
|
||||||
public bool IsOpen
|
public bool IsOpen
|
||||||
{
|
{
|
||||||
get { return isOpen; }
|
get { return isOpen; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
isOpen = value;
|
isOpen = value;
|
||||||
openState = (isOpen) ? 1.0f : 0.0f;
|
openState = (isOpen) ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float OpenState
|
private Rectangle doorRect;
|
||||||
{
|
|
||||||
get { return openState; }
|
|
||||||
set
|
public float OpenState
|
||||||
{
|
{
|
||||||
if (openState == value) return;
|
get { return openState; }
|
||||||
openState = MathHelper.Clamp(value, 0.0f, 1.0f);
|
set
|
||||||
|
{
|
||||||
|
if (openState == value) return;
|
||||||
|
openState = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||||
if (window==null)
|
|
||||||
{
|
|
||||||
Rectangle rect = item.Rect;
|
|
||||||
rect.Height = (int)(rect.Height * (1.0f - openState));
|
if (window==null)
|
||||||
|
{
|
||||||
}
|
Rectangle rect = item.Rect;
|
||||||
else
|
rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||||
{
|
|
||||||
//Rectangle rect = item.Rect;
|
}
|
||||||
//rect.Height = (int)(rect.Height * (1.0f - openState));
|
else
|
||||||
|
{
|
||||||
Rectangle rect1 = item.Rect;
|
//Rectangle rect = item.Rect;
|
||||||
rect1.Height = -window.Y;
|
//rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||||
|
|
||||||
rect1.Y += (int)(item.Rect.Height * openState);
|
Rectangle rect1 = doorRect;
|
||||||
rect1.Height = Math.Max(rect1.Height - (rect1.Y - item.Rect.Y), 0);
|
rect1.Height = -window.Y;
|
||||||
rect1.Y = Math.Min(item.Rect.Y, rect1.Y);
|
|
||||||
|
rect1.Y += (int)(doorRect.Height * openState);
|
||||||
Rectangle rect2 = item.Rect;
|
rect1.Height = Math.Max(rect1.Height - (rect1.Y - doorRect.Y), 0);
|
||||||
rect2.Y = rect2.Y + window.Y - window.Height;
|
rect1.Y = Math.Min(doorRect.Y, rect1.Y);
|
||||||
|
|
||||||
rect2.Y += (int)(item.Rect.Height * openState);
|
if (rect1.Height == 0)
|
||||||
//rect2.Height = Math.Max(rect2.Height - (rect2.Y - item.Rect.Y), 0);
|
{
|
||||||
rect2.Y = Math.Min(item.Rect.Y, rect2.Y);
|
convexHull.Enabled = false;
|
||||||
rect2.Height = rect2.Y - (item.Rect.Y - (int)(item.Rect.Height * (1.0f - openState)));
|
}
|
||||||
|
else
|
||||||
convexHull.SetVertices(GetConvexHullCorners(rect1));
|
{
|
||||||
if (convexHull2!=null) convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
convexHull.SetVertices(GetConvexHullCorners(rect1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (convexHull2 != null)
|
||||||
}
|
{
|
||||||
|
Rectangle rect2 = doorRect;
|
||||||
PhysicsBody body;
|
rect2.Y = rect2.Y + window.Y - window.Height;
|
||||||
|
|
||||||
Sprite doorSprite;
|
rect2.Y += (int)(doorRect.Height * openState);
|
||||||
|
rect2.Y = Math.Min(doorRect.Y, rect2.Y);
|
||||||
public Door(Item item, XElement element)
|
rect2.Height = rect2.Y - (doorRect.Y - (int)(doorRect.Height * (1.0f - openState)));
|
||||||
: base(item, element)
|
convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||||
{
|
|
||||||
//Vector2 position = new Vector2(newRect.X, newRect.Y);
|
if (rect2.Height == 0)
|
||||||
|
{
|
||||||
// isOpen = false;
|
convexHull2.Enabled = false;
|
||||||
|
}
|
||||||
body = new PhysicsBody(BodyFactory.CreateRectangle(Game1.world,
|
else
|
||||||
ConvertUnits.ToSimUnits(Math.Max(item.Rect.Width, 1)),
|
{
|
||||||
ConvertUnits.ToSimUnits(Math.Max(item.Rect.Height, 1)),
|
convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||||
1.5f));
|
}
|
||||||
|
}
|
||||||
body.BodyType = BodyType.Static;
|
|
||||||
body.SetTransform(
|
|
||||||
ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + item.Rect.Width / 2, item.Rect.Y - item.Rect.Height / 2)),
|
|
||||||
0.0f);
|
|
||||||
body.Friction = 0.5f;
|
}
|
||||||
|
|
||||||
|
}
|
||||||
//string spritePath = Path.GetDirectoryName(item.Prefab.ConfigFile) + "\\"+ ToolBox.GetAttributeString(element, "sprite", "");
|
}
|
||||||
|
|
||||||
foreach (XElement subElement in element.Elements())
|
PhysicsBody body;
|
||||||
{
|
|
||||||
if (subElement.Name.ToString().ToLower() != "sprite") continue;
|
Sprite doorSprite;
|
||||||
doorSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile));
|
|
||||||
break;
|
public Door(Item item, XElement element)
|
||||||
}
|
: base(item, element)
|
||||||
|
{
|
||||||
isActive = true;
|
//Vector2 position = new Vector2(newRect.X, newRect.Y);
|
||||||
|
|
||||||
Vector2[] corners = GetConvexHullCorners(item.Rect);
|
// isOpen = false;
|
||||||
|
foreach (XElement subElement in element.Elements())
|
||||||
convexHull = new ConvexHull(corners, Color.Black);
|
{
|
||||||
if (window!=null) convexHull2 = new ConvexHull(corners, Color.Black);
|
if (subElement.Name.ToString().ToLower() != "sprite") continue;
|
||||||
|
doorSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile));
|
||||||
OpenState = openState;
|
break;
|
||||||
//powerConsumption = -100.0f;
|
}
|
||||||
|
|
||||||
//LinkedGap.Open = openState;
|
doorRect = new Rectangle(
|
||||||
}
|
item.Rect.Center.X - (int)(doorSprite.size.X / 2),
|
||||||
|
item.Rect.Y,
|
||||||
private Vector2[] GetConvexHullCorners(Rectangle rect)
|
(int)doorSprite.size.X,
|
||||||
{
|
(int)doorSprite.size.Y);
|
||||||
Vector2[] corners = new Vector2[4];
|
|
||||||
corners[0] = new Vector2(rect.X, rect.Y - rect.Height);
|
|
||||||
corners[1] = new Vector2(rect.X, rect.Y);
|
body = new PhysicsBody(BodyFactory.CreateRectangle(Game1.world,
|
||||||
corners[2] = new Vector2(rect.Right, rect.Y);
|
ConvertUnits.ToSimUnits(Math.Max(doorRect.Width, 1)),
|
||||||
corners[3] = new Vector2(rect.Right, rect.Y - rect.Height);
|
ConvertUnits.ToSimUnits(Math.Max(doorRect.Height, 1)),
|
||||||
|
1.5f));
|
||||||
return corners;
|
|
||||||
}
|
body.BodyType = BodyType.Static;
|
||||||
|
body.SetTransform(
|
||||||
public override void Move(Vector2 amount)
|
ConvertUnits.ToSimUnits(new Vector2(doorRect.Center.X, doorRect.Y - doorRect.Height / 2)),
|
||||||
{
|
0.0f);
|
||||||
base.Move(amount);
|
body.Friction = 0.5f;
|
||||||
|
|
||||||
body.SetTransform(body.Position + ConvertUnits.ToSimUnits(amount), 0.0f);
|
|
||||||
|
//string spritePath = Path.GetDirectoryName(item.Prefab.ConfigFile) + "\\"+ ToolBox.GetAttributeString(element, "sprite", "");
|
||||||
convexHull.Move(amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
isActive = true;
|
||||||
public override bool Pick(Character picker)
|
|
||||||
{
|
|
||||||
isActive = true;
|
Vector2[] corners = GetConvexHullCorners(doorRect);
|
||||||
isOpen = !isOpen;
|
|
||||||
|
convexHull = new ConvexHull(corners, Color.Black);
|
||||||
return true;
|
if (window!=null) convexHull2 = new ConvexHull(corners, Color.Black);
|
||||||
}
|
|
||||||
|
OpenState = openState;
|
||||||
public override void Update(float deltaTime, Camera cam)
|
//powerConsumption = -100.0f;
|
||||||
{
|
|
||||||
OpenState += deltaTime * ((isOpen) ? 3.0f : -3.0f);
|
//LinkedGap.Open = openState;
|
||||||
|
}
|
||||||
item.SendSignal((isOpen) ? "1" : "0", "state_out");
|
|
||||||
}
|
private Vector2[] GetConvexHullCorners(Rectangle rect)
|
||||||
|
{
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
Vector2[] corners = new Vector2[4];
|
||||||
{
|
corners[0] = new Vector2(rect.X, rect.Y - rect.Height);
|
||||||
|
corners[1] = new Vector2(rect.X, rect.Y);
|
||||||
LinkedGap.Open = openState;
|
corners[2] = new Vector2(rect.Right, rect.Y);
|
||||||
|
corners[3] = new Vector2(rect.Right, rect.Y - rect.Height);
|
||||||
Color color = (item.IsSelected) ? Color.Green : Color.White;
|
|
||||||
|
return corners;
|
||||||
//prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
}
|
||||||
|
|
||||||
if (openState == 1.0f)
|
public override void Move(Vector2 amount)
|
||||||
{
|
{
|
||||||
body.Enabled = false;
|
base.Move(amount);
|
||||||
convexHull.Enabled = false;
|
|
||||||
}
|
linkedGap.Move(amount);
|
||||||
else
|
|
||||||
{
|
body.SetTransform(body.Position + ConvertUnits.ToSimUnits(amount), 0.0f);
|
||||||
spriteBatch.Draw(doorSprite.Texture, new Vector2(item.Rect.Center.X, -item.Rect.Y),
|
|
||||||
new Rectangle(0, (int)(doorSprite.size.Y * openState),
|
convexHull.Move(amount);
|
||||||
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
|
if (convexHull2 != null) convexHull2.Move(amount);
|
||||||
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
|
}
|
||||||
|
|
||||||
convexHull.Enabled = true;
|
|
||||||
|
public override bool Pick(Character picker)
|
||||||
if (openState == 0.0f)
|
{
|
||||||
{
|
isActive = true;
|
||||||
body.Enabled = true;
|
isOpen = !isOpen;
|
||||||
}
|
|
||||||
else
|
return true;
|
||||||
{
|
}
|
||||||
|
|
||||||
|
public override void Update(float deltaTime, Camera cam)
|
||||||
//push characters out of the doorway when the door is closing/opening
|
{
|
||||||
Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y));
|
OpenState += deltaTime * ((isOpen) ? 3.0f : -3.0f);
|
||||||
Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(item.Rect.Width,
|
|
||||||
item.Rect.Height * (1.0f - openState)));
|
item.SendSignal((isOpen) ? "1" : "0", "state_out");
|
||||||
|
}
|
||||||
foreach (Character c in Character.characterList)
|
|
||||||
{
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
int dir = Math.Sign(c.animController.limbs[0].SimPosition.X - simPos.X);
|
{
|
||||||
foreach (Limb l in c.animController.limbs)
|
|
||||||
{
|
LinkedGap.Open = openState;
|
||||||
if (l.SimPosition.Y < simPos.Y || l.SimPosition.Y > simPos.Y - simSize.Y) continue;
|
|
||||||
if (Math.Abs(l.SimPosition.X - simPos.X) > simSize.X * 2.0f) continue;
|
Color color = (item.IsSelected) ? Color.Green : Color.White;
|
||||||
|
|
||||||
l.body.ApplyForce(new Vector2(dir * 10.0f, 0.0f));
|
//prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
||||||
}
|
|
||||||
}
|
if (openState == 1.0f)
|
||||||
}
|
{
|
||||||
}
|
body.Enabled = false;
|
||||||
}
|
convexHull.Enabled = false;
|
||||||
|
}
|
||||||
public override void Remove()
|
else
|
||||||
{
|
{
|
||||||
base.Remove();
|
spriteBatch.Draw(doorSprite.Texture, new Vector2(item.Rect.Center.X, -item.Rect.Y),
|
||||||
|
new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.size.Y * openState),
|
||||||
Game1.world.RemoveBody(body.FarseerBody);
|
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
|
||||||
|
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
|
||||||
doorSprite.Remove();
|
|
||||||
|
convexHull.Enabled = true;
|
||||||
convexHull.Remove();
|
|
||||||
if (convexHull2 != null) convexHull2.Remove();
|
if (openState == 0.0f)
|
||||||
}
|
{
|
||||||
|
body.Enabled = true;
|
||||||
public override void ReceiveSignal(string signal, Connection connection, Item sender)
|
}
|
||||||
{
|
else
|
||||||
isActive = true;
|
{
|
||||||
if (connection.name=="toggle")
|
//push characters out of the doorway when the door is closing/opening
|
||||||
{
|
Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y));
|
||||||
isOpen = !isOpen;
|
Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(item.Rect.Width,
|
||||||
}
|
item.Rect.Height * (1.0f - openState)));
|
||||||
else if (connection.name == "set_state")
|
|
||||||
{
|
foreach (Character c in Character.characterList)
|
||||||
isOpen = (signal!="0");
|
{
|
||||||
}
|
int dir = Math.Sign(c.animController.limbs[0].SimPosition.X - simPos.X);
|
||||||
}
|
foreach (Limb l in c.animController.limbs)
|
||||||
}
|
{
|
||||||
}
|
if (l.SimPosition.Y < simPos.Y || l.SimPosition.Y > simPos.Y - simSize.Y) continue;
|
||||||
|
if (Math.Abs(l.SimPosition.X - simPos.X) > simSize.X * 2.0f) continue;
|
||||||
|
|
||||||
|
l.body.ApplyForce(new Vector2(dir * 10.0f, 0.0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Remove()
|
||||||
|
{
|
||||||
|
base.Remove();
|
||||||
|
|
||||||
|
Game1.world.RemoveBody(body.FarseerBody);
|
||||||
|
|
||||||
|
linkedGap.Remove();
|
||||||
|
|
||||||
|
doorSprite.Remove();
|
||||||
|
|
||||||
|
convexHull.Remove();
|
||||||
|
if (convexHull2 != null) convexHull2.Remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReceiveSignal(string signal, Connection connection, Item sender)
|
||||||
|
{
|
||||||
|
isActive = true;
|
||||||
|
if (connection.name=="toggle")
|
||||||
|
{
|
||||||
|
isOpen = !isOpen;
|
||||||
|
}
|
||||||
|
else if (connection.name == "set_state")
|
||||||
|
{
|
||||||
|
isOpen = (signal!="0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+218
-219
@@ -1,219 +1,218 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
class ItemPrefab : MapEntityPrefab
|
class ItemPrefab : MapEntityPrefab
|
||||||
{
|
{
|
||||||
static string contentFolder = "Content/Items/";
|
static string contentFolder = "Content/Items/";
|
||||||
|
|
||||||
string configFile;
|
string configFile;
|
||||||
|
|
||||||
//should the camera focus on the construction when selected
|
//should the camera focus on the construction when selected
|
||||||
protected bool focusOnSelected;
|
protected bool focusOnSelected;
|
||||||
//the amount of "camera offset" when selecting the construction
|
//the amount of "camera offset" when selecting the construction
|
||||||
protected float offsetOnSelected;
|
protected float offsetOnSelected;
|
||||||
//default size
|
//default size
|
||||||
protected Vector2 size;
|
protected Vector2 size;
|
||||||
|
|
||||||
//how close the character has to be to the item to pick it up
|
//how close the character has to be to the item to pick it up
|
||||||
float pickDistance;
|
float pickDistance;
|
||||||
|
|
||||||
|
|
||||||
public List<Sound> sounds;
|
public List<Sound> sounds;
|
||||||
|
|
||||||
//an area next to the construction
|
//an area next to the construction
|
||||||
//the construction can be Activated() by a character inside the area
|
//the construction can be Activated() by a character inside the area
|
||||||
public List<Rectangle> triggers;
|
public List<Rectangle> triggers;
|
||||||
|
|
||||||
public string ConfigFile
|
public string ConfigFile
|
||||||
{
|
{
|
||||||
get { return configFile; }
|
get { return configFile; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float PickDistance
|
public float PickDistance
|
||||||
{
|
{
|
||||||
get { return pickDistance; }
|
get { return pickDistance; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool IsLinkable
|
public override bool IsLinkable
|
||||||
{
|
{
|
||||||
get { return isLinkable; }
|
get { return isLinkable; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FocusOnSelected
|
public bool FocusOnSelected
|
||||||
{
|
{
|
||||||
get { return focusOnSelected; }
|
get { return focusOnSelected; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float OffsetOnSelected
|
public float OffsetOnSelected
|
||||||
{
|
{
|
||||||
get { return offsetOnSelected; }
|
get { return offsetOnSelected; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
|
public override void UpdatePlacing(SpriteBatch spriteBatch, Camera cam)
|
||||||
{
|
{
|
||||||
Vector2 position = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
Vector2 position = Map.MouseToWorldGrid(cam);
|
||||||
position = cam.ScreenToWorld(position);
|
|
||||||
|
if (!resizeHorizontal && !resizeVertical)
|
||||||
if (!resizeHorizontal && !resizeVertical)
|
{
|
||||||
{
|
if (PlayerInput.LeftButtonClicked())
|
||||||
if (PlayerInput.LeftButtonClicked())
|
{
|
||||||
{
|
new Item(new Rectangle((int)position.X, (int)position.Y, (int)sprite.size.X, (int)sprite.size.Y), this);
|
||||||
new Item(new Rectangle((int)position.X, (int)position.Y, (int)sprite.size.X, (int)sprite.size.Y), this);
|
//constructor.Invoke(lobject);
|
||||||
//constructor.Invoke(lobject);
|
|
||||||
|
placePosition = Vector2.Zero;
|
||||||
placePosition = Vector2.Zero;
|
|
||||||
|
selected = null;
|
||||||
selected = null;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f));
|
||||||
sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f));
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
Vector2 placeSize = size;
|
||||||
Vector2 placeSize = size;
|
|
||||||
|
if (placePosition == Vector2.Zero)
|
||||||
if (placePosition == Vector2.Zero)
|
{
|
||||||
{
|
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
|
||||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
|
placePosition = position;
|
||||||
placePosition = position;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
if (resizeHorizontal)
|
||||||
if (resizeHorizontal)
|
placeSize.X = Math.Max(position.X - placePosition.X, size.X);
|
||||||
placeSize.X = Math.Max(position.X - placePosition.X, size.X);
|
if (resizeVertical)
|
||||||
if (resizeVertical)
|
placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y);
|
||||||
placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y);
|
|
||||||
|
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
|
||||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
|
{
|
||||||
{
|
new Item(new Rectangle((int)placePosition.X, (int)placePosition.Y, (int)placeSize.X, (int)placeSize.Y), this);
|
||||||
new Item(new Rectangle((int)placePosition.X, (int)placePosition.Y, (int)placeSize.X, (int)placeSize.Y), this);
|
|
||||||
|
selected = null;
|
||||||
selected = null;
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
position = placePosition;
|
||||||
position = placePosition;
|
}
|
||||||
}
|
|
||||||
|
sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, Color.White);
|
||||||
sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, Color.White);
|
}
|
||||||
}
|
|
||||||
|
if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null;
|
||||||
if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null;
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
public static void LoadAll()
|
||||||
public static void LoadAll()
|
{
|
||||||
{
|
string[] files = Directory.GetFiles(contentFolder, "*.xml", SearchOption.AllDirectories);
|
||||||
string[] files = Directory.GetFiles(contentFolder, "*.xml", SearchOption.AllDirectories);
|
|
||||||
|
foreach (string filePath in files)
|
||||||
foreach (string filePath in files)
|
{
|
||||||
{
|
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
if (doc == null) return;
|
||||||
if (doc == null) return;
|
|
||||||
|
if (doc.Root.Name.ToString().ToLower() == "item")
|
||||||
if (doc.Root.Name.ToString().ToLower() == "item")
|
{
|
||||||
{
|
new ItemPrefab(doc.Root, filePath);
|
||||||
new ItemPrefab(doc.Root, filePath);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
foreach (XElement element in doc.Root.Elements())
|
||||||
foreach (XElement element in doc.Root.Elements())
|
{
|
||||||
{
|
if (element.Name.ToString().ToLower() != "item") continue;
|
||||||
if (element.Name.ToString().ToLower() != "item") continue;
|
|
||||||
|
new ItemPrefab(element, filePath);
|
||||||
new ItemPrefab(element, filePath);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public ItemPrefab (XElement element, string filePath)
|
||||||
public ItemPrefab (XElement element, string filePath)
|
{
|
||||||
{
|
|
||||||
|
configFile = filePath;
|
||||||
configFile = filePath;
|
|
||||||
|
name = ToolBox.GetAttributeString(element, "name", "");
|
||||||
name = ToolBox.GetAttributeString(element, "name", "");
|
if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!");
|
||||||
if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!");
|
|
||||||
|
//if (element.Attribute("sprite") != null)
|
||||||
//if (element.Attribute("sprite") != null)
|
//{
|
||||||
//{
|
// sprite = new Sprite(Path.GetDirectoryName(filePath) + "/" + element.Attribute("sprite").Value, new Vector2(0.5f, 0.5f));
|
||||||
// sprite = new Sprite(Path.GetDirectoryName(filePath) + "/" + element.Attribute("sprite").Value, new Vector2(0.5f, 0.5f));
|
// sprite.Depth = 0.5f;
|
||||||
// sprite.Depth = 0.5f;
|
//}
|
||||||
//}
|
|
||||||
|
//var initableProperties = GetProperties<Initable>();
|
||||||
//var initableProperties = GetProperties<Initable>();
|
//foreach (ObjectProperty initableProperty in initableProperties)
|
||||||
//foreach (ObjectProperty initableProperty in initableProperties)
|
//{
|
||||||
//{
|
// object value = ToolBox.GetAttributeObject(element, initableProperty.Name.ToLower());
|
||||||
// object value = ToolBox.GetAttributeObject(element, initableProperty.Name.ToLower());
|
// if (value == null)
|
||||||
// if (value == null)
|
// {
|
||||||
// {
|
// foreach (var ini in initableProperty.Attributes.OfType<Initable>())
|
||||||
// foreach (var ini in initableProperty.Attributes.OfType<Initable>())
|
// {
|
||||||
// {
|
// value = ini.defaultValue;
|
||||||
// value = ini.defaultValue;
|
// break;
|
||||||
// break;
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
|
||||||
|
// initableProperty.TrySetValue(value);
|
||||||
// initableProperty.TrySetValue(value);
|
//}
|
||||||
//}
|
|
||||||
|
pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f));
|
||||||
pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f));
|
|
||||||
|
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
|
||||||
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
|
|
||||||
|
resizeHorizontal = ToolBox.GetAttributeBool(element, "resizehorizontal", false);
|
||||||
resizeHorizontal = ToolBox.GetAttributeBool(element, "resizehorizontal", false);
|
resizeVertical = ToolBox.GetAttributeBool(element, "resizevertical", false);
|
||||||
resizeVertical = ToolBox.GetAttributeBool(element, "resizevertical", false);
|
|
||||||
|
focusOnSelected = ToolBox.GetAttributeBool(element, "focusonselected", false);
|
||||||
focusOnSelected = ToolBox.GetAttributeBool(element, "focusonselected", false);
|
|
||||||
|
offsetOnSelected = ToolBox.GetAttributeFloat(element, "offsetonselected", 0.0f);
|
||||||
offsetOnSelected = ToolBox.GetAttributeFloat(element, "offsetonselected", 0.0f);
|
|
||||||
|
triggers = new List<Rectangle>();
|
||||||
triggers = new List<Rectangle>();
|
foreach (XElement subElement in element.Elements())
|
||||||
foreach (XElement subElement in element.Elements())
|
{
|
||||||
{
|
switch (subElement.Name.ToString().ToLower())
|
||||||
switch (subElement.Name.ToString().ToLower())
|
{
|
||||||
{
|
case "sprite":
|
||||||
case "sprite":
|
sprite = new Sprite(subElement, Path.GetDirectoryName(filePath) + "/");
|
||||||
sprite = new Sprite(subElement, Path.GetDirectoryName(filePath) + "/");
|
size = sprite.size;
|
||||||
size = sprite.size;
|
break;
|
||||||
break;
|
case "trigger":
|
||||||
case "trigger":
|
Rectangle trigger = new Rectangle(0, 0, 10,10);
|
||||||
Rectangle trigger = new Rectangle(0, 0, 10,10);
|
|
||||||
|
trigger.X = ToolBox.GetAttributeInt(subElement, "x", 0);
|
||||||
trigger.X = ToolBox.GetAttributeInt(subElement, "x", 0);
|
trigger.Y = ToolBox.GetAttributeInt(subElement, "y", 0);
|
||||||
trigger.Y = ToolBox.GetAttributeInt(subElement, "y", 0);
|
|
||||||
|
trigger.Width = ToolBox.GetAttributeInt(subElement, "width", 0);
|
||||||
trigger.Width = ToolBox.GetAttributeInt(subElement, "width", 0);
|
trigger.Height = ToolBox.GetAttributeInt(subElement, "height", 0);
|
||||||
trigger.Height = ToolBox.GetAttributeInt(subElement, "height", 0);
|
|
||||||
|
triggers.Add(trigger);
|
||||||
triggers.Add(trigger);
|
|
||||||
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
sounds = new List<Sound>();
|
||||||
sounds = new List<Sound>();
|
var soundElements = element.Descendants("Sound");
|
||||||
var soundElements = element.Descendants("Sound");
|
foreach (XElement soundElement in soundElements)
|
||||||
foreach (XElement soundElement in soundElements)
|
{
|
||||||
{
|
string soundPath = ToolBox.GetAttributeString(soundElement, "path", "");
|
||||||
string soundPath = ToolBox.GetAttributeString(soundElement, "path", "");
|
if (soundPath == "") continue;
|
||||||
if (soundPath == "") continue;
|
|
||||||
|
Sound sound = Sound.Load(soundPath);
|
||||||
Sound sound = Sound.Load(soundPath);
|
if (sound != null) sounds.Add(sound);
|
||||||
if (sound != null) sounds.Add(sound);
|
}
|
||||||
}
|
|
||||||
|
list.Add(this);
|
||||||
list.Add(this);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
+578
-572
File diff suppressed because it is too large
Load Diff
+436
-436
@@ -1,436 +1,436 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
|
|
||||||
class Hull : MapEntity
|
class Hull : MapEntity
|
||||||
{
|
{
|
||||||
public static List<Hull> hullList = new List<Hull>();
|
public static List<Hull> hullList = new List<Hull>();
|
||||||
|
|
||||||
public static bool EditWater;
|
public static bool EditWater;
|
||||||
|
|
||||||
public static WaterRenderer renderer;
|
public static WaterRenderer renderer;
|
||||||
|
|
||||||
public static bool DebugDraw;
|
public static bool DebugDraw;
|
||||||
|
|
||||||
public const float OxygenDistributionSpeed = 500.0f;
|
public const float OxygenDistributionSpeed = 500.0f;
|
||||||
public const float OxygenDetoriationSpeed = 0.3f;
|
public const float OxygenDetoriationSpeed = 0.3f;
|
||||||
public const float OxygenConsumptionSpeed = 1000.0f;
|
public const float OxygenConsumptionSpeed = 1000.0f;
|
||||||
|
|
||||||
public const int WaveWidth = 16;
|
public const int WaveWidth = 16;
|
||||||
const float WaveStiffness = 0.003f;
|
const float WaveStiffness = 0.003f;
|
||||||
const float WaveSpread = 0.05f;
|
const float WaveSpread = 0.05f;
|
||||||
const float WaveDampening = 0.01f;
|
const float WaveDampening = 0.01f;
|
||||||
|
|
||||||
//how much excess water the room can contain (= more than the volume of the room)
|
//how much excess water the room can contain (= more than the volume of the room)
|
||||||
public const float MaxCompress = 10000f;
|
public const float MaxCompress = 10000f;
|
||||||
|
|
||||||
public readonly Dictionary<string, PropertyDescriptor> properties;
|
public readonly Dictionary<string, PropertyDescriptor> properties;
|
||||||
|
|
||||||
float lethalPressure;
|
float lethalPressure;
|
||||||
|
|
||||||
float surface;
|
float surface;
|
||||||
float volume;
|
float volume;
|
||||||
float pressure;
|
float pressure;
|
||||||
|
|
||||||
float oxygen;
|
float oxygen;
|
||||||
|
|
||||||
bool update;
|
bool update;
|
||||||
|
|
||||||
float[] waveY; //displacement from the surface of the water
|
float[] waveY; //displacement from the surface of the water
|
||||||
float[] waveVel; //velocity of the point
|
float[] waveVel; //velocity of the point
|
||||||
|
|
||||||
float[] leftDelta;
|
float[] leftDelta;
|
||||||
float[] rightDelta;
|
float[] rightDelta;
|
||||||
|
|
||||||
public override bool IsLinkable
|
public override bool IsLinkable
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float LethalPressure
|
public float LethalPressure
|
||||||
{
|
{
|
||||||
get { return lethalPressure; }
|
get { return lethalPressure; }
|
||||||
set { lethalPressure = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
set { lethalPressure = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 Size
|
public Vector2 Size
|
||||||
{
|
{
|
||||||
get { return new Vector2(rect.Width, rect.Height); }
|
get { return new Vector2(rect.Width, rect.Height); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Surface
|
public float Surface
|
||||||
{
|
{
|
||||||
get { return surface; }
|
get { return surface; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Volume
|
public float Volume
|
||||||
{
|
{
|
||||||
get { return volume; }
|
get { return volume; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
volume = MathHelper.Clamp(value, 0.0f, FullVolume + MaxCompress);
|
volume = MathHelper.Clamp(value, 0.0f, FullVolume + MaxCompress);
|
||||||
if (volume < FullVolume) Pressure = rect.Y - rect.Height + volume / rect.Width;
|
if (volume < FullVolume) Pressure = rect.Y - rect.Height + volume / rect.Width;
|
||||||
if (volume > 0.0f) update = true;
|
if (volume > 0.0f) update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Oxygen
|
public float Oxygen
|
||||||
{
|
{
|
||||||
get { return oxygen; }
|
get { return oxygen; }
|
||||||
set { oxygen = MathHelper.Clamp(value, 0.0f, FullVolume); }
|
set { oxygen = MathHelper.Clamp(value, 0.0f, FullVolume); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float OxygenPercentage
|
public float OxygenPercentage
|
||||||
{
|
{
|
||||||
get { return oxygen / FullVolume * 100.0f; }
|
get { return oxygen / FullVolume * 100.0f; }
|
||||||
set { Oxygen = (value / 100.0f) * FullVolume; }
|
set { Oxygen = (value / 100.0f) * FullVolume; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float FullVolume
|
public float FullVolume
|
||||||
{
|
{
|
||||||
get { return (rect.Width * rect.Height); }
|
get { return (rect.Width * rect.Height); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Pressure
|
public float Pressure
|
||||||
{
|
{
|
||||||
get { return pressure; }
|
get { return pressure; }
|
||||||
set { pressure = value; }
|
set { pressure = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] WaveY
|
public float[] WaveY
|
||||||
{
|
{
|
||||||
get { return waveY; }
|
get { return waveY; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] WaveVel
|
public float[] WaveVel
|
||||||
{
|
{
|
||||||
get { return waveVel; }
|
get { return waveVel; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hull(Rectangle rectangle)
|
public Hull(Rectangle rectangle)
|
||||||
{
|
{
|
||||||
rect = rectangle;
|
rect = rectangle;
|
||||||
|
|
||||||
OxygenPercentage = (float)(Game1.random.NextDouble() * 100.0);
|
OxygenPercentage = (float)(Game1.random.NextDouble() * 100.0);
|
||||||
|
|
||||||
properties = TypeDescriptor.GetProperties(this.GetType())
|
properties = TypeDescriptor.GetProperties(this.GetType())
|
||||||
.Cast<PropertyDescriptor>()
|
.Cast<PropertyDescriptor>()
|
||||||
.ToDictionary(pr => pr.Name);
|
.ToDictionary(pr => pr.Name);
|
||||||
|
|
||||||
int arraySize = (rectangle.Width / WaveWidth + 1);
|
int arraySize = (rectangle.Width / WaveWidth + 1);
|
||||||
waveY = new float[arraySize];
|
waveY = new float[arraySize];
|
||||||
waveVel = new float[arraySize];
|
waveVel = new float[arraySize];
|
||||||
|
|
||||||
leftDelta = new float[arraySize];
|
leftDelta = new float[arraySize];
|
||||||
rightDelta = new float[arraySize];
|
rightDelta = new float[arraySize];
|
||||||
|
|
||||||
surface = rect.Y - rect.Height;
|
surface = rect.Y - rect.Height;
|
||||||
|
|
||||||
aiTarget = new AITarget(this);
|
aiTarget = new AITarget(this);
|
||||||
aiTarget.SightRange = (rect.Width + rect.Height)*10.0f;
|
aiTarget.SightRange = (rect.Width + rect.Height)*10.0f;
|
||||||
|
|
||||||
hullList.Add(this);
|
hullList.Add(this);
|
||||||
|
|
||||||
Item.UpdateHulls();
|
Item.UpdateHulls();
|
||||||
Gap.UpdateHulls();
|
Gap.UpdateHulls();
|
||||||
|
|
||||||
Volume = 0.0f;
|
Volume = 0.0f;
|
||||||
|
|
||||||
//add to list of entities as well
|
//add to list of entities as well
|
||||||
mapEntityList.Add(this);
|
mapEntityList.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 position)
|
public override bool Contains(Vector2 position)
|
||||||
{
|
{
|
||||||
return (Map.RectContains(rect, position) &&
|
return (Map.RectContains(rect, position) &&
|
||||||
!Map.RectContains(new Rectangle(rect.X + 8, rect.Y - 8, rect.Width -16, rect.Height -16), position));
|
!Map.RectContains(new Rectangle(rect.X + 8, rect.Y - 8, rect.Width - 16, rect.Height - 16), position));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetWaveIndex(Vector2 position)
|
public int GetWaveIndex(Vector2 position)
|
||||||
{
|
{
|
||||||
int index = (int)(position.X - rect.X) / WaveWidth;
|
int index = (int)(position.X - rect.X) / WaveWidth;
|
||||||
index = MathHelper.Clamp(index, 0, waveY.Length-1);
|
index = MathHelper.Clamp(index, 0, waveY.Length-1);
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(Vector2 amount)
|
public override void Move(Vector2 amount)
|
||||||
{
|
{
|
||||||
rect.X += (int)amount.X;
|
rect.X += (int)amount.X;
|
||||||
rect.Y += (int)amount.Y;
|
rect.Y += (int)amount.Y;
|
||||||
|
|
||||||
Item.UpdateHulls();
|
Item.UpdateHulls();
|
||||||
Gap.UpdateHulls();
|
Gap.UpdateHulls();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Remove()
|
public override void Remove()
|
||||||
{
|
{
|
||||||
base.Remove();
|
base.Remove();
|
||||||
|
|
||||||
Item.UpdateHulls();
|
Item.UpdateHulls();
|
||||||
Gap.UpdateHulls();
|
Gap.UpdateHulls();
|
||||||
|
|
||||||
//renderer.Dispose();
|
//renderer.Dispose();
|
||||||
|
|
||||||
hullList.Remove(this);
|
hullList.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(Camera cam, float deltaTime)
|
public override void Update(Camera cam, float deltaTime)
|
||||||
{
|
{
|
||||||
Oxygen -= OxygenDetoriationSpeed * deltaTime;
|
Oxygen -= OxygenDetoriationSpeed * deltaTime;
|
||||||
|
|
||||||
if (EditWater)
|
if (EditWater)
|
||||||
{
|
{
|
||||||
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
|
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
if (Map.RectContains(rect, position))
|
if (Map.RectContains(rect, position))
|
||||||
{
|
{
|
||||||
if (PlayerInput.LeftButtonDown())
|
if (PlayerInput.LeftButtonDown())
|
||||||
{
|
{
|
||||||
waveY[(int)(position.X - rect.X) / Hull.WaveWidth] = 100.0f;
|
waveY[(int)(position.X - rect.X) / Hull.WaveWidth] = 100.0f;
|
||||||
Volume = Volume + 1500.0f;
|
Volume = Volume + 1500.0f;
|
||||||
}
|
}
|
||||||
else if (PlayerInput.GetMouseState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
|
else if (PlayerInput.GetMouseState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
|
||||||
{
|
{
|
||||||
Volume = Volume - 1500.0f;
|
Volume = Volume - 1500.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!update) return;
|
if (!update) return;
|
||||||
|
|
||||||
float surfaceY = rect.Y - rect.Height + Volume / rect.Width;
|
float surfaceY = rect.Y - rect.Height + Volume / rect.Width;
|
||||||
for (int i = 0; i < waveY.Length; i++)
|
for (int i = 0; i < waveY.Length; i++)
|
||||||
{
|
{
|
||||||
float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i]));
|
float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i]));
|
||||||
if (maxDelta > ToolBox.RandomFloat(0.2f,10.0f))
|
if (maxDelta > ToolBox.RandomFloat(0.2f,10.0f))
|
||||||
{
|
{
|
||||||
Game1.particleManager.CreateParticle(ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])),
|
Game1.particleManager.CreateParticle(ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])),
|
||||||
0.0f, new Vector2(0.0f, waveVel[i]/10.0f-1.0f), "mist");
|
ToolBox.RandomFloat(0.0f,6.2f), new Vector2(0.0f, -0.5f), "mist");
|
||||||
}
|
}
|
||||||
|
|
||||||
waveY[i] = waveY[i] + waveVel[i];
|
waveY[i] = waveY[i] + waveVel[i];
|
||||||
|
|
||||||
if (surfaceY + waveY[i] > rect.Y)
|
if (surfaceY + waveY[i] > rect.Y)
|
||||||
{
|
{
|
||||||
waveY[i] -= (surfaceY + waveY[i]) - rect.Y;
|
waveY[i] -= (surfaceY + waveY[i]) - rect.Y;
|
||||||
waveVel[i] = waveVel[i] * -0.5f;
|
waveVel[i] = waveVel[i] * -0.5f;
|
||||||
}
|
}
|
||||||
else if (surfaceY + waveY[i] < rect.Y - rect.Height)
|
else if (surfaceY + waveY[i] < rect.Y - rect.Height)
|
||||||
{
|
{
|
||||||
waveY[i] -= (surfaceY + waveY[i]) - (rect.Y - rect.Height);
|
waveY[i] -= (surfaceY + waveY[i]) - (rect.Y - rect.Height);
|
||||||
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++)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < waveY.Length - 1; i++)
|
for (int i = 1; i < waveY.Length - 1; i++)
|
||||||
{
|
{
|
||||||
leftDelta[i] = WaveSpread * (waveY[i] - waveY[i - 1]);
|
leftDelta[i] = WaveSpread * (waveY[i] - waveY[i - 1]);
|
||||||
waveVel[i - 1] = waveVel[i - 1] + leftDelta[i];
|
waveVel[i - 1] = waveVel[i - 1] + leftDelta[i];
|
||||||
|
|
||||||
rightDelta[i] = WaveSpread * (waveY[i] - waveY[i + 1]);
|
rightDelta[i] = WaveSpread * (waveY[i] - waveY[i + 1]);
|
||||||
waveVel[i + 1] = waveVel[i + 1] + rightDelta[i];
|
waveVel[i + 1] = waveVel[i + 1] + rightDelta[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < waveY.Length - 1; i++)
|
for (int i = 1; i < waveY.Length - 1; i++)
|
||||||
{
|
{
|
||||||
waveY[i - 1] = waveY[i - 1] + leftDelta[i];
|
waveY[i - 1] = waveY[i - 1] + leftDelta[i];
|
||||||
waveY[i + 1] = waveY[i + 1] + rightDelta[i];
|
waveY[i + 1] = waveY[i + 1] + rightDelta[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (volume<FullVolume)
|
if (volume<FullVolume)
|
||||||
{
|
{
|
||||||
LethalPressure -= 0.5f;
|
LethalPressure -= 0.5f;
|
||||||
if (Volume == 0.0f)
|
if (Volume == 0.0f)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < waveY.Length - 1; i++)
|
for (int i = 1; i < waveY.Length - 1; i++)
|
||||||
{
|
{
|
||||||
if (waveY[i] > 0.1f) return;
|
if (waveY[i] > 0.1f) return;
|
||||||
}
|
}
|
||||||
update = false;
|
update = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LethalPressure += 1.0f;
|
LethalPressure += 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
||||||
{
|
{
|
||||||
if (!editing && !DebugDraw) return;
|
if (!editing && !DebugDraw) return;
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Vector2(rect.X, -rect.Y),
|
new Vector2(rect.X, -rect.Y),
|
||||||
new Vector2(rect.Width, rect.Height),
|
new Vector2(rect.Width, rect.Height),
|
||||||
isHighlighted ? Color.Green : Color.Blue);
|
isHighlighted ? Color.Green : Color.Blue);
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height),
|
new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height),
|
||||||
Color.Red*((100.0f-OxygenPercentage)/400.0f), true);
|
Color.Red*((100.0f-OxygenPercentage)/400.0f), true);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.font, "Pressure: " + ((int)pressure - rect.Y).ToString() +
|
spriteBatch.DrawString(GUI.font, "Pressure: " + ((int)pressure - rect.Y).ToString() +
|
||||||
" - Lethality: " + lethalPressure +
|
" - Lethality: " + lethalPressure +
|
||||||
" - Oxygen: "+((int)OxygenPercentage).ToString(), new Vector2(rect.X+10, -rect.Y+10), Color.Black);
|
" - Oxygen: "+((int)OxygenPercentage).ToString(), new Vector2(rect.X+10, -rect.Y+10), Color.Black);
|
||||||
spriteBatch.DrawString(GUI.font, volume.ToString() +" / "+ FullVolume.ToString(), new Vector2(rect.X+10, -rect.Y+30), Color.Black);
|
spriteBatch.DrawString(GUI.font, volume.ToString() +" / "+ FullVolume.ToString(), new Vector2(rect.X+10, -rect.Y+30), Color.Black);
|
||||||
|
|
||||||
if (isSelected && editing)
|
if (isSelected && editing)
|
||||||
{
|
{
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Vector2(rect.X - 5, -rect.Y - 5),
|
new Vector2(rect.X - 5, -rect.Y - 5),
|
||||||
new Vector2(rect.Width + 10, rect.Height + 10),
|
new Vector2(rect.Width + 10, rect.Height + 10),
|
||||||
Color.Red);
|
Color.Red);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
//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;
|
float top = rect.Y;
|
||||||
float bottom = rect.Y - rect.Height;
|
float bottom = rect.Y - rect.Height;
|
||||||
float surfaceY = bottom + Volume / rect.Width;
|
float surfaceY = bottom + Volume / rect.Width;
|
||||||
|
|
||||||
//interpolate the position of the rendered surface towards the "target surface"
|
//interpolate the position of the rendered surface towards the "target surface"
|
||||||
surface = surface + (surfaceY - surface) / 10.0f;
|
surface = surface + (surfaceY - surface) / 10.0f;
|
||||||
|
|
||||||
Matrix transform =
|
Matrix transform =
|
||||||
cam.Transform
|
cam.Transform
|
||||||
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
|
|
||||||
if (bottom > cam.WorldView.Y || top < cam.WorldView.Y - cam.WorldView.Height) return;
|
if (bottom > cam.WorldView.Y || top < cam.WorldView.Y - cam.WorldView.Height) return;
|
||||||
|
|
||||||
if (!update)
|
if (!update)
|
||||||
{
|
{
|
||||||
// create the four corners of our triangle.
|
// create the four corners of our triangle.
|
||||||
Vector3 p1 = new Vector3(rect.X, top, 0.0f);
|
Vector3 p1 = new Vector3(rect.X, top, 0.0f);
|
||||||
Vector3 p2 = new Vector3(rect.X + rect.Width, top, 0.0f);
|
Vector3 p2 = new Vector3(rect.X + rect.Width, top, 0.0f);
|
||||||
|
|
||||||
Vector3 p3 = new Vector3(p2.X, bottom, 0.0f);
|
Vector3 p3 = new Vector3(p2.X, bottom, 0.0f);
|
||||||
Vector3 p4 = new Vector3(p1.X, bottom, 0.0f);
|
Vector3 p4 = new Vector3(p1.X, bottom, 0.0f);
|
||||||
|
|
||||||
renderer.vertices[renderer.positionInBuffer] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
renderer.vertices[renderer.positionInBuffer] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 1] = new WaterVertex(p2, new Vector2(p2.X, -p2.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 1] = new WaterVertex(p2, new Vector2(p2.X, -p2.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 2] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 2] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
||||||
|
|
||||||
renderer.vertices[renderer.positionInBuffer + 3] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 3] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 4] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 4] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 5] = new WaterVertex(p4, new Vector2(p4.X, -p4.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 5] = new WaterVertex(p4, new Vector2(p4.X, -p4.Y), transform);
|
||||||
|
|
||||||
renderer.positionInBuffer += 6;
|
renderer.positionInBuffer += 6;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = rect.X;
|
int x = rect.X;
|
||||||
int start = (int)Math.Floor((float)(cam.WorldView.X - x) / WaveWidth);
|
int start = (int)Math.Floor((float)(cam.WorldView.X - x) / WaveWidth);
|
||||||
start = Math.Max(start, 0);
|
start = Math.Max(start, 0);
|
||||||
|
|
||||||
int end = (waveY.Length - 1)
|
int end = (waveY.Length - 1)
|
||||||
- (int)Math.Floor((float)((x + rect.Width) - (cam.WorldView.X + cam.WorldView.Width)) / WaveWidth);
|
- (int)Math.Floor((float)((x + rect.Width) - (cam.WorldView.X + cam.WorldView.Width)) / WaveWidth);
|
||||||
end = Math.Min(end, waveY.Length - 1);
|
end = Math.Min(end, waveY.Length - 1);
|
||||||
|
|
||||||
x += start * WaveWidth;
|
x += start * WaveWidth;
|
||||||
|
|
||||||
for (int i = start; i < end; i++)
|
for (int i = start; i < end; i++)
|
||||||
{
|
{
|
||||||
if (renderer.positionInBuffer > renderer.vertices.Length - 6) return;
|
if (renderer.positionInBuffer > renderer.vertices.Length - 6) return;
|
||||||
|
|
||||||
Vector3 p1 = new Vector3(x, top, 0.0f);
|
Vector3 p1 = new Vector3(x, top, 0.0f);
|
||||||
Vector3 p4 = new Vector3(p1.X, surface + waveY[i], 0.0f);
|
Vector3 p4 = new Vector3(p1.X, surface + waveY[i], 0.0f);
|
||||||
|
|
||||||
//skip adjacent "water rects" if the surface of the water is roughly at the same position
|
//skip adjacent "water rects" if the surface of the water is roughly at the same position
|
||||||
int width = WaveWidth;
|
int width = WaveWidth;
|
||||||
while (i<end-1 && Math.Abs(waveY[i + 1] - waveY[i]) < 1.0f)
|
while (i<end-1 && Math.Abs(waveY[i + 1] - waveY[i]) < 1.0f)
|
||||||
{
|
{
|
||||||
width += WaveWidth;
|
width += WaveWidth;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 p2 = new Vector3(x + width, top, 0.0f);
|
Vector3 p2 = new Vector3(x + width, top, 0.0f);
|
||||||
Vector3 p3 = new Vector3(p2.X, surface + waveY[i+1], 0.0f);
|
Vector3 p3 = new Vector3(p2.X, surface + waveY[i+1], 0.0f);
|
||||||
|
|
||||||
renderer.vertices[renderer.positionInBuffer] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
renderer.vertices[renderer.positionInBuffer] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 1] = new WaterVertex(p2, new Vector2(p2.X, -p2.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 1] = new WaterVertex(p2, new Vector2(p2.X, -p2.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 2] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 2] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
||||||
|
|
||||||
renderer.vertices[renderer.positionInBuffer + 3] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 3] = new WaterVertex(p1, new Vector2(p1.X, -p1.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 4] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 4] = new WaterVertex(p3, new Vector2(p3.X, -p3.Y), transform);
|
||||||
renderer.vertices[renderer.positionInBuffer + 5] = new WaterVertex(p4, new Vector2(p4.X, -p4.Y), transform);
|
renderer.vertices[renderer.positionInBuffer + 5] = new WaterVertex(p4, new Vector2(p4.X, -p4.Y), transform);
|
||||||
|
|
||||||
renderer.positionInBuffer += 6;
|
renderer.positionInBuffer += 6;
|
||||||
|
|
||||||
x += width;
|
x += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns the water block which contains the point (or null if it isn't inside any)
|
//returns the water block which contains the point (or null if it isn't inside any)
|
||||||
public static Hull FindHull(Vector2 position, Hull guess = null)
|
public static Hull FindHull(Vector2 position, Hull guess = null)
|
||||||
{
|
{
|
||||||
if (guess != null && hullList.Contains(guess))
|
if (guess != null && hullList.Contains(guess))
|
||||||
{
|
{
|
||||||
if (Map.RectContains(guess.rect, position)) return guess;
|
if (Map.RectContains(guess.rect, position)) return guess;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Hull w in hullList)
|
foreach (Hull w in hullList)
|
||||||
{
|
{
|
||||||
if (Map.RectContains(w.rect, position)) return w;
|
if (Map.RectContains(w.rect, position)) return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override XElement Save(XDocument doc)
|
public override XElement Save(XDocument doc)
|
||||||
{
|
{
|
||||||
XElement element = new XElement("Hull");
|
XElement element = new XElement("Hull");
|
||||||
|
|
||||||
element.Add(new XAttribute("ID", ID),
|
element.Add(new XAttribute("ID", ID),
|
||||||
new XAttribute("x", rect.X),
|
new XAttribute("x", rect.X),
|
||||||
new XAttribute("y", rect.Y),
|
new XAttribute("y", rect.Y),
|
||||||
new XAttribute("width", rect.Width),
|
new XAttribute("width", rect.Width),
|
||||||
new XAttribute("height", rect.Height),
|
new XAttribute("height", rect.Height),
|
||||||
new XAttribute("water", volume));
|
new XAttribute("water", volume));
|
||||||
|
|
||||||
doc.Root.Add(element);
|
doc.Root.Add(element);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Load(XElement element)
|
public static void Load(XElement element)
|
||||||
{
|
{
|
||||||
Rectangle rect = new Rectangle(
|
Rectangle rect = new Rectangle(
|
||||||
int.Parse(element.Attribute("x").Value),
|
int.Parse(element.Attribute("x").Value),
|
||||||
int.Parse(element.Attribute("y").Value),
|
int.Parse(element.Attribute("y").Value),
|
||||||
int.Parse(element.Attribute("width").Value),
|
int.Parse(element.Attribute("width").Value),
|
||||||
int.Parse(element.Attribute("height").Value));
|
int.Parse(element.Attribute("height").Value));
|
||||||
|
|
||||||
Hull h = new Hull(rect);
|
Hull h = new Hull(rect);
|
||||||
|
|
||||||
h.volume = ToolBox.GetAttributeFloat(element, "pressure", 0.0f);
|
h.volume = ToolBox.GetAttributeFloat(element, "pressure", 0.0f);
|
||||||
|
|
||||||
h.ID = int.Parse(element.Attribute("ID").Value);
|
h.ID = int.Parse(element.Attribute("ID").Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+183
-191
@@ -1,191 +1,183 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Subsurface.Lights
|
namespace Subsurface.Lights
|
||||||
{
|
{
|
||||||
class ConvexHull
|
class ConvexHull
|
||||||
{
|
{
|
||||||
public static List<ConvexHull> list = new List<ConvexHull>();
|
public static List<ConvexHull> list = new List<ConvexHull>();
|
||||||
static BasicEffect drawingEffect;
|
static BasicEffect drawingEffect;
|
||||||
|
|
||||||
private VertexPositionColor[] vertices;
|
private VertexPositionColor[] vertices;
|
||||||
private short[] indices;
|
private short[] indices;
|
||||||
int primitiveCount;
|
int primitiveCount;
|
||||||
|
|
||||||
bool[] backFacing;
|
bool[] backFacing;
|
||||||
VertexPositionColor[] shadowVertices;
|
VertexPositionColor[] shadowVertices;
|
||||||
|
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private Vector2 position = Vector2.Zero;
|
public ConvexHull(Vector2[] points, Color color)
|
||||||
//public Vector2 Position
|
{
|
||||||
//{
|
int vertexCount = points.Length;
|
||||||
// get { return position; }
|
vertices = new VertexPositionColor[vertexCount + 1];
|
||||||
// set { position = value; }
|
Vector2 center = Vector2.Zero;
|
||||||
//}
|
|
||||||
|
for (int i = 0; i < vertexCount; i++)
|
||||||
public ConvexHull(Vector2[] points, Color color)
|
{
|
||||||
{
|
vertices[i] = new VertexPositionColor(new Vector3(points[i], 0), color);
|
||||||
int vertexCount = points.Length;
|
center += points[i];
|
||||||
vertices = new VertexPositionColor[vertexCount + 1];
|
}
|
||||||
Vector2 center = Vector2.Zero;
|
center /= points.Length;
|
||||||
|
vertices[vertexCount] = new VertexPositionColor(new Vector3(center, 0), color);
|
||||||
for (int i = 0; i < vertexCount; i++)
|
|
||||||
{
|
primitiveCount = points.Length;
|
||||||
vertices[i] = new VertexPositionColor(new Vector3(points[i], 0), color);
|
indices = new short[primitiveCount * 3];
|
||||||
center += points[i];
|
|
||||||
}
|
for (int i = 0; i < primitiveCount; i++)
|
||||||
center /= points.Length;
|
{
|
||||||
vertices[vertexCount] = new VertexPositionColor(new Vector3(center, 0), color);
|
indices[3 * i] = (short)i;
|
||||||
|
indices[3 * i + 1] = (short)((i + 1) % vertexCount);
|
||||||
primitiveCount = points.Length;
|
indices[3 * i + 2] = (short)vertexCount;
|
||||||
indices = new short[primitiveCount * 3];
|
}
|
||||||
|
backFacing = new bool[vertexCount];
|
||||||
for (int i = 0; i < primitiveCount; i++)
|
|
||||||
{
|
Enabled = true;
|
||||||
indices[3 * i] = (short)i;
|
|
||||||
indices[3 * i + 1] = (short)((i + 1) % vertexCount);
|
list.Add(this);
|
||||||
indices[3 * i + 2] = (short)vertexCount;
|
}
|
||||||
}
|
|
||||||
backFacing = new bool[vertexCount];
|
public void Move(Vector2 amount)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < vertices.Count(); i++)
|
||||||
Enabled = true;
|
{
|
||||||
|
vertices[i].Position = new Vector3(vertices[i].Position.X + amount.X, vertices[i].Position.Y + amount.Y, vertices[i].Position.Z);
|
||||||
list.Add(this);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move(Vector2 amount)
|
public void SetVertices(Vector2[] points)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vertices.Count(); i++)
|
int vertexCount = points.Length;
|
||||||
{
|
vertices = new VertexPositionColor[vertexCount + 1];
|
||||||
vertices[i].Position = new Vector3(vertices[i].Position.X + amount.X, vertices[i].Position.Y + amount.Y, vertices[i].Position.Z);
|
|
||||||
}
|
for (int i = 0; i < vertexCount; i++)
|
||||||
}
|
{
|
||||||
|
vertices[i] = new VertexPositionColor(new Vector3(points[i], 0), Color.Black);
|
||||||
public void SetVertices(Vector2[] points)
|
}
|
||||||
{
|
}
|
||||||
int vertexCount = points.Length;
|
|
||||||
vertices = new VertexPositionColor[vertexCount + 1];
|
//public void Draw(GameTime gameTime)
|
||||||
|
//{
|
||||||
for (int i = 0; i < vertexCount; i++)
|
// device.RasterizerState = RasterizerState.CullNone;
|
||||||
{
|
// device.BlendState = BlendState.Opaque;
|
||||||
vertices[i] = new VertexPositionColor(new Vector3(points[i], 0), Color.Black);
|
|
||||||
}
|
// drawingEffect.World = Matrix.CreateTranslation(position.X, position.Y, 0);
|
||||||
}
|
|
||||||
|
// foreach (EffectPass pass in drawingEffect.CurrentTechnique.Passes)
|
||||||
//public void Draw(GameTime gameTime)
|
// {
|
||||||
//{
|
// pass.Apply();
|
||||||
// device.RasterizerState = RasterizerState.CullNone;
|
// device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, primitiveCount);
|
||||||
// device.BlendState = BlendState.Opaque;
|
// }
|
||||||
|
//}
|
||||||
// drawingEffect.World = Matrix.CreateTranslation(position.X, position.Y, 0);
|
|
||||||
|
public void DrawShadows(GraphicsDevice graphicsDevice, Camera cam, Vector2 lightSourcePos)
|
||||||
// foreach (EffectPass pass in drawingEffect.CurrentTechnique.Passes)
|
{
|
||||||
// {
|
if (!Enabled) return;
|
||||||
// pass.Apply();
|
|
||||||
// device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, primitiveCount);
|
if (drawingEffect == null)
|
||||||
// }
|
{
|
||||||
//}
|
drawingEffect = new BasicEffect(graphicsDevice);
|
||||||
|
drawingEffect.VertexColorEnabled = true;
|
||||||
public void DrawShadows(GraphicsDevice graphicsDevice, Camera cam, Vector2 lightSourcePos)
|
}
|
||||||
{
|
|
||||||
if (!Enabled) return;
|
//compute facing of each edge, using N*L
|
||||||
|
for (int i = 0; i < primitiveCount; i++)
|
||||||
if (drawingEffect == null)
|
{
|
||||||
{
|
Vector2 firstVertex = new Vector2(vertices[i].Position.X, vertices[i].Position.Y);
|
||||||
drawingEffect = new BasicEffect(graphicsDevice);
|
int secondIndex = (i + 1) % primitiveCount;
|
||||||
drawingEffect.VertexColorEnabled = true;
|
Vector2 secondVertex = new Vector2(vertices[secondIndex].Position.X, vertices[secondIndex].Position.Y);
|
||||||
}
|
Vector2 middle = (firstVertex + secondVertex) / 2;
|
||||||
|
|
||||||
//compute facing of each edge, using N*L
|
Vector2 L = lightSourcePos - middle;
|
||||||
for (int i = 0; i < primitiveCount; i++)
|
|
||||||
{
|
Vector2 N = new Vector2();
|
||||||
Vector2 firstVertex = new Vector2(vertices[i].Position.X, vertices[i].Position.Y);
|
N.X = -(secondVertex.Y - firstVertex.Y);
|
||||||
int secondIndex = (i + 1) % primitiveCount;
|
N.Y = secondVertex.X - firstVertex.X;
|
||||||
Vector2 secondVertex = new Vector2(vertices[secondIndex].Position.X, vertices[secondIndex].Position.Y);
|
|
||||||
Vector2 middle = (firstVertex + secondVertex) / 2;
|
backFacing[i] = (Vector2.Dot(N, L) < 0);
|
||||||
|
}
|
||||||
Vector2 L = lightSourcePos - middle;
|
|
||||||
|
//find beginning and ending vertices which
|
||||||
Vector2 N = new Vector2();
|
//belong to the shadow
|
||||||
N.X = -(secondVertex.Y - firstVertex.Y);
|
int startingIndex = 0;
|
||||||
N.Y = secondVertex.X - firstVertex.X;
|
int endingIndex = 0;
|
||||||
|
for (int i = 0; i < primitiveCount; i++)
|
||||||
backFacing[i] = (Vector2.Dot(N, L) < 0);
|
{
|
||||||
}
|
int currentEdge = i;
|
||||||
|
int nextEdge = (i + 1) % primitiveCount;
|
||||||
//find beginning and ending vertices which
|
|
||||||
//belong to the shadow
|
if (backFacing[currentEdge] && !backFacing[nextEdge])
|
||||||
int startingIndex = 0;
|
endingIndex = nextEdge;
|
||||||
int endingIndex = 0;
|
|
||||||
for (int i = 0; i < primitiveCount; i++)
|
if (!backFacing[currentEdge] && backFacing[nextEdge])
|
||||||
{
|
startingIndex = nextEdge;
|
||||||
int currentEdge = i;
|
}
|
||||||
int nextEdge = (i + 1) % primitiveCount;
|
|
||||||
|
int shadowVertexCount;
|
||||||
if (backFacing[currentEdge] && !backFacing[nextEdge])
|
|
||||||
endingIndex = nextEdge;
|
//nr of vertices that are in the shadow
|
||||||
|
if (endingIndex > startingIndex)
|
||||||
if (!backFacing[currentEdge] && backFacing[nextEdge])
|
shadowVertexCount = endingIndex - startingIndex + 1;
|
||||||
startingIndex = nextEdge;
|
else
|
||||||
}
|
shadowVertexCount = primitiveCount + 1 - startingIndex + endingIndex;
|
||||||
|
|
||||||
int shadowVertexCount;
|
shadowVertices = new VertexPositionColor[shadowVertexCount * 2];
|
||||||
|
|
||||||
//nr of vertices that are in the shadow
|
//create a triangle strip that has the shape of the shadow
|
||||||
if (endingIndex > startingIndex)
|
int currentIndex = startingIndex;
|
||||||
shadowVertexCount = endingIndex - startingIndex + 1;
|
int svCount = 0;
|
||||||
else
|
while (svCount != shadowVertexCount * 2)
|
||||||
shadowVertexCount = primitiveCount + 1 - startingIndex + endingIndex;
|
{
|
||||||
|
Vector3 vertexPos = vertices[currentIndex].Position;
|
||||||
shadowVertices = new VertexPositionColor[shadowVertexCount * 2];
|
|
||||||
|
//one vertex on the hull
|
||||||
//create a triangle strip that has the shape of the shadow
|
shadowVertices[svCount] = new VertexPositionColor();
|
||||||
int currentIndex = startingIndex;
|
shadowVertices[svCount].Color = Color.Black;
|
||||||
int svCount = 0;
|
shadowVertices[svCount].Position = vertexPos;
|
||||||
while (svCount != shadowVertexCount * 2)
|
|
||||||
{
|
//one extruded by the light direction
|
||||||
Vector3 vertexPos = vertices[currentIndex].Position;
|
shadowVertices[svCount + 1] = new VertexPositionColor();
|
||||||
|
shadowVertices[svCount + 1].Color = Color.Black;
|
||||||
//one vertex on the hull
|
Vector3 L2P = vertexPos - new Vector3(lightSourcePos, 0);
|
||||||
shadowVertices[svCount] = new VertexPositionColor();
|
L2P.Normalize();
|
||||||
shadowVertices[svCount].Color = Color.Black;
|
shadowVertices[svCount + 1].Position = new Vector3(lightSourcePos, 0) + L2P * 9000;
|
||||||
shadowVertices[svCount].Position = vertexPos;
|
|
||||||
|
svCount += 2;
|
||||||
//one extruded by the light direction
|
currentIndex = (currentIndex + 1) % primitiveCount;
|
||||||
shadowVertices[svCount + 1] = new VertexPositionColor();
|
}
|
||||||
shadowVertices[svCount + 1].Color = Color.Black;
|
|
||||||
Vector3 L2P = vertexPos - new Vector3(lightSourcePos, 0);
|
drawingEffect.World = cam.ShaderTransform
|
||||||
L2P.Normalize();
|
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
shadowVertices[svCount + 1].Position = new Vector3(lightSourcePos, 0) + L2P * 9000;
|
drawingEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
svCount += 2;
|
graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, shadowVertices, 0, shadowVertexCount * 2 - 2);
|
||||||
currentIndex = (currentIndex + 1) % primitiveCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingEffect.World = cam.ShaderTransform
|
public void Remove()
|
||||||
* Matrix.CreateOrthographic(Game1.GraphicsWidth, Game1.GraphicsHeight, -1, 1) * 0.5f;
|
{
|
||||||
drawingEffect.CurrentTechnique.Passes[0].Apply();
|
list.Remove(this);
|
||||||
|
}
|
||||||
graphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, shadowVertices, 0, shadowVertexCount * 2 - 2);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove()
|
}
|
||||||
{
|
|
||||||
list.Remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
+398
-381
@@ -1,381 +1,398 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using FarseerPhysics.Dynamics;
|
using FarseerPhysics.Dynamics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using FarseerPhysics.Collision;
|
using FarseerPhysics.Collision;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
public enum Direction : byte
|
public enum Direction : byte
|
||||||
{
|
{
|
||||||
None = 0, Left = 1, Right = 2
|
None = 0, Left = 1, Right = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Map
|
static class Map
|
||||||
{
|
{
|
||||||
public static Vector2 gridSize = new Vector2(16.0f, 16.0f);
|
static string MapFolder = "Content/SavedMaps";
|
||||||
|
|
||||||
private static Vector2 lastPickedPosition;
|
public static Vector2 gridSize = new Vector2(16.0f, 16.0f);
|
||||||
private static float lastPickedFraction;
|
|
||||||
|
private static Vector2 lastPickedPosition;
|
||||||
private static Rectangle borders;
|
private static float lastPickedFraction;
|
||||||
|
|
||||||
private static string filePath;
|
private static Rectangle borders;
|
||||||
|
|
||||||
public static Vector2 LastPickedPosition
|
private static string filePath;
|
||||||
{
|
|
||||||
get { return lastPickedPosition; }
|
public static Vector2 LastPickedPosition
|
||||||
}
|
{
|
||||||
|
get { return lastPickedPosition; }
|
||||||
public static float LastPickedFraction
|
}
|
||||||
{
|
|
||||||
get { return lastPickedFraction; }
|
public static float LastPickedFraction
|
||||||
}
|
{
|
||||||
|
get { return lastPickedFraction; }
|
||||||
public static Rectangle Borders
|
}
|
||||||
{
|
|
||||||
get { return borders; }
|
public static Rectangle Borders
|
||||||
}
|
{
|
||||||
|
get { return borders; }
|
||||||
public static string FilePath
|
}
|
||||||
{
|
|
||||||
get { return filePath; }
|
public static string FilePath
|
||||||
}
|
{
|
||||||
|
get { return filePath; }
|
||||||
public static void Draw(SpriteBatch spriteBatch, bool editing = false)
|
}
|
||||||
{
|
|
||||||
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++ )
|
public static void Draw(SpriteBatch spriteBatch, bool editing = false)
|
||||||
{
|
{
|
||||||
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++ )
|
||||||
}
|
{
|
||||||
}
|
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
||||||
|
}
|
||||||
public static void DrawFront(SpriteBatch spriteBatch, bool editing = false)
|
}
|
||||||
{
|
|
||||||
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++)
|
public static void DrawFront(SpriteBatch spriteBatch, bool editing = false)
|
||||||
{
|
{
|
||||||
if (MapEntity.mapEntityList[i].sprite == null || MapEntity.mapEntityList[i].sprite.Depth < 0.5f)
|
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++)
|
||||||
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
{
|
||||||
}
|
if (MapEntity.mapEntityList[i].sprite == null || MapEntity.mapEntityList[i].sprite.Depth < 0.5f)
|
||||||
}
|
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
||||||
|
}
|
||||||
public static void DrawBack(SpriteBatch spriteBatch, bool editing = false)
|
}
|
||||||
{
|
|
||||||
|
public static void DrawBack(SpriteBatch spriteBatch, bool editing = false)
|
||||||
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++)
|
{
|
||||||
{
|
|
||||||
if (MapEntity.mapEntityList[i].sprite == null || MapEntity.mapEntityList[i].sprite.Depth >= 0.5f)
|
for (int i = 0; i < MapEntity.mapEntityList.Count(); i++)
|
||||||
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
{
|
||||||
}
|
if (MapEntity.mapEntityList[i].sprite == null || MapEntity.mapEntityList[i].sprite.Depth >= 0.5f)
|
||||||
}
|
MapEntity.mapEntityList[i].Draw(spriteBatch, editing);
|
||||||
|
}
|
||||||
public static Vector2 MouseToWorldGrid(Camera cam)
|
}
|
||||||
{
|
|
||||||
Vector2 position = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
public static Vector2 MouseToWorldGrid(Camera cam)
|
||||||
position = cam.ScreenToWorld(position);
|
{
|
||||||
|
Vector2 position = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
||||||
return VectorToWorldGrid(position);
|
position = cam.ScreenToWorld(position);
|
||||||
}
|
|
||||||
|
return VectorToWorldGrid(position);
|
||||||
public static Vector2 VectorToWorldGrid(Vector2 position)
|
}
|
||||||
{
|
|
||||||
position.X = (float)Math.Floor(Convert.ToDouble(position.X / gridSize.X)) * gridSize.X;
|
public static Vector2 VectorToWorldGrid(Vector2 position)
|
||||||
position.Y = (float)Math.Ceiling(Convert.ToDouble(position.Y / gridSize.Y)) * gridSize.Y;
|
{
|
||||||
|
position.X = (float)Math.Floor(Convert.ToDouble(position.X / gridSize.X)) * gridSize.X;
|
||||||
return position;
|
position.Y = (float)Math.Ceiling(Convert.ToDouble(position.Y / gridSize.Y)) * gridSize.Y;
|
||||||
}
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
public static Rectangle AbsRect(Vector2 pos, Vector2 size)
|
|
||||||
{
|
|
||||||
if (size.X < 0.0f)
|
public static Rectangle AbsRect(Vector2 pos, Vector2 size)
|
||||||
{
|
{
|
||||||
pos.X += size.X;
|
if (size.X < 0.0f)
|
||||||
size.X = -size.X;
|
{
|
||||||
}
|
pos.X += size.X;
|
||||||
if (size.Y < 0.0f)
|
size.X = -size.X;
|
||||||
{
|
}
|
||||||
pos.Y -= size.Y;
|
if (size.Y < 0.0f)
|
||||||
size.Y = -size.Y;
|
{
|
||||||
}
|
pos.Y -= size.Y;
|
||||||
|
size.Y = -size.Y;
|
||||||
return new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
|
}
|
||||||
}
|
|
||||||
|
return new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
|
||||||
public static bool RectContains(Rectangle rect, Vector2 pos)
|
}
|
||||||
{
|
|
||||||
return (pos.X > rect.X && pos.X < rect.X + rect.Width
|
public static bool RectContains(Rectangle rect, Vector2 pos)
|
||||||
&& pos.Y < rect.Y && pos.Y > rect.Y - rect.Height);
|
{
|
||||||
}
|
return (pos.X > rect.X && pos.X < rect.X + rect.Width
|
||||||
|
&& pos.Y < rect.Y && pos.Y > rect.Y - rect.Height);
|
||||||
public static bool RectsOverlap(Rectangle rect1, Rectangle rect2)
|
}
|
||||||
{
|
|
||||||
return !(rect1.X > rect2.X + rect2.Width || rect1.X + rect1.Width < rect2.X ||
|
public static bool RectsOverlap(Rectangle rect1, Rectangle rect2)
|
||||||
rect1.Y < rect2.Y - rect2.Height || rect1.Y - rect1.Height > rect2.Y);
|
{
|
||||||
}
|
return !(rect1.X > rect2.X + rect2.Width || rect1.X + rect1.Width < rect2.X ||
|
||||||
|
rect1.Y < rect2.Y - rect2.Height || rect1.Y - rect1.Height > rect2.Y);
|
||||||
public static Body PickBody(Vector2 rayStart, Vector2 rayEnd, List<Body> ignoredBodies = null)
|
}
|
||||||
{
|
|
||||||
float closestFraction = 1.0f;
|
public static Body PickBody(Vector2 rayStart, Vector2 rayEnd, List<Body> ignoredBodies = null)
|
||||||
Body closestBody = null;
|
{
|
||||||
Game1.world.RayCast((fixture, point, normal, fraction) =>
|
float closestFraction = 1.0f;
|
||||||
{
|
Body closestBody = null;
|
||||||
if (fixture == null || fixture.CollisionCategories == Category.None) return -1;
|
Game1.world.RayCast((fixture, point, normal, fraction) =>
|
||||||
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
|
{
|
||||||
|
if (fixture == null || fixture.CollisionCategories == Category.None) return -1;
|
||||||
Structure structure = fixture.Body.UserData as Structure;
|
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
|
||||||
if (structure != null && (structure.IsPlatform || !structure.HasBody)) return -1;
|
|
||||||
|
Structure structure = fixture.Body.UserData as Structure;
|
||||||
if (fraction < closestFraction)
|
if (structure != null && (structure.IsPlatform || !structure.HasBody)) return -1;
|
||||||
{
|
|
||||||
closestFraction = fraction;
|
if (fraction < closestFraction)
|
||||||
if (fixture.Body!=null) closestBody = fixture.Body;
|
{
|
||||||
}
|
closestFraction = fraction;
|
||||||
return fraction;
|
if (fixture.Body!=null) closestBody = fixture.Body;
|
||||||
}
|
}
|
||||||
, rayStart, rayEnd);
|
return fraction;
|
||||||
|
}
|
||||||
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
, rayStart, rayEnd);
|
||||||
lastPickedFraction = closestFraction;
|
|
||||||
return closestBody;
|
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
||||||
}
|
lastPickedFraction = closestFraction;
|
||||||
|
return closestBody;
|
||||||
|
}
|
||||||
public static Structure CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
|
|
||||||
{
|
|
||||||
Structure closestStructure = null;
|
public static Structure CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
|
||||||
float closestFraction = 1.0f;
|
{
|
||||||
|
Structure closestStructure = null;
|
||||||
if (Vector2.Distance(rayStart,rayEnd)<0.01f)
|
float closestFraction = 1.0f;
|
||||||
{
|
|
||||||
closestFraction = 0.01f;
|
if (Vector2.Distance(rayStart,rayEnd)<0.01f)
|
||||||
return null;
|
{
|
||||||
}
|
closestFraction = 0.01f;
|
||||||
|
return null;
|
||||||
Game1.world.RayCast((fixture, point, normal, fraction) =>
|
}
|
||||||
{
|
|
||||||
if (fixture == null || fixture.CollisionCategories != Physics.CollisionWall) return -1;
|
Game1.world.RayCast((fixture, point, normal, fraction) =>
|
||||||
|
{
|
||||||
Structure structure = fixture.Body.UserData as Structure;
|
if (fixture == null || fixture.CollisionCategories != Physics.CollisionWall) return -1;
|
||||||
if (structure != null)
|
|
||||||
{
|
Structure structure = fixture.Body.UserData as Structure;
|
||||||
if (structure.IsPlatform || structure.StairDirection != Direction.None) return -1;
|
if (structure != null)
|
||||||
int sectionIndex = structure.FindSectionIndex(ConvertUnits.ToDisplayUnits(point));
|
{
|
||||||
if (sectionIndex > -1 && structure.SectionHasHole(sectionIndex)) return -1;
|
if (structure.IsPlatform || structure.StairDirection != Direction.None) return -1;
|
||||||
}
|
int sectionIndex = structure.FindSectionIndex(ConvertUnits.ToDisplayUnits(point));
|
||||||
|
if (sectionIndex > -1 && structure.SectionHasHole(sectionIndex)) return -1;
|
||||||
if (fraction < closestFraction)
|
}
|
||||||
{
|
|
||||||
if (structure != null) closestStructure = structure;
|
if (fraction < closestFraction)
|
||||||
closestFraction = fraction;
|
{
|
||||||
}
|
if (structure != null) closestStructure = structure;
|
||||||
return closestFraction;
|
closestFraction = fraction;
|
||||||
}
|
}
|
||||||
, rayStart, rayEnd);
|
return closestFraction;
|
||||||
|
}
|
||||||
|
, rayStart, rayEnd);
|
||||||
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
|
||||||
lastPickedFraction = closestFraction;
|
|
||||||
return closestStructure;
|
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
||||||
}
|
lastPickedFraction = closestFraction;
|
||||||
|
return closestStructure;
|
||||||
public static Body PickBody(Vector2 point)
|
}
|
||||||
{
|
|
||||||
Body foundBody = null;
|
public static Body PickBody(Vector2 point)
|
||||||
AABB aabb = new AABB(point, point);
|
{
|
||||||
|
Body foundBody = null;
|
||||||
Game1.world.QueryAABB(p =>
|
AABB aabb = new AABB(point, point);
|
||||||
{
|
|
||||||
foundBody = p.Body;
|
Game1.world.QueryAABB(p =>
|
||||||
|
{
|
||||||
return true;
|
foundBody = p.Body;
|
||||||
|
|
||||||
}, ref aabb);
|
return true;
|
||||||
|
|
||||||
return foundBody;
|
}, ref aabb);
|
||||||
}
|
|
||||||
|
return foundBody;
|
||||||
public static bool InsideWall(Vector2 point)
|
}
|
||||||
{
|
|
||||||
Body foundBody = Map.PickBody(point);
|
public static bool InsideWall(Vector2 point)
|
||||||
if (foundBody==null) return false;
|
{
|
||||||
|
Body foundBody = Map.PickBody(point);
|
||||||
Structure wall = foundBody.UserData as Structure;
|
if (foundBody==null) return false;
|
||||||
if (wall == null || wall.IsPlatform) return false;
|
|
||||||
|
Structure wall = foundBody.UserData as Structure;
|
||||||
return true;
|
if (wall == null || wall.IsPlatform) return false;
|
||||||
}
|
|
||||||
|
return true;
|
||||||
public static void Save(string filePath, string fileName)
|
}
|
||||||
{
|
|
||||||
if (fileName==null)
|
public static void Save(string filePath, string fileName)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("No save file selected");
|
if (fileName==null)
|
||||||
return;
|
{
|
||||||
}
|
DebugConsole.ThrowError("No save file selected");
|
||||||
XDocument doc = new XDocument(
|
return;
|
||||||
new XElement((XName)fileName));
|
}
|
||||||
|
XDocument doc = new XDocument(
|
||||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
new XElement((XName)fileName));
|
||||||
{
|
|
||||||
e.Save(doc);
|
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||||
}
|
{
|
||||||
|
e.Save(doc);
|
||||||
try
|
}
|
||||||
{
|
|
||||||
string docString = doc.ToString();
|
try
|
||||||
ToolBox.CompressStringToFile(filePath+fileName+".gz", doc.ToString());
|
{
|
||||||
}
|
string docString = doc.ToString();
|
||||||
catch
|
ToolBox.CompressStringToFile(filePath+fileName+".gz", doc.ToString());
|
||||||
{
|
}
|
||||||
DebugConsole.ThrowError("Saving map ''" + filePath + fileName + "'' failed!");
|
catch
|
||||||
}
|
{
|
||||||
|
DebugConsole.ThrowError("Saving map ''" + filePath + fileName + "'' failed!");
|
||||||
|
}
|
||||||
//doc.Save(filePath + fileName);
|
|
||||||
}
|
|
||||||
|
//doc.Save(filePath + fileName);
|
||||||
public static string[] GetMapFilePaths()
|
}
|
||||||
{
|
|
||||||
string[] mapFilePaths;
|
public static string[] GetMapFilePaths()
|
||||||
try
|
{
|
||||||
{
|
string[] mapFilePaths;
|
||||||
mapFilePaths = Directory.GetFiles("Content/SavedMaps");
|
|
||||||
}
|
if (!Directory.Exists(MapFolder))
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
try
|
||||||
DebugConsole.ThrowError("Couldn't open directory ''Content/SavedMaps''!", e);
|
{
|
||||||
return null;
|
Directory.CreateDirectory(MapFolder);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
return mapFilePaths;
|
{
|
||||||
}
|
|
||||||
|
DebugConsole.ThrowError("Directory ''Content/SavedMaps'' not found and creating the directory failed.");
|
||||||
public static void Load(string filePath, string fileName)
|
return null;
|
||||||
{
|
}
|
||||||
Load(filePath + fileName);
|
}
|
||||||
}
|
|
||||||
|
try
|
||||||
public static void Load(string file)
|
{
|
||||||
{
|
mapFilePaths = Directory.GetFiles(MapFolder);
|
||||||
Clear();
|
}
|
||||||
filePath = file;
|
catch (Exception e)
|
||||||
XDocument doc = null;
|
{
|
||||||
|
DebugConsole.ThrowError("Couldn't open directory ''Content/SavedMaps''!", e);
|
||||||
string extension = Path.GetExtension(file);
|
return null;
|
||||||
|
}
|
||||||
if (extension==".gz")
|
|
||||||
{
|
return mapFilePaths;
|
||||||
Stream stream = ToolBox.DecompressFiletoStream(file);
|
}
|
||||||
if (stream == null)
|
|
||||||
{
|
public static void Load(string filePath, string fileName)
|
||||||
DebugConsole.ThrowError("Loading map ''" + file + "'' failed!");
|
{
|
||||||
return;
|
Load(filePath + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
public static void Load(string file)
|
||||||
{
|
{
|
||||||
stream.Position = 0;
|
Clear();
|
||||||
doc = XDocument.Load(stream); //ToolBox.TryLoadXml(file);
|
filePath = file;
|
||||||
stream.Close();
|
XDocument doc = null;
|
||||||
stream.Dispose();
|
|
||||||
}
|
string extension = Path.GetExtension(file);
|
||||||
|
|
||||||
catch
|
if (extension==".gz")
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Loading map ''" + file + "'' failed!");
|
Stream stream = ToolBox.DecompressFiletoStream(file);
|
||||||
return;
|
if (stream == null)
|
||||||
}
|
{
|
||||||
}
|
DebugConsole.ThrowError("Loading map ''" + file + "'' failed!");
|
||||||
else if (extension ==".xml")
|
return;
|
||||||
{
|
}
|
||||||
doc = XDocument.Load(file);
|
|
||||||
}
|
try
|
||||||
else
|
{
|
||||||
{
|
stream.Position = 0;
|
||||||
DebugConsole.ThrowError("Couldn't load map ''"+file+"! (Unrecognized file extension)");
|
doc = XDocument.Load(stream); //ToolBox.TryLoadXml(file);
|
||||||
return;
|
stream.Close();
|
||||||
}
|
stream.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
foreach (XElement element in doc.Root.Elements())
|
catch
|
||||||
{
|
{
|
||||||
string typeName = element.Name.ToString();
|
DebugConsole.ThrowError("Loading map ''" + file + "'' failed!");
|
||||||
|
return;
|
||||||
Type t;
|
}
|
||||||
try
|
}
|
||||||
{
|
else if (extension ==".xml")
|
||||||
// Get the type of a specified class.
|
{
|
||||||
t = Type.GetType("Subsurface." + typeName + ", Subsurface", true, true);
|
doc = XDocument.Load(file);
|
||||||
if (t == null)
|
}
|
||||||
{
|
else
|
||||||
DebugConsole.ThrowError("Error in " + file + "! Could not find a entity of the type ''" + typeName + "''.");
|
{
|
||||||
continue;
|
DebugConsole.ThrowError("Couldn't load map ''"+file+"! (Unrecognized file extension)");
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Error in " + file + "! Could not find a entity of the type ''" + typeName + "''.", e);
|
foreach (XElement element in doc.Root.Elements())
|
||||||
continue;
|
{
|
||||||
}
|
string typeName = element.Name.ToString();
|
||||||
|
|
||||||
try
|
Type t;
|
||||||
{
|
try
|
||||||
MethodInfo loadMethod = t.GetMethod("Load");
|
{
|
||||||
loadMethod.Invoke(t, new object[] { element });
|
// Get the type of a specified class.
|
||||||
}
|
t = Type.GetType("Subsurface." + typeName + ", Subsurface", true, true);
|
||||||
catch (Exception e)
|
if (t == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Could not find the method ''Load'' in " + t + ".", e);
|
DebugConsole.ThrowError("Error in " + file + "! Could not find a entity of the type ''" + typeName + "''.");
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
borders = new Rectangle(0, 0, 1, 1);
|
{
|
||||||
foreach (Hull hull in Hull.hullList)
|
DebugConsole.ThrowError("Error in " + file + "! Could not find a entity of the type ''" + typeName + "''.", e);
|
||||||
{
|
continue;
|
||||||
if (hull.Rect.X < borders.X || borders.X == 0) borders.X = hull.Rect.X;
|
}
|
||||||
if (hull.Rect.Y > borders.Y || borders.Y == 0) borders.Y = hull.Rect.Y;
|
|
||||||
|
try
|
||||||
if (hull.Rect.X + hull.Rect.Width > borders.X + borders.Width) borders.Width = hull.Rect.X + hull.Rect.Width - borders.X;
|
{
|
||||||
if (hull.Rect.Y - hull.Rect.Height < borders.Y - borders.Height) borders.Height = borders.Y - (hull.Rect.Y - hull.Rect.Height);
|
MethodInfo loadMethod = t.GetMethod("Load");
|
||||||
}
|
loadMethod.Invoke(t, new object[] { element });
|
||||||
|
}
|
||||||
MapEntity.LinkAll();
|
catch (Exception e)
|
||||||
foreach (Item item in Item.itemList)
|
{
|
||||||
{
|
DebugConsole.ThrowError("Could not find the method ''Load'' in " + t + ".", e);
|
||||||
foreach (ItemComponent ic in item.components)
|
}
|
||||||
{
|
|
||||||
ic.OnMapLoaded();
|
}
|
||||||
}
|
|
||||||
}
|
borders = new Rectangle(0, 0, 1, 1);
|
||||||
}
|
foreach (Hull hull in Hull.hullList)
|
||||||
|
{
|
||||||
|
if (hull.Rect.X < borders.X || borders.X == 0) borders.X = hull.Rect.X;
|
||||||
|
if (hull.Rect.Y > borders.Y || borders.Y == 0) borders.Y = hull.Rect.Y;
|
||||||
public static void Clear()
|
|
||||||
{
|
if (hull.Rect.X + hull.Rect.Width > borders.X + borders.Width) borders.Width = hull.Rect.X + hull.Rect.Width - borders.X;
|
||||||
Map.filePath = "";
|
if (hull.Rect.Y - hull.Rect.Height < borders.Y - borders.Height) borders.Height = borders.Y - (hull.Rect.Y - hull.Rect.Height);
|
||||||
|
}
|
||||||
if (Game1.gameScreen.Cam != null) Game1.gameScreen.Cam.TargetPos = Vector2.Zero;
|
|
||||||
|
MapEntity.LinkAll();
|
||||||
Entity.RemoveAll();
|
foreach (Item item in Item.itemList)
|
||||||
|
{
|
||||||
if (Game1.gameSession!=null)
|
foreach (ItemComponent ic in item.components)
|
||||||
Game1.gameSession.crewManager.EndShift();
|
{
|
||||||
|
ic.OnMapLoaded();
|
||||||
PhysicsBody.list.Clear();
|
}
|
||||||
|
}
|
||||||
Ragdoll.list.Clear();
|
}
|
||||||
|
|
||||||
Game1.world.Clear();
|
|
||||||
}
|
|
||||||
|
public static void Clear()
|
||||||
}
|
{
|
||||||
}
|
Map.filePath = "";
|
||||||
|
|
||||||
|
if (Game1.gameScreen.Cam != null) Game1.gameScreen.Cam.TargetPos = Vector2.Zero;
|
||||||
|
|
||||||
|
Entity.RemoveAll();
|
||||||
|
|
||||||
|
if (Game1.gameSession!=null)
|
||||||
|
Game1.gameSession.crewManager.EndShift();
|
||||||
|
|
||||||
|
PhysicsBody.list.Clear();
|
||||||
|
|
||||||
|
Ragdoll.list.Clear();
|
||||||
|
|
||||||
|
Game1.world.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+291
-291
@@ -1,291 +1,291 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Subsurface
|
namespace Subsurface
|
||||||
{
|
{
|
||||||
class EditMapScreen : Screen
|
class EditMapScreen : Screen
|
||||||
{
|
{
|
||||||
Camera cam;
|
Camera cam;
|
||||||
|
|
||||||
GUIComponent GUIpanel;
|
GUIComponent GUIpanel;
|
||||||
|
|
||||||
GUIComponent[] GUItabs;
|
GUIComponent[] GUItabs;
|
||||||
int selectedTab;
|
int selectedTab;
|
||||||
|
|
||||||
//a character used for picking up and manipulating items
|
//a character used for picking up and manipulating items
|
||||||
Character dummyCharacter;
|
Character dummyCharacter;
|
||||||
|
|
||||||
bool characterMode;
|
bool characterMode;
|
||||||
|
|
||||||
public Camera Cam
|
public Camera Cam
|
||||||
{
|
{
|
||||||
get { return cam; }
|
get { return cam; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditMapScreen()
|
public EditMapScreen()
|
||||||
{
|
{
|
||||||
cam = new Camera();
|
cam = new Camera();
|
||||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||||
|
|
||||||
selectedTab = -1;
|
selectedTab = -1;
|
||||||
|
|
||||||
GUIpanel = new GUIFrame(new Rectangle(0,0, 120, Game1.GraphicsHeight), Color.DarkGray*0.8f);
|
GUIpanel = new GUIFrame(new Rectangle(0,0, 120, Game1.GraphicsHeight), Color.DarkGray*0.8f);
|
||||||
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
//GUIListBox constructionList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUIpanel);
|
//GUIListBox constructionList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUIpanel);
|
||||||
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
|
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
|
||||||
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
|
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", GUI.style, Alignment.Left, GUIpanel);
|
GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", GUI.style, Alignment.Left, GUIpanel);
|
||||||
button.UserData = 0;
|
button.UserData = 0;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", GUI.style, Alignment.Left, GUIpanel);
|
button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", GUI.style, Alignment.Left, GUIpanel);
|
||||||
button.UserData = 1;
|
button.UserData = 1;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", GUI.style, Alignment.Left, GUIpanel);
|
button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", GUI.style, Alignment.Left, GUIpanel);
|
||||||
button.OnClicked = ToggleCharacterMode;
|
button.OnClicked = ToggleCharacterMode;
|
||||||
|
|
||||||
GUItabs = new GUIComponent[2];
|
GUItabs = new GUIComponent[2];
|
||||||
int width = 400, height = 400;
|
int width = 400, height = 400;
|
||||||
GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), Color.DarkGray*0.8f);
|
GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), Color.DarkGray*0.8f);
|
||||||
GUItabs[0].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
GUItabs[0].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUItabs[0]);
|
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUItabs[0]);
|
||||||
itemList.OnSelected = SelectPrefab;
|
itemList.OnSelected = SelectPrefab;
|
||||||
itemList.CheckSelected = MapEntityPrefab.GetSelected;
|
itemList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||||
|
|
||||||
GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), Color.DarkGray * 0.8f);
|
GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), Color.DarkGray * 0.8f);
|
||||||
GUItabs[1].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
GUItabs[1].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUItabs[1]);
|
GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUItabs[1]);
|
||||||
structureList.OnSelected = SelectPrefab;
|
structureList.OnSelected = SelectPrefab;
|
||||||
structureList.CheckSelected = MapEntityPrefab.GetSelected;
|
structureList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||||
|
|
||||||
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
|
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
|
||||||
{
|
{
|
||||||
GUIListBox parent = ((ep as ItemPrefab) == null) ? structureList : itemList;
|
GUIListBox parent = ((ep as ItemPrefab) == null) ? structureList : itemList;
|
||||||
Color color = ((parent.CountChildren % 2) == 0) ? Color.White : Color.LightGray;
|
Color color = ((parent.CountChildren % 2) == 0) ? Color.White : Color.LightGray;
|
||||||
|
|
||||||
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, parent);
|
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, parent);
|
||||||
frame.UserData = ep;
|
frame.UserData = ep;
|
||||||
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
frame.Color = color;
|
frame.Color = color;
|
||||||
frame.HoverColor = Color.Gold * 0.2f;
|
frame.HoverColor = Color.Gold * 0.2f;
|
||||||
frame.SelectedColor = Color.Gold * 0.5f;
|
frame.SelectedColor = Color.Gold * 0.5f;
|
||||||
|
|
||||||
GUITextBlock textBlock = new GUITextBlock(
|
GUITextBlock textBlock = new GUITextBlock(
|
||||||
new Rectangle(40, 0, 0, 25),
|
new Rectangle(40, 0, 0, 25),
|
||||||
ep.Name,
|
ep.Name,
|
||||||
Color.Transparent, Color.Black,
|
Color.Transparent, Color.Black,
|
||||||
Alignment.Left,
|
Alignment.Left,
|
||||||
Alignment.Left,
|
Alignment.Left,
|
||||||
frame);
|
frame);
|
||||||
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
||||||
|
|
||||||
if (ep.sprite != null)
|
if (ep.sprite != null)
|
||||||
{
|
{
|
||||||
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
|
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
|
||||||
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
|
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Select()
|
public override void Select()
|
||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
|
|
||||||
GUIComponent.MouseOn = null;
|
GUIComponent.MouseOn = null;
|
||||||
characterMode = false;
|
characterMode = false;
|
||||||
//CreateDummyCharacter();
|
//CreateDummyCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deselect()
|
public override void Deselect()
|
||||||
{
|
{
|
||||||
base.Deselect();
|
base.Deselect();
|
||||||
|
|
||||||
GUIComponent.MouseOn = null;
|
GUIComponent.MouseOn = null;
|
||||||
|
|
||||||
if (dummyCharacter != null)
|
if (dummyCharacter != null)
|
||||||
{
|
{
|
||||||
dummyCharacter.Remove();
|
dummyCharacter.Remove();
|
||||||
dummyCharacter = null;
|
dummyCharacter = null;
|
||||||
Game1.world.ProcessChanges();
|
Game1.world.ProcessChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateDummyCharacter()
|
private void CreateDummyCharacter()
|
||||||
{
|
{
|
||||||
if (dummyCharacter != null) dummyCharacter.Remove();
|
if (dummyCharacter != null) dummyCharacter.Remove();
|
||||||
|
|
||||||
dummyCharacter = new Character("Content/Characters/Human/human.xml", Vector2.Zero);
|
dummyCharacter = new Character("Content/Characters/Human/human.xml", Vector2.Zero);
|
||||||
Character.Controlled = dummyCharacter;
|
Character.Controlled = dummyCharacter;
|
||||||
Game1.world.ProcessChanges();
|
Game1.world.ProcessChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectTab(GUIButton button, object obj)
|
private bool SelectTab(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
selectedTab = (int)obj;
|
selectedTab = (int)obj;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ToggleCharacterMode(GUIButton button, object obj)
|
private bool ToggleCharacterMode(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
characterMode = !characterMode;
|
characterMode = !characterMode;
|
||||||
button.Color = (characterMode) ? Color.Gold : Color.White;
|
button.Color = (characterMode) ? Color.Gold : Color.White;
|
||||||
|
|
||||||
if (characterMode)
|
if (characterMode)
|
||||||
{
|
{
|
||||||
CreateDummyCharacter();
|
CreateDummyCharacter();
|
||||||
}
|
}
|
||||||
else if (dummyCharacter != null)
|
else if (dummyCharacter != null)
|
||||||
{
|
{
|
||||||
dummyCharacter.Remove();
|
dummyCharacter.Remove();
|
||||||
dummyCharacter = null;
|
dummyCharacter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MapEntity me in MapEntity.mapEntityList)
|
foreach (MapEntity me in MapEntity.mapEntityList)
|
||||||
{
|
{
|
||||||
me.IsHighlighted = false;
|
me.IsHighlighted = false;
|
||||||
me.IsSelected = false;
|
me.IsSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectPrefab(object obj)
|
private bool SelectPrefab(object obj)
|
||||||
{
|
{
|
||||||
MapEntityPrefab.SelectPrefab(obj);
|
MapEntityPrefab.SelectPrefab(obj);
|
||||||
selectedTab = -1;
|
selectedTab = -1;
|
||||||
GUIComponent.MouseOn = null;
|
GUIComponent.MouseOn = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows the game to run logic such as updating the world,
|
/// Allows the game to run logic such as updating the world,
|
||||||
/// checking for collisions, gathering input, and playing audio.
|
/// checking for collisions, gathering input, and playing audio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
//Vector2 mousePosition = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
//Vector2 mousePosition = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
||||||
//mousePosition = cam.ScreenToWorld(mousePosition);
|
//mousePosition = cam.ScreenToWorld(mousePosition);
|
||||||
|
|
||||||
//if (!Character.characterList.Contains(dummyCharacter))
|
//if (!Character.characterList.Contains(dummyCharacter))
|
||||||
//{
|
//{
|
||||||
// CreateDummyCharacter();
|
// CreateDummyCharacter();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
cam.MoveCamera((float)deltaTime);
|
cam.MoveCamera((float)deltaTime);
|
||||||
cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed/1000.0f,0.1f, 2.0f);
|
cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed/1000.0f,0.1f, 2.0f);
|
||||||
|
|
||||||
if (characterMode)
|
if (characterMode)
|
||||||
{
|
{
|
||||||
foreach (MapEntity me in MapEntity.mapEntityList)
|
foreach (MapEntity me in MapEntity.mapEntityList)
|
||||||
{
|
{
|
||||||
me.IsHighlighted = false;
|
me.IsHighlighted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dummyCharacter.SelectedConstruction==null)
|
if (dummyCharacter.SelectedConstruction==null)
|
||||||
{
|
{
|
||||||
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition));
|
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition));
|
||||||
foreach (Limb limb in dummyCharacter.animController.limbs)
|
foreach (Limb limb in dummyCharacter.animController.limbs)
|
||||||
{
|
{
|
||||||
limb.body.SetTransform(mouseSimPos, 0.0f);
|
limb.body.SetTransform(mouseSimPos, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dummyCharacter.ControlLocalPlayer(cam, false);
|
dummyCharacter.ControlLocalPlayer(cam, false);
|
||||||
dummyCharacter.Control(cam);
|
dummyCharacter.Control(cam);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
MapEntity.UpdateSelecting(cam);
|
MapEntity.UpdateSelecting(cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GUIpanel.Update((float)deltaTime);
|
GUIpanel.Update((float)deltaTime);
|
||||||
if (selectedTab > -1)
|
if (selectedTab > -1)
|
||||||
{
|
{
|
||||||
GUItabs[selectedTab].Update((float)deltaTime);
|
GUItabs[selectedTab].Update((float)deltaTime);
|
||||||
if (PlayerInput.RightButtonClicked()) selectedTab = -1;
|
if (PlayerInput.RightButtonClicked()) selectedTab = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is called when the game should draw itself.
|
/// This is called when the game should draw itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
//cam.UpdateTransform();
|
//cam.UpdateTransform();
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
|
|
||||||
graphics.Clear(new Color(0.051f, 0.149f, 0.271f, 1.0f));
|
graphics.Clear(new Color(0.051f, 0.149f, 0.271f, 1.0f));
|
||||||
|
|
||||||
Map.Draw(spriteBatch, true);
|
Map.Draw(spriteBatch, true);
|
||||||
|
|
||||||
if (!characterMode)
|
if (!characterMode)
|
||||||
{
|
{
|
||||||
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(spriteBatch, cam);
|
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(spriteBatch, cam);
|
||||||
|
|
||||||
MapEntity.DrawSelecting(spriteBatch, cam);
|
MapEntity.DrawSelecting(spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//-------------------- HUD -----------------------------
|
//-------------------- HUD -----------------------------
|
||||||
|
|
||||||
spriteBatch.Begin();
|
spriteBatch.Begin();
|
||||||
|
|
||||||
GUIpanel.Draw(spriteBatch);
|
GUIpanel.Draw(spriteBatch);
|
||||||
|
|
||||||
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
|
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch);
|
||||||
|
|
||||||
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (characterMode)
|
if (characterMode)
|
||||||
{
|
{
|
||||||
if (dummyCharacter != null && dummyCharacter.SelectedConstruction != null)
|
if (dummyCharacter != null && dummyCharacter.SelectedConstruction != null)
|
||||||
{
|
{
|
||||||
if (Character.Controlled.SelectedConstruction == dummyCharacter.ClosestItem)
|
if (dummyCharacter.SelectedConstruction == dummyCharacter.ClosestItem)
|
||||||
{
|
{
|
||||||
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter);
|
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dummyCharacter.SelectedConstruction = null;
|
dummyCharacter.SelectedConstruction = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed)
|
if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed)
|
||||||
{
|
{
|
||||||
//if (Inventory.draggingItem!=null)
|
//if (Inventory.draggingItem!=null)
|
||||||
//{
|
//{
|
||||||
// Inventory.draggingItem.see
|
// Inventory.draggingItem.see
|
||||||
//}
|
//}
|
||||||
Inventory.draggingItem = null;
|
Inventory.draggingItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MapEntity.Edit(spriteBatch, cam);
|
MapEntity.Edit(spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||||
<InstallUrlHistory />
|
<InstallUrlHistory />
|
||||||
<SupportUrlHistory />
|
<SupportUrlHistory />
|
||||||
<UpdateUrlHistory />
|
<UpdateUrlHistory />
|
||||||
<BootstrapperUrlHistory />
|
<BootstrapperUrlHistory />
|
||||||
<ErrorReportUrlHistory />
|
<ErrorReportUrlHistory />
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
<FallbackCulture>en-US</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||||
<ProjectView>ShowAllFiles</ProjectView>
|
<ProjectView>ProjectFiles</ProjectView>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
Reference in New Issue
Block a user