From 313781b365dcce8dce03a3c26babdcb4637ca2bf Mon Sep 17 00:00:00 2001 From: Joel de Vahl Date: Sun, 5 Aug 2007 23:00:32 +0000 Subject: scroll wheel for weapon switch --- src/game/client/game_client.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/game/client/game_client.cpp') 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)); -- cgit 1.4.1