Esempio n. 1
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. 2
0
        //mxd
        public override void OnTextureFit(FitTextureOptions options)
        {
            if (!General.Map.UDMF)
            {
                return;
            }
            if (string.IsNullOrEmpty(Sidedef.MiddleTexture) || Sidedef.MiddleTexture == "-" || !Texture.IsImageLoaded)
            {
                return;
            }
            FitTexture(options);
            Setup();

            // Update linked effects
            SectorData sd = mode.GetSectorDataEx(Sector.Sector);

            if (sd != null)
            {
                sd.Reset(true);
            }
        }
Esempio n. 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;
        }