コード例 #1
0
// Change in focus
void    CFolderJoin::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		// Reset other values...
		bDblClick = LTFALSE;

		m_nNumServers       = 0;
		m_nNumServersListed = 0;
		m_nVersionFilter = (int)g_vtNetVersionFilter.GetFloat();
		m_nGameFilter = (int)g_vtNetGameFilter.GetFloat();
		m_nPopFilter = (int)g_vtNetPopFilter.GetFloat();
		m_nServerSort = (int)g_vtNetServerSortKey.GetFloat();
		m_nPlayerSort = (int)g_vtNetPlayerSortKey.GetFloat();

        bFrameDelay = LTTRUE;
		m_szPassword[0] = LTNULL;

		nOldIndex = -1;

		HSTRING hStr = g_pLTClient->FormatString(IDS_STATUS_CONNECTING);
		SetDummyStatusState(hStr, 500, FSS_GETSERVICES);
		g_pLTClient->FreeString(hStr);
		

        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		g_vtNetVersionFilter.WriteFloat((float)m_nVersionFilter);
		g_vtNetGameFilter.WriteFloat((float)m_nGameFilter);
		g_vtNetPopFilter.WriteFloat((float)m_nPopFilter);
		g_vtNetServerSortKey.WriteFloat((float)m_nServerSort);
		g_vtNetPlayerSortKey.WriteFloat((float)m_nPlayerSort);

		SetState(FSS_IDLE);
		GetGameSpyClientMgr()->Term();
        bFrameDelay = LTTRUE;
		m_pServerList->RemoveAllControls();
		m_pPlayerList->RemoveAllControls();
		m_pOptionList->RemoveAllControls();
        SetCurGameServerHandle(LTNULL);

	}
	CBaseFolder::OnFocus(bFocus);
}
コード例 #2
0
void CFolderGame::OnFocus(LTBOOL bFocus)
{
	CGameSettings *pSettings = g_pInterfaceMgr->GetSettings();
	if (bFocus)
	{
	
		m_bGore = pSettings->Gore();
		m_nDifficulty = g_pGameClientShell->GetDifficulty();
		m_bFadeBodies = g_pGameClientShell->GetFadeBodies();
		m_nSubtitles = (int)g_vtSubtitles.GetFloat();
		m_bAlwaysRun = pSettings->RunLock();

		m_nLayout = (int)g_vtHUDLayout.GetFloat();

		m_nHeadBob = (int)(10.0f * GetConsoleFloat("HeadBob",1.0f));
		m_nWeaponSway = (int)(10.0f * GetConsoleFloat("WeaponSway",1.0f));
		m_nPickupMsgDur = (int)(2.0f * GetConsoleFloat("PickupMessageDuration",5.0f));
		m_bObjMessages = ( GetConsoleInt("ObjectiveMessages",1) > 0 );

        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		pSettings->SetBoolVar("Gore",m_bGore);
		g_vtSubtitles.WriteFloat((LTFLOAT)m_nSubtitles);
		g_vtHUDLayout.WriteFloat((LTFLOAT)m_nLayout);
		WriteConsoleInt("Difficulty",m_nDifficulty);
		g_pGameClientShell->SetDifficulty((GameDifficulty)m_nDifficulty);
		WriteConsoleInt("FadeBodies",(int)m_bFadeBodies);
		g_pGameClientShell->SetFadeBodies(m_bFadeBodies);
		pSettings->SetBoolVar("RunLock",m_bAlwaysRun);

		WriteConsoleFloat("HeadBob",((LTFLOAT)m_nHeadBob / 10.0f));
		WriteConsoleFloat("WeaponSway",((LTFLOAT)m_nWeaponSway / 10.0f));
		WriteConsoleFloat("PickupMessageDuration",((LTFLOAT)m_nPickupMsgDur / 2.0f));
		WriteConsoleInt("ObjectiveMessages",m_bObjMessages);

		g_pLTClient->WriteConfigFile("autoexec.cfg");


	}
	CBaseFolder::OnFocus(bFocus);
}
コード例 #3
0
ファイル: FolderPlayer.cpp プロジェクト: Arc0re/lithtech
// Change in focus
void    CFolderPlayer::OnFocus(LTBOOL bFocus)
{

	if (bFocus)
	{
		m_bRestoreSkinHead = LTTRUE;

		m_nModNum = -1;
		m_nSkinNum = 0;
		m_nHeadNum = 0;

		int nUpdateRate = GetConsoleInt("UpdateRate",10);
		m_nConnect = 3;
		while (m_nConnect && nUpdateRate < kConnectSpeeds[m_nConnect])
			m_nConnect--;

		nInitConnect = m_nConnect;

		SAFE_STRCPY(m_szPlayerModel,g_vtPlayerModel.GetStr() );
		GetConsoleString("NetPlayerSkin",m_szPlayerSkin,"");
		GetConsoleString("NetPlayerHead",m_szPlayerHead,"");

		if ( !m_szPlayerSkin[0] || !m_szPlayerHead[0] )
		{
			char szTemp[512];
			strcpy(szTemp, m_szPlayerModel);
			if ( strchr(szTemp, ',') )
			{
				*strchr(szTemp, ',') = '_';
				_strlwr(szTemp);
				strcpy(m_szPlayerSkin, g_pModelButeMgr->GetButeMgr()->GetString(szTemp, "Skin0"));
				strcpy(m_szPlayerHead, g_pModelButeMgr->GetButeMgr()->GetString(szTemp, "Head0"));
			} 
		}

		BuildModelList();
		SAFE_STRCPY(m_szPlayerName,g_vtPlayerName.GetStr() );

		if (m_nModNum < 0)
		{
			m_nModNum = 0;
			HSTRING hStr = m_pModelCtrl->GetString(0);
            strcpy(m_szPlayerModel,g_pLTClient->GetStringData(hStr));

		}

		m_nTeam = (int)g_vtPlayerTeam.GetFloat();
		m_nTargetNameSize = (int)g_vtTargetNameSize.GetFloat();
		m_nTargetNameTransparency = (int)(100.0f*g_vtTargetNameTransparency.GetFloat());
		m_bAutoSwitchWeapons =  (LTBOOL)GetConsoleInt("AutoWeaponSwitch",1);
		m_bAutoSwitchAmmo =  (LTBOOL)GetConsoleInt("AutoAmmoSwitch",1);
		m_bIgnoreTaunts =  (LTBOOL)GetConsoleInt("IgnoreTaunts",0);
	
        UpdateData(LTFALSE);
	}
	else
	{
		UpdateData();

		if (nInitConnect != m_nConnect)
		{
			WriteConsoleInt("UpdateRate",kConnectSpeeds[m_nConnect]);
		}

		LTBOOL bChanged = LTFALSE;
		char szTemp[32];
		SAFE_STRCPY(szTemp,g_vtPlayerModel.GetStr() );
		if (strcmp(szTemp,m_szPlayerModel) != 0)
			bChanged = LTTRUE;


		GetConsoleString("NetPlayerSkin",szTemp,"");
		if (strcmp(szTemp,m_szPlayerSkin) != 0)
			bChanged = LTTRUE;

		GetConsoleString("NetPlayerHead",szTemp,"");
		if (strcmp(szTemp,m_szPlayerHead) != 0)
			bChanged = LTTRUE;

		SAFE_STRCPY(szTemp,g_vtPlayerName.GetStr() );
		if (strcmp(szTemp,m_szPlayerName) != 0)
			bChanged = LTTRUE;

		if (m_nTeam != (int)g_vtPlayerTeam.GetFloat())
			bChanged = LTTRUE;

		g_vtPlayerName.SetStr(m_szPlayerName);
		g_vtPlayerModel.SetStr(m_szPlayerModel);
		WriteConsoleString("NetPlayerHead",m_szPlayerHead);
		WriteConsoleString("NetPlayerSkin",m_szPlayerSkin);
        g_vtPlayerTeam.WriteFloat((LTFLOAT)m_nTeam);
        g_vtTargetNameSize.WriteFloat((LTFLOAT)m_nTargetNameSize);
        g_vtTargetNameTransparency.WriteFloat((LTFLOAT)m_nTargetNameTransparency/100.0f);
		WriteConsoleInt("AutoWeaponSwitch",(int)m_bAutoSwitchWeapons);
		WriteConsoleInt("AutoAmmoSwitch",(int)m_bAutoSwitchAmmo);
		WriteConsoleInt("IgnoreTaunts",(int)m_bIgnoreTaunts);

        HLOCALOBJ hPlayerObj = g_pLTClient->GetClientObject();
		if (bChanged && g_pGameClientShell->IsInWorld() && hPlayerObj && g_pGameClientShell->IsMultiplayerGame())
		{
            HSTRING hstrName = g_pLTClient->CreateString(m_szPlayerName);
			if (!hstrName) return;
            HSTRING hstrModel = g_pLTClient->CreateString(m_szPlayerModel);
			if (!hstrModel) return;
            HSTRING hstrSkin = g_pLTClient->CreateString(strchr(m_szPlayerSkin, ',')+1);
			if (!hstrSkin) return;
            HSTRING hstrHead = g_pLTClient->CreateString(strchr(m_szPlayerHead, ',')+1);
			if (!hstrHead) return;

			// Init multiplayer info on server...

            HMESSAGEWRITE hWrite = g_pLTClient->StartMessage(MID_PLAYER_MULTIPLAYER_CHANGE);
            g_pLTClient->WriteToMessageHString(hWrite, hstrName);
            g_pLTClient->WriteToMessageHString(hWrite, hstrModel);
            g_pLTClient->WriteToMessageHString(hWrite, hstrSkin);
            g_pLTClient->WriteToMessageHString(hWrite, hstrHead);
            g_pLTClient->WriteToMessageByte(hWrite, (uint8)m_nTeam);
            g_pLTClient->EndMessage(hWrite);

			g_pLTClient->FreeString(hstrName);
			g_pLTClient->FreeString(hstrModel);
			g_pLTClient->FreeString(hstrSkin);
			g_pLTClient->FreeString(hstrHead);

			ClearModelList();
		}

		g_pLTClient->FreeUnusedModels();

        g_pLTClient->WriteConfigFile("autoexec.cfg");

	}
	CBaseFolder::OnFocus(bFocus);
}