mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +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);
|
||||
DoomPictureReader picreader = new DoomPictureReader(palette);
|
||||
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;
|
||||
|
||||
case DOOMFLAT:
|
||||
|
@ -95,6 +103,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
data.Seek(0, SeekOrigin.Begin);
|
||||
DoomFlatReader flatreader = new DoomFlatReader(palette);
|
||||
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;
|
||||
|
||||
case DOOMCOLORMAP:
|
||||
|
|
|
@ -630,6 +630,9 @@ namespace CodeImp.DoomBuilder.Data
|
|||
string[] files = GetAllFiles(path, includesubdirs);
|
||||
foreach(string f in files)
|
||||
{
|
||||
//mxd. Skip IMGZ files
|
||||
if(Path.GetExtension(f).ToUpperInvariant() == ".IMGZ") continue;
|
||||
|
||||
// Make the texture name from filename without extension
|
||||
name = Path.GetFileNameWithoutExtension(f);
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
#region ================== Variables
|
||||
|
||||
// Palette to use
|
||||
private Playpal palette;
|
||||
public uint ImageType { get; private set; } //mxd
|
||||
private readonly Playpal palette;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{
|
||||
// Initialize
|
||||
this.palette = palette;
|
||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
#region ================== Variables
|
||||
|
||||
// Palette to use
|
||||
private Playpal palette;
|
||||
public uint ImageType { get; private set; } //mxd
|
||||
private readonly Playpal palette;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{
|
||||
// Initialize
|
||||
this.palette = palette;
|
||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
|
@ -32,8 +32,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
#region ================== Variables
|
||||
|
||||
// Palette to use
|
||||
private Playpal palette;
|
||||
public uint ImageType { get; private set; } //mxd
|
||||
private readonly Playpal palette;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -44,7 +43,6 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{
|
||||
// Initialize
|
||||
this.palette = palette;
|
||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN; //mxd
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
|
@ -342,7 +342,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
private const int IL_IMAGE_CHANNELS = 0x0DFF;*/
|
||||
|
||||
//mxd
|
||||
public uint ImageType { get; private set; }
|
||||
private readonly uint imagetype;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -351,15 +351,16 @@ namespace CodeImp.DoomBuilder.IO
|
|||
// Constructor
|
||||
public FileImageReader()
|
||||
{
|
||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
||||
imagetype = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public FileImageReader(uint devilImageType) {
|
||||
ImageType = devilImageType;//mxd
|
||||
public FileImageReader(uint devilImagetype)
|
||||
{
|
||||
imagetype = devilImagetype;//mxd
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -394,7 +395,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
stream.Read(bytes, 0, bytes.Length);
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -417,7 +418,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
ilDeleteImages(1, new IntPtr(&imageid));
|
||||
|
||||
//mxd. TGA fix
|
||||
if (ImageType == DevilImageType.IL_TGA)
|
||||
if (imagetype == DevilImageType.IL_TGA)
|
||||
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
|
||||
return bmp;
|
||||
|
|
|
@ -26,9 +26,6 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{
|
||||
internal unsafe interface IImageReader
|
||||
{
|
||||
//mxd. Variables
|
||||
uint ImageType { get; } //holds Devil library Image type
|
||||
|
||||
// Methods
|
||||
Bitmap ReadAsBitmap(Stream stream);
|
||||
Bitmap ReadAsBitmap(Stream stream, out int offsetx, out int offsety);
|
||||
|
|
|
@ -28,14 +28,11 @@ namespace CodeImp.DoomBuilder.IO
|
|||
{
|
||||
internal class UnknownImageReader : IImageReader
|
||||
{
|
||||
public uint ImageType { get; private set; } //mxd
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public UnknownImageReader()
|
||||
{
|
||||
ImageType = DevilImageType.IL_TYPE_UNKNOWN;//mxd
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue