aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-15 19:53:12 -0400
committerPaul Gilbert2014-05-15 19:53:12 -0400
commit84b38d8b390745da15bb0b9526209b60492df723 (patch)
tree500ccfee9570abdf6764b64f524a0f6bf680d881
parent690efa51f53c74e3f3cfc402829a2714024a141e (diff)
downloadscummvm-rg350-84b38d8b390745da15bb0b9526209b60492df723.tar.gz
scummvm-rg350-84b38d8b390745da15bb0b9526209b60492df723.tar.bz2
scummvm-rg350-84b38d8b390745da15bb0b9526209b60492df723.zip
MADS: Fix incorrect array indexes referencing outputIndexes
-rw-r--r--engines/mads/nebular/sound_nebular.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp
index 8b1a02e0b6..a2a66a32ee 100644
--- a/engines/mads/nebular/sound_nebular.cpp
+++ b/engines/mads/nebular/sound_nebular.cpp
@@ -686,7 +686,7 @@ void ASound::updateChannelState() {
}
static const int outputIndexes[] = {
- 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17
+ 0, 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17
};
static const int outputChannels[] = {
0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0
@@ -704,7 +704,7 @@ static const int volumeList[] = {
};
void ASound::updateActiveChannel() {
- int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]];
+ int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2 + 1]];
int portVal = _ports[reg] & 0xFFC0;
int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63);
@@ -725,7 +725,7 @@ void ASound::loadSample(int sampleIndex) {
_activeChannelReg = _activeChannelNumber;
_samplePtr = &_samples[sampleIndex * 2];
- _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]];
+ _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]];
processSample();
AdlibChannelData &cd = _channelData[_activeChannelNumber];
@@ -735,7 +735,7 @@ void ASound::loadSample(int sampleIndex) {
cd._field0 = _samplePtr->_fieldE;
_samplePtr = &_samples[sampleIndex * 2 + 1];
- _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]];
+ _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 + 1]];
processSample();
}