Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • STJr/UltimateZoneBuilder
  • KartKrew/high-voltage-ring
  • ashi/ultimate-zone-builder
  • Alam/UltimateZoneBuilder
  • Indev/UltimateZoneBuilder
  • Acelite/UltimateZoneBuilder
  • LoganAir/high-voltage-ring
  • coatlessali/high-voltage-ring
  • spherallic/high-voltage-ring
  • EeveeEuphoria/high-voltage-ring
  • StarManiaKG/the-story-of-horsepowering-vetted-racing
  • frostu8/high-voltage-ring
  • Benji_Menji/high-voltage-ring
  • Nep2Disk/UltimateZoneBuilder
  • PencilVoid/high-voltage-ring
15 results
Show changes
Showing
with 2228 additions and 2023 deletions
source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls; using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
...@@ -187,8 +188,14 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -187,8 +188,14 @@ namespace CodeImp.DoomBuilder.Windows
{ {
InitializeComponent(); InitializeComponent();
DoUDMFControls(this);
// Plane equation slopes are handled internally instead through the UDMF fields, so they need special attention
EnableDisableControlAndChildren(gbCeilingSLope, General.Map.Config.PlaneEquationSupport);
EnableDisableControlAndChildren(gbFloorSlope, General.Map.Config.PlaneEquationSupport);
//mxd. Load settings //mxd. Load settings
if(General.Settings.StoreSelectedEditTab) if (General.Settings.StoreSelectedEditTab)
{ {
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0); int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
tabs.SelectTab(activetab); tabs.SelectTab(activetab);
...@@ -220,10 +227,6 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -220,10 +227,6 @@ namespace CodeImp.DoomBuilder.Windows
{ {
renderstyles = new List<string>(); 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 // Fill renderstyles
foreach(string name in General.Map.Config.SectorRenderStyles.Values) foreach(string name in General.Map.Config.SectorRenderStyles.Values)
...@@ -243,10 +246,6 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -243,10 +246,6 @@ namespace CodeImp.DoomBuilder.Windows
{ {
portalrenderstyles = new List<string>(); 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 // Fill portal renderstyles
foreach(string name in General.Map.Config.SectorPortalRenderStyles.Values) foreach(string name in General.Map.Config.SectorPortalRenderStyles.Values)
...@@ -838,6 +837,36 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -838,6 +837,36 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
EnableDisableControlAndChildren(control, General.Map.Config.SectorFields.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion #endregion
#region ================== Events #region ================== Events
......
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
this.cbrandomroll.Name = "cbrandomroll"; this.cbrandomroll.Name = "cbrandomroll";
this.cbrandomroll.Size = new System.Drawing.Size(66, 17); this.cbrandomroll.Size = new System.Drawing.Size(66, 17);
this.cbrandomroll.TabIndex = 5; this.cbrandomroll.TabIndex = 5;
this.cbrandomroll.Tag = "roll";
this.cbrandomroll.Text = "Random"; this.cbrandomroll.Text = "Random";
this.cbrandomroll.UseVisualStyleBackColor = true; this.cbrandomroll.UseVisualStyleBackColor = true;
this.cbrandomroll.CheckedChanged += new System.EventHandler(this.cbrandomroll_CheckedChanged); this.cbrandomroll.CheckedChanged += new System.EventHandler(this.cbrandomroll_CheckedChanged);
...@@ -154,6 +155,7 @@ ...@@ -154,6 +155,7 @@
this.cbrandompitch.Name = "cbrandompitch"; this.cbrandompitch.Name = "cbrandompitch";
this.cbrandompitch.Size = new System.Drawing.Size(66, 17); this.cbrandompitch.Size = new System.Drawing.Size(66, 17);
this.cbrandompitch.TabIndex = 3; this.cbrandompitch.TabIndex = 3;
this.cbrandompitch.Tag = "pitch";
this.cbrandompitch.Text = "Random"; this.cbrandompitch.Text = "Random";
this.cbrandompitch.UseVisualStyleBackColor = true; this.cbrandompitch.UseVisualStyleBackColor = true;
this.cbrandompitch.CheckedChanged += new System.EventHandler(this.cbrandompitch_CheckedChanged); this.cbrandompitch.CheckedChanged += new System.EventHandler(this.cbrandompitch_CheckedChanged);
...@@ -186,6 +188,7 @@ ...@@ -186,6 +188,7 @@
this.roll.Size = new System.Drawing.Size(60, 24); this.roll.Size = new System.Drawing.Size(60, 24);
this.roll.StepValues = null; this.roll.StepValues = null;
this.roll.TabIndex = 4; this.roll.TabIndex = 4;
this.roll.Tag = "roll";
this.roll.WhenTextChanged += new System.EventHandler(this.roll_WhenTextChanged); this.roll.WhenTextChanged += new System.EventHandler(this.roll_WhenTextChanged);
// //
// labelroll // labelroll
...@@ -214,6 +217,7 @@ ...@@ -214,6 +217,7 @@
this.pitch.Size = new System.Drawing.Size(60, 24); this.pitch.Size = new System.Drawing.Size(60, 24);
this.pitch.StepValues = null; this.pitch.StepValues = null;
this.pitch.TabIndex = 2; this.pitch.TabIndex = 2;
this.pitch.Tag = "pitch";
this.pitch.WhenTextChanged += new System.EventHandler(this.pitch_WhenTextChanged); this.pitch.WhenTextChanged += new System.EventHandler(this.pitch_WhenTextChanged);
// //
// labelpitch // labelpitch
...@@ -355,6 +359,7 @@ ...@@ -355,6 +359,7 @@
this.rollControl.Name = "rollControl"; this.rollControl.Name = "rollControl";
this.rollControl.Size = new System.Drawing.Size(64, 64); this.rollControl.Size = new System.Drawing.Size(64, 64);
this.rollControl.TabIndex = 20; this.rollControl.TabIndex = 20;
this.rollControl.Tag = "roll";
this.rollControl.AngleChanged += new System.EventHandler(this.rollControl_AngleChanged); this.rollControl.AngleChanged += new System.EventHandler(this.rollControl_AngleChanged);
// //
// grouppitch // grouppitch
...@@ -376,6 +381,7 @@ ...@@ -376,6 +381,7 @@
this.pitchControl.Name = "pitchControl"; this.pitchControl.Name = "pitchControl";
this.pitchControl.Size = new System.Drawing.Size(64, 64); this.pitchControl.Size = new System.Drawing.Size(64, 64);
this.pitchControl.TabIndex = 20; this.pitchControl.TabIndex = 20;
this.pitchControl.Tag = "pitch";
this.pitchControl.AngleChanged += new System.EventHandler(this.pitchControl_AngleChanged); this.pitchControl.AngleChanged += new System.EventHandler(this.pitchControl_AngleChanged);
// //
// groupangle // groupangle
...@@ -435,7 +441,7 @@ ...@@ -435,7 +441,7 @@
// //
// posX // posX
// //
this.posX.AllowDecimal = true; this.posX.AllowDecimal = false; // SRB2 doesn't support decimal positions (yet?)
this.posX.AllowExpressions = true; this.posX.AllowExpressions = true;
this.posX.AllowNegative = true; this.posX.AllowNegative = true;
this.posX.AllowRelative = true; this.posX.AllowRelative = true;
...@@ -454,7 +460,7 @@ ...@@ -454,7 +460,7 @@
// //
// posY // posY
// //
this.posY.AllowDecimal = true; this.posY.AllowDecimal = false; // SRB2 doesn't support decimal positions (yet?)
this.posY.AllowExpressions = true; this.posY.AllowExpressions = true;
this.posY.AllowNegative = true; this.posY.AllowNegative = true;
this.posY.AllowRelative = true; this.posY.AllowRelative = true;
...@@ -530,6 +536,7 @@ ...@@ -530,6 +536,7 @@
this.labelScale.Name = "labelScale"; this.labelScale.Name = "labelScale";
this.labelScale.Size = new System.Drawing.Size(80, 14); this.labelScale.Size = new System.Drawing.Size(80, 14);
this.labelScale.TabIndex = 32; this.labelScale.TabIndex = 32;
this.labelScale.Tag = "scalex";
this.labelScale.Text = "Scale:"; this.labelScale.Text = "Scale:";
this.labelScale.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.labelScale.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
...@@ -551,6 +558,7 @@ ...@@ -551,6 +558,7 @@
this.scale.Size = new System.Drawing.Size(72, 24); this.scale.Size = new System.Drawing.Size(72, 24);
this.scale.StepValues = null; this.scale.StepValues = null;
this.scale.TabIndex = 0; this.scale.TabIndex = 0;
this.scale.Tag = "scalex";
this.scale.WhenTextChanged += new System.EventHandler(this.scale_WhenTextChanged); this.scale.WhenTextChanged += new System.EventHandler(this.scale_WhenTextChanged);
// //
// actiongroup // actiongroup
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Controls; using CodeImp.DoomBuilder.Controls;
...@@ -93,6 +94,8 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -93,6 +94,8 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
DoUDMFControls(this);
//mxd. Load settings //mxd. Load settings
useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false); useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false);
...@@ -361,6 +364,37 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -361,6 +364,37 @@ namespace CodeImp.DoomBuilder.Windows
flagsrename = newflagsrename; flagsrename = newflagsrename;
} }
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
//EnableDisableControlAndChildren(control, General.Map.Config.HasUniversalFieldOrFlag<Thing>(name));
EnableDisableControlAndChildren(control, General.Map.Config.ThingFields.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion #endregion
#region ================== Events #region ================== Events
......
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
this.cbrandomroll.Name = "cbrandomroll"; this.cbrandomroll.Name = "cbrandomroll";
this.cbrandomroll.Size = new System.Drawing.Size(66, 17); this.cbrandomroll.Size = new System.Drawing.Size(66, 17);
this.cbrandomroll.TabIndex = 5; this.cbrandomroll.TabIndex = 5;
this.cbrandomroll.Tag = "roll";
this.cbrandomroll.Text = "Random"; this.cbrandomroll.Text = "Random";
this.cbrandomroll.UseVisualStyleBackColor = true; this.cbrandomroll.UseVisualStyleBackColor = true;
this.cbrandomroll.CheckedChanged += new System.EventHandler(this.cbrandomroll_CheckedChanged); this.cbrandomroll.CheckedChanged += new System.EventHandler(this.cbrandomroll_CheckedChanged);
...@@ -176,6 +177,7 @@ ...@@ -176,6 +177,7 @@
this.cbrandompitch.Name = "cbrandompitch"; this.cbrandompitch.Name = "cbrandompitch";
this.cbrandompitch.Size = new System.Drawing.Size(66, 17); this.cbrandompitch.Size = new System.Drawing.Size(66, 17);
this.cbrandompitch.TabIndex = 3; this.cbrandompitch.TabIndex = 3;
this.cbrandompitch.Tag = "pitch";
this.cbrandompitch.Text = "Random"; this.cbrandompitch.Text = "Random";
this.cbrandompitch.UseVisualStyleBackColor = true; this.cbrandompitch.UseVisualStyleBackColor = true;
this.cbrandompitch.CheckedChanged += new System.EventHandler(this.cbrandompitch_CheckedChanged); this.cbrandompitch.CheckedChanged += new System.EventHandler(this.cbrandompitch_CheckedChanged);
...@@ -208,6 +210,7 @@ ...@@ -208,6 +210,7 @@
this.roll.Size = new System.Drawing.Size(60, 24); this.roll.Size = new System.Drawing.Size(60, 24);
this.roll.StepValues = null; this.roll.StepValues = null;
this.roll.TabIndex = 4; this.roll.TabIndex = 4;
this.roll.Tag = "roll";
this.roll.WhenTextChanged += new System.EventHandler(this.roll_WhenTextChanged); this.roll.WhenTextChanged += new System.EventHandler(this.roll_WhenTextChanged);
// //
// labelroll // labelroll
...@@ -236,6 +239,7 @@ ...@@ -236,6 +239,7 @@
this.pitch.Size = new System.Drawing.Size(60, 24); this.pitch.Size = new System.Drawing.Size(60, 24);
this.pitch.StepValues = null; this.pitch.StepValues = null;
this.pitch.TabIndex = 2; this.pitch.TabIndex = 2;
this.pitch.Tag = "pitch";
this.pitch.WhenTextChanged += new System.EventHandler(this.pitch_WhenTextChanged); this.pitch.WhenTextChanged += new System.EventHandler(this.pitch_WhenTextChanged);
// //
// labelpitch // labelpitch
...@@ -295,6 +299,7 @@ ...@@ -295,6 +299,7 @@
this.labelGravity.Name = "labelGravity"; this.labelGravity.Name = "labelGravity";
this.labelGravity.Size = new System.Drawing.Size(43, 13); this.labelGravity.Size = new System.Drawing.Size(43, 13);
this.labelGravity.TabIndex = 18; this.labelGravity.TabIndex = 18;
this.labelGravity.Tag = "gravity";
this.labelGravity.Text = "Gravity:"; this.labelGravity.Text = "Gravity:";
this.tooltip.SetToolTip(this.labelGravity, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" + this.tooltip.SetToolTip(this.labelGravity, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" +
"ed as their absolute.\r\nDefault is 1.0."); "ed as their absolute.\r\nDefault is 1.0.");
...@@ -399,6 +404,7 @@ ...@@ -399,6 +404,7 @@
this.rollControl.Name = "rollControl"; this.rollControl.Name = "rollControl";
this.rollControl.Size = new System.Drawing.Size(64, 64); this.rollControl.Size = new System.Drawing.Size(64, 64);
this.rollControl.TabIndex = 20; this.rollControl.TabIndex = 20;
this.rollControl.Tag = "roll";
this.rollControl.AngleChanged += new System.EventHandler(this.rollControl_AngleChanged); this.rollControl.AngleChanged += new System.EventHandler(this.rollControl_AngleChanged);
// //
// grouppitch // grouppitch
...@@ -420,6 +426,7 @@ ...@@ -420,6 +426,7 @@
this.pitchControl.Name = "pitchControl"; this.pitchControl.Name = "pitchControl";
this.pitchControl.Size = new System.Drawing.Size(64, 64); this.pitchControl.Size = new System.Drawing.Size(64, 64);
this.pitchControl.TabIndex = 20; this.pitchControl.TabIndex = 20;
this.pitchControl.Tag = "pitch";
this.pitchControl.AngleChanged += new System.EventHandler(this.pitchControl_AngleChanged); this.pitchControl.AngleChanged += new System.EventHandler(this.pitchControl_AngleChanged);
// //
// groupangle // groupangle
...@@ -594,6 +601,7 @@ ...@@ -594,6 +601,7 @@
this.floatbobphase.Size = new System.Drawing.Size(72, 24); this.floatbobphase.Size = new System.Drawing.Size(72, 24);
this.floatbobphase.StepValues = null; this.floatbobphase.StepValues = null;
this.floatbobphase.TabIndex = 4; this.floatbobphase.TabIndex = 4;
this.floatbobphase.Tag = "floatbobphase";
// //
// label1 // label1
// //
...@@ -602,6 +610,7 @@ ...@@ -602,6 +610,7 @@
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(86, 13); this.label1.Size = new System.Drawing.Size(86, 13);
this.label1.TabIndex = 27; this.label1.TabIndex = 27;
this.label1.Tag = "floatbobphase";
this.label1.Text = "Float bob phase:"; this.label1.Text = "Float bob phase:";
// //
// conversationID // conversationID
...@@ -621,6 +630,7 @@ ...@@ -621,6 +630,7 @@
this.conversationID.Size = new System.Drawing.Size(72, 24); this.conversationID.Size = new System.Drawing.Size(72, 24);
this.conversationID.StepValues = null; this.conversationID.StepValues = null;
this.conversationID.TabIndex = 3; this.conversationID.TabIndex = 3;
this.conversationID.Tag = "conversation";
// //
// labelID // labelID
// //
...@@ -629,6 +639,7 @@ ...@@ -629,6 +639,7 @@
this.labelID.Name = "labelID"; this.labelID.Name = "labelID";
this.labelID.Size = new System.Drawing.Size(86, 13); this.labelID.Size = new System.Drawing.Size(86, 13);
this.labelID.TabIndex = 25; this.labelID.TabIndex = 25;
this.labelID.Tag = "conversation";
this.labelID.Text = "Conversation ID:"; this.labelID.Text = "Conversation ID:";
// //
// health // health
...@@ -648,6 +659,7 @@ ...@@ -648,6 +659,7 @@
this.health.Size = new System.Drawing.Size(72, 24); this.health.Size = new System.Drawing.Size(72, 24);
this.health.StepValues = null; this.health.StepValues = null;
this.health.TabIndex = 2; this.health.TabIndex = 2;
this.health.Tag = "health";
// //
// label10 // label10
// //
...@@ -658,6 +670,7 @@ ...@@ -658,6 +670,7 @@
this.label10.Name = "label10"; this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(41, 13); this.label10.Size = new System.Drawing.Size(41, 13);
this.label10.TabIndex = 22; this.label10.TabIndex = 22;
this.label10.Tag = "health";
this.label10.Text = "Health:"; this.label10.Text = "Health:";
this.tooltip.SetToolTip(this.label10, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" + this.tooltip.SetToolTip(this.label10, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" +
"ed as their absolute.\r\nDefault is 1."); "ed as their absolute.\r\nDefault is 1.");
...@@ -679,6 +692,7 @@ ...@@ -679,6 +692,7 @@
this.score.Size = new System.Drawing.Size(72, 24); this.score.Size = new System.Drawing.Size(72, 24);
this.score.StepValues = null; this.score.StepValues = null;
this.score.TabIndex = 1; this.score.TabIndex = 1;
this.score.Tag = "score";
// //
// label9 // label9
// //
...@@ -687,6 +701,7 @@ ...@@ -687,6 +701,7 @@
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(38, 13); this.label9.Size = new System.Drawing.Size(38, 13);
this.label9.TabIndex = 20; this.label9.TabIndex = 20;
this.label9.Tag = "score";
this.label9.Text = "Score:"; this.label9.Text = "Score:";
// //
// gravity // gravity
...@@ -706,6 +721,7 @@ ...@@ -706,6 +721,7 @@
this.gravity.Size = new System.Drawing.Size(72, 24); this.gravity.Size = new System.Drawing.Size(72, 24);
this.gravity.StepValues = null; this.gravity.StepValues = null;
this.gravity.TabIndex = 0; this.gravity.TabIndex = 0;
this.gravity.Tag = "gravity";
// //
// grouprendering // grouprendering
// //
...@@ -731,6 +747,7 @@ ...@@ -731,6 +747,7 @@
this.resetalpha.Name = "resetalpha"; this.resetalpha.Name = "resetalpha";
this.resetalpha.Size = new System.Drawing.Size(23, 23); this.resetalpha.Size = new System.Drawing.Size(23, 23);
this.resetalpha.TabIndex = 69; this.resetalpha.TabIndex = 69;
this.resetalpha.Tag = "alpha";
this.tooltip.SetToolTip(this.resetalpha, "Reset"); this.tooltip.SetToolTip(this.resetalpha, "Reset");
this.resetalpha.UseVisualStyleBackColor = true; this.resetalpha.UseVisualStyleBackColor = true;
this.resetalpha.Click += new System.EventHandler(this.resetalpha_Click); this.resetalpha.Click += new System.EventHandler(this.resetalpha_Click);
...@@ -741,6 +758,7 @@ ...@@ -741,6 +758,7 @@
this.labelScale.Name = "labelScale"; this.labelScale.Name = "labelScale";
this.labelScale.Size = new System.Drawing.Size(80, 14); this.labelScale.Size = new System.Drawing.Size(80, 14);
this.labelScale.TabIndex = 32; this.labelScale.TabIndex = 32;
this.labelScale.Tag = "scalex";
this.labelScale.Text = "Scale:"; this.labelScale.Text = "Scale:";
this.labelScale.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.labelScale.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
...@@ -757,6 +775,7 @@ ...@@ -757,6 +775,7 @@
this.scale.Name = "scale"; this.scale.Name = "scale";
this.scale.Size = new System.Drawing.Size(186, 26); this.scale.Size = new System.Drawing.Size(186, 26);
this.scale.TabIndex = 0; this.scale.TabIndex = 0;
this.scale.Tag = "scalex";
this.scale.OnValuesChanged += new System.EventHandler(this.scale_OnValuesChanged); this.scale.OnValuesChanged += new System.EventHandler(this.scale_OnValuesChanged);
// //
// color // color
...@@ -768,6 +787,7 @@ ...@@ -768,6 +787,7 @@
this.color.Name = "color"; this.color.Name = "color";
this.color.Size = new System.Drawing.Size(207, 31); this.color.Size = new System.Drawing.Size(207, 31);
this.color.TabIndex = 3; this.color.TabIndex = 3;
this.color.Tag = "fillcolor";
// //
// alpha // alpha
// //
...@@ -786,6 +806,7 @@ ...@@ -786,6 +806,7 @@
this.alpha.Size = new System.Drawing.Size(72, 24); this.alpha.Size = new System.Drawing.Size(72, 24);
this.alpha.StepValues = null; this.alpha.StepValues = null;
this.alpha.TabIndex = 2; this.alpha.TabIndex = 2;
this.alpha.Tag = "alpha";
this.alpha.WhenTextChanged += new System.EventHandler(this.alpha_WhenTextChanged); this.alpha.WhenTextChanged += new System.EventHandler(this.alpha_WhenTextChanged);
// //
// label8 // label8
...@@ -795,6 +816,7 @@ ...@@ -795,6 +816,7 @@
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(37, 13); this.label8.Size = new System.Drawing.Size(37, 13);
this.label8.TabIndex = 25; this.label8.TabIndex = 25;
this.label8.Tag = "alpha";
this.label8.Text = "Alpha:"; this.label8.Text = "Alpha:";
// //
// renderStyle // renderStyle
...@@ -805,6 +827,7 @@ ...@@ -805,6 +827,7 @@
this.renderStyle.Name = "renderStyle"; this.renderStyle.Name = "renderStyle";
this.renderStyle.Size = new System.Drawing.Size(156, 21); this.renderStyle.Size = new System.Drawing.Size(156, 21);
this.renderStyle.TabIndex = 1; this.renderStyle.TabIndex = 1;
this.renderStyle.Tag = "renderstyle";
this.renderStyle.SelectedIndexChanged += new System.EventHandler(this.renderStyle_SelectedIndexChanged); this.renderStyle.SelectedIndexChanged += new System.EventHandler(this.renderStyle_SelectedIndexChanged);
// //
// labelrenderstyle // labelrenderstyle
...@@ -814,6 +837,7 @@ ...@@ -814,6 +837,7 @@
this.labelrenderstyle.Name = "labelrenderstyle"; this.labelrenderstyle.Name = "labelrenderstyle";
this.labelrenderstyle.Size = new System.Drawing.Size(69, 13); this.labelrenderstyle.Size = new System.Drawing.Size(69, 13);
this.labelrenderstyle.TabIndex = 23; this.labelrenderstyle.TabIndex = 23;
this.labelrenderstyle.Tag = "renderstyle";
this.labelrenderstyle.Text = "Render style:"; this.labelrenderstyle.Text = "Render style:";
// //
// actiongroup // actiongroup
......
...@@ -97,6 +97,8 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -97,6 +97,8 @@ namespace CodeImp.DoomBuilder.Windows
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
DoUDMFControls(this);
//mxd. Load settings //mxd. Load settings
useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false); useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false);
...@@ -417,6 +419,37 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -417,6 +419,37 @@ namespace CodeImp.DoomBuilder.Windows
flagsrename = newflagsrename; flagsrename = newflagsrename;
} }
/// <summary>
/// Enables or disables controls depending on if their tag is one of the UDMF fields set in the game config.
/// </summary>
/// <param name="control">Control to process</param>
private void DoUDMFControls(Control control)
{
if (control.Tag is string name && !string.IsNullOrWhiteSpace(name))
{
//EnableDisableControlAndChildren(control, General.Map.Config.HasUniversalFieldOrFlag<Thing>(name));
EnableDisableControlAndChildren(control, General.Map.Config.ThingFields.Any(f => f.Name == name));
}
else
{
foreach (Control c in control.Controls)
DoUDMFControls(c);
}
}
/// <summary>
/// Enables or disables a control and all its children.
/// </summary>
/// <param name="control">Control the enable or disable</param>
/// <param name="state">If to enable or disable</param>
private void EnableDisableControlAndChildren(Control control, bool state)
{
control.Enabled = state;
foreach (Control c in control.Controls)
EnableDisableControlAndChildren(c, state);
}
#endregion #endregion
#region ================== Events #region ================== Events
......
...@@ -94,6 +94,9 @@ namespace CodeImp.DoomBuilder.Windows ...@@ -94,6 +94,9 @@ namespace CodeImp.DoomBuilder.Windows
tabs.TabPages.Remove(tabcustom); tabs.TabPages.Remove(tabcustom);
panelHeightControls.Visible = false; panelHeightControls.Visible = false;
} }
if (!General.Map.Config.VertexHeightSupport)
panelHeightControls.Enabled = false;
// Decimals allowed? // Decimals allowed?
if(General.Map.FormatInterface.VertexDecimals > 0) if(General.Map.FormatInterface.VertexDecimals > 0)
......
...@@ -35,7 +35,7 @@ void SetError(const char* fmt, ...) ...@@ -35,7 +35,7 @@ void SetError(const char* fmt, ...)
va_list va; va_list va;
va_start(va, fmt); va_start(va, fmt);
mSetErrorBuffer[0] = 0; mSetErrorBuffer[0] = 0;
#ifdef WIN32 #ifdef _WIN32
_vsnprintf(mSetErrorBuffer, sizeof(mSetErrorBuffer) - 1, fmt, va); _vsnprintf(mSetErrorBuffer, sizeof(mSetErrorBuffer) - 1, fmt, va);
#else #else
vsnprintf(mSetErrorBuffer, sizeof(mSetErrorBuffer) - 1, fmt, va); vsnprintf(mSetErrorBuffer, sizeof(mSetErrorBuffer) - 1, fmt, va);
......
...@@ -26,6 +26,22 @@ ...@@ -26,6 +26,22 @@
#include <cmath> #include <cmath>
#include "fasttrig.h" #include "fasttrig.h"
#if defined (__GNUC__) && !defined (__i386__) && !defined (__x86_64__)
#define NO_SSE
#endif
#if defined (_MSC_VER) && defined (_M_IX86_FP) && (_M_IX86_FP <= 1)
#define NO_SSE
#endif
#if defined (_MSC_VER) && defined (_M_ARM)
#define NO_SSE
#endif
#if defined (_MSC_VER) && defined (_M_ARM64)
#define NO_SSE
#endif
#ifndef NO_SSE #ifndef NO_SSE
#include <xmmintrin.h> #include <xmmintrin.h>
#endif #endif
......
...@@ -566,11 +566,11 @@ void GLRenderDevice::GarbageCollectBuffer(int size, VertexFormat format) ...@@ -566,11 +566,11 @@ void GLRenderDevice::GarbageCollectBuffer(int size, VertexFormat format)
GLuint handle = old->GetVAO(); GLuint handle = old->GetVAO();
glDeleteVertexArrays(1, &handle); glDeleteVertexArrays(1, &handle);
if (handle == oldvao) oldvao = sharedbuf->GetVAO(); if ((size_t)handle == (size_t)oldvao) oldvao = sharedbuf->GetVAO();
handle = old->GetBuffer(); handle = old->GetBuffer();
glDeleteBuffers(1, &handle); glDeleteBuffers(1, &handle);
if (handle == oldarray) oldarray = sharedbuf->GetBuffer(); if ((size_t)handle == (size_t)oldarray) oldarray = sharedbuf->GetBuffer();
glBindBuffer(GL_ARRAY_BUFFER, oldarray); glBindBuffer(GL_ARRAY_BUFFER, oldarray);
glBindVertexArray(oldvao); glBindVertexArray(oldvao);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "../Backend.h" #include "../Backend.h"
#include "OpenGLContext.h" #include "OpenGLContext.h"
#include <list> #include <list>
#include <mutex>
class GLSharedVertexBuffer; class GLSharedVertexBuffer;
class GLShader; class GLShader;
......
...@@ -63,7 +63,6 @@ private: ...@@ -63,7 +63,6 @@ private:
int mHeight = 0; int mHeight = 0;
PixelFormat mFormat = {}; PixelFormat mFormat = {};
bool mCubeTexture = false; bool mCubeTexture = false;
bool mPBOTexture = false;
GLuint mTexture = 0; GLuint mTexture = 0;
GLuint mFramebuffer = 0; GLuint mFramebuffer = 0;
GLuint mDepthRenderbuffer = 0; GLuint mDepthRenderbuffer = 0;
......
...@@ -30,9 +30,9 @@ public: ...@@ -30,9 +30,9 @@ public:
OpenGLLoadFunctions() { ogl_LoadFunctions(); } OpenGLLoadFunctions() { ogl_LoadFunctions(); }
}; };
#ifdef WIN32 #ifdef _WIN32
#include <CommCtrl.h> #include <commctrl.h>
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
...@@ -178,14 +178,14 @@ void OpenGLContext::SwapBuffers() ...@@ -178,14 +178,14 @@ void OpenGLContext::SwapBuffers()
int OpenGLContext::GetWidth() const int OpenGLContext::GetWidth() const
{ {
RECT box = { 0 }; RECT box = { 0, 0, 0, 0 };
GetClientRect(window, &box); GetClientRect(window, &box);
return box.right - box.left; return box.right - box.left;
} }
int OpenGLContext::GetHeight() const int OpenGLContext::GetHeight() const
{ {
RECT box = { 0 }; RECT box = { 0, 0, 0, 0 };
GetClientRect(window, &box); GetClientRect(window, &box);
return box.bottom - box.top; return box.bottom - box.top;
} }
...@@ -217,15 +217,15 @@ OpenGLContext::CreateFunctions OpenGLContext::GetCreateFunctions(HWND window) ...@@ -217,15 +217,15 @@ OpenGLContext::CreateFunctions OpenGLContext::GetCreateFunctions(HWND window)
{ {
wglMakeCurrent(queryDC, queryContext); wglMakeCurrent(queryDC, queryContext);
functions.wglCreateContextAttribsARB = (ptr_wglCreateContextAttribsARB)wglGetProcAddress("wglCreateContextAttribsARB"); functions.wglCreateContextAttribsARB = (ptr_wglCreateContextAttribsARB)(void*)wglGetProcAddress("wglCreateContextAttribsARB");
functions.wglGetPixelFormatAttribivEXT = (ptr_wglGetPixelFormatAttribivEXT)wglGetProcAddress("wglGetPixelFormatAttribivEXT"); functions.wglGetPixelFormatAttribivEXT = (ptr_wglGetPixelFormatAttribivEXT)(void*)wglGetProcAddress("wglGetPixelFormatAttribivEXT");
functions.wglGetPixelFormatAttribfvEXT = (ptr_wglGetPixelFormatAttribfvEXT)wglGetProcAddress("wglGetPixelFormatAttribfvEXT"); functions.wglGetPixelFormatAttribfvEXT = (ptr_wglGetPixelFormatAttribfvEXT)(void*)wglGetProcAddress("wglGetPixelFormatAttribfvEXT");
functions.wglChoosePixelFormatEXT = (ptr_wglChoosePixelFormatEXT)wglGetProcAddress("wglChoosePixelFormatEXT"); functions.wglChoosePixelFormatEXT = (ptr_wglChoosePixelFormatEXT)(void*)wglGetProcAddress("wglChoosePixelFormatEXT");
HMODULE opengl32 = LoadLibrary("opengl32.dll"); HMODULE opengl32 = LoadLibrary("opengl32.dll");
if (opengl32) if (opengl32)
{ {
functions.error = reinterpret_cast<ptr_glError>(GetProcAddress(opengl32, "glGetError")); functions.error = reinterpret_cast<ptr_glError>((void*)GetProcAddress(opengl32, "glGetError"));
FreeLibrary(opengl32); FreeLibrary(opengl32);
} }
...@@ -513,9 +513,6 @@ private: ...@@ -513,9 +513,6 @@ private:
bool is_glx_extension_supported(const char* ext_name); bool is_glx_extension_supported(const char* ext_name);
int major_version = 3;
int minor_version = 2;
void* opengl_lib_handle = nullptr; void* opengl_lib_handle = nullptr;
}; };
...@@ -934,7 +931,7 @@ std::unique_ptr<IOpenGLContext> IOpenGLContext::Create(void* disp, void* window) ...@@ -934,7 +931,7 @@ std::unique_ptr<IOpenGLContext> IOpenGLContext::Create(void* disp, void* window)
return ctx; return ctx;
} }
void* GL_GetProcAddress(const char* function_name) extern "C" void* GL_GetProcAddress(const char* function_name)
{ {
if (glx_global.glXGetProcAddressARB) if (glx_global.glXGetProcAddressARB)
return (void*)glx_global.glXGetProcAddressARB((GLubyte*)function_name); return (void*)glx_global.glXGetProcAddressARB((GLubyte*)function_name);
......
...@@ -18,6 +18,7 @@ static void* AppleGLGetProcAddress (const char *name) ...@@ -18,6 +18,7 @@ static void* AppleGLGetProcAddress (const char *name)
#endif /* __APPLE__ */ #endif /* __APPLE__ */
/* BEGINNING OF MANUAL CHANGES, DO NOT REMOVE! */ /* BEGINNING OF MANUAL CHANGES, DO NOT REMOVE! */
#if 0 // Unused function
#if defined(__sgi) || defined (__sun) || defined(__unix__) #if defined(__sgi) || defined (__sun) || defined(__unix__)
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
...@@ -39,6 +40,7 @@ static void* PosixGetProcAddress (const GLubyte* name) ...@@ -39,6 +40,7 @@ static void* PosixGetProcAddress (const GLubyte* name)
return dlsym(h, (const char*)name); return dlsym(h, (const char*)name);
} }
#endif /* __sgi || __sun || __unix__ */ #endif /* __sgi || __sun || __unix__ */
#endif
#if defined(_WIN32) #if defined(_WIN32)
...@@ -67,7 +69,7 @@ static int TestPointer(const PROC pTest) ...@@ -67,7 +69,7 @@ static int TestPointer(const PROC pTest)
return 1; return 1;
} }
static PROC WinGetProcAddress(const char *name) static void *WinGetProcAddress(const char *name)
{ {
HMODULE glMod = NULL; HMODULE glMod = NULL;
PROC pFunc = wglGetProcAddress((LPCSTR)name); PROC pFunc = wglGetProcAddress((LPCSTR)name);
...@@ -85,7 +87,6 @@ static PROC WinGetProcAddress(const char *name) ...@@ -85,7 +87,6 @@ static PROC WinGetProcAddress(const char *name)
#define IntGetProcAddress(name) AppleGLGetProcAddress(name) #define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#else #else
#if defined(__sgi) || defined(__sun) || defined(__unix__) #if defined(__sgi) || defined(__sun) || defined(__unix__)
void* GL_GetProcAddress(const char* proc);
#define IntGetProcAddress(name) GL_GetProcAddress((const char*)name) #define IntGetProcAddress(name) GL_GetProcAddress((const char*)name)
//#define IntGetProcAddress(name) PosixGetProcAddress((const GLubyte*)name) //#define IntGetProcAddress(name) PosixGetProcAddress((const GLubyte*)name)
/* END OF MANUAL CHANGES, DO NOT REMOVE! */ /* END OF MANUAL CHANGES, DO NOT REMOVE! */
......
...@@ -4216,6 +4216,8 @@ int ogl_GetMinorVersion(void); ...@@ -4216,6 +4216,8 @@ int ogl_GetMinorVersion(void);
int ogl_GetMajorVersion(void); int ogl_GetMajorVersion(void);
int ogl_IsVersionGEQ(int majorVersion, int minorVersion); int ogl_IsVersionGEQ(int majorVersion, int minorVersion);
void* GL_GetProcAddress(const char* proc);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus*/ #endif /*__cplusplus*/
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#include <memory> #include <memory>
#include <string> #include <string>
#ifdef WIN32 #ifdef _WIN32
#include <Windows.h> #include <windows.h>
#undef min #undef min
#undef max #undef max
#endif #endif
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "Precomp.h" #include "Precomp.h"
#include "RawMouse.h" #include "RawMouse.h"
#ifdef WIN32 #ifdef _WIN32
#ifndef HID_USAGE_PAGE_GENERIC #ifndef HID_USAGE_PAGE_GENERIC
#define HID_USAGE_PAGE_GENERIC ((USHORT) 0x01) #define HID_USAGE_PAGE_GENERIC ((USHORT) 0x01)
...@@ -105,7 +105,7 @@ LRESULT RawMouse::OnMessage(INT message, WPARAM wparam, LPARAM lparam) ...@@ -105,7 +105,7 @@ LRESULT RawMouse::OnMessage(INT message, WPARAM wparam, LPARAM lparam)
{ {
std::vector<uint32_t> buf((size + 3) / 4); std::vector<uint32_t> buf((size + 3) / 4);
result = GetRawInputData(rawinputHandle, RID_INPUT, buf.data(), &size, sizeof(RAWINPUTHEADER)); result = GetRawInputData(rawinputHandle, RID_INPUT, buf.data(), &size, sizeof(RAWINPUTHEADER));
if (result >= 0) if (result != (UINT)-1)
{ {
RAWINPUT* rawinput = (RAWINPUT*)buf.data(); RAWINPUT* rawinput = (RAWINPUT*)buf.data();
if (rawinput->header.dwType == RIM_TYPEMOUSE) if (rawinput->header.dwType == RIM_TYPEMOUSE)
...@@ -172,7 +172,7 @@ extern "C" ...@@ -172,7 +172,7 @@ extern "C"
RawMouse* RawMouse_New(void* hwnd) RawMouse* RawMouse_New(void* hwnd)
{ {
#ifdef WIN32 #ifdef _WIN32
return new RawMouse(hwnd); return new RawMouse(hwnd);
#else #else
return nullptr; return nullptr;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#pragma once #pragma once
#ifdef WIN32 #ifdef _WIN32
class RawMouse class RawMouse
{ {
......
...@@ -706,8 +706,8 @@ void Context::CalcDoorAltHeight(sector_t *sec) ...@@ -706,8 +706,8 @@ void Context::CalcDoorAltHeight(sector_t *sec)
fixed_t door_h = sec->floorheight; // == sec->ceilingheight fixed_t door_h = sec->floorheight; // == sec->ceilingheight
// compute lowest ceiling and highest floor of neighbor sectors // compute lowest ceiling and highest floor of neighbor sectors
fixed_t low_ceil = 32767 << FRACBITS; fixed_t low_ceil = INT32_MAX;
fixed_t high_floor = -32767 << FRACBITS; fixed_t high_floor = INT32_MIN;
int k, pass; int k, pass;
......
...@@ -39,10 +39,16 @@ ...@@ -39,10 +39,16 @@
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif
#ifdef WIN32 #ifndef FORCEINLINE
#if defined (_MSC_VER)
#define FORCEINLINE __forceinline #define FORCEINLINE __forceinline
//#elif defined (__MINGW32__)
//#define FORCEINLINE inline
#elif defined (__GNUC__)
#define FORCEINLINE inline __attribute__((always_inline))
#else #else
#define FORCEINLINE #define FORCEINLINE inline
#endif
#endif #endif
// This uses a sine table with linear interpolation // This uses a sine table with linear interpolation
......