diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/menubar.cpp | 5 | ||||
-rw-r--r-- | engines/sci/gfx/menubar.h | 6 |
3 files changed, 8 insertions, 9 deletions
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 37c43096c1..a716805e9a 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -187,7 +187,7 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { /* Default to menu 0, unless the mouse was used to generate this effect */ if (mouse_down) - s->_menubar->mapPointer(cursorPos, menu_nr, item_nr, port); + s->_menubar->mapPointer(cursorPos, menu_nr, item_nr, toCommonRect(port->_bounds)); else menu_nr = 0; @@ -263,7 +263,7 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { { Common::Point curMousePos = s->_cursor->getPosition(); menu_mode = (curMousePos.y < 10); - claimed = !menu_mode && !s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, port); + claimed = !menu_mode && !s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, toCommonRect(port->_bounds)); mouse_down = 0; } break; @@ -278,7 +278,7 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { } if (mouse_down) - s->_menubar->mapPointer(s->_cursor->getPosition(), menu_nr, item_nr, port); + s->_menubar->mapPointer(s->_cursor->getPosition(), menu_nr, item_nr, toCommonRect(port->_bounds)); if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */ diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 1786c7026f..62120097ab 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -32,7 +32,6 @@ #include "sci/engine/state.h" #include "sci/gfx/menubar.h" #include "sci/engine/kernel.h" -#include "sci/gfx/gfx_state_internal.h" // required for GfxPort namespace Sci { @@ -389,7 +388,7 @@ bool Menubar::itemValid(int menu_nr, int item_nr) const { return false; // May not be selected } -bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, GfxPort *port) const { +bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, Common::Rect portBounds) const { if (pointerPos.y <= 10) { // Re-evaulate menu int x = MENU_LEFT_BORDER; @@ -418,7 +417,7 @@ bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &ite if ((int)menu._items.size() <= row) return true; - if ((pointerPos.x < port->_bounds.x) || (pointerPos.x > port->_bounds.x + port->_bounds.width)) + if ((pointerPos.x < portBounds.left) || (pointerPos.x > portBounds.right)) return true; if (itemValid(menu_nr, row)) diff --git a/engines/sci/gfx/menubar.h b/engines/sci/gfx/menubar.h index 029af5923b..5a440a480b 100644 --- a/engines/sci/gfx/menubar.h +++ b/engines/sci/gfx/menubar.h @@ -30,9 +30,9 @@ #include "sci/engine/vm_types.h" #include "sci/gfx/operations.h" -#include "sci/gfx/gfx_widgets.h" #include "common/array.h" +#include "common/rect.h" namespace Sci { @@ -214,11 +214,11 @@ public: * necessary) * @param[in] item_nr the current menu item (updated by this function * if necessary) - * @param[in] port the port of the currently active menu (if any) + * @param[in] portBounds the port bounds of the currently active menu (if any) * @return true if the pointer is outside a valid port, * false otherwise. */ - bool mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, GfxPort *port) const; + bool mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, Common::Rect portBounds) const; }; |