diff options
Diffstat (limited to '')
-rw-r--r-- | NW4RTools/Texture.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/NW4RTools/Texture.cs b/NW4RTools/Texture.cs index a328648..f2cf231 100644 --- a/NW4RTools/Texture.cs +++ b/NW4RTools/Texture.cs @@ -63,6 +63,9 @@ namespace NW4RTools { } +#if DEV_DONT_MODIFY_TEXTURE + public byte[][] ImageData; +#endif public Bitmap[] Images; @@ -95,7 +98,11 @@ namespace NW4RTools { } public int GetDataSize(int imageID) { +#if DEV_DONT_MODIFY_TEXTURE + return ImageData[imageID].Length; +#else return GetDataSize(Images[imageID].Width, Images[imageID].Height, Format); +#endif } @@ -104,9 +111,9 @@ namespace NW4RTools { int blkWidth = info.TexelWidth; int blkHeight = info.TexelHeight; - int width = Images[imageID].Width; - int height = Images[imageID].Height; - var bits = Images[imageID].LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + int width = Images [imageID].Width; + int height = Images [imageID].Height; + var bits = Images [imageID].LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); var data = new OutputStream(ByteEndian.BigEndian); @@ -238,7 +245,7 @@ namespace NW4RTools { for (int iBlockX = 0; iBlockX < 2; iBlockX++) { var block = Util.NVDXT.compressDXT1a((Util.NVDXT.ARGBPixel*)bits.Scan0, x + (iBlockX * 4), y + (iBlockY * 4), - bits.Width, bits.Height); + (bits.Stride / 4), bits.Height); data.WriteUInt16(block.Color0); data.WriteUInt16(block.Color1); |