Added "File -> Open Map in current WAD" command (default shortcut is Ctrl-Shift-O).

Fixed some errors in non-UDMF <-> UDMF map conversion.
Updated ISS setup script (not tested).
Removed some unused variables.
This commit is contained in:
MaxED 2013-07-23 14:25:03 +00:00
parent bafb8ed511
commit e5a9bac2ad
15 changed files with 223 additions and 142 deletions

View file

@ -38,25 +38,28 @@ include("Includes\\ZDoom_common.cfg", "mapformat_udmf");
!!!!!!!!!!!!! GAME STUFF !!!!!!!!!!!!! !!!!!!!!!!!!! GAME STUFF !!!!!!!!!!!!!
!Keep only the one that's appropriate! !Keep only the one that's appropriate!
// Settings common to Doom games // Settings common to Doom games
include("Includes\\ZDoom_common.cfg", "game_doom"); include("Includes\\Game_Doom.cfg");
// Settings common to Heretic games // Settings common to Heretic games
include("Includes\\ZDoom_common.cfg", "game_heretic"); include("Includes\\Game_Heretic.cfg");
// Settings common to Hexen games // Settings common to Hexen games
include("Includes\\ZDoom_common.cfg", "game_hexen"); include("Includes\\Game_Hexen.cfg");
// Settings common to Strife games // Settings common to Strife games
include("Includes\\ZDoom_common.cfg", "game_strife"); include("Includes\\Game_Strife.cfg");
// Settings common to Chex Quest games // Settings common to Chex Quest games
include("Includes\\ZDoom_common.cfg", "game_chex"); include("Includes\\Game_Chex.cfg");
// Settings common to Chex Quest 3 games // Settings common to Chex Quest 3 games
include("Includes\\ZDoom_common.cfg", "game_chex3"); include("Includes\\Game_Chex3.cfg");
// Settings common to Harmony games // Settings common to Harmony games
include("Includes\\ZDoom_common.cfg", "game_harmony"); include("Includes\\Game_Harmony.cfg");
// Settings common to Action Doom 2 games
include("Includes\\Game_Action2.cfg");
!!!!!!!!!!!!! GAME STUFF !!!!!!!!!!!!! !!!!!!!!!!!!! GAME STUFF !!!!!!!!!!!!!
!!!!Keep only one of each category!!!! !!!!Keep only one of each category!!!!

View file

