aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
authorPaul Gilbert2014-01-02 14:28:31 -1000
committerPaul Gilbert2014-01-02 14:28:31 -1000
commit76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b (patch)
treeaddee2c38b607755fcb339c77c5974440ba8336c /engines/voyeur
parent86a0d366e4f1234ea2f40c770efb2fffe292c9a9 (diff)
downloadscummvm-rg350-76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b.tar.gz
scummvm-rg350-76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b.tar.bz2
scummvm-rg350-76f7d974f6f0fe97033e07481f0b9d8f2cc2b42b.zip
VOYEUR: In progress work trying to fix doGossip
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/animation.cpp15
-rw-r--r--engines/voyeur/animation.h3
-rw-r--r--engines/voyeur/graphics.cpp12
-rw-r--r--engines/voyeur/graphics.h1
-rw-r--r--engines/voyeur/voyeur_game.cpp19
5 files changed, 29 insertions, 21 deletions
diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index 0fc5669c66..5bda66e7fe 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -195,7 +195,7 @@ RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTr
initBackSurface();
_videoBase = header._videoBase;
- _dirtyPalette = true;
+ _dirtyPalette = header._colorCount > 0;
_curFrame = 0;
_nextFrameStartTime = 0;
@@ -261,7 +261,7 @@ const Graphics::Surface *RL2Decoder::RL2VideoTrack::decodeNextFrame() {
// Decode the graphic data using the appropriate method depending on whether the animation
// has a background or just raw frames without any background transparency
- if (_hasBackFrame) {
+ if (_backSurface) {
rl2DecodeFrameWithTransparency(_videoBase);
} else {
rl2DecodeFrameWithoutTransparency(_videoBase);
@@ -350,6 +350,7 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
if (nextByte == 0) {
// Move one single byte from reference surface
+ assert(frameSize > 0);
destP[screenOffset] = refP[screenOffset];
++screenOffset;
--frameSize;
@@ -366,6 +367,7 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
// Run length of transparency (i.e. pixels to copy from reference frame)
runLength = MIN(runLength, frameSize);
+
Common::copy(refP + screenOffset, refP + screenOffset + runLength, destP + screenOffset);
screenOffset += runLength;
frameSize -= runLength;
@@ -373,8 +375,8 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
// Run length of a single pixel value
int runLength = _fileStream->readByte();
nextByte &= 0x7f;
-
runLength = MIN(runLength, frameSize);
+
Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);
screenOffset += runLength;
frameSize -= runLength;
@@ -386,14 +388,11 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
Common::copy(refP + screenOffset, refP + (_surface->w * _surface->h), destP + screenOffset);
}
-void RL2Decoder::RL2VideoTrack::setupBackSurface(Graphics::Surface *surface) {
+Graphics::Surface *RL2Decoder::RL2VideoTrack::getBackSurface() {
if (!_backSurface)
initBackSurface();
- assert(surface->w == _backSurface->w && surface->h == _backSurface->h);
- const byte *srcP = (const byte *)surface->getPixels();
- byte *destP = (byte *)_backSurface->getPixels();
- Common::copy(srcP, srcP + surface->w * surface->h, destP);
+ return _backSurface;
}
/*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index c68c670fbb..ed237775cf 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -105,17 +105,18 @@ private:
uint16 getWidth() const;
uint16 getHeight() const;
Graphics::Surface *getSurface() { return _surface; }
+ Graphics::Surface *getBackSurface();
Graphics::PixelFormat getPixelFormat() const;
int getCurFrame() const { return _curFrame; }
int getFrameCount() const { return _header._numFrames; }
uint32 getNextFrameStartTime() const { return _nextFrameStartTime; }
const Graphics::Surface *decodeNextFrame();
const byte *getPalette() const { _dirtyPalette = false; return _header._palette; }
+ int getPaletteCount() const { return _header._colorCount; }
bool hasDirtyPalette() const { return _dirtyPalette; }
const Common::List<Common::Rect> *getDirtyRects() const { return &_dirtyRects; }
void clearDirtyRects() { _dirtyRects.clear(); }
void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
- void setupBackSurface(Graphics::Surface *surface);
private:
Common::SeekableReadStream *_fileStream;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index f189d2b699..e4b30b14c4 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -680,6 +680,18 @@ void GraphicsManager::setOneColor(int idx, byte r, byte g, byte b) {
g_system->getPaletteManager()->setPalette(&palEntry[0], idx, 1);
}
+void GraphicsManager::setColors(int start, int count, const byte *pal) {
+ for (int i = 0; i < count; ++i) {
+ if ((i + start) != 128) {
+ const byte *rgb = pal + i * 3;
+ setColor(i + start, rgb[0], rgb[1], rgb[2]);
+ }
+ }
+
+ _vm->_eventsManager._intPtr.field38 = true;
+ _vm->_eventsManager._intPtr._hasPalette = true;
+}
+
void GraphicsManager::screenReset() {
resetPalette();
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index 92b3e51453..970e814be2 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -111,6 +111,7 @@ public:
void resetPalette();
void setColor(int idx, byte r, byte g, byte b);
void setOneColor(int idx, byte r, byte g, byte b);
+ void setColors(int start, int count, const byte *pal);
void screenReset();
void fadeDownICF1(int steps);
void fadeUpICF1(int steps);
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index c57de37162..dab7149c2a 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -688,23 +688,21 @@ void VoyeurEngine::doGossip() {
pal->startFade();
// Transfer initial background to video decoder
- //PictureResource videoFrame(decoder.getVideoSurface());
- //_graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(-32, -20));
+ PictureResource videoFrame(decoder.getVideoTrack()->getBackSurface());
+ bgPic->_bounds.moveTo(0, 0);
+ _graphicsManager.sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
flipPageAndWait();
- /*
byte *frameNumsP = _bVoy->memberAddr(0x309);
byte *posP = _bVoy->boltEntry(0x30A)._data;
// Main playback loop
-
int picCtr = 0;
- decoder.start();
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) {
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
- _graphicsManager.setPalette(palette, 0, 256);
+ _graphicsManager.setPalette(palette, 128, 128);
}
if (decoder.needsUpdate()) {
@@ -723,15 +721,12 @@ void VoyeurEngine::doGossip() {
const Graphics::Surface *frame = decoder.decodeNextFrame();
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
(byte *)_graphicsManager._screenSurface.getPixels());
-
-
- flipPageAndWait();
}
-
- _eventsManager.pollEvents();
+
+ _eventsManager.getMouseInfo();
g_system->delayMillis(10);
}
-
+ /*
decoder.loadFile("a2110100.rl2");
decoder.start();