Esempio n. 1
0
 //mxd. Sector brightness change
 public override void OnChangeTargetBrightness(bool up)
 {
     if (level != null)
     {
         // This floor is part of 3D-floor
         if (level.sector != Sector.Sector)
         {
             BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
             vs.Floor.OnChangeTargetBrightness(up);
             vs.UpdateSectorGeometry(true);
         }
         // This is actual floor of a sector with extrafloors
         else if (Sector.ExtraFloors.Count > 0 && !Sector.ExtraFloors[0].ExtraFloor.Floor.restrictlighting && !Sector.ExtraFloors[0].ExtraFloor.Floor.disablelighting)
         {
             Sector.ExtraFloors[0].OnChangeTargetBrightness(up);
         }
         else
         {
             base.OnChangeTargetBrightness(up);
         }
     }
     else
     {
         base.OnChangeTargetBrightness(up);
     }
 }
Esempio n. 2
0
        // Thisvirtuals the secotr and neightbours if needed
        public void UpdateSectorGeometry(bool includeneighbours)
        {
            // Rebuild sector
            this.Changed = true;

            // Go for all things in this sector
            foreach (Thing t in General.Map.Map.Things)
            {
                if (t.Sector == this.Sector)
                {
                    if (mode.VisualThingExists(t))
                    {
                        // Update thing
                        BaseVisualThing vt = (mode.GetVisualThing(t) as BaseVisualThing);
                        vt.Changed = true;
                    }
                }
            }

            if (includeneighbours)
            {
                // Also rebuild surrounding sectors, because outside sidedefs may need to be adjusted
                foreach (Sidedef sd in this.Sector.Sidedefs)
                {
                    if (sd.Other != null)
                    {
                        if (mode.VisualSectorExists(sd.Other.Sector))
                        {
                            BaseVisualSector bvs = (BaseVisualSector)mode.GetVisualSector(sd.Other.Sector);
                            bvs.Changed = true;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        // This resets this sector data and all sectors that require updating after me

        /*public void Reset()
         * {
         *      if(isupdating) return;
         *      isupdating = true;
         *
         *      // This is set to false so that this sector is rebuilt the next time it is needed!
         *      updated = false;
         *
         *      // The visual sector associated is now outdated
         *      if(mode.VisualSectorExists(sector))
         *      {
         *              BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector);
         *              vs.UpdateSectorGeometry(false);
         *      }
         *
         *      // Also reset the sectors that depend on this sector
         *      foreach(KeyValuePair<Sector, bool> s in updatesectors)
         *      {
         *              SectorData sd = mode.GetSectorData(s.Key);
         *              sd.Reset();
         *      }
         *
         *      isupdating = false;
         * }*/

        //mxd. This marks this sector data and all sector datas that require updating as not updated
        public void Reset(bool resetneighbours)
        {
            if (isupdating)
            {
                return;
            }
            isupdating = true;

            // This is set to false so that this sector is rebuilt the next time it is needed!
            updated = false;

            // The visual sector associated is now outdated
            if (mode.VisualSectorExists(sector))
            {
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector);
                vs.Changed = true;
            }

            // Reset the sectors that depend on this sector
            if (resetneighbours)
            {
                foreach (KeyValuePair <Sector, bool> s in updatesectors)
                {
                    SectorData sd = mode.GetSectorDataEx(s.Key);
                    if (sd != null)
                    {
                        sd.Reset(s.Value);
                    }
                }
            }

            isupdating = false;
        }
Esempio n. 4
0
        // This updates the VisualSectors and VisualThings that have their Changed property set
        private void UpdateChangedObjects()
        {
            foreach (KeyValuePair <Sector, VisualSector> vs in allsectors)
            {
                if (vs.Value != null)
                {
                    BaseVisualSector bvs = (BaseVisualSector)vs.Value;
                    if (bvs.Changed)
                    {
                        bvs.Rebuild();
                    }
                }
            }

            foreach (KeyValuePair <Thing, VisualThing> vt in allthings)
            {
                if (vt.Value != null)
                {
                    BaseVisualThing bvt = (BaseVisualThing)vt.Value;
                    if (bvt.Changed)
                    {
                        bvt.Rebuild();
                    }
                }
            }
        }
Esempio n. 5
0
        // This sets the Lower Unpegged flag
        public virtual void ApplyLowerUnpegged(bool set)
        {
            if (!set)
            {
                // Remove flag
                mode.CreateUndo("Remove lower-unpegged setting");
                mode.SetActionResult("Removed lower-unpegged setting.");
                this.Sidedef.Line.SetFlag(General.Map.Config.LowerUnpeggedFlag, false);
            }
            else
            {
                // Add flag
                mode.CreateUndo("Set lower-unpegged setting");
                mode.SetActionResult("Set lower-unpegged setting.");
                this.Sidedef.Line.SetFlag(General.Map.Config.LowerUnpeggedFlag, true);
            }

            // Update sidedef geometry
            VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef);

            parts.SetupAllParts();

            // Update other sidedef geometry
            if (Sidedef.Other != null)
            {
                BaseVisualSector othersector = (BaseVisualSector)mode.GetVisualSector(Sidedef.Other.Sector);
                parts = othersector.GetSidedefParts(Sidedef.Other);
                parts.SetupAllParts();
            }
        }
Esempio n. 6
0
        public void ClearSelection()
        {
            selectedobjects = new List <IVisualEventReceiver>();

            foreach (KeyValuePair <Sector, VisualSector> vs in allsectors)
            {
                BaseVisualSector bvs = (BaseVisualSector)vs.Value;
                if (bvs.Floor != null)
                {
                    bvs.Floor.Selected = false;
                }
                if (bvs.Ceiling != null)
                {
                    bvs.Ceiling.Selected = false;
                }
                foreach (Sidedef sd in vs.Key.Sidedefs)
                {
                    List <VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd);
                    foreach (VisualGeometry sdg in sidedefgeos)
                    {
                        sdg.Selected = false;
                    }
                }
            }

            foreach (KeyValuePair <Thing, VisualThing> vt in allthings)
            {
                BaseVisualThing bvt = (BaseVisualThing)vt.Value;
                bvt.Selected = false;
            }
        }
Esempio n. 7
0
        // This is called after an action is performed
        private void PostAction()
        {
            if (!string.IsNullOrEmpty(actionresult.displaystatus))
            {
                General.Interface.DisplayStatus(StatusType.Action, actionresult.displaystatus);
            }

            // Reset changed flags
            foreach (KeyValuePair <Sector, VisualSector> vs in allsectors)
            {
                BaseVisualSector bvs = (vs.Value as BaseVisualSector);
                bvs.Floor.Changed   = false;
                bvs.Ceiling.Changed = false;
            }

            selectionchanged = false;

            if (singleselection)
            {
                ClearSelection();
            }

            UpdateChangedObjects();
            ShowTargetInfo();
        }
        // Edit button released
        public void OnEditEnd()
        {
            if (General.Interface.IsActiveWindow)
            {
                List <Vertex> verts = mode.GetSelectedVertices();
                updateList = new Dictionary <BaseVisualSector, bool>();

                foreach (Vertex v in verts)
                {
                    VertexData vd = mode.GetVertexData(v);
                    foreach (KeyValuePair <Sector, bool> s in vd.UpdateAlso)
                    {
                        if (mode.VisualSectorExists(s.Key))
                        {
                            BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
                            if (!updateList.ContainsKey(vs))
                            {
                                updateList.Add(vs, s.Value);
                            }
                        }
                    }
                }

                General.Interface.OnEditFormValuesChanged += Interface_OnEditFormValuesChanged;
                mode.StartRealtimeInterfaceUpdate(SelectionType.Vertices);
                General.Interface.ShowEditVertices(verts, false);
                mode.StopRealtimeInterfaceUpdate(SelectionType.Vertices);
                General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;

                updateList.Clear();
                updateList = null;
            }
        }
Esempio n. 9
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);
                }
            }
        }
        //mxd
        public virtual void OnChangeTextureRotation(float angle)
        {
            if (!General.Map.UDMF)
            {
                return;
            }

            if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
            {
                undoticket = mode.CreateUndo("Change texture rotation");
            }

            string key = (GeometryType == VisualGeometryType.FLOOR ? "rotationfloor" : "rotationceiling");

            mode.SetActionResult((GeometryType == VisualGeometryType.FLOOR ? "Floor" : "Ceiling") + " rotation changed to " + angle);

            //set value
            Sector s = GetControlSector();

            s.Fields.BeforeFieldsChange();
            UniFields.SetFloat(s.Fields, key, angle, 0.0f);

            if (s.Index != Sector.Sector.Index)
            {
                s.UpdateNeeded = true;
                s.UpdateCache();
                mode.GetSectorData(s).Update();
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
                vs.UpdateSectorGeometry(false);
            }

            Sector.Sector.UpdateNeeded = true;
            Sector.Sector.UpdateCache();
            Sector.UpdateSectorGeometry(false);
        }
