aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/resource.cpp13
-rw-r--r--scumm/script_v5.cpp5
-rw-r--r--scumm/scummvm.cpp4
-rw-r--r--scumm/sound.cpp40
-rw-r--r--scumm/sound.h5
5 files changed, 26 insertions, 41 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index ea62be8b22..a36c557e20 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -217,7 +217,7 @@ bool ScummEngine::openResourceFile(const char *filename, byte encByte) {
_fileHandle.close();
}
- _fileHandle.open(filename, getGameDataPath(), 1, encByte);
+ _fileHandle.open(filename, getGameDataPath(), File::kFileReadMode, encByte);
return _fileHandle.isOpen();
}
@@ -2213,13 +2213,10 @@ void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int le
sprintf(buf, "dumps/%s%d.dmp", tag, idx);
#endif
- out.open(buf, "", 1);
- if (out.isOpen() == false) {
- out.open(buf, "", 2);
- if (out.isOpen() == false)
- return;
- out.write(ptr, size);
- }
+ out.open(buf, "", File::kFileWriteMode);
+ if (out.isOpen() == false)
+ return;
+ out.write(ptr, size);
out.close();
}
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 81e0b00b77..13036bb657 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -2258,7 +2258,6 @@ void ScummEngine_v5::o5_isSoundRunning() {
void ScummEngine_v5::o5_soundKludge() {
int items[16];
- int i;
if (_features & GF_SMALL_HEADER) { // Is WaitForSentence in SCUMM V3
if (_sentenceNum) {
@@ -2272,11 +2271,7 @@ void ScummEngine_v5::o5_soundKludge() {
return;
}
- for (i = 0; i < 16; i++)
- items[i] = 0;
-
int num = getWordVararg(items);
-
_sound->soundKludge(items, num);
}
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index de24813638..9553ce3028 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -778,7 +778,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
}
break;
}
- if (fontFile && fp.open(fontFile, getGameDataPath(), 1)) {
+ if (fontFile && fp.open(fontFile, getGameDataPath())) {
debug(2, "Loading CJK Font");
_CJKMode = true;
fp.seek(2, SEEK_CUR);
@@ -807,7 +807,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_2byteWidth = 16;
_2byteHeight = 16;
//use FM Towns font rom, since game files don't have kanji font resources
- if (fp.open("fmt_fnt.rom", getGameDataPath(), 1) || fp.open("fmt_fnt.rom", "./", 1)) {
+ if (fp.open("fmt_fnt.rom", getGameDataPath()) || fp.open("fmt_fnt.rom", "./")) {
_CJKMode = true;
debug(2, "Loading FM Towns Kanji rom");
_2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 91cfdcc613..f4f06f71b4 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -632,12 +632,12 @@ int Sound::isSoundRunning(int sound) const {
*/
bool Sound::isSoundInUse(int sound) const {
- if (sound == _currentCDSound)
- return pollCD() != 0;
-
if (_scumm->_imuseDigital)
return (_scumm->_imuseDigital->getSoundStatus(sound) != 0);
+ if (sound == _currentCDSound)
+ return pollCD() != 0;
+
if (isSoundInQueue(sound))
return true;
@@ -651,30 +651,25 @@ bool Sound::isSoundInUse(int sound) const {
}
bool Sound::isSoundInQueue(int sound) const {
- int i, j, num;
- int16 table[16];
+ int i, num;
i = _soundQue2Pos;
while (i--) {
if (_soundQue2[i] == sound)
- return 1;
+ return true;
}
i = 0;
while (i < _soundQuePos) {
num = _soundQue[i++];
- memset(table, 0, sizeof(table));
-
if (num > 0) {
- for (j = 0; j < num; j++)
- table[j] = _soundQue[i + j];
+ if (_soundQue[i + 0] == 0x10F && _soundQue[i + 1] == 8 && _soundQue[i + 2] == sound)
+ return true;
i += num;
- if (table[0] == 0x10F && table[1] == 8 && table[2] == sound)
- return 1;
}
}
- return 0;
+ return false;
}
void Sound::stopSound(int a) {
@@ -692,7 +687,7 @@ void Sound::stopSound(int a) {
if (_scumm->_musicEngine)
_scumm->_musicEngine->stopSound(a);
- for (i = 0; i < 10; i++)
+ for (i = 0; i < ARRAYSIZE(_soundQue2); i++)
if (_soundQue2[i] == a)
_soundQue2[i] = 0;
}
@@ -734,13 +729,12 @@ void Sound::soundKludge(int *list, int num) {
if (list[0] == -1) {
processSoundQues();
- return;
- }
-
- _soundQue[_soundQuePos++] = num;
-
- for (i = 0; i < num; i++) {
- _soundQue[_soundQuePos++] = list[i];
+ } else {
+ _soundQue[_soundQuePos++] = num;
+
+ for (i = 0; i < num; i++) {
+ _soundQue[_soundQuePos++] = list[i];
+ }
}
}
@@ -771,8 +765,6 @@ void Sound::setupSound() {
_scumm->_imuse->setMasterVolume(ConfMan.getInt("master_volume"));
_scumm->_imuse->set_music_volume(ConfMan.getInt("music_volume"));
}
- _scumm->_mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255);
- _scumm->_mixer->setMusicVolume(ConfMan.getInt("music_volume"));
delete _sfxFile;
_sfxFile = openSfxFile();
}
@@ -937,7 +929,7 @@ File *Sound::openSfxFile() {
if (!file->isOpen()) {
sprintf(buf, "%s.tlk", _scumm->getGameName());
- file->open(buf, _scumm->getGameDataPath(), 1, 0x69);
+ file->open(buf, _scumm->getGameDataPath(), File::kFileReadMode, 0x69);
}
return file;
}
diff --git a/scumm/sound.h b/scumm/sound.h
index d41fc44a81..f23eeccf9d 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -66,13 +66,11 @@ public:
void addSoundToQueue2(int sound);
void processSoundQues();
void playSound(int sound);
- void processSfxQueues();
void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
void stopTalkSound();
bool isMouthSyncOff(uint pos);
int isSoundRunning(int sound) const;
bool isSoundInUse(int sound) const;
- bool isSoundInQueue(int sound) const;
void stopSound(int a);
void stopAllSounds();
void soundKludge(int *list, int num);
@@ -93,6 +91,9 @@ protected:
File *openSfxFile();
void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id = -1);
bool isSfxFinished() const;
+ void processSfxQueues();
+
+ bool isSoundInQueue(int sound) const;
};
} // End of namespace Scumm