merging bob's turreted-unit hax
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRa.FileFormats;
|
using OpenRa.FileFormats;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using OpenRa.Game.Graphics;
|
using OpenRa.Game.Graphics;
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ namespace OpenRa.Game
|
|||||||
public readonly Dictionary<int, Player> players = new Dictionary<int, Player>();
|
public readonly Dictionary<int, Player> players = new Dictionary<int, Player>();
|
||||||
|
|
||||||
// temporary, until we remove all the subclasses of Building
|
// temporary, until we remove all the subclasses of Building
|
||||||
public Dictionary<string, Func<int2, Player, Building>> buildingCreation = new Dictionary<string, Func<int2, Player, Building>>();
|
public Dictionary<string, Func<int2, Player, Building>> buildingCreation;
|
||||||
|
|
||||||
public Player LocalPlayer { get { return players[localPlayerIndex]; } }
|
public Player LocalPlayer { get { return players[localPlayerIndex]; } }
|
||||||
|
|
||||||
@@ -48,12 +49,13 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
network = new Network();
|
network = new Network();
|
||||||
|
|
||||||
buildingCreation.Add("proc", (location, owner) => new Refinery(location, owner, this));
|
var buildings = new[] { "fact", "powr", "apwr", "barr", "atek", "stek", "dome" };
|
||||||
buildingCreation.Add("weap", (location, owner) => new WarFactory(location, owner, this));
|
buildingCreation = buildings.ToDictionary(s => s,
|
||||||
|
s => (Func<int2, Player, Building>)(
|
||||||
|
(l, o) => new Building(s, l, o, this)));
|
||||||
|
|
||||||
string[] buildings = { "fact", "powr", "apwr", "barr", "atek", "stek", "dome" };
|
buildingCreation.Add("proc", (location, owner) => new Refinery(location, owner, this));
|
||||||
foreach (string s in buildings)
|
buildingCreation.Add("weap", (location, owner) => new WarFactory(location, owner, this));
|
||||||
buildingCreation.Add(s, (location, owner) => new Building(s, location, owner, this));
|
|
||||||
|
|
||||||
controller = new Controller(this); // CAREFUL THERES AN UGLY HIDDEN DEPENDENCY HERE STILL
|
controller = new Controller(this); // CAREFUL THERES AN UGLY HIDDEN DEPENDENCY HERE STILL
|
||||||
worldRenderer = new WorldRenderer(renderer, world);
|
worldRenderer = new WorldRenderer(renderer, world);
|
||||||
|
|||||||
@@ -36,9 +36,8 @@ namespace OpenRa.Game
|
|||||||
Location = Point.Empty;
|
Location = Point.Empty;
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
//bool windowed = !settings.GetValue("fullscreen", false);
|
bool windowed = !settings.GetValue("fullscreen", false);
|
||||||
//renderer = new Renderer(this, GetResolution(settings), windowed);
|
renderer = new Renderer(this, GetResolution(settings), windowed);
|
||||||
renderer = new Renderer( this, new Size( 800, 600 ), true );
|
|
||||||
SheetBuilder.Initialize( renderer );
|
SheetBuilder.Initialize( renderer );
|
||||||
|
|
||||||
game = new Game( settings.GetValue( "map", "scg11eb.ini" ), renderer, new int2( ClientSize ) );
|
game = new Game( settings.GetValue( "map", "scg11eb.ini" ), renderer, new int2( ClientSize ) );
|
||||||
@@ -49,10 +48,12 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
game.world.Add( new Unit( "mcv", new int2( 5, 5 ), game.players[ 3 ], game ) );
|
game.world.Add( new Unit( "mcv", new int2( 5, 5 ), game.players[ 3 ], game ) );
|
||||||
game.world.Add( new Unit( "mcv", new int2( 7, 5 ), game.players[ 2 ], game ) );
|
game.world.Add( new Unit( "mcv", new int2( 7, 5 ), game.players[ 2 ], game ) );
|
||||||
game.world.Add( controlled = new Unit( "mcv", new int2( 9, 5 ), game.players[ 1 ], game ) );
|
|
||||||
|
|
||||||
game.world.Add( controlled = new TurretedUnit( "jeep", new int2( 9, 7 ), game.players[ 1 ], game ) );
|
game.world.Add( controlled = new TurretedUnit( "jeep", new int2( 9, 7 ), game.players[ 1 ], game ) );
|
||||||
|
|
||||||
|
game.world.Add(controlled = new Unit("mcv", new int2(9, 5), game.players[1], game));
|
||||||
|
|
||||||
game.controller.orderGenerator = controlled;
|
game.controller.orderGenerator = controlled;
|
||||||
|
|
||||||
sidebar = new Sidebar(Race.Soviet, renderer, game);
|
sidebar = new Sidebar(Race.Soviet, renderer, game);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using OpenRa.Game.Graphics;
|
using OpenRa.Game.Graphics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using IjwFramework.Types;
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
@@ -39,13 +41,14 @@ namespace OpenRa.Game
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Sprite[] CurrentImages
|
public override IEnumerable<Pair<Sprite,float2>> CurrentImages
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (roof == null)
|
return (roof == null)
|
||||||
? base.CurrentImages
|
? base.CurrentImages
|
||||||
: (base.CurrentImages.Concat( roof.Images ).ToArray());
|
: (base.CurrentImages.Concat(
|
||||||
|
new[] { Pair.New(roof.Image, 24 * (float2)location) }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user