|
|
@ -101,10 +101,8 @@ void IN_MouseSavePos( void ) |
|
|
|
if( !in_mouseactive ) |
|
|
|
if( !in_mouseactive ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef XASH_SDL |
|
|
|
Platform_GetMousePos( &in_lastvalidpos.x, &in_lastvalidpos.y ); |
|
|
|
SDL_GetMouseState( &in_lastvalidpos.x, &in_lastvalidpos.y ); |
|
|
|
|
|
|
|
in_mouse_savedpos = true; |
|
|
|
in_mouse_savedpos = true; |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -119,9 +117,7 @@ void IN_MouseRestorePos( void ) |
|
|
|
if( !in_mouse_savedpos ) |
|
|
|
if( !in_mouse_savedpos ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef XASH_SDL |
|
|
|
Platform_SetMousePos( in_lastvalidpos.x, in_lastvalidpos.y ); |
|
|
|
SDL_WarpMouseInWindow( host.hWnd, in_lastvalidpos.x, in_lastvalidpos.y ); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_mouse_savedpos = false; |
|
|
|
in_mouse_savedpos = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -152,7 +148,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate ) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_WarpMouseInWindow( host.hWnd, host.window_center_x, host.window_center_y ); |
|
|
|
Platform_SetMousePos( host.window_center_x, host.window_center_y ); |
|
|
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE ); |
|
|
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE ); |
|
|
|
if( clgame.dllFuncs.pfnLookEvent ) |
|
|
|
if( clgame.dllFuncs.pfnLookEvent ) |
|
|
|
SDL_SetRelativeMouseMode( SDL_TRUE ); |
|
|
|
SDL_SetRelativeMouseMode( SDL_TRUE ); |
|
|
@ -282,9 +278,7 @@ void IN_MouseMove( void ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// find mouse movement
|
|
|
|
// find mouse movement
|
|
|
|
#ifdef XASH_SDL |
|
|
|
Platform_GetMousePos( ¤t_pos.x, ¤t_pos.y ); |
|
|
|
SDL_GetMouseState( ¤t_pos.x, ¤t_pos.y ); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VGui_MouseMove( current_pos.x, current_pos.y ); |
|
|
|
VGui_MouseMove( current_pos.x, current_pos.y ); |
|
|
|
|
|
|
|
|
|
|
@ -321,7 +315,7 @@ void IN_MouseEvent( void ) |
|
|
|
#if defined( XASH_SDL ) |
|
|
|
#if defined( XASH_SDL ) |
|
|
|
static qboolean ignore; // igonre mouse warp event
|
|
|
|
static qboolean ignore; // igonre mouse warp event
|
|
|
|
int x, y; |
|
|
|
int x, y; |
|
|
|
SDL_GetMouseState(&x, &y); |
|
|
|
Platform_GetMousePos(&x, &y); |
|
|
|
if( host.mouse_visible ) |
|
|
|
if( host.mouse_visible ) |
|
|
|
SDL_ShowCursor( SDL_TRUE ); |
|
|
|
SDL_ShowCursor( SDL_TRUE ); |
|
|
|
else |
|
|
|
else |
|
|
@ -332,7 +326,7 @@ void IN_MouseEvent( void ) |
|
|
|
x > host.window_center_x + host.window_center_x / 2 || |
|
|
|
x > host.window_center_x + host.window_center_x / 2 || |
|
|
|
y > host.window_center_y + host.window_center_y / 2 ) |
|
|
|
y > host.window_center_y + host.window_center_y / 2 ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_WarpMouseInWindow(host.hWnd, host.window_center_x, host.window_center_y); |
|
|
|
Platform_SetMousePos( host.window_center_x, host.window_center_y ); |
|
|
|
ignore = 1; // next mouse event will be mouse warp
|
|
|
|
ignore = 1; // next mouse event will be mouse warp
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|