aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-29 16:27:23 +0000
committerFilippos Karapetis2009-10-29 16:27:23 +0000
commit6eea032245a6b3d34b5e830e2d98ed20be5dcc90 (patch)
treeff29fb089c65bd3dd5503ef570d18450c287fcb0
parentcaa5136b5cc1ba9471fd86d90c13e6c5bf8acde1 (diff)
downloadscummvm-rg350-6eea032245a6b3d34b5e830e2d98ed20be5dcc90.tar.gz
scummvm-rg350-6eea032245a6b3d34b5e830e2d98ed20be5dcc90.tar.bz2
scummvm-rg350-6eea032245a6b3d34b5e830e2d98ed20be5dcc90.zip
Disable the "Delete" button for all versions of SQ4 floppy, and the "Change Directory" button for all games (English and non-English versions)
svn-id: r45503
-rw-r--r--engines/sci/engine/kfile.cpp1
-rw-r--r--engines/sci/engine/kgraphics.cpp24
2 files changed, 12 insertions, 13 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index afaa648955..5d325b1076 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -454,7 +454,6 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
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);
}
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index dbe3d2c109..94164cae7b 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -621,13 +621,15 @@ reg_t kAssertPalette(EngineState *s, int argc, reg_t *argv) {
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 @@ static void disableCertainButtons(SegManager *segMan, Common::String gameName, r
* 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 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
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;
}