Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r--src/game/base/ship.cc50
1 files changed, 8 insertions, 42 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 78764e3..696033c 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -27,7 +27,7 @@ const float impulse_delay = 3.0f; // 3 second delay before impulse kicks in
// note: this delay must match the impulse drive sound set
const float jump_delay = 5.0f; // 5 seconds delay before jump driv kicks in
-Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(), PhysicsBody(this)
+Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable()
{
entity_moduletypeid = ship_enttype;
@@ -81,7 +81,6 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(
Ship::~Ship()
{
- shutdown_physics();
}
void Ship::reset()
@@ -282,35 +281,30 @@ void Ship::explode()
void Ship::set_zone(core::Zone *zone)
{
- shutdown_physics();
-
core::EntityControlable::set_zone(zone);
if (owner() && (owner()->control() == (EntityControlable*) this))
owner()->set_zone(zone);
-
- init_physics(radius());
}
void Ship::frame(float seconds)
{
- float actual_maxspeed = ship_shipmodel->maxspeed();
- float actual_turnspeed = ship_shipmodel->turnspeed();
- float actual_acceleration = ship_shipmodel->acceleration();
- float actual_thrust = 0;
-
-#ifndef HAVE_BULLET
const float direction_reaction = 2.0f; // direction controls reaction time factor
const float thrust_reaction = 0.5f; // thrust control reaction time factor
const float strafe_reaction = 1.5f;
const float afterburner_reaction = 1.0f; // a fterburner control reaction time
+ float actual_maxspeed = ship_shipmodel->maxspeed();
+ float actual_turnspeed = ship_shipmodel->turnspeed();
+ float actual_acceleration = ship_shipmodel->acceleration();
+ float actual_thrust = 0;
float cosangle; // cosine of an angle
float angle; // angle in radians
math::Vector3f n; // normal of a plane
- math::Axis target_axis(axis()); // target axis
-#endif
+
+ math::Axis target_axis(axis()); // target axis
+
entity_movement = 0;
/* -- update state ----------------------------------------- */
@@ -511,7 +505,6 @@ void Ship::frame(float seconds)
actual_thrust = 1.0f;
}
-
// update strafe control target
if (current_target_strafe < target_strafe) {
current_target_strafe += strafe_reaction * seconds;
@@ -522,9 +515,6 @@ void Ship::frame(float seconds)
if (current_target_strafe < target_strafe)
current_target_strafe = target_strafe;
}
-#ifndef HAVE_BULLET
-
- /* -- original frame --------------------------------------- */
// update roll control target
if (current_target_roll < target_roll) {
@@ -615,30 +605,6 @@ void Ship::frame(float seconds)
get_location() += axis().forward() * speed() * seconds;
}
-#else /* #ifndef HAVE_BULLET */
-
- /* -- bullet frame ----------------------------------------- */
-
- // get entity speed from physics body
- btVector3 velocity(body()->getInterpolationLinearVelocity());
- entity_speed = velocity.length();
-
- // get physics body world transformation
- btTransform t;
- if (body()->getMotionState())
- body()->getMotionState()->getWorldTransform(t);
- else
- t = body()->getWorldTransform();
-
- // get entity location from physics body
- btVector3 v(t.getOrigin());
- entity_location.assign(v[0], v[1], v[2]);
-
- // apply engine trust to the body
- body()->applyCentralImpulse(to_btVector3(axis().forward() * actual_thrust * actual_acceleration * seconds * 20.0f));
-
-#endif /* else #ifndef HAVE_BULLET */
-
entity_movement = target_thrust;
entity_movement = math::max(entity_movement, fabs(current_target_pitch));
entity_movement = math::max(entity_movement, fabs(current_target_direction));