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.
This commit is contained in:
MaxED 2015-01-25 23:22:42 +00:00
parent 7bacccf3a1
commit 1c769eec3f
24 changed files with 677 additions and 58 deletions

View file

@ -161,9 +161,9 @@ keywords
A_QueueCorpse = "A_QueueCorpse";
A_RearrangePointers = "A_RearrangePointers(int target, int master, int tracer, int flags)\nflags: AAPTR flags.";
A_Respawn = "A_Respawn[(int flags = RSF_FOG)]\nflags: RSF flags";
A_ScaleVelocity = "A_ScaleVelocity(float scale)";
A_ScaleVelocity = "A_ScaleVelocity(float scale[, int pointer = AAPTR_DEFAULT])";
A_ScreamAndUnblock = "A_ScreamAndUnblock";
A_SetAngle = "A_SetAngle(float angle[, int flags])\nangle: the actor\"s new angle, in degrees.\nflags: SPF flags.";
A_SetAngle = "A_SetAngle(float angle[, int flags = 0[, int pointer = AAPTR_DEFAULT]])\nangle: the actor\"s new angle, in degrees.\nflags: SPF flags.";
A_SetArg = "A_SetArg(int position, int value)";
A_SetDamageType = "A_SetDamageType(str damagetype)";
A_SetFloat = "A_SetFloat";
@ -172,15 +172,15 @@ keywords
A_SetHealth = "A_SetHealth(int health[, int pointer = AAPTR_DEFAULT])\nhealth: The health value to set for the actor. Valid values are 1 and above.\npointer: The actor to set its health. Default is AAPTR_DEFAULT, which corresponds to the calling actor.";
A_SetInvulnerable = "A_SetInvulnerable";
A_SetMass = "A_SetMass(int mass)";
A_SetPitch = "A_SetPitch(float pitch[, int flags])\npitch: The actor\"s new pitch, in degrees.\nflags: SPF flags.";
A_SetPitch = "A_SetPitch(float pitch[, int flags = 0[, int pointer = AAPTR_DEFAULT]])\npitch: The actor\"s new pitch, in degrees.\nflags: SPF flags.";
A_SetReflective = "A_SetReflective";
A_SetReflectiveInvulnerable = "A_SetReflectiveInvulnerable";
A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX])";
A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX[, int pointer = AAPTR_DEFAULT]])";
A_SetShadow = "A_SetShadow";
A_SetShootable = "A_SetShootable";
A_SetSolid = "A_SetSolid";
A_SetSpecial = "A_SetSpecial(int special, int arg0, int arg1, int arg2, int arg3, int arg4)";
A_SetSpeed = "A_SetSpeed(float speed)";
A_SetSpeed = "A_SetSpeed(float speed[, int pointer = AAPTR_DEFAULT])";
A_SetTics = "A_SetTics(int tics)";
A_SetTranslucent = "A_SetTranslucent(float alpha[, int mode = 0])";
A_SetUserVar = "A_SetUserVar(str name, int value)";

View file

@ -514,9 +514,11 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Trackbar, Version=1.0.2486.37933, Culture=neutral, PublicKeyToken=503bf28f63ad27b4">
<Private>False</Private>
</Reference>
@ -943,6 +945,7 @@
</Compile>
<Compile Include="ZDoom\ActorStructure.cs" />
<Compile Include="ZDoom\PatchStructure.cs" />
<Compile Include="ZDoom\ReverbsParser.cs" />
<Compile Include="ZDoom\StateGoto.cs" />
<Compile Include="ZDoom\TexturesParser.cs" />
<Compile Include="ZDoom\TextureStructure.cs" />

View file

