Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  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 <type_traits>
  29. #include "dxxsconf.h"
  30. #include <cstdint>
  31.  
  32. #if DXX_USE_OGL
  33. // GL Sync methods
  34. enum SyncGLMethod : uint8_t {
  35.         SYNC_GL_NONE=0,
  36.         SYNC_GL_FENCE,
  37.         SYNC_GL_FENCE_SLEEP,
  38.         SYNC_GL_FINISH_AFTER_SWAP,
  39.         SYNC_GL_FINISH_BEFORE_SWAP,
  40.         SYNC_GL_AUTO
  41. };
  42.  
  43. #define OGL_SYNC_METHOD_DEFAULT         SYNC_GL_AUTO
  44. #define OGL_SYNC_WAIT_DEFAULT           2               /* milliseconds */
  45.  
  46. #endif
  47.  
  48. // Struct that keeps all variables used by FindArg
  49. // Prefixes are:
  50. //   Sys - System Options
  51. //   Ctl - Control Options
  52. //   Snd - Sound Options
  53. //   Gfx - Graphics Options
  54. //   Ogl - OpenGL Options
  55. //   Mpl - Multiplayer Options
  56. //   Edi - Editor Options
  57. //   Dbg - Debugging/Undocumented Options
  58. #include <string>
  59. #include "dxxsconf.h"
  60. #include "dsx-ns.h"
  61. #include "pack.h"
  62.  
  63. namespace dcx {
  64. struct CArg : prohibit_void_ptr<CArg>
  65. {
  66.         bool CtlNoCursor;
  67.         bool CtlNoMouse;
  68.         bool CtlNoStickyKeys;
  69.         bool DbgForbidConsoleGrab;
  70.         bool DbgShowMemInfo;
  71.         bool DbgSafelog;
  72.         bool SysShowCmdHelp;
  73.         bool SysLowMem;
  74.         int8_t SysUsePlayersDir;
  75.         bool SysAutoRecordDemo;
  76.         bool SysWindow;
  77.         bool SysAutoDemo;
  78.         bool GfxSkipHiresFNT;
  79.         bool SndNoSound;
  80.         bool SndNoMusic;
  81.         bool SysNoBorders;
  82.         bool SysNoTitles;
  83. #if DXX_USE_SDLMIXER
  84.         bool SndDisableSdlMixer;
  85. #else
  86.         static constexpr std::true_type SndDisableSdlMixer{};
  87. #endif
  88. #if DXX_MAX_JOYSTICKS
  89.         bool CtlNoJoystick;
  90. #else
  91.         static constexpr std::true_type CtlNoJoystick{};
  92. #endif
  93. #if DXX_USE_OGL
  94.         bool OglFixedFont;
  95.         SyncGLMethod OglSyncMethod;
  96.         bool OglDarkEdges;
  97.         bool DbgUseOldTextureMerge;
  98.         bool DbgGlIntensity4Ok;
  99.         bool DbgGlReadPixelsOk;
  100.         bool DbgGlGetTexLevelParamOk;
  101.         bool DbgGlLuminance4Alpha4Ok;
  102.         bool DbgGlRGBA2Ok;
  103.         unsigned OglSyncWait;
  104. #else
  105.         bool DbgSdlHWSurface;
  106.         bool DbgSdlASyncBlit;
  107. #endif
  108.         bool DbgNoRun;
  109.         bool DbgNoDoubleBuffer;
  110.         bool DbgNoCompressPigBitmap;
  111.         bool DbgRenderStats;
  112.         uint8_t DbgBpp;
  113.         int8_t DbgVerbose;
  114.         bool SysNoNiceFPS;
  115.         int SysMaxFPS;
  116.         uint16_t MplUdpHostPort;
  117.         uint16_t MplUdpMyPort;
  118. #if DXX_USE_TRACKER
  119.         uint16_t MplTrackerPort;
  120.         std::string MplTrackerAddr;
  121. #endif
  122.         std::string SysMissionDir;
  123.         std::string SysHogDir;
  124.         std::string SysPilot;
  125.         std::string SysRecordDemoNameTemplate;
  126.         std::string MplUdpHostAddr;
  127.         std::string DbgAltTex;
  128. #if !DXX_USE_OGL
  129.         std::string DbgTexMap;
  130. #endif
  131. };
  132. extern CArg CGameArg;
  133. }
  134.  
  135. #ifdef dsx
  136. namespace dsx {
  137. struct Arg : prohibit_void_ptr<Arg>
  138. {
  139. #if DXX_USE_SHAREPATH
  140.         bool SysNoHogDir;
  141. #endif
  142. #ifdef DXX_BUILD_DESCENT_I
  143.         bool EdiNoBm;
  144. #endif
  145. #ifdef DXX_BUILD_DESCENT_II
  146.         bool SysNoMovies;
  147.         bool GfxSkipHiresMovie;
  148.         bool GfxSkipHiresGFX;
  149.         int SndDigiSampleRate;
  150.         std::string EdiAutoLoad;
  151.         bool EdiSaveHoardData;
  152.         bool EdiMacData; // also used for some read routines in non-editor build
  153. #endif
  154. };
  155.  
  156. extern struct Arg GameArg;
  157.  
  158. bool InitArgs(int argc, char **argv);
  159. }
  160.  
  161. namespace dcx {
  162. #define PLAYER_DIRECTORY_TEXT   "Players/"
  163.  
  164. __attribute_format_arg(1)
  165. static inline const char *PLAYER_DIRECTORY_STRING(const char *s);
  166. static inline const char *PLAYER_DIRECTORY_STRING(const char *s)
  167. {
  168.         return &s[CGameArg.SysUsePlayersDir + sizeof(PLAYER_DIRECTORY_TEXT) - 1];
  169. }
  170. #define PLAYER_DIRECTORY_STRING(S)      ((PLAYER_DIRECTORY_STRING)(PLAYER_DIRECTORY_TEXT S))
  171. }
  172. #endif
  173.