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
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;
}

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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