Bake PickAny tiles on map save. Translate maxvalue index to random tile for backwards compat.

This commit is contained in:
Paul Chote
2011-02-11 16:49:25 +13:00
parent 9407c55262
commit db770eb997
6 changed files with 17 additions and 24 deletions

View File

@@ -67,10 +67,10 @@ namespace OpenRA.Mods.RA
// Correlate the tile "image" aka subtile with its position to find the template origin
var tile = w.Map.MapTiles[i, j].type;
var image = w.Map.MapTiles[i, j].image;
var index = w.Map.MapTiles[i, j].index;
var template = w.TileSet.Templates[tile];
var ni = i - image % template.Size.X;
var nj = j - image / template.Size.X;
var ni = i - index % template.Size.X;
var nj = j - index / template.Size.X;
// Create a new actor for this bridge and keep track of which subtiles this bridge includes
var bridge = w.CreateActor(BridgeTypes[tile].First, new TypeDictionary
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA
var y = nj + ind / template.Size.X;
// This isn't the bridge you're looking for
if (!w.Map.IsInMap(x, y) || w.Map.MapTiles[x, y].image != ind)
if (!w.Map.IsInMap(x, y) || w.Map.MapTiles[x, y].index != ind)
continue;
subTiles.Add(new int2(x,y),ind);

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA.Buildings
if (!world.LocalShroud.IsExplored(kv.Key))
continue;
bibSprites[kv.Value.type - 1][kv.Value.image].DrawAt( wr,
bibSprites[kv.Value.type - 1][kv.Value.index].DrawAt( wr,
Game.CellSize * kv.Key, "terrain");
}
}

View File

@@ -72,9 +72,9 @@ namespace OpenRA.Mods.RA
var tile = tiles[loc];
// Existing smudge; make it deeper
int depth = Info.Depths[tile.type-1];
if (tile.image < depth - 1)
if (tile.index < depth - 1)
{
tile.image++;
tile.index++;
tiles[loc] = tile; // struct semantics.
}
}
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA
if (localPlayer != null && !localPlayer.Shroud.IsExplored(kv.Key))
continue;
smudgeSprites[kv.Value.type- 1][kv.Value.image].DrawAt( wr,
smudgeSprites[kv.Value.type- 1][kv.Value.index].DrawAt( wr,
Game.CellSize * kv.Key, "terrain");
}
}