From ccc0420c52d341ea20ff879aac7520179ca24bdf Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 3 Jun 2011 00:55:28 +0200 Subject: [PATCH] + papyrus --- data/papyrus.png | Bin 0 -> 366 bytes src/map.cpp | 27 +++++++++++++++++++-- src/mapblock.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++ src/mapnode.cpp | 10 ++++++++ src/mapnode.h | 1 + src/materials.cpp | 1 + src/server.cpp | 1 + src/tile.cpp | 1 + 8 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 data/papyrus.png diff --git a/data/papyrus.png b/data/papyrus.png new file mode 100644 index 0000000000000000000000000000000000000000..bf0dec7fe2f2048a4f521c8efce41fd775ef1339 GIT binary patch literal 366 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z8pdfpRr>`sfZ8j!h8TlvGX3u~^k|nMYCC>S|xv6<249-QVi6yBi3gww4 z84B*6z5(HleBwYww>@1PLo7}w$NbQk_)zum)BpPRHc2lo)}Gw)qEN_h-;M^E`sQ-fP#!OO#8CHBS# z{=^hT{;@x~ae?}Svkg=9BsirSbe}%_Y<%@FFaUlvmanip, v2s16(x,z)); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Don't make a tree so high that it doesn't fit if(y > y_nodes_max - 6) @@ -3236,6 +3250,15 @@ void makeChunk(ChunkMakeData *data) MapNode *n = &data->vmanip.m_data[i]; if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS && n->d != CONTENT_SAND) continue; + // Papyrus grows only on mud and in water + if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + { + p.Y++; + make_papyrus(data->vmanip, p); + } + // Don't make a tree under water level + if(y < WATER_LEVEL) + continue; // Trees grow only on mud and grass if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) { @@ -3243,7 +3266,7 @@ void makeChunk(ChunkMakeData *data) make_tree(data->vmanip, p); } // Cactii grow only on sand - if(n->d == CONTENT_SAND) + else if(n->d == CONTENT_SAND) { p.Y++; make_cactus(data->vmanip, p); diff --git a/src/mapblock.cpp b/src/mapblock.cpp index d98bfaf1..c6b82634 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -987,6 +987,16 @@ scene::SMesh* makeMapBlockMesh(MeshMakeData *data) g_texturesource->getTextureId("wood.png")); material_wood.setTexture(0, pa_wood.atlas); + // Papyrus material + video::SMaterial material_papyrus; + material_papyrus.setFlag(video::EMF_LIGHTING, false); + material_papyrus.setFlag(video::EMF_BILINEAR_FILTER, false); + material_papyrus.setFlag(video::EMF_FOG_ENABLE, true); + material_papyrus.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + AtlasPointer pa_papyrus = g_texturesource->getTexture( + g_texturesource->getTextureId("papyrus.png")); + material_papyrus.setTexture(0, pa_papyrus.atlas); + for(s16 z=0; zm_daynight_ratio))); + video::SColor c(255,l,l,l); + for(u32 j=0; j<4; j++) + { + video::S3DVertex vertices[4] = + { + video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y1()), + video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y1()), + video::S3DVertex(BS/2,BS/2,0, 0,0,0, c, + pa_papyrus.x1(), pa_papyrus.y0()), + video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c, + pa_papyrus.x0(), pa_papyrus.y0()), + }; + if(j == 0) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(45); + } + else if(j == 1) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-45); + } + else if(j == 2) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(135); + } + else if(j == 3) + { + for(u16 i=0; i<4; i++) + vertices[i].Pos.rotateXZBy(-135); + } + + for(u16 i=0; i<4; i++) + { + vertices[i].Pos += intToFloat(p + blockpos_nodes, BS); + } + + u16 indices[] = {0,1,2,2,3,0}; + // Add to mesh collector + collector.append(material_papyrus, vertices, 4, indices, 6); + } + } } diff --git a/src/mapnode.cpp b/src/mapnode.cpp index cef9bbf0..954c85f2 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -241,6 +241,16 @@ void init_mapnode() f->is_ground_content = true; f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + i = CONTENT_PAPYRUS; + f = &g_content_features[i]; + f->setInventoryTexture("papyrus.png"); + f->light_propagates = true; + f->param_type = CPT_LIGHT; + f->is_ground_content = true; + f->dug_item = std::string("MaterialItem ")+itos(i)+" 1"; + f->solidness = 0; // drawn separately, makes no faces + f->walkable = false; + i = CONTENT_GLASS; f = &g_content_features[i]; f->light_propagates = true; diff --git a/src/mapnode.h b/src/mapnode.h index e8cc0ab5..52d0199c 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -105,6 +105,7 @@ void init_content_inventory_texture_paths(); #define CONTENT_CACTUS 23 #define CONTENT_BRICK 24 #define CONTENT_CLAY 25 +#define CONTENT_PAPYRUS 26 /* Content feature list diff --git a/src/materials.cpp b/src/materials.cpp index 8c23056f..e95ca7ba 100644 --- a/src/materials.cpp +++ b/src/materials.cpp @@ -76,6 +76,7 @@ void initializeMaterialProperties() setWoodLikeDiggingProperties(CONTENT_TREE, 1.0); setWoodLikeDiggingProperties(CONTENT_LEAVES, 0.15); setWoodLikeDiggingProperties(CONTENT_CACTUS, 0.75); + setWoodLikeDiggingProperties(CONTENT_PAPYRUS, 0.25); setWoodLikeDiggingProperties(CONTENT_GLASS, 0.15); setWoodLikeDiggingProperties(CONTENT_FENCE, 0.75); setWoodLikeDiggingProperties(CONTENT_WOOD, 0.75); diff --git a/src/server.cpp b/src/server.cpp index 17850c5f..e9875456 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4111,6 +4111,7 @@ void setCreativeInventory(Player *player) CONTENT_TREE, CONTENT_LEAVES, CONTENT_CACTUS, + CONTENT_PAPYRUS, CONTENT_GLASS, CONTENT_FENCE, CONTENT_MESE, diff --git a/src/tile.cpp b/src/tile.cpp index 71e0c963..c77262c4 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -517,6 +517,7 @@ void TextureSource::buildMainAtlas() sourcelist.push_back("leaves.png"); sourcelist.push_back("cactus_side.png"); sourcelist.push_back("cactus_top.png"); + sourcelist.push_back("papyrus.png"); sourcelist.push_back("glass.png"); sourcelist.push_back("mud.png^grass_side.png"); sourcelist.push_back("cobble.png");