@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.Data
private Dictionary<int, ModelData> modeldefEntries; //Thing.Type, Model entry
private Dictionary<int, DynamicLightData> gldefsEntries; //Thing.Type, Light entry
private MapInfo mapInfo; //mapinfo
private Dictionary<string, KeyValuePair<int, int>> reverbs; //<name, <arg1, arg2>
// Background loading
private Queue<ImageData> imageque;
@ -112,6 +113,7 @@ namespace CodeImp.DoomBuilder.Data
internal Dictionary<int, ModelData> ModeldefEntries { get { return modeldefEntries; } }
internal Dictionary<int, DynamicLightData> GldefsEntries { get { return gldefsEntries; } }
internal MapInfo MapInfo { get { return mapInfo; } }
public Dictionary<string, KeyValuePair<int, int>> Reverbs { get { return reverbs; } }
public Playpal Palette { get { return palette; } }
public PreviewManager Previews { get { return previews; } }
@ -156,6 +158,7 @@ namespace CodeImp.DoomBuilder.Data
//mxd.
modeldefEntries = new Dictionary<int, ModelData>();
gldefsEntries = new Dictionary<int, DynamicLightData>();
reverbs = new Dictionary<string, KeyValuePair<int, int>>();
// Load special images
missingtexture3d = new ResourceImage("CodeImp.DoomBuilder.Resources.MissingTexture3D.png");
@ -318,8 +321,9 @@ namespace CodeImp.DoomBuilder.Data
spritecount = LoadThingSprites();
LoadInternalSprites();
//mxd
//mxd. Load more stuff
LoadMapInfo();
LoadReverbs();
ModelReader.Init();
LoadVoxels();
Dictionary<string, int> actorsByClass = CreateActorsByClassList();
@ -1770,6 +1774,27 @@ namespace CodeImp.DoomBuilder.Data
parser.Parse(group.Value, group.Key);
}
//mxd. This loads REVERBS
private void LoadReverbs()
{
ReverbsParser parser = new ReverbsParser();
reverbs.Clear();
foreach(DataReader dr in containers)
{
currentreader = dr;
Dictionary<string, Stream> streams = dr.GetReverbsData();
foreach(KeyValuePair<string, Stream> group in streams)
{
// Parse the data
parser.Parse(group.Value, group.Key);
}
}
currentreader = null;
reverbs = parser.GetReverbs();
}
//mxd
internal MemoryStream LoadFile(string name)
{

View file

@ -165,6 +165,9 @@ namespace CodeImp.DoomBuilder.Data
public virtual Dictionary<string, Stream> GetGldefsData(GameType gameType) { return new Dictionary<string, Stream>(); }
public virtual Dictionary<string, Stream> GetGldefsData(string location) { return new Dictionary<string, Stream>(); }
//mxd. When implemented, this returns the Reverbs lump
public virtual Dictionary<string, Stream> GetReverbsData() { return new Dictionary<string, Stream>(); }
//mxd. When implemented, this returns the list of voxel model names
public virtual string[] GetVoxelNames() { return null; }

View file

@ -145,11 +145,10 @@ namespace CodeImp.DoomBuilder.Data
{
MemoryStream stream = LoadFile(foundfile);
if(stream.Length > 767) {//mxd
if(stream.Length > 767) //mxd
palette = new Playpal(stream);
} else {
else
General.ErrorLogger.Add(ErrorType.Warning, "Warning: invalid palette '"+foundfile+"'");
}
stream.Dispose();
}
@ -600,6 +599,35 @@ namespace CodeImp.DoomBuilder.Data
#endregion
#region ================== Reverbs
public override Dictionary<string, Stream> GetReverbsData()
{
// Error when suspended
if(issuspended) throw new Exception("Data reader is suspended");
Dictionary<string, Stream> streams = new Dictionary<string, Stream>();
// Get from wads first
//TODO: is this the correct order?..
foreach(WADReader wr in wads)
{
Dictionary<string, Stream> wadstreams = wr.GetReverbsData();
foreach(KeyValuePair<string, Stream> pair in wadstreams) streams.Add(pair.Key, pair.Value);
}
// Then from our own files
string foundfile = FindFirstFile("reverbs", false);
if((foundfile != null) && FileExists(foundfile))
{
streams.Add(foundfile, LoadFile(foundfile));
}
return streams;
}
#endregion
#region ================== Methods
// This loads the images in this directory

View file

@ -923,6 +923,17 @@ namespace CodeImp.DoomBuilder.Data
return GetGldefsData("MODELDEF");
}
//mxd
public override Dictionary<string, Stream> GetReverbsData()
{
if(issuspended) throw new Exception("Data reader is suspended");
Dictionary<string, Stream> result = new Dictionary<string, Stream>();
Lump lump = file.FindLump("REVERBS");
if(lump != null) result.Add(Path.Combine(location.location, "REVERBS"), lump.Stream);
return result;
}
//mxd
internal override MemoryStream LoadFile(string name)
{

View file

@ -2739,7 +2739,7 @@ namespace CodeImp.DoomBuilder.Map
}
/// <summary>This finds the thing closest to the specified position.</summary>
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange)
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange, int type)
{
RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
Thing closest = null;
@ -2749,6 +2749,9 @@ namespace CodeImp.DoomBuilder.Map
// Go for all things in selection
foreach(Thing t in selection)
{
//mxd. Required type?
if(type != 0 && t.Type != type) continue;
px = t.Position.x;
py = t.Position.y;
@ -3079,7 +3082,10 @@ namespace CodeImp.DoomBuilder.Map
public Vertex NearestVertexSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestVertexSquareRange(vertices, pos, maxrange); }
/// <summary>This finds the thing closest to the specified position.</summary>
public Thing NearestThingSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(things, pos, maxrange); }
public Thing NearestThingSquareRange(Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(things, pos, maxrange, 0); }
/// <summary>This finds the thing closest to the specified position.</summary>
public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange) { return MapSet.NearestThingSquareRange(selection, pos, maxrange, 0); }
/// <summary>This finds the closest unselected linedef that is not connected to the given vertex.</summary>
public Linedef NearestUnselectedUnreferencedLinedef(Vector2D pos, float maxrange, Vertex v, out float distance)

