diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/animation.cpp | 10 | ||||
-rw-r--r-- | engines/draci/animation.h | 8 | ||||
-rw-r--r-- | engines/draci/game.cpp | 4 | ||||
-rw-r--r-- | engines/draci/game.h | 2 |
4 files changed, 20 insertions, 4 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index ff1d07197f..e46582487c 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -295,6 +295,11 @@ void Animation::del() { } void AnimationManager::pauseAnimations() { + if (_animationPauseCounter++) { + // Already paused + return; + } + Common::List<Animation *>::iterator it; for (it = _animations.begin(); it != _animations.end(); ++it) { @@ -308,6 +313,11 @@ void AnimationManager::pauseAnimations() { } void AnimationManager::unpauseAnimations() { + if (--_animationPauseCounter) { + // Still paused + return; + } + Common::List<Animation *>::iterator it; for (it = _animations.begin(); it != _animations.end(); ++it) { diff --git a/engines/draci/animation.h b/engines/draci/animation.h index b6e6e9fa1b..1a7cb599cb 100644 --- a/engines/draci/animation.h +++ b/engines/draci/animation.h @@ -178,7 +178,7 @@ private: class AnimationManager { public: - AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1) {} + AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1), _animationPauseCounter(0) {} ~AnimationManager() { deleteAll(); } void insert(Animation *anim, bool allocateIndex); @@ -214,6 +214,12 @@ private: * See Animation::_index for details. */ int _lastIndex; + + /** How many times the animations are paused. + * Needed because the animations can be paused once by entering the + * inventory and then again by entering the game menu. When they are + * unpaused the first time, they should be kept paused. */ + int _animationPauseCounter; }; } // End of namespace Draci diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index aedc3b9a87..d985c2dee0 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -332,8 +332,8 @@ void Game::handleInventoryLoop() { // animation ID. In this way, we obtain its itemID. if (_animUnderCursor != NULL && _animUnderCursor != _inventoryAnim && _animUnderCursor->getID() != kOverlayImage) { _itemUnderCursor = getItem(kInventoryItemsID - _animUnderCursor->getID()); - if (_itemUnderCursor != NULL) - assert(_itemUnderCursor->_anim == _animUnderCursor); + assert(_itemUnderCursor != NULL); + assert(_itemUnderCursor->_anim == _animUnderCursor); } else { _itemUnderCursor = NULL; } diff --git a/engines/draci/game.h b/engines/draci/game.h index cd1e5c5dd6..3d02489da7 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -252,7 +252,7 @@ public: int getItemStatus(int itemID) const { return _itemStatus[itemID]; } void setItemStatus(int itemID, int status) { _itemStatus[itemID] = status; } - GameItem *getItem(int id) { return id >= 0 ? &_items[id] : NULL; } + GameItem *getItem(int id) { return id >= 0 && id < (int) _info._numItems ? &_items[id] : NULL; } GameItem *getCurrentItem() const { return _currentItem; } void setCurrentItem(GameItem *item) { _currentItem = item; } void removeItem(GameItem *item); |