Esempio n. 11
0
        // Paste properties
        public virtual void OnPasteProperties()
        {
            if (BuilderPlug.Me.CopiedSidedefProps != null)
            {
                mode.CreateUndo("Paste sidedef properties");
                mode.SetActionResult("Pasted sidedef properties.");
                BuilderPlug.Me.CopiedSidedefProps.Apply(Sidedef);

                // Update sectors on both sides
                BaseVisualSector front = (BaseVisualSector)mode.GetVisualSector(Sidedef.Sector);
                if (front != null)
                {
                    front.Changed = true;
                }
                if (Sidedef.Other != null)
                {
                    BaseVisualSector back = (BaseVisualSector)mode.GetVisualSector(Sidedef.Other.Sector);
                    if (back != null)
                    {
                        back.Changed = true;
                    }
                }
                mode.ShowTargetInfo();
            }
        }
        // Raise/lower thing
        public void OnChangeTargetHeight(int amount)
        {
            if (General.Map.FormatInterface.HasThingHeight)
            {
                if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
                {
                    undoticket = mode.CreateUndo("Change thing height");
                }

                Thing.Move(Thing.Position + new Vector3D(0.0f, 0.0f, (info.Hangs ? -amount : amount)));

                mode.SetActionResult("Changed thing height to " + Thing.Position.z + ".");

                // Update what must be updated
                ThingData td = mode.GetThingData(this.Thing);
                foreach (KeyValuePair <Sector, bool> s in td.UpdateAlso)
                {
                    if (mode.VisualSectorExists(s.Key))
                    {
                        BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
                        vs.UpdateSectorGeometry(s.Value);
                    }
                }

                this.Changed = true;
            }
        }
