mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 03:11:40 +00:00
miauw.
This commit is contained in:
parent
85ae983769
commit
04d21101cf
6 changed files with 216 additions and 5 deletions
28
Build/Compilers/glBSP.cfg
Normal file
28
Build/Compilers/glBSP.cfg
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
// How to display the nodebuilder name
|
||||
title = "glBSP";
|
||||
|
||||
// Parameter placeholders:
|
||||
// %F is the WAD file where the nodebuilder must read from
|
||||
// %T is the WAD file to which the nodebuilde writes its output (optional)
|
||||
|
||||
// Settings used when saving a map
|
||||
savemap
|
||||
{
|
||||
compiler = "glBSP.exe";
|
||||
parameters = "%F -o %T";
|
||||
}
|
||||
|
||||
// Settings used when testing a map
|
||||
testmap
|
||||
{
|
||||
compiler = "glBSP.exe";
|
||||
parameters = "%F -o %T";
|
||||
}
|
||||
|
||||
// Settings used when using 3D mode
|
||||
mode3dbuild
|
||||
{
|
||||
compiler = "glBSP.exe";
|
||||
parameters = "-normal -noreject -v5 -factor 1 %F -o %T";
|
||||
}
|
|
@ -54,6 +54,7 @@
|
|||
<Compile Include="General\ConfigurationInfo.cs" />
|
||||
<Compile Include="General\MapManager.cs" />
|
||||
<Compile Include="Controls\SpecialKeys.cs" />
|
||||
<Compile Include="General\NodebuilderInfo.cs" />
|
||||
<Compile Include="Geometry\Angle2D.cs" />
|
||||
<Compile Include="Geometry\Line2D.cs" />
|
||||
<Compile Include="Geometry\Vector2D.cs" />
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Files and Folders
|
||||
private const string SETTINGS_CONFIG_FILE = "Builder.cfg";
|
||||
private const string GAME_CONFIGS_DIR = "Configurations";
|
||||
private const string COMPILERS_DIR = "Compilers";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -91,6 +92,7 @@ namespace CodeImp.DoomBuilder
|
|||
private static string apppath;
|
||||
private static string temppath;
|
||||
private static string configspath;
|
||||
private static string compilerspath;
|
||||
|
||||
// Main objects
|
||||
private static Assembly thisasm;
|
||||
|
@ -101,6 +103,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Configurations
|
||||
private static List<ConfigurationInfo> configs;
|
||||
private static List<NodebuilderInfo> nodebuilders;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -110,9 +113,11 @@ namespace CodeImp.DoomBuilder
|
|||
public static string AppPath { get { return apppath; } }
|
||||
public static string TempPath { get { return temppath; } }
|
||||
public static string ConfigsPath { get { return configspath; } }
|
||||
public static string CompilersPath { get { return compilerspath; } }
|
||||
public static MainForm MainWindow { get { return mainwindow; } }
|
||||
public static Configuration Settings { get { return settings; } }
|
||||
public static List<ConfigurationInfo> Configs { get { return configs; } }
|
||||
public static List<NodebuilderInfo> Nodebuilders { get { return nodebuilders; } }
|
||||
public static MapManager Map { get { return map; } }
|
||||
public static ActionManager Actions { get { return actions; } }
|
||||
|
||||
|
@ -198,8 +203,8 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Make array
|
||||
configs = new List<ConfigurationInfo>();
|
||||
|
||||
// Go for all files in the configurations directory
|
||||
|
||||
// Go for all cfg files in the configurations directory
|
||||
filenames = Directory.GetFiles(configspath, "*.cfg", SearchOption.TopDirectoryOnly);
|
||||
foreach(string filepath in filenames)
|
||||
{
|
||||
|
@ -220,6 +225,53 @@ namespace CodeImp.DoomBuilder
|
|||
configs.Sort();
|
||||
}
|
||||
|
||||
// This finds all nodebuilder configurations
|
||||
private static void FindNodebuilderConfigurations()
|
||||
{
|
||||
Configuration cfg;
|
||||
string[] filenames;
|
||||
|
||||
// Display status
|
||||
mainwindow.DisplayStatus("Loading nodebuilder configurations...");
|
||||
|
||||
// Make array
|
||||
nodebuilders = new List<NodebuilderInfo>();
|
||||
|
||||
// Go for all cfg files in the compilers directory
|
||||
filenames = Directory.GetFiles(compilerspath, "*.cfg", SearchOption.TopDirectoryOnly);
|
||||
foreach(string filepath in filenames)
|
||||
{
|
||||
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 nodebuilder configuration file \"" + filepath + "\".\n" +
|
||||
"Error near line " + cfg.ErrorLine + ": " + cfg.ErrorDescription,
|
||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make nodebuilder info
|
||||
nodebuilders.Add(new NodebuilderInfo(cfg));
|
||||
}
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
// Unable to load configuration
|
||||
MessageBox.Show(mainwindow, "Unable to load the nodebuilder configuration file \"" + filepath + "\".",
|
||||
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the configurations list
|
||||
configs.Sort();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Startup
|
||||
|
@ -237,11 +289,10 @@ namespace CodeImp.DoomBuilder
|
|||
localpath = new Uri(Path.GetDirectoryName(thisasm.GetName().CodeBase));
|
||||
apppath = Uri.UnescapeDataString(localpath.AbsolutePath);
|
||||
|
||||
// Temporary directory
|
||||
// Setup directories
|
||||
temppath = Path.GetTempPath();
|
||||
|
||||
// Configurations directory
|
||||
configspath = Path.Combine(apppath, GAME_CONFIGS_DIR);
|
||||
compilerspath = Path.Combine(apppath, COMPILERS_DIR);
|
||||
|
||||
// Load configuration
|
||||
if(!File.Exists(Path.Combine(apppath, SETTINGS_CONFIG_FILE))) throw (new FileNotFoundException("Unable to find the program configuration \"" + SETTINGS_CONFIG_FILE + "\"."));
|
||||
|
@ -263,6 +314,9 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Load game configurations
|
||||
FindGameConfigurations();
|
||||
|
||||
// Load nodebuilder configurations
|
||||
FindNodebuilderConfigurations();
|
||||
|
||||
// Run application from the main window
|
||||
mainwindow.DisplayReady();
|
||||
|
@ -482,3 +536,4 @@ namespace CodeImp.DoomBuilder
|
|||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
113
Source/General/NodebuilderInfo.cs
Normal file
113
Source/General/NodebuilderInfo.cs
Normal file
|
@ -0,0 +1,113 @@
|
|||
|
||||
#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 CodeImp.DoomBuilder.Images;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder
|
||||
{
|
||||
internal class NodebuilderInfo : IComparable<NodebuilderInfo>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
private string name;
|
||||
private ProcessStartInfo savemapprocess;
|
||||
private ProcessStartInfo testmapprocess;
|
||||
private ProcessStartInfo mode3dbuildprocess;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public string Name { get { return name; } }
|
||||
public ProcessStartInfo SaveMapProcess { get { return savemapprocess; } }
|
||||
public ProcessStartInfo TestMapProcess { get { return testmapprocess; } }
|
||||
public ProcessStartInfo Mode3DBuildProcess { get { return mode3dbuildprocess; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public NodebuilderInfo(Configuration cfg)
|
||||
{
|
||||
// Initialize
|
||||
this.name = cfg.ReadSetting("title", "");
|
||||
|
||||
// Setup save map process
|
||||
SetupProcess(out savemapprocess,
|
||||
cfg.ReadSetting("savemap.compiler", ""),
|
||||
cfg.ReadSetting("savemap.parameters", ""));
|
||||
|
||||
// Setup test map process
|
||||
SetupProcess(out testmapprocess,
|
||||
cfg.ReadSetting("testmap.compiler", ""),
|
||||
cfg.ReadSetting("testmap.parameters", ""));
|
||||
|
||||
// Setup 3d build process
|
||||
SetupProcess(out mode3dbuildprocess,
|
||||
cfg.ReadSetting("mode3dbuild.compiler", ""),
|
||||
cfg.ReadSetting("mode3dbuild.parameters", ""));
|
||||
}
|
||||
|
||||
// This sets up a process
|
||||
private void SetupProcess(out ProcessStartInfo processinfo, string compiler, string parameters)
|
||||
{
|
||||
processinfo = new ProcessStartInfo();
|
||||
processinfo.Arguments = parameters;
|
||||
processinfo.FileName = Path.Combine(General.CompilersPath, compiler);
|
||||
processinfo.CreateNoWindow = false;
|
||||
processinfo.ErrorDialog = false;
|
||||
processinfo.UseShellExecute = true;
|
||||
processinfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
processinfo.WorkingDirectory = General.TempPath;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This compares it to other ConfigurationInfo objects
|
||||
public int CompareTo(NodebuilderInfo other)
|
||||
{
|
||||
// Compare
|
||||
return name.CompareTo(other.name);
|
||||
}
|
||||
|
||||
// String representation
|
||||
public override string ToString()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
1
Source/Interface/ConfigForm.Designer.cs
generated
1
Source/Interface/ConfigForm.Designer.cs
generated
|
@ -205,6 +205,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.listconfigs.Size = new System.Drawing.Size(215, 300);
|
||||
this.listconfigs.Sorted = true;
|
||||
this.listconfigs.TabIndex = 0;
|
||||
this.listconfigs.SelectedIndexChanged += new System.EventHandler(this.listconfigs_SelectedIndexChanged);
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
|
|
|
@ -43,6 +43,19 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Add a copy
|
||||
listconfigs.Items.Add(ci.Clone());
|
||||
}
|
||||
|
||||
// Fill list of nodebuilders
|
||||
confignodebuilder.Items.AddRange(General.Nodebuilders.ToArray());
|
||||
}
|
||||
|
||||
#region ================== Configuration Panel
|
||||
|
||||
// Configuration item selected
|
||||
private void listconfigs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue