diff options
-rw-r--r-- | scumm/actor.cpp | 24 | ||||
-rw-r--r-- | scumm/boxes.cpp | 34 | ||||
-rw-r--r-- | scumm/camera.cpp | 12 | ||||
-rw-r--r-- | scumm/charset.cpp | 2 | ||||
-rw-r--r-- | scumm/costume.cpp | 10 | ||||
-rw-r--r-- | scumm/dialogs.cpp | 6 | ||||
-rw-r--r-- | scumm/gfx.cpp | 74 | ||||
-rw-r--r-- | scumm/object.cpp | 92 | ||||
-rw-r--r-- | scumm/player_v2.cpp | 2 | ||||
-rw-r--r-- | scumm/resource.cpp | 32 | ||||
-rw-r--r-- | scumm/resource_v2.cpp | 2 | ||||
-rw-r--r-- | scumm/saveload.cpp | 6 | ||||
-rw-r--r-- | scumm/script.cpp | 38 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v5.cpp | 22 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 38 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 215 | ||||
-rw-r--r-- | scumm/sound.cpp | 6 | ||||
-rw-r--r-- | scumm/string.cpp | 48 | ||||
-rw-r--r-- | scumm/verbs.cpp | 10 |
20 files changed, 338 insertions, 337 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index da008fde61..d5a2d42c8b 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -79,7 +79,7 @@ void Actor::initActor(int mode) { forceClip = 0; ignoreTurns = false; - if (_vm->_features & GF_AFTER_V2) { + if (_vm->_version <= 2) { initFrame = 2; walkFrame = 0; standFrame = 1; @@ -96,7 +96,7 @@ void Actor::initActor(int mode) { walkScript = 0; talkScript = 0; - _vm->_classData[number] = (_vm->_features & GF_AFTER_V7) ? _vm->_classData[0] : 0; + _vm->_classData[number] = (_vm->_version >= 7) ? _vm->_classData[0] : 0; } void Actor::stopActorMoving() { @@ -237,7 +237,7 @@ int Actor::remapDirection(int dir, bool is_walking) { switch (flags & 7) { case 1: - if (_vm->_features & GF_AFTER_V7) { + if (_vm->_version >= 7) { if (dir < 180) return 90; else @@ -249,7 +249,7 @@ int Actor::remapDirection(int dir, bool is_walking) { return (dir == 90) ? 90 : 270; } case 2: - if (_vm->_features & GF_AFTER_V7) { + if (_vm->_version >= 7) { if (dir > 90 && dir < 270) return 180; else @@ -388,7 +388,7 @@ void Actor::setupActorScale() { return; scale = _vm->getScale(walkbox, x, y); - if (_vm->_features & GF_AFTER_V8) { + if (_vm->_version == 8) { // At least in COMI, scale values are clipped to range 1-255 if (scale < 1) scale = 1; @@ -523,7 +523,7 @@ void Actor::animateActor(int anim) { turnToDirection(dir); break; default: - if (_vm->_features & GF_AFTER_V2) + if (_vm->_version <= 2) startAnimActor(anim / 4); else startAnimActor(anim); @@ -759,7 +759,7 @@ void Actor::showActor() { if (costumeNeedsInit) { startAnimActor(initFrame); - if (_vm->_features & GF_AFTER_V2) { + if (_vm->_version <= 2) { startAnimActor(standFrame); startAnimActor(talkStopFrame); } @@ -784,7 +784,7 @@ void Scumm::walkActors() { for (i = 1; i < _numActors; i++) { if (_actors[i].isInCurrentRoom()) - if (_features & GF_AFTER_V2 || _features & GF_AFTER_V3) + if (_version <= 3) _actors[i].walkActorOld(); else _actors[i].walkActor(); @@ -828,7 +828,7 @@ void Scumm::processActors() { // Make a list of all actors in this room for (int i = 1; i < _numActors; i++) { - if ((_features & GF_AFTER_V8) && _actors[i].layer < 0) + if (_version == 8 && _actors[i].layer < 0) continue; if (_actors[i].isInCurrentRoom()) actors[numactors++] = &_actors[i]; @@ -1143,7 +1143,7 @@ void Actor::setActorCostume(int c) { void Actor::startWalkActor(int destX, int destY, int dir) { AdjustBoxResult abr; - if (_vm->_features & GF_AFTER_V2 || _vm->_features & GF_AFTER_V3) { + if (_vm->_version <= 3) { abr.x = destX; abr.y = destY; } else { @@ -1226,7 +1226,7 @@ void Actor::walkActor() { int new_dir, box; int16 foundPathX, foundPathY; - if (_vm->_features & GF_AFTER_V7) { + if (_vm->_version >= 7) { // FIXME - this is kind of a hack right now but it fixes the // walk scripts in The Dig. if (moving & MF_FROZEN) { @@ -1496,7 +1496,7 @@ bool Actor::isInClass(int cls) { } bool Actor::isPlayer() { - if (_vm->_features & GF_AFTER_V2) + if (_vm->_version <= 2) return _vm->VAR(42) <= number && number <= _vm->VAR(43); else return isInClass(kObjectClassPlayer); diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp index bb1b5629ce..6b0e65a06f 100644 --- a/scumm/boxes.cpp +++ b/scumm/boxes.cpp @@ -96,9 +96,9 @@ byte Scumm::getMaskFromBox(int box) { if (!ptr) return 0; - if (_features & GF_AFTER_V8) + if (_version == 8) return (byte) FROM_LE_32(ptr->v8.mask); - else if (_features & GF_AFTER_V2) + else if (_version <= 2) return ptr->v2.mask; else return ptr->old.mask; @@ -114,9 +114,9 @@ void Scumm::setBoxFlags(int box, int val) { } else { Box *ptr = getBoxBaseAddr(box); assert(ptr); - if (_features & GF_AFTER_V8) + if (_version == 8) ptr->v8.flags = TO_LE_32(val); - else if (_features & GF_AFTER_V2) + else if (_version <= 2) ptr->v2.flags = val; else ptr->old.flags = val; @@ -127,9 +127,9 @@ byte Scumm::getBoxFlags(int box) { Box *ptr = getBoxBaseAddr(box); if (!ptr) return 0; - if (_features & GF_AFTER_V8) + if (_version == 8) return (byte) FROM_LE_32(ptr->v8.flags); - else if (_features & GF_AFTER_V2) + else if (_version <= 2) return ptr->v2.flags; else return ptr->old.flags; @@ -138,9 +138,9 @@ byte Scumm::getBoxFlags(int box) { void Scumm::setBoxScale(int box, int scale) { Box *ptr = getBoxBaseAddr(box); assert(ptr); - if (_features & GF_AFTER_V8) + if (_version == 8) ptr->v8.scale = TO_LE_32(scale); - else if (_features & GF_AFTER_V2) + else if (_version <= 2) error("This should not ever be called!"); else ptr->old.scale = TO_LE_16(scale); @@ -160,7 +160,7 @@ int Scumm::getScale(int box, int x, int y) { if (!ptr) return 255; - if (_features & GF_AFTER_V8) { + if (_version == 8) { int slot = FROM_LE_32(ptr->v8.scaleSlot); if (slot) { assert(1 <= slot && slot <= 20); @@ -214,7 +214,7 @@ int Scumm::getBoxScale(int box) { Box *ptr = getBoxBaseAddr(box); if (!ptr) return 255; - if (_features & GF_AFTER_V8) + if (_version == 8) return FROM_LE_32(ptr->v8.scale); else return READ_LE_UINT16(&ptr->old.scale); @@ -224,7 +224,7 @@ byte Scumm::getNumBoxes() { byte *ptr = getResourceAddress(rtMatrix, 2); if (!ptr) return 0; - if (_features & GF_AFTER_V8) + if (_version == 8) return (byte) READ_LE_UINT32(ptr); else return ptr[0]; @@ -247,13 +247,13 @@ Box *Scumm::getBoxBaseAddr(int box) { } else checkRange(ptr[0] - 1, 0, box, "Illegal box %d"); - if (_features & GF_AFTER_V2) + if (_version <= 2) return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1); - else if (_features & GF_AFTER_V3) + else if (_version == 3) return (Box *)(ptr + box * SIZEOF_BOX_V3 + 1); else if (_features & GF_SMALL_HEADER) return (Box *)(ptr + box * SIZEOF_BOX + 1); - else if (_features & GF_AFTER_V8) + else if (_version == 8) return (Box *)(ptr + box * SIZEOF_BOX_V8 + 4); else return (Box *)(ptr + box * SIZEOF_BOX + 2); @@ -327,7 +327,7 @@ void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box) { Box *bp = getBoxBaseAddr(boxnum); assert(bp); - if (_features & GF_AFTER_V8) { + if (_version == 8) { box->ul.x = (short)FROM_LE_32(bp->v8.ulx); box->ul.y = (short)FROM_LE_32(bp->v8.uly); box->ur.x = (short)FROM_LE_32(bp->v8.urx); @@ -359,7 +359,7 @@ void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box) { SWAP(box->ll.x, box->lr.x); SWAP(box->ll.y, box->lr.y); } - } else if (_features & GF_AFTER_V2) { + } else if (_version <= 2) { box->ul.x = bp->v2.ulx * 8; box->ul.y = bp->v2.uy * 2; box->ur.x = bp->v2.urx * 8; @@ -589,7 +589,7 @@ int Scumm::getPathToDestBox(byte from, byte to) { boxm = getBoxMatrixBaseAddr(); - if (_features & GF_AFTER_V2) { + if (_version <= 2) { // The v2 box matrix is a real matrix with numOfBoxes rows and columns. // The first numOfBoxes bytes contain indices to the start of the corresponding // row (although that seems unnecessary to me - the value is easily computable. diff --git a/scumm/camera.cpp b/scumm/camera.cpp index 4f027e3a75..6a51c0dfec 100644 --- a/scumm/camera.cpp +++ b/scumm/camera.cpp @@ -26,7 +26,7 @@ #include "charset.h" void Scumm::setCameraAtEx(int at) { - if (!(_features & GF_AFTER_V7)) { + if (!(_features & GF_NEW_CAMERA)) { camera._mode = CM_NORMAL; camera._cur.x = at; setCameraAt(at, 0); @@ -47,7 +47,7 @@ void Scumm::setCameraAt(int pos_x, int pos_y) { camera._cur.x = (short) VAR(VAR_CAMERA_MAX_X); if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT)) { - if (_features & GF_AFTER_V2) + if (_version <= 2) VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8; else VAR(VAR_CAMERA_POS_X) = camera._cur.x; @@ -217,7 +217,7 @@ void Scumm::moveCamera() { cameraMoved(); if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT) && pos != camera._cur.x) { - if (_features & GF_AFTER_V2) + if (_version <= 2) VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8; else VAR(VAR_CAMERA_POS_X) = camera._cur.x; @@ -311,7 +311,7 @@ void Scumm_v7::moveCamera() { void Scumm::cameraMoved() { - if (_features & GF_AFTER_V7) { + if (_features & GF_NEW_CAMERA) { assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2)); } else { if (camera._cur.x < (_screenWidth / 2)) { @@ -325,7 +325,7 @@ void Scumm::cameraMoved() { _screenEndStrip = _screenStartStrip + gdi._numStrips - 1; _screenTop = camera._cur.y - (_screenHeight / 2); - if (_features & GF_AFTER_V7) { + if (_features & GF_NEW_CAMERA) { _screenLeft = camera._cur.x - (_screenWidth / 2); } else { _screenLeft = _screenStartStrip << 3; @@ -351,7 +351,7 @@ void Scumm_v7::panCameraTo(int x, int y) { } void Scumm::actorFollowCamera(int act) { - if (!(_features & GF_AFTER_V7)) { + if (!(_features & GF_NEW_CAMERA)) { int old; /* mi1 compatibilty */ diff --git a/scumm/charset.cpp b/scumm/charset.cpp index 06cfb19f7a..e9b7a6ec46 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -56,7 +56,7 @@ void CharsetRendererCommon::setCurID(byte id) { if (_fontPtr == 0) error("CharsetRendererCommon::setCurID: charset %d not found!\n", id); - if (_vm->_features & GF_AFTER_V4) + if (_vm->_version == 4) _fontPtr += 17; else _fontPtr += 29; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 90f7dbec3d..b0daf2ca3d 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -401,7 +401,7 @@ void CostumeRenderer::proc3_ami() { void LoadedCostume::loadCostume(int id) { _ptr = _vm->getResourceAddress(rtCostume, id); - if (_vm->_features & GF_AFTER_V6) + if (_vm->_version >= 6) _ptr += 8; else if (_vm->_features & GF_OLD_BUNDLE) _ptr += -2; @@ -522,7 +522,7 @@ void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) { i = 0; do { if (mask & 0x8000) { - if ((_features & GF_AFTER_V3) || (_features & GF_AFTER_V2)) { + if (_version <= 3) { j = *r++; if (j == 0xFF) @@ -575,7 +575,7 @@ void CostumeRenderer::setPalette(byte *palette) { } _palette[_loaded._ptr[8]] = _palette[0]; } else { - if ((_vm->_features & GF_AFTER_V6) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) { + if ((_vm->_features & GF_NEW_OPCODES) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) { for (i = 0; i < _loaded._numColors; i++) { color = palette[i]; if (color == 255) @@ -621,7 +621,7 @@ byte LoadedCostume::increaseAnim(Actor *a, int slot) { end = a->cost.end[slot]; code = _dataptr[i] & 0x7F; - if (_vm->_features & GF_AFTER_V2 || _vm->_features & GF_AFTER_V3) { + if (_vm->_version <= 3) { if (_dataptr[i] & 0x80) a->cost.soundCounter++; } @@ -641,7 +641,7 @@ byte LoadedCostume::increaseAnim(Actor *a, int slot) { if (a->cost.start[slot] != end) continue; } else { - if (_vm->_features & GF_AFTER_V6) { + if (_vm->_version >= 6) { if (nc >= 0x71 && nc <= 0x78) { _vm->_sound->addSoundToQueue2(a->sound[nc - 0x71]); if (a->cost.start[slot] != end) diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index d6a7e08d01..1b5b73483e 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -176,11 +176,11 @@ const ScummVM::String ScummDialog::queryResString(int stringno) { if (stringno == 0) return String(); - if (_scumm->_features & GF_AFTER_V7) + if (_scumm->_version >= 7) result = _scumm->getStringAddressVar(string_map_table_v7[stringno - 1].num); - else if (_scumm->_features & GF_AFTER_V6) + else if (_scumm->_version == 6) result = _scumm->getStringAddressVar(string_map_table_v6[stringno - 1].num); - else if (_scumm->_features & GF_AFTER_V5) + else if (_scumm->_version == 5) result = _scumm->getStringAddress(string_map_table_v5[stringno - 1].num); else // TODO: For V8 games, maybe grab the strings from the language file? diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 8a5fc45bc7..6076664030 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -211,7 +211,7 @@ void Scumm::getGraphicsPerformance() { if (VAR_PERFORMANCE_2 != 0xFF) // Variable is reserved for game scripts in earlier games VAR(VAR_PERFORMANCE_2) = 0; - if (_features & GF_AFTER_V7) + if (_version >= 7) initScreens(0, 0, _screenWidth, _screenHeight); else initScreens(0, 16, _screenWidth, 144); @@ -226,7 +226,7 @@ void Scumm::initScreens(int a, int b, int w, int h) { } if (!getResourceAddress(rtBuffer, 4)) { - if (_features & GF_AFTER_V7) { + if (_version >= 7) { initVirtScreen(3, 0, (_screenHeight / 2) - 10, _screenWidth, 13, false, false); } else { initVirtScreen(3, 0, 80, _screenWidth, 13, false, false); @@ -249,8 +249,8 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, assert(height >= 0); assert(slot >= 0 && slot < 4); - if (_features & GF_AFTER_V7) { - if ((!slot) && (_roomHeight != 0)) + if (_version >= 7) { + if (slot == 0 && (_roomHeight != 0)) height = _roomHeight; } @@ -266,7 +266,7 @@ void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, vs->backBuf = NULL; if (vs->scrollable) { - if (_features & GF_AFTER_V7) { + if (_version >= 7) { size += _screenWidth * 8; } else { size += _screenWidth * 4; @@ -316,7 +316,7 @@ void Scumm::updateDirtyRect(int virt, int left, int right, int top, int bottom, lp = (left >> 3) + _screenStartStrip; if (lp < 0) lp = 0; - if (_features & GF_AFTER_V7) { + if (_version >= 7) { #ifdef V7_SMOOTH_SCROLLING_HACK rp = (right + vs->xstart) >> 3; #else @@ -359,10 +359,10 @@ void Scumm::drawDirtyScreenParts() { byte *src; updateDirtyScreen(2); - if (_features & GF_AFTER_V2 || _features & GF_AFTER_V3) + if (_version <= 3) updateDirtyScreen(1); - if (camera._last.x == camera._cur.x && (camera._last.y == camera._cur.y || !(_features & GF_AFTER_V7))) { + if (camera._last.x == camera._cur.x && (camera._last.y == camera._cur.y || !(_features & GF_NEW_CAMERA))) { updateDirtyScreen(0); } else { vs = &virtscr[0]; @@ -398,7 +398,7 @@ void Gdi::updateDirtyScreen(VirtScreen *vs) { if (vs->height == 0) return; - if (_vm->_features & GF_AFTER_V7 && (_vm->camera._cur.y != _vm->camera._last.y)) { + if (_vm->_features & GF_NEW_CAMERA && (_vm->camera._cur.y != _vm->camera._last.y)) { drawStripToScreen(vs, 0, _numStrips << 3, 0, vs->height); } else { int i; @@ -421,7 +421,7 @@ void Gdi::updateDirtyScreen(VirtScreen *vs) { continue; } // handle vertically scrolling rooms - if (_vm->_features & GF_AFTER_V7) + if (_vm->_features & GF_NEW_CAMERA) drawStripToScreen(vs, start * 8, w, 0, vs->height); else drawStripToScreen(vs, start * 8, w, top, bottom); @@ -490,7 +490,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) { numLinesToProcess = bottom - top; if (numLinesToProcess) { - if ((_vm->_features & GF_AFTER_V6) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen)) { + if ((_vm->_features & GF_NEW_OPCODES) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen)) { if (_vm->hasCharsetMask(strip << 3, top, (strip + 1) << 3, bottom)) draw8ColWithMasking(backbuff_ptr, bgbak_ptr, numLinesToProcess, mask_ptr); else @@ -581,12 +581,12 @@ void Scumm::initBGBuffers(int height) { int size, itemsize, i; byte *room; - if (_features & GF_AFTER_V7) { + if (_version >= 7) { initVirtScreen(0, 0, virtscr[0].topline, _screenWidth, height, 1, 1); } room = getResourceAddress(rtRoom, _roomResource); - if ((_features & GF_AFTER_V2) || (_features & GF_AFTER_V3)) { + if (_version <= 3) { gdi._numZBuffer = 2; } else if (_features & GF_SMALL_HEADER) { int off; @@ -603,7 +603,7 @@ void Scumm::initBGBuffers(int height) { ptr += off; off = READ_LE_UINT16(ptr); } - } else if (_features & GF_AFTER_V8) { + } else if (_version == 8) { // in V8 there is no RMIH and num z buffers is in RMHD ptr = findResource(MKID('RMHD'), room); gdi._numZBuffer = READ_LE_UINT32(ptr + 24) + 1; @@ -613,7 +613,7 @@ void Scumm::initBGBuffers(int height) { } assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 8); - if (_features & GF_AFTER_V7) + if (_version >= 7) itemsize = (_roomHeight + 10) * gdi._numStrips; else itemsize = (_roomHeight + 4) * gdi._numStrips; @@ -652,7 +652,7 @@ void Scumm::drawFlashlight() { return; // Calculate the area of the flashlight - if (_gameId == GID_ZAK256 || _features & GF_AFTER_V2) { + if (_gameId == GID_ZAK256 || _version <= 2) { x = _mouse.x + virtscr[0].xstart; y = _mouse.y - virtscr[0].topline; } else { @@ -723,7 +723,7 @@ void Scumm::redrawBGAreas() { int val; int diff; - if (!(_features & GF_AFTER_V7)) + if (!(_features & GF_NEW_CAMERA)) if (camera._cur.x != camera._last.x && _charset->_hasMask) stopTalk(); @@ -738,7 +738,7 @@ void Scumm::redrawBGAreas() { } } - if (_features & GF_AFTER_V7) { + if (_features & GF_NEW_CAMERA) { diff = (camera._cur.x >> 3) - (camera._last.x >> 3); if (_fullRedraw == 0 && diff == 1) { val = 2; @@ -776,7 +776,7 @@ void Scumm::redrawBGStrip(int start, int num) { for (int i = 0; i < num; i++) setGfxUsageBit(s + i, USAGE_BIT_DIRTY); - if (_features & GF_AFTER_V1) { + if (_version == 1) { gdi._C64ObjectMode = false; } gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs, @@ -835,7 +835,7 @@ void Scumm::restoreBG(ScummVM::Rect rect, byte backColor) { width = rect.width(); // Check whether lights are turned on or not - lightsOn = (_features & GF_AFTER_V6) || (vs->number != 0) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen); + lightsOn = (_features & GF_NEW_OPCODES) || (vs->number != 0) || (VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen); if (vs->alloctwobuffers && _currentRoom != 0 && lightsOn ) { blit(backbuff, bgbak, width, height); @@ -906,12 +906,12 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi bool useOrDecompress = false; // Check whether lights are turned on or not - lightsOn = (_vm->_features & GF_AFTER_V6) || (vs->number != 0) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen); + lightsOn = (_vm->_features & GF_NEW_OPCODES) || (vs->number != 0) || (_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_screen); CHECK_HEAP; if (_vm->_features & GF_SMALL_HEADER) smap_ptr = ptr; - else if (_vm->_features & GF_AFTER_V8) + else if (_vm->_version == 8) smap_ptr = ptr; else smap_ptr = findResource(MKID('SMAP'), ptr); @@ -922,7 +922,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi if (_zbufferDisabled) numzbuf = 0; - else if (_numZBuffer <= 1 || (_vm->_features & GF_AFTER_V2)) + else if (_numZBuffer <= 1 || (_vm->_version <= 2)) numzbuf = _numZBuffer; else { numzbuf = _numZBuffer; @@ -940,7 +940,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi for (i = 2; i < numzbuf; i++) { zplane_list[i] = zplane_list[i-1] + READ_LE_UINT16(zplane_list[i-1]); } - } else if (_vm->_features & GF_AFTER_V8) { + } else if (_vm->_version == 8) { // Find the OFFS chunk of the ZPLN chunk const byte *zplnOffsChunkStart = smap_ptr + READ_BE_UINT32(smap_ptr + 12) + 24; @@ -971,7 +971,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi } } - if (_vm->_features & GF_AFTER_V8) { + if (_vm->_version == 8) { // A small hack to skip to the BSTR->WRAP->OFFS chunk. Note: order matters, we do this // *after* the Z buffer code because that assumes' the orginal value of smap_ptr. smap_ptr += 24; @@ -995,7 +995,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi // dificult to draw only parts of a room/object. We handle the V2 graphics // differently from all other (newer) graphic formats for this reason. // - if ((_vm->_features & GF_AFTER_V2) && !(_vm->_features & GF_AFTER_V1)) { + if (_vm->_version == 2) { if (vs->alloctwobuffers) bgbak_ptr = _vm->getResourceAddress(rtBuffer, vs->number + 5) + (y * _numStrips + x) * 8; @@ -1125,12 +1125,12 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi else bgbak_ptr = backbuff_ptr; - if (_vm->_features & GF_AFTER_V1) { + if (_vm->_version == 1) { if (_C64ObjectMode) drawStripC64Object(bgbak_ptr, stripnr, width, height); else drawStripC64Background(bgbak_ptr, stripnr, height); - } else if (!(_vm->_features & GF_AFTER_V2)) { + } else if (_vm->_version > 2) { if (_vm->_features & GF_16COLOR) { decodeStripEGA(bgbak_ptr, smap_ptr + READ_LE_UINT16(smap_ptr + stripnr * 2 + 2), height); } else if (_vm->_features & GF_SMALL_HEADER) { @@ -1158,10 +1158,10 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi } CHECK_HEAP; - if (_vm->_features & GF_AFTER_V1) { + if (_vm->_version == 1) { mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + y * _numStrips + x + _imgBufOffs[1]; // drawStripC64Mask(mask_ptr, stripnr, height); - } else if (_vm->_features & GF_AFTER_V2) { + } else if (_vm->_version == 2) { // Do nothing here for V2 games - zplane was handled already. } else if (flag & dbDrawMaskOnAll) { // Sam & Max uses dbDrawMaskOnAll for things like the inventory @@ -1180,7 +1180,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi // don't know what for. At the time of writing, these games // are still too unstable for me to investigate. - if (_vm->_features & GF_AFTER_V8) + if (_vm->_version == 8) z_plane_ptr = zplane_list[1] + READ_LE_UINT32(zplane_list[1] + stripnr * 4 + 8); else z_plane_ptr = zplane_list[1] + READ_LE_UINT16(zplane_list[1] + stripnr * 2 + 8); @@ -1204,7 +1204,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4); else if (_vm->_features & GF_SMALL_HEADER) offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 2); - else if (_vm->_features & GF_AFTER_V8) + else if (_vm->_version == 8) offs = (uint16) READ_LE_UINT32(zplane_list[i] + stripnr * 4 + 8); else offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8); @@ -2183,7 +2183,7 @@ void Scumm::fadeOut(int effect) { VirtScreen *vs; virtscr[0].setDirtyRange(0, 0); - if (!(_features & GF_AFTER_V7)) + if (!(_features & GF_NEW_CAMERA)) camera._last.x = camera._cur.x; if (_screenEffectFlag && effect != 0) { @@ -2578,7 +2578,7 @@ void Scumm::setPaletteFromPtr(const byte *ptr) { // check for that. And somebody before me added a check for V7 games, turning this // off there, too... I wonder if it hurts other games, too? What exactly is broken // if we remove this patch? - if ((_gameId == GID_MONKEY_VGA) || (_features & GF_AFTER_V7) || (i <= 15 || r < 252 || g < 252 || b < 252)) { + if ((_gameId == GID_MONKEY_VGA) || (_version >= 7) || (i <= 15 || r < 252 || g < 252 || b < 252)) { *dest++ = r; *dest++ = g; *dest++ = b; @@ -2719,7 +2719,7 @@ void Scumm::cyclePalette() { } if (_shadowPalette) { - if (_features & GF_AFTER_V7) { + if (_version >= 7) { for (j = 0; j < NUM_SHADOW_PALETTE; j++) ::cycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2)); } else { @@ -3376,7 +3376,7 @@ void Scumm::useBompCursor(const byte *im, int width, int height) { _cursor.animate = 0; // Skip the header - if (_features & GF_AFTER_V8) { + if (_version == 8) { im += 16; } else { im += 18; @@ -3409,7 +3409,7 @@ void Scumm::decompressDefaultCursor(int idx) { for (j = 0; j < w; j++) _grabbedCursor[i * 8 + j] = color; } - } else if (_features & GF_AFTER_V2) { + } else if (_version <= 2) { _cursor.width = 23; _cursor.height = 21; _cursor.hotspotX = 11; diff --git a/scumm/object.cpp b/scumm/object.cpp index 8f2533eb28..6fb5f56172 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -217,7 +217,7 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) { const byte *ptr; const ImageHeader *imhd; - if (_features & GF_AFTER_V6) { + if (_version >= 6) { state = getState(object) - 1; if (state < 0) state = 0; @@ -237,10 +237,10 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) { return; } imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr); - if (_features & GF_AFTER_V8) { + if (_version == 8) { x = od->x_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].x); y = od->y_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].y); - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { x = od->x_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].x); y = od->y_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].y); } else { @@ -251,7 +251,7 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) { x = od->walk_x; y = od->walk_y; } - if (_features & GF_AFTER_V8) + if (_version == 8) dir = fromSimpleDir(1, od->actordir); else dir = oldDirToNewDir(od->actordir & 3); @@ -288,18 +288,18 @@ int Scumm::getObjActToObjActDist(int a, int b) { if (y > x) x = y; - return (_features & GF_AFTER_V2) ? x / 8 : x; + return (_version <= 2) ? x / 8 : x; } int Scumm::findObject(int x, int y) { int i, b; byte a; - const int mask = (_features & GF_AFTER_V2) ? 0x8 : 0xF; + const int mask = (_version <= 2) ? 0x8 : 0xF; for (i = 1; i < _numLocalObjects; i++) { if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable)) continue; - if (_features & GF_AFTER_V2 && _objs[i].state & 0x2) + if ((_version <= 2) && _objs[i].state & 0x2) continue; b = i; do { @@ -319,7 +319,7 @@ int Scumm::findObject(int x, int y) { void Scumm::drawRoomObject(int i, int arg) { ObjectData *od; byte a; - const int mask = (_features & GF_AFTER_V2) ? 0x8 : 0xF; + const int mask = (_version <= 2) ? 0x8 : 0xF; od = &_objs[i]; if ((i < 1) || (od->obj_nr < 1) || !od->state) @@ -337,7 +337,7 @@ void Scumm::drawRoomObject(int i, int arg) { void Scumm::drawRoomObjects(int arg) { int i; - const int mask = (_features & GF_AFTER_V2) ? 0x8 : 0xF; + const int mask = (_version <= 2) ? 0x8 : 0xF; if (_features & GF_DRAWOBJ_OTHER_ORDER) { for (i = 1; i < _numLocalObjects; i++) @@ -408,7 +408,7 @@ void Scumm::drawObject(int obj, int arg) { ptr += 0; else if (_features & GF_SMALL_HEADER) ptr += 8; - else if (_features & GF_AFTER_V8) { + else if (_version == 8) { ptr = findResource(MKID('IMAG'), ptr); if (!ptr) return; @@ -442,13 +442,13 @@ void Scumm::drawObject(int obj, int arg) { if (numstrip != 0) { byte flags = Gdi::dbAllowMaskOr; - if (_features & GF_AFTER_V1) { + if (_version == 1) { gdi._C64ObjectMode = true; gdi.decodeC64Gfx(ptr, gdi._C64ObjectMap, width * (height >> 3) * 3); } // Sam & Max needs this to fix object-layering problems with // the inventory and conversation icons. - if ((_features & GF_AFTER_V7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, kObjectClassIgnoreBoxes)) + if ((_version >= 7 || _gameId == GID_SAMNMAX) && getClass(od->obj_nr, kObjectClassIgnoreBoxes)) flags |= Gdi::dbDrawMaskOnAll; gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width << 3, height, x - xpos, numstrip, flags); } @@ -496,9 +496,9 @@ void Scumm::loadRoomObjects() { room = getResourceAddress(rtRoom, _roomResource); roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), room); - if (_features & GF_AFTER_V8) + if (_version == 8) _numObjectsInRoom = (byte)READ_LE_UINT32(&(roomhdr->v8.numObjects)); - else if (_features & GF_AFTER_V7) + else if (_version == 7) _numObjectsInRoom = READ_LE_UINT16(&(roomhdr->v7.numObjects)); else _numObjectsInRoom = READ_LE_UINT16(&(roomhdr->old.numObjects)); @@ -509,7 +509,7 @@ void Scumm::loadRoomObjects() { if (_numObjectsInRoom > _numLocalObjects) error("More than %d objects in room %d", _numLocalObjects, _roomResource); - if (_features & GF_AFTER_V8) + if (_version == 8) searchptr = rootptr = getResourceAddress(rtRoomScripts, _roomResource); else searchptr = rootptr = room; @@ -526,9 +526,9 @@ void Scumm::loadRoomObjects() { od->OBCDoffset = ptr - rootptr; cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), ptr); - if (_features & GF_AFTER_V7) + if (_version >= 7) od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); - else if (_features & GF_AFTER_V6) + else if (_version == 6) od->obj_nr = READ_LE_UINT16(&(cdhd->v6.obj_id)); else od->obj_nr = READ_LE_UINT16(&(cdhd->v5.obj_id)); @@ -550,11 +550,11 @@ void Scumm::loadRoomObjects() { error("Room %d missing image blocks(s)", _roomResource); imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr); - if (_features & GF_AFTER_V8) + if (_version == 8) // In V8, IMHD has no obj_id, but rather a name string. We map the name // back to an object id using a table derived from the DOBJ resource. obim_id = _objectIDMap[imhd->v8.name]; - else if (_features & GF_AFTER_V7) + else if (_version == 7) obim_id = READ_LE_UINT16(&imhd->v7.obj_id); else obim_id = READ_LE_UINT16(&imhd->old.obj_id); @@ -590,7 +590,7 @@ void Scumm::loadRoomObjectsOldBundle() { if (_numObjectsInRoom > _numLocalObjects) error("More than %d objects in room %d", _numLocalObjects, _roomResource); - if (_features & GF_AFTER_V2) + if (_version <= 2) ptr = room + 28; else ptr = room + 29; @@ -696,14 +696,14 @@ void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *search od->y_pos = ((*(ptr + 10)) & 0x7F) << 3; od->parentstate = (*(ptr + 10) & 0x80) ? 1 : 0; - if (_features & GF_AFTER_V2) + if (_version <= 2) od->parentstate <<= 3; od->width = *(ptr + 11) << 3; od->parent = *(ptr + 12); - if (_features & GF_AFTER_V2) { + if (_version <= 2) { od->walk_x = *(ptr + 13) * 8; od->walk_y = (*(ptr + 14) & 0x1f) * 8; od->actordir = (*(ptr + 15)) & 7; @@ -719,7 +719,7 @@ void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *search } if (searchptr == NULL) { - if (_features & GF_AFTER_V8) + if (_version == 8) searchptr = getResourceAddress(rtRoomScripts, _roomResource); else searchptr = room; @@ -729,7 +729,7 @@ void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *search if (cdhd == NULL) error("Room %d missing CDHD blocks(s)", _roomResource); - if (_features & GF_AFTER_V8) { + if (_version == 8) { od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -743,7 +743,7 @@ void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *search // HACK: This is done sinec an angle doesn't fit into a byte (360 > 256) od->actordir = toSimpleDir(1, READ_LE_UINT32(&imhd->v8.actordir)); - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -756,7 +756,7 @@ void Scumm::setupRoomObject(ObjectData *od, const byte *room, const byte *search od->height = READ_LE_UINT16(&imhd->v7.height); od->actordir = READ_LE_UINT16(&imhd->v7.actordir); - } else if (_features & GF_AFTER_V6) { + } else if (_version == 6) { od->obj_nr = READ_LE_UINT16(&(cdhd->v6.obj_id)); od->width = READ_LE_UINT16(&cdhd->v6.w); @@ -892,7 +892,7 @@ const byte *Scumm::getObjOrActorName(int obj) { if (obj < _numActors) return derefActor(obj, "getObjOrActorName")->getActorName(); - if (_features & GF_AFTER_V6) { + if (_version >= 6) { for (i = 0; i < _numNewNames; i++) { if (_newNames[i] == obj) { debug(5, "Found new name for object %d at _newNames[i]", obj, i); @@ -909,7 +909,7 @@ const byte *Scumm::getObjOrActorName(int obj) { if (_features & GF_SMALL_HEADER) { byte offset = 0; - if (_features & GF_AFTER_V2) + if (_version <= 2) offset = *(objptr + 14); else if (_features & GF_OLD_BUNDLE) offset = *(objptr + 16); @@ -950,7 +950,7 @@ byte *Scumm::getOBCDFromObject(int obj) { if (_objs[i].obj_nr == obj) { if (_objs[i].fl_object_index) return getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8; - if (_features & GF_AFTER_V8) + if (_version == 8) return getResourceAddress(rtRoomScripts, _roomResource) + _objs[i].OBCDoffset; else return getResourceAddress(rtRoom, _roomResource) + _objs[i].OBCDoffset; @@ -1027,9 +1027,9 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint } else { const RoomHeader *roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr); - if (_features & GF_AFTER_V8) + if (_version == 8) numobj = READ_LE_UINT32(&(roomhdr->v8.numObjects)); - else if (_features & GF_AFTER_V7) + else if (_version == 7) numobj = READ_LE_UINT16(&(roomhdr->v7.numObjects)); else numobj = READ_LE_UINT16(&(roomhdr->old.numObjects)); @@ -1041,7 +1041,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint error("findObjectInRoom: More (%d) than %d objects in room %d", numobj, _numLocalObjects, room); if (_features & GF_OLD_BUNDLE) { - if (_features & GF_AFTER_V2) + if (_version <= 2) searchptr = roomptr + 28; else searchptr = roomptr + 29; @@ -1068,7 +1068,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint } if (findWhat & foCodeHeader) { - if (_features & GF_AFTER_V8) + if (_version == 8) searchptr = getResourceAddress(rtRoomScripts, room); else searchptr = roomptr; @@ -1084,9 +1084,9 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint if (_features & GF_SMALL_HEADER) id2 = READ_LE_UINT16(obcdptr + 6); - else if (_features & GF_AFTER_V7) + else if (_version >= 7) id2 = READ_LE_UINT16(&(cdhd->v7.obj_id)); - else if (_features & GF_AFTER_V6) + else if (_version == 6) id2 = READ_LE_UINT16(&(cdhd->v6.obj_id)); else id2 = READ_LE_UINT16(&(cdhd->v5.obj_id)); @@ -1116,11 +1116,11 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obimptr); if (_features & GF_SMALL_HEADER) id3 = READ_LE_UINT16(obimptr + 6); - else if (_features & GF_AFTER_V8) + else if (_version == 8) // In V8, IMHD has no obj_id, but rather a name string. We map the name // back to an object id using a table derived from the DOBJ resource. id3 = _objectIDMap[imhd->v8.name]; - else if (_features & GF_AFTER_V7) + else if (_version == 7) id3 = READ_LE_UINT16(&imhd->v7.obj_id); else id3 = READ_LE_UINT16(&imhd->old.obj_id); @@ -1314,12 +1314,12 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) { findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, img, room); - if (_features & GF_AFTER_V8) { + if (_version == 8) { setCursorHotspot(READ_LE_UINT32(&foir.imhd->v8.hotspot[0].x), READ_LE_UINT32(&foir.imhd->v8.hotspot[0].y)); w = READ_LE_UINT32(&foir.imhd->v8.width) >> 3; h = READ_LE_UINT32(&foir.imhd->v8.height) >> 3; - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { setCursorHotspot(READ_LE_UINT16(&foir.imhd->v7.hotspot[0].x), READ_LE_UINT16(&foir.imhd->v7.hotspot[0].y)); w = READ_LE_UINT16(&foir.imhd->v7.width) >> 3; @@ -1335,7 +1335,7 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) { // code in drawBlastObject. It would be *much* nicer if we could aggregate this // common code into some helper functions, instead of having long convuluted // cases scattered all over the place. - if (_features & GF_AFTER_V8) { + if (_version == 8) { dataptr = findResource(MKID('IMAG'), foir.obim); assert(dataptr); dataptr = findResource(MKID('WRAP'), dataptr); @@ -1451,7 +1451,7 @@ void Scumm::drawBlastObject(BlastObject *eo) { if (!ptr) error("BlastObject object %d (%d) image not found", eo->number, idx); - if (_features & GF_AFTER_V8) { + if (_version == 8) { // The OBIM contains an IMAG, which in turn contains a WRAP, which contains // an OFFS chunk and multiple BOMP chunks. To find the right BOMP, we can // either use the offsets in the OFFS chunk, or iterate over all BOMPs we find. @@ -1480,7 +1480,7 @@ void Scumm::drawBlastObject(BlastObject *eo) { //hexdump(bomp,32); - if (_features & GF_AFTER_V8) { + if (_version == 8) { bdd.srcwidth = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.width); bdd.srcheight = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.height); } else { @@ -1491,7 +1491,7 @@ void Scumm::drawBlastObject(BlastObject *eo) { bdd.out = vs->screenPtr + vs->xstart; bdd.outwidth = vs->width; bdd.outheight = vs->height; - if (_features & GF_AFTER_V8) { + if (_version == 8) { bdd.dataptr = bomp + 8; // Why this? See also useBompCursor } else { bdd.dataptr = bomp + 10; // Why this? See also useBompCursor @@ -1563,7 +1563,7 @@ void Scumm::removeBlastObject(BlastObject *eo) { if (left_strip < 0) left_strip = 0; - if (_features & GF_AFTER_V7) { + if (_version >= 7) { if (right_strip > 409) right_strip = 409; } else { @@ -1640,7 +1640,7 @@ void Scumm::loadFlObject(uint object, uint room) { isRoomScriptsLocked = ((res.flags[rtRoomScripts][room] & RF_LOCK) != 0); if (!isRoomLocked) lock(rtRoom, room); - if (_features & GF_AFTER_V8 && !isRoomScriptsLocked) + if (_version == 8 && !isRoomScriptsLocked) lock(rtRoomScripts, room); // Allocate slot & memory for floating object @@ -1658,7 +1658,7 @@ void Scumm::loadFlObject(uint object, uint room) { // Unlock room/roomScripts if (!isRoomLocked) unlock(rtRoom, room); - if (_features & GF_AFTER_V8 && !isRoomScriptsLocked) + if (_version == 8 && !isRoomScriptsLocked) unlock(rtRoomScripts, room); // Setup local object flags diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index f073f8781b..c057704e59 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -556,7 +556,7 @@ void Player_V2::clear_channel(int i) { } int Player_V2::getMusicTimer() { - if ((_scumm->_features & GF_AFTER_V3)) + if (_scumm->_version == 3) return _music_timer; else return channels[0].d.music_timer; diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 8d22112252..c63d426ae0 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -76,8 +76,8 @@ void Scumm::openRoom(int room) { } if (!(_features & GF_SMALL_HEADER)) { - if (_features & GF_AFTER_V7) { - if (room > 0 && (_features & GF_AFTER_V8)) + if (_version >= 7) { + if (room > 0 && (_version == 8)) VAR(VAR_CURRENTDISK) = res.roomno[rtRoom][room]; sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]); sprintf(buf2, "%s.%.3d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]); @@ -219,7 +219,7 @@ bool Scumm::openResourceFile(const char *filename) { void Scumm::askForDisk(const char *filename, int disknum) { char buf[128]; - if (_features & GF_AFTER_V8) { + if (_version == 8) { char result; _bundle->closeVoiceFile(); @@ -254,7 +254,7 @@ void Scumm::readIndexFile() { closeRoom(); openRoom(0); - if (!(_features & GF_AFTER_V6)) { + if (_version <= 5) { /* Figure out the sizes of various resources */ while (!_fileHandle.eof()) { blocktype = fileReadDword(); @@ -308,14 +308,14 @@ void Scumm::readIndexFile() { break; case MKID('DOBJ'): - if (_features & GF_AFTER_V8) + if (_version == 8) num = _fileHandle.readUint32LE(); else num = _fileHandle.readUint16LE(); assert(num == _numGlobalObjects); - if (_features & GF_AFTER_V8) { /* FIXME: Not sure.. */ + if (_version == 8) { /* FIXME: Not sure.. */ char buffer[40]; for (i = 0; i < num; i++) { _fileHandle.read(buffer, 40); @@ -328,7 +328,7 @@ void Scumm::readIndexFile() { _classData[i] = _fileHandle.readUint32LE(); } memset(_objectOwnerTable, 0xFF, num); - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { _fileHandle.read(_objectStateTable, num); _fileHandle.read(_objectRoomTable, num); memset(_objectOwnerTable, 0xFF, num); @@ -344,7 +344,7 @@ void Scumm::readIndexFile() { } } - if (!(_features & GF_AFTER_V8)) { + if (_version != 8) { _fileHandle.read(_classData, num * sizeof(uint32)); // Swap flag endian where applicable @@ -435,7 +435,7 @@ void Scumm::readArrayFromIndexFile() { int num; int a, b, c; - if (_features & GF_AFTER_V8) { + if (_version == 8) { while ((num = _fileHandle.readUint32LE()) != 0) { a = _fileHandle.readUint32LE(); b = _fileHandle.readUint32LE(); @@ -470,7 +470,7 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name) { debug(9, "readResTypeList(%s,%x,%s)", resTypeFromId(id), FROM_LE_32(tag), name); - if (_features & GF_AFTER_V8) + if (_version == 8) num = _fileHandle.readUint32LE(); else if (!(_features & GF_OLD_BUNDLE)) num = _fileHandle.readUint16LE(); @@ -575,7 +575,7 @@ void Scumm::ensureResourceLoaded(int type, int i) { debug(9, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i); - if (type == rtRoom && i > 0x7F && !(_features & GF_AFTER_V7)) { + if (type == rtRoom && i > 0x7F && _version < 7) { i = _resourceMapper[i & 0x7F]; } @@ -601,7 +601,7 @@ void Scumm::ensureResourceLoaded(int type, int i) { loadResource(type, i); - if (!(_features & GF_AFTER_V7) && !(_features & GF_SMALL_HEADER)) + if (_version < 7 && !(_features & GF_SMALL_HEADER)) if (type == rtRoom && i == _roomResource) VAR(VAR_ROOM_FLAG) = 1; } @@ -627,7 +627,7 @@ int Scumm::loadResource(int type, int idx) { roomNr = _roomResource; if (type == rtRoom) { - if (_features & GF_AFTER_V8) + if (_version == 8) fileOffs = 8; else fileOffs = 0; @@ -1649,7 +1649,7 @@ void Scumm::resourceStats() { } void Scumm::readMAXS() { - if (_features & GF_AFTER_V8) { // CMI + if (_version == 8) { // CMI _fileHandle.seek(50 + 50, SEEK_CUR); // 176 - 8 _numVariables = _fileHandle.readUint32LE(); // 1500 _numBitVariables = _fileHandle.readUint32LE(); // 2048 @@ -1673,7 +1673,7 @@ void Scumm::readMAXS() { _numGlobalScripts = 2000; _shadowPaletteSize = NUM_SHADOW_PALETTE * 256; - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { _fileHandle.seek(50 + 50, SEEK_CUR); _numVariables = _fileHandle.readUint16LE(); _numBitVariables = _fileHandle.readUint16LE(); @@ -1695,7 +1695,7 @@ void Scumm::readMAXS() { _numGlobalScripts = 2000; _shadowPaletteSize = NUM_SHADOW_PALETTE * 256; - } else if (_features & GF_AFTER_V6) { + } else if (_version == 6) { _numVariables = _fileHandle.readUint16LE(); _fileHandle.readUint16LE(); // 16 in Sam/DOTT _numBitVariables = _fileHandle.readUint16LE(); diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp index 3414696650..89fa40409c 100644 --- a/scumm/resource_v2.cpp +++ b/scumm/resource_v2.cpp @@ -146,7 +146,7 @@ void Scumm_v2::readIndexFile() { break; case 0x0A31: warning("Classic V1 game detected"); - setFeatures(_features | GF_AFTER_V1); + _version = 1; readClassicIndexFile(); break; default: diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 8dbb726f2a..29a7cf9911 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -162,7 +162,7 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr) { _completeScreenRedraw = true; - if (_features & GF_AFTER_V1) { + if (_version == 1) { setupC64Palette(); setDirtyColors(0, 15); } else if (_features & GF_16COLOR) { @@ -180,12 +180,12 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr) { _drawObjectQueNr = 0; _verbMouseOver = 0; - if (_features & GF_AFTER_V7) + if (_features & GF_NEW_CAMERA) cameraMoved(); initBGBuffers(_roomHeight); - if (_features & GF_AFTER_V2) { + if (_version == 2) { // Regenerate strip table when loading _roomStrips = gdi.generateStripTable(getResourceAddress(rtRoom, _roomResource) + _IM00_offs, _roomWidth, _roomHeight, _roomStrips); diff --git a/scumm/script.cpp b/scumm/script.cpp index 0661494f0e..118f887b92 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -137,7 +137,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry) { objptr = getOBCDFromObject(obj); assert(objptr); - if (_features & GF_AFTER_V2) + if (_version <= 2) verbptr = objptr + 15; else if (_features & GF_OLD_BUNDLE) verbptr = objptr + 17; @@ -153,7 +153,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry) { if (!(_features & GF_SMALL_HEADER)) verbptr += _resourceHeaderSize; - if (_features & GF_AFTER_V8) { + if (_version == 8) { const uint32 *ptr = (const uint32 *)verbptr; uint32 verb; do { @@ -165,7 +165,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry) { ptr += 2; } while (1); return verboffs + 8 + READ_LE_UINT32(ptr + 1); - } if (_features & GF_AFTER_V2) { + } if (_version <= 2) { do { if (!*verbptr) return 0; @@ -354,7 +354,7 @@ void Scumm::getScriptBaseAddress() { case 3: case WIO_ROOM: /* room script */ - if (_features & GF_AFTER_V8) { + if (_version == 8) { _scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource); assert(_roomResource < res.num[rtRoomScripts]); _lastCodePtr = &res.address[rtRoomScripts][_roomResource]; @@ -640,7 +640,7 @@ void Scumm::stopObjectCode() { } void Scumm::runHook(int i) { - if (_features & GF_AFTER_V2) { + if (_version <= 2) { // FIXME - TODO } else { int tmp[16]; @@ -654,7 +654,7 @@ void Scumm::runHook(int i) { void Scumm::freezeScripts(int flag) { int i; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { for (i = 0; i < NUM_SCRIPT_SLOT; i++) { if (_currentScript != i && vm.slot[i].status != ssDead && !vm.slot[i].freezeResistant) { vm.slot[i].status |= 0x80; @@ -683,7 +683,7 @@ void Scumm::freezeScripts(int flag) { void Scumm::unfreezeScripts() { int i; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { for (i = 0; i < NUM_SCRIPT_SLOT; i++) { vm.slot[i].status &= 0x7F; vm.slot[i].freezeCount = 0; @@ -728,7 +728,7 @@ void Scumm::runAllScripts() { } void Scumm::runExitScript() { - if (!(_features & GF_AFTER_V2) && VAR(VAR_EXIT_SCRIPT)) + if (_version > 2 && VAR(VAR_EXIT_SCRIPT)) runScript(VAR(VAR_EXIT_SCRIPT), 0, 0, 0); if (_EXCD_offs) { int slot = getScriptSlot(); @@ -759,12 +759,12 @@ void Scumm::runExitScript() { runScriptNested(slot); } - if (!(_features & GF_AFTER_V2) && VAR(VAR_EXIT_SCRIPT2)) + if (_version > 2 && VAR(VAR_EXIT_SCRIPT2)) runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, 0); } void Scumm::runEntryScript() { - if (!(_features & GF_AFTER_V2) && VAR(VAR_ENTRY_SCRIPT)) + if (_version > 2 && VAR(VAR_ENTRY_SCRIPT)) runScript(VAR(VAR_ENTRY_SCRIPT), 0, 0, 0); if (_ENCD_offs) { int slot = getScriptSlot(); @@ -778,7 +778,7 @@ void Scumm::runEntryScript() { vm.slot[slot].delayFrameCount = 0; runScriptNested(slot); } - if (!(_features & GF_AFTER_V2) && VAR(VAR_ENTRY_SCRIPT2)) + if (_version > 2 && VAR(VAR_ENTRY_SCRIPT2)) runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, 0); } @@ -826,7 +826,7 @@ void Scumm::killAllScriptsExceptCurrent() { void Scumm::doSentence(int verb, int objectA, int objectB) { SentenceTab *st; - if (_features & GF_AFTER_V7) { + if (_version >= 7) { if (objectA == objectB) return; @@ -855,7 +855,7 @@ void Scumm::checkAndRunSentenceScript() { int i; ScriptSlot *ss; int sentenceScript; - if (_features & GF_AFTER_V2) + if (_version <= 2) sentenceScript = 2; else sentenceScript = VAR(VAR_SENTENCE_SCRIPT); @@ -873,11 +873,11 @@ void Scumm::checkAndRunSentenceScript() { _sentenceNum--; - if (!(_features & GF_AFTER_V7)) + if (_version < 7) if (_sentence[_sentenceNum].preposition && _sentence[_sentenceNum].objectB == _sentence[_sentenceNum].objectA) return; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { _scummVars[VAR_ACTIVE_VERB] = _sentence[_sentenceNum].verb; _scummVars[VAR_ACTIVE_OBJECT1] = _sentence[_sentenceNum].objectA; _scummVars[VAR_ACTIVE_OBJECT2] = _sentence[_sentenceNum].objectB; @@ -896,7 +896,7 @@ void Scumm::runInputScript(int a, int cmd, int mode) { int args[16]; int verbScript; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { verbScript = 4; _scummVars[VAR_CLICK_AREA] = a; switch(a) { @@ -972,7 +972,7 @@ int Scumm::defineArray(int array, int type, int dim2, int dim1) { id = getArrayId(); - if (_features & GF_AFTER_V8) { + if (_version == 8) { if (array & 0x40000000) { } @@ -1054,7 +1054,7 @@ int Scumm::resStrLen(const byte *src) const { num++; if (chr != 1 && chr != 2 && chr != 3 && chr != 8) { - if (_features & GF_AFTER_V8) { + if (_version == 8) { src += 4; num += 4; } else { @@ -1151,6 +1151,6 @@ void Scumm::endOverride() { vm.cutScenePtr[idx] = 0; vm.cutSceneScript[idx] = 0; - if (!(_features & GF_AFTER_V3)) + if (_version > 3) VAR(VAR_OVERRIDE) = 0; } diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index e6e0653caa..502b5361eb 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -688,7 +688,7 @@ void Scumm_v2::o2_actorSet() { // FIXME: This hack would make costume draw. However, until // we have added support for the V1 costume format, this hurts // more than it helps. - if (_features & GF_AFTER_V1 && vm.slot[_currentScript].number == 1) { + if (_version == 1 && vm.slot[_currentScript].number == 1) { a->setActorCostume(act); } #endif diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index ea7944cb65..ea7e3b94c0 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1186,7 +1186,7 @@ void Scumm_v5::o5_isEqual() { int16 a, b; int var; - if (_features & GF_AFTER_V2) + if (_version <= 2) var = fetchScriptByte(); else var = fetchScriptWord(); @@ -1338,7 +1338,7 @@ void Scumm_v5::o5_loadRoomWithEgo() { void Scumm_v5::o5_matrixOps() { int a, b; - if (_features & GF_AFTER_V3) { + if (_version == 3) { a = getVarOrDirectByte(0x80); b = fetchScriptByte(); setBoxFlags(a, b); @@ -1400,7 +1400,7 @@ void Scumm_v5::o5_panCameraTo() { void Scumm_v5::o5_pickupObject() { int obj, room; - if (_features & GF_AFTER_V3) { + if (_version == 3) { o5_drawObject(); return; } @@ -1519,7 +1519,7 @@ void Scumm_v5::o5_resourceRoutines() { ensureResourceLoaded(resType[op-1], resid); break; case 4: // load room - if (_features & GF_AFTER_V3) { + if (_version == 3) { ensureResourceLoaded(rtRoom, resid); if (resid > 0x7F) resid = _resourceMapper[resid & 0x7F]; @@ -1623,7 +1623,7 @@ void Scumm_v5::o5_resourceRoutines() { void Scumm_v5::o5_roomOps() { int a = 0, b = 0, c, d, e; - if (_features & GF_AFTER_V3) { + if (_version == 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -1631,7 +1631,7 @@ void Scumm_v5::o5_roomOps() { _opcode = fetchScriptByte(); switch (_opcode & 0x1F) { case 1: /* room scroll */ - if (!(_features & GF_AFTER_V3)) { + if (_version != 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -1648,7 +1648,7 @@ void Scumm_v5::o5_roomOps() { break; case 2: /* room color */ if (_features & GF_SMALL_HEADER) { - if (!(_features & GF_AFTER_V3)) { + if (_version != 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -1666,7 +1666,7 @@ void Scumm_v5::o5_roomOps() { break; case 3: /* set screen */ - if (!(_features & GF_AFTER_V3)) { + if (_version != 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -1674,7 +1674,7 @@ void Scumm_v5::o5_roomOps() { break; case 4: /* set palette color */ if (_features & GF_SMALL_HEADER) { - if (!(_features & GF_AFTER_V3)) { + if (_version != 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -1708,7 +1708,7 @@ void Scumm_v5::o5_roomOps() { break; case 8: /* room scale? */ if (_features & GF_SMALL_HEADER) { - if (!(_features & GF_AFTER_V3)) { + if (_version != 3) { a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); } @@ -2400,7 +2400,7 @@ void Scumm_v5::o5_walkActorToActor() { if (!a2->isInCurrentRoom()) return; - if (_features & GF_AFTER_V2) + if (_version <= 2) dist *= 8; else if (dist == 0xFF) { dist = a2->scalex * a->width / 0xFF; diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 156a09c308..31eeef87a0 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -378,7 +378,7 @@ const char *Scumm_v6::getOpcodeDesc(byte i) { int Scumm_v6::popRoomAndObj(int *room) { int obj; - if (_features & GF_AFTER_V7) { + if (_version >= 7) { obj = pop(); *room = getObjectRoom(obj); } else { @@ -408,7 +408,7 @@ int Scumm::readArray(int array, int idx, int base) { if (ah->type == 4) { return ah->data[base]; - } else if (_features & GF_AFTER_V8) { + } else if (_version == 8) { return (int32)READ_LE_UINT32(ah->data + base * 4); } else { return (int16)READ_LE_UINT16(ah->data + base * 2); @@ -425,7 +425,7 @@ void Scumm::writeArray(int array, int idx, int base, int value) { if (ah->type == 4) { ah->data[base] = value; - } else if (_features & GF_AFTER_V8) { + } else if (_version == 8) { #if defined(SCUMM_NEED_ALIGNMENT) uint32 tmp = TO_LE_32(value); memcpy(&ah->data[base*4], &tmp, 4); @@ -940,7 +940,7 @@ void Scumm_v6::o6_stopObjectScript() { } void Scumm_v6::o6_panCameraTo() { - if (_features & GF_AFTER_V7) { + if (_version >= 7) { int y = pop(); int x = pop(); panCameraTo(x, y); @@ -950,14 +950,14 @@ void Scumm_v6::o6_panCameraTo() { } void Scumm_v6::o6_actorFollowCamera() { - if (_features & GF_AFTER_V7) + if (_version >= 7) setCameraFollows(derefActor(pop(), "actorFollowCamera")); else actorFollowCamera(pop()); } void Scumm_v6::o6_setCameraAt() { - if (_features & GF_AFTER_V7) { + if (_version >= 7) { int x, y; camera._follows = 0; @@ -1101,7 +1101,7 @@ void Scumm_v6::o6_doSentence() { int verb, objectA, objectB, dummy = 0; objectB = pop(); - if (!(_features & GF_AFTER_V8)) + if (_version < 8) dummy = pop(); // dummy pop (in Sam&Max, seems to be always 0 or 130) objectA = pop(); verb = pop(); @@ -1155,7 +1155,7 @@ void Scumm_v6::o6_loadRoomWithEgo() { /* startScene maybe modifies VAR_EGO, i hope not */ - if (!(_features & GF_AFTER_V7)) { + if (_version == 6) { setCameraAt(a->x, a->y); setCameraFollows(a); } @@ -1320,7 +1320,7 @@ void Scumm_v6::o6_setObjectName() { if (obj < _numActors) error("Can't set actor %d name with new-name-of", obj); - if (!(_features & GF_AFTER_V7) && !getOBCDFromObject(obj)) + if (_version < 7 && !getOBCDFromObject(obj)) error("Can't set name of object %d", obj); for (i = 0; i < _numNewNames; i++) { @@ -1375,7 +1375,7 @@ void Scumm_v6::o6_resourceRoutines() { switch (op) { case 100: /* load script */ resid = pop(); - if (_features & GF_AFTER_V7) + if (_version >= 7) if (resid >= _numGlobalScripts) break; ensureResourceLoaded(rtScript, resid); @@ -1394,7 +1394,7 @@ void Scumm_v6::o6_resourceRoutines() { break; case 104: /* nuke script */ resid = pop(); - if (_features & GF_AFTER_V7) + if (_version >= 7) if (resid >= _numGlobalScripts) break; setResourceCounter(rtScript, resid, 0x7F); @@ -1698,7 +1698,7 @@ void Scumm_v6::o6_actorOps() { break; case 95: a->ignoreBoxes = 1; - if (_features & GF_AFTER_V7) + if (_version >= 7) a->forceClip = 100; else a->forceClip = 0; @@ -1707,7 +1707,7 @@ void Scumm_v6::o6_actorOps() { break; case 96: a->ignoreBoxes = 0; - if (_features & GF_AFTER_V7) + if (_version >= 7) a->forceClip = 100; else a->forceClip = 0; @@ -1977,7 +1977,7 @@ void Scumm_v6::o6_saveRestoreVerbs() { a = pop(); byte subOp = fetchScriptByte(); - if (_features & GF_AFTER_V8) { + if (_version == 8) { subOp = (subOp - 141) + 0xB4; } @@ -2061,7 +2061,7 @@ void Scumm_v6::o6_wait() { break; return; case 170: - if (_features & GF_AFTER_V7) { + if (_version >= 7) { if (camera._dest != camera._cur) break; } else { @@ -2227,7 +2227,7 @@ void Scumm_v6::o6_talkActor() { _messagePtr = _scriptPointer; _scriptPointer += resStrLen(_scriptPointer) + 1; - if (((_gameId == GID_DIG) || (_features & GF_AFTER_V8)) && (_messagePtr[0] == '/')) { + if ((_gameId == GID_DIG || _gameId == GID_CMI) && (_messagePtr[0] == '/')) { char pointer[20]; int i, j; @@ -2380,7 +2380,7 @@ void Scumm_v6::o6_kernelSetFunctions() { num = getStackList(args, ARRAYSIZE(args)); - if (_features & GF_AFTER_V7) { + if (_version >= 7) { switch (args[0]) { case 4: grabCursor(args[1], args[2], args[3], args[4]); @@ -2901,7 +2901,7 @@ void Scumm_v6::o6_pickVarRandom() { num = readArray(value, 0, 0); byte *ptr = getResourceAddress(rtString, num); - if (_features & GF_AFTER_V7) { + if (_version >= 7) { var_A = READ_LE_UINT32(ptr + 4); var_C = READ_LE_UINT32(ptr + 8); } else { @@ -2935,7 +2935,7 @@ void Scumm_v6::o6_getDateTime() { VAR(VAR_TIMEDATE_HOUR) = t->tm_hour; VAR(VAR_TIMEDATE_MINUTE) = t->tm_min; - if (_features & GF_AFTER_V8) + if (_version == 8) VAR(VAR_TIMEDATE_SECOND) = t->tm_sec; } diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index fc2c5d2e6f..26f90953a0 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -88,93 +88,93 @@ static const VersionSettings scumm_settings[] = { /* Scumm Version 2 */ {"maniac", "Maniac Mansion", GID_MANIAC, 2, - GF_AFTER_V2 | GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "00.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "00.LFL"}, {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, - GF_AFTER_V2 | GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "00.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALLING, "00.LFL"}, /* Scumm Version 3 */ {"indy3EGA", "Indiana Jones and the Last Crusade", GID_INDY3, 3, - GF_AFTER_V3 | GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE, "00.LFL"}, + GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE, "00.LFL"}, {"indy3", "Indiana Jones and the Last Crusade (256)", GID_INDY3_256, 3, - GF_AFTER_V3 | GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_ADLIB_DEFAULT, "00.LFL"}, + GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_ADLIB_DEFAULT, "00.LFL"}, {"zak256", "Zak McKracken and the Alien Mindbenders (256)", GID_ZAK256, 3, - GF_AFTER_V3 | GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_AUDIOTRACKS, "00.LFL"}, + GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_AUDIOTRACKS, "00.LFL"}, {"loom", "Loom", GID_LOOM, 3, - GF_AFTER_V3 | GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE, "00.LFL"}, + GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE, "00.LFL"}, /* Scumm Version 4 */ {"monkeyEGA", "Monkey Island 1 (EGA)", GID_MONKEY_EGA, 4, - GF_AFTER_V4 | GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_ADLIB_DEFAULT, "000.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_ADLIB_DEFAULT, "000.LFL"}, {"pass", "Passport to Adventure", GID_MONKEY_EGA, 4, - GF_AFTER_V4 | GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_ADLIB_DEFAULT, "000.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR | GF_ADLIB_DEFAULT, "000.LFL"}, /* Scumm version 5 */ {"monkeyVGA", "Monkey Island 1 (256 color Floppy version)", GID_MONKEY_VGA, 4, - GF_AFTER_V4 | GF_SMALL_HEADER | GF_USE_KEY | GF_ADLIB_DEFAULT, "000.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_ADLIB_DEFAULT, "000.LFL"}, {"loomcd", "Loom (256 color CD version)", GID_LOOM256, 4, - GF_AFTER_V4 | GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, "000.LFL"}, + GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, "000.LFL"}, {"monkey", "Monkey Island 1", GID_MONKEY, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, 0}, {"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT, 0}, {"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"mi2demo", "Monkey Island 2: LeChuck's revenge (Demo)", GID_MONKEY2, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"indydemo", "Indiana Jones and the Fate of Atlantis (FM Towns Demo)", GID_INDY4, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"atlantis", "Indiana Jones and the Fate of Atlantis", GID_INDY4, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"playfate", "Indiana Jones and the Fate of Atlantis (Demo)", GID_INDY4, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"fate", "Indiana Jones and the Fate of Atlantis (Demo)", GID_INDY4, 5, - GF_AFTER_V5 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, /* Scumm Version 6 */ {"puttputt", "Putt-Putt Joins The Parade (DOS)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"puttdemo", "Putt-Putt Joins The Parade (DOS Demo)", GID_PUTTDEMO, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS, 0}, {"moondemo", "Putt-Putt Goes To The Moon (DOS Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"puttmoon", "Putt-Putt Goes To The Moon (DOS)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"funpack", "Putt-Putt's Fun Pack", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"fbpack", "Fatty Bear's Fun Pack", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"fbear", "Fatty Bear's Birthday Surprise (DOS)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"fbdemo", "Fatty Bear's Birthday Surprise (DOS Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, {"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_ADLIB_DEFAULT, 0}, {"samnmax", "Sam & Max", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER, 0}, {"samdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, {"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, {"snmidemo", "Sam & Max (Interactive WIP Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, + GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT, 0}, - {"test", "Test demo game", GID_SAMNMAX, 6, GF_NEW_OPCODES | GF_AFTER_V6, 0}, + {"test", "Test demo game", GID_SAMNMAX, 6, GF_NEW_OPCODES, 0}, /* Humongous Entertainment Scumm Version 7 */ {"farmdemo", "Let's Explore the Farm with Buzzy (Demo)", GID_SAMNMAX, 6, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_HEV7 | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_AFTER_HEV7 | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0}, /* Scumm Version 7 */ {"ft", "Full Throttle", GID_FT, 7, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_V7 | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE, 0}, {"dig", "The Dig", GID_DIG, 7, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_V7 | GF_NEW_COSTUMES, 0}, + GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE, 0}, /* Scumm Version 8 */ {"comi", "The Curse of Monkey Island", GID_CMI, 8, - GF_NEW_OPCODES | GF_AFTER_V6 | GF_AFTER_V7 | GF_AFTER_V8 | GF_NEW_COSTUMES | GF_DEFAULT_TO_1X_SCALER, 0}, + GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEFAULT_TO_1X_SCALER, 0}, {NULL, NULL, 0, 0, 0, NULL} }; @@ -634,7 +634,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _mixer->setMusicVolume(kDefaultMusicVolume); // Init iMuse - if (_features & GF_AFTER_V7) { + if (_features & GF_DIGI_IMUSE) { _imuseDigital = new IMuseDigital(this); _imuse = NULL; _playerV2 = NULL; @@ -752,11 +752,10 @@ void Scumm::setFeatures (uint32 newFeatures) { _features = newFeatures; - if (!_bcr || newCostumes!=newNewCostumes) - { + if (!_bcr || newCostumes != newNewCostumes) { delete _bcr; if (newNewCostumes) - _bcr = new AkosRenderer (this); + _bcr = new AkosRenderer(this); else _bcr = new CostumeRenderer(this); } @@ -768,15 +767,15 @@ void Scumm::scummInit() { tempMusic = 0; debug(9, "scummInit"); - if (_features & GF_AFTER_V1) { + if (_version == 1) { initScreens(0, 16, _screenWidth, 152); - } else if (_features & GF_AFTER_V7) { + } else if (_version >= 7) { initScreens(0, 0, _screenWidth, _screenHeight); } else { initScreens(0, 16, _screenWidth, 144); } - if (_features & GF_AFTER_V1) { + if (_version == 1) { for (i = 0; i < 16; i++) _shadowPalette[i] = i; setupC64Palette(); @@ -786,7 +785,7 @@ void Scumm::scummInit() { setupEGAPalette(); } - if (_features & GF_AFTER_V2) { + if (_version <= 2) { initV2MouseOver(); // Seems in V2 there was only a single room effect (iris), // so we set that here. @@ -794,18 +793,18 @@ void Scumm::scummInit() { _switchRoomEffect = 5; } - if (_features & GF_AFTER_V2) + if (_version <= 2) _charset = new CharsetRendererV2(this); - else if (_features & GF_AFTER_V3) + else if (_version == 3) _charset = new CharsetRendererV3(this); - else if (_features & GF_AFTER_V8) + else if (_version == 8) _charset = new CharsetRendererNut(this); else _charset = new CharsetRendererClassic(this); memset(_charsetData, 0, sizeof(_charsetData)); - if (!(_features & GF_SMALL_NAMES) && !(_features & GF_AFTER_V8)) + if (!(_features & GF_SMALL_NAMES) && _version != 8) loadCharset(1); if (_features & GF_OLD_BUNDLE) @@ -842,7 +841,7 @@ void Scumm::scummInit() { _verbs[i].key = 0; } - if (!(_features & GF_AFTER_V7)) { + if (!(_features & GF_NEW_CAMERA)) { camera._leftTrigger = 10; camera._rightTrigger = 30; camera._mode = 0; @@ -851,7 +850,7 @@ void Scumm::scummInit() { virtscr[0].xstart = 0; - if (!(_features & GF_AFTER_V7)) { + if (!(_features & GF_NEW_OPCODES)) { // Setup light _flashlight.xStrips = 7; _flashlight.yStrips = 7; @@ -890,7 +889,7 @@ void Scumm::scummInit() { clearDrawObjectQueue(); for (i = 0; i < 6; i++) { - if (_features & GF_AFTER_V3) { // GF_OLD256 or GF_AFTER_V3 ? + if (_version == 3) { // FIXME - what is this? _string[i].t_xpos = 0; _string[i].t_ypos = 0; } else { @@ -921,7 +920,7 @@ void Scumm::scummInit() { void Scumm::initScummVars() { // FIXME - if (_features & GF_AFTER_V2) { + if (_version <= 2) { // This needs to be at least greater than 40 to get the more // elaborate version of the EGA Zak into. I don't know where // else it makes any difference. @@ -929,13 +928,13 @@ void Scumm::initScummVars() { return; } - if (!(_features & GF_AFTER_V6)) + if (_version < 6) VAR(VAR_V5_TALK_STRING_Y) = -0x50; - if (_features & GF_AFTER_V8) { // Fixme: How do we deal with non-cd installs? + if (_version == 8) { // Fixme: How do we deal with non-cd installs? VAR(VAR_CURRENTDISK) = 1; VAR(VAR_LANGUAGE) = _language; - } else if (_features & GF_AFTER_V7) { + } else if (_version >= 7) { VAR(VAR_V6_EMSSPACE) = 10000; } else { VAR(VAR_CURRENTDRIVE) = 0; @@ -950,16 +949,18 @@ void Scumm::initScummVars() { VAR(VAR_SOUNDPARAM) = 0; VAR(VAR_SOUNDPARAM2) = 0; VAR(VAR_SOUNDPARAM3) = 0; - if (_features & GF_AFTER_V6 && VAR_V6_EMSSPACE != 0xFF) + if (_version >= 6 && VAR_V6_EMSSPACE != 0xFF) VAR(VAR_V6_EMSSPACE) = 10000; VAR(VAR_59) = 3; + } + + if (!(_features & GF_NEW_OPCODES)) { // Setup light VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; } - - + VAR(VAR_CHARINC) = 4; VAR(VAR_TALK_ACTOR) = 0; } @@ -987,7 +988,7 @@ int Scumm::scummLoop(int delta) { // that it will be in a different state each time you run the program. _rnd.getRandomNumber(2); - if (!(_features & GF_AFTER_V2)) { + if (_version > 2) { VAR(VAR_TMR_1) += delta; VAR(VAR_TMR_2) += delta; VAR(VAR_TMR_3) += delta; @@ -1012,16 +1013,16 @@ int Scumm::scummLoop(int delta) { processKbd(); - if (_features & GF_AFTER_V7) { + if (_features & GF_NEW_CAMERA) { VAR(VAR_CAMERA_POS_X) = camera._cur.x; VAR(VAR_CAMERA_POS_Y) = camera._cur.y; - } else if (_features & GF_AFTER_V2) { + } else if (_version <= 2) { VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8; } else { VAR(VAR_CAMERA_POS_X) = camera._cur.x; } VAR(VAR_HAVE_MSG) = (_haveMsg == 0xFE) ? 0xFF : _haveMsg; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8; VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2; } else { @@ -1072,7 +1073,7 @@ load_game: // Ender: Disabled for small_header games, as can overwrite game // variables (eg, Zak256 cashcard values). Temp disabled for V8 // because of odd timing issue with scripts and the variable reset - if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER) && !(_features & GF_AFTER_V8)) + if (success && _saveLoadCompatible && !(_features & GF_SMALL_HEADER) && _version < 8) VAR(VAR_GAME_LOADED) = 201; } else { success = loadState(_saveLoadSlot, _saveLoadCompatible); @@ -1113,7 +1114,7 @@ load_game: drawVerb(i, 0); verbMouseOver(0); - if (_features & GF_AFTER_V2) { + if (_version <= 2) { redrawV2Inventory(); checkV2MouseOver(_mouse); } @@ -1146,7 +1147,7 @@ load_game: CHARSET_1(); if (camera._cur.x != camera._last.x || _BgNeedsRedraw || _fullRedraw - || (_features & GF_AFTER_V7 && camera._cur.y != camera._last.y)) { + || ((_features & GF_NEW_CAMERA) && camera._cur.y != camera._last.y)) { redrawBGAreas(); } @@ -1159,7 +1160,7 @@ load_game: setActorRedrawFlags(); resetActorBgs(); - if (!(_features & GF_AFTER_V7) && + if (!(_features & GF_NEW_OPCODES) && !(VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_screen) && VAR(VAR_CURRENT_LIGHTS) & LIGHTMODE_flashlight) { drawFlashlight(); @@ -1183,18 +1184,18 @@ load_game: } _verbRedraw = false; - if (_features & GF_AFTER_V2) + if (_version <= 2) checkV2MouseOver(_mouse); drawBlastTexts(); drawBlastObjects(); - if (_features & GF_AFTER_V8) + if (_version == 8) processUpperActors(); drawDirtyScreenParts(); removeBlastObjects(); removeBlastTexts(); - if (!(_features & GF_AFTER_V6)) + if (_version <= 5) playActorSounds(); _sound->processSoundQues(); @@ -1254,7 +1255,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr) { _actors[i].hideActor(); } - if (!(_features & GF_AFTER_V7)) { + if (_version < 7) { for (i = 0; i < 256; i++) _shadowPalette[i] = i; if (_features & GF_SMALL_HEADER) @@ -1271,7 +1272,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr) { _currentRoom = room; VAR(VAR_ROOM) = room; - if (room >= 0x80 && !(_features & GF_AFTER_V7)) + if (room >= 0x80 && _version < 7) _roomResource = _resourceMapper[room & 0x7F]; else _roomResource = room; @@ -1298,13 +1299,13 @@ void Scumm::startScene(int room, Actor * a, int objectNr) { else loadRoomObjects(); - if (!(_features & GF_AFTER_V7)) { + if (!(_features & GF_NEW_CAMERA)) { camera._mode = CM_NORMAL; camera._cur.x = camera._dest.x = _screenWidth / 2; camera._cur.y = camera._dest.y = _screenHeight / 2; } - if (_features & GF_AFTER_V6 && VAR_V6_SCREEN_WIDTH != 0xFF) { + if (VAR_V6_SCREEN_WIDTH != 0xFF && VAR_V6_SCREEN_HEIGHT != 0xFF) { VAR(VAR_V6_SCREEN_WIDTH) = _roomWidth; VAR(VAR_V6_SCREEN_HEIGHT) = _roomHeight; } @@ -1312,7 +1313,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr) { VAR(VAR_CAMERA_MIN_X) = _screenWidth / 2; VAR(VAR_CAMERA_MAX_X) = _roomWidth - (_screenWidth / 2); - if (_features & GF_AFTER_V7) { + if (_features & GF_NEW_CAMERA) { VAR(VAR_CAMERA_MIN_Y) = _screenHeight / 2; VAR(VAR_CAMERA_MAX_Y) = _roomHeight - (_screenHeight / 2); setCameraAt(_screenWidth / 2, _screenHeight / 2); @@ -1340,7 +1341,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr) { _egoPositioned = false; runEntryScript(); - if (!(_features & GF_AFTER_V7)) { + if (_version < 7) { if (a && !_egoPositioned) { int x, y; getObjectXYPos(objectNr, x, y); @@ -1399,7 +1400,7 @@ void Scumm::initRoomSubBlocks() { // Determine the room and room script base address roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource); - if (_features & GF_AFTER_V8) + if (_version == 8) roomResPtr = getResourceAddress(rtRoomScripts, _roomResource); if (!roomptr || !roomResPtr) error("Room %d: data not found (" __FILE__ ":%d)", _roomResource, __LINE__); @@ -1412,13 +1413,13 @@ void Scumm::initRoomSubBlocks() { else rmhd = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr); - if (_features & GF_AFTER_V1) { + if (_version == 1) { _roomWidth = roomptr[4] * 8; _roomHeight = roomptr[5] * 8; - } else if (_features & GF_AFTER_V8) { + } else if (_version == 8) { _roomWidth = READ_LE_UINT32(&(rmhd->v8.width)); _roomHeight = READ_LE_UINT32(&(rmhd->v8.height)); - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { _roomWidth = READ_LE_UINT16(&(rmhd->v7.width)); _roomHeight = READ_LE_UINT16(&(rmhd->v7.height)); } else { @@ -1429,7 +1430,7 @@ void Scumm::initRoomSubBlocks() { // // Find the room image data // - if (_features & GF_AFTER_V1) { + if (_version == 1) { _IM00_offs = 0; for(i = 0; i < 4; i++){ gdi._C64Colors[i] = roomptr[6 + i]; @@ -1442,11 +1443,11 @@ void Scumm::initRoomSubBlocks() { gdi._C64ObjectMode = true; } else if (_features & GF_OLD_BUNDLE) { _IM00_offs = READ_LE_UINT16(roomptr + 0x0A); - if (_features & GF_AFTER_V2) + if (_version == 2) _roomStrips = gdi.generateStripTable(roomptr + _IM00_offs, _roomWidth, _roomHeight, _roomStrips); } else if (_features & GF_SMALL_HEADER) _IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr; - else if (_features & GF_AFTER_V8) { + else if (_version == 8) { ptr = findResource(MKID('IMAG'), roomptr); assert(ptr); ptr = findResource(MKID('WRAP'), ptr); @@ -1464,7 +1465,7 @@ void Scumm::initRoomSubBlocks() { // Look for an exit script // int EXCD_len = -1; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { _EXCD_offs = READ_LE_UINT16(roomptr + 0x18); EXCD_len = READ_LE_UINT16(roomptr + 0x1A) - _EXCD_offs + _resourceHeaderSize; // HACK } else if (_features & GF_OLD_BUNDLE) { @@ -1482,7 +1483,7 @@ void Scumm::initRoomSubBlocks() { // Look for an entry script // int ENCD_len = -1; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { _ENCD_offs = READ_LE_UINT16(roomptr + 0x1A); ENCD_len = READ_LE_UINT16(roomptr) - _ENCD_offs + _resourceHeaderSize; // HACK } else if (_features & GF_OLD_BUNDLE) { @@ -1506,7 +1507,7 @@ void Scumm::initRoomSubBlocks() { // Load box data // if (_features & GF_SMALL_HEADER) { - if (_features & GF_AFTER_V2) + if (_version <= 2) ptr = roomptr + *(roomptr + 0x15); else if (_features & GF_OLD_BUNDLE) ptr = roomptr + READ_LE_UINT16(roomptr + 0x15); @@ -1515,9 +1516,9 @@ void Scumm::initRoomSubBlocks() { if (ptr) { byte numOfBoxes = *ptr; int size; - if (_features & GF_AFTER_V2) + if (_version <= 2) size = numOfBoxes * SIZEOF_BOX_V2 + 1; - else if (_features & GF_AFTER_V3) + else if (_version == 3) size = numOfBoxes * SIZEOF_BOX_V3 + 1; else size = numOfBoxes * SIZEOF_BOX + 1; @@ -1525,7 +1526,7 @@ void Scumm::initRoomSubBlocks() { createResource(rtMatrix, 2, size); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); ptr += size; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { size = numOfBoxes * (numOfBoxes + 1); } else if (_features & GF_OLD_BUNDLE) // FIXME. This is an evil HACK!!! @@ -1568,7 +1569,7 @@ void Scumm::initRoomSubBlocks() { ptr = findResourceData(MKID('SCAL'), roomptr); if (ptr) { offs = ptr - roomptr; - if (_features & GF_AFTER_V8) { + if (_version == 8) { for (i = 1; i < _maxScaleTable; i++, offs += 16) { int scale1 = READ_LE_UINT32(roomptr + offs); int y1 = READ_LE_UINT32(roomptr + offs + 4); @@ -1596,7 +1597,7 @@ void Scumm::initRoomSubBlocks() { // Determine the room script base address roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource); - if (_features & GF_AFTER_V8) + if (_version == 8) roomResPtr = getResourceAddress(rtRoomScripts, _roomResource); searchptr = roomResPtr; @@ -1605,7 +1606,7 @@ void Scumm::initRoomSubBlocks() { int num_sounds; int num_scripts; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { num_sounds = *(roomResPtr + 22); num_scripts = *(roomResPtr + 23); ptr = roomptr + 28 + num_objects * 4; @@ -1613,7 +1614,7 @@ void Scumm::initRoomSubBlocks() { loadResource(rtSound, *ptr++); while (num_scripts--) loadResource(rtScript, *ptr++); - } else if (_features & GF_AFTER_V3) { + } else if (_version == 3) { num_sounds = *(roomResPtr + 23); num_scripts = *(roomResPtr + 24); ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts; @@ -1660,11 +1661,11 @@ void Scumm::initRoomSubBlocks() { ptr += _resourceHeaderSize; /* skip tag & size */ - if (_features & GF_AFTER_V8) { + if (_version == 8) { id = READ_LE_UINT32(ptr); checkRange(NUM_LOCALSCRIPT + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); _localScriptList[id - _numGlobalScripts] = ptr + 4 - roomResPtr; - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { id = READ_LE_UINT16(ptr); checkRange(NUM_LOCALSCRIPT + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); _localScriptList[id - _numGlobalScripts] = ptr + 2 - roomResPtr; @@ -1695,7 +1696,7 @@ void Scumm::initRoomSubBlocks() { setPaletteFromRes(); } - if (_features & GF_AFTER_V6) { + if (_version >= 6) { ptr = findResource(MKID('PALS'), roomptr); if (ptr) { _PALS_offs = ptr - roomptr; @@ -1718,7 +1719,7 @@ void Scumm::initRoomSubBlocks() { ptr = findResourceData(MKID('TRNS'), roomptr); if (ptr) gdi._transparentColor = ptr[0]; - else if (_features & GF_AFTER_V8) + else if (_version == 8) gdi._transparentColor = 5; // FIXME else gdi._transparentColor = 255; @@ -1920,7 +1921,7 @@ void Scumm::processKbd() { _virtualMouse.x = _mouse.x + virtscr[0].xstart; - if(_features & GF_AFTER_V7) + if(_features & GF_NEW_CAMERA) _virtualMouse.y = _mouse.y + camera._cur.y - (_screenHeight / 2); else _virtualMouse.y = _mouse.y; @@ -2036,7 +2037,7 @@ int Scumm::getKeyInput() { _mouseButStat = MBS_RIGHT_CLICK; } - if (_features & GF_AFTER_V8) { + if (_version == 8) { VAR(VAR_MOUSE_BUTTONS) = 0; VAR(VAR_MOUSE_HOLD) = 0; VAR(VAR_RIGHTBTN_HOLD) = 0; @@ -2054,10 +2055,10 @@ int Scumm::getKeyInput() { VAR(VAR_RIGHTBTN_HOLD) = 1; VAR(VAR_MOUSE_HOLD) += 2; } - } else if (_features & GF_AFTER_V7) { + } else if (_version == 7) { VAR(VAR_LEFTBTN_HOLD) = (_leftBtnPressed & msDown) != 0; VAR(VAR_RIGHTBTN_HOLD) = (_rightBtnPressed & msDown) != 0; - } else if (_features & GF_AFTER_V2) { + } else if (_version <= 2) { // Store the input type. So far we can't distinguish // between 1, 3 and 5. // 1) Verb 2) Scene 3) Inv. 4) Key @@ -2202,7 +2203,7 @@ int normalizeAngle(int angle) { const char *Scumm::getGameDataPath() const { #ifdef MACOSX - if (_features & GF_AFTER_V8 && !memcmp(_gameDataPath, "/Volumes/MONKEY3_", 17)) { + if (_version == 8 && !memcmp(_gameDataPath, "/Volumes/MONKEY3_", 17)) { // Special case for COMI on Mac OS X. The mount points on OS X depend // on the volume name. Hence if playing from CD, we'd get a problem. // So if loading of a resource file fails, we fall back to the (fixed) @@ -2444,16 +2445,16 @@ void Scumm::launch() { setupOpcodes(); - if (_features & GF_AFTER_V8) + if (_version == 8) _numActors = 80; - else if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX)) + else if ((_version == 7) || (_gameId == GID_SAMNMAX)) _numActors = 30; else if (_gameId == GID_MANIAC) _numActors = 25; else _numActors = 13; - if (_features & GF_AFTER_V7) + if (_version >= 7) OF_OWNER_ROOM = 0xFF; else OF_OWNER_ROOM = 0x0F; @@ -2476,8 +2477,8 @@ void Scumm::launch() { scummInit(); - if (!(_features & GF_AFTER_V2)) { - if (!(_features & GF_AFTER_V7)) + if (_version > 2) { + if (_version < 7) VAR(VAR_VERSION) = 21; VAR(VAR_DEBUGMODE) = _debugMode; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 22f1bf2c08..a02218282d 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -53,7 +53,7 @@ Sound::~Sound() { } void Sound::addSoundToQueue(int sound) { - if (!(_scumm->_features & GF_AFTER_V7)) { + if (!(_scumm->_features & GF_DIGI_IMUSE)) { _scumm->VAR(_scumm->VAR_LAST_SOUND) = sound; _scumm->ensureResourceLoaded(rtSound, sound); addSoundToQueue2(sound); @@ -104,7 +104,7 @@ void Sound::processSoundQues() { ); #endif - if (_scumm->_features & GF_AFTER_V7) { + if (_scumm->_features & GF_DIGI_IMUSE) { if (_scumm->_imuseDigital) _scumm->_imuseDigital->doCommand(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); @@ -390,7 +390,7 @@ void Sound::playSound(int soundID) { } - if (_scumm->_features & GF_OLD_BUNDLE && !(_scumm->_features & GF_AFTER_V1)) { + if (_scumm->_features & GF_OLD_BUNDLE && _scumm->_version != 1) { // FIXME: support amiga sounds uint16 amigatest; amigatest = READ_LE_UINT16(ptr + 12); diff --git a/scumm/string.cpp b/scumm/string.cpp index 43df672ed6..6e0a2b898a 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -90,7 +90,7 @@ void Scumm::CHARSET_1() { // 'secret room while walking' hang. It doesn't do the camera check // when the talk target isn't an actor. The question is, can we make // this a more general case? Does it really need to be Zak specific? - if (!(_features & GF_AFTER_V7) && !(_gameId==GID_ZAK256 && VAR(VAR_TALK_ACTOR) == 0xFF)) { + if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && VAR(VAR_TALK_ACTOR) == 0xFF)) { if ((camera._dest.x >> 3) != (camera._cur.x >> 3) || camera._cur.x != camera._last.x) return; } @@ -100,7 +100,7 @@ void Scumm::CHARSET_1() { a = derefActorSafe(VAR(VAR_TALK_ACTOR), "CHARSET_1"); if (a && _string[0].overhead != 0) { - if (!(_features & GF_AFTER_V6)) { + if (_version <= 5) { _string[0].xpos = a->x - camera._cur.x + (_screenWidth / 2); if (VAR(VAR_V5_TALK_STRING_Y) < 0) { @@ -142,7 +142,7 @@ void Scumm::CHARSET_1() { _charset->_right = _string[0].right; _charset->setColor(_charsetColor); - if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) // FIXME + if (_version > 3) // FIXME for (i = 0; i < 4; i++) _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; @@ -182,7 +182,7 @@ void Scumm::CHARSET_1() { _talkDelay = _defaultTalkDelay; if (!_keepText) { - if ((_features & GF_AFTER_V2 || _features & GF_AFTER_V3) && _gameId != GID_LOOM) { + if (_version <= 3 && _gameId != GID_LOOM) { _charset->_hasMask = true; gdi._mask.left = _string[0].xpos; gdi._mask.top = _string[0].ypos; @@ -202,7 +202,7 @@ void Scumm::CHARSET_1() { } buffer = _charsetBuffer + _charsetBufPos; - if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) + if (_version > 3) _charset->addLinebreaks(0, buffer, 0, t); if (_charset->_center) { @@ -229,7 +229,7 @@ void Scumm::CHARSET_1() { _charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1; } _charset->_nextTop += _charset->getFontHeight(); - if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) { + if (_version > 3) { // FIXME - is this really needed? _charset->_disableOffsX = true; } @@ -244,9 +244,9 @@ void Scumm::CHARSET_1() { _charset->_top = _charset->_nextTop; if(c & 0x80 && _CJKMode) c += *buffer++ * 256; - if (_features & GF_AFTER_V2 || _features & GF_AFTER_V3) { + if (_version <= 3) { _charset->printChar(c); - } else if (_features & GF_AFTER_V6) { + } else if (_version >= 6) { if (!_noSubtitles || (_haveMsg != 0xFE && _haveMsg != 0xFF)) _charset->printChar(c); } else { @@ -256,7 +256,7 @@ void Scumm::CHARSET_1() { _charset->_nextLeft = _charset->_left; _charset->_nextTop = _charset->_top; - if (_features & GF_AFTER_V2) { + if (_version <= 2) { _talkDelay += _defaultTalkDelay / 20; VAR(VAR_CHARCOUNT)++; } else @@ -356,7 +356,7 @@ void Scumm::drawString(int a) { _charset->_disableOffsX = _charset->_firstChar = true; _charset->setCurID(_string[a].charset); - if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) { + if (_version > 3) { for (i = 0; i < 4; i++) _charsetColorMap[i] = _charsetData[_charset->getCurID()][i]; } @@ -382,7 +382,7 @@ void Scumm::drawString(int a) { _charset->_left -= _charset->getStringWidth(a, buf) >> 1; } - if (!(_features & GF_AFTER_V7)) + if (_version < 7) _charset->_ignoreCharsetMask = true; @@ -427,7 +427,7 @@ void Scumm::drawString(int a) { break; } } else { - if (a == 1 && (_features & GF_AFTER_V6)) { + if (a == 1 && _version >= 6) { if (_string[a].no_talk_anim == 0) _charset->_blitAlso = true; } @@ -448,7 +448,7 @@ void Scumm::drawString(int a) { _string[a].xpos = _charset->_str.right + 8; // Indy3: Fixes Grail Diary text positioning - if (_features & GF_AFTER_V7) { + if (_version >= 7) { _charset->_hasMask = true; gdi._mask.extend(_charset->_str); } @@ -478,7 +478,7 @@ const byte *Scumm::addMessageToStack(const byte *msg) { if (chr != 1 && chr != 2 && chr != 3 && chr != 8) { ptr[num++] = *msg++; // and some commands are followed by parameters to the functions below ptr[num++] = *msg++; // these are numbers of names, strings, verbs, variables, etc - if (_features & GF_AFTER_V8) { + if (_version == 8) { ptr[num++] = *msg++; ptr[num++] = *msg++; } @@ -498,7 +498,7 @@ const byte *Scumm::addMessageToStack(const byte *msg) { chr = ptr[num++]; switch (chr) { case 4: - if (_features & GF_AFTER_V8) { + if (_version == 8) { addIntToStack(READ_LE_UINT32(ptr + num)); num += 4; } else { @@ -507,7 +507,7 @@ const byte *Scumm::addMessageToStack(const byte *msg) { } break; case 5: - if (_features & GF_AFTER_V8) { + if (_version == 8) { addVerbToStack(READ_LE_UINT32(ptr + num)); num += 4; } else { @@ -516,7 +516,7 @@ const byte *Scumm::addMessageToStack(const byte *msg) { } break; case 6: - if (_features & GF_AFTER_V8) { + if (_version == 8) { addNameToStack(READ_LE_UINT32(ptr + num)); num += 4; } else { @@ -525,10 +525,10 @@ const byte *Scumm::addMessageToStack(const byte *msg) { } break; case 7: - if (_features & GF_AFTER_V8) { + if (_version == 8) { addStringToStack(READ_LE_UINT32(ptr + num)); num += 4; - } else if (_features & GF_AFTER_V2) { + } else if (_version <= 2) { int var = READ_LE_UINT16(ptr + num); num += 2; char c; @@ -553,7 +553,7 @@ const byte *Scumm::addMessageToStack(const byte *msg) { *_msgPtrToAdd++ = chr; *_msgPtrToAdd++ = ptr[num++]; *_msgPtrToAdd++ = ptr[num++]; - if (_features & GF_AFTER_V8) { + if (_version == 8) { // FIXME - is this right?!? *_msgPtrToAdd++ = ptr[num++]; *_msgPtrToAdd++ = ptr[num++]; @@ -593,7 +593,7 @@ void Scumm::addVerbToStack(int var) for (k = 1; k < _maxVerbs; k++) { if (num == _verbs[k].verbid && !_verbs[k].type && !_verbs[k].saveid) { byte *ptr = getResourceAddress(rtVerb, k); - if ((_features & GF_AFTER_V8) && (ptr[0] == '/')) { + if ((_version == 8) && (ptr[0] == '/')) { char pointer[20]; int i, j; @@ -626,7 +626,7 @@ void Scumm::addNameToStack(int var) if (num) ptr = getObjOrActorName(num); if (ptr) { - if ((_features & GF_AFTER_V8) && (ptr[0] == '/')) { + if ((_version == 8) && (ptr[0] == '/')) { char pointer[20]; int i, j; @@ -649,13 +649,13 @@ void Scumm::addNameToStack(int var) void Scumm::addStringToStack(int var) { byte *ptr; - if (_features & GF_AFTER_V6 || _gameId == GID_INDY3_256) + if (_version >= 6 || _gameId == GID_INDY3_256) var = readVar(var); if (var) { ptr = getStringAddress(var); if (ptr) { - if ((_features & GF_AFTER_V8) && (ptr[0] == '/')) { + if ((_version == 8) && (ptr[0] == '/')) { char pointer[20]; int i, j; diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index 73e60d995d..cdebff4219 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -260,7 +260,7 @@ void Scumm::checkExecVerbs() { return; } runInputScript(2, 0, code); - } else if (_features & GF_AFTER_V2 && zone->number == 2 && _mouse.y > zone->topline + 32) { + } else if (_version <= 2 && zone->number == 2 && _mouse.y > zone->topline + 32) { checkV2Inventory(_mouse.x, _mouse.y); } else { over = checkMouseOver(_mouse.x, _mouse.y); @@ -353,7 +353,7 @@ void Scumm::drawVerb(int verb, int mode) { return; assert(_messagePtr); - if ((_features & GF_AFTER_V8) && (_messagePtr[0] == '/')) { + if ((_version == 8) && (_messagePtr[0] == '/')) { char pointer[20]; int i, j; @@ -429,7 +429,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) { imptr = (obim + 8); } else { imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obim); - if (_features & GF_AFTER_V7) { + if (_version >= 7) { imgw = READ_LE_UINT16(&imhd->v7.width) >> 3; imgh = READ_LE_UINT16(&imhd->v7.height) >> 3; } else { @@ -437,7 +437,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) { imgh = READ_LE_UINT16(&imhd->old.height) >> 3; } - if (_features & GF_AFTER_V8) { + if (_version == 8) { warning("drawVerbBitmap(%d, %d, %d)", verb, x, y); imptr = findResource(MKID('IMAG'), obim); assert(imptr); @@ -453,7 +453,7 @@ void Scumm::drawVerbBitmap(int verb, int x, int y) { error("No image for verb %d", verb); } assert(imptr); - if (_features & GF_AFTER_V1) { + if (_version == 1) { gdi._C64ObjectMode = true; gdi.decodeC64Gfx(imptr, gdi._C64ObjectMap, imgw * imgh * 3); } |