Пример #1
0
LTBOOL   CScreenConfigure::Init(int nScreenID)
{
	LoadString(IDS_DEVICE_MOUSE,strDeviceNiceName[1],sizeof(strDeviceNiceName[1]));
	LoadString(IDS_DEVICE_JOYSTICK,strDeviceNiceName[2],sizeof(strDeviceNiceName[2]));

	sprintf (szWheelUp,"%s %s",strDeviceNiceName[1], LoadTempString(IDS_WHEEL_UP) );
	sprintf (szWheelDown,"%s %s",strDeviceNiceName[1], LoadTempString(IDS_WHEEL_DOWN) );

	if (g_pGameClientShell->HasGamepad())
	{
		devices[2] = DEVICETYPE_GAMEPAD;
		g_pGameClientShell->EnableGamepad();
	}
	else if (g_pGameClientShell->HasJoystick())
	{
		devices[2] = DEVICETYPE_JOYSTICK;
		g_pGameClientShell->EnableJoystick();
	}
	else
		devices[2] = DEVICETYPE_UNKNOWN;



	for (int dev = 0; dev < 3; dev++)
	{
		g_pLTClient->GetDeviceName (devices[dev],strDeviceName[dev], sizeof(strDeviceName[dev]));
	}


	return CBaseScreen::Init(nScreenID);
}
Пример #2
0
// Build the screen
LTBOOL CScreenAudio::Build()
{

	CreateTitle(IDS_TITLE_SOUND);

	kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"ColumnWidth");
	kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_AUDIO,"SliderWidth");

	uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions();
	m_bMusicEnabled = (dwAdvancedOptions & AO_MUSIC);

	//background frame
	LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_AUDIO,"FrameRect");
	LTIntPt pos(frameRect.left,frameRect.top);
	int nHt = frameRect.bottom - frameRect.top;
	int nWd = frameRect.right - frameRect.left;

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

	m_pSoundVolumeCtrl=AddSlider(IDS_SOUND_FXVOL, IDS_HELP_SOUNDVOL, kGap, kWidth, -1, &m_nSoundVolume);
	m_pSoundVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) );
	m_pSoundVolumeCtrl->SetSliderRange(SOUND_MIN_VOL, SOUND_MAX_VOL);
	m_pSoundVolumeCtrl->SetSliderIncrement(SOUND_SLIDER_INC);

   	m_pSpeechVolumeCtrl=AddSlider(IDS_SPEECH_FXVOL, IDS_HELP_SPEECHVOL, kGap, kWidth, -1, &m_nSpeechVolume);
	m_pSpeechVolumeCtrl->Enable( (dwAdvancedOptions & AO_SOUND) );
	m_pSpeechVolumeCtrl->SetSliderRange(SPEECH_MIN_VOL, SPEECH_MAX_VOL);
	m_pSpeechVolumeCtrl->SetSliderIncrement(SPEECH_SLIDER_INC);

	m_pSoundQualityCtrl=AddToggle(IDS_SOUND_QUALITY, IDS_HELP_SOUNDQUAL, kGap, &m_bSoundQuality);
	m_pSoundQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH));
	m_pSoundQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW));
	m_pSoundQualityCtrl->Enable( (dwAdvancedOptions & AO_SOUND) );

	m_pMusicVolumeCtrl = AddSlider(IDS_SOUND_MUSICVOL, IDS_HELP_MUSICVOL, kGap, kWidth, -1, &m_nMusicVolume);
	m_pMusicVolumeCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) );
	m_pMusicVolumeCtrl->SetSliderRange(MUSIC_MIN_VOL, MUSIC_MAX_VOL);
	m_pMusicVolumeCtrl->SetSliderIncrement(MUSIC_SLIDER_INC);

	m_pMusicQualityCtrl=AddToggle(IDS_MUSIC_QUALITY, IDS_HELP_MUSIC_QUALITY, kGap, &m_bMusicQuality);
	m_pMusicQualityCtrl->SetOnString(LoadTempString(IDS_SOUND_HIGH));
	m_pMusicQualityCtrl->SetOffString(LoadTempString(IDS_SOUND_LOW));
	m_pMusicQualityCtrl->Enable( (dwAdvancedOptions & AO_MUSIC) );


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

	UseBack(LTTRUE,LTTRUE);
	return LTTRUE;
}
Пример #3
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;

}
Пример #4
0
LTBOOL CScreenHostLevels::FillAvailList()
{
	// Sanity checks...

    if (!m_pAvailMissions) return(LTFALSE);


	for (int nMission = 0; nMission < g_pMissionButeMgr->GetNumMissions(); nMission++)
	{
		MISSION* pMission = g_pMissionButeMgr->GetMission(nMission);
		if (pMission)
		{
			CLTGUITextCtrl *pCtrl = NULL;
			if (pMission->nNameId > 0)
				pCtrl = CreateTextItem(LoadTempString(pMission->nNameId),CMD_ADD_LEVEL,pMission->nDescId);
			else if (!pMission->sName.empty())
				pCtrl = CreateTextItem((char *)pMission->sName.c_str(),CMD_ADD_LEVEL,pMission->nDescId);
			else
			{
				char szWorldTitle[MAX_PATH] = "";
				_splitpath( pMission->aLevels[0].szLevel, NULL, NULL, szWorldTitle, NULL );
				pCtrl = CreateTextItem(szWorldTitle,CMD_ADD_LEVEL,0);
			}
			pCtrl->SetFont(LTNULL,nListFontSize);
			pCtrl->SetParam1(nMission);
			pCtrl->SetFixedWidth(nAvailWidth,LTTRUE);
			m_pAvailMissions->AddControl(pCtrl);
		}
	}


    return (LTTRUE);
}
Пример #5
0
void CMenuPlayer::UpdateControls()
{
	const RANK* pRank = g_pPlayerStats->GetRank();
	if (pRank)
		m_pRank->GetColumn(1)->SetString(LoadTempString(pRank->nNameId));
	else
		m_pRank->GetColumn(1)->SetString("<error>");

	char szTmp[32];
	sprintf(szTmp,"%d",g_pPlayerStats->GetTotalSkillPoints());
	m_pTotal->GetColumn(1)->SetString(szTmp);
	m_pTotal->Show(!IsMultiplayerGame());

	sprintf(szTmp,"%d",g_pPlayerStats->GetAvailSkillPoints());
	m_pAvail->GetColumn(1)->SetString(szTmp);
	m_pAvail->Show(!IsMultiplayerGame());

	for (uint8 i = 0; i < kNumSkills; i++)
	{
		eSkill skl = (eSkill)i;
		if (m_pSkills[i])
		{
			eSkillLevel lvl = (eSkillLevel)g_pPlayerStats->GetSkillLevel(skl);
			m_pSkills[i]->SetSkillLevel(lvl);
		}
	}

	if (m_Popup.IsVisible())
		UpdatePopup();
}
Пример #6
0
const char* GetSkillLevelName(eSkillLevel lvl)
{
	static int nIds[kNumSkillLevels] = 
	{
		IDS_SKILL_NOVICE,
		IDS_SKILL_AMATEUR,
		IDS_SKILL_SKILLED,
		IDS_SKILL_EXPERT,
		IDS_SKILL_MASTER,
	};

	return (const char *)LoadTempString(nIds[lvl]);
}
Пример #7
0
void CMenuPlayer::UpdateModText(bool bForce)
{
	static uint16 nCurrentHelp = 0;
	uint16 nHelp = m_Popup.GetHelpID();

	if (bForce || nHelp != nCurrentHelp)
	{
		nCurrentHelp = nHelp;
		if (nCurrentHelp)
		{
			m_ModDesc.SetString(LoadTempString(nCurrentHelp));
		}
		else
			m_ModDesc.SetString(" ");
	}
}
Пример #8
0
// Build the screen
LTBOOL CScreenTeam::Build()
{

	CreateTitle(IDS_TITLE_TEAM);
	int kColumn0 = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_TEAM,"ColumnWidth");
	int kColumn1 = (640 - GetPageLeft()) - kColumn0;
	int kArrow = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_TEAM,"ArrowWidth");

	m_pName = AddColumnCtrl(CMD_EDIT_NAME, IDS_HELP_TEAM_NAME);
	m_pName->AddColumn(LoadTempString(IDS_TEAM_NAME), kColumn0);
	m_pName->AddColumn("<Team name>", kColumn1, LTTRUE);

	m_pModel = AddTextItem(IDS_TEAM_MODEL, LTNULL, IDS_HELP_TEAM_MODEL);

	LTIntPt arrowPos = m_pModel->GetBasePos();
	arrowPos.x += kColumn0;

	HTEXTURE hLeft = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowlt.dtx");
	HTEXTURE hLeftH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowlt_h.dtx");

	m_pLeft = debug_new(CLTGUIButton);
	if (m_pLeft)
	{
		m_pLeft->Create(CMD_LEFT,LTNULL,hLeft,hLeftH);
		m_pLeft->SetBasePos(arrowPos);
		AddControl(m_pLeft);
		m_pLeft->SetCommandHandler(this);
	}
	arrowPos.x += kArrow;

	HTEXTURE hRight = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowrt.dtx");
	HTEXTURE hRightH = g_pInterfaceResMgr->GetTexture("interface\\menu\\sprtex\\arrowrt_h.dtx");
	m_pRight = debug_new(CLTGUIButton);
	if (m_pRight)
	{
		m_pRight->Create(CMD_RIGHT,LTNULL,hRight,hRightH);
		m_pRight->SetBasePos(arrowPos);
		AddControl(m_pRight);
		m_pRight->SetCommandHandler(this);
	}


 	// Make sure to call the base class
	return CBaseScreen::Build();
}
Пример #9
0
void CHUDChatInput::Show(bool bShow, bool bTeam) 
{
	m_bVisible = bShow;
	m_nHistory = -1;
	g_pChatMsgs->ShowHistory(bShow);


	//only set the team flag when showing the ChatInput. We will need to
	// access the flag after it is hidden.
	if (bShow)
		m_bTeamMessage = bTeam;

	m_EditCtrl.Show(bShow);
	g_pGameClientShell->SetInputState(!bShow);
	g_pLTClient->ClearInput();

	if (bShow)
	{
		m_pStr->SetText(LoadTempString(IDS_SAY));
		m_szChatStr[0] = 0;
	
		Update();

	}
	
	// Pause the server in single player while chatting... 

	if( !IsMultiplayerGame() )
	{
		g_pGameClientShell->PauseGame( !!bShow, true );
	}

	// Send the Message to the server
	CAutoMessage cMsg;
	cMsg.Writeuint8(MID_PLAYER_CHATMODE);
    cMsg.Writeuint8((uint8)bShow);
    g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);

	m_EditCtrl.UpdateData(!bShow);
}
Пример #10
0
void CScreenHostLevels::AddMissionToList(int nMissionId)
{
	// Sanity checks...

	if (!m_pSelMissions) return;
	if (m_pSelMissions->GetNumControls() == MAX_GAME_LEVELS) return;


	// Add the level to the list...

	MISSION *pMission = g_pMissionButeMgr->GetMission(nMissionId);

	if (pMission)
	{
		
		CLTGUITextCtrl *pCtrl = NULL;
		if (pMission->nNameId > 0)
			pCtrl = CreateTextItem(LoadTempString(pMission->nNameId),CMD_REMOVE_LEVEL,pMission->nDescId);
		else if (!pMission->sName.empty())
			pCtrl = CreateTextItem((char *)pMission->sName.c_str(),CMD_REMOVE_LEVEL,pMission->nDescId);
		else
		{
			char szWorldTitle[MAX_PATH] = "";
			_splitpath( pMission->aLevels[0].szLevel, NULL, NULL, szWorldTitle, NULL );
			pCtrl = CreateTextItem(szWorldTitle,CMD_REMOVE_LEVEL,0);
		}
		pCtrl->SetFont(LTNULL,nListFontSize);
		pCtrl->SetParam1(nMissionId);
		pCtrl->SetFixedWidth(nSelWidth,LTTRUE);
		m_pSelMissions->AddControl(pCtrl);
		
	}
	else
	{
		ASSERT(!"Invalid mission id");
	}

}
Пример #11
0
void CScreenFailure::OnFocus(LTBOOL bFocus)
{

	if (bFocus)
	{
		g_fDuration = 0.0f;
		if (m_pString)
		{
			CUIFormattedPolyString *pStr = m_pString->GetString();
			if (pStr)
				pStr->SetText(LoadTempString(g_pInterfaceMgr->GetFailStringID()));
		}
	}
	else
	{
		if (m_pString)
		{
			CUIFormattedPolyString *pStr = m_pString->GetString();
			if (pStr)
				pStr->SetText("");
		}
	}
	CBaseScreen::OnFocus(bFocus);
}
Пример #12
0
void CScreenPostload::Escape()
{
	// Check if they were prompted to press any key.
	if( m_bPressAnyKey )
	{
		// Acknowledge keypress.
		m_bPressAnyKey = false;

		HLOCALOBJ hPlayerObj = g_pLTClient->GetClientObject();
		if (g_pGameClientShell->IsWorldLoaded() && hPlayerObj)
		{
			// Tell the client we're ready to play.
			g_pGameClientShell->SendClientLoadedMessage( );

			// Change to waiting for other players.
			m_pContinueStr->SetText( LoadTempString(IDS_WAITINGFOROTHERPLAYERS));
			m_pContinueStr->SetColor(m_nContinueColor);
		}
		else
		{
			g_pInterfaceMgr->SwitchToScreen(SCREEN_ID_MAIN);
		}
	}
}
Пример #13
0
void CBaseMenu::SetTitle (int stringID)
{
	m_Title.SetString(LoadTempString(stringID));
}
Пример #14
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;
}
Пример #15
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());
	
}
Пример #16
0
// This is called when the screen gets or loses focus
void CMenuMission::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		int mission = g_pMissionMgr->GetCurrentMission();
		int level = g_pMissionMgr->GetCurrentLevel();
		MISSION* pMission = g_pMissionButeMgr->GetMission(mission);
		if (pMission)
		{
			m_pNameCtrl->SetString(LoadTempString(pMission->nNameId));
			LEVEL* pLevel = g_pMissionButeMgr->GetLevel(mission,level);
			if (pLevel)
			{
				m_pLevelCtrl->SetString(LoadTempString(pLevel->nNameId));
			}
			else
				m_pLevelCtrl->SetString(" ");

		}
		else
		{
			m_pNameCtrl->SetString(LoadTempString(IDS_CUSTOM_LEVEL));
			m_pLevelCtrl->SetString(" ");
		}

		uint16 nextItem = m_nFirstObj;
		uint16 numItems = 0;
		uint16 nWidth = s_Size.x - 2*m_Indent.x;

		g_pPlayerStats->SetObjectivesSeen();

		// add required objectives
		IDList* pObj = g_pPlayerStats->GetObjectives();

		//check to see if we need to add a label
		if (pObj->m_IDArray.size())
		{
			// if we already have created a objectives label, use it
			if (m_pObjLabel)
			{
				m_List.AddControl(m_pObjLabel);
			}
			else
			{
				// otherwise create a label
				uint16 ndx = AddControl(IDS_OBJECTIVES,0,LTTRUE);
				m_pObjLabel = (CLTGUITextCtrl *)m_List.GetControl(ndx);
			}
		}

		for (int i = (int)(pObj->m_IDArray.size())-1; i >= 0 ; i--)
		{
			CObjectiveCtrl* pCtrl = LTNULL;
			uint32 objID = pObj->m_IDArray[i];
			// if we don't have a cached objective control, create a new one
			if (numItems >= m_Objectives.size())
			{
				uint16 ndx = AddObjectiveControl(objID);
				pCtrl = (CObjectiveCtrl*)m_List.GetControl(ndx);
				pCtrl->SetFixedWidth(nWidth);
				numItems++;
			}
			else
			{
				//otherwise, grab one from the cache
				pCtrl = (CObjectiveCtrl*)m_Objectives[numItems];
				m_List.AddControl(pCtrl);
				pCtrl->SetString(LoadTempString(objID));
				pCtrl->SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
				pCtrl->SetTexture(m_BulletTex);
				numItems++;

			}

		}

		// add optional objectives
		pObj = g_pPlayerStats->GetOptionalObjectives();

		//check to see if we need to add a label
		if (pObj->m_IDArray.size() && !numItems)
		{
			// if we already have created a objectives label, use it
			if (m_pObjLabel)
			{
				m_List.AddControl(m_pObjLabel);
			}
			else
			{
				// otherwise create a label
				uint16 ndx = AddControl(IDS_OBJECTIVES,0,LTTRUE);
				m_pObjLabel = (CLTGUITextCtrl *)m_List.GetControl(ndx);
			}
		}
		for (int i = (int)(pObj->m_IDArray.size())-1; i >= 0 ; i--)
		{
			CObjectiveCtrl* pCtrl = LTNULL;
			uint32 objID = pObj->m_IDArray[i];
			// if we don't have a cached objective control, create a new one
			if (numItems >= m_Objectives.size())
			{
				uint16 ndx = AddObjectiveControl(objID,LTFALSE,LTTRUE);
				pCtrl = (CObjectiveCtrl*)m_List.GetControl(ndx);
				pCtrl->SetFixedWidth(nWidth);
				numItems++;
			}
			else
			{
				//otherwise, grab one from the cache
				pCtrl = (CObjectiveCtrl*)m_Objectives[numItems];
				m_List.AddControl(pCtrl);
				char szString[256] = "";
				LoadString(objID,szString,sizeof(szString));
				strcat(szString,szOptional);

				pCtrl->SetString(szString);
				pCtrl->SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
				pCtrl->SetTexture(m_BulletTex);
				numItems++;

			}

		}

		// add completed objectives
		pObj = g_pPlayerStats->GetCompletedObjectives();

		//check to see if we need to add a label
		if (pObj->m_IDArray.size() && !numItems)
		{
			// if we already have created a objectives label, use it
			if (m_pObjLabel)
			{
				m_List.AddControl(m_pObjLabel);
			}
			else
			{
				// otherwise create a label
				uint16 ndx = AddControl(IDS_OBJECTIVES,0,LTTRUE);
				m_pObjLabel = (CLTGUITextCtrl *)m_List.GetControl(ndx);
			}
		}

		for (int i = (int)(pObj->m_IDArray.size())-1; i >= 0 ; i--)
		{
			CObjectiveCtrl* pCtrl = LTNULL;
			uint32 objID = pObj->m_IDArray[i];
			// if we don't have a cached objective control, create a new one
			if (numItems >= m_Objectives.size())
			{
				uint16 ndx = AddObjectiveControl(objID,LTTRUE);
				pCtrl = (CObjectiveCtrl*)m_List.GetControl(ndx);
				pCtrl->SetFixedWidth(nWidth);
				numItems++;
			}
			else
			{
				//otherwise, grab one from the cache
				pCtrl = (CObjectiveCtrl*)m_Objectives[numItems];
				m_List.AddControl(pCtrl);
				pCtrl->SetString(LoadTempString(objID));
				pCtrl->SetColors(argbCompleted,argbCompleted,argbCompleted);
				pCtrl->SetTexture(m_CompletedTex);
				numItems++;

			}

		}

		// add mission parameters
		pObj = g_pPlayerStats->GetParameters();

		//check to see if we need to add a label
		if (pObj->m_IDArray.size())
		{
			// if we already have created a parameters label, use it
			if (m_pParameters)
			{
				m_List.AddControl(m_pParameters);
			}
			else
			{
				// otherwise create a label
				uint16 ndx = AddControl(IDS_PARAMETERS,0,LTTRUE);
				m_pParameters = (CLTGUITextCtrl *)m_List.GetControl(ndx);
			}
		}
		for (int i = (int)(pObj->m_IDArray.size())-1; i >= 0 ; i--)
		{
			CObjectiveCtrl* pCtrl = LTNULL;
			uint32 objID = pObj->m_IDArray[i];

			// if we don't have a cached objective control, create a new one
			if (numItems >= m_Objectives.size())
			{
				uint16 ndx = AddObjectiveControl(objID);
				pCtrl = (CObjectiveCtrl*)m_List.GetControl(ndx);
				pCtrl->SetFixedWidth(nWidth);
				numItems++;
			}
			else
			{
				//otherwise, grab one from the cache
				pCtrl = (CObjectiveCtrl*)m_Objectives[numItems];
				m_List.AddControl(pCtrl);
				pCtrl->SetString(LoadTempString(objID));
				pCtrl->SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
				numItems++;

			}

		}

		m_List.SetStartIndex(0);
		
	}
	else
	{
		// take the objectives and parameters out of the list 
		// (they are still cached for re-use)
		RemoveObjectives();
	}
	CBaseMenu::OnFocus(bFocus);

}
Пример #17
0
void CHUDMissionText::Start(int nMessageID)
{
	Start(LoadTempString(nMessageID));
}
Пример #18
0
void CHUDCrosshair::Update()
{
	if (!m_bEnabled)
		return;


	
	IClientWeaponBase* pClientWeapon = g_pPlayerMgr->GetCurrentClientWeapon();

    float fPerturb = 1.0f;

	// Just use the weapon's dynamic perturb to determine the amount the
	// crosshair should scale...
	if (pClientWeapon)
	{
		fPerturb = pClientWeapon->GetDynamicPerturb();
	}

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

	bool bDynamic = (!!GetConsoleInt("CrosshairDynamic",1));


	uint32 cr = (uint32)(GetConsoleInt("CrosshairRed",0x00));
	uint32 cg = (uint32)(GetConsoleInt("CrosshairGreen",0xFF));
	uint32 cb = (uint32)(GetConsoleInt("CrosshairBlue",0xFF));
	uint32 ca = (uint32)( (1.0f - fPerturb) * 255.0f);

	if (!bDynamic)
		ca = 0xFF;

	uint32 crosscolor = SET_ARGB(ca,cr,cg,cb);
	g_pDrawPrim->SetRGBA(&m_Poly[0],crosscolor);

	if (bDynamic)
	{
		ca = (uint32)( fPerturb * 255.0f);
		crosscolor = SET_ARGB(ca,cr,cg,cb);
		g_pDrawPrim->SetRGBA(&m_Poly[1],crosscolor);
	}


	if (m_fScale != g_pInterfaceResMgr->GetXRatio())
	{
		m_fScale = g_pInterfaceResMgr->GetXRatio();

		ScalePolies();

		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_bCanActivateTarget = g_pPlayerMgr->GetTargetMgr()->CanActivateTarget();
	m_nTargetTeam = g_pPlayerMgr->GetTargetMgr()->GetTargetTeam();

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

	//track whether or not we've zoomed since our last update
	static bool bZoomed = false;
	if( g_pPlayerMgr->IsZooming() )
	{
		if (!bZoomed)
		{
			bZoomed = true;
			m_pStr->SetText("");
		}
		
		return;
	}

	//if we have zoomed since our last full update, force an update
	if (!bZoomed && hObj == m_hObj && nID == m_nString)
		return;

	bZoomed = false;

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


	// 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_pPlayerMgr->InCameraGadgetRange( hObj ) )
		{
			g_pInterfaceMgr->CreateOverlay(OVM_CAMERA_TARGET);
			g_pInterfaceMgr->RemoveOverlay(OVM_CAMERA);
			return;

		}
	}

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


}
Пример #19
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;
}
Пример #20
0
void CHUDChatMsgQueue::AddMessage(int nMessageID, eChatMsgType type)
{
	AddMessage(LoadTempString(nMessageID),type);
}
Пример #21
0
LTBOOL CBaseMenu::Init()
{
	if (!s_Frame)
	{

		char szTmp[128] = "";
		g_pLayoutMgr->GetMenuFrame(szTmp,sizeof(szTmp));
		s_Frame = g_pInterfaceResMgr->GetTexture(szTmp);

		g_pLayoutMgr->GetMenuFrameTip(szTmp,sizeof(szTmp));
		s_FrameTip = g_pInterfaceResMgr->GetTexture(szTmp);

		s_Size	= g_pLayoutMgr->GetMenuSize();
		s_Pos	= g_pLayoutMgr->GetMenuPosition();

		g_pLayoutMgr->GetMenuUpArrow(szTmp,sizeof(szTmp));
		s_Up = g_pInterfaceResMgr->GetTexture(szTmp);
		g_pLayoutMgr->GetMenuUpArrowHighlight(szTmp,sizeof(szTmp));
		s_UpH = g_pInterfaceResMgr->GetTexture(szTmp);

		g_pLayoutMgr->GetMenuDownArrow(szTmp,sizeof(szTmp));
		s_Down = g_pInterfaceResMgr->GetTexture(szTmp);
		g_pLayoutMgr->GetMenuDownArrowHighlight(szTmp,sizeof(szTmp));
		s_DownH = g_pInterfaceResMgr->GetTexture(szTmp);
	}

	m_FontFace		= g_pLayoutMgr->GetMenuFontFace(m_MenuID);
	m_FontSize		= g_pLayoutMgr->GetMenuFontSize(m_MenuID);
	m_TitleFontFace	= g_pLayoutMgr->GetMenuTitleFontFace(m_MenuID);
	m_TitleFontSize	= g_pLayoutMgr->GetMenuTitleFontSize(m_MenuID);

	m_Indent		= g_pLayoutMgr->GetMenuIndent(m_MenuID);


	m_SelectedColor		= g_pLayoutMgr->GetMenuSelectedColor(m_MenuID);
	m_NonSelectedColor	= g_pLayoutMgr->GetMenuNonSelectedColor(m_MenuID);
	m_DisabledColor		= g_pLayoutMgr->GetMenuDisabledColor(m_MenuID);

	if (!Create(NULL,s_Size.x,s_Size.y)) return LTFALSE;

	SetupQuadUVs(m_Poly[0], s_Frame, 0.0f,0.0f,1.0f,1.0f);
	SetupQuadUVs(m_Poly[1], s_FrameTip, 0.0f,0.0f,1.0f,1.0f);
	g_pDrawPrim->SetRGBA(&m_Poly[0],argbWhite);
	g_pDrawPrim->SetRGBA(&m_Poly[1],argbWhite);


	LTIntPt pos = m_Indent;

	CUIFont* pFont = g_pInterfaceResMgr->GetFont(m_TitleFontFace);
	if (!pFont) return LTFALSE;

    if (!m_Title.Create("X", LTNULL, LTNULL, pFont, m_TitleFontSize, this))
	{
        return LTFALSE;
	}

	m_Title.SetColors(m_NonSelectedColor,m_NonSelectedColor,m_NonSelectedColor);
	m_Title.Enable(LTFALSE);

	pos.x = m_Indent.x + 24;
	CLTGUIWindow::AddControl(&m_Title,pos);

	m_Title.SetScale(1.0f);
	pos.x = m_Indent.x;
	pos.y += (m_Title.GetHeight() + 4);
	m_Title.SetScale(g_pInterfaceResMgr->GetXRatio());

	m_List.Create(s_Size.y - pos.y);
	uint16 nOffset = (s_Size.x-m_Indent.x*2)-16;
	m_List.UseArrows(nOffset ,1.0f,s_Up,s_UpH,s_Down,s_DownH);
	CLTGUIWindow::AddControl(&m_List,pos);

	m_Resume.Create(LoadTempString(IDS_RESUME),MC_CLOSE,NULL,pFont,m_TitleFontSize,this);

	pos.x = s_Size.x - m_Indent.x - m_Resume.GetWidth();
	pos.y = 12;
	CLTGUIWindow::AddControl(&m_Resume,pos);

	pos.x = s_Pos;
	pos.y = 0;
	SetBasePos(pos);


	return LTTRUE;
}
Пример #22
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);


}
Пример #23
0
void CHUDPickupMsgQueue::AddMessage(int nMessageID,const char *pszImage)
{
	AddMessage(LoadTempString(nMessageID),pszImage);
}
Пример #24
0
uint16 CBaseMenu::AddControl (int stringID, uint32 commandID, LTBOOL bStatic)
{
	return AddControl(LoadTempString(stringID),commandID,bStatic);
}
Пример #25
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;

}
Пример #26
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();
}
Пример #27
0
void CLoadingScreen::UpdateMissionInfo()
{
	// No need to update mission info if a different screen is being rendered...
	
	if( m_pRenderScreen )
		return;

	EnterCriticalSection(&m_MissionUpdate);

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

			// 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 );
			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 = "";

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

		}

	}

	m_pMissionNameStr->SetText(m_missionname.c_str());
	m_pLevelNameStr->SetText(m_levelname.c_str());
	m_pHelpStr->SetText(m_help.c_str());

	if (g_pGameClientShell->IsRunningPerformanceTest())
	{
		m_pBriefingStr->SetText(LoadTempString( IDS_PERFORMANCE_TEST_BRIEF ));
	}
	else
	{
		m_pBriefingStr->SetText(m_briefing.c_str());
	}

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



	LeaveCriticalSection(&m_MissionUpdate);
}
Пример #28
0
// Change in focus
void    CScreenMulti::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		// Make sure we're disconnected from server.
		if(g_pLTClient->IsConnected())
		{
			g_pInterfaceMgr->SetIntentionalDisconnect( true );
			g_pClientMultiplayerMgr->ForceDisconnect();
		}

		std::string sMissionFile;
		switch (g_pGameClientShell->GetGameType())
		{
		case eGameTypeCooperative:
			// Initialize to the coop mission bute.
			sMissionFile = MISSION_COOP_FILE;
			break;
		
		case eGameTypeDeathmatch:
		case eGameTypeTeamDeathmatch:
			// Initialize to the DM mission bute.
			sMissionFile = MISSION_DM_FILE;
			break;

		case eGameTypeDoomsDay:
			// Initialize to the doomsday mission bute.
			sMissionFile = MISSION_DD_FILE;
			break;
		}

		if( !g_pMissionButeMgr->Init( sMissionFile.c_str() ))
		{
			g_pLTClient->ShutdownWithMessage("Could not load mission bute %s.", sMissionFile.c_str() );
			return;
		}


		if (g_bLAN)
		{
			m_eCurState = eState_Ready;
			m_pCDKeyCtrl->Show(LTFALSE);
			m_pJoin->Enable(LTTRUE);
			m_pHost->Enable(LTTRUE);
			m_pWait->Show(LTFALSE);
			m_pSysMOTD->Show(LTFALSE);
			m_pGameMOTD->Show(LTFALSE);
			m_pSysFrame->Show(LTFALSE);
			m_pGameFrame->Show(LTFALSE);
			m_pUpdate->Show(LTFALSE);
			m_pStatusCtrl->Show(LTFALSE);

		}
		else
		{
			m_pJoin->Enable(LTFALSE);
			m_pHost->Enable(LTFALSE);

			m_pSysMOTD->Show(LTTRUE);
			m_pGameMOTD->Show(LTTRUE);
			m_pSysFrame->Show(LTTRUE);
			m_pGameFrame->Show(LTTRUE);
			m_pUpdate->Show(LTFALSE);
			m_pStatusCtrl->Show(LTTRUE);
			

			m_pCDKeyCtrl->Show(LTTRUE);
			IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir();
			// Make a serverdir if we don't have one
			// Note : Find a way to put this back in the game client shell!!!  It has to be
			// here right now so that we can delete it when we start up a server..
			if (!pServerDir)
			{
				pServerDir = g_pClientMultiplayerMgr->CreateServerDir( );
			}
			m_pWaitText->SetString(LoadTempString(IDS_INTERNET));
			m_pWait->Show(LTTRUE);
			SetCapture(m_pWait);

			m_eCurState = eState_Startup;

		}



        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();
	}
	CBaseScreen::OnFocus(bFocus);
	if (bFocus)
	{
		//since several failure states can drop us here, make sure that we return to main screen on escape
		m_pScreenMgr->AddScreenToHistory( SCREEN_ID_MAIN );
	}

}
Пример #29
0
// Build the screen
LTBOOL CScreenGame::Build()
{

	CreateTitle(IDS_TITLE_GAME_OPTIONS);

	kGap = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"ColumnWidth");
	kWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_GAME,"SliderWidth");

	//background frame
	LTRect frameRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_GAME,"FrameRect");
	LTIntPt pos(frameRect.left,frameRect.top);
	int nHt = frameRect.bottom - frameRect.top;
	int nWd = frameRect.right - frameRect.left;

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

	//crosshair menu
	AddTextItem(IDS_CONTROLS_CROSSHAIR, CMD_CROSSHAIR, IDS_HELP_CROSSHAIRMENU);

	CLTGUICycleCtrl* pCycle = AddCycle(IDS_DISPLAY_SUBTITLES,IDS_HELP_SUBTITLES,kGap,&m_nSubtitles);
	char szTmp[64];
    FormatString(IDS_OFF,szTmp,sizeof(szTmp));
	pCycle->AddString(szTmp);

    FormatString(IDS_ON,szTmp,sizeof(szTmp));
	pCycle->AddString(szTmp);

	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	if (pProfile && !g_pVersionMgr->IsLowViolence())
	{
		CLTGUIToggle *pGore = AddToggle(IDS_DISPLAY_GORE,IDS_HELP_GORE,kGap,&m_bGore);
	}

	char szYes[16];
	char szNo[16];
	FormatString(IDS_YES,szYes,sizeof(szYes));
	FormatString(IDS_NO,szNo,sizeof(szNo));

	//always run
	CLTGUIToggle* pToggle = AddToggle(IDS_ADVCONTROLS_RUNLOCK, IDS_HELP_RUNLOCK, kGap, &m_bAlwaysRun );
	pToggle->SetOnString(szYes);
	pToggle->SetOffString(szNo);

	// Add the Difficulty option
	m_pDifficultyCtrl = AddCycle(IDS_DIFFICULTY,IDS_HELP_DIFFICULTY,kGap,&m_nDifficulty);

    FormatString(IDS_NEW_EASY,szTmp,sizeof(szTmp));
	m_pDifficultyCtrl->AddString(szTmp);
	
	FormatString(IDS_NEW_MEDIUM,szTmp,sizeof(szTmp));
	m_pDifficultyCtrl->AddString(szTmp);
	
	FormatString(IDS_NEW_HARD,szTmp,sizeof(szTmp));
	m_pDifficultyCtrl->AddString(szTmp);

	FormatString(IDS_NEW_INSANE,szTmp,sizeof(szTmp));
	m_pDifficultyCtrl->AddString(szTmp);
