diff options
author | paramat <paramat@users.noreply.github.com> | 2017-09-18 05:08:56 +0100 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:31:59 +0200 |
commit | b8f473be21b932c0c0cdb9ae3bfb4243f262a763 (patch) | |
tree | 334535c97691b87eee0697fabbddb1f5c5355f70 /src | |
parent | b1fae4c7beb66b4aa63ad04ac6ba9e145b39ca82 (diff) | |
download | minetest-b8f473be21b932c0c0cdb9ae3bfb4243f262a763.tar.gz minetest-b8f473be21b932c0c0cdb9ae3bfb4243f262a763.tar.bz2 minetest-b8f473be21b932c0c0cdb9ae3bfb4243f262a763.zip |
Leveled nodebox: Change levels from 1/63rds to 1/64ths
Add missing documentation of leveled nodebox to lua_api.txt, plus
a little cleaning up nearby.
Diffstat (limited to 'src')
-rw-r--r-- | src/mapnode.cpp | 15 | ||||
-rw-r--r-- | src/mapnode.h | 4 |
2 files changed, 6 insertions, 13 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index d835daba2..ff5ad5557 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -249,18 +249,11 @@ void transformNodeBox(const MapNode &n, const NodeBox &nodebox, int facedir = n.getFaceDir(nodemgr); u8 axisdir = facedir>>2; facedir&=0x03; - for(std::vector<aabb3f>::const_iterator - i = fixed.begin(); - i != fixed.end(); ++i) - { - aabb3f box = *i; - - if (nodebox.type == NODEBOX_LEVELED) { - box.MaxEdge.Y = -BS/2 + BS*((float)1/LEVELED_MAX) * n.getLevel(nodemgr); - } + for (aabb3f box : fixed) { + if (nodebox.type == NODEBOX_LEVELED) + box.MaxEdge.Y = (-0.5f + n.getLevel(nodemgr) / 64.0f) * BS; - switch (axisdir) - { + switch (axisdir) { case 0: if(facedir == 1) { diff --git a/src/mapnode.h b/src/mapnode.h index 9c56a7e17..23248c45d 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -103,8 +103,8 @@ enum Rotation { #define LIQUID_INFINITY_MASK 0x80 //0b10000000 -// mask for param2, now as for liquid -#define LEVELED_MASK 0x3F +// mask for leveled nodebox param2 +#define LEVELED_MASK 0x7F #define LEVELED_MAX LEVELED_MASK |