aboutsummaryrefslogtreecommitdiff
path: root/src/mapnode.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-08 01:12:55 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-08 01:12:55 +0200
commitdd9e82f5bc2982abab436afdd68df799c6fdd857 (patch)
tree1aae2e8c85ed3630feb0f3af758ba4aa0f4a6d6c /src/mapnode.h
parent25a7fabed83caccb2c321bb4d080c5907f37b60a (diff)
downloadhax-minetest-server-dd9e82f5bc2982abab436afdd68df799c6fdd857.tar.gz
hax-minetest-server-dd9e82f5bc2982abab436afdd68df799c6fdd857.zip
bug-fixin'
Diffstat (limited to 'src/mapnode.h')
-rw-r--r--src/mapnode.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/mapnode.h b/src/mapnode.h
index fcbb80fd1..0aaa4dc78 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -167,25 +167,38 @@ struct ContentFeatures
~ContentFeatures();
+ // Quickhands for simple materials
+ void setTexture(u16 i, const TextureSpec &spec, u8 alpha=255)
+ {
+ tiles[i].spec = spec;
+ if(alpha != 255)
+ {
+ tiles[i].alpha = alpha;
+ tiles[i].material_type = MATERIAL_ALPHA_VERTEX;
+ }
+ }
void setAllTextures(const TextureSpec &spec, u8 alpha=255)
{
for(u16 i=0; i<6; i++)
{
- tiles[i].spec = spec;
- tiles[i].alpha = alpha;
+ setTexture(i, spec, alpha);
}
// Set this too so it can be left as is most times
- /*if(inventory_image_path == "")
- inventory_image_path = porting::getDataPath(imgname.c_str());*/
-
if(inventory_texture.empty())
inventory_texture = spec;
}
- void setTexture(u16 i, const TextureSpec &spec, u8 alpha=255)
+
+ void setTile(u16 i, const TileSpec &tile)
{
- tiles[i].spec = spec;
- tiles[i].alpha = alpha;
+ tiles[i] = tile;
+ }
+ void setAllTiles(const TileSpec &tile)
+ {
+ for(u16 i=0; i<6; i++)
+ {
+ setTile(i, tile);
+ }
}
void setInventoryTexture(const TextureSpec &spec)
@@ -417,12 +430,11 @@ struct MapNode
union
{
- u8 param2;
-
/*
- Direction for torches and other stuff.
- Format is freeform. e.g. packDir or encode_dirs can be used.
+ The second parameter. Initialized to 0.
+ Direction for torches and flowing water.
*/
+ u8 param2;
u8 dir;
};