View file

@ -28,4 +28,4 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.14.0.1885")]
[assembly: AssemblyVersion("1.14.0.2201")]

View file

@ -631,7 +631,11 @@ namespace CodeImp.DoomBuilder.Rendering
{
img = General.Map.Data.GetFlatImage(longimagename);
if(!(img is UnknownImage))
if(img is UnknownImage)
{
img = General.Map.Data.UnknownTexture3D;
}
else
{
if(img.IsImageLoaded && !img.LoadFailed)
{

View file

@ -1785,27 +1785,36 @@ namespace CodeImp.DoomBuilder.Windows
// This hides redundant separators
internal void UpdateSeparators()
{
UpdateToolStripSeparators(toolbar.Items);
UpdateToolStripSeparators(menumode.DropDownItems);
UpdateToolStripSeparators(toolbar.Items, false);
UpdateToolStripSeparators(menumode.DropDownItems, true);
//mxd
UpdateToolStripSeparators(modestoolbar.Items);
UpdateToolStripSeparators(modecontrolsloolbar.Items);
UpdateToolStripSeparators(modestoolbar.Items, true);
UpdateToolStripSeparators(modecontrolsloolbar.Items, true);
}
// This hides redundant separators (mxd)
private static void UpdateToolStripSeparators(ToolStripItemCollection items)
// This hides redundant separators
private static void UpdateToolStripSeparators(ToolStripItemCollection items, bool defaultvisible)
{
ToolStripItem pvi = null;
foreach(ToolStripItem i in items)
foreach(ToolStripItem i in items)
{
if (i is ToolStripSeparator)
bool separatorvisible = false;
// This is a seperator?
if(i is ToolStripSeparator)
{
i.Visible = !(pvi == null || (!pvi.Visible || pvi is ToolStripSeparator));
// Make visible when previous item was not a seperator
separatorvisible = !(pvi is ToolStripSeparator) && (pvi != null);
i.Visible = separatorvisible;
}
pvi = i;
// Keep as previous visible item
if(i.Visible || separatorvisible || (defaultvisible && !(i is ToolStripSeparator))) pvi = i;
}
// Hide last item if it is a seperator
if(pvi is ToolStripSeparator) pvi.Visible = false;
}
// This enables or disables all editing mode items and toolbar buttons

View file

@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace CodeImp.DoomBuilder.ZDoom
{
internal sealed class ReverbsParser : ZDTextParser
{
private readonly List<string> names;
private readonly List<int> firstargs;
private readonly List<int> secondargs;
public ReverbsParser()
{
names = new List<string>();
firstargs = new List<int>();
secondargs = new List<int>();
}
public override bool Parse(Stream stream, string sourcefilename)
{
base.Parse(stream, sourcefilename);
// Continue until at the end of the stream
while(SkipWhitespace(true))
{
string token = ReadToken();
if(!string.IsNullOrEmpty(token))
{
if(token == "{")
{
// Skip inner properties
do
{
SkipWhitespace(true);
token = ReadToken();
} while(token!= "}");
}
else
{
//this should be reverb name and args
string name = StripTokenQuotes(token);
if(string.IsNullOrEmpty(name))
{
ReportError("Got empty sound environment name!");
break;
}
// Read first part of the ID
SkipWhitespace(true);
token = StripTokenQuotes(ReadToken());
int arg1;
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out arg1))
{
ReportError("Failed to parse the first part of '" + name + "' sound environment ID!");
break;
}
// Read second part of the ID
SkipWhitespace(true);
token = StripTokenQuotes(ReadToken());
int arg2;
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out arg2))
{
ReportError("Failed to parse the second part of '" + name + "' sound environment ID!");
break;
}
// Add to collections
if(names.Contains(name))
{
General.ErrorLogger.Add(ErrorType.Warning, "'" + name + "' Sound environment is double-defined in '" + sourcefilename + "'!");
int index = names.IndexOf(name);
firstargs[index] = arg1;
secondargs[index] = arg2;
}
else
{
names.Add(name);
firstargs.Add(arg1);
secondargs.Add(arg2);
}
}
}
}
return true;
}
internal Dictionary<string, KeyValuePair<int, int>> GetReverbs()
{
string[] sortednames = new string[names.Count];
names.CopyTo(sortednames);
Array.Sort(sortednames);
Dictionary<string, KeyValuePair<int, int>> result = new Dictionary<string, KeyValuePair<int, int>>(names.Count);
foreach(string name in sortednames)
{
int index = names.IndexOf(name);
result.Add(name, new KeyValuePair<int, int>(firstargs[index], secondargs[index]));
}
return result;
}
}
}