Esempio n. 13
0
        // Flood-fill textures
        public virtual void OnTextureFloodfill()
        {
            if (BuilderPlug.Me.CopiedTexture != null)
            {
                string oldtexture     = GetTextureName();
                long   oldtexturelong = Lump.MakeLongName(oldtexture);
                string newtexture     = BuilderPlug.Me.CopiedTexture;
                if (newtexture != oldtexture)
                {
                    mode.CreateUndo("Flood-fill textures with " + newtexture);
                    mode.SetActionResult("Flood-filled textures with " + newtexture + ".");

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

                    // Get the texture
                    ImageData newtextureimage = General.Map.Data.GetTextureImage(newtexture);
                    if (newtextureimage != null)
                    {
                        if (mode.IsSingleSelection)
                        {
                            // Clear all marks, this will align everything it can
                            General.Map.Map.ClearMarkedSidedefs(false);
                        }
                        else
                        {
                            // Limit the alignment to selection only
                            General.Map.Map.ClearMarkedSidedefs(true);
                            List <Sidedef> sides = mode.GetSelectedSidedefs();
                            foreach (Sidedef sd in sides)
                            {
                                sd.Marked = false;
                            }
                        }

                        // Do the alignment
                        Tools.FloodfillTextures(this.Sidedef, oldtexturelong, newtextureimage, false);

                        // Get the changed sidedefs
                        List <Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);
                        foreach (Sidedef sd in changes)
                        {
                            // Update the parts for this sidedef!
                            if (mode.VisualSectorExists(sd.Sector))
                            {
                                BaseVisualSector   vs    = (mode.GetVisualSector(sd.Sector) as BaseVisualSector);
                                VisualSidedefParts parts = vs.GetSidedefParts(sd);
                                parts.SetupAllParts();
                            }
                        }

                        General.Map.Data.UpdateUsedTextures();
                        mode.Renderer.SetCrosshairBusy(false);
                        mode.ShowTargetInfo();
                    }
                }
            }
        }
