Begin unhardcoding 128 map size; Trees; Waypoints

This commit is contained in:
Paul Chote
2010-03-03 09:42:45 +13:00
parent f1211e4414
commit ae2bbae16c
14 changed files with 295 additions and 249 deletions

View File

@@ -39,7 +39,7 @@ namespace OpenRA.GameRules
// External game settings
public readonly string NetworkHost = "";
public readonly int NetworkPort = 0;
public readonly string Map = "scm01ea.ini";
public readonly string Map = "scm02ea.ini";
public readonly int Player = 1;
public readonly string Replay = "";
public readonly string PlayerName = "";

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -93,9 +93,9 @@ namespace OpenRA.Graphics
public static Bitmap RenderTerrainBitmap(Map map, TileSet tileset)
{
var colors = terrainTypeColors[map.Theater.ToLowerInvariant()];
var terrain = new Bitmap(128, 128);
for (var y = 0; y < 128; y++)
for (var x = 0; x < 128; x++)
var terrain = new Bitmap(map.MapSize, map.MapSize);
for (var y = 0; y < map.MapSize; y++)
for (var x = 0; x < map.MapSize; x++)
terrain.SetPixel(x, y, map.IsInMap(x, y)
? colors[tileset.GetWalkability(map.MapTiles[x, y])]
: shroudColor);

View File

@@ -35,10 +35,11 @@ namespace OpenRA
public PathFinder( World world )
{
this.world = world;
var map = world.Map;
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++)
passableCost[(int)umt] = new float[128, 128];
for( int x = 0 ; x < 128 ; x++ )
for( int y = 0 ; y < 128 ; y++ )
passableCost[(int)umt] = new float[map.MapSize, map.MapSize];
for( int x = 0 ; x < map.MapSize ; x++ )
for( int y = 0 ; y < map.MapSize ; y++ )
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++ )
passableCost[(int)umt][ x, y ] = ( world.Map.IsInMap( x, y ) )
? (float)TerrainCosts.Cost( umt, world.TileSet.GetWalkability( world.Map.MapTiles[ x, y ] ) )

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
@@ -36,8 +36,8 @@ namespace OpenRA.Traits
public UnitInfluence( Actor self )
{
for (int i = 0; i < 128; i++)
for (int j = 0; j < 128; j++)
for (int i = 0; i < self.World.Map.MapSize; i++)
for (int j = 0; j < self.World.Map.MapSize; j++)
influence[ i, j ] = new List<Actor>();
self.World.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupySpace>() );
@@ -73,8 +73,8 @@ namespace OpenRA.Traits
[Conditional( "SANITY_CHECKS" )]
void SanityCheck( Actor self )
{
for( int y = 0 ; y < 128 ; y++ )
for( int x = 0 ; x < 128 ; x++ )
for( int y = 0 ; y < self.World.Map.MapSize ; y++ )
for( int x = 0 ; x < self.World.Map.MapSize ; x++ )
if( influence[ x, y ] != null )
foreach (var a in influence[ x, y ])
if (!a.traits.Get<IOccupySpace>().OccupiedCells().Contains( new int2( x, y ) ) )

View File

@@ -56,8 +56,8 @@ namespace OpenRA
public void Draw( World world )
{
if (ShowUnitDebug)
for (var j = 0; j < 128; j++)
for (var i = 0; i < 128; i++)
for (var j = 0; j < world.Map.MapSize; j++)
for (var i = 0; i < world.Map.MapSize; i++)
if (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(new int2(i, j)).Any())
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), "terrain");
}