Rename joystick index related things to joystick id
Since SDL3 doesn't use indexes this should make it less confusing when I start working on this
This commit is contained in:
parent
8b28f97e81
commit
1ca56d100a
6 changed files with 19 additions and 19 deletions
|
|
@ -71,9 +71,9 @@ INT32 I_NumJoys(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const char *I_GetJoyName(INT32 joyindex)
|
||||
const char *I_GetJoyName(INT32 joyid)
|
||||
{
|
||||
(void)joyindex;
|
||||
(void)joyid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1263,7 +1263,7 @@ INT32 G_PlayerInputAnalog(UINT8 p, INT32 gc, boolean digital, SINT8 type)
|
|||
|
||||
deadzone = (JOYAXISRANGE * deadzonetype) / FRACUNIT;
|
||||
|
||||
deviceID = I_GetJoystickDeviceIndexForPlayer(p) + 1;
|
||||
deviceID = I_GetJoystickIDForPlayer(p) + 1;
|
||||
|
||||
retrygetcontrol:
|
||||
for (i = 0; i < MAXINPUTMAPPING; i++)
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ INT32 G_GetDevicePlayer(INT32 deviceID)
|
|||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (deviceID == I_GetJoystickDeviceIndexForPlayer(i) + 1)
|
||||
if (deviceID == I_GetJoystickIDForPlayer(i) + 1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,11 +235,11 @@ extern INT32 numcontrollers;
|
|||
|
||||
/** \brief The *I_GetJoyName function
|
||||
|
||||
\param joyindex which joystick
|
||||
\param joyid which joystick
|
||||
|
||||
\return joystick name
|
||||
*/
|
||||
const char *I_GetJoyName(INT32 joyindex);
|
||||
const char *I_GetJoyName(INT32 joyid);
|
||||
|
||||
void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 blue);
|
||||
|
|
@ -320,7 +320,7 @@ const char *I_LocateWad(void);
|
|||
*/
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
INT32 I_GetJoystickDeviceIndexForPlayer(UINT8 pnum);
|
||||
INT32 I_GetJoystickIDForPlayer(UINT8 pnum);
|
||||
|
||||
/** \brief Checks if the mouse needs to be grabbed
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ void I_JoyScale4(void)
|
|||
}
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
|
||||
INT32 I_GetJoystickID(SDL_Gamepad *dev)
|
||||
{
|
||||
SDL_Joystick *joystick = NULL;
|
||||
|
||||
|
|
@ -1082,7 +1082,7 @@ INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
INT32 I_GetJoystickDeviceIndexForPlayer(UINT8 pnum)
|
||||
INT32 I_GetJoystickIDForPlayer(UINT8 pnum)
|
||||
{
|
||||
SDL_Joystick *joystick = NULL;
|
||||
|
||||
|
|
@ -1164,7 +1164,7 @@ void I_ShutdownJoystick(UINT8 index)
|
|||
INT32 i;
|
||||
event_t event;
|
||||
|
||||
event.device = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
|
||||
event.device = I_GetJoystickID(JoyInfo[index].dev);
|
||||
event.type = ev_keyup;
|
||||
event.data2 = 0;
|
||||
event.data3 = 0;
|
||||
|
|
@ -1198,7 +1198,7 @@ void I_ShutdownJoystick(UINT8 index)
|
|||
|
||||
|
||||
*/
|
||||
static int joy_open(int playerIndex, int joyIndex)
|
||||
static int joy_open(int playerIndex, int joyID)
|
||||
{
|
||||
SDL_Gamepad *newdev = NULL;
|
||||
int num_joy = 0;
|
||||
|
|
@ -1214,7 +1214,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (joyIndex <= 0)
|
||||
if (joyID <= 0)
|
||||
return -1;
|
||||
|
||||
SDL_GetJoysticks(&num_joy);
|
||||
|
|
@ -1225,7 +1225,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||
return -1;
|
||||
}
|
||||
|
||||
newdev = SDL_OpenGamepad(joyIndex-1);
|
||||
newdev = SDL_OpenGamepad(joyID-1);
|
||||
|
||||
// Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
|
||||
// This indexing is SDL's responsibility and there's not much we can do about it.
|
||||
|
|
@ -1251,7 +1251,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||
}
|
||||
|
||||
JoyInfo[playerIndex].dev = newdev;
|
||||
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
|
||||
JoyInfo[playerIndex].id = I_GetJoystickID(JoyInfo[playerIndex].dev);
|
||||
|
||||
if (JoyInfo[playerIndex].dev == NULL)
|
||||
{
|
||||
|
|
@ -1345,7 +1345,7 @@ void I_InitJoystick(UINT8 index)
|
|||
break;
|
||||
}
|
||||
|
||||
JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
|
||||
JoyInfo[index].id = I_GetJoystickID(JoyInfo[index].dev);
|
||||
|
||||
if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device
|
||||
{
|
||||
|
|
@ -1435,14 +1435,14 @@ INT32 I_NumJoys(void)
|
|||
|
||||
static char joyname[255]; // joystick name is straight from the driver
|
||||
|
||||
const char *I_GetJoyName(INT32 joyindex)
|
||||
const char *I_GetJoyName(INT32 joyid)
|
||||
{
|
||||
const char *tempname = NULL;
|
||||
joyname[0] = 0;
|
||||
joyindex--; //SDL's Joystick System starts at 0, not 1
|
||||
joyid--; //SDL's Joystick System starts at 0, not 1
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
{
|
||||
tempname = SDL_GetJoystickNameForID(joyindex);
|
||||
tempname = SDL_GetJoystickNameForID(joyid);
|
||||
if (tempname)
|
||||
{
|
||||
strncpy(joyname, tempname, 254);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ void I_GetConsoleEvents(void);
|
|||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
|
||||
INT32 I_GetJoystickID(SDL_Gamepad *dev);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
|
|
|
|||
Loading…
Reference in a new issue