aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-12-27 17:21:04 +0100
committerStrangerke2014-12-27 17:21:04 +0100
commit576bab349c862b16fcca1e9e0fb3fbb52cc6edc4 (patch)
tree25c5665f2481ef872dc999f790624c7d1662bb2c /engines
parent6a7834a05ed880cba32f0adb87950179c4ec404c (diff)
downloadscummvm-rg350-576bab349c862b16fcca1e9e0fb3fbb52cc6edc4.tar.gz
scummvm-rg350-576bab349c862b16fcca1e9e0fb3fbb52cc6edc4.tar.bz2
scummvm-rg350-576bab349c862b16fcca1e9e0fb3fbb52cc6edc4.zip
ACCESS: Use loadSoundTable instead of push_back in several places
Diffstat (limited to 'engines')
-rw-r--r--engines/access/access.cpp9
-rw-r--r--engines/access/amazon/amazon_game.cpp4
-rw-r--r--engines/access/amazon/amazon_logic.cpp12
-rw-r--r--engines/access/sound.cpp4
-rw-r--r--engines/access/sound.h2
5 files changed, 16 insertions, 15 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 080a8ef975..7f59ae7ad6 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -222,14 +222,14 @@ void AccessEngine::speakText(ASurface *s, const Common::String &msg) {
_events->clearEvents();
while (!shouldQuit()) {
_sound->freeSounds();
- Resource *sound = _sound->loadSound(_narateFile + 99, _sndSubFile);
- _sound->_soundTable.push_back(SoundEntry(sound, 1));
+ _sound->loadSoundTable(0, _narateFile + 99, _sndSubFile);
_sound->playSound(0);
- _scripts->cmdFreeSound();
while(_sound->isSFXPlaying() && !shouldQuit())
_events->pollEvents();
+ _scripts->cmdFreeSound();
+
if (_events->isKeyMousePressed()) {
_sndSubFile += soundsLeft;
break;
@@ -257,11 +257,12 @@ void AccessEngine::speakText(ASurface *s, const Common::String &msg) {
Resource *res = _sound->loadSound(_narateFile + 99, _sndSubFile);
_sound->_soundTable.push_back(SoundEntry(res, 1));
_sound->playSound(0);
- _scripts->cmdFreeSound();
while(_sound->isSFXPlaying() && !shouldQuit())
_events->pollEvents();
+ _scripts->cmdFreeSound();
+
if (_events->_leftButton) {
_events->debounceLeft();
_sndSubFile += soundsLeft;
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index d6b759b308..4c9df7b8ff 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -528,8 +528,8 @@ void AmazonEngine::startChapter(int chapter) {
_sound->freeSounds();
if (isCD()) {
- _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(115, 0), 1));
- _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(115, 1), 1));
+ _sound->loadSoundTable(0, 115, 0);
+ _sound->loadSoundTable(1, 115, 1);
_sound->playSound(0);
_sound->playSound(1);
diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp
index 82f0edfa6e..6dffb85e5e 100644
--- a/engines/access/amazon/amazon_logic.cpp
+++ b/engines/access/amazon/amazon_logic.cpp
@@ -490,12 +490,12 @@ void Opening::doTent() {
_vm->_screen->setDisplayScan();
_vm->_screen->forceFadeOut();
_vm->_events->hideCursor();
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 39), 1));
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 14), 1));
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 15), 1));
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 16), 1));
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 31), 2));
- _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 52), 2));
+ _vm->_sound->loadSoundTable(0, 98, 39);
+ _vm->_sound->loadSoundTable(1, 98, 14);
+ _vm->_sound->loadSoundTable(2, 98, 15);
+ _vm->_sound->loadSoundTable(3, 98, 16);
+ _vm->_sound->loadSoundTable(4, 98, 31, 2);
+ _vm->_sound->loadSoundTable(5, 98, 52, 2);
_vm->_sound->playSound(0);
_vm->_files->_setPaletteFlag = false;
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 53b611b65b..221b409aa9 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -56,7 +56,7 @@ void SoundManager::clearSounds() {
}
}
-void SoundManager::loadSoundTable(int idx, int fileNum, int subfile) {
+void SoundManager::loadSoundTable(int idx, int fileNum, int subfile, int priority) {
debugC(1, kDebugSound, "loadSoundTable(%d, %d, %d)", idx, fileNum, subfile);
Resource *soundResource;
@@ -67,7 +67,7 @@ void SoundManager::loadSoundTable(int idx, int fileNum, int subfile) {
delete _soundTable[idx]._res;
soundResource = _vm->_files->loadFile(fileNum, subfile);
_soundTable[idx]._res = soundResource;
- _soundTable[idx]._priority = 1;
+ _soundTable[idx]._priority = priority;
}
Resource *SoundManager::loadSound(int fileNum, int subfile) {
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 7109438f43..90f6656e26 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -60,7 +60,7 @@ public:
SoundManager(AccessEngine *vm, Audio::Mixer *mixer);
~SoundManager();
- void loadSoundTable(int idx, int fileNum, int subfile);
+ void loadSoundTable(int idx, int fileNum, int subfile, int priority = 1);
void playSound(int soundIndex);
void checkSoundQueue();