Add offroad gamepad rumble

This commit is contained in:
Eidolon 2023-03-25 21:25:47 -05:00 committed by toaster
parent 17daf1aeba
commit f7ca9043a1

View file

@ -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"
@ -8336,6 +8337,31 @@ void K_KartPlayerAfterThink(player_t *player)
player->nullHitlag = 0;
}
// Apply rumble to player if local to machine and not in demo playback
if (!demo.playback)
{
int i;
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[g_localplayers[i]])
{
UINT16 low = 0;
UINT16 high = 0;
if (player->offroad > 0 && (player->mo->momx != 0 || player->mo->momy != 0 || player->mo->momz != 0))
{
low = 65536 / 4;
high = 65536 / 4;
}
G_PlayerDeviceRumble(i, low, high);
break;
}
}
}
}
/*--------------------------------------------------