made a real terrain type for it; still not quite right though. will crash on snow maps atm too.

This commit is contained in:
Chris Forbes
2010-01-18 23:22:00 +13:00
parent 3101ffa671
commit faf28a90ae
10 changed files with 26 additions and 7 deletions

View File

@@ -42,7 +42,7 @@ namespace OpenRa
// stash it // stash it
replacedTiles[new int2(x, y)] = w.Map.MapTiles[x, y].image; replacedTiles[new int2(x, y)] = w.Map.MapTiles[x, y].image;
// remove the tile from the actual map // remove the tile from the actual map
w.Map.MapTiles[x, y].tile = 0xff; w.Map.MapTiles[x, y].tile = 0xfffe;
w.Map.MapTiles[x, y].image = 0; w.Map.MapTiles[x, y].image = 0;
} }
} }

View File

@@ -49,7 +49,7 @@ namespace OpenRa.Graphics
if (terrainTypeColors == null) if (terrainTypeColors == null)
{ {
var pal = new Palette(FileSystem.Open(Game.world.Map.Theater + ".pal")); var pal = new Palette(FileSystem.Open(Game.world.Map.Theater + ".pal"));
terrainTypeColors = new[] {theater.ToLowerInvariant() == "snow" ? 0xe3 :0x1a, 0x63, 0x2f, 0x1f, 0x14, 0x64, 0x1f, 0x68, 0x6b, 0x6d } terrainTypeColors = new[] {theater.ToLowerInvariant() == "snow" ? 0xe3 :0x1a, 0x63, 0x2f, 0x1f, 0x14, 0x64, 0x1f, 0x68, 0x6b, 0x6d, 0x67 }
.Select( a => Color.FromArgb(alpha, pal.GetColor(a) )).ToArray(); .Select( a => Color.FromArgb(alpha, pal.GetColor(a) )).ToArray();
playerColors = Util.MakeArray<Color>( 8, b => Color.FromArgb(alpha, Chat.paletteColors[b]) ); playerColors = Util.MakeArray<Color>( 8, b => Color.FromArgb(alpha, Chat.paletteColors[b]) );

View File

@@ -23,16 +23,17 @@ namespace OpenRa
Wall = 7, Wall = 7,
Beach = 8, Beach = 8,
Ore = 9, Ore = 9,
Special = 10,
} }
static class TerrainCosts static class TerrainCosts
{ {
static double[][] costs = Util.MakeArray<double[]>( 4, static double[][] costs = Util.MakeArray<double[]>( 4,
a => Util.MakeArray<double>( 10, b => double.PositiveInfinity )); a => Util.MakeArray<double>( 11, b => double.PositiveInfinity ));
static TerrainCosts() static TerrainCosts()
{ {
for( int i = 0 ; i < 10 ; i++ ) for( int i = 0 ; i < 11 ; i++ )
{ {
if( i == 4 ) continue; if( i == 4 ) continue;
var section = Rules.AllRules.GetSection( ( (TerrainMovementType)i ).ToString() ); var section = Rules.AllRules.GetSection( ( (TerrainMovementType)i ).ToString() );
@@ -46,6 +47,7 @@ namespace OpenRa
public static double Cost( UnitMovementType unitMovementType, int r ) public static double Cost( UnitMovementType unitMovementType, int r )
{ {
if (r >= 10) return 1.0;
return costs[ (byte)unitMovementType ][ r ]; return costs[ (byte)unitMovementType ][ r ];
} }
} }

View File

@@ -9,7 +9,7 @@ namespace OpenRa.Traits
public readonly int[] SpawnOffset = null; public readonly int[] SpawnOffset = null;
public readonly string[] Produces = { }; public readonly string[] Produces = { };
public object Create(Actor self) { return new Production(self); } public virtual object Create(Actor self) { return new Production(self); }
} }
class Production : IIssueOrder, IResolveOrder, IProducer, ITags class Production : IIssueOrder, IResolveOrder, IProducer, ITags

View File

@@ -3,9 +3,9 @@ using OpenRa.GameRules;
namespace OpenRa.Traits namespace OpenRa.Traits
{ {
class ProductionSurroundInfo : ITraitInfo class ProductionSurroundInfo : ProductionInfo
{ {
public object Create(Actor self) { return new ProductionSurround(self); } public override object Create(Actor self) { return new ProductionSurround(self); }
} }
class ProductionSurround : Production class ProductionSurround : Production

View File

@@ -138,6 +138,10 @@ namespace RulesConverter
{ "Produces", "Produces" } } { "Produces", "Produces" } }
}, },
{ "ProductionSurround", new PL {
{ "Produces", "Produces" } }
},
{ "Minelayer", new PL { { "Minelayer", new PL {
{ "Mine", "Primary" } } { "Mine", "Primary" } }
}, },

BIN
bogus.tem Normal file

Binary file not shown.

View File

@@ -999,6 +999,7 @@ SYRD:
Sight: 4 Sight: 4
RenderBuilding: RenderBuilding:
ProductionSurround: ProductionSurround:
Produces: Ship
IronCurtainable: IronCurtainable:
SPEN: SPEN:
@@ -1023,6 +1024,7 @@ SPEN:
Sight: 4 Sight: 4
RenderBuilding: RenderBuilding:
ProductionSurround: ProductionSurround:
Produces: Ship
IronCurtainable: IronCurtainable:
FACT: FACT:

View File

@@ -2822,3 +2822,9 @@ tiletype18=2
tiletype19=2 tiletype19=2
tiletype23=2 tiletype23=2
tiletype24=2 tiletype24=2
[TEM65534]
Name=Bogus
width=1
height=1
tiletype0=10

View File

@@ -304,3 +304,8 @@ gflr{0:0000}
0118 0118
gstr{0:0000} gstr{0:0000}
; bogus
TS-
1
fffe
bogus