From 8f3d5d53200bc9a2b9f54ee94939766d34d8e3b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Jun 2013 21:20:42 -0400 Subject: VOYEUR: Fixed initialisation of viewport parent pointer --- engines/voyeur/events.cpp | 7 +++++-- engines/voyeur/files.cpp | 12 +++++++++--- engines/voyeur/files.h | 2 +- engines/voyeur/graphics.cpp | 11 ++--------- 4 files changed, 17 insertions(+), 15 deletions(-) (limited to 'engines/voyeur') diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 47f70d39bf..9a22efefef 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -72,8 +72,10 @@ void EventsManager::vStopCycle() { } void EventsManager::sWaitFlip() { - // TODO: See if this needs a proper wait loop with event polling - //while (_intPtr.field39) ; + while (_gameData._flipWait && !_vm->shouldQuit()) { + pollEvents(); + g_system->delayMillis(10); + } Common::Array &viewPorts = _vm->_graphicsManager._viewPortListPtr->_entries; for (uint idx = 0; idx < viewPorts.size(); ++idx) { @@ -88,6 +90,7 @@ void EventsManager::sWaitFlip() { _vm->_graphicsManager._clipPtr = clipPtr; viewPort._rectListCount[viewPort._pageIndex] = 0; + viewPort._rectListPtr[viewPort._pageIndex]->clear(); viewPort._flags &= 0xFFBF; } } diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 69cfcc2786..335255d3e5 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -457,8 +457,14 @@ void BoltFile::vInitCycl() { void BoltFile::initViewPort() { initDefault(); - _state._curMemberPtr->_viewPortResource = new ViewPortResource( - _state, _state._curMemberPtr->_data); + + ViewPortResource *viewPort; + byte *src = _state._curMemberPtr->_data; + _state._curMemberPtr->_viewPortResource = viewPort = new ViewPortResource(_state, src); + + // This is done post-constructor, since viewports can be self referential, so + // we ned the _viewPortResource field to have been set before resolving the pointer + viewPort->_parent = getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource; } void BoltFile::initViewPortList() { @@ -693,7 +699,7 @@ PictureResource::~PictureResource() { ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src): _fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) { _flags = READ_LE_UINT16(src); - _next = state._curLibPtr->getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource; + _parent = NULL; _pageCount = READ_LE_UINT16(src + 6); _pageIndex = READ_LE_UINT16(src + 8); _lastPage = READ_LE_UINT16(src + 10); diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 659f29baaf..4d8b86f9a6 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -234,7 +234,7 @@ private: void setupViewPort(PictureResource *page, Common::Rect *clipRect, ViewPortSetupPtr setupFn, ViewPortAddPtr addFn, ViewPortRestorePtr restoreFn); public: - ViewPortResource *_next; + ViewPortResource *_parent; int _pageCount; int _pageIndex; int _lastPage; diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 99abc11f52..9eacda86c2 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -549,15 +549,8 @@ void GraphicsManager::setColor(int idx, int r, int g, int b) { void GraphicsManager::screenReset() { 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; + fillPic(*_vPort, 0); + (*_vPort)->_parent->_flags |= 8; // Flip flipPage(); -- cgit v1.2.3