Various fixes and tweaks to rewinds

This commit is contained in:
fickleheart 2019-04-06 18:06:02 -05:00
parent 1f2adee119
commit aaa6418981
2 changed files with 26 additions and 11 deletions

View file

@ -5939,6 +5939,10 @@ void G_PreviewRewind(tic_t previewtime)
size_t i, j; size_t i, j;
fixed_t tweenvalue = 0; fixed_t tweenvalue = 0;
rewindinfo_t *info = rewindhead, *next_info = rewindhead; rewindinfo_t *info = rewindhead, *next_info = rewindhead;
if (!info)
return;
while (info->leveltime > previewtime && info->prev) while (info->leveltime > previewtime && info->prev)
{ {
next_info = info; next_info = info;
@ -5947,6 +5951,7 @@ void G_PreviewRewind(tic_t previewtime)
if (info != next_info) if (info != next_info)
tweenvalue = FixedDiv(previewtime - info->leveltime, next_info->leveltime - info->leveltime); tweenvalue = FixedDiv(previewtime - info->leveltime, next_info->leveltime - info->leveltime);
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (!playeringame[i] || players[i].spectator) if (!playeringame[i] || players[i].spectator)
@ -5998,16 +6003,23 @@ void G_PreviewRewind(tic_t previewtime)
void G_ConfirmRewind(tic_t rewindtime) void G_ConfirmRewind(tic_t rewindtime)
{ {
tic_t i; tic_t i;
boolean oldmenuactive = menuactive, oldsounddisabled = sound_disabled, olddigitaldisabled = digital_disabled; boolean oldmenuactive = menuactive, oldsounddisabled = sound_disabled;
INT32 olddp1 = displayplayer, olddp2 = secondarydisplayplayer, olddp3 = thirddisplayplayer, olddp4 = fourthdisplayplayer; INT32 olddp1 = displayplayer, olddp2 = secondarydisplayplayer, olddp3 = thirddisplayplayer, olddp4 = fourthdisplayplayer;
UINT8 oldss = splitscreen; UINT8 oldss = splitscreen;
cv_renderview.value = 0;
menuactive = false; // Prevent loops menuactive = false; // Prevent loops
sound_disabled = /*digital_disabled =*/ true; // Prevent sound spam
demo.rewinding = true; // may not need later CV_StealthSetValue(&cv_renderview, 0);
if (rewindtime > starttime)
{
sound_disabled = true; // Prevent sound spam
demo.rewinding = true;
}
else
demo.rewinding = false;
G_DoPlayDemo(NULL); // Restart the current demo G_DoPlayDemo(NULL); // Restart the current demo
for (i = 0; i < rewindtime && leveltime < rewindtime; i++) for (i = 0; i < rewindtime && leveltime < rewindtime; i++)
@ -6019,11 +6031,10 @@ void G_ConfirmRewind(tic_t rewindtime)
demo.rewinding = false; demo.rewinding = false;
menuactive = oldmenuactive; // Bring the menu back up menuactive = oldmenuactive; // Bring the menu back up
sound_disabled = oldsounddisabled; // Re-enable SFX sound_disabled = oldsounddisabled; // Re-enable SFX
digital_disabled = olddigitaldisabled;
wipegamestate = gamestate; // No fading back in! wipegamestate = gamestate; // No fading back in!
cv_renderview.value = 1; COM_BufInsertText("renderview on\n");
splitscreen = oldss; splitscreen = oldss;
displayplayer = olddp1; displayplayer = olddp1;

View file

@ -5759,7 +5759,7 @@ static void M_DrawPlaybackMenu(void)
else else
icon = W_CachePatchName("PLAYRANK", PU_CACHE); // temp icon = W_CachePatchName("PLAYRANK", PU_CACHE); // temp
if (i == playback_fastforward && cv_playbackspeed.value > 1) if ((i == playback_fastforward && cv_playbackspeed.value > 1) || (i == playback_rewind && demo.rewinding))
V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, 0, icon, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SILVER, GTC_MENUCACHE)); V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, 0, icon, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SILVER, GTC_MENUCACHE));
else else
V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, 0, icon, (i == itemOn) ? activemap : inactivemap); V_DrawMappedPatch(currentMenu->x + currentMenu->menuitems[i].alphaKey, currentMenu->y, 0, icon, (i == itemOn) ? activemap : inactivemap);
@ -5771,6 +5771,8 @@ static void M_DrawPlaybackMenu(void)
static void M_PlaybackRewind(INT32 choice) static void M_PlaybackRewind(INT32 choice)
{ {
static tic_t lastconfirmtime;
(void)choice; (void)choice;
if (!demo.rewinding) if (!demo.rewinding)
@ -5784,11 +5786,13 @@ static void M_PlaybackRewind(INT32 choice)
else else
demo.rewinding = paused = true; demo.rewinding = paused = true;
} }
else else if (lastconfirmtime + TICRATE/2 < I_GetTime())
{
lastconfirmtime = I_GetTime();
G_ConfirmRewind(leveltime); G_ConfirmRewind(leveltime);
}
// temp CV_SetValue(&cv_playbackspeed, 1);
//G_ConfirmRewind(starttime + 90*TICRATE);
} }
static void M_PlaybackPause(INT32 choice) static void M_PlaybackPause(INT32 choice)