diff options
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.h | 12 |
2 files changed, 15 insertions, 7 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 390cc81779..80800da074 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -390,13 +390,7 @@ void GfxFrameout::kernelAddPicAt(const reg_t planeObject, const GuiResourceId pi #pragma mark Rendering void GfxFrameout::frameOut(const bool shouldShowBits, const Common::Rect &eraseRect) { - // In SSCI, mouse events were received via hardware interrupt, so the mouse - // cursor would always get updated whenever the user moved the mouse. Since - // we must poll for mouse events instead, poll here so that the mouse gets - // updated with its current position at render time. If we do not do this, - // the mouse gets "stuck" during loops that do not make calls to kGetEvent, - // like transitions. - g_sci->getEventManager()->getSciEvent(SCI_EVENT_PEEK); + updateMousePositionForRendering(); RobotDecoder &robotPlayer = g_sci->_video32->getRobotPlayer(); const bool robotIsActive = robotPlayer.getStatus() != RobotDecoder::kRobotStatusUninitialized; @@ -452,6 +446,8 @@ void GfxFrameout::frameOut(const bool shouldShowBits, const Common::Rect &eraseR } void GfxFrameout::palMorphFrameOut(const int8 *styleRanges, PlaneShowStyle *showStyle) { + updateMousePositionForRendering(); + Palette sourcePalette(_palette->getNextPalette()); alterVmap(sourcePalette, sourcePalette, -1, styleRanges); diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index ab58f41144..1585a3440a 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -24,6 +24,7 @@ #define SCI_GRAPHICS_FRAMEOUT_H #include "engines/util.h" // for initGraphics +#include "sci/event.h" #include "sci/graphics/plane32.h" #include "sci/graphics/screen_item32.h" @@ -370,6 +371,17 @@ public: #pragma mark - #pragma mark Mouse cursor private: + void updateMousePositionForRendering() const { + // In SSCI, mouse events were received via hardware interrupt, so the + // mouse cursor would always get updated immediately when the user moved + // the mouse. ScummVM must poll for mouse events from the backend + // instead, so we poll just before rendering so that the latest mouse + // position is rendered instead of whatever position it was at the last + // time kGetEvent was called. Without this, the mouse appears stuck + // during loops that do not make calls to kGetEvent, like transitions. + g_sci->getEventManager()->getSciEvent(SCI_EVENT_PEEK); + } + /** * Determines whether or not the point given by * `position` is inside of the given screen item. |