Fix game pause

This commit is contained in:
nukeykt 2019-11-15 01:08:50 +09:00 committed by Christoph Oelckers
parent 7049070721
commit 62ccf7712a

View file

@ -1142,6 +1142,7 @@ short wConsoleNode; // TODO - move me into network file
int mouseaiming, aimmode, mouseflip;
int runkey_mode, auto_run;
ClockTicks tclocks, tclocks2;
void DebugOut(const char *fmt, ...)
{
@ -1504,18 +1505,19 @@ void CheckKeys()
{
if (bPause)
{
ototalclock = totalclock = tclocks;
bPause = kFalse;
KB_KeyDown[sc_Pause] = 0;
}
else
{
bPause = kTrue;
NoClip();
int nLen = MyGetStringWidth("PAUSED");
myprintext((320 - nLen) / 2, 100, "PAUSED", 0);
Clip();
videoNextPage();
// NoClip();
// int nLen = MyGetStringWidth("PAUSED");
// myprintext((320 - nLen) / 2, 100, "PAUSED", 0);
// Clip();
// videoNextPage();
}
KB_KeyDown[sc_Pause] = 0;
}
return;
}
@ -1989,7 +1991,7 @@ static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk
// {
// return 65536;
// }
if (bRecord || bPlayback || nFreeze != 0 || bCamera)
if (bRecord || bPlayback || nFreeze != 0 || bCamera || bPause)
return 65536;
int32_t rfreq = (refreshfreq != -1 ? refreshfreq : 60);
uint64_t elapsedFrames = tabledivide64(((uint64_t) (totalclk - ototalclk).toScale16()) * rfreq, 65536*120);
@ -2000,8 +2002,6 @@ static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk
return clamp(tabledivide64(65536*elapsedFrames*30, rfreq), 0, 65536);
}
ClockTicks tclocks, tclocks2;
static void GameDisplay(void)
{
// End Section B
@ -2039,6 +2039,12 @@ static void GameDisplay(void)
#endif
}
if (bPause)
{
int nLen = MyGetStringWidth("PAUSED");
myprintext((320 - nLen) / 2, 100, "PAUSED", 0);
}
videoNextPage();
}