private BlockMap <BlockEntry> CreateBlockmap(bool ignorecontrolsectors)
        {
            // Make blockmap
            RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);

            area = MapSet.IncreaseArea(area, new Vector2D(outerleft, outertop));
            area = MapSet.IncreaseArea(area, new Vector2D(outerright, outerbottom));
            area = AlignAreaToGrid(area);

            BlockMap <BlockEntry> blockmap = new BlockMap <BlockEntry>(area, (int)gridsize);

            if (ignorecontrolsectors)
            {
                foreach (Sector s in General.Map.Map.Sectors)
                {
                    // Managed control sectors have the custom UDMF field "user_managed_3d_floor" set to true
                    // So if the field is NOT set, add the sector to the blockmap
                    bool managed = s.Fields.GetValue("user_managed_3d_floor", false);

                    if (managed == false)
                    {
                        blockmap.AddSector(s);
                    }
                    else                     // When a tag was manually removed a control sector still might have the user_managed_3d_floor field, but not be
                    {                        // recognized as a 3D floor control sector. In that case also add the sector to the blockmap
                        bool orphaned = true;

                        foreach (ThreeDFloor tdf in ((ThreeDFloorHelperMode)General.Editing.Mode).ThreeDFloors)
                        {
                            if (tdf.Sector == s)
                            {
                                orphaned = false;
                                break;
                            }
                        }

                        if (orphaned)
                        {
                            blockmap.AddSector(s);
                        }
                    }
                }
            }
            else
            {
                blockmap.AddSectorsSet(General.Map.Map.Sectors);
            }

            return(blockmap);
        }
Пример #2
0
        private BlockMap <BlockEntry> CreateBlockmap(bool ignorecontrolsectors)
        {
            // Make blockmap
            RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);

            area = MapSet.IncreaseArea(area, new Vector2D(outerleft, outertop));
            area = MapSet.IncreaseArea(area, new Vector2D(outerright, outerbottom));
            area = AlignAreaToGrid(area);

            BlockMap <BlockEntry> blockmap = new BlockMap <BlockEntry>(area, (int)gridsize);

            if (ignorecontrolsectors)
            {
                foreach (Sector s in General.Map.Map.Sectors)
                {
                    // Managed control sectors have the custom UDMF field "user_managed_3d_floor" set to true
                    // So if the field is NOT set, add the sector to the blockmap
                    if (s.Fields.GetValue("user_managed_3d_floor", false) == false)
                    {
                        blockmap.AddSector(s);
                    }
                }
            }
            else
            {
                blockmap.AddSectorsSet(General.Map.Map.Sectors);
            }

            return(blockmap);
        }