Esempio n. 1
0
        //mxd
        protected void ClearFields(IEnumerable <string> keys, string undodescription, string resultdescription)
        {
            if (!General.Map.UDMF)
            {
                return;
            }

            mode.CreateUndo(undodescription);
            mode.SetActionResult(resultdescription);
            level.sector.Fields.BeforeFieldsChange();

            foreach (string key in keys)
            {
                if (level.sector.Fields.ContainsKey(key))
                {
                    level.sector.Fields.Remove(key);
                    level.sector.UpdateNeeded = true;
                }
            }

            if (level.sector.UpdateNeeded)
            {
                if (level.sector != Sector.Sector && mode.VisualSectorExists(level.sector))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                    vs.UpdateSectorGeometry(false);
                }
                else
                {
                    Sector.UpdateSectorGeometry(false);
                }
            }
        }
Esempio n. 2
0
 // Copy properties
 public virtual void OnCopyProperties()
 {
     BuilderPlug.Me.CopiedThingProps = new ThingProperties(Thing);
     mode.SetActionResult("Copied thing properties.");
 }
Esempio n. 3
0
        // Flood-fill textures
        public virtual void OnTextureFloodfill()
        {
            if (BuilderPlug.Me.CopiedFlat != null)
            {
                string oldtexture     = GetTextureName();
                long   oldtexturelong = Lump.MakeLongName(oldtexture);
                string newtexture     = BuilderPlug.Me.CopiedFlat;
                if (newtexture != oldtexture)
                {
                    // Get the texture
                    ImageData newtextureimage = General.Map.Data.GetFlatImage(newtexture);
                    if (newtextureimage != null)
                    {
                        bool fillceilings = (this is VisualCeiling);

                        if (fillceilings)
                        {
                            mode.CreateUndo("Flood-fill ceilings with " + newtexture);
                            mode.SetActionResult("Flood-filled ceilings with " + newtexture + ".");
                        }
                        else
                        {
                            mode.CreateUndo("Flood-fill floors with " + newtexture);
                            mode.SetActionResult("Flood-filled floors with " + newtexture + ".");
                        }

                        mode.Renderer.SetCrosshairBusy(true);
                        General.Interface.RedrawDisplay();

                        if (mode.IsSingleSelection)
                        {
                            // Clear all marks, this will align everything it can
                            General.Map.Map.ClearMarkedSectors(false);
                        }
                        else
                        {
                            // Limit the alignment to selection only
                            General.Map.Map.ClearMarkedSectors(true);
                            List <Sector> sectors = mode.GetSelectedSectors();
                            foreach (Sector s in sectors)
                            {
                                s.Marked = false;
                            }
                        }

                        // Do the fill
                        Tools.FloodfillFlats(this.Sector.Sector, fillceilings, oldtexturelong, newtextureimage, false);

                        // Get the changed sectors
                        List <Sector> changes = General.Map.Map.GetMarkedSectors(true);
                        foreach (Sector s in changes)
                        {
                            // Update the visual sector
                            if (mode.VisualSectorExists(s))
                            {
                                BaseVisualSector vs = (mode.GetVisualSector(s) as BaseVisualSector);
                                if (fillceilings)
                                {
                                    vs.Ceiling.Setup();
                                }
                                else
                                {
                                    vs.Floor.Setup();
                                }
                            }
                        }

                        General.Map.Data.UpdateUsedTextures();
                        mode.Renderer.SetCrosshairBusy(false);
                        mode.ShowTargetInfo();
                    }
                }
            }
        }
 // Copy properties
 public void OnCopyProperties()
 {
     BuilderPlug.Me.CopiedVertexProps = new VertexProperties(vertex);
     mode.SetActionResult("Copied vertex properties.");
 }
        //mxd. Delete thing
        public void OnDelete()
        {
            mode.CreateUndo("Delete thing");
            mode.SetActionResult("Deleted a thing.");

            this.Thing.Fields.BeforeFieldsChange();
            this.Thing.Dispose();
            this.Dispose();

            General.Map.IsChanged = true;
            General.Map.ThingsFilter.Update();
        }
Esempio n. 6
0
        // Insert middle texture
        public virtual void OnInsert()
        {
            // No middle texture yet?
            if (!Sidedef.MiddleRequired() && (string.IsNullOrEmpty(Sidedef.MiddleTexture) || (Sidedef.MiddleTexture[0] == '-')))
            {
                // Make it now
                mode.CreateUndo("Create middle texture");
                mode.SetActionResult("Created middle texture.");
                General.Settings.FindDefaultDrawSettings();
                Sidedef.SetTextureMid(General.Settings.DefaultTexture);

                // Update
                Sector.Changed = true;

                // Other side as well
                if (string.IsNullOrEmpty(Sidedef.Other.MiddleTexture) || (Sidedef.Other.MiddleTexture[0] == '-'))
                {
                    Sidedef.Other.SetTextureMid(General.Settings.DefaultTexture);

                    // Update
                    VisualSector othersector = mode.GetVisualSector(Sidedef.Other.Sector);
                    if (othersector is BaseVisualSector)
                    {
                        (othersector as BaseVisualSector).Changed = true;
                    }
                }
            }
        }