MCPcopy Create free account
hub / github.com/TurningWheel/Barony / loadMods

Method loadMods

src/mod_tools.cpp:11813–12028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11811}
11812
11813void Mods::loadMods()
11814{
11815#ifndef EDITOR
11816 Mods::disableSteamAchievements = false;
11817 Mods::verifyAchievements(nullptr, false);
11818
11819 isLoading = true;
11820 loading = true;
11821 createLoadingScreen(5);
11822 doLoadingScreen();
11823
11824 Mods::customContentLoadedFirstTime = true;
11825
11826 updateLoadingScreen(10);
11827 doLoadingScreen();
11828
11829 // process any new model files encountered in the mod load list.
11830 if ( physfsSearchModelsToUpdate() || !Mods::modelsListModifiedIndexes.empty() )
11831 {
11832 int modelsIndexUpdateStart = 1;
11833 int modelsIndexUpdateEnd = nummodels;
11834 bool oldModelCache = useModelCache;
11835 useModelCache = false;
11836 physfsModelIndexUpdate(modelsIndexUpdateStart, modelsIndexUpdateEnd);
11837 for (int c = modelsIndexUpdateStart; c < modelsIndexUpdateEnd && c < nummodels; ++c) {
11838 if (polymodels[c].faces) {
11839 free(polymodels[c].faces);
11840 polymodels[c].faces = nullptr;
11841 }
11842 if (polymodels[c].vao) {
11843 GL_CHECK_ERR(glDeleteVertexArrays(1, &polymodels[c].vao));
11844 }
11845 if (polymodels[c].positions) {
11846 GL_CHECK_ERR(glDeleteBuffers(1, &polymodels[c].positions));
11847 }
11848 if (polymodels[c].colors) {
11849 GL_CHECK_ERR(glDeleteBuffers(1, &polymodels[c].colors));
11850 }
11851 if (polymodels[c].normals) {
11852 GL_CHECK_ERR(glDeleteBuffers(1, &polymodels[c].normals));
11853 }
11854 }
11855
11856 // polymodels will get free'd if generating all models in generatePolyModels
11857 //free(polymodels);
11858 //polymodels = nullptr;
11859 generatePolyModels(modelsIndexUpdateStart, modelsIndexUpdateEnd, true);
11860 generateVBOs(modelsIndexUpdateStart, modelsIndexUpdateEnd);
11861 useModelCache = oldModelCache;
11862 Mods::modelsListRequiresReloadUnmodded = true;
11863 }
11864
11865 updateLoadingScreen(20);
11866 doLoadingScreen();
11867
11868 if ( physfsSearchSoundsToUpdate() || !Mods::soundsListModifiedIndexes.empty() )
11869 {
11870 physfsReloadSounds(false);

Callers

nothing calls this directly

Calls 15

createLoadingScreenFunction · 0.85
doLoadingScreenFunction · 0.85
updateLoadingScreenFunction · 0.85
physfsModelIndexUpdateFunction · 0.85
generatePolyModelsFunction · 0.85
generateVBOsFunction · 0.85
physfsReloadSoundsFunction · 0.85
physfsReloadTilesFunction · 0.85

Tested by

no test coverage detected