long FlcDeltaFlc(BinaryFormatter formatter, int frame) { long pos, read; short lines, l, b, colour; byte skip; sbyte change; lines = formatter.ReadShort16(); read = 6 + sizeof(short); l = 0; while (lines > 0) { pos = l * FlcHeader.width; b = formatter.ReadShort16(); read += 2; if ((b & 0xC000) == 0x0000) { b &= 0x3FFF; for (int j = 0; j < b; j++) { skip = formatter.ReadByte(); pos += skip; read += 1; change = formatter.ReadSByte(); read += 1; if (change > 0) { for (int i = 0; i < change; i++) { colour = formatter.ReadShort16(); read += 2; mBufferFrames[frame][pos++] = (byte)(colour & 0x00FF); mBufferFrames[frame][pos++] = (byte)((colour >> 8) & 0x00FF); } } else { change = (sbyte)-change; colour = formatter.ReadShort16(); read += 2; for (int i = 0; i < change; i++) { mBufferFrames[frame][pos++] = (byte)(colour & 0x00FF); mBufferFrames[frame][pos++] = (byte)((colour >> 8) & 0x00FF); } } } lines--; l++; } else { if ((b & 0xC000) == 0xC000) l -= b; else mBufferFrames[frame][pos++] = (byte)(b & 0x00FF); } } if ((read % 4) == 1) { formatter.ReadBytes(2); read++; } return read; }