From 6a76c226e10e92c3e3339096f07f8ab065e2098b Mon Sep 17 00:00:00 2001 From: Kahrl Date: Thu, 12 Jan 2012 06:10:39 +0100 Subject: The huge item definition and item namespace unification patch (itemdef), see http://c55.me/minetest/wiki/doku.php?id=changes:itemdef --- src/nodedef.h | 49 +++++++++++-------------------------------------- 1 file changed, 11 insertions(+), 38 deletions(-) (limited to 'src/nodedef.h') diff --git a/src/nodedef.h b/src/nodedef.h index fdf2f8c45..598ad7fb3 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tile.h" #endif #include "materials.h" // MaterialProperties +class IItemDefManager; class ITextureSource; class IGameDef; @@ -124,7 +125,6 @@ struct ContentFeatures // 0 1 2 3 4 5 // up down right left back front TileSpec tiles[6]; - video::ITexture *inventory_texture; // Special material/texture // - Currently used for flowing liquids video::SMaterial *special_materials[CF_SPECIAL_COUNT]; @@ -133,11 +133,7 @@ struct ContentFeatures u8 visual_solidness; // When solidness=0, this tells how it looks like bool backface_culling; #endif - - // List of textures that are used and are wanted to be included in - // the texture atlas - std::set used_texturenames; - + /* Actual data */ @@ -148,7 +144,6 @@ struct ContentFeatures enum NodeDrawType drawtype; float visual_scale; // Misc. scale parameter std::string tname_tiles[6]; - std::string tname_inventory; MaterialSpec mspec_special[CF_SPECIAL_COUNT]; // Use setter methods u8 alpha; @@ -174,10 +169,6 @@ struct ContentFeatures // If true, param2 is set to direction when placed. Used for torches. // NOTE: the direction format is quite inefficient and should be changed bool wall_mounted; - // Whether this content type often contains mineral. - // Used for texture atlas creation. - // Currently only enabled for CONTENT_STONE. - bool often_contains_mineral; // Inventory item string as which the node appears in inventory when dug. // Mineral overrides this. std::string dug_item; @@ -202,9 +193,6 @@ struct ContentFeatures u32 damage_per_second; NodeBox selection_box; MaterialProperties material; - std::string cookresult_item; - float furnace_cooktime; - float furnace_burntime; /* Methods @@ -214,22 +202,8 @@ struct ContentFeatures ~ContentFeatures(); void reset(); void serialize(std::ostream &os); - void deSerialize(std::istream &is, IGameDef *gamedef); + void deSerialize(std::istream &is); - /* - Texture setters. - - */ - - // Texture setters. They also add stuff to used_texturenames. - void setTexture(u16 i, std::string name); - void setAllTextures(std::string name); - void setSpecialMaterial(u16 i, const MaterialSpec &mspec); - - void setInventoryTexture(std::string imgname); - void setInventoryTextureCube(std::string top, - std::string left, std::string right); - /* Some handy methods */ @@ -253,7 +227,6 @@ public: virtual bool getId(const std::string &name, content_t &result) const=0; virtual content_t getId(const std::string &name) const=0; virtual const ContentFeatures& get(const std::string &name) const=0; - virtual std::string getAlias(const std::string &name) const =0; virtual void serialize(std::ostream &os)=0; }; @@ -271,8 +244,7 @@ public: virtual content_t getId(const std::string &name) const=0; // If not found, returns the features of CONTENT_IGNORE virtual const ContentFeatures& get(const std::string &name) const=0; - virtual std::string getAlias(const std::string &name) const =0; - + // Register node definition virtual void set(content_t c, const ContentFeatures &def)=0; // Register node definition by name (allocate an id) @@ -281,11 +253,12 @@ public: const ContentFeatures &def)=0; // If returns CONTENT_IGNORE, could not allocate id virtual content_t allocateDummy(const std::string &name)=0; - // Set an alias so that nodes named will load as . - // Alias is not set if has already been defined. - // Alias will be removed if is defined at a later point of time. - virtual void setAlias(const std::string &name, - const std::string &convert_to)=0; + + /* + Update item alias mapping. + Call after updating item definitions. + */ + virtual void updateAliases(IItemDefManager *idef)=0; /* Update tile textures to latest return values of TextueSource. @@ -294,7 +267,7 @@ public: virtual void updateTextures(ITextureSource *tsrc)=0; virtual void serialize(std::ostream &os)=0; - virtual void deSerialize(std::istream &is, IGameDef *gamedef)=0; + virtual void deSerialize(std::istream &is)=0; }; IWritableNodeDefManager* createNodeDefManager(); -- cgit v1.2.3