aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_lol.cpp
diff options
context:
space:
mode:
authorFlorian Kagerer2009-03-15 16:48:20 +0000
committerFlorian Kagerer2009-03-15 16:48:20 +0000
commitdcf32be3f656b0adda3feb3c07c1f5940ebfa979 (patch)
treeec584f60b548031d4dc06d595fe27b934537d027 /engines/kyra/gui_lol.cpp
parentf1079ef624ff39aa9b09b3fc220244a99256aad6 (diff)
downloadscummvm-rg350-dcf32be3f656b0adda3feb3c07c1f5940ebfa979.tar.gz
scummvm-rg350-dcf32be3f656b0adda3feb3c07c1f5940ebfa979.tar.bz2
scummvm-rg350-dcf32be3f656b0adda3feb3c07c1f5940ebfa979.zip
LOL: - added some missing animations for the shops
- added support for dropping/picking up items (no throwing yet) svn-id: r39422
Diffstat (limited to 'engines/kyra/gui_lol.cpp')
-rw-r--r--engines/kyra/gui_lol.cpp56
1 files changed, 49 insertions, 7 deletions
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index ffc3009bdb..453e4280ea 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1196,22 +1196,47 @@ int LoLEngine::clickedExitCharInventory(Button *button) {
return 1;
}
-int LoLEngine::clickedUnk16(Button *button) {
+int LoLEngine::clickedSceneDropItem(Button *button) {
+ static const uint8 offsX[] = { 0x40, 0xC0, 0x40, 0xC0 };
+ static const uint8 offsY[] = { 0x40, 0x40, 0xC0, 0xC0 };
+ static const uint8 dirIndex[] = { 0, 1, 2, 3, 1, 3, 0, 2, 3, 2, 1, 0, 2, 0, 3, 1 };
+
+ if ((_updateFlags & 1) || !_itemInHand)
+ return 0;
+
+ uint16 block = _currentBlock;
+ if (button->data2Val2 > 1) {
+ block = calcNewBlockPosition(_currentBlock, _currentDirection);
+ int f = _wllWallFlags[_levelBlockProperties[block].walls[_currentDirection ^ 2]];
+ if (!(f & 0x80) || (f & 2))
+ return 1;
+ }
+
+ uint16 x = 0;
+ uint16 y = 0;
+ int i = dirIndex[(_currentDirection << 2) + button->data2Val2];
+
+ calcCoordinates(x, y, block, offsX[i], offsY[i]);
+ dropItem(_itemInHand, x, y, 0, 1);
+ setHandItem(0);
+
return 1;
}
int LoLEngine::clickedScenePickupItem(Button *button) {
static const int8 checkX[] = { 0, 0, 1, 0, -1, -1, 1, 1, -1, 0, 2, 0, -2, -1, 1, 2, 2, 1, -1, -2, -2 };
static const int8 checkY[] = { 0, -1, 0, 1, 0, -1, -1, 1, 1, -2, 0, 2, 0, -2, -2, -1, 1, 2, 2, 1, -1 };
+ static const int len = ARRAYSIZE(checkX);
- if (_updateFlags & 1)
+ if ((_updateFlags & 1) || _itemInHand)
return 0;
+
int cp = _screen->setCurPage(_sceneDrawPage1);
- clickSceneSub1();
+ redrawSceneItem();
int p = 0;
- for (int i = 0; i < 21; i++) {
+ for (int i = 0; i < len; i++) {
p = _screen->getPagePixel(_screen->_curPage, _mouseX + checkX[i], _mouseY + checkY[i]);
if (p)
break;
@@ -1224,10 +1249,10 @@ int LoLEngine::clickedScenePickupItem(Button *button) {
uint16 block = (p <= 128) ? calcNewBlockPosition(_currentBlock, _currentDirection) : _currentBlock;
- int found = checkSceneForItems(&_levelBlockProperties[block], p &0x7f);
+ int found = checkSceneForItems(&_levelBlockProperties[block].drawObjects, p & 0x7f);
if (found != -1) {
- foundItemSub(found, block);
+ pickupItem(found, block);
setHandItem(found);
}
@@ -1368,7 +1393,24 @@ int LoLEngine::clickedUnk24(Button *button) {
return 1;
}
-int LoLEngine::clickedSceneDropItem(Button *button) {
+int LoLEngine::clickedSceneThrowItem(Button *button) {
+ //if (_updateFlags & 1)
+ return 0;
+
+ uint16 block = calcNewBlockPosition(_currentBlock, _currentDirection);
+ if ((_wllWallFlags[_levelBlockProperties[block].walls[_currentDirection ^ 2]] & 2) || !_itemInHand)
+ return 0;
+
+ uint16 x = 0;
+ uint16 y = 0;
+ calcCoordinates(x, y, _currentBlock, 0x80, 0x80);
+
+ if (throwItem(0, _itemInHand, x, y, 12, _currentDirection << 1, 6, _selectedCharacter, 0x3f)) {
+ snd_playSoundEffect(18, -1);
+ setHandItem(0);
+ }
+
+ _sceneUpdateRequired = true;
return 1;
}