Debian Codegraph @

prboom2/src/dsda/pause.c

raw
1 //
2 // Copyright(C) 2022 by Ryan Krafnick
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 // DSDA Pause Mode
16 //
17
18 #include "doomstat.h"
19 #include "e6y.h"
20
21 #include "pause.h"
22
23 static dboolean paused;
24
25 dboolean dsda_Paused(void) {
26 return paused != 0;
27 }
28
29 dboolean dsda_PausedViaMenu(void) {
30 return menuactive && !netgame;
31 }
32
33 dboolean dsda_PausedOutsideDemo(void) {
34 return dsda_PauseMode(PAUSE_PLAYBACK | PAUSE_BUILDMODE) || dsda_PausedViaMenu();
35 }
36
37 dboolean dsda_CameraPaused(void) {
38 return paused && !walkcamera.type;
39 }
40
41 dboolean dsda_PauseMode(int mode) {
42 return (paused & mode) != 0;
43 }
44
45 void dsda_RemovePauseMode(int mode) {
46 paused &= ~mode;
47 }
48
49 void dsda_ApplyPauseMode(int mode) {
50 paused |= mode;
51 }
52
53 void dsda_TogglePauseMode(int mode) {
54 paused ^= mode;
55 }
56
57 void dsda_ResetPauseMode(void) {
58 paused = 0;
59 }
60
61 int dsda_MaskPause(void) {
62 int mask;
63
64 mask = paused & ~PAUSE_COMMAND;
65 paused &= PAUSE_COMMAND;
66
67 return mask;
68 }
69
70 void dsda_UnmaskPause(int mask) {
71 paused |= mask;
72 }