diff options
author | Max Horn | 2002-12-28 01:57:19 +0000 |
---|---|---|
committer | Max Horn | 2002-12-28 01:57:19 +0000 |
commit | ae5b30df3d67644f341a30997de5192fed8bcbdc (patch) | |
tree | db63a860f15229ec901e9b6d0bedaaf9f6f2435f /scumm/script_v6.cpp | |
parent | 319facc9c3a54bff3adab663e32f37bddb07c9e9 (diff) | |
download | scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.tar.gz scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.tar.bz2 scummvm-rg350-ae5b30df3d67644f341a30997de5192fed8bcbdc.zip |
get rid of getStringLen and use the more powerful resStrLen instead; moved resStrLen from common/ to scumm/, where it belongs; enhanced resStrLen to suport V8; fixed translateText to support embeded vars (in strings I mean) - it may still not be fully correct but at least is better now; rewrote o6_arrayOps to parallel the V8 version - needs testing
svn-id: r6215
Diffstat (limited to 'scumm/script_v6.cpp')
-rw-r--r-- | scumm/script_v6.cpp | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 3271cf10d7..52508edc15 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1952,54 +1952,46 @@ void Scumm_v6::o6_getVerbEntrypoint() push(getVerbEntrypoint(v, e)); } -void Scumm::arrayop_1(int a, byte *ptr) -{ - ArrayHeader *ah; - int r; - int len = getStringLen(ptr); - - r = defineArray(a, 4, 0, len); - ah = (ArrayHeader *)getResourceAddress(rtString, r); - copyString(ah->data, ptr, len); -} - void Scumm_v6::o6_arrayOps() { - int a, b, c, d, num; + byte subOp = fetchScriptByte(); + int array = fetchScriptWord(); + int b, c, d, len; + ArrayHeader *ah; int list[128]; - switch (fetchScriptByte()) { + switch (subOp) { case 205: - a = fetchScriptWord(); - pop(); - arrayop_1(a, NULL); + b = pop(); + len = resStrLen(_scriptPointer); + c = defineArray(array, 4, 0, len + 1); + ah = (ArrayHeader *)getResourceAddress(rtString, c); + copyScriptString(ah->data + b); break; case 208: - a = fetchScriptWord(); b = pop(); c = pop(); - d = readVar(a); + d = readVar(array); if (d == 0) { - defineArray(a, 5, 0, b + c); + defineArray(array, 5, 0, b + c); } while (c--) { - writeArray(a, 0, b + c, pop()); + writeArray(array, 0, b + c, pop()); } break; case 212: - a = fetchScriptWord(); b = pop(); - num = getStackList(list, sizeof(list) / sizeof(list[0])); - d = readVar(a); + len = getStackList(list, sizeof(list) / sizeof(list[0])); + d = readVar(array); if (d == 0) error("Must DIM a two dimensional array before assigning"); c = pop(); - while (--num >= 0) { - writeArray(a, c, b + num, list[num]); + while (--len >= 0) { + writeArray(array, c, b + len, list[len]); } break; default: - error("o6_arrayOps: default case"); + error("o6_arrayOps: default case %d (array %d)", subOp, array); } } @@ -2015,7 +2007,6 @@ void Scumm_v6::o6_saveRestoreVerbs() byte subOp = fetchScriptByte(); if (_features & GF_AFTER_V8) { subOp = (subOp - 141) + 0xB4; - printf("o8_saveRestoreVerbs:%d\n", (int)subOp); } switch (subOp) { @@ -2112,7 +2103,6 @@ void Scumm_v6::o6_wait() return; case 171: - printf("wait for sentence"); if (_sentenceNum) { if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) return; @@ -2290,8 +2280,9 @@ void Scumm_v6::o6_talkActor() char pointer[20]; int i, j; - _scriptPointer += resStrLen((char*)_scriptPointer) + 1; + _scriptPointer += resStrLen(_scriptPointer) + 1; translateText(_messagePtr, _transText); + for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) { if (_messagePtr[i] != '/') pointer[j++] = _messagePtr[i]; @@ -2934,7 +2925,7 @@ void Scumm_v6::decodeParseString(int m, int n) char pointer[20]; int i, j; - _scriptPointer += resStrLen((char*)_scriptPointer)+ 1; + _scriptPointer += resStrLen(_scriptPointer)+ 1; translateText(_messagePtr, _transText); for (i = 0, j = 0; (_messagePtr[i] != '/' || j == 0) && j < 19; i++) { if (_messagePtr[i] != '/') |