diff options
author | lukaslw | 2014-06-15 15:52:08 +0200 |
---|---|---|
committer | lukaslw | 2014-06-22 20:09:07 +0200 |
commit | ca7554dae3bfce513d6a0b92be1274e168b60a87 (patch) | |
tree | c64704677721eb736a0265827ad158191c9126bd /engines/prince | |
parent | cb40b5123b6befccd95e24a0563152002567bf54 (diff) | |
download | scummvm-rg350-ca7554dae3bfce513d6a0b92be1274e168b60a87.tar.gz scummvm-rg350-ca7554dae3bfce513d6a0b92be1274e168b60a87.tar.bz2 scummvm-rg350-ca7554dae3bfce513d6a0b92be1274e168b60a87.zip |
PRINCE: checkOptions() implementation
Diffstat (limited to 'engines/prince')
-rw-r--r-- | engines/prince/prince.cpp | 53 | ||||
-rw-r--r-- | engines/prince/prince.h | 1 |
2 files changed, 53 insertions, 1 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 9cacbf7a94..12d9961583 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -1731,6 +1731,57 @@ void PrinceEngine::enableOptions() { } } +void PrinceEngine::checkOptions() { + if (_optionsFlag) { + Common::Rect optionsRect; + optionsRect.left = _optionsX; + optionsRect.top = _optionsY; + optionsRect.right = _optionsX + _optionsWidth; + optionsRect.bottom = _optionsY + _optionsHeight; + Common::Point mousePos = _system->getEventManager()->getMousePos(); + if (!optionsRect.contains(mousePos)) { + _optionsFlag = 0; + _selectedMob = 0; + return; + } + _graph->drawAsShadowSurface(_graph->_frontScreen, _optionsX, _optionsY, _optionsPic, _graph->_shadowTable50); + + _optionEnabled = -1; + int optionsYCord = mousePos.y - (_optionsY + 16); + if (optionsYCord >= 0) { + int selectedOptionNr = optionsYCord / _optionsStep; + if (selectedOptionNr < _optionsNumber) { + _optionEnabled = selectedOptionNr; + } + } + int optionsColor; + int textY = _optionsY + 16; + for (int i = 0; i < _optionsNumber; i++) { + if (i != _optionEnabled) { + optionsColor = _optionsColor1; + } else { + optionsColor = _optionsColor2; + } + Common::String optText; + switch(getLanguage()) { + case Common::PL_POL: + optText = optionsTextPL[i]; + break; + case Common::DE_DEU: + optText = optionsTextDE[i]; + break; + case Common::EN_ANY: + optText = optionsTextEN[i]; + break; + }; + uint16 textW = getTextWidth(optText.c_str()); + uint16 textX = _optionsX + _optionsWidth / 2 - textW / 2; + _font->drawString(_graph->_screenForInventory, optText, textX, textY, textW, optionsColor); + textY += _optionsStep; + } + } +} + void PrinceEngine::checkInvOptions() { if (_optionsFlag) { Common::Rect optionsRect; @@ -1750,7 +1801,7 @@ void PrinceEngine::checkInvOptions() { int optionsYCord = mousePos.y - (_optionsY + 16); if (optionsYCord >= 0) { int selectedOptionNr = optionsYCord / _invOptionsStep; - if (selectedOptionNr < _optionsNumber) { + if (selectedOptionNr < _invOptionsNumber) { _optionEnabled = selectedOptionNr; } } diff --git a/engines/prince/prince.h b/engines/prince/prince.h index d91037cc0d..80666b47a9 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -334,6 +334,7 @@ public: void addInvObj(); void makeInvCursor(int itemNr); void enableOptions(); + void checkOptions(); void checkInvOptions(); void inventoryLeftButton(); void inventoryRightButton(); |