diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-05-13 18:06:47 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-05-13 18:06:47 +0200 |
commit | f3e741dad1311e0b4057b530386e246f921be52c (patch) | |
tree | 64581e3f0ddfa9d4740eed7b545fe3db87b8c126 /src/mapnode.cpp | |
parent | 96a37aed31cfb9c131e46eda80bdbe3d2289a546 (diff) | |
parent | 69c70dd319532f7860f211f4a527a902b0386e49 (diff) | |
download | dragonfireclient-f3e741dad1311e0b4057b530386e246f921be52c.tar.xz |
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 0551f3b6f..c885bfe1d 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -159,8 +159,11 @@ u8 MapNode::getWallMounted(const NodeDefManager *nodemgr) const { const ContentFeatures &f = nodemgr->get(*this); if (f.param_type_2 == CPT2_WALLMOUNTED || - f.param_type_2 == CPT2_COLORED_WALLMOUNTED) + f.param_type_2 == CPT2_COLORED_WALLMOUNTED) { return getParam2() & 0x07; + } else if (f.drawtype == NDT_SIGNLIKE || f.drawtype == NDT_TORCHLIKE) { + return 1; + } return 0; } @@ -177,6 +180,16 @@ v3s16 MapNode::getWallMountedDir(const NodeDefManager *nodemgr) const } } +u8 MapNode::getDegRotate(const NodeDefManager *nodemgr) const +{ + const ContentFeatures &f = nodemgr->get(*this); + if (f.param_type_2 == CPT2_DEGROTATE) + return getParam2() % 240; + if (f.param_type_2 == CPT2_COLORED_DEGROTATE) + return 10 * ((getParam2() & 0x1F) % 24); + return 0; +} + void MapNode::rotateAlongYAxis(const NodeDefManager *nodemgr, Rotation rot) { ContentParamType2 cpt2 = nodemgr->get(*this).param_type_2; @@ -230,6 +243,17 @@ void MapNode::rotateAlongYAxis(const NodeDefManager *nodemgr, Rotation rot) Rotation oldrot = wallmounted_to_rot[wmountface - 2]; param2 &= ~7; param2 |= rot_to_wallmounted[(oldrot - rot) & 3]; + } else if (cpt2 == CPT2_DEGROTATE) { + int angle = param2; // in 1.5° + angle += 60 * rot; // don’t do that on u8 + angle %= 240; + param2 = angle; + } else if (cpt2 == CPT2_COLORED_DEGROTATE) { + int angle = param2 & 0x1F; // in 15° + int color = param2 & 0xE0; + angle += 6 * rot; + angle %= 24; + param2 = color | angle; } } |