diff options
Diffstat (limited to 'src/client/input.cc')
-rw-r--r-- | src/client/input.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 819ce27..6306fc8 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -453,6 +453,36 @@ void key_released(Key *key) } +void reset() +{ + local_direction = 0.0f; + local_pitch = 0.0f; + local_roll = 0.0f; + if (core::localcontrol()) { + local_thrust = core::localcontrol()->thrust(); + last_control = core::localcontrol()->id(); + } else { + local_thrust = 0; + last_control = 0; + } + mouse_pitch = 0.0f; + mouse_direction = 0.0f; + mouse_x = video::width / 2; + mouse_y = video::height / 2; + render::Camera::reset(); + mouse_control_override = false; + targets::reset(); + render::reset(); + + for (Keyboard::iterator it = keyboard->begin(); it != keyboard->end(); it++) { + Key *key = (*it).second; + if (key) { + key->pressed() = 0; + key->lastpressed() = 0; + } + } +} + void frame(float seconds) { /* -- detect localcontrol() changes --------------- */ |