2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
using System.Windows.Forms;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
2015-09-10 17:38:27 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
|
|
|
|
|
|
|
|
|
#endregion
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
|
|
|
|
internal class BaseVisualVertex : VisualVertex, IVisualEventReceiver
|
|
|
|
|
{
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
2015-09-10 17:38:27 +00:00
|
|
|
|
private readonly BaseVisualMode mode;
|
2020-05-21 12:20:02 +00:00
|
|
|
|
private readonly double cageradius2;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
private Vector3D boxp1;
|
|
|
|
|
private Vector3D boxp2;
|
|
|
|
|
|
|
|
|
|
// Undo/redo
|
|
|
|
|
private int undoticket;
|
|
|
|
|
|
2013-07-10 08:59:17 +00:00
|
|
|
|
//updating
|
|
|
|
|
private static Dictionary<BaseVisualSector, bool> updateList;
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
|
public BaseVisualVertex(BaseVisualMode mode, Vertex v, bool ceilingVertex)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
: base(v, ceilingVertex)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
this.mode = mode;
|
2014-09-16 08:51:27 +00:00
|
|
|
|
cageradius2 = DEFAULT_SIZE * General.Settings.GZVertexScale3D * Angle2D.SQRT2;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
cageradius2 = cageradius2 * cageradius2;
|
|
|
|
|
|
2015-09-10 17:38:27 +00:00
|
|
|
|
// Synchronize selection?
|
|
|
|
|
if(mode.UseSelectionFromClassicMode && v.Selected
|
|
|
|
|
&& (General.Map.ViewMode == ViewMode.Normal ||
|
|
|
|
|
(!ceilingVertex && General.Map.ViewMode == ViewMode.FloorTextures)
|
|
|
|
|
|| (ceilingVertex && General.Map.ViewMode == ViewMode.CeilingTextures)))
|
|
|
|
|
{
|
|
|
|
|
this.selected = true;
|
|
|
|
|
mode.AddSelectedObject(this);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
changed = true;
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//this updates the handle itself
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void Update()
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(!changed) return;
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double z = ceilingVertex ? vertex.ZCeiling : vertex.ZFloor;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2020-05-21 12:20:02 +00:00
|
|
|
|
if(!double.IsNaN(z))
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-09-05 13:30:59 +00:00
|
|
|
|
haveOffset = true;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
z = GetSectorHeight();
|
2013-05-02 11:03:16 +00:00
|
|
|
|
haveOffset = false;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vector3D pos = new Vector3D(vertex.Position.x, vertex.Position.y, z);
|
|
|
|
|
SetPosition(pos);
|
|
|
|
|
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double radius = DEFAULT_SIZE * General.Settings.GZVertexScale3D;
|
2015-03-27 13:18:54 +00:00
|
|
|
|
boxp1 = new Vector3D(pos.x - radius, pos.y - radius, (ceilingVertex ? pos.z - radius : pos.z));
|
|
|
|
|
boxp2 = new Vector3D(pos.x + radius, pos.y + radius, (ceilingVertex ? pos.z : pos.z + radius));
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
changed = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateGeometry(Vertex v)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
VertexData vd = mode.GetVertexData(v);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, bool> s in vd.UpdateAlso)
|
|
|
|
|
{
|
|
|
|
|
if(mode.VisualSectorExists(s.Key))
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
|
|
|
|
|
vs.UpdateSectorGeometry(s.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-08 13:13:28 +00:00
|
|
|
|
//get the most appropriate height from sectors
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private int GetSectorHeight()
|
|
|
|
|
{
|
2013-09-05 13:30:59 +00:00
|
|
|
|
int height;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
VertexData vd = mode.GetVertexData(vertex);
|
|
|
|
|
Sector[] sectors = new Sector[vd.UpdateAlso.Keys.Count];
|
|
|
|
|
vd.UpdateAlso.Keys.CopyTo(sectors, 0);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(ceilingVertex)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
height = sectors[0].CeilHeight;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 1; i < sectors.Length; i++)
|
|
|
|
|
{
|
2013-05-02 11:03:16 +00:00
|
|
|
|
if(sectors[i].CeilHeight < height)
|
2013-03-18 13:52:27 +00:00
|
|
|
|
height = sectors[i].CeilHeight;
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
height = sectors[0].FloorHeight;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 1; i < sectors.Length; i++)
|
|
|
|
|
{
|
2013-05-02 11:03:16 +00:00
|
|
|
|
if(sectors[i].FloorHeight > height)
|
2013-03-18 13:52:27 +00:00
|
|
|
|
height = sectors[i].FloorHeight;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return height;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 11:06:01 +00:00
|
|
|
|
//mxd
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public bool IsSelected()
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-04-01 11:06:01 +00:00
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
#region ================== Object picking
|
|
|
|
|
|
|
|
|
|
// This performs a fast test in object picking
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double distance2 = Line2D.GetDistanceToLineSq(from, to, vertex.Position, false);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
return (distance2 <= cageradius2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This performs an accurate test for object picking
|
2020-05-21 12:20:02 +00:00
|
|
|
|
public override bool PickAccurate(Vector3D from, Vector3D to, Vector3D dir, ref double u_ray)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
Vector3D delta = to - from;
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double tfar = float.MaxValue;
|
|
|
|
|
double tnear = float.MinValue;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
// Ray-Box intersection code
|
|
|
|
|
// See http://www.masm32.com/board/index.php?topic=9941.0
|
|
|
|
|
|
|
|
|
|
// Check X slab
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(delta.x == 0.0f)
|
|
|
|
|
{
|
|
|
|
|
if(from.x > boxp2.x || from.x < boxp1.x)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray is parallel to the planes & outside slab
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double tmp = 1.0f / delta.x;
|
|
|
|
|
double t1 = (boxp1.x - from.x) * tmp;
|
|
|
|
|
double t2 = (boxp2.x - from.x) * tmp;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(t1 > t2)
|
|
|
|
|
General.Swap(ref t1, ref t2);
|
|
|
|
|
if(t1 > tnear)
|
|
|
|
|
tnear = t1;
|
|
|
|
|
if(t2 < tfar)
|
|
|
|
|
tfar = t2;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(tnear > tfar || tfar < 0.0f)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray missed box or box is behind ray
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check Y slab
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(delta.y == 0.0f)
|
|
|
|
|
{
|
|
|
|
|
if(from.y > boxp2.y || from.y < boxp1.y)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray is parallel to the planes & outside slab
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double tmp = 1.0f / delta.y;
|
|
|
|
|
double t1 = (boxp1.y - from.y) * tmp;
|
|
|
|
|
double t2 = (boxp2.y - from.y) * tmp;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(t1 > t2)
|
|
|
|
|
General.Swap(ref t1, ref t2);
|
|
|
|
|
if(t1 > tnear)
|
|
|
|
|
tnear = t1;
|
|
|
|
|
if(t2 < tfar)
|
|
|
|
|
tfar = t2;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(tnear > tfar || tfar < 0.0f)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray missed box or box is behind ray
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check Z slab
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(delta.z == 0.0f)
|
|
|
|
|
{
|
|
|
|
|
if(from.z > boxp2.z || from.z < boxp1.z)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray is parallel to the planes & outside slab
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
double tmp = 1.0f / delta.z;
|
|
|
|
|
double t1 = (boxp1.z - from.z) * tmp;
|
|
|
|
|
double t2 = (boxp2.z - from.z) * tmp;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(t1 > t2)
|
|
|
|
|
General.Swap(ref t1, ref t2);
|
|
|
|
|
if(t1 > tnear)
|
|
|
|
|
tnear = t1;
|
|
|
|
|
if(t2 < tfar)
|
|
|
|
|
tfar = t2;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(tnear > tfar || tfar < 0.0f)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Ray missed box or box is behind ray
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set interpolation point
|
|
|
|
|
u_ray = (tnear > 0.0f) ? tnear : tfar;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Unused events
|
|
|
|
|
|
|
|
|
|
// Unused
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnSelectBegin() { }
|
|
|
|
|
public void OnEditBegin() { }
|
|
|
|
|
public void OnMouseMove(MouseEventArgs e) { }
|
2023-09-19 15:53:27 +00:00
|
|
|
|
public void OnChangeTargetBrightness(bool up, bool local) { }
|
2023-09-29 18:44:04 +00:00
|
|
|
|
public bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { return true; }
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnChangeScale(int incrementX, int incrementY) { }
|
|
|
|
|
public void OnSelectTexture() { }
|
|
|
|
|
public void OnCopyTexture() { }
|
|
|
|
|
public void OnPasteTexture() { }
|
|
|
|
|
public void OnCopyTextureOffsets() { }
|
|
|
|
|
public void OnPasteTextureOffsets() { }
|
|
|
|
|
public void OnTextureAlign(bool alignx, bool aligny) { }
|
|
|
|
|
public void OnTextureFit(FitTextureOptions options) { } //mxd
|
|
|
|
|
public void OnToggleUpperUnpegged() { }
|
|
|
|
|
public void OnToggleLowerUnpegged() { }
|
|
|
|
|
public void OnResetTextureOffset() { }
|
|
|
|
|
public void OnResetLocalTextureOffset() { } //mxd
|
2016-03-14 10:25:27 +00:00
|
|
|
|
public void OnProcess(long deltatime) { }
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnTextureFloodfill() { }
|
|
|
|
|
public void OnInsert() { }
|
|
|
|
|
public void ApplyTexture(string texture) { }
|
|
|
|
|
public void ApplyUpperUnpegged(bool set) { }
|
|
|
|
|
public void ApplyLowerUnpegged(bool set) { }
|
|
|
|
|
public string GetTextureName() { return ""; }
|
2023-10-14 12:24:09 +00:00
|
|
|
|
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight, bool stopatselected) { } //mxd
|
2019-01-19 07:56:13 +00:00
|
|
|
|
public virtual void OnPaintSelectBegin() { } // biwa
|
|
|
|
|
public virtual void OnPaintSelectEnd() { } // biwa
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
|
|
|
|
// Select or deselect
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnSelectEnd()
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
|
|
|
|
if(this.selected)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
this.selected = false;
|
|
|
|
|
mode.RemoveSelectedObject(this);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
this.selected = true;
|
|
|
|
|
mode.AddSelectedObject(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Copy properties
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnCopyProperties()
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
BuilderPlug.Me.CopiedVertexProps = new VertexProperties(vertex);
|
|
|
|
|
mode.SetActionResult("Copied vertex properties.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Paste properties
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
public void OnPasteProperties(bool usecopysettings)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
|
|
|
|
if(BuilderPlug.Me.CopiedVertexProps != null)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
mode.CreateUndo("Paste vertex properties");
|
|
|
|
|
mode.SetActionResult("Pasted vertex properties.");
|
2016-10-11 12:58:35 +00:00
|
|
|
|
BuilderPlug.Me.CopiedVertexProps.Apply(new List<Vertex> { vertex }, usecopysettings);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//update affected sectors
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry(vertex);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
changed = true;
|
|
|
|
|
mode.ShowTargetInfo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-02 07:47:22 +00:00
|
|
|
|
//Delete key pressed - remove zoffset field
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnDelete()
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-07-31 12:38:47 +00:00
|
|
|
|
mode.CreateUndo("Clear vertex height offset");
|
|
|
|
|
mode.SetActionResult("Cleared vertex height offset.");
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(ceilingVertex)
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
if(double.IsNaN(vertex.ZCeiling)) return;
|
|
|
|
|
vertex.ZCeiling = double.NaN;
|
2013-07-08 13:13:28 +00:00
|
|
|
|
|
|
|
|
|
//update affected sectors
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry(vertex);
|
2013-07-08 13:13:28 +00:00
|
|
|
|
changed = true;
|
|
|
|
|
mode.ShowTargetInfo();
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
if(double.IsNaN(vertex.ZFloor)) return;
|
|
|
|
|
vertex.ZFloor = double.NaN;
|
2013-05-02 07:47:22 +00:00
|
|
|
|
|
|
|
|
|
//update affected sectors
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry(vertex);
|
2013-05-02 07:47:22 +00:00
|
|
|
|
changed = true;
|
|
|
|
|
mode.ShowTargetInfo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Edit button released
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnEditEnd()
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
|
|
|
|
if(General.Interface.IsActiveWindow)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
List<Vertex> verts = mode.GetSelectedVertices();
|
2013-07-10 08:59:17 +00:00
|
|
|
|
updateList = new Dictionary<BaseVisualSector, bool>();
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Vertex v in verts)
|
|
|
|
|
{
|
2013-07-10 08:59:17 +00:00
|
|
|
|
VertexData vd = mode.GetVertexData(v);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(KeyValuePair<Sector, bool> s in vd.UpdateAlso)
|
|
|
|
|
{
|
|
|
|
|
if(mode.VisualSectorExists(s.Key))
|
|
|
|
|
{
|
2013-07-10 08:59:17 +00:00
|
|
|
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
|
2015-12-09 19:10:46 +00:00
|
|
|
|
if(!updateList.ContainsKey(vs)) updateList.Add(vs, s.Value);
|
2013-07-10 08:59:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 11:19:12 +00:00
|
|
|
|
General.Interface.OnEditFormValuesChanged += Interface_OnEditFormValuesChanged;
|
2013-07-19 15:30:58 +00:00
|
|
|
|
mode.StartRealtimeInterfaceUpdate(SelectionType.Vertices);
|
2013-07-08 13:13:28 +00:00
|
|
|
|
General.Interface.ShowEditVertices(verts, false);
|
2013-07-19 15:30:58 +00:00
|
|
|
|
mode.StopRealtimeInterfaceUpdate(SelectionType.Vertices);
|
2013-07-10 09:57:30 +00:00
|
|
|
|
General.Interface.OnEditFormValuesChanged -= Interface_OnEditFormValuesChanged;
|
2013-07-10 08:59:17 +00:00
|
|
|
|
|
|
|
|
|
updateList.Clear();
|
|
|
|
|
updateList = null;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-08 13:13:28 +00:00
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void Interface_OnEditFormValuesChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
2013-07-10 08:59:17 +00:00
|
|
|
|
foreach(KeyValuePair<BaseVisualSector, bool> group in updateList)
|
|
|
|
|
group.Key.UpdateSectorGeometry(group.Value);
|
2013-07-08 13:13:28 +00:00
|
|
|
|
|
|
|
|
|
changed = true;
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Raise/lower thing
|
Fixed, Draw Lines/Rectangle/Circle/Curve modes: line length labels displayed incorrect length.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: line length labels are now displayed the same way as in Draw modes.
Changed, Drag Linedefs/Vertices/Sectors/Things modes: "lock movement to cardinal directions" mode (Alt-Shift-Drag) now locks movement in 4 directions instead of 8 and doesn't snap map elements to nearest grid intersections when they are not aligned to it.
Added, Visual mode, GZDoom, DECORATE: FORCEXYBILLBOARD flag is now supported.
Added, Visual mode, GLOOME, DECORATE: FLOORSPRITE, CEILSPRITE, WALLSPRITE, ROLLSPRITE and STICKTOPLANE flags are now supported (implementation is somewhat broken ATM and probably doesn't work the same way as in GLOOME, because Windows build with most these features is nowhere to be found...).
Fixed, Visual mode: in some cases Thing brightness was calculated incorrectly.
Updated ZDoom_DECORATE.cfg.
2015-08-25 22:05:14 +00:00
|
|
|
|
public void OnChangeTargetHeight(int amount)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
|
|
|
|
|
undoticket = mode.CreateUndo("Change vertex height");
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(ceilingVertex)
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
vertex.ZCeiling = (double.IsNaN(vertex.ZCeiling) ? GetSectorHeight() + amount : vertex.ZCeiling + amount);
|
2013-09-05 13:30:59 +00:00
|
|
|
|
mode.SetActionResult("Changed vertex height to " + vertex.ZCeiling + ".");
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-05-21 12:20:02 +00:00
|
|
|
|
vertex.ZFloor = (double.IsNaN(vertex.ZFloor) ? GetSectorHeight() + amount : vertex.ZFloor + amount);
|
2013-09-05 13:30:59 +00:00
|
|
|
|
mode.SetActionResult("Changed vertex height to " + vertex.ZFloor + ".");
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update what must be updated
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry(vertex);
|
2013-05-02 07:47:22 +00:00
|
|
|
|
changed = true;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|