diff options
author | Travis Howell | 2004-02-07 02:52:27 +0000 |
---|---|---|
committer | Travis Howell | 2004-02-07 02:52:27 +0000 |
commit | 86394f45427ebe346c3ec46dd2a5deb4373985f8 (patch) | |
tree | 0f0559e99ccb7cc24ec41bfe1838fc52e4804850 /scumm | |
parent | 3a8bfbeeb159b7c1230c46d4b3d5371c256ac65d (diff) | |
download | scummvm-rg350-86394f45427ebe346c3ec46dd2a5deb4373985f8.tar.gz scummvm-rg350-86394f45427ebe346c3ec46dd2a5deb4373985f8.tar.bz2 scummvm-rg350-86394f45427ebe346c3ec46dd2a5deb4373985f8.zip |
Clean up last commit.
svn-id: r12754
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 18 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 287 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 59 |
3 files changed, 44 insertions, 320 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 33b3450058..cc42c1bd2e 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -326,8 +326,6 @@ protected: const OpcodeEntryV6 *_opcodesV6; - File _hFileTable[17]; - public: ScummEngine_v6(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs) : ScummEngine(detector, syst, gs) { VAR_VIDEONAME = 0xFF; @@ -364,9 +362,6 @@ protected: void writeArray(int array, int index, int base, int value); void shuffleArray(int num, int minIdx, int maxIdx); - void unknownEA_func(int a, int b, int c, int d, int e); - int readFileToArray(int slot, int32 size); - void writeFileFromArray(int slot, int resID); /* Version 6 script opcodes */ void o6_setBlastObjectWindow(); @@ -522,23 +517,12 @@ protected: void o6_bor(); void o6_band(); void o6_stopTalking(); - void o6_openFile(); - void o6_closeFile(); - void o6_deleteFile(); - void o6_readFile(); - void o6_rename(); - void o6_writeFile(); void o6_findAllObjects(); void o6_pickVarRandom(); void o6_getDateTime(); - void o6_unknownE0(); void o6_unknownE1(); void o6_unknownE4(); - void o6_localizeArray(); void o6_shuffle(); - void o6_unknownFA(); - void o6_unknownEA(); - void o6_readINI(); byte VAR_VIDEONAME; byte VAR_RANDOM_NR; @@ -582,6 +566,8 @@ protected: /* Version 6 script opcodes */ void o6_drawBlastObject(); void o6_setBlastObjectWindow(); + void o6_setState(); + void o6_startSound(); void o6_roomOps(); void o6_actorOps(); void o6_verbOps(); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 60f15a321b..9ea17fd993 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -320,18 +320,18 @@ void ScummEngine_v6::setupOpcodes() { OPCODE(o6_bor), /* D8 */ OPCODE(o6_isRoomScriptRunning), - OPCODE(o6_closeFile), - OPCODE(o6_openFile), - OPCODE(o6_readFile), + OPCODE(o6_invalid), + OPCODE(o6_invalid), + OPCODE(o6_invalid), /* DC */ - OPCODE(o6_writeFile), + OPCODE(o6_invalid), OPCODE(o6_findAllObjects), - OPCODE(o6_deleteFile), - OPCODE(o6_rename), + OPCODE(o6_invalid), + OPCODE(o6_invalid), /* E0 */ - OPCODE(o6_unknownE0), + OPCODE(o6_invalid), OPCODE(o6_unknownE1), - OPCODE(o6_localizeArray), + OPCODE(o6_invalid), OPCODE(o6_pickVarRandom), /* E4 */ OPCODE(o6_unknownE4), @@ -341,7 +341,7 @@ void ScummEngine_v6::setupOpcodes() { /* E8 */ OPCODE(o6_invalid), OPCODE(o6_invalid), - OPCODE(o6_unknownEA), + OPCODE(o6_invalid), OPCODE(o6_invalid), /* EC */ OPCODE(o6_getActorLayer), @@ -352,7 +352,7 @@ void ScummEngine_v6::setupOpcodes() { OPCODE(o6_invalid), OPCODE(o6_invalid), OPCODE(o6_invalid), - OPCODE(o6_readINI), + OPCODE(o6_invalid), /* F4 */ OPCODE(o6_invalid), OPCODE(o6_invalid), @@ -361,7 +361,7 @@ void ScummEngine_v6::setupOpcodes() { /* F8 */ OPCODE(o6_invalid), OPCODE(o6_invalid), - OPCODE(o6_unknownFA), + OPCODE(o6_invalid), OPCODE(o6_invalid), /* FC */ OPCODE(o6_invalid), @@ -1011,12 +1011,6 @@ void ScummEngine_v6::o6_setState() { int state = pop(); int obj = pop(); - if ((_features & GF_HUMONGOUS) && (state & 0x8000)) { - state = state & 0x7F00; - putState(obj, state); - return; - } - putState(obj, state); markObjectRectAsDirty(obj); if (_BgNeedsRedraw) @@ -1064,9 +1058,6 @@ void ScummEngine_v6::o6_getOwner() { } void ScummEngine_v6::o6_startSound() { - if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO)) - pop(); // offset which seems to always be zero - if (_features & GF_DIGI_IMUSE) _imuseDigital->startSfx(pop()); else @@ -1838,10 +1829,7 @@ void ScummEngine_v6::o6_actorOps() { j = pop(); i = pop(); checkRange(255, 0, i, "Illegal palette slot %d"); - if ((_features & GF_HUMONGOUS) && (_gameId != GID_PUTTDEMO)) - a->remapActorPaletteColor(i, j); - else - a->setPalette(i, j); + a->setPalette(i, j); break; case 87: // SO_TALK_COLOR a->talkColor = pop(); @@ -1987,8 +1975,6 @@ void ScummEngine_v6::o6_verbOps() { if (_curVerbSlot) { setVerbObject(_roomResource, a, slot); vs->type = kImageVerbType; - if (_features & GF_HUMONGOUS) - vs->imgindex = a; } break; case 125: // SO_VERB_NAME @@ -2013,8 +1999,6 @@ void ScummEngine_v6::o6_verbOps() { vs->curmode = 0; break; case 131: // SO_VERB_DELETE - if (_features & GF_HUMONGOUS) - slot = getVerbSlot(pop(), 0); killVerb(slot); break; case 132: // SO_VERB_NEW @@ -2446,8 +2430,6 @@ void ScummEngine_v6::o6_dimArray() { void ScummEngine_v6::o6_dummy() { /* nothing */ - if (_features & GF_HUMONGOUS) - stopObjectCode(); } void ScummEngine_v6::o6_dim2dimArray() { @@ -2986,28 +2968,9 @@ void ScummEngine_v6::o6_stampObject() { int object, x, y, state; // dummy opcode in tentacle - if (_gameId == GID_TENTACLE) + if (_version == 6) return; - // V6 version - if (_version == 6) { - state = pop(); - if (state == 0) { - state = 1; - } - y = pop(); - x = pop(); - object = pop(); - int objnum = getObjectIndex(object); - if (objnum == -1) - return; - _objs[objnum].x_pos = x * 8; - _objs[objnum].y_pos = y * 8; - putState(object, state); - drawObject(objnum, 0); - return; - } - // V7 version state = pop(); y = pop(); @@ -3043,153 +3006,6 @@ void ScummEngine_v6::o6_stopTalking() { stopTalk(); } -// Humongous Entertainment games only -void ScummEngine_v6::o6_openFile() { - int mode, len, slot, l, r; - byte filename[100]; - - _msgPtrToAdd = filename; - _messagePtr = _scriptPointer; - addMessageToStack(_messagePtr); - - len = resStrLen(_scriptPointer); - _scriptPointer += len + 1; - - for (r = strlen((char*)filename); r != 0; r--) { - if (filename[r - 1] == '\\') - break; - } - - mode = pop(); - slot = -1; - for (l = 0; l < 17; l++) { - if (_hFileTable[l].isOpen() == false) { - slot = l; - break; - } - } - - if (slot != -1) { - if (mode == 1) - _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileReadMode); - else if (mode == 2) - _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileWriteMode); - else - error("o6_openFile(): wrong open file mode"); - - warning("%d = o6_openFile(\"%s\", %d)", slot, filename + r, mode); - } - push(slot); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_closeFile() { - int slot = pop(); - _hFileTable[slot].close(); - warning("o6_closeFile(%d)", slot); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_deleteFile() { - int len, r; - byte filename[100]; - - _msgPtrToAdd = filename; - _messagePtr = _scriptPointer; - addMessageToStack(_messagePtr); - - len = resStrLen(_scriptPointer); - _scriptPointer += len + 1; - - for (r = strlen((char*)filename); r != 0; r--) { - if (filename[r - 1] == '\\') - break; - } - - warning("stub o6_deleteFile(\"%s\")", filename + r); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_rename() { - int len, r1, r2; - byte filename[100],filename2[100]; - - _msgPtrToAdd = filename; - _messagePtr = _scriptPointer; - addMessageToStack(_messagePtr); - - len = resStrLen(_scriptPointer); - _scriptPointer += len + 1; - - for (r1 = strlen((char*)filename); r1 != 0; r1--) { - if (filename[r1 - 1] == '\\') - break; - } - - _msgPtrToAdd = filename2; - _messagePtr = _scriptPointer; - addMessageToStack(_messagePtr); - - len = resStrLen(_scriptPointer); - _scriptPointer += len + 1; - - for (r2 = strlen((char*)filename2); r2 != 0; r2--) { - if (filename2[r2 - 1] == '\\') - break; - } - - warning("stub o6_rename(\"%s\" to \"%s\")", filename + r1, filename2 + r2); -} - -int ScummEngine_v6::readFileToArray(int slot, int32 size) { - if (size == 0) - size = _hFileTable[slot].size() - _hFileTable[slot].pos(); - writeVar(0, 0); - defineArray(0, 3, 0, size); - byte *ptr = getResourceAddress(rtString, readVar(0)); - _hFileTable[slot].read(ptr, size); - return readVar(0); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_readFile() { - int32 size = pop(); - int slot = pop(); - - if (size == -2) { - push(_hFileTable[slot].readUint16LE()); - } else if (size == -1) { - push(_hFileTable[slot].readByte()); - } else { - push(readFileToArray(slot, size)); - } - warning("o6_readFile(%d, %d)", slot, size); -} - -void ScummEngine_v6::writeFileFromArray(int slot, int resID) { - byte *ptr = getResourceAddress(rtString, resID); - // FIXME: hack for proper size: / 2 - 5 - int32 size = getResourceSize(rtString, resID) / 2 - 5; - _hFileTable[slot].write(ptr, size); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_writeFile() { - int32 size = pop(); - int16 resID = pop(); - int slot = pop(); - - if (size == -2) { - _hFileTable[slot].writeUint16LE(resID); - } else if (size == -1) { - _hFileTable[slot].writeByte(resID); - } else { - writeFileFromArray(slot, resID); - } - warning("o6_writeFile(%d, %d)", slot, resID); -} - -// Humongous Entertainment games only void ScummEngine_v6::o6_findAllObjects() { int a = pop(); int i = 1; @@ -3326,87 +3142,10 @@ void ScummEngine_v6::o6_unknownE1() { push(area); } -// Humongous Entertainment games only -void ScummEngine_v6::o6_unknownE0() { - int a = fetchScriptByte(); - a -= 222; - if (a != 0) { - a -= 2; - if (a != 0) - return; - warning("o6_unknownE0(%d) stub", pop()); - } else { - warning("o6_uknownE0, sound volume %d stub", pop()); - } -} - -// Humongous Entertainment games only void ScummEngine_v6::o6_unknownE4() { warning("o6_unknownE4(%d) stub", pop()); } -// Humongous Entertainment games only -void ScummEngine_v6::o6_unknownFA() { - int len, a = fetchScriptByte(); - - len = resStrLen(_scriptPointer); - warning("stub o6_unknownFA(%d, \"%s\")", a, _scriptPointer); - _scriptPointer += len + 1; -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_unknownEA() { - int edi, esi, eax; - edi = pop(); - esi = pop(); - - if (edi == 0) { - eax = esi; - esi = edi; - edi = eax; - } - - eax = fetchScriptByte(); - switch (eax) { - case 199: - unknownEA_func(5, esi, edi, fetchScriptWord(), eax); - break; - case 202: - unknownEA_func(3, esi, edi, fetchScriptWord(), eax); - break; - default: - break; - } -} - -void ScummEngine_v6::unknownEA_func(int a, int b, int c, int d, int e) { - // Used in mini game at Cosmic Dust Diner in puttmoon - warning("unknownEA_func(%d, %d, %d, %d, %d) stub", a, b, c, d, e); -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_readINI() { - int len; - - len = resStrLen(_scriptPointer); - warning("stub o6_readINI(\"%s\")", _scriptPointer); - _scriptPointer += len + 1; - pop(); - push(0); - -} - -// Humongous Entertainment games only -void ScummEngine_v6::o6_localizeArray() { - int stringID = pop(); - - if (stringID < _numArray) { - _baseArrays[stringID][0] = (byte)_currentScript; - } else { - warning("o6_localizeArray(%d): too big scriptID", stringID); - } -} - void ScummEngine_v6::decodeParseString(int m, int n) { byte b; diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index a2834922f5..2a3ecd1f01 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -382,6 +382,29 @@ const char *ScummEngine_v6he::getOpcodeDesc(byte i) { return _opcodesV6he[i].desc; } +void ScummEngine_v6he::o6_setState() { + int state = pop(); + int obj = pop(); + + if (state & 0x8000) { + state = state & 0x7F00; + putState(obj, state); + return; + } + + putState(obj, state); + markObjectRectAsDirty(obj); + if (_BgNeedsRedraw) + clearDrawObjectQueue(); +} + +void ScummEngine_v6he::o6_startSound() { + if (_gameId != GID_PUTTDEMO) + pop(); // offset which seems to always be zero + + _sound->addSoundToQueue(pop()); +} + void ScummEngine_v6he::o6_roomOps() { int a, b, c, d, e; byte op; @@ -437,8 +460,6 @@ void ScummEngine_v6he::o6_roomOps() { _saveTemporaryState = true; _saveLoadSlot = pop(); _saveLoadFlag = pop(); - if (_gameId == GID_TENTACLE) - _saveSound = (_saveLoadSlot != 0); break; case 181: // SO_ROOM_FADE @@ -494,17 +515,7 @@ void ScummEngine_v6he::o6_roomOps() { case 213: // SO_ROOM_NEW_PALETTE a = pop(); - - // This opcode is used when turning off noir mode in Sam & Max, - // but since our implementation of this feature doesn't change - // the original palette there's no need to reload it. Doing it - // this way, we avoid some graphics glitches that the original - // interpreter had. - - if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 64) - setDirtyColors(0, 255); - else - setPalette(a); + setPalette(a); break; case 220: a = pop(); @@ -617,19 +628,13 @@ void ScummEngine_v6he::o6_actorOps() { break; case 95: // SO_IGNORE_BOXES a->ignoreBoxes = 1; - if (_version >= 7) - a->forceClip = 100; - else - a->forceClip = 0; + a->forceClip = 0; if (a->isInCurrentRoom()) a->putActor(a->_pos.x, a->_pos.y, a->room); break; case 96: // SO_FOLLOW_BOXES a->ignoreBoxes = 0; - if (_version >= 7) - a->forceClip = 100; - else - a->forceClip = 0; + a->forceClip = 0; if (a->isInCurrentRoom()) a->putActor(a->_pos.x, a->_pos.y, a->room); break; @@ -811,7 +816,7 @@ void ScummEngine_v6he::o6_wait() { offs = fetchScriptWordSigned(); actnum = pop(); a = derefActor(actnum, "o6_wait:168"); - if (a->isInCurrentRoom() && a->moving) + if (a->moving) break; return; case 169: // SO_WAIT_FOR_MESSAGE Wait for message @@ -819,14 +824,8 @@ void ScummEngine_v6he::o6_wait() { break; return; case 170: // SO_WAIT_FOR_CAMERA Wait for camera - if (_version >= 7) { - if (camera._dest != camera._cur) - break; - } else { - if (camera._cur.x / 8 != camera._dest.x / 8) - break; - } - + if (camera._cur.x / 8 != camera._dest.x / 8) + break; return; case 171: // SO_WAIT_FOR_SENTENCE if (_sentenceNum) { |