SW: Amend how game pauses.

- Pausing game with Pause key now works again.
This commit is contained in:
Mitchell Richters 2020-05-29 10:32:53 +10:00 committed by Christoph Oelckers
parent b86d499e0b
commit 33b6b85d57
9 changed files with 51 additions and 96 deletions

View file

@ -64,7 +64,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
static int OverlapDraw = FALSE; static int OverlapDraw = FALSE;
extern SWBOOL QuitFlag, LocationInfo, ConPanel, SpriteInfo, PauseKeySet; extern SWBOOL QuitFlag, LocationInfo, ConPanel, SpriteInfo;
extern SWBOOL Voxel; extern SWBOOL Voxel;
extern char buffer[]; extern char buffer[];
SWBOOL DrawScreen; SWBOOL DrawScreen;
@ -1071,7 +1071,7 @@ static ClockTicks mapzoomclock;
void void
ResizeView(PLAYERp pp) ResizeView(PLAYERp pp)
{ {
if (M_Active() || PauseKeySet) if (M_Active() || paused)
return; return;
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6) if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
@ -2027,7 +2027,7 @@ drawscreen(PLAYERp pp)
smoothratio = CalcSmoothRatio(totalclock, ototalclock, 120 / synctics); smoothratio = CalcSmoothRatio(totalclock, ototalclock, 120 / synctics);
if (GamePaused && !ReloadPrompt) // The checks were brought over from domovethings if (paused && !ReloadPrompt) // The checks were brought over from domovethings
smoothratio = 65536; smoothratio = 65536;
if (!ScreenSavePic) if (!ScreenSavePic)
@ -2327,6 +2327,26 @@ drawscreen(PLAYERp pp)
if (cl_sointerpolation) if (cl_sointerpolation)
so_restoreinterpolations(); // Stick at end of drawscreen so_restoreinterpolations(); // Stick at end of drawscreen
if (paused && !M_Active())
{
short w,h;
#define MSG_GAME_PAUSED "Game Paused"
MNU_MeasureString(MSG_GAME_PAUSED, &w, &h);
PutStringTimer(pp, TEXT_TEST_COL(w), 100, MSG_GAME_PAUSED, 999);
}
else
{
pClearTextLine(pp, 100);
}
if (!CommEnabled && TEST(pp->Flags, PF_DEAD))
{
if (ReloadPrompt)
{
ReloadPrompt = FALSE;
}
}
PostDraw(); PostDraw();
DrawScreen = FALSE; DrawScreen = FALSE;
} }

View file

