aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorWalter van Niftrik2009-05-21 22:03:23 +0000
committerWalter van Niftrik2009-05-21 22:03:23 +0000
commit36fe37443d53c64d0172791a5bc6226c7fe199c0 (patch)
tree55e21c6a9b38d19437410156f9470c68fe3e6389 /engines/sci/engine
parent7ed8d7f573da40d19299f14d304491184fe221a8 (diff)
downloadscummvm-rg350-36fe37443d53c64d0172791a5bc6226c7fe199c0.tar.gz
scummvm-rg350-36fe37443d53c64d0172791a5bc6226c7fe199c0.tar.bz2
scummvm-rg350-36fe37443d53c64d0172791a5bc6226c7fe199c0.zip
SCI: Added support for KQ6 movies.
svn-id: r40774
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp1
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kgraphics.cpp43
3 files changed, 45 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index b84466e852..7985d3301b 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -210,6 +210,7 @@ SciKernelFunction kfunct_mappers[] = {
DEFUN("DoSync", kDoSync, ".*"),
DEFUN("ResCheck", kResCheck, "iii*"),
DEFUN("SetQuitStr", kSetQuitStr, "r"),
+ DEFUN("ShowMovie", kShowMovie, "ri"),
// Special and NOP stuff
{KF_NEW, NULL, k_Unknown, NULL},
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index da3dca9ec4..c7110d5165 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -433,6 +433,7 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv);
reg_t kDoSync(EngineState *s, int funct_nr, int argc, reg_t *argv);
reg_t kResCheck(EngineState *s, int funct_nr, int argc, reg_t *argv);
reg_t kSetQuitStr(EngineState *s, int funct_nr, int argc, reg_t *argv);
+reg_t kShowMovie(EngineState *s, int funct_nr, int argc, reg_t *argv);
reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv);
// The Unknown/Unnamed kernel function
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index a0bb426584..14e82a9a62 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/events.h"
#include "sci/sci.h"
#include "sci/resource.h"
@@ -32,6 +33,7 @@
#include "sci/gfx/gfx_gui.h"
#include "sci/gfx/gfx_widgets.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxContainer, GfxPort, GfxVisual
+#include "sci/gfx/seq_decoder.h"
namespace Sci {
@@ -3312,4 +3314,45 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kShowMovie(EngineState *s, int funct_nr, int argc, reg_t *argv) {
+ const char *filename = kernel_dereference_char_pointer(s, argv[0], 0);
+ int framerate = UKPV(1); // FIXME: verify
+ SeqDecoder seq;
+
+ if (!seq.loadFile(filename)) {
+ warning("Failed to open movie file %s", filename);
+ return s->r_acc;
+ }
+
+ bool play = true;
+ while (play) {
+ gfx_pixmap_t *pixmap = seq.getFrame(play);
+ gfx_xlate_pixmap(pixmap, s->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE);
+ GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, pixmap, gfx_rect(0, 0, 320, 200), Common::Point(pixmap->xoffset, pixmap->yoffset)));
+ gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
+ gfx_free_pixmap(pixmap);
+
+ uint32 startTime = g_system->getMillis();
+
+ // Wait before showing the next frame
+ while (play && (g_system->getMillis() < startTime + 1000 / framerate)) {
+ // FIXME: we should probably make a function that handles quitting in these kinds of situations
+ Common::Event curEvent;
+ Common::EventManager *eventMan = g_system->getEventManager();
+
+ // Process quit events
+ while (eventMan->pollEvent(curEvent)) {
+ if (curEvent.type == Common::EVENT_QUIT) {
+ play = false;
+ quit_vm();
+ }
+ }
+
+ g_system->delayMillis(10);
+ }
+ }
+
+ return s->r_acc;
+}
+
} // End of namespace Sci