[Scummvm-git-logs] scummvm master -> 8fa22df10208ede2448dbfe1760812c7a4029829
mgerhardy
martin.gerhardy at gmail.com
Thu Nov 26 16:28:05 UTC 2020
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:
8fa22df102 TWINE: fixed invisible mouse cursor when going back into the ui
Commit: 8fa22df10208ede2448dbfe1760812c7a4029829
https://github.com/scummvm/scummvm/commit/8fa22df10208ede2448dbfe1760812c7a4029829
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-26T17:26:53+01:00
Commit Message:
TWINE: fixed invisible mouse cursor when going back into the ui
Addresses bug https://bugs.scummvm.org/ticket/11977
Changed paths:
engines/twine/twine.cpp
engines/twine/twine.h
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index c28fc804c0..e10234c61c 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -82,12 +82,12 @@ ScopedEngineFreeze::~ScopedEngineFreeze() {
_engine->unfreezeTime();
}
-ScopedCursor::ScopedCursor(const TwinEEngine* engine) {
- CursorMan.showMouse(engine->cfgfile.Mouse);
+ScopedCursor::ScopedCursor(TwinEEngine* engine) : _engine(engine) {
+ _engine->pushMouseCursorVisible();
}
ScopedCursor::~ScopedCursor() {
- CursorMan.showMouse(false);
+ _engine->popMouseCursorVisible();
}
TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flags, TwineGameType gameType)
@@ -155,6 +155,23 @@ TwinEEngine::~TwinEEngine() {
delete _debugScene;
}
+void TwinEEngine::pushMouseCursorVisible() {
+ ++_mouseCursorState;
+ if (!cfgfile.Mouse) {
+ return;
+ }
+ if (_mouseCursorState == 1) {
+ CursorMan.showMouse(cfgfile.Mouse);
+ }
+}
+
+void TwinEEngine::popMouseCursorVisible() {
+ --_mouseCursorState;
+ if (_mouseCursorState == 0) {
+ CursorMan.showMouse(false);
+ }
+}
+
Common::Error TwinEEngine::run() {
debug("Based on TwinEngine v0.2.2");
debug("(c)2002 The TwinEngine team.");
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 6ea81aa596..417b5a83ab 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -164,7 +164,8 @@ struct ScopedEngineFreeze {
};
struct ScopedCursor {
- ScopedCursor(const TwinEEngine* engine);
+ TwinEEngine* _engine;
+ ScopedCursor(TwinEEngine* engine);
~ScopedCursor();
};
@@ -172,6 +173,7 @@ class TwinEEngine : public Engine {
private:
int32 isTimeFreezed = 0;
int32 saveFreezedTime = 0;
+ int32 _mouseCursorState = 0;
ActorMoveStruct loopMovePtr; // mainLoopVar1
PauseToken _pauseToken;
TwineGameType _gameType;
@@ -199,6 +201,9 @@ public:
SaveStateList getSaveSlots() const;
void autoSave();
+ void pushMouseCursorVisible();
+ void popMouseCursorVisible();
+
bool isLBA1() const { return _gameType == TwineGameType::GType_LBA; };
bool isLBA2() const { return _gameType == TwineGameType::GType_LBA2; };
More information about the Scummvm-git-logs
mailing list