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;
|
|
|
|
|
private readonly float 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;
|
2013-07-08 13:13:28 +00:00
|
|
|
|
float z = ceilingVertex ? vertex.ZCeiling : vertex.ZFloor;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(!float.IsNaN(z))
|
|
|
|
|
{
|
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);
|
|
|
|
|
|
2014-09-16 08:51:27 +00:00
|
|
|
|
float 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)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
float distance2 = Line2D.GetDistanceToLineSq(from, to, vertex.Position, false);
|
|
|
|
|
return (distance2 <= cageradius2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This performs an accurate test for object picking
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override bool PickAccurate(Vector3D from, Vector3D to, Vector3D dir, ref float u_ray)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
Vector3D delta = to - from;
|
|
|
|
|
float tfar = float.MaxValue;
|
|
|
|
|
float tnear = float.MinValue;
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
float tmp = 1.0f / delta.x;
|
|
|
|
|
float t1 = (boxp1.x - from.x) * tmp;
|
|
|
|
|
float t2 = (boxp2.x - from.x) * tmp;
|
|
|
|
|
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
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
float tmp = 1.0f / delta.y;
|
|
|
|
|
float t1 = (boxp1.y - from.y) * tmp;
|
|
|
|
|
float t2 = (boxp2.y - from.y) * tmp;
|
|
|
|
|
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
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
float tmp = 1.0f / delta.z;
|
|
|
|
|
float t1 = (boxp1.z - from.z) * tmp;
|
|
|
|
|
float t2 = (boxp2.z - from.z) * tmp;
|
|
|
|
|
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) { }
|
|
|
|
|
public void OnChangeTargetBrightness(bool up) { }
|
|
|
|
|
public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { }
|
|
|
|
|
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
|
|
|
|
|
public void OnProcess(float deltatime) { }
|
|
|
|
|
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 ""; }
|
|
|
|
|
public void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
|
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
|
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 OnPasteProperties()
|
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.");
|
|
|
|
|
BuilderPlug.Me.CopiedVertexProps.Apply(vertex);
|
|
|
|
|
|
|
|
|
|
//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)
|
|
|
|
|
{
|
2013-07-08 13:13:28 +00:00
|
|
|
|
if(float.IsNaN(vertex.ZCeiling)) return;
|
|
|
|
|
vertex.ZCeiling = float.NaN;
|
|
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
{
|
2013-07-08 13:13:28 +00:00
|
|
|
|
if(float.IsNaN(vertex.ZFloor)) return;
|
|
|
|
|
vertex.ZFloor = float.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);
|
|
|
|
|
updateList.Add(vs, s.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
vertex.ZCeiling = (float.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
|
|
|
|
|
{
|
|
|
|
|
vertex.ZFloor = (float.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
|
|
|
|
|
}
|
|
|
|
|
}
|