Fixed: selected items info was not updated when deleting a map element.

Changed, Sound Environments mode: previously selected sound environment is now automatically selected when inserting a new sound environment item. Also it's now impossible to accept the form without selecting a sound environment.
Changed, Sound Propagation mode: single-sided lines with sound zone boundary flag are now highlightable and clickable.
This commit is contained in:
MaxED 2015-06-30 18:34:08 +00:00
parent 6732e31493
commit 2f77560b55
10 changed files with 40 additions and 10 deletions

View file

@ -983,6 +983,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
OnMouseMove(e);
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
General.Interface.RedrawDisplay();
}
@ -1052,6 +1053,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
OnMouseMove(e);
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
General.Interface.RedrawDisplay();
}

View file

@ -1618,6 +1618,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
UpdateSelectedLabels();
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
General.Interface.RedrawDisplay();
}

View file

@ -888,6 +888,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
OnMouseMove(e);
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
}

View file

@ -936,6 +936,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
OnMouseMove(e);
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
General.Interface.RedrawDisplay();
}
@ -1014,6 +1015,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
OnMouseMove(e);
// Redraw screen
UpdateSelectionInfo(); //mxd
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
General.Interface.RedrawDisplay();
}

View file

@ -434,7 +434,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
private static bool LinedefBlocksSoundEnvironment(Linedef linedef)
{
if(General.Map.UDMF) return linedef.IsFlagSet("zoneboundary"); //mxd. Fancier this way :)
if(General.Map.UDMF) return linedef.IsFlagSet(SoundEnvironmentMode.ZoneBoundaryFlag); //mxd. Fancier this way :)
// In Hexen format the line must have action 121 (Line_SetIdentification) and bit 1 of
// the second argument set (see http://zdoom.org/wiki/Line_SetIdentification)

View file

@ -62,6 +62,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
internal const string ZoneBoundaryFlag = "zoneboundary"; //mxd
#endregion
@ -194,7 +195,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
General.Map.UndoRedo.CreateUndo("Toggle Sound Zone Boundary");
// Toggle flag
highlightedline.SetFlag("zoneboundary", !highlightedline.IsFlagSet("zoneboundary"));
highlightedline.SetFlag(ZoneBoundaryFlag, !highlightedline.IsFlagSet(ZoneBoundaryFlag));
// Update
UpdateData();
@ -385,7 +386,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
//mxd. Find the nearest linedef within default highlight range
l = General.Map.Map.NearestLinedefRange(mousemappos, 20 / renderer.Scale);
//mxd. We are not interested in single-sided lines, unless they have zoneboundary flag...
if(l != null && ((l.Front == null || l.Back == null) && (General.Map.UDMF && !l.IsFlagSet("zoneboundary"))))
if(l != null && ((l.Front == null || l.Back == null) && (General.Map.UDMF && !l.IsFlagSet(ZoneBoundaryFlag))))
{
l = null;
}

View file

@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
foreach (Sidedef sd in sector.Sidedefs)
{
bool blocksound = sd.Line.IsFlagSet(General.Map.UDMF ? "blocksound" : "64");
bool blocksound = sd.Line.IsFlagSet(SoundPropagationMode.BlockSoundFlag);
if (blocksound) blockinglines.Add(sd.Line);
// If the line is one sided, the sound can travel nowhere, so try the next one

View file

@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
internal static string BlockSoundFlag { get { return (General.Map.UDMF ? "blocksound" : "64"); } } //mxd
#endregion
@ -123,7 +124,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
BuilderPlug.Me.BlockingLinedefs.Clear();
foreach (Linedef ld in General.Map.Map.Linedefs)
if (ld.IsFlagSet(General.Map.UDMF ? "blocksound" : "64"))
if (ld.IsFlagSet(BlockSoundFlag))
BuilderPlug.Me.BlockingLinedefs.Add(ld);
if (highlighted == null || highlighted.IsDisposed) return;
@ -336,8 +337,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
General.Map.UndoRedo.CreateUndo("Toggle Linedef Sound Blocking");
// Toggle flag
string flag = (General.Map.UDMF ? "blocksound" : "64");
highlightedline.SetFlag(flag, !highlightedline.IsFlagSet(flag));
highlightedline.SetFlag(BlockSoundFlag, !highlightedline.IsFlagSet(BlockSoundFlag));
// Update
ResetSoundPropagation();
@ -397,8 +397,8 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
//mxd. Find the nearest linedef within default highlight range
l = General.Map.Map.NearestLinedefRange(mousemappos, 20 / renderer.Scale);
//mxd. We are not interested in single-sided lines...
if(l != null && (l.Front == null || l.Back == null)) l = null;
//mxd. We are not interested in single-sided lines (unless they have "blocksound" flag set)...
if(l != null && (l.Front == null || l.Back == null) && !l.IsFlagSet(BlockSoundFlag)) l = null;
//mxd. Set as highlighted
if(highlightedline != l)

View file

@ -44,7 +44,7 @@
this.groupBox1.Size = new System.Drawing.Size(190, 351);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Sound Environments ";
this.groupBox1.Text = " Sound Environments: ";
//
// list
//
@ -55,10 +55,12 @@
this.list.Size = new System.Drawing.Size(184, 329);
this.list.TabIndex = 0;
this.list.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.list_MouseDoubleClick);
this.list.SelectedIndexChanged += new System.EventHandler(this.list_SelectedIndexChanged);
//
// accept
//
this.accept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.accept.Enabled = false;
this.accept.Location = new System.Drawing.Point(14, 394);
this.accept.Name = "accept";
this.accept.Size = new System.Drawing.Size(91, 23);

View file

@ -27,6 +27,8 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
}
}
private static string previousenvironmentname;
public ReverbsPickerForm(Thing t)
{
InitializeComponent();
@ -48,6 +50,19 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
}
}
// Select previously selected item?
if(!string.IsNullOrEmpty(previousenvironmentname) && list.SelectedItem == null)
{
foreach(ReverbListItem item in list.Items)
{
if(item.ToString() == previousenvironmentname)
{
list.SelectedItem = item;
break;
}
}
}
// Dormant?
cbactiveenv.Checked = !BuilderPlug.ThingDormant(t);
list.Focus();
@ -69,8 +84,14 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
private void accept_Click(object sender, EventArgs e)
{
if(list.SelectedItem != null) previousenvironmentname = list.SelectedItem.ToString();
this.DialogResult = DialogResult.OK;
this.Close();
}
private void list_SelectedIndexChanged(object sender, EventArgs e)
{
accept.Enabled = (list.SelectedItem != null);
}
}
}