[Scummvm-git-logs] scummvm master -> 652722e760fab2959c74e2fa65452f334c8b8478

bgK bastien.bouclet at gmail.com
Thu Nov 7 11:02:15 CET 2019


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6901ee0242 3DS: Use the full resolution for the overlay on the top screen
652722e760 3DS: Rework mouse cursor movement


Commit: 6901ee0242c128d3b6026f83a10da4ca90e265e0
    https://github.com/scummvm/scummvm/commit/6901ee0242c128d3b6026f83a10da4ca90e265e0
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-11-07T11:02:00+01:00

Commit Message:
3DS: Use the full resolution for the overlay on the top screen

Changed paths:
  R backends/platform/3ds/gui.cpp
  R backends/platform/3ds/gui.h
    backends/platform/3ds/module.mk
    backends/platform/3ds/options-dialog.cpp
    backends/platform/3ds/options-dialog.h
    backends/platform/3ds/osystem-events.cpp
    backends/platform/3ds/osystem-graphics.cpp
    backends/platform/3ds/osystem.cpp
    backends/platform/3ds/osystem.h
    po/POTFILES


diff --git a/backends/platform/3ds/gui.cpp b/backends/platform/3ds/gui.cpp
deleted file mode 100644
index 0883d5a..0000000
--- a/backends/platform/3ds/gui.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "backends/platform/3ds/gui.h"
-#include "common/system.h"
-
-StatusMessageDialog* StatusMessageDialog::_opened = 0;
-
-StatusMessageDialog::StatusMessageDialog(const Common::String &message, uint32 duration)
-	: MessageDialog(message, 0, 0) {
-	_timer = g_system->getMillis() + duration;
-	if (_opened)
-		_opened->close();
-	_opened = this;
-}
-
-void StatusMessageDialog::handleTickle() {
-	MessageDialog::handleTickle();
-	if (g_system->getMillis() > _timer)
-		close();
-}
-
-void StatusMessageDialog::close() {
-    GUI::Dialog::close();
-	if (_opened)
-		_opened = 0;
-}
diff --git a/backends/platform/3ds/gui.h b/backends/platform/3ds/gui.h
deleted file mode 100644
index 8e82c6c..0000000
--- a/backends/platform/3ds/gui.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef GUI_3DS_H
-#define GUI_3DS_H
-
-#include "gui/message.h"
-
-class StatusMessageDialog : public GUI::MessageDialog {
-public:
-	StatusMessageDialog(const Common::String &message, uint32 duration);
-
-	void handleTickle();
-
-protected:
-	virtual void close();
-
-	uint32 _timer;
-	static StatusMessageDialog* _opened;
-};
-
-#endif // GUI_3DS_H
diff --git a/backends/platform/3ds/module.mk b/backends/platform/3ds/module.mk
index 3eb15ae..16fbd5f 100644
--- a/backends/platform/3ds/module.mk
+++ b/backends/platform/3ds/module.mk
@@ -4,7 +4,6 @@ MODULE_OBJS := \
 	main.o \
 	shader.shbin.o \
 	sprite.o \
-	gui.o \
 	config.o \
 	options-dialog.o \
 	osystem.o \
