void CFolderIntel::BuildIntelList() { if (m_nMissionNum < 0) return; MISSION* pMission = g_pMissionMgr->GetMission(m_nMissionNum); if (!pMission) return; CreateTitle(pMission->nNameId); for (int n =0;n < kNumSFXTypes;n++) { nSFXCounts[n] = 0; } CLTGUIFont *pFont; if (g_pLayoutMgr->GetListFontSize((eFolderID)m_nFolderID) == 0) pFont = GetSmallFont(); else if (g_pLayoutMgr->GetListFontSize((eFolderID)m_nFolderID) == 1) pFont = GetMediumFont(); else pFont = GetLargeFont(); int numItems = g_pGameClientShell->GetIntelItemMgr()->GetNumItems(m_nMissionNum); for (int i = 0; i < numItems; i++) { IntelItem *pItem = debug_new(IntelItem); g_pGameClientShell->GetIntelItemMgr()->GetItem(m_nMissionNum,i,pItem); int nNameID = 0; int nCount = 0; if (pItem->nID) { for (int n =0;!nNameID && n < kNumSFXTypes;n++) { if (pItem->nType == nSFXIDs[n]) { nSFXCounts[n]++; nNameID = nSFXNameIDs[n]; nCount = nSFXCounts[n]; } } } if (nNameID) { m_intelArray.Add(pItem); HSTRING hStr = g_pLTClient->FormatString(nNameID,nCount); CLTGUITextItemCtrl *pCtrl = AddTextItem(hStr,0,0,LTFALSE,pFont); g_pLTClient->FreeString(hStr); pCtrl->SetParam1(m_intelArray.GetSize()); } else { debug_delete(pItem); } } }
CLTGUITextItemCtrl* CMenuCharacter::InitWeaponNumCtrl(int index, DWORD dwCommandID, int x, int y, DBOOL enable) { char str[5]; HSTRING hString=m_pClientDE->CreateString("0"); // Create the new menu option CLTGUITextItemCtrl *pOption = new CLTGUITextItemCtrl; if(!pOption->Create(m_pClientDE, dwCommandID, hString, m_pMainMenus->GetSmallFont(), 1, DTRUE, DNULL)) { m_pClientDE->FreeString(hString); delete pOption; return DNULL; } m_pClientDE->FreeString(hString); for(int i = 1; i <= WEAP_LASTPLAYERWEAPON; i++) { itoa(g_WeaponDefaults[i - 1].m_dwStrengthReq, str, 10); hString=m_pClientDE->CreateString(str); pOption->AddString(hString); m_pClientDE->FreeString(hString); } pOption->SetColor(SETRGB(220,190,170), SETRGB(125,30,0)); pOption->SetSelIndex(index); pOption->SetPos(x, y); pOption->Enable(enable); return pOption; }
// build a list of objectives for a new mission void CFolderObjectives::BuildObjectivesList() { int missionNum = g_pInterfaceMgr->GetMissionData()->GetMissionNum(); MISSION* pMission = g_pMissionMgr->GetMission(missionNum); if (!pMission) return; CLTGUIFont *pFont = GetSmallFont(); for (int i = 0; i < pMission->nNumObjectives ; i++) { uint32 objID = pMission->aObjectiveIds[i]; CGroupCtrl *pGroup = debug_new(CGroupCtrl); CLTGUITextItemCtrl *pCtrl = CreateTextItem((int)objID,LTNULL,LTNULL,LTTRUE,pFont); if (pCtrl) { pCtrl->Enable(LTFALSE); pCtrl->SetFixedWidth(440); int nIndex= 0; CBitmapCtrl *pCheck = debug_new(CBitmapCtrl); pCheck->Create(g_pLTClient,"interface\\check-off.pcx"); int strHeight = pCtrl->GetHeight(); int bmpHeight = pCheck->GetHeight(); int height = Max(strHeight,bmpHeight) + 4; pGroup->Create(480,height); LTIntPt offset(40, (height - strHeight) / 2 ); pGroup->AddControl(pCtrl,offset); offset.x = 0; offset.y = (height - bmpHeight) / 2; pGroup->AddControl(pCheck,offset); pGroup->Enable(LTFALSE); AddFreeControl(pGroup); } } }
CLTGUITextItemCtrl* CMenuCharacter::InitNumberCtrl(int low, int high, int index, DWORD dwCommandID, int x, int y) { char str[5]; itoa(low, str, 10); HSTRING hString=m_pClientDE->CreateString(str); // Create the new menu option CLTGUITextItemCtrl *pOption = new CLTGUITextItemCtrl; if(!pOption->Create(m_pClientDE, dwCommandID, hString, m_pMainMenus->GetSmallFont(), 1, DTRUE, DNULL)) { m_pClientDE->FreeString(hString); delete pOption; return DNULL; } m_pClientDE->FreeString(hString); for(int i = low + 1; i <= high; i++) { itoa(i, str, 10); hString=m_pClientDE->CreateString(str); pOption->AddString(hString); m_pClientDE->FreeString(hString); } pOption->SetColor(SETRGB(220,190,170), SETRGB(125,30,0)); pOption->SetSelIndex(index); pOption->SetPos(x, y); return pOption; }
void CFolderMultiBriefing::OnFocus(LTBOOL bFocus) { if (bFocus) { int missionId = g_pGameClientShell->GetMPMissionName(); int briefId = g_pGameClientShell->GetMPMissionBriefing(); if (missionId) { CLTGUIFont *pFont = (briefId ? GetMediumFont() : GetLargeFont()); CLTGUITextItemCtrl* pCtrl =AddTextItem(missionId,LTNULL,0,LTTRUE,pFont); pCtrl->SetFixedWidth(480); pCtrl->Enable(LTFALSE); } if (briefId) { if (missionId) AddBlankLine(); CLTGUITextItemCtrl* pCtrl=AddTextItem(IDS_BRIEFING,LTNULL,0,LTTRUE,GetMediumFont()); pCtrl->Enable(LTFALSE); CStaticTextCtrl *pBrief = AddStaticTextItem(briefId,LTNULL,LTNULL,480,0,LTTRUE,GetSmallFont()); if (pBrief) { pBrief->Enable(LTFALSE); } } UseBack(LTFALSE); } else { RemoveFree(); } CBaseFolder::OnFocus(bFocus); }
void CFolderViewInventory::OnFocus(LTBOOL bFocus) { if (bFocus) { m_nLastWeapon = WMGR_INVALID_ID; m_szModel[0] = '\0'; m_szSkin[0] = '\0'; BuildInventoryList(); if (!m_controlArray.GetSize()) { CLTGUITextItemCtrl *pCtrl = AddTextItem(IDS_NO_INVENTORY,LTNULL,LTNULL,LTTRUE,GetLargeFont()); pCtrl->Enable(LTFALSE); } m_nKey = GetCommandKey(COMMAND_ID_INVENTORY); bOKtoDismiss = !IsKeyDown(m_nKey); } else { SetSelection(kNoSelection); ClearInventoryList(); } CBaseSelectionFolder::OnFocus(bFocus); }
void CFolderSave::BuildSavedLevelList() { AddTextItem(IDS_QUICKSAVE,FOLDER_CMD_CUSTOM,IDS_HELP_QUICKSAVE,LTFALSE,GetMediumFont()); // Create an empty string HSTRING hEmpty=g_pLTClient->CreateString(" "); int nFirstEmpty = -1; CLTGUITextItemCtrl *pCtrl = AddTextItem(IDS_LOAD_USERGAME,LTNULL,LTNULL,LTTRUE,GetMediumFont()); pCtrl->Enable(LTFALSE); for (int i = 0; i < kMaxSave; i++) { LTBOOL bEmpty = LTTRUE; char strFilename[128]; sprintf (strFilename, "Save\\Slot%02d.sav", i+1); if (CWinUtil::FileExist(strFilename)) { char strSaveGameSetting[256]; memset (strSaveGameSetting, 0, 256); char strKey[32]; sprintf (strKey, "SaveGame%02d", i+1); CWinUtil::WinGetPrivateProfileString (GAME_NAME, strKey, "", strSaveGameSetting, 256, SAVEGAMEINI_FILENAME); int mission = -1; int level = -1; struct tm* pTimeDate = LTNULL; char strWorldName[128] = ""; char strUserName[128] = ""; char strTime[128] = ""; if (strlen (strSaveGameSetting) > 0) { char* pWorldName = strtok(strSaveGameSetting,"|"); char* pNameStr = strtok(NULL,"|"); char* pTimeStr = strtok(NULL,"|"); time_t nSeconds = (time_t) atol (pTimeStr); pTimeDate = localtime (&nSeconds); if (pTimeDate) { if (g_pInterfaceResMgr->IsEnglish()) { sprintf (strTime, "%02d/%02d/%02d %02d:%02d:%02d", pTimeDate->tm_mon + 1, pTimeDate->tm_mday, (pTimeDate->tm_year + 1900) % 100, pTimeDate->tm_hour, pTimeDate->tm_min, pTimeDate->tm_sec); } else { sprintf (strTime, "%02d/%02d/%02d %02d:%02d:%02d", pTimeDate->tm_mday, pTimeDate->tm_mon + 1, (pTimeDate->tm_year + 1900) % 100, pTimeDate->tm_hour, pTimeDate->tm_min, pTimeDate->tm_sec); } } sprintf(strWorldName," %s",pWorldName); sprintf(strUserName," %s",pNameStr); } HSTRING hWorld = LTNULL; HSTRING hTime = LTNULL; if (strlen(strUserName) > 0) { hWorld = g_pLTClient->CreateString(strUserName); bEmpty = LTFALSE; } else if (strlen(strWorldName) > 0) { hWorld=g_pLTClient->CreateString(strWorldName); bEmpty = LTFALSE; } if (!bEmpty && strlen(strTime) > 0) { // Set the text in the control hTime=g_pLTClient->CreateString(strTime); } if (hWorld) { CLTGUIColumnTextCtrl* pCtrl = AddColumnText(FOLDER_CMD_CUSTOM+1+i, IDS_HELP_SAVEGAME, LTFALSE, GetSmallFont()); pCtrl->SetParam1( m_controlArray.GetSize() - 1); // The world name column pCtrl->AddColumn(hWorld, kColumnWidth, LTF_JUSTIFY_LEFT); // This is a spacer pCtrl->AddColumn(hEmpty, kGap, LTF_JUSTIFY_LEFT); if (hTime) { // The column that contains the date/time pCtrl->AddColumn(hTime, 230, LTF_JUSTIFY_LEFT); g_pLTClient->FreeString(hTime); } g_pLTClient->FreeString(hWorld); } } if (bEmpty && nFirstEmpty < 0) nFirstEmpty = i; } if (nFirstEmpty >= 0) { CLTGUIColumnTextCtrl* pCtrl = AddColumnText(FOLDER_CMD_CUSTOM+1+nFirstEmpty, IDS_HELP_SAVEGAME, LTFALSE, GetSmallFont()); pCtrl->SetParam1( m_controlArray.GetSize() - 1); // The world name column pCtrl->AddColumn(IDS_EMPTY, kColumnWidth, LTF_JUSTIFY_LEFT); // This is a spacer pCtrl->AddColumn(hEmpty, kGap, LTF_JUSTIFY_LEFT); // The column that contains the date/time pCtrl->AddColumn(hEmpty, 230, LTF_JUSTIFY_LEFT); } g_pLTClient->FreeString(hEmpty); }
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)); }
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 CFolderLoad::BuildSavedLevelList() { char strSaveGameSetting[256]; memset (strSaveGameSetting, 0, 256); if (CWinUtil::FileExist(QUICKSAVE_FILENAME)) { SaveGameData sQuickSave; CWinUtil::WinGetPrivateProfileString (GAME_NAME, "SaveGame00", "", strSaveGameSetting, 256, SAVEGAMEINI_FILENAME); ParseSaveString(strSaveGameSetting,&sQuickSave,LTFALSE); if (strlen(sQuickSave.szUserName) > 0) { CLTGUITextItemCtrl *pCtrl = AddTextItem(IDS_QUICKLOAD,LTNULL,LTNULL,LTTRUE,GetMediumFont()); pCtrl->Enable(LTFALSE); char szStr[256]; sprintf(szStr," %s",sQuickSave.szUserName); HSTRING hLoad=g_pLTClient->CreateString(szStr); CLTGUIColumnTextCtrl* pColCtrl = AddColumnText(FOLDER_CMD_CUSTOM, IDS_HELP_QUICKLOAD, LTFALSE, GetSmallFont()); // The world name column pColCtrl->AddColumn(hLoad, kColumnWidth, LTF_JUSTIFY_LEFT); if (strlen(sQuickSave.szTime) > 0) { // The column that contains the date/time HSTRING hTime=g_pLTClient->CreateString(sQuickSave.szTime); pColCtrl->AddColumn(hTime, 230, LTF_JUSTIFY_LEFT); g_pLTClient->FreeString(hTime); } g_pLTClient->FreeString(hLoad); } } if (CWinUtil::FileExist(RELOADLEVEL_FILENAME)) { CWinUtil::WinGetPrivateProfileString (GAME_NAME, "Reload", "", strSaveGameSetting, 256, SAVEGAMEINI_FILENAME); SaveGameData sAutoSave; ParseSaveString(strSaveGameSetting,&sAutoSave,LTFALSE); if (strlen(sAutoSave.szUserName) > 0) { CLTGUITextItemCtrl *pCtrl = AddTextItem(IDS_LOADCURRENT,LTNULL,LTNULL,LTTRUE,GetMediumFont()); pCtrl->Enable(LTFALSE); char szStr[256]; sprintf(szStr," %s",sAutoSave.szUserName); HSTRING hLoad=g_pLTClient->CreateString(szStr); CLTGUIColumnTextCtrl* pColCtrl = AddColumnText(FOLDER_CMD_CUSTOM+1, IDS_HELP_RELOAD, LTFALSE, GetSmallFont()); // The world name column pColCtrl->AddColumn(hLoad, kColumnWidth, LTF_JUSTIFY_LEFT); if (strlen(sAutoSave.szTime) > 0) { // The column that contains the date/time HSTRING hTime=g_pLTClient->CreateString(sAutoSave.szTime); pColCtrl->AddColumn(hTime, 230, LTF_JUSTIFY_LEFT); g_pLTClient->FreeString(hTime); } g_pLTClient->FreeString(hLoad); } } CLTGUITextItemCtrl *pCtrl = AddTextItem(IDS_LOAD_USERGAME,LTNULL,LTNULL,LTTRUE,GetMediumFont()); pCtrl->Enable(LTFALSE); for (int i = 0; i < kMaxSave; i++) { char strFilename[128]; sprintf (strFilename, "Save\\Slot%02d.sav", i+1); if (CWinUtil::FileExist(strFilename)) { SaveGameData sSave; char szKey[32] = ""; sprintf (szKey, "SaveGame%02d", i+1); CWinUtil::WinGetPrivateProfileString (GAME_NAME, szKey, "", strSaveGameSetting, 256, SAVEGAMEINI_FILENAME); ParseSaveString(strSaveGameSetting,&sSave); if (strlen(sSave.szUserName) > 0) { char szStr[256]; sprintf(szStr," %s",sSave.szUserName); HSTRING hLoad=g_pLTClient->CreateString(szStr); CLTGUIColumnTextCtrl* pCtrl = AddColumnText(FOLDER_CMD_CUSTOM+2+i, IDS_HELP_LOADGAME, LTFALSE, GetSmallFont()); // The world name column pCtrl->AddColumn(hLoad, kColumnWidth, LTF_JUSTIFY_LEFT); if (strlen(sSave.szTime) > 0) { // The column that contains the date/time HSTRING hTime=g_pLTClient->CreateString(sSave.szTime); pCtrl->AddColumn(hTime, 230, LTF_JUSTIFY_LEFT); g_pLTClient->FreeString(hTime); } g_pLTClient->FreeString(hLoad); } } } }
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(); }