MCPcopy Create free account
hub / github.com/JACoders/OpenJK / UI_LoadMenus

Function UI_LoadMenus

code/ui/ui_main.cpp:2923–2995  ·  view source on GitHub ↗

================= UI_LoadMenus Load all menus based on the files listed in the data file in menuFile (default "ui/menus.txt") ================= */

Source from the content-addressed store, hash-verified

2921=================
2922*/
2923void UI_LoadMenus(const char *menuFile, qboolean reset)
2924{
2925// pc_token_t token;
2926// int handle;
2927 int start;
2928
2929 char *buffer;
2930 const char *holdBuffer;
2931 int len;
2932
2933 start = Sys_Milliseconds();
2934
2935 len = ui.FS_ReadFile(menuFile,(void **) &buffer);
2936
2937 if (len<1)
2938 {
2939 Com_Printf( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
2940 len = ui.FS_ReadFile("ui/menus.txt",(void **) &buffer);
2941
2942 if (len<1)
2943 {
2944 Com_Error( ERR_FATAL, "%s", va("default menu file not found: ui/menus.txt, unable to continue!\n", menuFile ));
2945 return;
2946 }
2947 }
2948
2949 if (reset)
2950 {
2951 Menu_Reset();
2952 }
2953
2954 const char *token2;
2955 holdBuffer = buffer;
2956 COM_BeginParseSession();
2957 while ( 1 )
2958 {
2959 token2 = COM_ParseExt( &holdBuffer, qtrue );
2960 if (!*token2)
2961 {
2962 break;
2963 }
2964
2965 if( *token2 == 0 || *token2 == '}') // End of the menus file
2966 {
2967 break;
2968 }
2969
2970 if (*token2 == '{')
2971 {
2972 continue;
2973 }
2974 else if (Q_stricmp(token2, "loadmenu") == 0)
2975 {
2976 if (Load_Menu(&holdBuffer))
2977 {
2978 continue;
2979 }
2980 else

Callers 5

_UI_InitFunction · 0.70
UI_LoadFunction · 0.70
UI_MainMenuFunction · 0.70
UI_LoadMissionSelectMenuFunction · 0.70
Menus_ActivateByNameFunction · 0.70

Calls 10

Q_stricmpFunction · 0.85
COM_EndParseSessionFunction · 0.85
Menu_ResetFunction · 0.70
Load_MenuFunction · 0.70
Sys_MillisecondsFunction · 0.50
Com_PrintfFunction · 0.50
vaFunction · 0.50
Com_ErrorFunction · 0.50
COM_BeginParseSessionFunction · 0.50
COM_ParseExtFunction · 0.50

Tested by

no test coverage detected