//arrows

EntViewOrg = EntViewOrg + right * cvar.duckright;
same for up / height too

void HUD_Key_Event( int eventcode, int keynum, const char *pszCurrentBinding )
{
	if( keynum == 102 ) //f
	{
		if( eventcode == 1 )
			cvar.menu=!cvar.menu;
		KeyEventResult = 0;
	}
	if( keynum == 134 ) //shift
	{
		if( cvar.rspeed > 1 )
		{
			if( eventcode == 1 )
				cvar.speed = cvar.rspeed;
			if( eventcode == 0 )
				cvar.speed = 1;
			KeyEventResult = 0;
		}
	}
	if( cvar.menu && (eventcode==1) )
	{
		if( keynum == 128 )
		{
			if( menuIndex>0 ) menuIndex--;
			KeyEventResult = 0;
		}
		if( keynum == 129 ) //downarrow
		{
			if( menuIndex<menuItems-1 ) menuIndex++;
			KeyEventResult = 0;
		}
		if( keynum == 130 ) //leftarrow
		{
			cvar.menu = 0;
			KeyEventResult = 0;
		}
		if( keynum == 131 ) //rightarrow
		{
			if( menu[menuIndex].value )
			{
				menu[menuIndex].value[0] += menu[menuIndex].step;
				if( menu[menuIndex].value[0] > menu[menuIndex].max )
					menu[menuIndex].value[0] = menu[menuIndex].min;
			}
			KeyEventResult = 0;
		}
		if( keynum == 239 )
		{
			if( menuIndex<menuItems-1 ) menuIndex++;
			KeyEventResult = 0;
		}
		if( keynum == 240 )
		{
			if( menuIndex>0 ) menuIndex--;
			KeyEventResult = 0;
		}
		if( keynum == 241 )
		{
			if( eventcode )
			{
				menu[menuIndex].value[0] += menu[menuIndex].step;
				if( menu[menuIndex].value[0] > menu[menuIndex].max )
					menu[menuIndex].value[0] = menu[menuIndex].min;
			}
			KeyEventResult = 0;
		}
		if( keynum == 242 )
		{
			if( eventcode )
				cvar.menu = 0;
			KeyEventResult = 0;
		}
		
	}
	else
	{
		if( keynum == 131 ) //rightarrow
		{
			if( eventcode == 1 )
				cvar.menu=!cvar.menu;
			KeyEventResult = 0;
		}
		if( cvar.bind >= 1 )
		{
			cvar.bind=floor(cvar.bind);
			if( keynum == 240+cvar.bind ) //mouse2
			{
				cvar.lock = (eventcode==1);
				cvar.aim = (eventcode==1);
				//KeyEventResult = 0;
			}
		}
	}
}

//wasd
void HUD_Key_Event( int eventcode, int keynum, const char *pszCurrentBinding )
{
	if( keynum == 102 ) //f
	{
		if( eventcode == 1 )
			cvar.menu=!cvar.menu;
		KeyEventResult = 0;
	}
	if( keynum == 134 ) //shift
	{
		if( cvar.rspeed > 1 )
		{
			if( eventcode == 1 )
				cvar.speed = cvar.rspeed;
			if( eventcode == 0 )
				cvar.speed = 1;
			KeyEventResult = 0;
		}
	}
	if( cvar.menu && (eventcode==1) )
	{
		if( keynum == 119 ) // W or uparrow
		{
			if( menuIndex>0 ) menuIndex--;
			KeyEventResult = 0;
		}
		if( keynum == 115 ) //downarrow
		{
			if( menuIndex<menuItems-1 ) menuIndex++;
			KeyEventResult = 0;
		}
		if( keynum == 97 ) //leftarrow
		{
			cvar.menu = 0;
			KeyEventResult = 0;
		}
		if( keynum == 100 ) //rightarrow
		{
			if( menu[menuIndex].value )
			{
				menu[menuIndex].value[0] += menu[menuIndex].step;
				if( menu[menuIndex].value[0] > menu[menuIndex].max )
					menu[menuIndex].value[0] = menu[menuIndex].min;
			}
			KeyEventResult = 0;
		}
		if( keynum == 239 )
		{
			if( menuIndex<menuItems-1 ) menuIndex++;
			KeyEventResult = 0;
		}
		if( keynum == 240 )
		{
			if( menuIndex>0 ) menuIndex--;
			KeyEventResult = 0;
		}
		if( keynum == 241 )
		{
			if( eventcode )
			{
				menu[menuIndex].value[0] += menu[menuIndex].step;
				if( menu[menuIndex].value[0] > menu[menuIndex].max )
					menu[menuIndex].value[0] = menu[menuIndex].min;
			}
			KeyEventResult = 0;
		}
		if( keynum == 242 )
		{
			if( eventcode )
				cvar.menu = 0;
			KeyEventResult = 0;
		}
		
	}
	else
	{
		if( keynum == 100 ) //rightarrow
		{
			if( eventcode == 1 )
				cvar.menu=!cvar.menu;
			KeyEventResult = 0;
		}
		if( cvar.bind >= 1 )
		{
			cvar.bind=floor(cvar.bind);
			if( keynum == 240+cvar.bind ) //mouse2
			{
				cvar.lock = (eventcode==1);
				cvar.aim = (eventcode==1);
				//KeyEventResult = 0;
			}
		}
	}
}
