Added, Edit Sectors window: added UI for floor/ceiling portals.

Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Sectors Settings" page).
This commit is contained in:
MaxED 2016-10-11 12:58:35 +00:00
parent 908f5d4cb5
commit 70d35bf1d6
25 changed files with 862 additions and 399 deletions

View file

@ -389,6 +389,31 @@ mapformat_udmf
include("UDMF_misc.cfg", "sectorflags");
}
// Sector portal flags (ceiling)
ceilingportalflags
{
portal_ceil_disabled = "Disabled";
portal_ceil_blocksound = "Block sound";
portal_ceil_nopass = "Impassable";
portal_ceil_norender = "Not rendered";
}
// Sector portal flags (floor)
floorportalflags
{
portal_floor_disabled = "Disabled";
portal_floor_blocksound = "Block sound";
portal_floor_nopass = "Impassable";
portal_floor_norender = "Not rendered";
}
// Sector portal renderstyles
sectorportalrenderstyles
{
translucent = "Translucent";
additive = "Additive";
}
// DEFAULT SECTOR BRIGHTNESS LEVELS
sectorbrightness
{

View file

@ -451,6 +451,8 @@ keywords
GetZAt = "float GetZAt([float x = 0.0[, float y = 0.0[, float angle = 0.0[, int flags = 0[, int pick_pointer = AAPTR_TARGET]]]]])";
IsPointerEqual = "bool IsPointerEqual(int ptr1, int ptr2)";
OverlayID = "int OverlayID()";
OverlayX = "float OverlayX([int layer = 0])";
OverlayY = "float OverlayY([int layer = 0])";
}
properties

View file

@ -214,6 +214,19 @@ Note: All <bool> fields default to false unless mentioned otherwise.
damagehazard = <bool>; // Changes damage model to Strife's delayed damage for the given sector. Default = false.
floorterrain = <string>; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.'
ceilingterrain = <string>; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.'
portal_ceil_alpha = <float> // translucency of ceiling portal (default is 0 (not visible))
portal_ceil_blocksound = <bool> // ceiling portal blocks sound.
portal_ceil_disabled = <bool> // ceiling portal disabled.
portal_ceil_nopass = <bool> // ceiling portal blocks movement if true.
portal_ceil_norender = <bool> // ceiling portal not rendered.
portal_ceil_overlaytype = <string> // defines translucency style, can either be "translucent" or "additive". Default is "translucent".
portal_floor_alpha = <float> // translucency of floor portal (default is 0 (not visible))
portal_floor_blocksound = <bool> // floor portal blocks sound.
portal_floor_disabled = <bool> // floor portal disabled.
portal_floor_nopass = <bool> // ceiling portal blocks movement if true.
portal_floor_norender = <bool> // ceiling portal not rendered.
portal_floor_overlaytype = <string> // defines translucency style, can either be "translucent" or "additive". Default is "translucent".
* Note about dropactors

View file

@ -22,6 +22,12 @@
<b class="fat">sectorflags</b> (structure) - <span class="red">GZDB only, UDMF only</span>.<br />
Lists the options that can be set on a sector.<br />
<br />
<b class="fat">ceilingportalflags</b> (structure) - <span class="red">GZDB only, UDMF only</span>.<br />
Lists the options that can be set on a sector's ceiling portal.<br />
<br />
<b class="fat">floorportalflags</b> (structure) - <span class="red">GZDB only, UDMF only</span>.<br />
Lists the options that can be set on a sector's floor portal.<br />
<br />
<b class="fat">sectorrenderstyles </b>(structure) - <span class="red">GZDB only, UDMF only</span>.<br />
Lists the renderstyles that can be set on a sector.<br />
<br />
@ -33,6 +39,10 @@ sectorrenderstyles
add = "Additive";
}
</pre>
<br />
<b class="fat">sectorportalrenderstyles </b>(structure) - <span class="red">GZDB only, UDMF only</span>.<br />
Same as <b class="fat">sectorrenderstyles</b>, but for floor/ceiling portals.<br />
<br />
<b class="fat">sectorbrightness</b> (structure)<br />
This structure provides Doom Builder with a list of sector brightness levels that are most common. Doom Builder will use these levels to increase/decrease the brightness quickly. The structure must contain numeric setting names for the brightness levels. The settings don't need a value and any value will be ignored by Doom Builder.<br />
<br />

View file

@ -136,11 +136,14 @@ namespace CodeImp.DoomBuilder.Config
// Sectors
private readonly Dictionary<string, string> sectorflags; //mxd
private readonly Dictionary<string, string> ceilportalflags; //mxd
private readonly Dictionary<string, string> floorportalflags; //mxd
private readonly Dictionary<int, SectorEffectInfo> sectoreffects;
private readonly List<SectorEffectInfo> sortedsectoreffects;
private readonly List<GeneralizedOption> geneffectoptions;
private readonly StepsList brightnesslevels;
private readonly Dictionary<string, string> sectorrenderstyles; //mxd
private readonly Dictionary<string, string> sectorportalrenderstyles; //mxd
// Universal fields
private readonly List<UniversalFieldInfo> linedeffields;
@ -263,11 +266,14 @@ namespace CodeImp.DoomBuilder.Config
// Sectors
public IDictionary<string, string> SectorFlags { get { return sectorflags; } } //mxd
public IDictionary<string, string> CeilingPortalFlags { get { return ceilportalflags; } } //mxd
public IDictionary<string, string> FloorPortalFlags { get { return floorportalflags; } } //mxd
public IDictionary<int, SectorEffectInfo> SectorEffects { get { return sectoreffects; } }
public List<SectorEffectInfo> SortedSectorEffects { get { return sortedsectoreffects; } }
public List<GeneralizedOption> GenEffectOptions { get { return geneffectoptions; } }
public StepsList BrightnessLevels { get { return brightnesslevels; } }
public Dictionary<string, string> SectorRenderStyles { get { return sectorrenderstyles; } } //mxd
public Dictionary<string, string> SectorPortalRenderStyles { get { return sectorportalrenderstyles; } } //mxd
// Universal fields
public List<UniversalFieldInfo> LinedefFields { get { return linedeffields; } }
@ -314,6 +320,8 @@ namespace CodeImp.DoomBuilder.Config
this.sidedefflags = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.genactioncategories = new List<GeneralizedCategory>();
this.sectorflags = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.ceilportalflags = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.floorportalflags = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.sectoreffects = new Dictionary<int, SectorEffectInfo>();
this.sortedsectoreffects = new List<SectorEffectInfo>();
this.geneffectoptions = new List<GeneralizedOption>();
@ -330,6 +338,7 @@ namespace CodeImp.DoomBuilder.Config
this.makedoorflags = new Dictionary<string, bool>(StringComparer.Ordinal);
this.linedefrenderstyles = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.sectorrenderstyles = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.sectorportalrenderstyles = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.thingrenderstyles = new Dictionary<string, string>(StringComparer.Ordinal); //mxd
this.defaultskytextures = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); //mxd
@ -447,10 +456,13 @@ namespace CodeImp.DoomBuilder.Config
// Sectors
LoadStringDictionary(sectorflags, "sectorflags"); //mxd
LoadStringDictionary(ceilportalflags, "ceilingportalflags"); //mxd
LoadStringDictionary(floorportalflags, "floorportalflags"); //mxd
LoadBrightnessLevels();
LoadSectorEffects();
LoadSectorGeneralizedEffects();
LoadStringDictionary(sectorrenderstyles, "sectorrenderstyles"); //mxd
LoadStringDictionary(sectorportalrenderstyles, "sectorportalrenderstyles"); //mxd
// Universal fields
linedeffields = LoadUniversalFields("linedef");

View file

@ -306,6 +306,16 @@ namespace CodeImp.DoomBuilder.Controls
if(s.Flags.ContainsKey(group.Key) && s.Flags[group.Key])
flags.Items.Add(new ListViewItem(group.Value) { Checked = true });
}
foreach(KeyValuePair<string, string> group in General.Map.Config.CeilingPortalFlags)
{
if(s.Flags.ContainsKey(group.Key) && s.Flags[group.Key])
flags.Items.Add(new ListViewItem(group.Value + " (ceil. portal)") { Checked = true });
}
foreach(KeyValuePair<string, string> group in General.Map.Config.FloorPortalFlags)
{
if(s.Flags.ContainsKey(group.Key) && s.Flags[group.Key])
flags.Items.Add(new ListViewItem(group.Value + " (floor portal)") { Checked = true });
}
//mxd. Flags panel visibility and size
flagsPanel.Visible = (flags.Items.Count > 0);

View file

