mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
Reorganize some of the code for SDL_JOYDEVICEADDED events
This commit is contained in:
parent
4dc7c6459c
commit
650df71cfc
3 changed files with 93 additions and 204 deletions
|
|
@ -872,6 +872,92 @@ INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev)
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Misleading function: updates device indices for all players BUT the one specified.
|
||||||
|
// Necessary for SDL_JOYDEVICEADDED events
|
||||||
|
void I_UpdateJoystickDeviceIndices(INT32 player)
|
||||||
|
{
|
||||||
|
if (player != 1) // This is a fucking mess.
|
||||||
|
{
|
||||||
|
if (JoyInfo.dev) // update joystick 1's device index
|
||||||
|
cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
||||||
|
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||||
|
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value)
|
||||||
|
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
||||||
|
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||||
|
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||||
|
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
||||||
|
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||||
|
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||||
|
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
||||||
|
else if (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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player != 2)
|
||||||
|
{
|
||||||
|
if (JoyInfo2.dev) // update joystick 2's device index
|
||||||
|
cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
||||||
|
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
||||||
|
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||||
|
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||||
|
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||||
|
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
||||||
|
else if (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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player != 3)
|
||||||
|
{
|
||||||
|
if (JoyInfo3.dev) // update joystick 3's device index
|
||||||
|
cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
||||||
|
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
||||||
|
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||||
|
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||||
|
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||||
|
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||||
|
else if (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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player != 4)
|
||||||
|
{
|
||||||
|
if (JoyInfo4.dev) // update joystick 4's device index
|
||||||
|
cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
||||||
|
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||||
|
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||||
|
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
||||||
|
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
||||||
|
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||||
|
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
||||||
|
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
||||||
|
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||||
|
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
||||||
|
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
||||||
|
else // we tried...
|
||||||
|
cv_usejoystick4.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Joystick 1 buttons states
|
/** \brief Joystick 1 buttons states
|
||||||
*/
|
*/
|
||||||
static UINT64 lastjoybuttons = 0;
|
static UINT64 lastjoybuttons = 0;
|
||||||
|
|
|
||||||
|
|
@ -962,225 +962,25 @@ void I_GetEvent(void)
|
||||||
&& JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
&& JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||||
{
|
{
|
||||||
cv_usejoystick.value = evt.jdevice.which + 1;
|
cv_usejoystick.value = evt.jdevice.which + 1;
|
||||||
|
I_UpdateJoystickDeviceIndices(1);
|
||||||
if (JoyInfo2.dev) // update joystick 2's device index
|
|
||||||
cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo3.dev) // update joystick 3's device index
|
|
||||||
cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo4.dev) // update joystick 4's device index
|
|
||||||
cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
|
||||||
else // we tried...
|
|
||||||
cv_usejoystick4.value = 0;
|
|
||||||
}
|
}
|
||||||
else if (newjoy && (!JoyInfo2.dev || !SDL_JoystickGetAttached(JoyInfo2.dev)) // PLAYER 2
|
else if (newjoy && (!JoyInfo2.dev || !SDL_JoystickGetAttached(JoyInfo2.dev)) // PLAYER 2
|
||||||
&& JoyInfo.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
&& JoyInfo.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||||
{
|
{
|
||||||
cv_usejoystick2.value = evt.jdevice.which + 1;
|
cv_usejoystick2.value = evt.jdevice.which + 1;
|
||||||
|
I_UpdateJoystickDeviceIndices(2);
|
||||||
if (JoyInfo.dev) // update joystick 1's device index
|
|
||||||
cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo3.dev) // update joystick 3's device index
|
|
||||||
cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo4.dev) // update joystick 4's device index
|
|
||||||
cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
|
||||||
else // we tried...
|
|
||||||
cv_usejoystick4.value = 0;
|
|
||||||
}
|
}
|
||||||
else if (newjoy && (!JoyInfo3.dev || !SDL_JoystickGetAttached(JoyInfo3.dev)) // PLAYER 3
|
else if (newjoy && (!JoyInfo3.dev || !SDL_JoystickGetAttached(JoyInfo3.dev)) // PLAYER 3
|
||||||
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
|
||||||
{
|
{
|
||||||
cv_usejoystick3.value = evt.jdevice.which + 1;
|
cv_usejoystick3.value = evt.jdevice.which + 1;
|
||||||
|
I_UpdateJoystickDeviceIndices(3);
|
||||||
if (JoyInfo.dev) // update joystick 1's device index
|
|
||||||
cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo2.dev) // update joystick 2's device index
|
|
||||||
cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo4.dev) // update joystick 4's device index
|
|
||||||
cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick4.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
|
||||||
else // we tried...
|
|
||||||
cv_usejoystick4.value = 0;
|
|
||||||
}
|
}
|
||||||
else if (newjoy && (!JoyInfo4.dev || !SDL_JoystickGetAttached(JoyInfo4.dev)) // PLAYER 4
|
else if (newjoy && (!JoyInfo4.dev || !SDL_JoystickGetAttached(JoyInfo4.dev)) // PLAYER 4
|
||||||
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy) // don't override a currently active device
|
&& JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy) // don't override a currently active device
|
||||||
{
|
{
|
||||||
cv_usejoystick4.value = evt.jdevice.which + 1;
|
cv_usejoystick4.value = evt.jdevice.which + 1;
|
||||||
|
I_UpdateJoystickDeviceIndices(4);
|
||||||
if (JoyInfo.dev) // update joystick 1's device index
|
|
||||||
cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo2.dev) // update joystick 2's device index
|
|
||||||
cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
|
|
||||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (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;
|
|
||||||
|
|
||||||
if (JoyInfo3.dev) // update joystick 3's device index
|
|
||||||
cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
|
||||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick3.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
|
||||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
|
||||||
&& atoi(cv_usejoystick.string) != cv_usejoystick.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
|
||||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
|
||||||
&& atoi(cv_usejoystick2.string) != cv_usejoystick2.value)
|
|
||||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
|
||||||
else if (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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was cv_usejoystick disabled in settings?
|
// Was cv_usejoystick disabled in settings?
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,9 @@ void I_ShutdownJoystick4(void);
|
||||||
// Cheat to get the device index for a joystick handle
|
// Cheat to get the device index for a joystick handle
|
||||||
INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev);
|
INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev);
|
||||||
|
|
||||||
|
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||||
|
void I_UpdateJoystickDeviceIndices(INT32 player);
|
||||||
|
|
||||||
void I_GetConsoleEvents(void);
|
void I_GetConsoleEvents(void);
|
||||||
|
|
||||||
void SDLforceUngrabMouse(void);
|
void SDLforceUngrabMouse(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue