about summary refs log tree commit diff
path: root/src/game/client/game_client.cpp
diff options
context:
space:
mode:
authorJoel de Vahl <joel@stalverk80.se>2007-08-05 23:00:32 +0000
committerJoel de Vahl <joel@stalverk80.se>2007-08-05 23:00:32 +0000
commit313781b365dcce8dce03a3c26babdcb4637ca2bf (patch)
tree9ba43c34f29818929f067fde1d82f0d0b64eeae8 /src/game/client/game_client.cpp
parent01306887157deabe2c4d5ea0ffd0813fcc874f89 (diff)
downloadzcatch-313781b365dcce8dce03a3c26babdcb4637ca2bf.tar.gz
zcatch-313781b365dcce8dce03a3c26babdcb4637ca2bf.zip
scroll wheel for weapon switch
Diffstat (limited to 'src/game/client/game_client.cpp')
-rw-r--r--src/game/client/game_client.cpp13
1 files changed, 11 insertions, 2 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));