Exemplo n.º 1
0
/*
================
VID_MenuKey
================
*/
const char *VID_MenuKey( int key )
{
	extern void M_PopMenu( void );

	menuframework_s *m = s_current_menu;
	static const char *sound = "misc/menu1.wav";

	switch ( key )
	{
	case K_ESCAPE:
		M_PopMenu();
		return NULL;
	case K_UPARROW:
		m->cursor--;
		Menu_AdjustCursor( m, -1 );
		break;
	case K_DOWNARROW:
		m->cursor++;
		Menu_AdjustCursor( m, 1 );
		break;
	case K_LEFTARROW:
		Menu_SlideItem( m, -1 );
		break;
	case K_RIGHTARROW:
		Menu_SlideItem( m, 1 );
		break;
	case K_ENTER:
		Menu_SelectItem( m );
		break;
	}

	return sound;
}
Exemplo n.º 2
0
static void UpdateMenuFunc( void *unused )
{
	curmenu = s_options_list.curvalue;
	m_entersound = true;
	M_PopMenu();
	M_PushMenu ( &s_options_menu2[curmenu] );
	m_entersound = false;

}
Exemplo n.º 3
0
const char *VID_MenuKey( int key )
{
	menuframework_t *m = s_current_menu;
	static const char *insound = "misc/menu1.wav";
	static const char *movesound = "misc/menu2.wav";	// NeVo
	static const char *exitsound = "misc/menu3.wav";	// NeVo
	const char *sound = NULL;

	switch ( key )
	{
	case K_ESCAPE:
		M_PopMenu();	// NeVo
		return exitsound;	// NeVo
		break;
	case K_KP_UPARROW:
	case K_UPARROW:
		m->cursor--;
		Menu_AdjustCursor( m, -1 );
		sound = movesound;
		break;
	case K_KP_DOWNARROW:
	case K_DOWNARROW:
		m->cursor++;
		Menu_AdjustCursor( m, 1 );
		sound = movesound;
		break;
	case K_KP_LEFTARROW:
	case K_LEFTARROW:
		Menu_SlideItem( m, -1 );
		sound = movesound;
		break;
	case K_KP_RIGHTARROW:
	case K_RIGHTARROW:
		Menu_SlideItem( m, 1 );
		sound = movesound;
		break;
	case K_KP_ENTER:
	case K_ENTER:
		if ( !Menu_SelectItem( m ) )
			ApplyChanges( NULL );
		sound = movesound;
		break;
	}

	return sound;
}
Exemplo n.º 4
0
PRIVATE const char *M_Victory_Key( int key )
{
	if( nvictory )
	{
		M_PopMenu();
		M_PushMenu( M_Victory_Text_Draw, M_Victory_Key );
		nvictory = 0;
		page = 0;
		ClientStatic.state = ca_disconnected;

		return NULL;
	}

	switch( key )
	{
		case K_ESCAPE:
			nvictory = 1;
			M_ForceMenuOff();
			M_Menu_Main_f();
			break;

		case K_KP_LEFTARROW:
		case K_LEFTARROW:
			if( page == 1 )
			{
				page = 0;
			}
			break;

		case K_KP_RIGHTARROW:
		case K_RIGHTARROW:
			if( page == 0 )
			{
				page = 1;
			}
			break;

	}

	return NULL;
}
Exemplo n.º 5
0
const char *M_Quit_Key (menuframework_s *self, int key)
{
	switch (key)
	{
	case K_ESCAPE:
	case K_MOUSE2:
	case 'n':
	case 'N':
		M_PopMenu ();
		break;

	case 'Y':
	case 'y':
		cls.key_dest = key_console;
		CL_Quit_f ();
		break;

	default:
		break;
	}

	return NULL;

}
Exemplo n.º 6
0
/**
 * \brief Handle menu navigation
 */
