aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-06-14 23:39:33 +0200
committerSven Hesse2012-06-14 23:40:18 +0200
commit3b8b3c4caffc8a19a7ad4c4fa55bad712f0e5fce (patch)
tree50daa05b07c4efe95e5a276a2309cf0638345fa7
parentacaf8f762382f1aa886d4a3f5b0b8b662863f01c (diff)
downloadscummvm-rg350-3b8b3c4caffc8a19a7ad4c4fa55bad712f0e5fce.tar.gz
scummvm-rg350-3b8b3c4caffc8a19a7ad4c4fa55bad712f0e5fce.tar.bz2
scummvm-rg350-3b8b3c4caffc8a19a7ad4c4fa55bad712f0e5fce.zip
GOB: Fix a failed assert in Litte Red Riding Hood
-rw-r--r--engines/gob/inter_v1.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 6fc472a0ac..3652637e32 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -1584,14 +1584,13 @@ void Inter_v1::o1_waitEndPlay(OpFuncParams &params) {
}
void Inter_v1::o1_playComposition(OpFuncParams &params) {
- int16 composition[50];
- int16 dataVar;
- int16 freqVal;
+ int16 dataVar = _vm->_game->_script->readVarIndex();
+ int16 freqVal = _vm->_game->_script->readValExpr();
- dataVar = _vm->_game->_script->readVarIndex();
- freqVal = _vm->_game->_script->readValExpr();
+ int16 composition[50];
+ int maxEntries = MIN<int>(50, (_variables->getSize() - dataVar) / 4);
for (int i = 0; i < 50; i++)
- composition[i] = (int16) VAR_OFFSET(dataVar + i * 4);
+ composition[i] = (i < maxEntries) ? ((int16) VAR_OFFSET(dataVar + i * 4)) : -1;
_vm->_sound->blasterPlayComposition(composition, freqVal);
}