improved harpoon gun, misc ui stuff & bugfixes
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
|||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
build/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<VSPerformanceSession Version="1.00">
|
||||||
|
<Options>
|
||||||
|
<CollectionMethod>Sampling</CollectionMethod>
|
||||||
|
<AllocationMethod>None</AllocationMethod>
|
||||||
|
<AddReport>true</AddReport>
|
||||||
|
<UniqueReport>Timestamp</UniqueReport>
|
||||||
|
<SamplingMethod>Cycles</SamplingMethod>
|
||||||
|
<CycleCount>10000000</CycleCount>
|
||||||
|
<PageFaultCount>10</PageFaultCount>
|
||||||
|
<SysCallCount>10</SysCallCount>
|
||||||
|
<SamplingCounter PlatformID="00000000" CounterID="0000000000000000" ReloadValue="000000000000000a" />
|
||||||
|
<RelocateBinaries>false</RelocateBinaries>
|
||||||
|
<HardwareCounters EnableHWCounters="false" />
|
||||||
|
</Options>
|
||||||
|
<PreinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PreinstrumentEvent>
|
||||||
|
<PostinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PostinstrumentEvent>
|
||||||
|
</VSPerformanceSession>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<VSPerformanceSession Version="1.00">
|
||||||
|
<Options>
|
||||||
|
<Solution>Subsurface_Solution.sln</Solution>
|
||||||
|
<CollectionMethod>Sampling</CollectionMethod>
|
||||||
|
<AllocationMethod>None</AllocationMethod>
|
||||||
|
<AddReport>true</AddReport>
|
||||||
|
<ResourceBasedAnalysisSelected>true</ResourceBasedAnalysisSelected>
|
||||||
|
<UniqueReport>Timestamp</UniqueReport>
|
||||||
|
<SamplingMethod>Cycles</SamplingMethod>
|
||||||
|
<CycleCount>10000000</CycleCount>
|
||||||
|
<PageFaultCount>10</PageFaultCount>
|
||||||
|
<SysCallCount>10</SysCallCount>
|
||||||
|
<SamplingCounter Name="" ReloadValue="00000000000f4240" DisplayName="" />
|
||||||
|
<RelocateBinaries>false</RelocateBinaries>
|
||||||
|
<HardwareCounters EnableHWCounters="false" />
|
||||||
|
<EtwSettings />
|
||||||
|
<PdhSettings>
|
||||||
|
<PdhCountersEnabled>false</PdhCountersEnabled>
|
||||||
|
<PdhCountersRate>500</PdhCountersRate>
|
||||||
|
<PdhCounters>
|
||||||
|
<PdhCounter>\Fyysinen levy(_Total)\Levyjonon keskiarvo</PdhCounter>
|
||||||
|
<PdhCounter>\Muisti\Sivua/s</PdhCounter>
|
||||||
|
<PdhCounter>\Suoritin(_Total)\Suoritinaika prosentteina</PdhCounter>
|
||||||
|
</PdhCounters>
|
||||||
|
</PdhSettings>
|
||||||
|
</Options>
|
||||||
|
<ExcludeSmallFuncs>true</ExcludeSmallFuncs>
|
||||||
|
<InteractionProfilingEnabled>false</InteractionProfilingEnabled>
|
||||||
|
<JScriptProfilingEnabled>false</JScriptProfilingEnabled>
|
||||||
|
<PreinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PreinstrumentEvent>
|
||||||
|
<PostinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PostinstrumentEvent>
|
||||||
|
<Binaries>
|
||||||
|
<ProjBinary>
|
||||||
|
<Path>Subsurface\obj\x86\Debug\Subsurface.exe</Path>
|
||||||
|
<ArgumentTimestamp>01/01/0001 00:00:00</ArgumentTimestamp>
|
||||||
|
<Instrument>true</Instrument>
|
||||||
|
<Sample>true</Sample>
|
||||||
|
<ExternalWebsite>false</ExternalWebsite>
|
||||||
|
<InteractionProfilingEnabled>false</InteractionProfilingEnabled>
|
||||||
|
<IsLocalJavascript>false</IsLocalJavascript>
|
||||||
|
<IsWindowsStoreApp>false</IsWindowsStoreApp>
|
||||||
|
<IsWWA>false</IsWWA>
|
||||||
|
<LaunchProject>true</LaunchProject>
|
||||||
|
<OverrideProjectSettings>false</OverrideProjectSettings>
|
||||||
|
<LaunchMethod>Executable</LaunchMethod>
|
||||||
|
<ExecutablePath>Subsurface\bin\Windows\Debug\Subsurface.exe</ExecutablePath>
|
||||||
|
<StartupDirectory>Subsurface\bin\Windows\Debug\</StartupDirectory>
|
||||||
|
<Arguments>
|
||||||
|
</Arguments>
|
||||||
|
<NetAppHost>IIS</NetAppHost>
|
||||||
|
<NetBrowser>InternetExplorer</NetBrowser>
|
||||||
|
<ExcludeSmallFuncs>true</ExcludeSmallFuncs>
|
||||||
|
<JScriptProfilingEnabled>false</JScriptProfilingEnabled>
|
||||||
|
<PreinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PreinstrumentEvent>
|
||||||
|
<PostinstrumentEvent>
|
||||||
|
<InstrEventExclude>false</InstrEventExclude>
|
||||||
|
</PostinstrumentEvent>
|
||||||
|
<ProjRef>{008C0F83-E914-4966-9135-EA885059EDD8}|Subsurface\Subsurface.csproj</ProjRef>
|
||||||
|
<ProjPath>Subsurface\Subsurface.csproj</ProjPath>
|
||||||
|
<ProjName>Subsurface</ProjName>
|
||||||
|
</ProjBinary>
|
||||||
|
</Binaries>
|
||||||
|
<Reports>
|
||||||
|
<Report>
|
||||||
|
<Path>Subsurface150526.vsp</Path>
|
||||||
|
</Report>
|
||||||
|
</Reports>
|
||||||
|
<Launches>
|
||||||
|
<ProjBinary>
|
||||||
|
<Path>:PB:{008C0F83-E914-4966-9135-EA885059EDD8}|Subsurface\Subsurface.csproj</Path>
|
||||||
|
</ProjBinary>
|
||||||
|
</Launches>
|
||||||
|
</VSPerformanceSession>
|
||||||
@@ -198,8 +198,9 @@ namespace Subsurface
|
|||||||
|
|
||||||
public Vector2 WorldToScreen(Vector2 coords)
|
public Vector2 WorldToScreen(Vector2 coords)
|
||||||
{
|
{
|
||||||
Vector2 screenCoords = Vector2.Transform(coords, transform);
|
coords.Y = -coords.Y;
|
||||||
return new Vector2(screenCoords.X, screenCoords.Y);
|
//Vector2 screenCoords = Vector2.Transform(coords, transform);
|
||||||
|
return Vector2.Transform(coords, transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -587,6 +587,51 @@ namespace Subsurface
|
|||||||
// ConvertUnits.ToDisplayUnits(animController.targetMovement.X, animController.targetMovement.Y), Color.Green);
|
// ConvertUnits.ToDisplayUnits(animController.targetMovement.X, animController.targetMovement.Y), Color.Green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static GUIProgressBar drowningBar;
|
||||||
|
public void DrawHud(SpriteBatch spriteBatch, Camera cam)
|
||||||
|
{
|
||||||
|
if (drowningBar==null)
|
||||||
|
{
|
||||||
|
int width = 200, height = 20;
|
||||||
|
drowningBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, 20, width, height), Color.Blue, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
drowningBar.BarSize = Character.Controlled.Oxygen / 100.0f;
|
||||||
|
if (drowningBar.BarSize < 1.0f)
|
||||||
|
drowningBar.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (Character.Controlled.Inventory != null)
|
||||||
|
Character.Controlled.Inventory.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (closestItem!=null)
|
||||||
|
{
|
||||||
|
Color color = Color.Orange;
|
||||||
|
|
||||||
|
Vector2 startPos = Position + (closestItem.Position - Position) * 0.7f;
|
||||||
|
startPos = cam.WorldToScreen(startPos);
|
||||||
|
|
||||||
|
Vector2 textPos = startPos;
|
||||||
|
|
||||||
|
float stringWidth = GUI.font.MeasureString(closestItem.Prefab.Name).X;
|
||||||
|
textPos -= new Vector2(stringWidth / 2, 20);
|
||||||
|
spriteBatch.DrawString(GUI.font, closestItem.Prefab.Name, textPos, Color.Black);
|
||||||
|
spriteBatch.DrawString(GUI.font, closestItem.Prefab.Name, textPos + new Vector2(1, -1), Color.Orange);
|
||||||
|
|
||||||
|
textPos.Y += 50.0f;
|
||||||
|
foreach (string text in closestItem.HighlightText)
|
||||||
|
{
|
||||||
|
textPos.X = startPos.X - GUI.font.MeasureString(text).X / 2;
|
||||||
|
|
||||||
|
spriteBatch.DrawString(GUI.font, text, textPos, Color.Black);
|
||||||
|
spriteBatch.DrawString(GUI.font, text, textPos + new Vector2(1, -1), Color.Orange);
|
||||||
|
|
||||||
|
textPos.Y += 25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void PlaySound(AIController.AiState state)
|
public void PlaySound(AIController.AiState state)
|
||||||
{
|
{
|
||||||
if (sounds == null || sounds.Count()==0) return;
|
if (sounds == null || sounds.Count()==0) return;
|
||||||
|
|||||||
@@ -265,7 +265,6 @@ namespace Subsurface
|
|||||||
Limb limb = f1.Body.UserData as Limb;
|
Limb limb = f1.Body.UserData as Limb;
|
||||||
if (limb != null && (limb.type == LimbType.LeftFoot || limb.type == LimbType.RightFoot))
|
if (limb != null && (limb.type == LimbType.LeftFoot || limb.type == LimbType.RightFoot))
|
||||||
{
|
{
|
||||||
Debug.WriteLine(contact.Manifold.LocalNormal.Y);
|
|
||||||
if (contact.Manifold.LocalNormal.Y >= 0.0f)
|
if (contact.Manifold.LocalNormal.Y >= 0.0f)
|
||||||
{
|
{
|
||||||
stairs = structure;
|
stairs = structure;
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 816 B |
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
<Items>
|
<Items>
|
||||||
<Item
|
<Item
|
||||||
name="Harpoon"
|
name="Spear"
|
||||||
pickdistance="200">
|
pickdistance="200">
|
||||||
|
|
||||||
<Sprite texture ="harpoon.png" depth="0.55"/>
|
<Sprite texture ="spear.png" depth="0.55"/>
|
||||||
|
|
||||||
<Body width="80" height="5" density="10"/>
|
<Body width="64" height="5" density="20"/>
|
||||||
|
|
||||||
<Pickable slots="Any"/>
|
<Pickable slots="Any"/>
|
||||||
<Projectile launchimpulse="20.0" damage="20.0" bleedingdamage="20.0" doesstick="true">
|
<Projectile launchimpulse="20.0" damage="20.0" bleedingdamage="20.0" doesstick="true">
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<Sprite texture ="harpoongun.png" depth="0.04"/>
|
<Sprite texture ="harpoongun.png" depth="0.04"/>
|
||||||
|
|
||||||
<Body width="90" height="30" density="5"/>
|
<Body width="90" height="30" density="10"/>
|
||||||
|
|
||||||
<Holdable holdpos="35,-10" aimpos="35,-10" handle1="-15,-6" handle2="26,7"/>
|
<Holdable holdpos="35,-10" aimpos="35,-10" handle1="-15,-6" handle2="26,7"/>
|
||||||
|
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
<RangedWeapon barrelpos="49,10">
|
<RangedWeapon barrelpos="49,10">
|
||||||
<Sound path="Content/Items/Weapons/harpoon1.ogg" type="OnUse"/>
|
<Sound path="Content/Items/Weapons/harpoon1.ogg" type="OnUse"/>
|
||||||
<Sound path="Content/Items/Weapons/harpoon2.ogg" type="OnUse"/>
|
<Sound path="Content/Items/Weapons/harpoon2.ogg" type="OnUse"/>
|
||||||
<RequiredItems name="Harpoon" type="Contained"/>
|
<RequiredItems name="Spear" type="Contained"/>
|
||||||
</RangedWeapon>
|
</RangedWeapon>
|
||||||
|
|
||||||
<ItemContainer itempos="27,11" iteminterval="0,-4" hideitems="false">
|
<ItemContainer itempos="27,10" iteminterval="0,-8" hideitems="false">
|
||||||
<Containable name="Harpoon"/>
|
<Containable name="Spear"/>
|
||||||
</ItemContainer>
|
</ItemContainer>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
|
|||||||
+11
-31
@@ -65,8 +65,6 @@ namespace Subsurface
|
|||||||
static Texture2D t;
|
static Texture2D t;
|
||||||
public static SpriteFont font;
|
public static SpriteFont font;
|
||||||
|
|
||||||
private static GUIProgressBar drowningBar;
|
|
||||||
|
|
||||||
private static GraphicsDevice graphicsDevice;
|
private static GraphicsDevice graphicsDevice;
|
||||||
|
|
||||||
|
|
||||||
@@ -87,11 +85,7 @@ namespace Subsurface
|
|||||||
t = new Texture2D(graphicsDevice, 1, 1);
|
t = new Texture2D(graphicsDevice, 1, 1);
|
||||||
t.SetData<Color>(
|
t.SetData<Color>(
|
||||||
new Color[] { Color.White });// fill the texture with white
|
new Color[] { Color.White });// fill the texture with white
|
||||||
|
|
||||||
int width = 200, height = 20;
|
|
||||||
drowningBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, 20, width, height), Color.Blue, 1.0f);
|
|
||||||
|
|
||||||
|
|
||||||
style = new GUIStyle("Content/HUD/style.xml");
|
style = new GUIStyle("Content/HUD/style.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,40 +256,26 @@ namespace Subsurface
|
|||||||
return clicked;
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Draw(float deltaTime, SpriteBatch spriteBatch)
|
public static void Draw(float deltaTime, SpriteBatch spriteBatch, Camera cam)
|
||||||
{
|
{
|
||||||
spriteBatch.DrawString(font,
|
//spriteBatch.DrawString(font,
|
||||||
"FPS: " + (int)Game1.frameCounter.AverageFramesPerSecond
|
// "FPS: " + (int)Game1.frameCounter.AverageFramesPerSecond
|
||||||
+ " - render: "+Game1.renderTimeElapsed,
|
// + " - render: "+Game1.renderTimeElapsed,
|
||||||
new Vector2(10, 10), Color.White);
|
// new Vector2(10, 10), Color.White);
|
||||||
|
|
||||||
spriteBatch.DrawString(font,
|
//spriteBatch.DrawString(font,
|
||||||
"Physics: " + Game1.world.UpdateTime
|
// "Physics: " + Game1.world.UpdateTime
|
||||||
+ " - bodies: " + Game1.world.BodyList.Count,
|
// + " - bodies: " + Game1.world.BodyList.Count,
|
||||||
new Vector2(10, 30), Color.White);
|
// new Vector2(10, 30), Color.White);
|
||||||
|
|
||||||
if (Character.Controlled != null)
|
|
||||||
{
|
|
||||||
drowningBar.BarSize = Character.Controlled.Oxygen/100.0f;
|
|
||||||
if (drowningBar.BarSize<1.0f)
|
|
||||||
drowningBar.Draw(spriteBatch);
|
|
||||||
|
|
||||||
if (Character.Controlled.Inventory!=null)
|
if (Character.Controlled != null) Character.Controlled.DrawHud(spriteBatch, cam);
|
||||||
Character.Controlled.Inventory.Draw(spriteBatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawMessages(spriteBatch, (float)deltaTime);
|
DrawMessages(spriteBatch, (float)deltaTime);
|
||||||
|
|
||||||
DebugConsole.Draw(spriteBatch);
|
DebugConsole.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawCharacterHUD(SpriteBatch spriteBatch, Character character)
|
|
||||||
{
|
|
||||||
drowningBar.BarSize = character.Oxygen/100.0f;
|
|
||||||
|
|
||||||
drowningBar.Draw(spriteBatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddMessage(string message, Color color, float lifeTime = 3.0f)
|
public static void AddMessage(string message, Color color, float lifeTime = 3.0f)
|
||||||
{
|
{
|
||||||
Vector2 currPos = new Vector2(Game1.GraphicsWidth / 2.0f, Game1.GraphicsHeight * 0.7f);
|
Vector2 currPos = new Vector2(Game1.GraphicsWidth / 2.0f, Game1.GraphicsHeight * 0.7f);
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Subsurface
|
||||||
|
{
|
||||||
|
class GUIMessageBox
|
||||||
|
{
|
||||||
|
public static Queue<GUIMessageBox> messageBoxes = new Queue<GUIMessageBox>();
|
||||||
|
|
||||||
|
const int DefaultWidth=400, DefaultHeight=200;
|
||||||
|
|
||||||
|
public delegate bool OnClickedHandler(GUIButton button, object obj);
|
||||||
|
public OnClickedHandler OnClicked;
|
||||||
|
|
||||||
|
GUIFrame frame;
|
||||||
|
GUIButton[] buttons;
|
||||||
|
|
||||||
|
public GUIMessageBox(string header, string text)
|
||||||
|
: this(header, text, new string[] {"OK"})
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = (Alignment.Left |Alignment.Top))
|
||||||
|
{
|
||||||
|
frame = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-DefaultWidth/2, Game1.GraphicsHeight/2-DefaultHeight/2, DefaultWidth, DefaultHeight),
|
||||||
|
GUI.style.backGroundColor, Alignment.CenterX, GUI.style);
|
||||||
|
frame.Padding = GUI.style.smallPadding;
|
||||||
|
|
||||||
|
if (buttons == null || buttons.Length == 0)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Creating a message box with no buttons isn't allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, 5, 0, 30), header, Color.Transparent, Color.White, textAlignment, frame, true);
|
||||||
|
new GUITextBlock(new Rectangle(0,50,0,DefaultHeight-70),text, Color.Transparent, Color.White, textAlignment, frame, true);
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
this.buttons = new GUIButton[buttons.Length];
|
||||||
|
for (int i=0; i<buttons.Length; i++)
|
||||||
|
{
|
||||||
|
this.buttons[i] = new GUIButton(new Rectangle(x,0,150,30), buttons[i], GUI.style, Alignment.Left, frame);
|
||||||
|
this.buttons[i].OnClicked = ButtonClicked;
|
||||||
|
x += this.buttons[i].Rect.Width + 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ButtonClicked(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
if (OnClicked==null) return true;
|
||||||
|
|
||||||
|
return OnClicked(button, obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -69,7 +69,7 @@ namespace Subsurface
|
|||||||
graphics = new GraphicsDeviceManager(this);
|
graphics = new GraphicsDeviceManager(this);
|
||||||
|
|
||||||
graphicsWidth = 1280;
|
graphicsWidth = 1280;
|
||||||
graphicsHeight = 700;
|
graphicsHeight = 720;
|
||||||
|
|
||||||
//graphics.IsFullScreen = true;
|
//graphics.IsFullScreen = true;
|
||||||
graphics.PreferredBackBufferWidth = graphicsWidth;
|
graphics.PreferredBackBufferWidth = graphicsWidth;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
if (hideItems) return;
|
if (hideItems) return;
|
||||||
|
|
||||||
Vector2 transformedItemPos;
|
Vector2 transformedItemPos = itemPos;
|
||||||
Vector2 transformedItemInterval = itemInterval;
|
Vector2 transformedItemInterval = itemInterval;
|
||||||
float currentRotation = itemRotation;
|
float currentRotation = itemRotation;
|
||||||
//float transformedItemRotation = itemRotation;
|
//float transformedItemRotation = itemRotation;
|
||||||
@@ -177,8 +177,18 @@ namespace Subsurface.Items.Components
|
|||||||
{
|
{
|
||||||
Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
|
Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
|
||||||
|
|
||||||
transformedItemPos = ConvertUnits.ToDisplayUnits(item.body.Position) + Vector2.Transform(itemPos, transform);
|
if (item.body.Dir==-1.0f)
|
||||||
|
{
|
||||||
|
transformedItemPos.X = -transformedItemPos.X;
|
||||||
|
transformedItemInterval.X = -transformedItemInterval.X;
|
||||||
|
}
|
||||||
|
transformedItemPos = Vector2.Transform(transformedItemPos, transform);
|
||||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
transformedItemPos += ConvertUnits.ToDisplayUnits(item.body.Position);
|
||||||
|
|
||||||
currentRotation += item.body.Rotation;
|
currentRotation += item.body.Rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +196,13 @@ namespace Subsurface.Items.Components
|
|||||||
{
|
{
|
||||||
if (containedItem == null) continue;
|
if (containedItem == null) continue;
|
||||||
|
|
||||||
containedItem.sprite.Draw(spriteBatch, new Vector2(transformedItemPos.X, -transformedItemPos.Y), -currentRotation, 1.0f);
|
containedItem.sprite.Draw(
|
||||||
|
spriteBatch,
|
||||||
|
new Vector2(transformedItemPos.X, -transformedItemPos.Y),
|
||||||
|
-currentRotation,
|
||||||
|
1.0f,
|
||||||
|
(item.body != null && item.body.Dir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
|
||||||
|
|
||||||
transformedItemPos += transformedItemInterval;
|
transformedItemPos += transformedItemInterval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
Game1.world.RemoveBody(body.FarseerBody);
|
Game1.world.RemoveBody(body.FarseerBody);
|
||||||
|
|
||||||
linkedGap.Remove();
|
if (linkedGap!=null) linkedGap.Remove();
|
||||||
|
|
||||||
doorSprite.Remove();
|
doorSprite.Remove();
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace Subsurface.Items.Components
|
|||||||
private bool OnProjectileCollision(Fixture f1, Fixture f2, Contact contact)
|
private bool OnProjectileCollision(Fixture f1, Fixture f2, Contact contact)
|
||||||
{
|
{
|
||||||
//doesn't collide with items
|
//doesn't collide with items
|
||||||
if (f2.Body.UserData is Item) return false;
|
//if (f2.Body.UserData is Item) return false;
|
||||||
|
|
||||||
if (ignoredBodies.Contains(f2.Body)) return false;
|
if (ignoredBodies.Contains(f2.Body)) return false;
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ namespace Subsurface.Items.Components
|
|||||||
|
|
||||||
stickJoint = new PrismaticJoint(targetBody, item.body.FarseerBody, item.body.Position, axis, true);
|
stickJoint = new PrismaticJoint(targetBody, item.body.FarseerBody, item.body.Position, axis, true);
|
||||||
stickJoint.MotorEnabled = true;
|
stickJoint.MotorEnabled = true;
|
||||||
stickJoint.MaxMotorForce = 15.0f;
|
stickJoint.MaxMotorForce = 30.0f;
|
||||||
|
|
||||||
stickJoint.LimitEnabled = true;
|
stickJoint.LimitEnabled = true;
|
||||||
stickJoint.UpperLimit = ConvertUnits.ToSimUnits(item.sprite.size.X*0.7f);
|
stickJoint.UpperLimit = ConvertUnits.ToSimUnits(item.sprite.size.X*0.7f);
|
||||||
|
|||||||
@@ -455,29 +455,8 @@ namespace Subsurface
|
|||||||
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
||||||
{
|
{
|
||||||
Color color = (isSelected && editing) ? color = Color.Red : Color.White;
|
Color color = (isSelected && editing) ? color = Color.Red : Color.White;
|
||||||
if (isHighlighted)
|
if (isHighlighted) color = Color.Orange;
|
||||||
{
|
|
||||||
color = Color.Orange;
|
|
||||||
|
|
||||||
float stringWidth = GUI.font.MeasureString(prefab.Name).X;
|
|
||||||
Vector2 textPos = new Vector2(Position.X, -Position.Y);
|
|
||||||
textPos -= new Vector2(stringWidth / 2, 40);
|
|
||||||
spriteBatch.DrawString(GUI.font, prefab.Name, textPos, Color.Black);
|
|
||||||
spriteBatch.DrawString(GUI.font, prefab.Name, textPos + new Vector2(1, -1), Color.Orange);
|
|
||||||
|
|
||||||
|
|
||||||
textPos = new Vector2(Position.X, -Position.Y+50);
|
|
||||||
foreach (string text in highlightText)
|
|
||||||
{
|
|
||||||
textPos.X = Position.X - GUI.font.MeasureString(text).X/2;
|
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.font, text, textPos, Color.Black);
|
|
||||||
spriteBatch.DrawString(GUI.font, text, textPos + new Vector2(1, -1), Color.Orange);
|
|
||||||
|
|
||||||
textPos.Y += 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (body==null)
|
if (body==null)
|
||||||
{
|
{
|
||||||
prefab.sprite.DrawTiled(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
prefab.sprite.DrawTiled(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace Subsurface
|
|||||||
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":
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Subsurface
|
|||||||
//a value between 0.0f-1.0f (0.0 = closed, 1.0f = open)
|
//a value between 0.0f-1.0f (0.0 = closed, 1.0f = open)
|
||||||
float open;
|
float open;
|
||||||
|
|
||||||
//the forces of the water flow which are exerted on physics bodies
|
//the force of the water flow which is exerted on physics bodies
|
||||||
Vector2 flowForce;
|
Vector2 flowForce;
|
||||||
|
|
||||||
Hull flowTargetHull;
|
Hull flowTargetHull;
|
||||||
@@ -384,7 +384,10 @@ namespace Subsurface
|
|||||||
//lower room is full of water
|
//lower room is full of water
|
||||||
if (hull2.Pressure > hull1.Pressure)
|
if (hull2.Pressure > hull1.Pressure)
|
||||||
{
|
{
|
||||||
float delta = Math.Min(hull2.Volume - hull2.FullVolume + Hull.MaxCompress / 2.0f, deltaTime * 5000f * sizeModifier);
|
float delta = Math.Min(hull2.Volume - hull2.FullVolume + Hull.MaxCompress / 2.0f, deltaTime * 8000.0f * sizeModifier);
|
||||||
|
|
||||||
|
flowForce = new Vector2(0.0f, Math.Min(hull2.Pressure-hull1.Pressure,500.0f));
|
||||||
|
|
||||||
delta = Math.Max(delta, 0.0f);
|
delta = Math.Max(delta, 0.0f);
|
||||||
hull1.Volume += delta;
|
hull1.Volume += delta;
|
||||||
hull2.Volume -= delta;
|
hull2.Volume -= delta;
|
||||||
@@ -398,12 +401,13 @@ namespace Subsurface
|
|||||||
// //water1.WaveY[posX] = delta;
|
// //water1.WaveY[posX] = delta;
|
||||||
// water1.WaveVel[posX] = delta * 0.01f;
|
// water1.WaveVel[posX] = delta * 0.01f;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (hull1.Volume > hull1.FullVolume)
|
if (hull1.Volume > hull1.FullVolume)
|
||||||
{
|
{
|
||||||
hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2);
|
hull1.Pressure = Math.Max(hull1.Pressure, (hull1.Pressure + hull2.Pressure) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
flowForce = new Vector2(0.0f, delta);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//there's water in the upper room, drop to lower
|
//there's water in the upper room, drop to lower
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||||
|
|
||||||
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
|
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||||
|
|
||||||
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace Subsurface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||||
|
|
||||||
if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed) Inventory.draggingItem = null;
|
if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed) Inventory.draggingItem = null;
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
rightPanel[selectedRightPanel].Draw(spriteBatch);
|
rightPanel[selectedRightPanel].Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
menuTabs[selectedTab].Draw(spriteBatch);
|
menuTabs[selectedTab].Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ namespace Subsurface
|
|||||||
|
|
||||||
float camAngle;
|
float camAngle;
|
||||||
|
|
||||||
|
Body previewPlatform;
|
||||||
|
Hull previewHull;
|
||||||
|
|
||||||
public bool isServer;
|
public bool isServer;
|
||||||
|
|
||||||
public string SelectedMap
|
public string SelectedMap
|
||||||
@@ -103,6 +106,18 @@ namespace Subsurface
|
|||||||
public override void Deselect()
|
public override void Deselect()
|
||||||
{
|
{
|
||||||
textBox.Deselect();
|
textBox.Deselect();
|
||||||
|
|
||||||
|
if (previewPlatform!=null)
|
||||||
|
{
|
||||||
|
Game1.world.RemoveBody(previewPlatform);
|
||||||
|
previewPlatform = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewHull!=null)
|
||||||
|
{
|
||||||
|
previewHull.Remove();
|
||||||
|
previewHull = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Select()
|
public override void Select()
|
||||||
@@ -203,9 +218,9 @@ namespace Subsurface
|
|||||||
femaleButton.UserData = Gender.Female;
|
femaleButton.UserData = Gender.Female;
|
||||||
femaleButton.OnClicked += SwitchGender;
|
femaleButton.OnClicked += SwitchGender;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 200, 200,30), "Job preferences:", Color.Transparent, Color.Black, Alignment.Left, playerFrame);
|
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", Color.Transparent, Color.Black, Alignment.Left, playerFrame);
|
||||||
|
|
||||||
GUIListBox jobList = new GUIListBox(new Rectangle(0,230,200,250), Color.White, playerFrame);
|
GUIListBox jobList = new GUIListBox(new Rectangle(0,180,200,0), Color.White, playerFrame);
|
||||||
|
|
||||||
foreach (Job job in Job.jobList)
|
foreach (Job job in Job.jobList)
|
||||||
{
|
{
|
||||||
@@ -275,12 +290,7 @@ namespace Subsurface
|
|||||||
Game1.gameScreen.Cam.TargetPos = pos;
|
Game1.gameScreen.Cam.TargetPos = pos;
|
||||||
|
|
||||||
menu.Update((float)deltaTime);
|
menu.Update((float)deltaTime);
|
||||||
|
|
||||||
if (Game1.client != null && Game1.client.Character != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f);
|
durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +304,7 @@ namespace Subsurface
|
|||||||
|
|
||||||
menu.Draw(spriteBatch);
|
menu.Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch);
|
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
@@ -303,11 +313,15 @@ namespace Subsurface
|
|||||||
{
|
{
|
||||||
if (Game1.client.Character != null)
|
if (Game1.client.Character != null)
|
||||||
{
|
{
|
||||||
Vector2 position = new Vector2(playerFrame.Rect.X + playerFrame.Rect.Width * 0.25f, playerFrame.Rect.Y + 100.0f);
|
Vector2 position = new Vector2(playerFrame.Rect.X + playerFrame.Rect.Width * 0.25f, playerFrame.Rect.Y + 25.0f);
|
||||||
Matrix transform = Matrix.CreateTranslation(new Vector3(ConvertUnits.ToDisplayUnits(-Game1.client.Character.SimPosition)+position, 0.0f));
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, null,null,null,null,null,transform);
|
Vector2 pos = Game1.client.Character.Position;
|
||||||
|
pos.Y = -pos.Y;
|
||||||
|
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos+position, 0.0f));
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront, null,null,null,null,null,transform);
|
||||||
Game1.client.Character.Draw(spriteBatch);
|
Game1.client.Character.Draw(spriteBatch);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -363,15 +377,18 @@ namespace Subsurface
|
|||||||
|
|
||||||
character.animController.isStanding = true;
|
character.animController.isStanding = true;
|
||||||
|
|
||||||
//TODO: only create if hasn't been created yet
|
if (previewPlatform==null)
|
||||||
//{
|
{
|
||||||
Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f);
|
Body platform = BodyFactory.CreateRectangle(Game1.world, 3.0f, 1.0f, 5.0f);
|
||||||
platform.SetTransform(new Vector2(pos.X, pos.Y + 1.5f), 0.0f);
|
platform.SetTransform(new Vector2(pos.X, pos.Y - 2.5f), 0.0f);
|
||||||
platform.IsStatic = true;
|
platform.IsStatic = true;
|
||||||
|
}
|
||||||
|
|
||||||
pos = ConvertUnits.ToDisplayUnits(pos);
|
if (previewPlatform==null)
|
||||||
new Hull(new Rectangle((int)pos.X - 100, (int)-pos.Y + 100, 200, 200));
|
{
|
||||||
//}
|
pos = ConvertUnits.ToDisplayUnits(pos);
|
||||||
|
new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 200));
|
||||||
|
}
|
||||||
|
|
||||||
Physics.Alpha = 1.0f;
|
Physics.Alpha = 1.0f;
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
<Compile Include="Characters\HumanoidAnimController.cs" />
|
<Compile Include="Characters\HumanoidAnimController.cs" />
|
||||||
<Compile Include="GameSession\TraitorMode.cs" />
|
<Compile Include="GameSession\TraitorMode.cs" />
|
||||||
<Compile Include="GUI\GUIImage.cs" />
|
<Compile Include="GUI\GUIImage.cs" />
|
||||||
|
<Compile Include="GUI\GUIMessageBox.cs" />
|
||||||
<Compile Include="GUI\GUITickBox.cs" />
|
<Compile Include="GUI\GUITickBox.cs" />
|
||||||
<Compile Include="Interface1.cs" />
|
<Compile Include="Interface1.cs" />
|
||||||
<Compile Include="Items\CharacterInventory.cs" />
|
<Compile Include="Items\CharacterInventory.cs" />
|
||||||
@@ -358,6 +359,9 @@
|
|||||||
<Content Include="Content\Items\Weapons\harpoon.png">
|
<Content Include="Content\Items\Weapons\harpoon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\Items\Weapons\spear.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\Items\Weapons\weapons.xml">
|
<Content Include="Content\Items\Weapons\weapons.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
<ErrorReportUrlHistory />
|
<ErrorReportUrlHistory />
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
<FallbackCulture>en-US</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user