aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-03-25 10:11:38 +0000
committerTorbjörn Andersson2006-03-25 10:11:38 +0000
commit737c52590b3ae1d19a1fc193f143e58dea670886 (patch)
tree6fc0ffbd9dae7af9ba0dde732bf679050ba1ce4f /engines
parent2c279848d8df0e060e3cf3ebadf3d679d9398a66 (diff)
downloadscummvm-rg350-737c52590b3ae1d19a1fc193f143e58dea670886.tar.gz
scummvm-rg350-737c52590b3ae1d19a1fc193f143e58dea670886.tar.bz2
scummvm-rg350-737c52590b3ae1d19a1fc193f143e58dea670886.zip
I believe that the purpose of updateCallback45() is to add a signed value to a
channel's unsigned tempo. Rewrote the function to make this clearer, and renamed it update_changeChannelTempo(). svn-id: r21448
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/sound_adlib.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index b6736f2069..4fb0c626b6 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -275,7 +275,7 @@ private:
int update_resetToGlobalTempo(uint8 *&dataptr, Channel &channel, uint8 value);
int update_nop1(uint8 *&dataptr, Channel &channel, uint8 value);
int update_setDurationRandomness(uint8 *&dataptr, Channel &channel, uint8 value);
- int updateCallback45(uint8 *&dataptr, Channel &channel, uint8 value);
+ int update_changeChannelTempo(uint8 *&dataptr, Channel &channel, uint8 value);
int updateCallback46(uint8 *&dataptr, Channel &channel, uint8 value);
int update_nop2(uint8 *&dataptr, Channel &channel, uint8 value);
int update_setupRhythmSection(uint8 *&dataptr, Channel &channel, uint8 value);
@@ -1560,18 +1560,15 @@ int AdlibDriver::update_setDurationRandomness(uint8 *&dataptr, Channel &channel,
return 0;
}
-int AdlibDriver::updateCallback45(uint8 *&dataptr, Channel &channel, uint8 value) {
- if (value & 0x80) {
- value += channel.tempo;
- if (value >= channel.tempo)
- value = 1;
- } else {
- uint8 temp = value;
- value += channel.tempo;
- if (value < temp)
- value = 0xFF;
- }
- channel.tempo = value;
+int AdlibDriver::update_changeChannelTempo(uint8 *&dataptr, Channel &channel, uint8 value) {
+ int tempo = channel.tempo + (int8)value;
+
+ if (tempo <= 0)
+ tempo = 1;
+ else if (tempo > 255)
+ tempo = 255;
+
+ channel.tempo = tempo;
return 0;
}
@@ -1922,7 +1919,7 @@ const AdlibDriver::ParserOpcode AdlibDriver::_parserOpcodeTable[] = {
// 60
COMMAND(update_setDurationRandomness),
- COMMAND(updateCallback45),
+ COMMAND(update_changeChannelTempo),
COMMAND(update_stopChannel),
COMMAND(updateCallback46),