much more

This commit is contained in:
codeimp 2007-10-14 21:31:45 +00:00
parent 6250543976
commit e45ab9fff5
28 changed files with 515 additions and 80 deletions

BIN
Resources/Icons/NewMap2.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Resources/Icons/NewMap2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

View file

@ -194,6 +194,8 @@
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Builder.ico" />
<None Include="Resources\Properties.png" />
<None Include="Resources\NewMap2.png" />
<None Include="Resources\Zoom.png" />
<None Include="Resources\SaveMap.png" />
<None Include="Resources\OpenMap.png" />

View file

@ -45,6 +45,8 @@ namespace CodeImp.DoomBuilder.Controls
public const string ZOOMOUT = "zoomout";
public const string CONFIGURATION = "configuration";
public const string PREFERENCES = "preferences";
public const string MAPOPTIONS = "mapoptions";
public const string RELOADRESOURCES = "reloadresources";
#endregion

View file

@ -26,7 +26,7 @@ using System.Text;
namespace CodeImp.DoomBuilder.Data
{
internal struct DataLocation
internal struct DataLocation : IComparable<DataLocation>, IComparable, IEquatable<DataLocation>
{
// Constants
public const int RESOURCE_WAD = 0;
@ -54,5 +54,23 @@ namespace CodeImp.DoomBuilder.Data
// Simply show location
return location;
}
// This compares two locations
public int CompareTo(DataLocation other)
{
return string.Compare(this.location, other.location, true);
}
// This compares two locations
public int CompareTo(object obj)
{
return string.Compare(this.location, ((DataLocation)obj).location, true);
}
// This compares two locations
public bool Equals(DataLocation other)
{
return (this.CompareTo(other) == 0);
}
}
}

View file

@ -25,6 +25,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using CodeImp.DoomBuilder.IO;
using System.Windows.Forms;
#endregion
@ -127,21 +128,30 @@ namespace CodeImp.DoomBuilder.Data
// TODO: Make this work more elegant using reflection.
// Make DataLocation.type of type Type and assign the
// types of the desired reader classes.
// Choose container type
switch(dl.type)
{
// WAD file container
case DataLocation.RESOURCE_WAD:
c = new WADReader(dl);
break;
// Directory container
case DataLocation.RESOURCE_DIRECTORY:
c = new DirectoryReader(dl);
break;
}
try
{
// Choose container type
switch(dl.type)
{
// WAD file container
case DataLocation.RESOURCE_WAD:
c = new WADReader(dl);
break;
// Directory container
case DataLocation.RESOURCE_DIRECTORY:
c = new DirectoryReader(dl);
break;
}
}
catch(Exception)
{
// Unable to load resource
General.ShowErrorMessage("Unable to load resources from location \"" + dl.location + "\". Please make sure the location is accessible and not in use by another program.", MessageBoxButtons.OK);
continue;
}
// Add container
if(c != null) containers.Add(c);
}
@ -189,9 +199,17 @@ namespace CodeImp.DoomBuilder.Data
// Go for all containers
foreach(DataReader d in containers)
{
// Resume
General.WriteLogLine("Resumed data resource '" + d.Location.location + "'");
d.Resume();
try
{
// Resume
General.WriteLogLine("Resumed data resource '" + d.Location.location + "'");
d.Resume();
}
catch(Exception)
{
// Unable to load resource
General.ShowErrorMessage("Unable to load resources from location \"" + d.Location.location + "\". Please make sure the location is accessible and not in use by another program.", MessageBoxButtons.OK);
}
}
}

View file

