diff options
author | Matthew Stewart | 2018-05-17 19:35:31 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | 6117a8919432e7223f3e263f7d9c2f84840f76b9 (patch) | |
tree | 5a605ac102264ce9ea41bc11ba14299a10d0460f /engines/startrek/menu.cpp | |
parent | 02485484c31bee3101ecd3ac7ccb86e2db7b029b (diff) | |
download | scummvm-rg350-6117a8919432e7223f3e263f7d9c2f84840f76b9.tar.gz scummvm-rg350-6117a8919432e7223f3e263f7d9c2f84840f76b9.tar.bz2 scummvm-rg350-6117a8919432e7223f3e263f7d9c2f84840f76b9.zip |
STARTREK: Inventory menu and hotspots
Action buttons now react when hovering over hotspots.
Diffstat (limited to 'engines/startrek/menu.cpp')
-rw-r--r-- | engines/startrek/menu.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/engines/startrek/menu.cpp b/engines/startrek/menu.cpp index acd41549f3..50661be8ed 100644 --- a/engines/startrek/menu.cpp +++ b/engines/startrek/menu.cpp @@ -31,9 +31,9 @@ namespace StarTrek { /** * Returns the index of the button at the given position, or -1 if none. */ -int StarTrekEngine::getMenuButtonAt(const Menu &menu, int x, int y) { - for (int i = 0; i < menu.numButtons; i++) { - const Sprite &spr = menu.sprites[i]; +int StarTrekEngine::getMenuButtonAt(Sprite *sprites, int numSprites, int x, int y) { + for (int i = 0; i < numSprites; i++) { + const Sprite &spr = sprites[i]; if (spr.drawMode != 2) continue; @@ -130,7 +130,6 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri && (mouseX1 == 0x7fff || vCenter >= mouseY1)) { mouseX1 = hCenter; mouseY1 = vCenter; - debug("Try %d %d", mouseX1, mouseY1); } if (mouseX2 == 0x7fff || vCenter > mouseY2 || (hCenter == mouseX2 && vCenter == mouseY2)) { @@ -656,7 +655,7 @@ int StarTrekEngine::handleMenuEvents(uint32 ticksUntilClickingEnabled, bool arg4 case TREKEVENT_TICK: { case TREKEVENT_MOUSEMOVE: // FIXME: actual game only uses TICK event here Common::Point mousePos = _gfx->getMousePos(); - int buttonIndex = getMenuButtonAt(*_activeMenu, mousePos.x, mousePos.y); + int buttonIndex = getMenuButtonAt(_activeMenu->sprites, _activeMenu->numButtons, mousePos.x, mousePos.y); if (buttonIndex != -1) { if (_activeMenu->disabledButtons & (1<<buttonIndex)) buttonIndex = -1; @@ -704,7 +703,7 @@ int StarTrekEngine::handleMenuEvents(uint32 ticksUntilClickingEnabled, bool arg4 } else { Common::Point mouse = _gfx->getMousePos(); - if (getMenuButtonAt(*_activeMenu, mouse.x, mouse.y) == -1) { + if (getMenuButtonAt(_activeMenu->sprites, _activeMenu->numButtons, mouse.x, mouse.y) == -1) { playSoundEffectIndex(0x10); return MENUEVENT_LCLICK_OFFBUTTON; } |