/* Minetest-c55 Copyright (C) 2010 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "nodedef.h" #include "main.h" // For g_settings #include "nodemetadata.h" #ifndef SERVER #include "tile.h" #endif #include "log.h" #include "settings.h" #include "nameidmapping.h" /* NodeBox */ void NodeBox::serialize(std::ostream &os) const { writeU8(os, 0); // version writeU8(os, type); writeV3F1000(os, fixed.MinEdge); writeV3F1000(os, fixed.MaxEdge); writeV3F1000(os, wall_top.MinEdge); writeV3F1000(os, wall_top.MaxEdge); writeV3F1000(os, wall_bottom.MinEdge); writeV3F1000(os, wall_bottom.MaxEdge); writeV3F1000(os, wall_side.MinEdge); writeV3F1000(os, wall_side.MaxEdge); } void NodeBox::deSerialize(std::istream &is) { int version = readU8(is); if(version != 0) throw SerializationError("unsupported NodeBox version"); type = (enum NodeBoxType)readU8(is); fixed.MinEdge = readV3F1000(is); fixed.MaxEdge = readV3F1000(is); wall_top.MinEdge = readV3F1000(is); wall_top.MaxEdge = readV3F1000(is); wall_bottom.MinEdge = readV3F1000(is); wall_bottom.MaxEdge = readV3F1000(is); wall_side.MinEdge = readV3F1000(is); wall_side.MaxEdge = readV3F1000(is); } /* MaterialSpec */ void MaterialSpec::serialize(std::ostream &os) const { os<set(i, get(i)); } return mgr; } virtual const ContentFeatures& get(content_t c) const { assert(c <= MAX_CONTENT); return m_content_features[c]; } virtual const ContentFeatures& get(const MapNode &n) const { return get(n.getContent()); } virtual bool getId(const std::string &name, content_t &result) const { return m_name_id_mapping.getId(name, result); } virtual content_t getId(const std::string &name) const { content_t id = CONTENT_IGNORE; getId(name, id); return id; } virtual const ContentFeatures& get(const std::string &name) const { content_t id = CONTENT_IGNORE; getId(name, id); return get(id); } // IWritableNodeDefManager virtual void set(content_t c, const ContentFeatures &def) { infostream<<"registerNode: registering content id \""< return end mm_texture.update_game(gamedetails) end -------------------------------------------------------------------------------- function mm_texture.reset() mm_texture.gameid = nil local have_bg = false local have_overlay = mm_texture.set_generic("overlay") if not have_overlay then have_bg = mm_texture.set_generic("background") end mm_texture.clear("header") mm_texture.clear("footer") core.set_clouds(false) mm_texture.set_generic("footer") mm_texture.set_generic("header") if not have_bg then if core.setting_getbool("menu_clouds") then core.set_clouds(true) else mm_texture.set_dirt_bg() end end end -------------------------------------------------------------------------------- function mm_texture.update_game(gamedetails) if mm_texture.gameid == gamedetails.id then return end local have_bg = false local have_overlay = mm_texture.set_game("overlay",gamedetails) if not have_overlay then have_bg = mm_texture.set_game("background",gamedetails) end mm_texture.clear("header") mm_texture.clear("footer") core.set_clouds(false) if not have_bg then if core.setting_getbool("menu_clouds") then core.set_clouds<