[Scummvm-git-logs] scummvm master -> 3121c213109771aa54dae98cdece01a92b68afb4

dreammaster noreply at scummvm.org
Fri Sep 26 11:36:13 UTC 2025


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:
3121c21310 BAGEL: MFC: Fix joystick movement range


Commit: 3121c213109771aa54dae98cdece01a92b68afb4
    https://github.com/scummvm/scummvm/commit/3121c213109771aa54dae98cdece01a92b68afb4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-09-26T04:36:07-07:00

Commit Message:
BAGEL: MFC: Fix joystick movement range

Changed paths:
    engines/bagel/mfc/libs/event_loop.cpp
    engines/bagel/mfc/libs/event_loop.h


diff --git a/engines/bagel/mfc/libs/event_loop.cpp b/engines/bagel/mfc/libs/event_loop.cpp
index 4337e343e1b..02211268edf 100644
--- a/engines/bagel/mfc/libs/event_loop.cpp
+++ b/engines/bagel/mfc/libs/event_loop.cpp
@@ -224,9 +224,9 @@ void EventLoop::setMessageWnd(Common::Event &ev, HWND &hWnd) {
 			switch (ev.type) {
 			case Common::EVENT_JOYAXIS_MOTION:
 				if (ev.joystick.axis == 0)
-					_joystickPos.x = ev.joystick.position;
+					_joystickPos.x = ev.joystick.position + JOYSTICK_REST_POS;
 				else
-					_joystickPos.y = ev.joystick.position;
+					_joystickPos.y = ev.joystick.position + JOYSTICK_REST_POS;
 
 				joystickWin->SendMessage(MM_JOY1MOVE, JOYSTICKID1,
 					MAKELPARAM(_joystickPos.x, _joystickPos.y));
diff --git a/engines/bagel/mfc/libs/event_loop.h b/engines/bagel/mfc/libs/event_loop.h
index 4c9c3f52681..16f8ae1382e 100644
--- a/engines/bagel/mfc/libs/event_loop.h
+++ b/engines/bagel/mfc/libs/event_loop.h
@@ -43,6 +43,8 @@ typedef void(*TimerProc)(
 typedef Common::KeyCode(*KeybindProc)(int key);
 typedef void (*FocusChangeProc)(CWnd *oldFocus, CWnd *newFocus);
 
+#define JOYSTICK_REST_POS 32767
+
 class WndList : public Common::List<CWnd *> {
 public:
 	bool contains(CWnd *wnd) const {
@@ -93,7 +95,7 @@ private:
 	TimerList _timers;
 	int _timerIdCtr = 0;
 	uint32 _nextFrameTime = 0;
-	Common::Point _joystickPos;
+	Common::Point _joystickPos = { JOYSTICK_REST_POS, JOYSTICK_REST_POS };
 	Common::Point _mousePos;
 	uint _joystickButtons = 0;
 	HOOKPROC _kbdHookProc = nullptr;




More information about the Scummvm-git-logs mailing list