diff options
-rw-r--r-- | src/client/input.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 963dd9f..d898b78 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -28,6 +28,7 @@ namespace client core::Cvar *input_mousecontrol = 0; core::Cvar *input_keydelay = 0; core::Cvar *input_keyrepeat = 0; +core::Cvar *input_mousedelay = 0; namespace input { @@ -60,7 +61,6 @@ float mouse_direction = 0; // true if the mouse has control -const float mouse_timeout = 0.200f; // 200 ms select time-out float mouse_control_override_time = 0; bool mouse_control_override = false; bool mouse_control = false; @@ -266,9 +266,11 @@ void init() input_keydelay = core::Cvar::get("input_keydelay", 200.0f, core::Cvar::Archive); input_keydelay->set_info("[int] keyboard delay time-out in milliseconds"); - input_keyrepeat = core::Cvar::get("input_keyrepeat", 30.0f, core::Cvar::Archive); + input_keyrepeat = core::Cvar::get("input_keyrepeat", 35.0f, core::Cvar::Archive); input_keyrepeat->set_info("[int] keyboard repeat time-out in milliseconds"); + input_mousedelay = core::Cvar::get("input_mousedelay", 150.0f, core::Cvar::Archive); + input_mousedelay->set_info("[int] mouse click time-out in milliseconds"); core::Func *func = 0; func = core::Func::add("ui_console", func_ui_console); @@ -528,7 +530,7 @@ void key_released(Key *key) { if (core::application()->connected() && core::localcontrol()) { - if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover() && (key->waspressed() <= mouse_timeout) ) { + if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover() && (key->waspressed() <= (input_mousedelay->value()/1000.0f) ) ) { // hovering target selected targets::select_target(targets::hover()); } @@ -751,7 +753,7 @@ void frame(float seconds) math::clamp(delay, 50.0f, 500.0f); } - float repeat = 30.0f; // key repeat time-out in milliseconds + float repeat = 35.0f; // key repeat time-out in milliseconds if (input_keyrepeat) { repeat = input_keyrepeat->value(); math::clamp(repeat, 10.0f, 250.0f); @@ -783,10 +785,10 @@ void frame(float seconds) mouse_deadzone = false; if (core::application()->connected() && core::localcontrol()) { - mouse_control = !console()->visible() && ((input_mousecontrol->value() > 0) || (mouse_control_override && (mouse_control_override_time + mouse_timeout < core::application()->time()))); + mouse_control = !console()->visible() && ((input_mousecontrol->value() > 0) || (mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time()))); if (mouse_control && joystick_control && ((render::Camera::mode() == render::Camera::Track) || (render::Camera::mode() == render::Camera::Cockpit))) { - if (!(mouse_control_override && (mouse_control_override_time + mouse_timeout < core::application()->time()))) { + if (!(mouse_control_override && (mouse_control_override_time + (input_mousedelay->value() / 1000.0f) < core::application()->time()))) { mouse_control = false; } } |