From ec6f6cfa701d00c9f38711dc362856112a420786 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 3 Jul 2018 15:32:26 -0400 Subject: [PATCH] Fix splitscreen joystick --- src/g_game.c | 19 ++++++++++--------- src/i_joy.h | 2 +- src/m_menu.c | 8 ++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 663a8d46..f4adcf49 100644 --- a/src/g_game.c +++ b/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 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 diff --git a/src/i_joy.h b/src/i_joy.h index 316011fc..00302eb0 100644 --- a/src/i_joy.h +++ b/src/i_joy.h @@ -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; diff --git a/src/m_menu.c b/src/m_menu.c index ca496366..f61fa292 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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 };