diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/objects.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 2 | ||||
-rw-r--r-- | engines/sherlock/scene.h | 10 | ||||
-rw-r--r-- | engines/sherlock/surface.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 69 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 46 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 15 |
10 files changed, 159 insertions, 7 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index 3e8838cb79..8818f805a5 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -1151,6 +1151,10 @@ CAnimStream::CAnimStream() { _zPlacement = 0; } +void CAnimStream::getNextFrame() { + // TODO +} + /*----------------------------------------------------------------*/ SceneImage::SceneImage() { diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index ec5c2e7897..d671066a23 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -429,6 +429,8 @@ struct CAnimStream { int _zPlacement; // Used by doBgAnim for determining Z order CAnimStream(); + + void getNextFrame(); }; struct SceneImage { diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index 624e4d3c99..37a1b32740 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -183,11 +183,6 @@ private: * will remain the same on future visits to the scene */ void saveSceneStatus(); - - /** - * Draw all the shapes, people and NPCs in the correct order - */ - void drawAllShapes(); protected: SherlockEngine *_vm; @@ -198,6 +193,11 @@ protected: */ virtual void checkBgShapes(); + /** + * Draw all the shapes, people and NPCs in the correct order + */ + void drawAllShapes(); + Scene(SherlockEngine *vm); public: int _currentScene; diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp index 6cf479c962..5a9e59e01b 100644 --- a/engines/sherlock/surface.cpp +++ b/engines/sherlock/surface.cpp @@ -96,6 +96,12 @@ void Surface::transBlitFrom(const ImageFrame &src, const Common::Point &pt, transBlitFrom(src._frame, pt + src._offset, flipped, overrideColor); } +void Surface::transBlitFrom(const Surface &src, const Common::Point &pt, + bool flipped, int overrideColor) { + const Graphics::Surface &s = src._surface; + transBlitFrom(s, pt, flipped, overrideColor); +} + void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt, bool flipped, int overrideColor) { Common::Rect drawRect(0, 0, src.w, src.h); diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp index 6d90416c34..368b24bfcd 100644 --- a/engines/sherlock/tattoo/tattoo.cpp +++ b/engines/sherlock/tattoo/tattoo.cpp @@ -68,6 +68,10 @@ void TattooEngine::loadInitialPalette() { delete stream; } +void TattooEngine::drawCredits() { + // TODO +} + void TattooEngine::eraseCredits() { // TODO } diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h index b6a85108e4..bb6310dbe3 100644 --- a/engines/sherlock/tattoo/tattoo.h +++ b/engines/sherlock/tattoo/tattoo.h @@ -54,6 +54,11 @@ public: virtual ~TattooEngine() {} /** + * Draw credits on the screen + */ + void drawCredits(); + + /** * Erase any area of the screen covered by credits */ void eraseCredits(); diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index 1effd60682..dd96f3358e 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -196,6 +196,8 @@ void TattooScene::doBgAnimEraseBackground() { } void TattooScene::doBgAnim() { + TattooUserInterface &ui = *((TattooUserInterface *)_vm->_ui); + doBgAnimCheckCursor(); // Events &events = *_vm->_events; @@ -208,7 +210,7 @@ void TattooScene::doBgAnim() { talk._talkToAbort = false; // Check the characters and sprites for updates - for (int idx = 0; idx < MAX_CHARACTERS; ++idx) { + for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) { if (people[idx]._type == CHARACTER) people[idx].checkSprite(); } @@ -220,8 +222,73 @@ void TattooScene::doBgAnim() { // Erase any affected background areas doBgAnimEraseBackground(); + + doBgAnimUpdateBgObjectsAndAnim(); + + ui.drawInterface(); +} + +void TattooScene::doBgAnimUpdateBgObjectsAndAnim() { + TattooEngine &vm = *((TattooEngine *)_vm); + People &people = *_vm->_people; + Screen &screen = *_vm->_screen; + + for (uint idx = 0; idx < _bgShapes.size(); ++idx) { + Object &obj = _bgShapes[idx]; + if (obj._type == ACTIVE_BG_SHAPE || obj._type == NO_SHAPE) + obj.adjustObject(); + } + + for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) { + if (people[idx]._type == CHARACTER) + people[idx].adjustSprite(); + } + + if (_activeCAnim._images != nullptr != _activeCAnim._zPlacement != REMOVE) { + _activeCAnim.getNextFrame(); + } + + // Flag the bg shapes which need to be redrawn + checkBgShapes(); + drawAllShapes(); + + + if (_mask != nullptr) { + switch (_currentScene) { + case 7: + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 110), screen._currentScroll); + break; + + case 8: + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 180), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 180), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 180), screen._currentScroll); + if (!_vm->readFlags(880)) + screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(940, 300), screen._currentScroll); + break; + + case 18: + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 203), screen._currentScroll); + if (!_vm->readFlags(189)) + screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + _maskOffset.x, 239), screen._currentScroll); + break; + + case 53: + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110), screen._currentScroll); + break; + + case 68: + screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 203), screen._currentScroll); + screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124 + _maskOffset.x, 239), screen._currentScroll); + break; + } + } } + void TattooScene::updateBackground() { People &people = *_vm->_people; Screen &screen = *_vm->_screen; diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h index 5e26eaa455..de28306c1b 100644 --- a/engines/sherlock/tattoo/tattoo_scene.h +++ b/engines/sherlock/tattoo/tattoo_scene.h @@ -39,6 +39,11 @@ private: void doBgAnimCheckCursor(); void doBgAnimEraseBackground(); + + /** + * Update the background objects and canimations as part of doBgAnim + */ + void doBgAnimUpdateBgObjectsAndAnim(); protected: /** * Checks all the background shapes. If a background shape is animating, diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 98ec34d62c..e76322833f 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -22,7 +22,7 @@ #include "sherlock/tattoo/tattoo_user_interface.h" #include "sherlock/tattoo/tattoo_scene.h" -#include "sherlock/sherlock.h" +#include "sherlock/tattoo/tattoo.h" namespace Sherlock { @@ -31,6 +31,8 @@ namespace Tattoo { TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm) { _menuBuffer = nullptr; _invMenuBuffer = nullptr; + _tagBuffer = nullptr; + _invGraphic = nullptr; } void TattooUserInterface::handleInput() { @@ -38,6 +40,44 @@ void TattooUserInterface::handleInput() { _vm->_events->pollEventsAndWait(); } +void TattooUserInterface::drawInterface(int bufferNum) { + Screen &screen = *_vm->_screen; + TattooEngine &vm = *((TattooEngine *)_vm); + + if (_invMenuBuffer != nullptr) { + Common::Rect r = _invMenuBounds; + r.grow(-3); + r.translate(-screen._currentScroll, 0); + _grayAreas.clear(); + _grayAreas.push_back(r); + + drawGrayAreas(); + screen._backBuffer1.transBlitFrom(*_invMenuBuffer, Common::Point(_invMenuBounds.left, _invMenuBounds.top)); + } + + if (_menuBuffer != nullptr) { + Common::Rect r = _menuBounds; + r.grow(-3); + r.translate(-screen._currentScroll, 0); + _grayAreas.clear(); + _grayAreas.push_back(r); + + drawGrayAreas(); + screen._backBuffer1.transBlitFrom(*_menuBuffer, Common::Point(_invMenuBounds.left, _invMenuBounds.top)); + } + + // See if we need to draw a Text Tag floating with the cursor + if (_tagBuffer != nullptr) + screen._backBuffer1.transBlitFrom(*_tagBuffer, Common::Point(_tagBounds.left, _tagBounds.top)); + + // See if we need to draw an Inventory Item Graphic floating with the cursor + if (_invGraphic != nullptr) + screen._backBuffer1.transBlitFrom(*_invGraphic, Common::Point(_invGraphicBounds.left, _invGraphicBounds.top)); + + if (vm._creditsActive) + vm.drawCredits(); +} + void TattooUserInterface::doBgAnimRestoreUI() { TattooScene &scene = *((TattooScene *)_vm->_scene); Screen &screen = *_vm->_screen; @@ -101,6 +141,10 @@ void TattooUserInterface::doScroll() { _invMenuBounds.translate(screen._currentScroll - oldScroll, 0); } +void TattooUserInterface::drawGrayAreas() { + // TODO +} + } // End of namespace Tattoo } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index c7a4c4cf77..2125f1ba07 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -36,10 +36,20 @@ private: Common::Rect _oldMenuBounds; Common::Rect _invMenuBounds; Common::Rect _oldInvMenuBounds; + Common::Rect _tagBounds; Common::Rect _oldTagBounds; + Common::Rect _invGraphicBounds; Common::Rect _oldInvGraphicBounds; Surface *_menuBuffer; Surface *_invMenuBuffer; + Surface *_tagBuffer; + Surface *_invGraphic; + Common::Array<Common::Rect> _grayAreas; +private: + /** + * Draws designated areas of the screen that are meant to be grayed out using grayscale colors + */ + void drawGrayAreas(); public: TattooUserInterface(SherlockEngine *vm); @@ -59,6 +69,11 @@ public: * Main input handler for the user interface */ virtual void handleInput(); + + /** + * Draw the user interface onto the screen's back buffers + */ + virtual void drawInterface(int bufferNum = 3); }; } // End of namespace Tattoo |