2010-10-19 07:29:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Yamagi Burmeister
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
* Copyright (C) 1997-2005 Id Software, Inc.
|
2010-10-19 07:29:20 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*
|
2018-07-16 13:36:06 +00:00
|
|
|
* Joystick threshold code is partially based on http://ioquake3.org code.
|
|
|
|
*
|
2010-10-19 07:29:20 +00:00
|
|
|
* =======================================================================
|
|
|
|
*
|
2014-01-05 17:09:26 +00:00
|
|
|
* This is the Quake II input system backend, implemented with SDL.
|
2010-10-19 07:29:20 +00:00
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*/
|
2013-04-28 19:33:08 +00:00
|
|
|
|
2018-07-16 12:37:34 +00:00
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
|
2012-08-01 11:47:32 +00:00
|
|
|
#include "../../client/header/keyboard.h"
|
2014-06-10 07:43:53 +00:00
|
|
|
#include "../../client/header/client.h"
|
2018-07-16 12:37:34 +00:00
|
|
|
#include "../generic/header/input.h"
|
2013-08-25 22:55:31 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// ----
|
|
|
|
|
|
|
|
// Maximal mouse move per frame
|
2010-10-19 08:25:47 +00:00
|
|
|
#define MOUSE_MAX 3000
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// Minimal mouse move per frame
|
|
|
|
#define MOUSE_MIN 40
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// ----
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// These are used to communicate the events collected by
|
|
|
|
// IN_Update() called at the beginning of a frame to the
|
|
|
|
// actual movement functions called at a later time.
|
2013-11-10 08:46:28 +00:00
|
|
|
static int mouse_x, mouse_y;
|
2018-07-16 13:36:06 +00:00
|
|
|
static int back_button_id = -1;
|
2017-12-02 17:54:26 +00:00
|
|
|
static float joystick_yaw, joystick_pitch;
|
|
|
|
static float joystick_forwardmove, joystick_sidemove;
|
|
|
|
static float joystick_up;
|
2018-07-16 13:36:06 +00:00
|
|
|
static qboolean mlooking;
|
|
|
|
|
|
|
|
// The last time input events were processed.
|
|
|
|
// Used throughout the client.
|
|
|
|
int sys_frame_time;
|
|
|
|
|
|
|
|
// Console Variables
|
|
|
|
cvar_t *vid_fullscreen;
|
|
|
|
cvar_t *freelook;
|
|
|
|
cvar_t *lookstrafe;
|
|
|
|
cvar_t *m_forward;
|
|
|
|
cvar_t *m_pitch;
|
|
|
|
cvar_t *m_side;
|
|
|
|
cvar_t *m_up;
|
|
|
|
cvar_t *m_yaw;
|
|
|
|
cvar_t *sensitivity;
|
|
|
|
|
|
|
|
static cvar_t *exponential_speedup;
|
|
|
|
static cvar_t *in_grab;
|
|
|
|
static cvar_t *m_filter;
|
|
|
|
static cvar_t *windowed_mouse;
|
|
|
|
|
|
|
|
// ----
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
/* Haptic feedback types */
|
|
|
|
enum QHARPICTYPES {
|
|
|
|
HAPTIC_EFFECT_UNKNOWN = -1,
|
|
|
|
HAPTIC_EFFECT_BLASTER = 0,
|
|
|
|
HAPTIC_EFFECT_MENY,
|
|
|
|
HAPTIC_EFFECT_HYPER_BLASTER,
|
|
|
|
HAPTIC_EFFECT_MACHINEGUN,
|
|
|
|
HAPTIC_EFFECT_SHOTGUN,
|
|
|
|
HAPTIC_EFFECT_SSHOTGUN,
|
|
|
|
HAPTIC_EFFECT_RAILGUN,
|
|
|
|
HAPTIC_EFFECT_ROCKETGUN,
|
|
|
|
HAPTIC_EFFECT_GRENADE,
|
|
|
|
HAPTIC_EFFECT_BFG,
|
|
|
|
HAPTIC_EFFECT_PALANX,
|
|
|
|
HAPTIC_EFFECT_IONRIPPER,
|
|
|
|
HAPTIC_EFFECT_ETFRIFLE,
|
|
|
|
HAPTIC_EFFECT_SHOTGUN2,
|
|
|
|
HAPTIC_EFFECT_TRACKER,
|
|
|
|
HAPTIC_EFFECT_PAIN,
|
|
|
|
HAPTIC_EFFECT_STEP,
|
|
|
|
HAPTIC_EFFECT_TRAPCOCK,
|
|
|
|
HAPTIC_EFFECT_LAST
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hapric_effects_cache {
|
2018-02-06 21:37:36 +00:00
|
|
|
int effect_type;
|
|
|
|
int effect_volume;
|
|
|
|
int effect_id;
|
|
|
|
int effect_x;
|
|
|
|
int effect_y;
|
|
|
|
int effect_z;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
};
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
qboolean show_haptic;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
static SDL_Haptic *joystick_haptic = NULL;
|
|
|
|
static SDL_Joystick *joystick = NULL;
|
|
|
|
static SDL_GameController *controller = NULL;
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
static int last_haptic_volume = 0;
|
|
|
|
static int last_haptic_efffect_size = HAPTIC_EFFECT_LAST;
|
|
|
|
static int last_haptic_efffect_pos = 0;
|
|
|
|
static struct hapric_effects_cache last_haptic_efffect[HAPTIC_EFFECT_LAST];
|
2013-11-10 08:46:28 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// Joystick sensitivity
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
static cvar_t *joy_yawsensitivity;
|
|
|
|
static cvar_t *joy_pitchsensitivity;
|
|
|
|
static cvar_t *joy_forwardsensitivity;
|
|
|
|
static cvar_t *joy_sidesensitivity;
|
|
|
|
static cvar_t *joy_upsensitivity;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// Joystick direction settings
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
static cvar_t *joy_axis_leftx;
|
|
|
|
static cvar_t *joy_axis_lefty;
|
|
|
|
static cvar_t *joy_axis_rightx;
|
|
|
|
static cvar_t *joy_axis_righty;
|
|
|
|
static cvar_t *joy_axis_triggerleft;
|
|
|
|
static cvar_t *joy_axis_triggerright;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// Joystick threshold settings
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
static cvar_t *joy_axis_leftx_threshold;
|
|
|
|
static cvar_t *joy_axis_lefty_threshold;
|
|
|
|
static cvar_t *joy_axis_rightx_threshold;
|
|
|
|
static cvar_t *joy_axis_righty_threshold;
|
|
|
|
static cvar_t *joy_axis_triggerleft_threshold;
|
|
|
|
static cvar_t *joy_axis_triggerright_threshold;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// Joystick haptic
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
static cvar_t *joy_haptic_magnitude;
|
2016-12-19 02:16:44 +00:00
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/* ------------------------------------------------------------------ */
|
2012-11-13 21:37:17 +00:00
|
|
|
|
2010-10-19 08:25:47 +00:00
|
|
|
/*
|
2015-01-17 07:34:58 +00:00
|
|
|
* This creepy function translates SDL keycodes into
|
|
|
|
* the id Tech 2 engines interal representation.
|
2010-10-19 08:25:47 +00:00
|
|
|
*/
|
2013-11-10 08:46:28 +00:00
|
|
|
static int
|
2010-10-19 08:25:47 +00:00
|
|
|
IN_TranslateSDLtoQ2Key(unsigned int keysym)
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
2012-06-08 10:23:01 +00:00
|
|
|
int key = 0;
|
|
|
|
|
2015-01-17 07:34:58 +00:00
|
|
|
/* These must be translated */
|
|
|
|
switch (keysym)
|
2012-06-08 10:23:01 +00:00
|
|
|
{
|
2015-01-17 07:34:58 +00:00
|
|
|
case SDLK_PAGEUP:
|
|
|
|
key = K_PGUP;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_9:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_PGUP;
|
|
|
|
break;
|
|
|
|
case SDLK_PAGEDOWN:
|
|
|
|
key = K_PGDN;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_3:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_PGDN;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_7:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_HOME;
|
|
|
|
break;
|
|
|
|
case SDLK_HOME:
|
|
|
|
key = K_HOME;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_1:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_END;
|
|
|
|
break;
|
|
|
|
case SDLK_END:
|
|
|
|
key = K_END;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_4:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_LEFTARROW;
|
|
|
|
break;
|
|
|
|
case SDLK_LEFT:
|
|
|
|
key = K_LEFTARROW;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_6:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_RIGHTARROW;
|
|
|
|
break;
|
|
|
|
case SDLK_RIGHT:
|
|
|
|
key = K_RIGHTARROW;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_2:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_DOWNARROW;
|
|
|
|
break;
|
|
|
|
case SDLK_DOWN:
|
|
|
|
key = K_DOWNARROW;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_8:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_UPARROW;
|
|
|
|
break;
|
|
|
|
case SDLK_UP:
|
|
|
|
key = K_UPARROW;
|
|
|
|
break;
|
|
|
|
case SDLK_ESCAPE:
|
|
|
|
key = K_ESCAPE;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_ENTER:
|
|
|
|
key = K_KP_ENTER;
|
|
|
|
break;
|
|
|
|
case SDLK_RETURN:
|
|
|
|
key = K_ENTER;
|
|
|
|
break;
|
|
|
|
case SDLK_TAB:
|
|
|
|
key = K_TAB;
|
|
|
|
break;
|
|
|
|
case SDLK_F1:
|
|
|
|
key = K_F1;
|
|
|
|
break;
|
|
|
|
case SDLK_F2:
|
|
|
|
key = K_F2;
|
|
|
|
break;
|
|
|
|
case SDLK_F3:
|
|
|
|
key = K_F3;
|
|
|
|
break;
|
|
|
|
case SDLK_F4:
|
|
|
|
key = K_F4;
|
|
|
|
break;
|
|
|
|
case SDLK_F5:
|
|
|
|
key = K_F5;
|
|
|
|
break;
|
|
|
|
case SDLK_F6:
|
|
|
|
key = K_F6;
|
|
|
|
break;
|
|
|
|
case SDLK_F7:
|
|
|
|
key = K_F7;
|
|
|
|
break;
|
|
|
|
case SDLK_F8:
|
|
|
|
key = K_F8;
|
|
|
|
break;
|
|
|
|
case SDLK_F9:
|
|
|
|
key = K_F9;
|
|
|
|
break;
|
|
|
|
case SDLK_F10:
|
|
|
|
key = K_F10;
|
|
|
|
break;
|
|
|
|
case SDLK_F11:
|
|
|
|
key = K_F11;
|
|
|
|
break;
|
|
|
|
case SDLK_F12:
|
|
|
|
key = K_F12;
|
|
|
|
break;
|
|
|
|
case SDLK_F13:
|
|
|
|
key = K_F13;
|
|
|
|
break;
|
|
|
|
case SDLK_F14:
|
|
|
|
key = K_F14;
|
|
|
|
break;
|
|
|
|
case SDLK_F15:
|
|
|
|
key = K_F15;
|
|
|
|
break;
|
|
|
|
case SDLK_BACKSPACE:
|
|
|
|
key = K_BACKSPACE;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_PERIOD:
|
|
|
|
key = K_KP_DEL;
|
|
|
|
break;
|
|
|
|
case SDLK_DELETE:
|
|
|
|
key = K_DEL;
|
|
|
|
break;
|
|
|
|
case SDLK_PAUSE:
|
|
|
|
key = K_PAUSE;
|
|
|
|
break;
|
|
|
|
case SDLK_LSHIFT:
|
|
|
|
case SDLK_RSHIFT:
|
|
|
|
key = K_SHIFT;
|
|
|
|
break;
|
|
|
|
case SDLK_LCTRL:
|
|
|
|
case SDLK_RCTRL:
|
|
|
|
key = K_CTRL;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_LGUI:
|
|
|
|
case SDLK_RGUI:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_COMMAND;
|
|
|
|
break;
|
|
|
|
case SDLK_RALT:
|
|
|
|
case SDLK_LALT:
|
|
|
|
key = K_ALT;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_5:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_5;
|
|
|
|
break;
|
|
|
|
case SDLK_INSERT:
|
|
|
|
key = K_INS;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_KP_0:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_INS;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_MULTIPLY:
|
|
|
|
key = K_KP_STAR;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_PLUS:
|
|
|
|
key = K_KP_PLUS;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_MINUS:
|
|
|
|
key = K_KP_MINUS;
|
|
|
|
break;
|
|
|
|
case SDLK_KP_DIVIDE:
|
|
|
|
key = K_KP_SLASH;
|
|
|
|
break;
|
|
|
|
case SDLK_MODE:
|
|
|
|
key = K_MODE;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_APPLICATION:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_COMPOSE;
|
|
|
|
break;
|
|
|
|
case SDLK_HELP:
|
|
|
|
key = K_HELP;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_PRINTSCREEN:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_PRINT;
|
|
|
|
break;
|
|
|
|
case SDLK_SYSREQ:
|
|
|
|
key = K_SYSREQ;
|
|
|
|
break;
|
|
|
|
case SDLK_MENU:
|
|
|
|
key = K_MENU;
|
|
|
|
break;
|
|
|
|
case SDLK_POWER:
|
|
|
|
key = K_POWER;
|
|
|
|
break;
|
|
|
|
case SDLK_UNDO:
|
|
|
|
key = K_UNDO;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_SCROLLLOCK:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_SCROLLOCK;
|
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
case SDLK_NUMLOCKCLEAR:
|
2015-01-17 07:34:58 +00:00
|
|
|
key = K_KP_NUMLOCK;
|
|
|
|
break;
|
|
|
|
case SDLK_CAPSLOCK:
|
|
|
|
key = K_CAPSLOCK;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-08 10:23:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return key;
|
2010-10-19 07:29:20 +00:00
|
|
|
}
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/* ------------------------------------------------------------------ */
|
2013-08-26 21:55:34 +00:00
|
|
|
|
2010-10-19 08:25:47 +00:00
|
|
|
/*
|
2014-01-05 17:09:26 +00:00
|
|
|
* Updates the input queue state. Called every
|
|
|
|
* frame by the client and does nearly all the
|
|
|
|
* input magic.
|
2010-10-19 08:25:47 +00:00
|
|
|
*/
|
2014-01-05 17:09:26 +00:00
|
|
|
void
|
|
|
|
IN_Update(void)
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
2014-01-05 17:09:26 +00:00
|
|
|
qboolean want_grab;
|
|
|
|
SDL_Event event;
|
2018-02-03 08:20:58 +00:00
|
|
|
unsigned int key;
|
2013-11-10 08:46:28 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
static char last_hat = SDL_HAT_CENTERED;
|
|
|
|
static qboolean left_trigger = false;
|
|
|
|
static qboolean right_trigger = false;
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/* Get and process an event */
|
|
|
|
while (SDL_PollEvent(&event))
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
2014-01-05 17:09:26 +00:00
|
|
|
|
|
|
|
switch (event.type)
|
|
|
|
{
|
|
|
|
case SDL_MOUSEWHEEL:
|
2015-01-17 07:34:58 +00:00
|
|
|
Key_Event((event.wheel.y > 0 ? K_MWHEELUP : K_MWHEELDOWN), true, true);
|
|
|
|
Key_Event((event.wheel.y > 0 ? K_MWHEELUP : K_MWHEELDOWN), false, true);
|
2013-11-26 18:22:29 +00:00
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
case SDL_MOUSEBUTTONDOWN:
|
|
|
|
case SDL_MOUSEBUTTONUP:
|
2018-02-03 08:20:58 +00:00
|
|
|
switch (event.button.button)
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
|
|
|
case SDL_BUTTON_LEFT:
|
|
|
|
key = K_MOUSE1;
|
|
|
|
break;
|
|
|
|
case SDL_BUTTON_MIDDLE:
|
|
|
|
key = K_MOUSE3;
|
|
|
|
break;
|
|
|
|
case SDL_BUTTON_RIGHT:
|
|
|
|
key = K_MOUSE2;
|
|
|
|
break;
|
|
|
|
case SDL_BUTTON_X1:
|
|
|
|
key = K_MOUSE4;
|
|
|
|
break;
|
|
|
|
case SDL_BUTTON_X2:
|
|
|
|
key = K_MOUSE5;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2012-04-29 13:57:33 +00:00
|
|
|
|
2015-01-17 07:34:58 +00:00
|
|
|
Key_Event(key, (event.type == SDL_MOUSEBUTTONDOWN), true);
|
2013-03-18 18:37:26 +00:00
|
|
|
break;
|
|
|
|
|
2014-03-26 19:34:19 +00:00
|
|
|
case SDL_MOUSEMOTION:
|
2018-02-03 08:20:58 +00:00
|
|
|
if (cls.key_dest == key_game && (int) cl_paused->value == 0)
|
|
|
|
{
|
|
|
|
mouse_x += event.motion.xrel;
|
|
|
|
mouse_y += event.motion.yrel;
|
|
|
|
}
|
2014-03-26 19:34:19 +00:00
|
|
|
break;
|
|
|
|
|
2015-01-17 07:34:58 +00:00
|
|
|
case SDL_TEXTINPUT:
|
2018-07-16 13:36:06 +00:00
|
|
|
if ((event.text.text[0] >= ' ') && (event.text.text[0] <= '~'))
|
2015-01-21 16:24:03 +00:00
|
|
|
{
|
|
|
|
Char_Event(event.text.text[0]);
|
|
|
|
}
|
|
|
|
|
2015-01-17 07:34:58 +00:00
|
|
|
break;
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
case SDL_KEYDOWN:
|
Workaround for better AZERTY-Keyboard support
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à , ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have scancodes
which we need scancodes to identify the keys.
While at it I unified handling of SDL_KEYDOWN and SDL_KEYUP, the code
is almost identical anyway, apart from one bool argument to Key_Event().
We track this problem in #81
2015-11-22 21:55:06 +00:00
|
|
|
case SDL_KEYUP:
|
|
|
|
{
|
|
|
|
qboolean down = (event.type == SDL_KEYDOWN);
|
|
|
|
|
2015-12-12 17:47:46 +00:00
|
|
|
/* workaround for AZERTY-keyboards, which don't have 1, 2, ..., 9, 0 in first row:
|
|
|
|
* always map those physical keys (scancodes) to those keycodes anyway
|
|
|
|
* see also https://bugzilla.libsdl.org/show_bug.cgi?id=3188 */
|
Workaround for better AZERTY-Keyboard support
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à , ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have scancodes
which we need scancodes to identify the keys.
While at it I unified handling of SDL_KEYDOWN and SDL_KEYUP, the code
is almost identical anyway, apart from one bool argument to Key_Event().
We track this problem in #81
2015-11-22 21:55:06 +00:00
|
|
|
SDL_Scancode sc = event.key.keysym.scancode;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
if (sc >= SDL_SCANCODE_1 && sc <= SDL_SCANCODE_0)
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
2015-12-12 17:47:46 +00:00
|
|
|
/* Note that the SDL_SCANCODEs are SDL_SCANCODE_1, _2, ..., _9, SDL_SCANCODE_0
|
|
|
|
* while in ASCII it's '0', '1', ..., '9' => handle 0 and 1-9 separately
|
|
|
|
* (quake2 uses the ASCII values for those keys) */
|
|
|
|
int key = '0'; /* implicitly handles SDL_SCANCODE_0 */
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
if (sc <= SDL_SCANCODE_9)
|
Workaround for better AZERTY-Keyboard support
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à , ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have scancodes
which we need scancodes to identify the keys.
While at it I unified handling of SDL_KEYDOWN and SDL_KEYUP, the code
is almost identical anyway, apart from one bool argument to Key_Event().
We track this problem in #81
2015-11-22 21:55:06 +00:00
|
|
|
{
|
|
|
|
key = '1' + (sc - SDL_SCANCODE_1);
|
|
|
|
}
|
2018-07-16 12:37:34 +00:00
|
|
|
|
Workaround for better AZERTY-Keyboard support
The first row of AZERTY-Keyboards (used in France and Belgium) doesn't
have numbers as keys but ², &, é, ", ', (, -, è, _, ç, à , ), =
(with small differences between France and Belgium).
For some of those keys we don't have keycodes - and neither does SDL2.
See also https://bugzilla.libsdl.org/show_bug.cgi?id=3188
As a workaround, just map those keys to 1, 2, ..., 9, 0 anyway, as those
are keys Quake2 already knows (and those chars are printed on the keys
too, for typing they're reachable via shift).
This workaround only works for SDL2, as SDL1.2 doesn't have scancodes
which we need scancodes to identify the keys.
While at it I unified handling of SDL_KEYDOWN and SDL_KEYUP, the code
is almost identical anyway, apart from one bool argument to Key_Event().
We track this problem in #81
2015-11-22 21:55:06 +00:00
|
|
|
Key_Event(key, down, false);
|
2015-01-17 07:34:58 +00:00
|
|
|
}
|
|
|
|
else
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
2018-07-16 13:36:06 +00:00
|
|
|
if ((event.key.keysym.sym >= SDLK_SPACE) && (event.key.keysym.sym < SDLK_DELETE))
|
|
|
|
{
|
|
|
|
Key_Event(event.key.keysym.sym, down, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Key_Event(IN_TranslateSDLtoQ2Key(event.key.keysym.sym), down, true);
|
|
|
|
}
|
2014-01-05 17:09:26 +00:00
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
2015-03-31 19:23:04 +00:00
|
|
|
|
2015-04-13 22:51:38 +00:00
|
|
|
case SDL_WINDOWEVENT:
|
2018-02-03 08:20:58 +00:00
|
|
|
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST ||
|
|
|
|
event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
2015-04-13 22:51:38 +00:00
|
|
|
{
|
|
|
|
Key_MarkAllUp();
|
|
|
|
}
|
2018-02-03 08:20:58 +00:00
|
|
|
else if (event.window.event == SDL_WINDOWEVENT_MOVED)
|
2017-03-04 15:31:34 +00:00
|
|
|
{
|
|
|
|
// make sure GLimp_GetRefreshRate() will query from SDL again - the window might
|
|
|
|
// be on another display now!
|
|
|
|
glimp_refreshRate = -1;
|
|
|
|
}
|
2015-04-13 22:51:38 +00:00
|
|
|
break;
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
case SDL_CONTROLLERBUTTONUP:
|
|
|
|
case SDL_CONTROLLERBUTTONDOWN: /* Handle Controller Back button */
|
|
|
|
{
|
|
|
|
qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
if (event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK)
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
Key_Event(K_JOY_BACK, down, true);
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLERAXISMOTION: /* Handle Controller Motion */
|
|
|
|
{
|
2018-02-03 08:20:58 +00:00
|
|
|
char *direction_type;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
float threshold = 0;
|
|
|
|
float fix_value = 0;
|
|
|
|
int axis_value = event.caxis.value;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
switch (event.caxis.axis)
|
|
|
|
{
|
|
|
|
/* left/right */
|
|
|
|
case SDL_CONTROLLER_AXIS_LEFTX:
|
|
|
|
direction_type = joy_axis_leftx->string;
|
|
|
|
threshold = joy_axis_leftx_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
|
|
|
/* top/bottom */
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLER_AXIS_LEFTY:
|
|
|
|
direction_type = joy_axis_lefty->string;
|
|
|
|
threshold = joy_axis_lefty_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
|
|
|
/* second left/right */
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLER_AXIS_RIGHTX:
|
|
|
|
direction_type = joy_axis_rightx->string;
|
|
|
|
threshold = joy_axis_rightx_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
|
|
|
/* second top/bottom */
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLER_AXIS_RIGHTY:
|
|
|
|
direction_type = joy_axis_righty->string;
|
|
|
|
threshold = joy_axis_righty_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
|
|
|
direction_type = joy_axis_triggerleft->string;
|
|
|
|
threshold = joy_axis_triggerleft_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
|
|
|
direction_type = joy_axis_triggerright->string;
|
|
|
|
threshold = joy_axis_triggerright_threshold->value;
|
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
default:
|
|
|
|
direction_type = "none";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (threshold > 0.9)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
threshold = 0.9;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
if (axis_value < 0 && (axis_value > (32768 * threshold)))
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
axis_value = 0;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
else if (axis_value > 0 && (axis_value < (32768 * threshold)))
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
axis_value = 0;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
// Smoothly ramp from dead zone to maximum value (from ioquake)
|
|
|
|
// https://github.com/ioquake/ioq3/blob/master/code/sdl/sdl_input.c
|
2018-02-03 08:20:58 +00:00
|
|
|
fix_value = ((float) abs(axis_value) / 32767.0f - threshold) / (1.0f - threshold);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (fix_value < 0.0f)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
fix_value = 0.0f;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
2016-07-18 08:11:54 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
axis_value = (int) (32767 * ((axis_value < 0) ? -fix_value : fix_value));
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
if (cls.key_dest == key_game && (int) cl_paused->value == 0)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
if (strcmp(direction_type, "sidemove") == 0)
|
|
|
|
{
|
|
|
|
joystick_sidemove = axis_value * joy_sidesensitivity->value;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2017-12-02 17:54:26 +00:00
|
|
|
// We need to be twice faster because with joystic we run...
|
|
|
|
joystick_sidemove *= cl_sidespeed->value * 2.0f;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
else if (strcmp(direction_type, "forwardmove") == 0)
|
|
|
|
{
|
|
|
|
joystick_forwardmove = axis_value * joy_forwardsensitivity->value;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
// We need to be twice faster because with joystic we run...
|
2017-12-02 17:54:26 +00:00
|
|
|
joystick_forwardmove *= cl_forwardspeed->value * 2.0f;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
else if (strcmp(direction_type, "yaw") == 0)
|
|
|
|
{
|
|
|
|
joystick_yaw = axis_value * joy_yawsensitivity->value;
|
|
|
|
joystick_yaw *= cl_yawspeed->value;
|
|
|
|
}
|
|
|
|
else if (strcmp(direction_type, "pitch") == 0)
|
|
|
|
{
|
|
|
|
joystick_pitch = axis_value * joy_pitchsensitivity->value;
|
|
|
|
joystick_pitch *= cl_pitchspeed->value;
|
|
|
|
}
|
|
|
|
else if (strcmp(direction_type, "updown") == 0)
|
|
|
|
{
|
|
|
|
joystick_up = axis_value * joy_upsensitivity->value;
|
|
|
|
joystick_up *= cl_upspeed->value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(direction_type, "triggerleft") == 0)
|
|
|
|
{
|
|
|
|
qboolean new_left_trigger = abs(axis_value) > (32767 / 4);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (new_left_trigger != left_trigger)
|
|
|
|
{
|
|
|
|
left_trigger = new_left_trigger;
|
|
|
|
Key_Event(K_TRIG_LEFT, left_trigger, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(direction_type, "triggerright") == 0)
|
|
|
|
{
|
|
|
|
qboolean new_right_trigger = abs(axis_value) > (32767 / 4);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (new_right_trigger != right_trigger)
|
|
|
|
{
|
|
|
|
right_trigger = new_right_trigger;
|
|
|
|
Key_Event(K_TRIG_RIGHT, right_trigger, true);
|
|
|
|
}
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Joystick can have more buttons than on general game controller
|
|
|
|
// so try to map not free buttons
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_JOYBUTTONUP:
|
|
|
|
case SDL_JOYBUTTONDOWN:
|
|
|
|
{
|
|
|
|
qboolean down = (event.type == SDL_JOYBUTTONDOWN);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
|
|
|
// Ignore back button, we don't need event for such button
|
2017-10-14 15:58:19 +00:00
|
|
|
if (back_button_id == event.jbutton.button)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
return;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
if (event.jbutton.button <= (K_JOY32 - K_JOY1))
|
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Key_Event(event.jbutton.button + K_JOY1, down, true);
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case SDL_JOYHATMOTION:
|
|
|
|
{
|
|
|
|
if (last_hat != event.jhat.value)
|
|
|
|
{
|
2018-02-03 08:20:58 +00:00
|
|
|
char diff = last_hat ^event.jhat.value;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
int i;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if (diff & (1 << i))
|
|
|
|
{
|
2018-07-16 13:36:06 +00:00
|
|
|
// check that we have button up for some bit
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (last_hat & (1 << i))
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Key_Event(i + K_HAT_UP, false, true);
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
/* check that we have button down for some bit */
|
|
|
|
if (event.jhat.value & (1 << i))
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Key_Event(i + K_HAT_UP, true, true);
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
last_hat = event.jhat.value;
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
break;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
2018-07-16 12:37:34 +00:00
|
|
|
|
2016-07-18 08:11:54 +00:00
|
|
|
case SDL_QUIT:
|
|
|
|
Com_Quit();
|
|
|
|
break;
|
2015-04-13 22:51:38 +00:00
|
|
|
}
|
2012-06-08 10:23:01 +00:00
|
|
|
}
|
|
|
|
|
2018-02-03 08:20:58 +00:00
|
|
|
/* Grab and ungrab the mouse if the console or the menu is opened */
|
|
|
|
if (in_grab->value == 3)
|
|
|
|
{
|
|
|
|
want_grab = windowed_mouse->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
want_grab = (vid_fullscreen->value || in_grab->value == 1 ||
|
2013-07-30 18:13:49 +00:00
|
|
|
(in_grab->value == 2 && windowed_mouse->value));
|
2018-02-03 08:20:58 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// calling GLimp_GrabInput() each frame is a bit ugly but simple and should work.
|
|
|
|
// The called SDL functions return after a cheap check, if there's nothing to do.
|
2015-03-27 17:56:16 +00:00
|
|
|
GLimp_GrabInput(want_grab);
|
2018-02-04 15:45:32 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// We need to save the frame time so other subsystems
|
|
|
|
// know the exact time of the last input events.
|
2018-02-04 15:45:32 +00:00
|
|
|
sys_frame_time = Sys_Milliseconds();
|
2014-01-05 17:09:26 +00:00
|
|
|
}
|
2017-04-22 08:29:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Removes all pending events from SDLs queue.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
In_FlushQueue(void)
|
|
|
|
{
|
|
|
|
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
|
|
|
Key_MarkAllUp();
|
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/*
|
|
|
|
* Move handling
|
|
|
|
*/
|
|
|
|
void
|
2015-01-16 15:58:46 +00:00
|
|
|
IN_Move(usercmd_t *cmd)
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
2018-07-16 13:36:06 +00:00
|
|
|
static int old_mouse_x;
|
|
|
|
static int old_mouse_y;
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
if (m_filter->value)
|
2012-06-08 10:23:01 +00:00
|
|
|
{
|
2014-01-05 17:09:26 +00:00
|
|
|
if ((mouse_x > 1) || (mouse_x < -1))
|
|
|
|
{
|
|
|
|
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((mouse_y > 1) || (mouse_y < -1))
|
|
|
|
{
|
|
|
|
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
|
|
|
}
|
2012-06-08 10:23:01 +00:00
|
|
|
}
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
old_mouse_x = mouse_x;
|
|
|
|
old_mouse_y = mouse_y;
|
|
|
|
|
|
|
|
if (mouse_x || mouse_y)
|
|
|
|
{
|
|
|
|
if (!exponential_speedup->value)
|
|
|
|
{
|
|
|
|
mouse_x *= sensitivity->value;
|
|
|
|
mouse_y *= sensitivity->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((mouse_x > MOUSE_MIN) || (mouse_y > MOUSE_MIN) ||
|
|
|
|
(mouse_x < -MOUSE_MIN) || (mouse_y < -MOUSE_MIN))
|
|
|
|
{
|
|
|
|
mouse_x = (mouse_x * mouse_x * mouse_x) / 4;
|
|
|
|
mouse_y = (mouse_y * mouse_y * mouse_y) / 4;
|
|
|
|
|
|
|
|
if (mouse_x > MOUSE_MAX)
|
|
|
|
{
|
|
|
|
mouse_x = MOUSE_MAX;
|
|
|
|
}
|
|
|
|
else if (mouse_x < -MOUSE_MAX)
|
|
|
|
{
|
|
|
|
mouse_x = -MOUSE_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mouse_y > MOUSE_MAX)
|
|
|
|
{
|
|
|
|
mouse_y = MOUSE_MAX;
|
|
|
|
}
|
|
|
|
else if (mouse_y < -MOUSE_MAX)
|
|
|
|
{
|
|
|
|
mouse_y = -MOUSE_MAX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// add mouse X/Y movement to cmd
|
2015-01-16 15:58:46 +00:00
|
|
|
if ((in_strafe.state & 1) || (lookstrafe->value && mlooking))
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
|
|
|
cmd->sidemove += m_side->value * mouse_x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-16 15:58:46 +00:00
|
|
|
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
2014-01-05 17:09:26 +00:00
|
|
|
}
|
|
|
|
|
2015-01-16 15:58:46 +00:00
|
|
|
if ((mlooking || freelook->value) && !(in_strafe.state & 1))
|
2014-01-05 17:09:26 +00:00
|
|
|
{
|
2015-01-16 15:58:46 +00:00
|
|
|
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
2014-01-05 17:09:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmd->forwardmove -= m_forward->value * mouse_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
mouse_x = mouse_y = 0;
|
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
// To make the the viewangles changes independent of framerate we need to scale
|
|
|
|
// with frametime (assuming the configured values are for 60hz)
|
|
|
|
//
|
|
|
|
// 1/32768 is to normalize the input values from SDL (they're between -32768 and
|
|
|
|
// 32768 and we want -1 to 1) for movement this is not needed, as those are
|
|
|
|
// absolute values independent of framerate
|
2017-12-02 17:54:26 +00:00
|
|
|
float joyViewFactor = (1.0f/32768.0f) * (cls.rframetime/0.01666f);
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (joystick_yaw)
|
|
|
|
{
|
2017-12-02 17:54:26 +00:00
|
|
|
cl.viewangles[YAW] -= (m_yaw->value * joystick_yaw) * joyViewFactor;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(joystick_pitch)
|
|
|
|
{
|
2017-12-02 17:54:26 +00:00
|
|
|
cl.viewangles[PITCH] += (m_pitch->value * joystick_pitch) * joyViewFactor;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (joystick_forwardmove)
|
|
|
|
{
|
|
|
|
cmd->forwardmove -= (m_forward->value * joystick_forwardmove) / 32768;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (joystick_sidemove)
|
|
|
|
{
|
|
|
|
cmd->sidemove += (m_side->value * joystick_sidemove) / 32768;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (joystick_up)
|
|
|
|
{
|
|
|
|
cmd->upmove -= (m_up->value * joystick_up) / 32768;
|
|
|
|
}
|
2010-10-19 07:29:20 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/* ------------------------------------------------------------------ */
|
2010-10-19 07:29:20 +00:00
|
|
|
|
2010-10-19 08:25:47 +00:00
|
|
|
/*
|
2013-11-10 08:46:28 +00:00
|
|
|
* Look down
|
2010-10-19 08:25:47 +00:00
|
|
|
*/
|
2010-10-19 07:29:20 +00:00
|
|
|
static void
|
2012-06-08 10:23:01 +00:00
|
|
|
IN_MLookDown(void)
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
|
|
|
mlooking = true;
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:25:47 +00:00
|
|
|
/*
|
2013-11-10 08:46:28 +00:00
|
|
|
* Look up
|
2010-10-19 08:25:47 +00:00
|
|
|
*/
|
2010-10-19 07:29:20 +00:00
|
|
|
static void
|
2012-06-08 10:23:01 +00:00
|
|
|
IN_MLookUp(void)
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
|
|
|
mlooking = false;
|
2015-01-16 15:58:46 +00:00
|
|
|
IN_CenterView();
|
2010-10-19 07:29:20 +00:00
|
|
|
}
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
/* ------------------------------------------------------------------ */
|
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
static void IN_Haptic_Shutdown(void);
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
/*
|
|
|
|
* Init haptic effects
|
|
|
|
*/
|
|
|
|
static int
|
2018-02-06 21:37:36 +00:00
|
|
|
IN_Haptic_Effect_Init(int effect_x, int effect_y, int effect_z, int period, int magnitude, int length, int attack, int fade)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Direction:
|
|
|
|
* North - 0
|
|
|
|
* East - 9000
|
|
|
|
* South - 18000
|
|
|
|
* West - 27000
|
|
|
|
*/
|
|
|
|
static SDL_HapticEffect haptic_effect;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_memset(&haptic_effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
haptic_effect.type = SDL_HAPTIC_SINE;
|
2018-02-06 21:37:36 +00:00
|
|
|
haptic_effect.periodic.direction.type = SDL_HAPTIC_CARTESIAN; // Cartesian/3d coordinates
|
|
|
|
haptic_effect.periodic.direction.dir[0] = effect_x;
|
|
|
|
haptic_effect.periodic.direction.dir[1] = effect_y;
|
|
|
|
haptic_effect.periodic.direction.dir[2] = effect_z;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
haptic_effect.periodic.period = period;
|
|
|
|
haptic_effect.periodic.magnitude = magnitude;
|
|
|
|
haptic_effect.periodic.length = length;
|
|
|
|
haptic_effect.periodic.attack_length = attack;
|
|
|
|
haptic_effect.periodic.fade_length = fade;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
|
|
|
int effect_id = SDL_HapticNewEffect(joystick_haptic, &haptic_effect);
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (effect_id < 0)
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
Com_Printf ("SDL_HapticNewEffect failed: %s\n", SDL_GetError());
|
|
|
|
Com_Printf ("Please try to rerun game. Effects will be disabled for now.\n");
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
IN_Haptic_Shutdown();
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
return effect_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2018-02-06 21:37:36 +00:00
|
|
|
IN_Haptic_Effects_To_Id(int haptic_effect, int effect_volume, int effect_x, int effect_y, int effect_z)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
if ((SDL_HapticQuery(joystick_haptic) & SDL_HAPTIC_SINE)==0)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
return -1;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2018-02-06 21:37:36 +00:00
|
|
|
int hapric_volume = joy_haptic_magnitude->value * effect_volume * 16; // * 128 = 32767 max strength;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (hapric_volume > 255)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
hapric_volume = 255;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
else if (hapric_volume < 0)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
hapric_volume = 0;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
switch(haptic_effect) {
|
|
|
|
case HAPTIC_EFFECT_MENY:
|
|
|
|
case HAPTIC_EFFECT_TRAPCOCK:
|
|
|
|
case HAPTIC_EFFECT_STEP:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 48,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_PAIN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 196,
|
|
|
|
300/* 0.3 seconds long */, 200/* Takes 0.2 second to get max strength */,
|
|
|
|
200/* Takes 0.2 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_BLASTER:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_HYPER_BLASTER:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_ETFRIFLE:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_TRACKER:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_MACHINEGUN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 800/* 800 ms*/, hapric_volume * 88,
|
|
|
|
600/* 0.6 seconds long */, 200/* Takes 0.2 second to get max strength */,
|
|
|
|
400/* Takes 0.4 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_SHOTGUN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 100,
|
|
|
|
500/* 0.5 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
200/* Takes 0.2 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_SHOTGUN2:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 96,
|
|
|
|
500/* 0.5 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_SSHOTGUN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 96,
|
|
|
|
500/* 0.5 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_RAILGUN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 64,
|
|
|
|
400/* 0.4 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_ROCKETGUN:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 700/* 700 ms*/, hapric_volume * 128,
|
|
|
|
400/* 0.4 seconds long */, 300/* Takes 0.3 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_GRENADE:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_BFG:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 800/* 800 ms*/, hapric_volume * 100,
|
|
|
|
600/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_PALANX:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
case HAPTIC_EFFECT_IONRIPPER:
|
2018-07-16 13:36:06 +00:00
|
|
|
return IN_Haptic_Effect_Init(effect_x, effect_y, effect_z, 500/* 500 ms*/, hapric_volume * 64,
|
|
|
|
200/* 0.2 seconds long */, 100/* Takes 0.1 second to get max strength */,
|
|
|
|
100/* Takes 0.1 second to fade away */);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
IN_Haptic_Effects_Info(void)
|
|
|
|
{
|
|
|
|
show_haptic = true;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Com_Printf ("Joystic/Mouse haptic:\n");
|
|
|
|
Com_Printf (" * %d effects\n", SDL_HapticNumEffects(joystick_haptic));
|
|
|
|
Com_Printf (" * %d effects in same time\n", SDL_HapticNumEffectsPlaying(joystick_haptic));
|
|
|
|
Com_Printf (" * %d haptic axis\n", SDL_HapticNumAxes(joystick_haptic));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
IN_Haptic_Effects_Init(void)
|
|
|
|
{
|
|
|
|
last_haptic_efffect_size = SDL_HapticNumEffectsPlaying(joystick_haptic);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (last_haptic_efffect_size > HAPTIC_EFFECT_LAST)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
last_haptic_efffect_size = HAPTIC_EFFECT_LAST;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
for (int i=0; i<HAPTIC_EFFECT_LAST; i++)
|
|
|
|
{
|
|
|
|
last_haptic_efffect[i].effect_type = HAPTIC_EFFECT_UNKNOWN;
|
|
|
|
last_haptic_efffect[i].effect_id = -1;
|
2018-02-06 21:37:36 +00:00
|
|
|
last_haptic_efffect[i].effect_volume = 0;
|
|
|
|
last_haptic_efffect[i].effect_x = 0;
|
|
|
|
last_haptic_efffect[i].effect_y = 0;
|
|
|
|
last_haptic_efffect[i].effect_z = 0;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Shuts the backend down
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
IN_Haptic_Effect_Shutdown(int * effect_id)
|
|
|
|
{
|
|
|
|
if (!effect_id)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
return;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (*effect_id >= 0)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_HapticDestroyEffect(joystick_haptic, *effect_id);
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
*effect_id = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-10-14 15:58:19 +00:00
|
|
|
IN_Haptic_Effects_Shutdown(void)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
for (int i=0; i<HAPTIC_EFFECT_LAST; i++)
|
|
|
|
{
|
|
|
|
last_haptic_efffect[i].effect_type = HAPTIC_EFFECT_UNKNOWN;
|
2018-02-06 21:37:36 +00:00
|
|
|
last_haptic_efffect[i].effect_volume = 0;
|
|
|
|
last_haptic_efffect[i].effect_x = 0;
|
|
|
|
last_haptic_efffect[i].effect_y = 0;
|
|
|
|
last_haptic_efffect[i].effect_z = 0;
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
IN_Haptic_Effect_Shutdown(&last_haptic_efffect[i].effect_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-06 21:37:36 +00:00
|
|
|
/*
|
|
|
|
* Haptic Feedback:
|
|
|
|
* effect_volume=0..16
|
|
|
|
* effect{x,y,z} - effect direction
|
|
|
|
* name - sound file name
|
|
|
|
*/
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
void
|
2018-02-06 21:37:36 +00:00
|
|
|
Haptic_Feedback(char *name, int effect_volume, int effect_x, int effect_y, int effect_z)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
int effect_type = HAPTIC_EFFECT_UNKNOWN;
|
|
|
|
|
|
|
|
if (joy_haptic_magnitude->value <= 0)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
return;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
2018-02-06 21:37:36 +00:00
|
|
|
if (effect_volume <= 0)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
2018-02-06 21:37:36 +00:00
|
|
|
return;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
2018-02-06 21:37:36 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (!joystick_haptic)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
return;
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
if (last_haptic_volume != (int)(joy_haptic_magnitude->value * 255))
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
IN_Haptic_Effects_Shutdown();
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
IN_Haptic_Effects_Init();
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
last_haptic_volume = joy_haptic_magnitude->value * 255;
|
|
|
|
|
|
|
|
if (strstr(name, "misc/menu"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_MENY;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/blastf1a"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_BLASTER;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/hyprbf1a"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_HYPER_BLASTER;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/machgf"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_MACHINEGUN;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/shotgf1b"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_SHOTGUN;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/sshotf1b"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_SSHOTGUN;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/railgf1a"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_RAILGUN;
|
|
|
|
}
|
2018-02-06 21:37:36 +00:00
|
|
|
else if (strstr(name, "weapons/rocklf1a") ||
|
|
|
|
strstr(name, "weapons/rocklx1a"))
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_ROCKETGUN;
|
|
|
|
}
|
2018-02-06 21:37:36 +00:00
|
|
|
else if (strstr(name, "weapons/grenlf1a") ||
|
|
|
|
strstr(name, "weapons/grenlx1a") ||
|
|
|
|
strstr(name, "weapons/hgrent1a"))
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_GRENADE;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/bfg__f1y"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_BFG;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/plasshot"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_PALANX;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/rippfire"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_IONRIPPER;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/nail1"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_ETFRIFLE;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/shotg2"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_SHOTGUN2;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/disint2"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_TRACKER;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "player/male/pain") ||
|
|
|
|
strstr(name, "player/female/pain") ||
|
|
|
|
strstr(name, "players/male/pain") ||
|
|
|
|
strstr(name, "players/female/pain"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_PAIN;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "player/step") ||
|
|
|
|
strstr(name, "player/land"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_STEP;
|
|
|
|
}
|
|
|
|
else if (strstr(name, "weapons/trapcock"))
|
|
|
|
{
|
|
|
|
effect_type = HAPTIC_EFFECT_TRAPCOCK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (effect_type != HAPTIC_EFFECT_UNKNOWN)
|
|
|
|
{
|
|
|
|
// check last effect for reuse
|
2018-02-06 21:37:36 +00:00
|
|
|
if (last_haptic_efffect[last_haptic_efffect_pos].effect_type != effect_type ||
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_volume != effect_volume ||
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_x != effect_x ||
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_y != effect_y ||
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_z != effect_z)
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
{
|
|
|
|
// FIFO for effects
|
|
|
|
last_haptic_efffect_pos = (last_haptic_efffect_pos+1) % last_haptic_efffect_size;
|
|
|
|
IN_Haptic_Effect_Shutdown(&last_haptic_efffect[last_haptic_efffect_pos].effect_id);
|
2018-02-06 21:37:36 +00:00
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_volume = effect_volume;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_type = effect_type;
|
2018-02-06 21:37:36 +00:00
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_x = effect_x;
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_y = effect_y;
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_z = effect_z;
|
|
|
|
last_haptic_efffect[last_haptic_efffect_pos].effect_id = IN_Haptic_Effects_To_Id(
|
|
|
|
effect_type, effect_volume, effect_x, effect_y, effect_z);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_HapticRunEffect(joystick_haptic, last_haptic_efffect[last_haptic_efffect_pos].effect_id, 1);
|
|
|
|
}
|
|
|
|
}
|
2014-01-05 17:09:26 +00:00
|
|
|
|
2014-01-05 19:22:34 +00:00
|
|
|
/*
|
|
|
|
* Initializes the backend
|
|
|
|
*/
|
|
|
|
void
|
2015-01-16 15:58:46 +00:00
|
|
|
IN_Init(void)
|
2014-01-05 19:22:34 +00:00
|
|
|
{
|
2015-01-16 15:58:46 +00:00
|
|
|
Com_Printf("------- input initialization -------\n");
|
|
|
|
|
2014-01-05 19:22:34 +00:00
|
|
|
mouse_x = mouse_y = 0;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
joystick_yaw = joystick_pitch = joystick_forwardmove = joystick_sidemove = 0;
|
|
|
|
|
2013-11-10 08:46:28 +00:00
|
|
|
exponential_speedup = Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE);
|
2013-05-01 21:24:44 +00:00
|
|
|
freelook = Cvar_Get("freelook", "1", 0);
|
2013-11-10 08:46:28 +00:00
|
|
|
in_grab = Cvar_Get("in_grab", "2", CVAR_ARCHIVE);
|
2013-05-01 21:24:44 +00:00
|
|
|
lookstrafe = Cvar_Get("lookstrafe", "0", 0);
|
2013-11-10 08:46:28 +00:00
|
|
|
m_filter = Cvar_Get("m_filter", "0", CVAR_ARCHIVE);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
m_up = Cvar_Get("m_up", "1", 0);
|
2013-05-01 21:24:44 +00:00
|
|
|
m_forward = Cvar_Get("m_forward", "1", 0);
|
2013-11-10 08:46:28 +00:00
|
|
|
m_pitch = Cvar_Get("m_pitch", "0.022", 0);
|
2013-05-01 21:24:44 +00:00
|
|
|
m_side = Cvar_Get("m_side", "0.8", 0);
|
2013-11-10 08:46:28 +00:00
|
|
|
m_yaw = Cvar_Get("m_yaw", "0.022", 0);
|
|
|
|
sensitivity = Cvar_Get("sensitivity", "3", 0);
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
joy_haptic_magnitude = Cvar_Get("joy_haptic_magnitude", "0.0", CVAR_ARCHIVE);
|
|
|
|
|
|
|
|
joy_yawsensitivity = Cvar_Get("joy_yawsensitivity", "1.0", CVAR_ARCHIVE);
|
|
|
|
joy_pitchsensitivity = Cvar_Get("joy_pitchsensitivity", "1.0", CVAR_ARCHIVE);
|
|
|
|
joy_forwardsensitivity = Cvar_Get("joy_forwardsensitivity", "1.0", CVAR_ARCHIVE);
|
|
|
|
joy_sidesensitivity = Cvar_Get("joy_sidesensitivity", "1.0", CVAR_ARCHIVE);
|
|
|
|
joy_upsensitivity = Cvar_Get("joy_upsensitivity", "1.0", CVAR_ARCHIVE);
|
|
|
|
|
|
|
|
joy_axis_leftx = Cvar_Get("joy_axis_leftx", "sidemove", CVAR_ARCHIVE);
|
|
|
|
joy_axis_lefty = Cvar_Get("joy_axis_lefty", "forwardmove", CVAR_ARCHIVE);
|
|
|
|
joy_axis_rightx = Cvar_Get("joy_axis_rightx", "yaw", CVAR_ARCHIVE);
|
|
|
|
joy_axis_righty = Cvar_Get("joy_axis_righty", "pitch", CVAR_ARCHIVE);
|
|
|
|
joy_axis_triggerleft = Cvar_Get("joy_axis_triggerleft", "triggerleft", CVAR_ARCHIVE);
|
|
|
|
joy_axis_triggerright = Cvar_Get("joy_axis_triggerright", "triggerright", CVAR_ARCHIVE);
|
|
|
|
|
|
|
|
joy_axis_leftx_threshold = Cvar_Get("joy_axis_leftx_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
joy_axis_lefty_threshold = Cvar_Get("joy_axis_lefty_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
joy_axis_rightx_threshold = Cvar_Get("joy_axis_rightx_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
joy_axis_righty_threshold = Cvar_Get("joy_axis_righty_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
joy_axis_triggerleft_threshold = Cvar_Get("joy_axis_triggerleft_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
joy_axis_triggerright_threshold = Cvar_Get("joy_axis_triggerright_threshold", "0.15", CVAR_ARCHIVE);
|
|
|
|
|
2013-11-10 08:46:28 +00:00
|
|
|
vid_fullscreen = Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
|
|
|
windowed_mouse = Cvar_Get("windowed_mouse", "1", CVAR_USERINFO | CVAR_ARCHIVE);
|
2010-10-19 07:29:20 +00:00
|
|
|
|
2013-05-01 21:24:44 +00:00
|
|
|
Cmd_AddCommand("+mlook", IN_MLookDown);
|
|
|
|
Cmd_AddCommand("-mlook", IN_MLookUp);
|
2010-10-19 07:29:20 +00:00
|
|
|
|
2015-01-17 07:34:58 +00:00
|
|
|
SDL_StartTextInput();
|
2015-01-16 15:58:46 +00:00
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
/* Joystick init */
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (!SDL_WasInit(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC))
|
|
|
|
{
|
|
|
|
if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == -1)
|
|
|
|
{
|
|
|
|
Com_Printf ("Couldn't init SDL joystick: %s.\n", SDL_GetError ());
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Com_Printf ("%i joysticks were found.\n", SDL_NumJoysticks());
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (SDL_NumJoysticks() > 0) {
|
2018-07-16 13:36:06 +00:00
|
|
|
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
joystick = SDL_JoystickOpen(i);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Com_Printf ("The name of the joystick is '%s'\n", SDL_JoystickName(joystick));
|
|
|
|
Com_Printf ("Number of Axes: %d\n", SDL_JoystickNumAxes(joystick));
|
|
|
|
Com_Printf ("Number of Buttons: %d\n", SDL_JoystickNumButtons(joystick));
|
|
|
|
Com_Printf ("Number of Balls: %d\n", SDL_JoystickNumBalls(joystick));
|
|
|
|
Com_Printf ("Number of Hats: %d\n", SDL_JoystickNumHats(joystick));
|
|
|
|
|
|
|
|
joystick_haptic = SDL_HapticOpenFromJoystick(joystick);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (joystick_haptic == NULL)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
|
|
|
Com_Printf("Most likely joystick isn't haptic\n");
|
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
else
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
IN_Haptic_Effects_Info();
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
if(SDL_IsGameController(i))
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
SDL_GameControllerButtonBind backBind;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
controller = SDL_GameControllerOpen(i);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Com_Printf ("Controller settings: %s\n", SDL_GameControllerMapping(controller));
|
|
|
|
Com_Printf ("Controller axis: \n");
|
|
|
|
Com_Printf (" * leftx = %s\n", joy_axis_leftx->string);
|
|
|
|
Com_Printf (" * lefty = %s\n", joy_axis_lefty->string);
|
|
|
|
Com_Printf (" * rightx = %s\n", joy_axis_rightx->string);
|
|
|
|
Com_Printf (" * righty = %s\n", joy_axis_righty->string);
|
|
|
|
Com_Printf (" * triggerleft = %s\n", joy_axis_triggerleft->string);
|
|
|
|
Com_Printf (" * triggerright = %s\n", joy_axis_triggerright->string);
|
|
|
|
|
|
|
|
Com_Printf ("Controller thresholds: \n");
|
|
|
|
Com_Printf (" * leftx = %f\n", joy_axis_leftx_threshold->value);
|
|
|
|
Com_Printf (" * lefty = %f\n", joy_axis_lefty_threshold->value);
|
|
|
|
Com_Printf (" * rightx = %f\n", joy_axis_rightx_threshold->value);
|
|
|
|
Com_Printf (" * righty = %f\n", joy_axis_righty_threshold->value);
|
|
|
|
Com_Printf (" * triggerleft = %f\n", joy_axis_triggerleft_threshold->value);
|
|
|
|
Com_Printf (" * triggerright = %f\n", joy_axis_triggerright_threshold->value);
|
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
backBind = SDL_GameControllerGetBindForButton(controller, SDL_CONTROLLER_BUTTON_BACK);
|
|
|
|
|
2018-07-16 13:36:06 +00:00
|
|
|
if (backBind.bindType == SDL_CONTROLLER_BINDTYPE_BUTTON)
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
back_button_id = backBind.value.button;
|
|
|
|
Com_Printf ("\nBack button JOY%d will be unbindable.\n", back_button_id+1);
|
|
|
|
}
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char joystick_guid[256] = {0};
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_JoystickGUID guid;
|
|
|
|
guid = SDL_JoystickGetDeviceGUID(i);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_JoystickGetGUIDString(guid, joystick_guid, 255);
|
2018-07-16 13:36:06 +00:00
|
|
|
|
2018-06-12 11:17:20 +00:00
|
|
|
Com_Printf ("To use joystick as game controller please set SDL_GAMECONTROLLERCONFIG:\n");
|
2017-10-14 15:58:19 +00:00
|
|
|
Com_Printf ("e.g.: SDL_GAMECONTROLLERCONFIG='%s,%s,leftx:a0,lefty:a1,rightx:a2,righty:a3,back:b1,...\n", joystick_guid, SDL_JoystickName(joystick));
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
joystick_haptic = SDL_HapticOpenFromMouse();
|
2018-07-16 13:36:06 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
if (joystick_haptic == NULL)
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
|
|
|
Com_Printf("Most likely mouse isn't haptic\n");
|
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
else
|
2018-07-16 13:36:06 +00:00
|
|
|
{
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
IN_Haptic_Effects_Info();
|
2018-07-16 13:36:06 +00:00
|
|
|
}
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-16 15:58:46 +00:00
|
|
|
Com_Printf("------------------------------------\n\n");
|
2010-10-19 07:29:20 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 08:25:47 +00:00
|
|
|
/*
|
|
|
|
* Shuts the backend down
|
|
|
|
*/
|
2017-10-14 15:58:19 +00:00
|
|
|
static void
|
|
|
|
IN_Haptic_Shutdown(void)
|
|
|
|
{
|
|
|
|
if (joystick_haptic)
|
|
|
|
{
|
|
|
|
IN_Haptic_Effects_Shutdown();
|
|
|
|
|
|
|
|
SDL_HapticClose(joystick_haptic);
|
|
|
|
joystick_haptic = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-19 07:29:20 +00:00
|
|
|
void
|
2015-01-16 15:58:46 +00:00
|
|
|
IN_Shutdown(void)
|
2010-10-19 07:29:20 +00:00
|
|
|
{
|
2013-11-10 08:46:28 +00:00
|
|
|
Cmd_RemoveCommand("force_centerview");
|
2013-05-01 21:24:44 +00:00
|
|
|
Cmd_RemoveCommand("+mlook");
|
|
|
|
Cmd_RemoveCommand("-mlook");
|
2013-11-10 08:46:28 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
Com_Printf("Shutting down input.\n");
|
|
|
|
|
2017-10-14 15:58:19 +00:00
|
|
|
IN_Haptic_Shutdown();
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
|
|
|
|
if (controller)
|
|
|
|
{
|
2017-10-14 15:58:19 +00:00
|
|
|
back_button_id = -1;
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
SDL_GameControllerClose(controller);
|
|
|
|
controller = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (joystick)
|
|
|
|
{
|
|
|
|
SDL_JoystickClose(joystick);
|
|
|
|
joystick = NULL;
|
|
|
|
}
|
2010-10-19 07:29:20 +00:00
|
|
|
}
|
|
|
|
|
2014-01-05 17:09:26 +00:00
|
|
|
/* ------------------------------------------------------------------ */
|