예제 #1
0
 public WadAdditionalSoundInfo(WadAdditionalSoundInfoId id)
 {
     Id = id;
 }
예제 #2
0
        private static bool LoadAdditionalSoundInfos(ChunkReader chunkIO, ChunkId idOuter, Wad2 wad, Dictionary <long, WadSoundInfo> soundInfos, Dictionary <long, WadSample> samples)
        {
            if (idOuter == Wad2Chunks.AdditionalSoundInfosObsolete)
            {
                chunkIO.ReadChunks((id, chunkSize) =>
                {
                    if (id != Wad2Chunks.SoundInfo)
                    {
                        return(false);
                    }

                    WadSoundInfo soundInfo;
                    long index;
                    LoadSoundInfo(chunkIO, wad, samples, out soundInfo, out index);
                    var wId = new WadAdditionalSoundInfoId("Unnamed " + soundInfo.Name);
                    wad.AdditionalSoundInfosObsolete.Add(wId, new WadAdditionalSoundInfo(wId)
                    {
                        SoundInfo = soundInfo
                    });

                    return(true);
                });
                return(true);
            }
            else if (idOuter == Wad2Chunks.AdditionalSoundInfos)
            {
                var additionalSoundInfos = new SortedList <WadAdditionalSoundInfoId, WadAdditionalSoundInfo>();
                chunkIO.ReadChunks((id, chunkSize) =>
                {
                    if (id != Wad2Chunks.AdditionalSoundInfo)
                    {
                        return(false);
                    }
                    string soundName = null;
                    int SoundInfoId  = -1;
                    chunkIO.ReadChunks((id2, chunkSize2) =>
                    {
                        if (id2 == Wad2Chunks.AdditionalSoundInfoName)
                        {
                            soundName = chunkIO.ReadChunkString(chunkSize2);
                        }
                        else if (id2 == Wad2Chunks.AdditionalSoundInfoSoundInfoId)
                        {
                            SoundInfoId = chunkIO.ReadChunkInt(chunkSize2);
                        }
                        else
                        {
                            return(false);
                        }
                        return(true);
                    });

                    var Id = new WadAdditionalSoundInfoId(soundName);
                    additionalSoundInfos.Add(Id, new WadAdditionalSoundInfo(Id)
                    {
                        SoundInfo = soundInfos[SoundInfoId]
                    });
                    return(true);
                });

                wad.AdditionalSoundInfosObsolete = additionalSoundInfos;
                return(true);
            }
            return(false);
        }