]> git.lizzy.rs Git - minetest.git/blobdiff - src/game.cpp
Warnings fix
[minetest.git] / src / game.cpp
index bcd155a79f9b0916d20d3d8daf53eca1219abc6b..0c7d15d0cde86f8a50e9333fd94d4f04ea68f095 100644 (file)
@@ -208,33 +208,6 @@ class PlayerInventoryFormSource: public IFormSource
        Client *m_client;
 };
 
-class FormspecFormSource: public IFormSource
-{
-public:
-       FormspecFormSource(std::string formspec,FormspecFormSource** game_formspec)
-       {
-               m_formspec = formspec;
-               m_game_formspec = game_formspec;
-       }
-
-       ~FormspecFormSource()
-       {
-               *m_game_formspec = 0;
-       }
-
-       void setForm(std::string formspec) {
-               m_formspec = formspec;
-       }
-
-       std::string getForm()
-       {
-               return m_formspec;
-       }
-
-       std::string m_formspec;
-       FormspecFormSource** m_game_formspec;
-};
-
 /*
        Check if a node is pointable
 */
@@ -831,6 +804,10 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
                u32 daynight_ratio = m_client->getEnv().getDayNightRatio();
                float daynight_ratio_f = (float)daynight_ratio / 1000.0;
                services->setPixelShaderConstant("dayNightRatio", &daynight_ratio_f, 1);
+               
+               // Normal map texture layer
+               int layer = 1;
+               services->setPixelShaderConstant("normalTexture" , (irr::f32*)&layer, 1);
        }
 };
 
@@ -2478,6 +2455,7 @@ void the_game(
                camera.step(dtime);
 
                v3f player_position = player->getPosition();
+               v3s16 pos_i = floatToInt(player_position, BS);
                v3f camera_position = camera.getPosition();
                v3f camera_direction = camera.getDirection();
                f32 camera_fov = camera.getFovMax();
@@ -2511,7 +2489,12 @@ void the_game(
                
                //u32 t1 = device->getTimer()->getRealTime();
                
-               f32 d = 4; // max. distance
+               f32 d = playeritem_def.range; // max. distance
+               f32 d_hand = itemdef->get("").range;
+               if(d < 0 && d_hand >= 0)
+                       d = d_hand;
+               else if(d < 0)
+                       d = 4.0;
                core::line3d<f32> shootline(camera_position,
                                camera_position + camera_direction * BS * (d+1));
 
@@ -2635,20 +2618,6 @@ void the_game(
                                        if(tp)
                                                params = getDigParams(nodedef->get(n).groups, tp);
                                }
-                               
-                               SimpleSoundSpec sound_dig = nodedef->get(n).sound_dig;
-                               if(sound_dig.exists()){
-                                       if(sound_dig.name == "__group"){
-                                               if(params.main_group != ""){
-                                                       soundmaker.m_player_leftpunch_sound.gain = 0.5;
-                                                       soundmaker.m_player_leftpunch_sound.name =
-                                                                       std::string("default_dig_") +
-                                                                                       params.main_group;
-                                               }
-                                       } else{
-                                               soundmaker.m_player_leftpunch_sound = sound_dig;
-                                       }
-                               }
 
                                float dig_time_complete = 0.0;
 
@@ -2681,6 +2650,20 @@ void the_game(
                                        dig_index = crack_animation_length;
                                }
 
+                               SimpleSoundSpec sound_dig = nodedef->get(n).sound_dig;
+                               if(sound_dig.exists() && params.diggable){
+                                       if(sound_dig.name == "__group"){
+                                               if(params.main_group != ""){
+                                                       soundmaker.m_player_leftpunch_sound.gain = 0.5;
+                                                       soundmaker.m_player_leftpunch_sound.name =
+                                                                       std::string("default_dig_") +
+                                                                                       params.main_group;
+                                               }
+                                       } else{
+                                               soundmaker.m_player_leftpunch_sound = sound_dig;
+                                       }
+                               }
+
                                // Don't show cracks if not diggable
                                if(dig_time_complete >= 100000.0)
                                {
@@ -3052,7 +3035,9 @@ void the_game(
                                <<", "<<(player_position.Y/BS)
                                <<", "<<(player_position.Z/BS)
                                <<") (yaw="<<(wrapDegrees_0_360(camera_yaw))
-                               <<") (seed = "<<((unsigned long long)client.getMapSeed())
+                               <<") (t="<<client.getEnv().getClientMap().getHeat(pos_i)
+                               <<"C, h="<<client.getEnv().getClientMap().getHumidity(pos_i)
+                               <<"%) (seed = "<<((unsigned long long)client.getMapSeed())
                                <<")";
                        guitext2->setText(narrow_to_wide(os.str()).c_str());
                        guitext2->setVisible(true);