aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-06 18:59:39 +0000
committerMartin Kiewitz2010-01-06 18:59:39 +0000
commitedc7fcf121bf56052858498d3168c344c00d7442 (patch)
tree4ea0519f9a717f8e371bff39da92a06f9d93f746 /engines
parent11d9f150106cbcc6be196902f3970badb8de70f5 (diff)
downloadscummvm-rg350-edc7fcf121bf56052858498d3168c344c00d7442.tar.gz
scummvm-rg350-edc7fcf121bf56052858498d3168c344c00d7442.tar.bz2
scummvm-rg350-edc7fcf121bf56052858498d3168c344c00d7442.zip
SCI: sync displayScreen with framebuffer after successful video playback (fixes background vanishing in mainmenu of gk1demo)
svn-id: r47089
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp17
-rw-r--r--engines/sci/graphics/gui.cpp4
-rw-r--r--engines/sci/graphics/gui.h2
-rw-r--r--engines/sci/graphics/screen.cpp7
-rw-r--r--engines/sci/graphics/screen.h1
5 files changed, 27 insertions, 4 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index fa1e3b073e..686c4ae10f 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -995,6 +995,8 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) {
}
reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
+ bool playedVideo = false;
+
// KQ6 Windows calls this with one argument. It doesn't seem
// to have a purpose...
if (argc == 1)
@@ -1009,10 +1011,12 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
Graphics::AviDecoder *aviDecoder = new Graphics::AviDecoder(g_system->getMixer());
Graphics::VideoPlayer *player = new Graphics::VideoPlayer(aviDecoder);
- if (aviDecoder->loadFile(filename.c_str()))
+ if (aviDecoder->loadFile(filename.c_str())) {
player->playVideo();
- else
+ playedVideo = true;
+ } else {
warning("Failed to open movie file %s", filename.c_str());
+ }
aviDecoder->closeFile();
delete player;
delete aviDecoder;
@@ -1024,15 +1028,20 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
SeqDecoder *seqDecoder = new SeqDecoder();
Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder);
- if (seqDecoder->loadFile(filename.c_str(), delay))
+ if (seqDecoder->loadFile(filename.c_str(), delay)) {
player->playVideo();
- else
+ playedVideo = true;
+ } else {
warning("Failed to open movie file %s", filename.c_str());
+ }
seqDecoder->closeFile();
delete player;
delete seqDecoder;
}
+ if (playedVideo)
+ s->_gui->syncWithFramebuffer();
+
return s->r_acc;
}
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index b11be4ceb7..8eb83495fa 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -821,6 +821,10 @@ int16 SciGui::getCelCount(GuiResourceId viewId, int16 loopNo) {
return _gfx->getView(viewId)->getLoopInfo(loopNo)->celCount;
}
+void SciGui::syncWithFramebuffer() {
+ _screen->syncWithFramebuffer();
+}
+
reg_t SciGui::portraitLoad(Common::String resourceName) {
return NULL_REG;
}
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index c5b1ad1892..293c41da70 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -145,6 +145,8 @@ public:
virtual int16 getLoopCount(GuiResourceId viewId);
virtual int16 getCelCount(GuiResourceId viewId, int16 loopNo);
+ virtual void syncWithFramebuffer();
+
virtual reg_t portraitLoad(Common::String resourceName);
virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
virtual void portraitUnload(uint16 portraitId);
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index fce6827d43..a78b049e5e 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -91,6 +91,13 @@ void Screen::copyFromScreen(byte *buffer) {
g_system->unlockScreen();
}
+void Screen::syncWithFramebuffer() {
+ Graphics::Surface *screen = g_system->lockScreen();
+
+ memcpy(_displayScreen, screen->pixels, _displayPixels);
+ g_system->unlockScreen();
+}
+
void Screen::copyRectToScreen(const Common::Rect &rect) {
if (!_upscaledHires) {
g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, rect.left, rect.top, rect.width(), rect.height());
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 447eb31d38..ba8d906631 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -55,6 +55,7 @@ public:
void copyToScreen();
void copyFromScreen(byte *buffer);
+ void syncWithFramebuffer();
void copyRectToScreen(const Common::Rect &rect);
void copyRectToScreen(const Common::Rect &rect, int16 x, int16 y);