[Scummvm-cvs-logs] SF.net SVN: scummvm:[39662] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Mar 24 13:14:41 CET 2009
Revision: 39662
http://scummvm.svn.sourceforge.net/scummvm/?rev=39662&view=rev
Author: fingolfin
Date: 2009-03-24 12:14:41 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
SCI: Only pass the pointerpos to Menubar::mapPointer, not the full gfx_state_t
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kmenu.cpp
scummvm/trunk/engines/sci/gfx/menubar.cpp
scummvm/trunk/engines/sci/gfx/menubar.h
Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-03-24 12:14:22 UTC (rev 39661)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-03-24 12:14:41 UTC (rev 39662)
@@ -193,7 +193,7 @@
/* Default to menu 0, unless the mouse was used to generate this effect */
if (mouse_down)
- s->_menubar->mapPointer(s->gfx_state, &menu_nr, &item_nr, port);
+ s->_menubar->mapPointer(s->gfx_state->pointer_pos, menu_nr, item_nr, port);
else
menu_nr = 0;
@@ -267,7 +267,7 @@
case SCI_EVT_MOUSE_RELEASE:
menu_mode = (s->gfx_state->pointer_pos.y < 10);
- claimed = !menu_mode && !s->_menubar->mapPointer(s->gfx_state, &menu_nr, &item_nr, port);
+ claimed = !menu_mode && !s->_menubar->mapPointer(s->gfx_state->pointer_pos, menu_nr, item_nr, port);
mouse_down = 0;
break;
@@ -281,7 +281,7 @@
}
if (mouse_down)
- s->_menubar->mapPointer(s->gfx_state, &menu_nr, &item_nr, port);
+ s->_menubar->mapPointer(s->gfx_state->pointer_pos, menu_nr, item_nr, port);
if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */
Modified: scummvm/trunk/engines/sci/gfx/menubar.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.cpp 2009-03-24 12:14:22 UTC (rev 39661)
+++ scummvm/trunk/engines/sci/gfx/menubar.cpp 2009-03-24 12:14:41 UTC (rev 39662)
@@ -387,40 +387,40 @@
return false; // May not be selected
}
-bool Menubar::mapPointer(gfx_state_t *state, int *menu_nr, int *item_nr, gfxw_port_t *port) const {
+bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, gfxw_port_t *port) const {
- if (state->pointer_pos.y <= 10) { // Re-evaulate menu
+ if (pointerPos.y <= 10) { // Re-evaulate menu
int x = MENU_LEFT_BORDER;
for (uint i = 0; i < _menus.size(); i++) {
int newx = x + MENU_BORDER_SIZE * 2 + _menus[i]._titleWidth;
- if (state->pointer_pos.x < x)
+ if (pointerPos.x < x)
return false;
- if (state->pointer_pos.x < newx) {
- *menu_nr = i;
- *item_nr = -1;
+ if (pointerPos.x < newx) {
+ menu_nr = i;
+ item_nr = -1;
}
x = newx;
}
} else {
- int row = (state->pointer_pos.y / 10) - 1;
+ int row = (pointerPos.y / 10) - 1;
- if ((*menu_nr < 0) || (*menu_nr >= (int)_menus.size()))
+ if ((menu_nr < 0) || (menu_nr >= (int)_menus.size()))
return true; // No menu
- const Menu &menu = _menus[*menu_nr]; // Menu is valid, assume that it's popped up
+ const Menu &menu = _menus[menu_nr]; // Menu is valid, assume that it's popped up
if ((int)menu._items.size() <= row)
return true;
- if ((state->pointer_pos.x < port->bounds.x) || (state->pointer_pos.x > port->bounds.x + port->bounds.width))
+ if ((pointerPos.x < port->bounds.x) || (pointerPos.x > port->bounds.x + port->bounds.width))
return true;
- if (itemValid(*menu_nr, row))
- *item_nr = row; // Only modify if we'll be hitting a valid element
+ if (itemValid(menu_nr, row))
+ item_nr = row; // Only modify if we'll be hitting a valid element
}
Modified: scummvm/trunk/engines/sci/gfx/menubar.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.h 2009-03-24 12:14:22 UTC (rev 39661)
+++ scummvm/trunk/engines/sci/gfx/menubar.h 2009-03-24 12:14:41 UTC (rev 39662)
@@ -204,12 +204,13 @@
/**
* Maps the pointer position to a (menu,item) tuple.
- * Parameters: (gfx_state_t *) state: The current state
- * ((int *) x (int *)) (menu_nr, item_nr): Pointers to the current menu/item tuple
- * (port_t *) port: The port of the currently active menu (if any)
+ * @param pointerPos the current pointer position
+ * @param menu_nr the current menu (updated by this function if necessary)
+ * @param item_nr the current menu item (updated by this function if necessary)
+ * @param port the port of the currently active menu (if any)
* @return true if the pointer is outside a valid port, false otherwise.
*/
- bool mapPointer(gfx_state_t *state, int *menu_nr, int *item_nr, gfxw_port_t *port) const;
+ bool mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, gfxw_port_t *port) const;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list