Show wallpaper when loading a savegame

deque
scrawl 11 years ago
parent d2ad2e0f31
commit 577ed3943b

@ -11,6 +11,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/statemanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/inputmanager.hpp" #include "../mwbase/inputmanager.hpp"
@ -26,7 +27,6 @@ namespace MWGui
, WindowBase("openmw_loading_screen.layout") , WindowBase("openmw_loading_screen.layout")
, mLastRenderTime(0.f) , mLastRenderTime(0.f)
, mLastWallpaperChangeTime(0.f) , mLastWallpaperChangeTime(0.f)
, mFirstLoad(true)
, mProgress(0) , mProgress(0)
, mVSyncWasEnabled(false) , mVSyncWasEnabled(false)
{ {
@ -77,7 +77,11 @@ namespace MWGui
mWindow->setVSyncEnabled(false); mWindow->setVSyncEnabled(false);
#endif #endif
if (!mFirstLoad) bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
== MWBase::StateManager::State_NoGame);
if (!showWallpaper)
{ {
mBackgroundImage->setImageTexture(""); mBackgroundImage->setImageTexture("");
int width = mWindow->getWidth(); int width = mWindow->getWidth();
@ -103,12 +107,12 @@ namespace MWGui
setVisible(true); setVisible(true);
if (mFirstLoad) if (showWallpaper)
{ {
changeWallpaper(); changeWallpaper();
} }
MWBase::Environment::get().getWindowManager()->pushGuiMode(mFirstLoad ? GM_LoadingWallpaper : GM_Loading); MWBase::Environment::get().getWindowManager()->pushGuiMode(showWallpaper ? GM_LoadingWallpaper : GM_Loading);
} }
void LoadingScreen::loadingOff() void LoadingScreen::loadingOff()
@ -188,11 +192,6 @@ namespace MWGui
draw(); draw();
} }
void LoadingScreen::removeWallpaper()
{
mFirstLoad = false;
}
void LoadingScreen::draw() void LoadingScreen::draw()
{ {
const float loadingScreenFps = 20.f; const float loadingScreenFps = 20.f;
@ -201,7 +200,10 @@ namespace MWGui
{ {
mLastRenderTime = mTimer.getMilliseconds (); mLastRenderTime = mTimer.getMilliseconds ();
if (mFirstLoad && mTimer.getMilliseconds () > mLastWallpaperChangeTime + 5000*1) bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
== MWBase::StateManager::State_NoGame);
if (showWallpaper && mTimer.getMilliseconds () > mLastWallpaperChangeTime + 5000*1)
{ {
mLastWallpaperChangeTime = mTimer.getMilliseconds (); mLastWallpaperChangeTime = mTimer.getMilliseconds ();
changeWallpaper(); changeWallpaper();

@ -29,8 +29,6 @@ namespace MWGui
virtual void setVisible(bool visible); virtual void setVisible(bool visible);
virtual void removeWallpaper();
LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw); LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw);
virtual ~LoadingScreen(); virtual ~LoadingScreen();
@ -42,8 +40,6 @@ namespace MWGui
void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; } void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
private: private:
bool mFirstLoad;
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow; Ogre::RenderWindow* mWindow;

@ -347,8 +347,6 @@ namespace MWWorld
MWBase::Environment::get().getWorld()->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();
mCellChanged = true; mCellChanged = true;
loadingListener->removeWallpaper();
} }
//We need the ogre renderer and a scene node. //We need the ogre renderer and a scene node.
@ -449,8 +447,6 @@ namespace MWWorld
mCellChanged = true; mCellChanged = true;
MWBase::Environment::get().getWorld ()->getFader ()->fadeIn(0.5); MWBase::Environment::get().getWorld ()->getFader ()->fadeIn(0.5);
loadingListener->removeWallpaper();
} }
void Scene::changeToExteriorCell (const ESM::Position& position) void Scene::changeToExteriorCell (const ESM::Position& position)

@ -18,9 +18,6 @@ namespace Loading
virtual void setProgressRange (size_t range) = 0; virtual void setProgressRange (size_t range) = 0;
virtual void setProgress (size_t value) = 0; virtual void setProgress (size_t value) = 0;
virtual void increaseProgress (size_t increase = 1) = 0; virtual void increaseProgress (size_t increase = 1) = 0;
/// Indicate the scene is now ready to be shown
virtual void removeWallpaper() = 0;
}; };
// Used for stopping a loading sequence when the object goes out of scope // Used for stopping a loading sequence when the object goes out of scope

Loading…
Cancel
Save