[Scummvm-cvs-logs] SF.net SVN: scummvm:[49047] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun May 16 12:36:21 CEST 2010


Revision: 49047
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49047&view=rev
Author:   thebluegr
Date:     2010-05-16 10:36:21 +0000 (Sun, 16 May 2010)

Log Message:
-----------
Added automatic detection of the IHNM demo

Modified Paths:
--------------
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/detection_tables.h
    scummvm/trunk/engines/saga/events.cpp
    scummvm/trunk/engines/saga/font.cpp
    scummvm/trunk/engines/saga/gfx.cpp
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/introproc_ihnm.cpp
    scummvm/trunk/engines/saga/music.cpp
    scummvm/trunk/engines/saga/resource_res.cpp
    scummvm/trunk/engines/saga/saga.cpp
    scummvm/trunk/engines/saga/saga.h
    scummvm/trunk/engines/saga/saveload.cpp
    scummvm/trunk/engines/saga/scene.cpp
    scummvm/trunk/engines/saga/scene.h
    scummvm/trunk/engines/saga/sndres.cpp
    scummvm/trunk/engines/saga/sprite.cpp

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/animation.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -324,7 +324,7 @@
 		_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);
 		}

Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/detection_tables.h	2010-05-16 10:36:21 UTC (rev 49047)
@@ -626,7 +626,7 @@
 			GUIO_NONE
 		},
 		GID_IHNM,
-		GF_IHNM_DEMO,
+		0,
 		IHNMDEMO_DEFAULT_SCENE,
 		&IHNMDEMO_Resources,
 		ARRAYSIZE(IHNMDEMO_GameFonts),

Modified: scummvm/trunk/engines/saga/events.cpp
===================================================================
--- scummvm/trunk/engines/saga/events.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/events.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -508,13 +508,13 @@
 		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:

Modified: scummvm/trunk/engines/saga/font.cpp
===================================================================
--- scummvm/trunk/engines/saga/font.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/font.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -651,7 +651,7 @@
 	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 @@
 			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;

Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/gfx.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -494,7 +494,7 @@
 
 		switch (cursorType) {
 		case kCursorBusy:
-			if (!(_vm->getFeatures() & GF_IHNM_DEMO))
+			if (!_vm->isIHNMDemo())
 				resourceId = RID_IHNM_HOURGLASS_CURSOR;
 			else
 				resourceId = (uint32)-1;

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/interface.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -387,7 +387,7 @@
 		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 @@
 	} 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 @@
 #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 @@
 	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 @@
 
 	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 @@
 			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 @@
 		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);

Modified: scummvm/trunk/engines/saga/introproc_ihnm.cpp
===================================================================
--- scummvm/trunk/engines/saga/introproc_ihnm.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/introproc_ihnm.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -54,7 +54,7 @@
 
 	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 @@
 
 	_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 @@
 		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);

Modified: scummvm/trunk/engines/saga/music.cpp
===================================================================
--- scummvm/trunk/engines/saga/music.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/music.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -396,7 +396,7 @@
 		// 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);

Modified: scummvm/trunk/engines/saga/resource_res.cpp
===================================================================
--- scummvm/trunk/engines/saga/resource_res.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/resource_res.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -46,7 +46,7 @@
 
 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 @@
 	byte *resourcePointer;
 	size_t resourceLength;
 
-	if (!(_vm->getFeatures() & GF_IHNM_DEMO)) {
+	if (!_vm->isIHNMDemo()) {
 		_vm->_resource->loadResource(resourceContext, metaResourceTable[chapter],
 									 resourcePointer, resourceLength);
 	} else {

Modified: scummvm/trunk/engines/saga/saga.cpp
===================================================================
--- scummvm/trunk/engines/saga/saga.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/saga.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -222,6 +222,7 @@
 	_copyProtection = ConfMan.getBool("copy_protection");
 	_gf_wyrmkeep = false;
 	_musicWasPlaying = false;
+	_isIHNMDemo = Common::File::exists("music.res");
 
 	if (_readingSpeed > 3)
 		_readingSpeed = 0;

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/saga.h	2010-05-16 10:36:21 UTC (rev 49047)
@@ -150,9 +150,8 @@
 #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 @@
 		return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
 	}
 
+	bool isIHNMDemo() { return _isIHNMDemo; }
+
 	int16 _framesEsc;
 
 	uint32 _globalFlags;
@@ -519,6 +520,7 @@
 	bool _copyProtection;
 	bool _gf_wyrmkeep;
 	bool _musicWasPlaying;
+	bool _isIHNMDemo;
 
 	SndRes *_sndRes;
 	Sound *_sound;

Modified: scummvm/trunk/engines/saga/saveload.cpp
===================================================================
--- scummvm/trunk/engines/saga/saveload.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/saveload.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -327,7 +327,7 @@
 		_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);

Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/scene.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -636,7 +636,7 @@
 		_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::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();

Modified: scummvm/trunk/engines/saga/scene.h
===================================================================
--- scummvm/trunk/engines/saga/scene.h	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/scene.h	2010-05-16 10:36:21 UTC (rev 49047)
@@ -366,7 +366,7 @@
 	void showIHNMDemoSpecialScreen();
 
 	bool isNonInteractiveIHNMDemoPart() {
-		return _vm->getFeatures() & GF_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149);
+		return _vm->isIHNMDemo() && (_sceneNumber >= 144 && _sceneNumber <= 149);
 	}
 
 	bool isITEPuzzleScene() {

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/sndres.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -74,7 +74,7 @@
 		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 {

Modified: scummvm/trunk/engines/saga/sprite.cpp
===================================================================
--- scummvm/trunk/engines/saga/sprite.cpp	2010-05-16 10:23:44 UTC (rev 49046)
+++ scummvm/trunk/engines/saga/sprite.cpp	2010-05-16 10:36:21 UTC (rev 49047)
@@ -63,7 +63,7 @@
 		_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 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list