From 137836348b53e77cb9ff6157c2c994fdb1deca1d Mon Sep 17 00:00:00 2001 From: a1batross Date: Thu, 29 Nov 2018 20:24:19 +0300 Subject: [PATCH] client: fix GetCenterWindow engine call --- engine/client/cl_game.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 49d6331e..a1041a43 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -1949,7 +1949,21 @@ GetWindowCenterX */ static int pfnGetWindowCenterX( void ) { - return host.window_center_x; + int x = 0; +#ifdef _WIN32 + if( m_ignore->value ) + { + POINT pos; + GetCursorPos( &pos ); + return pos.x; + } +#endif + +#ifdef XASH_SDL + SDL_GetWindowPosition( host.hWnd, &x, NULL ); +#endif + + return host.window_center_x + x; } /* @@ -1960,7 +1974,21 @@ GetWindowCenterY */ static int pfnGetWindowCenterY( void ) { - return host.window_center_y; + int y = 0; +#ifdef _WIN32 + if( m_ignore->value ) + { + POINT pos; + GetCursorPos( &pos ); + return pos.y; + } +#endif + +#ifdef XASH_SDL + SDL_GetWindowPosition( host.hWnd, NULL, &y ); +#endif + + return host.window_center_y + y; } /*