public ThreeDFloor(Sector sector, IEnumerable <Sector> potentialsectors) { if (sector == null) { throw new Exception("Sector can't be null"); } this.sector = sector; taggedsectors = new List <Sector>(); topflat = sector.CeilTexture; bottomflat = sector.FloorTexture; topheight = sector.CeilHeight; bottomheight = sector.FloorHeight; brightness = sector.Brightness; tags = new List <int>(); floorslope = sector.FloorSlope; floorslopeoffset = sector.FloorSlopeOffset; ceilingslope = sector.CeilSlope; ceilingslopeoffset = sector.CeilSlopeOffset; foreach (Sidedef sd in sector.Sidedefs) { if (sd.Line.Action == 160) { bordertexture = sd.MiddleTexture; udmftag = sd.Line.Args[0]; type = sd.Line.Args[1]; flags = sd.Line.Args[2]; alpha = sd.Line.Args[3]; linedefproperties = new LinedefProperties(sd.Line); sectorproperties = new SectorProperties(sector); foreach (Sector s in BuilderPlug.GetSectorsByTag(potentialsectors, sd.Line.Args[0])) { if (!taggedsectors.Contains(s)) { taggedsectors.Add(s); } } } } }
public ThreeDFloor() { sector = null; taggedsectors = new List <Sector>(); topflat = General.Settings.DefaultCeilingTexture; bottomflat = General.Settings.DefaultFloorTexture; topheight = General.Settings.DefaultCeilingHeight; bottomheight = General.Settings.DefaultFloorHeight; bordertexture = General.Settings.DefaultTexture; type = 1; flags = 0; tags = new List <int>(); floorslope = new Vector3D(0.0f, 0.0f, 0.0f); floorslopeoffset = 0.0f; ceilingslope = new Vector3D(0.0f, 0.0f, 0.0f); ceilingslopeoffset = 0.0f; linedefproperties = null; sectorproperties = null; alpha = 255; }
public bool CreateGeometry(List <int> tagblacklist, List <DrawnVertex> alldrawnvertices, LinedefProperties ldprops, SectorProperties sectorprops, bool forcenewtag, out int newtag) { List <Vertex> vertices = new List <Vertex>(); Vector3D slopetopthingpos = new Vector3D(0, 0, 0); Vector3D slopebottomthingpos = new Vector3D(0, 0, 0); Line2D slopeline = new Line2D(0, 0, 0, 0); newtag = -1; // We need 5 vertices to draw the control sector if (alldrawnvertices.Count < 5) { General.Interface.DisplayStatus(StatusType.Warning, "Could not draw new sector: not enough vertices"); return(false); } // Get the first 5 vertices in the list and also remove them from the list, so that creating further // control sectors won't use them List <DrawnVertex> drawnvertices = alldrawnvertices.GetRange(0, 5); alldrawnvertices.RemoveRange(0, 5); // drawnvertices = BuilderPlug.Me.ControlSectorArea.GetNewControlSectorVertices(); if (Tools.DrawLines(drawnvertices) == false) { General.Interface.DisplayStatus(StatusType.Warning, "Could not draw new sector"); return(false); } sector = General.Map.Map.GetMarkedSectors(true)[0]; if (sectorprops != null) { sectorprops.Apply(new List <Sector>() { sector }, false); } sector.FloorHeight = bottomheight; sector.CeilHeight = topheight; sector.SetFloorTexture(bottomflat); sector.SetCeilTexture(topflat); sector.Brightness = brightness; sector.FloorSlope = floorslope; sector.FloorSlopeOffset = floorslopeoffset; sector.CeilSlope = ceilingslope; sector.CeilSlopeOffset = ceilingslopeoffset; foreach (Sidedef sd in sector.Sidedefs) { sd.Line.Front.SetTextureMid(bordertexture); } if (!sector.Fields.ContainsKey("user_managed_3d_floor")) { sector.Fields.Add("user_managed_3d_floor", new UniValue(UniversalType.Boolean, true)); } sector.Fields["comment"] = new UniValue(UniversalType.String, "[!]DO NOT DELETE! This sector is managed by the 3D floor plugin."); // With multiple tag support in UDMF only one tag is needed, so bind it right away if (General.Map.UDMF == true) { if (isnew || forcenewtag) { newtag = udmftag = BuilderPlug.Me.ControlSectorArea.GetNewSectorTag(tagblacklist); tagblacklist.Add(udmftag); } BindTag(udmftag, ldprops); } return(true); }
private SectorProperties CheckSector(int i, int j) { if(i>=0 && i<hive.sectors.Count && j>=0 && j<hive.sectors[i].Count && !isLastSector(i,j))//(hive.sectors[i][j]!=null) { return hive.sectors[i][j]; } else { SectorProperties forbidden = new SectorProperties(); forbidden.isForbidden = true; return forbidden; } }