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
800 stars 131 forks source link

After saving a savegame while recording a demo, the game remains paused #293

Closed SoDOOManiac closed 6 years ago

SoDOOManiac commented 6 years ago

If you save a savegame while recording a demo, the game remains paused, with 'Pause' word on the screen. I have to ESC to the menu and then out of it to resume game. doom0047 P.S. Checked Choco behavior: it doesn't get stuck in a pause after saving game in a demo, but the demo desyncs on playback.

fabiangreffrath commented 6 years ago

Checked Choco behavior: it doesn't get stuck in a pause after saving game in a demo, but the demo desyncs on playback.

That's the very reason why Crispy switches to pause as soon as the demo is entered.

However, it should switch back when the demo is left, need to investigate that...

SoDOOManiac commented 6 years ago

However, it should switch back when the demo is left

What exactly do you mean, what should 'switch back' upon leaving the demo (entering the menu)?

fabiangreffrath commented 6 years ago

During demo recording, entering the menus should switch the game to pause and leaving the menus again should unpause the game.

fabiangreffrath commented 6 years ago

BTW, was this save or quicksave?

SoDOOManiac commented 6 years ago

No matter if the save was quick or not, one gets stuck in a pause after save. So you say it's a price paid to keep demos in sync?

fabiangreffrath commented 6 years ago

Okay, I think I understand why this doesn't work: It is currently impossible to send both a "pause/unpause" and a "save game" event within the same tic. See how the "save game" event overrides the cmd->buttons field just after is has been set to BTS_PAUSE:

https://github.com/fabiangreffrath/crispy-doom/blob/HEAD/src/doom/g_game.c#L724

fabiangreffrath commented 6 years ago

I guess this works:

--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -1177,6 +1177,10 @@ void G_Ticker (void)
                    savegameslot =
                        (players[i].cmd.buttons & BTS_SAVEMASK)>>BTS_SAVESHIFT;
                    gameaction = ga_savegame;
+                   // [crispy] un-pause immediately after saving
+                   // (impossible to send save and pause specials within the same tic)
+                   if (demorecording && paused)
+                       sendpause = true;
                    break;
                }
            }