Follow Windows' switched mouse buttons for the mouse bindings.

GetAsyncKeyState reads the physical buttons, so with "switch primary and secondary buttons" on, a left-handed
player's primary button targeted and the secondary attacked, the other way round from the window's own clicks.
mouse_l and mouse_r now mean the primary and secondary buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 09:14:33 -05:00
parent c65f21d531
commit 2986daf84e

View File

@@ -31,8 +31,10 @@ static int key_vk(int key) {
case KEY_DOWN: return VK_DOWN;
case KEY_LEFT: return VK_LEFT;
case KEY_RIGHT: return VK_RIGHT;
case KEY_MOUSE_L: return VK_LBUTTON;
case KEY_MOUSE_R: return VK_RBUTTON;
// GetAsyncKeyState reads the physical buttons: with Windows' "switch primary and secondary buttons" on, the
// primary (left) button is the physical right one, as the window's own WM_LBUTTONDOWN has it
case KEY_MOUSE_L: return GetSystemMetrics(SM_SWAPBUTTON) ? VK_RBUTTON : VK_LBUTTON;
case KEY_MOUSE_R: return GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON;
case KEY_MOUSE_M: return VK_MBUTTON;
case KEY_MOUSE_X1: return VK_XBUTTON1;
case KEY_MOUSE_X2: return VK_XBUTTON2;