Skip to content

Commit d340dcc

Browse files
committed
Migrate ROM cvar in_gameControllerAvailable
Also make sure it always really matches the state of whether gamepad mode is being used.
1 parent db48b53 commit d340dcc

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/engine/client/cl_input.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Maryland 20850 USA.
4040
#include "engine/qcommon/sys.h"
4141
#include "framework/CommandSystem.h"
4242

43+
static Cvar::Cvar<bool> in_gameControllerAvailable(
44+
"in_gameControllerAvailable", "whether controller is a gamepad (as opposed to joystick)",
45+
Cvar::ROM, false);
46+
4347
unsigned frame_msec;
4448
int old_com_frameTime;
4549

@@ -716,7 +720,7 @@ usercmd_t CL_CreateCmd()
716720
CL_MouseMove( &cmd );
717721

718722
// get basic movement from joystick or controller
719-
if ( cl_gameControllerAvailable->integer )
723+
if ( in_gameControllerAvailable.Get() )
720724
{
721725
CL_GameControllerMove( &cmd );
722726
}

src/engine/client/cl_main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ cvar_t *cl_aviFrameRate;
9595

9696
cvar_t *cl_freelook;
9797
cvar_t *cl_sensitivity;
98-
cvar_t *cl_gameControllerAvailable;
9998

10099
cvar_t *cl_mouseAccelOffset;
101100
cvar_t *cl_mouseAccel;
@@ -2334,8 +2333,6 @@ void CL_Init()
23342333
cl_mouseAccel = Cvar_Get( "cl_mouseAccel", "0", 0 );
23352334
cl_freelook = Cvar_Get( "cl_freelook", "1", CVAR_ARCHIVE );
23362335

2337-
cl_gameControllerAvailable = Cvar_Get( "in_gameControllerAvailable", "0", CVAR_ROM );
2338-
23392336
// 0: legacy mouse acceleration
23402337
// 1: new implementation
23412338

src/engine/client/client.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ extern cvar_t *cl_doubletapdelay;
399399
extern cvar_t *cl_sensitivity;
400400
extern cvar_t *cl_freelook;
401401

402-
extern cvar_t *cl_gameControllerAvailable;
403-
404402
extern cvar_t *cl_mouseAccel;
405403
extern cvar_t *cl_mouseAccelOffset;
406404
extern cvar_t *cl_mouseAccelStyle;

src/engine/sys/sdl_input.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,11 +631,12 @@ static void IN_InitJoystick()
631631
gamepad = SDL_OpenGamepad( id );
632632
if ( gamepad )
633633
{
634-
Cvar_Set( "in_gameControllerAvailable", "1" );
635634
SDL_GamepadEventsEnabled();
636635
}
637636
}
638637

638+
Cvar::SetValueForce( "in_gameControllerAvailable", gamepad ? "1" : "0" );
639+
639640
controllerLog.Notice( "Joystick %d opened", stickIndex );
640641
controllerLog.Verbose( "Name: %s", JoystickNameForID( id ) );
641642
controllerLog.Verbose( "Axes: %d", SDL_GetNumJoystickAxes( stick ) );

0 commit comments

Comments
 (0)