Exemple #1
0
 public ctrlBrush(clsBrush NewBrush)
 {
     this.InitializeComponent();
     this.Brush = NewBrush;
     this.UpdateControlValues();
     this.nudRadius.ValueChanged += new EventHandler(this.nudRadius_Changed);
     this.nudRadius.Leave += new EventHandler(this.nudRadius_Changed);
 }
Exemple #2
0
 public void Apply_Height_Set(clsBrush Brush, byte Height)
 {
     clsMouseOver.clsOverTerrain mouseOverTerrain = this.GetMouseOverTerrain();
     if (mouseOverTerrain != null)
     {
         clsMap.clsApplyHeightSet tool = new clsMap.clsApplyHeightSet {
             Map = this.Map,
             Height = Height
         };
         Brush.PerformActionMapVertices(tool, mouseOverTerrain.Vertex);
         this.Map.Update();
         this.MapView.DrawViewLater();
     }
 }
Exemple #3
0
        private clsResult FinishTextures()
        {
            int num;
            clsBrush.sPosNum num2;
            clsResult result2 = new clsResult("");
            if (!this.cbxMasterTexture.Checked)
            {
                switch (this.cboTileset.SelectedIndex)
                {
                    case 0:
                        this.Generator.Map.Tileset = modProgram.Tileset_Arizona;
                        this.Generator.GenerateTileset = modGenerator.Generator_TilesetArizona;
                        goto Label_023D;

                    case 1:
                        this.Generator.Map.Tileset = modProgram.Tileset_Urban;
                        this.Generator.GenerateTileset = modGenerator.Generator_TilesetUrban;
                        goto Label_023D;

                    case 2:
                        this.Generator.Map.Tileset = modProgram.Tileset_Rockies;
                        this.Generator.GenerateTileset = modGenerator.Generator_TilesetRockies;
                        goto Label_023D;
                }
                result2.ProblemAdd("Error: bad tileset selection.");
                this.btnGenerateLayout.Enabled = true;
                return result2;
            }
            switch (this.cboTileset.SelectedIndex)
            {
                case 0:
                    this.Generator.GenerateTileset = modGenerator.Generator_TilesetArizona;
                    modGenerator.TerrainStyle_Arizona.Watermap = this.Generator.GetWaterMap();
                    modGenerator.TerrainStyle_Arizona.LevelCount = this.Generator.LevelCount;
                    this.Generator.Map.GenerateMasterTerrain(ref modGenerator.TerrainStyle_Arizona);
                    modGenerator.TerrainStyle_Arizona.Watermap = null;
                    break;

                case 1:
                    this.Generator.GenerateTileset = modGenerator.Generator_TilesetUrban;
                    modGenerator.TerrainStyle_Urban.Watermap = this.Generator.GetWaterMap();
                    modGenerator.TerrainStyle_Urban.LevelCount = this.Generator.LevelCount;
                    this.Generator.Map.GenerateMasterTerrain(ref modGenerator.TerrainStyle_Urban);
                    modGenerator.TerrainStyle_Urban.Watermap = null;
                    break;

                case 2:
                    this.Generator.GenerateTileset = modGenerator.Generator_TilesetRockies;
                    modGenerator.TerrainStyle_Rockies.Watermap = this.Generator.GetWaterMap();
                    modGenerator.TerrainStyle_Rockies.LevelCount = this.Generator.LevelCount;
                    this.Generator.Map.GenerateMasterTerrain(ref modGenerator.TerrainStyle_Rockies);
                    modGenerator.TerrainStyle_Rockies.Watermap = null;
                    break;

                default:
                    result2.ProblemAdd("Error: bad tileset selection.");
                    this.btnGenerateLayout.Enabled = true;
                    return result2;
            }
            this.Generator.Map.TileType_Reset();
            this.Generator.Map.SetPainterToDefaults();
            goto Label_054A;
            Label_023D:
            this.Generator.Map.TileType_Reset();
            this.Generator.Map.SetPainterToDefaults();
            double num3 = Math.Atan((255.0 * this.Generator.Map.HeightMultiplier) / ((2.0 * (this.Generator.LevelCount - 1.0)) * 128.0)) - 0.017453292519943295;
            clsBrush brush = new clsBrush(Math.Max(this.Generator.Map.Terrain.TileSize.X, this.Generator.Map.Terrain.TileSize.Y) * 1.1, clsBrush.enumShape.Square);
            clsMap.clsApplyCliff tool = new clsMap.clsApplyCliff {
                Map = this.Generator.Map,
                Angle = num3,
                SetTris = true
            };
            num2.Normal = new modMath.sXY_int((int) Math.Round(((double) (((double) this.Generator.Map.Terrain.TileSize.X) / 2.0))), (int) Math.Round(((double) (((double) this.Generator.Map.Terrain.TileSize.Y) / 2.0))));
            num2.Alignment = num2.Normal;
            brush.PerformActionMapTiles(tool, num2);
            clsBooleanMap exterior = new clsBooleanMap();
            clsBooleanMap map = new clsBooleanMap();
            exterior = this.Generator.GetWaterMap();
            clsGeneratorTileset generateTileset = this.Generator.GenerateTileset;
            bool[] flagArray2 = new bool[(generateTileset.OldTextureLayers.LayerCount - 1) + 1];
            bool[] flagArray = new bool[(generateTileset.OldTextureLayers.LayerCount - 1) + 1];
            int num6 = generateTileset.OldTextureLayers.LayerCount - 1;
            for (num = 0; num <= num6; num++)
            {
                modProgram.sLayerList.clsLayer layer = generateTileset.OldTextureLayers.Layers[num];
                layer.Terrainmap = this.Generator.Map.GenerateTerrainMap(layer.Scale, layer.Density);
                if (layer.SlopeMax < 0f)
                {
                    layer.SlopeMax = (float) (num3 - 0.017453292519943295);
                    if (layer.HeightMax < 0f)
                    {
                        layer.HeightMax = 255f;
                        map.Within(layer.Terrainmap, exterior);
                        layer.Terrainmap.ValueData = map.ValueData;
                        map.ValueData = new clsBooleanMap.clsValueData();
                        flagArray[num] = true;
                    }
                    flagArray2[num] = true;
                }
                layer = null;
            }
            this.Generator.Map.MapTexturer(ref generateTileset.OldTextureLayers);
            int num7 = generateTileset.OldTextureLayers.LayerCount - 1;
            for (num = 0; num <= num7; num++)
            {
                modProgram.sLayerList.clsLayer layer2 = generateTileset.OldTextureLayers.Layers[num];
                layer2.Terrainmap = null;
                if (flagArray2[num])
                {
                    layer2.SlopeMax = -1f;
                }
                if (flagArray[num])
                {
                    layer2.HeightMax = -1f;
                }
                layer2 = null;
            }
            generateTileset = null;
            Label_054A:
            this.Generator.Map.LevelWater();
            this.Generator.Map.WaterTriCorrection();
            this.Generator.Map.SectorGraphicsChanges.SetAllChanged();
            this.Generator.Map.SectorUnitHeightsChanges.SetAllChanged();
            this.Generator.Map.Update();
            this.Generator.Map.UndoStepCreate("Generated Textures");
            if (this.Generator.Map == this._Owner.MainMap)
            {
                modMain.frmMainInstance.PainterTerrains_Refresh(-1, -1);
                modMain.frmMainInstance.MainMapTilesetChanged();
            }
            return result2;
        }