From 086724d774399aa0b101d2503929e3fca54813d5 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 13 Oct 2004 10:55:50 +0000 Subject: Remove more duplicates. svn-id: r15544 --- scumm/intern.h | 9 +-- scumm/script_v100he.cpp | 10 +-- scumm/script_v72he.cpp | 181 ++---------------------------------------------- scumm/script_v7he.cpp | 44 +++++++++++- scumm/script_v80he.cpp | 12 ++-- scumm/script_v90he.cpp | 12 ++-- 6 files changed, 68 insertions(+), 200 deletions(-) diff --git a/scumm/intern.h b/scumm/intern.h index d6b8a1380d..78cd66d1a0 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -641,6 +641,7 @@ protected: void o70_unknownED(); void o70_stringLen(); void o70_unknownEF(); + void o70_unknownF1(); void o70_readINI(); void o70_writeINI(); void o70_unknownF5(); @@ -709,7 +710,6 @@ protected: int newDim1start, int newDim1end, int type); int readFileToArray(int slot, int32 size); void writeFileFromArray(int slot, int resID); - void arrrays_unk2(int dst, int src, int len2, int len); void displayWizImage(const WizImage *pwi); void getWizImageDim(int resnum, int state, uint32 &w, uint32 &h); @@ -730,14 +730,12 @@ protected: void o72_isAnyOf(); void o72_unknown50(); void o72_findObjectWithClassOf(); - void o72_wordArrayInc(); void o72_getObjectImageX(); void o72_getObjectImageY(); void o72_captureWizImage(); void o72_getTimer(); void o72_setTimer(); void o72_unknown5A(); - void o72_wordArrayDec(); void o72_startScript(); void o72_startObject(); void o72_drawObject(); @@ -765,14 +763,11 @@ protected: void o72_pickVarRandom(); void o72_redimArray(); void o72_unknownEC(); - void o72_unknownED(); void o72_unknownEF(); - void o72_unknownF1(); + void o72_unknownF0(); void o72_checkGlobQueue(); void o72_readINI(); void o72_writeINI(); - void o72_unknownF0(); - void o72_unknownF4(); void o72_unknownF5(); void o72_unknownF6(); void o72_getResourceSize(); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 21fb61589c..708d110f73 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -79,7 +79,7 @@ void ScummEngine_v100he::setupOpcodes() { OPCODE(o72_traceStatus), OPCODE(o6_wordVarDec), /* 1C */ - OPCODE(o72_wordArrayDec), + OPCODE(o6_wordArrayDec), OPCODE(o72_deleteFile), OPCODE(o100_dim2dimArray), OPCODE(o100_dimArray), @@ -324,17 +324,17 @@ void ScummEngine_v100he::setupOpcodes() { OPCODE(o6_startScriptQuick2), OPCODE(o6_getState), /* E0 */ - OPCODE(o72_unknownF1), + OPCODE(o70_unknownF1), OPCODE(o72_unknownEC), OPCODE(o72_unknownEF), OPCODE(o72_unknownF0), /* E4 */ OPCODE(o70_stringLen), - OPCODE(o72_unknownF5), + OPCODE(o70_unknownF5), OPCODE(o6_invalid), - OPCODE(o72_unknownF6), + OPCODE(o70_unknownF6), /* E8 */ - OPCODE(o72_unknownED), + OPCODE(o70_unknownED), OPCODE(o60_readFilePos), OPCODE(o72_getTimer), OPCODE(o6_getVerbEntrypoint), diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 0e715d3963..93d43766af 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -148,7 +148,7 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o72_unknown50), OPCODE(o6_invalid), OPCODE(o72_findObjectWithClassOf), - OPCODE(o72_wordArrayInc), + OPCODE(o6_wordArrayInc), /* 54 */ OPCODE(o72_getObjectImageX), OPCODE(o72_getObjectImageY), @@ -158,7 +158,7 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o72_getTimer), OPCODE(o72_setTimer), OPCODE(o72_unknown5A), - OPCODE(o72_wordArrayDec), + OPCODE(o6_wordArrayDec), /* 5C */ OPCODE(o6_if), OPCODE(o6_ifNot), @@ -341,18 +341,18 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o60_readFilePos), /* EC */ OPCODE(o72_unknownEC), - OPCODE(o72_unknownED), + OPCODE(o70_unknownED), OPCODE(o70_stringLen), OPCODE(o72_unknownEF), /* F0 */ OPCODE(o72_unknownF0), - OPCODE(o72_unknownF1), + OPCODE(o70_unknownF1), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), /* F4 */ OPCODE(o72_writeINI), - OPCODE(o72_unknownF5), - OPCODE(o72_unknownF6), + OPCODE(o70_unknownF5), + OPCODE(o70_unknownF6), OPCODE(o6_invalid), /* F8 */ OPCODE(o72_getResourceSize), @@ -512,31 +512,6 @@ void ScummEngine_v72he::readArrayFromIndexFile() { } } -void ScummEngine_v72he::arrrays_unk2(int dst, int src, int len2, int len) { - int edi, value; - int i = 0; - - if (len == -1) { - len = resStrLen(getStringAddress(src)); - len2 = 0; - } - - edi = resStrLen(getStringAddress(dst)); - - len -= len2; - len++; - - while (i < len) { - writeVar(0, src); - value = readArray(0, 0, len2 + i); - writeVar(0, dst); - writeArray(0, 0, edi + i, value); - i++; - } - - writeArray(0, 0, edi + i, 0); -} - void ScummEngine_v72he::copyScriptString(byte *dst) { int i = 0; byte b; @@ -741,18 +716,6 @@ void ScummEngine_v72he::o72_findObjectWithClassOf() { push(r); } -void ScummEngine_v72he::o72_wordArrayInc() { - int var = fetchScriptWord(); - int base = pop(); - writeArray(var, 0, base, readArray(var, 0, base) + 1); -} - -void ScummEngine_v72he::o72_wordArrayDec() { - int var = fetchScriptWord(); - int base = pop(); - writeArray(var, 0, base, readArray(var, 0, base) - 1); -} - void ScummEngine_v72he::o72_getObjectImageX() { int object = pop(); int objnum = getObjectIndex(object); @@ -2232,31 +2195,6 @@ void ScummEngine_v72he::o72_unknownEC() { debug(1,"stub o72_unknownEC"); } -void ScummEngine_v72he::o72_unknownED() { - int array, pos, len; - int chr, result = 0; - - len = pop(); - pos = pop(); - array = pop(); - - if (len == -1) { - pos = 0; - len = resStrLen(getStringAddress(array)); - } - - writeVar(0, array); - while (pos <= len) { - chr = readArray(0, 0, pos); - if (chr) - result += _charset->getCharWidth(chr); - pos++; - } - - push(result); - debug(1,"stub o72_unknownED"); -} - void ScummEngine_v72he::o72_unknownEF() { int dst, size; int b = pop(); @@ -2299,48 +2237,6 @@ void ScummEngine_v72he::o72_unknownF0() { debug(1,"stub o72_unknownF0"); } -void ScummEngine_v72he::o72_unknownF1() { - byte *addr, *addr2; - int i = 0; - - int id = pop(); - int id2 = pop(); - - addr = getStringAddress(id); - if (!addr) - error("o72_stringLen: Reference to zeroed array pointer (%d)", id); - - addr2 = getStringAddress(id2); - if (!addr) - error("o72_stringLen: Reference to zeroed array pointer (%d)", id); - - while(1) { - if (*addr != *addr2) - break; - if (*addr == 0) { - push(0); - return; - } - - addr++; - addr2++; - - if (*addr != *addr2) - break; - if (*addr == 0) { - push(0); - return; - } - - addr++; - addr2++; - i += 2; - } - - push (i); - debug(1,"o70_unknownF1 stub (%d, %d, %d)", id, id2, i); -} - void ScummEngine_v72he::o72_checkGlobQueue() { byte subOp = fetchScriptByte(); int idx = pop(); @@ -2403,71 +2299,6 @@ void ScummEngine_v72he::o72_writeINI() { } } -void ScummEngine_v72he::o72_unknownF5() { - int chr, max; - int array, len, pos, result = 0; - max = pop(); - pos = pop(); - array = pop(); - - len = resStrLen(getStringAddress(array)); - - writeVar(0, array); - while (pos <= len) { - chr = readArray(0, 0, pos); - result += _charset->getCharWidth(chr); - if (result >= max) { - push(pos); - return; - } - pos++; - } - - push(len); - debug(1,"stub o72_unknownF5 (%d)", result); -} - -void ScummEngine_v72he::o72_unknownF6() { - int len, edi, pos, value, id; - value = pop(); - edi = pop(); - pos = pop(); - id = pop(); - - if (edi >= 0) { - len = resStrLen(getStringAddress(id)); - if (len < edi) - edi = len; - } else { - edi = 0; - } - - if (pos < 0) - pos = 0; - - writeVar(0, id); - if (edi > pos) { - while (edi >= pos) { - if (readArray(0, 0, pos) == value) { - push(pos); - return; - } - pos++; - } - } else { - while (edi <= pos) { - if (readArray(0, 0, pos) == value) { - push(pos); - return; - } - pos--; - } - } - - push(-1); - debug(1,"stub o72_unknownF6"); -} - void ScummEngine_v72he::o72_getResourceSize() { int size = 0, type; diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 8c45d57d7c..791cfefc52 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -347,7 +347,7 @@ void ScummEngine_v70he::setupOpcodes() { OPCODE(o70_unknownEF), /* F0 */ OPCODE(o6_invalid), - OPCODE(o6_invalid), + OPCODE(o70_unknownF1), OPCODE(o6_invalid), OPCODE(o70_readINI), /* F4 */ @@ -761,6 +761,48 @@ void ScummEngine_v70he::o70_unknownEF() { debug(1,"stub o70_unknownEF"); } +void ScummEngine_v70he::o70_unknownF1() { + byte *addr, *addr2; + int i = 0; + + int id = pop(); + int id2 = pop(); + + addr = getStringAddress(id); + if (!addr) + error("o72_stringLen: Reference to zeroed array pointer (%d)", id); + + addr2 = getStringAddress(id2); + if (!addr) + error("o72_stringLen: Reference to zeroed array pointer (%d)", id); + + while(1) { + if (*addr != *addr2) + break; + if (*addr == 0) { + push(0); + return; + } + + addr++; + addr2++; + + if (*addr != *addr2) + break; + if (*addr == 0) { + push(0); + return; + } + + addr++; + addr2++; + i += 2; + } + + push (i); + debug(1,"o70_unknownF1 stub (%d, %d, %d)", id, id2, i); +} + void ScummEngine_v70he::o70_readINI() { int len; int type; diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 731138d035..45c885b55c 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -147,7 +147,7 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o72_unknown50), OPCODE(o6_invalid), OPCODE(o72_findObjectWithClassOf), - OPCODE(o72_wordArrayInc), + OPCODE(o6_wordArrayInc), /* 54 */ OPCODE(o72_getObjectImageX), OPCODE(o72_getObjectImageY), @@ -157,7 +157,7 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o72_getTimer), OPCODE(o72_setTimer), OPCODE(o72_unknown5A), - OPCODE(o72_wordArrayDec), + OPCODE(o6_wordArrayDec), /* 5C */ OPCODE(o6_if), OPCODE(o6_ifNot), @@ -340,18 +340,18 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o60_readFilePos), /* EC */ OPCODE(o72_unknownEC), - OPCODE(o72_unknownED), + OPCODE(o70_unknownED), OPCODE(o70_stringLen), OPCODE(o72_unknownEF), /* F0 */ OPCODE(o72_unknownF0), - OPCODE(o72_unknownF1), + OPCODE(o70_unknownF1), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), /* F4 */ OPCODE(o72_writeINI), - OPCODE(o72_unknownF5), - OPCODE(o72_unknownF6), + OPCODE(o70_unknownF5), + OPCODE(o70_unknownF6), OPCODE(o6_invalid), /* F8 */ OPCODE(o72_getResourceSize), diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index c2f3be8cea..f9ce4ce817 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -147,7 +147,7 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o72_unknown50), OPCODE(o6_invalid), OPCODE(o72_findObjectWithClassOf), - OPCODE(o72_wordArrayInc), + OPCODE(o6_wordArrayInc), /* 54 */ OPCODE(o72_getObjectImageX), OPCODE(o72_getObjectImageY), @@ -157,7 +157,7 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o72_getTimer), OPCODE(o72_setTimer), OPCODE(o72_unknown5A), - OPCODE(o72_wordArrayDec), + OPCODE(o6_wordArrayDec), /* 5C */ OPCODE(o6_if), OPCODE(o6_ifNot), @@ -340,18 +340,18 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o60_readFilePos), /* EC */ OPCODE(o72_unknownEC), - OPCODE(o72_unknownED), + OPCODE(o70_unknownED), OPCODE(o70_stringLen), OPCODE(o72_unknownEF), /* F0 */ OPCODE(o72_unknownF0), - OPCODE(o72_unknownF1), + OPCODE(o70_unknownF1), OPCODE(o72_checkGlobQueue), OPCODE(o72_readINI), /* F4 */ OPCODE(o72_writeINI), - OPCODE(o72_unknownF5), - OPCODE(o72_unknownF6), + OPCODE(o70_unknownF5), + OPCODE(o70_unknownF6), OPCODE(o6_invalid), /* F8 */ OPCODE(o72_getResourceSize), -- cgit v1.2.3