@ -410,7 +410,7 @@ namespace CodeImp.DoomBuilder
// Create main window
General.WriteLogLine("Loading main interface window...");
mainwindow = new MainForm();
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
// Show main window
General.WriteLogLine("Showing main interface window...");
@ -579,7 +579,7 @@ namespace CodeImp.DoomBuilder
}
// All done
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
Cursor.Current = Cursors.Default;
}
@ -607,7 +607,7 @@ namespace CodeImp.DoomBuilder
// Done
Cursor.Current = Cursors.Default;
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
General.WriteLogLine("Map unload done");
}
@ -677,7 +677,7 @@ namespace CodeImp.DoomBuilder
}
// All done
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
Cursor.Current = Cursors.Default;
}
@ -704,7 +704,7 @@ namespace CodeImp.DoomBuilder
map.SaveMap(map.FilePathName, MapManager.SAVE_NORMAL);
// All done
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
Cursor.Current = Cursors.Default;
}
@ -734,7 +734,7 @@ namespace CodeImp.DoomBuilder
map.SaveMap(savefile.FileName, MapManager.SAVE_AS);
// All done
mainwindow.UpdateMenus();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
Cursor.Current = Cursors.Default;
}
@ -820,6 +820,12 @@ namespace CodeImp.DoomBuilder
// This shows a message and logs the message
public static DialogResult ShowWarningMessage(string message, MessageBoxButtons buttons)
{
return ShowWarningMessage(message, buttons, MessageBoxDefaultButton.Button1);
}
// This shows a message and logs the message
public static DialogResult ShowWarningMessage(string message, MessageBoxButtons buttons, MessageBoxDefaultButton defaultbutton)
{
Cursor oldcursor;
DialogResult result;
@ -832,7 +838,7 @@ namespace CodeImp.DoomBuilder
Cursor.Current = Cursors.Default;
// Show message
result = MessageBox.Show(Form.ActiveForm, message, Application.ProductName, buttons, MessageBoxIcon.Warning);
result = MessageBox.Show(Form.ActiveForm, message, Application.ProductName, buttons, MessageBoxIcon.Warning, defaultbutton);
// Restore old cursor
Cursor.Current = oldcursor;

View file

@ -31,6 +31,7 @@ using CodeImp.DoomBuilder.Editing;
using System.Diagnostics;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Controls;
#endregion
@ -86,7 +87,7 @@ namespace CodeImp.DoomBuilder
public MapSet Map { get { return map; } }
public EditMode Mode { get { return mode; } }
public DataManager Data { get { return data; } }
public bool IsChanged { get { return changed; } set { changed = value; } }
public bool IsChanged { get { return changed; } set { changed |= value; } }
public bool IsDisposed { get { return isdisposed; } }
public D3DGraphics Graphics { get { return graphics; } }
public Configuration Configuration { get { return config; } }
@ -108,6 +109,9 @@ namespace CodeImp.DoomBuilder
// Not already disposed?
if(!isdisposed)
{
// Unbind any methods
ActionAttribute.UnbindMethods(this);
// Dispose
General.WriteLogLine("Unloading data resources...");
data.Dispose();
@ -193,6 +197,9 @@ namespace CodeImp.DoomBuilder
data = new DataManager();
data.Load(configinfo.Resources, options.Resources);
// Bind any methods
ActionAttribute.BindMethods(this);
// Set default mode
ChangeMode(typeof(FrozenOverviewMode));
@ -267,7 +274,10 @@ namespace CodeImp.DoomBuilder
data = new DataManager();
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
// Bind any methods
ActionAttribute.BindMethods(this);
// Set default mode
ChangeMode(typeof(FrozenOverviewMode));
@ -284,7 +294,8 @@ namespace CodeImp.DoomBuilder
public bool SaveMap(string newfilepathname, int savemode)
{
MapSet outputset;
string nodebuildername, oldstatus;
string nodebuildername, oldstatus, settingsfile;
Configuration mapsettings;
WAD targetwad;
int index;
bool includenodes;
@ -339,6 +350,10 @@ namespace CodeImp.DoomBuilder
{
// Kill target file
if(File.Exists(newfilepathname)) File.Delete(newfilepathname);
// Kill .dbs settings file
settingsfile = newfilepathname.Substring(0, newfilepathname.Length - 4) + ".dbs";
if(File.Exists(settingsfile)) File.Delete(settingsfile);
}
// On Save AS we have to copy the previous file to the new file
@ -383,11 +398,46 @@ namespace CodeImp.DoomBuilder
// Resume data resources
data.Resume();
try
{
// Open or create the map settings
settingsfile = newfilepathname.Substring(0, newfilepathname.Length - 4) + ".dbs";
if(File.Exists(settingsfile))
mapsettings = new Configuration(settingsfile, true);
else
mapsettings = new Configuration(true);
// Write settings
mapsettings.WriteSetting("type", "Doom Builder Map Settings Configuration");
mapsettings.WriteSetting("gameconfig", options.ConfigFile);
options.Resources.WriteToConfig(mapsettings, "maps." + options.CurrentName + ".resources");
// Save settings
mapsettings.SaveConfiguration(settingsfile);
}
catch(Exception e)
{
// Warning only
General.WriteLogLine("WARNING: " + e.GetType().Name + ": " + e.Message);
General.WriteLogLine("WARNING: Could not write the map settings configuration file!");
}
// Was the map saved in a different file? And not for testing purpose?
if((savemode != SAVE_TEST) && (newfilepathname != filepathname))
{
// Keep new filename
filepathname = newfilepathname;
filetitle = Path.GetFileName(filepathname);
// Changes saved
changed = false;
// Reload resources
ReloadResources();
}
// Success!
General.WriteLogLine("Map saving done");
filepathname = newfilepathname;
filetitle = Path.GetFileName(filepathname);
changed = false;
return true;
}
@ -717,6 +767,58 @@ namespace CodeImp.DoomBuilder
#region ================== Methods
// This reloads resources
[Action(Action.RELOADRESOURCES)]
public void ReloadResources()
{
DataLocation maplocation;
string oldstatus;
Cursor oldcursor;
// Keep old display info
oldstatus = General.MainWindow.GetCurrentSatus();
oldcursor = Cursor.Current;
// Show status
General.MainWindow.DisplayStatus("Reloading data resources...");
Cursor.Current = Cursors.WaitCursor;
// Reload game configuration
General.WriteLogLine("Reloading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = General.LoadGameConfiguration(options.ConfigFile);
// Reload data resources
General.WriteLogLine("Reloading data resources...");
data.Dispose();
data = new DataManager();
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
// Reset status
General.MainWindow.DisplayStatus(oldstatus);
Cursor.Current = oldcursor;
}
// Game Configuration action
[Action(Action.MAPOPTIONS)]
public void ShowMapOptions()
{
// Show map options dialog
MapOptionsForm optionsform = new MapOptionsForm(options);
if(optionsform.ShowDialog(General.MainWindow) == DialogResult.OK)
{
// Update interface
General.MainWindow.UpdateInterface();
// Reload resources
ReloadResources();
}
// Done
optionsform.Dispose();
}
// This changes editing mode
public void ChangeMode(Type modetype, params object[] args)
{

View file

@ -114,8 +114,8 @@ namespace CodeImp.DoomBuilder
{
ProcessStartInfo processinfo;
Process process;
string args, message;
TimeSpan deltatime;
string args;
try
{
@ -126,7 +126,7 @@ namespace CodeImp.DoomBuilder
catch(Exception e)
{
// Unable to copy files
General.ShowErrorMessage("Unable to copy the required files for the compiler (" + compiler.Name + ") . " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
General.ShowErrorMessage("Unable to copy the required files for the compiler (" + compiler.Name + "). " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
return false;
}

View file

@ -255,8 +255,8 @@ namespace CodeImp.DoomBuilder.IO
if(!isreadonly)
{
// Flush writing changes
writer.Flush();
file.Flush();
if(writer != null) writer.Flush();
if(file != null) file.Flush();
}
}

View file

@ -259,7 +259,7 @@ namespace CodeImp.DoomBuilder.Interface
// Close
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
// Cancel clicked
@ -267,7 +267,7 @@ namespace CodeImp.DoomBuilder.Interface
{
// Close
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
}
// Browse clicked

View file

@ -34,6 +34,7 @@ namespace CodeImp.DoomBuilder.Interface
System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.menumain = new System.Windows.Forms.MenuStrip();
this.menufile = new System.Windows.Forms.ToolStripMenuItem();
@ -45,6 +46,8 @@ namespace CodeImp.DoomBuilder.Interface
this.itemsavemapinto = new System.Windows.Forms.ToolStripMenuItem();
this.itemnorecent = new System.Windows.Forms.ToolStripMenuItem();
this.itemexit = new System.Windows.Forms.ToolStripMenuItem();
this.menuedit = new System.Windows.Forms.ToolStripMenuItem();
this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem();
this.menutools = new System.Windows.Forms.ToolStripMenuItem();
this.configurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -54,6 +57,8 @@ namespace CodeImp.DoomBuilder.Interface
this.buttonnewmap = new System.Windows.Forms.ToolStripButton();
this.buttonopenmap = new System.Windows.Forms.ToolStripButton();
this.buttonsavemap = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.buttonmapoptions = new System.Windows.Forms.ToolStripButton();
this.statusbar = new System.Windows.Forms.StatusStrip();
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
this.zoomlabel = new System.Windows.Forms.ToolStripStatusLabel();
@ -71,11 +76,13 @@ namespace CodeImp.DoomBuilder.Interface
this.panelinfo = new System.Windows.Forms.Panel();
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
this.display = new System.Windows.Forms.Panel();
this.itemreloadresources = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.menumain.SuspendLayout();
this.toolbar.SuspendLayout();
this.statusbar.SuspendLayout();
@ -112,6 +119,7 @@ namespace CodeImp.DoomBuilder.Interface
//
this.menumain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menufile,
this.menuedit,
this.menutools,
this.menuhelp});
this.menumain.Location = new System.Drawing.Point(0, 0);
@ -140,7 +148,7 @@ namespace CodeImp.DoomBuilder.Interface
//
// itemnewmap
//
this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.NewMap;
this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.File;
this.itemnewmap.Name = "itemnewmap";
this.itemnewmap.ShortcutKeyDisplayString = "";
this.itemnewmap.Size = new System.Drawing.Size(201, 22);
@ -203,9 +211,28 @@ namespace CodeImp.DoomBuilder.Interface
this.itemexit.Text = "Exit";
this.itemexit.Click += new System.EventHandler(this.itemexit_Click);
//
// menuedit
//
this.menuedit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.itemmapoptions});
this.menuedit.Name = "menuedit";
this.menuedit.Size = new System.Drawing.Size(37, 20);
this.menuedit.Text = "Edit";
//
// itemmapoptions
//
this.itemmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties;
this.itemmapoptions.Name = "itemmapoptions";
this.itemmapoptions.Size = new System.Drawing.Size(161, 22);
this.itemmapoptions.Tag = "mapoptions";
this.itemmapoptions.Text = "Map Options....";
this.itemmapoptions.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// menutools
//
this.menutools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.itemreloadresources,
toolStripSeparator4,
this.configurationToolStripMenuItem,
this.preferencesToolStripMenuItem});
this.menutools.Name = "menutools";
@ -249,7 +276,9 @@ namespace CodeImp.DoomBuilder.Interface
this.toolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.buttonnewmap,
this.buttonopenmap,
this.buttonsavemap});
this.buttonsavemap,
this.toolStripSeparator3,
this.buttonmapoptions});
this.toolbar.Location = new System.Drawing.Point(0, 24);
this.toolbar.Name = "toolbar";
this.toolbar.Size = new System.Drawing.Size(731, 25);
@ -289,6 +318,23 @@ namespace CodeImp.DoomBuilder.Interface
this.buttonsavemap.Text = "Save Map";
this.buttonsavemap.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// buttonmapoptions
//
this.buttonmapoptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttonmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties;
this.buttonmapoptions.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttonmapoptions.Name = "buttonmapoptions";
this.buttonmapoptions.Size = new System.Drawing.Size(23, 22);
this.buttonmapoptions.Tag = "mapoptions";
this.buttonmapoptions.Text = "Map Options";
this.buttonmapoptions.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// statusbar
//
this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -453,6 +499,19 @@ namespace CodeImp.DoomBuilder.Interface
this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter);
this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
//
// itemreloadresources
//
this.itemreloadresources.Name = "itemreloadresources";
this.itemreloadresources.Size = new System.Drawing.Size(197, 22);
this.itemreloadresources.Tag = "reloadresources";
this.itemreloadresources.Text = "Reload Resources";
this.itemreloadresources.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripSeparator4
//
toolStripSeparator4.Name = "toolStripSeparator4";
toolStripSeparator4.Size = new System.Drawing.Size(194, 6);
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -525,5 +584,10 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.ToolStripMenuItem menutools;
private System.Windows.Forms.ToolStripMenuItem configurationToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem menuedit;
private System.Windows.Forms.ToolStripMenuItem itemmapoptions;
private System.Windows.Forms.ToolStripButton buttonmapoptions;
private System.Windows.Forms.ToolStripMenuItem itemreloadresources;
}
}

