aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2011-02-07 12:24:09 +0000
committerFilippos Karapetis2011-02-07 12:24:09 +0000
commit6f9ac84f77f140c8008ffec0e57fcf2ddd17a10e (patch)
treedbf6c0eae66fe09f7ab9e397ba41c60e2b01c970 /engines/sci/engine
parentd7fb5239e7ed9b95442b8a481cdd9e6c25a9acc5 (diff)
downloadscummvm-rg350-6f9ac84f77f140c8008ffec0e57fcf2ddd17a10e.tar.gz
scummvm-rg350-6f9ac84f77f140c8008ffec0e57fcf2ddd17a10e.tar.bz2
scummvm-rg350-6f9ac84f77f140c8008ffec0e57fcf2ddd17a10e.zip
SCI: Converted the robot decoder into a regular video decoder, and decoupled it from the
SciEngine class - Robot videos are now shown in frameOut(), like they should, and kRobot(sync) is only used for syncing with the game scripts - Hooked video playing into the "play_video" console command svn-id: r55801
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kgraphics.cpp15
-rw-r--r--engines/sci/engine/kvideo.cpp33
2 files changed, 32 insertions, 16 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 0c0e3bf720..8730724d68 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -48,12 +48,12 @@
#include "sci/graphics/paint16.h"
#include "sci/graphics/picture.h"
#include "sci/graphics/ports.h"
-#include "sci/graphics/robot.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
#ifdef ENABLE_SCI32
#include "sci/graphics/frameout.h"
+#include "sci/video/robot_decoder.h"
#endif
namespace Sci {
@@ -1398,7 +1398,6 @@ reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
int16 subop = argv[0].toUint16();
- GfxRobot *robot = g_sci->_gfxRobot;
switch (subop) {
case 0: { // init
@@ -1408,7 +1407,8 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
int16 x = argv[4].toUint16();
int16 y = argv[5].toUint16();
warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
- robot->init(id, x, y);
+ g_sci->_robotDecoder->load(id);
+ g_sci->_robotDecoder->setPos(x, y);
}
break;
case 1: // LSL6 hires (startup)
@@ -1423,10 +1423,13 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
warning("kRobot(%d)", subop);
break;
case 8: // sync
- robot->processNextFrame();
- // Signal the engine scripts that the video is done
- if (robot->getCurFrame() == robot->getFrameCount())
+ if ((uint32)g_sci->_robotDecoder->getCurFrame() != g_sci->_robotDecoder->getFrameCount() - 1) {
+ writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
+ } else {
+ g_sci->_robotDecoder->close();
+ // Signal the engine scripts that the video is done
writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG);
+ }
break;
default:
warning("kRobot(%d)", subop);
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index ef47f9b9c6..1ed3a713b0 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -51,12 +51,15 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
uint16 screenWidth = g_system->getWidth();
uint16 screenHeight = g_system->getHeight();
bool isVMD = videoState.fileName.hasSuffix(".vmd");
-
- if (screenWidth == 640 && width <= 320 && height <= 240 && ((videoState.flags & kDoubled) || !isVMD)) {
- width *= 2;
- height *= 2;
- pitch *= 2;
- scaleBuffer = new byte[width * height * bytesPerPixel];
+ bool isRobot = videoState.fileName.hasSuffix(".rbt");
+
+ if (!isRobot) {
+ if (screenWidth == 640 && width <= 320 && height <= 240 && ((videoState.flags & kDoubled) || !isVMD)) {
+ width *= 2;
+ height *= 2;
+ pitch *= 2;
+ scaleBuffer = new byte[width * height * bytesPerPixel];
+ }
}
uint16 x, y;
@@ -73,8 +76,13 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
y = (screenHeight - height) / 2;
}
} else {
- x = (screenWidth - width) / 2;
- y = (screenHeight - height) / 2;
+ if (!isRobot) {
+ x = (screenWidth - width) / 2;
+ y = (screenHeight - height) / 2;
+ } else {
+ x = 0;
+ y = 0;
+ }
}
bool skipVideo = false;
@@ -84,13 +92,18 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
+
if (frame) {
if (scaleBuffer) {
// TODO: Probably should do aspect ratio correction in e.g. GK1 Windows
g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel);
g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height);
- } else
- g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height);
+ } else {
+ if (!isRobot)
+ g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height);
+ else // Frames in robot videos have different dimensions
+ g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ }
if (videoDecoder->hasDirtyPalette())
videoDecoder->setSystemPalette();