/* ======================== idMenuScreen_Shell_Controls::Update ======================== */ void idMenuScreen_Shell_Controls::Update() { if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_SWF_SELECT"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if( heading != NULL ) { idStr controls( idLocalization::GetString( "#str_04158" ) ); controls.ToUpper(); heading->SetText( controls ); // CONTROLS heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } if( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== 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::Show ======================== */ void idMenuWidget::Show() { if( GetSWFObject() == NULL ) { return; } if( !BindSprite( GetSWFObject()->GetRootObject() ) ) { return; } GetSprite()->SetVisible( true ); int currentFrame = GetSprite()->GetCurrentFrame(); int findFrame = GetSprite()->FindFrame( "rollOn" ); int idleFrame = GetSprite()->FindFrame( "idle" ); if( currentFrame == findFrame || ( currentFrame > 1 && currentFrame <= idleFrame ) ) { return; } GetSprite()->PlayFrame( findFrame ); }
/* ======================== idMenuWidget_InfoBox::ObserveEvent ======================== */ void idMenuWidget_InfoBox::ResetInfoScroll() { idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( !BindSprite( root ) || GetSprite() == NULL ){ return; } idSWFTextInstance * txtBody = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBody" ); if ( txtBody != NULL ) { txtBody->scroll = 0; } if ( scrollbar != NULL ) { scrollbar->Update(); } }
/* ======================== idMenuScreen_Shell_Leaderboards::Update ======================== */ void idMenuScreen_Shell_Leaderboards::Update() { if ( menuData != NULL ) { idMenuWidget_CommandBar * cmdBar = menuData->GetCmdBar(); if ( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t * buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if ( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); buttonInfo->label = "#str_online_leaderboards_toggle_filter"; buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS ); if ( !lbCache->IsLoadingNewLeaderboard() && !lbCache->IsRequestingRows() && options != NULL && options->GetTotalNumberOfOptions() > 0 ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if ( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_view_profile"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } } } idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( BindSprite( root ) ) { idSWFTextInstance * heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if ( heading != NULL ) { heading->SetText( lbCache->GetFilterStrType() ); heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance * gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if ( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } if ( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== idMenuScreen_Shell_Stereoscopics::Update ======================== */ void idMenuScreen_Shell_Stereoscopics::Update() { if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if( heading != NULL ) { heading->SetText( "#str_swf_stereoscopics_heading" ); // STEREOSCOPIC RENDERING heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } if( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== 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 ); } } }
/* ======================== idMenuScreen_Shell_GameBrowser::ShowScreen ======================== */ void idMenuScreen_Shell_GameBrowser::ShowScreen( const mainMenuTransition_t transitionType ) { idMenuHandler_Shell * const mgr = dynamic_cast< idMenuHandler_Shell * >( menuData ); if ( mgr == NULL ) { return; } idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( BindSprite( root ) ) { idSWFTextInstance * heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if ( heading != NULL ) { heading->SetText( "#str_swf_pwf_heading" ); // MULTIPLAYER heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance * gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if ( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } listWidget->ClearGames(); if ( mgr->GetCmdBar() != NULL ) { idMenuWidget_CommandBar::buttonInfo_t * buttonInfo; mgr->GetCmdBar()->ClearAllButtons(); buttonInfo = mgr->GetCmdBar()->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if ( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = mgr->GetCmdBar()->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); buttonInfo->label = "#str_02276"; buttonInfo->action.Set( WIDGET_ACTION_COMMAND, BROWSER_COMMAND_REFRESH_SERVERS ); } mgr->HidePacifier(); idMenuScreen::ShowScreen( transitionType ); UpdateServerList(); }
/* ======================== idMenuScreen_Shell_PartyLobby::ShowScreen ======================== */ void idMenuScreen_Shell_PartyLobby::ShowScreen( const mainMenuTransition_t transitionType ) { isPeer = false; isHost = false; idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFSpriteInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedSprite( "waitTime" ); if( waitTime != NULL ) { waitTime->SetVisible( false ); } } if( session->GetPartyLobbyBase().IsHost() ) { idMatchParameters matchParameters = session->GetPartyLobbyBase().GetMatchParms(); if( net_inviteOnly.GetBool() ) { matchParameters.matchFlags |= MATCH_INVITE_ONLY; } else { matchParameters.matchFlags &= ~MATCH_INVITE_ONLY; } matchParameters.numSlots = session->GetTitleStorageInt( "MAX_PLAYERS_ALLOWED", 4 ); session->UpdatePartyParms( matchParameters ); } idMenuScreen::ShowScreen( transitionType ); if( lobby != NULL ) { lobby->SetFocusIndex( 0 ); } }
/* ======================== idMenuScreen_Shell_GameLobby::Update ======================== */ void idMenuScreen_Shell_GameLobby::Update() { idLobbyBase& activeLobby = session->GetActivePlatformLobbyBase(); if( lobby != NULL ) { if( activeLobby.GetNumActiveLobbyUsers() != 0 ) { if( lobby->GetFocusIndex() >= activeLobby.GetNumActiveLobbyUsers() ) { lobby->SetFocusIndex( activeLobby.GetNumActiveLobbyUsers() - 1 ); lobby->SetViewIndex( lobby->GetViewOffset() + lobby->GetFocusIndex() ); } } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if( heading != NULL ) { heading->SetText( "#str_swf_multiplayer" ); // MULTIPLAYER heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } if( privateGameLobby && options != NULL ) { if( session->GetActivePlatformLobbyBase().IsHost() && !isHost ) { menuOptions.Clear(); idList< idStr > option; isHost = true; isPeer = false; option.Append( "#str_swf_start_match" ); // Start match menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_match_settings" ); // Match Settings menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_invite_only" ); // Toggle privacy menuOptions.Append( option ); option.Clear(); option.Append( "#str_swf_invite_friends" ); // Invite Friends menuOptions.Append( option ); option.Clear(); idMenuWidget_Button* buttonWidget = NULL; int index = 0; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_START, 0 ); buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_quick_start_desc" ); } index++; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_SETTINGS, 1 ); buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_match_setting_desc" ); } index++; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_TOGGLE_PRIVACY, 2 ); buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_toggle_privacy_desc" ); } index++; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 3 ); buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_invite_desc" ); } index++; options->SetListData( menuOptions ); } else if( session->GetActivePlatformLobbyBase().IsPeer() ) { if( !isPeer ) { menuOptions.Clear(); idList< idStr > option; option.Append( "#str_swf_invite_friends" ); // Invite Friends menuOptions.Append( option ); option.Clear(); idMenuWidget_Button* buttonWidget = NULL; int index = 0; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 0 ); buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_invite_desc" ); } options->SetListData( menuOptions ); } isPeer = true; isHost = false; } } if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_view_profile"; } buttonInfo->action.Set( WIDGET_ACTION_SELECT_GAMERTAG ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_SWF_SELECT"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); lobbyUserID_t luid; if( isHost && CanKickSelectedPlayer( luid ) ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY4 ); buttonInfo->label = "#str_swf_kick"; buttonInfo->action.Set( WIDGET_ACTION_JOY4_ON_PRESS ); } } } if( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== idMenuScreen_HUD::UpdateChattingHud ======================== */ void idMenuScreen_HUD::UpdateChattingHud( idPlayer * player ) { if ( !mpChatObject || !GetSWFObject() ) { return; } idSWF * gui = GetSWFObject(); if ( player->isChatting == 0 ) { if ( mpChatObject->GetCurrentFrame() != 1 ) { mpChatObject->StopFrame( 1 ); gui->ForceInhibitControl( false ); gui->SetGlobal( "focusWindow", 0 ); } } else { if ( !mpChatObject->IsVisible() ) { mpChatObject->SetVisible( true ); mpChatObject->PlayFrame( "rollOn" ); gui->ForceInhibitControl( true ); idSWFTextInstance * txtType = mpChatObject->GetScriptObject()->GetNestedText( "info", "saybox" ); int length = 0; if ( txtType ) { if ( player->isChatting == 1 ) { txtType->SetText( "#str_swf_talk_all" ); } else if ( player->isChatting == 2 ) { txtType->SetText( "#str_swf_talk_team" ); } txtType->SetStrokeInfo( true ); length = txtType->GetTextLength(); } idSWFSpriteInstance * sayBox = mpChatObject->GetScriptObject()->GetNestedSprite( "info", "textEntry" ); if ( sayBox ) { sayBox->SetXPos( length + 10 ); } idSWFTextInstance * say = mpChatObject->GetScriptObject()->GetNestedText( "info", "textEntry", "txtVal" ); if ( say != NULL ) { say->SetIgnoreColor( false ); say->SetText( "" ); say->SetStrokeInfo( true ); say->renderMode = SWF_TEXT_RENDER_AUTOSCROLL; } idSWFScriptObject * const sayObj = mpChatObject->GetScriptObject()->GetNestedObj( "info", "textEntry", "txtVal" ); if ( sayObj != NULL ) { gui->SetGlobal( "focusWindow", sayObj ); class idPostTextChat : public idSWFScriptFunction_RefCounted { public: idPostTextChat( idPlayer * _player, idSWFTextInstance * _text ) { player = _player; text = _text; } idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) { if ( !player || !text ) { return idSWFScriptVar(); } idStr val = text->text; val.Replace( "\'", "" ); val.Replace( "\"", "" ); idStr command; if ( player->isChatting == 2 ) { command = va( "sayTeam %s\n", val.c_str() ); } else { command = va( "say %s\n", val.c_str() ); } cmdSystem->BufferCommandText( CMD_EXEC_NOW, command.c_str() ); player->isChatting = 0; return idSWFScriptVar(); } idPlayer * player; idSWFTextInstance * text; }; class idCancelTextChat : public idSWFScriptFunction_RefCounted { public: idCancelTextChat( idPlayer * _player ) { player = _player; } idSWFScriptVar Call( idSWFScriptObject * thisObject, const idSWFParmList & parms ) { if ( !player ) { return idSWFScriptVar(); } player->isChatting = 0; return idSWFScriptVar(); } idPlayer * player; }; sayObj->Set( "onPress", new ( TAG_SWF ) idPostTextChat( player, say ) ); idSWFScriptObject * const shortcutKeys = gui->GetGlobal( "shortcutKeys" ).GetObject(); if ( verify( shortcutKeys != NULL ) ) { shortcutKeys->Set( "ENTER", sayObj ); shortcutKeys->Set( "ESCAPE", new ( TAG_SWF ) idCancelTextChat( player ) ); } } } } }
/* ======================== idMenuWidget_PDA_AudioFiles::Update ======================== */ void idMenuWidget_PDA_AudioFiles::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) || GetSprite() == NULL ) { return; } idPlayer* player = gameLocal.GetLocalPlayer(); if( player == NULL ) { return; } if( pdaIndex > player->GetInventory()->pdas.Num() ) { return; } const idDeclPDA* pda = player->GetInventory()->pdas[ pdaIndex ]; idSWFScriptObject* dataObj = GetSprite()->GetScriptObject()->GetNestedObj( "info" ); if( dataObj != NULL && pda != NULL ) { idSWFTextInstance* txtOwner = dataObj->GetNestedText( "txtOwner" ); if( txtOwner != NULL ) { idStr ownerText = idLocalization::GetString( "#str_04203" ); ownerText.Append( ": " ); ownerText.Append( pda->GetFullName() ); txtOwner->SetText( ownerText.c_str() ); } idMenuWidget_DynamicList* const audioList = dynamic_cast< idMenuWidget_DynamicList* >( &GetChildByIndex( 0 ) ); if( audioList != NULL ) { audioFileNames.Clear(); if( pda->GetNumAudios() == 0 ) { idList< idStr > audioName; audioName.Append( idLocalization::GetString( "#str_04168" ) ); audioList->GetChildByIndex( 0 ).SetState( WIDGET_STATE_DISABLED ); audioFileNames.Append( audioName ); } else { audioList->GetChildByIndex( 0 ).SetState( WIDGET_STATE_NORMAL ); const idDeclAudio* aud = NULL; for( int index = 0; index < pda->GetNumAudios(); ++index ) { idList< idStr > audioName; aud = pda->GetAudioByIndex( index ); if( aud != NULL ) { audioName.Append( aud->GetAudioName() ); } else { audioName.Append( "" ); } audioFileNames.Append( audioName ); } } audioList->SetListData( audioFileNames ); if( audioList->BindSprite( root ) ) { audioList->Update(); } } } //idSWFSpriteInstance * dataSprite = dataObj->GetSprite(); }
/* ======================== idMenuScreen_Scoreboard::ShowScreen ======================== */ void idMenuScreen_Scoreboard::ShowScreen( const mainMenuTransition_t transitionType ) { idMenuScreen::ShowScreen( transitionType ); if( GetSWFObject() ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScoreboard" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02618" ); txtVal->SetStrokeInfo( true, 0.9f, 2.0f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameType" ); if( txtVal != NULL ) { idStr mode = idLocalization::GetString( "#str_02376" ); mode.Append( ": " ); const idStrList& modes = common->GetModeDisplayList(); idStr modeName = idLocalization::GetString( modes[ idMath::ClampInt( 0, modes.Num() - 1, gameLocal.gameType ) ] ); mode.Append( idLocalization::GetString( idLocalization::GetString( modeName ) ) ); txtVal->SetText( mode ); txtVal->SetStrokeInfo( true, 0.9f, 1.8f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02181" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore" ); if( txtVal != NULL ) { if( gameLocal.gameType == GAME_LASTMAN ) { txtVal->SetText( idLocalization::GetString( "#str_04242" ) ); } else if( gameLocal.gameType == GAME_CTF ) { txtVal->SetText( idLocalization::GetString( "#str_11112" ) ); } else { txtVal->SetText( idLocalization::GetString( "#str_04243" ) ); } txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02619" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02048" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading2" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02181" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore2" ); if( txtVal != NULL ) { if( gameLocal.gameType == GAME_LASTMAN ) { txtVal->SetText( idLocalization::GetString( "#str_04242" ) ); } else if( gameLocal.gameType == GAME_CTF ) { txtVal->SetText( idLocalization::GetString( "#str_11112" ) ); } else { txtVal->SetText( idLocalization::GetString( "#str_04243" ) ); } txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins2" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02619" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing2" ); if( txtVal != NULL ) { txtVal->SetText( "#str_02048" ); txtVal->SetStrokeInfo( true, 0.75f, 1.75f ); } } } }
/* ======================== idMenuWidget_CommandBar::Update ======================== */ void idMenuWidget_CommandBar::Update() { if ( GetSWFObject() == NULL ) { return; } idSWFScriptObject & root = GetSWFObject()->GetRootObject(); if ( !BindSprite( root ) ) { return; } const int BASE_PADDING = 35; const int PER_BUTTON_PADDING = 65; const int ALIGNMENT_SCALE = ( GetAlignment() == LEFT ) ? 1 : -1; int xPos = ALIGNMENT_SCALE * BASE_PADDING; // Setup the button order. idStaticList< button_t, MAX_BUTTONS > buttonOrder; for ( int i = 0; i < buttonOrder.Max(); ++i ) { buttonOrder.Append( static_cast< button_t >( i ) ); } // NOTE: Special consideration is done for JPN PS3 where the standard accept button is // swapped with the standard back button. i.e. In US: X = Accept, O = Back, but in JPN // X = Back, O = Accept. if ( GetSWFObject()->UseCircleForAccept() ) { buttonOrder[ BUTTON_JOY2 ] = BUTTON_JOY1; buttonOrder[ BUTTON_JOY1 ] = BUTTON_JOY2; } // FIXME: handle animating in of the button bar? GetSprite()->SetVisible( true ); idStr shortcutName; for ( int i = 0; i < buttonOrder.Num(); ++i ) { const char * const buttonName = BUTTON_NAMES[ buttonOrder[ i ] ]; idSWFSpriteInstance * const buttonSprite = GetSprite()->GetScriptObject()->GetSprite( buttonName ); if ( buttonSprite == NULL ) { continue; } idSWFTextInstance * const buttonText = buttonSprite->GetScriptObject()->GetText( "txt_info" ); if ( buttonText == NULL ) { continue; } idSWFSpriteInstance * const imageSprite = buttonSprite->GetScriptObject()->GetSprite( "img" ); if ( imageSprite == NULL ) { continue; } if ( buttons[ i ].action.GetType() != WIDGET_ACTION_NONE ) { idSWFScriptObject * const shortcutKeys = GetSWFObject()->GetGlobal( "shortcutKeys" ).GetObject(); if ( verify( shortcutKeys != NULL ) ) { buttonSprite->GetScriptObject()->Set( "onPress", new WrapWidgetSWFEvent( this, WIDGET_EVENT_COMMAND, i ) ); // bind the main action - need to use all caps here because shortcuts are stored that way shortcutName = buttonName; shortcutName.ToUpper(); shortcutKeys->Set( shortcutName, buttonSprite->GetScriptObject() ); // Some other keys have additional bindings. Remember that the button here is // actually the virtual button, and the physical button could be swapped based // on the UseCircleForAccept business on JPN PS3. switch ( i ) { case BUTTON_JOY1: { shortcutKeys->Set( "ENTER", buttonSprite->GetScriptObject() ); break; } case BUTTON_JOY2: { shortcutKeys->Set( "ESCAPE", buttonSprite->GetScriptObject() ); shortcutKeys->Set( "BACKSPACE", buttonSprite->GetScriptObject() ); break; } case BUTTON_TAB: { shortcutKeys->Set( "K_TAB", buttonSprite->GetScriptObject() ); break; } } } if ( buttons[ i ].label.IsEmpty() ) { buttonSprite->SetVisible( false ); } else { imageSprite->SetVisible( true ); imageSprite->StopFrame( menuData->GetPlatform() + 1 ); buttonSprite->SetVisible( true ); buttonSprite->SetXPos( xPos ); buttonText->SetText( buttons[ i ].label ); xPos += ALIGNMENT_SCALE * ( buttonText->GetTextLength() + PER_BUTTON_PADDING ); } } else { buttonSprite->SetVisible( false ); idSWFScriptObject * const shortcutKeys = GetSWFObject()->GetGlobal( "shortcutKeys" ).GetObject(); if ( verify( shortcutKeys != NULL ) ) { buttonSprite->GetScriptObject()->Set( "onPress", 0 ); // bind the main action - need to use all caps here because shortcuts are stored that way shortcutName = buttonName; shortcutName.ToUpper(); shortcutKeys->Set( shortcutName, buttonSprite->GetScriptObject() ); } } } }
/* ======================== idMenuScreen_PDA_UserEmails::Initialize ======================== */ void idMenuScreen_PDA_UserEmails::Initialize( idMenuHandler* data ) { idMenuScreen::Initialize( data ); if( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuEmail" ); pdaInbox.SetSpritePath( GetSpritePath(), "info", "inbox" ); pdaInbox.Initialize( data ); pdaInbox.SetNoAutoFree( true ); emailScrollbar.SetSpritePath( GetSpritePath(), "info", "email", "info", "scrollbar" ); emailScrollbar.Initialize( data ); emailScrollbar.SetNoAutoFree( true ); emailInfo.SetSpritePath( GetSpritePath(), "info", "email" ); emailInfo.Initialize( data ); emailInfo.SetScrollbar( &emailScrollbar ); emailInfo.AddChild( &emailScrollbar ); emailInfo.RegisterEventObserver( this ); emailInfo.AddEventAction( WIDGET_EVENT_ROLL_OVER ).Set( WIDGET_ACTION_EMAIL_HOVER, 1 ); emailInfo.AddEventAction( WIDGET_EVENT_ROLL_OUT ).Set( WIDGET_ACTION_EMAIL_HOVER, 0 ); emailInfo.SetNoAutoFree( true ); AddChild( &pdaInbox ); AddChild( &emailInfo ); if( pdaInbox.GetEmailList() != NULL ) { pdaInbox.GetEmailList()->RegisterEventObserver( &emailInfo ); pdaInbox.GetEmailList()->RegisterEventObserver( &emailScrollbar ); for( int i = 0; i < pdaInbox.GetEmailList()->GetChildren().Num(); ++i ) { idMenuWidget& child = pdaInbox.GetEmailList()->GetChildByIndex( i ); idMenuWidget_Button* const button = dynamic_cast< idMenuWidget_Button* >( &child ); if( button != NULL ) { button->RegisterEventObserver( &emailInfo ); } } } AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_RSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RSTICK_RELEASE ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_RSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RSTICK_RELEASE ) ); 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 ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, 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_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, 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_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 ) ); class idInfoBoxRefresh : public idSWFScriptFunction_RefCounted { public: idInfoBoxRefresh( idMenuWidget_InfoBox* _widget ) : widget( _widget ) { } idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms ) { if( widget == NULL ) { return idSWFScriptVar(); } widget->Update(); return idSWFScriptVar(); } private: idMenuWidget_InfoBox* widget; }; if( GetSWFObject() != NULL ) { GetSWFObject()->SetGlobal( "refreshInfoBox", new( TAG_SWF ) idInfoBoxRefresh( &emailInfo ) ); } }
/* ======================== 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() ); } }
/* ======================== idMenuWidget_ScrollBar::Update ======================== */ void idMenuWidget_ScrollBar::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) || GetSprite() == NULL ) { return; } if( GetParent() == NULL ) { return; } CalcTopAndBottom(); idSWFScriptObject* node = GetSprite()->GetScriptObject()->GetNestedObj( "node" ); idSWFSpriteInstance* nodeSprite = GetSprite()->GetScriptObject()->GetNestedSprite( "node" ); if( node != NULL && nodeSprite != NULL ) { node->Set( "onDrag", new( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_DRAG_START, 0 ) ); node->Set( "onRelease", new( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_DRAG_STOP, 0 ) ); const idMenuWidget_DynamicList* const list = dynamic_cast< const idMenuWidget_DynamicList* const >( GetParent() ); if( list != NULL ) { float percent = 0.0f; if( ( list->GetTotalNumberOfOptions() - list->GetNumVisibleOptions() ) > 0 ) { percent = ( float )list->GetViewOffset() / ( ( float )list->GetTotalNumberOfOptions() - list->GetNumVisibleOptions() ); float range = yBot - yTop; nodeSprite->SetVisible( true ); nodeSprite->SetYPos( percent * range ); //GetSprite()->StopFrame( int( ( percent * 100.0f ) + 2.0f ) ); } else { nodeSprite->SetVisible( 0 ); } } idMenuWidget_InfoBox* const infoBox = dynamic_cast< idMenuWidget_InfoBox* const >( GetParent() ); if( infoBox != NULL ) { float percent = 0.0f; if( infoBox->GetMaxScroll() == 0 ) { nodeSprite->SetVisible( 0 ); } else { percent = ( float )infoBox->GetScroll() / ( float )infoBox->GetMaxScroll(); float range = yBot - yTop; nodeSprite->SetVisible( true ); nodeSprite->SetYPos( percent * range ); //GetSprite()->StopFrame( int( ( percent * 100.0f ) + 2.0f ) ); } } } }
/* ======================== idMenuScreen_Shell_Save::UpdateSaveEnumerations ======================== */ void idMenuScreen_Shell_Save::UpdateSaveEnumerations() { const saveGameDetailsList_t& saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames(); sortedSaves = saveGameInfo; idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > saveList; int newSaveOffset = 1; bool hasAutosave = false; if( session->GetSaveGameManager().IsWorking() ) { idList< idStr > saveName; saveName.Append( "#str_dlg_refreshing" ); saveList.Append( saveName ); if( options != NULL ) { options->SetListData( saveList ); options->Update(); } } else { for( int i = 0; i < saveGameInfo.Num(); ++i ) { if( saveGameInfo[i].slotName.Icmp( "autosave" ) == 0 ) { hasAutosave = true; break; } } if( saveGameInfo.Num() == MAX_SAVEGAMES || ( !hasAutosave && saveGameInfo.Num() == MAX_SAVEGAMES - 1 ) ) { newSaveOffset = 0; } if( newSaveOffset != 0 ) { idList< idStr > newSave; newSave.Append( "#str_swf_new_save_game" ); saveList.Append( newSave ); } if( options != NULL ) { sortedSaves.Sort( idSort_SavesByDate() ); for( int slot = 0; slot < sortedSaves.Num(); ++slot ) { const idSaveGameDetails& details = sortedSaves[slot]; if( details.slotName.Icmp( "autosave" ) == 0 ) { sortedSaves.RemoveIndex( slot ); slot--; } } // +1 because the first item is "New Save" saveList.SetNum( sortedSaves.Num() + newSaveOffset ); for( int slot = 0; slot < sortedSaves.Num(); ++slot ) { idStr& slotSaveName = saveList[ slot + newSaveOffset ].Alloc(); const idSaveGameDetails& details = sortedSaves[slot]; if( details.damaged ) { slotSaveName = va( S_COLOR_RED "%s", idLocalization::GetString( "#str_swf_corrupt_file" ) ); } else if( details.GetSaveVersion() > BUILD_NUMBER ) { slotSaveName = va( S_COLOR_RED "%s", idLocalization::GetString( "#str_swf_wrong_version" ) ); } else { if( details.slotName.Icmp( "autosave" ) == 0 ) { slotSaveName.Append( S_COLOR_YELLOW ); } else if( details.slotName.Icmp( "quick" ) == 0 ) { slotSaveName.Append( S_COLOR_ORANGE ); } slotSaveName.Append( details.GetMapName() ); } } options->SetListData( saveList ); options->Update(); } } if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; // BACK } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); if( !session->GetSaveGameManager().IsWorking() ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_02179"; // SAVE GAME } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); if( options != NULL ) { if( options->GetViewIndex() != 0 || ( options->GetViewIndex() == 0 && newSaveOffset == 0 ) ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_02315"; // DELETE } buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS ); if( btnDelete != NULL ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( btnDelete->BindSprite( root ) ) { if( menuData->GetPlatform() != 2 ) { btnDelete->SetLabel( "" ); } else { btnDelete->GetSprite()->SetVisible( true ); btnDelete->SetLabel( "#str_02315" ); } } btnDelete->Update(); } } else { if( btnDelete != NULL ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( btnDelete->BindSprite( root ) ) { btnDelete->SetLabel( "" ); btnDelete->Update(); } } } } } cmdBar->Update(); } } if( saveInfo != NULL ) { saveInfo->Update(); } if( options != NULL && options->GetTotalNumberOfOptions() > 0 && options->GetViewIndex() >= options->GetTotalNumberOfOptions() ) { options->SetViewIndex( options->GetTotalNumberOfOptions() - newSaveOffset ); if( options->GetViewOffset() > options->GetViewIndex() ) { options->SetViewOffset( options->GetViewIndex() ); } options->SetFocusIndex( options->GetViewIndex() - options->GetViewOffset() ); } }
/* ======================== idMenuScreen_Shell_ControllerLayout::Update ======================== */ void idMenuScreen_Shell_ControllerLayout::Update() { if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if( heading != NULL ) { heading->SetText( "#str_swf_controller_layout" ); // CONTROLLER LAYOUT heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } if( menuData != NULL ) { idSWFSpriteInstance* layout = NULL; layout = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "controlInfo", "layout360" ); if( layout != NULL ) { if( menuData->GetPlatform( true ) == 2 ) { layout->StopFrame( 1 ); } else { layout->StopFrame( menuData->GetPlatform( true ) + 1 ); } } } } if( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== idMenuWidget_PDA_EmailInbox::Update ======================== */ void idMenuWidget_PDA_EmailInbox::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) || GetSprite() == NULL ) { return; } idPlayer* player = gameLocal.GetLocalPlayer(); if( player == NULL ) { return; } if( pdaIndex > player->GetInventory().pdas.Num() ) { return; } const idDeclPDA* pda = player->GetInventory().pdas[ pdaIndex ]; idSWFScriptObject* dataObj = GetSprite()->GetScriptObject()->GetNestedObj( "info" ); if( dataObj != NULL && pda != NULL ) { idSWFTextInstance* txtOwner = dataObj->GetNestedText( "heading", "txtOwner" ); if( txtOwner != NULL ) { idStr ownerText = idLocalization::GetString( "#str_01474" ); ownerText.Append( ": " ); if( pdaIndex == 0 ) { ownerText.Append( session->GetLocalUserName( 0 ) ); } else { ownerText.Append( pda->GetFullName() ); } txtOwner->SetText( ownerText.c_str() ); if( pdaIndex == 0 ) { txtOwner->SetIgnoreColor( false ); } else { txtOwner->SetIgnoreColor( false ); txtOwner->SetText( pda->GetFullName() ); } } if( emailList != NULL ) { const idDeclEmail* email = NULL; emailInfo.Clear(); for( int index = 0; index < pda->GetNumEmails(); ++index ) { idList< idStr > emailData; email = pda->GetEmailByIndex( index ); if( email != NULL ) { emailData.Append( email->GetFrom() ); emailData.Append( email->GetSubject() ); emailData.Append( email->GetDate() ); } emailInfo.Append( emailData ); } emailList->SetListData( emailInfo ); if( emailList->BindSprite( root ) ) { emailList->Update(); } } } }
/* ======================== idMenuScreen_Shell_PartyLobby::Update ======================== */ void idMenuScreen_Shell_PartyLobby::Update() { idLobbyBase& activeLobby = session->GetPartyLobbyBase(); if( lobby != NULL ) { if( activeLobby.GetNumActiveLobbyUsers() != 0 ) { if( lobby->GetFocusIndex() >= activeLobby.GetNumActiveLobbyUsers() ) { lobby->SetFocusIndex( activeLobby.GetNumActiveLobbyUsers() - 1 ); lobby->SetViewIndex( lobby->GetViewOffset() + lobby->GetFocusIndex() ); } } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" ); if( heading != NULL ) { heading->SetText( "#str_swf_multiplayer" ); // MULTIPLAYER heading->SetStrokeInfo( true, 0.75f, 1.75f ); } idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" ); if( gradient != NULL && heading != NULL ) { gradient->SetXPos( heading->GetTextLength() ); } } UpdateOptions(); if( menuData != NULL && menuData->NextScreen() == SHELL_AREA_PARTY_LOBBY ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_00395"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_SWF_SELECT"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); lobbyUserID_t luid; if( isHost && CanKickSelectedPlayer( luid ) ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY4 ); buttonInfo->label = "#str_swf_kick"; buttonInfo->action.Set( WIDGET_ACTION_JOY4_ON_PRESS ); } buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_view_profile"; } buttonInfo->action.Set( WIDGET_ACTION_SELECT_GAMERTAG ); } } if( btnBack != NULL ) { btnBack->BindSprite( root ); } idMenuScreen::Update(); }
/* ======================== idMenuScreen_Shell_GameLobby::ShowScreen ======================== */ void idMenuScreen_Shell_GameLobby::ShowScreen( const mainMenuTransition_t transitionType ) { if( options != NULL ) { options->SetFocusIndex( 0 ); options->SetViewIndex( 0 ); } isHost = false; isPeer = false; idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms(); // Make sure map name is up to date. if( matchParameters.gameMap >= 0 ) { matchParameters.mapName = common->GetMapList()[ matchParameters.gameMap ].mapFile; } privateGameLobby = MatchTypeIsPrivate( matchParameters.matchFlags ); if( !privateGameLobby ) // Public Game Lobby { menuOptions.Clear(); idList< idStr > option; if( options != NULL ) { option.Append( "#str_swf_invite_friends" ); // Invite Friends menuOptions.Append( option ); option.Clear(); int index = 0; options->GetChildByIndex( index ).ClearEventActions(); options->GetChildByIndex( index ).AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAME_CMD_INVITE, 0 ); idMenuWidget_Button* buttonWidget = dynamic_cast< idMenuWidget_Button* >( &options->GetChildByIndex( index ) ); if( buttonWidget != NULL ) { buttonWidget->SetDescription( "#str_swf_invite_desc" ); } options->SetListData( menuOptions ); } longCountdown = Sys_Milliseconds() + WAIT_START_TIME_LONG; longCountRemaining = longCountdown; shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFSpriteInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedSprite( "waitTime" ); if( waitTime != NULL ) { waitTime->SetVisible( !privateGameLobby ); } } idMenuScreen::ShowScreen( transitionType ); if( lobby != NULL ) { lobby->SetFocusIndex( 0 ); } session->UpdateMatchParms( matchParameters ); }
/* ======================== idMenuScreen_Shell_Load::UpdateSaveEnumerations ======================== */ void idMenuScreen_Shell_Load::UpdateSaveEnumerations() { const saveGameDetailsList_t& saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames(); sortedSaves = saveGameInfo; sortedSaves.Sort( idSort_SavesByDate() ); if( options != NULL ) { idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > saveList; if( session->GetSaveGameManager().IsWorking() ) { idList< idStr > saveName; saveName.Append( "#str_dlg_refreshing" ); saveList.Append( saveName ); } else if( sortedSaves.Num() == 0 ) { idList< idStr > saveName; saveName.Append( "#str_no_saves_found" ); saveList.Append( saveName ); } else { saveList.SetNum( sortedSaves.Num() ); for( int slot = 0; slot < sortedSaves.Num(); ++slot ) { idStr& slotSaveName = saveList[slot].Alloc(); const idSaveGameDetails& details = sortedSaves[slot]; if( details.damaged ) { slotSaveName = va( S_COLOR_RED "%s", idLocalization::GetString( "#str_swf_corrupt_file" ) ); } else if( details.GetSaveVersion() > BUILD_NUMBER ) { slotSaveName = va( S_COLOR_RED "%s", idLocalization::GetString( "#str_swf_wrong_version" ) ); } else { if( details.slotName.Icmp( "autosave" ) == 0 ) { slotSaveName.Append( S_COLOR_YELLOW ); } else if( details.slotName.Icmp( "quick" ) == 0 ) { slotSaveName.Append( S_COLOR_ORANGE ); } slotSaveName.Append( details.GetMapName() ); } } } options->SetListData( saveList ); options->Update(); } if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar(); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_back"; // BACK } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); if( sortedSaves.Num() > 0 && !session->GetSaveGameManager().IsWorking() ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_load_heading"; // LOAD GAME } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_load_delete"; // DELETE GAME } buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS ); if( btnDelete != NULL ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( btnDelete->BindSprite( root ) ) { if( menuData->GetPlatform() != 2 ) { btnDelete->SetLabel( "" ); } else { btnDelete->GetSprite()->SetVisible( true ); btnDelete->SetLabel( "#str_swf_load_delete" ); } } btnDelete->Update(); } } else { if( btnDelete != NULL ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( btnDelete->BindSprite( root ) ) { btnDelete->SetLabel( "" ); btnDelete->Update(); } } } cmdBar->Update(); } } if( saveInfo != NULL ) { saveInfo->Update(); } if( options != NULL && options->GetTotalNumberOfOptions() > 0 && options->GetViewIndex() >= options->GetTotalNumberOfOptions() ) { options->SetViewIndex( options->GetTotalNumberOfOptions() - 1 ); if( options->GetViewOffset() > options->GetViewIndex() ) { options->SetViewOffset( options->GetViewIndex() ); } options->SetFocusIndex( options->GetViewIndex() - options->GetViewOffset() ); } }
/* ======================== idMenuWidget_Shell_SaveInfo::Update ======================== */ void idMenuWidget_Shell_SaveInfo::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) || GetSprite() == NULL ) { return; } const saveGameDetailsList_t& saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames(); saveGameDetailsList_t sortedSaves = saveGameInfo; sortedSaves.Sort( idSort_SavesByDate() ); for( int slot = 0; slot < sortedSaves.Num(); ++slot ) { const idSaveGameDetails& details = sortedSaves[slot]; if( forSaveScreen && details.slotName.Icmp( "autosave" ) == 0 ) { sortedSaves.RemoveIndex( slot ); slot--; } } idStr info; if( loadIndex >= 0 && sortedSaves.Num() != 0 && loadIndex < sortedSaves.Num() ) { const idSaveGameDetails& details = sortedSaves[ loadIndex ]; info.Append( Sys_TimeStampToStr( details.date ) ); info.Append( "\n" ); // PS3 only strings that use the dict just set const char* expansionStr = ""; switch( details.GetExpansion() ) { case GAME_D3XP: expansionStr = idLocalization::GetString( "#str_swf_resurrection" ); break; case GAME_D3LE: expansionStr = idLocalization::GetString( "#str_swf_lost_episodes" ); break; case GAME_BASE: expansionStr = idLocalization::GetString( "#str_swf_doom3" ); break; default: expansionStr = idLocalization::GetString( "#str_savegame_title" ); break; } const char* difficultyStr = ""; switch( details.GetDifficulty() ) { case 0: difficultyStr = idLocalization::GetString( "#str_swf_difficulty_easy" ); // easy break; case 1: difficultyStr = idLocalization::GetString( "#str_swf_difficulty_medium" ); // medium break; case 2: difficultyStr = idLocalization::GetString( "#str_swf_difficulty_hard" ); // hard break; case 3: difficultyStr = idLocalization::GetString( "#str_swf_difficulty_impossible" ); // impossible break; } idStr summary; summary.Format( idLocalization::GetString( "#str_swf_save_info_format" ), difficultyStr, Sys_SecToStr( details.GetPlaytime() ), expansionStr ); info.Append( summary ); if( details.damaged ) { info.Append( "\n" ); info.Append( va( "^1%s^0", idLocalization::GetString( "#str_swf_damaged" ) ) ); } else if( details.GetSaveVersion() > BUILD_NUMBER ) { info.Append( "\n" ); info.Append( va( "^1%s^0", idLocalization::GetString( "#str_swf_wrong_version" ) ) ); } } idSWFTextInstance* infoSprite = GetSprite()->GetScriptObject()->GetNestedText( "txtDesc" ); if( infoSprite != NULL ) { infoSprite->SetText( info ); } idSWFSpriteInstance* img = GetSprite()->GetScriptObject()->GetNestedSprite( "img" ); if( img != NULL ) { // TODO_SPARTY: until we have a thumbnail hide the image if(forSaveScreen ) img->SetVisible( false ); else img->SetVisible( true ); if( saveGameThumbnails[loadIndex] != NULL ) { // Use Detected Thumbnail img->SetMaterial( saveGameThumbnails[loadIndex] ); } else { if(saveThumbDefault != NULL) { // Use Default Thumbnail. img->SetMaterial( saveThumbDefault ); } else { // No thumbnail Image exists. img->SetVisible( false ); } } } }
/* ======================== idMenuScreen_Shell_PressStart::ShowScreen ======================== */ void idMenuScreen_Shell_PressStart::ShowScreen( const mainMenuTransition_t transitionType ) { idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { if( g_demoMode.GetBool() ) { idList<const idMaterial*> coverIcons; if( itemList != NULL ) { itemList->SetListImages( coverIcons ); } if( startButton != NULL ) { startButton->BindSprite( root ); startButton->SetLabel( idLocalization::GetString( "#str_swf_press_start" ) ); } idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" ); if( backing != NULL ) { backing->SetVisible( false ); } } else { idList<const idMaterial*> coverIcons; coverIcons.Append( doomCover ); coverIcons.Append( doom3Cover ); coverIcons.Append( doom2Cover ); if( itemList != NULL ) { itemList->SetListImages( coverIcons ); itemList->SetFocusIndex( 1, true ); itemList->SetViewIndex( 1 ); itemList->SetMoveToIndex( 1 ); } if( startButton != NULL ) { startButton->BindSprite( root ); startButton->SetLabel( "" ); } idSWFSpriteInstance* backing = GetSprite()->GetScriptObject()->GetNestedSprite( "backing" ); if( backing != NULL ) { backing->SetVisible( true ); } } } idMenuScreen::ShowScreen( transitionType ); }
/* ======================== idMenuScreen_Shell_GameLobby::UpdateLobby ======================== */ void idMenuScreen_Shell_GameLobby::UpdateLobby() { if( menuData != NULL && menuData->ActiveScreen() != SHELL_AREA_GAME_LOBBY ) { return; } // Keep this menu in sync with the session host/peer status. if( session->GetActivePlatformLobbyBase().IsHost() && !isHost ) { Update(); } if( session->GetActivePlatformLobbyBase().IsPeer() && !isPeer ) { Update(); } if( !privateGameLobby ) { int ms = 0; if( session->GetActivePlatformLobbyBase().IsHost() ) { idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* const >( menuData ); if( handler != NULL ) { if( session->GetActivePlatformLobbyBase().IsLobbyFull() ) { longCountdown = Sys_Milliseconds() + longCountRemaining; int timeRemaining = shortCountdown - Sys_Milliseconds(); if( timeRemaining < 0 ) { timeRemaining = 0; } ms = ( int ) ceilf( timeRemaining / 1000.0f ); handler->SetTimeRemaining( timeRemaining ); } else if( session->GetActivePlatformLobbyBase().GetNumLobbyUsers() > 1 ) { int timeRemaining = longCountdown - Sys_Milliseconds(); if( timeRemaining > WAIT_START_TIME_SHORT ) { shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT; } else { shortCountdown = timeRemaining; } longCountRemaining = timeRemaining; if( timeRemaining < 0 ) { timeRemaining = 0; } ms = ( int ) ceilf( timeRemaining / 1000.0f ); handler->SetTimeRemaining( timeRemaining ); } else { ms = 0; longCountdown = Sys_Milliseconds() + WAIT_START_TIME_LONG; longCountRemaining = longCountdown; shortCountdown = Sys_Milliseconds() + WAIT_START_TIME_SHORT; handler->SetTimeRemaining( longCountRemaining ); } } } else { if( menuData != NULL ) { idMenuHandler_Shell* handler = dynamic_cast< idMenuHandler_Shell* const >( menuData ); if( handler != NULL ) { ms = ( int ) ceilf( handler->GetTimeRemaining() / 1000.0f ); } } } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( BindSprite( root ) ) { idSWFTextInstance* waitTime = GetSprite()->GetScriptObject()->GetNestedText( "waitTime", "txtVal" ); if( waitTime != NULL ) { idStr status; if( ms == 1 ) { status = idLocalization::GetString( "#str_online_game_starts_in_second" ); status.Replace( "<DNT_VAL>", idStr( ms ) ); waitTime->SetText( status ); } else if( ms > 0 && ms < 30 ) { status = idLocalization::GetString( "#str_online_game_starts_in_seconds" ); status.Replace( "<DNT_VAL>", idStr( ms ) ); waitTime->SetText( status ); } else { waitTime->SetText( "" ); } waitTime->SetStrokeInfo( true, 0.75f, 2.0f ); } } Update(); } else { if( isPeer ) { Update(); } } if( session->GetState() == idSession::GAME_LOBBY ) { if( options != NULL ) { if( options->GetFocusIndex() >= options->GetTotalNumberOfOptions() && options->GetTotalNumberOfOptions() > 0 ) { options->SetViewIndex( options->GetTotalNumberOfOptions() - 1 ); options->SetFocusIndex( options->GetTotalNumberOfOptions() - 1 ); } } idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms(); idSWFTextInstance* mapName = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtMapName" ); idSWFTextInstance* modeName = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtModeName" ); if( mapName != NULL ) { const idList< mpMap_t > maps = common->GetMapList(); idStr name = idLocalization::GetString( maps[ idMath::ClampInt( 0, maps.Num() - 1, matchParameters.gameMap ) ].mapName ); mapName->SetText( name ); mapName->SetStrokeInfo( true ); } if( modeName != NULL ) { const idStrList& modes = common->GetModeDisplayList(); idStr mode = idLocalization::GetString( modes[ idMath::ClampInt( 0, modes.Num() - 1, matchParameters.gameMode ) ] ); modeName->SetText( mode ); modeName->SetStrokeInfo( true ); } idSWFTextInstance* privacy = GetSprite()->GetScriptObject()->GetNestedText( "matchInfo", "txtPrivacy" ); if( privacy != NULL ) { if( isPeer || !privateGameLobby ) { privacy->SetText( "" ); } else { int bitSet = ( matchParameters.matchFlags & MATCH_INVITE_ONLY ); bool privacySet = ( bitSet != 0 ? true : false ); if( privacySet ) { privacy->SetText( "#str_swf_privacy_closed" ); privacy->SetStrokeInfo( true ); } else if( !privacySet ) { privacy->SetText( "#str_swf_privacy_open" ); privacy->SetStrokeInfo( true ); } } } idLocalUser* user = session->GetSignInManager().GetMasterLocalUser(); if( user != NULL && options != NULL ) { if( user->IsInParty() && user->GetPartyCount() > 1 && !session->IsPlatformPartyInLobby() && menuOptions.Num() > 0 ) { if( menuOptions[ menuOptions.Num() - 1 ][0] != "#str_swf_invite_xbox_live_party" ) { menuOptions[ menuOptions.Num() - 1 ][0] = "#str_swf_invite_xbox_live_party"; // invite Xbox LIVE party options->SetListData( menuOptions ); options->Update(); } } else if( menuOptions.Num() > 0 ) { if( menuOptions[ menuOptions.Num() - 1 ][0] != "#str_swf_invite_friends" ) { menuOptions[ menuOptions.Num() - 1 ][0] = "#str_swf_invite_friends"; // invite Xbox LIVE party options->SetListData( menuOptions ); options->Update(); } } } } // setup names for lobby; if( lobby != NULL ) { idMenuHandler_Shell* mgr = dynamic_cast< idMenuHandler_Shell* >( menuData ); if( mgr != NULL ) { mgr->UpdateLobby( lobby ); lobby->Update(); } if( lobby->GetNumEntries() > 0 && lobby->GetFocusIndex() >= lobby->GetNumEntries() ) { lobby->SetFocusIndex( lobby->GetNumEntries() - 1 ); lobby->SetViewIndex( lobby->GetNumEntries() - 1 ); } } }
/* ======================== 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_PDA_VideoDisks::Update ======================== */ void idMenuScreen_PDA_VideoDisks::Update() { idPlayer* player = gameLocal.GetLocalPlayer(); if( menuData != NULL ) { idMenuWidget_CommandBar* cmdBar = dynamic_cast< idMenuWidget_CommandBar* const >( menuData->GetChildFromIndex( PDA_WIDGET_CMD_BAR ) ); if( cmdBar != NULL ) { cmdBar->ClearAllButtons(); idMenuWidget_CommandBar::buttonInfo_t* buttonInfo; buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_01345"; } buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_TAB ); buttonInfo->label = ""; buttonInfo->action.Set( WIDGET_ACTION_GO_BACK ); if( player != NULL && player->GetInventory().videos.Num() > 0 ) { if( player->GetVideoMaterial() == NULL ) { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_play"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } else { buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 ); if( menuData->GetPlatform() != 2 ) { buttonInfo->label = "#str_swf_stop"; } buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED ); } } } } if( player != NULL ) { //if ( pdaVideoList == NULL ) { // idMenuScreen::Update(); // return; //} idSWFScriptObject& root = GetSWFObject()->GetRootObject(); int index = pdaVideoList.GetViewIndex(); const idDeclVideo* video = player->GetVideo( index ); if( video == NULL ) { idMenuScreen::Update(); return; } if( player->GetVideoMaterial() != NULL ) { // update video material if( BindSprite( root ) && GetSprite() != NULL ) { idSWFSpriteInstance* videoSprite = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "details", "video", "img" ); const idMaterial* mat = player->GetVideoMaterial(); if( videoSprite != NULL && mat != NULL ) { videoSprite->SetMaterial( mat ); } } } else { idSWFSpriteInstance* videoSprite = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "details", "video", "img" ); if( videoSprite != NULL ) { videoSprite->SetMaterial( video->GetPreview() ); } } } idMenuScreen::Update(); }
/* ======================== idMenuWidget_PDA_Objective::Update ======================== */ void idMenuWidget_PDA_Objective::Update() { if( GetSWFObject() == NULL ) { return; } idSWFScriptObject& root = GetSWFObject()->GetRootObject(); if( !BindSprite( root ) || GetSprite() == NULL ) { return; } idPlayer* player = gameLocal.GetLocalPlayer(); if( player == NULL ) { return; } idSWFScriptObject* dataObj = GetSprite()->GetScriptObject()->GetNestedObj( "info" ); idSWFSpriteInstance* dataSprite = dataObj->GetSprite(); if( dataObj != NULL && dataSprite != NULL ) { idSWFSpriteInstance* img = dataObj->GetNestedSprite( "objImg", "img" ); if( player->GetInventory().objectiveNames.Num() == 0 ) { dataSprite->StopFrame( 1 ); } else { int numObjectives = player->GetInventory().objectiveNames.Num(); int objStartIndex = 0; if( numObjectives == 1 ) { dataSprite->StopFrame( 2 ); objStartIndex = 0; } else { dataSprite->StopFrame( 3 ); objStartIndex = 1; } idSWFTextInstance* txtDesc = dataObj->GetNestedText( "txtDesc" ); int displayCount = 0; for( int index = numObjectives - 1; displayCount < 2 && index >= 0; --index ) { if( img != NULL ) { if( player->GetInventory().objectiveNames[index].screenshot == NULL ) { img->SetVisible( false ); } else { img->SetVisible( true ); img->SetMaterial( player->GetInventory().objectiveNames[index].screenshot ); } } idSWFSpriteInstance* objSel = dataObj->GetNestedSprite( va( "obj%d", objStartIndex - displayCount ), "sel" ); idSWFTextInstance* txtNote = dataObj->GetNestedText( va( "obj%d", objStartIndex - displayCount ), "txtVal" ); if( objSel != NULL ) { if( displayCount == 0 ) { objSel->SetVisible( true ); } else { objSel->SetVisible( false ); } } if( txtNote != NULL ) { txtNote->SetText( player->GetInventory().objectiveNames[index].title.c_str() ); } if( displayCount == 0 ) { txtDesc->SetText( player->GetInventory().objectiveNames[index].text.c_str() ); } displayCount++; } } // Set the main objective text idTarget_SetPrimaryObjective* mainObj = player->GetPrimaryObjective(); idSWFTextInstance* txtMainObj = dataObj->GetNestedText( "txtObj" ); if( txtMainObj != NULL ) { if( mainObj != NULL ) { txtMainObj->SetText( mainObj->spawnArgs.GetString( "text", idLocalization::GetString( "#str_04253" ) ) ); } else { txtMainObj->SetText( idLocalization::GetString( "#str_02526" ) ); } } } }