mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-08 09:51:45 +00:00
Try resetting driftend
This commit is contained in:
parent
51bde5c934
commit
0dc472a255
3 changed files with 36 additions and 8 deletions
42
src/g_game.c
42
src/g_game.c
|
|
@ -876,6 +876,24 @@ INT32 localdelta[MAXSPLITSCREENPLAYERS];
|
||||||
INT32 localstoredeltas[MAXSPLITSCREENPLAYERS][TICCMD_LATENCYMASK + 1];
|
INT32 localstoredeltas[MAXSPLITSCREENPLAYERS][TICCMD_LATENCYMASK + 1];
|
||||||
UINT8 localtic;
|
UINT8 localtic;
|
||||||
|
|
||||||
|
void G_ResetAnglePrediction(player_t *player)
|
||||||
|
{
|
||||||
|
UINT16 i, j;
|
||||||
|
|
||||||
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
|
{
|
||||||
|
if (&players[displayplayers[i]] == player)
|
||||||
|
{
|
||||||
|
localdelta[i] = 0;
|
||||||
|
for (j = 0; j < TICCMD_LATENCYMASK; j++)
|
||||||
|
{
|
||||||
|
localstoredeltas[i][j] = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Turning was removed from G_BuildTiccmd to prevent easy client hacking.
|
// Turning was removed from G_BuildTiccmd to prevent easy client hacking.
|
||||||
// This brings back the camera prediction that was lost.
|
// This brings back the camera prediction that was lost.
|
||||||
static void G_DoAnglePrediction(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer, player_t *player)
|
static void G_DoAnglePrediction(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer, player_t *player)
|
||||||
|
|
@ -884,17 +902,25 @@ static void G_DoAnglePrediction(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer, p
|
||||||
|
|
||||||
localtic = cmd->latency;
|
localtic = cmd->latency;
|
||||||
|
|
||||||
while (realtics > 0)
|
if (player->pflags & PF_DRIFTEND)
|
||||||
{
|
{
|
||||||
localsteering[ssplayer - 1] = K_UpdateSteeringValue(localsteering[ssplayer - 1], cmd->turning);
|
// Otherwise, your angle slingshots off to the side violently...
|
||||||
angleChange = K_GetKartTurnValue(player, localsteering[ssplayer - 1]) << TICCMD_REDUCE;
|
G_ResetAnglePrediction(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (realtics > 0)
|
||||||
|
{
|
||||||
|
localsteering[ssplayer - 1] = K_UpdateSteeringValue(localsteering[ssplayer - 1], cmd->turning);
|
||||||
|
angleChange = K_GetKartTurnValue(player, localsteering[ssplayer - 1]) << TICCMD_REDUCE;
|
||||||
|
|
||||||
// Store the angle we applied to this tic, so we can revert it later.
|
// Store the angle we applied to this tic, so we can revert it later.
|
||||||
// If we trust the camera to do all of the work, then it can get out of sync fast.
|
// If we trust the camera to do all of the work, then it can get out of sync fast.
|
||||||
localstoredeltas[ssplayer - 1][cmd->latency] += angleChange;
|
localstoredeltas[ssplayer - 1][cmd->latency] += angleChange;
|
||||||
localdelta[ssplayer - 1] += angleChange;
|
localdelta[ssplayer - 1] += angleChange;
|
||||||
|
|
||||||
realtics--;
|
realtics--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localangle[ssplayer - 1] = player->angleturn + localdelta[ssplayer - 1];
|
localangle[ssplayer - 1] = player->angleturn + localdelta[ssplayer - 1];
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ extern consvar_t cv_resume;
|
||||||
// build an internal map name MAPxx from map number
|
// build an internal map name MAPxx from map number
|
||||||
const char *G_BuildMapName(INT32 map);
|
const char *G_BuildMapName(INT32 map);
|
||||||
|
|
||||||
|
void G_ResetAnglePrediction(player_t *player);
|
||||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
|
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
|
||||||
|
|
||||||
// copy ticcmd_t to and fro the normal way
|
// copy ticcmd_t to and fro the normal way
|
||||||
|
|
|
||||||
|
|
@ -4874,6 +4874,7 @@ void P_ForceLocalAngle(player_t *player, angle_t angle)
|
||||||
if (player == &players[displayplayers[i]])
|
if (player == &players[displayplayers[i]])
|
||||||
{
|
{
|
||||||
localangle[i] = angle;
|
localangle[i] = angle;
|
||||||
|
G_ResetAnglePrediction(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue