Added, Things mode: minimum/maximum sound radii can now be displayed for ZDoom's Ambient Sound things.

Added, Things mode: added "Show Light Radii" and "Show Sound Radii" main toolbar and View menu buttons.
Fixed, Action arguments control: invisible splitter between args1-3 and args4-5 is no longer draggable.
Updated ZDoom ACC (SetTranslation).
Updated ZDoom_ACS.cfg (SetTranslation).
This commit is contained in:
MaxED 2016-10-03 11:42:12 +00:00
parent 8c6971a437
commit 07db2506c5
22 changed files with 1035 additions and 119 deletions

View file

@ -400,6 +400,7 @@ special
-200:CheckClass(1),
-201:DamageActor(6), // [arookas]
-202:SetActorFlag(3),
-203:SetTranslation(2),
// ZDaemon's
-19620:GetTeamScore(1),

View file

@ -355,6 +355,7 @@ keywords
SetActorProperty = "void SetActorProperty(int tid, int property, [int|float|str] value)\nproperty: one of the APROP_ properties.";
SetActorRoll = "void SetActorRoll(int tid, fixed angle)";
SetActorState = "int SetActorState(int tid, str statename[, bool exact])\nForces the actor(s) with the matching tid into the specified state, as defined in Decorate.\nIf tid is 0, the activator is affected.\nThe exact parameter specifies whether or not partial state name matches are accepted.";
SetActorTeleFog = "void SetActorTeleFog(int tid, str telefogsrcclass, str telefogdestclass";
SetActorVelocity = "bool SetActorVelocity(int tid, fixed velx, fixed vely, fixed velz, bool add, bool setbob)\nChanges actor velocity.\ntid: TID of things to affect. If 0, the activator is used.\nvelx, vely, velz: The desired velocity for the affected things.\nadd: If true, each affected actor's velocity is modified by the velx, vely\nand velz parameters, rather than replaced by them.\nsetbob: If true, the speed adjustment influences the bobbing of any concerned player actor.";
SetAirControl = "void SetAirControl(fixed amount)\nSets how well the player can move while in the air.\nThe default amount is 0.00390625.";
SetAirSupply = "bool SetAirSupply(int playernum, int tics)\nSets the amount of tics remaining in a player's air supply.";
@ -386,8 +387,8 @@ keywords
SetSectorDamage = "fixed SetSectorDamage(int tag, int amount, str damagetype, int interval, int leaky)";
SetSectorTerrain = "fixed SetSectorTerrain(int tag, int plane, str terraintype)";
SetSkyScrollSpeed = "void SetSkyScrollSpeed(int sky, fixed skyspeed)\nChanges the scrolling speed of a sky.\nThis is useful in conjunction with ChangeSky.\nsky: either 1 or 2.\nskyspeed: the desired scrolling speed.";
SetActorTeleFog = "void SetActorTeleFog(int tid, str telefogsrcclass, str telefogdestclass";
SetThingSpecial = "void SetThingSpecial(int tid, int special[, int arg0[, int arg1[, int arg2[, int arg3[, int arg4]]]]])\nSets the special for any things with the same TID.\nThis is similar to Thing_SetSpecial, except it can only be used from ACS,\nand it can set all of a thing's special arguments.\nIf tid is 0, then the activator is used.";
SetTranslation = "void SetTranslation(int tid, str transname)";
SetUserArray = "void SetUserArray(int tid, str name, int pos, int value)\nSets one of the affected actor's user array-bound variables.";
SetUserCVar = "bool SetUserCVar(int playernumber, str cvar, int value)\nSets the console variable of a particular player.\nOnly mod-defined console variables through CVARINFO can be changed by using this function.\nReturns FALSE if cvar is invalid, it is not writable, or the player doesn't exist.";
SetUserCVarString = "bool SetUserCVarString(int playernumber, str cvar, str value)\nSets the console variable of a particular player.\nOnly mod-defined console variables through CVARINFO can be changed by using this function.\nReturns FALSE if cvar is invalid, it is not writable, or the player doesn't exist.";

View file

@ -898,6 +898,7 @@
<Compile Include="Rendering\VisualVertexHandle.cs" />
<Compile Include="Geometry\Line3D.cs" />
<Compile Include="Data\Scripting\ScriptHandlerAttribute.cs" />
<Compile Include="ZDoom\AmbientSoundInfo.cs" />
<Compile Include="ZDoom\DecorateCategoryInfo.cs" />
<Compile Include="ZDoom\LockDefsParser.cs" />
<Compile Include="ZDoom\Scripting\DecorateParserSE.cs" />
@ -1045,6 +1046,7 @@
<Compile Include="ZDoom\ReverbsParser.cs" />
<Compile Include="ZDoom\SndInfoParser.cs" />
<Compile Include="ZDoom\SndSeqParser.cs" />
<Compile Include="ZDoom\SoundInfo.cs" />
<Compile Include="ZDoom\StateGoto.cs" />
<Compile Include="ZDoom\TerrainParser.cs" />
<Compile Include="ZDoom\TexturesParser.cs" />

View file

