aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-11-06 21:52:05 -0500
committerPaul Gilbert2014-12-12 22:23:31 -0500
commitb5ad2b9db52e4184829c02830a9d2b22b6f85dde (patch)
tree09c9b37ec79f427f758bfa6864cac5071f087016 /engines
parentb0653e1c924650c86edd220a37786c82faaeb11e (diff)
downloadscummvm-rg350-b5ad2b9db52e4184829c02830a9d2b22b6f85dde.tar.gz
scummvm-rg350-b5ad2b9db52e4184829c02830a9d2b22b6f85dde.tar.bz2
scummvm-rg350-b5ad2b9db52e4184829c02830a9d2b22b6f85dde.zip
ACCESS: Inventory item merge zoom partially working
Diffstat (limited to 'engines')
-rw-r--r--engines/access/inventory.cpp61
-rw-r--r--engines/access/inventory.h2
2 files changed, 59 insertions, 4 deletions
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp
index 86e73c1cec..2dc73a2864 100644
--- a/engines/access/inventory.cpp
+++ b/engines/access/inventory.cpp
@@ -308,10 +308,11 @@ void InventoryManager::chooseItem() {
int selIndex;
while (!_vm->shouldQuit()) {
+ // Check for events
+ events.pollEvents();
g_system->delayMillis(10);
// Poll events and wait for a click on a known area
- events.pollEvents();
if (!events._leftButton || ((selIndex = coordIndexOf()) == -1))
continue;
@@ -319,7 +320,7 @@ void InventoryManager::chooseItem() {
if (selIndex == 25)
_vm->_useItem = -1;
break;
- } else if (selIndex < (int)_items.size()) {
+ } else if (selIndex < (int)_items.size() && _items[selIndex] != -1) {
_boxNum = selIndex;
_vm->copyBF2Vid();
combineItems();
@@ -417,7 +418,7 @@ void InventoryManager::combineItems() {
}
int destBox = events.checkMouseBox1(_invCoords);
- if (destBox >= 0 && destBox != _boxNum && destBox < _items.size()
+ if (destBox >= 0 && destBox != _boxNum && destBox < (int)_items.size()
&& _items[destBox] != -1) {
int itemA = invItem;
int itemB = _items[destBox];
@@ -432,9 +433,19 @@ void InventoryManager::combineItems() {
_items[destBox] = combinedItem;
_tempLOff[destBox] = _inv[combinedItem]._name;
- // TODO: zoomIcon calls?
+ // Zoom out the old two items and zoom in the new combined item
+ events.hideCursor();
+ zoomIcon(itemA, itemB, destBox, true);
+ Common::Rect destRect(_invCoords[destBox].left, _invCoords[destBox].top,
+ _invCoords[destBox].left + 46, _invCoords[destBox].top + 35);
+ _vm->_buffer2.copyBlock(&_vm->_buffer1, destRect);
+ screen._screenYOff = 0;
+
+ zoomIcon(itemB, -1, destBox, true);
+ zoomIcon(combinedItem, -1, destBox, false);
_boxNum = destBox;
+ events.showCursor();
return;
}
}
@@ -443,6 +454,48 @@ void InventoryManager::combineItems() {
putInvIcon(_boxNum, invItem);
}
+void InventoryManager::zoomIcon(int zoomItem, int backItem, int zoomBox, bool shrink) {
+ Screen &screen = *_vm->_screen;
+ screen._screenYOff = 0;
+ SpriteResource *sprites = _vm->_objectsTable[99];
+
+ int8 zoomScale = shrink ? -1 : 1;
+ int8 zoomInc = shrink ? -1 : 1;
+ Common::Rect boxRect(_invCoords[zoomBox].left, _invCoords[zoomBox].top,
+ _invCoords[zoomBox].left + 46, _invCoords[zoomBox].top + 35);
+
+ while (!_vm->shouldQuit() && zoomScale != 0) {
+ _vm->_events->pollEvents();
+ g_system->delayMillis(5);
+
+ _vm->_buffer2.copyBlock(&_vm->_buffer1, boxRect);
+ if (backItem != -1) {
+ _iconDisplayFlag = false;
+ putInvIcon(zoomBox, backItem);
+ }
+
+ _vm->_scale = zoomScale;
+ screen.setScaleTable(zoomScale);
+
+ int xv = screen._scaleTable1[boxRect.width() + 1];
+ if (xv) {
+ int yv = screen._scaleTable1[boxRect.height() + 1];
+ if (yv) {
+ // The zoomed size is positive in both directions, so show zoomed item
+ Common::Rect scaledBox(xv, yv);
+ scaledBox.moveTo(boxRect.left + (boxRect.width() - xv + 1) / 2,
+ boxRect.top + (boxRect.height() - yv + 1) / 2);
+
+ _vm->_buffer2.sPlotF(sprites->getFrame(zoomItem), scaledBox);
+ }
+ }
+
+ screen.copyBlock(&_vm->_buffer2, boxRect);
+
+ zoomScale += zoomInc;
+ }
+}
+
void InventoryManager::synchronize(Common::Serializer &s) {
int count = _inv.size();
s.syncAsUint16LE(count);
diff --git a/engines/access/inventory.h b/engines/access/inventory.h
index eff142c9c9..f2b1f5e182 100644
--- a/engines/access/inventory.h
+++ b/engines/access/inventory.h
@@ -102,6 +102,8 @@ private:
void outlineIcon(int itemIndex);
void combineItems();
+
+ void zoomIcon(int zoomItem, int backItem, int zoomBox, bool shrink);
public:
Common::Array<InventoryEntry> _inv;
int _startInvItem;