@ -35,35 +35,35 @@
this.angletrackbar = new System.Windows.Forms.TrackBar();
this.label1 = new System.Windows.Forms.Label();
this.pivotmodeselector = new System.Windows.Forms.ComboBox();
this.cbuselineangles = new System.Windows.Forms.CheckBox();
this.rotationcontrol = new CodeImp.DoomBuilder.Controls.AngleControlEx();
this.slopeangle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.sloperotation = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.slopeoffset = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.cbuselineangles = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).BeginInit();
this.SuspendLayout();
//
// label23
//
this.label23.Location = new System.Drawing.Point(3, 83);
this.label23.Location = new System.Drawing.Point(31, 75);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(76, 14);
this.label23.Size = new System.Drawing.Size(72, 14);
this.label23.TabIndex = 28;
this.label23.Text = "Slope angle:";
this.label23.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label24
//
this.label24.Location = new System.Drawing.Point(3, 53);
this.label24.Location = new System.Drawing.Point(47, 44);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(76, 14);
this.label24.Size = new System.Drawing.Size(56, 14);
this.label24.TabIndex = 26;
this.label24.Text = "Rotation:";
this.label24.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// reset
//
this.reset.Location = new System.Drawing.Point(85, 138);
this.reset.Location = new System.Drawing.Point(107, 130);
this.reset.Name = "reset";
this.reset.Size = new System.Drawing.Size(82, 23);
this.reset.TabIndex = 25;
@ -73,9 +73,9 @@
//
// label18
//
this.label18.Location = new System.Drawing.Point(3, 113);
this.label18.Location = new System.Drawing.Point(31, 105);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(76, 14);
this.label18.Size = new System.Drawing.Size(72, 14);
this.label18.TabIndex = 23;
this.label18.Text = "Height offset:";
this.label18.TextAlign = System.Drawing.ContentAlignment.TopRight;
@ -83,20 +83,20 @@
// angletrackbar
//
this.angletrackbar.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.angletrackbar.Location = new System.Drawing.Point(173, 82);
this.angletrackbar.Location = new System.Drawing.Point(175, 72);
this.angletrackbar.Maximum = 85;
this.angletrackbar.Minimum = -85;
this.angletrackbar.Name = "angletrackbar";
this.angletrackbar.Size = new System.Drawing.Size(175, 45);
this.angletrackbar.Size = new System.Drawing.Size(113, 45);
this.angletrackbar.TabIndex = 57;
this.angletrackbar.TickFrequency = 10;
this.angletrackbar.ValueChanged += new System.EventHandler(this.angletrackbar_ValueChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(3, 12);
this.label1.Location = new System.Drawing.Point(34, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(76, 14);
this.label1.Size = new System.Drawing.Size(72, 14);
this.label1.TabIndex = 58;
this.label1.Text = "Pivot:";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
@ -109,17 +109,30 @@
"World origin",
"Selection center",
"Sector center"});
this.pivotmodeselector.Location = new System.Drawing.Point(85, 9);
this.pivotmodeselector.Location = new System.Drawing.Point(107, 3);
this.pivotmodeselector.Name = "pivotmodeselector";
this.pivotmodeselector.Size = new System.Drawing.Size(132, 21);
this.pivotmodeselector.TabIndex = 59;
this.pivotmodeselector.SelectedIndexChanged += new System.EventHandler(this.pivotmodeselector_SelectedIndexChanged);
//
// cbuselineangles
//
this.cbuselineangles.AutoSize = true;
this.cbuselineangles.Location = new System.Drawing.Point(175, 44);
this.cbuselineangles.Name = "cbuselineangles";
this.cbuselineangles.Size = new System.Drawing.Size(113, 17);
this.cbuselineangles.TabIndex = 60;
this.cbuselineangles.Tag = "";
this.cbuselineangles.Text = "Use linedef angles";
this.cbuselineangles.UseVisualStyleBackColor = true;
this.cbuselineangles.CheckedChanged += new System.EventHandler(this.cbuselineangles_CheckedChanged);
//
// rotationcontrol
//
this.rotationcontrol.Angle = 0;
this.rotationcontrol.AngleOffset = 0;
this.rotationcontrol.Location = new System.Drawing.Point(173, 36);
this.rotationcontrol.DoomAngleClamping = false;
this.rotationcontrol.Location = new System.Drawing.Point(5, 28);
this.rotationcontrol.Name = "rotationcontrol";
this.rotationcontrol.Size = new System.Drawing.Size(44, 44);
this.rotationcontrol.TabIndex = 56;
@ -136,9 +149,9 @@
this.slopeangle.ButtonStepSmall = 0.1F;
this.slopeangle.ButtonStepsUseModifierKeys = true;
this.slopeangle.ButtonStepsWrapAround = false;
this.slopeangle.Location = new System.Drawing.Point(85, 78);
this.slopeangle.Location = new System.Drawing.Point(107, 70);
this.slopeangle.Name = "slopeangle";
this.slopeangle.Size = new System.Drawing.Size(82, 24);
this.slopeangle.Size = new System.Drawing.Size(62, 24);
this.slopeangle.StepValues = null;
this.slopeangle.TabIndex = 29;
this.slopeangle.WhenTextChanged += new System.EventHandler(this.slopeangle_WhenTextChanged);
@ -154,9 +167,9 @@
this.sloperotation.ButtonStepSmall = 0.1F;
this.sloperotation.ButtonStepsUseModifierKeys = true;
this.sloperotation.ButtonStepsWrapAround = false;
this.sloperotation.Location = new System.Drawing.Point(85, 48);
this.sloperotation.Location = new System.Drawing.Point(107, 40);
this.sloperotation.Name = "sloperotation";
this.sloperotation.Size = new System.Drawing.Size(82, 24);
this.sloperotation.Size = new System.Drawing.Size(62, 24);
this.sloperotation.StepValues = null;
this.sloperotation.TabIndex = 27;
this.sloperotation.WhenTextChanged += new System.EventHandler(this.sloperotation_WhenTextChanged);
@ -173,25 +186,13 @@
this.slopeoffset.ButtonStepSmall = 1F;
this.slopeoffset.ButtonStepsUseModifierKeys = true;
this.slopeoffset.ButtonStepsWrapAround = false;
this.slopeoffset.Location = new System.Drawing.Point(85, 108);
this.slopeoffset.Location = new System.Drawing.Point(107, 100);
this.slopeoffset.Name = "slopeoffset";
this.slopeoffset.Size = new System.Drawing.Size(82, 24);
this.slopeoffset.Size = new System.Drawing.Size(62, 24);
this.slopeoffset.StepValues = null;
this.slopeoffset.TabIndex = 24;
this.slopeoffset.WhenTextChanged += new System.EventHandler(this.slopeoffset_WhenTextChanged);
//
// cbuselineangles
//
this.cbuselineangles.AutoSize = true;
this.cbuselineangles.Location = new System.Drawing.Point(226, 52);
this.cbuselineangles.Name = "cbuselineangles";
this.cbuselineangles.Size = new System.Drawing.Size(113, 17);
this.cbuselineangles.TabIndex = 60;
this.cbuselineangles.Tag = "";
this.cbuselineangles.Text = "Use linedef angles";
this.cbuselineangles.UseVisualStyleBackColor = true;
this.cbuselineangles.CheckedChanged += new System.EventHandler(this.cbuselineangles_CheckedChanged);
//
// SectorSlopeControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -209,7 +210,7 @@
this.Controls.Add(this.slopeoffset);
this.Controls.Add(this.label18);
this.Name = "SectorSlopeControl";
this.Size = new System.Drawing.Size(353, 169);
this.Size = new System.Drawing.Size(298, 160);
((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View file

@ -165,6 +165,16 @@ namespace CodeImp.DoomBuilder.IO
if(stringflags.ContainsKey(flag.Key)) continue;
stringflags.Add(flag.Key, false);
}
foreach(KeyValuePair<string, string> flag in General.Map.Config.CeilingPortalFlags)
{
if(stringflags.ContainsKey(flag.Key)) continue;
stringflags.Add(flag.Key, false);
}
foreach(KeyValuePair<string, string> flag in General.Map.Config.FloorPortalFlags)
{
if(stringflags.ContainsKey(flag.Key)) continue;
stringflags.Add(flag.Key, false);
}
// Create new item
Dictionary<string, UniValue> fields = ReadCustomFields(reader);

View file

@ -66,6 +66,10 @@ namespace CodeImp.DoomBuilder.IO
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.CeilingPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.FloorPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
// Add thing flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)

View file

@ -104,6 +104,10 @@ namespace CodeImp.DoomBuilder.IO
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.CeilingPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.FloorPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
// Add thing flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)
@ -413,6 +417,10 @@ namespace CodeImp.DoomBuilder.IO
Dictionary<string, bool> stringflags = new Dictionary<string, bool>(StringComparer.Ordinal);
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
stringflags[flag.Key] = GetCollectionEntry(c, flag.Key, false, false, where);
foreach(KeyValuePair<string, string> flag in General.Map.Config.CeilingPortalFlags)
stringflags[flag.Key] = GetCollectionEntry(c, flag.Key, false, false, where);
foreach(KeyValuePair<string, string> flag in General.Map.Config.FloorPortalFlags)
stringflags[flag.Key] = GetCollectionEntry(c, flag.Key, false, false, where);
// Create new item
Sector s = map.CreateSector();

View file

@ -90,6 +90,10 @@ namespace CodeImp.DoomBuilder.IO
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.CeilingPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(KeyValuePair<string, string> flag in General.Map.Config.FloorPortalFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
// Add thing flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)

View file

@ -64,6 +64,10 @@ uifields
leakiness = 0;
floorterrain = 2;
ceilingterrain = 2;
portal_ceil_alpha = 1;
portal_floor_alpha = 1;
portal_ceil_overlaytype = 2;
portal_floor_overlaytype = 2;
}
thing

View file

@ -124,6 +124,18 @@
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.ceilportalrenderstylelabel = new System.Windows.Forms.Label();
this.ceilportalrenderstyle = new System.Windows.Forms.ComboBox();
this.label21 = new System.Windows.Forms.Label();
this.ceilportalalpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.ceilportalflags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.floorportalflags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
this.label22 = new System.Windows.Forms.Label();
this.floorportalalpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.floorportalrenderstylelabel = new System.Windows.Forms.Label();
this.floorportalrenderstyle = new System.Windows.Forms.ComboBox();
groupaction = new System.Windows.Forms.GroupBox();
groupeffect = new System.Windows.Forms.GroupBox();
label14 = new System.Windows.Forms.Label();
@ -154,6 +166,8 @@
this.groupBox4.SuspendLayout();
this.tabcomment.SuspendLayout();
this.tabcustom.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox7.SuspendLayout();
this.SuspendLayout();
//
// groupaction
@ -550,7 +564,7 @@
this.tabs.Location = new System.Drawing.Point(10, 10);
this.tabs.Margin = new System.Windows.Forms.Padding(1);
this.tabs.Name = "tabs";
this.tabs.Padding = new System.Drawing.Point(24, 3);
this.tabs.Padding = new System.Drawing.Point(20, 3);
this.tabs.SelectedIndex = 0;
this.tabs.Size = new System.Drawing.Size(511, 504);
this.tabs.TabIndex = 1;
@ -803,7 +817,7 @@
//
// floorAngleControl
//
this.floorAngleControl.Angle = 0;
this.floorAngleControl.Angle = -270;
this.floorAngleControl.AngleOffset = 90;
this.floorAngleControl.DoomAngleClamping = false;
this.floorAngleControl.Location = new System.Drawing.Point(6, 156);
@ -1084,7 +1098,7 @@
//
// ceilAngleControl
//
this.ceilAngleControl.Angle = 0;
this.ceilAngleControl.Angle = -270;
this.ceilAngleControl.AngleOffset = 90;
this.ceilAngleControl.DoomAngleClamping = false;
this.ceilAngleControl.Location = new System.Drawing.Point(6, 156);
@ -1261,6 +1275,8 @@
//
// tabslopes
//
this.tabslopes.Controls.Add(this.groupBox7);
this.tabslopes.Controls.Add(this.groupBox6);
this.tabslopes.Controls.Add(this.groupBox5);
this.tabslopes.Controls.Add(this.groupBox4);
this.tabslopes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -1268,7 +1284,7 @@
this.tabslopes.Name = "tabslopes";
this.tabslopes.Size = new System.Drawing.Size(503, 478);
this.tabslopes.TabIndex = 3;
this.tabslopes.Text = "Slopes";
this.tabslopes.Text = "Slopes / Portals";
this.tabslopes.UseVisualStyleBackColor = true;
//
// groupBox5
@ -1276,16 +1292,16 @@
this.groupBox5.Controls.Add(this.floorslopecontrol);
this.groupBox5.Location = new System.Drawing.Point(3, 239);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(497, 230);
this.groupBox5.Size = new System.Drawing.Size(298, 230);
this.groupBox5.TabIndex = 1;
this.groupBox5.TabStop = false;
this.groupBox5.Text = " Floor ";
this.groupBox5.Text = " Floor slope ";
//
// floorslopecontrol
//
this.floorslopecontrol.Location = new System.Drawing.Point(6, 19);
this.floorslopecontrol.Location = new System.Drawing.Point(4, 19);
this.floorslopecontrol.Name = "floorslopecontrol";
this.floorslopecontrol.Size = new System.Drawing.Size(431, 178);
this.floorslopecontrol.Size = new System.Drawing.Size(290, 178);
this.floorslopecontrol.TabIndex = 0;
this.floorslopecontrol.UseLineAngles = false;
this.floorslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.floorslopecontrol_OnUseLineAnglesChanged);
@ -1298,16 +1314,16 @@
this.groupBox4.Controls.Add(this.ceilingslopecontrol);
this.groupBox4.Location = new System.Drawing.Point(3, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(497, 230);
this.groupBox4.Size = new System.Drawing.Size(298, 230);
this.groupBox4.TabIndex = 0;
this.groupBox4.TabStop = false;
this.groupBox4.Text = " Ceiling ";
this.groupBox4.Text = " Ceiling slope ";
//
// ceilingslopecontrol
//
this.ceilingslopecontrol.Location = new System.Drawing.Point(6, 19);
this.ceilingslopecontrol.Location = new System.Drawing.Point(4, 19);
this.ceilingslopecontrol.Name = "ceilingslopecontrol";
this.ceilingslopecontrol.Size = new System.Drawing.Size(431, 178);
this.ceilingslopecontrol.Size = new System.Drawing.Size(290, 178);
this.ceilingslopecontrol.TabIndex = 1;
this.ceilingslopecontrol.UseLineAngles = false;
this.ceilingslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.ceilingslopecontrol_OnUseLineAnglesChanged);
@ -1396,6 +1412,154 @@
this.tooltip.InitialDelay = 10;
this.tooltip.ReshowDelay = 100;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.ceilportalflags);
this.groupBox6.Controls.Add(this.label21);
this.groupBox6.Controls.Add(this.ceilportalalpha);
this.groupBox6.Controls.Add(this.ceilportalrenderstylelabel);
this.groupBox6.Controls.Add(this.ceilportalrenderstyle);
this.groupBox6.Location = new System.Drawing.Point(307, 3);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(193, 230);
this.groupBox6.TabIndex = 2;
this.groupBox6.TabStop = false;
this.groupBox6.Text = " Ceiling portal ";
//
// ceilportalrenderstylelabel
//
this.ceilportalrenderstylelabel.Location = new System.Drawing.Point(6, 26);
this.ceilportalrenderstylelabel.Name = "ceilportalrenderstylelabel";
this.ceilportalrenderstylelabel.Size = new System.Drawing.Size(72, 14);
this.ceilportalrenderstylelabel.TabIndex = 56;
this.ceilportalrenderstylelabel.Tag = "";
this.ceilportalrenderstylelabel.Text = "Render style:";
this.ceilportalrenderstylelabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// ceilportalrenderstyle
//
this.ceilportalrenderstyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ceilportalrenderstyle.FormattingEnabled = true;
this.ceilportalrenderstyle.Location = new System.Drawing.Point(84, 22);
this.ceilportalrenderstyle.Name = "ceilportalrenderstyle";
this.ceilportalrenderstyle.Size = new System.Drawing.Size(103, 21);
this.ceilportalrenderstyle.TabIndex = 55;
//
// label21
//
this.label21.Location = new System.Drawing.Point(6, 54);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(72, 14);
this.label21.TabIndex = 58;
this.label21.Tag = "";
this.label21.Text = "Alpha:";
this.label21.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// ceilportalalpha
//
this.ceilportalalpha.AllowDecimal = true;
this.ceilportalalpha.AllowNegative = false;
this.ceilportalalpha.AllowRelative = false;
this.ceilportalalpha.ButtonStep = 1;
this.ceilportalalpha.ButtonStepBig = 0.25F;
this.ceilportalalpha.ButtonStepFloat = 0.1F;
this.ceilportalalpha.ButtonStepSmall = 0.01F;
this.ceilportalalpha.ButtonStepsUseModifierKeys = true;
this.ceilportalalpha.ButtonStepsWrapAround = false;
this.ceilportalalpha.Location = new System.Drawing.Point(84, 49);
this.ceilportalalpha.Name = "ceilportalalpha";
this.ceilportalalpha.Size = new System.Drawing.Size(62, 24);
this.ceilportalalpha.StepValues = null;
this.ceilportalalpha.TabIndex = 57;
this.ceilportalalpha.Tag = "";
//
// ceilportalflags
//
this.ceilportalflags.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.ceilportalflags.AutoScroll = true;
this.ceilportalflags.Columns = 2;
this.ceilportalflags.Location = new System.Drawing.Point(6, 79);
this.ceilportalflags.Name = "ceilportalflags";
this.ceilportalflags.Size = new System.Drawing.Size(181, 145);
this.ceilportalflags.TabIndex = 59;
this.ceilportalflags.VerticalSpacing = 1;
//
// groupBox7
//
this.groupBox7.Controls.Add(this.floorportalflags);
this.groupBox7.Controls.Add(this.label22);
this.groupBox7.Controls.Add(this.floorportalalpha);
this.groupBox7.Controls.Add(this.floorportalrenderstylelabel);
this.groupBox7.Controls.Add(this.floorportalrenderstyle);
this.groupBox7.Location = new System.Drawing.Point(307, 239);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(193, 230);
this.groupBox7.TabIndex = 60;
this.groupBox7.TabStop = false;
this.groupBox7.Text = " Floor portal ";
//
// floorportalflags
//
this.floorportalflags.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.floorportalflags.AutoScroll = true;
this.floorportalflags.Columns = 2;
this.floorportalflags.Location = new System.Drawing.Point(6, 79);
this.floorportalflags.Name = "floorportalflags";
this.floorportalflags.Size = new System.Drawing.Size(181, 145);
this.floorportalflags.TabIndex = 59;
this.floorportalflags.VerticalSpacing = 1;
//
// label22
//
this.label22.Location = new System.Drawing.Point(6, 54);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(72, 14);
this.label22.TabIndex = 58;
this.label22.Tag = "";
this.label22.Text = "Alpha:";
this.label22.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// floorportalalpha
//
this.floorportalalpha.AllowDecimal = true;
this.floorportalalpha.AllowNegative = false;
this.floorportalalpha.AllowRelative = false;
this.floorportalalpha.ButtonStep = 1;
this.floorportalalpha.ButtonStepBig = 0.25F;
this.floorportalalpha.ButtonStepFloat = 0.1F;
this.floorportalalpha.ButtonStepSmall = 0.01F;
this.floorportalalpha.ButtonStepsUseModifierKeys = true;
this.floorportalalpha.ButtonStepsWrapAround = false;
this.floorportalalpha.Location = new System.Drawing.Point(84, 49);
this.floorportalalpha.Name = "floorportalalpha";
this.floorportalalpha.Size = new System.Drawing.Size(62, 24);
this.floorportalalpha.StepValues = null;
this.floorportalalpha.TabIndex = 57;
this.floorportalalpha.Tag = "";
//
// floorportalrenderstylelabel
//
this.floorportalrenderstylelabel.Location = new System.Drawing.Point(6, 26);
this.floorportalrenderstylelabel.Name = "floorportalrenderstylelabel";
this.floorportalrenderstylelabel.Size = new System.Drawing.Size(72, 14);
this.floorportalrenderstylelabel.TabIndex = 56;
this.floorportalrenderstylelabel.Tag = "";
this.floorportalrenderstylelabel.Text = "Render style:";
this.floorportalrenderstylelabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// floorportalrenderstyle
//
this.floorportalrenderstyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.floorportalrenderstyle.FormattingEnabled = true;
this.floorportalrenderstyle.Location = new System.Drawing.Point(84, 22);
this.floorportalrenderstyle.Name = "floorportalrenderstyle";
this.floorportalrenderstyle.Size = new System.Drawing.Size(103, 21);
this.floorportalrenderstyle.TabIndex = 55;
//
// SectorEditFormUDMF
//
this.AcceptButton = this.apply;
@ -1436,6 +1600,8 @@
this.groupBox4.ResumeLayout(false);
this.tabcomment.ResumeLayout(false);
this.tabcustom.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -1522,5 +1688,17 @@
private System.Windows.Forms.ComboBox damagetype;
private System.Windows.Forms.Button resetfloorterrain;
private System.Windows.Forms.Button resetceilterrain;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label ceilportalrenderstylelabel;
private System.Windows.Forms.ComboBox ceilportalrenderstyle;
private System.Windows.Forms.Label label21;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox ceilportalalpha;
private CodeImp.DoomBuilder.Controls.CheckboxArrayControl ceilportalflags;
private System.Windows.Forms.GroupBox groupBox7;
private CodeImp.DoomBuilder.Controls.CheckboxArrayControl floorportalflags;
private System.Windows.Forms.Label label22;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorportalalpha;
private System.Windows.Forms.Label floorportalrenderstylelabel;
private System.Windows.Forms.ComboBox floorportalrenderstyle;
}
}