View file

@ -501,7 +501,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update entire display
General.Interface.RedrawDisplay();
}
} else if(highlighted != null)
}
else if(highlighted != null)
{
highlighted = null;
Highlight(null);

View file

@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
public static BuilderPlug Me { get { return me; } }
// This plugin relies on some functionality that wasn't there in older versions
public override int MinimumRevision { get { return 1885; } }
public override int MinimumRevision { get { return 2201; } }
// This event is called when the plugin is initialized
public override void OnInitialize()
@ -318,6 +318,39 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
environment.Things = environment.Things.OrderBy(o => o.Index).ToList();
environment.Linedefs = environment.Linedefs.OrderBy(o => o.Index).ToList();
//mxd. Find the first non-dormant thing
Thing activeenv = null;
foreach(Thing t in environment.Things)
{
if(!ThingDormant(t))
{
activeenv = t;
break;
}
}
//mxd. Update environment name
if(activeenv != null)
{
foreach(KeyValuePair<string, KeyValuePair<int, int>> group in General.Map.Data.Reverbs)
{
if(group.Value.Key == activeenv.Args[0] && group.Value.Value == activeenv.Args[1])
{
environment.Name = group.Key + " (" + activeenv.Args[0] + " " + activeenv.Args[1] + ") ";
break;
}
}
//mxd. No suitable name found?..
if(environment.Name == SoundEnvironment.DEFAULT_NAME)
{
environment.Name += " (" + activeenv.Args[0] + " " + activeenv.Args[1] + ")";
}
}
//mxd. Still no suitable name?..
if(environment.Name == SoundEnvironment.DEFAULT_NAME) environment.Name += " " + environment.ID;
lock (soundenvironments)
{
soundenvironments.Add(environment);
@ -375,5 +408,17 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
// the second argument set (see http://zdoom.org/wiki/Line_SetIdentification)
return (linedef.Action == 121 && (linedef.Args[1] & 1) == 1); //mxd. Fancier this way :)
}
//mxd
internal static bool ThingDormant(Thing thing)
{
return thing.IsFlagSet(General.Map.UDMF ? "dormant" : "14");
}
//mxd
internal static void SetThingDormant(Thing thing, bool dormant)
{
thing.SetFlag(General.Map.UDMF ? "dormant" : "14", dormant);
}
}
}

