aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/dialogs.cpp5
-rw-r--r--scumm/imuse_digi.cpp64
-rw-r--r--scumm/imuse_digi.h11
-rw-r--r--scumm/script.cpp9
-rw-r--r--scumm/script_v6.cpp11
-rw-r--r--scumm/script_v8.cpp2
-rw-r--r--scumm/scumm.h2
-rw-r--r--scumm/scummvm.cpp6
-rw-r--r--scumm/smush/insane.cpp9
-rw-r--r--scumm/smush/insane.h3
-rw-r--r--scumm/smush/smush_player.cpp5
-rw-r--r--scumm/smush/smush_player.h2
-rw-r--r--scumm/sound.cpp13
-rw-r--r--scumm/string.cpp7
14 files changed, 56 insertions, 93 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index 1501eb10ea..5008e04043 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -458,7 +458,7 @@ void ConfigDialog::open() {
GUI_OptionsDialog::open();
// update checkboxes, too
- subtitlesCheckbox->setState(_scumm->_noSubtitles == false);
+ subtitlesCheckbox->setState(ConfMan.getBool("subtitles"));
}
void ConfigDialog::close() {
@@ -484,9 +484,6 @@ void ConfigDialog::close() {
_scumm->_mixer->setVolume(soundVolumeSfx * soundVolumeMaster / 255);
_scumm->_mixer->setMusicVolume(soundVolumeMusic);
-
- // Subtitles?
- _scumm->_noSubtitles = !ConfMan.getBool("subtitles");
}
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index 35863b03f8..f0df2a8928 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -674,12 +674,6 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm)
: _scumm(scumm) {
_pause = false;
- _voiceVocData = NULL;
- _voiceVocSize = 0;
- _voiceVocRate = 0;
-
- _voiceBundleData = NULL;
-
_nameBundleMusic = "";
_musicBundleBufFinal = NULL;
_musicBundleBufOutput = NULL;
@@ -766,23 +760,15 @@ void IMuseDigital::callback() {
}
}
-void IMuseDigital::setVocVoice(byte *src, int32 size, int rate) {
- _voiceVocData = src;
- _voiceVocSize = size;
- _voiceVocRate = rate;
-}
-
-void IMuseDigital::setBundleVoice(byte *src) {
- _voiceBundleData = src;
-}
-
-void IMuseDigital::startSound(int sound) {
+void IMuseDigital::startSound(int sound, byte *voc_src, int voc_size, int voc_rate) {
debug(5, "IMuseDigital::startSound(%d)", sound);
int l, r;
for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
if (!_channel[l].used && !_channel[l].handle.isActive()) {
byte *ptr, *s_ptr;
+ byte *_voiceVocData = (voc_src && voc_size > 0) ? voc_src : 0;
+ byte *_voiceBundleData = (voc_src && voc_size <= 0) ? voc_src : 0;
if ((sound == kTalkSoundID) && (_voiceBundleData)) {
s_ptr = ptr = _voiceBundleData;
} else if ((sound == kTalkSoundID) && (_voiceVocData)) {
@@ -819,37 +805,26 @@ void IMuseDigital::startSound(int sound) {
int32 size = 0;
int t;
- if ((sound == kTalkSoundID) && (_voiceVocData)) {
- _channel[l].mixerSize = _voiceVocRate * 2;
- _channel[l].freq = _voiceVocRate;
- _channel[l].size = _voiceVocSize * 2;
- _channel[l].bits = 8;
- _channel[l].channels = 2;
- _channel[l].mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
- _channel[l].data = (byte *)malloc(_channel[l].size);
-
- for (t = 0; t < _channel[l].size / 2; t++) {
- *(_channel[l].data + t * 2 + 0) = *(_voiceVocData + t);
- *(_channel[l].data + t * 2 + 1) = *(_voiceVocData + t);
+ if ((sound == kTalkSoundID) && (_voiceVocData) || (READ_UINT32(ptr) == MKID('Crea'))) {
+ if (READ_UINT32(ptr) == MKID('Crea')) {
+ int loops = 0;
+ voc_src = readVOCFromMemory(ptr, voc_size, voc_rate, loops);
}
-
- _voiceVocData = NULL;
- } else if (READ_UINT32(ptr) == MKID('Crea')) {
- int32 loops = 0;
- byte *t_ptr= readVOCFromMemory(ptr, size, _channel[l].freq, loops);
- _channel[l].mixerSize = _channel[l].freq * 2;
- _channel[l].size = size * 2;
+ _channel[l].mixerSize = voc_rate * 2;
+ _channel[l].freq = voc_rate;
+ _channel[l].size = voc_size * 2;
_channel[l].bits = 8;
_channel[l].channels = 2;
_channel[l].mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
_channel[l].data = (byte *)malloc(_channel[l].size);
+ // Widen data to two channels
for (t = 0; t < _channel[l].size / 2; t++) {
- *(_channel[l].data + t * 2 + 0) = *(t_ptr + t);
- *(_channel[l].data + t * 2 + 1) = *(t_ptr + t);
+ *(_channel[l].data + t * 2 + 0) = *(voc_src + t);
+ *(_channel[l].data + t * 2 + 1) = *(voc_src + t);
}
- free(t_ptr);
+ free(voc_src);
} else if (READ_UINT32(ptr) == MKID('iMUS')) {
ptr += 16;
for (;;) {
@@ -964,11 +939,10 @@ void IMuseDigital::startSound(int sound) {
size *= 2;
_channel[l].channels = 2;
_channel[l].data = (byte *)malloc(size);
+ // Widen data to two channels
for (t = 0; t < size / 4; t++) {
- *(_channel[l].data + t * 4 + 0) = *(ptr + t * 2 + 0);
- *(_channel[l].data + t * 4 + 1) = *(ptr + t * 2 + 1);
- *(_channel[l].data + t * 4 + 2) = *(ptr + t * 2 + 0);
- *(_channel[l].data + t * 4 + 3) = *(ptr + t * 2 + 1);
+ *(uint16 *)(_channel[l].data + t * 4 + 0) = *(uint16 *)(ptr + t * 2);
+ *(uint16 *)(_channel[l].data + t * 4 + 2) = *(uint16 *)(ptr + t * 2);
}
}
_channel[l].size = size;
@@ -978,6 +952,7 @@ void IMuseDigital::startSound(int sound) {
size *= 2;
_channel[l].channels = 2;
_channel[l].data = (byte *)malloc(size);
+ // Widen data to two channels
for (t = 0; t < size / 2; t++) {
*(_channel[l].data + t * 2 + 0) = *(ptr + t);
*(_channel[l].data + t * 2 + 1) = *(ptr + t);
@@ -1478,8 +1453,7 @@ void IMuseDigital::playBundleSound(const char *sound) {
if (ptr) {
stopSound(kTalkSoundID);
- setBundleVoice(ptr);
- startSound(kTalkSoundID);
+ startSound(kTalkSoundID, ptr);
free(ptr);
}
}
diff --git a/scumm/imuse_digi.h b/scumm/imuse_digi.h
index 9bd7b379e9..5d462f650b 100644
--- a/scumm/imuse_digi.h
+++ b/scumm/imuse_digi.h
@@ -130,17 +130,12 @@ private:
public:
int32 _bundleSongPosInMs;
Bundle *_bundle; // FIXME: should be protected but is used by ScummEngine::askForDisk
- byte *_voiceVocData;
- int32 _voiceVocSize;
- int _voiceVocRate;
-
- byte *_voiceBundleData;
void pauseBundleMusic(bool state);
void stopBundleMusic();
void playBundleSound(const char *sound);
- void setVocVoice(byte *src, int32 size, int rate);
- void setBundleVoice(byte *src);
+
+ void startSound(int sound, byte *src, int size = 0, int rate = 0);
public:
IMuseDigital(ScummEngine *scumm);
@@ -148,7 +143,7 @@ public:
void setMasterVolume(int vol) {}
- void startSound(int sound);
+ void startSound(int sound) { startSound(sound, 0, 0, 0); }
void stopSound(int sound);
void stopAllSounds();
void pause(bool pause);
diff --git a/scumm/script.cpp b/scumm/script.cpp
index c7252f98be..9fc9e15315 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -22,6 +22,7 @@
#include "stdafx.h"
+#include "common/config-manager.h"
#include "common/util.h"
#include "scumm/actor.h"
@@ -476,7 +477,7 @@ int ScummEngine::readVar(uint var) {
}
if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
- return _noSubtitles;
+ return !ConfMan.getBool("subtitles");
}
checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
@@ -542,8 +543,10 @@ void ScummEngine::writeVar(uint var, int value) {
_scummVars[var] = value;
// stay in sync with loom cd subtitle var
- if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES && (value == 0 || value == 1))
- _noSubtitles = (value != 0);
+ if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
+ assert(value == 0 || value == 1);
+ ConfMan.set("subtitles", (value == 0));
+ }
if ((_varwatch == (int)var) || (_varwatch == 0)) {
if (vm.slot[_currentScript].number < 100)
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index bfa4f8687f..26057c800f 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -23,6 +23,8 @@
#include "stdafx.h"
+#include "common/config-manager.h"
+
#include "scumm/actor.h"
#include "scumm/charset.h"
#include "scumm/imuse.h"
@@ -2413,7 +2415,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
debug(1, "INSANE Arg: %d %d", args[1], args[2]);
- SmushPlayer *sp = new SmushPlayer(this, speed, !_noSubtitles);
+ SmushPlayer *sp = new SmushPlayer(this, speed);
// INSANE mode 0: SMUSH movie playback
if (args[1] == 0) {
@@ -2422,7 +2424,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
#ifdef INSANE
const int insaneVarNum = (_features & GF_DEMO) ? 232 : 233;
- _insane->setSmushParams(speed, !_noSubtitles);
+ _insane->setSmushParams(speed);
_insane->runScene(insaneVarNum);
#else
@@ -2559,10 +2561,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
_saveSound = args[1];
break;
case 215:
- if (args[1])
- _noSubtitles = false;
- else
- _noSubtitles = true;
+ ConfMan.set("subtitles", args[1] != 0);
break;
default:
error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 9d5822db0a..36cb2cfcc5 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -1244,7 +1244,7 @@ void ScummEngine_v8::o8_startVideo() {
debug(4, "o8_startVideo(%s/%s)", getGameDataPath(), (const char*)_scriptPointer);
- SmushPlayer *sp = new SmushPlayer(this, 83333, !_noSubtitles);
+ SmushPlayer *sp = new SmushPlayer(this, 83333);
sp->play((const char*)_scriptPointer, getGameDataPath());
delete sp;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 46ac7180c1..d14d07f48d 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -1013,8 +1013,6 @@ protected:
int _charsetBufPos;
byte _charsetBuffer[512];
-public:
- bool _noSubtitles; // Whether to skip all subtitles
protected:
void initCharset(int charset);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index dbdc75c899..c6de503849 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -471,7 +471,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
memset(_charsetBuffer, 0, sizeof(_charsetBuffer));
_copyProtection = false;
_demoMode = false;
- _noSubtitles = false;
_confirmExit = false;
_numInMsgStack = 0;
_msgPtrToAdd = NULL;
@@ -659,11 +658,10 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_copyProtection = ConfMan.getBool("copy_protection");
_demoMode = ConfMan.getBool("demo_mode");
- _noSubtitles = ConfMan.getBool("subtitles");
- _noSubtitles ^=1;
if (ConfMan.hasKey("nosubtitles")) {
warning("Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead");
- _noSubtitles = ConfMan.getBool("nosubtitles");
+ if (!ConfMan.hasKey("subtitles"))
+ ConfMan.set("subtitles", !ConfMan.getBool("nosubtitles"));
}
_confirmExit = ConfMan.getBool("confirm_exit");
_defaultTalkDelay = ConfMan.getInt("talkspeed");
diff --git a/scumm/smush/insane.cpp b/scumm/smush/insane.cpp
index 8486ef714c..7347c91a6c 100644
--- a/scumm/smush/insane.cpp
+++ b/scumm/smush/insane.cpp
@@ -24,6 +24,7 @@
#include "base/engine.h"
+#include "common/config-manager.h"
#include "common/file.h"
#include "scumm/scumm.h"
@@ -106,16 +107,14 @@ Insane::~Insane(void) {
delete _smush_icons2Nut;
}
-void Insane::setSmushParams(int speed, bool subtitles) {
+void Insane::setSmushParams(int speed) {
_speed = speed;
- _subtitles = subtitles;
}
void Insane::initvars(void) {
int i, j;
_speed = 12;
- _subtitles = true;
_insaneIsRunning = false;
_numberArray = 0;
@@ -1859,7 +1858,7 @@ void Insane::runScene(int arraynum) {
// ptrMainLoop = &ptrMainLoopBody;
_insaneIsRunning = true;
- _player = new SmushPlayer(_scumm, _speed, _subtitles);
+ _player = new SmushPlayer(_scumm, _speed);
_player->insanity(true);
_numberArray = arraynum;
@@ -3501,7 +3500,7 @@ void Insane::postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
if (tsceneProp->actor != -1) {
if (_actor[tsceneProp->actor].field_54) {
tsceneProp->counter++;
- if (!_actor[tsceneProp->actor].runningSound || !_scumm->_noSubtitles) {
+ if (!_actor[tsceneProp->actor].runningSound || ConfMan.getBool("subtitles")) {
if (_actor[tsceneProp->actor].act[3].state == 72 &&
_currTrsMsg) {
smush_setPaletteValue(1, tsceneProp->r, tsceneProp->g, tsceneProp->b);
diff --git a/scumm/smush/insane.h b/scumm/smush/insane.h
index 0c215d75f3..02aab9c779 100644
--- a/scumm/smush/insane.h
+++ b/scumm/smush/insane.h
@@ -58,7 +58,7 @@ class Insane {
Insane(ScummEngine *scumm);
~Insane();
- void setSmushParams(int speed, bool subtitles);
+ void setSmushParams(int speed);
void runScene(int arraynum);
void procPreRendering(void);
@@ -75,7 +75,6 @@ class Insane {
SmushPlayer *_player;
int32 _speed;
- bool _subtitles;
bool _insaneIsRunning;
int32 _numberArray;
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp
index 980668556a..45b6280df4 100644
--- a/scumm/smush/smush_player.cpp
+++ b/scumm/smush/smush_player.cpp
@@ -23,6 +23,7 @@
#include "base/engine.h"
+#include "common/config-manager.h"
#include "common/file.h"
#include "common/util.h"
#include "common/timer.h"
@@ -209,7 +210,7 @@ void SmushPlayer::timerCallback(void *refCon) {
((SmushPlayer *)refCon)->parseNextFrame();
}
-SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed, bool subtitles) {
+SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed) {
_scumm = scumm;
_version = -1;
_nbframes = 0;
@@ -224,7 +225,7 @@ SmushPlayer::SmushPlayer(ScummEngine *scumm, int speed, bool subtitles) {
_frameBuffer = NULL;
_skipNext = false;
- _subtitles = subtitles;
+ _subtitles = ConfMan.getBool("subtitles");
_dst = NULL;
_storeFrame = false;
_width = 0;
diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h
index 12a86a01a9..d45f5446ca 100644
--- a/scumm/smush/smush_player.h
+++ b/scumm/smush/smush_player.h
@@ -71,7 +71,7 @@ private:
bool _middleAudio;
public:
- SmushPlayer(ScummEngine *, int, bool);
+ SmushPlayer(ScummEngine *scumm, int speed);
~SmushPlayer();
void play(const char *filename, const char *directory);
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 13fa9cb31f..9b0abe5185 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -559,7 +559,8 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
_mouthSyncMode = true;
}
- startSfxSound(_sfxFile, size, handle, id);
+ if (!_soundsPaused && _scumm->_mixer->isReady())
+ startSfxSound(_sfxFile, size, handle, id);
}
void Sound::stopTalkSound() {
@@ -794,9 +795,6 @@ void Sound::pauseSounds(bool pause) {
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
- if (_soundsPaused || !_scumm->_mixer->isReady())
- return;
-
if (file_size > 0) {
if (_vorbis_mode) {
#ifdef USE_VORBIS
@@ -815,9 +813,7 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle,
byte *data = loadVOCFile(_sfxFile, size, rate);
if (_scumm->_imuseDigital) {
- _scumm->_imuseDigital->setVocVoice(data, size, rate);
- _scumm->_imuseDigital->startSound(kTalkSoundID);
- free(data);
+ _scumm->_imuseDigital->startSound(kTalkSoundID, data, size, rate);
} else {
_scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, id);
}
@@ -832,7 +828,8 @@ File *Sound::openSfxFile() {
* same directory */
offset_table = NULL;
- // for now until better streaming will be, ft voice can't not be compressed
+ // FIXME / TODO / HACK: for FT voice can only be loaded from original .sou
+ // files, not .so3 or .sog. This will be so until IMuseDigital gets fixed.
if (_scumm->_imuseDigital) {
sprintf(buf, "%s.sou", _scumm->getGameName());
if (!file->open(buf, _scumm->getGameDataPath())) {
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 24d709ec3f..d14a4474c9 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -21,6 +21,9 @@
*/
#include "stdafx.h"
+
+#include "common/config-manager.h"
+
#include "scumm/scumm.h"
#include "scumm/actor.h"
#include "scumm/charset.h"
@@ -316,9 +319,9 @@ void ScummEngine::CHARSET_1() {
if (_version <= 3) {
_charset->printChar(c);
} else {
- if ((_gameId == GID_LOOM256) && _noSubtitles && (_sound->pollCD())) {
+ if ((_gameId == GID_LOOM256) && !ConfMan.getBool("subtitles") && (_sound->pollCD())) {
// Special case for loomcd, since it only uses CD audio.for sound
- } else if (_noSubtitles && (_haveMsg == 0xFE || _sound->_talkChannelHandle.isActive())) {
+ } else if (!ConfMan.getBool("subtitles") && (_haveMsg == 0xFE || _sound->_talkChannelHandle.isActive())) {
// Subtitles are turned off, and there is a voice version
// of this message -> don't print it.
} else