@ -40,33 +40,44 @@ Source: Builder.exe; DestDir: {app}; Flags: ignoreversion
Source: GZBuilder.cfg; DestDir: {app}; Flags: ignoreversion Source: GZBuilder.cfg; DestDir: {app}; Flags: ignoreversion
Source: Refmanual.chm; DestDir: {app}; Flags: ignoreversion Source: Refmanual.chm; DestDir: {app}; Flags: ignoreversion
Source: DevIL.dll; DestDir: {app}; Flags: ignoreversion Source: DevIL.dll; DestDir: {app}; Flags: ignoreversion
Source: Sharpzip.dll; DestDir: {app}; Flags: ignoreversion Source: SharpCompress.3.5.dll; DestDir: {app}; Flags: ignoreversion
Source: Scintilla.dll; DestDir: {app}; Flags: ignoreversion Source: Scintilla.dll; DestDir: {app}; Flags: ignoreversion
Source: Trackbar.dll; DestDir: {app}; Flags: ignoreversion Source: Trackbar.dll; DestDir: {app}; Flags: ignoreversion
Source: SlimDX.dll; DestDir: {app}; Flags: ignoreversion Source: SlimDX.dll; DestDir: {app}; Flags: ignoreversion
Source: GPL.txt; DestDir: {app}; Flags: ignoreversion Source: GPL.txt; DestDir: {app}; Flags: ignoreversion
Source: Compilers\*; DestDir: {app}\Compilers; Flags: ignoreversion recursesubdirs Source: Compilers\*; DestDir: {app}\Compilers; Flags: ignoreversion recursesubdirs
Source: Configurations\*; DestDir: {app}\Configurations; Flags: ignoreversion recursesubdirs Source: Configurations\*; DestDir: {app}\Configurations; Flags: ignoreversion recursesubdirs
Source: Gldefs\*; DestDir: {app}\Gldefs; Flags: ignoreversion recursesubdirs
Source: Scripting\*; DestDir: {app}\Scripting; Flags: ignoreversion recursesubdirs Source: Scripting\*; DestDir: {app}\Scripting; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: Plugins\BuilderModes.dll; DestDir: {app}\Plugins; Flags: ignoreversion Source: Plugins\BuilderModes.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\BuilderEffects.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\ColorPicker.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\CommentsPanel.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\CopyPasteSectorProps.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\NodesViewer.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\StairSectorBuilder.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\Statistics.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\TagExplorer.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\TagRange.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\VisplaneExplorer.dll; DestDir: {app}\Plugins; Flags: ignoreversion
Source: Plugins\Loadorder.cfg; DestDir: {app}\Plugins; Flags: ignoreversion onlyifdoesntexist Source: Plugins\Loadorder.cfg; DestDir: {app}\Plugins; Flags: ignoreversion onlyifdoesntexist
Source: Sprites\*; DestDir: {app}\Sprites; Flags: ignoreversion recursesubdirs Source: Sprites\*; DestDir: {app}\Sprites; Flags: ignoreversion recursesubdirs
[Icons] [Icons]
Name: {group}\Doom Builder; Filename: {app}\Builder.exe Name: {group}\Doom Builder; Filename: {app}\Builder.exe
Name: {group}\{cm:UninstallProgram,Doom Builder}; Filename: {uninstallexe} Name: {group}\{cm:UninstallProgram,Doom Builder}; Filename: {uninstallexe}
Name: {commondesktop}\Doom Builder; Filename: {app}\Builder.exe; Tasks: desktopicon Name: {commondesktop}\GZDoom Builder; Filename: {app}\Builder.exe; Tasks: desktopicon
[Run] [Run]
[UninstallDelete] [UninstallDelete]
Name: {localappdata}\Doom Builder; Type: filesandordirs //Name: {localappdata}\Doom Builder; Type: filesandordirs
Name: {app}; Type: filesandordirs Name: {app}; Type: filesandordirs
[InstallDelete] [InstallDelete]
Name: {app}\Builder.pdb; Type: files Name: {app}\Builder.pdb; Type: files
[Registry] [Registry]
Root: HKLM; Subkey: SOFTWARE\CodeImp\Doom Builder\; ValueType: string; ValueName: Location; ValueData: {app}; Flags: uninsdeletevalue Root: HKLM; Subkey: SOFTWARE\CodeImp\GZDoom Builder\; ValueType: string; ValueName: Location; ValueData: {app}; Flags: uninsdeletevalue
[Messages] [Messages]
ReadyLabel2a=Continue to begin with the installation, or click Back if you want to review or change any settings. ReadyLabel2a=Continue to begin with the installation, or click Back if you want to review or change any settings.
[Code] [Code]

View file

@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables #region ================== Variables
// Original configuration // Original configuration
private Configuration cfg; //private Configuration cfg;
// Compiler settings // Compiler settings
private CompilerInfo compiler; private CompilerInfo compiler;
@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Config
internal ScriptConfiguration() internal ScriptConfiguration()
{ {
// Initialize // Initialize
this.cfg = new Configuration(); //this.cfg = new Configuration();
this.keywords = new Dictionary<string, string>(); this.keywords = new Dictionary<string, string>();
this.constants = new List<string>(); this.constants = new List<string>();
this.lowerkeywords = new Dictionary<string, string>(); this.lowerkeywords = new Dictionary<string, string>();
@ -128,7 +128,7 @@ namespace CodeImp.DoomBuilder.Config
IDictionary dic; IDictionary dic;
// Initialize // Initialize
this.cfg = cfg; //this.cfg = cfg;
this.keywords = new Dictionary<string,string>(); this.keywords = new Dictionary<string,string>();
this.constants = new List<string>(); this.constants = new List<string>();
this.lowerkeywords = new Dictionary<string, string>(); this.lowerkeywords = new Dictionary<string, string>();

View file

@ -38,9 +38,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables #region ================== Variables
private TypeHandler typehandler; private TypeHandler typehandler;
private bool ignorebuttonchange = false; private bool ignorebuttonchange;
//mxd
private ArgumentInfo arginfo;
private bool gotTagArgument; private bool gotTagArgument;
#endregion #endregion
@ -178,8 +176,6 @@ namespace CodeImp.DoomBuilder.Controls
// This sets up the control for a specific argument // This sets up the control for a specific argument
public void Setup(ArgumentInfo arginfo) public void Setup(ArgumentInfo arginfo)
{ {
this.arginfo = arginfo; //mxd
int oldvalue = 0; int oldvalue = 0;
// Get the original value // Get the original value

View file

@ -86,9 +86,11 @@ namespace CodeImp.DoomBuilder.Controls
public DockersControl() public DockersControl()
{ {
InitializeComponent(); InitializeComponent();
expandedwidth = (int)((float)this.Width * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width)); expandedwidth = (int)(this.Width * (this.CurrentAutoScaleDimensions.Width / this.AutoScaleDimensions.Width));
tabs.TabsOffsetTop = buttonTogglePinning.Bottom + 2; //mxd tabs.TabsOffsetTop = buttonTogglePinning.Bottom + 2; //mxd
buttonTogglePinning.Image = General.Settings.CollapseDockers ? CodeImp.DoomBuilder.Properties.Resources.Unpin : CodeImp.DoomBuilder.Properties.Resources.Pin; //mxd
if(General.Settings != null)
buttonTogglePinning.Image = General.Settings.CollapseDockers ? CodeImp.DoomBuilder.Properties.Resources.Unpin : CodeImp.DoomBuilder.Properties.Resources.Pin; //mxd
} }
#endregion #endregion

View file

@ -922,11 +922,9 @@ namespace CodeImp.DoomBuilder.Data
// Return texture // Return texture
return textures[longname]; return textures[longname];
} }
else
{ // Return null image
// Return null image return new UnknownImage(Properties.Resources.UnknownImage);
return new UnknownImage(Properties.Resources.UnknownImage);
}
} }
#endregion #endregion

