Fixed: Assigning new tag using "New tag" button when selection already had a tag was not working.

Fixed: "Automatic clear selection in classic modes" option was broken.
This commit is contained in:
MaxED 2013-03-28 11:37:08 +00:00
parent c04a65f104
commit 5bae932013
6 changed files with 30 additions and 17 deletions

View file

@ -90,6 +90,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
if(tags.Contains(newTag)) {
cbTagPicker.SelectedIndex = tags.IndexOf(newTag);
} else {
cbTagPicker.SelectedIndex = -1;
cbTagPicker.Text = newTag.ToString();
}
tag = newTag;
@ -150,6 +151,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private void newTag_Click(object sender, EventArgs e) {
//todo: check tag labels?
tag = General.Map.Map.GetNewTag();
cbTagPicker.SelectedIndex = -1;
cbTagPicker.Text = tag.ToString();
valid = true;
}

View file

@ -126,7 +126,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
ControlHandle handle = controlHandles[curControlHandle];
if (snaptogrid) {
handle.Position = DrawGeometryMode.GetCurrentPosition(mousemappos, false, true, renderer, new List<DrawnVertex>()).pos;
handle.Position = General.Map.Grid.SnappedToGrid(mousemappos);// DrawGeometryMode.GetCurrentPosition(mousemappos, false, true, renderer, new List<DrawnVertex>()).pos;
} else {
handle.Position = mousemappos;
}
@ -475,7 +475,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
relLenGroup[0] = 0.0f;
//get length and angle of line, which defines the shape
float length = getLineLength(pointGroup[0], pointGroup[segmentsCount - 1]);
float length = Vector2D.Distance(pointGroup[0], pointGroup[segmentsCount - 1]);// getLineLength(pointGroup[0], pointGroup[segmentsCount - 1]);
float angle = (float)Math.Atan2(pointGroup[0].y - pointGroup[segmentsCount - 1].y, pointGroup[0].x - pointGroup[segmentsCount - 1].x);
float curAngle, diff, segLen;
@ -487,7 +487,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
p1 = pointGroup[i];
curAngle = (float)Math.Atan2(p0.y - p1.y, p0.x - p1.x);
diff = (angle + (float)Math.PI) - (curAngle + (float)Math.PI);
segLen = (int)(getLineLength(p0, p1) * Math.Cos(diff));
segLen = (int)(Vector2D.Distance(p0, p1) * Math.Cos(diff));
relLenGroup[i] = relLenGroup[i - 1] + segLen / length;
}
@ -496,12 +496,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes {
return relLenGroup;
}
private float getLineLength(Vector2D p0, Vector2D p1) {
float vx = Math.Abs(p0.x - p1.x);
float vy = Math.Abs(p0.y - p1.y);
return (float)Math.Sqrt(vx * vx + vy * vy);
}
//this returns relative handle location
private Vector2D getHandleLocation(Vector2D start, Vector2D end, Vector2D direction) {
float angle = -(float)Math.Atan2(start.y - end.y, start.x - end.x);

View file

@ -332,6 +332,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Finish();
renderer.Present();
}
//mxd
} else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedLinedefsCount > 0) {
General.Map.Map.ClearSelectedLinedefs();
General.Interface.RedrawDisplay();
}
}
@ -540,8 +544,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
bool selectionvolume = ((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f));
if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
General.Map.Map.ClearSelectedLinedefs();
//if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
//General.Map.Map.ClearSelectedLinedefs();
if(selectionvolume)
{

View file

@ -555,6 +555,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(TextLabel l in labelarray) l.Color = General.Colors.Highlight;
UpdateOverlay();
renderer.Present();
//mxd
} else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedSectorsCount > 0) {
General.Map.Map.ClearSelectedLinedefs();
General.Map.Map.ClearSelectedSectors();
General.Interface.RedrawDisplay();
}
}
@ -819,11 +824,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
bool selectionvolume = ((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f));
if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
/*if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
{
General.Map.Map.ClearSelectedLinedefs();
General.Map.Map.ClearSelectedSectors();
}
}*/
if(selectionvolume)
{

View file

@ -318,6 +318,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Finish();
renderer.Present();
}
//mxd
} else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedThingsCount > 0) {
General.Map.Map.ClearSelectedThings();
General.Interface.RedrawDisplay();
}
}
@ -544,8 +548,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
bool selectionvolume = ((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f));
if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
General.Map.Map.ClearSelectedThings();
//if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
//General.Map.Map.ClearSelectedThings();
if(selectionvolume)
{

View file

@ -232,6 +232,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Finish();
renderer.Present();
}
//mxd
} else if(BuilderPlug.Me.AutoClearSelection && General.Map.Map.SelectedVerticessCount > 0) {
General.Map.Map.ClearSelectedVertices();
General.Interface.RedrawDisplay();
}
}
@ -501,8 +505,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
bool selectionvolume = ((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f));
if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
General.Map.Map.ClearSelectedVertices();
//if(BuilderPlug.Me.AutoClearSelection && !selectionvolume)
//General.Map.Map.ClearSelectedVertices();
if(selectionvolume)
{