[Scummvm-git-logs] scummvm master -> 1b4d3ea3ed7b91e43a59957a8ffc879c7dd3e60d
athrxx
noreply at scummvm.org
Thu Sep 8 20:42:28 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:
1b4d3ea3ed SCUMM: (IMS) - cleanup
Commit: 1b4d3ea3ed7b91e43a59957a8ffc879c7dd3e60d
https://github.com/scummvm/scummvm/commit/1b4d3ea3ed7b91e43a59957a8ffc879c7dd3e60d
Author: athrxx (athrxx at scummvm.org)
Date: 2022-09-08T22:42:04+02:00
Commit Message:
SCUMM: (IMS) - cleanup
(also fix Amiga regression)
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 dae413e4906..efae39612a8 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -513,7 +513,6 @@ 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 2f0135785b1..d8d2f2c64eb 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -362,7 +362,7 @@ struct Part : public Common::Serializable {
void set_instrument(byte *data);
void load_global_instrument(byte b);
- void set_transpose(int8 transpose);
+ void set_transpose(int8 transpose, int8 clipRangeLow, int8 clipRangeHi);
void set_detune(int8 detune);
void set_pri(int8 pri);
void set_pan(int8 pan);
@@ -415,7 +415,6 @@ 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 1bdc0c474e8..fda371a0aa1 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -146,14 +146,15 @@ void Part::set_pan(int8 pan) {
sendPanPosition(_pan_eff + 0x40);
}
-void Part::set_transpose(int8 transpose) {
+void Part::set_transpose(int8 transpose, int8 clipRangeLow, int8 clipRangeHi) {
+ if (_se->_game_id == GID_TENTACLE && (transpose > 24 || transpose < -24))
+ return;
+
_transpose = transpose;
- // 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
+ // The Amiga versions have a signed/unsigned bug which makes the check for _transpose == -128 impossible. They actually check 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);
+ _transpose_eff = (!_se->_isAmiga && _transpose == -128) ? 0 : transpose_clamp(_transpose + _player->getTranspose(), clipRangeLow, clipRangeHi);
if (_player->isAdLibOrFMTowns() || _se->_isAmiga)
sendTranspose();
else
@@ -184,7 +185,8 @@ void Part::effectLevel(byte value) {
}
void Part::fix_after_load() {
- set_transpose(_transpose);
+ int lim = (_se->_game_id == GID_TENTACLE || _se->_isAmiga) ? 12 : 24;
+ set_transpose(_transpose, -lim, lim);
volume(_vol);
set_detune(_detune);
set_pri(_pri);
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 067f8f5a1e7..4b99e6a4b02 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -577,9 +577,10 @@ int Player::setTranspose(byte relative, int b) {
_transpose = b;
- for (part = _parts; part; part = part->_next) {
- part->set_transpose(part->_transpose);
- }
+ // MI2 and INDY4 use bounds of -24/24, DOTT uses -12/12.
+ int lim = (_se->_game_id == GID_TENTACLE) ? 12 : 24;
+ for (part = _parts; part; part = part->_next)
+ part->set_transpose(part->_transpose, -lim, lim);
return 0;
}
@@ -595,7 +596,10 @@ void Player::part_set_transpose(uint8 chan, byte relative, int8 b) {
return;
if (relative)
b = transpose_clamp(b + part->_transpose, -7, 7);
- part->set_transpose(b);
+
+ // MI2 and INDY4 use bounds of -24/24, DOTT uses -12/12.
+ int lim = (_se->_game_id == GID_TENTACLE) ? 12 : 24;
+ part->set_transpose(b, -lim, lim);
}
bool Player::jump(uint track, uint beat, uint tick) {
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index bfc72a8ee34..b126e87585a 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -72,9 +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;
- // 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);
+ // The original intepreter uses a different clipping range for MI2 and INDY4 here,
+ // instead of the usual -24/24. DOTT always uses -12/12.
+ part->set_transpose(buf[5], -12, 12);
part->set_detune(buf[6]);
part->pitchBendFactor(buf[7]);
if (part->_percussion) {
More information about the Scummvm-git-logs
mailing list