Added automatic detection of the IHNM demo

svn-id: r49047
This commit is contained in:
Filippos Karapetis 2010-05-16 10:36:21 +00:00
parent b57bab8e3b
commit 80acb21a56
16 changed files with 32 additions and 29 deletions

View File

@ -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);
}

View File

@ -626,7 +626,7 @@ static const SAGAGameDescription gameDescriptions[] = {
GUIO_NONE
},
GID_IHNM,
GF_IHNM_DEMO,
0,
IHNMDEMO_DEFAULT_SCENE,
&IHNMDEMO_Resources,
ARRAYSIZE(IHNMDEMO_GameFonts),

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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() {

View File

@ -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 {

View File

@ -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 {