aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2007-12-23 02:33:58 +0000
committerFilippos Karapetis2007-12-23 02:33:58 +0000
commit5b74b676ce35172cae45278a8e6008c0858bf4d4 (patch)
tree7af869a81bb2538ec02f5f16c5f3350203739759 /engines
parent275c91be33968f17bf1ad2cad2cccdece598ce98 (diff)
downloadscummvm-rg350-5b74b676ce35172cae45278a8e6008c0858bf4d4.tar.gz
scummvm-rg350-5b74b676ce35172cae45278a8e6008c0858bf4d4.tar.bz2
scummvm-rg350-5b74b676ce35172cae45278a8e6008c0858bf4d4.zip
Disable voices when voice files do not exist (like the original interpreter does), instead of exiting with an error. This is necessary for devices with little space
svn-id: r29956
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/interface.cpp21
-rw-r--r--engines/saga/rscfile.cpp14
-rw-r--r--engines/saga/saga.cpp16
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/saga/sndres.cpp11
5 files changed, 41 insertions, 22 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 4eeb62f422..c299bbf0e0 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1597,15 +1597,20 @@ void Interface::setOption(PanelButton *panelButton) {
ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25);
break;
case kTextVoices:
- if (_vm->_subtitlesEnabled && _vm->_voicesEnabled) { // Both
- _vm->_subtitlesEnabled = false; // Set it to "Audio"
- _vm->_voicesEnabled = true; // Not necessary, just for completeness
- } else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled) {
- _vm->_subtitlesEnabled = true; // Set it to "Text"
+ if (_vm->_voiceFilesExist) {
+ if (_vm->_subtitlesEnabled && _vm->_voicesEnabled) { // Both
+ _vm->_subtitlesEnabled = false; // Set it to "Audio"
+ _vm->_voicesEnabled = true; // Not necessary, just for completeness
+ } else if (!_vm->_subtitlesEnabled && _vm->_voicesEnabled) {
+ _vm->_subtitlesEnabled = true; // Set it to "Text"
+ _vm->_voicesEnabled = false;
+ } else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled) {
+ _vm->_subtitlesEnabled = true; // Set it to "Both"
+ _vm->_voicesEnabled = true;
+ }
+ } else {
+ _vm->_subtitlesEnabled = true; // Set it to "Text"
_vm->_voicesEnabled = false;
- } else if (_vm->_subtitlesEnabled && !_vm->_voicesEnabled) {
- _vm->_subtitlesEnabled = true; // Set it to "Both"
- _vm->_voicesEnabled = true;
}
ConfMan.setBool("subtitles", _vm->_subtitlesEnabled);
diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp
index a081b200a9..6f93c8016a 100644
--- a/engines/saga/rscfile.cpp
+++ b/engines/saga/rscfile.cpp
@@ -360,6 +360,8 @@ bool Resource::createContexts() {
bool censoredVersion = false;
uint16 voiceFileType = GAME_VOICEFILE;
+ _vm->_voiceFilesExist = true;
+
// If the Wyrmkeep credits file is found, set the Wyrmkeep version flag to true
if (Common::File::exists("graphics/credit3n.dlt")) {
_vm->_gf_wyrmkeep = true;
@@ -459,6 +461,10 @@ bool Resource::createContexts() {
} else {
// No voice file found, don't add any file to the array
voicesFileInArray = true;
+ warning("No voice file found, voices will be disabled");
+ _vm->_voicesEnabled = false;
+ _vm->_subtitlesEnabled = true;
+ _vm->_voiceFilesExist = false;
}
} else {
// If the voices file is not specified in the detector table, add it here
@@ -494,6 +500,10 @@ bool Resource::createContexts() {
} else {
// No voice file found, don't add any file to the array
voicesFileInArray = true;
+ warning("No voice file found, voices will be disabled");
+ _vm->_voicesEnabled = false;
+ _vm->_subtitlesEnabled = true;
+ _vm->_voiceFilesExist = false;
}
}
}
@@ -554,9 +564,9 @@ bool Resource::createContexts() {
}
context->serial = 0;
- // IHNM has serveral different voice files, so we need to allow
+ // IHNM has several different voice files, so we need to allow
// multiple resource contexts of the same type. We tell them
- // apart by assigning each of the duplicates an unique serial
+ // apart by assigning each of the duplicates a unique serial
// number. The default behaviour when requesting a context will
// be to look for serial number 0.
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 567491b481..e2e44d5c0e 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -224,15 +224,17 @@ int SagaEngine::init() {
_gfx->initPalette();
- if (getGameType() == GType_IHNM) {
- if (!ConfMan.hasKey("voices")) {
- _voicesEnabled = true;
- ConfMan.setBool("voices", true);
+ if (_voiceFilesExist) {
+ if (getGameType() == GType_IHNM) {
+ if (!ConfMan.hasKey("voices")) {
+ _voicesEnabled = true;
+ ConfMan.setBool("voices", true);
+ } else {
+ _voicesEnabled = ConfMan.getBool("voices");
+ }
} else {
- _voicesEnabled = ConfMan.getBool("voices");
+ _voicesEnabled = true;
}
- } else {
- _voicesEnabled = true;
}
// FIXME: This is the ugly way of reducing redraw overhead. It works
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index ac4e66ce7a..7d1c275435 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -522,6 +522,7 @@ public:
int _musicVolume;
bool _subtitlesEnabled;
bool _voicesEnabled;
+ bool _voiceFilesExist;
int _readingSpeed;
bool _copyProtection;
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 9b42443582..f03a34f2c9 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -106,11 +106,6 @@ void SndRes::setVoiceBank(int serial) {
_voiceSerial = serial;
_voiceContext = _vm->_resource->getContext(GAME_VOICEFILE, _voiceSerial);
- if (_voiceContext == NULL) {
- error("SndRes::SndRes resource context not found");
- }
-
-
}
void SndRes::playSound(uint32 resourceId, int volume, bool loop) {
@@ -129,6 +124,9 @@ void SndRes::playSound(uint32 resourceId, int volume, bool loop) {
void SndRes::playVoice(uint32 resourceId) {
SoundBuffer buffer;
+ if (!(_vm->_voiceFilesExist))
+ return;
+
if (_vm->getGameType() == GType_IHNM && !(_vm->_voicesEnabled))
return;
@@ -330,6 +328,9 @@ int SndRes::getVoiceLength(uint32 resourceId) {
double msDouble;
SoundBuffer buffer;
+ if (!(_vm->_voiceFilesExist))
+ return -1;
+
if (!load(_voiceContext, resourceId, buffer, true)) {
return -1;
}