public static byte[] Convert(string json) { var obj = JsonConvert.DeserializeObject<json_dat>(json); var dat = ZlibStream.UncompressBuffer(obj.data); Dictionary<short, TerrainTile> tileDict = new Dictionary<short, TerrainTile>(); for (int i = 0; i < obj.dict.Length; i++) { var o = obj.dict[i]; tileDict[(short)i] = new TerrainTile() { TileId = o.ground == null ? (short)0xff : XmlDatas.IdToType[o.ground], TileObj = o.objs == null ? null : o.objs[0].id, Name = o.objs == null ? "" : o.objs[0].name ?? "", Terrain = TerrainType.None, Region = o.regions == null ? TileRegion.None : (TileRegion)Enum.Parse(typeof(TileRegion), o.regions[0].id.Replace(' ', '_')) }; } var tiles = new TerrainTile[obj.width, obj.height]; using (NReader rdr = new NReader(new MemoryStream(dat))) for (int y = 0; y < obj.height; y++) for (int x = 0; x < obj.width; x++) { tiles[x, y] = tileDict[rdr.ReadInt16()]; } return WorldMapExporter.Export(tiles); }
public static byte[] ConvertMakeWalls(string json) { var obj = JsonConvert.DeserializeObject<json_dat>(json); var dat = ZlibStream.UncompressBuffer(obj.data); Dictionary<short, TerrainTile> tileDict = new Dictionary<short, TerrainTile>(); for (int i = 0; i < obj.dict.Length; i++) { var o = obj.dict[i]; tileDict[(short)i] = new TerrainTile() { TileId = o.ground == null ? (short)0xff : XmlDatas.IdToType[o.ground], TileObj = o.objs == null ? null : o.objs[0].id, Name = o.objs == null ? "" : o.objs[0].name ?? "", Terrain = TerrainType.None, Region = o.regions == null ? TileRegion.None : (TileRegion)Enum.Parse(typeof(TileRegion), o.regions[0].id.Replace(' ', '_')) }; } var tiles = new TerrainTile[obj.width, obj.height]; using (NReader rdr = new NReader(new MemoryStream(dat))) for (int y = 0; y < obj.height; y++) for (int x = 0; x < obj.width; x++) { tiles[x, y] = tileDict[rdr.ReadInt16()]; tiles[x, y].X = x; tiles[x, y].Y = y; } foreach (var i in tiles) { if (i.TileId == 0xff && i.TileObj == null) { bool createWall = false; for (int ty = -1; ty <= 1; ty++) for (int tx = -1; tx <= 1; tx++) try { if (tiles[i.X + tx, i.Y + ty].TileId != 0xff) createWall = true; } catch { } if (createWall) tiles[i.X, i.Y].TileObj = "Grey Wall"; } } return WorldMapExporter.Export(tiles); }
public static byte[] Export(TerrainTile[,] tiles) { List<TerrainTile> dict = new List<TerrainTile>(); int w = tiles.GetLength(0); int h = tiles.GetLength(1); byte[] dat = new byte[w * h * 3]; int idx = 0; for (int y = 0; y < h; y++) for (int x = 0; x < w; x++) { TerrainTile tile = tiles[x, y]; short i = (short)dict.IndexOf(tile); if (i == -1) { i = (short)dict.Count; dict.Add(tile); } dat[idx] = (byte)(i & 0xff); dat[idx + 1] = (byte)(i >> 8); dat[idx + 2] = (byte)tile.Elevation; idx += 3; } MemoryStream ms = new MemoryStream(); using (BinaryWriter wtr = new BinaryWriter(ms)) { wtr.Write((short)dict.Count); foreach (var i in dict) { wtr.Write(i.TileId); wtr.Write(i.TileObj ?? ""); wtr.Write(i.Name ?? ""); wtr.Write((byte)i.Terrain); wtr.Write((byte)i.Region); //wtr.Write((byte)i.Elevation); } wtr.Write(w); wtr.Write(h); wtr.Write(dat); } byte[] buff = ZlibStream.CompressBuffer(ms.ToArray()); byte[] ret = new byte[buff.Length + 1]; Buffer.BlockCopy(buff, 0, ret, 1, buff.Length); ret[0] = 2; return ret; }
public TerrainDisplay(TerrainTile[,] tiles) { mode = Mode.Erase; this.tilesBak = (TerrainTile[,])tiles.Clone(); this.tiles = tiles; ClientSize = new Size(800, 800); BackColor = Color.Black; WindowState = FormWindowState.Maximized; panel = new Panel() { Dock = DockStyle.Fill, AutoScroll = true, Controls = { (pic = new PictureBox() { Image = bmp = RenderColorBmp(tiles), SizeMode = PictureBoxSizeMode.AutoSize, }) } }; panel.HorizontalScroll.Enabled = true; panel.VerticalScroll.Enabled = true; panel.HorizontalScroll.Visible = true; panel.VerticalScroll.Visible = true; Controls.Add(panel); pic2 = new PictureBox() { Image = bmp, Width = 250, Height = 250, SizeMode = PictureBoxSizeMode.Zoom }; Controls.Add(pic2); pic2.BringToFront(); Text = mode.ToString(); pic.MouseMove += new MouseEventHandler(pic_MouseMove); pic.MouseDoubleClick += new MouseEventHandler(pic_MouseDoubleClick); }
public void ComputeBiomes(TerrainTile[,] buff) { var nodeMoist = ComputeMoisture(); var polyMoist = RedistributeMoisture(nodeMoist); var elevs = map.Polygons .SelectMany(_ => _.Nodes) .Select(_ => _.DistanceToCoast.Value) .OrderBy(_ => _) .Distinct().ToArray(); elevationThreshold = new double[] { 0 / 5.0, 1 / 5.0, 3 / 5.0, 4 / 5.0, }; beaches = new HashSet<MapPolygon>(map.Polygons.Where(b => !b.IsWater && b.Neighbour.Any(w1 => (w1.IsCoast && w1.IsOcean) || w1.Neighbour.Any(w2 => w2.IsCoast && w2.IsOcean)))); var moists = nodeMoist .Select(_ => _.Value) .OrderBy(_ => _) .Distinct().ToArray(); moistureThreshold = new double[] { 1 / 7.0, 2 / 7.0, 3 / 7.0, 4 / 7.0, 5 / 7.0, 6 / 7.0, }; AddNoiseAndBiome(buff, polyMoist); BlurElevation(buff, 5); Randomize(buff); ComputeSpawnTerrains(buff); }
static TerrainTile[,] CreateTerrain(int seed, PolygonMap map) { Rasterizer <TerrainTile> rasterizer = new Rasterizer <TerrainTile>(Size, Size); //Set all to ocean rasterizer.Clear(new TerrainTile() { PolygonId = -1, Elevation = 0, Moisture = 1, TileId = TileTypes.DeepWater, TileObj = null }); //Render lands poly foreach (var poly in map.Polygons.Where(_ => !_.IsWater)) { uint color = 0x00ffffff; color |= (uint)(poly.DistanceToCoast * 255) << 24; rasterizer.FillPolygon( poly.Nodes.SelectMany(_ => { return(new[] { (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size }); }).Concat(new[] { (poly.Nodes[0].X + 1) / 2 * Size, (poly.Nodes[0].Y + 1) / 2 * Size }).ToArray(), new TerrainTile() { PolygonId = poly.Id, Elevation = (float)poly.DistanceToCoast, Moisture = -1, TileId = TileTypes.Grass, TileObj = null }); } MapFeatures fea = new MapFeatures(map, seed); //Render roads var roads = fea.GenerateRoads(); foreach (var i in roads) { rasterizer.DrawClosedCurve(i.SelectMany(_ => new[] { (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size }).ToArray(), 1, t => { t.TileId = TileTypes.Road; return(t); }, 3); } //Render waters poly foreach (var poly in map.Polygons.Where(_ => _.IsWater)) { var tile = new TerrainTile() { PolygonId = poly.Id, Elevation = (float)poly.DistanceToCoast, TileObj = null }; if (poly.IsCoast) { tile.TileId = TileTypes.MovingWater; tile.Moisture = 0; } else { tile.TileId = TileTypes.DeepWater; tile.Moisture = 1; } rasterizer.FillPolygon( poly.Nodes.SelectMany(_ => { return(new[] { (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size }); }).Concat(new[] { (poly.Nodes[0].X + 1) / 2 * Size, (poly.Nodes[0].Y + 1) / 2 * Size }).ToArray(), tile); } //Render rivers var rivers = fea.GenerateRivers(); Dictionary <Tuple <MapNode, MapNode>, int> edges = new Dictionary <Tuple <MapNode, MapNode>, int>(); foreach (var i in rivers) { for (int j = 1; j < i.Length; j++) { Tuple <MapNode, MapNode> edge = new Tuple <MapNode, MapNode>(i[j - 1], i[j]); int count; if (edges.TryGetValue(edge, out count)) { count++; } else { count = 1; } edges[edge] = count; } } foreach (var i in edges) { i.Key.Item1.IsWater = true; i.Key.Item1.RiverValue = i.Value + 1; i.Key.Item2.IsWater = true; i.Key.Item2.RiverValue = i.Value + 1; rasterizer.DrawLineBresenham( (i.Key.Item1.X + 1) / 2 * Size, (i.Key.Item1.Y + 1) / 2 * Size, (i.Key.Item2.X + 1) / 2 * Size, (i.Key.Item2.Y + 1) / 2 * Size, t => { t.TileId = TileTypes.Water; t.Elevation = (float)(i.Key.Item1.DistanceToCoast + i.Key.Item2.DistanceToCoast) / 2; t.Moisture = 1; return(t); }, 3 * Math.Min(2, i.Value)); } return(rasterizer.Buffer); }
public static byte[] ConvertMakeWalls(string json) { var obj = JsonConvert.DeserializeObject <json_dat>(json); var dat = ZlibStream.UncompressBuffer(obj.data); Dictionary <short, TerrainTile> tileDict = new Dictionary <short, TerrainTile>(); for (int i = 0; i < obj.dict.Length; i++) { var o = obj.dict[i]; tileDict[(short)i] = new TerrainTile() { TileId = o.ground == null ? (short)0xff : XmlDatas.IdToType[o.ground], TileObj = o.objs == null ? null : o.objs[0].id, Name = o.objs == null ? "" : o.objs[0].name ?? "", Terrain = TerrainType.None, Region = o.regions == null ? TileRegion.None : (TileRegion)Enum.Parse(typeof(TileRegion), o.regions[0].id.Replace(' ', '_')) }; } var tiles = new TerrainTile[obj.width, obj.height]; using (NReader rdr = new NReader(new MemoryStream(dat))) for (int y = 0; y < obj.height; y++) { for (int x = 0; x < obj.width; x++) { tiles[x, y] = tileDict[rdr.ReadInt16()]; tiles[x, y].X = x; tiles[x, y].Y = y; } } foreach (var i in tiles) { if (i.TileId == 0xff && i.TileObj == null) { bool createWall = false; for (int ty = -1; ty <= 1; ty++) { for (int tx = -1; tx <= 1; tx++) { try { if (tiles[i.X + tx, i.Y + ty].TileId != 0xff) { createWall = true; } } catch { } } } if (createWall) { tiles[i.X, i.Y].TileObj = "Grey Wall"; } } } return(WorldMapExporter.Export(tiles)); }
// TODO: turn terrain into tiles public void LoadTiles() { // discard old tiles // TODO: do we need to unload resources here? this.Tiles.Clear(); for (int y = 0; y < NYTiles; y++) { for (int x = 0; x < NXTiles; x++) { //var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x * TileSize), 0.0f, (float)(y * TileSize)),(float)TileSize); var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x), 0.0f, (float)(y)), 1.0f); tile.SetDataFromCells(this.Data, x * TileSize, y * TileSize, this.Width); this.Tiles.Add(tile); } } }
public static void Export(TerrainTile[,] tiles, string path) { File.WriteAllBytes(path, Export(tiles)); }
static Bitmap RenderMoistBmp(TerrainTile[,] tiles) { int w = tiles.GetLength(0); int h = tiles.GetLength(1); Bitmap bmp = new Bitmap(w, h); BitmapBuffer buff = new BitmapBuffer(bmp); buff.Lock(); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { uint color = 0x00ffffff; color |= (uint)(tiles[x, y].Moisture * 255) << 24; buff[x, y] = color; } buff.Unlock(); return bmp; }
void Randomize(TerrainTile[,] buff) { int w = buff.GetLength(0); int h = buff.GetLength(1); TerrainTile[,] tmp = (TerrainTile[,])buff.Clone(); for (int y = 10; y < h - 10; y++) for (int x = 10; x < w - 10; x++) { var tile = buff[x, y]; if (tile.TileId == TileTypes.Water && tile.Elevation >= elevationThreshold[3]) tile.TileId = TileTypes.SnowRock; else if (tile.TileId != TileTypes.Water && tile.TileId != TileTypes.Road && tile.TileId != TileTypes.Beach && tile.TileId != TileTypes.MovingWater && tile.TileId != TileTypes.DeepWater) { var id = tmp[x + rand.Next(-3, 4), y + rand.Next(-3, 4)].TileId; while (id == TileTypes.Water || id == TileTypes.Road || id == TileTypes.Beach || id == TileTypes.MovingWater || id == TileTypes.DeepWater) id = tmp[x + rand.Next(-3, 4), y + rand.Next(-3, 4)].TileId; tile.TileId = id; } //if (tile.TileId == TileTypes.Beach) // tile.Region = TileRegion.Spawn; string biome = tile.Biome; if (tile.TileId == TileTypes.Beach) biome = "beach"; else if (tile.TileId == TileTypes.MovingWater) biome = "coast"; var biomeObj = Decoration.GetDecor(biome, rand); if (biomeObj != null) { tile.TileObj = biomeObj; var size = Decoration.GetSize(biomeObj, rand); if (size != null) tile.Name = "size:" + size; } float elevation = 0; int c = 0; for (int dy = -1; dy <= 1; dy++) for (int dx = -1; dx <= 1; dx++) { if (x + dx < 0 || x + dx >= w || y + dy < 0 || y + dy >= h) continue; elevation += tmp[x + dx, y + dy].Elevation; c++; } tile.Elevation = elevation / c; buff[x, y] = tile; } }
//https://code.google.com/p/imagelibrary/source/browse/trunk/Filters/GaussianBlurFilter.cs //Blur the elevation static void BlurElevation(TerrainTile[,] tiles, double radius) { int w = tiles.GetLength(0); int h = tiles.GetLength(1); int shift, source; int blurDiam = (int)Math.Pow(radius, 2); int gaussWidth = (blurDiam * 2) + 1; double[] kernel = CreateKernel(gaussWidth, blurDiam); // Calculate the sum of the Gaussian kernel double gaussSum = 0; for (int n = 0; n < gaussWidth; n++) { gaussSum += kernel[n]; } // Scale the Gaussian kernel for (int n = 0; n < gaussWidth; n++) { kernel[n] = kernel[n] / gaussSum; } //premul = kernel[k] / gaussSum; // Create an X & Y pass buffer float[,] gaussPassX = new float[w, h]; // Do Horizontal Pass for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { // Iterate through kernel for (int k = 0; k < gaussWidth; k++) { // Get pixel-shift (pixel dist between dest and source) shift = k - blurDiam; // Basic edge clamp source = x + shift; if (source <= 0 || source >= w) { source = x; } // Combine source and destination pixels with Gaussian Weight gaussPassX[x, y] = (float)(gaussPassX[x, y] + tiles[source, y].Elevation * kernel[k]); } } } // Do Vertical Pass for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { tiles[x, y].Elevation = 0; // Iterate through kernel for (int k = 0; k < gaussWidth; k++) { // Get pixel-shift (pixel dist between dest and source) shift = k - blurDiam; // Basic edge clamp source = y + shift; if (source <= 0 || source >= h) { source = y; } // Combine source and destination pixels with Gaussian Weight tiles[x, y].Elevation = (float)(tiles[x, y].Elevation + (gaussPassX[x, source]) * kernel[k]); } } } }
static Bitmap RenderTerrainBmp(TerrainTile[,] tiles) { int w = tiles.GetLength(0); int h = tiles.GetLength(1); Bitmap bmp = new Bitmap(w, h); BitmapBuffer buff = new BitmapBuffer(bmp); buff.Lock(); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { buff[x, y] = TileTypes.terrainColor[tiles[x, y].Terrain]; } buff.Unlock(); return bmp; }
static TerrainTile[,] CreateTerrain(int seed, PolygonMap map) { Rasterizer<TerrainTile> rasterizer = new Rasterizer<TerrainTile>(Size, Size); //Set all to ocean rasterizer.Clear(new TerrainTile() { PolygonId = -1, Elevation = 0, Moisture = 1, TileId = TileTypes.DeepWater, TileObj = null }); //Render lands poly foreach (var poly in map.Polygons.Where(_ => !_.IsWater)) { uint color = 0x00ffffff; color |= (uint)(poly.DistanceToCoast * 255) << 24; rasterizer.FillPolygon( poly.Nodes.SelectMany(_ => { return new[]{ (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size}; }).Concat(new[]{ (poly.Nodes[0].X + 1) / 2 * Size, (poly.Nodes[0].Y + 1) / 2 * Size}).ToArray(), new TerrainTile() { PolygonId = poly.Id, Elevation = (float)poly.DistanceToCoast, Moisture = -1, TileId = TileTypes.Grass, TileObj = null }); } MapFeatures fea = new MapFeatures(map, seed); //Render roads var roads = fea.GenerateRoads(); foreach (var i in roads) { rasterizer.DrawClosedCurve(i.SelectMany(_ => new[] { (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size }).ToArray(), 1, t => { t.TileId = TileTypes.Road; return t; }, 3); } //Render waters poly foreach (var poly in map.Polygons.Where(_ => _.IsWater)) { var tile = new TerrainTile() { PolygonId = poly.Id, Elevation = (float)poly.DistanceToCoast, TileObj = null }; if (poly.IsCoast) { tile.TileId = TileTypes.MovingWater; tile.Moisture = 0; } else { tile.TileId = TileTypes.DeepWater; tile.Moisture = 1; } rasterizer.FillPolygon( poly.Nodes.SelectMany(_ => { return new[]{ (_.X + 1) / 2 * Size, (_.Y + 1) / 2 * Size}; }).Concat(new[]{ (poly.Nodes[0].X + 1) / 2 * Size, (poly.Nodes[0].Y + 1) / 2 * Size}).ToArray(), tile); } //Render rivers var rivers = fea.GenerateRivers(); Dictionary<Tuple<MapNode, MapNode>, int> edges = new Dictionary<Tuple<MapNode, MapNode>, int>(); foreach (var i in rivers) { for (int j = 1; j < i.Length; j++) { Tuple<MapNode, MapNode> edge = new Tuple<MapNode, MapNode>(i[j - 1], i[j]); int count; if (edges.TryGetValue(edge, out count)) count++; else count = 1; edges[edge] = count; } } foreach (var i in edges) { i.Key.Item1.IsWater = true; i.Key.Item1.RiverValue = i.Value + 1; i.Key.Item2.IsWater = true; i.Key.Item2.RiverValue = i.Value + 1; rasterizer.DrawLineBresenham( (i.Key.Item1.X + 1) / 2 * Size, (i.Key.Item1.Y + 1) / 2 * Size, (i.Key.Item2.X + 1) / 2 * Size, (i.Key.Item2.Y + 1) / 2 * Size, t => { t.TileId = TileTypes.Water; t.Elevation = (float)(i.Key.Item1.DistanceToCoast + i.Key.Item2.DistanceToCoast) / 2; t.Moisture = 1; return t; }, 3 * Math.Min(2, i.Value)); } return rasterizer.Buffer; }
string GetBiome(TerrainTile tile) { if (tile.PolygonId == -1) return "unknown"; if (tile.TileId == TileTypes.Road) return "road"; if (tile.TileId == TileTypes.Water) return "river"; MapPolygon poly = map.Polygons[tile.PolygonId]; if (tile.TileId == 0xb4) return "towel"; if (beaches.Contains(poly)) return "beach"; else if (poly.IsWater) { if (poly.IsCoast) return "coast"; else if (poly.IsOcean) return "ocean"; else return "water"; } else { if (tile.Elevation >= elevationThreshold[3]) { if (tile.Moisture > moistureThreshold[4]) return "snowy"; else return "mountain"; } else if (tile.Elevation > elevationThreshold[2]) { if (tile.Moisture > moistureThreshold[4]) return "dryland"; else if (tile.Moisture > moistureThreshold[2]) return "taiga"; else return "desert"; } else if (tile.Elevation > elevationThreshold[1]) { if (tile.Moisture > moistureThreshold[4]) return "forest"; else if (tile.Moisture > moistureThreshold[2]) return "shrub"; else return "desert"; } else { if (tile.Moisture > moistureThreshold[4]) return "rainforest"; else if (tile.Moisture > moistureThreshold[3]) return "forest"; else if (tile.Moisture > moistureThreshold[2]) return "grassland"; else return "desert"; } } //return "unknown"; //betacode }
void ComputeSpawnTerrains(TerrainTile[,] buff) { int w = buff.GetLength(0); int h = buff.GetLength(1); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { var tile = buff[x, y]; tile.Terrain = GetBiomeTerrain(tile); buff[x, y] = tile; } }
void AddNoiseAndBiome(TerrainTile[,] buff, Dictionary<MapPolygon, double> moist) { int w = buff.GetLength(0); int h = buff.GetLength(1); var elevationNoise = new Noise(rand.Next()); var moistureNoise = new Noise(rand.Next()); //var elevationNoise = PerlinNoise.GetPerlinNoise(rand.Next(), 256, 256, 2); //var moistureNoise = PerlinNoise.GetPerlinNoise(rand.Next(), 256, 256, 2); for (int y = 0; y < w; y++) for (int x = 0; x < h; x++) { var tile = buff[x, y]; if (tile.PolygonId != -1) { var poly = map.Polygons[tile.PolygonId]; tile.Elevation = Math.Min(1, (float)(poly.DistanceToCoast + poly.DistanceToCoast * elevationNoise.GetNoise(x * 128.0 / w, y * 128.0 / h, 0.3) * 0.01f) * 2); if (tile.Elevation > 1) tile.Elevation = 1; else if (tile.Elevation < 0) tile.Elevation = 0; tile.Elevation = (float)Math.Pow(tile.Elevation, 1.5); tile.Moisture = (float)(moist[poly] + moist[poly] * moistureNoise.GetNoise(x * 128.0 / w, y * 128.0 / h, 0.3) * 0.01f); if (tile.Moisture > 1) tile.Moisture = 1; else if (tile.Moisture < 0) tile.Moisture = 0; } tile.Biome = GetBiome(tile); var biomeGround = GetBiomeGround(tile.Biome); if (biomeGround != 0) tile.TileId = biomeGround; buff[x, y] = tile; } }
TerrainType GetBiomeTerrain(TerrainTile tile) { if (tile.PolygonId == -1 || tile.TileId == TileTypes.Road || tile.TileId == TileTypes.Water) return TerrainType.None; MapPolygon poly = map.Polygons[tile.PolygonId]; if (!poly.IsWater && beaches.Contains(poly)) return TerrainType.ShoreSand; else if (poly.IsWater) return TerrainType.None; else { if (tile.Elevation >= elevationThreshold[3]) return TerrainType.Mountains; else if (tile.Elevation > elevationThreshold[2]) { if (tile.Moisture > moistureThreshold[4]) return TerrainType.HighPlains; else if (tile.Moisture > moistureThreshold[2]) return TerrainType.HighForest; else return TerrainType.HighSand; } else if (tile.Elevation > elevationThreshold[1]) { if (tile.Moisture > moistureThreshold[4]) return TerrainType.MidForest; else if (tile.Moisture > moistureThreshold[2]) return TerrainType.MidPlains; else return TerrainType.MidSand; } else { if (poly.Neighbour.Any(_ => beaches.Contains(_))) { if (tile.Moisture > moistureThreshold[2]) return TerrainType.ShorePlains; } if (tile.Moisture > moistureThreshold[3]) return TerrainType.LowForest; else if (tile.Moisture > moistureThreshold[2]) return TerrainType.LowPlains; else return TerrainType.LowSand; } } /* return TerrainType.None; */ }
static uint GetColor(TerrainTile tile) { if (tile.Region == TileRegion.Spawn) return 0xffff0000; return TileTypes.color[tile.TileId]; }