[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.157,2.158 script_v6he.cpp,2.48,2.49 script_v7he.cpp,2.10,2.11
Travis Howell
kirben at users.sourceforge.net
Tue Jun 1 01:39:01 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24101/scumm
Modified Files:
intern.h script_v6he.cpp script_v7he.cpp
Log Message:
HE games use slightly different E1 opcode
Move HE7 specific opcodes to he7, as requested.
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.157
retrieving revision 2.158
diff -u -d -r2.157 -r2.158
--- intern.h 1 Jun 2004 06:38:35 -0000 2.157
+++ intern.h 1 Jun 2004 08:37:57 -0000 2.158
@@ -576,7 +576,6 @@
void virtScreenLoad(int resIdx, int x1, int y1, int x2, int y2);
uint8 virtScreenLoadUnpack(vsUnpackCtx *ctx, byte *data);
void seekFilePos(int slot, int offset, int mode);
- byte stringLen(byte *);
virtual void decodeParseString(int a, int b);
/* Version 6 script opcodes */
@@ -601,14 +600,9 @@
void o6_writeFile();
void o6_setVolume();
void o6_seekFilePos();
+ void o6_unknownE1();
void o6_localizeArray();
- void o6_unknownFA();
void o6_redimArray();
- void o6_stringLen();
- void o6_readINI();
- void o6_unknownF4();
- void o6_unknownF9();
- void o6_unknownFB();
void o6_readFilePos();
void o6_quitPauseRestart();
};
@@ -633,9 +627,17 @@
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_readINI();
+ void o7_unknownF4();
+ void o7_unknownF9();
+ void o7_unknownFA();
+ void o7_unknownFB();
};
class ScummEngine_v7 : public ScummEngine_v6 {
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.48
retrieving revision 2.49
diff -u -d -r2.48 -r2.49
--- script_v6he.cpp 1 Jun 2004 06:38:36 -0000 2.48
+++ script_v6he.cpp 1 Jun 2004 08:37:57 -0000 2.49
@@ -342,23 +342,23 @@
/* EC */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
- OPCODE(o6_stringLen),
+ OPCODE(o6_invalid),
OPCODE(o6_invalid),
/* F0 */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
- OPCODE(o6_readINI),
+ OPCODE(o6_invalid),
/* F4 */
- OPCODE(o6_unknownF4),
+ OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
/* F8 */
OPCODE(o6_invalid),
- OPCODE(o6_unknownF9),
- OPCODE(o6_unknownFA),
- OPCODE(o6_unknownFB),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
+ OPCODE(o6_invalid),
/* FC */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
@@ -1272,12 +1272,45 @@
}
}
-void ScummEngine_v6he::o6_unknownFA() {
- int len, a = fetchScriptByte();
+void ScummEngine_v6he::o6_unknownE1() {
+ int x = pop();
+ int y = pop();
+
+ if (x > _screenWidth - 1) {
+ push(-1);
+ return;
+ }
+ if (x < 0) {
+ push(-1);
+ return;
+ }
+
+ if (y < 0) {
+ push(-1);
+ return;
+ }
- len = resStrLen(_scriptPointer);
- warning("stub o6_unknownFA(%d, \"%s\")", a, _scriptPointer);
- _scriptPointer += len + 1;
+ VirtScreen *vs = findVirtScreen(y);
+
+ if (vs == NULL) {
+ push(-1);
+ return;
+ }
+
+ int offset = (y - vs->topline) * vs->width + x + _screenLeft;
+
+ byte area = *(vs->screenPtr + offset);
+ push(area);
+}
+
+void ScummEngine_v6he::o6_localizeArray() {
+ int stringID = pop();
+
+ if (stringID < _numArray) {
+ _baseArrays[stringID][0] = (byte)_currentScript;
+ } else {
+ warning("o6_localizeArray(%d): too big scriptID", stringID);
+ }
}
void ScummEngine_v6he::o6_seekFilePos() {
@@ -1387,172 +1420,6 @@
ah->dim2 = TO_LE_16(newX + 1);
}
-void ScummEngine_v6he::o6_stringLen() {
- int a, len;
- byte *addr;
-
- a = pop();
-
- addr = getStringAddress(a);
- if (!addr) {
- // FIXME: should be error here
- warning("o6_stringLen: Reference to zeroed array pointer (%d)", a);
- push(0);
- return;
- }
-
- if (_heversion >= 60) {
- len = strlen((char *)getStringAddress(a));
- } else { // FREDDI, PUTTMOON
- len = stringLen(addr);
- }
- push(len);
-}
-
-byte ScummEngine_v6he::stringLen(byte *ptr) {
- byte len;
- byte c;
- if (!ptr) {
- //ptr = _someGlobalPtr;
- error("ScummEngine_v6he::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_v6he::o6_readINI() {
- int len;
-
- len = resStrLen(_scriptPointer);
- debug(1, "stub o6_readINI(\"%s\")", _scriptPointer);
- _scriptPointer += len + 1;
- pop();
- push(0);
-
-}
-
-void ScummEngine_v6he::o6_localizeArray() {
- int stringID = pop();
-
- if (stringID < _numArray) {
- _baseArrays[stringID][0] = (byte)_currentScript;
- } else {
- warning("o6_localizeArray(%d): too big scriptID", stringID);
- }
-}
-
-void ScummEngine_v6he::o6_unknownF4() {
- if (_heversion >= 60) {
- 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:
- addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
- debug(1, "o6_unknownF4(%d, %d, \"%s\")", a, b, filename1);
- break;
- case 2:
- addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
-
- addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
-
- 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;
- byte filename[100];
-
- addMessageToStack(_scriptPointer, filename, sizeof(filename));
-
- len = resStrLen(_scriptPointer);
- _scriptPointer += len + 1;
-
- for (r = strlen((char*)filename); r != 0; r--) {
- if (filename[r - 1] == '\\')
- break;
- }
-
- warning("stub o6_unknownF9(\"%s\")", filename + r);
-}
-
-void ScummEngine_v6he::o6_unknownFB() {
- byte b;
- b = fetchScriptByte();
-
- switch (b) {
- case 246:
- case 248:
- pop();
- pop();
- pop();
- pop();
- pop();
- pop();
- pop();
- pop();
- pop();
- break;
- case 247:
- pop();
- pop();
- break;
- }
- warning("o6_unknownFB stub");
-}
-
void ScummEngine_v6he::decodeParseString(int m, int n) {
byte b;
int c;
Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -d -r2.10 -r2.11
--- script_v7he.cpp 5 Apr 2004 18:54:51 -0000 2.10
+++ script_v7he.cpp 1 Jun 2004 08:37:57 -0000 2.11
@@ -342,23 +342,23 @@
/* EC */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
- OPCODE(o6_stringLen),
+ OPCODE(o7_stringLen),
OPCODE(o6_invalid),
/* F0 */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
- OPCODE(o6_readINI),
+ OPCODE(o7_readINI),
/* F4 */
- OPCODE(o6_unknownF4),
+ OPCODE(o7_unknownF4),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o6_invalid),
/* F8 */
OPCODE(o6_invalid),
- OPCODE(o6_unknownF9),
- OPCODE(o6_unknownFA),
- OPCODE(o6_unknownFB),
+ OPCODE(o7_unknownF9),
+ OPCODE(o7_unknownFA),
+ OPCODE(o7_unknownFB),
/* FC */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
@@ -404,4 +404,168 @@
push(_objs[objnum].y_pos);
}
+void ScummEngine_v7he::o7_unknownFA() {
+ int len, a = fetchScriptByte();
+
+ len = resStrLen(_scriptPointer);
+ warning("stub o7_unknownFA(%d, \"%s\")", a, _scriptPointer);
+ _scriptPointer += len + 1;
+}
+
+void ScummEngine_v7he::o7_stringLen() {
+ int a, len;
+ byte *addr;
+
+ a = pop();
+
+ addr = getStringAddress(a);
+ if (!addr) {
+ // FIXME: should be error here
+ warning("o7_stringLen: Reference to zeroed array pointer (%d)", a);
+ push(0);
+ return;
+ }
+
+ if (_heversion >= 60) {
+ len = strlen((char *)getStringAddress(a));
+ } else { // FREDDI, PUTTMOON
+ len = stringLen(addr);
+ }
+ 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_readINI() {
+ int len;
+
+ len = resStrLen(_scriptPointer);
+ debug(1, "stub o7_readINI(\"%s\")", _scriptPointer);
+ _scriptPointer += len + 1;
+ pop();
+ push(0);
+
+}
+
+void ScummEngine_v7he::o7_unknownF4() {
+ if (_heversion >= 60) {
+ 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:
+ 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;
+
+ addMessageToStack(_scriptPointer, filename2, sizeof(filename2));
+
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
+ break;
+ }
+ }
+ warning("o7_unknownF4 stub");
+}
+
+void ScummEngine_v7he::o7_unknownF9() {
+ // File related
+ int len, r;
+ byte filename[100];
+
+ addMessageToStack(_scriptPointer, filename, sizeof(filename));
+
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+
+ for (r = strlen((char*)filename); r != 0; r--) {
+ if (filename[r - 1] == '\\')
+ break;
+ }
+
+ warning("stub o7_unknownF9(\"%s\")", filename + r);
+}
+
+void ScummEngine_v7he::o7_unknownFB() {
+ byte b;
+ b = fetchScriptByte();
+
+ switch (b) {
+ case 246:
+ case 248:
+ pop();
+ pop();
+ pop();
+ pop();
+ pop();
+ pop();
+ pop();
+ pop();
+ pop();
+ break;
+ case 247:
+ pop();
+ pop();
+ break;
+ }
+ warning("o7_unknownFB stub");
+}
+
} // End of namespace Scumm
More information about the Scummvm-git-logs
mailing list