[Scummvm-cvs-logs] scummvm master -> 54ede63fcc5046f8fec7b59e64b66780fd7a73b5

wjp wjp at usecode.org
Mon Feb 13 21:39:44 CET 2012


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

Summary:
3f5aaa0ca5 SCUMM: Clean up resetSentence
c7a5d31f05 BASS: Report savegame errors when saving by pressing enter
87e85e17cb BASS: Fix savegame corruption
54ede63fcc BASS: Reduce code duplication in autosave code


Commit: 3f5aaa0ca5b77d3e766d5eb8ea51085f072db701
    https://github.com/scummvm/scummvm/commit/3f5aaa0ca5b77d3e766d5eb8ea51085f072db701
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2012-02-13T11:26:43-08:00

Commit Message:
SCUMM: Clean up resetSentence

Changed paths:
    engines/scumm/script_v2.cpp
    engines/scumm/scumm_v2.h



diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 9c8742c..ce162b4 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -873,7 +873,7 @@ void ScummEngine_v2::o2_doSentence() {
 		return;
 	}
 	if (a == 0xFB) {
-		resetSentence(false);
+		resetSentence();
 		return;
 	}
 
@@ -1411,7 +1411,7 @@ void ScummEngine_v2::o2_loadRoomWithEgo() {
 
 	_fullRedraw = true;
 
-	resetSentence(false);
+	resetSentence();
 
 	if (x >= 0 && y >= 0) {
 		a->startWalkActor(x, y, -1);
@@ -1492,7 +1492,7 @@ void ScummEngine_v2::o2_cutscene() {
 
 	_sentenceNum = 0;
 	stopScript(SENTENCE_SCRIPT);
-	resetSentence(false);
+	resetSentence();
 
 	vm.cutScenePtr[0] = 0;
 }
@@ -1640,7 +1640,7 @@ void ScummEngine_v2::o2_switchCostumeSet() {
 		o2_dummy();
 }
 
-void ScummEngine_v2::resetSentence(bool walking) {
+void ScummEngine_v2::resetSentence() {
 	VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
 	VAR(VAR_SENTENCE_OBJECT1) = 0;
 	VAR(VAR_SENTENCE_OBJECT2) = 0;
diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h
index b407fd3..316a08d 100644
--- a/engines/scumm/scumm_v2.h
+++ b/engines/scumm/scumm_v2.h
@@ -87,7 +87,7 @@ protected:
 	void clearStateCommon(byte type);
 	void stopScriptCommon(int script);
 
-	virtual void resetSentence(bool walking);
+	void resetSentence();
 	void setUserState(byte state);
 
 	virtual void handleMouseOver(bool updateInventory);


Commit: c7a5d31f0576fe6ced0ac3170ab89c5df13135ba
    https://github.com/scummvm/scummvm/commit/c7a5d31f0576fe6ced0ac3170ab89c5df13135ba
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2012-02-13T12:21:42-08:00

Commit Message:
BASS: Report savegame errors when saving by pressing enter

This makes error handling consistent between mouse and keyboard.

Changed paths:
    engines/sky/control.cpp



diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 9efa6ce..7741f10 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -878,6 +878,8 @@ uint16 Control::saveRestorePanel(bool allowSave) {
 			clickRes = handleClick(lookList[0]);
 			if (clickRes == GAME_SAVED)
 				saveDescriptions(saveGameTexts);
+			else if (clickRes == NO_DISK_SPACE)
+				displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
 			quitPanel = true;
 			_mouseClicked = false;
 			_keyPressed.reset();


Commit: 87e85e17cbe95821899bee76d978924760d76f89
    https://github.com/scummvm/scummvm/commit/87e85e17cbe95821899bee76d978924760d76f89
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2012-02-13T12:28:32-08:00

Commit Message:
BASS: Fix savegame corruption

When using the GMM or autosaves, _savedMouse and _savedCharSet were
never set. See bug #3487117.

Changed paths:
    engines/sky/control.cpp
    engines/sky/control.h
    engines/sky/detection.cpp



diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 7741f10..fd2f2b9 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -535,7 +535,7 @@ uint16 Control::handleClick(ConResource *pButton) {
 		return saveRestorePanel(true); // texts can be edited
 	case SAVE_A_GAME:
 		animClick(pButton);
-		return saveGameToFile();
+		return saveGameToFile(true);
 	case RESTORE_A_GAME:
 		animClick(pButton);
 		return restoreGameFromFile(false);
@@ -1101,6 +1101,10 @@ void Control::doAutoSave() {
 		displayMessage(0, "Unable to create autosave file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
 		return;
 	}
+
+	_savedCharSet = _skyText->giveCurrentCharSet();
+	_savedMouse = _skyMouse->giveCurrentMouseType();
+
 	uint8 *saveData = (uint8 *)malloc(0x20000);
 	uint32 fSize = prepareSaveData(saveData);
 
@@ -1114,7 +1118,7 @@ void Control::doAutoSave() {
 	free(saveData);
 }
 
-uint16 Control::saveGameToFile() {
+uint16 Control::saveGameToFile(bool fromControlPanel) {
 	char fName[20];
 	sprintf(fName,"SKY-VM.%03d", _selectedGame);
 
@@ -1123,6 +1127,13 @@ uint16 Control::saveGameToFile() {
 	if (outf == NULL)
 		return NO_DISK_SPACE;
 
+	if (!fromControlPanel) {
+		// These variables are usually set when entering the control panel,
+		// but not when using the GMM.
+		_savedCharSet = _skyText->giveCurrentCharSet();
+		_savedMouse = _skyMouse->giveCurrentMouseType();
+	}
+
 	uint8 *saveData = (uint8 *)malloc(0x20000);
 	uint32 fSize = prepareSaveData(saveData);
 
diff --git a/engines/sky/control.h b/engines/sky/control.h
index 6aa7a41..59eda9b 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -190,7 +190,7 @@ public:
 	bool loadSaveAllowed();
 
 	uint16 _selectedGame;
-	uint16 saveGameToFile();
+	uint16 saveGameToFile(bool fromControlPanel);
 
 	void loadDescriptions(Common::StringArray &list);
 	void saveDescriptions(const Common::StringArray &list);
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 484958c..a078200 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -286,7 +286,7 @@ Common::Error SkyEngine::saveGameState(int slot, const Common::String &desc) {
 
 	// Set the save slot and save the game
 	_skyControl->_selectedGame = slot - 1;
-	if (_skyControl->saveGameToFile() != GAME_SAVED)
+	if (_skyControl->saveGameToFile(false) != GAME_SAVED)
 		return Common::kWritePermissionDenied;
 
 	// Load current save game descriptions


Commit: 54ede63fcc5046f8fec7b59e64b66780fd7a73b5
    https://github.com/scummvm/scummvm/commit/54ede63fcc5046f8fec7b59e64b66780fd7a73b5
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2012-02-13T12:31:41-08:00

Commit Message:
BASS: Reduce code duplication in autosave code

Changed paths:
    engines/sky/control.cpp
    engines/sky/control.h



diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index fd2f2b9..a40e77d 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -1094,36 +1094,23 @@ void Control::doAutoSave() {
 		strcpy(fName, "SKY-VM-CD.ASD");
 	else
 		sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
-	Common::OutSaveFile *outf;
-
-	outf = _saveFileMan->openForSaving(fName);
-	if (outf == NULL) {
-		displayMessage(0, "Unable to create autosave file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
-		return;
-	}
-
-	_savedCharSet = _skyText->giveCurrentCharSet();
-	_savedMouse = _skyMouse->giveCurrentMouseType();
-
-	uint8 *saveData = (uint8 *)malloc(0x20000);
-	uint32 fSize = prepareSaveData(saveData);
 
-	outf->write(saveData, fSize);
-	outf->finalize();
+	uint16 res = saveGameToFile(false, fName);
 
-	if (outf->err())
-		displayMessage(0, "Unable to write autosave file '%s'. Disk full? (%s)", fName, _saveFileMan->popErrorDesc().c_str());
+	if (res != GAME_SAVED)
+		displayMessage(0, "Unable to perform autosave to '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
 
-	delete outf;
-	free(saveData);
 }
 
-uint16 Control::saveGameToFile(bool fromControlPanel) {
+uint16 Control::saveGameToFile(bool fromControlPanel, const char *filename) {
 	char fName[20];
-	sprintf(fName,"SKY-VM.%03d", _selectedGame);
+	if (!filename) {
+		sprintf(fName,"SKY-VM.%03d", _selectedGame);
+		filename = fName;
+	}
 
 	Common::OutSaveFile *outf;
-	outf = _saveFileMan->openForSaving(fName);
+	outf = _saveFileMan->openForSaving(filename);
 	if (outf == NULL)
 		return NO_DISK_SPACE;
 
diff --git a/engines/sky/control.h b/engines/sky/control.h
index 59eda9b..42ada56 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -190,7 +190,7 @@ public:
 	bool loadSaveAllowed();
 
 	uint16 _selectedGame;
-	uint16 saveGameToFile(bool fromControlPanel);
+	uint16 saveGameToFile(bool fromControlPanel, const char *filename = 0);
 
 	void loadDescriptions(Common::StringArray &list);
 	void saveDescriptions(const Common::StringArray &list);






More information about the Scummvm-git-logs mailing list