View file

@ -1125,6 +1125,26 @@ namespace CodeImp.DoomBuilder
openfile.Dispose(); openfile.Dispose();
} }
//mxd
// This loads a map from file
[BeginAction("openmapincurrentwad")]
internal static void OpenMapInCurrentWad() {
if (map == null || string.IsNullOrEmpty(map.FilePathName) || !File.Exists(map.FilePathName)){
General.Interface.DisplayStatus(StatusType.Warning, "Unable to open map form current WAD!");
return;
}
// Update main window
mainwindow.Update();
// Open map file
OpenMapFile(map.FilePathName, null);
//mxd
mainwindow.UpdateGZDoomPanel();
General.Settings.GZForceDefaultTextures = false;
}
// This opens the specified file // This opens the specified file
internal static void OpenMapFile(string filename, MapOptions options) internal static void OpenMapFile(string filename, MapOptions options)
{ {

View file

@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder {
private string filetitle; private string filetitle;
private string filepathname; private string filepathname;
private string temppath; private string temppath;
private string origmapconfigfile; //mxd. Map configuration, which was used to open the map.
// Main objects // Main objects
private MapSet map; private MapSet map;
@ -255,6 +256,7 @@ namespace CodeImp.DoomBuilder {
General.WriteLogLine("Loading game configuration..."); General.WriteLogLine("Loading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile); configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile)); config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
origmapconfigfile = options.ConfigFile;//mxd
configinfo.ApplyDefaults(config); configinfo.ApplyDefaults(config);
General.Editing.UpdateCurrentEditModes(); General.Editing.UpdateCurrentEditModes();
@ -346,6 +348,7 @@ namespace CodeImp.DoomBuilder {
General.WriteLogLine("Loading game configuration..."); General.WriteLogLine("Loading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile); configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile)); config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
origmapconfigfile = options.ConfigFile;//mxd
configinfo.ApplyDefaults(config); configinfo.ApplyDefaults(config);
General.Editing.UpdateCurrentEditModes(); General.Editing.UpdateCurrentEditModes();
@ -618,7 +621,8 @@ namespace CodeImp.DoomBuilder {
targetwad = new WAD(newfilepathname); targetwad = new WAD(newfilepathname);
// Copy all lumps, except the original map // Copy all lumps, except the original map
CopyAllLumpsExceptMap(origwad, targetwad, origmapname); GameConfiguration origcfg = (origmapconfigfile == configinfo.Filename ? config : new GameConfiguration(General.LoadGameConfiguration(origmapconfigfile))); //mxd
CopyAllLumpsExceptMap(origwad, targetwad, origcfg, origmapname);
// Close original file and delete it // Close original file and delete it
origwad.Dispose(); origwad.Dispose();
@ -861,9 +865,7 @@ namespace CodeImp.DoomBuilder {
l.Stream.Seek(0, SeekOrigin.Begin); l.Stream.Seek(0, SeekOrigin.Begin);
return new MemoryStream(l.Stream.ReadAllBytes()); return new MemoryStream(l.Stream.ReadAllBytes());
} }
else { return null;
return null;
}
} }
// This writes a copy of the data to a lump in the temp file // This writes a copy of the data to a lump in the temp file
@ -935,13 +937,31 @@ namespace CodeImp.DoomBuilder {
} }
} }
//mxd. This is called on tempwad, which should only have the current map inside it.
private void removeUnneededLumps(WAD target, string mapname) {
//Get the list of lumps required by current map format
List<string> requiredLumps = new List<string>();
foreach (DictionaryEntry ml in config.MapLumpNames){
string lumpname = ml.Key.ToString();
if(lumpname == CONFIG_MAP_HEADER) lumpname = mapname;
requiredLumps.Add(lumpname);
}
//Remove lumps, which are not required
List<Lump> toRemove = new List<Lump>();
foreach (Lump lump in target.Lumps)
if (!requiredLumps.Contains(lump.Name)) toRemove.Add(lump);
foreach (Lump lump in toRemove) target.Remove(lump);
}
// This copies all lumps, except those of a specific map // This copies all lumps, except those of a specific map
private void CopyAllLumpsExceptMap(WAD source, WAD target, string sourcemapname) { private void CopyAllLumpsExceptMap(WAD source, WAD target, GameConfiguration mapconfig, string sourcemapname) {
// Go for all lumps // Go for all lumps
bool skipping = false; bool skipping = false;
foreach (Lump srclump in source.Lumps) { foreach (Lump srclump in source.Lumps) {
// Check if we should stop skipping lumps here // Check if we should stop skipping lumps here
if (skipping && !config.MapLumpNames.Contains(srclump.Name)) { if (skipping && !mapconfig.MapLumpNames.Contains(srclump.Name)) {
// Stop skipping // Stop skipping
skipping = false; skipping = false;
} }
@ -1236,10 +1256,9 @@ namespace CodeImp.DoomBuilder {
// This also saves implicitly // This also saves implicitly
return scriptwindow.AskSaveAll(); return scriptwindow.AskSaveAll();
} }
else {
// No problems // No problems
return true; return true;
}
} }
// This applies the changed status for internal scripts // This applies the changed status for internal scripts
@ -1272,10 +1291,8 @@ namespace CodeImp.DoomBuilder {
// Check if scripts are changed // Check if scripts are changed
return scriptschanged || scriptwindow.Editor.CheckImplicitChanges(); return scriptschanged || scriptwindow.Editor.CheckImplicitChanges();
} }
else {
// Check if scripts are changed return scriptschanged;
return scriptschanged;
}
} }
// This compiles all lumps that require compiling and stores the results // This compiles all lumps that require compiling and stores the results
@ -1304,105 +1321,100 @@ namespace CodeImp.DoomBuilder {
byte[] filedata; byte[] filedata;
string reallumpname = lumpname; string reallumpname = lumpname;
//mxd. Does lump require compiling?
ScriptConfiguration scriptconfig = config.MapLumps[lumpname].script;
if (scriptconfig.Compiler == null) return true;
// Find the lump // Find the lump
if (lumpname == CONFIG_MAP_HEADER) reallumpname = TEMP_MAP_HEADER; if (lumpname == CONFIG_MAP_HEADER) reallumpname = TEMP_MAP_HEADER;
Lump lump = tempwad.FindLump(reallumpname); Lump lump = tempwad.FindLump(reallumpname);
if (lump == null) throw new Exception("No such lump in temporary wad file '" + reallumpname + "'."); if (lump == null) throw new Exception("No such lump in temporary wad file '" + reallumpname + "'.");
// Determine source file // Determine source file
if (filepathname.Length > 0) sourcefile = (filepathname.Length > 0 ? filepathname : tempwad.Filename);
sourcefile = filepathname;
else
sourcefile = tempwad.Filename;
// New list of errors // New list of errors
if (clearerrors) errors.Clear(); if (clearerrors) errors.Clear();
// Determine the script configuration to use // Determine the script configuration to use
ScriptConfiguration scriptconfig = config.MapLumps[lumpname].script; try {
if (scriptconfig.Compiler != null) { // Initialize compiler
try { compiler = scriptconfig.Compiler.Create();
// Initialize compiler } catch(Exception e) {
compiler = scriptconfig.Compiler.Create(); // Fail
} catch (Exception e) { errors.Add(new CompilerError("Unable to initialize compiler. " + e.GetType().Name + ": " + e.Message));
// Fail return false;
errors.Add(new CompilerError("Unable to initialize compiler. " + e.GetType().Name + ": " + e.Message)); }
return false;
}
try { try {
// Write lump data to temp script file in compiler's temp directory // Write lump data to temp script file in compiler's temp directory
inputfile = General.MakeTempFilename(compiler.Location, "tmp"); inputfile = General.MakeTempFilename(compiler.Location, "tmp");
lump.Stream.Seek(0, SeekOrigin.Begin); lump.Stream.Seek(0, SeekOrigin.Begin);
BinaryReader reader = new BinaryReader(lump.Stream); BinaryReader reader = new BinaryReader(lump.Stream);
File.WriteAllBytes(inputfile, reader.ReadBytes((int)lump.Stream.Length)); File.WriteAllBytes(inputfile, reader.ReadBytes((int)lump.Stream.Length));
} catch (Exception e) { } catch(Exception e) {
// Fail // Fail
compiler.Dispose(); compiler.Dispose();
errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message)); errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message));
return false; return false;
} }
// Make random output filename // Make random output filename
outputfile = General.MakeTempFilename(compiler.Location, "tmp"); outputfile = General.MakeTempFilename(compiler.Location, "tmp");
// Run compiler // Run compiler
compiler.Parameters = scriptconfig.Parameters; compiler.Parameters = scriptconfig.Parameters;
compiler.InputFile = Path.GetFileName(inputfile); compiler.InputFile = Path.GetFileName(inputfile);
compiler.OutputFile = Path.GetFileName(outputfile); compiler.OutputFile = Path.GetFileName(outputfile);
compiler.SourceFile = sourcefile; compiler.SourceFile = sourcefile;
compiler.WorkingDirectory = Path.GetDirectoryName(inputfile); compiler.WorkingDirectory = Path.GetDirectoryName(inputfile);
if (compiler.Run()) { if(compiler.Run()) {
// Process errors // Process errors
foreach (CompilerError e in compiler.Errors) { foreach(CompilerError e in compiler.Errors) {
CompilerError newerror = e; CompilerError newerror = e;
// If the error's filename equals our temporary file, // If the error's filename equals our temporary file,
// use the lump name instead and prefix it with ? // use the lump name instead and prefix it with ?
if (string.Compare(e.filename, inputfile, true) == 0) if(string.Compare(e.filename, inputfile, true) == 0)
newerror.filename = "?" + reallumpname; newerror.filename = "?" + reallumpname;
errors.Add(newerror); errors.Add(newerror);
} }
// No errors? // No errors?
if (compiler.Errors.Length == 0) { if(compiler.Errors.Length == 0) {
// Output file exists? // Output file exists?
if (File.Exists(outputfile)) { if(File.Exists(outputfile)) {
// Copy output file data into a lump? // Copy output file data into a lump?
if (!string.IsNullOrEmpty(scriptconfig.ResultLump)) { if(!string.IsNullOrEmpty(scriptconfig.ResultLump)) {
// Do that now then // Do that now then
try { try {
filedata = File.ReadAllBytes(outputfile); filedata = File.ReadAllBytes(outputfile);
} catch (Exception e) { } catch(Exception e) {
// Fail // Fail
compiler.Dispose(); compiler.Dispose();
errors.Add(new CompilerError("Unable to read compiler output file. " + e.GetType().Name + ": " + e.Message)); errors.Add(new CompilerError("Unable to read compiler output file. " + e.GetType().Name + ": " + e.Message));
return false; return false;
} }
// Store data // Store data
MemoryStream stream = new MemoryStream(filedata); MemoryStream stream = new MemoryStream(filedata);
SetLumpData(scriptconfig.ResultLump, stream); SetLumpData(scriptconfig.ResultLump, stream);
} }
} }
} }
// Clean up // Clean up
compiler.Dispose(); compiler.Dispose();
// Done // Done
return true; return true;
} else { }
// Fail
compiler.Dispose(); // Fail
errors = null; compiler.Dispose();
return false; errors = null;
} return false;
} else {
// No compiler to run for this script type
return true;
}
} }
// This clears all compiler errors // This clears all compiler errors
@ -1425,7 +1437,16 @@ namespace CodeImp.DoomBuilder {
AcsParserSE parser = new AcsParserSE(); AcsParserSE parser = new AcsParserSE();
parser.OnInclude = updateScriptsFromLocation; parser.OnInclude = updateScriptsFromLocation;
parser.Parse(stream, "SCRIPTS", true); parser.Parse(stream, "SCRIPTS", true);
namedScripts.AddRange(parser.NamedScripts);
if(parser.NamedScripts.Count > 0 && (FormatInterface is DoomMapSetIO || FormatInterface is HexenMapSetIO)) {
List<string> names = new List<string>();
foreach(ScriptItem item in parser.NamedScripts)
names.Add("'" + item.Name + "'");
General.ErrorLogger.Add(ErrorType.Warning, "Current map format doesn't support named scripts! Following scripts will not work:" + string.Join(", ", names.ToArray()));
} else {
namedScripts.AddRange(parser.NamedScripts);
}
numberedScripts.AddRange(parser.NumberedScripts); numberedScripts.AddRange(parser.NumberedScripts);
scriptincludes.AddRange(parser.Includes); scriptincludes.AddRange(parser.Includes);
} }
@ -1611,6 +1632,10 @@ namespace CodeImp.DoomBuilder {
General.WriteLogLine("Initializing map format interface " + config.FormatInterface + "..."); General.WriteLogLine("Initializing map format interface " + config.FormatInterface + "...");
io = MapSetIO.Create(config.FormatInterface, tempwad, this); io = MapSetIO.Create(config.FormatInterface, tempwad, this);
//mxd. Some lumps may've become unneeded during map format conversion.
if(oldFormatInterface != config.FormatInterface)
removeUnneededLumps(tempwad, TEMP_MAP_HEADER);
// Create required lumps if they don't exist yet // Create required lumps if they don't exist yet
CreateRequiredLumps(tempwad, TEMP_MAP_HEADER); CreateRequiredLumps(tempwad, TEMP_MAP_HEADER);
@ -1626,6 +1651,7 @@ namespace CodeImp.DoomBuilder {
foreach(Thing t in General.Map.Map.Things) t.TranslateToUDMF(); foreach(Thing t in General.Map.Map.Things) t.TranslateToUDMF();
} }
General.Map.Map.UpdateCustomLinedefColors(); General.Map.Map.UpdateCustomLinedefColors();
UpdateScriptNames(); //mxd
// Update interface // Update interface
General.MainWindow.SetupInterface(); General.MainWindow.SetupInterface();

