aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/voyeur/events.cpp2
-rw-r--r--engines/voyeur/files.cpp24
-rw-r--r--engines/voyeur/files.h8
-rw-r--r--engines/voyeur/game.cpp2
-rw-r--r--engines/voyeur/game.h2
-rw-r--r--engines/voyeur/graphics.cpp41
-rw-r--r--engines/voyeur/graphics.h9
-rw-r--r--engines/voyeur/voyeur.cpp2
8 files changed, 69 insertions, 21 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index c7ec6b99a7..c43c810b88 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -65,7 +65,7 @@ void EventsManager::sWaitFlip() {
(_vm->_graphicsManager.*viewPort._restoreFn)(&viewPort);
_vm->_graphicsManager._clipPtr = clipPtr;
- viewPort._field40[viewPort._pageIndex] = 0;
+ viewPort._rectListCount[viewPort._pageIndex] = 0;
viewPort._flags &= 0xFFBF;
}
}
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index aacefd99f3..8522cc77d7 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -614,12 +614,21 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
_pages[1] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x30), &_field30);
- state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x34), &_field34);
- state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x38), &_field38);
- state._curLibPtr->resolveIt(READ_LE_UINT32(src + 0x3C), &_field3C);
- for (int i = 0; i < 3; ++i)
- _field40[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+ // Get the rect list
+ for (int i = 0; i < 3; ++i) {
+ _rectListCount[i] = (int16)READ_LE_UINT16(src + 0x40 + 2 * i);
+
+ int16 *rectList = (int16 *)state._curLibPtr->memberAddrOffset(READ_LE_UINT32(src + 0x34 + i * 4));
+ _rectListPtr[i] = new Common::Array<Common::Rect>();
+
+ for (int i = 0; i < _rectListCount[0]; ++i) {
+ int xs = FROM_LE_16(rectList[0]);
+ int ys = FROM_LE_16(rectList[1]);
+ _rectListPtr[i]->push_back(Common::Rect(xs, ys, xs + FROM_LE_16(rectList[2]),
+ ys + FROM_LE_16(rectList[3])));
+ }
+ }
xs = READ_LE_UINT16(src + 0x46);
ys = READ_LE_UINT16(src + 0x48);
@@ -637,6 +646,11 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
_addFn = &GraphicsManager::addRectNoSaveBack;
}
+ViewPortResource::~ViewPortResource() {
+ for (int i = 0; i < 3; ++i)
+ delete _rectListPtr[i];
+}
+
void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
PictureResource *pic = _currentPic;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index ccbea8a209..32c203eec8 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -232,10 +232,8 @@ public:
PictureResource *_activePage;
PictureResource *_pages[2];
byte *_field30;
- byte *_field34;
- byte *_field38;
- byte *_field3C;
- int16 _field40[3];
+ Common::Array<Common::Rect> *_rectListPtr[3];
+ int _rectListCount[3];
Common::Rect _clipRect;
byte *_field7A;
GraphicMethodPtr _fn1;
@@ -244,7 +242,7 @@ public:
ViewPortRestorePtr _restoreFn;
public:
ViewPortResource(BoltFilesState &state, const byte *src);
- virtual ~ViewPortResource() {}
+ virtual ~ViewPortResource();
void setupViewPort();
};
diff --git a/engines/voyeur/game.cpp b/engines/voyeur/game.cpp
index e38863a1e4..9167cd942b 100644
--- a/engines/voyeur/game.cpp
+++ b/engines/voyeur/game.cpp
@@ -26,6 +26,8 @@ namespace Voyeur {
IntData::IntData() {
_field9 = false;
+ _flipWait = false;
+ _field2A = 0;
}
void IntData::audioInit() {
diff --git a/engines/voyeur/game.h b/engines/voyeur/game.h
index 35fffbe649..d99df39c02 100644
--- a/engines/voyeur/game.h
+++ b/engines/voyeur/game.h
@@ -112,6 +112,8 @@ public:
class IntData {
public:
bool _field9;
+ bool _flipWait;
+ int _field2A;
byte *_colors;
Common::List<IntNode *> _intNodes;
public:
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index b0487a0e8b..3acf2a35f5 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -34,6 +34,7 @@ GraphicsManager::GraphicsManager() {
_SVGAReset = 0;
_screenOffset = 0;
_planeSelect = 0;
+ _sImageShift = 3;
_palFlag = false;
_MCGAMode = false;
_saveBack = false;
@@ -87,18 +88,34 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
_clipPtr = clipRect;
}
- viewPort->_field40[1] = -1;
+ viewPort->_rectListCount[1] = -1;
}
-void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
// TODO
}
void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
- // TODO
+ if (viewPort->_rectListCount[0] != -1) {
+ for (int i = 0; i < viewPort->_rectListCount[0]; ++i) {
+ addRectOptSaveRect(viewPort, 1, (*viewPort->_rectListPtr[0])[i]);
+ }
+ } else {
+ viewPort->_rectListCount[1] = -1;
+ }
+
+ restoreBack(*viewPort->_rectListPtr[1], viewPort->_rectListCount[1], viewPort->_pages[0],
+ viewPort->_pages[1]);
+
+ int count = viewPort->_rectListCount[0];
+ restoreBack(*viewPort->_rectListPtr[0], viewPort->_rectListCount[0],
+ viewPort->_activePage, viewPort->_currentPic);
+
+ SWAP(viewPort->_rectListPtr[0], viewPort->_rectListPtr[1]);
+ viewPort->_rectListCount[1] = count;
}
-void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds) {
// TODO: more
}
@@ -214,7 +231,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
int ys = ofs.y + destPic->_bounds.top;
backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
- (this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, &backBounds);
+ (this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, backBounds);
}
}
@@ -276,8 +293,15 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
}
+/**
+ * Queues the given picture for display
+ */
void GraphicsManager::sDisplayPic(PictureResource *pic) {
- // TODO
+ if (pic->_flags & 8) {
+ _vm->_eventsManager._intPtr._field2A = READ_LE_UINT32(pic->_imgData) >> _sImageShift;
+ }
+
+ _vm->_eventsManager._intPtr._flipWait = true;
}
void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
@@ -313,4 +337,9 @@ void GraphicsManager::flipPage() {
}
}
+void GraphicsManager::restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
+ PictureResource *srcPic, PictureResource *destPic) {
+ //TODO
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index c34c2b44d3..263d44eb65 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -44,7 +44,7 @@ class ViewPortResource;
typedef void (GraphicsManager::*GraphicMethodPtr)();
typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
-typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int y, Common::Rect *bounds);
+typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int idx, const Common::Rect &bounds);
typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
class GraphicsManager {
@@ -64,12 +64,15 @@ public:
Common::Rect *_clipPtr;
int _screenOffset;
uint _planeSelect;
+ int _sImageShift;
private:
static void fadeIntFunc();
static void vDoFadeInt();
static void vDoCycleInt();
void addIntNode(IntNode *node);
+ void restoreBack(Common::Array<Common::Rect> &rectList, int rectListCount,
+ PictureResource *srcPic, PictureResource *destPic);
public:
GraphicsManager();
void setVm(VoyeurEngine *vm) { _vm = vm; }
@@ -79,9 +82,9 @@ public:
void addFadeInt();
void setupMCGASaveRect(ViewPortResource *viewPort);
- void addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds);
+ void addRectOptSaveRect(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
void restoreMCGASaveRect(ViewPortResource *viewPort);
- void addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds);
+ void addRectNoSaveBack(ViewPortResource *viewPort, int idx, const Common::Rect &bounds);
void EMSMapPageHandle(int v1, int v2, int v3);
void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1ff1bdea22..82ee1a87af 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -138,7 +138,7 @@ void VoyeurEngine::initInput() {
}
void VoyeurEngine::doHeadTitle() {
- char dest[144];
+// char dest[144];
_eventsManager.startMainClockInt();
if (_bVoy->getBoltGroup(0x10500)) {