]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/game.cpp
Merge pull request #465 from doserj/mod_selection_empty_modname_fix
[dragonfireclient.git] / src / game.cpp
index c8f1d218786a1c50a17ec19f5db48d5e0f0f0ee1..5693c5c1275114302087c85b7020df96938efd45 100644 (file)
@@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "guiChatConsole.h"
 #include "config.h"
 #include "clouds.h"
+#include "particles.h"
 #include "camera.h"
 #include "farmesh.h"
 #include "mapblock.h"
@@ -1261,7 +1262,7 @@ void the_game(
        gui::IGUIStaticText *guitext_info = guienv->addStaticText(
                        L"",
                        core::rect<s32>(0,0,400,text_height*5+5) + v2s32(100,200),
-                       false, false);
+                       false, true);
        
        // Status text (displays info when showing and hiding GUI stuff, etc.)
        gui::IGUIStaticText *guitext_status = guienv->addStaticText(
@@ -2099,7 +2100,8 @@ void the_game(
                                {
                                        break;
                                }
-                               else if(event.type == CE_PLAYER_DAMAGE)
+                               else if(event.type == CE_PLAYER_DAMAGE &&
+                                               client.getHP() != 0)
                                {
                                        //u16 damage = event.player_damage.amount;
                                        //infostream<<"Player damage: "<<damage<<std::endl;
@@ -2314,6 +2316,8 @@ void the_game(
 
                if(input->getRightState())
                        repeat_rightclick_timer += dtime;
+               else
+                       repeat_rightclick_timer = 0;
 
                if(playeritem_usable && input->getLeftState())
                {
@@ -2398,6 +2402,13 @@ void the_game(
                                else
                                {
                                        dig_time_complete = params.time;
+                                       if (g_settings->getBool("enable_particles"))
+                                       {
+                                               const ContentFeatures &features =
+                                                       client.getNodeDefManager()->get(n);
+                                               addPunchingParticles
+                                                       (gamedef, smgr, player, nodepos, features.tiles);
+                                       }
                                }
 
                                if(dig_time_complete >= 0.001)
@@ -2429,6 +2440,14 @@ void the_game(
                                        MapNode wasnode = map.getNode(nodepos);
                                        client.removeNode(nodepos);
 
+                                       if (g_settings->getBool("enable_particles"))
+                                       {
+                                               const ContentFeatures &features =
+                                                       client.getNodeDefManager()->get(wasnode);
+                                               addDiggingParticles
+                                                       (gamedef, smgr, player, nodepos, features.tiles);
+                                       }
+
                                        dig_time = 0;
                                        digging = false;
 
@@ -2463,7 +2482,9 @@ void the_game(
                                
                                // Sign special case, at least until formspec is properly implemented.
                                // Deprecated?
-                               if(meta && meta->getString("formspec") == "hack:sign_text_input" && !random_input)
+                               if(meta && meta->getString("formspec") == "hack:sign_text_input" 
+                                               && !random_input
+                                               && !input->isKeyDown(getKeySetting("keymap_sneak")))
                                {
                                        infostream<<"Launching metadata text input"<<std::endl;
                                        
@@ -2478,7 +2499,8 @@ void the_game(
                                                        wtext))->drop();
                                }
                                // If metadata provides an inventory view, activate it
-                               else if(meta && meta->getString("formspec") != "" && !random_input)
+                               else if(meta && meta->getString("formspec") != "" && !random_input
+                                               && !input->isKeyDown(getKeySetting("keymap_sneak")))
                                {
                                        infostream<<"Launching custom inventory view"<<std::endl;
 
@@ -2697,6 +2719,12 @@ void the_game(
                        farmesh->update(v2f(player_position.X, player_position.Z),
                                        brightness, farmesh_range);
                }
+
+               /*
+                       Update particles
+               */
+
+               allparticles_step(dtime, client.getEnv());
                
                /*
                        Fog