View file

@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Variables #region ================== Variables
private Stream stream; //private Stream stream;
private BinaryWriter writer; private BinaryWriter writer;
private Dictionary<string, ushort> stringstable; private Dictionary<string, ushort> stringstable;
@ -50,7 +50,7 @@ namespace CodeImp.DoomBuilder.IO
public SerializerStream(Stream stream) public SerializerStream(Stream stream)
{ {
// Initialize // Initialize
this.stream = stream; //this.stream = stream;
this.writer = new BinaryWriter(stream); this.writer = new BinaryWriter(stream);
this.stringstable = new Dictionary<string, ushort>(); this.stringstable = new Dictionary<string, ushort>();
} }

View file

@ -68,6 +68,18 @@ openmap
allowscroll = false; allowscroll = false;
} }
//mxd
openmapincurrentwad
{
title = "Open Map in current WAD";
category = "file";
description = "Opens an existing map from already loaded WAD file for viewing or modifying.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
default = 196687; //Ctrl-Shift-O
}
closemap closemap
{ {
title = "Close Map"; title = "Close Map";

View file

@ -47,7 +47,7 @@ namespace CodeImp.DoomBuilder.VisualModes
// Graphics // Graphics
protected IRenderer3D renderer; protected IRenderer3D renderer;
private Renderer3D renderer3d; //private Renderer3D renderer3d;
// Options // Options
private bool processgeometry; private bool processgeometry;
@ -101,7 +101,7 @@ namespace CodeImp.DoomBuilder.VisualModes
{ {
// Initialize // Initialize
this.renderer = General.Map.Renderer3D; this.renderer = General.Map.Renderer3D;
this.renderer3d = (Renderer3D)General.Map.Renderer3D; //this.renderer3d = (Renderer3D)General.Map.Renderer3D;
this.blockmap = new VisualBlockMap(); this.blockmap = new VisualBlockMap();
this.allsectors = new Dictionary<Sector, VisualSector>(General.Map.Map.Sectors.Count); this.allsectors = new Dictionary<Sector, VisualSector>(General.Map.Map.Sectors.Count);
this.allthings = new Dictionary<Thing,VisualThing>(General.Map.Map.Things.Count); this.allthings = new Dictionary<Thing,VisualThing>(General.Map.Map.Things.Count);

View file

@ -1,3 +1,5 @@
using CodeImp.DoomBuilder.Controls;
namespace CodeImp.DoomBuilder.Windows namespace CodeImp.DoomBuilder.Windows
{ {
partial class MainForm partial class MainForm
@ -51,6 +53,7 @@ namespace CodeImp.DoomBuilder.Windows
this.menufile = new System.Windows.Forms.ToolStripMenuItem(); this.menufile = new System.Windows.Forms.ToolStripMenuItem();
this.itemnewmap = new System.Windows.Forms.ToolStripMenuItem(); this.itemnewmap = new System.Windows.Forms.ToolStripMenuItem();
this.itemopenmap = new System.Windows.Forms.ToolStripMenuItem(); this.itemopenmap = new System.Windows.Forms.ToolStripMenuItem();
this.itemopenmapincurwad = new System.Windows.Forms.ToolStripMenuItem();
this.itemclosemap = new System.Windows.Forms.ToolStripMenuItem(); this.itemclosemap = new System.Windows.Forms.ToolStripMenuItem();
this.itemsavemap = new System.Windows.Forms.ToolStripMenuItem(); this.itemsavemap = new System.Windows.Forms.ToolStripMenuItem();
this.itemsavemapas = new System.Windows.Forms.ToolStripMenuItem(); this.itemsavemapas = new System.Windows.Forms.ToolStripMenuItem();
@ -295,13 +298,13 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.seperatorfileopen.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); this.seperatorfileopen.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.seperatorfileopen.Name = "seperatorfileopen"; this.seperatorfileopen.Name = "seperatorfileopen";
this.seperatorfileopen.Size = new System.Drawing.Size(199, 6); this.seperatorfileopen.Size = new System.Drawing.Size(220, 6);
// //
// seperatorfilerecent // seperatorfilerecent
// //
this.seperatorfilerecent.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); this.seperatorfilerecent.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.seperatorfilerecent.Name = "seperatorfilerecent"; this.seperatorfilerecent.Name = "seperatorfilerecent";
this.seperatorfilerecent.Size = new System.Drawing.Size(199, 6); this.seperatorfilerecent.Size = new System.Drawing.Size(220, 6);
// //
// seperatoreditgrid // seperatoreditgrid
// //
@ -379,6 +382,7 @@ namespace CodeImp.DoomBuilder.Windows
this.menufile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menufile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.itemnewmap, this.itemnewmap,
this.itemopenmap, this.itemopenmap,
this.itemopenmapincurwad,
this.itemclosemap, this.itemclosemap,
this.seperatorfileopen, this.seperatorfileopen,
this.itemsavemap, this.itemsavemap,
@ -397,7 +401,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.File; this.itemnewmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.File;
this.itemnewmap.Name = "itemnewmap"; this.itemnewmap.Name = "itemnewmap";
this.itemnewmap.ShortcutKeyDisplayString = ""; this.itemnewmap.ShortcutKeyDisplayString = "";
this.itemnewmap.Size = new System.Drawing.Size(202, 22); this.itemnewmap.Size = new System.Drawing.Size(223, 22);
this.itemnewmap.Tag = "builder_newmap"; this.itemnewmap.Tag = "builder_newmap";
this.itemnewmap.Text = "&New Map"; this.itemnewmap.Text = "&New Map";
this.itemnewmap.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemnewmap.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -406,15 +410,23 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.itemopenmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.OpenMap; this.itemopenmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.OpenMap;
this.itemopenmap.Name = "itemopenmap"; this.itemopenmap.Name = "itemopenmap";
this.itemopenmap.Size = new System.Drawing.Size(202, 22); this.itemopenmap.Size = new System.Drawing.Size(223, 22);
this.itemopenmap.Tag = "builder_openmap"; this.itemopenmap.Tag = "builder_openmap";
this.itemopenmap.Text = "&Open Map..."; this.itemopenmap.Text = "&Open Map...";
this.itemopenmap.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemopenmap.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// itemopenmapincurwad
//
this.itemopenmapincurwad.Name = "itemopenmapincurwad";
this.itemopenmapincurwad.Size = new System.Drawing.Size(223, 22);
this.itemopenmapincurwad.Tag = "builder_openmapincurrentwad";
this.itemopenmapincurwad.Text = "Open Map in current &WAD...";
this.itemopenmapincurwad.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemclosemap // itemclosemap
// //
this.itemclosemap.Name = "itemclosemap"; this.itemclosemap.Name = "itemclosemap";
this.itemclosemap.Size = new System.Drawing.Size(202, 22); this.itemclosemap.Size = new System.Drawing.Size(223, 22);
this.itemclosemap.Tag = "builder_closemap"; this.itemclosemap.Tag = "builder_closemap";
this.itemclosemap.Text = "&Close Map"; this.itemclosemap.Text = "&Close Map";
this.itemclosemap.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemclosemap.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -423,7 +435,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.itemsavemap.Image = global::CodeImp.DoomBuilder.Properties.Resources.SaveMap; this.itemsavemap.Image = global::CodeImp.DoomBuilder.Properties.Resources.SaveMap;
this.itemsavemap.Name = "itemsavemap"; this.itemsavemap.Name = "itemsavemap";
this.itemsavemap.Size = new System.Drawing.Size(202, 22); this.itemsavemap.Size = new System.Drawing.Size(223, 22);
this.itemsavemap.Tag = "builder_savemap"; this.itemsavemap.Tag = "builder_savemap";
this.itemsavemap.Text = "&Save Map"; this.itemsavemap.Text = "&Save Map";
this.itemsavemap.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemsavemap.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -431,7 +443,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemsavemapas // itemsavemapas
// //
this.itemsavemapas.Name = "itemsavemapas"; this.itemsavemapas.Name = "itemsavemapas";
this.itemsavemapas.Size = new System.Drawing.Size(202, 22); this.itemsavemapas.Size = new System.Drawing.Size(223, 22);
this.itemsavemapas.Tag = "builder_savemapas"; this.itemsavemapas.Tag = "builder_savemapas";
this.itemsavemapas.Text = "Save Map &As..."; this.itemsavemapas.Text = "Save Map &As...";
this.itemsavemapas.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemsavemapas.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -439,7 +451,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemsavemapinto // itemsavemapinto
// //
this.itemsavemapinto.Name = "itemsavemapinto"; this.itemsavemapinto.Name = "itemsavemapinto";
this.itemsavemapinto.Size = new System.Drawing.Size(202, 22); this.itemsavemapinto.Size = new System.Drawing.Size(223, 22);
this.itemsavemapinto.Tag = "builder_savemapinto"; this.itemsavemapinto.Tag = "builder_savemapinto";
this.itemsavemapinto.Text = "Save Map &Into..."; this.itemsavemapinto.Text = "Save Map &Into...";
this.itemsavemapinto.Click += new System.EventHandler(this.InvokeTaggedAction); this.itemsavemapinto.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -448,19 +460,19 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.seperatorfilesave.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); this.seperatorfilesave.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.seperatorfilesave.Name = "seperatorfilesave"; this.seperatorfilesave.Name = "seperatorfilesave";
this.seperatorfilesave.Size = new System.Drawing.Size(199, 6); this.seperatorfilesave.Size = new System.Drawing.Size(220, 6);
// //
// itemnorecent // itemnorecent
// //
this.itemnorecent.Enabled = false; this.itemnorecent.Enabled = false;
this.itemnorecent.Name = "itemnorecent"; this.itemnorecent.Name = "itemnorecent";
this.itemnorecent.Size = new System.Drawing.Size(202, 22); this.itemnorecent.Size = new System.Drawing.Size(223, 22);
this.itemnorecent.Text = "No recently opened files"; this.itemnorecent.Text = "No recently opened files";
// //
// itemexit // itemexit
// //
this.itemexit.Name = "itemexit"; this.itemexit.Name = "itemexit";
this.itemexit.Size = new System.Drawing.Size(202, 22); this.itemexit.Size = new System.Drawing.Size(223, 22);
this.itemexit.Text = "E&xit"; this.itemexit.Text = "E&xit";
this.itemexit.Click += new System.EventHandler(this.itemexit_Click); this.itemexit.Click += new System.EventHandler(this.itemexit_Click);
// //
@ -2530,5 +2542,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editAreaScreenshotToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editAreaScreenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem itemShortcutReference; private System.Windows.Forms.ToolStripMenuItem itemShortcutReference;
private System.Windows.Forms.ToolStripMenuItem itemopenmapincurwad;
} }
} }

