/// <summary> /// The load sky. /// </summary> /// <param name="meta">The meta.</param> /// <remarks></remarks> public void LoadSky(ref Meta meta) { map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 8; int tempc = map.BR.ReadInt32(); int tempr = map.BR.ReadInt32() - map.SecondaryMagic; if (tempc == 0) { return; } map.BR.BaseStream.Position = tempr + 4; int tempident = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); if (tempident != -1) { sky = new Sky(tempident, map); map.BR.BaseStream.Position = map.MetaInfo.Offset[tempident] + 4; tempident = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); if (tempident != -1) { Meta tempmeta = new Meta(map); tempmeta.ReadMetaFromMap(tempident, false); SkyBox = new ParsedModel(ref tempmeta); } } map.CloseMap(); }
/// <summary> /// Initializes a new instance of the <see cref="BSPModel"/> class. /// </summary> /// <param name="meta">The meta.</param> /// <remarks></remarks> public BSPModel(ref Meta meta) { if (meta == null) { MessageBox.Show("ERROR: NO SBSP tag selected!"); this.BspNumber = -1; return; } this.map = meta.Map; string[] temps = meta.name.Split('\\'); Name = temps[temps.Length - 1]; BspNumber = map.BSP.FindBSPNumberByBSPIdent(meta.ident); switch (map.HaloVersion) { case HaloVersionEnum.Halo2: case HaloVersionEnum.Halo2Vista: // 10x 0.0000010 LoadModelStructure(ref meta); // 5x 0.0000010 LoadPermutations(ref meta); // Load Decorators LoadUnknowns(ref meta); // 5x 0.0000010 Shaders = new BSPShaderContainer(this, ref meta); Display = new BSPDisplayedInfo(); // 2x 0.0000010 LoadLightmaps(); sky = new Sky(); LoadSky(ref meta); Spawns = new SpawnInfo(map); // 1x 0.0000010 ClusterInfo = ClustersPVS.GetClustersPVSInfo(ref meta); break; case HaloVersionEnum.Halo1: case HaloVersionEnum.HaloCE: Shaders = new BSPShaderContainer(); this.BSPPermutationRawDataMetaChunks = new BSPPermutationRawDataMetaChunk[0]; this.LightMapBitmap = new Bitmap[0]; this.SceneryLightMapBitmap = new Bitmap[0]; this.PermutationInfo = new PermutationPlacement[0]; LoadModelStructure(ref meta); Display = new BSPDisplayedInfo(); Spawns = new SpawnInfo(map); sky = new Sky(); break; } }