[Scummvm-cvs-logs] scummvm master -> 0d3a2267c7a06b14302736c50dd4d5e4f9c6eafd

bluegr md5 at scummvm.org
Sat Jul 9 15:02:00 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0d3a2267c7 SAGA: Removed several game flags, which are now found more reliably on the fly


Commit: 0d3a2267c7a06b14302736c50dd4d5e4f9c6eafd
    https://github.com/scummvm/scummvm/commit/0d3a2267c7a06b14302736c50dd4d5e4f9c6eafd
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-07-09T05:59:30-07:00

Commit Message:
SAGA: Removed several game flags, which are now found more reliably on the fly

- The logo screens of all ITE versions are shown correctly now
- Wyrmkeep versions, demo versions with scene substitutes, demos with
mono music and demo versions with LE VOX encoded voices are all found
automatically now

Changed paths:
    engines/saga/detection.cpp
    engines/saga/detection_tables.h
    engines/saga/introproc_ite.cpp
    engines/saga/music.cpp
    engines/saga/resource.cpp
    engines/saga/saga.cpp
    engines/saga/saga.h
    engines/saga/scene.cpp
    engines/saga/sndres.cpp



diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 7a98fe4..2f1b61e 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -67,9 +67,6 @@ int SagaEngine::getGameId() const { return _gameDescription->gameId; }
 uint32 SagaEngine::getFeatures() const {
 	uint32 result = _gameDescription->features;
 
-	if (_gf_wyrmkeep)
-		result |= GF_WYRMKEEP;
-
 	return result;
 }
 
diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h
index ab73fcb..a29d835 100644
--- a/engines/saga/detection_tables.h
+++ b/engines/saga/detection_tables.h
@@ -221,7 +221,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NOSPEECH
 		},
 		GID_ITE,
-		GF_WYRMKEEP | GF_SCENE_SUBSTITUTES | GF_MONO_MUSIC | GF_LE_VOICES,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -247,7 +247,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NOSPEECH
 		},
 		GID_ITE,
-		GF_WYRMKEEP | GF_LE_VOICES,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -273,7 +273,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NONE
 		},
 		GID_ITE,
-		GF_WYRMKEEP | GF_SCENE_SUBSTITUTES,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -299,7 +299,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NONE
 		},
 		GID_ITE,
-		GF_WYRMKEEP | GF_8BIT_UNSIGNED_PCM,
+		GF_8BIT_UNSIGNED_PCM,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -356,7 +356,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NONE
 		},
 		GID_ITE,
-		GF_WYRMKEEP,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -388,7 +388,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NONE
 		},
 		GID_ITE,
-		GF_WYRMKEEP,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
@@ -418,7 +418,7 @@ static const SAGAGameDescription gameDescriptions[] = {
 			GUIO_NONE
 		},
 		GID_ITE,