@ -224,8 +224,6 @@ const GAME_SET gs_defaults =
GAME_SET gs; GAME_SET gs;
SWBOOL PlayerTrackingMode = FALSE; SWBOOL PlayerTrackingMode = FALSE;
SWBOOL PauseMode = FALSE;
SWBOOL PauseKeySet = FALSE;
SWBOOL SlowMode = FALSE; SWBOOL SlowMode = FALSE;
SWBOOL FrameAdvanceTics = 3; SWBOOL FrameAdvanceTics = 3;
SWBOOL ScrollMode2D = FALSE; SWBOOL ScrollMode2D = FALSE;
@ -2437,10 +2435,6 @@ void MoveLoop(void)
// demosync_record(); // demosync_record();
#endif #endif
} }
// Get input again to update q16ang/q16horiz.
if (!PedanticMode)
getinput(&loc, TRUE);
} }
@ -2577,17 +2571,26 @@ void RunLevel(void)
return; // Stop the game loop if a savegame was loaded from the menu. return; // Stop the game loop if a savegame was loaded from the menu.
} }
if (M_Active() || GUICapture || GamePaused) updatePauseStatus();
if (paused)
{ {
ototalclock = (int)totalclock - (120 / synctics); ototalclock = (int)totalclock - (120 / synctics);
buttonMap.ResetButtonStates(); buttonMap.ResetButtonStates();
} }
else else
{ {
faketimerhandler(); while (ready2send && (totalclock >= ototalclock + synctics))
{
UpdateInputs();
MoveLoop(); MoveLoop();
} }
// Get input again to update q16ang/q16horiz.
if (!PedanticMode)
getinput(&loc, TRUE);
}
drawscreen(Player + screenpeek); drawscreen(Player + screenpeek);
if (QuitFlag) if (QuitFlag)
@ -2600,8 +2603,6 @@ void RunLevel(void)
} }
timerUpdateClock(); timerUpdateClock();
while (ready2send && (totalclock >= ototalclock + synctics))
UpdateInputs();
} }
ready2send = 0; ready2send = 0;
@ -2990,53 +2991,6 @@ FunctionKeys(PLAYERp pp)
} }
} }
void PauseKey(PLAYERp pp)
{
extern SWBOOL CheatInputMode;
if (inputState.GetKeyStatus(sc_Pause) && !CommEnabled && !InputMode && !M_Active() && !CheatInputMode && !ConPanel)
{
inputState.ClearKeyStatus(sc_Pause);
PauseKeySet ^= 1;
if (PauseKeySet)
GamePaused = TRUE;
else
GamePaused = FALSE;
if (GamePaused)
{
short w,h;
#define MSG_GAME_PAUSED "Game Paused"
MNU_MeasureString(MSG_GAME_PAUSED, &w, &h);
PutStringTimer(pp, TEXT_TEST_COL(w), 100, MSG_GAME_PAUSED, 999);
Mus_SetPaused(true);
}
else
{
pClearTextLine(pp, 100);
Mus_SetPaused(false);
}
}
if (!CommEnabled && TEST(pp->Flags, PF_DEAD))
{
if (ReloadPrompt)
{
ReloadPrompt = FALSE;
/*
}
else
{
inputState.SetKeyStatus(sc_Escape);
ControlPanelType = ct_quickloadmenu;
}
*/
}
}
}
short MirrorDelay; short MirrorDelay;
double elapsedInputTicks; double elapsedInputTicks;
@ -3105,9 +3059,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
ControlInfo info; ControlInfo info;
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
PauseKey(pp); if (paused)
if (PauseKeySet)
return; return;
// MAP KEY // MAP KEY

View file

@ -2392,7 +2392,6 @@ void sendlogoff(void);
extern int ototalclock, save_totalclock, gotlastpacketclock,smoothratio; extern int ototalclock, save_totalclock, gotlastpacketclock,smoothratio;
extern SWBOOL ready2send; extern SWBOOL ready2send;
extern SWBOOL GamePaused;
// local copy of variables updated by faketimerhandler // local copy of variables updated by faketimerhandler
extern int locselectedgun; extern int locselectedgun;

View file

@ -29,6 +29,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "baselayer.h" #include "baselayer.h"
#include "mmulti.h" #include "mmulti.h"
#include "gamecontrol.h"
#include "keys.h" #include "keys.h"
#include "game.h" #include "game.h"
#include "tags.h" #include "tags.h"
@ -70,7 +72,6 @@ SYNC BUG NOTES:
//#define MAXSYNCBYTES 16 //#define MAXSYNCBYTES 16
static uint8_t tempbuf[576], packbuf[576]; static uint8_t tempbuf[576], packbuf[576];
int PlayClock; int PlayClock;
extern SWBOOL PauseKeySet;
gNET gNet; gNET gNet;
extern short PlayerQuitMenuLevel; extern short PlayerQuitMenuLevel;
@ -128,7 +129,6 @@ int save_totalclock;
// must start out as 0 // must start out as 0
SWBOOL GamePaused = FALSE;
SWBOOL NetBroadcastMode = TRUE; SWBOOL NetBroadcastMode = TRUE;
SWBOOL NetModeOverride = FALSE; SWBOOL NetModeOverride = FALSE;
@ -385,33 +385,17 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
return buf - base_ptr; return buf - base_ptr;
} }
void
PauseGame(void)
{
if (PauseKeySet)
return;
if (DemoPlaying || DemoRecording)
return;
if (GamePaused)
return;
if (numplayers < 2)
GamePaused = TRUE;
}
void void
ResumeGame(void) ResumeGame(void)
{ {
if (PauseKeySet) if (paused)
return; return;
if (DemoPlaying || DemoRecording) if (DemoPlaying || DemoRecording)
return; return;
if (numplayers < 2) if (numplayers < 2)
GamePaused = FALSE; paused = 0;
} }
void void

