diff options
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/ship.cc | 39 | ||||
-rw-r--r-- | src/game/base/ship.h | 1 |
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; |