-		GF_WYRMKEEP,
+		0,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
diff --git a/engines/saga/introproc_ite.cpp b/engines/saga/introproc_ite.cpp
index 87fd48e..9248f2b 100644
--- a/engines/saga/introproc_ite.cpp
+++ b/engines/saga/introproc_ite.cpp
@@ -179,21 +179,22 @@ enum {
 EventColumns *Scene::ITEQueueCredits(int delta_time, int duration, int n_credits, const IntroCredit credits[]) {
 	int game;
 	Common::Language lang;
+	bool hasWyrmkeepCredits = (Common::File::exists("credit3n.dlt") ||	// PC
+							   Common::File::exists("credit3m.dlt"));	// Mac
 
 	// The assumption here is that all WyrmKeep versions have the same
 	// credits, regardless of which operating system they're for.
 
 	lang = _vm->getLanguage();
 
-	if (_vm->getFeatures() & GF_WYRMKEEP) {
+	if (hasWyrmkeepCredits)
 		game = kITEWyrmKeep;
-	} else if (_vm->getPlatform() == Common::kPlatformMacintosh) {
+	else if (_vm->getPlatform() == Common::kPlatformMacintosh)
 		game = kITEMac;
-	} else if (_vm->getFeatures() & GF_EXTRA_ITE_CREDITS) {
+	else if (_vm->getFeatures() & GF_EXTRA_ITE_CREDITS)
 		game = kITEPCCD;
-	} else {
+	else
 		game = kITEPC;
-	}
 
 	int line_spacing = 0;
 	int paragraph_spacing;
@@ -303,6 +304,11 @@ int Scene::SC_ITEIntroAnimProc(int param, void *refCon) {
 int Scene::ITEIntroAnimProc(int param) {
 	Event event;
 	EventColumns *eventColumns;
+	bool isMac = _vm->getPlatform() == Common::kPlatformMacintosh;
+	bool isMultiCD = _vm->getPlatform() == Common::kPlatformUnknown;
+	bool hasWyrmkeepCredits = (Common::File::exists("credit3n.dlt") ||	// PC
+							   Common::File::exists("credit3m.dlt"));	// Mac
+	bool isDemo = Common::File::exists("scriptsd.rsc");
 
 	switch (param) {
 	case SCENE_BEGIN:{
@@ -324,19 +330,10 @@ int Scene::ITEIntroAnimProc(int param) {
 		// playback
 		int lastAnim;
 
-		if (_vm->getFeatures() & GF_WYRMKEEP) {
-			if (_vm->getPlatform() == Common::kPlatformMacintosh) {
-				lastAnim = 3;
-			} else {
-				lastAnim = 2;
-			}
-		} else {
-			if (_vm->getPlatform() == Common::kPlatformMacintosh) {
-				lastAnim = 4;
-			} else {
-				lastAnim = 5;
-			}
-		}
+		if (hasWyrmkeepCredits || isMultiCD || isDemo)
+			lastAnim = isMac ? 3 : 2;
+		else
+			lastAnim = isMac ? 4 : 5;
 
 		for (int i = 0; i < lastAnim; i++)
 			_vm->_anim->link(i, i+1);
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index 21f3cc4..85315ab 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -287,7 +287,12 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
 					if (_vm->isBigEndian())
 						musicFlags &= ~Audio::FLAG_LITTLE_ENDIAN;
 
-					if (_vm->getFeatures() & GF_MONO_MUSIC)
+					// The newer ITE Mac demo version contains a music file, but it has mono music.
+					// This is the only music file that is about 7MB, whereas all the other ones
+					// are much larger. Thus, we use this simple heuristic to determine if we got
+					// mono music in the ITE demos or not.
+					if (!strcmp(_digitalMusicContext->fileName(), "musicd.rsc") &&
+						_digitalMusicContext->fileSize() < 8000000)
 						musicFlags &= ~Audio::FLAG_STEREO;
 
 					audioStream = Audio::makeRawStream(musicStream, 11025, musicFlags, DisposeAfterUse::YES);
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index 72b0213..1b0dfa2 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -162,12 +162,6 @@ bool Resource::createContexts() {
 		uint16 voiceFileAddType;
 	};
 
-
-	// If the Wyrmkeep credits file is found, set the Wyrmkeep version flag to true
-	if (Common::File::exists("credit3n.dlt")) {
-		_vm->_gf_wyrmkeep = true;
-	}
-
 	for (const ADGameFileDescription *gameFileDescription = _vm->getFilesDescriptions();
 		gameFileDescription->fileName; gameFileDescription++) {
 		addContext(gameFileDescription->fileName, gameFileDescription->fileType);
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index d168605..6e272d3 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -72,9 +72,8 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc)
 	_readingSpeed = 0;
 
 	_copyProtection = false;
-	_gf_wyrmkeep = false;
 	_musicWasPlaying = false;
-
+	_hasITESceneSubstitutes = false;
 
 	_sndRes = NULL;
 	_sound = NULL;
@@ -211,9 +210,9 @@ Common::Error SagaEngine::run() {
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
 	_readingSpeed = getTalkspeed();
 	_copyProtection = ConfMan.getBool("copy_protection");
-	_gf_wyrmkeep = false;
 	_musicWasPlaying = false;
 	_isIHNMDemo = Common::File::exists("music.res");
+	_hasITESceneSubstitutes = Common::File::exists("boarhall.bbm");
 
 	if (_readingSpeed > 3)
 		_readingSpeed = 0;
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 23258e1..3368836 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -137,16 +137,12 @@ enum GameFileTypes {
 };
 
 enum GameFeatures {
-	GF_WYRMKEEP          = 1 << 0,
-	GF_ITE_FLOPPY        = 1 << 1,
-	GF_SCENE_SUBSTITUTES = 1 << 2,
+	GF_ITE_FLOPPY        = 1 << 0,
 #if 0
-	GF_OLD_ITE_DOS       = 1 << 3, 	// Currently unused
+	GF_OLD_ITE_DOS       = 1 << 1, 	// Currently unused
 #endif
-	GF_MONO_MUSIC        = 1 << 4,
-	GF_EXTRA_ITE_CREDITS = 1 << 5,
-	GF_LE_VOICES         = 1 << 6,
-	GF_8BIT_UNSIGNED_PCM = 1 << 7
+	GF_EXTRA_ITE_CREDITS = 1 << 2,
+	GF_8BIT_UNSIGNED_PCM = 1 << 3
 };
 
 enum VerbTypeIds {
@@ -532,9 +528,9 @@ public:
 	int _readingSpeed;
 
 	bool _copyProtection;
-	bool _gf_wyrmkeep;
 	bool _musicWasPlaying;
 	bool _isIHNMDemo;
+	bool _hasITESceneSubstitutes;
 
 	SndRes *_sndRes;
 	Sound *_sound;
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index 66ee8f4..61e62d5 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -451,7 +451,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
 
 	// This is used for latter ITE demos where all places on world map except
 	// Tent Faire are substituted with LBM picture and short description
-	if (_vm->getFeatures() & GF_SCENE_SUBSTITUTES) {
+	if (_vm->_hasITESceneSubstitutes) {
 		for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) {
 			if (sceneSubstitutes[i].sceneId == sceneNumber) {
 				Surface bbmBuffer;
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 2433c93..add34e2 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -262,9 +262,12 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
 			buffer.flags |= Audio::FLAG_UNSIGNED;
 			buffer.flags &= ~Audio::FLAG_16BITS;
 		} else {
-			// Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded
-			if (!uncompressedSound && !scumm_stricmp(context->fileName(), "voicesd.rsc"))
+			// Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded.
+			// These are LE in all the Windows and Mac demos
+			if (!uncompressedSound && !scumm_stricmp(context->fileName(), "voicesd.rsc")) {
 				resourceType = kSoundVOX;
+				buffer.flags |= Audio::FLAG_LITTLE_ENDIAN;
+			}
 		}
 	}
 	buffer.buffer = NULL;
@@ -272,8 +275,6 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
 	// Check for LE sounds
 	if (!context->isBigEndian())
 		buffer.flags |= Audio::FLAG_LITTLE_ENDIAN;
-	if ((context->fileType() & GAME_VOICEFILE) && (_vm->getFeatures() & GF_LE_VOICES))
-		buffer.flags |= Audio::FLAG_LITTLE_ENDIAN;
 
 	// Older Mac versions of ITE were Macbinary packed
 	int soundOffset = (context->fileType() & GAME_MACBINARY) ? 36 : 0;






More information about the Scummvm-git-logs mailing list