diff options
author | Stijn Buys <ingar@osirion.org> | 2009-07-16 18:34:54 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-07-16 18:34:54 +0000 |
commit | 70b4d79d501be4802a06770f02b8f49e2c14e8a7 (patch) | |
tree | b868e13489f8ef4377c7ac6c7d900ee854270b03 /src/game/base | |
parent | 1b8ceba3a173ff59939042713cd07a65e83193f1 (diff) |
Removes unused collor array support, disable bullet in sys/sys.h
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/game.cc | 30 | ||||
-rw-r--r-- | src/game/base/game.h | 2 | ||||
-rw-r--r-- | src/game/base/physics.cc | 2 | ||||
-rw-r--r-- | src/game/base/ship.cc | 16 |
4 files changed, 28 insertions, 22 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc index 441e080..ed1b80e 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -237,10 +237,11 @@ void Game::func_launch(core::Player *player, std::string const &args) Ship *ship = static_cast<Ship *>(player->control()); ship->shutdown_physics(); core::Entity *dock = player->view(); - ship->entity_location.assign(dock->location() + (dock->axis().forward() * (player->control()->radius()+ dock->radius()))); + ship->entity_location.assign(dock->location() + (dock->axis().forward() * (ship->radius()+ dock->radius()))); ship->entity_axis.assign(dock->axis()); ship->set_state(core::Entity::Normal); ship->init_physics(ship->radius()); + ship->set_state(core::Entity::Jump); player->set_view(0); player->send("^BLaunching from " + dock->name()); @@ -258,21 +259,27 @@ void Game::func_respawn(core::Player *player, std::string const &args) if (player->control()->state() != core::Entity::Destroyed) return; - player->control()->set_zone(Default::zone); + Ship *ship = static_cast<Ship *>(player->control()); core::Entity *dock = player->control()->zone()->default_view(); + + ship->shutdown_physics(); + if (dock) { - player->control()->entity_location.assign(dock->location() + (dock->axis().forward() * ((player->control()->radius()+ dock->radius())))); - player->control()->entity_axis.assign(dock->axis()); - player->control()->set_state(core::Entity::Docked); + ship->entity_location.assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius())))); + ship->entity_axis.assign(dock->axis()); + ship->set_state(core::Entity::Docked); player->set_view(dock); player->send("^BRespawning at " + dock->name()); } else { - player->control()->location().clear(); - player->control()->axis().clear(); - player->control()->set_state(core::Entity::Normal); + ship->location().clear(); + ship->axis().clear(); + ship->set_state(core::Entity::Jump); player->set_view(0); player->send("^BRespawning"); } + + ship->set_zone(Default::zone); + ship->init_physics(ship->radius()); } @@ -302,7 +309,8 @@ void Game::func_goto(core::Player *player, const std::string &args) ship->set_state(core::Entity::Normal); ship->init_physics(ship->radius()); - + ship->set_state(core::Entity::Jump); + player->set_view(0); player->send("Going to " + dock->name()); } else { @@ -945,10 +953,10 @@ bool Game::load_player() void Game::frame(float seconds) { + Physics::frame(seconds); + if (!running()) return; - - Physics::frame(seconds); } void Game::player_connect(core::Player *player) diff --git a/src/game/base/game.h b/src/game/base/game.h index 1f16a9f..7519970 100644 --- a/src/game/base/game.h +++ b/src/game/base/game.h @@ -51,7 +51,7 @@ public: Game(); virtual ~Game(); - /// run one time frame + /// run one game frame void frame(float seconds); /// is called when a player connects diff --git a/src/game/base/physics.cc b/src/game/base/physics.cc index e0b6a70..b76e0c1 100644 --- a/src/game/base/physics.cc +++ b/src/game/base/physics.cc @@ -267,7 +267,7 @@ void PhysicsBody::init_physics(const float mass) collider_body = new btRigidBody(body_info); collider_body->setUserPointer((void *)entity()); collider_body->setLinearFactor(btVector3(1,1,1)); - //collider_body->setCcdMotionThreshold(0.0001f); + collider_body->setCcdMotionThreshold(0.0001f); } else { collider_body = new btRigidBody(mass, 0, collider_shape->bullet_shape(), inertia); collider_body->setWorldTransform(t); diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 739b29a..b512d34 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -278,14 +278,14 @@ void Ship::frame(float seconds) if (entity_timer <= 0) { if (ship_jumpdepart && ship_jumpdepart->target()) { set_state(core::Entity::Jump); + entity_speed = Game::g_impulsespeed->value(); if (ship_jumpdepart->moduletype() == jumpgate_enttype) { entity_axis.assign(ship_jumpdepart->target()->axis()); entity_location.assign(ship_jumpdepart->target()->location()); //entity_location += entity_axis.forward() * radius(); } else { entity_location.assign(ship_jumpdepart->target()->location() + location() - ship_jumpdepart->location()); - } - + } set_zone(ship_jumpdepart->target()->zone()); owner()->send("^BJumping to the " + ship_jumpdepart->target()->zone()->name()); } else { @@ -320,18 +320,16 @@ void Ship::frame(float seconds) target_afterburner = 0.0f; target_thrust = 0; - // FIXME jump location and axis - //math::Axis default_axis; - //entity_axis.assign(default_axis); - entity_dirty = true; - // FIXME 5 second cooldown - entity_speed = Game::g_impulsespeed->value(); entity_state = core::Entity::Normal; + entity_dirty = true; + if (owner() && owner()->view() && owner()->control() == (EntityControlable*) this) owner()->set_view(0); + return; + } else if (entity_state == core::Entity::ImpulseInitiate) { if (ship_impulsedrive_timer + 1.0f <= core::server()->time()) { @@ -546,7 +544,7 @@ void Ship::frame(float seconds) 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 * 10.0f)); + body()->applyCentralImpulse(to_btVector3(axis().forward() * actual_thrust * actual_acceleration * seconds * 20.0f)); #endif /* else #ifndef HAVE_BULLET */ |