AVALANCHE: Upgrade drop-down menu. (Now it's complete.) Fix Trip::neardoor().

This commit is contained in:
uruk 2013-09-02 15:44:55 +02:00
parent cf5f150d9b
commit 9e848e8e64
3 changed files with 14 additions and 7 deletions

View File

@ -532,7 +532,7 @@ void AvalancheEngine::updateEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
_lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::checkclick().
_lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link().
break;
case Common::EVENT_LBUTTONUP:
_lucerna->holdLeftMouse = false; // Same as above.

View File

@ -863,7 +863,8 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it...
if (_vm->_lucerna->holdLeftMouse) {
if (cursorPos.y > 21) {
if (!((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8)
&& (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) { // Clicked OUTSIDE the menu.
&& (cursorPos.y >= 24) && (cursorPos.y <= (ddm_o.fly * 2 + 1))))) {
// Clicked OUTSIDE the menu.
if (ddm_o.menunow) {
ddm_o.wipe();
_vm->_lucerna->holdLeftMouse = false;
@ -874,9 +875,16 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it...
// Clicked on menu bar.
if (ddm_o.menunow) {
ddm_o.wipe();
_vm->_lucerna->holdLeftMouse = true;
_vm->_graphics->_surface.copyFrom(backup);
_vm->_graphics->refreshScreen();
_vm->_lucerna->holdLeftMouse = true;
if (((ddm_o.left * 8) <= cursorPos.x) && (cursorPos.x <= (ddm_o.left * 8 + 80))) { // 80: the width of one menu item on the bar in pixels.
// If we clicked on the same menu item on the bar...
_vm->_lucerna->holdLeftMouse = false;
return;
}
break;
}
}
@ -885,8 +893,7 @@ void Dropdown::menu_link() { // TODO: Optimize it ASAP!!! It really needs it...
if ((ddm_o.firstlix) && ((cursorPos.x >= ddm_o.flx1 * 8) && (cursorPos.x <= ddm_o.flx2 * 8)
&& (cursorPos.y >= 12) && (cursorPos.y <= (ddm_o.fly * 2 + 1)))) {
// We act only if the button is relased over a menu item.
Common::Event event;
// We act only if the button is released over a menu item.
while (!_vm->shouldQuit()) {
cursorPos = _vm->getMousePos();
ddm_o.lightup(cursorPos);

View File

@ -1573,7 +1573,7 @@ bool Trip::infield(byte which) {
}
bool Trip::neardoor() {
if (_vm->_gyro->numfields < 9) {
if (_vm->_gyro->numfields < 8) {
/* there ARE no doors here! */
return false;
}
@ -1581,7 +1581,7 @@ bool Trip::neardoor() {
int16 ux = tr[0].x;
int16 uy = tr[0].y + tr[0]._info.yl;
bool nd = false;
for (byte fv = 9; fv <= _vm->_gyro->numfields; fv++)
for (byte fv = 8; fv < _vm->_gyro->numfields; fv++)
if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2)
&& (uy >= _vm->_gyro->fields[fv].y1) && (uy <= _vm->_gyro->fields[fv].y2))
nd = true;