mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-03 13:42:31 +00:00
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:
parent
89fc9a618e
commit
380beaa023
2 changed files with 22 additions and 25 deletions
25
src/k_kart.c
25
src/k_kart.c
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
22
src/p_tick.c
22
src/p_tick.c
|
|
@ -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++)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue