aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v7he.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scumm/script_v7he.cpp')
-rw-r--r--scumm/script_v7he.cpp268
1 files changed, 38 insertions, 230 deletions
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp
index 274b8b47f2..a5863b0d7f 100644
--- a/scumm/script_v7he.cpp
+++ b/scumm/script_v7he.cpp
@@ -57,7 +57,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_pushByteVar),
OPCODE(o6_pushWordVar),
/* 04 */
- OPCODE(o7_getString),
+ OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_byteArrayRead),
OPCODE(o6_wordArrayRead),
@@ -157,8 +157,8 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_byteArrayInc),
OPCODE(o6_wordArrayInc),
/* 54 */
- OPCODE(o7_objectX),
- OPCODE(o7_objectY),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
OPCODE(o6_byteVarDec),
OPCODE(o6_wordVarDec),
/* 58 */
@@ -169,7 +169,7 @@ void ScummEngine_v7he::setupOpcodes() {
/* 5C */
OPCODE(o6_if),
OPCODE(o6_ifNot),
- OPCODE(o7_startScript),
+ OPCODE(o6_startScript),
OPCODE(o6_startScriptQuick),
/* 60 */
OPCODE(o6_startObject),
@@ -257,7 +257,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_getActorElevation),
OPCODE(o6_getVerbEntrypoint),
/* A4 */
- OPCODE(o7_arrayOps),
+ OPCODE(o6_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(o7_dimArray),
+ OPCODE(o6_dimArray),
OPCODE(o6_dummy),
OPCODE(o6_startObjectQuick),
OPCODE(o6_startScriptQuick2),
@@ -318,7 +318,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_invalid),
/* D4 */
OPCODE(o6_shuffle),
- OPCODE(o7_jumpToScript),
+ OPCODE(o6_jumpToScript),
OPCODE(o6_band),
OPCODE(o6_bor),
/* D8 */
@@ -386,59 +386,11 @@ const char *ScummEngine_v7he::getOpcodeDesc(byte i) {
}
-void ScummEngine_v7he::o7_objectX() {
- if (_heversion <= 71) {
- o6_invalid();
- }
-
- int object = pop();
- int objnum = getObjectIndex(object);
-
- if (objnum == -1) {
- push(0);
- return;
- }
-
- push(_objs[objnum].x_pos);
-}
-
-
-void ScummEngine_v7he::o7_objectY() {
- if (_heversion <= 71) {
- o6_invalid();
- }
-
- int object = pop();
- int objnum = getObjectIndex(object);
-
- if (objnum == -1) {
- push(0);
- return;
- }
-
- push(_objs[objnum].y_pos);
-}
-
-void ScummEngine_v7he::o7_getString() {
- int len;
-
- len = resStrLen(_scriptPointer);
- warning("stub o7_getString(\"%s\")", _scriptPointer);
- _scriptPointer += len;
- fetchScriptWord();
- fetchScriptWord();
-}
-
void ScummEngine_v7he::o7_unknownFA() {
- int len, a = fetchScriptByte();
-
- if (_heversion <= 71) {
- len = resStrLen(_scriptPointer);
- warning("stub o7_unknownFA(%d, \"%s\")", a, _scriptPointer);
- _scriptPointer += len + 1;
- } else {
- warning("stub o7_unknownFA(%d)", a);
- }
+ int num = fetchScriptByte();
+ int len = resStrLen(_scriptPointer);
+ warning("stub o7_unknownFA(%d, \"%s\")", num, _scriptPointer);
+ _scriptPointer += len + 1;
}
void ScummEngine_v7he::o7_stringLen() {
@@ -455,11 +407,7 @@ void ScummEngine_v7he::o7_stringLen() {
return;
}
- if (_gameId == GID_FREDDEMO) {
- len = strlen((char *)getStringAddress(a));
- } else { // FREDDI, PUTTMOON
- len = stringLen(addr);
- }
+ len = stringLen(addr);
push(len);
}
@@ -496,22 +444,14 @@ void ScummEngine_v7he::o7_readINI() {
int retval;
// we pretend that we don't have .ini file
- if (_heversion <= 71) {
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- type = pop();
- } else {
- type = fetchScriptByte();
- }
-
-
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ type = pop();
switch (type) {
case 1: // number
- case 6: // HE 7.2
push(0);
break;
case 2: // string
- case 7: // HE 7.2
defineArray(0, kStringArray, 0, 0);
retval = readVar(0);
writeArray(0, 0, 0, 0);
@@ -523,54 +463,34 @@ void ScummEngine_v7he::o7_readINI() {
}
void ScummEngine_v7he::o7_unknownF4() {
- if (_gameId == GID_FREDDEMO) {
- byte b;
- int len;
- b = fetchScriptByte();
-
- switch (b) {
- case 6:
- pop();
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- break;
- case 7:
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- break;
- }
- } else { // FREDDI, PUTTMOON
- int a, b;
- byte filename1[256], filename2[256];
- int len;
+ int a, b;
+ byte filename1[256], filename2[256];
+ int len;
-
- b = pop();
- a = pop();
+
+ b = pop();
+ a = pop();
- switch (b) {
- case 1:
- addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
+ switch (b) {
+ case 1:
+ addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- debug(1, "o7_unknownF4(%d, %d, \"%s\")", a, b, filename1);
- break;
- case 2:
- addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ debug(1, "o7_unknownF4(%d, %d, \"%s\")", a, b, filename1);
+ break;
+ case 2:
+ addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
- addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
+ addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
- break;
- }
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
+ break;
}
warning("o7_unknownF4 stub");
}
@@ -677,118 +597,6 @@ 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_jumpToScript() {
- if (_heversion <= 71) {
- ScummEngine_v6::o6_jumpToScript();
- return;
- }
- int args[16];
- int script, flags;
-
- getStackList(args, ARRAYSIZE(args));
- script = pop();
- flags = fetchScriptByte();
- stopObjectCode();
- runScript(script, (flags == 199 || flags == 200), (flags == 195 || flags == 200), args);
-}
-
-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();
@@ -885,7 +693,7 @@ void ScummEngine_v7he::o7_cursorCommand() {
setCursorTransparency(pop());
break;
default:
- error("o6_cursorCommand: default case %x", subOp);
+ error("o7_cursorCommand: default case %x", subOp);
}
VAR(VAR_CURSORSTATE) = _cursor.state;