mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-18 18:11:13 +00:00
Changed: both DoomTexture and DoomFlat formats should be checked when determining an image format if "Mix textures and flats" flag is set.
Changed: "imgz" images are now skipped while loading textures.
This commit is contained in:
parent
8b0f973b94
commit
10da128475
8 changed files with 29 additions and 21 deletions
|
@ -88,6 +88,14 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
data.Seek(0, SeekOrigin.Begin);
|
data.Seek(0, SeekOrigin.Begin);
|
||||||
DoomPictureReader picreader = new DoomPictureReader(palette);
|
DoomPictureReader picreader = new DoomPictureReader(palette);
|
||||||
if(picreader.Validate(data)) return picreader;
|
if(picreader.Validate(data)) return picreader;
|
||||||
|
|
||||||
|
// Also check if data is valid for a doom flat... (mxd)
|
||||||
|
if (General.Map.Config.MixTexturesFlats)
|
||||||
|
{
|
||||||
|
data.Seek(0, SeekOrigin.Begin);
|
||||||
|
DoomFlatReader flatpicreader = new DoomFlatReader(palette);
|
||||||
|
if(flatpicreader.Validate(data)) return flatpicreader;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DOOMFLAT:
|
case DOOMFLAT:
|
||||||
|
@ -95,6 +103,14 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
data.Seek(0, SeekOrigin.Begin);
|
data.Seek(0, SeekOrigin.Begin);
|
||||||
DoomFlatReader flatreader = new DoomFlatReader(palette);
|
DoomFlatReader flatreader = new DoomFlatReader(palette);
|
||||||
if(flatreader.Validate(data)) return flatreader;
|
if(flatreader.Validate(data)) return flatreader;
|
||||||
|
|
||||||
|
// Also check if data is valid for a doom picture... (mxd)
|
||||||
|
if (General.Map.Config.MixTexturesFlats)
|
||||||
|
{
|
||||||
|
data.Seek(0, SeekOrigin.Begin);
|
||||||
|
DoomPictureReader picflatreader = new DoomPictureReader(palette);
|
||||||
|
if(picflatreader.Validate(data)) return picflatreader;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DOOMCOLORMAP:
|
case DOOMCOLORMAP:
|
||||||
|
|
|
@ -630,6 +630,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
string[] files = GetAllFiles(path, includesubdirs);
|
string[] files = GetAllFiles(path, includesubdirs);
|
||||||
foreach(string f in files)
|
foreach(string f in files)
|
||||||
{
|
{
|
||||||
|
//mxd. Skip IMGZ files
|
||||||
|
if(Path.GetExtension(f).ToUpperInvariant() == ".IMGZ") continue;
|
||||||
|
|
||||||
// Make the texture name from filename without extension
|
// Make the texture name from filename without extension
|
||||||
name = Path.GetFileNameWithoutExtension(f);
|
name = Path.GetFileNameWithoutExtension(f);
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
// Palette to use
|
// Palette to use
|
||||||
private Playpal palette;
|
private readonly Playpal palette;
|
||||||
public uint ImageType { get; private set; } //mxd
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
this.palette = palette;
|
this.palette = palette;
|
||||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
|
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
// Palette to use
|
// Palette to use
|
||||||
private Playpal palette;
|
private readonly Playpal palette;
|
||||||
public uint ImageType { get; private set; } //mxd
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
this.palette = palette;
|
this.palette = palette;
|
||||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
// Palette to use
|
// Palette to use
|
||||||
private Playpal palette;
|
private readonly Playpal palette;
|
||||||
public uint ImageType { get; private set; } //mxd
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
this.palette = palette;
|
this.palette = palette;
|
||||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
|
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
@ -342,7 +342,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
private const int IL_IMAGE_CHANNELS = 0x0DFF;*/
|
private const int IL_IMAGE_CHANNELS = 0x0DFF;*/
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public uint ImageType { get; private set; }
|
private readonly uint imagetype;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -351,15 +351,16 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
// Constructor
|
// Constructor
|
||||||
public FileImageReader()
|
public FileImageReader()
|
||||||
{
|
{
|
||||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
imagetype = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public FileImageReader(uint devilImageType) {
|
public FileImageReader(uint devilImagetype)
|
||||||
ImageType = devilImageType;//mxd
|
{
|
||||||
|
imagetype = devilImagetype;//mxd
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
@ -394,7 +395,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
stream.Read(bytes, 0, bytes.Length);
|
stream.Read(bytes, 0, bytes.Length);
|
||||||
fixed(byte* bptr = bytes)
|
fixed(byte* bptr = bytes)
|
||||||
{
|
{
|
||||||
if (!ilLoadL(ImageType, new IntPtr(bptr), (uint)bytes.Length))
|
if (!ilLoadL(imagetype, new IntPtr(bptr), (uint)bytes.Length))
|
||||||
throw new BadImageFormatException();
|
throw new BadImageFormatException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +418,7 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
ilDeleteImages(1, new IntPtr(&imageid));
|
ilDeleteImages(1, new IntPtr(&imageid));
|
||||||
|
|
||||||
//mxd. TGA fix
|
//mxd. TGA fix
|
||||||
if (ImageType == DevilImageType.IL_TGA)
|
if (imagetype == DevilImageType.IL_TGA)
|
||||||
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||||
|
|
||||||
return bmp;
|
return bmp;
|
||||||
|
|
|
@ -26,9 +26,6 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
{
|
{
|
||||||
internal unsafe interface IImageReader
|
internal unsafe interface IImageReader
|
||||||
{
|
{
|
||||||
//mxd. Variables
|
|
||||||
uint ImageType { get; } //holds Devil library Image type
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
Bitmap ReadAsBitmap(Stream stream);
|
Bitmap ReadAsBitmap(Stream stream);
|
||||||
Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety);
|
Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety);
|
||||||
|
|
|
@ -28,14 +28,11 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
{
|
{
|
||||||
internal class UnknownImageReader : IImageReader
|
internal class UnknownImageReader : IImageReader
|
||||||
{
|
{
|
||||||
public uint ImageType { get; private set; } //mxd
|
|
||||||
|
|
||||||
#region ================== Constructor / Disposer
|
#region ================== Constructor / Disposer
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public UnknownImageReader()
|
public UnknownImageReader()
|
||||||
{
|
{
|
||||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue