Esempio n. 1
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;
	}
}
Esempio n. 2
0
void CScreenPreload::FirstUpdate( )
{
	int n = 0;
	char szTagName[30];
	char szAttName[30];
	char szFXName[128];

	m_bHaveLights = LTFALSE;


	HOBJECT hCamera = g_pInterfaceMgr->GetInterfaceCamera();
	if (!hCamera) return;

	// Check if we have a mission entry.
	bool bGotMission = false;
	if( !g_pMissionMgr->IsCustomLevel( ))
	{
		int nNewMission = g_pMissionMgr->GetNewMission( );
		int nNewLevel = g_pMissionMgr->GetNewLevel( );
		MISSION* pMission = g_pMissionButeMgr->GetMission( nNewMission );
		if( pMission )
		{
			int nBriefingId = pMission->aLevels[nNewLevel].nBriefingId;
			if( nBriefingId >= 0 && !g_pMissionMgr->IsRestoringLevel( ))
				m_layout = pMission->szBriefLayout;
			else
				m_layout = pMission->szLayout;

			bGotMission = true;
		}
	}

	// If we were unsuccessful in getting info from the mission, then just
	// use defaults.
	if( !bGotMission )
	{
		m_layout = "LoadScreenDefault";
	}



    g_pLTClient->GetObjectPos(hCamera, &s_vPos);
    g_pLTClient->GetObjectRotation(hCamera, &s_rRot);
	s_vU = s_rRot.Up();
	s_vR = s_rRot.Right();
	s_vF = s_rRot.Forward();


	SAFE_STRCPY(szTagName,m_layout.c_str());
	if (!g_pLayoutMgr->Exist(szTagName))
		SAFE_STRCPY(szTagName,"LoadScreenDefault");

	sprintf(szAttName,"Light%d",n);
	while (g_pLayoutMgr->HasValue(szTagName,szAttName))
	{
		g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128);
		if (strlen(szFXName))
		{
			CreateLightFX(szFXName);
		}

		n++;
		sprintf(szAttName,"Light%d",n);

	}


	n = 0;
	sprintf(szAttName,"PreScale%d",n);
	while (g_pLayoutMgr->HasValue(szTagName,szAttName))
	{
		g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128);
		if (strlen(szFXName))
		{
			CBaseScaleFX *pSFX = CreateScaleFX(szFXName);
		}

		n++;
		sprintf(szAttName,"PreScale%d",n);

	}

	

	n = 0;
	sprintf(szAttName,"PreFX%d",n);
	while (g_pLayoutMgr->HasValue(szTagName,szAttName))
	{
		g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128);
		if (strlen(szFXName))
		{
			INT_FX* pFX = g_pLayoutMgr->GetFX(szFXName);
			if (pFX)
			{
				g_pInterfaceMgr->AddInterfaceFX(LTNULL, pFX->szFXName,pFX->vPos,pFX->bLoop);
			}
		}

		
		n++;
		sprintf(szAttName,"PreFX%d",n);

	}

	ChainFXList::iterator iter = m_Chains.begin();
	while (iter != m_Chains.end())
	{
		debug_delete(*iter);
		iter++;
	}
	m_Chains.clear();

	char szIntroFXName[128] = "";
	char szShortFXName[128] = "";
	char szLoopFXName[128] = "";
	int nFXNum = 0;
	bool bFound = false;
	do
	{
		szIntroFXName[0] = 0;
		szShortFXName[0] = 0;
		szLoopFXName[0] = 0;
		bFound = false;

		sprintf(szAttName,"PreIntroFX%d",nFXNum);
		if (g_pLayoutMgr->HasValue(szTagName,szAttName))
		{
			g_pLayoutMgr->GetString(szTagName,szAttName,szIntroFXName,128);
		}
		sprintf(szAttName,"PreLoopFX%d",nFXNum);
		if (g_pLayoutMgr->HasValue(szTagName,szAttName))
		{
			g_pLayoutMgr->GetString(szTagName,szAttName,szLoopFXName,128);
		}
		if (strlen(szIntroFXName) || strlen(szShortFXName) ) //don't start loop-only chains || strlen(szLoopFXName))
		{
			nFXNum++;
			bFound = true;

			CChainedFX *pChain = debug_new(CChainedFX);
			pChain->Init(szIntroFXName,szShortFXName,szLoopFXName);
			m_Chains.push_back(pChain);
		}

	} while (bFound);


	// Start all the chains.
	iter = m_Chains.begin();
	while (iter != m_Chains.end())
	{
		(*iter)->Start(!!m_bVisited);
		iter++;
	}
	
	// If we are not joining a lan game and the cdkey hasn't been validated,
	// we need to do it now.
	m_eValidatingCDKeyState = kValidatingCDKeyState_None;
	if( !g_bLAN && g_pClientMultiplayerMgr->GetStartGameRequest( ).m_Type == STARTGAME_CLIENTTCP )
	{
		IServerDirectory *pServerDir = g_pClientMultiplayerMgr->GetServerDir();
		if( !pServerDir || !pServerDir->IsCDKeyValid( ))
		{
			m_eValidatingCDKeyState = kValidatingCDKeyState_Start;
		}
	}
}