From 31380b4bb93d1fb65faff8f71753de80fb0a8c9d Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 20 Feb 2012 05:30:01 +0100 Subject: AnmChr/Clr/TexSrt writing done for now. Not 100% perfect but it works! --- NW4RTools/Texture.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'NW4RTools/Texture.cs') 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); -- cgit v1.2.3