From cbbdf4db47cc6efeef5d9fa2630445e64aa3e444 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 18 Jan 2014 08:09:38 -0500 Subject: VOYEUR: Fix sFillBox to work for PictureResource as well --- engines/voyeur/files.cpp | 50 ++++++++++++++++++++++++++---------------- engines/voyeur/files.h | 8 ++++++- engines/voyeur/voyeur_game.cpp | 6 ++--- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index e728696038..67488e4643 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -724,7 +724,34 @@ RectResource::RectResource(int x1, int y1, int x2, int y2) { /*------------------------------------------------------------------------*/ -PictureResource::PictureResource(BoltFilesState &state, const byte *src) { +DisplayResource::DisplayResource() { + _vm = NULL; +} + +DisplayResource::DisplayResource(VoyeurEngine *vm) { + _vm = vm; +} + +void DisplayResource::sFillBox(int width, int height) { + assert(_vm); + bool saveBack = _vm->_graphicsManager._saveBack; + _vm->_graphicsManager._saveBack = false; + + PictureResource pr; + pr._flags = 1; + pr._select = 0xff; + pr._pick = 0; + pr._onOff = _vm->_graphicsManager._drawPtr->_penColor; + pr._bounds = Common::Rect(0, 0, width, height); + + _vm->_graphicsManager.sDrawPic(&pr, this, _vm->_graphicsManager._drawPtr->_pos); + _vm->_graphicsManager._saveBack = saveBack; +} + +/*------------------------------------------------------------------------*/ + +PictureResource::PictureResource(BoltFilesState &state, const byte *src): + DisplayResource(state._vm) { _flags = READ_LE_UINT16(src); _select = src[2]; _pick = src[3]; @@ -915,7 +942,8 @@ void PictureResource::flipVertical(const byte *data) { /*------------------------------------------------------------------------*/ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src): - _fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) { + _fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), + _state(state), DisplayResource(state._vm) { _flags = READ_LE_UINT16(src); _parent = NULL; _pageCount = READ_LE_UINT16(src + 6); @@ -1271,23 +1299,7 @@ int ViewPortResource::textWidth(const Common::String &msg) { void ViewPortResource::addSaveRect(int pageIndex, const Common::Rect &r) { // TODO - warning("TODO: addSaveRect"); -} - -void ViewPortResource::sFillBox(int width, int height) { - bool saveBack = _state._vm->_graphicsManager._saveBack; - _state._vm->_graphicsManager._saveBack = false; - - PictureResource pr; - pr._flags = 1; - pr._select = 0xff; - pr._pick = 0; - pr._onOff = _state._vm->_graphicsManager._drawPtr->_penColor; - pr._bounds = Common::Rect(0, 0, width, height); - - _state._vm->_graphicsManager.sDrawPic(&pr, this, - _state._vm->_graphicsManager._drawPtr->_pos); - _state._vm->_graphicsManager._saveBack = saveBack; + error("TODO: addSaveRect"); } void ViewPortResource::fillPic(byte onOff) { diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index e2a638028b..cbbf35eff8 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -248,8 +248,15 @@ enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 }; class DisplayResource { +private: + VoyeurEngine *_vm; public: uint32 _flags; +public: + DisplayResource(); + DisplayResource(VoyeurEngine *vm); + + void sFillBox(int width, int height); }; /* bvoy.blt resource types */ @@ -338,7 +345,6 @@ public: int drawText(const Common::String &msg); int textWidth(const Common::String &msg); void addSaveRect(int pageIndex, const Common::Rect &r); - void sFillBox(int width, int height); void fillPic(byte onOff = 0); void drawIfaceTime(); }; diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index f31e67b0fc..d55a972c64 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -483,8 +483,7 @@ void VoyeurEngine::reviewTape() { _graphicsManager._drawPtr->_penColor = 0; _graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top); - // TODO: Check - does drawText need to work on PictureResources? - ((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height()); + _graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height()); newX = si; int yp = 45; @@ -549,8 +548,7 @@ void VoyeurEngine::reviewTape() { _graphicsManager._drawPtr->_penColor = 0; _graphicsManager._drawPtr->_pos = Common::Point(tempRect.left, tempRect.top); - // TODO: Does sFillBox need to work on picture resources? - ((ViewPortResource *)_graphicsManager._backgroundPage)->sFillBox(tempRect.width(), tempRect.height()); + _graphicsManager._backgroundPage->sFillBox(tempRect.width(), tempRect.height()); evtIndex = si; int yp = 45; -- cgit v1.2.3