Fix splitscreen joystick

This commit is contained in:
TehRealSalt 2018-07-03 15:32:26 -04:00
parent 45ea6cad0a
commit ec6f6cfa70
3 changed files with 15 additions and 14 deletions

View File

@ -1161,7 +1161,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
INT32 laim, th, tspeed, forward, side, axis; //i
const INT32 speed = 1;
// these ones used for multiple conditions
boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, analogjoystickmove, gamepadjoystickmove, kbl, rd;
boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, usejoystick, analogjoystickmove, gamepadjoystickmove, kbl, rd;
player_t *player;
camera_t *thiscam;
angle_t lang;
@ -1258,6 +1258,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
break;
}
usejoystick = (analogjoystickmove || gamepadjoystickmove);
turnright = InputDown(gc_turnright, ssplayer);
turnleft = InputDown(gc_turnleft, ssplayer);
@ -1334,14 +1335,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
{
if (InputDown(gc_accelerate, ssplayer) || (cv_usejoystick.value && axis > 0))
if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_ACCELERATE;
if (InputDown(gc_brake, ssplayer) || (cv_usejoystick.value && axis > 0))
if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_BRAKE;
axis = JoyAxis(AXISAIM, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
forward += forwardmove[1];
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
forward -= forwardmove[1];
}
else
@ -1377,20 +1378,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// But forward/backward IS used for aiming.
axis = JoyAxis(AXISAIM, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (cv_usejoystick.value && axis < 0))
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
cmd->buttons |= BT_FORWARD;
if (InputDown(gc_aimbackward, ssplayer) || (cv_usejoystick.value && axis > 0))
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_BACKWARD;
}
// fire with any button/key
axis = JoyAxis(AXISFIRE, ssplayer);
if (InputDown(gc_fire, ssplayer) || (cv_usejoystick.value && axis > 0))
if (InputDown(gc_fire, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_ATTACK;
// drift with any button/key
axis = JoyAxis(AXISDRIFT, ssplayer);
if (InputDown(gc_drift, ssplayer) || (cv_usejoystick.value && axis > 0))
if (InputDown(gc_drift, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_DRIFT;
// Lua scriptable buttons

View File

@ -50,7 +50,7 @@ struct JoyType_s
};
typedef struct JoyType_s JoyType_t;
/** \brief Joystick info
for palyer 1 and 2's joystick/gamepad
for palyer[sic] 1-4's joystick/gamepad
*/
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;

View File

@ -1347,7 +1347,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 70},
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 80},
{IT_STRING|IT_CVAR, NULL, "Powerup warning", &cv_kartinvinsfx, 100},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 100},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 120},
};
@ -1450,10 +1450,10 @@ static menuitem_t OP_ServerOptionsMenu[] =
#ifndef NONET
{IT_STRING | IT_CVAR, NULL, "Max Player Count", &cv_maxplayers, 80},
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", &cv_allownewplayer, 90},
{IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 100},
//{IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 100},
{IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 120},
{IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 130},
{IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 100},
{IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 110},
#endif
};