@ -93,6 +93,9 @@ namespace CodeImp.DoomBuilder.Config
private bool rollsprite;
private bool rollcenter;
private bool dontflip;
//mxd. Ambinent sound info
private AmbientSoundInfo ambientsound;
#endregion
@ -136,6 +139,9 @@ namespace CodeImp.DoomBuilder.Config
public bool RollCenter { get { return rollcenter; } }
public bool DontFlip { get { return dontflip; } }
//mxd. Ambinent sound info
public AmbientSoundInfo AmbientSound { get { return ambientsound; } internal set { ambientsound = value; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -28,19 +28,19 @@
this.components = new System.ComponentModel.Container();
this.splitcontainer = new System.Windows.Forms.SplitContainer();
this.cbuseargstr = new System.Windows.Forms.CheckBox();
this.scriptnames = new CodeImp.DoomBuilder.Controls.ColoredComboBox();
this.scriptnumbers = new CodeImp.DoomBuilder.Controls.ColoredComboBox();
this.arg0label = new System.Windows.Forms.Label();
this.arg1label = new System.Windows.Forms.Label();
this.arg2label = new System.Windows.Forms.Label();
this.arg3label = new System.Windows.Forms.Label();
this.arg4label = new System.Windows.Forms.Label();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.scriptnames = new CodeImp.DoomBuilder.Controls.ColoredComboBox();
this.scriptnumbers = new CodeImp.DoomBuilder.Controls.ColoredComboBox();
this.arg0 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg3label = new System.Windows.Forms.Label();
this.arg4label = new System.Windows.Forms.Label();
this.arg3 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg4 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.splitcontainer.Panel1.SuspendLayout();
this.splitcontainer.Panel2.SuspendLayout();
this.splitcontainer.SuspendLayout();
@ -49,6 +49,7 @@
// splitcontainer
//
this.splitcontainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitcontainer.IsSplitterFixed = true;
this.splitcontainer.Location = new System.Drawing.Point(0, 0);
this.splitcontainer.Name = "splitcontainer";
//
@ -86,6 +87,34 @@
this.cbuseargstr.UseVisualStyleBackColor = true;
this.cbuseargstr.CheckedChanged += new System.EventHandler(this.cbuseargstr_CheckedChanged);
//
// scriptnames
//
this.scriptnames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.scriptnames.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptnames.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptnames.BackColor = System.Drawing.Color.Honeydew;
this.scriptnames.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.scriptnames.FormattingEnabled = true;
this.scriptnames.Location = new System.Drawing.Point(237, 104);
this.scriptnames.Name = "scriptnames";
this.scriptnames.Size = new System.Drawing.Size(110, 21);
this.scriptnames.TabIndex = 41;
this.scriptnames.TextChanged += new System.EventHandler(this.scriptnames_TextChanged);
//
// scriptnumbers
//
this.scriptnumbers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.scriptnumbers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptnumbers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptnumbers.BackColor = System.Drawing.Color.LemonChiffon;
this.scriptnumbers.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.scriptnumbers.FormattingEnabled = true;
this.scriptnumbers.Location = new System.Drawing.Point(237, 80);
this.scriptnumbers.Name = "scriptnumbers";
this.scriptnumbers.Size = new System.Drawing.Size(110, 21);
this.scriptnumbers.TabIndex = 40;
this.scriptnumbers.TextChanged += new System.EventHandler(this.scriptnumbers_TextChanged);
//
// arg0label
//
this.arg0label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -119,56 +148,6 @@
this.arg2label.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.arg2label.UseMnemonic = false;
//
// arg3label
//
this.arg3label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.arg3label.Location = new System.Drawing.Point(55, 8);
this.arg3label.Name = "arg3label";
this.arg3label.Size = new System.Drawing.Size(179, 14);
this.arg3label.TabIndex = 44;
this.arg3label.Text = "Argument 4:";
this.arg3label.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.arg3label.UseMnemonic = false;
//
// arg4label
//
this.arg4label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.arg4label.Location = new System.Drawing.Point(55, 33);
this.arg4label.Name = "arg4label";
this.arg4label.Size = new System.Drawing.Size(179, 14);
this.arg4label.TabIndex = 46;
this.arg4label.Text = "Argument 5:";
this.arg4label.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.arg4label.UseMnemonic = false;
//
// scriptnames
//
this.scriptnames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.scriptnames.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptnames.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptnames.BackColor = System.Drawing.Color.Honeydew;
this.scriptnames.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.scriptnames.FormattingEnabled = true;
this.scriptnames.Location = new System.Drawing.Point(237, 104);
this.scriptnames.Name = "scriptnames";
this.scriptnames.Size = new System.Drawing.Size(110, 21);
this.scriptnames.TabIndex = 41;
this.scriptnames.TextChanged += new System.EventHandler(this.scriptnames_TextChanged);
//
// scriptnumbers
//
this.scriptnumbers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.scriptnumbers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptnumbers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptnumbers.BackColor = System.Drawing.Color.LemonChiffon;
this.scriptnumbers.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.scriptnumbers.FormattingEnabled = true;
this.scriptnumbers.Location = new System.Drawing.Point(237, 80);
this.scriptnumbers.Name = "scriptnumbers";
this.scriptnumbers.Size = new System.Drawing.Size(110, 21);
this.scriptnumbers.TabIndex = 40;
this.scriptnumbers.TextChanged += new System.EventHandler(this.scriptnumbers_TextChanged);
//
// arg0
//
this.arg0.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -193,6 +172,28 @@
this.arg2.Size = new System.Drawing.Size(110, 24);
this.arg2.TabIndex = 35;
//
// arg3label
//
this.arg3label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.arg3label.Location = new System.Drawing.Point(55, 8);
this.arg3label.Name = "arg3label";
this.arg3label.Size = new System.Drawing.Size(179, 14);
this.arg3label.TabIndex = 44;
this.arg3label.Text = "Argument 4:";
this.arg3label.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.arg3label.UseMnemonic = false;
//
// arg4label
//
this.arg4label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.arg4label.Location = new System.Drawing.Point(55, 33);
this.arg4label.Name = "arg4label";
this.arg4label.Size = new System.Drawing.Size(179, 14);
this.arg4label.TabIndex = 46;
this.arg4label.Text = "Argument 5:";
this.arg4label.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.arg4label.UseMnemonic = false;
//
// arg3
//
this.arg3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));

View file

@ -2541,6 +2541,7 @@ namespace CodeImp.DoomBuilder.Data
currentreader = null;
// Anything to do?
parser.FinishSetup();
if(parser.AmbientSounds.Count > 0)
{
// Update or create the main enums list
@ -2552,9 +2553,9 @@ namespace CodeImp.DoomBuilder.Data
}
if(configenums.ContainsKey(0)) configenums.Remove(0);
foreach(KeyValuePair<int, string> group in parser.AmbientSounds)
foreach(KeyValuePair<int, AmbientSoundInfo> group in parser.AmbientSounds)
{
configenums[group.Key] = new EnumItem(group.Key.ToString(), group.Value);
configenums[group.Key] = new EnumItem(group.Key.ToString(), group.Value.SoundName);
}
// Store results in "ambient_sounds" enum
@ -2581,10 +2582,14 @@ namespace CodeImp.DoomBuilder.Data
for(int i = 14001; i < 14065; i++)
{
int ambsoundindex = i - 14000;
if(!configenums.ContainsKey(ambsoundindex) || !thingtypes.ContainsKey(i) || !string.IsNullOrEmpty(thingtypes[i].ClassName)) continue;
// Attach AmbientSoundInfo
if(parser.AmbientSounds.ContainsKey(ambsoundindex))
thingtypes[i].AmbientSound = parser.AmbientSounds[ambsoundindex];
// Update title
thingtypes[i].Title += " (" + configenums[ambsoundindex] + ")";
if(configenums.ContainsKey(ambsoundindex) && thingtypes.ContainsKey(i) && string.IsNullOrEmpty(thingtypes[i].ClassName))
thingtypes[i].Title += " (" + configenums[ambsoundindex] + ")";
}
}
}

View file

@ -104,7 +104,7 @@ namespace CodeImp.DoomBuilder.Windows
this.separatorgeomerge = new System.Windows.Forms.ToolStripSeparator();
this.itemfullbrightness = new System.Windows.Forms.ToolStripMenuItem();
this.itemtogglegrid = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.separatorhelpers = new System.Windows.Forms.ToolStripSeparator();
this.menuzoom = new System.Windows.Forms.ToolStripMenuItem();
this.item2zoom800 = new System.Windows.Forms.ToolStripMenuItem();
this.item2zoom400 = new System.Windows.Forms.ToolStripMenuItem();
@ -789,7 +789,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemtogglesky,
this.itemtoggleeventlines,
this.itemtogglevisualverts,
this.toolStripSeparator4,
this.separatorhelpers,
this.menuzoom,
this.itemgotocoords,
this.itemfittoscreen,
@ -923,8 +923,8 @@ namespace CodeImp.DoomBuilder.Windows
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(212, 6);
this.separatorhelpers.Name = "separatorhelpers";
this.separatorhelpers.Size = new System.Drawing.Size(212, 6);
//
// menuzoom
//
@ -2978,7 +2978,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
private System.Windows.Forms.ToolStrip modecontrolsloolbar;
private System.Windows.Forms.ToolStripMenuItem itemfullbrightness;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripSeparator separatorhelpers;
private System.Windows.Forms.ToolStripButton buttonfullbrightness;
private System.Windows.Forms.ToolStripSeparator separatorfullbrightness;
private System.Windows.Forms.ToolStripSeparator separatorfilters;

