[Scummvm-cvs-logs] scummvm master -> 453fab3de1aa1eb994488c5a6c1f27d7eb2b0ce3

bluegr md5 at scummvm.org
Sun Sep 25 20:34:33 CEST 2011


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:
0e4b35a8e8 AGI: Switched to Common::String in the save/load code
453fab3de1 SCI: Added a workaround for bug #3295652 - "AGI: (Fan) SQ0: Animation overdraws some of the text window" and removed som


Commit: 0e4b35a8e8dad861c0890ee4edfbf6271b07397f
    https://github.com/scummvm/scummvm/commit/0e4b35a8e8dad861c0890ee4edfbf6271b07397f
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-25T11:25:25-07:00

Commit Message:
AGI: Switched to Common::String in the save/load code

Changed paths:
    engines/agi/agi.h
    engines/agi/cycle.cpp
    engines/agi/preagi.h
    engines/agi/saveload.cpp



diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 447e55e..c2af0c5 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -809,8 +809,8 @@ public:
 	virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
 		int16 p4, int16 p5, int16 p6, int16 p7) = 0;
 	virtual void releaseImageStack() = 0;
-	virtual	int saveGame(const char *fileName, const char *saveName) = 0;
-	virtual int loadGame(const char *fileName, bool checkId = true) = 0;
+	virtual	int saveGame(Common::String fileName, Common::String saveName) = 0;
+	virtual int loadGame(Common::String fileName, bool checkId = true) = 0;
 
 	int _soundemu;
 
@@ -881,13 +881,13 @@ public:
 
 	StringData _stringdata;
 
-	void getSavegameFilename(int num, char *fileName);
+	Common::String getSavegameFilename(int num);
 	void getSavegameDescription(int num, char *buf, bool showEmpty = true);
 	int selectSlot();
-	int saveGame(const char *fileName, const char *saveName);
+	int saveGame(Common::String fileName, Common::String saveName);
+	int loadGame(Common::String fileName, bool checkId = true);
 	int saveGameDialog();
 	int saveGameSimple();
-	int loadGame(const char *fileName, bool checkId = true);
 	int loadGameDialog();
 	int loadGameSimple();
 
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index f77ef79..e6f122f 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -361,9 +361,7 @@ int AgiEngine::playGame() {
 		}
 
 		if (shouldPerformAutoSave(_lastSaveTime)) {
-			char fileName[MAXPATHLEN];
-			getSavegameFilename(0, fileName);
-			saveGame(fileName, "Autosave");
+			saveGame(getSavegameFilename(0), "Autosave");
 		}
 
 	} while (!(shouldQuit() || _restartGame));
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h
index 14ff483..6f534c3 100644
--- a/engines/agi/preagi.h
+++ b/engines/agi/preagi.h
@@ -73,8 +73,8 @@ protected:
 	void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
 		int16 p4, int16 p5, int16 p6, int16 p7) {}
 	void releaseImageStack() {}
-	int saveGame(const char *fileName, const char *saveName) { return -1; }
-	int loadGame(const char *fileName, bool checkId = true) { return -1; }
+	int saveGame(Common::String fileName, Common::String saveName) { return -1; }
+	int loadGame(Common::String fileName, bool checkId = true) { return -1; }
 
 	// Game
 	Common::String getTargetName() { return _targetName; }
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 648cb6f..f919a9a 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -53,22 +53,22 @@ namespace Agi {
 
 static const uint32 AGIflag = MKTAG('A','G','I',':');
 
-int AgiEngine::saveGame(const char *fileName, const char *description) {
+int AgiEngine::saveGame(Common::String fileName, Common::String description) {
 	char gameIDstring[8] = "gameIDX";
 	int i;
 	Common::OutSaveFile *out;
 	int result = errOK;
 
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName, description);
+	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName.c_str(), description);
 	if (!(out = _saveFileMan->openForSaving(fileName))) {
-		warning("Can't create file '%s', game not saved", fileName);
+		warning("Can't create file '%s', game not saved", fileName.c_str());
 		return errBadFileOpen;
 	} else {
-		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName);
+		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName.c_str());
 	}
 
 	out->writeUint32BE(AGIflag);
-	out->write(description, 31);
+	out->write(description.c_str(), 31);
 
 	out->writeByte(SAVEGAME_VERSION);
 	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save game version (%d)", SAVEGAME_VERSION);
