@ -10,7 +10,7 @@
@@ -10,7 +10,7 @@
# include "input_mouse.h"
# ifdef SUPPORT_GOLDSOURCE_INPUT
# if SUPPORT_GOLDSOURCE_INPUT
# include "hud.h"
# include "cl_util.h"
@ -24,10 +24,10 @@
@@ -24,10 +24,10 @@
# include "view.h"
# if !_WIN32
# define USE_SDL2
# define USE_SDL2 1
# endif
# ifdef USE_SDL2
# if USE_SDL2
# define ARRAYSIZE(p) ( sizeof(p) / sizeof(p[0]) )
# include <dlfcn.h>
# include <SDL2/SDL_mouse.h>
@ -220,7 +220,7 @@ enum _ControlList
@@ -220,7 +220,7 @@ enum _ControlList
AxisTurn
} ;
# if !defined( USE_SDL2) && defined( _WIN32)
# if !USE_SDL2 && _WIN32
DWORD dwAxisFlags [ JOY_MAX_AXES ] =
{
JOY_RETURNX ,
@ -234,9 +234,9 @@ DWORD dwAxisFlags[JOY_MAX_AXES] =
@@ -234,9 +234,9 @@ DWORD dwAxisFlags[JOY_MAX_AXES] =
DWORD dwAxisMap [ JOY_MAX_AXES ] ;
DWORD dwControlMap [ JOY_MAX_AXES ] ;
# if defined( USE_SDL2)
# if USE_SDL2
int pdwRawValue [ JOY_MAX_AXES ] ;
# elif defined( _WIN32)
# elif _WIN32
PDWORD pdwRawValue [ JOY_MAX_AXES ] ;
# endif
DWORD joy_oldbuttonstate , joy_oldpovstate ;
@ -244,9 +244,9 @@ DWORD joy_oldbuttonstate, joy_oldpovstate;
@@ -244,9 +244,9 @@ DWORD joy_oldbuttonstate, joy_oldpovstate;
int joy_id ;
DWORD joy_numbuttons ;
# ifdef USE_SDL2
# if USE_SDL2
SDL_GameController * s_pJoystick = NULL ;
# elif defined( _WIN32)
# elif _WIN32
DWORD joy_flags ;
static JOYINFOEX ji ;
# endif
@ -568,7 +568,7 @@ void GoldSourceInput::IN_Shutdown (void)
@@ -568,7 +568,7 @@ void GoldSourceInput::IN_Shutdown (void)
}
# endif
# ifdef USE_SDL2
# if USE_SDL2
for ( int j = 0 ; j < ARRAYSIZE ( sdlFunctions ) ; + + j ) {
* ( sdlFunctions [ j ] . ppfnFunc ) = NULL ;
}
@ -737,7 +737,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
@@ -737,7 +737,7 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
else
# endif
{
# ifdef USE_SDL2
# if USE_SDL2
safe_pfnSDL_GetRelativeMouseState ( & deltaX , & deltaY ) ;
current_pos . x = deltaX ;
current_pos . y = deltaY ;
@ -929,8 +929,8 @@ void GoldSourceInput::IN_MouseMove ( float frametime, usercmd_t *cmd)
@@ -929,8 +929,8 @@ void GoldSourceInput::IN_MouseMove ( float frametime, usercmd_t *cmd)
dead_viewangles = viewangles ; // keep them actual
/*
//#define TRACE_TEST
# if defined( TRACE_TEST )
//#define TRACE_TEST 1
# if TRACE_TEST
{
int mx , my ;
void V_Move ( int mx , int my ) ;
@ -967,7 +967,7 @@ void GoldSourceInput::IN_Accumulate (void)
@@ -967,7 +967,7 @@ void GoldSourceInput::IN_Accumulate (void)
else
# endif
{
# ifdef USE_SDL2
# if USE_SDL2
int deltaX , deltaY ;
safe_pfnSDL_GetRelativeMouseState ( & deltaX , & deltaY ) ;
mx_accum + = deltaX ;
@ -1022,7 +1022,7 @@ void IN_StartupJoystick (void)
@@ -1022,7 +1022,7 @@ void IN_StartupJoystick (void)
// assume no joystick
joy_avail = 0 ;
# ifdef USE_SDL2
# if USE_SDL2
int nJoysticks = safe_pfnSDL_NumJoysticks ( ) ;
if ( nJoysticks > 0 )
{
@ -1054,7 +1054,7 @@ void IN_StartupJoystick (void)
@@ -1054,7 +1054,7 @@ void IN_StartupJoystick (void)
{
gEngfuncs . Con_DPrintf ( " joystick not found -- driver not present \n \n " ) ;
}
# elif defined( _WIN32)
# elif _WIN32
int numdevs ;
JOYCAPS jc ;
MMRESULT mmr ;
@ -1109,7 +1109,7 @@ void IN_StartupJoystick (void)
@@ -1109,7 +1109,7 @@ void IN_StartupJoystick (void)
# endif
}
# ifdef USE_SDL2
# if USE_SDL2
int RawValuePointer ( int axis )
{
switch ( axis )
@ -1126,7 +1126,7 @@ int RawValuePointer (int axis)
@@ -1126,7 +1126,7 @@ int RawValuePointer (int axis)
}
}
# elif defined( _WIN32)
# elif _WIN32
PDWORD RawValuePointer ( int axis )
{
switch ( axis )
@ -1209,7 +1209,7 @@ void Joy_AdvancedUpdate_f (void)
@@ -1209,7 +1209,7 @@ void Joy_AdvancedUpdate_f (void)
dwControlMap [ JOY_AXIS_V ] = dwTemp & JOY_RELATIVE_AXIS ;
}
# if !defined( USE_SDL2) && defined( _WIN32)
# if !USE_SDL2 && _WIN32
// compute the axes to collect from DirectInput
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV ;
for ( i = 0 ; i < JOY_MAX_AXES ; i + + )
@ -1241,7 +1241,7 @@ void GoldSourceInput::IN_Commands (void)
@@ -1241,7 +1241,7 @@ void GoldSourceInput::IN_Commands (void)
// loop through the joystick buttons
// key a joystick event or auxillary event for higher number buttons for each state change
# ifdef USE_SDL2
# if USE_SDL2
buttonstate = 0 ;
for ( i = 0 ; i < SDL_CONTROLLER_BUTTON_MAX ; i + + )
{
@ -1255,7 +1255,7 @@ void GoldSourceInput::IN_Commands (void)
@@ -1255,7 +1255,7 @@ void GoldSourceInput::IN_Commands (void)
{
pdwRawValue [ i ] = RawValuePointer ( i ) ;
}
# elif defined( _WIN32)
# elif _WIN32
buttonstate = ji . dwButtons ;
# endif
@ -1281,7 +1281,7 @@ void GoldSourceInput::IN_Commands (void)
@@ -1281,7 +1281,7 @@ void GoldSourceInput::IN_Commands (void)
// this avoids any potential problems related to moving from one
// direction to another without going through the center position
povstate = 0 ;
# if !defined( USE_SDL2) && defined( _WIN32)
# if !USE_SDL2 && _WIN32
if ( ji . dwPOV ! = JOY_POVCENTERED )
{
if ( ji . dwPOV = = JOY_POVFORWARD )
@ -1319,10 +1319,10 @@ IN_ReadJoystick
@@ -1319,10 +1319,10 @@ IN_ReadJoystick
*/
int IN_ReadJoystick ( void )
{
# ifdef USE_SDL2
# if USE_SDL2
safe_pfnSDL_JoystickUpdate ( ) ;
return 1 ;
# elif defined( _WIN32)
# elif _WIN32
memset ( & ji , 0 , sizeof ( ji ) ) ;
ji . dwSize = sizeof ( ji ) ;
ji . dwFlags = joy_flags ;
@ -1399,9 +1399,9 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
@@ -1399,9 +1399,9 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
for ( i = 0 ; i < JOY_MAX_AXES ; i + + )
{
// get the floating point zero-centered, potentially-inverted data for the current axis
# ifdef USE_SDL2
# if USE_SDL2
fAxisValue = ( float ) pdwRawValue [ i ] ;
# elif defined( _WIN32)
# elif _WIN32
fAxisValue = ( float ) * pdwRawValue [ i ] ;
fAxisValue - = 32768.0 ;
# endif
@ -1625,7 +1625,7 @@ void GoldSourceInput::IN_Init (void)
@@ -1625,7 +1625,7 @@ void GoldSourceInput::IN_Init (void)
}
# endif
# ifdef USE_SDL2
# if USE_SDL2
# if __APPLE__
# define SDL2_FULL_LIBNAME "libsdl2-2.0.0.dylib"
# else