HaloMap.RawData.Sound.ReadH2SoundData C# (CSharp) Method

ReadH2SoundData() public method

The read h 2 sound data.
public ReadH2SoundData ( int TagIndex, Map map, bool dontreadraw ) : void
TagIndex int The TagIndex.
map HaloMap.Map.Map The map.
dontreadraw bool The dontreadraw.
return void
        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);
                    }
                }
            }
        }