示例#1
0
// Build the screen
LTBOOL CScreenHostLevels::Build()
{
	LTIntPt addPos = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"AddPos");
	LTIntPt removePos = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"RemovePos");
	LTIntPt commandPos = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"CommandPos");

	if (g_pLayoutMgr->HasCustomValue((eScreenID)m_nScreenID,"ListFontSize"))
		nListFontSize = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontSize");

	CreateTitle(IDS_TITLE_HOST_MISSIONS);

	m_pAdd = AddTextItem(IDS_HOST_ADD_MISSION, CMD_ADD_LEVEL, IDS_HELP_ADD_MISSION, addPos);
	
	m_pAddAll = AddTextItem(IDS_HOST_ADD_ALL, CMD_ADD_ALL, IDS_HELP_ADD_ALL, commandPos);
	m_pRemoveAll = AddTextItem(IDS_HOST_REMOVE_ALL, CMD_REMOVE_ALL, IDS_HELP_REM_ALL);

	m_pRemove = AddTextItem(IDS_HOST_REMOVE_MISSION, CMD_REMOVE_LEVEL, IDS_HELP_REM_MISSION, removePos);

	
	LTRect rcAvailRect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"AvailRect");
	int nListHeight = (rcAvailRect.bottom - rcAvailRect.top);
	nAvailWidth = (rcAvailRect.right - rcAvailRect.left);

	m_pAvailMissions = AddList(LTIntPt(rcAvailRect.left,rcAvailRect.top),nListHeight,LTTRUE,nAvailWidth);
	m_pAvailMissions->SetIndent(LTIntPt(5,5));
	m_pAvailMissions->SetFrameWidth(2);
	m_pAvailMissions->Enable(LTFALSE);

	LTRect rcSelRect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"SelectRect");
	nListHeight = (rcSelRect.bottom - rcSelRect.top);
	nSelWidth = (rcSelRect.right - rcSelRect.left);

	m_pSelMissions = AddList(LTIntPt(rcSelRect.left,rcSelRect.top),nListHeight,LTTRUE,nSelWidth);
	m_pSelMissions->SetIndent(LTIntPt(5,5));
	m_pSelMissions->SetFrameWidth(2);
	m_pSelMissions->Enable(LTFALSE);

	m_nextPos.y += nListHeight;
	uint16 nListWidth = nSelWidth-16;
	m_pLoopToggle = AddToggle(IDS_LOOP_MISSIONS,IDS_HELP_LOOP_MISSIONS,nListWidth,&m_bLoopMissions);
	m_pLoopToggle->SetOnString(LoadTempString(IDS_YES));
	m_pLoopToggle->SetOffString(LoadTempString(IDS_NO));


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

	UseBack(LTTRUE,LTTRUE);

	

	return LTTRUE;

}
示例#2
0
LTBOOL CHUDCrosshair::Init()
{

	g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite);
	g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite);
	g_pDrawPrim->SetRGBA(&m_Poly[2],argbWhite);


    g_vtScopeLRGap.Init(g_pLTClient, "ScopeLRGap", NULL, 32.0f);
    g_vtScopeUDGap.Init(g_pLTClient, "ScopeUPGap", NULL, 32.0f);
    g_vtScopeLRRadius.Init(g_pLTClient, "ScopeLRRadius", NULL, 0.377f);
    g_vtScopeUDRadius.Init(g_pLTClient, "ScopeUDRadius", NULL, 0.34f);

	uint8 nFont = g_pLayoutMgr->GetHUDFont();
	CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);

	m_StrPos = LTIntPt(320,250);
	m_nStrSz = 16;
	m_nStrJust = 1;
	m_StrColor = argbWhite;
	m_StrDisColor = 0x80808080;

	m_pStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pStr->SetColor(m_StrColor);

	m_DbgPos = LTIntPt(360,200);
	m_nDbgSz = 12;
	m_nDbgWidth = 220;
	m_nDbgJust = 0;
	m_DbgColor = argbWhite;

	m_pDbgStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pDbgStr->SetColor(m_DbgColor);
	m_pDbgStr->SetWrapWidth(m_nDbgWidth);


	uint8 style = (uint8)GetConsoleInt("CrosshairStyle",0);
	SetStyle(style);

	UpdateLayout();	


	return LTTRUE;
}
示例#3
0
LTBOOL CMenuMgr::Init()
{
	//build menu array
	m_MenuArray.reserve(MENU_ID_UNASSIGNED);

	//add menus here
	m_MenuArray.push_back(&m_MenuSystem);
	m_MenuArray.push_back(&m_MenuMission);
	m_MenuArray.push_back(&m_MenuInventory);
	m_MenuArray.push_back(&m_MenuKeys);
	m_MenuArray.push_back(&m_MenuIntel);
	m_MenuArray.push_back(&m_MenuPlayer);

	//init menus
	MenuArray::iterator iter = m_MenuArray.begin();
	while (iter != m_MenuArray.end())
	{
		if (!(*iter)->Init())
			return LTFALSE;
		iter++;
	}

	m_fSlideInTime	= g_pLayoutMgr->GetMenuSlideInTime();
	m_fSlideOutTime = g_pLayoutMgr->GetMenuSlideOutTime();
	m_nMenuPos		= g_pLayoutMgr->GetMenuPosition();

	char szTemp[128];
	char *pTag = "Menu";

	g_pLayoutMgr->GetString(pTag,"SlideInSound",szTemp,sizeof(szTemp));
	m_sSlideInSound = szTemp;

	g_pLayoutMgr->GetString(pTag,"SlideOutSound",szTemp,sizeof(szTemp));
	m_sSlideOutSound = szTemp;

	g_pLayoutMgr->GetString(pTag,"Bar",szTemp,sizeof(szTemp));
	HTEXTURE hBar = g_pInterfaceResMgr->GetTexture(szTemp);

	g_pLayoutMgr->GetString(pTag,"BarTip",szTemp,sizeof(szTemp));
	HTEXTURE hBarTip = g_pInterfaceResMgr->GetTexture(szTemp);



	LTIntPt size = g_pLayoutMgr->GetPoint(pTag,"BarSize");
	uint8 fontFace = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFont");
	uint8 fontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFontSize");
	m_nBarPos = g_pLayoutMgr->GetInt(pTag,"BarPosition");
	int nBarSpacing = g_pLayoutMgr->GetInt(pTag,"BarSpacing");
	LTVector vCol = g_pLayoutMgr->GetVector(pTag,"BarSelectColor");
	uint8 nR = (uint8)vCol.x;
	uint8 nG = (uint8)vCol.y;
	uint8 nB = (uint8)vCol.z;
	g_nSelectColor = SET_ARGB(0xFF,nR,nG,nB);


	m_MenuBar.Init(hBar,hBarTip,size);
	m_MenuBar.SetBasePos(LTIntPt(0,m_nBarPos));
	
	CUIFont* pFont = g_pInterfaceResMgr->GetFont(fontFace);
	
	LTIntPt offset(nBarSpacing,(size.y-fontSize)/2);
	for (uint8 i =0; i < m_MenuArray.size(); i++)
	{
		CLTGUITextCtrl *pCtrl = debug_new(CLTGUITextCtrl);
		CBaseMenu *pMenu = m_MenuArray[i];
		pCtrl->Create(pMenu->GetTitle(),i,NULL,pFont,fontSize,&m_MenuBar);
		pCtrl->SetColors(g_nSelectColor,argbBlack,argbWhite);
		pCtrl->SetParam1(pMenu->GetMenuID());
		m_MenuBar.AddControl(pCtrl,offset);
		offset.x += nBarSpacing + pCtrl->GetWidth();
	}

    return LTTRUE;
}
示例#4
0
LTBOOL CLoadingScreen::Init()
{
	if (m_eCurState != STATE_NONE)
		return LTFALSE;

	if( m_pRenderScreen )
	{
		// Just let the render screen know it is about to be draw and set the state to init...

		m_pRenderScreen->OnFocus( true );
		m_eCurState = STATE_INIT;

		return LTTRUE;
	}
	
	m_photo = "";

	// Check if we have a mission entry.
	bool bGotMission = false;
	
	if( !g_pMissionMgr->IsCustomLevel( ))
	{
		int nCurMission = g_pMissionMgr->GetCurrentMission( );
		MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission );

		if( pMission )
		{
			if (pMission->nNameId > 0)
				m_missionname = LoadTempString(pMission->nNameId);
			else
				m_missionname = pMission->sName;

			int nCurLevel = g_pMissionMgr->GetCurrentLevel( );
			m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId );
			m_layout = pMission->szLayout;

			//set the post load layout here, so that it matches
			// even when our mission info is updated partway through the load
			CScreenPostload *pPostload = (CScreenPostload *) (g_pInterfaceMgr->GetScreenMgr( )->GetScreenFromID(SCREEN_ID_POSTLOAD));
			if (pPostload)
			{
				pPostload->SetLayout(pMission->szLayout);
			}


			// Show a briefing for this level if it exists.  Also, only
			// show the briefing if we haven't been to this level before.
			int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId;
			if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( ))
			{
				m_briefing = LoadTempString( nBriefingId );
				m_layout = pMission->szBriefLayout;
				if (pPostload)
				{
					pPostload->SetLayout(pMission->szBriefLayout);
				}
			}
			else
				m_briefing = "";

			// Show help text for this level if it exists.
			int nHelpId = pMission->aLevels[nCurLevel].nHelpId;
			if( nHelpId >= 0)
			{
				m_help = LoadTempString( nHelpId );
				if (pPostload)
				{
					pPostload->SetLayout(pMission->szBriefLayout);
				}
			}
			else
				m_help = "";

			if( !IsCoopMultiplayerGameType( ))
			{
				m_photo = pMission->sPhoto;
			}


			bGotMission = true;
		}

	}

	// If we were unsuccessful in getting info from the mission, then just
	// use defaults.
	if( !bGotMission )
	{
		// If connecting to a remote server, set our mission descriptor to 
		// the ip we're connecting to.
		if( g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ))
		{
			// Make a loading string using the IP to be joined.
			char szLoadingString[256];

			if (strlen(g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName))
			{
				sprintf( szLoadingString, "%s:  %s", LoadTempString(IDS_CONNECTING_TO_SERVER), 
					g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName );
			}
			else
			{
				sprintf( szLoadingString, "%s", LoadTempString(IDS_CONNECTING_TO_SERVER));
			}
			m_missionname = szLoadingString;

			sprintf( szLoadingString, "    (%s)", g_pClientMultiplayerMgr->GetStartGameRequest( ).m_TCPAddress );

			m_levelname = szLoadingString;
		}
		// Local game, set the mission descriptor to the level name.
		else
		{
			if (g_pGameClientShell->IsRunningPerformanceTest())
			{
				m_missionname = LoadTempString( IDS_TITLE_PERFORMANCE_TEST );
				m_levelname = "";
			}
			else
			{
				m_missionname = LoadTempString( IDS_CUSTOM_LEVEL );
				// Split the worldname up into parts so we can get the load string.
				char const* pszWorldName = g_pMissionMgr->GetCurrentWorldName( );
				char szWorldTitle[MAX_PATH] = "";
				_splitpath( pszWorldName, NULL, NULL, szWorldTitle, NULL );
				m_levelname = szWorldTitle;

			}

		}

		m_layout = "LoadScreenDefault";
		m_briefing = "";
		m_help = "";
	}

	char szTagName[30];
	if (!m_bReadLayout)
	{
		m_bReadLayout = true;

		SAFE_STRCPY(szTagName,"LoadScreenDefault");

		//default layout info title string
		m_DefaultTitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");
		m_nDefaultTitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");
		m_nDefaultTitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

		LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
		uint8 nR = (uint8)vColor.x;
		uint8 nG = (uint8)vColor.y;
		uint8 nB = (uint8)vColor.z;

		m_nDefaultTitleColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info title string
		m_DefaultLevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");
		m_nDefaultLevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");
		m_nDefaultLevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultLevelColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info mission briefing string
		LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
		m_DefaultBriefingPos = LTIntPt(rect.left,rect.top);
		m_nDefaultBriefingWidth = (rect.right - rect.left);

		m_nDefaultBriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");
		m_nDefaultBriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultBriefingColor = SET_ARGB(0xFF,nR,nG,nB);

		//default layout info mission help string
		rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
		m_DefaultHelpPos = LTIntPt(rect.left,rect.top);
		m_nDefaultHelpWidth = (rect.right - rect.left);

		m_nDefaultHelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");
		m_nDefaultHelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

		vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
		nR = (uint8)vColor.x;
		nG = (uint8)vColor.y;
		nB = (uint8)vColor.z;

		m_nDefaultHelpColor = SET_ARGB(0xFF,nR,nG,nB);

		m_DefaultPhotoRect = g_pLayoutMgr->GetRect(szTagName,"PhotoRect");

	}

	//Setup title string
	LTIntPt TitlePos			= m_DefaultTitlePos;
	uint8	TitleFont			= m_nDefaultTitleFont;
	uint8	TitleFontSize		= m_nDefaultTitleFontSize;
	uint32	TitleColor			= m_nDefaultTitleColor;
	LTIntPt LevelPos			= m_DefaultLevelPos;
	uint8	LevelFont			= m_nDefaultLevelFont;
	uint8	LevelFontSize		= m_nDefaultLevelFontSize;
	uint32	LevelColor			= m_nDefaultLevelColor;
	LTIntPt BriefingPos			= m_DefaultBriefingPos;
	uint16	BriefingWidth		= m_nDefaultBriefingWidth;
	uint8	BriefingFont		= m_nDefaultBriefingFont;
	uint8	BriefingFontSize	= m_nDefaultBriefingFontSize;
	uint32	BriefingColor		= m_nDefaultBriefingColor;
	LTIntPt HelpPos				= m_DefaultHelpPos;
	uint16	HelpWidth			= m_nDefaultHelpWidth;
	uint8	HelpFont			= m_nDefaultHelpFont;
	uint8	HelpFontSize		= m_nDefaultHelpFontSize;
	uint32	HelpColor			= m_nDefaultHelpColor;

	//*******************************************************************************
	// Build Mission Name String

	// look for override values
	SAFE_STRCPY(szTagName,m_layout.c_str());
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//override layout info title string
		if (g_pLayoutMgr->HasValue(szTagName,"TitlePos"))
			TitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleFont"))
			TitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleSize"))
			TitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

		if (g_pLayoutMgr->HasValue(szTagName,"TitleColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			TitleColor = SET_ARGB(0xFF,nR,nG,nB);
		}

		//override layout info Level string
		if (g_pLayoutMgr->HasValue(szTagName,"LevelPos"))
			LevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelFont"))
			LevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelSize"))
			LevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

		if (g_pLayoutMgr->HasValue(szTagName,"LevelColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			LevelColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	uint8 nFontSize = (uint8)((float)TitleFontSize * g_pInterfaceResMgr->GetXRatio());
	CUIFont *pFont = g_pInterfaceResMgr->GetFont(TitleFont);

	if (!m_pMissionNameStr)
	{
		m_pMissionNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}
	m_pMissionNameStr->SetColor(TitleColor);
	m_pMissionNameStr->SetText(m_missionname.c_str());
	m_pMissionNameStr->SetCharScreenHeight(nFontSize);
	float x = (float)TitlePos.x * g_pInterfaceResMgr->GetXRatio();
	float y = (float)TitlePos.y * g_pInterfaceResMgr->GetYRatio();
	m_pMissionNameStr->SetPosition(x,y);

	nFontSize = (uint8)((float)LevelFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(LevelFont);

	if (!m_pLevelNameStr)
	{
		m_pLevelNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}
	m_pLevelNameStr->SetColor(LevelColor);
	m_pLevelNameStr->SetText(m_levelname.c_str());
	m_pLevelNameStr->SetCharScreenHeight(nFontSize);
	x = (float)LevelPos.x * g_pInterfaceResMgr->GetXRatio();
	y = (float)LevelPos.y * g_pInterfaceResMgr->GetYRatio();
	m_pLevelNameStr->SetPosition(x,y);


	//*******************************************************************************
	// Build Mission Briefing String

	//look for override values
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//default layout info mission briefing string
		if (g_pLayoutMgr->HasValue(szTagName,"BriefingRect"))
		{
			LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
			BriefingPos = LTIntPt(rect.left,rect.top);
			BriefingWidth = (rect.right - rect.left);
		}

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingFont"))
			BriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingSize"))
			BriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

		if (g_pLayoutMgr->HasValue(szTagName,"BriefingColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			BriefingColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	nFontSize = (uint8)((float)BriefingFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(BriefingFont);
	
	if (!m_pBriefingStr)
	{
		m_pBriefingStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}

	
	if (g_pGameClientShell->IsRunningPerformanceTest())
	{
		m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF ));
	}
	else
	{
		m_pBriefingStr->SetText(m_briefing.c_str());
	}
	m_pBriefingStr->SetColor(BriefingColor);
	m_pBriefingStr->SetCharScreenHeight(nFontSize);
	x = (float)BriefingPos.x * g_pInterfaceResMgr->GetXRatio();
	y = (float)BriefingPos.y * g_pInterfaceResMgr->GetYRatio();
	m_pBriefingStr->SetPosition(x,y);
	m_pBriefingStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)BriefingWidth));

	//*******************************************************************************
	// Build Mission Help String

	//look for override values
	if (g_pLayoutMgr->Exist(szTagName))
	{
		//default layout info mission briefing string
		if (g_pLayoutMgr->HasValue(szTagName,"HelpRect"))
		{
			LTRect rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
			HelpPos = LTIntPt(rect.left,rect.top);
			HelpWidth = (rect.right - rect.left);
		}

		if (g_pLayoutMgr->HasValue(szTagName,"HelpFont"))
			HelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");

		if (g_pLayoutMgr->HasValue(szTagName,"HelpSize"))
			HelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

		if (g_pLayoutMgr->HasValue(szTagName,"HelpColor"))
		{
			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			HelpColor = SET_ARGB(0xFF,nR,nG,nB);
		}

	}

	nFontSize = (uint8)((float)HelpFontSize * g_pInterfaceResMgr->GetXRatio());
	pFont = g_pInterfaceResMgr->GetFont(HelpFont);
	
	if (!m_pHelpStr)
	{
		m_pHelpStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
	}

	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	if (pProfile->m_bLoadScreenTips)
	{
		m_pHelpStr->SetText(m_help.c_str());
		m_pHelpStr->SetColor(HelpColor);
		m_pHelpStr->SetCharScreenHeight(nFontSize);
		x = (float)HelpPos.x * g_pInterfaceResMgr->GetXRatio();
		y = (float)HelpPos.y * g_pInterfaceResMgr->GetYRatio();
		m_pHelpStr->SetPosition(x,y);
		m_pHelpStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)HelpWidth));
	}
	else
	{
		m_pHelpStr->SetText("");
	}


	if( !IsCoopMultiplayerGameType() && !m_photo.empty() )
	{
		m_hFrame = g_pInterfaceResMgr->GetTexture(m_photo.c_str());
		if (m_hFrame)
		{
			SetupQuadUVs(m_photoPoly, m_hFrame, 0.0f, 0.0f, 1.0f, 0.75f);
			g_pDrawPrim->SetRGBA(&m_photoPoly,argbWhite);

			float fScale = g_pInterfaceResMgr->GetXRatio();
			float fx = (float)m_DefaultPhotoRect.left * fScale;
			float fy = (float)m_DefaultPhotoRect.top * fScale;

			float fw = (float)(m_DefaultPhotoRect.right - m_DefaultPhotoRect.left) * fScale;
			float fh = (float)(m_DefaultPhotoRect.bottom - m_DefaultPhotoRect.top) * fScale;

			g_pDrawPrim->SetXYWH(&m_photoPoly,fx,fy,fw,fh);

		}
	}
	else
	{
		m_hFrame = LTNULL;
	}


	
	CreateInterfaceSFX();

	// Reset the frame counter
	m_nFrameCounter = 0;
	m_fLastFrameTime = CWinUtil::GetTime();
	m_fCurFrameDelta = 0.0f;
	
	m_eCurState = STATE_INIT;

	return LTTRUE;
}
// Build the folder
LTBOOL CFolderHostLevels::Build()
{
	if (!g_vtNetGameType.IsInitted())
	{
        g_vtNetGameType.Init(g_pLTClient,"NetGameType",LTNULL,(float)m_nGameType);
	}

	rcAvailRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"AvailLevelsRect");
	rcSelRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"SelLevelsRect");
	rcCommandRect = g_pLayoutMgr->GetFolderCustomRect((eFolderID)m_nFolderID,"CommandRect");
	nIndent = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"TextIndent");
	nArrowWidth = g_pLayoutMgr->GetFolderCustomInt((eFolderID)m_nFolderID,"ArrowWidth");

	CreateTitle(IDS_TITLE_HOST_LEVELS);

	//Add Avail Levels List
    LTIntPt pos(rcAvailRect.left + nIndent,rcAvailRect.top);
	CLTGUIFont *pFont = GetLargeFont();
	nBarHeight = pFont->GetHeight();

    CStaticTextCtrl *pCtrl = CreateStaticTextItem(IDS_HOST_AVAIL_LEVELS, LTNULL, LTNULL,0,0, LTTRUE, pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
    pCtrl->Enable(LTFALSE);

	pFont = GetSmallFont();
	pos.x = rcAvailRect.left + nIndent;
	pos.y = rcAvailRect.top + nBarHeight;
	int nListHeight = (rcAvailRect.bottom - rcAvailRect.top) - nBarHeight;
	int nListWidth = (rcAvailRect.right - rcAvailRect.left) - nArrowWidth;

	m_pAvailLevels = debug_new(CListCtrl);
    m_pAvailLevels->Create(nListHeight, LTTRUE, nListWidth);
	m_pAvailLevels->SetParam1(nListWidth);
	m_pAvailLevels->SetItemSpacing(0);
    m_pAvailLevels->EnableMouseMoveSelect(LTTRUE);
	m_pAvailLevels->SetHelpID(IDS_HELP_AVAIL_LEVELS);
    AddFixedControl(m_pAvailLevels,pos,LTTRUE);

	//Add Selected Levels List
    pos = LTIntPt(rcSelRect.left + nIndent,rcSelRect.top);
	pFont = GetLargeFont();

    pCtrl = CreateStaticTextItem(IDS_HOST_SELECTED_LEVELS, LTNULL, LTNULL,0,0,LTTRUE, pFont);
    AddFixedControl(pCtrl,pos,LTFALSE);
    pCtrl->Enable(LTFALSE);

	pFont = GetSmallFont();
	pos.x = rcSelRect.left + nIndent;
	pos.y = rcSelRect.top + nBarHeight;
	nListHeight = (rcSelRect.bottom - rcSelRect.top) - nBarHeight;
	nListWidth = (rcSelRect.right - rcSelRect.left) - nArrowWidth;

	m_pSelLevels = debug_new(CListCtrl);
    m_pSelLevels->Create(nListHeight, LTTRUE, nListWidth);
	m_pSelLevels->SetParam1(nListWidth);
	m_pSelLevels->SetItemSpacing(0);
    m_pSelLevels->EnableMouseMoveSelect(LTTRUE);
	m_pSelLevels->SetHelpID(IDS_HELP_SEL_LEVELS);
    AddFixedControl(m_pSelLevels,pos,LTTRUE);

	//Add Commands
    pos = LTIntPt(rcCommandRect.left + nIndent,rcCommandRect.top);
	nListWidth = rcCommandRect.right - rcCommandRect.left;
	pFont = GetLargeFont();


	m_pAddAll = CreateStaticTextItem(IDS_HOST_ADD_ALL, CMD_ADD_ALL, IDS_HELP_ADD_ALL, nListWidth);
    AddFixedControl(m_pAddAll,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pAddLevel = CreateStaticTextItem(IDS_HOST_ADD_LEVEL, CMD_ADD_LEVEL, IDS_HELP_ADD_LEVEL, nListWidth);
    AddFixedControl(m_pAddLevel,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pRemoveLevel = CreateStaticTextItem(IDS_HOST_REMOVE_LEVEL, CMD_REMOVE_LEVEL, IDS_HELP_REM_LEVEL, nListWidth);
    AddFixedControl(m_pRemoveLevel,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());

	m_pRemoveAll = CreateStaticTextItem(IDS_HOST_REMOVE_ALL, CMD_REMOVE_ALL, IDS_HELP_REM_ALL, nListWidth);
    AddFixedControl(m_pRemoveAll,pos,LTTRUE);
	pos.y += (m_nItemSpacing + pFont->GetHeight());



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

	UseBack(LTTRUE,LTTRUE);

	return LTTRUE;

}
示例#6
0
void CInterfaceTimer::Draw()
{

	// If we're not paused, recalculate the time left.
	if( !m_bPause )
		m_fTimeLeft = m_fTime - g_pLTClient->GetGameTime( );

	// Update/Draw the timer if there is anytime left...
	if( m_fTimeLeft <= 0.0f )
		return;

	// Draw the string to the surface...

	int nMinutes = int(m_fTimeLeft) / 60;
	int nSeconds = m_fTimeLeft > 60.0 ? int(m_fTimeLeft) % 60 : int(m_fTimeLeft);

	char aBuffer[8];
	char aMinutes[8];
	char aSeconds[8];
	BuildTimeString(aMinutes, nMinutes);
	BuildTimeString(aSeconds, nSeconds);
	uint8 nFont = 0;
	LTVector vColor;

	sprintf(aBuffer, "%s:%s", aMinutes, aSeconds);
	
 	if (!m_pTimeStr)
 	{
		switch( m_nTeamId )
		{
			// Team1.
			case 0:
				nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team1TimerFont");
				m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team1TimerSize");
				m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","Team1TimerPos");
				vColor = g_pLayoutMgr->GetVector("Miscellaneous","Team1TimerColor");
				break;
			// Team2.
			case 1:
				nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team2TimerFont");
				m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","Team2TimerSize");
				m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","Team2TimerPos");
				vColor = g_pLayoutMgr->GetVector("Miscellaneous","Team2TimerColor");
				break;
			// Unspecified.
			default:
				nFont = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","TimerFont");
				m_nBaseSize = (uint8)g_pLayoutMgr->GetInt("Miscellaneous","TimerSize");
				m_BasePos = g_pLayoutMgr->GetPoint("Miscellaneous","TimerPos");
				vColor = g_pLayoutMgr->GetVector("Miscellaneous","TimerColor");
				break;
		}

		if (m_nBaseSize == 0) 
			m_nBaseSize = 24;

		if (m_BasePos.x == 0)
			m_BasePos = LTIntPt(320,40);

		CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);
		m_pTimeStr = g_pFontManager->CreateFormattedPolyString(pFont, aBuffer);
		m_pTimeStr->SetAlignmentH(CUI_HALIGN_CENTER);

		m_nColor = SET_ARGB( 0xFF, ( uint8 )vColor.x, ( uint8 )vColor.y, ( uint8 )vColor.z );
 	}
 	else
 	{
		m_pTimeStr->SetText(aBuffer);
 	}

	uint8 nSize = (uint8)((LTFLOAT)m_nBaseSize * g_pInterfaceResMgr->GetXRatio());
	m_pTimeStr->SetCharScreenHeight(nSize);

	// Position the text
	float x = (float)m_BasePos.x * g_pInterfaceResMgr->GetXRatio();
	float y = (float)m_BasePos.y * g_pInterfaceResMgr->GetYRatio();

	m_pTimeStr->SetPosition( x+2.0f, y+2.0f);
	m_pTimeStr->SetColor(argbBlack);
	m_pTimeStr->Render();
	
	m_pTimeStr->SetPosition( x, y );
	m_pTimeStr->SetColor(m_nColor);
	m_pTimeStr->Render();
}
示例#7
0
// Build the screen
LTBOOL CScreenProfile::Build()
{
	// Set the title's text
	CreateTitle(IDS_TITLE_PROFILE);

	// Get edit controls position and create it.
	LTIntPt pos = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"ProfileNamePos");
	m_pCurrent = AddTextItem(" ", LTNULL, LTNULL, pos, LTTRUE);

	AddTextItem(IDS_CREATE, CMD_CREATE, IDS_HELP_PROFILE_CREATE);

	AddTextItem(IDS_LOAD, CMD_LOAD, IDS_HELP_PROFILE_LOAD);

//jrg - 8/18/02 removed as a quick and dirty to multiple issues caused by renaming profiles.
//	m_pRename = AddTextItem(IDS_RENAME, CMD_RENAME, IDS_HELP_PROFILE_RENAME);

	m_pDelete = AddTextItem(IDS_DELETE, CMD_DELETE, IDS_HELP_PROFILE_DELETE);


	LTIntPt dlgPos = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"DialogPos");
	LTIntPt dlgSz = g_pLayoutMgr->GetScreenCustomPoint((eScreenID)m_nScreenID,"DialogSize");
	kDlgHt = dlgSz.y;
	kDlgWd = dlgSz.x;
	uint8 nDlgFont = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"DialogFontFace");
	uint8 nDlgFontSz = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"DialogFontSize");

	nListFont = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontFace");
	nListFontSz = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontSize");

	char szBack[128] = "";
	g_pLayoutMgr->GetScreenCustomString((eScreenID)m_nScreenID,"DialogFrame",szBack,sizeof(szBack));

	m_pDlg = debug_new(CLTGUIWindow);
	m_pDlg->Create(g_pInterfaceResMgr->GetTexture(szBack),kDlgHt,kDlgWd);

	LTIntPt tmp(8,8);
	CUIFont *pFont = g_pInterfaceResMgr->GetFont(nDlgFont);

	CLTGUITextCtrl *pCtrl = CreateTextItem(IDS_PROFILE_LIST, LTNULL, LTNULL, kDefaultPos, LTTRUE);
	pCtrl->SetFont(pFont,nDlgFontSz);
	m_pDlg->AddControl(pCtrl, tmp);

	tmp.y += 24;

	
	// Make a list controller
	m_pListCtrl = debug_new(CLTGUIListCtrl);
    if (m_pListCtrl->Create(kDlgHt-64))
	{
		HTEXTURE hUp = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowup.dtx");
		HTEXTURE hUpH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowup_h.dtx");
		HTEXTURE hDown = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowdn.dtx");
		HTEXTURE hDownH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowdn_h.dtx");
		m_pListCtrl->UseArrows(kDlgWd-48,1.0f,hUp,hUpH,hDown,hDownH);
		m_pListCtrl->SetIndent(LTIntPt(4,4));
		m_pListCtrl->SetFrameWidth(2);
		m_pListCtrl->SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);

		m_pDlg->AddControl(m_pListCtrl, tmp);

	}

	pCtrl = CreateTextItem(IDS_CANCEL, CMD_CANCEL, LTNULL);
	pCtrl->SetFont(pFont,nDlgFontSz);
	tmp.x = (kDlgWd - pCtrl->GetBaseWidth()) / 2;
	tmp.y = (kDlgHt - pCtrl->GetBaseHeight()) - 8;
	m_pDlg->AddControl(pCtrl, tmp);

	AddControl(m_pDlg);

	m_pDlg->SetBasePos(dlgPos);
	m_pDlg->SetScale(g_pInterfaceResMgr->GetXRatio());
	m_pDlg->Show(LTFALSE);

	m_pDlg->SetSelection(1);

	UseBack(LTTRUE);


	// Make sure to call the base class
	return CBaseScreen::Build();
}
示例#8
0
void CScreenPostload::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		// [KLS 6/23/02] - Turn the cursor off until everything is loaded...
		g_pInterfaceMgr->UseCursor(LTFALSE, LTFALSE);

		// Assume we won't be showing the press any key text.
		m_bPressAnyKey = false;

		// Check if we have a mission entry.
		bool bGotMission = false;
		if( !g_pMissionMgr->IsCustomLevel( ))
		{
			int nCurMission = g_pMissionMgr->GetCurrentMission( );
			MISSION* pMission = g_pMissionButeMgr->GetMission( nCurMission );

			if( pMission )
			{
				m_missionname = LoadTempString(pMission->nNameId);
				int nCurLevel = g_pMissionMgr->GetCurrentLevel( );
				m_levelname = LoadTempString( pMission->aLevels[nCurLevel].nNameId );
				m_layout = pMission->szLayout;
				
				// Show a briefing for this level if it exists.  Also, only
				// show the briefing if we haven't been to this level before.
				int nBriefingId = pMission->aLevels[nCurLevel].nBriefingId;
				if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( ))
				{
					m_briefing = LoadTempString( nBriefingId );
					m_layout = pMission->szBriefLayout;
				}
				else
					m_briefing = "";

				// Show help text for this level if it exists.
				int nHelpId = pMission->aLevels[nCurLevel].nHelpId;
				if( nHelpId >= 0)
					m_help = LoadTempString( nHelpId );
				else
					m_help = "";
				bGotMission = true;
			}
		}


		// If we were unsuccessful in getting info from the mission, then just
		// use defaults.
		if( !bGotMission )
		{
			// If connecting to a remote server, set our mission descriptor to 
			// the ip we're connecting to.
			if( g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ))
			{
				// Make a loading string using the IP to be joined.
				char szLoadingString[256];
				if (strlen(g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName))
				{
					sprintf( szLoadingString, "%s:  %s", LoadTempString(IDS_CONNECTING_TO_SERVER), 
						g_pClientMultiplayerMgr->GetStartGameRequest( ).m_HostInfo.m_sName );
				}
				else
				{
					sprintf( szLoadingString, "%s", LoadTempString(IDS_CONNECTING_TO_SERVER));
				}
				m_missionname = szLoadingString;

				sprintf( szLoadingString, "    (%s)", g_pClientMultiplayerMgr->GetStartGameRequest( ).m_TCPAddress );

				m_levelname = szLoadingString;
			}
			// Local game, set the mission descriptor to the level name.
			else
			{

				if (g_pGameClientShell->IsRunningPerformanceTest())
				{
					m_missionname = LoadTempString( IDS_TITLE_PERFORMANCE_TEST );
					m_levelname = "";
				}
				else
				{
					m_missionname = LoadTempString( IDS_CUSTOM_LEVEL );
					// Split the worldname up into parts so we can get the load string.
					char const* pszWorldName = g_pMissionMgr->GetCurrentWorldName( );
					char szWorldTitle[MAX_PATH] = "";
					_splitpath( pszWorldName, NULL, NULL, szWorldTitle, NULL );
					m_levelname = szWorldTitle;

				}

			}

			m_layout = "LoadScreenDefault";
			m_briefing = "";
		}

		char szTagName[30];
		if (!m_bReadLayout)
		{
			m_bReadLayout = true;

			SAFE_STRCPY(szTagName,"LoadScreenDefault");

			//default layout info title string
			m_DefaultTitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");
			m_nDefaultTitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");
			m_nDefaultTitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

			LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
			uint8 nR = (uint8)vColor.x;
			uint8 nG = (uint8)vColor.y;
			uint8 nB = (uint8)vColor.z;

			m_nDefaultTitleColor = SET_ARGB(0xFF,nR,nG,nB);

			//default layout info level string
			m_DefaultLevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");
			m_nDefaultLevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");
			m_nDefaultLevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

			vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
			nR = (uint8)vColor.x;
			nG = (uint8)vColor.y;
			nB = (uint8)vColor.z;

			m_nDefaultLevelColor = SET_ARGB(0xFF,nR,nG,nB);

			//default layout info mission briefing string
			LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
			m_DefaultBriefingPos = LTIntPt(rect.left,rect.top);
			m_nDefaultBriefingWidth = (rect.right - rect.left);

			m_nDefaultBriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");
			m_nDefaultBriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

			vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
			nR = (uint8)vColor.x;
			nG = (uint8)vColor.y;
			nB = (uint8)vColor.z;

			m_nDefaultBriefingColor = SET_ARGB(0xFF,nR,nG,nB);

			//default layout info mission help string
			rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
			m_DefaultHelpPos = LTIntPt(rect.left,rect.top);
			m_nDefaultHelpWidth = (rect.right - rect.left);

			m_nDefaultHelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");
			m_nDefaultHelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

			vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
			nR = (uint8)vColor.x;
			nG = (uint8)vColor.y;
			nB = (uint8)vColor.z;

			m_nDefaultHelpColor = SET_ARGB(0xFF,nR,nG,nB);

			//default layout info Continue string
			m_DefaultContinuePos = g_pLayoutMgr->GetPoint(szTagName,"ContinuePos");
			m_nDefaultContinueFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueFont");
			m_nDefaultContinueFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueSize");

			vColor = g_pLayoutMgr->GetVector(szTagName, "ContinueColor");
			nR = (uint8)vColor.x;
			nG = (uint8)vColor.y;
			nB = (uint8)vColor.z;

			m_nDefaultContinueColor = SET_ARGB(0xFF,nR,nG,nB);

		}

		//Setup title string
		LTIntPt TitlePos			= m_DefaultTitlePos;
		uint8	TitleFont			= m_nDefaultTitleFont;
		uint8	TitleFontSize		= m_nDefaultTitleFontSize;
		uint32	TitleColor			= m_nDefaultTitleColor;
		LTIntPt LevelPos			= m_DefaultLevelPos;
		uint8	LevelFont			= m_nDefaultLevelFont;
		uint8	LevelFontSize		= m_nDefaultLevelFontSize;
		uint32	LevelColor			= m_nDefaultLevelColor;

		//look for override values
		SAFE_STRCPY(szTagName,m_layout.c_str());
		if (g_pLayoutMgr->Exist(szTagName))
		{
			//override layout info title string
			if (g_pLayoutMgr->HasValue(szTagName,"TitlePos"))
				TitlePos = g_pLayoutMgr->GetPoint(szTagName,"TitlePos");

			if (g_pLayoutMgr->HasValue(szTagName,"TitleFont"))
				TitleFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleFont");

			if (g_pLayoutMgr->HasValue(szTagName,"TitleSize"))
				TitleFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"TitleSize");

			if (g_pLayoutMgr->HasValue(szTagName,"TitleColor"))
			{
				LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "TitleColor");
				uint8 nR = (uint8)vColor.x;
				uint8 nG = (uint8)vColor.y;
				uint8 nB = (uint8)vColor.z;

				TitleColor = SET_ARGB(0xFF,nR,nG,nB);
			}

			//override layout info Level string
			if (g_pLayoutMgr->HasValue(szTagName,"LevelPos"))
				LevelPos = g_pLayoutMgr->GetPoint(szTagName,"LevelPos");

			if (g_pLayoutMgr->HasValue(szTagName,"LevelFont"))
				LevelFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelFont");

			if (g_pLayoutMgr->HasValue(szTagName,"LevelSize"))
				LevelFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"LevelSize");

			if (g_pLayoutMgr->HasValue(szTagName,"LevelColor"))
			{
				LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "LevelColor");
				uint8 nR = (uint8)vColor.x;
				uint8 nG = (uint8)vColor.y;
				uint8 nB = (uint8)vColor.z;

				LevelColor = SET_ARGB(0xFF,nR,nG,nB);
			}
		}

		uint8 nFontSize = (uint8)((float)TitleFontSize * g_pInterfaceResMgr->GetXRatio());
		CUIFont *pFont = g_pInterfaceResMgr->GetFont(TitleFont);

		if (!m_pMissionNameStr)
		{
			m_pMissionNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
		}
		m_pMissionNameStr->SetColor(TitleColor);
		m_pMissionNameStr->SetText(m_missionname.c_str());
		m_pMissionNameStr->SetCharScreenHeight(nFontSize);
		float x = (float)TitlePos.x * g_pInterfaceResMgr->GetXRatio();
		float y = (float)TitlePos.y * g_pInterfaceResMgr->GetYRatio();
		m_pMissionNameStr->SetPosition(x,y);

		nFontSize = (uint8)((float)LevelFontSize * g_pInterfaceResMgr->GetXRatio());
		pFont = g_pInterfaceResMgr->GetFont(LevelFont);

		if (!m_pLevelNameStr)
		{
			m_pLevelNameStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
		}
		m_pLevelNameStr->SetColor(LevelColor);
		m_pLevelNameStr->SetText(m_levelname.c_str());
		m_pLevelNameStr->SetCharScreenHeight(nFontSize);
		x = (float)LevelPos.x * g_pInterfaceResMgr->GetXRatio();
		y = (float)LevelPos.y * g_pInterfaceResMgr->GetYRatio();
		m_pLevelNameStr->SetPosition(x,y);

		//Setup briefing string
		LTIntPt BriefingPos			= m_DefaultBriefingPos;
		uint16	BriefingWidth		= m_nDefaultBriefingWidth;
		uint8	BriefingFont		= m_nDefaultBriefingFont;
		uint8	BriefingFontSize	= m_nDefaultBriefingFontSize;
		uint32	BriefingColor		= m_nDefaultBriefingColor;

		//look for override values
		if (g_pLayoutMgr->Exist(szTagName))
		{
			//default layout info mission briefing string
			if (g_pLayoutMgr->HasValue(szTagName,"BriefingRect"))
			{
				LTRect rect = g_pLayoutMgr->GetRect(szTagName,"BriefingRect");
				BriefingPos = LTIntPt(rect.left,rect.top);
				BriefingWidth = (rect.right - rect.left);
			}

			if (g_pLayoutMgr->HasValue(szTagName,"BriefingFont"))
				BriefingFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingFont");

			if (g_pLayoutMgr->HasValue(szTagName,"BriefingSize"))
				BriefingFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"BriefingSize");

			if (g_pLayoutMgr->HasValue(szTagName,"BriefingColor"))
			{
				LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "BriefingColor");
				uint8 nR = (uint8)vColor.x;
				uint8 nG = (uint8)vColor.y;
				uint8 nB = (uint8)vColor.z;

				BriefingColor = SET_ARGB(0xFF,nR,nG,nB);
			}

		}

		nFontSize = (uint8)((float)BriefingFontSize * g_pInterfaceResMgr->GetXRatio());
		pFont = g_pInterfaceResMgr->GetFont(BriefingFont);

		if (!m_pBriefingStr)
		{
			m_pBriefingStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
		}
		
		m_pBriefingStr->SetText(m_briefing.c_str());
		m_pBriefingStr->SetColor(BriefingColor);
		m_pBriefingStr->SetCharScreenHeight(nFontSize);
		x = (float)BriefingPos.x * g_pInterfaceResMgr->GetXRatio();
		y = (float)BriefingPos.y * g_pInterfaceResMgr->GetYRatio();
		m_pBriefingStr->SetPosition(x,y);
		m_pBriefingStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)BriefingWidth));


		//Setup briefing string
		LTIntPt HelpPos			= m_DefaultHelpPos;
		uint16	HelpWidth		= m_nDefaultHelpWidth;
		uint8	HelpFont		= m_nDefaultHelpFont;
		uint8	HelpFontSize	= m_nDefaultHelpFontSize;
		uint32	HelpColor		= m_nDefaultHelpColor;

		//look for override values
		if (g_pLayoutMgr->Exist(szTagName))
		{
			//default layout info mission briefing string
			if (g_pLayoutMgr->HasValue(szTagName,"HelpRect"))
			{
				LTRect rect = g_pLayoutMgr->GetRect(szTagName,"HelpRect");
				HelpPos = LTIntPt(rect.left,rect.top);
				HelpWidth = (rect.right - rect.left);
			}

			if (g_pLayoutMgr->HasValue(szTagName,"HelpFont"))
				HelpFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpFont");

			if (g_pLayoutMgr->HasValue(szTagName,"HelpSize"))
				HelpFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"HelpSize");

			if (g_pLayoutMgr->HasValue(szTagName,"HelpColor"))
			{
				LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "HelpColor");
				uint8 nR = (uint8)vColor.x;
				uint8 nG = (uint8)vColor.y;
				uint8 nB = (uint8)vColor.z;

				HelpColor = SET_ARGB(0xFF,nR,nG,nB);
			}

		}

		nFontSize = (uint8)((float)HelpFontSize * g_pInterfaceResMgr->GetXRatio());
		pFont = g_pInterfaceResMgr->GetFont(HelpFont);

		if (!m_pHelpStr)
		{
			m_pHelpStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
		}
	
		CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
		if (pProfile->m_bLoadScreenTips)
		{

			m_pHelpStr->SetText(m_help.c_str());
			m_pHelpStr->SetColor(HelpColor);
			m_pHelpStr->SetCharScreenHeight(nFontSize);
			x = (float)HelpPos.x * g_pInterfaceResMgr->GetXRatio();
			y = (float)HelpPos.y * g_pInterfaceResMgr->GetYRatio();
			m_pHelpStr->SetPosition(x,y);
			m_pHelpStr->SetWrapWidth((uint16)(g_pInterfaceResMgr->GetXRatio() * (float)HelpWidth));
		}
		else
		{
			m_pHelpStr->SetText("");
		}

		
		//Setup Continue string
		LTIntPt ContinuePos				= m_DefaultContinuePos;
		uint8	ContinueFont			= m_nDefaultContinueFont;
		uint8	ContinueFontSize		= m_nDefaultContinueFontSize;
		m_nContinueColor				= m_nDefaultContinueColor;

		//look for override values
		if (g_pLayoutMgr->Exist(szTagName))
		{
			//override layout info Continue string
			if (g_pLayoutMgr->HasValue(szTagName,"ContinuePos"))
				ContinuePos = g_pLayoutMgr->GetPoint(szTagName,"ContinuePos");

			if (g_pLayoutMgr->HasValue(szTagName,"ContinueFont"))
				ContinueFont = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueFont");

			if (g_pLayoutMgr->HasValue(szTagName,"ContinueSize"))
				ContinueFontSize = (uint8)g_pLayoutMgr->GetInt(szTagName,"ContinueSize");

			if (g_pLayoutMgr->HasValue(szTagName,"ContinueColor"))
			{
				LTVector vColor = g_pLayoutMgr->GetVector(szTagName, "ContinueColor");
				uint8 nR = (uint8)vColor.x;
				uint8 nG = (uint8)vColor.y;
				uint8 nB = (uint8)vColor.z;

				m_nContinueColor = SET_ARGB(0xFF,nR,nG,nB);
			}

		}

		// [KLS 6/21/02] - We restore music here to make sure everything is loaded
		// before the "press any key" text is shown...

		g_pGameClientShell->RestoreMusic();

		// [KLS 6/23/02] - Turn the cursor on once everything is loaded...
		g_pInterfaceMgr->UseCursor(LTTRUE);


		nFontSize = (uint8)((float)ContinueFontSize * g_pInterfaceResMgr->GetXRatio());
		pFont = g_pInterfaceResMgr->GetFont(ContinueFont);

		if (!m_pContinueStr)
		{
			m_pContinueStr = g_pFontManager->CreateFormattedPolyString(pFont,"");
		}

		// If we have a briefing, then post the press any key.
		if( m_briefing.length( ) > 0 )
		{
			m_bPressAnyKey = true;
			m_pContinueStr->SetText( LoadTempString( IDS_PRESS_ANY_KEY ));
		}
		// Otherwise show the "waiting for other players".
		else
		{
			m_bPressAnyKey = false;
			m_pContinueStr->SetText( LoadTempString( IDS_WAITINGFOROTHERPLAYERS ));

			g_pGameClientShell->SendClientLoadedMessage( );
		}

		m_pContinueStr->SetColor(m_nContinueColor);
		m_pContinueStr->SetCharScreenHeight(nFontSize);
		x = (float)ContinuePos.x * g_pInterfaceResMgr->GetXRatio();
		y = (float)ContinuePos.y * g_pInterfaceResMgr->GetYRatio();
		m_pContinueStr->SetPosition(x,y);

		s_bFlash = false;
		s_fFlashTime = g_pLTClient->GetTime() + 0.333f;

		s_nFlashColor = (m_nContinueColor ^ 0x00FFFFFF);

		g_pClientSoundMgr->PlayInterfaceSound("Interface\\Snd\\pressanykey.wav");
	}

	CBaseScreen::OnFocus(bFocus);
	m_bVisited = 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();
}
示例#10
0
LTBOOL CMenuPlayer::Init()
{
	m_MenuID = MENU_ID_PLAYER;
	s_pSklMenu = this;

	if (!CBaseMenu::Init()) return LTFALSE;

	int nNameWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"NameWidth");
	int nLevelWidth = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"LevelWidth");
	int nUpgradeWidth = s_Size.x - ( (m_Indent.x * 2) + nNameWidth + nLevelWidth);


	LTVector vColor = g_pLayoutMgr->GetMenuCustomVector(m_MenuID,"HighlightColor");
	uint8 nA = 255;
	uint8 nR = (uint8)vColor.x;
	uint8 nG = (uint8)vColor.y;
	uint8 nB = (uint8)vColor.z;

	skillHighlightColor= SET_ARGB(nA,nR,nG,nB);


	uint8 nSmallerFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"SmallerFontSize");

	SetTitle(IDS_TITLE_SUMMARY);

	LTIntPt	popupSize = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"PopupSize");
	m_Popup.Init(s_Frame,s_FrameTip,popupSize);
	m_Popup.m_bWaitForUpdate = LTFALSE;
	LTIntPt offset = m_Indent;
	offset.y = 8;

	CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_TitleFontFace);
	m_Name.Create("name",LTNULL,LTNULL,pFont,m_TitleFontSize,LTNULL);
	m_Name.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Name.Enable(LTFALSE);
	m_Popup.AddControl(&m_Name,offset);
	offset.y += (m_Name.GetHeight() + 4);


	pFont = g_pInterfaceResMgr->GetFont(m_FontFace);
	m_Level.Create("level",LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
	m_Level.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Level.Enable(LTFALSE);
	m_Popup.AddControl(&m_Level,offset);
	offset.y += (m_Level.GetHeight() + 12);

	m_Header.Create(LTNULL,LTNULL,pFont,m_FontSize, LTNULL);
	m_Header.AddColumn(" ",nNameWidth);
	m_Header.AddColumn(LoadTempString(IDS_CURRENT),60);
	m_Header.AddColumn(LoadTempString(IDS_UPGRADE),60);
	m_Header.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Header.Enable(LTFALSE);
	m_Popup.AddControl(&m_Header,offset);
	offset.y += (m_Header.GetHeight() + 2);


	for (uint8 m = 0; m < kMaxModifiers; ++m)
	{
		m_Mods[m].Create(LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
		m_Mods[m].AddColumn(" ",nNameWidth);
		m_Mods[m].AddColumn("100",60);
		m_Mods[m].AddColumn("100",60);
		m_Mods[m].SetColors(skillHighlightColor,m_NonSelectedColor,m_DisabledColor);
		m_Mods[m].Enable(LTTRUE);
		m_Popup.AddControl(&m_Mods[m],offset);
		offset.y += (m_Mods[m].GetHeight() + 2);

	}
	offset.y += 8;

	m_Upgrade.Create("Upgrade",MC_UPGRADE,IDS_HELP_UPGRADE,pFont,m_FontSize,this);
	m_Upgrade.SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
	m_Popup.AddControl(&m_Upgrade,offset);
	offset.y += (m_Upgrade.GetHeight() + 4);

	m_Points.Create("avail",LTNULL,LTNULL,pFont,m_FontSize,LTNULL);
	m_Points.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Points.SetFont(LTNULL,nSmallerFont);
	m_Points.Enable(LTFALSE);
	m_Popup.AddControl(&m_Points,offset);

	uint8 nHelpFont = (uint8)g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"HelpFontSize");
	offset = g_pLayoutMgr->GetMenuCustomPoint(m_MenuID,"HelpOffset");
	uint16 nWidth = 600 - 2* offset.x;
	if (!nHelpFont)
		nHelpFont = m_FontSize;
	m_ModDesc.Create("description",LTNULL,LTNULL,pFont,nHelpFont,LTNULL);
	m_ModDesc.SetColors(m_SelectedColor,m_SelectedColor,m_SelectedColor);
	m_ModDesc.SetFixedWidth(nWidth);
	m_ModDesc.Enable(LTFALSE);
	m_Popup.AddControl(&m_ModDesc,offset);



	int nPopupPos = g_pLayoutMgr->GetMenuCustomInt(m_MenuID,"PopupPos");
	m_Popup.SetBasePos(LTIntPt(0,nPopupPos));

	g_pInterfaceMgr->GetMenuMgr()->RegisterCommand(COMMAND_ID_STATUS,MENU_ID_PLAYER);

	//Rank control
	m_pRank = AddColumnCtrl();
	m_pRank->AddColumn(LoadTempString(IDS_RANK),nNameWidth);
	m_pRank->AddColumn("Novice",nNameWidth);

	//Total points control
	m_pTotal = AddColumnCtrl();
	m_pTotal->AddColumn(LoadTempString(IDS_SCORE),nNameWidth);
	m_pTotal->AddColumn("0",nNameWidth);

	//Avail points control
	m_pAvail = AddColumnCtrl();
	m_pAvail->AddColumn(LoadTempString(IDS_SKILL_PTS),nNameWidth);
	m_pAvail->AddColumn("0",nNameWidth);

	AddControl(" ",0,LTTRUE);


//	CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_FontFace);
	for (uint8 i = 0; i < kNumSkills; i++)
	{
		eSkill skl = (eSkill)i;
		if (g_pSkillsButeMgr->IsAvailable(skl) )
		{
			m_pSkills[i] = debug_new(CSkillCtrl);
			m_pSkills[i]->Create(skl,(MC_CUSTOM+i),pFont,m_FontSize,this,nNameWidth);
			m_List.AddControl(m_pSkills[i]);
		}

	}
	

	return LTTRUE;
}
示例#11
0
// Build the screen
LTBOOL CScreenMulti::Build()
{

	CreateTitle(IDS_TITLE_MULTI);

	//basic controls
	AddTextItem(IDS_PLAYER_SETUP, CMD_PLAYER, IDS_HELP_PLAYER);

	m_pCDKeyCtrl = AddColumnCtrl(CMD_EDIT_CDKEY, IDS_HELP_CDKEY);
	m_pCDKeyCtrl->AddColumn(LoadTempString(IDS_CDKEY), 200);
	m_pCDKeyCtrl->AddColumn("  ", 320, LTTRUE);
	
	m_pJoin = AddTextItem(IDS_JOIN, CMD_JOIN, IDS_HELP_JOIN);
	m_pHost = AddTextItem(IDS_HOST, CMD_HOST, IDS_HELP_HOST);


	m_pUpdate = AddTextItem(IDS_LAUNCH_UPDATE, CMD_UPDATE, IDS_HELP_LAUNCH_UPDATE);


	HTEXTURE hUp = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowup.dtx");
	HTEXTURE hUpH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowup_h.dtx");
	HTEXTURE hDown = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowdn.dtx");
	HTEXTURE hDownH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowdn_h.dtx");

	char szFrame[128];
	g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_MULTI,"FrameTexture",szFrame,sizeof(szFrame));
	HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame);

	LTRect rect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_MULTI,"SystemMOTDRect");
	LTIntPt pos(rect.left,rect.top);
	LTIntPt size( (rect.right - rect.left),(rect.bottom - rect.top));
	uint8 nMOTDSize = (uint8)g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_MULTI,"MessageFontSize");
	uint8 nFont = g_pLayoutMgr->GetScreenFontFace((eScreenID)m_nScreenID);
	CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);

	m_pSysFrame = debug_new(CLTGUIFrame);
	m_pSysFrame->Create(hFrame,size.x+16,size.y,LTTRUE);
	m_pSysFrame->SetBasePos(pos);
	AddControl(m_pSysFrame);

	m_pSysMOTD = debug_new(CLTGUILargeText);
	m_pSysMOTD->Create("",pFont,nMOTDSize,size);
	m_pSysMOTD->SetBasePos(pos);
	m_pSysMOTD->SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
	m_pSysMOTD->Enable(LTTRUE);
	m_pSysMOTD->SetFrameWidth(1);
	m_pSysMOTD->SetIndent(2);
	m_pSysMOTD->UseArrows(1.0f,hUp,hUpH,hDown,hDownH);
	AddControl(m_pSysMOTD);



	rect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_MULTI,"GameMOTDRect");
	pos.x = rect.left;
	pos.y = rect.top;
	size.x = (rect.right - rect.left);
	size.y = (rect.bottom - rect.top);

	m_pGameFrame = debug_new(CLTGUIFrame);
	m_pGameFrame->Create(hFrame,size.x+16,size.y,LTTRUE);
	m_pGameFrame->SetBasePos(pos);
	AddControl(m_pGameFrame);

	
	m_pGameMOTD = debug_new(CLTGUILargeText);
	m_pGameMOTD->Create("",pFont,nMOTDSize,size);
	m_pGameMOTD->SetBasePos(pos);
	m_pGameMOTD->SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
	m_pGameMOTD->Enable(LTTRUE);
	m_pGameMOTD->SetFrameWidth(1);
	m_pGameMOTD->SetIndent(2);
	m_pGameMOTD->UseArrows(1.0f,hUp,hUpH,hDown,hDownH);
	AddControl(m_pGameMOTD);




	nFont = g_pLayoutMgr->GetDialogFontFace();
	pFont = g_pInterfaceResMgr->GetFont(nFont);
	uint8 nFontSize = g_pLayoutMgr->GetDialogFontSize();

	m_pWaitText = debug_new(CLTGUITextCtrl);
    if (!m_pWaitText->Create(LoadTempString(IDS_INTERNET), NULL, LTNULL, pFont, nFontSize, this))
	{
		debug_delete(m_pWaitText);
        return LTFALSE;
	}
	m_pWaitText->SetColors(argbBlack, argbBlack, argbBlack);
	m_pWaitText->Enable(LTFALSE);

	uint16 w = 16+m_pWaitText->GetBaseWidth();
	uint16 h = 16+m_pWaitText->GetBaseHeight();


	m_pWait = debug_new(CLTGUIWindow);

	char szBack[128] = "";
	g_pLayoutMgr->GetDialogFrame(szBack,sizeof(szBack));

	m_pWait->Create(g_pInterfaceResMgr->GetTexture(szBack),w,h);

	uint16 x = (640-w)/2;
	uint16 y = (480-h)/2;
	m_pWait->SetBasePos(LTIntPt(x,y));
	AddControl(m_pWait);

	
	m_pWait->AddControl(m_pWaitText,LTIntPt(8,8));


	// status text -----------------------------------------------
	pos = g_pLayoutMgr->GetScreenCustomPoint(SCREEN_ID_MULTI,"StatusPos");
	char szTmp[256] = "";
	LoadString(IDS_WAITING,szTmp,sizeof(szTmp));
	m_pStatusCtrl = AddTextItem(FormatTempString(IDS_STATUS_STRING,szTmp), 0, 0, pos, LTTRUE);
	m_pStatusCtrl->SetFont(NULL, nMOTDSize);

	CreateDMMissionFile();
