[Scummvm-cvs-logs] SF.net SVN: scummvm:[49968] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jun 18 01:14:34 CEST 2010


Revision: 49968
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49968&view=rev
Author:   fingolfin
Date:     2010-06-17 23:14:34 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
SCI: Change SciEngine's 'char *getGameID()' to 'Common::String getGameId()'

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/kpathing.cpp
    scummvm/trunk/engines/sci/graphics/palette.cpp
    scummvm/trunk/engines/sci/graphics/picture.cpp
    scummvm/trunk/engines/sci/graphics/ports.cpp
    scummvm/trunk/engines/sci/graphics/screen.cpp
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sci.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/console.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -424,7 +424,7 @@
 
 	bool hasVocab997 = g_sci->getResMan()->testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS)) ? true : false;
 
-	DebugPrintf("Game ID: %s\n", _engine->getGameID());
+	DebugPrintf("Game ID: %s\n", _engine->getGameId().c_str());
 	DebugPrintf("Emulated interpreter version: %s\n", getSciVersionDesc(getSciVersion()));
 	DebugPrintf("\n");
 	DebugPrintf("Detected features:\n");

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -747,7 +747,7 @@
 		// In SCI1.1, kSetSynonyms is an empty function
 		_kernelNames[0x26] = "Empty";
 
