mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
added nodebuilder configurations and fixed some nodebuilding behavior
This commit is contained in:
parent
f8574ace7a
commit
c79ad3fa55
7 changed files with 173 additions and 90 deletions
1
Build/Compilers/bsp-w32.bat
Normal file
1
Build/Compilers/bsp-w32.bat
Normal file
|
@ -0,0 +1 @@
|
|||
bsp-w32.exe %*
|
|
@ -5,7 +5,37 @@ compilers
|
|||
// The setting named "program" defines what .exe to run
|
||||
bspw32
|
||||
{
|
||||
// Don't ask me why, but running the exe directly doesn't seem to work.
|
||||
// It seems like it ignores the parameters. Using a batch file seems to 'fix' this.
|
||||
interface = "NodesCompiler";
|
||||
program = "bsp-w32.exe";
|
||||
program = "bsp-w32.bat";
|
||||
executable = "bsp-w32.exe";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Below are configurations for this nodebuilder. If you want to make your own configurations,
|
||||
// it is recommended to do so in your own file as this file will be updated each release.
|
||||
|
||||
// NOTE: Nodebuilder configuration key names defined here must be unique for all nodebuilders!
|
||||
// Recommend to start the key name with the name of the compiler, followed by underscore and a specific name.
|
||||
|
||||
// The "compiler" setting must refer to an existing compiler (such as defined above), but it
|
||||
// does not have to be a compiler defined in the same configuration file.
|
||||
|
||||
nodebuilders
|
||||
{
|
||||
bspw32_normal
|
||||
{
|
||||
title = "BSP-W32 - Normal";
|
||||
compiler = "bspw32";
|
||||
parameters = "%FI -o %FO";
|
||||
}
|
||||
|
||||
bspw32_fast
|
||||
{
|
||||
title = "BSP-W32 - Fast (no reject)";
|
||||
compiler = "bspw32";
|
||||
parameters = "-noreject %FI -o %FO";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,3 +9,30 @@ compilers
|
|||
program = "zdbsp.exe";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Below are configurations for this nodebuilder. If you want to make your own configurations,
|
||||
// it is recommended to do so in your own file as this file will be updated each release.
|
||||
|
||||
// NOTE: Nodebuilder configuration key names defined here must be unique for all nodebuilders!
|
||||
// Recommend to start the key name with the name of the compiler, followed by underscore and a specific name.
|
||||
|
||||
// The "compiler" setting must refer to an existing compiler (such as defined above), but it
|
||||
// does not have to be a compiler defined in the same configuration file.
|
||||
|
||||
nodebuilders
|
||||
{
|
||||
zdbsp_normal
|
||||
{
|
||||
title = "ZDBSP - Normal";
|
||||
compiler = "zdbsp";
|
||||
parameters = "-o%FO %FI";
|
||||
}
|
||||
|
||||
zdbsp_fast
|
||||
{
|
||||
title = "ZDBSP - Fast (no reject)";
|
||||
compiler = "zdbsp";
|
||||
parameters = "-R -o%FO %FI";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,11 @@ quality over quantity. It is done when it's done.
|
|||
The order and included items may also change any time.
|
||||
=========================================================
|
||||
|
||||
- Fix up nodebuilder configurations and all user to choose no nodebuilder.
|
||||
- Offsets in info panel are not updated when dragging textue or changing texture offsets.
|
||||
|
||||
- Full brightness option in Visual Mode
|
||||
|
||||
- Info panel should be collapsable
|
||||
|
||||
- Create menus for different modes
|
||||
|
||||
|
@ -19,6 +23,8 @@ The order and included items may also change any time.
|
|||
|
||||
- Set up forum for bug reports and development.
|
||||
|
||||
- Test map nomonsters option in same menu
|
||||
|
||||
=========================================================
|
||||
BETA TESTING STARTS HERE
|
||||
OFFICIAL MANUAL WRITING STARTS HERE
|
||||
|
|
|
@ -92,6 +92,17 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// No compiler found?
|
||||
if(this.compiler == null) throw new Exception("No such compiler defined: '" + compilername + "'");
|
||||
}
|
||||
|
||||
// Constructor for "none" nodebuilder
|
||||
public NodebuilderInfo()
|
||||
{
|
||||
// Initialize
|
||||
this.name = "";
|
||||
this.compiler = null;
|
||||
this.title = "[do not build nodes]";
|
||||
this.parameters = "";
|
||||
this.specialoutputfile = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -389,42 +389,6 @@ namespace CodeImp.DoomBuilder
|
|||
// If the scripts window is open, save the scripts first
|
||||
if(IsScriptsWindowOpen) scriptwindow.Editor.ImplicitSave();
|
||||
|
||||
// Make a copy of the map data
|
||||
outputset = map.Clone();
|
||||
|
||||
// Remove all flags from all 3D Start things
|
||||
foreach(Thing t in outputset.Things)
|
||||
{
|
||||
if(t.Type == config.Start3DModeThingType)
|
||||
{
|
||||
List<string> flagkeys = new List<string>(t.Flags.Keys);
|
||||
foreach(string k in flagkeys) t.Flags[k] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Do we need sidedefs compression?
|
||||
if(map.Sidedefs.Count > io.MaxSidedefs)
|
||||
{
|
||||
// Compress sidedefs
|
||||
outputset.CompressSidedefs();
|
||||
|
||||
// Check if it still doesnt fit
|
||||
if(map.Sidedefs.Count > io.MaxSidedefs)
|
||||
{
|
||||
// Problem! Can't save the map like this!
|
||||
General.ShowErrorMessage("Unable to save the map: There are too many unique sidedefs!", MessageBoxButtons.OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check for more limitations
|
||||
|
||||
// Write to temporary file
|
||||
General.WriteLogLine("Writing map data structures to file...");
|
||||
index = tempwad.FindLumpIndex(TEMP_MAP_HEADER);
|
||||
if(index == -1) index = 0;
|
||||
io.Write(outputset, TEMP_MAP_HEADER, index);
|
||||
|
||||
// Only recompile scripts when the scripts have changed
|
||||
// (not when only the map changed)
|
||||
if(CheckScriptChanged())
|
||||
|
@ -447,23 +411,64 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
}
|
||||
|
||||
// Only rebuild nodes when the actual map has changed
|
||||
// Only write the map and rebuild nodes when the actual map has changed
|
||||
// (not when only scripts have changed)
|
||||
if(changed)
|
||||
{
|
||||
// Make a copy of the map data
|
||||
outputset = map.Clone();
|
||||
|
||||
// Remove all flags from all 3D Start things
|
||||
foreach(Thing t in outputset.Things)
|
||||
{
|
||||
if(t.Type == config.Start3DModeThingType)
|
||||
{
|
||||
List<string> flagkeys = new List<string>(t.Flags.Keys);
|
||||
foreach(string k in flagkeys) t.Flags[k] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Do we need sidedefs compression?
|
||||
if(map.Sidedefs.Count > io.MaxSidedefs)
|
||||
{
|
||||
// Compress sidedefs
|
||||
outputset.CompressSidedefs();
|
||||
|
||||
// Check if it still doesnt fit
|
||||
if(map.Sidedefs.Count > io.MaxSidedefs)
|
||||
{
|
||||
// Problem! Can't save the map like this!
|
||||
General.ShowErrorMessage("Unable to save the map: There are too many unique sidedefs!", MessageBoxButtons.OK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check for more limitations
|
||||
|
||||
// Write to temporary file
|
||||
General.WriteLogLine("Writing map data structures to file...");
|
||||
index = tempwad.FindLumpIndex(TEMP_MAP_HEADER);
|
||||
if(index == -1) index = 0;
|
||||
io.Write(outputset, TEMP_MAP_HEADER, index);
|
||||
outputset.Dispose();
|
||||
|
||||
// Get the corresponding nodebuilder
|
||||
if(savemode == SAVE_TEST) nodebuildername = configinfo.NodebuilderTest;
|
||||
else nodebuildername = configinfo.NodebuilderSave;
|
||||
nodebuildername = savemode == SAVE_TEST ? configinfo.NodebuilderTest : configinfo.NodebuilderSave;
|
||||
|
||||
// Build the nodes
|
||||
oldstatus = General.MainWindow.GetCurrentSatus();
|
||||
General.MainWindow.DisplayStatus("Building map nodes...");
|
||||
if((nodebuildername != null) && (nodebuildername != ""))
|
||||
if(!string.IsNullOrEmpty(nodebuildername))
|
||||
includenodes = BuildNodes(nodebuildername, true);
|
||||
else
|
||||
includenodes = false;
|
||||
General.MainWindow.DisplayStatus(oldstatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if we have nodebuilder lumps
|
||||
includenodes = VerifyNodebuilderLumps(tempwad, TEMP_MAP_HEADER);
|
||||
}
|
||||
|
||||
// Suspend data resources
|
||||
data.Suspend();
|
||||
|
@ -508,8 +513,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// Determine original map name
|
||||
if(options.PreviousName != "") origmapname = options.PreviousName;
|
||||
else origmapname = options.CurrentName;
|
||||
origmapname = options.PreviousName != "" ? options.PreviousName : options.CurrentName;
|
||||
|
||||
// Copy map lumps to target file
|
||||
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, targetwad, origmapname, true, true, includenodes, true);
|
||||
|
@ -597,10 +601,8 @@ namespace CodeImp.DoomBuilder
|
|||
{
|
||||
NodebuilderInfo nodebuilder;
|
||||
string tempfile1, tempfile2;
|
||||
bool lumpnodebuild, lumpallowempty;
|
||||
bool lumpscomplete = false;
|
||||
WAD buildwad;
|
||||
int srcindex;
|
||||
|
||||
// Find the nodebuilder
|
||||
nodebuilder = General.GetNodebuilderByName(nodebuildername);
|
||||
|
@ -618,6 +620,17 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Make temporary filename
|
||||
tempfile1 = General.MakeTempFilename(compiler.Location);
|
||||
|
||||
// Make the temporary WAD file
|
||||
General.WriteLogLine("Creating temporary build file: " + tempfile1);
|
||||
buildwad = new WAD(tempfile1);
|
||||
|
||||
// Copy lumps to buildwad
|
||||
General.WriteLogLine("Copying map lumps to temporary build file...");
|
||||
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, buildwad, BUILD_MAP_HEADER, true, false, false, true);
|
||||
|
||||
// Close buildwad
|
||||
buildwad.Dispose();
|
||||
|
||||
// Does the nodebuilder require an output file?
|
||||
if(nodebuilder.HasSpecialOutputFile)
|
||||
|
@ -631,17 +644,6 @@ namespace CodeImp.DoomBuilder
|
|||
// Output file is same as input file
|
||||
tempfile2 = tempfile1;
|
||||
}
|
||||
|
||||
// Make the temporary WAD file
|
||||
General.WriteLogLine("Creating temporary build file: " + tempfile1);
|
||||
buildwad = new WAD(tempfile1);
|
||||
|
||||
// Copy lumps to buildwad
|
||||
General.WriteLogLine("Copying map lumps to temporary build file...");
|
||||
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, buildwad, BUILD_MAP_HEADER, true, false, false, true);
|
||||
|
||||
// Close buildwad
|
||||
buildwad.Dispose();
|
||||
|
||||
// Run the nodebuilder
|
||||
compiler.Parameters = nodebuilder.Parameters;
|
||||
|
@ -653,38 +655,8 @@ namespace CodeImp.DoomBuilder
|
|||
// Open the output file
|
||||
buildwad = new WAD(tempfile2);
|
||||
|
||||
// Find the map header in source
|
||||
srcindex = buildwad.FindLumpIndex(BUILD_MAP_HEADER);
|
||||
if(srcindex > -1)
|
||||
{
|
||||
// Go for all the map lump names
|
||||
lumpscomplete = true;
|
||||
foreach(DictionaryEntry ml in config.MapLumpNames)
|
||||
{
|
||||
// Read lump settings from map config
|
||||
lumpnodebuild = config.ReadSetting("maplumpnames." + ml.Key + ".nodebuild", false);
|
||||
lumpallowempty = config.ReadSetting("maplumpnames." + ml.Key + ".allowempty", false);
|
||||
|
||||
// Check if this lump should exist
|
||||
if(lumpnodebuild && !lumpallowempty)
|
||||
{
|
||||
// Find the lump in the source
|
||||
if(buildwad.FindLump(ml.Key.ToString(), srcindex, srcindex + config.MapLumpNames.Count + 2) == null)
|
||||
{
|
||||
// Missing a lump!
|
||||
lumpscomplete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cannot find header
|
||||
lumpscomplete = false;
|
||||
}
|
||||
|
||||
// Output lumps complete?
|
||||
lumpscomplete = VerifyNodebuilderLumps(buildwad, BUILD_MAP_HEADER);
|
||||
if(lumpscomplete)
|
||||
{
|
||||
// Copy nodebuilder lumps to temp file
|
||||
|
@ -712,6 +684,40 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
}
|
||||
|
||||
// This verifies if the nodebuilder lumps exist in a WAD file
|
||||
private bool VerifyNodebuilderLumps(WAD wad, string mapheader)
|
||||
{
|
||||
bool lumpscomplete = false;
|
||||
|
||||
// Find the map header in source
|
||||
int srcindex = wad.FindLumpIndex(mapheader);
|
||||
if(srcindex > -1)
|
||||
{
|
||||
// Go for all the map lump names
|
||||
lumpscomplete = true;
|
||||
foreach(DictionaryEntry ml in config.MapLumpNames)
|
||||
{
|
||||
// Read lump settings from map config
|
||||
bool lumpnodebuild = config.ReadSetting("maplumpnames." + ml.Key + ".nodebuild", false);
|
||||
bool lumpallowempty = config.ReadSetting("maplumpnames." + ml.Key + ".allowempty", false);
|
||||
|
||||
// Check if this lump should exist
|
||||
if(lumpnodebuild && !lumpallowempty)
|
||||
{
|
||||
// Find the lump in the source
|
||||
if(wad.FindLump(ml.Key.ToString(), srcindex, srcindex + config.MapLumpNames.Count + 2) == null)
|
||||
{
|
||||
// Missing a lump!
|
||||
lumpscomplete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lumpscomplete;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Lumps
|
||||
|
|
|
@ -68,7 +68,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// No skill
|
||||
skill.Value = 0;
|
||||
|
||||
// TODO: Nodebuilders are allowed to be empty
|
||||
// Nodebuilders are allowed to be empty
|
||||
nodebuildersave.Items.Add(new NodebuilderInfo());
|
||||
nodebuildertest.Items.Add(new NodebuilderInfo());
|
||||
|
||||
// Fill comboboxes with nodebuilders
|
||||
nodebuildersave.Items.AddRange(General.Nodebuilders.ToArray());
|
||||
|
@ -132,7 +134,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
|
||||
// Go for all nodebuilder save items
|
||||
// Go for all nodebuilder test items
|
||||
nodebuildertest.SelectedIndex = -1;
|
||||
for(int i = 0; i < nodebuildertest.Items.Count; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue