本文整理汇总了C#中HaloMap.Map.Map.OpenMap方法的典型用法代码示例。如果您正苦于以下问题:C# Map.OpenMap方法的具体用法?C# Map.OpenMap怎么用?C# Map.OpenMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HaloMap.Map.Map
的用法示例。
在下文中一共展示了Map.OpenMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: H1BSPConvert
/// <summary>
/// Initializes a new instance of the <see cref="BSPConvert"/> class.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="test">The test.</param>
/// <remarks></remarks>
public H1BSPConvert(Map map, ref PropertyGrid test)
{
switch (map.HaloVersion)
{
case HaloVersionEnum.Halo1:
case HaloVersionEnum.HaloCE:
map.OpenMap(MapTypes.Internal);
H1SBSP h1bsp = new H1SBSP(map.BSP.sbsp[0].TagIndex, map);
test.SelectedObject = h1bsp.Header;
map.CloseMap();
break;
case HaloVersionEnum.Halo2:
case HaloVersionEnum.Halo2Vista:
MessageBox.Show("Open an H1 Map first");
break;
}
// OpenFileDialog open = new OpenFileDialog();
// open.Filter = "*.map|*.map";
// if (open.ShowDialog() == DialogResult.Cancel) return;
// int h2map=Maps.Add(open.FileName);
// Halo2BSP h2bsp = new Halo2BSP(h2map);
// Maps.Remove(h2map);
}
示例2: Scripts
/// <summary>
/// Initializes a new instance of the <see cref="Scripts"/> class.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public Scripts(Map map)
{
map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 568;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
syntaxes = new Syntax[tempc];
map.BR.BaseStream.Position = tempr;
for (int x = 0; x < tempc; x++)
{
syntaxes[x] = new Syntax(ref map.BR);
}
map.CloseMap();
}
示例3: BitmapControl
/// <summary>
/// Initializes a new instance of the <see cref="BitmapControl"/> class.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public BitmapControl(Map map)
{
InitializeComponent();
this.map = map;
map.OpenMap(MapTypes.Internal);
pm = new ParsedBitmap(ref map.SelectedMeta, map);
for (int x = 0; x < pm.Properties.Length; x++)
{
TreeNode tn = new TreeNode("Bitmap #" + x);
tn.Tag = "BITMAP";
for (int i = 0; i < map.SelectedMeta.raw.rawChunks.Count; i++)
{
int count = pm.Properties[x].mipMapCount;
BitmapRawDataChunk bmRaw = (BitmapRawDataChunk)map.SelectedMeta.raw.rawChunks[i];
if (bmRaw.inchunk == x)
{
TreeNode chunknode = new TreeNode("Chunk #" + bmRaw.num);
chunknode.Tag = "CHUNK";
int chunkWidth = pm.Properties[x].width >> bmRaw.num;
int mipcount = 0;
while (chunkWidth > 1 && count > 0)
{
TreeNode mipnode = new TreeNode("Mipmap #" + (mipcount++));
mipnode.Tag = "MIPMAP";
chunknode.Nodes.Add(mipnode);
chunkWidth >>= 1;
count--;
}
tn.Nodes.Add(chunknode);
}
}
treeView1.Nodes.Add(tn);
}
map.CloseMap();
DisplayBitmap(0, 0, 0);
}
示例4: hlmtContainer
/// <summary>
/// Initializes a new instance of the <see cref="hlmtContainer"/> class.
/// </summary>
/// <param name="tagIndex">Index of the tag.</param>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public hlmtContainer(int tagIndex, Map map)
{
bool alreadyOpen = true;
if (!(map.isOpen && map.openMapType == MapTypes.Internal))
{
map.OpenMap(MapTypes.Internal);
alreadyOpen = false;
}
this.TagIndex = tagIndex;
Permutations = new PermutationInfo();
Permutations.Name = map.FileNames.Name[TagIndex];
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 112;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
Permutations.Piece = new PermutationInfo.PermutationPiece[tempc];
for (int x = 0; x < tempc; x++)
{
Permutations.Piece[x] = new PermutationInfo.PermutationPiece();
map.BR.BaseStream.Position = tempr + (x * 16);
Permutations.Piece[x].PieceName = map.Strings.Name[map.BR.ReadInt16()];
map.BR.BaseStream.Position = tempr + (x * 16) + 8;
int tempc2 = map.BR.ReadInt32();
int tempr2 = map.BR.ReadInt32() - map.SecondaryMagic;
Permutations.Piece[x].Permutation = new PermutationInfo.PermutationPiece.PermutationVariation[tempc2];
for (int xx = 0; xx < tempc2; xx++)
{
Permutations.Piece[x].Permutation[xx] = new PermutationInfo.PermutationPiece.PermutationVariation();
map.BR.BaseStream.Position = tempr2 + (xx * 8);
string temps2 = map.Strings.Name[map.BR.ReadInt16()];
Permutations.Piece[x].Permutation[xx].PermutationNameX = temps2;
}
}
if (!alreadyOpen)
{
map.CloseMap();
}
}
示例5: ReadH1ModelRaw
/// <summary>
/// The read h 1 model raw.
/// </summary>
/// <param name="TagIndex">The TagIndex.</param>
/// <param name="map">The map.</param>
/// <param name="dontreadraw">The dontreadraw.</param>
/// <remarks></remarks>
public void ReadH1ModelRaw(int TagIndex, Map map, bool dontreadraw)
{
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 208;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.PrimaryMagic;
for (int y = 0; y < tempc; y++)
{
map.BR.BaseStream.Position = tempr + (y * 48) + 36;
int tempcc = map.BR.ReadInt32();
int temprc = map.BR.ReadInt32() - map.PrimaryMagic;
for (int x = 0; x < tempcc; x++)
{
RawDataChunk Raw = new RawDataChunk();
map.BR.BaseStream.Position = temprc + (x * 104) + 4;
Raw.shadernumber = map.BR.ReadInt16();
Raw.pointerMetaOffset = temprc + (x * 104) + 76 - map.MetaInfo.Offset[TagIndex];
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset - 4;
Raw.rawDataType = RawDataType.HaloCEIndices;
Raw.size = (map.BR.ReadInt32() + 2) * 2;
Raw.offset = map.BR.ReadInt32() - map.PrimaryMagic;
if (dontreadraw == false)
{
map.OpenMap(Raw.rawLocation);
map.BR.BaseStream.Position = Raw.offset;
Raw.MS = new MemoryStream(Raw.size);
Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);
map.OpenMap(MapTypes.Internal);
}
this.rawChunks.Add(Raw);
Raw = new RawDataChunk();
Raw.rawDataType = RawDataType.HaloCEVertices;
Raw.pointerMetaOffset = temprc + (x * 104) + 100 - map.MetaInfo.Offset[TagIndex];
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset - 12;
Raw.size = map.BR.ReadInt32();
Raw.size *= 32;
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
this.IntermediatePointerOffset = map.BR.ReadInt32() - map.PrimaryMagic;
map.BR.BaseStream.Position = this.IntermediatePointerOffset + 4;
Raw.offset = map.BR.ReadInt32() - map.PrimaryMagic;
if (dontreadraw == false)
{
map.OpenMap(Raw.rawLocation);
map.BR.BaseStream.Position = Raw.offset;
Raw.MS = new MemoryStream(Raw.size);
Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);
map.OpenMap(MapTypes.Internal);
}
this.rawChunks.Add(Raw);
}
}
}
示例6: Halo2BSPContainer
/// <summary>
/// The halo 2 bsp container.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void Halo2BSPContainer(Map map)
{
map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = map.MetaInfo.Offset[3] + 528;
bspcount = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
sbsp = new BSPInfo[bspcount];
for (int x = 0; x < bspcount; x++)
{
sbsp[x] = new BSPInfo();
sbsp[x].pointerOffset = tempr + (x * 68) - map.MetaInfo.Offset[3];
map.BR.BaseStream.Position = tempr + (x * 68);
sbsp[x].offset = map.BR.ReadInt32();
map.Functions.ParsePointer(ref sbsp[x].offset, ref sbsp[x].location);
sbsp[x].size = map.BR.ReadInt32();
sbsp[x].magic = map.BR.ReadInt32() - sbsp[x].offset;
map.BR.BaseStream.Position = tempr + (x * 68) + 20;
sbsp[x].ident = map.BR.ReadInt32();
// MessageBox.Show(sbsp[x].ident.ToString("X"));
sbsp[x].TagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].ident);
map.MetaInfo.Offset[sbsp[x].TagIndex] = sbsp[x].offset;
map.MetaInfo.Size[sbsp[x].TagIndex] = sbsp[x].size;
map.BR.BaseStream.Position = tempr + (x * 68) + 28;
sbsp[x].lightmapident = map.BR.ReadInt32();
sbsp[x].lightmapTagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].lightmapident);
if (sbsp[x].lightmapTagIndex == -1)
{
continue;
}
map.BR.BaseStream.Position = sbsp[x].offset + 8;
sbsp[x].lightmapoffset = map.BR.ReadInt32();
if (sbsp[x].lightmapoffset == 0)
{
sbsp[x].lightmapident = -1;
sbsp[x].lightmapTagIndex = -1;
if (
MessageBox.Show(
"There is no lightmap for this bsp and the scenario is currently linked to a broken ID.\n Would you like Entity to fix it?",
"Error",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
map.BW.BaseStream.Position = tempr + (x * 68) + 28;
map.BW.Write(int.Parse("FFFFFFFF", NumberStyles.HexNumber));
}
continue;
}
sbsp[x].lightmapoffset += -sbsp[x].magic;
sbsp[x].lightmapsize = sbsp[x].size + sbsp[x].offset - sbsp[x].lightmapoffset;
map.MetaInfo.Offset[sbsp[x].lightmapTagIndex] = sbsp[x].lightmapoffset;
map.MetaInfo.Size[sbsp[x].lightmapTagIndex] = sbsp[x].lightmapsize;
// light map bitmap
map.BR.BaseStream.Position = sbsp[x].lightmapoffset + 128;
int tempc = map.BR.ReadInt32();
int temprx = map.BR.ReadInt32() - sbsp[x].magic;
map.BR.BaseStream.Position = temprx + 28;
sbsp[x].LightMap_TagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
///light map palettes
map.BR.BaseStream.Position = temprx + 8;
int tempc2 = map.BR.ReadInt32();
int tempr2 = map.BR.ReadInt32() - sbsp[x].magic;
sbsp[x].palettesoffset = tempr2;
for (int y = 0; y < tempc2; y++)
{
map.BR.BaseStream.Position = tempr2 + (y * 1024);
Palette_Color[] pc = new Palette_Color[256];
for (int z = 0; z < 256; z++)
{
pc[z] = new Palette_Color();
pc[z].r = map.BR.ReadByte();
pc[z].g = map.BR.ReadByte();
pc[z].b = map.BR.ReadByte();
pc[z].a = map.BR.ReadByte();
}
sbsp[x].LightMap_Palettes.Add(pc);
}
map.BR.BaseStream.Position = temprx + 40;
tempc2 = map.BR.ReadInt32();
tempr2 = map.BR.ReadInt32() - sbsp[x].magic;
sbsp[x].VisualChunk_Bitmap_Index = new int[tempc2];
sbsp[x].VisualChunk_LightMap_Index = new int[tempc2];
if (tempc2 != 0)
{
map.BR.BaseStream.Position = tempr2;
for (int y = 0; y < tempc2; y++)
{
//.........这里部分代码省略.........
示例7: HaloCEContainer
/// <summary>
/// The halo ce container.
/// </summary>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void HaloCEContainer(Map map)
{
map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = map.MetaInfo.Offset[0] + 1444;
bspcount = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.PrimaryMagic;
sbsp = new BSPInfo[bspcount];
for (int x = 0; x < bspcount; x++)
{
sbsp[x] = new BSPInfo();
sbsp[x].pointerOffset = tempr + (x * 32) - map.MetaInfo.Offset[0];
map.BR.BaseStream.Position = tempr + (x * 32);
sbsp[x].offset = map.BR.ReadInt32();
sbsp[x].size = map.BR.ReadInt32();
sbsp[x].magic = map.BR.ReadInt32() - sbsp[x].offset;
map.BR.BaseStream.Position = tempr + (x * 32) + 28;
sbsp[x].ident = map.BR.ReadInt32();
sbsp[x].TagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].ident);
map.MetaInfo.Offset[sbsp[x].TagIndex] = sbsp[x].offset;
map.MetaInfo.Size[sbsp[x].TagIndex] = sbsp[x].size;
map.BR.BaseStream.Position = sbsp[x].offset + 4;
sbsp[x].Halo1VerticeCount = map.BR.ReadInt32();
sbsp[x].lightmapoffset = 24;
map.BR.BaseStream.Position = sbsp[x].lightmapoffset + 12;
sbsp[x].lightmapident = map.BR.ReadInt32();
sbsp[x].lightmapTagIndex = map.Functions.ForMeta.FindMetaByID(sbsp[x].ident);
}
map.CloseMap();
}
示例8: BuildMeta
/// <summary>
/// The build meta.
/// </summary>
/// <param name="metasplit">The metasplit.</param>
/// <param name="map">The map.</param>
/// <returns></returns>
/// <remarks></remarks>
public static Meta BuildMeta(MetaSplitter metasplit, Map map)
{
metasize = 0;
MetaStream = new MemoryStream(metasplit.Header.chunksize);
BinaryWriter BW = new BinaryWriter(MetaStream);
// BW.BaseStream.Position = 0;
// BW.Write(metasplit.Header.MS.ToArray(), 0, metasplit.Header.chunksize);
metasize += metasplit.Header.chunksize;
TagIndex = metasplit.TagIndex;
Meta m = new Meta(map);
List<Meta.Item> NewItems = new List<Meta.Item>();
// Major error here! Size is not calculated right!
RecursivelyAddPiecesToMeta(metasplit.Header, ref NewItems, ref BW);
m.items = NewItems;
if (MetaStream.Length % 4 != 0)
{
metasize += (int)MetaStream.Length % 4;
MetaStream.SetLength(MetaStream.Length + MetaStream.Length % 4);
}
m.MS = MetaStream;
m.size = metasize;
m.type = metasplit.type;
m.name = metasplit.name;
m.rawType = metasplit.rawtype;
m.raw = metasplit.raw;
m.magic = metasplit.magic;
m.offset = metasplit.offset;
m.TagIndex = TagIndex;
m.RelinkReferences();
m.WriteReferences();
// m.items.Clear();
// MetaScanner Ms = new MetaScanner();
if (m.rawType != RawDataContainerType.Empty)
{
map.OpenMap(MapTypes.Internal);
m.raw = map.Functions.ForMeta.ReadRaw(m.TagIndex, false);
map.CloseMap();
}
// map.OpenMap(MapTypes.Internal);
// IFPIO ifp=IFP.IFPHashMap.GetIfp(m.type);
// m.parsed = true;
// Ms.ScanWithIFP(ref ifp, ref m, map) ;
// map.CloseMap();
return m;
}
示例9: SplitWithIFP
/// <summary>
/// The split with ifp.
/// </summary>
/// <param name="ifp">The ifp.</param>
/// <param name="meta">The meta.</param>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void SplitWithIFP(ref IFPIO ifp, ref Meta meta, Map map)
{
this.type = meta.type;
this.TagIndex = meta.TagIndex;
this.name = meta.name;
this.offset = meta.offset;
this.magic = meta.magic;
this.raw = meta.raw;
this.rawtype = meta.rawType;
map.OpenMap(MapTypes.Internal);
if (ifp.items != null)
{
map.BR.BaseStream.Position = meta.offset;
Header = new SplitReflexive();
Header.offset = 0;
Header.Chunks = new List<SplitReflexive>();
Header.translation = 0;
// Header.MS = new MemoryStream(ifp.headerSize);
// Header.MS.Write(map.BR.ReadBytes(ifp.headerSize), 0, ifp.headerSize);
Header.chunksize = ifp.headerSize;
Header.chunkcount = 1;
Header.splitReflexiveType = SplitReflexive.SplitReflexiveType.Container;
Header.realtranslation = meta.offset;
if (meta.type == "sbsp")
{
int p = map.BSP.FindBSPNumberByBSPIdent(meta.ident);
CycleElements(
ref Header, ifp.items, ref meta, meta.offset, map, meta.TagIndex, map.BSP.sbsp[p].magic);
}
else if (meta.type == "ltmp")
{
int p = map.BSP.FindBSPNumberByLightMapIdent(meta.ident);
CycleElements(
ref Header, ifp.items, ref meta, meta.offset, map, meta.TagIndex, map.BSP.sbsp[p].magic);
}
else
{
// not "sbsp" or "ltmp"
CycleElements(ref Header, ifp.items, ref meta, meta.offset, map, meta.TagIndex, map.SecondaryMagic);
}
}
map.CloseMap();
}
示例10: ScanMapForLayOut
//.........这里部分代码省略.........
if (map.HaloVersion == HaloVersionEnum.Halo2 ||
map.HaloVersion == HaloVersionEnum.Halo2Vista)
{
int padding = map.Functions.Padding(lo.startoffset + lo.size, 4096);
lo.size += padding;
}
lo.endoffset = lo.startoffset + lo.size;
layout.chunks.Add(lo);
if (map.HaloVersion == HaloVersionEnum.Halo2 ||
map.HaloVersion == HaloVersionEnum.Halo2Vista)
{
for (int x = 0; x < map.Unicode.ut.Length; x++)
{
lo = new LayOutChunk(0);
lo.rawType = RawDataContainerType.UnicodeNamesIndex;
lo.startoffset = map.Unicode.ut[x].indexOffset;
lo.size = map.Unicode.ut[x].count * 8;
lo.size += map.Functions.Padding(lo.size, 512);
lo.endoffset = lo.startoffset + lo.size;
layout.chunks.Add(lo);
lo = new LayOutChunk(0);
lo.rawType = RawDataContainerType.UnicodeNames;
lo.startoffset = map.Unicode.ut[x].tableOffset;
lo.size = map.Unicode.ut[x].tableSize;
lo.size += map.Functions.Padding(lo.size, 512);
lo.endoffset = lo.startoffset + lo.size;
layout.chunks.Add(lo);
}
}
map.OpenMap(MapTypes.Internal);
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (map.HaloVersion == HaloVersionEnum.Halo2 ||
map.HaloVersion == HaloVersionEnum.Halo2Vista)
{
if (map.MetaInfo.TagType[x] == "snd!" | map.MetaInfo.TagType[x] == "ltmp")
{
continue;
}
Application.DoEvents();
}
Meta m = new Meta(map);
m.offset = map.MetaInfo.Offset[x];
// checks if type has raw data
m.rawType = map.Functions.ForMeta.CheckForRaw(map.MetaInfo.TagType[x]);
if (m.rawType != RawDataContainerType.Empty)
{
m.raw = map.Functions.ForMeta.ReadRaw(x, true);
LayOutChunk l = new LayOutChunk(map.MapHeader.fileSize);
int tempint = layout.FindByType(m.rawType);
if (tempint == -1)
{
l = new LayOutChunk(map.MapHeader.fileSize);
l.rawType = m.rawType;
layout.chunks.Add(l);
tempint = layout.FindByType(m.rawType);
}
示例11: SaveToXml
/// <summary>
/// The save to xml.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="map">The map.</param>
/// <remarks></remarks>
public void SaveToXml(string path, Map map)
{
XmlTextWriter xtw = new XmlTextWriter(path, Encoding.Default);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartElement("MapLayOut");
xtw.WriteAttributeString("Map", map.filePath);
int tempindex = path.LastIndexOf("\\");
string tempfilepath = path.Substring(0, tempindex) + "\\" +
path.Substring(tempindex + 1, path.Length - tempindex - 1) + " - Meta Chunks\\";
Directory.CreateDirectory(tempfilepath);
map.OpenMap(MapTypes.Internal);
for (int x = 0; x < chunks.Count; x++)
{
LayOutChunk c = (LayOutChunk)chunks[x];
// c.Read(map);
FileStream FS = new FileStream(
tempfilepath + "MapMetaChunk[" + x + "] - " + c.rawType + ".meta", FileMode.Create);
BinaryWriter BW = new BinaryWriter(FS);
// BW.Write(c.MS.ToArray());
// c.Write(BW, 0);
map.BR.BaseStream.Position = c.startoffset;
map.BufferReadWrite(ref map.BR, ref BW, c.size);
BW.Close();
FS.Close();
xtw.WriteStartElement("LayOutChunk");
xtw.WriteAttributeString("Type", c.rawType.ToString());
xtw.WriteAttributeString("StartOffset", c.startoffset.ToString("X"));
xtw.WriteAttributeString("EndOffset", c.endoffset.ToString("X"));
xtw.WriteAttributeString("Size", c.size.ToString("X"));
for (int xx = 0; xx < c.rawPieces.Count; xx++)
{
RawInfoChunk cc = (RawInfoChunk)c.rawPieces[xx];
xtw.WriteStartElement("RawDataPiece");
xtw.WriteAttributeString("Type", cc.rawType.ToString());
xtw.WriteAttributeString("Offset", cc.offset.ToString("X"));
xtw.WriteAttributeString("Size", cc.size.ToString("X"));
xtw.WriteAttributeString("PointerOffset", cc.offsetOfPointer.ToString("X"));
xtw.WriteEndElement();
}
xtw.WriteEndElement();
}
xtw.WriteEndElement();
xtw.Close();
map.CloseMap();
}
示例12: ReadH2BitmapRaw
/// <summary>
/// The read h 2 bitmap raw.
/// </summary>
/// <param name="TagIndex">The TagIndex.</param>
/// <param name="map">The map.</param>
/// <param name="dontreadraw">The dontreadraw.</param>
/// <remarks></remarks>
public void ReadH2BitmapRaw(int TagIndex, Map map, bool dontreadraw)
{
// Offset 68 = Bitmap Data reflexive
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 68;
int tempc = map.BR.ReadInt32();
int tempr = map.BR.ReadInt32() - map.SecondaryMagic;
for (int x = 0; x < tempc; x++)
{
// Bitmap Data reflexive is 116 bytes large
// Offset 4 in BD reflexive is (short) width
map.BR.BaseStream.Position = tempr + (x * 116) + 4;
int width = map.BR.ReadInt16();
// Offset 6 in BD reflexive is (short) width
int height = map.BR.ReadInt16();
// Offset 8 in BD reflexive is (short) width
int depth = map.BR.ReadInt16();
// Offset 10 in BD reflexive is (short) type
int type = map.BR.ReadInt16();
// Offset 12 in BD reflexive is (short) format
int format = map.BR.ReadInt16();
// Offset 20 in BD reflexive is (short) mipmap Count
map.BR.BaseStream.Position = tempr + (x * 116) + 20;
int mipmapCount = map.BR.ReadInt16();
for (int xx = 0; xx < 6; xx++)
{
BitmapRawDataChunk Raw = new BitmapRawDataChunk();
Raw.inchunk = x;
Raw.num = xx;
Raw.pointerMetaOffset = tempr + (x * 116) + 28 + (xx * 4) - map.MetaInfo.Offset[TagIndex];
Raw.rawDataType = RawDataType.bitm;
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
Raw.offset = map.BR.ReadInt32();
if (Raw.offset == -1)
{
break;
}
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset + 24;
Raw.size = map.BR.ReadInt32();
map.Functions.ParsePointer(ref Raw.offset, ref Raw.rawLocation);
if (dontreadraw == false)
{
map.OpenMap(Raw.rawLocation);
map.BR.BaseStream.Position = Raw.offset;
Raw.MS = new MemoryStream(Raw.size);
Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);
#region mipmap loading section
int offset = 0;
int Bpp = 4; // 32 bit
switch (format)
{
case 0:
case 1:
case 2:
case 17:
Bpp = 1; // 8 bit
break;
case 3:
case 6:
case 8:
case 9:
case 22:
Bpp = 2; // 16 bit
break;
}
for (int xxx = xx; xxx < mipmapCount; xxx++)
{
mipmapDataChunk mipmapDC = new mipmapDataChunk();
mipmapDC.width = width >> xxx;
mipmapDC.height = height >> xxx;
mipmapDC.depth = depth >> xxx != 0 ? depth >> xxx : 1;
mipmapDC.offset = offset;
mipmapDC.size = mipmapDC.width * mipmapDC.height * mipmapDC.depth * Bpp;
// if (type == 2) // Cubemap, 6 sides
// mipmapDC.size *= 6;
switch (format)
{
case 14: // DXT1
mipmapDC.size /= 8;
break;
case 15: // DXT3
//.........这里部分代码省略.........
示例13: Read
/// <summary>
/// The read.
/// </summary>
/// <param name="TagIndex">The TagIndex.</param>
/// <param name="map">The map.</param>
/// <param name="dontreadraw">The dontreadraw.</param>
/// <remarks></remarks>
public override void Read(int TagIndex, Map map, bool dontreadraw)
{
RawDataChunk Raw = new RawDataChunk();
Raw.rawDataType = RawDataType.DECR;
Raw.pointerMetaOffset = 56;
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 56;
Raw.offset = map.BR.ReadInt32();
Raw.size = map.BR.ReadInt32();
map.Functions.ParsePointer(ref Raw.offset, ref Raw.rawLocation);
if (dontreadraw == false)
{
map.OpenMap(Raw.rawLocation);
map.BR.BaseStream.Position = Raw.offset;
Raw.MS = new MemoryStream(Raw.size);
Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);
map.OpenMap(MapTypes.Internal);
}
this.rawChunks.Add(Raw);
}
示例14: MapBuilder
/// <summary>
/// The map builder.
/// </summary>
/// <param name="metas">The metas.</param>
/// <param name="layout">The layout.</param>
/// <param name="map">The map.</param>
/// <param name="addsounds">The addsounds.</param>
/// <remarks></remarks>
public void MapBuilder(ArrayList metas, ref MapLayout layout, Map map, bool addsounds)
{
string[] filestofix = new string[0];
if (map.MapHeader.mapType != MapTypes.Internal)
{
if (
MessageBox.Show(
"This map is an external resource and updating it will effect all the other maps. Continue?",
string.Empty,
MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
return;
}
OpenFileDialog openfiles = new OpenFileDialog();
openfiles.Multiselect = true;
openfiles.Filter = "Halo 2 Map (*.map)| *.map";
openfiles.ShowDialog();
filestofix = openfiles.FileNames;
}
if (addsounds == false)
{
for (int x = 0; x < metas.Count; x++)
{
if (((Meta)metas[x]).type == "snd!")
{
metas.RemoveAt(x);
x--;
}
}
}
int totalshift = 0;
ArrayList strings = new ArrayList();
for (int x = 0; x < metas.Count; x++)
{
Meta m = (Meta)metas[x];
for (int y = 0; y < m.items.Count; y++)
{
Meta.Item ii = m.items[y];
if (ii.type == Meta.ItemType.String)
{
Meta.String iii = (Meta.String)ii;
if (Array.IndexOf(map.Strings.Name, iii.name) == -1)
{
if (strings.IndexOf(iii.name) == -1)
{
strings.Add(iii.name);
}
}
}
}
}
map.OpenMap(MapTypes.Internal);
Meta ughmeta = new Meta(map);
ughmeta.ReadMetaFromMap(map.IndexHeader.metaCount - 1, true);
IFPIO ifp = IFPHashMap.GetIfp("ugh!", map.HaloVersion);
ughmeta.rawType = RawDataContainerType.Empty;
ughmeta.headersize = ifp.headerSize;
ughmeta.scanner.ScanWithIFP(ref ifp);
#region get model info
int tempint = layout.FindByType(RawDataContainerType.Model);
LayOutChunk loc = (LayOutChunk)layout.chunks[tempint];
#endregion
#region sound raw data
int sndshift = 0;
int sndpermcount = 0;
int sndchoicecount = 0;
int sndchunk1count = 0;
int addedsoundnames = 0;
MetaSplitter metasplit = new MetaSplitter();
metasplit.SplitWithIFP(ref ifp, ref ughmeta, map);
map.OpenMap(MapTypes.Internal);
int soundnameindex = 0;
int soundpermutationindex = 0;
int soundchoiceindex = 0;
int soundchunk1index = 0;
//.........这里部分代码省略.........
示例15: ReadH2SoundData
/// <summary>
/// The read h 2 sound data.
/// </summary>
/// <param name="TagIndex">The TagIndex.</param>
/// <param name="map">The map.</param>
/// <param name="dontreadraw">The dontreadraw.</param>
/// <remarks></remarks>
public void ReadH2SoundData(int TagIndex, Map map, bool dontreadraw)
{
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 8;
index = map.BR.ReadInt16();
count = 1; // map.BR.ReadInt16();
Permutations = new ugh_.SoundPermutationChunk[count];
for (int x = 0; x < count; x++)
{
int currentindex = index + x;
Permutations[x] = map.ugh.Permutations[currentindex];
for (int xx = 0; xx < map.ugh.Permutations[currentindex].choicecount; xx++)
{
int choiceindexx = map.ugh.Permutations[currentindex].choiceindex + xx;
Permutations[x].Choices.Add(map.ugh.Choices[choiceindexx]);
for (int xxx = 0; xxx < map.ugh.Choices[choiceindexx].soundcount; xxx++)
{
int soundindex = map.ugh.Choices[choiceindexx].soundindex + xxx;
Permutations[x].Choices[xx].SoundChunks1.Add(map.ugh.SoundChunks1[soundindex]);
RawDataChunk Raw = new RawDataChunk();
Raw.rawDataType = RawDataType.snd1;
Raw.offset = map.ugh.SoundChunks1[soundindex].offset;
Raw.size = map.ugh.SoundChunks1[soundindex].size & 0x3FFFFFFF;
Raw.rawLocation = map.ugh.SoundChunks1[soundindex].rawLocation;
if (dontreadraw == false)
{
map.OpenMap(Raw.rawLocation);
map.BR.BaseStream.Position = Raw.offset;
Raw.MS = new MemoryStream(Raw.size);
Raw.MS.Write(map.BR.ReadBytes(Raw.size), 0, Raw.size);
map.OpenMap(MapTypes.Internal);
}
this.rawChunks.Add(Raw);
}
}
}
}