Map saving: map lumps position in the wad is now kept persistent when saving it (previously / in DB2 map lumps were always pushed to the end of the wad when saving it).

Internal: added NeutralResourcesLanguageAttribute to all assemblies. Theoretically this should result in a bit better performance when accessing embedded resources.
Updated ZDoom_DECORATE.cfg (A_Chase flags).
This commit is contained in:
MaxED 2016-03-17 23:58:08 +00:00
parent adadca9d99
commit 476ccb5561
11 changed files with 60 additions and 20 deletions

View file

@ -1089,6 +1089,11 @@ constants
CHF_NIGHTMAREFAST;
CHF_NOPLAYACTIVE;
CHF_RESURRECT;
CHF_NORANDOMTURN;
CHF_NODIRECTIONTURN;
CHF_NOPOSTATTACKTURN;
CHF_STOPIFBLOCKED;
CHF_DONTTURN;
CLOFF_AIM_VERT_NOOFFSET;
CLOFF_ALLOWNULL;
CLOFF_BEYONDTARGET;

View file

@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder
internal const string TEMP_MAP_HEADER = "TEMPMAP";
internal const string BUILD_MAP_HEADER = "MAP01";
public const string CONFIG_MAP_HEADER = "~MAP";
private const int REPLACE_TARGET_MAP = -1; //mxd
#endregion
@ -398,8 +399,7 @@ namespace CodeImp.DoomBuilder
// Copy the map lumps to the temp file
General.WriteLogLine("Copying map lumps to temporary file...");
CopyLumpsByType(mapwad, options.CurrentName, tempwad, TEMP_MAP_HEADER,
true, true, true, true);
CopyLumpsByType(mapwad, options.CurrentName, tempwad, TEMP_MAP_HEADER, REPLACE_TARGET_MAP, true, true, true, true);
// Close the map file
mapwad.Dispose();
@ -502,7 +502,7 @@ namespace CodeImp.DoomBuilder
// Copy the map lumps to the temp file
General.WriteLogLine("Copying map lumps to temporary file...");
CopyLumpsByType(mapwad, options.CurrentName, tempwad, TEMP_MAP_HEADER, true, true, true, true);
CopyLumpsByType(mapwad, options.CurrentName, tempwad, TEMP_MAP_HEADER, REPLACE_TARGET_MAP, true, true, true, true);
// Close the map file
mapwad.Dispose();
@ -871,6 +871,7 @@ namespace CodeImp.DoomBuilder
// Determine original map name
string origmapname = (!string.IsNullOrEmpty(options.PreviousName) && purpose != SavePurpose.IntoFile) ? options.PreviousName : options.CurrentName;
string origwadfile = string.Empty; //mxd
int mapheaderindex = REPLACE_TARGET_MAP; //mxd. Lump index of the map file header in the source WAD
try
{
@ -942,7 +943,7 @@ namespace CodeImp.DoomBuilder
origcfg = new GameConfiguration(ci.Configuration);
}
CopyAllLumpsExceptMap(origwad, targetwad, origcfg, origmapname);
mapheaderindex = CopyAllLumpsExceptMap(origwad, targetwad, origcfg, origmapname);
// Close original file and delete it
origwad.Dispose();
@ -979,7 +980,7 @@ namespace CodeImp.DoomBuilder
}
// Copy map lumps to target file
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, targetwad, origmapname, true, true, includenodes, true);
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, targetwad, origmapname, mapheaderindex, true, true, includenodes, true);
// mxd. Was the map renamed?
if(options.LevelNameChanged)
@ -1189,7 +1190,7 @@ namespace CodeImp.DoomBuilder
// 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);
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, buildwad, BUILD_MAP_HEADER, REPLACE_TARGET_MAP, true, false, false, true);
// Close buildwad
buildwad.Dispose();
@ -1234,7 +1235,7 @@ namespace CodeImp.DoomBuilder
{
// Copy nodebuilder lumps to temp file
General.WriteLogLine("Copying nodebuilder lumps to temporary file...");
CopyLumpsByType(buildwad, BUILD_MAP_HEADER, tempwad, TEMP_MAP_HEADER, false, false, true, false);
CopyLumpsByType(buildwad, BUILD_MAP_HEADER, tempwad, TEMP_MAP_HEADER, REPLACE_TARGET_MAP, false, false, true, false);
}
else
{
@ -1426,13 +1427,16 @@ namespace CodeImp.DoomBuilder
foreach(Lump lump in toRemove) target.Remove(lump);
}
// This copies all lumps, except those of a specific map
private static void CopyAllLumpsExceptMap(WAD source, WAD target, GameConfiguration mapconfig, string sourcemapname)
// This copies all lumps, except those of a specific map. mxd. Returns the index of skipped map's header lump
private static int CopyAllLumpsExceptMap(WAD source, WAD target, GameConfiguration mapconfig, string sourcemapname)
{
// Go for all lumps
bool skipping = false;
foreach(Lump srclump in source.Lumps)
int headerpos = REPLACE_TARGET_MAP; //mxd
for(int i = 0; i < source.Lumps.Count; i++)
{
Lump srclump = source.Lumps[i];
// Check if we should stop skipping lumps here
if(skipping)
{
@ -1448,10 +1452,12 @@ namespace CodeImp.DoomBuilder
}
// Check if we should start skipping lumps here
if(!skipping && (srclump.Name == sourcemapname))
//TODO: I see a big, but kinda esoteric problem here if the source has several maps with the same name (mxd)
if(!skipping && headerpos == REPLACE_TARGET_MAP && srclump.Name == sourcemapname)
{
// We have encountered the map header, start skipping!
skipping = true;
headerpos = i;
}
// Not skipping this lump?
@ -1462,16 +1468,20 @@ namespace CodeImp.DoomBuilder
srclump.CopyTo(tgtlump);
}
}
return headerpos;
}
// This copies specific map lumps from one WAD to another
private void CopyLumpsByType(WAD source, string sourcemapname,
WAD target, string targetmapname,
int targetheaderinsertindex, //mxd
bool copyrequired, bool copyblindcopy,
bool copynodebuild, bool copyscript)
{
// Find the map header in target
int tgtheaderindex = target.FindLumpIndex(targetmapname);
// Find the map header in target (mxd. Or use the provided one)
bool replacetargetmap = (targetheaderinsertindex == REPLACE_TARGET_MAP); //mxd
int tgtheaderindex = (replacetargetmap ? target.FindLumpIndex(targetmapname) : targetheaderinsertindex); //mxd
if(tgtheaderindex == -1)
{
// If this header doesnt exists in the target
@ -1501,13 +1511,17 @@ namespace CodeImp.DoomBuilder
int sourceindex = FindSpecificLump(source, srclumpname, srcheaderindex, sourcemapname, config.MapLumps);
if(sourceindex > -1)
{
// Remove lump at target
int lumpindex = RemoveSpecificLump(target, tgtlumpname, tgtheaderindex, targetmapname, config.MapLumps);
//mxd. Don't do this when inserting a map (SaveMap() removes the old version of the map before calling CopyLumpsByType())
if(replacetargetmap)
{
// Remove lump at target
int lumpindex = RemoveSpecificLump(target, tgtlumpname, tgtheaderindex, targetmapname, config.MapLumps);
// Determine target index
// When original lump was found and removed then insert at that position
// otherwise insert after last insertion position
if(lumpindex > -1) targetindex = lumpindex; else targetindex++;
// Determine target index
// When original lump was found and removed then insert at that position
// otherwise insert after last insertion position
if(lumpindex > -1) targetindex = lumpindex; else targetindex++;
}
if(targetindex > target.Lumps.Count) targetindex = target.Lumps.Count;
// Copy the lump to the target
@ -1515,6 +1529,9 @@ namespace CodeImp.DoomBuilder
Lump lump = source.Lumps[sourceindex];
Lump newlump = target.Insert(tgtlumpname, targetindex, lump.Length);
lump.CopyTo(newlump);
//mxd. We still need to increment targetindex...
if(!replacetargetmap) targetindex++;
}
else
{

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -28,4 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2411")]
[assembly: AssemblyVersion("2.3.0.2411")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -33,3 +34,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -29,3 +30,4 @@ using System.Runtime.InteropServices;
// Revision
//
[assembly: AssemblyVersion("2.3.0.2411")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -32,3 +33,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -33,3 +34,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
@ -33,3 +34,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
@ -33,3 +34,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -32,3 +33,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -1,5 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@ -33,3 +34,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]