LTBOOL CFolderObjectives::Build()
{

	CreateTitle(IDS_TITLE_OBJECTIVES);


    m_pMissionCtrl=AddTextItem(IDS_SPACER,LTNULL,0,LTTRUE, GetMediumFont());
	m_pMissionCtrl->SetFixedWidth(480);
    m_pMissionCtrl->Enable(LTFALSE);

	AddBlankLine();

    CLTGUITextItemCtrl* pCtrl=AddTextItem(IDS_OBJECTIVES,LTNULL,0,LTTRUE, GetMediumFont());
    pCtrl->Enable(LTFALSE);

	CLTGUIFont *pFont = GetMediumFont();

    m_pSpacerCtrl = CreateTextItem(" ",LTNULL,LTNULL, LTTRUE, pFont);
    m_pSpacerCtrl->Enable(LTFALSE);

	dwNumStaticControls = m_controlArray.GetSize();

	return 	CBaseFolder::Build();
;
}
예제 #2
0
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);
		}

	}
}
예제 #3
0
LTBOOL CFolderIntel::Build()
{

	LTIntPt header = g_pLayoutMgr->GetFolderCustomPoint((eFolderID)m_nFolderID,"HeaderPos");
	CLTGUITextItemCtrl *pCtrl = CreateTextItem(IDS_INTEL_ITEMS,0,0,LTTRUE,GetMediumFont());
	AddFixedControl(pCtrl,header,LTFALSE);

    UseArrows(LTTRUE);
	UseBack(LTTRUE,LTFALSE,LTTRUE);

	return CBaseSelectionFolder::Build();
}
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);

}
예제 #5
0
void CFolderNew::BuildMissionList()
{
	int nextMission = g_pGameClientShell->GetPlayerSummary()->GetNextMission();
	int nCurrentMission = -1;
	for (int mis = 0; mis <= nextMission; ++mis)
	{
		MISSION* pMission = g_pMissionMgr->GetMission(mis);
        uint32 cmd = (uint32)mis + FOLDER_CMD_CUSTOM;
		if (!pMission) break;

		int nameId = pMission->nNameId;
		int nListWidth = m_ListRect.right - m_ListRect.left;
        HSTRING hStr = g_pLTClient->FormatString(nameId);

		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();

		CBitmapCtrl *pCheck = debug_new(CBitmapCtrl);
		if (g_pLayoutMgr->GetListFontSize((eFolderID)m_nFolderID))
            pCheck->Create(g_pLTClient,"interface\\check-off.pcx","interface\\check-on.pcx");
		else
            pCheck->Create(g_pLTClient,"interface\\small_check-off.pcx","interface\\small_check-on.pcx");
		pCheck->Select((mis < nextMission));

		int nWidth = pCheck->GetWidth();
        CStaticTextCtrl *pCtrl = CreateStaticTextItem(hStr,cmd,LTNULL,(nListWidth - nWidth),0,LTFALSE,pFont);
        pCtrl->Enable(LTTRUE);


		int nHeight = Max(pCtrl->GetHeight(),pCheck->GetHeight());

		CGroupCtrl *pGroup = AddGroup(nListWidth,nHeight,cmd);
        g_pLTClient->FreeString(hStr);

        LTIntPt offset;

        pGroup->AddControl(pCheck,offset,LTFALSE);
		offset.x = nWidth;
        pGroup->AddControl(pCtrl,offset,LTTRUE);

//		AddPhotoBitmap(g_pInterfaceResMgr->GetSharedSurface(pMission->szPhoto));


	}
}
예제 #6
0
LTBOOL CFolderViewInventory::Build()
{
	CreateTitle(IDS_TITLE_INVENTORY);
	m_pFont = GetLargeFont();
	if (g_pLayoutMgr->GetListFontSize((eFolderID)m_nFolderID) == 0)
		m_pFont = GetSmallFont();
	else if (g_pLayoutMgr->GetListFontSize((eFolderID)m_nFolderID) == 1)
		m_pFont = GetMediumFont();

    UseArrows(LTTRUE);
	UseBack(LTTRUE,LTFALSE,LTTRUE);

    LTBOOL success = CBaseSelectionFolder::Build();


	return success;

}
예제 #7
0
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);


}
예제 #8
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);
		}

	}
}
// Build the folder
LTBOOL CFolderJoin::Build()
{
	rcServerRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"ServerRect");
	rcPlayerRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"PlayerRect");
	rcOptionRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"OptionRect");
	rcStatusRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"StatusRect");
	rcCommandRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"CommandRect");

	nGap = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ColumnGap");
	nIndent = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TextIndent");

	nGameWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"GameWidth");
	nPlayerWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"PlayerWidth");
	nPingWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"PingWidth");
	nTypeWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TypeWidth");
	nMapWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"MapWidth");
	nNameWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"NameWidth");
	nScoreWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ScoreWidth");
	nOptionWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"OptionWidth");

	nArrowWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ArrowWidth");

	CreateTitle(IDS_TITLE_JOIN);

	//Add Server Header
    LTIntPt pos(rcServerRect.left + nIndent,rcServerRect.top);
	CLTGUIFont *pFont = GetMediumFont();
	nBarHeight = pFont->GetHeight();


	CStaticTextCtrl *pCtrl = CreateStaticTextItem(IDS_SERVER_NAME,CMD_SORT_SERV_NAME,IDS_HELP_SERVER_NAME,nGameWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerNameCtrl = pCtrl;
	pos.x += nGameWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PLAYERS,CMD_SORT_SERV_PLAYERS,IDS_HELP_SERVER_PLAYERS,nPlayerWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerPlayersCtrl = pCtrl;
	pos.x += nPlayerWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PING,CMD_SORT_SERV_PING,IDS_HELP_SERVER_PING,nPingWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pServerPingCtrl = pCtrl;
	pos.x += nPingWidth+nGap;

	pFont = GetMediumFont();
    pCtrl = CreateStaticTextItem(IDS_SERVER_GAME,CMD_SORT_SERV_GAME,LTNULL,nTypeWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
	pServerGameCtrl = pCtrl;
	pos.x += nTypeWidth+nGap;

    pCtrl = CreateStaticTextItem(IDS_SERVER_MAP,CMD_SORT_SERV_MAP,LTNULL,nMapWidth,pFont->GetHeight(),LTFALSE,pFont);
	pServerMapCtrl = pCtrl;
    AddFixedControl(pCtrl,pos,LTFALSE);

	//Add Server List
	pos.x = rcServerRect.left + nIndent;
	pos.y = rcServerRect.top + nBarHeight;
	int nListHeight = (rcServerRect.bottom - rcServerRect.top) - nBarHeight;
	nListHeight += 19;	// [blg] tweak

	nServerGroupWidth = (rcServerRect.right - rcServerRect.left) - nArrowWidth;
	m_pServerList = debug_new(CListCtrl);
    m_pServerList->Create(nListHeight, LTTRUE, nServerGroupWidth);
	m_pServerList->SetItemSpacing(0);
    m_pServerList->EnableMouseClickSelect(LTTRUE);
    AddFixedControl(m_pServerList,pos,LTTRUE);

	//Add Player Header
	pFont = GetMediumFont();
    pos = LTIntPt(rcPlayerRect.left + nIndent,rcPlayerRect.top);

	pCtrl = CreateStaticTextItem(IDS_JOIN_PLAYER_NAME,CMD_SORT_PLYR_NAME,IDS_HELP_SORT_PLYR_NAME,nNameWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pPlayerNameCtrl = pCtrl;
	pos.x += nNameWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_JOIN_PLAYER_SCORE,CMD_SORT_PLYR_SCORE,IDS_HELP_SORT_PLYR_SCORE,nScoreWidth,pFont->GetHeight(),LTFALSE,pFont);
    AddFixedControl(pCtrl,pos,LTTRUE);
	pPlayerFragCtrl = pCtrl;
	pos.x += nScoreWidth+nGap;

	pCtrl = CreateStaticTextItem(IDS_SERVER_PING,CMD_SORT_PLYR_PING,IDS_HELP_SORT_PLYR_PING,nPingWidth,pFont->GetHeight(),LTFALSE,pFont);
	pPlayerPingCtrl = pCtrl;
    AddFixedControl(pCtrl,pos,LTTRUE);

	//Add PlayerList Here
	pos.x = rcPlayerRect.left + nIndent;
	pos.y = rcPlayerRect.top + nBarHeight;
	nListHeight = (rcPlayerRect.bottom - rcPlayerRect.top) - nBarHeight;
	nListHeight += 24;	// [blg] tweak
	nPlayerGroupWidth = (rcPlayerRect.right - rcPlayerRect.left) - nArrowWidth;
	m_pPlayerList = debug_new(CListCtrl);
    m_pPlayerList->Create(nListHeight, LTTRUE, nPlayerGroupWidth);
	m_pPlayerList->SetItemSpacing(0);
//    m_pPlayerList->Enable(LTFALSE);
    AddFixedControl(m_pPlayerList,pos,LTTRUE);


	//Add Commands
	pFont = GetMediumFont();
	pos.x = rcCommandRect.left;
	pos.y = rcCommandRect.top;
	m_pRefresh = CreateTextItem(IDS_SERVER_REFRESH,CMD_REFRESH_SERVERS,IDS_HELP_REFRESH,LTFALSE,pFont);
    AddFixedControl(m_pRefresh,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	// [blg] re-ping is not support in the GameSpy SDK
	//m_pRePing = CreateTextItem(IDS_SERVER_REPING,CMD_REPING_SERVERS,IDS_HELP_REPING,LTFALSE,pFont);
    //AddFixedControl(m_pRePing,pos,LTTRUE);
	//pos.y += pFont->GetHeight();

	m_pVersionFilter = CreateTextItem(IDS_ALL_VERSIONS,CMD_VERSION_FILTER,IDS_HELP_VERSION_FILTER,LTFALSE,pFont,&m_nVersionFilter);
	m_pVersionFilter->AddString(IDS_CURRENT_VERSION);
    AddFixedControl(m_pVersionFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pGameFilter = CreateTextItem(anGameFilterID[0],CMD_GAME_FILTER,IDS_HELP_GAME_FILTER,LTFALSE,pFont,&m_nGameFilter);
	m_pGameFilter->AddString(anGameFilterID[1]);
	m_pGameFilter->AddString(anGameFilterID[2]);
    AddFixedControl(m_pGameFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pPopFilter = CreateTextItem(anPopFilterID[0],CMD_POP_FILTER,IDS_HELP_POP_FILTER,LTFALSE,pFont,&m_nPopFilter);
	m_pPopFilter->AddString(anPopFilterID[1]);
	m_pPopFilter->AddString(anPopFilterID[2]);
	m_pPopFilter->AddString(anPopFilterID[3]);
    AddFixedControl(m_pPopFilter,pos,LTTRUE);
	pos.y += pFont->GetHeight();

	m_pJoin = CreateTextItem(IDS_JOIN_GAME,CMD_JOIN,IDS_HELP_JOIN_GAME,LTFALSE,pFont);
    m_pJoin->Enable(LTFALSE);
    AddFixedControl(m_pJoin,pos,LTFALSE);
	pos.y += pFont->GetHeight();


	//Add Option Header
	pFont = GetMediumFont();
    pos = LTIntPt(rcOptionRect.left + nIndent,rcOptionRect.top);

    pCtrl = CreateStaticTextItem(IDS_OPTION_NAME,LTNULL,LTNULL,nNameWidth,pFont->GetHeight(),LTTRUE,pFont);
    pCtrl->Enable(LTFALSE);
    AddFixedControl(pCtrl,pos,LTFALSE);
	pos.x += nOptionWidth+nGap;

    pCtrl = CreateStaticTextItem(IDS_OPTION_VALUE,LTNULL,LTNULL,nScoreWidth,pFont->GetHeight(),LTTRUE,pFont);
    pCtrl->Enable(LTFALSE);
    AddFixedControl(pCtrl,pos,LTFALSE);

	//Add OptionList Here
	pos.x = rcOptionRect.left + nIndent;
	pos.y = rcOptionRect.top + nBarHeight;
	nListHeight = (rcOptionRect.bottom - rcOptionRect.top) - nBarHeight;
	nOptionGroupWidth = (rcOptionRect.right - rcOptionRect.left) - nArrowWidth;
	m_pOptionList = debug_new(CListCtrl);
    m_pOptionList->Create(nListHeight, LTTRUE, nOptionGroupWidth);
	m_pOptionList->SetItemSpacing(0);
//    m_pOptionList->Enable(LTFALSE);
    AddFixedControl(m_pOptionList,pos,LTFALSE);

	rcStatusRect.top = rcStatusRect.bottom - nBarHeight;

    bFrameDelay = LTTRUE;

	// Make sure to call the base class
	return CBaseFolder::Build();
}
// Change in focus
void CFolderWeaponControls::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		nLastId = WMGR_INVALID_ID;
		ReadBindings();		
		CLTGUIColumnTextCtrl *pCtrl=AddColumnText(LTNULL, LTNULL, LTTRUE, GetMediumFont());

		HSTRING hText = g_pLTClient->FormatString(IDS_KEY);
		pCtrl->AddColumn(hText, 50, LTF_JUSTIFY_LEFT);
		g_pLTClient->FreeString(hText);

		hText = g_pLTClient->FormatString(IDS_WEAPON);
		pCtrl->AddColumn(hText, kWidth, LTF_JUSTIFY_LEFT);
		pCtrl->Enable(LTFALSE);
		g_pLTClient->FreeString(hText);

//		AddBlankLine();


		for (int i = 0; i < 10; i++)
		{
			pCtrl=AddColumnText(LTNULL, IDS_HELP_SETWEAPON, LTFALSE, GetSmallFont());
			pCtrl->SetParam1(i+1);

			char str[16];
			sprintf(str,"  %s",szTriggers[i]);
			hText = g_pLTClient->CreateString(str);
			pCtrl->AddColumn(hText, 50, LTF_JUSTIFY_LEFT);
			g_pLTClient->FreeString(hText);

			int nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[i]);
			WEAPON *pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
			if (pWeapon)
				pCtrl->AddColumn(pWeapon->nNameId, kWidth, LTF_JUSTIFY_LEFT);
			else
				pCtrl->AddColumn(IDS_CONTROL_UNASSIGNED, kWidth, LTF_JUSTIFY_LEFT);


		}

		AddBlankLine();

		m_bLargeIcon = (GetConsoleInt("BindingIconSize",0) > 0);
		CToggleCtrl *pToggle = AddToggle(IDS_WPN_ICON_SZ,IDS_HELP_WPN_ICON_SZ, kWidth, &m_bLargeIcon,LTFALSE,GetSmallFont());
		pToggle->SetOnString(IDS_LARGE);
		pToggle->SetOffString(IDS_SMALL);

		m_nIconAlpha = (int)(GetConsoleFloat("BindingIconAlpha",0.7f) * 10.0f);
		CSliderCtrl *pSlider = AddSlider(IDS_WPN_ICON_A,IDS_HELP_WPN_ICON_A,kWidth,kSlider,&m_nIconAlpha,LTFALSE,GetSmallFont());
		pSlider->SetSliderIncrement(1);
		pSlider->SetSliderRange(0,10);

		m_bUseNumbers = (GetConsoleInt("BindingNumbers",1) > 0);
		pToggle = AddToggle(IDS_WPN_USE_NUMS,IDS_HELP_WPN_USE_NUMS, kWidth, &m_bUseNumbers,LTFALSE,GetSmallFont());
		pToggle->SetOnString(IDS_YES);
		pToggle->SetOffString(IDS_NO);


        UpdateData(LTFALSE);

	}
	else
	{
		UpdateData();

		WriteConsoleInt("BindingIconSize",m_bLargeIcon);
		WriteConsoleInt("BindingNumbers",m_bUseNumbers);
		WriteConsoleFloat("BindingIconAlpha",((LTFLOAT)m_nIconAlpha) / 10.0f);
		WriteBindings();

		g_pInterfaceMgr->GetPlayerStats()->UpdateWeaponBindings();

		// Just to be safe save the config incase anything changed...
        g_pLTClient->WriteConfigFile("autoexec.cfg");
		RemoveFree();

	}
	CBaseFolder::OnFocus(bFocus);
	if (bFocus) UpdateSelection();

}
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);
			}
		}

	}


}
예제 #12
0
// Build the folder
LTBOOL CFolderPlayer::Build()
{

	CreateTitle(IDS_TITLE_PLAYER_SETUP);

    g_vtPlayerModel.Init(g_pLTClient, "NetPlayerModel", "Hero,action", 0.0f);
    g_vtPlayerTeam.Init(g_pLTClient, "NetPlayerTeam", LTNULL, 0.0f);
    g_vtTargetNameTransparency.Init(g_pLTClient, "TargetNameTransparency", LTNULL, 1.0f);
    g_vtTargetNameSize.Init(g_pLTClient, "TargetNameSize", LTNULL, 0.0f);

	m_pLabel = CreateTextItem(IDS_PLAYER_NAME, CMD_EDIT_NAME, IDS_HELP_PLAYER_NAME);

    m_pEdit = CreateEditCtrl(" ", CMD_EDIT_NAME, LTNULL, m_szPlayerName, sizeof(m_szPlayerName), 25, LTTRUE, GetMediumFont());
	m_pEdit->EnableCursor();
    m_pEdit->Enable(LTFALSE);
	m_pEdit->SetAlignment(LTF_JUSTIFY_CENTER);

	m_pNameGroup = AddGroup(640,m_pLabel->GetHeight(),IDS_HELP_PLAYER_NAME);

    LTIntPt offset(0,0);
    m_pNameGroup->AddControl(m_pLabel,offset,LTTRUE);
	offset.x = 200;
    m_pNameGroup->AddControl(m_pEdit,offset,LTFALSE);

	AddBlankLine();

	CToggleCtrl* pToggle = AddToggle(IDS_AUTOSWITCH_WEAPONS, IDS_HELP_AUTOSWITCH_WEAPONS, 225, &m_bAutoSwitchWeapons );
	pToggle->SetOnString(IDS_ON);
	pToggle->SetOffString(IDS_OFF);

	pToggle = AddToggle(IDS_AUTOSWITCH_AMMO, IDS_HELP_AUTOSWITCH_AMMO, 225, &m_bAutoSwitchAmmo );
	pToggle->SetOnString(IDS_ON);
	pToggle->SetOffString(IDS_OFF);

	pToggle = AddToggle(IDS_IGNORE_TAUNTS, IDS_HELP_IGNORE_TAUNTS, 225, &m_bIgnoreTaunts );
	pToggle->SetOnString(IDS_YES);
	pToggle->SetOffString(IDS_NO);

	CCycleCtrl *pCycle = AddCycleItem(IDS_CONNECT_SPEED,IDS_CONNECT_SPEED,200,25,&m_nConnect);
	pCycle->AddString(IDS_CONNECT_VSLOW);
	pCycle->AddString(IDS_CONNECT_SLOW);
	pCycle->AddString(IDS_CONNECT_MEDIUM);
	pCycle->AddString(IDS_CONNECT_FAST);

	pCycle = AddCycleItem(IDS_PLAYER_TEAM,IDS_HELP_PLAYER_TEAM,200,25,&m_nTeam);
	pCycle->AddString(IDS_PLAYER_EITHER);
	pCycle->AddString(IDS_PLAYER_UNITY);
	pCycle->AddString(IDS_PLAYER_HARM);

	CSliderCtrl* pSlider = AddSlider(IDS_TARGETNAMETRANSPARENCY, IDS_TARGETNAMETRANSPARENCY_HELP, 225, 200, &m_nTargetNameTransparency);
	pSlider->SetSliderRange(0, 100);
	pSlider->SetSliderIncrement(5);

	pCycle = AddCycleItem(IDS_TARGETNAMESIZE,IDS_TARGETNAMESIZE_HELP,200,25,&m_nTargetNameSize);
	pCycle->AddString(IDS_SMALL);
	pCycle->AddString(IDS_MEDIUM);
	pCycle->AddString(IDS_LARGE);

	m_pModelCtrl = AddCycleItem(IDS_PLAYER_MODEL,IDS_HELP_PLAYER_MODEL,200,25,&m_nModNum);
	m_pModelCtrl->NotifyOnChange(CMD_MODEL_CHANGE,this);

	m_pSkinCtrl = AddCycleItem(IDS_PLAYER_SKIN,IDS_HELP_PLAYER_SKIN,200,25,&m_nSkinNum);
	m_pSkinCtrl->NotifyOnChange(CMD_SKIN_CHANGE,this);

	m_pHeadCtrl = AddCycleItem(IDS_PLAYER_HEAD,IDS_HELP_PLAYER_HEAD,200,25,&m_nHeadNum);
	m_pHeadCtrl->NotifyOnChange(CMD_HEAD_CHANGE,this);

	// Make sure to call the base class
	if (! CBaseFolder::Build()) return LTFALSE;

	UseBack(LTTRUE,LTTRUE);
	return LTTRUE;
}
void CFolderObjectives::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		m_pMissionCtrl->RemoveAll();
		UseContinue(FOLDER_ID_NONE);

		int missionNum = g_pInterfaceMgr->GetMissionData()->GetMissionNum();

		MISSION* pMission = g_pMissionMgr->GetMission(missionNum);
		if (!pMission) return;

		int missionId = pMission->nNameId;

        HSTRING hTxt=g_pLTClient->FormatString(missionId);
		m_pMissionCtrl->AddString(hTxt);
        g_pLTClient->FreeString(hTxt);

		//add objectives
		BuildObjectivesList();

		//add spacer
		AddFreeControl(m_pSpacerCtrl);


		UseBack(LTFALSE);
	    int nHelp = LTNULL;
		m_eNextFolder = GetNextSelectionFolder(FOLDER_ID_OBJECTIVES,&nHelp);
		UseContinue(FOLDER_ID_NONE);

		
		if (m_eNextFolder == FOLDER_ID_INVENTORY)
		{
			m_pSelectCtrl = CreateTextItem( IDS_START_MISSION, CMD_START, IDS_HELP_START, LTFALSE, GetMediumFont());
			LTIntPt pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"StartPos");
			AddFixedControl(m_pSelectCtrl,pos);
			SetSelection(GetIndex(m_pSelectCtrl));
		}
		else
		{
			LTIntPt pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"SkipPos");

			m_pSkipCtrl = CreateTextItem( IDS_SKIP_OUTFITTING,CMD_SKIP, IDS_HELP_SKIP_OUTFITTING, LTFALSE, GetMediumFont());
			AddFixedControl(m_pSkipCtrl,pos);
			SetSelection(GetIndex(m_pSkipCtrl));

			pos = g_pLayoutMgr->GetFolderCustomPoint(FOLDER_ID_OBJECTIVES,"SelectPos");
			
			m_pSelectCtrl =  CreateTextItem( IDS_DO_OUTFITTING, FOLDER_CMD_CONTINUE, IDS_HELP_DO_OUTFITTING, LTFALSE, GetMediumFont());
			AddFixedControl(m_pSelectCtrl,pos);
		}

		UseBack();
	}
	else
	{
		SetSelection(kNoSelection);
		while (m_controlArray.GetSize() > dwNumStaticControls)
		{
			CLTGUICtrl* pCtrl = m_controlArray[dwNumStaticControls];
			m_controlArray.Remove(dwNumStaticControls);

			if (pCtrl != m_pSpacerCtrl)
				debug_delete(pCtrl);


		}
		if (m_pSkipCtrl)
		{
			RemoveFixedControl(m_pSkipCtrl);
			debug_delete(m_pSkipCtrl);
			m_pSkipCtrl = LTNULL;
 
		}

		if (m_pSelectCtrl)
		{
			RemoveFixedControl(m_pSelectCtrl);
			debug_delete(m_pSelectCtrl);
			m_pSelectCtrl = LTNULL;
 
		}


	}
	CBaseFolder::OnFocus(bFocus);

}