diff options
author | johndoe123 | 2012-11-19 22:24:03 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:47:38 +0200 |
commit | b2934eb166ba5b442a93969ad8b4dfbbc6ef3314 (patch) | |
tree | b2ffdaa149da1a7e1a989a6617b19849b3184923 /engines/neverhood/sound.cpp | |
parent | cc015e3d24d15dc0c3532063927fd40e2329f43e (diff) | |
download | scummvm-rg350-b2934eb166ba5b442a93969ad8b4dfbbc6ef3314.tar.gz scummvm-rg350-b2934eb166ba5b442a93969ad8b4dfbbc6ef3314.tar.bz2 scummvm-rg350-b2934eb166ba5b442a93969ad8b4dfbbc6ef3314.zip |
NEVERHOOD: Fix Klaymen "grow" animation after drinking the potion
- Remove static sprite 0x50C027A8 Scene2803/Scene2803Small because the resource doesn't exist!
- Remove some old comments
- Fix resource extData handling which fixes some crashes
- Enable reusing deleted sound/music slots in SoundMan (was disabled for debugging)
Diffstat (limited to 'engines/neverhood/sound.cpp')
-rw-r--r-- | engines/neverhood/sound.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index f0961f42e9..3cbcf96354 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -436,26 +436,22 @@ SoundItem *SoundMan::getSoundItemByHash(uint32 soundFileHash) { } int16 SoundMan::addMusicItem(MusicItem *musicItem) { -#if 0 for (uint i = 0; i < _musicItems.size(); ++i) if (!_musicItems[i]) { _musicItems[i] = musicItem; return i; } -#endif int16 musicIndex = _musicItems.size(); _musicItems.push_back(musicItem); return musicIndex; } int16 SoundMan::addSoundItem(SoundItem *soundItem) { -#if 0 for (uint i = 0; i < _soundItems.size(); ++i) if (!_soundItems[i]) { _soundItems[i] = soundItem; return i; } -#endif int16 soundIndex = _soundItems.size(); _soundItems.push_back(soundItem); return soundIndex; @@ -550,7 +546,7 @@ void AudioResourceMan::removeSound(int16 soundIndex) { void AudioResourceMan::loadSound(int16 soundIndex) { AudioResourceManSoundItem *soundItem = _soundItems[soundIndex]; - if (!soundItem->_data) { + if (!soundItem->_data && soundItem->_resourceHandle.isValid()) { // TODO Check if it's a sound resource _vm->_res->loadResource(soundItem->_resourceHandle); soundItem->_data = soundItem->_resourceHandle.data(); @@ -580,6 +576,7 @@ void AudioResourceMan::setSoundPan(int16 soundIndex, int16 pan) { } void AudioResourceMan::playSound(int16 soundIndex, bool looping) { + AudioResourceManSoundItem *soundItem = _soundItems[soundIndex]; if (!soundItem->_data) loadSound(soundIndex); @@ -587,8 +584,9 @@ void AudioResourceMan::playSound(int16 soundIndex, bool looping) { if (!soundItem->_data) return; - Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundItem->_data, soundItem->_resourceHandle.size(), DisposeAfterUse::NO); const byte *shiftValue = soundItem->_resourceHandle.extData(); + + Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundItem->_data, soundItem->_resourceHandle.size(), DisposeAfterUse::NO); NeverhoodAudioStream *audioStream = new NeverhoodAudioStream(22050, *shiftValue, false, DisposeAfterUse::YES, stream); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &soundItem->_soundHandle, |