aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/menu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/menu.cpp')
-rw-r--r--engines/agi/menu.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index cef60ca161..49c2d0eeab 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -49,8 +49,8 @@ GfxMenu::GfxMenu(AgiEngine *vm, GfxMgr *gfx, PictureMgr *picture, TextMgr *text)
_drawnMenuNr = -1;
_drawnMenuHeight = 0;
_drawnMenuWidth = 0;
- _drawnMenuRow = 0;
- _drawnMenuColumn = 0;
+ _drawnMenuY = 0;
+ _drawnMenuX = 0;
}
GfxMenu::~GfxMenu() {
@@ -323,8 +323,9 @@ void GfxMenu::execute() {
// Unless we are in "via mouse" mode. In that case check current mouse position
if (viaMouse) {
- int16 mouseRow = _vm->_mouse.pos.y / FONT_DISPLAY_HEIGHT;
- int16 mouseColumn = _vm->_mouse.pos.x / FONT_DISPLAY_WIDTH;
+ int16 mouseRow = _vm->_mouse.pos.y;
+ int16 mouseColumn = _vm->_mouse.pos.x;
+ _gfx->translateDisplayPosToFontScreen(mouseColumn, mouseRow);
mouseFindMenuSelection(mouseRow, mouseColumn, _drawnMenuNr, _mouseModeItemNr);
}
@@ -368,7 +369,7 @@ void GfxMenu::execute() {
// WORKAROUND: Playarea starts right at the stop, so instead of clearing that part, render it from playarea
// Required for at least Donald Duck
// This was not done by original AGI, which means the upper pixel line were cleared in this case.
- _gfx->render_Block(0, (1 * FONT_VISUAL_HEIGHT) - 1, SCRIPT_WIDTH, FONT_VISUAL_HEIGHT);
+ _gfx->render_Block(0, 0, SCRIPT_WIDTH, FONT_VISUAL_HEIGHT);
} else {
_text->clearLine(0, 0);
}
@@ -427,10 +428,11 @@ void GfxMenu::drawMenu(int16 selectedMenuNr, int16 selectedMenuItemNr) {
// calculate active menu dimensions
_drawnMenuHeight = (menuEntry->itemCount + 2) * FONT_VISUAL_HEIGHT;
_drawnMenuWidth = (menuEntry->maxItemTextLen * FONT_VISUAL_WIDTH) + 8;
- _drawnMenuRow = (menuEntry->itemCount + 3 - _text->getWindowRowMin()) * FONT_VISUAL_HEIGHT - 1;
- _drawnMenuColumn = (itemEntry->column - 1) * FONT_VISUAL_WIDTH;
+ _drawnMenuY = (1 - _text->getWindowRowMin()) * FONT_VISUAL_HEIGHT;
+ //(menuEntry->itemCount + 3 - _text->getWindowRowMin()) * FONT_VISUAL_HEIGHT - 1;
+ _drawnMenuX = (itemEntry->column - 1) * FONT_VISUAL_WIDTH;
- _gfx->drawBox(_drawnMenuColumn, _drawnMenuRow, _drawnMenuWidth, _drawnMenuHeight, 15, 0);
+ _gfx->drawBox(_drawnMenuX, _drawnMenuY, _drawnMenuWidth, _drawnMenuHeight, 15, 0);
while (itemCount) {
if (itemNr == selectedMenuItemNr) {
@@ -448,7 +450,7 @@ void GfxMenu::removeActiveMenu(int16 selectedMenuNr) {
drawMenuName(selectedMenuNr, false);
// overwrite actual menu items by rendering play screen
- _gfx->render_Block(_drawnMenuColumn, _drawnMenuRow, _drawnMenuWidth, _drawnMenuHeight);
+ _gfx->render_Block(_drawnMenuX, _drawnMenuY, _drawnMenuWidth, _drawnMenuHeight);
}
void GfxMenu::keyPress(uint16 newKey) {
@@ -549,8 +551,10 @@ void GfxMenu::keyPress(uint16 newKey) {
// In "via mouse" mode, we check if user let go of the left mouse button and then select the item that way
void GfxMenu::mouseEvent(uint16 newKey) {
// Find out, where current mouse cursor actually is
- int16 mouseRow = _vm->_mouse.pos.y / FONT_DISPLAY_HEIGHT;
- int16 mouseColumn = _vm->_mouse.pos.x / FONT_DISPLAY_WIDTH;
+ int16 mouseRow = _vm->_mouse.pos.y;
+ int16 mouseColumn = _vm->_mouse.pos.x;
+
+ _gfx->translateDisplayPosToFontScreen(mouseColumn, mouseRow);
int16 activeMenuNr, activeItemNr;
mouseFindMenuSelection(mouseRow, mouseColumn, activeMenuNr, activeItemNr);
@@ -638,7 +642,7 @@ void GfxMenu::mouseFindMenuSelection(int16 mouseRow, int16 mouseColumn, int16 &a
if (mouseRow == menuEntry->row) {
// line match
- if ((mouseColumn >= menuEntry->column) && (mouseColumn <= (menuEntry->column + menuEntry->textLen))) {
+ if ((mouseColumn >= menuEntry->column) && (mouseColumn < (menuEntry->column + menuEntry->textLen))) {
// full match
activeMenuNr = menuNr;
activeMenuItemNr = -1; // no item selected
@@ -660,7 +664,7 @@ void GfxMenu::mouseFindMenuSelection(int16 mouseRow, int16 mouseColumn, int16 &a
if (mouseRow == itemEntry->row) {
// line match
- if ((mouseColumn >= itemEntry->column) && (mouseColumn <= (itemEntry->column + itemEntry->textLen))) {
+ if ((mouseColumn >= itemEntry->column) && (mouseColumn < (itemEntry->column + itemEntry->textLen))) {
// full match
if (itemEntry->enabled) {
// Only see it, when it's currently enabled