View file

@ -1884,6 +1884,7 @@ namespace CodeImp.DoomBuilder.Windows
case ToolbarSection.Things: toolbar.Items.Insert(toolbar.Items.IndexOf(buttonviewnormal), button); break;
case ToolbarSection.Views: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatorviews), button); break;
case ToolbarSection.Geometry: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatorgeometry), button); break;
case ToolbarSection.Helpers: toolbar.Items.Insert(toolbar.Items.IndexOf(separatorgzmodes), button); break; //mxd
case ToolbarSection.Testing: toolbar.Items.Insert(toolbar.Items.IndexOf(seperatortesting), button); break;
case ToolbarSection.Modes: modestoolbar.Items.Add(button); break; //mxd
case ToolbarSection.Custom: modecontrolsloolbar.Items.Add(button); modecontrolsloolbar.Visible = true; break; //mxd
@ -2381,6 +2382,8 @@ namespace CodeImp.DoomBuilder.Windows
case MenuSection.EditGeometry: menuedit.DropDownItems.Insert(menuedit.DropDownItems.IndexOf(seperatoreditgeometry), menu); break;
case MenuSection.EditGrid: menuedit.DropDownItems.Insert(menuedit.DropDownItems.IndexOf(seperatoreditgrid), menu); break;
case MenuSection.EditMapOptions: menuedit.DropDownItems.Add(menu); break;
case MenuSection.ViewHelpers: menuview.DropDownItems.Insert(menuview.DropDownItems.IndexOf(separatorhelpers), menu); break; //mxd
case MenuSection.ViewRendering: menuview.DropDownItems.Insert(menuview.DropDownItems.IndexOf(separatorrendering), menu); break; //mxd
case MenuSection.ViewThings: menuview.DropDownItems.Insert(menuview.DropDownItems.IndexOf(seperatorviewthings), menu); break;
case MenuSection.ViewViews: menuview.DropDownItems.Insert(menuview.DropDownItems.IndexOf(seperatorviewviews), menu); break;
case MenuSection.ViewZoom: menuview.DropDownItems.Insert(menuview.DropDownItems.IndexOf(seperatorviewzoom), menu); break;

View file

@ -35,6 +35,8 @@ namespace CodeImp.DoomBuilder.Windows
EditMapOptions,
ViewThings,
ViewViews,
ViewHelpers, //mxd
ViewRendering, //mxd
ViewZoom,
ViewScriptEdit,
PrefabsInsert,

View file

@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.Windows
Things,
Views,
Geometry,
Helpers, //mxd
Testing,
Custom,
Modes //mxd

View file

@ -0,0 +1,203 @@
using System;
using System.IO;
namespace CodeImp.DoomBuilder.ZDoom
{
public class AmbientSoundInfo
{
#region ================== Enums
public enum AmbientType
{
NONE,
POINT,
SURROUND,
WORLD
}
public enum AmbientMode
{
NONE,
CONTINUOUS,
RANDOM,
PERIODIC
}
#endregion
#region ================== Variables
private string soundname;
private int index = -1;
private AmbientType type = AmbientType.NONE;
private AmbientMode mode = AmbientMode.NONE;
private float volume = 1.0f;
private float attenuation = 1.0f;
private float minsecs;
private float maxsecs;
private float secs;
// Editor sound radii
private float minradius;
private float maxradius;
#endregion
#region ================== Properties
public string SoundName { get { return soundname; } }
public int Index { get { return index; } } // Ambient sound index
// Sound settings
public AmbientType AmbientSoundType { get { return type; } }
public AmbientMode AmbientSoundMode { get { return mode; } }
public float Volume { get { return volume; } }
// Can be set when AmbientType == POINT
public float Attenuation { get { return attenuation; } }
// Used when AmbientMode == RANDOM
public float SecondsMin { get { return minsecs; } }
public float SecondsMax { get { return maxsecs; } }
// Used when AmbientMode == PERIODIC
public float Seconds { get { return secs; } }
// Editor sound radii
public float MinimumRadius { get { return minradius; } }
public float MaximumRadius { get { return maxradius; } }
#endregion
#region ================== Methods
internal bool Setup(SndInfoParser parser)
{
// Read index
if(!parser.ReadSignedInt(ref index) || index < 0)
{
// Not numeric!
parser.ReportError("Expected $ambient <index> value");
return false;
}
// Read name
if(!parser.SkipWhitespace(true)) return false;
soundname = parser.StripTokenQuotes(parser.ReadToken(false));
if(string.IsNullOrEmpty(soundname))
{
parser.ReportError("Expected $ambient <logicalsound> value");
return false;
}
// Next token can be either [type] or <mode>...
if(!parser.SkipWhitespace(true)) return false;
string token = parser.ReadToken(false).ToLowerInvariant();
// Can be [type]
if(token == "point" || token == "surround" || token == "world")
{
// Next token may be attenuation...
if(token == "point")
{
if(!parser.SkipWhitespace(false)) return false;
string next = parser.ReadToken(false);
if(!parser.ReadSignedFloat(next, ref attenuation) || attenuation < 0f)
{
// Rewind so this structure can be read again
parser.DataStream.Seek(-next.Length - 1, SeekOrigin.Current);
}
}
// Store type
switch(token)
{
case "point": type = AmbientType.POINT; break;
case "surround": type = AmbientType.SURROUND; break;
case "world": type = AmbientType.WORLD; break;
}
// Read next token
if(!parser.SkipWhitespace(false)) return false;
token = parser.ReadToken(false).ToLowerInvariant();
}
// Sould be <mode>
if(token == "continuous" || token == "random" || token == "periodic")
{
// Next 2 tokens must be minsecs and maxsecs
if(token == "random")
{
if(!parser.SkipWhitespace(false)) return false;
if(!parser.ReadSignedFloat(ref minsecs) || minsecs < 0f)
{
parser.ReportError("Expected $ambient <minsecs> value");
return false;
}
if(!parser.SkipWhitespace(false)) return false;
if(!parser.ReadSignedFloat(ref maxsecs) || maxsecs < 0f)
{
parser.ReportError("Expected $ambient <maxsecs> value");
return false;
}
}
// Next token must be secs
else if(token == "periodic")
{
if(!parser.SkipWhitespace(false)) return false;
if(!parser.ReadSignedFloat(ref secs) || secs < 0f)
{
parser.ReportError("Expected $ambient <secs> value");
return false;
}
}
// Store mode
switch(token)
{
case "continuous": mode = AmbientMode.CONTINUOUS; break;
case "random": mode = AmbientMode.RANDOM; break;
case "periodic": mode = AmbientMode.PERIODIC; break;
}
}
else
{
parser.ReportError("Expected ambient sound <mode> or [type]");
return false;
}
// Read volume
if(!parser.SkipWhitespace(false)) return false;
if(!parser.ReadSignedFloat(ref volume) || volume < 0f)
{
parser.ReportError("Expected ambient sound <volume> value");
return false;
}
return true;
}
internal void SetupSound(SoundInfo info)
{
// Store radii
minradius = info.MinimumDistance / info.Attenuation;
if(info.Rolloff == SoundInfo.RolloffType.LOG)
{
// Calculate from RolloffFactor
maxradius = info.MinimumDistance + info.RolloffFactor * info.MinimumDistance;
}
else
{
maxradius = info.MaximumDistance;
}
maxradius /= info.Attenuation;
}
#endregion
}
}

