aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cruise/sound.cpp')
-rw-r--r--engines/cruise/sound.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 86146e3189..cc9a17eb9a 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -342,9 +342,7 @@ void AdLibSoundDriver::adjustVolume(int channel, int volume) {
volume = 0;
}
volume += volume / 4;
- if (volume > 127) {
- volume = 127;
- }
+ // The higher possible value for volume is 100
int volAdjust = (channel == 4) ? _sfxVolume : _musicVolume;
volume = (volume * volAdjust) / 128;
@@ -379,13 +377,12 @@ void AdLibSoundDriver::stopChannel(int channel) {
}
void AdLibSoundDriver::stopAll() {
- int i;
- for (i = 0; i < 18; ++i) {
+ for (int i = 0; i < 18; ++i)
OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 63);
- }
- for (i = 0; i < 9; ++i) {
+
+ for (int i = 0; i < 9; ++i)
OPLWriteReg(_opl, 0xB0 | i, 0);
- }
+
OPLWriteReg(_opl, 0xBD, 0);
}
@@ -630,7 +627,7 @@ bool PCSoundFxPlayer::load(const char *song) {
stop();
}
- strcpy(_musicName, song);
+ Common::strlcpy(_musicName, song, sizeof(_musicName));
_songPlayed = false;
_looping = false;
_sfxData = readBundleSoundFile(song);
@@ -652,7 +649,7 @@ bool PCSoundFxPlayer::load(const char *song) {
if (dot) {
*dot = '\0';
}
- strcat(instrument, _driver->getInstrumentExtension());
+ Common::strlcat(instrument, _driver->getInstrumentExtension(), sizeof(instrument));
_instrumentsData[i] = readBundleSoundFile(instrument);
if (!_instrumentsData[i]) {
warning("Unable to load soundfx instrument '%s'", instrument);