Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/input.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 5c5a71d..fcf33f8 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -875,13 +875,17 @@ void frame()
}
if (mouse_control) {
+ const float aim_square_size = 256.0f;
+
// direction
int l = mouse_x - (render::State::width() / 2);
- mouse_direction = float(-l) / (float)(render::State::width() / 2);
+ mouse_direction = float(-l) / math::min( 0.5f *(float)(render::State::width()), aim_square_size);
+ math::clamp(mouse_direction, -1.0f, 1.0f);
// pitch
int h = mouse_y - (render::State::height() / 2);
- mouse_pitch = float(-h) / (float)(render::State::height() / 2);
+ mouse_pitch = float(-h) / math::min (0.5f * (float)(render::State::height()), aim_square_size);
+ math::clamp(mouse_pitch, -1.0f, 1.0f);
if ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit)) {