added AttackTurreted.

This commit is contained in:
Bob
2009-10-18 23:51:00 +13:00
parent 62207efbd9
commit 5f2d89fd63
8 changed files with 144 additions and 54 deletions

View File

@@ -6,7 +6,7 @@ using OpenRa.TechTree;
namespace OpenRa.Game
{
using GRegion = OpenRa.Game.Graphics.Region;
using GRegion = OpenRa.Game.Graphics.Region;
using System.Runtime.InteropServices;
class MainWindow : Form
@@ -22,9 +22,9 @@ using System.Runtime.InteropServices;
return new Size(settings.GetValue("width", desktopResolution.Width),
settings.GetValue("height", desktopResolution.Height));
}
[DllImport("user32")]
}
[DllImport("user32")]
static extern int ShowCursor([MarshalAs(UnmanagedType.Bool)] bool visible);
public MainWindow(Settings settings)
@@ -33,11 +33,11 @@ using System.Runtime.InteropServices;
FileSystem.Mount(new Package("redalert.mix"));
FileSystem.Mount(new Package("conquer.mix"));
FileSystem.Mount(new Package("hires.mix"));
FileSystem.Mount(new Package("general.mix"));
FileSystem.Mount(new Package("local.mix"));
FileSystem.Mount(new Package("sounds.mix"));
FileSystem.Mount(new Package("speech.mix"));
FileSystem.Mount(new Package("allies.mix"));
FileSystem.Mount(new Package("general.mix"));
FileSystem.Mount(new Package("local.mix"));
FileSystem.Mount(new Package("sounds.mix"));
FileSystem.Mount(new Package("speech.mix"));
FileSystem.Mount(new Package("allies.mix"));
FileSystem.Mount(new Package("russian.mix"));
FormBorderStyle = FormBorderStyle.None;
@@ -52,22 +52,25 @@ using System.Runtime.InteropServices;
game = new Game(settings.GetValue("map", "scg11eb.ini"), renderer, new int2(ClientSize));
SequenceProvider.ForcePrecache();
SequenceProvider.ForcePrecache();
Traits.RenderBuilding.Prefetch();
game.world.Add( new Actor( "mcv", new int2( 5, 5 ), game.players[ 3 ]) );
game.world.Add( new Actor( "mcv", new int2( 7, 5 ), game.players[ 2 ] ) );
game.world.Add( new Actor( "mcv", new int2( 9, 5 ), game.players[ 0 ] ) );
game.world.Add( new Actor( "jeep", new int2( 9, 7 ), game.players[ 1 ] ) );
game.world.Add(new Bullet("105mm", game.players[1], null,
new int2(200, 200), new int2(400, 200), game));
game.world.Add( new Actor( "mcv", new int2( 9, 5 ), game.players[ 0 ] ) );
var jeep = new Actor( "jeep", new int2( 9, 7 ), game.players[ 1 ] );
game.world.Add( jeep );
var tank = new Actor( "3tnk", new int2( 12, 7 ), game.players[ 1 ] );
game.world.Add( tank );
tank.traits.Get<Traits.AttackTurreted>().target = jeep;
sidebar = new Sidebar(renderer, game);
sidebar = new Sidebar(renderer, game);
renderer.BuildPalette(game.map);
ShowCursor(false);
renderer.BuildPalette(game.map);
ShowCursor(false);
game.world.ResetTimer();
}
internal void Run()
@@ -76,9 +79,9 @@ using System.Runtime.InteropServices;
{
game.Tick();
// rude hack
game.viewport.cursor = (game.controller.orderGenerator is UnitOrderGenerator)
&& (game.controller.orderGenerator as UnitOrderGenerator).selection.Count > 0
// rude hack
game.viewport.cursor = (game.controller.orderGenerator is UnitOrderGenerator)
&& (game.controller.orderGenerator as UnitOrderGenerator).selection.Count > 0
? OpenRa.Game.Cursor.Move : OpenRa.Game.Cursor.Default;
Application.DoEvents();