aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2004-03-02 06:42:22 +0000
committerTravis Howell2004-03-02 06:42:22 +0000
commitca85e8d51d5a8b2d0489dbfb3d33a15480b1a90e (patch)
treeb365071135c4f83f495450e23cf32532ba955ae6 /scumm
parentf80d6a7a2660ede913c7d7cf58d5afa26fc471cd (diff)
downloadscummvm-rg350-ca85e8d51d5a8b2d0489dbfb3d33a15480b1a90e.tar.gz
scummvm-rg350-ca85e8d51d5a8b2d0489dbfb3d33a15480b1a90e.tar.bz2
scummvm-rg350-ca85e8d51d5a8b2d0489dbfb3d33a15480b1a90e.zip
Ooops, just move everyting used by HE6 to HE6.
svn-id: r13137
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h5
-rw-r--r--scumm/script_v6he.cpp74
-rw-r--r--scumm/script_v7he.cpp118
3 files changed, 69 insertions, 128 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index cf152a706d..0d18e0530b 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -593,6 +593,7 @@ protected:
void o6_redimArray();
void o6_stringLen();
void o6_readINI();
+ void o6_unknownF4();
void o6_unknownF9();
void o6_readFilePos();
};
@@ -617,13 +618,9 @@ protected:
virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i);
- byte stringLen(byte *);
-
/* Version 7 script opcodes */
void o7_objectX();
void o7_objectY();
- void o7_stringLen();
- void o7_unknownF4();
void o7_unknownFB();
};
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp
index ec7d68055e..ce53e47f80 100644
--- a/scumm/script_v6he.cpp
+++ b/scumm/script_v6he.cpp
@@ -352,7 +352,7 @@ void ScummEngine_v6he::setupOpcodes() {
OPCODE(o6_invalid),
OPCODE(o6_readINI),
/* F4 */
- OPCODE(o6_invalid),
+ OPCODE(o6_unknownF4),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
@@ -1248,22 +1248,21 @@ void ScummEngine_v6he::o6_stringLen() {
int a, len;
byte *addr;
- if (!(_features & GF_WINDOWS)) {
- o6_invalid();
- return;
- }
-
a = pop();
addr = getStringAddress(a);
if (!addr) {
// FIXME: should be error here
- warning("ScummEngine_v6he::o7_stringLen: Reference to zeroed array pointer (%d)", a);
+ warning("o6_stringLen: Reference to zeroed array pointer (%d)", a);
push(0);
return;
}
- len = stringLen(addr);
+ if (_gameId == GID_FREDDEMO) {
+ len = strlen((char *)getStringAddress(a));
+ } else { // FREDDI, PUTTMOON
+ len = stringLen(addr);
+ }
push(len);
}
@@ -1315,6 +1314,65 @@ void ScummEngine_v6he::o6_localizeArray() {
}
}
+void ScummEngine_v6he::o6_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;
+
+
+ b = pop();
+ a = pop();
+
+ switch (b) {
+ case 1:
+ _msgPtrToAdd = filename1;
+ _messagePtr = _scriptPointer;
+ addMessageToStack(_messagePtr);
+
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ debug(1, "o6_unknownF4(%d, %d, \"%s\")", a, b, _messagePtr);
+ break;
+ case 2:
+ _msgPtrToAdd = filename1;
+ _messagePtr = _scriptPointer;
+ addMessageToStack(_messagePtr);
+
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+
+ _msgPtrToAdd = filename2;
+ _messagePtr = _scriptPointer;
+ addMessageToStack(_messagePtr);
+
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ debug(1, "o6_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
+ break;
+ }
+ }
+ warning("o6_unknownF4 stub");
+}
+
void ScummEngine_v6he::o6_unknownF9() {
// File related
int len, r;
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp
index cda0d14749..f1f07ca4d1 100644
--- a/scumm/script_v7he.cpp
+++ b/scumm/script_v7he.cpp
@@ -344,7 +344,7 @@ void ScummEngine_v7he::setupOpcodes() {
/* EC */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
- OPCODE(o7_stringLen),
+ OPCODE(o6_stringLen),
OPCODE(o6_invalid),
/* F0 */
OPCODE(o6_invalid),
@@ -352,7 +352,7 @@ void ScummEngine_v7he::setupOpcodes() {
OPCODE(o6_invalid),
OPCODE(o6_readINI),
/* F4 */
- OPCODE(o7_unknownF4),
+ OPCODE(o6_unknownF4),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
@@ -406,120 +406,6 @@ void ScummEngine_v7he::o7_objectY() {
push(_objs[objnum].y_pos);
}
-void ScummEngine_v7he::o7_stringLen() {
- int a, len;
- byte *addr;
-
- if (!(_features & GF_WINDOWS)) {
- o6_invalid();
- return;
- }
-
- a = pop();
-
- addr = getStringAddress(a);
- if (!addr) {
- // FIXME: should be error here
- warning("ScummEngine_v7he::o7_stringLen: Reference to zeroed array pointer (%d)", a);
- push(0);
- return;
- }
-
- len = strlen((char *)getStringAddress(a));
- push(len);
-}
-
-byte ScummEngine_v7he::stringLen(byte *ptr) {
- byte len;
- byte c;
- if (!ptr) {
- //ptr = _someGlobalPtr;
- error("ScummEngine_v7he::stringLen(): zero ptr. Undimplemented behaviour");
- return 1;
- }
-
- len = 0;
- c = *ptr++;
-
- if (len == c)
- return 1;
-
- do {
- len++;
- if (c == 0xff) {
- ptr += 3;
- len += 3;
- }
- c = *ptr++;
- } while (c);
-
- return len+1;
-}
-
-void ScummEngine_v7he::o7_unknownF4() {
- if (!(_features & GF_WINDOWS)) {
- o6_invalid();
- return;
- }
-
- 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.w32, PUTTMOON.w32
- int a, b;
- byte filename1[256], filename2[256];
- int len;
-
-
- b = pop();
- a = pop();
-
- switch (b) {
- case 1:
- _msgPtrToAdd = filename1;
- _messagePtr = _scriptPointer;
- addMessageToStack(_messagePtr);
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- debug(0, "unknownF4(%d, %d, \"%s\")", a, b, _messagePtr);
- break;
- case 2:
- _msgPtrToAdd = filename1;
- _messagePtr = _scriptPointer;
- addMessageToStack(_messagePtr);
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
-
- _msgPtrToAdd = filename2;
- _messagePtr = _scriptPointer;
- addMessageToStack(_messagePtr);
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- debug(0, "unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
- break;
- }
- }
- warning("o7_unknownF4 stub");
-}
-
void ScummEngine_v7he::o7_unknownFB() {
byte b;
b = fetchScriptByte();