Beispiel #1
0
/*
=================
UI_TeamOrdersMenu_Key
=================
*/
sfxHandle_t UI_TeamOrdersMenu_Key( int key ) {
	menulist_s	*l;
	int	x;
	int	y;
	int	index;

	l = (menulist_s	*)Menu_ItemAtCursor( &teamOrdersMenuInfo.menu );
	if( l != &teamOrdersMenuInfo.list ) {
		return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
	}

	switch( key ) {
		case K_MOUSE1:
			x = l->generic.left;
			y = l->generic.top;
			if( UI_CursorInRect( x, y, l->generic.right - x, l->generic.bottom - y ) ) {
				index = (uis.cursory - y) / PROP_HEIGHT;
				l->oldvalue = l->curvalue;
				l->curvalue = index;

				if( l->generic.callback ) {
					l->generic.callback( l, QM_ACTIVATED );
					return menu_move_sound;
				}
			}
			return menu_null_sound;

		case K_KP_UPARROW:
		case K_UPARROW:
			l->oldvalue = l->curvalue;

			if( l->curvalue == 0 ) {
				l->curvalue = l->numitems - 1;
			}
			else {
				l->curvalue--;
			}
			return menu_move_sound;

		case K_KP_DOWNARROW:
		case K_DOWNARROW:
			l->oldvalue = l->curvalue;

			if( l->curvalue == l->numitems - 1 ) {
				l->curvalue = 0;;
			}
			else {
				l->curvalue++;
			}
			return menu_move_sound;
	}

	return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
}
/*
=================
UI_HelpMenu_Key
=================
*/
static sfxHandle_t UI_HelpMenu_Key( int key ) {
	switch( key ) {
		case K_KP_LEFTARROW:
		case K_LEFTARROW:
			UI_HelpMenu_Event( &helpMenuInfo.prev, QM_ACTIVATED );
			break;

		case K_KP_RIGHTARROW:
		case K_RIGHTARROW:
			UI_HelpMenu_Event( &helpMenuInfo.next, QM_ACTIVATED );
			break;

		// TODO: Close menu with second keypress. How to get original key (from "ui_help x" bind(s))?
		//       Key_GetKey seems to be in cgame only
		// FIXME: Hardcoded like in ui_music until there's a better approach
		case 'g':
		case 'h':
			UI_PopMenu();
			return 0;
		
		default:
			break;
	}

	return Menu_DefaultKey( &helpMenuInfo.menu, key );
}
Beispiel #3
0
/*
=================
UI_DemosMenu_Key
=================
*/
static sfxHandle_t UI_DemosMenu_Key( int key ) {
	menucommon_s	*item;

	item = Menu_ItemAtCursor( &s_demos.menu );

	return Menu_DefaultKey( &s_demos.menu, key );
}
Beispiel #4
0
/*
=================
ArenaServers_MenuKey
=================
*/
static sfxHandle_t ArenaServers_MenuKey( int key ) {
	if( key == K_SPACE  && serverStatus.refreshActive ) {
		ArenaServers_StopRefresh();	
		return menu_move_sound;
	}

	if( ( key == K_DEL || key == K_KP_DEL ) && ( g_servertype == AS_FAVORITES ) &&
		( Menu_ItemAtCursor( &g_arenaservers.menu) == &g_arenaservers.list ) ) {
		ArenaServers_AddRemoveFavorite();
		return menu_move_sound;
	}

/*	if( ( key == 70 ) && ( g_servertype != AS_FAVORITES ) &&
		( Menu_ItemAtCursor( &g_arenaservers.menu) == &g_arenaservers.list ) ) {
		ArenaServers_AddRemoveFavorite();
		return menu_move_sound;
	}*/

	if( key == K_MOUSE2 || key == K_ESCAPE ) {
		ArenaServers_StopRefresh();
//		ArenaServers_SaveChanges();
	}


	return Menu_DefaultKey( &g_arenaservers.menu, key );
}
Beispiel #5
0
/*
=================
ArenaServers_MenuKey
=================
*/
static sfxHandle_t ArenaServers_MenuKey( int key ) {
	if( key == K_SPACE  && g_arenaservers.refreshservers ) {
		ArenaServers_StopRefresh();	
		return menu_move_sound;
	}

	if( ( key == K_DEL || key == K_KP_DEL ) && ( g_servertype == UIAS_FAVORITES ) &&
		( Menu_ItemAtCursor( &g_arenaservers.menu) == &g_arenaservers.list ) ) {
		ArenaServers_Remove();
		ArenaServers_UpdateMenu();
		return menu_move_sound;
	}

	if( key == K_MOUSE2 || key == K_ESCAPE ) {
		ArenaServers_StopRefresh();
		ArenaServers_SaveChanges();
	}
        
        if( key == K_MWHEELUP ) {
            ScrollList_Key( &g_arenaservers.list, K_UPARROW );
        }
        
        if( key == K_MWHEELDOWN ) {
            ScrollList_Key( &g_arenaservers.list, K_DOWNARROW );
        }


	return Menu_DefaultKey( &g_arenaservers.menu, key );
}
/*
=================
UI_SPPostgameMenu_MenuKey
=================
*/
static sfxHandle_t UI_SPPostgameMenu_MenuKey( int key ) {
    if ( uis.realtime < postgameMenuInfo.ignoreKeysTime ) {
        return 0;
    }

    if( postgameMenuInfo.phase == 1 ) {
        trap_Cmd_ExecuteText( EXEC_APPEND, "abort_podium\n" );
        postgameMenuInfo.phase = 2;
        postgameMenuInfo.starttime = uis.realtime;
        postgameMenuInfo.ignoreKeysTime	= uis.realtime + 250;
        return 0;
    }

    if( postgameMenuInfo.phase == 2 ) {
        postgameMenuInfo.phase = 3;
        postgameMenuInfo.starttime = uis.realtime;
        postgameMenuInfo.ignoreKeysTime	= uis.realtime + 250;
        return 0;
    }

    if( key == K_ESCAPE || key == K_MOUSE2 ) {
        return 0;
    }

    return Menu_DefaultKey( &postgameMenuInfo.menu, key );
}
static sfxHandle_t MediaView_MenuKey( int key ) {

	if( key == K_MOUSE2 || key == K_ESCAPE ) {
		MediaView_OnClose();
	}

	return Menu_DefaultKey( &s_mediaview_menu.menu, key );
}
Beispiel #8
0
/*
 * UI_SPSkillMenu_Key
 */
