From 75906b43ecb9a04fdab365bd8b1a00fbdbc66918 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 3 Oct 2010 19:57:17 +0000 Subject: ui updates, removed impulse and jumpgte g_devel conditions, jumpdrive crash bugfix --- src/game/base/jumppoint.cc | 7 +++++-- src/game/base/ship.cc | 49 +++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 27 deletions(-) (limited to 'src/game') diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc index 9ef18d9..ae66262 100644 --- a/src/game/base/jumppoint.cc +++ b/src/game/base/jumppoint.cc @@ -20,6 +20,8 @@ JumpPoint::JumpPoint() : core::EntityDynamic() set_radius(0.25f); set_flag(core::Entity::Static); set_flag(core::Entity::Bright); + // FIXME jumppoints should be harder to find + set_flag(core::Entity::ShowOnMap); entity_moduletypeid = jumppoint_enttype; jumppoint_target = 0; @@ -60,17 +62,18 @@ void JumpPoint::validate() core::Entity *targetentity = targetzone->find_entity(entitylabel); if (!targetentity) { - con_warn << " Could not find target jumppoint '" << entitylabel << "'\n"; + con_warn << " Could not find target jumppoint '" << entitylabel << "' in zone '" << zonelabel << "'\n"; return; } if ((targetentity->moduletype() != jumppoint_enttype) && (targetentity->moduletype() != jumpgate_enttype)) { - con_warn << " Jumppoint with invalid target jumppoint '" << entitylabel << "'\n"; + con_warn << " Jumppoint with invalid target jumppoint '" << entitylabel << "' in zone '" << zonelabel << "'\n"; return; } jumppoint_target = static_cast(targetentity); + con_debug << " jumppoint to " << targetzone->label() << std::endl; //con_debug << " Jumppoint " << zone->label() << ":" << label() << " with target " << targetlabel() << std::endl; } diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index d51a119..78764e3 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -23,6 +23,9 @@ namespace game { const float MIN_DELTA = 0.000001f; +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) { @@ -126,29 +129,30 @@ void Ship::func_impulse() entity_state = core::Entity::Normal; target_thrust = 1.0f; entity_thrust = 0.0f; + set_dirty(); + return; + } - } else if (entity_state == core::Entity::ImpulseInitiate) { + if (entity_state == core::Entity::ImpulseInitiate) { entity_state = core::Entity::Normal; - - } else if (entity_state != core::Entity::Normal) { + set_dirty(); return; + } - } else { - if (entity_state == core::Entity::JumpInitiate) { - ship_jumpdrive_timer = 0; - entity_timer = 0; - } - - entity_state = core::Entity::ImpulseInitiate; - if (Game::g_devel->value()) { - entity_timer = 0; - } else { - entity_timer = 3; - } - ship_impulsedrive_timer = core::server()->time(); + if (entity_state == core::Entity::JumpInitiate) { + entity_state = core::Entity::Normal; + ship_jumpdrive_timer = 0; + entity_timer = 0; + set_dirty(); } - set_dirty(); + if (entity_state != core::Entity::Normal) + return; + + entity_state = core::Entity::ImpulseInitiate; + entity_timer = impulse_delay; + ship_impulsedrive_timer = core::server()->time(); + } void Ship::initiate_jump(JumpPoint *depart) @@ -163,14 +167,9 @@ void Ship::initiate_jump(JumpPoint *depart) ship_jumpdepart = depart; entity_state = core::Entity::JumpInitiate; - - if (Game::g_devel->value()) { - entity_timer = 0; - } else { - entity_timer = 8; - } - + entity_timer = jump_delay; ship_jumpdrive_timer = core::server()->time(); + set_dirty(); } @@ -351,7 +350,7 @@ void Ship::frame(float seconds) set_zone(ship_jumpdepart->target()->zone()); - if (owner() && owner()->view()->zone() != ship_jumpdepart->target()->zone()) + if (owner() && owner()->view() && (owner()->view()->zone() != ship_jumpdepart->target()->zone())) owner()->set_view(0); owner()->send("^BJumping to the " + ship_jumpdepart->target()->zone()->name()); -- cgit v1.2.3