use FRACUNIT in rumbleticker + some changes

- brakedrift will now add to any rumble thats currently going on
- both hyu and invul now rumble less heavy on offroad
This commit is contained in:
Alug committed 2025-01-01 21:34:02 +01:00
1 parent 878b1d60da
commit 2c55e28ea5
1 file changed
+50 -9
+50 -9
View File
@@ -378,21 +378,31 @@ static void P_DeviceRumbleTick(void)
UINT16 high = 0;
if (!cv_usejoystick[i].value)
{
continue;
}
if (!cv_rumble[i].value)
{
continue;
}
player_t *player = &players[displayplayers[i]];
if (!P_IsLocalPlayer(player))
{
continue;
}
if (!playeringame[displayplayers[i]] || player->spectator)
{
continue;
}
if (player->mo == NULL)
{
continue;
}
if (player->exiting)
{
@@ -402,26 +412,50 @@ static void P_DeviceRumbleTick(void)
if (player->kartstuff[k_spinouttimer])
{
low = high = 65536 / 4;
low = high = FRACUNIT / 4;
}
else if (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2)))
{
low = high = 65536 / 8;
low = high = FRACUNIT / 8;
}
else if ((player->kartstuff[k_offroad] && !player->kartstuff[k_hyudorotimer])
else if ((player->kartstuff[k_offroad])
&& P_IsObjectOnGround(player->mo) && player->speed != 0)
{
low = high = 65536 / 64;
if (player->kartstuff[k_hyudorotimer])
{
high = FRACUNIT / 128;
}
else if (player->kartstuff[k_invincibilitytimer])
{
high = FRACUNIT / 64;
}
else
{
low = high = FRACUNIT / 64;
}
}
else if (player->kartstuff[k_brakedrift])
if (player->kartstuff[k_brakedrift])
{
low = 0;
high = 65536 / 256;
high += FRACUNIT / 256;
}
// hack alert! i just dont want this thing constantly resetting the rumble lol
if (low == 0 && high == 0)
{
continue;
}
// pls dont overflow or smth lel
if (low > FRACUNIT-1)
{
low = FRACUNIT-1;
}
if (high > FRACUNIT-1)
{
high = FRACUNIT-1;
}
G_PlayerDeviceRumble(i, low, high, 57);
}
@@ -795,8 +829,15 @@ void P_PreTicker(INT32 frames)
// Run any "after all the other thinkers" stuff
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
{
if (!playeringame[i])
continue;
if (!players[i].mo || P_MobjWasRemoved(players[i].mo))
continue;
P_PlayerAfterThink(&players[i]);
}
LUA_HookThinkFrame();