void MissionCompleteStatsLine::UpdateLabels()
{
	C_ASW_Game_Resource* pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	if (m_iMarineIndex <0 || m_iMarineIndex>=pGameResource->GetMaxMarineResources())
	{
		m_pNameLabel->SetText("");
		m_pMedalArea->SetMarineResource(NULL);
		Q_snprintf(m_szCurrentName, sizeof(m_szCurrentName), "");
		return;	
	}
	
	C_ASW_Marine_Resource* pMR = pGameResource->GetMarineResource(m_iMarineIndex);
	if (m_pMedalArea)
		m_pMedalArea->SetMarineResource(pMR);
	if (pMR)
	{
		if ( pMR->GetProfile() && Q_strcmp( pMR->GetProfile()->m_ShortName, m_szCurrentName ) )
		{
			m_pNameLabel->SetText(pMR->GetProfile()->m_ShortName);
			Q_snprintf(m_szCurrentName, sizeof(m_szCurrentName), "%s", pMR->GetProfile()->m_ShortName);
		}
		SetBgColor(m_pBGColor);
	}
	else
	{
		m_pNameLabel->SetText("");
	}

	// todo: reset stats bars
}
void CASWHud3DMarineNames::PaintMarineNameLabels()
{
	C_ASW_Player *local = C_ASW_Player::GetLocalASWPlayer();
	if ( !local )
		return;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	int count = 0;
	int my_count = 0;
	for ( int i = 0; i < pGameResource->GetMaxMarineResources(); i++ )
	{
		C_ASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR && pMR->GetHealthPercent() > 0 )
		{
			C_ASW_Marine *pMarine = pMR->GetMarineEntity();
			if ( pMarine )
			{
				if ( pMarine->GetCommander() == local )
				{
					PaintMarineLabel( my_count, pMarine, pMR, local->GetMarine() == pMarine );
					my_count++;
				}
				else
				{
					PaintMarineLabel( -1, pMarine, pMR, false );
				}

				count++;
			}
		}		
	}
}
void listroster_f(void)
{
	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	for (int i=0;i<ASW_NUM_MARINE_PROFILES;i++)
	{
		Msg("[C] Roster %d selected=%d\n", i, pGameResource->IsRosterSelected(i));
	}
}
void CASWHudPortraits::OnThink()
{
    VPROF_BUDGET( "CASWHudPortraits::OnThink", VPROF_BUDGETGROUP_ASW_CLIENT );

    int iNumMyMarines = 0;
    int iNumOtherMarines = 0;
    C_ASW_Player *local = C_ASW_Player::GetLocalASWPlayer();
    if ( local )
    {
        C_ASW_Game_Resource* pGameResource = ASWGameResource();
        if (pGameResource)
        {
            for (int i=0; i<pGameResource->GetMaxMarineResources(); i++)
            {
                C_ASW_Marine_Resource* pMR = pGameResource->GetMarineResource(i);
                if (pMR)
                {
                    if (pMR->GetCommander() == local)
                    {
                        m_hMyMarine[iNumMyMarines] = pMR;

                        iNumMyMarines++;
                        if (pMR->GetMarineEntity() == local->GetMarine())
                            m_hCurrentlySelectedMarineResource = pMR;
                    }
                    else if (!(ASWGameRules() && ASWGameRules()->IsTutorialMap()))	// in tutorial, don't show marines not under your command
                    {
                        m_hOtherMarine[iNumOtherMarines] = pMR;
                        iNumOtherMarines++;
                    }
                }
            }
            // clear out future slots
            for (int i=iNumMyMarines; i<ASW_MAX_MARINE_RESOURCES; i++)
            {
                m_hMyMarine[i] == NULL;
            }
            for (int i=iNumOtherMarines; i<ASW_MAX_MARINE_RESOURCES; i++)
            {
                m_hOtherMarine[i] == NULL;
            }
        }
    }
    // JOYPAD REMOVED
    //bool bJoypadModeChanged = (m_bLastJoypadMode != engine->ASW_IsJoypadMode());
    //m_bLastJoypadMode = engine->ASW_IsJoypadMode();
    bool bJoypadModeChanged = m_bLastJoypadMode = false;
    bool bResize = ((m_iNumMyMarines != iNumMyMarines) || (m_iNumOtherMarines != iNumOtherMarines) || bJoypadModeChanged);
    m_iNumMyMarines = iNumMyMarines;
    m_iNumOtherMarines = iNumOtherMarines;

    UpdatePortraits(bResize);
}
// displays the mission objectives in the game resource
void ListObjectives(void)
{
	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	for (int i=0;i<12;i++)
	{
		if ( pGameResource->GetObjective(i) == NULL )
			Msg("Objective %d = empty\n", i);
	}
}
void MissionCompletePlayerStatsLine::UpdateLabels()
{
	C_ASW_Game_Resource* pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	if ( m_iPlayerIndex < 1 || m_iPlayerIndex>gpGlobals->maxClients )
	{
		m_pNameLabel->SetText("");
		if ( m_pMedalArea )
		{
			m_pMedalArea->SetProfileIndex( -1 );
		}

		m_wszCurrentName[ 0 ] = L'\0';
		return;
	}

	C_ASW_Player *pPlayer = dynamic_cast<C_ASW_Player*>( UTIL_PlayerByIndex( m_iPlayerIndex ) );
	if ( !pPlayer )
		return;

	wchar_t wszPlayerName[ 64 ];
	g_pVGuiLocalize->ConvertANSIToUnicode( g_PR->GetPlayerName( m_iPlayerIndex ), wszPlayerName, sizeof( wszPlayerName ) );

	wchar_t wszPlayerStatus[ 64 ];
	wszPlayerStatus[ 0 ] = L'\0';
	if ( m_iPlayerIndex == pGameResource->GetLeaderEntIndex() )
	{				
		V_wcsncpy( wszPlayerStatus, g_pVGuiLocalize->Find( "#asw_stats_player_status_leader" ), sizeof( wszPlayerStatus ) );
	}
	else if ( pGameResource->IsPlayerReady(m_iPlayerIndex) )
	{
		V_wcsncpy( wszPlayerStatus, g_pVGuiLocalize->Find( "#asw_stats_player_status_ready" ), sizeof( wszPlayerStatus ) );
	}

	char szPlayerXP[ 64 ];
	V_snprintf( szPlayerXP, sizeof( szPlayerXP ), "%d", pPlayer->GetExperience() );
	wchar_t wszPlayerXP[ 64 ];
	g_pVGuiLocalize->ConvertANSIToUnicode( szPlayerXP, wszPlayerXP, sizeof( wszPlayerXP ) );

	g_pVGuiLocalize->ConstructString( m_wszCurrentName, sizeof( m_wszCurrentName ), g_pVGuiLocalize->Find( "#asw_stats_player_name" ), 3, wszPlayerName, wszPlayerStatus, wszPlayerXP );
	m_pNameLabel->SetText( m_wszCurrentName );

	if ( m_pMedalArea )
	{
		m_pMedalArea->SetProfileIndex( m_iPlayerIndex - 1 );
	}

	SetBgColor( m_pBGColor );		
}
Exemple #7
0
void StatsReport::OnThink()
{
	int nMarine = 0;

	m_pObjectiveMap->ClearBlips();

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			Vector vPos;
			vPos.x = pMR->m_TimelinePosX.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.y = pMR->m_TimelinePosY.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.z = 0.0f;

			bool bDead = ( pMR->m_TimelineHealth.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp ) <= 0.0f );
			
			m_pObjectiveMap->AddBlip( MapBlip_t( vPos, bDead ? Color( 255, 255, 255, 255 ) : getColorPerIndex(pMR->GetCommanderIndex()), bDead ? MAP_BLIP_TEXTURE_DEATH : MAP_BLIP_TEXTURE_NORMAL ) );

			if ( m_pReadyCheckImages[ nMarine ]->IsVisible() )
			{
				C_ASW_Player *pPlayer = pMR->GetCommander();
				if ( pPlayer )
				{
					if ( !pMR->IsInhabited() || ASWGameResource()->IsPlayerReady( pPlayer ) )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxTicked" );
					}
					else if ( pPlayer == ASWGameResource()->GetLeader() )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/PlayerList/LeaderIcon" );
					}
					else
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxEmpty" );
					}
				}
			}

			nMarine++;
		}
	}

	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		
	}
}
	// if the player has his mouse over another marine, highlight it, cos he's the one we can give health to
	void CASW_Weapon_Medical_Satchel::MouseOverEntity(C_BaseEntity *pEnt, Vector vecWorldCursor)
	{
		C_ASW_Marine* pOtherMarine = C_ASW_Marine::AsMarine( pEnt );
		CASW_Player *pOwner = GetCommander();
		CASW_Marine *pMarine = GetMarine();
		if (!pOwner || !pMarine)
			return;

		float fOtherHealth = 1.0f;
		if (pOtherMarine && pOtherMarine->GetMarineResource())
			fOtherHealth = pOtherMarine->GetMarineResource()->GetHealthPercent();
		if (!pOtherMarine)
		{
			C_ASW_Game_Resource *pGameResource = ASWGameResource();
			if (pGameResource)
			{
				// find marine closest to world cursor
				const float fMustBeThisClose = 70;
				const C_ASW_Game_Resource::CMarineToCrosshairInfo::tuple_t &info = pGameResource->GetMarineCrosshairCache()->GetClosestMarine();
				if ( info.m_fDistToCursor <= fMustBeThisClose )
				{
					pOtherMarine = info.m_hMarine.Get();
				}
			}
		}

		// if the marine our cursor is over is near enough, highlight him
		if (pOtherMarine)
		{
			float dist = (pMarine->GetAbsOrigin() - pOtherMarine->GetAbsOrigin()).Length2D();
			if (dist < MAX_HEAL_DISTANCE)
			{
				bool bCanGiveHealth = ( fOtherHealth < 1.0f && m_iClip1 > 0 );
				ASWInput()->SetHighlightEntity( pOtherMarine, bCanGiveHealth );
				if ( bCanGiveHealth )		// if he needs healing, show the give health cursor
				{
					CASWHudCrosshair *pCrosshair = GET_HUDELEMENT( CASWHudCrosshair );
					if ( pCrosshair )
					{
						pCrosshair->SetShowGiveHealth(true);
					}
				}
			}
		}		
	}
