static void CG_LoadHud_f( void) { char buff[1024]; const char *hudSet; memset(buff, 0, sizeof(buff)); #ifdef MISSIONPACK // must reload both ui and hud at once, they share the string memory pool UI_Load(); Init_Display(&cgDC); #else Init_Display(&cgDC); String_Init(); #endif Menu_Reset(); trap_Cvar_VariableStringBuffer("cg_hudFiles", buff, sizeof(buff)); hudSet = buff; if (hudSet[0] == '\0') { hudSet = "ui/hud.txt"; } CG_LoadMenus(hudSet); menuScoreboard = NULL; }
/* ================= UI_ConsoleCommand ================= */ qboolean UI_ConsoleCommand( int realTime ) { char *cmd; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv( 0 ); // ensure minimum menu data is available //Menu_Cache(); if ( Q_stricmp (cmd, "ui_test") == 0 ) { UI_ShowPostGame(qtrue); } if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } if ( Q_stricmp (cmd, "ui_load") == 0 ) { UI_Load(); return qtrue; } if ( Q_stricmp (cmd, "remapShader") == 0 ) { if (trap_Argc() == 4) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, UI_Argv(3)); return qtrue; } } if ( Q_stricmp (cmd, "postgame") == 0 ) { UI_CalcPostGameStats(); return qtrue; } if ( Q_stricmp (cmd, "ui_cache") == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) { //UI_TeamOrdersMenu_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) { //UI_CDKeyMenu_f(); return qtrue; } return qfalse; }
static void UI_Load_f( void ) { #ifdef MISSIONPACK_HUD if ( cg.connected ) { // if hud scripts are loaded, UI_Load() will break it. So reload hud and ui using loadhud command. trap_Cmd_ExecuteText( EXEC_NOW, "loadhud\n" ); return; } #endif UI_Load(); }
qboolean UI_ConsoleCommand( int realTime ) { char *cmd = UI_Argv( 0 ); uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; if ( Q_stricmp( cmd, "ui_report" ) == 0 ) { UI_Report(); return qtrue; } if ( Q_stricmp( cmd, "ui_load" ) == 0 ) { UI_Load(); return qtrue; } if ( Q_stricmp( cmd, "ui_opensiegemenu" ) == 0 ) { if ( trap->Cvar_VariableValue( "g_gametype" ) == GT_SIEGE ) { Menus_CloseAll(); if ( Menus_ActivateByName( UI_Argv( 1 ) ) ) { trap->Key_SetCatcher( KEYCATCH_UI ); } } return qtrue; } if ( !Q_stricmp( cmd, "ui_openmenu" ) ) { Menus_CloseAll(); if ( Menus_ActivateByName( UI_Argv( 1 ) ) ) { trap->Key_SetCatcher( KEYCATCH_UI ); } return qtrue; } if ( Q_stricmp( cmd, "ui_cache" ) == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp( cmd, "ui_teamOrders" ) == 0 ) { return qtrue; } if ( Q_stricmp( cmd, "ui_cdkey" ) == 0 ) { return qtrue; } return qfalse; }
qboolean UI_ConsoleCommand( void ) { char *cmd; if (!ui.SG_GameAllowedToSaveHere(qtrue)) //only check if incamera { return qfalse; } cmd = UI_Argv( 0 ); // ensure minimum menu data is available Menu_Cache(); if ( Q_stricmp (cmd, "ui_cache") == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp (cmd, "levelselect") == 0 ) { UI_LoadMenu_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) { UI_SaveMenu_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } #ifndef JK2_MODE if ( Q_stricmp (cmd, "ui_load") == 0 ) { UI_Load(); return qtrue; } #endif return qfalse; }
/* ================= UI_ConsoleCommand ================= */ qboolean UI_ConsoleCommand( int realTime ) { char *cmd; uiClientState_t cstate; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv( 0 ); // ensure minimum menu data is available //Menu_Cache(); if ( Q_stricmp (cmd, "ui_test") == 0 ) { UI_ShowPostGame(qtrue); } if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } if ( Q_stricmp (cmd, "ui_load") == 0 ) { UI_Load(); return qtrue; } // Arnout: we DEFINATELY do NOT want this here /*if ( Q_stricmp (cmd, "remapShader") == 0 ) { if (trap_Argc() == 4) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, UI_Argv(3)); return qtrue; } }*/ if ( Q_stricmp (cmd, "postgame") == 0 ) { UI_CalcPostGameStats(); return qtrue; } if ( Q_stricmp (cmd, "ui_cache") == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) { //UI_TeamOrdersMenu_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_cdkey") == 0 ) { //UI_CDKeyMenu_f(); return qtrue; } if( Q_stricmp( cmd, "iamacheater" ) == 0 ) { int i; // unlock all available levels and campaigns for SP for( i = 0; i < uiInfo.campaignCount; i++ ) { if( uiInfo.campaignList[i].typeBits & (1<<GT_SINGLE_PLAYER) ) { uiInfo.campaignList[i].unlocked = qtrue; uiInfo.campaignList[i].progress = uiInfo.campaignList[i].mapCount; } } return qtrue; } trap_GetClientState( &cstate ); if( cstate.connState == CA_DISCONNECTED ) { if( Q_stricmp( cmd, "campaign" ) == 0 ) { UI_Campaign_f(); return qtrue; } if( Q_stricmp( cmd, "listcampaigns" ) == 0 ) { UI_ListCampaigns_f(); return qtrue; } } return qfalse; }
qboolean UI_ConsoleCommand(int realTime) { char *cmd; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv(0); // ensure minimum menu data is available //Menu_Cache(); if (Q_stricmp(cmd, "ui_test") == 0) { UI_ShowPostGame(qtrue); } if (Q_stricmp(cmd, "ui_report") == 0) { UI_Report(); return qtrue; } if (Q_stricmp(cmd, "ui_load") == 0) { UI_Load(); return qtrue; } if (Q_stricmp(cmd, "remapShader") == 0) { //Makro - disabling shader remapping when cheats are off if (trap_Cvar_VariableValue("sv_cheats") == 1) { if (trap_Argc() >= 4) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, UI_Argv(3)); } else //Makro - if no offset is specified, use 0 if (trap_Argc() == 3) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, 0); } else Com_Printf("Usage: remapShader <oldShader> <newShader> [timeOffset]\n"); } else Com_Printf("Shader remapping is cheat-protected\n"); return qtrue; } if (Q_stricmp(cmd, "postgame") == 0) { UI_CalcPostGameStats(); return qtrue; } if (Q_stricmp(cmd, "ui_cache") == 0) { UI_Cache_f(); return qtrue; } if (Q_stricmp(cmd, "ui_teamOrders") == 0) { //UI_TeamOrdersMenu_f(); return qtrue; } if (Q_stricmp(cmd, "ui_cdkey") == 0) { //UI_CDKeyMenu_f(); return qtrue; } //Makro - adding popup for choose commands if (Q_stricmp(cmd, "ui_RQ3_loadout") == 0) { if (UI_RQ3_WeaponMenuAccess()) _UI_SetActiveMenu(UIMENU_RQ3_WEAPON); else Com_Printf("Weapon/item menus are not available in this gametype.\n"); return qtrue; } //Makro - join menu if (Q_stricmp(cmd, "ui_RQ3_joinTeam") == 0) { _UI_SetActiveMenu(UIMENU_RQ3_JOIN); return qtrue; } //Makro - tkok menu if (Q_stricmp(cmd, "ui_RQ3_tkok") == 0) { if (trap_Cvar_VariableValue("g_gametype") >= GT_TEAM) _UI_SetActiveMenu(UIMENU_RQ3_TKOK); else Com_Printf("Not playing a team-based game.\n"); return qtrue; } //Makro - presets menu if (Q_stricmp(cmd, "ui_RQ3_presets") == 0) { _UI_SetActiveMenu(UIMENU_RQ3_PRESETS); return qtrue; } //Makro - I've always wanted a command to inc/dec a cvar :) if (Q_stricmp(cmd, "inc") == 0) { if (trap_Argc() >= 2) { char cvar[MAX_CVAR_VALUE_STRING]; float amount = 1; float val; int max = 0; Q_strncpyz(cvar, UI_Argv(1), sizeof(cvar)); val = trap_Cvar_VariableValue(cvar); if (trap_Argc() >= 3) { amount = atof(UI_Argv(2)); if (trap_Argc() >= 4) { max = atoi(UI_Argv(3)); } } if (max != 0) { trap_Cvar_SetValue(cvar, (float) (((int) (val + amount)) % max)); } else { trap_Cvar_SetValue(cvar, val + amount); } } else { Com_Printf("Usage: inc <cvarName> [amount] [max]\n"); } return qtrue; } /* if ( Q_stricmp (cmd, "ifCvars") == 0) { if (trap_Argc() >= 4) { char cvar[MAX_CVAR_VALUE_STRING], cvarValue[MAX_CVAR_VALUE_STRING]; char *val = ""; char command[256]; char script[1024]; qboolean doScript = qfalse; int i; Q_strncpyz(cvar, UI_Argv(1), sizeof(cvar)); Q_strncpyz(cvarValue, UI_Argv(2), sizeof(cvarValue)); memset(script, 0, sizeof(script)); for (i=3; i<trap_Argc(); i++) { Q_strncpyz(command, UI_Argv(i), sizeof(command)); Q_strcat(script, sizeof(script), command); if (trap_Argc()-i > 1) { Q_strcat(script, sizeof(script), " "); } } val = UI_Cvar_VariableString(cvar); if (Q_stricmp(val, cvarValue) == 0) { doScript = qtrue; Com_Printf(va("^3%s = %s^7\n", val, cvarValue)); } if (doScript) { trap_Cmd_ExecuteText(EXEC_APPEND, va("%s\n", script)); } } else { Com_Printf(va("Usage: %s <cvarName> <cvarValue> <script>\n", cmd)); } return qtrue; } */ /* if (Q_stricmp(cmd, "error") == 0) { if (trap_Cvar_VariableValue("developer") == 1) { char text[MAX_CVAR_VALUE_STRING]; memset(text, 0, sizeof(text)); if (trap_Argc() == 1) { //Q_strcat(text, sizeof(text), "INFO: Testing error menu. Type 'error [msg]' in the console to see this screen. This command is only available when developer is set to 1"); Q_strcat(text, sizeof(text), "Could not download \"maps/longmapname.pk3\" because autodownloading is disabled on the server\n\nThe server you are connecting to is not a pure server, set autodownload to No in your settings and you might be able to join the game anyway.\n"); } else { Q_strncpyz(text, ConcatArgs(1), sizeof(text)); } Com_Error(ERR_DROP, text); return qtrue; } } */ if (Q_stricmp(cmd, "ui_RQ3_postVidRestart") == 0) { _UI_SetActiveMenu(UIMENU_RQ3_POST_VID_RESTART); return qtrue; } return qfalse; }
/* ================= UI_ConsoleCommand ================= */ qboolean UI_ConsoleCommand( int realTime ) { char *cmd; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv( 0 ); // ensure minimum menu data is available //Menu_Cache(); if ( Q_stricmp (cmd, "ui_test") == 0 ) { UI_ShowPostGame(qtrue); } if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } if ( Q_stricmp (cmd, "ui_load") == 0 ) { UI_Load(); return qtrue; } if ( Q_stricmp (cmd, "ui_opensiegemenu" ) == 0 ) { if ( trap_Cvar_VariableValue ( "g_gametype" ) == GT_SIEGE ) { Menus_CloseAll(); if (Menus_ActivateByName(UI_Argv(1))) { trap_Key_SetCatcher( KEYCATCH_UI ); } } return qtrue; } if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) { //if ( trap_Cvar_VariableValue ( "developer" ) ) { Menus_CloseAll(); if (Menus_ActivateByName(UI_Argv(1))) { trap_Key_SetCatcher( KEYCATCH_UI ); } return qtrue; } } /* if ( Q_stricmp (cmd, "remapShader") == 0 ) { if (trap_Argc() == 4) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, UI_Argv(3)); return qtrue; } } */ if ( Q_stricmp (cmd, "postgame") == 0 ) { UI_CalcPostGameStats(); return qtrue; } if ( Q_stricmp (cmd, "ui_cache") == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) { //UI_TeamOrdersMenu_f(); return qtrue; } if ( Q_stricmp (cmd, "pause") == 0 ) { return qtrue; } return qfalse; }
/* ================= UI_ConsoleCommand ================= */ qboolean UI_ConsoleCommand( int realTime ) { char *cmd; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv( 0 ); // ensure minimum menu data is available //Menu_Cache(); // JKG - Only allow these commands if we're using a debug compile // We don't want players f****n around with these #ifdef _DEBUG if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } /*if ( Q_stricmp (cmd, "ui_testmaster") == 0) { JKG_GLUI_Task_Test(testMasterFinalFunc); return qtrue; } if ( Q_stricmp (cmd, "ui_testterms") == 0) { JKG_GLUI_Task_GetTermsOfUse(termsMasterFinalFunc); return qtrue; } if ( Q_stricmp (cmd, "ui_testregister") == 0 ) { char username[32]; char password[32]; char email[64]; trap_Argv(1, username, 32); trap_Argv(2, password, 32); trap_Argv(3, email, 32); JKG_GLUI_Task_RegisterUser(username, password, email, registerFinalFunc); return qtrue; } if ( Q_stricmp (cmd, "ui_testlogin") == 0 ) { char username[32]; char password[32]; trap_Argv(1, username, 32); trap_Argv(2, password, 32); JKG_GLUI_Task_Login(username, password, loginFinalFunc); return qtrue; }*/ if ( Q_stricmp (cmd, "ui_report") == 0 ) { UI_Report(); return qtrue; } if ( Q_stricmp (cmd, "ui_load") == 0 ) { UI_Load(); return qtrue; } if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) { //if ( trap_Cvar_VariableValue ( "developer" ) ) { Menus_CloseAll(); if (Menus_ActivateByName(UI_Argv(1))) { trap_Key_SetCatcher( KEYCATCH_UI ); } return qtrue; } } if ( Q_stricmp (cmd, "ui_cache") == 0 ) { UI_Cache_f(); return qtrue; } if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) { //UI_TeamOrdersMenu_f(); return qtrue; } #endif // _DEBUG return qfalse; }
qboolean UI_ConsoleCommand(int realTime) { char *cmd; uiClientState_t cstate; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv(0); if (Q_stricmp(cmd, "ui_test") == 0) { UI_ShowPostGame(qtrue); } else if (Q_stricmp(cmd, "ui_report") == 0) { UI_Report(); return qtrue; } else if (Q_stricmp(cmd, "ui_load") == 0) { UI_Load(); return qtrue; } else if (Q_stricmp(cmd, "ui_cache") == 0) { UI_Cache_f(); return qtrue; } else if (Q_stricmp(cmd, "listfavs") == 0) { UI_ListFavourites_f(); return qtrue; } else if (Q_stricmp(cmd, "removefavs") == 0) { UI_RemoveAllFavourites_f(); return qtrue; } else if (Q_stricmp(cmd, "show_menu") == 0 && DC->getCVarValue("developer")) { char *menu_name = UI_Argv(1); if (menu_name) { Menus_OpenByName(menu_name); } } trap_GetClientState(&cstate); if (cstate.connState == CA_DISCONNECTED) { if (Q_stricmp(cmd, "campaign") == 0) { UI_Campaign_f(); return qtrue; } else if (Q_stricmp(cmd, "listcampaigns") == 0) { UI_ListCampaigns_f(); return qtrue; } } return qfalse; }
/* ================= UI_ConsoleCommand ================= */ qboolean UI_ConsoleCommand(int realTime) { char *cmd; char *arg1; uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime; uiInfo.uiDC.realTime = realTime; cmd = UI_Argv(0); // ensure minimum menu data is available //Menu_Cache(); if(Q_stricmp(cmd, "ui_test") == 0) { UI_ShowPostGame(qtrue); } if(Q_stricmp(cmd, "ui_report") == 0) { UI_Report(); return qtrue; } if(Q_stricmp(cmd, "ui_load") == 0) { UI_Load(); return qtrue; } if(Q_stricmp(cmd, "remapShader") == 0) { if(trap_Argc() == 4) { char shader1[MAX_QPATH]; char shader2[MAX_QPATH]; Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1)); Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2)); trap_R_RemapShader(shader1, shader2, UI_Argv(3)); return qtrue; } } if(Q_stricmp(cmd, "postgame") == 0) { UI_CalcPostGameStats(); return qtrue; } if(Q_stricmp(cmd, "ui_cache") == 0) { UI_Cache_f(); return qtrue; } if(Q_stricmp(cmd, "ui_teamOrders") == 0) { //UI_TeamOrdersMenu_f(); return qtrue; } if(Q_stricmp(cmd, "menu") == 0) { arg1 = UI_Argv(1); if(Menu_Count() > 0) { trap_Key_SetCatcher(KEYCATCH_UI); Menus_ActivateByName(arg1); return qtrue; } } if(Q_stricmp(cmd, "closemenus") == 0) { if(Menu_Count() > 0) { trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_UI); trap_Key_ClearStates(); trap_Cvar_Set("cl_paused", "0"); Menus_CloseAll(); return qtrue; } } return qfalse; }