View file

@ -1,6 +1,8 @@
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
@ -12,7 +14,9 @@ namespace CodeImp.DoomBuilder.ZDoom
{
#region ================== Variables
private Dictionary<int, string> ambientsounds;
private Dictionary<int, AmbientSoundInfo> ambientsounds;
private Dictionary<string, SoundInfo> sounds;
private SoundInfo globalprops;
#endregion
@ -20,7 +24,8 @@ namespace CodeImp.DoomBuilder.ZDoom
internal override ScriptType ScriptType { get { return ScriptType.SNDINFO; } }
internal Dictionary<int, string> AmbientSounds { get { return ambientsounds; } }
internal Dictionary<int, AmbientSoundInfo> AmbientSounds { get { return ambientsounds; } }
internal Dictionary<string, SoundInfo> Sounds { get { return sounds; } }
#endregion
@ -28,9 +33,11 @@ namespace CodeImp.DoomBuilder.ZDoom
public SndInfoParser()
{
specialtokens = "";
ambientsounds = new Dictionary<int, string>();
specialtokens = "{}";
ambientsounds = new Dictionary<int, AmbientSoundInfo>();
sounds = new Dictionary<string, SoundInfo>(StringComparer.OrdinalIgnoreCase);
skipeditorcomments = true; // otherwise //$AMBIENT will be treated like one...
globalprops = new SoundInfo();
}
#endregion
@ -50,46 +57,451 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!base.Parse(data, clearerrors)) return false;
// Continue until at the end of the stream
string currentgametype = GameType.UNKNOWN;
while(SkipWhitespace(true))
{
string token = ReadToken().ToLowerInvariant();
//INFO: For many commands, using * as the sound name will mean that
//INFO: the command will apply to all sounds that do not specify otherwise.
string token = StripTokenQuotes(ReadToken()).ToLowerInvariant();
if(string.IsNullOrEmpty(token)) continue;
// Skipping block for different game?
if(currentgametype != GameType.UNKNOWN && currentgametype != General.Map.Config.BaseGame)
{
// Should we stop skipping?
if(token == "$endif") currentgametype = GameType.UNKNOWN;
continue;
}
switch(token)
{
//$ambient <index> <logicalsound> [type] <mode> <volume>
case "$ambient":
// Read index
SkipWhitespace(true);
int index = -1;
if(!ReadSignedInt(ref index) || index < 0)
{
// Not numeric!
ReportError("Expected ambient sound index");
return false;
}
// Must parse all commands to reliably get sound assignments...
case "$alias": if(!ParseAlias()) return false; break;
case "$ambient": if(!ParseAmbient()) return false; break;
case "$archivepath": if(!SkipTokens(1)) return false; break;
case "$attenuation": if(!ParseAttenuation()) return false; break;
case "$edfoverride": break;
case "$limit": if(!ParseLimit()) return false; break;
case "$map": if(!SkipTokens(2)) return false; break;
case "$mididevice": if(!ParseMidiDevice()) return false; break;
case "$musicalias": if(!SkipTokens(2)) return false; break;
case "$musicvolume": if(!SkipTokens(2)) return false; break;
case "$pitchshift": if(!SkipTokens(2)) return false; break;
case "$pitchshiftrange": if(!SkipTokens(1)) return false; break;
case "$playeralias": if(!SkipTokens(4)) return false; break;
case "$playercompat": if(!SkipTokens(4)) return false; break;
case "$playersound": if(!SkipTokens(4)) return false; break;
case "$playersounddup": if(!SkipTokens(4)) return false; break;
case "$random": if(!ParseRandom()) return false; break;
case "$registered": break;
case "$rolloff": if(!ParseRolloff()) return false; break;
case "$singular": if(!SkipTokens(1)) return false; break;
case "$volume": if(!ParseVolume()) return false; break;
// Read name
SkipWhitespace(true);
string logicalsound = StripQuotes(ReadToken(false));
if(string.IsNullOrEmpty(logicalsound))
{
ReportError("Expected ambient sound logicalname");
return false;
}
// Game type blocks...
case "$ifdoom": currentgametype = GameType.DOOM; break;
case "$ifheretic": currentgametype = GameType.HERETIC; break;
case "$ifhexen": currentgametype = GameType.HEXEN; break;
case "$ifstrife": currentgametype = GameType.STRIFE; break;
// Add to collection
if(ambientsounds.ContainsKey(index))
LogWarning("Ambient sound " + index + " is double-defined as \"" + ambientsounds[index] + "\" and \"" + logicalsound + "\"");
ambientsounds[index] = logicalsound;
break;
// Should be logicalname lumpname pair...
default: if(!ParseSoundAssignment(token)) return false; break;
}
}
return true;
}
// $ambient <index> <logicalsound> [type] <mode> <volume>
private bool ParseAmbient()
{
if(!SkipWhitespace(true)) return false;
AmbientSoundInfo asi = new AmbientSoundInfo();
if(!asi.Setup(this)) return false;
// Skip strange cases...
if(asi.SoundName.StartsWith("*")) return true;
// Check for duplicates
if(ambientsounds.ContainsKey(asi.Index))
LogWarning("Ambient sound " + asi.Index + " is double-defined as \"" + ambientsounds[asi.Index].SoundName + "\" and \"" + asi.SoundName + "\"");
// Add to collection
ambientsounds[asi.Index] = asi;
return true;
}
// $alias aliasname soundname
private bool ParseAlias()
{
// Read aliasname
if(!SkipWhitespace(true)) return false;
string aliasname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(aliasname)) return false;
// Read soundname
if(!SkipWhitespace(true)) return false;
string soundname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(soundname)) return false;
SoundInfo info = GetSoundInfo(soundname);
// Check for duplicates
if(sounds.ContainsKey(aliasname))
LogWarning("$alias name \"" + aliasname + "\" is double-defined");
// Add to collection
sounds[aliasname] = info;
return true;
}
// $attenuation aliasname value
private bool ParseAttenuation()
{
// Read aliasname
if(!SkipWhitespace(true)) return false;
string aliasname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(aliasname)) return false;
SoundInfo info = GetSoundInfo(aliasname);
// Read value
if(!SkipWhitespace(true)) return false;
if(!ReadSignedFloat(ref info.Attenuation) || info.Attenuation < 0f)
{
ReportError("Expected $attenuation value");
return false;
}
return true;
}
// Needed because of optional parameter...
// $limit soundname <amount> [limitdistance]
private bool ParseLimit()
{
// Read soundname
if(!SkipWhitespace(true)) return false;
string soundname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(soundname)) return false;
// Must be <amount>
if(!SkipWhitespace(false)) return false;
int amount = 2;
if(!ReadSignedInt(ref amount))
{
ReportError("Expected $limit <amount> value");
return false;
}
// Can be [limitdistance]
if(!SkipWhitespace(false)) return false;
int limitdistance = 256;
string next = ReadToken(false);
if(!ReadSignedInt(next, ref limitdistance) || limitdistance < 0f)
{
// Rewind so this structure can be read again
DataStream.Seek(-next.Length - 1, SeekOrigin.Current);
}
return true;
}
// Needed because of optional parameter...
// $mididevice musicname device [parameter]
private bool ParseMidiDevice()
{
// Read musicname
if(!SkipWhitespace(true)) return false;
string musicname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(musicname)) return false;
// Read device
if(!SkipWhitespace(true)) return false;
string device = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(device)) return false;
// Try to read parameter
if(!SkipWhitespace(true)) return false;
string parameter = StripTokenQuotes(ReadToken()).ToLowerInvariant();
if(string.IsNullOrEmpty(parameter)) return false;
HashSet<string> validparams = new HashSet<string> { "opl", "fluidsynth", "timidity", "wildmidy" };
if(!validparams.Contains(parameter))
{
// Rewind so this structure can be read again
DataStream.Seek(-parameter.Length - 1, SeekOrigin.Current);
}
return true;
}
// $rolloff soundname <mindist> <maxdist>
// $rolloff soundname <type>
private bool ParseRolloff()
{
// Read soundname
if(!SkipWhitespace(true)) return false;
string soundname = StripTokenQuotes(ReadToken());
SoundInfo info = GetSoundInfo(soundname);
// Next token can be <type>...
if(!SkipWhitespace(true)) return false;
string token = ReadToken(false).ToLowerInvariant();
if(token == "custom" || token == "linear" || token == "log")
{
if(token == "linear")
{
// Must be <min distance> <max distance> pair
if(!SkipWhitespace(false)) return false;
if(!ReadSignedInt(ref info.MinimumDistance) || info.MinimumDistance < 0)
{
ReportError("Expected $rolloff linear <mindist> value");
return false;
}
if(!SkipWhitespace(false)) return false;
if(!ReadSignedInt(ref info.MaximumDistance) || info.MaximumDistance < 0)
{
ReportError("Expected $rolloff linear <maxdist> value");
return false;
}
}
else if(token == "log")
{
// Must be <min distance> <rolloff factor> pair
if(!SkipWhitespace(false)) return false;
if(!ReadSignedInt(ref info.MinimumDistance) || info.MinimumDistance < 0)
{
ReportError("Expected $rolloff log <mindist> value");
return false;
}
if(!SkipWhitespace(false)) return false;
if(!ReadSignedFloat(ref info.RolloffFactor) || info.RolloffFactor < 0f)
{
ReportError("Expected $rolloff log <rolloff factor> value");
return false;
}
}
// Store type
switch(token)
{
case "custom": info.Rolloff = SoundInfo.RolloffType.CUSTOM; break;
case "linear": info.Rolloff = SoundInfo.RolloffType.LINEAR; break;
case "log": info.Rolloff = SoundInfo.RolloffType.LOG; break;
}
}
// Must be <mindist> <maxdist> pair
else
{
if(!ReadSignedInt(token, ref info.MinimumDistance) || info.MinimumDistance < 0)
{
ReportError("Expected $rolloff <mindist> value");
return false;
}
if(!SkipWhitespace(false)) return false;
if(!ReadSignedInt(ref info.MaximumDistance) || info.MaximumDistance < 0)
{
ReportError("Expected $rolloff <maxdist> value");
return false;
}
}
return true;
}
// $volume soundname <volume>
private bool ParseVolume()
{
// Read soundname
if(!SkipWhitespace(true)) return false;
string soundname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(soundname)) return false;
SoundInfo info = GetSoundInfo(soundname);
// Read value
if(!SkipWhitespace(true)) return false;
if(!ReadSignedFloat(ref info.Volume) || info.Volume < 0f)
{
ReportError("Expected $volume value");
return false;
}
// Clamp it
info.Volume = General.Clamp(info.Volume, 0.0f, 1.0f);
return true;
}
// $random aliasname { logicalname1 logicalname2 logicalname3 ... }
private bool ParseRandom()
{
// Read aliasname
if(!SkipWhitespace(true)) return false;
string aliasname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(aliasname)) return false;
SoundInfo info = GetSoundInfo(aliasname);
// Must be opening brace
if(!SkipWhitespace(true) || !NextTokenIs("{")) return false;
// Read logicalnames
List<string> logicalnames = new List<string>();
while(true)
{
if(!SkipWhitespace(true)) return false;
string token = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(token) || token == "}") break;
logicalnames.Add(token);
}
if(logicalnames.Count == 0)
{
ReportError("$random " + aliasname + " definition is empty");
return false;
}
if(logicalnames.Contains(aliasname))
{
ReportError("$random " + aliasname + " references itself");
return false;
}
// Assign logicalnames
info.Type = SoundInfo.SoundInfoType.GROUP_RANDOM;
foreach(string name in logicalnames)
{
SoundInfo rinfo = GetSoundInfo(name);
info.Children.Add(rinfo);
}
return true;
}
// Reads logicalname lumpname pair
private bool ParseSoundAssignment(string logicalname)
{
// Check logicalname
logicalname = StripTokenQuotes(logicalname);
if(string.IsNullOrEmpty(logicalname)) return false;
// Read lumpname
if(!SkipWhitespace(true)) return false;
string lumpname = StripTokenQuotes(ReadToken());
if(string.IsNullOrEmpty(lumpname)) return false;
SoundInfo info = GetSoundInfo(logicalname);
info.LumpName = lumpname;
return true;
}
private bool SkipTokens(int count)
{
for(int i = 0; i < count; i++)
{
if(!SkipWhitespace(true)) return false;
if(string.IsNullOrEmpty(ReadToken(false))) return false;
}
return true;
}
#endregion
#region ================== Methods
private SoundInfo GetSoundInfo(string soundname)
{
if(soundname == "*") return globalprops;
if(!sounds.ContainsKey(soundname)) sounds[soundname] = new SoundInfo(soundname);
return sounds[soundname];
}
internal void FinishSetup()
{
// Check undefined sounds
List<SoundInfo> toremove = new List<SoundInfo>();
foreach(SoundInfo sound in sounds.Values)
{
if(!IsValid(sound))
{
if(sound.Type == SoundInfo.SoundInfoType.SOUND)
General.ErrorLogger.Add(ErrorType.Warning, ScriptType + " warning: sound \"" + sound.Name + "\" is not defined.");
toremove.Add(sound);
}
else
{
// Apply settings from the first child...
if(sound.Type == SoundInfo.SoundInfoType.GROUP_RANDOM)
{
SoundInfo src = sound;
do
{
src = src.Children[0];
}while(src.Type != SoundInfo.SoundInfoType.SOUND);
if(src.Type == SoundInfo.SoundInfoType.SOUND)
{
sound.Volume = src.Volume;
sound.Attenuation = src.Attenuation;
sound.MinimumDistance = src.MinimumDistance;
sound.MaximumDistance = src.MaximumDistance;
sound.Rolloff = src.Rolloff;
sound.RolloffFactor = src.RolloffFactor;
}
}
// Apply global settings...
SoundInfo defprops = new SoundInfo("#DEFAULT_PROPERTIES#");
if(sound.Volume == defprops.Volume) sound.Volume = globalprops.Volume;
if(sound.Attenuation == defprops.Attenuation) sound.Attenuation = globalprops.Attenuation;
if(sound.MinimumDistance == defprops.MinimumDistance) sound.MinimumDistance = globalprops.MinimumDistance;
if(sound.MaximumDistance == defprops.MaximumDistance) sound.MaximumDistance = globalprops.MaximumDistance;
if(sound.Rolloff == defprops.Rolloff) sound.Rolloff = globalprops.Rolloff;
if(sound.RolloffFactor == defprops.RolloffFactor) sound.RolloffFactor = globalprops.RolloffFactor;
}
}
// Connect SoundInfos to AmbientSoundInfos...
foreach(AmbientSoundInfo info in ambientsounds.Values)
{
if(!sounds.ContainsKey(info.SoundName))
{
General.ErrorLogger.Add(ErrorType.Warning, ScriptType + " warning: $ambient sound " + info.Index + " has undefined sound \"" + info.SoundName + "\".");
continue;
}
info.SetupSound(sounds[info.SoundName]);
}
// Remove invalid sounds
foreach(SoundInfo info in toremove) sounds.Remove(info.Name);
}
private static bool IsValid(SoundInfo info)
{
switch(info.Type)
{
case SoundInfo.SoundInfoType.SOUND:
return !string.IsNullOrEmpty(info.LumpName) || SoundInfo.SPECIAL_SOUNDS.Contains(info.Name);
case SoundInfo.SoundInfoType.GROUP_RANDOM:
foreach(SoundInfo child in info.Children)
if(!IsValid(child)) return false;
return true;
default:
throw new NotImplementedException("Unknown SoundInfoType");
}
}
#endregion
}
}

