mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-14 00:20:40 +00:00
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:
parent
264ae55a03
commit
0d726c6884
6 changed files with 51 additions and 25 deletions
|
@ -57,6 +57,7 @@ zdoom
|
||||||
115 = "Instant death";
|
115 = "Instant death";
|
||||||
116 = "Delayed damage strong (hazardcount +4/16 per second)";
|
116 = "Delayed damage strong (hazardcount +4/16 per second)";
|
||||||
118 = "Carry player by tag";
|
118 = "Carry player by tag";
|
||||||
|
195 = "Hidden Sector (automap)";
|
||||||
196 = "Healing Sector";
|
196 = "Healing Sector";
|
||||||
197 = "Lightning Outdoor";
|
197 = "Lightning Outdoor";
|
||||||
198 = "Lightning Indoor 2";
|
198 = "Lightning Indoor 2";
|
||||||
|
|
|
@ -208,8 +208,11 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// This scrolls anywhere
|
// This scrolls anywhere
|
||||||
private void ScrollBy(float deltax, float deltay)
|
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
|
// Scroll now
|
||||||
renderer2d.PositionView(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
|
renderer2d.PositionView(offset.x, offset.y);
|
||||||
this.OnViewChanged();
|
this.OnViewChanged();
|
||||||
|
|
||||||
// Redraw
|
// Redraw
|
||||||
|
@ -265,9 +268,10 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
|
|
||||||
// Calculate view position difference
|
// Calculate view position difference
|
||||||
Vector2D diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos;
|
Vector2D diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos;
|
||||||
|
Vector2D offset = ClampViewOffset(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y); //mxd
|
||||||
|
|
||||||
// Zoom now
|
// Zoom now
|
||||||
renderer2d.PositionView(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y);
|
renderer2d.PositionView(offset.x, offset.y);
|
||||||
renderer2d.ScaleView(newscale);
|
renderer2d.ScaleView(newscale);
|
||||||
this.OnViewChanged();
|
this.OnViewChanged();
|
||||||
|
|
||||||
|
@ -281,6 +285,15 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
if(mouseinside) OnMouseMove(new MouseEventArgs(mousebuttons, 0, (int)mousepos.x, (int)mousepos.y, 0));
|
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
|
//mxd. This changes current grid size based on current zoom level
|
||||||
internal void MatchGridSizeToDisplayScale()
|
internal void MatchGridSizeToDisplayScale()
|
||||||
{
|
{
|
||||||
|
@ -659,7 +672,7 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
if(General.Settings.GZSynchCameras && !General.Interface.CtrlState
|
if(General.Settings.GZSynchCameras && !General.Interface.CtrlState
|
||||||
&& General.Editing.PreviousMode != null && General.Editing.PreviousMode.IsSubclassOf(typeof(VisualMode)))
|
&& 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);
|
renderer2d.PositionView(campos.x, campos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2122,22 +2122,11 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
//mxd. Remove remaining new verts from dragged shape if possible
|
//mxd. Remove remaining new verts from dragged shape if possible
|
||||||
if(mergemode == MergeGeometryMode.REPLACE)
|
if(mergemode == MergeGeometryMode.REPLACE)
|
||||||
{
|
{
|
||||||
// Get lines, which belong to dragged sectors
|
// Collect verts created by splitting. Can't use GetMarkedVertices here, because we are in the middle of AddRemove
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
HashSet<Vertex> tocheck = new HashSet<Vertex>();
|
HashSet<Vertex> tocheck = new HashSet<Vertex>();
|
||||||
|
foreach(Vertex v in vertices)
|
||||||
foreach(Linedef l in sectorlines)
|
|
||||||
{
|
{
|
||||||
if(l.IsDisposed) continue;
|
if(v != null && v.Marked && !movingverts.Contains(v)) tocheck.Add(v);
|
||||||
if(!movingverts.Contains(l.Start)) tocheck.Add(l.Start);
|
|
||||||
if(!movingverts.Contains(l.End)) tocheck.Add(l.End);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove verts, which are not part of initially dragged verts
|
// Remove verts, which are not part of initially dragged verts
|
||||||
|
|
|
@ -943,15 +943,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a point
|
// Remove last point
|
||||||
[BeginAction("removepoint")]
|
[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(points.Count > 0 && points.Count > index) points.RemoveAt(index);
|
||||||
if(labels.Count > 0)
|
if(labels.Count > 0 && labels.Count > index)
|
||||||
{
|
{
|
||||||
labels[labels.Count - 1].Dispose();
|
labels[index].Dispose();
|
||||||
labels.RemoveAt(labels.Count - 1);
|
labels.RemoveAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
|
|
@ -381,6 +381,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RemoveFirstPoint()
|
||||||
|
{
|
||||||
|
RemovePoint();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
|
@ -323,14 +323,25 @@ drawpoint
|
||||||
|
|
||||||
removepoint
|
removepoint
|
||||||
{
|
{
|
||||||
title = "Remove Previous Vertex";
|
title = "Remove Last Vertex";
|
||||||
category = "drawing";
|
category = "drawing";
|
||||||
description = "Removes the previously drawn vertex from the drawing session.";
|
description = "Removes the last drawn vertex from the drawing session.";
|
||||||
allowkeys = true;
|
allowkeys = true;
|
||||||
allowmouse = true;
|
allowmouse = true;
|
||||||
allowscroll = 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
|
finishdraw
|
||||||
{
|
{
|
||||||
title = "Finish Drawing";
|
title = "Finish Drawing";
|
||||||
|
|
Loading…
Reference in a new issue