View file

@ -2124,6 +2124,7 @@ namespace CodeImp.DoomBuilder.Windows
itemsavemapas.Enabled = (General.Map != null); itemsavemapas.Enabled = (General.Map != null);
itemsavemapinto.Enabled = (General.Map != null); itemsavemapinto.Enabled = (General.Map != null);
itemtestmap.Enabled = (General.Map != null); itemtestmap.Enabled = (General.Map != null);
itemopenmapincurwad.Enabled = (General.Map != null); //mxd
// Toolbar icons // Toolbar icons
buttonnewmap.Enabled = itemnewmap.Enabled; buttonnewmap.Enabled = itemnewmap.Enabled;

View file

@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
#region ================== Variables #region ================== Variables
private PreferencesController controller; //private PreferencesController controller;
#endregion #endregion
@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This sets up the form with the preferences controller // This sets up the form with the preferences controller
public void Setup(PreferencesController controller) public void Setup(PreferencesController controller)
{ {
this.controller = controller; //this.controller = controller;
// Add tab pages // Add tab pages
foreach(TabPage p in tabs.TabPages) foreach(TabPage p in tabs.TabPages)

View file

@ -287,12 +287,11 @@ namespace CodeImp.DoomBuilder.ColorPicker.Windows {
//this is called only once //this is called only once
private Color getThingColor(Thing thing) { private Color getThingColor(Thing thing) {
if (thing.Type == 1502) { //vavoom light if (thing.Type == 1502) //vavoom light
return Color.White; return Color.White;
} else if (thing.Type == 1503) { //vavoom colored light if (thing.Type == 1503) //vavoom colored light
return Color.FromArgb((byte)thing.Args[1], (byte)thing.Args[2], (byte)thing.Args[3]); return Color.FromArgb((byte)thing.Args[1], (byte)thing.Args[2], (byte)thing.Args[3]);
} return Color.FromArgb((byte)thing.Args[0], (byte)thing.Args[1], (byte)thing.Args[2]);
return Color.FromArgb((byte)thing.Args[0], (byte)thing.Args[1], (byte)thing.Args[2]); ;
} }
//this sets data to use as a reference for relative mode //this sets data to use as a reference for relative mode