diff options
| -rw-r--r-- | scumm/intern.h | 5 | ||||
| -rw-r--r-- | scumm/script_v100he.cpp | 133 | ||||
| -rw-r--r-- | scumm/script_v6.cpp | 10 | ||||
| -rw-r--r-- | scumm/script_v6he.cpp | 10 | ||||
| -rw-r--r-- | scumm/script_v72he.cpp | 44 | ||||
| -rw-r--r-- | scumm/script_v7he.cpp | 33 | ||||
| -rw-r--r-- | scumm/script_v80he.cpp | 2 | ||||
| -rw-r--r-- | scumm/scumm.cpp | 2 |
8 files changed, 154 insertions, 85 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 6d36f711f5..3d9662fccf 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -612,7 +612,7 @@ protected: Win32ResExtractor *_win32ResExtractor; - int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndLoop; + int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndFlags; public: ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); @@ -909,6 +909,8 @@ protected: const char *desc; }; + int _heResId, _heResType; + const OpcodeEntryV100he *_opcodesV100he; public: @@ -938,6 +940,7 @@ protected: void o100_quitPauseRestart(); void o100_cursorCommand(); void o100_wait(); + void o100_getResourceSize(); void o100_unknown27(); void o100_getPaletteData(); void o100_unknown25(); diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp index 79b6e617c9..0b796a8cce 100644 --- a/scumm/script_v100he.cpp +++ b/scumm/script_v100he.cpp @@ -272,7 +272,7 @@ void ScummEngine_v100he::setupOpcodes() { OPCODE(o72_getNumFreeArrays), OPCODE(o72_getArrayDimSize), OPCODE(o72_checkGlobQueue), - OPCODE(o72_getResourceSize), + OPCODE(o100_getResourceSize), /* B8 */ OPCODE(o100_unknown27), OPCODE(o6_invalid), @@ -381,11 +381,11 @@ void ScummEngine_v100he::o100_actorOps() { Actor *a; int i, j, k; int args[32]; - byte b; + byte subOp; byte string[256]; - b = fetchScriptByte(); - if (b == 129) { + subOp = fetchScriptByte(); + if (subOp == 129) { _curActor = pop(); return; } @@ -394,7 +394,7 @@ void ScummEngine_v100he::o100_actorOps() { if (!a) return; - switch (b) { + switch (subOp) { case 3: pop(); pop(); @@ -574,7 +574,7 @@ void ScummEngine_v100he::o100_actorOps() { a->_walkFrame = pop(); break; default: - error("o100_actorOps: default case %d", b); + error("o100_actorOps: default case %d", subOp); } } @@ -890,43 +890,59 @@ void ScummEngine_v100he::o100_unknown28() { void ScummEngine_v100he::o100_resourceRoutines() { // Incomplete - int resid, op; - op = fetchScriptByte(); + int obj, room; - switch (op) { + byte subOp = fetchScriptByte(); + + switch (subOp) { case 14: - // charset - resid = pop(); + _heResType = rtCharset; + _heResId = pop(); break; case 25: - // costume - resid = pop(); + _heResType = rtCostume; + _heResId = pop(); break; case 34: - // flobject - resid = pop(); + _heResType = rtFlObject; + _heResId = pop(); break; case 40: - // image - resid = pop(); + _heResType = rtImage; + _heResId = pop(); + break; + case 47: + if (_heResType == rtFlObject) { + obj = _heResId; + room= getObjectRoom(obj); + loadFlObject(obj, room); + } else if (_heResType == rtCharset) { + loadCharset(_heResId); + } break; case 62: - // room - resid = pop(); + _heResType = rtRoom; + _heResId = pop(); break; case 66: - // script - resid = pop(); + _heResType = rtScript; + _heResId = pop(); break; case 72: - // sound - resid = pop(); + _heResType = rtSound; + _heResId = pop(); break; case 128: - // lock + // lock? + break; + case 133: + if (_heResType == rtCharset) + nukeCharset(_heResId); + else + nukeResource(_heResType, _heResId); break; default: - debug(1,"o100_resourceRoutines: default case %d", op); + debug(1,"o100_resourceRoutines: default case %d", subOp); } } @@ -947,6 +963,15 @@ void ScummEngine_v100he::o100_wizImageOps() { _wizParams.img.y1 = pop(); _wizParams.img.x1 = pop(); break; + case 11: + _wizParams.processFlags |= 0x300; + _wizParams.processMode = 2; + _wizParams.box.bottom = pop(); + _wizParams.box.right = pop(); + _wizParams.box.top = pop(); + _wizParams.box.left = pop(); + _wizParams.unk_148 = pop(); + break; case 29: _wizParams.processMode = 1; break; @@ -1180,29 +1205,28 @@ void ScummEngine_v100he::o100_roomOps() { } void ScummEngine_v100he::o100_startSound() { - byte op; - op = fetchScriptByte(); + byte subOp = fetchScriptByte(); - switch (op) { + switch (subOp) { case 6: - _heSndLoop |= 16; + _heSndFlags |= 16; pop(); break; case 92: _sound->addSoundToQueue(_heSndSoundId, _heSndOffset); break; case 128: - _heSndLoop |= 2; + _heSndFlags |= 2; break; case 129: _heSndChannel = pop(); break; case 130: - _heSndLoop |= 40; + _heSndFlags |= 40; pop(); break; case 131: - _heSndLoop |= 4; + _heSndFlags |= 4; break; case 132: case 134: @@ -1212,18 +1236,18 @@ void ScummEngine_v100he::o100_startSound() { _heSndChannel = VAR(VAR_MUSIC_CHANNEL); break; case 133: - _heSndLoop |= 80; + _heSndFlags |= 80; pop(); break; case 135: - _heSndLoop |= 4; + _heSndFlags |= 4; break; case 136: - _heSndLoop |= 20; + _heSndFlags |= 20; pop(); break; default: - error("o100_startSound invalid case %d", op); + error("o100_startSound invalid case %d", subOp); } } @@ -1449,6 +1473,43 @@ void ScummEngine_v100he::o100_wait() { o6_breakHere(); } +void ScummEngine_v100he::o100_getResourceSize() { + int size = 0, type; + + int idx = pop(); + byte subOp = fetchScriptByte(); + + switch (subOp) { + case 25: + type = rtCostume; + break; + case 40: + type = rtImage; + break; + case 62: + type = rtRoomImage; + break; + case 66: + type = rtScript; + break; + case 72: + if (idx > _numSounds) { + // TODO Music resource size + push(100); + return; + } + type = rtSound; + break; + default: + error("o100_getResourceSize: default type %d", subOp); + } + + const byte *ptr = getResourceAddress(type, idx); + if (ptr) + size = READ_BE_UINT32(ptr + 4) - 8; + push(size); +} + void ScummEngine_v100he::o100_unknown27() { byte subOp = fetchScriptByte(); switch (subOp) { diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 5c9fce7ec9..b02cd0e484 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1765,10 +1765,10 @@ void ScummEngine_v6::o6_actorOps() { Actor *a; int i, j, k; int args[8]; - byte b; + byte subOp; - b = fetchScriptByte(); - if (b == 197) { + subOp = fetchScriptByte(); + if (subOp == 197) { _curActor = pop(); return; } @@ -1777,7 +1777,7 @@ void ScummEngine_v6::o6_actorOps() { if (!a) return; - switch (b) { + switch (subOp) { case 76: // SO_COSTUME a->setActorCostume(pop()); break; @@ -1911,7 +1911,7 @@ void ScummEngine_v6::o6_actorOps() { a->talkScript = pop(); break; default: - error("o6_actorOps: default case %d", b); + error("o6_actorOps: default case %d", subOp); } } diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 245ac464a0..e6119506ed 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -595,10 +595,10 @@ void ScummEngine_v60he::o60_actorOps() { Actor *a; int i, j, k; int args[8]; - byte b; + byte subOp; - b = fetchScriptByte(); - if (b == 197) { + subOp = fetchScriptByte(); + if (subOp == 197) { _curActor = pop(); return; } @@ -607,7 +607,7 @@ void ScummEngine_v60he::o60_actorOps() { if (!a) return; - switch (b) { + switch (subOp) { case 30: // _heversion >= 70 _actorClipOverride.bottom = pop(); @@ -762,7 +762,7 @@ void ScummEngine_v60he::o60_actorOps() { break; } default: - error("o60_actorOps: default case %d", b); + error("o60_actorOps: default case %d", subOp); } } diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 8efe5e3135..eb7c85c12b 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -846,7 +846,7 @@ void ScummEngine_v72he::o72_startObject() { } void ScummEngine_v72he::o72_drawObject() { - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); int state = 0, y = -1, x = -1; switch (subOp) { @@ -895,7 +895,7 @@ void ScummEngine_v72he::o72_printWizImage() { } void ScummEngine_v72he::o72_getArrayDimSize() { - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); int32 val1, val2; ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(fetchScriptWord())); if (!ah) { @@ -1047,11 +1047,11 @@ void ScummEngine_v72he::o72_actorOps() { Actor *a; int i, j, k; int args[32]; - byte b; + byte subOp; byte string[256]; - b = fetchScriptByte(); - if (b == 197) { + subOp = fetchScriptByte(); + if (subOp == 197) { _curActor = pop(); return; } @@ -1060,7 +1060,7 @@ void ScummEngine_v72he::o72_actorOps() { if (!a) return; - switch (b) { + switch (subOp) { case 21: // HE 80+ k = getStackList(args, ARRAYSIZE(args)); for (i = 0; i < k; ++i) { @@ -1245,7 +1245,7 @@ void ScummEngine_v72he::o72_actorOps() { break; } default: - error("o72_actorOps: default case %d", b); + error("o72_actorOps: default case %d", subOp); } } @@ -1995,7 +1995,7 @@ int ScummEngine_v72he::readFileToArray(int slot, int32 size) { void ScummEngine_v72he::o72_readFile() { int slot, val; int32 size; - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); switch (subOp) { case 4: @@ -2037,7 +2037,7 @@ void ScummEngine_v72he::writeFileFromArray(int slot, int resID) { void ScummEngine_v72he::o72_writeFile() { int16 resID = pop(); int slot = pop(); - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); switch (subOp) { case 4: @@ -2092,12 +2092,10 @@ void ScummEngine_v72he::o72_deleteFile() { void ScummEngine_v72he::o72_getPixel() { byte area; + int x = pop(); int y = pop(); - int subOp = fetchScriptByte(); - - if (subOp != 218 && subOp != 219) - return; + byte subOp = fetchScriptByte(); VirtScreen *vs = findVirtScreen(y); if (vs == NULL || x > _screenWidth - 1 || x < 0) { @@ -2105,10 +2103,16 @@ void ScummEngine_v72he::o72_getPixel() { return; } - if (subOp == 218) + switch (subOp) { + case 218: area = *vs->getBackPixels(x, y - vs->topline); - else + break; + case 219: area = *vs->getPixels(x, y - vs->topline); + break; + default: + error("o72_getPixel: default case %d", subOp); + } push(area); } @@ -2155,12 +2159,12 @@ void ScummEngine_v72he::o72_pickVarRandom() { } void ScummEngine_v72he::o72_redimArray() { - int subcode, newX, newY; + int newX, newY; newY = pop(); newX = pop(); - subcode = fetchScriptByte(); - switch (subcode) { + byte subOp = fetchScriptByte(); + switch (subOp) { case 5: redimArray(fetchScriptWord(), 0, newX, 0, newY, kIntArray); break; @@ -2171,7 +2175,7 @@ void ScummEngine_v72he::o72_redimArray() { redimArray(fetchScriptWord(), 0, newX, 0, newY, kDwordArray); break; default: - error("o72_redimArray: default type %d", subcode); + error("o72_redimArray: default type %d", subOp); } } @@ -2321,7 +2325,7 @@ void ScummEngine_v72he::o72_unknownF1() { } void ScummEngine_v72he::o72_checkGlobQueue() { - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); int idx = pop(); debug(1,"o72_checkGlobQueue stub (%d, %d)", subOp, idx); diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 31c648fa5c..24c75858b0 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -405,21 +405,20 @@ void ScummEngine_v70he::arrrays_unk2(int dst, int src, int len2, int len) { } void ScummEngine_v70he::o70_startSound() { - byte op; - op = fetchScriptByte(); + byte subOp = fetchScriptByte(); - switch (op) { + switch (subOp) { case 9: - _heSndLoop |= 4; + _heSndFlags |= 4; break; case 23: debug(1,"o70_startSound: case 29 (%d, %d, %d)", pop(), pop(), pop()); break; case 56: - _heSndLoop |= 2; + _heSndFlags |= 2; break; case 164: - _heSndLoop |= 2; + _heSndFlags |= 2; break; case 224: _heSndSoundFreq = pop(); @@ -441,18 +440,18 @@ void ScummEngine_v70he::o70_startSound() { break; case 245: - _heSndLoop |= 1; + _heSndFlags |= 1; break; case 255: - // _sound->addSoundToQueue(_heSndSoundId, _heSndOffset, _heSndChannel, _heSndLoop); + // _sound->addSoundToQueue(_heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags); _sound->addSoundToQueue(_heSndSoundId, _heSndOffset); - debug(2, "o70_startSound stub (%d, %d, %d, %d)", _heSndSoundId, _heSndOffset, _heSndChannel, _heSndLoop); - _heSndLoop = 0; + debug(2, "o70_startSound stub (%d, %d, %d, %d)", _heSndSoundId, _heSndOffset, _heSndChannel, _heSndFlags); + _heSndFlags = 0; break; default: - error("o70_startSound invalid case %d", op); + error("o70_startSound invalid case %d", subOp); } } @@ -618,7 +617,7 @@ void ScummEngine_v70he::o70_quitPauseRestart() { byte subOp = fetchScriptByte(); int par1; - switch (subOp & 0xff) { + switch (subOp) { case 22: // HE80+ clearDrawObjectQueue(); break; @@ -909,13 +908,13 @@ void ScummEngine_v70he::o70_unknownFA() { } void ScummEngine_v70he::o70_polygonOps() { - byte b; - b = fetchScriptByte(); int vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; int id; int fromId, toId; - switch (b) { + byte subOp = fetchScriptByte(); + + switch (subOp) { case 68: // HE 100 case 69: // HE 100 case 246: @@ -930,7 +929,7 @@ void ScummEngine_v70he::o70_polygonOps() { vert1x = pop(); id = pop(); - polygonStore(id, (b == 69 || b == 248), vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, + polygonStore(id, (subOp == 69 || subOp == 248), vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); break; case 28: // HE 100 @@ -940,6 +939,8 @@ void ScummEngine_v70he::o70_polygonOps() { polygonErase(fromId, toId); break; + default: + error("o70_polygonOps: default case %d", subOp); } } diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 33a14c975d..331589d93c 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -500,7 +500,7 @@ void ScummEngine_v80he::o80_writeConfigFile() { void ScummEngine_v80he::o80_cursorCommand() { int a, i; int args[16]; - int subOp = fetchScriptByte(); + byte subOp = fetchScriptByte(); switch (subOp) { case 0x13: // Loads cursors from another resource diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 4e4300e46a..18080a55a3 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1011,7 +1011,7 @@ ScummEngine_v70he::ScummEngine_v70he(GameDetector *detector, OSystem *syst, cons _heSndSoundId = 0; _heSndOffset = 0; _heSndChannel = 0; - _heSndLoop = 0; + _heSndFlags = 0; _heSndSoundFreq = 0; } |
