aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2004-08-23 08:41:23 +0000
committerTravis Howell2004-08-23 08:41:23 +0000
commitbbfe489e9f4529169d3787b4598003c638d76067 (patch)
tree37ee805be5a3584b890a9038411ef06d3a6dfe0b
parent28c32a9fb702014393490365f84d2d97f9822cc7 (diff)
downloadscummvm-rg350-bbfe489e9f4529169d3787b4598003c638d76067.tar.gz
scummvm-rg350-bbfe489e9f4529169d3787b4598003c638d76067.tar.bz2
scummvm-rg350-bbfe489e9f4529169d3787b4598003c638d76067.zip
More changes for He 7.2 games
Might need HE7.2 class eventually svn-id: r14704
-rw-r--r--scumm/intern.h3
-rw-r--r--scumm/resource.cpp3
-rw-r--r--scumm/script_v7he.cpp103
3 files changed, 106 insertions, 3 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index e669673597..519f5e2e81 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -634,6 +634,9 @@ protected:
void o7_quitPauseRestart();
void o7_getActorRoom();
void o7_pickupObject();
+ void o7_arrayOps();
+ void o7_dimArray();
+ void o7_startScript();
void o7_startSound();
void o7_cursorCommand();
};
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 99be45a34e..d9426f14ed 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -2324,6 +2324,9 @@ void ScummEngine::readMAXS(int blockSize) {
_numGlobalObjects = _fileHandle.readUint16LE();
_fileHandle.readUint16LE();
+ // FIXME: Where is this set???
+ _numVerbs = 200;
+
_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);
// FIXME: Is this correct??? A V6+ game which doesn't use object name
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp
index f2aea2fa27..cba47e9a56 100644
--- a/scumm/script_v7he.cpp
+++ b/scumm/script_v7he.cpp
@@ -169,7 +169,7 @@ void ScummEngine_v7he::setupOpcodes() {
/* 5C */
OPCODE(o6_if),
OPCODE(o6_ifNot),
- OPCODE(o6_startScript),
+ OPCODE(o7_startScript),
OPCODE(o6_startScriptQuick),
/* 60 */
OPCODE(o6_startObject),
@@ -257,7 +257,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_getActorElevation),
OPCODE(o6_getVerbEntrypoint),
/* A4 */
- OPCODE(o6_arrayOps),
+ OPCODE(o7_arrayOps),
OPCODE(o6_saveRestoreVerbs),
OPCODE(o6_drawBox),
OPCODE(o6_pop),
@@ -287,7 +287,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_talkActor),
OPCODE(o6_talkEgo),
/* BC */
- OPCODE(o6_dimArray),
+ OPCODE(o7_dimArray),
OPCODE(o6_dummy),
OPCODE(o6_startObjectQuick),
OPCODE(o6_startScriptQuick2),
@@ -670,6 +670,103 @@ void ScummEngine_v7he::o7_getActorRoom() {
push(getObjectRoom(act));
}
+void ScummEngine_v7he::o7_dimArray() {
+ if (_heversion <= 71) {
+ ScummEngine_v6:o6_dimArray();
+ return;
+ }
+
+ int data;
+ int type = fetchScriptByte();
+
+ switch (type) {
+ case 5: // SO_INT_ARRAY
+ data = kIntArray;
+ break;
+ case 2: // SO_BIT_ARRAY
+ data = kBitArray;
+ break;
+ case 3: // SO_NIBBLE_ARRAY
+ data = kNibbleArray;
+ break;
+ case 4: // SO_BYTE_ARRAY
+ data = kByteArray;
+ break;
+ case 7: // SO_STRING_ARRAY
+ data = kStringArray;
+ break;
+ case 204: // SO_UNDIM_ARRAY
+ nukeArray(fetchScriptWord());
+ return;
+ default:
+ error("o7_dimArray: default case %d", type);
+ }
+
+ defineArray(fetchScriptWord(), data, 0, pop());
+}
+
+void ScummEngine_v7he::o7_arrayOps() {
+ byte subOp = fetchScriptByte();
+ int array = fetchScriptWord();
+ int b, c, d, len;
+ ArrayHeader *ah;
+ int list[128];
+
+ switch (subOp) {
+ case 7: // SO_ASSIGN_STRING
+ len = resStrLen(_scriptPointer);
+ ah = defineArray(array, kStringArray, 0, len + 1);
+ copyScriptString(ah->data);
+ break;
+ case 205: // SO_ASSIGN_STRING
+ b = pop();
+ len = resStrLen(_scriptPointer);
+ ah = defineArray(array, kStringArray, 0, len + 1);
+ copyScriptString(ah->data + b);
+ break;
+ case 208: // SO_ASSIGN_INT_LIST
+ b = pop();
+ c = pop();
+ d = readVar(array);
+ if (d == 0) {
+ defineArray(array, kIntArray, 0, b + c);
+ }
+ while (c--) {
+ writeArray(array, 0, b + c, pop());
+ }
+ break;
+ case 212: // SO_ASSIGN_2DIM_LIST
+ b = pop();
+ len = getStackList(list, ARRAYSIZE(list));
+ d = readVar(array);
+ if (d == 0)
+ error("Must DIM a two dimensional array before assigning");
+ c = pop();
+ while (--len >= 0) {
+ writeArray(array, c, b + len, list[len]);
+ }
+ break;
+ default:
+ error("o7_arrayOps: default case %d (array %d)", subOp, array);
+ }
+}
+
+void ScummEngine_v7he::o7_startScript() {
+ if (_heversion <= 71) {
+ ScummEngine_v6:o6_startScript();
+ return;
+ }
+
+ int args[16];
+ int script, flags;
+
+ getStackList(args, ARRAYSIZE(args));
+ script = pop();
+ flags = fetchScriptByte();
+
+ runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
+}
+
void ScummEngine_v7he::o7_startSound() {
byte op;
op = fetchScriptByte();