]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/game.cpp
Check the data path before usage
[dragonfireclient.git] / src / game.cpp
index 55ae6686edd4ccc41b348af8c183dbadba418ee8..0f858e879694cc3404a896e207ec0223d91e8afe 100644 (file)
@@ -538,6 +538,43 @@ void getPointedNode(Client *client, v3f player_position,
                                }
                        }
                }
+               else if(n.d == CONTENT_RAIL)
+               {
+                       v3s16 dir = unpackDir(n.dir);
+                       v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
+                       dir_f *= BS/2 - BS/6 - BS/20;
+                       v3f cpf = npf + dir_f;
+                       f32 distance = (cpf - camera_position).getLength();
+
+                       float d = (float)BS/16;
+                       v3f vertices[4] =
+                       {
+                               v3f(BS/2, -BS/2+d, -BS/2),
+                               v3f(-BS/2, -BS/2, BS/2),
+                       };
+
+                       for(s32 i=0; i<2; i++)
+                       {
+                               vertices[i] += npf;
+                       }
+
+                       core::aabbox3d<f32> box;
+
+                       box = core::aabbox3d<f32>(vertices[0]);
+                       box.addInternalPoint(vertices[1]);
+
+                       if(distance < mindistance)
+                       {
+                               if(box.intersectsWithLine(shootline))
+                               {
+                                       nodefound = true;
+                                       nodepos = np;
+                                       neighbourpos = np;
+                                       mindistance = distance;
+                                       nodehilightbox = box;
+                               }
+                       }
+               }
                /*
                        Regular blocks
                */
@@ -1099,7 +1136,7 @@ void the_game(
                */
 
                static f32 dtime_avg1 = 0.0;
-               dtime_avg1 = dtime_avg1 * 0.98 + dtime * 0.02;
+               dtime_avg1 = dtime_avg1 * 0.96 + dtime * 0.04;
                f32 dtime_jitter1 = dtime - dtime_avg1;
 
                static f32 dtime_jitter1_max_sample = 0.0;
@@ -1915,15 +1952,9 @@ void the_game(
                */
                if(farmesh)
                {
-                       farmesh_range = draw_control.wanted_range * 10;
-                       if(draw_control.range_all && farmesh_range < 500)
-                               farmesh_range = 500;
-                       if(farmesh_range > 1000)
-                               farmesh_range = 1000;
-
                        farmesh->step(dtime);
                        farmesh->update(v2f(player_position.X, player_position.Z),
-                                       0.05+brightness*0.95, farmesh_range);
+                                       0.05+brightness*0.95);
                }
                
                // Store brightness value
@@ -1990,7 +2021,7 @@ void the_game(
                        endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;
                        
                        char temptext[300];
-                       snprintf(temptext, 300, "Minetest-c55 %s ("
+                       snprintf(temptext, 300, "Minetest-delta %s ("
                                        "R: range_all=%i"
                                        ")"
                                        " drawtime=%.0f, beginscenetime=%.0f"
@@ -2241,6 +2272,13 @@ void the_game(
                                        core::rect<s32>(0,0,screensize.X,screensize.Y),
                                        NULL);
                }
+
+               /*
+                       Environment post fx
+               */
+               {
+                       client.getEnv()->drawPostFx(driver, camera_position);
+               }
                
                /*
                        End scene