diff options
Diffstat (limited to 'scumm/script_v7he.cpp')
-rw-r--r-- | scumm/script_v7he.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
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; |