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-08-08 22:17:29 +0000
committerStijn Buys <ingar@osirion.org>2008-08-08 22:17:29 +0000
commit56b0856541446cbafee4eed9ef0ee9fb69af565a (patch)
tree8cec133fb9b0a02fc2f415c26b69fcd4c6db1ef9 /src/client/input.cc
parentf540e8dac10de8ff443692e78404b1508dde9d1e (diff)
improved truster indicator, impulse engine sounds
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 7812d7e..963dd9f 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -59,8 +59,6 @@ float mouse_pitch = 0;
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;
@@ -355,8 +353,10 @@ void action_press(Key const *key, std::string const &action)
/* -- mouse control ------------------------------- */
} else if (action.compare("+control") == 0) {
- mouse_control_override = true;
- mouse_control_override_time = key->pressed();
+ if (!mouse_control_override) {
+ mouse_control_override = true;
+ mouse_control_override_time = key->pressed();
+ }
/* -- directional control ------------------------- */
} else if (action.compare("+left") == 0) {
@@ -404,17 +404,19 @@ void action_release(Key *key, std::string const &action)
/* -- mouse control ------------------------------- */
} else if (action.compare("+control") == 0) {
- mouse_control_override = false;
- mouse_control_override_time = 0;
-
- if (!input_mousecontrol->value() || (joystick_control && mouse_control &&
- (render::Camera::mode() == render::Camera::Track || render::Camera::mode() == render::Camera::Cockpit))) {
- local_direction = 0.0f;
- local_pitch = 0.0f;
- local_roll = 0.0f;
-
- render::Camera::set_direction(0.0f);
- render::Camera::set_pitch(0.0f);
+ if (mouse_control_override) {
+ mouse_control_override = false;
+ mouse_control_override_time = 0;
+
+ if (!input_mousecontrol->value() || (joystick_control && mouse_control &&
+ (render::Camera::mode() == render::Camera::Track || render::Camera::mode() == render::Camera::Cockpit))) {
+ local_direction = 0.0f;
+ local_pitch = 0.0f;
+ local_roll = 0.0f;
+
+ render::Camera::set_direction(0.0f);
+ render::Camera::set_pitch(0.0f);
+ }
}
/* -- directional control ------------------------- */
@@ -524,7 +526,7 @@ void key_pressed(Key *key)
void key_released(Key *key)
{
- if (core::application()->connected() && core::localcontrol() && !console()->visible() && !chat::visible()) {
+ if (core::application()->connected() && core::localcontrol()) {
if ((key->sym() == 512 + SDL_BUTTON_LEFT) && targets::hover() && (key->waspressed() <= mouse_timeout) ) {
// hovering target selected
@@ -657,6 +659,10 @@ void frame(float seconds)
render::reset();
}
+ if (core::localcontrol() && (core::localcontrol()->eventstate() != core::Entity::Normal)) {
+ local_thrust = core::localcontrol()->thrust();
+ }
+
/* -- detect joystick stat changes ---------------- */
Joystick::frame();
joystick_control = Joystick::is_enabled();
@@ -761,7 +767,7 @@ void frame(float seconds)
for (Keyboard::iterator it = keyboard->begin(); it != keyboard->end(); it++) {
key = (*it).second;
- if (key && key->sym() < 512 && key->pressed()) {
+ if (key && key->pressed()) {
while ((key->pressed()+delay < core::application()->time()) && (key->lastpressed()+repeat < core::application()->time())) {
if (key->lastpressed() > key->pressed())
key->key_lastpressed += repeat;