public void AddTerrain(Terrain newTerrain) { newTerrain.Num = TerrainCount; Array.Resize(ref Terrains, TerrainCount + 1); Terrains[TerrainCount] = newTerrain; TerrainCount++; }
public override void ActionPerform() { Terrain = Map.Terrain; Painter = Map.Painter; ResultTiles = null; ResultDirection = TileUtil.None; //apply centre brushes if ( !Terrain.Tiles[PosNum.X, PosNum.Y].Terrain_IsCliff ) { for ( int BrushNum = 0; BrushNum <= Painter.TerrainCount - 1; BrushNum++ ) { Terrain_Inner = Painter.Terrains[BrushNum]; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //i i i i ResultTiles = Terrain_Inner.Tiles; ResultDirection = TileUtil.None; } } } } } } //apply transition brushes if ( !Terrain.Tiles[PosNum.X, PosNum.Y].Terrain_IsCliff ) { for ( int BrushNum = 0; BrushNum <= Painter.TransitionBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.TransitionBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.TransitionBrushes[BrushNum].Terrain_Outer; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //i i i i //nothing to do here break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //i i i o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.BottomRight; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //i i o i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.BottomLeft; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //i i o o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Bottom; break; } } } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //i o i i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.TopRight; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //i o i o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Right; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //i o o i ResultTiles = null; ResultDirection = TileUtil.None; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //i o o o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.BottomRight; break; } } } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //o i i i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.TopLeft; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //o i i o ResultTiles = null; ResultDirection = TileUtil.None; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //o i o i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Left; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //o i o o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.BottomLeft; break; } } } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //o o i i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Top; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //o o i o ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.TopRight; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { //o o o i ResultTiles = Painter.TransitionBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.TopLeft; break; } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { //o o o o //nothing to do here break; } } } } } } //set cliff tiles if ( Terrain.Tiles[PosNum.X, PosNum.Y].Tri ) { if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriTopLeftIsCliff ) { if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriBottomRightIsCliff ) { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain_Inner == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 3 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = Terrain.Tiles[PosNum.X, PosNum.Y].DownSide; break; } } if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Bottom; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Left; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Top; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Right; break; } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } else { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.TopLeft; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { int A = 0; if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.BottomRight; break; } } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } } else if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriBottomRightIsCliff ) { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.BottomRight; break; } } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.TopLeft; break; } } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } else { //no cliff } } else { //default tri orientation if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriTopRightIsCliff ) { if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriBottomLeftIsCliff ) { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain_Inner == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 3 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = Terrain.Tiles[PosNum.X, PosNum.Y].DownSide; break; } } if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Bottom; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Left; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer) && (Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Top; break; } else if ( ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner && Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer || Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) || ((Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner || Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner) && (Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer && Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer)) ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Straight; ResultDirection = TileUtil.Right; break; } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } else { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.TopRight; break; } } else if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.BottomLeft; break; } } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } } else if ( Terrain.Tiles[PosNum.X, PosNum.Y].TriBottomLeftIsCliff ) { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.CliffBrushCount - 1; BrushNum++ ) { Terrain_Inner = Painter.CliffBrushes[BrushNum].Terrain_Inner; Terrain_Outer = Painter.CliffBrushes[BrushNum].Terrain_Outer; if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Inner ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Inner ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_In; ResultDirection = TileUtil.BottomLeft; break; } } else if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Inner ) { int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( A >= 2 ) { ResultTiles = Painter.CliffBrushes[BrushNum].Tiles_Corner_Out; ResultDirection = TileUtil.TopRight; break; } } } if ( BrushNum == Painter.CliffBrushCount ) { ResultTiles = null; ResultDirection = TileUtil.None; } } else { //no cliff } } //apply roads Road = null; if ( Terrain.SideH[PosNum.X, PosNum.Y].Road != null ) { Road = Terrain.SideH[PosNum.X, PosNum.Y].Road; } else if ( Terrain.SideH[PosNum.X, PosNum.Y + 1].Road != null ) { Road = Terrain.SideH[PosNum.X, PosNum.Y + 1].Road; } else if ( Terrain.SideV[PosNum.X + 1, PosNum.Y].Road != null ) { Road = Terrain.SideV[PosNum.X + 1, PosNum.Y].Road; } else if ( Terrain.SideV[PosNum.X, PosNum.Y].Road != null ) { Road = Terrain.SideV[PosNum.X, PosNum.Y].Road; } if ( Road != null ) { int BrushNum = 0; for ( BrushNum = 0; BrushNum <= Painter.RoadBrushCount - 1; BrushNum++ ) { if ( Painter.RoadBrushes[BrushNum].Road == Road ) { Terrain_Outer = Painter.RoadBrushes[BrushNum].Terrain; int A = 0; if ( Terrain.Vertices[PosNum.X, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( Terrain.Vertices[PosNum.X + 1, PosNum.Y + 1].Terrain == Terrain_Outer ) { A++; } if ( A >= 2 ) { break; } } } ResultTiles = null; ResultDirection = TileUtil.None; if ( BrushNum < Painter.RoadBrushCount ) { RoadTop = Terrain.SideH[PosNum.X, PosNum.Y].Road == Road; RoadLeft = Terrain.SideV[PosNum.X, PosNum.Y].Road == Road; RoadRight = Terrain.SideV[PosNum.X + 1, PosNum.Y].Road == Road; RoadBottom = Terrain.SideH[PosNum.X, PosNum.Y + 1].Road == Road; //do cross intersection if ( RoadTop && RoadLeft && RoadRight && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_CrossIntersection; ResultDirection = TileUtil.None; //do T intersection } else if ( RoadTop && RoadLeft && RoadRight ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_TIntersection; ResultDirection = TileUtil.Top; } else if ( RoadTop && RoadLeft && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_TIntersection; ResultDirection = TileUtil.Left; } else if ( RoadTop && RoadRight && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_TIntersection; ResultDirection = TileUtil.Right; } else if ( RoadLeft && RoadRight && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_TIntersection; ResultDirection = TileUtil.Bottom; //do straight } else if ( RoadTop && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Straight; if ( VBMath.Rnd() >= 0.5F ) { ResultDirection = TileUtil.Top; } else { ResultDirection = TileUtil.Bottom; } } else if ( RoadLeft && RoadRight ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Straight; if ( VBMath.Rnd() >= 0.5F ) { ResultDirection = TileUtil.Left; } else { ResultDirection = TileUtil.Right; } //do corner } else if ( RoadTop && RoadLeft ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Corner_In; ResultDirection = TileUtil.TopLeft; } else if ( RoadTop && RoadRight ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Corner_In; ResultDirection = TileUtil.TopRight; } else if ( RoadLeft && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Corner_In; ResultDirection = TileUtil.BottomLeft; } else if ( RoadRight && RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_Corner_In; ResultDirection = TileUtil.BottomRight; //do end } else if ( RoadTop ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_End; ResultDirection = TileUtil.Top; } else if ( RoadLeft ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_End; ResultDirection = TileUtil.Left; } else if ( RoadRight ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_End; ResultDirection = TileUtil.Right; } else if ( RoadBottom ) { ResultTiles = Painter.RoadBrushes[BrushNum].Tile_End; ResultDirection = TileUtil.Bottom; } } } if ( ResultTiles == null ) { ResultTexture.TextureNum = -1; ResultTexture.Direction = TileUtil.None; } else { ResultTexture = ResultTiles.GetRandom(); } if ( ResultTexture.TextureNum < 0 ) { if ( MakeInvalidTiles ) { Terrain.Tiles[PosNum.X, PosNum.Y].Texture = TileUtil.OrientateTile(ResultTexture, ResultDirection); } } else { Terrain.Tiles[PosNum.X, PosNum.Y].Texture = TileUtil.OrientateTile(ResultTexture, ResultDirection); } Map.SectorGraphicsChanges.TileChanged(PosNum); Map.SectorTerrainUndoChanges.TileChanged(PosNum); }
public void MapTexturer(ref sLayerList LayerList) { var X = 0; var Y = 0; var A = 0; Terrain[,] TerrainType = null; float[,] Slope = null; var tmpTerrain = default(Terrain); var bmA = new BooleanMap(); var bmB = new BooleanMap(); var LayerNum = 0; var LayerResult = new BooleanMap[LayerList.LayerCount]; double BestSlope = 0; double CurrentSlope = 0; var AllowSlope = default(bool); var Pos = new XYInt(); TerrainType = new Terrain[Terrain.TileSize.X + 1, Terrain.TileSize.Y + 1]; Slope = new float[Terrain.TileSize.X, Terrain.TileSize.Y]; for ( Y = 0; Y <= Terrain.TileSize.Y - 1; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X - 1; X++ ) { //get slope BestSlope = 0.0D; Pos.X = (int)((X + 0.25D) * Constants.TerrainGridSpacing); Pos.Y = (int)((Y + 0.25D) * Constants.TerrainGridSpacing); CurrentSlope = GetTerrainSlopeAngle(Pos); if ( CurrentSlope > BestSlope ) { BestSlope = CurrentSlope; } Pos.X = (int)((X + 0.75D) * Constants.TerrainGridSpacing); Pos.Y = (int)((Y + 0.25D) * Constants.TerrainGridSpacing); CurrentSlope = GetTerrainSlopeAngle(Pos); if ( CurrentSlope > BestSlope ) { BestSlope = CurrentSlope; } Pos.X = (int)((X + 0.25D) * Constants.TerrainGridSpacing); Pos.Y = (int)((Y + 0.75D) * Constants.TerrainGridSpacing); CurrentSlope = GetTerrainSlopeAngle(Pos); if ( CurrentSlope > BestSlope ) { BestSlope = CurrentSlope; } Pos.X = (int)((X + 0.75D) * Constants.TerrainGridSpacing); Pos.Y = (int)((Y + 0.75D) * Constants.TerrainGridSpacing); CurrentSlope = GetTerrainSlopeAngle(Pos); if ( CurrentSlope > BestSlope ) { BestSlope = CurrentSlope; } Slope[X, Y] = (float)BestSlope; } } for ( LayerNum = 0; LayerNum <= LayerList.LayerCount - 1; LayerNum++ ) { tmpTerrain = LayerList.Layers[LayerNum].Terrain; if ( tmpTerrain != null ) { //do other layer constraints LayerResult[LayerNum] = new BooleanMap(); LayerResult[LayerNum].Copy(LayerList.Layers[LayerNum].Terrainmap); if ( LayerList.Layers[LayerNum].WithinLayer >= 0 ) { if ( LayerList.Layers[LayerNum].WithinLayer < LayerNum ) { bmA.Within(LayerResult[LayerNum], LayerResult[LayerList.Layers[LayerNum].WithinLayer]); LayerResult[LayerNum].ValueData = bmA.ValueData; bmA.ValueData = new BooleanMapDataValue(); } } for ( A = 0; A <= LayerNum - 1; A++ ) { if ( LayerList.Layers[LayerNum].AvoidLayers[A] ) { bmA.Expand_One_Tile(LayerResult[A]); bmB.Remove(LayerResult[LayerNum], bmA); LayerResult[LayerNum].ValueData = bmB.ValueData; bmB.ValueData = new BooleanMapDataValue(); } } //do height and slope constraints for ( Y = 0; Y <= Terrain.TileSize.Y; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X; X++ ) { if ( LayerResult[LayerNum].ValueData.Value[Y, X] ) { if ( Terrain.Vertices[X, Y].Height < LayerList.Layers[LayerNum].HeightMin || Terrain.Vertices[X, Y].Height > LayerList.Layers[LayerNum].HeightMax ) { LayerResult[LayerNum].ValueData.Value[Y, X] = false; } if ( LayerResult[LayerNum].ValueData.Value[Y, X] ) { AllowSlope = true; if ( X > 0 ) { if ( Y > 0 ) { if ( Slope[X - 1, Y - 1] < LayerList.Layers[LayerNum].SlopeMin || Slope[X - 1, Y - 1] > LayerList.Layers[LayerNum].SlopeMax ) { AllowSlope = false; } } if ( Y < Terrain.TileSize.Y ) { if ( Slope[X - 1, Y] < LayerList.Layers[LayerNum].SlopeMin || Slope[X - 1, Y] > LayerList.Layers[LayerNum].SlopeMax ) { AllowSlope = false; } } } if ( X < Terrain.TileSize.X ) { if ( Y > 0 ) { if ( Slope[X, Y - 1] < LayerList.Layers[LayerNum].SlopeMin || Slope[X, Y - 1] > LayerList.Layers[LayerNum].SlopeMax ) { AllowSlope = false; } } if ( Y < Terrain.TileSize.Y ) { if ( Slope[X, Y] < LayerList.Layers[LayerNum].SlopeMin || Slope[X, Y] > LayerList.Layers[LayerNum].SlopeMax ) { AllowSlope = false; } } } if ( !AllowSlope ) { LayerResult[LayerNum].ValueData.Value[Y, X] = false; } } } } } LayerResult[LayerNum].Remove_Diagonals(); for ( Y = 0; Y <= Terrain.TileSize.Y; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X; X++ ) { if ( LayerResult[LayerNum].ValueData.Value[Y, X] ) { TerrainType[X, Y] = tmpTerrain; } } } } } //set vertex terrain by terrain map for ( Y = 0; Y <= Terrain.TileSize.Y; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X; X++ ) { if ( TerrainType[X, Y] != null ) { Terrain.Vertices[X, Y].Terrain = TerrainType[X, Y]; } } } AutoTextureChanges.SetAllChanged(); UpdateAutoTextures(); }
public static void CreatePainterUrban() { var NewBrushCliff = default(CliffBrush); var NewBrush = default(TransitionBrush); var NewRoadBrush = default(RoadBrush); //urban App.Painter_Urban = new Painter(); var Terrain_Green = new Terrain(); Terrain_Green.Name = "Green"; App.Painter_Urban.AddTerrain(Terrain_Green); var Terrain_Blue = new Terrain(); Terrain_Blue.Name = "Blue"; App.Painter_Urban.AddTerrain(Terrain_Blue); var Terrain_Gray = new Terrain(); Terrain_Gray.Name = "Gray"; App.Painter_Urban.AddTerrain(Terrain_Gray); var Terrain_Orange = new Terrain(); Terrain_Orange.Name = "Orange"; App.Painter_Urban.AddTerrain(Terrain_Orange); var Terrain_Concrete = new Terrain(); Terrain_Concrete.Name = "Concrete"; App.Painter_Urban.AddTerrain(Terrain_Concrete); var Terrain_Water = new Terrain(); Terrain_Water.Name = "Water"; App.Painter_Urban.AddTerrain(Terrain_Water); //green centre brush Terrain_Green.Tiles.Tile_Add(50, TileUtil.None, 1); //blue centre brush Terrain_Blue.Tiles.Tile_Add(0, TileUtil.None, 14); Terrain_Blue.Tiles.Tile_Add(2, TileUtil.None, 1); //line //gray centre brush Terrain_Gray.Tiles.Tile_Add(5, TileUtil.None, 1); Terrain_Gray.Tiles.Tile_Add(7, TileUtil.None, 4); Terrain_Gray.Tiles.Tile_Add(8, TileUtil.None, 4); Terrain_Gray.Tiles.Tile_Add(78, TileUtil.None, 4); //orange centre brush Terrain_Orange.Tiles.Tile_Add(31, TileUtil.None, 1); //pipe Terrain_Orange.Tiles.Tile_Add(22, TileUtil.None, 50); //concrete centre brush Terrain_Concrete.Tiles.Tile_Add(51, TileUtil.None, 200); //water centre brush Terrain_Water.Tiles.Tile_Add(17, TileUtil.None, 1); //cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Gray; NewBrushCliff.Terrain_Outer = Terrain_Gray; NewBrushCliff.Tiles_Straight.Tile_Add(69, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Straight.Tile_Add(70, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(68, TileUtil.TopRight, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(68, TileUtil.BottomLeft, 1); App.Painter_Urban.AddBrush(NewBrushCliff); //water to gray transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water->Gray"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Gray; NewBrush.Tiles_Straight.Tile_Add(23, TileUtil.Left, 1); NewBrush.Tiles_Straight.Tile_Add(24, TileUtil.Top, 1); NewBrush.Tiles_Corner_In.Tile_Add(25, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(26, TileUtil.TopLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //water to concrete transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water->Concrete"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Concrete; NewBrush.Tiles_Straight.Tile_Add(13, TileUtil.Left, 1); NewBrush.Tiles_Straight.Tile_Add(14, TileUtil.Bottom, 1); NewBrush.Tiles_Corner_In.Tile_Add(16, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(15, TileUtil.BottomLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //gray to blue transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Gray->Blue"; NewBrush.Terrain_Inner = Terrain_Gray; NewBrush.Terrain_Outer = Terrain_Blue; NewBrush.Tiles_Straight.Tile_Add(6, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(4, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(3, TileUtil.BottomRight, 1); App.Painter_Urban.AddBrush(NewBrush); //concrete to gray transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Concrete->Gray"; NewBrush.Terrain_Inner = Terrain_Concrete; NewBrush.Terrain_Outer = Terrain_Gray; NewBrush.Tiles_Straight.Tile_Add(9, TileUtil.Left, 1); NewBrush.Tiles_Straight.Tile_Add(27, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(30, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(10, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(29, TileUtil.BottomLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //orange to blue transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Orange->Blue"; NewBrush.Terrain_Inner = Terrain_Orange; NewBrush.Terrain_Outer = Terrain_Blue; NewBrush.Tiles_Straight.Tile_Add(33, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(34, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(35, TileUtil.BottomRight, 1); App.Painter_Urban.AddBrush(NewBrush); //orange to green transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Orange->Green"; NewBrush.Terrain_Inner = Terrain_Orange; NewBrush.Terrain_Outer = Terrain_Green; NewBrush.Tiles_Straight.Tile_Add(39, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(38, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(37, TileUtil.TopLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //orange to gray transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Orange->Gray"; NewBrush.Terrain_Inner = Terrain_Orange; NewBrush.Terrain_Outer = Terrain_Gray; NewBrush.Tiles_Straight.Tile_Add(60, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(73, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(72, TileUtil.TopLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //orange to concrete transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Orange->Concrete"; NewBrush.Terrain_Inner = Terrain_Orange; NewBrush.Terrain_Outer = Terrain_Concrete; NewBrush.Tiles_Straight.Tile_Add(71, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(76, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(75, TileUtil.BottomRight, 1); App.Painter_Urban.AddBrush(NewBrush); //gray to green transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Gray->Green"; NewBrush.Terrain_Inner = Terrain_Gray; NewBrush.Terrain_Outer = Terrain_Green; NewBrush.Tiles_Straight.Tile_Add(77, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(58, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(79, TileUtil.BottomLeft, 1); App.Painter_Urban.AddBrush(NewBrush); //road var Road_Road = new Road(); Road_Road.Name = "Road"; App.Painter_Urban.AddRoad(Road_Road); //road green NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Green; NewRoadBrush.Tile_CrossIntersection.Tile_Add(49, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(40, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(42, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(45, TileUtil.Left, 1); App.Painter_Urban.AddBrush(NewRoadBrush); //road blue NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Blue; NewRoadBrush.Tile_CrossIntersection.Tile_Add(49, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(40, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(42, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(41, TileUtil.Left, 1); App.Painter_Urban.AddBrush(NewRoadBrush); //road gray NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Gray; NewRoadBrush.Tile_CrossIntersection.Tile_Add(49, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(40, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(42, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(43, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(44, TileUtil.Left, 1); App.Painter_Urban.AddBrush(NewRoadBrush); //road orange NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Orange; NewRoadBrush.Tile_CrossIntersection.Tile_Add(49, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(40, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(42, TileUtil.Left, 1); App.Painter_Urban.AddBrush(NewRoadBrush); //road concrete NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Concrete; NewRoadBrush.Tile_CrossIntersection.Tile_Add(49, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(40, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(42, TileUtil.Left, 1); App.Painter_Urban.AddBrush(NewRoadBrush); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layers = new clsLayer[0]; DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount = 0; var NewLayer = default(clsLayer); NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Gray; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Water; NewLayer.HeightMax = -1.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.Terrain = Terrain_Blue; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 3.0F; NewLayer.Density = 0.3F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[2] = true; NewLayer.Terrain = Terrain_Orange; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 2.5F; NewLayer.Density = 0.4F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[2] = true; NewLayer.AvoidLayers[3] = true; NewLayer.Terrain = Terrain_Concrete; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 1.5F; NewLayer.Density = 0.6F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[2] = true; NewLayer.AvoidLayers[3] = true; NewLayer.AvoidLayers[4] = true; NewLayer.Terrain = Terrain_Green; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 2.5F; NewLayer.Density = 0.6F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 2; NewLayer.Terrain = Terrain_Orange; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 1.5F; NewLayer.Density = 0.5F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 3; NewLayer.Terrain = Terrain_Blue; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 1.5F; NewLayer.Density = 0.5F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetUrban.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 3; NewLayer.AvoidLayers[7] = true; NewLayer.Terrain = Terrain_Green; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 1.5F; NewLayer.Density = 0.5F; }
public static void CreatePainterRockies() { var NewBrushCliff = default(CliffBrush); var NewBrush = default(TransitionBrush); var NewRoadBrush = default(RoadBrush); App.Painter_Rockies = new Painter(); var Terrain_Grass = new Terrain(); Terrain_Grass.Name = "Grass"; App.Painter_Rockies.AddTerrain(Terrain_Grass); var Terrain_Gravel = new Terrain(); Terrain_Gravel.Name = "Gravel"; App.Painter_Rockies.AddTerrain(Terrain_Gravel); var Terrain_Dirt = new Terrain(); Terrain_Dirt.Name = "Dirt"; App.Painter_Rockies.AddTerrain(Terrain_Dirt); var Terrain_GrassSnow = new Terrain(); Terrain_GrassSnow.Name = "Grass Snow"; App.Painter_Rockies.AddTerrain(Terrain_GrassSnow); var Terrain_GravelSnow = new Terrain(); Terrain_GravelSnow.Name = "Gravel Snow"; App.Painter_Rockies.AddTerrain(Terrain_GravelSnow); var Terrain_Snow = new Terrain(); Terrain_Snow.Name = "Snow"; App.Painter_Rockies.AddTerrain(Terrain_Snow); var Terrain_Concrete = new Terrain(); Terrain_Concrete.Name = "Concrete"; App.Painter_Rockies.AddTerrain(Terrain_Concrete); var Terrain_Water = new Terrain(); Terrain_Water.Name = "Water"; App.Painter_Rockies.AddTerrain(Terrain_Water); //grass centre brush Terrain_Grass.Tiles.Tile_Add(0, TileUtil.None, 1); //gravel centre brush Terrain_Gravel.Tiles.Tile_Add(5, TileUtil.None, 1); Terrain_Gravel.Tiles.Tile_Add(6, TileUtil.None, 1); Terrain_Gravel.Tiles.Tile_Add(7, TileUtil.None, 1); //dirt centre brush Terrain_Dirt.Tiles.Tile_Add(53, TileUtil.None, 1); //grass snow centre brush Terrain_GrassSnow.Tiles.Tile_Add(23, TileUtil.None, 1); //gravel snow centre brush Terrain_GravelSnow.Tiles.Tile_Add(41, TileUtil.None, 1); //snow centre brush Terrain_Snow.Tiles.Tile_Add(64, TileUtil.None, 1); //concrete centre brush Terrain_Concrete.Tiles.Tile_Add(22, TileUtil.None, 1); //water centre brush Terrain_Water.Tiles.Tile_Add(17, TileUtil.None, 1); //gravel to gravel cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Gravel Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Gravel; NewBrushCliff.Terrain_Outer = Terrain_Gravel; NewBrushCliff.Tiles_Straight.Tile_Add(46, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Straight.Tile_Add(71, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(45, TileUtil.TopRight, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(45, TileUtil.BottomLeft, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //gravel snow to gravel cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Gravel Snow -> Gravel Cliff"; NewBrushCliff.Terrain_Inner = Terrain_GravelSnow; NewBrushCliff.Terrain_Outer = Terrain_Gravel; NewBrushCliff.Tiles_Straight.Tile_Add(29, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(9, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(42, TileUtil.BottomLeft, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //snow to gravel cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Snow -> Gravel Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Snow; NewBrushCliff.Terrain_Outer = Terrain_Gravel; NewBrushCliff.Tiles_Straight.Tile_Add(68, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(63, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(42, TileUtil.BottomLeft, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //gravel snow cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Gravel Snow Cliff"; NewBrushCliff.Terrain_Inner = Terrain_GravelSnow; NewBrushCliff.Terrain_Outer = Terrain_GravelSnow; NewBrushCliff.Tiles_Straight.Tile_Add(44, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(9, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(9, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //snow to gravel snow cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Snow -> Gravel Snow Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Snow; NewBrushCliff.Terrain_Outer = Terrain_GravelSnow; NewBrushCliff.Tiles_Straight.Tile_Add(78, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(63, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(9, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //snow to snow cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Snow -> Snow Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Snow; NewBrushCliff.Terrain_Outer = Terrain_Snow; NewBrushCliff.Tiles_Straight.Tile_Add(78, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(63, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(63, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrushCliff); //water to grass transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water -> Grass"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Grass; NewBrush.Tiles_Straight.Tile_Add(14, TileUtil.Bottom, 1); NewBrush.Tiles_Corner_In.Tile_Add(16, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(15, TileUtil.BottomLeft, 1); App.Painter_Rockies.AddBrush(NewBrush); //water to gravel transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water -> Gravel"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Gravel; NewBrush.Tiles_Straight.Tile_Add(31, TileUtil.Top, 1); NewBrush.Tiles_Corner_In.Tile_Add(32, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(33, TileUtil.TopLeft, 1); App.Painter_Rockies.AddBrush(NewBrush); //grass to gravel transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Grass -> Gravel"; NewBrush.Terrain_Inner = Terrain_Grass; NewBrush.Terrain_Outer = Terrain_Gravel; NewBrush.Tiles_Straight.Tile_Add(2, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(3, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(4, TileUtil.TopLeft, 1); App.Painter_Rockies.AddBrush(NewBrush); //grass to grass snow transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Grass -> Grass Snow"; NewBrush.Terrain_Inner = Terrain_Grass; NewBrush.Terrain_Outer = Terrain_GrassSnow; NewBrush.Tiles_Straight.Tile_Add(26, TileUtil.Top, 1); NewBrush.Tiles_Corner_In.Tile_Add(25, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(24, TileUtil.TopLeft, 1); App.Painter_Rockies.AddBrush(NewBrush); //grass to dirt transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Grass -> Dirt"; NewBrush.Terrain_Inner = Terrain_Grass; NewBrush.Terrain_Outer = Terrain_Dirt; NewBrush.Tiles_Straight.Tile_Add(34, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(35, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(36, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrush); //gravel snow to gravel transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Gravel Snow -> Gravel"; NewBrush.Terrain_Inner = Terrain_GravelSnow; NewBrush.Terrain_Outer = Terrain_Gravel; NewBrush.Tiles_Straight.Tile_Add(12, TileUtil.Bottom, 1); NewBrush.Tiles_Corner_In.Tile_Add(10, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(11, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrush); //snow to gravel snow transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Snow -> Gravel Snow"; NewBrush.Terrain_Inner = Terrain_Snow; NewBrush.Terrain_Outer = Terrain_GravelSnow; NewBrush.Tiles_Straight.Tile_Add(67, TileUtil.Bottom, 1); NewBrush.Tiles_Corner_In.Tile_Add(65, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(66, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrush); //concrete to dirt transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Concrete -> Dirt"; NewBrush.Terrain_Inner = Terrain_Concrete; NewBrush.Terrain_Outer = Terrain_Dirt; NewBrush.Tiles_Straight.Tile_Add(21, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(19, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(20, TileUtil.BottomRight, 1); App.Painter_Rockies.AddBrush(NewBrush); //gravel to dirt transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Gravel -> Dirt"; NewBrush.Terrain_Inner = Terrain_Gravel; NewBrush.Terrain_Outer = Terrain_Dirt; NewBrush.Tiles_Straight.Tile_Add(38, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(40, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(39, TileUtil.TopLeft, 1); App.Painter_Rockies.AddBrush(NewBrush); //road var Road_Road = new Road(); Road_Road.Name = "Road"; App.Painter_Rockies.AddRoad(Road_Road); //road brown NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Dirt; NewRoadBrush.Tile_TIntersection.Tile_Add(13, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(59, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(60, TileUtil.Left, 1); App.Painter_Rockies.AddBrush(NewRoadBrush); //track var Road_Track = new Road(); Road_Track.Name = "Track"; App.Painter_Rockies.AddRoad(Road_Track); //track brown NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Track; NewRoadBrush.Terrain = Terrain_Dirt; NewRoadBrush.Tile_TIntersection.Tile_Add(72, TileUtil.Right, 1); NewRoadBrush.Tile_Straight.Tile_Add(49, TileUtil.Top, 1); NewRoadBrush.Tile_Straight.Tile_Add(51, TileUtil.Top, 2); NewRoadBrush.Tile_Corner_In.Tile_Add(50, TileUtil.BottomRight, 1); NewRoadBrush.Tile_End.Tile_Add(52, TileUtil.Bottom, 1); App.Painter_Rockies.AddBrush(NewRoadBrush); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layers = new clsLayer[0]; DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount = 0; var NewLayer = default(clsLayer); NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Gravel; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Water; NewLayer.HeightMax = -1.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.Terrain = Terrain_Grass; NewLayer.HeightMax = 60.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[3] = true; NewLayer.Terrain = Terrain_GravelSnow; NewLayer.HeightMin = 150.0F; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 3; NewLayer.AvoidLayers[1] = true; NewLayer.Terrain = Terrain_Snow; NewLayer.HeightMin = 200.0F; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 3; NewLayer.AvoidLayers[4] = true; NewLayer.Terrain = Terrain_Snow; NewLayer.HeightMin = 150.0F; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 1.5F; NewLayer.Density = 0.45F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[2] = true; NewLayer.AvoidLayers[3] = true; NewLayer.Terrain = Terrain_GravelSnow; NewLayer.HeightMin = 0.0F; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; NewLayer.Scale = 1.5F; NewLayer.Density = 0.45F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetRockies.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.WithinLayer = 2; NewLayer.Terrain = Terrain_Dirt; NewLayer.HeightMin = 0.0F; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 1.0F; NewLayer.Density = 0.3F; }
public static void CreatePainterArizona() { CliffBrush NewBrushCliff; TransitionBrush NewBrush; RoadBrush NewRoadBrush; App.Painter_Arizona = new Painter(); //arizona var Terrain_Red = new Terrain(); Terrain_Red.Name = "Red"; App.Painter_Arizona.AddTerrain(Terrain_Red); var Terrain_Yellow = new Terrain(); Terrain_Yellow.Name = "Yellow"; App.Painter_Arizona.AddTerrain(Terrain_Yellow); var Terrain_Sand = new Terrain(); Terrain_Sand.Name = "Sand"; App.Painter_Arizona.AddTerrain(Terrain_Sand); var Terrain_Brown = new Terrain(); Terrain_Brown.Name = "Brown"; App.Painter_Arizona.AddTerrain(Terrain_Brown); var Terrain_Green = new Terrain(); Terrain_Green.Name = "Green"; App.Painter_Arizona.AddTerrain(Terrain_Green); var Terrain_Concrete = new Terrain(); Terrain_Concrete.Name = "Concrete"; App.Painter_Arizona.AddTerrain(Terrain_Concrete); var Terrain_Water = new Terrain(); Terrain_Water.Name = "Water"; App.Painter_Arizona.AddTerrain(Terrain_Water); //red centre brush Terrain_Red.Tiles.Tile_Add(48, TileUtil.None, 1); Terrain_Red.Tiles.Tile_Add(53, TileUtil.None, 1); Terrain_Red.Tiles.Tile_Add(54, TileUtil.None, 1); Terrain_Red.Tiles.Tile_Add(76, TileUtil.None, 1); //yellow centre brushTerrain_yellow Terrain_Yellow.Tiles.Tile_Add(9, TileUtil.None, 1); Terrain_Yellow.Tiles.Tile_Add(11, TileUtil.None, 1); //sand centre brush Terrain_Sand.Tiles.Tile_Add(12, TileUtil.None, 1); //brown centre brush Terrain_Brown.Tiles.Tile_Add(5, TileUtil.None, 1); Terrain_Brown.Tiles.Tile_Add(6, TileUtil.None, 1); Terrain_Brown.Tiles.Tile_Add(7, TileUtil.None, 1); Terrain_Brown.Tiles.Tile_Add(8, TileUtil.None, 1); //green centre brush Terrain_Green.Tiles.Tile_Add(23, TileUtil.None, 1); //concrete centre brush Terrain_Concrete.Tiles.Tile_Add(22, TileUtil.None, 1); //water centre brush Terrain_Water.Tiles.Tile_Add(17, TileUtil.None, 1); //red cliff brush NewBrushCliff = new CliffBrush(); NewBrushCliff.Name = "Red Cliff"; NewBrushCliff.Terrain_Inner = Terrain_Red; NewBrushCliff.Terrain_Outer = Terrain_Red; NewBrushCliff.Tiles_Straight.Tile_Add(46, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Straight.Tile_Add(71, TileUtil.Bottom, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(45, TileUtil.TopRight, 1); NewBrushCliff.Tiles_Corner_In.Tile_Add(75, TileUtil.TopLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(45, TileUtil.BottomLeft, 1); NewBrushCliff.Tiles_Corner_Out.Tile_Add(75, TileUtil.BottomRight, 1); App.Painter_Arizona.AddBrush(NewBrushCliff); //water to sand transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water->Sand"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Sand; NewBrush.Tiles_Straight.Tile_Add(14, TileUtil.Bottom, 1); NewBrush.Tiles_Corner_In.Tile_Add(16, TileUtil.BottomLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(15, TileUtil.BottomLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //water to green transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Water->Green"; NewBrush.Terrain_Inner = Terrain_Water; NewBrush.Terrain_Outer = Terrain_Green; NewBrush.Tiles_Straight.Tile_Add(31, TileUtil.Top, 1); NewBrush.Tiles_Corner_In.Tile_Add(33, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(32, TileUtil.TopLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //yellow to red transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Yellow->Red"; NewBrush.Terrain_Inner = Terrain_Yellow; NewBrush.Terrain_Outer = Terrain_Red; NewBrush.Tiles_Straight.Tile_Add(27, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(28, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(29, TileUtil.BottomRight, 1); App.Painter_Arizona.AddBrush(NewBrush); //sand to red transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Sand->Red"; NewBrush.Terrain_Inner = Terrain_Sand; NewBrush.Terrain_Outer = Terrain_Red; NewBrush.Tiles_Straight.Tile_Add(43, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(42, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(41, TileUtil.TopLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //sand to yellow transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Sand->Yellow"; NewBrush.Terrain_Inner = Terrain_Sand; NewBrush.Terrain_Outer = Terrain_Yellow; NewBrush.Tiles_Straight.Tile_Add(10, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(1, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(0, TileUtil.TopLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //brown to red transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Brown->Red"; NewBrush.Terrain_Inner = Terrain_Brown; NewBrush.Terrain_Outer = Terrain_Red; NewBrush.Tiles_Straight.Tile_Add(34, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(36, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(35, TileUtil.TopLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //brown to yellow transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Brown->Yellow"; NewBrush.Terrain_Inner = Terrain_Brown; NewBrush.Terrain_Outer = Terrain_Yellow; NewBrush.Tiles_Straight.Tile_Add(38, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(39, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(40, TileUtil.BottomRight, 1); App.Painter_Arizona.AddBrush(NewBrush); //brown to sand transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Brown->Sand"; NewBrush.Terrain_Inner = Terrain_Brown; NewBrush.Terrain_Outer = Terrain_Sand; NewBrush.Tiles_Straight.Tile_Add(2, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(3, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(4, TileUtil.BottomRight, 1); App.Painter_Arizona.AddBrush(NewBrush); //brown to green transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Brown->Green"; NewBrush.Terrain_Inner = Terrain_Brown; NewBrush.Terrain_Outer = Terrain_Green; NewBrush.Tiles_Straight.Tile_Add(24, TileUtil.Left, 1); NewBrush.Tiles_Corner_In.Tile_Add(26, TileUtil.TopLeft, 1); NewBrush.Tiles_Corner_Out.Tile_Add(25, TileUtil.TopLeft, 1); App.Painter_Arizona.AddBrush(NewBrush); //concrete to red transition brush NewBrush = new TransitionBrush(); NewBrush.Name = "Concrete->Red"; NewBrush.Terrain_Inner = Terrain_Concrete; NewBrush.Terrain_Outer = Terrain_Red; NewBrush.Tiles_Straight.Tile_Add(21, TileUtil.Right, 1); NewBrush.Tiles_Corner_In.Tile_Add(19, TileUtil.BottomRight, 1); NewBrush.Tiles_Corner_Out.Tile_Add(20, TileUtil.BottomRight, 1); App.Painter_Arizona.AddBrush(NewBrush); var Road_Road = new Road(); Road_Road = new Road(); Road_Road.Name = "Road"; App.Painter_Arizona.AddRoad(Road_Road); var Road_Track = new Road(); Road_Track = new Road(); Road_Track.Name = "Track"; App.Painter_Arizona.AddRoad(Road_Track); //road NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Road; NewRoadBrush.Terrain = Terrain_Red; NewRoadBrush.Tile_TIntersection.Tile_Add(57, TileUtil.Bottom, 1); NewRoadBrush.Tile_Straight.Tile_Add(59, TileUtil.Left, 1); NewRoadBrush.Tile_End.Tile_Add(47, TileUtil.Left, 1); App.Painter_Arizona.AddBrush(NewRoadBrush); //track NewRoadBrush = new RoadBrush(); NewRoadBrush.Road = Road_Track; NewRoadBrush.Terrain = Terrain_Red; NewRoadBrush.Tile_CrossIntersection.Tile_Add(73, TileUtil.None, 1); NewRoadBrush.Tile_TIntersection.Tile_Add(72, TileUtil.Right, 1); NewRoadBrush.Tile_Straight.Tile_Add(49, TileUtil.Top, 1); NewRoadBrush.Tile_Straight.Tile_Add(51, TileUtil.Top, 2); NewRoadBrush.Tile_Corner_In.Tile_Add(50, TileUtil.BottomRight, 1); NewRoadBrush.Tile_End.Tile_Add(52, TileUtil.Bottom, 1); App.Painter_Arizona.AddBrush(NewRoadBrush); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layers = new clsLayer[0]; DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount = 0; var NewLayer = default(clsLayer); NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Red; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.Terrain = Terrain_Sand; NewLayer.HeightMax = -1.0F; //signals water distribution NewLayer.SlopeMax = -1.0F; //signals water distribution NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.WithinLayer = 1; NewLayer.Terrain = Terrain_Water; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 0.0F; NewLayer.Density = 1.0F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.Terrain = Terrain_Brown; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; //signals to use cliff angle NewLayer.Scale = 3.0F; NewLayer.Density = 0.35F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.AvoidLayers[3] = true; NewLayer.Terrain = Terrain_Yellow; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = -1.0F; //signals to use cliff angle NewLayer.Scale = 2.0F; NewLayer.Density = 0.6F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.WithinLayer = 4; NewLayer.Terrain = Terrain_Sand; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 1.0F; NewLayer.Density = 0.5F; NewLayer = new clsLayer(); DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.Layer_Insert(DefaultGenerator.Generator_TilesetArizona.OldTextureLayers.LayerCount, NewLayer); NewLayer.AvoidLayers[1] = true; NewLayer.WithinLayer = 3; NewLayer.Terrain = Terrain_Green; NewLayer.HeightMax = 255.0F; NewLayer.SlopeMax = (float)MathUtil.RadOf90Deg; NewLayer.Scale = 2.0F; NewLayer.Density = 0.4F; }
private void ToolPerformTile() { var PainterBrushNum = 0; var A = 0; for ( PainterBrushNum = 0; PainterBrushNum <= Painter.TerrainCount - 1; PainterBrushNum++ ) { PainterTerrainA = Painter.Terrains[PainterBrushNum]; for ( A = 0; A <= PainterTerrainA.Tiles.TileCount - 1; A++ ) { PainterTexture = PainterTerrainA.Tiles.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } } for ( PainterBrushNum = 0; PainterBrushNum <= Painter.TransitionBrushCount - 1; PainterBrushNum++ ) { PainterTerrainA = Painter.TransitionBrushes[PainterBrushNum].Terrain_Inner; PainterTerrainB = Painter.TransitionBrushes[PainterBrushNum].Terrain_Outer; for ( A = 0; A <= Painter.TransitionBrushes[PainterBrushNum].Tiles_Straight.TileCount - 1; A++ ) { PainterTexture = Painter.TransitionBrushes[PainterBrushNum].Tiles_Straight.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.DirectionsOnSameSide(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainB.Num]++; } else { TerrainCount[PainterTerrainA.Num]++; } } } for ( A = 0; A <= Painter.TransitionBrushes[PainterBrushNum].Tiles_Corner_In.TileCount - 1; A++ ) { PainterTexture = Painter.TransitionBrushes[PainterBrushNum].Tiles_Corner_In.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.IdenticalTileDirections(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainB.Num]++; } else { TerrainCount[PainterTerrainA.Num]++; } } } for ( A = 0; A <= Painter.TransitionBrushes[PainterBrushNum].Tiles_Corner_Out.TileCount - 1; A++ ) { PainterTexture = Painter.TransitionBrushes[PainterBrushNum].Tiles_Corner_Out.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { OppositeDirection = PainterTexture.Direction; OppositeDirection.FlipX(); OppositeDirection.FlipY(); TileUtil.RotateDirection(OppositeDirection, Texture.Orientation, ref ResultDirection); if ( TileUtil.IdenticalTileDirections(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainA.Num]++; } else { TerrainCount[PainterTerrainB.Num]++; } } } } for ( PainterBrushNum = 0; PainterBrushNum <= Painter.CliffBrushCount - 1; PainterBrushNum++ ) { PainterTerrainA = Painter.CliffBrushes[PainterBrushNum].Terrain_Inner; PainterTerrainB = Painter.CliffBrushes[PainterBrushNum].Terrain_Outer; for ( A = 0; A <= Painter.CliffBrushes[PainterBrushNum].Tiles_Straight.TileCount - 1; A++ ) { PainterTexture = Painter.CliffBrushes[PainterBrushNum].Tiles_Straight.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.DirectionsOnSameSide(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainB.Num]++; } else { TerrainCount[PainterTerrainA.Num]++; } } } for ( A = 0; A <= Painter.CliffBrushes[PainterBrushNum].Tiles_Corner_In.TileCount - 1; A++ ) { PainterTexture = Painter.CliffBrushes[PainterBrushNum].Tiles_Corner_In.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.IdenticalTileDirections(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainA.Num]++; } else { TerrainCount[PainterTerrainB.Num]++; } } } for ( A = 0; A <= Painter.CliffBrushes[PainterBrushNum].Tiles_Corner_Out.TileCount - 1; A++ ) { PainterTexture = Painter.CliffBrushes[PainterBrushNum].Tiles_Corner_Out.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { OppositeDirection = PainterTexture.Direction; OppositeDirection.FlipX(); OppositeDirection.FlipY(); TileUtil.RotateDirection(OppositeDirection, Texture.Orientation, ref ResultDirection); if ( TileUtil.IdenticalTileDirections(VertexDirection, ResultDirection) ) { TerrainCount[PainterTerrainA.Num]++; } else { TerrainCount[PainterTerrainB.Num]++; } } } } for ( PainterBrushNum = 0; PainterBrushNum <= Painter.RoadBrushCount - 1; PainterBrushNum++ ) { PainterTerrainA = Painter.RoadBrushes[PainterBrushNum].Terrain; for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_Corner_In.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_Corner_In.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_CrossIntersection.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_CrossIntersection.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_End.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_End.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_Straight.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_Straight.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_TIntersection.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_TIntersection.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TerrainCount[PainterTerrainA.Num]++; } } } }
protected void ToolPerformTile() { var PainterBrushNum = 0; var A = 0; for ( PainterBrushNum = 0; PainterBrushNum <= Painter.RoadBrushCount - 1; PainterBrushNum++ ) { PainterRoad = Painter.RoadBrushes[PainterBrushNum].Road; PainterTerrain = Painter.RoadBrushes[PainterBrushNum].Terrain; for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_Corner_In.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_Corner_In.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.DirectionsOnSameSide(SideDirection, ResultDirection) ) { RoadCount[PainterRoad.Num]++; } } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_CrossIntersection.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_CrossIntersection.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { RoadCount[PainterRoad.Num]++; } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_End.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_End.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.IdenticalTileDirections(SideDirection, ResultDirection) ) { RoadCount[PainterRoad.Num]++; } } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_Straight.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_Straight.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( TileUtil.DirectionsAreInLine(SideDirection, ResultDirection) ) { RoadCount[PainterRoad.Num]++; } } } for ( A = 0; A <= Painter.RoadBrushes[PainterBrushNum].Tile_TIntersection.TileCount - 1; A++ ) { PainterTexture = Painter.RoadBrushes[PainterBrushNum].Tile_TIntersection.Tiles[A]; if ( PainterTexture.TextureNum == Texture.TextureNum ) { TileUtil.RotateDirection(PainterTexture.Direction, Texture.Orientation, ref ResultDirection); if ( !TileUtil.DirectionsOnSameSide(SideDirection, ResultDirection) ) { RoadCount[PainterRoad.Num]++; } } } } }