NScumm.Sky.Sound.LoadSection C# (CSharp) Method

LoadSection() public method

public LoadSection ( byte section ) : void
section byte
return void
        public void LoadSection(byte section)
        {
            FnStopFx();
            _mixer.StopAll();

            _soundData = _skyDisk.LoadFile(section * 4 + SoundFileBase);
            ushort asmOfs;
            if (SystemVars.Instance.GameVersion.Version.Minor == 109)
            {
                if (section == 0)
                    asmOfs = 0x78;
                else
                    asmOfs = 0x7C;
            }
            else
                asmOfs = 0x7E;

            if ((_soundData[asmOfs] != 0x3C) || (_soundData[asmOfs + 0x27] != 0x8D) ||
                (_soundData[asmOfs + 0x28] != 0x1E) || (_soundData[asmOfs + 0x2F] != 0x8D) ||
                (_soundData[asmOfs + 0x30] != 0x36))
                throw new NotSupportedException("Unknown sounddriver version");

            _soundsTotal = _soundData[asmOfs + 1];
            var sRateTabOfs = _soundData.ToUInt16(asmOfs + 0x29);
            _sfxBaseOfs = _soundData.ToUInt16(asmOfs + 0x31);
            _sampleRates = new ByteAccess(_soundData, sRateTabOfs);

            _sfxInfo = new UShortAccess(_soundData, _sfxBaseOfs);
            // if we just restored a savegame, the sfxqueue holds the sound we need to restart
            if (!SystemVars.Instance.SystemFlags.HasFlag(SystemFlags.GameRestored))
                for (var cnt = 0; cnt < MaxQueuedFx; cnt++)
                    SfxQueue[cnt].Count = 0;
        }

Usage Example

コード例 #1
0
        private bool FnEnterSection(uint sectionNo, uint b, uint c)
        {
            if (SkyEngine.IsDemo && (sectionNo > 2))
            {
                Control.ShowGameQuitMsg();
            }

            _scriptVariables[CUR_SECTION]    = sectionNo;
            SystemVars.Instance.CurrentMusic = 0;

            if (sectionNo == 5) //linc section - has different mouse icons
            {
                _skyMouse.ReplaceMouseCursors(60302);
            }

            if ((sectionNo != _currentSection) || SystemVars.Instance.SystemFlags.HasFlag(SystemFlags.GameRestored))
            {
                _currentSection = sectionNo;

                sectionNo++;
                _skyMusic.LoadSection((byte)sectionNo);
                _skySound.LoadSection((byte)sectionNo);
                _skyGrid.LoadGrids();
                SystemVars.Instance.SystemFlags &= ~SystemFlags.GameRestored;
            }

            return(true);
        }