aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2004-09-16 23:34:26 +0000
committerTravis Howell2004-09-16 23:34:26 +0000
commit2ac60430fcea9c751552ae6e7d09076d2233c8b2 (patch)
tree74241401d5b63a55d28fa7e32c8a417dd4e356f0 /scumm
parentcf717603916aae5c420055dde35f74660803c95e (diff)
downloadscummvm-rg350-2ac60430fcea9c751552ae6e7d09076d2233c8b2.tar.gz
scummvm-rg350-2ac60430fcea9c751552ae6e7d09076d2233c8b2.tar.bz2
scummvm-rg350-2ac60430fcea9c751552ae6e7d09076d2233c8b2.zip
A few more corrections, fixes freddi2 crash.
svn-id: r15142
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v6.cpp2
-rw-r--r--scumm/script_v72he.cpp2
-rw-r--r--scumm/script_v80he.cpp5
-rw-r--r--scumm/script_v90he.cpp2
4 files changed, 6 insertions, 5 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index af5c4457a4..60172ec1f4 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -3021,7 +3021,7 @@ void ScummEngine_v6::o6_pickVarRandom() {
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(value));
dim1 = FROM_LE_16(ah->dim1) - 1;
- if (dim1 <= num) {
+ if (dim1 < num) {
int16 var_2 = readArray(value, 0, num - 1);
shuffleArray(value, 1, dim1);
if (readArray(value, 0, 1) == var_2) {
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index fc396fc58e..b391f7760a 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -1718,7 +1718,7 @@ void ScummEngine_v72he::o72_pickVarRandom() {
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(value));
dim1end = FROM_LE_32(ah->dim1end);
- if (dim1end <= num) {
+ if (dim1end < num) {
int16 var_2 = readArray(value, 0, num - 1);
shuffleArray(value, 1, dim1end);
if (readArray(value, 0, 1) == var_2) {
diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp
index 3a2abee5e6..345ab72c51 100644
--- a/scumm/script_v80he.cpp
+++ b/scumm/script_v80he.cpp
@@ -641,8 +641,9 @@ void ScummEngine_v80he::o80_pickVarRandom() {
if (dim1end < num) {
int16 var_2 = readArray(value, 0, num - 1);
shuffleArray(value, 1, dim1end);
- if (readArray(value, 0, 1) == var_2 && var_2 >= 3) {
- int tmp = readArray(value, 0, 2);
+ num = 1;
+ if (readArray(value, 0, 1) == var_2 && dim1end >= 3) {
+ int16 tmp = readArray(value, 0, 2);
writeArray(value, 0, num, tmp);
writeArray(value, 0, 2, var_2);
}
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index 170192bb31..7fa8e30b15 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -328,7 +328,7 @@ void ScummEngine_v90he::setupOpcodes() {
OPCODE(o6_soundOps),
OPCODE(o72_getPixel),
OPCODE(o6_localizeArray),
- OPCODE(o72_pickVarRandom),
+ OPCODE(o80_pickVarRandom),
/* E4 */
OPCODE(o6_setBoxSet),
OPCODE(o6_invalid),