public void ReadCEModelRaw(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 * 132) + 4;
Raw.shadernumber = map.BR.ReadInt16();
Raw.pointerMetaOffset = temprc + (x * 132) + 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.IndexHeader.ModelRawDataOffset + map.IndexHeader.ModelIndicesOffset +
map.BR.ReadInt32();
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 * 132) + 100 - map.MetaInfo.Offset[TagIndex];
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset - 12;
Raw.size = map.BR.ReadInt32();
Raw.size *= 68;
map.BR.BaseStream.Position = map.MetaInfo.Offset[TagIndex] + Raw.pointerMetaOffset;
Raw.offset = map.IndexHeader.ModelRawDataOffset + map.BR.ReadInt32();
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);
}
}
}