[Scummvm-cvs-logs] scummvm master -> 85ca13db4b192b5993f1b291d90cce85ad94fb98

bluegr md5 at scummvm.org
Mon Mar 26 23:24:28 CEST 2012


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

Summary:
98b60f1af8 DREAMWEB: Slight cleanup of DreamWebEngine::animPointer()
85ca13db4b AGI: Use the ScummVM dialogs for saving/loading


Commit: 98b60f1af88c94fde1244bab53a13f61345ad945
    https://github.com/scummvm/scummvm/commit/98b60f1af88c94fde1244bab53a13f61345ad945
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-03-26T14:21:48-07:00

Commit Message:
DREAMWEB: Slight cleanup of DreamWebEngine::animPointer()

Changed paths:
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 9789e20..8226982 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1621,8 +1621,7 @@ void DreamWebEngine::animPointer() {
 			if (_pointerCount == 16)
 				_pointerCount = 0;
 		}
-		static const uint8 flashMouseTab[] = { 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2 };
-		_pointerFrame = flashMouseTab[_pointerCount];
+		_pointerFrame = (_pointerCount <= 8) ? 1 : 2;
 		return;
 	}
 	if (_vars._watchingTime != 0) {


Commit: 85ca13db4b192b5993f1b291d90cce85ad94fb98
    https://github.com/scummvm/scummvm/commit/85ca13db4b192b5993f1b291d90cce85ad94fb98
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-03-26T14:21:50-07:00

Commit Message:
AGI: Use the ScummVM dialogs for saving/loading

An option has been added to use the original ones, if needed

Changed paths:
    README
    engines/agi/agi.cpp
    engines/agi/agi.h
    engines/agi/detection.cpp
    engines/agi/saveload.cpp
    po/POTFILES



diff --git a/README b/README
index a12ba07..91dca99 100644
--- a/README
+++ b/README
@@ -2066,6 +2066,11 @@ The following keywords are recognized:
 
     boot_param         number   Pass this number to the boot script
 
+Sierra games using the AGI engine add the following non-standard keywords:
+
+    originalsaveload   bool     If true, the original save/load screens are
+                                used instead of the enhanced ScummVM ones
+
 Sierra games using the SCI engine add the following non-standard keywords:
 
     disable_dithering  bool     Remove dithering artifacts from EGA games
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 137d607..3adcf96 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -498,6 +498,9 @@ static const GameSettings agiSettings[] = {
 };
 
 AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+	// Assign default values to the config manager, in case settings are missing
+	ConfMan.registerDefault("originalsaveload", "false");
+
 	_noSaveLoadAllowed = false;
 
 	_rnd = new Common::RandomSource("agi");
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index cebee42..520b0aa 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -890,6 +890,9 @@ public:
 	int saveGameSimple();
 	int loadGameDialog();
 	int loadGameSimple();
+	int doSave(int slot, const Common::String &desc);
+	int doLoad(int slot, bool showMessages);
+	int scummVMSaveLoadDialog(bool isSave);
 
 	uint8 *_intobj;
 	InputMode _oldMode;
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 982dce8..7c7394e 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -31,6 +31,8 @@
 #include "common/md5.h"
 #include "common/savefile.h"
 #include "common/textconsole.h"
+#include "common/translation.h"
+
 #include "graphics/thumbnail.h"
 #include "graphics/surface.h"
 
@@ -139,6 +141,13 @@ static const PlainGameDescriptor agiGames[] = {
 	{0, 0}
 };
 
+static const ExtraGuiOption agiExtraGuiOption = {
+	_s("Use original save/load screens"),
+	_s("Use the original save/load screens, instead of the ScummVM ones"),
+	"originalsaveload",
+	false
+};
+
 #include "agi/detection_tables.h"
 
 using namespace Agi;
@@ -162,6 +171,7 @@ public:
 
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+	virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
 	virtual SaveStateList listSaves(const char *target) const;
 	virtual int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
@@ -219,6 +229,12 @@ bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD
 	return res;
 }
 