View file

@ -94,6 +94,37 @@ namespace CodeImp.DoomBuilder.Interface
lastsize = this.Size;
}
#endregion
#region ================== General
// This updates all menus for the current status
public void UpdateInterface()
{
// Map opened?
if(General.Map != null)
{
// Show map name and filename in caption
this.Text = General.Map.FileTitle + " (" + General.Map.Options.CurrentName + ") - " + Application.ProductName;
}
else
{
// Show normal caption
this.Text = Application.ProductName;
}
// Update menus and toolbar icons
UpdateFileMenu();
UpdateEditMenu();
UpdateToolsMenu();
}
// Generic event that invokes the tagged action
private void InvokeTaggedAction(object sender, EventArgs e)
{
General.Actions[(sender as ToolStripItem).Tag.ToString()].Invoke();
}
#endregion
#region ================== Window
@ -472,19 +503,6 @@ namespace CodeImp.DoomBuilder.Interface
}
}
}
// This updates all menus for the current status
public void UpdateMenus()
{
// Update them all
UpdateFileMenu();
}
// Generic event that invokes the tagged action
private void InvokeTaggedAction(object sender, EventArgs e)
{
General.Actions[(sender as ToolStripItem).Tag.ToString()].Invoke();
}
#endregion
@ -631,13 +649,29 @@ namespace CodeImp.DoomBuilder.Interface
private void itemexit_Click(object sender, EventArgs e) { this.Close(); }
// Recent item clicked
void recentitem_Click(object sender, EventArgs e)
private void recentitem_Click(object sender, EventArgs e)
{
// Get the item that was clicked
ToolStripItem item = (sender as ToolStripItem);
// Open this file
General.OpenMapFile(item.Text);
General.OpenMapFile(item.Tag.ToString());
}
#endregion
#region ================== Edit Menu
// This sets up the edit menu
private void UpdateEditMenu()
{
// No edit menu when no map open
menuedit.Enabled = (General.Map != null);
// Enable/disable items
// Toolbar icons
buttonmapoptions.Enabled = (General.Map != null);
}
#endregion
@ -658,6 +692,15 @@ namespace CodeImp.DoomBuilder.Interface
#region ================== Tools Menu
// This sets up the tools menu
private void UpdateToolsMenu()
{
// Enable/disable items
itemreloadresources.Enabled = (General.Map != null);
// Toolbar icons
}
// Game Configuration action
[Action(Action.CONFIGURATION)]
public void ShowConfiguration()
@ -666,7 +709,11 @@ namespace CodeImp.DoomBuilder.Interface
ConfigForm cfgform = new ConfigForm();
if(cfgform.ShowDialog(this) == DialogResult.OK)
{
// TODO: Reload resources if a map is open
// Update interface
UpdateInterface();
// Reload resources if a map is open
if(General.Map != null) General.Map.ReloadResources();
}
// Done

