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>2008-06-02 16:44:40 +0000
committerStijn Buys <ingar@osirion.org>2008-06-02 16:44:40 +0000
commit6582edea98876b8f5797429e76f8fc253f83747a (patch)
tree9f0053e6c45c9d6a1e49bf00317fe8b504b6fc4b /src/client/input.cc
parent8c17868585e2a12f947ec387947c4521ef21d775 (diff)
restored cl_mousecontrol cvar
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 3d5b30c..cb54e32 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -20,6 +20,8 @@
namespace client
{
+core::Cvar *cl_mousecontrol = 0;
+
namespace input
{
@@ -27,8 +29,8 @@ namespace input
Keyboard *keyboard = 0;
-bool free_control = true;
-bool free_control_override = false;
+//bool free_control = true;
+bool cl_mousecontrol_override = false;
// local controls
float local_direction = 0.0f;
@@ -62,8 +64,13 @@ void func_screenshot(std::string const & args)
void func_ui_control(std::string const &args)
{
- free_control = !free_control;
- if (!free_control) {
+ if (cl_mousecontrol->value() > 0) {
+ (*cl_mousecontrol) = 0.0f;
+ } else {
+ (*cl_mousecontrol) = 1.0f;
+ }
+
+ if (!cl_mousecontrol->value()) {
local_direction = 0.0f;
local_pitch = 0.0f;
local_roll = 0.0f;
@@ -153,6 +160,9 @@ void init()
SDL_WM_GrabInput(SDL_GRAB_ON);
// SDL_EnableUNICODE(1);
+ cl_mousecontrol = core::Cvar::get("cl_mousecontrol", "1", core::Cvar::Archive);
+ cl_mousecontrol->set_info("[bool] set mouse control on or off");
+
core::Func *func = 0;
func = core::Func::add("ui_console", func_ui_console);
@@ -165,7 +175,7 @@ void init()
func->set_info("switch view mode");
func = core::Func::add("ui_control",func_ui_control);
- func->set_info("toggle control on or off");
+ func->set_info("toggle mouse control on or off");
func = core::Func::add("list_keys", func_list_keys);
func->set_info("list keyboard key names");
@@ -223,7 +233,7 @@ void action_press(std::string const &action)
/* -- mouse control ------------------------------- */
} else if (action.compare("+control") == 0) {
- free_control_override = true;
+ cl_mousecontrol_override = true;
/* -- directional control ------------------------- */
} else if (action.compare("+left") == 0) {
@@ -271,8 +281,8 @@ void action_release(std::string const &action)
/* -- mouse control ------------------------------- */
} else if (action.compare("+control") == 0) {
- free_control_override = false;
- if (!free_control) {
+ cl_mousecontrol_override = false;
+ if (!cl_mousecontrol->value()) {
local_direction = 0.0f;
local_pitch = 0.0f;
local_roll = 0.0f;
@@ -328,8 +338,7 @@ void frame(float seconds)
mouse_x = video::width / 2;
mouse_y = video::height / 2;
render::Camera::reset();
- free_control = true;
- free_control_override = false;
+ cl_mousecontrol_override = false;
}
SDL_Event event;
@@ -442,7 +451,7 @@ void frame(float seconds)
if (core::application()->connected() && core::localcontrol()) {
- mouse_control = !console()->visible() && (free_control || free_control_override);
+ mouse_control = !console()->visible() && ((cl_mousecontrol->value() > 0) || cl_mousecontrol_override);
if (mouse_control) {
// the mouse will not react if it is in the deadzone