Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/input.cc28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 3c1b423..7edc1c2 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -1010,30 +1010,18 @@ void frame()
}
if (mouse_control || freelook_control ) {
- const float aim_square_size = math::min(render::State::width(), render::State::height()) * 0.5f;
-
- int l = mouse_x;
- int h = mouse_y;
-
- if (freelook_control)
- {
- // mouse location is relative to where freelook was initiated
- l -= freelook_control_x;
- h -= freelook_control_y;
- }
- else
- {
- // mouse location is relative to the center of the screen
- l -= (render::State::width() / 2);
- h -= (render::State::height() / 2);
- }
+ const float aim_square_size = 0.5f * math::min(render::State::width(), render::State::height());
+ // mouse location is relative to the center of the screen
+ const int l = mouse_x - (render::State::width() / 2);
+ const int h = mouse_y - (render::State::height() / 2);
+
// direction
- mouse_direction = float(-l) / math::min( 0.5f *(float)(render::State::width()), aim_square_size);
+ mouse_direction = float(-l) / aim_square_size;
math::clamp(mouse_direction, -1.0f, 1.0f);
// pitch
- mouse_pitch = float(-h) / math::min (0.5f * (float)(render::State::height()), aim_square_size);
+ mouse_pitch = float(-h) / aim_square_size;
math::clamp(mouse_pitch, -1.0f, 1.0f);
if (freelook_control)
@@ -1074,6 +1062,8 @@ void frame()
}
else if (mouse_control)
{
+ // the base game overrides the actual direction and pitch controls
+
// mouse is controling direction
switch (render::camera().mode())
{