Esempio n. 14
0
 public EffectUDMFVertexOffset(SectorData data) : base(data)
 {
     // New effect added: This sector needs an update!
     if (data.Mode.VisualSectorExists(data.Sector))
     {
         BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
         vs.UpdateSectorGeometry(true);
     }
 }
Esempio n. 15
0
 //mxd
 private void UpdateSectorSides(Sector s)
 {
     foreach (Sidedef side in s.Sidedefs)
     {
         if (side.Other != null && side.Other.Sector != null && data.Mode.VisualSectorExists(side.Other.Sector))
         {
             BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(side.Other.Sector);
             vs.GetSidedefParts(side.Other).SetupAllParts();
         }
     }
 }
Esempio n. 16
0
        // Constructor
        public EffectCopySlope(SectorData data, Thing sourcething) : base(data)
        {
            thing = sourcething;

            // New effect added: This sector needs an update!
            if (data.Mode.VisualSectorExists(data.Sector))
            {
                BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
                vs.UpdateSectorGeometry(true);
            }
        }
Esempio n. 17
0
        // Constructor
        public Effect3DFloor(SectorData data, Linedef sourcelinedef) : base(data)
        {
            linedef = sourcelinedef;

            // New effect added: This sector needs an update!
            if (data.Mode.VisualSectorExists(data.Sector))
            {
                BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
                vs.UpdateSectorGeometry(true);
            }
        }
        // Constructor
        public EffectTransferCeilingBrightness(SectorData data, Linedef sourcelinedef) : base(data)
        {
            linedef = sourcelinedef;

            // New effect added: This sector needs an update!
            if (data.Mode.VisualSectorExists(data.Sector))
            {
                BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
                vs.UpdateSectorGeometry(false);
            }
        }
Esempio n. 19
0
        // Apply Texture
        public virtual void ApplyTexture(string texture)
        {
            mode.CreateUndo("Change flat \"" + texture + "\"");
            SetTexture(texture);

            // Update
            if (mode.VisualSectorExists(level.sector))
            {
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                vs.UpdateSectorGeometry(false);
            }
        }
Esempio n. 20
0
        // Constructor
        public EffectThingVertexSlope(SectorData data, List <Thing> sourcethings, bool floor) : base(data)
        {
            things     = sourcethings;
            slopefloor = floor;

            // New effect added: This sector needs an update!
            if (data.Mode.VisualSectorExists(data.Sector))
            {
                BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
                vs.UpdateSectorGeometry(true);
            }
        }
Esempio n. 21
0
        public EffectPlaneCopySlope(SectorData data, Linedef sourcelinedef, bool front) : base(data)
        {
            this.linedef = sourcelinedef;
            this.front   = front;

            // New effect added: This sector needs an update!
            if (data.Mode.VisualSectorExists(data.Sector))
            {
                BaseVisualSector vs = (BaseVisualSector)data.Mode.GetVisualSector(data.Sector);
                vs.UpdateSectorGeometry(true);
            }
        }
        private void UpdateGeometry(Vertex v)
        {
            VertexData vd = mode.GetVertexData(v);

            foreach (KeyValuePair <Sector, bool> s in vd.UpdateAlso)
            {
                if (mode.VisualSectorExists(s.Key))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
                    vs.UpdateSectorGeometry(s.Value);
                }
            }
        }
