aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-14 18:03:47 +0000
committerFilippos Karapetis2009-10-14 18:03:47 +0000
commit20036d3cb4705404710519653cb0f5da56d90da7 (patch)
tree6d45ddaea12277ad94d1e5cf5e2f58261f8a527a /engines/sci
parentccaec44fc0dabcd923a9216dc4a303d25f7ec69f (diff)
downloadscummvm-rg350-20036d3cb4705404710519653cb0f5da56d90da7.tar.gz
scummvm-rg350-20036d3cb4705404710519653cb0f5da56d90da7.tar.bz2
scummvm-rg350-20036d3cb4705404710519653cb0f5da56d90da7.zip
Fixed the palette in the SEQ decoder again
svn-id: r45088
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp19
-rw-r--r--engines/sci/gfx/seq_decoder.cpp6
-rw-r--r--engines/sci/gfx/seq_decoder.h2
-rw-r--r--engines/sci/gui/gui_palette.cpp20
-rw-r--r--engines/sci/gui/gui_palette.h2
5 files changed, 29 insertions, 20 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 76aa9dc11b..9693f05b63 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1041,24 +1041,29 @@ static reg_t kShowMovie_DOS(EngineState *s, int argc, reg_t *argv) {
Common::String filename = s->_segMan->getString(argv[0]);
int delay = argv[1].toUint16(); // Time between frames in ticks
SeqDecoder seq;
- SciGuiScreen *videoScreen = new SciGuiScreen(320, 200, 1);
- if (!seq.loadFile(filename, s->resMan, videoScreen) &&
- !seq.loadFile(Common::String("SEQ/") + filename, s->resMan, videoScreen)) {
+ if (!seq.loadFile(filename, s->resMan) &&
+ !seq.loadFile(Common::String("SEQ/") + filename, s->resMan)) {
warning("Failed to open movie file %s", filename.c_str());
- delete videoScreen;
return s->r_acc;
}
- delete videoScreen;
-
bool play = true;
while (play) {
uint32 startTime = g_system->getMillis();
SeqFrame *frame = seq.getFrame(play);
Common::Rect frameRect = frame->frameRect;
- g_system->copyRectToScreen(frame->data, frameRect.width(), frameRect.left, frameRect.top, frameRect.width(), frameRect.height());
+ byte *scr = (byte *)g_system->lockScreen()->pixels;
+ int cur = 0;
+ for (int y = frameRect.top; y < frameRect.bottom; y++) {
+ for (int x = frameRect.left; x < frameRect.right; x++) {
+ if (frame->data[cur] != frame->colorKey)
+ scr[y * 320 + x] = frame->data[cur];
+ cur++;
+ }
+ }
+ g_system->unlockScreen();
g_system->updateScreen();
delete frame->data;
diff --git a/engines/sci/gfx/seq_decoder.cpp b/engines/sci/gfx/seq_decoder.cpp
index 047ec4294a..dc119551d0 100644
--- a/engines/sci/gfx/seq_decoder.cpp
+++ b/engines/sci/gfx/seq_decoder.cpp
@@ -35,7 +35,7 @@ SeqDecoder::~SeqDecoder() {
closeFile();
}
-bool SeqDecoder::loadFile(Common::String fileName, ResourceManager *resMan, SciGuiScreen *screen) {
+bool SeqDecoder::loadFile(Common::String fileName, ResourceManager *resMan) {
closeFile();
_fileStream = SearchMan.createReadStreamForMember(fileName);
@@ -48,11 +48,13 @@ bool SeqDecoder::loadFile(Common::String fileName, ResourceManager *resMan, SciG
byte *paletteData = new byte[paletteSize];
_fileStream->read(paletteData, paletteSize);
GuiPalette seqPalette;
- SciGuiPalette *pal = new SciGuiPalette(resMan, screen);
+ SciGuiScreen *videoScreen = new SciGuiScreen(320, 200, 1);
+ SciGuiPalette *pal = new SciGuiPalette(resMan, videoScreen, false);
pal->createFromData(paletteData, &seqPalette);
pal->set(&seqPalette, 2);
delete pal;
delete[] paletteData;
+ delete videoScreen;
_currentFrame = 0;
diff --git a/engines/sci/gfx/seq_decoder.h b/engines/sci/gfx/seq_decoder.h
index af90ef1eb8..c4a9dc6d4a 100644
--- a/engines/sci/gfx/seq_decoder.h
+++ b/engines/sci/gfx/seq_decoder.h
@@ -44,7 +44,7 @@ class SeqDecoder {
public:
SeqDecoder() : _fileStream(0) { }
~SeqDecoder();
- bool loadFile(Common::String fileName, ResourceManager *resMan, SciGuiScreen *screen);
+ bool loadFile(Common::String fileName, ResourceManager *resMan);
void closeFile();
SeqFrame *getFrame(bool &hasNext);
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp
index 5a237822e1..d30c499d4c 100644
--- a/engines/sci/gui/gui_palette.cpp
+++ b/engines/sci/gui/gui_palette.cpp
@@ -34,7 +34,7 @@
namespace Sci {
-SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen)
+SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen, bool autoSetPalette)
: _resMan(resMan), _screen(screen) {
int16 color;
@@ -54,14 +54,16 @@ SciGuiPalette::SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen)
_sysPalette.colors[255].g = 255;
_sysPalette.colors[255].b = 255;
- // Load default palette from resource 999
- if (!setFromResource(999, 2)) {
- // if not found, we try to set amiga palette
- if (!setAmiga()) {
- // if that also doesnt work out, set EGA palette
- setEGA();
- }
- };
+ if (autoSetPalette) {
+ // Load default palette from resource 999
+ if (!setFromResource(999, 2)) {
+ // if not found, we try to set amiga palette
+ if (!setAmiga()) {
+ // if that also doesnt work out, set EGA palette
+ setEGA();
+ }
+ };
+ }
// Init _clrPowers used in MatchColor
for(color = 0; color < 256; color++)
diff --git a/engines/sci/gui/gui_palette.h b/engines/sci/gui/gui_palette.h
index 5d7b3ba867..038ced7e2b 100644
--- a/engines/sci/gui/gui_palette.h
+++ b/engines/sci/gui/gui_palette.h
@@ -33,7 +33,7 @@ namespace Sci {
class SciGuiScreen;
class SciGuiPalette {
public:
- SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen);
+ SciGuiPalette(ResourceManager *resMan, SciGuiScreen *screen, bool autoSetPalette = true);
~SciGuiPalette();
void createFromData(byte *data, GuiPalette *paletteOut);