summaryrefslogtreecommitdiffstats
path: root/game/client/camera.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-03-21 18:16:40 +0500
committeruntodesu <kirill@untode.su>2025-03-21 18:16:40 +0500
commit9f80a278a6f188c8e9131df0684bad14a07491ee (patch)
tree067c6ad4b892a34c3c03e3ecdbe312453bd46ea4 /game/client/camera.cc
parentfddd7f761176bb45cfdd41eeccaeadac22d33ddf (diff)
downloadvoxelius-9f80a278a6f188c8e9131df0684bad14a07491ee.tar.bz2
voxelius-9f80a278a6f188c8e9131df0684bad14a07491ee.zip
Toggles system rework, added flight pmove mode
- Reworked toggles to use a constant-styled enumerations - Added TOGGLE_PM_FLIGHT and an according movement mode. Now server-side just doesn't simulate gravity altogether for players, instead relying on whatever the client provides which works fine for now. Closes #12
Diffstat (limited to 'game/client/camera.cc')
-rw-r--r--game/client/camera.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/game/client/camera.cc b/game/client/camera.cc
index 5eb150a..30ec581 100644
--- a/game/client/camera.cc
+++ b/game/client/camera.cc
@@ -14,6 +14,7 @@
#include "client/player_move.hh"
#include "client/session.hh"
#include "client/settings.hh"
+#include "client/toggles.hh"
ConfigFloat camera::roll_angle(2.0f, 0.0f, 4.0f);
ConfigFloat camera::vertical_fov(90.0f, 45.0f, 110.0f);
@@ -88,10 +89,12 @@ void camera::update(void)
glm::fvec3 right_vector, up_vector;
cxangles::vectors(camera::angles, &camera::direction, &right_vector, &up_vector);
- // Apply view roll angle
- // FIXME: check if grounded
auto client_angles = camera::angles;
- client_angles[2] = cxpr::radians(-camera::roll_angle.get_value() * glm::dot(velocity.value / PMOVE_MAX_SPEED_GROUND, right_vector));
+
+ if(!toggles::get(TOGGLE_PM_FLIGHT)) {
+ // Apply the quake-like view rolling
+ client_angles[2] = cxpr::radians(-camera::roll_angle.get_value() * glm::dot(velocity.value / PMOVE_MAX_SPEED_GROUND, right_vector));
+ }
const auto z_near = 0.01f;
const auto z_far = 1.25f * static_cast<float>(CHUNK_SIZE * camera::view_distance.get_value());