diff --git a/libretro/libretro.c b/libretro/libretro.c index 1d0e812..8579f3e 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -1459,5 +1459,4 @@ void R_InitInterpolation(void) tic_vars.frac_step = FRACUNIT * TICRATE / tic_vars.fps; tic_vars.sample_step = info.timing.sample_rate / tic_vars.fps; } - tic_vars.frac = FRACUNIT; } diff --git a/src/d_client.c b/src/d_client.c index 2e132c8..d065147 100644 --- a/src/d_client.c +++ b/src/d_client.c @@ -511,49 +511,42 @@ void D_InitNetGame (void) consoleplayer = displayplayer = doomcom->consoleplayer; } + void D_BuildNewTiccmds(void) { - I_StartTic(); - - if (maketic <= gametic) + static float tcount; + tcount += TICRATE; + if (tcount>0) { - // Create new ticcmds if running behind - G_BuildTiccmd(&localcmds[maketic % BACKUPTICS]); - maketic++; - } - else - { - // Update latest ticcmd if running ahead - ticcmd_t prevcmd = localcmds[(maketic-1) % BACKUPTICS]; - ticcmd_t *cmd = &localcmds[(maketic-1) % BACKUPTICS]; - - G_BuildTiccmd(cmd); - cmd->angleturn += prevcmd.angleturn; - cmd->buttons |= prevcmd.buttons; + tcount -= tic_vars.fps; + I_StartTic(); + G_BuildTiccmd(&localcmds[maketic % BACKUPTICS]); + maketic++; } } void TryRunTics(void) { tic_vars.frac += tic_vars.frac_step; - - D_BuildNewTiccmds(); - - if (movement_smooth && gamestate==wipegamestate) { - WasRenderedInTryRunTics = TRUE; - D_Display(); + if(tic_vars.frac > FRACUNIT) { + tic_vars.frac = FRACUNIT; } - if(tic_vars.frac >= FRACUNIT) { - tic_vars.frac -= FRACUNIT; + I_StartTic(); + + if (maketic <= gametic) { + WasRenderedInTryRunTics = TRUE; + if (movement_smooth && gamestate==wipegamestate) + D_Display(); + } else { if (advancedemo) - D_DoAdvanceDemo (); + D_DoAdvanceDemo (); M_Ticker (); G_Ticker (); P_Checksum(gametic); gametic++; + tic_vars.frac = 0; } - } #endif diff --git a/src/r_fps.c b/src/r_fps.c index e9b1312..479afed 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -79,7 +79,6 @@ void R_InterpolateView (player_t *player) { static mobj_t *oviewer; - fixed_t frac; boolean NoInterpolate = paused || (menuactive && !demoplayback); @@ -92,9 +91,7 @@ void R_InterpolateView (player_t *player) } if (NoInterpolate) - frac = FRACUNIT; - else - frac = tic_vars.frac; + tic_vars.frac = FRACUNIT; if (movement_smooth) { @@ -104,13 +101,17 @@ void R_InterpolateView (player_t *player) player->prev_viewz = player->viewz; player->prev_viewangle = player->mo->angle + viewangleoffset; + //player->prev_viewpitch = player->mo->pitch + viewpitchoffset; + + //P_ResetWalkcam(); } - viewx = player->mo->PrevX + FixedMul (frac, player->mo->x - player->mo->PrevX); - viewy = player->mo->PrevY + FixedMul (frac, player->mo->y - player->mo->PrevY); - viewz = player->prev_viewz + FixedMul (frac, player->viewz - player->prev_viewz); + viewx = player->mo->PrevX + FixedMul (tic_vars.frac, player->mo->x - player->mo->PrevX); + viewy = player->mo->PrevY + FixedMul (tic_vars.frac, player->mo->y - player->mo->PrevY); + viewz = player->prev_viewz + FixedMul (tic_vars.frac, player->viewz - player->prev_viewz); - viewangle = player->prev_viewangle + FixedMul (frac, R_SmoothPlaying_Get(player->mo->angle) - player->prev_viewangle) + viewangleoffset; + viewangle = player->prev_viewangle + FixedMul (tic_vars.frac, R_SmoothPlaying_Get(player->mo->angle) - player->prev_viewangle) + viewangleoffset; + //viewpitch = player->prev_viewpitch + FixedMul (frac, player->mo->pitch - player->prev_viewpitch) + viewpitchoffset; } else { @@ -119,18 +120,19 @@ void R_InterpolateView (player_t *player) viewz = player->viewz; viewangle = R_SmoothPlaying_Get(player->mo->angle) + viewangleoffset; + //viewpitch = player->mo->pitch + viewpitchoffset; } if (!paused && movement_smooth) { int i; - didInterp = frac != FRACUNIT; + didInterp = tic_vars.frac != FRACUNIT; if (didInterp) { for (i = numinterpolations - 1; i >= 0; i--) { - R_DoAnInterpolation (i, frac); + R_DoAnInterpolation (i, tic_vars.frac); } } }