mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
SWORD1: Don't set the same cursor on every frame
Removes unnecessary overhead on the backend when the cursor has just one frame.
This commit is contained in:
parent
1566ef32b6
commit
40333617ee
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user