@@ -239,33 +239,33 @@ int AgiEngine::saveGame(const char *fileName, const char *description) {
 
 	out->finalize();
 	if (out->err()) {
-		warning("Can't write file '%s'. (Disk full?)", fileName);
+		warning("Can't write file '%s'. (Disk full?)", fileName.c_str());
 		result = errIOError;
 	} else
-		debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description, fileName);
+		debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description, fileName.c_str());
 
 	delete out;
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);
+	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
 
 	_lastSaveTime = _system->getMillis();
 
 	return result;
 }
 
-int AgiEngine::loadGame(const char *fileName, bool checkId) {
+int AgiEngine::loadGame(Common::String fileName, bool checkId) {
 	char description[31], saveVersion, loadId[8];
 	int i, vtEntries = MAX_VIEWTABLE;
 	uint8 t;
 	int16 parm[7];
 	Common::InSaveFile *in;
 
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName);
+	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str());
 
 	if (!(in = _saveFileMan->openForLoading(fileName))) {
-		warning("Can't open file '%s', game not loaded", fileName);
+		warning("Can't open file '%s', game not loaded", fileName.c_str());
 		return errBadFileOpen;
 	} else {
-		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName);
+		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
 	}
 
 	uint32 typea = in->readUint32BE();
@@ -527,7 +527,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) {
 		_gfx->setAGIPal(in->readSint16BE());
 
 	delete in;
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);
+	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
 
 	setflag(fRestoreJustRan, true);
 
@@ -546,28 +546,27 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) {
 #define NUM_SLOTS 100
 #define NUM_VISIBLE_SLOTS 12
 
-void AgiEngine::getSavegameFilename(int num, char *fileName) {
+Common::String AgiEngine::getSavegameFilename(int num) {
 	Common::String saveLoadSlot = _targetName;
 	saveLoadSlot += Common::String::format(".%.3d", num);
-	strcpy(fileName, saveLoadSlot.c_str());
+	return saveLoadSlot;
 }
 
 void AgiEngine::getSavegameDescription(int num, char *buf, bool showEmpty) {
-	char fileName[MAXPATHLEN];
 	Common::InSaveFile *in;
+	Common::String fileName = getSavegameFilename(num);
 
 	debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Current game id is %s", _targetName.c_str());
-	getSavegameFilename(num, fileName);
 
 	if (!(in = _saveFileMan->openForLoading(fileName))) {
-		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName);
+		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName.c_str());
 
 		if (showEmpty)
 			strcpy(buf, "        (empty slot)");
 		else
 			*buf = 0;
 	} else {
-		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName);
+		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
 
 		uint32 type = in->readUint32BE();
 
@@ -783,7 +782,6 @@ getout:
 }
 
 int AgiEngine::saveGameDialog() {
-	char fileName[MAXPATHLEN];
 	char *desc;
 	const char *buttons[] = { "Do as I say!", "I regret", NULL };
 	char dstr[200];
@@ -853,14 +851,14 @@ int AgiEngine::saveGameDialog() {
 		return errOK;
 	}
 
-	getSavegameFilename(_firstSlot + slot, fileName);
-	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName);
+	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 = saveGame(fileName.c_str(), desc);
 
 	if (result == errOK)
 		messageBox("Game saved.");
