Merge branch 'reset-ticcmd-angle' into 'master'

P_ForceLocalAngle: reset ticcmd angles and localsteering

See merge request KartKrew/Kart!1409
This commit is contained in:
James R 2023-08-20 22:57:00 +00:00
commit 8412a1a787
3 changed files with 27 additions and 0 deletions

View file

@ -561,6 +561,16 @@ void D_ResetTiccmds(void)
D_Clearticcmd(textcmds[i]->tic);
}
void D_ResetTiccmdAngle(UINT8 ss, angle_t angle)
{
INT32 i;
for (i = 0; i < MAXGENTLEMENDELAY; ++i)
{
localcmds[ss][i].angle = angle >> TICCMD_REDUCE;
}
}
ticcmd_t *D_LocalTiccmd(UINT8 ss)
{
return &localcmds[ss][0];

View file

@ -617,6 +617,7 @@ INT32 D_NumPlayers(void);
boolean D_IsPlayerHumanAndGaming(INT32 player_number);
void D_ResetTiccmds(void);
void D_ResetTiccmdAngle(UINT8 ss, angle_t angle);
ticcmd_t *D_LocalTiccmd(UINT8 ss);
tic_t GetLag(INT32 node);

View file

@ -4689,6 +4689,22 @@ void P_ForceLocalAngle(player_t *player, angle_t angle)
break;
}
}
// jartha: OK, I don't really know how ticcmds work. The
// specific problem I'm trying to fix is that, on level
// load, the player angle gets reset. But the ticcmds
// copied in afterward don't match this angle, and they
// influence the player steering.
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[g_localplayers[i]])
{
D_ResetTiccmdAngle(i, angle);
localsteering[i] = angle;
break;
}
}
}
boolean P_PlayerFullbright(player_t *player)