1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

Allow disabling mouse hacks

This commit is contained in:
Toni Spets 2010-11-15 20:36:22 +02:00
parent d881b92c1c
commit 924a5254a8
3 changed files with 21 additions and 4 deletions

15
main.c
View File

@ -537,6 +537,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
"filter=nearest\n" "filter=nearest\n"
"; mouse sensitivity scaling\n" "; mouse sensitivity scaling\n"
"adjmouse=false\n" "adjmouse=false\n"
"; enable C&C/RA mouse hack\n"
"mhack=true\n"
, fh); , fh);
fclose(fh); fclose(fh);
} }
@ -578,7 +580,8 @@ 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);
GetPrivateProfileStringA("ddraw", "adjmouse", "FALSE", tmp, sizeof(tmp), ini_path);
if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1') if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1')
{ {
This->adjmouse = TRUE; This->adjmouse = TRUE;
@ -588,6 +591,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
This->adjmouse = FALSE; This->adjmouse = FALSE;
} }
GetPrivateProfileStringA("ddraw", "mhack", "TRUE", tmp, sizeof(tmp), ini_path);
if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1')
{
This->mhack = TRUE;
}
else
{
This->mhack = FALSE;
}
This->Ref = 0; This->Ref = 0;
ddraw_AddRef(This); ddraw_AddRef(This);

1
main.h
View File

@ -69,6 +69,7 @@ typedef struct IDirectDrawImpl
RECT cursorclip; RECT cursorclip;
BOOL locked; BOOL locked;
BOOL adjmouse; BOOL adjmouse;
BOOL mhack;
BOOL key_ctrl; BOOL key_ctrl;
BOOL key_tab; BOOL key_tab;

View File

@ -168,7 +168,10 @@ void mouse_unlock()
void mouse_init(HWND hWnd) void mouse_init(HWND hWnd)
{ {
SetCursor(LoadCursor(NULL, IDC_ARROW)); if(ddraw->mhack)
hack_iat(&hacks[0]); {
mouse_active = TRUE; SetCursor(LoadCursor(NULL, IDC_ARROW));
hack_iat(&hacks[0]);
mouse_active = TRUE;
}
} }