aboutsummaryrefslogtreecommitdiff
path: root/src/camera.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-11-20 01:45:57 +0000
committerparamat <mat.gregory@virginmedia.com>2017-12-04 02:25:10 +0000
commitf470cb7270560a26afff0a0eadfc69070236c109 (patch)
tree045b3cac767dfae7fffc02258d02cbaf7978a96f /src/camera.cpp
parent2507d32afe05c73bb27ed221c2a592b0894fdc68 (diff)
downloadminetest-f470cb7270560a26afff0a0eadfc69070236c109.tar.gz
minetest-f470cb7270560a26afff0a0eadfc69070236c109.tar.bz2
minetest-f470cb7270560a26afff0a0eadfc69070236c109.zip
Zoom: Set zoom FOV per-player using a player object property
Remove player object property 'can zoom'. Add player object property 'zoom fov'. Remove clientside setting for 'zoom fov'. Object property default is 15 degrees in creative mode, zoom disabled in survival mode. Needed due to zoom now loading and/or generating distant world according to zoom FOV. Update object properties serialisation version to 3.
Diffstat (limited to 'src/camera.cpp')
-rw-r--r--src/camera.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index 62acbe26d..a64b903ae 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -72,8 +72,7 @@ Camera::Camera(MapDrawControl &draw_control, Client *client):
m_cache_fall_bobbing_amount = g_settings->getFloat("fall_bobbing_amount");
m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount");
m_cache_fov = g_settings->getFloat("fov");
- m_cache_zoom_fov = g_settings->getFloat("zoom_fov");
- m_arm_inertia = g_settings->getBool("arm_inertia");
+ m_arm_inertia = g_settings->getBool("arm_inertia");
m_nametags.clear();
}
@@ -453,12 +452,13 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
// Get FOV
f32 fov_degrees;
- if (player->getPlayerControl().zoom && player->getCanZoom()) {
- fov_degrees = m_cache_zoom_fov;
+ // Disable zoom with zoom FOV = 0
+ if (player->getPlayerControl().zoom && player->getZoomFOV() > 0.001f) {
+ fov_degrees = player->getZoomFOV();
} else {
fov_degrees = m_cache_fov;
}
- fov_degrees = rangelim(fov_degrees, 1.0, 160.0);
+ fov_degrees = rangelim(fov_degrees, 1.0f, 160.0f);
// FOV and aspect ratio
const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize();