Merged in GZDB r2500.

This commit is contained in:
MascaraSnake 2016-04-08 19:50:00 +02:00
parent 2dba78a3d2
commit ea2d439b87
3 changed files with 60 additions and 33 deletions

View file

@ -33,7 +33,8 @@ namespace CodeImp.DoomBuilder.Data
// Members // Members
public int type; public int type;
public string location; public string location;
public bool option1; private string name; //mxd
public bool option1;
public bool option2; public bool option2;
public bool notfortesting; public bool notfortesting;
@ -46,7 +47,8 @@ namespace CodeImp.DoomBuilder.Data
this.option1 = option1; this.option1 = option1;
this.option2 = option2; this.option2 = option2;
this.notfortesting = notfortesting; this.notfortesting = notfortesting;
} this.name = string.Empty; //mxd
}
// This displays the struct as string // This displays the struct as string
public override string ToString() public override string ToString()
@ -55,8 +57,33 @@ namespace CodeImp.DoomBuilder.Data
return location; return location;
} }
// This compares two locations //mxd. This returns short location name
public int CompareTo(DataLocation other) public string GetShortName()
{
if (string.IsNullOrEmpty(name))
{
// Make shorter name for display purposes
switch (type)
{
case RESOURCE_DIRECTORY:
name = location.Substring(location.LastIndexOf(Path.DirectorySeparatorChar) + 1);
break;
case RESOURCE_WAD:
case RESOURCE_PK3:
name = Path.GetFileName(location);
break;
default:
throw new NotImplementedException("Unknown location type: " + type);
}
}
return name;
}
// This compares two locations
public int CompareTo(DataLocation other)
{ {
return string.Compare(this.location, other.location, true); return string.Compare(this.location, other.location, true);
} }
@ -88,8 +115,8 @@ namespace CodeImp.DoomBuilder.Data
break; break;
default: default:
throw new NotImplementedException("ResourceListEditor.FixedResourceLocationList: got unknown location type: " + type); throw new NotImplementedException("Unknown location type: " + type);
} }
return true; return true;
} }

View file

@ -1521,10 +1521,10 @@ namespace CodeImp.DoomBuilder.Data
{ {
// Parse the data // Parse the data
group.Value.Seek(0, SeekOrigin.Begin); group.Value.Seek(0, SeekOrigin.Begin);
decorate.Parse(group.Value, group.Key, true); decorate.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
//mxd. DECORATE lumps are interdepandable. Can't carry on... //mxd. DECORATE lumps are interdepandable. Can't carry on...
if(decorate.HasError) if (decorate.HasError)
{ {
decorate.LogError(); //mxd decorate.LogError(); //mxd
return counter; return counter;
@ -1850,11 +1850,11 @@ namespace CodeImp.DoomBuilder.Data
Dictionary<string, Stream> decostreams = currentreader.GetDecorateData(location); Dictionary<string, Stream> decostreams = currentreader.GetDecorateData(location);
foreach(KeyValuePair<string, Stream> group in decostreams) foreach(KeyValuePair<string, Stream> group in decostreams)
{ {
// Parse this data // Parse this data
parser.Parse(group.Value, Path.Combine(currentreader.Location.location, group.Key), false); parser.Parse(group.Value, group.Key, false);
//mxd. DECORATE lumps are interdepandable. Can't carry on... //mxd. DECORATE lumps are interdepandable. Can't carry on...
if(parser.HasError) if (parser.HasError)
{ {
parser.LogError(); parser.LogError();
return; return;
@ -1995,7 +1995,7 @@ namespace CodeImp.DoomBuilder.Data
foreach(KeyValuePair<string, Stream> group in streams) foreach(KeyValuePair<string, Stream> group in streams)
{ {
// Parse the data // Parse the data
if(parser.Parse(group.Value, Path.Combine(currentreader.Location.location, group.Key), true)) if (parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true))
{ {
foreach(KeyValuePair<string, ModelData> g in parser.Entries) foreach(KeyValuePair<string, ModelData> g in parser.Entries)
{ {
@ -2078,8 +2078,8 @@ namespace CodeImp.DoomBuilder.Data
KeyValuePair<string, Stream> group = dr.GetVoxeldefData(); KeyValuePair<string, Stream> group = dr.GetVoxeldefData();
if(group.Value != null) if(group.Value != null)
{ {
if(parser.Parse(group.Value, group.Key, true)) if (parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true))
{ {
foreach(KeyValuePair<string, ModelData> entry in parser.Entries) foreach(KeyValuePair<string, ModelData> entry in parser.Entries)
{ {
foreach(KeyValuePair<string, List<int>> sc in sprites) foreach(KeyValuePair<string, List<int>> sc in sprites)
@ -2135,10 +2135,10 @@ namespace CodeImp.DoomBuilder.Data
foreach(KeyValuePair<string, Stream> group in streams) foreach(KeyValuePair<string, Stream> group in streams)
{ {
parser.Parse(group.Value, group.Key, false); parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), false);
// Gldefs can be interdependable. Can't carry on // Gldefs can be interdependable. Can't carry on
if(parser.HasError) if (parser.HasError)
{ {
parser.LogError(); parser.LogError();
return; return;
@ -2272,11 +2272,11 @@ namespace CodeImp.DoomBuilder.Data
Dictionary<string, Stream> streams = dr.GetReverbsData(); Dictionary<string, Stream> streams = dr.GetReverbsData();
foreach(KeyValuePair<string, Stream> group in streams) foreach(KeyValuePair<string, Stream> group in streams)
{ {
// Parse the data // Parse the data
parser.Parse(group.Value, group.Key, true); parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
// Report errors? // Report errors?
if(parser.HasError) parser.LogError(); if (parser.HasError) parser.LogError();
} }
} }
@ -2301,10 +2301,10 @@ namespace CodeImp.DoomBuilder.Data
// Parse the data // Parse the data
foreach(KeyValuePair<string, Stream> group in streams) foreach(KeyValuePair<string, Stream> group in streams)
{ {
parser.Parse(group.Value, group.Key, true); parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
// Report errors? // Report errors?
if(parser.HasError) parser.LogError(); if (parser.HasError) parser.LogError();
} }
} }
@ -2327,10 +2327,10 @@ namespace CodeImp.DoomBuilder.Data
// Parse the data // Parse the data
foreach(KeyValuePair<string, Stream> group in streams) foreach(KeyValuePair<string, Stream> group in streams)
{ {
parser.Parse(group.Value, group.Key, true); parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
// Report errors? // Report errors?
if(parser.HasError) parser.LogError(); if (parser.HasError) parser.LogError();
// Create images // Create images
foreach(var g in parser.CameraTextures) foreach(var g in parser.CameraTextures)

View file

@ -200,8 +200,8 @@ namespace CodeImp.DoomBuilder.Data
if(General.Map.Config.MixTexturesFlats) if(General.Map.Config.MixTexturesFlats)
{ {
ImageData img = General.Map.Data.GetTextureImage(p.lumpname); ImageData img = General.Map.Data.GetTextureImage(p.lumpname);
if(!(img is UnknownImage)) if (!(img is UnknownImage) && img != this)
{ {
if(!img.IsImageLoaded) img.LoadImage(); if(!img.IsImageLoaded) img.LoadImage();
//mxd. Apply transformations from TexturePatch. We don't want to modify the original bitmap here, so make a copy //mxd. Apply transformations from TexturePatch. We don't want to modify the original bitmap here, so make a copy