diff options
author | Johannes Schickel | 2008-04-24 13:14:39 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-24 13:14:39 +0000 |
commit | e360eb13f87f6825cc11ffa01b270cbeabb94aae (patch) | |
tree | 29ca9917b1adba3d4502ec2a78e13c96b9e6f3e0 /engines | |
parent | 68c511423e529d240c4d014b165924eeca6ec1b9 (diff) | |
download | scummvm-rg350-e360eb13f87f6825cc11ffa01b270cbeabb94aae.tar.gz scummvm-rg350-e360eb13f87f6825cc11ffa01b270cbeabb94aae.tar.bz2 scummvm-rg350-e360eb13f87f6825cc11ffa01b270cbeabb94aae.zip |
Fixed bug in checkCharCollision.
svn-id: r31687
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/items_v3.cpp | 32 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 2 |
3 files changed, 36 insertions, 4 deletions
diff --git a/engines/kyra/items_v3.cpp b/engines/kyra/items_v3.cpp index 931367657b..809d276b74 100644 --- a/engines/kyra/items_v3.cpp +++ b/engines/kyra/items_v3.cpp @@ -422,6 +422,38 @@ void KyraEngine_v3::exchangeMouseItem(int itemPos, int runScript) { runSceneScript6(); } +bool KyraEngine_v3::pickUpItem(int x, int y, int runScript) { + debugC(9, kDebugLevelMain, "KyraEngine_v3::pickUpItem(%d, %d, %d)", x, y, runScript); + int itemPos = checkItemCollision(x, y); + + if (itemPos <= -1) + return false; + + if (_itemInHand >= 0) { + exchangeMouseItem(itemPos, runScript); + } else { + _screen->hideMouse(); + deleteItemAnimEntry(itemPos); + int itemId = _itemList[itemPos].id; + _itemList[itemPos].id = 0xFFFF; + playSoundEffect(0x0B, 0xC8); + setMouseCursor(itemId); + int str2 = 7; + + //if (_lang == 1) + // str2 = getItemCommandStringPickUp(itemId); + + updateItemCommand(itemId, str2, 0xFF); + _itemInHand = itemId; + _screen->showMouse(); + + if (runScript) + runSceneScript6(); + } + + return true; +} + bool KyraEngine_v3::isDropable(int x, int y) { debugC(9, kDebugLevelMain, "KyraEngine_v3::isDropable(%d, %d)", x, y); if (y < 14 || y > 187) diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index 6f12cb0fa4..a33e869db0 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -967,9 +967,9 @@ bool KyraEngine_v3::checkCharCollision(int x, int y) { int height = (scale * 76) >> 8; int x1 = _mainCharacter.x1 - width/2; - int x2 = _mainCharacter.x2 + width/2; + int x2 = _mainCharacter.x1 + width/2; int y1 = _mainCharacter.y1 - height; - int y2 = _mainCharacter.y2; + int y2 = _mainCharacter.y1; if (x >= x1 && x <= x2 && y >= y1 && y <= y2) return true; @@ -1029,7 +1029,7 @@ void KyraEngine_v3::handleInput(int x, int y) { if (checkCharCollision(x, y) && _unk3 >= -1 && runSceneScript2()) { return; - } else if (_itemInHand == 27) { + } else if (_itemInHand != 27 && pickUpItem(x, y, 1)) { return; } else if (checkItemCollision(x, y) == -1) { resetGameFlag(1); diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index b7718adcba..4e8a832118 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -320,7 +320,7 @@ private: bool processItemDrop(uint16 sceneId, uint16 item, int x, int y, int unk1, int unk2); void itemDropDown(int startX, int startY, int dstX, int dstY, int itemSlot, uint16 item, int remove); void exchangeMouseItem(int itemPos, int runScript); - bool pickUpItem(int x, int y); + bool pickUpItem(int x, int y, int runScript); bool isDropable(int x, int y); |