/// <summary> /// The h 1 spawn info. /// </summary> /// <param name="map">The map.</param> /// <remarks></remarks> public void H1SpawnInfo(Map map) { map.OpenMap(MapTypes.Internal); // collections map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 900; int tempc = map.BR.ReadInt32(); int tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { //map.OpenMap(MapTypes.Internal); H1Collection vs = new H1Collection(); map.BR.BaseStream.Position = tempr + (144 * x) + 4; vs.SpawnsInMode = (H1Collection.H1CollectionTypeEnum)map.BR.ReadInt32(); map.BR.BaseStream.Position = tempr + (144 * x) + 64; vs.offset = tempr + (144 * x) + 64; vs.X = map.BR.ReadSingle(); vs.Y = map.BR.ReadSingle(); vs.Z = map.BR.ReadSingle(); vs.RotationDirection = Renderer.DegreeToRadian(map.BR.ReadSingle()); map.BR.BaseStream.Position = tempr + (144 * x) + 92; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); if (tempbase == -1) { continue; } //map.CloseMap(); vs.TagPath = map.FileNames.Name[tempbase]; vs.ModelTagNumber = map.Functions.FindModelByBaseClass(tempbase); if (vs.ModelTagNumber == -1) { continue; } vs.ModelName = map.FileNames.Name[vs.ModelTagNumber]; Spawn.Add(vs); } // vehicle //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 588; int[] temppalette = new int[map.BR.ReadInt32()]; int[] temppalette2 = new int[temppalette.Length]; tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < temppalette.Length; x++) { //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = tempr + (x * 48) + 12; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); //map.CloseMap(); temppalette2[x] = tempbase; temppalette[x] = map.Functions.FindModelByBaseClass(tempbase); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 576; tempc = map.BR.ReadInt32(); tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { map.BR.BaseStream.Position = tempr + (120 * x); short tempshort = map.BR.ReadInt16(); if (tempshort == -1) { continue; } map.BR.BaseStream.Position = tempr + (120 * x) + 8; VehicleSpawn vs = new VehicleSpawn(); vs.offset = tempr + (120 * x) + 8; vs.X = map.BR.ReadSingle(); vs.Y = map.BR.ReadSingle(); vs.Z = map.BR.ReadSingle(); vs.Yaw = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.Pitch = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.Roll = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.ModelTagNumber = temppalette[tempshort]; if (vs.ModelTagNumber == -1) { continue; } vs.TagPath = map.FileNames.Name[temppalette2[tempshort]]; vs.ModelName = map.FileNames.Name[vs.ModelTagNumber]; Spawn.Add(vs); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 540; temppalette = new int[map.BR.ReadInt32()]; temppalette2 = new int[temppalette.Length]; tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < temppalette.Length; x++) { //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = tempr + (x * 48) + 12; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); //map.CloseMap(); temppalette2[x] = tempbase; temppalette[x] = map.Functions.FindModelByBaseClass(tempbase); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 528; tempc = map.BR.ReadInt32(); tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { map.BR.BaseStream.Position = tempr + (72 * x); short tempshort = map.BR.ReadInt16(); if (tempshort == -1) { continue; } map.BR.BaseStream.Position = tempr + (72 * x) + 8; ScenerySpawn vs = new ScenerySpawn(); vs.offset = tempr + (72 * x) + 8; vs.X = map.BR.ReadSingle(); vs.Y = map.BR.ReadSingle(); vs.Z = map.BR.ReadSingle(); vs.Yaw = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.Pitch = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.Roll = Renderer.DegreeToRadian(map.BR.ReadSingle()); vs.ModelTagNumber = temppalette[tempshort]; if (vs.ModelTagNumber == -1) { continue; } vs.TagPath = map.FileNames.Name[temppalette2[tempshort]]; vs.ModelName = map.FileNames.Name[vs.ModelTagNumber]; Spawn.Add(vs); } }
/// <summary> /// The h 1 spawn info. /// </summary> /// <param name="map">The map.</param> /// <remarks></remarks> public void H1SpawnInfo(Map map) { map.OpenMap(MapTypes.Internal); // collections map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 900; int tempc = map.BR.ReadInt32(); int tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { //map.OpenMap(MapTypes.Internal); H1Collection vs = new H1Collection(); map.BR.BaseStream.Position = tempr + (144 * x); vs.Read(map); map.BR.BaseStream.Position = tempr + (144 * x) + 92; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); if (tempbase == -1) { continue; } //map.CloseMap(); vs.TagPath = map.FileNames.Name[tempbase]; vs.ModelTagNumber = map.Functions.FindModelByBaseClass(tempbase); if (vs.ModelTagNumber == -1) { continue; } vs.ModelName = map.FileNames.Name[vs.ModelTagNumber]; Spawn.Add(vs); } // vehicle //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 588; int[] temppalette = new int[map.BR.ReadInt32()]; int[] temppalette2 = new int[temppalette.Length]; tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < temppalette.Length; x++) { //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = tempr + (x * 48) + 12; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); //map.CloseMap(); temppalette2[x] = tempbase; temppalette[x] = map.Functions.FindModelByBaseClass(tempbase); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 576; tempc = map.BR.ReadInt32(); tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { map.BR.BaseStream.Position = tempr + (120 * x); VehicleSpawn vs = new VehicleSpawn(); vs.Read(map); if (vs.PaletteIndex == -1) { continue; } vs.ModelTagNumber = temppalette[vs.PaletteIndex]; if (vs.ModelTagNumber == -1) { continue; } vs.TagPath = map.FileNames.Name[temppalette2[vs.PaletteIndex]]; vs.ModelName = map.FileNames.Name[vs.ModelTagNumber]; Spawn.Add(vs); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 540; temppalette = new int[map.BR.ReadInt32()]; temppalette2 = new int[temppalette.Length]; tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < temppalette.Length; x++) { //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = tempr + (x * 48) + 12; int tempbase = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32()); //map.CloseMap(); temppalette2[x] = tempbase; temppalette[x] = map.Functions.FindModelByBaseClass(tempbase); } //map.OpenMap(MapTypes.Internal); map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 528; tempc = map.BR.ReadInt32(); tempr = map.BR.ReadInt32() - map.PrimaryMagic; for (int x = 0; x < tempc; x++) { ScenerySpawn ss = new ScenerySpawn(); map.BR.BaseStream.Position = tempr + (72 * x) + 8; ss.Read(map); if (ss.PaletteIndex == -1) { continue; } ss.ModelTagNumber = temppalette[ss.PaletteIndex]; if (ss.ModelTagNumber == -1) { continue; } ss.TagPath = map.FileNames.Name[temppalette2[ss.PaletteIndex]]; ss.ModelName = map.FileNames.Name[ss.ModelTagNumber]; Spawn.Add(ss); } }