aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorJamieson Christian2003-08-15 07:10:30 +0000
committerJamieson Christian2003-08-15 07:10:30 +0000
commitc0730f6cb9d4485d0546a5e6fd909c485f4312fc (patch)
tree4e3c8d9ccc25149e8ff6117f6c0c3e0e17937b2c /scumm
parent3ddb50711e906b16406d18c9e0abde289abc12bf (diff)
downloadscummvm-rg350-c0730f6cb9d4485d0546a5e6fd909c485f4312fc.tar.gz
scummvm-rg350-c0730f6cb9d4485d0546a5e6fd909c485f4312fc.tar.bz2
scummvm-rg350-c0730f6cb9d4485d0546a5e6fd909c485f4312fc.zip
Fix for Bug [788531] Indy3VGA - Access violation with PC Speaker "travel" music
Checked for OOB channel clear command. The "travel" music in question seems to try to clear channel 4 when there are only channels 0-3. Now we check and bail if OOB. Perhaps this isn't quite the correct thing to do. Would channel 4 be significant, as in perhaps "clear ALL channels"? Hoenicke should answer this one. svn-id: r9700
Diffstat (limited to 'scumm')
-rw-r--r--scumm/player_v2.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp
index 9c344c3dd4..0720477ab5 100644
--- a/scumm/player_v2.cpp
+++ b/scumm/player_v2.cpp
@@ -589,10 +589,15 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
break;
case 0xfd: // clear other channel
- value = READ_LE_UINT16 (script_ptr);
- debug(9, "clear channel %d", value/50);
+ value = READ_LE_UINT16 (script_ptr) / sizeof (ChannelInfo);
+ debug(9, "clear channel %d", value);
script_ptr += 2;
- channel = &_channels[value / sizeof(ChannelInfo)];
+ // In Indy3, when traveling to Venice a command is
+ // issued to clear channel 4, which is OOB. So, we
+ // check first.
+ if (value >= ARRAYSIZE (_channels))
+ break;
+ channel = &_channels[value];
// fall through
case 0xfa: // clear current channel