Made the precision with which the NiGHTS circles are drawn configurable

This commit is contained in:
MascaraSnake 2016-01-12 10:54:23 +01:00
parent 1e107dcd46
commit 4e043b510f
5 changed files with 80 additions and 26 deletions

View file

@ -712,6 +712,7 @@ qualitydisplay = true;
squarethings = true;
testmonsters = false;
doublesidedalpha = 0.5f;
nightscircleprecision = 360;
backgroundalpha = 1f;
defaultviewmode = 2;
classicbilinear = false;

View file

@ -51,7 +51,8 @@ namespace CodeImp.DoomBuilder.Config
private int imagebrightness;
private float doublesidedalpha;
private byte doublesidedalphabyte;
private float backgroundalpha;
private int nightscircleprecision;
private float backgroundalpha;
private bool qualitydisplay;
private bool testmonsters;
private int defaultviewmode;
@ -141,8 +142,9 @@ namespace CodeImp.DoomBuilder.Config
public int VisualFOV { get { return visualfov; } internal set { visualfov = value; } }
public int ImageBrightness { get { return imagebrightness; } internal set { imagebrightness = value; } }
public float DoubleSidedAlpha { get { return doublesidedalpha; } internal set { doublesidedalpha = value; doublesidedalphabyte = (byte)(doublesidedalpha * 255f); } }
public byte DoubleSidedAlphaByte { get { return doublesidedalphabyte; } }
public float BackgroundAlpha { get { return backgroundalpha; } internal set { backgroundalpha = value; } }
public byte DoubleSidedAlphaByte { get { return doublesidedalphabyte; } }
public int NiGHTSCirclePrecision { get { return nightscircleprecision; } internal set { nightscircleprecision = value; } }
public float BackgroundAlpha { get { return backgroundalpha; } internal set { backgroundalpha = value; } }
public float VisualMouseSensX { get { return visualmousesensx; } internal set { visualmousesensx = value; } }
public float VisualMouseSensY { get { return visualmousesensy; } internal set { visualmousesensy = value; } }
public bool QualityDisplay { get { return qualitydisplay; } internal set { qualitydisplay = value; } }
@ -260,7 +262,8 @@ namespace CodeImp.DoomBuilder.Config
imagebrightness = cfg.ReadSetting("imagebrightness", 3);
doublesidedalpha = cfg.ReadSetting("doublesidedalpha", 0.4f);
doublesidedalphabyte = (byte)(doublesidedalpha * 255f);
backgroundalpha = cfg.ReadSetting("backgroundalpha", 1.0f);
nightscircleprecision = cfg.ReadSetting("nightscircleprecision", 360);
backgroundalpha = cfg.ReadSetting("backgroundalpha", 1.0f);
qualitydisplay = cfg.ReadSetting("qualitydisplay", true);
testmonsters = cfg.ReadSetting("testmonsters", true);
defaultviewmode = cfg.ReadSetting("defaultviewmode", (int)ViewMode.Normal);
@ -360,7 +363,8 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("qualitydisplay", qualitydisplay);
cfg.WriteSetting("testmonsters", testmonsters);
cfg.WriteSetting("doublesidedalpha", doublesidedalpha);
cfg.WriteSetting("backgroundalpha", backgroundalpha);
cfg.WriteSetting("nightscircleprecision", nightscircleprecision);
cfg.WriteSetting("backgroundalpha", backgroundalpha);
cfg.WriteSetting("defaultviewmode", defaultviewmode);
cfg.WriteSetting("classicbilinear", classicbilinear);
cfg.WriteSetting("visualbilinear", visualbilinear);

View file

