Added, Draw Lines mode: added "Remove First Vertex" action (Ctrl-Backspace). It removes the first drawn vertex from the drawing session. Renamed "Remove Previous Vertex" action to "Remove Last Vertex".

Changed, Classic modes: added a limit on how far the view can be scrolled from the editable map area.
Fixed, Drag geometry modes: in some cases incorrect vertices were removed when using "Replace with dragged geometry" drag mode.
Fixed, Game configurations: sector special 195 ("Hidden Sector") was missing from Hexen/UDMF specials list.
This commit is contained in:
MaxED 2016-12-16 21:23:37 +00:00 committed by spherallic
parent 264ae55a03
commit 0d726c6884
6 changed files with 51 additions and 25 deletions

View file

@ -57,6 +57,7 @@ zdoom
115 = "Instant death";
116 = "Delayed damage strong (hazardcount +4/16 per second)";
118 = "Carry player by tag";
195 = "Hidden Sector (automap)";
196 = "Healing Sector";
197 = "Lightning Outdoor";
198 = "Lightning Indoor 2";

View file

@ -208,8 +208,11 @@ namespace CodeImp.DoomBuilder.Editing
// This scrolls anywhere
private void ScrollBy(float deltax, float deltay)
{
//mxd. Don't stroll too far from map boundaries
Vector2D offset = ClampViewOffset(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
// Scroll now
renderer2d.PositionView(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
renderer2d.PositionView(offset.x, offset.y);
this.OnViewChanged();
// Redraw
@ -265,9 +268,10 @@ namespace CodeImp.DoomBuilder.Editing
// Calculate view position difference
Vector2D diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos;
Vector2D offset = ClampViewOffset(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y); //mxd
// Zoom now
renderer2d.PositionView(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y);
renderer2d.PositionView(offset.x, offset.y);
renderer2d.ScaleView(newscale);
this.OnViewChanged();
@ -281,6 +285,15 @@ namespace CodeImp.DoomBuilder.Editing
if(mouseinside) OnMouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
}
//mxd. Makes sure given offset stays within map boundaries
private static Vector2D ClampViewOffset(float x, float y)
{
Vector2D diff = new Vector2D(x, y);
Vector2D safediff = new Vector2D(General.Clamp(diff.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary),
General.Clamp(diff.y, General.Map.Config.BottomBoundary, General.Map.Config.TopBoundary));
return diff - (diff - safediff);
}
//mxd. This changes current grid size based on current zoom level
internal void MatchGridSizeToDisplayScale()
{
@ -659,7 +672,7 @@ namespace CodeImp.DoomBuilder.Editing
if(General.Settings.GZSynchCameras && !General.Interface.CtrlState
&& General.Editing.PreviousMode != null && General.Editing.PreviousMode.IsSubclassOf(typeof(VisualMode)))
{
Vector2D campos = new Vector2D(General.Map.VisualCamera.Position.x, General.Map.VisualCamera.Position.y);
Vector2D campos = ClampViewOffset(General.Map.VisualCamera.Position.x, General.Map.VisualCamera.Position.y);
renderer2d.PositionView(campos.x, campos.y);
}

View file

@ -2122,22 +2122,11 @@ namespace CodeImp.DoomBuilder.Map
//mxd. Remove remaining new verts from dragged shape if possible
if(mergemode == MergeGeometryMode.REPLACE)
{
// Get lines, which belong to dragged sectors
HashSet<Sector> draggedsectors = GetSectorsFromLinedefs(movinglines);
HashSet<Linedef> sectorlines = new HashSet<Linedef>();
foreach(Sector s in draggedsectors)
{
foreach(Sidedef side in s.Sidedefs)
sectorlines.Add(side.Line);
}
// Collect verts created by splitting. Can't use GetMarkedVertices here, because we are in the middle of AddRemove
HashSet<Vertex> tocheck = new HashSet<Vertex>();
foreach(Linedef l in sectorlines)
foreach(Vertex v in vertices)
{
if(l.IsDisposed) continue;
if(!movingverts.Contains(l.Start)) tocheck.Add(l.Start);
if(!movingverts.Contains(l.End)) tocheck.Add(l.End);
if(v != null && v.Marked && !movingverts.Contains(v)) tocheck.Add(v);
}
// Remove verts, which are not part of initially dragged verts

View file

@ -943,15 +943,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
// Remove a point
// Remove last point
[BeginAction("removepoint")]
public virtual void RemovePoint()
public virtual void RemovePoint() { RemovePointAt(points.Count - 1); }
//mxd. Remove first point
[BeginAction("removefirstpoint")]
public virtual void RemoveFirstPoint() { RemovePointAt(0); }
//mxd
private void RemovePointAt(int index)
{
if(points.Count > 0) points.RemoveAt(points.Count - 1);
if(labels.Count > 0)
if(points.Count > 0 && points.Count > index) points.RemoveAt(index);
if(labels.Count > 0 && labels.Count > index)
{
labels[labels.Count - 1].Dispose();
labels.RemoveAt(labels.Count - 1);
labels[index].Dispose();
labels.RemoveAt(index);
}
Update();

View file

@ -381,6 +381,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
Update();
}
public override void RemoveFirstPoint()
{
RemovePoint();
}
#endregion
#region ================== Events

View file

@ -323,14 +323,25 @@ drawpoint
removepoint
{
title = "Remove Previous Vertex";
title = "Remove Last Vertex";
category = "drawing";
description = "Removes the previously drawn vertex from the drawing session.";
description = "Removes the last drawn vertex from the drawing session.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}
removefirstpoint
{
title = "Remove First Vertex";
category = "drawing";
description = "Removes the first drawn vertex from the drawing session.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
default = 131080; // Ctrl-Backspace
}
finishdraw
{
title = "Finish Drawing";