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 MissionCompleteStatsLine::InitFrom(C_ASW_Debrief_Stats *pDebriefStats)
{
	if (!pDebriefStats)
		return;

	if (m_iMarineIndex < 0 || m_iMarineIndex >= ASW_MAX_MARINE_RESOURCES)
		return;

	if (!ASWGameRules() || !ASWGameResource())
		return;

	C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(m_iMarineIndex);
	if (!pMR)
		return;

	m_bInitStats = true;

	// find marine with highest kills, highest acc, lowest FF and lowest damage taken
	int iHighestKills = pDebriefStats->GetHighestKills();
	float fHighestAccuracy = pDebriefStats->GetHighestAccuracy();
	int iHighestFF = pDebriefStats->GetHighestFriendlyFire();
	int iHighestDamage = pDebriefStats->GetHighestDamageTaken();
	int iHighestShotsFired = pDebriefStats->GetHighestShotsFired();

	float fDelay = 1.0f;	// roughly how many seconds we want it to take for the bars to fill
	float fKillRate = float(iHighestKills) / fDelay;
	float fAccRate = fHighestAccuracy / fDelay;
	float fFFRate = float(iHighestFF) / fDelay;
	float fDamageRate = float(iHighestDamage) / fDelay;
	float fShotsFiredRate = float(iHighestShotsFired) / fDelay;

	// kills
	m_pStats[0]->Init(0, pDebriefStats->GetKills(m_iMarineIndex), fKillRate, true, false);
	m_pStats[0]->AddMinMax( 0, iHighestKills );
	m_pStats[1]->Init(0, pDebriefStats->GetAccuracy(m_iMarineIndex), fAccRate, true, true);
	m_pStats[1]->AddMinMax( 0, fHighestAccuracy );
	m_pStats[2]->Init(0, pDebriefStats->GetFriendlyFire(m_iMarineIndex), fFFRate, true, false);
	m_pStats[2]->AddMinMax( 0, iHighestFF );
	m_pStats[3]->Init(0, pDebriefStats->GetDamageTaken(m_iMarineIndex), fDamageRate, true, false);
	m_pStats[3]->AddMinMax( 0, iHighestDamage );
	m_pStats[4]->Init(0, pDebriefStats->GetShotsFired(m_iMarineIndex), fShotsFiredRate, true, false);
	m_pStats[4]->AddMinMax( 0, iHighestShotsFired );

	// wounded
	m_pWoundedLabel->SetFgColor(Color(255,0,0,255));
	
	if (pMR->GetHealthPercent() <= 0)
	{
		m_pWoundedLabel->SetText("#asw_kia");
		m_pWoundedLabel->SetVisible(true);
	}
	else if (pDebriefStats->IsWounded(m_iMarineIndex))
	{
		m_pWoundedLabel->SetText("#asw_wounded");
		m_pWoundedLabel->SetVisible(true);
	}
	else
	{
		m_pWoundedLabel->SetVisible(false);
	}
	
	// update our class specific bar
	if (pMR->GetProfile()->GetMarineClass() == MARINE_CLASS_SPECIAL_WEAPONS)
	{
		m_pStats[5]->SetVisible(false);
		m_pBarIcons[5]->SetVisible(false);
	}
	else
	{
		m_pStats[5]->SetVisible(true);
		m_pBarIcons[5]->SetVisible(true);

		if (pMR->GetProfile()->GetMarineClass() == MARINE_CLASS_NCO)
		{
			int iHighest = pDebriefStats->GetHighestAliensBurned();
			float fRate = float(iHighest) / fDelay;
			m_pStats[5]->Init(0, pDebriefStats->GetAliensBurned(m_iMarineIndex), fRate, true, false);
			m_pStats[5]->AddMinMax( 0, iHighest );
			m_pBarIcons[5]->SetImage("swarm/Briefing/statburned");
		}
		else if (pMR->GetProfile()->GetMarineClass() == MARINE_CLASS_MEDIC)
		{
			int iHighest = pDebriefStats->GetHighestHealthHealed();
			float fRate = float(iHighest) / fDelay;
			Msg( "Medic healed %d highest %d\n", pDebriefStats->GetHealthHealed(m_iMarineIndex), iHighest );
			m_pStats[5]->Init(0, pDebriefStats->GetHealthHealed(m_iMarineIndex), fRate, true, false);
			m_pStats[5]->AddMinMax( 0, iHighest );
			m_pBarIcons[5]->SetImage("swarm/Briefing/statheal");
		}
		else if (pMR->GetProfile()->GetMarineClass() == MARINE_CLASS_TECH)
		{
			int iHighest = pDebriefStats->GetHighestFastHacks();
			float fRate = float(iHighest) / fDelay;
			m_pStats[5]->Init(0, pDebriefStats->GetFastHacks(m_iMarineIndex), fRate, true, false);
			m_pStats[5]->AddMinMax( 0, iHighest );
			m_pBarIcons[5]->SetImage("swarm/Briefing/stathack");
		}
	}

	if (ASWGameRules() && ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame())
	{
		m_pStats[6]->SetVisible(true);
		m_pBarIcons[6]->SetVisible(true);

		int iHighestSkillPointsAwarded = pDebriefStats->GetHighestSkillPointsAwarded();
		float fDelay = 1.0f;	// roughly how many seconds we want it to take for the bars to fill
		float fSkillPointsRate = float(iHighestSkillPointsAwarded) / fDelay;
		m_pStats[6]->Init(0, pDebriefStats->GetSkillPointsAwarded(m_iMarineIndex), fSkillPointsRate, true, false);
		m_pStats[6]->AddMinMax( 0, iHighestSkillPointsAwarded );
	}
	else
	{
		m_pStats[6]->SetVisible(false);
		m_pBarIcons[6]->SetVisible(false);
	}
}