Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-27 16:47:39 +0000
committerStijn Buys <ingar@osirion.org>2010-11-27 16:47:39 +0000
commitd22085f13895ab5f3cc479c3249ebeea32f53ed7 (patch)
tree3071930e073e4d87d28bb164943cba1cd0b20874 /src/game
parent2792e70132ceaa6eb33c8b39528fe8f2c23045e1 (diff)
Removed input lag from ship controles.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/ship.cc39
-rw-r--r--src/game/base/ship.h1
2 files changed, 32 insertions, 8 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 86a467b..ef60e97 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -37,6 +37,8 @@ Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityContro
ship_jumpdrive_timer = 0;
ship_jumpdepart = 0;
+ current_impulse = false;
+
// apply ship type settings
ship_shipmodel->apply(this);
@@ -361,10 +363,10 @@ void Ship::action (btScalar seconds)
void Ship::frame(float seconds)
{
- const float direction_reaction = 2.0f; // directional control reaction time
- const float thrust_reaction = 0.5f; // thrust control reaction time
- const float strafe_reaction = 1.5f; // strafe control reaction time
- const float afterburner_reaction = 1.0f; // afterburner control reaction time
+ //const float direction_reaction = 2.0f; // directional control reaction time
+ //const float thrust_reaction = 0.5f; // thrust control reaction time
+ //const float strafe_reaction = 1.5f; // strafe control reaction time
+ //const float afterburner_reaction = 1.0f; // afterburner control reaction time
math::Vector3f n; // normal of a plane
math::Axis target_axis(axis()); // target axis
@@ -531,7 +533,28 @@ void Ship::frame(float seconds)
entity_thrust = 0;
}
+ /* -- SNAPPY ------------------------------------------ */
+
+ current_target_afterburner = target_afterburner;
+ if (current_target_afterburner < 0.0f) {
+ target_thrust = 0;
+ }
+ entity_thrust = target_thrust;
+
+ current_target_strafe = target_strafe;
+ current_target_vstrafe = target_vstrafe;
+
+ current_target_roll = target_roll;
+ current_target_pitch = target_pitch;
+ current_target_direction = target_direction;
+
+ // clamp values
+ math::clamp(entity_thrust, 0.0f, 1.0f);
+
+ /* -- NOT SNAPPY -------------------------------------- */
+ /*
// update afterburner control target
+
if (current_target_afterburner < target_afterburner) {
current_target_afterburner += afterburner_reaction * seconds;
if (current_target_afterburner > target_afterburner)
@@ -541,8 +564,8 @@ void Ship::frame(float seconds)
current_target_afterburner -= afterburner_reaction * seconds;
if (current_target_afterburner < target_afterburner)
current_target_afterburner = target_afterburner;
- }
-
+ }
+
// update thrust control target
if (current_target_afterburner < 0.0f) {
target_thrust = 0;
@@ -560,7 +583,6 @@ void Ship::frame(float seconds)
}
math::clamp(entity_thrust, 0.0f, 1.0f);
-
// update strafe control target
if (current_target_strafe < target_strafe) {
current_target_strafe += strafe_reaction * seconds;
@@ -617,7 +639,8 @@ void Ship::frame(float seconds)
if (current_target_roll < target_roll)
current_target_roll = target_roll;
}
-
+ */
+
EntityControlable::frame(seconds);
}
diff --git a/src/game/base/ship.h b/src/game/base/ship.h
index 033f497..b0256aa 100644
--- a/src/game/base/ship.h
+++ b/src/game/base/ship.h
@@ -124,6 +124,7 @@ private:
float current_target_strafe;
float current_target_vstrafe;
float current_target_afterburner;
+ bool current_impulse;
bool ship_jumpdrive;
float ship_jumpdrive_timer;