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
Launcher/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

150
Launcher/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,150 @@
namespace Launcher
{
partial class LauncherMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherMain));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.launchButton = new System.Windows.Forms.Button();
this.resolutionBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.fullscreenBox = new System.Windows.Forms.CheckBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(57, 25);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(508, 69);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// launchButton
//
this.launchButton.Location = new System.Drawing.Point(455, 399);
this.launchButton.Name = "launchButton";
this.launchButton.Size = new System.Drawing.Size(161, 42);
this.launchButton.TabIndex = 1;
this.launchButton.Text = "LAUNCH";
this.launchButton.UseVisualStyleBackColor = true;
this.launchButton.Click += new System.EventHandler(this.launchButton_Click);
//
// resolutionBox
//
this.resolutionBox.AllowDrop = true;
this.resolutionBox.FormattingEnabled = true;
this.resolutionBox.Location = new System.Drawing.Point(57, 207);
this.resolutionBox.Name = "resolutionBox";
this.resolutionBox.Size = new System.Drawing.Size(212, 21);
this.resolutionBox.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(54, 191);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Resolution:";
//
// fullscreenBox
//
this.fullscreenBox.AutoSize = true;
this.fullscreenBox.Location = new System.Drawing.Point(57, 252);
this.fullscreenBox.Name = "fullscreenBox";
this.fullscreenBox.Size = new System.Drawing.Size(74, 17);
this.fullscreenBox.TabIndex = 4;
this.fullscreenBox.Text = "Fullscreen";
this.fullscreenBox.UseVisualStyleBackColor = true;
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(368, 207);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(212, 21);
this.comboBox2.TabIndex = 5;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(365, 191);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Content package:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(368, 234);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(130, 35);
this.button2.TabIndex = 7;
this.button2.Text = "Package manager";
this.button2.UseVisualStyleBackColor = true;
//
// LauncherMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(628, 453);
this.Controls.Add(this.button2);
this.Controls.Add(this.label2);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.fullscreenBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.resolutionBox);
this.Controls.Add(this.launchButton);
this.Controls.Add(this.pictureBox1);
this.Name = "LauncherMain";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button launchButton;
private System.Windows.Forms.ComboBox resolutionBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox fullscreenBox;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button2;
}
}

162
Launcher/Form1.cs Normal file
View File

