Some interpolation related fixes #141

Merged
alufolie91 merged 16 commits from interpfixes into Saturn-Next 2024-11-17 21:25:42 +01:00
9 changed files with 48 additions and 25 deletions

No files matched your search

+9 -6
View File
@@ -6401,19 +6401,21 @@ boolean TryRunTics(tic_t realtics)
}
#endif
if (neededtic > gametic)
ticking = neededtic > gametic;
if (ticking)
{
hu_stopped = false;
if (realtics)
hu_stopped = false;
}
if (player_joining)
{
hu_stopped = true;
if (realtics)
hu_stopped = true;
return false;
}
ticking = neededtic > gametic;
if (ticking)
{
// run the count * tics
@@ -6444,7 +6446,8 @@ boolean TryRunTics(tic_t realtics)
}
else
{
hu_stopped = true;
if (realtics)
hu_stopped = true;
}
return ticking;
+1 -1
View File
@@ -813,7 +813,7 @@ void D_SRB2Loop(void)
{
renderdeltatics = FLOAT_TO_FIXED(deltatics);
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
if (!(paused || P_AutoPause()) && !hu_stopped)
{
rendertimefrac = g_time.timefrac;
}
-3
View File
@@ -2016,9 +2016,6 @@ static void G_FixCamera(UINT8 view)
// Make sure the viewport doesn't interpolate at all into
// its new position -- just snap instantly into place.
// Why does it need to be done twice?
R_ResetViewInterpolation(view);
R_ResetViewInterpolation(view);
}
-1
View File
@@ -3018,7 +3018,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
if (rendermode != render_none && !reloadinggamestate)
{
R_ResetViewInterpolation(0);
R_ResetViewInterpolation(0);
R_UpdateMobjInterpolators();
}
+3 -2
View File
@@ -2084,6 +2084,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mo->y += y;
mo->z += z;
P_SetThingPosition(mo);
mo->old_x = mo->x;
mo->old_y = mo->y;
mo->old_z = mo->z;
if (mo->player)
{
@@ -2102,7 +2105,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
camera[i].reset = true;
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
R_RelativeTeleportViewInterpolation(i, x, y, z, 0);
R_ResetViewInterpolation(i + 1); // reset view interp as well
break;
}
}
@@ -2520,7 +2522,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (displayplayers[i] == (mo->player - players))
{
R_ResetViewInterpolation(i + 1);
R_ResetViewInterpolation(i + 1);
}
}
}
+13 -3
View File
@@ -434,10 +434,21 @@ void P_Ticker(boolean run)
{
INT32 i;
//Increment jointime even if paused.
// Increment jointime and quittime even if paused
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
++players[i].jointime;
{
players[i].jointime++;
}
}
if (run)
{
// Update old view state BEFORE ticking so resetting
// the old interpolation state from game logic works.
R_UpdateViewInterpolation();
}
if (objectplacing)
{
@@ -669,7 +680,6 @@ void P_Ticker(boolean run)
if (run)
{
R_UpdateLevelInterpolators();
R_UpdateViewInterpolation();
// Hack: ensure newview is assigned every tic.
// Ensures view interpolation is T-1 to T in poor network conditions
-1
View File
@@ -3995,7 +3995,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{
P_MoveChaseCamera(player, thiscam, false);
R_ResetViewInterpolation(num + 1);
R_ResetViewInterpolation(num + 1);
}
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
+10 -2
View File
@@ -23,6 +23,7 @@
#include "r_state.h"
#include "z_zone.h"
#include "console.h" // con_startup_loadprogress
#include "i_time.h"
#ifdef HWRENDER
#include "hardware/hw_main.h" // for cv_grshearing
@@ -79,6 +80,7 @@ static viewvars_t skyview_old[MAXSPLITSCREENPLAYERS];
static viewvars_t skyview_new[MAXSPLITSCREENPLAYERS];
static viewvars_t *oldview = &pview_old[0];
static tic_t last_view_update;
static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
viewvars_t *newview = &pview_new[0];
@@ -207,21 +209,27 @@ void R_UpdateViewInterpolation(void)
Indev450 commented 2024-11-10 12:01:27 +01:00 (Migrated from github.com)
Review

This probably should have parentheses around == ((last_view_update == I_GetTime()) ? 1 : 2;). Not sure about order of operations here but just to be safe

This probably should have parentheses around == (`(last_view_update == I_GetTime()) ? 1 : 2;`). Not sure about order of operations here but just to be safe
alufolie91 commented 2024-11-12 16:15:02 +01:00 (Migrated from github.com)
Review

added some there

added some there
if (oldview_invalid[i]) oldview_invalid[i]--;
}
last_view_update = I_GetTime();
}
void R_ResetViewInterpolation(UINT8 p)
{
// Wait an extra tic if the interpolation state hasn't
// updated yet.
int t = ((last_view_update == I_GetTime()) ? 1 : 2);
if (p == 0)
{
UINT8 i;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
oldview_invalid[i]++;
oldview_invalid[i] = t;
}
}
else
{
oldview_invalid[p - 1]++;
oldview_invalid[p - 1] = t;
}
}
5
+12 -6
View File
@@ -463,14 +463,12 @@ void Y_IntermissionDrawer(void)
for (i = 0; i < data.match.numplayers; i++)
{
boolean dojitter = data.match.jitter[data.match.num[i]];
data.match.jitter[data.match.num[i]] = 0;
if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator)
{
char strtime[MAXPLAYERNAME+1];
if (dojitter)
// Apply the jitter offset (later reversed)
if (data.match.jitter[data.match.num[i]] > 0)
y--;
V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i]));
@@ -559,7 +557,7 @@ void Y_IntermissionDrawer(void)
}
}
if (dojitter)
if (data.match.jitter[data.match.num[i]] > 0)
y++;
}
else
@@ -666,8 +664,16 @@ void Y_Ticker(void)
return;
}
if (intertic < TICRATE || intertic & 1 || endtic != -1)
if (intertic < TICRATE || endtic != -1)
{
return;
}
if (data.match.rankingsmode && intertic & 1)
{
memset(data.match.jitter, 0, sizeof (data.match.jitter));
return;
}
if (intertype == int_race || intertype == int_match)
{