Beispiel #1
0
        // spawning
        public E_Mold New()
        {
            E_Mold empty = new E_Mold();

            empty.Mold = new byte[mold.Length];
            return(empty);
        }
        // assemblers
        private void Disassemble()
        {
            animationOffset = Bits.GetInt24(rom, 0x252C00 + (index * 3)) - 0xC00000;
            ushort animationLength = Bits.GetShort(rom, animationOffset);

            buffer = Bits.GetBytes(rom, animationOffset, Bits.GetShort(rom, animationOffset));
            //
            int    offset                = 2;
            ushort graphicSetPointer     = Bits.GetShort(buffer, offset); offset += 2;
            ushort paletteSetPointer     = Bits.GetShort(buffer, offset); offset += 2;
            ushort sequencePacketPointer = Bits.GetShort(buffer, offset); offset += 2;
            ushort moldPacketPointer     = Bits.GetShort(buffer, offset); offset += 2;

            // skip 2 unknown bytes
            offset += 2;
            //
            width  = buffer[offset++];
            height = buffer[offset++];
            codec  = Bits.GetShort(buffer, offset); offset += 2;
            //
            int tileSetPointer = Bits.GetShort(buffer, offset);

            graphicSetLength = paletteSetPointer - graphicSetPointer;
            graphicSet       = new byte[0x2000];
            Buffer.BlockCopy(buffer, graphicSetPointer, graphicSet, 0, graphicSetLength);
            paletteSetLength = (ushort)(tileSetPointer - paletteSetPointer);
            paletteSet       = new PaletteSet(buffer, 0, paletteSetPointer, 8, 16, 32);
            tilesetLength    = sequencePacketPointer - tileSetPointer - 2;
            tileset_bytes    = new byte[64 * 4 * 2 * 4];
            Buffer.BlockCopy(buffer, tileSetPointer, tileset_bytes, 0, tilesetLength);
            //
            offset = sequencePacketPointer;
            for (int i = 0; Bits.GetShort(buffer, offset) != 0x0000; i++)
            {
                E_Sequence tSequence = new E_Sequence();
                tSequence.Disassemble(buffer, offset);
                sequences.Add(tSequence);
                offset += 2;
            }
            offset = moldPacketPointer;
            ushort end = 0;

            for (int i = 0; Bits.GetShort(buffer, offset) != 0x0000; i++)
            {
                if (Bits.GetShort(buffer, offset + 2) == 0x0000)
                {
                    end = animationLength;
                }
                else
                {
                    end = Bits.GetShort(buffer, offset + 2);
                }
                E_Mold tMold = new E_Mold();
                tMold.Disassemble(buffer, offset, end);
                molds.Add(tMold);
                offset += 2;
            }
        }
Beispiel #3
0
        public E_Mold Copy()
        {
            E_Mold copy = new E_Mold();

            copy.Mold = new byte[mold.Length];
            mold.CopyTo(copy.Mold, 0);
            copy.MoldOffset = moldOffset;
            return(copy);
        }