[Scummvm-cvs-logs] SF.net SVN: scummvm: [29956] scummvm/trunk/engines/saga
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Dec 23 03:33:58 CET 2007
Revision: 29956
http://scummvm.svn.sourceforge.net/scummvm/?rev=29956&view=rev
Author: thebluegr
Date: 2007-12-22 18:33:58 -0800 (Sat, 22 Dec 2007)
Log Message:
-----------
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
Modified Paths:
--------------
scummvm/trunk/engines/saga/interface.cpp
scummvm/trunk/engines/saga/rscfile.cpp
scummvm/trunk/engines/saga/saga.cpp
scummvm/trunk/engines/saga/saga.h
scummvm/trunk/engines/saga/sndres.cpp
Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp 2007-12-23 00:34:48 UTC (rev 29955)
+++ scummvm/trunk/engines/saga/interface.cpp 2007-12-23 02:33:58 UTC (rev 29956)
@@ -1597,15 +1597,20 @@
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);
Modified: scummvm/trunk/engines/saga/rscfile.cpp
===================================================================
--- scummvm/trunk/engines/saga/rscfile.cpp 2007-12-23 00:34:48 UTC (rev 29955)
+++ scummvm/trunk/engines/saga/rscfile.cpp 2007-12-23 02:33:58 UTC (rev 29956)
@@ -360,6 +360,8 @@
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 @@
} 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 @@
} 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 @@
}
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.
Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp 2007-12-23 00:34:48 UTC (rev 29955)
+++ scummvm/trunk/engines/saga/saga.cpp 2007-12-23 02:33:58 UTC (rev 29956)
@@ -224,15 +224,17 @@
_gfx->initPalette();
- if (getGameType() == GType_IHNM) {
- if (!ConfMan.hasKey("voices")) {
+ if (_voiceFilesExist) {
+ if (getGameType() == GType_IHNM) {
+ if (!ConfMan.hasKey("voices")) {
+ _voicesEnabled = true;
+ ConfMan.setBool("voices", true);
+ } else {
+ _voicesEnabled = ConfMan.getBool("voices");
+ }
+ } else {
_voicesEnabled = true;
- ConfMan.setBool("voices", true);
- } else {
- _voicesEnabled = ConfMan.getBool("voices");
}
- } else {
- _voicesEnabled = true;
}
// FIXME: This is the ugly way of reducing redraw overhead. It works
Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h 2007-12-23 00:34:48 UTC (rev 29955)
+++ scummvm/trunk/engines/saga/saga.h 2007-12-23 02:33:58 UTC (rev 29956)
@@ -522,6 +522,7 @@
int _musicVolume;
bool _subtitlesEnabled;
bool _voicesEnabled;
+ bool _voiceFilesExist;
int _readingSpeed;
bool _copyProtection;
Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp 2007-12-23 00:34:48 UTC (rev 29955)
+++ scummvm/trunk/engines/saga/sndres.cpp 2007-12-23 02:33:58 UTC (rev 29956)
@@ -106,11 +106,6 @@
_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::playVoice(uint32 resourceId) {
SoundBuffer buffer;
+ if (!(_vm->_voiceFilesExist))
+ return;
+
if (_vm->getGameType() == GType_IHNM && !(_vm->_voicesEnabled))
return;
@@ -330,6 +328,9 @@
double msDouble;
SoundBuffer buffer;
+ if (!(_vm->_voiceFilesExist))
+ return -1;
+
if (!load(_voiceContext, resourceId, buffer, true)) {
return -1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list