Debian Codegraph @

common/include/args.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Prototypes for accessing arguments.
23 *
24 */
25
26 #pragma once
27
28 #include <span>
29 #include <type_traits>
30 #include "dxxsconf.h"
31 #include <cstdint>
32
33 #if DXX_USE_OGL
34 // GL Sync methods
35 enum SyncGLMethod : uint8_t {
36 SYNC_GL_NONE=0,
37 SYNC_GL_FENCE,
38 SYNC_GL_FENCE_SLEEP,
39 SYNC_GL_FINISH_AFTER_SWAP,
40 SYNC_GL_FINISH_BEFORE_SWAP,
41 SYNC_GL_AUTO
42 };
43
44 #define OGL_SYNC_METHOD_DEFAULT SYNC_GL_AUTO
45 #define OGL_SYNC_WAIT_DEFAULT 2 /* milliseconds */
46
47 #endif
48
49 // Struct that keeps all variables used by FindArg
50 // Prefixes are:
51 // Sys - System Options
52 // Ctl - Control Options
53 // Snd - Sound Options
54 // Gfx - Graphics Options
55 // Ogl - OpenGL Options
56 // Mpl - Multiplayer Options
57 // Edi - Editor Options
58 // Dbg - Debugging/Undocumented Options
59 #include <string>
60 #include "dxxsconf.h"
61 #include "dsx-ns.h"
62 #include "pack.h"
63
64 namespace dcx {
65
66 enum class sound_sample_rate : uint16_t;
67 enum class digi_mixer_method : uint8_t;
68
69 struct CArg : prohibit_void_ptr<CArg>
70 {
71 bool CtlNoCursor;
72 bool CtlNoMouse;
73 bool CtlNoStickyKeys;
74 bool DbgForbidConsoleGrab;
75 bool DbgShowMemInfo;
76 bool DbgSafelog;
77 bool SysShowCmdHelp;
78 bool SysLowMem;
79 int8_t SysUsePlayersDir;
80 bool SysAutoRecordDemo;
81 bool SysWindow;
82 bool SysAutoDemo;
83 bool GfxSkipHiresFNT;
84 bool SndNoSound;
85 bool SndNoMusic;
86 bool SysNoBorders;
87 bool SysNoTitles;
88 #if DXX_USE_SDLMIXER
89 bool SndDisableSdlMixer;
90 digi_mixer_method SndMixerMethod;
91 #else
92 static constexpr std::true_type SndDisableSdlMixer{};
93 #endif
94 #if DXX_MAX_JOYSTICKS
95 bool CtlNoJoystick;
96 #else
97 static constexpr std::true_type CtlNoJoystick{};
98 #endif
99 #if DXX_USE_OGL
100 bool OglFixedFont;
101 SyncGLMethod OglSyncMethod;
102 bool OglDarkEdges;
103 bool DbgUseOldTextureMerge;
104 bool DbgGlIntensity4Ok;
105 bool DbgGlReadPixelsOk;
106 bool DbgGlGetTexLevelParamOk;
107 bool DbgGlLuminance4Alpha4Ok;
108 bool DbgGlRGBA2Ok;
109 #if DXX_USE_STEREOSCOPIC_RENDER
110 bool OglStereo;
111 uint8_t OglStereoView;
112 #endif
113 unsigned OglSyncWait;
114 #else
115 bool DbgSdlHWSurface;
116 bool DbgSdlASyncBlit;
117 #endif
118 bool DbgNoRun;
119 bool DbgNoDoubleBuffer;
120 bool DbgNoCompressPigBitmap;
121 bool DbgRenderStats;
122 uint8_t DbgBpp;
123 int8_t DbgVerbose;
124 #if DXX_USE_SHAREPATH
125 bool SysNoHogDir;
126 #endif
127 bool SysNoNiceFPS;
128 int SysMaxFPS;
129 int SysRenderZoomAdjustment;
130 uint16_t MplUdpHostPort;
131 uint16_t MplUdpMyPort;
132 #if DXX_USE_TRACKER
133 uint16_t MplTrackerPort;
134 std::string MplTrackerAddr;
135 #endif
136 std::string SysMissionDir;
137 std::string SysHogDir;
138 std::string SysPilot;
139 std::string SysRecordDemoNameTemplate;
140 std::string MplUdpHostAddr;
141 std::string DbgAltTex;
142 #if !DXX_USE_OGL
143 std::string DbgTexMap;
144 #endif
145 };
146 extern CArg CGameArg;
147 }
148
149 #ifdef DXX_BUILD_DESCENT
150 namespace dsx {
151 struct Arg : prohibit_void_ptr<Arg>
152 {
153 #if DXX_BUILD_DESCENT == 1
154 bool EdiNoBm;
155 #endif
156 #if DXX_BUILD_DESCENT == 2
157 bool SysNoMovies;
158 bool GfxSkipHiresMovie;
159 bool GfxSkipHiresGFX;
160 sound_sample_rate SndDigiSampleRate;
161 std::string EdiAutoLoad;
162 bool EdiSaveHoardData;
163 bool EdiMacData; // also used for some read routines in non-editor build
164 #endif
165 };
166
167 extern struct Arg GameArg;
168
169 bool InitArgs(std::span<char *> argv);
170 }
171
172 namespace dcx {
173 #define PLAYER_DIRECTORY_TEXT "Players/"
174
175 dxx_compiler_attribute_format_arg(1)
176 static inline const char *PLAYER_DIRECTORY_STRING(const char *s);
177 static inline const char *PLAYER_DIRECTORY_STRING(const char *s)
178 {
179 return &s[CGameArg.SysUsePlayersDir + sizeof(PLAYER_DIRECTORY_TEXT) - 1];
180 }
181 #define PLAYER_DIRECTORY_STRING(S) ((PLAYER_DIRECTORY_STRING)(PLAYER_DIRECTORY_TEXT S))
182 }
183 #endif