added stuff

This commit is contained in:
codeimp 2007-06-14 23:31:57 +00:00
parent 705ee05c54
commit 776a52b50f
31 changed files with 1673 additions and 59 deletions

View file

@ -2,9 +2,9 @@
mainwindow
{
positionx = 27;
windowstate = 2;
sizeheight = 586;
sizewidth = 750;
sizeheight = 572;
positiony = 15;
windowstate = 2;
sizewidth = 739;
}

View file

@ -44,10 +44,24 @@
</Target>
-->
<ItemGroup>
<Compile Include="General\ConfigurationInfo.cs" />
<Compile Include="General\MapManager.cs" />
<Compile Include="Geometry\Angle2D.cs" />
<Compile Include="Geometry\Line2D.cs" />
<Compile Include="Geometry\Vector2D.cs" />
<Compile Include="Geometry\Vector3D.cs" />
<Compile Include="Interface\MapOptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Interface\MapOptionsForm.Designer.cs">
<DependentUpon>MapOptionsForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ResourceOptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Interface\ResourceOptionsForm.Designer.cs">
<DependentUpon>ResourceOptionsForm.cs</DependentUpon>
</Compile>
<Compile Include="IO\Configuration.cs" />
<Compile Include="General\General.cs" />
<Compile Include="IO\ClippedStream.cs" />
@ -61,7 +75,9 @@
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Map\Linedef.cs" />
<Compile Include="Map\MapOptions.cs" />
<Compile Include="Map\MapSet.cs" />
<Compile Include="Map\ResourceLocation.cs" />
<Compile Include="Map\Sector.cs" />
<Compile Include="Map\Sidedef.cs" />
<Compile Include="Map\Thing.cs" />
@ -86,6 +102,14 @@
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Interface\MapOptionsForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MapOptionsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Interface\ResourceOptionsForm.resx">
<SubType>Designer</SubType>
<DependentUpon>ResourceOptionsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>

View file

