fix tile rotation

This commit is contained in:
darkrose 2013-11-18 19:56:43 +10:00
parent 4a8b9b54c3
commit 0724a7c0a9
2 changed files with 16 additions and 13 deletions

View File

@ -5076,6 +5076,7 @@ void content_mapnode_init()
f->light_propagates = true;
f->sunlight_propagates = true;
f->solidness = 0; // drawn separately, makes no faces
f->rotate_tile_with_nodebox = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
content_mapnode_nodebox_bed_head(f);
setWoodLikeDiggingProperties(f->digging_properties, 0.25);
@ -5097,6 +5098,7 @@ void content_mapnode_init()
f->light_propagates = true;
f->sunlight_propagates = true;
f->solidness = 0; // drawn separately, makes no faces
f->rotate_tile_with_nodebox = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_HEAD)+" 1";
content_mapnode_nodebox_bed_foot(f);
setWoodLikeDiggingProperties(f->digging_properties, 0.25);

View File

@ -355,33 +355,34 @@ TileSpec MapNode::getTile(v3s16 dir)
}
}
if (content_features(*this).rotate_tile_with_nodebox) {
if(dir_i == 0){
if(param1 == 1){ // -90
u8 facedir = 0;
if (content_features(*this).param_type == CPT_FACEDIR_SIMPLE) {
facedir = param1;
}else if (content_features(*this).param2_type == CPT_FACEDIR_SIMPLE) {
facedir = (param2&0x0F);
}
if (dir_i == 0) {
if (facedir == 1) { // -90
std::string name = g_texturesource->getTextureName(spec.texture.id);
name += "^[transformR270";
spec.texture = g_texturesource->getTexture(name);
}
else if(param1 == 2){ // 180
}else if (facedir == 2) { // 180
spec.texture.pos += spec.texture.size;
spec.texture.size *= -1;
}
else if(param1 == 3){ // 90
}else if (facedir == 3) { // 90
std::string name = g_texturesource->getTextureName(spec.texture.id);
name += "^[transformR90";
spec.texture = g_texturesource->getTexture(name);
}
}
else if(dir_i == 1){
if(param1 == 1){ // -90
}else if (dir_i == 1) {
if (facedir == 1) { // -90
std::string name = g_texturesource->getTextureName(spec.texture.id);
name += "^[transformR90";
spec.texture = g_texturesource->getTexture(name);
}
else if(param1 == 2){ // 180
}else if (facedir == 2) { // 180
spec.texture.pos += spec.texture.size;
spec.texture.size *= -1;
}
else if(param1 == 3){ // 90
}else if (facedir == 3) { // 90
std::string name = g_texturesource->getTextureName(spec.texture.id);
name += "^[transformR270";
spec.texture = g_texturesource->getTexture(name);