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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Oct 29 17:27:24 CET 2009


Revision: 45503
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45503&view=rev
Author:   thebluegr
Date:     2009-10-29 16:27:23 +0000 (Thu, 29 Oct 2009)

Log Message:
-----------
Disable the "Delete" button for all versions of SQ4 floppy, and the "Change Directory" button for all games (English and non-English versions)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kfile.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2009-10-29 16:05:24 UTC (rev 45502)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-10-29 16:27:23 UTC (rev 45503)
@@ -454,7 +454,6 @@
 		listSavegames(saves);
 		int savedir_nr = saves[savegame_id].id;
 		Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
-		//printf("Deleting savegame '%s'\n", filename.c_str());
 		Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
 		saveFileMan->removeSavefile(filename);
 		}

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-29 16:05:24 UTC (rev 45502)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-29 16:27:23 UTC (rev 45503)
@@ -621,13 +621,15 @@
 	return s->r_acc;
 }
 
-static void disableCertainButtons(SegManager *segMan, Common::String gameName, reg_t obj) {
-	reg_t text_pos = GET_SEL32(segMan, obj, text);
+static void disableCertainButtons(EngineState *s, Common::String gameName, reg_t obj) {
+	reg_t text_pos = GET_SEL32(s->_segMan, obj, text);
 	Common::String text;
 	if (!text_pos.isNull())
-		text = segMan->getString(text_pos);
-	int type = GET_SEL32V(segMan, obj, type);
-	int state = GET_SEL32V(segMan, obj, state);
+		text = s->_segMan->getString(text_pos);
+	Common::String englishText = s->getLanguageString(text.c_str(), K_LANG_ENGLISH);
+	englishText.trim();
+	int type = GET_SEL32V(s->_segMan, obj, type);
+	int state = GET_SEL32V(s->_segMan, obj, state);
 
 	/*
 	 * WORKAROUND: The function is a "prevent the user from doing something
@@ -648,17 +650,15 @@
 	 * effort (see above), and to simply disable the delete functionality for
 	 * that game - bringing the save/load dialog on a par with SCI0.
 	 */
-	// NOTE: This _only_ works with the English version
 	if (type == SCI_CONTROLS_TYPE_BUTTON && (gameName == "sq4") &&
-			getSciVersion() < SCI_VERSION_1_1 && text == " Delete ") {
-		PUT_SEL32V(segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
+			getSciVersion() < SCI_VERSION_1_1 && englishText == "Delete") {
+		PUT_SEL32V(s->_segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
 	}
 
 	// Disable the "Change Directory" button, as we don't allow the game engine to
 	// change the directory where saved games are placed
-	// NOTE: This _only_ works with the English version
-	if (type == SCI_CONTROLS_TYPE_BUTTON && text == "Change\r\nDirectory") {
-		PUT_SEL32V(segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
+	if (type == SCI_CONTROLS_TYPE_BUTTON && englishText == "Change\r\nDirectory") {
+		PUT_SEL32V(s->_segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
 	}
 }
 
@@ -783,7 +783,7 @@
 reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) {
 	reg_t controlObject = argv[0];
 
-	disableCertainButtons(s->_segMan, s->_gameName, controlObject);
+	disableCertainButtons(s, s->_gameName, controlObject);
 	_k_GenericDrawControl(s, controlObject, false);
 	return NULL_REG;
 }


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