本文整理汇总了C#中HaloMap.Meta.Meta.ReadMetaFromMap方法的典型用法代码示例。如果您正苦于以下问题:C# Meta.ReadMetaFromMap方法的具体用法?C# Meta.ReadMetaFromMap怎么用?C# Meta.ReadMetaFromMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HaloMap.Meta.Meta
的用法示例。
在下文中一共展示了Meta.ReadMetaFromMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetaItemComparer
/// <summary>
/// Initializes a new instance of the <see cref="MetaItemComparer"/> class.
/// </summary>
/// <param name="currentForm">The current form.</param>
/// <remarks></remarks>
public MetaItemComparer(MapForm currentForm)
{
Map map = currentForm.map;
int counter = 0;
for (counter = 0; counter < map.MapHeader.fileCount; counter++)
{
currentForm.SetProgressBar(counter * 100 / map.MapHeader.fileCount);
ifpMeta = new Meta(map);
manualMeta = new Meta(map);
manualMeta.ReadMetaFromMap(counter, false);
ifpMeta.ReadMetaFromMap(counter, false);
// parse ifp and scan meta with it
try
{
IFPIO io = IFPHashMap.GetIfp(ifpMeta.type, map.HaloVersion);
ifpMeta.headersize = io.headerSize;
manualMeta.headersize = io.headerSize;
try
{
ifpMeta.scanner.ScanWithIFP(ref io);
}
catch (Exception ex)
{
Global.ShowErrorMsg("Broken IFP - " + ifpMeta.type, ex);
}
manualMeta.scanner.ScanManually();
check(map);
}
catch (Exception ex)
{
Globals.Global.ShowErrorMsg(string.Empty, ex);
}
}
currentForm.SetProgressBar(0);
}
示例2: Populate
public void Populate(int iOffset, int iIndexedReflexiveOffset)
{
this.isNulledOutReflexive = false;
System.IO.BinaryReader BR = new System.IO.BinaryReader(meta.MS);
int mapMetaOffset = meta.offset;
if (this._EntIndex.reflexiveTagType + this._EntIndex.reflexiveTagName != string.Empty)
{
int tagNum = map.Functions.ForMeta.FindByNameAndTagType(this._EntIndex.reflexiveTagType, this._EntIndex.reflexiveTagName);
if (tagNum != -1)
{
Meta meta2 = new Meta(map);
map.OpenMap(MapTypes.Internal);
meta2.ReadMetaFromMap(tagNum, true);
map.CloseMap();
mapMetaOffset = meta2.offset;
this._EntIndex.reflexiveLayer = "root";
}
}
if (this._EntIndex.reflexiveLayer.ToLower() == "root")
this._IndexedReflexiveOffset = mapMetaOffset + this._EntIndex.ReflexiveOffset;
else if (this._EntIndex.reflexiveLayer.ToLower() == "oneup")
this._IndexedReflexiveOffset = iIndexedReflexiveOffset + this._EntIndex.ReflexiveOffset;
/*
bool openedMap = false;
if (map.isOpen == false)
{
map.OpenMap(MapTypes.Internal);
openedMap = true;
}
map.BA.Position = iOffset + this.chunkOffset;
*/
BR.BaseStream.Position = iOffset + this.chunkOffset;
this.offsetInMap = meta.offset + iOffset + this.chunkOffset;
switch (_ValueType)
{
case IFPIO.ObjectEnum.Short:
{
this.Value = (int)BR.ReadInt16();
break;
}
case IFPIO.ObjectEnum.Int:
{
this.Value = BR.ReadInt32();
break;
}
case IFPIO.ObjectEnum.UShort:
{
this.Value = (int)BR.ReadUInt16();
break;
}
case IFPIO.ObjectEnum.UInt:
{
this.Value = (int)BR.ReadUInt32();
break;
}
case IFPIO.ObjectEnum.Byte:
{
this.Value = (int)BR.ReadByte();
break;
}
}
UpdateSelectionList(false);
/*
if (openedMap == true)
map.CloseMap();
*/
}
示例3: OverWrite
/// <summary>
/// The over write.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="tagIndex">Index of the tag.</param>
/// <param name="newMeta">The new meta.</param>
/// <remarks></remarks>
public static void OverWrite(Map map, int tagIndex, ref Meta newMeta)
{
TagIndex = tagIndex;
if (map.MetaInfo.TagType[tagIndex] == "sbsp")
{
MessageBox.Show("Can't OverWrite The Bsp");
return;
}
newMeta.RelinkReferences();
ArrayList metas = new ArrayList(0);
map.OpenMap(MapTypes.Internal);
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (tagIndex == x)
{
newMeta.type = map.MetaInfo.TagType[x];
newMeta.name = map.FileNames.Name[x];
SizeOfShift = newMeta.size - map.MetaInfo.Size[x];
metas.Add(newMeta);
continue;
}
Meta m = new Meta(map);
m.ReadMetaFromMap(x, true);
try
{
IFPIO ifpx = IFPHashMap.GetIfp(m.type, map.HaloVersion);
m.headersize = ifpx.headerSize;
m.scanner.ScanWithIFP(ref ifpx);
// metaScanner.ScanManually(ref m, ref map);
metas.Add(m);
}
catch (System.Exception ex)
{
Globals.Global.ShowErrorMsg(string.Empty, ex);
}
}
FixReflexives(metas, map);
map.CloseMap();
}
示例4: LoadSky
/// <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();
}
示例5: MapRebuilder
/// <summary>
/// The map rebuilder.
/// </summary>
/// <param name="layout">The layout.</param>
/// <remarks></remarks>
public void MapRebuilder(ref MapLayout layout)
{
int totalshift = 0;
// find new strings
///
///
ArrayList strings = new ArrayList();
foreach (string s in map.Strings.Name)
{
strings.Add(s);
}
for (int x = 0; x < MetaList.Count; x++)
{
Meta m = (Meta)MetaList[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 (strings.IndexOf(iii.name) == -1)
{
strings.Add(iii.name);
}
}
}
}
///read ugh to meta
///
///
map.OpenMap(MapTypes.Internal);
Meta ughmeta = new Meta(map);
ughmeta.ReadMetaFromMap(map.IndexHeader.metaCount - 1, false);
IFPIO ifp = IFPHashMap.GetIfp("ugh!", map.HaloVersion);
ughmeta.headersize = ifp.headerSize;
ughmeta.scanner.ScanWithIFP(ref ifp);
MetaList.Add(ughmeta);
string temps = string.Empty;
///get model info
int tempint = layout.FindByType(RawDataContainerType.Model);
LayOutChunk loc = (LayOutChunk)layout.chunks[tempint];
//////////////////////////////////////
///model raw data
///
int modeshift = 0;
loc.startoffset += totalshift;
for (int x = 0; x < MetaList.Count; x++)
{
Meta m = (Meta)MetaList[x];
if (m.rawType == RawDataContainerType.Model)
{
BinaryWriter BW = new BinaryWriter(m.MS);
for (int y = 0; y < m.raw.rawChunks.Count; y++)
{
RawDataChunk r = m.raw.rawChunks[y];
if (r.rawLocation != MapTypes.Internal)
{
int tempintxx = r.offset;
if (r.rawLocation == MapTypes.MPShared)
{
tempintxx |= int.Parse("80000000", NumberStyles.HexNumber);
}
else if (r.rawLocation == MapTypes.SPShared)
{
tempintxx |= int.Parse("C0000000", NumberStyles.HexNumber);
}
else if (r.rawLocation == MapTypes.MainMenu)
{
tempintxx |= int.Parse("40000000", NumberStyles.HexNumber);
}
// writes new pointer to loaded meta
BW.BaseStream.Position = r.pointerMetaOffset;
BW.Write(tempintxx);
BW.Write(r.size);
continue;
}
int tempintx = loc.startoffset + modeshift;
// writes new pointer to loaded meta
BW.BaseStream.Position = r.pointerMetaOffset;
BW.Write(tempintx);
BW.Write(r.size);
//.........这里部分代码省略.........
示例6: LoadScenery
/// <summary>
/// The load scenery.
/// </summary>
/// <param name="SceneryList">The scenery list.</param>
/// <remarks></remarks>
public void LoadScenery(ref List<SceneryInfo> SceneryList)
{
if (SceneryList == null)
{
SceneryList = new List<SceneryInfo>();
}
else
{
SceneryList.Clear();
}
map.OpenMap(MapTypes.Internal);
// Lists all Scenery
for (int i = 0; i < map.MapHeader.fileCount; i++)
{
if (map.MetaInfo.TagType[i] == "scnr")
{
Meta m = new Meta(map);
// Base address of SCNR tag, offset of Scenery Palette pointer (+88)
map.BR.BaseStream.Position = map.MetaInfo.Offset[i] + 88;
int chunkCount = map.BR.ReadInt32();
int chunkOffset = map.BR.ReadInt32() - map.SecondaryMagic;
// Scenery Palette Objects
for (int a = 0; a < chunkCount; a++)
{
SceneryInfo Scenery = new SceneryInfo();
// The Palette Chunk #
Scenery.ScenPalNumber = a;
// Each chunk is 40 bytes apart
map.BR.BaseStream.Position = chunkOffset + a * 40;
char[] tagName = map.BR.ReadChars(4);
Scenery.ScenTagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
try
{
// Retrieve the Model HLMT tag from the Scenery tag (+56)
map.BR.BaseStream.Position = map.MetaInfo.Offset[Scenery.ScenTagNumber] + 56;
Scenery.HlmtTagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
// Base address of HLMT tag, offset of MODE pointer (+4)
map.BR.BaseStream.Position = map.MetaInfo.Offset[Scenery.HlmtTagNumber] + 4;
Scenery.ModelTagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
if (Scenery.ModelTagNumber != -1)
{
m.ReadMetaFromMap(Scenery.ModelTagNumber, false);
Scenery.Model = new ParsedModel(ref m);
}
else
{
Scenery.Model = null;
}
ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref device, ref Scenery.Model);
string[] s = map.FileNames.Name[Scenery.ScenTagNumber].Split('\\');
Scenery.Name = s[s.Length - 1];
Scenery.TagPath = map.FileNames.Name[Scenery.ScenTagNumber];
Scenery.TagType = map.MetaInfo.TagType[Scenery.ScenTagNumber];
SceneryList.Add(Scenery);
}
catch
{
}
}
break;
}
}
map.CloseMap();
}
示例7: tsExternalReferenceAdd_Click
private void tsExternalReferenceAdd_Click(object sender, EventArgs e)
{
TreeNode tn = treeViewTagReflexives.SelectedNode;
reflexiveData rd = (reflexiveData)tn.Tag;
if (rd.reflexive == null)
{
MessageBox.Show("Not a reflexive!");
return;
}
WinMetaEditor.references refs = new WinMetaEditor.references();
if (rd.inTagNumber == this.meta.TagIndex)
{
refs.ident = this.meta.offset + rd.baseOffset + this.meta.magic;
refs.offset = rd.baseOffset;
refs.tagIndex = this.meta.TagIndex;
refs.tagName = this.meta.name;
refs.tagType = this.meta.type;
}
else
{
refs.tagIndex = map.Functions.ForMeta.FindMetaByOffset(rd.baseOffset);
Meta m = new Meta(map);
map.OpenMap(MapTypes.Internal);
m.ReadMetaFromMap(refs.tagIndex, true);
map.CloseMap();
refs.ident = rd.baseOffset + m.magic;
refs.offset = rd.baseOffset;
refs.tagName = m.name;
refs.tagType = m.type;
m.Dispose();
}
refs.chunkCount = rd.chunkCount;
refs.size = rd.reflexive.chunkSize;
refs.name = rd.reflexive.name;
// Check for duplicates & remove
List<WinMetaEditor.references> refList = ((WinMetaEditor)this.ParentForm).reflexiveReferences;
for (int i = 0; i < refList.Count; i++)
{
if (refList[i].ident == refs.ident)
refList.RemoveAt(i--);
}
// Always add to top of list
refList.Insert(0, refs);
}
示例8: CEShaderInfo
//.........这里部分代码省略.........
break;
case "swat":
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 88;
mainid = map.BR.ReadInt32();
break;
case "smet":
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + 88;
mainid = map.BR.ReadInt32();
break;
}
map.CloseMap();
mainid = map.Functions.ForMeta.FindMetaByID(mainid);
primarydetail = map.Functions.ForMeta.FindMetaByID(primarydetail);
secondarydetail = map.Functions.ForMeta.FindMetaByID(secondarydetail);
micro = map.Functions.ForMeta.FindMetaByID(micro);
if (mainid == -1)
{
return;
}
if (map.MetaInfo.external[mainid])
{
map.OpenMap(MapTypes.Bitmaps);
}
else
{
map.OpenMap(MapTypes.Internal);
}
Meta tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(mainid, false);
map.CloseMap();
ParsedBitmap pm = new ParsedBitmap(ref tempmeta, map);
// Attempt to load LOD2, if that fails, load LOD0
try
{
this.MainBitmap = pm.FindChunkAndDecode(0, 2, 0, ref tempmeta, map, 0, 0);
}
catch
{
this.MainBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
}
this.MainName = map.FileNames.Name[mainid];
if (primarydetail != -1)
{
if (map.MetaInfo.external[primarydetail])
{
map.OpenMap(MapTypes.Bitmaps);
}
else
{
map.OpenMap(MapTypes.Internal);
}
tempmeta = new Meta(map);
tempmeta.ReadMetaFromMap(primarydetail, false);
map.CloseMap();
pm = new ParsedBitmap(ref tempmeta, map);
this.primarydetailBitmap = pm.FindChunkAndDecode(0, 0, 0, ref tempmeta, map, 0, 0);
this.primarydetailName = map.FileNames.Name[primarydetail];
示例9: fixSystemLinkToolStripMenuItem_Click
/// <summary>
/// The fix system link tool strip menu item_ click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <remarks></remarks>
private void fixSystemLinkToolStripMenuItem_Click(object sender, EventArgs e)
{
int count = 0;
List<int> ids = new List<int>();
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
switch (map.MetaInfo.TagType[x])
{
case "bipd":
case "bloc":
case "ctrl":
case "jpt!":
case "mach":
case "scen":
case "ssce":
case "vehi":
ids.Add(map.MetaInfo.Ident[x]);
count++;
break;
case "eqip":
case "garb":
case "proj":
ids.Add(map.MetaInfo.Ident[x]);
ids.Add(map.MetaInfo.Ident[x]);
count += 2;
break;
case "weap":
ids.Add(map.MetaInfo.Ident[x]);
ids.Add(map.MetaInfo.Ident[x]);
ids.Add(map.MetaInfo.Ident[x]);
count += 3;
break;
}
}
map.OpenMap(MapTypes.Internal);
Meta m = new Meta(map);
m.ReadMetaFromMap(3, true);
try
{
IFPIO io = IFPHashMap.GetIfp("scnr", map.HaloVersion);
m.headersize = io.headerSize;
m.scanner.ScanWithIFP(ref io);
MetaSplitter metasplit = new MetaSplitter();
metasplit.SplitWithIFP(ref io, ref m, map);
for (int x = 0; x < metasplit.Header.Chunks[0].ChunkResources.Count; x++)
{
// Offset 984 = [SCNR] Predicted Resources
if (metasplit.Header.Chunks[0].ChunkResources[x].offset == 984)
{
MetaSplitter.SplitReflexive reflex =
(MetaSplitter.SplitReflexive)metasplit.Header.Chunks[0].ChunkResources[x];
// count = # of chunks incl. added/removed
// reflex.Chunks.Count = # of chunks listed in Predicted Resources (?)
int diff = count - reflex.Chunks.Count;
// Add/Remove chunks to match the difference
for (int y = 0; y < diff; y++)
{
MetaSplitter.SplitReflexive MetaChunk = new MetaSplitter.SplitReflexive();
MetaChunk.splitReflexiveType = MetaSplitter.SplitReflexive.SplitReflexiveType.Chunk;
MetaChunk.chunksize = 4;
MetaChunk.MS = new MemoryStream(4);
reflex.Chunks.Add(MetaChunk);
}
for (int y = 0; y < reflex.Chunks.Count; y++)
{
BinaryWriter BW = new BinaryWriter(reflex.Chunks[y].MS);
BW.Write(ids[y]);
}
metasplit.Header.Chunks[0].ChunkResources[x] = reflex;
break;
}
}
Meta newmeta = MetaBuilder.BuildMeta(metasplit, map);
map.OpenMap(MapTypes.Internal);
map.ChunkTools.Add(newmeta);
map.CloseMap();
// info.OpenMap(MapTypes.Internal);
// info.BW.BaseStream.Position = m.offset + r.translation;
// for (int x = 0; x < count; x++)
//.........这里部分代码省略.........
示例10: LoadSpawns
//.........这里部分代码省略.........
{
SpawnInfo.RotationSpawn tempspawn2 = bsp.Spawns.Spawn[xx] as SpawnInfo.RotationSpawn;
if (bsp.Spawns.Spawn[xx] is SpawnInfo.BoundingBoxSpawn)
{
continue;
}
if (tempspawn.ModelTagNumber == tempspawn2.ModelTagNumber)
{
BoundingBoxModel[x] = BoundingBoxModel[xx];
spawnmodelindex[x] = spawnmodelindex[xx];
bsp.Spawns.Spawn[x].bbXDiff = bsp.Spawns.Spawn[xx].bbXDiff;
bsp.Spawns.Spawn[x].bbYDiff = bsp.Spawns.Spawn[xx].bbYDiff;
bsp.Spawns.Spawn[x].bbZDiff = bsp.Spawns.Spawn[xx].bbZDiff;
found = true;
break;
}
}
if (found)
{
continue;
}
#endregion
#region ReadSpawnMeta
Meta m = new Meta(map);
if (tempspawn.ModelTagNumber == -1)
{
MessageBox.Show("Test");
}
m.ReadMetaFromMap(tempspawn.ModelTagNumber, false);
#endregion
#region DirectXModel
ParsedModel pm = new ParsedModel(ref m);
// pm.PermutationString=pm.hlmt.Permutations[pm.hlmt.FindPermutationByBaseClass,
ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref render.device, ref pm);
SpawnModel.Add(pm);
spawnmodelindex[x] = SpawnModel.Count - 1;
m.Dispose();
#endregion
#region BoundingBox
float boxwidth = pm.BoundingBox.MaxX - pm.BoundingBox.MinX;
float boxheight = pm.BoundingBox.MaxY - pm.BoundingBox.MinY;
float boxdepth = pm.BoundingBox.MaxZ - pm.BoundingBox.MinZ;
try
{
BoundingBoxModel[x] = Mesh.Box(render.device, boxwidth, boxheight, boxdepth);
}
catch (Exception ex)
{
Global.ShowErrorMsg("Failure to create Bounding Box Mesh for " + pm.name +
"\nWidth : " + boxwidth.ToString() +
"\nHeight: " + boxheight.ToString() +
"\nLength: " + boxdepth.ToString(),
ex);
}
示例11: Add
/// <summary>
/// The add.
/// </summary>
/// <param name="tagIndex">Index of the tag.</param>
/// <param name="metasplit">The metasplit.</param>
/// <remarks></remarks>
public void Add(int tagIndex, MetaSplitter metasplit)
{
// TagIndex - Global Variable
this.TagIndex = tagIndex;
ArrayList metas = new ArrayList(0);
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
// sender.setProgressBar(x / map.IndexHeader.metaCount);
Meta m = new Meta(map);
m.ReadMetaFromMap(x, true);
// Read meta layout of TAG from .ENT file
IFPIO ifpx = IFPHashMap.GetIfp(m.type, map.HaloVersion);
m.headersize = ifpx.headerSize;
if (m.type == "sbsp")
{
}
else
{
// anything but "sbsp"
m.scanner.ScanWithIFP(ref ifpx);
// metaScanner.ScanManually(ref m, ref map);
}
metas.Add(m);
}
// sender.setProgressBar(0);
Meta targetTag = (Meta)metas[tagIndex];
Meta tempm = MetaBuilder.BuildMeta(metasplit, map); // (Meta) metas[TagIndex];
metas[tagIndex] = tempm;
// ((Meta)metas[TagIndex]).RelinkReferences(map);
SizeOfShift = tempm.size - targetTag.size;
// Map IS already open? I guess it's a safety check.
map.OpenMap(MapTypes.Internal);
FixReflexives(metas);
map.CloseMap();
}
示例12: ToDir
/// <summary>
/// The to dir.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="path">The path.</param>
/// <remarks></remarks>
public static void ToDir(Map map, string path)
{
if (path[path.Length - 1] != '\\')
{
path += "\\";
}
Results = new Hashtable();
List<Meta> metas = new List<Meta>();
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
Meta m = new Meta(map);
m.ReadMetaFromMap(x, true);
m.scanner.ScanManually();
metas.Add(m);
}
for (int x = 0; x < metas.Count; x++)
{
Meta m = metas[x];
DissectMeta(ref m);
metas[x] = m;
}
}
示例13: RecursivelyCheckMetas
/// <summary>
/// The recursively check metas.
/// </summary>
/// <param name="tn">The tn.</param>
/// <remarks></remarks>
private void RecursivelyCheckMetas(TreeNode tn)
{
foreach (TreeNode n in tn.Nodes)
{
if (n.Checked == false)
{
continue;
}
if (n.Text.IndexOf('.') == -1)
{
RecursivelyCheckMetas(n);
continue;
}
StatusLabel1.Text = "Processing: " + n.Text + "...";
Application.DoEvents();
int id = 0;
for (int xx = 0; xx < map.IndexHeader.metaCount; xx++)
{
string[] tempn = map.FileNames.Name[xx].Split('\\');
string tempi = tempn[tempn.Length - 1] + "." + map.MetaInfo.TagType[xx];
int i = map.FileNames.Name[xx].LastIndexOf('\\');
string tempp = string.Empty;
if (i != -1)
{
tempp = map.FileNames.Name[xx].Substring(0, i) + "\\";
}
if (n.Text == tempi && n.Tag.ToString() == map.FileNames.Name[xx] + "." + map.MetaInfo.TagType[xx])
{
id = xx;
break;
}
}
if (map.MetaInfo.TagType[id] == "ltmp")
{
Meta templtmp = new Meta(map);
templtmp.TagIndex = id;
templtmp.type = map.MetaInfo.TagType[id];
templtmp.name = map.FileNames.Name[id];
templtmp.offset = 0;
templtmp.size = 0;
templtmp.ident = map.MetaInfo.Ident[id];
templtmp.MS = new MemoryStream(0);
templtmp.rawType = RawDataContainerType.Empty;
templtmp.items = new List<Meta.Item>();
MetaList.Add(templtmp);
continue;
}
if (map.MetaInfo.TagType[id] == "ugh!")
{
continue;
}
if (map.MetaInfo.TagType[id] == "snd!")
{
// dontscanraw = true;
}
Meta m = new Meta(map);
m.ReadMetaFromMap(id, false);
if (m.type != "sbsp" && m.type != "jmad")
{
IFPIO ifp = IFPHashMap.GetIfp(m.type, map.HaloVersion);
// m.parsed = true;
m.headersize = ifp.headerSize;
m.scanner.ScanWithIFP(ref ifp);
}
else
{
m.scanner.ScanManually();
}
switch (m.type.Trim())
{
case "matg":
matg = m;
break;
case "sncl":
sncl = m;
break;
case "spk!":
spk = m;
break;
case "scnr":
scnr = m;
break;
//.........这里部分代码省略.........
示例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: LoadWeapons
/// <summary>
/// The load weapons.
/// </summary>
/// <param name="WeaponsList">The weapons list.</param>
/// <remarks></remarks>
public void LoadWeapons(ref List<CollectionInfo> WeaponsList)
{
if (WeaponsList == null)
{
WeaponsList = new List<CollectionInfo>();
}
else
{
WeaponsList.Clear();
}
map.OpenMap(MapTypes.Internal);
// Lists all weapons
for (int i = 0; i < map.MetaInfo.TagType.Length; i++)
{
if ((map.MetaInfo.TagType[i] == "itmc") || (map.MetaInfo.TagType[i] == "vehc"))
{
CollectionInfo Weapon = new CollectionInfo();
Meta m = new Meta(map);
m.ReadMetaFromMap(i, false);
Weapon.ModelTagNumber = map.Functions.FindModelByBaseClass(i);
if (Weapon.ModelTagNumber != -1)
{
m.ReadMetaFromMap(Weapon.ModelTagNumber, false);
Weapon.Model = new ParsedModel(ref m);
ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref device, ref Weapon.Model);
// Store names into Weapon
Weapon.TagPath = map.FileNames.Name[i];
Weapon.TagType = map.MetaInfo.TagType[i];
int xx = map.Functions.ForMeta.FindByNameAndTagType(Weapon.TagType, Weapon.TagPath);
string[] NameSplit = map.FileNames.Name[xx].Split('\\');
Weapon.Name = NameSplit[NameSplit.Length - 1];
Weapon.Name = Weapon.Name.Replace('_', ' ');
WeaponsList.Add(Weapon);
}
}
}
map.CloseMap();
}