diff options
author | sapier <Sapier at GMX dot net> | 2014-08-23 12:16:46 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2015-01-02 17:53:42 +0100 |
commit | 0db73bd83effa7dbc0f28862c8157e0283d24e44 (patch) | |
tree | 9a4d17a2b659da9e29ca8fc7edc1bd8d8b1fc132 /src | |
parent | 35149a10e3b26425e358cb6f4ae0449a052d30a7 (diff) | |
download | minetest-0db73bd83effa7dbc0f28862c8157e0283d24e44.tar.gz minetest-0db73bd83effa7dbc0f28862c8157e0283d24e44.tar.bz2 minetest-0db73bd83effa7dbc0f28862c8157e0283d24e44.zip |
More consistent progress bar from 0-100 on startup
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 23 | ||||
-rw-r--r-- | src/game.cpp | 17 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/client.cpp b/src/client.cpp index b401eb804..cfa8704b3 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2703,17 +2703,27 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font) assert(m_nodedef_received); assert(mediaReceived()); + wchar_t* text = wgettext("Loading textures..."); + // Rebuild inherited images and recreate textures infostream<<"- Rebuilding images and textures"<<std::endl; + draw_load_screen(text,device, guienv, 0, 70); m_tsrc->rebuildImagesAndTextures(); + delete[] text; // Rebuild shaders infostream<<"- Rebuilding shaders"<<std::endl; + text = wgettext("Rebuilding shaders..."); + draw_load_screen(text, device, guienv, 0, 75); m_shsrc->rebuildShaders(); + delete[] text; // Update node aliases infostream<<"- Updating node aliases"<<std::endl; + text = wgettext("Initializing nodes..."); + draw_load_screen(text, device, guienv, 0, 80); m_nodedef->updateAliases(m_itemdef); + delete[] text; // Update node textures and assign shaders to each tile infostream<<"- Updating node textures"<<std::endl; @@ -2723,21 +2733,21 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font) if(g_settings->getBool("preload_item_visuals")) { verbosestream<<"Updating item textures and meshes"<<std::endl; - wchar_t* text = wgettext("Item textures..."); + text = wgettext("Item textures..."); draw_load_screen(text, device, guienv, 0, 0); std::set<std::string> names = m_itemdef->getAll(); size_t size = names.size(); size_t count = 0; int percent = 0; for(std::set<std::string>::const_iterator - i = names.begin(); i != names.end(); ++i){ + i = names.begin(); i != names.end(); ++i) + { // Asking for these caches the result m_itemdef->getInventoryTexture(*i, this); m_itemdef->getWieldMesh(*i, this); count++; - percent = count*100/size; - if (count%50 == 0) // only update every 50 item - draw_load_screen(text, device, guienv, 0, percent); + percent = (count * 100 / size * 0.2) + 80; + draw_load_screen(text, device, guienv, 0, percent); } delete[] text; } @@ -2748,7 +2758,10 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font) m_state = LC_Ready; sendReady(); + text = wgettext("Done!"); + draw_load_screen(text, device, guienv, 0, 100); infostream<<"Client::afterContentReceived() done"<<std::endl; + delete[] text; } float Client::getRTT(void) diff --git a/src/game.cpp b/src/game.cpp index 5d44a7db5..6eb6aaec4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1325,7 +1325,6 @@ struct FpsControl { * many functions that do require objects of thse types do not modify them * (so they can be passed as a const qualified parameter) */ - struct CameraOrientation { f32 camera_yaw; // "right/left" f32 camera_pitch; // "up/down" @@ -1898,7 +1897,7 @@ bool Game::initSound() bool Game::createSingleplayerServer(const std::string map_dir, const SubgameSpec &gamespec, u16 port, std::string *address) { - showOverlayMessage("Creating server...", 0, 25); + showOverlayMessage("Creating server...", 0, 5); std::string bind_str = g_settings->get("bind_address"); Address bind_addr(0, 0, 0, 0, port); @@ -1936,7 +1935,7 @@ bool Game::createClient(const std::string &playername, const std::string &password, std::string *address, u16 port, std::wstring *error_message) { - showOverlayMessage("Creating client...", 0, 50); + showOverlayMessage("Creating client...", 0, 10); draw_control = new MapDrawControl; if (!draw_control) @@ -2105,7 +2104,7 @@ bool Game::connectToServer(const std::string &playername, const std::string &password, std::string *address, u16 port, bool *connect_ok, bool *aborted) { - showOverlayMessage("Resolving address...", 0, 75); + showOverlayMessage("Resolving address...", 0, 15); Address connect_address(0, 0, 0, 0, port); @@ -2196,7 +2195,7 @@ bool Game::connectToServer(const std::string &playername, } // Update status - showOverlayMessage("Connecting to server...", dtime, 100); + showOverlayMessage("Connecting to server...", dtime, 20); } } catch (con::PeerNotFoundException &e) { // TODO: Should something be done here? At least an info/error @@ -2251,16 +2250,16 @@ bool Game::getServerContent(bool *aborted) } // Display status - int progress = 0; + int progress = 25; if (!client->itemdefReceived()) { wchar_t *text = wgettext("Item definitions..."); - progress = 0; + progress = 25; draw_load_screen(text, device, guienv, dtime, progress); delete[] text; } else if (!client->nodedefReceived()) { wchar_t *text = wgettext("Node definitions..."); - progress = 25; + progress = 30; draw_load_screen(text, device, guienv, dtime, progress); delete[] text; } else { @@ -2281,7 +2280,7 @@ bool Game::getServerContent(bool *aborted) message << " ( " << cur << cur_unit << " )"; } - progress = 50 + client->mediaReceiveProgress() * 50 + 0.5; + progress = 30 + client->mediaReceiveProgress() * 35 + 0.5; draw_load_screen(narrow_to_wide(message.str().c_str()), device, guienv, dtime, progress); } |