diff options
| author | Joel de Vahl <joel@stalverk80.se> | 2007-08-05 23:00:32 +0000 |
|---|---|---|
| committer | Joel de Vahl <joel@stalverk80.se> | 2007-08-05 23:00:32 +0000 |
| commit | 313781b365dcce8dce03a3c26babdcb4637ca2bf (patch) | |
| tree | 9ba43c34f29818929f067fde1d82f0d0b64eeae8 /src/game/client | |
| parent | 01306887157deabe2c4d5ea0ffd0813fcc874f89 (diff) | |
| download | zcatch-313781b365dcce8dce03a3c26babdcb4637ca2bf.tar.gz zcatch-313781b365dcce8dce03a3c26babdcb4637ca2bf.zip | |
scroll wheel for weapon switch
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/game_client.cpp | 13 | ||||
| -rw-r--r-- | src/game/client/menu.cpp | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 8b813968..487ec73d 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1319,12 +1319,21 @@ void render_game() // Weapon switching #define TEST_WEAPON_KEY(key) if (inp_key_pressed(config.key_weapon ## key)) input.activeweapon = key-1; + if(config.scroll_weapon) + { + int delta = inp_mouse_scroll(); + input.activeweapon = input.activeweapon + delta; + + if(input.activeweapon > 3) + input.activeweapon = 3; + else if(input.activeweapon < 0) + input.activeweapon = 0; + } + TEST_WEAPON_KEY(1); TEST_WEAPON_KEY(2); TEST_WEAPON_KEY(3); TEST_WEAPON_KEY(4); - //for(int i = 0; i < 8; i++) - // input.activeweapon = inp_key_pressed('1'+i) ? i : input.activeweapon; } snap_input(&input, sizeof(input)); diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index a3b94356..b39b8c3a 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -804,7 +804,7 @@ static int settings_controls_render() { "Hammer:", &config_copy.key_weapon4, config_set_key_weapon4 }, }; - for (int i = 0; i < 7; i++) + for (int i = 0; i < 6; i++) { key_thing key = keys[i + scroll_index]; @@ -825,7 +825,11 @@ static int settings_controls_render() config_set_key_hook(&config_copy, ui_do_key_reader(&config_copy.key_hook, column2_x, row1_y + 160, 150, 36, config_copy.key_hook)); */ - scroll_index = do_scroll_bar_vert(&scroll_index, 600, row1_y, 40 * 7, 9 - 7, scroll_index); + scroll_index = do_scroll_bar_vert(&scroll_index, 600, row1_y, 40 * 6, 9 - 7, scroll_index); + + ui_do_label(column1_x, row1_y + 40 * 6, "Scroll wheel weapon switch", 22); + config_set_scroll_weapon(&config_copy, ui_do_check_box(&config_copy.scroll_weapon, column2_x + 50, row1_y + 40 * 6, 22, 22, config_copy.scroll_weapon)); + return 0; } |