VOYEUR: Fixed initialisation of viewport parent pointer

This commit is contained in:
Paul Gilbert 2013-06-16 21:20:42 -04:00
parent 76ba4bcafb
commit 8f3d5d5320
4 changed files with 17 additions and 15 deletions

View File

@ -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<ViewPortResource *> &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;
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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();