-		if (!strcmp(g_sci->getGameID(), "kq6")) {
+		if (g_sci->getGameId() == "kq6") {
 			// In the Windows version of KQ6 CD, the empty kSetSynonyms
 			// function has been replaced with kPortrait. In KQ6 Mac,
 			// kPlayBack has been replaced by kShowMovie.
@@ -755,7 +755,7 @@
 				_kernelNames[0x26] = "Portrait";
 			else if (g_sci->getPlatform() == Common::kPlatformMacintosh)
 				_kernelNames[0x84] = "ShowMovie";
-		} else if (!strcmp(g_sci->getGameID(), "qfg4") && g_sci->isDemo()) {
+		} else if (g_sci->getGameId() == "qfg4" && g_sci->isDemo()) {
 			_kernelNames[0x7b] = "RemapColors"; // QFG4 Demo has this SCI2 function instead of StrSplit
 		}
 

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -534,7 +534,7 @@
 
 	// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
 	// till the actual problem is found
-	if (!strcmp(g_sci->getGameID(), "lsl1sci") && s->currentRoomNumber() == 300) {
+	if (g_sci->getGameId() == "lsl1sci" && s->currentRoomNumber() == 300) {
 		int top = readSelectorValue(s->_segMan, object, SELECTOR(brTop));
 		writeSelectorValue(s->_segMan, object, SELECTOR(brTop), top + 2);
 	}
@@ -807,7 +807,7 @@
 			//  ALL other games use a hardcoded -1 (madness!)
 			// We are detecting jones/talkie as "jones" as well, but the sierra interpreter of talkie doesnt have this
 			//  "hack". Hopefully it wont cause regressions (the code causes regressions if used against kq5/floppy)
-			if (!strcmp(g_sci->getGameID(), "jones"))
+			if (g_sci->getGameId() == "jones")
 				priority = readSelectorValue(s->_segMan, controlObject, SELECTOR(priority));
 			else
 				priority = -1;
@@ -991,7 +991,7 @@
 	bool hiresMode = (argc > 7) ? true : false;
 	reg_t upscaledHiresHandle = (argc > 7) ? argv[7] : NULL_REG;
 
-	if (!strcmp(g_sci->getGameID(), "freddypharkas") || !strcmp(g_sci->getGameID(), "freddypharkas-demo")) {
+	if (g_sci->getGameId() == "freddypharkas" || g_sci->getGameId() == "freddypharkas-demo") {
 		// WORKAROUND
 		// Script 24 contains code that draws the game menu on screen. It uses a temp variable for setting priority that
 		//  is not set. in Sierra sci this happens to be 8250h. In our sci temporary variables are initialized thus we would
@@ -1002,7 +1002,7 @@
 			priority = 15;
 	}
 
-	if (!strcmp(g_sci->getGameID(), "laurabow2")) {
+	if (g_sci->getGameId() == "laurabow2") {
 		// WORKAROUND
 		// see the one above
 		if ((viewId == 995) && (priority == 0))

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -59,9 +59,9 @@
 	// LSL3 calculates a machinespeed variable during game startup (right after the filthy questions)
 	//  This one would go through w/o throttling resulting in having to do 1000 pushups or something
 	//  Another way of handling this would be delaying incrementing of "machineSpeed" selector
-	if (!strcmp(g_sci->getGameID(), "lsl3") && s->currentRoomNumber() == 290)
+	if (g_sci->getGameId() == "lsl3" && s->currentRoomNumber() == 290)
 		s->_throttleTrigger = true;
-	if (!strcmp(g_sci->getGameID(), "iceman") && s->currentRoomNumber() == 27) {
+	if (g_sci->getGameId() == "iceman" && s->currentRoomNumber() == 27) {
 		s->_throttleTrigger = true;
 		neededSleep = 60;
 	}

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -1056,7 +1056,7 @@
 
 	// WORKAROUND: broken polygon in lsl1sci, room 350, after opening elevator
 	// Polygon has 17 points but size is set to 19
-	if ((size == 19) && !strcmp(g_sci->getGameID(), "lsl1sci")) {
+	if ((size == 19) && g_sci->getGameId() == "lsl1sci") {
 		if ((s->currentRoomNumber() == 350)
 		&& (read_point(segMan, points, 18) == Common::Point(108, 137))) {
 			debug(1, "Applying fix for broken polygon in lsl1sci, room 350");
@@ -1174,7 +1174,7 @@
 
 		// WORKAROUND LSL5 room 660. Priority glitch due to us choosing a different path
 		// than SSCI. Happens when Patti walks to the control room.
-		if (!strcmp(g_sci->getGameID(), "lsl5") && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) {
+		if (g_sci->getGameId() == "lsl5" && (s->currentRoomNumber() == 660) && (Common::Point(67, 131) == *new_start) && (Common::Point(229, 101) == *new_end)) {
 			debug(1, "[avoidpath] Applying fix for priority problem in LSL5, room 660");
 			pf_s->_prependPoint = new_start;
 			new_start = new Common::Point(77, 107);

Modified: scummvm/trunk/engines/sci/graphics/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/graphics/palette.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -66,11 +66,11 @@
 	//  and those will overwrite the current palette in that case
 	// Quest for Glory 3 demo and police quest 1 vga behave the same interpreter wise and all have glitches, if we don't
 	//  switch back
-	if (!strcmp(g_sci->getGameID(), "laurabow2") && (g_sci->isDemo()))
+	if (g_sci->getGameId() == "laurabow2" && (g_sci->isDemo()))
 		_alwaysForceRealMerge = true;
-	if (!strcmp(g_sci->getGameID(), "qfg3") && (g_sci->isDemo()))
+	else if (g_sci->getGameId() == "qfg3" && (g_sci->isDemo()))
 		_alwaysForceRealMerge = true;
-	if (!strcmp(g_sci->getGameID(), "pq1sci"))
+	else if (g_sci->getGameId() == "pq1sci")
 		_alwaysForceRealMerge = true;
 }
 

Modified: scummvm/trunk/engines/sci/graphics/picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/picture.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/graphics/picture.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -437,7 +437,7 @@
 			memcpy(&EGApalettes[i], &vector_defaultEGApalette, sizeof(vector_defaultEGApalette));
 		memcpy(&EGApriority, &vector_defaultEGApriority, sizeof(vector_defaultEGApriority));
 
-		if (strcmp(g_sci->getGameID(), "iceman") == 0) {
+		if (g_sci->getGameId() == "iceman") {
 			// WORKAROUND: we remove certain visual&priority lines in underwater rooms of iceman, when not dithering the
 			//              picture. Normally those lines aren't shown, because they share the same color as the dithered
 			//              fill color combination. When not dithering, those lines would appear and get distracting.
@@ -532,7 +532,7 @@
 		//  inside picture data for such games
 		case PIC_OP_SET_PATTERN:
 			if (_resourceType >= SCI_PICTURE_TYPE_SCI11) {
-				if (strcmp(g_sci->getGameID(), "sq4") == 0) {
+				if (g_sci->getGameId() == "sq4") {
 					// WORKAROUND: For SQ4 / for some pictures handle this like a terminator
 					//  This picture includes garbage data, first a set pattern w/o parameter and then short pattern
 					//  I guess that garbage is a left over from the sq4-floppy (sci1) to sq4-cd (sci1.1) conversion

Modified: scummvm/trunk/engines/sci/graphics/ports.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/ports.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/graphics/ports.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -87,7 +87,7 @@
 	// Jones, Slater and Hoyle 3 were called with parameter -Nw 0 0 200 320.
 	// Mother Goose (SCI1) uses -Nw 0 0 159 262. The game will later use SetPort so we don't need to set the other fields.
 	// This actually meant not skipping the first 10 pixellines in windowMgrPort
-	Common::String gameId = g_sci->getGameID();
+	Common::String gameId = g_sci->getGameId();
 	if (gameId == "jones" || gameId == "slater" || gameId == "hoyle3" || (gameId == "mothergoose" && getSciVersion() == SCI_VERSION_1_EARLY))
 		offTop = 0;
 

Modified: scummvm/trunk/engines/sci/graphics/screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/screen.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/graphics/screen.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -97,9 +97,9 @@
 	if (_resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1) {
 		// For SCI1.1 Mac, we need to expand the screen to accommodate for
 		// the icon bar. Of course, both KQ6 and QFG1 VGA differ in size.
-		if (!scumm_stricmp(g_sci->getGameID(), "kq6"))
+		if (g_sci->getGameId() == "kq6")
 			initGraphics(_displayWidth, _displayHeight + 26, _displayWidth > 320);
-		else if (!scumm_stricmp(g_sci->getGameID(), "qfg1"))
+		else if (g_sci->getGameId() == "qfg1")
 			initGraphics(_displayWidth, _displayHeight + 20, _displayWidth > 320);
 		else
 			error("Unknown SCI1.1 Mac game");

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-17 23:14:34 UTC (rev 49968)
@@ -72,7 +72,7 @@
 class GfxDriver;
 
 SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
-		: Engine(syst), _gameDescription(desc) {
+		: Engine(syst), _gameDescription(desc), _gameId(_gameDescription->gameid) {
 
 	assert(g_sci == 0);
 	g_sci = this;
@@ -128,7 +128,7 @@
 
 	// Add the patches directory, except for KQ6CD; The patches folder in some versions of KQ6CD
 	// is for the demo of Phantasmagoria, included in the disk
-	if (strcmp(getGameID(), "kq6"))
+	if (_gameId != "kq6")
 		SearchMan.addSubDirectoryMatching(gameDataDir, "patches");	// resource patches
 }
 
@@ -167,7 +167,7 @@
 */
 
 	// Add the after market GM patches for the specified game, if they exist
-	_resMan->addNewGMPatch(getGameID());
+	_resMan->addNewGMPatch(_gameId);
 	_gameObj = _resMan->findGameObject();
 
 	SegManager *segMan = new SegManager(_resMan);
@@ -179,10 +179,10 @@
 	//  gk1/floppy does support upscaled hires scriptswise, but doesn't actually have the hires content we need to limit
 	//  it to platform windows.
 	if (getPlatform() == Common::kPlatformWindows) {
-		if (!strcmp(getGameID(), "kq6"))
+		if (_gameId == "kq6")
 			upscaledHires = GFX_SCREEN_UPSCALED_640x440;
 #ifdef ENABLE_SCI32
-		if (!strcmp(getGameID(), "gk1"))
+		if (_gameId == "gk1")
 			upscaledHires = GFX_SCREEN_UPSCALED_640x480;
 #endif
 	}
@@ -494,10 +494,6 @@
 	return _console;
 }
 
-const char* SciEngine::getGameID() const {
-	return _gameDescription->gameid;
-}
-
 Common::Language SciEngine::getLanguage() const {
 	return _gameDescription->language;
 }
@@ -523,14 +519,12 @@
 }
 
 Common::String SciEngine::getFilePrefix() const {
-	const char* gameID = getGameID();
-	if (!strcmp(gameID, "qfg2")) {
+	if (_gameId == "qfg2") {
 		// Quest for Glory 2 wants to read files from Quest for Glory 1 (EGA/VGA) to import character data
 		if (_gamestate->currentRoomNumber() == 805)
 			return "qfg1";
 		// TODO: Include import-room for qfg1vga
-	}
-	if (!strcmp(gameID, "qfg3")) {
+	} else if (_gameId == "qfg3") {
 		// Quest for Glory 3 wants to read files from Quest for Glory 2 to import character data
 		if (_gamestate->currentRoomNumber() == 54)
 			return "qfg2";

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2010-06-17 23:13:54 UTC (rev 49967)
+++ scummvm/trunk/engines/sci/sci.h	2010-06-17 23:14:34 UTC (rev 49968)
@@ -151,7 +151,7 @@
 	bool canSaveGameStateCurrently();
 	void syncSoundSettings();
 
-	const char* getGameID() const;
+	const Common::String &getGameId() const { return _gameId; }
 	int getResourceVersion() const;
 	Common::Language getLanguage() const;
 	Common::Platform getPlatform() const;
@@ -265,6 +265,7 @@
 	void initStackBaseWithSelector(Selector selector);
 
 	const ADGameDescription *_gameDescription;
+	const Common::String _gameId;
 	ResourceManager *_resMan; /**< The resource manager */
 	EngineState *_gamestate;
 	Kernel *_kernel;


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