Clean up the project, revert hacky flat alignment, fix About menu and browser handling.

This commit is contained in:
sphere 2021-02-21 14:59:33 +01:00
parent 37993cde49
commit 0c8effe3a3
6 changed files with 38 additions and 86 deletions

View file

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Source\Core\Builder.csproj", "{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}"
EndProject
@ -24,6 +24,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoundPropagation", "Source\Plugins\SoundPropagationMode\SoundPropagation.csproj", "{F59B344C-DD50-4DB7-ADDD-56AAD66450AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StairSectorBuilder", "Source\Plugins\StairSectorBuilder\StairSectorBuilder.csproj", "{3F365121-906B-409D-BB1E-37E0A78056C2}"
ProjectSection(ProjectDependencies) = postProject
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C} = {818B3D10-F791-4C3F-9AF5-BB2D0079B63C}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -125,4 +128,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C3B3213-299D-4D31-93DE-3EC44B99CB83}
EndGlobalSection
EndGlobal

View file

@ -1993,43 +1993,11 @@ namespace CodeImp.DoomBuilder
// This opens a URL in the default browser
public static void OpenWebsite(string url)
{
RegistryKey key = null;
Process p = null;
string browser;
try
{
// Get the registry key where default browser is stored
key = Registry.ClassesRoot.OpenSubKey(@"HTTP\shell\open\command", false);
// Trim off quotes
browser = key.GetValue(null).ToString().ToLower().Replace("\"", "");
// String doesnt end in EXE?
if(!browser.EndsWith("exe"))
{
// Get rid of everything after the ".exe"
browser = browser.Substring(0, browser.LastIndexOf(".exe") + 4);
}
System.Diagnostics.Process.Start(url);
}
finally
{
// Clean up
if(key != null) key.Close();
}
try
{
// Fork a process
p = new Process();
p.StartInfo.FileName = browser;
p.StartInfo.Arguments = url;
p.Start();
}
catch(Exception) { }
// Clean up
if(p != null) p.Dispose();
catch (Exception) { }
}
// This returns the short path name for a file

View file

@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.gzdbLink = new System.Windows.Forms.LinkLabel();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.srb2link = new System.Windows.Forms.LinkLabel();
label1 = new System.Windows.Forms.Label();
pictureBox1 = new System.Windows.Forms.PictureBox();
pictureBox3 = new System.Windows.Forms.PictureBox();
@ -156,23 +157,25 @@ namespace CodeImp.DoomBuilder.Windows
this.tabPage3.Controls.Add(this.copyversion);
this.tabPage3.Controls.Add(this.version);
this.tabPage3.Controls.Add(this.pictureBox5);
this.tabPage3.Controls.Add(this.srb2link);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(383, 201);
this.tabPage3.TabIndex = 2;
this.tabPage3.TabIndex = 17;
this.tabPage3.Text = "About Zone Builder";
this.tabPage3.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.SystemColors.Control;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label2.Location = new System.Drawing.Point(10, 144);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(278, 13);
this.label2.Size = new System.Drawing.Size(210, 26);
this.label2.TabIndex = 16;
this.label2.Text = "Zone Builder was developed by MascaraSnake, toaster, Justburner and sphere.";
this.label2.Text = "Zone Builder is developed by: \r\nMascaraSnake, toaster, Justburner, sphere";
//
// copyversion
//
@ -259,6 +262,19 @@ namespace CodeImp.DoomBuilder.Windows
this.tabPage2.Text = "About Doom Builder";
this.tabPage2.UseVisualStyleBackColor = true;
//
// srb2link
//
this.srb2link.ActiveLinkColor = System.Drawing.Color.Firebrick;
this.srb2link.AutoSize = true;
this.srb2link.LinkColor = System.Drawing.SystemColors.HotTrack;
this.srb2link.Location = new System.Drawing.Point(10, 180);
this.srb2link.Name = "srb2link";
this.srb2link.Size = new System.Drawing.Size(114, 13);
this.srb2link.TabIndex = 2;
this.srb2link.TabStop = true;
this.srb2link.Text = "www.srb2.org";
this.srb2link.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.srb2link_LinkClicked);
//
// AboutForm
//
this.AcceptButton = this.close;
@ -309,5 +325,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label version;
private System.Windows.Forms.Button copyversion;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.LinkLabel srb2link;
}
}

