From c707e00195f1035ae535f3fc8697af42e73190c0 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 29 Nov 2010 10:52:07 +0200 Subject: =?UTF-8?q?sit=C3=A4=20sun=20t=C3=A4t=C3=A4=20tekeill=C3=A4,=20toi?= =?UTF-8?q?mii=20kivasti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mapnode.h | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'src/mapnode.h') diff --git a/src/mapnode.h b/src/mapnode.h index 68e669161..981f36d86 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -17,10 +17,25 @@ #define MATERIALS_COUNT 256 -// This is completely ignored. It doesn't create faces with anything. +/* + Ignored node. + + param is used for custom information in special containers, + like VoxelManipulator. + + Anything that stores MapNodes doesn't have to preserve parameters + associated with this material. + + Doesn't create faces with anything and is considered being + out-of-map in the game map. +*/ #define MATERIAL_IGNORE 255 -// This is the common material through which the player can walk -// and which is transparent to light +#define MATERIAL_IGNORE_DEFAULT_PARAM 0 + +/* + The common material through which the player can walk and which + is transparent to light +*/ #define MATERIAL_AIR 254 /* @@ -63,6 +78,8 @@ enum Material MATERIAL_GRASS_FOOTSTEPS, MATERIAL_MESE, + + MATERIAL_MUD, // This is set to the number of the actual values in this enum USEFUL_MATERIAL_COUNT @@ -126,6 +143,21 @@ inline u8 face_materials(u8 m1, u8 m2) return 2; } +/* + Returns true for materials that form the base ground that + follows the main heightmap +*/ +inline bool is_ground_material(u8 m) +{ + return( + m == MATERIAL_STONE || + m == MATERIAL_GRASS || + m == MATERIAL_GRASS_FOOTSTEPS || + m == MATERIAL_MESE || + m == MATERIAL_MUD + ); +} + struct MapNode { //TODO: block type to differ from material @@ -133,9 +165,6 @@ struct MapNode // block type u8 d; - // Removed because light is now stored in param for air - // f32 light; - /* Misc parameter. Initialized to 0. - For light_propagates() blocks, this is light intensity, @@ -155,6 +184,11 @@ struct MapNode param = a_param; } + bool operator==(const MapNode &other) + { + return (d == other.d && param == other.param); + } + bool light_propagates() { return light_propagates_material(d); -- cgit v1.2.3