From 793761c6954d68e7b38afe54665a1f668f8acc68 Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Thu, 12 Nov 2009 03:09:15 +0000 Subject: Fixed Script::icoStat() svn-id: r45850 --- engines/draci/draci.h | 1 - engines/draci/script.cpp | 41 ++++++++++++----------------------------- 2 files changed, 12 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/draci/draci.h b/engines/draci/draci.h index 746bfa09f1..68e56bb2d7 100644 --- a/engines/draci/draci.h +++ b/engines/draci/draci.h @@ -42,7 +42,6 @@ #include "draci/animation.h" #include "draci/sound.h" #include "draci/music.h" -#include "draci/walking.h" namespace Draci { diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index bed04f7b95..df632dc0d7 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -270,9 +270,7 @@ int Script::funcIcoStat(int itemID) const { int Script::funcIsIcoAct(int itemID) const { itemID -= 1; - const GameItem *item = _vm->_game->getCurrentItem(); - const int currentID = item ? item->_absNum : -1; - return currentID == itemID; + return _vm->_game->getCurrentItem() == _vm->_game->getItem(itemID); } int Script::funcActIco(int itemID) const { @@ -539,41 +537,26 @@ void Script::icoStat(const Common::Array ¶ms) { _vm->_game->setItemStatus(itemID, status == 1); - if (_vm->_game->getItemStatus(itemID) == 0) { - if (item) { - item->_anim->del(); - item->_anim = NULL; - } - + if (!_vm->_game->getItemStatus(itemID)) { + // Remove the item from the inventory and release its animations. _vm->_game->removeItem(item); + item->_anim->del(); + item->_anim = NULL; + // If the item was in the hand, remove it from the hands and, + // if the cursor was set to this item (as opposed to, say, an + // arrow leading outside a location), set it to standard. if (_vm->_game->getCurrentItem() == item) { _vm->_game->setCurrentItem(NULL); - } - - if (_vm->_mouse->getCursorType() == kNormalCursor) { - // TODO: is this correct? - if (_vm->_game->getLoopStatus() == kStatusInventory) { - _vm->_mouse->cursorOff(); + if (_vm->_mouse->getCursorType() >= kItemCursor) { + _vm->_mouse->setCursorType(kNormalCursor); } } - } - - if (_vm->_game->getItemStatus(itemID) == 1) { - if (item) { - _vm->_game->loadItemAnimation(item); - } + } else { + _vm->_game->loadItemAnimation(item); _vm->_game->setCurrentItem(item); - _vm->_mouse->loadItemCursor(item, false); - - // TODO: This is probably not needed but I'm leaving it to be sure for now - // The original engine needed to turn off the mouse temporarily when changing - // the cursor image. I'm just setting it to the final state of that transition. - if (_vm->_game->getLoopStatus() == kStatusInventory) { - _vm->_mouse->cursorOn(); - } } } -- cgit v1.2.3