diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/input.cc | 1 | ||||
-rw-r--r-- | src/client/soundext.cc | 13 | ||||
-rw-r--r-- | src/client/soundext.h | 2 | ||||
-rw-r--r-- | src/game/base/game.h | 1 | ||||
-rw-r--r-- | src/game/base/ship.cc | 33 |
5 files changed, 39 insertions, 11 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 50ef4da..8672284 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -713,6 +713,7 @@ void reset() last_key = 0; mouse_lastmoved = 0; joystick_lastmoved = 0; + keyboard_modifiers = 0; } void frame() diff --git a/src/client/soundext.cc b/src/client/soundext.cc index b07cc35..5ebcd99 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -95,6 +95,7 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun state_impulsestartbuffer = 0; state_impulsestopbuffer = 0; state_jumpstartbuffer = 0; + state_jumpstopbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -123,6 +124,7 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun state_impulsestartbuffer = audio::Buffers::load("engines/impulse_start00"); state_impulsestopbuffer = audio::Buffers::load("engines/impulse_stop00"); state_jumpstartbuffer = audio::Buffers::load("engines/jump_start00"); + state_jumpstopbuffer = audio::Buffers::load("engines/jump_stop00"); state_engineloopsource = audio::Sources::get(); state_engineeventsource = audio::Sources::get(); @@ -176,6 +178,7 @@ void SoundExt::clear() state_impulsestartbuffer = 0; state_impulsestopbuffer = 0; state_jumpstartbuffer = 0; + state_jumpstopbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -231,6 +234,16 @@ void SoundExt::frame(float elapsed) state_engineeventbuffer = audio::play(state_engineeventsource, state_jumpstartbuffer); } + + } else if (entity->state() == core::Entity::Jump) { + + if (state_engineeventbuffer != state_jumpstopbuffer) { + audio::update_source(state_engineeventsource, + entity->location() - entity->axis().forward() * r , + entity->axis().forward() * speed); + + state_engineeventbuffer = audio::play(state_engineeventsource, state_jumpstopbuffer); + } } else if (entity->state() == core::Entity::Impulse) { diff --git a/src/client/soundext.h b/src/client/soundext.h index becaa8e..cf5585e 100644 --- a/src/client/soundext.h +++ b/src/client/soundext.h @@ -85,6 +85,8 @@ private: size_t state_impulsestopbuffer; /// index of the audio buffer containing the jump engine start sound size_t state_jumpstartbuffer; + /// index of the audio buffer containing the jump engine stop sound + size_t state_jumpstopbuffer; /// index of the audio buffer currently looping in enginesource size_t state_engineloopbuffer; 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 |