/*
	pCycle = AddCycle(IDS_HUDLAYOUT,IDS_HELP_HUDLAYOUT,kGap,&m_nLayout);
	for (int hl = 0; hl < g_pLayoutMgr->GetNumHUDLayouts(); hl++)
	{
		char szTmpBuffer[128];
		FormatString(g_pLayoutMgr->GetLayoutName(hl),szTmpBuffer,sizeof(szTmpBuffer));
		pCycle->AddString(szTmpBuffer);
	}
*/

	CLTGUISlider *pSlider=AddSlider(IDS_HEADBOB, IDS_HELP_HEADBOB, kGap, kWidth, -1, &m_nHeadBob);
	pSlider->SetSliderRange(0, 10);
	pSlider->SetSliderIncrement(1);

	pSlider=AddSlider(IDS_WEAPONSWAY, IDS_HELP_WEAPONSWAY, kGap, kWidth, -1, &m_nWeaponSway);
	pSlider->SetSliderRange(0, 10);
	pSlider->SetSliderIncrement(1);

	pSlider=AddSlider(IDS_PICKUP_MSG_DUR, IDS_HELP_PICKUP_MSG_DUR, kGap, kWidth, -1, &m_nMsgDur);
	pSlider->SetSliderRange(1, 10);
	pSlider->SetSliderIncrement(1);

	pToggle = AddToggle(IDS_AUTOSWITCH_WEAPONS, IDS_HELP_AUTOSWITCH_WEAPONS, kGap, &m_bAutoWeaponSwitch );
	pToggle->SetOnString(szYes);
	pToggle->SetOffString(szNo);

	pToggle = AddToggle(IDS_LOAD_TIPS, IDS_HELP_LOAD_TIPS, kGap, &m_bLoadScreenTips );
	pToggle->SetOnString(LoadTempString(IDS_ON));
	pToggle->SetOffString(LoadTempString(IDS_OFF));

	pToggle = AddToggle(IDS_CONTOUR, IDS_HELP_CONTOUR, kGap, &m_bVehicleContour );
	pToggle->SetOnString(LoadTempString(IDS_ON));
	pToggle->SetOffString(LoadTempString(IDS_OFF));

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

	UseBack(LTTRUE,LTTRUE);
	return LTTRUE;
}
Пример #30
0
void CScreenMulti::RequestValidate()
{
	IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir();
	// Load the default CD key
	pServerDir->GetCDKey(&m_sCurCDKey);
	if (!pServerDir->SetCDKey(m_sCurCDKey.c_str()))
		m_sCurCDKey = "";	
	
	m_pCDKeyCtrl->SetString(1,m_sCurCDKey.c_str());

	if (m_sCurCDKey.empty())
	{
		m_pJoin->Enable(LTFALSE);
		m_pHost->Enable(LTFALSE);
		m_eCurState = eState_NoCDKey;

		MBCreate mb;
		g_pInterfaceMgr->ShowMessageBox(IDS_NO_CDKEY,&mb);

		return;

	}

	if( pServerDir->IsCDKeyValid( ))
	{
		if (m_sSysMOTD.empty() ||  m_sGameMOTD.empty())
			RequestMOTD();
		else
		{
			m_pJoin->Enable(LTTRUE);
			m_pHost->Enable(LTTRUE);
			m_eCurState = eState_Ready;
		}
		return;
	};

	m_pJoin->Enable(LTFALSE);
	m_pHost->Enable(LTFALSE);
	bool bResult = true;
	
	bResult &= pServerDir->QueueRequest(IServerDirectory::eRequest_Validate_CDKey);
	if (bResult)
	{
		g_pLTClient->CPrint( "QueueRequest(IServerDirectory::eRequest_Validate_CDKey)");
		m_eCurState = eState_ValidateCDKey;
		m_pWaitText->SetString(LoadTempString(IDS_VALIDATING));
		m_pWait->Show(LTTRUE);
		SetCapture(m_pWait);

	}
	else
	{
		g_pLTClient->CPrint( "QueueRequest(IServerDirectory::eRequest_Validate_CDKey) : FAILED");
		if (m_pScreenMgr->GetLastScreenID() == SCREEN_ID_MAIN)
		{
			MBCreate mb;
			g_pInterfaceMgr->ShowMessageBox(IDS_CDKEY_INVALID,&mb);

		}
		m_pWait->Show(LTFALSE);
		if (GetCapture() == m_pWait)
			SetCapture(NULL);
		m_eCurState = eState_NoCDKey;
	}
}