View file

@ -186,7 +186,6 @@ void SendVersion(int version);
void InitNetPlayerOptions(void); void InitNetPlayerOptions(void);
void CheckVersion(int GameVersion); void CheckVersion(int GameVersion);
void SW_SendMessage(short pnum,const char *text); void SW_SendMessage(short pnum,const char *text);
void PauseGame(void);
void ResumeGame(void); void ResumeGame(void);
END_SW_NS END_SW_NS

View file

@ -6229,7 +6229,7 @@ pChopsShake(PANEL_SPRITEp psp)
void void
pChopsWait(PANEL_SPRITEp psp) pChopsWait(PANEL_SPRITEp psp)
{ {
//if (!GamePaused && RANDOM_P2(1024) < 10) //if (!paused && RANDOM_P2(1024) < 10)
if (RANDOM_P2(1024) < 10) if (RANDOM_P2(1024) < 10)
{ {
// random x position // random x position

View file

@ -7846,9 +7846,9 @@ void PauseMultiPlay(void)
{ {
FLAG_KEY_RELEASE(pp, SK_PAUSE); FLAG_KEY_RELEASE(pp, SK_PAUSE);
GamePaused ^= 1; paused ^= 1;
if (GamePaused) if (paused)
{ {
short w,h; short w,h;
auto m = GStrings("Game Paused"); auto m = GStrings("Game Paused");
@ -7859,14 +7859,12 @@ void PauseMultiPlay(void)
SavePrediction = PredictionOn; SavePrediction = PredictionOn;
PredictionOn = FALSE; PredictionOn = FALSE;
Mus_SetPaused(true);
} }
else else
{ {
PredictionOn = SavePrediction; PredictionOn = SavePrediction;
TRAVERSE_CONNECT(p) TRAVERSE_CONNECT(p)
pClearTextLine(Player + p, 100); pClearTextLine(Player + p, 100);
Mus_SetPaused(false);
} }
} }
} }
@ -7962,8 +7960,7 @@ domovethings(void)
#if 0 #if 0
{ {
extern SWBOOL PauseKeySet; if (inputState.GetKeyStatus(KEYSC_F5) && !(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)) && !paused)
if (inputState.GetKeyStatus(KEYSC_F5) && !(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)) && !PauseKeySet)
{ {
inputState.GetKeyStatus(KEYSC_F5) = 0; inputState.GetKeyStatus(KEYSC_F5) = 0;
ResChange(); ResChange();
@ -7991,7 +7988,7 @@ domovethings(void)
DoPlayerMenuKeys(pp); DoPlayerMenuKeys(pp);
} }
if (GamePaused) if (paused)
{ {
if (!ReloadPrompt) if (!ReloadPrompt)
return; return;

View file

@ -28,6 +28,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "build.h" #include "build.h"
#include "common.h" #include "common.h"
#include "gamecontrol.h"
#include "names2.h" #include "names2.h"
#include "game.h" #include "game.h"
#include "tags.h" #include "tags.h"
@ -190,7 +192,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a
*y_diff = 0; *y_diff = 0;
*ang_diff = 0; *ang_diff = 0;
if (GamePaused) if (paused)
return; return;
// find the closest quake - should be a strength value // find the closest quake - should be a strength value

View file

@ -26,6 +26,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ns.h" #include "ns.h"
#include "build.h" #include "build.h"
#include "gamecontrol.h"
#include "names2.h" #include "names2.h"
#include "game.h" #include "game.h"
#include "tags.h" #include "tags.h"
@ -91,7 +93,7 @@ void VisViewChange(PLAYERp pp, int *vis)
int x,y,z; int x,y,z;
short sectnum; short sectnum;
if (GamePaused) if (paused)
return; return;
// find the closest quake - should be a strength value // find the closest quake - should be a strength value