@ -58,10 +58,6 @@ namespace CodeImp.DoomBuilder.Rendering
private const int FONT_HEIGHT = 0;
internal const int NUM_VIEW_MODES = 4;
private const int CIRCLE_PRECISION = 360;
#endregion
#region ================== Variables
@ -1957,6 +1953,7 @@ namespace CodeImp.DoomBuilder.Rendering
// This renders a circle with given color
public void RenderCircle(Vector2D center, float radius, float thickness, PixelColor c, bool transformcoords)
{
int CIRCLE_PRECISION = General.Settings.NiGHTSCirclePrecision;
Vector2D[] points = new Vector2D[CIRCLE_PRECISION];
for (int i = 0; i < CIRCLE_PRECISION; i++)
{

View file

@ -67,6 +67,7 @@ namespace CodeImp.DoomBuilder.Windows
this.defaultviewmode = new System.Windows.Forms.ComboBox();
this.keyusedlabel = new System.Windows.Forms.Label();
this.colorsgroup1 = new System.Windows.Forms.GroupBox();
this.colorNiGHTS = new CodeImp.DoomBuilder.Controls.ColorControl();
this.color3dFloors = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorInfo = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorMD3 = new CodeImp.DoomBuilder.Controls.ColorControl();
@ -179,7 +180,9 @@ namespace CodeImp.DoomBuilder.Windows
this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.browseScreenshotsFolderDialog = new System.Windows.Forms.FolderBrowserDialog();
this.colorNiGHTS = new CodeImp.DoomBuilder.Controls.ColorControl();
this.nightscircleprecision = new System.Windows.Forms.TrackBar();
this.label23 = new System.Windows.Forms.Label();
this.nightscircleprecisionlabel = new System.Windows.Forms.Label();
label7 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
@ -218,6 +221,7 @@ namespace CodeImp.DoomBuilder.Windows
((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).BeginInit();
this.colorsgroup3.SuspendLayout();
this.tabpasting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nightscircleprecision)).BeginInit();
this.SuspendLayout();
//
// label7
@ -613,6 +617,9 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorsgroup1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.colorsgroup1.Controls.Add(this.nightscircleprecision);
this.colorsgroup1.Controls.Add(this.label23);
this.colorsgroup1.Controls.Add(this.nightscircleprecisionlabel);
this.colorsgroup1.Controls.Add(this.colorNiGHTS);
this.colorsgroup1.Controls.Add(this.color3dFloors);
this.colorsgroup1.Controls.Add(this.colorInfo);
@ -636,6 +643,17 @@ namespace CodeImp.DoomBuilder.Windows
this.colorsgroup1.Text = " Display ";
this.colorsgroup1.Visible = false;
//
// colorNiGHTS
//
this.colorNiGHTS.BackColor = System.Drawing.Color.Transparent;
this.colorNiGHTS.Label = "NiGHTS path:";
this.colorNiGHTS.Location = new System.Drawing.Point(15, 314);
this.colorNiGHTS.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorNiGHTS.MinimumSize = new System.Drawing.Size(100, 23);
this.colorNiGHTS.Name = "colorNiGHTS";
this.colorNiGHTS.Size = new System.Drawing.Size(168, 23);
this.colorNiGHTS.TabIndex = 25;
//
// color3dFloors
//
this.color3dFloors.BackColor = System.Drawing.Color.Transparent;
@ -1955,16 +1973,38 @@ namespace CodeImp.DoomBuilder.Windows
//
this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into";
//
// colorNiGHTS
// nightscircleprecision
//
this.colorNiGHTS.BackColor = System.Drawing.Color.Transparent;
this.colorNiGHTS.Label = "NiGHTS path:";
this.colorNiGHTS.Location = new System.Drawing.Point(15, 314);
this.colorNiGHTS.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorNiGHTS.MinimumSize = new System.Drawing.Size(100, 23);
this.colorNiGHTS.Name = "colorNiGHTS";
this.colorNiGHTS.Size = new System.Drawing.Size(168, 23);
this.colorNiGHTS.TabIndex = 25;
this.nightscircleprecision.BackColor = System.Drawing.SystemColors.Window;
this.nightscircleprecision.LargeChange = 1;
this.nightscircleprecision.Location = new System.Drawing.Point(11, 432);
this.nightscircleprecision.Maximum = 36;
this.nightscircleprecision.Minimum = 1;
this.nightscircleprecision.Name = "nightscircleprecision";
this.nightscircleprecision.Size = new System.Drawing.Size(130, 45);
this.nightscircleprecision.TabIndex = 26;
this.nightscircleprecision.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.nightscircleprecision.Value = 36;
this.nightscircleprecision.ValueChanged += new System.EventHandler(this.nightscircleprecision_ValueChanged);
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(14, 411);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(123, 13);
this.label23.TabIndex = 27;
this.label23.Text = "NiGHTS circle precision:";
this.label23.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// nightscircleprecisionlabel
//
this.nightscircleprecisionlabel.AutoSize = true;
this.nightscircleprecisionlabel.Location = new System.Drawing.Point(147, 444);
this.nightscircleprecisionlabel.Name = "nightscircleprecisionlabel";
this.nightscircleprecisionlabel.Size = new System.Drawing.Size(25, 13);
this.nightscircleprecisionlabel.TabIndex = 28;
this.nightscircleprecisionlabel.Text = "360";
//
// PreferencesForm
//
@ -2027,6 +2067,7 @@ namespace CodeImp.DoomBuilder.Windows
this.colorsgroup3.ResumeLayout(false);
this.colorsgroup3.PerformLayout();
this.tabpasting.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nightscircleprecision)).EndInit();
this.ResumeLayout(false);
}
@ -2174,5 +2215,8 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label label27;
private System.Windows.Forms.CheckBox cbDrawFullCrosshair;
private Controls.ColorControl colorNiGHTS;
private System.Windows.Forms.TrackBar nightscircleprecision;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label nightscircleprecisionlabel;
}
}