View file

@ -36,7 +36,8 @@ namespace CodeImp.DoomBuilder.Windows
private bool preventchanges; //mxd
private bool undocreated; //mxd
private StepsList anglesteps; //mxd
private readonly string[] renderstyles; //mxd
private readonly List<string> renderstyles; //mxd
private readonly List<string> portalrenderstyles; //mxd
//mxd. Persistent settings
private static bool linkCeilingScale;
@ -187,19 +188,60 @@ namespace CodeImp.DoomBuilder.Windows
flags.Add(lf.Value, lf.Key);
flags.Enabled = General.Map.Config.SectorFlags.Count > 0;
// Fill floor protal flags list
foreach(KeyValuePair<string, string> lf in General.Map.Config.FloorPortalFlags)
floorportalflags.Add(lf.Value, lf.Key);
floorportalflags.Enabled = General.Map.Config.FloorPortalFlags.Count > 0;
// Fill ceiling protal flags list
foreach(KeyValuePair<string, string> lf in General.Map.Config.CeilingPortalFlags)
ceilportalflags.Add(lf.Value, lf.Key);
ceilportalflags.Enabled = General.Map.Config.CeilingPortalFlags.Count > 0;
// Setup renderstyles
renderstyles = new string[General.Map.Config.SectorRenderStyles.Count];
General.Map.Config.SectorRenderStyles.Keys.CopyTo(renderstyles, 0);
floorRenderStyle.Enabled = (General.Map.Config.SectorRenderStyles.Count > 0);
labelfloorrenderstyle.Enabled = (General.Map.Config.SectorRenderStyles.Count > 0);
ceilRenderStyle.Enabled = (General.Map.Config.SectorRenderStyles.Count > 0);
labelceilrenderstyle.Enabled = (General.Map.Config.SectorRenderStyles.Count > 0);
if(General.Map.Config.SectorRenderStyles.Count > 0)
{
string[] rskeys = new string[General.Map.Config.SectorRenderStyles.Count];
General.Map.Config.SectorRenderStyles.Keys.CopyTo(rskeys, 0);
renderstyles = new List<string>(rskeys);
}
else
{
renderstyles = new List<string>();
}
floorRenderStyle.Enabled = (renderstyles.Count > 0);
labelfloorrenderstyle.Enabled = (renderstyles.Count > 0);
ceilRenderStyle.Enabled = (renderstyles.Count > 0);
labelceilrenderstyle.Enabled = (renderstyles.Count > 0);
// Fill renderstyles
foreach(KeyValuePair<string, string> lf in General.Map.Config.SectorRenderStyles)
foreach(string name in General.Map.Config.SectorRenderStyles.Values)
{
floorRenderStyle.Items.Add(lf.Value);
ceilRenderStyle.Items.Add(lf.Value);
floorRenderStyle.Items.Add(name);
ceilRenderStyle.Items.Add(name);
}
// Setup portal renderstyles
if(General.Map.Config.SectorPortalRenderStyles.Count > 0)
{
string[] rskeys = new string[General.Map.Config.SectorPortalRenderStyles.Count];
General.Map.Config.SectorPortalRenderStyles.Keys.CopyTo(rskeys, 0);
portalrenderstyles = new List<string>(rskeys);
}
else
{
portalrenderstyles = new List<string>();
}
floorportalrenderstyle.Enabled = (portalrenderstyles.Count > 0);
floorportalrenderstylelabel.Enabled = (portalrenderstyles.Count > 0);
ceilportalrenderstyle.Enabled = (portalrenderstyles.Count > 0);
ceilportalrenderstylelabel.Enabled = (portalrenderstyles.Count > 0);
// Fill portal renderstyles
foreach(string name in General.Map.Config.SectorPortalRenderStyles.Values)
{
floorportalrenderstyle.Items.Add(name);
ceilportalrenderstyle.Items.Add(name);
}
// Fill effects list
@ -277,6 +319,12 @@ namespace CodeImp.DoomBuilder.Windows
foreach(CheckBox c in flags.Checkboxes)
if(sc.Flags.ContainsKey(c.Tag.ToString())) c.Checked = sc.Flags[c.Tag.ToString()];
// Portal flags
foreach(CheckBox c in floorportalflags.Checkboxes)
if(sc.Flags.ContainsKey(c.Tag.ToString())) c.Checked = sc.Flags[c.Tag.ToString()];
foreach(CheckBox c in ceilportalflags.Checkboxes)
if(sc.Flags.ContainsKey(c.Tag.ToString())) c.Checked = sc.Flags[c.Tag.ToString()];
// Effects
effect.Value = sc.Effect;
brightness.Text = sc.Brightness.ToString();
@ -316,9 +364,17 @@ namespace CodeImp.DoomBuilder.Windows
ceilAlpha.Text = General.Clamp(sc.Fields.GetValue("alphaceiling", 1.0f), 0f, 1f).ToString();
floorAlpha.Text = General.Clamp(sc.Fields.GetValue("alphafloor", 1.0f), 0f, 1f).ToString();
// Portal alpha
ceilportalalpha.Text = General.Clamp(sc.Fields.GetValue("portal_ceil_alpha", 1.0f), 0f, 1f).ToString();
floorportalalpha.Text = General.Clamp(sc.Fields.GetValue("portal_floor_alpha", 1.0f), 0f, 1f).ToString();
//Render style
ceilRenderStyle.SelectedIndex = Array.IndexOf(renderstyles, sc.Fields.GetValue("renderstyleceiling", "translucent"));
floorRenderStyle.SelectedIndex = Array.IndexOf(renderstyles, sc.Fields.GetValue("renderstylefloor", "translucent"));
ceilRenderStyle.SelectedIndex = renderstyles.IndexOf(sc.Fields.GetValue("renderstyleceiling", "translucent"));
floorRenderStyle.SelectedIndex = renderstyles.IndexOf(sc.Fields.GetValue("renderstylefloor", "translucent"));
// Portal render style
ceilportalrenderstyle.SelectedIndex = portalrenderstyles.IndexOf(sc.Fields.GetValue("portal_ceil_overlaytype", "translucent"));
floorportalrenderstyle.SelectedIndex = portalrenderstyles.IndexOf(sc.Fields.GetValue("portal_floor_overlaytype", "translucent"));
//Damage
damagetype.Text = sc.Fields.GetValue("damagetype", NO_DAMAGETYPE);
@ -359,15 +415,9 @@ namespace CodeImp.DoomBuilder.Windows
foreach(Sector s in sectors)
{
// Flags
foreach(CheckBox c in flags.Checkboxes)
{
if(c.CheckState == CheckState.Indeterminate) continue; //mxd
if(s.IsFlagSet(c.Tag.ToString()) != c.Checked)
{
c.ThreeState = true;
c.CheckState = CheckState.Indeterminate;
}
}
SetupFlags(flags, s);
SetupFlags(ceilportalflags, s);
SetupFlags(floorportalflags, s);
// Effects
if(s.Effect != effect.Value) effect.Empty = true;
@ -427,12 +477,22 @@ namespace CodeImp.DoomBuilder.Windows
if(s.Fields.GetValue("alphaceiling", 1.0f).ToString() != ceilAlpha.Text) ceilAlpha.Text = "";
if(s.Fields.GetValue("alphafloor", 1.0f).ToString() != floorAlpha.Text) floorAlpha.Text = "";
// Portal alpha
if(s.Fields.GetValue("portal_ceil_alpha", 1.0f).ToString() != ceilportalalpha.Text) ceilportalalpha.Text = "";
if(s.Fields.GetValue("portal_floor_alpha", 1.0f).ToString() != floorportalalpha.Text) floorportalalpha.Text = "";
//Render style
if(ceilRenderStyle.SelectedIndex > -1 && ceilRenderStyle.SelectedIndex != Array.IndexOf(renderstyles, s.Fields.GetValue("renderstyleceiling", "translucent")))
if(ceilRenderStyle.SelectedIndex > -1 && ceilRenderStyle.SelectedIndex != renderstyles.IndexOf(s.Fields.GetValue("renderstyleceiling", "translucent")))
ceilRenderStyle.SelectedIndex = -1;
if(floorRenderStyle.SelectedIndex > -1 && floorRenderStyle.SelectedIndex != Array.IndexOf(renderstyles, s.Fields.GetValue("renderstylefloor", "translucent")))
if(floorRenderStyle.SelectedIndex > -1 && floorRenderStyle.SelectedIndex != renderstyles.IndexOf(s.Fields.GetValue("renderstylefloor", "translucent")))
floorRenderStyle.SelectedIndex = -1;
// Portal render style
if(ceilportalrenderstyle.SelectedIndex > -1 && ceilportalrenderstyle.SelectedIndex != portalrenderstyles.IndexOf(s.Fields.GetValue("portal_ceil_overlaytype", "translucent")))
ceilportalrenderstyle.SelectedIndex = -1;
if(floorportalrenderstyle.SelectedIndex > -1 && floorportalrenderstyle.SelectedIndex != portalrenderstyles.IndexOf(s.Fields.GetValue("portal_floor_overlaytype", "translucent")))
floorportalrenderstyle.SelectedIndex = -1;
//Damage
if(damagetype.SelectedIndex > -1 && s.Fields.GetValue("damagetype", NO_DAMAGETYPE) != damagetype.Text)
damagetype.SelectedIndex = -1;
@ -512,6 +572,43 @@ namespace CodeImp.DoomBuilder.Windows
preventchanges = false; //mxd
}
//mxd
private static void SetupFlags(CheckboxArrayControl control, Sector s)
{
foreach(CheckBox c in control.Checkboxes)
{
if(c.CheckState == CheckState.Indeterminate) continue; //mxd
if(s.IsFlagSet(c.Tag.ToString()) != c.Checked)
{
c.ThreeState = true;
c.CheckState = CheckState.Indeterminate;
}
}
}
//mxd
private static void ApplyFlags(CheckboxArrayControl control, Sector s)
{
foreach(CheckBox c in control.Checkboxes)
{
switch(c.CheckState)
{
case CheckState.Checked: s.SetFlag(c.Tag.ToString(), true); break;
case CheckState.Unchecked: s.SetFlag(c.Tag.ToString(), false); break;
}
}
}
//mxd
private static void ApplyAlpha(ButtonsNumericTextbox control, Sector s, string key)
{
if(!string.IsNullOrEmpty(control.Text))
{
float ceilAlphaVal = General.Clamp(control.GetResultFloat(s.Fields.GetValue(key, 1.0f)), 0f, 1f);
UniFields.SetFloat(s.Fields, key, ceilAlphaVal, 1.0f);
}
}
//mxd
private void MakeUndo()
{
@ -684,28 +781,15 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
//mxd
string[] rskeys = null;
if(General.Map.Config.SectorRenderStyles.Count > 0)
{
rskeys = new string[General.Map.Config.SectorRenderStyles.Count];
General.Map.Config.SectorRenderStyles.Keys.CopyTo(rskeys, 0);
}
MakeUndo(); //mxd
// Go for all sectors
foreach(Sector s in sectors)
{
// Apply all flags
foreach(CheckBox c in flags.Checkboxes)
{
switch(c.CheckState)
{
case CheckState.Checked: s.SetFlag(c.Tag.ToString(), true); break;
case CheckState.Unchecked: s.SetFlag(c.Tag.ToString(), false); break;
}
}
ApplyFlags(flags, s);
ApplyFlags(ceilportalflags, s);
ApplyFlags(floorportalflags, s);
// Effects
if(!effect.Empty) s.Effect = effect.Value;
@ -717,25 +801,29 @@ namespace CodeImp.DoomBuilder.Windows
commenteditor.Apply(s.Fields);
// Alpha
if(!string.IsNullOrEmpty(ceilAlpha.Text))
ApplyAlpha(ceilAlpha, s, "alphaceiling");
ApplyAlpha(floorAlpha, s, "alphafloor");
// Portal alpha
ApplyAlpha(ceilportalalpha, s, "portal_ceil_alpha");
ApplyAlpha(floorportalalpha, s, "portal_floor_alpha");
// Renderstyle
if(renderstyles.Count > 0)
{
float ceilAlphaVal = General.Clamp(ceilAlpha.GetResultFloat(s.Fields.GetValue("alphaceiling", 1.0f)), 0f, 1f);
UniFields.SetFloat(s.Fields, "alphaceiling", ceilAlphaVal, 1.0f);
}
if(!string.IsNullOrEmpty(floorAlpha.Text))
{
float floorAlphaVal = General.Clamp(floorAlpha.GetResultFloat(s.Fields.GetValue("alphafloor", 1.0f)), 0f, 1f);
UniFields.SetFloat(s.Fields, "alphafloor", floorAlphaVal, 1.0f);
if(ceilRenderStyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "renderstyleceiling", renderstyles[ceilRenderStyle.SelectedIndex], "translucent");
if(floorRenderStyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "renderstylefloor", renderstyles[floorRenderStyle.SelectedIndex], "translucent");
}
//renderstyle
if(rskeys != null)
// Portal renderstyles
if(portalrenderstyles.Count > 0)
{
if(ceilRenderStyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "renderstyleceiling", rskeys[ceilRenderStyle.SelectedIndex], "translucent");
if(floorRenderStyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "renderstylefloor", rskeys[floorRenderStyle.SelectedIndex], "translucent");
if(ceilportalrenderstyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "portal_ceil_overlaytype", portalrenderstyles[ceilportalrenderstyle.SelectedIndex], "translucent");
if(floorportalrenderstyle.SelectedIndex > -1)
UniFields.SetString(s.Fields, "portal_floor_overlaytype", portalrenderstyles[floorportalrenderstyle.SelectedIndex], "translucent");
}
//Damage

View file

@ -138,12 +138,36 @@
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label14.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label13.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupfloorceiling.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@ -174,4 +198,10 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -1233,11 +1233,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single linedef" : sel.Count + " linedefs"); //mxd
General.Map.UndoRedo.CreateUndo("Paste properties to " + rest);
foreach(Linedef l in sel)
{
BuilderPlug.Me.CopiedLinedefProps.Apply(l, false);
l.UpdateCache();
}
BuilderPlug.Me.CopiedLinedefProps.Apply(sel, false);
foreach(Linedef l in sel) l.UpdateCache();
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties to " + rest + ".");
// Update and redraw
@ -1278,11 +1275,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single linedef" : sel.Count + " linedefs");
General.Map.UndoRedo.CreateUndo("Paste properties with options to " + rest);
foreach(Linedef l in sel)
{
BuilderPlug.Me.CopiedLinedefProps.Apply(l, true);
l.UpdateCache();
}
BuilderPlug.Me.CopiedLinedefProps.Apply(sel, true);
foreach(Linedef l in sel) l.UpdateCache();
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties with options to " + rest + ".");
// Update and redraw

View file

@ -1497,9 +1497,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single sector" : sel.Count + " sectors"); //mxd
General.Map.UndoRedo.CreateUndo("Paste properties to " + rest);
BuilderPlug.Me.CopiedSectorProps.Apply(sel, false);
foreach(Sector s in sel)
{
BuilderPlug.Me.CopiedSectorProps.Apply(s, false);
s.UpdateCeilingSurface();
s.UpdateFloorSurface();
}
@ -1544,9 +1544,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single sector" : sel.Count + " sectors");
General.Map.UndoRedo.CreateUndo("Paste properties with options to " + rest);
BuilderPlug.Me.CopiedSectorProps.Apply(sel, true);
foreach(Sector s in sel)
{
BuilderPlug.Me.CopiedSectorProps.Apply(s, true);
s.UpdateCeilingSurface();
s.UpdateFloorSurface();
}

View file

@ -1260,11 +1260,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single thing" : sel.Count + " things"); //mxd
General.Map.UndoRedo.CreateUndo("Paste properties to " + rest);
foreach(Thing t in sel)
{
BuilderPlug.Me.CopiedThingProps.Apply(t, false);
t.UpdateConfiguration();
}
BuilderPlug.Me.CopiedThingProps.Apply(sel, false);
foreach(Thing t in sel) t.UpdateConfiguration();
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties to" + rest + ".");
// Update
@ -1310,11 +1307,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single thing" : sel.Count + " things");
General.Map.UndoRedo.CreateUndo("Paste properties with options to " + rest);
foreach(Thing t in sel)
{
BuilderPlug.Me.CopiedThingProps.Apply(t, true);
t.UpdateConfiguration();
}
BuilderPlug.Me.CopiedThingProps.Apply(sel, true);
foreach(Thing t in sel) t.UpdateConfiguration();
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties with options to " + rest + ".");
// Update

View file

@ -742,10 +742,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single vertex" : sel.Count + " vertices"); //mxd
General.Map.UndoRedo.CreateUndo("Paste properties to " + rest);
foreach(Vertex v in sel)
{
BuilderPlug.Me.CopiedVertexProps.Apply(v, false);
}
BuilderPlug.Me.CopiedVertexProps.Apply(sel, false);
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties to " + rest + ".");
// Update and redraw
@ -785,10 +782,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply properties to selection
string rest = (sel.Count == 1 ? "a single vertex" : sel.Count + " vertices");
General.Map.UndoRedo.CreateUndo("Paste properties with options to " + rest);
foreach(Vertex v in sel)
{
BuilderPlug.Me.CopiedVertexProps.Apply(v, true);
}
BuilderPlug.Me.CopiedVertexProps.Apply(sel, true);
General.Interface.DisplayStatus(StatusType.Action, "Pasted properties with options to " + rest + ".");
// Update and redraw

View file

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
@ -26,13 +27,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called to test if the item should be displayed
public override bool DetermineVisiblity()
{
return General.Map.Config.SectorFlags.Count > 0;
return General.Map.Config.SectorFlags.Count > 0
|| General.Map.Config.CeilingPortalFlags.Count > 0
|| General.Map.Config.FloorPortalFlags.Count > 0;
}
// This is called when the browse button is pressed
public override string Browse(string initialvalue)
{
return FlagsForm.ShowDialog(Form.ActiveForm, initialvalue, General.Map.Config.SectorFlags);
return FlagsForm.ShowDialog(Form.ActiveForm, initialvalue, GetAllFlags());
}
// This is called to perform a search (and replace)
@ -45,6 +48,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Where to search?
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
// Combine all sector flags...
Dictionary<string, string> allflags = GetAllFlags();
// Find what? (mxd)
Dictionary<string, bool> findflagslist = new Dictionary<string, bool>();
foreach(string flag in value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
@ -57,7 +63,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
f = f.Substring(1, f.Length - 1);
}
if(General.Map.Config.SectorFlags.ContainsKey(f)) findflagslist.Add(f, setflag);
if(allflags.ContainsKey(f)) findflagslist.Add(f, setflag);
}
if(findflagslist.Count == 0)
{
@ -80,7 +86,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
f = f.Substring(1, f.Length - 1);
}
if(!General.Map.Config.SectorFlags.ContainsKey(f))
if(!allflags.ContainsKey(f))
{
MessageBox.Show("Invalid replace value \"" + f + "\" for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
return objs.ToArray();
@ -127,6 +133,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
return objs.ToArray();
}
private static Dictionary<string, string> GetAllFlags()
{
// Combine all sector flags...
Dictionary<string, string> allflags = new Dictionary<string, string>(General.Map.Config.SectorFlags);
foreach(var group in General.Map.Config.CeilingPortalFlags)
allflags[group.Key] = group.Value + " (ceil. portal)";
foreach(var group in General.Map.Config.FloorPortalFlags)
allflags[group.Key] = group.Value + " (floor portal)";
return allflags;
}
#endregion
}
}

