[Scummvm-git-logs] scummvm master -> 6f678e6e84ae1a21c825fde582a956ac189cec3f

bgK bastien.bouclet at gmail.com
Sat Nov 30 17:53:27 UTC 2019


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:
6f678e6e84 3DS: Prevent magnify effect from updating while the GUI is active


Commit: 6f678e6e84ae1a21c825fde582a956ac189cec3f
    https://github.com/scummvm/scummvm/commit/6f678e6e84ae1a21c825fde582a956ac189cec3f
Author: Michael Ball (ballm4788 at gmail.com)
Date: 2019-11-30T18:53:23+01:00

Commit Message:
3DS: Prevent magnify effect from updating while the GUI is active

Changed paths:
    backends/platform/3ds/osystem-events.cpp
    backends/platform/3ds/osystem-graphics.cpp
    backends/platform/3ds/osystem.cpp
    backends/platform/3ds/osystem.h


diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index 1ee550e..6af7c4d 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -144,7 +144,6 @@ static void eventThreadFunc(void *arg) {
 		// Button events
 		if (keysPressed & KEY_L) {
 			if (g_gui.isActive()) {
-				// TODO: Prevent the magnify effect from updating while the GUI is active
 				osys->displayMessageOnOSD(_("Magnify Mode cannot be activated in menus."));
 			} else if (config.screen != kScreenBoth && osys->getMagnifyMode() == MODE_MAGOFF) {
 				// TODO: Automatically enable both screens while magnify mode is on
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index fa419f2..e1170a9 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -25,6 +25,7 @@
 #include "backends/platform/3ds/shader_shbin.h"
 #include "common/rect.h"
 #include "graphics/fontman.h"
+#include "gui/gui-manager.h"
 #include "options-dialog.h"
 #include "config.h"
 
@@ -156,8 +157,8 @@ void OSystem_3DS::initSize(uint width, uint height,
 	_gameHeight = height;
 	_gameTopTexture.create(width, height, _pfGameTexture);
 	_overlay.create(400, 320, _pfGameTexture);
-	_topHalfWidth = _topWidth / 2;
-	_topHalfHeight = _topHeight / 2;
+	_magCenterX = _magWidth / 2;
+	_magCenterY = _magHeight / 2;
 
 	if (format) {
 		debug("pixelformat: %d %d %d %d %d", format->bytesPerPixel, format->rBits(), format->gBits(), format->bBits(), format->aBits());
@@ -461,16 +462,21 @@ void OSystem_3DS::updateMagnify() {
 		_magnifyMode = MODE_MAGOFF;
 	}
 
+	// TODO: When exiting GUI, prevent cursor's position within GUI from changing
+	// position of magnification viewport. Possible solution: save in-game cursor
+	// coordinates separately from GUI cursor coordinates?
 	if (_magnifyMode == MODE_MAGON) {
-		_topX = (_cursorX < _topHalfWidth) ?
-			0 : ((_cursorX < (_gameWidth - _topHalfWidth)) ?
-			_cursorX - _topHalfWidth : _gameWidth - _topWidth);
-		_topY = (_cursorY < _topHalfHeight) ?
-			0 : ((_cursorY < _gameHeight - _topHalfHeight) ?
-			_cursorY - _topHalfHeight : _gameHeight - _topHeight);
+		if (!g_gui.isActive()) {
+			_magX = (_cursorX < _magCenterX) ?
+				0 : ((_cursorX < (_gameWidth - _magCenterX)) ?
+				_cursorX - _magCenterX : _gameWidth - _magWidth);
+			_magY = (_cursorY < _magCenterY) ?
+				0 : ((_cursorY < _gameHeight - _magCenterY) ?
+				_cursorY - _magCenterY : _gameHeight - _magHeight);
+		}
 		_gameTopTexture.setScale(1.f,1.f);
 		_gameTopTexture.setPosition(0,0);
-		_gameTopTexture.setOffset(_topX, _topY);
+		_gameTopTexture.setOffset(_magX, _magY);
 	}
 }
 
diff --git a/backends/platform/3ds/osystem.cpp b/backends/platform/3ds/osystem.cpp
index 2003795..7ac115b 100644
--- a/backends/platform/3ds/osystem.cpp
+++ b/backends/platform/3ds/osystem.cpp
@@ -72,10 +72,10 @@ OSystem_3DS::OSystem_3DS():
 	_gameBottomY(0),
 	_gameWidth(320),
 	_gameHeight(240),
-	_topX(0),
-	_topY(0),
-	_topWidth(400),
-	_topHeight(240),
+	_magX(0),
+	_magY(0),
+	_magWidth(400),
+	_magHeight(240),
 	_overlayVisible(false),
 	_screenChangeId(0),
 	_magnifyMode(MODE_MAGOFF),
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index a0f78fd..d6d667d 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -174,9 +174,6 @@ private:
 	u16 _gameWidth, _gameHeight;
 	u16 _gameTopX, _gameTopY;
 	u16 _gameBottomX, _gameBottomY;
-	u16 _topWidth, _topHeight;
-	u16 _topHalfWidth, _topHalfHeight;
-	u16 _topX, _topY;
 
 	// Audio
 	Thread audioThread;
@@ -241,7 +238,12 @@ private:
 	float _cursorDeltaX, _cursorDeltaY;
 	int _cursorHotspotX, _cursorHotspotY;
 	uint32 _cursorKeyColor;
+
+	// Magnify
 	MagnifyMode _magnifyMode;
+	u16 _magX, _magY;
+	u16 _magWidth, _magHeight;
+	u16 _magCenterX, _magCenterY;
 };
 
 } // namespace _3DS




More information about the Scummvm-git-logs mailing list