diff --git a/main.c b/main.c index 006bf11..27da2ce 100644 --- a/main.c +++ b/main.c @@ -210,8 +210,16 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(LOWORD(lParam) != ddraw->render->width / 2 || HIWORD(lParam) != ddraw->render->height / 2) { - ddraw->cursor.x += LOWORD(lParam) - ddraw->render->width / 2; - ddraw->cursor.y += HIWORD(lParam) - ddraw->render->height / 2; + if(ddraw->adjmouse) + { + ddraw->cursor.x += (LOWORD(lParam) - ddraw->render->width / 2) * ((float)ddraw->width / ddraw->render->width); + ddraw->cursor.y += (HIWORD(lParam) - ddraw->render->height / 2) * ((float)ddraw->height / ddraw->render->height); + } + else + { + ddraw->cursor.x += LOWORD(lParam) - ddraw->render->width / 2; + ddraw->cursor.y += HIWORD(lParam) - ddraw->render->height / 2; + } if(ddraw->cursor.x < 0) ddraw->cursor.x = 0; if(ddraw->cursor.y < 0) ddraw->cursor.y = 0; @@ -509,6 +517,15 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk { This->render->filter = 0; } + GetPrivateProfileStringA("ddraw", "adjmouse", "TRUE", tmp, sizeof(tmp), ini_path); + if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1') + { + This->adjmouse = TRUE; + } + else + { + This->adjmouse = FALSE; + } This->render->Initialize(); diff --git a/main.h b/main.h index a84ce0a..9dfbc1e 100644 --- a/main.h +++ b/main.h @@ -65,10 +65,11 @@ typedef struct IDirectDrawImpl HWND hWnd; LRESULT CALLBACK (*WndProc)(HWND, UINT, WPARAM, LPARAM); POINT winpos; - POINT cursor; + struct { float x; float y; } cursor; POINT center; RECT cursorclip; BOOL locked; + BOOL adjmouse; BOOL key_ctrl; BOOL key_tab; diff --git a/mouse.c b/mouse.c index 2ccfb0d..eba017c 100644 --- a/mouse.c +++ b/mouse.c @@ -73,8 +73,8 @@ struct game games[] = BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint) { - lpPoint->x = ddraw->cursor.x; - lpPoint->y = ddraw->cursor.y; + lpPoint->x = (int)ddraw->cursor.x; + lpPoint->y = (int)ddraw->cursor.y; return TRUE; }