View file

@ -18,13 +18,14 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
InitializeComponent();
soundenvironments.ImageList = new ImageList();
soundenvironments.ImageList.Images.Add(global::SoundPropagationMode.Properties.Resources.Status0);
soundenvironments.ImageList.Images.Add(global::SoundPropagationMode.Properties.Resources.Warning);
soundenvironments.ImageList.Images.Add(Properties.Resources.Status0);
soundenvironments.ImageList.Images.Add(Properties.Resources.Warning);
}
public void AddSoundEnvironment(SoundEnvironment se)
public void AddSoundEnvironment(SoundEnvironment se)
{
TreeNode topnode = new TreeNode("Sound environment " + se.ID);
TreeNode topnode = new TreeNode(se.Name);
topnode.Tag = se; //mxd
TreeNode thingsnode = new TreeNode("Things (" + se.Things.Count + ")");
TreeNode linedefsnode = new TreeNode("Linedefs (" + se.Linedefs.Count + ")");
int notdormant = 0;
@ -37,7 +38,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
thingnode.Tag = t;
thingsnode.Nodes.Add(thingnode);
if(!ThingDormant(t))
if(!BuilderPlug.ThingDormant(t))
{
notdormant++;
}
@ -56,7 +57,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
foreach (TreeNode tn in thingsnode.Nodes)
{
if (!ThingDormant((Thing)tn.Tag))
if (!BuilderPlug.ThingDormant((Thing)tn.Tag))
{
tn.ImageIndex = 1;
tn.SelectedImageIndex = 1;
@ -110,16 +111,11 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
// Sound environments will no be added in consecutive order, so we'll have to find
// out where in the tree to add the node
Regex seid = new Regex(@"\d+$");
int insertionplace = 0;
foreach (TreeNode tn in soundenvironments.Nodes)
{
Match match = seid.Match(tn.Text);
int num = int.Parse(match.Value);
if (se.ID < num) break;
if(se.ID < ((SoundEnvironment)tn.Tag).ID) break;
insertionplace++;
}
@ -132,7 +128,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
foreach (TreeNode tn in soundenvironments.Nodes)
{
if (se != null && tn.Text == "Sound environment " + se.ID)
if(se != null && tn.Text == se.Name)
{
if (tn.NodeFont == null || tn.NodeFont.Style != FontStyle.Bold)
{
@ -150,11 +146,6 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
soundenvironments.EndUpdate();
}
private static bool ThingDormant(Thing thing)
{
return thing.IsFlagSet(General.Map.UDMF ? "dormant" : "14");
}
private static bool IsClickOnText(TreeView treeView, TreeNode node, Point location)
{
var hitTest = treeView.HitTest(location);

View file

@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.5485
// Runtime Version:2.0.50727.5466
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SoundPropagationMode.Properties {
namespace CodeImp.DoomBuilder.SoundPropagationMode.Properties {
using System;
@ -39,7 +39,7 @@ namespace SoundPropagationMode.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SoundPropagationMode.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeImp.DoomBuilder.SoundPropagationMode.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

View file

@ -10,6 +10,12 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
{
public class SoundEnvironment
{
#region ================== Constants
public const string DEFAULT_NAME = "Unknown sound environment"; //mxd
#endregion
#region ================== Properties
public List<Sector> Sectors { get; private set; }
@ -17,6 +23,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
public List<Linedef> Linedefs { get; set; }
public PixelColor Color { get; set; }
public int ID { get; set; }
public string Name { get; set; } //mxd
#endregion
@ -27,6 +34,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
Linedefs = new List<Linedef>();
Color = General.Colors.Background;
ID = -1;
Name = DEFAULT_NAME; //mxd
}
}
}

View file

@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
[EditMode(DisplayName = "Sound Environment Mode",
SwitchAction = "soundenvironmentmode", // Action name used to switch to this mode
ButtonImage = "ZDoomSoundEnvironment.png", // Image resource name for the button
ButtonOrder = int.MinValue + 501, // Position of the button (lower is more to the left)
ButtonOrder = int.MinValue + 502, // Position of the button (lower is more to the left)
ButtonGroup = "000_editing",
UseByDefault = true,
SafeStartMode = false,
@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
private Sector highlighted;
private SoundEnvironment highlightedsoundenvironment;
private Linedef highlightedline; //mxd
private Thing highlightedthing; //mxd
// Interface
private SoundEnvironmentPanel panel;
@ -57,7 +58,6 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
#endregion
#region ================== Properties
public override object HighlightedObject { get { return highlighted; } }
@ -200,6 +200,27 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
General.Interface.RedrawDisplay();
}
//mxd. Show Reverb selector dialog
protected override void OnEditEnd()
{
if(highlightedthing != null)
{
ReverbsPickerForm form = new ReverbsPickerForm(highlightedthing);
if(form.ShowDialog((Form)General.Interface) == DialogResult.OK)
{
// Make undo
General.Map.UndoRedo.CreateUndo("Change Sound Environment Settings");
// Apply changes
form.ApplyTo(highlightedthing);
// Update
UpdateData();
General.Interface.RedrawDisplay();
}
}
}
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
General.Interface.DisplayStatus(StatusType.Ready, "Finished updating sound environments");
@ -283,6 +304,9 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
}
}
//mxd. Render highlighted thing
if(highlightedthing != null) renderer.RenderThing(highlightedthing, General.Colors.Selection, 1.0f);
renderer.Finish();
}
@ -362,11 +386,31 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
}
//mxd. Set as highlighted
bool redrawrequired = false;
if(highlightedline != l)
{
highlightedline = l;
General.Interface.RedrawDisplay();
redrawrequired = true;
}
//mxd. Find the nearest thing within default highlight range
if(highlightedline == null)
{
Thing t = MapSet.NearestThingSquareRange(General.Map.ThingsFilter.VisibleThings, mousemappos, 10 / renderer.Scale, 9048);
if(highlightedthing != t)
{
highlightedthing = t;
redrawrequired = true;
}
}
else if(highlightedthing != null)
{
highlightedthing = null;
redrawrequired = true;
}
//mxd. Redraw display?
if(redrawrequired) General.Interface.RedrawDisplay();
}
}

View file

@ -8,7 +8,7 @@
<ProjectGuid>{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SoundPropagationMode</RootNamespace>
<RootNamespace>CodeImp.DoomBuilder.SoundPropagationMode</RootNamespace>
<AssemblyName>SoundPropagationMode</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@ -51,8 +51,10 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BufferedTreeView.cs">
@ -87,6 +89,12 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SoundPropagationMode.cs" />
<Compile Include="Windows\ReverbsPickerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\ReverbsPickerForm.Designer.cs">
<DependentUpon>ReverbsPickerForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Builder.csproj">
@ -123,6 +131,9 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Status0.png" />
<EmbeddedResource Include="Windows\ReverbsPickerForm.resx">
<DependentUpon>ReverbsPickerForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View file

@ -1,10 +1,10 @@
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.SoundPropagationMode
{
public partial class ColorConfiguration : Form
public partial class ColorConfiguration : DelayedForm
{
public ColorConfiguration()
{

View file

@ -131,8 +131,8 @@
// ColorConfiguration
//
this.AcceptButton = this.okbutton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelbutton;
this.ClientSize = new System.Drawing.Size(196, 223);
this.Controls.Add(this.resetcolors);
@ -147,9 +147,10 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ColorConfiguration";
this.Opacity = 1;
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Color configuration";
this.Text = "Color Configuration";
this.ResumeLayout(false);
}

View file

@ -46,7 +46,7 @@
// colorconfiguration
//
this.colorconfiguration.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.colorconfiguration.Image = global::SoundPropagationMode.Properties.Resources.ColorManagement;
this.colorconfiguration.Image = global::CodeImp.DoomBuilder.SoundPropagationMode.Properties.Resources.ColorManagement;
this.colorconfiguration.ImageTransparentColor = System.Drawing.Color.Magenta;
this.colorconfiguration.Name = "colorconfiguration";
this.colorconfiguration.Size = new System.Drawing.Size(23, 22);
@ -56,8 +56,8 @@
//
// MenusForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.toolStrip1);
this.Name = "MenusForm";

View file

@ -0,0 +1,124 @@
namespace CodeImp.DoomBuilder.SoundPropagationMode
{
partial class ReverbsPickerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.list = new System.Windows.Forms.ListBox();
this.accept = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
this.cbactiveenv = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.list);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(190, 351);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Sound Environments ";
//
// list
//
this.list.Dock = System.Windows.Forms.DockStyle.Fill;
this.list.FormattingEnabled = true;
this.list.Location = new System.Drawing.Point(3, 16);
this.list.Name = "list";
this.list.Size = new System.Drawing.Size(184, 329);
this.list.TabIndex = 0;
this.list.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.list_MouseDoubleClick);
//
// accept
//
this.accept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.accept.Location = new System.Drawing.Point(111, 394);
this.accept.Name = "accept";
this.accept.Size = new System.Drawing.Size(91, 23);
this.accept.TabIndex = 0;
this.accept.Text = "OK";
this.accept.UseVisualStyleBackColor = true;
this.accept.Click += new System.EventHandler(this.accept_Click);
//
// cancel
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(14, 394);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(91, 23);
this.cancel.TabIndex = 1;
this.cancel.Text = "Cancel";
this.cancel.UseVisualStyleBackColor = true;
//
// cbactiveenv
//
this.cbactiveenv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbactiveenv.AutoSize = true;
this.cbactiveenv.Location = new System.Drawing.Point(15, 369);
this.cbactiveenv.Name = "cbactiveenv";
this.cbactiveenv.Size = new System.Drawing.Size(152, 17);
this.cbactiveenv.TabIndex = 1;
this.cbactiveenv.Text = "Active Sound Environment";
this.cbactiveenv.UseVisualStyleBackColor = true;
//
// ReverbsPickerForm
//
this.AcceptButton = this.accept;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(214, 422);
this.Controls.Add(this.cbactiveenv);
this.Controls.Add(this.cancel);
this.Controls.Add(this.accept);
this.Controls.Add(this.groupBox1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(230, 200);
this.Name = "ReverbsPickerForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Choose a Sound Environment";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button accept;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.ListBox list;
private System.Windows.Forms.CheckBox cbactiveenv;
}
}

View file

@ -0,0 +1,75 @@
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();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>