Exemple #1
0
bool CGroupData::Read(FitIniFile &fitFile, const char *groupName) {
	int result;
	result = sReadIdString(fitFile, "Label", m_Label);
	result = sReadIdInteger(fitFile, "NumberToComplete", m_NumMissionsToComplete);
	result = sReadIdString(fitFile, "OperationFile", m_OperationFile);
	result = sReadIdString(fitFile, "Video", m_VideoFile);
	result = sReadIdString(fitFile, "PreVideo", m_PreVideoFile);
	result = sReadIdInteger(fitFile, "Tune", m_TuneNumber);
	result = sReadIdString(fitFile, "ABLScript", m_ABLScript);
	int missionCount = 0;
	result = sReadIdInteger(fitFile, "MissionCount", missionCount);
	if (NO_ERR != result) { return false; }

	int index;
	for (index = 0; missionCount > index; index+=1) {
		ECharString blockName;
		blockName.Format("%sMission%d", groupName, index);
		result = fitFile.seekBlock(blockName.Data());
		if (NO_ERR != result) { assert(false); continue; }
		CMissionData missionData;
		bool bresult = missionData.Read(fitFile);
		if (true != bresult) { assert(false); continue; }
		m_MissionList.Append(missionData);
	}

	return true;
}
uint32 CFolderStats::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	if (dwCommand == CMD_INTEL)
	{
		CMissionData* pMissionData = g_pInterfaceMgr->GetMissionData();
		if (!pMissionData) return 0;
		int nMissionNum = pMissionData->GetMissionNum();

		CFolderIntel *pIntel = (CFolderIntel *)m_pFolderMgr->GetFolderFromID(FOLDER_ID_INTEL);
		pIntel->SetMissionNum(nMissionNum);

		m_pFolderMgr->SetCurrentFolder(FOLDER_ID_INTEL);
		return 1;
	}

	return CBaseFolder::OnCommand(dwCommand, dwParam1, dwParam2);
}
void CFolderSummary::UpdateData()
{
	CPlayerSummaryMgr *pPSummary = g_pGameClientShell->GetPlayerSummary();
	if (!pPSummary) return;

	CMissionData* pMissionData = g_pInterfaceMgr->GetMissionData();
	if (!pMissionData) return;

	int nMissionNum = pMissionData->GetMissionNum();
	MISSION* pMission = g_pMissionMgr->GetMission(nMissionNum);
	if (!pMission) return;

	MISSIONSUMMARY* pMSummary = pPSummary->GetMissionSummary(nMissionNum);
	if (!pMSummary) return;

	pPSummary->ReadRankData();

	RemoveFree();

    CLTGUITextItemCtrl* pCtrl = LTNULL;

	CLTGUIColumnTextCtrl *pRanks=AddColumnText(LTNULL, LTNULL, LTTRUE, GetLargeFont());

	// The rank header
	pRanks->AddColumn(IDS_STAT_RANK, 200, LTF_JUSTIFY_LEFT);
	if (m_nFolderID != FOLDER_ID_FAILURE)
	{
		pRanks->AddColumn(IDS_SUMMARY_BEST, 200, LTF_JUSTIFY_LEFT);
	}
    pRanks->Enable(LTFALSE);

	pRanks=AddColumnText(LTNULL, LTNULL, LTTRUE, GetSmallFont());

	//rank
    LTFLOAT fRank = 0.0f;
	int nRankId = 0;
	if (m_nFolderID == FOLDER_ID_FAILURE)
	{
		pRanks->AddColumn(IDS_STAT_FAILED, 200, LTF_JUSTIFY_LEFT);
	}
	else
	{
		fRank = pMSummary->fCurRank;
		nRankId = g_pMissionMgr->GetMissionRating()->GetRankId(fRank);
		pRanks->AddColumn(nRankId, 200, LTF_JUSTIFY_LEFT);
	}


	if (m_nFolderID != FOLDER_ID_FAILURE)
	{
		//best rank
		fRank = pMSummary->fBestRank;
		nRankId = g_pMissionMgr->GetMissionRating()->GetRankId(fRank);
		pRanks->AddColumn(nRankId, 200, LTF_JUSTIFY_LEFT);
	}
    pRanks->Enable(LTFALSE);


	//time in mission
	char str[128];
    LTFLOAT fSec = pMSummary->fTotalMissionTime;
    uint32 nMin = (uint32)fSec / 60;
    fSec -= (60.0f * (LTFLOAT)nMin);
    uint32 nHour = nMin / 60;
	nMin -= 60 * nHour;
	sprintf(str,"%02d:%02d:%.1f",nHour,nMin,fSec);

    HSTRING hTxt=g_pLTClient->FormatString(IDS_STAT_TIME,str);
    pCtrl= AddTextItem(hTxt,LTNULL,0,LTTRUE, GetLargeFont());
    pCtrl->Enable(LTFALSE);
    g_pLTClient->FreeString(hTxt);


	//accuracy
	if (pMission->bAllowAwards)
	{
		pCtrl = AddTextItem(IDS_STAT_ACCURACY,LTNULL,0, LTTRUE, GetLargeFont());
		pCtrl->Enable(LTFALSE);
		LTFLOAT fAccuracy = 0.0f;
		if (pMSummary->dwNumShotsFired)
		{
			fAccuracy = (LTFLOAT) pMSummary->dwNumHits / (LTFLOAT) pMSummary->dwNumShotsFired;
			int nAccuracy =(int)( 100.0f * fAccuracy);

			//shots fired
			hTxt=g_pLTClient->FormatString(IDS_STAT_SHOTS,
					pMSummary->dwNumShotsFired,pMSummary->dwNumHits, nAccuracy);
			pCtrl= AddTextItem(hTxt,LTNULL,0,LTTRUE, GetSmallFont());
			pCtrl->Enable(LTFALSE);
			g_pLTClient->FreeString(hTxt);

			//hit locations
			uint32 h = pMSummary->dwHitLocations[HL_HEAD];
			uint32 t = pMSummary->dwHitLocations[HL_TORSO];
			uint32 a = pMSummary->dwHitLocations[HL_ARM];
			uint32 l = pMSummary->dwHitLocations[HL_LEG];
			hTxt=g_pLTClient->FormatString(IDS_STAT_HITS,h,t,(a+l));
			pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
			pCtrl->Enable(LTFALSE);
			g_pLTClient->FreeString(hTxt);

			// casualties
			pCtrl = AddTextItem(IDS_STAT_CASUALTIES,LTNULL,0, LTTRUE, GetLargeFont());
			pCtrl->Enable(LTFALSE);
			hTxt=g_pLTClient->FormatString(IDS_STAT_KILLS, pMSummary->dwNumEnemyKills,
											pMSummary->dwNumFriendKills, pMSummary->dwNumNeutralKills);
			pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
			pCtrl->Enable(LTFALSE);
			g_pLTClient->FreeString(hTxt);


		}
		else
		{
			hTxt=g_pLTClient->FormatString(IDS_STAT_NOSHOTS);
			pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
			pCtrl->Enable(LTFALSE);
			g_pLTClient->FreeString(hTxt);
		}
	

		//stealth
		pCtrl = AddTextItem(IDS_STAT_STEALTH,LTNULL,0, LTTRUE, GetLargeFont());
		pCtrl->Enable(LTFALSE);

		hTxt=g_pLTClient->FormatString(IDS_STAT_DETECTED,pMSummary->dwNumTimesDetected,pMSummary->dwNumDisturbances);
		pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
		pCtrl->Enable(LTFALSE);
		g_pLTClient->FreeString(hTxt);
		hTxt=g_pLTClient->FormatString(IDS_STAT_DETECTED2,pMSummary->dwNumBodies,pMSummary->dwNumTimesHit);
		pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
		pCtrl->Enable(LTFALSE);
		g_pLTClient->FreeString(hTxt);
	}


	//inteligence
    pCtrl = AddTextItem(IDS_STAT_INTEL,LTNULL,0, LTTRUE, GetLargeFont());
    pCtrl->Enable(LTFALSE);

	int cur = pMSummary->m_nMissionCurNumIntel;
	int total = pMSummary->m_nMissionTotalIntel;
    hTxt=g_pLTClient->FormatString(IDS_SUMMARY_FOUND,cur,total);
    pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
    pCtrl->Enable(LTFALSE);



	if (m_nFolderID == FOLDER_ID_FAILURE)
	{
		nContinueId = FOLDER_ID_LOAD;
		nContinueHelpId = IDS_HELP_LOAD;
	}
	else
	{
		//	Generate Awards
		CFolderAwards* pAwards = (CFolderAwards*)m_pFolderMgr->GetFolderFromID(FOLDER_ID_AWARDS);
		pAwards->UpdateData();
		if (pAwards->HasAwards())
		{
			nContinueId = FOLDER_ID_AWARDS;
			nContinueHelpId = IDS_HELP_AWARDS;
		}
		else
		{
			nContinueId = FOLDER_ID_BRIEFING;
			nContinueHelpId = IDS_HELP_NEXTMISSION;
		}
	}

	UseContinue(nContinueId,nContinueHelpId);
	CalculateLastDrawn();
	CheckArrows();
	SetSelection(GetIndex(m_pContinue));

}
Exemple #4
0
void CFolderAwards::UpdateData()
{
	CPlayerSummaryMgr *pPSummary = g_pGameClientShell->GetPlayerSummary();
	if (!pPSummary) return;

	CMissionData* pMissionData = g_pInterfaceMgr->GetMissionData();
	if (!pMissionData) return;

	int nMissionNum = pMissionData->GetMissionNum();
	MISSION* pMission = g_pMissionMgr->GetMission(nMissionNum);
	if (!pMission) return;

	MISSIONSUMMARY* pMSummary = pPSummary->GetMissionSummary(nMissionNum);
	if (!pMSummary) return;

	pPSummary->ReadRankData();

	RemoveFree();

    CLTGUITextItemCtrl* pCtrl = LTNULL;


	g_pLTClient->CPrint("best:%0.2f,old best:%0.2f",pMSummary->fBestRank, pMSummary->fOldBestRank);
	if (pMSummary->fBestRank > pMSummary->fOldBestRank)
	{
		RANKBONUS oldBonus;
		RANKBONUS newBonus;
		pMission->GetRankBonus(pMSummary->fBestRank,&newBonus);
		pMission->GetRankBonus(pMSummary->fOldBestRank,&oldBonus);
		if (newBonus.nPerturbPoints > oldBonus.nPerturbPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_PERTURB,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nAmmoPoints > oldBonus.nAmmoPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_AMMO,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nArmorPoints > oldBonus.nArmorPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_ARMOR,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nDamagePoints > oldBonus.nDamagePoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_DAMAGE,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nHealthPoints > oldBonus.nHealthPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_HEALTH,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nReputationPoints > oldBonus.nReputationPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_REPUTATION,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

		if (newBonus.nStealthPoints > oldBonus.nStealthPoints)
		{
			pCtrl = AddTextItem(IDS_BONUS_STEALTH,LTNULL,0, LTTRUE, GetMediumFont());
			pCtrl->Enable(LTFALSE);
		}

	}

	if (pCtrl)
		AddBlankLine();


//	Generate Awards
	if (pMission->bAllowAwards)
	{
		MISSIONAWARDS *pAwards = g_pMissionMgr->GetMissionAwards();

		int awardNum = 0;
        pCtrl = AddTextItem(IDS_AWARDS,LTNULL,0, LTTRUE, GetLargeFont());
        pCtrl->Enable(LTFALSE);

        if (pAwards->nNumHighAmmoAwards && pMission->nHighAmmo > -1 && pMSummary->dwNumShotsFired >= (uint32)pMission->nHighAmmo)
		{
			awardNum = GetRandom(0,pAwards->nNumHighAmmoAwards-1);
            pCtrl = AddTextItem(pAwards->aHighAmmoAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());
            pCtrl->Enable(LTFALSE);
		}
        if (pAwards->nNumLowAmmoAwards && pMission->nLowAmmo > -1 && pMSummary->dwNumShotsFired <= (uint32)pMission->nLowAmmo)
		{
			awardNum = GetRandom(0,pAwards->nNumLowAmmoAwards-1);
            pCtrl = AddTextItem(pAwards->aLowAmmoAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());
            pCtrl->Enable(LTFALSE);
		}
	    LTFLOAT fAccuracy = 0.0f;
		if (pMSummary->dwNumShotsFired)
		{
			fAccuracy = (LTFLOAT) pMSummary->dwNumHits / (LTFLOAT) pMSummary->dwNumShotsFired;
		}

		if (pAwards->nNumAccuracyAwards && fAccuracy > pAwards->fAccuracyPct)
		{
			awardNum = GetRandom(0,pAwards->nNumAccuracyAwards-1);
            pCtrl = AddTextItem(pAwards->aAccuracyAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());
            pCtrl->Enable(LTFALSE);
		}
		if (pAwards->nNumMarksmanAwards && pMSummary->dwNumShotsFired)
		{

            LTFLOAT fMarksman = (LTFLOAT) pMSummary->dwHitLocations[HL_HEAD] / (LTFLOAT) pMSummary->dwNumShotsFired;
			if (fMarksman > pAwards->fMarksmanPct)
			{
				awardNum = GetRandom(0,pAwards->nNumMarksmanAwards-1);
                pCtrl = AddTextItem(pAwards->aMarksmanAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());
                pCtrl->Enable(LTFALSE);
			}
		}
		if (pAwards->nNumNonInjuryAwards && g_pInterfaceMgr->GetPlayerStats()->GetMissionDamage() == 0)
		{

			awardNum = GetRandom(0,pAwards->nNumNonInjuryAwards-1);
            pCtrl = AddTextItem(pAwards->aNonInjuryAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());

            pCtrl->Enable(LTFALSE);
		}
		if (pAwards->nNumNotShotAwards && pMSummary->dwNumTimesHit == 0)
		{

			awardNum = GetRandom(0,pAwards->nNumNotShotAwards-1);
            pCtrl = AddTextItem(pAwards->aNotShotAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());

            pCtrl->Enable(LTFALSE);
		}
        if (pAwards->nNumStealthAwards && pMission->nMaxDetect > -1 && (pMSummary->dwNumTimesDetected + pMSummary->dwNumBodies) <= (uint32)pMission->nMaxDetect)
		{
			awardNum = GetRandom(0,pAwards->nNumStealthAwards-1);
            pCtrl = AddTextItem(pAwards->aStealthAwards[awardNum],LTNULL,0, LTTRUE, GetSmallFont());
            pCtrl->Enable(LTFALSE);
		}

	}
}
void CFolderStats::UpdateData()
{
	CPlayerSummaryMgr *pPSummary = g_pGameClientShell->GetPlayerSummary();
	if (!pPSummary) return;
	CMissionData* pMissionData = g_pInterfaceMgr->GetMissionData();
	if (!pMissionData) return;
	int nMissionNum = pMissionData->GetMissionNum();
	MISSION* pMission = g_pMissionMgr->GetMission(nMissionNum);
	MISSIONSUMMARY* pMSummary = pPSummary->GetMissionSummary(nMissionNum);

	pPSummary->ReadRankData();

	RemoveFree();

    CLTGUITextItemCtrl* pCtrl = LTNULL;
    HSTRING hTxt = LTNULL;

	//time in mission
	char str[128];
    LTFLOAT fSec = pMSummary->fTotalMissionTime;
    uint32 nMin = (uint32)fSec / 60;
    fSec -= (60.0f * (LTFLOAT)nMin);
    uint32 nHour = nMin / 60;
	nMin -= 60 * nHour;
	sprintf(str,"%02d:%02d:%.1f",nHour,nMin,fSec);

    hTxt=g_pLTClient->FormatString(IDS_STAT_TIME,str);
    pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetLargeFont());
    pCtrl->Enable(LTFALSE);
    g_pLTClient->FreeString(hTxt);

	AddBlankLine();

	//accuracy
    pCtrl = AddTextItem(IDS_STAT_ACCURACY,LTNULL,0,LTTRUE, GetLargeFont());
    pCtrl->Enable(LTFALSE);
    LTFLOAT fAccuracy = 0.0f;
	if (pMSummary->dwNumShotsFired)
	{
        fAccuracy = (LTFLOAT) pMSummary->dwNumHits / (LTFLOAT) pMSummary->dwNumShotsFired;
		int nAccuracy =(int)( 100.0f * fAccuracy);

		//shots fired
        hTxt=g_pLTClient->FormatString(IDS_STAT_SHOTS,
				pMSummary->dwNumShotsFired,pMSummary->dwNumHits, nAccuracy);
        pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
        pCtrl->Enable(LTFALSE);
        g_pLTClient->FreeString(hTxt);

		//hit locations
        uint32 h = pMSummary->dwHitLocations[HL_HEAD];
        uint32 t = pMSummary->dwHitLocations[HL_TORSO];
        uint32 a = pMSummary->dwHitLocations[HL_ARM];
        uint32 l = pMSummary->dwHitLocations[HL_LEG];
        hTxt=g_pLTClient->FormatString(IDS_STAT_HITS,h,t,(a+l));
        pCtrl= AddTextItem(hTxt,LTNULL,0,LTTRUE, GetSmallFont());
        pCtrl->Enable(LTFALSE);
        g_pLTClient->FreeString(hTxt);

		AddBlankLine();

		// casualties
        pCtrl = AddTextItem(IDS_STAT_CASUALTIES,LTNULL,0, LTTRUE, GetLargeFont());
        pCtrl->Enable(LTFALSE);
        hTxt=g_pLTClient->FormatString(IDS_STAT_KILLS, pMSummary->dwNumEnemyKills,
										pMSummary->dwNumFriendKills, pMSummary->dwNumNeutralKills);
        pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
        pCtrl->Enable(LTFALSE);
        g_pLTClient->FreeString(hTxt);


	}
	else
	{
        hTxt=g_pLTClient->FormatString(IDS_STAT_NOSHOTS);
        pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
        pCtrl->Enable(LTFALSE);
        g_pLTClient->FreeString(hTxt);
	}

	AddBlankLine();

	//stealth
    pCtrl = AddTextItem(IDS_STAT_STEALTH,LTNULL,0, LTTRUE, GetLargeFont());
    pCtrl->Enable(LTFALSE);

    hTxt=g_pLTClient->FormatString(IDS_STAT_DETECTED,pMSummary->dwNumTimesDetected,pMSummary->dwNumDisturbances);
    pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
    pCtrl->Enable(LTFALSE);
    g_pLTClient->FreeString(hTxt);
    hTxt=g_pLTClient->FormatString(IDS_STAT_DETECTED2,pMSummary->dwNumBodies,pMSummary->dwNumTimesHit);
    pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
    pCtrl->Enable(LTFALSE);
    g_pLTClient->FreeString(hTxt);


	AddBlankLine();

	//inteligence
	int cur = pMSummary->m_nMissionCurNumIntel;
	if (cur)
	{
        pCtrl = AddTextItem(IDS_STAT_INTEL,LTNULL,0, LTTRUE, GetLargeFont());
        pCtrl->Enable(LTFALSE);
		
        hTxt=g_pLTClient->FormatString(IDS_STAT_FOUND,cur);
        pCtrl= AddTextItem(hTxt,LTNULL,0, LTTRUE, GetSmallFont());
        pCtrl->Enable(LTFALSE);
	}
	if (cur || pMSummary->m_nMissionMaxIntel)
		AddTextItem(IDS_VIEW_GALLERY,CMD_INTEL,IDS_HELP_VIEW_GALLERY, LTFALSE, GetSmallFont());

	CalculateLastDrawn();
	CheckArrows();
}