}
}
}
+
+ else if(n.getContent() == CONTENT_LADDER)
+ {
+ v3s16 dir = unpackDir(n.param2);
+ 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/2,-BS/2),
+ v3f(BS*0.49, BS/2, BS/2),
+ };
+
+ 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;
+ }
+ }
+ }
else if(n.getContent() == CONTENT_RAIL)
{
v3s16 dir = unpackDir(n.param0);
{
//std::cerr<<"frame"<<std::endl;
+ if(client.accessDenied())
+ {
+ error_message = L"Access denied. Reason: "
+ +client.accessDeniedReason();
+ std::cout<<DTIME<<wide_to_narrow(error_message)<<std::endl;
+ break;
+ }
+
if(g_gamecallback->disconnect_requested)
{
g_gamecallback->disconnect_requested = false;
}
// Get player position
- v3f player_position = client.getPlayerPosition();
+ v3f camera_position;
+ v3f player_position = client.getPlayerPosition(&camera_position);
//TimeTaker //timer2("//timer2");
v3f camera_direction = v3f(0,0,1);
camera_direction.rotateYZBy(camera_pitch);
camera_direction.rotateXZBy(camera_yaw);
-
- // This is at the height of the eyes of the current figure
- //v3f camera_position = player_position + v3f(0, BS+BS/2, 0);
- // This is more like in minecraft
- v3f camera_position = player_position + v3f(0, BS+BS*0.625, 0);
camera->setPosition(camera_position);
// *100.0 helps in large map coordinates
*/
if(farmesh)
{
+ farmesh_range = draw_control.wanted_range * 10;
+ if(draw_control.range_all && farmesh_range < 500)
+ farmesh_range = 500;
+ if(farmesh_range > 1000)
+ farmesh_range = 1000;
+
farmesh->step(dtime);
farmesh->update(v2f(player_position.X, player_position.Z),
- 0.05+brightness*0.95);
+ 0.05+brightness*0.95, farmesh_range);
}
// Store brightness value
if(client.getLocalInventoryUpdated()
|| g_selected_item != old_selected_item)
{
+ client.selectPlayerItem(g_selected_item);
old_selected_item = g_selected_item;
//std::cout<<"Updating local inventory"<<std::endl;
client.getLocalInventory(local_inventory);
// 0-1ms
guienv->drawAll();
+ /*
+ Environment post fx
+ */
+ {
+ client.getEnv()->drawPostFx(driver, camera_position);
+ }
+
/*
Draw hotbar
*/
NULL);
}
- /*
- Environment post fx
- */
- {
- client.getEnv()->drawPostFx(driver, camera_position);
- }
-
/*
End scene
*/