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; }
bool CScreenDisplay::OnRight() { if (!CBaseScreen::OnRight()) return false; CLTGUICtrl* pCtrl = GetSelectedControl(); if (pCtrl == m_pGamma) { pCtrl->UpdateData(); float fGamma = ConvertToGamma(m_nGamma); WriteConsoleFloat("GammaR",fGamma); WriteConsoleFloat("GammaG",fGamma); WriteConsoleFloat("GammaB",fGamma); } return true; }
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); }
bool CScreenDisplay::OnRButtonUp(int x, int y) { uint16 nControlIndex=0; if (GetControlUnderPoint(x, y, &nControlIndex)) { CLTGUICtrl* pCtrl = GetControl(nControlIndex); if (pCtrl == m_pGamma) { if (!pCtrl->OnRButtonUp(x,y)) return false; pCtrl->UpdateData(); float fGamma = ConvertToGamma(m_nGamma); WriteConsoleFloat("GammaR",fGamma); WriteConsoleFloat("GammaG",fGamma); WriteConsoleFloat("GammaB",fGamma); return true; } } return CBaseScreen::OnRButtonUp(x, y); }
LTBOOL CScreenDisplay::OnRButtonUp(int x, int y) { uint16 nControlIndex=0; if (GetControlUnderPoint(x, y, &nControlIndex)) { CLTGUICtrl* pCtrl = GetControl(nControlIndex); if (pCtrl == m_pHardwareCursor) { return OnLeft(); } if (pCtrl == m_pGamma) { if (!pCtrl->OnRButtonUp(x,y)) return LTFALSE; pCtrl->UpdateData(); float fGamma = ConvertToGamma(m_nGamma); WriteConsoleFloat("GammaR",fGamma); WriteConsoleFloat("GammaG",fGamma); WriteConsoleFloat("GammaB",fGamma); return LTTRUE; } } return CBaseScreen::OnRButtonUp(x, y); }
//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"); }
// 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(); }