const char *Default_MenuKey( menuframework_s *m, int key )
{
	const char *sound = NULL;
	menucommon_s *item;

	if( m )
	{
		if( ( item = Menu_ItemAtCursor( m ) ) != 0 )
		{
			if ( item->type == MTYPE_FIELD )
			{
				if ( Field_Key( ( menufield_s * ) item, key ) )
				{
					return NULL;
				}
			}
		}
	}

	switch( key )
	{
		case K_ESCAPE:
			M_PopMenu();
			return menu_out_sound;

		case K_KP_UPARROW:
		case K_UPARROW:
			if ( m )
			{
				m->cursor--;
				Menu_AdjustCursor( m, -1 );
				sound = menu_move_sound;
			}
			break;
		case K_TAB:
			if ( m )
			{
				m->cursor++;
				Menu_AdjustCursor( m, 1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_DOWNARROW:
		case K_DOWNARROW:
			if ( m )
			{
				m->cursor++;
				Menu_AdjustCursor( m, 1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_LEFTARROW:
		case K_LEFTARROW:
			if ( m )
			{
				Menu_SlideItem( m, -1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_RIGHTARROW:
		case K_RIGHTARROW:
			if ( m )
			{
				Menu_SlideItem( m, 1 );
				sound = menu_move_sound;
			}
			break;

		case K_MOUSE1:
		case K_MOUSE2:
		case K_MOUSE3:
		case K_JOY1:
		case K_JOY2:
		case K_JOY3:
		case K_JOY4:
		case K_AUX1:
		case K_AUX2:
		case K_AUX3:
		case K_AUX4:
		case K_AUX5:
		case K_AUX6:
		case K_AUX7:
		case K_AUX8:
		case K_AUX9:
		case K_AUX10:
		case K_AUX11:
		case K_AUX12:
		case K_AUX13:
		case K_AUX14:
		case K_AUX15:
		case K_AUX16:
			
		case K_KP_ENTER:
		case K_ENTER:
			if( m )
			{
				Menu_SelectItem( m );
			}
			sound = menu_move_sound;
			break;
	}

	return sound;
}
Exemplo n.º 7
0
static void CancelChanges( void *unused )
{
	extern void M_PopMenu( void );

	M_PopMenu();
}
Exemplo n.º 8
0
const char *Default_MenuKey( menuframework_s *m, int key )
{
	const char *sound = NULL;
	menucommon_t *item = NULL;

	if( m )
	{
		item = Menu_ItemAtCursor( m );
		if( item != NULL )
		{
			if( item->type == MTYPE_FIELD )
			{
				if( Field_Key( item, key ) )
					return NULL;
			}
		}
	}

	switch( key )
	{
	case 70: //F  for adding to favorites
	case 102: //f
		if( m && ( item->type == MTYPE_ACTION ) )
			M_AddToFavorites( item );
		break;
	case 82: //R  for removing favorites
	case 114: //r
		if( m && ( item->type == MTYPE_ACTION ) )
			M_RemoveFromFavorites( item );
		break;
	case K_ESCAPE:
		M_PopMenu();
		return menu_out_sound;

	case K_MOUSE1:
		if( !Menu_SlideItem( m, 1, key ) )
			Menu_SelectItem( m );
		sound = menu_move_sound;
		break;

	case K_MOUSE2:
		if( m && ( m_cursoritem == item ) && Menu_SlideItem( m, -1, key ) )
			sound = menu_move_sound;
		else
		{
			M_PopMenu();
			sound = menu_out_sound;

		}
		break;

	case K_MWHEELUP:
		if( Menu_ItemAtCursor( m )->scrollbar_id )  //sliding a scrollbar moves 3 lines
			Menu_SlideItem( m, -3, key ); //scrolling up is the equivalent of sliding left, therefore inverted.
		else if( Menu_ItemAtCursor( m )->type == MTYPE_SPINCONTROL || Menu_ItemAtCursor( m )->type == MTYPE_SLIDER )  //sliding a spincontrol moves 1 item
			Menu_SlideItem( m, 1, key );
		break;
	case KP_UPARROW:
	case K_UPARROW:
		if( m )
		{
			menucommon_t *item = Menu_ItemAtCursor( m );
			menucommon_t *scroll = m->items[item->scrollbar_id];
			if( item->scrollbar_id && item->type == MTYPE_ACTION && item->localdata[0] == 0 && scroll->curvalue > 0 )
				Menu_SlideItem( m, -1, key );
			else
				m->cursor--;
			Menu_AdjustCursor( m, -1 );
			sound = menu_move_sound;
		}
		break;
	case K_TAB:
		if( m )
		{
			if( Menu_ItemAtCursor( m )->scrollbar_id && Menu_ItemAtCursor( m )->type == MTYPE_ACTION )
			{
				int i = Menu_ItemAtCursor( m )->scrollbar_id;
				while( i <= MAXMENUITEMS )
				{
					if( !m->items[i]->scrollbar_id )
					{
						m->cursor = i;
						break;
					}
					i++;
				}
			}
			else
				m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;

	case K_MWHEELDOWN:
		if( Menu_ItemAtCursor( m )->scrollbar_id )  //sliding a scrollbar moves 3 lines
			Menu_SlideItem( m, 3, key ); //scrolling down is the equivalent of sliding right, therefore inverted.
		else if( Menu_ItemAtCursor( m )->type == MTYPE_SPINCONTROL || Menu_ItemAtCursor( m )->type == MTYPE_SLIDER )  //sliding a spincontrol moves 1 item
			Menu_SlideItem( m, -1, key );
		break;
	case KP_DOWNARROW:
	case K_DOWNARROW:
		if( m )
		{
			menucommon_t *item = Menu_ItemAtCursor( m );
			menucommon_t *scroll = m->items[item->scrollbar_id];
			if( item->scrollbar_id && item->type == MTYPE_ACTION && m->items[m->cursor + 1]->scrollbar_id != item->scrollbar_id && scroll->curvalue < scroll->maxvalue )
				Menu_SlideItem( m, 1, key );
			else
				m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;
	case KP_LEFTARROW:
	case K_LEFTARROW:
		if( m )
		{
			Menu_SlideItem( m, -1, key );
			sound = menu_move_sound;
		}
		break;
	case KP_RIGHTARROW:
	case K_RIGHTARROW:
		if( m )
		{
			Menu_SlideItem( m, 1, key );
			sound = menu_move_sound;
		}
		break;

	case K_MOUSE3:
	case K_JOY1:
	case K_JOY2:
	case K_JOY3:
	case K_JOY4:
	case K_AUX1:
	case K_AUX2:
	case K_AUX3:
	case K_AUX4:
	case K_AUX5:
	case K_AUX6:
	case K_AUX7:
	case K_AUX8:
	case K_AUX9:
	case K_AUX10:
	case K_AUX11:
	case K_AUX12:
	case K_AUX13:
	case K_AUX14:
	case K_AUX15:
	case K_AUX16:
	case K_AUX17:
	case K_AUX18:
	case K_AUX19:
	case K_AUX20:
	case K_AUX21:
	case K_AUX22:
	case K_AUX23:
	case K_AUX24:
	case K_AUX25:
	case K_AUX26:
	case K_AUX27:
	case K_AUX28:
	case K_AUX29:
	case K_AUX30:
	case K_AUX31:
	case K_AUX32:

	case KP_ENTER:
	case K_ENTER:
		if( m )
			Menu_SelectItem( m );
		sound = menu_move_sound;
		break;

	case K_MOUSE1DBLCLK:
		if (m)
		{
			menucommon_t *item;
			Menu_SelectItem( m );
			item = Menu_ItemAtCursor( m );
			if (item && item->callback_doubleclick)
				item->callback_doubleclick(item);
		}
		sound = menu_move_sound;
		break;
	}

	return sound;
}
Exemplo n.º 9
0
void M_genericBackFunc( struct menucommon_s *menuitem )
{
	M_PopMenu();
}
Exemplo n.º 10
0
// a safe way to pop a menu from command line
static void Cmd_PopMenu_f( void )
{
	if( m_menudepth >= 1 )
		M_PopMenu();
}
Exemplo n.º 11
0
const char *Default_MenuKey( menuframework_s *m, int key )
{
	const char *sound = NULL;
	menucommon_s *item = NULL;
	int index;

	if ( m )
	{
		if (key == K_MOUSE1) {
			index = Menu_ClickHit(m, m_mouse[0], m_mouse[1]);
			if( index != -1 && m_active->cursor != index) {
				m_active->cursor = index;
			}
		}

		if ( ( item = Menu_ItemAtCursor( m ) ) != 0 )
		{
			if ( item->type == MTYPE_FIELD )
			{
				if ( Field_Key( ( menufield_s * ) item, key ) )
					return NULL;
			}
			else if ( item->type == MTYPE_LIST )
			{
				if ( List_Key( ( menulist_s * ) item, key ) )
					return NULL;
			}
		}
	}

	// Little hack
	if( item && (item->type == MTYPE_SLIDER || item->type == MTYPE_SPINCONTROL) ) {
		if( key == K_MOUSE1 ) {
			key = K_RIGHTARROW;
		} else if( key == K_MOUSE2 ) {
			key = K_LEFTARROW;
		}
	}

	switch ( key )
	{
	case K_MOUSE2:
	case K_ESCAPE:
		M_PopMenu();
		return menu_out_sound;
	case K_KP_UPARROW:
	case K_UPARROW:
		if ( m )
		{
			m->cursor--;
			Menu_AdjustCursor( m, -1 );
			sound = menu_move_sound;
		}
		break;
	case K_TAB:
		if ( m )
		{
			m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_DOWNARROW:
	case K_DOWNARROW:
		if ( m )
		{
			m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_LEFTARROW:
	case K_LEFTARROW:
		if ( m )
		{
			Menu_SlideItem( m, -1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_RIGHTARROW:
	case K_RIGHTARROW:
		if ( m )
		{
			Menu_SlideItem( m, 1 );
			sound = menu_move_sound;
		}
		break;

	case K_MOUSE1:
	//case K_MOUSE2:
	case K_MOUSE3:
#ifdef JOYSTICK
	case K_JOY1:
	case K_JOY2:
	case K_JOY3:
	case K_JOY4:
	case K_AUX1:
	case K_AUX2:
	case K_AUX3:
	case K_AUX4:
	case K_AUX5:
	case K_AUX6:
	case K_AUX7:
	case K_AUX8:
	case K_AUX9:
	case K_AUX10:
	case K_AUX11:
	case K_AUX12:
	case K_AUX13:
	case K_AUX14:
	case K_AUX15:
	case K_AUX16:
	case K_AUX17:
	case K_AUX18:
	case K_AUX19:
	case K_AUX20:
	case K_AUX21:
	case K_AUX22:
	case K_AUX23:
	case K_AUX24:
	case K_AUX25:
	case K_AUX26:
	case K_AUX27:
	case K_AUX28:
	case K_AUX29:
	case K_AUX30:
	case K_AUX31:
	case K_AUX32:
#endif
		
	case K_KP_ENTER:
	case K_ENTER:
		if ( m )
			Menu_SelectItem( m );
		sound = menu_move_sound;
		break;
	}

	return sound;
}
Exemplo n.º 12
0
const char *VID_MenuKey( int k)
{
	M_PopMenu();

	return NULL;
}