/* ======================== idMenuWidget_DevList::NavigateBack ======================== */ void idMenuWidget_DevList::NavigateBack() { assert( devMapListInfos.Num() != 0 ); if ( devMapListInfos.Num() == 1 ) { // Important that this goes through as a DIRECT event, since more than likely the list // widget will have the parent's focus, so a standard ReceiveEvent() here would turn // into an infinite recursion. idWidgetEvent event( WIDGET_EVENT_BACK, 0, NULL, idSWFParmList() ); idWidgetAction action; action.Set( WIDGET_ACTION_GO_BACK, MENU_ROOT ); HandleAction( action, event ); return; } // NOTE: we need a copy here, since it's about to be removed from the list const indexInfo_t indexes = devMapListInfos[ devMapListInfos.Num() - 1 ]; assert( indexes.focusIndex < GetChildren().Num() ); assert( ( indexes.viewIndex - indexes.viewOffset ) < GetNumVisibleOptions() ); devMapListInfos.RemoveIndex( devMapListInfos.Num() - 1 ); RecalculateDevMenu(); SetViewIndex( indexes.viewIndex ); SetViewOffset( indexes.viewOffset ); Update(); // NOTE: This must be done AFTER Update() because so that it is sure to refer to the proper sprite GetChildByIndex( indexes.focusIndex ).SetState( WIDGET_STATE_SELECTED ); ForceFocusIndex( indexes.focusIndex ); SetFocusIndex( indexes.focusIndex ); gameLocal->GetMainMenu()->ClearWidgetActionRepeater(); }
/* ======================== idMenuScreen::ShowScreen ======================== */ void idMenuScreen::ShowScreen( const mainMenuTransition_t transitionType ) { if( menuGUI == NULL ) { return; } if( !BindSprite( menuGUI->GetRootObject() ) ) { return; } GetSprite()->SetVisible( true ); if( transitionType == MENU_TRANSITION_SIMPLE ) { if( menuData != NULL && menuData->ActiveScreen() != -1 ) { menuData->PlaySound( GUI_SOUND_BUILD_ON ); } GetSprite()->PlayFrame( "rollOn" ); } else if( transitionType == MENU_TRANSITION_ADVANCE ) { if( menuData != NULL && menuData->ActiveScreen() != -1 ) { menuData->PlaySound( GUI_SOUND_BUILD_ON ); } GetSprite()->PlayFrame( "rollOnFront" ); } else { if( menuData != NULL ) { menuData->PlaySound( GUI_SOUND_BUILD_OFF ); } GetSprite()->PlayFrame( "rollOnBack" ); } Update(); SetFocusIndex( GetFocusIndex(), true ); }
/* ======================== idMenuWidget_DevList::NavigateForward ======================== */ void idMenuWidget_DevList::NavigateForward( const int optionIndex ) { if ( devMenuList == NULL ) { return; } const int focusedIndex = GetViewOffset() + optionIndex; const idDeclDevMenuList::idDevMenuOption & devOption = devMenuList->devMenuList[ focusedIndex ]; if ( ( devOption.devMenuDisplayName.Length() == 0 ) || ( devOption.devMenuDisplayName.Cmp( "..." ) == 0 ) ) { return; } if ( devOption.devMenuSubList != NULL ) { indexInfo_t & indexes = devMapListInfos.Alloc(); indexes.name = devOption.devMenuSubList->GetName(); indexes.focusIndex = GetFocusIndex(); indexes.viewIndex = GetViewIndex(); indexes.viewOffset = GetViewOffset(); RecalculateDevMenu(); SetViewIndex( 0 ); SetViewOffset( 0 ); Update(); // NOTE: This must be done after the Update() because it MAY change the sprites that // children refer to GetChildByIndex( 0 ).SetState( WIDGET_STATE_SELECTED ); ForceFocusIndex( 0 ); SetFocusIndex( 0 ); gameLocal->GetMainMenu()->ClearWidgetActionRepeater(); } else { cmdSystem->AppendCommandText( va( "loadDevMenuOption %s %d\n", devMapListInfos[ devMapListInfos.Num() - 1 ].name, focusedIndex ) ); } }