[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.211,2.212 script.cpp,1.191,1.192 script_v6he.cpp,2.105,2.106 script_v72he.cpp,2.39,2.40 script_v7he.cpp,2.59,2.60 scumm.h,1.463,1.464
Travis Howell
kirben at users.sourceforge.net
Thu Sep 2 23:58:05 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24787/scumm
Modified Files:
intern.h script.cpp script_v6he.cpp script_v72he.cpp
script_v7he.cpp scumm.h
Log Message:
Add basic decoding of debug script scripts.
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.211
retrieving revision 2.212
diff -u -d -r2.211 -r2.212
--- intern.h 1 Sep 2004 03:58:04 -0000 2.211
+++ intern.h 3 Sep 2004 06:57:37 -0000 2.212
@@ -574,6 +574,8 @@
void seekFilePos(int slot, int offset, int mode);
virtual void decodeParseString(int a, int b);
+ void decodeScriptString(byte *dst, bool scriptString = false);
+
/* Version 6 script opcodes */
void o6_setState();
void o6_roomOps();
@@ -629,7 +631,7 @@
void o7_stringLen();
void o7_unknownEF();
void o7_readINI();
- void o7_unknownF4();
+ void o7_writeINI();
void o7_unknownF5();
void o7_unknownF6();
void o7_unknownF9();
@@ -727,6 +729,7 @@
void o72_unknownEF();
void o72_unknownF1();
void o72_readINI();
+ void o72_writeINI();
void o72_unknownF4();
void o72_unknownF6();
void o72_unknownF8();
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- script.cpp 1 Sep 2004 07:59:30 -0000 1.191
+++ script.cpp 3 Sep 2004 06:57:37 -0000 1.192
@@ -1056,7 +1056,7 @@
return false;
}
-void ScummEngine::copyScriptString(byte *dst, bool override) {
+int ScummEngine::copyScriptString(byte *dst, bool override) {
int len, i = 0;
if (_heversion >= 72 && (pop() == -1 || override)) {
len = resStrLen(_stringBuffer) + 1;
@@ -1069,6 +1069,7 @@
}
*dst = 0;
+ return len;
}
//
Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.105
retrieving revision 2.106
diff -u -d -r2.105 -r2.106
--- script_v6he.cpp 1 Sep 2004 10:15:10 -0000 2.105
+++ script_v6he.cpp 3 Sep 2004 06:57:38 -0000 2.106
@@ -1248,6 +1248,7 @@
byte b;
int i, color;
int args[31];
+ byte name[1024];
b = fetchScriptByte();
@@ -1300,24 +1301,21 @@
break;
case 194: // HE 7.2
- getStackList(args, ARRAYSIZE(args));
- pop();
+ decodeScriptString(name, true);
switch (m) {
case 0:
- actorTalk(_scriptPointer);
+ actorTalk(name);
break;
case 1:
- drawString(1, _scriptPointer);
+ drawString(1, name);
break;
case 2:
- unkMessage1(_scriptPointer);
+ unkMessage1(name);
break;
case 3:
- unkMessage2(_scriptPointer);
+ unkMessage2(name);
break;
}
- _scriptPointer += resStrLen(_scriptPointer) + 1;
-
break;
case 0xF9:
color = pop();
Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.39
retrieving revision 2.40
diff -u -d -r2.39 -r2.40
--- script_v72he.cpp 1 Sep 2004 03:58:04 -0000 2.39
+++ script_v72he.cpp 3 Sep 2004 06:57:38 -0000 2.40
@@ -351,7 +351,7 @@
OPCODE(o6_invalid),
OPCODE(o72_readINI),
/* F4 */
- OPCODE(o72_unknownF4),
+ OPCODE(o72_writeINI),
OPCODE(o6_invalid),
OPCODE(o72_unknownF6),
OPCODE(o6_invalid),
@@ -513,6 +513,42 @@
}
}
+void ScummEngine_v6he::decodeScriptString(byte *dst, bool scriptString) {
+ int args[31];
+ int num = 0, val = 0;
+ int len;
+ byte chr, name[256];
+
+ getStackList(args, ARRAYSIZE(args));
+ pop();
+
+ if (scriptString) {
+ addMessageToStack(_scriptPointer, name, sizeof(name));
+ len = resStrLen(_scriptPointer);
+ _scriptPointer += len + 1;
+ } else {
+ len = copyScriptString(name);
+ }
+
+ //FIXME Bad pop/push somewhere ?
+ if (len == -1)
+ return;
+
+ while (len--) {
+ chr = name[num++];
+ if (chr == 0x25) {
+ chr = name[num++];
+ if (chr == 0x64)
+ dst += snprintf((char *)dst, 5, "%d", args[val++]);
+ else if (chr == 0x73)
+ dst += addStringToStack(dst, 100, args[val++]);
+ continue;
+ }
+ *dst++ = chr;
+ }
+ *dst = 0;
+}
+
void ScummEngine_v72he::o72_pushDWord() {
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
@@ -803,10 +839,8 @@
break;
case 194: // SO_ASSIGN_STRING
array = fetchScriptWord();
- len = getStackList(list, ARRAYSIZE(list));
- pop();
- ah = defineArray(array, kStringArray, 0, 0, 0, 1024);
- copyScriptString(ah->data);
+ ah = defineArray(array, kStringArray, 0, 0, 0, 4096);
+ decodeScriptString(ah->data);
break;
case 208: // SO_ASSIGN_INT_LIST
array = fetchScriptWord();
@@ -1310,7 +1344,7 @@
debug(1, "o72_readINI (%d) %s", type, name);
}
-void ScummEngine_v72he::o72_unknownF4() {
+void ScummEngine_v72he::o72_writeINI() {
byte b;
byte name[256], name2[1024];
@@ -1321,11 +1355,11 @@
pop();
copyScriptString(name);
break;
- warning("o72_unknownF4 stub (%s)", name);
+ debug(1,"o72_writeINI stub (%s)", name);
case 7:
copyScriptString(name2);
copyScriptString(name);
- warning("o72_unknownF4 stub (%s, %s)", name, name2);
+ debug(1,"o72_writeINI stub (%s, %s)", name, name2);
break;
}
}
@@ -1380,13 +1414,15 @@
void ScummEngine_v72he::o72_unknownF9() {
// File related
- warning("stub o72_unknownF9");
+ byte name[100];
+ //copyScriptString(name);
+ //debug(1,"o72_unknownF9: %s", name);
}
void ScummEngine_v72he::o72_unknownFA() {
byte name[100];
- int id = fetchScriptByte();
copyScriptString(name);
+ int id = fetchScriptByte();
debug(1,"o72_unknownFA: (%d) %s", id, name);
}
Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.59
retrieving revision 2.60
diff -u -d -r2.59 -r2.60
--- script_v7he.cpp 1 Sep 2004 03:58:04 -0000 2.59
+++ script_v7he.cpp 3 Sep 2004 06:57:38 -0000 2.60
@@ -351,7 +351,7 @@
OPCODE(o6_invalid),
OPCODE(o7_readINI),
/* F4 */
- OPCODE(o7_unknownF4),
+ OPCODE(o7_writeINI),
OPCODE(o7_unknownF5),
OPCODE(o7_unknownF6),
OPCODE(o6_invalid),
@@ -882,11 +882,10 @@
}
}
-void ScummEngine_v7he::o7_unknownF4() {
+void ScummEngine_v7he::o7_writeINI() {
int a, b;
byte filename1[256], filename2[256];
int len;
-
b = pop();
a = pop();
@@ -897,7 +896,7 @@
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
- debug(1, "o7_unknownF4(%d, %d, \"%s\")", a, b, filename1);
+ debug(1, "o7_writeINI(%d, %d, \"%s\")", a, b, filename1);
break;
case 2:
addMessageToStack(_scriptPointer, filename1, sizeof(filename1));
@@ -909,10 +908,9 @@
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
- debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
+ debug(1, "o7_writeINI(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
break;
}
- debug(1,"o7_unknownF4 stub");
}
void ScummEngine_v7he::o7_unknownF5() {
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.463
retrieving revision 1.464
diff -u -d -r1.463 -r1.464
--- scumm.h 2 Sep 2004 17:29:48 -0000 1.463
+++ scumm.h 3 Sep 2004 06:57:38 -0000 1.464
@@ -623,7 +623,7 @@
void beginOverride();
void endOverride();
- void copyScriptString(byte *dst, bool override = false);
+ int copyScriptString(byte *dst, bool override = false);
int resStrLen(const byte *src) const;
void doSentence(int c, int b, int a);
More information about the Scummvm-git-logs
mailing list