Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cc2
-rw-r--r--src/client/input.cc30
-rw-r--r--src/client/input.h3
3 files changed, 35 insertions, 0 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 2f60fce..7951577 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -35,6 +35,8 @@ void func_r_restart(std::string const &args)
if (!video::init()) {
app.quit(1);
}
+
+ input::reset();
}
//--- public ------------------------------------------------------
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 --------------- */
diff --git a/src/client/input.h b/src/client/input.h
index 96192f8..b2b44c8 100644
--- a/src/client/input.h
+++ b/src/client/input.h
@@ -24,6 +24,9 @@ void shutdown();
/// handle one frame of input events
void frame(float seconds);
+/// reset input state
+void reset();
+
extern int mouse_x;
extern int mouse_y;