View file

@ -0,0 +1,103 @@
#region ================== Namespaces
using System;
using System.Collections.Generic;
#endregion
namespace CodeImp.DoomBuilder.ZDoom
{
public class SoundInfo
{
#region ================== Enums
public enum RolloffType
{
NONE,
INVALID,
CUSTOM,
LINEAR,
LOG
}
public enum SoundInfoType
{
SOUND,
GROUP_RANDOM,
}
#endregion
#region ================== Constants
//TODO: this probably should be defined in the Game Configuration...
public static readonly HashSet<string> SPECIAL_SOUNDS = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"*death", "*xdeath", "*wimpydeath", "*crazydeath", "*burndeath", "*gibbed", "*splat", "*pain100", "*pain75",
"*pain50", "*pain25", "*grunt", "*land", "*falling", "*jump", "*fist", "*fistgrunt", "*usefail", "*evillaugh",
"*weaponlaugh", "*puzzfail", "*poison", "*dive", "*surface", "*gasp", "*taunt", "*regenerate", "*drainhealth"
};
#endregion
#region ================== Variables
private string name;
private List<SoundInfo> children;
private SoundInfoType type;
#endregion
#region ================== Properties
public string Name { get { return name; } }
public List<SoundInfo> Children { get { return children; } }
public SoundInfoType Type { get { return type; } internal set { type = value; } }
// Sound settings
public string LumpName;
public float Volume;
public float Attenuation;
public int MinimumDistance;
public int MaximumDistance;
public RolloffType Rolloff;
public float RolloffFactor;
#endregion
#region ================== Constructor
public SoundInfo(string name)
{
this.name = name;
children = new List<SoundInfo>();
type = SoundInfoType.SOUND;
// Set non-existent settings
Volume = float.MinValue;
Attenuation = float.MinValue;
MinimumDistance = int.MinValue;
MaximumDistance = int.MinValue;
Rolloff = RolloffType.INVALID;
RolloffFactor = float.MinValue;
}
// Default props constructor
internal SoundInfo()
{
this.name = "#GLOBAL_PROPERTIES#";
children = new List<SoundInfo>();
type = SoundInfoType.SOUND;
// Set non-existent settings
Volume = 1.0f;
Attenuation = 1.0f;
MinimumDistance = 200;
MaximumDistance = 1200;
Rolloff = RolloffType.NONE;
RolloffFactor = 1.0f; // Is this the default value?
}
#endregion
}
}

