diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-15 00:16:45 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-15 00:16:45 +0000 |
commit | 84d6f8c6a58c2b0e94a6137b4a055a4e32d29457 (patch) | |
tree | aa39a09291cf7bbcc21287c44cc895192233da4d /src/client/input.cc | |
parent | bb73e3aaa036fb4450e98c715e80a6e8d9f2714d (diff) |
various small fixes
Diffstat (limited to 'src/client/input.cc')
-rw-r--r-- | src/client/input.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 1b895b7..10be405 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -56,6 +56,9 @@ bool mouse_control = false; const float thruster_offset = 0.05f; +// small hack to prevent two sounds triggered by the scrollwheel +bool singleclick = true; + //--- engine functions -------------------------------------------- void func_screenshot(std::string const & args) @@ -232,14 +235,18 @@ void action_press(std::string const &action) { /* -- thruster ------------------------------------ */ if (action.compare("+thrust") == 0) { - if (local_thrust < 1.0f) + if (local_thrust < 1.0f && singleclick) { audio::play("ui/thruster"); + singleclick = false; + } local_thrust += thruster_offset; } else if (action.compare("-thrust") == 0) { - if (local_thrust > 0.0f) + if (local_thrust > 0.0f && singleclick) { audio::play("ui/thruster"); + singleclick = false; + } local_thrust -= 2.0f * thruster_offset; /* -- mouse control ------------------------------- */ @@ -355,6 +362,7 @@ void frame(float seconds) SDL_Event event; Key *key = 0; bool pressed = false; + singleclick = true; while (SDL_PollEvent(&event)) { pressed = false; @@ -400,7 +408,7 @@ void frame(float seconds) if (keysym.mod & KMOD_CAPS) capslock = true; else capslock = false; if ((keysym.mod & KMOD_LSHIFT) || (keysym.mod & KMOD_RSHIFT)) capslock != capslock; */ - // FIXME screenshot and console are always captured + // console key is always captured if (key->bind().compare("ui_console") == 0) { console()->toggle(); local_direction = 0.0f; @@ -410,16 +418,13 @@ void frame(float seconds) render::Camera::set_direction(0.0f); render::Camera::set_pitch(0.0f); - } else if (key->bind().compare("screenshot") == 0) { - video::screenshot(); - } else if (console()->visible()) { - // FIXME send key events to the console + // send key events to the console if (event.type == SDL_KEYDOWN) console()->keypressed(translate_keysym(event.key.keysym)); } else if (chat::visible()) { - // FIXME send key events to the chat box + // send key events to the chat box if (event.type == SDL_KEYDOWN) chat::keypressed(translate_keysym(event.key.keysym)); @@ -445,7 +450,7 @@ void frame(float seconds) } else { - if (core::application()->connected() && core::localcontrol()) { + if (core::application()->connected() && core::localcontrol() && !console()->visible() && !chat::visible()) { char c = key->bind().c_str()[0]; if (c == '+' || c == '-') { |