mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-26 22:21:16 +00:00
IOQ3 commit 1946
This commit is contained in:
parent
5cd16e9de0
commit
26f5dfeaf8
5 changed files with 86 additions and 14 deletions
|
@ -108,6 +108,26 @@ New cvars
|
|||
cl_consoleKeys - space delimited list of key names or
|
||||
characters that toggle the console
|
||||
|
||||
in_joystickUseAnalog - Do not translate joystick axis events
|
||||
to keyboard commands
|
||||
|
||||
j_forward - Joystick analogue to m_forward,
|
||||
for forward movement speed/direction.
|
||||
j_side - Joystick analogue to m_side,
|
||||
for side movement speed/direction.
|
||||
j_pitch - Joystick analogue to m_pitch,
|
||||
for pitch rotation speed/direction.
|
||||
j_yaw - Joystick analogue to m_yaw,
|
||||
for yaw rotation speed/direction.
|
||||
j_forward_axis - Selects which joystick axis
|
||||
controls forward/back.
|
||||
j_side_axis - Selects which joystick axis
|
||||
controls left/right.
|
||||
j_pitch_axis - Selects which joystick axis
|
||||
controls pitch.
|
||||
j_yaw_axis - Selects which joystick axis
|
||||
controls yaw.
|
||||
|
||||
s_useOpenAL - use the OpenAL sound backend if available
|
||||
s_alPrecache - cache OpenAL sounds before use
|
||||
s_alGain - the value of AL_GAIN for each source
|
||||
|
|
|
@ -416,15 +416,19 @@ void CL_JoystickMove( usercmd_t *cmd ) {
|
|||
}
|
||||
|
||||
if ( !in_strafe.active ) {
|
||||
cl.viewangles[YAW] += anglespeed * cl_yawspeed->value * cl.joystickAxis[AXIS_SIDE];
|
||||
cl.viewangles[YAW] += anglespeed * j_yaw->value * cl.joystickAxis[j_yaw_axis->integer];
|
||||
cmd->rightmove = ClampChar( cmd->rightmove + (int) (j_side->value * cl.joystickAxis[j_side_axis->integer]) );
|
||||
} else {
|
||||
cmd->rightmove = ClampChar( cmd->rightmove + cl.joystickAxis[AXIS_SIDE] );
|
||||
cl.viewangles[YAW] += anglespeed * j_side->value * cl.joystickAxis[j_side_axis->integer];
|
||||
cmd->rightmove = ClampChar( cmd->rightmove + (int) (j_yaw->value * cl.joystickAxis[j_yaw_axis->integer]) );
|
||||
}
|
||||
|
||||
if ( in_mlooking ) {
|
||||
cl.viewangles[PITCH] += anglespeed * cl_pitchspeed->value * cl.joystickAxis[AXIS_FORWARD];
|
||||
cl.viewangles[PITCH] += anglespeed * j_forward->value * cl.joystickAxis[j_forward_axis->integer];
|
||||
cmd->forwardmove = ClampChar( cmd->forwardmove + (int) (j_pitch->value * cl.joystickAxis[j_pitch_axis->integer]) );
|
||||
} else {
|
||||
cmd->forwardmove = ClampChar( cmd->forwardmove + cl.joystickAxis[AXIS_FORWARD] );
|
||||
cl.viewangles[PITCH] += anglespeed * j_pitch->value * cl.joystickAxis[j_pitch_axis->integer];
|
||||
cmd->forwardmove = ClampChar( cmd->forwardmove + (int) (j_forward->value * cl.joystickAxis[j_forward_axis->integer]) );
|
||||
}
|
||||
|
||||
cmd->upmove = ClampChar( cmd->upmove + cl.joystickAxis[AXIS_UP] );
|
||||
|
|
|
@ -83,6 +83,15 @@ cvar_t *m_forward;
|
|||
cvar_t *m_side;
|
||||
cvar_t *m_filter;
|
||||
|
||||
cvar_t *j_pitch;
|
||||
cvar_t *j_yaw;
|
||||
cvar_t *j_forward;
|
||||
cvar_t *j_side;
|
||||
cvar_t *j_pitch_axis;
|
||||
cvar_t *j_yaw_axis;
|
||||
cvar_t *j_forward_axis;
|
||||
cvar_t *j_side_axis;
|
||||
|
||||
cvar_t *cl_activeAction;
|
||||
|
||||
cvar_t *cl_motdString;
|
||||
|
@ -3174,6 +3183,15 @@ void CL_Init( void ) {
|
|||
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE);
|
||||
#endif
|
||||
|
||||
j_pitch = Cvar_Get ("j_pitch", "0.022", CVAR_ARCHIVE);
|
||||
j_yaw = Cvar_Get ("j_yaw", "-0.022", CVAR_ARCHIVE);
|
||||
j_forward = Cvar_Get ("j_forward", "-0.25", CVAR_ARCHIVE);
|
||||
j_side = Cvar_Get ("j_side", "0.25", CVAR_ARCHIVE);
|
||||
j_pitch_axis = Cvar_Get ("j_pitch_axis", "3", CVAR_ARCHIVE);
|
||||
j_yaw_axis = Cvar_Get ("j_yaw_axis", "4", CVAR_ARCHIVE);
|
||||
j_forward_axis = Cvar_Get ("j_forward_axis", "1", CVAR_ARCHIVE);
|
||||
j_side_axis = Cvar_Get ("j_side_axis", "0", CVAR_ARCHIVE);
|
||||
|
||||
cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
|
||||
|
||||
Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE );
|
||||
|
|
|
@ -389,6 +389,15 @@ extern cvar_t *m_forward;
|
|||
extern cvar_t *m_side;
|
||||
extern cvar_t *m_filter;
|
||||
|
||||
extern cvar_t *j_pitch;
|
||||
extern cvar_t *j_yaw;
|
||||
extern cvar_t *j_forward;
|
||||
extern cvar_t *j_side;
|
||||
extern cvar_t *j_pitch_axis;
|
||||
extern cvar_t *j_yaw_axis;
|
||||
extern cvar_t *j_forward_axis;
|
||||
extern cvar_t *j_side_axis;
|
||||
|
||||
extern cvar_t *cl_timedemo;
|
||||
extern cvar_t *cl_aviFrameRate;
|
||||
extern cvar_t *cl_aviMotionJpeg;
|
||||
|
|
|
@ -67,6 +67,7 @@ static cvar_t *in_joystick = NULL;
|
|||
static cvar_t *in_joystickDebug = NULL;
|
||||
static cvar_t *in_joystickThreshold = NULL;
|
||||
static cvar_t *in_joystickNo = NULL;
|
||||
static cvar_t *in_joystickUseAnalog = NULL;
|
||||
|
||||
static int vidRestartTime = 0;
|
||||
|
||||
|
@ -561,6 +562,7 @@ struct
|
|||
{
|
||||
qboolean buttons[16]; // !!! FIXME: these might be too many.
|
||||
unsigned int oldaxes;
|
||||
int oldaaxes[16];
|
||||
unsigned int oldhats;
|
||||
} stick_state;
|
||||
|
||||
|
@ -606,6 +608,8 @@ static void IN_InitJoystick( void )
|
|||
if( in_joystickNo->integer < 0 || in_joystickNo->integer >= total )
|
||||
Cvar_Set( "in_joystickNo", "0" );
|
||||
|
||||
in_joystickUseAnalog = Cvar_Get( "in_joystickUseAnalog", "0", CVAR_ARCHIVE );
|
||||
|
||||
stick = SDL_JoystickOpen( in_joystickNo->integer );
|
||||
|
||||
if (stick == NULL) {
|
||||
|
@ -619,6 +623,7 @@ static void IN_InitJoystick( void )
|
|||
Com_DPrintf( "Hats: %d\n", SDL_JoystickNumHats(stick) );
|
||||
Com_DPrintf( "Buttons: %d\n", SDL_JoystickNumButtons(stick) );
|
||||
Com_DPrintf( "Balls: %d\n", SDL_JoystickNumBalls(stick) );
|
||||
Com_DPrintf( "Use Analog: %s\n", in_joystickUseAnalog->integer ? "Yes" : "No" );
|
||||
|
||||
SDL_JoystickEventState(SDL_QUERY);
|
||||
}
|
||||
|
@ -799,6 +804,21 @@ static void IN_JoyMove( void )
|
|||
for (i = 0; i < total; i++)
|
||||
{
|
||||
Sint16 axis = SDL_JoystickGetAxis(stick, i);
|
||||
|
||||
if (in_joystickUseAnalog->integer)
|
||||
{
|
||||
float f = ( (float) abs(axis) ) / 32767.0f;
|
||||
|
||||
if( f < in_joystickThreshold->value ) axis = 0;
|
||||
|
||||
if ( axis != stick_state.oldaaxes[i] )
|
||||
{
|
||||
Com_QueueEvent( 0, SE_JOYSTICK_AXIS, i, axis, 0, NULL );
|
||||
stick_state.oldaaxes[i] = axis;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = ( (float) axis ) / 32767.0f;
|
||||
if( f < -in_joystickThreshold->value ) {
|
||||
axes |= ( 1 << ( i * 2 ) );
|
||||
|
@ -807,6 +827,7 @@ static void IN_JoyMove( void )
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Time to update axes state based on old vs. new. */
|
||||
if (axes != stick_state.oldaxes)
|
||||
|
|
Loading…
Reference in a new issue