[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.253,2.254 script_v6.cpp,1.397,1.398 script_v6he.cpp,2.117,2.118 script_v72he.cpp,2.97,2.98 script_v80he.cpp,2.24,2.25
Travis Howell
kirben at users.sourceforge.net
Thu Sep 16 05:32:56 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16732/scumm
Modified Files:
intern.h script_v6.cpp script_v6he.cpp script_v72he.cpp
script_v80he.cpp
Log Message:
Correction to pickVarRandom
Add HE80+ version too.
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.253
retrieving revision 2.254
diff -u -d -r2.253 -r2.254
--- intern.h 15 Sep 2004 06:41:11 -0000 2.253
+++ intern.h 16 Sep 2004 12:30:52 -0000 2.254
@@ -563,6 +563,7 @@
virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i);
+ void localizeArray(int slot, int script);
void redimArray(int arrayId, int newX, int newY, int d);
int readFileToArray(int slot, int32 size);
void writeFileFromArray(int slot, int resID);
@@ -801,6 +802,7 @@
void o80_cursorCommand();
void o80_setState();
void o80_drawWizPolygon();
+ void o80_pickVarRandom();
};
class ScummEngine_v90he : public ScummEngine_v80he {
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.397
retrieving revision 1.398
diff -u -d -r1.397 -r1.398
--- script_v6.cpp 8 Sep 2004 12:14:55 -0000 1.397
+++ script_v6.cpp 16 Sep 2004 12:30:53 -0000 1.398
@@ -3019,7 +3019,7 @@
num = readArray(value, 0, 0);
byte *ptr = getResourceAddress(rtString, readVar(value));
- if (_version >= 7 || _heversion >= 72) {
+ if (_version >= 7) {
var_A = READ_LE_UINT32(ptr + 4);
var_C = READ_LE_UINT32(ptr + 8);
} else {
@@ -3028,7 +3028,7 @@
}
if (var_A-1 <= num) {
- int16 var_2 = readArray(value, 0, num - 1);
+ int16 var_2 = readArray(value, 0, var_A - 1);
shuffleArray(value, 1, num - 1);
if (readArray(value, 0, 1) == var_2) {
num = 2;
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.117
retrieving revision 2.118
diff -u -d -r2.117 -r2.118
--- script_v6he.cpp 15 Sep 2004 12:40:49 -0000 2.117
+++ script_v6he.cpp 16 Sep 2004 12:30:53 -0000 2.118
@@ -1153,15 +1153,18 @@
}
}
-void ScummEngine_v6he::o6_localizeArray() {
- int slot = pop();
-
+void ScummEngine_v6he::localizeArray(int slot, int script) {
if (slot >= _numArray)
error("o6_localizeArray(%d): array slot out of range", slot);
_arraySlot[slot] = vm.slot[_currentScript].number;
}
+void ScummEngine_v6he::o6_localizeArray() {
+ int slot = pop();
+ localizeArray(slot, vm.slot[_currentScript].number);
+}
+
void ScummEngine_v6he::o6_seekFilePos() {
int mode, offset, slot;
mode = pop();
Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.97
retrieving revision 2.98
diff -u -d -r2.97 -r2.98
--- script_v72he.cpp 15 Sep 2004 12:40:49 -0000 2.97
+++ script_v72he.cpp 16 Sep 2004 12:30:54 -0000 2.98
@@ -1693,7 +1693,7 @@
void ScummEngine_v72he::o72_pickVarRandom() {
int num;
int args[100];
- int32 var_A;
+ int32 dim1end;
num = getStackList(args, ARRAYSIZE(args));
int value = fetchScriptWord();
@@ -1716,11 +1716,11 @@
num = readArray(value, 0, 0);
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(value));
- var_A = FROM_LE_32(ah->dim1end);
+ dim1end = FROM_LE_32(ah->dim1end);
- if (var_A-1 <= num) {
+ if (dim1end <= num) {
int16 var_2 = readArray(value, 0, num - 1);
- shuffleArray(value, 1, num - 1);
+ shuffleArray(value, 1, dim1end);
if (readArray(value, 0, 1) == var_2) {
num = 2;
} else {
Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -d -r2.24 -r2.25
--- script_v80he.cpp 15 Sep 2004 12:40:49 -0000 2.24
+++ script_v80he.cpp 16 Sep 2004 12:30:54 -0000 2.25
@@ -328,7 +328,7 @@
OPCODE(o6_soundOps),
OPCODE(o72_getPixel),
OPCODE(o6_localizeArray),
- OPCODE(o72_pickVarRandom),
+ OPCODE(o80_pickVarRandom),
/* E4 */
OPCODE(o6_setBoxSet),
OPCODE(o6_invalid),
@@ -424,11 +424,7 @@
void ScummEngine_v80he::o80_unknown4A() {
int slot = pop();
-
- if (slot >= _numArray)
- error("o80_unknown4A(%d): array slot out of range", slot);
-
- _arraySlot[slot] = 0xFFFFFFFF;
+ localizeArray(slot, 0xFFFFFFFF);
}
void ScummEngine_v80he::o80_readConfigFile() {
@@ -607,4 +603,53 @@
}
}
+
+
+void ScummEngine_v80he::o80_pickVarRandom() {
+ int num;
+ int args[100];
+ int32 dim1end;
+
+ num = getStackList(args, ARRAYSIZE(args));
+ int value = fetchScriptWord();
+
+ if (readVar(value) == 0) {
+ defineArray(value, kDwordArray, 0, 0, 0, num + 1);
+ if (value & 0x8000)
+ localizeArray(readVar(value), 0xFFFFFFFF);
+ else if (value & 0x4000)
+ localizeArray(readVar(value), vm.slot[_currentScript].number);
+
+ if (num > 0) {
+ int16 counter = 0;
+ do {
+ writeArray(value, 0, counter + 1, args[counter]);
+ } while (++counter < num);
+ }
+
+ shuffleArray(value, 1, num-1);
+ writeArray(value, 0, 0, 2);
+ push(readArray(value, 0, 1));
+ return;
+ }
+
+ num = readArray(value, 0, 0);
+
+ ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(value));
+ dim1end = FROM_LE_32(ah->dim1end);
+
+ 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);
+ writeArray(value, 0, num, tmp);
+ writeArray(value, 0, 2, var_2);
+ }
+ }
+
+ writeArray(value, 0, 0, num + 1);
+ push(readArray(value, 0, num));
+}
+
} // End of namespace Scumm
More information about the Scummvm-git-logs
mailing list