mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-21 02:10:39 +00:00
Display "joystick used" prompt correctly if setting use_joystick from an old value > I_NumJoys()
This commit is contained in:
parent
e548f6f139
commit
b2c02838c4
1 changed files with 24 additions and 7 deletions
31
src/m_menu.c
31
src/m_menu.c
|
@ -6751,7 +6751,7 @@ static void M_ScreenshotOptions(INT32 choice)
|
||||||
|
|
||||||
static void M_DrawJoystick(void)
|
static void M_DrawJoystick(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i, compareval2, compareval;
|
||||||
|
|
||||||
M_DrawGenericMenu();
|
M_DrawGenericMenu();
|
||||||
|
|
||||||
|
@ -6760,8 +6760,23 @@ static void M_DrawJoystick(void)
|
||||||
M_DrawTextBox(OP_JoystickSetDef.x-8, OP_JoystickSetDef.y+LINEHEIGHT*i-12, 28, 1);
|
M_DrawTextBox(OP_JoystickSetDef.x-8, OP_JoystickSetDef.y+LINEHEIGHT*i-12, 28, 1);
|
||||||
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
|
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
|
||||||
|
|
||||||
if ((setupcontrols_secondaryplayer && (i == cv_usejoystick2.value))
|
#ifdef JOYSTICK_HOTPLUG
|
||||||
|| (!setupcontrols_secondaryplayer && (i == cv_usejoystick.value)))
|
if (atoi(cv_usejoystick2.string) > I_NumJoys())
|
||||||
|
compareval2 = atoi(cv_usejoystick2.string);
|
||||||
|
else
|
||||||
|
compareval2 = cv_usejoystick2.value;
|
||||||
|
|
||||||
|
if (atoi(cv_usejoystick.string) > I_NumJoys())
|
||||||
|
compareval = atoi(cv_usejoystick.string);
|
||||||
|
else
|
||||||
|
compareval = cv_usejoystick.value;
|
||||||
|
#else
|
||||||
|
compareval2 = cv_usejoystick2.value;
|
||||||
|
compareval = cv_usejoystick.value
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((setupcontrols_secondaryplayer && (i == compareval2))
|
||||||
|
|| (!setupcontrols_secondaryplayer && (i == compareval)))
|
||||||
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,V_GREENMAP,joystickInfo[i]);
|
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,V_GREENMAP,joystickInfo[i]);
|
||||||
else
|
else
|
||||||
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,0,joystickInfo[i]);
|
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,0,joystickInfo[i]);
|
||||||
|
@ -6836,7 +6851,7 @@ static void M_AssignJoystick(INT32 choice)
|
||||||
|
|
||||||
if (setupcontrols_secondaryplayer)
|
if (setupcontrols_secondaryplayer)
|
||||||
{
|
{
|
||||||
oldchoice = cv_usejoystick2.value;
|
oldchoice = atoi(cv_usejoystick2.string) > I_NumJoys() ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value;
|
||||||
CV_SetValue(&cv_usejoystick2, choice);
|
CV_SetValue(&cv_usejoystick2, choice);
|
||||||
|
|
||||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||||
|
@ -6848,7 +6863,8 @@ static void M_AssignJoystick(INT32 choice)
|
||||||
if (choice && oldchoice > I_NumJoys()) // if we did not select "None", we likely selected a used device
|
if (choice && oldchoice > I_NumJoys()) // if we did not select "None", we likely selected a used device
|
||||||
CV_SetValue(&cv_usejoystick2, oldchoice);
|
CV_SetValue(&cv_usejoystick2, oldchoice);
|
||||||
|
|
||||||
if (oldchoice == cv_usejoystick2.value)
|
if (oldchoice ==
|
||||||
|
(atoi(cv_usejoystick2.string) > I_NumJoys() ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value))
|
||||||
M_StartMessage("This joystick is used by another\n"
|
M_StartMessage("This joystick is used by another\n"
|
||||||
"player. Reset the joystick\n"
|
"player. Reset the joystick\n"
|
||||||
"for that player first.\n\n"
|
"for that player first.\n\n"
|
||||||
|
@ -6857,7 +6873,7 @@ static void M_AssignJoystick(INT32 choice)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldchoice = cv_usejoystick.value;
|
oldchoice = atoi(cv_usejoystick.string) > I_NumJoys() ? atoi(cv_usejoystick.string) : cv_usejoystick.value;
|
||||||
CV_SetValue(&cv_usejoystick, choice);
|
CV_SetValue(&cv_usejoystick, choice);
|
||||||
|
|
||||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||||
|
@ -6869,7 +6885,8 @@ static void M_AssignJoystick(INT32 choice)
|
||||||
if (choice && oldchoice > I_NumJoys()) // if we did not select "None", we likely selected a used device
|
if (choice && oldchoice > I_NumJoys()) // if we did not select "None", we likely selected a used device
|
||||||
CV_SetValue(&cv_usejoystick, oldchoice);
|
CV_SetValue(&cv_usejoystick, oldchoice);
|
||||||
|
|
||||||
if (oldchoice == cv_usejoystick.value)
|
if (oldchoice ==
|
||||||
|
(atoi(cv_usejoystick.string) > I_NumJoys() ? atoi(cv_usejoystick.string) : cv_usejoystick.value))
|
||||||
M_StartMessage("This joystick is used by another\n"
|
M_StartMessage("This joystick is used by another\n"
|
||||||
"player. Reset the joystick\n"
|
"player. Reset the joystick\n"
|
||||||
"for that player first.\n\n"
|
"for that player first.\n\n"
|
||||||
|
|
Loading…
Reference in a new issue