// This makes sure we are updated with the source linedef information public override void Update() { //mxd. Skip if arg0 is 0. if (thing.Args[0] == 0) { return; } ThingData td = data.Mode.GetThingData(thing); Thing t = thing; Linedef ld = sidedef.Line; if (ld != null) { if (t.Type == 9500) { SectorData sd = data.Mode.GetSectorData(sidedef.Sector); Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, sd.Floor.plane.GetZ(ld.Start.Position)); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, sd.Floor.plane.GetZ(ld.End.Position)); Vector3D v3 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + sd.Floor.plane.GetZ(t.Position)); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(sidedef.Sector, true); sd.Floor.plane = new Plane(v1, v2, v3, true); } else if (t.Type == 9501) { SectorData sd = data.Mode.GetSectorData(sidedef.Sector); Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, sd.Ceiling.plane.GetZ(ld.Start.Position)); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, sd.Ceiling.plane.GetZ(ld.End.Position)); Vector3D v3 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + sd.Ceiling.plane.GetZ(t.Position)); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(sidedef.Sector, true); sd.Ceiling.plane = new Plane(v1, v2, v3, false); } } }
// This makes sure we are updated with the source linedef information public override void Update() { // Create vertices in clockwise order Vector3D[] verts = new Vector3D[3]; int index = 0; foreach (Sidedef sd in data.Sector.Sidedefs) { Vertex v = sd.IsFront ? sd.Line.End : sd.Line.Start; // Presume not sloped if (slopefloor) { verts[index] = new Vector3D(v.Position.x, v.Position.y, data.Floor.plane.GetZ(v.Position)); } else { verts[index] = new Vector3D(v.Position.x, v.Position.y, data.Ceiling.plane.GetZ(v.Position)); } //mxd. UDMF vertex offset overrides this effect if (General.Map.UDMF) { if ((slopefloor && !float.IsNaN(v.ZFloor)) || !float.IsNaN(v.ZCeiling)) { index++; continue; } } // Find the thing at this position foreach (Thing t in things) { if ((Vector2D)t.Position == v.Position) { ThingData td = data.Mode.GetThingData(t); td.AddUpdateSector(data.Sector, true); verts[index] = t.Position; } } index++; } // Make new plane if (slopefloor) { data.Floor.plane = new Plane(verts[0], verts[1], verts[2], true); } else { data.Ceiling.plane = new Plane(verts[0], verts[2], verts[1], false); } }
// This makes sure we are updated with the source linedef information public override void Update() { ThingData td = data.Mode.GetThingData(thing); Thing t = thing; // Floor slope thing if (t.Type == 9502) { t.DetermineSector(data.Mode.BlockMap); if (t.Sector != null) { //mxd. Vertex zheight overrides this effect if (General.Map.UDMF && t.Sector.Sidedefs.Count == 3) { foreach (Sidedef side in t.Sector.Sidedefs) { if (!double.IsNaN(side.Line.Start.ZFloor) || !double.IsNaN(side.Line.End.ZFloor)) { return; } } } double angle = Angle2D.DoomToReal((int)Angle2D.RadToDeg(t.Angle)); double vangle = Angle2D.DegToRad(General.Clamp(t.Args[0], 0, 180)); //mxd. Don't underestimate user stupidity (or curiosity)! Vector2D point = new Vector2D(t.Position.x + Math.Cos(angle) * Math.Sin(vangle), t.Position.y + Math.Sin(angle) * Math.Sin(vangle)); Vector2D perpendicular = new Line2D(t.Position, point).GetPerpendicular(); Vector3D v1 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.FloorHeight); Vector3D v2 = new Vector3D( point.x + perpendicular.x, point.y + perpendicular.y, t.Position.z + t.Sector.FloorHeight + Math.Cos(vangle) ); Vector3D v3 = new Vector3D( point.x - perpendicular.x, point.y - perpendicular.y, t.Position.z + t.Sector.FloorHeight + Math.Cos(vangle) ); SectorData sd = data.Mode.GetSectorData(t.Sector); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(t.Sector, true); sd.Floor.plane = new Plane(v1, v2, v3, true); } } // Ceiling slope thing else if (t.Type == 9503) { t.DetermineSector(data.Mode.BlockMap); if (t.Sector != null) { //mxd. Vertex zheight overrides this effect if (General.Map.UDMF && t.Sector.Sidedefs.Count == 3) { foreach (Sidedef side in t.Sector.Sidedefs) { if (!double.IsNaN(side.Line.Start.ZCeiling) || !double.IsNaN(side.Line.End.ZCeiling)) { return; } } } double angle = Angle2D.DoomToReal((int)Angle2D.RadToDeg(t.Angle)); double vangle = Angle2D.DegToRad(General.Clamp(t.Args[0], 0, 180)); //mxd. Don't underestimate user stupidity (or curiosity)! Vector2D point = new Vector2D(t.Position.x + Math.Cos(angle) * Math.Sin(vangle), t.Position.y + Math.Sin(angle) * Math.Sin(vangle)); Vector2D perpendicular = new Line2D(t.Position, point).GetPerpendicular(); Vector3D v1 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.CeilHeight); Vector3D v2 = new Vector3D( point.x + perpendicular.x, point.y + perpendicular.y, t.Position.z + t.Sector.CeilHeight + Math.Cos(vangle) ); Vector3D v3 = new Vector3D( point.x - perpendicular.x, point.y - perpendicular.y, t.Position.z + t.Sector.CeilHeight + Math.Cos(vangle) ); SectorData sd = data.Mode.GetSectorData(t.Sector); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(t.Sector, true); sd.Ceiling.plane = new Plane(v1, v2, v3, false); } } }
// This makes sure we are updated with the source linedef information public override void Update() { //mxd. Skip if arg0 is 0. if (thing.Args[0] == 0) { return; } ThingData td = data.Mode.GetThingData(thing); Thing t = thing; // Find the tagged line Linedef ld = null; foreach (Linedef l in General.Map.Map.Linedefs) { if (l.Tags.Contains(t.Args[0])) { ld = l; break; } } if (ld != null) { if (t.Type == 9500) { // Slope the floor from the linedef to thing t.DetermineSector(data.Mode.BlockMap); if (t.Sector != null) { Vector3D v3 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.FloorHeight); if (ld.SideOfLine(t.Position) < 0.0f) { Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, ld.Front.Sector.FloorHeight); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, ld.Front.Sector.FloorHeight); SectorData sd = data.Mode.GetSectorData(ld.Front.Sector); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(ld.Front.Sector, true); sd.Floor.plane = new Plane(v1, v2, v3, true); } else { Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, ld.Back.Sector.FloorHeight); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, ld.Back.Sector.FloorHeight); SectorData sd = data.Mode.GetSectorData(ld.Back.Sector); sd.AddUpdateSector(data.Sector, true); if (!sd.Updated) { sd.Update(); } td.AddUpdateSector(ld.Back.Sector, true); sd.Floor.plane = new Plane(v2, v1, v3, true); } } } else if (t.Type == 9501) { // Slope the ceiling from the linedef to thing t.DetermineSector(data.Mode.BlockMap); if (t.Sector != null) { td.AddUpdateSector(t.Sector, true); Vector3D v3 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.CeilHeight); if (ld.SideOfLine(t.Position) < 0.0f) { Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, ld.Front.Sector.CeilHeight); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, ld.Front.Sector.CeilHeight); SectorData sd = data.Mode.GetSectorData(ld.Front.Sector); sd.AddUpdateSector(data.Sector, true); td.AddUpdateSector(ld.Front.Sector, true); if (!sd.Updated) { sd.Update(); } sd.Ceiling.plane = new Plane(v1, v2, v3, false); } else { Vector3D v1 = new Vector3D(ld.Start.Position.x, ld.Start.Position.y, ld.Back.Sector.CeilHeight); Vector3D v2 = new Vector3D(ld.End.Position.x, ld.End.Position.y, ld.Back.Sector.CeilHeight); SectorData sd = data.Mode.GetSectorData(ld.Back.Sector); sd.AddUpdateSector(data.Sector, true); td.AddUpdateSector(ld.Back.Sector, true); if (!sd.Updated) { sd.Update(); } sd.Ceiling.plane = new Plane(v2, v1, v3, false); } } } } }