mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 01:01:43 +00:00
Fix splitscreen joystick
This commit is contained in:
parent
45ea6cad0a
commit
ec6f6cfa70
3 changed files with 15 additions and 14 deletions
19
src/g_game.c
19
src/g_game.c
|
@ -1161,7 +1161,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
INT32 laim, th, tspeed, forward, side, axis; //i
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// 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;
|
player_t *player;
|
||||||
camera_t *thiscam;
|
camera_t *thiscam;
|
||||||
angle_t lang;
|
angle_t lang;
|
||||||
|
@ -1258,6 +1258,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usejoystick = (analogjoystickmove || gamepadjoystickmove);
|
||||||
turnright = InputDown(gc_turnright, ssplayer);
|
turnright = InputDown(gc_turnright, ssplayer);
|
||||||
turnleft = InputDown(gc_turnleft, 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 (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;
|
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;
|
cmd->buttons |= BT_BRAKE;
|
||||||
axis = JoyAxis(AXISAIM, ssplayer);
|
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];
|
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];
|
forward -= forwardmove[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1377,20 +1378,20 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
|
|
||||||
// But forward/backward IS used for aiming.
|
// But forward/backward IS used for aiming.
|
||||||
axis = JoyAxis(AXISAIM, ssplayer);
|
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;
|
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;
|
cmd->buttons |= BT_BACKWARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fire with any button/key
|
// fire with any button/key
|
||||||
axis = JoyAxis(AXISFIRE, ssplayer);
|
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;
|
cmd->buttons |= BT_ATTACK;
|
||||||
|
|
||||||
// drift with any button/key
|
// drift with any button/key
|
||||||
axis = JoyAxis(AXISDRIFT, ssplayer);
|
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;
|
cmd->buttons |= BT_DRIFT;
|
||||||
|
|
||||||
// Lua scriptable buttons
|
// Lua scriptable buttons
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct JoyType_s
|
||||||
};
|
};
|
||||||
typedef struct JoyType_s JoyType_t;
|
typedef struct JoyType_s JoyType_t;
|
||||||
/** \brief Joystick info
|
/** \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;
|
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
|
||||||
|
|
|
@ -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, "Reverse L/R Channels", &stereoreverse, 70},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 80},
|
{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},
|
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 120},
|
||||||
};
|
};
|
||||||
|
@ -1450,10 +1450,10 @@ static menuitem_t OP_ServerOptionsMenu[] =
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
{IT_STRING | IT_CVAR, NULL, "Max Player Count", &cv_maxplayers, 80},
|
{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, "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, "Allow WAD Downloading", &cv_downloading, 100},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 130},
|
{IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 110},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue