/*
========================
idMenuHandler::StartWidgetActionRepeater
========================
*/
void idMenuHandler::StartWidgetActionRepeater( idMenuWidget* widget, const idWidgetAction& action, const idWidgetEvent& event )
{
	if( actionRepeater.isActive && actionRepeater.action == action )
	{
		return;	// don't attempt to reactivate an already active repeater
	}
	
	actionRepeater.isActive = true;
	actionRepeater.action = action;
	actionRepeater.widget = widget;
	actionRepeater.event = event;
	actionRepeater.numRepetitions = 0;
	actionRepeater.nextRepeatTime = 0;
	actionRepeater.screenIndex = activeScreen;	// repeaters are cleared between screens
	
	if( action.GetParms().Num() == 2 )
	{
		actionRepeater.repeatDelay = action.GetParms()[ 1 ].ToInteger();
	}
	else
	{
		actionRepeater.repeatDelay = DEFAULT_REPEAT_TIME;
	}
	
	// do the first event immediately
	PumpWidgetActionRepeater();
}
/*
========================
idMenuScreen_Shell_ModeSelect::HandleAction h
========================
*/
bool idMenuScreen_Shell_ModeSelect::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_MODE_SELECT ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_PARTY_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( options == NULL ) {
				return true;
			}
			int selectionIndex = options->GetViewIndex();
			if ( parms.Num() == 1 ) {
				selectionIndex = parms[0].ToInteger();
			}	

			if ( options->GetFocusIndex() != selectionIndex ) {
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}

			idMatchParameters matchParameters = idMatchParameters( session->GetPartyLobbyBase().GetMatchParms() );
			matchParameters.gameMap = GAME_MAP_RANDOM;
			matchParameters.gameMode = selectionIndex;

			// Always a public match.
			matchParameters.matchFlags &= ~MATCH_INVITE_ONLY;

			session->UpdatePartyParms( matchParameters );

			// Update flags for game lobby.
			matchParameters.matchFlags = DefaultPartyFlags | DefaultPublicGameFlags;
			
			cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO, matchParameters.serverInfo );

			// Force a default value for the si_timelimit and si_fraglimit for quickmatch
			matchParameters.serverInfo.SetInt( "si_timelimit", 15 );
			matchParameters.serverInfo.SetInt( "si_fraglimit", 10 );

			session->FindOrCreateMatch( matchParameters );

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_GameBrowser::HandleAction h
========================
*/
bool idMenuScreen_Shell_GameBrowser::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandle ) {
	idMenuHandler_Shell * const mgr = dynamic_cast< idMenuHandler_Shell * >( menuData );

	if ( mgr == NULL ) {
		return false;
	}

	if ( mgr->ActiveScreen() != SHELL_AREA_BROWSER ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_PARTY_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_COMMAND: {
			switch ( parms[ 0 ].ToInteger() ) {
				case BROWSER_COMMAND_REFRESH_SERVERS: {
					UpdateServerList();
					break;
				}
				case BROWSER_COMMAND_SHOW_GAMERTAG: {
					int index = listWidget->GetServerIndex();
					if ( index != -1 ) {
						session->ShowServerGamerCardUI( index );
					}
					break;
				}
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			int selectionIndex = listWidget->GetFocusIndex();
			if ( parms.Num() > 0 ) {
				selectionIndex = parms[0].ToInteger();
			}

			if ( selectionIndex != listWidget->GetFocusIndex() ) {
				listWidget->SetViewIndex( listWidget->GetViewOffset() + selectionIndex );
				listWidget->SetFocusIndex( selectionIndex );
				return true;
			}

			int index = listWidget->GetServerIndex();
			if ( index != -1 ) {
				session->ConnectToServer( index );
			}
			return true;
		}
	}

	return idMenuScreen::HandleAction( action, event, widget, forceHandle );
}
/*
========================
idMenuScreen_Shell_Playstation::HandleAction h
========================
*/
bool idMenuScreen_Shell_Playstation::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_PLAYSTATION )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( options->GetFocusIndex() != selectionIndex )
			{
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}
			
			if( selectionIndex == 0 )
			{
			
			
			}
			else if( selectionIndex == 1 )
			{
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 5
0
/*
================================================
idMenuHandler::Update
================================================
*/
bool idMenuHandler::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_ADJUST_FIELD: {
			if ( widget != NULL && widget->GetDataSource() != NULL ) {
				widget->GetDataSource()->AdjustField( widget->GetDataSourceFieldIndex(), parms[ 0 ].ToInteger() );
				widget->Update();
			}
			return true;
		}
		case WIDGET_ACTION_FUNCTION: {
			if ( verify( action.GetScriptFunction() != NULL ) ) {
				action.GetScriptFunction()->Call( event.thisObject, event.parms );
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			idMenuScreen * const screen = menuScreens[ activeScreen ];
			if ( screen != NULL ) {
				idWidgetEvent pressEvent( WIDGET_EVENT_PRESS, 0, event.thisObject, idSWFParmList() );
				screen->ReceiveEvent( pressEvent );
			}
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() >= 2 );
			int repeatDelay = DEFAULT_REPEAT_TIME;
			if ( parms.Num() >= 3 ) {
				repeatDelay = parms[2].ToInteger();
			} 
			repeatAction.Set( repeatActionType, parms[ 1 ], repeatDelay );
			StartWidgetActionRepeater( widget, repeatAction, event );
			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER: {
			ClearWidgetActionRepeater();
			return true;
		}
	}

	if ( !widget->GetHandlerIsParent() ) {
		for ( int index = 0; index < children.Num(); ++index ) {
			if ( children[index] != NULL ) {
				if ( children[index]->HandleAction( action, event, widget, forceHandled ) ) {
					return true;
				}
			}
		}
	}

	return false;
}
/*
========================
idMenuScreen_Shell_Settings::HandleAction h
========================
*/
bool idMenuScreen_Shell_Settings::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_SETTINGS ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_COMMAND: {
			switch ( parms[0].ToInteger() ) {
				case SETTING_CMD_CONTROLS: {
					menuData->SetNextScreen( SHELL_AREA_CONTROLS, MENU_TRANSITION_SIMPLE );
					break;	
				}
				case SETTING_CMD_GAMEPLAY: {
					menuData->SetNextScreen( SHELL_AREA_GAME_OPTIONS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case SETTING_CMD_SYSTEM: {
					menuData->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case SETTING_CMD_3D: {
					menuData->SetNextScreen( SHELL_AREA_STEREOSCOPICS, MENU_TRANSITION_SIMPLE );
					break;
				}
			}

			if ( options != NULL ) {
				int selectionIndex = options->GetViewIndex();
				if ( parms.Num() == 1 ) {
					selectionIndex = parms[0].ToInteger();
				}	

				if ( options->GetFocusIndex() != selectionIndex ) {
					options->SetFocusIndex( selectionIndex );
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				}
			}

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_NewGame::HandleAction h
========================
*/
bool idMenuScreen_Shell_NewGame::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData != NULL )
	{
		if( menuData->ActiveScreen() != SHELL_AREA_NEW_GAME )
		{
			return false;
		}
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			if( menuData != NULL )
			{
				menuData->SetNextScreen( SHELL_AREA_CAMPAIGN, MENU_TRANSITION_SIMPLE );
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			idMenuHandler_Shell* shell = dynamic_cast< idMenuHandler_Shell* >( menuData );
			if( shell != NULL )
			{
				shell->SetNewGameType( selectionIndex );
				menuData->SetNextScreen( SHELL_AREA_DIFFICULTY, MENU_TRANSITION_SIMPLE );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Dev::HandleAction h
========================
*/
bool idMenuScreen_Shell_Dev::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_DEV )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( options->GetFocusIndex() != selectionIndex - options->GetViewOffset() )
			{
				options->SetFocusIndex( selectionIndex );
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
			}
			
			int mapIndex = options->GetViewIndex();
			if( ( mapIndex < devOptions.Num() ) && ( devOptions[ mapIndex ].map != NULL ) )
			{
				cmdSystem->AppendCommandText( va( "devmap %s\n", devOptions[ mapIndex ].map ) );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_PDA_VideoDisks::HandleAction
========================
*/
bool idMenuScreen_PDA_VideoDisks::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != PDA_AREA_VIDEO_DISKS )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() == 2 );
			repeatAction.Set( repeatActionType, parms[ 1 ] );
			if( menuData != NULL )
			{
				menuData->StartWidgetActionRepeater( widget, repeatAction, event );
			}
			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER:
		{
			if( menuData != NULL )
			{
				menuData->ClearWidgetActionRepeater();
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			ToggleVideoDiskPlay();
			Update();
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 10
0
/*
========================
idMenuWidget_InfoBox::ObserveEvent
========================
*/
bool idMenuWidget_InfoBox::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	const idSWFParmList & parms = action.GetParms();

	if ( action.GetType() == WIDGET_ACTION_SCROLL_VERTICAL ) {
		const scrollType_t scrollType = static_cast< scrollType_t >( event.arg );
		if ( scrollType == SCROLL_SINGLE ) {
			Scroll( parms[ 0 ].ToInteger() );
		}
		return true;
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 11
0
/*
========================
idMenuWidget_ScrollBar::HandleAction
========================
*/
bool idMenuWidget_ScrollBar::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	widgetAction_t actionType = action.GetType();

	switch ( actionType ) {
		case WIDGET_ACTION_SCROLL_DRAG: {

			if ( event.parms.Num() != 3 ) {
				return true;
			}

			dragging = true;

			float x = event.parms[0].ToFloat();
			float y = event.parms[1].ToFloat();
			bool initial = event.parms[2].ToBool();
			if ( initial ) {
				CalcTopAndBottom();
			}

			CalculatePosition( x, y );
			return true;
		}
		case WIDGET_ACTION_EVENT_DRAG_STOP: {
			dragging = false;
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Singleplayer::HandleAction
========================
*/
bool idMenuScreen_Shell_Singleplayer::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_CAMPAIGN ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( options == NULL ) {
				return true;
			}

			int selectionIndex = options->GetViewIndex();
			if ( parms.Num() == 1 ) {
				selectionIndex = parms[0].ToInteger();
			}			

			canContinue = false;
			const saveGameDetailsList_t & saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames();
			canContinue = ( saveGameInfo.Num() > 0 );
			if ( canContinue ) {
				if ( selectionIndex == 0 ) {
					ContinueGame();

				} else if ( selectionIndex == 1 ) {
					class idSWFScriptFunction_NewGame : public idSWFScriptFunction_RefCounted {
					public:
						idSWFScriptFunction_NewGame( idMenuHandler * _menuData, bool _accept ) {
							menuData = _menuData;
							accept = _accept;
						}
						idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
							common->Dialog().ClearDialog( GDM_DELETE_AUTOSAVE );
							if ( accept ) {
								menuData->SetNextScreen( SHELL_AREA_NEW_GAME, MENU_TRANSITION_SIMPLE );
							}
							return idSWFScriptVar();
						}
					private:
						idMenuHandler * menuData;
						bool accept;
					};
					common->Dialog().AddDialog( GDM_DELETE_AUTOSAVE, DIALOG_ACCEPT_CANCEL, new idSWFScriptFunction_NewGame( menuData, true ), new idSWFScriptFunction_NewGame( menuData, false ), true );
				} else if ( selectionIndex == 2 ) {
					menuData->SetNextScreen( SHELL_AREA_LOAD, MENU_TRANSITION_SIMPLE );
				}
			} else {
				if ( selectionIndex == 0 ) {
					menuData->SetNextScreen( SHELL_AREA_NEW_GAME, MENU_TRANSITION_SIMPLE );
				} else if ( selectionIndex == 1 ) {
					menuData->SetNextScreen( SHELL_AREA_LOAD, MENU_TRANSITION_SIMPLE );
				}	
			}
			
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Save::HandleAction
========================
*/
bool idMenuScreen_Shell_Save::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_SAVE )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_JOY4_ON_PRESS:
		{
			return true;
		}
		case WIDGET_ACTION_JOY3_ON_PRESS:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			DeleteGame( options->GetViewIndex() );
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			if( session->GetSaveGameManager().IsWorking() )
			{
				return true;
			}
			
			if( parms.Num() == 1 )
			{
				int selectionIndex = parms[0].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
					return true;
				}
			}
			
			SaveGame( options->GetViewIndex() );
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL:
		{
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_PDA_Inventory::HandleAction
========================
*/
bool idMenuScreen_PDA_Inventory::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != PDA_AREA_INVENTORY ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_JOY3_ON_PRESS: {
			EquipWeapon();
			return true;
		}
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() == 2 );
			repeatAction.Set( repeatActionType, parms[ 1 ] );
			menuData->StartWidgetActionRepeater( widget, repeatAction, event );
			return true;
		}
		case WIDGET_ACTION_SELECT_PDA_ITEM: {

			if ( itemList.GetMoveDiff() > 0 ) {
				itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
			}

			int index = parms[0].ToInteger();
			if ( index != 0 ) {
				itemList.MoveToIndex( index );
				Update();
			}

			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER: {
			menuData->ClearWidgetActionRepeater();
			return true;
		}
		case WIDGET_ACTION_SCROLL_HORIZONTAL: {
			
			if ( itemList.GetTotalNumberOfOptions() <= 1 ) {
				return true;
			}

			if ( itemList.GetMoveDiff() > 0 ) {
				itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
			}

			int direction = parms[0].ToInteger();
			if ( direction == 1 ) {					
				if ( itemList.GetViewIndex() == itemList.GetTotalNumberOfOptions() - 1 ) {
					return true;
				} else {
					itemList.MoveToIndex( 1 );
				}
			} else {
				if ( itemList.GetViewIndex() == 0 ) {
					return true;
				} else {
					itemList.MoveToIndex( ( itemList.GetNumVisibleOptions() / 2 ) + 1 );
				}
			}	
			Update();

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_PDA_UserEmails::HandleAction
========================
*/
bool idMenuScreen_PDA_UserEmails::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != PDA_AREA_USER_EMAIL )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_PDA_CLOSE:
		{
			menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			if( readingEmails )
			{
				ShowEmail( false );
			}
			else
			{
				menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
			}
			return true;
		}
		case WIDGET_ACTION_REFRESH:
		{
			UpdateEmail();
			return true;
		}
		case WIDGET_ACTION_PDA_SELECT_EMAIL:
		{
		
			if( widget->GetParent() != NULL )
			{
				idMenuWidget_DynamicList* emailList = dynamic_cast< idMenuWidget_DynamicList* >( widget->GetParent() );
				int index = parms[0].ToInteger();
				if( emailList != NULL )
				{
					emailList->SetViewIndex( emailList->GetViewOffset() + index );
					emailList->SetFocusIndex( index );
				}
			}
			
			ShowEmail( true );
			
			return true;
		}
		case WIDGET_ACTION_EMAIL_HOVER:
		{
			scrollEmailInfo = parms[0].ToBool();
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL:
		{
			if( ScrollCorrectList( action, event, widget ) )
			{
				return true;
			}
			UpdateEmail();
			break;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Leaderboards::HandleAction
========================
*/
bool idMenuScreen_Shell_Leaderboards::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_LEADERBOARDS ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_PARTY_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;									
		}
		case WIDGET_ACTION_JOY3_ON_PRESS: {
			lbCache->CycleFilter();
			refreshLeaderboard = true;
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {

			if ( options == NULL ) {
				return true;
			}

			int index = options->GetFocusIndex();
			if ( parms.Num() != 0 ) {
				index = parms[0].ToInteger();
			}

			if ( lbCache->GetEntryIndex() != index ) {
				lbCache->SetEntryIndex( index );
				refreshLeaderboard = true;
				return true;
			}

			const idLeaderboardCallback::row_t * row = lbCache->GetLeaderboardRow( lbCache->GetRowOffset() + lbCache->GetEntryIndex() );
			if ( row != NULL ) {
				lbCache->DisplayGamerCardUI( row );
			}

			return true;
		}
		case WIDGET_ACTION_SCROLL_TAB: {
			int delta = parms[0].ToInteger();
			lbIndex += delta;
			SetLeaderboardIndex();
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE: {
			if ( parms.Num() == 0 ) {
				return true;
			}

			if ( options == NULL ) {		
				return true;
			}

			int dir = parms[ 0 ].ToInteger();
			if ( lbCache->Scroll( dir ) ) {
				// TODO_SPARTY: play scroll sound
				refreshLeaderboard = true;
			}

			return true;
		}
		case WIDGET_ACTION_SCROLL_PAGE: {
			if ( parms.Num() == 0 ) {
				return true;
			}

			if ( options == NULL ) {		
				return true;
			}

			int dir = parms[ 0 ].ToInteger();
			if ( lbCache->ScrollOffset( dir ) ) {
				refreshLeaderboard = true;
			}

			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_ControllerLayout::HandleAction h
========================
*/
bool idMenuScreen_Shell_ControllerLayout::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_CONTROLLER_LAYOUT ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_GAMEPAD, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( parms.Num() != 1 ) {
				return true;
			}

			if ( options == NULL ) {
				return true;
			}

			int selectionIndex = parms[0].ToInteger();
			if ( selectionIndex != options->GetFocusIndex() ) {
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}						

			layoutData.AdjustField( selectionIndex, 1 );
			options->Update();
			UpdateBindingInfo();
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {

			if ( options == NULL ) {
				return true;
			}

			if ( parms.Num() == 4 ) {
				int selectionIndex = parms[3].ToInteger();
				if ( selectionIndex != options->GetFocusIndex() ) {
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
		case WIDGET_ACTION_ADJUST_FIELD: {
			if ( widget != NULL && widget->GetDataSource() != NULL ) {
				widget->GetDataSource()->AdjustField( widget->GetDataSourceFieldIndex(), parms[ 0 ].ToInteger() );
				widget->Update();
			}
			UpdateBindingInfo();
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_GameLobby::HandleAction h
========================
*/
bool idMenuScreen_Shell_GameLobby::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_GAME_LOBBY )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_JOY4_ON_PRESS:
		{
			idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
			lobbyUserID_t luid;
			if( CanKickSelectedPlayer( luid ) )
			{
				activeLobby.KickLobbyUser( luid );
			}
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			class idSWFScriptFunction_Accept : public idSWFScriptFunction_RefCounted
			{
			public:
				idSWFScriptFunction_Accept() { }
				idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
				{
					common->Dialog().ClearDialog( GDM_LEAVE_LOBBY_RET_NEW_PARTY );
					session->Cancel();
					
					return idSWFScriptVar();
				}
			};
			class idSWFScriptFunction_Cancel : public idSWFScriptFunction_RefCounted
			{
			public:
				idSWFScriptFunction_Cancel() { }
				idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
				{
					common->Dialog().ClearDialog( GDM_LEAVE_LOBBY_RET_NEW_PARTY );
					return idSWFScriptVar();
				}
			};
			
			idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
			
			if( activeLobby.GetNumActiveLobbyUsers() > 1 )
			{
				common->Dialog().AddDialog( GDM_LEAVE_LOBBY_RET_NEW_PARTY, DIALOG_ACCEPT_CANCEL, new( TAG_SWF ) idSWFScriptFunction_Accept(), new( TAG_SWF ) idSWFScriptFunction_Cancel(), false );
			}
			else
			{
				session->Cancel();
			}
			
			return true;
		}
		case WIDGET_ACTION_MUTE_PLAYER:
		{
		
			if( parms.Num() != 1 )
			{
				return true;
			}
			
			int index = parms[0].ToInteger();
			
			idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
			lobbyUserID_t luid = activeLobby.GetLobbyUserIdByOrdinal( index );
			if( luid.IsValid() )
			{
				session->ToggleLobbyUserVoiceMute( luid );
			}
			
			return true;
		}
		case WIDGET_ACTION_COMMAND:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetFocusIndex();
			if( parms.Num() > 1 )
			{
				selectionIndex = parms[1].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			switch( parms[0].ToInteger() )
			{
				case GAME_CMD_START:
				{
					idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* const >( menuData );
					if( handler != NULL )
					{
						handler->SetTimeRemaining( 0 );
					}
					break;
				}
				case GAME_CMD_SETTINGS:
				{
					menuData->SetNextScreen( SHELL_AREA_MATCH_SETTINGS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case GAME_CMD_TOGGLE_PRIVACY:
				{
					idMatchParameters matchParameters = idMatchParameters( session->GetActivePlatformLobbyBase().GetMatchParms() );
					matchParameters.matchFlags ^= MATCH_INVITE_ONLY;
					session->UpdateMatchParms( matchParameters );
					int bitSet = ( matchParameters.matchFlags & MATCH_INVITE_ONLY );
					net_inviteOnly.SetBool( bitSet != 0 ? true : false );
					
					// Must update the party parameters too for Xbox JSIP to work in game lobbies.
					idMatchParameters partyParms = session->GetPartyLobbyBase().GetMatchParms();
					if( MatchTypeInviteOnly( matchParameters.matchFlags ) )
					{
						partyParms.matchFlags |= MATCH_INVITE_ONLY;
					}
					else
					{
						partyParms.matchFlags &= ~MATCH_INVITE_ONLY;
					}
					session->UpdatePartyParms( partyParms );
					
					break;
				}
				case GAME_CMD_INVITE:
				{
					if( session->GetActivePlatformLobbyBase().IsLobbyFull() )
					{
						common->Dialog().AddDialog( GDM_CANNOT_INVITE_LOBBY_FULL, DIALOG_CONTINUE, NULL, NULL, true, __FUNCTION__, __LINE__, false );
						return true;
					}
					
					InvitePartyOrFriends();
					break;
				}
			}
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			if( parms.Num() == 4 )
			{
				int selectionIndex = parms[3].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
		case WIDGET_ACTION_SELECT_GAMERTAG:
		{
			int selectionIndex = lobby->GetFocusIndex();
			if( parms.Num() > 0 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != lobby->GetFocusIndex() )
			{
				lobby->SetViewIndex( lobby->GetViewOffset() + selectionIndex );
				lobby->SetFocusIndex( selectionIndex );
				return true;
			}
			
			idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
			lobbyUserID_t luid = activeLobby.GetLobbyUserIdByOrdinal( selectionIndex );
			if( luid.IsValid() )
			{
				session->ShowLobbyUserGamerCardUI( luid );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Gamepad::HandleAction
========================
*/
bool idMenuScreen_Shell_Gamepad::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_GAMEPAD ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_CONTROLS, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_COMMAND: {

			if ( options == NULL ) {
				return true;
			}

			int selectionIndex = options->GetFocusIndex();
			if ( parms.Num() > 0 ) {
				selectionIndex = parms[0].ToInteger();
			}

			if ( selectionIndex != options->GetFocusIndex() ) {
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}

			switch ( parms[0].ToInteger() ) {
#ifndef ID_PC
				case GAMEPAD_CMD_CONFIG: {
					menuData->SetNextScreen( SHELL_AREA_CONTROLLER_LAYOUT, MENU_TRANSITION_SIMPLE );
					break;
				}
#endif
				case GAMEPAD_CMD_INVERT: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_INVERT, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_LEFTY: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_LEFTY, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_VIBRATE: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VIBRATE, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_HOR_SENS: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_HOR_SENS, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_VERT_SENS: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VERT_SENS, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_ACCELERATION: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_ACCELERATION, 1 );
					options->Update();
					break;
				}
				case GAMEPAD_CMD_THRESHOLD: {
					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_THRESHOLD, 1 );
					options->Update();
					break;
				}
			}

			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {

			if ( options == NULL ) {
				return true;
			}

			if ( parms.Num() == 4 ) {
				int selectionIndex = parms[3].ToInteger();
				if ( selectionIndex != options->GetFocusIndex() ) {
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_PressStart::HandleAction
========================
*/
bool idMenuScreen_Shell_PressStart::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_START )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( itemList == NULL )
			{
				return true;
			}
			
			if( event.parms.Num() != 1 )
			{
				return true;
			}
			
			if( itemList->GetMoveToIndex() != itemList->GetViewIndex() )
			{
				return true;
			}
			
			if( parms.Num() > 0 )
			{
				const int index = parms[0].ToInteger();
				if( index != 0 )
				{
					itemList->MoveToIndex( index );
					Update();
				}
			}
			
			// RB begin
#if defined(USE_DOOMCLASSIC)
			if( itemList->GetMoveToIndex() == 0 )
			{
				common->SwitchToGame( DOOM_CLASSIC );
			}
			else
#endif
				if( itemList->GetMoveToIndex() == 1 )
				{
					if( session->GetSignInManager().GetMasterLocalUser() == NULL )
					{
						const int device = event.parms[ 0 ].ToInteger();
						session->GetSignInManager().RegisterLocalUser( device );
					}
					else
					{
						menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
					}
				}
#if defined(USE_DOOMCLASSIC)
				else if( itemList->GetMoveToIndex() == 2 )
				{
					common->SwitchToGame( DOOM2_CLASSIC );
				}
#endif
			// RB end
			
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
			idWidgetAction repeatAction;
			widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
			assert( parms.Num() == 2 );
			repeatAction.Set( repeatActionType, parms[ 1 ] );
			menuData->StartWidgetActionRepeater( widget, repeatAction, event );
			return true;
		}
		case WIDGET_ACTION_STOP_REPEATER:
		{
			menuData->ClearWidgetActionRepeater();
			return true;
		}
		case WIDGET_ACTION_SCROLL_HORIZONTAL:
		{
		
			if( itemList == NULL )
			{
				return true;
			}
			
			if( itemList->GetTotalNumberOfOptions() <= 1 )
			{
				return true;
			}
			
			idLib::Printf( "scroll \n" );
			
			if( itemList->GetMoveDiff() > 0 )
			{
				itemList->MoveToIndex( itemList->GetMoveToIndex(), true );
			}
			
			int direction = parms[0].ToInteger();
			if( direction == 1 )
			{
				if( itemList->GetViewIndex() == itemList->GetTotalNumberOfOptions() - 1 )
				{
					return true;
				}
				else
				{
					itemList->MoveToIndex( 1 );
				}
			}
			else
			{
				if( itemList->GetViewIndex() == 0 )
				{
					return true;
				}
				else
				{
					itemList->MoveToIndex( ( itemList->GetNumVisibleOptions() / 2 ) + 1 );
				}
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_SystemOptions::HandleAction h
========================
*/
bool idMenuScreen_Shell_SystemOptions::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_SYSTEM_OPTIONS )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			if( menuData != NULL )
			{
				menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
			}
			return true;
		}
		case WIDGET_ACTION_ADJUST_FIELD:
			if( widget->GetDataSourceFieldIndex() == idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN )
			{
				menuData->SetNextScreen( SHELL_AREA_RESOLUTION, MENU_TRANSITION_SIMPLE );
				return true;
			}
			break;
		case WIDGET_ACTION_COMMAND:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetFocusIndex();
			if( parms.Num() > 0 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( options && selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			switch( parms[0].ToInteger() )
			{
				case idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN:
				{
					menuData->SetNextScreen( SHELL_AREA_RESOLUTION, MENU_TRANSITION_SIMPLE );
					return true;
				}
				default:
				{
					systemData.AdjustField( parms[0].ToInteger(), 1 );
					options->Update();
				}
			}
			
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			if( parms.Num() == 4 )
			{
				int selectionIndex = parms[3].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 22
0
/*
========================
idMenuScreen_Scoreboard::HandleAction
========================
*/
bool idMenuScreen_Scoreboard::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SCOREBOARD_AREA_INVALID, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_MUTE_PLAYER:
		{
		
			if( parms.Num() != 1 )
			{
				return true;
			}
			
			idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
			
			if( !data )
			{
				return true;
			}
			int index = parms[0].ToInteger();
			data->MutePlayer( index );
			
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
		
			if( playerList == NULL )
			{
				return true;
			}
			
			int selectionIndex = playerList->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != playerList->GetFocusIndex() )
			{
				playerList->SetViewIndex( playerList->GetViewOffset() + selectionIndex );
				playerList->SetFocusIndex( selectionIndex );
			}
			
			idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
			
			if( !data )
			{
				return true;
			}
			
			int numRed = data->GetNumPlayers( 0 );
			int numBlue = data->GetNumPlayers( 1 );
			
			if( selectionIndex >= 4 && numBlue != 0 )
			{
				int index = numRed + ( selectionIndex - 4 );
				data->ViewPlayerProfile( index );
			}
			else
			{
				data->ViewPlayerProfile( selectionIndex );
			}
			
			
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE:
		{
		
			if( parms.Num() == 0 )
			{
				return true;
			}
			
			if( playerList )
			{
			
				int dir = parms[ 0 ].ToInteger();
				int scroll = 0;
				int curIndex = playerList->GetFocusIndex();
				
				idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
				
				if( !data )
				{
					return true;
				}
				
				int numRed = data->GetNumPlayers( 0 );
				int numBlue = data->GetNumPlayers( 1 );
				
				if( numRed + numBlue <= 1 )
				{
					return true;
				}
				
				if( dir > 0 )
				{
					if( numBlue == 0 )
					{
						if( curIndex + 1 >= numRed )
						{
							scroll = MAX_SCOREBOARD_SLOTS - curIndex;
						}
						else
						{
							scroll = dir;
						}
					}
					else
					{
						if( curIndex < 4 )
						{
							if( curIndex + 1 >= numRed )
							{
								scroll = ( MAX_SCOREBOARD_SLOTS * 0.5f ) - curIndex;
							}
							else
							{
								scroll = dir;
							}
						}
						else
						{
							if( curIndex - 3 >= numBlue )
							{
								scroll = MAX_SCOREBOARD_SLOTS - curIndex;
							}
							else
							{
								scroll = dir;
							}
						}
					}
				}
				else if( dir < 0 )
				{
					if( numBlue == 0 )
					{
						if( curIndex - 1 < 0 )
						{
							scroll = numRed - 1;
						}
						else
						{
							scroll = dir;
						}
					}
					else
					{
						if( curIndex < 4 )
						{
							if( curIndex - 1 < 0 )
							{
								scroll = ( ( MAX_SCOREBOARD_SLOTS * 0.5f ) + numBlue ) - 1;
							}
							else
							{
								scroll = dir;
							}
						}
						else
						{
							if( curIndex - 1 < 4 )
							{
								scroll = -( ( MAX_SCOREBOARD_SLOTS * 0.5f ) - ( numRed - 1 ) );
							}
							else
							{
								scroll = dir;
							}
						}
					}
				}
				
				if( scroll != 0 )
				{
					playerList->Scroll( scroll );
				}
			}
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Resolution::HandleAction h
========================
*/
bool idMenuScreen_Shell_Resolution::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_RESOLUTION ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( options != NULL ) {
				int selectionIndex = options->GetFocusIndex();
				if ( parms.Num() == 1 ) {
					selectionIndex = parms[0].ToInteger();
				}	

				if ( options->GetFocusIndex() != selectionIndex ) {
					options->SetFocusIndex( selectionIndex );
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				}
				const optionData_t & currentOption = optionData[options->GetViewIndex()];

				if ( currentOption == originalOption ) {
					// No change
					menuData->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
				} else if ( currentOption.fullscreen == 0 ) {
					// Changing to windowed mode
					r_fullscreen.SetInteger( 0 );
					cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "vid_restart\n" );
					menuData->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
				} else {
					// Changing to fullscreen mode
					r_fullscreen.SetInteger( currentOption.fullscreen );
					r_vidMode.SetInteger( currentOption.vidmode );
					cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
					cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "vid_restart\n" );

					class idSWFFuncAcceptVideoChanges : public idSWFScriptFunction_RefCounted {
					public:
						idSWFFuncAcceptVideoChanges( idMenuHandler * _menu, gameDialogMessages_t _msg, const optionData_t & _optionData, bool _accept ) {
							menuHandler = _menu;
							msg = _msg;
							optionData = _optionData;
							accept = _accept;
						}
						idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
							common->Dialog().ClearDialog( msg );
							if ( accept ) {
								cvarSystem->SetModifiedFlags( CVAR_ARCHIVE );
								if ( menuHandler != NULL ) {
									menuHandler->SetNextScreen( SHELL_AREA_SYSTEM_OPTIONS, MENU_TRANSITION_SIMPLE );
								}
							} else {
								r_fullscreen.SetInteger( optionData.fullscreen );
								r_vidMode.SetInteger( optionData.vidmode );
								cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
								cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "vid_restart\n" );
							}
							return idSWFScriptVar();
						}
					private:
						idMenuHandler * menuHandler;
						gameDialogMessages_t msg;
						optionData_t optionData;
						bool accept;
					};
					common->Dialog().AddDialog( GDM_CONFIRM_VIDEO_CHANGES, DIALOG_TIMER_ACCEPT_REVERT, new ( TAG_SWF ) idSWFFuncAcceptVideoChanges( menuData, GDM_CONFIRM_VIDEO_CHANGES, currentOption, true ), new ( TAG_SWF ) idSWFFuncAcceptVideoChanges( menuData, GDM_CONFIRM_VIDEO_CHANGES, originalOption, false ), false );
				}
				return true;
			}
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_MatchSettings::HandleAction h
========================
*/
bool idMenuScreen_Shell_MatchSettings::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_MATCH_SETTINGS ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_ADJUST_FIELD: {
			if ( widget != NULL && widget->GetDataSource() != NULL && options != NULL ) {
				widget->GetDataSource()->AdjustField( widget->GetDataSourceFieldIndex(), parms[ 0 ].ToInteger() );
				widget->Update();

				if ( matchData.MapChanged() ) {
					idMenuWidget_ControlButton * button = dynamic_cast< idMenuWidget_ControlButton * >( &options->GetChildByIndex( 1 ) );
					if ( button != NULL ) {
						button->Update();
					}
					matchData.ClearMapChanged();
				}
			}
			return true;
		}
		case WIDGET_ACTION_GO_BACK: {
			menuData->SetNextScreen( SHELL_AREA_GAME_LOBBY, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {

			if ( options == NULL ) {
				return true;
			}

			int selectionIndex = options->GetFocusIndex();
			if ( parms.Num() > 0 ) {
				selectionIndex = parms[0].ToInteger();
			}

			if ( selectionIndex != options->GetFocusIndex() ) {
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}						

			matchData.AdjustField( selectionIndex, 1 );
			options->Update();
			return true;
		}
		case WIDGET_ACTION_START_REPEATER: {

			if ( options == NULL ) {
				return true;
			}

			if ( parms.Num() == 4 ) {
				int selectionIndex = parms[3].ToInteger();
				if ( selectionIndex != options->GetFocusIndex() ) {
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 25
0
/*
========================
idMenuScreen_Shell_Root::HandleAction
========================
*/
bool idMenuScreen_Shell_Root::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( menuData == NULL ) {
		return true;
	}

	if ( menuData->ActiveScreen() != SHELL_AREA_ROOT ) {
		return false;
	}

	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();

	switch ( actionType ) {
		case WIDGET_ACTION_GO_BACK: {
			session->MoveToPressStart();
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED: {
			if ( menuData->GetPlatform() == 2 ) {

				idMenuHandler_Shell * shell = dynamic_cast< idMenuHandler_Shell * >( menuData );
				if ( !shell ) {
					return true;
				}

				idMenuWidget_MenuBar * menuBar = shell->GetMenuBar();

				if ( !menuBar ) {
					return true;
				}

				const idMenuWidget_MenuButton * buttonWidget = dynamic_cast< idMenuWidget_MenuButton * >( &menuBar->GetChildByIndex( menuBar->GetFocusIndex() ) );
				if ( !buttonWidget ) {
					return true;
				}

				idWidgetEvent pressEvent( WIDGET_EVENT_PRESS, 0, NULL, idSWFParmList() );
				menuBar->ReceiveEvent( pressEvent );
				return true;
			} 
			break;
		}
		case WIDGET_ACTION_SCROLL_HORIZONTAL: {

			if ( menuData->GetPlatform() != 2 ) {
				return true;
			}

			idMenuHandler_Shell * shell = dynamic_cast< idMenuHandler_Shell * >( menuData );
			if ( !shell ) {
				return true;
			}

			idMenuWidget_MenuBar * menuBar = shell->GetMenuBar();
			
			if ( !menuBar ) {
				return true;
			}

			int index = menuBar->GetViewIndex();			
			const int dir = parms[0].ToInteger();
#ifdef ID_RETAIL
			const int totalCount = menuBar->GetTotalNumberOfOptions() - 1;
#else
			const int totalCount = menuBar->GetTotalNumberOfOptions();
#endif
			index += dir;
			if ( index < 0 ) {
				index = totalCount - 1;
			} else if ( index >= totalCount ) {
				index = 0;
			}

			SetRootIndex( index );
			menuBar->SetViewIndex( index );
			menuBar->SetFocusIndex( index );			

			return true;
		}
		case WIDGET_ACTION_COMMAND: {
			switch ( parms[0].ToInteger() ) {
				case ROOT_CMD_START_DEMO: {
					cmdSystem->AppendCommandText( va( "devmap %s %d\n", "demo/enpro_e3_2012", 1 ) );
					break;
				}
				case ROOT_CMD_START_DEMO2: {
					cmdSystem->AppendCommandText( va( "devmap %s %d\n", "game/le_hell", 2 ) );
					break;
				}
				case ROOT_CMD_SETTINGS: {
					menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
					break;
				}
				case ROOT_CMD_QUIT: {
					HandleExitGameBtn();
					break;
				}
				case ROOT_CMD_DEV: {
					menuData->SetNextScreen( SHELL_AREA_DEV, MENU_TRANSITION_SIMPLE );
					break;
				}
				case ROOT_CMD_CAMPAIGN: {
					menuData->SetNextScreen( SHELL_AREA_CAMPAIGN, MENU_TRANSITION_SIMPLE );
					break;
				}
				case ROOT_CMD_MULTIPLAYER: {
					const idLocalUser * masterUser = session->GetSignInManager().GetMasterLocalUser();

					if ( masterUser == NULL ) {
						break;
					}

					if ( masterUser->GetOnlineCaps() & CAP_BLOCKED_PERMISSION ) {
						common->Dialog().AddDialog( GDM_ONLINE_INCORRECT_PERMISSIONS, DIALOG_CONTINUE, NULL, NULL, true, __FUNCTION__, __LINE__, false );
					} else if ( !masterUser->CanPlayOnline() ) { 
						class idSWFScriptFunction_Accept : public idSWFScriptFunction_RefCounted {
						public:
							idSWFScriptFunction_Accept() { }
							idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
								common->Dialog().ClearDialog( GDM_PLAY_ONLINE_NO_PROFILE );
								session->ShowOnlineSignin();
								return idSWFScriptVar();
							}
						};
						class idSWFScriptFunction_Cancel : public idSWFScriptFunction_RefCounted {
						public:
							idSWFScriptFunction_Cancel() { }
							idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) {
								common->Dialog().ClearDialog( GDM_PLAY_ONLINE_NO_PROFILE );
								return idSWFScriptVar();
							}
						};

						common->Dialog().AddDialog( GDM_PLAY_ONLINE_NO_PROFILE, DIALOG_ACCEPT_CANCEL, new (TAG_SWF) idSWFScriptFunction_Accept(), new (TAG_SWF) idSWFScriptFunction_Cancel(), false );
					} else {
						idMatchParameters matchParameters;
						matchParameters.matchFlags = DefaultPartyFlags;
						session->CreatePartyLobby( matchParameters );
					}
					break;
				}
				case ROOT_CMD_PLAYSTATION: {
					menuData->SetNextScreen( SHELL_AREA_PLAYSTATION, MENU_TRANSITION_SIMPLE );
					break;
				}
				case ROOT_CMD_CREDITS: {
					menuData->SetNextScreen( SHELL_AREA_CREDITS, MENU_TRANSITION_SIMPLE );
					break;
				}
			}
			return true;
		}
	}

	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
Exemplo n.º 26
0
/*
========================
idMenuHandler_PDA::HandleAction
========================
*/
bool idMenuHandler_PDA::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {

	if ( activeScreen == PDA_AREA_INVALID ) {
		return true;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList & parms = action.GetParms();
	
	if ( event.type == WIDGET_EVENT_COMMAND ) {
		if ( menuScreens[ activeScreen ] != NULL && !forceHandled ) {
			if ( menuScreens[ activeScreen ]->HandleAction( action, event, widget, true ) ) {
				if ( actionType == WIDGET_ACTION_GO_BACK ) {
					PlaySound( GUI_SOUND_BACK );
				} else {
					PlaySound( GUI_SOUND_ADVANCE );
				}
				return true;
			}
		}
	}

	switch ( actionType ) {
		case WIDGET_ACTION_PDA_SELECT_USER: {
			int index = parms[0].ToInteger();
			idMenuWidget_DynamicList * pdaList = dynamic_cast< idMenuWidget_DynamicList * >( GetChildFromIndex( PDA_WIDGET_PDA_LIST ) );
			if ( pdaList != NULL ) {
				pdaList->SetViewIndex( pdaList->GetViewOffset() + index );
				pdaList->SetFocusIndex( index );
			}
			return true;
		}
		case WIDGET_ACTION_SCROLL_TAB: {

			if ( transition != MENU_TRANSITION_INVALID ) {
				return true;
			}
			int delta = parms[0].ToInteger();
			idMenuWidget_NavBar * navBar = dynamic_cast< idMenuWidget_NavBar * >( GetChildFromIndex( PDA_WIDGET_NAV_BAR ) );
			if ( navBar != NULL ) {
				int focused = navBar->GetFocusIndex();
				focused += delta;
				if ( focused < 0 ) {
					focused = navBar->GetNumVisibleOptions() - 1;
				} else if ( focused >= navBar->GetNumVisibleOptions() ) {
					focused = 0;
				}

				navBar->SetViewIndex( focused );
				navBar->SetFocusIndex( focused, true );
				navBar->Update();

				nextScreen = activeScreen + delta;
				if ( nextScreen < 0 ) {
					nextScreen = PDA_NUM_AREAS - 1;
				} else if ( nextScreen == PDA_NUM_AREAS ) {
					nextScreen = 0;
				}

				if ( delta < 0 ) {					
					transition = MENU_TRANSITION_BACK;
				} else {
					transition = MENU_TRANSITION_ADVANCE;
				}

			}
			return true;
		}
		case WIDGET_ACTION_PDA_SELECT_NAV: {
			int index = parms[0].ToInteger();
			
			if ( index == -1 && activeScreen == PDA_AREA_USER_EMAIL ) {
				idMenuScreen_PDA_UserEmails * screen = dynamic_cast< idMenuScreen_PDA_UserEmails * const >( menuScreens[ PDA_AREA_USER_EMAIL ] );
				if ( screen ) {
					screen->ShowEmail( false );
				}
				return true;
			}

			// click on the current nav tab
			if ( index == -1 ) {
				return true;
			}

			idMenuWidget_NavBar * navBar = dynamic_cast< idMenuWidget_NavBar * >( GetChildFromIndex( PDA_WIDGET_NAV_BAR ) );
			if ( navBar != NULL ) {
				navBar->SetViewIndex( navBar->GetViewOffset() + index );
				navBar->SetFocusIndex( index, true );
				navBar->Update();

				if ( index < activeScreen ) {
					nextScreen = index;
					transition = MENU_TRANSITION_BACK;
				} else if ( index > activeScreen ) {
					nextScreen = index;
					transition = MENU_TRANSITION_ADVANCE;
				}
			}			
			return true;
		}
		case WIDGET_ACTION_SELECT_PDA_AUDIO: {
			if ( activeScreen == PDA_AREA_USER_DATA ) {
				int index = parms[0].ToInteger();
				idMenuWidget_DynamicList * pdaList = dynamic_cast< idMenuWidget_DynamicList * >( GetChildFromIndex( PDA_WIDGET_PDA_LIST ) );
				
				bool change = false;
				if ( pdaList != NULL ) {
					int pdaIndex = pdaList->GetViewIndex();
					change = PlayPDAAudioLog( pdaIndex, index );
				}

				if ( change ) {
					if ( widget->GetParent() != NULL ) {
						idMenuWidget_DynamicList * audioList = dynamic_cast< idMenuWidget_DynamicList * >( widget->GetParent() );
						int index = parms[0].ToInteger();
						if ( audioList != NULL ) {
							audioList->SetFocusIndex( index );
						}
					}
				}
			}

			return true;
		}
		case WIDGET_ACTION_SELECT_PDA_VIDEO: {
			if ( activeScreen == PDA_AREA_VIDEO_DISKS ) {
				int index = parms[0].ToInteger();
				if ( menuScreens[ PDA_AREA_VIDEO_DISKS ] != NULL ) {
					idMenuScreen_PDA_VideoDisks * screen = dynamic_cast< idMenuScreen_PDA_VideoDisks * const >( menuScreens[ PDA_AREA_VIDEO_DISKS ] );
					if ( screen != NULL ) {
						screen->SelectedVideoToPlay( index );
					}
				}
			}
			return true;
		}
	}

	return idMenuHandler::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Load::HandleAction h
========================
*/
bool idMenuScreen_Shell_Load::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData != NULL )
	{
		if( menuData->ActiveScreen() != SHELL_AREA_LOAD )
		{
			return false;
		}
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	switch( actionType )
	{
		case WIDGET_ACTION_JOY4_ON_PRESS:
		{
			return true;
		}
		case WIDGET_ACTION_JOY3_ON_PRESS:
		{
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			DeleteGame( selectionIndex );
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			if( menuData != NULL )
			{
				if( game->IsInGame() )
				{
					menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
				}
				else
				{
					menuData->SetNextScreen( SHELL_AREA_CAMPAIGN, MENU_TRANSITION_SIMPLE );
				}
			}
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
			if( options == NULL )
			{
				return true;
			}
			
			if( sortedSaves.Num() == 0 )
			{
				return true;
			}
			
			int selectionIndex = options->GetViewIndex();
			if( parms.Num() == 1 )
			{
				selectionIndex = parms[0].ToInteger();
				
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
				else
				{
					LoadGame( options->GetViewOffset() + selectionIndex );
				}
			}
			else
			{
				LoadGame( options->GetViewIndex() );
			}
			
			return true;
		}
		case WIDGET_ACTION_SCROLL_VERTICAL:
		{
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_GameOptions::HandleAction h
========================
*/
bool idMenuScreen_Shell_GameOptions::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_GAME_OPTIONS )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
			return true;
		}
		case WIDGET_ACTION_PRESS_FOCUSED:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetFocusIndex();
			if( parms.Num() > 0 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			systemData.AdjustField( selectionIndex, 1 );
			options->Update();
			
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
			if( parms.Num() == 4 )
			{
				int selectionIndex = parms[3].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_PartyLobby::HandleAction h
========================
*/
bool idMenuScreen_Shell_PartyLobby::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_PARTY_LOBBY )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_JOY4_ON_PRESS:
		{
		
			idLobbyBase& activeLobby = session->GetPartyLobbyBase();
			lobbyUserID_t luid;
			if( CanKickSelectedPlayer( luid ) )
			{
				activeLobby.KickLobbyUser( luid );
			}
			return true;
		}
		case WIDGET_ACTION_GO_BACK:
		{
			class idSWFScriptFunction_Accept : public idSWFScriptFunction_RefCounted
			{
			public:
				idSWFScriptFunction_Accept() { }
				idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
				{
					common->Dialog().ClearDialog( GDM_LEAVE_LOBBY_RET_MAIN );
					session->Cancel();
					
					return idSWFScriptVar();
				}
			};
			class idSWFScriptFunction_Cancel : public idSWFScriptFunction_RefCounted
			{
			public:
				idSWFScriptFunction_Cancel() { }
				idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
				{
					common->Dialog().ClearDialog( GDM_LEAVE_LOBBY_RET_MAIN );
					return idSWFScriptVar();
				}
			};
			
			idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase();
			
			if( activeLobby.GetNumActiveLobbyUsers() > 1 )
			{
				common->Dialog().AddDialog( GDM_LEAVE_LOBBY_RET_MAIN, DIALOG_ACCEPT_CANCEL, new( TAG_SWF ) idSWFScriptFunction_Accept(), new( TAG_SWF ) idSWFScriptFunction_Cancel(), false );
			}
			else
			{
				session->Cancel();
			}
			
			return true;
		}
		case WIDGET_ACTION_MUTE_PLAYER:
		{
		
			if( parms.Num() != 1 )
			{
				return true;
			}
			
			int index = parms[0].ToInteger();
			
			idLobbyBase& activeLobby = session->GetPartyLobbyBase();
			lobbyUserID_t luid = activeLobby.GetLobbyUserIdByOrdinal( index );
			if( luid.IsValid() )
			{
				session->ToggleLobbyUserVoiceMute( luid );
			}
			
			return true;
		}
		case WIDGET_ACTION_COMMAND:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetFocusIndex();
			if( parms.Num() > 1 )
			{
				selectionIndex = parms[1].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			switch( parms[0].ToInteger() )
			{
				case PARTY_CMD_QUICK:
				{
					idMatchParameters matchParameters = idMatchParameters( session->GetPartyLobbyBase().GetMatchParms() );
					
					// Reset these to random for quick match.
					matchParameters.gameMap =  GAME_MAP_RANDOM;
					matchParameters.gameMode = GAME_MODE_RANDOM;
					
					// Always a public match.
					matchParameters.matchFlags &= ~MATCH_INVITE_ONLY;
					
					session->UpdatePartyParms( matchParameters );
					
					// Update flags for game lobby.
					matchParameters.matchFlags = DefaultPartyFlags | DefaultPublicGameFlags;
					cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO, matchParameters.serverInfo );
					
					// Force a default value for the si_timelimit and si_fraglimit for quickmatch
					matchParameters.serverInfo.SetInt( "si_timelimit", 15 );
					matchParameters.serverInfo.SetInt( "si_fraglimit", 10 );
					
					session->FindOrCreateMatch( matchParameters );
					break;
				}
				case PARTY_CMD_FIND:
				{
					menuData->SetNextScreen( SHELL_AREA_MODE_SELECT, MENU_TRANSITION_SIMPLE );
					break;
				}
				case PARTY_CMD_CREATE:
				{
					idMatchParameters matchParameters = idMatchParameters( session->GetPartyLobbyBase().GetMatchParms() );
					
					const bool isInviteOnly = MatchTypeInviteOnly( matchParameters.matchFlags );
					
					matchParameters.matchFlags = DefaultPartyFlags | DefaultPrivateGameFlags;
					
					if( isInviteOnly )
					{
						matchParameters.matchFlags |= MATCH_INVITE_ONLY;
					}
					
					int mode = idMath::ClampInt( -1, GAME_COUNT - 1, si_mode.GetInteger() );
					const idList< mpMap_t > maps = common->GetMapList();
					int map = idMath::ClampInt( -1, maps.Num() - 1, si_map.GetInteger() );
					
					matchParameters.gameMap = map;
					matchParameters.gameMode = mode;
					cvarSystem->MoveCVarsToDict( CVAR_SERVERINFO, matchParameters.serverInfo );
					session->CreateMatch( matchParameters );
					break;
				}
				case PARTY_CMD_PWF:
				{
					menuData->SetNextScreen( SHELL_AREA_BROWSER, MENU_TRANSITION_SIMPLE );
					break;
				}
				case PARTY_CMD_LEADERBOARDS:
				{
					ShowLeaderboards();
					break;
				}
				case PARTY_CMD_TOGGLE_PRIVACY:
				{
					idMatchParameters matchParameters = idMatchParameters( session->GetPartyLobbyBase().GetMatchParms() );
					matchParameters.matchFlags ^= MATCH_INVITE_ONLY;
					session->UpdatePartyParms( matchParameters );
					int bitSet = ( matchParameters.matchFlags & MATCH_INVITE_ONLY );
					net_inviteOnly.SetBool( bitSet != 0 ? true : false );
					break;
				}
				case PARTY_CMD_SHOW_PARTY_GAMES:
				{
					session->ShowPartySessions();
					break;
				}
				case PARTY_CMD_INVITE:
				{
					if( session->GetPartyLobbyBase().IsLobbyFull() )
					{
						common->Dialog().AddDialog( GDM_CANNOT_INVITE_LOBBY_FULL, DIALOG_CONTINUE, NULL, NULL, true, __FUNCTION__, __LINE__, false );
						return true;
					}
					
					InvitePartyOrFriends();
					break;
				}
			}
			
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			if( parms.Num() == 4 )
			{
				int selectionIndex = parms[3].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
		case WIDGET_ACTION_SELECT_GAMERTAG:
		{
			int selectionIndex = lobby->GetFocusIndex();
			if( parms.Num() > 0 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != lobby->GetFocusIndex() )
			{
				lobby->SetViewIndex( lobby->GetViewOffset() + selectionIndex );
				lobby->SetFocusIndex( selectionIndex );
				return true;
			}
			
			idLobbyBase& activeLobby = session->GetPartyLobbyBase();
			lobbyUserID_t luid = activeLobby.GetLobbyUserIdByOrdinal( selectionIndex );
			if( luid.IsValid() )
			{
				session->ShowLobbyUserGamerCardUI( luid );
			}
			
			return true;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
/*
========================
idMenuScreen_Shell_Controls::HandleAction
========================
*/
bool idMenuScreen_Shell_Controls::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{

	if( menuData == NULL )
	{
		return true;
	}
	
	if( menuData->ActiveScreen() != SHELL_AREA_CONTROLS )
	{
		return false;
	}
	
	widgetAction_t actionType = action.GetType();
	const idSWFParmList& parms = action.GetParms();
	
	switch( actionType )
	{
		case WIDGET_ACTION_GO_BACK:
		{
			menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
			return true;
		}
		
		case WIDGET_ACTION_COMMAND:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			int selectionIndex = options->GetFocusIndex();
			if( parms.Num() > 0 )
			{
				selectionIndex = parms[0].ToInteger();
			}
			
			if( selectionIndex != options->GetFocusIndex() )
			{
				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
				options->SetFocusIndex( selectionIndex );
			}
			
			switch( parms[0].ToInteger() )
			{
				case CONTROLS_CMD_BINDINGS:
				{
					menuData->SetNextScreen( SHELL_AREA_KEYBOARD, MENU_TRANSITION_SIMPLE );
					break;
				}
				case CONTROLS_CMD_GAMEPAD:
				{
					menuData->SetNextScreen( SHELL_AREA_GAMEPAD, MENU_TRANSITION_SIMPLE );
					break;
				}
				case CONTROLS_CMD_INVERT:
				{
					controlData.AdjustField( idMenuDataSource_ControlSettings::CONTROLS_FIELD_INVERT_MOUSE, 1 );
					if( options != NULL )
					{
						options->Update();
					}
					break;
				}
				case CONTROLS_CMD_MOUSE_SENS:
				{
					controlData.AdjustField( idMenuDataSource_ControlSettings::CONTROLS_FIELD_MOUSE_SENS, 1 );
					if( options != NULL )
					{
						options->Update();
					}
					break;
				}
				case CONTROLS_CMD_GAMEPAD_ENABLED:
				{
					controlData.AdjustField( idMenuDataSource_ControlSettings::CONTROLS_FIELD_GAMEPAD_ENABLED, 1 );
					if( options != NULL )
					{
						options->Update();
					}
					break;
				}
			}
			
			return true;
		}
		case WIDGET_ACTION_START_REPEATER:
		{
		
			if( options == NULL )
			{
				return true;
			}
			
			if( parms.Num() == 4 )
			{
				int selectionIndex = parms[3].ToInteger();
				if( selectionIndex != options->GetFocusIndex() )
				{
					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
					options->SetFocusIndex( selectionIndex );
				}
			}
			break;
		}
	}
	
	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}