mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Scroll with the mouse wheel in the game's menus and along the D-pad strips
The wheel did nothing outside the map. Now each notch is one step of the stick a gamepad player would move: in a menu with the game's focus box (the inventory, shops, Options, the save list) the focus moves up or down, and while a D-pad strip (weapons, shields, bows, materials) is held open the choice moves left or right. The strip has no focus box while it is held, so it is found by its open screen, ShortCut_00, as the map is. The wheel now also counts while the cursor is released over the window, where the menus have the pointer. Input scripts take WHEEL lines and a recording writes them, and a script's one-shot MOUSE or WHEEL line goes in at the first poll at or after its tick instead of being lost when a poll skips that tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a37fc3c34
commit
a10c546a06
7 files changed
+127
-37
No files matched your search
+8
-3
@@ -84,7 +84,8 @@ uint32_t input_key_char(int key) {
|
||||
// ---- mouse camera: raw motion accumulated by the window thread, one stick sample per presented frame
|
||||
static volatile LONG mouse_dx, mouse_dy; // raw counts since the last frame sample
|
||||
static volatile LONG mouse_travel; // raw counts moved in total, captured or not (ikb_mouse_travel)
|
||||
static volatile LONG mouse_wheel; // wheel turned while captured, in WHEEL_DELTA units (ikb_wheel_take)
|
||||
static volatile LONG mouse_wheel; // wheel turned while captured or over the window, in WHEEL_DELTA units
|
||||
// (ikb_wheel_take)
|
||||
static volatile LONG cur_captured; // cursor hidden and confined to the client area
|
||||
static volatile LONG cur_active; // WM_ACTIVATEAPP: the window's application is active
|
||||
// Bits: CUR_REL, Esc or activation by a click on the title bar or border: until a client click; CUR_ESC, set with CUR_REL
|
||||
@@ -148,8 +149,12 @@ int input_window_msg(HWND h, UINT m, WPARAM w, LPARAM l, LRESULT *res) {
|
||||
InterlockedAdd(&mouse_dy, y);
|
||||
}
|
||||
}
|
||||
// The wheel comes in the same message (usButtonData, signed, + away from the player)
|
||||
if (cur_captured && ri.header.dwType == RIM_TYPEMOUSE && (ri.data.mouse.usButtonFlags & RI_MOUSE_WHEEL))
|
||||
// The wheel comes in the same message (usButtonData, signed, + away from the player). It counts while the
|
||||
// cursor is captured, or released over the client area: a game menu with the pointer (menu_cursor.c) takes it
|
||||
// as steps of its focus. input.c drops the notches where nothing takes them.
|
||||
float px, py;
|
||||
if (ri.header.dwType == RIM_TYPEMOUSE && (ri.data.mouse.usButtonFlags & RI_MOUSE_WHEEL) &&
|
||||
(cur_captured || ikb_pointer(&px, &py)))
|
||||
InterlockedAdd(&mouse_wheel, (SHORT)ri.data.mouse.usButtonData);
|
||||
break; // DefWindowProc must see WM_INPUT for cleanup
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user