@ -0,0 +1,30 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace CodeImp.DoomBuilder
{
internal struct ConfigurationInfo : IComparable<ConfigurationInfo>
{
// Members
public string name;
public string filename;
// Constructor
public ConfigurationInfo(string name, string filename)
{
// Initialize
this.name = name;
this.filename = filename;
}
// This compares it to other ConfigurationInfo objects
public int CompareTo(ConfigurationInfo other)
{
// Compare
return name.CompareTo(other.name);
}
}
}

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -20,7 +26,9 @@ using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Interface;
using CodeImp.DoomBuilder.IO;
using System.Collections.Specialized;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder
{
@ -44,10 +52,10 @@ namespace CodeImp.DoomBuilder
// Main objects
private static MainForm mainwindow;
private static Configuration settings;
private static MapManager map;
// Configurations
private static List<string> configfiles;
private static List<string> confignames;
private static List<ConfigurationInfo> configs;
#endregion
@ -58,7 +66,85 @@ namespace CodeImp.DoomBuilder
public static string ConfigsPath { get { return configspath; } }
public static MainForm MainWindow { get { return mainwindow; } }
public static Configuration Settings { get { return settings; } }
public static List<ConfigurationInfo> Configs { get { return configs; } }
public static MapManager Map { get { return map; } }
#endregion
#region ================== Configurations
// This loads and returns a game configuration
public static Configuration LoadGameConfiguration(string filename)
{
Configuration cfg;
// Make the full filepathname
string filepathname = Path.Combine(configspath, filename);
// Load configuration
try
{
// Try loading the configuration
cfg = new Configuration(filepathname, true);
// Check for erors
if(cfg.ErrorResult != 0)
{
// Error in configuration
MessageBox.Show(mainwindow, "Unable to load the game configuration file \"" + filename + "\".\n" +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription,
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
else
{
// Return config
return cfg;
}
}
catch(Exception)
{
// Unable to load configuration
MessageBox.Show(mainwindow, "Unable to load the game configuration file \"" + filename + "\".",
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
}
// This finds all game configurations
private static void FindGameConfigurations()
{
Configuration cfg;
string[] filenames;
string name, fullfilename;
// Display status
mainwindow.DisplayStatus("Loading game configurations...");
// Make array
configs = new List<ConfigurationInfo>();
// Go for all files in the configurations directory
filenames = Directory.GetFiles(configspath, "*.cfg", SearchOption.TopDirectoryOnly);
foreach(string filepath in filenames)
{
// Check if it can be loaded
cfg = LoadGameConfiguration(filepath);
if(cfg != null)
{
// Get name and filename
name = cfg.ReadSetting("game", "<unnamed game>");
fullfilename = Path.GetFileName(filepath);
// Add to lists
configs.Add(new ConfigurationInfo(name, fullfilename));
}
}
// Sort the configurations list
configs.Sort();
}
#endregion
#region ================== Startup
@ -89,63 +175,13 @@ namespace CodeImp.DoomBuilder
mainwindow.Update();
// Load game configurations
LoadConfigurations();
FindGameConfigurations();
// Run application from the main window
mainwindow.DisplayReady();
Application.Run(mainwindow);
}
// This loads configurations
private static void LoadConfigurations()
{
Configuration cfg;
string[] filenames;
string fn;
// Display status
mainwindow.DisplayStatus("Loading game configurations...");
// Make arrays
configfiles = new List<string>();
confignames = new List<string>();
// Go for all files in the configurations directory
filenames = Directory.GetFiles(configspath, "*.cfg", SearchOption.TopDirectoryOnly);
foreach(string filepath in filenames)
{
// Determine filename only
fn = Path.GetFileName(filepath);
try
{
// Try loading the configuration
cfg = new Configuration(filepath, true);
// Check for erors
if(cfg.ErrorResult != 0)
{
// Error in configuration
MessageBox.Show(mainwindow, "Unable to load the game configuration file \"" + fn + "\".\n" +
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription,
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
// Add to lists
configfiles.Add(fn);
confignames.Add(cfg.ReadSetting("game", "<unnamed game>"));
}
}
catch(Exception)
{
// Unable to load configuration
MessageBox.Show(mainwindow, "Unable to load the game configuration file \"" + fn + "\".",
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
#endregion
#region ================== Terminate
@ -164,5 +200,57 @@ namespace CodeImp.DoomBuilder
}
#endregion
#region ================== Management
// This creates a new map
public static bool NewMap()
{
MapOptions newoptions;
MapOptionsForm optionswindow;
DialogResult result;
// Empty options
newoptions = new MapOptions();
// Open map options dialog
optionswindow = new MapOptionsForm(newoptions);
if(optionswindow.ShowDialog(mainwindow) == DialogResult.OK)
{
// Map open and not saved?
if((map != null) && map.IsChanged)
{
// Ask to save changes
result = MessageBox.Show(mainwindow, "Do you want to save changes to " + map.FileTitle + " (" + map.Options.CurrentName + ")?", Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if(result == DialogResult.Yes)
{
// TODO: Save map
}
else if(result == DialogResult.Cancel)
{
// Abort
return false;
}
}
// Display status
mainwindow.DisplayStatus("Creating new map...");
// Create map manager with these options
map = new MapManager(newoptions);
// Done
mainwindow.DisplayReady();
return true;
}
else
{
// Cancelled
return false;
}
}
#endregion
}
}

View file

@ -0,0 +1,105 @@
#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;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Interface;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder
{
internal class MapManager : IDisposable
{
#region ================== Constants
#endregion
#region ================== Variables
// Status
private bool changed;
// Map information
private string filetitle;
private string filepathname;
private MapSet data;
private MapOptions options;
private Configuration config;
// Disposing
private bool isdisposed = false;
#endregion
#region ================== Properties
public string FilePathName { get { return filepathname; } }
public string FileTitle { get { return filetitle; } }
public MapOptions Options { get { return options; } }
public bool IsChanged { get { return changed; } set { changed = value; } }
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
// Constructor for new map
public MapManager(MapOptions options)
{
// Initialize
this.filetitle = "unnamed.wad";
this.filepathname = "";
this.changed = false;
this.options = options;
this.config = General.LoadGameConfiguration(options.ConfigFile);
this.data = new MapSet();
// We have no destructor
GC.SuppressFinalize(this);
}
// Diposer
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Dispose
data.Dispose();
// Done
isdisposed = true;
}
}
#endregion
#region ================== Methods
#endregion
}
}

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Geometry
{
internal struct Angle2D

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Geometry
{
internal struct Line2D

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Geometry
{
internal struct Vector2D

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Geometry
{
internal struct Vector3D

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal class ClippedStream : Stream

View file

@ -1,4 +1,6 @@
#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
@ -10,7 +12,10 @@
*
*/
#region = CFG file structure syntax =
#endregion
#region ================== CFG file structure syntax
/*
' ====================================================================================
' CONFIGURATION FILE STRUCTURE SYNTAX
@ -121,8 +126,10 @@
' age = 52;
' }
*/
#endregion
#region ================== Namespaces
using System;
using System.IO;
@ -131,6 +138,8 @@ using System.Globalization;
using System.Collections;
using System.Collections.Specialized;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal sealed class Configuration

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal interface IMapSetIO : IDisposable

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal class Lump : IDisposable

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal class WAD : IDisposable

View file

@ -79,6 +79,7 @@ namespace CodeImp.DoomBuilder.Interface
this.itemnewmap.Name = "itemnewmap";
this.itemnewmap.Size = new System.Drawing.Size(167, 22);
this.itemnewmap.Text = "New Map...";
this.itemnewmap.Click += new System.EventHandler(this.itemnewmap_Click);
//
// itemopenmap
//

View file

@ -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;
@ -5,6 +23,8 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
#endregion
namespace CodeImp.DoomBuilder.Interface
{
public partial class MainForm : Form
@ -128,5 +148,12 @@ namespace CodeImp.DoomBuilder.Interface
}
#endregion
#region ================== File Menu
// New map clicked
private void itemnewmap_Click(object sender, EventArgs e) { General.NewMap(); }
#endregion
}
}

View file

@ -117,15 +117,33 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menumain.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menumain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>121, 17</value>
</metadata>
<metadata name="statusbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="statusbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>207, 17</value>
</metadata>
<metadata name="panelinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="display.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View file

@ -0,0 +1,224 @@
namespace CodeImp.DoomBuilder.Interface
{
partial class MapOptionsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.GroupBox groupBox1;
System.Windows.Forms.Label label3;
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label1;
System.Windows.Forms.GroupBox groupBox2;
this.levelname = new System.Windows.Forms.TextBox();
this.config = new System.Windows.Forms.ComboBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.addresource = new System.Windows.Forms.Button();
this.resources = new System.Windows.Forms.ListBox();
this.apply = new System.Windows.Forms.Button();
this.cancel = new System.Windows.Forms.Button();
groupBox1 = new System.Windows.Forms.GroupBox();
label3 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
groupBox2 = new System.Windows.Forms.GroupBox();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
groupBox1.Controls.Add(label3);
groupBox1.Controls.Add(this.levelname);
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(this.config);
groupBox1.Controls.Add(label1);
groupBox1.Location = new System.Drawing.Point(12, 12);
groupBox1.Name = "groupBox1";
groupBox1.Size = new System.Drawing.Size(365, 118);
groupBox1.TabIndex = 10;
groupBox1.TabStop = false;
groupBox1.Text = " Settings ";
//
// label3
//
label3.AutoSize = true;
label3.Location = new System.Drawing.Point(239, 76);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(90, 14);
label3.TabIndex = 9;
label3.Text = "example: MAP01";
//
// levelname
//
this.levelname.Location = new System.Drawing.Point(129, 73);
this.levelname.Name = "levelname";
this.levelname.Size = new System.Drawing.Size(94, 20);
this.levelname.TabIndex = 8;
//
// label2
//
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(58, 76);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(65, 14);
label2.TabIndex = 7;
label2.Text = "Level name:";
//
// config
//
this.config.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.config.FormattingEnabled = true;
this.config.Location = new System.Drawing.Point(129, 31);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.TabIndex = 6;
//
// label1
//
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(18, 34);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(105, 14);
label1.TabIndex = 5;
label1.Text = "Game Configuration:";
//
// groupBox2
//
groupBox2.Controls.Add(this.button2);
groupBox2.Controls.Add(this.button1);
groupBox2.Controls.Add(this.addresource);
groupBox2.Controls.Add(this.resources);
groupBox2.Location = new System.Drawing.Point(12, 145);
groupBox2.Name = "groupBox2";
groupBox2.Size = new System.Drawing.Size(365, 165);
groupBox2.TabIndex = 11;
groupBox2.TabStop = false;
groupBox2.Text = " Custom Resources ";
//
// button2
//
this.button2.Location = new System.Drawing.Point(268, 125);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(74, 25);
this.button2.TabIndex = 13;
this.button2.Text = "Remove";
this.button2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(139, 125);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(123, 25);
this.button1.TabIndex = 12;
this.button1.Text = "Resource Options...";
this.button1.UseVisualStyleBackColor = true;
//
// 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;
//
// 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;
//
// apply
//
this.apply.Location = new System.Drawing.Point(147, 330);
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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(265, 330);
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);
//
// MapOptionsForm
//
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, 367);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(groupBox2);
this.Controls.Add(groupBox1);
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 = "MapOptionsForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Map Options";
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox levelname;
private System.Windows.Forms.ComboBox config;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button addresource;
private System.Windows.Forms.ListBox resources;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.Button cancel;
}
}

View file

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Interface
{
internal partial class MapOptionsForm : Form
{
// Variables
private MapOptions options;
// Properties
public MapOptions Options { get { return options; } }
// Constructor
public MapOptionsForm(MapOptions options)
{
// Initialize
InitializeComponent();
// Keep settings
this.options = options;
// 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);
// Is this configuration currently selected?
if(string.Compare(General.Configs[i].filename, options.ConfigFile, true) == 0)
{
// Select this item
config.SelectedIndex = config.Items.Count - 1;
}
}
// Set the level name
levelname.Text = options.CurrentName;
// Fill the resources list
foreach(ResourceLocation res in options.Resources)
resources.Items.Add(res);
}
// 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);
return;
}
// Level name empty?
if(levelname.Text.Length == 0)
{
// Enter a level name!
MessageBox.Show(this, "Please enter a level name for your map.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
// Apply changes
options.ClearResources();
options.ConfigFile = General.Configs[config.SelectedIndex].filename;
options.CurrentName = levelname.Text.Trim().ToUpper();
foreach(ResourceLocation res in resources.Items) options.AddResource(res);
// Hide window
this.DialogResult = DialogResult.OK;
this.Hide();
}
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
// Just hide window
this.DialogResult = DialogResult.Cancel;
this.Hide();
}
}
}

View file

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="levelname.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="config.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupBox2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="button2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="button1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="addresource.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="resources.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -0,0 +1,235 @@
namespace CodeImp.DoomBuilder.Interface
{
partial class ResourceOptionsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.Label label1;
System.Windows.Forms.Label label2;
this.tabs = new System.Windows.Forms.TabControl();
this.wadfiletab = new System.Windows.Forms.TabPage();
this.browsewad = new System.Windows.Forms.Button();
this.wadlocation = new System.Windows.Forms.TextBox();
this.directorytab = new System.Windows.Forms.TabPage();
this.dir_flats = new System.Windows.Forms.CheckBox();
this.dir_textures = new System.Windows.Forms.CheckBox();
this.browsedir = new System.Windows.Forms.Button();
this.dirlocation = new System.Windows.Forms.TextBox();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
label1 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
this.tabs.SuspendLayout();
this.wadfiletab.SuspendLayout();
this.directorytab.SuspendLayout();
this.SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(15, 20);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(104, 14);
label1.TabIndex = 0;
label1.Text = "WAD File Resource:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(15, 75);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(104, 14);
label2.TabIndex = 3;
label2.Text = "Directory Resource:";
//
// tabs
//
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabs.Controls.Add(this.wadfiletab);
this.tabs.Controls.Add(this.directorytab);
this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabs.ItemSize = new System.Drawing.Size(110, 19);
this.tabs.Location = new System.Drawing.Point(12, 12);
this.tabs.Name = "tabs";
this.tabs.SelectedIndex = 0;
this.tabs.Size = new System.Drawing.Size(353, 161);
this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabs.TabIndex = 0;
//
// wadfiletab
//
this.wadfiletab.Controls.Add(this.browsewad);
this.wadfiletab.Controls.Add(this.wadlocation);
this.wadfiletab.Controls.Add(label1);
this.wadfiletab.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.wadfiletab.Location = new System.Drawing.Point(4, 23);
this.wadfiletab.Name = "wadfiletab";
this.wadfiletab.Padding = new System.Windows.Forms.Padding(3);
this.wadfiletab.Size = new System.Drawing.Size(345, 134);
this.wadfiletab.TabIndex = 0;
this.wadfiletab.Text = "From WAD File";
this.wadfiletab.UseVisualStyleBackColor = true;
//
// browsewad
//
this.browsewad.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browsewad.Location = new System.Drawing.Point(296, 36);
this.browsewad.Name = "browsewad";
this.browsewad.Size = new System.Drawing.Size(30, 23);
this.browsewad.TabIndex = 2;
this.browsewad.Text = "...";
this.browsewad.UseVisualStyleBackColor = true;
//
// wadlocation
//
this.wadlocation.Location = new System.Drawing.Point(17, 37);
this.wadlocation.Name = "wadlocation";
this.wadlocation.ReadOnly = true;
this.wadlocation.Size = new System.Drawing.Size(273, 20);
this.wadlocation.TabIndex = 1;
//
// directorytab
//
this.directorytab.Controls.Add(this.dir_flats);
this.directorytab.Controls.Add(this.dir_textures);
this.directorytab.Controls.Add(this.browsedir);
this.directorytab.Controls.Add(this.dirlocation);
this.directorytab.Controls.Add(label2);
this.directorytab.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.directorytab.Location = new System.Drawing.Point(4, 23);
this.directorytab.Name = "directorytab";
this.directorytab.Padding = new System.Windows.Forms.Padding(3);
this.directorytab.Size = new System.Drawing.Size(345, 134);
this.directorytab.TabIndex = 1;
this.directorytab.Text = "From Directory";
this.directorytab.UseVisualStyleBackColor = true;
//
// dir_flats
//
this.dir_flats.AutoSize = true;
this.dir_flats.Location = new System.Drawing.Point(17, 45);
this.dir_flats.Name = "dir_flats";
this.dir_flats.Size = new System.Drawing.Size(126, 18);
this.dir_flats.TabIndex = 7;
this.dir_flats.Text = "Load images as flats";
this.dir_flats.UseVisualStyleBackColor = true;
//
// dir_textures
//
this.dir_textures.AutoSize = true;
this.dir_textures.Location = new System.Drawing.Point(17, 21);
this.dir_textures.Name = "dir_textures";
this.dir_textures.Size = new System.Drawing.Size(145, 18);
this.dir_textures.TabIndex = 6;
this.dir_textures.Text = "Load images as textures";
this.dir_textures.UseVisualStyleBackColor = true;
//
// browsedir
//
this.browsedir.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browsedir.Location = new System.Drawing.Point(296, 91);
this.browsedir.Name = "browsedir";
this.browsedir.Size = new System.Drawing.Size(30, 23);
this.browsedir.TabIndex = 5;
this.browsedir.Text = "...";
this.browsedir.UseVisualStyleBackColor = true;
//
// dirlocation
//
this.dirlocation.BackColor = System.Drawing.SystemColors.Control;
this.dirlocation.Location = new System.Drawing.Point(17, 92);
this.dirlocation.Name = "dirlocation";
this.dirlocation.ReadOnly = true;
this.dirlocation.Size = new System.Drawing.Size(273, 20);
this.dirlocation.TabIndex = 4;
//
// cancel
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.Location = new System.Drawing.Point(253, 189);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 15;
this.cancel.Text = "Cancel";
this.cancel.UseVisualStyleBackColor = true;
this.cancel.Click += new System.EventHandler(this.cancel_Click);
//
// 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(135, 189);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 14;
this.apply.Text = "OK";
this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click);
//
// ResourceOptionsForm
//
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(377, 226);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(this.tabs);
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 = "ResourceOptionsForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Resource Options";
this.tabs.ResumeLayout(false);
this.wadfiletab.ResumeLayout(false);
this.wadfiletab.PerformLayout();
this.directorytab.ResumeLayout(false);
this.directorytab.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabs;
private System.Windows.Forms.TabPage wadfiletab;
private System.Windows.Forms.TabPage directorytab;
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.Button apply;
private System.Windows.Forms.TextBox wadlocation;
private System.Windows.Forms.Button browsewad;
private System.Windows.Forms.Button browsedir;
private System.Windows.Forms.TextBox dirlocation;
private System.Windows.Forms.CheckBox dir_flats;
private System.Windows.Forms.CheckBox dir_textures;
}
}

