From 54c479c3d9e7cf47e00d2b2d2c6bd16989eeb510 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Feb 2014 22:22:34 -0500 Subject: VOYEUR: Bugfixes for computer event display --- engines/voyeur/data.cpp | 4 ++-- engines/voyeur/data.h | 4 ++-- engines/voyeur/files.cpp | 17 +++++++++++++++++ engines/voyeur/files.h | 1 + engines/voyeur/files_threads.cpp | 15 ++++++++------- engines/voyeur/voyeur.h | 2 +- engines/voyeur/voyeur_game.cpp | 21 ++++++++++++++------- 7 files changed, 45 insertions(+), 19 deletions(-) (limited to 'engines') diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp index 0f11c7bda2..e3791d2303 100644 --- a/engines/voyeur/data.cpp +++ b/engines/voyeur/data.cpp @@ -88,8 +88,8 @@ void SVoy::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_field4AC); s.syncAsSint16LE(_field4B8); s.syncAsSint16LE(_computerTextId); - s.syncAsSint16LE(_field4EC); - s.syncAsSint16LE(_field4EE); + s.syncAsSint16LE(_computerTimeMin); + s.syncAsSint16LE(_computerTimeMax); s.syncAsSint16LE(_field4F0); s.syncAsSint16LE(_field4F2); diff --git a/engines/voyeur/data.h b/engines/voyeur/data.h index b243b15682..bdd583b9c3 100644 --- a/engines/voyeur/data.h +++ b/engines/voyeur/data.h @@ -128,8 +128,8 @@ public: int _computerTextId; Common::Rect _rect4E4; - int _field4EC; - int _field4EE; + int _computerTimeMin; + int _computerTimeMax; int _field4F0; int _field4F2; diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index fe77d2f9e9..b5f6fb906a 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -1398,6 +1398,23 @@ void ViewPortResource::drawIfaceTime() { Common::Point(215, 27)); } +void ViewPortResource::drawPicPerm(PictureResource *pic, const Common::Point &pt) { + Common::Rect bounds = pic->_bounds; + bounds.translate(pt.x, pt.y); + + bool saveBack = _state._vm->_graphicsManager._saveBack; + _state._vm->_graphicsManager._saveBack = false; + _state._vm->_graphicsManager.sDrawPic(pic, this, pt); + clipRect(bounds); + + for (int pageIndex = 0; pageIndex < _pageCount; ++pageIndex) { + if (_pageIndex != pageIndex) { + addSaveRect(pageIndex, bounds); + } + } + + _state._vm->_graphicsManager._saveBack = saveBack; +} /*------------------------------------------------------------------------*/ ViewPortListResource::ViewPortListResource(BoltFilesState &state, const byte *src) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index 1ea8428fc8..604b30334a 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -373,6 +373,7 @@ public: void addSaveRect(int pageIndex, const Common::Rect &r); void fillPic(byte onOff = 0); void drawIfaceTime(); + void drawPicPerm(PictureResource *pic, const Common::Point &pt); }; class ViewPortPalEntry { diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index f18d84ec88..7955cfdbb6 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -629,8 +629,8 @@ void ThreadResource::parsePlayCommands() { if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) { _vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2); - _vm->_voy._field4EC = READ_LE_UINT16(dataP + 4); - _vm->_voy._field4EE = READ_LE_UINT16(dataP + 6); + _vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4); + _vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6); _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4]; _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1]; @@ -1198,8 +1198,8 @@ void ThreadResource::doRoom() { if (hotspotId == -1) { vm._eventsManager.setCursorColor(128, 0); vm._eventsManager.setCursor(crosshairsCursor); - } else if (hotspotId != 999 || voy._RTVNum < voy._field4EC || - (voy._field4EE - 2) < voy._RTVNum) { + } else if (hotspotId != 999 || voy._RTVNum < voy._computerTimeMin || + (voy._computerTimeMax - 2) < voy._RTVNum) { vm._eventsManager.setCursorColor(128, 1); vm._eventsManager.setCursor(magnifierCursor); } else { @@ -1241,9 +1241,9 @@ void ThreadResource::doRoom() { vm._eventsManager._mouseClicked = false; vm._eventsManager.startCursorBlink(); - int v = vm.doComputerText(9999); - if (v) - vm._voy.addComputerEventEnd(v); + int totalChars = vm.doComputerText(9999); + if (totalChars) + vm._voy.addComputerEventEnd(totalChars); vm._bVoy->freeBoltGroup(0x4900); } else { @@ -1262,6 +1262,7 @@ void ThreadResource::doRoom() { vm._graphicsManager._backgroundPage = vm._bVoy->boltEntry( vm._playStampGroupId)._picResource; + (*vm._graphicsManager._vPort)->setupViewPort(); vm._graphicsManager._backColors->startFade(); _vm->flipPageAndWait(); diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h index f39c4a2d1d..a79ec5b93d 100644 --- a/engines/voyeur/voyeur.h +++ b/engines/voyeur/voyeur.h @@ -238,7 +238,7 @@ public: void makeViewFinderP(); void initIFace(); void checkTransition(); - bool doComputerText(int maxLen); + int doComputerText(int maxLen); void getComputerBrush(); /** diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index b6390c5cef..a95355e8e0 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -1160,7 +1160,7 @@ Common::String VoyeurEngine::getTimeOfDay() { return Common::String::format("%d:%02d%s", _gameHour, _gameMinute, _voy._isAM ? AM : PM); } -bool VoyeurEngine::doComputerText(int maxLen) { +int VoyeurEngine::doComputerText(int maxLen) { FontInfoResource &font = *_graphicsManager._fontPtr; int totalChars = 0; @@ -1171,7 +1171,7 @@ bool VoyeurEngine::doComputerText(int maxLen) { if (_voy._vocSecondsOffset > 60) _voy._vocSecondsOffset = 0; - if (_voy._RTVNum > _voy._field4EE && maxLen == 9999) { + if (_voy._RTVNum > _voy._computerTimeMax && maxLen == 9999) { if (_currentVocId != -1) _soundManager.startVOCPlay(_currentVocId); font._justify = ALIGN_LEFT; @@ -1179,7 +1179,7 @@ bool VoyeurEngine::doComputerText(int maxLen) { font._justifyHeight = 100; font._pos = Common::Point(128, 100); (*_graphicsManager._vPort)->drawText(END_OF_MESSAGE); - } else if (_voy._RTVNum < _voy._field4EC && maxLen == 9999) { + } else if (_voy._RTVNum < _voy._computerTimeMin && maxLen == 9999) { if (_currentVocId != -1) _soundManager.startVOCPlay(_currentVocId); font._justify = ALIGN_LEFT; @@ -1244,7 +1244,7 @@ bool VoyeurEngine::doComputerText(int maxLen) { } while (!shouldQuit() && !_eventsManager._mouseClicked && totalChars < maxLen); - _voy._field4EE = 0; + _voy._computerTimeMax = 0; } flipPageAndWait(); @@ -1254,9 +1254,16 @@ bool VoyeurEngine::doComputerText(int maxLen) { } void VoyeurEngine::getComputerBrush() { - error("TODO: getComputerBrush"); -// if (_bVoy->getBoltGroup(0x4900)) { -// } + if (_bVoy->getBoltGroup(0x4900)) { + PictureResource *pic = _bVoy->boltEntry(0x490E)._picResource; + int xp = (384 - pic->_bounds.width()) / 2; + int yp = (240 - pic->_bounds.height()) / 2 - 4; + + (*_graphicsManager._vPort)->drawPicPerm(pic, Common::Point(xp, yp)); + + CMapResource *pal = _bVoy->boltEntry(0x490F)._cMapResource; + pal->startFade(); + } } void VoyeurEngine::doTimeBar(bool force) { -- cgit v1.2.3