From a85a7533e377d184c15701c9d002d0d163fc2ae9 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 9 Mar 2018 18:20:09 +0100 Subject: [PATCH] use real GetCursorPos --- ddraw.rc | 8 ++++---- src/main.c | 5 ++--- src/mouse.c | 11 +++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ddraw.rc b/ddraw.rc index 9883af7..7f7eb68 100644 --- a/ddraw.rc +++ b/ddraw.rc @@ -1,6 +1,6 @@ 1 VERSIONINFO -FILEVERSION 1,1,4,1 -PRODUCTVERSION 1,1,4,1 +FILEVERSION 1,1,4,2 +PRODUCTVERSION 1,1,4,2 { BLOCK "StringFileInfo" { @@ -8,13 +8,13 @@ PRODUCTVERSION 1,1,4,1 { VALUE "CompanyName", "cncnet.org" VALUE "FileDescription", "DirectDraw replacement for C&C95 and Red Alert" - VALUE "FileVersion", "1.1.4.1" + VALUE "FileVersion", "1.1.4.2" VALUE "InternalName", "ddraw" VALUE "LegalCopyright", "Copyright (c) 2010-2017" VALUE "LegalTrademarks", "" VALUE "OriginalFileName", "ddraw.dll" VALUE "ProductName", "DirectDraw replacement for C&C95 and Red Alert" - VALUE "ProductVersion", "1.1.4.1" + VALUE "ProductVersion", "1.1.4.2" VALUE "Comments", "https://cncnet.org" } } diff --git a/src/main.c b/src/main.c index 5914d78..0c3b83d 100644 --- a/src/main.c +++ b/src/main.c @@ -602,12 +602,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } - ddraw->cursor.x = GET_X_LPARAM(lParam); - ddraw->cursor.y = GET_Y_LPARAM(lParam); - if (ddraw->devmode) { mouse_lock(); + ddraw->cursor.x = GET_X_LPARAM(lParam); + ddraw->cursor.y = GET_Y_LPARAM(lParam); } break; diff --git a/src/mouse.c b/src/mouse.c index dcf442e..89afe44 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -37,6 +37,17 @@ BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint) { if (lpPoint) { + POINT pt; + + if (!GetCursorPos(&pt)) + return FALSE; + + if(ddraw->locked && (!ddraw->windowed || ScreenToClient(ddraw->hWnd, &pt))) + { + ddraw->cursor.x = pt.x; + ddraw->cursor.y = pt.y; + } + lpPoint->x = (int)ddraw->cursor.x; lpPoint->y = (int)ddraw->cursor.y; }