diff --git a/backends/platform/3ds/options-dialog.cpp b/backends/platform/3ds/options-dialog.cpp
index a6be649..d57daa7 100644
--- a/backends/platform/3ds/options-dialog.cpp
+++ b/backends/platform/3ds/options-dialog.cpp
@@ -61,7 +61,7 @@ OptionsDialog::OptionsDialog() : GUI::Dialog(20, 20, 280, 200) {
 	_screenRadioGroup->setValue(config.screen);
 
 	new GUI::StaticTextWidget(this, 0, 100, 110, 15, _("C-Pad Sensitivity:"), Graphics::kTextAlignRight);
-	_sensitivity = new GUI::SliderWidget(this, 115, 100, 160, 15, "TODO: Add tooltip", 1);
+	_sensitivity = new GUI::SliderWidget(this, 115, 100, 160, 15);
 	_sensitivity->setMinValue(-15);
 	_sensitivity->setMaxValue(30);
 	_sensitivity->setValue(config.sensitivity);
@@ -72,20 +72,41 @@ OptionsDialog::~OptionsDialog() {
 	optionMenuOpened = false;
 }
 
-void OptionsDialog::updateConfigManager() {
-	config.showCursor = _showCursorCheckbox->getState();
-	config.snapToBorder = _snapToBorderCheckbox->getState();
-	config.stretchToFit = _stretchToFitCheckbox->getState();
-	config.sensitivity = _sensitivity->getValue();
-	config.screen = _screenRadioGroup->getValue();
-	saveConfig();
-	loadConfig();
+bool OptionsDialog::getShowCursor() const {
+	return _showCursorCheckbox->getState();
+}
+
+bool OptionsDialog::getSnapToBorder() const {
+	return _snapToBorderCheckbox->getState();
+}
+
+bool OptionsDialog::getStretchToFit() const {
+	return _stretchToFitCheckbox->getState();
+}
+
+int OptionsDialog::getSensitivity() const {
+	return _sensitivity->getValue();
+}
+
+int OptionsDialog::getScreen() const {
+	return _screenRadioGroup->getValue();
+}
+
+void OptionsDialog::reflowLayout() {
+	const int screenW = g_system->getOverlayWidth();
+	const int screenH = g_system->getOverlayHeight();
+
+	// Center the dialog
+	_x = (screenW - getWidth()) / 2;
+	_y = (screenH - getHeight()) / 2;
+
+	GUI::Dialog::reflowLayout();
 }
 
 void OptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
 	switch(cmd) {
 	case GUI::kOKCmd:
-		updateConfigManager();
+		setResult(1);
 		// Fall through
 	case GUI::kCloseCmd:
 		close();
diff --git a/backends/platform/3ds/options-dialog.h b/backends/platform/3ds/options-dialog.h
index d8c0d7b..68ff75e 100644
--- a/backends/platform/3ds/options-dialog.h
+++ b/backends/platform/3ds/options-dialog.h
@@ -50,9 +50,16 @@ public:
 	OptionsDialog();
 	~OptionsDialog();
 
+	// GuiObject API
+	void reflowLayout() override;
+
+	bool getShowCursor() const;
+	bool getSnapToBorder() const;
+	bool getStretchToFit() const;
+	int getSensitivity() const;
+	int getScreen() const;
 protected:
-	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
-	void updateConfigManager();
+	void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
 
 	GUI::SliderWidget *_sensitivity;
 	GUI::CheckboxWidget *_showCursorCheckbox;
diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index 8c06187..fb30d66 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -22,13 +22,14 @@
 
 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h
 
-#include "osystem.h"
+#include "backends/platform/3ds/osystem.h"
+
+#include "backends/platform/3ds/config.h"
+#include "backends/platform/3ds/options-dialog.h"
 #include "backends/timer/default/default-timer.h"
-#include "gui/gui-manager.h"
+#include "common/translation.h"
 #include "engines/engine.h"
-#include "gui.h"
-#include "options-dialog.h"
-#include "config.h"
+#include "gui/gui-manager.h"
 
 namespace _3DS {
 
@@ -149,29 +150,29 @@ static void eventThreadFunc(void *arg) {
 		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.");
+				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
-				osys->displayMessageOnOSD("Magnify Mode can only be activated\n when both screens are enabled.");
+				osys->displayMessageOnOSD(_("Magnify Mode can only be activated\n when both screens are enabled."));
 			} else if (osys->getWidth() <= 400 && osys->getHeight() <= 240) {
-				osys->displayMessageOnOSD("In-game resolution too small to magnify.");
+				osys->displayMessageOnOSD(_("In-game resolution too small to magnify."));
 			} else {
 				if (osys->getMagnifyMode() == MODE_MAGOFF) {
 					osys->setMagnifyMode(MODE_MAGON);
 					if (inputMode == MODE_DRAG) {
 						inputMode = MODE_HOVER;
-						osys->displayMessageOnOSD("Magnify Mode On. Switching to Hover Mode...");
+						osys->displayMessageOnOSD(_("Magnify Mode On. Switching to Hover Mode..."));
 					} else {
-						osys->displayMessageOnOSD("Magnify Mode On");
+						osys->displayMessageOnOSD(_("Magnify Mode On"));
 					}
 				} else {
 					osys->setMagnifyMode(MODE_MAGOFF);
 					osys->updateSize();
 					if (savedInputMode == MODE_DRAG) {
 						inputMode = savedInputMode;
-						osys->displayMessageOnOSD("Magnify Mode Off. Reactivating Drag Mode...");
+						osys->displayMessageOnOSD(_("Magnify Mode Off. Reactivating Drag Mode..."));
 					} else {
-						osys->displayMessageOnOSD("Magnify Mode Off");
+						osys->displayMessageOnOSD(_("Magnify Mode Off"));
 					}
 				}
 			}
@@ -179,13 +180,13 @@ static void eventThreadFunc(void *arg) {
 		if (keysPressed & KEY_R) {
 			if (inputMode == MODE_DRAG) {
 				inputMode = savedInputMode = MODE_HOVER;
-				osys->displayMessageOnOSD("Hover Mode");
+				osys->displayMessageOnOSD(_("Hover Mode"));
 			} else {
 				if (osys->getMagnifyMode() == MODE_MAGOFF) {
 					inputMode = savedInputMode = MODE_DRAG;
-					osys->displayMessageOnOSD("Drag Mode");
+					osys->displayMessageOnOSD(_("Drag Mode"));
 				} else
-					osys->displayMessageOnOSD("Cannot Switch to Drag Mode while Magnify Mode is On");
+					osys->displayMessageOnOSD(_("Cannot Switch to Drag Mode while Magnify Mode is On"));
 			}
 		}
 		if (keysPressed & KEY_A || keysPressed & KEY_DLEFT || keysReleased & KEY_A || keysReleased & KEY_DLEFT) {
@@ -238,9 +239,9 @@ static void eventThreadFunc(void *arg) {
 				osys->updateSize();
 				if (savedInputMode == MODE_DRAG) {
 					inputMode = savedInputMode;
-					osys->displayMessageOnOSD("Magnify Mode Off. Reactivating Drag Mode.\nReturning to Launcher...");
+					osys->displayMessageOnOSD(_("Magnify Mode Off. Reactivating Drag Mode.\nReturning to Launcher..."));
 				} else
-					osys->displayMessageOnOSD("Magnify Mode Off. Returning to Launcher...");
+					osys->displayMessageOnOSD(_("Magnify Mode Off. Returning to Launcher..."));
 			}
 		}
 
@@ -309,8 +310,12 @@ void OSystem_3DS::destroyEvents() {
 
 void OSystem_3DS::transformPoint(touchPosition &point) {
 	if (!_overlayVisible) {
-		point.px = static_cast<float>(point.px) / _gameBottomTexture.getScaleX() - _gameBottomX;
-		point.py = static_cast<float>(point.py) / _gameBottomTexture.getScaleY() - _gameBottomY;
+		point.px = static_cast<float>(point.px) / _gameBottomTexture.getScaleX() - _gameBottomTexture.getPosX();
+		point.py = static_cast<float>(point.py) / _gameBottomTexture.getScaleY() - _gameBottomTexture.getPosY();
+	} else {
+		if (config.screen == kScreenTop) {
+			point.px = (uint32) point.px * 400 / 320; // TODO: Fix horizontal speed
+		}
 	}
 }
 
@@ -323,12 +328,7 @@ bool OSystem_3DS::pollEvent(Common::Event &event) {
 
 	if (optionMenuOpening) {
 		optionMenuOpening = false;
-		OptionsDialog dialog;
-		if (g_engine)
-			g_engine->pauseEngine(true);
-		dialog.runModal();
-		if (g_engine)
-			g_engine->pauseEngine(false);
+		runOptionsDialog();
 	}
 
 	Common::StackLock lock(*eventMutex);
@@ -340,4 +340,31 @@ bool OSystem_3DS::pollEvent(Common::Event &event) {
 	return true;
 }
 
+void OSystem_3DS::runOptionsDialog() {
+	OptionsDialog dialog;
+	if (g_engine)
+		g_engine->pauseEngine(true);
+	int result = dialog.runModal();
+	if (g_engine)
+		g_engine->pauseEngine(false);
+
+	if (result > 0) {
+		int oldScreen = config.screen;
+
+		config.showCursor   = dialog.getShowCursor();
+		config.snapToBorder = dialog.getSnapToBorder();
+		config.stretchToFit = dialog.getStretchToFit();
+		config.sensitivity  = dialog.getSensitivity();
+		config.screen       = dialog.getScreen();
+
+		saveConfig();
+		loadConfig();
+
+		if (config.screen != oldScreen) {
+			_screenChangeId++;
+			g_gui.checkScreenChange();
+		}
+	}
+}
+
 } // namespace _3DS
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 5c65cac..8fb92f4 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -146,12 +146,16 @@ int OSystem_3DS::getGraphicsMode() const {
 void OSystem_3DS::initSize(uint width, uint height,
                                    const Graphics::PixelFormat *format) {
 	debug("3ds initsize w:%d h:%d", width, height);
+	int oldScreen = config.screen;
 	loadConfig();
+	if (config.screen != oldScreen) {
+		_screenChangeId++;
+	}
 
 	_gameWidth = width;
 	_gameHeight = height;
 	_gameTopTexture.create(width, height, _pfGameTexture);
-	_overlay.create(getOverlayWidth(), getOverlayHeight(), _pfGameTexture);
+	_overlay.create(400, 320, _pfGameTexture);
 	_topHalfWidth = _topWidth / 2;
 	_topHalfHeight = _topHeight / 2;
 
@@ -560,7 +564,7 @@ int16 OSystem_3DS::getOverlayHeight() {
 }
 
 int16 OSystem_3DS::getOverlayWidth() {
-	return 320;
+	return config.screen == kScreenTop ? 400 : 320;
 }
 
 bool OSystem_3DS::showMouse(bool visible) {
diff --git a/backends/platform/3ds/osystem.cpp b/backends/platform/3ds/osystem.cpp
index aa0b3a7..2003795 100644
--- a/backends/platform/3ds/osystem.cpp
+++ b/backends/platform/3ds/osystem.cpp
@@ -77,6 +77,7 @@ OSystem_3DS::OSystem_3DS():
 	_topWidth(400),
 	_topHeight(240),
 	_overlayVisible(false),
+	_screenChangeId(0),
 	_magnifyMode(MODE_MAGOFF),
 	exiting(false),
 	sleeping(false)
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index 51aa40a..70cd475 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -105,7 +105,7 @@ public:
 	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
 	void initSize(uint width, uint height,
 	              const Graphics::PixelFormat *format = NULL);
-	virtual int getScreenChangeID() const { return 0; };
+	virtual int getScreenChangeID() const { return _screenChangeId; };
 
 	void beginGFXTransaction();
 	OSystem::TransactionError endGFXTransaction();
@@ -152,7 +152,6 @@ public:
 	void setMagnifyMode(MagnifyMode mode);
 	MagnifyMode getMagnifyMode(){ return _magnifyMode; }
 
-
 private:
 	void initGraphics();
 	void destroyGraphics();
@@ -160,6 +159,7 @@ private:
 	void destroyAudio();
 	void initEvents();
 	void destroyEvents();
+	void runOptionsDialog();
 
 	void flushGameScreen();
 	void flushCursor();
@@ -199,6 +199,7 @@ private:
 
 	int _screenShakeOffset;
 	bool _overlayVisible;
+	int _screenChangeId;
 
 	DVLB_s *_dvlb;
 	shaderProgram_s _program;
diff --git a/po/POTFILES b/po/POTFILES
index 94b14e7..dcce351 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -75,6 +75,8 @@ backends/networking/sdl_net/handlers/uploadfilehandler.cpp
 backends/networking/sdl_net/handlerutils.cpp
 backends/networking/sdl_net/localwebserver.cpp
 backends/networking/sdl_net/uploadfileclienthandler.cpp
+backends/platform/3ds/options-dialog.cpp
+backends/platform/3ds/osystem-events.cpp
 backends/platform/ds/arm9/source/dsoptions.cpp
 backends/platform/ios7/ios7_osys_events.cpp
 backends/platform/iphone/osys_events.cpp


Commit: 652722e760fab2959c74e2fa65452f334c8b8478
    https://github.com/scummvm/scummvm/commit/652722e760fab2959c74e2fa65452f334c8b8478
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-11-07T11:02:00+01:00

Commit Message:
3DS: Rework mouse cursor movement

- Fix clipping the cursor position
- Ensure the mouse has the same vertical and horizontal speed

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


diff --git a/backends/platform/3ds/osystem-events.cpp b/backends/platform/3ds/osystem-events.cpp
index fb30d66..1ee550e 100644
--- a/backends/platform/3ds/osystem-events.cpp
+++ b/backends/platform/3ds/osystem-events.cpp
@@ -51,8 +51,6 @@ static void eventThreadFunc(void *arg) {
 	uint32 touchStartTime = osys->getMillis();
 	touchPosition lastTouch = {0, 0};
 	bool isRightClick = false;
-	float cursorX = 0;
-	float cursorY = 0;
 	float cursorDeltaX = 0;
 	float cursorDeltaY = 0;
 	int circleDeadzone = 20;
@@ -93,8 +91,7 @@ static void eventThreadFunc(void *arg) {
 				if (touch.py > 239 - borderSnapZone)
 					touch.py = 239;
 			}
-			cursorX = touch.px;
-			cursorY = touch.py;
+
 			osys->transformPoint(touch);
 
 			osys->warpMouse(touch.px, touch.py);
@@ -130,16 +127,14 @@ static void eventThreadFunc(void *arg) {
 				pushEventQueue(eventQueue, event);
 			}
 		} else if (cursorDeltaX != 0 || cursorDeltaY != 0) {
-			cursorX += cursorDeltaX;
-			cursorY -= cursorDeltaY;
-			if (cursorX < 0) cursorX = 0;
-			if (cursorY < 0) cursorY = 0;
-			if (cursorX > 320) cursorX = 320;
-			if (cursorY > 240) cursorY = 240;
-			lastTouch.px = cursorX;
-			lastTouch.py = cursorY;
-			osys->transformPoint(lastTouch);
+			float scaleRatio = osys->getScaleRatio();
+
+			lastTouch.px += cursorDeltaX / scaleRatio;
+			lastTouch.py -= cursorDeltaY / scaleRatio;
+
+			osys->clipPoint(lastTouch);
 			osys->warpMouse(lastTouch.px, lastTouch.py);
+
 			event.mouse.x = lastTouch.px;
 			event.mouse.y = lastTouch.py;
 			event.type = Common::EVENT_MOUSEMOVE;
@@ -312,10 +307,18 @@ void OSystem_3DS::transformPoint(touchPosition &point) {
 	if (!_overlayVisible) {
 		point.px = static_cast<float>(point.px) / _gameBottomTexture.getScaleX() - _gameBottomTexture.getPosX();
 		point.py = static_cast<float>(point.py) / _gameBottomTexture.getScaleY() - _gameBottomTexture.getPosY();
+	}
+
+	clipPoint(point);
+}
+
+void OSystem_3DS::clipPoint(touchPosition &point) {
+	if (_overlayVisible) {
+		point.px = CLIP<uint16>(point.px, 0, getOverlayWidth()  - 1);
+		point.py = CLIP<uint16>(point.py, 0, getOverlayHeight() - 1);
 	} else {
-		if (config.screen == kScreenTop) {
-			point.px = (uint32) point.px * 400 / 320; // TODO: Fix horizontal speed
-		}
+		point.px = CLIP<uint16>(point.px, 0, _gameTopTexture.actualWidth  - 1);
+		point.py = CLIP<uint16>(point.py, 0, _gameTopTexture.actualHeight - 1);
 	}
 }
 
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index 8fb92f4..c3864c1 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -233,6 +233,16 @@ OSystem::TransactionError OSystem_3DS::endGFXTransaction() {
 	return OSystem::kTransactionSuccess;
 }
 
+float OSystem_3DS::getScaleRatio() const {
+	if (_overlayVisible) {
+		return 1.0;
+	} else if (config.screen == kScreenTop) {
+		return _gameTopTexture.getScaleX();
+	} else {
+		return _gameBottomTexture.getScaleX();
+	}
+}
+
 void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
 	assert(start + num <= 256);
 	memcpy(_palette + 3 * start, colors, 3 * num);
@@ -578,18 +588,17 @@ void OSystem_3DS::warpMouse(int x, int y) {
 	_cursorY = y;
 
 	// TODO: adjust for _cursorScalable ?
-	int offsetx = 0;
-	int offsety = 0;
 	x -= _cursorHotspotX;
 	y -= _cursorHotspotY;
+
+	int offsetx = 0;
+	int offsety = 0;
 	if (!_overlayVisible) {
-		offsetx += config.screen == kScreenTop ? _gameTopX : _gameBottomX;
-		offsety += config.screen == kScreenTop ? _gameTopY : _gameBottomY;
+		offsetx = config.screen == kScreenTop ? _gameTopTexture.getPosX() : _gameBottomTexture.getPosX();
+		offsety = config.screen == kScreenTop ? _gameTopTexture.getPosY() : _gameBottomTexture.getPosY();
 	}
-	float scalex = config.screen == kScreenTop ? (float)_gameTopTexture.actualWidth / _gameWidth : 1.f;
-	float scaley = config.screen == kScreenTop ? (float)_gameTopTexture.actualHeight / _gameHeight : 1.f;
-	_cursorTexture.setPosition(scalex * x + offsetx,
-							   scaley * y + offsety);
+
+	_cursorTexture.setPosition(x + offsetx, y + offsety);
 }
 
 void OSystem_3DS::setCursorDelta(float deltaX, float deltaY) {
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index 70cd475..c15c353 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -111,6 +111,7 @@ public:
 	OSystem::TransactionError endGFXTransaction();
 	int16 getHeight(){ return _gameHeight; }
 	int16 getWidth(){ return _gameWidth; }
+	float getScaleRatio() const;
 	void setPalette(const byte *colors, uint start, uint num);
 	void grabPalette(byte *colors, uint start, uint num) const;
 	void copyRectToScreen(const void *buf, int pitch, int x, int y, int w,
@@ -142,6 +143,8 @@ public:
 
 	// Transform point from touchscreen coords into gamescreen coords
 	void transformPoint(touchPosition &point);
+	// Clip point to gamescreen coords
+	void clipPoint(touchPosition &point);
 
 	void setCursorDelta(float deltaX, float deltaY);
 
diff --git a/backends/platform/3ds/sprite.h b/backends/platform/3ds/sprite.h
index a7d8b77..7bb4d36 100644
--- a/backends/platform/3ds/sprite.h
+++ b/backends/platform/3ds/sprite.h
@@ -54,10 +54,10 @@ public:
 	void setPosition(int x, int y);
 	void setOffset(uint16 x, uint16 y);
 	void setScale(float x, float y);
-	float getScaleX(){ return scaleX; }
-	float getScaleY(){ return scaleY; }
-	int getPosX(){ return posX; }
-	int getPosY(){ return posY; }
+	float getScaleX() const { return scaleX; }
+	float getScaleY() const { return scaleY; }
+	int getPosX() const { return posX; }
+	int getPosY() const { return posY; }
 	C3D_Mtx* getMatrix();
 
 	uint16 actualWidth;





More information about the Scummvm-git-logs mailing list