]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/clientmap.cpp
Add disable_jump and fall_damage_add_percent node groups
[dragonfireclient.git] / src / clientmap.cpp
index 3aa8af84884c2ba65c64edc46770723b32369c34..4d14cc1a24bfdb36acbcc7b82a87f00faf2e485b 100644 (file)
@@ -3,16 +3,16 @@ Minetest-c55
 Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock.h"
 #include "profiler.h"
 #include "settings.h"
+#include "util/mathconstants.h"
 
 #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
 
@@ -46,7 +47,7 @@ ClientMap::ClientMap(
        m_control(control),
        m_camera_position(0,0,0),
        m_camera_direction(0,0,1),
-       m_camera_fov(PI)
+       m_camera_fov(M_PI)
 {
        m_camera_mutex.Init();
        assert(m_camera_mutex.IsInitialized());
@@ -324,6 +325,16 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                                Occlusion culling
                        */
 
+                       // No occlusion culling when free_move is on and camera is
+                       // inside ground
+                       bool occlusion_culling_enabled = true;
+                       if(g_settings->getBool("free_move")){
+                               MapNode n = getNodeNoEx(cam_pos_nodes);
+                               if(n.getContent() == CONTENT_IGNORE ||
+                                               nodemgr->get(n).solidness == 2)
+                                       occlusion_culling_enabled = false;
+                       }
+
                        v3s16 cpn = block->getPos() * MAP_BLOCKSIZE;
                        cpn += v3s16(MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2, MAP_BLOCKSIZE/2);
                        float step = BS*1;
@@ -334,6 +345,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        s16 bs2 = MAP_BLOCKSIZE/2 + 1;
                        u32 needed_count = 1;
                        if(
+                               occlusion_culling_enabled &&
                                isOccluded(this, spn, cpn + v3s16(0,0,0),
                                        step, stepfac, startoff, endoff, needed_count, nodemgr) &&
                                isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2),
@@ -543,6 +555,7 @@ static bool getVisibleBrightness(Map *map, v3f p0, v3f dir, float step,
                        float newd = 2*BS;
                        pf = p0 + dir * 2*newd;
                        distance = newd;
+                       sunlight_min_d = 0;
                }
        }
        for(int i=0; distance < end_distance; i++){
@@ -597,9 +610,9 @@ int ClientMap::getBackgroundBrightness(float max_d, u32 daylight_factor,
        if(z_directions[0].X < -99){
                for(u32 i=0; i<sizeof(z_directions)/sizeof(*z_directions); i++){
                        z_directions[i] = v3f(
-                               0.01 * myrand_range(-80, 80),
+                               0.01 * myrand_range(-100, 100),
                                1.0,
-                               0.01 * myrand_range(-80, 80)
+                               0.01 * myrand_range(-100, 100)
                        );
                        z_offsets[i] = 0.01 * myrand_range(0,100);
                }