@@ -0,0 +1,162 @@
using Subsurface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace Launcher
{
public partial class LauncherMain : Form
{
private const string configPath = "config.xml";
private Subsurface.GameSettings settings;
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings(
string deviceName, int modeNum, ref DEVMODE devMode);
const int ENUM_CURRENT_SETTINGS = -1;
const int ENUM_REGISTRY_SETTINGS = -2;
private List<GraphicsMode> supportedModes;
public bool FullScreenEnabled
{
get { return settings.FullScreenEnabled; }
set { settings.FullScreenEnabled = value; }
}
//private GraphicsMode selectedMode;
public LauncherMain()
{
InitializeComponent();
supportedModes = new List<GraphicsMode>();
DEVMODE vDevMode = new DEVMODE();
int i = 0;
while (EnumDisplaySettings(null, i, ref vDevMode))
{
if (vDevMode.dmBitsPerPel < 16 || supportedModes.FirstOrDefault(sm => sm.Width == vDevMode.dmPelsWidth && sm.Height == vDevMode.dmPelsHeight) != null)
{
i++;
continue;
}
supportedModes.Add(
new GraphicsMode(vDevMode.dmPelsWidth,
vDevMode.dmPelsHeight,
vDevMode.dmBitsPerPel, vDevMode.dmDisplayFrequency));
i++;
}
resolutionBox.DataSource = new BindingList<GraphicsMode>(supportedModes);
//resolutionBox.SelectedIndexChanged =
//LoadSettings(configPath);
settings = new GameSettings(configPath);
resolutionBox.SelectedItem = supportedModes.FirstOrDefault(sm => sm.Width == settings.GraphicsWidth && sm.Height == settings.GraphicsHeight);
if (resolutionBox.SelectedItem == null)
{
resolutionBox.SelectedItem = supportedModes.FirstOrDefault(sm =>
sm.Width == Screen.PrimaryScreen.Bounds.Width &&
sm.Height == Screen.PrimaryScreen.Bounds.Height);
if (resolutionBox.SelectedItem == null) resolutionBox.SelectedItem = supportedModes[0];
}
fullscreenBox.DataBindings.Add("Checked", this, "FullscreenEnabled");
//resolutionBox.SelectedItem = selectedMode;
}
private void SaveSettings(string filePath)
{
GraphicsMode selectedMode = resolutionBox.SelectedItem as GraphicsMode;
settings.GraphicsWidth = selectedMode.Width;
settings.GraphicsHeight = selectedMode.Height;
settings.Save(configPath);
}
private void launchButton_Click(object sender, EventArgs e)
{
SaveSettings(configPath);
Process.Start(Directory.GetCurrentDirectory() + "/Subsurface.exe");
Application.Exit();
}
}
public class GraphicsMode
{
public readonly int Width, Height;
public readonly int Bits;
public readonly int Frequency;
public GraphicsMode(int width, int height, int bits, int freq)
{
Width = width;
Height = height;
Bits = bits;
Frequency = freq;
}
public override string ToString()
{
return Width + "x" + Height;// +", " + Bits + " bit, " + Frequency + " Hz";
}
}
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE
{
private const int CCHDEVICENAME = 0x20;
private const int CCHFORMNAME = 0x20;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public int dmPositionX;
public int dmPositionY;
public ScreenOrientation dmDisplayOrientation;
public int dmDisplayFixedOutput;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmFormName;
public short dmLogPixels;
public int dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
}
}

2891
Launcher/Form1.resx Normal file

File diff suppressed because it is too large Load Diff

97
Launcher/Launcher.csproj Normal file
View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Launcher</RootNamespace>
<AssemblyName>Launcher</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Subsurface\bin\Windows\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Launcher.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Subsurface\Subsurface.csproj">
<Project>{008c0f83-e914-4966-9135-ea885059edd8}</Project>
<Name>Subsurface</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

22
Launcher/Program.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Launcher
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LauncherMain());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Launcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Launcher")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ef69d08c-36d1-4c9b-ac73-198db7d6e904")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Launcher.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Launcher.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

30
Launcher/Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Launcher.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

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.

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);

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);

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)
{

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];

View File

@@ -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
{

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);
}

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

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;

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;

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);

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Subsurface
{
class SettingsScreen : Screen
{
}
}

85
Subsurface/Settings.cs Normal file
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);
}
}
}

View File

@@ -170,7 +170,7 @@ namespace Subsurface
if (File.Exists(file))
{
return Game1.textureLoader.FromFile(file);
return Game1.TextureLoader.FromFile(file);
}
else
{

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" />

View File

@@ -9,13 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_contentContent",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_content", "Subsurface_content\Subsurface_content\Subsurface_content.csproj", "{1E6BF44D-6E31-40CC-8321-3D5958C983E7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA5F5518-C0B6-49C4-A421-927EE4391842}"
ProjectSection(SolutionItems) = preProject
Performance1.psess = Performance1.psess
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Android|Any CPU = Android|Any CPU
@@ -209,6 +206,51 @@ Global
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|Mixed Platforms.Build.0 = Release|x86
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.ActiveCfg = Release|x86
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Windows8|x86.Build.0 = Release|x86
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Android|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Debug|x86.ActiveCfg = Debug|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.iOS|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Linux|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.OSX|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.PSM|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Release|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows|x86.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Any CPU.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Any CPU.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Mixed Platforms.ActiveCfg = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|Mixed Platforms.Build.0 = Release|Any CPU
{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}.Windows8|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Binary file not shown.