[Scummvm-cvs-logs] scummvm master -> 031b9b8ced1007545099e0e6285ea4bbe1d3e97f

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Apr 26 15:54:27 CEST 2015


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

Summary:
031b9b8ced SCI: restore: clear screen when restoring


Commit: 031b9b8ced1007545099e0e6285ea4bbe1d3e97f
    https://github.com/scummvm/scummvm/commit/031b9b8ced1007545099e0e6285ea4bbe1d3e97f
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-04-26T15:50:12+02:00

Commit Message:
SCI: restore: clear screen when restoring

primarily to clear kPortrait graphics in kq6
when restoring during portrait animation

Changed paths:
    engines/sci/engine/savegame.cpp
    engines/sci/graphics/screen.cpp
    engines/sci/graphics/screen.h



diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e0c2833..3d93441 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -41,6 +41,7 @@
 #include "sci/graphics/helpers.h"
 #include "sci/graphics/palette.h"
 #include "sci/graphics/ports.h"
+#include "sci/graphics/screen.h"
 #include "sci/parser/vocabulary.h"
 #include "sci/sound/audio.h"
 #include "sci/sound/music.h"
@@ -923,11 +924,15 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
 	// We don't need the thumbnail here, so just read it and discard it
 	Graphics::skipThumbnail(*fh);
 
-	// reset ports as one of the first things we do, because that may free() some hunk memory
+	// reset ports is one of the first things we do, because that may free() some hunk memory
 	//  and we don't want to do that after we read in the saved game hunk memory
 	if (ser.isLoading()) {
+		// reset ports
 		if (g_sci->_gfxPorts)
 			g_sci->_gfxPorts->reset();
+		// clear screen
+		if (g_sci->_gfxScreen)
+			g_sci->_gfxScreen->clear();
 	}
 
 	s->reset(true);
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 5a3b30f..dfcb5db 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -251,6 +251,18 @@ GfxScreen::~GfxScreen() {
 	free(_displayScreen);
 }
 
+// should not used regulary, only meant for restore game
+void GfxScreen::clear() {
+	// reset all screen data
+	memset(_visualScreen, 0, _pixels);
+	memset(_priorityScreen, 0, _pixels);
+	memset(_controlScreen, 0, _pixels);
+	memset(_displayScreen, 0, _displayPixels);
+	memset(&_ditheredPicColors, 0, sizeof(_ditheredPicColors));
+	_fontIsUpscaled = false;
+	copyToScreen();
+}
+
 void GfxScreen::copyToScreen() {
 	g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight);
 }
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 766e326..587d2ef 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -76,6 +76,7 @@ public:
 	byte getColorWhite() { return _colorWhite; }
 	byte getColorDefaultVectorData() { return _colorDefaultVectorData; }
 
+	void clear();
 	void copyToScreen();
 	void copyFromScreen(byte *buffer);
 	void kernelSyncWithFramebuffer();






More information about the Scummvm-git-logs mailing list