VOYEUR: Implemented flipPage

This commit is contained in:
Paul Gilbert 2013-05-31 21:31:33 -04:00
parent 4279eedceb
commit a6c852c99d
4 changed files with 51 additions and 14 deletions

View File

@ -598,17 +598,20 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
_state(state) {
_flags = READ_LE_UINT16(src);
_next = state._curLibPtr->getBoltEntry(READ_LE_UINT32(src + 2))._viewPortResource;
_pageCount = READ_LE_UINT16(src + 6);
_pageIndex = READ_LE_UINT16(src + 8);
_lastPage = READ_LE_UINT16(src + 10);
int xs = READ_LE_UINT16(src + 0xC);
int ys = READ_LE_UINT16(src + 0xE);
_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 0x10),
ys + READ_LE_UINT16(src + 0x12));
int xs = READ_LE_UINT16(src + 12);
int ys = READ_LE_UINT16(src + 14);
_bounds = Common::Rect(xs, ys, xs + READ_LE_UINT16(src + 16),
ys + READ_LE_UINT16(src + 18));
_field18 = READ_LE_UINT16(src + 0x18);
_picResource = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
_currentPic = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x20));
_activePage = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x24));
_picResource2 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
_picResource3 = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x2C));
_pages[0] = state._curLibPtr->getPictureResouce(READ_LE_UINT32(src + 0x28));
_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);
@ -634,7 +637,7 @@ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src):
void ViewPortResource::setupViewPort(PictureResource *page, Common::Rect *clipRect,
ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn) {
PictureResource *pic = _picResource;
PictureResource *pic = _currentPic;
Common::Rect r = _bounds;
r.translate(pic->_bounds.left, pic->_bounds.top);
int xDiff, yDiff;

View File

@ -223,12 +223,14 @@ private:
ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn);
public:
ViewPortResource *_next;
int _pageCount;
int _pageIndex;
int _lastPage;
Common::Rect _bounds;
int _field18;
PictureResource *_picResource;
PictureResource *_currentPic;
PictureResource *_activePage;
PictureResource *_picResource2;
PictureResource *_picResource3;
PictureResource *_pages[2];
byte *_field30;
byte *_field34;
byte *_field38;

View File

@ -33,6 +33,7 @@ GraphicsManager::GraphicsManager() {
_SVGAMode = 0;
_SVGAReset = 0;
_screenOffset = 0;
_planeSelect = 0;
_palFlag = false;
_MCGAMode = false;
_saveBack = false;
@ -81,7 +82,7 @@ void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
Common::Rect *clipRect = _clipPtr;
_clipPtr = &viewPort->_clipRect;
sDrawPic(viewPort->_activePage, viewPort->_picResource, Common::Point(), NULL);
sDrawPic(viewPort->_activePage, viewPort->_currentPic, Common::Point(), NULL);
_clipPtr = clipRect;
}
@ -127,11 +128,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
if (srcDisplay->_flags & 0x8000) {
// A viewport was passed, not a picture
srcPic = ((ViewPortResource *)srcDisplay)->_picResource;
srcPic = ((ViewPortResource *)srcDisplay)->_currentPic;
}
if (destDisplay->_flags & 0x8000) {
destViewPort = (ViewPortResource *)destDisplay;
destPic = destViewPort->_picResource;
destPic = destViewPort->_currentPic;
}
Common::Point ofs = Common::Point(offset.x + srcPic->_bounds.left - destPic->_bounds.left,
@ -275,12 +276,41 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
}
void GraphicsManager::sDisplayPic(PictureResource *pic) {
// TODO
}
void GraphicsManager::EMSMapPageHandle(int v1, int v2, int v3) {
// TODO
}
void GraphicsManager::flipPage() {
Common::Array<ViewPortResource *> &viewPorts = *_viewPortListPtr;
bool flipFlag = false;
for (uint idx = 0; idx < viewPorts.size(); ++idx) {
if (viewPorts[idx]->_flags & 0x20) {
if ((viewPorts[idx]->_flags & 9) == 9) {
if (_planeSelect == idx)
sDisplayPic(viewPorts[idx]->_currentPic);
flipFlag = true;
}
}
if (flipFlag) {
ViewPortResource &viewPort = *viewPorts[idx];
viewPort._lastPage = viewPort._pageIndex;
++viewPort._pageIndex;
if (viewPort._pageIndex >= viewPort._pageCount)
viewPort._pageIndex = 0;
assert(viewPort._pageIndex < 2);
viewPort._currentPic = viewPort._pages[viewPort._pageIndex];
viewPort._flags = (viewPort._flags & 0xFFF7) | 0x40;
}
}
}
void GraphicsManager::sWaitFlip() {

View File

@ -63,6 +63,7 @@ public:
bool _saveBack;
Common::Rect *_clipPtr;
int _screenOffset;
uint _planeSelect;
private:
static void fadeIntFunc();
static void vDoFadeInt();
@ -84,6 +85,7 @@ public:
void EMSMapPageHandle(int v1, int v2, int v3);
void sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay, const Common::Point &offset, void *v3);
void sDisplayPic(PictureResource *pic);
void flipPage();
void sWaitFlip();
};