Esempio n. 23
0
        // Delete texture
        public virtual void OnDelete()
        {
            // Remove texture
            mode.CreateUndo("Delete texture");
            mode.SetActionResult("Deleted a texture.");
            SetTexture("-");

            // Update
            if (mode.VisualSectorExists(level.sector))
            {
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                vs.UpdateSectorGeometry(false);
            }
        }
Esempio n. 24
0
        // Paste texture
        public override void OnPasteTexture()
        {
            if (BuilderPlug.Me.CopiedFlat != null)
            {
                mode.CreateUndo("Paste floor \"" + BuilderPlug.Me.CopiedFlat + "\"");
                mode.SetActionResult("Pasted flat \"" + BuilderPlug.Me.CopiedFlat + "\" on floor.");

                SetTexture(BuilderPlug.Me.CopiedFlat);

                // Update
                if (mode.VisualSectorExists(level.sector))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                    vs.UpdateSectorGeometry(false);
                }
            }
        }
Esempio n. 25
0
        //mxd. Texture scale change
        protected override void ChangeTextureScale(int incrementX, int incrementY)
        {
            if (Texture == null || !Texture.IsImageLoaded)
            {
                return;
            }
            Sector s      = GetControlSector();
            float  scaleX = s.Fields.GetValue("xscalefloor", 1.0f);
            float  scaleY = s.Fields.GetValue("yscalefloor", 1.0f);

            s.Fields.BeforeFieldsChange();

            if (incrementX != 0)
            {
                float pix       = (int)Math.Round(Texture.Width * scaleX) - incrementX;
                float newscaleX = (float)Math.Round(pix / Texture.Width, 3);
                scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
                UniFields.SetFloat(s.Fields, "xscalefloor", scaleX, 1.0f);
            }

            if (incrementY != 0)
            {
                float pix       = (int)Math.Round(Texture.Height * scaleY) - incrementY;
                float newscaleY = (float)Math.Round(pix / Texture.Height, 3);
                scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
                UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f);
            }

            // Update geometry
            if (mode.VisualSectorExists(level.sector))
            {
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                vs.UpdateSectorGeometry(false);
            }

            s.UpdateNeeded = true;
            s.UpdateCache();
            if (s.Index != Sector.Sector.Index)
            {
                Sector.Sector.UpdateNeeded = true;
                Sector.Sector.UpdateCache();
            }

            mode.SetActionResult("Floor scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");
        }
Esempio n. 26
0
        // Auto-align texture X offsets
        public virtual void OnTextureAlign(bool alignx, bool aligny)
        {
            mode.CreateUndo("Auto-align textures");
            mode.SetActionResult("Auto-aligned textures.");

            // Make sure the texture is loaded (we need the texture size)
            if (!base.Texture.IsImageLoaded)
            {
                base.Texture.LoadImage();
            }

            if (mode.IsSingleSelection)
            {
                // Clear all marks, this will align everything it can
                General.Map.Map.ClearMarkedSidedefs(false);
            }
            else
            {
                // Limit the alignment to selection only
                General.Map.Map.ClearMarkedSidedefs(true);
                List <Sidedef> sides = mode.GetSelectedSidedefs();
                foreach (Sidedef sd in sides)
                {
                    sd.Marked = false;
                }
            }

            // Do the alignment
            Tools.AutoAlignTextures(this.Sidedef, base.Texture, alignx, aligny, false);

            // Get the changed sidedefs
            List <Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);

            foreach (Sidedef sd in changes)
            {
                // Update the parts for this sidedef!
                if (mode.VisualSectorExists(sd.Sector))
                {
                    BaseVisualSector   vs    = (mode.GetVisualSector(sd.Sector) as BaseVisualSector);
                    VisualSidedefParts parts = vs.GetSidedefParts(sd);
                    parts.SetupAllParts();
                }
            }
        }
        // Paste properties
        public virtual void OnPasteProperties(bool usecopysettings)
        {
            if (BuilderPlug.Me.CopiedSectorProps != null)
            {
                mode.CreateUndo("Paste sector properties");
                mode.SetActionResult("Pasted sector properties.");

                //mxd. Added "usecopysettings"
                BuilderPlug.Me.CopiedSectorProps.Apply(level.sector, usecopysettings);

                if (mode.VisualSectorExists(level.sector))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                    vs.UpdateSectorGeometry(true);
                }

                mode.ShowTargetInfo();
            }
        }
