diff --git a/Build/Builder.cfg b/Build/Builder.cfg
index 7861f0b7..755643b5 100644
--- a/Build/Builder.cfg
+++ b/Build/Builder.cfg
@@ -1,10 +1,10 @@
mainwindow
{
- positionx = 27;
- sizeheight = 572;
- positiony = 15;
+ positionx = 209;
windowstate = 2;
+ positiony = 137;
+ sizeheight = 572;
sizewidth = 739;
}
diff --git a/Source/Builder.csproj b/Source/Builder.csproj
index f8686a77..e599ec3a 100644
--- a/Source/Builder.csproj
+++ b/Source/Builder.csproj
@@ -65,6 +65,12 @@
MapOptionsForm.cs
+
+ Form
+
+
+ OpenMapOptionsForm.cs
+
Form
@@ -74,6 +80,7 @@
+
@@ -123,6 +130,10 @@
Designer
MapOptionsForm.cs
+
+ Designer
+ OpenMapOptionsForm.cs
+
Designer
ResourceOptionsForm.cs
diff --git a/Source/Editing/EditMode.cs b/Source/Editing/EditMode.cs
index 6cf4d069..ff5dddc0 100644
--- a/Source/Editing/EditMode.cs
+++ b/Source/Editing/EditMode.cs
@@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.Editing
{
// Initialize
this.graphics = General.Map.Graphics;
-
+
// We have no destructor
GC.SuppressFinalize(this);
}
diff --git a/Source/General/General.cs b/Source/General/General.cs
index d35afe63..26459c53 100644
--- a/Source/General/General.cs
+++ b/Source/General/General.cs
@@ -99,6 +99,15 @@ namespace CodeImp.DoomBuilder
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
+ // Check if this is a Doom Builder 1 config
+ else if(cfg.ReadSetting("type", "") != "Doom Builder 2 Game Configuration")
+ {
+ // Old configuration
+ MessageBox.Show(mainwindow, "Unable to load the game configuration file \"" + filename + "\".\n" +
+ "This configuration is not a Doom Builder 2 game configuration.",
+ Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return null;
+ }
else
{
// Return config
@@ -132,7 +141,7 @@ namespace CodeImp.DoomBuilder
foreach(string filepath in filenames)
{
// Check if it can be loaded
- cfg = LoadGameConfiguration(filepath);
+ cfg = LoadGameConfiguration(Path.GetFileName(filepath));
if(cfg != null)
{
// Get name and filename
@@ -177,6 +186,7 @@ namespace CodeImp.DoomBuilder
// Create main window
mainwindow = new MainForm();
+ mainwindow.UpdateMenus();
// Show main window
mainwindow.Show();
@@ -224,21 +234,92 @@ namespace CodeImp.DoomBuilder
optionswindow = new MapOptionsForm(newoptions);
if(optionswindow.ShowDialog(mainwindow) == DialogResult.OK)
{
- // Ask to save the map if not saved yet
- if(AskSaveMap())
+ // Display status
+ mainwindow.DisplayStatus("Creating new map...");
+
+ // Clear the display
+ mainwindow.ClearDisplay();
+
+ // Trash the current map, if any
+ if(map != null) map.Dispose();
+
+ // Create map manager with given options
+ map = new MapManager();
+ if(!map.InitializeNewMap(newoptions))
+ {
+ // Unable to create map manager
+ map.Dispose();
+ map = null;
+
+ // Show splash logo on display
+ mainwindow.ShowSplashDisplay();
+
+ // Failed
+ mainwindow.UpdateMenus();
+ mainwindow.DisplayReady();
+ return false;
+ }
+
+ // Done
+ mainwindow.UpdateMenus();
+ mainwindow.DisplayReady();
+ return true;
+ }
+
+ // Cancelled
+ return false;
+ }
+
+ // This closes the current map
+ public static bool CloseMap()
+ {
+ // Display status
+ mainwindow.DisplayStatus("Closing map...");
+
+ // Trash the current map
+ if(map != null) map.Dispose();
+ map = null;
+
+ // Show splash logo on display
+ mainwindow.ShowSplashDisplay();
+
+ // Done
+ mainwindow.UpdateMenus();
+ mainwindow.DisplayReady();
+ return true;
+ }
+
+ // This loads a map from file
+ public static bool OpenMap()
+ {
+ OpenFileDialog openfile;
+ OpenMapOptionsForm openmapwindow;
+
+ // Open map file dialog
+ openfile = new OpenFileDialog();
+ openfile.Filter = "Doom WAD Files (*.wad)|*.wad";
+ openfile.Title = "Open Map";
+ if(openfile.ShowDialog(mainwindow) == DialogResult.OK)
+ {
+ // Update main window
+ mainwindow.Update();
+
+ // Open map options dialog
+ openmapwindow = new OpenMapOptionsForm(openfile.FileName);
+ if(openmapwindow.ShowDialog(mainwindow) == DialogResult.OK)
{
// Display status
- mainwindow.DisplayStatus("Creating new map...");
-
+ mainwindow.DisplayStatus("Opening map file...");
+
// Clear the display
mainwindow.ClearDisplay();
-
+
// Trash the current map, if any
if(map != null) map.Dispose();
// Create map manager with given options
map = new MapManager();
- if(!map.InitializeNewMap(newoptions))
+ if(!map.InitializeOpenMap(openfile.FileName, openmapwindow.Options))
{
// Unable to create map manager
map.Dispose();
@@ -253,58 +334,20 @@ namespace CodeImp.DoomBuilder
return false;
}
- // TEST:
- Vertex v1 = map.Data.CreateVertex(new Vector2D(20f, 20f));
- Vertex v2 = map.Data.CreateVertex(new Vector2D(-20f, 20f));
- Vertex v3 = map.Data.CreateVertex(new Vector2D(-20f, -20f));
- Vertex v4 = map.Data.CreateVertex(new Vector2D(20f, -20f));
- map.Data.CreateLinedef(v1, v2);
- map.Data.CreateLinedef(v2, v3);
- map.Data.CreateLinedef(v3, v4);
- map.Data.CreateLinedef(v4, v1);
-
// Done
mainwindow.UpdateMenus();
mainwindow.DisplayReady();
return true;
}
}
-
+
// Cancelled
return false;
}
-
- // This closes the current map
- public static bool CloseMap()
- {
- // Ask to save the map if not saved yet
- if(AskSaveMap())
- {
- // Display status
- mainwindow.DisplayStatus("Closing map...");
-
- // Trash the current map
- if(map != null) map.Dispose();
- map = null;
-
- // Show splash logo on display
- mainwindow.ShowSplashDisplay();
-
- // Done
- mainwindow.UpdateMenus();
- mainwindow.DisplayReady();
- return true;
- }
- else
- {
- // Cancelled
- return false;
- }
- }
// This asks to save the map if needed
// Returns false when action was cancelled
- private static bool AskSaveMap()
+ public static bool AskSaveMap()
{
DialogResult result;
diff --git a/Source/General/MapManager.cs b/Source/General/MapManager.cs
index 2475bfea..ce952ed5 100644
--- a/Source/General/MapManager.cs
+++ b/Source/General/MapManager.cs
@@ -112,9 +112,9 @@ namespace CodeImp.DoomBuilder
this.options = options;
// Create objects
- data = new MapSet();
graphics = new Graphics(General.MainWindow.Display);
config = General.LoadGameConfiguration(options.ConfigFile);
+ data = new MapSet();
// Initiate graphics
if(!graphics.Initialize()) return false;
@@ -125,6 +125,30 @@ namespace CodeImp.DoomBuilder
// Success
return true;
}
+
+ // Initializes for an existing map
+ public bool InitializeOpenMap(string filepathname, MapOptions options)
+ {
+ // Apply settings
+ this.filetitle = Path.GetFileName(filepathname);
+ this.filepathname = filepathname;
+ this.changed = false;
+ this.options = options;
+
+ // Create objects
+ graphics = new Graphics(General.MainWindow.Display);
+ config = General.LoadGameConfiguration(options.ConfigFile);
+ data = new MapSet();
+
+ // Initiate graphics
+ if(!graphics.Initialize()) return false;
+
+ // Set default mode
+ ChangeMode(typeof(FrozenOverviewMode));
+
+ // Success
+ return true;
+ }
#endregion
@@ -152,6 +176,9 @@ namespace CodeImp.DoomBuilder
Debug.WriteLine(e.InnerException.StackTrace);
throw e.InnerException;
}
+
+ // Redraw the display
+ mode.RedrawDisplay();
}
#endregion
diff --git a/Source/IO/ClippedStream.cs b/Source/IO/ClippedStream.cs
index 404144bb..6ea456bf 100644
--- a/Source/IO/ClippedStream.cs
+++ b/Source/IO/ClippedStream.cs
@@ -79,14 +79,14 @@ namespace CodeImp.DoomBuilder.IO
// Not already disposed?
if(!isdisposed)
{
+ // Already set isdisposed to prevent recursion
+ isdisposed = true;
+
// Clean up
basestream = null;
// Dispose base
base.Dispose();
-
- // Done
- isdisposed = true;
}
}
@@ -206,7 +206,7 @@ namespace CodeImp.DoomBuilder.IO
// This closes the stream
public override void Close()
{
- basestream.Close();
+ basestream = null;
base.Close();
this.Dispose();
}
diff --git a/Source/IO/Configuration.cs b/Source/IO/Configuration.cs
index 2aac5f80..17be906e 100644
--- a/Source/IO/Configuration.cs
+++ b/Source/IO/Configuration.cs
@@ -967,14 +967,14 @@ namespace CodeImp.DoomBuilder.IO
{
// Output the value with a postfixed f
db.Append(leveltabs); db.Append(de.Key); db.Append(spacing); db.Append("=");
- db.Append(spacing); db.Append(de.Value); db.Append("f;"); db.Append(newline);
+ db.Append(spacing); db.Append(String.Format(CultureInfo.InvariantCulture, "{0}", de.Value)); db.Append("f;"); db.Append(newline);
}
// Check if value is of other numeric type
else if(de.Value.GetType().IsPrimitive)
{
// Output the value unquoted
db.Append(leveltabs); db.Append(de.Key); db.Append(spacing); db.Append("=");
- db.Append(spacing); db.Append(de.Value); db.Append(";"); db.Append(newline);
+ db.Append(spacing); db.Append(String.Format(CultureInfo.InvariantCulture, "{0}", de.Value)); db.Append(";"); db.Append(newline);
}
else
{
diff --git a/Source/IO/DoomMapSetIO.cs b/Source/IO/DoomMapSetIO.cs
new file mode 100644
index 00000000..6b9eb8e5
--- /dev/null
+++ b/Source/IO/DoomMapSetIO.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+
+namespace CodeImp.DoomBuilder.IO
+{
+ internal class DoomMapSetIO : IDisposable
+ {
+ #region ================== Constants
+
+ #endregion
+
+ #region ================== Variables
+
+ // Disposing
+ private bool isdisposed = false;
+
+ #endregion
+
+ #region ================== Properties
+
+ // Disposing
+ public bool IsDisposed { get { return isdisposed; } }
+
+ #endregion
+
+ #region ================== Constructor / Disposer
+
+ // Constructor
+ public DoomMapSetIO()
+ {
+ // Initialize
+
+ // We have no destructor
+ GC.SuppressFinalize(this);
+ }
+
+ // Diposer
+ public void Dispose()
+ {
+ // Not already disposed?
+ if(!isdisposed)
+ {
+ // Clean up
+
+ // Done
+ isdisposed = true;
+ }
+ }
+
+ #endregion
+
+ #region ================== Methods
+
+ #endregion
+ }
+}
diff --git a/Source/IO/Lump.cs b/Source/IO/Lump.cs
index 316f94ee..4207fc56 100644
--- a/Source/IO/Lump.cs
+++ b/Source/IO/Lump.cs
@@ -102,8 +102,13 @@ namespace CodeImp.DoomBuilder.IO
// This makes the normal name from fixed name
private static string MakeNormalName(byte[] fixedname, Encoding encoding)
{
- // Return the name as a string
- return encoding.GetString(fixedname);
+ int length = 0;
+
+ // Figure out the length of the lump name
+ while((length < fixedname.Length) && (fixedname[length] != 0)) length++;
+
+ // Make normal name
+ return encoding.GetString(fixedname, 0, length);
}
// This makes the fixed name from normal name
diff --git a/Source/Interface/MainForm.Designer.cs b/Source/Interface/MainForm.Designer.cs
index 4f56d3de..42a6cf6a 100644
--- a/Source/Interface/MainForm.Designer.cs
+++ b/Source/Interface/MainForm.Designer.cs
@@ -41,17 +41,16 @@ namespace CodeImp.DoomBuilder.Interface
this.itemsavemapinto = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.itemexit = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuhelp = new System.Windows.Forms.ToolStripMenuItem();
+ this.itemhelpabout = new System.Windows.Forms.ToolStripMenuItem();
this.toolbar = new System.Windows.Forms.ToolStrip();
this.statusbar = new System.Windows.Forms.StatusStrip();
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
this.panelinfo = new System.Windows.Forms.Panel();
- this.display = new System.Windows.Forms.PictureBox();
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
- this.menuhelp = new System.Windows.Forms.ToolStripMenuItem();
- this.itemhelpabout = new System.Windows.Forms.ToolStripMenuItem();
+ this.display = new System.Windows.Forms.Panel();
this.menumain.SuspendLayout();
this.statusbar.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit();
this.SuspendLayout();
//
// menumain
@@ -93,6 +92,7 @@ namespace CodeImp.DoomBuilder.Interface
this.itemopenmap.Name = "itemopenmap";
this.itemopenmap.Size = new System.Drawing.Size(167, 22);
this.itemopenmap.Text = "Open Map...";
+ this.itemopenmap.Click += new System.EventHandler(this.itemopenmap_Click);
//
// itemclosemap
//
@@ -136,6 +136,21 @@ namespace CodeImp.DoomBuilder.Interface
this.itemexit.Text = "Exit";
this.itemexit.Click += new System.EventHandler(this.itemexit_Click);
//
+ // menuhelp
+ //
+ this.menuhelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.itemhelpabout});
+ this.menuhelp.Name = "menuhelp";
+ this.menuhelp.Size = new System.Drawing.Size(40, 20);
+ this.menuhelp.Text = "Help";
+ //
+ // itemhelpabout
+ //
+ this.itemhelpabout.Name = "itemhelpabout";
+ this.itemhelpabout.Size = new System.Drawing.Size(191, 22);
+ this.itemhelpabout.Text = "About Doom Builder...";
+ this.itemhelpabout.Click += new System.EventHandler(this.itemhelpabout_Click);
+ //
// toolbar
//
this.toolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
@@ -172,48 +187,32 @@ namespace CodeImp.DoomBuilder.Interface
this.panelinfo.Size = new System.Drawing.Size(731, 101);
this.panelinfo.TabIndex = 4;
//
+ // redrawtimer
+ //
+ this.redrawtimer.Interval = 1;
+ this.redrawtimer.Tick += new System.EventHandler(this.redrawtimer_Tick);
+ //
// display
//
this.display.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.display.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash2;
this.display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.display.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.display.CausesValidation = false;
this.display.Dock = System.Windows.Forms.DockStyle.Fill;
- this.display.ErrorImage = null;
- this.display.InitialImage = null;
this.display.Location = new System.Drawing.Point(0, 49);
this.display.Name = "display";
this.display.Size = new System.Drawing.Size(731, 373);
this.display.TabIndex = 5;
- this.display.TabStop = false;
this.display.MouseLeave += new System.EventHandler(this.display_MouseLeave);
this.display.MouseDown += new System.Windows.Forms.MouseEventHandler(this.display_MouseDown);
this.display.MouseMove += new System.Windows.Forms.MouseEventHandler(this.display_MouseMove);
- this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint);
- this.display.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseDoubleClick);
this.display.MouseClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseClick);
- this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
+ this.display.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseDoubleClick);
+ this.display.Resize += new System.EventHandler(this.display_Resize);
this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter);
- //
- // redrawtimer
- //
- this.redrawtimer.Interval = 1;
- this.redrawtimer.Tick += new System.EventHandler(this.redrawtimer_Tick);
- //
- // menuhelp
- //
- this.menuhelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.itemhelpabout});
- this.menuhelp.Name = "menuhelp";
- this.menuhelp.Size = new System.Drawing.Size(40, 20);
- this.menuhelp.Text = "Help";
- //
- // itemhelpabout
- //
- this.itemhelpabout.Name = "itemhelpabout";
- this.itemhelpabout.Size = new System.Drawing.Size(191, 22);
- this.itemhelpabout.Text = "About Doom Builder...";
- this.itemhelpabout.Click += new System.EventHandler(this.itemhelpabout_Click);
+ this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint);
+ this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
//
// MainForm
//
@@ -224,7 +223,6 @@ namespace CodeImp.DoomBuilder.Interface
this.Controls.Add(this.statusbar);
this.Controls.Add(this.toolbar);
this.Controls.Add(this.menumain);
- this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
@@ -240,7 +238,6 @@ namespace CodeImp.DoomBuilder.Interface
this.menumain.PerformLayout();
this.statusbar.ResumeLayout(false);
this.statusbar.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.display)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -252,7 +249,6 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.ToolStrip toolbar;
private System.Windows.Forms.StatusStrip statusbar;
private System.Windows.Forms.Panel panelinfo;
- private System.Windows.Forms.PictureBox display;
private System.Windows.Forms.ToolStripMenuItem menufile;
private System.Windows.Forms.ToolStripMenuItem itemnewmap;
private System.Windows.Forms.ToolStripMenuItem itemopenmap;
@@ -267,5 +263,6 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.Timer redrawtimer;
private System.Windows.Forms.ToolStripMenuItem menuhelp;
private System.Windows.Forms.ToolStripMenuItem itemhelpabout;
+ private System.Windows.Forms.Panel display;
}
}
\ No newline at end of file
diff --git a/Source/Interface/MainForm.cs b/Source/Interface/MainForm.cs
index 05a3b66b..bbe7bfdd 100644
--- a/Source/Interface/MainForm.cs
+++ b/Source/Interface/MainForm.cs
@@ -41,11 +41,15 @@ namespace CodeImp.DoomBuilder.Interface
private Point lastposition;
private Size lastsize;
+ // Mouse in display
+ private bool mouseinside;
+
#endregion
#region ================== Properties
- public PictureBox Display { get { return display; } }
+ public bool MouseInDisplay { get { return mouseinside; } }
+ public Panel Display { get { return display; } }
#endregion
@@ -163,7 +167,7 @@ namespace CodeImp.DoomBuilder.Interface
// Change display to show splash logo
display.BackColor = System.Drawing.SystemColors.AppWorkspace;
display.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash2;
- display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
+ //display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.Update();
}
@@ -173,7 +177,7 @@ namespace CodeImp.DoomBuilder.Interface
// Clear the display
display.BackColor = Color.Black;
display.BackgroundImage = null;
- display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile;
+ //display.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile;
this.Update();
}
@@ -193,6 +197,19 @@ namespace CodeImp.DoomBuilder.Interface
// Redraw now
if(General.Map != null) General.Map.Mode.RedrawDisplay();
}
+
+ // Display size changes
+ private void display_Resize(object sender, EventArgs e)
+ {
+ // Reset graphics to match changes
+ if(General.Map != null) General.Map.Graphics.Reset();
+
+ // Make sure control is repainted
+ display.Update();
+
+ // Redraw display
+ if(General.Map != null) General.Map.Mode.RedrawDisplay();
+ }
// Mouse click
private void display_MouseClick(object sender, MouseEventArgs e) { if(General.Map != null) General.Map.Mode.MouseClick(e); }
@@ -204,10 +221,18 @@ namespace CodeImp.DoomBuilder.Interface
private void display_MouseDown(object sender, MouseEventArgs e) { if(General.Map != null) General.Map.Mode.MouseDown(e); }
// Mouse enters
- private void display_MouseEnter(object sender, EventArgs e) { if(General.Map != null) General.Map.Mode.MouseEnter(e); }
+ private void display_MouseEnter(object sender, EventArgs e)
+ {
+ mouseinside = true;
+ if(General.Map != null) General.Map.Mode.MouseEnter(e);
+ }
// Mouse leaves
- private void display_MouseLeave(object sender, EventArgs e) { if(General.Map != null) General.Map.Mode.MouseLeave(e); }
+ private void display_MouseLeave(object sender, EventArgs e)
+ {
+ mouseinside = false;
+ if(General.Map != null) General.Map.Mode.MouseLeave(e);
+ }
// Mouse moves
private void display_MouseMove(object sender, MouseEventArgs e) { if(General.Map != null) General.Map.Mode.MouseMove(e); }
@@ -231,10 +256,13 @@ namespace CodeImp.DoomBuilder.Interface
#region ================== File Menu
// New map clicked
- private void itemnewmap_Click(object sender, EventArgs e) { General.NewMap(); }
+ private void itemnewmap_Click(object sender, EventArgs e) { if(General.AskSaveMap()) General.NewMap(); }
+
+ // Open map clicked
+ private void itemopenmap_Click(object sender, EventArgs e) { if(General.AskSaveMap()) General.OpenMap(); }
// Close map clicked
- private void itemclosemap_Click(object sender, EventArgs e) { General.CloseMap(); }
+ private void itemclosemap_Click(object sender, EventArgs e) { if(General.AskSaveMap()) General.CloseMap(); }
// Exit clicked
private void itemexit_Click(object sender, EventArgs e) { this.Close(); }
diff --git a/Source/Interface/MainForm.resx b/Source/Interface/MainForm.resx
index 605068ce..7775d1bb 100644
--- a/Source/Interface/MainForm.resx
+++ b/Source/Interface/MainForm.resx
@@ -117,12 +117,12 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- True
-
17, 17
+
+ True
+
True
@@ -138,12 +138,12 @@
True
-
- True
-
304, 17
+
+ True
+
True
diff --git a/Source/Interface/MapOptionsForm.cs b/Source/Interface/MapOptionsForm.cs
index 0c5f255c..fa1b7440 100644
--- a/Source/Interface/MapOptionsForm.cs
+++ b/Source/Interface/MapOptionsForm.cs
@@ -1,3 +1,21 @@
+
+#region ================== Copyright (c) 2007 Pascal vd Heiden
+
+/*
+ * Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
+ * This program is released under GNU General Public License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#endregion
+
+#region ================== Namespaces
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -6,6 +24,8 @@ using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
+#endregion
+
namespace CodeImp.DoomBuilder.Interface
{
internal partial class MapOptionsForm : Form
@@ -91,9 +111,14 @@ namespace CodeImp.DoomBuilder.Interface
private void addresource_Click(object sender, EventArgs e)
{
ResourceOptionsForm resoptions;
+ Point startposition;
// Open resource options dialog
resoptions = new ResourceOptionsForm(new ResourceLocation(), "Add Resource");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = this.Location;
+ startposition.Offset(50, 160);
+ resoptions.Location = startposition;
if(resoptions.ShowDialog(this) == DialogResult.OK)
{
// Add resource
@@ -105,12 +130,17 @@ namespace CodeImp.DoomBuilder.Interface
private void editresource_Click(object sender, EventArgs e)
{
ResourceOptionsForm resoptions;
-
+ Point startposition;
+
// Anything selected?
if(resources.SelectedIndex > -1)
{
// Open resource options dialog
resoptions = new ResourceOptionsForm((ResourceLocation)resources.SelectedItem, "Resource Options");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = this.Location;
+ startposition.Offset(50, 160);
+ resoptions.Location = startposition;
if(resoptions.ShowDialog(this) == DialogResult.OK)
{
// Replace resource
diff --git a/Source/Interface/OpenMapOptionsForm.Designer.cs b/Source/Interface/OpenMapOptionsForm.Designer.cs
new file mode 100644
index 00000000..cbfc687a
--- /dev/null
+++ b/Source/Interface/OpenMapOptionsForm.Designer.cs
@@ -0,0 +1,217 @@
+namespace CodeImp.DoomBuilder.Interface
+{
+ partial class OpenMapOptionsForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if(disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.panelres = new System.Windows.Forms.GroupBox();
+ this.deleteresource = new System.Windows.Forms.Button();
+ this.editresource = new System.Windows.Forms.Button();
+ this.addresource = new System.Windows.Forms.Button();
+ this.resources = new System.Windows.Forms.ListBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.apply = new System.Windows.Forms.Button();
+ this.cancel = new System.Windows.Forms.Button();
+ this.config = new System.Windows.Forms.ComboBox();
+ this.mapslist = new System.Windows.Forms.ListView();
+ this.panelres.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panelres
+ //
+ this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.panelres.Controls.Add(this.deleteresource);
+ this.panelres.Controls.Add(this.editresource);
+ this.panelres.Controls.Add(this.addresource);
+ this.panelres.Controls.Add(this.resources);
+ this.panelres.Location = new System.Drawing.Point(12, 214);
+ this.panelres.Name = "panelres";
+ this.panelres.Size = new System.Drawing.Size(365, 165);
+ this.panelres.TabIndex = 11;
+ this.panelres.TabStop = false;
+ this.panelres.Text = " Custom Resources ";
+ //
+ // deleteresource
+ //
+ this.deleteresource.Enabled = false;
+ this.deleteresource.Location = new System.Drawing.Point(268, 125);
+ this.deleteresource.Name = "deleteresource";
+ this.deleteresource.Size = new System.Drawing.Size(74, 25);
+ this.deleteresource.TabIndex = 13;
+ this.deleteresource.Text = "Remove";
+ this.deleteresource.UseVisualStyleBackColor = true;
+ this.deleteresource.Click += new System.EventHandler(this.deleteresource_Click);
+ //
+ // editresource
+ //
+ this.editresource.Enabled = false;
+ this.editresource.Location = new System.Drawing.Point(139, 125);
+ this.editresource.Name = "editresource";
+ this.editresource.Size = new System.Drawing.Size(123, 25);
+ this.editresource.TabIndex = 12;
+ this.editresource.Text = "Resource Options...";
+ this.editresource.UseVisualStyleBackColor = true;
+ this.editresource.Click += new System.EventHandler(this.editresource_Click);
+ //
+ // addresource
+ //
+ this.addresource.Location = new System.Drawing.Point(21, 125);
+ this.addresource.Name = "addresource";
+ this.addresource.Size = new System.Drawing.Size(112, 25);
+ this.addresource.TabIndex = 11;
+ this.addresource.Text = "Add Resource...";
+ this.addresource.UseVisualStyleBackColor = true;
+ this.addresource.Click += new System.EventHandler(this.addresource_Click);
+ //
+ // resources
+ //
+ this.resources.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.resources.FormattingEnabled = true;
+ this.resources.ItemHeight = 14;
+ this.resources.Location = new System.Drawing.Point(21, 31);
+ this.resources.Name = "resources";
+ this.resources.Size = new System.Drawing.Size(321, 88);
+ this.resources.TabIndex = 10;
+ this.resources.SelectedIndexChanged += new System.EventHandler(this.resources_SelectedIndexChanged);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(30, 24);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(105, 14);
+ this.label1.TabIndex = 14;
+ this.label1.Text = "Game Configuration:";
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(12, 57);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(365, 30);
+ this.label2.TabIndex = 16;
+ this.label2.Text = "With the above selected configuration, the maps shown below were found in the cho" +
+ "sen WAD file. Please select the map to load for editing.";
+ //
+ // apply
+ //
+ this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.apply.Location = new System.Drawing.Point(147, 399);
+ this.apply.Name = "apply";
+ this.apply.Size = new System.Drawing.Size(112, 25);
+ this.apply.TabIndex = 12;
+ this.apply.Text = "OK";
+ this.apply.UseVisualStyleBackColor = true;
+ this.apply.Click += new System.EventHandler(this.apply_Click);
+ //
+ // cancel
+ //
+ this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancel.Location = new System.Drawing.Point(265, 399);
+ this.cancel.Name = "cancel";
+ this.cancel.Size = new System.Drawing.Size(112, 25);
+ this.cancel.TabIndex = 13;
+ this.cancel.Text = "Cancel";
+ this.cancel.UseVisualStyleBackColor = true;
+ this.cancel.Click += new System.EventHandler(this.cancel_Click);
+ //
+ // config
+ //
+ this.config.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.config.FormattingEnabled = true;
+ this.config.Location = new System.Drawing.Point(141, 21);
+ this.config.Name = "config";
+ this.config.Size = new System.Drawing.Size(213, 22);
+ this.config.TabIndex = 15;
+ this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
+ //
+ // mapslist
+ //
+ this.mapslist.AutoArrange = false;
+ this.mapslist.FullRowSelect = true;
+ this.mapslist.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.mapslist.HideSelection = false;
+ this.mapslist.LabelWrap = false;
+ this.mapslist.Location = new System.Drawing.Point(12, 90);
+ this.mapslist.MultiSelect = false;
+ this.mapslist.Name = "mapslist";
+ this.mapslist.ShowGroups = false;
+ this.mapslist.Size = new System.Drawing.Size(365, 110);
+ this.mapslist.Sorting = System.Windows.Forms.SortOrder.Ascending;
+ this.mapslist.TabIndex = 18;
+ this.mapslist.UseCompatibleStateImageBehavior = false;
+ this.mapslist.View = System.Windows.Forms.View.List;
+ //
+ // OpenMapOptionsForm
+ //
+ this.AcceptButton = this.apply;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancel;
+ this.ClientSize = new System.Drawing.Size(389, 436);
+ this.Controls.Add(this.mapslist);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.config);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.cancel);
+ this.Controls.Add(this.apply);
+ this.Controls.Add(this.panelres);
+ this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "OpenMapOptionsForm";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Open Map Options";
+ this.Shown += new System.EventHandler(this.OpenMapOptionsForm_Shown);
+ this.panelres.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button deleteresource;
+ private System.Windows.Forms.Button editresource;
+ private System.Windows.Forms.Button addresource;
+ private System.Windows.Forms.ListBox resources;
+ private System.Windows.Forms.Button apply;
+ private System.Windows.Forms.Button cancel;
+ private System.Windows.Forms.ComboBox config;
+ private System.Windows.Forms.GroupBox panelres;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.ListView mapslist;
+
+
+ }
+}
\ No newline at end of file
diff --git a/Source/Interface/OpenMapOptionsForm.cs b/Source/Interface/OpenMapOptionsForm.cs
new file mode 100644
index 00000000..6aae0df7
--- /dev/null
+++ b/Source/Interface/OpenMapOptionsForm.cs
@@ -0,0 +1,364 @@
+
+#region ================== Copyright (c) 2007 Pascal vd Heiden
+
+/*
+ * Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
+ * This program is released under GNU General Public License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#endregion
+
+#region ================== Namespaces
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using CodeImp.DoomBuilder.IO;
+using CodeImp.DoomBuilder.Map;
+using System.IO;
+using System.Collections;
+
+#endregion
+
+namespace CodeImp.DoomBuilder.Interface
+{
+ internal partial class OpenMapOptionsForm : Form
+ {
+ // Variables
+ private Configuration mapsettings;
+ private MapOptions options;
+ private WAD wadfile;
+ private string filepathname;
+
+ // Properties
+ public string FilePathName { get { return filepathname; } }
+ public MapOptions Options { get { return options; } }
+
+ // Constructor
+ public OpenMapOptionsForm(string filepathname)
+ {
+ // Initialize
+ InitializeComponent();
+ this.filepathname = filepathname;
+ this.options = new MapOptions();
+ }
+
+ // This loads the settings and attempt to find a suitable config
+ private void LoadSettings()
+ {
+ string dbsfile;
+ string gameconfig;
+
+ // Busy
+ Cursor.Current = Cursors.WaitCursor;
+
+ try
+ {
+ // Open the WAD file
+ wadfile = new WAD(filepathname, true);
+
+ // Open the Map Settings configuration
+ dbsfile = filepathname.Substring(0, filepathname.Length - 4) + ".dbs";
+ if(File.Exists(dbsfile))
+ mapsettings = new Configuration(dbsfile, true);
+ else
+ mapsettings = new Configuration(true);
+ }
+ catch(Exception)
+ {
+ // Unable to open WAD file (or its config)
+ MessageBox.Show(this, "Could not open the WAD file for reading. Please make sure the file you selected is valid and is not in use by any other application.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ if(wadfile != null) wadfile.Dispose();
+ this.DialogResult = DialogResult.Cancel;
+ this.Hide();
+ }
+
+ // Check what game configuration is preferred
+ gameconfig = mapsettings.ReadSetting("gameconfig", "");
+
+ // Go for all configurations
+ for(int i = 0; i < General.Configs.Count; i++)
+ {
+ // Add config name to list
+ config.Items.Add(General.Configs[i].name);
+
+ // This is the preferred game configuration?
+ if(General.Configs[i].filename == gameconfig)
+ {
+ // Select this item
+ config.SelectedIndex = i;
+ }
+ }
+
+ // Still no configuration selected?
+ if(config.SelectedIndex == -1)
+ {
+ // Then go for all configurations to find a suitable one
+ for(int i = 0; i < General.Configs.Count; i++)
+ {
+ // TODO: Check if an IWAD is set for this configuration
+
+ // Match the wad against this configuration
+ if(MatchConfiguration(General.Configs[i].filename, wadfile))
+ {
+ // Select this item
+ config.SelectedIndex = i;
+ break;
+ }
+ }
+ }
+
+ // Done
+ Cursor.Current = Cursors.Default;
+ }
+
+ // This matches a WAD file with the specified game configuration
+ // by checking if the specific lumps are detected
+ private bool MatchConfiguration(string configfile, WAD wadfile)
+ {
+ Configuration cfg;
+ IDictionary detectlumps;
+ Lump lumpresult;
+ bool result = false;
+
+ // Load the configuration
+ cfg = General.LoadGameConfiguration(configfile);
+
+ // Get the lumps to detect
+ detectlumps = cfg.ReadSetting("gamedetect", new Hashtable());
+
+ // Go for all the lumps
+ foreach(DictionaryEntry lmp in detectlumps)
+ {
+ // Setting not broken?
+ if((lmp.Value is int) && (lmp.Key is string))
+ {
+ // Find the lump in the WAD file
+ lumpresult = wadfile.FindLump((string)lmp.Key);
+
+ // If one of these lumps must exist, and it is found
+ if(((int)lmp.Value == 1) && (lumpresult != null))
+ {
+ // Good result.
+ result = true;
+ }
+ // If this lumps may not exist, and it is found
+ else if(((int)lmp.Value == 2) && (lumpresult != null))
+ {
+ // Bad result.
+ result = false;
+ break;
+ }
+ // If this lumps must exist, and it is missing
+ else if(((int)lmp.Value == 3) && (lumpresult == null))
+ {
+ // Bad result.
+ result = false;
+ break;
+ }
+ }
+ }
+
+ // Return result
+ return result;
+ }
+
+ // Configuration is selected
+ private void config_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ List mapnames;
+ Configuration cfg;
+ IDictionary maplumpnames;
+ int scanindex, checkoffset;
+ int lumpsfound, lumpsrequired = 0;
+ string lumpname, selectedname = "";
+
+ // Keep selected name, if any
+ if(mapslist.SelectedItems.Count > 0)
+ selectedname = mapslist.SelectedItems[0].Text;
+
+ // Make an array for the map names
+ mapnames = new List();
+
+ // Load this configuration
+ cfg = General.LoadGameConfiguration(General.Configs[config.SelectedIndex].filename);
+
+ // Get the map lump names
+ maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
+
+ // Count how many required lumps we have to find
+ foreach(DictionaryEntry ml in maplumpnames)
+ {
+ // Read lump setting and count it
+ if(cfg.ReadSetting("maplumpnames." + ml.Key + ".required", false)) lumpsrequired++;
+ }
+
+ // Go for all the lumps in the wad
+ for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
+ {
+ // Make sure this lump is not part of the map
+ if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
+ {
+ // Check the required map lumps
+ lumpsfound = 0;
+ checkoffset = 1;
+ do
+ {
+ // Count the lump when it is marked as required
+ lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
+ if(cfg.ReadSetting("maplumpnames." + lumpname + ".required", false)) lumpsfound++;
+
+ // Check the next lump
+ checkoffset++;
+ }
+ // Continue while still within bounds and lumps are still recognized
+ while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
+ maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name));
+
+ // Map found? Then add it to the list
+ if(lumpsfound >= lumpsrequired)
+ mapnames.Add(new ListViewItem(wadfile.Lumps[scanindex].Name));
+ }
+ }
+
+ // Clear the list and add the new map names
+ mapslist.Items.Clear();
+ mapslist.Items.AddRange(mapnames.ToArray());
+ mapslist.Sort();
+
+ // Go for all items in the list
+ foreach(ListViewItem item in mapslist.Items)
+ {
+ // Was this item previously selected?
+ if(item.Text == selectedname)
+ {
+ // Select it again
+ item.Selected = true;
+ break;
+ }
+ }
+ }
+
+ // OK clicked
+ private void apply_Click(object sender, EventArgs e)
+ {
+ // Configuration selected?
+ if(config.SelectedIndex == -1)
+ {
+ // Select a configuration!
+ MessageBox.Show(this, "Please select a game configuration to use for editing your map.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ config.Focus();
+ return;
+ }
+
+ // No map selected?
+ if(mapslist.SelectedItems.Count == 0)
+ {
+ // Choose a map!
+ MessageBox.Show(this, "Please select a map to load for editing.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ mapslist.Focus();
+ return;
+ }
+
+ // Apply changes
+ options.ClearResources();
+ options.ConfigFile = General.Configs[config.SelectedIndex].filename;
+ options.CurrentName = mapslist.SelectedItems[0].ToString();
+ foreach(ResourceLocation res in resources.Items) options.AddResource(res);
+
+ // Hide window
+ wadfile.Dispose();
+ this.DialogResult = DialogResult.OK;
+ this.Hide();
+ }
+
+ // Cancel clicked
+ private void cancel_Click(object sender, EventArgs e)
+ {
+ // Just hide window
+ wadfile.Dispose();
+ this.DialogResult = DialogResult.Cancel;
+ this.Hide();
+ }
+
+ // Add Resource clicked
+ private void addresource_Click(object sender, EventArgs e)
+ {
+ ResourceOptionsForm resoptions;
+ Point startposition;
+
+ // Open resource options dialog
+ resoptions = new ResourceOptionsForm(new ResourceLocation(), "Add Resource");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = this.Location;
+ startposition.Offset(50, 230);
+ resoptions.Location = startposition;
+ if(resoptions.ShowDialog(this) == DialogResult.OK)
+ {
+ // Add resource
+ resources.Items.Add(resoptions.ResourceLocation);
+ }
+ }
+
+ // Resource Options clicked
+ private void editresource_Click(object sender, EventArgs e)
+ {
+ ResourceOptionsForm resoptions;
+ Point startposition;
+
+ // Anything selected?
+ if(resources.SelectedIndex > -1)
+ {
+ // Open resource options dialog
+ resoptions = new ResourceOptionsForm((ResourceLocation)resources.SelectedItem, "Resource Options");
+ resoptions.StartPosition = FormStartPosition.Manual;
+ startposition = this.Location;
+ startposition.Offset(50, 230);
+ resoptions.Location = startposition;
+ if(resoptions.ShowDialog(this) == DialogResult.OK)
+ {
+ // Replace resource
+ resources.Items[resources.SelectedIndex] = resoptions.ResourceLocation;
+ }
+ }
+ }
+
+ // Remove resource clicked
+ private void deleteresource_Click(object sender, EventArgs e)
+ {
+ // Anything selected?
+ if(resources.SelectedIndex > -1)
+ {
+ // Remove it
+ resources.Items.RemoveAt(resources.SelectedIndex);
+ }
+ }
+
+ // Resource selection changes
+ private void resources_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // Enable/disable buttons
+ editresource.Enabled = (resources.SelectedIndex > -1);
+ deleteresource.Enabled = (resources.SelectedIndex > -1);
+ }
+
+ // Window is shown
+ private void OpenMapOptionsForm_Shown(object sender, EventArgs e)
+ {
+ // Update window
+ this.Update();
+
+ // Load settings
+ LoadSettings();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/Interface/OpenMapOptionsForm.resx b/Source/Interface/OpenMapOptionsForm.resx
new file mode 100644
index 00000000..6b6339e0
--- /dev/null
+++ b/Source/Interface/OpenMapOptionsForm.resx
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/Source/Interface/ResourceOptionsForm.Designer.cs b/Source/Interface/ResourceOptionsForm.Designer.cs
index 850d5d4f..542528de 100644
--- a/Source/Interface/ResourceOptionsForm.Designer.cs
+++ b/Source/Interface/ResourceOptionsForm.Designer.cs
@@ -197,7 +197,7 @@ namespace CodeImp.DoomBuilder.Interface
//
// wadfiledialog
//
- this.wadfiledialog.Filter = "Doom WAD Files|*.wad";
+ this.wadfiledialog.Filter = "Doom WAD Files (*.wad)|*.wad";
this.wadfiledialog.Title = "Browse WAD File";
//
// dirdialog
diff --git a/Source/Interface/ResourceOptionsForm.cs b/Source/Interface/ResourceOptionsForm.cs
index 25165e42..dbf21a49 100644
--- a/Source/Interface/ResourceOptionsForm.cs
+++ b/Source/Interface/ResourceOptionsForm.cs
@@ -1,3 +1,21 @@
+
+#region ================== Copyright (c) 2007 Pascal vd Heiden
+
+/*
+ * Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
+ * This program is released under GNU General Public License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#endregion
+
+#region ================== Namespaces
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -7,6 +25,8 @@ using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using System.IO;
+#endregion
+
namespace CodeImp.DoomBuilder.Interface
{
internal partial class ResourceOptionsForm : Form
diff --git a/Source/Map/MapOptions.cs b/Source/Map/MapOptions.cs
index c5ff5c77..b07f4bd2 100644
--- a/Source/Map/MapOptions.cs
+++ b/Source/Map/MapOptions.cs
@@ -82,6 +82,41 @@ namespace CodeImp.DoomBuilder.Map
this.resources = new List();
}
+ // Constructor to load from Doom Builder Map Settings Configuration
+ public MapOptions(Configuration cfg, string mapname)
+ {
+ IDictionary mapinfo, resinfo;
+ ResourceLocation res;
+
+ // Initialize
+ this.previousname = "";
+ this.currentname = mapname;
+ this.configfile = cfg.ReadSetting("config", "");
+ this.resources = new List();
+
+ // Go for all items in the map info
+ mapinfo = cfg.ReadSetting(mapname, new Hashtable());
+ foreach(DictionaryEntry mp in mapinfo)
+ {
+ // Item is a structure?
+ if(mp.Value is IDictionary)
+ {
+ // Create resource
+ resinfo = (IDictionary)mp.Value;
+ res = new ResourceLocation();
+
+ // Copy information from Configuration to ResourceLocation
+ if(resinfo.Contains("type") && (resinfo["type"] is int)) res.type = (int)resinfo["type"];
+ if(resinfo.Contains("location") && (resinfo["location"] is string)) res.location = (string)resinfo["location"];
+ if(resinfo.Contains("textures") && (resinfo["textures"] is bool)) res.textures = (bool)resinfo["textures"];
+ if(resinfo.Contains("flats") && (resinfo["flats"] is bool)) res.flats = (bool)resinfo["flats"];
+
+ // Add resource
+ AddResource(res);
+ }
+ }
+ }
+
~MapOptions()
{
// Clean up
@@ -129,6 +164,12 @@ namespace CodeImp.DoomBuilder.Map
resources.RemoveAt(index);
}
+ // This displays the current map name
+ public override string ToString()
+ {
+ return currentname;
+ }
+
#endregion
}
}
diff --git a/Source/Rendering/Graphics.cs b/Source/Rendering/Graphics.cs
index 91cfa5f9..02bef50a 100644
--- a/Source/Rendering/Graphics.cs
+++ b/Source/Rendering/Graphics.cs
@@ -261,7 +261,7 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Resetting
// This resets the device and returns true on success
- private bool Reset()
+ public bool Reset()
{
PresentParameters displaypp;