[Scummvm-git-logs] scummvm master -> 0b8d7cf0f45cf8193fc1f53c65359d84693d3616
athrxx
noreply at scummvm.org
Thu Sep 8 18:49:59 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0b8d7cf0f4 SCUMM: (IMS) - fix transpose clipping boundaries
Commit: 0b8d7cf0f45cf8193fc1f53c65359d84693d3616
https://github.com/scummvm/scummvm/commit/0b8d7cf0f45cf8193fc1f53c65359d84693d3616
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-08T20:49:42+02:00
Commit Message:
SCUMM: (IMS) - fix transpose clipping boundaries
These are a bit different between DOTT and the earlier
games.
Changed paths:
engines/scumm/imuse/imuse.cpp
engines/scumm/imuse/imuse_internal.h
engines/scumm/imuse/imuse_part.cpp
engines/scumm/imuse/imuse_player.cpp
engines/scumm/imuse/sysex_scumm.cpp
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index efae39612a8..dae413e4906 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -513,6 +513,7 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
case IMuse::PROP_GAME_ID:
_game_id = value;
+ _version = (_game_id == GID_SAMNMAX) ? 2 : (_game_id == GID_TENTACLE ? 1 : 0);
break;
case IMuse::PROP_PC_SPEAKER:
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index 462e5a5f30d..2f0135785b1 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -415,6 +415,7 @@ protected:
TimerCallbackInfo _timer_info_native;
uint32 _game_id;
+ int _version; // V0: MI2 + INDY4, V1: DOTT, V2: SAM
// Plug-in SysEx handling. Right now this only supports one
// custom SysEx handler for the hardcoded IMUSE_SYSEX_ID
diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index 04a8ec89b74..1bdc0c474e8 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -148,20 +148,16 @@ void Part::set_pan(int8 pan) {
void Part::set_transpose(int8 transpose) {
_transpose = transpose;
-
- if (_se->_isAmiga) {
- // The Amiga version does a check like this. While this is probably a bug (a signed int8 can never be 128),
- // the playback depends on this being implemented exactly like in the original driver. I found this bug with
- // the WinUAE debugger. I don't know whether this is an Amiga only thing...
- _transpose_eff = /*(_transpose == 128) ? 0 : */transpose_clamp(_transpose + _player->getTranspose(), -12, 12);
+ // MI2 and INDY4 use bounds of -24/24, DOTT uses -12/12. SAMNMAX doesn't seem to do this clipping any more.
+ int lim = (_se->_version == 1) ? 12 : 24;
+ // The Amiga version has a signed/unsigned bug which makes the check for _transpose == -128 impossible. It actually checks for
+ // a value of 128 with a signed int8 (a signed int8 can never be 128). The playback depends on this being implemented exactly
+ // like in the original driver. I found this bug with the WinUAE debugger. The DOS versions do not have that bug.
+ _transpose_eff = (_se->_version == 0 && !_se->_isAmiga && _transpose == -128) ? 0 : transpose_clamp(_transpose + _player->getTranspose(), -lim, lim);
+ if (_player->isAdLibOrFMTowns() || _se->_isAmiga)
sendTranspose();
- } else {
- _transpose_eff = (_transpose == -128) ? 0 : transpose_clamp(_transpose + _player->getTranspose(), -24, 24);
- if (_player->isAdLibOrFMTowns())
- sendTranspose();
- else
- sendPitchBend();
- }
+ else
+ sendPitchBend();
}
void Part::sustain(bool value) {
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index cdd1633a96b..067f8f5a1e7 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -573,7 +573,7 @@ int Player::setTranspose(byte relative, int b) {
if (b > 24 || b < -24 || relative > 1)
return -1;
if (relative)
- b = transpose_clamp(_transpose + b, -24, 24);
+ b = transpose_clamp(_transpose + b, -7, 7);
_transpose = b;
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index b94bddda058..bfc72a8ee34 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -72,7 +72,9 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
part->volume(buf[3]);
part->set_pan(buf[4]);
part->_percussion = player->_supportsPercussion ? ((buf[5] & 0x80) > 0) : false;
- part->set_transpose(buf[5]);
+ // Basically the same thing that happens inside Part::set_transpose() (including the Amiga signed/unsigned bug),
+ // but with a different clipping range for MI2 and INDY4. For DOTT it its the exact same thing.
+ part->set_transpose((buf[5] != 0x80 || se->_isAmiga) ? transpose_clamp((int8)buf[5] + player->getTranspose(), -12, 12) : -128);
part->set_detune(buf[6]);
part->pitchBendFactor(buf[7]);
if (part->_percussion) {
More information about the Scummvm-git-logs
mailing list