// Edit button released
        public virtual void OnEditEnd()
        {
            if (General.Interface.IsActiveWindow)
            {
                List <Linedef> linedefs = mode.GetSelectedLinedefs();
                DialogResult   result   = General.Interface.ShowEditLinedefs(linedefs);
                if (result == DialogResult.OK)
                {
                    foreach (Linedef l in linedefs)
                    {
                        if (l.Front != null)
                        {
                            if (mode.VisualSectorExists(l.Front.Sector))
                            {
                                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Front.Sector);
                                vs.UpdateSectorGeometry(false);
                            }
                        }

                        if (l.Back != null)
                        {
                            if (mode.VisualSectorExists(l.Back.Sector))
                            {
                                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(l.Back.Sector);
                                vs.UpdateSectorGeometry(false);
                            }
                        }
                    }

                    mode.RebuildElementData();
                }
            }
        }
Exemple #2
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;
        }
        // Raise/lower thing
        public virtual 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, (float)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;
            }
        }
        // This updates this virtual the sector and neightbours if needed
        public void UpdateSectorGeometry(bool includeneighbours)
        {
            if (isupdating)
            {
                return;
            }

            isupdating = true;
            changed    = true;

            // Not sure what from this part we need, so commented out for now
            SectorData data = GetSectorData();

            data.Reset();

            // Update sectors that rely on this sector
            foreach (KeyValuePair <Sector, bool> s in data.UpdateAlso)
            {
                if (mode.VisualSectorExists(s.Key))
                {
                    BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
                    vs.UpdateSectorGeometry(s.Value);
                }
            }

            // 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;
                        }
                    }
                }
            }

            isupdating = false;
        }
        // Constructor
        public EffectThingLineSlope(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);
            }
        }
Exemple #6
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 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);
            }
        }
Exemple #8
0
        // Sector height change
        public virtual void OnChangeTargetHeight(int amount)
        {
            changed = true;

            ChangeHeight(amount);

            // Rebuild sector
            if (mode.VisualSectorExists(level.sector))
            {
                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
                vs.UpdateSectorGeometry(true);
            }
        }
Exemple #9
0
 // This changes the texture
 protected override void SetTexture(string texturename)
 {
     level.sector.SetCeilTexture(texturename);
     General.Map.Data.UpdateUsedTextures();
     if (level.sector == this.Sector.Sector)
     {
         this.Setup();
     }
     else if (mode.VisualSectorExists(level.sector))
     {
         BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
         vs.UpdateSectorGeometry(false);
     }
 }
Exemple #10
0
 // Paste properties
 public virtual void OnPasteProperties()
 {
     if (BuilderPlug.Me.CopiedSectorProps != null)
     {
         mode.CreateUndo("Paste sector properties");
         mode.SetActionResult("Pasted sector properties.");
         BuilderPlug.Me.CopiedSectorProps.Apply(level.sector);
         if (mode.VisualSectorExists(level.sector))
         {
             BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
             vs.UpdateSectorGeometry(true);
         }
         mode.ShowTargetInfo();
     }
 }
Exemple #11
0
 // Edit button released
 public virtual void OnEditEnd()
 {
     if (General.Interface.IsActiveWindow)
     {
         List <Sector> sectors = mode.GetSelectedSectors();
         DialogResult  result  = General.Interface.ShowEditSectors(sectors);
         if (result == DialogResult.OK)
         {
             // Rebuild sector
             foreach (Sector s in sectors)
             {
                 if (mode.VisualSectorExists(s))
                 {
                     BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
                     vs.UpdateSectorGeometry(true);
                 }
             }
         }
     }
 }