From 033bd59cfc2dff93529ad448459ad6348ea29c8d Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 3 Sep 2008 19:43:31 +0000 Subject: only one key repeat per frame --- src/client/input.cc | 7 ++----- src/client/keyboard.cc | 5 +++-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/input.cc b/src/client/input.cc index 75fa0f3..5cbb17c 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -786,11 +786,8 @@ void frame(float seconds) for (Keyboard::iterator it = keyboard->begin(); it != keyboard->end(); it++) { key = (*it).second; if (key && key->pressed()) { - while ((key->pressed()+delay < core::application()->time()) && (key->lastpressed()+repeat < core::application()->time())) { - if (key->lastpressed() > key->pressed()) - key->key_lastpressed += repeat; - else - key->key_lastpressed += delay; + if ((key->pressed()+delay < core::application()->time()) && (key->lastpressed()+repeat < core::application()->time())) { + key->key_lastpressed = core::application()->time(); key_pressed(key); } } diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc index ae21eb1..b420fb8 100644 --- a/src/client/keyboard.cc +++ b/src/client/keyboard.cc @@ -112,7 +112,7 @@ Keyboard::Keyboard() add_key("b", SDLK_b, 'b'); add_key("c", SDLK_c, 'c'); add_key("d", SDLK_d, 'd', "+straferight"); - add_key("e", SDLK_e, 'e'); + add_key("e", SDLK_e, 'e', "+rollright"); add_key("f", SDLK_f, 'f'); add_key("g", SDLK_g, 'g'); add_key("h", SDLK_h, 'h'); @@ -123,9 +123,10 @@ Keyboard::Keyboard() add_key("m", SDLK_m, 'm'); key = add_key("n", SDLK_n, 'n', "target_next"); key->assign(Key::Shift, "target_prev"); + key->assign(Key::Ctrl, "target_none"); add_key("o", SDLK_o, 'o'); add_key("p", SDLK_p, 'p'); - add_key("q", SDLK_q, 'q'); + add_key("q", SDLK_q, 'q', "+rollleft"); add_key("r", SDLK_r, 'r'); add_key("s", SDLK_s, 's', "+reverse"); add_key("t", SDLK_t, 't', "ui_chat"); -- cgit v1.2.3