diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gui/gui.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 2 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 26 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 2 |
4 files changed, 39 insertions, 1 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index e0fd24471f..8fe0243f41 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -228,7 +228,6 @@ void SciGUI::textColors(int argc, reg_t *argv) { void SciGUI::drawPicture(sciResourceId pictureId, uint16 style, uint16 flags, int16 EGApaletteNo) { bool addToFlag = flags ? true : false; - sciPort *oldPort = _gfx->SetPort((sciPort *)_windowMgr->_picWind); if (_windowMgr->isFrontWindow(_windowMgr->_picWind)) { @@ -317,6 +316,15 @@ void SciGUI::paletteAnimate(int fromColor, int toColor, int speed) { _gfx->animatePalette(fromColor, toColor, speed); } +int16 SciGUI::onControl(byte screenMask, Common::Rect rect) { + sciPort *oldPort = _gfx->SetPort((sciPort *)_windowMgr->_picWind); + int16 result; + + result = _gfx->onControl(screenMask, rect); + _gfx->SetPort(oldPort); + return result; +} + void SciGUI::moveCursor(int16 x, int16 y) { Common::Point newPos; sciPort *curPort = _gfx->GetPort(); diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 713db08bd5..de2353733e 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -74,6 +74,8 @@ public: virtual int16 paletteFind(int r, int g, int b); virtual void paletteAnimate(int fromColor, int toColor, int speed); + virtual int16 onControl(byte screenMask, Common::Rect rect); + virtual void moveCursor(int16 x, int16 y); private: diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 413939528b..fe1be61d80 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -1268,4 +1268,30 @@ void SciGUIgfx::animatePalette(byte fromColor, byte toColor, int speed) { _palSchedules.push_back(sched); } +int16 SciGUIgfx::onControl(uint16 screenMask, Common::Rect rect) { + Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom); + int16 x, y; + int16 result = 0; + + outRect.clip(_curPort->rect); + if (outRect.isEmpty()) // nothing to control + return 0; + OffsetRect(outRect); + + if (screenMask & SCI_SCREEN_MASK_PRIORITY) { + for (y = outRect.top; y < outRect.bottom; y++) { + for (x = outRect.left; x < outRect.right; x++) { + result |= 1 << _screen->Get_Priority(x, y); + } + } + } else { + for (y = outRect.top; y < outRect.bottom; y++) { + for (x = outRect.left; x < outRect.right; x++) { + result |= 1 << _screen->Get_Control(x, y); + } + } + } + return result; +} + } // end of namespace Sci diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 7ff89bb7ac..018b86090a 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -112,6 +112,8 @@ public: void animatePalette(byte fromColor, byte toColor, int speed); + int16 onControl(uint16 screenMask, Common::Rect rect); + sciPort *_menuPort; uint32 _sysTicks; int32 _sysSpeed; // ticker timer in ms |