View file

@ -57,6 +57,13 @@ namespace CodeImp.DoomBuilder.Windows
General.OpenWebsite("http://forum.zdoom.org/viewtopic.php?f=3&t=32392");
}
private void srb2link_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
General.OpenWebsite("https://www.srb2.org/");
}
// This copies the version number to clipboard
private void copyversion_Click(object sender, EventArgs e)
{

View file

@ -375,29 +375,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
vertices[i].u = vertices[i].u * sw;
vertices[i].v = -vertices[i].v * sh;
}
foreach (Sidedef side in s.Sidedefs)
{
if (side.Line.IsFlatAlignment && !side.Line.IsFlagSet("2048") && side.Line.Tag == 0 && side.Line.Front.Sector == s)
{
bool useoffsets = side.Line.IsFlagSet("8192");
float xoffset = useoffsets ? side.Line.Front.OffsetX : -side.Line.Start.Position.x;
float yoffset = useoffsets ? -side.Line.Front.OffsetY : -side.Line.Start.Position.y;
float rotation = General.ClampAngle(90f - side.Line.Angle * Angle2D.PIDEG);
// Affine offset, this got me a few headaches of why both rotation and offset didn't worked at same time
float rotationrad = rotation / Angle2D.PIDEG;
float cos = (float)Math.Cos(rotationrad);
float sin = (float)Math.Sin(rotationrad);
float rx = cos * xoffset - sin * yoffset;
float ry = sin * xoffset + cos * yoffset;
xoffset = rx;
yoffset = -ry;
Vector2D offset = new Vector2D(xoffset, yoffset);
SetupSurfaceVertices(vertices, s, img, offset, new Vector2D(1.0f, 1.0f), rotation, -1, 0, false);
}
}
}
}
}
@ -450,29 +427,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
vertices[i].u = vertices[i].u * sw;
vertices[i].v = -vertices[i].v * sh;
}
foreach (Sidedef side in s.Sidedefs)
{
if (side.Line.IsFlatAlignment && !side.Line.IsFlagSet("4096") && side.Line.Tag == 0 && side.Line.Front.Sector == s)
{
bool useoffsets = side.Line.IsFlagSet("8192");
float xoffset = useoffsets ? side.Line.Front.OffsetX : -side.Line.Start.Position.x;
float yoffset = useoffsets ? -side.Line.Front.OffsetY : -side.Line.Start.Position.y;
float rotation = General.ClampAngle(90f - side.Line.Angle * Angle2D.PIDEG);
// Affine offset, this got me a few headaches of why both rotation and offset didn't worked at same time
float rotationrad = rotation / Angle2D.PIDEG;
float cos = (float)Math.Cos(rotationrad);
float sin = (float)Math.Sin(rotationrad);
float rx = cos * xoffset - sin * yoffset;
float ry = sin * xoffset + cos * yoffset;
xoffset = rx;
yoffset = -ry;
Vector2D offset = new Vector2D(xoffset, yoffset);
SetupSurfaceVertices(vertices, s, img, offset, new Vector2D(1.0f, 1.0f), rotation, -1, 0, false);
}
}
}
}
}

View file

@ -151,7 +151,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Determine if we should repeat the middle texture
bool srb2repeat = General.Map.SRB2 && Sidedef.Line.IsFlagSet(General.Map.Config.RepeatMidtextureFlag);
bool doomrepeat = !General.Map.SRB2 && Sidedef.IsFlagSet("wrapmidtex") || Sidedef.Line.IsFlagSet("wrapmidtex");
bool repeatmidtex = srb2repeat || doomrepeat;
repeatmidtex = srb2repeat || doomrepeat;
//A little redundant, but having a separate boolean value for each case makes the code a little more readable
bool srb2repeatfixed = srb2repeat && Sidedef.OffsetX >= 4096;