public void Apply_Height_Set(clsBrush brush, byte height) { var mouseOverTerrain = GetMouseOverTerrain(); if ( mouseOverTerrain == null ) { return; } var applyHeightSet = new clsApplyHeightSet(); applyHeightSet.Map = Map; applyHeightSet.Height = height; brush.PerformActionMapVertices(applyHeightSet, mouseOverTerrain.Vertex); Map.Update(); MapViewControl.DrawViewLater(); }
private clsResult FinishTextures() { clsResult ReturnResult = new clsResult(""); if ( cbxMasterTexture.Checked ) { switch ( cboTileset.SelectedIndex ) { case 0: Generator.GenerateTileset = DefaultGenerator.Generator_TilesetArizona; DefaultGenerator.TerrainStyle_Arizona.Watermap = Generator.GetWaterMap(); DefaultGenerator.TerrainStyle_Arizona.LevelCount = Generator.LevelCount; Generator.Map.GenerateMasterTerrain(DefaultGenerator.TerrainStyle_Arizona); DefaultGenerator.TerrainStyle_Arizona.Watermap = null; break; case 1: Generator.GenerateTileset = DefaultGenerator.Generator_TilesetUrban; DefaultGenerator.TerrainStyle_Urban.Watermap = Generator.GetWaterMap(); DefaultGenerator.TerrainStyle_Urban.LevelCount = Generator.LevelCount; Generator.Map.GenerateMasterTerrain(DefaultGenerator.TerrainStyle_Urban); DefaultGenerator.TerrainStyle_Urban.Watermap = null; break; case 2: Generator.GenerateTileset = DefaultGenerator.Generator_TilesetRockies; DefaultGenerator.TerrainStyle_Rockies.Watermap = Generator.GetWaterMap(); DefaultGenerator.TerrainStyle_Rockies.LevelCount = Generator.LevelCount; Generator.Map.GenerateMasterTerrain(DefaultGenerator.TerrainStyle_Rockies); DefaultGenerator.TerrainStyle_Rockies.Watermap = null; break; default: ReturnResult.ProblemAdd("Error: bad tileset selection."); btnGenerateLayout.Enabled = true; return ReturnResult; } Generator.Map.TileType_Reset(); Generator.Map.SetPainterToDefaults(); } else { switch ( cboTileset.SelectedIndex ) { case 0: Generator.Map.Tileset = App.Tileset_Arizona; Generator.GenerateTileset = DefaultGenerator.Generator_TilesetArizona; break; case 1: Generator.Map.Tileset = App.Tileset_Urban; Generator.GenerateTileset = DefaultGenerator.Generator_TilesetUrban; break; case 2: Generator.Map.Tileset = App.Tileset_Rockies; Generator.GenerateTileset = DefaultGenerator.Generator_TilesetRockies; break; default: ReturnResult.ProblemAdd("Error: bad tileset selection."); btnGenerateLayout.Enabled = true; return ReturnResult; } Generator.Map.TileType_Reset(); Generator.Map.SetPainterToDefaults(); double CliffAngle = Math.Atan(255.0D * Generator.Map.HeightMultiplier / (2.0D * (Generator.LevelCount - 1.0D) * App.TerrainGridSpacing)) - MathUtil.RadOf1Deg; clsBrush tmpBrush = new clsBrush((Math.Max(Generator.Map.Terrain.TileSize.X, Generator.Map.Terrain.TileSize.Y)) * 1.1D, clsBrush.enumShape.Square); clsMap.clsApplyCliff ApplyCliff = new clsMap.clsApplyCliff(); ApplyCliff.Map = Generator.Map; ApplyCliff.Angle = CliffAngle; ApplyCliff.SetTris = true; clsBrush.sPosNum Alignments = new clsBrush.sPosNum(); Alignments.Normal = new sXY_int((int)(Conversion.Int(Generator.Map.Terrain.TileSize.X / 2.0D)), (int)(Conversion.Int(Generator.Map.Terrain.TileSize.Y / 2.0D))); Alignments.Alignment = Alignments.Normal; tmpBrush.PerformActionMapTiles(ApplyCliff, Alignments); bool[] RevertSlope = null; bool[] RevertHeight = null; clsBooleanMap WaterMap = new clsBooleanMap(); clsBooleanMap bmTemp = new clsBooleanMap(); int A = 0; WaterMap = Generator.GetWaterMap(); RevertSlope = new bool[Generator.GenerateTileset.OldTextureLayers.LayerCount]; RevertHeight = new bool[Generator.GenerateTileset.OldTextureLayers.LayerCount]; for ( A = 0; A <= Generator.GenerateTileset.OldTextureLayers.LayerCount - 1; A++ ) { App.sLayerList.clsLayer with_2 = Generator.GenerateTileset.OldTextureLayers.Layers[A]; with_2.Terrainmap = Generator.Map.GenerateTerrainMap(with_2.Scale, with_2.Density); if ( with_2.SlopeMax < 0.0F ) { with_2.SlopeMax = (float)(CliffAngle - MathUtil.RadOf1Deg); if ( with_2.HeightMax < 0.0F ) { with_2.HeightMax = 255.0F; bmTemp.Within(with_2.Terrainmap, WaterMap); with_2.Terrainmap.ValueData = bmTemp.ValueData; bmTemp.ValueData = new clsBooleanMap.clsValueData(); RevertHeight[A] = true; } RevertSlope[A] = true; } } Generator.Map.MapTexturer(Generator.GenerateTileset.OldTextureLayers); for ( A = 0; A <= Generator.GenerateTileset.OldTextureLayers.LayerCount - 1; A++ ) { App.sLayerList.clsLayer with_3 = Generator.GenerateTileset.OldTextureLayers.Layers[A]; with_3.Terrainmap = null; if ( RevertSlope[A] ) { with_3.SlopeMax = -1.0F; } if ( RevertHeight[A] ) { with_3.HeightMax = -1.0F; } } } Generator.Map.LevelWater(); Generator.Map.WaterTriCorrection(); Generator.Map.SectorGraphicsChanges.SetAllChanged(); Generator.Map.SectorUnitHeightsChanges.SetAllChanged(); Generator.Map.Update(); Generator.Map.UndoStepCreate("Generated Textures"); if ( Generator.Map == _Owner.MainMap ) { Program.frmMainInstance.PainterTerrains_Refresh(-1, -1); Program.frmMainInstance.MainMapTilesetChanged(); } return ReturnResult; }
public void Apply_Height_Set(clsBrush Brush, byte Height) { clsMouseOver.clsOverTerrain MouseOverTerrain = GetMouseOverTerrain(); if ( MouseOverTerrain == null ) { return; } clsMap.clsApplyHeightSet ApplyHeightSet = new clsMap.clsApplyHeightSet(); ApplyHeightSet.Map = Map; ApplyHeightSet.Height = Height; Brush.PerformActionMapVertices(ApplyHeightSet, MouseOverTerrain.Vertex); Map.Update(); MapViewControl.DrawViewLater(); }