diff options
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 1685dc11c..ed5bcb87b 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -53,95 +53,6 @@ void MapNode::getColor(const ContentFeatures &f, video::SColor *color) const *color = f.color; } -void MapNode::setLight(LightBank bank, u8 a_light, const ContentFeatures &f) noexcept -{ - // If node doesn't contain light data, ignore this - if(f.param_type != CPT_LIGHT) - return; - if(bank == LIGHTBANK_DAY) - { - param1 &= 0xf0; - param1 |= a_light & 0x0f; - } - else if(bank == LIGHTBANK_NIGHT) - { - param1 &= 0x0f; - param1 |= (a_light & 0x0f)<<4; - } - else - assert("Invalid light bank" == NULL); -} - -void MapNode::setLight(LightBank bank, u8 a_light, const NodeDefManager *nodemgr) -{ - setLight(bank, a_light, nodemgr->get(*this)); -} - -bool MapNode::isLightDayNightEq(const NodeDefManager *nodemgr) const -{ - const ContentFeatures &f = nodemgr->get(*this); - bool isEqual; - - if (f.param_type == CPT_LIGHT) { - u8 day = MYMAX(f.light_source, param1 & 0x0f); - u8 night = MYMAX(f.light_source, (param1 >> 4) & 0x0f); - isEqual = day == night; - } else { - isEqual = true; - } - - return isEqual; -} - -u8 MapNode::getLight(LightBank bank, const NodeDefManager *nodemgr) const -{ - // Select the brightest of [light source, propagated light] - const ContentFeatures &f = nodemgr->get(*this); - - u8 light; - if(f.param_type == CPT_LIGHT) - light = bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f; - else - light = 0; - - return MYMAX(f.light_source, light); -} - -u8 MapNode::getLightRaw(LightBank bank, const ContentFeatures &f) const noexcept -{ - if(f.param_type == CPT_LIGHT) - return bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f; - return 0; -} - -u8 MapNode::getLightNoChecks(LightBank bank, const ContentFeatures *f) const noexcept -{ - return MYMAX(f->light_source, - bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f); -} - -bool MapNode::getLightBanks(u8 &lightday, u8 &lightnight, - const NodeDefManager *nodemgr) const -{ - // Select the brightest of [light source, propagated light] - const ContentFeatures &f = nodemgr->get(*this); - if(f.param_type == CPT_LIGHT) - { - lightday = param1 & 0x0f; - lightnight = (param1>>4)&0x0f; - } - else - { - lightday = 0; - lightnight = 0; - } - if(f.light_source > lightday) - lightday = f.light_source; - if(f.light_source > lightnight) - lightnight = f.light_source; - return f.param_type == CPT_LIGHT || f.light_source != 0; -} - u8 MapNode::getFaceDir(const NodeDefManager *nodemgr, bool allow_wallmounted) const { |