Revert "remove "handlemouse" setting"

This reverts commit f1bcff220d.
This commit is contained in:
FunkyFr3sh 2021-06-16 07:47:15 +02:00
parent 6043bc9061
commit abdb74942b
10 changed files with 181 additions and 175 deletions

View file

@ -12,23 +12,27 @@ void mouse_lock()
return;
if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(FALSE) >= 0);
return;
}
if (g_hook_active && !g_ddraw->locked)
{
/* Get the window client area */
real_GetClientRect(g_ddraw->hwnd, &rc);
if (g_ddraw->adjmouse)
{
rc.top = g_ddraw->render.viewport.y;
rc.left = g_ddraw->render.viewport.x;
rc.right = g_ddraw->render.viewport.width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->render.viewport.height + g_ddraw->render.viewport.y;
rc.right = g_ddraw->render.viewport.width;
rc.bottom = g_ddraw->render.viewport.height;
}
else
{
rc.top = g_ddraw->render.viewport.y;
rc.left = g_ddraw->render.viewport.x;
rc.right = g_ddraw->width + g_ddraw->render.viewport.x;
rc.bottom = g_ddraw->height + g_ddraw->render.viewport.y;
rc.right = g_ddraw->width;
rc.bottom = g_ddraw->height;
}
/* Convert the client area to screen coordinates */
@ -53,15 +57,23 @@ void mouse_lock()
real_SetCursorPos(rc.left + g_ddraw->cursor.x, rc.top + g_ddraw->cursor.y - g_ddraw->mouse_y_adjust);
}
real_SetCursor(g_ddraw->old_cursor);
if (g_ddraw->hidecursor)
if (g_ddraw->handlemouse)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
real_ClipCursor(&rc);
while (real_ShowCursor(FALSE) >= 0);
}
else
{
real_SetCursor(g_ddraw->old_cursor);
real_ClipCursor(&rc);
if (g_ddraw->hidecursor)
{
g_ddraw->hidecursor = FALSE;
real_ShowCursor(FALSE);
}
real_ClipCursor(&rc);
}
g_ddraw->locked = TRUE;
}
@ -72,10 +84,17 @@ void mouse_unlock()
RECT rc;
if (g_ddraw->devmode)
{
if (g_ddraw->handlemouse)
while (real_ShowCursor(TRUE) < 0);
return;
}
if (!g_hook_active)
{
return;
}
if (g_ddraw->locked)
{
@ -93,11 +112,19 @@ void mouse_unlock()
SetRect(&rc, pt.x, pt.y, pt2.x, pt2.y);
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
if (g_ddraw->handlemouse)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
real_SetCursor(LoadCursor(NULL, IDC_ARROW));
}
else
{
CURSORINFO ci = { .cbSize = sizeof(CURSORINFO) };
if (real_GetCursorInfo(&ci) && ci.flags == 0)
{
g_ddraw->hidecursor = TRUE;
while (real_ShowCursor(TRUE) < 0);
}
}
real_SetCursor(LoadCursor(NULL, IDC_ARROW));