mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-16 17:51:27 +00:00
Better gamepad axis support
This commit is contained in:
parent
8cb73c8d25
commit
517fcd4366
5 changed files with 174 additions and 168 deletions
|
@ -794,10 +794,6 @@ void D_RegisterClientCommands(void)
|
|||
//CV_RegisterVar(&cv_alwaysfreelook2);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_sideaxis);
|
||||
CV_RegisterVar(&cv_sideaxis2);
|
||||
CV_RegisterVar(&cv_sideaxis3);
|
||||
CV_RegisterVar(&cv_sideaxis4);
|
||||
CV_RegisterVar(&cv_turnaxis);
|
||||
CV_RegisterVar(&cv_turnaxis2);
|
||||
CV_RegisterVar(&cv_turnaxis3);
|
||||
|
@ -806,6 +802,14 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_moveaxis2);
|
||||
CV_RegisterVar(&cv_moveaxis3);
|
||||
CV_RegisterVar(&cv_moveaxis4);
|
||||
CV_RegisterVar(&cv_brakeaxis);
|
||||
CV_RegisterVar(&cv_brakeaxis2);
|
||||
CV_RegisterVar(&cv_brakeaxis3);
|
||||
CV_RegisterVar(&cv_brakeaxis4);
|
||||
CV_RegisterVar(&cv_aimaxis);
|
||||
CV_RegisterVar(&cv_aimaxis2);
|
||||
CV_RegisterVar(&cv_aimaxis3);
|
||||
CV_RegisterVar(&cv_aimaxis4);
|
||||
CV_RegisterVar(&cv_lookaxis);
|
||||
CV_RegisterVar(&cv_lookaxis2);
|
||||
CV_RegisterVar(&cv_lookaxis3);
|
||||
|
@ -814,10 +818,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis3);
|
||||
CV_RegisterVar(&cv_fireaxis4);
|
||||
CV_RegisterVar(&cv_firenaxis);
|
||||
CV_RegisterVar(&cv_firenaxis2);
|
||||
CV_RegisterVar(&cv_firenaxis3);
|
||||
CV_RegisterVar(&cv_firenaxis4);
|
||||
CV_RegisterVar(&cv_driftaxis);
|
||||
CV_RegisterVar(&cv_driftaxis2);
|
||||
CV_RegisterVar(&cv_driftaxis3);
|
||||
CV_RegisterVar(&cv_driftaxis4);
|
||||
|
||||
// WARNING: the order is important when initialising mouse2
|
||||
// we need the mouse2port
|
||||
|
|
236
src/g_game.c
236
src/g_game.c
|
@ -416,81 +416,37 @@ consvar_t cv_useranalog3 = {"useranalog3", "Off", CV_SAVE|CV_CALL, CV_OnOff, Use
|
|||
consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
#if defined (_WII) || defined (WMINPUT)
|
||||
consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sideaxis = {"joyaxis_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis = {"joyaxis_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis = {"joyaxis_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_turnaxis = {"joyaxis_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#ifdef PSP
|
||||
consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
#ifdef _arch_dreamcast
|
||||
consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#elif defined (_XBOX)
|
||||
consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#elif defined (PSP)
|
||||
consvar_t cv_sideaxis = {"joyaxis_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_sideaxis = {"joyaxis_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
#ifndef _XBOX
|
||||
#ifdef PSP
|
||||
consvar_t cv_lookaxis = {"joyaxis_look", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_brakeaxis = {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis = {"joyaxis_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
#endif
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis = {"joyaxis_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis = {"joyaxis_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined (_WII) || defined (WMINPUT)
|
||||
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis2 = {"joyaxis2_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sideaxis2 = {"joyaxis2_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#ifdef _arch_dreamcast
|
||||
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#elif defined (_XBOX)
|
||||
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#elif defined (_PSP)
|
||||
consvar_t cv_sideaxis2 = {"joyaxis2_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_sideaxis2 = {"joyaxis2_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
#ifndef _XBOX
|
||||
consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis2 = {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis2 = {"joyaxis2_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_turnaxis3 = {"joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis3 = {"joyaxis3_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sideaxis3 = {"joyaxis3_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis3 = {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis3 = {"joyaxis3_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis3 = {"joyaxis3_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis3 = {"joyaxis3_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis3 = {"joyaxis3_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_turnaxis4 = {"joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis4 = {"joyaxis4_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_sideaxis4 = {"joyaxis4_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis4 = {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis4 = {"joyaxis4_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis4 = {"joyaxis4_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis4 = {"joyaxis4_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis4 = {"joyaxis4_drift", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
||||
#if MAXPLAYERS > 16
|
||||
|
@ -843,17 +799,20 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
|||
case AXISMOVE:
|
||||
axisval = cv_moveaxis.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis.value;
|
||||
break;
|
||||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis.value;
|
||||
break;
|
||||
case AXISFIRENORMAL:
|
||||
axisval = cv_firenaxis.value;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -920,17 +879,20 @@ static INT32 Joy2Axis(axis_input_e axissel)
|
|||
case AXISMOVE:
|
||||
axisval = cv_moveaxis2.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis2.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis2.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis2.value;
|
||||
break;
|
||||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis2.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis2.value;
|
||||
break;
|
||||
case AXISFIRENORMAL:
|
||||
axisval = cv_firenaxis2.value;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis2.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -992,26 +954,29 @@ static INT32 Joy3Axis(axis_input_e axissel)
|
|||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis3.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis3.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis3.value;
|
||||
break;
|
||||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis3.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis3.value;
|
||||
break;
|
||||
case AXISFIRENORMAL:
|
||||
axisval = cv_firenaxis3.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis3.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis3.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis3.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis3.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis3.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis3.value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis3.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1070,26 +1035,29 @@ static INT32 Joy4Axis(axis_input_e axissel)
|
|||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis4.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis4.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis4.value;
|
||||
break;
|
||||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis4.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis4.value;
|
||||
break;
|
||||
case AXISFIRENORMAL:
|
||||
axisval = cv_firenaxis4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis4.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis4.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis4.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis4.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis4.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis4.value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1365,11 +1333,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||
{
|
||||
if (InputDown(gc_accelerate, ssplayer))
|
||||
if (InputDown(gc_accelerate, ssplayer) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
if (InputDown(gc_brake, ssplayer))
|
||||
if (InputDown(gc_brake, ssplayer) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
axis = JoyAxis(AXISAIM, ssplayer);
|
||||
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
|
||||
forward += forwardmove[1];
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
|
||||
|
@ -1378,24 +1346,39 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
else
|
||||
{
|
||||
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
|
||||
if (InputDown(gc_accelerate, ssplayer) || player->kartstuff[k_mushroomtimer])
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_mushroomtimer])
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
forward = forwardmove[1]; // 50
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
forward += ((axis * forwardmove[1]) >> 10)*2;
|
||||
}
|
||||
|
||||
if (InputDown(gc_brake, ssplayer))
|
||||
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
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// But forward/backward IS used for aiming.
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
|
||||
axis = JoyAxis(AXISAIM, ssplayer);
|
||||
if (InputDown(gc_aimforward, ssplayer) || (cv_usejoystick.value && axis < 0))
|
||||
cmd->buttons |= BT_FORWARD;
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_BACKWARD;
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1388,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// drift button
|
||||
if (InputDown(gc_drift, ssplayer))
|
||||
axis = JoyAxis(AXISDRIFT, ssplayer);
|
||||
if (InputDown(gc_drift, ssplayer) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
// Lua scriptable buttons
|
||||
|
@ -1503,12 +1487,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
else
|
||||
{
|
||||
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
if (mirrormode)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove - side);
|
||||
else
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
if (mirrormode)
|
||||
cmd->sidemove = -cmd->sidemove;
|
||||
|
||||
if (ssplayer == 2 && player->bot == 1) {
|
||||
if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons))
|
||||
{
|
||||
|
|
13
src/g_game.h
13
src/g_game.h
|
@ -56,10 +56,10 @@ extern INT16 rw_maximums[NUM_WEAPONS];
|
|||
// used in game menu
|
||||
extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_sideaxis3,cv_turnaxis3,cv_moveaxis3,cv_lookaxis3,cv_fireaxis3,cv_firenaxis3;
|
||||
extern consvar_t cv_sideaxis4,cv_turnaxis4,cv_moveaxis4,cv_lookaxis4,cv_fireaxis4,cv_firenaxis4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4;
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
typedef enum
|
||||
|
@ -67,11 +67,12 @@ typedef enum
|
|||
AXISNONE = 0,
|
||||
AXISTURN,
|
||||
AXISMOVE,
|
||||
AXISBRAKE,
|
||||
AXISAIM,
|
||||
AXISLOOK,
|
||||
AXISSTRAFE,
|
||||
AXISDEAD, //Axises that don't want deadzones
|
||||
AXISFIRE,
|
||||
AXISFIRENORMAL,
|
||||
AXISDRIFT,
|
||||
} axis_input_e;
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
|
|
|
@ -1282,6 +1282,16 @@ void G_Controldefault(void)
|
|||
gamecontrol[gc_fire ][0] = KEY_SPACE;
|
||||
gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
|
||||
|
||||
gamecontrol[gc_aimforward ][1] = KEY_HAT1+0;
|
||||
gamecontrol[gc_aimbackward][1] = KEY_HAT1+1;
|
||||
gamecontrol[gc_turnleft ][1] = KEY_HAT1+2;
|
||||
gamecontrol[gc_turnright ][1] = KEY_HAT1+3;
|
||||
gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[gc_drift ][1] = KEY_JOY1+1; // X
|
||||
gamecontrol[gc_brake ][1] = KEY_JOY1+2; // B
|
||||
gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB
|
||||
gamecontrol[gc_lookback ][1] = KEY_JOY1+5; // RB
|
||||
|
||||
// Extra controls
|
||||
gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
|
||||
gamecontrol[gc_pause ][0] = KEY_PAUSE;
|
||||
|
@ -1291,6 +1301,9 @@ void G_Controldefault(void)
|
|||
gamecontrol[gc_scores ][0] = KEY_TAB;
|
||||
gamecontrol[gc_spectate ][0] = '\'';
|
||||
|
||||
gamecontrol[gc_scores ][1] = KEY_JOY1+6; // Back
|
||||
gamecontrol[gc_spectate ][1] = KEY_JOY1+7; // Start (This is sort of like MP's pause...?)
|
||||
|
||||
// Spectator controls
|
||||
gamecontrol[gc_lookup ][0] = KEY_PGUP;
|
||||
gamecontrol[gc_lookdown ][0] = KEY_PGDN;
|
||||
|
|
60
src/m_menu.c
60
src/m_menu.c
|
@ -1194,47 +1194,51 @@ static menuitem_t OP_MiscControlsMenu[] =
|
|||
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis , 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis2 , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90},
|
||||
};
|
||||
|
||||
#ifndef NOFOURPLAYER
|
||||
static menuitem_t OP_Joystick3Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup3PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis3 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis3 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis3 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis3 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis3 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis3 , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup3PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis3 , 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick4Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup4PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis4 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis4 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis4 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis4 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis4 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis4 , 80},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick..." , M_Setup4PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue