Norbert wrote:It has become almost impossible to make a running jump using a gamepad.
I can't promise I'll be able to help, but I'll take a look at the source code.
Okay, here are my findings.
1. First of all, given how the joystick code currently works, I was wrong about the (-)30000 values.
Those need to be (-)8000 values or it's impossible to combine directions, such as left+up.
2. This adds D-pad support:
Code: Select all
Add to data.h:
----------
extern int dpad_states[2] INIT( = { 0, 0 } );
Change in read_joyst_control() of seg000.c:
----------
if ((joy_states[0] == -1) || (dpad_states[0] == -1))
if ((joy_states[0] == 1) || (dpad_states[0] == 1))
if ((joy_states[1] == -1) || (dpad_states[1] == -1))
if ((joy_states[1] == 1) || (dpad_states[1] == 1))
Add to seg009.c:
----------
case SDL_JOYHATMOTION:
switch (event.jhat.value)
{
// [0] = hor | [1] = ver
case 1: dpad_states[0] = 0; dpad_states[1] = -1; break; // up
case 2: dpad_states[0] = 1; dpad_states[1] = 0; break; // right
case 3: dpad_states[0] = 1; dpad_states[1] = -1; break; // right + up
case 4: dpad_states[0] = 0; dpad_states[1] = 1; break; // down
case 6: dpad_states[0] = 1; dpad_states[1] = 1; break; // right + down
case 8: dpad_states[0] = -1; dpad_states[1] = 0; break; // left
case 9: dpad_states[0] = -1; dpad_states[1] = -1; break; // left + up
case 12: dpad_states[0] = -1; dpad_states[1] = 1; break; // left + down
default: dpad_states[0] = 0; dpad_states[1] = 0; break;
}
break;
3. In my opinion, currently, neither the joystick nor the D-pad work properly. The problem is that on the one hand it often doesn't react to certain input when you want it to, while on the other hand it often reacts to certain input when you don't want it to. It's all over the place. For example, when I printf the event.jhat.value and only press to the lower right on the D-pad I should see 6 constantly but many, many 4's show up. The joystick is even worse.
My suggestion is to use both the D-pad and the joystick for movement left and right, and use buttons to jump and crouch.
Of course this might make using 'Shift' with jump/crouch trickier, but with X as Shift and A/Y for jump/crouch, I think this should work.
(Also, moving to the Game Controller API would be a good idea. See
this section in the migration guide.)