diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword1/mouse.cpp | 11 | ||||
-rw-r--r-- | engines/sword1/mouse.h | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/engines/sword1/mouse.cpp b/engines/sword1/mouse.cpp index 751b27efc0..87e476e504 100644 --- a/engines/sword1/mouse.cpp +++ b/engines/sword1/mouse.cpp @@ -197,6 +197,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) { free(_currentPtr); _currentPtr = NULL; } + if (ptrId) { MousePtr *lugg = NULL; MousePtr *ptr = (MousePtr*)_resMan->openFetchRes(ptrId); @@ -284,6 +285,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) { void Mouse::setPointer(uint32 resId, uint32 rate) { _currentPtrId = resId; _frame = 0; + _activeFrame = -1; createPointer(resId, _currentLuggageId); @@ -298,15 +300,24 @@ void Mouse::setPointer(uint32 resId, uint32 rate) { void Mouse::setLuggage(uint32 resId, uint32 rate) { _currentLuggageId = resId; _frame = 0; + _activeFrame = -1; + createPointer(_currentPtrId, resId); } void Mouse::animate() { if ((Logic::_scriptVars[MOUSE_STATUS] == 1) || (_mouseOverride && _currentPtr)) { _frame = (_frame + 1) % _currentPtr->numFrames; + + if (_activeFrame == _frame) + return; + uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr); ptrData += _frame * _currentPtr->sizeX * _currentPtr->sizeY; + CursorMan.replaceCursor(ptrData, _currentPtr->sizeX, _currentPtr->sizeY, _currentPtr->hotSpotX, _currentPtr->hotSpotY, 255); + + _activeFrame = _frame; } } diff --git a/engines/sword1/mouse.h b/engines/sword1/mouse.h index 50b7431c48..1b4ca12183 100644 --- a/engines/sword1/mouse.h +++ b/engines/sword1/mouse.h @@ -99,8 +99,9 @@ private: ObjectMan *_objMan; Common::Point _mouse; - uint32 _currentPtrId, _currentLuggageId, _frame; + uint32 _currentPtrId, _currentLuggageId; MousePtr *_currentPtr; + int _frame, _activeFrame; uint16 _numObjs; uint16 _lastState, _state; uint32 _getOff; |