//	CreateTDMMissionFile();
	CreateDDMissionFile();


 	// Make sure to call the base class
	return CBaseScreen::Build();
}
示例#12
0
LTBOOL CHUDCrosshair::Init()
{

    m_fCrosshairGapMin = g_pLayoutMgr->GetCrosshairGapMin();
	if (m_fCrosshairGapMin <= 0.0f)
		m_fCrosshairGapMin = 5.0f;
    float fGapMax = g_pLayoutMgr->GetCrosshairGapMax();
	if (fGapMax <= 0.0f)
		fGapMax = 8.0f;
	m_fCrosshairGapRange = fGapMax - m_fCrosshairGapMin;

    m_fCrosshairBarMin = g_pLayoutMgr->GetCrosshairBarMin();
	if (m_fCrosshairBarMin <= 0.0f)
		m_fCrosshairBarMin = 5.0f;
	float fBarMax = g_pLayoutMgr->GetCrosshairBarMax();
	if (fBarMax <= 0.0f)
		fBarMax = 8.0f;
	m_fCrosshairBarRange = fBarMax - m_fCrosshairBarMin;

	g_pDrawPrim->SetUVWH(&m_Poly,0.0f,0.0f,1.0f,1.0f);
	g_pDrawPrim->SetRGBA(&m_Poly,argbWhite);


    g_vtScopeLRGap.Init(g_pLTClient, "ScopeLRGap", NULL, 32.0f);
    g_vtScopeUDGap.Init(g_pLTClient, "ScopeUPGap", NULL, 32.0f);
    g_vtScopeLRRadius.Init(g_pLTClient, "ScopeLRRadius", NULL, 0.377f);
    g_vtScopeUDRadius.Init(g_pLTClient, "ScopeUDRadius", NULL, 0.34f);

	// ABM TRON reticles
	for (int i = 0; i < NUM_RETICLES; i++)
	{
		m_hReticleTex[i] = g_pInterfaceResMgr->GetTexture(szReticleTex[i]);
	}
	g_pDrawPrim->SetRGBA(&m_ReticlePrim, argbWhite);
	g_pDrawPrim->SetUVWH(&m_ReticlePrim, 0.0f, 0.0f, 1.0f, 1.0f);

	uint8 nFont = g_pLayoutMgr->GetHUDFont();
	CUIFont* pFont = g_pInterfaceResMgr->GetFont(nFont);

	m_StrPos = LTIntPt(320,220);
	m_nStrSz = 16;
	m_nStrJust = 1;
	m_StrColor = argbWhite;
	m_StrDisColor = 0x80808080;

	m_pStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pStr->SetColor(m_StrColor);

	m_DbgPos = LTIntPt(360,200);
	m_nDbgSz = 12;
	m_nDbgWidth = 220;
	m_nDbgJust = 0;
	m_DbgColor = argbWhite;

	m_pDbgStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pDbgStr->SetColor(m_DbgColor);
	m_pDbgStr->SetWrapWidth(m_nDbgWidth);

	m_InfoPos = LTIntPt(320, 260);
	m_nInfoSz = 12;
	m_nInfoWidth = 200;
	m_nInfoJust = 1;
	m_InfoColor = 0x8000FF00;
	m_InfoBadColor = 0x80FF0000;

	m_pInfoStr = g_pFontManager->CreateFormattedPolyString(pFont,"",0.0f,0.0f);
	m_pInfoStr->SetColor(m_InfoColor);
	m_pInfoStr->SetWrapWidth(m_nInfoWidth);

	UpdateLayout();	


	return LTTRUE;
}
示例#13
0
// Build the screen
LTBOOL CScreenConfigure::Build()
{

	CreateTitle(IDS_TITLE_CONFIGURE);

	m_nActionWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"ActionWidth");
	m_nEqualsWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"EqualsWidth");
	m_nCommandWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"CommandWidth");
	m_ListRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_CONFIGURE,"ListRect");
	m_nListFontSize = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"ListFontSize");


	int nWidth = GetPageRight() - GetPageLeft();
	LTIntPt topPos = g_pLayoutMgr->GetScreenCustomPoint(SCREEN_ID_CONFIGURE,"MoveControlPos");

	CLTGUITextCtrl *pCtrl = AddTextItem(IDS_MOVE_CONTROLS,CMD_MOVE_COM,LTNULL,topPos);
	pCtrl->SetFixedWidth(nWidth);

	pCtrl = AddTextItem(IDS_INV_CONTROLS,CMD_INV_COM,LTNULL);
	pCtrl->SetFixedWidth(nWidth);

	pCtrl = AddTextItem(IDS_VIEW_CONTROLS,CMD_VIEW_COM,LTNULL);
	pCtrl->SetFixedWidth(nWidth);

	pCtrl = AddTextItem(IDS_MISC_CONTROLS,CMD_MISC_COM,LTNULL);
	pCtrl->SetFixedWidth(nWidth);

	
	LTIntPt pos(m_ListRect.left,m_ListRect.top);
	int nHt = m_ListRect.bottom - m_ListRect.top;
	int nWd = m_nActionWidth + m_nEqualsWidth + m_nCommandWidth;

	char szFrame[128];
	g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_CONFIGURE,"FrameTexture",szFrame,sizeof(szFrame));
	HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame);
	m_pFrame = debug_new(CLTGUIFrame);
	m_pFrame->Create(hFrame,nWd,nHt+8,LTTRUE);
	m_pFrame->SetBasePos(pos);
	AddControl(m_pFrame);


	for (int nType = 0; nType < kNumCommandTypes; nType++)
	{
		m_pList[nType] = AddList(pos,nHt);
		m_pList[nType]->SetFrameWidth(2);
		m_pList[nType]->SetIndent(LTIntPt(4,4));
		m_pList[nType]->Show(LTFALSE);

		pCtrl = LTNULL;
		switch (nType)
		{
		case COM_MOVE:
			pCtrl = CreateTextItem(IDS_MOVE_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
			break;
		case COM_INV:
			pCtrl = CreateTextItem(IDS_INV_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
			break;
		case COM_VIEW:
			pCtrl = CreateTextItem(IDS_VIEW_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
			break;
		case COM_MISC:
			pCtrl = CreateTextItem(IDS_MISC_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
			break;
		}

		if (pCtrl)
			m_pList[nType]->AddControl(pCtrl);

	}

	InitControlList();

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

	UseBack(LTTRUE,LTTRUE);
	return LTTRUE;
}
示例#14
0
LTBOOL CHUDMessage::Create(MsgCreate &mc)
{
	if (!mc.pFont) return LTFALSE; 

	if (kMinDuration < 0.0f)
		kMinDuration = g_pLayoutMgr->GetMessageMinTime();
	if (kMinFade < 0.0f)
		kMinFade = g_pLayoutMgr->GetMessageMinFade();


	m_pFont = mc.pFont;


	if (!m_pText)
	{
		m_pText = g_pFontManager->CreateFormattedPolyString(m_pFont,"",0.0f,0.0f);
		if (!m_pText)
			return LTFALSE;
	}

	m_pText->SetText(mc.sString.c_str());


	m_nFontSize = mc.nFontSize;
	m_nBaseFontSize = mc.nFontSize;
	m_nTextColor = mc.nTextColor;
	m_nFixedWidth = mc.nWidth;

	m_bDropShadow = mc.bDropShadow;
	
	m_pText->SetColor(m_nTextColor);

	m_fInitTime = -1.0f;

	m_eJustify = mc.eJustify;
	m_fDuration = mc.fDuration * GetConsoleFloat("MessageDuration",1.0f);
	if (m_fDuration < kMinDuration)
		m_fDuration = kMinDuration;
	m_fFadeDur  = mc.fFadeDur * GetConsoleFloat("MessageDuration",1.0f);;
	if (m_fFadeDur < kMinFade)
		m_fFadeDur = kMinFade;

	m_hImage = mc.hImage;
	m_nBaseImageSize = mc.nImageSize;

	switch (m_eJustify)
	{
	case kMsgLeft:
		m_pText->SetAlignmentH(CUI_HALIGN_LEFT);
		break;
	case kMsgRight:
		m_pText->SetAlignmentH(CUI_HALIGN_RIGHT);
		break;
	case kMsgCenter:
		m_pText->SetAlignmentH(CUI_HALIGN_CENTER);
		break;
	};


	InitPoly();

	SetBasePos(LTIntPt(0,0));

	SetScale(g_pInterfaceResMgr->GetXRatio());

	m_bVisible = LTTRUE;

	

	return LTTRUE;
}
示例#15
0
// Build the screen
LTBOOL CScreenSingle::Build()
{

	CreateTitle(IDS_TITLE_GAME);

	AddTextItem(IDS_NEWGAME, CMD_NEW_GAME, IDS_HELP_NEW);

	m_pLoadCtrl = AddTextItem(IDS_LOADGAME,	CMD_LOAD_GAME, IDS_HELP_LOAD);
	m_pLoadCtrl->Enable( LTFALSE );

	m_pChapterCtrl = AddTextItem(IDS_CHAPTERS, CMD_CHAPTER, IDS_HELP_CHAPTERS);

#ifndef _REMOVE_CUSTOM_LEVELS
	CLTGUITextCtrl *pCustom = AddTextItem(IDS_CUSTOM_LEVEL, CMD_CUSTOM_LEVEL, IDS_HELP_CUSTOM);
#endif // _REMOVE_CUSTOM_LEVELS



	char szFrame[128];
	g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_SINGLE,"FrameTexture",szFrame,sizeof(szFrame));
	HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame);

	LTRect rect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"DiffRect");
	int nHeight = (rect.bottom - rect.top);
	int nWidth = (rect.right - rect.left);
	LTIntPt pos = LTIntPt(rect.left,rect.top);

	m_pDiffFrame = debug_new(CLTGUIFrame);
	m_pDiffFrame->Create(hFrame,nWidth,nHeight,LTTRUE);
	m_pDiffFrame->SetBasePos(pos);
	m_pDiffFrame->Show(LTFALSE);
	AddControl(m_pDiffFrame);


	nWidth -= 16;
	m_pDiff = AddList(pos,nHeight, LTTRUE, nWidth);
	if (m_pDiff)
	{
		m_pDiff->SetIndent(LTIntPt(8,8));
		m_pDiff->SetFrameWidth(2);
		m_pDiff->Show(LTFALSE);


		CLTGUITextCtrl *pCtrl = CreateTextItem(IDS_NEW_EASY,	CMD_EASY,	IDS_HELP_EASY);
		m_pDiff->AddControl(pCtrl);

		pCtrl = CreateTextItem(IDS_NEW_MEDIUM, CMD_MEDIUM, IDS_HELP_MEDIUM);
		m_pDiff->AddControl(pCtrl);

		pCtrl = CreateTextItem(IDS_NEW_HARD,	CMD_HARD,	IDS_HELP_HARD);
		m_pDiff->AddControl(pCtrl);

		pCtrl = CreateTextItem(IDS_NEW_INSANE, CMD_INSANE, IDS_HELP_INSANE);
		m_pDiff->AddControl(pCtrl);
	}


	rect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"ChapterRect");
	nHeight = (rect.bottom - rect.top);
	nWidth = (rect.right - rect.left);
	pos = LTIntPt(rect.left,rect.top);

	m_pChapterFrame = debug_new(CLTGUIFrame);
	m_pChapterFrame->Create(hFrame,nWidth,nHeight,LTTRUE);
	m_pChapterFrame->SetBasePos(pos);
	m_pChapterFrame->Show(LTFALSE);
	AddControl(m_pChapterFrame);


	nWidth -= 16;
	m_pChapter = AddList(pos,nHeight, LTTRUE, nWidth);
	if (m_pChapter)
	{
		m_pChapter->SetIndent(LTIntPt(8,8));
		m_pChapter->SetFrameWidth(2);
		m_pChapter->Show(LTFALSE);

	}



#ifndef _REMOVE_CUSTOM_LEVELS

	rect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"CustomRect");
	nHeight = (rect.bottom - rect.top);
	nWidth = (rect.right - rect.left);
	pos = LTIntPt(rect.left,rect.top);

	m_pCustomFrame = debug_new(CLTGUIFrame);
	m_pCustomFrame->Create(hFrame,nWidth,nHeight,LTTRUE);
	m_pCustomFrame->SetBasePos(pos);
	m_pCustomFrame->Show(LTFALSE);
	AddControl(m_pCustomFrame);

	nWidth -= 16;
	m_pCustom = AddList(pos,nHeight, LTTRUE, nWidth);
	if (m_pCustom)
	{
		m_pCustom->SetIndent(LTIntPt(8,8));
		m_pCustom->SetFrameWidth(2);
		m_pCustom->Show(LTFALSE);

		BuildCustomLevelsList(nWidth-16);


	}

	//if no custom levels, remove the link
	if (pCustom && !m_pCustom || m_pCustom->GetNumControls() < 1)
	{
		RemoveControl(pCustom);
	}
#endif // _REMOVE_CUSTOM_LEVELS



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


	return LTTRUE;

}