/* ======================== idMenuScreen_Shell_ControllerLayout::Initialize ======================== */ void idMenuScreen_Shell_ControllerLayout::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuControllerLayout" ); options = new (TAG_SWF) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_LAYOUT_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "controlInfo", "options" ); options->SetWrappingAllowed( true ); options->SetControlList( true ); options->Initialize( data ); AddChild( options ); btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_gamepad_heading" ); // CONTROLS btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); idMenuWidget_ControlButton * control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_BUTTON_FULL_TEXT_SLIDER ); control->SetLabel( "CONTROL LAYOUT" ); // Auto Weapon Reload control->SetDataSource( &layoutData, idMenuDataSource_LayoutSettings::LAYOUT_FIELD_LAYOUT ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); options->AddChild( control ); }
/* ======================== idMenuWidget_PDA_EmailInbox::Initialize ======================== */ void idMenuWidget_PDA_EmailInbox::Initialize( idMenuHandler* data ) { idMenuWidget_ScrollBar* scrollbar = new( TAG_SWF ) idMenuWidget_ScrollBar(); scrollbar->SetSpritePath( GetSpritePath(), "info", "scrollbar" ); scrollbar->Initialize( data ); emailList = new( TAG_SWF ) idMenuWidget_DynamicList(); emailList->SetSpritePath( GetSpritePath(), "info", "options" ); emailList->SetNumVisibleOptions( MAX_EMAIL_ITEMS ); emailList->SetWrappingAllowed( true ); while( emailList->GetChildren().Num() < MAX_EMAIL_ITEMS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PDA_SELECT_EMAIL, emailList->GetChildren().Num() ); buttonWidget->AddEventAction( WIDGET_EVENT_FOCUS_ON ).Set( WIDGET_ACTION_REFRESH ); buttonWidget->Initialize( data ); buttonWidget->RegisterEventObserver( scrollbar ); emailList->AddChild( buttonWidget ); } emailList->Initialize( data ); emailList->AddChild( scrollbar ); AddChild( emailList ); }
/* ======================== idMenuScreen_Shell_Playstation::Initialize ======================== */ void idMenuScreen_Shell_Playstation::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuPlaystation" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions; idList< idStr > option; option.Append( "#str_swf_friends" ); // FRIENDS menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_check_for_invites" ); // CHECK FOR INVITES menuOptions.Append( option ); options->SetListData( menuOptions ); options->SetNumVisibleOptions( NUM_SETTING_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); while( options->GetChildren().Num() < NUM_SETTING_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* >( data ); if( handler != NULL && handler->GetInGame() ) { btnBack->SetLabel( "#str_swf_pause_menu" ); } else { btnBack->SetLabel( "#str_02305" ); } btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Save::Initialize ======================== */ void idMenuScreen_Shell_Save::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuSave" ); saveInfo = new( TAG_SWF ) idMenuWidget_Shell_SaveInfo(); saveInfo->SetSpritePath( GetSpritePath(), "info", "details" ); saveInfo->Initialize( data ); saveInfo->SetForSaveScreen( true ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_SAVE_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); while( options->GetChildren().Num() < NUM_SAVE_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->RegisterEventObserver( saveInfo ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); AddChild( saveInfo ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_pause_menu" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); btnDelete = new idMenuWidget_Button(); btnDelete->Initialize( data ); btnDelete->SetLabel( "" ); btnDelete->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_JOY3_ON_PRESS ); btnDelete->SetSpritePath( GetSpritePath(), "info", "btnDelete" ); AddChild( btnDelete ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Bindings::Initialize ======================== */ void idMenuScreen_Shell_Bindings::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuBindings" ); restoreDefault = new idMenuWidget_Button(); restoreDefault->Initialize( data ); restoreDefault->SetLabel( "" ); restoreDefault->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_JOY3_ON_PRESS ); restoreDefault->SetSpritePath( GetSpritePath(), "info", "btnRestore" ); AddChild( restoreDefault ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); idStr controls( idLocalization::GetString( "#str_04158" ) ); controls.ToUpper(); btnBack->SetLabel( controls ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); options = new idMenuWidget_DynamicList(); options->SetIgnoreColor( true ); options->SetNumVisibleOptions( NUM_BIND_LISTINGS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); UpdateBindingDisplay(); while( options->GetChildren().Num() < NUM_BIND_LISTINGS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_NewGame::Initialize ======================== */ void idMenuScreen_Shell_NewGame::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuNewGame" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions; idList< idStr > option; option.Append( "#str_swf_doom3" ); // doom 3 menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_resurrection" ); // resurrection of evil menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_lost_episodes" ); // lost episodes menuOptions.Append( option ); options->SetListData( menuOptions ); options->SetNumVisibleOptions( NUM_NEW_GAME_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); while( options->GetChildren().Num() < NUM_NEW_GAME_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_campaign" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuWidget::BindSprite Takes the sprite path strings and resolves it to an actual sprite relative to a given root. This is setup in this manner, because we can't resolve from path -> sprite immediately since SWFs aren't necessarily loaded at the time widgets are instantiated. ======================== */ bool idMenuWidget::BindSprite( idSWFScriptObject& root ) { const char* args[ 6 ] = { NULL }; assert( GetSpritePath().Num() > 0 ); for( int i = 0; i < GetSpritePath().Num(); ++i ) { args[ i ] = GetSpritePath()[ i ].c_str(); } boundSprite = root.GetNestedSprite( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ], args[ 5 ] ); return boundSprite != NULL; }
/* ======================== idMenuScreen_PDA_VideoDisks::Initialize ======================== */ void idMenuScreen_PDA_VideoDisks::Initialize( idMenuHandler* data ) { if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuVideo" ); videoDetails.SetSpritePath( GetSpritePath(), "info", "details" ); videoDetails.Initialize( data ); videoDetails.SetNoAutoFree( true ); scrollbar.SetSpritePath( GetSpritePath(), "info", "videoList", "scrollbar" ); scrollbar.Initialize( data ); scrollbar.SetNoAutoFree( true ); pdaVideoList.SetSpritePath( GetSpritePath(), "info", "videoList", "options" ); pdaVideoList.SetNumVisibleOptions( MAX_VIDEO_ITEMS ); pdaVideoList.SetWrappingAllowed( true ); pdaVideoList.SetNoAutoFree( true ); while( pdaVideoList.GetChildren().Num() < MAX_VIDEO_ITEMS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_PDA_VIDEO, pdaVideoList.GetChildren().Num() ); buttonWidget->RegisterEventObserver( &videoDetails ); buttonWidget->RegisterEventObserver( &scrollbar ); buttonWidget->Initialize( data ); pdaVideoList.AddChild( buttonWidget ); } pdaVideoList.Initialize( data ); pdaVideoList.AddChild( &scrollbar ); AddChild( &pdaVideoList ); AddChild( &videoDetails ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( &pdaVideoList, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); AddEventAction( WIDGET_EVENT_TAB_NEXT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) ); AddEventAction( WIDGET_EVENT_TAB_PREV ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) ); idMenuScreen::Initialize( data ); }
/* ======================== idMenuScreen_Shell_PressStart::Initialize ======================== */ void idMenuScreen_Shell_PressStart::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuStart" ); itemList = new( TAG_SWF ) idMenuWidget_Carousel(); itemList->SetSpritePath( GetSpritePath(), "info", "options" ); itemList->SetNumVisibleOptions( NUM_GAME_SELECTIONS_VISIBLE ); while( itemList->GetChildren().Num() < NUM_GAME_SELECTIONS_VISIBLE ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, itemList->GetChildren().Num() ); buttonWidget->Initialize( data ); itemList->AddChild( buttonWidget ); } itemList->Initialize( data ); AddChild( itemList ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ) ); doomCover = declManager->FindMaterial( "guis/assets/mainmenu/doom_cover.tga" ); doom2Cover = declManager->FindMaterial( "guis/assets/mainmenu/doom2_cover.tga" ); doom3Cover = declManager->FindMaterial( "guis/assets/mainmenu/doom3_cover.tga" ); startButton = new idMenuWidget_Button(); startButton->SetSpritePath( GetSpritePath(), "info", "btnStart" ); AddChild( startButton ); }
/* ======================== idMenuScreen_Shell_Root::Initialize ======================== */ void idMenuScreen_Shell_Root::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuMain" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_MAIN_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->Initialize( data ); options->SetWrappingAllowed( true ); AddChild( options ); helpWidget = new( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); while( options->GetChildren().Num() < NUM_MAIN_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); buttonWidget->RegisterEventObserver( helpWidget ); options->AddChild( buttonWidget ); } options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) ); AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, 0 ); }
/* ======================== idMenuScreen_Shell_Singleplayer::Initialize ======================== */ void idMenuScreen_Shell_Singleplayer::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuCampaign" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_SINGLEPLAYER_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); AddChild( options ); idMenuWidget_Help* const helpWidget = new( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); while( options->GetChildren().Num() < NUM_SINGLEPLAYER_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->RegisterEventObserver( helpWidget ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_02305" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuWidget_ScoreboardList::Update ======================== */ void idMenuWidget_ScoreboardList::Update() { if ( GetSWFObject() == NULL ) { return; } idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( !BindSprite( root ) ) { return; } for ( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex ) { idMenuWidget & child = GetChildByIndex( optionIndex ); const int childIndex = GetViewOffset() + optionIndex; bool shown = false; child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) ); if ( child.BindSprite( root ) ) { shown = PrepareListElement( child, childIndex ); if ( optionIndex == focusIndex && child.GetState() != WIDGET_STATE_SELECTED && child.GetState() != WIDGET_STATE_SELECTING ) { child.SetState( WIDGET_STATE_SELECTING ); } else if ( optionIndex != focusIndex && child.GetState() != WIDGET_STATE_NORMAL ) { child.SetState( WIDGET_STATE_NORMAL ); } child.Update(); } } }
/* ======================== idMenuWidget_DynamicList::Update ======================== */ void idMenuWidget_DynamicList::Update() { if ( GetSWFObject() == NULL ) { return; } idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( !BindSprite( root ) ) { return; } for ( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex ) { if ( optionIndex >= children.Num() ) { idSWFSpriteInstance * item = GetSprite()->GetScriptObject()->GetNestedSprite( va( "item%d", optionIndex ) ); if ( item != NULL ) { item->SetVisible( false ); continue; } } idMenuWidget & child = GetChildByIndex( optionIndex ); const int childIndex = GetViewOffset() + optionIndex; bool shown = false; child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) ); if ( child.BindSprite( root ) ) { if ( optionIndex >= GetTotalNumberOfOptions() ) { child.ClearSprite(); continue; } else { //const int controlIndex = GetNumVisibleOptions() - Min( GetNumVisibleOptions(), GetTotalNumberOfOptions() ) + optionIndex; shown = PrepareListElement( child, childIndex ); child.Update(); } if ( !shown ) { child.SetState( WIDGET_STATE_HIDDEN ); } else { if ( optionIndex == focusIndex ) { child.SetState( WIDGET_STATE_SELECTING ); } else { child.SetState( WIDGET_STATE_NORMAL ); } } } } idSWFSpriteInstance * const upSprite = GetSprite()->GetScriptObject()->GetSprite( "upIndicator" ); if ( upSprite != NULL ) { upSprite->SetVisible( GetViewOffset() > 0 ); } idSWFSpriteInstance * const downSprite = GetSprite()->GetScriptObject()->GetSprite( "downIndicator" ); if ( downSprite != NULL ) { downSprite->SetVisible( GetViewOffset() + GetNumVisibleOptions() < GetTotalNumberOfOptions() ); } }
/* ======================== idMenuScreen_Scoreboard::Initialize ======================== */ void idMenuScreen_Scoreboard::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "sbDefault" ); playerList = new( TAG_SWF ) idMenuWidget_ScoreboardList(); playerList->SetSpritePath( GetSpritePath(), "info", "playerList" ); playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS ); playerList->SetWrappingAllowed( true ); while( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS ) { idMenuWidget_ScoreboardButton* const buttonWidget = new( TAG_SWF ) idMenuWidget_ScoreboardButton(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() ); buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() ); buttonWidget->Initialize( data ); playerList->AddChild( buttonWidget ); } playerList->Initialize( data ); AddChild( playerList ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Bindings::ToggleWait ======================== */ void idMenuScreen_Shell_Bindings::ToggleWait( bool wait ) { if( wait ) { if( blinder != NULL ) { blinder->SetVisible( true ); if( options != NULL ) { blinder->StopFrame( options->GetFocusIndex() + 1 ); } } if( txtBlinder != NULL ) { txtBlinder->SetVisible( true ); } if( restoreDefault != NULL ) { restoreDefault->SetLabel( "" ); } } else { if( blinder != NULL ) { blinder->SetVisible( false ); } if( txtBlinder != NULL ) { txtBlinder->SetVisible( false ); } if( restoreDefault != NULL ) { if( menuData != NULL ) { menuGUI = menuData->GetGUI(); if( menuGUI != NULL ) { idSWFScriptObject& root = menuGUI->GetRootObject(); restoreDefault->SetSpritePath( GetSpritePath(), "info", "btnRestore" ); restoreDefault->BindSprite( root ); } } if( restoreDefault->GetSprite() ) { restoreDefault->GetSprite()->SetVisible( true ); } restoreDefault->SetLabel( "#str_swf_restore_defaults" ); } } }
/* ======================== idMenuWidget_MenuBar::Update ======================== */ void idMenuWidget_MenuBar::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) ) { return; } totalWidth = 0.0f; buttonPos = 0.0f; for( int index = 0; index < GetNumVisibleOptions(); ++index ) { if( index >= children.Num() ) { break; } if( index != 0 ) { totalWidth += rightSpacer; } idMenuWidget& child = GetChildByIndex( index ); child.SetSpritePath( GetSpritePath(), va( "btn%d", index ) ); if( child.BindSprite( root ) ) { PrepareListElement( child, index ); child.Update(); } } // 640 is half the size of our flash files width float xPos = 640.0f - ( totalWidth / 2.0f ); GetSprite()->SetXPos( xPos ); idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" ); if( backing != NULL ) { if( menuData != NULL && menuData->GetPlatform() != 2 ) { backing->SetVisible( false ); } else { backing->SetVisible( true ); backing->SetXPos( totalWidth / 2.0f ); } } }
/* ======================== idMenuScreen_PDA_Inventory::Initialize ======================== */ void idMenuScreen_PDA_Inventory::Initialize( idMenuHandler * data ) { AddEventAction( WIDGET_EVENT_TAB_NEXT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) ); AddEventAction( WIDGET_EVENT_TAB_PREV ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuItems" ); if ( menuGUI != NULL ) { idSWFScriptObject & root = menuGUI->GetRootObject(); BindSprite( root ); } infoBox.SetSpritePath( GetSpritePath(), "info", "details" ); infoBox.Initialize( data ); infoBox.SetNoAutoFree( true ); itemList.SetSpritePath( GetSpritePath(), "info", "options" ); itemList.SetNumVisibleOptions( NUM_INVENTORY_ITEMS_VISIBLE ); itemList.SetNoAutoFree( true ); while ( itemList.GetChildren().Num() < NUM_INVENTORY_ITEMS_VISIBLE ) { idMenuWidget_Button * const buttonWidget = new (TAG_SWF) idMenuWidget_Button(); buttonWidget->Initialize( data ); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_PDA_ITEM, itemList.GetChildren().Num() ); itemList.AddChild( buttonWidget ); } itemList.Initialize( data ); AddChild( &itemList ); AddChild( &infoBox ); //AddChild( assignment ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ) ); idMenuScreen::Initialize( data ); }
/* ======================== idMenuScreen_Shell_Dev::Initialize ======================== */ void idMenuScreen_Shell_Dev::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuSettings" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_DEV_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); while( options->GetChildren().Num() < NUM_DEV_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "MAIN MENU" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); SetupDevOptions(); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_GameBrowser::Initialize ======================== */ void idMenuScreen_Shell_GameBrowser::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuPWF" ); listWidget = new idMenuWidget_GameBrowserList(); listWidget->SetSpritePath( GetSpritePath(), "info", "options" ); listWidget->SetNumVisibleOptions( NUM_SERVER_LIST_ITEMS ); listWidget->SetWrappingAllowed( true ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, 1 ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, -1 ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, 1 ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_SCROLL_VERTICAL, -1 ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); listWidget->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER ); AddChild( listWidget ); idMenuWidget_Help * const helpWidget = new ( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); while ( listWidget->GetChildren().Num() < NUM_SERVER_LIST_ITEMS ) { idMenuWidget_ServerButton * buttonWidget = new idMenuWidget_ServerButton; buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, listWidget->GetChildren().Num() ); buttonWidget->SetState( WIDGET_STATE_HIDDEN ); buttonWidget->RegisterEventObserver( helpWidget ); listWidget->AddChild( buttonWidget ); } btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_multiplayer" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); }
/* ======================== idMenuWidget_LobbyList::Update ======================== */ void idMenuWidget_LobbyList::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) ) { return; } for( int i = 0; i < headings.Num(); ++i ) { idSWFTextInstance* txtHeading = GetSprite()->GetScriptObject()->GetNestedText( va( "heading%d", i ) ); if( txtHeading != NULL ) { txtHeading->SetText( headings[i] ); txtHeading->SetStrokeInfo( true, 0.75f, 1.75f ); } } for( int optionIndex = 0; optionIndex < GetNumVisibleOptions(); ++optionIndex ) { bool shown = false; if( optionIndex < GetChildren().Num() ) { idMenuWidget& child = GetChildByIndex( optionIndex ); child.SetSpritePath( GetSpritePath(), va( "item%d", optionIndex ) ); if( child.BindSprite( root ) ) { shown = PrepareListElement( child, optionIndex ); if( shown ) { child.GetSprite()->SetVisible( true ); child.Update(); } else { child.GetSprite()->SetVisible( false ); } } } } }
/* ======================== idMenuWidget_DevList::RecalculateDevMenu ======================== */ void idMenuWidget_DevList::RecalculateDevMenu() { if ( devMapListInfos.Num() > 0 ) { const idDeclDevMenuList * const devMenuListDecl = idDeclDevMenuList::resourceList.Load( devMapListInfos[ devMapListInfos.Num() - 1 ].name, false ); if ( devMenuListDecl != NULL ) { devMenuList = devMenuListDecl; } } idSWFScriptObject & root = gameLocal->GetMainMenu()->GetSWF()->GetRootObject(); for ( int i = 0; i < GetChildren().Num(); ++i ) { idMenuWidget & child = GetChildByIndex( i ); child.SetSpritePath( GetSpritePath(), va( "option%d", i ) ); if ( child.BindSprite( root ) ) { child.SetState( WIDGET_STATE_NORMAL ); child.GetSprite()->StopFrame( 1 ); } } }
/* ======================== idMenuWidget_DynamicList::Recalculate ======================== */ void idMenuWidget_DynamicList::Recalculate() { idSWF * swf = GetSWFObject(); if ( swf == NULL ) { return; } idSWFScriptObject & root = swf->GetRootObject(); for ( int i = 0; i < GetChildren().Num(); ++i ) { idMenuWidget & child = GetChildByIndex( i ); child.SetSpritePath( GetSpritePath(), "info", "list", va( "item%d", i ) ); if ( child.BindSprite( root ) ) { child.SetState( WIDGET_STATE_NORMAL ); child.GetSprite()->StopFrame( 1 ); } } }
/* ======================== idMenuWidget_PDA_AudioFiles::Initialize ======================== */ void idMenuWidget_PDA_AudioFiles::Initialize( idMenuHandler* data ) { idMenuWidget_DynamicList* pdaAudioList = new( TAG_SWF ) idMenuWidget_DynamicList(); pdaAudioList->SetSpritePath( GetSpritePath(), "info", "options" ); pdaAudioList->SetNumVisibleOptions( MAX_AUDIO_ITEMS ); pdaAudioList->SetWrappingAllowed( true ); while( pdaAudioList->GetChildren().Num() < MAX_AUDIO_ITEMS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_PDA_AUDIO, pdaAudioList->GetChildren().Num() ); buttonWidget->Initialize( data ); pdaAudioList->AddChild( buttonWidget ); } pdaAudioList->Initialize( data ); AddChild( pdaAudioList ); }
/* ======================== idMenuScreen_Shell_PartyLobby::Initialize ======================== */ void idMenuScreen_Shell_PartyLobby::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuPartyLobby" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_LOBBY_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); AddChild( options ); idMenuWidget_Help* const helpWidget = new( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); while( options->GetChildren().Num() < NUM_LOBBY_OPTIONS ) { idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button(); buttonWidget->Initialize( data ); buttonWidget->RegisterEventObserver( helpWidget ); options->AddChild( buttonWidget ); } options->Initialize( data ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_02305" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); lobby = new( TAG_SWF ) idMenuWidget_LobbyList(); lobby->SetNumVisibleOptions( 8 ); lobby->SetSpritePath( GetSpritePath(), "options" ); lobby->SetWrappingAllowed( true ); lobby->Initialize( data ); while( lobby->GetChildren().Num() < 8 ) { idMenuWidget_LobbyButton* const buttonWidget = new idMenuWidget_LobbyButton(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_GAMERTAG, lobby->GetChildren().Num() ); buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, lobby->GetChildren().Num() ); buttonWidget->Initialize( data ); lobby->AddChild( buttonWidget ); } AddChild( lobby ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( lobby, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( lobby, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_RSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( lobby, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( lobby, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Leaderboards::Initialize ======================== */ void idMenuScreen_Shell_Leaderboards::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } lbCache = new idLBCache(); lbCache->Reset(); SetSpritePath( "menuLeaderboards" ); options = new (TAG_SWF) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_LEADERBOARD_ITEMS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); while ( options->GetChildren().Num() < NUM_LEADERBOARD_ITEMS ) { idMenuWidget_Button * const buttonWidget = new (TAG_SWF) idMenuWidget_Button(); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); buttonWidget->Initialize( data ); options->AddChild( buttonWidget ); } options->Initialize( data ); AddChild( options ); btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_party_lobby" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); btnNext = new (TAG_SWF) idMenuWidget_Button(); btnNext->Initialize( data ); btnNext->SetLabel( "#str_swf_next" ); btnNext->SetSpritePath( GetSpritePath(), "info", "btnNext" ); btnNext->AddEventAction( WIDGET_EVENT_PRESS ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) ); AddChild( btnNext ); btnPrev = new (TAG_SWF) idMenuWidget_Button(); btnPrev->Initialize( data ); btnPrev->SetLabel( "#str_swf_prev" ); btnPrev->SetSpritePath( GetSpritePath(), "info", "btnPrevious" ); btnPrev->AddEventAction( WIDGET_EVENT_PRESS ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) ); AddChild( btnPrev ); btnPageDwn = new (TAG_SWF) idMenuWidget_Button(); btnPageDwn->Initialize( data ); btnPageDwn->SetLabel( "#str_swf_next_page" ); btnPageDwn->SetSpritePath( GetSpritePath(), "info", "btnPageDwn" ); idSWFParmList parms; parms.Append( MAX_STAT_LISTINGS - 1 ); btnPageDwn->AddEventAction( WIDGET_EVENT_PRESS ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_PAGE_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_PAGEDWN ) ); btnPageDwn->AddEventAction( WIDGET_EVENT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_PAGEDWN_RELEASE ) ); AddChild( btnPageDwn ); btnPageUp = new (TAG_SWF) idMenuWidget_Button(); btnPageUp->Initialize( data ); btnPageUp->SetLabel( "#str_swf_prev_page" ); btnPageUp->SetSpritePath( GetSpritePath(), "info", "btnPageUp" ); parms.Clear(); parms.Append( MAX_STAT_LISTINGS - 1 ); btnPageUp->AddEventAction( WIDGET_EVENT_PRESS ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_PAGE_UP_START_REPEATER, WIDGET_EVENT_SCROLL_PAGEUP ) ); btnPageUp->AddEventAction( WIDGET_EVENT_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_PAGEUP_RELEASE ) ); AddChild( btnPageUp ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_PAGEDWN ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_PAGE_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_PAGEDWN ) ); AddEventAction( WIDGET_EVENT_SCROLL_PAGEUP ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_PAGE_UP_START_REPEATER, WIDGET_EVENT_SCROLL_PAGEUP ) ); AddEventAction( WIDGET_EVENT_SCROLL_PAGEDWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_PAGEDWN_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_PAGEUP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_PAGEUP_RELEASE ) ); AddEventAction( WIDGET_EVENT_TAB_NEXT ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) ); AddEventAction( WIDGET_EVENT_TAB_PREV ).Set( new (TAG_SWF) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) ); leaderboards.Clear(); const idList< mpMap_t > maps = common->GetMapList(); const char ** gameModes = NULL; const char ** gameModesDisplay = NULL; int numModes = game->GetMPGameModes( &gameModes, &gameModesDisplay ); for ( int mapIndex = 0; mapIndex < maps.Num(); ++mapIndex ) { for ( int modeIndex = 0; modeIndex < numModes; ++modeIndex ) { // Check the supported modes on the map. if( maps[ mapIndex ].supportedModes & BIT( modeIndex ) ) { int boardID = LeaderboardLocal_GetID( mapIndex, modeIndex ); const leaderboardDefinition_t * lbDef = Sys_FindLeaderboardDef( boardID ); if ( lbDef != NULL ) { doomLeaderboard_t lb = doomLeaderboard_t( lbDef, lbDef->boardName ); leaderboards.Append( lb ); } } } } }
/* ======================== idMenuScreen_Shell_SystemOptions::Initialize ======================== */ void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuSystemOptions" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_SYSTEM_OPTIONS_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); options->SetControlList( true ); options->Initialize( data ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_settings" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( options ); AddChild( btnBack ); idMenuWidget_ControlButton* control; control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_02154" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_swf_framerate" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FRAMERATE ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FRAMERATE ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_04126" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VSYNC ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VSYNC ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_04128" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_ANTIALIASING ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_ANTIALIASING ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_swf_motionblur" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR ); options->AddChild( control ); // RB begin control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "Soft Shadows" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SHADOWMAPPING ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SHADOWMAPPING ); options->AddChild( control ); /*control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_swf_lodbias" ); control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_LODBIAS ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_LODBIAS ); options->AddChild( control );*/ // RB end control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_02155" ); // Brightness control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_BRIGHTNESS ); control->SetupEvents( 2, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_BRIGHTNESS ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_02163" ); // Volume control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VOLUME ); control->SetupEvents( 2, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VOLUME ); options->AddChild( control ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Gamepad::Initialize ======================== */ void idMenuScreen_Shell_Gamepad::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuGamepad" ); options = new (TAG_SWF) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_CONTROLS_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); options->SetControlList( true ); options->Initialize( data ); AddChild( options ); idMenuWidget_Help * const helpWidget = new ( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); idStr controls( idLocalization::GetString( "#str_04158" ) ); controls.ToUpper(); btnBack->SetLabel( controls ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); idMenuWidget_ControlButton * control; #ifndef ID_PC control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_BUTTON_TEXT ); control->SetLabel( "#str_swf_gamepad_config" ); // Gamepad Configuration control->SetDescription( "#str_swf_config_desc" ); control->RegisterEventObserver( helpWidget ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_CONFIG ); options->AddChild( control ); #endif control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_lefty_flip" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_LEFTY ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_LEFTY ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_invert_gamepad" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_INVERT ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_INVERT ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_vibration" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VIBRATE ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_VIBRATE ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_swf_hor_sens" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_HOR_SENS ); control->SetupEvents( 2, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_HOR_SENS ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_swf_vert_sens" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VERT_SENS ); control->SetupEvents( 2, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_VERT_SENS ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_joy_gammaLook" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_ACCELERATION ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_ACCELERATION ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_joy_mergedThreshold" ); control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_THRESHOLD ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_THRESHOLD ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuWidget_NavBar::PrepareListElement ======================== */ void idMenuWidget_NavBar::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) ) { return; } int rightIndex = 0; buttonPos = initialPos; for( int index = 0; index < GetNumVisibleOptions() - 1; ++index ) { idSWFSpriteInstance* const rightOption = GetSprite()->GetScriptObject()->GetSprite( va( "optionRight%d", index ) ); rightOption->SetVisible( false ); idSWFSpriteInstance* const leftOption = GetSprite()->GetScriptObject()->GetSprite( va( "optionLeft%d", index ) ); leftOption->SetVisible( false ); } for( int index = 0; index < GetTotalNumberOfOptions(); ++index ) { idMenuWidget& child = GetChildByIndex( index ); idMenuWidget_NavButton* const button = dynamic_cast< idMenuWidget_NavButton* >( &child ); button->SetLabel( "" ); } for( int index = 0; index < GetNumVisibleOptions(); ++index ) { if( index < GetFocusIndex() ) { idMenuWidget& child = GetChildByIndex( index ); child.SetSpritePath( GetSpritePath(), va( "optionLeft%d", index ) ); if( child.BindSprite( root ) ) { PrepareListElement( child, index ); child.Update(); } } else if( index > GetFocusIndex() ) { int rightChildIndex = ( GetNumVisibleOptions() - 1 ) + ( index - 1 ); idMenuWidget& child = GetChildByIndex( rightChildIndex ); child.SetSpritePath( GetSpritePath(), va( "optionRight%d", rightIndex ) ); rightIndex++; if( child.BindSprite( root ) ) { PrepareListElement( child, index ); child.Update(); } } else { int mainIndex = GetTotalNumberOfOptions() - 1; idMenuWidget& child = GetChildByIndex( mainIndex ); child.SetSpritePath( GetSpritePath(), va( "option" ) ); if( child.BindSprite( root ) ) { PrepareListElement( child, index ); child.Update(); } } } }
/* ======================== idMenuScreen_Shell_ModeSelect::Initialize ======================== */ void idMenuScreen_Shell_ModeSelect::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuModeSelect" ); options = new (TAG_SWF) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_SETTING_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); AddChild( options ); idMenuWidget_Help * const helpWidget = new ( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); const idStrList & modes = common->GetModeDisplayList(); idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions; for ( int i = 0; i < modes.Num(); ++i ) { idList< idStr > option; option.Append( modes[i] ); menuOptions.Append( option ); } options->SetListData( menuOptions ); const char * tips[] = { "#str_swf_deathmatch_desc", "#str_swf_tourney_desc", "#str_swf_team_deathmatch_desc", "#str_swf_lastman_desc", "#str_swf_ctf_desc" }; while ( options->GetChildren().Num() < NUM_SETTING_OPTIONS ) { idMenuWidget_Button * const buttonWidget = new (TAG_SWF) idMenuWidget_Button(); buttonWidget->Initialize( data ); buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); if ( options->GetChildren().Num() < menuOptions.Num() ) { buttonWidget->SetDescription( tips[options->GetChildren().Num()] ); } buttonWidget->RegisterEventObserver( helpWidget ); options->AddChild( buttonWidget ); } options->Initialize( data ); btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_multiplayer" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }
/* ======================== idMenuScreen_Shell_Controls::Initialize ======================== */ void idMenuScreen_Shell_Controls::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuControls" ); options = new( TAG_SWF ) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_CONTROLS_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); options->SetControlList( true ); options->Initialize( data ); AddChild( options ); idMenuWidget_Help* const helpWidget = new( TAG_SWF ) idMenuWidget_Help(); helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" ); AddChild( helpWidget ); btnBack = new( TAG_SWF ) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_settings" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); idMenuWidget_ControlButton* control; control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_BUTTON_TEXT ); control->SetLabel( "#str_swf_keyboard" ); // KEY BINDINGS control->SetDescription( "#str_swf_binding_desc" ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, CONTROLS_CMD_BINDINGS ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_BUTTON_TEXT ); control->SetLabel( "#str_swf_gamepad" ); // Gamepad control->SetDescription( "#str_swf_gamepad_desc" ); control->RegisterEventObserver( helpWidget ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, CONTROLS_CMD_GAMEPAD ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_gamepad_enabled" ); // Gamepad Enabled control->SetDataSource( &controlData, idMenuDataSource_ControlSettings::CONTROLS_FIELD_GAMEPAD_ENABLED ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, CONTROLS_CMD_GAMEPAD_ENABLED ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TOGGLE ); control->SetLabel( "#str_swf_invert_mouse" ); // Invert Mouse control->SetDataSource( &controlData, idMenuDataSource_ControlSettings::CONTROLS_FIELD_INVERT_MOUSE ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, CONTROLS_CMD_INVERT ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_BAR ); control->SetLabel( "#str_swf_mouse_sens" ); // Mouse Sensitivity control->SetDataSource( &controlData, idMenuDataSource_ControlSettings::CONTROLS_FIELD_MOUSE_SENS ); control->SetupEvents( 2, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, CONTROLS_CMD_MOUSE_SENS ); control->RegisterEventObserver( helpWidget ); options->AddChild( control ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) ); }