[Scummvm-git-logs] scummvm master -> 88fe9fed51dd1c3442e47cde279b3bac3452c548
Scorpeg
noreply at scummvm.org
Wed Nov 4 20:05:04 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
88fe9fed51 GRAPHICS: Add hotspot overlay ownership and suspension
Commit: 88fe9fed51dd1c3442e47cde279b3bac3452c548
https://github.com/scummvm/scummvm/commit/88fe9fed51dd1c3442e47cde279b3bac3452c548
Author: Scorp (scorp at mrs.mn)
Date: 2026-11-04T23:04:53+03:00
Commit Message:
GRAPHICS: Add hotspot overlay ownership and suspension
Changed paths:
engines/engine.cpp
engines/engine.h
graphics/hotspot_renderer.cpp
graphics/hotspot_renderer.h
gui/EventRecorder.cpp
gui/gui-manager.cpp
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 15b8936947d..7b918fe4742 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -714,6 +714,7 @@ PauseToken Engine::pauseEngine() {
_pauseLevel++;
if (_pauseLevel == 1) {
+ suspendHotspots();
_pauseStartTime = _system->getMillis();
_pauseScreenChangeID = g_system->getScreenChangeID();
pauseEngineIntern(true);
@@ -753,18 +754,23 @@ void Engine::showHotspots(bool show) {
if (show) {
_hotspotForceRedraw = true;
} else {
+ suspendHotspots();
if (_hotspotRenderer)
_hotspotRenderer->releaseResources();
_hotspotScratch.resize(0);
- if (_hotspotCursorHidden) {
- CursorMan.showMouse(_hotspotPrevCursorVisible);
- _hotspotCursorHidden = false;
- }
- if (g_system->isOverlayVisible())
- g_system->hideOverlay();
}
}
+void Engine::suspendHotspots() {
+ if (_hotspotRenderer)
+ _hotspotRenderer->hideOverlay(*_system);
+ if (_hotspotCursorHidden) {
+ CursorMan.showMouse(_hotspotPrevCursorVisible);
+ _hotspotCursorHidden = false;
+ }
+ _hotspotForceRedraw = true;
+}
+
void Engine::getHotspotPositions(Common::Array<Graphics::HotspotInfo> &hotspots) {
}
@@ -784,12 +790,14 @@ Graphics::HotspotRenderer *Engine::createHotspotRenderer() {
}
void Engine::drawHotspots() {
- if (!_showHotspots)
+ if (!_showHotspots || isPaused() || g_gui.isActive())
return;
if (!_hotspotRenderer) {
_hotspotRenderer = createHotspotRenderer();
_hotspotForceRedraw = true;
}
+ if (_system->isOverlayVisible() && !_hotspotRenderer->ownsOverlay())
+ return;
if (hotspotDirty() || _hotspotForceRedraw) {
_hotspotScratch.resize(0);
getHotspotPositions(_hotspotScratch);
diff --git a/engines/engine.h b/engines/engine.h
index c1139978c7d..289b7d44814 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -587,6 +587,8 @@ public:
* @param show true to show hotspots, false to hide them
*/
virtual void showHotspots(bool show);
+ /** Release the hotspot overlay without changing the user's toggle state. */
+ void suspendHotspots();
bool isShowingHotspots() const { return _showHotspots; }
virtual HotspotKeyMode hotspotsKeyMode() const { return kHotspotKeyModeToggle; }
HotspotKeyMode effectiveHotspotKeyMode() const;
diff --git a/graphics/hotspot_renderer.cpp b/graphics/hotspot_renderer.cpp
index 0da912ed117..66c5df12d5f 100644
--- a/graphics/hotspot_renderer.cpp
+++ b/graphics/hotspot_renderer.cpp
@@ -164,10 +164,16 @@ void HotspotRenderer::exchangeHotspots(Common::Array<HotspotInfo> &hotspots) {
}
}
+void HotspotRenderer::hideOverlay(OSystem &system) {
+ if (_ownsOverlay && system.isOverlayVisible())
+ system.hideOverlay();
+ _ownsOverlay = false;
+ _dirty = true;
+}
+
void HotspotRenderer::renderOverlay(OSystem &system, MarkerShape markerShape, bool showText, bool forceRedraw) {
if (_hotspots.empty()) {
- if (system.isOverlayVisible())
- system.hideOverlay();
+ hideOverlay(system);
_overlay.free();
_previousBounds = Common::Rect();
_drawBounds = Common::Rect();
@@ -184,13 +190,17 @@ void HotspotRenderer::renderOverlay(OSystem &system, MarkerShape markerShape, bo
if (width <= 0 || height <= 0 || gameWidth <= 0 || gameHeight <= 0 || format.bytesPerPixel < 2)
return;
const bool visible = system.isOverlayVisible();
+ if (visible && !_ownsOverlay)
+ return;
const bool resized = _overlay.w != width || _overlay.h != height || _overlay.format != format;
if (!_dirty && !forceRedraw && !resized && visible && format.aBits() &&
_gameSize.x == gameWidth && _gameSize.y == gameHeight && _screenChangeID == screenChangeID &&
_shape == markerShape && _font == font)
return;
- if (!visible)
+ if (!visible) {
system.showOverlay(false);
+ _ownsOverlay = true;
+ }
if (resized)
_overlay.create(width, height, format);
if (format.aBits()) {
diff --git a/graphics/hotspot_renderer.h b/graphics/hotspot_renderer.h
index 8925d9b6efb..2466859b156 100644
--- a/graphics/hotspot_renderer.h
+++ b/graphics/hotspot_renderer.h
@@ -103,6 +103,8 @@ public:
void setStyle(const HotspotStyle &style);
void invalidate();
void releaseResources();
+ bool ownsOverlay() const { return _ownsOverlay; }
+ void hideOverlay(OSystem &system);
bool empty() const { return _hotspots.empty(); }
void setHotspots(Common::Array<HotspotInfo> hotspots);
void exchangeHotspots(Common::Array<HotspotInfo> &hotspots);
@@ -190,6 +192,7 @@ private:
Surface _overlay;
Common::Array<HotspotInfo> _hotspots;
bool _dirty = true;
+ bool _ownsOverlay = false;
Common::Point _gameSize;
int _screenChangeID = -1;
MarkerShape _shape = kMarkerCrosshair;
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp
index 7879e20a611..8063d45edec 100644
--- a/gui/EventRecorder.cpp
+++ b/gui/EventRecorder.cpp
@@ -29,6 +29,7 @@ DECLARE_SINGLETON(GUI::EventRecorder);
}
#include "common/debug-channels.h"
+#include "engines/engine.h"
#include "backends/timer/sdl/sdl-timer.h"
#include "backends/mixer/mixer.h"
#include "common/config-manager.h"
@@ -811,6 +812,8 @@ void EventRecorder::preDrawOverlayGui() {
if ((_initialized) || (_needRedraw)) {
RecordMode oldMode = _recordMode;
_recordMode = kPassthrough;
+ if (g_engine)
+ g_engine->suspendHotspots();
g_system->showOverlay();
g_gui.checkScreenChange();
g_gui.theme()->clearAll();
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index bc85ba39c8e..5b31a1b0af4 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -20,6 +20,7 @@
*/
#include "common/events.h"
+#include "engines/engine.h"
#include "common/translation.h"
#include "common/zip-set.h"
#include "gui/EventRecorder.h"
@@ -595,6 +596,8 @@ void GuiManager::runLoop() {
#endif
if (!_stateIsSaved) {
+ if (g_engine)
+ g_engine->suspendHotspots();
saveState();
_theme->enable();
didSaveState = true;
More information about the Scummvm-git-logs
mailing list