OpenJK icon indicating copy to clipboard operation
OpenJK copied to clipboard

Analog sensitive not working

Open Pollito001 opened this issue 12 years ago • 16 comments

Thanks to fix joystick crash now a have another issue i can move with analog joystick but not sencitive ,when i use Speeder Bike i cant turn left or right with joystick just mouse

Pollito001 avatar Jul 28 '13 00:07 Pollito001

Presumably because there's not joystick code for vehicles?

ensiform avatar Jul 28 '13 01:07 ensiform

Analog sensitive not work when i move joystick character run like keyboard does

Pollito001 avatar Jul 28 '13 05:07 Pollito001

Yeah, this isn't exactly done yet but it's easy enough to fix.

eezstreet avatar Aug 03 '13 09:08 eezstreet

Err rewriting the entire xinput code plus the cl_input code is an easy enough fix eh?

ensiform avatar Aug 03 '13 15:08 ensiform

Change the input to use usercmd->rightmove and usercmd->forwardmove properly = no problem. The game handles the rest like it’s supposed to.

Sent from Windows Mail

From: Ensiform Sent: ‎August‎ ‎3‎, ‎2013 ‎8‎:‎23‎ ‎AM To: Razish/OpenJK CC: eezstreet Subject: Re: [OpenJK] Analog sensitive not working (#335)

Err rewriting the entire xinput code plus the cl_input code is an easy enough fix eh?

— Reply to this email directly or view it on GitHub.

eezstreet avatar Aug 03 '13 17:08 eezstreet

Yea okay whatever you say.

Button handling all wrong. X360 controllers have 6 axes 4 for sticks 2 for triggers.

CL_JoystickMove WRONG for all OS'. win_input xinput code is all kinds of terrible and you cant even bind jump to A button to actually hold it.

ensiform avatar Aug 03 '13 19:08 ensiform

Please just read what I wrote, instead of shooting it down instantly. I'm not referring to that. Anyway, triggers are just mapped like buttons for the moment.

Sent from my Windows Phone


From: Ensiformmailto:[email protected] Sent: ‎8/‎3/‎2013 3:08 PM To: Razish/OpenJKmailto:[email protected] Cc: eezstreetmailto:[email protected] Subject: Re: [OpenJK] Analog sensitive not working (#335)

Yea okay whatever you say.

Button handling all wrong. X360 controllers have 6 axes 4 for sticks 2 for triggers.

CL_JoystickMove WRONG for all OS'. win_input xinput code is all kinds of terrible and you cant even bind jump to A button to actually hold it.


Reply to this email directly or view it on GitHub: https://github.com/Razish/OpenJK/issues/335#issuecomment-22059869

eezstreet avatar Aug 03 '13 20:08 eezstreet

Theres a project named xlava that already have analog support for jedy academy but only single player mode: https://github.com/xLAva/JediAcademyLinux

Pollito001 avatar Jun 15 '16 17:06 Pollito001

@Pollito001

Theres a project named xlava that already have analog support for jedy academy but only single player mode: https://github.com/xLAva/JediAcademyLinux

Or use in_joystickUseAnalog 1

ensiform avatar Jun 15 '16 19:06 ensiform

Or use in_joystickUseAnalog 1

Have you tried this? I have not gotten it to work with Afterglow PS3 Dualshock controller on Windows or Linux. The same controller works with analogue input in other games like Borderlands

Razish avatar Jun 16 '16 05:06 Razish

Well it works more or less in ioquake3 with the x360 controller when I tested it a long time ago. :suspect:

ensiform avatar Jun 16 '16 16:06 ensiform

When i use command in_joystickUseAnalog 1 the game turn axis into regular buttons, analog sticks move the character but fast like W,A,S,D does,maybe with xlava's code you can repair that issue

Pollito001 avatar Jun 19 '16 20:06 Pollito001

I'm not going to use that code.

ensiform avatar Jun 19 '16 21:06 ensiform

Ok, thank you anyway, But consider fix that issue because is imposible tu play without sensitive especially in First Person Mode :)

Pollito001 avatar Jun 19 '16 22:06 Pollito001

Well you didn't direct to the code specifically and there's not a good universal gamepad support for the in game and menus. The menus support would probably be the worst.

ensiform avatar Jun 19 '16 23:06 ensiform

Hey, I fixed this issue, but I don't know how to push a patch request. Anyway here's the fix: You need to manually set in_joystickUseAnalog to 1 because the switch in the settings dialog does not work. Then the game will accurately get joystick readings. The problem is that joystick readings come as 16-bit int while the game internally uses an 8-bit signed char for movement speed, and the joystick readings are not translated correctly. What happens is that if the reading is higher than 127 or lower than -127 it will be mapped to the highest/lowest value, but since joystick readings go from 0 to about 32000 these are essentially always mapped to either 0 (if the joystick is not moved) or to the max/min 127/ -127. In practice this appears as the same as if the readings are directly mapped to pressing buttons.

The fix is simple: In the file code/client/cl_input.cpp change cmd->rightmove = ClampChar( cmd->rightmove + cl.joystickAxis[AXIS_SIDE] ); into cmd->rightmove = ClampChar( cmd->rightmove + (cl.joystickAxis[AXIS_SIDE] >> 8)); and likewise change cmd->forwardmove = ClampChar( cmd->forwardmove + cl.joystickAxis[AXIS_FORWARD]); into cmd->forwardmove = ClampChar( cmd->forwardmove + (cl.joystickAxis[AXIS_FORWARD] >> 8)); The right shift with 8 simply divides the input with 2^8, as needed.

Akselbert avatar Dec 09 '21 10:12 Akselbert