aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/voyeur/files.cpp12
-rw-r--r--engines/voyeur/files.h1
-rw-r--r--engines/voyeur/graphics.cpp93
-rw-r--r--engines/voyeur/graphics.h3
-rw-r--r--engines/voyeur/voyeur.cpp1
5 files changed, 104 insertions, 6 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 3bbea7a5d1..02d7c7a25b 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -543,6 +543,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(&src[10]),
ys + READ_LE_UINT16(&src[12]));
_maskData = READ_LE_UINT32(&src[14]);
+ _planeSize = READ_LE_UINT16(&src[22]);
_imgData = NULL;
@@ -618,6 +619,17 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
}
}
+PictureResource::PictureResource() {
+ _select = 0;
+ _pick = 0;
+ _onOff = 0;
+ _depth = 0;
+ _maskData = 0;
+ _planeSize = 0;
+
+ _imgData = NULL;
+}
+
PictureResource::~PictureResource() {
delete _imgData;
}
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 996dc2b3a0..df29924fa3 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -215,6 +215,7 @@ public:
byte *_imgData;
public:
PictureResource(BoltFilesState &state, const byte *src);
+ PictureResource();
virtual ~PictureResource();
};
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 7f9fd48c8f..e579d7f2ff 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -220,11 +220,24 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
widthDiff2 = destPic->_bounds.width() - width2;
if (destViewPort) {
- error("TODO: Examine further when it's actually used");
if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
- // TODO
+ backBounds.left = destPic->_bounds.left + offset.x;
+ backBounds.top = destPic->_bounds.top + offset.y;
+ backBounds.setWidth(width2);
+ backBounds.setHeight(height1);
+ addRectOptSaveRect(destViewPort, 1, backBounds);
+
} else if (!destViewPort->_addFn) {
- // TODO
+ if (destViewPort->_rectListCount[destViewPort->_pageIndex] < -1) {
+ Common::Rect r;
+ r.left = destPic->_bounds.left + offset.x;
+ r.top = destPic->_bounds.top + offset.y;
+ r.setWidth(width2);
+ r.setHeight(height1);
+
+ (*destViewPort->_rectListPtr[destViewPort->_pageIndex]).push_back(r);
+ ++destViewPort->_rectListCount[destViewPort->_pageIndex];
+ }
} else {
int xs = ofs.x + destPic->_bounds.left;
int ys = ofs.y + destPic->_bounds.top;
@@ -315,8 +328,46 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
}
} else {
- error("TODO: sDrawPic");
+ // loc_26666
+ if (srcPic->_pick == 0) {
+ // loc_2727A
+ int onOff = srcPic->_onOff;
+ int onOff2 = onOff | (onOff << 8);
+
+ if (srcFlags & 2) {
+ if (srcFlags & 8) {
+
+ } else {
+
+ }
+ } else {
+ // TODO
+
+ }
+
+ } else {
+ // loc_26673
+ // TODO
+ }
+ }
+}
+
+void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
+ PictureResource *pic;
+ if (display->_flags & 0x8000) {
+ pic = ((ViewPortResource *)display)->_currentPic;
+ } else {
+ pic = (PictureResource *)display;
}
+
+ PictureResource picResource;
+ picResource._flags = 0;
+ picResource._select = 0xff;
+ picResource._pick = 0;
+ picResource._onOff = onOff;
+ picResource._bounds = pic->_bounds;
+
+ sDrawPic(&picResource, display, Common::Point());
}
/**
@@ -386,8 +437,40 @@ void GraphicsManager::clearPalette() {
g_system->getPaletteManager()->setPalette(&palette[0], 0, 256);
}
+void GraphicsManager::resetPalette() {
+ for (int i = 0; i < 256; ++i)
+ setColor(i, 0, 0, 0);
+
+ _vm->_eventsManager._intPtr.field38 = 1;
+ _vm->_eventsManager._intPtr._hasPalette = true;
+}
+
+void GraphicsManager::setColor(int idx, int r, int g, int b) {
+ byte *vgaP = &_VGAColors[idx * 3];
+ vgaP[0] = r >> 2;
+ vgaP[1] = g >> 2;
+ vgaP[2] = b >> 2;
+
+ _vm->_eventsManager._intPtr._palStartIndex = MIN(_vm->_eventsManager._intPtr._palStartIndex, idx);
+ _vm->_eventsManager._intPtr._palEndIndex = MAX(_vm->_eventsManager._intPtr._palEndIndex, idx);
+}
+
void GraphicsManager::screenReset() {
- // TODO
+ resetPalette();
+ (*_vPort)->setupViewPort();
+ fillPic(*_vPort, 0);
+
+ // Flag the following viewport
+ uint i = 0;
+ while (i < _viewPortListPtr->_entries.size() && _viewPortListPtr->_entries[i] != *_vPort)
+ ++i;
+ assert(i < (_viewPortListPtr->_entries.size() - 1));
+
+ _viewPortListPtr->_entries[i + 1]->_flags |= 8;
+
+ // Flip
+ flipPage();
+ _vm->_eventsManager.sWaitFlip();
}
} // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index c1a0adafd1..5d0b00d35c 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -86,9 +86,12 @@ public:
void EMSMapPageHandle(int v1, int v2, int v3);
void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset);
+ void GraphicsManager::fillPic(DisplayResource *display, byte onOff);
void sDisplayPic(PictureResource *pic);
void flipPage();
void clearPalette();
+ void resetPalette();
+ void setColor(int idx, int r, int g, int b);
void screenReset();
};
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 98d88ac75a..93bb7a664a 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -179,7 +179,6 @@ void VoyeurEngine::doHeadTitle() {
_graphicsManager.screenReset();
_bVoy->freeBoltGroup(0x10500);
- _graphicsManager.screenReset();
if (shouldQuit())
return;