JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.01k stars 616 forks source link

Analog sensitive not working #335

Open Pollito001 opened 11 years ago

Pollito001 commented 11 years ago

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

ensiform commented 11 years ago

Presumably because there's not joystick code for vehicles?

Pollito001 commented 11 years ago

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

eezstreet commented 11 years ago

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

ensiform commented 11 years ago

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

eezstreet commented 11 years ago

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.

ensiform commented 11 years ago

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.

eezstreet commented 11 years ago

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:notifications@github.com Sent: ‎8/‎3/‎2013 3:08 PM To: Razish/OpenJKmailto:OpenJK@noreply.github.com Cc: eezstreetmailto:eezstreet@live.com 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

Pollito001 commented 8 years ago

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

ensiform commented 8 years ago

@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

Razish commented 8 years ago

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

ensiform commented 8 years ago

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

Pollito001 commented 8 years ago

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

ensiform commented 8 years ago

I'm not going to use that code.

Pollito001 commented 8 years ago

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

ensiform commented 8 years ago

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.

Akselbert commented 2 years ago

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.