/** * @brief Reloads the ui scripts and reinitializes the ui */ static void UI_Restart_f (void) { typedef std::vector<std::string> Names; Names names; for (int i = 0; i < ui_global.windowStackPos; i++) { names.push_back(std::string(ui_global.windowStack[i]->name)); } UI_Shutdown(); CLMN_Shutdown(); R_FontShutdown(); UI_Init(); R_FontInit(); Com_Printf("%i ui script files\n", FS_BuildFileList("ufos/ui/*.ufo")); FS_NextScriptHeader(nullptr, nullptr, nullptr); const char* type, *name, *text; text = nullptr; while ((type = FS_NextScriptHeader("ufos/*.ufo", &name, &text)) != nullptr) { if (Q_streq(type, "font")) UI_ParseFont(name, &text); else if (Q_streq(type, "menu_model")) UI_ParseUIModel(name, &text); else if (Q_streq(type, "sprite")) UI_ParseSprite(name, &text); } UI_Reinit(); FS_NextScriptHeader(nullptr, nullptr, nullptr); text = nullptr; while ((type = FS_NextScriptHeader("ufos/ui/*.ufo", &name, &text)) != nullptr) { if (Q_streq(type, "window")) UI_ParseWindow(type, name, &text); else if (Q_streq(type, "component")) UI_ParseComponent(type, name, &text); else if (Q_streq(type, "menu_model")) UI_ParseUIModel(name, &text); else if (Q_streq(type, "sprite")) UI_ParseSprite(name, &text); else if (Q_streq(type, "lua")) UI_ParseAndLoadLuaScript(name, &text); } CLMN_Init(); for (Names::iterator i = names.begin(); i != names.end(); ++i) { UI_PushWindow(i->c_str()); } }
/** * @brief Called at client startup * @note not called for dedicated servers * parses all *.ufos that are needed for single- and multiplayer * @sa Com_ParseScripts * @sa CL_ParseScriptSecond * @sa CL_ParseScriptFirst * @note Nothing here should depends on items, equipments, actors and all other * entities that are parsed in Com_ParseScripts (because maybe items are not parsed * but e.g. techs would need those parsed items - thus we have to parse e.g. techs * at a later stage) * @note This data is persistent until you shutdown the game * @return True if the parsing function succeeded. */ bool CL_ParseClientData (const char* type, const char* name, const char** text) { #ifndef COMPILE_UNITTESTS static int progressCurrent = 0; progressCurrent++; if (progressCurrent % 10 == 0) SCR_DrawLoadingScreen(false, std::min(progressCurrent * 30 / 1500, 30)); #endif if (Q_streq(type, "window")) return UI_ParseWindow(type, name, text); else if (Q_streq(type, "component")) return UI_ParseComponent(type, name, text); else if (Q_streq(type, "particle")) CL_ParseParticle(name, text); else if (Q_streq(type, "language")) CL_ParseLanguages(name, text); else if (Q_streq(type, "font")) return UI_ParseFont(name, text); else if (Q_streq(type, "tutorial")) TUT_ParseTutorials(name, text); else if (Q_streq(type, "menu_model")) return UI_ParseUIModel(name, text); else if (Q_streq(type, "sprite")) return UI_ParseSprite(name, text); else if (Q_streq(type, "sequence")) CL_ParseSequence(name, text); else if (Q_streq(type, "music")) M_ParseMusic(name, text); else if (Q_streq(type, "actorskin")) CL_ParseActorSkin(name, text); else if (Q_streq(type, "cgame")) GAME_ParseModes(name, text); else if (Q_streq(type, "tip")) CL_ParseTipOfTheDay(name, text); return true; }