Merge two opcode, move two opcodes back to HE70.

svn-id: r16731
This commit is contained in:
Travis Howell 2005-02-02 12:05:00 +00:00
parent 8e9b6da08d
commit cc708339ea
6 changed files with 63 additions and 83 deletions

View File

@ -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();

View File

@ -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),

View File

@ -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();

View File

@ -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;

View File

@ -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),

View File

@ -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),