From 80acb21a56f6e1a42de6d44de87d24891ded7e80 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 16 May 2010 10:36:21 +0000 Subject: Added automatic detection of the IHNM demo svn-id: r49047 --- engines/saga/animation.cpp | 2 +- engines/saga/detection_tables.h | 2 +- engines/saga/events.cpp | 4 ++-- engines/saga/font.cpp | 4 ++-- engines/saga/gfx.cpp | 2 +- engines/saga/interface.cpp | 14 +++++++------- engines/saga/introproc_ihnm.cpp | 6 +++--- engines/saga/music.cpp | 2 +- engines/saga/resource_res.cpp | 4 ++-- engines/saga/saga.cpp | 1 + engines/saga/saga.h | 8 +++++--- engines/saga/saveload.cpp | 2 +- engines/saga/scene.cpp | 4 ++-- engines/saga/scene.h | 2 +- engines/saga/sndres.cpp | 2 +- engines/saga/sprite.cpp | 2 +- 16 files changed, 32 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp index 8c11ddac1a..0d65d2f191 100644 --- a/engines/saga/animation.cpp +++ b/engines/saga/animation.cpp @@ -324,7 +324,7 @@ void Anim::clearCutaway() { _vm->_interface->restoreMode(); _vm->_gfx->showCursor(true); - if (_vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->isIHNMDemo()) { // Enable the save reminder state after each cutaway for the IHNM demo _vm->_interface->setSaveReminderState(true); } diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index 7a346b78e9..e5796e813b 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -626,7 +626,7 @@ static const SAGAGameDescription gameDescriptions[] = { GUIO_NONE }, GID_IHNM, - GF_IHNM_DEMO, + 0, IHNMDEMO_DEFAULT_SCENE, &IHNMDEMO_Resources, ARRAYSIZE(IHNMDEMO_GameFonts), diff --git a/engines/saga/events.cpp b/engines/saga/events.cpp index 0ed1f2b3d9..d15f0b2af3 100644 --- a/engines/saga/events.cpp +++ b/engines/saga/events.cpp @@ -508,13 +508,13 @@ int Events::handleOneShot(Event *event) { case kEventSetNormalCursor: // in ITE and IHNM demo there is just one cursor // ITE never makes this call - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) + if (!_vm->isIHNMDemo()) _vm->_gfx->setCursor(kCursorNormal); break; case kEventSetBusyCursor: // in ITE and IHNM demo there is just one cursor // ITE never makes this call - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) + if (!_vm->isIHNMDemo()) _vm->_gfx->setCursor(kCursorBusy); break; default: diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 3ffe27f783..5b7b7289eb 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -651,7 +651,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) { FontId fontId = kSmallFont; // The demo version of IHNM has 3 font types (like ITE), not 6 (like the full version of IHNM) - if (_vm->getGameId() == GID_ITE || _vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->getGameId() == GID_ITE || _vm->isIHNMDemo()) { switch (font) { case (kKnownFontSmall): fontId = kSmallFont; @@ -674,7 +674,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) { break; } #ifdef ENABLE_IHNM - } else if (_vm->getGameId() == GID_IHNM && !(_vm->getFeatures() & GF_IHNM_DEMO)) { + } else if (_vm->getGameId() == GID_IHNM && !_vm->isIHNMDemo()) { switch (font) { case (kKnownFontSmall): fontId = kSmallFont; diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp index bb0a1677b1..40a633ac5d 100644 --- a/engines/saga/gfx.cpp +++ b/engines/saga/gfx.cpp @@ -494,7 +494,7 @@ void Gfx::setCursor(CursorType cursorType) { switch (cursorType) { case kCursorBusy: - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) + if (!_vm->isIHNMDemo()) resourceId = RID_IHNM_HOURGLASS_CURSOR; else resourceId = (uint32)-1; diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 2cb61e21cc..c0d3cee465 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -387,7 +387,7 @@ int Interface::activate() { unlockMode(); if (_panelMode == kPanelMain || _panelMode == kPanelChapterSelection) { _saveReminderState = 1; - } else if (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO) { + } else if (_panelMode == kPanelNull && _vm->isIHNMDemo()) { _saveReminderState = 1; } _vm->_gfx->showCursor(true); @@ -438,7 +438,7 @@ void Interface::setMode(int mode) { } else if (mode == kPanelChapterSelection) { _saveReminderState = 1; } else if (mode == kPanelNull) { - if (_vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->isIHNMDemo()) { _inMainMode = true; _saveReminderState = 1; } @@ -728,7 +728,7 @@ bool Interface::processAscii(Common::KeyState keystate) { #ifdef ENABLE_IHNM if (_vm->getGameId() == GID_IHNM) { // Any keypress here returns the user back to the game - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { + if (!_vm->isIHNMDemo()) { _vm->_scene->clearPsychicProfile(); } else { setMode(kPanelConverse); @@ -809,7 +809,7 @@ void Interface::draw() { drawStatusBar(); if (_panelMode == kPanelMain || _panelMode == kPanelMap || - (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO)) { + (_panelMode == kPanelNull && _vm->isIHNMDemo())) { _mainPanel.getRect(rect); _vm->_gfx->drawRegion(rect, _mainPanel.image); @@ -826,7 +826,7 @@ void Interface::draw() { if (_panelMode == kPanelMain || _panelMode == kPanelConverse || _lockedMode == kPanelMain || _lockedMode == kPanelConverse || - (_panelMode == kPanelNull && _vm->getFeatures() & GF_IHNM_DEMO)) { + (_panelMode == kPanelNull && _vm->isIHNMDemo())) { leftPortraitPoint.x = _mainPanel.x + _vm->getDisplayInfo().leftPortraitXOffset; leftPortraitPoint.y = _mainPanel.y + _vm->getDisplayInfo().leftPortraitYOffset; _vm->_sprite->draw(_defPortraits, _leftPortrait, leftPortraitPoint, 256); @@ -1079,7 +1079,7 @@ void Interface::setQuit(PanelButton *panelButton) { break; case kTextQuit: #ifdef ENABLE_IHNM - if (_vm->getFeatures() & GF_IHNM_DEMO) + if (_vm->isIHNMDemo()) _vm->_scene->creditsScene(); // display sales info for IHNM demo else #endif @@ -1853,7 +1853,7 @@ void Interface::update(const Point& mousePoint, int updateFlag) { if (_vm->getGameId() == GID_IHNM) { // Any mouse click here returns the user back to the game if (updateFlag & UPDATE_MOUSECLICK) { - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { + if (!_vm->isIHNMDemo()) { _vm->_scene->clearPsychicProfile(); } else { setMode(kPanelConverse); diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp index a8970ffd6f..e149753dfd 100644 --- a/engines/saga/introproc_ihnm.cpp +++ b/engines/saga/introproc_ihnm.cpp @@ -54,7 +54,7 @@ int Scene::IHNMStartProc() { IHNMLoadCutaways(); - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { + if (!_vm->isIHNMDemo()) { int logoLength = -168; if (_vm->getLanguage() == Common::DE_DEU || _vm->getLanguage() == Common::ES_ESP) @@ -105,7 +105,7 @@ int Scene::IHNMCreditsProc() { _vm->_music->play(0, MUSIC_NORMAL); - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { + if (!_vm->isIHNMDemo()) { // Display the credits for 400 frames playTitle(4, -400, true); } else { @@ -130,7 +130,7 @@ void Scene::IHNMLoadCutaways() { error("Scene::IHNMStartProc() resource context not found"); } - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) + if (!_vm->isIHNMDemo()) _vm->_resource->loadResource(resourceContext, RID_IHNM_INTRO_CUTAWAYS, resourcePointer, resourceLength); else _vm->_resource->loadResource(resourceContext, RID_IHNMDEMO_INTRO_CUTAWAYS, resourcePointer, resourceLength); diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 23568853aa..75c5cdffd7 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -396,7 +396,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { // Note that the IHNM demo has only got one music file // (music.rsc). It is assumed that it contains FM music - if (hasAdLib() || _vm->getFeatures() & GF_IHNM_DEMO) { + if (hasAdLib() || _vm->isIHNMDemo()) { context = _vm->_resource->getContext(GAME_MUSICFILE_FM); } else { context = _vm->_resource->getContext(GAME_MUSICFILE_GM); diff --git a/engines/saga/resource_res.cpp b/engines/saga/resource_res.cpp index 8de5529540..8546030241 100644 --- a/engines/saga/resource_res.cpp +++ b/engines/saga/resource_res.cpp @@ -46,7 +46,7 @@ static int metaResourceTableDemo[] = { 0, 0, 0, 0, 0, 0, 0, 285, 0 }; void Resource_RES::loadGlobalResources(int chapter, int actorsEntrance) { if (chapter < 0) - chapter = (!(_vm->getFeatures() & GF_IHNM_DEMO)) ? 8 : 7; + chapter = !_vm->isIHNMDemo() ? 8 : 7; _vm->_script->_globalVoiceLUT.freeMem(); @@ -69,7 +69,7 @@ void Resource_RES::loadGlobalResources(int chapter, int actorsEntrance) { byte *resourcePointer; size_t resourceLength; - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) { + if (!_vm->isIHNMDemo()) { _vm->_resource->loadResource(resourceContext, metaResourceTable[chapter], resourcePointer, resourceLength); } else { diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 8ccc6d96e5..2911d9c451 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -222,6 +222,7 @@ Common::Error SagaEngine::run() { _copyProtection = ConfMan.getBool("copy_protection"); _gf_wyrmkeep = false; _musicWasPlaying = false; + _isIHNMDemo = Common::File::exists("music.res"); if (_readingSpeed > 3) _readingSpeed = 0; diff --git a/engines/saga/saga.h b/engines/saga/saga.h index a667a09d30..2bef489e05 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -150,9 +150,8 @@ enum GameFeatures { #endif GF_MONO_MUSIC = 1 << 4, GF_EXTRA_ITE_CREDITS = 1 << 5, - GF_IHNM_DEMO = 1 << 6, - GF_LE_VOICES = 1 << 7, - GF_8BIT_UNSIGNED_PCM = 1 << 8 + GF_LE_VOICES = 1 << 6, + GF_8BIT_UNSIGNED_PCM = 1 << 7 }; enum VerbTypeIds { @@ -502,6 +501,8 @@ public: return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1; } + bool isIHNMDemo() { return _isIHNMDemo; } + int16 _framesEsc; uint32 _globalFlags; @@ -519,6 +520,7 @@ public: bool _copyProtection; bool _gf_wyrmkeep; bool _musicWasPlaying; + bool _isIHNMDemo; SndRes *_sndRes; Sound *_sound; diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index 951d0a5698..2740462dab 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -327,7 +327,7 @@ void SagaEngine::load(const char *fileName) { _music->stop(); if (_scene->currentChapterNumber() == 8) _interface->setMode(kPanelChapterSelection); - if (!(getFeatures() & GF_IHNM_DEMO)) { + if (!isIHNMDemo()) { _music->play(_music->_songTable[_scene->getCurrentMusicTrack()], _scene->getCurrentMusicRepeat() ? MUSIC_LOOP : MUSIC_NORMAL); } else { _music->play(3, MUSIC_LOOP); diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 5cb1890a2d..40ee1fb720 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -636,7 +636,7 @@ void Scene::loadScene(LoadSceneParams &loadSceneParams) { _vm->_interface->activate(); if (loadSceneParams.chapter == 8 || loadSceneParams.chapter == -1) { - if (!(_vm->getFeatures() & GF_IHNM_DEMO)) + if (!_vm->isIHNMDemo()) _vm->_interface->setMode(kPanelChapterSelection); else _vm->_interface->setMode(kPanelNull); @@ -1518,7 +1518,7 @@ void Scene::showPsychicProfile(const char *text) { } void Scene::clearPsychicProfile() { - if (_vm->_interface->getMode() == kPanelPlacard || _vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->_interface->getMode() == kPanelPlacard || _vm->isIHNMDemo()) { _vm->_render->setFlag(RF_DISABLE_ACTORS); _vm->_scene->clearPlacard(); _vm->_interface->activate(); diff --git a/engines/saga/scene.h b/engines/saga/scene.h index 985e5e5286..4fbde560b5 100644 --- a/engines/saga/scene.h +++ b/engines/saga/scene.h @@ -366,7 +366,7 @@ class Scene { void showIHNMDemoSpecialScreen(); bool isNonInteractiveIHNMDemoPart() { - return _vm->getFeatures() & GF_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149); + return _vm->isIHNMDemo() && (_sceneNumber >= 144 && _sceneNumber <= 149); } bool isITEPuzzleScene() { diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 4532e2d23a..8ea3fc4003 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -74,7 +74,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm), _sfxContext(NULL), _voiceContext(NULL) byte *resourcePointer; size_t resourceLength; - if (_vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->isIHNMDemo()) { _vm->_resource->loadResource(resourceContext, RID_IHNMDEMO_SFX_LUT, resourcePointer, resourceLength); } else { diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index 9e93efde4e..c1a9846b47 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -63,7 +63,7 @@ Sprite::Sprite(SagaEngine *vm) : _vm(vm) { _arrowSprites = _saveReminderSprites = _inventorySprites = _mainSprites; #ifdef ENABLE_IHNM } else if (_vm->getGameId() == GID_IHNM) { - if (_vm->getFeatures() & GF_IHNM_DEMO) { + if (_vm->isIHNMDemo()) { loadList(RID_IHNMDEMO_ARROW_SPRITES, _arrowSprites); loadList(RID_IHNMDEMO_SAVEREMINDER_SPRITES, _saveReminderSprites); } else { -- cgit v1.2.3