Fix flowing liquid animation direction calculation
authorPerttu Ahola <celeron55@gmail.com>
Fri, 2 Nov 2012 16:05:42 +0000 (18:05 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 2 Nov 2012 16:05:42 +0000 (18:05 +0200)
src/content_mapblock.cpp

index ad819e7939e9669853f44db449a339a06e40e4c3..ff8ef5276deec6788b0f6a6bb6b9d655ba5c6869 100644 (file)
@@ -492,15 +492,15 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
                                // -Z towards +Z, thus the direction is +Z.
                                // Rotate texture to make animation go in flow direction
                                // Positive if liquid moves towards +Z
-                               int dz = (corner_levels[side_corners[2][0]] +
-                                               corner_levels[side_corners[2][1]] <
-                                               corner_levels[side_corners[3][0]] +
-                                               corner_levels[side_corners[3][1]]);
+                               int dz = (corner_levels[side_corners[3][0]] +
+                                               corner_levels[side_corners[3][1]]) -
+                                               (corner_levels[side_corners[2][0]] +
+                                               corner_levels[side_corners[2][1]]);
                                // Positive if liquid moves towards +X
-                               int dx = (corner_levels[side_corners[0][0]] +
-                                               corner_levels[side_corners[0][1]] <
-                                               corner_levels[side_corners[1][0]] +
-                                               corner_levels[side_corners[1][1]]);
+                               int dx = (corner_levels[side_corners[1][0]] +
+                                               corner_levels[side_corners[1][1]]) -
+                                               (corner_levels[side_corners[0][0]] +
+                                               corner_levels[side_corners[0][1]]);
                                // -X
                                if(-dx >= abs(dz))
                                {