summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-03 16:21:06 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-03 16:21:06 +0300
commit01c2b003e1efb839ad246eb939af7fa8336b9ad5 (patch)
tree9771fbd3321709f6aff0761ed7efc5a177823352 /src/main.cpp
parent06eb0ad4d063c696afa53cad75824c7778c5c157 (diff)
downloadminetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.tar.gz
minetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.tar.bz2
minetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.zip
commit before some more radical changes
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c9db0bdc4..a901163df 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2701,6 +2701,55 @@ int main(int argc, char *argv[])
}
}
}
+ else if(n.d == CONTENT_SIGN_WALL)
+ {
+ v3s16 dir = unpackDir(n.dir);
+ v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
+ dir_f *= BS/2 - BS/6 - BS/20;
+ v3f cpf = npf + dir_f;
+ f32 distance = (cpf - camera_position).getLength();
+
+ v3f vertices[4] =
+ {
+ v3f(BS*0.42,-BS*0.35,-BS*0.4),
+ v3f(BS*0.49, BS*0.35, BS*0.4),
+ };
+
+ for(s32 i=0; i<2; i++)
+ {
+ if(dir == v3s16(1,0,0))
+ vertices[i].rotateXZBy(0);
+ if(dir == v3s16(-1,0,0))
+ vertices[i].rotateXZBy(180);
+ if(dir == v3s16(0,0,1))
+ vertices[i].rotateXZBy(90);
+ if(dir == v3s16(0,0,-1))
+ vertices[i].rotateXZBy(-90);
+ if(dir == v3s16(0,-1,0))
+ vertices[i].rotateXYBy(-90);
+ if(dir == v3s16(0,1,0))
+ vertices[i].rotateXYBy(90);
+
+ vertices[i] += npf;
+ }
+
+ core::aabbox3d<f32> box;
+
+ box = core::aabbox3d<f32>(vertices[0]);
+ box.addInternalPoint(vertices[1]);
+
+ if(distance < mindistance)
+ {
+ if(box.intersectsWithLine(shootline))
+ {
+ nodefound = true;
+ nodepos = np;
+ neighbourpos = np;
+ mindistance = distance;
+ nodehilightbox = box;
+ }
+ }
+ }
/*
Regular blocks
*/
@@ -2765,11 +2814,20 @@ int main(int argc, char *argv[])
static float dig_time = 0.0;
static u16 dig_index = 0;
- // Visualize selection
+ /*
+ Visualize selection
+ */
hilightboxes.push_back(nodehilightbox);
- // Handle digging
+ /*
+ TODO:
+ Check information text of node
+ */
+
+ /*
+ Handle digging
+ */
if(g_input->getLeftReleased())
{