dxx-rebirth/common/include/args.h

172 lines
4.1 KiB
C
Raw Normal View History

2006-03-20 17:12:09 +00:00
/*
2014-06-01 17:55:23 +00:00
* Portions of this file are copyright Rebirth contributors and licensed as
* described in COPYING.txt.
* Portions of this file are copyright Parallax Software and licensed
* according to the Parallax license below.
* See COPYING.txt for license details.
2006-03-20 17:12:09 +00:00
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
2006-03-20 17:12:09 +00:00
/*
*
* Prototypes for accessing arguments.
*
*/
2015-01-25 05:32:44 +00:00
#pragma once
2006-03-20 17:12:09 +00:00
#ifdef __cplusplus
#include <cstdint>
#ifdef OGL
// GL Sync methods
typedef enum {
SYNC_GL_NONE=0,
SYNC_GL_FENCE,
SYNC_GL_FENCE_SLEEP,
SYNC_GL_FINISH_AFTER_SWAP,
SYNC_GL_FINISH_BEFORE_SWAP,
SYNC_GL_AUTO
} SyncGLMethod;
#define OGL_SYNC_METHOD_DEFAULT SYNC_GL_AUTO
#define OGL_SYNC_WAIT_DEFAULT 2 /* milliseconds */
#endif
// Struct that keeps all variables used by FindArg
// Prefixes are:
// Sys - System Options
// Ctl - Control Options
// Snd - Sound Options
// Gfx - Graphics Options
// Ogl - OpenGL Options
// Mpl - Multiplayer Options
// Edi - Editor Options
// Dbg - Debugging/Undocumented Options
2015-03-22 18:49:20 +00:00
#include <string>
#include "dxxsconf.h"
2015-07-04 21:01:17 +00:00
#include "pack.h"
#include "compiler-type_traits.h"
2015-12-13 18:00:49 +00:00
namespace dcx {
2015-07-18 21:01:56 +00:00
struct CArg : prohibit_void_ptr<CArg>
{
bool CtlNoCursor;
bool CtlNoMouse;
bool CtlNoStickyKeys;
bool DbgForbidConsoleGrab;
bool DbgShowMemInfo;
2015-10-18 21:01:21 +00:00
bool DbgSafelog;
#if defined(__unix__)
bool SysNoHogDir;
#endif
bool SysShowCmdHelp;
2015-12-24 04:01:26 +00:00
bool GfxSkipHiresFNT;
2015-11-24 04:05:36 +00:00
bool SndNoSound;
2015-12-24 04:01:26 +00:00
bool SndNoMusic;
2015-11-24 04:05:36 +00:00
#ifdef USE_SDLMIXER
bool SndDisableSdlMixer;
#else
static constexpr tt::true_type SndDisableSdlMixer{};
2015-11-26 02:56:55 +00:00
#endif
#if MAX_JOYSTICKS
bool CtlNoJoystick;
#else
static constexpr tt::true_type CtlNoJoystick{};
2015-12-18 04:08:23 +00:00
#endif
#ifdef OGL
2015-12-18 04:08:24 +00:00
bool DbgUseOldTextureMerge;
2015-12-18 04:08:23 +00:00
bool DbgGlIntensity4Ok;
2015-12-18 04:08:24 +00:00
bool DbgGlReadPixelsOk;
2015-12-18 04:08:24 +00:00
bool DbgGlGetTexLevelParamOk;
2015-12-18 04:08:24 +00:00
bool DbgGlLuminance4Alpha4Ok;
2015-12-18 04:08:24 +00:00
bool DbgGlRGBA2Ok;
2015-11-24 04:05:36 +00:00
#endif
2015-12-18 04:08:23 +00:00
uint8_t DbgBpp;
int8_t DbgVerbose;
2015-12-24 04:01:26 +00:00
bool SysNoNiceFPS;
int SysMaxFPS;
std::string SysMissionDir;
2015-12-24 04:01:26 +00:00
std::string SysHogDir;
2015-12-24 04:01:26 +00:00
std::string SysPilot;
2015-12-24 04:01:26 +00:00
std::string SysRecordDemoNameTemplate;
2015-07-18 21:01:56 +00:00
};
extern CArg CGameArg;
}
2015-07-18 21:01:56 +00:00
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
2015-12-13 18:00:49 +00:00
namespace dsx {
2015-07-04 21:01:17 +00:00
struct Arg : prohibit_void_ptr<Arg>
{
2015-07-04 21:01:17 +00:00
bool SysUsePlayersDir;
bool SysLowMem;
bool SysAutoRecordDemo;
2015-07-04 21:01:17 +00:00
bool SysWindow;
bool SysNoBorders;
2015-10-09 02:46:09 +00:00
bool SysNoTitles;
2015-07-04 21:01:17 +00:00
bool SysAutoDemo;
#ifdef DXX_BUILD_DESCENT_I
bool EdiNoBm;
2013-11-10 05:25:08 +00:00
#endif
#ifdef DXX_BUILD_DESCENT_II
2015-07-04 21:01:17 +00:00
bool SysNoMovies;
bool GfxSkipHiresMovie;
bool GfxSkipHiresGFX;
int SndDigiSampleRate;
#endif
#ifdef OGL
2015-07-04 21:01:17 +00:00
bool OglFixedFont;
SyncGLMethod OglSyncMethod;
int OglSyncWait;
#endif
2015-03-22 18:49:20 +00:00
std::string MplUdpHostAddr;
2015-01-25 05:32:44 +00:00
uint16_t MplUdpHostPort;
uint16_t MplUdpMyPort;
#ifdef USE_TRACKER
uint16_t MplTrackerPort;
2015-03-22 18:49:20 +00:00
std::string MplTrackerAddr;
#endif
#ifdef DXX_BUILD_DESCENT_II
2015-03-22 18:49:20 +00:00
std::string EdiAutoLoad;
2015-07-04 21:01:17 +00:00
bool EdiSaveHoardData;
bool EdiMacData; // also used for some read routines in non-editor build
#endif
2015-07-04 21:01:17 +00:00
bool DbgNoRun;
bool DbgRenderStats;
2015-03-22 18:49:20 +00:00
std::string DbgAltTex;
std::string DbgTexMap;
2015-07-04 21:01:17 +00:00
bool DbgNoDoubleBuffer;
bool DbgNoCompressPigBitmap;
#ifdef OGL
#else
int DbgSdlHWSurface;
int DbgSdlASyncBlit;
#endif
};
extern struct Arg GameArg;
bool InitArgs(int argc, char **argv);
static inline const char *PLAYER_DIRECTORY_STRING(const char *s, const char *f) __attribute_format_arg(2);
2015-01-18 01:58:33 +00:00
static inline const char *PLAYER_DIRECTORY_STRING(const char *s, const char *)
{
return (GameArg.SysUsePlayersDir) ? s : (s + sizeof("Players/") - 1);
}
#define PLAYER_DIRECTORY_STRING(S) ((PLAYER_DIRECTORY_STRING)("Players/" S, S))
}
#endif
#endif