View file

@ -62,7 +62,8 @@ namespace CodeImp.DoomBuilder.Windows
// Interface
imagebrightness.Value = General.Settings.ImageBrightness;
doublesidedalpha.Value = General.Clamp((int)((1.0f - General.Settings.DoubleSidedAlpha) * 10.0f), doublesidedalpha.Minimum, doublesidedalpha.Maximum);
defaultviewmode.SelectedIndex = General.Settings.DefaultViewMode;
nightscircleprecision.Value = General.Clamp((int)(General.Settings.NiGHTSCirclePrecision)/10, nightscircleprecision.Minimum, nightscircleprecision.Maximum);
defaultviewmode.SelectedIndex = General.Settings.DefaultViewMode;
fieldofview.Value = General.Clamp(General.Settings.VisualFOV / 10, fieldofview.Minimum, fieldofview.Maximum);
mousespeed.Value = General.Clamp(General.Settings.MouseSpeed / 100, mousespeed.Minimum, mousespeed.Maximum);
movespeed.Value = General.Clamp(General.Settings.MoveSpeed / 100, movespeed.Minimum, movespeed.Maximum);
@ -233,7 +234,8 @@ namespace CodeImp.DoomBuilder.Windows
// Apply interface
General.Settings.ImageBrightness = imagebrightness.Value;
General.Settings.DoubleSidedAlpha = 1.0f - (doublesidedalpha.Value * 0.1f);
General.Settings.DefaultViewMode = defaultviewmode.SelectedIndex;
General.Settings.NiGHTSCirclePrecision = nightscircleprecision.Value * 10;
General.Settings.DefaultViewMode = defaultviewmode.SelectedIndex;
General.Settings.VisualFOV = fieldofview.Value * 10;
General.Settings.MouseSpeed = mousespeed.Value * 100;
General.Settings.MoveSpeed = movespeed.Value * 100;
@ -959,8 +961,14 @@ namespace CodeImp.DoomBuilder.Windows
doublesidedalphalabel.Text = percent + "%";
}
//mxd
private void tbDynLightCount_ValueChanged(object sender, EventArgs e)
private void nightscircleprecision_ValueChanged(object sender, EventArgs e)
{
int value = nightscircleprecision.Value * 10;
nightscircleprecisionlabel.Text = value.ToString();
}
//mxd
private void tbDynLightCount_ValueChanged(object sender, EventArgs e)
{
labelDynLightCount.Text = tbDynLightCount.Value.ToString();
}
@ -1028,8 +1036,8 @@ namespace CodeImp.DoomBuilder.Windows
hlpevent.Handled = true;
}
}
/*
/*
// This writes all action help files using a template and some basic info from the actions.
// Also writes actioncontents.txt with all files to be inserted into Contents.hhc.
// Only used during development. Actual button to call this has been removed.
@ -1061,5 +1069,5 @@ namespace CodeImp.DoomBuilder.Windows
File.WriteAllText(filename, contents.ToString());
}
*/
}
}
}