3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 ContentFeatures::~ContentFeatures()
32 struct ContentFeatures g_content_features[256];
34 ContentFeatures & content_features(u8 i)
36 return g_content_features[i];
39 void init_mapnode(IIrrlichtWrapper *irrlicht)
42 ContentFeatures *f = NULL;
45 f = &g_content_features[i];
46 f->setAllTextures(irrlicht->getTextureId("stone.png"));
47 f->param_type = CPT_MINERAL;
48 f->is_ground_content = true;
51 f = &g_content_features[i];
52 f->setAllTextures(TextureSpec(irrlicht->getTextureId("mud.png"),
53 irrlicht->getTextureId("grass_side.png")));
54 f->setTexture(0, irrlicht->getTextureId("grass.png"));
55 f->setTexture(1, irrlicht->getTextureId("mud.png"));
56 f->setInventoryTexture(irrlicht->getTextureId("grass.png"));
57 f->param_type = CPT_MINERAL;
58 f->is_ground_content = true;
60 i = CONTENT_GRASS_FOOTSTEPS;
61 f = &g_content_features[i];
62 f->setAllTextures(TextureSpec(irrlicht->getTextureId("mud.png"),
63 irrlicht->getTextureId("grass_side.png")));
64 f->setTexture(0, irrlicht->getTextureId("grass_footsteps.png"));
65 f->setTexture(1, irrlicht->getTextureId("mud.png"));
66 f->setInventoryTexture(irrlicht->getTextureId("grass_footsteps.png"));
67 f->param_type = CPT_MINERAL;
68 f->is_ground_content = true;
71 f = &g_content_features[i];
72 f->setAllTextures(irrlicht->getTextureId("mud.png"));
73 f->param_type = CPT_MINERAL;
74 f->is_ground_content = true;
77 f = &g_content_features[i];
78 f->setAllTextures(irrlicht->getTextureId("mud.png"));
79 f->param_type = CPT_MINERAL;
80 f->is_ground_content = true;
83 f = &g_content_features[i];
84 f->setAllTextures(irrlicht->getTextureId("tree.png"));
85 f->setTexture(0, irrlicht->getTextureId("tree_top.png"));
86 f->setTexture(1, irrlicht->getTextureId("tree_top.png"));
87 f->setInventoryTexture(irrlicht->getTextureId("tree_top.png"));
88 f->param_type = CPT_MINERAL;
89 f->is_ground_content = true;
92 f = &g_content_features[i];
93 f->setAllTextures(irrlicht->getTextureId("leaves.png"));
94 f->param_type = CPT_MINERAL;
95 f->is_ground_content = true;
97 i = CONTENT_COALSTONE;
98 f = &g_content_features[i];
99 f->translate_to = new MapNode(CONTENT_STONE, MINERAL_COAL);
100 /*f->setAllTextures(irrlicht->getTextureId("coalstone.png"));
101 f->is_ground_content = true;*/
104 f = &g_content_features[i];
105 f->setAllTextures(irrlicht->getTextureId("wood.png"));
106 f->is_ground_content = true;
109 f = &g_content_features[i];
110 f->setAllTextures(irrlicht->getTextureId("mese.png"));
111 f->is_ground_content = true;
114 f = &g_content_features[i];
115 f->setAllTextures(irrlicht->getTextureId("cloud.png"));
116 f->is_ground_content = true;
119 f = &g_content_features[i];
120 f->param_type = CPT_LIGHT;
121 f->light_propagates = true;
122 f->sunlight_propagates = true;
125 f->pointable = false;
127 f->buildable_to = true;
130 f = &g_content_features[i];
131 f->setInventoryTexture(irrlicht->getTextureId("water.png"));
132 f->param_type = CPT_LIGHT;
133 f->light_propagates = true;
134 f->solidness = 0; // Drawn separately, makes no faces
136 f->pointable = false;
138 f->buildable_to = true;
139 f->liquid_type = LIQUID_FLOWING;
141 i = CONTENT_WATERSOURCE;
142 f = &g_content_features[i];
143 //f->setTexture(0, irrlicht->getTextureId("water.png"), WATER_ALPHA);
144 f->setAllTextures(irrlicht->getTextureId("water.png"), WATER_ALPHA);
145 f->setInventoryTexture(irrlicht->getTextureId("water.png"));
146 f->param_type = CPT_LIGHT;
147 f->light_propagates = true;
150 f->pointable = false;
152 f->buildable_to = true;
153 f->liquid_type = LIQUID_SOURCE;
156 f = &g_content_features[i];
157 f->setInventoryTexture(irrlicht->getTextureId("torch_on_floor.png"));
158 f->param_type = CPT_LIGHT;
159 f->light_propagates = true;
160 f->solidness = 0; // drawn separately, makes no faces
162 f->wall_mounted = true;
166 TileSpec MapNode::getTile(v3s16 dir)
172 if(dir == v3s16(0,0,0))
174 else if(dir == v3s16(0,1,0))
176 else if(dir == v3s16(0,-1,0))
178 else if(dir == v3s16(1,0,0))
180 else if(dir == v3s16(-1,0,0))
182 else if(dir == v3s16(0,0,1))
184 else if(dir == v3s16(0,0,-1))
189 spec = content_features(d).tiles[0];
191 spec = content_features(d).tiles[dir_i];
193 if(content_features(d).param_type == CPT_MINERAL)
195 u8 mineral = param & 0x1f;
196 // Add mineral block texture
197 textureid_t tid = mineral_block_texture(mineral);
199 spec.spec.addTid(tid);
205 u8 MapNode::getMineral()
207 if(content_features(d).param_type == CPT_MINERAL)
215 // Pointers to c_str()s g_content_features[i].inventory_image_path
216 //const char * g_content_inventory_texture_paths[USEFUL_CONTENT_COUNT] = {0};
218 void init_content_inventory_texture_paths()
220 dstream<<"DEPRECATED "<<__FUNCTION_NAME<<std::endl;
221 /*for(u16 i=0; i<USEFUL_CONTENT_COUNT; i++)
223 g_content_inventory_texture_paths[i] =
224 g_content_features[i].inventory_image_path.c_str();