aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
authorMax Horn2006-04-23 23:00:32 +0000
committerMax Horn2006-04-23 23:00:32 +0000
commite80d24aa22e5e83a86b28454d23241f3574eef1f (patch)
tree58852fa7ad03cfd0d79f21b3cee69a04a3446c60 /engines/scumm/he
parent91831974a86e5964f24c745c45ea3ed75589ac2e (diff)
downloadscummvm-rg350-e80d24aa22e5e83a86b28454d23241f3574eef1f.tar.gz
scummvm-rg350-e80d24aa22e5e83a86b28454d23241f3574eef1f.tar.bz2
scummvm-rg350-e80d24aa22e5e83a86b28454d23241f3574eef1f.zip
Some more cleanup in class Scumm::Sound
svn-id: r22125
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/resource_he.cpp10
-rw-r--r--engines/scumm/he/sound_he.cpp7
-rw-r--r--engines/scumm/he/sound_he.h10
3 files changed, 22 insertions, 5 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 9bf44b214c..103d9b8e32 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -1821,8 +1821,8 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
int i;
int chan = -1;
- for (i = 0; i < ARRAYSIZE(_sound->_heChannel); i++) {
- if (_sound->_heChannel[i].sound == snd1id)
+ for (i = 0; i < ARRAYSIZE(((SoundHE *)_sound)->_heChannel); i++) {
+ if (((SoundHE *)_sound)->_heChannel[i].sound == snd1id)
chan = i;
}
@@ -1830,8 +1830,8 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
sbng2Ptr = heFindResource(MKID_BE('SBNG'), snd2Ptr);
if (sbng1Ptr != NULL && sbng2Ptr != NULL) {
- if (chan != -1 && _sound->_heChannel[chan].codeOffs > 0) {
- int curOffs = _sound->_heChannel[chan].codeOffs;
+ if (chan != -1 && ((SoundHE *)_sound)->_heChannel[chan].codeOffs > 0) {
+ int curOffs = ((SoundHE *)_sound)->_heChannel[chan].codeOffs;
src = snd1Ptr + curOffs;
dst = sbng1Ptr + 8;
@@ -1850,7 +1850,7 @@ void ScummEngine_v80he::createSound(int snd1id, int snd2id) {
dst = sbng1Ptr + 8;
}
- _sound->_heChannel[chan].codeOffs = sbng1Ptr - snd1Ptr + 8;
+ ((SoundHE *)_sound)->_heChannel[chan].codeOffs = sbng1Ptr - snd1Ptr + 8;
tmp = sbng2Ptr + 8;
while ((offs = READ_LE_UINT16(tmp)) != 0) {
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index e626d78ef9..af17ed6ac0 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -157,6 +157,13 @@ void SoundHE::stopSound(int sound) {
}
}
+void SoundHE::stopAllSounds() {
+ // Clear sound channels for HE games
+ memset(_heChannel, 0, sizeof(_heChannel));
+
+ Sound::stopAllSounds();
+}
+
void SoundHE::setupSound() {
Sound::setupSound();
diff --git a/engines/scumm/he/sound_he.h b/engines/scumm/he/sound_he.h
index 1beae1ab43..4e3511b2ab 100644
--- a/engines/scumm/he/sound_he.h
+++ b/engines/scumm/he/sound_he.h
@@ -43,6 +43,15 @@ protected:
Audio::SoundHandle _heSoundChannels[8];
+public: // Used by createSound()
+ struct {
+ int sound;
+ int codeOffs;
+ int priority;
+ int sbngBlock;
+ int soundVars[27];
+ } _heChannel[8];
+
public:
SoundHE(ScummEngine *parent);
~SoundHE();
@@ -52,6 +61,7 @@ public:
virtual int isSoundRunning(int sound) const;
virtual void stopSound(int sound);
+ virtual void stopAllSounds();
virtual void setupSound();
bool getHEMusicDetails(int id, int &musicOffs, int &musicSize);