mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
More consistent progress bar from 0-100 on startup
This commit is contained in:
parent
35149a10e3
commit
0db73bd83e
@ -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)
|
||||
|
17
src/game.cpp
17
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user