diff options
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/events.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/events.h | 10 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_map.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 11 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 12 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_options.cpp | 18 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_options.h | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_quit.cpp | 18 |
9 files changed, 48 insertions, 40 deletions
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index a8912f6f1e..0f3b781520 100644 --- a/engines/sherlock/events.cpp +++ b/engines/sherlock/events.cpp @@ -157,10 +157,6 @@ bool Events::isCursorVisible() const { return CursorMan.isVisible(); } -void Events::moveMouse(const Common::Point &pt) { - g_system->warpMouse(pt.x, pt.y); -} - void Events::pollEvents() { checkForNextFrameCounter(); @@ -208,7 +204,14 @@ void Events::pollEventsAndWait() { } void Events::warpMouse(const Common::Point &pt) { - g_system->warpMouse(pt.x, pt.y); + Common::Point p = pt - _vm->_screen->_currentScroll; + g_system->warpMouse(p.x, p.y); +} + +void Events::warpMouse() { + Screen &screen = *_vm->_screen; + warpMouse(Common::Point(screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH / 2, + screen._currentScroll.y + SHERLOCK_SCREEN_HEIGHT / 2)); } bool Events::checkForNextFrameCounter() { diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h index 93a5e54f81..3dd4da2411 100644 --- a/engines/sherlock/events.h +++ b/engines/sherlock/events.h @@ -110,11 +110,6 @@ public: bool isCursorVisible() const; /** - * Move the mouse - */ - void moveMouse(const Common::Point &pt); - - /** * Check for any pending events */ void pollEvents(); @@ -131,6 +126,11 @@ public: void warpMouse(const Common::Point &pt); /** + * Move the mouse cursor to the center of the screen + */ + void warpMouse(); + + /** * Get the current mouse position */ Common::Point screenMousePos() const; diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index aa0a2f48b4..f9a10ebc70 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -432,7 +432,7 @@ OpcodeReturn ScalpelTalk::cmdMoveMouse(const byte *&str) { Events &events = *_vm->_events; ++str; - events.moveMouse(Common::Point((str[0] - 1) * 256 + str[1] - 1, str[2])); + events.warpMouse(Common::Point((str[0] - 1) * 256 + str[1] - 1, str[2])); if (_talkToAbort) return RET_EXIT; str += 3; diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp index 79eca00e91..96bc1f8a42 100644 --- a/engines/sherlock/tattoo/tattoo_map.cpp +++ b/engines/sherlock/tattoo/tattoo_map.cpp @@ -92,7 +92,7 @@ int TattooMap::show() { // Load the custom mouse cursors for the map ImageFile cursors("omouse.vgs"); events.setCursor(cursors[0]._frame); - events.warpMouse(Common::Point(SHERLOCK_SCREEN_WIDTH / 2, SHERLOCK_SCREEN_HEIGHT / 2)); + events.warpMouse(); // Load the data for the map _iconImages = new ImageFile("mapicons.vgs"); diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index ef9e895870..f602259ea8 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -31,7 +31,7 @@ namespace Tattoo { TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm), _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm), _verbsWidget(vm), - _labWidget(vm), _creditsWidget(vm), _optionsWidget(vm) { + _labWidget(vm), _creditsWidget(vm), _optionsWidget(vm), _quitWidget(vm) { Common::fill(&_lookupTable[0], &_lookupTable[PALETTE_COUNT], 0); Common::fill(&_lookupTable1[0], &_lookupTable1[PALETTE_COUNT], 0); _scrollSize = 0; @@ -404,12 +404,14 @@ void TattooUserInterface::doStandardControl() { case Common::KEYCODE_F4: // Display options - _optionsWidget.summonWindow(); + events.warpMouse(); + _optionsWidget.load(); return; case Common::KEYCODE_F10: // Quit menu freeMenu(); + events.warpMouse(); doQuitMenu(); return; @@ -559,7 +561,6 @@ void TattooUserInterface::doInventory(int mode) { } void TattooUserInterface::doControls() { - _menuMode = OPTION_MODE; _optionsWidget.load(); } @@ -568,7 +569,7 @@ void TattooUserInterface::pickUpObject(int objNum) { } void TattooUserInterface::doQuitMenu() { - // TODO + _quitWidget.show(); } void TattooUserInterface::putMessage(const char *formatStr, ...) { @@ -818,7 +819,7 @@ void TattooUserInterface::makeBGArea(const Common::Rect &r) { Screen &screen = *_vm->_screen; for (int yp = r.top; yp < r.bottom; ++yp) { - byte *ptr = screen._backBuffer1.getBasePtr(r.left + screen._currentScroll.x, yp); + byte *ptr = screen._backBuffer1.getBasePtr(r.left, yp); for (int xp = r.left; xp < r.right; ++xp, ++ptr) *ptr = _lookupTable[*ptr]; diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index 790c892ec8..016398efd5 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -32,6 +32,7 @@ #include "sherlock/tattoo/widget_inventory.h" #include "sherlock/tattoo/widget_lab.h" #include "sherlock/tattoo/widget_options.h" +#include "sherlock/tattoo/widget_quit.h" #include "sherlock/tattoo/widget_text.h" #include "sherlock/tattoo/widget_tooltip.h" #include "sherlock/tattoo/widget_verbs.h" @@ -55,6 +56,7 @@ private: int _cAnimFramePause; WidgetInventory _inventoryWidget; WidgetMessage _messageWidget; + WidgetQuit _quitWidget; Common::List<WidgetBase *> _widgets; byte _lookupTable[PALETTE_COUNT]; byte _lookupTable1[PALETTE_COUNT]; @@ -85,11 +87,6 @@ private: void initFileMenu(); /** - * Handle displaying the quit menu - */ - void doQuitMenu(); - - /** * Free any active menu */ void freeMenu(); @@ -161,6 +158,11 @@ public: void doControls(); /** + * Handle the display of the quit menu + */ + void doQuitMenu(); + + /** * Pick up the selected object */ void pickUpObject(int objNum); diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp index a96fcf4eaa..dd5fd701a8 100644 --- a/engines/sherlock/tattoo/widget_options.cpp +++ b/engines/sherlock/tattoo/widget_options.cpp @@ -30,7 +30,7 @@ namespace Sherlock { namespace Tattoo { -WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm), _quitWidget(vm) { +WidgetOptions::WidgetOptions(SherlockEngine *vm) : WidgetBase(vm) { _midiSliderX = _digiSliderX = 0; _selector = _oldSelector = -1; } @@ -39,6 +39,7 @@ void WidgetOptions::load() { Events &events = *_vm->_events; Music &music = *_vm->_music; Sound &sound = *_vm->_sound; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; Common::Point mousePos = events.mousePos(); // Set bounds for the dialog @@ -54,6 +55,9 @@ void WidgetOptions::load() { // Setup the dialog _surface.create(_bounds.width(), _bounds.height()); render(); + + summonWindow(); + ui._menuMode = OPTION_MODE; } void WidgetOptions::handleEvents() { @@ -234,7 +238,7 @@ void WidgetOptions::handleEvents() { case 10: // Quit banishWindow(); - _quitWidget.show(); + ui.doQuitMenu(); break; default: @@ -303,11 +307,12 @@ void WidgetOptions::render(OptionRenderMode mode) { sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY); _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE); - drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6)); + drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6)); _surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2, _midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE); - drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2, 7, num)); + drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2, + _midiSliderX + 4, sliderY - (num - 6) / 2 + num)); if (_midiSliderX - 4 > _surface.widestChar()) _surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM); @@ -332,10 +337,11 @@ void WidgetOptions::render(OptionRenderMode mode) { sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY); _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.w() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE); - drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar() * 2, 6)); + drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.w() - _surface.widestChar(), sliderY + 6)); _surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE); - drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, 7, num)); + drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4, + sliderY - (num - 6) / 2 + num)); if (_digiSliderX - 4 > _surface.widestChar()) _surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM); if (_digiSliderX + 4 < _surface.w() - _surface.widestChar()) diff --git a/engines/sherlock/tattoo/widget_options.h b/engines/sherlock/tattoo/widget_options.h index 213704f2ee..c2f1fccf53 100644 --- a/engines/sherlock/tattoo/widget_options.h +++ b/engines/sherlock/tattoo/widget_options.h @@ -25,7 +25,6 @@ #include "common/scummsys.h" #include "sherlock/tattoo/widget_base.h" -#include "sherlock/tattoo/widget_quit.h" namespace Sherlock { @@ -42,7 +41,6 @@ class WidgetOptions : public WidgetBase { private: int _midiSliderX, _digiSliderX; int _selector, _oldSelector; - WidgetQuit _quitWidget; /** * Render the contents of the dialog onto the widget's surface diff --git a/engines/sherlock/tattoo/widget_quit.cpp b/engines/sherlock/tattoo/widget_quit.cpp index c44a4887f8..472ef48772 100644 --- a/engines/sherlock/tattoo/widget_quit.cpp +++ b/engines/sherlock/tattoo/widget_quit.cpp @@ -35,18 +35,18 @@ WidgetQuit::WidgetQuit(SherlockEngine *vm) : WidgetBase(vm) { } void WidgetQuit::show() { - Screen &screen = *_vm->_screen; + Events &events = *_vm->_events; TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; ImageFile &images = *ui._interfaceImages; + Common::Point mousePos = events.mousePos(); const char *YES = FIXED(Yes); const char *NO = FIXED(No); // Set up the display area _bounds = Common::Rect(_surface.stringWidth(FIXED(AreYouSureYou)) + _surface.widestChar() * 2, (_surface.fontHeight() + 7) * 4); - _bounds.moveTo((SHERLOCK_SCREEN_WIDTH - _bounds.width()) / 2 + screen._currentScroll.x, - SHERLOCK_SCREEN_HEIGHT - _bounds.height() - 100); - + _bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2); + // Create the surface _surface.create(_bounds.width(), _bounds.height()); _surface.fill(TRANSPARENCY); @@ -72,6 +72,7 @@ void WidgetQuit::show() { } ui._menuMode = QUIT_MODE; + summonWindow(); } void WidgetQuit::handleEvents() { @@ -81,7 +82,7 @@ void WidgetQuit::handleEvents() { Common::Rect btn1Rect(_bounds.left, _bounds.top + (_surface.fontHeight() + 4) * 2 + 3, _bounds.right, _bounds.top + (_surface.fontHeight() + 4) * 2 + 3 + _surface.fontHeight() + 7); Common::Rect btn2Rect(_bounds.left, _bounds.top + (_surface.fontHeight() + 4) * 2 + _surface.fontHeight() + 10, - _bounds.right, _bounds.top + (_surface.fontHeight() + 4) * 2 + 3 + _surface.fontHeight() + 7); + _bounds.right, _bounds.top + (_surface.fontHeight() + 4) * 2 + 10 + _surface.fontHeight() * 2 + 7); if (talk._talkToAbort) return; @@ -152,12 +153,9 @@ void WidgetQuit::handleEvents() { _select = -1; _outsideMenu = false; - if (btn2Rect.contains(mousePos)) { - close(); - } else if (btn1Rect.contains(mousePos)) { - close(); + close(); + if (btn1Rect.contains(mousePos)) _vm->quitGame(); - } } } |