diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index 79cbd4752e..848cc1c719 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -29,15 +29,17 @@ namespace MWGui if (!mLoadingOn) loadingOn(); + const int numRefLists = 20; + if (depth == 0) { mCurrentCellLoading = current; mTotalCellsLoading = total; mCurrentRefLoading = 0; - + mCurrentRefList = 0; } - if (depth == 1) + else if (depth == 1) { mCurrentRefLoading = current; mTotalRefsLoading = total; @@ -54,7 +56,14 @@ namespace MWGui refProgress = 1; else refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1); -std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoading-1 << std::endl; + refProgress += mCurrentRefList; + refProgress /= numRefLists; + + assert(refProgress <= 1 && refProgress >= 0); + + if (depth == 1 && mCurrentRefLoading == mTotalRefsLoading-1) + ++mCurrentRefList; + float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading); assert(progress <= 1 && progress >= 0); if (progress >= 1) @@ -78,7 +87,7 @@ std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoa // SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work. for (int i = 0; i < Ogre::RENDER_QUEUE_MAX; ++i) { - if (i > 10 && i < 90) + if (i > 0 && i < 90) mSceneMgr->addSpecialCaseRenderQueue(i); } mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE); @@ -87,7 +96,9 @@ std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoa // (e.g. when using "coc" console command, it would enter an infinite loop and crash due to overflow) MWBase::Environment::get().getInputManager()->update(0, true); + mWindow->getViewport(0)->setClearEveryFrame(false); mWindow->update(); + mWindow->getViewport(0)->setClearEveryFrame(true); // resume 3d rendering mSceneMgr->clearSpecialCaseRenderQueues(); diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index ec01714f82..2256bca6b1 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -31,6 +31,7 @@ namespace MWGui int mTotalCellsLoading; int mCurrentRefLoading; int mTotalRefsLoading; + int mCurrentRefList; bool mLoadingOn; diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index bcf4a2002d..c3843b831c 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -50,6 +50,10 @@ namespace } } } + else + { + MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, 0, 1); + } } }