several small fixes

This commit is contained in:
codeimp 2008-02-15 14:08:26 +00:00
parent ec9157c73b
commit 8fe8a6e7a8
6 changed files with 82 additions and 62 deletions

View file

@ -956,6 +956,25 @@ namespace CodeImp.DoomBuilder
// Update interface
General.MainWindow.UpdateInterface();
// Stop data manager
data.Dispose();
// Apply new options
this.options = optionsform.Options;
// Load new game configuration
General.WriteLogLine("Loading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
General.Plugins.GameConfigurationChanged();
// Setup new map format IO
General.WriteLogLine("Initializing map format interface " + config.FormatInterface + "...");
io = MapSetIO.Create(config.FormatInterface, tempwad, this);
// Create required lumps if they don't exist yet
CreateRequiredLumps(tempwad, TEMP_MAP_HEADER);
// Reload resources
ReloadResources();
}

View file

@ -287,7 +287,7 @@ namespace CodeImp.DoomBuilder.Geometry
// This removes all sidedefs which has a sidedefs on the other side
// of the same line that refers to the same sector. These are removed
// because they are useless and make the triangulation inefficient.
private void RemoveDoubleSidedefReferences(Dictionary<Sidedef, bool> todosides, ICollection<Sidedef> sides)
private static void RemoveDoubleSidedefReferences(Dictionary<Sidedef, bool> todosides, ICollection<Sidedef> sides)
{
// Go for all sides
foreach(Sidedef sd in sides)
@ -306,7 +306,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
// This finds the right-most vertex to start tracing with
private Vertex FindRightMostVertex(Dictionary<Sidedef, bool> sides, Dictionary<Vertex, Vertex> ignores)
private static Vertex FindRightMostVertex(Dictionary<Sidedef, bool> sides, Dictionary<Vertex, Vertex> ignores)
{
Vertex found = null;
@ -408,7 +408,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
// This finds the right-most vertex in an inner polygon to use for cut startpoint.
private LinkedListNode<EarClipVertex> FindRightMostVertex(Polygon p)
private static LinkedListNode<EarClipVertex> FindRightMostVertex(Polygon p)
{
LinkedListNode<EarClipVertex> found = p.First;
LinkedListNode<EarClipVertex> v = found.Next;
@ -425,7 +425,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
// This finds the cut coordinates and splits the other poly with inner vertices
private void SplitOuterWithInner(LinkedListNode<EarClipVertex> start, Polygon p, Polygon inner)
private static void SplitOuterWithInner(LinkedListNode<EarClipVertex> start, Polygon p, Polygon inner)
{
Line2D starttoright = new Line2D(start.Value.Position, start.Value.Position + new Vector2D(1000.0f, 0.0f));
LinkedListNode<EarClipVertex> v1, v2;
@ -642,7 +642,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
// This returns the 3-vertex array triangle for an ear
private EarClipVertex[] GetTriangle(EarClipVertex v)
private static EarClipVertex[] GetTriangle(EarClipVertex v)
{
EarClipVertex[] t = new EarClipVertex[3];
if(v.MainListNode.Previous == null) t[0] = v.MainListNode.List.Last.Value; else t[0] = v.MainListNode.Previous.Value;
@ -652,7 +652,7 @@ namespace CodeImp.DoomBuilder.Geometry
}
// This checks if a vertex is reflex (corner > 180 deg) or convex (corner < 180 deg)
private bool IsReflex(EarClipVertex[] t)
private static bool IsReflex(EarClipVertex[] t)
{
// Return true when corner is > 180 deg
//return (Line2D.GetSideOfLine(t[0].Position, t[2].Position, t[1].Position) < 0.00001f);
@ -661,7 +661,7 @@ namespace CodeImp.DoomBuilder.Geometry
// This checks if a point is inside a triangle
// NOTE: vertices in t must be in clockwise order!
private bool PointInsideTriangle(EarClipVertex[] t, Vector2D p)
private static bool PointInsideTriangle(EarClipVertex[] t, Vector2D p)
{
return (Line2D.GetSideOfLine(t[0].Position, t[1].Position, p) < 0.00001f) &&
(Line2D.GetSideOfLine(t[1].Position, t[2].Position, p) < 0.00001f) &&

View file

@ -106,7 +106,7 @@ namespace CodeImp.DoomBuilder.IO
public static unsafe long MakeLongName(string name)
{
long value = 0;
byte[] namebytes = Encoding.ASCII.GetBytes(name);
byte[] namebytes = Encoding.ASCII.GetBytes(name.Trim().ToUpper());
uint bytes = (uint)namebytes.Length;
if(bytes > 8) bytes = 8;
@ -127,7 +127,7 @@ namespace CodeImp.DoomBuilder.IO
while((length < fixedname.Length) && (fixedname[length] != 0)) length++;
// Make normal name
return encoding.GetString(fixedname, 0, length).Trim();
return encoding.GetString(fixedname, 0, length).Trim().ToUpper();
}
// This makes the fixed name from normal name
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.IO
byte[] fixedname = new byte[8];
// Write the name in bytes
encoding.GetBytes(name.Trim(), 0, name.Length, fixedname, 0);
encoding.GetBytes(name.Trim().ToUpper(), 0, name.Length, fixedname, 0);
// Return result
return fixedname;

View file

@ -65,8 +65,8 @@ namespace CodeImp.DoomBuilder.Interface
this.flags = new CodeImp.DoomBuilder.Interface.CheckboxArrayControl();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.tabs = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabproperties = new System.Windows.Forms.TabPage();
this.tabsidedefs = new System.Windows.Forms.TabPage();
this.backside = new System.Windows.Forms.CheckBox();
this.backgroup = new System.Windows.Forms.GroupBox();
this.backsector = new CodeImp.DoomBuilder.Interface.NumericTextbox();
@ -83,7 +83,7 @@ namespace CodeImp.DoomBuilder.Interface
this.fronthigh = new CodeImp.DoomBuilder.Interface.TextureSelectorControl();
this.frontoffsety = new CodeImp.DoomBuilder.Interface.NumericTextbox();
this.frontoffsetx = new CodeImp.DoomBuilder.Interface.NumericTextbox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabcustom = new System.Windows.Forms.TabPage();
this.fieldslist = new CodeImp.DoomBuilder.Interface.FieldsEditorControl();
label2 = new System.Windows.Forms.Label();
taglabel = new System.Windows.Forms.Label();
@ -103,11 +103,11 @@ namespace CodeImp.DoomBuilder.Interface
this.doompanel.SuspendLayout();
this.settingsgroup.SuspendLayout();
this.tabs.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabproperties.SuspendLayout();
this.tabsidedefs.SuspendLayout();
this.backgroup.SuspendLayout();
this.frontgroup.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabcustom.SuspendLayout();
this.SuspendLayout();
//
// label2
@ -485,9 +485,9 @@ namespace CodeImp.DoomBuilder.Interface
this.tabs.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.tabs.Controls.Add(this.tabPage1);
this.tabs.Controls.Add(this.tabPage2);
this.tabs.Controls.Add(this.tabPage3);
this.tabs.Controls.Add(this.tabproperties);
this.tabs.Controls.Add(this.tabsidedefs);
this.tabs.Controls.Add(this.tabcustom);
this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabs.Location = new System.Drawing.Point(10, 10);
this.tabs.Margin = new System.Windows.Forms.Padding(1);
@ -497,33 +497,33 @@ namespace CodeImp.DoomBuilder.Interface
this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabs.TabIndex = 20;
//
// tabPage1
// tabproperties
//
this.tabPage1.Controls.Add(this.settingsgroup);
this.tabPage1.Controls.Add(this.actiongroup);
this.tabPage1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabPage1.Location = new System.Drawing.Point(4, 23);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(5);
this.tabPage1.Size = new System.Drawing.Size(533, 381);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Properties";
this.tabPage1.UseVisualStyleBackColor = true;
this.tabproperties.Controls.Add(this.settingsgroup);
this.tabproperties.Controls.Add(this.actiongroup);
this.tabproperties.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabproperties.Location = new System.Drawing.Point(4, 23);
this.tabproperties.Name = "tabproperties";
this.tabproperties.Padding = new System.Windows.Forms.Padding(5);
this.tabproperties.Size = new System.Drawing.Size(533, 381);
this.tabproperties.TabIndex = 0;
this.tabproperties.Text = "Properties";
this.tabproperties.UseVisualStyleBackColor = true;
//
// tabPage2
// tabsidedefs
//
this.tabPage2.Controls.Add(this.backside);
this.tabPage2.Controls.Add(this.backgroup);
this.tabPage2.Controls.Add(this.frontside);
this.tabPage2.Controls.Add(this.frontgroup);
this.tabPage2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabPage2.Location = new System.Drawing.Point(4, 23);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(5);
this.tabPage2.Size = new System.Drawing.Size(533, 381);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Sidedefs";
this.tabPage2.UseVisualStyleBackColor = true;
this.tabsidedefs.Controls.Add(this.backside);
this.tabsidedefs.Controls.Add(this.backgroup);
this.tabsidedefs.Controls.Add(this.frontside);
this.tabsidedefs.Controls.Add(this.frontgroup);
this.tabsidedefs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabsidedefs.Location = new System.Drawing.Point(4, 23);
this.tabsidedefs.Name = "tabsidedefs";
this.tabsidedefs.Padding = new System.Windows.Forms.Padding(5);
this.tabsidedefs.Size = new System.Drawing.Size(533, 381);
this.tabsidedefs.TabIndex = 1;
this.tabsidedefs.Text = "Sidedefs";
this.tabsidedefs.UseVisualStyleBackColor = true;
//
// backside
//
@ -703,16 +703,16 @@ namespace CodeImp.DoomBuilder.Interface
this.frontoffsetx.TabIndex = 8;
this.frontoffsetx.Enter += new System.EventHandler(this.SelectAllText);
//
// tabPage3
// tabcustom
//
this.tabPage3.Controls.Add(this.fieldslist);
this.tabPage3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabPage3.Location = new System.Drawing.Point(4, 23);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(533, 381);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Custom";
this.tabPage3.UseVisualStyleBackColor = true;
this.tabcustom.Controls.Add(this.fieldslist);
this.tabcustom.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabcustom.Location = new System.Drawing.Point(4, 23);
this.tabcustom.Name = "tabcustom";
this.tabcustom.Size = new System.Drawing.Size(533, 381);
this.tabcustom.TabIndex = 2;
this.tabcustom.Text = "Custom";
this.tabcustom.UseVisualStyleBackColor = true;
//
// fieldslist
//
@ -747,14 +747,14 @@ namespace CodeImp.DoomBuilder.Interface
this.doompanel.PerformLayout();
this.settingsgroup.ResumeLayout(false);
this.tabs.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabproperties.ResumeLayout(false);
this.tabsidedefs.ResumeLayout(false);
this.tabsidedefs.PerformLayout();
this.backgroup.ResumeLayout(false);
this.backgroup.PerformLayout();
this.frontgroup.ResumeLayout(false);
this.frontgroup.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabcustom.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -772,8 +772,8 @@ namespace CodeImp.DoomBuilder.Interface
private NumericTextbox tag;
private System.Windows.Forms.Button newtag;
private System.Windows.Forms.TabControl tabs;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabproperties;
private System.Windows.Forms.TabPage tabsidedefs;
private System.Windows.Forms.GroupBox frontgroup;
private System.Windows.Forms.CheckBox frontside;
private NumericTextbox frontoffsety;
@ -803,7 +803,7 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.Label arg4label;
private System.Windows.Forms.Label arg2label;
private System.Windows.Forms.Label arg3label;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabcustom;
private FieldsEditorControl fieldslist;
}
}

View file

@ -64,9 +64,10 @@ namespace CodeImp.DoomBuilder.Interface
backmid.Initialize();
backlow.Initialize();
// Show appropriate panel
// Show appropriate panels/tabs
doompanel.Visible = General.Map.IsType(typeof(DoomMapSetIO));
hexenpanel.Visible = General.Map.IsType(typeof(HexenMapSetIO));
if(!General.Map.IsType(typeof(UniversalMapSetIO))) tabs.TabPages.Remove(tabcustom);
}
// This sets up the form to edit the given lines

View file

@ -267,10 +267,10 @@
<metadata name="tabs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="tabsidedefs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="backside.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">