public void Read(BinaryReaderEx br) { //data that seems to be present in every level header = Instance <SceneHeader> .FromStream(br, 0); meshinfo = Instance <MeshInfo> .FromStream(br, header.ptrMeshInfo); verts = InstanceList <Vertex> .FromStream(br, meshinfo.ptrVertexArray, meshinfo.cntVertex); restartPts = InstanceList <PosAng> .FromStream(br, header.ptrRestartPts, header.cntRestartPts); visdata = InstanceList <VisData> .FromStream(br, meshinfo.ptrColDataArray, meshinfo.cntColData); quads = InstanceList <QuadBlock> .FromStream(br, meshinfo.ptrQuadBlockArray, meshinfo.cntQuadBlock); //optional stuff, can be missing if (header.ptrSkybox != 0) { skybox = Instance <SkyBox> .FromStream(br, header.ptrSkybox); } if (header.ptrVcolAnim != 0) { vertanims = InstanceList <VertexAnim> .FromStream(br, header.ptrVcolAnim, header.cntVcolAnim); } if (header.ptrAiNav != 0) { nav = Instance <Nav> .FromStream(br, header.ptrAiNav); } if (header.ptrTrialData != 0) { trial = Instance <TrialData> .FromStream(br, header.ptrTrialData); } if (header.cntSpawnPts != 0) { br.Jump(header.ptrSpawnPts); unkadv = new UnkAdv(br, (int)header.cntSpawnPts); } if (header.cntTrialData != 0) { br.Jump(header.ptrTrialData); int cnt = br.ReadInt32(); int ptr = br.ReadInt32(); br.Jump(ptr); for (int i = 0; i < cnt; i++) { posu1.Add(new PosAng(br)); } } if (header.cntu2 != 0) { br.Jump(header.ptru2); int cnt = br.ReadInt32(); int ptr = br.ReadInt32(); br.Jump(ptr); for (int i = 0; i < cnt; i++) { posu2.Add(new Vector3s(br)); } } /* * //water texture * br.BaseStream.Position = header.ptrWater; * * List<uint> vptr = new List<uint>(); * List<uint> wptr = new List<uint>(); * * for (int i = 0; i < header.cntWater; i++) * { * vptr.Add(br.ReadUInt32()); * wptr.Add(br.ReadUInt32()); * } * * wptr.Sort(); * * foreach(uint u in wptr) * { * Console.WriteLine(u.ToString("X8")); * } * * Console.ReadKey(); */ //read pickups for (int i = 0; i < header.numPickupHeaders; i++) { br.Jump(header.ptrPickupHeadersPtrArray + 4 * i); br.Jump(br.ReadUInt32()); pickups.Add(new PickupHeader(br)); } //read pickup models //starts out right, but anims ruin it br.Jump(header.ptrPickupModelsPtr); int x = (int)br.BaseStream.Position; for (int i = 0; i < header.numPickupModels; i++) { br.BaseStream.Position = x + 4 * i; br.BaseStream.Position = br.ReadUInt32(); dynamics.Add(new LODModel(br)); } }