Fixes & Resources support

This commit is contained in:
Paul Chote
2010-04-01 22:02:04 +13:00
committed by Bob
parent 705e3eb2f6
commit c366b7c7fc
7 changed files with 32 additions and 49 deletions

View File

@@ -89,8 +89,8 @@ namespace OpenRA.Graphics
public static Bitmap RenderTerrainBitmap(Map map, TileSet tileset)
{
var terrain = new Bitmap(map.MapSize.X, map.MapSize.Y);
for (var y = 0; y < map.MapSize.Y; y++)
for (var x = 0; x < map.MapSize.X; x++)
for (var x = 0; x < map.MapSize.X; x++)
for (var y = 0; y < map.MapSize.Y; y++)
terrain.SetPixel(x, y, map.IsInMap(x, y)
? Color.FromArgb(alpha, terrainTypeColors[map.Theater].ColorForTerrainType(tileset.GetTerrainType(map.MapTiles[x, y])))
: shroudColor);
@@ -117,8 +117,8 @@ namespace OpenRA.Graphics
var res = world.WorldActor.traits.Get<ResourceLayer>();
oreLayer = new Bitmap(terrain);
for (var y = world.Map.TopLeft.Y; y < world.Map.BottomRight.Y; y++)
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
for (var y = world.Map.TopLeft.Y; y < world.Map.BottomRight.Y; y++)
if (res.GetResource(new int2(x,y)) != null)
oreLayer.SetPixel(x, y, Color.FromArgb(alpha, terrainTypeColors[world.Map.Theater].ColorForTerrainType(TerrainType.Ore)));
}
@@ -140,8 +140,8 @@ namespace OpenRA.Graphics
*(c + (a.Actor.Location.Y * bitmapData.Stride >> 2) + a.Actor.Location.X) =
Color.FromArgb(alpha, a.Actor.Owner.Color).ToArgb();
for (var y = world.Map.BottomRight.Y; y < world.Map.YOffset + world.Map.BottomRight.Y; y++)
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
for (var y = world.Map.TopLeft.Y; y < world.Map.BottomRight.Y; y++)
{
if (!world.LocalPlayer.Shroud.DisplayOnRadar(x, y))
{

View File

@@ -50,11 +50,10 @@ namespace OpenRA.Graphics
int nv = 0;
int ni = 0;
for( int i = map.TopLeft.X ; i < map.BottomRight.X; i++ )
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
for( int i = map.TopLeft.X ; i < map.BottomRight.X; i++ )
{
Log.Write("{0} {1}",i,j);
Sprite tile = tileMapping[map.MapTiles[i, j]];
Sprite tile = tileMapping[map.MapTiles[i, j]];
// TODO: The zero below should explicitly refer to the terrain palette, but this code is called
// before the palettes are created
Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni, tile.size);