Refactor Rumble condition check to iterate over splitscreen players once in p_tick.c, instead of players*splitscreen players in k_kart.c

This commit is contained in:
toaster 2023-04-02 23:49:45 +01:00
parent 89fc9a618e
commit 380beaa023
2 changed files with 22 additions and 25 deletions

View file

@ -8337,31 +8337,6 @@ 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->boostpower < FRACUNIT && P_IsObjectOnGround(player->mo))
{
low = 65536 / 4;
high = 65536 / 4;
}
G_PlayerDeviceRumble(i, low, high);
break;
}
}
}
}
/*--------------------------------------------------

View file

@ -747,6 +747,28 @@ 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->boostpower < FRACUNIT && P_IsObjectOnGround(player->mo))
{
low = 65536 / 4;
high = 65536 / 4;
}
G_PlayerDeviceRumble(i, low, high);
}
}
if (numFinishingPlayers > 1)
{
for (i = 0; i < numFinishingPlayers; i++)