mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
Merge branch 'pad-rumble' into 'master'
Gamepad rumble See merge request KartKrew/Kart!1098
This commit is contained in:
commit
86dd34d807
17 changed files with 222 additions and 27 deletions
|
|
@ -2898,6 +2898,8 @@ void CL_Reset(void)
|
|||
http_source[0] = '\0';
|
||||
#endif
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1024,6 +1024,7 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_kickstartaccel[i]);
|
||||
CV_RegisterVar(&cv_shrinkme[i]);
|
||||
CV_RegisterVar(&cv_deadzone[i]);
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
|
|
@ -1035,10 +1036,6 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_controlperkey);
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_mousesens);
|
||||
CV_RegisterVar(&cv_mouseysens);
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
|
|
@ -3315,6 +3312,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
|||
}
|
||||
|
||||
I_UpdateMouseGrab();
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
// Command for stuck characters in netgames, griefing, etc.
|
||||
|
|
|
|||
42
src/g_game.c
42
src/g_game.c
|
|
@ -353,6 +353,11 @@ static void weaponPrefChange2(void);
|
|||
static void weaponPrefChange3(void);
|
||||
static void weaponPrefChange4(void);
|
||||
|
||||
static void rumble_off_handle(void);
|
||||
static void rumble_off_handle2(void);
|
||||
static void rumble_off_handle3(void);
|
||||
static void rumble_off_handle4(void);
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// chat timer thingy
|
||||
|
|
@ -416,8 +421,6 @@ consvar_t cv_pauseifunfocused = CVAR_INIT ("pauseifunfocused", "Yes", CV_SAVE, C
|
|||
// Display song credits
|
||||
consvar_t cv_songcredits = CVAR_INIT ("songcredits", "On", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
consvar_t cv_invertmouse = CVAR_INIT ("invertmouse", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
||||
consvar_t cv_invincmusicfade = CVAR_INIT ("invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL);
|
||||
consvar_t cv_growmusicfade = CVAR_INIT ("growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL);
|
||||
|
||||
|
|
@ -447,6 +450,13 @@ consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS] = {
|
|||
CVAR_INIT ("deadzone4", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("rumble", "On", CV_SAVE|CV_CALL, CV_OnOff, rumble_off_handle),
|
||||
CVAR_INIT ("rumble2", "On", CV_SAVE|CV_CALL, CV_OnOff, rumble_off_handle2),
|
||||
CVAR_INIT ("rumble3", "On", CV_SAVE|CV_CALL, CV_OnOff, rumble_off_handle3),
|
||||
CVAR_INIT ("rumble4", "On", CV_SAVE|CV_CALL, CV_OnOff, rumble_off_handle4)
|
||||
};
|
||||
|
||||
// now automatically allocated in D_RegisterClientCommands
|
||||
// so that it doesn't have to be updated depending on the value of MAXPLAYERS
|
||||
char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
||||
|
|
@ -1476,6 +1486,30 @@ static void weaponPrefChange4(void)
|
|||
WeaponPref_Send(3);
|
||||
}
|
||||
|
||||
static void rumble_off_handle(void)
|
||||
{
|
||||
if (cv_rumble[0].value == 0)
|
||||
G_ResetPlayerDeviceRumble(0);
|
||||
}
|
||||
|
||||
static void rumble_off_handle2(void)
|
||||
{
|
||||
if (cv_rumble[1].value == 0)
|
||||
G_ResetPlayerDeviceRumble(1);
|
||||
}
|
||||
|
||||
static void rumble_off_handle3(void)
|
||||
{
|
||||
if (cv_rumble[2].value == 0)
|
||||
G_ResetPlayerDeviceRumble(2);
|
||||
}
|
||||
|
||||
static void rumble_off_handle4(void)
|
||||
{
|
||||
if (cv_rumble[3].value == 0)
|
||||
G_ResetPlayerDeviceRumble(3);
|
||||
}
|
||||
|
||||
//
|
||||
// G_DoLoadLevelEx
|
||||
//
|
||||
|
|
@ -1571,6 +1605,8 @@ void G_DoLoadLevelEx(boolean resetplayer, gamestate_t newstate)
|
|||
{
|
||||
Automate_Run(AEV_ROUNDSTART);
|
||||
}
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
void G_DoLoadLevel(boolean resetplayer)
|
||||
|
|
@ -3197,6 +3233,8 @@ void G_AddPlayer(INT32 playernum)
|
|||
|
||||
void G_ExitLevel(void)
|
||||
{
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
UINT8 i;
|
||||
|
|
|
|||
|
|
@ -70,18 +70,9 @@ extern consvar_t cv_songcredits;
|
|||
|
||||
extern consvar_t cv_pauseifunfocused;
|
||||
|
||||
extern consvar_t cv_invertmouse;
|
||||
|
||||
extern consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
|
|
|||
|
|
@ -23,16 +23,7 @@
|
|||
#include "v_video.h" // V_GetColor for assigning gamepad indictaor colors
|
||||
#include "z_zone.h"
|
||||
|
||||
#define MAXMOUSESENSITIVITY 100 // sensitivity steps
|
||||
|
||||
static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"}, {0, NULL}};
|
||||
|
||||
// mouse values are used once
|
||||
consvar_t cv_mousesens = CVAR_INIT ("mousesens", "20", CV_SAVE, mousesens_cons_t, NULL);
|
||||
consvar_t cv_mousesens2 = CVAR_INIT ("mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL);
|
||||
consvar_t cv_mouseysens = CVAR_INIT ("mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL);
|
||||
consvar_t cv_mouseysens2 = CVAR_INIT ("mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL);
|
||||
consvar_t cv_controlperkey = CVAR_INIT ("controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL);
|
||||
|
||||
// current state of the keys
|
||||
|
|
@ -208,6 +199,8 @@ void G_SetDeviceForPlayer(INT32 player, INT32 device)
|
|||
if (device > 0)
|
||||
{
|
||||
I_SetGamepadPlayerIndex(device, -1);
|
||||
I_GamepadRumble(device, 0, 0);
|
||||
I_GamepadRumbleTriggers(device, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -327,6 +320,75 @@ void G_ResetAllDeviceResponding(void)
|
|||
}
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
if (cv_rumble[player].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, low_strength, high_strength);
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumbleTriggers(INT32 player, UINT16 left_strength, UINT16 right_strength)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
if (cv_rumble[player].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumbleTriggers(device_id, left_strength, right_strength);
|
||||
}
|
||||
|
||||
void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0);
|
||||
I_GamepadRumbleTriggers(device_id, 0, 0);
|
||||
}
|
||||
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
{
|
||||
int i;
|
||||
int devices;
|
||||
|
||||
devices = G_GetNumAvailableGamepads();
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetAvailableGamepadDevice(i);
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0);
|
||||
I_GamepadRumbleTriggers(device_id, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean AutomaticControllerReassignmentIsAllowed(INT32 device)
|
||||
{
|
||||
boolean device_is_gamepad = device > 0;
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ typedef enum
|
|||
} gamecontrols_e;
|
||||
|
||||
// mouse values are used once
|
||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
||||
extern consvar_t cv_controlperkey;
|
||||
|
||||
// current state of the keys: JOYAXISRANGE or 0 when boolean.
|
||||
|
|
@ -159,6 +157,13 @@ void G_SetDeviceForPlayer(INT32 player, INT32 device);
|
|||
|
||||
void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player);
|
||||
|
||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength);
|
||||
void G_PlayerDeviceRumbleTriggers(INT32 player, UINT16 left_strength, UINT16 right_strength);
|
||||
void G_ResetPlayerDeviceRumble(INT32 player);
|
||||
void G_ResetAllDeviceRumbles(void);
|
||||
|
||||
/// Get the gamekeydown array (NUMINPUTS values) for the given device, or NULL if the device id is invalid.
|
||||
INT32* G_GetDeviceGameKeyDownArray(INT32 device);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ void I_SetGamepadPlayerIndex(INT32 device_id, INT32 index);
|
|||
void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue);
|
||||
void I_GetGamepadGuid(INT32 device_id, char *out, int out_len);
|
||||
void I_GetGamepadName(INT32 device_id, char *out, int out_len);
|
||||
void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength);
|
||||
void I_GamepadRumbleTriggers(INT32 device_id, UINT16 left_strength, UINT16 right_strength);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h" // for device rumble
|
||||
#include "m_random.h"
|
||||
#include "p_local.h"
|
||||
#include "p_slopes.h"
|
||||
|
|
|
|||
|
|
@ -945,6 +945,7 @@ extern INT16 controlleroffsets[][2];
|
|||
extern consvar_t cv_dummyprofilename;
|
||||
extern consvar_t cv_dummyprofileplayername;
|
||||
extern consvar_t cv_dummyprofilekickstart;
|
||||
extern consvar_t cv_dummyprofilerumble;
|
||||
|
||||
void M_ResetOptions(void);
|
||||
void M_InitOptions(INT32 choice); // necessary for multiplayer since there's some options we won't want to access
|
||||
|
|
|
|||
|
|
@ -1171,6 +1171,7 @@ void M_Init(void)
|
|||
CV_RegisterVar(&cv_dummyprofilename);
|
||||
CV_RegisterVar(&cv_dummyprofileplayername);
|
||||
CV_RegisterVar(&cv_dummyprofilekickstart);
|
||||
CV_RegisterVar(&cv_dummyprofilerumble);
|
||||
|
||||
CV_RegisterVar(&cv_dummygpdifficulty);
|
||||
CV_RegisterVar(&cv_dummykartspeed);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ profile_t* PR_MakeProfileFromPlayer(const char *prname, const char *pname, const
|
|||
|
||||
// Player bound cvars:
|
||||
new->kickstartaccel = cv_kickstartaccel[pnum].value;
|
||||
new->rumble = cv_rumble[pnum].value;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
@ -277,6 +278,7 @@ void PR_SaveProfiles(void)
|
|||
|
||||
// Consvars.
|
||||
WRITEUINT8(save.p, profilesList[i]->kickstartaccel);
|
||||
WRITEUINT8(save.p, profilesList[i]->rumble);
|
||||
|
||||
// Controls.
|
||||
for (j = 0; j < num_gamecontrols; j++)
|
||||
|
|
@ -409,6 +411,14 @@ void PR_LoadProfiles(void)
|
|||
|
||||
// Consvars.
|
||||
profilesList[i]->kickstartaccel = (boolean)READUINT8(save.p);
|
||||
if (version < 4)
|
||||
{
|
||||
profilesList[i]->rumble = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
profilesList[i]->rumble = (boolean)READUINT8(save.p);
|
||||
}
|
||||
|
||||
// Controls.
|
||||
for (j = 0; j < num_gamecontrols; j++)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ extern "C" {
|
|||
#define SKINNAMESIZE 16
|
||||
|
||||
#define PROFILENAMELEN 6
|
||||
#define PROFILEVER 3
|
||||
#define PROFILEVER 4
|
||||
#define MAXPROFILES 16
|
||||
#define PROFILESFILE "ringprofiles.prf"
|
||||
#define PROFILE_GUEST 0
|
||||
|
|
@ -74,6 +74,7 @@ struct profile_t
|
|||
// Player-specific consvars.
|
||||
// @TODO: List all of those
|
||||
boolean kickstartaccel; // cv_kickstartaccel
|
||||
boolean rumble; // cv_rumble
|
||||
|
||||
// Finally, control data itself
|
||||
INT32 controls[num_gamecontrols][MAXINPUTMAPPING]; // Lists of all the controls, defined the same way as default inputs in g_input.c
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ menu_t OPTIONS_ProfilesDef = {
|
|||
consvar_t cv_dummyprofilename = CVAR_INIT ("dummyprofilename", "", CV_HIDDEN, NULL, NULL);
|
||||
consvar_t cv_dummyprofileplayername = CVAR_INIT ("dummyprofileplayername", "", CV_HIDDEN, NULL, NULL);
|
||||
consvar_t cv_dummyprofilekickstart = CVAR_INIT ("dummyprofilekickstart", "Off", CV_HIDDEN, CV_OnOff, NULL);
|
||||
consvar_t cv_dummyprofilerumble = CVAR_INIT ("dummyprofilerumble", "On", CV_HIDDEN, CV_OnOff, NULL);
|
||||
|
||||
void M_ProfileSelectInit(INT32 choice)
|
||||
{
|
||||
|
|
@ -92,12 +93,14 @@ static void M_StartEditProfile(INT32 c)
|
|||
CV_StealthSet(&cv_dummyprofilename, optionsmenu.profile->profilename);
|
||||
CV_StealthSet(&cv_dummyprofileplayername, optionsmenu.profile->playername);
|
||||
CV_StealthSetValue(&cv_dummyprofilekickstart, optionsmenu.profile->kickstartaccel);
|
||||
CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_StealthSet(&cv_dummyprofilename, "");
|
||||
CV_StealthSet(&cv_dummyprofileplayername, "");
|
||||
CV_StealthSetValue(&cv_dummyprofilekickstart, 0); // off
|
||||
CV_StealthSetValue(&cv_dummyprofilerumble, 1); // on
|
||||
}
|
||||
|
||||
// Setup greyout and stuff.
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ menuitem_t OPTIONS_ProfileControls[] = {
|
|||
{IT_HEADER, "TOGGLES", "For per-player commands",
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
||||
{IT_CONTROL | IT_CVAR, "RUMBLE", "For gamepad users - should your device rumble?",
|
||||
NULL, {.cvar = &cv_dummyprofilerumble}, 0, 0},
|
||||
|
||||
{IT_CONTROL | IT_CVAR, "KICKSTART ACCEL", "Hold A to auto-accel. Tap it to cancel.",
|
||||
NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0},
|
||||
|
||||
|
|
@ -182,6 +185,7 @@ static void M_ProfileControlSaveResponse(INT32 choice)
|
|||
SINT8 belongsto = PR_ProfileUsedBy(optionsmenu.profile);
|
||||
// Save the profile
|
||||
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value;
|
||||
optionsmenu.profile->rumble = cv_dummyprofilerumble.value;
|
||||
memcpy(&optionsmenu.profile->controls, optionsmenu.tempcontrols, sizeof(gamecontroldefault));
|
||||
|
||||
// If this profile is in-use by anyone, apply the changes immediately upon exiting.
|
||||
|
|
@ -190,6 +194,7 @@ static void M_ProfileControlSaveResponse(INT32 choice)
|
|||
{
|
||||
memcpy(&gamecontrol[belongsto], optionsmenu.tempcontrols, sizeof(gamecontroldefault));
|
||||
CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value);
|
||||
CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value);
|
||||
}
|
||||
|
||||
M_GoBack(0);
|
||||
|
|
@ -206,6 +211,7 @@ void M_ProfileControlsConfirm(INT32 choice)
|
|||
M_ProfileControlSaveResponse(MA_YES);
|
||||
|
||||
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel.
|
||||
optionsmenu.profile->rumble = cv_dummyprofilerumble.value; // And rumble too!
|
||||
|
||||
// Reapply player 1's real profile.
|
||||
if (cv_currprofile.value > -1)
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@ void M_OpenPauseMenu(void)
|
|||
PAUSE_Main[mpause_entergame].status = IT_STRING | IT_CALL;
|
||||
}
|
||||
}
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
void M_QuitPauseMenu(INT32 choice)
|
||||
|
|
|
|||
32
src/p_tick.c
32
src/p_tick.c
|
|
@ -747,6 +747,38 @@ void P_Ticker(boolean run)
|
|||
}
|
||||
}
|
||||
|
||||
// Apply rumble to player if local to machine and not in demo playback
|
||||
if (!demo.playback)
|
||||
{
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
player_t *player = &players[g_localplayers[i]];
|
||||
UINT16 low = 0;
|
||||
UINT16 high = 0;
|
||||
|
||||
if (player->mo == NULL)
|
||||
continue;
|
||||
|
||||
if ((player->mo->eflags & MFE_DAMAGEHITLAG) && player->mo->hitlag)
|
||||
{
|
||||
low = 65536 / 2;
|
||||
high = 65536 / 2;
|
||||
}
|
||||
else if (player->sneakertimer > (sneakertime-(TICRATE/2)))
|
||||
{
|
||||
low = 65536 / (3+player->numsneakers);
|
||||
high = 65536 / (3+player->numsneakers);
|
||||
}
|
||||
else if (player->boostpower < FRACUNIT && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
low = 65536 / 32;
|
||||
high = 65536 / 32;
|
||||
}
|
||||
|
||||
G_PlayerDeviceRumble(i, low, high);
|
||||
}
|
||||
}
|
||||
|
||||
if (numFinishingPlayers > 1)
|
||||
{
|
||||
for (i = 0; i < numFinishingPlayers; i++)
|
||||
|
|
|
|||
|
|
@ -1019,6 +1019,46 @@ void I_GetGamepadName(INT32 device_id, char *out, int out_len)
|
|||
out[out_len - 1] = 0;
|
||||
}
|
||||
|
||||
void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength)
|
||||
{
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,9))
|
||||
(void)device_id;
|
||||
(void)low_strength;
|
||||
(void)high_strength;
|
||||
(void)length_ms;
|
||||
#else
|
||||
I_Assert(device_id > 0); // Gamepad devices are always ID 1 or higher
|
||||
|
||||
SDL_GameController *controller = SDL_GameControllerFromInstanceID(device_id - 1);
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_GameControllerRumble(controller, low_strength, high_strength, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_GamepadRumbleTriggers(INT32 device_id, UINT16 left_strength, UINT16 right_strength)
|
||||
{
|
||||
#if !(SDL_VERSION_ATLEAST(2,0,14))
|
||||
(void)device_id;
|
||||
(void)low_strength;
|
||||
(void)high_strength;
|
||||
(void)length_ms;
|
||||
#else
|
||||
I_Assert(device_id > 0); // Gamepad devices are always ID 1 or higher
|
||||
|
||||
SDL_GameController *controller = SDL_GameControllerFromInstanceID(device_id - 1);
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_GameControllerRumbleTriggers(controller, left_strength, right_strength, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// I_StartupInput
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue