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