2019-10-25 22:32:49 +00:00
# pragma once
2020-05-22 16:28:03 +00:00
# include <memory>
2019-10-27 07:14:58 +00:00
# include "c_cvars.h"
# include "zstring.h"
2019-10-27 23:24:09 +00:00
# include "inputstate.h"
2019-10-28 21:19:50 +00:00
# include "gamecvars.h"
2019-11-28 00:02:45 +00:00
# include "tarray.h"
# include "name.h"
2019-12-24 17:53:29 +00:00
# include "memarena.h"
2019-10-27 07:14:58 +00:00
extern FString currentGame ;
2019-11-01 23:38:30 +00:00
extern FString LumpFilter ;
2019-10-28 21:19:50 +00:00
class FArgs ;
2020-04-23 19:18:40 +00:00
extern bool GUICapture ;
2019-10-25 22:32:49 +00:00
2019-12-24 17:53:29 +00:00
extern FMemArena dump ; // this is for memory blocks than cannot be deallocated without some huge effort. Put them in here so that they do not register on shutdown.
2019-11-28 00:02:45 +00:00
extern TMap < FName , int32_t > NameToTileIndex ;
2019-10-31 23:32:56 +00:00
int CONFIG_Init ( ) ;
2019-10-26 19:50:49 +00:00
// I am not sure if anything below will survive for long...
# define MAXMOUSEAXES 2
# define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
2019-10-26 21:45:55 +00:00
// default mouse scale
# define DEFAULTMOUSEANALOGUESCALE 65536
// default joystick settings
# define DEFAULTJOYSTICKANALOGUESCALE 65536
# define DEFAULTJOYSTICKANALOGUEDEAD 1000
# define DEFAULTJOYSTICKANALOGUESATURATE 9500
2019-10-26 19:50:49 +00:00
2019-10-26 21:45:55 +00:00
void CONFIG_SetupJoystick ( void ) ;
void CONFIG_SetGameControllerDefaultsClear ( ) ;
2019-10-28 06:05:32 +00:00
2019-10-27 07:14:58 +00:00
extern FStringCVar * const CombatMacros [ ] ;
void CONFIG_ReadCombatMacros ( ) ;
2019-10-27 12:40:24 +00:00
int32_t CONFIG_GetMapBestTime ( char const * const mapname , uint8_t const * const mapmd4 ) ;
int CONFIG_SetMapBestTime ( uint8_t const * const mapmd4 , int32_t tm ) ;
2019-12-22 19:55:47 +00:00
int GameMain ( ) ;
2019-10-28 21:19:50 +00:00
struct UserConfig
{
FString gamegrp ;
FString CommandMap ;
FString DefaultDef ;
FString DefaultCon ;
FString CommandDemo ;
FString CommandName ;
FString CommandIni ;
std : : unique_ptr < FArgs > AddDefs ;
std : : unique_ptr < FArgs > AddCons ;
std : : unique_ptr < FArgs > AddFiles ;
std : : unique_ptr < FArgs > AddFilesPre ; //To be added before the main directory. Only for legacy options.
std : : unique_ptr < FArgs > AddArt ;
2020-01-10 20:36:46 +00:00
TArray < FString > toBeDeleted ;
2019-10-28 21:19:50 +00:00
bool nomonsters = false ;
bool nosound = false ;
2020-04-12 06:07:48 +00:00
//bool nomusic = false;
2019-10-28 21:19:50 +00:00
bool nologo = false ;
int setupstate = - 1 ;
int netPort = 0 ; // g_netPort = Batoi(argv[i + 1]);
int netServerMode = - 1 ; // g_networkMode = NET_SERVER; g_noSetup = g_noLogo = TRUE;
FString netServerAddress ; // Net_Connect(argv[i + 1]); g_noSetup = g_noLogo = TRUE;
FString netPassword ; // Bstrncpyz(g_netPassword, argv[i + 1], sizeof(g_netPassword));
void ProcessOptions ( ) ;
} ;
extern UserConfig userConfig ;
2020-04-12 06:07:48 +00:00
extern int nomusic ;
2020-04-12 06:09:38 +00:00
extern bool nosound ;
2019-10-28 21:19:50 +00:00
inline bool MusicEnabled ( )
{
2020-04-12 06:07:48 +00:00
return ! nomusic ;
2019-10-28 21:19:50 +00:00
}
inline bool SoundEnabled ( )
{
2020-04-12 06:09:38 +00:00
return snd_enabled & & ! nosound ;
2019-10-28 21:19:50 +00:00
}
2019-10-30 17:09:00 +00:00
enum
{
GAMEFLAG_DUKE = 0x00000001 ,
GAMEFLAG_NAM = 0x00000002 ,
GAMEFLAG_NAPALM = 0x00000004 ,
GAMEFLAG_WW2GI = 0x00000008 ,
GAMEFLAG_ADDON = 0x00000010 ,
GAMEFLAG_SHAREWARE = 0x00000020 ,
GAMEFLAG_DUKEBETA = 0x00000060 , // includes 0x20 since it's a shareware beta
2020-07-19 19:04:22 +00:00
GAMEFLAG_PLUTOPAK = 0x00000080 ,
2019-10-30 17:09:00 +00:00
GAMEFLAG_RR = 0x00000100 ,
2019-11-02 17:28:50 +00:00
GAMEFLAG_RRRA = 0x00000200 ,
2020-07-19 19:04:22 +00:00
GAMEFLAG_RRALL = GAMEFLAG_RR | GAMEFLAG_RRRA ,
2020-02-26 19:16:27 +00:00
GAMEFLAG_BLOOD = 0x00000800 ,
GAMEFLAG_SW = 0x00001000 ,
GAMEFLAG_POWERSLAVE = 0x00002000 ,
GAMEFLAG_EXHUMED = 0x00004000 ,
GAMEFLAG_PSEXHUMED = GAMEFLAG_POWERSLAVE | GAMEFLAG_EXHUMED , // the two games really are the same, except for the name and the publisher.
2020-05-07 07:49:05 +00:00
GAMEFLAG_WORLDTOUR = 0x00008000 ,
GAMEFLAG_STANDALONE = 0x00010000 ,
GAMEFLAGMASK = 0x0000FFFF , // flags allowed from grpinfo
2019-10-30 17:09:00 +00:00
2020-07-19 19:04:22 +00:00
// We still need these for the parsers.
GAMEFLAG_FURY = 0 ,
GAMEFLAG_DEER = 0 ,
2019-10-30 23:41:56 +00:00
} ;
struct GrpInfo
{
FString name ;
FString scriptname ;
FString defname ;
FString rtsname ;
FString gamefilter ;
uint32_t CRC = 0 ;
uint32_t dependencyCRC = 0 ;
size_t size = 0 ;
int flags = 0 ;
2019-11-01 18:25:42 +00:00
bool loaddirectory = false ;
2020-02-01 20:12:09 +00:00
bool isAddon = false ;
2019-11-01 18:25:42 +00:00
TArray < FString > mustcontain ;
2019-12-26 09:47:10 +00:00
TArray < FString > tobedeleted ;
2019-10-30 23:41:56 +00:00
TArray < FString > loadfiles ;
TArray < FString > loadart ;
} ;
struct GrpEntry
{
FString FileName ;
GrpInfo FileInfo ;
uint32_t FileIndex ;
} ;
2019-11-01 18:25:42 +00:00
extern int g_gameType ;
const char * G_DefaultDefFile ( void ) ;
const char * G_DefFile ( void ) ;
2019-10-30 23:41:56 +00:00
2020-05-06 14:10:44 +00:00
// game check shortcuts
inline bool isNam ( )
{
return g_gameType & ( GAMEFLAG_NAM | GAMEFLAG_NAPALM ) ;
}
2020-05-08 22:34:48 +00:00
inline bool isNamWW2GI ( )
{
return g_gameType & ( GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI ) ;
}
2020-05-06 14:10:44 +00:00
inline bool isWW2GI ( )
{
return g_gameType & ( GAMEFLAG_WW2GI ) ;
}
inline bool isRR ( )
{
return g_gameType & ( GAMEFLAG_RRALL ) ;
}
inline bool isRRRA ( )
{
return g_gameType & ( GAMEFLAG_RRRA ) ;
}
2020-05-07 07:49:05 +00:00
inline bool isWorldTour ( )
{
return g_gameType & GAMEFLAG_WORLDTOUR ;
}
2020-07-19 19:04:22 +00:00
inline bool isPlutoPak ( )
{
return g_gameType & GAMEFLAG_PLUTOPAK ;
}
2019-10-30 23:41:56 +00:00
TArray < GrpEntry > GrpScan ( ) ;
2020-05-28 23:22:45 +00:00
void S_PauseSound ( bool notmusic , bool notsfx ) ;
void S_ResumeSound ( bool notsfx ) ;
2019-12-22 19:55:47 +00:00
void S_SetSoundPaused ( int state ) ;
2019-12-24 18:59:14 +00:00
void G_FatalEngineError ( void ) ;
2020-02-02 09:27:47 +00:00
int CalcSmoothRatio ( const ClockTicks & totalclk , const ClockTicks & ototalclk , int realgameticspersec ) ;
2020-01-11 16:05:25 +00:00
2020-02-05 11:57:17 +00:00
FString G_GetDemoPath ( ) ;
2020-04-12 06:09:38 +00:00
enum
{
PAUSESFX_MENU = 1 ,
PAUSESFX_CONSOLE = 2
} ;
2020-05-28 23:22:45 +00:00
void updatePauseStatus ( ) ;
2020-07-15 16:10:31 +00:00
void updatePauseStatus ( bool state , bool multiplayer ) ;
2020-05-28 23:22:45 +00:00
extern int paused ;
2020-07-21 20:59:24 +00:00
extern int chatmodeon ;