Esempio n. 28
0
        // This makes a list of the selected object
        private void RebuildSelectedObjectsList()
        {
            // Make list of selected objects
            selectedobjects = new List <IVisualEventReceiver>();
            foreach (KeyValuePair <Sector, VisualSector> vs in allsectors)
            {
                if (vs.Value != null)
                {
                    BaseVisualSector bvs = (BaseVisualSector)vs.Value;
                    if ((bvs.Floor != null) && bvs.Floor.Selected)
                    {
                        selectedobjects.Add(bvs.Floor);
                    }
                    if ((bvs.Ceiling != null) && bvs.Ceiling.Selected)
                    {
                        selectedobjects.Add(bvs.Ceiling);
                    }
                    foreach (Sidedef sd in vs.Key.Sidedefs)
                    {
                        List <VisualGeometry> sidedefgeos = bvs.GetSidedefGeometry(sd);
                        foreach (VisualGeometry sdg in sidedefgeos)
                        {
                            if (sdg.Selected)
                            {
                                selectedobjects.Add((sdg as IVisualEventReceiver));
                            }
                        }
                    }
                }
            }

            foreach (KeyValuePair <Thing, VisualThing> vt in allthings)
            {
                if (vt.Value != null)
                {
                    BaseVisualThing bvt = (BaseVisualThing)vt.Value;
                    if (bvt.Selected)
                    {
                        selectedobjects.Add(bvt);
                    }
                }
            }
        }
        //mxd
        public void OnMove(Vector3D newposition)
        {
            if ((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
            {
                undoticket = mode.CreateUndo("Move thing");
            }
            Thing.Move(newposition);
            mode.SetActionResult("Changed thing position to " + Thing.Position + ".");

            // Update what must be updated
            ThingData td = mode.GetThingData(this.Thing);

            foreach (KeyValuePair <Sector, bool> s in td.UpdateAlso)
            {
                if (mode.VisualSectorExists(s.Key))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
                    vs.UpdateSectorGeometry(s.Value);
                }
            }

            this.Changed = true;
        }
Esempio n. 30
0
        //mxd
        protected override void UpdateSkyRenderFlag()
        {
            bool isrenderedassky = renderassky;

            renderassky = (level.sector.CeilTexture == General.Map.Config.SkyFlatName);
            if (isrenderedassky != renderassky && Sector.Sides != null)
            {
                // Upper/middle geometry may need updating...
                foreach (Sidedef side in level.sector.Sidedefs)
                {
                    VisualSidedefParts parts = Sector.GetSidedefParts(side);
                    if (parts.upper != null)
                    {
                        parts.upper.UpdateSkyRenderFlag();
                    }
                    else if (parts.middlesingle != null)
                    {
                        parts.middlesingle.UpdateSkyRenderFlag();
                    }

                    // On the other side as well...
                    if (side.Other != null && side.Other.Sector != null &&
                        side.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName)
                    {
                        BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
                        if (other != null && other.Sides != null)
                        {
                            parts = other.GetSidedefParts(side.Other);
                            if (parts.upper != null)
                            {
                                parts.upper.UpdateSkyRenderFlag();
                            }
                        }
                    }
                }
            }
        }