Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • STJr/UltimateZoneBuilder
  • KartKrew/high-voltage-ring
  • ashi/ultimate-zone-builder
  • Alam/UltimateZoneBuilder
  • Indev/UltimateZoneBuilder
  • Acelite/UltimateZoneBuilder
  • LoganAir/high-voltage-ring
  • coatlessali/high-voltage-ring
  • spherallic/high-voltage-ring
  • EeveeEuphoria/high-voltage-ring
  • StarManiaKG/the-story-of-horsepowering-vetted-racing
  • frostu8/high-voltage-ring
  • Benji_Menji/high-voltage-ring
  • Nep2Disk/UltimateZoneBuilder
  • PencilVoid/high-voltage-ring
15 results
Show changes
Showing
with 487 additions and 230 deletions
......@@ -225,10 +225,10 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
sd.SetTextureMid(bordertexture);
if (sd.Line.Action >= 100 && sd.Line.Action < 300)
{
sd.Line.Args[1] = type;
sd.Line.Args[2] = flags;
sd.Line.Args[3] = alpha;
{
// We need to update the linedef's args, but we can't do it directly because otherwise their state will not be saved for the undo snapshot,
// so we're using the linedef's update method
sd.Line.Update(sd.Line.GetFlags(), sd.Line.Activate, sd.Line.Tags, sd.Line.Action, new int[] { sd.Line.Args[0], type, flags, alpha, sd.Line.Args[4] });
}
}
}
......
......@@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected ICollection<Thing> unselectedthings; //mxd
// List of things, which should be moved
private ICollection<Thing> thingstodrag; //mxd
protected ICollection<Thing> thingstodrag; //mxd
//mxd. List of sectors
private List<Sector> selectedsectors;
......@@ -133,7 +133,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Make list of selected vertices and things
selectedverts = General.Map.Map.GetMarkedVertices(true);
selectedthings = General.Map.Map.GetSelectedThings(true); //mxd
thingstodrag = (BuilderPlug.Me.SyncronizeThingEdit ? selectedthings : new List<Thing>()); //mxd
// Only set the things to drag if they weren't set by the inherited modes
if(thingstodrag == null)
thingstodrag = (BuilderPlug.Me.SyncronizeThingEdit ? selectedthings : new List<Thing>()); //mxd
// Make list of non-selected vertices and things
// Non-selected vertices will be used for snapping to nearest items
......
......@@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Constructor / Disposer
// Constructor to start dragging immediately
public DragSectorsMode(Vector2D dragstartmappos, ICollection<Sector> sectors)
public DragSectorsMode(Vector2D dragstartmappos, ICollection<Sector> sectors, ICollection<Thing> things)
{
// Mark what we are dragging
General.Map.Map.ClearAllMarks(false);
......@@ -74,6 +74,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
sd.Line.End.Marked = true;
}
}
// If we got things they will be dragged, otherwise
if (things != null)
thingstodrag = things;
// Initialize
base.StartDrag(dragstartmappos);
......
......@@ -74,6 +74,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Linedefs that will be edited
ICollection<Linedef> editlines;
// Autosave
private bool allowautosave;
#endregion
#region ================== Properties
......@@ -629,6 +632,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
UpdateSelectionInfo(); //mxd
SetupSectorLabels(); //mxd
// By default we allow autosave
allowautosave = true;
}
// Mode disengages
......@@ -835,11 +841,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if(General.Interface.IsActiveWindow)
{
// Prevent autosave while the editing dialog is shown
allowautosave = false;
// Show line edit dialog
General.Interface.OnEditFormValuesChanged += linedefEditForm_OnValuesChanged;
DialogResult result = General.Interface.ShowEditLinedefs(editlines);
General.Interface.OnEditFormValuesChanged -= linedefEditForm_OnValuesChanged;
allowautosave = true;
General.Map.Map.Update();
// Update entire display
......@@ -1250,6 +1261,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
CreateBlockmap();
}
public override bool OnAutoSaveBegin()
{
return allowautosave;
}
//mxd
private void RenderComment(Linedef l)
{
......
......@@ -87,6 +87,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Sectors that will be edited
private ICollection<Sector> editsectors;
// Autosave
private bool allowautosave;
#endregion
#region ================== Properties
......@@ -873,6 +876,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
UpdateSelectedLabels();
UpdateOverlaySurfaces();//mxd
UpdateSelectionInfo(); //mxd
// By default we allow autosave
allowautosave = true;
}
// Mode disengages
......@@ -1116,11 +1122,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if(General.Interface.IsActiveWindow)
{
// Prevent autosave while the editing dialog is shown
allowautosave = false;
//mxd. Show realtime vertex edit dialog
General.Interface.OnEditFormValuesChanged += sectorEditForm_OnValuesChanged;
DialogResult result = General.Interface.ShowEditSectors(editsectors);
General.Interface.OnEditFormValuesChanged -= sectorEditForm_OnValuesChanged;
allowautosave = true;
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
UpdateEffectLabels();
......@@ -1319,6 +1330,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((highlighted != null) && !highlighted.IsDisposed)
{
ICollection<Sector> dragsectors;
ICollection<Thing> dragthings = null;
// Highlighted item not selected?
if (!highlighted.Selected)
......@@ -1326,6 +1338,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select only this sector for dragging
General.Map.Map.ClearSelectedSectors();
dragsectors = new List<Sector> { highlighted };
if (BuilderPlug.Me.SyncronizeThingEdit)
dragthings = General.Map.Map.Things.Where(t => t.Sector == highlighted).ToList();
UpdateOverlaySurfaces(); //mxd
}
else
......@@ -1335,7 +1352,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start dragging the selection
if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag(dragsectors)) //mxd
General.Editing.ChangeMode(new DragSectorsMode(mousedownmappos, dragsectors));
General.Editing.ChangeMode(new DragSectorsMode(mousedownmappos, dragsectors, dragthings));
}
}
}
......@@ -1621,6 +1638,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.ToggleHighlight();
}
public override bool OnAutoSaveBegin()
{
return allowautosave;
}
//mxd
private void RenderComment(Sector s)
{
......
......@@ -79,6 +79,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Things that will be edited
private ICollection<Thing> editthings;
// Autosave
private bool allowautosave;
#endregion
#region ================== Properties
......@@ -177,6 +180,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
UpdateSelectionInfo(); //mxd
UpdateHelperObjects(); //mxd
SetupSectorLabels(); //mxd
// By default we allow autosave
allowautosave = true;
}
// Mode disengages
......@@ -553,11 +559,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Edit only when preferred
if(!thinginserted || BuilderPlug.Me.EditNewThing)
{
// Prevent autosave while the editing dialog is shown
allowautosave = false;
//mxd. Show realtime thing edit dialog
General.Interface.OnEditFormValuesChanged += thingEditForm_OnValuesChanged;
DialogResult result = General.Interface.ShowEditThings(editthings);
General.Interface.OnEditFormValuesChanged -= thingEditForm_OnValuesChanged;
allowautosave = true;
//mxd. Update helper lines
UpdateHelperObjects();
......@@ -829,6 +840,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
public override bool OnAutoSaveBegin()
{
return allowautosave;
}
//mxd. Check if any selected thing is outside of map boundary
private static bool CanDrag(ICollection<Thing> dragthings)
{
......
......@@ -62,6 +62,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Vertices that will be edited
ICollection<Vertex> editvertices;
// Autosave
private bool allowautosave;
#endregion
#region ================== Properties
......@@ -127,6 +130,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Convert geometry selection to vertices only
General.Map.Map.ConvertSelection(SelectionType.Vertices);
UpdateSelectionInfo(); //mxd
// By default we allow autosave
allowautosave = true;
}
// Mode disengages
......@@ -410,11 +416,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
if(General.Interface.IsActiveWindow)
{
// Prevent autosave while the editing dialog is shown
allowautosave = false;
//mxd. Show realtime vertex edit dialog
General.Interface.OnEditFormValuesChanged += vertexEditForm_OnValuesChanged;
DialogResult result = General.Interface.ShowEditVertices(editvertices);
General.Interface.OnEditFormValuesChanged -= vertexEditForm_OnValuesChanged;
allowautosave = true;
// Update entire display
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
......@@ -660,6 +671,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
public override bool OnAutoSaveBegin()
{
return allowautosave;
}
//mxd. Check if any selected vertex is outside of map boundary
private static bool CanDrag(ICollection<Vertex> dragvertices)
{
......
......@@ -401,7 +401,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
if(General.Map.UDMF && General.Settings.GZShowVisualVertices)
if(General.Map.UDMF && General.Map.Config.VertexHeightSupport && General.Settings.GZShowVisualVertices)
{
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
{
......@@ -652,7 +652,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
if(General.Map.UDMF)
if(General.Map.UDMF && General.Map.Config.VertexHeightSupport)
{
foreach(KeyValuePair<Vertex, VisualVertexPair> pair in vertices)
pair.Value.Update();
......@@ -1052,7 +1052,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Find interesting things (such as sector slopes)
// Pass one of slope things, and determine which one are for pass two
//TODO: rewrite using classnames instead of numbers
//TODO: unfuck this because UDB decided to overhaul this...
foreach (Thing t in General.Map.Map.Things)
{
// SRB2
......@@ -1327,7 +1327,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Pass two of slope things
//TODO: rewrite using classnames instead of numbers
//TODO: unfuck this because UDB decided to overhaul this...
foreach (Thing t in slopethingpass[1])
{
switch (t.Type)
......@@ -1766,7 +1766,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd
if(General.Map.UDMF && General.Settings.GZShowVisualVertices && vertices.Count > 0)
if(General.Map.UDMF && General.Map.Config.VertexHeightSupport && General.Settings.GZShowVisualVertices && vertices.Count > 0)
{
List<VisualVertex> verts = new List<VisualVertex>();
......
......@@ -383,78 +383,109 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!General.Map.Config.SidedefTextureSkewing)
return;
string skewtype = Sidedef.Fields.GetValue("skew_bottom_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
if (General.Map.Config.SkewStyle == Config.SkewStyle.GZDoom)
{
double leftz, rightz;
int skewtype = Sidedef.Fields.GetValue("skew_bottom", 0);
if (skewtype == "front_floor")
if (skewtype > 0 && skewtype <= 4 && Texture != null)
{
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
Plane plane;
Vector2D start = Sidedef.IsFront ? Sidedef.Line.Start.Position : Sidedef.Line.End.Position;
Vector2D end = Sidedef.IsFront ? Sidedef.Line.End.Position : Sidedef.Line.Start.Position;
if (skewtype == 1)
plane = Sector.GetSectorData().Floor.plane;
else if (skewtype == 2)
plane = Sector.GetSectorData().Ceiling.plane;
else if (skewtype == 3)
plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
else // skewtype 4
plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
double leftz = plane.GetZ(start);
double rightz = plane.GetZ(end);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height) * Sidedef.Fields.GetValue("scaley_bottom", 1.0) / Sidedef.Fields.GetValue("scalex_bottom", 1.0))
);
}
else if(skewtype == "back_floor")
{
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else if(skewtype == "front_ceiling")
}
else if (General.Map.Config.SkewStyle == Config.SkewStyle.EternityEngine)
{
string skewtype = Sidedef.Fields.GetValue("skew_bottom_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
{
if (Sidedef.IsFront)
double leftz, rightz;
if (skewtype == "front_floor")
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else if (skewtype == "back_floor")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
else // Back ceiling
{
if (Sidedef.IsFront)
else if (skewtype == "front_ceiling")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else // Back ceiling
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
}
}
}
......
......@@ -544,77 +544,108 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!General.Map.Config.SidedefTextureSkewing)
return;
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
if (General.Map.Config.SkewStyle == Config.SkewStyle.GZDoom)
{
double leftz, rightz;
int skewtype = Sidedef.Fields.GetValue("skew_middle", 0);
if(skewtype == "front_floor")
if (skewtype > 0 && skewtype <= 4 && Texture != null)
{
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
Plane plane;
Vector2D start = Sidedef.IsFront ? Sidedef.Line.Start.Position : Sidedef.Line.End.Position;
Vector2D end = Sidedef.IsFront ? Sidedef.Line.End.Position : Sidedef.Line.Start.Position;
if (skewtype == 1)
plane = Sector.GetSectorData().Floor.plane;
else if (skewtype == 2)
plane = Sector.GetSectorData().Ceiling.plane;
else if (skewtype == 3)
plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
else // skewtype 4
plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
double leftz = plane.GetZ(start);
double rightz = plane.GetZ(end);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height) * Sidedef.Fields.GetValue("scaley_mid", 1.0) / Sidedef.Fields.GetValue("scalex_mid", 1.0))
);
}
else if(skewtype == "front_ceiling")
{
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else if (skewtype == "back_floor")
}
else if (General.Map.Config.SkewStyle == Config.SkewStyle.EternityEngine)
{
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
{
if (Sidedef.IsFront)
double leftz, rightz;
if (skewtype == "front_floor")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else if (skewtype == "front_ceiling")
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
else // Back ceiling
{
if (Sidedef.IsFront)
else if (skewtype == "back_floor")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else // Back ceiling
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
}
}
}
......@@ -628,39 +659,91 @@ namespace CodeImp.DoomBuilder.BuilderModes
/// <returns>The top and bottom clipping planes</returns>
private (Plane, Plane) CreateSkewClipPlanes(double textop, double texbottom, SectorData sd, SectorData osd)
{
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
if (General.Map.Config.SkewStyle == Config.SkewStyle.GZDoom)
{
int skewtype = Sidedef.Fields.GetValue("skew_middle", 0);
if(skewtype > 0 && skewtype <= 4)
{
double diff;
Line2D line;
if (skewtype == 1)
(diff, line) = GetZDiff(true, Sidedef.IsFront);
else if(skewtype == 2)
(diff, line) = GetZDiff(false, Sidedef.IsFront);
else if(skewtype == 3)
(diff, line) = GetZDiff(true, !Sidedef.IsFront);
else // skewtype 4
(diff, line) = GetZDiff(false, !Sidedef.IsFront);
Vector2D v3 = line.GetPerpendicular() * 10 + line.v1;
Plane topplane = new Plane(
new Vector3D(line.v1, textop),
new Vector3D(line.v2, textop + diff),
new Vector3D(v3, textop),
false);
Plane bottomplane = new Plane(
new Vector3D(line.v1, texbottom),
new Vector3D(line.v2, texbottom + diff),
new Vector3D(v3, textop),
true);
return (topplane, bottomplane);
}
else // Invalid skew type
{
return (
new Plane(new Vector3D(0, 0, -1), textop),
new Plane(new Vector3D(0, 0, 1), -texbottom)
);
}
}
else if (General.Map.Config.SkewStyle == Config.SkewStyle.EternityEngine)
{
double diff;
Line2D line;
if (skewtype == "front_ceiling")
(diff, line) = GetZDiff(false, true);
else if(skewtype == "back_ceiling")
(diff, line) = GetZDiff(false, false);
else if(skewtype == "front_floor")
(diff, line) = GetZDiff(true, true);
else // back_floor
(diff, line) = GetZDiff(true, false);
Vector2D v3 = line.GetPerpendicular() * 10 + line.v1;
Plane topplane = new Plane(
new Vector3D(line.v1, textop),
new Vector3D(line.v2, textop + diff),
new Vector3D(v3, textop),
false);
Plane bottomplane = new Plane(
new Vector3D(line.v1, texbottom),
new Vector3D(line.v2, texbottom + diff),
new Vector3D(v3, textop),
true);
return (topplane, bottomplane);
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
{
double diff;
Line2D line;
if (skewtype == "front_ceiling")
(diff, line) = GetZDiff(false, true);
else if (skewtype == "back_ceiling")
(diff, line) = GetZDiff(false, false);
else if (skewtype == "front_floor")
(diff, line) = GetZDiff(true, true);
else // back_floor
(diff, line) = GetZDiff(true, false);
Vector2D v3 = line.GetPerpendicular() * 10 + line.v1;
Plane topplane = new Plane(
new Vector3D(line.v1, textop),
new Vector3D(line.v2, textop + diff),
new Vector3D(v3, textop),
false);
Plane bottomplane = new Plane(
new Vector3D(line.v1, texbottom),
new Vector3D(line.v2, texbottom + diff),
new Vector3D(v3, textop),
true);
return (topplane, bottomplane);
}
else // Invalid skew type
{
return (
new Plane(new Vector3D(0, 0, -1), textop),
new Plane(new Vector3D(0, 0, 1), -texbottom)
);
}
}
else // Invalid skew type
else // No matching skew style
{
return (
new Plane(new Vector3D(0, 0, -1), textop),
......
......@@ -352,21 +352,48 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!General.Map.Config.SidedefTextureSkewing)
return;
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
// We don't have to check for back because this it's single-sided
if ((skewtype == "front_floor" || skewtype == "front_ceiling") && Texture != null)
if (General.Map.Config.SkewStyle == Config.SkewStyle.GZDoom)
{
double leftz, rightz;
Plane plane = skewtype == "front_floor" ? Sector.GetSectorData().Floor.plane : Sector.GetSectorData().Ceiling.plane;
int skewtype = Sidedef.Fields.GetValue("skew_middle", 0);
if (skewtype > 0 && skewtype <= 2 && Texture != null)
{
Plane plane;
Vector2D start = Sidedef.IsFront ? Sidedef.Line.Start.Position : Sidedef.Line.End.Position;
Vector2D end = Sidedef.IsFront ? Sidedef.Line.End.Position : Sidedef.Line.Start.Position;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (skewtype == 1)
plane = Sector.GetSectorData().Floor.plane;
else // skewtype 2
plane = Sector.GetSectorData().Ceiling.plane;
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
double leftz = plane.GetZ(start);
double rightz = plane.GetZ(end);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height) * Sidedef.Fields.GetValue("scaley_mid", 1.0) / Sidedef.Fields.GetValue("scalex_mid", 1.0))
);
}
}
else if (General.Map.Config.SkewStyle == Config.SkewStyle.EternityEngine)
{
string skewtype = Sidedef.Fields.GetValue("skew_middle_type", "none");
// We don't have to check for back because this it's single-sided
if ((skewtype == "front_floor" || skewtype == "front_ceiling") && Texture != null)
{
double leftz, rightz;
Plane plane = skewtype == "front_floor" ? Sector.GetSectorData().Floor.plane : Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
}
}
}
......
......@@ -376,77 +376,108 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!General.Map.Config.SidedefTextureSkewing)
return;
string skewtype = Sidedef.Fields.GetValue("skew_top_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
if (General.Map.Config.SkewStyle == Config.SkewStyle.GZDoom)
{
double leftz, rightz;
int skewtype = Sidedef.Fields.GetValue("skew_top", 0);
if (skewtype == "front_ceiling")
if (skewtype > 0 && skewtype <= 4 && Texture != null)
{
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
Plane plane;
Vector2D start = Sidedef.IsFront ? Sidedef.Line.Start.Position : Sidedef.Line.End.Position;
Vector2D end = Sidedef.IsFront ? Sidedef.Line.End.Position : Sidedef.Line.Start.Position;
if (skewtype == 1)
plane = Sector.GetSectorData().Floor.plane;
else if (skewtype == 2)
plane = Sector.GetSectorData().Ceiling.plane;
else if (skewtype == 3)
plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
else // skewtype 4
plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
double leftz = plane.GetZ(start);
double rightz = plane.GetZ(end);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height) * Sidedef.Fields.GetValue("scaley_top", 1.0) / Sidedef.Fields.GetValue("scalex_top", 1.0))
);
}
else if (skewtype == "back_ceiling")
{
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else if(skewtype == "front_floor")
}
else if (General.Map.Config.SkewStyle == Config.SkewStyle.EternityEngine)
{
string skewtype = Sidedef.Fields.GetValue("skew_top_type", "none");
if ((skewtype == "front_floor" || skewtype == "front_ceiling" || skewtype == "back_floor" || skewtype == "back_ceiling") && Texture != null)
{
if(Sidedef.IsFront)
double leftz, rightz;
if (skewtype == "front_ceiling")
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else if (skewtype == "back_ceiling")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Ceiling.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
else // Back floor
{
if (Sidedef.IsFront)
else if (skewtype == "front_floor")
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
if (Sidedef.IsFront)
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
else
else // Back floor
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
if (Sidedef.IsFront)
{
Plane plane = mode.GetSectorData(Sidedef.Other.Sector).Floor.plane;
leftz = plane.GetZ(Sidedef.Line.Start.Position);
rightz = plane.GetZ(Sidedef.Line.End.Position);
}
else
{
Plane plane = Sector.GetSectorData().Floor.plane;
leftz = plane.GetZ(Sidedef.Line.End.Position);
rightz = plane.GetZ(Sidedef.Line.Start.Position);
}
}
}
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
skew = new Vector2f(
Vertices.Min(v => v.u), // Get the lowest horizontal texture offset
(float)((rightz - leftz) / Sidedef.Line.Length * ((double)Texture.Width / Texture.Height))
);
}
}
}
......
......@@ -187,6 +187,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
private void CreateBlockmap()
{
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
area = MapSet.IncreaseArea(area, General.Map.Map.Things);
blockmap = new BlockMap<BlockEntry>(area);
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
blockmap.AddSectorsSet(General.Map.Map.Sectors);
......@@ -435,6 +436,9 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
// To show things that will wake up we need to know the sector they are in
Parallel.ForEach(General.Map.Map.Things, t => t.DetermineSector(blockmap));
// Recreate the overlay geometry
UpdateData();
// Update
ResetSoundPropagation();
General.Interface.RedrawDisplay();
......@@ -465,6 +469,9 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
// To show things that will wake up we need to know the sector they are in
Parallel.ForEach(General.Map.Map.Things, t => t.DetermineSector(blockmap));
// Recreate the overlay geometry
UpdateData();
// Update
ResetSoundPropagation();
General.Interface.RedrawDisplay();
......
......@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.6")]
[assembly: AssemblyFileVersion("1.0.0.6")]
[assembly: AssemblyVersion("1.0.0.8")]
[assembly: AssemblyFileVersion("1.0.0.8")]
URL http://devbuilds.drdteam.org/ultimatedoombuilder/
URL https://ultimatedoombuilder.github.io/files/
FileName Builder.exe
UpdateName GZDoom_Builder_Bugfix-r[REVNUM].7z
InstallerName UltimateDoomBuilder-Setup-R[REVNUM]-[PLATFORM].exe
......
URL http://devbuilds.drdteam.org/ultimatedoombuilder/
URL https://ultimatedoombuilder.github.io/files/
FileName Builder.exe
UpdateName UltimateDoomBuilder-r[REVNUM]-x64.7z
InstallerName UltimateDoomBuilder-Setup-R[REVNUM]-x64.exe
......
URL http://devbuilds.drdteam.org/ultimatedoombuilder/
URL https://ultimatedoombuilder.github.io/files/
FileName Builder.exe
UpdateName UltimateDoomBuilder-r[REVNUM]-x86.7z
InstallerName UltimateDoomBuilder-Setup-R[REVNUM]-x86.exe
......