MOHAWK: Simplify retrieving game features

This commit is contained in:
Bastien Bouclet 2020-03-27 20:14:46 +01:00
parent c9476543e0
commit 1d731aeef9
20 changed files with 74 additions and 67 deletions

View file

@ -127,7 +127,7 @@ void MystCursorManager::setCursor(uint16 id) {
// We're using the screen palette for the original game, but we need // We're using the screen palette for the original game, but we need
// to use this for any 8bpp cursor in ME. // to use this for any 8bpp cursor in ME.
if (_vm->getFeatures() & GF_ME) if (_vm->isGameVariant(GF_ME))
CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256); CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256);
} else { } else {
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();

View file

@ -73,6 +73,10 @@ uint32 MohawkEngine::getFeatures() const {
return _gameDescription->features; return _gameDescription->features;
} }
bool MohawkEngine::isGameVariant(MohawkGameFeatures feature) const {
return (_gameDescription->features & feature) != 0;
}
Common::Platform MohawkEngine::getPlatform() const { Common::Platform MohawkEngine::getPlatform() const {
return _gameDescription->desc.platform; return _gameDescription->desc.platform;
} }

View file

@ -125,16 +125,16 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name
_dropPageButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.DropPage", _("~D~rop Page"), nullptr, kDropCmd); _dropPageButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.DropPage", _("~D~rop Page"), nullptr, kDropCmd);
// Myst ME only has maps // Myst ME only has maps
if (vm->getFeatures() & GF_ME) { if (vm->isGameVariant(GF_ME)) {
_showMapButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.ShowMap", _("Show ~M~ap"), nullptr, kMapCmd); _showMapButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.ShowMap", _("Show ~M~ap"), nullptr, kMapCmd);
} }
// Myst demo only has a menu // Myst demo only has a menu
if (vm->getFeatures() & GF_DEMO) { if (vm->isGameVariant(GF_DEMO)) {
_returnToMenuButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.MainMenu", _("Main Men~u~"), nullptr, kMenuCmd); _returnToMenuButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.MainMenu", _("Main Men~u~"), nullptr, kMenuCmd);
} }
if (vm->getFeatures() & GF_25TH) { if (vm->isGameVariant(GF_25TH)) {
GUI::StaticTextWidget *languageCaption = new GUI::StaticTextWidget(widgetsBoss(), "MystOptionsDialog.LanguageDesc", _("Language:")); GUI::StaticTextWidget *languageCaption = new GUI::StaticTextWidget(widgetsBoss(), "MystOptionsDialog.LanguageDesc", _("Language:"));
languageCaption->setAlign(Graphics::kTextAlignRight); languageCaption->setAlign(Graphics::kTextAlignRight);

View file

@ -87,6 +87,7 @@ public:
const MohawkGameDescription *_gameDescription; const MohawkGameDescription *_gameDescription;
const char *getGameId() const; const char *getGameId() const;
uint32 getFeatures() const; uint32 getFeatures() const;
bool isGameVariant(MohawkGameFeatures feature) const;
const char *getAppName() const; const char *getAppName() const;
Common::Platform getPlatform() const; Common::Platform getPlatform() const;
uint8 getGameType() const; uint8 getGameType() const;

View file

@ -144,7 +144,7 @@ void MohawkEngine_Myst::cachePreload(uint32 tag, uint16 id) {
for (uint32 i = 0; i < _mhk.size(); i++) { for (uint32 i = 0; i < _mhk.size(); i++) {
// Check for MJMP in Myst ME // Check for MJMP in Myst ME
if ((getFeatures() & GF_ME) && tag == ID_MSND && _mhk[i]->hasResource(ID_MJMP, id)) { if (isGameVariant(GF_ME) && tag == ID_MSND && _mhk[i]->hasResource(ID_MJMP, id)) {
Common::SeekableReadStream *tempData = _mhk[i]->getResource(ID_MJMP, id); Common::SeekableReadStream *tempData = _mhk[i]->getResource(ID_MJMP, id);
uint16 msndId = tempData->readUint16LE(); uint16 msndId = tempData->readUint16LE();
delete tempData; delete tempData;
@ -429,9 +429,9 @@ Common::Error MohawkEngine_Myst::run() {
// Start us on the first stack. // Start us on the first stack.
if (getGameType() == GType_MAKINGOF) if (getGameType() == GType_MAKINGOF)
changeToStack(kMakingOfStack, 1, 0, 0); changeToStack(kMakingOfStack, 1, 0, 0);
else if (getFeatures() & GF_DEMO) else if (isGameVariant(GF_DEMO))
changeToStack(kDemoStack, 2000, 0, 0); changeToStack(kDemoStack, 2000, 0, 0);
else if (getFeatures() & GF_25TH) else if (isGameVariant(GF_25TH))
changeToStack(kMenuStack, 1, 0, 0); changeToStack(kMenuStack, 1, 0, 0);
else else
changeToStack(kIntroStack, 1, 0, 0); changeToStack(kIntroStack, 1, 0, 0);
@ -501,7 +501,7 @@ void MohawkEngine_Myst::loadStackArchives(MystStack stackId) {
loadArchive(mystFiles[stackId], nullptr, true); loadArchive(mystFiles[stackId], nullptr, true);
if (getFeatures() & GF_ME) { if (isGameVariant(GF_ME)) {
if (languageDesc) { if (languageDesc) {
loadArchive("help", languageDesc->archiveSuffix, false); loadArchive("help", languageDesc->archiveSuffix, false);
} }
@ -509,7 +509,7 @@ void MohawkEngine_Myst::loadStackArchives(MystStack stackId) {
loadArchive("help", nullptr, true); loadArchive("help", nullptr, true);
} }
if (getFeatures() & GF_25TH) { if (isGameVariant(GF_25TH)) {
loadArchive("menu", nullptr, true); loadArchive("menu", nullptr, true);
} }
} }
@ -543,9 +543,9 @@ void MohawkEngine_Myst::registerDefaultSettings() {
void MohawkEngine_Myst::applyGameSettings() { void MohawkEngine_Myst::applyGameSettings() {
// Allow changing the language when in the main menu when the game has not yet been started. // Allow changing the language when in the main menu when the game has not yet been started.
// It's not possible to reliably change the language one the game is started as the current // It's not possible to reliably change the language once the game is started as the current
// view cannot be reconstructed using the save / stack state. // view cannot be reconstructed using the save / stack state.
if ((getFeatures() & GF_25TH) && !isGameStarted()) { if (isGameVariant(GF_25TH) && !isGameStarted()) {
_currentLanguage = Common::parseLanguage(ConfMan.get("language")); _currentLanguage = Common::parseLanguage(ConfMan.get("language"));
_gfx->loadMenuFont(); _gfx->loadMenuFont();
changeToStack(_stack->getStackId(), _card->getId(), 0, 0); changeToStack(_stack->getStackId(), _card->getId(), 0, 0);
@ -696,7 +696,7 @@ bool MohawkEngine_Myst::canDoAction(MystEventAction action) {
case kMystActionShowMap: case kMystActionShowMap:
return actionsAllowed && stack->getMap(); return actionsAllowed && stack->getMap();
case kMystActionOpenMainMenu: case kMystActionOpenMainMenu:
assert(getFeatures() & GF_DEMO); assert(isGameVariant(GF_DEMO));
return actionsAllowed && stack->getStackId() != kDemoStack; return actionsAllowed && stack->getStackId() != kDemoStack;
default: default:
// Not implemented yet // Not implemented yet
@ -721,14 +721,14 @@ void MohawkEngine_Myst::doAction(MystEventAction action) {
break; break;
} }
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
if (_stack->getStackId() != kDemoStack && isInteractive()) { if (_stack->getStackId() != kDemoStack && isInteractive()) {
changeToStack(kDemoStack, 2002, 0, 0); changeToStack(kDemoStack, 2002, 0, 0);
} }
break; break;
} }
if (getFeatures() & GF_25TH && isInteractive()) { if (isGameVariant(GF_25TH) && isInteractive()) {
if (_stack->getStackId() == kMenuStack) { if (_stack->getStackId() == kMenuStack) {
// If the menu is active and a game is loaded, go back to the game // If the menu is active and a game is loaded, go back to the game
if (_prevStack) { if (_prevStack) {
@ -858,7 +858,7 @@ void MohawkEngine_Myst::changeToStack(MystStack stackId, uint16 card, uint16 lin
// In Myst ME, play a fullscreen flyby movie, except when loading saves. // In Myst ME, play a fullscreen flyby movie, except when loading saves.
// Also play a flyby when first linking to Myst. // Also play a flyby when first linking to Myst.
if (getFeatures() & GF_ME if (isGameVariant(GF_ME)
&& ((_stack && _stack->getStackId() == kMystStack) || (stackId == kMystStack && card == 4134))) { && ((_stack && _stack->getStackId() == kMystStack) || (stackId == kMystStack && card == 4134))) {
playFlybyMovie(stackId); playFlybyMovie(stackId);
} }
@ -962,7 +962,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card, TransitionType transition) {
_card->enter(); _card->enter();
// The demo resets the cursor at each card change except when in the library // The demo resets the cursor at each card change except when in the library
if (getFeatures() & GF_DEMO if (isGameVariant(GF_DEMO)
&& _gameState->_globals.currentAge != kMystLibrary) { && _gameState->_globals.currentAge != kMystLibrary) {
_cursor->setDefaultCursor(); _cursor->setDefaultCursor();
} }
@ -1059,7 +1059,7 @@ Common::Error MohawkEngine_Myst::saveGameState(int slot, const Common::String &d
} }
bool MohawkEngine_Myst::hasGameSaveSupport() const { bool MohawkEngine_Myst::hasGameSaveSupport() const {
return !(getFeatures() & GF_DEMO) && getGameType() != GType_MAKINGOF; return !isGameVariant(GF_DEMO) && getGameType() != GType_MAKINGOF;
} }
bool MohawkEngine_Myst::isInteractive() const { bool MohawkEngine_Myst::isInteractive() const {

View file

@ -176,7 +176,7 @@ void MystCard::loadView() {
// Precache Card Resources // Precache Card Resources
uint32 cacheImageType; uint32 cacheImageType;
if (_vm->getFeatures() & GF_ME) if (_vm->isGameVariant(GF_ME))
cacheImageType = ID_PICT; cacheImageType = ID_PICT;
else else
cacheImageType = ID_WDIB; cacheImageType = ID_WDIB;

View file

@ -44,7 +44,7 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) :
_viewport = Common::Rect(544, 332); _viewport = Common::Rect(544, 332);
if (_vm->getFeatures() & GF_ME) { if (_vm->isGameVariant(GF_ME)) {
// High color // High color
initGraphics(_viewport.width(), _viewport.height(), nullptr); initGraphics(_viewport.width(), _viewport.height(), nullptr);
@ -66,7 +66,7 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) :
_mainMenuBackupScreenThumbnail.reset(new Graphics::Surface()); _mainMenuBackupScreenThumbnail.reset(new Graphics::Surface());
_mainMenuBackupBackBuffer.reset(new Graphics::Surface()); _mainMenuBackupBackBuffer.reset(new Graphics::Surface());
if (_vm->getFeatures() & GF_25TH) { if (_vm->isGameVariant(GF_ME) && _vm->isGameVariant(GF_25TH)) {
loadMenuFont(); loadMenuFont();
} }
} }
@ -110,7 +110,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) {
// that PICT resources can contain WDIB's instead of PICT's. // that PICT resources can contain WDIB's instead of PICT's.
Common::SeekableReadStream *dataStream = nullptr; Common::SeekableReadStream *dataStream = nullptr;
if (_vm->getFeatures() & GF_ME && _vm->hasResource(ID_PICT, id)) { if (_vm->isGameVariant(GF_ME) && _vm->hasResource(ID_PICT, id)) {
// The PICT resource exists. However, it could still contain a MystBitmap // The PICT resource exists. However, it could still contain a MystBitmap
// instead of a PICT image... // instead of a PICT image...
dataStream = _vm->getResource(ID_PICT, id); dataStream = _vm->getResource(ID_PICT, id);
@ -121,7 +121,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) {
bool isPict = false; bool isPict = false;
if ((_vm->getFeatures() & GF_ME) && dataStream->size() > 512 + 10 + 4) { if (_vm->isGameVariant(GF_ME) && dataStream->size() > 512 + 10 + 4) {
// Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap // Here we detect whether it's really a PICT or a WDIB. Since a MystBitmap
// would be compressed, there's no way to detect for the BM without a hack. // would be compressed, there's no way to detect for the BM without a hack.
// So, we search for the PICT version opcode for detection. // So, we search for the PICT version opcode for detection.
@ -144,7 +144,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) {
} else { } else {
mhkSurface = _bmpDecoder->decodeImage(dataStream); mhkSurface = _bmpDecoder->decodeImage(dataStream);
if (_vm->getFeatures() & GF_ME) { if (_vm->isGameVariant(GF_ME)) {
mhkSurface->convertToTrueColor(); mhkSurface->convertToTrueColor();
} else { } else {
remapSurfaceToSystemPalette(mhkSurface); remapSurfaceToSystemPalette(mhkSurface);
@ -166,7 +166,7 @@ void MystGraphics::applyImagePatches(uint16 id, const MohawkSurface *mhkSurface)
// //
// Here we stomp over the "off" with an "on". // Here we stomp over the "off" with an "on".
// The fixed image was provided by dafioram in bug Trac#10115. // The fixed image was provided by dafioram in bug Trac#10115.
if (id == 2019 && _vm->getFeatures() & GF_ME && _vm->getLanguage() == Common::EN_ANY) { if (id == 2019 && _vm->isGameVariant(GF_ME) && _vm->getLanguage() == Common::EN_ANY) {
static const byte markerSwitchInstructionsFixPic[] = { static const byte markerSwitchInstructionsFixPic[] = {
0x1d, 0x1c, 0x19, 0x19, 0x19, 0x19, 0x1c, 0x19, 0x19, 0x17, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1d, 0x1c, 0x19, 0x19, 0x19, 0x19, 0x1c, 0x19, 0x19, 0x17, 0x19, 0x19, 0x19, 0x19, 0x19,
0x1e, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1e, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
@ -270,7 +270,7 @@ void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src,
MohawkSurface *mhkSurface = findImage(image); MohawkSurface *mhkSurface = findImage(image);
Graphics::Surface *surface = mhkSurface->getSurface(); Graphics::Surface *surface = mhkSurface->getSurface();
if (image == 2258 && _vm->getFeatures() & GF_ME) { if (image == 2258 && _vm->isGameVariant(GF_ME)) {
// In Myst ME, the image for the open red page brother door // In Myst ME, the image for the open red page brother door
// when the special lights are on does not have the correct width. // when the special lights are on does not have the correct width.
// We work around this issue by tweaking the destination rectangle // We work around this issue by tweaking the destination rectangle
@ -317,7 +317,7 @@ void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src,
for (uint16 i = 0; i < height; i++) for (uint16 i = 0; i < height; i++)
memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->format.bytesPerPixel); memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->format.bytesPerPixel);
if (!(_vm->getFeatures() & GF_ME)) { if (!_vm->isGameVariant(GF_ME)) {
// Make sure the palette is set // Make sure the palette is set
assert(mhkSurface->getPalette()); assert(mhkSurface->getPalette());
memcpy(_palette, mhkSurface->getPalette(), 256 * 3); memcpy(_palette, mhkSurface->getPalette(), 256 * 3);
@ -685,11 +685,11 @@ void MystGraphics::drawRect(Common::Rect rect, RectState state) {
Graphics::Surface *screen = _vm->_system->lockScreen(); Graphics::Surface *screen = _vm->_system->lockScreen();
if (state == kRectEnabled) if (state == kRectEnabled)
screen->frameRect(rect, (_vm->getFeatures() & GF_ME) ? _pixelFormat.RGBToColor(0, 255, 0) : 250); screen->frameRect(rect, _vm->isGameVariant(GF_ME) ? _pixelFormat.RGBToColor(0, 255, 0) : 250);
else if (state == kRectUnreachable) else if (state == kRectUnreachable)
screen->frameRect(rect, (_vm->getFeatures() & GF_ME) ? _pixelFormat.RGBToColor(0, 0, 255) : 252); screen->frameRect(rect, _vm->isGameVariant(GF_ME) ? _pixelFormat.RGBToColor(0, 0, 255) : 252);
else else
screen->frameRect(rect, (_vm->getFeatures() & GF_ME) ? _pixelFormat.RGBToColor(255, 0, 0) : 249); screen->frameRect(rect, _vm->isGameVariant(GF_ME) ? _pixelFormat.RGBToColor(255, 0, 0) : 249);
_vm->_system->unlockScreen(); _vm->_system->unlockScreen();
} }
@ -700,7 +700,7 @@ void MystGraphics::drawLine(const Common::Point &p1, const Common::Point &p2, ui
void MystGraphics::fadeToBlack() { void MystGraphics::fadeToBlack() {
// This is only for the demo // This is only for the demo
assert(!(_vm->getFeatures() & GF_ME)); assert(!_vm->isGameVariant(GF_ME));
// Linear fade in 64 steps // Linear fade in 64 steps
for (int i = 63; i >= 0; i--) { for (int i = 63; i >= 0; i--) {
@ -718,7 +718,7 @@ void MystGraphics::fadeToBlack() {
void MystGraphics::fadeFromBlack() { void MystGraphics::fadeFromBlack() {
// This is only for the demo // This is only for the demo
assert(!(_vm->getFeatures() & GF_ME)); assert(!_vm->isGameVariant(GF_ME));
copyBackBufferToScreen(_viewport); copyBackBufferToScreen(_viewport);

View file

@ -764,7 +764,7 @@ void MystScriptParser::o_changeStack(uint16 var, const ArgumentsArray &args) {
_vm->_sound->stopEffect(); _vm->_sound->stopEffect();
if (_vm->getFeatures() & GF_DEMO) { if (_vm->isGameVariant(GF_DEMO)) {
// No need to have a table for just this data... // No need to have a table for just this data...
if (targetStack == 1) if (targetStack == 1)
_vm->changeToStack(kDemoSlidesStack, 1000, soundIdLinkSrc, soundIdLinkDst); _vm->changeToStack(kDemoSlidesStack, 1000, soundIdLinkSrc, soundIdLinkDst);

View file

@ -46,7 +46,7 @@ MystSound::~MystSound() {
} }
Audio::RewindableAudioStream *MystSound::makeAudioStream(uint16 id, CueList *cueList) { Audio::RewindableAudioStream *MystSound::makeAudioStream(uint16 id, CueList *cueList) {
if (_vm->getFeatures() & GF_ME) if (_vm->isGameVariant(GF_ME))
return Audio::makeWAVStream(_vm->getResource(ID_MSND, convertMystID(id)), DisposeAfterUse::YES); return Audio::makeWAVStream(_vm->getResource(ID_MSND, convertMystID(id)), DisposeAfterUse::YES);
else else
return makeMohawkWaveStream(_vm->getResource(ID_MSND, id), cueList); return makeMohawkWaveStream(_vm->getResource(ID_MSND, id), cueList);

View file

@ -116,7 +116,7 @@ void Intro::introMovies_run() {
case 4: case 4:
_introStep = 5; _introStep = 5;
if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video if (!_vm->isGameVariant(GF_DEMO)) { // The demo doesn't have the intro video
video = _vm->playMovieFullscreen("intro", kIntroStack); video = _vm->playMovieFullscreen("intro", kIntroStack);
} }
break; break;
@ -125,7 +125,7 @@ void Intro::introMovies_run() {
_introStep = 6; _introStep = 6;
break; break;
default: default:
if (_vm->getFeatures() & GF_DEMO) if (_vm->isGameVariant(GF_DEMO))
_vm->changeToCard(2001, kTransitionRightToLeft); _vm->changeToCard(2001, kTransitionRightToLeft);
else else
_vm->changeToCard(2, kTransitionRightToLeft); _vm->changeToCard(2, kTransitionRightToLeft);
@ -135,7 +135,7 @@ void Intro::introMovies_run() {
void Intro::o_playIntroMovies(uint16 var, const ArgumentsArray &args) { void Intro::o_playIntroMovies(uint16 var, const ArgumentsArray &args) {
_introMoviesRunning = true; _introMoviesRunning = true;
if (_vm->getFeatures() & GF_25TH) { if (_vm->isGameVariant(GF_25TH)) {
// In the 25th anniversary version, the Broderbund / Cyan Logo were already shown // In the 25th anniversary version, the Broderbund / Cyan Logo were already shown
// before the main menu. No need to play them again here. // before the main menu. No need to play them again here.
_introStep = 4; _introStep = 4;

View file

@ -2975,7 +2975,7 @@ void Myst::clockGearForwardOneStep(uint16 gear) {
void Myst::clockWeightDownOneStep() { void Myst::clockWeightDownOneStep() {
// The Myst ME version of this video is encoded faster than the original // The Myst ME version of this video is encoded faster than the original
// The weight goes on the floor one step too early. Original ME engine also has this behavior. // The weight goes on the floor one step too early. Original ME engine also has this behavior.
bool updateVideo = !(_vm->getFeatures() & GF_ME) || _clockWeightPosition < (2214 - 246); bool updateVideo = !_vm->isGameVariant(GF_ME) || _clockWeightPosition < (2214 - 246);
// Set video bounds // Set video bounds
if (updateVideo) { if (updateVideo) {
@ -3278,7 +3278,7 @@ Common::Point Myst::towerRotationMapComputeCoords(uint16 angle) {
void Myst::towerRotationMapDrawLine(const Common::Point &end, bool rotationLabelVisible) { void Myst::towerRotationMapDrawLine(const Common::Point &end, bool rotationLabelVisible) {
uint32 color; uint32 color;
if (_vm->getFeatures() & GF_ME) { if (_vm->isGameVariant(GF_ME)) {
Graphics::PixelFormat pf = _vm->_system->getScreenFormat(); Graphics::PixelFormat pf = _vm->_system->getScreenFormat();
if (!_towerRotationOverSpot) if (!_towerRotationOverSpot)
@ -3505,7 +3505,7 @@ void Myst::o_observatory_init(uint16 var, const ArgumentsArray &args) {
bool Myst::observatoryIsDDMMYYYY2400() { bool Myst::observatoryIsDDMMYYYY2400() {
// TODO: Auto-detect based on the month rect position // TODO: Auto-detect based on the month rect position
return !(_vm->getFeatures() & GF_ME) && (_vm->getLanguage() == Common::FR_FRA return !_vm->isGameVariant(GF_ME) && (_vm->getLanguage() == Common::FR_FRA
|| _vm->getLanguage() == Common::DE_DEU); || _vm->getLanguage() == Common::DE_DEU);
} }

View file

@ -213,7 +213,7 @@ bool MystGameState::saveState(int slot) {
debugC(kDebugSaveLoad, "Saving game to '%s'", filename.c_str()); debugC(kDebugSaveLoad, "Saving game to '%s'", filename.c_str());
Common::Serializer s(nullptr, saveFile); Common::Serializer s(nullptr, saveFile);
syncGameState(s, _vm->getFeatures() & GF_ME); syncGameState(s, _vm->isGameVariant(GF_ME));
saveFile->finalize(); saveFile->finalize();
delete saveFile; delete saveFile;
@ -532,7 +532,7 @@ void MystGameState::addZipDest(MystStack stack, uint16 view) {
ZipDests *zipDests = nullptr; ZipDests *zipDests = nullptr;
// The demo has no zip dest storage // The demo has no zip dest storage
if (_vm->getFeatures() & GF_DEMO) if (_vm->isGameVariant(GF_DEMO))
return; return;
// Select stack // Select stack
@ -578,7 +578,7 @@ bool MystGameState::isReachableZipDest(MystStack stack, uint16 view) {
return false; return false;
// The demo has no zip dest storage // The demo has no zip dest storage
if (_vm->getFeatures() & GF_DEMO) if (_vm->isGameVariant(GF_DEMO))
return false; return false;
// Select stack // Select stack

View file

@ -176,7 +176,7 @@ Common::Error MohawkEngine_Riven::run() {
_cursor->showCursor(); _cursor->showCursor();
// Let's begin, shall we? // Let's begin, shall we?
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
// Start the demo off with the videos // Start the demo off with the videos
changeToStack(kStackAspit); changeToStack(kStackAspit);
changeToCard(6); changeToCard(6);
@ -263,12 +263,12 @@ void MohawkEngine_Riven::processInput() {
runOptionsDialog(); runOptionsDialog();
break; break;
case kRivenActionOpenMainMenu: case kRivenActionOpenMainMenu:
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
// Return to the main menu in the demo // Return to the main menu in the demo
if (_stack->getId() != kStackAspit) if (_stack->getId() != kStackAspit)
changeToStack(kStackAspit); changeToStack(kStackAspit);
changeToCard(1); changeToCard(1);
} else if (!_scriptMan->hasQueuedScripts() && getFeatures() & GF_25TH) { } else if (!_scriptMan->hasQueuedScripts() && isGameVariant(GF_25TH)) {
// Check if we haven't jumped to menu // Check if we haven't jumped to menu
if (_menuSavedStack == -1) { if (_menuSavedStack == -1) {
goToMainMenu(); goToMainMenu();
@ -281,7 +281,7 @@ void MohawkEngine_Riven::processInput() {
break; break;
case kRivenActionPlayIntroVideos: case kRivenActionPlayIntroVideos:
// Play the intro videos in the demo // Play the intro videos in the demo
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
if (_stack->getId() != kStackAspit) if (_stack->getId() != kStackAspit)
changeToStack(kStackAspit); changeToStack(kStackAspit);
changeToCard(6); changeToCard(6);
@ -392,7 +392,7 @@ void MohawkEngine_Riven::changeToStack(uint16 stackId) {
char prefix = RivenStacks::getName(stackId)[0]; char prefix = RivenStacks::getName(stackId)[0];
// Load the localization override file if any // Load the localization override file if any
if (getFeatures() & GF_25TH) { if (isGameVariant(GF_25TH)) {
loadLanguageDatafile(prefix, stackId); loadLanguageDatafile(prefix, stackId);
} }
@ -467,9 +467,9 @@ const char **MohawkEngine_Riven::listExpectedDatafiles() const {
}; };
const char **datafiles; const char **datafiles;
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
datafiles = datafilesDemo; datafiles = datafilesDemo;
} else if (getFeatures() & GF_DVD) { } else if (isGameVariant(GF_DVD)) {
datafiles = datafilesDVD; datafiles = datafilesDVD;
} else { } else {
datafiles = datafilesCD; datafiles = datafilesCD;
@ -624,7 +624,7 @@ void MohawkEngine_Riven::changeToCard(uint16 dest) {
// on different cards). // on different cards).
_gfx->clearCache(); _gfx->clearCache();
if (!(getFeatures() & GF_DEMO)) { if (!isGameVariant(GF_DEMO)) {
for (byte i = 0; i < ARRAYSIZE(rivenSpecialChange); i++) for (byte i = 0; i < ARRAYSIZE(rivenSpecialChange); i++)
if (_stack->getId() == rivenSpecialChange[i].startStack && dest == _stack->getCardStackId( if (_stack->getId() == rivenSpecialChange[i].startStack && dest == _stack->getCardStackId(
rivenSpecialChange[i].startCardRMAP)) { rivenSpecialChange[i].startCardRMAP)) {
@ -813,7 +813,7 @@ bool MohawkEngine_Riven::isZipVisitedCard(const Common::String &hotspotName) con
} }
bool MohawkEngine_Riven::canLoadGameStateCurrently() { bool MohawkEngine_Riven::canLoadGameStateCurrently() {
if (getFeatures() & GF_DEMO) { if (isGameVariant(GF_DEMO)) {
return false; return false;
} }

View file

@ -219,7 +219,7 @@ void RivenCard::applyPropertiesPatch2E76(uint32 globalId) {
// } // }
// break; // break;
// } // }
if (globalId == 0x2E76 && !(_vm->getFeatures() & GF_DVD)) { if (globalId == 0x2E76 && !_vm->isGameVariant(GF_DVD)) {
uint16 aGehnVariable = _vm->getStack()->getIdFromName(kVariableNames, "agehn"); uint16 aGehnVariable = _vm->getStack()->getIdFromName(kVariableNames, "agehn");
uint16 aTrapBookVariable = _vm->getStack()->getIdFromName(kVariableNames, "atrapbook"); uint16 aTrapBookVariable = _vm->getStack()->getIdFromName(kVariableNames, "atrapbook");
uint16 patchData[] = { uint16 patchData[] = {
@ -398,7 +398,7 @@ void RivenCard::applyPropertiesPatch22118(uint32 globalId) {
} }
void RivenCard::applyPropertiesPatchE2E(uint32 globalId) { void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
if (!(_vm->getFeatures() & GF_25TH)) if (!_vm->isGameVariant(GF_25TH))
return; return;
// The main menu in the Myst 25th anniversary version is patched to include new items: // The main menu in the Myst 25th anniversary version is patched to include new items:

View file

@ -340,8 +340,10 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) :
_effectScreen = new Graphics::Surface(); _effectScreen = new Graphics::Surface();
_effectScreen->create(608, 392, _pixelFormat); _effectScreen->create(608, 392, _pixelFormat);
if (_vm->isGameVariant(GF_25TH)) {
loadMenuFont(); loadMenuFont();
} }
}
RivenGraphics::~RivenGraphics() { RivenGraphics::~RivenGraphics() {
_effectScreen->free(); _effectScreen->free();

View file

@ -54,7 +54,7 @@ void RivenInventory::draw() {
clearArea(); clearArea();
// Draw the demo's exit button // Draw the demo's exit button
if (_vm->getFeatures() & GF_DEMO) { if (_vm->isGameVariant(GF_DEMO)) {
// extras.mhk tBMP 101 contains "EXIT" instead of Atrus' journal in the demo! // extras.mhk tBMP 101 contains "EXIT" instead of Atrus' journal in the demo!
// The demo's extras.mhk contains all the other inventory/marble/credits image // The demo's extras.mhk contains all the other inventory/marble/credits image
// but has hacked tBMP 101 with "EXIT". *sigh* // but has hacked tBMP 101 with "EXIT". *sigh*
@ -100,7 +100,7 @@ void RivenInventory::checkClick(const Common::Point &mousePos) {
} }
// In the demo, check if we've clicked the exit button // In the demo, check if we've clicked the exit button
if (_vm->getFeatures() & GF_DEMO) { if (_vm->isGameVariant(GF_DEMO)) {
if (_demoExitRect.contains(mousePos)) { if (_demoExitRect.contains(mousePos)) {
if (_vm->getStack()->getId() == kStackAspit && _vm->getCard()->getId() == 1) { if (_vm->getStack()->getId() == kStackAspit && _vm->getCard()->getId() == 1) {
// From the main menu, go to the "quit" screen // From the main menu, go to the "quit" screen
@ -181,7 +181,7 @@ bool RivenInventory::isVisible() const {
return false; return false;
} }
if (_vm->getFeatures() & GF_DEMO) { if (_vm->isGameVariant(GF_DEMO)) {
// The inventory is always visible in the demo // The inventory is always visible in the demo
return true; return true;
} }

View file

@ -165,7 +165,7 @@ SaveStateDescriptor RivenSaveLoad::querySaveMetaInfos(const int slot) {
} }
Common::Error RivenSaveLoad::loadGame(const int slot) { Common::Error RivenSaveLoad::loadGame(const int slot) {
if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo if (_vm->isGameVariant(GF_DEMO)) // Don't load games in the demo
return Common::kNoError; return Common::kNoError;
Common::String filename = buildSaveFilename(slot); Common::String filename = buildSaveFilename(slot);
@ -187,8 +187,8 @@ Common::Error RivenSaveLoad::loadGame(const int slot) {
Common::SeekableReadStream *vers = mhk->getResource(ID_VERS, 1); Common::SeekableReadStream *vers = mhk->getResource(ID_VERS, 1);
uint32 saveGameVersion = vers->readUint32BE(); uint32 saveGameVersion = vers->readUint32BE();
delete vers; delete vers;
if ((saveGameVersion == kCDSaveGameVersion && (_vm->getFeatures() & GF_DVD)) if ((saveGameVersion == kCDSaveGameVersion && _vm->isGameVariant(GF_DVD))
|| (saveGameVersion == kDVDSaveGameVersion && !(_vm->getFeatures() & GF_DVD))) { || (saveGameVersion == kDVDSaveGameVersion && !_vm->isGameVariant(GF_DVD))) {
warning("Unable to load: Saved game created using an incompatible game version - CD vs DVD"); warning("Unable to load: Saved game created using an incompatible game version - CD vs DVD");
delete mhk; delete mhk;
return Common::Error(Common::kUnknownError, "Saved game created using an incompatible game version - CD vs DVD"); return Common::Error(Common::kUnknownError, "Saved game created using an incompatible game version - CD vs DVD");
@ -297,7 +297,7 @@ Common::Error RivenSaveLoad::loadGame(const int slot) {
Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() { Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES); Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
if (_vm->getFeatures() & GF_DVD) if (_vm->isGameVariant(GF_DVD))
stream->writeUint32BE(kDVDSaveGameVersion); stream->writeUint32BE(kDVDSaveGameVersion);
else else
stream->writeUint32BE(kCDSaveGameVersion); stream->writeUint32BE(kCDSaveGameVersion);

View file

@ -313,7 +313,7 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
// switchCard(534); // switchCard(534);
// playSound(112, 256, 0); // playSound(112, 256, 0);
if (cardGlobalId == 0x2E900 && scriptType == kMouseDownScript && hotspotId == 3 if (cardGlobalId == 0x2E900 && scriptType == kMouseDownScript && hotspotId == 3
&& !(vm->getFeatures() & GF_DVD)) { && !vm->isGameVariant(GF_DVD)) {
shouldApplyPatches = true; shouldApplyPatches = true;
RivenSimpleCommand::ArgumentArray arguments; RivenSimpleCommand::ArgumentArray arguments;
arguments.push_back(112); arguments.push_back(112);
@ -325,7 +325,7 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
// Second part of the patch to fix the invalid card change when entering Gehn's office // Second part of the patch to fix the invalid card change when entering Gehn's office
// The first part is in the card patches. // The first part is in the card patches.
if (cardGlobalId == 0x2E76 && scriptType == kCardUpdateScript && !(vm->getFeatures() & GF_DVD)) { if (cardGlobalId == 0x2E76 && scriptType == kCardUpdateScript && !vm->isGameVariant(GF_DVD)) {
shouldApplyPatches = true; shouldApplyPatches = true;
for (uint i = 0; i < _commands.size(); i++) { for (uint i = 0; i < _commands.size(); i++) {
@ -367,7 +367,7 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
// Override the main menu new game script to call an external command. // Override the main menu new game script to call an external command.
// This way we can reset all the state when starting a new game while a game is already started. // This way we can reset all the state when starting a new game while a game is already started.
if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16 if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16
&& (vm->getFeatures() & GF_25TH)) { && vm->isGameVariant(GF_25TH)) {
shouldApplyPatches = true; shouldApplyPatches = true;
_commands.clear(); _commands.clear();

View file

@ -90,7 +90,7 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
// The original game hides the start/setup buttons depending on an ini entry. // The original game hides the start/setup buttons depending on an ini entry.
// It's safe to ignore this command. // It's safe to ignore this command.
if (!(_vm->getFeatures() & GF_25TH)) if (!_vm->isGameVariant(GF_25TH))
return; return;
int lang = -1; int lang = -1;
@ -202,7 +202,7 @@ void ASpit::xaatrusbooknextpage(const ArgumentArray &args) {
// Keep turning pages while the mouse is pressed // Keep turning pages while the mouse is pressed
while (keepTurningPages()) { while (keepTurningPages()) {
// Check for the last page // Check for the last page
if (((_vm->getFeatures() & GF_DEMO) && page == 6) || page == 10) if ((_vm->isGameVariant(GF_DEMO) && page == 6) || page == 10)
return; return;
// Update the page number // Update the page number

View file

@ -140,7 +140,7 @@ void VideoEntry::setVolume(int volume) {
VideoManager::VideoManager(MohawkEngine *vm) : _vm(vm) { VideoManager::VideoManager(MohawkEngine *vm) : _vm(vm) {
// Set dithering enabled, if required // Set dithering enabled, if required
_enableDither = (_vm->getGameType() == GType_MYST || _vm->getGameType() == GType_MAKINGOF) && !(_vm->getFeatures() & GF_ME); _enableDither = (_vm->getGameType() == GType_MYST || _vm->getGameType() == GType_MAKINGOF) && !_vm->isGameVariant(GF_ME);
} }
VideoManager::~VideoManager() { VideoManager::~VideoManager() {