Exemple #1
0
        public GridEntry(BinaryReader reader, string version)
        {
            if (version == "0.003")
            {
                int depth = reader.ReadInt32(); // unused, for now

                mTilePaletteIndex = reader.ReadByte();
                mBlockPaletteIndex = reader.ReadByte();
                mAltitude = reader.ReadByte();
                byte flags = reader.ReadByte();

                if ((flags & 0x01) != 0) mTile = true;
                if ((flags & 0x02) != 0) Block = BlockTypeEnum.Low;
                if ((flags & 0x04) != 0) mTunnel = true;
                if ((flags & 0x08) != 0) Block = BlockTypeEnum.High;
                if ((flags & 0x10) != 0) mExit = true;
            }
            else
            {
                byte first = reader.ReadByte();
                byte second = reader.ReadByte();

                mTilePaletteIndex = ((first & ValueMasks[0]) >> ValueShifts[0]);
                mBlockPaletteIndex = ((first & ValueMasks[1]) >> ValueShifts[1]);

                mTile = ((second & ValueMasks[2]) >> ValueShifts[2]) == 1 ? true : false;
                mTunnel = ((second & ValueMasks[3]) >> ValueShifts[3]) == 1 ? true : false;
                mBlock = (BlockTypeEnum)((second & ValueMasks[4]) >> ValueShifts[4]);
                mAltitude = (byte)((second & ValueMasks[5]) >> ValueShifts[5]);
                mExit = ((second & ValueMasks[6]) >> ValueShifts[6]) == 1 ? true : false;
            }
        }
Exemple #2
0
 public GridEntry(GridEntry aOther)
 {
     mAltitude = aOther.mAltitude;
     mTilePaletteIndex = aOther.mTilePaletteIndex;
     mBlockPaletteIndex = aOther.mBlockPaletteIndex;
     mTile = aOther.mTile;
     mTunnel = aOther.mTunnel;
     mBlock = aOther.mBlock;
     mExit = aOther.mExit;
 }