mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-21 03:11:24 +00:00
Check joystick IDs against all other players [by Digiku]
Untested on my end, but conceptually sound.
This commit is contained in:
parent
266e255bb6
commit
7a9e6161ae
2 changed files with 244 additions and 57 deletions
|
@ -879,19 +879,47 @@ void I_UpdateJoystickDeviceIndices(INT32 player)
|
|||
{
|
||||
if (player != 1) // This is a fucking mess.
|
||||
{
|
||||
if (JoyInfo.dev) // update joystick 1's device index
|
||||
//////////////////////////////
|
||||
// update joystick 1's device index
|
||||
//////////////////////////////
|
||||
|
||||
if (JoyInfo.dev)
|
||||
cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value)
|
||||
// is cv_usejoystick used?
|
||||
else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
|
||||
atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||
// is cv_usejoystick2 used?
|
||||
else if ( // don't check JoyInfo or cv_usejoystick; we're currently operating on those
|
||||
atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||
// is cv_usejoystick3 used?
|
||||
else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
|
||||
atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
// is cv_usejoystick4 used?
|
||||
else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
|
||||
atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick.value = 0;
|
||||
|
@ -899,19 +927,47 @@ void I_UpdateJoystickDeviceIndices(INT32 player)
|
|||
|
||||
if (player != 2)
|
||||
{
|
||||
if (JoyInfo2.dev) // update joystick 2's device index
|
||||
//////////////////////////////
|
||||
// update joystick 2's device index
|
||||
//////////////////////////////
|
||||
|
||||
if (JoyInfo2.dev)
|
||||
cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
||||
// is cv_usejoystick2 used?
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value
|
||||
// don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
||||
// is cv_usejoystick used?
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value
|
||||
// don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||
// is cv_usejoystick3 used?
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value
|
||||
// don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
// is cv_usejoystick4 used?
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value
|
||||
// don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick3.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick2.value = 0;
|
||||
|
@ -919,19 +975,47 @@ void I_UpdateJoystickDeviceIndices(INT32 player)
|
|||
|
||||
if (player != 3)
|
||||
{
|
||||
if (JoyInfo3.dev) // update joystick 3's device index
|
||||
//////////////////////////////
|
||||
// update joystick 3's device index
|
||||
//////////////////////////////
|
||||
|
||||
if (JoyInfo3.dev)
|
||||
cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
||||
// is cv_usejoystick3 used?
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick2.value
|
||||
// don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
||||
// is cv_usejoystick used?
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value
|
||||
// don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||
// is cv_usejoystick2 used?
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value
|
||||
// don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
// is cv_usejoystick4 used?
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick2.value
|
||||
// don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick3.value = 0;
|
||||
|
@ -939,19 +1023,47 @@ void I_UpdateJoystickDeviceIndices(INT32 player)
|
|||
|
||||
if (player != 4)
|
||||
{
|
||||
if (JoyInfo4.dev) // update joystick 4's device index
|
||||
//////////////////////////////
|
||||
// update joystick 4's device index
|
||||
//////////////////////////////
|
||||
|
||||
if (JoyInfo4.dev)
|
||||
cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
||||
// is cv_usejoystick4 used?
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick3.value)
|
||||
// don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||
// is cv_usejoystick used?
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != cv_usejoystick3.value)
|
||||
// don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||
// is cv_usejoystick2 used?
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick3.value)
|
||||
// don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||
// is cv_usejoystick3 used?
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick2.value
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||
// don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
||||
else // we tried...
|
||||
cv_usejoystick4.value = 0;
|
||||
|
@ -1820,7 +1932,7 @@ void I_ShutdownJoystick4(void)
|
|||
|
||||
joystick4_started = 0;
|
||||
JoyReset(&JoyInfo4);
|
||||
|
||||
|
||||
// don't shutdown the subsystem here, because hotplugging
|
||||
}
|
||||
|
||||
|
|
|
@ -945,45 +945,76 @@ void I_GetEvent(void)
|
|||
case SDL_JOYBUTTONDOWN:
|
||||
Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type);
|
||||
break;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
case SDL_JOYDEVICEADDED:
|
||||
{
|
||||
// OH BOY are you in for a good time! #abominationstation
|
||||
|
||||
SDL_Joystick *newjoy = SDL_JoystickOpen(evt.jdevice.which);
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick device index %d added\n", evt.jdevice.which + 1);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Because SDL's device index is unstable, we're going to cheat here a bit:
|
||||
// For the first joystick setting that is NOT active:
|
||||
//
|
||||
// 1. Set cv_usejoystickX.value to the new device index (this does not change what is written to config.cfg)
|
||||
//
|
||||
// 2. Set OTHERS' cv_usejoystickX.value to THEIR new device index, because it likely changed
|
||||
// * If device doesn't exist, switch cv_usejoystick back to default value (.string)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
if (newjoy && (!JoyInfo.dev || !SDL_JoystickGetAttached(JoyInfo.dev)) // PLAYER 1
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 1
|
||||
//////////////////////////////
|
||||
|
||||
if (newjoy && (!JoyInfo.dev || !SDL_JoystickGetAttached(JoyInfo.dev))
|
||||
&& JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick.value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(1);
|
||||
}
|
||||
else if (newjoy && (!JoyInfo2.dev || !SDL_JoystickGetAttached(JoyInfo2.dev)) // PLAYER 2
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 2
|
||||
//////////////////////////////
|
||||
|
||||
else if (newjoy && (!JoyInfo2.dev || !SDL_JoystickGetAttached(JoyInfo2.dev))
|
||||
&& JoyInfo.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick2.value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(2);
|
||||
}
|
||||
else if (newjoy && (!JoyInfo3.dev || !SDL_JoystickGetAttached(JoyInfo3.dev)) // PLAYER 3
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 3
|
||||
//////////////////////////////
|
||||
|
||||
else if (newjoy && (!JoyInfo3.dev || !SDL_JoystickGetAttached(JoyInfo3.dev))
|
||||
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick3.value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(3);
|
||||
}
|
||||
else if (newjoy && (!JoyInfo4.dev || !SDL_JoystickGetAttached(JoyInfo4.dev)) // PLAYER 4
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 4
|
||||
//////////////////////////////
|
||||
|
||||
else if (newjoy && (!JoyInfo4.dev || !SDL_JoystickGetAttached(JoyInfo4.dev))
|
||||
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick4.value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(4);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0") || !cv_usejoystick.value)
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
|
@ -1008,15 +1039,20 @@ void I_GetEvent(void)
|
|||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Update all joysticks' init states
|
||||
// This is a little wasteful since cv_usejoystick already calls this, but
|
||||
// we need to do this in case CV_SetValue did nothing because the string was already same.
|
||||
// if the device is already active, this should do nothing, effectively.
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
I_InitJoystick();
|
||||
I_InitJoystick2();
|
||||
I_InitJoystick3();
|
||||
I_InitJoystick4();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
|
@ -1030,6 +1066,9 @@ void I_GetEvent(void)
|
|||
SDL_JoystickClose(newjoy);
|
||||
}
|
||||
break;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
case SDL_JOYDEVICEREMOVED:
|
||||
if (JoyInfo.dev && !SDL_JoystickGetAttached(JoyInfo.dev))
|
||||
{
|
||||
|
@ -1055,66 +1094,100 @@ void I_GetEvent(void)
|
|||
I_ShutdownJoystick4();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Update the device indexes, because they likely changed
|
||||
// * If device doesn't exist, switch cv_usejoystick back to default value (.string)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (JoyInfo.dev)
|
||||
cv_usejoystick.value = JoyInfo.oldjoy = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy)
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick.value = 0;
|
||||
|
||||
if (JoyInfo2.dev)
|
||||
cv_usejoystick2.value = JoyInfo2.oldjoy = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick2.value = 0;
|
||||
|
||||
if (JoyInfo3.dev)
|
||||
cv_usejoystick3.value = JoyInfo3.oldjoy = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick3.value = 0;
|
||||
|
||||
if (JoyInfo4.dev)
|
||||
cv_usejoystick4.value = JoyInfo4.oldjoy = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy)
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy)
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo1.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick4.value = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0"))
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
|
@ -1139,6 +1212,8 @@ void I_GetEvent(void)
|
|||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
|
|
Loading…
Reference in a new issue