diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 7 | ||||
-rw-r--r-- | scumm/script_v100he.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 73 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 48 | ||||
-rw-r--r-- | scumm/script_v80he.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 6 |
6 files changed, 63 insertions, 83 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index ccaeb86e67..69e7c63e78 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -661,6 +661,7 @@ protected: virtual void redrawBGAreas(); + int setupStringArray(int size); void appendSubstring(int dst, int src, int len2, int len); int findObject(int x, int y, int num, int *args); @@ -675,9 +676,11 @@ protected: void o70_findObject(); void o70_quitPauseRestart(); void o70_kernelSetFunctions(); + void o70_copyString(); void o70_getStringWidth(); void o70_getStringLen(); void o70_appendString(); + void o70_concatString(); void o70_compareString(); void o70_readINI(); void o70_writeINI(); @@ -734,6 +737,7 @@ protected: virtual void writeArray(int array, int idx2, int idx1, int value); void redimArray(int arrayId, int newDim2start, int newDim2end, int newDim1start, int newDim1end, int type); + int setupStringArray(int size); int readFileToArray(int slot, int32 size); void writeFileFromArray(int slot, int resID); @@ -787,9 +791,6 @@ protected: void o72_getPixel(); void o72_pickVarRandom(); void o72_redimArray(); - void o72_copyString(); - void o72_appendString(); - void o72_concatString(); void o72_checkGlobQueue(); void o72_readINI(); void o72_writeINI(); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index ea4bbe2ec9..6d914a3762 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -322,9 +322,9 @@ void ScummEngine_v100he::setupOpcodes() { OPCODE(o6_getState), /* E0 */ OPCODE(o70_compareString), - OPCODE(o72_copyString), - OPCODE(o72_appendString), - OPCODE(o72_concatString), + OPCODE(o70_copyString), + OPCODE(o70_appendString), + OPCODE(o70_concatString), /* E4 */ OPCODE(o70_getStringLen), OPCODE(o70_getStringLenForWidth), diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 096b3cda4b..fcb7c8cf41 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -338,12 +338,12 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o72_redimArray), OPCODE(o60_readFilePos), /* EC */ - OPCODE(o72_copyString), + OPCODE(o70_copyString), OPCODE(o70_getStringWidth), OPCODE(o70_getStringLen), - OPCODE(o72_appendString), + OPCODE(o70_appendString), /* F0 */ - OPCODE(o72_concatString), + OPCODE(o70_concatString), OPCODE(o70_compareString), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), @@ -494,6 +494,13 @@ void ScummEngine_v72he::writeArray(int array, int idx2, int idx1, int value) { } } +int ScummEngine_v72he::setupStringArray(int size) { + writeVar(0, 0); + defineArray(0, kStringArray, 0, 0, 0, size + 1); + writeArray(0, 0, 0, 0); + return readVar(0); +} + void ScummEngine_v72he::readArrayFromIndexFile() { int num; int a, b, c; @@ -1822,66 +1829,6 @@ void ScummEngine_v72he::redimArray(int arrayId, int newDim2start, int newDim2end ah->dim2end = TO_LE_32(newDim2end); } -void ScummEngine_v72he::o72_copyString() { - int dst, size; - int src = pop(); - - size = resStrLen(getStringAddress(src)) + 1; - - writeVar(0, 0); - defineArray(0, kStringArray, 0, 0, 0, size); - writeArray(0, 0, 0, 0); - dst = readVar(0); - - appendSubstring(dst, src, -1, -1); - - push(dst); - debug(1,"o72_copyString"); -} - -void ScummEngine_v72he::o72_appendString() { - int dst, size; - - int len = pop(); - int srcOffs = pop(); - int src = pop(); - - size = len - srcOffs + 2; - - writeVar(0, 0); - defineArray(0, kStringArray, 0, 0, 0, size); - writeArray(0, 0, 0, 0); - - dst = readVar(0); - - appendSubstring(dst, src, srcOffs, len); - - push(dst); - debug(1,"o72_appendString"); -} - -void ScummEngine_v72he::o72_concatString() { - int dst, size; - - int src2 = pop(); - int src1 = pop(); - - size = resStrLen(getStringAddress(src1)); - size += resStrLen(getStringAddress(src2)) + 1; - - writeVar(0, 0); - defineArray(0, kStringArray, 0, 0, 0, size); - writeArray(0, 0, 0, 0); - - dst = readVar(0); - - appendSubstring(dst, src1, 0, -1); - appendSubstring(dst, src2, 0, -1); - - push(dst); - debug(1,"o72_concatString"); -} - void ScummEngine_v72he::o72_checkGlobQueue() { byte subOp = fetchScriptByte(); int idx = pop(); diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index c07026f001..2d4aa8fe2c 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -337,12 +337,12 @@ void ScummEngine_v70he::setupOpcodes() { OPCODE(o60_redimArray), OPCODE(o60_readFilePos), /* EC */ - OPCODE(o6_invalid), + OPCODE(o70_copyString), OPCODE(o70_getStringWidth), OPCODE(o70_getStringLen), OPCODE(o70_appendString), /* F0 */ - OPCODE(o6_invalid), + OPCODE(o70_concatString), OPCODE(o70_compareString), OPCODE(o6_invalid), OPCODE(o70_readINI), @@ -375,6 +375,13 @@ const char *ScummEngine_v70he::getOpcodeDesc(byte i) { return _opcodesv70he[i].desc; } +int ScummEngine_v70he::setupStringArray(int size) { + writeVar(0, 0); + defineArray(0, kStringArray, 0, size + 1); + writeArray(0, 0, 0, 0); + return readVar(0); +} + void ScummEngine_v70he::appendSubstring(int dst, int src, int srcOffs, int len) { int dstOffs, value; int i = 0; @@ -714,6 +721,19 @@ void ScummEngine_v70he::o70_quitPauseRestart() { } } +void ScummEngine_v70he::o70_copyString() { + int dst, size; + int src = pop(); + + size = resStrLen(getStringAddress(src)) + 1; + dst = setupStringArray(size); + + appendSubstring(dst, src, -1, -1); + + push(dst); + debug(1,"o70_copyString"); +} + void ScummEngine_v70he::o70_getStringWidth() { int array, pos, len; int chr, width = 0; @@ -821,12 +841,7 @@ void ScummEngine_v70he::o70_appendString() { int src = pop(); size = len - srcOffs + 2; - - writeVar(0, 0); - defineArray(0, kStringArray, 0, size); - writeArray(0, 0, 0, 0); - - dst = readVar(0); + dst = setupStringArray(size); appendSubstring(dst, src, srcOffs, len); @@ -834,6 +849,23 @@ void ScummEngine_v70he::o70_appendString() { debug(1,"o70_appendString"); } +void ScummEngine_v70he::o70_concatString() { + int dst, size; + + int src2 = pop(); + int src1 = pop(); + + size = resStrLen(getStringAddress(src1)); + size += resStrLen(getStringAddress(src2)) + 1; + dst = setupStringArray(size); + + appendSubstring(dst, src1, 0, -1); + appendSubstring(dst, src2, 0, -1); + + push(dst); + debug(1,"o70_concatString"); +} + void ScummEngine_v70he::o70_compareString() { byte *addr, *addr2; int i = 0; diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 898d9b14d0..8dae92b389 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -336,12 +336,12 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o72_redimArray), OPCODE(o60_readFilePos), /* EC */ - OPCODE(o72_copyString), + OPCODE(o70_copyString), OPCODE(o70_getStringWidth), OPCODE(o70_getStringLen), - OPCODE(o72_appendString), + OPCODE(o70_appendString), /* F0 */ - OPCODE(o72_concatString), + OPCODE(o70_concatString), OPCODE(o70_compareString), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index e4d581221e..030df2d253 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -336,12 +336,12 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o72_redimArray), OPCODE(o60_readFilePos), /* EC */ - OPCODE(o72_copyString), + OPCODE(o70_copyString), OPCODE(o70_getStringWidth), OPCODE(o70_getStringLen), - OPCODE(o72_appendString), + OPCODE(o70_appendString), /* F0 */ - OPCODE(o72_concatString), + OPCODE(o70_concatString), OPCODE(o70_compareString), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), |