Merge branch 'axis-brake-broken' into 'master'

Fix gamepad axis brake behaviour

See merge request KartKrew/Kart-Public!324
This commit is contained in:
Sal 2022-12-15 23:01:22 +00:00
commit 80abf38648

View file

@ -1503,22 +1503,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
{
cmd->buttons |= BT_ACCELERATE;
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
forward += ((axis * forwardmove[1]) >> 10)*2;
forward += ((axis * forwardmove[1]) / (JOYAXISRANGE-1));
}
axis = JoyAxis(AXISBRAKE, ssplayer);
if (InputDown(gc_brake, ssplayer) || (gamepadjoystickmove && axis > 0))
{
cmd->buttons |= BT_BRAKE;
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
}
else if (analogjoystickmove && axis > 0)
{
cmd->buttons |= BT_BRAKE;
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
forward -= ((axis * forwardmove[0]) >> 10);
forward -= ((axis * forwardmove[0]) / (JOYAXISRANGE-1));
}
// But forward/backward IS used for aiming.