View file

@ -138,6 +138,9 @@
<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="toolStripSeparator4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="toolbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -93,6 +93,7 @@ namespace CodeImp.DoomBuilder.Interface
//
// levelname
//
this.levelname.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.levelname.Location = new System.Drawing.Point(129, 73);
this.levelname.Name = "levelname";
this.levelname.Size = new System.Drawing.Size(94, 20);
@ -105,7 +106,6 @@ namespace CodeImp.DoomBuilder.Interface
this.config.Location = new System.Drawing.Point(129, 31);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.Sorted = true;
this.config.TabIndex = 6;
this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
//

View file

@ -24,6 +24,8 @@ using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.IO;
using System.IO;
#endregion
@ -72,6 +74,11 @@ namespace CodeImp.DoomBuilder.Interface
// OK clicked
private void apply_Click(object sender, EventArgs e)
{
Configuration newcfg;
string oldio, newio;
WAD sourcewad;
bool conflictingname;
// Configuration selected?
if(config.SelectedIndex == -1)
{
@ -90,6 +97,56 @@ namespace CodeImp.DoomBuilder.Interface
return;
}
// Level name changed and the map exists in a source wad?
if((levelname.Text != options.CurrentName) &&
(General.Map.FilePathName != "") && File.Exists(General.Map.FilePathName))
{
// Open the source wad file to check for conflicting name
sourcewad = new WAD(General.Map.FilePathName, true);
conflictingname = (sourcewad.FindLumpIndex(levelname.Text) > -1);
sourcewad.Dispose();
// Names conflict?
if(conflictingname)
{
// Show warning!
if(General.ShowWarningMessage("The map name \"" + levelname.Text + "\" is already in use by another map or data lump in the source WAD file. Saving your map with this name will cause conflicting data lumps in the WAD file. Do you want to continue?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
return;
}
}
}
// Configuration changed?
if(General.Configs[config.SelectedIndex].Filename != options.ConfigFile)
{
// Load the new cfg file
newcfg = General.LoadGameConfiguration(General.Configs[config.SelectedIndex].Filename);
if(newcfg == null) return;
// Check if the config uses a different IO interface
oldio = General.Map.Configuration.ReadSetting("formatinterface", "");
newio = newcfg.ReadSetting("formatinterface", "");
if(oldio != newio)
{
// Warn the user about IO interface change
if(General.ShowWarningMessage("The game configuration you selected uses a different file format than your current map. Because your map was not designed for this format it may cause the map to work incorrectly in the game. Do you want to continue?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2) == DialogResult.No)
{
// Reset to old configuration
for(int i = 0; i < config.Items.Count; i++)
{
// Is this configuration the old config?
if(string.Compare(General.Configs[i].Filename, options.ConfigFile, true) == 0)
{
// Select this item
config.SelectedIndex = i;
}
}
return;
}
}
}
// Apply changes
options.ClearResources();
options.ConfigFile = General.Configs[config.SelectedIndex].Filename;
@ -98,7 +155,7 @@ namespace CodeImp.DoomBuilder.Interface
// Hide window
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
// Cancel clicked
@ -106,7 +163,7 @@ namespace CodeImp.DoomBuilder.Interface
{
// Just hide window
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
}
// Game configuration chosen

View file

@ -127,7 +127,6 @@ namespace CodeImp.DoomBuilder.Interface
this.config.Location = new System.Drawing.Point(141, 21);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.Sorted = true;
this.config.TabIndex = 15;
this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
//
@ -151,6 +150,7 @@ namespace CodeImp.DoomBuilder.Interface
this.mapslist.UseCompatibleStateImageBehavior = false;
this.mapslist.View = System.Windows.Forms.View.List;
this.mapslist.DoubleClick += new System.EventHandler(this.mapslist_DoubleClick);
this.mapslist.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.mapslist_ItemSelectionChanged);
//
// OpenMapOptionsForm
//

View file

@ -40,6 +40,7 @@ namespace CodeImp.DoomBuilder.Interface
private MapOptions options;
private WAD wadfile;
private string filepathname;
private string selectedmapname;
// Properties
public string FilePathName { get { return filepathname; } }
@ -70,7 +71,7 @@ namespace CodeImp.DoomBuilder.Interface
// WAD file does not exist
MessageBox.Show(this, "Could not open the WAD file: The file does not exist.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
return;
}
@ -78,13 +79,6 @@ namespace CodeImp.DoomBuilder.Interface
{
// 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)
{
@ -92,9 +86,17 @@ namespace CodeImp.DoomBuilder.Interface
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();
this.Close();
return;
}
// Open the Map Settings configuration
dbsfile = filepathname.Substring(0, filepathname.Length - 4) + ".dbs";
if(File.Exists(dbsfile))
try { mapsettings = new Configuration(dbsfile, true); }
catch(Exception) { mapsettings = new Configuration(true); }
else
mapsettings = new Configuration(true);
// Check what game configuration is preferred
gameconfig = mapsettings.ReadSetting("gameconfig", "");
@ -258,6 +260,7 @@ namespace CodeImp.DoomBuilder.Interface
}
// Clear the list and add the new map names
mapslist.BeginUpdate();
mapslist.Items.Clear();
mapslist.Items.AddRange(mapnames.ToArray());
mapslist.Sort();
@ -273,6 +276,8 @@ namespace CodeImp.DoomBuilder.Interface
break;
}
}
if((mapslist.SelectedItems.Count == 0) && (mapslist.Items.Count > 0)) mapslist.Items[0].Selected = true;
mapslist.EndUpdate();
// Show configuration resources
datalocations.FixedResourceLocationList(ci.Resources);
@ -309,7 +314,7 @@ namespace CodeImp.DoomBuilder.Interface
// Hide window
wadfile.Dispose();
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
// Cancel clicked
@ -318,7 +323,7 @@ namespace CodeImp.DoomBuilder.Interface
// Just hide window
wadfile.Dispose();
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
}
// Window is shown
@ -338,5 +343,47 @@ namespace CodeImp.DoomBuilder.Interface
if(mapslist.SelectedItems.Count > 0) apply.PerformClick();
}
// Map name selected
private void mapslist_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
DataLocationList locations;
DataLocationList listedlocations;
// Map previously selected?
if((selectedmapname != null) && (selectedmapname != ""))
{
// Get locations from previous selected map settings
locations = new DataLocationList(mapsettings, "maps." + selectedmapname + ".resources");
listedlocations = datalocations.GetResources();
// Remove data locations that this map has in its config
foreach(DataLocation dl in locations)
listedlocations.Remove(dl);
// Set new data locations
datalocations.EditResourceLocationList(listedlocations);
// Done
selectedmapname = null;
}
// Anything selected?
if(mapslist.SelectedItems.Count > 0)
{
// Get the map name
selectedmapname = mapslist.SelectedItems[0].Text;
// Get locations from previous selected map settings
locations = new DataLocationList(mapsettings, "maps." + selectedmapname + ".resources");
listedlocations = datalocations.GetResources();
// Add data locations that this map has in its config
foreach(DataLocation dl in locations)
if(!listedlocations.Contains(dl)) listedlocations.Add(dl);
// Set new data locations
datalocations.EditResourceLocationList(listedlocations);
}
}
}
}