static Handle
UI_SPSkillMenu_Key(int key)
{
	if(key == K_MOUSE2 || key == K_ESCAPE)
		trap_sndstartlocalsound(skillMenuInfo.silenceSound,
			CHAN_ANNOUNCER);
	return Menu_DefaultKey(&skillMenuInfo.menu, key);
}
Beispiel #9
0
/*
=================
UI_SPSkillMenu_Key
=================
*/
static sfxHandle_t UI_SPSkillMenu_Key(int key)
{
	if (key == K_MOUSE2 || key == K_ESCAPE)
	{
		trap_S_StartLocalSound(skillMenuInfo.silenceSound, CHAN_ANNOUNCER);
	}
	return Menu_DefaultKey(&skillMenuInfo.menu, key);
}
Beispiel #10
0
/*
=================
PlayerModel_MenuKey
=================
*/
static sfxHandle_t PlayerModel_MenuKey(int key) {
	menucommon_s*	m;
	int				picnum;

	switch (key) {
		case K_KP_LEFTARROW:
		case K_LEFTARROW:
			m = Menu_ItemAtCursor(&s_playermodel.menu);
			picnum = m->id - ID_PLAYERPIC0;
			if (picnum >= 0 && picnum <= 15) {
				if (picnum > 0) {
					Menu_SetCursor(&s_playermodel.menu, s_playermodel.menu.cursor - 1);
					return (menu_move_sound);

				} else if (s_playermodel.modelpage > 0) {
					s_playermodel.modelpage--;
					Menu_SetCursor(&s_playermodel.menu, s_playermodel.menu.cursor + 15);
					PlayerModel_UpdateGrid();
					return (menu_move_sound);
				} else
					return (menu_buzz_sound);
			}
			break;

		case K_KP_RIGHTARROW:
		case K_RIGHTARROW:
			m = Menu_ItemAtCursor(&s_playermodel.menu);
			picnum = m->id - ID_PLAYERPIC0;
			if (picnum >= 0 && picnum <= 15) {
				if ((picnum < 15) && (s_playermodel.modelpage*MAX_MODELSPERPAGE + picnum + 1 < s_playermodel.nummodels)) {
					Menu_SetCursor(&s_playermodel.menu, s_playermodel.menu.cursor + 1);
					return (menu_move_sound);
				} else if ((picnum == 15) && (s_playermodel.modelpage < s_playermodel.numpages - 1)) {
					s_playermodel.modelpage++;
					Menu_SetCursor(&s_playermodel.menu, s_playermodel.menu.cursor - 15);
					PlayerModel_UpdateGrid();
					return (menu_move_sound);
				} else
					return (menu_buzz_sound);
			}
			break;

		case K_MOUSE2:
			trap_Cvar_Set("headmodel", s_playermodel.modelskin);
			trap_Cvar_Set("team_headmodel", s_playermodel.modelskin);
			PlayerModel_SaveChanges();
			PlayerModel_UpdateModel();
			return (menu_buzz_sound);

		case K_ESCAPE:
			PlayerModel_SaveChanges();
			break;
	}

	return (Menu_DefaultKey(&s_playermodel.menu, key));
}
Beispiel #11
0
/*
=================
UI_ModsMenu_Key
=================
*/
static sfxHandle_t UI_ModsMenu_Key( int key ) {
	if( key == K_MWHEELUP ) {
		ScrollList_Key( &s_mods.list, K_UPARROW );
	}

	if( key == K_MWHEELDOWN ) {
		ScrollList_Key( &s_mods.list, K_DOWNARROW );
	}
	return Menu_DefaultKey( &s_mods.menu, key );
}
Beispiel #12
0
/*
=================
UI_DemosMenu_Key
=================
*/
static sfxHandle_t UI_DemosMenu_Key (int key)
{
	//menucommon_s	*item;

	//Com_Printf("ui demo menu key: %d  (curvalue %d, oldvalue %d)  m->nitems %d\n", key, s_demos.list.curvalue, s_demos.list.oldvalue, s_demos.menu.nitems);
	if (key == K_ENTER  ||  key == K_KP_ENTER) {
		Demos_PlayDemoOrChangeDir();
	}
	//item = Menu_ItemAtCursor( &s_demos.menu );

	return Menu_DefaultKey( &s_demos.menu, key );
}
Beispiel #13
0
/*
=================
UI_SPPostgameMenu_MenuKey
=================
*/
static sfxHandle_t UI_SPPostgameMenu_MenuKey( int key ) {
	if ( uis.realtime < postgameMenuInfo.ignoreKeysTime ) {
		return 0;
	}

	postgameMenuInfo.starttime = uis.realtime;
	postgameMenuInfo.ignoreKeysTime	= uis.realtime + 250;

	// NO ESCAPE FOR YOU!!!
	if( key == K_ESCAPE || key == K_MOUSE2 ) {
		return 0;
	}

	return Menu_DefaultKey( &postgameMenuInfo.menu, key );
}
/*
=================
ServerInfo_MenuKey
=================
*/
static sfxHandle_t ServerInfo_MenuKey( int key )
{
	switch ( key ) {
	case K_MWHEELUP:
	case K_PGUP:
		ServerInfo_Event( &s_serverinfo.arrowup, QM_ACTIVATED );
		break;
	case K_MWHEELDOWN:
	case K_PGDN:
		ServerInfo_Event( &s_serverinfo.arrowdown, QM_ACTIVATED );
		break;
	}

	return ( Menu_DefaultKey( &s_serverinfo.menu, key ) );
}
/*
=================
StartServer_ItemPage_Old_MenuKey
=================
*/
static sfxHandle_t StartServer_ItemPage_Old_MenuKey( int key )
{
	switch (key)
	{
		case K_MOUSE2:
		case K_ESCAPE:
			if (!s_itemcontrols_old.ingame_menu) {
				StartServer_ItemPage_Old_Save();
				UI_PopMenu();
				UI_PopMenu();
			}
			break;
	}

	return ( Menu_DefaultKey( &s_itemcontrols_old.menu, key ) );
}
Beispiel #16
0
/*
=================
Reset_MenuKey
=================
*/
static sfxHandle_t Reset_MenuKey( int key ) {
	switch ( key ) {
	case K_LEFTARROW:
	case K_RIGHTARROW:
		key = K_TAB;
		break;

	case 'n':
	case 'N':
		Reset_MenuEvent( &s_reset.no, QM_ACTIVATED );
		break;

	case 'y':
	case 'Y':
		Reset_MenuEvent( &s_reset.yes, QM_ACTIVATED );
		break;
	}

	return Menu_DefaultKey( &s_reset.menu, key );
}
Beispiel #17
0
/*
=================
ConfirmMenu_Key
=================
*/
static sfxHandle_t ConfirmMenu_Key( int key ) {
	switch ( key ) {
	case K_KP_LEFTARROW:
	case K_LEFTARROW:
	case K_KP_RIGHTARROW:
	case K_RIGHTARROW:
		key = K_TAB;
		break;

	case 'n':
	case 'N':
		ConfirmMenu_Event( &s_confirm.no, QM_ACTIVATED );
		break;

	case 'y':
	case 'Y':
		ConfirmMenu_Event( &s_confirm.yes, QM_ACTIVATED );
		break;
	}

	return Menu_DefaultKey( &s_confirm.menu, key );
}
Beispiel #18
0
/*
=================
Preferences_MenuKey
=================
*/
static sfxHandle_t Preferences_MenuKey( int key )
{
	return Menu_DefaultKey( &s_gameoptions_menu, key );
}
Beispiel #19
0
/*
=================
M_CDKey_MenuKey
=================
*/
static sfxHandle_t M_CDKey_MenuKey( int key )
{
	return Menu_DefaultKey( &s_cdkey_menu, key );
}
Beispiel #20
0
/*
=================
MotdMenu_Key
=================
*/
sfxHandle_t MotdMenu_Key( int key )
{
    return ( Menu_DefaultKey( &s_motdstuff.menu, key ) );
}
Beispiel #21
0
/*
=================
TurboliftMenu_Key
=================
*/
sfxHandle_t TurboliftMenu_Key (int key)
{
	return ( Menu_DefaultKey( &s_turbolift.menu, key ) );
}
Beispiel #22
0
/*
=================
UI_DemosMenu_Key
=================
*/
static sfxHandle_t UI_DemosMenu_Key( int key ) 
{
	return Menu_DefaultKey( &s_demos.menu, key );
}
/*
=================
Controls_MenuKey
=================
*/
static sfxHandle_t Controls_MenuKey( int key )
{
	int			id;
	int			i;
	qboolean	found;
	bind_t*		bindptr;
	found = qfalse;

	if (!s_controls.waitingforkey)
	{
		switch (key)
		{
			case K_BACKSPACE:
			case K_DEL:
			case K_KP_DEL:
				key = -1;
				break;
		
			case K_MOUSE2:
			case K_ESCAPE:
				if (s_controls.changesmade)
					Controls_SetConfig();
				goto ignorekey;	

			default:
				goto ignorekey;
		}
	}
	else
	{
		if (key & K_CHAR_FLAG)
			goto ignorekey;

		switch (key)
		{
			case K_ESCAPE:
				s_controls.waitingforkey = qfalse;
				Controls_Update();
				return menu_null_sound;
	
			case '`':
				goto ignorekey;
		}
	}

	s_controls.changesmade = qtrue;
	
	if (key != -1)
	{
		// remove from any other bind
		bindptr = g_bindings;
		for (i=0; ;i++,bindptr++)
		{
			if (!bindptr->label)	
				break;

			if (bindptr->bind2 == key)
				bindptr->bind2 = -1;

			if (bindptr->bind1 == key)
			{
				bindptr->bind1 = bindptr->bind2;	
				bindptr->bind2 = -1;
			}
		}
	}

	// assign key to local store
	id      = ((menucommon_s*)(s_controls.menu.items[s_controls.menu.cursor]))->id;
	bindptr = g_bindings;
	for (i=0; ;i++,bindptr++)
	{
		if (!bindptr->label)	
			break;
		
		if (bindptr->id == id)
		{
			found = qtrue;
			if (key == -1)
			{
				if( bindptr->bind1 != -1 ) {
					trap_Key_SetBinding( bindptr->bind1, "" );
					bindptr->bind1 = -1;
				}
				if( bindptr->bind2 != -1 ) {
					trap_Key_SetBinding( bindptr->bind2, "" );
					bindptr->bind2 = -1;
				}
			}
			else if (bindptr->bind1 == -1) {
				bindptr->bind1 = key;
			}
			else if (bindptr->bind1 != key && bindptr->bind2 == -1) {
				bindptr->bind2 = key;
			}
			else
			{
				trap_Key_SetBinding( bindptr->bind1, "" );
				trap_Key_SetBinding( bindptr->bind2, "" );
				bindptr->bind1 = key;
				bindptr->bind2 = -1;
			}						
			break;
		}
	}				
		
	s_controls.waitingforkey = qfalse;

	if (found)
	{	
		Controls_Update();
		return menu_null_sound;
	}

ignorekey:
	return Menu_DefaultKey( &s_controls.menu, key );
}
static sfxHandle_t UI_checkMenuExitKeys( int key ) {
	if( key == K_MOUSE2 || key == K_ESCAPE ) {
		UI_StopMusic(); // -> durch refresh sollte automatisch wieder der normale starten
	}
	return Menu_DefaultKey( uis.activemenu , key );
}
Beispiel #25
0
/*
=================
ServerInfo_MenuKey
=================
*/
static sfxHandle_t ServerInfo_MenuKey( int key )
{
	return ( Menu_DefaultKey( &s_serverinfo.menu, key ) );
}
Beispiel #26
0
/*
=================
sqlMenu_Key
=================
*/
sfxHandle_t sqlMenu_Key (int key)
{
	return ( Menu_DefaultKey( &s_sql.menu, key ) );
}
Beispiel #27
0
/*
=================
PlayerSettings_MenuKey
=================
*/
static sfxHandle_t PlayerSettings_MenuKey(int key) {
    if (key == K_MOUSE2 || key == K_ESCAPE) {
        PlayerSettings_SaveChanges();
    }
    return Menu_DefaultKey(&s_playersettings.menu, key);
}
Beispiel #28
0
/*
=================
M_Sound_MenuKey
=================
*/
static sfxHandle_t M_Sound_MenuKey( int key )
{
	return Menu_DefaultKey( &soundOptionsInfo.menu, key );
}