void CASWHudEmotes::PaintEmotes()
{
    C_ASW_Game_Resource *pGameResource = ASWGameResource();
    if (!pGameResource)
        return;

    for (int i=0; i<pGameResource->GetMaxMarineResources(); i++)
    {
        C_ASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
        if (!pMR)
            continue;

        C_ASW_Marine *marine = pMR->GetMarineEntity();
        if ( !marine )
            continue;

        PaintEmotesFor(marine);
    }
}
void ReturnCampaignMapButton::OnThink()
{
	BaseClass::OnThink();

	C_ASW_Player* player = C_ASW_Player::GetLocalASWPlayer();
	if (!player || !ASWGameRules())
		return;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	bool bLeader = (player == pGameResource->GetLeader());

	// only show this button if you successfully complete a campaign mission - otherwise the start/ready button in the corner will offer restart options for the leader
	if (bLeader && ASWGameRules()->IsCampaignGame() && ASWGameRules()->GetMissionFailed())
	{		
		if (GetAlpha() <= 0)
		{
			SetAlpha(1);
			vgui::GetAnimationController()->RunAnimationCommand(this, "alpha", 255.0f, 0, 1.0f, vgui::AnimationController::INTERPOLATOR_LINEAR);
		}
		m_bCanReturn = pGameResource->AreAllOtherPlayersReady(player->entindex());

		if (m_bCanReturn)
		{
			SetButtonEnabled(true);
		}
		else
		{
			SetButtonEnabled(false);
		}
	}
	else
	{
		if (GetAlpha() > 0)
			SetAlpha(0);
	}	
}
void ListMarineResources(void)
{
	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
	{
		if (pGameResource->GetMarineResource(i) == NULL)
			Msg("MarineResource %d = empty\n", i);
		else
		{
			Msg("MarineResource %d = present, profileindex %d, commander %d commander index %d\n",
				i, pGameResource->GetMarineResource(i)->m_MarineProfileIndex,
				pGameResource->GetMarineResource(i)->GetCommander(),
				pGameResource->GetMarineResource(i)->GetCommanderIndex());
		}
	}
}
Exemple #12
0
void StatsReport::SetPlayerNames( void )
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer )
		return;

	int nMarine = 0;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			C_ASW_Player *pCommander = pMR->GetCommander();

			Color color = getColorPerIndex(pMR->GetCommanderIndex());

			if ( pPlayer != pCommander )
			{
				color[ 3 ] = 128;
			}

			m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetLineColor( color );
			m_pPlayerNames[ nMarine ]->SetFgColor( color );

			wchar_t wszMarineName[ 32 ];
			pMR->GetDisplayName( wszMarineName, sizeof( wszMarineName ) );

			m_pPlayerNames[ nMarine ]->SetText( wszMarineName );

			if ( gpGlobals->maxClients == 1 )
			{
				// Don't need these in singleplayer
				m_pAvatarImages[ nMarine ]->SetVisible( false );
				m_pReadyCheckImages[ nMarine ]->SetVisible( false );
			}
			else
			{
#if !defined(NO_STEAM)
				CSteamID steamID;

				if ( pCommander )
				{
					player_info_t pi;
					if ( engine->GetPlayerInfo( pCommander->entindex(), &pi ) )
					{
						if ( pi.friendsID )
						{
							CSteamID steamIDForPlayer( pi.friendsID, 1, steamapicontext->SteamUtils()->GetConnectedUniverse(), k_EAccountTypeIndividual );
							steamID = steamIDForPlayer;
						}
					}
				}

				if ( steamID.IsValid() )
				{
					m_pAvatarImages[ nMarine ]->SetAvatarBySteamID( &steamID );

					int wide, tall;
					m_pAvatarImages[ nMarine ]->GetSize( wide, tall );

					CAvatarImage *pImage = static_cast< CAvatarImage* >( m_pAvatarImages[ nMarine ]->GetImage() );
					if ( pImage )
					{
						pImage->SetAvatarSize( wide, tall );
						pImage->SetPos( -AVATAR_INDENT_X, -AVATAR_INDENT_Y );
					}
				}
#endif
			}

			nMarine++;
		}
	}

	while ( nMarine < ASW_STATS_REPORT_MAX_PLAYERS )
	{
		m_pAvatarImages[ nMarine ]->SetVisible( false );
		m_pReadyCheckImages[ nMarine ]->SetVisible( false );
		nMarine++;
	}
}
Exemple #13
0
// fills in all the bars and labels with the current players and their XP values
void StatsReport::SetStatCategory( int nCategory )
{
	for ( int i = 0; i < ASW_STATS_REPORT_CATEGORIES; ++i )
	{
		m_pCategoryButtons[ i ]->SetDefaultColor( Color( 100, 100, 100, 255 ), Color( 35, 41, 57, 90 ) );
	}

	m_pCategoryButtons[ nCategory ]->SetDefaultColor( Color( 255, 255, 255, 255 ), Color( 35, 41, 57, 192 ) );

	int nRankOrder[ ASW_STATS_REPORT_MAX_PLAYERS ];
	float fBestValues[ ASW_STATS_REPORT_MAX_PLAYERS ];

	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; ++i )
	{
		nRankOrder[ i ] = i;
	}

	//float fMinValue = FLT_MAX;
	float fMaxValue = -FLT_MAX;

	int nMarine = 0;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			switch ( nCategory )
			{
			case 0:
				m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetTimeline( &pMR->m_TimelineFriendlyFire );
				fMaxValue = MAX( fMaxValue, 50.0f );
				break;

			case 1:
				m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetTimeline( &pMR->m_TimelineKillsTotal );
				break;

			case 2:
				m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetTimeline( &pMR->m_TimelineHealth );
				break;

			case 3:
				m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->SetTimeline( &pMR->m_TimelineAmmo );
				break;
			}

			fBestValues[ nMarine ] = m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->GetFinalValue();

			//fMinValue = MIN( fMinValue, m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->GetTroughValue() );
			fMaxValue = MAX( fMaxValue, m_pStatGraphPlayer->m_pStatGraphs[ nMarine ]->GetCrestValue() );

			nMarine++;
		}
	}
	
	// Sort the names based on who did the best in this category
	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS - 1; ++i )
	{
		for ( int j = 0; j < ASW_STATS_REPORT_MAX_PLAYERS - 1 - i; ++j )
		{
			if ( fBestValues[ j ] < fBestValues[ j + 1 ] )
			{
				float fTemp = fBestValues[ j ];
				fBestValues[ j ] = fBestValues[ j + 1 ];
				fBestValues[ j + 1 ] = fTemp;

				int nTemp = nRankOrder[ j ];
				nRankOrder[ j ] = nRankOrder[ j + 1 ];
				nRankOrder[ j + 1 ] = nTemp;
			}
		}
	}

	// Physically position all the marine names in their ranked order
	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; ++i )
	{
		m_pStatGraphPlayer->m_pStatGraphs[ i ]->SetMinMaxValues( 0.0f, fMaxValue );
		vgui::GetAnimationController()->RunAnimationCommand( m_pPlayerNames[ nRankOrder[ i ] ], "ypos", m_fPlayerNamePosY[ i ], 0, 0.25f, vgui::AnimationController::INTERPOLATOR_LINEAR );
		vgui::GetAnimationController()->RunAnimationCommand( m_pAvatarImages[ nRankOrder[ i ] ], "ypos", m_fPlayerNamePosY[ i ], 0, 0.25f, vgui::AnimationController::INTERPOLATOR_LINEAR );
		vgui::GetAnimationController()->RunAnimationCommand( m_pReadyCheckImages[ nRankOrder[ i ] ], "ypos", m_fPlayerNamePosY[ i ], 0, 0.25f, vgui::AnimationController::INTERPOLATOR_LINEAR );
	}

	m_pStatGraphPlayer->InvalidateLayout( true );
}
void MissionCompletePanel::OnCommand(const char* command)
{
	C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer || !ASWGameRules() )
		return;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	bool bLeader = ( pPlayer == pGameResource->GetLeader() );

	if ( !Q_stricmp( command, "XPTab" ) )
	{
		m_PropertySheet->SetActivePage( m_PropertySheet->GetPage( 0 ) );
		if ( !ASWGameRules()->GetMissionSuccess() )
		{
			m_pHeaderFooter->SetTitle("#asw_mission_failed");
		}
		else
		{
			m_pHeaderFooter->SetTitle( "#asw_summary" );
		}
	}
	else if ( !Q_stricmp( command, "StatsTab" ) )
	{
		m_PropertySheet->SetActivePage( m_PropertySheet->GetPage( 1 ) );
		m_pHeaderFooter->SetTitle( "#asw_stats_tab" );
		m_bViewedStatsPage = true;
	}
	else if ( !Q_stricmp( command, "Restart" ) )
	{
		if ( !bLeader )
			return;

		bool bAllReady = pGameResource->AreAllOtherPlayersReady( pPlayer->entindex() );
		if ( bAllReady )
		{
			pPlayer->RequestMissionRestart();
		}
		else
		{
			// ForceReadyPanel* pForceReady = 
			engine->ClientCmd("cl_wants_restart"); // notify other players that we're waiting on them
			new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_restartm", ASW_FR_RESTART);
		}
	}
	else if ( !Q_stricmp( command, "Ready" ) )
	{
		// just make us ready
		pPlayer->StartReady();
	}
	else if ( !Q_stricmp( command, "Continue" ) )
	{
		if ( ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame() && ASWGameRules()->CampaignMissionsLeft() <= 1 )
		{
			if ( !m_bCreditsSeen )
			{
				C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
				if ( pPlayer )
				{
					m_pStatsPanel->m_pDebrief->m_pPara[0]->SetVisible( false );
					m_pStatsPanel->m_pDebrief->m_pPara[1]->SetVisible( false );
					m_pStatsPanel->m_pDebrief->m_pPara[2]->SetVisible( false );
					pPlayer->LaunchCredits( m_pStatsPanel->m_pDebrief->m_pBackground->m_pBackgroundInner );
					m_bCreditsSeen = true;
					UpdateVisibleButtons();
				}
			}
			else
			{
				// Vote on a new mission
				engine->ClientCmd("asw_vote_chooser 0 notrans");
			}
		}
		else if ( bLeader )
		{
			bool bAllReady = pGameResource->AreAllOtherPlayersReady( pPlayer->entindex() );
			if ( bAllReady )
			{
				if ( ASWGameRules()->IsCampaignGame() && ASWGameRules()->GetMissionSuccess() )   // completed a campaign map
				{
					pPlayer->CampaignSaveAndShow();
				}
				else
				{
					// TODO: Proceed to the next mission, pop up a mission selection dialog, etc?
					// just do a restart for now
					pPlayer->RequestMissionRestart();
				}
			}
			else
			{
				if ( ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame() )
				{
					// ForceReadyPanel* pForceReady = 
					engine->ClientCmd("cl_wants_continue");	// notify other players that we're waiting on them
					new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_continuem", ASW_FR_CONTINUE);
				}
				else
				{
					// TODO: Proceed to the next mission, pop up a mission selection dialog, etc?
					// just do a restart for now
					// ForceReadyPanel* pForceReady = 
					engine->ClientCmd("cl_wants_restart"); // notify other players that we're waiting on them
					new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_restartm", ASW_FR_RESTART);
				}
			}
		}

		return;
	}

	BaseClass::OnCommand(command);
}
void MissionCompletePanel::UpdateVisibleButtons()
{
	if ( gpGlobals->maxClients <= 1 && !asw_show_stats_in_singleplayer.GetBool() )
	{
		m_pNextButton->SetVisible( false );
		m_pRestartButton->SetVisible( false );
		m_pReadyButton->SetVisible( false );
		m_pReadyCheckImage->SetVisible( false );
		m_pContinueButton->SetVisible( false );
		m_pTab[ 0 ]->SetVisible( false );
		m_pTab[ 1 ]->SetVisible( false );
		return;
	}

	C_ASW_Player* player = C_ASW_Player::GetLocalASWPlayer();
	if (!player || !ASWGameRules())
		return;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	bool bLeader = (player == pGameResource->GetLeader());

	if ( !m_bViewedStatsPage )
	{
		if ( ( m_pExperienceReport->m_bDoneAnimating || gpGlobals->curtime > m_flForceVisibleButtonsTime )
			&& m_iStage >= MCP_STAGE_STATS )
		{
			m_pNextButton->SetVisible( true );
		}
		else
		{
			m_pNextButton->SetVisible( false );
		}
		
		m_pRestartButton->SetVisible( false );
		m_pReadyButton->SetVisible( false );
		m_pReadyCheckImage->SetVisible( false );
		m_pContinueButton->SetVisible( false );
		m_pTab[ 0 ]->SetVisible( false );
		m_pTab[ 1 ]->SetVisible( false );
	}
	else
	{
		if ( bLeader )
		{
			m_pReadyButton->SetVisible( false );
			m_pReadyCheckImage->SetVisible( false );
			if ( ASWGameRules()->GetMissionSuccess() )
			{
				if ( ASWGameRules()->IsCampaignGame() && ASWGameRules()->CampaignMissionsLeft() <= 1 )
				{
					if ( !m_bCreditsSeen )
					{
						m_pContinueButton->SetText( "#asw_button_credits" );
					}
					else
					{
						m_pContinueButton->SetText( "#asw_button_new_campaign" );
					}
				}
				else
				{
					m_pContinueButton->SetText( "#asw_button_continue" );
				}

				m_pContinueButton->SetVisible( true );
				m_pRestartButton->SetVisible( false );
			}
			else
			{
				m_pContinueButton->SetVisible( false );
				m_pRestartButton->SetVisible( true );
			}
		}
		else
		{
			if ( ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame() && ASWGameRules()->CampaignMissionsLeft() <= 1 )
			{
				if ( !m_bCreditsSeen )
				{
					m_pContinueButton->SetText( "#asw_button_credits" );
				}
				else
				{
					m_pContinueButton->SetText( "#asw_button_new_campaign" );
				}

				m_pContinueButton->SetVisible( true );
				m_pReadyButton->SetVisible( false );
				m_pReadyCheckImage->SetVisible( false );
			}
			else
			{
				m_pContinueButton->SetVisible( false );
				m_pReadyButton->SetVisible( true );
				m_pReadyCheckImage->SetVisible( true );
			}

			m_pRestartButton->SetVisible( false );

			if ( ASWGameResource()->IsPlayerReady( player ) )
			{
				m_pReadyCheckImage->SetImage( "swarm/HUD/TickBoxTicked" );
			}
			else
			{
				m_pReadyCheckImage->SetImage( "swarm/HUD/TickBoxEmpty" );
			}
		}
		m_pTab[ 0 ]->SetVisible( true );
		m_pTab[ 1 ]->SetVisible( true );
	}
}
void CASWHudObjective::UpdateObjectiveList()
{
    C_ASW_Game_Resource* pGameResource = ASWGameResource();
    if (!pGameResource)
        return;
    int iCurrent = 0;
    bool bNeedsLayout = false;
    for (int i=0; i<ASW_MAX_OBJECTIVES; i++)
    {
        C_ASW_Objective* pObjective = pGameResource->GetObjective(i);
        bool bUpdatedTitle = false;
        if (pObjective && !pObjective->IsObjectiveDummy() && !pObjective->IsObjectiveHidden())
        {
            if (m_hObjectives[iCurrent].Get() != pObjective || pObjective->NeedsTitleUpdate()
                    || m_bObjectiveTitleEmpty[iCurrent])
            {
                if (m_hObjectives[iCurrent].Get() != pObjective)
                {
                    m_bObjectiveComplete[iCurrent] = pObjective->IsObjectiveComplete();
                    if (pObjective->GetObjectiveIconName()[0] != '\0')
                    {
                        m_pObjectiveIcon[iCurrent]->SetImage(pObjective->GetObjectiveIconName());
                        //Msg("Set objective icon %d to %s\n", iCurrent, pObjective->GetObjectiveIconName());
                    }
                    if (pObjective->IsObjectiveComplete())
                        m_pTickBox[iCurrent]->SetImage("swarm/HUD/TickBoxTicked");
                    else
                        m_pTickBox[iCurrent]->SetImage("swarm/HUD/TickBoxEmpty");
                    m_hObjectives[iCurrent] = pObjective;
                }
                // set the content for this objective
                const wchar_t *pTitle = pObjective->GetObjectiveTitle();
                bUpdatedTitle = true;
                m_bObjectiveTitleEmpty[iCurrent] = (pTitle[0] == '\0');
                m_pObjectiveLabel[iCurrent]->SetText(pTitle);
                if (m_bPlayMissionCompleteSequence && m_hObjectiveComplete.Get() == pObjective)
                {
                    m_pObjectiveGlowLabel->SetText(pTitle);
                    //Msg("A) Set glow label to %s\n", pTitle);
                }

                // make sure they're visible
                if (!m_pObjectiveLabel[iCurrent]->IsVisible())
                    m_pObjectiveLabel[iCurrent]->SetVisible(true);
                if (pObjective->GetObjectiveIconName()[0] != '\0' && !m_pObjectiveIcon[iCurrent]->IsVisible())
                {
                    //Msg("setting objective icon %d visible\n", iCurrent);
                    m_pObjectiveIcon[iCurrent]->SetVisible(true);
                }
                else
                {
                    m_pObjectiveIcon[iCurrent]->SetVisible(false);
                }
                if (!m_pTickBox[iCurrent]->IsVisible())
                    m_pTickBox[iCurrent]->SetVisible(true);

                bNeedsLayout = true;
            }

            // already have this objective in our list, but check if it's become complete
            if (m_bObjectiveComplete[iCurrent] != pObjective->IsObjectiveComplete())
            {
                //Msg("Objective %d is now complete!\n", iCurrent);
                m_bObjectiveComplete[iCurrent] = pObjective->IsObjectiveComplete();
                if (pObjective->IsObjectiveComplete())
                    m_pTickBox[iCurrent]->SetImage("swarm/HUD/TickBoxTicked");
                else
                    m_pTickBox[iCurrent]->SetImage("swarm/HUD/TickBoxEmpty");
                if (ASWGameRules() && ASWGameRules()->GetGameState() == ASW_GS_INGAME)//  && !ASWGameRules()->IsTutorialMap()
                {
                    m_iObjectiveCompleteSequencePos = iCurrent;
                    m_hObjectiveComplete = pObjective;
                    m_bPlayMissionCompleteSequence = true;
                    m_iNumLetters = 0;
                    GetAnimationController()->RunAnimationCommand(m_pCompleteLabel, "Alpha", 255, 0, 0.1f, AnimationController::INTERPOLATOR_LINEAR);
                    GetAnimationController()->RunAnimationCommand(m_pCompleteLabelBD, "Alpha", 255, 0, 0.1f, AnimationController::INTERPOLATOR_LINEAR);
                    GetAnimationController()->RunAnimationCommand(m_pObjectiveGlowLabel, "Alpha", 255, 0, 0.1f, AnimationController::INTERPOLATOR_LINEAR);
                    const wchar_t *pTitle = pObjective->GetObjectiveTitle();
                    m_pObjectiveGlowLabel->SetText(pTitle);
                    //Msg("1) Set glow label to %s\n", pTitle);
                }
            }
            if ( m_hObjectiveComplete.Get() != NULL && m_hObjectiveComplete.Get() == pObjective )
            {
                if ( iCurrent != m_iObjectiveCompleteSequencePos )
                {
                    m_iObjectiveCompleteSequencePos = iCurrent;
                    bNeedsLayout = true;
                }
            }
            iCurrent++;
        }
    }
    if ( m_iNumObjectivesListed != iCurrent)
    {
        m_iNumObjectivesListed = iCurrent;
        bNeedsLayout = true;
    }

    for (int i=iCurrent; i<ASW_MAX_OBJECTIVES; i++)
    {
        //Msg("Clearing objective slot %d\n", i);
        m_hObjectives[i] = NULL;
        if (m_pObjectiveLabel[i]->IsVisible())
            m_pObjectiveLabel[i]->SetVisible(false);
        if (m_pObjectiveIcon[i]->IsVisible())
            m_pObjectiveIcon[i]->SetVisible(false);
        if (m_pTickBox[i]->IsVisible())
            m_pTickBox[i]->SetVisible(false);
    }
    if ( IsSpectating() != m_bLastSpectating )
    {
        bNeedsLayout = true;
    }

    if ( bNeedsLayout )
    {
        LayoutObjectives();
    }
}