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.cc27
-rw-r--r--src/client/input.h5
-rw-r--r--src/client/view.cc6
3 files changed, 24 insertions, 14 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index c7c751e..8d80a21 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -19,6 +19,8 @@
namespace client
{
+core::Cvar *cl_mousecontrol = 0;
+
namespace input
{
@@ -34,8 +36,8 @@ unsigned int last_control = 0;
// mouse cursor position
int mouse_x = 0;
int mouse_y = 0;
-
-core::Cvar *cl_mousecontrol = 0;
+// true if the mouse is in the deadzone
+bool mouse_deadzone = false;
void init()
{
@@ -197,26 +199,25 @@ void frame(float seconds)
if (!console::visible() && core::application()->connected() && core::localcontrol()) {
- if (cl_mousecontrol->value()) {
+ if (camera::mode == camera::Track && cl_mousecontrol->value()) {
// mouse control when camera is in tracking mode
- if (camera::mode == camera::Track) {
- int l = mouse_x - (video::width >> 1);
+ int l = mouse_x - (video::width >> 1);
- if (abs(l) < ( CHARWIDTH >> 1 )) // dead zone
- local_turn = 0;
- else {
- l = (mouse_x - CHARWIDTH) - ((video::width - CHARWIDTH) >> 1);
- local_turn = float (-l) / (float) ((video::width - CHARWIDTH) >> 1);
- }
- } else {
+ if (abs(l) < ( CHARWIDTH >> 1 )) {
+ // dead zone
local_turn = 0;
+ mouse_deadzone = true;
+ } else {
+ l = (mouse_x - CHARWIDTH) - ((video::width - CHARWIDTH) >> 1);
+ local_turn = float (-l) / (float) ((video::width - CHARWIDTH) >> 1);
+ mouse_deadzone = false;
}
-
} else {
if (local_turn > 1.0f)
local_turn = 1.0f;
else if (local_turn < -1.0f)
local_turn = -1.0f;
+ mouse_deadzone = false;
}
core::localcontrol()->set_thrust(local_thrust);
diff --git a/src/client/input.h b/src/client/input.h
index 9d47eb8..bcbba9b 100644
--- a/src/client/input.h
+++ b/src/client/input.h
@@ -7,9 +7,13 @@
#ifndef __INCLUDED_cLIENT_INPUT_H__
#define __INCLUDED_cLIENT_INPUT_H__
+#include "core/cvar.h"
+
namespace client
{
+extern core::Cvar *cl_mousecontrol;
+
namespace input
{
@@ -24,6 +28,7 @@ void frame(float seconds);
extern int mouse_x;
extern int mouse_y;
+extern bool mouse_deadzone;
} // namespace input
diff --git a/src/client/view.cc b/src/client/view.cc
index c31cc12..4180b1e 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -212,7 +212,11 @@ void draw_cursor()
std::stringstream colorstr(draw_crosshaircolor->str());
colorstr >> color;
}
- color.a = 0.5f;
+
+ if (cl_mousecontrol->value() && input::mouse_deadzone)
+ color.a = 0.3f;
+ else
+ color.a = 0.5f;
gl::color(color);
gl::begin(gl::Quads);