Skip to content

Commit

Permalink
PRINCE: enableOptions() - update for inventory items
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jul 29, 2014
1 parent 4a022e7 commit 956b989
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
51 changes: 27 additions & 24 deletions engines/prince/prince.cpp
Expand Up @@ -2382,7 +2382,7 @@ void PrinceEngine::rightMouseButton() {
_secondHero->freeOldMove();
_interpreter->storeNewPC(0);
if (_currentPointerNumber < 2) {
enableOptions();
enableOptions(true);
} else {
_currentPointerNumber = 1;
changeCursor(1);
Expand Down Expand Up @@ -2536,38 +2536,41 @@ void PrinceEngine::inventoryLeftMouseButton() {

void PrinceEngine::inventoryRightMouseButton() {
if (_textSlots[0]._str == nullptr) {
enableOptions();
enableOptions(false);
}
}

void PrinceEngine::enableOptions() {
void PrinceEngine::enableOptions(bool checkType) {
if (_optionsFlag != 1) {
changeCursor(1);
_currentPointerNumber = 1;
if (_selectedMob != -1) {
if (_mobList[_selectedMob]._type != 0x100) {
Common::Point mousePos = _system->getEventManager()->getMousePos();
int x1 = mousePos.x - _optionsWidth / 2;
int x2 = mousePos.x + _optionsWidth / 2;
if (x1 < 0) {
x1 = 0;
x2 = _optionsWidth;
} else if (x2 >= kNormalWidth) {
x1 = kNormalWidth - _optionsWidth;
x2 = kNormalWidth;
}
int y1 = mousePos.y - 10;
if (y1 < 0) {
y1 = 0;
}
if (y1 + _optionsHeight >= kNormalHeight) {
y1 = kNormalHeight - _optionsHeight;
if (checkType) {
if (_mobList[_selectedMob]._type == 0x100) {
return;
}
_optionsMob = _selectedMob;
_optionsX = x1;
_optionsY = y1;
_optionsFlag = 1;
}
Common::Point mousePos = _system->getEventManager()->getMousePos();
int x1 = mousePos.x - _optionsWidth / 2;
int x2 = mousePos.x + _optionsWidth / 2;
if (x1 < 0) {
x1 = 0;
x2 = _optionsWidth;
} else if (x2 >= kNormalWidth) {
x1 = kNormalWidth - _optionsWidth;
x2 = kNormalWidth;
}
int y1 = mousePos.y - 10;
if (y1 < 0) {
y1 = 0;
}
if (y1 + _optionsHeight >= kNormalHeight) {
y1 = kNormalHeight - _optionsHeight;
}
_optionsMob = _selectedMob;
_optionsX = x1;
_optionsY = y1;
_optionsFlag = 1;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/prince/prince.h
Expand Up @@ -422,7 +422,7 @@ class PrinceEngine : public Engine {
void swapInv(int heroId);
void addInvObj();
void makeInvCursor(int itemNr);
void enableOptions();
void enableOptions(bool checkType);
void checkOptions();
void checkInvOptions();

Expand Down

0 comments on commit 956b989

Please sign in to comment.