/// <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(); } }
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(); } }