diff options
author | Florian Kagerer | 2009-06-21 20:40:31 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-06-21 20:40:31 +0000 |
commit | df611a52784a41660c578fe22aed190d71101740 (patch) | |
tree | 2e4fe27b6b1ccd88b9d25a380fb7f47bb036305c /engines/kyra | |
parent | 7eaf539b23c0d4a52c7c562532649e6bff69be90 (diff) | |
download | scummvm-rg350-df611a52784a41660c578fe22aed190d71101740.tar.gz scummvm-rg350-df611a52784a41660c578fe22aed190d71101740.tar.bz2 scummvm-rg350-df611a52784a41660c578fe22aed190d71101740.zip |
LOL: - implemented support for "floating cursors"
- prevent complete refresh for audio menu whenever a mouse button is pressed
svn-id: r41734
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/gui_lol.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 57 | ||||
-rw-r--r-- | engines/kyra/lol.h | 4 |
3 files changed, 62 insertions, 9 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 27780fef8d..a88310910f 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -585,7 +585,7 @@ void LoLEngine::gui_drawCompass() { } int LoLEngine::gui_enableControls() { - _floatingMouseArrowControl = 0; + _floatingCursorControl = 0; if (!_currentControlMode) { for (int i = 76; i < 85; i++) @@ -600,7 +600,7 @@ int LoLEngine::gui_disableControls(int controlMode) { if (_currentControlMode) return 0; - _floatingMouseArrowControl = (controlMode & 2) ? 2 : 1; + _floatingCursorControl = (controlMode & 2) ? 2 : 1; gui_toggleFightButtons(true); @@ -2406,7 +2406,7 @@ int GUI_LoL::runMenu(Menu &menu) { if (getInput()) { if (!_newMenu) - _newMenu = _currentMenu; + _newMenu = (_currentMenu != &_audioOptions) ? _currentMenu : 0; else _lastMenu = _menuResult == -1 ? _lastMenu : _currentMenu; } @@ -2685,8 +2685,10 @@ int GUI_LoL::clickedAudioMenu(Button *button) { newVolume = CLIP(newVolume, 2, 102); - if (newVolume == oldVolume) + if (newVolume == oldVolume) { + _screen->updateScreen(); return 0; + } _screen->drawShape(0, _vm->_gameShapes[87], tX + oldVolume, button->y, 0, 0x10); // Temporary HACK diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index ba6689c8a8..399b051ba0 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -200,7 +200,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _partyPosX = _partyPosY = 0; _shpDmX = _shpDmY = _dmScaleW = _dmScaleH = 0; - _floatingMouseArrowControl = 0; + _floatingCursorControl = _currentFloatingCursor = 0; memset(_activeTim, 0, sizeof(_activeTim)); memset(_openDoorState, 0, sizeof(_openDoorState)); @@ -663,6 +663,55 @@ bool LoLEngine::posWithinRect(int mouseX, int mouseY, int x1, int y1, int x2, in return true; } +void LoLEngine::checkFloatingPointerRegions() { + if (!_floatingCursorsEnabled) + return; + + int t = -1; + + Common::Point p = getMousePos(); + int mouseX = p.x; + int mouseY = p.y; + + if (!(_updateFlags & 4) & !_floatingCursorControl) { + if (posWithinRect(p.x, p.y, 96, 0, 303, 136)) { + if (!posWithinRect(p.x, p.y, 128, 16, 271, 119)) { + if (posWithinRect(p.x, p.y, 112, 0, 287, 15)) + t = 0; + if (posWithinRect(p.x, p.y, 272, 88, 303, 319)) + t = 1; + if (posWithinRect(p.x, p.y, 112, 110, 287, 135)) + t = 2; + if (posWithinRect(p.x, p.y, 96, 88, 127, 119)) + t = 3; + if (posWithinRect(p.x, p.y, 96, 16, 127, 87)) + t = 4; + if (posWithinRect(p.x, p.y, 272, 16, 303, 87)) + t = 5; + + if (t < 4) { + int d = (_currentDirection + t) & 3; + if (!checkBlockPassability(calcNewBlockPosition(_currentBlock, d), d)) + t = 6; + } + } + } + } + + if (t == _currentFloatingCursor) + return; + + if (t == -1) { + setMouseCursorToItemInHand(); + } else { + static const uint8 floatingPtrX[] = { 7, 13, 7, 0, 0, 15, 7 }; + static const uint8 floatingPtrY[] = { 0, 7, 12, 7, 6, 6, 7 }; + _screen->setMouseCursor(floatingPtrX[t], floatingPtrY[t], _gameShapes[10 + t]); + } + + _currentFloatingCursor = t; +} + uint8 *LoLEngine::getItemIconShapePtr(int index) { int ix = _itemProperties[_itemsInPlay[index].itemPropertyIndex].shpIndex; if (_itemProperties[_itemsInPlay[index].itemPropertyIndex].flags & 0x200) @@ -860,7 +909,7 @@ void LoLEngine::runLoop() { _timer->update(); - //checkFloatingPointerRegions(); + checkFloatingPointerRegions(); gui_updateInput(); update(); @@ -1465,7 +1514,7 @@ void LoLEngine::gui_specialSceneSuspendControls(int controlMode) { _specialSceneFlag = 1; _currentControlMode = controlMode; calcCharPortraitXpos(); - //checkMouseRegions(); + checkFloatingPointerRegions(); } void LoLEngine::gui_specialSceneRestoreControls(int restoreLamp) { @@ -1475,7 +1524,7 @@ void LoLEngine::gui_specialSceneRestoreControls(int restoreLamp) { } _updateFlags &= 0xfffe; _specialSceneFlag = 0; - //checkMouseRegions(); + checkFloatingPointerRegions(); } void LoLEngine::restoreAfterSceneWindowDialogue(int redraw) { diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 9d9a8948de..75c1ed5af7 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -347,7 +347,9 @@ private: uint8 *getItemIconShapePtr(int index); bool posWithinRect(int mouseX, int mouseY, int x1, int y1, int x2, int y2); - int _floatingMouseArrowControl; + void checkFloatingPointerRegions(); + int _floatingCursorControl; + int _currentFloatingCursor; // intro + character selection int processPrologue(); |