From bd421e2b53326657f2746ef0f55c08ea53d7a761 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 7 Jul 2011 23:23:12 +0000 Subject: Added a 2 second jump drive cooldown, added jump completed sound effect, reset keyboard modifiers when resetting the video subsystem. --- src/game/base/game.h | 1 + src/game/base/ship.cc | 33 ++++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'src/game') diff --git a/src/game/base/game.h b/src/game/base/game.h index 908aeb6..27ba31b 100644 --- a/src/game/base/game.h +++ b/src/game/base/game.h @@ -41,6 +41,7 @@ const float planet_safe_distance = 50.0f; // ship engine delay times const float jump_timer_delay = 5.0f; +const float jump_cooldown_delay = 2.0f; const float impulse_timer_delay = 3.0f; diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 7a499c3..2b8411a 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -422,8 +422,9 @@ void Ship::frame(const unsigned long elapsed) } else { set_state(core::Entity::Normal); } - ship_jumpdrive_timer = 0; - entity_timer = 0; + + ship_jumpdrive_timer = core::server()->time(); + entity_timer = jump_cooldown_delay; set_dirty(); return; @@ -455,16 +456,26 @@ void Ship::frame(const unsigned long elapsed) target_afterburner = 0.0f; target_thrust = 0.0f; - // FIXME 5 second cooldown - entity_state = core::Entity::Normal; - - set_dirty(); - - if (owner() && owner()->view() && owner()->control() == (EntityControlable*) this) - owner()->set_view(0); - + // apply jump drive cooldown + if (ship_jumpdrive_timer + 1.0f <= core::server()->time()) { + entity_timer -= 1.0f; + + if (entity_timer <= 0) { + ship_jumpdrive_timer = 0; + set_state(core::Entity::Normal); + set_dirty(); + + if (owner() && owner()->view() && owner()->control() == (EntityControlable*) this) + owner()->set_view(0); + + } else { + ship_jumpdrive_timer = core::server()->time(); + set_dirty(); + } + } + return; - + } else if (entity_state == core::Entity::ImpulseInitiate) { // cancel impulse drive if afterburner goes reverse -- cgit v1.2.3