]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/game.cpp
Fix typo in lua_api.txt
[dragonfireclient.git] / src / game.cpp
index 7954c8d8003ab6c7e12f9a51bfbb0aaf32e0980b..71a578a65b5283b44e7357a746f5fe3359a948d6 100644 (file)
@@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "tool.h"
 #include "guiChatConsole.h"
 #include "config.h"
+#include "version.h"
 #include "clouds.h"
 #include "particles.h"
 #include "camera.h"
@@ -794,9 +795,9 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
                services->setPixelShaderConstant("skyBgColor", bgcolorfa, 4);
 
                // Fog distance
-               float fog_distance = *m_fog_range;
-               if(*m_force_fog_off)
-                       fog_distance = 10000*BS;
+               float fog_distance = 10000*BS;
+               if(g_settings->getBool("enable_fog") && !*m_force_fog_off)
+                       fog_distance = *m_fog_range;
                services->setPixelShaderConstant("fogDistance", &fog_distance, 1);
 
                // Day-night ratio
@@ -915,7 +916,6 @@ void the_game(
        std::string address, // If "", local server is used
        u16 port,
        std::wstring &error_message,
-       std::string configpath,
        ChatBackend &chat_backend,
        const SubgameSpec &gamespec, // Used for local game,
        bool simple_singleplayer_mode
@@ -1001,7 +1001,7 @@ void the_game(
                draw_load_screen(text, device, font,0,25);
                delete[] text;
                infostream<<"Creating server"<<std::endl;
-               server = new Server(map_dir, configpath, gamespec,
+               server = new Server(map_dir, gamespec,
                                simple_singleplayer_mode);
                server->start(port);
        }
@@ -1457,6 +1457,8 @@ void the_game(
        Hud hud(driver, guienv, font, text_height,
                        gamedef, player, &local_inventory);
 
+       bool use_weather = g_settings->getBool("weather");
+
        for(;;)
        {
                if(device->run() == false || kill == true)
@@ -1721,7 +1723,7 @@ void the_game(
                        GUIFormSpecMenu *menu =
                                new GUIFormSpecMenu(device, guiroot, -1,
                                        &g_menumgr,
-                                       &client, gamedef);
+                                       &client, gamedef, tsrc);
 
                        InventoryLocation inventoryloc;
                        inventoryloc.setCurrentPlayer();
@@ -2260,7 +2262,7 @@ void the_game(
                                                GUIFormSpecMenu *menu =
                                                                new GUIFormSpecMenu(device, guiroot, -1,
                                                                                &g_menumgr,
-                                                                               &client, gamedef);
+                                                                               &client, gamedef, tsrc);
                                                menu->setFormSource(current_formspec);
                                                menu->setTextDest(current_textdest);
                                                menu->drop();
@@ -2756,7 +2758,7 @@ void the_game(
                                        GUIFormSpecMenu *menu =
                                                new GUIFormSpecMenu(device, guiroot, -1,
                                                        &g_menumgr,
-                                                       &client, gamedef);
+                                                       &client, gamedef, tsrc);
                                        menu->setFormSpec(meta->getString("formspec"),
                                                        inventoryloc);
                                        menu->setFormSource(new NodeMetadataFormSource(
@@ -2861,6 +2863,8 @@ void the_game(
                        fog_range = 100000*BS;
                else {
                        fog_range = draw_control.wanted_range*BS + 0.0*MAP_BLOCKSIZE*BS;
+                       if(use_weather)
+                               fog_range *= (1.5 - 1.4*(float)client.getEnv().getClientMap().getHumidity(pos_i)/100);
                        fog_range = MYMIN(fog_range, (draw_control.farthest_drawn+20)*BS);
                        fog_range *= 0.9;
                }
@@ -2929,7 +2933,7 @@ void the_game(
                        Fog
                */
                
-               if(g_settings->getBool("enable_fog") == true && !force_fog_off)
+               if(g_settings->getBool("enable_fog") && !force_fog_off)
                {
                        driver->setFog(
                                bgcolor,
@@ -2960,9 +2964,6 @@ void the_game(
 
                //TimeTaker guiupdatetimer("Gui updating");
                
-               const char program_name_and_version[] =
-                       "Minetest " VERSION_STRING;
-
                if(show_debug)
                {
                        static float drawtime_avg = 0;
@@ -2976,7 +2977,7 @@ void the_game(
                        
                        std::ostringstream os(std::ios_base::binary);
                        os<<std::fixed
-                               <<program_name_and_version
+                               <<"Minetest "<<minetest_version_hash
                                <<" (R: range_all="<<draw_control.range_all<<")"
                                <<std::setprecision(0)
                                <<" drawtime = "<<drawtime_avg
@@ -2992,7 +2993,9 @@ void the_game(
                }
                else if(show_hud || show_chat)
                {
-                       guitext->setText(narrow_to_wide(program_name_and_version).c_str());
+                       std::ostringstream os(std::ios_base::binary);
+                       os<<"Minetest "<<minetest_version_hash;
+                       guitext->setText(narrow_to_wide(os.str()).c_str());
                        guitext->setVisible(true);
                }
                else
@@ -3200,6 +3203,11 @@ void the_game(
 
                                smgr->drawAll(); // 'smgr->drawAll();' may go here
 
+                               driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
+
+                               if (show_hud)
+                                       hud.drawSelectionBoxes(hilightboxes);
+
 
                                //Right eye...
                                irr::core::vector3df rightEye;
@@ -3224,6 +3232,11 @@ void the_game(
 
                                smgr->drawAll(); // 'smgr->drawAll();' may go here
 
+                               driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
+
+                               if (show_hud)
+                                       hud.drawSelectionBoxes(hilightboxes);
+
 
                                //driver->endScene();
 
@@ -3252,9 +3265,11 @@ void the_game(
                driver->setMaterial(m);
 
                driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
-
-               if (show_hud)
+               if((!g_settings->getBool("anaglyph")) && (show_hud))
+               {
                        hud.drawSelectionBoxes(hilightboxes);
+               }
+
                /*
                        Wielded tool
                */
@@ -3340,7 +3355,7 @@ void the_game(
                */
                {
                        TimeTaker timer("endScene");
-                       endSceneX(driver);
+                       driver->endScene();
                        endscenetime = timer.stop(true);
                }