View file

@ -36,13 +36,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool hexen = true;
private bool udmf = true;
private string description = "Unnamed field";
private string fieldname1;
private string fieldname2;
public bool DOOM { get { return doom; } set { doom = value; } }
public bool HEXEN { get { return hexen; } set { hexen = value; } }
public bool UDMF { get { return udmf; } set { udmf = value; } }
public string Description { get { return description; } set { description = value; } }
public string Field1 { get { return fieldname1; } set { fieldname1 = value; } }
public string Field2 { get { return fieldname2; } set { fieldname2 = value; } }
public bool SupportsCurrentMapFormat { get { return General.Map != null && (General.Map.DOOM && doom || General.Map.HEXEN && hexen || General.Map.UDMF && udmf); } }
public bool SupportsCurrentMapFormat
{
get
{
if(General.Map == null) return false;
if(!string.IsNullOrEmpty(fieldname1) || !string.IsNullOrEmpty(fieldname2)) return General.Map.UDMF;
return (General.Map.DOOM && doom || General.Map.HEXEN && hexen || General.Map.UDMF && udmf);
}
}
}
public abstract class MapElementPropertiesCopySettings
@ -55,11 +67,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
foreach(Attribute attr in Attribute.GetCustomAttributes(prop))
{
if(attr.GetType() == typeof(FieldDescription))
{
FieldDescription fd = (FieldDescription)attr;
prop.SetValue(this, fd.SupportsCurrentMapFormat);
}
if(attr.GetType() != typeof(FieldDescription)) continue;
FieldDescription fd = (FieldDescription)attr;
prop.SetValue(this, fd.SupportsCurrentMapFormat);
}
}
}
@ -90,6 +100,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
protected void ApplyUIFields<T>(ICollection<T> collection, MapElementPropertiesCopySettings settings) where T : MapElement
{
FieldInfo[] props = settings.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach(FieldInfo prop in props)
{
// Property set?
if(!(bool)prop.GetValue(settings)) continue;
foreach(Attribute attr in Attribute.GetCustomAttributes(prop))
{
if(attr.GetType() != typeof(FieldDescription)) continue;
FieldDescription fd = (FieldDescription)attr;
if(fd.SupportsCurrentMapFormat && !string.IsNullOrEmpty(fd.Field1))
{
if(!string.IsNullOrEmpty(fd.Field2))
foreach(T me in collection) Apply(me.Fields, fd.Field1, fd.Field2);
else
foreach(T me in collection) Apply(me.Fields, fd.Field1);
}
}
}
}
protected void Apply(UniFields other, string key)
{
if(uifields.ContainsKey(key)) other[key] = new UniValue(uifields[key]);
@ -125,13 +157,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public class VertexPropertiesCopySettings : MapElementPropertiesCopySettings
{
[FieldDescription(Description = "Vertex Floor Height", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Vertex floor height", Field1 = "zfloor")]
public bool ZFloor = true;
[FieldDescription(Description = "Vertex Ceiling Height", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Vertex ceiling height", Field1 = "zceiling")]
public bool ZCeiling = true;
[FieldDescription(Description = "Custom Fields", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Custom fields", DOOM = false, HEXEN = false)]
public bool Fields = true;
}
@ -151,20 +183,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Applies coped properties
public void Apply(Vertex v, bool usecopysettings)
public void Apply(ICollection<Vertex> verts, bool usecopysettings)
{
Apply(v, (usecopysettings ? CopySettings : defaultsettings));
Apply(verts, (usecopysettings ? CopySettings : defaultsettings));
}
//mxd. Applies coped properties using selected settings
public void Apply(Vertex v, VertexPropertiesCopySettings settings)
public void Apply(ICollection<Vertex> verts, VertexPropertiesCopySettings settings)
{
if(settings.ZCeiling) v.ZCeiling = zceiling;
if(settings.ZFloor) v.ZFloor = zfloor;
if(settings.Fields)
foreach(Vertex v in verts)
{
v.Fields.BeforeFieldsChange();
ApplyCustomFields(v.Fields);
if(settings.ZCeiling) v.ZCeiling = zceiling;
if(settings.ZFloor) v.ZFloor = zfloor;
if(settings.Fields)
{
v.Fields.BeforeFieldsChange();
ApplyCustomFields(v.Fields);
}
}
}
}
@ -176,62 +211,80 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public class SectorPropertiesCopySettings : MapElementPropertiesCopySettings
{
[FieldDescription(Description = "Floor Height")]
[FieldDescription(Description = "Floor height")]
public bool FloorHeight = true;
[FieldDescription(Description = "Ceiling Height")]
[FieldDescription(Description = "Ceiling height")]
public bool CeilingHeight = true;
[FieldDescription(Description = "Floor Texture")]
[FieldDescription(Description = "Floor texture")]
public bool FloorTexture = true;
[FieldDescription(Description = "Ceiling Texture")]
[FieldDescription(Description = "Ceiling texture")]
public bool CeilingTexture = true;
[FieldDescription(Description = "Floor Texture Offset", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor texture offsets", Field1 = "xpanningfloor", Field2 = "ypanningfloor")]
public bool FloorTextureOffset = true;
[FieldDescription(Description = "Ceiling Texture Offset", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling texture offsets", Field1 = "xpanningceiling", Field2 = "ypanningceiling")]
public bool CeilingTextureOffset = true;
[FieldDescription(Description = "Floor Texture Scale", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor texture scale", Field1 = "xscalefloor", Field2 = "yscalefloor")]
public bool FloorTextureScale = true;
[FieldDescription(Description = "Ceiling Texture Scale", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling texture scale", Field1 = "xscaleceiling", Field2 = "yscaleceiling")]
public bool CeilingTextureScale = true;
[FieldDescription(Description = "Floor Texture Rotation", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor texture rotation", Field1 = "rotationfloor")]
public bool FloorTextureRotation = true;
[FieldDescription(Description = "Ceiling Texture Rotation", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling texture rotation", Field1 = "rotationceiling")]
public bool CeilingTextureRotation = true;
[FieldDescription(Description = "Floor Alpha", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor alpha", Field1 = "alphafloor")]
public bool FloorAlpha = true;
[FieldDescription(Description = "Ceiling Alpha", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling alpha", Field1 = "alphaceiling")]
public bool CeilingAlpha = true;
[FieldDescription(Description = "Sector Brightness")]
[FieldDescription(Description = "Floor portal alpha", Field1 = "portal_floor_alpha")]
public bool FloorPortalAlpha = true;
[FieldDescription(Description = "Ceiling portal alpha", Field1 = "portal_ceil_alpha")]
public bool CeilingPortalAlpha = true;
[FieldDescription(Description = "Sector brightness")]
public bool Brightness = true;
[FieldDescription(Description = "Floor Brightness", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor brightness", Field1 = "lightfloor", Field2 = "lightfloorabsolute")]
public bool FloorBrightness = true;
[FieldDescription(Description = "Ceiling Brightness", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling brightness", Field1 = "lightceiling", Field2 = "lightceilingabsolute")]
public bool CeilingBrightness = true;
[FieldDescription(Description = "Floor Render Style", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor render style", Field1 = "renderstylefloor")]
public bool FloorRenderStyle = true;
[FieldDescription(Description = "Ceiling Render Style", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling render style", Field1 = "renderstyleceiling")]
public bool CeilingRenderStyle = true;
[FieldDescription(Description = "Floor portal render style", Field1 = "portal_floor_overlaytype")]
public bool FloorPortalRenderStyle = true;
[FieldDescription(Description = "Ceiling portal render style", Field1 = "portal_ceil_overlaytype")]
public bool CeilingPortalRenderStyle = true;
[FieldDescription(Description = "Floor Slope", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Floor slope", DOOM = false, HEXEN = false)]
public bool FloorSlope = true;
[FieldDescription(Description = "Ceiling Slope", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Ceiling slope", DOOM = false, HEXEN = false)]
public bool CeilingSlope = true;
[FieldDescription(Description = "Floor terrain", Field1 = "floorterrain")]
public bool FloorTerrain = true;
[FieldDescription(Description = "Ceiling terrain", Field1 = "ceilingterrain")]
public bool CeilingTerrain = true;
[FieldDescription(Description = "Tags")]
public bool Tag = true;
@ -242,25 +295,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Flags", DOOM = false, HEXEN = false)]
public bool Flags = true;
[FieldDescription(Description = "Light Color", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Light color", Field1 = "lightcolor")]
public bool LightColor = true;
[FieldDescription(Description = "Fade Color", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Fade color", Field1 = "fadecolor")]
public bool FadeColor = true;
[FieldDescription(Description = "Desaturation", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Desaturation", Field1 = "desaturation")]
public bool Desaturation = true;
[FieldDescription(Description = "Sound Sequence", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Damage type", Field1 = "damagetype")]
public bool DamageType = true;
[FieldDescription(Description = "Damage amount", Field1 = "damageamount")]
public bool DamageAmount = true;
[FieldDescription(Description = "Damage interval", Field1 = "damageinterval")]
public bool DamageInterval = true;
[FieldDescription(Description = "Damage leakiness", Field1 = "leakiness")]
public bool DamageLeakiness = true;
[FieldDescription(Description = "Sound sequence", Field1 = "soundsequence")]
public bool SoundSequence = true;
[FieldDescription(Description = "Gravity", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Gravity", Field1 = "gravity")]
public bool Gravity = true;
[FieldDescription(Description = "Custom Fields", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Custom fields", DOOM = false, HEXEN = false)]
public bool Fields = true;
[FieldDescription(Description = "Comment", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Comment", Field1 = "comment")]
public bool Comment = true;
}
@ -301,66 +366,53 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Applies coped properties
public void Apply(Sector s, bool usecopysettings)
public void Apply(ICollection<Sector> sectors, bool usecopysettings)
{
Apply(s, (usecopysettings ? CopySettings : defaultsettings));
Apply(sectors, (usecopysettings ? CopySettings : defaultsettings));
}
//mxd. Applies coped properties using selected settings
public void Apply(Sector s, SectorPropertiesCopySettings settings)
public void Apply(ICollection<Sector> sectors, SectorPropertiesCopySettings settings)
{
if(settings.FloorHeight) s.FloorHeight = floorheight;
if(settings.CeilingHeight) s.CeilHeight = ceilheight;
if(settings.FloorTexture) s.SetFloorTexture(floortexture);
if(settings.CeilingTexture) s.SetCeilTexture(ceilingtexture);
if(settings.Brightness) s.Brightness = brightness;
if(settings.Tag) s.Tags = new List<int>(tags); //mxd
if(settings.Special) s.Effect = effect;
if(settings.CeilingSlope)
foreach(Sector s in sectors)
{
s.CeilSlopeOffset = ceilslopeoffset;
s.CeilSlope = ceilslope;
}
if(settings.FloorSlope)
{
s.FloorSlopeOffset = floorslopeoffset;
s.FloorSlope = floorslope;
}
if(settings.Flags)
{
s.ClearFlags(); //mxd
foreach(KeyValuePair<string, bool> f in flags) //mxd
s.SetFlag(f.Key, f.Value);
if(settings.FloorHeight) s.FloorHeight = floorheight;
if(settings.CeilingHeight) s.CeilHeight = ceilheight;
if(settings.FloorTexture) s.SetFloorTexture(floortexture);
if(settings.CeilingTexture) s.SetCeilTexture(ceilingtexture);
if(settings.Brightness) s.Brightness = brightness;
if(settings.Tag) s.Tags = new List<int>(tags); //mxd
if(settings.Special) s.Effect = effect;
if(settings.CeilingSlope)
{
s.CeilSlopeOffset = ceilslopeoffset;
s.CeilSlope = ceilslope;
}
if(settings.FloorSlope)
{
s.FloorSlopeOffset = floorslopeoffset;
s.FloorSlope = floorslope;
}
if(settings.Flags)
{
s.ClearFlags(); //mxd
foreach(KeyValuePair<string, bool> f in flags) //mxd
s.SetFlag(f.Key, f.Value);
}
}
// Should we bother?
if(!General.Map.UDMF) return;
// Apply fields
s.Fields.BeforeFieldsChange();
// Apply custom fields
foreach(Sector s in sectors)
{
s.Fields.BeforeFieldsChange();
if(settings.Fields) ApplyCustomFields(s.Fields);
}
// Apply UI fields
if(settings.FloorTextureOffset) Apply(s.Fields, "xpanningfloor", "ypanningfloor");
if(settings.CeilingTextureOffset) Apply(s.Fields, "xpanningceiling", "ypanningceiling");
if(settings.FloorTextureScale) Apply(s.Fields, "xscalefloor", "yscalefloor");
if(settings.CeilingTextureScale) Apply(s.Fields, "xscaleceiling", "yscaleceiling");
if(settings.FloorTextureRotation) Apply(s.Fields, "rotationfloor");
if(settings.CeilingTextureRotation) Apply(s.Fields, "rotationceiling");
if(settings.FloorBrightness) Apply(s.Fields, "lightfloor", "lightfloorabsolute");
if(settings.CeilingBrightness) Apply(s.Fields, "lightceiling", "lightceilingabsolute");
if(settings.FloorAlpha) Apply(s.Fields, "alphafloor");
if(settings.CeilingAlpha) Apply(s.Fields, "alphaceiling");
if(settings.FloorRenderStyle) Apply(s.Fields, "renderstylefloor");
if(settings.CeilingRenderStyle) Apply(s.Fields, "renderstyleceiling");
if(settings.Gravity) Apply(s.Fields, "gravity");
if(settings.LightColor) Apply(s.Fields, "lightcolor");
if(settings.FadeColor) Apply(s.Fields, "fadecolor");
if(settings.Desaturation) Apply(s.Fields, "desaturation");
if(settings.SoundSequence) Apply(s.Fields, "soundsequence");
if(settings.Comment) Apply(s.Fields, "comment");
// Apply custom fields
if(settings.Fields) ApplyCustomFields(s.Fields);
ApplyUIFields(sectors, settings);
}
}
@ -371,46 +423,46 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public class SidedefPropertiesCopySettings : MapElementPropertiesCopySettings
{
[FieldDescription(Description = "Upper Texture")]
[FieldDescription(Description = "Upper texture")]
public bool UpperTexture = true;
[FieldDescription(Description = "Middle Texture")]
[FieldDescription(Description = "Middle texture")]
public bool MiddleTexture = true;
[FieldDescription(Description = "Lower Texture")]
[FieldDescription(Description = "Lower texture")]
public bool LowerTexture = true;
[FieldDescription(Description = "Texture Offset X")]
[FieldDescription(Description = "Texture offset X")]
public bool OffsetX = true;
[FieldDescription(Description = "Texture Offset Y")]
[FieldDescription(Description = "Texture offset Y")]
public bool OffsetY = true;
[FieldDescription(Description = "Upper Texture Offset", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Upper texture offsets", Field1 = "offsetx_top", Field2 = "offsety_top")]
public bool UpperTextureOffset = true;
[FieldDescription(Description = "Middle Texture Offset", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Middle texture offsets", Field1 = "offsetx_mid", Field2 = "offsety_mid")]
public bool MiddleTextureOffset = true;
[FieldDescription(Description = "Lower Texture Offset", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Lower texture offsets", Field1 = "offsetx_bottom", Field2 = "offsety_bottom")]
public bool LowerTextureOffset = true;
[FieldDescription(Description = "Upper Texture Scale", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Upper texture scale", Field1 = "scalex_top", Field2 = "scaley_top")]
public bool UpperTextureScale = true;
[FieldDescription(Description = "Middle Texture Scale", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Middle texture scale", Field1 = "scalex_mid", Field2 = "scaley_mid")]
public bool MiddleTextureScale = true;
[FieldDescription(Description = "Lower Texture Scale", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Lower texture scale", Field1 = "scalex_bottom", Field2 = "scaley_bottom")]
public bool LowerTextureScale = true;
[FieldDescription(Description = "Brightness", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Brightness", Field1 = "light", Field2 = "lightabsolute")]
public bool Brightness = true;
[FieldDescription(Description = "Flags", DOOM = false, HEXEN = false)]
public bool Flags = true;
[FieldDescription(Description = "Custom Fields", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Custom fields", DOOM = false, HEXEN = false)]
public bool Fields = true;
}
@ -439,43 +491,41 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Applies coped properties with all settings enabled
public void Apply(Sidedef s, bool usecopysettings)
public void Apply(ICollection<Sidedef> sides, bool usecopysettings)
{
Apply(s, (usecopysettings ? CopySettings : DefaultSettings));
Apply(sides, (usecopysettings ? CopySettings : DefaultSettings));
}
//mxd. Applies selected settings
public void Apply(Sidedef s, SidedefPropertiesCopySettings settings)
public void Apply(ICollection<Sidedef> sides, SidedefPropertiesCopySettings settings)
{
if(settings.UpperTexture) s.SetTextureHigh(hightexture);
if(settings.MiddleTexture) s.SetTextureMid(middletexture);
if(settings.LowerTexture) s.SetTextureLow(lowtexture);
if(settings.OffsetX) s.OffsetX = offsetx;
if(settings.OffsetY) s.OffsetY = offsety;
if(settings.Flags)
foreach(Sidedef s in sides)
{
s.ClearFlags(); //mxd
foreach(KeyValuePair<string, bool> f in flags) //mxd
s.SetFlag(f.Key, f.Value);
if(settings.UpperTexture) s.SetTextureHigh(hightexture);
if(settings.MiddleTexture) s.SetTextureMid(middletexture);
if(settings.LowerTexture) s.SetTextureLow(lowtexture);
if(settings.OffsetX) s.OffsetX = offsetx;
if(settings.OffsetY) s.OffsetY = offsety;
if(settings.Flags)
{
s.ClearFlags(); //mxd
foreach(KeyValuePair<string, bool> f in flags) //mxd
s.SetFlag(f.Key, f.Value);
}
}
// Should we bother?
if(!General.Map.UDMF) return;
// Apply fields
s.Fields.BeforeFieldsChange();
foreach(Sidedef s in sides)
{
s.Fields.BeforeFieldsChange();
if(settings.Fields) ApplyCustomFields(s.Fields);
}
// Apply UI fields
if(settings.UpperTextureOffset) Apply(s.Fields, "offsetx_top", "offsety_top");
if(settings.MiddleTextureOffset) Apply(s.Fields, "offsetx_mid", "offsety_mid");
if(settings.LowerTextureOffset) Apply(s.Fields, "offsetx_bottom", "offsety_bottom");
if(settings.UpperTextureScale) Apply(s.Fields, "scalex_top", "scaley_top");
if(settings.MiddleTextureScale) Apply(s.Fields, "scalex_mid", "scaley_mid");
if(settings.LowerTextureScale) Apply(s.Fields, "scalex_bottom", "scaley_bottom");
if(settings.Brightness) Apply(s.Fields, "light", "lightabsolute");
// Apply custom fields
if(settings.Fields) ApplyCustomFields(s.Fields);
ApplyUIFields(sides, settings);
}
}
@ -489,7 +539,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Action")]
public bool Action = true;
[FieldDescription(Description = "Action Arguments", DOOM = false)]
[FieldDescription(Description = "Action arguments", DOOM = false)]
public bool Arguments = true;
[FieldDescription(Description = "Activation", DOOM = false, UDMF = false)]
@ -501,19 +551,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Flags")]
public bool Flags = true;
[FieldDescription(Description = "Alpha", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Alpha", Field1 = "alpha")]
public bool Alpha = true;
[FieldDescription(Description = "Render Style", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Render style", Field1 = "renderstyle")]
public bool RenderStyle = true;
[FieldDescription(Description = "Lock Number", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Lock number", Field1 = "locknumber")]
public bool LockNumber = true;
[FieldDescription(Description = "Custom Fields", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Custom fields", DOOM = false, HEXEN = false)]
public bool Fields = true;
[FieldDescription(Description = "Comment", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Comment", Field1 = "comment")]
public bool Comment = true;
}
@ -545,64 +595,74 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Applies coped properties with all settings enabled
public void Apply(Linedef l, bool usecopysettings) { Apply(l, usecopysettings, true); }
public void Apply(Linedef l, bool usecopysettings, bool applytosidedefs)
public void Apply(ICollection<Linedef> lines, bool usecopysettings) { Apply(lines, usecopysettings, true); }
public void Apply(ICollection<Linedef> lines, bool usecopysettings, bool applytosidedefs)
{
if(usecopysettings)
Apply(l, CopySettings, (applytosidedefs ? SidedefProperties.CopySettings : null));
Apply(lines, CopySettings, (applytosidedefs ? SidedefProperties.CopySettings : null));
else
Apply(l, defaultsettings, (applytosidedefs ? SidedefProperties.DefaultSettings : null));
Apply(lines, defaultsettings, (applytosidedefs ? SidedefProperties.DefaultSettings : null));
}
//mxd. Applies selected linededf and sidedef settings
public void Apply(Linedef l, LinedefPropertiesCopySettings settings, SidedefPropertiesCopySettings sidesettings)
public void Apply(ICollection<Linedef> lines, LinedefPropertiesCopySettings settings, SidedefPropertiesCopySettings sidesettings)
{
if(sidesettings != null)
List<Sidedef> frontsides = new List<Sidedef>(lines.Count);
List<Sidedef> backsides = new List<Sidedef>(lines.Count);
foreach(Linedef l in lines)
{
if((front != null) && (l.Front != null)) front.Apply(l.Front, sidesettings);
if((back != null) && (l.Back != null)) back.Apply(l.Back, sidesettings);
}
if(settings.Flags)
{
l.ClearFlags();
foreach(KeyValuePair<string, bool> f in flags)
l.SetFlag(f.Key, f.Value);
}
if(settings.Activation) l.Activate = activate;
if(settings.Tag) l.Tags = new List<int>(tags); //mxd
if(settings.Action) l.Action = action;
if(settings.Arguments)
{
for(int i = 0; i < l.Args.Length; i++)
l.Args[i] = args[i];
if(settings.Flags)
{
l.ClearFlags();
foreach(KeyValuePair<string, bool> f in flags)
l.SetFlag(f.Key, f.Value);
}
if(settings.Activation) l.Activate = activate;
if(settings.Tag) l.Tags = new List<int>(tags); //mxd
if(settings.Action) l.Action = action;
if(settings.Arguments)
{
for(int i = 0; i < l.Args.Length; i++)
l.Args[i] = args[i];
}
if(l.Front != null) frontsides.Add(l.Front);
if(l.Back != null) backsides.Add(l.Back);
}
// Should we bother?
if(!General.Map.UDMF) return;
// Apply fields
l.Fields.BeforeFieldsChange();
// Apply string arguments
if(settings.Arguments)
foreach(Linedef l in lines)
{
Apply(l.Fields, "arg0str");
l.Fields.BeforeFieldsChange();
// Apply string arguments
if(settings.Arguments)
{
Apply(l.Fields, "arg0str");
//TODO: re-enable when UI part is ready
//Apply(l.Fields, "arg1str");
//Apply(l.Fields, "arg2str");
//Apply(l.Fields, "arg3str");
//Apply(l.Fields, "arg4str");
//TODO: re-enable when UI part is ready
//Apply(l.Fields, "arg1str");
//Apply(l.Fields, "arg2str");
//Apply(l.Fields, "arg3str");
//Apply(l.Fields, "arg4str");
}
// Apply custom fields
if(settings.Fields) ApplyCustomFields(l.Fields);
}
// Apply UI fields
if(settings.Alpha) Apply(l.Fields, "alpha");
if(settings.RenderStyle) Apply(l.Fields, "renderstyle");
if(settings.LockNumber) Apply(l.Fields, "locknumber");
if(settings.Comment) Apply(l.Fields, "comment");
ApplyUIFields(lines, settings);
// Apply custom fields
if(settings.Fields) ApplyCustomFields(l.Fields);
// Apply sidedef settings
if(sidesettings != null)
{
if(front != null) front.Apply(frontsides, sidesettings);
if(back != null) back.Apply(backsides, sidesettings);
}
}
}
@ -619,7 +679,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Angle")]
public bool Angle = true;
[FieldDescription(Description = "Z Height", DOOM = false)]
[FieldDescription(Description = "Z-height", DOOM = false)]
public bool ZHeight = true;
[FieldDescription(Description = "Pitch", DOOM = false, HEXEN = false)]
@ -634,7 +694,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Action", DOOM = false)]
public bool Action = true;
[FieldDescription(Description = "Action Arguments", DOOM = false)]
[FieldDescription(Description = "Action arguments", DOOM = false)]
public bool Arguments = true;
[FieldDescription(Description = "Tag", DOOM = false)]
@ -643,31 +703,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
[FieldDescription(Description = "Flags")]
public bool Flags = true;
[FieldDescription(Description = "Conversation ID", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Conversation ID", Field1 = "conversation")]
public bool Conversation = true;
[FieldDescription(Description = "Gravity", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Gravity", Field1 = "gravity")]
public bool Gravity = true;
[FieldDescription(Description = "Health Multiplier", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Health multiplier", Field1 = "health")]
public bool Health = true;
[FieldDescription(Description = "Score", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Score", Field1 = "score")]
public bool Score = true;
[FieldDescription(Description = "Alpha", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Float bob phase", Field1 = "floatbobphase")]
public bool FloatBobPhase = true;
[FieldDescription(Description = "Alpha", Field1 = "alpha")]
public bool Alpha = true;
[FieldDescription(Description = "Fill Color", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Fill color", Field1 = "fillcolor")]
public bool FillColor = true;
[FieldDescription(Description = "Render Style", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Render style", Field1 = "renderstyle")]
public bool RenderStyle = true;
[FieldDescription(Description = "Custom Fields", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Custom fields", DOOM = false, HEXEN = false)]
public bool Fields = true;
[FieldDescription(Description = "Comment", DOOM = false, HEXEN = false)]
[FieldDescription(Description = "Comment", Field1 = "comment")]
public bool Comment = true;
}
@ -706,64 +769,63 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Applies coped properties with all settings enabled
public void Apply(Thing t, bool usecopysettings)
public void Apply(ICollection<Thing> things, bool usecopysettings)
{
Apply(t, (usecopysettings ? CopySettings : defaultsettings));
Apply(things, (usecopysettings ? CopySettings : defaultsettings));
}
//mxd. Applies selected settings
public void Apply(Thing t, ThingPropertiesCopySettings settings)
public void Apply(ICollection<Thing> things, ThingPropertiesCopySettings settings)
{
if(settings.Type) t.Type = type;
if(settings.Angle) t.Rotate(angle);
if(settings.ZHeight) t.Move(t.Position.x, t.Position.y, zheight);
if(settings.Pitch) t.SetPitch(pitch);
if(settings.Roll) t.SetRoll(roll);
if(settings.Scale) t.SetScale(scalex, scaley);
if(settings.Flags)
foreach(Thing t in things)
{
t.ClearFlags();
foreach(KeyValuePair<string, bool> f in flags)
t.SetFlag(f.Key, f.Value);
}
if(settings.Tag) t.Tag = tag;
if(settings.Action) t.Action = action;
if(settings.Arguments)
{
for(int i = 0; i < t.Args.Length; i++)
t.Args[i] = args[i];
if(settings.Type) t.Type = type;
if(settings.Angle) t.Rotate(angle);
if(settings.ZHeight) t.Move(t.Position.x, t.Position.y, zheight);
if(settings.Pitch) t.SetPitch(pitch);
if(settings.Roll) t.SetRoll(roll);
if(settings.Scale) t.SetScale(scalex, scaley);
if(settings.Flags)
{
t.ClearFlags();
foreach(KeyValuePair<string, bool> f in flags)
t.SetFlag(f.Key, f.Value);
}
if(settings.Tag) t.Tag = tag;
if(settings.Action) t.Action = action;
if(settings.Arguments)
{
for(int i = 0; i < t.Args.Length; i++)
t.Args[i] = args[i];
}
}
// Should we bother?
if(!General.Map.UDMF) return;
// Apply fields
t.Fields.BeforeFieldsChange();
// Apply string arguments
if(settings.Arguments)
foreach(Thing t in things)
{
Apply(t.Fields, "arg0str");
// Apply fields
t.Fields.BeforeFieldsChange();
//TODO: re-enable when UI part is ready
//Apply(t.Fields, "arg1str");
//Apply(t.Fields, "arg2str");
//Apply(t.Fields, "arg3str");
//Apply(t.Fields, "arg4str");
// Apply string arguments
if(settings.Arguments)
{
Apply(t.Fields, "arg0str");
//TODO: re-enable when UI part is ready
//Apply(t.Fields, "arg1str");
//Apply(t.Fields, "arg2str");
//Apply(t.Fields, "arg3str");
//Apply(t.Fields, "arg4str");
}
// Apply custom fields
if(settings.Fields) ApplyCustomFields(t.Fields);
}
// Apply UI fields
if(settings.Conversation) Apply(t.Fields, "conversation");
if(settings.Gravity) Apply(t.Fields, "gravity");
if(settings.Health) Apply(t.Fields, "health");
if(settings.FillColor) Apply(t.Fields, "fillcolor");
if(settings.Alpha) Apply(t.Fields, "alpha");
if(settings.Score) Apply(t.Fields, "score");
if(settings.RenderStyle) Apply(t.Fields, "renderstyle");
if(settings.Comment) Apply(t.Fields, "comment");
// Apply custom fields
if(settings.Fields) ApplyCustomFields(t.Fields);
ApplyUIFields(things, settings);
}
}
@ -822,24 +884,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!General.Map.UDMF) return true;
// UI fields
if(flags.FloorTextureOffset && !UniFields.ValuesMatch("xpanningfloor", "ypanningfloor", source, target)) return false;
if(flags.CeilingTextureOffset && !UniFields.ValuesMatch("xpanningceiling", "ypanningceiling", source, target)) return false;
if(flags.FloorTextureScale && !UniFields.ValuesMatch("xscalefloor", "yscalefloor", source, target)) return false;
if(flags.CeilingTextureScale && !UniFields.ValuesMatch("xscaleceiling", "yscaleceiling", source, target)) return false;
if(flags.FloorTextureRotation && !UniFields.ValuesMatch("rotationfloor", source, target)) return false;
if(flags.CeilingTextureRotation && !UniFields.ValuesMatch("rotationceiling", source, target)) return false;
if(flags.FloorBrightness && !UniFields.ValuesMatch("lightfloor", "lightfloorabsolute", source, target)) return false;
if(flags.CeilingBrightness && !UniFields.ValuesMatch("lightceiling", "lightceilingabsolute", source, target)) return false;
if(flags.FloorAlpha && !UniFields.ValuesMatch("alphafloor", source, target)) return false;
if(flags.CeilingAlpha && !UniFields.ValuesMatch("alphaceiling", source, target)) return false;
if(flags.FloorRenderStyle && !UniFields.ValuesMatch("renderstylefloor", source, target)) return false;
if(flags.CeilingRenderStyle && !UniFields.ValuesMatch("renderstyleceiling", source, target)) return false;
if(flags.Gravity && !UniFields.ValuesMatch("gravity", source, target)) return false;
if(flags.LightColor && !UniFields.ValuesMatch("lightcolor", source, target)) return false;
if(flags.FadeColor && !UniFields.ValuesMatch("fadecolor", source, target)) return false;
if(flags.Desaturation && !UniFields.ValuesMatch("desaturation", source, target)) return false;
if(flags.SoundSequence && !UniFields.ValuesMatch("soundsequence", source, target)) return false;
if(flags.Comment && !UniFields.ValuesMatch("comment", source, target)) return false;
if(!UIFieldsMatch(flags, source, target)) return false;
// Custom fields
return !flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields);
@ -876,10 +921,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(General.Map.UDMF)
{
// UI fields
if(linedefflags.Alpha && !UniFields.ValuesMatch("alpha", source, target)) return false;
if(linedefflags.RenderStyle && !UniFields.ValuesMatch("renderstyle", source, target)) return false;
if(linedefflags.LockNumber && !UniFields.ValuesMatch("locknumber", source, target)) return false;
if(linedefflags.Comment && !UniFields.ValuesMatch("comment", source, target)) return false;
if(!UIFieldsMatch(linedefflags, source, target)) return false;
// Custom fields
if(linedefflags.Fields && !UniFields.CustomFieldsMatch(source.Fields, target.Fields)) return false;
@ -910,13 +952,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags())) return false;
// UI fields
if(flags.UpperTextureScale && !UniFields.ValuesMatch("scalex_top", "scaley_top", source, target)) return false;
if(flags.MiddleTextureScale && !UniFields.ValuesMatch("scalex_mid", "scaley_mid", source, target)) return false;
if(flags.LowerTextureScale && !UniFields.ValuesMatch("scalex_bottom", "scaley_bottom", source, target)) return false;
if(flags.UpperTextureOffset && !UniFields.ValuesMatch("offsetx_top", "offsety_top", source, target)) return false;
if(flags.MiddleTextureOffset && !UniFields.ValuesMatch("offsetx_mid", "offsety_mid", source, target)) return false;
if(flags.LowerTextureOffset && !UniFields.ValuesMatch("offsetx_bottom", "offsety_bottom", source, target)) return false;
if(flags.Brightness && !UniFields.ValuesMatch("light", "lightabsolute", source, target)) return false;
if(!UIFieldsMatch(flags, source, target)) return false;
// Custom fields
return !flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields);
@ -958,14 +994,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(flags.Scale && (source.ScaleX != target.ScaleX) || (source.ScaleY != target.ScaleY)) return false;
// UI fields
if(flags.Conversation && !UniFields.ValuesMatch("conversation", source, target)) return false;
if(flags.Gravity && !UniFields.ValuesMatch("gravity", source, target)) return false;
if(flags.Health && !UniFields.ValuesMatch("health", source, target)) return false;
if(flags.FillColor && !UniFields.ValuesMatch("fillcolor", source, target)) return false;
if(flags.Alpha && !UniFields.ValuesMatch("alpha", source, target)) return false;
if(flags.Score && !UniFields.ValuesMatch("score", source, target)) return false;
if(flags.RenderStyle && !UniFields.ValuesMatch("renderstyle", source, target)) return false;
if(flags.Comment && !UniFields.ValuesMatch("comment", source, target)) return false;
if(!UIFieldsMatch(flags, source, target)) return false;
// Custom fields
return !flags.Fields || UniFields.CustomFieldsMatch(source.Fields, target.Fields);
@ -973,6 +1002,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion
#region Utility
private static bool FlagsMatch(HashSet<string> flags1, HashSet<string> flags2)
{
if(flags1.Count != flags2.Count) return false;
@ -1006,6 +1037,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
return count.Values.All(c => c == 0);
}
private static bool UIFieldsMatch(MapElementPropertiesCopySettings settings, MapElement first, MapElement second)
{
FieldInfo[] props = settings.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach(FieldInfo prop in props)
{
// Property set?
if(!(bool)prop.GetValue(settings)) continue;
foreach(Attribute attr in Attribute.GetCustomAttributes(prop))
{
if(attr.GetType() != typeof(FieldDescription)) continue;
FieldDescription fd = (FieldDescription)attr;
if(fd.SupportsCurrentMapFormat && !string.IsNullOrEmpty(fd.Field1))
{
if(!string.IsNullOrEmpty(fd.Field2))
{
if(!UniFields.ValuesMatch(fd.Field1, fd.Field2, first, second)) return false;
}
else
{
if(!UniFields.ValuesMatch(fd.Field1, first, second)) return false;
}
}
}
}
return true;
}
#endregion
}
#endregion

View file

@ -689,7 +689,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
mode.SetActionResult("Pasted sector properties.");
//mxd. Added "usecopysettings"
BuilderPlug.Me.CopiedSectorProps.Apply(level.sector, usecopysettings);
BuilderPlug.Me.CopiedSectorProps.Apply(new List<Sector> { level.sector }, usecopysettings);
if(mode.VisualSectorExists(level.sector))
{

View file

@ -1206,8 +1206,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
string pastetarget = (pastesideprops ? "linedef and sidedef" : "linedef"); //mxd
mode.CreateUndo("Paste " + pastetarget + " properties");
mode.SetActionResult("Pasted " + pastetarget + " properties.");
BuilderPlug.Me.CopiedLinedefProps.Apply(Sidedef.Line, usecopysettings, false); //mxd
if(pastesideprops) BuilderPlug.Me.CopiedSidedefProps.Apply(Sidedef, usecopysettings); //mxd. Added "usecopysettings"
BuilderPlug.Me.CopiedLinedefProps.Apply(new List<Linedef> { Sidedef.Line }, usecopysettings, false); //mxd
if(pastesideprops) BuilderPlug.Me.CopiedSidedefProps.Apply(new List<Sidedef> { Sidedef }, usecopysettings); //mxd. Added "usecopysettings"
// Update sectors on both sides
BaseVisualSector front = (BaseVisualSector)mode.GetVisualSector(Sidedef.Sector);

View file

@ -693,7 +693,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
mode.CreateUndo("Paste thing properties");
mode.SetActionResult("Pasted thing properties.");
BuilderPlug.Me.CopiedThingProps.Apply(Thing, usecopysettings); //mxd. Added "usecopysettings"
BuilderPlug.Me.CopiedThingProps.Apply(new List<Thing> { Thing }, usecopysettings); //mxd. Added "usecopysettings"
Thing.UpdateConfiguration();
this.Rebuild();
mode.ShowTargetInfo();

View file

@ -296,7 +296,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
mode.CreateUndo("Paste vertex properties");
mode.SetActionResult("Pasted vertex properties.");
BuilderPlug.Me.CopiedVertexProps.Apply(vertex, usecopysettings);
BuilderPlug.Me.CopiedVertexProps.Apply(new List<Vertex> { vertex }, usecopysettings);
//update affected sectors
UpdateGeometry(vertex);