]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client/content_mapblock.cpp
Restore Irrlicht 1.9 support
[dragonfireclient.git] / src / client / content_mapblock.cpp
index f7d20001f41d33eb3c494d31c225260efd2a71e4..90284ecce51c9f03c6ea53d7883a823fbd402a67 100644 (file)
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include <cmath>
 #include "content_mapblock.h"
 #include "util/numeric.h"
 #include "util/directiontables.h"
@@ -512,10 +513,10 @@ f32 MapblockMeshGenerator::getCornerLevel(int i, int k)
                        count++;
                } else if (content == CONTENT_AIR) {
                        air_count++;
-                       if (air_count >= 2)
-                               return -0.5 * BS + 0.2;
                }
        }
+       if (air_count >= 2)
+               return -0.5 * BS + 0.2;
        if (count > 0)
                return sum / count;
        return 0;
@@ -722,7 +723,8 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
        for (auto &glass_tile : glass_tiles)
                glass_tile = tiles[4];
 
-       u8 param2 = n.getParam2();
+       // Only respect H/V merge bits when paramtype2 = "glasslikeliquidlevel" (liquid tank)
+       u8 param2 = (f->param_type_2 == CPT2_GLASSLIKE_LIQUID_LEVEL) ? n.getParam2() : 0;
        bool H_merge = !(param2 & 128);
        bool V_merge = !(param2 & 64);
        param2 &= 63;
@@ -1453,10 +1455,10 @@ void MapblockMeshGenerator::generate()
        }
 }
 
-void MapblockMeshGenerator::renderSingle(content_t node)
+void MapblockMeshGenerator::renderSingle(content_t node, u8 param2)
 {
        p = {0, 0, 0};
-       n = MapNode(node, 0xff, 0x00);
+       n = MapNode(node, 0xff, param2);
        f = &nodedef->get(n);
        drawNode();
 }