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-07-22 22:48:21 +0000
committerStijn Buys <ingar@osirion.org>2008-07-22 22:48:21 +0000
commit67517585e9b55967f5236ed5ebca77173eb2f2e3 (patch)
tree48a235b3265c91478ba814141a31cc74ab87db27 /src/client/input.cc
parent540b500f2176966ebfb7f21ebd2c17ddfdcd34e6 (diff)
reset keyboard state on r_restart
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc30
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 --------------- */