added stuff and fixed a bug in ZDoom_StrifeHexen.cfg

This commit is contained in:
codeimp 2007-06-14 14:44:18 +00:00
parent e222927480
commit f117185dd9
13 changed files with 217 additions and 3 deletions

Binary file not shown.

BIN
Build/Cmcs21.oca Normal file

Binary file not shown.

View file

@ -2881,7 +2881,6 @@ thingtypes
title = "Stool"; title = "Stool";
width = 6; width = 6;
} }
{
9027 = "Red Particle Fountain"; 9027 = "Red Particle Fountain";
9028 = "Green Particle Fountain"; 9028 = "Green Particle Fountain";

Binary file not shown.

View file

@ -51,6 +51,7 @@
<Compile Include="IO\Configuration.cs" /> <Compile Include="IO\Configuration.cs" />
<Compile Include="General\General.cs" /> <Compile Include="General\General.cs" />
<Compile Include="IO\ClippedStream.cs" /> <Compile Include="IO\ClippedStream.cs" />
<Compile Include="IO\IMapSetIO.cs" />
<Compile Include="IO\Lump.cs" /> <Compile Include="IO\Lump.cs" />
<Compile Include="IO\WAD.cs" /> <Compile Include="IO\WAD.cs" />
<Compile Include="Interface\MainForm.cs"> <Compile Include="Interface\MainForm.cs">
@ -65,6 +66,7 @@
<Compile Include="Map\Sidedef.cs" /> <Compile Include="Map\Sidedef.cs" />
<Compile Include="Map\Thing.cs" /> <Compile Include="Map\Thing.cs" />
<Compile Include="Map\Vertex.cs" /> <Compile Include="Map\Vertex.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>

View file

@ -20,6 +20,7 @@ using System.IO;
using System.Reflection; using System.Reflection;
using CodeImp.DoomBuilder.Interface; using CodeImp.DoomBuilder.Interface;
using CodeImp.DoomBuilder.IO; using CodeImp.DoomBuilder.IO;
using System.Collections.Specialized;
namespace CodeImp.DoomBuilder namespace CodeImp.DoomBuilder
{ {
@ -29,6 +30,7 @@ namespace CodeImp.DoomBuilder
// Files and Folders // Files and Folders
private const string SETTINGS_CONFIG_FILE = "Builder.cfg"; private const string SETTINGS_CONFIG_FILE = "Builder.cfg";
private const string GAME_CONFIGS_DIR = "Configurations";
#endregion #endregion
@ -37,23 +39,29 @@ namespace CodeImp.DoomBuilder
// Files and Folders // Files and Folders
private static string apppath; private static string apppath;
private static string temppath; private static string temppath;
private static string configspath;
// Main objects // Main objects
private static MainForm mainwindow; private static MainForm mainwindow;
private static Configuration settings; private static Configuration settings;
// Configurations
private static List<string> configfiles;
private static List<string> confignames;
#endregion #endregion
#region ================== Properties #region ================== Properties
public static string AppPath { get { return apppath; } } public static string AppPath { get { return apppath; } }
public static string TempPath { get { return temppath; } } public static string TempPath { get { return temppath; } }
public static string ConfigsPath { get { return configspath; } }
public static MainForm MainWindow { get { return mainwindow; } } public static MainForm MainWindow { get { return mainwindow; } }
public static Configuration Settings { get { return settings; } } public static Configuration Settings { get { return settings; } }
#endregion #endregion
#region ================== Methods #region ================== Startup
// Main program entry // Main program entry
public static void Main(string[] args) public static void Main(string[] args)
@ -66,6 +74,9 @@ namespace CodeImp.DoomBuilder
// Temporary directory // Temporary directory
temppath = Path.GetTempPath(); temppath = Path.GetTempPath();
// Configurations directory
configspath = Path.Combine(apppath, GAME_CONFIGS_DIR);
// Load configuration // Load configuration
if(!File.Exists(Path.Combine(apppath, SETTINGS_CONFIG_FILE))) throw (new FileNotFoundException("Unable to find the program configuration \"" + SETTINGS_CONFIG_FILE + "\".")); if(!File.Exists(Path.Combine(apppath, SETTINGS_CONFIG_FILE))) throw (new FileNotFoundException("Unable to find the program configuration \"" + SETTINGS_CONFIG_FILE + "\"."));
settings = new Configuration(Path.Combine(apppath, SETTINGS_CONFIG_FILE), false); settings = new Configuration(Path.Combine(apppath, SETTINGS_CONFIG_FILE), false);
@ -75,11 +86,66 @@ namespace CodeImp.DoomBuilder
// Show main window // Show main window
mainwindow.Show(); mainwindow.Show();
mainwindow.Update();
// Load game configurations
LoadConfigurations();
// Run application from the main window // Run application from the main window
mainwindow.DisplayReady();
Application.Run(mainwindow); 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 #endregion
} }
} }

