Example #1
0
void CScreenHostMission::UpdateCampaignName()
{
	bool isDefault = (m_pProfile->m_ServerGameOptions.IsDefaultCampaign());
	if (!isDefault)
	{
		char const* pszCampaignFile = GetCampaignFile( m_pProfile->m_ServerGameOptions );

		if (!CWinUtil::FileExist( pszCampaignFile ))
		{
			m_pProfile->m_ServerGameOptions.SetCampaignName(DEFAULT_CAMPAIGN);
			isDefault = true;
		}
	}



	if (isDefault)
	{
		char szTmp[64];
		LoadString(IDS_HOST_CAMPAIGN_DEFAULT,szTmp,sizeof(szTmp));
		m_pCurrent->SetString(FormatTempString(IDS_CURRENT_CAMPAIGN,szTmp));
		m_pLevels->Enable(false);
	}
	else
	{
		m_pCurrent->SetString(FormatTempString(IDS_CURRENT_CAMPAIGN,m_pProfile->m_ServerGameOptions.GetCampaignName()));
		m_pLevels->Enable(true);
	}
}
Example #2
0
void CScreenProfile::UpdateProfileName()
{
	m_pCurrent->SetString(FormatTempString(IDS_CURRENT_PROFILE,m_szProfile));

	CreateProfileList();

}
Example #3
0
// Setup the resolution control based on the currently selected resolution
void CScreenDisplay::SetupResolutionCtrl()
{
	if (!m_pResolutionCtrl)
	{
		return;
	}


	// Get the selected renderer
	int nResolutionIndex=m_pResolutionCtrl->GetSelIndex();

	// Clear the current resolutions
	m_pResolutionCtrl->RemoveAll();
    uint32 dwOldWidth=0;
    uint32 dwOldHeight=0;
    uint32 dwOldBitDepth=0;
    uint32 dwCurWidth = 0;
    uint32 dwCurHeight = 0;
    uint32 dwCurBitDepth = 0;
	int	 nNewRes = 0;

	unsigned int nResolutions=m_rendererData.m_resolutionArray.GetSize();

	if ((unsigned int)nResolutionIndex < nResolutions)
	{
		dwOldWidth=m_rendererData.m_resolutionArray[nResolutionIndex].m_dwWidth;
		dwOldHeight=m_rendererData.m_resolutionArray[nResolutionIndex].m_dwHeight;
		dwOldBitDepth=m_rendererData.m_resolutionArray[nResolutionIndex].m_dwBitDepth;
	}


	// Add each resolution
	unsigned int i;
	for (i=0; i < nResolutions; i++)
	{
        uint32 dwWidth=m_rendererData.m_resolutionArray[i].m_dwWidth;
        uint32 dwHeight=m_rendererData.m_resolutionArray[i].m_dwHeight;
        uint32 dwBitDepth=m_rendererData.m_resolutionArray[i].m_dwBitDepth;

        if (    LTDIFF(dwWidth,dwOldWidth) <= LTDIFF(dwCurWidth,dwOldWidth) &&
                LTDIFF(dwHeight,dwOldHeight) <= LTDIFF(dwCurHeight,dwOldHeight) &&
                LTDIFF(dwBitDepth,dwOldBitDepth) < LTDIFF(dwCurBitDepth,dwOldBitDepth)
				)
		{
			nNewRes = i;
			dwCurWidth = dwWidth;
			dwCurHeight = dwHeight;
			dwCurBitDepth = dwBitDepth;
		}
		// Load the resolution format string.  This is "Resolution: [%dx%dx%d]" in English
		m_pResolutionCtrl->AddString(FormatTempString(IDS_DMODE_RESOLUTION, dwWidth, dwHeight, dwBitDepth));
	}

	m_pResolutionCtrl->SetSelIndex(nNewRes);

}
void CScreenPlayerSkills::UpdateData(LTBOOL bSaveAndValidate)
{
	if (!bSaveAndValidate)
	{
		for (int i = 0; i < kNumSkills; i++)
		{
			s_nLevels[i] = (uint8)m_nLevels[i];
		}
		m_pPool->SetString(FormatTempString(IDS_X_OF_Y,m_nPool,s_nMaxPool));

	}
	CBaseScreen::UpdateData(bSaveAndValidate);
}
Example #5
0
uint32 CMenuPlayer::OnCommand(uint32 nCommand, uint32 nParam1, uint32 nParam2)
{

	if (m_Popup.m_bWaitForUpdate)
	{
		if (nCommand == MC_UPDATE)
		{
			m_Popup.m_bWaitForUpdate = LTFALSE;
//			g_pInterfaceMgr->GetMenuMgr()->HideSubMenu(true);
			UpdateControls();
		}

		return 1;

	}
	if (nCommand == MC_UPGRADE && m_Upgrade.IsEnabled())
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_PLAYER_SKILLS);
		cMsg.Writeuint8((uint8)g_nSkill);
		g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);

		m_Popup.m_bWaitForUpdate = LTTRUE;

		// Play upgrade sound...
		g_pClientSoundMgr->PlayInterfaceSound("Interface\\Snd\\upgraded_skill.wav");
	}
	else if (nCommand >= MC_CUSTOM)
	{
		g_nSkill = nCommand - MC_CUSTOM;
		UpdatePopup();
		m_Points.SetString(FormatTempString(IDS_SKILL_AVAIL,g_pPlayerStats->GetAvailSkillPoints()));
		m_Popup.ClearSelection();
		m_Popup.PreviousSelection();
		UpdateModText(true);
		g_pInterfaceMgr->GetMenuMgr()->ShowSubMenu(&m_Popup);
		
	}
	else
	{
		return CBaseMenu::OnCommand(nCommand,nParam1,nParam2);
	}

	return 1;
}
bool CScreenPlayerSkills::SetSkill(int nSkl, int nNew)
{
	if (nNew < 0 || nNew >= kNumSkillLevels) return false;
	int nOld = m_nLevels[nSkl];
	if (nNew == nOld) return true;

	

	eSkill skl = (eSkill)nSkl;

	int nAvail = m_nPool;
	while (nNew < nOld)
	{
		int nCost = (int)g_pSkillsButeMgr->GetCostToUpgrade(skl,(eSkillLevel)(nOld));
		nAvail += nCost;
		nOld--;
	}

	while (nNew > nOld)
	{
		int nCost = (int)g_pSkillsButeMgr->GetCostToUpgrade(skl,(eSkillLevel)(nOld+1));

		if (nCost > nAvail)
			return false;

		nAvail -= nCost;
		nOld++;
	}


	m_nPool = nAvail;
	m_pPool->SetString(FormatTempString(IDS_X_OF_Y,m_nPool,s_nMaxPool));

	m_nLevels[nSkl] = nNew;
	s_nLevels[nSkl] = (uint8)m_nLevels[nSkl];
	m_pLabel[nSkl]->UpdateData(LTFALSE);

	return true;
}
Example #7
0
void CMenuPlayer::UpdatePopup()
{
	eSkill skl = (eSkill)g_nSkill;
	eSkillLevel lvl = (eSkillLevel)g_pPlayerStats->GetSkillLevel(skl);
	eSkillLevel nxt = (eSkillLevel)(g_pPlayerStats->GetSkillLevel(skl) + 1);

	m_Name.SetString(GetSkillName(skl));
	m_Level.SetString(GetSkillLevelName(lvl));

	m_Header.GetColumn(2)->Show(!IsMultiplayerGame());

	uint8 nMax = g_pSkillsButeMgr->GetNumModifiers(skl);
	
	for (uint8 m = 0; m < kMaxModifiers; ++m)
	{
		if (m < nMax)
		{
			m_Mods[m].GetColumn(0)->SetString(LoadTempString(g_pSkillsButeMgr->GetModifierNameId(skl,m)));
			m_Mods[m].SetHelpID(g_pSkillsButeMgr->GetModifierDescriptionId(skl,m));

			char szTmp[8];

			float fBase = g_pSkillsButeMgr->GetModifier(skl,SKL_NOVICE,m);
			
			if (fBase <= 0.0f)
			{
				ASSERT(!"MenuPlayer::Bad skill mod");
				fBase = 1.0f;
			}
			float fCur = g_pSkillsButeMgr->GetModifier(skl,lvl,m);
			if (fCur <= 0.0f)
			{
				ASSERT(!"MenuPlayer::Bad skill mod");
				fCur = 1.0f;
			}

			if (fCur >= fBase)
			{
				sprintf(szTmp,"%3.0f%%",100.0f*fCur/fBase);
			}
			else
			{
				sprintf(szTmp,"%3.0f%%",100.0f*fBase/fCur);
			}

			m_Mods[m].GetColumn(1)->SetString(szTmp);


			if ( nxt < kNumSkillLevels)
			{
				float fNxt = g_pSkillsButeMgr->GetModifier(skl,nxt,m);
				if (fNxt <= 0.0f)
				{
					ASSERT(!"MenuPlayer::Bad skill mod");
					fNxt = 1.0f;
				}
				if (fNxt >= fBase)
				{
					sprintf(szTmp,"%3.0f%%",100.0f*fNxt/fBase);
				}
				else
				{
					sprintf(szTmp,"%3.0f%%",100.0f*fBase/fNxt);
				}

			}
			else
			{
				sprintf(szTmp," - ");
			}
			m_Mods[m].GetColumn(2)->SetString(szTmp);
			m_Mods[m].GetColumn(2)->Show(!IsMultiplayerGame());
		
			
			m_Mods[m].Show(true);
		}
		else
		{
			m_Mods[m].Show(false);
		}
	}

	
	if (IsMultiplayerGame())
	{
		m_Upgrade.Show(LTFALSE);
		m_Upgrade.Enable(LTFALSE);
		m_Upgrade.Select(LTFALSE);
		m_Popup.ClearSelection();
		m_Popup.NextSelection();
	}
	else if ( nxt < kNumSkillLevels)
	{
		uint32 nCost = g_pPlayerStats->GetCostToUpgrade(skl);

		char szNext[32];
		SAFE_STRCPY(szNext,GetSkillLevelName(nxt));
		m_Upgrade.SetString(FormatTempString(IDS_SKILL_UPGRADE,szNext,nCost));
		m_Upgrade.SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
		LTBOOL bCanAfford =  (nCost <= g_pPlayerStats->GetAvailSkillPoints()  );

		m_Upgrade.Show(LTTRUE);
		m_Upgrade.Enable(bCanAfford);
		m_Upgrade.Select(bCanAfford);
		if (!bCanAfford)
		{
			m_Popup.ClearSelection();
			m_Popup.NextSelection();
		}
	}
	else
	{
		m_Upgrade.Show(LTTRUE);
		m_Upgrade.SetString(FormatTempString(IDS_SKILL_MAX));
		m_Upgrade.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
		m_Upgrade.Enable(LTFALSE);
		m_Upgrade.Select(LTFALSE);
		m_Popup.ClearSelection();
		m_Popup.NextSelection();

	}

	m_Points.SetString(FormatTempString(IDS_SKILL_AVAIL,g_pPlayerStats->GetAvailSkillPoints()));
	m_Points.Show(!IsMultiplayerGame());
	
}
Example #8
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();
}
Example #9
0
void CHUDCrosshair::Update()
{
	if (!m_bEnabled)
		return;

	if (m_fScale != g_pInterfaceResMgr->GetXRatio())
	{
		m_fScale = g_pInterfaceResMgr->GetXRatio();
		m_x = (float)m_StrPos.x * m_fScale;
		m_y = (float)m_StrPos.y * m_fScale;

		uint8 nTextSize = (uint8)((float)m_nStrSz * m_fScale);
		m_pStr->SetCharScreenHeight(nTextSize);

		m_dbgx = (float)m_DbgPos.x * m_fScale;
		m_dbgy = (float)m_DbgPos.y * m_fScale;
	
		nTextSize = (uint8)((float)m_nDbgSz * m_fScale);
		m_pDbgStr->SetCharScreenHeight(nTextSize);

		m_infox = (float)m_InfoPos.x * m_fScale;
		m_infoy = (float)m_InfoPos.y * m_fScale;

		nTextSize = (uint8)((float)m_nInfoSz * m_fScale);
		m_pInfoStr->SetCharScreenHeight(nTextSize);
	}

	if (g_pPlayerMgr->IsCarryingBody())
	{
		m_nString = 0;
		if (g_pPlayerMgr->CanDropBody())
			m_pStr->SetText(LoadTempString(IDS_TARGET_DROP));
		else
			m_pStr->SetText("");
		return;
	}

	// Draw the appropriate cross-hair based on our current weapon,
	// and what is directly in front of us...

	bool bWeaponsEnabled = g_pPlayerMgr->GetClientWeaponMgr()->WeaponsEnabled();
	IClientWeaponBase* pClientWeapon = g_pPlayerMgr->GetCurrentClientWeapon();
	m_bArmed = (pClientWeapon && bWeaponsEnabled);

	if (g_pPlayerMgr->IsSearching())
	{
		m_pStr->SetText(LoadTempString(IDS_TARGET_SEARCHING));
		return;
	}

	HOBJECT hObj = g_pPlayerMgr->GetTargetMgr()->GetTargetObject();
	uint16  nID = g_pPlayerMgr->GetTargetMgr()->GetTargetStringID();

	if (strcmp(g_pPlayerMgr->GetTargetMgr()->GetDebugString(),m_pDbgStr->GetText()))
		m_pDbgStr->SetText(g_pPlayerMgr->GetTargetMgr()->GetDebugString());

	if (hObj == m_hObj && nID == m_nString)
		return;

	m_hObj = hObj;
	m_nString = nID;
	m_pStr->SetText(g_pPlayerMgr->GetTargetMgr()->GetTargetString());

	if (g_pTronPlayerMgr->GetTronTargetMgr()->IsEnergyRequired())
	{
		int iEnergy = g_pTronPlayerMgr->GetTronTargetMgr()->GetEnergyRequired();
		m_pInfoStr->SetText(FormatTempString(IDS_REQUIRES_ENERGY,iEnergy));
		int iPlayerEnergy = g_pTronPlayerStats->GetEnergy();
		m_pInfoStr->SetColor((iPlayerEnergy > iEnergy) ? m_InfoColor : m_InfoBadColor);
	}
	else
	{
		m_pInfoStr->SetText("");
	}

	// Check for special case of camera-activate mode...

	bool bUsingCamera = false;
	AMMO const *pAmmo = g_pWeaponMgr->GetAmmo(g_pPlayerStats->GetCurrentAmmo());
	if (pAmmo && pAmmo->eInstDamageType == DT_GADGET_CAMERA)
	{
		bUsingCamera = true;
	}
	if (!bUsingCamera || !g_pPlayerMgr->IsZoomed())
	{
		g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA);
		g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA_TARGET);
		return;
	}


	if (hObj)
	{
		uint32 dwUserFlags = 0;
		g_pCommonLT->GetObjectFlags(hObj, OFT_User, dwUserFlags);

		if ( dwUserFlags & USRFLG_GADGET_CAMERA )
		{
			g_pInterfaceMgr->CreateOverlay(OVM_CAMERA_TARGET);
			g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA);
			return;

		}
	}

	g_pInterfaceMgr->CreateOverlay(OVM_CAMERA);
	g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA_TARGET);


}