diff options
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 42f020e71..1685dc11c 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -149,6 +149,9 @@ u8 MapNode::getFaceDir(const NodeDefManager *nodemgr, if (f.param_type_2 == CPT2_FACEDIR || f.param_type_2 == CPT2_COLORED_FACEDIR) return (getParam2() & 0x1F) % 24; + if (f.param_type_2 == CPT2_4DIR || + f.param_type_2 == CPT2_COLORED_4DIR) + return getParam2() & 0x03; if (allow_wallmounted && (f.param_type_2 == CPT2_WALLMOUNTED || f.param_type_2 == CPT2_COLORED_WALLMOUNTED)) return wallmounted_to_facedir[getParam2() & 0x07]; @@ -196,7 +199,8 @@ void MapNode::rotateAlongYAxis(const NodeDefManager *nodemgr, Rotation rot) { ContentParamType2 cpt2 = nodemgr->get(*this).param_type_2; - if (cpt2 == CPT2_FACEDIR || cpt2 == CPT2_COLORED_FACEDIR) { + if (cpt2 == CPT2_FACEDIR || cpt2 == CPT2_COLORED_FACEDIR || + cpt2 == CPT2_4DIR || cpt2 == CPT2_COLORED_4DIR) { static const u8 rotate_facedir[24 * 4] = { // Table value = rotated facedir // Columns: 0, 90, 180, 270 degrees rotation around vertical axis @@ -232,10 +236,17 @@ void MapNode::rotateAlongYAxis(const NodeDefManager *nodemgr, Rotation rot) 22, 21, 20, 23, 23, 22, 21, 20 }; - u8 facedir = (param2 & 31) % 24; - u8 index = facedir * 4 + rot; - param2 &= ~31; - param2 |= rotate_facedir[index]; + if (cpt2 == CPT2_FACEDIR || cpt2 == CPT2_COLORED_FACEDIR) { + u8 facedir = (param2 & 31) % 24; + u8 index = facedir * 4 + rot; + param2 &= ~31; + param2 |= rotate_facedir[index]; + } else if (cpt2 == CPT2_4DIR || cpt2 == CPT2_COLORED_4DIR) { + u8 fourdir = param2 & 3; + u8 index = fourdir + rot; + param2 &= ~3; + param2 |= rotate_facedir[index]; + } } else if (cpt2 == CPT2_WALLMOUNTED || cpt2 == CPT2_COLORED_WALLMOUNTED) { u8 wmountface = (param2 & 7); |