diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cc16907fa..fdda510dd 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2878,7 +2878,7 @@ static void Got_Mapcmd(const UINT8 **cp, INT32 playernum) if (demo.playback && !demo.timing) precache = false; - demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING; + demo.willsave = (cv_recordmultiplayerdemos.value == 2); demo.savebutton = 0; G_InitNew(pencoremode, mapnumber, presetplayer, skipprecutscene); diff --git a/src/g_demo.cpp b/src/g_demo.cpp index 71cef6e81..28e92b027 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -3992,7 +3992,7 @@ boolean G_CheckDemoStatus(void) if (!demo.recording) return false; - if (modeattacking || demo.savemode != demovars_s::DSM_NOTSAVING) + if (modeattacking || demo.willsave) { if (demobuf.p) { @@ -4081,14 +4081,13 @@ void G_SaveDemo(void) md5_buffer((char *)p+16, (demobuf.buffer + length) - (p+16), p); #endif - if (FIL_WriteFile(demoname, demobuf.buffer, demobuf.p - demobuf.buffer)) // finally output the file. - demo.savemode = demovars_s::DSM_SAVED; + bool saved = FIL_WriteFile(demoname, demobuf.buffer, demobuf.p - demobuf.buffer); // finally output the file. Z_Free(demobuf.buffer); demo.recording = false; if (!modeattacking) { - if (demo.savemode == demovars_s::DSM_SAVED) + if (saved) { CONS_Printf(M_GetText("Demo %s recorded\n"), demoname); if (gamedata->eversavedreplay == false) @@ -4111,7 +4110,7 @@ boolean G_CheckDemoTitleEntry(void) if (!G_PlayerInputDown(0, gc_b, 0) && !G_PlayerInputDown(0, gc_x, 0)) return false; - demo.savemode = demovars_s::DSM_WILLSAVE; + demo.willsave = true; M_OpenVirtualKeyboard( false, [](const char* replace) -> const char* diff --git a/src/g_demo.h b/src/g_demo.h index 85b4d65f7..91b2c7ee7 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -90,12 +90,7 @@ struct demovars_s { boolean netgame; // multiplayer netgame tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going - enum { - DSM_NOTSAVING, - DSM_WILLAUTOSAVE, - DSM_WILLSAVE, - DSM_SAVED - } savemode; + boolean willsave; boolean freecam; diff --git a/src/g_game.c b/src/g_game.c index 79e5bd91e..3ca13d642 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4549,7 +4549,7 @@ void G_AfterIntermission(void) M_PlaybackQuit(0); return; } - else if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING)) + else if (demo.recording && (modeattacking || demo.willsave)) G_SaveDemo(); if (modeattacking) // End the run. diff --git a/src/p_tick.c b/src/p_tick.c index 1d273e328..3e1e2bb1c 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -1178,9 +1178,8 @@ void P_Ticker(boolean run) { G_WriteAllGhostTics(); - if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE)) - if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) - G_CheckDemoTitleEntry(); + if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) + G_CheckDemoTitleEntry(); } else if (demo.playback) // Use Ghost data for consistency checks. { diff --git a/src/st_stuff.c b/src/st_stuff.c index b2a2bbc41..65f048b7c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1459,26 +1459,11 @@ void ST_DrawServerSplash(boolean timelimited) void ST_DrawSaveReplayHint(INT32 flags) { - const char *text = ""; - switch (demo.savemode) - { - case DSM_NOTSAVING: - text = "\xAB" "or " "\xAE" "Save replay"; - break; - - case DSM_WILLAUTOSAVE: - text = "Replay will be saved. \xAB" "Change title"; - break; - - case DSM_WILLSAVE: - text = "Replay will be saved."; - break; - - case DSM_SAVED: - text = "Replay saved!"; - break; - } - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, flags|V_YELLOWMAP, text); + V_DrawRightAlignedThinString( + BASEVIDWIDTH - 2, 2, + flags|V_YELLOWMAP, + demo.willsave ? "Replay will be saved. \xAB" "Change title" : "\xAB" "or " "\xAE" "Save replay" + ); } static fixed_t ST_CalculateFadeIn(player_t *player) diff --git a/src/y_inter.cpp b/src/y_inter.cpp index 13a5e6ba1..688afbd8c 100644 --- a/src/y_inter.cpp +++ b/src/y_inter.cpp @@ -80,7 +80,6 @@ static INT32 powertype = PWRLV_DISABLED; static INT32 intertic; static INT32 endtic = -1; static INT32 sorttic = -1; -static INT32 replayprompttic; static fixed_t mqscroll = 0; static fixed_t chkscroll = 0; @@ -1690,12 +1689,8 @@ skiptallydrawer: } finalcounter: - { - if ((modeattacking == ATTACKING_NONE) && (demo.recording || demo.savemode == demovars_s::DSM_SAVED) && !demo.playback) - { - ST_DrawSaveReplayHint(0); - } - } + if ((modeattacking == ATTACKING_NONE) && demo.recording) + ST_DrawSaveReplayHint(0); if (Y_CanSkipIntermission()) { @@ -1731,13 +1726,7 @@ void Y_Ticker(void) return; if (demo.recording) - { - if (demo.savemode == demovars_s::DSM_NOTSAVING) - { - replayprompttic++; - G_CheckDemoTitleEntry(); - } - } + G_CheckDemoTitleEntry(); // Check for pause or menu up in single player if (paused || P_AutoPause())