diff options
51 files changed, 1089 insertions, 1099 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 5bfd1d82e2..ffddf7114e 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -45,7 +45,7 @@ ScummEngine *Actor::_vm = 0; void Actor::initActorClass(ScummEngine *scumm) { _vm = scumm; - if (_vm->_features & GF_SMALL_HEADER) { + if (_vm->_game.features & GF_SMALL_HEADER) { kInvalidBox = 255; } } @@ -90,7 +90,7 @@ void Actor::initActor(int mode) { _facing = 180; _heCondMask = 1; _heNoTalkAnimation = 0; - if (_vm->_version >= 7) + if (_vm->_game.version >= 7) _visible = false; _heSkipLimbs = false; } else if (mode == 2) { @@ -116,21 +116,21 @@ void Actor::initActor(int mode) { setActorWalkSpeed(8, 2); _animSpeed = 0; - if (_vm->_version >= 6) + if (_vm->_game.version >= 6) _animProgress = 0; _ignoreBoxes = false; - _forceClip = (_vm->_version >= 7) ? 100 : 0; + _forceClip = (_vm->_game.version >= 7) ? 100 : 0; _ignoreTurns = false; - if (_vm->_heversion >= 61) + if (_vm->_game.heversion >= 61) _flip = 0; _talkFrequency = 256; _talkPan = 64; _talkVolume = 127; - if (_vm->_version <= 2) { + if (_vm->_game.version <= 2) { _initFrame = 2; _walkFrame = 0; _standFrame = 1; @@ -153,7 +153,7 @@ void Actor::initActor(int mode) { _auxBlock.reset(); _hePaletteNum = 0; - _vm->_classData[_number] = (_vm->_version >= 7) ? _vm->_classData[0] : 0; + _vm->_classData[_number] = (_vm->_game.version >= 7) ? _vm->_classData[0] : 0; } void Actor::stopActorMoving() { @@ -175,7 +175,7 @@ void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY) { } int ScummEngine::getAngleFromPos(int x, int y) const { - if (_gameId == GID_DIG || _gameId == GID_CMI) { + if (_game.id == GID_DIG || _game.id == GID_CMI) { double temp = atan2((double)x, (double)-y); return normalizeAngle((int)(temp * 180 / PI)); } else { @@ -255,7 +255,7 @@ int Actor::remapDirection(int dir, bool is_walking) { // not necessary here because we never call the function unless the // actor is in the current room anyway. - if (!_ignoreBoxes || _vm->_gameId == GID_LOOM) { + if (!_ignoreBoxes || _vm->_game.id == GID_LOOM) { specdir = _vm->_extraBoxFlags[_walkbox]; if (specdir) { if (specdir & 0x8000) { @@ -287,7 +287,7 @@ int Actor::remapDirection(int dir, bool is_walking) { switch (flags & 7) { case 1: - if (_vm->_version >= 7) { + if (_vm->_game.version >= 7) { if (dir < 180) return 90; else @@ -299,7 +299,7 @@ int Actor::remapDirection(int dir, bool is_walking) { return (dir == 90) ? 90 : 270; } case 2: - if (_vm->_version >= 7) { + if (_vm->_game.version >= 7) { if (dir > 90 && dir < 270) return 180; else @@ -330,15 +330,15 @@ int Actor::updateActorDirection(bool is_walking) { int dir; bool shouldInterpolate; - if ((_vm->_version == 6) && _ignoreTurns) + if ((_vm->_game.version == 6) && _ignoreTurns) return _facing; - dirType = (_vm->_version >= 7) ? _vm->_costumeLoader->hasManyDirections(_costume) : false; + dirType = (_vm->_game.version >= 7) ? _vm->_costumeLoader->hasManyDirections(_costume) : false; from = toSimpleDir(dirType, _facing); dir = remapDirection(_targetFacing, is_walking); - if (_vm->_version >= 7) + if (_vm->_game.version >= 7) // Direction interpolation interfers with walk scripts in Dig; they perform // (much better) interpolation themselves. shouldInterpolate = false; @@ -425,7 +425,7 @@ int Actor::actorWalkStep() { void Actor::setupActorScale() { - if (_vm->_features & GF_NO_SCALING) { + if (_vm->_game.features & GF_NO_SCALING) { _scalex = 0xFF; _scaley = 0xFF; return; @@ -437,7 +437,7 @@ void Actor::setupActorScale() { // For some boxes, we ignore the scaling and use whatever values the // scripts set. This is used e.g. in the Mystery Vortex in Sam&Max. // Older games used the flag 0x20 differently, though. - if (_vm->_gameId == GID_SAMNMAX && (_vm->getBoxFlags(_walkbox) & kBoxIgnoreScale)) + if (_vm->_game.id == GID_SAMNMAX && (_vm->getBoxFlags(_walkbox) & kBoxIgnoreScale)) return; _boxscale = _vm->getBoxScale(_walkbox); @@ -449,7 +449,7 @@ void Actor::setupActorScale() { } void Actor::startAnimActor(int f) { - if (_vm->_version >= 7 && !((_vm->_gameId == GID_FT) && (_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (_vm->_game.version >= 7 && !((_vm->_game.id == GID_FT) && (_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { switch (f) { case 1001: f = _initFrame; @@ -503,7 +503,7 @@ void Actor::startAnimActor(int f) { _needRedraw = true; // V1 - V2 games don't seem to need a _cost.reset() at this point. // Causes Zak to lose his body in several scenes, see bug #771508 - if (_vm->_version >= 3 && f == _initFrame) { + if (_vm->_game.version >= 3 && f == _initFrame) { _cost.reset(); _auxBlock.reset(); } @@ -516,7 +516,7 @@ void Actor::startAnimActor(int f) { void Actor::animateActor(int anim) { int cmd, dir; - if (_vm->_version >= 7 && !((_vm->_gameId == GID_FT) && (_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (_vm->_game.version >= 7 && !((_vm->_game.id == GID_FT) && (_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { if (anim == 0xFF) anim = 2000; @@ -547,7 +547,7 @@ void Actor::animateActor(int anim) { turnToDirection(dir); break; default: - if (_vm->_version <= 2) + if (_vm->_game.version <= 2) startAnimActor(anim / 4); else startAnimActor(anim); @@ -576,7 +576,7 @@ void Actor::setDirection(int direction) { vald = _cost.frame[i]; if (vald == 0xFFFF) continue; - _vm->_costumeLoader->costumeDecodeData(this, vald, (_vm->_version <= 2) ? 0xFFFF : aMask); + _vm->_costumeLoader->costumeDecodeData(this, vald, (_vm->_game.version <= 2) ? 0xFFFF : aMask); } _needRedraw = true; @@ -613,7 +613,7 @@ void Actor::putActor(int dstX, int dstY, byte newRoom) { // WORKAROUND: The green transparency of the tank in the Hall of Oddities is // is positioned one pixel too far to the left. This appears to be a // bug in the original game as well. - if (_vm->_gameId == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236) + if (_vm->_game.id == GID_SAMNMAX && newRoom == 16 && _number == 5 && dstX == 235 && dstY == 236) dstX++; _pos.x = dstX; @@ -634,7 +634,7 @@ void Actor::putActor(int dstX, int dstY, byte newRoom) { adjustActorPos(); } else { #ifndef DISABLE_HE - if (_vm->_heversion >= 71) + if (_vm->_game.heversion >= 71) ((ScummEngine_v71he *)_vm)->queueAuxBlock(this); #endif hideActor(); @@ -661,7 +661,7 @@ AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) { int tmpDist, bestDist, threshold, numBoxes; byte flags, bestBox; int box; - const int firstValidBox = (_vm->_features & GF_SMALL_HEADER) ? 0 : 1; + const int firstValidBox = (_vm->_game.features & GF_SMALL_HEADER) ? 0 : 1; abr.x = dstX; abr.y = dstY; @@ -677,8 +677,8 @@ AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY) { if (numBoxes < firstValidBox) return abr; - bestDist = (_vm->_version >= 7) ? 0x7FFFFFFF : 0xFFFF; - if (_vm->_version <= 2) + bestDist = (_vm->_game.version >= 7) ? 0x7FFFFFFF : 0xFFFF; + if (_vm->_game.version <= 2) bestDist *= 8*2; // Adjust for the fact that we multiply x by 8 and y by 2 bestBox = kInvalidBox; @@ -778,7 +778,7 @@ void Actor::turnToDirection(int newdir) { _moving &= ~MF_TURN; if (newdir != _facing) { - if (_vm->_version <= 6) + if (_vm->_game.version <= 6) _moving = MF_TURN; else _moving |= MF_TURN; @@ -811,7 +811,7 @@ void Actor::showActor() { if (_costumeNeedsInit) { startAnimActor(_initFrame); - if (_vm->_version <= 2) { + if (_vm->_game.version <= 2) { startAnimActor(_standFrame); startAnimActor(_talkStopFrame); } @@ -819,7 +819,7 @@ void Actor::showActor() { } // FIXME: Evil hack to work around bug #770717 - if (!_moving && _vm->_version <= 2) + if (!_moving && _vm->_game.version <= 2) startAnimActor(_standFrame); stopActorMoving(); @@ -831,14 +831,14 @@ void Actor::showActor() { // an internal variable. Emulate this to prevent overwriting script vars... // Maniac NES (V1), however, DOES have a ScummVar for VAR_TALK_ACTOR int ScummEngine::getTalkingActor() { - if (_gameId == GID_MANIAC && _version == 1 && !(_platform == Common::kPlatformNES)) + if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) return _V1TalkingActor; else return VAR(VAR_TALK_ACTOR); } void ScummEngine::setTalkingActor(int value) { - if (_gameId == GID_MANIAC && _version == 1 && !(_platform == Common::kPlatformNES)) + if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) _V1TalkingActor = value; else VAR(VAR_TALK_ACTOR) = value; @@ -866,7 +866,7 @@ void ScummEngine::setupV1ActorTalkColor() { int i; for (i = 1; i < _numActors; i++) { - if (_platform == Common::kPlatformC64) { + if (_game.platform == Common::kPlatformC64) { _actors[i]._talkColor = c64MMActorTalkColor[i]; } else { _actors[i]._talkColor = v1MMActorTalkColor[i]; @@ -888,7 +888,7 @@ void ScummEngine::walkActors() { for (i = 1; i < _numActors; i++) { if (_actors[i].isInCurrentRoom()) - if (_version <= 3) + if (_game.version <= 3) _actors[i].walkActorOld(); else _actors[i].walkActor(); @@ -947,7 +947,7 @@ void ScummEngine::processActors() { // Make a list of all actors in this room for (int i = 1; i < _numActors; i++) { - if (_version == 8 && _actors[i]._layer < 0) + if (_game.version == 8 && _actors[i]._layer < 0) continue; if (_actors[i].isInCurrentRoom()) { _sortedActors[numactors++] = &_actors[i]; @@ -973,7 +973,7 @@ void ScummEngine::processActors() { // and, according to cyx, neither do newer ones. At least not FT and // COMI. See bug #1220168 for more details. - if (_gameId == GID_SAMNMAX) { + if (_game.id == GID_SAMNMAX) { for (int j = 0; j < numactors; ++j) { for (int i = 0; i < numactors; ++i) { int sc_actor1 = _sortedActors[j]->_pos.y; @@ -1015,7 +1015,7 @@ void ScummEngine::processActors() { } } - if (_features & GF_NEW_COSTUMES) + if (_game.features & GF_NEW_COSTUMES) akos_processQueue(); } @@ -1084,12 +1084,12 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_actorX = _pos.x + _offsX - _vm->virtscr[0].xstart; bcr->_actorY = _pos.y + _offsY - _elevation; - if (_vm->_platform == Common::kPlatformNES) { + if (_vm->_game.platform == Common::kPlatformNES) { // In the NES version, when the actor is facing right, // we need to shift it 8 pixels to the left if (_facing == 90) bcr->_actorX -= 8; - } else if (_vm->_version <= 2) { + } else if (_vm->_game.version <= 2) { // HACK: We have to adjust the x position by one strip (8 pixels) in // V2 games. However, it is not quite clear to me why. And to fully // match the original, it seems we have to offset by 2 strips if the @@ -1098,13 +1098,13 @@ void Actor::drawActorCostume(bool hitTestMode) { // to adjust the 270 degree case... if (_facing == 270) bcr->_actorX += 16; - else if (_vm->_version == 2) + else if (_vm->_game.version == 2) bcr->_actorX += 8; } bcr->_clipOverride = _clipOverride; - if (_vm->_version == 4 && _boxscale & 0x8000) { + if (_vm->_game.version == 4 && _boxscale & 0x8000) { bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((_boxscale & 0x7fff) + 1, _pos.x, _pos.y); } else { bcr->_scaleX = _scalex; @@ -1112,9 +1112,9 @@ void Actor::drawActorCostume(bool hitTestMode) { } bcr->_shadow_mode = _shadowMode; - if (_vm->_version >= 5 && _vm->_heversion == 0) { + if (_vm->_game.version >= 5 && _vm->_game.heversion == 0) { bcr->_shadow_table = _vm->_shadowPalette; - } else if (_vm->_heversion == 70) { + } else if (_vm->_game.heversion == 70) { bcr->_shadow_table = _vm->_HEV7ActorPalette; } @@ -1122,7 +1122,7 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->setPalette(_palette); bcr->setFacing(this); - if (_vm->_version >= 7) { + if (_vm->_game.version >= 7) { bcr->_zbuf = _forceClip; if (bcr->_zbuf == 100) { @@ -1150,7 +1150,7 @@ void Actor::drawActorCostume(bool hitTestMode) { bcr->_skipLimbs = (_heSkipLimbs != 0); bcr->_paletteNum = _hePaletteNum; - if (_vm->_heversion >= 80 && _heNoTalkAnimation == 0 && _animProgress == 0) { + if (_vm->_game.heversion >= 80 && _heNoTalkAnimation == 0 && _animProgress == 0) { if (_vm->getTalkingActor() == _number && !_vm->_string[0].no_talk_anim) { int talkState = 0; @@ -1170,7 +1170,7 @@ void Actor::drawActorCostume(bool hitTestMode) { // If the actor is partially hidden, redraw it next frame. // Only done for pre-AKOS, though. if (bcr->drawCostume(_vm->virtscr[0], _vm->gdi._numStrips, this, _drawToBackBuf) & 1) { - _needRedraw = (_vm->_version <= 6); + _needRedraw = (_vm->_game.version <= 6); } if (!hitTestMode) { @@ -1263,7 +1263,7 @@ void ScummEngine::setActorRedrawFlags() { // Redraw all actors if a full redraw was requested. // Also redraw all actors in COMI (see bug #1066329 for details). - if (_fullRedraw || _version == 8 || (VAR_REDRAW_ALL_ACTORS != 0xFF && VAR(VAR_REDRAW_ALL_ACTORS) != 0)) { + if (_fullRedraw || _game.version == 8 || (VAR_REDRAW_ALL_ACTORS != 0xFF && VAR(VAR_REDRAW_ALL_ACTORS) != 0)) { for (j = 1; j < _numActors; j++) { _actors[j]._needRedraw = true; } @@ -1312,7 +1312,7 @@ int ScummEngine::getActorFromPos(int x, int y) { for (i = 1; i < _numActors; i++) { if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) && y >= _actors[i]._top && y <= _actors[i]._bottom) { - if (_version > 2 || i != VAR(VAR_EGO)) + if (_game.version > 2 || i != VAR(VAR_EGO)) return i; } } @@ -1348,7 +1348,7 @@ void ScummEngine_v7::actorTalk(const byte *msg) { // Play associated speech, if any playSpeech((byte *)_lastStringTag); - if ((_version == 7 && !_keepText) || (_version == 8 && VAR(VAR_HAVE_MSG))) { + if ((_game.version == 7 && !_keepText) || (_game.version == 8 && VAR(VAR_HAVE_MSG))) { stopTalk(); } if (_actorToPrintStrFor == 0xFF) { @@ -1371,11 +1371,11 @@ void ScummEngine_v7::actorTalk(const byte *msg) { _charsetBufPos = 0; _talkDelay = 0; _haveMsg = 1; - if (_version == 7) + if (_game.version == 7) VAR(VAR_HAVE_MSG) = 0xFF; _haveActorSpeechMsg = true; CHARSET_1(); - if (_version == 8) + if (_game.version == 8) VAR(VAR_HAVE_MSG) = (_string[0].no_talk_anim) ? 2 : 1; } #endif @@ -1386,7 +1386,7 @@ void ScummEngine::actorTalk(const byte *msg) { convertMessageToString(msg, _charsetBuffer, sizeof(_charsetBuffer)); // FIXME: Workaround for bugs #770039 and #770049 - if (_gameId == GID_LOOM) { + if (_game.id == GID_LOOM) { if (!*_charsetBuffer) return; } @@ -1400,7 +1400,7 @@ void ScummEngine::actorTalk(const byte *msg) { int oldact; // WORKAROUND bug #770724 - if (_gameId == GID_LOOM && _roomResource == 23 && + if (_game.id == GID_LOOM && _roomResource == 23 && vm.slot[_currentScript].number == 232 && _actorToPrintStrFor == 0) { _actorToPrintStrFor = 2; // Could be anything from 2 to 5. Maybe compare to original? } @@ -1424,9 +1424,9 @@ void ScummEngine::actorTalk(const byte *msg) { return; } - if (_heversion >= 72 || getTalkingActor() > 0x7F) { + if (_game.heversion >= 72 || getTalkingActor() > 0x7F) { _charsetColor = (byte)_string[0].color; - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { if (_NES_lastTalkingActor != getTalkingActor()) _NES_talkColor ^= 1; _NES_lastTalkingActor = getTalkingActor(); @@ -1446,7 +1446,7 @@ void ScummEngine::actorTalk(const byte *msg) { } void Actor::runActorTalkScript(int f) { - if (_vm->_version == 8 && _vm->VAR(_vm->VAR_HAVE_MSG) == 2) + if (_vm->_game.version == 8 && _vm->VAR(_vm->VAR_HAVE_MSG) == 2) return; if (_talkScript) { @@ -1474,21 +1474,21 @@ void ScummEngine::stopTalk() { act = getTalkingActor(); if (act && act < 0x80) { Actor *a = derefActor(act, "stopTalk"); - if ((_version >= 7 && !_string[0].no_talk_anim) || - (_version <= 6 && a->isInCurrentRoom() && _useTalkAnims)) { + if ((_game.version >= 7 && !_string[0].no_talk_anim) || + (_game.version <= 6 && a->isInCurrentRoom() && _useTalkAnims)) { a->runActorTalkScript(a->_talkStopFrame); _useTalkAnims = false; } - if (_version <= 7 && _heversion == 0) + if (_game.version <= 7 && _game.heversion == 0) setTalkingActor(0xFF); a->_heTalking = false; } - if (_version == 8 || _heversion >= 60) + if (_game.version == 8 || _game.heversion >= 60) setTalkingActor(0); - if (_version == 8) + if (_game.version == 8) VAR(VAR_HAVE_MSG) = 0; _keepText = false; - if (_version >= 7) { + if (_game.version >= 7) { #ifndef DISABLE_SCUMM_7_8 ((ScummEngine_v7 *)this)->clearSubtitleQueue(); #endif @@ -1500,7 +1500,7 @@ void ScummEngine::stopTalk() { void Actor::setActorCostume(int c) { int i; - if (_vm->_heversion >= 61 && (c == -1 || c == -2)) { + if (_vm->_game.heversion >= 61 && (c == -1 || c == -2)) { _heSkipLimbs = (c == -1); _needRedraw = true; return; @@ -1508,16 +1508,16 @@ void Actor::setActorCostume(int c) { // Based on disassembly. It seems that high byte is not used at all, though // it is attached to all horizontally flipped object, like left eye. - if (_vm->_heversion == 61) + if (_vm->_game.heversion == 61) c &= 0xff; _costumeNeedsInit = true; - if (_vm->_features & GF_NEW_COSTUMES) { + if (_vm->_game.features & GF_NEW_COSTUMES) { memset(_animVariable, 0, sizeof(_animVariable)); #ifndef DISABLE_HE - if (_vm->_heversion >= 71) + if (_vm->_game.heversion >= 71) ((ScummEngine_v71he *)_vm)->queueAuxBlock(this); #endif @@ -1545,18 +1545,18 @@ void Actor::setActorCostume(int c) { // V1 zak uses palette[] as a dynamic costume color array. - if (_vm->_version == 1) + if (_vm->_game.version == 1) return; - if (_vm->_features & GF_NEW_COSTUMES) { + if (_vm->_game.features & GF_NEW_COSTUMES) { for (i = 0; i < 256; i++) _palette[i] = 0xFF; - } else if (_vm->_features & GF_OLD_BUNDLE) { + } else if (_vm->_game.features & GF_OLD_BUNDLE) { for (i = 0; i < 16; i++) _palette[i] = i; // Make stuff more visible on CGA. Based on disassembly - if (_vm->_renderMode == Common::kRenderCGA && _vm->_version > 2) { + if (_vm->_renderMode == Common::kRenderCGA && _vm->_game.version > 2) { _palette[6] = 5; _palette[7] = 15; } @@ -1565,8 +1565,8 @@ void Actor::setActorCostume(int c) { _palette[i] = 0xFF; } - if (_vm->_heversion >= 71 && _vm->getTalkingActor() == _number) { - if (_vm->_heversion <= 95 || (_vm->_heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) { + if (_vm->_game.heversion >= 71 && _vm->getTalkingActor() == _number) { + if (_vm->_game.heversion <= 95 || (_vm->_game.heversion >= 98 && _vm->VAR(_vm->VAR_SKIP_RESET_TALK_ACTOR) == 0)) { //_vm->setTalkingActor(0); } } @@ -1575,19 +1575,19 @@ void Actor::setActorCostume(int c) { void Actor::startWalkActor(int destX, int destY, int dir) { AdjustBoxResult abr; - if (!isInCurrentRoom() && _vm->_version >= 7) { + if (!isInCurrentRoom() && _vm->_game.version >= 7) { debug(0, "startWalkActor: attempting to walk actor %d who is not in this room", _number); return; } - if (_vm->_version <= 4) { + if (_vm->_game.version <= 4) { abr.x = destX; abr.y = destY; } else { abr = adjustXYToBeInBox(destX, destY); } - if (!isInCurrentRoom() && _vm->_version <= 6) { + if (!isInCurrentRoom() && _vm->_game.version <= 6) { _pos.x = abr.x; _pos.y = abr.y; if (_ignoreTurns == false && dir != -1) @@ -1658,7 +1658,7 @@ void Actor::walkActor() { int new_dir, next_box; Common::Point foundPath; - if (_vm->_version >= 7) { + if (_vm->_game.version >= 7) { if (_moving & MF_FROZEN) { if (_moving & MF_TURN) { new_dir = updateActorDirection(false); @@ -1837,7 +1837,7 @@ void Actor::walkActorOld() { // WORKAROUND: To fully fix bug #774783, we add a special case // here, resulting in a different next_box value for Hitler. - if ((_vm->_gameId == GID_INDY3) && _vm->_roomResource == 46 && _walkbox == 1 && _walkdata.destbox == 0 && _number == 9) + if ((_vm->_game.id == GID_INDY3) && _vm->_roomResource == 46 && _walkbox == 1 && _walkdata.destbox == 0 && _number == 9) next_box = 1; if (next_box < 0) { @@ -1856,7 +1856,7 @@ void Actor::walkActorOld() { _walkdata.curbox = next_box; - if (_vm->_version <= 2) { + if (_vm->_game.version <= 2) { _vm->getClosestPtOnBox(_walkdata.curbox, _pos.x, _pos.y, p2.x, p2.y); _vm->getClosestPtOnBox(_walkbox, p2.x, p2.y, p3.x, p3.y); // FIXME: Work in progress @@ -1997,14 +1997,14 @@ bool Actor::isInClass(int cls) { } bool Actor::isPlayer() { - if (_vm->_version <= 2) + if (_vm->_game.version <= 2) return _vm->VAR(42) <= _number && _number <= _vm->VAR(43); else return isInClass(kObjectClassPlayer); } void Actor::setUserCondition(int slot, int set) { - const int condMaskCode = (_vm->_heversion >= 90) ? 0x1FFF : 0x3FF; + const int condMaskCode = (_vm->_game.heversion >= 90) ? 0x1FFF : 0x3FF; checkRange(32, 1, slot, "Condition %d out of range"); if (set == 0) { _heCondMask &= ~(1 << (slot + 0xF)); @@ -2024,7 +2024,7 @@ bool Actor::isUserConditionSet(int slot) const { } void Actor::setTalkCondition(int slot) { - const int condMaskCode = (_vm->_heversion >= 90) ? 0x1FFF : 0x3FF; + const int condMaskCode = (_vm->_game.heversion >= 90) ? 0x1FFF : 0x3FF; checkRange(32, 1, slot, "Condition %d out of range"); _heCondMask = (_heCondMask & ~condMaskCode) | 1; if (slot != 1) { diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 858e722579..79824a53d0 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -168,7 +168,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { loadCostume(a->_costume); - if (_vm->_version >= 7 && hasManyDirections()) + if (_vm->_game.version >= 7 && hasManyDirections()) anim = toSimpleDir(1, a->getFacing()) + frame * 8; else anim = newDirToOldDir(a->getFacing()) + frame * 4; @@ -302,7 +302,7 @@ void AkosRenderer::setPalette(byte *new_palette) { if (size > 256) error("akos_setPalette: %d is too many colors", size); - if (_vm->_heversion >= 99 && _paletteNum) { + if (_vm->_game.heversion >= 99 && _paletteNum) { for (i = 0; i < size; i++) palette[i] = (byte)_vm->_hePalettes[_paletteNum * 1024 + 768 + akpl[i]]; } else { @@ -311,7 +311,7 @@ void AkosRenderer::setPalette(byte *new_palette) { } } - if (_vm->_heversion == 70) { + if (_vm->_game.heversion == 70) { for (i = 0; i < size; i++) palette[i] = _vm->_HEV7ActorPalette[palette[i]]; } @@ -375,7 +375,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) { if (_skipLimbs) return 0; - if (_vm->_heversion >= 70 && cost.active[limb] == 8) + if (_vm->_game.heversion >= 70 && cost.active[limb] == 8) return 0; if (!cost.active[limb] || cost.stopped & (1 << limb)) @@ -476,11 +476,11 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) { } else { uint32 type = cond & ~0x3FFFFFFF; cond &= 0x3FFFFFFF; - if (_vm->_heversion >= 90) { + if (_vm->_game.heversion >= 90) { shadowMask = cond & 0xE000; cond &= ~0xE000; } - if (_vm->_heversion >= 90 && cond == 0) { + if (_vm->_game.heversion >= 90 && cond == 0) { decflag = 1; } else if (type == 0x40000000) { // restored_bit decflag = (a->_heCondMask & cond) ? 1 : 0; @@ -497,7 +497,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) { if (decflag == 0) continue; - if (_vm->_heversion >= 90) { + if (_vm->_game.heversion >= 90) { _shadow_mode = ((shadowMask & 0x8000) && xmap) ? 3 : 0; } @@ -572,7 +572,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) { } else if (_shadow_mode == 2) { error("codec1_spec2"); // TODO } else if (_shadow_mode == 3) { - if (_vm->_heversion >= 90) { + if (_vm->_game.heversion >= 90) { pcolor = (pcolor << 8) + *dst; pcolor = xmap[pcolor]; } else if (pcolor < 8) { @@ -765,7 +765,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { byte drawFlag = 1; Codec1 v1; - const int scaletableSize = (_vm->_heversion >= 61) ? 128 : 384; + const int scaletableSize = (_vm->_game.heversion >= 61) ? 128 : 384; /* implement custom scale table */ @@ -774,7 +774,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { // smallCostumeScaleTable from costume.cpp is used here // So I had to put copy of it back here as it was before 1.227 revision // of this file. - v1.scaletable = (_vm->_heversion >= 61) ? smallCostumeScaleTableAKOS : bigCostumeScaleTable; + v1.scaletable = (_vm->_game.heversion >= 61) ? smallCostumeScaleTableAKOS : bigCostumeScaleTable; if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->res.isResourceLoaded(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) { v1.scaletable = _vm->getStringAddressVar(_vm->VAR_CUSTOMSCALETABLE); } @@ -897,7 +897,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { v1.skip_width = _width; v1.scaleXstep = _mirror ? 1 : -1; - if (_vm->_heversion >= 71) { + if (_vm->_game.heversion >= 71) { if (_clipOverride.right > _clipOverride.left && _clipOverride.bottom > _clipOverride.top) { if (rect.left < _clipOverride.left) rect.left = _clipOverride.left; @@ -1148,7 +1148,7 @@ void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, in while (t_height--) { akos16DecodeLine(tmp_buf, t_width, dir); bompApplyMask(akos16.buffer, maskptr, maskbit, t_width, transparency); - bool HE7Check = (_vm->_heversion == 70); + bool HE7Check = (_vm->_game.heversion == 70); bompApplyShadow(_shadow_mode, _shadow_table, akos16.buffer, dest, t_width, transparency, HE7Check); if (numskip_after != 0) { @@ -1163,7 +1163,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { Common::Rect clip; int32 minx, miny, maxw, maxh; int32 skip_x, skip_y, cur_x, cur_y; - byte transparency = (_vm->_heversion >= 61) ? palette[0] : 255; + byte transparency = (_vm->_game.heversion >= 61) ? palette[0] : 255; if (_actorHitMode) { error("codec16: _actorHitMode not yet implemented"); @@ -1184,7 +1184,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { maxw = _out.w; maxh = _out.h; - if (_vm->_heversion >= 71) { + if (_vm->_game.heversion >= 71) { if (_clipOverride.right > _clipOverride.left && _clipOverride.bottom > _clipOverride.top) { minx = _clipOverride.left; miny = _clipOverride.top; @@ -1319,7 +1319,7 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { _draw_bottom = dst.bottom; const uint8 *palPtr = NULL; - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { palPtr = _vm->_hePalettes + 1792; } @@ -1413,7 +1413,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const curpos += 3; break; case AKC_SoundStuff: - if (_heversion >= 61) + if (_game.heversion >= 61) curpos += 6; else curpos += 8; @@ -1529,7 +1529,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const a->_flip = GW(2) != 0; continue; case AKC_CmdQue3: - if (_heversion >= 61) + if (_game.heversion >= 61) tmp = GB(2); else tmp = GB(2) - 1; @@ -1555,7 +1555,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const akos_queCommand(5, a, GB(2), 0); continue; case AKC_SoundStuff: - if (_heversion >= 61) + if (_game.heversion >= 61) continue; tmp = GB(2) - 1; if (tmp >= 8) @@ -1572,7 +1572,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const if (akfo == NULL) error("akos_increaseAnim: no AKFO table"); tmp = a->getAnimVar(GB(2)) - 1; - if (_heversion >= 80) { + if (_game.heversion >= 80) { if (tmp < 0 || tmp > a->_cost.heJumpCountTable[chan] - 1) error("akos_increaseAnim: invalid jump value %d", tmp); curpos = READ_LE_UINT16(akfo + a->_cost.heJumpOffsetTable[chan] + tmp * 2); @@ -1615,7 +1615,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const continue; case AKC_Ignore2: - if (_heversion >= 71) + if (_game.heversion >= 71) akos_queCommand(3, a, a->_sound[a->getAnimVar(GB(2))], 0); continue; @@ -1763,7 +1763,7 @@ void ScummEngine::akos_processQueue() { break; case 7: #ifndef DISABLE_HE - assert(_heversion >= 71); + assert(_game.heversion >= 71); ((ScummEngine_v71he *)this)->queueAuxEntry(a->_number, param_1); #endif break; diff --git a/engines/scumm/base-costume.cpp b/engines/scumm/base-costume.cpp index e93b5b80cd..913b462574 100644 --- a/engines/scumm/base-costume.cpp +++ b/engines/scumm/base-costume.cpp @@ -43,10 +43,10 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const _numStrips = numStrips; - if (_vm->_version == 1) { + if (_vm->_game.version == 1) { _xmove = 0; _ymove = 0; - } else if (_vm->_features & GF_OLD_BUNDLE) { + } else if (_vm->_game.features & GF_OLD_BUNDLE) { _xmove = -72; _ymove = -100; } else { diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index 4460519480..33707d971e 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -88,7 +88,7 @@ static Common::Point closestPtOnLine(const Common::Point &start, const Common::P byte ScummEngine::getMaskFromBox(int box) { // Fix for bug #740244 and #755863. This appears to have been a // long standing bug in the original engine? - if (_version <= 3 && box == 255) + if (_game.version <= 3 && box == 255) return 1; Box *ptr = getBoxBaseAddr(box); @@ -97,12 +97,12 @@ byte ScummEngine::getMaskFromBox(int box) { // WORKAROUND for bug #847827: This is a bug in the data files, as it also // occurs with the original engine. We work around it here anyway. - if (_gameId == GID_INDY4 && _currentRoom == 225 && _roomResource == 94 && box == 8) + if (_game.id == GID_INDY4 && _currentRoom == 225 && _roomResource == 94 && box == 8) return 0; - if (_version == 8) + if (_game.version == 8) return (byte) FROM_LE_32(ptr->v8.mask); - else if (_version <= 2) + else if (_game.version <= 2) return ptr->v2.mask; else return ptr->old.mask; @@ -119,9 +119,9 @@ void ScummEngine::setBoxFlags(int box, int val) { Box *ptr = getBoxBaseAddr(box); if (!ptr) return; - if (_version == 8) + if (_game.version == 8) ptr->v8.flags = TO_LE_32(val); - else if (_version <= 2) + else if (_game.version <= 2) ptr->v2.flags = val; else ptr->old.flags = val; @@ -132,9 +132,9 @@ byte ScummEngine::getBoxFlags(int box) { Box *ptr = getBoxBaseAddr(box); if (!ptr) return 0; - if (_version == 8) + if (_game.version == 8) return (byte) FROM_LE_32(ptr->v8.flags); - else if (_version <= 2) + else if (_game.version <= 2) return ptr->v2.flags; else return ptr->old.flags; @@ -143,9 +143,9 @@ byte ScummEngine::getBoxFlags(int box) { void ScummEngine::setBoxScale(int box, int scale) { Box *ptr = getBoxBaseAddr(box); assert(ptr); - if (_version == 8) + if (_game.version == 8) ptr->v8.scale = TO_LE_32(scale); - else if (_version <= 2) + else if (_game.version <= 2) error("This should not ever be called!"); else ptr->old.scale = TO_LE_16(scale); @@ -158,7 +158,7 @@ void ScummEngine::setBoxScaleSlot(int box, int slot) { } int ScummEngine::getScale(int box, int x, int y) { - if (_features & GF_NO_SCALING) + if (_game.features & GF_NO_SCALING) return 255; Box *ptr = getBoxBaseAddr(box); @@ -167,7 +167,7 @@ int ScummEngine::getScale(int box, int x, int y) { int slot , scale; - if (_version == 8) { + if (_game.version == 8) { // COMI has a separate field for the scale slot... slot = FROM_LE_32(ptr->v8.scaleSlot); scale = FROM_LE_32(ptr->v8.scale); @@ -225,12 +225,12 @@ int ScummEngine::getScaleFromSlot(int slot, int x, int y) { } int ScummEngine::getBoxScale(int box) { - if (_features & GF_NO_SCALING) + if (_game.features & GF_NO_SCALING) return 255; Box *ptr = getBoxBaseAddr(box); if (!ptr) return 255; - if (_version == 8) + if (_game.version == 8) return FROM_LE_32(ptr->v8.scale); else return READ_LE_UINT16(&ptr->old.scale); @@ -359,7 +359,7 @@ byte ScummEngine::getNumBoxes() { byte *ptr = getResourceAddress(rtMatrix, 2); if (!ptr) return 0; - if (_version == 8) + if (_game.version == 8) return (byte) READ_LE_UINT32(ptr); else return ptr[0]; @@ -372,7 +372,7 @@ Box *ScummEngine::getBoxBaseAddr(int box) { // The NES version of Maniac Mansion attempts to set flags for boxes 2-4 // when there are only three boxes (0-2) when walking out to the garage. - if ((_gameId == GID_MANIAC) && (_platform == Common::kPlatformNES) && (box >= ptr[0])) + if ((_game.id == GID_MANIAC) && (_game.platform == Common::kPlatformNES) && (box >= ptr[0])) return NULL; // FIXME: In "pass to adventure", the loom demo, when bobbin enters @@ -389,17 +389,17 @@ Box *ScummEngine::getBoxBaseAddr(int box) { // checking at all. All the problems so far have been cases where // the value was exactly one more than what we consider the maximum. // So it's very well possible that all of these are script errors. - if (_version <= 4 && ptr[0] == box) + if (_game.version <= 4 && ptr[0] == box) box--; checkRange(ptr[0] - 1, 0, box, "Illegal box %d"); - if (_version <= 2) + if (_game.version <= 2) return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1); - else if (_version == 3) + else if (_game.version == 3) return (Box *)(ptr + box * SIZEOF_BOX_V3 + 1); - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) return (Box *)(ptr + box * SIZEOF_BOX + 1); - else if (_version == 8) + else if (_game.version == 8) return (Box *)(ptr + box * SIZEOF_BOX_V8 + 4); else return (Box *)(ptr + box * SIZEOF_BOX + 2); @@ -473,7 +473,7 @@ void ScummEngine::getBoxCoordinates(int boxnum, BoxCoords *box) { Box *bp = getBoxBaseAddr(boxnum); assert(bp); - if (_version == 8) { + if (_game.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); @@ -501,7 +501,7 @@ void ScummEngine::getBoxCoordinates(int boxnum, BoxCoords *box) { SWAP(box->ul, box->ur); SWAP(box->ll, box->lr); } - } else if (_version <= 2) { + } else if (_game.version <= 2) { box->ul.x = bp->v2.ulx * 8; box->ul.y = bp->v2.uy * 2; box->ur.x = bp->v2.urx * 8; @@ -720,7 +720,7 @@ int ScummEngine::getPathToDestBox(byte from, byte to) { boxm = getBoxMatrixBaseAddr(); - if (_version <= 2) { + if (_game.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. @@ -744,7 +744,7 @@ int ScummEngine::getPathToDestBox(byte from, byte to) { // WORKAROUND #2: In addition to the above, we have to add this special // case to fix the scene in Indy3 where Indy meets Hitler in Berlin. // See bug #770690 and also bug #774783. - if ((_gameId == GID_INDY3) && _roomResource == 46 && from == 1 && to == 0) + if ((_game.id == GID_INDY3) && _roomResource == 46 && from == 1 && to == 0) return 0; // Skip up to the matrix data for box 'from' @@ -1145,7 +1145,7 @@ void Actor::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::Poin if (box2 == finalBox) { // In Indy3, the masks (= z-level) have to match, too -- needed for the // 'maze' in the zeppeling (see bug #1032964). - if (_vm->_gameId != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) { + if (_vm->_game.id != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) { // Is the actor (x,y) between both gates? if (compareSlope(_pos.x, _pos.y, _walkdata.dest.x, _walkdata.dest.y, gateA[0].x, gateA[0].y) != compareSlope(_pos.x, _pos.y, _walkdata.dest.x, _walkdata.dest.y, gateB[0].x, gateB[0].y) && diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index cc6d9bfaed..70781063dd 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -29,7 +29,7 @@ namespace Scumm { void ScummEngine::setCameraAtEx(int at) { - if (!(_features & GF_NEW_CAMERA)) { + if (!(_game.features & GF_NEW_CAMERA)) { camera._mode = kNormalCameraMode; camera._cur.x = at; setCameraAt(at, 0); @@ -55,7 +55,7 @@ void ScummEngine::setCameraAt(int pos_x, int pos_y) { } // If the camera moved and text is visible, remove it - if (camera._cur.x != camera._last.x && _charset->_hasMask && _version > 3) + if (camera._cur.x != camera._last.x && _charset->_hasMask && _game.version > 3) stopTalk(); } @@ -176,7 +176,7 @@ void ScummEngine::moveCamera() { void ScummEngine::cameraMoved() { int screenLeft; - if (_features & GF_NEW_CAMERA) { + if (_game.features & GF_NEW_CAMERA) { assert(camera._cur.x >= (_screenWidth / 2) && camera._cur.y >= (_screenHeight / 2)); } else { if (camera._cur.x < (_screenWidth / 2)) { @@ -190,7 +190,7 @@ void ScummEngine::cameraMoved() { _screenEndStrip = _screenStartStrip + gdi._numStrips - 1; _screenTop = camera._cur.y - (_screenHeight / 2); - if (_features & GF_NEW_CAMERA) { + if (_game.features & GF_NEW_CAMERA) { screenLeft = camera._cur.x - (_screenWidth / 2); } else { screenLeft = _screenStartStrip * 8; @@ -206,7 +206,7 @@ void ScummEngine::panCameraTo(int x, int y) { } void ScummEngine::actorFollowCamera(int act) { - if (!(_features & GF_NEW_CAMERA)) { + if (!(_game.features & GF_NEW_CAMERA)) { int old; old = camera._follows; diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 3eca87d110..ccfcc652c4 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -31,7 +31,7 @@ namespace Scumm { void ScummEngine::loadCJKFont() { Common::File fp; _useCJKMode = false; - if (_language == Common::JA_JPN && _version <= 5) { // FM-TOWNS v3 / v5 Kanji + if (_language == Common::JA_JPN && _game.version <= 5) { // FM-TOWNS v3 / v5 Kanji int numChar = 256 * 32; _2byteWidth = 16; _2byteHeight = 16; @@ -53,11 +53,11 @@ void ScummEngine::loadCJKFont() { numChar = 2350; break; case Common::JA_JPN: - fontFile = (_gameId == GID_DIG) ? "kanji16.fnt" : "japanese.fnt"; + fontFile = (_game.id == GID_DIG) ? "kanji16.fnt" : "japanese.fnt"; numChar = 1024; //FIXME break; case Common::ZH_TWN: - if (_gameId == GID_CMI) { + if (_game.id == GID_CMI) { fontFile = "chinese.fnt"; numChar = 1; //FIXME } @@ -234,7 +234,7 @@ void CharsetRendererCommon::setCurID(byte id) { if (_fontPtr == 0) error("CharsetRendererCommon::setCurID: charset %d not found!", id); - if (_vm->_version == 4) + if (_vm->_game.version == 4) _fontPtr += 17; else _fontPtr += 29; @@ -295,12 +295,12 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) { int width = 1; byte chr; int oldID = getCurID(); - int code = (_vm->_heversion >= 80) ? 127 : 64; + int code = (_vm->_game.heversion >= 80) ? 127 : 64; while ((chr = text[pos++]) != 0) { if (chr == '\n' || chr == '\r') break; - if (_vm->_heversion >= 72) { + if (_vm->_game.heversion >= 72) { if (chr == code) { chr = text[pos++]; if (chr == 84 || chr == 116) { // Strings of speech offset/size @@ -316,7 +316,7 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) { } else { if (chr == '@') continue; - if (chr == 255 || (_vm->_version <= 6 && chr == 254)) { + if (chr == 255 || (_vm->_game.version <= 6 && chr == 254)) { chr = text[pos++]; if (chr == 3) // 'WAIT' break; @@ -359,10 +359,10 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) { int curw = 1; byte chr; int oldID = getCurID(); - int code = (_vm->_heversion >= 80) ? 127 : 64; + int code = (_vm->_game.heversion >= 80) ? 127 : 64; while ((chr = str[pos++]) != 0) { - if (_vm->_heversion >= 72) { + if (_vm->_game.heversion >= 72) { if (chr == code) { chr = str[pos++]; if (chr == 84 || chr == 116) { // Strings of speech offset/size @@ -382,7 +382,7 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) { } else { if (chr == '@') continue; - if (chr == 255 || (_vm->_version <= 6 && chr == 254)) { + if (chr == 255 || (_vm->_game.version <= 6 && chr == 254)) { chr = str[pos++]; if (chr == 3) // 'Wait' break; @@ -1177,10 +1177,10 @@ void CharsetRendererV3::setColor(byte color) _color = color; // FM-TOWNS version of Loom uses old color method as well - if ((_vm->_version >= 2) && (_vm->_features & GF_16COLOR || (_vm->_gameId == GID_LOOM && _vm->_version == 3))) { + if ((_vm->_game.version >= 2) && (_vm->_game.features & GF_16COLOR || (_vm->_game.id == GID_LOOM && _vm->_game.version == 3))) { useShadow = ((_color & 0xF0) != 0); _color &= 0x0f; - } else if (_vm->_features & GF_OLD256) { + } else if (_vm->_game.features & GF_OLD256) { useShadow = ((_color & 0x80) != 0); _color &= 0x7f; } else @@ -1193,7 +1193,7 @@ void CharsetRendererV3::setColor(byte color) void CharsetRendererCommon::enableShadow(bool enable) { if (enable) { - if (_vm->_platform == Common::kPlatformFMTowns) { + if (_vm->_game.platform == Common::kPlatformFMTowns) { _shadowColor = 8; _shadowMode = kFMTOWNSShadowMode; } else { @@ -1409,7 +1409,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { _textScreenID = vs->number; } - if ((_vm->_heversion >= 71 && _bitDepth >= 8) || (_vm->_heversion >= 90 && _bitDepth == 0)) { + if ((_vm->_game.heversion >= 71 && _bitDepth >= 8) || (_vm->_game.heversion >= 90 && _bitDepth == 0)) { #ifndef DISABLE_HE if (ignoreCharsetMask || !vs->hasTwoBuffers) { dstPtr = vs->getPixels(0, 0); @@ -1606,7 +1606,7 @@ CharsetRendererNut::CharsetRendererNut(ScummEngine *vm) for (int i = 0; i < 5; i++) { char fontname[256]; - if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO) && (i == 4)) + if ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO) && (i == 4)) break; sprintf(fontname, "font%d.nut", i); _fr[i] = new NutRenderer(_vm); @@ -1619,7 +1619,7 @@ CharsetRendererNut::CharsetRendererNut(ScummEngine *vm) CharsetRendererNut::~CharsetRendererNut() { for (int i = 0; i < 5; i++) { - if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO) && (i == 4)) + if ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO) && (i == 4)) break; delete _fr[i]; } diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 48f81111c6..cc6d52f186 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -90,7 +90,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { const int scaletableSize = 128; - const bool newAmiCost = (_vm->_version == 5) && (_vm->_platform == Common::kPlatformAmiga); + const bool newAmiCost = (_vm->_game.version == 5) && (_vm->_game.platform == Common::kPlatformAmiga); CHECK_HEAP @@ -219,7 +219,7 @@ byte ClassicCostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { v1.skip_width = _width; v1.scaleXstep = _mirror ? 1 : -1; - if (_vm->_version == 1) + if (_vm->_game.version == 1) // V1 games uses 8 x 8 pixels for actors _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 8, rect.top, rect.bottom, _actorID); else @@ -357,11 +357,11 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) { if (!(_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) { palette[2] = 11; palette[3] = 11; - } else if (_vm->_gameId == GID_MANIAC) { + } else if (_vm->_game.id == GID_MANIAC) { palette[1] = v1MMActorPalatte1[actor]; palette[2] = v1MMActorPalatte2[actor]; } else { - palette[1] = (_vm->_platform == Common::kPlatformC64) ? 10 : 8; + palette[1] = (_vm->_game.platform == Common::kPlatformC64) ? 10 : 8; palette[2] = _palette[actor]; } mask = v1.mask_ptr; @@ -549,11 +549,11 @@ void ClassicCostumeLoader::loadCostume(int id) { _id = id; byte *ptr = _vm->getResourceAddress(rtCostume, id); - if (_vm->_version >= 6) + if (_vm->_game.version >= 6) ptr += 8; - else if (_vm->_features & GF_OLD_BUNDLE) + else if (_vm->_game.features & GF_OLD_BUNDLE) ptr += -2; - else if (_vm->_features & GF_SMALL_HEADER) + else if (_vm->_game.features & GF_SMALL_HEADER) ptr += 0; else ptr += 2; @@ -589,7 +589,7 @@ void ClassicCostumeLoader::loadCostume(int id) { // Don't forget, these games were designed around a fixed 16 color HW palette :-) // In addition, all offsets are shifted by 2; we accomodate that via a separate // _baseptr value (instead of adding tons of if's throughout the code). - if (_vm->_features & GF_OLD_BUNDLE) { + if (_vm->_game.features & GF_OLD_BUNDLE) { _numColors = (_format == 0x57) ? 0 : 1; _baseptr += 2; } @@ -716,7 +716,7 @@ byte ClassicCostumeRenderer::drawLimb(const Actor *a, int limb) { if (code != 0x7B) { _srcptr = _loaded._baseptr + READ_LE_UINT16(frameptr + code * 2); - if (!(_vm->_features & GF_OLD256) || code < 0x79) { + if (!(_vm->_game.features & GF_OLD256) || code < 0x79) { const CostumeInfo *costumeInfo; int xmoveCur, ymoveCur; @@ -781,7 +781,7 @@ void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) return; } - if (_vm->_version == 1) { + if (_vm->_game.version == 1) { mask = *r++ << 8; } else { mask = READ_LE_UINT16(r); @@ -790,7 +790,7 @@ void ClassicCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) i = 0; do { if (mask & 0x8000) { - if (_vm->_version <= 3) { + if (_vm->_game.version <= 3) { j = *r++; if (j == 0xFF) @@ -836,7 +836,7 @@ void ClassicCostumeRenderer::setPalette(byte *palette) { if (_loaded._format == 0x57) { memcpy(_palette, palette, 13); - } else if (_vm->_features & GF_OLD_BUNDLE) { + } else if (_vm->_game.features & GF_OLD_BUNDLE) { if ((_vm->VAR(_vm->VAR_CURRENT_LIGHTS) & LIGHTMODE_actor_color)) { memcpy(_palette, palette, 16); } else { @@ -891,7 +891,7 @@ byte ClassicCostumeLoader::increaseAnim(Actor *a, int slot) { end = a->_cost.end[slot]; code = _animCmds[i] & 0x7F; - if (_vm->_version <= 3) { + if (_vm->_game.version <= 3) { if (_animCmds[i] & 0x80) a->_cost.soundCounter++; } @@ -911,9 +911,9 @@ byte ClassicCostumeLoader::increaseAnim(Actor *a, int slot) { if (a->_cost.start[slot] != end) continue; } else { - if (_vm->_version >= 6) { + if (_vm->_game.version >= 6) { if (nc >= 0x71 && nc <= 0x78) { - uint sound = (_vm->_heversion == 60) ? 0x78 - nc : nc - 0x71; + uint sound = (_vm->_game.heversion == 60) ? 0x78 - nc : nc - 0x71; _vm->_sound->addSoundToQueue2(a->_sound[sound]); if (a->_cost.start[slot] != end) continue; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 99fc3cf4c0..e6d3104de8 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -134,11 +134,11 @@ void ScummEngine_v6::setCursorTransparency(int a) { } void ScummEngine::updateCursor() { - const int transColor = (_heversion >= 80) ? 5 : 255; + const int transColor = (_game.heversion >= 80) ? 5 : 255; _system->setMouseCursor(_grabbedCursor, _cursor.width, _cursor.height, _cursor.hotspotX, _cursor.hotspotY, - (_platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), - (_heversion == 70 ? 2 : 1)); + (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), + (_game.heversion == 70 ? 2 : 1)); } void ScummEngine_v6::grabCursor(int x, int y, int w, int h) { @@ -230,18 +230,18 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, img, room); imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), foir.obim); - if (_version == 8) { + if (_game.version == 8) { setCursorHotspot(READ_LE_UINT32(&imhd->v8.hotspot[0].x), READ_LE_UINT32(&imhd->v8.hotspot[0].y)); w = READ_LE_UINT32(&imhd->v8.width) / 8; h = READ_LE_UINT32(&imhd->v8.height) / 8; - } else if (_version == 7) { + } else if (_game.version == 7) { setCursorHotspot(READ_LE_UINT16(&imhd->v7.hotspot[0].x), READ_LE_UINT16(&imhd->v7.hotspot[0].y)); w = READ_LE_UINT16(&imhd->v7.width) / 8; h = READ_LE_UINT16(&imhd->v7.height) / 8; } else { - if (_heversion == 0) { + if (_game.heversion == 0) { setCursorHotspot(READ_LE_UINT16(&imhd->old.hotspot[0].x), READ_LE_UINT16(&imhd->old.hotspot[0].y)); } @@ -251,7 +251,7 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { dataptr = getObjectImage(foir.obim, imgindex); assert(dataptr); - if (_version == 8) { + if (_game.version == 8) { bomp = dataptr; } else { size = READ_BE_UINT32(dataptr + 4); @@ -326,7 +326,7 @@ void ScummEngine_v6::useBompCursor(const byte *im, int width, int height) { _cursor.animate = 0; // Skip the header - if (_version == 8) { + if (_game.version == 8) { im += 16; } else { im += 18; @@ -338,7 +338,7 @@ void ScummEngine_v6::useBompCursor(const byte *im, int width, int height) { void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { // Cursor image in both Looms are based on images from charset. - if (_gameId != GID_LOOM) { + if (_game.id != GID_LOOM) { // FIXME: Actually: is this opcode ever called by a non-Loom game? // Which V3-V5 game besides Loom makes use of custom cursors, ever? error("V3--V5 SO_CURSOR_IMAGE(%d,%d) called - tell Fingolfin where you saw this!", index, chr); @@ -348,9 +348,9 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { // const int oldID = _charset->getCurID(); - if (_version == 3) { + if (_game.version == 3) { _charset->setCurID(0); - } else if (_version >= 4) { + } else if (_game.version >= 4) { _charset->setCurID(1); } @@ -382,7 +382,7 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) { void ScummEngine_v5::redefineBuiltinCursorHotspot(int index, int x, int y) { // Cursor image in both Looms are based on images from charset. - if (_gameId != GID_LOOM) { + if (_game.id != GID_LOOM) { // FIXME: Actually: is this opcode ever called by a non-Loom game? // Which V3-V5 game besides Loom makes use of custom cursors, ever? error("V3--V5 SO_CURSOR_HOTSPOT(%d,%d,%d) called - tell Fingolfin where you saw this!", index, x, y); @@ -400,12 +400,12 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); - if (_version == 1) + if (_game.version == 1) color = default_v1_cursor_colors[idx]; else color = default_cursor_colors[idx]; - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { _cursor.width = 8; _cursor.height = 8; _cursor.hotspotX = 0; @@ -422,7 +422,7 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { *dst++ = palette[((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) | ((idx == 3) ? 4 : 0)]; } - } else if (_version <= 2 && _platform == Common::kPlatformAmiga) { + } else if (_game.version <= 2 && _game.platform == Common::kPlatformAmiga) { _cursor.width = 15; _cursor.height = 15; _cursor.hotspotX = 7; @@ -451,7 +451,7 @@ void ScummEngine_v5::setBuiltinCursor(int idx) { *(hotspot - _cursor.width * (3 + i) + i) = color; *(hotspot + _cursor.width * (3 + i) + i) = color; } - } else if (_version <= 2) { + } else if (_game.version <= 2) { _cursor.width = 23; _cursor.height = 21; _cursor.hotspotX = 11; diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index e14e9a36f0..7ed345c572 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -84,7 +84,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s) DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0); DVar_Register("scumm_exename", &_vm->_baseName, DVAR_STRING, 0); - DVar_Register("scumm_gameid", &_vm->_gameId, DVAR_BYTE, 0); + DVar_Register("scumm_gameid", &_vm->_game.id, DVAR_BYTE, 0); // Register commands DCmd_Register("continue", &ScummDebugger::Cmd_Exit); @@ -105,7 +105,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s) DCmd_Register("scripts", &ScummDebugger::Cmd_PrintScript); DCmd_Register("importres", &ScummDebugger::Cmd_ImportRes); - if (_vm->_gameId == GID_LOOM) + if (_vm->_game.id == GID_LOOM) DCmd_Register("drafts", &ScummDebugger::Cmd_PrintDraft); DCmd_Register("loadgame", &ScummDebugger::Cmd_LoadGame); @@ -324,11 +324,11 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) { DebugPrintf("Could not open file %s\n", argv[2]); return true; } - if (_vm->_features & GF_SMALL_HEADER) { + if (_vm->_game.features & GF_SMALL_HEADER) { size = file.readUint16LE(); file.seek(-2, SEEK_CUR); - } else if (_vm->_features & GF_SMALL_HEADER) { - if (_vm->_version == 4) + } else if (_vm->_game.features & GF_SMALL_HEADER) { + if (_vm->_game.version == 4) file.seek(8, SEEK_CUR); size = file.readUint32LE(); file.readUint16LE(); @@ -660,11 +660,11 @@ bool ScummDebugger::Cmd_PrintBoxMatrix(int argc, const char **argv) { int i, j; DebugPrintf("Walk matrix:\n"); - if (_vm->_version <= 2) + if (_vm->_game.version <= 2) boxm += num; for (i = 0; i < num; i++) { DebugPrintf("%d: ", i); - if (_vm->_version <= 2) { + if (_vm->_game.version <= 2) { for (j = 0; j < num; j++) DebugPrintf("[%d] ", *boxm++); } else { @@ -829,7 +829,7 @@ bool ScummDebugger::Cmd_PrintDraft(int argc, const char **argv) { const char *notes = "cdefgabC"; int i, base, draft; - if (_vm->_gameId != GID_LOOM) { + if (_vm->_game.id != GID_LOOM) { DebugPrintf("Command only works with Loom/LoomCD\n"); return true; } @@ -855,7 +855,7 @@ bool ScummDebugger::Cmd_PrintDraft(int argc, const char **argv) { // Possibly they store information on where and/or how the draft can // be used. They appear to remain constant throughout the game. - base = (_vm->_version == 3) ? 50 : 100; + base = (_vm->_game.version == 3) ? 50 : 100; if (argc == 2) { // We had to debug a problem at the end of the game that only diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index eafd956251..0db2a9bc7d 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -166,11 +166,11 @@ const Common::String ScummDialog::queryResString(int stringno) { if (stringno == 0) return String(); - if (_vm->_version >= 7) + if (_vm->_game.version >= 7) result = _vm->getStringAddressVar(string_map_table_v7[stringno - 1].num); - else if (_vm->_version == 6) + else if (_vm->_game.version == 6) result = _vm->getStringAddressVar(string_map_table_v6[stringno - 1].num); - else if (_vm->_version == 5) + else if (_vm->_game.version == 5) result = _vm->getStringAddress(string_map_table_v5[stringno - 1].num); else // TODO: For V8 games, maybe grab the strings from the language file? @@ -717,7 +717,7 @@ void ConfigDialog::close() { else _vm->_voiceMode = ConfMan.getBool("subtitles"); - if (_vm->_version >= 7) + if (_vm->_game.version >= 7) _vm->VAR(_vm->VAR_VOICE_MODE) = _vm->_voiceMode; } @@ -785,7 +785,7 @@ HelpDialog::HelpDialog(ScummEngine *scumm) } _page = 1; - _numPages = ScummHelp::numPages(scumm->_gameId); + _numPages = ScummHelp::numPages(scumm->_game.id); int y = 5 + lineHeight * (HELP_NUM_LINES + 2) + 2; @@ -801,7 +801,7 @@ void HelpDialog::displayKeyBindings() { String titleStr, *keyStr, *dscStr; - ScummHelp::updateStrings(_vm->_gameId, _vm->_version, _vm->_platform, _page, titleStr, keyStr, dscStr); + ScummHelp::updateStrings(_vm->_game.id, _vm->_game.version, _vm->_game.platform, _page, titleStr, keyStr, dscStr); _title->setLabel(titleStr); for (int i = 0; i < HELP_NUM_LINES; i++) { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 8831491c14..0a4772ad86 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -205,7 +205,7 @@ void Gdi::init() { _numStrips = _vm->_screenWidth / 8; // Increase the number of screen strips by one; needed for smooth scrolling - if (_vm->_version >= 7) { + if (_vm->_game.version >= 7) { // We now have mostly working smooth scrolling code in place for V7+ games // (i.e. The Dig, Full Throttle and COMI). It seems to work very well so far. // One area which still may need some work are the AKOS codecs (except for @@ -222,8 +222,8 @@ void Gdi::init() { } void Gdi::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) { - if (_vm->_version == 1) { - if (_vm->_platform == Common::kPlatformNES) { + if (_vm->_game.version == 1) { + if (_vm->_game.platform == Common::kPlatformNES) { decodeNESGfx(roomptr); } else { for (int i = 0; i < 4; i++){ @@ -236,7 +236,7 @@ void Gdi::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) { decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18) + 2, _C64.maskChar, READ_LE_UINT16(roomptr + READ_LE_UINT16(roomptr + 18))); _objectMode = true; } - } else if (_vm->_version == 2) { + } else if (_vm->_game.version == 2) { _roomStrips = generateStripTable(roomptr + IM00_offs, _vm->_roomWidth, _vm->_roomHeight, _roomStrips); } @@ -265,14 +265,14 @@ void ScummEngine::initScreens(int b, int h) { // in pre-V7 for the games messages (like 'Pause', Yes/No dialogs, // version display, etc.). I don't know about V7, maybe the same is the // case there. If so, we could probably just remove it completely. - if (_version >= 7) { + if (_game.version >= 7) { initVirtScreen(kUnkVirtScreen, (_screenHeight / 2) - 10, _screenWidth, 13, false, false); } else { initVirtScreen(kUnkVirtScreen, 80, _screenWidth, 13, false, false); } } - if ((_platform == Common::kPlatformNES) && (h != _screenHeight)) { + if ((_game.platform == Common::kPlatformNES) && (h != _screenHeight)) { // This is a hack to shift the whole screen downwards to match the original. // Otherwise we would have to do lots of coordinate adjustments all over // the code. @@ -297,7 +297,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int assert(height >= 0); assert(slot >= 0 && slot < 4); - if (_version >= 7) { + if (_game.version >= 7) { if (slot == kMainVirtScreen && (_roomHeight != 0)) height = _roomHeight; } @@ -312,7 +312,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int vs->bytesPerPixel = 1; vs->pitch = width; - if (_version >= 7) { + if (_game.version >= 7) { // Increase the pitch by one; needed to accomodate the extra // screen strip which we use to implement smooth scrolling. // See Gdi::init() @@ -327,7 +327,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int // very little of the screen has to be redrawn, and we have a very low // memory overhead (namely for every pixel we want to scroll, we need // one additional byte in the buffer). - if (_version >= 7) { + if (_game.version >= 7) { size += vs->pitch * 8; } else { size += vs->pitch * 4; @@ -380,7 +380,7 @@ void ScummEngine::markRectAsDirty(VirtScreenNumber virt, int left, int right, in lp = 0; rp = (right + vs->xstart) / 8; - if (_version >= 7) { + if (_game.version >= 7) { if (rp > 409) rp = 409; } else { @@ -424,7 +424,7 @@ void ScummEngine::drawDirtyScreenParts() { updateDirtyScreen(kTextVirtScreen); // Update game area ("stage") - if (camera._last.x != camera._cur.x || (_features & GF_NEW_CAMERA && (camera._cur.y != camera._last.y))) { + if (camera._last.x != camera._cur.x || (_game.features & GF_NEW_CAMERA && (camera._cur.y != camera._last.y))) { // Camera moved: redraw everything VirtScreen *vs = &virtscr[kMainVirtScreen]; drawStripToScreen(vs, 0, vs->w, 0, vs->h); @@ -448,14 +448,14 @@ void ScummEngine_v6::drawDirtyScreenParts() { // texts have to be drawn before the blast objects. Unless // someone can think of a better way to achieve this effect. - if (_version >= 7 && VAR(VAR_BLAST_ABOVE_TEXT) == 1) { + if (_game.version >= 7 && VAR(VAR_BLAST_ABOVE_TEXT) == 1) { drawBlastTexts(); drawBlastObjects(); } else { drawBlastObjects(); drawBlastTexts(); } - if (_version == 8) + if (_game.version == 8) processUpperActors(); // Call the original method. @@ -540,7 +540,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i const byte *src = vs->getPixels(x, top); byte *dst = _compositeBuf + x + y * _screenWidth; - if (_version < 7) { + if (_game.version < 7) { // Handle the text mask in older games; newer (V7/V8) games do not use it anymore. const byte *text = (byte *)_charset->_textSurface.pixels + x + y * _charset->_textSurface.pitch; @@ -577,7 +577,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // NES can address negative number strips and that poses problem for // our code. So instead adding zillions of fixes and potentially break // other games we shift it right on rendering stage - if ((_platform == Common::kPlatformNES) && (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen)) || (vs->number == kTextVirtScreen))) { + if ((_game.platform == Common::kPlatformNES) && (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen)) || (vs->number == kTextVirtScreen))) { x += 16; while (x + width >= _screenWidth) width -= 16; @@ -615,7 +615,7 @@ void ScummEngine::ditherCGA(byte *dst, int dstPitch, int x, int y, int width, in idx1 = (y + y1) % 2; - if (_version == 2) + if (_game.version == 2) idx1 = 0; for (int x1 = 0; x1 < width; x1++) { @@ -687,26 +687,26 @@ void ScummEngine::initBGBuffers(int height) { int size, itemsize, i; byte *room; - if (_version >= 7) { + if (_game.version >= 7) { // Resize main virtual screen in V7 games. This is necessary // because in V7, rooms may be higher than one screen, so we have // to accomodate for that. initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, true, true); } - if (_heversion >= 70) + if (_game.heversion >= 70) room = getResourceAddress(rtRoomImage, _roomResource); else room = getResourceAddress(rtRoom, _roomResource); - if (_version <= 3) { + if (_game.version <= 3) { gdi._numZBuffer = 2; - } else if (_features & GF_SMALL_HEADER) { + } else if (_game.features & GF_SMALL_HEADER) { int off; ptr = findResourceData(MKID('SMAP'), room); gdi._numZBuffer = 0; - if (_features & GF_16COLOR) + if (_game.features & GF_16COLOR) off = READ_LE_UINT16(ptr); else off = READ_LE_UINT32(ptr); @@ -716,11 +716,11 @@ void ScummEngine::initBGBuffers(int height) { ptr += off; off = READ_LE_UINT16(ptr); } - } else if (_version == 8) { + } else if (_game.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; - } else if (_heversion >= 70) { + } else if (_game.heversion >= 70) { ptr = findResource(MKID('RMIH'), room); gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1; } else { @@ -729,7 +729,7 @@ void ScummEngine::initBGBuffers(int height) { } assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 8); - if (_version >= 7) + if (_game.version >= 7) itemsize = (_roomHeight + 10) * gdi._numStrips; else itemsize = (_roomHeight + 4) * gdi._numStrips; @@ -755,8 +755,8 @@ void ScummEngine::redrawBGAreas() { int diff; int val = 0; - if (!(_features & GF_NEW_CAMERA)) - if (camera._cur.x != camera._last.x && _charset->_hasMask && (_version > 3 && _gameId != GID_PASS)) + if (!(_game.features & GF_NEW_CAMERA)) + if (camera._cur.x != camera._last.x && _charset->_hasMask && (_game.version > 3 && _game.id != GID_PASS)) stopTalk(); // Redraw parts of the background which are marked as dirty. @@ -768,7 +768,7 @@ void ScummEngine::redrawBGAreas() { } } - if (_features & GF_NEW_CAMERA) { + if (_game.features & GF_NEW_CAMERA) { diff = camera._cur.x / 8 - camera._last.x / 8; if (_fullRedraw || ABS(diff) >= gdi._numStrips) { _bgNeedsRedraw = false; @@ -828,7 +828,7 @@ void ScummEngine::redrawBGStrip(int start, int num) { for (int i = 0; i < num; i++) setGfxUsageBit(s + i, USAGE_BIT_DIRTY); - if (_heversion >= 70) + if (_game.heversion >= 70) room = getResourceAddress(rtRoomImage, _roomResource); else room = getResourceAddress(rtRoom, _roomResource); @@ -1059,7 +1059,7 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) { byte *mask = (byte *)_charset->_textSurface.pixels + _charset->_textSurface.pitch * (y - _screenTop) + x; fill(mask, _charset->_textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width, height); } - } else if (_heversion == 100) { + } else if (_game.heversion == 100) { // Flags are used for different methods in HE games int32 flags = color; if (flags & 0x4000000) { @@ -1109,7 +1109,7 @@ void ScummEngine::drawFlashlight() { return; // Calculate the area of the flashlight - if (_gameId == GID_ZAK || _gameId == GID_MANIAC) { + if (_game.id == GID_ZAK || _game.id == GID_MANIAC) { x = _mouse.x + vs->xstart; y = _mouse.y - vs->topline; } else { @@ -1122,7 +1122,7 @@ void ScummEngine::drawFlashlight() { _flashlight.x = x - _flashlight.w / 2 - _screenStartStrip * 8; _flashlight.y = y - _flashlight.h / 2; - if (_gameId == GID_LOOM) + if (_game.id == GID_LOOM) _flashlight.y -= 12; // Clip the flashlight at the borders @@ -1303,7 +1303,7 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) int numzbuf; int i; - if ((_vm->_features & GF_SMALL_HEADER) || _vm->_version == 8) + if ((_vm->_game.features & GF_SMALL_HEADER) || _vm->_game.version == 8) zplane_list[0] = ptr; else if (bmapImage) zplane_list[0] = _vm->findResource(MKID('BMAP'), ptr); @@ -1312,18 +1312,18 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) if (_zbufferDisabled) numzbuf = 0; - else if (_numZBuffer <= 1 || (_vm->_version <= 2)) + else if (_numZBuffer <= 1 || (_vm->_game.version <= 2)) numzbuf = _numZBuffer; else { numzbuf = _numZBuffer; assert(numzbuf <= 9); - if (_vm->_features & GF_SMALL_HEADER) { - if (_vm->_features & GF_16COLOR) + if (_vm->_game.features & GF_SMALL_HEADER) { + if (_vm->_game.features & GF_16COLOR) zplane_list[1] = ptr + READ_LE_UINT16(ptr); else { zplane_list[1] = ptr + READ_LE_UINT32(ptr); - if (_vm->_features & GF_OLD256) { + if (_vm->_game.features & GF_OLD256) { if (0 == READ_LE_UINT32(zplane_list[1])) zplane_list[1] = 0; } @@ -1331,7 +1331,7 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) for (i = 2; i < numzbuf; i++) { zplane_list[i] = zplane_list[i-1] + READ_LE_UINT16(zplane_list[i-1]); } - } else if (_vm->_version == 8) { + } else if (_vm->_game.version == 8) { // Find the OFFS chunk of the ZPLN chunk const byte *zplnOffsChunkStart = ptr + 24 + READ_BE_UINT32(ptr + 12); @@ -1391,8 +1391,8 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi _objectMode = (flag & dbObjectMode) == dbObjectMode; - if (_objectMode && _vm->_version == 1) { - if (_vm->_platform == Common::kPlatformNES) { + if (_objectMode && _vm->_game.version == 1) { + if (_vm->_game.platform == Common::kPlatformNES) { decodeNESObject(ptr, x, y, width, height); } else { decodeC64Gfx(ptr, _C64.objectMap, (width / 8) * (height / 8) * 3); @@ -1400,9 +1400,9 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi } CHECK_HEAP; - if (_vm->_features & GF_SMALL_HEADER) { + if (_vm->_game.features & GF_SMALL_HEADER) { smap_ptr = ptr; - } else if (_vm->_version == 8) { + } else if (_vm->_game.version == 8) { // Skip to the BSTR->WRAP->OFFS chunk smap_ptr = ptr + 24; } else @@ -1413,7 +1413,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi numzbuf = getZPlanes(ptr, zplane_list, false); const byte *tmsk_ptr = NULL; - if (_vm->_heversion >= 72) { + if (_vm->_game.heversion >= 72) { tmsk_ptr = _vm->findResource(MKID('TMSK'), ptr); } @@ -1431,7 +1431,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->_version == 2) + if (_vm->_game.version == 2) drawBitmapV2Helper(ptr, vs, x, y, width, height, stripnr, numstrip); sx = x - vs->xstart / 8; @@ -1471,8 +1471,8 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi else dstPtr = (byte *)vs->pixels + y * vs->pitch + (x + k) * 8; - if (_vm->_version == 1) { - if (_vm->_platform == Common::kPlatformNES) { + if (_vm->_game.version == 1) { + if (_vm->_game.platform == Common::kPlatformNES) { mask_ptr = getMaskBuffer(x + k, y, 1); drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height); } @@ -1480,7 +1480,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height); else drawStripC64Background(dstPtr, vs->pitch, stripnr, height); - } else if (_vm->_version == 2) { + } else if (_vm->_game.version == 2) { // Do nothing here for V2 games - drawing was already handled. } else { // Do some input verification and make sure the strip/strip offset @@ -1488,11 +1488,11 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi // but if e.g. a savegame gets corrupted, we can easily get into // trouble here. See also bug #795214. int offset = -1, smapLen; - if (_vm->_features & GF_16COLOR) { + if (_vm->_game.features & GF_16COLOR) { smapLen = READ_LE_UINT16(smap_ptr); if (stripnr * 2 + 2 < smapLen) offset = READ_LE_UINT16(smap_ptr + stripnr * 2 + 2); - } else if (_vm->_features & GF_SMALL_HEADER) { + } else if (_vm->_game.features & GF_SMALL_HEADER) { smapLen = READ_LE_UINT32(smap_ptr); if (stripnr * 4 + 4 < smapLen) offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 4); @@ -1519,17 +1519,17 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi CHECK_HEAP; // COMI and HE games only uses flag value - if (_vm->_version == 8 || _vm->_heversion >= 60) + if (_vm->_game.version == 8 || _vm->_game.heversion >= 60) transpStrip = true; - if (_vm->_version == 1) { + if (_vm->_game.version == 1) { mask_ptr = getMaskBuffer(x + k, y, 1); - if (_vm->_platform == Common::kPlatformNES) { + if (_vm->_game.platform == Common::kPlatformNES) { drawStripNESMask(mask_ptr, stripnr, y, height); } else { drawStripC64Mask(mask_ptr, stripnr, width, height); } - } else if (_vm->_version == 2) { + } else if (_vm->_game.version == 2) { // Do nothing here for V2 games - zplane was already handled. } else if (flag & dbDrawMaskOnAll) { // Sam & Max uses dbDrawMaskOnAll for things like the inventory @@ -1548,7 +1548,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->_version == 8) + if (_vm->_game.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); @@ -1566,13 +1566,13 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, int y, const int wi if (!zplane_list[i]) continue; - if (_vm->_features & GF_OLD_BUNDLE) + if (_vm->_game.features & GF_OLD_BUNDLE) offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2); - else if (_vm->_features & GF_OLD256) + else if (_vm->_game.features & GF_OLD256) offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 4); - else if (_vm->_features & GF_SMALL_HEADER) + else if (_vm->_game.features & GF_SMALL_HEADER) offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 2); - else if (_vm->_version == 8) + else if (_vm->_game.version == 8) offs = READ_LE_UINT32(zplane_list[i] + stripnr * 4 + 8); else offs = READ_LE_UINT16(zplane_list[i] + stripnr * 2 + 8); @@ -1779,12 +1779,12 @@ void Gdi::resetBackground(int top, int bottom, int strip) { bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess) { assert(numLinesToProcess); - if (_vm->_features & GF_16COLOR) { + if (_vm->_game.features & GF_16COLOR) { drawStripEGA(dst, dstPitch, src, numLinesToProcess); return false; } - if ((_vm->_platform == Common::kPlatformAmiga) && (_vm->_version >= 4)) + if ((_vm->_game.platform == Common::kPlatformAmiga) && (_vm->_game.version >= 4)) _paletteMod = 16; else _paletteMod = 0; @@ -2753,7 +2753,7 @@ void Gdi::drawStripBasicV(byte *dst, int dstPitch, const byte *src, int height, void Gdi::drawStripRaw(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const { int x; - if (_vm->_features & GF_OLD256) { + if (_vm->_game.features & GF_OLD256) { uint h = height; x = 8; for (;;) { @@ -2942,7 +2942,7 @@ void ScummEngine::fadeOut(int effect) { VirtScreen *vs = &virtscr[0]; vs->setDirtyRange(0, 0); - if (!(_features & GF_NEW_CAMERA)) + if (!(_game.features & GF_NEW_CAMERA)) camera._last.x = camera._cur.x; if (_switchRoomEffect >= 130 && _switchRoomEffect <= 133) { @@ -3156,7 +3156,7 @@ void ScummEngine::dissolveEffect(int width, int height) { // Speed up the effect for CD Loom since it uses it so often. I don't // think the original had any delay at all, so on modern hardware it // wasn't even noticeable. - if (_gameId == GID_LOOM && (_version == 4)) + if (_game.id == GID_LOOM && (_game.version == 4)) blits_before_refresh *= 2; for (i = 0; i < w * h; i++) { @@ -3283,7 +3283,7 @@ void ScummEngine::scrollEffect(int dir) { void ScummEngine::unkScreenEffect6() { // CD Loom (but not EGA Loom!) uses a more fine-grained dissolve - if (_gameId == GID_LOOM && (_version == 4)) + if (_game.id == GID_LOOM && (_game.version == 4)) dissolveEffect(1, 1); else dissolveEffect(8, 4); diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index 85df92cdb7..efe0f15017 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -35,7 +35,7 @@ void ScummEngine_v70he::remapHEPalette(const uint8 *src, uint8 *dst) { uint8 *palPtr; src += 30; - if (_heversion >= 99) { + if (_game.heversion >= 99) { palPtr = _hePalettes + 1024 + 30; } else { palPtr = _currentPalette + 30; diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 7970068e99..8568449e6f 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -1722,7 +1722,7 @@ void ScummEngine_v90he::readMAXS(int blockSize) { _numNewNames = 10; _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); - if (_features & GF_HE_985) + if (_game.features & GF_HE_985) _numGlobalScripts = 2048; else _numGlobalScripts = 200; diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 9d7de59450..1868d6b71e 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -406,7 +406,7 @@ void ScummEngine_v60he::o60_setState() { if (state & 0x8000) { state &= 0x7FFF; putState(obj, state); - if (_heversion >= 72) + if (_game.heversion >= 72) removeObjectFromDrawQue(obj); } else { putState(obj, state); @@ -440,7 +440,7 @@ void ScummEngine_v60he::o60_roomOps() { case 174: // SO_ROOM_SCREEN b = pop(); a = pop(); - if (_heversion >= 71) + if (_game.heversion >= 71) initScreens(a, _screenHeight); else initScreens(a, b); @@ -477,7 +477,7 @@ void ScummEngine_v60he::o60_roomOps() { case 181: // SO_ROOM_FADE a = pop(); - if (_heversion >= 70) { + if (_game.heversion >= 70) { // Defaults to 1 but doesn't use fade effects } else if (a) { _switchRoomEffect = (byte)(a & 0xFF); @@ -502,7 +502,7 @@ void ScummEngine_v60he::o60_roomOps() { c = pop(); b = pop(); a = pop(); - if (_heversion == 60) + if (_game.heversion == 60) setupShadowPalette(a, b, c, d, e, 0, 256); break; @@ -594,7 +594,7 @@ void ScummEngine_v60he::o60_actorOps() { switch (subOp) { case 30: - // _heversion >= 70 + // _game.heversion >= 70 _actorClipOverride.bottom = pop(); _actorClipOverride.right = pop(); _actorClipOverride.top = pop(); @@ -1051,7 +1051,7 @@ void ScummEngine_v60he::o60_readFile() { int val; // Fatty Bear uses positive values - if ((_platform == Common::kPlatformPC) && (_gameId == GID_FBEAR)) + if ((_game.platform == Common::kPlatformPC) && (_game.id == GID_FBEAR)) size = -size; if (size == -2) { @@ -1079,7 +1079,7 @@ void ScummEngine_v60he::o60_writeFile() { int slot = pop(); // Fatty Bear uses positive values - if ((_platform == Common::kPlatformPC) && (_gameId == GID_FBEAR)) + if ((_game.platform == Common::kPlatformPC) && (_game.id == GID_FBEAR)) size = -size; if (size == -2) { @@ -1114,7 +1114,7 @@ void ScummEngine_v60he::o60_soundOps() { } void ScummEngine_v60he::localizeArray(int slot, byte scriptSlot) { - if (_heversion >= 80) + if (_game.heversion >= 80) slot &= ~0x33539000; if (slot >= _numArray) diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index bd70845f67..3e71073f69 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -488,7 +488,7 @@ void ScummEngine_v70he::o70_pickupObject() { addObjectToInventory(obj, room); putOwner(obj, VAR(VAR_EGO)); - if (_heversion <= 70) { + if (_game.heversion <= 70) { putClass(obj, kObjectClassUntouchable, 1); putState(obj, 1); markObjectRectAsDirty(obj); @@ -563,7 +563,7 @@ void ScummEngine_v70he::o70_resourceRoutines() { break; case 111: // SO_LOCK_ROOM resid = pop(); - if (_heversion <= 71 && resid > 0x7F) + if (_game.heversion <= 71 && resid > 0x7F) resid = _resourceMapper[resid & 0x7F]; res.lock(rtRoom, resid); res.lock(rtRoomImage, resid); @@ -584,7 +584,7 @@ void ScummEngine_v70he::o70_resourceRoutines() { break; case 115: // SO_UNLOCK_ROOM resid = pop(); - if (_heversion <= 71 && resid > 0x7F) + if (_game.heversion <= 71 && resid > 0x7F) resid = _resourceMapper[resid & 0x7F]; res.unlock(rtRoom, resid); res.unlock(rtRoomImage, resid); diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 605d490738..4c56703fa1 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -406,12 +406,12 @@ ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int ty size = arrayDataSizes[type]; - if (_heversion >= 80) + if (_game.heversion >= 80) id |= 0x33539000; writeVar(array, id); - if (_heversion >= 80) + if (_game.heversion >= 80) id &= ~0x33539000; size *= dim2end - dim2start + 1; @@ -1749,10 +1749,10 @@ void ScummEngine_v72he::o72_openFile() { debug(1,"Original filename %s", filename); // There are Macintosh specific versions of HE7.2 games. - if (_heversion >= 80 && _platform == Common::kPlatformMacintosh) { + if (_game.heversion >= 80 && _game.platform == Common::kPlatformMacintosh) { // Work around for filename difference in HE7 file, needs to // open 'Water (7)' instead of 'Water Worries (7)'. - if (_gameId == GID_WATER && _heversion == 99 && !strcmp((char *)filename, "Water.he7")) { + if (_game.id == GID_WATER && _game.heversion == 99 && !strcmp((char *)filename, "Water.he7")) { strcpy((char *)filename, "Water (7)"); } else { char buf1[128]; @@ -2216,7 +2216,7 @@ void ScummEngine_v72he::o72_getResourceSize() { int size, type; int resid = pop(); - if (_heversion == 72) { + if (_game.heversion == 72) { push(getSoundResourceSize(resid)); return; } diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index a4fbd65053..2f6d0569c2 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -981,14 +981,14 @@ void ScummEngine_v90he::o90_getSpriteInfo() { push(0); break; case 15: - if (_heversion == 99) { + if (_game.heversion == 99) { flags = getStackList(args, ARRAYSIZE(args)); type = pop(); groupId = pop(); y = pop(); x = pop(); push(_sprite->findSpriteWithClassOf(x, y, groupId, type, flags, args)); - } else if (_heversion == 98) { + } else if (_game.heversion == 98) { type = pop(); groupId = pop(); y = pop(); @@ -1231,7 +1231,7 @@ void ScummEngine_v90he::o90_setSpriteInfo() { _sprite->setSpriteAngle(spriteId, args[0]); break; case 23: - if (_features & GF_HE_985 || _heversion >= 99) { + if (_game.features & GF_HE_985 || _game.heversion >= 99) { _curMaxSpriteId = pop(); _curSpriteId = pop(); @@ -1876,7 +1876,7 @@ void ScummEngine_v90he::o90_getPolygonOverlap() { if (dist >= 2) { dist = (int)sqrt((double)(dist + 1)); } - if (_heversion >= 98) { + if (_game.heversion >= 98) { push((dist <= args1[2]) ? 1 : 0); } else { push((dist > args1[2]) ? 1 : 0); diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 5ed135cd8a..d687844d9d 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -114,7 +114,7 @@ int Sound::getSoundPos(int sound) { } int Sound::getSoundVar(int sound, int var) { - if (_vm->_heversion >= 90 && var == 26) { + if (_vm->_game.heversion >= 90 && var == 26) { return isSoundCodeUsed(sound); } @@ -171,7 +171,7 @@ void Sound::setupHEMusicFile() { _heMusicTracks = musicFile.readUint32LE(); debug(5, "Total music tracks %d", _heMusicTracks); - int musicStart = (_vm->_heversion >= 80) ? 56 : 20; + int musicStart = (_vm->_game.heversion >= 80) ? 56 : 20; musicFile.seek(musicStart, SEEK_SET); _heMusic = (HEMusic *)malloc((_heMusicTracks + 1) * sizeof(HEMusic)); @@ -180,7 +180,7 @@ void Sound::setupHEMusicFile() { _heMusic[i].offset = musicFile.readUint32LE(); _heMusic[i].size = musicFile.readUint32LE(); - if (_vm->_heversion >= 80) { + if (_vm->_game.heversion >= 80) { musicFile.seek(+9, SEEK_CUR); } else { musicFile.seek(+13, SEEK_CUR); @@ -373,7 +373,7 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) { musicFile.read(spoolPtr, size); musicFile.close(); - if (_vm->_heversion == 70) { + if (_vm->_game.heversion == 70) { _vm->_mixer->playRaw(&_heSoundChannels[heChannel], spoolPtr, size, 11025, flags, soundID); return; } diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index f8de332dcf..aa35412587 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -121,7 +121,7 @@ void Wiz::polygonTransform(int resNum, int state, int po_x, int po_y, int angle, getWizImageDim(resNum, state, w, h); // set the transformation origin to the center of the image - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { pts[0].x = pts[3].x = -(w / 2); pts[1].x = pts[2].x = w / 2 - 1; pts[0].y = pts[1].y = -(h / 2); @@ -887,7 +887,7 @@ void Wiz::captureWizImage(int resNum, const Common::Rect& r, bool backBuffer, in if (rCapt.intersects(r)) { rCapt.clip(r); const uint8 *palPtr; - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { palPtr = _vm->_hePalettes + 1024; } else { palPtr = _vm->_currentPalette; @@ -985,7 +985,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int uint8 *dst = NULL; const uint8 *palPtr = NULL; - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { if (palette) { palPtr = _vm->_hePalettes + palette * 1024 + 768; } else { @@ -1024,7 +1024,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int x1, int y1, int zorder, int if (flags & kWIFRemapPalette) { rmap = _vm->findWrappedBlock(MKID('RMAP'), dataPtr, state, 0); assert(rmap); - if (_vm->_heversion <= 80 || READ_BE_UINT32(rmap) != 0x01234567) { + if (_vm->_game.heversion <= 80 || READ_BE_UINT32(rmap) != 0x01234567) { uint8 *rgbs = _vm->findWrappedBlock(MKID('RGBS'), dataPtr, state, 0); assert(rgbs); _vm->remapHEPalette(rgbs, rmap + 4); @@ -1533,7 +1533,7 @@ void Wiz::createWizEmptyImage(const WizParameters *params) { res_size += 8 + img_w * img_h; const uint8 *palPtr; - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { palPtr = _vm->_hePalettes + 1024; } else { palPtr = _vm->_currentPalette; @@ -1996,7 +1996,7 @@ int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags } switch (c) { case 0: - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { ret = getRawWizPixelColor(wizd, x, y, w, h, _vm->VAR(_vm->VAR_WIZ_TCOLOR)) != _vm->VAR(_vm->VAR_WIZ_TCOLOR) ? 1 : 0; } else { ret = 0; @@ -2030,7 +2030,7 @@ uint8 Wiz::getWizPixelColor(int resNum, int state, int x, int y, int flags) { assert(wizd); switch (c) { case 0: - if (_vm->_heversion >= 99) { + if (_vm->_game.heversion >= 99) { color = getRawWizPixelColor(wizd, x, y, w, h, _vm->VAR(_vm->VAR_WIZ_TCOLOR)); } else { color = _vm->VAR(_vm->VAR_WIZ_TCOLOR); diff --git a/engines/scumm/help.cpp b/engines/scumm/help.cpp index acc9e67a6d..16d840b4aa 100644 --- a/engines/scumm/help.cpp +++ b/engines/scumm/help.cpp @@ -122,7 +122,7 @@ void ScummHelp::updateStrings(byte gameId, byte version, Common::Platform platfo // HACK. I know use of g_scumm here is evil, however, // introducing new GID and putting it everywhere will // pollute code much more that this single instance - if (g_scumm->_platform == Common::kPlatformNES) { + if (g_scumm->_game.platform == Common::kPlatformNES) { ADD_BIND("q", "Push"); ADD_BIND("a", "Pull"); ADD_BIND("z", "Give"); diff --git a/engines/scumm/imuse.cpp b/engines/scumm/imuse.cpp index 5d170e98b8..a4eede4935 100644 --- a/engines/scumm/imuse.cpp +++ b/engines/scumm/imuse.cpp @@ -279,7 +279,7 @@ bool IMuseInternal::startSound(int sound) { // workaround is to clear the trigger if the player listens to Rex or // Wally before tune 81 has finished on its own. - if (g_scumm->_gameId == GID_SAMNMAX && sound == 82 && getSoundStatus(81, false)) + if (g_scumm->_game.id == GID_SAMNMAX && sound == 82 && getSoundStatus(81, false)) ImClearTrigger(81, 1); player->clear(); @@ -776,7 +776,7 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) { debug(0, "IMuse doCommand(16) - set_volchan (%d, %d)", a[1], a[2]); return set_volchan(a[1], a[2]); case 17: - if (g_scumm->_gameId != GID_SAMNMAX) { + if (g_scumm->_game.id != GID_SAMNMAX) { debug(0, "IMuse doCommand(17) - set_channel_volume (%d, %d)", a[1], a[2]); return set_channel_volume(a[1], a[2]); } else { @@ -791,7 +791,7 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) { } } case 18: - if (g_scumm->_gameId != GID_SAMNMAX) { + if (g_scumm->_game.id != GID_SAMNMAX) { return set_volchan_entry(a[1], a[2]); } else { // Sam & Max: ImCheckTrigger. @@ -839,7 +839,7 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) { switch (cmd) { case 0: - if (g_scumm->_gameId == GID_SAMNMAX) { + if (g_scumm->_game.id == GID_SAMNMAX) { if (a[3] == 1) // Measure number return ((player->getBeatIndex() - 1) >> 2) + 1; else if (a[3] == 2) // Beat number @@ -849,7 +849,7 @@ int32 IMuseInternal::doCommand(int numargs, int a[]) { return player->getParam(a[2], a[3]); } case 1: - if (g_scumm->_gameId == GID_SAMNMAX) { + if (g_scumm->_game.id == GID_SAMNMAX) { // FIXME: Could someone verify this? // // This jump instruction is known to be used in diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index 83deb91e54..0feecd122f 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -87,7 +87,7 @@ void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, i break; case 0x1000: // ImuseSetState debug(5, "ImuseSetState (%d)", b); - if ((_vm->_gameId == GID_DIG) && (_vm->_features & GF_DEMO)) { + if ((_vm->_game.id == GID_DIG) && (_vm->_game.features & GF_DEMO)) { if (b == 1) { fadeOutMusic(200); startMusic(1, 127); @@ -97,7 +97,7 @@ void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, i startMusic(2, 127); } } - } else if ((_vm->_gameId == GID_CMI) && (_vm->_features & GF_DEMO)) { + } else if ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO)) { fadeOutMusic(120); if (b == 2) { startMusic("in1.imx", 1100, 0, 127); @@ -112,34 +112,34 @@ void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, i } else { warning("imuse digital: set state unknown for cmi demo: %d, room: %d", b, _vm->_currentRoom); } - } else if (_vm->_gameId == GID_DIG) { + } else if (_vm->_game.id == GID_DIG) { setDigMusicState(b); - } else if (_vm->_gameId == GID_CMI) { + } else if (_vm->_game.id == GID_CMI) { setComiMusicState(b); - } else if (_vm->_gameId == GID_FT) { + } else if (_vm->_game.id == GID_FT) { setFtMusicState(b); } break; case 0x1001: // ImuseSetSequence debug(5, "ImuseSetSequence (%d)", b); - if (_vm->_gameId == GID_DIG) { + if (_vm->_game.id == GID_DIG) { setDigMusicSequence(b); - } else if (_vm->_gameId == GID_CMI) { + } else if (_vm->_game.id == GID_CMI) { setComiMusicSequence(b); - } else if (_vm->_gameId == GID_FT) { + } else if (_vm->_game.id == GID_FT) { setFtMusicSequence(b); } break; case 0x1002: // ImuseSetCuePoint debug(5, "ImuseSetCuePoint (%d)", b); - if (_vm->_gameId == GID_FT) { + if (_vm->_game.id == GID_FT) { setFtMusicCuePoint(b); } break; case 0x1003: // ImuseSetAttribute debug(5, "ImuseSetAttribute (%d, %d)", b, c); - assert((_vm->_gameId == GID_DIG) || (_vm->_gameId == GID_FT)); - if (_vm->_gameId == GID_DIG) { + assert((_vm->_game.id == GID_DIG) || (_vm->_game.id == GID_FT)); + if (_vm->_game.id == GID_DIG) { _attributes[b] = c; } break; diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 6adef74ab7..61d625ec0a 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -273,8 +273,8 @@ bool ImuseDigiSndMgr::openMusicBundle(soundStruct *sound, int disk) { sound->bundle = new BundleMgr(_cacheBundleDir); assert(sound->bundle); - if (_vm->_gameId == GID_CMI) { - if (_vm->_features & GF_DEMO) { + if (_vm->_game.id == GID_CMI) { + if (_vm->_game.features & GF_DEMO) { result = sound->bundle->open("music.bun", sound->compressed); } else { char musicfile[20]; @@ -293,7 +293,7 @@ bool ImuseDigiSndMgr::openMusicBundle(soundStruct *sound, int disk) { // FIXME: Shouldn't we only set _disk if result == true? _disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK); } - } else if (_vm->_gameId == GID_DIG) + } else if (_vm->_game.id == GID_DIG) result = sound->bundle->open("digmusic.bun", sound->compressed, true); else error("ImuseDigiSndMgr::openMusicBundle() Don't know which bundle file to load"); @@ -308,8 +308,8 @@ bool ImuseDigiSndMgr::openVoiceBundle(soundStruct *sound, int disk) { sound->bundle = new BundleMgr(_cacheBundleDir); assert(sound->bundle); - if (_vm->_gameId == GID_CMI) { - if (_vm->_features & GF_DEMO) { + if (_vm->_game.id == GID_CMI) { + if (_vm->_game.features & GF_DEMO) { result = sound->bundle->open("voice.bun", sound->compressed); } else { char voxfile[20]; @@ -328,7 +328,7 @@ bool ImuseDigiSndMgr::openVoiceBundle(soundStruct *sound, int disk) { // FIXME: Shouldn't we only set _disk if result == true? _disk = (byte)_vm->VAR(_vm->VAR_CURRENTDISK); } - } else if (_vm->_gameId == GID_DIG) + } else if (_vm->_game.id == GID_DIG) result = sound->bundle->open("digvoice.bun", sound->compressed); else error("ImuseDigiSndMgr::openVoiceBundle() Don't know which bundle file to load"); @@ -347,7 +347,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch error("ImuseDigiSndMgr::openSound() can't alloc free sound slot"); } - const bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO)); + const bool header_outside = ((_vm->_game.id == GID_CMI) && !(_vm->_game.features & GF_DEMO)); bool result = false; byte *ptr = NULL; @@ -579,7 +579,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b } int header_size = soundHandle->offsetData; - bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO)); + bool header_outside = ((_vm->_game.id == GID_CMI) && !(_vm->_game.features & GF_DEMO)); if ((soundHandle->bundle) && (!soundHandle->compressed)) { size = soundHandle->bundle->decompressSampleByCurIndex(start + offset, size, buf, header_size, header_outside); } else if (soundHandle->resPtr) { diff --git a/engines/scumm/imuse_player.cpp b/engines/scumm/imuse_player.cpp index 06ebd289cd..cf40044a9d 100644 --- a/engines/scumm/imuse_player.cpp +++ b/engines/scumm/imuse_player.cpp @@ -402,7 +402,7 @@ void Player::sysEx(byte *p, uint16 len) { switch (code = *p++) { case 0: - if (g_scumm->_gameId != GID_SAMNMAX) { + if (g_scumm->_game.id != GID_SAMNMAX) { // There are 17 bytes of useful information beyond // what we've read so far. All we know about them is // as follows: diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 7073bd596f..8b8dc75df1 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -87,10 +87,10 @@ void ScummEngine::parseEvents() { // because that's what MI2 looks for in // its "instant win" cheat. _keyPressed = event.kbd.keycode + 154; - } else if (event.kbd.ascii == 315 && (_gameId == GID_CMI && !(_features & GF_DEMO))) { + } else if (event.kbd.ascii == 315 && (_game.id == GID_CMI && !(_game.features & GF_DEMO))) { // FIXME: support in-game menu screen. For now, this remaps F1 to F5 in COMI _keyPressed = 319; - } else if (event.kbd.ascii < 273 || event.kbd.ascii > 276 || _version >= 7) { + } else if (event.kbd.ascii < 273 || event.kbd.ascii > 276 || _game.version >= 7) { // don't let game have arrow keys as we currently steal them // for keyboard cursor control // this fixes bug with up arrow (273) corresponding to @@ -101,7 +101,7 @@ void ScummEngine::parseEvents() { _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. } - if (_heversion >= 80) { + if (_game.heversion >= 80) { // Keyboard is controlled via variable int _keyState = 0; @@ -198,7 +198,7 @@ void ScummEngine::clearClickedStatus() { _keyPressed = 0; #ifndef DISABLE_HE - if (_heversion >= 98) { + if (_game.heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed); } #endif @@ -211,14 +211,14 @@ void ScummEngine::processKbd(bool smushMode) { int saveloadkey; #ifndef DISABLE_HE - if (_heversion >= 98) { + if (_game.heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->processKeyStroke(_keyPressed); } #endif _lastKeyHit = _keyPressed; _keyPressed = 0; - if (((_version <= 2) || (_platform == Common::kPlatformFMTowns && _version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) { + if (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && 315 <= _lastKeyHit && _lastKeyHit < 315+12) { // Convert F-Keys for V1/V2 games (they start at 1 instead of at 315) _lastKeyHit -= 314; } @@ -238,7 +238,7 @@ void ScummEngine::processKbd(bool smushMode) { _virtualMouse.x = _mouse.x + virtscr[0].xstart; _virtualMouse.y = _mouse.y - virtscr[0].topline; - if (_features & GF_NEW_CAMERA) + if (_game.features & GF_NEW_CAMERA) _virtualMouse.y += _screenTop; if (_virtualMouse.y < 0) @@ -262,14 +262,14 @@ void ScummEngine::processKbd(bool smushMode) { } } - if (_leftBtnPressed & msClicked && _rightBtnPressed & msClicked && _version >= 4) { + if (_leftBtnPressed & msClicked && _rightBtnPressed & msClicked && _game.version >= 4) { // Pressing both mouse buttons is treated as if you pressed // the cutscene exit key (i.e. ESC in most games). That mimicks // the behaviour of the original engine where pressing both // mouse buttons also skips the current cutscene. _mouseAndKeyboardStat = 0; _lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY); - } else if (_rightBtnPressed & msClicked && (_version <= 3 && _gameId != GID_LOOM)) { + } else if (_rightBtnPressed & msClicked && (_game.version <= 3 && _game.id != GID_LOOM)) { // Pressing right mouse button is treated as if you pressed // the cutscene exit key (i.e. ESC in most games). That mimicks // the behaviour of the original engine where pressing right @@ -282,11 +282,11 @@ void ScummEngine::processKbd(bool smushMode) { _mouseAndKeyboardStat = MBS_RIGHT_CLICK; } - if (_version >= 6) { + if (_game.version >= 6) { VAR(VAR_LEFTBTN_HOLD) = (_leftBtnPressed & msDown) != 0; VAR(VAR_RIGHTBTN_HOLD) = (_rightBtnPressed & msDown) != 0; - if (_version >= 7) { + if (_game.version >= 7) { VAR(VAR_LEFTBTN_DOWN) = (_leftBtnPressed & msClicked) != 0; VAR(VAR_RIGHTBTN_DOWN) = (_rightBtnPressed & msClicked) != 0; } @@ -324,7 +324,7 @@ void ScummEngine::processKbd(bool smushMode) { } #endif - if (_version >= 6 && _lastKeyHit == 20) { + if (_game.version >= 6 && _lastKeyHit == 20) { char buf[256]; _voiceMode++; @@ -358,7 +358,7 @@ void ScummEngine::processKbd(bool smushMode) { } if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY) || - (((_version <= 2) || (_platform == Common::kPlatformFMTowns && _version == 3)) && _lastKeyHit == 8)) { + (((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) && _lastKeyHit == 8)) { confirmRestartDialog(); return; } @@ -371,26 +371,26 @@ void ScummEngine::processKbd(bool smushMode) { // COMI version string is hard coded // Dig/FT version strings are partly hard coded too - if (_version == 7 && _lastKeyHit == VAR(VAR_VERSION_KEY)) { + if (_game.version == 7 && _lastKeyHit == VAR(VAR_VERSION_KEY)) { versionDialog(); return; } - if ((_version <= 2) || (_platform == Common::kPlatformFMTowns && _version == 3)) + if ((_game.version <= 2) || (_game.platform == Common::kPlatformFMTowns && _game.version == 3)) saveloadkey = 5; // F5 - else if ((_version <= 3) || (_gameId == GID_SAMNMAX) || (_gameId == GID_CMI) || (_heversion >= 72)) + else if ((_game.version <= 3) || (_game.id == GID_SAMNMAX) || (_game.id == GID_CMI) || (_game.heversion >= 72)) saveloadkey = 319; // F5 else saveloadkey = VAR(VAR_MAINMENU_KEY); - if ((_platform == Common::kPlatformC64 && _gameId == GID_MANIAC && _lastKeyHit == 27) || + if ((_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC && _lastKeyHit == 27) || (VAR_CUTSCENEEXIT_KEY != 0xFF && _lastKeyHit == VAR(VAR_CUTSCENEEXIT_KEY))) { #ifndef DISABLE_SCUMM_7_8 // Skip cutscene (or active SMUSH video). For the V2 games, which // normally use F4 for this, we add in a hack that makes escape work, // too (just for convenience). if (smushMode) { - if (_gameId == GID_FT) + if (_game.id == GID_FT) _insane->escapeKeyHandler(); else _smushVideoShouldFinish = true; @@ -398,7 +398,7 @@ void ScummEngine::processKbd(bool smushMode) { #endif if (!smushMode || _smushVideoShouldFinish) abortCutscene(); - if (_version <= 2) { + if (_game.version <= 2) { // Ensure that the input script also sees the key press. // This is necessary so you can abort the airplane travel // in Zak. @@ -450,7 +450,7 @@ void ScummEngine::processKbd(bool smushMode) { VAR(VAR_CHARINC) = _defaultTalkDelay; } else if (_lastKeyHit == '~' || _lastKeyHit == '#') { // Debug console _debugger->attach(); - } else if (_version <= 2) { + } else if (_game.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 diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index 08c982b65f..6e769153c6 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -55,7 +55,7 @@ Insane::Insane(ScummEngine_v6 *scumm) { initvars(); - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { readFileToMem("roadrash.rip", &_smush_roadrashRip); readFileToMem("roadrsh2.rip", &_smush_roadrsh2Rip); readFileToMem("roadrsh3.rip", &_smush_roadrsh3Rip); @@ -179,7 +179,7 @@ void Insane::initvars(void) { _iactBits[i] = 0; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { init_enemyStruct(EN_ROTT1, EN_ROTT1, 0, 0, 160, 0, INV_MACE, 63, "endcrshr.san", 25, 15, 16, 26, 11, 3); } else { @@ -634,7 +634,7 @@ void Insane::putActors(void) { void Insane::readState(void) { // PATCH - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { _actor[0].inventory[INV_CHAIN] = 0; _actor[0].inventory[INV_CHAINSAW] = 0; _actor[0].inventory[INV_MACE] = 0; @@ -803,7 +803,7 @@ void Insane::prepareScenePropScene(int32 scenePropNum, bool arg_4, bool arg_8) { debugC(DEBUG_INSANE, "Insane::prepareScenePropScene(%d, %d, %d)", scenePropNum, arg_4, arg_8); - if (((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) || !loadScenePropSounds(idx)) + if (((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) || !loadScenePropSounds(idx)) return; _actor[0].defunct = arg_4; @@ -900,7 +900,7 @@ int32 Insane::weaponDamage(int32 actornum) { } void Insane::reinitActors(void) { - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { smlayer_setActorCostume(0, 2, readArray(11)); smlayer_setActorCostume(0, 0, readArray(13)); smlayer_setActorCostume(0, 1, readArray(12)); @@ -956,7 +956,7 @@ void Insane::escapeKeyHandler(void) { struct fluConf *flu; // Demos have just one scene - if (!_insaneIsRunning || _vm->_features & GF_DEMO) { + if (!_insaneIsRunning || _vm->_game.features & GF_DEMO) { smush_setToFinish(); return; } @@ -1182,7 +1182,7 @@ void Insane::smlayer_setActorLayer(int actornum, int actnum, int layer) { } void Insane::smlayer_setFluPalette(byte *pal, int shut_flag) { - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) return; // if (shut_flag) @@ -1298,7 +1298,7 @@ void Insane::procSKIP(Chunk &b) { int16 par1, par2; _player->_skipNext = false; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { _player->checkBlock(b, TYPE_SKIP, 2); par1 = b.getWord(); if (isBitSet(par1)) diff --git a/engines/scumm/insane/insane_ben.cpp b/engines/scumm/insane/insane_ben.cpp index 4e58fa14c9..465922d353 100644 --- a/engines/scumm/insane/insane_ben.cpp +++ b/engines/scumm/insane/insane_ben.cpp @@ -125,7 +125,7 @@ int32 Insane::actionBen(void) { bool doDamage = false; int sound; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) sound = 59; else sound = 95; @@ -566,7 +566,7 @@ void Insane::actor02Reaction(int32 buttons) { if (_actor[0].act[2].frame == 2) { if (_currEnemy != EN_CAVEFISH) { tmp = calcEnemyDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(50); } else { @@ -889,7 +889,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_2X4: case INV_BOOT: tmp = calcEnemyDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(52); if (tmp == 1000) @@ -1014,7 +1014,7 @@ void Insane::actor02Reaction(int32 buttons) { smlayer_setActorFacing(0, 2, 19, 180); _actor[0].act[2].state = 27; _actor[0].act[2].tilt = calcTilt(_actor[0].tilt); - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) smlayer_startSfx(72); break; case 27: @@ -1057,7 +1057,7 @@ void Insane::actor02Reaction(int32 buttons) { case INV_BOOT: case INV_DUST: tmp = calcEnemyDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(58); if (tmp == 1000) @@ -1176,7 +1176,7 @@ void Insane::actor02Reaction(int32 buttons) { case 36: smlayer_setActorLayer(0, 2, 5); _actor[0].kicking = false; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) smlayer_setActorCostume(0, 2, readArray(17)); else smlayer_setActorCostume(0, 2, readArray(18)); @@ -1222,7 +1222,7 @@ void Insane::actor02Reaction(int32 buttons) { case EN_ROTT1: case EN_ROTT2: case EN_ROTT3: - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) queueSceneSwitch(9, 0, "bencrshe.san", 64, 0, 0, 0); else queueSceneSwitch(9, 0, "wr2_benr.san", 64, 0, 0, 0); @@ -1923,7 +1923,7 @@ void Insane::switchBenWeapon(void) { _actor[0].act[2].state = 34; break; case INV_WRENCH: - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) smlayer_setActorCostume(0, 2, readArray(24)); else smlayer_setActorCostume(0, 2, readArray(25)); @@ -1934,7 +1934,7 @@ void Insane::switchBenWeapon(void) { case INV_BOOT: case INV_HAND: case INV_DUST: - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) smlayer_setActorCostume(0, 2, readArray(11)); else smlayer_setActorCostume(0, 2, readArray(12)); @@ -1985,7 +1985,7 @@ int32 Insane::setBenState(void) { void Insane::ouchSoundBen(void) { _actor[0].act[3].state = 52; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { smlayer_startVoice(54); return; } diff --git a/engines/scumm/insane/insane_enemy.cpp b/engines/scumm/insane/insane_enemy.cpp index d67fc7ae09..2b12754131 100644 --- a/engines/scumm/insane/insane_enemy.cpp +++ b/engines/scumm/insane/insane_enemy.cpp @@ -1266,7 +1266,7 @@ void Insane::ouchSoundEnemy(void) { _actor[1].act[3].state = 52; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { smlayer_startVoice(55); return; } @@ -1700,7 +1700,7 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].weaponClass = 1; if (_actor[1].act[2].frame >= 6) { tmp = calcBenDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(50); } else if (tmp == 1) @@ -1872,7 +1872,7 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorFacing(1, 2, 19, 180); _actor[1].act[2].state = 19; _actor[1].act[2].tilt = calcTilt(_actor[1].tilt); - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { smlayer_startSfx(69); if (!_actor[1].field_54) { tmp = _vm->_rnd.getRandomNumber(4); @@ -1936,7 +1936,7 @@ void Insane::actor12Reaction(int32 buttons) { case INV_2X4: case INV_BOOT: tmp = calcBenDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(52); else if (tmp == 1000) @@ -2054,7 +2054,7 @@ void Insane::actor12Reaction(int32 buttons) { _actor[1].kicking = true; if (_actor[1].act[2].frame >= 3) { tmp = calcBenDamage(1, 1); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { if (tmp == 1) smlayer_startSfx(57); } else if (tmp == 1) @@ -2110,7 +2110,7 @@ void Insane::actor12Reaction(int32 buttons) { smlayer_setActorLayer(1, 2, 25); _actor[1].act[2].state = 37; - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { smlayer_startSfx(96); switch (_currEnemy) { case EN_ROTT1: diff --git a/engines/scumm/insane/insane_iact.cpp b/engines/scumm/insane/insane_iact.cpp index c706c7d191..9b2ceb3230 100644 --- a/engines/scumm/insane/insane_iact.cpp +++ b/engines/scumm/insane/insane_iact.cpp @@ -324,7 +324,7 @@ void Insane::iactScene4(byte *renderBitmap, int32 codecparam, int32 setupsan12, int32 setupsan13, Chunk &b, int32 size, int32 flags) { _player->checkBlock(b, TYPE_IACT, 8); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) return; int16 par1, par2, par3, par4, par5; diff --git a/engines/scumm/insane/insane_scenes.cpp b/engines/scumm/insane/insane_scenes.cpp index 7cc01fc2cf..651852a5a5 100644 --- a/engines/scumm/insane/insane_scenes.cpp +++ b/engines/scumm/insane/insane_scenes.cpp @@ -68,14 +68,14 @@ void Insane::runScene(int arraynum) { break; case 2: setupValues(); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) smlayer_setActorCostume(0, 2, readArray(10)); else smlayer_setActorCostume(0, 2, readArray(11)); smlayer_putActor(0, 2, _actor[0].x, _actor[0].y1 + 190, _smlayer_room2); _mainRoadPos = readArray(2); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { initScene(5); startVideo("tovista.san", 1, 32, 12, 0); } else if (_mainRoadPos == _posBrokenTruck) { @@ -142,7 +142,7 @@ void Insane::runScene(int arraynum) { _insaneIsRunning = false; - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { writeArray(50, _actor[0].inventory[INV_CHAIN]); writeArray(51, _actor[0].inventory[INV_CHAINSAW]); writeArray(52, _actor[0].inventory[INV_MACE]); @@ -239,7 +239,7 @@ void Insane::stopSceneSounds(int sceneId) { _actor[1].defunct = 0; _actor[1].scenePropSubIdx = 0; _actor[1].field_54 = 0; - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { smlayer_stopSound(59); smlayer_stopSound(63); } else { @@ -315,7 +315,7 @@ void Insane::shutCurrentScene(void) { // insane_loadSceneData1 & insane_loadSceneData2 int Insane::loadSceneData(int scene, int flag, int phase) { - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) return 1; int retvalue = 1; @@ -649,7 +649,7 @@ void Insane::setSceneCostumes(int sceneId) { case 4: case 5: case 6: - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) smlayer_setActorCostume(0, 2, readArray(10)); else smlayer_setActorCostume(0, 2, readArray(11)); @@ -669,7 +669,7 @@ void Insane::setEnemyCostumes(void) { debugC(DEBUG_INSANE, "setEnemyCostumes(%d)", _currEnemy); - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) { + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { smlayer_setActorCostume(0, 2, readArray(11)); smlayer_setActorCostume(0, 0, readArray(13)); smlayer_setActorCostume(0, 1, readArray(12)); @@ -1133,7 +1133,7 @@ void Insane::postCase20(byte *renderBitmap, int32 codecparam, int32 setupsan12, void Insane::postCase3(byte *renderBitmap, int32 codecparam, int32 setupsan12, int32 setupsan13, int32 curFrame, int32 maxFrame) { - if ((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)) + if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) turnBen(false); else turnBen(true); diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 7f09a69b72..f838d6732c 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -63,7 +63,7 @@ bool ScummEngine::getClass(int obj, int cls) const { cls &= 0x7F; checkRange(32, 1, cls, "Class %d out of range in getClass"); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { // Translate the new (V5) object classes to the old classes // (for those which differ). switch (cls) { @@ -90,7 +90,7 @@ void ScummEngine::putClass(int obj, int cls, bool set) { cls &= 0x7F; checkRange(32, 1, cls, "Class %d out of range in putClass"); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { // Translate the new (V5) object classes to the old classes // (for those which differ). switch (cls) { @@ -114,7 +114,7 @@ void ScummEngine::putClass(int obj, int cls, bool set) { else _classData[obj] &= ~(1 << (cls - 1)); - if (_version <= 4 && obj >= 1 && obj < _numActors) { + if (_game.version <= 4 && obj >= 1 && obj < _numActors) { _actors[obj].classChanged(cls, set); } } @@ -143,7 +143,7 @@ int ScummEngine::getState(int obj) { // the it. Fortunately it does not prevent frustrated players from // blowing up the mansion, should they feel the urge to. - if (_gameId == GID_MANIAC && (obj == 182 || obj == 193)) + if (_game.id == GID_MANIAC && (obj == 182 || obj == 193)) _objectStateTable[obj] |= 0x08; } @@ -234,7 +234,7 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { const byte *ptr; const ImageHeader *imhd; - if (_version >= 6) { + if (_game.version >= 6) { state = getState(object) - 1; if (state < 0) state = 0; @@ -249,7 +249,7 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { } imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr); assert(imhd); - if (_version == 8) { + if (_game.version == 8) { switch (FROM_LE_32(imhd->v8.version)) { case 800: x = od.x_pos + (int32)READ_LE_UINT32((const byte *)imhd + 8 * state + 0x44); @@ -262,7 +262,7 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { default: error("Unsupported image header version %d\n", FROM_LE_32(imhd->v8.version)); } - } else if (_version == 7) { + } else if (_game.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 { @@ -273,7 +273,7 @@ void ScummEngine::getObjectXYPos(int object, int &x, int &y, int &dir) { x = od.walk_x; y = od.walk_y; } - if (_version == 8) + if (_game.version == 8) dir = fromSimpleDir(1, od.actordir); else dir = oldDirToNewDir(od.actordir & 3); @@ -316,7 +316,7 @@ int ScummEngine::getObjActToObjActDist(int a, int b) { } // Now compute the distance between the two points - if (_version <= 2) { + if (_game.version <= 2) { // For V1/V2 games, distances are measured in the original "character" // based coordinate system, instead of pixels. Otherwise various scripts // will break. See bugs #853874, #774529 @@ -332,17 +332,17 @@ int ScummEngine::getObjActToObjActDist(int a, int b) { int ScummEngine::findObject(int x, int y) { int i, b; byte a; - const int mask = (_version <= 2) ? 0x8 : 0xF; + const int mask = (_game.version <= 2) ? 0x8 : 0xF; for (i = 1; i < _numLocalObjects; i++) { if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable)) continue; - if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { if (_objs[i].flags == 0 && _objs[i].state & 0x2) continue; } else { - if (_version <= 2 && _objs[i].state & 0x2) + if (_game.version <= 2 && _objs[i].state & 0x2) continue; } @@ -352,7 +352,7 @@ int ScummEngine::findObject(int x, int y) { b = _objs[b].parent; if (b == 0) { #ifndef DISABLE_HE - if (_heversion >= 70) { + if (_game.heversion >= 70) { if (((ScummEngine_v70he *)this)->_wiz->polygonHit(_objs[i].obj_nr, x, y)) return _objs[i].obj_nr; } @@ -371,7 +371,7 @@ int ScummEngine::findObject(int x, int y) { void ScummEngine::drawRoomObject(int i, int arg) { ObjectData *od; byte a; - const int mask = (_version <= 2) ? 0x8 : 0xF; + const int mask = (_game.version <= 2) ? 0x8 : 0xF; od = &_objs[i]; if ((i < 1) || (od->obj_nr < 1) || !od->state) @@ -380,7 +380,7 @@ void ScummEngine::drawRoomObject(int i, int arg) { do { a = od->parentstate; if (!od->parent) { - if (_version <= 6 || od->fl_object_index == 0) + if (_game.version <= 6 || od->fl_object_index == 0) drawObject(i, arg); break; } @@ -390,9 +390,9 @@ void ScummEngine::drawRoomObject(int i, int arg) { void ScummEngine::drawRoomObjects(int arg) { int i; - const int mask = (_version <= 2) ? 0x8 : 0xF; + const int mask = (_game.version <= 2) ? 0x8 : 0xF; - if (_heversion >= 60) { + if (_game.heversion >= 60) { // In HE games, normal objects are drawn, followed by FlObjects. for (i = (_numLocalObjects-1); i > 0; i--) { if (_objs[i].obj_nr > 0 && (_objs[i].state & mask) && _objs[i].fl_object_index == 0) @@ -402,7 +402,7 @@ void ScummEngine::drawRoomObjects(int arg) { if (_objs[i].obj_nr > 0 && (_objs[i].state & mask) && _objs[i].fl_object_index != 0) drawRoomObject(i, arg); } - } else if (_gameId == GID_SAMNMAX) { + } else if (_game.id == GID_SAMNMAX) { // In Sam & Max, objects are drawn in reverse order. for (i = 1; i < _numLocalObjects; i++) if (_objs[i].obj_nr > 0) @@ -465,7 +465,7 @@ void ScummEngine::drawObject(int obj, int arg) { ptr = getOBIMFromObjectData(od); - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) ptr += 0; else ptr = getObjectImage(ptr, getState(od.obj_nr)); @@ -494,11 +494,11 @@ void ScummEngine::drawObject(int obj, int arg) { // Sam & Max needs this to fix object-layering problems with // the inventory and conversation icons. - if ((_gameId == GID_SAMNMAX && getClass(od.obj_nr, kObjectClassIgnoreBoxes)) || - (_gameId == GID_FT && getClass(od.obj_nr, kObjectClassPlayer))) + if ((_game.id == GID_SAMNMAX && getClass(od.obj_nr, kObjectClassIgnoreBoxes)) || + (_game.id == GID_FT && getClass(od.obj_nr, kObjectClassPlayer))) flags |= Gdi::dbDrawMaskOnAll; - if (_heversion >= 70 && findResource(MKID('SMAP'), ptr) == NULL) + if (_game.heversion >= 70 && findResource(MKID('SMAP'), ptr) == NULL) gdi.drawBMAPObject(ptr, &virtscr[0], obj, od.x_pos, od.y_pos, od.width, od.height); else gdi.drawBitmap(ptr, &virtscr[0], x, ypos, width * 8, height, x - xpos, numstrip, flags); @@ -508,7 +508,7 @@ void ScummEngine::drawObject(int obj, int arg) { void ScummEngine::clearRoomObjects() { int i; - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { for (i = 0; i < _numLocalObjects; i++) { _objs[i].obj_nr = 0; } @@ -528,7 +528,7 @@ void ScummEngine::clearRoomObjects() { res.nukeResource(rtFlObject, _objs[i].fl_object_index); _objs[i].obj_nr = 0; _objs[i].fl_object_index = 0; - } else if (_heversion >= 70) { + } else if (_game.heversion >= 70) { storeFlObject(i); _objs[i].obj_nr = 0; _objs[i].fl_object_index = 0; @@ -580,7 +580,7 @@ void ScummEngine::loadRoomObjects() { if (_numObjectsInRoom > _numLocalObjects) error("More than %d objects in room %d", _numLocalObjects, _roomResource); - if (_version == 8) + if (_game.version == 8) searchptr = rootptr = getResourceAddress(rtRoomScripts, _roomResource); else searchptr = rootptr = room; @@ -598,9 +598,9 @@ void ScummEngine::loadRoomObjects() { od->OBCDoffset = ptr - rootptr; cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), ptr); - if (_version >= 7) + if (_game.version >= 7) od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); - else if (_version == 6) + else if (_game.version == 6) od->obj_nr = READ_LE_UINT16(&(cdhd->v6.obj_id)); else od->obj_nr = READ_LE_UINT16(&(cdhd->v5.obj_id)); @@ -651,7 +651,7 @@ void ScummEngine_v3old::loadRoomObjects() { if (_numObjectsInRoom > _numLocalObjects) error("More than %d objects in room %d", _numLocalObjects, _roomResource); - if (_version <= 2) + if (_game.version <= 2) ptr = room + 28; else ptr = room + 29; @@ -759,7 +759,7 @@ void ScummEngine_v4::setupRoomObject(ObjectData *od, const byte *room, const byt assert(room); const byte *ptr = room + od->OBCDoffset; - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) ptr -= 2; od->obj_nr = READ_LE_UINT16(ptr + 6); @@ -768,14 +768,14 @@ void ScummEngine_v4::setupRoomObject(ObjectData *od, const byte *room, const byt od->y_pos = ((*(ptr + 10)) & 0x7F) * 8; od->parentstate = (*(ptr + 10) & 0x80) ? 1 : 0; - if (_version <= 2) + if (_game.version <= 2) od->parentstate *= 8; od->width = *(ptr + 11) * 8; od->parent = *(ptr + 12); - if (_version <= 2) { + if (_game.version <= 2) { od->walk_x = *(ptr + 13) * 8; od->walk_y = (*(ptr + 14) & 0x1f) * 8; od->actordir = (*(ptr + 15)) & 7; @@ -795,7 +795,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte * assert(room); if (searchptr == NULL) { - if (_version == 8) + if (_game.version == 8) searchptr = getResourceAddress(rtRoomScripts, _roomResource); else searchptr = room; @@ -809,7 +809,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte * od->flags = Gdi::dbAllowMaskOr; - if (_version == 8) { + if (_game.version == 8) { od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -824,7 +824,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte * if (FROM_LE_32(imhd->v8.version) == 801) od->flags = ((((byte)READ_LE_UINT32(&imhd->v8.flags)) & 16) == 0) ? Gdi::dbAllowMaskOr : 0; - } else if (_version == 7) { + } else if (_game.version == 7) { od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -836,7 +836,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte * od->height = READ_LE_UINT16(&imhd->v7.height); od->actordir = (byte)READ_LE_UINT16(&imhd->v7.actordir); - } else if (_version == 6) { + } else if (_game.version == 6) { od->obj_nr = READ_LE_UINT16(&(cdhd->v6.obj_id)); od->width = READ_LE_UINT16(&cdhd->v6.w); @@ -851,7 +851,7 @@ void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte * od->parent = cdhd->v6.parent; od->actordir = cdhd->v6.actordir; - if (_heversion >= 60 && imhd) + if (_game.heversion >= 60 && imhd) od->flags = ((imhd->old.flags & 1) != 0) ? Gdi::dbAllowMaskOr : 0; } else { @@ -1021,12 +1021,12 @@ const byte *ScummEngine::getObjOrActorName(int obj) { if (objptr == NULL) return NULL; - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { byte offset = 0; - if (_version <= 2) + if (_game.version <= 2) offset = *(objptr + 14); - else if (_features & GF_OLD_BUNDLE) + else if (_game.features & GF_OLD_BUNDLE) offset = *(objptr + 16); else offset = *(objptr + 18); @@ -1093,7 +1093,7 @@ byte *ScummEngine::getOBCDFromObject(int obj) { if (_objs[i].fl_object_index) { assert(_objs[i].OBCDoffset == 8); ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index); - } else if (_version == 8) + } else if (_game.version == 8) ptr = getResourceAddress(rtRoomScripts, _roomResource); else ptr = getResourceAddress(rtRoom, _roomResource); @@ -1121,11 +1121,11 @@ const byte *ScummEngine::getOBIMFromObjectData(const ObjectData &od) { const byte *ScummEngine::getObjectImage(const byte *ptr, int state) { assert(ptr); - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) ptr += 0; - else if (_features & GF_SMALL_HEADER) { + else if (_game.features & GF_SMALL_HEADER) { ptr += 8; - } else if (_version == 8) { + } else if (_game.version == 8) { // The OBIM contains an IMAG, which in turn contains a WRAP, which contains // an OFFS chunk and multiple BOMP/SMAP chunks. To find the right BOMP/SMAP, // we use the offsets in the OFFS chunk, @@ -1164,9 +1164,9 @@ int ScummEngine::getObjectImageCount(int object) { if (!imhd) return 0; - if (_version == 8) { + if (_game.version == 8) { return (READ_LE_UINT32(&imhd->v8.image_count)); - } else if (_version == 7) { + } else if (_game.version == 7) { return(READ_LE_UINT16(&imhd->v7.image_count)); } else { return (READ_LE_UINT16(&imhd->old.image_count)); @@ -1191,7 +1191,7 @@ int ScummEngine_v7::getObjectIdFromOBIM(const byte *obim) { #endif int ScummEngine::getObjectIdFromOBIM(const byte *obim) { - if (_features & GF_SMALL_HEADER) + if (_game.features & GF_SMALL_HEADER) return READ_LE_UINT16(obim + 6); const ImageHeader *imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obim); @@ -1215,9 +1215,9 @@ void ScummEngine::addObjectToInventory(uint obj, uint room) { size = READ_BE_UINT32(ptr + 4); } else { findObjectInRoom(&foir, foCodeHeader, obj, room); - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) size = READ_LE_UINT16(foir.obcd); - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) size = READ_LE_UINT32(foir.obcd); else size = READ_BE_UINT32(foir.obcd + 4); @@ -1243,7 +1243,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, id2 = getObjectIndex(id); if (findWhat & foCheckAlreadyLoaded && id2 != -1) { - assert(_version >= 6); + assert(_game.version >= 6); if (findWhat & foCodeHeader) { fo->obcd = obcdptr = getOBCDFromObject(id); assert(obcdptr); @@ -1260,14 +1260,14 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, if (!roomptr) error("findObjectInRoom: failed getting roomptr to %d", room); - if (_features & GF_OLD_BUNDLE) { + if (_game.features & GF_OLD_BUNDLE) { numobj = roomptr[20]; } else { const RoomHeader *roomhdr = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr); - if (_version == 8) + if (_game.version == 8) numobj = READ_LE_UINT32(&(roomhdr->v8.numObjects)); - else if (_version == 7) + else if (_game.version == 7) numobj = READ_LE_UINT16(&(roomhdr->v7.numObjects)); else numobj = READ_LE_UINT16(&(roomhdr->old.numObjects)); @@ -1278,8 +1278,8 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, if (numobj > _numLocalObjects) error("findObjectInRoom: More (%d) than %d objects in room %d", numobj, _numLocalObjects, room); - if (_features & GF_OLD_BUNDLE) { - if (_version <= 2) + if (_game.features & GF_OLD_BUNDLE) { + if (_game.version <= 2) searchptr = roomptr + 28; else searchptr = roomptr + 29; @@ -1305,23 +1305,23 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, } if (findWhat & foCodeHeader) { - if (_version == 8) + if (_game.version == 8) searchptr = getResourceAddress(rtRoomScripts, room); else searchptr = roomptr; assert(searchptr); - ResourceIterator obcds(searchptr, (_features & GF_SMALL_HEADER) != 0); + ResourceIterator obcds(searchptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { obcdptr = obcds.findNext(MKID('OBCD')); if (obcdptr == NULL) error("findObjectInRoom: Not enough code blocks in room %d", room); cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), obcdptr); - if (_features & GF_SMALL_HEADER) + if (_game.features & GF_SMALL_HEADER) id2 = READ_LE_UINT16(obcdptr + 6); - else if (_version >= 7) + else if (_game.version >= 7) id2 = READ_LE_UINT16(&(cdhd->v7.obj_id)); - else if (_version == 6) + else if (_game.version == 6) id2 = READ_LE_UINT16(&(cdhd->v6.obj_id)); else id2 = READ_LE_UINT16(&(cdhd->v5.obj_id)); @@ -1338,7 +1338,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, roomptr = fo->roomptr; if (findWhat & foImageHeader) { - ResourceIterator obims(roomptr, (_features & GF_SMALL_HEADER) != 0); + ResourceIterator obims(roomptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { obimptr = obims.findNext(MKID('OBIM')); if (obimptr == NULL) @@ -1373,7 +1373,7 @@ void ScummEngine::setOwnerOf(int obj, int owner) { // it probably applies to all V6+ games. See bugs #493153 and #907113. // FT disassembly is checked, behaviour is correct. [sev] - int arg = (_version >= 6) ? obj : 0; + int arg = (_game.version >= 6) ? obj : 0; if (owner == 0) { clearOwnerOf(obj); @@ -1469,7 +1469,7 @@ void ScummEngine::setObjectState(int obj, int state, int x, int y) { } addObjectToDrawQue(i); - if (_version >= 7) { + if (_game.version >= 7) { int imagecount; if (state == 0xFF) { state = getState(obj); @@ -1593,7 +1593,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { error("BlastObject object %d image not found", eo->number); const byte *img = getObjectImage(ptr, eo->image); - if (_version == 8) { + if (_game.version == 8) { assert(img); bomp = img + 8; } else { @@ -1606,7 +1606,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { if (!bomp) error("object %d is not a blast object", eo->number); - if (_version == 8) { + if (_game.version == 8) { bdd.srcwidth = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.width); bdd.srcheight = READ_LE_UINT32(&((const BompHeader *)bomp)->v8.height); } else { @@ -1617,7 +1617,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { bdd.dst = *vs; bdd.dst.pixels = vs->getPixels(0, 0); // Skip the bomp header - if (_version == 8) { + if (_game.version == 8) { bdd.dataptr = bomp + 8; } else { bdd.dataptr = bomp + 10; @@ -1749,7 +1749,7 @@ void ScummEngine::loadFlObject(uint object, uint room) { isRoomScriptsLocked = res.isLocked(rtRoomScripts, room); if (!isRoomLocked) res.lock(rtRoom, room); - if (_version == 8 && !isRoomScriptsLocked) + if (_game.version == 8 && !isRoomScriptsLocked) res.lock(rtRoomScripts, room); // Allocate slot & memory for floating object @@ -1767,7 +1767,7 @@ void ScummEngine::loadFlObject(uint object, uint room) { // Unlock room/roomScripts if (!isRoomLocked) res.unlock(rtRoom, room); - if (_version == 8 && !isRoomScriptsLocked) + if (_game.version == 8 && !isRoomScriptsLocked) res.unlock(rtRoomScripts, room); // Setup local object flags diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index d8b8f643f1..c4d23dcd5d 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -203,7 +203,7 @@ void ScummEngine::setupV1Palette() { setPalColor(13, 85, 255, 85); setPalColor(14, 85, 85, 255); - if (_gameId == GID_ZAK) + if (_game.id == GID_ZAK) setPalColor(15, 170, 170, 170); else setPalColor(15, 85, 85, 85); @@ -216,8 +216,8 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { byte *dest, r, g, b; if (numcolor < 0) { - if (_features & GF_SMALL_HEADER) { - if (_features & GF_OLD256) + if (_game.features & GF_SMALL_HEADER) { + if (_game.features & GF_OLD256) numcolor = READ_LE_UINT16(ptr); else numcolor = READ_LE_UINT16(ptr) / 3; @@ -237,8 +237,8 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { b = *ptr++; // Only SCUMM 5/6 games use 6/6/6 style palettes - if (_version >= 5 && _version <= 6) { - if ((_heversion <= 73 && i < 15) || i == 15 || r < 252 || g < 252 || b < 252) { + if (_game.version >= 5 && _game.version <= 6) { + if ((_game.heversion <= 73 && i < 15) || i == 15 || r < 252 || g < 252 || b < 252) { *dest++ = r; *dest++ = g; *dest++ = b; @@ -252,7 +252,7 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) { } } - if (_heversion >= 90 || _version == 8) { + if (_game.heversion >= 90 || _game.version == 8) { memcpy(_darkenPalette, _currentPalette, 768); } @@ -272,7 +272,7 @@ void ScummEngine::initCycl(const byte *ptr) { memset(_colorCycle, 0, sizeof(_colorCycle)); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { cycl = _colorCycle; for (j = 0; j < 16; ++j, ++cycl) { uint16 delay = READ_BE_UINT16(ptr); @@ -397,7 +397,7 @@ void ScummEngine::cyclePalette() { doCyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2)); if (_shadowPalette) { - if (_version >= 7) { + if (_game.version >= 7) { for (j = 0; j < NUM_SHADOW_PALETTE; j++) doCycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2)); } else { @@ -580,7 +580,7 @@ void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale // from within Room 23 (the big machine), as it has no shadow effects // and thus doesn't result in any visual differences. - if (_gameId == GID_SAMNMAX) { + if (_game.id == GID_SAMNMAX) { for (i = 0; i < 256; i++) _shadowPalette[i] = i; } @@ -613,7 +613,7 @@ void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) { int max; - if (_version >= 5 && _version <= 6 && _heversion <= 60) { + if (_game.version >= 5 && _game.version <= 6 && _game.heversion <= 60) { max = 252; } else { max = 255; @@ -624,16 +624,16 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int const byte *palptr; int color, idx, j; - if (_heversion >= 90 || _version == 8) { + if (_game.heversion >= 90 || _game.version == 8) { palptr = _darkenPalette; } else { palptr = getPalettePtr(_curPalIndex, _roomResource); } for (j = startColor; j <= endColor; j++) { - idx = (_heversion == 70) ? _HEV7ActorPalette[j] : j; + idx = (_game.heversion == 70) ? _HEV7ActorPalette[j] : j; cptr = palptr + idx * 3; - if (_heversion == 70) + if (_game.heversion == 70) setDirtyColors(idx, idx); color = *cptr++; @@ -654,7 +654,7 @@ void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int color = max; _currentPalette[idx * 3 + 2] = color; } - if (_heversion != 70) + if (_game.heversion != 70) setDirtyColors(startColor, endColor); } } @@ -760,7 +760,7 @@ int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) { int ar, ag, ab; uint sum, bestsum, bestitem = 0; - int startColor = (_version == 8) ? 24 : 1; + int startColor = (_game.version == 8) ? 24 : 1; byte *pal = _currentPalette + startColor * 3; if (r > 255) @@ -777,7 +777,7 @@ int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) { b &= ~3; for (i = startColor; i < 255; i++, pal += 3) { - if (_version == 7 && _colorUsedByCycle[i]) + if (_game.version == 7 && _colorUsedByCycle[i]) continue; ar = pal[0] & ~3; @@ -850,13 +850,13 @@ void ScummEngine::copyPalColor(int dst, int src) { } void ScummEngine::setPalColor(int idx, int r, int g, int b) { - if (_heversion == 70) + if (_game.heversion == 70) idx = _HEV7ActorPalette[idx]; _currentPalette[idx * 3 + 0] = r; _currentPalette[idx * 3 + 1] = g; _currentPalette[idx * 3 + 2] = b; - if (_version == 8) { + if (_game.version == 8) { _darkenPalette[idx * 3 + 0] = r; _darkenPalette[idx * 3 + 1] = g; _darkenPalette[idx * 3 + 2] = b; @@ -919,7 +919,7 @@ void ScummEngine::updatePalette() { if (_palDirtyMax == -1) return; - bool noir_mode = (_gameId == GID_SAMNMAX && readVar(0x8000)); + bool noir_mode = (_game.id == GID_SAMNMAX && readVar(0x8000)); int first = _palDirtyMin; int num = _palDirtyMax - first + 1; int i; @@ -930,7 +930,7 @@ void ScummEngine::updatePalette() { for (i = _palDirtyMin; i <= _palDirtyMax; i++) { byte *data; - if (_features & GF_SMALL_HEADER && _version > 2) + if (_game.features & GF_SMALL_HEADER && _game.version > 2) data = _currentPalette + _shadowPalette[i] * 3; else data = _currentPalette + i * 3; diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/player_v2.cpp index 70aff98bb9..d49706d524 100644 --- a/engines/scumm/player_v2.cpp +++ b/engines/scumm/player_v2.cpp @@ -345,12 +345,12 @@ static const uint16 pcjr_freq_table[12] = { Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) { int i; - _isV3Game = (scumm->_version >= 3); + _isV3Game = (scumm->_game.version >= 3); _vm = scumm; _mixer = scumm->_mixer; _sample_rate = _mixer->getOutputRate(); - _header_len = (scumm->_features & GF_OLD_BUNDLE) ? 4 : 6; + _header_len = (scumm->_game.features & GF_OLD_BUNDLE) ? 4 : 6; // Initialize sound queue _current_nr = _next_nr = 0; diff --git a/engines/scumm/player_v3a.cpp b/engines/scumm/player_v3a.cpp index 32ab9754af..f4663b83f3 100644 --- a/engines/scumm/player_v3a.cpp +++ b/engines/scumm/player_v3a.cpp @@ -158,7 +158,7 @@ void Player_V3A::startSound(int nr) { byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); - if ((_vm->_gameId != GID_INDY3) && (_vm->_gameId != GID_LOOM)) + if ((_vm->_game.id != GID_INDY3) && (_vm->_game.id != GID_LOOM)) error("player_v3a - unknown game!"); if (!_isinit) { @@ -167,7 +167,7 @@ void Player_V3A::startSound(int nr) { int offset = 4; int numInstruments; - if (_vm->_gameId == GID_INDY3) { + if (_vm->_game.id == GID_INDY3) { ptr = _vm->getResourceAddress(rtSound, 83); numInstruments = 12; } else { @@ -195,7 +195,7 @@ void Player_V3A::startSound(int nr) { _wavetable[i]->_oct[j] = READ_BE_UINT16(ptr + offset + 8); offset += 10; } - if (_vm->_gameId == GID_INDY3) { + if (_vm->_game.id == GID_INDY3) { _wavetable[i]->_pitadjust = 0; offset += 2; } else { @@ -239,7 +239,7 @@ void Player_V3A::startSound(int nr) { } _sfx[i].id = nr; _sfx[i].dur = looped ? -1 : (1 + 60 * size / rate); - if ((_vm->_gameId == GID_INDY3) && (nr == 60)) + if ((_vm->_game.id == GID_INDY3) && (nr == 60)) _sfx[i].dur = 240; _mod->startChannel(nr | 0x100, sound, size, rate, vol, loopStart, loopEnd); } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 42599dc3d0..c42e451522 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -93,17 +93,17 @@ void ScummEngine::openRoom(const int room) { if (room_offs == -1) break; - if (room_offs != 0 && room != 0 && _heversion < 98) { + if (room_offs != 0 && room != 0 && _game.heversion < 98) { _fileOffset = res.roomoffs[rtRoom][room]; return; } - if (_version <= 3) { + if (_game.version <= 3) { sprintf(buf, "%.2d.lfl", room); // Maniac Mansion demo has .man instead of .lfl - if (_gameId == GID_MANIAC) + if (_game.id == GID_MANIAC) sprintf(buf2, "%.2d.man", room); - encByte = (_features & GF_USE_KEY) ? 0xFF : 0; - } else if (_features & GF_SMALL_HEADER) { + encByte = (_game.features & GF_USE_KEY) ? 0xFF : 0; + } else if (_game.features & GF_SMALL_HEADER) { if (room == 0 || room >= 900) { sprintf(buf, "%.3d.lfl", room); encByte = 0; @@ -118,8 +118,8 @@ void ScummEngine::openRoom(const int room) { } } else { - if (_heversion >= 70) { // Windows titles - if (_heversion >= 98) { + if (_game.heversion >= 70) { // Windows titles + if (_game.heversion >= 98) { int disk = 0; if (_heV7DiskOffsets) disk = _heV7DiskOffsets[room]; @@ -136,25 +136,25 @@ void ScummEngine::openRoom(const int room) { } } else sprintf(buf, "%s.he%.1d", _baseName.c_str(), room == 0 ? 0 : 1); - } else if (_version >= 7) { - if (room > 0 && (_version == 8)) + } else if (_game.version >= 7) { + if (room > 0 && (_game.version == 8)) VAR(VAR_CURRENTDISK) = diskNumber; sprintf(buf, "%s.la%d", _baseName.c_str(), diskNumber); sprintf(buf2, "%s.%.3d", _baseName.c_str(), diskNumber); - } else if (_heversion >= 60) { + } else if (_game.heversion >= 60) { sprintf(buf, "%s.he%.1d", _baseName.c_str(), diskNumber); } else { sprintf(buf, "%s.%.3d", _baseName.c_str(), diskNumber); - if (_gameId == GID_SAMNMAX) + if (_game.id == GID_SAMNMAX) sprintf(buf2, "%s.sm%.1d", _baseName.c_str(), diskNumber); } - encByte = (_features & GF_USE_KEY) ? 0x69 : 0; + encByte = (_game.features & GF_USE_KEY) ? 0x69 : 0; } // If we have substitute - if (_substResFileNameIndex > 0 && !(_platform == Common::kPlatformNES || _platform == Common::kPlatformC64)) { + if (_substResFileNameIndex > 0 && !(_game.platform == Common::kPlatformNES || _game.platform == Common::kPlatformC64)) { char tmpBuf[128]; generateSubstResFileName(buf, tmpBuf, sizeof(tmpBuf)); strcpy(buf, tmpBuf); @@ -168,7 +168,7 @@ void ScummEngine::openRoom(const int room) { if ((result == false) && (buf2[0])) { result = openResourceFile(buf2, encByte); // We have .man files so set demo mode - if (_gameId == GID_MANIAC) + if (_game.id == GID_MANIAC) _demoMode = true; } @@ -222,7 +222,7 @@ void ScummEngine::readRoomsOffsets() { debug(9, "readRoomOffsets()"); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { _fileHandle->seek(12, SEEK_SET); // Directly searching for the room offset block would be more generic... } else { _fileHandle->seek(16, SEEK_SET); @@ -302,7 +302,7 @@ bool ScummEngine::openResourceFile(const char *filename, byte encByte) { void ScummEngine::askForDisk(const char *filename, int disknum) { char buf[128]; - if (_version == 8) { + if (_game.version == 8) { #ifndef DISABLE_SCUMM_7_8 char result; @@ -336,7 +336,7 @@ void ScummEngine::readIndexFile() { closeRoom(); openRoom(0); - if (_version <= 5) { + if (_game.version <= 5) { // Figure out the sizes of various resources while (!_fileHandle->eof()) { blocktype = fileReadDword(); @@ -519,7 +519,7 @@ void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) { case MKID('RNAM'): // Names of rooms. Maybe we should put them into a table, for use by the debugger? - if (_heversion >= 80) { + if (_game.heversion >= 80) { for (int room; (room = _fileHandle->readUint16LE()); ) { char buf[100]; i = 0; @@ -586,7 +586,7 @@ void ScummEngine::readResTypeList(int id, uint32 tag, const char *name) { debug(9, "readResTypeList(%s,%s,%s)", resTypeFromId(id), tag2str(TO_BE_32(tag)), name); - if (_version == 8) + if (_game.version == 8) num = _fileHandle->readUint32LE(); else num = _fileHandle->readUint16LE(); @@ -595,7 +595,7 @@ void ScummEngine::readResTypeList(int id, uint32 tag, const char *name) { error("Invalid number of %ss (%d) in directory", name, num); } - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { for (i = 0; i < num; i++) { res.roomno[id][i] = _fileHandle->readByte(); res.roomoffs[id][i] = _fileHandle->readUint32LE(); @@ -607,11 +607,11 @@ void ScummEngine::readResTypeList(int id, uint32 tag, const char *name) { for (i = 0; i < num; i++) { res.roomoffs[id][i] = _fileHandle->readUint32LE(); - if (id == rtRoom && _heversion >= 70) + if (id == rtRoom && _game.heversion >= 70) _heV7RoomIntOffsets[i] = res.roomoffs[id][i]; } - if (_heversion >= 70) { + if (_game.heversion >= 70) { for (i = 0; i < num; i++) { res.globsize[id][i] = _fileHandle->readUint32LE(); } @@ -639,7 +639,7 @@ void ScummEngine::allocResTypeData(int id, uint32 tag, int num, const char *name res.roomoffs[id] = (uint32 *)calloc(num, sizeof(uint32)); } - if (_heversion >= 70) { + if (_game.heversion >= 70) { res.globsize[id] = (uint32 *)calloc(num, sizeof(uint32)); if (id == rtRoom) @@ -654,11 +654,11 @@ void ScummEngine::loadCharset(int no) { debugC(DEBUG_GENERAL, "loadCharset(%d)", no); /* FIXME - hack around crash in Indy4 (occurs if you try to load after dieing) */ - if (_gameId == GID_INDY4 && no == 0) + if (_game.id == GID_INDY4 && no == 0) no = 1; /* for Humongous catalogs */ - if (_heversion >= 70 && _numCharsets == 1) { + if (_game.heversion >= 70 && _numCharsets == 1) { debug(0, "Not loading charset as it doesn't seem to exist?"); return; } @@ -683,7 +683,7 @@ void ScummEngine::ensureResourceLoaded(int type, int i) { debugC(DEBUG_RESOURCE, "ensureResourceLoaded(%s,%d)", resTypeFromId(type), i); - if ((type == rtRoom) && i > 0x7F && _version < 7 && _heversion <= 71) { + if ((type == rtRoom) && i > 0x7F && _game.version < 7 && _game.heversion <= 71) { i = _resourceMapper[i & 0x7F]; } @@ -709,7 +709,7 @@ void ScummEngine::ensureResourceLoaded(int type, int i) { loadResource(type, i); - if (_version == 5 && type == rtRoom && i == _roomResource) + if (_game.version == 5 && type == rtRoom && i == _roomResource) VAR(VAR_ROOM_FLAG) = 1; } @@ -720,7 +720,7 @@ int ScummEngine::loadResource(int type, int idx) { debugC(DEBUG_RESOURCE, "loadResource(%s,%d)", resTypeFromId(type),idx); - if (type == rtCharset && (_features & GF_SMALL_HEADER)) { + if (type == rtCharset && (_game.features & GF_SMALL_HEADER)) { loadCharset(idx); return (1); } @@ -734,9 +734,9 @@ int ScummEngine::loadResource(int type, int idx) { roomNr = _roomResource; if (type == rtRoom) { - if (_version == 8) + if (_game.version == 8) fileOffs = 8; - else if (_heversion >= 70) + else if (_game.heversion >= 70) fileOffs = _heV7RoomIntOffsets[idx]; else fileOffs = 0; @@ -750,20 +750,20 @@ int ScummEngine::loadResource(int type, int idx) { _fileHandle->seek(fileOffs + _fileOffset, SEEK_SET); - if (_features & GF_OLD_BUNDLE) { - if ((_version == 3) && !(_platform == Common::kPlatformAmiga) && (type == rtSound)) { + if (_game.features & GF_OLD_BUNDLE) { + if ((_game.version == 3) && !(_game.platform == Common::kPlatformAmiga) && (type == rtSound)) { return readSoundResourceSmallHeader(type, idx); } else { size = _fileHandle->readUint16LE(); _fileHandle->seek(-2, SEEK_CUR); } - } else if (_features & GF_SMALL_HEADER) { - if (_version == 4) + } else if (_game.features & GF_SMALL_HEADER) { + if (_game.version == 4) _fileHandle->seek(8, SEEK_CUR); size = _fileHandle->readUint32LE(); tag = _fileHandle->readUint16LE(); _fileHandle->seek(-6, SEEK_CUR); - if ((type == rtSound) && !(_platform == Common::kPlatformAmiga) && !(_platform == Common::kPlatformFMTowns)) { + if ((type == rtSound) && !(_game.platform == Common::kPlatformAmiga) && !(_game.platform == Common::kPlatformFMTowns)) { return readSoundResourceSmallHeader(type, idx); } } else { @@ -773,7 +773,7 @@ int ScummEngine::loadResource(int type, int idx) { tag = fileReadDword(); - if (tag != res.tags[type] && _heversion < 70) { + if (tag != res.tags[type] && _game.heversion < 70) { error("%s %d not in room %d at %d+%d in file %s", res.name[type], idx, roomNr, _fileOffset, fileOffs, _fileHandle->name()); @@ -799,7 +799,7 @@ int ScummEngine::loadResource(int type, int idx) { } int ScummEngine::getResourceRoomNr(int type, int idx) { - if (type == rtRoom && _heversion < 70) + if (type == rtRoom && _game.heversion < 70) return idx; return res.roomno[type][idx]; } @@ -816,7 +816,7 @@ byte *ScummEngine::getResourceAddress(int type, int idx) { CHECK_HEAP - if (_heversion >= 80 && type == rtString) + if (_game.heversion >= 80 && type == rtString) idx &= ~0x33539000; if (!res.validateResource("getResourceAddress", type, idx)) @@ -889,7 +889,7 @@ byte *ResourceManager::createResource(int type, int idx, uint32 size) { if (!validateResource("allocating", type, idx)) return NULL; - if (_vm->_version <= 2) { + if (_vm->_game.version <= 2) { // Nuking and reloading a resource can be harmful in some // cases. For instance, Zak tries to reload the intro music // while it's playing. See bug #1253171. @@ -951,9 +951,9 @@ void ResourceManager::nukeResource(int type, int idx) { } const byte *ScummEngine::findResourceData(uint32 tag, const byte *ptr) { - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) error("findResourceData must not be used in GF_OLD_BUNDLE games"); - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) ptr = findResourceSmall(tag, ptr); else ptr = findResource(tag, ptr); @@ -967,9 +967,9 @@ int ScummEngine::getResourceDataSize(const byte *ptr) const { if (ptr == NULL) return 0; - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) return READ_LE_UINT16(ptr) - _resourceHeaderSize; - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) return READ_LE_UINT32(ptr) - _resourceHeaderSize; else return READ_BE_UINT32(ptr - 4) - _resourceHeaderSize; @@ -1221,8 +1221,8 @@ void ScummEngine_v7::readMAXS(int blockSize) { _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); - if ((_gameId == GID_FT) && (_features & GF_DEMO) && - (_platform == Common::kPlatformPC)) + if ((_game.id == GID_FT) && (_game.features & GF_DEMO) && + (_game.platform == Common::kPlatformPC)) _numGlobalScripts = 300; else _numGlobalScripts = 2000; @@ -1256,11 +1256,11 @@ void ScummEngine_v6::readMAXS(int blockSize) { _objectRoomTable = NULL; _numGlobalScripts = 200; - if (_heversion >= 70) { + if (_game.heversion >= 70) { _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); } - if (_heversion <= 70) { + if (_game.heversion <= 70) { _shadowPaletteSize = 256; _shadowPalette = (byte *)calloc(_shadowPaletteSize, 1); } @@ -1346,14 +1346,14 @@ void ScummEngine::allocateArrays() { _roomVars = (int32 *)calloc(_numRoomVariables, sizeof(int32)); _scummVars = (int32 *)calloc(_numVariables, sizeof(int32)); _bitVars = (byte *)calloc(_numBitVariables >> 3, 1); - if (_heversion >= 60) { + if (_game.heversion >= 60) { _arraySlot = (byte *)calloc(_numArray, 1); } - if (_heversion >= 70) { + if (_game.heversion >= 70) { _storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData)); } - allocResTypeData(rtCostume, (_features & GF_NEW_COSTUMES) ? MKID('AKOS') : MKID('COST'), + allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKID('AKOS') : MKID('COST'), _numCostumes, "costume", 1); allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1); allocResTypeData(rtRoomImage, MKID('RMIM'), _numRooms, "room image", 1); @@ -1373,7 +1373,7 @@ void ScummEngine::allocateArrays() { allocResTypeData(rtImage, MKID('AWIZ'), _numImages, "images", 1); allocResTypeData(rtTalkie, MKID('TLKE'), _numTalkies, "talkie", 1); - if (_heversion >= 70) { + if (_game.heversion >= 70) { allocResTypeData(rtSpoolBuffer, MKID('NONE'), 9, "spool buffer", 0); } } @@ -1385,9 +1385,9 @@ void ScummEngine::dumpResource(const char *tag, int idx, const byte *ptr, int le uint32 size; if (length >= 0) size = length; - else if (_features & GF_OLD_BUNDLE) + else if (_game.features & GF_OLD_BUNDLE) size = READ_LE_UINT16(ptr); - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) size = READ_LE_UINT32(ptr); else size = READ_BE_UINT32(ptr + 4); @@ -1462,7 +1462,7 @@ const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) { debugC(DEBUG_RESOURCE, "findResource(%s, %lx)", tag2str(tag), searchin); if (!searchin) { - if (_heversion >= 70) { + if (_game.heversion >= 70) { searchin = _resourceLastSearchBuf; totalsize = _resourceLastSearchSize; curpos = 0; diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp index 26e96ec9ef..7d951d2408 100644 --- a/engines/scumm/resource_v2.cpp +++ b/engines/scumm/resource_v2.cpp @@ -32,14 +32,14 @@ namespace Scumm { void ScummEngine_v2::readClassicIndexFile() { int i; - if (_gameId == GID_MANIAC) { - if (_platform == Common::kPlatformC64) { + if (_game.id == GID_MANIAC) { + if (_game.platform == Common::kPlatformC64) { _numGlobalObjects = 256; _numRooms = 55; _numCostumes = 25; _numScripts = 160; _numSounds = 70; - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { _numGlobalObjects = 775; _numRooms = 55; @@ -58,8 +58,8 @@ void ScummEngine_v2::readClassicIndexFile() { _numScripts = 200; _numSounds = 100; } - } else if (_gameId == GID_ZAK) { - if (_platform == Common::kPlatformC64) { + } else if (_game.id == GID_ZAK) { + if (_game.platform == Common::kPlatformC64) { _numGlobalObjects = 775; _numRooms = 59; _numCostumes = 38; @@ -178,19 +178,19 @@ void ScummEngine_v2::readIndexFile() { break; case 0x0A31: printf("Classic V1 game detected\n"); - _version = 1; + _game.version = 1; readClassicIndexFile(); break; case 0x4643: - if (!(_platform == Common::kPlatformNES)) + if (!(_game.platform == Common::kPlatformNES)) error("Use maniac target"); printf("NES V1 game detected\n"); - _version = 1; + _game.version = 1; readClassicIndexFile(); break; case 0x132: printf("C64 V1 game detected\n"); - _version = 1; + _game.version = 1; readClassicIndexFile(); break; default: diff --git a/engines/scumm/resource_v4.cpp b/engines/scumm/resource_v4.cpp index 0f8530af2d..b99cfe209b 100644 --- a/engines/scumm/resource_v4.cpp +++ b/engines/scumm/resource_v4.cpp @@ -122,7 +122,7 @@ void ScummEngine_v4::readIndexFile() { default: // FIXME: this is a little hack because Indy3 FM-TOWNS has // 32 extra bytes of unknown meaning appended to 00.LFL - if (!(_gameId == GID_INDY3 && _platform == Common::kPlatformFMTowns)) + if (!(_game.id == GID_INDY3 && _game.platform == Common::kPlatformFMTowns)) error("Bad ID %c%c found in directory!", blocktype & 0xFF, blocktype >> 8); return; } diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index d5734e6334..f8b737c5ef 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -56,13 +56,13 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { if (_currentScript != 0xFF) { if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) { - if (ss->cutsceneOverride && _version >= 5) + if (ss->cutsceneOverride && _game.version >= 5) error("Object %d stopped with active cutscene/override in exit", ss->number); nukeArrays(_currentScript); _currentScript = 0xFF; } else if (ss->where == WIO_LOCAL) { - if (ss->cutsceneOverride && _version >= 5) + if (ss->cutsceneOverride && _game.version >= 5) error("Script %d stopped with active cutscene/override in exit", ss->number); nukeArrays(_currentScript); @@ -76,7 +76,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { runExitScript(); killScriptsAndResources(); - if (_version >= 4 && _heversion <= 61) + if (_game.version >= 4 && _game.heversion <= 61) stopCycle(0); _sound->processSound(); @@ -91,7 +91,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { _actors[i].hideActor(); } - if (_version >= 7) { + if (_game.version >= 7) { // Set the shadow palette(s) to all black. This fixes // bug #795940, and actually makes some sense (after all, // shadows tend to be rather black, don't they? ;-) @@ -102,7 +102,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { if (_shadowPalette) _shadowPalette[i] = i; } - if (_features & GF_SMALL_HEADER) + if (_game.features & GF_SMALL_HEADER) setDirtyColors(0, 255); } @@ -115,7 +115,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { _currentRoom = room; VAR(VAR_ROOM) = room; - if (room >= 0x80 && _version < 7 && _heversion <= 71) + if (room >= 0x80 && _game.version < 7 && _game.heversion <= 71) _roomResource = _resourceMapper[room & 0x7F]; else _roomResource = room; @@ -151,13 +151,13 @@ void ScummEngine::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_NEW_CAMERA) { + if (_game.features & GF_NEW_CAMERA) { VAR(VAR_CAMERA_MIN_Y) = _screenHeight / 2; VAR(VAR_CAMERA_MAX_Y) = _roomHeight - (_screenHeight / 2); setCameraAt(_screenWidth / 2, _screenHeight / 2); } else { camera._mode = kNormalCameraMode; - if (_version > 2) + if (_game.version > 2) camera._cur.x = camera._dest.x = _screenWidth / 2; camera._cur.y = camera._dest.y = _screenHeight / 2; } @@ -167,7 +167,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); - if (_version >= 5 && a) { + if (_game.version >= 5 && a) { where = whereIsObject(objectNr); if (where != WIO_ROOM && where != WIO_FLOBJECT) error("startScene: Object %d is not in room %d", objectNr, @@ -177,7 +177,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { a->putActor(x, y, _currentRoom); a->setDirection(dir + 180); a->stopActorMoving(); - if (_gameId == GID_SAMNMAX) { + if (_game.id == GID_SAMNMAX) { camera._cur.x = camera._dest.x = a->_pos.x; setCameraAt(a->_pos.x, a->_pos.y); } @@ -187,16 +187,16 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { _egoPositioned = false; runEntryScript(); - if ((_version <= 2) && !(_platform == Common::kPlatformC64)) { + if ((_game.version <= 2) && !(_game.platform == Common::kPlatformC64)) { runScript(5, 0, 0, 0); - } else if (_version >= 5 && _version <= 6) { + } else if (_game.version >= 5 && _game.version <= 6) { if (a && !_egoPositioned) { int x, y; getObjectXYPos(objectNr, x, y); a->putActor(x, y, _currentRoom); a->_moving = 0; } - } else if (_version >= 7) { + } else if (_game.version >= 7) { if (camera._follows) { a = derefActor(camera._follows, "startScene: follows"); setCameraAt(a->_pos.x, a->_pos.y); @@ -229,7 +229,7 @@ void ScummEngine::loadRoomSubBlocks() { // Determine the room and room script base address roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource); - if (_version == 8) + if (_game.version == 8) roomResPtr = getResourceAddress(rtRoomScripts, _roomResource); if (!roomptr || !roomResPtr) error("Room %d: data not found (" __FILE__ ":%d)", _roomResource, __LINE__); @@ -239,11 +239,11 @@ void ScummEngine::loadRoomSubBlocks() { // rmhd = (const RoomHeader *)findResourceData(MKID('RMHD'), roomptr); - if (_version == 8) { + if (_game.version == 8) { _roomWidth = READ_LE_UINT32(&(rmhd->v8.width)); _roomHeight = READ_LE_UINT32(&(rmhd->v8.height)); _numObjectsInRoom = (byte)READ_LE_UINT32(&(rmhd->v8.numObjects)); - } else if (_version == 7) { + } else if (_game.version == 7) { _roomWidth = READ_LE_UINT16(&(rmhd->v7.width)); _roomHeight = READ_LE_UINT16(&(rmhd->v7.height)); _numObjectsInRoom = (byte)READ_LE_UINT16(&(rmhd->v7.numObjects)); @@ -256,11 +256,11 @@ void ScummEngine::loadRoomSubBlocks() { // // Find the room image data // - if (_version == 8) { + if (_game.version == 8) { _IM00_offs = getObjectImage(roomptr, 1) - roomptr; - } else if (_features & GF_SMALL_HEADER) { + } else if (_game.features & GF_SMALL_HEADER) { _IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr; - } else if (_heversion >= 70) { + } else if (_game.heversion >= 70) { byte *roomImagePtr = getResourceAddress(rtRoomImage, _roomResource); _IM00_offs = findResource(MKID('IM00'), roomImagePtr) - roomImagePtr; } else { @@ -291,13 +291,13 @@ void ScummEngine::loadRoomSubBlocks() { // Determine the room script base address roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource); - if (_version == 8) + if (_game.version == 8) roomResPtr = getResourceAddress(rtRoomScripts, _roomResource); searchptr = roomResPtr; memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets)); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { ResourceIterator localScriptIterator(searchptr, true); while ((ptr = localScriptIterator.findNext(MKID('LSCR'))) != NULL) { int id = 0; @@ -312,7 +312,7 @@ void ScummEngine::loadRoomSubBlocks() { _localScriptOffsets[id - _numGlobalScripts] = ptr + 1 - roomptr; } - } else if (_heversion >= 90) { + } else if (_game.heversion >= 90) { ResourceIterator localScriptIterator2(searchptr, false); while ((ptr = localScriptIterator2.findNext(MKID('LSC2'))) != NULL) { int id = 0; @@ -354,11 +354,11 @@ void ScummEngine::loadRoomSubBlocks() { ptr += _resourceHeaderSize; /* skip tag & size */ - if (_version == 8) { + if (_game.version == 8) { id = READ_LE_UINT32(ptr); checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); _localScriptOffsets[id - _numGlobalScripts] = ptr + 4 - roomResPtr; - } else if (_version == 7) { + } else if (_game.version == 7) { id = READ_LE_UINT16(ptr); checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d"); _localScriptOffsets[id - _numGlobalScripts] = ptr + 2 - roomResPtr; @@ -386,7 +386,7 @@ void ScummEngine::loadRoomSubBlocks() { _CLUT_offs = ptr - roomptr; // Locate the standard room palettes (for V6+ games). - if (_version >= 6) { + if (_game.version >= 6) { ptr = findResource(MKID('PALS'), roomptr); if (ptr) { _PALS_offs = ptr - roomptr; @@ -395,7 +395,7 @@ void ScummEngine::loadRoomSubBlocks() { // Transparent color byte trans; - if (_version == 8) + if (_game.version == 8) trans = (byte)READ_LE_UINT32(&(rmhd->v8.transparency)); else { ptr = findResourceData(MKID('TRNS'), roomptr); @@ -406,7 +406,7 @@ void ScummEngine::loadRoomSubBlocks() { } // Actor Palette in HE 70 games - if (_heversion == 70) { + if (_game.heversion == 70) { ptr = findResourceData(MKID('REMP'), roomptr); if (ptr) { for (i = 0; i < 256; i++) @@ -425,7 +425,7 @@ void ScummEngine::loadRoomSubBlocks() { // when they shouldn't be. Luckily, bitvar69 is set to 1 if and only if // the teeth are trapped and have not yet been taken by the player. So // we can make use of that fact to fix the object class of obj 182. - if (_gameId == GID_TENTACLE && _roomResource == 26 && readVar(0x8000 + 69) + if (_game.id == GID_TENTACLE && _roomResource == 26 && readVar(0x8000 + 69) && getClass(182, kObjectClassUntouchable)) { putClass(182, kObjectClassUntouchable, 0); } @@ -456,12 +456,12 @@ void ScummEngine::initRoomSubBlocks() { res.nukeResource(rtMatrix, 1); res.nukeResource(rtMatrix, 2); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { ptr = findResourceData(MKID('BOXD'), roomptr); if (ptr) { byte numOfBoxes = *ptr; int size; - if (_version == 3) + if (_game.version == 3) size = numOfBoxes * SIZEOF_BOX_V3 + 1; else size = numOfBoxes * SIZEOF_BOX + 1; @@ -506,7 +506,7 @@ void ScummEngine::initRoomSubBlocks() { ptr = findResourceData(MKID('SCAL'), roomptr); if (ptr) { int s1, s2, y1, y2; - if (_version == 8) { + if (_game.version == 8) { for (i = 1; i < res.num[rtScaleTable]; i++, ptr += 16) { s1 = READ_LE_UINT32(ptr); y1 = READ_LE_UINT32(ptr + 4); @@ -529,7 +529,7 @@ void ScummEngine::initRoomSubBlocks() { // Color cycling // HE 7.0 games load resources but don't use them. - if (_version >= 4 && _heversion <= 61) { + if (_game.version >= 4 && _game.heversion <= 61) { ptr = findResourceData(MKID('CYCL'), roomptr); if (ptr) { initCycl(ptr); @@ -538,7 +538,7 @@ void ScummEngine::initRoomSubBlocks() { #ifndef DISABLE_HE // Polygons in HE 80+ games - if (_heversion >= 80) { + if (_game.heversion >= 80) { ptr = findResourceData(MKID('POLD'), roomptr); if (ptr) { ((ScummEngine_v70he *)this)->_wiz->polygonLoad(ptr); @@ -572,8 +572,8 @@ void ScummEngine_v3old::loadRoomSubBlocks() { // rmhd = (const RoomHeader *)(roomptr + 4); - if (_version == 1) { - if (_platform == Common::kPlatformNES) { + if (_game.version == 1) { + if (_game.platform == Common::kPlatformNES) { _roomWidth = READ_LE_UINT16(&(rmhd->old.width)) * 8; _roomHeight = READ_LE_UINT16(&(rmhd->old.height)) * 8; @@ -595,7 +595,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() { // // Find the room image data // - if (_version == 1) { + if (_game.version == 1) { _IM00_offs = 0; } else { _IM00_offs = READ_LE_UINT16(roomptr + 0x0A); @@ -605,7 +605,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() { // Look for an exit script // int EXCD_len = -1; - if (_version <= 2) { + if (_game.version <= 2) { _EXCD_offs = READ_LE_UINT16(roomptr + 0x18); EXCD_len = READ_LE_UINT16(roomptr + 0x1A) - _EXCD_offs + _resourceHeaderSize; // HACK } else { @@ -619,7 +619,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() { // Look for an entry script // int ENCD_len = -1; - if (_version <= 2) { + if (_game.version <= 2) { _ENCD_offs = READ_LE_UINT16(roomptr + 0x1A); ENCD_len = READ_LE_UINT16(roomptr) - _ENCD_offs + _resourceHeaderSize; // HACK } else { @@ -649,7 +649,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() { int num_sounds; int num_scripts; - if (_version <= 2) { + if (_game.version <= 2) { num_sounds = *(roomptr + 22); num_scripts = *(roomptr + 23); ptr = roomptr + 28 + num_objects * 4; @@ -657,7 +657,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() { loadResource(rtSound, *ptr++); while (num_scripts--) loadResource(rtScript, *ptr++); - } else /* if (_version == 3) */ { + } else /* if (_game.version == 3) */ { num_sounds = *(roomptr + 23); num_scripts = *(roomptr + 24); ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts; @@ -698,7 +698,7 @@ void ScummEngine_v3old::initRoomSubBlocks() { error("Room %d: data not found (" __FILE__ ":%d)", _roomResource, __LINE__); // Reset room color for V1 zak - if (_version == 1) + if (_game.version == 1) _roomPalette[0] = 0; // @@ -708,17 +708,17 @@ void ScummEngine_v3old::initRoomSubBlocks() { res.nukeResource(rtMatrix, 2); // TODO: Convert older walkbox format - if (_gameId == GID_MANIAC && _platform == Common::kPlatformC64) + if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) return; - if (_version <= 2) + if (_game.version <= 2) ptr = roomptr + *(roomptr + 0x15); else ptr = roomptr + READ_LE_UINT16(roomptr + 0x15); if (ptr) { byte numOfBoxes = *ptr; int size; - if (_version <= 2) + if (_game.version <= 2) size = numOfBoxes * SIZEOF_BOX_V2 + 1; else size = numOfBoxes * SIZEOF_BOX_V3 + 1; @@ -726,7 +726,7 @@ void ScummEngine_v3old::initRoomSubBlocks() { res.createResource(rtMatrix, 2, size); memcpy(getResourceAddress(rtMatrix, 2), ptr, size); ptr += size; - if (_version <= 2) { + if (_game.version <= 2) { size = numOfBoxes * (numOfBoxes + 1); } else { // FIXME. This is an evil HACK!!! diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 01f2507c60..2fe48e585e 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -157,7 +157,7 @@ bool ScummEngine::loadState(int slot, bool compat) { } // We (deliberately) broke HE savegame compatibility at some point. - if (hdr.ver < VER(50) && _heversion >= 71) { + if (hdr.ver < VER(50) && _game.heversion >= 71) { warning("Unsupported version of '%s'", filename); delete in; return false; @@ -250,7 +250,7 @@ bool ScummEngine::loadState(int slot, bool compat) { initScummVars(); - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) loadCharset(0); // FIXME - HACK ? // @@ -264,7 +264,7 @@ bool ScummEngine::loadState(int slot, bool compat) { setupVolumes(); // Init NES costume data - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { if (hdr.ver < VER(47)) _NESCostumeSet = 0; NES_loadCostumeSet(_NESCostumeSet); @@ -277,21 +277,21 @@ bool ScummEngine::loadState(int slot, bool compat) { // WORKAROUND bug #795214: Object 819 could be set to a state of 1 in old save games // Object 819 is part of the exit of the church and should not be drawn. - if (hdr.ver < VER(59) && _gameId == GID_MONKEY_VGA) { + if (hdr.ver < VER(59) && _game.id == GID_MONKEY_VGA) { putState(819, 0); } - if (hdr.ver < VER(33) && _version >= 7) { + if (hdr.ver < VER(33) && _game.version >= 7) { // For a long time, we didn't set these vars to default values. VAR(VAR_DEFAULT_TALK_DELAY) = 60; - if (_version == 7) + if (_game.version == 7) VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; } if (hdr.ver < VER(30)) { // For a long time, we used incorrect location, causing it to default to zero. - if (_version == 8) - _scummVars[VAR_CHARINC] = (_features & GF_DEMO) ? 3 : 1; + if (_game.version == 8) + _scummVars[VAR_CHARINC] = (_game.features & GF_DEMO) ? 3 : 1; // Needed due to subtitle speed changes _defaultTalkDelay /= 20; } @@ -300,7 +300,7 @@ bool ScummEngine::loadState(int slot, bool compat) { // scumm vars. We now know the proper locations. To be able to properly use // old save games, we update the old (bad) variables to the new (correct) // ones. - if (hdr.ver < VER(28) && _version == 8) { + if (hdr.ver < VER(28) && _game.version == 8) { _scummVars[VAR_CAMERA_MIN_X] = _scummVars[101]; _scummVars[VAR_CAMERA_MAX_X] = _scummVars[102]; _scummVars[VAR_CAMERA_MIN_Y] = _scummVars[103]; @@ -327,15 +327,15 @@ bool ScummEngine::loadState(int slot, bool compat) { // anyway. There was a time, though, when re-initializing was necessary // for backwards compatibility, and it may still prove useful if we // ever add options for using different 16-colour palettes. - if (_version == 1) { - if (_platform == Common::kPlatformC64) { + if (_game.version == 1) { + if (_game.platform == Common::kPlatformC64) { setupC64Palette(); - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { setupNESPalette(); } else { setupV1Palette(); } - } else if (_features & GF_16COLOR) { + } else if (_game.features & GF_16COLOR) { switch (_renderMode) { case Common::kRenderEGA: setupEGAPalette(); @@ -355,7 +355,7 @@ bool ScummEngine::loadState(int slot, bool compat) { break; default: - if ((_platform == Common::kPlatformAmiga) || (_platform == Common::kPlatformAtariST)) + if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) setupAmigaPalette(); else setupEGAPalette(); @@ -364,13 +364,13 @@ bool ScummEngine::loadState(int slot, bool compat) { setDirtyColors(0, 255); - if (hdr.ver < VER(35) && _gameId == GID_MANIAC && _version == 1) + if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version == 1) setupV1ActorTalkColor(); // Load the static room data loadRoomSubBlocks(); - if (!(_features & GF_NEW_CAMERA)) { + if (!(_game.features & GF_NEW_CAMERA)) { camera._last.x = camera._cur.x; } @@ -457,7 +457,7 @@ bool ScummEngine::getSavegameName(int slot, char *desc) { } // We (deliberately) broke HE savegame compatibility at some point. - if (hdr.ver < VER(57) && _heversion >= 60) { + if (hdr.ver < VER(57) && _game.heversion >= 60) { strcpy(desc, "Unsupported version"); return false; } @@ -1073,7 +1073,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { // For V1-V5 games, there used to be no object name resources. // At some point this changed. But since old savegames rely on // unchanged resource counts, we have to hard code the following check - if (_version < 6 && type == rtObjectName) + if (_game.version < 6 && type == rtObjectName) continue; for (idx = 1; idx < res.num[type]; idx++) saveLoadResource(s, type, idx); @@ -1096,7 +1096,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { if (_shadowPaletteSize) { s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte); // _roomPalette didn't show up until V21 save games - if (s->getVersion() >= VER(21) && _version < 5) + if (s->getVersion() >= VER(21) && _game.version < 5) s->saveLoadArrayOf(_roomPalette, sizeof(_roomPalette), 1, sleByte); } @@ -1143,9 +1143,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { else s->saveLoadArrayOf(_scummVars, _numVariables, sizeof(_scummVars[0]), sleInt32); - if (_gameId == GID_TENTACLE) // Maybe misplaced, but that's the main idea + if (_game.id == GID_TENTACLE) // Maybe misplaced, but that's the main idea _scummVars[120] = var120Backup; - if (_gameId == GID_INDY4) + if (_game.id == GID_INDY4) _scummVars[98] = var98Backup; s->saveLoadArrayOf(_bitVars, _numBitVariables >> 3, 1, sleByte); @@ -1391,7 +1391,7 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { void ScummEngine::saveResource(Serializer *ser, int type, int idx) { assert(res.address[type][idx]); - if ((res.mode[type] == 0) || (_heversion >= 60 && res.mode[type] == 2 && idx == 1)) { + if ((res.mode[type] == 0) || (_game.heversion >= 60 && res.mode[type] == 2 && idx == 1)) { byte *ptr = res.address[type][idx]; uint32 size = ((MemBlkHeader *)ptr)->size; @@ -1408,7 +1408,7 @@ void ScummEngine::saveResource(Serializer *ser, int type, int idx) { } void ScummEngine::loadResource(Serializer *ser, int type, int idx) { - if ((res.mode[type] == 0) || (_heversion >= 60 && res.mode[type] == 2 && idx == 1)) { + if ((res.mode[type] == 0) || (_game.heversion >= 60 && res.mode[type] == 2 && idx == 1)) { uint32 size = ser->loadUint32(); assert(size); res.createResource(type, idx, size); diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index c6a971837f..3b5b25c714 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -67,7 +67,7 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in } if (cycle == 0) - cycle = (_heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1; + cycle = (_game.heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1; slot = getScriptSlot(); @@ -95,7 +95,7 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b if (!object) return; - if (!recursive && (_version >= 3)) + if (!recursive && (_game.version >= 3)) stopObjectScript(object); where = whereIsObject(object); @@ -116,7 +116,7 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b return; if (cycle == 0) - cycle = (_heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1; + cycle = (_game.heversion >= 90) ? VAR(VAR_SCRIPT_CYCLE) : 1; s = &vm.slot[slot]; s->number = object; @@ -155,13 +155,13 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { objptr = getOBCDFromObject(obj); assert(objptr); - if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) verbptr = objptr + 14; - else if (_version <= 2) + else if (_game.version <= 2) verbptr = objptr + 15; - else if (_features & GF_OLD_BUNDLE) + else if (_game.features & GF_OLD_BUNDLE) verbptr = objptr + 17; - else if (_features & GF_SMALL_HEADER) + else if (_game.features & GF_SMALL_HEADER) verbptr = objptr + 19; else verbptr = findResource(MKID('VERB'), objptr); @@ -170,10 +170,10 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { verboffs = verbptr - objptr; - if (!(_features & GF_SMALL_HEADER)) + if (!(_game.features & GF_SMALL_HEADER)) verbptr += _resourceHeaderSize; - if (_version == 8) { + if (_game.version == 8) { const uint32 *ptr = (const uint32 *)verbptr; uint32 verb; do { @@ -185,7 +185,7 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { ptr += 2; } while (1); return verboffs + 8 + READ_LE_UINT32(ptr + 1); - } else if (_version <= 2) { + } else if (_game.version <= 2) { do { if (!*verbptr) return 0; @@ -204,7 +204,7 @@ int ScummEngine::getVerbEntrypoint(int obj, int entry) { verbptr += 3; } while (1); - if (_features & GF_SMALL_HEADER) + if (_game.features & GF_SMALL_HEADER) return READ_LE_UINT16(verbptr + 1); else return verboffs + READ_LE_UINT16(verbptr + 1); @@ -225,7 +225,7 @@ void ScummEngine::stopScript(int script) { if (script == ss->number && ss->status != ssDead && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL)) { if (ss->cutsceneOverride) - if (_version >= 5) + if (_game.version >= 5) error("Script %d stopped with active cutscene/override", script); ss->number = 0; ss->status = ssDead; @@ -265,7 +265,7 @@ void ScummEngine::stopObjectScript(int script) { if (script == ss->number && ss->status != ssDead && (ss->where == WIO_ROOM || ss->where == WIO_INVENTORY || ss->where == WIO_FLOBJECT)) { if (ss->cutsceneOverride) - if (_version >= 5) + if (_game.version >= 5) error("Object %d stopped with active cutscene/override", script); ss->number = 0; ss->status = ssDead; @@ -364,7 +364,7 @@ void ScummEngine::updateScriptPtr() { void ScummEngine::nukeArrays(byte scriptSlot) { int i; - if (_heversion == 0 || scriptSlot == 0) + if (_game.heversion == 0 || scriptSlot == 0) return; for (i = 1; i < _numArray; i++) { @@ -396,7 +396,7 @@ void ScummEngine::getScriptBaseAddress() { case WIO_LOCAL: case WIO_ROOM: /* room script */ - if (_version == 8) { + if (_game.version == 8) { _scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource); assert(_roomResource < res.num[rtRoomScripts]); _lastCodePtr = &res.address[rtRoomScripts][_roomResource]; @@ -426,7 +426,7 @@ void ScummEngine::getScriptBaseAddress() { } // The following fixes bug #1202487. Confirmed against disasm. - if (_version <= 2 && _scriptOrgPointer == NULL) { + if (_game.version <= 2 && _scriptOrgPointer == NULL) { ss->status = ssDead; _currentScript = 0xFF; } @@ -517,7 +517,7 @@ int ScummEngine::readVar(uint var) { debugC(DEBUG_VARS, "readvar(%d)", var); - if ((var & 0x2000) && (_version <= 5)) { + if ((var & 0x2000) && (_game.version <= 5)) { a = fetchScriptWord(); if (a & 0x2000) var += readVar(a & ~0x2000); @@ -528,7 +528,7 @@ int ScummEngine::readVar(uint var) { if (!(var & 0xF000)) { if (!_copyProtection) { - if (var == 490 && _gameId == GID_MONKEY2) { + if (var == 490 && _game.id == GID_MONKEY2) { var = 518; } } @@ -545,19 +545,19 @@ int ScummEngine::readVar(uint var) { } if (var & 0x8000) { - if (_heversion >= 80) { + if (_game.heversion >= 80) { var &= 0xFFF; checkRange(_numRoomVariables - 1, 0, var, "Room variable %d out of range(w)"); return _roomVars[var]; - } else if (_version <= 3 && !(_gameId == GID_INDY3 && (_platform == Common::kPlatformFMTowns))) { + } else if (_game.version <= 3 && !(_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns))) { int bit = var & 0xF; var = (var >> 4) & 0xFF; if (!_copyProtection) { - if (_gameId == GID_LOOM && (_platform == Common::kPlatformFMTowns) && var == 214 && bit == 15) { + if (_game.id == GID_LOOM && (_game.platform == Common::kPlatformFMTowns) && var == 214 && bit == 15) { return 0; - } else if (_gameId == GID_ZAK && (_platform == Common::kPlatformFMTowns) && var == 151 && bit == 8) { + } else if (_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns) && var == 151 && bit == 8) { return 0; } } @@ -567,7 +567,7 @@ int ScummEngine::readVar(uint var) { } else { var &= 0x7FFF; if (!_copyProtection) { - if (_gameId == GID_INDY3 && (_platform == Common::kPlatformFMTowns) && var == 1508) + if (_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns) && var == 1508) return 0; } @@ -577,13 +577,13 @@ int ScummEngine::readVar(uint var) { } if (var & 0x4000) { - if (_features & GF_FEW_LOCALS) { + if (_game.features & GF_FEW_LOCALS) { var &= 0xF; } else { var &= 0xFFF; } - if (_heversion >= 80) + if (_game.heversion >= 80) checkRange(25, 0, var, "Local variable %d out of range(r)"); else checkRange(20, 0, var, "Local variable %d out of range(r)"); @@ -602,14 +602,14 @@ void ScummEngine::writeVar(uint var, int value) { if (VAR_SUBTITLES != 0xFF && var == VAR_SUBTITLES) { // Ignore default setting in HE72-73 games - if (_heversion <= 73 && vm.slot[_currentScript].number == 1) + if (_game.heversion <= 73 && vm.slot[_currentScript].number == 1) return; assert(value == 0 || value == 1); ConfMan.set("subtitles", value); } if (VAR_NOSUBTITLES != 0xFF && var == VAR_NOSUBTITLES) { // Ignore default setting in HE60-71 games - if (_heversion >= 60 && vm.slot[_currentScript].number == 1) + if (_game.heversion >= 60 && vm.slot[_currentScript].number == 1) return; assert(value == 0 || value == 1); ConfMan.set("subtitles", !value); @@ -634,12 +634,12 @@ void ScummEngine::writeVar(uint var, int value) { } if (var & 0x8000) { - if (_heversion >= 80) { + if (_game.heversion >= 80) { var &= 0xFFF; checkRange(_numRoomVariables - 1, 0, var, "Room variable %d out of range(w)"); _roomVars[var] = value; - } else if (_version <= 3 && !(_gameId == GID_INDY3 && (_platform == Common::kPlatformFMTowns))) { + } else if (_game.version <= 3 && !(_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns))) { // In the old games, the bit variables were using the same memory // as the normal variables! int bit = var & 0xF; @@ -662,13 +662,13 @@ void ScummEngine::writeVar(uint var, int value) { } if (var & 0x4000) { - if (_features & GF_FEW_LOCALS) { + if (_game.features & GF_FEW_LOCALS) { var &= 0xF; } else { var &= 0xFFF; } - if (_heversion >= 80) + if (_game.heversion >= 80) checkRange(25, 0, var, "Local variable %d out of range(w)"); else checkRange(20, 0, var, "Local variable %d out of range(w)"); @@ -725,13 +725,13 @@ void ScummEngine::stopObjectCode() { if (ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL) { if (ss->cutsceneOverride) { - if (_version >= 5) + if (_game.version >= 5) warning("Object %d ending with active cutscene/override (%d)", ss->number, ss->cutsceneOverride); ss->cutsceneOverride = 0; } } else { if (ss->cutsceneOverride) { - if (_version >= 5) + if (_game.version >= 5) warning("Script %d ending with active cutscene/override (%d)", ss->number, ss->cutsceneOverride); ss->cutsceneOverride = 0; } @@ -747,7 +747,7 @@ void ScummEngine::runInventoryScript(int i) { memset(args, 0, sizeof(args)); args[0] = i; if (VAR(VAR_INVENTORY_SCRIPT)) { - if (_gameId == GID_INDY3 && _platform == Common::kPlatformMacintosh) { + if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) { inventoryScript(); } else { runScript(VAR(VAR_INVENTORY_SCRIPT), 0, 0, args); @@ -848,7 +848,7 @@ void ScummEngine::inventoryScript() { void ScummEngine::freezeScripts(int flag) { int i; - if (_version <= 2) { + if (_game.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; @@ -877,7 +877,7 @@ void ScummEngine::freezeScripts(int flag) { void ScummEngine::unfreezeScripts() { int i; - if (_version <= 2) { + if (_game.version <= 2) { for (i = 0; i < NUM_SCRIPT_SLOT; i++) { vm.slot[i].status &= 0x7F; vm.slot[i].freezeCount = 0; @@ -907,7 +907,7 @@ void ScummEngine::runAllScripts() { vm.slot[i].didexec = 0; _currentScript = 0xFF; - int numCycles = (_heversion >= 90) ? VAR(VAR_NUM_SCRIPT_CYCLES) : 1; + int numCycles = (_game.heversion >= 90) ? VAR(VAR_NUM_SCRIPT_CYCLES) : 1; for (int cycle = 1; cycle <= numCycles; cycle++) { for (i = 0; i < NUM_SCRIPT_SLOT; i++) { @@ -922,7 +922,7 @@ void ScummEngine::runAllScripts() { } void ScummEngine::runExitScript() { - if (_version > 2 && VAR(VAR_EXIT_SCRIPT)) + if (_game.version > 2 && VAR(VAR_EXIT_SCRIPT)) runScript(VAR(VAR_EXIT_SCRIPT), 0, 0, 0); if (_EXCD_offs) { int slot = getScriptSlot(); @@ -939,7 +939,7 @@ void ScummEngine::runExitScript() { // FIXME: the exit script of room 7 in indy3 only seems to have a size // and tag not actual data not even a 00 (stop code). Maybe we should // be limiting ourselves to strictly reading the size from the header? - if (_gameId == GID_INDY3 && !(_features & GF_OLD_BUNDLE)) { + if (_game.id == GID_INDY3 && !(_game.features & GF_OLD_BUNDLE)) { byte *roomptr = getResourceAddress(rtRoom, _roomResource); const byte *excd = findResourceData(MKID('EXCD'), roomptr) - _resourceHeaderSize; if (!excd || (getResourceDataSize(excd) < 1)) { @@ -951,12 +951,12 @@ void ScummEngine::runExitScript() { initializeLocals(slot, 0); runScriptNested(slot); } - if (_version > 2 && VAR(VAR_EXIT_SCRIPT2)) + if (_game.version > 2 && VAR(VAR_EXIT_SCRIPT2)) runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, 0); } void ScummEngine::runEntryScript() { - if (_version > 2 && VAR(VAR_ENTRY_SCRIPT)) + if (_game.version > 2 && VAR(VAR_ENTRY_SCRIPT)) runScript(VAR(VAR_ENTRY_SCRIPT), 0, 0, 0); if (_ENCD_offs) { int slot = getScriptSlot(); @@ -972,7 +972,7 @@ void ScummEngine::runEntryScript() { initializeLocals(slot, 0); runScriptNested(slot); } - if (_version > 2 && VAR(VAR_ENTRY_SCRIPT2)) + if (_game.version > 2 && VAR(VAR_ENTRY_SCRIPT2)) runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, 0); } @@ -984,7 +984,7 @@ void ScummEngine::killScriptsAndResources() { for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) { if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) { if (ss->cutsceneOverride) { - if (_version >= 5) + if (_game.version >= 5) warning("Object %d stopped with active cutscene/override in exit", ss->number); ss->cutsceneOverride = 0; } @@ -992,7 +992,7 @@ void ScummEngine::killScriptsAndResources() { ss->status = ssDead; } else if (ss->where == WIO_LOCAL) { if (ss->cutsceneOverride) { - if (_version >= 5) + if (_game.version >= 5) warning("Script %d stopped with active cutscene/override in exit", ss->number); ss->cutsceneOverride = 0; } @@ -1010,12 +1010,12 @@ void ScummEngine::killScriptsAndResources() { // We can delete custom name resources if either the object is // no longer in use (i.e. not owned by anyone anymore); or if // it is an object which is owned by a room. - if (owner == 0 || (_version < 7 && owner == OF_OWNER_ROOM)) { + if (owner == 0 || (_game.version < 7 && owner == OF_OWNER_ROOM)) { // WORKAROUND for a problem mentioned in bug report #941275: // In FOA in the sentry room, in the chest plate of the statue, // the pegs may be renamed to mouth: this custom name is lost // when leaving the room; this hack prevents this). - if (owner == OF_OWNER_ROOM && _gameId == GID_INDY4 && 336 <= obj && obj <= 340) + if (owner == OF_OWNER_ROOM && _game.id == GID_INDY4 && 336 <= obj && obj <= 340) continue; _newNames[i] = 0; @@ -1030,7 +1030,7 @@ void ScummEngine::killAllScriptsExceptCurrent() { for (int i = 0; i < NUM_SCRIPT_SLOT; i++) { if (i != _currentScript) { vm.slot[i].status = ssDead; - if (_version == 6) + if (_game.version == 6) vm.slot[i].cutsceneOverride = 0; } } @@ -1039,7 +1039,7 @@ void ScummEngine::killAllScriptsExceptCurrent() { void ScummEngine::doSentence(int verb, int objectA, int objectB) { SentenceTab *st; - if (_version >= 7) { + if (_game.version >= 7) { if (objectA == objectB) return; @@ -1069,7 +1069,7 @@ void ScummEngine::checkAndRunSentenceScript() { int localParamList[24]; const ScriptSlot *ss; int sentenceScript; - if (_version <= 2) + if (_game.version <= 2) sentenceScript = 2; else sentenceScript = VAR(VAR_SENTENCE_SCRIPT); @@ -1087,11 +1087,11 @@ void ScummEngine::checkAndRunSentenceScript() { _sentenceNum--; - if (_version < 7) + if (_game.version < 7) if (_sentence[_sentenceNum].preposition && _sentence[_sentenceNum].objectB == _sentence[_sentenceNum].objectA) return; - if (_version <= 2) { + if (_game.version <= 2) { _scummVars[VAR_ACTIVE_VERB] = _sentence[_sentenceNum].verb; _scummVars[VAR_ACTIVE_OBJECT1] = _sentence[_sentenceNum].objectA; _scummVars[VAR_ACTIVE_OBJECT2] = _sentence[_sentenceNum].objectB; @@ -1105,7 +1105,7 @@ void ScummEngine::checkAndRunSentenceScript() { // assumes that one of the two objects is an actor. If that's // not the case, fall back on the default sentence script. - if (_gameId == GID_FT && sentenceScript == _buggyFTSentenceScript && !isValidActor(localParamList[1]) && !isValidActor(localParamList[2])) { + if (_game.id == GID_FT && sentenceScript == _buggyFTSentenceScript && !isValidActor(localParamList[1]) && !isValidActor(localParamList[2])) { sentenceScript = _defaultFTSentenceScript; } } @@ -1118,11 +1118,11 @@ void ScummEngine::runInputScript(int a, int cmd, int mode) { int args[24]; int verbScript; - if (_gameId == GID_MANIAC && _platform == Common::kPlatformC64) { + if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) { verbScript = 3; //_scummVars[9] = cmd; - } else if (_version <= 2) { + } else if (_game.version <= 2) { verbScript = 4; _scummVars[VAR_CLICK_AREA] = a; switch (a) { @@ -1142,13 +1142,13 @@ void ScummEngine::runInputScript(int a, int cmd, int mode) { args[1] = cmd; args[2] = mode; // All HE 72+ games but only some HE 71 games. - if (_heversion >= 71) { + if (_game.heversion >= 71) { args[3] = VAR(VAR_VIRT_MOUSE_X); args[4] = VAR(VAR_VIRT_MOUSE_Y); } // Macintosh verison of indy3ega used different interface, so adjust values. - if (_gameId == GID_INDY3 && _platform == Common::kPlatformMacintosh) { + if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) { if (a == 1 && (cmd >= 101 && cmd <= 108)) { if (cmd == 107) { VAR(67) -= 2; @@ -1236,12 +1236,12 @@ int ScummEngine::resStrLen(const byte *src) const { // WORKAROUND for bug #985948, a script bug in Indy3. See also // the corresponding code in ScummEngine::convertMessageToString(). - if (_gameId == GID_INDY3 && chr == 0x2E) { + if (_game.id == GID_INDY3 && chr == 0x2E) { continue; } if (chr != 1 && chr != 2 && chr != 3 && chr != 8) { - if (_version == 8) { + if (_game.version == 8) { src += 4; num += 4; } else { @@ -1318,7 +1318,7 @@ void ScummEngine::abortCutscene() { // Proper fix might be to let SMUSH/INSANE run from outside the script // engine but that would require lots of changes and may actually have // negative effects, too. So we cheat here, to fix bug #751670. - if (_version == 7) + if (_game.version == 7) getScriptEntryPoint(); } @@ -1348,7 +1348,7 @@ void ScummEngine::endOverride() { vm.cutScenePtr[idx] = 0; vm.cutSceneScript[idx] = 0; - if (_version > 3) + if (_game.version > 3) VAR(VAR_OVERRIDE) = 0; } diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index 880628f53e..d13b045ed8 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -415,18 +415,18 @@ void ScummEngine_v2::decodeParseString() { int textSlot = 0; _string[textSlot].xpos = 0; _string[textSlot].ypos = 0; - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) _string[textSlot].right = 256; else _string[textSlot].right = 320; _string[textSlot].center = false; _string[textSlot].overhead = false; - if (_gameId == GID_MANIAC && _actorToPrintStrFor == 0xFF) { - if (_platform == Common::kPlatformC64) { + if (_game.id == GID_MANIAC && _actorToPrintStrFor == 0xFF) { + if (_game.platform == Common::kPlatformC64) { _string[textSlot].color = 14; } else if (_demoMode) { - _string[textSlot].color = (_version == 2) ? 15 : 1; + _string[textSlot].color = (_game.version == 2) ? 15 : 1; } } @@ -459,7 +459,7 @@ void ScummEngine_v2::writeVar(uint var, int value) { // cutscene. Script 116 sets var[175] to 1, which disables New Kid in // script 164. Unfortunatly, when New Kid is reenabled (var[175] = 0) in // script 89, script 164 isn't reran to redraw it. Why? Dunno. Hack? Yes. - if ((var == 175) && (_gameId == GID_MANIAC) && (vm.slot[_currentScript].number == 89)) + if ((var == 175) && (_game.id == GID_MANIAC) && (vm.slot[_currentScript].number == 89)) runScript(164, 0, 0, 0); } @@ -533,7 +533,7 @@ void ScummEngine_v2::o2_setObjPreposition() { int obj = getVarOrDirectWord(PARAM_1); int unk = fetchScriptByte(); - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) return; if (whereIsObject(obj) != WIO_NOT_FOUND) { @@ -705,7 +705,7 @@ void ScummEngine_v2::o2_actorOps() { a->_sound[0] = arg; break; case 2: // SO_PALETTE - if (_version == 1) + if (_game.version == 1) i = act; else i = fetchScriptByte(); @@ -719,7 +719,7 @@ void ScummEngine_v2::o2_actorOps() { a->setActorCostume(arg); break; case 5: // SO_TALK_COLOR - if (_gameId == GID_MANIAC && _version == 2 && _demoMode && arg == 1) + if (_game.id == GID_MANIAC && _game.version == 2 && _demoMode && arg == 1) a->_talkColor = 15; else a->_talkColor = arg; @@ -791,7 +791,7 @@ void ScummEngine_v2::o2_resourceRoutines() { return; // HACK V2 Maniac Mansion tries to load an invalid sound resource in demo script. - if (_gameId == GID_MANIAC && _version == 2 && vm.slot[_currentScript].number == 9 && type == rtSound && resid == 1) + if (_game.id == GID_MANIAC && _game.version == 2 && vm.slot[_currentScript].number == 9 && type == rtSound && resid == 1) return; if ((opcode & 0x0f) == 1) { @@ -834,9 +834,9 @@ void ScummEngine_v2::o2_verbOps() { slot = getVarOrDirectByte(PARAM_1) + 1; int prep = fetchScriptByte(); // Only used in V1? // V1 Maniac verbs are relative to the 'verb area' - under the sentence - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) x += 8; - else if ((_gameId == GID_MANIAC) && (_version == 1)) + else if ((_game.id == GID_MANIAC) && (_game.version == 1)) y += 8; //printf("o2_verbOps: verb = %d, slot = %d, x = %d, y = %d, unk = %d, name = %s\n", @@ -847,16 +847,16 @@ void ScummEngine_v2::o2_verbOps() { vs = &_verbs[slot]; vs->verbid = verb; - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { vs->color = 1; vs->hicolor = 1; vs->dimcolor = 1; - } else if (_version == 1) { - vs->color = (_gameId == GID_MANIAC && _demoMode) ? 16 : 5; + } else if (_game.version == 1) { + vs->color = (_game.id == GID_MANIAC && _demoMode) ? 16 : 5; vs->hicolor = 7; vs->dimcolor = 11; } else { - vs->color = (_gameId == GID_MANIAC && _demoMode) ? 13 : 2; + vs->color = (_game.id == GID_MANIAC && _demoMode) ? 13 : 2; vs->hicolor = 14; vs->dimcolor = 8; } @@ -990,7 +990,7 @@ void ScummEngine_v2::o2_drawSentence() { const byte *temp; int slot = getVerbSlot(VAR(VAR_SENTENCE_VERB), 0); - if (!((_userState & 32) || (_platform == Common::kPlatformNES && _userState & 0xe0))) + if (!((_userState & 32) || (_game.platform == Common::kPlatformNES && _userState & 0xe0))) return; if (getResourceAddress(rtVerb, slot)) @@ -1007,7 +1007,7 @@ void ScummEngine_v2::o2_drawSentence() { // For V1 games, the engine must compute the preposition. // In all other Scumm versions, this is done by the sentence script. - if ((_gameId == GID_MANIAC && _version == 1 && !(_platform == Common::kPlatformNES)) && (VAR(VAR_SENTENCE_PREPOSITION) == 0)) { + if ((_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) && (VAR(VAR_SENTENCE_PREPOSITION) == 0)) { if (_verbs[slot].prep == 0xFF) { byte *ptr = getOBCDFromObject(VAR(VAR_SENTENCE_OBJECT1)); assert(ptr); @@ -1035,7 +1035,7 @@ void ScummEngine_v2::o2_drawSentence() { { " ", " in", " with", " on", " to" } // Korean }; int lang = (_language <= 8) ? _language : 0; // Default to english - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { strcat(sentence, (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2)); } else strcat(sentence, prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)]); @@ -1052,10 +1052,10 @@ void ScummEngine_v2::o2_drawSentence() { _string[2].charset = 1; _string[2].ypos = virtscr[kVerbVirtScreen].topline; _string[2].xpos = 0; - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { _string[2].xpos = 16; _string[2].color = 0; - } else if (_version == 1) + } else if (_game.version == 1) _string[2].color = 16; else _string[2].color = 13; @@ -1065,7 +1065,7 @@ void ScummEngine_v2::o2_drawSentence() { int i = 0, len = 0; // Maximum length of printable characters - int maxChars = (_platform == Common::kPlatformNES) ? 60: 40; + int maxChars = (_game.platform == Common::kPlatformNES) ? 60: 40; while (*ptr) { if (*ptr != '@') len++; @@ -1075,14 +1075,14 @@ void ScummEngine_v2::o2_drawSentence() { string[i++] = *ptr++; - if (_platform == Common::kPlatformNES && len == 30) { + if (_game.platform == Common::kPlatformNES && len == 30) { string[i++] = 0xFF; string[i++] = 8; } } string[i] = 0; - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { sentenceline.top = virtscr[kVerbVirtScreen].topline; sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 16; sentenceline.left = 16; @@ -1123,7 +1123,7 @@ void ScummEngine_v2::o2_walkActorTo() { int act = getVarOrDirectByte(PARAM_1); // WORKAROUND bug #1252606 - if (_gameId == GID_ZAK && _version == 1 && vm.slot[_currentScript].number == 115 && act == 249) { + if (_game.id == GID_ZAK && _game.version == 1 && vm.slot[_currentScript].number == 115 && act == 249) { act = VAR(VAR_EGO); } @@ -1155,7 +1155,7 @@ void ScummEngine_v2::o2_startScript() { // The enhanced version of Zak McKracken included in the // SelectWare Classic Collection bundle used CD check instead // of the usual key code check at airports. - if ((_gameId == GID_ZAK) && (script == 15) && (_roomResource == 45)) + if ((_game.id == GID_ZAK) && (script == 15) && (_roomResource == 45)) return; } @@ -1167,7 +1167,7 @@ void ScummEngine_v2::o2_stopScript() { script = getVarOrDirectByte(PARAM_1); - if ((_gameId == GID_ZAK) && (_roomResource == 7) && (vm.slot[_currentScript].number == 10001)) { + if ((_game.id == GID_ZAK) && (_roomResource == 7) && (vm.slot[_currentScript].number == 10001)) { // FIXME: Nasty hack for bug #771499 // Don't let the exit script for room 7 stop the buy script (24), // switching to the number selection keypad (script 15) @@ -1255,7 +1255,7 @@ void ScummEngine_v2::o2_findObject() { int x = getVarOrDirectByte(PARAM_1) * 8; int y = getVarOrDirectByte(PARAM_2) * 2; obj = findObject(x, y); - if (obj == 0 && (_platform == Common::kPlatformNES) && (_userState & 0x40)) { + if (obj == 0 && (_game.platform == Common::kPlatformNES) && (_userState & 0x40)) { if (_mouseOverBoxV2 >= 0 && _mouseOverBoxV2 < 4) obj = findInventory(VAR(VAR_EGO), _mouseOverBoxV2 + _inventoryOffset + 1); } @@ -1323,7 +1323,7 @@ void ScummEngine_v2::o2_lights() { c = fetchScriptByte(); if (c == 0) { - if (_gameId == GID_MANIAC && _version == 1 && !(_platform == Common::kPlatformNES)) { + if (_game.id == GID_MANIAC && _game.version == 1 && !(_game.platform == Common::kPlatformNES)) { // Convert older light mode values into // equivalent values.of later games // 0 Darkness @@ -1432,7 +1432,7 @@ void ScummEngine_v2::o2_roomOps() { VAR(VAR_CAMERA_MAX_X) = b; break; case 2: // SO_ROOM_COLOR - if (_version == 1) { + if (_game.version == 1) { // V1 zak needs to know when room color is changed _roomPalette[0] = 255; _roomPalette[1] = a; @@ -1456,7 +1456,7 @@ void ScummEngine_v2::o2_cutscene() { // FIXME allows quotes script (173) to start during introudction of // demo mode of V1 Maniac Mansion. setUserState was halting script // 173 before it started. - if (!(_gameId == GID_MANIAC && _demoMode)) + if (!(_game.id == GID_MANIAC && _demoMode)) // Hide inventory, freeze scripts, hide cursor setUserState(15); @@ -1479,7 +1479,7 @@ void ScummEngine_v2::o2_endCutscene() { // Reset user state to values before cutscene setUserState(vm.cutSceneData[0] | 7); - if ((_gameId == GID_MANIAC) && !(_platform == Common::kPlatformNES)) { + if ((_game.id == GID_MANIAC) && !(_game.platform == Common::kPlatformNES)) { camera._mode = (byte) vm.cutSceneData[3]; if (camera._mode == kFollowActorCameraMode) { actorFollowCamera(VAR(VAR_EGO)); @@ -1527,7 +1527,7 @@ void ScummEngine_v2::o2_pickupObject() { clearDrawObjectQueue(); runInventoryScript(1); - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) _sound->addSoundToQueue(51); // play 'pickup' sound } @@ -1544,7 +1544,7 @@ void ScummEngine_v2::o2_cursorCommand() { // TODO: Define the magic numbers void ScummEngine_v2::setUserState(byte state) { if (state & 4) { // Userface - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) _userState = (_userState & ~0xE0) | (state & 0xE0); else _userState = state & (32 | 64 | 128); @@ -1558,7 +1558,7 @@ void ScummEngine_v2::setUserState(byte state) { } if (state & 2) { // Cursor Show/Hide - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) _userState = (_userState & ~0x10) | (state & 0x10); if (state & 16) { _userPut = 1; @@ -1573,7 +1573,7 @@ void ScummEngine_v2::setUserState(byte state) { Common::Rect rect; rect.top = virtscr[kVerbVirtScreen].topline; rect.bottom = virtscr[kVerbVirtScreen].topline + 8 * 88; - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { rect.left = 16; rect.right = 255; } else { @@ -1603,9 +1603,9 @@ void ScummEngine_v2::o2_dummy() { void ScummEngine_v2::o2_switchCostumeSet() { // NES version of maniac uses this to switch between the two // groups of costumes it has - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) NES_loadCostumeSet(fetchScriptByte()); - else if (_platform == Common::kPlatformC64) + else if (_game.platform == Common::kPlatformC64) fetchScriptByte(); else o2_dummy(); diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 0932958abb..499d13dabd 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -413,7 +413,7 @@ void ScummEngine_v5::o5_actorOps() { int i, j; while ((_opcode = fetchScriptByte()) != 0xFF) { - if (_features & GF_SMALL_HEADER) + if (_game.features & GF_SMALL_HEADER) _opcode = (_opcode & 0xE0) | convertTable[(_opcode & 0x1F) - 1]; switch (_opcode & 0x1F) { @@ -500,7 +500,7 @@ void ScummEngine_v5::o5_actorOps() { a->_width = getVarOrDirectByte(PARAM_1); break; case 17: // SO_ACTOR_SCALE - if (_version == 4) { + if (_game.version == 4) { i = j = getVarOrDirectByte(PARAM_1); } else { i = getVarOrDirectByte(PARAM_1); @@ -545,7 +545,7 @@ void ScummEngine_v5::o5_setClass() { if (newClass == 0) { // Class '0' means: clean all class data _classData[obj] = 0; - if ((_features & GF_SMALL_HEADER) && obj <= _numActors) { + if ((_game.features & GF_SMALL_HEADER) && obj <= _numActors) { Actor *a = derefActor(obj, "o5_setClass"); a->_ignoreBoxes = false; a->_forceClip = 0; @@ -564,7 +564,7 @@ void ScummEngine_v5::o5_add() { // understand the reasoning behind this, compare script 210 and 218 in // room 20. Apparently they made a mistake when converting the absolute // delays into relative ones. - if (_gameId == GID_LOOM && _version == 4 && vm.slot[_currentScript].number == 210 && _currentRoom == 20 && _resultVarNumber == 0x4000) { + if (_game.id == GID_LOOM && _game.version == 4 && vm.slot[_currentScript].number == 210 && _currentRoom == 20 && _resultVarNumber == 0x4000) { switch (a) { // Fix for the Var[250] == 11 case case 138: @@ -605,7 +605,7 @@ void ScummEngine_v5::o5_animateActor() { // WORKAROUND bug #820357: This seems to be yet another script bug which // the original engine let slip by. For details, refer to the tracker item. - if (_gameId == GID_INDY4 && vm.slot[_currentScript].number == 206 && _currentRoom == 17 && (act == 31 || act == 86)) { + if (_game.id == GID_INDY4 && vm.slot[_currentScript].number == 206 && _currentRoom == 17 && (act == 31 || act == 86)) { return; } @@ -635,7 +635,7 @@ void ScummEngine_v5::o5_chainScript() { // called via chainScript by script 32, and in there Local[5] is defined // to the actor ID of the opposing soldier. So, we copy that value over // to the Local[5] variable of script 33. - if (_gameId == GID_INDY3 && vm.slot[cur].number == 32 && script == 33) { + if (_game.id == GID_INDY3 && vm.slot[cur].number == 32 && script == 33) { vars[5] = vm.localvar[cur][5]; } @@ -700,7 +700,7 @@ void ScummEngine_v5::o5_cursorCommand() { initCharset(getVarOrDirectByte(PARAM_1)); break; case 14: /* unk */ - if (_version == 3) { + if (_game.version == 3) { /*int a = */ getVarOrDirectByte(PARAM_1); /*int b = */ getVarOrDirectByte(PARAM_2); // This is some kind of "init charset" opcode. However, we don't have to do anything @@ -714,7 +714,7 @@ void ScummEngine_v5::o5_cursorCommand() { break; } - if (_version >= 4) { + if (_game.version >= 4) { VAR(VAR_CURSORSTATE) = _cursor.state; VAR(VAR_USERPUT) = _userPut; } @@ -811,7 +811,7 @@ void ScummEngine_v5::o5_drawObject() { xpos = ypos = 255; obj = getVarOrDirectWord(PARAM_1); - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { xpos = getVarOrDirectWord(PARAM_2); ypos = getVarOrDirectWord(PARAM_3); } else { @@ -1053,7 +1053,7 @@ void ScummEngine_v5::o5_getActorRoom() { // WORKAROUND bug #746349. This is a really odd bug in either the script // or in our script engine. Might be a good idea to investigate this // further by e.g. looking at the FOA engine a bit closer. - if (_gameId == GID_INDY4 && _roomResource == 94 && vm.slot[_currentScript].number == 206 && !isValidActor(act)) { + if (_game.id == GID_INDY4 && _roomResource == 94 && vm.slot[_currentScript].number == 206 && !isValidActor(act)) { setResult(0); return; } @@ -1066,7 +1066,7 @@ void ScummEngine_v5::o5_getActorScale() { Actor *a; // INDY3 uses this opcode for waitForActor - if (_gameId == GID_INDY3) { + if (_game.id == GID_INDY3) { const byte *oldaddr = _scriptPointer - 1; a = derefActor(getVarOrDirectByte(PARAM_1), "o5_getActorScale (wait)"); if (a->_moving) { @@ -1100,7 +1100,7 @@ void ScummEngine_v5::o5_getActorX() { int a; getResultPos(); - if ((_gameId == GID_INDY3) && !(_platform == Common::kPlatformMacintosh)) + if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh)) a = getVarOrDirectByte(PARAM_1); else a = getVarOrDirectWord(PARAM_1); @@ -1112,7 +1112,7 @@ void ScummEngine_v5::o5_getActorY() { int a; getResultPos(); - if ((_gameId == GID_INDY3) && !(_platform == Common::kPlatformMacintosh)) { + if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh)) { a = getVarOrDirectByte(PARAM_1); // WORKAROUND bug #636433 (can't get into Zeppelin) @@ -1132,14 +1132,14 @@ void ScummEngine_v5::o5_saveLoadGame() { byte slot = (a & 0x1F) + 1; byte result = 0; - if ((_gameId == GID_MANIAC) && (_version == 1)) { + if ((_game.id == GID_MANIAC) && (_game.version == 1)) { // Convert older load/save screen // 1 Load // 2 Save slot = 1; if (a == 1) _opcode = 0x40; - else if ((a == 2) || (_platform == Common::kPlatformNES)) + else if ((a == 2) || (_game.platform == Common::kPlatformNES)) _opcode = 0x80; } else { _opcode = a & 0xE0; @@ -1150,7 +1150,7 @@ void ScummEngine_v5::o5_saveLoadGame() { result = 100; break; case 0x20: // drive - if (_gameId == GID_INDY3) { + if (_game.id == GID_INDY3) { // 0 = hard drive // 1 = disk drive result = 0; @@ -1190,7 +1190,7 @@ void ScummEngine_v5::o5_saveLoadGame() { } void ScummEngine_v5::o5_getAnimCounter() { - if (_version == 3) { + if (_game.version == 3) { o5_saveLoadGame(); return; } @@ -1239,11 +1239,11 @@ void ScummEngine_v5::o5_getDist() { // FIXME: MI2 race workaround, see bug #597022. We never quite figured out // what the real cause of this, or if it maybe occurs in the original, too... - if (_gameId == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60) + if (_game.id == GID_MONKEY2 && vm.slot[_currentScript].number == 40 && r < 60) r = 60; // WORKAROUND bug #795937 - if ((_gameId == GID_MONKEY_EGA || _gameId == GID_PASS) && o1 == 1 && o2 == 307 && vm.slot[_currentScript].number == 205 && r == 2) + if ((_game.id == GID_MONKEY_EGA || _game.id == GID_PASS) && o1 == 1 && o2 == 307 && vm.slot[_currentScript].number == 205 && r == 2) r = 3; setResult(r); @@ -1260,7 +1260,7 @@ void ScummEngine_v5::o5_getObjectOwner() { } void ScummEngine_v5::o5_getObjectState() { - if (_features & GF_SMALL_HEADER) { + if (_game.features & GF_SMALL_HEADER) { o5_ifState(); } else { getResultPos(); @@ -1350,7 +1350,7 @@ void ScummEngine_v5::o5_isEqual() { int16 a, b; int var; - if (_version <= 2) + if (_game.version <= 2) var = fetchScriptByte(); else var = fetchScriptWord(); @@ -1362,12 +1362,12 @@ void ScummEngine_v5::o5_isEqual() { // other sound effect (the bartender spitting) which is only played on // type 3 soundcards. - if (_gameId == GID_MONKEY2 && var == VAR_SOUNDCARD && b == 5) + if (_game.id == GID_MONKEY2 && var == VAR_SOUNDCARD && b == 5) b = a; // HACK: To allow demo script of Maniac Mansion V2 // The camera x position is only 100, instead of 180, after game title name scrolls. - if (_gameId == GID_MANIAC && _version == 2 && _demoMode && isScriptRunning(173) && b == 180) + if (_game.id == GID_MANIAC && _game.version == 2 && _demoMode && isScriptRunning(173) && b == 180) b = 100; if (b == a) @@ -1409,7 +1409,7 @@ void ScummEngine_v5::o5_lessOrEqual() { int16 b = getVarOrDirectWord(PARAM_1); // WORKAROUND bug #820507 : Work around a bug in Indy3Town. - if (_gameId == GID_INDY3 && (_platform == Common::kPlatformFMTowns) && + if (_game.id == GID_INDY3 && (_game.platform == Common::kPlatformFMTowns) && (vm.slot[_currentScript].number == 200 || vm.slot[_currentScript].number == 203) && _currentRoom == 70 && b == -256) { o5_jumpRelative(); @@ -1482,7 +1482,7 @@ void ScummEngine_v5::o5_loadRoom() { if (!_copyProtection) { // Skip copy protection scheme - if (_gameId == GID_INDY3 && (_features & GF_OLD_BUNDLE) && room == 92) { + if (_game.id == GID_INDY3 && (_game.features & GF_OLD_BUNDLE) && room == 92) { VAR(57) = 1; return; } @@ -1491,7 +1491,7 @@ void ScummEngine_v5::o5_loadRoom() { // For small header games, we only call startScene if the room // actually changed. This avoid unwanted (wrong) fades in Zak256 // and others. OTOH, it seems to cause a problem in newer games. - if (!(_features & GF_SMALL_HEADER) || room != _currentRoom) + if (!(_game.features & GF_SMALL_HEADER) || room != _currentRoom) startScene(room, 0, 0); _fullRedraw = true; @@ -1518,7 +1518,7 @@ void ScummEngine_v5::o5_loadRoomWithEgo() { startScene(a->_room, a, obj); VAR(VAR_WALKTO_OBJ) = 0; - if (_version <= 4) { + if (_game.version <= 4) { if (whereIsObject(obj) != WIO_ROOM) error("o5_loadRoomWithEgo: Object %d is not in room %d", obj, _currentRoom); if (!_egoPositioned) { @@ -1544,7 +1544,7 @@ void ScummEngine_v5::o5_loadRoomWithEgo() { void ScummEngine_v5::o5_matrixOps() { int a, b; - if (_version == 3) { + if (_game.version == 3) { a = getVarOrDirectByte(PARAM_1); b = fetchScriptByte(); setBoxFlags(a, b); @@ -1606,7 +1606,7 @@ void ScummEngine_v5::o5_panCameraTo() { void ScummEngine_v5::o5_pickupObject() { int obj, room; - if (_version == 3 || _version == 4) { + if (_game.version == 3 || _game.version == 4) { o5_drawObject(); return; } @@ -1708,7 +1708,7 @@ void ScummEngine_v5::o5_resourceRoutines() { _opcode = fetchScriptByte(); if (_opcode != 17) resid = getVarOrDirectByte(PARAM_1); - if (!(_platform == Common::kPlatformFMTowns)) { + if (!(_game.platform == Common::kPlatformFMTowns)) { // FIXME - this probably can be removed eventually, I don't think the following // check will ever be triggered, but then I could be wrong and it's better // to play it safe. @@ -1725,7 +1725,7 @@ void ScummEngine_v5::o5_resourceRoutines() { ensureResourceLoaded(resType[op - 1], resid); break; case 4: // SO_LOAD_ROOM - if (_version == 3) { + if (_game.version == 3) { ensureResourceLoaded(rtRoom, resid); if (resid > 0x7F) resid = _resourceMapper[resid & 0x7F]; @@ -1741,7 +1741,7 @@ void ScummEngine_v5::o5_resourceRoutines() { case 6: // SO_NUKE_SOUND case 7: // SO_NUKE_COSTUME case 8: // SO_NUKE_ROOM - if (_gameId == GID_ZAK && (_platform == Common::kPlatformFMTowns)) + if (_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns)) error("o5_resourceRoutines %d should not occur in Zak256", op); else res.setResourceCounter(resType[op-5], resid, 0x7F); @@ -1829,7 +1829,7 @@ void ScummEngine_v5::o5_resourceRoutines() { void ScummEngine_v5::o5_roomOps() { int a = 0, b = 0, c, d, e; - if (_version == 3) { + if (_game.version == 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } @@ -1837,7 +1837,7 @@ void ScummEngine_v5::o5_roomOps() { _opcode = fetchScriptByte(); switch (_opcode & 0x1F) { case 1: // SO_ROOM_SCROLL - if (_version != 3) { + if (_game.version != 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } @@ -1853,8 +1853,8 @@ void ScummEngine_v5::o5_roomOps() { VAR(VAR_CAMERA_MAX_X) = b; break; case 2: // SO_ROOM_COLOR - if (_features & GF_SMALL_HEADER) { - if (_version != 3) { + if (_game.features & GF_SMALL_HEADER) { + if (_game.version != 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } @@ -1867,15 +1867,15 @@ void ScummEngine_v5::o5_roomOps() { break; case 3: // SO_ROOM_SCREEN - if (_version != 3) { + if (_game.version != 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } initScreens(a, b); break; case 4: // SO_ROOM_PALETTE - if (_features & GF_SMALL_HEADER) { - if (_version != 3) { + if (_game.features & GF_SMALL_HEADER) { + if (_game.version != 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } @@ -1908,8 +1908,8 @@ void ScummEngine_v5::o5_roomOps() { setScaleSlot(e - 1, 0, b, a, 0, d, c); break; case 8: // SO_ROOM_INTENSITY - if (_features & GF_SMALL_HEADER) { - if (_version != 3) { + if (_game.features & GF_SMALL_HEADER) { + if (_game.version != 3) { a = getVarOrDirectWord(PARAM_1); b = getVarOrDirectWord(PARAM_2); } @@ -1930,7 +1930,7 @@ void ScummEngine_v5::o5_roomOps() { case 10: // SO_ROOM_FADE a = getVarOrDirectWord(PARAM_1); if (a) { - if (_platform == Common::kPlatformFMTowns) { + if (_game.platform == Common::kPlatformFMTowns) { switch (a) { case 8: // compose kMainVirtScreen over a screen buffer case 9: // call 0x110:0x20 _ax=0x601 _edx=2 @@ -2135,7 +2135,7 @@ void ScummEngine_v5::o5_setVarRange() { } while (--a); // Macintosh verison of indy3ega used different interface, so adjust values. - if (_gameId == GID_INDY3 && _platform == Common::kPlatformMacintosh) { + if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) { VAR(68) = 0; VAR(69) = 0; VAR(70) = 168; @@ -2154,7 +2154,7 @@ void ScummEngine_v5::o5_setVarRange() { } void ScummEngine_v5::o5_startMusic() { - if (_platform == Common::kPlatformFMTowns && _version == 3) { + if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { // In FM-TOWNS games this is some kind of Audio CD status query function. // See also bug #762589 (thanks to Hibernatus for providing the information). getResultPos(); @@ -2197,7 +2197,7 @@ void ScummEngine_v5::o5_startSound() { // Woodtick music often resumes before Largo's theme has finished. As // far as I can tell, this is a script bug. - if (_gameId == GID_MONKEY2 && sound == 110 && _sound->isSoundRunning(151)) { + if (_game.id == GID_MONKEY2 && sound == 110 && _sound->isSoundRunning(151)) { debug(1, "Delaying Woodtick music until Largo's theme has finished\n"); _scriptPointer = oldaddr; o5_breakHere(); @@ -2229,7 +2229,7 @@ void ScummEngine_v5::o5_isSoundRunning() { void ScummEngine_v5::o5_soundKludge() { int items[16]; - if (_features & GF_SMALL_HEADER) { // Is WaitForSentence in SCUMM V3 + if (_game.features & GF_SMALL_HEADER) { // Is WaitForSentence in SCUMM V3 if (_sentenceNum) { if (_sentence[_sentenceNum - 1].freezeCount && !isScriptInUse(VAR(VAR_SENTENCE_SCRIPT))) return; @@ -2267,14 +2267,14 @@ void ScummEngine_v5::o5_startScript() { // FIXME: Script 171 loads a complete room resource, instead of the actual script. // Causing invalid opcode cases, see bug #1290485 - if (_gameId == GID_ZAK && (_platform == Common::kPlatformFMTowns) && script == 171) + if (_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns) && script == 171) return; if (!_copyProtection) { // Method used by original games to skip copy protection scheme - if (_gameId == GID_LOOM && _version == 3 && _currentRoom == 69 && script == 201) + if (_game.id == GID_LOOM && _game.version == 3 && _currentRoom == 69 && script == 201) script = 205; - else if ((_gameId == GID_MONKEY_VGA || _gameId == GID_MONKEY_EGA) && script == 152) + else if ((_game.id == GID_MONKEY_VGA || _game.id == GID_MONKEY_EGA) && script == 152) return; } @@ -2295,7 +2295,7 @@ void ScummEngine_v5::o5_stopScript() { script = getVarOrDirectByte(PARAM_1); - if (_gameId == GID_INDY4 && script == 164 && + if (_game.id == GID_INDY4 && script == 164 && _roomResource == 50 && vm.slot[_currentScript].number == 213 && VAR(VAR_HAVE_MSG)) { // WORKAROUND bug #1308033: Due to a script bug, a line of text is skipped // which Indy is supposed to speak when he finds Orichalcum in some old @@ -2333,7 +2333,7 @@ void ScummEngine_v5::o5_stringOps() { b = getVarOrDirectByte(PARAM_2); c = getVarOrDirectByte(PARAM_3); ptr = getResourceAddress(rtString, a); - if (!(_gameId == GID_LOOM && _version == 4)) { /* FIXME - LOOM256 */ + if (!(_game.id == GID_LOOM && _game.version == 4)) { /* FIXME - LOOM256 */ if (ptr == NULL) error("String %d does not exist", a); ptr[b] = c; @@ -2413,7 +2413,7 @@ void ScummEngine_v5::o5_verbOps() { vs->curRect.left = getVarOrDirectWord(PARAM_1); vs->curRect.top = getVarOrDirectWord(PARAM_2); // Macintosh verison of indy3ega used different interface, so adjust values. - if ((_platform == Common::kPlatformMacintosh) && (_gameId == GID_INDY3)) { + if ((_game.platform == Common::kPlatformMacintosh) && (_game.id == GID_INDY3)) { switch (verb) { case 1: case 2: @@ -2445,7 +2445,7 @@ void ScummEngine_v5::o5_verbOps() { vs->curRect.top += 8; break; } - } else if (_gameId == GID_LOOM && _version == 4) { + } else if (_game.id == GID_LOOM && _game.version == 4) { // FIXME: hack loom notes into right spot if ((verb >= 90) && (verb <= 97)) { // Notes switch (verb) { @@ -2493,7 +2493,7 @@ void ScummEngine_v5::o5_verbOps() { vs = &_verbs[slot]; vs->verbid = verb; vs->color = 2; - vs->hicolor = (_version == 3) ? 14 : 0; + vs->hicolor = (_game.version == 3) ? 14 : 0; vs->dimcolor = 8; vs->type = kTextVerbType; vs->charset_nr = _string[0]._default.charset; @@ -2553,7 +2553,7 @@ void ScummEngine_v5::o5_verbOps() { void ScummEngine_v5::o5_wait() { const byte *oldaddr = _scriptPointer - 1; - if ((_gameId == GID_INDY3) && !(_platform == Common::kPlatformMacintosh)) { + if ((_game.id == GID_INDY3) && !(_game.platform == Common::kPlatformMacintosh)) { _opcode = 2; } else _opcode = fetchScriptByte(); @@ -2609,12 +2609,12 @@ void ScummEngine_v5::o5_walkActorToActor() { int nr2 = getVarOrDirectByte(PARAM_2); int dist = fetchScriptByte(); - if (nr == 106 && _gameId == GID_INDY4) { + if (nr == 106 && _game.id == GID_INDY4) { printf("Bypassing Indy4 bug\n"); return; } - if (_gameId == GID_LOOM && _version == 4 && nr == 1 && nr2 == 0 && + if (_game.id == GID_LOOM && _game.version == 4 && nr == 1 && nr2 == 0 && dist == 255 && vm.slot[_currentScript].number == 98) { // WORKAROUND bug #743615: LoomCD script 98 contains this: // walkActorToActor(1,0,255) @@ -2623,7 +2623,7 @@ void ScummEngine_v5::o5_walkActorToActor() { return; } - if (_gameId == GID_INDY4 && nr == 1 && nr2 == 106 && + if (_game.id == GID_INDY4 && nr == 1 && nr2 == 106 && dist == 255 && vm.slot[_currentScript].number == 210) { // WORKAROUND bug: Work around an invalid actor bug when using the // camel in Fate of Atlantis, the "wits" path. The room-65-210 script @@ -2642,7 +2642,7 @@ void ScummEngine_v5::o5_walkActorToActor() { if (!a2->isInCurrentRoom()) return; - if (_version <= 2) + if (_game.version <= 2) dist *= 8; else if (dist == 0xFF) { dist = a->_scalex * a->_width / 0xFF; @@ -2655,7 +2655,7 @@ void ScummEngine_v5::o5_walkActorToActor() { else x -= dist; - if (_version <= 3) { + if (_game.version <= 3) { AdjustBoxResult abr = a->adjustXYToBeInBox(x, y); x = abr.x; y = abr.y; @@ -2734,7 +2734,7 @@ void ScummEngine_v5::decodeParseString() { _string[textSlot].overhead = false; break; case 6: // SO_LEFT - if (_version == 3) { + if (_game.version == 3) { _string[textSlot].height = getVarOrDirectWord(PARAM_1); } else { _string[textSlot].center = false; @@ -2748,7 +2748,7 @@ void ScummEngine_v5::decodeParseString() { int offset = (uint16)getVarOrDirectWord(PARAM_1); int delay = (uint16)getVarOrDirectWord(PARAM_2); - if (_gameId == GID_LOOM && _version == 4) { + if (_game.id == GID_LOOM && _game.version == 4) { if (offset == 0 && delay == 0) { VAR(VAR_MUSIC_TIMER) = 0; _sound->stopCD(); @@ -2774,7 +2774,7 @@ void ScummEngine_v5::decodeParseString() { // WORKAROUND: This happens when Chaos introduces // herself to bishop Mandible. Of all the places to put // a typo... - if (_gameId == GID_LOOM && strcmp((const char *) _scriptPointer, "I am Choas.") == 0) + if (_game.id == GID_LOOM && strcmp((const char *) _scriptPointer, "I am Choas.") == 0) printString(textSlot, (const byte *) "I am Chaos."); else printString(textSlot, _scriptPointer); @@ -2792,7 +2792,7 @@ void ScummEngine_v5::decodeParseString() { // Note: We can't use saveDefault() here because we only want to // save the position and color. In particular, we do not want to // save the 'center' flag. See bug #933168. - if (_version <= 3) { + if (_game.version <= 3) { _string[textSlot]._default.xpos = _string[textSlot].xpos; _string[textSlot]._default.ypos = _string[textSlot].ypos; _string[textSlot]._default.height = _string[textSlot].height; @@ -2815,7 +2815,7 @@ void ScummEngine_v5::o5_oldRoomEffect() { a = getVarOrDirectWord(PARAM_1); #if 1 - if (_platform == Common::kPlatformFMTowns && _version == 3) { + if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { // FIXME / TODO: OK the first thing to note is: at least in Zak256, // maybe also in other games, this opcode does a bit more. I added // some stubs here, but somebody with a full IDA or more knowledge diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index f28591d266..21dfefd76f 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -385,7 +385,7 @@ const char *ScummEngine_v6::getOpcodeDesc(byte i) { int ScummEngine_v6::popRoomAndObj(int *room) { int obj; - if (_version >= 7) { + if (_game.version >= 7) { obj = pop(); *room = getObjectRoom(obj); } else { @@ -404,7 +404,7 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::defineArray(int array, int type, in assert(0 <= type && type <= 5); - if (_heversion >= 61) { + if (_game.heversion >= 61) { if (type == kBitArray || type == kNibbleArray) type = kByteArray; } else { @@ -422,7 +422,7 @@ ScummEngine_v6::ArrayHeader *ScummEngine_v6::defineArray(int array, int type, in id = findFreeArrayId(); - if (_version == 8) { + if (_game.version == 8) { if (array & 0x40000000) { } @@ -461,12 +461,12 @@ void ScummEngine_v6::nukeArray(int a) { data = readVar(a); - if (_heversion >= 80) + if (_game.heversion >= 80) data &= ~0x33539000; if (data) res.nukeResource(rtString, data); - if (_heversion >= 60) + if (_game.heversion >= 60) _arraySlot[data] = 0; writeVar(a, 0); @@ -517,7 +517,7 @@ int ScummEngine_v6::readArray(int array, int idx, int base) { // [03BD] (5D) if ((localvar13 != -1) && (localvar14 != -1)) { // [03CF] (B6) printDebug.begin() // ... - if (_gameId == GID_FT && array == 447 && _currentRoom == 95 && vm.slot[_currentScript].number == 2010 && idx == -1 && base == -1) { + if (_game.id == GID_FT && array == 447 && _currentRoom == 95 && vm.slot[_currentScript].number == 2010 && idx == -1 && base == -1) { return 0; } @@ -531,7 +531,7 @@ int ScummEngine_v6::readArray(int array, int idx, int base) { int val; if (FROM_LE_16(ah->type) != kIntArray) { val = ah->data[offset]; - } else if (_version == 8) { + } else if (_game.version == 8) { val = (int32)READ_LE_UINT32(ah->data + offset * 4); } else { val = (int16)READ_LE_UINT16(ah->data + offset * 2); @@ -553,7 +553,7 @@ void ScummEngine_v6::writeArray(int array, int idx, int base, int value) { if (FROM_LE_16(ah->type) != kIntArray) { ah->data[offset] = value; - } else if (_version == 8) { + } else if (_game.version == 8) { WRITE_LE_UINT32(ah->data + offset * 4, value); } else { WRITE_LE_UINT16(ah->data + offset * 2, value); @@ -825,7 +825,7 @@ void ScummEngine_v6::o6_startScript() { // the Wally and Rex dinosaurs will always restart their speech, instead of // stopping and starting their speech. This was a script bug in the original // game. - if (_gameId == GID_SAMNMAX && _roomResource == 59 && + if (_game.id == GID_SAMNMAX && _roomResource == 59 && vm.slot[_currentScript].number == 201 && script == 48) { o6_breakHere(); } @@ -837,7 +837,7 @@ void ScummEngine_v6::o6_startScript() { // text in this spot, for the above reason. Since the data files are // unchanged, it must have been an engine hack job. No idea how they did // it exactly, but this here is how we do it :-) - if (_gameId == GID_CMI && script == 204 && + if (_game.id == GID_CMI && script == 204 && _currentRoom == 15 && vm.slot[_currentScript].number == 421 && _language == Common::DE_DEU) { @@ -983,7 +983,7 @@ void ScummEngine_v6::o6_cursorCommand() { case 0x99: // SO_CURSOR_IMAGE Set cursor image { int room, obj; - if (_heversion >= 70) { + if (_game.heversion >= 70) { obj = pop(); room = getObjectRoom(obj); } else { @@ -1029,7 +1029,7 @@ void ScummEngine_v6::o6_ifClassOfIs() { num = getStackList(args, ARRAYSIZE(args)); obj = pop(); - if (_heversion >= 80 && num == 0) { + if (_game.heversion >= 80 && num == 0) { push(_classData[obj]); return; } @@ -1091,11 +1091,11 @@ void ScummEngine_v6::o6_startSound() { // In Fatty Bear's Birthday Surprise the piano uses offsets 1 - 23 to // indicate which note to play, but only when using the standard piano // sound. See also o60_soundOps() - if (_heversion >= 60 && (_gameId != GID_PUTTDEMO)) + if (_game.heversion >= 60 && (_game.id != GID_PUTTDEMO)) offset = pop(); #ifndef DISABLE_SCUMM_7_8 - if (_features & GF_DIGI_IMUSE) + if (_game.features & GF_DIGI_IMUSE) _imuseDigital->startSfx(pop(), 64); else #endif @@ -1107,7 +1107,7 @@ void ScummEngine_v6::o6_stopSound() { } void ScummEngine_v6::o6_startMusic() { - if (_features & GF_DIGI_IMUSE) + if (_game.features & GF_DIGI_IMUSE) error("o6_startMusic() It shouldn't be called here for imuse digital"); _sound->addSoundToQueue(pop()); @@ -1118,7 +1118,7 @@ void ScummEngine_v6::o6_stopObjectScript() { } void ScummEngine_v6::o6_panCameraTo() { - if (_version >= 7) { + if (_game.version >= 7) { int y = pop(); int x = pop(); panCameraTo(x, y); @@ -1128,14 +1128,14 @@ void ScummEngine_v6::o6_panCameraTo() { } void ScummEngine_v6::o6_actorFollowCamera() { - if (_version >= 7) + if (_game.version >= 7) setCameraFollows(derefActor(pop(), "actorFollowCamera")); else actorFollowCamera(pop()); } void ScummEngine_v6::o6_setCameraAt() { - if (_version >= 7) { + if (_game.version >= 7) { int x, y; camera._follows = 0; @@ -1153,7 +1153,7 @@ void ScummEngine_v6::o6_setCameraAt() { void ScummEngine_v6::o6_loadRoom() { int room = pop(); startScene(room, 0, 0); - if (_heversion >= 61) { + if (_game.heversion >= 61) { setCameraAt(camera._cur.x, 0); } _fullRedraw = true; @@ -1188,7 +1188,7 @@ void ScummEngine_v6::o6_walkActorToObj() { a->startWalkActor(x, y, dir); } else { a2 = derefActorSafe(obj, "o6_walkActorToObj(2)"); - if (_gameId == GID_SAMNMAX && a2 == 0) { + if (_game.id == GID_SAMNMAX && a2 == 0) { // WORKAROUND bug #742676 SAM: Fish Farm. Note quite sure why it // happens, whether it's normal or due to a bug in the ScummVM code. debug(0, "o6_walkActorToObj: invalid actor %d", obj); @@ -1268,7 +1268,7 @@ void ScummEngine_v6::o6_faceActor() { void ScummEngine_v6::o6_animateActor() { int anim = pop(); int act = pop(); - if (_gameId == GID_TENTACLE && _roomResource == 57 && + if (_game.id == GID_TENTACLE && _roomResource == 57 && vm.slot[_currentScript].number == 19 && act == 593) { // WORKAROUND bug #743363: This very odd case (animateActor(593,250)) // occurs in DOTT, in the cutscene after George cuts down the "cherry @@ -1277,7 +1277,7 @@ void ScummEngine_v6::o6_animateActor() { // (593 is the time machine in room 57), or if this is simply a script bug. act = 6; } - if (_gameId == GID_SAMNMAX && _roomResource == 35 && + if (_game.id == GID_SAMNMAX && _roomResource == 35 && vm.slot[_currentScript].number == 202 && act == 4 && anim == 14) { // WORKAROUND bug #1223621 (Animation glitch at World of Fish). // Before starting animation 14 of the fisherman, make sure he isn't @@ -1294,7 +1294,7 @@ void ScummEngine_v6::o6_doSentence() { int verb, objectA, objectB, dummy = 0; objectB = pop(); - if (_version < 8) + if (_game.version < 8) dummy = pop(); // dummy pop (in Sam&Max, seems to be always 0 or 130) objectA = pop(); verb = pop(); @@ -1344,7 +1344,7 @@ void ScummEngine_v6::o6_loadRoomWithEgo() { startScene(a->_room, a, obj); VAR(VAR_WALKTO_OBJ) = 0; - if (_version == 6) { + if (_game.version == 6) { camera._cur.x = camera._dest.x = a->_pos.x; setCameraFollows(a); } @@ -1531,7 +1531,7 @@ void ScummEngine_v6::o6_setBoxFlags() { void ScummEngine_v6::o6_createBoxMatrix() { createBoxMatrix(); - if ((_gameId == GID_DIG) || (_gameId == GID_CMI)) + if ((_game.id == GID_DIG) || (_game.id == GID_CMI)) putActors(); } @@ -1543,7 +1543,7 @@ void ScummEngine_v6::o6_resourceRoutines() { switch (subOp) { case 100: // SO_LOAD_SCRIPT resid = pop(); - if (_version >= 7) + if (_game.version >= 7) if (resid >= _numGlobalScripts) break; ensureResourceLoaded(rtScript, resid); @@ -1562,7 +1562,7 @@ void ScummEngine_v6::o6_resourceRoutines() { break; case 104: // SO_NUKE_SCRIPT resid = pop(); - if (_version >= 7) + if (_game.version >= 7) if (resid >= _numGlobalScripts) break; res.setResourceCounter(rtScript, resid, 0x7F); @@ -1697,7 +1697,7 @@ void ScummEngine_v6::o6_roomOps() { _saveTemporaryState = true; _saveLoadSlot = pop(); _saveLoadFlag = pop(); - if (_gameId == GID_TENTACLE) + if (_game.id == GID_TENTACLE) _saveSound = (_saveLoadSlot != 0); break; @@ -1761,7 +1761,7 @@ void ScummEngine_v6::o6_roomOps() { // this way, we avoid some graphics glitches that the original // interpreter had. - if (_gameId == GID_SAMNMAX && vm.slot[_currentScript].number == 64) + if (_game.id == GID_SAMNMAX && vm.slot[_currentScript].number == 64) setDirtyColors(0, 255); else setPalette(a); @@ -1860,13 +1860,13 @@ void ScummEngine_v6::o6_actorOps() { break; case 95: // SO_IGNORE_BOXES a->_ignoreBoxes = 1; - a->_forceClip = (_version >= 7) ? 100 : 0; + a->_forceClip = (_game.version >= 7) ? 100 : 0; if (a->isInCurrentRoom()) a->putActor(a->_pos.x, a->_pos.y, a->_room); break; case 96: // SO_FOLLOW_BOXES a->_ignoreBoxes = 0; - a->_forceClip = (_version >= 7) ? 100 : 0; + a->_forceClip = (_game.version >= 7) ? 100 : 0; if (a->isInCurrentRoom()) a->putActor(a->_pos.x, a->_pos.y, a->_room); break; @@ -1943,7 +1943,7 @@ void ScummEngine_v6::o6_verbOps() { if (_curVerbSlot) { setVerbObject(_roomResource, a, slot); vs->type = kImageVerbType; - if (_heversion >= 61) + if (_game.heversion >= 61) vs->imgindex = a; } break; @@ -1969,7 +1969,7 @@ void ScummEngine_v6::o6_verbOps() { vs->curmode = 0; break; case 131: // SO_VERB_DELETE - if (_heversion >= 60) { + if (_game.heversion >= 60) { slot = getVerbSlot(pop(), 0); } killVerb(slot); @@ -2126,7 +2126,7 @@ void ScummEngine_v6::o6_saveRestoreVerbs() { a = pop(); byte subOp = fetchScriptByte(); - if (_version == 8) { + if (_game.version == 8) { subOp = (subOp - 141) + 0xB4; } @@ -2192,7 +2192,7 @@ void ScummEngine_v6::o6_wait() { offs = fetchScriptWordSigned(); actnum = pop(); a = derefActor(actnum, "o6_wait:168"); - if (_version >= 7) { + if (_game.version >= 7) { if (a->isInCurrentRoom() && a->_moving) break; } else { @@ -2205,7 +2205,7 @@ void ScummEngine_v6::o6_wait() { break; return; case 170: // SO_WAIT_FOR_CAMERA Wait for camera - if (_version >= 7) { + if (_game.version >= 7) { if (camera._dest != camera._cur) break; } else { @@ -2271,7 +2271,7 @@ void ScummEngine_v6::o6_soundKludge() { // to hang indefinitely. We identify the buggy part of the script by // looking for a soundKludge() opcode immediately followed by a jump. - if (_gameId == GID_CMI && _roomResource == 11 && vm.slot[_currentScript].number == 2016 && *_scriptPointer == 0x66) { + if (_game.id == GID_CMI && _roomResource == 11 && vm.slot[_currentScript].number == 2016 && *_scriptPointer == 0x66) { debug(3, "Working around script bug in room-11-2016"); o6_breakHere(); } @@ -2413,7 +2413,7 @@ void ScummEngine_v6::o6_dimArray() { } void ScummEngine_v6::o6_dummy() { - if (_heversion >= 60) { + if (_game.heversion >= 60) { stopObjectCode(); } } @@ -2513,7 +2513,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() { num = getStackList(args, ARRAYSIZE(args)); - if (_version >= 7) { + if (_game.version >= 7) { switch (args[0]) { case 4: grabCursor(args[1], args[2], args[3], args[4]); @@ -2532,14 +2532,14 @@ void ScummEngine_v6::o6_kernelSetFunctions() { SmushPlayer *sp = new SmushPlayer(this, _smushFrameRate); // Correct incorrect smush filename in Macintosh FT demo - if ((_gameId == GID_FT) && (_features & GF_DEMO) && (_platform == Common::kPlatformMacintosh) && + if ((_game.id == GID_FT) && (_game.features & GF_DEMO) && (_game.platform == Common::kPlatformMacintosh) && (strcmp((char *)getStringAddressVar(VAR_VIDEONAME), "jumpgorge.san") == 0)) sp->play("jumpgorg.san"); else sp->play((char *)getStringAddressVar(VAR_VIDEONAME)); delete sp; - } else if (_gameId == GID_FT) { - const int insaneVarNum = ((_features & GF_DEMO) && (_platform == Common::kPlatformPC)) + } else if (_game.id == GID_FT) { + const int insaneVarNum = ((_game.features & GF_DEMO) && (_game.platform == Common::kPlatformPC)) ? 232 : 233; _insaneRunning = true; @@ -2651,7 +2651,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() { break; case 114: // Sam & Max film noir mode - if (_gameId == GID_SAMNMAX) { + if (_game.id == GID_SAMNMAX) { // At this point ScummVM will already have set // variable 0x8000 to indicate that the game is // in film noir mode. All we have to do here is @@ -2938,7 +2938,7 @@ void ScummEngine_v6::o6_stampObject() { y = pop(); x = pop(); object = pop(); - if (_version >= 7 && object < 30) { + if (_game.version >= 7 && object < 30) { if (state == 0) state = 255; @@ -3069,7 +3069,7 @@ void ScummEngine_v6::o6_getDateTime() { VAR(VAR_TIMEDATE_HOUR) = t->tm_hour; VAR(VAR_TIMEDATE_MINUTE) = t->tm_min; - if (_version == 8) + if (_game.version == 8) VAR(VAR_TIMEDATE_SECOND) = t->tm_sec; } @@ -3078,7 +3078,7 @@ void ScummEngine_v6::o6_getPixel() { // minigame in "The Dig" int x, y; - if (_heversion == 61) { + if (_game.heversion == 61) { x = pop(); y = pop(); } else { @@ -3131,7 +3131,7 @@ void ScummEngine_v6::o6_setBoxSet() { assert(matrix); memcpy(matrix, boxm + 8, mboxSize); - if (_version == 7) + if (_game.version == 7) putActors(); } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 0127c73d5c..bf707c4d8d 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1130,12 +1130,7 @@ static int compareMD5Table(const void *a, const void *b) { ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex) : Engine(syst), - _gameId(gs.id), - _version(gs.version), - _heversion(gs.heversion), - _features(gs.features), - _platform(gs.platform), - _midi(gs.midi), + _game(gs), _substResFileNameIndex(substResFileNameIndex), _substResFileNameIndexBundle(0), _debugger(0), @@ -1163,7 +1158,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS if (!elem) printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); - if (_gameId == GID_FT) { + if (_game.id == GID_FT) { // WORKAROUND for bug #1407789. See checkAndRunSentenceScript() // for the actual workaround. @@ -1190,13 +1185,13 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS } // Add default file directories. - if (((_platform == Common::kPlatformAmiga) || (_platform == Common::kPlatformAtariST)) && (_version <= 4)) { + if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) { // This is for the Amiga version of Indy3/Loom/Maniac/Zak File::addDefaultDirectory(_gameDataPath + "ROOMS/"); File::addDefaultDirectory(_gameDataPath + "rooms/"); } - if ((_platform == Common::kPlatformMacintosh) && (_version == 3)) { + if ((_game.platform == Common::kPlatformMacintosh) && (_game.version == 3)) { // This is for the Mac version of Indy3/Loom File::addDefaultDirectory(_gameDataPath + "Rooms 1/"); File::addDefaultDirectory(_gameDataPath + "Rooms 2/"); @@ -1205,7 +1200,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS #ifndef DISABLE_SCUMM_7_8 #ifdef MACOSX - if (_version == 8 && !memcmp(_gameDataPath.c_str(), "/Volumes/MONKEY3_", 17)) { + if (_game.version == 8 && !memcmp(_gameDataPath.c_str(), "/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) @@ -1220,13 +1215,13 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS File::addDefaultDirectory("/Volumes/MONKEY3_2/resource/"); } else #endif - if (_version == 8) { + if (_game.version == 8) { // This is for COMI File::addDefaultDirectory(_gameDataPath + "RESOURCE/"); File::addDefaultDirectory(_gameDataPath + "resource/"); } - if (_version == 7) { + if (_game.version == 7) { // This is for Full Throttle & The Dig File::addDefaultDirectory(_gameDataPath + "VIDEO/"); File::addDefaultDirectory(_gameDataPath + "video/"); @@ -1237,17 +1232,17 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // We read data directly from NES ROM instead of extracting it with // external tool - if ((_platform == Common::kPlatformNES) && _substResFileNameIndex) { + if ((_game.platform == Common::kPlatformNES) && _substResFileNameIndex) { char tmpBuf[128]; generateSubstResFileName("00.LFL", tmpBuf, sizeof(tmpBuf)); _fileHandle = new ScummNESFile(); _containerFile = tmpBuf; - } else if ((_platform == Common::kPlatformC64) && _substResFileNameIndex) { + } else if ((_game.platform == Common::kPlatformC64) && _substResFileNameIndex) { char tmpBuf1[128], tmpBuf2[128]; generateSubstResFileName("00.LFL", tmpBuf1, sizeof(tmpBuf1)); generateSubstResFileName("01.LFL", tmpBuf2, sizeof(tmpBuf2)); - _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _gameId == GID_MANIAC); + _fileHandle = new ScummC64File(tmpBuf1, tmpBuf2, _game.id == GID_MANIAC); _containerFile = tmpBuf1; } else @@ -1261,8 +1256,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // (we do that here); the rest is handled by the ScummFile class and // code in openResourceFile() (and in the Sound class, for MONSTER.SOU // handling). - if (_version >= 5 && _heversion == 0 && _substResFileNameIndex && - _platform == Common::kPlatformMacintosh && + if (_game.version >= 5 && _game.heversion == 0 && _substResFileNameIndex && + _game.platform == Common::kPlatformMacintosh && substResFileNameTable[_substResFileNameIndex].genMethod == kGenAsIs) { if (_fileHandle->open(substResFileNameTable[_substResFileNameIndex].macName)) { _containerFile = substResFileNameTable[_substResFileNameIndex].macName; @@ -1645,20 +1640,20 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS } // Do some render mode restirctions - if (_version == 1) + if (_game.version == 1) _renderMode = Common::kRenderDefault; switch (_renderMode) { case Common::kRenderHercA: case Common::kRenderHercG: - if (_version > 2 && _gameId != GID_MONKEY_EGA) + if (_game.version > 2 && _game.id != GID_MONKEY_EGA) _renderMode = Common::kRenderDefault; break; case Common::kRenderCGA: case Common::kRenderEGA: case Common::kRenderAmiga: - if (!(_features & GF_16COLOR)) + if (!(_game.features & GF_16COLOR)) _renderMode = Common::kRenderDefault; break; @@ -1669,15 +1664,15 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _hexdumpScripts = false; _showStack = false; - if (_platform == Common::kPlatformFMTowns && _version == 3) { // FM-TOWNS V3 games use 320x240 + if (_game.platform == Common::kPlatformFMTowns && _game.version == 3) { // FM-TOWNS V3 games use 320x240 _screenWidth = 320; _screenHeight = 240; - } else if (_version == 8 || _heversion >= 71) { + } else if (_game.version == 8 || _game.heversion >= 71) { // COMI uses 640x480. Likewise starting from version 7.1, HE games use // 640x480, too. _screenWidth = 640; _screenHeight = 480; - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { _screenWidth = 256; _screenHeight = 240; } else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { @@ -1794,7 +1789,7 @@ ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const Scum #ifndef DISABLE_HE ScummEngine_v70he::ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex) : ScummEngine_v60he(detector, syst, gs, md5sum, substResFileNameIndex) { - if (_platform == Common::kPlatformMacintosh && (_heversion >= 72 && _heversion <= 73)) + if (_game.platform == Common::kPlatformMacintosh && (_game.heversion >= 72 && _game.heversion <= 73)) _resExtractor = new MacResExtractor(this); else _resExtractor = new Win32ResExtractor(this); @@ -1871,10 +1866,10 @@ ScummEngine_v90he::ScummEngine_v90he(GameDetector *detector, OSystem *syst, cons ScummEngine_v90he::~ScummEngine_v90he() { delete _sprite; - if (_heversion >= 98) { + if (_game.heversion >= 98) { delete _logicHE; } - if (_heversion >= 99) { + if (_game.heversion >= 99) { free(_hePalettes); } } @@ -1924,18 +1919,18 @@ int ScummEngine::init(GameDetector &detector) { _system->endGFXTransaction(); // On some systems it's not safe to run CD audio games from the CD. - if (_features & GF_AUDIOTRACKS) + if (_game.features & GF_AUDIOTRACKS) checkCD(); int cd_num = ConfMan.getInt("cdrom"); - if (cd_num >= 0 && (_features & GF_AUDIOTRACKS)) + if (cd_num >= 0 && (_game.features & GF_AUDIOTRACKS)) _system->openCD(cd_num); // Create the sound manager _sound = new Sound(this); // Setup the music engine - setupMusic(_midi); + setupMusic(_game.midi); // TODO: We shouldn't rely on the global Language values matching those COMI etc. expect. // Rather we should explicitly translate them. @@ -1948,27 +1943,27 @@ int ScummEngine::init(GameDetector &detector) { loadCJKFont(); // Create the charset renderer - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) _charset = new CharsetRendererNES(this); - else if (_version <= 2) + else if (_game.version <= 2) _charset = new CharsetRendererV2(this, _language); - else if (_version == 3) + else if (_game.version == 3) _charset = new CharsetRendererV3(this); #ifndef DISABLE_SCUMM_7_8 - else if (_version == 8) + else if (_game.version == 8) _charset = new CharsetRendererNut(this); #endif else _charset = new CharsetRendererClassic(this); // Create the costume renderer - if (_features & GF_NEW_COSTUMES) { + if (_game.features & GF_NEW_COSTUMES) { _costumeRenderer = new AkosRenderer(this); _costumeLoader = new AkosCostumeLoader(this); - } else if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + } else if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { _costumeRenderer = new C64CostumeRenderer(this); _costumeLoader = new C64CostumeLoader(this); - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { _costumeRenderer = new NESCostumeRenderer(this); _costumeLoader = new NESCostumeLoader(this); } else { @@ -1978,7 +1973,7 @@ int ScummEngine::init(GameDetector &detector) { #ifndef DISABLE_SCUMM_7_8 // Create FT INSANE object - if (_gameId == GID_FT) + if (_game.id == GID_FT) _insane = new Insane((ScummEngine_v6 *)this); else #endif @@ -1995,46 +1990,46 @@ int ScummEngine::init(GameDetector &detector) { setupOpcodes(); - if (_version == 8) + if (_game.version == 8) _numActors = 80; - else if (_version == 7) + else if (_game.version == 7) _numActors = 30; - else if (_gameId == GID_SAMNMAX) + else if (_game.id == GID_SAMNMAX) _numActors = 30; - else if (_gameId == GID_MANIAC) + else if (_game.id == GID_MANIAC) _numActors = 25; - else if (_heversion >= 80) + else if (_game.heversion >= 80) _numActors = 62; - else if (_heversion >= 72) + else if (_game.heversion >= 72) _numActors = 30; else _numActors = 13; - if (_version >= 7) + if (_game.version >= 7) OF_OWNER_ROOM = 0xFF; else OF_OWNER_ROOM = 0x0F; - // if (_gameId==GID_MONKEY2 && _bootParam == 0) + // if (_game.id==GID_MONKEY2 && _bootParam == 0) // _bootParam = 10001; - if (!_copyProtection && _gameId == GID_INDY4 && _bootParam == 0) { + if (!_copyProtection && _game.id == GID_INDY4 && _bootParam == 0) { _bootParam = -7873; } - if (!_copyProtection && _gameId == GID_SAMNMAX && _bootParam == 0) { + if (!_copyProtection && _game.id == GID_SAMNMAX && _bootParam == 0) { _bootParam = -1; } readIndexFile(); #ifdef PALMOS_68K - if (_features & GF_NEW_COSTUMES) + if (_game.features & GF_NEW_COSTUMES) res._maxHeapThreshold = gVars->memory[kMemScummNewCostGames]; else res._maxHeapThreshold = gVars->memory[kMemScummOldCostGames]; #else - if (_features & GF_NEW_COSTUMES) { + if (_game.features & GF_NEW_COSTUMES) { // Since the new costumes are very big, we increase the heap limit, to avoid having // to constantly reload stuff from the data files. res._maxHeapThreshold = 6 * 1024 * 1024; @@ -2049,7 +2044,7 @@ int ScummEngine::init(GameDetector &detector) { if (VAR_DEBUGMODE != 0xFF) { VAR(VAR_DEBUGMODE) = _debugMode; - if (_heversion >= 80 && _debugMode) + if (_game.heversion >= 80 && _debugMode) VAR(85) = 1; } @@ -2057,7 +2052,7 @@ int ScummEngine::init(GameDetector &detector) { _imuse->setBase(res.address[rtSound]); } - if (_version >= 5) + if (_game.version >= 5) _sound->setupSound(); #if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) @@ -2077,12 +2072,12 @@ void ScummEngine::scummInit() { _tempMusic = 0; debug(9, "scummInit"); - if ((_gameId == GID_MANIAC) && (_version == 1) && !(_platform == Common::kPlatformNES)) { - if (_platform == Common::kPlatformC64) + if ((_game.id == GID_MANIAC) && (_game.version == 1) && !(_game.platform == Common::kPlatformNES)) { + if (_game.platform == Common::kPlatformC64) initScreens(8, 144); else initScreens(16, 152); - } else if (_version >= 7 || _heversion >= 71) { + } else if (_game.version >= 7 || _game.heversion >= 71) { initScreens(0, _screenHeight); } else { initScreens(16, 144); @@ -2092,20 +2087,20 @@ void ScummEngine::scummInit() { for (i = 0; i < 256; i++) _roomPalette[i] = i; - if (_version == 1) { + if (_game.version == 1) { // Use 17 color table for v1 games to allow // correct color for inventory and sentence // line // Original games used some kind of dynamic // color table remapping between rooms - if (_platform == Common::kPlatformC64) { + if (_game.platform == Common::kPlatformC64) { setupC64Palette(); - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { setupNESPalette(); } else { setupV1Palette(); } - } else if (_features & GF_16COLOR) { + } else if (_game.features & GF_16COLOR) { for (i = 0; i < 16; i++) _shadowPalette[i] = i; @@ -2128,17 +2123,17 @@ void ScummEngine::scummInit() { break; default: - if ((_platform == Common::kPlatformAmiga) || (_platform == Common::kPlatformAtariST)) + if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) setupAmigaPalette(); else setupEGAPalette(); } } - if (_version > 3 && _version < 8) + if (_game.version > 3 && _game.version < 8) loadCharset(1); - if (_features & GF_OLD_BUNDLE) + if (_game.features & GF_OLD_BUNDLE) loadCharset(0); // FIXME - HACK ? setShake(0); @@ -2153,13 +2148,13 @@ void ScummEngine::scummInit() { _actors[i].initActor(1); // this is from IDB - if ((_version == 1) || (_gameId == GID_MANIAC && _demoMode)) + if ((_game.version == 1) || (_game.id == GID_MANIAC && _demoMode)) _actors[i].setActorCostume(i); } - if (_gameId == GID_MANIAC && _version == 1) { + if (_game.id == GID_MANIAC && _game.version == 1) { setupV1ActorTalkColor(); - } else if (_gameId == GID_MANIAC && _version == 2 && _demoMode) { + } else if (_game.id == GID_MANIAC && _game.version == 2 && _demoMode) { // HACK Some palette changes needed for demo script // in Maniac Mansion (Enhanced) _actors[3].setPalette(3, 1); @@ -2190,18 +2185,18 @@ void ScummEngine::scummInit() { _verbs[i].key = 0; } - if (_version == 7) { + if (_game.version == 7) { VAR(VAR_CAMERA_THRESHOLD_X) = 100; VAR(VAR_CAMERA_THRESHOLD_Y) = 70; VAR(VAR_CAMERA_ACCEL_X) = 100; VAR(VAR_CAMERA_ACCEL_Y) = 100; - } else if (!(_features & GF_NEW_CAMERA)) { - if (_platform == Common::kPlatformNES) { + } else if (!(_game.features & GF_NEW_CAMERA)) { + if (_game.platform == Common::kPlatformNES) { camera._leftTrigger = 6; // 6 camera._rightTrigger = 21; // 25 } else { camera._leftTrigger = 10; - camera._rightTrigger = (_heversion >= 71) ? 70 : 30; + camera._rightTrigger = (_game.heversion >= 71) ? 70 : 30; } camera._mode = 0; } @@ -2249,11 +2244,11 @@ void ScummEngine::scummInit() { clearDrawObjectQueue(); - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) decodeNESBaseTiles(); for (i = 0; i < 6; i++) { - if (_version == 3) { // FIXME - what is this? + if (_game.version == 3) { // FIXME - what is this? _string[i]._default.xpos = 0; _string[i]._default.ypos = 0; } else { @@ -2282,7 +2277,7 @@ void ScummEngine_c64::scummInit() { void ScummEngine_v2::scummInit() { ScummEngine::scummInit(); - if (_platform == Common::kPlatformNES) { + if (_game.platform == Common::kPlatformNES) { initNESMouseOver(); _switchRoomEffect2 = _switchRoomEffect = 6; } else { @@ -2307,7 +2302,7 @@ void ScummEngine_v60he::scummInit() { // HACK cursor hotspot is wrong // Original games used // setCursorHotspot(8, 7); - if (_gameId == GID_FUNPACK) + if (_game.id == GID_FUNPACK) setCursorHotspot(16, 16); } @@ -2329,11 +2324,11 @@ void ScummEngine_v90he::scummInit() { _sprite->resetTables(0); memset(&_wizParams, 0, sizeof(_wizParams)); - if (_features & GF_HE_CURSORLESS) + if (_game.features & GF_HE_CURSORLESS) setDefaultCursor(); - if (_heversion >= 98) { - switch (_gameId) { + if (_game.heversion >= 98) { + switch (_game.id) { case GID_PUTTRACE: _logicHE = new LogicHErace(this); break; @@ -2395,7 +2390,7 @@ void ScummEngine::setupMusic(int midi) { } // FIXME: MD_TOWNS should not be _midi_native in the first place!! iMuse code needs to be restructured. - if ((_gameId == GID_TENTACLE) || (_gameId == GID_SAMNMAX) || (midiDriver == MD_TOWNS)) + if ((_game.id == GID_TENTACLE) || (_game.id == GID_SAMNMAX) || (midiDriver == MD_TOWNS)) _enable_gs = false; else _enable_gs = ConfMan.getBool("enable_gs"); @@ -2412,28 +2407,28 @@ void ScummEngine::setupMusic(int midi) { } // Init iMuse - if (_features & GF_DIGI_IMUSE) { + if (_game.features & GF_DIGI_IMUSE) { #ifndef DISABLE_SCUMM_7_8 _musicEngine = _imuseDigital = new IMuseDigital(this, 10); #endif - } else if (_platform == Common::kPlatformC64) { + } else if (_game.platform == Common::kPlatformC64) { // TODO _musicEngine = NULL; - } else if (_platform == Common::kPlatformNES) { + } else if (_game.platform == Common::kPlatformNES) { _musicEngine = new Player_NES(this); - } else if ((_platform == Common::kPlatformAmiga) && (_version == 2)) { + } else if ((_game.platform == Common::kPlatformAmiga) && (_game.version == 2)) { _musicEngine = new Player_V2A(this); - } else if ((_platform == Common::kPlatformAmiga) && (_version == 3)) { + } else if ((_game.platform == Common::kPlatformAmiga) && (_game.version == 3)) { _musicEngine = new Player_V3A(this); - } else if ((_platform == Common::kPlatformAmiga) && (_version <= 4)) { + } else if ((_game.platform == Common::kPlatformAmiga) && (_game.version <= 4)) { _musicEngine = NULL; - } else if (_gameId == GID_MANIAC && (_version == 1)) { + } else if (_game.id == GID_MANIAC && (_game.version == 1)) { _musicEngine = new Player_V1(this, midiDriver != MD_PCSPK); - } else if (_version <= 2) { + } else if (_game.version <= 2) { _musicEngine = new Player_V2(this, midiDriver != MD_PCSPK); - } else if ((_musicType == MDT_PCSPK) && ((_version > 2) && (_version <= 4))) { + } else if ((_musicType == MDT_PCSPK) && ((_game.version > 2) && (_game.version <= 4))) { _musicEngine = new Player_V2(this, midiDriver != MD_PCSPK); - } else if (_version >= 3 && _heversion <= 61 && _platform != Common::kPlatform3DO) { + } else if (_game.version >= 3 && _game.heversion <= 61 && _game.platform != Common::kPlatform3DO) { MidiDriver *nativeMidiDriver = 0; MidiDriver *adlibMidiDriver = 0; @@ -2444,7 +2439,7 @@ void ScummEngine::setupMusic(int midi) { bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && (midi & MDT_ADLIB); if (_musicType == MDT_ADLIB || multi_midi) { adlibMidiDriver = MidiDriver_ADLIB_create(_mixer); - adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_features & GF_SMALL_HEADER) ? 1 : 0); + adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } _musicEngine = _imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver); @@ -2453,7 +2448,7 @@ void ScummEngine::setupMusic(int midi) { _imuse->property(IMuse::PROP_TEMPO_BASE, ConfMan.getInt("tempo")); _imuse->property(IMuse::PROP_NATIVE_MT32, _native_mt32); _imuse->property(IMuse::PROP_GS, _enable_gs); - if (_heversion >= 60 || midi == MDT_TOWNS) { + if (_game.heversion >= 60 || midi == MDT_TOWNS) { _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1); _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1); } @@ -2498,12 +2493,12 @@ int ScummEngine::go() { _saveLoadFlag = 0; #ifndef DISABLE_HE - if (_heversion >= 98) { + if (_game.heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->initOnce(); ((ScummEngine_v90he *)this)->_logicHE->beforeBootScript(); } #endif - if (_gameId == GID_MANIAC && _demoMode) + if (_game.id == GID_MANIAC && _demoMode) runScript(9, 0, 0, args); else runScript(1, 0, 0, args); @@ -2563,15 +2558,15 @@ int ScummEngine::scummLoop(int delta) { _rnd.getRandomNumber(2); #ifndef DISABLE_HE - if (_heversion >= 98) { + if (_game.heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->startOfFrame(); } #endif - if (_version > 2) { + if (_game.version > 2) { VAR(VAR_TMR_1) += delta; VAR(VAR_TMR_2) += delta; VAR(VAR_TMR_3) += delta; - if (_gameId == GID_ZAK || _gameId == GID_INDY3) { + if (_game.id == GID_ZAK || _game.id == GID_INDY3) { // All versions of Indy3 set three extra timers // FM-TOWNS version of Zak sets three extra timers VAR(39) += delta; @@ -2599,30 +2594,30 @@ int ScummEngine::scummLoop(int delta) { // In V1-V3 games, CHARSET_1 is called much earlier than in newer games. // See also bug #770042 for a case were this makes a difference. - if (_version <= 3) + if (_game.version <= 3) CHARSET_1(); processKbd(false); - if (_features & GF_NEW_CAMERA) { + if (_game.features & GF_NEW_CAMERA) { VAR(VAR_CAMERA_POS_X) = camera._cur.x; VAR(VAR_CAMERA_POS_Y) = camera._cur.y; - } else if (_version <= 2) { + } else if (_game.version <= 2) { VAR(VAR_CAMERA_POS_X) = camera._cur.x / 8; } else { VAR(VAR_CAMERA_POS_X) = camera._cur.x; } - if (_version <= 7) + if (_game.version <= 7) VAR(VAR_HAVE_MSG) = _haveMsg; - if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { // TODO - } else if (_version <= 2) { + } else if (_game.version <= 2) { VAR(VAR_VIRT_MOUSE_X) = _virtualMouse.x / 8; VAR(VAR_VIRT_MOUSE_Y) = _virtualMouse.y / 2; // Adjust mouse coordinates as narrow rooms in NES are centered - if (_platform == Common::kPlatformNES && _NESStartStrip > 0) { + if (_game.platform == Common::kPlatformNES && _NESStartStrip > 0) { VAR(VAR_VIRT_MOUSE_X) -= 2; if (VAR(VAR_VIRT_MOUSE_X) < 0) VAR(VAR_VIRT_MOUSE_X) = 0; @@ -2638,7 +2633,7 @@ int ScummEngine::scummLoop(int delta) { } } - if (_features & GF_AUDIOTRACKS) { + if (_game.features & GF_AUDIOTRACKS) { // Covered automatically by the Sound class } else if (VAR_MUSIC_TIMER != 0xFF) { if (_musicEngine) { @@ -2682,7 +2677,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 && _saveTemporaryState && !(_features & GF_SMALL_HEADER) && _version < 8) + if (success && _saveTemporaryState && !(_game.features & GF_SMALL_HEADER) && _game.version < 8) VAR(VAR_GAME_LOADED) = 201; } else { success = loadState(_saveLoadSlot, _saveTemporaryState); @@ -2691,7 +2686,7 @@ load_game: // Ender: Disabled for small_header games, as can overwrite game // variables (eg, Zak256 cashcard values). - if (success && _saveTemporaryState && !(_features & GF_SMALL_HEADER)) + if (success && _saveTemporaryState && !(_game.features & GF_SMALL_HEADER)) VAR(VAR_GAME_LOADED) = 203; } @@ -2718,23 +2713,23 @@ load_game: _charset->_hasMask = false; // HACK as in game save stuff isn't supported currently - if (_gameId == GID_LOOM) { + if (_game.id == GID_LOOM) { int args[16]; uint value; memset(args, 0, sizeof(args)); args[0] = 2; - if (_platform == Common::kPlatformMacintosh) + if (_game.platform == Common::kPlatformMacintosh) value = 105; - else if (_version == 4) // 256 color CD version + else if (_game.version == 4) // 256 color CD version value = 150; else value = 100; - byte restoreScript = (_platform == Common::kPlatformFMTowns) ? 17 : 18; + byte restoreScript = (_game.platform == Common::kPlatformFMTowns) ? 17 : 18; // if verbs should be shown restore them if (VAR(value) == 2) runScript(restoreScript, 0, 0, args); - } else if (_version > 3) { + } else if (_game.version > 3) { for (int i = 0; i < _numVerbs; i++) drawVerb(i, 0); } else { @@ -2747,7 +2742,7 @@ load_game: _fullRedraw = true; } - if (_heversion >= 80) { + if (_game.heversion >= 80) { _sound->processSoundCode(); } runAllScripts(); @@ -2766,32 +2761,32 @@ load_game: } if (_currentRoom == 0) { - if (_version > 3) + if (_game.version > 3) CHARSET_1(); drawDirtyScreenParts(); } else { walkActors(); moveCamera(); updateObjectStates(); - if (_version > 3) + if (_game.version > 3) CHARSET_1(); if (camera._cur.x != camera._last.x || _bgNeedsRedraw || _fullRedraw - || ((_features & GF_NEW_CAMERA) && camera._cur.y != camera._last.y)) { + || ((_game.features & GF_NEW_CAMERA) && camera._cur.y != camera._last.y)) { redrawBGAreas(); } processDrawQue(); - if (_heversion >= 99) + if (_game.heversion >= 99) _fullRedraw = false; // Full Throttle always redraws verbs and draws verbs before actors - if (_version >= 7) + if (_game.version >= 7) redrawVerbs(); #ifndef DISABLE_HE - if (_heversion >= 90) { + if (_game.heversion >= 90) { ((ScummEngine_v90he *)this)->_sprite->resetBackground(); ((ScummEngine_v90he *)this)->_sprite->sortActiveSprites(); } @@ -2811,7 +2806,7 @@ load_game: _fullRedraw = false; - if (_version >= 4 && _heversion <= 61) + if (_game.version >= 4 && _game.heversion <= 61) cyclePalette(); palManipulate(); if (_doEffect) { @@ -2830,7 +2825,7 @@ load_game: // Render everything to the screen. drawDirtyScreenParts(); - if (_version <= 5) + if (_game.version <= 5) playActorSounds(); } @@ -2839,7 +2834,7 @@ load_game: #ifndef DISABLE_SCUMM_7_8 if (_imuseDigital) { _imuseDigital->flushTracks(); - if ( ((_gameId == GID_DIG) && (!(_features & GF_DEMO))) || (_gameId == GID_CMI) ) + if ( ((_game.id == GID_DIG) && (!(_game.features & GF_DEMO))) || (_game.id == GID_CMI) ) _imuseDigital->refreshScripts(); } #endif @@ -2856,10 +2851,10 @@ load_game: _system->showMouse(_cursor.state > 0); #ifndef DISABLE_HE - if (_heversion >= 90) { + if (_game.heversion >= 90) { ((ScummEngine_v90he *)this)->_sprite->updateImages(); } - if (_heversion >= 98) { + if (_game.heversion >= 98) { ((ScummEngine_v90he *)this)->_logicHE->endOfFrame(); } #endif @@ -2935,14 +2930,14 @@ void ScummEngine::restart() { } // Reinit sound engine - if (_version >= 5) + if (_game.version >= 5) _sound->setupSound(); // Re-run bootscript int args[16]; memset(args, 0, sizeof(args)); args[0] = _bootParam; - if (_gameId == GID_MANIAC && _demoMode) + if (_game.id == GID_MANIAC && _demoMode) runScript(9, 0, 0, args); else runScript(1, 0, 0, args); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index d08a66022c..9dd0135d1a 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -415,11 +415,7 @@ public: ScummDebugger *_debugger; // Core variables - byte _gameId; - byte _version; - uint8 _heversion; - uint32 _features; // Should only be accessed for reading (TODO enforce it compiler-wise with making it private and creating an accessor) - Common::Platform _platform; + ScummGameSettings _game; uint8 _gameMD5[16]; /** Random number generator */ @@ -1143,7 +1139,6 @@ protected: int _saveSound; bool _native_mt32; bool _enable_gs; - int _midi; MidiDriverFlags _musicType; bool _copyProtection; bool _demoMode; diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp index 96d9e2f7c5..59caaeea61 100644 --- a/engines/scumm/smush/smush_font.cpp +++ b/engines/scumm/smush/smush_font.cpp @@ -125,7 +125,7 @@ int SmushFont::draw2byte(byte *buffer, int dst_width, int x, int y, int idx) { int h = _vm->_2byteHeight; byte *src = _vm->get2byteCharPtr(idx); - byte *dst = buffer + dst_width * (y + (_vm->_gameId == GID_CMI ? 7 : (_vm->_gameId == GID_DIG ? 2 : 0))) + x; + byte *dst = buffer + dst_width * (y + (_vm->_game.id == GID_CMI ? 7 : (_vm->_game.id == GID_DIG ? 2 : 0))) + x; byte bits = 0; char color = (_color != -1) ? _color : 1; @@ -133,7 +133,7 @@ int SmushFont::draw2byte(byte *buffer, int dst_width, int x, int y, int idx) { if (_new_colors) color = (char)0xff; - if (_vm->_gameId == GID_FT) + if (_vm->_game.id == GID_FT) color = 1; for (int j = 0; j < h; j++) { diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 926e7f9f87..89fe8998d7 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -434,7 +434,7 @@ void SmushPlayer::handleIACT(Chunk &b) { int32 size = b.getDword(); int32 bsize = b.getSize() - 18; - if (_vm->_gameId != GID_CMI) { + if (_vm->_game.id != GID_CMI) { int32 track = track_id; if (track_flags == 1) { track = track_id + 100; @@ -568,7 +568,7 @@ void SmushPlayer::handleTextResource(Chunk &b) { } byte transBuf[512]; - if (_vm->_gameId == GID_CMI) { + if (_vm->_game.id == GID_CMI) { _vm->translateText((const byte *)str - 1, transBuf); while (*str++ != '/') ; @@ -646,7 +646,7 @@ void SmushPlayer::handleTextResource(Chunk &b) { assert(sf != NULL); sf->setColor(color); - if (_vm->_gameId == GID_CMI && string2[0] != 0) { + if (_vm->_game.id == GID_CMI && string2[0] != 0) { str = string2; } @@ -1034,13 +1034,13 @@ void SmushPlayer::setupAnim(const char *file) { char file_font[11]; if (_insanity) { - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) readString("mineroad.trs"); } else readString(file); - if (_vm->_gameId == GID_FT) { - if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC))) { + if (_vm->_game.id == GID_FT) { + if (!((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC))) { _sf[0] = new SmushFont(_vm, true, false); _sf[1] = new SmushFont(_vm, true, false); _sf[2] = new SmushFont(_vm, true, false); @@ -1050,17 +1050,17 @@ void SmushPlayer::setupAnim(const char *file) { _sf[2]->loadFont("titlfnt.nut"); _sf[3]->loadFont("specfnt.nut"); } - } else if (_vm->_gameId == GID_DIG) { - if (!(_vm->_features & GF_DEMO)) { + } else if (_vm->_game.id == GID_DIG) { + if (!(_vm->_game.features & GF_DEMO)) { for (i = 0; i < 4; i++) { sprintf(file_font, "font%d.nut", i); _sf[i] = new SmushFont(_vm, i != 0, false); _sf[i]->loadFont(file_font); } } - } else if (_vm->_gameId == GID_CMI) { + } else if (_vm->_game.id == GID_CMI) { for (i = 0; i < 5; i++) { - if ((_vm->_features & GF_DEMO) && (i == 4)) + if ((_vm->_game.features & GF_DEMO) && (i == 4)) break; sprintf(file_font, "font%d.nut", i); _sf[i] = new SmushFont(_vm, false, true); diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 128c77bece..78ed585f72 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -112,7 +112,7 @@ void Sound::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlags) } void Sound::addSoundToQueue2(int sound, int heOffset, int heChannel, int heFlags) { - if (_vm->_heversion >= 60 && _soundQue2Pos) { + if (_vm->_game.heversion >= 60 && _soundQue2Pos) { int i = _soundQue2Pos; while (i--) { if (_soundQue2[i].sound == sound && !(heFlags & 2)) @@ -129,13 +129,13 @@ void Sound::addSoundToQueue2(int sound, int heOffset, int heChannel, int heFlags } void Sound::processSound() { - if (_vm->_heversion >= 60) { + if (_vm->_game.heversion >= 60) { processSoundQueues(); processSfxQueues(); } else { processSfxQueues(); - if (_vm->_features & GF_DIGI_IMUSE) + if (_vm->_game.features & GF_DIGI_IMUSE) return; processSoundQueues(); @@ -147,14 +147,14 @@ void Sound::processSoundQueues() { int snd, heOffset, heChannel, heFlags; int data[16]; - if (_vm->_heversion >= 72) { + if (_vm->_game.heversion >= 72) { for (i = 0; i <_soundQue2Pos; i++) { snd = _soundQue2[i].sound; heOffset = _soundQue2[i].offset; heChannel = _soundQue2[i].channel; heFlags = _soundQue2[i].flags; if (snd) { - if (_vm->_heversion>= 60) + if (_vm->_game.heversion>= 60) playHESound(snd, heOffset, heChannel, heFlags); else playSound(snd); @@ -169,7 +169,7 @@ void Sound::processSoundQueues() { heChannel = _soundQue2[_soundQue2Pos].channel; heFlags = _soundQue2[_soundQue2Pos].flags; if (snd) { - if (_vm->_heversion>= 60) + if (_vm->_game.heversion>= 60) playHESound(snd, heOffset, heChannel, heFlags); else playSound(snd); @@ -302,7 +302,7 @@ void Sound::playSound(int soundID) { // I'll add some code to test that theory for now. // Check if the resource has already been demangled - if ((_vm->_platform == Common::kPlatformSegaCD) && (ptr[0] != 1)) { + if ((_vm->_game.platform == Common::kPlatformSegaCD) && (ptr[0] != 1)) { for (int i = 0; i < size; i++) { ptr[i] ^= 0x16; if (ptr[i] >= 0x7F) { @@ -327,10 +327,10 @@ void Sound::playSound(int soundID) { memcpy(sound, ptr + 6, size); _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } - else if ((_vm->_platform == Common::kPlatformFMTowns && _vm->_version == 3) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { + else if ((_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 3) || READ_UINT32(ptr) == MKID('SOUN') || READ_UINT32(ptr) == MKID('TOWS')) { bool tows = READ_UINT32(ptr) == MKID('TOWS'); - if (_vm->_version == 3) { + if (_vm->_game.version == 3) { size = READ_LE_UINT32(ptr); } else { size = READ_BE_UINT32(ptr + 4) - 2; @@ -410,7 +410,7 @@ void Sound::playSound(int soundID) { break; } } - else if ((_vm->_gameId == GID_LOOM) && (_vm->_platform == Common::kPlatformMacintosh)) { + else if ((_vm->_game.id == GID_LOOM) && (_vm->_game.platform == Common::kPlatformMacintosh)) { // Mac version of Loom uses yet another sound format /* playSound #9 (room 70) @@ -433,7 +433,7 @@ void Sound::playSound(int soundID) { 000070: 01 18 5a 00 10 00 02 28 5f 00 01 00 00 00 00 00 |..Z....(_.......| */ } - else if ((_vm->_platform == Common::kPlatformMacintosh) && (_vm->_gameId == GID_INDY3) && (ptr[26] == 0)) { + else if ((_vm->_game.platform == Common::kPlatformMacintosh) && (_vm->_game.id == GID_INDY3) && (ptr[26] == 0)) { size = READ_BE_UINT16(ptr + 12); rate = 3579545 / READ_BE_UINT16(ptr + 20); sound = (char *)malloc(size); @@ -443,10 +443,10 @@ void Sound::playSound(int soundID) { } else { - if (_vm->_gameId == GID_MONKEY_VGA || _vm->_gameId == GID_MONKEY_EGA - || (_vm->_gameId == GID_MONKEY && _vm->_platform == Common::kPlatformMacintosh)) { + if (_vm->_game.id == GID_MONKEY_VGA || _vm->_game.id == GID_MONKEY_EGA + || (_vm->_game.id == GID_MONKEY && _vm->_game.platform == Common::kPlatformMacintosh)) { // Sound is currently not supported at all in the amiga versions of these games - if (_vm->_platform == Common::kPlatformAmiga) { + if (_vm->_game.platform == Common::kPlatformAmiga) { int track = -1; if (soundID == 50) track = 17; @@ -500,13 +500,13 @@ void Sound::processSfxQueues() { if (_vm->_imuseDigital) { finished = !isSoundRunning(kTalkSoundID); - } else if (_vm->_heversion >= 60) { + } else if (_vm->_game.heversion >= 60) { finished = !isSoundRunning(1); } else { finished = !_vm->_mixer->isSoundHandleActive(_talkChannelHandle); } - if ((uint) act < 0x80 && ((_vm->_version == 8) || (_vm->_version <= 7 && !_vm->_string[0].no_talk_anim))) { + if ((uint) act < 0x80 && ((_vm->_game.version == 8) || (_vm->_game.version <= 7 && !_vm->_string[0].no_talk_anim))) { a = _vm->derefActor(act, "processSfxQueues"); if (a->isInCurrentRoom()) { if (isMouthSyncOff(_curSoundPos) && !_mouthSyncMode) { @@ -518,13 +518,13 @@ void Sound::processSfxQueues() { _mouthSyncMode = 1; } - if (_vm->_version <= 6 && finished) + if (_vm->_game.version <= 6 && finished) a->runActorTalkScript(a->_talkStopFrame); } } - if ((!ConfMan.getBool("subtitles") && finished && _vm->_version <= 6) || (finished && _vm->_talkDelay == 0)) { - if (!(_vm->_version == 8 && _vm->VAR(_vm->VAR_HAVE_MSG) == 0)) + if ((!ConfMan.getBool("subtitles") && finished && _vm->_game.version <= 6) || (finished && _vm->_talkDelay == 0)) { + if (!(_vm->_game.version == 8 && _vm->VAR(_vm->VAR_HAVE_MSG) == 0)) _vm->stopTalk(); } } @@ -545,12 +545,12 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle int size = 0; int id = -1; - if (_vm->_gameId == GID_CMI) { + if (_vm->_game.id == GID_CMI) { _sfxMode |= mode; return; - } else if (_vm->_gameId == GID_DIG) { + } else if (_vm->_game.id == GID_DIG) { _sfxMode |= mode; - if (!(_vm->_features & GF_DEMO)) + if (!(_vm->_game.features & GF_DEMO)) return; char filename[30]; @@ -599,7 +599,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle // automatically stop any other that may be playing at that time. So // that is what we do here, but we make an exception for speech. - if (mode == 1 && (_vm->_gameId == GID_TENTACLE || _vm->_gameId == GID_SAMNMAX)) { + if (mode == 1 && (_vm->_game.id == GID_TENTACLE || _vm->_game.id == GID_SAMNMAX)) { id = 777777 + _talk_sound_channel; _vm->_mixer->stopID(id); } @@ -691,7 +691,7 @@ void Sound::stopTalkSound() { #ifndef DISABLE_SCUMM_7_8 _vm->_imuseDigital->stopSound(kTalkSoundID); #endif - } else if (_vm->_heversion >= 60) { + } else if (_vm->_game.heversion >= 60) { stopSound(1); } else { _vm->_mixer->stopHandle(_talkChannelHandle); @@ -726,11 +726,11 @@ int Sound::isSoundRunning(int sound) const { if (sound == _currentCDSound) return pollCD(); - if (_vm->_heversion >= 70) { + if (_vm->_game.heversion >= 70) { if (sound >= 10000) { return _vm->_mixer->getSoundID(_heSoundChannels[sound - 10000]); } - } else if (_vm->_heversion >= 60) { + } else if (_vm->_game.heversion >= 60) { if (sound == -2) { sound = _heChannel[0].sound; } else if (sound == -1) { @@ -814,11 +814,11 @@ bool Sound::isSoundInQueue(int sound) const { void Sound::stopSound(int sound) { int i; - if (_vm->_heversion >= 70) { + if (_vm->_game.heversion >= 70) { if ( sound >= 10000) { stopSoundChannel(sound - 10000); } - } else if (_vm->_heversion >= 60) { + } else if (_vm->_game.heversion >= 60) { if (sound == -2) { sound = _heChannel[0].sound; } else if (sound == -1) { @@ -832,7 +832,7 @@ void Sound::stopSound(int sound) { stopCDTimer(); } - if (!(_vm->_features & GF_DIGI_IMUSE)) + if (!(_vm->_game.features & GF_DIGI_IMUSE)) _vm->_mixer->stopID(sound); if (_vm->_musicEngine) @@ -910,7 +910,7 @@ void Sound::soundKludge(int *list, int num) { } void Sound::talkSound(uint32 a, uint32 b, int mode, int channel) { - if (_vm->_version >= 6 && ConfMan.getBool("speech_mute")) + if (_vm->_game.version >= 6 && ConfMan.getBool("speech_mute")) return; if (mode == 1) { @@ -937,11 +937,11 @@ void Sound::setupSound() { _sfxFile = openSfxFile(); - if (_vm->_heversion >= 70) { + if (_vm->_game.heversion >= 70) { setupHEMusicFile(); } - if (_vm->_gameId == GID_FT) { + if (_vm->_game.id == GID_FT) { _vm->VAR(_vm->VAR_VOICE_BUNDLE_LOADED) = _sfxFile->isOpen(); } } @@ -966,7 +966,7 @@ void Sound::pauseSounds(bool pause) { _vm->_mixer->pauseAll(pause); - if ((_vm->_features & GF_AUDIOTRACKS) && _vm->VAR(_vm->VAR_MUSIC_TIMER) > 0) { + if ((_vm->_game.features & GF_AUDIOTRACKS) && _vm->VAR(_vm->VAR_MUSIC_TIMER) > 0) { if (pause) stopCDTimer(); else @@ -1026,7 +1026,7 @@ ScummFile *Sound::openSfxFile() { } if (!file->isOpen()) { - if ((_vm->_heversion <= 61 && _vm->_platform == Common::kPlatformMacintosh) || (_vm->_heversion >= 70)) { + if ((_vm->_game.heversion <= 61 && _vm->_game.platform == Common::kPlatformMacintosh) || (_vm->_game.heversion >= 70)) { sprintf(buf, "%s.he2", _vm->getBaseName()); } else { sprintf(buf, "%s.tlk", _vm->getBaseName()); @@ -1036,7 +1036,7 @@ ScummFile *Sound::openSfxFile() { _vm->generateSubstResFileName(buf, buf1, sizeof(buf1)); strcpy(buf, buf1); } - if (file->open(buf) && _vm->_heversion <= 73) + if (file->open(buf) && _vm->_game.heversion <= 73) file->setEnc(0x69); _soundMode = kVOCMode; } @@ -1102,7 +1102,7 @@ void Sound::startCDTimer() { // when Chaos first appears, and I have to use 101 for Monkey 1 or the // intro music will be cut short. - if (_vm->_gameId == GID_LOOM && _vm->_version == 4) + if (_vm->_game.id == GID_LOOM && _vm->_game.version == 4) timer_interval = 100; else timer_interval = 101; @@ -1754,10 +1754,10 @@ void ScummEngine::convertADResource(int type, int idx, byte *src_ptr, int size) // Convert the ticks into a MIDI tempo. // Unfortunate LOOM and INDY3 have different interpretation // of the ticks value. - if (_gameId == GID_INDY3) { + if (_game.id == GID_INDY3) { // Note: since we fix ppqn at 480, ppqn/473 is almost 1 dw = 500000 * 256 / 473 * ppqn / ticks; - } else if (_gameId == GID_LOOM && _version == 3) { + } else if (_game.id == GID_LOOM && _game.version == 3) { dw = 500000 * ppqn / 4 / ticks; } else { dw = 500000 * 256 / ticks; @@ -2099,7 +2099,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { debug(4, "readSoundResourceSmallHeader(%d)", idx); - if ((_gameId == GID_LOOM) && (_version == 3) && (_platform == Common::kPlatformPC) && VAR(VAR_SOUNDCARD) == 4) { + if ((_game.id == GID_LOOM) && (_game.version == 3) && (_game.platform == Common::kPlatformPC) && VAR(VAR_SOUNDCARD) == 4) { // Roland resources in Loom are tagless // So we add an RO tag to allow imuse to detect format byte *ptr, *src_ptr; @@ -2114,12 +2114,12 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { memcpy(ptr, "RO", 2); ptr += 2; memcpy(ptr, src_ptr, ro_size - 4); ptr += ro_size - 4; return 1; - } else if (_features & GF_OLD_BUNDLE) { + } else if (_game.features & GF_OLD_BUNDLE) { wa_offs = _fileHandle->pos(); wa_size = _fileHandle->readUint16LE(); _fileHandle->seek(wa_size - 2, SEEK_CUR); - if (!(_platform == Common::kPlatformAtariST || _platform == Common::kPlatformMacintosh)) { + if (!(_game.platform == Common::kPlatformAtariST || _game.platform == Common::kPlatformMacintosh)) { ad_offs = _fileHandle->pos(); ad_size = _fileHandle->readUint16LE(); } @@ -2173,7 +2173,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { // 7 bytes MIDI tempo sysex // + some default instruments byte *ptr; - if (_features & GF_OLD_BUNDLE) { + if (_game.features & GF_OLD_BUNDLE) { ad_size -= 4; _fileHandle->seek(ad_offs + 4, SEEK_SET); } else { @@ -2186,7 +2186,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) { free(ptr); return 1; } else if ((_musicType == MDT_PCSPK) && wa_offs != 0) { - if (_features & GF_OLD_BUNDLE) { + if (_game.features & GF_OLD_BUNDLE) { _fileHandle->seek(wa_offs, SEEK_SET); _fileHandle->read(res.createResource(type, idx, wa_size), wa_size); } else { diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index be530f8c81..bc668a43dd 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -69,7 +69,7 @@ void ScummEngine::debugMessage(const byte *msg) { byte buffer[500]; convertMessageToString(msg, buffer, sizeof(buffer)); -// if ((_gameId == GID_CMI) && _debugMode) { // In CMI, debugMessage is used for printDebug output +// if ((_game.id == GID_CMI) && _debugMode) { // In CMI, debugMessage is used for printDebug output if ((buffer[0] != 0xFF) && _debugMode) { debug(0, "DEBUG: %s", buffer); return; @@ -84,7 +84,7 @@ void ScummEngine::debugMessage(const byte *msg) { // Sam and Max uses a caching system, printing empty messages // and setting VAR_V6_SOUNDMODE beforehand. See patch 609791. - if (_gameId == GID_SAMNMAX) + if (_game.id == GID_SAMNMAX) channel = VAR(VAR_V6_SOUNDMODE); if (channel != 2) @@ -250,7 +250,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { byte *buffer = _charsetBuffer + _charsetBufPos; while (!endLoop) { c = *buffer++; - if (!(c == 0xFF || (_version <= 6 && c == 0xFE))) { + if (!(c == 0xFF || (_game.version <= 6 && c == 0xFE))) { break; } c = *buffer++; @@ -265,7 +265,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { endLoop = true; break; case 3: - _haveMsg = (_version >= 7) ? 1 : 0xFF; + _haveMsg = (_game.version >= 7) ? 1 : 0xFF; _keepText = false; endLoop = true; break; @@ -287,7 +287,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24); buffer += 14; - if (_heversion >= 60) { + if (_game.heversion >= 60) { _sound->startHETalkSound(talk_sound_a); } else { _sound->talkSound(talk_sound_a, talk_sound_b, 2); @@ -324,7 +324,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) { #ifndef DISABLE_HE bool ScummEngine_v72he::handleNextCharsetCode(Actor *a, int *code) { - const int charsetCode = (_heversion >= 80) ? 127 : 64; + const int charsetCode = (_game.heversion >= 80) ? 127 : 64; uint32 talk_sound_a = 0; uint32 talk_sound_b = 0; int i, c = 0; @@ -406,7 +406,7 @@ void ScummEngine::CHARSET_1() { byte *subtitleLine = subtitleBuffer; Common::Point subtitlePos; - if (_version >= 7) { + if (_game.version >= 7) { ((ScummEngine_v7 *)this)->processSubtitleQueue(); } #endif @@ -414,7 +414,7 @@ void ScummEngine::CHARSET_1() { if (!_haveMsg) return; - if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK && (_platform == Common::kPlatformFMTowns) && getTalkingActor() == 0xFF)) { + if (!(_game.features & GF_NEW_CAMERA) && !(_game.id == GID_ZAK && (_game.platform == Common::kPlatformFMTowns) && getTalkingActor() == 0xFF)) { if ((camera._dest.x / 8) != (camera._cur.x / 8) || camera._cur.x != camera._last.x) return; } @@ -429,7 +429,7 @@ void ScummEngine::CHARSET_1() { _string[0].xpos = a->_pos.x - virtscr[0].xstart; _string[0].ypos = a->_pos.y - a->getElevation() - _screenTop; - if (_version <= 5) { + if (_game.version <= 5) { if (VAR(VAR_V5_TALK_STRING_Y) < 0) { s = (a->_scaley * (int)VAR(VAR_V5_TALK_STRING_Y)) / 0xFF; @@ -469,13 +469,13 @@ void ScummEngine::CHARSET_1() { else _charset->setCurID(_string[0].charset); - if (_version >= 5) + if (_game.version >= 5) memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4); if (_talkDelay) return; - if ((_version <= 6 && _haveMsg == 1) || (_version == 7 && _haveMsg != 1) || (_version == 8 && VAR(VAR_HAVE_MSG))) { + if ((_game.version <= 6 && _haveMsg == 1) || (_game.version == 7 && _haveMsg != 1) || (_game.version == 8 && VAR(VAR_HAVE_MSG))) { if ((_sound->_sfxMode & 2) == 0) stopTalk(); return; @@ -489,7 +489,7 @@ void ScummEngine::CHARSET_1() { _talkDelay = (VAR_DEFAULT_TALK_DELAY != 0xFF) ? VAR(VAR_DEFAULT_TALK_DELAY) : 60; if (!_keepText) { - if (_version >= 7) { + if (_game.version >= 7) { #ifndef DISABLE_SCUMM_7_8 ((ScummEngine_v7 *)this)->clearSubtitleQueue(); _charset->_nextLeft = _string[0].xpos; @@ -507,7 +507,7 @@ void ScummEngine::CHARSET_1() { t *= 2; } - if (_version > 3) + if (_game.version > 3) _charset->addLinebreaks(0, _charsetBuffer + _charsetBufPos, 0, t); if (_charset->_center) { @@ -521,7 +521,7 @@ void ScummEngine::CHARSET_1() { while (handleNextCharsetCode(a, &c)) { if (c == 0) { // End of text reached, set _haveMsg accordingly - _haveMsg = (_version >= 7) ? 2 : 1; + _haveMsg = (_game.version >= 7) ? 2 : 1; _keepText = false; break; } @@ -530,7 +530,7 @@ void ScummEngine::CHARSET_1() { newLine:; _charset->_nextLeft = _string[0].xpos; #ifndef DISABLE_SCUMM_7_8 - if (_version >= 7 && subtitleLine != subtitleBuffer) { + if (_game.version >= 7 && subtitleLine != subtitleBuffer) { ((ScummEngine_v7 *)this)->addSubtitleToQueue(subtitleBuffer, subtitlePos, _charsetColor, _charset->getCurID()); subtitleLine = subtitleBuffer; } @@ -539,14 +539,14 @@ void ScummEngine::CHARSET_1() { _charset->_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2; } - if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { break; - } else if (!(_platform == Common::kPlatformFMTowns) && _string[0].height) { + } else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) { _charset->_nextTop += _string[0].height; } else { _charset->_nextTop += _charset->getFontHeight(); } - if (_version > 3) { + if (_game.version > 3) { // FIXME - is this really needed? _charset->_disableOffsX = true; } @@ -556,7 +556,7 @@ void ScummEngine::CHARSET_1() { _charset->_left = _charset->_nextLeft; _charset->_top = _charset->_nextTop; - if (_version >= 7) { + if (_game.version >= 7) { #ifndef DISABLE_SCUMM_7_8 if (subtitleLine == subtitleBuffer) { subtitlePos.x = _charset->_left; @@ -575,14 +575,14 @@ void ScummEngine::CHARSET_1() { _charsetBufPos = buffer - _charsetBuffer; } } - if (_version <= 3) { + if (_game.version <= 3) { _charset->printChar(c, false); } else { - if (_features & GF_HE_NOSUBTITLES) { + if (_game.features & GF_HE_NOSUBTITLES) { // HE games which use sprites for subtitles - } else if (_heversion >= 60 && !ConfMan.getBool("subtitles") && _sound->isSoundRunning(1)) { + } else if (_game.heversion >= 60 && !ConfMan.getBool("subtitles") && _sound->isSoundRunning(1)) { // Special case for HE games - } else if (_gameId == GID_LOOM && !ConfMan.getBool("subtitles") && (_sound->pollCD())) { + } else if (_game.id == GID_LOOM && !ConfMan.getBool("subtitles") && (_sound->pollCD())) { // Special case for Loom (CD), since it only uses CD audio.for sound } else if (!ConfMan.getBool("subtitles") && (!_haveActorSpeechMsg || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) { // Subtitles are turned off, and there is a voice version @@ -595,24 +595,24 @@ void ScummEngine::CHARSET_1() { _charset->_nextTop = _charset->_top; } - if (_version <= 2) { + if (_game.version <= 2) { _talkDelay += _defaultTalkDelay; VAR(VAR_CHARCOUNT)++; } else { _talkDelay += (int)VAR(VAR_CHARINC); } // Handle line overflow for V3 - if (_version == 3 && _charset->_nextLeft > _screenWidth) { + if (_game.version == 3 && _charset->_nextLeft > _screenWidth) { _charset->_nextLeft = _screenWidth; } // Handle line breaks for V1-V2 - if (_version <= 2 && _charset->_nextLeft > _screenWidth) { + if (_game.version <= 2 && _charset->_nextLeft > _screenWidth) { goto newLine; } } #ifndef DISABLE_SCUMM_7_8 - if (_version >= 7 && subtitleLine != subtitleBuffer) { + if (_game.version >= 7 && subtitleLine != subtitleBuffer) { ((ScummEngine_v7 *)this)->addSubtitleToQueue(subtitleBuffer, subtitlePos, _charsetColor, _charset->getCurID()); } #endif @@ -624,13 +624,13 @@ void ScummEngine::drawString(int a, const byte *msg) { int i, c; byte fontHeight = 0; uint color; - int code = (_heversion >= 80) ? 127 : 64; + int code = (_game.heversion >= 80) ? 127 : 64; bool cmi_pos_hack = false; convertMessageToString(msg, buf, sizeof(buf)); - if (_version >= 7) { + if (_game.version >= 7) { // I recently disabled charset mask related code for V7+ games, thinking // that it should never be needed there. Well, I missed on case: In this // method, it could potentially still be used. Now the question is: @@ -657,7 +657,7 @@ void ScummEngine::drawString(int a, const byte *msg) { _charset->_disableOffsX = _charset->_firstChar = true; _charset->setCurID(_string[a].charset); - if (_version >= 5) + if (_game.version >= 5) memcpy(_charsetColorMap, _charsetData[_charset->getCurID()], 4); fontHeight = _charset->getFontHeight(); @@ -680,7 +680,7 @@ void ScummEngine::drawString(int a, const byte *msg) { _charset->_left -= _charset->getStringWidth(a, buf) / 2; } - const bool ignoreCharsetMask = (_version < 7); + const bool ignoreCharsetMask = (_game.version < 7); if (!buf[0]) { buf[0] = ' '; @@ -688,7 +688,7 @@ void ScummEngine::drawString(int a, const byte *msg) { } for (i = 0; (c = buf[i++]) != 0;) { - if (_heversion >= 72 && c == code) { + if (_game.heversion >= 72 && c == code) { c = buf[i++]; switch (c) { case 110: @@ -700,7 +700,7 @@ void ScummEngine::drawString(int a, const byte *msg) { _charset->_top += fontHeight; break; } - } else if (c == 0xFF || (_version <= 6 && c == 0xFE)) { + } else if (c == 0xFF || (_game.version <= 6 && c == 0xFE)) { c = buf[i++]; switch (c) { case 9: @@ -716,7 +716,7 @@ void ScummEngine::drawString(int a, const byte *msg) { } else { _charset->_left = _charset->_startLeft; } - if (!(_platform == Common::kPlatformFMTowns) && _string[0].height) { + if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) { _charset->_nextTop += _string[0].height; } else { _charset->_top += fontHeight; @@ -732,7 +732,7 @@ void ScummEngine::drawString(int a, const byte *msg) { break; } } else { - if (a == 1 && _version >= 6) { + if (a == 1 && _game.version >= 6) { // FIXME: The following code is a bit nasty. It is used for the // Highway surfing game in Sam&Max; there, _blitAlso is set to // true when writing the highscore numbers. It is also in DOTT @@ -753,7 +753,7 @@ void ScummEngine::drawString(int a, const byte *msg) { c = 0x20; //not in S-JIS } else { c += buf[i++] * 256; - if (_gameId == GID_CMI) { + if (_game.id == GID_CMI) { cmi_pos_hack = true; _charset->_top += 6; } @@ -793,7 +793,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) return 0; } - if (_version >= 7) { + if (_game.version >= 7) { translateText(msg, transBuf); src = transBuf; } else { @@ -804,11 +804,11 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) while (1) { chr = src[num++]; - if (_heversion >= 80 && (src[num - 1] == '(' && src[num] == 'P' && src[num + 1] == 'U')) { + if (_game.heversion >= 80 && (src[num - 1] == '(' && src[num] == 'P' && src[num + 1] == 'U')) { while (src[num++] != ')'); continue; } - if ((_features & GF_HE_LOCALIZED) && chr == '[') { + if ((_game.features & GF_HE_LOCALIZED) && chr == '[') { while (src[num++] != ']'); continue; } @@ -821,7 +821,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) // WORKAROUND for bug #985948, a script bug in Indy3. Apparently, // a german 'sz' was encoded incorrectly as 0xFF2E. We replace // this by the correct encoding here. See also ScummEngine::resStrLen(). - if (_gameId == GID_INDY3 && chr == 0x2E) { + if (_game.id == GID_INDY3 && chr == 0x2E) { *dst++ = 0xE1; continue; } @@ -831,7 +831,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) *dst++ = 0xFF; *dst++ = chr; } else { - val = (_version == 8) ? READ_LE_UINT32(src + num) : READ_LE_UINT16(src + num); + val = (_game.version == 8) ? READ_LE_UINT32(src + num) : READ_LE_UINT16(src + num); switch (chr) { case 4: dst += convertIntMessage(dst, end - dst, val); @@ -855,7 +855,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) *dst++ = chr; *dst++ = src[num+0]; *dst++ = src[num+1]; - if (_version == 8) { + if (_game.version == 8) { *dst++ = src[num+2]; *dst++ = src[num+3]; } @@ -863,10 +863,10 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) default: error("convertMessageToString(): string escape sequence %d unknown", chr); } - num += (_version == 8) ? 4 : 2; + num += (_game.version == 8) ? 4 : 2; } } else { - if (!(chr == '@' && _heversion <= 71)) { + if (!(chr == '@' && _game.heversion <= 71)) { *dst++ = chr; } } @@ -918,7 +918,7 @@ int ScummEngine::convertNameMessage(byte *dst, int dstSize, int var) { int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) { const byte *ptr; - if (_version <= 2) { + if (_game.version <= 2) { byte chr; int i = 0; while ((chr = (byte)_scummVars[var++])) { @@ -931,7 +931,7 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) { return i; } - if (_version == 3 || (_version >= 6 && _heversion < 72)) + if (_game.version == 3 || (_game.version >= 6 && _game.heversion < 72)) var = readVar(var); if (var) { @@ -957,7 +957,7 @@ void ScummEngine_v80he::initCharset(int charsetno) { #endif void ScummEngine::initCharset(int charsetno) { - if (_gameId == GID_FT) { + if (_game.id == GID_FT) { if (!res.isResourceLoaded(rtCharset, charsetno)) loadCharset(charsetno); } else { @@ -990,9 +990,9 @@ void ScummEngine_v7::loadLanguageBundle() { ScummFile file; int32 size; - if (_gameId == GID_DIG) { + if (_game.id == GID_DIG) { openFile(file, "language.bnd"); - } else if (_gameId == GID_CMI) { + } else if (_game.id == GID_CMI) { openFile(file, "language.tab"); } else { return; @@ -1032,7 +1032,7 @@ void ScummEngine_v7::loadLanguageBundle() { ptr = _languageBuffer; - if (_gameId == GID_DIG) { + if (_game.id == GID_DIG) { int lineCount = _languageIndexSize; const char *baseTag = ""; byte enc = 0; // Initially assume the language file is not encoded @@ -1133,12 +1133,12 @@ void ScummEngine_v7::loadLanguageBundle() { } void ScummEngine_v7::playSpeech(const byte *ptr) { - if ((_gameId == GID_DIG || _gameId == GID_CMI) && ptr[0]) { + if ((_game.id == GID_DIG || _game.id == GID_CMI) && ptr[0]) { char pointer[20]; strcpy(pointer, (const char *)ptr); // Play speech - if (!(_features & GF_DEMO) && (_gameId == GID_CMI)) // CMI demo does not have .IMX for voice + if (!(_game.features & GF_DEMO) && (_game.id == GID_CMI)) // CMI demo does not have .IMX for voice strcat(pointer, ".IMX"); _sound->stopTalkSound(); @@ -1157,7 +1157,7 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff) { _lastStringTag[0] = 0; // WORKAROUND for bug #1172655. - if (_gameId == GID_DIG && text[0] != '/') { + if (_game.id == GID_DIG && text[0] != '/') { if (!strcmp((const char *)text, "faint light")) text = (const byte *)"/NEW.007/faint light"; else if (!strcmp((const char *)text, "glowing crystal")) @@ -1185,7 +1185,7 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff) { } - if (_version >= 7 && text[0] == '/') { + if (_game.version >= 7 && text[0] == '/') { // Extract the string tag from the text: /..../ for (i = 0; (i < 12) && (text[i + 1] != '/'); i++) _lastStringTag[i] = target.tag[i] = toupper(text[i + 1]); @@ -1210,7 +1210,7 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff) { if (found != NULL) { strcpy((char *)trans_buff, _languageBuffer + found->offset); - if ((_gameId == GID_DIG) && !(_features & GF_DEMO)) { + if ((_game.id == GID_DIG) && !(_game.features & GF_DEMO)) { // Replace any '%___' by the corresponding special codes in the source text const byte *src = text; char *dst = (char *)trans_buff; diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index d1622072ca..420b3231ac 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -81,7 +81,7 @@ void ScummEngine::setupScummVars() { VAR_SOUNDCARD = 48; VAR_VIDEOMODE = 49; - if (_version >= 4) { + if (_game.version >= 4) { VAR_SCROLL_SCRIPT = 27; VAR_DEBUGMODE = 39; VAR_MAINMENU_KEY = 50; @@ -90,12 +90,12 @@ void ScummEngine::setupScummVars() { VAR_USERPUT = 53; } - if (_version >= 5) { + if (_game.version >= 5) { VAR_SOUNDPARAM = 64; VAR_SOUNDPARAM2 = 65; VAR_SOUNDPARAM3 = 66; } - if (_version >= 5) { + if (_game.version >= 5) { VAR_SOUNDRESULT = 56; VAR_TALKSTOP_KEY = 57; VAR_FADE_DELAY = 59; @@ -168,10 +168,10 @@ void ScummEngine_v5::setupScummVars() { VAR_CURRENT_LIGHTS = 9; - if (_version >= 4) { + if (_game.version >= 4) { VAR_V5_TALK_STRING_Y = 54; } - if ((_gameId == GID_LOOM && _version == 4) || _version >= 5) { + if ((_game.id == GID_LOOM && _game.version == 4) || _game.version >= 5) { VAR_NOSUBTITLES = 60; } } @@ -183,7 +183,7 @@ void ScummEngine_v6::setupScummVars() { VAR_ROOM_WIDTH = 41; VAR_ROOM_HEIGHT = 54; - if (_heversion >= 60) { + if (_game.heversion >= 60) { VAR_NOSUBTITLES = 60; } else { VAR_VOICE_MODE = 60; // 0 is voice, 1 is voice+text, 2 is text only @@ -204,7 +204,7 @@ void ScummEngine_v6::setupScummVars() { VAR_TIMEDATE_MINUTE = 126; // Sam & Max specific - if (_gameId == GID_SAMNMAX) { + if (_game.id == GID_SAMNMAX) { VAR_V6_SOUNDMODE = 9; VAR_CHARSET_MASK = 123; } @@ -295,7 +295,7 @@ void ScummEngine_v72he::setupScummVars() { VAR_MOUSE_STATE = 75; VAR_POLYGONS_ONLY = 76; - if (_heversion <= 73) { + if (_game.heversion <= 73) { VAR_NUM_SOUND_CHANNELS = 56; } } @@ -319,7 +319,7 @@ void ScummEngine_v90he::setupScummVars() { VAR_SCRIPT_CYCLE = 103; VAR_NUM_SCRIPT_CYCLES = 104; - if (_heversion >= 95) { + if (_game.heversion >= 95) { VAR_NUM_SPRITE_GROUPS = 105; VAR_NUM_SPRITES = 106; VAR_U32_VERSION = 107; @@ -327,10 +327,10 @@ void ScummEngine_v90he::setupScummVars() { VAR_WIZ_TCOLOR = 117; VAR_RESERVED_SOUND_CHANNELS = 120; } - if (_heversion >= 98) { + if (_game.heversion >= 98) { VAR_SKIP_RESET_TALK_ACTOR = 125; } - if (_heversion >= 99) { + if (_game.heversion >= 99) { VAR_MAIN_SCRIPT = 127; VAR_NUM_PALETTES = 130; VAR_NUM_UNK = 131; @@ -430,7 +430,7 @@ void ScummEngine_v7::setupScummVars() { VAR_FADE_DELAY = 117; // Full Throttle specific - if (_gameId == GID_FT) { + if (_game.id == GID_FT) { VAR_CHARSET_MASK = 119; } @@ -543,21 +543,21 @@ void ScummEngine_v8::setupScummVars() { void ScummEngine_v2::initScummVars() { - if (_platform == Common::kPlatformC64 && _gameId == GID_MANIAC) { + if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) { VAR(VAR_EGO) = 3; } // 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. - if (_gameId == GID_ZAK) + if (_game.id == GID_ZAK) VAR(VAR_MACHINE_SPEED) = 0x7FFF; } void ScummEngine_v5::initScummVars() { ScummEngine::initScummVars(); - if (_version >= 4 && _version <= 5) + if (_game.version >= 4 && _game.version <= 5) VAR(VAR_V5_TALK_STRING_Y) = -0x50; if (VAR_CURRENT_LIGHTS != 0xFF) { @@ -565,7 +565,7 @@ void ScummEngine_v5::initScummVars() { VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; } - if (_gameId == GID_MONKEY) + if (_game.id == GID_MONKEY) _scummVars[74] = 1225; } @@ -573,7 +573,7 @@ void ScummEngine_v5::initScummVars() { void ScummEngine_v7::initScummVars() { ScummEngine::initScummVars(); - if (_version == 8) { // FIXME: How do we deal with non-cd installs? + if (_game.version == 8) { // FIXME: How do we deal with non-cd installs? VAR(VAR_CURRENTDISK) = 1; VAR(VAR_LANGUAGE) = _language; } else { @@ -626,13 +626,13 @@ void ScummEngine_v90he::initScummVars() { VAR(VAR_SCRIPT_CYCLE) = 1; VAR(VAR_NUM_SCRIPT_CYCLES) = 1; - if (_heversion >= 95) { + if (_game.heversion >= 95) { VAR(VAR_NUM_SPRITE_GROUPS) = MAX(64, _numSprites / 4) - 1; VAR(VAR_NUM_SPRITES) = _numSprites - 1; VAR(VAR_WIZ_TCOLOR) = 5; VAR(VAR_RESERVED_SOUND_CHANNELS) = 9; } - if (_heversion >= 98) { + if (_game.heversion >= 98) { VAR(VAR_U32_VERSION) = _logicHE->versionID(); VAR(VAR_U32_ARRAY_UNK) = 0; } @@ -647,7 +647,7 @@ void ScummEngine_v99he::initScummVars() { #endif void ScummEngine::initScummVars() { - if (_heversion < 70 && _version <= 6) { + if (_game.heversion < 70 && _game.version <= 6) { switch (_musicType) { case MDT_NONE: VAR(VAR_SOUNDCARD) = 0; @@ -659,9 +659,9 @@ void ScummEngine::initScummVars() { VAR(VAR_SOUNDCARD) = 3; break; default: - if ((_gameId == GID_MONKEY_EGA || _gameId == GID_MONKEY_VGA || (_gameId == GID_LOOM && _version == 3)) - && (_platform == Common::kPlatformPC)) { - if (_gameId == GID_LOOM) { + if ((_game.id == GID_MONKEY_EGA || _game.id == GID_MONKEY_VGA || (_game.id == GID_LOOM && _game.version == 3)) + && (_game.platform == Common::kPlatformPC)) { + if (_game.id == GID_LOOM) { char buf[50]; Common::File f; for (int i = 82; i < 85; i++) { @@ -669,7 +669,7 @@ void ScummEngine::initScummVars() { if (!Common::File::exists(buf)) error("Native MIDI support requires Roland patch from LucasArts"); } - } else if (_gameId == GID_MONKEY_EGA) { + } else if (_game.id == GID_MONKEY_EGA) { if (!Common::File::exists("DISK09.LEC")) error("Native MIDI support requires Roland patch from LucasArts"); } @@ -679,11 +679,11 @@ void ScummEngine::initScummVars() { } } - if (_platform == Common::kPlatformFMTowns) + if (_game.platform == Common::kPlatformFMTowns) VAR(VAR_VIDEOMODE) = 42; - else if (_platform == Common::kPlatformMacintosh) + else if (_game.platform == Common::kPlatformMacintosh) VAR(VAR_VIDEOMODE) = 50; - else if (_platform == Common::kPlatformAmiga) + else if (_game.platform == Common::kPlatformAmiga) VAR(VAR_VIDEOMODE) = 82; else if (_renderMode == Common::kRenderCGA) VAR(VAR_VIDEOMODE) = 4; @@ -694,25 +694,25 @@ void ScummEngine::initScummVars() { else VAR(VAR_VIDEOMODE) = 19; - if (_platform == Common::kPlatformMacintosh && (_features & GF_OLD_BUNDLE)) { + if (_game.platform == Common::kPlatformMacintosh && (_game.features & GF_OLD_BUNDLE)) { // Set screen size for the Macintosh version of Indy3/Loom VAR(39) = 320; } - if (_platform == Common::kPlatformPC && _gameId == GID_LOOM && _version == 3) { + if (_game.platform == Common::kPlatformPC && _game.id == GID_LOOM && _game.version == 3) { // Set number of sound resources VAR(39) = 80; } - if (_gameId == GID_LOOM || _version >= 4) + if (_game.id == GID_LOOM || _game.version >= 4) VAR(VAR_HEAPSPACE) = 1400; - if (_version >= 4) + if (_game.version >= 4) VAR(VAR_FIXEDDISK) = 1; - if (_version >= 5) + if (_game.version >= 5) VAR(VAR_MOUSEPRESENT) = 1; - if (_version == 6) + if (_game.version == 6) VAR(VAR_V6_EMSSPACE) = 10000; - if (_heversion >= 60) { + if (_game.heversion >= 60) { // Set fast speed, to enable all animations VAR(VAR_MACHINE_SPEED) = 2; diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 7b01527b92..21a83510bc 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -94,7 +94,7 @@ void ScummEngine_v2::initV2MouseOver() { int i; int arrow_color, color, hi_color; - if (_version == 1) { + if (_game.version == 1) { color = 16; hi_color = 7; arrow_color = 6; @@ -275,7 +275,7 @@ void ScummEngine_v2::checkV2MouseOver(Common::Point pos) { } void ScummEngine_v2::checkV2Inventory(int x, int y) { - int inventoryArea = (_platform == Common::kPlatformNES) ? 48: 32; + int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32; int object = 0; y -= virtscr[kVerbVirtScreen].topline; @@ -316,8 +316,8 @@ void ScummEngine_v2::redrawV2Inventory() { int i; int max_inv; Common::Rect inventoryBox; - int inventoryArea = (_platform == Common::kPlatformNES) ? 48: 32; - int maxChars = (_platform == Common::kPlatformNES) ? 13: 18; + int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32; + int maxChars = (_game.platform == Common::kPlatformNES) ? 13: 18; _mouseOverBoxV2 = -1; @@ -364,7 +364,7 @@ void ScummEngine_v2::redrawV2Inventory() { _string[1].xpos = _mouseOverBoxesV2[kInventoryUpArrow].rect.left; _string[1].ypos = _mouseOverBoxesV2[kInventoryUpArrow].rect.top + vs->topline; _string[1].color = _mouseOverBoxesV2[kInventoryUpArrow].color; - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) drawString(1, (const byte *)"\x7E"); else drawString(1, (const byte *)" \1\2"); @@ -375,7 +375,7 @@ void ScummEngine_v2::redrawV2Inventory() { _string[1].xpos = _mouseOverBoxesV2[kInventoryDownArrow].rect.left; _string[1].ypos = _mouseOverBoxesV2[kInventoryDownArrow].rect.top + vs->topline; _string[1].color = _mouseOverBoxesV2[kInventoryDownArrow].color; - if (_platform == Common::kPlatformNES) + if (_game.platform == Common::kPlatformNES) drawString(1, (const byte *)"\x7F"); else drawString(1, (const byte *)" \3\4"); @@ -383,7 +383,7 @@ void ScummEngine_v2::redrawV2Inventory() { } void ScummEngine::redrawVerbs() { - if (_version <= 2 && !(_userState & 128)) // Don't draw verbs unless active + if (_game.version <= 2 && !(_userState & 128)) // Don't draw verbs unless active return; int i, verb = 0; @@ -452,7 +452,7 @@ void ScummEngine::checkExecVerbs() { } } - if ((_gameId == GID_INDY4 || _gameId == GID_PASS) && _mouseAndKeyboardStat >= '0' && _mouseAndKeyboardStat <= '9') { + if ((_game.id == GID_INDY4 || _game.id == GID_PASS) && _mouseAndKeyboardStat >= '0' && _mouseAndKeyboardStat <= '9') { // To support keyboard fighting in FOA, we need to remap the number keys. // FOA apparently expects PC scancode values (see script 46 if you want // to know where I got these numbers from). Oddly enough, the The Indy 3 @@ -472,12 +472,12 @@ void ScummEngine::checkExecVerbs() { } else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) { VirtScreen *zone = findVirtScreen(_mouse.y); byte code = _mouseAndKeyboardStat & MBS_LEFT_CLICK ? 1 : 2; - int inventoryArea = (_platform == Common::kPlatformNES) ? 48: 32; + int inventoryArea = (_game.platform == Common::kPlatformNES) ? 48: 32; - if (_version <= 2 && zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) { + if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) { // Click into V2 sentence line runInputScript(5, 0, 0); - } else if (_version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + inventoryArea) { + } else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + inventoryArea) { // Click into V2 inventory ((ScummEngine_v2 *)this)->checkV2Inventory(_mouse.x, _mouse.y); } else { @@ -502,7 +502,7 @@ void ScummEngine_c64::checkExecVerbs() { if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) { // TODO - } else if (_version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) { + } else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) { // Click into V2 inventory checkV2Inventory(_mouse.x, _mouse.y); } else { @@ -539,10 +539,10 @@ void ScummEngine_c64::checkExecVerbs() { void ScummEngine::verbMouseOver(int verb) { // Don't do anything unless verbs are active - if (_version <= 2 && !(_userState & 128)) + if (_game.version <= 2 && !(_userState & 128)) return; - if (_gameId == GID_FT) + if (_game.id == GID_FT) return; if (_verbMouseOver == verb) @@ -689,7 +689,7 @@ void ScummEngine::drawVerb(int verb, int mode) { vs->curRect.bottom = _charset->_str.bottom; vs->oldRect = _charset->_str; _charset->_str.left = _charset->_str.right; - } else if (_gameId != GID_FT) { + } else if (_game.id != GID_FT) { restoreVerbBG(verb); } } @@ -731,11 +731,11 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { obim = getResourceAddress(rtVerb, verb); assert(obim); - if (_features & GF_OLD_BUNDLE) { + if (_game.features & GF_OLD_BUNDLE) { imgw = obim[0]; imgh = obim[1] / 8; imptr = obim + 2; - } else if (_features & GF_SMALL_HEADER) { + } else if (_game.features & GF_SMALL_HEADER) { size = READ_LE_UINT32(obim); imgw = (*(obim + size + 11)); @@ -743,7 +743,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { imptr = getObjectImage(obim, 1); } else { imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obim); - if (_version >= 7) { + if (_game.version >= 7) { imgw = READ_LE_UINT16(&imhd->v7.width) / 8; imgh = READ_LE_UINT16(&imhd->v7.height) / 8; } else { @@ -790,7 +790,7 @@ void ScummEngine::killVerb(int slot) { res.nukeResource(rtVerb, slot); - if (_version <= 6 && vs->saveid == 0) { + if (_game.version <= 6 && vs->saveid == 0) { drawVerb(slot, 0); verbMouseOver(0); } @@ -804,14 +804,14 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { FindObjectInRoom foir; int i; - if (_heversion >= 70) { // Windows titles. Here we always ignore room + if (_game.heversion >= 70) { // Windows titles. Here we always ignore room room = getObjectRoom(object); } if (whereIsObject(object) == WIO_FLOBJECT) error("Can't grab verb image from flobject"); - if (_features & GF_OLD_BUNDLE) { + if (_game.features & GF_OLD_BUNDLE) { for (i = (_numLocalObjects-1); i > 0; i--) { if (_objs[i].obj_nr == object) { findObjectInRoom(&foir, foImageHeader, object, room); @@ -824,7 +824,7 @@ void ScummEngine::setVerbObject(uint room, uint object, uint verb) { return; } } - } else if (_features & GF_SMALL_HEADER) { + } else if (_game.features & GF_SMALL_HEADER) { for (i = (_numLocalObjects-1); i > 0; i--) { if (_objs[i].obj_nr == object) { // FIXME - the only thing we need from the OBCD is the image size! |