Resetting fixrequirements if an item is broken more than once, launcher & selecting graphics mode, some new sounds

This commit is contained in:
Regalis
2015-07-20 14:28:34 +03:00
parent fb0e8ea54c
commit 4aa3d9d7ee
44 changed files with 3781 additions and 36 deletions
+6
View File
@@ -8,6 +8,12 @@
<Sprite texture ="junctionbox.png" depth="0.8"/>
<fixrequirement name="Electrical repairs">
<skill name="Electrical Engineering" level="40"/>
<item name="Wire"/>
<item name="Screwdriver"/>
</fixrequirement>
<PowerTransfer canbeselected = "true">
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
</PowerTransfer>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -266,7 +266,7 @@ namespace Subsurface
public static void Draw(float deltaTime, SpriteBatch spriteBatch, Camera cam)
{
spriteBatch.DrawString(Font,
"FPS: " + (int)Game1.frameCounter.AverageFramesPerSecond
"FPS: " + (int)Game1.FrameCounter.AverageFramesPerSecond
+ " - Physics: " + Game1.World.UpdateTime
+ " - bodies: " + Game1.World.BodyList.Count,
new Vector2(10, 10), Color.White);
+3 -3
View File
@@ -21,9 +21,9 @@ namespace Subsurface
public TitleScreen(GraphicsDevice graphics)
{
backgroundTexture = Game1.textureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = Game1.textureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = Game1.textureLoader.FromFile("Content/UI/titleText.png");
backgroundTexture = Game1.TextureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = Game1.TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = Game1.TextureLoader.FromFile("Content/UI/titleText.png");
renderTarget = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
+14 -11
View File
@@ -22,7 +22,7 @@ namespace Subsurface
public static GraphicsDevice CurrGraphicsDevice;
public static FrameCounter frameCounter;
public static FrameCounter FrameCounter;
public static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
@@ -41,20 +41,21 @@ namespace Subsurface
public static ParticleManager particleManager;
public static TextureLoader textureLoader;
public static TextureLoader TextureLoader;
public static World World;
public static TitleScreen TitleScreen;
private bool titleScreenOpen;
public static GameSettings Config;
//public static Random localRandom;
//public static Random random;
//private Stopwatch renderTimer;
//public static int renderTimeElapsed;
public Camera Cam
{
get { return GameScreen.Cam; }
@@ -83,11 +84,13 @@ namespace Subsurface
public Game1()
{
Graphics = new GraphicsDeviceManager(this);
graphicsWidth = 1280;
graphicsHeight = 720;
//Graphics.IsFullScreen = true;
Config = new GameSettings("config.xml");
graphicsWidth = Config.GraphicsWidth;
graphicsHeight = Config.GraphicsHeight;
Graphics.IsFullScreen = Config.FullScreenEnabled;
Graphics.PreferredBackBufferWidth = graphicsWidth;
Graphics.PreferredBackBufferHeight = graphicsHeight;
Content.RootDirectory = "Content";
@@ -95,7 +98,7 @@ namespace Subsurface
//graphics.SynchronizeWithVerticalRetrace = false;
//graphics.ApplyChanges();
frameCounter = new FrameCounter();
FrameCounter = new FrameCounter();
//renderTimer = new Stopwatch();
@@ -138,7 +141,7 @@ namespace Subsurface
ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation);
spriteBatch = new SpriteBatch(GraphicsDevice);
textureLoader = new TextureLoader(GraphicsDevice);
TextureLoader = new TextureLoader(GraphicsDevice);
titleScreenOpen = true;
TitleScreen = new TitleScreen(GraphicsDevice);
@@ -267,7 +270,7 @@ namespace Subsurface
double deltaTime = gameTime.ElapsedGameTime.TotalSeconds;
frameCounter.Update(deltaTime);
FrameCounter.Update(deltaTime);
if (titleScreenOpen)
{
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Subsurface
{
this.character = character;
if (icons == null) icons = Game1.textureLoader.FromFile("Content/UI/inventoryIcons.png");
if (icons == null) icons = Game1.TextureLoader.FromFile("Content/UI/inventoryIcons.png");
slotPositions = new Vector2[limbSlots.Length];
@@ -51,7 +51,7 @@ namespace Subsurface.Items.Components
pt.currPowerConsumption += (-fullPower - pt.currPowerConsumption) / inertia;
pt.Item.SendSignal("",
"power", fullPower / Math.Max(fullLoad, 1.0f));
if (-pt.currPowerConsumption > pt.powerLoad * 2.0f) pt.item.Condition = 0.0f;
}
else
{
+3 -2
View File
@@ -53,7 +53,8 @@ namespace Subsurface
GUIComponent component = reqFrame.children.Find(c => c.UserData as string == itemName);
GUITextBlock text = component as GUITextBlock;
bool itemFound = (character.Inventory.items.FirstOrDefault(i => i !=null && i.Name == itemName) != null);
Item item = character.Inventory.items.FirstOrDefault(i => i !=null && i.Name == itemName);
bool itemFound = (item != null);
if (!itemFound) success = false;
@@ -178,7 +179,7 @@ namespace Subsurface
CreateGUIFrame(item);
}
UpdateGUIFrame(item, character);
UpdateGUIFrame(item, character);
frame.Update((float)Physics.step);
frame.Draw(spriteBatch);
}
+12 -1
View File
@@ -63,7 +63,18 @@ namespace Subsurface
public float Condition
{
get { return condition; }
set { condition = MathHelper.Clamp(value, 0.0f, 100.0f); }
set
{
float prev = condition;
condition = MathHelper.Clamp(value, 0.0f, 100.0f);
if (condition==0.0f && prev>0.0f)
{
foreach (FixRequirement req in FixRequirements)
{
req.Fixed = false;
}
}
}
}
public float Health
+1 -1
View File
@@ -90,7 +90,7 @@ namespace Subsurface
public Level(string seed, float difficulty, int width, int height, int siteInterval)
{
if (shaftTexture == null) shaftTexture = Game1.textureLoader.FromFile("Content/Map/shaft.png");
if (shaftTexture == null) shaftTexture = Game1.TextureLoader.FromFile("Content/Map/shaft.png");
this.seed = seed;
+3 -8
View File
@@ -61,9 +61,9 @@ namespace Subsurface
connections = new List<LocationConnection>();
iceTexture = Game1.textureLoader.FromFile("Content/Map/iceSurface.png");
iceCraters = Game1.textureLoader.FromFile("Content/Map/iceCraters.png");
iceCrack = Game1.textureLoader.FromFile("Content/Map/iceCrack.png");
iceTexture = Game1.TextureLoader.FromFile("Content/Map/iceSurface.png");
iceCraters = Game1.TextureLoader.FromFile("Content/Map/iceCraters.png");
iceCrack = Game1.TextureLoader.FromFile("Content/Map/iceCrack.png");
Rand.SetSyncedSeed(this.seed);
@@ -176,11 +176,6 @@ namespace Subsurface
private void GenerateDifficulties(Location start, List<LocationConnection> locations, float currDifficulty)
{
if (start.Name.Contains("Sabbati"))
{
int a = 1;
}
//start.Difficulty = currDifficulty;
currDifficulty += Rand.Range(difficultyIncrease.X, difficultyIncrease.Y, false);
if (currDifficulty > Rand.Range(difficultyCutoff.X, difficultyCutoff.Y, false)) currDifficulty = 10.0f;
+1 -1
View File
@@ -68,7 +68,7 @@ namespace Subsurface
effect.Parameters["xColor"].SetValue(new Vector4(0.75f, 0.8f, 0.9f, 1.0f));
effect.Parameters["xBlurDistance"].SetValue(0.0005f);
effect.Parameters["xWaterBumpMap"].SetValue(Game1.textureLoader.FromFile("Content/waterbump.jpg"));
effect.Parameters["xWaterBumpMap"].SetValue(Game1.TextureLoader.FromFile("Content/waterbump.jpg"));
effect.Parameters["xWaveWidth"].SetValue(0.1f);
effect.Parameters["xWaveHeight"].SetValue(0.1f);
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Subsurface
{
class SettingsScreen : Screen
{
}
}
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Subsurface
{
public class GameSettings
{
public int GraphicsWidth
{
get;
set;
}
public int GraphicsHeight
{
get;
set;
}
public bool FullScreenEnabled
{
get;
set;
}
public GameSettings(string filePath)
{
Load(filePath);
}
public void Load(string filePath)
{
XDocument doc = ToolBox.TryLoadXml(filePath);
try
{
XElement graphicsMode = doc.Root.Element("graphicsmode");
GraphicsWidth = int.Parse(graphicsMode.Attribute("width").Value);
GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value);
FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true";
}
catch
{
GraphicsWidth = 1024;
GraphicsHeight = 768;
return;
}
}
public void Save(string filePath)
{
XDocument doc = null;
try
{
doc = XDocument.Load(filePath);
}
catch
{
doc = new XDocument();
}
if (doc.Root == null)
{
doc.Add(new XElement("config"));
}
XElement gMode = doc.Root.Element("graphicsmode");
if (gMode == null)
{
gMode = new XElement("graphicsmode");
doc.Root.Add(gMode);
}
gMode.ReplaceAttributes(
new XAttribute("width", GraphicsWidth),
new XAttribute("height", GraphicsHeight),
new XAttribute("fullscreen", FullScreenEnabled ? "true" : "false"));
doc.Save(filePath);
}
}
}
+1 -1
View File
@@ -170,7 +170,7 @@ namespace Subsurface
if (File.Exists(file))
{
return Game1.textureLoader.FromFile(file);
return Game1.TextureLoader.FromFile(file);
}
else
{
+2
View File
@@ -190,7 +190,9 @@
<Compile Include="Screens\LobbyScreen.cs" />
<Compile Include="Screens\MainMenu.cs" />
<Compile Include="Screens\NetLobbyScreen.cs" />
<Compile Include="Screens\SettingsScreen.cs" />
<Compile Include="Screens\Screen.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Sounds\OggSound.cs" />
<Compile Include="Sounds\SoundManager.cs" />
<Compile Include="Sounds\OggStream.cs" />