29 #include "../idlib/precompiled.h"
95 common->
DPrintf(
"idSessionLocal::SetGUI: cleared an active message box\n" );
110 memset( &ev, 0,
sizeof( ev ) );
163 for ( i = 0; i < fileList.
Num(); i++ ) {
167 fileList[
i].StripLeading(
'/' );
168 fileList[
i].StripFileExtension();
197 for ( i = 0; i < fileList.
Num(); i++ ) {
259 int n = str.
Find(
";" );
261 skin = str.
Left( n );
267 if ( skin.
Icmp( uiSkin ) == 0 ) {
326 #if defined( __linux__ )
342 const char *cmd = args.
Argv(icmd-1);
354 if ( saveGameName && saveGameName[0] ) {
357 if ( icmd == args.
Argc() || atoi(args.
Argv( icmd++ )) == 0 ) {
358 idStr saveFileName = saveGameName;
360 saveFileName =
"savegames/" + saveFileName;
371 if ( file !=
NULL ) {
377 if ( src.
LoadFile( saveFileName ) ) {
417 idStr saveName, description, screenshot;
436 if ( screenshot.
Length() == 0 ) {
437 screenshot =
va(
"savegames/%s.tga",
loadGameList[choice].c_str());
452 int tab = date.
Find(
'\t' );
477 for( icmd = 0; icmd < args.
Argc(); ) {
478 const char *cmd = args.
Argv( icmd++ );
504 if ( args.
Argc() - icmd >= 1 ) {
527 for( i = 0; i < args.
Argc(); ) {
528 const char *cmd = args.
Argv( i++ );
537 if ( args.
Argc() - i >= 1 ) {
571 for( icmd = 0; icmd < args.
Argc(); ) {
572 const char *cmd = args.
Argv( icmd++ );
585 if ( icmd < args.
Argc() ) {
588 #ifndef ID_DEMO_BUILD
685 if ( gametype ==
NULL || *gametype == 0 ||
idStr::Icmp( gametype,
"singleplayer" ) == 0 ) {
686 gametype =
"Deathmatch";
696 for ( i = 0; i <
num; i++ ) {
698 if ( dict && dict->
GetBool( gametype ) ) {
699 const char *mapName = dict->
GetString(
"name" );
700 if ( mapName[ 0 ] ==
'\0' ) {
736 if ( !s || s[0] == 0 ) {
781 if ( n_clients > maxclients ) {
813 if ( args.
Argc() - icmd >= 1 ) {
814 skin = args.
Argv( icmd++ );
837 if ( args.
Argc() - icmd >= 2 ) {
838 int key = atoi( args.
Argv( icmd++ ) );
850 if ( args.
Argc() - icmd >= 1 ) {
853 if ( snd.
Length() == 1 ) {
854 channel = atoi( snd );
855 snd = args.
Argv( icmd++ );
864 if ( args.
Argc() - icmd >= 1 ) {
874 if ( args.
Argc() - icmd >= 1 ) {
875 vcmd = args.
Argv( icmd++ );
877 if ( !vcmd.
Length() || !vcmd.
Icmp(
"speakers" ) ) {
889 if ( !vcmd.
Icmp(
"eax" ) ) {
919 if ( !vcmd.
Icmp(
"drivar" ) ) {
927 if ( args.
Argc() - icmd >= 1 ) {
928 vcmd = args.
Argv( icmd++ );
941 }
else if (
idStr::Icmp( vcmd,
"recommended" ) == 0 ) {
960 if ( args.
Argc() - icmd >= 1 ) {
1043 if ( args.
Argc() - icmd >= 1 ) {
1044 vcmd = args.
Argv( icmd++ );
1068 for ( i = 0; i < args.
Argc(); ) {
1069 const char *cmd = args.
Argv( i++ );
1104 const char *cmd = args.
Argv( 0 );
1133 }
else if ( gui ==
guiMsg ) {
1145 }
else if ( strstr( cmd,
"sound " ) == cmd ) {
1153 }
else if ( !doIngame ) {
1154 common->
DPrintf(
"idSessionLocal::DispatchCommand: no dispatch found for command '%s'\n", menuCommand );
1171 const char *menuCommand;
1179 if ( !menuCommand || !menuCommand[0] ) {
1216 memset( &ev, 0,
sizeof( ev ) );
1220 if ( cmd && cmd[0] ) {
1232 common->
DPrintf(
"message box sanity check: !common->IsInitialized()\n" );
1243 common->
DPrintf(
"message box sanity check: not compatible with dedicated server\n" );
1256 common->
DPrintf(
"MessageBox: %s - %s\n", title ? title :
"", message ? message :
"" );
1345 common->
Printf(
"idSessionLocal::MessageBox: unknown msg box type\n" );
1402 int dlnow = 0, dltotal = 0;
1405 idStr sNow, sTotal, sBW, sETA, sMsg;
1441 if ( lapsed > 2000 ) {
1448 if ( lapsed < 2000 ) {
1451 sprintf( sETA,
"%.0f sec", ( (
float)dltotal / (
float)dlnow - 1.0
f ) * lapsed / 1000 );
1455 if ( lapsed < 2000 ) {
1462 guiMsg->
SetStateString(
"progress",
va(
"%d", progress_start + dlnow * ( progress_end - progress_start ) / dltotal ) );
1507 common->
DPrintf(
"MessageBox HandleMsgCommands 1st frame ignore\n" );
1516 }
else if (
idStr::Icmp( menuCommand,
"right" ) == 0 ) {
1530 #define NOTEDATFILE "C:/notenumber.dat"
1538 for (
int tries = 0; tries < 10; tries++ ) {
1540 if ( file !=
NULL ) {
1545 int noteNumber = 1000;
1547 file->
Read( ¬eNumber, 4 );
1552 idStr str, noteNum, shotName, workName, fileName =
"viewnotes/";
1555 const char *severity =
NULL;
1557 if ( p ==
NULL || *p ==
'\0' ) {
1564 severity =
"WishList_Viewnotes/";
1566 severity =
"MustFix_Viewnotes/";
1568 fileName += severity;
1582 fileList.
Append( fileName +
"/Nobody" );
1584 for ( i = 0; i <
count; i++ ) {
1586 workName = fileName +
"/";
1588 fileList.
Append( workName );
1592 fileName +=
"maps/";
1595 fileList.
Append( fileName );
1600 for ( i = 0; i < fileList.
Num(); i++ ) {
1601 workName = fileList[
i];
1604 int workNote = noteNumber;
1611 if ( severity && *severity ) {
1612 workName = severity;
1613 workName +=
"viewNotes";
1626 for (
int tries = 0; tries < 10; tries++ ) {
1628 if ( file !=
NULL ) {
1634 file->
Write( ¬eNumber, 4 );
void GUIUpdateSelected(void)
virtual void SetCVarInteger(const char *name, const int value, int flags=0)=0
virtual idFile * OpenFileRead(const char *relativePath, bool allowCopyFiles=true, const char *gamedir=NULL)=0
char xpkey[CDKEY_BUF_LEN]
void HandleRestartMenuCommands(const char *menuCommand)
idStr GetAutoSaveName(const char *mapName) const
virtual void Add(int id, const idStr &s)=0
int GetInt(const char *key, const char *defaultString="0") const
idStr & SetFileExtension(const char *extension)
virtual idFileList * ListFiles(const char *relativePath, const char *extension, bool sort=false, bool fullRelativePath=false, const char *gamedir=NULL)=0
assert(prefInfo.fullscreenBtn)
virtual void StateChanged(int time, bool redraw=false)=0
idCVarSystem * cvarSystem
void GetSaveGameList(idStrList &fileList, idList< fileTIME_T > &fileTimes)
virtual void SetCVarFloat(const char *name, const float value, int flags=0)=0
virtual void SetStateString(const char *varName, const char *value)=0
virtual void virtual void virtual const idLangDict * GetLanguageDict(void)=0
void SetNum(int newnum, bool resize=true)
void ScrubSaveGameFileName(idStr &saveFileName) const
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
void R_ScreenshotFilename(int &lastNumber, const char *base, idStr &fileName)
virtual const char * MessageBox(msgBoxType_t type, const char *message, const char *title=NULL, bool wait=false, const char *fire_yes=NULL, const char *fire_no=NULL, bool network=false)
const idStrList & GetList(void) const
virtual void SetModifiedFlags(int flags)=0
virtual int GetNumMaps()=0
virtual int GetCVarInteger(const char *name) const =0
virtual void PlayShaderDirectly(const char *name, int channel=-1)=0
static idAsyncClient client
idRenderSystem * renderSystem
int Sys_Milliseconds(void)
void MenuEvent(const sysEvent_t *event)
idFileSystem * fileSystem
virtual idFile * OpenExplicitFileRead(const char *OSPath)=0
idCVar com_machineSpec("com_machineSpec","-1", CVAR_INTEGER|CVAR_ARCHIVE|CVAR_SYSTEM,"hardware classification, -1 = not detected, 0 = low quality, 1 = medium quality, 2 = high quality, 3 = ultra quality")
virtual void ExecuteCommandBuffer(void)=0
virtual void HandleNamedEvent(const char *eventName)=0
virtual void FindMapScreenshot(const char *path, char *buf, int len)=0
const char * Left(int len, idStr &result) const
virtual const char * HandleGuiCommands(const char *menuCommand)=0
virtual int IsEAXAvailable(void)=0
virtual void SetCVarString(const char *name, const char *value, int flags=0)=0
virtual void SetKeyBindingNames(void)=0
GLuint GLuint GLsizei GLenum type
virtual bool CDKeysAreValid(bool strict)=0
void Sys_Sleep(const int time)
virtual void SetStateInt(const char *varName, const int value)=0
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void ReloadImages(bool force) const
void SendVersionCheck(bool fromMenu=false)
const char * GetDescription(int index) const
void UpdateMPLevelShot(void)
HandleGuiCommand_t guiHandle
virtual const char * HandleEvent(const sysEvent_t *event, int time, bool *updateVisuals=NULL)=0
int Icmp(const char *text) const
int BestUnit(const char *format, float value, Measure_t measure)
int GetNumMods(void) const
idSoundWorld * menuSoundWorld
virtual void Pause(void)=0
void MoveToNewMap(const char *mapName)
idUserInterface * guiTest
virtual void RemoveFile(const char *relativePath)=0
virtual void SetSelection(int sel)=0
virtual void DeleteStateVar(const char *varName)=0
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
bool BoxDialogSanityCheck(void)
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
GLuint GLuint GLsizei count
idListGUI * guiMainMenu_MapList
const char * GetString(const char *key, const char *defaultString="") const
void SetMainMenuGuiVars(void)
idStr & StripFileExtension(void)
void DispatchCommand(idUserInterface *gui, const char *menuCommand, bool doIngame=true)
void SetSaveGameGuiVars(void)
virtual void GUIFrame(bool execCmd, bool network)=0
virtual void ClearAllSoundEmitters(void)=0
virtual void SetPlayingSoundWorld(idSoundWorld *soundWorld)=0
idUserInterface * guiActive
idUserInterface * guiTakeNotes
virtual void SetCursor(float x, float y)=0
void StartNewGame(const char *mapName, bool devmap=false)
bool GetBool(const char *key, const char *defaultString="0") const
virtual const char * GetCVarString(const char *name) const =0
void HandleMsgCommands(const char *menuCommand)
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
void SetInteger(const int value)
virtual void SetCVarBool(const char *name, const bool value, int flags=0)=0
int GetInteger(void) const
virtual int GetSelection(char *s, int size, int sel=0) const =0
virtual int Read(void *buffer, int len)
static void GetNETServers()
const char * GetString(const char *str) const
virtual int GetScreenWidth(void) const =0
void HandleChatMenuCommands(const char *menuCommand)
virtual const char * Activate(bool activate, int time)=0
virtual void DownloadProgressBox(backgroundDownload_t *bgl, const char *title, int progress_start=0, int progress_end=100)
void HandleInGameCommands(const char *menuCommand)
const char * Right(int len, idStr &result) const
int Find(const char c, int start=0, int end=-1) const
virtual void UnPause(void)=0
virtual void FreeFileList(idFileList *fileList)=0
idUsercmdGen * usercmdGen
idStr & RemoveColors(void)
virtual int GetScreenHeight(void) const =0
virtual float GetCVarFloat(const char *name) const =0
virtual void Close(void)=0
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void SetMainMenuSkin(void)
virtual const idDict & State() const =0
virtual bool IsPaused(void)=0
virtual void StartMenu(bool playIntro=false)
idDeclManager * declManager
mapSpawnData_t mapSpawnData
idUserInterface * guiIntro
void TokenizeString(const char *text, bool keepAsStrings)
idUserInterface * GetActiveMenu()
int Append(const type &obj)
virtual bool Active(void)=0
virtual void Clear(void)=0
static idCVar gui_configServerRate
virtual idFile * OpenExplicitFileWrite(const char *OSPath)=0
virtual void StopBox(void)
virtual void GuiFrameEvents()
idUserInterface * guiMainMenu
virtual void UpdateScreen(bool outOfSequence=true)
const char *(* HandleGuiCommand_t)(const char *)
virtual void SetGUI(idUserInterface *gui, HandleGuiCommand_t handle)
bool LoadGame(const char *saveName)
idSoundSystem * soundSystem
virtual int Write(const void *buffer, int len)
void SetSorting(serverSort_t sort)
const char * Sys_TimeStampToStr(ID_TIME_T timeStamp)
void HandleIntroMenuCommands(const char *menuCommand)
idCVar si_map("si_map","game/mp/d3dm1", CVAR_GAME|CVAR_SERVERINFO|CVAR_ARCHIVE,"map to be played next on server", idCmdSystem::ArgCompletion_MapName)
virtual void SetCDKeyGuiVars(void)
const char * c_str(void) const
bool HandleSaveGameMenuCommand(idCmdArgs &args, int &icmd)
virtual bool GetCVarBool(const char *name) const =0
char cdkey[CDKEY_BUF_LEN]
const char * Argv(int arg) const
virtual void Quit(void)=0
void SetModsMenuGuiVars(void)
virtual bool IsMultiplayer()
virtual bool IsInitialized(void) const =0
virtual void InhibitUsercmd(inhibit_t subsystem, bool inhibit)=0
char * va(const char *fmt,...)
virtual void CloseFile(idFile *f)=0
virtual void DPrintf(const char *fmt,...) id_attribute((format(printf
virtual const idDict * GetMapDecl(int i)=0
virtual void FreeModList(idModList *modList)=0
const char * GetMod(int index) const
idUserInterface * guiMsgRestore
idUserInterface * guiRestartMenu
ID_INLINE T Min(T x, T y)
int ReadToken(idToken *token)
virtual void HandleMainMenuCommands(const char *menuCommand, idUserInterface *gui)=0
int sprintf(idStr &string, const char *fmt,...)
virtual bool HasD3XP(void)=0
void HandleMainMenuCommands(const char *menuCommand)
bool SaveGame(const char *saveName, bool autosave=false)
virtual void TakeScreenshot(int width, int height, const char *fileName, int samples, struct renderView_s *ref)=0
void SetPbMenuGuiVars(void)
int LoadFile(const char *filename, bool OSPath=false)
void HandleNoteCommands(const char *menuCommand)
virtual idModList * ListMods(void)=0