View file

@ -620,6 +620,12 @@
<ItemGroup>
<None Include="Resources\Guidelines.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\LightRadius.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\SoundRadius.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -64,11 +64,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool awaitingMouseClick; //mxd
private bool selectionfromhighlight; //mxd
//mxd. Event lines
//mxd. Helper shapes
private List<Line3D> persistenteventlines;
//mxd. Dynamic light shapes
private List<Line3D> dynamiclightshapes;
private List<Line3D> ambientsoundshapes;
//mxd. Text labels
private Dictionary<Thing, TextLabel> labels;
@ -157,6 +156,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
General.Interface.AddButton(BuilderPlug.Me.MenusForm.SeparatorSectors1); //mxd
General.Interface.AddButton(BuilderPlug.Me.MenusForm.AlignThingsToWall); //mxd
//mxd. Add radii buttons/items...
General.Interface.AddButton(BuilderPlug.Me.MenusForm.ButtonLightRadii, ToolbarSection.Helpers);
General.Interface.AddButton(BuilderPlug.Me.MenusForm.ButtonSoundRadii, ToolbarSection.Helpers);
General.Interface.AddMenu(BuilderPlug.Me.MenusForm.ItemLightRadii, MenuSection.ViewHelpers);
General.Interface.AddMenu(BuilderPlug.Me.MenusForm.ItemSoundRadii, MenuSection.ViewHelpers);
General.Interface.EndToolbarUpdate(); //mxd
// Convert geometry selection to linedefs selection
@ -183,6 +188,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionEffects); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors1); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.AlignThingsToWall); //mxd
//mxd. Remove radii buttons/items...
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ButtonLightRadii);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ButtonSoundRadii);
General.Interface.RemoveMenu(BuilderPlug.Me.MenusForm.ItemLightRadii);
General.Interface.RemoveMenu(BuilderPlug.Me.MenusForm.ItemSoundRadii);
General.Interface.EndToolbarUpdate(); //mxd
//mxd. Do some highlight management...
@ -245,12 +256,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(General.Settings.GZShowEventLines) eventlines.AddRange(persistenteventlines);
//mxd. Dynamic light radii
if(!General.Map.DOOM && General.Settings.GZDrawLightsMode != LightRenderMode.NONE)
if(BuilderPlug.Me.ShowLightRadii)
{
eventlines.AddRange(dynamiclightshapes);
if(highlighted != null) eventlines.AddRange(GetDynamicLightShapes(new List<Thing> { highlighted } ));
}
//mxd. Ambient sound radii
if(BuilderPlug.Me.ShowSoundRadii)
{
eventlines.AddRange(ambientsoundshapes);
if(highlighted != null) eventlines.AddRange(GetAmbientSoundShapes(new List<Thing> { highlighted }));
}
//mxd
if(eventlines.Count > 0) renderer.RenderArrows(eventlines);
@ -1059,12 +1077,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update light radii
dynamiclightshapes = GetDynamicLightShapes(General.Map.Map.Things);
// Update ambient sound radii
ambientsoundshapes = GetAmbientSoundShapes(General.Map.Map.Things);
}
//mxd
private List<Line3D> GetDynamicLightShapes(IEnumerable<Thing> things)
{
List<Line3D> circles = new List<Line3D>();
if(General.Map.DOOM) return circles;
const int linealpha = 128;
foreach(Thing t in things)
{
@ -1138,6 +1161,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
return circles;
}
//mxd
private List<Line3D> GetAmbientSoundShapes(IEnumerable<Thing> things)
{
List<Line3D> circles = new List<Line3D>();
const int linealpha = 128;
foreach(Thing t in things)
{
ThingTypeInfo info = General.Map.Data.GetThingInfoEx(t.Type);
if(info != null && info.AmbientSound != null)
{
// Determine color
PixelColor color = (t == highlighted ? General.Colors.Highlight.WithAlpha(linealpha) : t.Color.WithAlpha(linealpha));
// Add lines if visible
const int numsides = 24;
if(info.AmbientSound.MinimumRadius > 0)
circles.AddRange(LinksCollector.MakeCircleLines(t.Position, color, info.AmbientSound.MinimumRadius, numsides));
if(info.AmbientSound.MaximumRadius > 0)
circles.AddRange(LinksCollector.MakeCircleLines(t.Position, color, info.AmbientSound.MaximumRadius, numsides));
}
}
return circles;
}
#endregion
#region ================== Actions

View file

@ -128,6 +128,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool lockSectorTextureOffsetsWhileDragging; //mxd
private bool syncthingedit; //mxd
private bool alphabasedtexturehighlighting; //mxd
private bool showlightradii; //mxd
private bool showsoundradii; //mxd
#endregion
@ -178,6 +180,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public bool LockSectorTextureOffsetsWhileDragging { get { return lockSectorTextureOffsetsWhileDragging; } internal set { lockSectorTextureOffsetsWhileDragging = value; } } //mxd
public bool SyncronizeThingEdit { get { return syncthingedit; } internal set { syncthingedit = value; } } //mxd
public bool AlphaBasedTextureHighlighting { get { return alphabasedtexturehighlighting; } internal set { alphabasedtexturehighlighting = value; } } //mxd
public bool ShowLightRadii { get { return showlightradii; } internal set { showlightradii = value; } } //mxd
public bool ShowSoundRadii { get { return showsoundradii; } internal set { showsoundradii = value; } } //mxd
//mxd. "Make Door" action persistent settings
internal MakeDoorSettings MakeDoor;
@ -205,6 +209,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
menusform.SyncronizeThingEditButton.Checked = syncthingedit; //mxd
menusform.SyncronizeThingEditSectorsItem.Checked = syncthingedit; //mxd
menusform.SyncronizeThingEditLinedefsItem.Checked = syncthingedit; //mxd
menusform.ItemLightRadii.Checked = showlightradii;
menusform.ButtonLightRadii.Checked = showlightradii;
menusform.ItemSoundRadii.Checked = showsoundradii;
menusform.ButtonSoundRadii.Checked = showsoundradii;
// Load Undo\Redo docker
undoredopanel = new UndoRedoPanel();
@ -289,6 +297,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
viewselectioneffects = General.Settings.ReadPluginSetting("viewselectioneffects", true);
syncthingedit = General.Settings.ReadPluginSetting("syncthingedit", true);
alphabasedtexturehighlighting = General.Settings.ReadPluginSetting("alphabasedtexturehighlighting", true);
showlightradii = General.Settings.ReadPluginSetting("showlightradii", true);
showsoundradii = General.Settings.ReadPluginSetting("showsoundradii", true);
}
//mxd. Save settings, which can be changed via UI
@ -299,6 +309,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("viewselectioneffects", viewselectioneffects);
General.Settings.WritePluginSetting("syncthingedit", syncthingedit);
General.Settings.WritePluginSetting("alphabasedtexturehighlighting", alphabasedtexturehighlighting);
General.Settings.WritePluginSetting("showlightradii", showlightradii);
General.Settings.WritePluginSetting("showsoundradii", showsoundradii);
}
//mxd. These should be reset when changing maps

