Merge branch 'master' of git://github.com/chrisforbes/OpenRA
This commit is contained in:
@@ -40,6 +40,8 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
readonly int paletteColumns;
|
readonly int paletteColumns;
|
||||||
readonly int2 paletteOrigin;
|
readonly int2 paletteOrigin;
|
||||||
|
|
||||||
|
const int MinRows = 4;
|
||||||
|
|
||||||
public Chrome(Renderer r)
|
public Chrome(Renderer r)
|
||||||
{
|
{
|
||||||
@@ -96,7 +98,7 @@ namespace OpenRa.Game
|
|||||||
cantBuild = new Animation("clock");
|
cantBuild = new Animation("clock");
|
||||||
cantBuild.PlayFetchIndex("idle", () => 0);
|
cantBuild.PlayFetchIndex("idle", () => 0);
|
||||||
|
|
||||||
digitSprites = OpenRa.Game.Graphics.Util.MakeArray(10, a => a)
|
digitSprites = Graphics.Util.MakeArray(10, a => a)
|
||||||
.Select(n => new Sprite(specialBin, new Rectangle(32 + 13 * n, 0, 13, 17), TextureChannel.Alpha)).ToList();
|
.Select(n => new Sprite(specialBin, new Rectangle(32 + 13 * n, 0, 13, 17), TextureChannel.Alpha)).ToList();
|
||||||
|
|
||||||
shimSprites = new[]
|
shimSprites = new[]
|
||||||
@@ -408,7 +410,7 @@ namespace OpenRa.Game
|
|||||||
if (++x == columns) { x = 0; y++; }
|
if (++x == columns) { x = 0; y++; }
|
||||||
}
|
}
|
||||||
|
|
||||||
while (x != 0)
|
while (x != 0 || y < MinRows)
|
||||||
{
|
{
|
||||||
var rect = new Rectangle(origin.X + x * 64, origin.Y + 48 * y, 64, 48);
|
var rect = new Rectangle(origin.X + x * 64, origin.Y + 48 * y, 64, 48);
|
||||||
var drawPos = Game.viewport.Location + new float2(rect.Location);
|
var drawPos = Game.viewport.Location + new float2(rect.Location);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRa.Game.GameRules
|
|||||||
public readonly string Replay = "";
|
public readonly string Replay = "";
|
||||||
|
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
public readonly bool RepairRequiresConyard = false;
|
public readonly bool RepairRequiresConyard = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ using System.IO;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenRa.FileFormats;
|
using OpenRa.FileFormats;
|
||||||
|
using OpenRa.Game.GameRules;
|
||||||
using OpenRa.Game.Graphics;
|
using OpenRa.Game.Graphics;
|
||||||
using OpenRa.Game.Orders;
|
using OpenRa.Game.Orders;
|
||||||
using OpenRa.Game.GameRules;
|
|
||||||
|
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
@@ -31,51 +31,33 @@ namespace OpenRa.Game
|
|||||||
[DllImport("user32")]
|
[DllImport("user32")]
|
||||||
static extern int ShowCursor([MarshalAs(UnmanagedType.Bool)] bool visible);
|
static extern int ShowCursor([MarshalAs(UnmanagedType.Bool)] bool visible);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MainWindow(Settings settings)
|
public MainWindow(Settings settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
BackColor = Color.Black;
|
BackColor = Color.Black;
|
||||||
StartPosition = FormStartPosition.Manual;
|
StartPosition = FormStartPosition.Manual;
|
||||||
Location = Point.Empty;
|
Location = Point.Empty;
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
// Load user settings
|
|
||||||
Game.Settings = new UserSettings();
|
|
||||||
|
|
||||||
while (!File.Exists("redalert.mix"))
|
while (!File.Exists("redalert.mix"))
|
||||||
{
|
{
|
||||||
var current = Directory.GetCurrentDirectory();
|
var current = Directory.GetCurrentDirectory();
|
||||||
if (Directory.GetDirectoryRoot(current) == current)
|
if (Directory.GetDirectoryRoot(current) == current)
|
||||||
throw new InvalidOperationException("Unable to load MIX files.");
|
throw new InvalidOperationException("Unable to load MIX files.");
|
||||||
Directory.SetCurrentDirectory("..");
|
Directory.SetCurrentDirectory("..");
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// settings.ini should be located with the mix files
|
|
||||||
FileSystem.MountTemporary(new Folder("./"));
|
|
||||||
IniFile SettingsRules = new IniFile(FileSystem.Open("settings.ini"));
|
|
||||||
FieldLoader.Load(Game.Settings, SettingsRules.GetSection("Settings"));
|
|
||||||
FileSystem.UnmountTemporaryPackages();
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadUserSettings(settings);
|
||||||
|
|
||||||
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
||||||
UiOverlay.ShowBuildDebug = Game.Settings.BuildingDebug;
|
UiOverlay.ShowBuildDebug = Game.Settings.BuildingDebug;
|
||||||
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
||||||
Renderer.SheetSize = Game.Settings.SheetSize;
|
Renderer.SheetSize = Game.Settings.SheetSize;
|
||||||
|
|
||||||
|
|
||||||
FileSystem.MountDefaultPackages();
|
FileSystem.MountDefaultPackages();
|
||||||
|
|
||||||
if (Game.Settings.UseAftermath)
|
if (Game.Settings.UseAftermath)
|
||||||
{
|
|
||||||
FileSystem.MountAftermathPackages();
|
FileSystem.MountAftermathPackages();
|
||||||
}
|
|
||||||
|
|
||||||
bool windowed = !Game.Settings.Fullscreen;
|
bool windowed = !Game.Settings.Fullscreen;
|
||||||
renderer = new Renderer(this, GetResolution(settings), windowed);
|
renderer = new Renderer(this, GetResolution(settings), windowed);
|
||||||
@@ -89,6 +71,19 @@ namespace OpenRa.Game
|
|||||||
Game.ResetTimer();
|
Game.ResetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LoadUserSettings(Settings settings)
|
||||||
|
{
|
||||||
|
Game.Settings = new UserSettings();
|
||||||
|
var settingsFile = settings.GetValue("settings", "settings.ini");
|
||||||
|
if (FileSystem.Exists(settingsFile))
|
||||||
|
{
|
||||||
|
FileSystem.MountTemporary(new Folder("./"));
|
||||||
|
FieldLoader.Load(Game.Settings,
|
||||||
|
new IniFile(FileSystem.Open(settingsFile)).GetSection("Settings"));
|
||||||
|
FileSystem.UnmountTemporaryPackages();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void Run()
|
internal void Run()
|
||||||
{
|
{
|
||||||
while (Created && Visible)
|
while (Created && Visible)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRa.Game.Orders;
|
using OpenRa.Game.Orders;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using OpenRa.Game.Graphics;
|
||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
@@ -109,7 +110,7 @@ namespace OpenRa.Game.Traits
|
|||||||
var f = 1 - (animationTick * 1.0f / animationLength);
|
var f = 1 - (animationTick * 1.0f / animationLength);
|
||||||
|
|
||||||
using (var bitmapCopy = new Bitmap(bmp))
|
using (var bitmapCopy = new Bitmap(bmp))
|
||||||
for (int j = 0; j < 8; j++)
|
for (int j = 0; j < (int)PaletteType.Chrome; j++)
|
||||||
for (int i = 0; i < bmp.Width; i++)
|
for (int i = 0; i < bmp.Width; i++)
|
||||||
{
|
{
|
||||||
var h = bitmapCopy.GetPixel(i, j).GetHue(); // 0-360
|
var h = bitmapCopy.GetPixel(i, j).GetHue(); // 0-360
|
||||||
|
|||||||
4
settings-netplay-local-aftermath.ini
Normal file
4
settings-netplay-local-aftermath.ini
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[Settings]
|
||||||
|
NetworkHost=localhost
|
||||||
|
NetworkPort=1234
|
||||||
|
UseAftermath=yes
|
||||||
3
settings-netplay-local.ini
Normal file
3
settings-netplay-local.ini
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[Settings]
|
||||||
|
NetworkHost=localhost
|
||||||
|
NetworkPort=1234
|
||||||
Reference in New Issue
Block a user