Пример #1
0
 private void Load(Stream stream)
 {
     this.header = GetHeader(stream);
     this.edges = GetEdges(stream);
     this.vertices = GetVertices(stream);
     this.originalFaces = GetOriginalFaces(stream);
     this.faces = GetFaces(stream);
     this.planes = GetPlanes(stream);
     this.surfedges = GetSurfedges(stream);
     this.textureInfo = GetTextureInfo(stream);
     this.brushes = GetBrushes(stream);
     this.brushsides = GetBrushsides(stream);
     this.entityBuffer = GetEntities(stream);
     this.nodes = GetNodes(stream);
     this.leafs = GetLeafs(stream);
     //LoadWorld();
 }
Пример #2
0
        private Header GetHeader(Stream stream)
        {
            Header header = new Header();
            header.ident = UtilityReader.ReadInt(stream);

            if (header.ident == (int)('V' + ('B' << 8) + ('S' << 16) + ('P' << 24)))
                UtilityReader.BigEndian = false;
            else
                UtilityReader.BigEndian = true;

            header.version = UtilityReader.ReadInt(stream);
            header.lumps = new Lump[64];
            for (int i = 0; i < header.lumps.Length; i++)
            {
                header.lumps[i] = new Lump();
                header.lumps[i].type = (LumpType)i;
                header.lumps[i].offset = UtilityReader.ReadInt(stream);
                header.lumps[i].length = UtilityReader.ReadInt(stream);
                header.lumps[i].version = UtilityReader.ReadInt(stream);
                header.lumps[i].fourCC = UtilityReader.ReadInt(stream);
            }
            header.mapRevision = UtilityReader.ReadInt(stream);
            return header;
        }