aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-05-16 10:36:21 +0000
committerFilippos Karapetis2010-05-16 10:36:21 +0000
commit80acb21a56f6e1a42de6d44de87d24891ded7e80 (patch)
tree64824e515c93e246acc05ed1816663b8f55b8b23 /engines
parentb57bab8e3ba0909a253c439296f7f5e9c2bb2150 (diff)
downloadscummvm-rg350-80acb21a56f6e1a42de6d44de87d24891ded7e80.tar.gz
scummvm-rg350-80acb21a56f6e1a42de6d44de87d24891ded7e80.tar.bz2
scummvm-rg350-80acb21a56f6e1a42de6d44de87d24891ded7e80.zip
Added automatic detection of the IHNM demo
svn-id: r49047
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/animation.cpp2
-rw-r--r--engines/saga/detection_tables.h2
-rw-r--r--engines/saga/events.cpp4
-rw-r--r--engines/saga/font.cpp4
-rw-r--r--engines/saga/gfx.cpp2
-rw-r--r--engines/saga/interface.cpp14
-rw-r--r--engines/saga/introproc_ihnm.cpp6
-rw-r--r--engines/saga/music.cpp2
-rw-r--r--engines/saga/resource_res.cpp4
-rw-r--r--engines/saga/saga.cpp1
-rw-r--r--engines/saga/saga.h8
-rw-r--r--engines/saga/saveload.cpp2
-rw-r--r--engines/saga/scene.cpp4
-rw-r--r--engines/saga/scene.h2
-rw-r--r--engines/saga/sndres.cpp2
-rw-r--r--engines/saga/sprite.cpp2
16 files changed, 32 insertions, 29 deletions
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 {