示例#1
0
void CCheatMgr::SetConsole( bool bMode )
{
	s_CheatInfo[CHEAT_CONSOLE].bActive = bMode;

	WriteConsoleInt( "ConsoleEnable", bMode ? 1 : 0 );

}
示例#2
0
LTBOOL CScreenDisplay::OnRight()
{
	if (!CBaseScreen::OnRight()) return LTFALSE;
	CLTGUICtrl* pCtrl = GetSelectedControl();
	if (pCtrl == m_pHardwareCursor)
	{
		m_pHardwareCursor->UpdateData(LTTRUE);
		if (m_bHardwareCursor)
		{
			MBCreate mb;
			mb.eType = LTMB_YESNO;
			mb.pFn = AreYouSureCallBack;
			mb.pData = this;
			g_pInterfaceMgr->ShowMessageBox(IDS_CONFIRM_CURSOR,&mb,0,LTFALSE);
		}
		else
		{
			g_pCursorMgr->UseHardwareCursor(LTFALSE);
			WriteConsoleInt("HardwareCursor",0);
		}
	}
	if (pCtrl == m_pGamma)
	{
		pCtrl->UpdateData();
		float fGamma = ConvertToGamma(m_nGamma);
		WriteConsoleFloat("GammaR",fGamma);
		WriteConsoleFloat("GammaG",fGamma);
		WriteConsoleFloat("GammaB",fGamma);
	}
	return LTTRUE;
}
示例#3
0
void CScreenDisplay::ConfirmHardwareCursor(bool bReturn)
{
	UpdateData(true);
	m_bHardwareCursor = bReturn;
	g_pCursorMgr->UseHardwareCursor(m_bHardwareCursor);
	WriteConsoleInt("HardwareCursor",(int)m_bHardwareCursor);
	UpdateData(false);
}
示例#4
0
void CScreenDisplay::ConfirmHardwareCursor(LTBOOL bReturn)
{
	UpdateData(LTTRUE);
	m_bHardwareCursor = bReturn;
	g_pCursorMgr->UseHardwareCursor(m_bHardwareCursor);
	WriteConsoleInt("HardwareCursor",(int)m_bHardwareCursor);
	UpdateData(LTFALSE);
}
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);
}
void CFolderHostLevels::SaveLevelList(CListCtrl *pList)
{
	// Sanity checks...

	if (!pList) return;


	// Write out the level count...
	int cLevels = pList->GetNum();

	if (m_nGameType == COOPERATIVE_ASSAULT)
	{
		WriteConsoleInt("NetCANumLevels", cLevels);
	}
	else
	{
		WriteConsoleInt("NetNumLevels", cLevels);
	}


	// Write out each level...

	for (int i = 0; i < cLevels; i++)
	{
		char sLabel[32];
		if (m_nGameType == COOPERATIVE_ASSAULT)
		{
			wsprintf(sLabel, "NetCALevel%i", i);
		}
		else
		{
			wsprintf(sLabel, "NetLevel%i", i);
		}
		CStaticTextCtrl *pCtrl = (CStaticTextCtrl *)pList->GetControl(i);
		HSTRING hText = pCtrl->GetString();
        char *pTemp = g_pLTClient->GetStringData(hText);
		char sLevel[256] = "";
		sprintf(sLevel,"%s\\%s",szPath,pTemp);

		WriteConsoleString(sLabel, sLevel);
	}
}
void CFolderEffects::OnFocus(LTBOOL bFocus)
{

	
	if (bFocus)
	{
		m_bTracers = (LTBOOL)GetConsoleInt("Tracers",1);
		m_bShellCasings = (LTBOOL)GetConsoleInt("ShellCasings",1);
		m_bMuzzleLight = (LTBOOL)GetConsoleInt("MuzzleLight",1);
		m_bWeather = (LTBOOL)GetConsoleInt("EnableWeatherFX",1);
		m_nImpact = GetConsoleInt("ImpactFXLevel",2);
		m_nDebris = GetConsoleInt("DebrisFXLevel",2);
		UpdateData(LTFALSE);
	}
	else
	{
        UpdateData(LTTRUE);
		WriteConsoleInt("Tracers",(int)m_bTracers);
		WriteConsoleInt("ShellCasings",(int)m_bShellCasings);
		WriteConsoleInt("MuzzleLight",(int)m_bMuzzleLight);
		WriteConsoleInt("EnableWeatherFX",(int)m_bWeather);
		WriteConsoleInt("ImpactFXLevel",m_nImpact);
		WriteConsoleInt("DebrisFXLevel",m_nDebris);

	}
	CBaseFolder::OnFocus(bFocus);
}
示例#8
0
// Save the sound settings
void CScreenAudio::SaveSoundSettings()
{
    UpdateData(LTTRUE);

	CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();
	pProfile->m_nSoundVolume = m_nSoundVolume;
	pProfile->m_nMusicVolume = m_nMusicVolume;

	WriteConsoleInt("MusicActive", (m_nMusicVolume > MUSIC_MIN_VOL) && m_bMusicEnabled);
	pProfile->m_fSpeechSoundMultiplier = m_nSpeechVolume / 100.0f;
	pProfile->m_bSoundQuality = m_bSoundQuality;
	pProfile->m_bMusicQuality = m_bMusicQuality;

	pProfile->ApplySound();
}
示例#9
0
LTBOOL CLoadingScreen::Show(LTBOOL bRun)
{
	if (bRun && !GetConsoleInt("DynamicLoadScreen",1))
		bRun = LTFALSE;
	// Make sure we're in the correct state
	if (m_eCurState == STATE_NONE)
	{
		if (!Init())
			return LTFALSE;
	}

	if (m_eCurState != STATE_INIT)
		return LTFALSE;

	// Turn off the cursor
	g_pCursorMgr->UseCursor(LTFALSE);
	
	// Set up the FarZ & turn off fog (farz of 0 is bogus)

	m_nOldFarZ = GetConsoleInt("FarZ", 10000);
	m_nOldFarZ = m_nOldFarZ == 0 ? 10000 : m_nOldFarZ;

	m_bOldFogEnable = (LTBOOL) GetConsoleInt("FogEnable", 0);

	g_pGameClientShell->SetFarZ(10000);
	WriteConsoleInt("FogEnable", 0);

	// Make sure we're not in optimized 2D mode (happens sometimes...)
	g_pLTClient->EndOptimized2D();

	
	// Go into the right state..
	m_eCurState = STATE_SHOW;

	// Update once so the screen's showing
	Update();

	// Start updating if they wanted it to..
	if (bRun)
		return Resume();

	// Ok, it's visible or active
	return LTTRUE;
}
LTBOOL CFolderDisplay::OnRight()
{
	if (!CBaseFolder::OnRight()) return LTFALSE;
	if (GetSelectedControl() == m_pHardwareCursor)
	{
		m_pHardwareCursor->UpdateData(LTTRUE);
		if (m_bHardwareCursor)
		{
			HSTRING hString = g_pLTClient->FormatString(IDS_CONFIRM_CURSOR);
			g_pInterfaceMgr->ShowMessageBox(hString,LTMB_YESNO,AreYouSureCallBack,this,LTFALSE,LTFALSE);
			g_pLTClient->FreeString(hString);
		}
		else
		{
			g_pInterfaceMgr->UseHardwareCursor(LTFALSE);
			WriteConsoleInt("HardwareCursor",0);
		}
	}
	return LTTRUE;
}
示例#11
0
LTBOOL CLoadingScreen::Hide()
{
	// Ensure our state
	if (m_eCurState == STATE_ACTIVE)
	{
		// Stop!!!
		if (!Pause())
			return LTFALSE;
	}

	if (m_eCurState != STATE_SHOW)
		return LTFALSE;

	// Clear the screen
//	g_pInterfaceMgr->ClearAllScreenBuffers();

	// Change state
	m_eCurState = STATE_INIT;

	// Clean up
	Term();

	// Re-set the console...
	g_pGameClientShell->SetFarZ(m_nOldFarZ);
	WriteConsoleInt("FogEnable", (int)m_bOldFogEnable);

	// Let the render screen know it's going away...

	if( m_pRenderScreen )
	{
		// Don't lose focus until after setting the state to init...
		
		m_pRenderScreen->OnFocus( LTFALSE );
		m_pRenderScreen = LTNULL;
	}

	// Done!
	return LTTRUE;
}
示例#12
0
bool CLoadingScreen::Hide()
{
	// Ensure our state
	if (m_eCurState == STATE_ACTIVE)
	{
		// Stop!!!
		if (!Pause())
			return false;
	}

	if (m_eCurState != STATE_SHOW)
		return false;

	// Change state
	m_eCurState = STATE_INIT;

	// Clean up
	Term();

	// Re-set the console...
	g_pGameClientShell->SetFarZ(m_nOldFarZ);
	WriteConsoleInt("FogEnable", (int)m_bOldFogEnable);

	// Let the render screen know it's going away...

	if( m_pRenderScreen )
	{
		// Don't lose focus until after setting the state to init...
		
		m_pRenderScreen->OnFocus( false );
		m_pRenderScreen = NULL;
	}

	// Done!
	return true;
}
示例#13
0
bool CLoadingScreen::Show(bool bNew)
{

	// Make sure we're in the correct state
	if (m_eCurState == STATE_NONE)
	{
		if (!Init())
			return false;
	}

	if (m_eCurState != STATE_INIT)
		return false;


	// Turn off the cursor
	g_pCursorMgr->UseCursor(false);

	// Set up the FarZ & turn off fog (farz of 0 is bogus)

	m_nOldFarZ = GetConsoleInt("FarZ", 10000);
	m_nOldFarZ = m_nOldFarZ == 0 ? 10000 : m_nOldFarZ;

	m_bOldFogEnable = !!GetConsoleInt("FogEnable", 0);

	g_pGameClientShell->SetFarZ(10000);
	WriteConsoleInt("FogEnable", 0);

	// Go into the right state..
	m_eCurState = STATE_SHOW;

	// Update once so the screen's showing
	Update();

	// Start updating if they wanted it to..
	return Resume();
}
示例#14
0
void CFolderAdvDisplay::OnFocus(LTBOOL bFocus)
{
	uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions();
	g_bFocus = LTFALSE;
	LTBOOL bAllowMirrors = (GetConsoleInt("BitDepth",16) == 32);
	if (bFocus)
	{
		

		m_pMirrors->Enable(bAllowMirrors);

        m_bLightMap = (GetConsoleInt("LightMap",0) > 0);
		if (bAllowMirrors)
	        m_bMirrors = (GetConsoleInt("DrawPortals",0) > 0);
		else
			m_bMirrors = LTFALSE;
        m_bDetailTextures = (GetConsoleInt("DetailTextures",0) > 0);
        m_bEnvMapWorld = (GetConsoleInt("EnvMapWorld",0) > 0);
        m_bEnvMapEnable = (GetConsoleInt("EnvMapEnable",0) > 0);
        m_bTripleBuffer = (GetConsoleInt("TripleBuffer",0) > 0) && (dwAdvancedOptions & AO_TRIPLEBUFFER);
        m_bFixSparkleys = (GetConsoleInt("FixSparkleys",0) > 0);
        m_bTrilinear = (GetConsoleInt("Trilinear",0) > 0);

		m_nShadows = 0;
		if (GetConsoleInt("DrawShadows",0) > 0)
		{
			m_nShadows++;
			if (GetConsoleInt("ModelShadowProj",0) > 0) m_nShadows++;
		}

        UpdateData(LTFALSE);
		g_bFocus = LTTRUE;

	}
	else
	{
        UpdateData(LTTRUE);

		LTBOOL bOldTB = (GetConsoleInt("TripleBuffer",0) > 0);

		WriteConsoleInt("LightMap",m_bLightMap);
		if (bAllowMirrors)
			WriteConsoleInt("DrawPortals",m_bMirrors);
		WriteConsoleInt("DetailTextures",m_bDetailTextures);
		WriteConsoleInt("EnvMapWorld",m_bEnvMapWorld);
		WriteConsoleInt("EnvMapEnable",m_bEnvMapEnable);
		WriteConsoleInt("TripleBuffer",m_bTripleBuffer && (dwAdvancedOptions & AO_TRIPLEBUFFER));
		WriteConsoleInt("FixSparkleys",m_bFixSparkleys);
		WriteConsoleInt("Trilinear",m_bTrilinear);

		WriteConsoleInt("DrawShadows",(m_nShadows > 0) );
		WriteConsoleInt("MaxModelShadows",(m_nShadows > 0) );
		WriteConsoleInt("ModelShadowProj",(m_nShadows > 1) );

		if (bOldTB != m_bTripleBuffer)
		{
			// Set the renderer mode
			g_pInterfaceMgr->SetSwitchingRenderModes(LTTRUE);
			g_pLTClient->RunConsoleString("RestartRender");
			g_pInterfaceMgr->SetSwitchingRenderModes(LTFALSE);

		}

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

	}
	CBaseFolder::OnFocus(bFocus);
}
示例#15
0
//sets current options from given cfg
void CPerformanceMgr::SetPerformanceOptions(sPerformCfg *pCfg, int nCfg)
{
	for (int i = 0; i < kNumDetailSettings; i++)
	{
		WriteConsoleInt(sSettings[i].szVar,pCfg->nSettings[i]);
	}

	uint32 dwAdvancedOptions = g_pInterfaceMgr->GetAdvancedOptions();
	//disable triple buffer 
	if ( !(dwAdvancedOptions & AO_TRIPLEBUFFER))
	{
		
	}
	if (nCfg == 2 && kPerform_TripleBuffering)
	{
		//for high detail, the triple buffering default value depends on the VSyncOnFlip setting
		int vsync = !!GetConsoleInt("VSyncOnFlip",1);
		WriteConsoleInt(sSettings[kPerform_TripleBuffering].szVar,vsync+1);
	}


	//disable music
	if ( !(dwAdvancedOptions & AO_MUSIC))
	{
		WriteConsoleInt(sSettings[kPerform_MusicActive].szVar,0);
	}

	if (pCfg->nSettings[kPerform_MusicActive] == 0)
	{
		WriteConsoleInt("musicvolume",MUSIC_MIN_VOL);
	}

	if (pCfg->nSettings[kPerform_ShadowDetail] <= 0)
	{
		//turn off shadows if appropriate
		WriteConsoleInt("ModelShadow_Proj_Enable",   0 );
	}
	else
	{
		WriteConsoleInt("ModelShadow_Proj_Enable",   1 );
		int8 nDetail = pCfg->nSettings[kPerform_ShadowDetail] - 1;
		for (int sub = 0; sub < kNumShadowDetails; sub++)
		{
			WriteConsoleInt(sShadowDetails[sub].szVar,sShadowDetails[sub].nSetting[nDetail]);
		}

	}

	uint8 nDetail = pCfg->nSettings[kPerform_FXDetail];
	for (int sub = 0; sub < kNumFXDetails; sub++)
	{
		WriteConsoleInt(sFXDetails[sub].szVar,sFXDetails[sub].nSetting[nDetail]);
	}

	// Set the fx detail setting here (it is set in the loop above) so we know it is 
	// always correct...
	g_pGameClientShell->GetClientFXMgr()->SetDetailLevel( GetConsoleInt("ClientFXDetailLevel", 0) );


	switch (pCfg->nSettings[kPerform_EnvironmentalDetail])
	{
	case 0: //off
		WriteConsoleInt("ScatterEnable",  0 );
		WriteConsoleInt("SnowEnable",  0 );
		break;
	case 1: //low
		WriteConsoleInt("ScatterEnable",  0 );
		WriteConsoleInt("SnowEnable",  1 );
		WriteConsoleFloat("SnowDensityScale",  0.25f );
		break;
	case 2: //medium
		WriteConsoleInt("ScatterEnable",  1 );
		WriteConsoleInt("SnowEnable",  1 );
		WriteConsoleFloat("SnowDensityScale",  0.5f );
		break;
	case 3: //high
		WriteConsoleInt("ScatterEnable",  1 );
		WriteConsoleInt("SnowEnable",  1 );
		WriteConsoleFloat("SnowDensityScale",  1.0f );
		break;
	}
	
	

	nDetail = pCfg->nSettings[kPerform_DetailLevel];
	if ( nDetail >= 0 && nDetail < kNumDetailLevels)
	{
		for (int grp = 0; grp < kNumTextureGroups; grp++)
		{
			WriteConsoleInt(sTextureGroups[grp].szVar,sTextureGroups[grp].nSetting[nDetail]);
		}
	}
	else
	{
		for (int grp = 0; grp < kNumTextureGroups; grp++)
		{
			WriteConsoleInt(sTextureGroups[grp].szVar,pCfg->nDetails[grp]);
		}
	}

	if (nCfg < 0)
		nCfg = GetPerformanceCfg(false);

	if (nCfg < 0 || (uint32)nCfg >= m_ConfigList.size())
	{
		WriteConsoleString("PerformanceConfig",".CustomConfig");
	}
	else
	{
		sPerformCfg *pPresetCfg = m_ConfigList[nCfg];
		WriteConsoleString("PerformanceConfig",pPresetCfg->szName);
	}

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

}
示例#16
0
// 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);
}
// Called when the folder gains or focus
void CFolderDisplay::OnFocus(LTBOOL bFocus)
{
	CGameSettings *pSettings = g_pInterfaceMgr->GetSettings();

	if (bFocus)
	{
		m_bEscape = LTFALSE;

		m_bHardwareCursor = (GetConsoleInt("HardwareCursor",0) > 0 && GetConsoleInt("DisableHardwareCursor",0) == 0);
		m_pHardwareCursor->Enable(GetConsoleInt("DisableHardwareCursor",0) == 0);

		// The current render mode
		RMode currentMode;
		g_pLTClient->GetRenderMode(&currentMode);

		// Set the renderer controls so that they match the currently selected renderer
		unsigned int n;
		for (n=0; n < m_rendererArray.GetSize(); n++)
		{
			unsigned int i;
			for (i=0; i < m_rendererArray[n].m_resolutionArray.GetSize(); i++)
			{
				RMode mode=GetRendererModeStruct(n, i);

				if (IsRendererEqual(&currentMode, &mode))
				{
					// Set the renderer index
					m_pRendererCtrl->SetSelIndex(n);

					// Setup the resolution control
					SetupResolutionCtrl();

					// Set the resolution index
					m_pResolutionCtrl->SetSelIndex(i);
				}
			}
		}
		m_bTexture32 = pSettings->GetBoolVar("32BitTextures");
	

        UpdateData(LTFALSE);
		SetSelection(1);

	}
	else
	{
		UpdateData();


		if (m_bEscape)
		{
			LTBOOL bTexture32 = pSettings->GetBoolVar("32BitTextures");

			WriteConsoleInt("HardwareCursor",(int)m_bHardwareCursor);

			pSettings->SetBoolVar("32BitTextures",m_bTexture32);


			LTBOOL bRebind = (bTexture32 != m_bTexture32);

			// Set the render mode if we are losing focus
			if (m_pRendererCtrl && m_pResolutionCtrl)
			{

				int oldMO = (int)pSettings->GetFloatVar("MipmapOffset");

				LTBOOL bSet = SetRenderer(m_pRendererCtrl->GetSelIndex(), m_pResolutionCtrl->GetSelIndex());

				// If we didn't switch resolutions and the mipmap offset changed, rebind textures.
				if(!bSet)
				{
					int curMO = (int)pSettings->GetFloatVar("MipmapOffset");
					if(curMO != oldMO)
					{
						bRebind = LTTRUE;
					}
				}
			}
			if (bRebind)
			{

                g_pLTClient->Start3D();
                g_pLTClient->StartOptimized2D();

				g_pInterfaceResMgr->DrawMessage(GetSmallFont(),IDS_REBINDING_TEXTURES);

                g_pLTClient->EndOptimized2D();
                g_pLTClient->End3D();
                g_pLTClient->FlipScreen(0);
				g_pLTClient->RunConsoleString("RebindTextures");

			}
				
		}

		if (GetConsoleInt("BitDepth",16) == 16)
			WriteConsoleInt("DrawPortals",0);
		else if ((GetConsoleInt("BitDepth",16) == 32) && (GetConsoleInt("PerformanceLevel",1) == 2))
			WriteConsoleInt("DrawPortals",1);

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


	}
	CBaseFolder::OnFocus(bFocus);
}
// Change in focus
void CFolderWeaponControls::OnFocus(LTBOOL bFocus)
{
	if (bFocus)
	{
		nLastId = WMGR_INVALID_ID;
		ReadBindings();		
		CLTGUIColumnTextCtrl *pCtrl=AddColumnText(LTNULL, LTNULL, LTTRUE, GetMediumFont());

		HSTRING hText = g_pLTClient->FormatString(IDS_KEY);
		pCtrl->AddColumn(hText, 50, LTF_JUSTIFY_LEFT);
		g_pLTClient->FreeString(hText);

		hText = g_pLTClient->FormatString(IDS_WEAPON);
		pCtrl->AddColumn(hText, kWidth, LTF_JUSTIFY_LEFT);
		pCtrl->Enable(LTFALSE);
		g_pLTClient->FreeString(hText);

//		AddBlankLine();


		for (int i = 0; i < 10; i++)
		{
			pCtrl=AddColumnText(LTNULL, IDS_HELP_SETWEAPON, LTFALSE, GetSmallFont());
			pCtrl->SetParam1(i+1);

			char str[16];
			sprintf(str,"  %s",szTriggers[i]);
			hText = g_pLTClient->CreateString(str);
			pCtrl->AddColumn(hText, 50, LTF_JUSTIFY_LEFT);
			g_pLTClient->FreeString(hText);

			int nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[i]);
			WEAPON *pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
			if (pWeapon)
				pCtrl->AddColumn(pWeapon->nNameId, kWidth, LTF_JUSTIFY_LEFT);
			else
				pCtrl->AddColumn(IDS_CONTROL_UNASSIGNED, kWidth, LTF_JUSTIFY_LEFT);


		}

		AddBlankLine();

		m_bLargeIcon = (GetConsoleInt("BindingIconSize",0) > 0);
		CToggleCtrl *pToggle = AddToggle(IDS_WPN_ICON_SZ,IDS_HELP_WPN_ICON_SZ, kWidth, &m_bLargeIcon,LTFALSE,GetSmallFont());
		pToggle->SetOnString(IDS_LARGE);
		pToggle->SetOffString(IDS_SMALL);

		m_nIconAlpha = (int)(GetConsoleFloat("BindingIconAlpha",0.7f) * 10.0f);
		CSliderCtrl *pSlider = AddSlider(IDS_WPN_ICON_A,IDS_HELP_WPN_ICON_A,kWidth,kSlider,&m_nIconAlpha,LTFALSE,GetSmallFont());
		pSlider->SetSliderIncrement(1);
		pSlider->SetSliderRange(0,10);

		m_bUseNumbers = (GetConsoleInt("BindingNumbers",1) > 0);
		pToggle = AddToggle(IDS_WPN_USE_NUMS,IDS_HELP_WPN_USE_NUMS, kWidth, &m_bUseNumbers,LTFALSE,GetSmallFont());
		pToggle->SetOnString(IDS_YES);
		pToggle->SetOffString(IDS_NO);


        UpdateData(LTFALSE);

	}
	else
	{
		UpdateData();

		WriteConsoleInt("BindingIconSize",m_bLargeIcon);
		WriteConsoleInt("BindingNumbers",m_bUseNumbers);
		WriteConsoleFloat("BindingIconAlpha",((LTFLOAT)m_nIconAlpha) / 10.0f);
		WriteBindings();

		g_pInterfaceMgr->GetPlayerStats()->UpdateWeaponBindings();

		// Just to be safe save the config incase anything changed...
        g_pLTClient->WriteConfigFile("autoexec.cfg");
		RemoveFree();

	}
	CBaseFolder::OnFocus(bFocus);
	if (bFocus) UpdateSelection();

}