UltimateZoneBuilder/Source/Plugins/SoundPropagationMode/Windows/ReverbsPickerForm.cs
MaxED 1c769eec3f Core, internal: added ReverbsParser. Reverbs can be accessed using General.Map.Data.Reverbs.
Sound Environment Mode: sound environments can now be picked by editing sound environment things.
Sound Environment Mode: detected sound environments names are now used as item names in the tree view.
Fixed, Classic modes: incorrect texture was used as unknown floor/ceiling texture (I broke this in r2199).
Fixed, MainForm: reverted MainForm.UpdateToolStripSeparators. By making it look simpler I made it work more buggy...
Updated ZDoom_DECORATE.cfg.
2015-01-25 23:22:42 +00:00

75 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.SoundPropagationMode
{
public partial class ReverbsPickerForm : Form
{
private struct ReverbListItem
{
private readonly string name;
public readonly int Arg0;
public readonly int Arg1;
public ReverbListItem(string name, int arg0, int arg1)
{
this.name = name + " (" + arg0 + " " + arg1 + ")";
Arg0 = arg0;
Arg1 = arg1;
}
public override string ToString()
{
return name;
}
}
public ReverbsPickerForm(Thing t)
{
InitializeComponent();
// Fill the list
foreach(KeyValuePair<string, KeyValuePair<int, int>> reverb in General.Map.Data.Reverbs)
{
list.Items.Add(new ReverbListItem(reverb.Key, reverb.Value.Key, reverb.Value.Value));
}
// Select suitable item
foreach(var item in list.Items)
{
ReverbListItem rli = (ReverbListItem)item;
if(rli.Arg0 == t.Args[0] && rli.Arg1 == t.Args[1])
{
list.SelectedItem = item;
break;
}
}
// Dormant?
cbactiveenv.Checked = !BuilderPlug.ThingDormant(t);
list.Focus();
}
public void ApplyTo(Thing t)
{
if(list.SelectedItem == null) return;
ReverbListItem rli = (ReverbListItem)list.SelectedItem;
t.Args[0] = rli.Arg0;
t.Args[1] = rli.Arg1;
BuilderPlug.SetThingDormant(t, !cbactiveenv.Checked);
}
private void list_MouseDoubleClick(object sender, MouseEventArgs e)
{
if(list.SelectedItem != null) accept_Click(accept, EventArgs.Empty);
}
private void accept_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}