@@ -871,17 +869,15 @@ int AgiEngine::saveGameDialog() {
 }
 
 int AgiEngine::saveGameSimple() {
-	char fileName[MAXPATHLEN];
-	getSavegameFilename(0, fileName);
+	Common::String fileName = getSavegameFilename(0);
 
-	int result = saveGame(fileName, "Default savegame");
+	int result = saveGame(fileName.c_str(), "Default savegame");
 	if (result != errOK)
 		messageBox("Error saving game.");
 	return result;
 }
 
 int AgiEngine::loadGameDialog() {
-	char fileName[MAXPATHLEN];
 	int rc, slot = 0;
 	int hm, vm, hp, vp;	// box margins
 	int w;
@@ -908,9 +904,9 @@ int AgiEngine::loadGameDialog() {
 		return errOK;
 	}
 
-	getSavegameFilename(_firstSlot + slot, fileName);
+	Common::String fileName = getSavegameFilename(_firstSlot + slot);
 
-	if ((rc = loadGame(fileName)) == errOK) {
+	if ((rc = loadGame(fileName.c_str())) == errOK) {
 		messageBox("Game restored.");
 		_game.exitAllLogics = 1;
 		_menu->enableAll();
@@ -922,16 +918,15 @@ int AgiEngine::loadGameDialog() {
 }
 
 int AgiEngine::loadGameSimple() {
-	char fileName[MAXPATHLEN];
 	int rc = 0;
 
-	getSavegameFilename(0, fileName);
+	Common::String fileName = getSavegameFilename(0);
 
 	_sprites->eraseBoth();
 	_sound->stopSound();
 	closeWindow();
 
-	if ((rc = loadGame(fileName)) == errOK) {
+	if ((rc = loadGame(fileName.c_str())) == errOK) {
 		messageBox("Game restored.");
 		_game.exitAllLogics = 1;
 		_menu->enableAll();


Commit: 453fab3de1aa1eb994488c5a6c1f27d7eb2b0ce3
    https://github.com/scummvm/scummvm/commit/453fab3de1aa1eb994488c5a6c1f27d7eb2b0ce3
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-09-25T11:27:12-07:00

Commit Message:
SCI: Added a workaround for bug #3295652 - "AGI: (Fan) SQ0: Animation overdraws some of the text window" and removed some duplicate code

Changed paths:
    engines/agi/detection_tables.h
    engines/agi/text.cpp



diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index a6fb0c9..cb12eaf 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -814,9 +814,9 @@ static const AGIGameDescription gameDescriptions[] = {
 	FANMADE("Snowboarding Demo (v1.0)", "24bb8f29f1eddb5c0a099705267c86e4"),
 	FANMADE("Solar System Tour", "b5a3d0f392dfd76a6aa63f3d5f578403"),
 	FANMADE("Sorceror's Appraisal", "fe62615557b3cb7b08dd60c9d35efef1"),
-	GAME("sq0", "v1.03", "d2fd6f7404e86182458494e64375e590", 0x2917, GID_FANMADE),
-	GAME("sq0", "v1.04", "2ad9d1a4624a98571ee77dcc83f231b6", 0x2917, GID_FANMADE),
-	GAME_PS("sq0", "", "e1a8e4efcce86e1efcaa14633b9eb986", 762, 0x2440, GID_FANMADE, Common::kPlatformCoCo3),
+	GAME("sq0", "v1.03", "d2fd6f7404e86182458494e64375e590", 0x2917, GID_SQ0),
+	GAME("sq0", "v1.04", "2ad9d1a4624a98571ee77dcc83f231b6", 0x2917, GID_SQ0),
+	GAME_PS("sq0", "", "e1a8e4efcce86e1efcaa14633b9eb986", 762, 0x2440, GID_SQ0, Common::kPlatformCoCo3),
 	GAME("sqx", "v10.0 Feb 05", "c992ae2f8ab18360404efdf16fa9edd1", 0x2917, GID_FANMADE),
 	GAME("sqx", "v10.0 Jul 18", "812edec45cefad559d190ffde2f9c910", 0x2917, GID_FANMADE),
 	GAME_PS("sqx", "", "f0a59044475a5fa37c055d8c3eb4d1a7", 768, 0x2440, GID_FANMADE, Common::kPlatformCoCo3),
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 6021e12..9ac60c0 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -437,11 +437,13 @@ int AgiEngine::print(const char *p, int lin, int col, int len) {
 
 	debugC(4, kDebugLevelText, "print(): lin = %d, col = %d, len = %d", lin, col, len);
 
-	if (col == 0 && lin == 0 && len == 0)
-		lin = col = -1;
-
-	if (len == 0)
-		len = 30;
+	// WORKAROUND for SQ0, room 28: when the tree is talking, non-blocking
+	// text boxes are shown and the tree's animation is shown underneath.
+	// The text boxes are drawn too low, and the tree's animation is painted
+	// over them. We cheat here and move the text boxex one line above to
+	// avoid getting them overdrawn. Fixes bug #3295652.
+	if (getGameID() == GID_SQ0 && getvar(0) == 28 && lin == 6)
+		lin = 5;
 
 	blitTextbox(p, lin, col, len);
 






More information about the Scummvm-git-logs mailing list