View file

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using System.IO;
namespace CodeImp.DoomBuilder.Interface
{
internal partial class ResourceOptionsForm : Form
{
// Variables
private ResourceLocation res;
// Properties
public ResourceLocation ResourceLocation { get { return res; } }
// Constructor
public ResourceOptionsForm(ResourceLocation settings)
{
// Initialize
InitializeComponent();
// Apply settings from ResourceLocation
this.res = settings;
switch(res.type)
{
// Setup for WAD File
case ResourceLocation.RESOURCE_WAD:
wadfiletab.Select();
wadlocation.Text = res.location;
break;
// Setup for Directory
case ResourceLocation.RESOURCE_DIRECTORY:
directorytab.Select();
dirlocation.Text = res.location;
dir_textures.Checked = res.textures;
dir_flats.Checked = res.flats;
break;
}
}
// OK clicked
private void apply_Click(object sender, EventArgs e)
{
// Apply settings to ResourceLocation
switch(tabs.SelectedIndex)
{
// Setup WAD File
case ResourceLocation.RESOURCE_WAD:
// Check if directory is specified
if((wadlocation.Text.Length == 0) ||
(!File.Exists(wadlocation.Text)))
{
// No valid wad file specified
MessageBox.Show(this, "Please select a valid WAD File resource.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
// Apply settings
res.type = ResourceLocation.RESOURCE_WAD;
res.location = wadlocation.Text;
res.textures = false;
res.flats = false;
// Done
this.DialogResult = DialogResult.OK;
this.Hide();
}
break;
// Setup Directory
case ResourceLocation.RESOURCE_DIRECTORY:
// Check if directory is specified
if((dirlocation.Text.Length == 0) ||
(!Directory.Exists(dirlocation.Text)))
{
// No valid directory specified
MessageBox.Show(this, "Please select a valid directory resource.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
// At least one of the checkboxes must be checked
else if(!dir_flats.Checked && !dir_textures.Checked)
{
// Must select one of the checkboxes
MessageBox.Show(this, "Please choose to load the images as texture or flats, or both.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
// Apply settings
res.type = ResourceLocation.RESOURCE_WAD;
res.location = dirlocation.Text;
res.textures = dir_textures.Checked;
res.flats = dir_flats.Checked;
// Done
this.DialogResult = DialogResult.OK;
this.Hide();
}
break;
}
}
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
// Just hide
this.DialogResult = DialogResult.Cancel;
this.Hide();
}
}
}

View file

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tabs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="wadfiletab.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="browsewad.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="wadlocation.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="directorytab.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dir_flats.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dir_textures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="browsedir.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dirlocation.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class Linedef : IDisposable

134
Source/Map/MapOptions.cs Normal file
View file

@ -0,0 +1,134 @@
#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;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.IO;
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class MapOptions
{
#region ================== Constants
#endregion
#region ================== Variables
// Game configuration
private string configfile;
// Map header name
private string currentname;
private string previousname;
// Additional resources
private List<ResourceLocation> resources;
#endregion
#region ================== Properties
public string ConfigFile { get { return configfile; } set { configfile = value; } }
public ICollection<ResourceLocation> Resources { get { return resources; } }
public string PreviousName { get { return previousname; } }
public string CurrentName
{
get { return currentname; }
set
{
// Change the name, but keep previous name
if(currentname != value)
{
if(previousname == "") previousname = currentname;
currentname = value;
}
}
}
#endregion
#region ================== Constructor / Disposer
// Constructor
public MapOptions()
{
// Initialize
this.previousname = "";
this.currentname = "";
this.configfile = "";
this.resources = new List<ResourceLocation>();
}
~MapOptions()
{
// Clean up
this.resources = null;
}
#endregion
#region ================== Methods
// This adds a resource location and returns the index where the item was added
public int AddResource(ResourceLocation res)
{
// Get a fully qualified path
res.location = Path.GetFullPath(res.location);
// Go for all items in the list
for(int i = 0; i < resources.Count; i++)
{
// Check if location is already added
if(Path.GetFullPath(resources[i].location) == res.location)
{
// Update the item in the list
resources[i] = res;
return i;
}
}
// Add to list
resources.Add(res);
return resources.Count - 1;
}
// This clears all reasource
public void ClearResources()
{
// Clear list
resources.Clear();
}
// This removes a resource by index
public void RemoveResource(int index)
{
// Remove the item
resources.RemoveAt(index);
}
#endregion
}
}

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class MapSet : IDisposable

View file

@ -0,0 +1,58 @@
#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;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal struct ResourceLocation
{
// Constants
public const int RESOURCE_WAD = 0;
public const int RESOURCE_DIRECTORY = 1;
// Members
public int type;
public string location;
public bool textures;
public bool flats;
// Constructor
public ResourceLocation(int type, string location, bool textures, bool flats)
{
// Initialize
this.type = type;
this.location = location;
this.textures = textures;
this.flats = flats;
}
// This displays the struct as string
public override string ToString()
{
// Simply show location
return location;
}
}
}

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class Sector : IDisposable

View file

@ -1,4 +1,6 @@
#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
@ -10,12 +12,18 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class Sidedef : IDisposable

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class Thing : IDisposable

View file

@ -1,4 +1,6 @@
#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
@ -10,6 +12,10 @@
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
@ -17,6 +23,8 @@ using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.Map
{
internal class Vertex : IDisposable