// 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;
                        }
                    }
                }
            }
        }
Exemple #2
0
        // Sector brightness change
        public virtual void OnChangeTargetBrightness(bool up)
        {
            if (!Sector.Changed)
            {
                // Change brightness
                mode.CreateUndo("Change sector brightness", UndoGroup.SectorBrightnessChange, Sector.Sector.FixedIndex);

                if (up)
                {
                    Sector.Sector.Brightness = General.Map.Config.BrightnessLevels.GetNextHigher(Sector.Sector.Brightness);
                }
                else
                {
                    Sector.Sector.Brightness = General.Map.Config.BrightnessLevels.GetNextLower(Sector.Sector.Brightness);
                }

                mode.SetActionResult("Changed sector brightness to " + Sector.Sector.Brightness + ".");

                Sector.Sector.UpdateCache();

                // Rebuild sector
                Sector.Changed = true;

                // Go for all things in this sector
                foreach (Thing t in General.Map.Map.Things)
                {
                    if (t.Sector == Sector.Sector)
                    {
                        if (mode.VisualThingExists(t))
                        {
                            // Update thing
                            BaseVisualThing vt = (mode.GetVisualThing(t) as BaseVisualThing);
                            vt.Changed = true;
                        }
                    }
                }
            }
        }
Exemple #3
0
        // This updates this virtual the sector and neightbours if needed
        override 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 = mode.GetSectorDataEx(this.Sector); //mxd

            if (data != null)                                    //mxd
            {
                data.Reset(false);

                // Update sectors that rely on this sector
                foreach (KeyValuePair <Sector, bool> s in data.UpdateAlso)
                {
                    SectorData other = mode.GetSectorDataEx(s.Key);
                    if (other != null)
                    {
                        other.Reset(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 = (BaseVisualThing)mode.GetVisualThing(t);
                        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))
                        {
                            SectorData other = mode.GetSectorDataEx(sd.Other.Sector);

                            if (other != null)
                            {
                                other.Reset(other.UpdateAlso.Count > 0 ? true : false);                                 // biwa. Make sure to reset the update status of dependend sectors. This fixes #250, where 3D floors where not updated when the control sector was sloped using line action 181
                            }
                            else
                            {
                                BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sd.Other.Sector);
                                vs.Changed = true;
                            }
                        }
                    }
                }
            }

            Sector.UpdateFogColor();             //mxd
            isupdating = false;
        }