+const ExtraGuiOptions AgiMetaEngine::getExtraGuiOptions(const Common::String &target) const {
+	ExtraGuiOptions options;
+	options.push_back(agiExtraGuiOption);
+	return options;
+}
+
 SaveStateList AgiMetaEngine::listSaves(const char *target) const {
 	const uint32 AGIflag = MKTAG('A','G','I',':');
 	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 0ef6230..04054da 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -29,6 +29,10 @@
 #include "common/config-manager.h"
 #include "common/savefile.h"
 #include "common/textconsole.h"
+#include "common/translation.h"
+
+#include "gui/saveload.h"
+
 #include "graphics/thumbnail.h"
 #include "graphics/surface.h"
 
@@ -784,7 +788,87 @@ int AgiEngine::selectSlot() {
 	return rc;
 }
 
+int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
+	const EnginePlugin *plugin = NULL;
+	EngineMan.findGame(ConfMan.get("gameid"), &plugin);
+	GUI::SaveLoadChooser *dialog;
+	Common::String desc;
+	int slot;
+
+	if (isSave) {
+		dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
+		dialog->setSaveMode(true);
+
+		slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+		desc = dialog->getResultString();
+
+		if (desc.empty()) {
+			// create our own description for the saved game, the user didnt enter it
+#if defined(USE_SAVEGAME_TIMESTAMP)
+			TimeDate curTime;
+			g_system->getTimeAndDate(curTime);
+			curTime.tm_year += 1900; // fixup year
+			curTime.tm_mon++; // fixup month
+			desc = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+#else
+			desc = Common::String::format("Save %d", slot + 1);
+#endif
+		}
+
+		if (desc.size() > 28)
+			desc = Common::String(desc.c_str(), 28);
+	} else {
+		dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"));
+		dialog->setSaveMode(false);
+		slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+	}
+
+	delete dialog;
+
+	if (isSave)
+		return doSave(slot, desc);
+	else
+		return doLoad(slot, false);
+}
+
+int AgiEngine::doSave(int slot, const Common::String &desc) {
+	Common::String fileName = getSavegameFilename(slot);
+	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+
+	// Make sure all graphics was blitted to screen. This fixes bug
+	// #2960567: "AGI: Ego partly erased in Load/Save thumbnails"
+	_gfx->doUpdate();
+
+	return saveGame(fileName, desc);
+}
+
+int AgiEngine::doLoad(int slot, bool showMessages) {
+	Common::String fileName = getSavegameFilename(slot);
+	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+
+	_sprites->eraseBoth();
+	_sound->stopSound();
+	closeWindow();
+
+	int result = loadGame(fileName);
+
+	if (result == errOK) {
+		if (showMessages)
+			messageBox("Game restored.");
+		_game.exitAllLogics = 1;
+		_menu->enableAll();
+	} else {
+		if (showMessages)
+			messageBox("Error restoring game.");
+	}
+
+	return result;
+}
+
 int AgiEngine::saveGameDialog() {
+	if (!ConfMan.getBool("originalsaveload"))
+		return scummVMSaveLoadDialog(true);
+
 	char *desc;
 	const char *buttons[] = { "Do as I say!", "I regret", NULL };
 	char dstr[200];
@@ -854,14 +938,7 @@ int AgiEngine::saveGameDialog() {
 		return errOK;
 	}
 
-	Common::String fileName = getSavegameFilename(_firstSlot + slot);
-	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
-
-	// Make sure all graphics was blitted to screen. This fixes bug
-	// #2960567: "AGI: Ego partly erased in Load/Save thumbnails"
-	_gfx->doUpdate();
-
-	int result = saveGame(fileName, desc);
+	int result = doSave(_firstSlot + slot, desc);
 
 	if (result == errOK)
 		messageBox("Game saved.");
@@ -872,6 +949,9 @@ int AgiEngine::saveGameDialog() {
 }
 
 int AgiEngine::saveGameSimple() {
+	if (!ConfMan.getBool("originalsaveload"))
+		return scummVMSaveLoadDialog(true);
+
 	Common::String fileName = getSavegameFilename(0);
 
 	int result = saveGame(fileName, "Default savegame");
@@ -881,7 +961,10 @@ int AgiEngine::saveGameSimple() {
 }
 
 int AgiEngine::loadGameDialog() {
-	int rc, slot = 0;
+	if (!ConfMan.getBool("originalsaveload"))
+		return scummVMSaveLoadDialog(false);
+
+	int slot = 0;
 	int hm, vm, hp, vp;	// box margins
 	int w;
 
@@ -907,37 +990,14 @@ int AgiEngine::loadGameDialog() {
 		return errOK;
 	}
 
-	Common::String fileName = getSavegameFilename(_firstSlot + slot);
-
-	if ((rc = loadGame(fileName)) == errOK) {
-		messageBox("Game restored.");
-		_game.exitAllLogics = 1;
-		_menu->enableAll();
-	} else {
-		messageBox("Error restoring game.");
-	}
-
-	return rc;
+	return doLoad(_firstSlot + slot, true);
 }
 
 int AgiEngine::loadGameSimple() {
-	int rc = 0;
-
-	Common::String fileName = getSavegameFilename(0);
-
-	_sprites->eraseBoth();
-	_sound->stopSound();
-	closeWindow();
-
-	if ((rc = loadGame(fileName)) == errOK) {
-		messageBox("Game restored.");
-		_game.exitAllLogics = 1;
-		_menu->enableAll();
-	} else {
-		messageBox("Error restoring game.");
-	}
-
-	return rc;
+	if (!ConfMan.getBool("originalsaveload"))
+		return scummVMSaveLoadDialog(false);
+	else
+		return doLoad(0, true);
 }
 
 void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
diff --git a/po/POTFILES b/po/POTFILES
index 7241b2b..8b74115 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -23,6 +23,8 @@ common/util.cpp
 engines/advancedDetector.cpp
 engines/dialogs.cpp
 engines/engine.cpp
+engines/agi/detection.cpp
+engines/agi/saveload.cpp
 engines/dreamweb/detection.cpp
 engines/sci/detection.cpp
 engines/scumm/dialogs.cpp






More information about the Scummvm-git-logs mailing list