View file

@ -120,13 +120,43 @@
<metadata name="columnHeader1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</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="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="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="panelres.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="datalocations.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="config.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mapslist.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

@ -267,7 +267,7 @@ namespace CodeImp.DoomBuilder.Interface
// Close
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
// Cancel clicked
@ -275,7 +275,7 @@ namespace CodeImp.DoomBuilder.Interface
{
// Close
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
}
#endregion

View file

@ -96,7 +96,7 @@ namespace CodeImp.DoomBuilder.Interface
// Done
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
break;
@ -126,7 +126,7 @@ namespace CodeImp.DoomBuilder.Interface
// Done
this.DialogResult = DialogResult.OK;
this.Hide();
this.Close();
}
break;
}
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.Interface
{
// Just hide
this.DialogResult = DialogResult.Cancel;
this.Hide();
this.Close();
}
// Browse WAD File clicked

View file

@ -157,6 +157,7 @@ namespace CodeImp.DoomBuilder.Map
s.floortexname = floortexname;
s.special = special;
s.tag = tag;
s.brightness = brightness;
}
#endregion

View file

@ -60,6 +60,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap File {
get {
object obj = ResourceManager.GetObject("File", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap NewMap {
get {
object obj = ResourceManager.GetObject("NewMap", resourceCulture);
@ -74,6 +81,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Properties {
get {
object obj = ResourceManager.GetObject("Properties", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap SaveMap {
get {
object obj = ResourceManager.GetObject("SaveMap", resourceCulture);

View file

@ -121,19 +121,25 @@
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Splash2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Properties" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -35,7 +35,7 @@ closemap
savemap
{
title = "File: Save Map";
description = "Saves the current map to the opened WAD file.";
description = "Saves the current map to the opened source WAD file.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
@ -59,6 +59,15 @@ savemapinto
allowscroll = false;
}
mapoptions
{
title = "Edit: Map Options";
description = "Shows the map options dialog which allows changing the map lump name, game configuration and custom resources.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}
scrollwest
{
title = "2D: Scroll West";
@ -116,7 +125,7 @@ zoomout
configuration
{
title = "Tools: Game Configurations";
description = "Shows the game configurations dialog.";
description = "Shows the game configurations dialog which allows you to configure settings such as nodebuilder, testing program and resources.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
@ -130,3 +139,12 @@ preferences
allowmouse = false;
allowscroll = false;
}
reloadresources
{
title = "Tools: Reload Resources";
description = "Reloads all data resources such as game configuration, textures and flats. Usefull when resource files have been changed outside of Doom Builder.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B