View file

@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.selectdoublesideditem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.fliplinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.alignlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.flipsidedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.curvelinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
@ -59,6 +60,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.mergesectorsitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.flipsectorlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.alignsectorlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.makedooritem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
@ -99,6 +101,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.syncthingteditbutton = new System.Windows.Forms.ToolStripButton();
this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton();
this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton();
this.buttonlightradii = new System.Windows.Forms.ToolStripButton();
this.buttonsoundradii = new System.Windows.Forms.ToolStripButton();
this.fileMenuStrip = new System.Windows.Forms.MenuStrip();
this.exportStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
@ -107,8 +111,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.itemcopyprops = new System.Windows.Forms.ToolStripMenuItem();
this.itempasteprops = new System.Windows.Forms.ToolStripMenuItem();
this.itempastepropsoptions = new System.Windows.Forms.ToolStripMenuItem();
this.alignsectorlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.alignlinedefsitem = new System.Windows.Forms.ToolStripMenuItem();
this.viewmenuitem = new System.Windows.Forms.ToolStripMenuItem();
this.itemlightradii = new System.Windows.Forms.ToolStripMenuItem();
this.itemsoundradii = new System.Windows.Forms.ToolStripMenuItem();
this.menustrip.SuspendLayout();
this.manualstrip.SuspendLayout();
this.fileMenuStrip.SuspendLayout();
@ -210,6 +215,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.fliplinedefsitem.Text = "&Flip Linedefs";
this.fliplinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// alignlinedefsitem
//
this.alignlinedefsitem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Flip;
this.alignlinedefsitem.Name = "alignlinedefsitem";
this.alignlinedefsitem.Size = new System.Drawing.Size(224, 22);
this.alignlinedefsitem.Tag = "alignlinedefs";
this.alignlinedefsitem.Text = "Align &Linedefs";
//
// flipsidedefsitem
//
this.flipsidedefsitem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Flip;
@ -388,6 +401,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.flipsectorlinedefsitem.Text = "&Flip Linedefs";
this.flipsectorlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// alignsectorlinedefsitem
//
this.alignsectorlinedefsitem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Flip;
this.alignsectorlinedefsitem.Name = "alignsectorlinedefsitem";
this.alignsectorlinedefsitem.Size = new System.Drawing.Size(224, 22);
this.alignsectorlinedefsitem.Tag = "alignlinedefs";
this.alignsectorlinedefsitem.Text = "Align &Linedefs";
this.alignsectorlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
@ -553,7 +575,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonMarqueSelectTouching,
this.syncthingteditbutton,
this.buttonAlignThingsToWall,
this.buttonTextureOffsetLock});
this.buttonTextureOffsetLock,
this.buttonlightradii,
this.buttonsoundradii});
this.manualstrip.Location = new System.Drawing.Point(0, 73);
this.manualstrip.Name = "manualstrip";
this.manualstrip.Size = new System.Drawing.Size(794, 25);
@ -781,11 +805,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
"tant while sector is dragged";
this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click);
//
// buttonlightradii
//
this.buttonlightradii.CheckOnClick = true;
this.buttonlightradii.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttonlightradii.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.LightRadius;
this.buttonlightradii.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonlightradii.Name = "buttonlightradii";
this.buttonlightradii.Size = new System.Drawing.Size(23, 22);
this.buttonlightradii.Text = "Dynamic Light Radii";
this.buttonlightradii.Click += new System.EventHandler(this.buttonlightradii_Click);
//
// buttonsoundradii
//
this.buttonsoundradii.CheckOnClick = true;
this.buttonsoundradii.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttonsoundradii.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.SoundRadius;
this.buttonsoundradii.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonsoundradii.Name = "buttonsoundradii";
this.buttonsoundradii.Size = new System.Drawing.Size(23, 22);
this.buttonsoundradii.Text = "Sound Radii";
this.buttonsoundradii.Click += new System.EventHandler(this.buttonsoundradii_Click);
//
// fileMenuStrip
//
this.fileMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportStripMenuItem,
this.editmenuitem});
this.editmenuitem,
this.viewmenuitem});
this.fileMenuStrip.Location = new System.Drawing.Point(0, 0);
this.fileMenuStrip.Name = "fileMenuStrip";
this.fileMenuStrip.Size = new System.Drawing.Size(794, 24);
@ -851,22 +898,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.itempastepropsoptions.Text = "Paste Properties Special...";
this.itempastepropsoptions.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// alignsectorlinedefsitem
// viewmenuitem
//
this.alignsectorlinedefsitem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Flip;
this.alignsectorlinedefsitem.Name = "alignsectorlinedefsitem";
this.alignsectorlinedefsitem.Size = new System.Drawing.Size(224, 22);
this.alignsectorlinedefsitem.Tag = "alignlinedefs";
this.alignsectorlinedefsitem.Text = "Align &Linedefs";
this.alignsectorlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
this.viewmenuitem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.itemlightradii,
this.itemsoundradii});
this.viewmenuitem.Name = "viewmenuitem";
this.viewmenuitem.Size = new System.Drawing.Size(44, 20);
this.viewmenuitem.Text = "View";
//
// alignlinedefsitem
// itemlightradii
//
this.alignlinedefsitem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Flip;
this.alignlinedefsitem.Name = "alignlinedefsitem";
this.alignlinedefsitem.Size = new System.Drawing.Size(224, 22);
this.alignlinedefsitem.Tag = "alignlinedefs";
this.alignlinedefsitem.Text = "Align &Linedefs";
this.itemlightradii.CheckOnClick = true;
this.itemlightradii.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.LightRadius;
this.itemlightradii.Name = "itemlightradii";
this.itemlightradii.Size = new System.Drawing.Size(212, 22);
this.itemlightradii.Text = "Show Dynamic Light Radii";
this.itemlightradii.Click += new System.EventHandler(this.buttonlightradii_Click);
//
// itemsoundradii
//
this.itemsoundradii.CheckOnClick = true;
this.itemsoundradii.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.SoundRadius;
this.itemsoundradii.Name = "itemsoundradii";
this.itemsoundradii.Size = new System.Drawing.Size(212, 22);
this.itemsoundradii.Text = "Show Sound Radii";
this.itemsoundradii.Click += new System.EventHandler(this.buttonsoundradii_Click);
//
// MenusForm
//
@ -978,5 +1035,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripSeparator separatorcopyprops;
private System.Windows.Forms.ToolStripMenuItem alignsectorlinedefsitem;
private System.Windows.Forms.ToolStripMenuItem alignlinedefsitem;
private System.Windows.Forms.ToolStripButton buttonlightradii;
private System.Windows.Forms.ToolStripButton buttonsoundradii;
private System.Windows.Forms.ToolStripMenuItem viewmenuitem;
private System.Windows.Forms.ToolStripMenuItem itemlightradii;
private System.Windows.Forms.ToolStripMenuItem itemsoundradii;
}
}

