fabiangreffrath / crispy-doom

Crispy Doom is a limit-removing enhanced-resolution Doom source port based on Chocolate Doom.
https://fabiangreffrath.github.io/crispy-homepage
GNU General Public License v2.0
807 stars 132 forks source link

loading a game while recording a demo doesn't unpause #393

Closed fabiangreffrath closed 5 years ago

fabiangreffrath commented 5 years ago

Reported here:

https://www.doomworld.com/forum/topic/67168-crispy-doom-551-update-march-7-2019/?page=40&tab=comments#comment-1972083

fabiangreffrath commented 5 years ago

The problem is that G_InitNew(), which gets called by G_DoLoadGame(), unconditionally sets paused = false. Since we still have setpause = true, we trigger a BTS_PAUSE button press in the changed code block, which will get interpreted as entering pause again (instead of actually un-pausing) in the next tic.

I am sure this patch fixes the original issue, i.e. the game doesn't un-pause after loading during demo recording. I am not sure, though, if this also fixes the silent un-pausing during the savegame loading confirmation menu that @Zodomaniac reported in #396 .

diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 32af667d..d449afd2 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -751,7 +751,7 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic)
     {
        sendpause = false;
        // [crispy] ignore un-pausing in menus during demo recording
-       if (!(menuactive && demorecording && paused))
+       if (!(menuactive && demorecording && paused) && gameaction != ga_loadgame)
        {
        cmd->buttons = BT_SPECIAL | BTS_PAUSE;
        }