aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2013-05-31 21:03:16 -0400
committerPaul Gilbert2013-05-31 21:03:16 -0400
commit4279eedceb261e3c179343b15d2e6841dc0bd43b (patch)
treecb6128c093a6052ee108a27131a967bd2990fb17 /engines
parent43d31cc33424c053e8f42c7fcb5f18b422ef1ef9 (diff)
downloadscummvm-rg350-4279eedceb261e3c179343b15d2e6841dc0bd43b.tar.gz
scummvm-rg350-4279eedceb261e3c179343b15d2e6841dc0bd43b.tar.bz2
scummvm-rg350-4279eedceb261e3c179343b15d2e6841dc0bd43b.zip
VOYEUR: Cleanup of sDrawPic parameter usage and viewport initialisation
Diffstat (limited to 'engines')
-rw-r--r--engines/voyeur/files.cpp10
-rw-r--r--engines/voyeur/files.h16
-rw-r--r--engines/voyeur/graphics.cpp54
-rw-r--r--engines/voyeur/graphics.h15
-rw-r--r--engines/voyeur/voyeur.cpp9
5 files changed, 62 insertions, 42 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 6f2ef5c288..f72517a672 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -412,8 +412,13 @@ void BoltFile::initViewPort() {
void BoltFile::initViewPortList() {
initDefault();
- _state._curMemberPtr->_viewPortListResource = new ViewPortListResource(
+
+ ViewPortListResource *res;
+ _state._curMemberPtr->_viewPortListResource = res = new ViewPortListResource(
_state, _state._curMemberPtr->_data);
+
+ _state._vm->_graphicsManager._viewPortListPtr = &res->_entries;
+ _state._vm->_graphicsManager._vPort = &res->_entries[0];
}
void BoltFile::initFontInfo() {
@@ -510,7 +515,6 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
_maskData = READ_LE_UINT32(&src[14]);
_imgData = NULL;
- _secondPicture = NULL;
int nbytes = _bounds.width() * _bounds.height();
if (_flags & 0x20) {
@@ -716,8 +720,6 @@ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *sr
assert(entry._viewPortResource);
_entries.push_back(entry._viewPortResource);
}
-
- state._vm->_graphicsManager._vPort = _entries[0];
}
/*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 57fbb0f880..d75c88ae0b 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -192,9 +192,13 @@ public:
bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
};
-class PictureResource {
+class DisplayResource {
public:
uint16 _flags;
+};
+
+class PictureResource: public DisplayResource {
+public:
byte _select;
byte _pick;
byte _onOff;
@@ -204,13 +208,6 @@ public:
uint _planeSize;
byte *_imgData;
-
- // TODO: Investigate further just why/how pictuers are chained
- PictureResource *_secondPicture;
- // TODO: Figure out if the following data is part of all pictures, or if
- // only for certain types (when flags & 0x8000 != 0)
- Common::Rect _bounds2;
- Field86MethodPtr _field86;
public:
PictureResource(BoltFilesState &state, const byte *src);
virtual ~PictureResource();
@@ -218,14 +215,13 @@ public:
typedef void (ViewPortResource::*ViewPortMethodPtr)();
-class ViewPortResource {
+class ViewPortResource: public DisplayResource {
private:
BoltFilesState &_state;
private:
void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn,
ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
public:
- int _flags;
ViewPortResource *_next;
Common::Rect _bounds;
int _field18;
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index 006aca12b3..0a208e4978 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -37,6 +37,8 @@ GraphicsManager::GraphicsManager() {
_MCGAMode = false;
_saveBack = false;
_clipPtr = NULL;
+ _viewPortListPtr = NULL;
+ _vPort = NULL;
}
void GraphicsManager::sInitGraphics() {
@@ -87,19 +89,19 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
viewPort->_field42 = -1;
}
-void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3) {
-
+void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
+ // TODO
}
void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) {
-
+ // TODO
}
-void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3) {
+void GraphicsManager::addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds) {
}
-void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic,
+void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
const Common::Point &offset, void *v3) {
int var4C = 0;
int width1, width2;
@@ -108,7 +110,7 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
int srcOffset;
int screenOffset;
int flags1, flags2;
- PictureResource *saveddestPic = NULL;
+ ViewPortResource *destViewPort = NULL;
Common::Rect newBounds;
Common::Rect backBounds;
int var24;
@@ -119,14 +121,17 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
byte *imgData1, *imgData2;
byte *srcP, *destP;
- if (srcPic->_flags & 0x8000) {
- srcPic = srcPic->_secondPicture;
- warning("TODO: Particularly validate 'extended' pictures");
+ // Get the picture parameters, or deference viewport pointers to get their pictures
+ PictureResource *srcPic = (PictureResource *)srcDisplay;
+ PictureResource *destPic = (PictureResource *)destDisplay;
+
+ if (srcDisplay->_flags & 0x8000) {
+ // A viewport was passed, not a picture
+ srcPic = ((ViewPortResource *)srcDisplay)->_picResource;
}
- if (destPic->_flags & 0x8000) {
- saveddestPic = destPic;
- destPic = destPic->_secondPicture;
- warning("TODO: Particularly validate 'extended' pictures");
+ if (destDisplay->_flags & 0x8000) {
+ destViewPort = (ViewPortResource *)destDisplay;
+ destPic = destViewPort->_picResource;
}
Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left,
@@ -142,10 +147,11 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
int xs = _clipPtr->left - srcPic->_bounds.left;
int ys = _clipPtr->top - srcPic->_bounds.top;
newBounds = Common::Rect(xs, ys, xs + _clipPtr->width(), ys + _clipPtr->height());
- } else if (saveddestPic) {
- int xs = saveddestPic->_bounds2.left - destPic->_bounds.left;
- int ys = saveddestPic->_bounds2.top - destPic->_bounds.top;
- newBounds = Common::Rect(xs, ys, xs + destPic->_bounds2.width(), ys + destPic->_bounds2.height());
+ } else if (destViewPort) {
+ int xs = destViewPort->_clipRect.left - destPic->_bounds.left;
+ int ys = destViewPort->_clipRect.top - destPic->_bounds.top;
+ newBounds = Common::Rect(xs, ys, xs + destViewPort->_clipRect.width(),
+ ys + destViewPort->_clipRect.height());
} else {
newBounds = Common::Rect(0, 0, destPic->_bounds.width(), destPic->_bounds.height());
}
@@ -196,18 +202,18 @@ void GraphicsManager::sDrawPic(PictureResource *srcPic, PictureResource *destPic
widthDiff = width1 - width2;
widthDiff2 = destPic->_bounds.width() - width2;
- if (saveddestPic) {
+ if (destViewPort) {
error("TODO: Examine further when it's actually used");
if (!_saveBack || ((srcPic->_flags & 0x800) != 0)) {
// TODO
- } else if (!saveddestPic->_field86) {
+ } else if (!destViewPort->_addFn) {
// TODO
} else {
int xs = ofs.x + destPic->_bounds.left;
int ys = ofs.y + destPic->_bounds.top;
backBounds = Common::Rect(xs, ys, xs + width2, ys + height1);
- (this->*saveddestPic->_field86)(saveddestPic, saveddestPic->_bounds.top, backBounds);
+ (this->*destViewPort->_addFn)(destViewPort, destViewPort->_bounds.top, &backBounds);
}
}
@@ -273,4 +279,12 @@ void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
// TODO
}
+void GraphicsManager::flipPage() {
+
+}
+
+void GraphicsManager::sWaitFlip() {
+
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index d17b18d3b0..f7e43ff65a 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -38,14 +38,14 @@ namespace Voyeur {
class VoyeurEngine;
class GraphicsManager;
+class DisplayResource;
class PictureResource;
class ViewPortResource;
typedef void (GraphicsManager::*GraphicMethodPtr)();
typedef void (GraphicsManager::*ViewPortSetupPtr)(ViewPortResource *);
-typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, void *v2, void *v3);
+typedef void (GraphicsManager::*ViewPortAddPtr)(ViewPortResource *, int y, Common::Rect *bounds);
typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *);
-typedef void (GraphicsManager::*Field86MethodPtr)(void *pic, int y, Common::Rect &bounds);
class GraphicsManager {
public:
@@ -57,7 +57,8 @@ public:
int _SVGAPage;
int _SVGAMode;
int _SVGAReset;
- ViewPortResource *_vPort;
+ Common::Array<ViewPortResource *> *_viewPortListPtr;
+ ViewPortResource **_vPort;
bool _MCGAMode;
bool _saveBack;
Common::Rect *_clipPtr;
@@ -77,12 +78,14 @@ public:
void addFadeInt();
void setupMCGASaveRect(ViewPortResource *viewPort);
- void addRectOptSaveRect(ViewPortResource *viewPort, void *v2, void *v3);
+ void addRectOptSaveRect(ViewPortResource *viewPort, int y, Common::Rect *bounds);
void restoreMCGASaveRect(ViewPortResource *viewPort);
- void addRectNoSaveBack(ViewPortResource *viewPort, void *v2, void *v3);
+ void addRectNoSaveBack(ViewPortResource *viewPort, int y, Common::Rect *bounds);
void EMSMapPageHandle(int v1, int v2, int v3);
- void sDrawPic(PictureResource *srcPic, PictureResource *destPic, const Common::Point &offset, void *v3);
+ void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
+ void flipPage();
+ void sWaitFlip();
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index dc25ec4745..27bf8585c9 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -143,8 +143,13 @@ void VoyeurEngine::doHeadTitle() {
_eventsManager.startMainClockInt();
if (_bVoy->getBoltGroup(0x10500)) {
_graphicsManager._backgroundPage = _bVoy->getBoltEntry(0x5020000)._picResource;
- _graphicsManager._vPort->setupViewPort();
-
+ (*_graphicsManager._vPort)->setupViewPort();
+ (*_graphicsManager._vPort)->_flags |= 8;
+
+ _graphicsManager.flipPage();
+ _graphicsManager.sWaitFlip();
+
+ // TODO:
}
}