28
Source/IO/IMapSetIO.cs Normal file
View file

@ -0,0 +1,28 @@
/*
* 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.
*
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.IO
{
internal interface IMapSetIO : IDisposable
{
// Methods
MapSet Read(string mapname);
void Write(MapSet map, string mapname);
}
}

View file

@ -41,9 +41,11 @@ namespace CodeImp.DoomBuilder.Interface
this.itemexit = new System.Windows.Forms.ToolStripMenuItem(); this.itemexit = new System.Windows.Forms.ToolStripMenuItem();
this.toolbar = new System.Windows.Forms.ToolStrip(); this.toolbar = new System.Windows.Forms.ToolStrip();
this.statusbar = new System.Windows.Forms.StatusStrip(); this.statusbar = new System.Windows.Forms.StatusStrip();
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
this.panelinfo = new System.Windows.Forms.Panel(); this.panelinfo = new System.Windows.Forms.Panel();
this.display = new System.Windows.Forms.PictureBox(); this.display = new System.Windows.Forms.PictureBox();
this.menumain.SuspendLayout(); this.menumain.SuspendLayout();
this.statusbar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -129,11 +131,23 @@ namespace CodeImp.DoomBuilder.Interface
// //
// statusbar // statusbar
// //
this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.statusbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.statuslabel});
this.statusbar.Location = new System.Drawing.Point(0, 471); this.statusbar.Location = new System.Drawing.Point(0, 471);
this.statusbar.Name = "statusbar"; this.statusbar.Name = "statusbar";
this.statusbar.Size = new System.Drawing.Size(619, 22); this.statusbar.Size = new System.Drawing.Size(619, 22);
this.statusbar.TabIndex = 2; this.statusbar.TabIndex = 2;
// //
// statuslabel
//
this.statuslabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.statuslabel.Name = "statuslabel";
this.statuslabel.Size = new System.Drawing.Size(573, 17);
this.statuslabel.Spring = true;
this.statuslabel.Text = "Initializing user interface...";
this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panelinfo // panelinfo
// //
this.panelinfo.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelinfo.Dock = System.Windows.Forms.DockStyle.Bottom;
@ -175,6 +189,8 @@ namespace CodeImp.DoomBuilder.Interface
this.Text = "Doom Builder"; this.Text = "Doom Builder";
this.menumain.ResumeLayout(false); this.menumain.ResumeLayout(false);
this.menumain.PerformLayout(); this.menumain.PerformLayout();
this.statusbar.ResumeLayout(false);
this.statusbar.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.display)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.display)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -197,5 +213,6 @@ namespace CodeImp.DoomBuilder.Interface
private System.Windows.Forms.ToolStripMenuItem itemsavemapinto; private System.Windows.Forms.ToolStripMenuItem itemsavemapinto;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem itemexit; private System.Windows.Forms.ToolStripMenuItem itemexit;
private System.Windows.Forms.ToolStripStatusLabel statuslabel;
} }
} }

View file

@ -9,11 +9,44 @@ namespace CodeImp.DoomBuilder.Interface
{ {
public partial class MainForm : Form public partial class MainForm : Form
{ {
#region ================== Constants
private const string STATUS_READY_TEXT = "Ready.";
#endregion
#region ================== Constructor / Disposer
// Constructor // Constructor
public MainForm() public MainForm()
{ {
// Setup controls // Setup controls
InitializeComponent(); InitializeComponent();
} }
#endregion
#region ================== Statusbar
// This changes status text
public void DisplayStatus(string status)
{
// Update status description
if(statuslabel.Text != status)
statuslabel.Text = status;
// Refresh if needed
statusbar.Invalidate();
this.Update();
}
// This changes status text to Ready
public void DisplayReady()
{
// Display ready status description
DisplayStatus(STATUS_READY_TEXT);
}
#endregion
} }
} }

View file

@ -1,3 +1,15 @@
/*
* 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.
*
*/
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View file

@ -1,3 +1,15 @@
/*
* 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.
*
*/
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View file

@ -1,3 +1,15 @@
/*
* 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.
*
*/
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View file

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Doom Builder")]
[assembly: AssemblyDescription("Doom, Heretic and Hexen map editor")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CodeImp")]
[assembly: AssemblyProduct("Doom Builder")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("767cd97a-8b1f-42b3-9086-a5ab9cdbe4ab")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]