diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 9b4d9e25a..adae3df9b 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -64,7 +64,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS static int OverlapDraw = FALSE; -extern SWBOOL QuitFlag, LocationInfo, ConPanel, SpriteInfo, PauseKeySet; +extern SWBOOL QuitFlag, LocationInfo, ConPanel, SpriteInfo; extern SWBOOL Voxel; extern char buffer[]; SWBOOL DrawScreen; @@ -1071,7 +1071,7 @@ static ClockTicks mapzoomclock; void ResizeView(PLAYERp pp) { - if (M_Active() || PauseKeySet) + if (M_Active() || paused) return; if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6) @@ -2027,7 +2027,7 @@ drawscreen(PLAYERp pp) 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; if (!ScreenSavePic) @@ -2327,6 +2327,26 @@ drawscreen(PLAYERp pp) if (cl_sointerpolation) 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(); DrawScreen = FALSE; } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 83e221220..6f66487e9 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -224,8 +224,6 @@ const GAME_SET gs_defaults = GAME_SET gs; SWBOOL PlayerTrackingMode = FALSE; -SWBOOL PauseMode = FALSE; -SWBOOL PauseKeySet = FALSE; SWBOOL SlowMode = FALSE; SWBOOL FrameAdvanceTics = 3; SWBOOL ScrollMode2D = FALSE; @@ -2437,10 +2435,6 @@ void MoveLoop(void) // demosync_record(); #endif } - - // Get input again to update q16ang/q16horiz. - if (!PedanticMode) - getinput(&loc, TRUE); } @@ -2577,15 +2571,24 @@ void RunLevel(void) 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); buttonMap.ResetButtonStates(); } else { - faketimerhandler(); - MoveLoop(); + while (ready2send && (totalclock >= ototalclock + synctics)) + { + UpdateInputs(); + MoveLoop(); + } + + // Get input again to update q16ang/q16horiz. + if (!PedanticMode) + getinput(&loc, TRUE); } drawscreen(Player + screenpeek); @@ -2600,8 +2603,6 @@ void RunLevel(void) } timerUpdateClock(); - while (ready2send && (totalclock >= ototalclock + synctics)) - UpdateInputs(); } 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; double elapsedInputTicks; @@ -3105,9 +3059,7 @@ getinput(SW_PACKET *loc, SWBOOL tied) ControlInfo info; CONTROL_GetInput(&info); - PauseKey(pp); - - if (PauseKeySet) + if (paused) return; // MAP KEY diff --git a/source/sw/src/game.h b/source/sw/src/game.h index d59c06032..1ab36ea9e 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2392,7 +2392,6 @@ void sendlogoff(void); extern int ototalclock, save_totalclock, gotlastpacketclock,smoothratio; extern SWBOOL ready2send; -extern SWBOOL GamePaused; // local copy of variables updated by faketimerhandler extern int locselectedgun; diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index 85f51f3fd..af412722e 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -29,6 +29,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "baselayer.h" #include "mmulti.h" +#include "gamecontrol.h" + #include "keys.h" #include "game.h" #include "tags.h" @@ -70,7 +72,6 @@ SYNC BUG NOTES: //#define MAXSYNCBYTES 16 static uint8_t tempbuf[576], packbuf[576]; int PlayClock; -extern SWBOOL PauseKeySet; gNET gNet; extern short PlayerQuitMenuLevel; @@ -128,7 +129,6 @@ int save_totalclock; // must start out as 0 -SWBOOL GamePaused = FALSE; SWBOOL NetBroadcastMode = TRUE; SWBOOL NetModeOverride = FALSE; @@ -385,33 +385,17 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf) return buf - base_ptr; } -void -PauseGame(void) -{ - if (PauseKeySet) - return; - - if (DemoPlaying || DemoRecording) - return; - - if (GamePaused) - return; - - if (numplayers < 2) - GamePaused = TRUE; -} - void ResumeGame(void) { - if (PauseKeySet) + if (paused) return; if (DemoPlaying || DemoRecording) return; if (numplayers < 2) - GamePaused = FALSE; + paused = 0; } void diff --git a/source/sw/src/network.h b/source/sw/src/network.h index 2d91154a3..acee18989 100644 --- a/source/sw/src/network.h +++ b/source/sw/src/network.h @@ -186,7 +186,6 @@ void SendVersion(int version); void InitNetPlayerOptions(void); void CheckVersion(int GameVersion); void SW_SendMessage(short pnum,const char *text); -void PauseGame(void); void ResumeGame(void); END_SW_NS diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index c2ef56e02..e444389dd 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -6229,7 +6229,7 @@ pChopsShake(PANEL_SPRITEp psp) void pChopsWait(PANEL_SPRITEp psp) { - //if (!GamePaused && RANDOM_P2(1024) < 10) + //if (!paused && RANDOM_P2(1024) < 10) if (RANDOM_P2(1024) < 10) { // random x position diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 22fff4782..4b9bf4c05 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -7846,9 +7846,9 @@ void PauseMultiPlay(void) { FLAG_KEY_RELEASE(pp, SK_PAUSE); - GamePaused ^= 1; + paused ^= 1; - if (GamePaused) + if (paused) { short w,h; auto m = GStrings("Game Paused"); @@ -7859,14 +7859,12 @@ void PauseMultiPlay(void) SavePrediction = PredictionOn; PredictionOn = FALSE; - Mus_SetPaused(true); } else { PredictionOn = SavePrediction; TRAVERSE_CONNECT(p) pClearTextLine(Player + p, 100); - Mus_SetPaused(false); } } } @@ -7962,8 +7960,7 @@ domovethings(void) #if 0 { - extern SWBOOL PauseKeySet; - if (inputState.GetKeyStatus(KEYSC_F5) && !(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)) && !PauseKeySet) + if (inputState.GetKeyStatus(KEYSC_F5) && !(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)) && !paused) { inputState.GetKeyStatus(KEYSC_F5) = 0; ResChange(); @@ -7991,7 +7988,7 @@ domovethings(void) DoPlayerMenuKeys(pp); } - if (GamePaused) + if (paused) { if (!ReloadPrompt) return; diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index 5dbafad17..a007bcf61 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -28,6 +28,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "build.h" #include "common.h" +#include "gamecontrol.h" + #include "names2.h" #include "game.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; *ang_diff = 0; - if (GamePaused) + if (paused) return; // find the closest quake - should be a strength value diff --git a/source/sw/src/vis.cpp b/source/sw/src/vis.cpp index 2b9415ab9..5f00c8544 100644 --- a/source/sw/src/vis.cpp +++ b/source/sw/src/vis.cpp @@ -26,6 +26,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "build.h" +#include "gamecontrol.h" + #include "names2.h" #include "game.h" #include "tags.h" @@ -91,7 +93,7 @@ void VisViewChange(PLAYERp pp, int *vis) int x,y,z; short sectnum; - if (GamePaused) + if (paused) return; // find the closest quake - should be a strength value