aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-07 21:25:31 +0000
committerMartin Kiewitz2009-10-07 21:25:31 +0000
commit80d136a362e667d4e8ff0754fe634eba30e0590a (patch)
treece2e6047cbd46c116ba0d8e8349f826e38df6590
parentc0c2d4f484cbf4dfaed91be525b365102a916a17 (diff)
downloadscummvm-rg350-80d136a362e667d4e8ff0754fe634eba30e0590a.tar.gz
scummvm-rg350-80d136a362e667d4e8ff0754fe634eba30e0590a.tar.bz2
scummvm-rg350-80d136a362e667d4e8ff0754fe634eba30e0590a.zip
SCI: kDrawPic / had an error in previous revision
svn-id: r44759
-rw-r--r--engines/sci/engine/kgraphics.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 5f4c8de759..b71f3b6462 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -922,8 +922,8 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) {
if (!argv[2].isNull())
addToFlag = true;
// FIXME: usesOldGfxFunctions() seems to be broken, cause sq3 has it set, but uses bit 0 correctly
- if (s->_kernel->usesOldGfxFunctions())
- addToFlag = !addToFlag;
+ if (!s->_kernel->usesOldGfxFunctions())
+ addToFlag = !addToFlag; // later engines set the bit, but dont want to add to picture
}
if (argc >= 4)
EGApaletteNo = argv[3].toUint16();
@@ -1585,7 +1585,7 @@ reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) {
s->gui->addToPicView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
break;
default:
- error("kAddToPic with unsupported parameter count %d", argc);
+ error("kAddToPic with unsupported parameter count %d", argc);
}
return s->r_acc;
}
@@ -1598,7 +1598,7 @@ reg_t kSetPort(EngineState *s, int argc, reg_t *argv) {
uint16 portPtr;
Common::Rect picRect;
int16 picTop, picLeft;
-
+
switch (argc) {
case 1:
portPtr = argv[0].toSint16();
@@ -1735,25 +1735,25 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) {
static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
Common::String filename = s->_segMan->getString(argv[1]);
-
+
Graphics::AVIPlayer *player = new Graphics::AVIPlayer(g_system);
-
+
if (!player->open(filename)) {
warning("Failed to open movie file %s", filename.c_str());
return s->r_acc;
}
-
+
uint32 startTime = g_system->getMillis();
bool play = true;
-
+
while (play && player->getCurFrame() < player->getFrameCount()) {
uint32 elapsed = g_system->getMillis() - startTime;
-
+
if (elapsed >= player->getCurFrame() * 1000 / player->getFrameRate()) {
Graphics::Surface *surface = player->getNextFrame();
Palette *palette = NULL;
-
+
if (player->dirtyPalette()) {
byte *rawPalette = player->getPalette();
Palette *colors = new Palette(256);
@@ -1769,29 +1769,29 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
palette->forceInto(s->gfx_state->driver->getMode()->palette);
}
-
+
if (surface) {
// Allocate a pixmap
gfx_pixmap_t *pixmap = gfx_new_pixmap(surface->w, surface->h, 0, 0, 0);
assert(pixmap);
gfx_pixmap_alloc_index_data(pixmap);
-
+
// Copy data from the surface
memcpy(pixmap->index_data, surface->pixels, surface->w * surface->h);
pixmap->xoffset = (g_system->getWidth() - surface->w) / 2;
pixmap->yoffset = (g_system->getHeight() - surface->h) / 2;
pixmap->palette = palette;
-
+
// Copy the frame to the screen
gfx_xlate_pixmap(pixmap, s->gfx_state->driver->getMode());
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);
-
+
// Surface is freed when the codec in the video is deleted
}
}
-
+
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
@@ -1803,7 +1803,7 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
break;
}
}
-
+
g_system->delayMillis(10);
}