mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
Add new ini option, adjmouse, enables mouse sensitivity scaling
This commit is contained in:
parent
58001d9de3
commit
7ff0c285ba
21
main.c
21
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)
|
if(LOWORD(lParam) != ddraw->render->width / 2 || HIWORD(lParam) != ddraw->render->height / 2)
|
||||||
{
|
{
|
||||||
ddraw->cursor.x += LOWORD(lParam) - ddraw->render->width / 2;
|
if(ddraw->adjmouse)
|
||||||
ddraw->cursor.y += HIWORD(lParam) - ddraw->render->height / 2;
|
{
|
||||||
|
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.x < 0) ddraw->cursor.x = 0;
|
||||||
if(ddraw->cursor.y < 0) ddraw->cursor.y = 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;
|
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();
|
This->render->Initialize();
|
||||||
|
|
||||||
|
3
main.h
3
main.h
@ -65,10 +65,11 @@ typedef struct IDirectDrawImpl
|
|||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
LRESULT CALLBACK (*WndProc)(HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK (*WndProc)(HWND, UINT, WPARAM, LPARAM);
|
||||||
POINT winpos;
|
POINT winpos;
|
||||||
POINT cursor;
|
struct { float x; float y; } cursor;
|
||||||
POINT center;
|
POINT center;
|
||||||
RECT cursorclip;
|
RECT cursorclip;
|
||||||
BOOL locked;
|
BOOL locked;
|
||||||
|
BOOL adjmouse;
|
||||||
|
|
||||||
BOOL key_ctrl;
|
BOOL key_ctrl;
|
||||||
BOOL key_tab;
|
BOOL key_tab;
|
||||||
|
4
mouse.c
4
mouse.c
@ -73,8 +73,8 @@ struct game games[] =
|
|||||||
|
|
||||||
BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
|
BOOL WINAPI fake_GetCursorPos(LPPOINT lpPoint)
|
||||||
{
|
{
|
||||||
lpPoint->x = ddraw->cursor.x;
|
lpPoint->x = (int)ddraw->cursor.x;
|
||||||
lpPoint->y = ddraw->cursor.y;
|
lpPoint->y = (int)ddraw->cursor.y;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user