Пример #1
0
        void IMapItem.Write(MemoryStream stream, SpecificationMode spec)
        {
            switch (spec)
            {
            case SpecificationMode.Doom:
            case SpecificationMode.Hexen:
                stream.Write(BitConverter.GetBytes(OffsetX), 0, 2);
                stream.Write(BitConverter.GetBytes(OffsetY), 0, 2);
                stream.Write(DoomUtils.GetNameAsBytes(TopTexture), 0, 8);
                stream.Write(DoomUtils.GetNameAsBytes(BottomTexture), 0, 8);
                stream.Write(DoomUtils.GetNameAsBytes(Texture), 0, 8);
                stream.Write(BitConverter.GetBytes(Sector), 0, 2);
                break;

            case SpecificationMode.UDMF:
            default:
                throw new NotImplementedException();
            }
        }
Пример #2
0
        /// <summary>
        /// Creates a side defenition from a stream
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="spec"></param>
        /// <param name="line"></param>
        public SideDefenition(MemoryStream stream, SpecificationMode spec, LineDefenition line)
        {
            this.line = line;
            switch (spec)
            {
            case SpecificationMode.Doom:
            case SpecificationMode.Hexen:
                byte[] buffer = new byte[30];
                stream.Read(buffer, 0, 30);
                OffsetX       = BitConverter.ToInt16(buffer, 0);
                OffsetY       = BitConverter.ToInt16(buffer, 2);
                TopTexture    = DoomUtils.ToName(buffer, 4, 8);
                BottomTexture = DoomUtils.ToName(buffer, 12, 8);
                Texture       = DoomUtils.ToName(buffer, 20, 8);
                Sector        = BitConverter.ToUInt16(buffer, 28);
                break;

            case SpecificationMode.UDMF:
            default:
                throw new NotImplementedException();
            }
        }
Пример #3
0
        public Sector(MemoryStream stream, SpecificationMode spec)
        {
            switch (spec)
            {
            case SpecificationMode.Doom:
            case SpecificationMode.Hexen:
                byte[] buffer = new byte[26];
                stream.Read(buffer, 0, 26);
                FloorHeight    = BitConverter.ToInt16(buffer, 0);
                CeilingHeight  = BitConverter.ToInt16(buffer, 2);
                FloorTexture   = DoomUtils.ToName(buffer, 4, 8);
                CeilingTexture = DoomUtils.ToName(buffer, 12, 8);
                LightLevel     = BitConverter.ToInt16(buffer, 20);
                SectorSpecial  = BitConverter.ToUInt16(buffer, 22);
                SectorTag      = BitConverter.ToUInt16(buffer, 24);
                break;

            case SpecificationMode.UDMF:
            default:
                throw new NotImplementedException();
            }
        }