Example #1
0
        internal virtual void ImportBitmap4bpp(Stream iso, string filename, int paletteIndex)
        {
            AbstractSprite sprite = GetAbstractSpriteFromIso(iso);

            byte[]    importBytes       = System.IO.File.ReadAllBytes(filename);
            const int totalPaletteBytes = 32 * 16;

            byte[] originalPaletteBytes = Position.AddOffset(0, totalPaletteBytes - Position.Length).ReadIso(iso);
            sprite.ImportBitmap4bpp(paletteIndex, importBytes, originalPaletteBytes);
            byte[] sprBytes = sprite.ToByteArray(0);
            if (sprBytes.Length > Size)
            {
                throw new SpriteTooLargeException(sprBytes.Length, (int)Size);
            }

            ImportSprite(iso, sprBytes);
        }
        internal override void ImportBitmap4bpp(Stream iso, string filename, int paletteIndex)
        {
            AbstractSprite sprite = GetAbstractSpriteFromIso(iso);

            byte[]    importBytes       = System.IO.File.ReadAllBytes(filename);
            const int totalPaletteBytes = 32 * 16;

            byte[] originalPaletteBytes = Position.AddOffset(0, totalPaletteBytes - Position.Length).ReadIso(iso);
            sprite.ImportBitmap4bpp(paletteIndex, importBytes, originalPaletteBytes);

            byte[] sprBytes = sprite.ToByteArray(0);
            if (sprBytes.Length > Size)
            {
                throw new SpriteTooLargeException(sprBytes.Length, (int)Size);
            }

            //System.IO.File.WriteAllBytes(@"spr4.bin", sprBytes);    // DEBUG
            ImportSprite(iso, sprBytes);
            for (int i = 0; i < NumChildren; i++)
            {
                //System.IO.File.WriteAllBytes(@"sp2_4.bin", sprite.ToByteArray(i + 1));    // DEBUG
                ImportSp2(iso, sprite.ToByteArray(i + 1), i);
            }
        }