[Scummvm-git-logs] scummvm master -> fc24d54ceed1abee5fb8995f3027bd086a13d169
OMGPizzaGuy
noreply at scummvm.org
Tue Dec 20 01:32:54 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fc24d54cee ULTIMA8: Avoid replacing the mouse cursor if the shape frame has not changed
Commit: fc24d54ceed1abee5fb8995f3027bd086a13d169
https://github.com/scummvm/scummvm/commit/fc24d54ceed1abee5fb8995f3027bd086a13d169
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-12-19T19:32:20-06:00
Commit Message:
ULTIMA8: Avoid replacing the mouse cursor if the shape frame has not changed
Changed paths:
engines/ultima/ultima8/kernel/mouse.cpp
engines/ultima/ultima8/kernel/mouse.h
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp
index d4037dc9147..066c3a35e91 100644
--- a/engines/ultima/ultima8/kernel/mouse.cpp
+++ b/engines/ultima/ultima8/kernel/mouse.cpp
@@ -38,7 +38,7 @@ namespace Ultima8 {
Mouse *Mouse::_instance = nullptr;
-Mouse::Mouse() : _flashingCursorTime(0), _mouseOverGump(0),
+Mouse::Mouse() : _lastMouseFrame(-1), _flashingCursorTime(0), _mouseOverGump(0),
_dragging(DRAG_NOT), _dragging_objId(0), _draggingItem_startGump(0),
_draggingItem_lastGump(0) {
_instance = this;
@@ -544,13 +544,17 @@ void Mouse::update() {
const Shape *mouse = gamedata->getMouse();
if (mouse) {
int frame = getMouseFrame();
- if (frame >= 0 && (uint)frame < mouse->frameCount()) {
- const ShapeFrame *f = mouse->getFrame(frame);
- CursorMan.replaceCursor(f->_pixels, f->_width, f->_height, f->_xoff, f->_yoff, f->_keycolor);
- CursorMan.replaceCursorPalette(mouse->getPalette()->_palette, 0, 256);
- CursorMan.showMouse(true);
- } else {
- CursorMan.showMouse(false);
+ if (frame != _lastMouseFrame) {
+ _lastMouseFrame = frame;
+
+ if (frame >= 0 && (uint)frame < mouse->frameCount()) {
+ const ShapeFrame *f = mouse->getFrame(frame);
+ CursorMan.replaceCursor(f->_pixels, f->_width, f->_height, f->_xoff, f->_yoff, f->_keycolor);
+ CursorMan.replaceCursorPalette(mouse->getPalette()->_palette, 0, 256);
+ CursorMan.showMouse(true);
+ } else {
+ CursorMan.showMouse(false);
+ }
}
}
}
diff --git a/engines/ultima/ultima8/kernel/mouse.h b/engines/ultima/ultima8/kernel/mouse.h
index d19d188cb5d..06744eec5cf 100644
--- a/engines/ultima/ultima8/kernel/mouse.h
+++ b/engines/ultima/ultima8/kernel/mouse.h
@@ -101,6 +101,7 @@ public:
private:
static Mouse *_instance;
Common::Stack<MouseCursor> _cursors;
+ int _lastMouseFrame;
/**
* Time mouse started flashing, or 0
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 0180b8776ad..087ac565ed2 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -581,6 +581,9 @@ Common::Error Ultima8Engine::runGame() {
}
handleDelayedEvents();
+ // Update the mouse
+ _mouse->update();
+
// Paint Screen
paint();
@@ -638,9 +641,6 @@ void Ultima8Engine::paint() {
}
#endif
- // Update the mouse
- _mouse->update();
-
// End _painting
_screen->EndPainting();
}
More information about the Scummvm-git-logs
mailing list