View file

@ -90,6 +90,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
public ToolStripMenuItem SyncronizeThingEditLinedefsItem { get { return syncthingeditlinedefsitem; } } //mxd
public ToolStripButton MakeDoor { get { return buttonMakeDoor; } } //mxd
//mxd. Thing mode radii buttons
public ToolStripMenuItem ItemLightRadii { get { return itemlightradii; } }
public ToolStripMenuItem ItemSoundRadii { get { return itemsoundradii; } }
public ToolStripButton ButtonLightRadii { get { return buttonlightradii; } }
public ToolStripButton ButtonSoundRadii { get { return buttonsoundradii; } }
#endregion
#region ================== Constructor / Disposer
@ -280,6 +286,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.FocusDisplay();
}
//mxd
private void buttonlightradii_Click(object sender, EventArgs e)
{
BuilderPlug.Me.ShowLightRadii = !BuilderPlug.Me.ShowLightRadii;
buttonlightradii.Checked = BuilderPlug.Me.ShowLightRadii;
itemlightradii.Checked = BuilderPlug.Me.ShowLightRadii;
General.Interface.DisplayStatus(StatusType.Info, "Light radii are " + (BuilderPlug.Me.ShowLightRadii ? "SHOWN" : "HIDDEN"));
General.Interface.RedrawDisplay();
}
//mxd
private void buttonsoundradii_Click(object sender, EventArgs e)
{
BuilderPlug.Me.ShowSoundRadii = !BuilderPlug.Me.ShowSoundRadii;
buttonsoundradii.Checked = BuilderPlug.Me.ShowSoundRadii;
itemsoundradii.Checked = BuilderPlug.Me.ShowSoundRadii;
General.Interface.DisplayStatus(StatusType.Info, "Sound radii are " + (BuilderPlug.Me.ShowSoundRadii ? "SHOWN" : "HIDDEN"));
General.Interface.RedrawDisplay();
}
#endregion
}
}

View file

@ -242,6 +242,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
}
}
internal static System.Drawing.Bitmap LightRadius {
get {
object obj = ResourceManager.GetObject("LightRadius", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap List {
get {
object obj = ResourceManager.GetObject("List", resourceCulture);
@ -354,6 +361,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
}
}
internal static System.Drawing.Bitmap SoundRadius {
get {
object obj = ResourceManager.GetObject("SoundRadius", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Text {
get {
object obj = ResourceManager.GetObject("Text", resourceCulture);

View file

@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Guidelines" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Guidelines.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Join" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Join.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -217,6 +220,9 @@
<data name="Reset" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Reset.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LightRadius" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LightRadius.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Show" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Show.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -262,7 +268,7 @@
<data name="Show3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Show3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Guidelines" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Guidelines.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="SoundRadius" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SoundRadius.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB