Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2016-07-23 20:51:48 +0200
committerStijn Buys <ingar@osirion.org>2016-07-23 20:51:48 +0200
commit492a5aabefb1a25d6c497bb1c8e12201c6d36f1d (patch)
tree0b44486f0d4b99411664bdbfb83d765c7e0fcb62 /src/client
parent72c73d592fe5e52539798ef02c77f63684398b8d (diff)
Removed freelook mouse position offset.
Diffstat (limited to 'src/client')
-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())
{