aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/parallaction_ns.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2007-09-23 20:17:50 +0000
committerNicola Mettifogo2007-09-23 20:17:50 +0000
commit05abbf49a2990fb16070682ab177aa88e823a382 (patch)
treeebe9980cf25252e4725ed68a533289133c697d5e /engines/parallaction/parallaction_ns.cpp
parent7da28f6129cf8b0fb06bbbc0f9d5e848c1695e9c (diff)
downloadscummvm-rg350-05abbf49a2990fb16070682ab177aa88e823a382.tar.gz
scummvm-rg350-05abbf49a2990fb16070682ab177aa88e823a382.tar.bz2
scummvm-rg350-05abbf49a2990fb16070682ab177aa88e823a382.zip
Moved most of inventory-related code inside classes Inventory and InventoryRenderer. Shift is not completed, as new code doesn't handle selections yet (falling back to existent code).
svn-id: r29060
Diffstat (limited to 'engines/parallaction/parallaction_ns.cpp')
-rw-r--r--engines/parallaction/parallaction_ns.cpp50
1 files changed, 32 insertions, 18 deletions
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 9f1b172bb5..6df2172557 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -139,34 +139,48 @@ void Parallaction_ns::initCursors() {
return;
}
-void Parallaction_ns::setMousePointer(int16 index) {
+void Parallaction_ns::setArrowCursor() {
- if (index == kCursorArrow) { // standard mouse pointer
+ debugC(1, kDebugInput, "setting mouse cursor to arrow");
- _system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
- _system->showMouse(true);
+ // this stuff is needed to avoid artifacts with labels and selected items when switching cursors
+ hideLabel(kPriority15);
+ _activeItem._id = 0;
- } else {
- // inventory item pointer
- byte *v8 = (byte*)_mouseComposedArrow->pixels;
+ _system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
+ _system->showMouse(true);
- // FIXME: destination offseting is not clear
- byte* s = _char._objs->getData(getInventoryItemIndex(index));
- byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
+}
- for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
- memcpy(d, s, INVENTORYITEM_WIDTH);
+void Parallaction_ns::setInventoryCursor(int pos) {
- s += INVENTORYITEM_PITCH;
- d += MOUSECOMBO_WIDTH;
- }
+ if (pos == -1)
+ return;
+
+ const InventoryItem *item = getInventoryItem(pos);
+ if (item->_index == 0)
+ return;
+
+ _activeItem._id = item->_id;
- _system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
+ byte *v8 = (byte*)_mouseComposedArrow->pixels;
+
+ // FIXME: destination offseting is not clear
+ byte* s = _char._objs->getData(item->_index);
+ byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
+
+ for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
+ memcpy(d, s, INVENTORYITEM_WIDTH);
+
+ s += INVENTORYITEM_PITCH;
+ d += MOUSECOMBO_WIDTH;
}
- return;
+ _system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
+
}
+
void Parallaction_ns::callFunction(uint index, void* parm) {
assert(index < 25); // magic value 25 is maximum # of callables for Nippon Safes
@@ -238,7 +252,7 @@ void Parallaction_ns::changeLocation(char *location) {
_hoverZone = NULL;
if (_engineFlags & kEngineBlockInput) {
- changeCursor( kCursorArrow );
+ setArrowCursor();
}
_animations.remove(&_char._ani);