void COptionsManager::OnElementFound(ICVar *pCVar) { if(pCVar) { CFlashMenuScreen *pMainMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDSTART)); CFlashMenuScreen *pInGameMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDINGAME)); CFlashMenuScreen *pCurrentMenu = NULL; if(pMainMenu && pMainMenu->IsLoaded()) pCurrentMenu = pMainMenu; else if(pInGameMenu && pInGameMenu->IsLoaded()) pCurrentMenu = pInGameMenu; else return; const char* name = pCVar->GetName(); const char* value = pCVar->GetString(); bool bIsValid = true; if(pCVar) bIsValid = pCVar->GetIVal()==pCVar->GetRealIVal(); SFlashVarValue option[3] = {name, value, bIsValid}; pCurrentMenu->Invoke("Root.MainMenu.Options.SetOption", option, 3); } }
CFlashMenuScreen *COptionsManager::GetCurrentMenu() { CFlashMenuScreen *pMainMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDSTART)); CFlashMenuScreen *pInGameMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDINGAME)); CFlashMenuScreen *pCurrentMenu = NULL; if(pMainMenu && pMainMenu->IsLoaded()) pCurrentMenu = pMainMenu; else if(pInGameMenu && pInGameMenu->IsLoaded()) pCurrentMenu = pInGameMenu; return pCurrentMenu; }
void COptionsManager::UpdateFlashOptions() { std::map<string,SOptionEntry>::const_iterator it = m_profileOptions.begin(); std::map<string,SOptionEntry>::const_iterator end = m_profileOptions.end(); CFlashMenuScreen *pMainMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDSTART)); CFlashMenuScreen *pInGameMenu = SAFE_MENU_FUNC_RET(GetMenuScreen(CFlashMenuObject::MENUSCREEN_FRONTENDINGAME)); CFlashMenuScreen *pCurrentMenu = NULL; if(pMainMenu && pMainMenu->IsLoaded()) pCurrentMenu = pMainMenu; else if(pInGameMenu && pInGameMenu->IsLoaded()) pCurrentMenu = pInGameMenu; if(!pCurrentMenu) return; for(;it!=end;++it) { if(!strcmp(it->first.c_str(),"pb_client")) { SFlashVarValue option[3] = {"pb_client", m_pbEnabled, true}; pCurrentMenu->Invoke("Root.MainMenu.Options.SetOption", option, 3); } else if(!stricmp(it->first.c_str(), "fsaa_mode")) { if(g_pGame->GetMenu()) { if(!gEnv->pConsole->GetCVar("r_FSAA")->GetIVal()) { SFlashVarValue option[3] = {"fsaa_mode", "0", true}; pCurrentMenu->Invoke("Root.MainMenu.Options.SetOption", option, 3); } else { int samples = gEnv->pConsole->GetCVar("r_FSAA_samples")->GetIVal(); int quality = gEnv->pConsole->GetCVar("r_FSAA_quality")->GetIVal(); SFlashVarValue option[3] = {"fsaa_mode", g_pGame->GetMenu()->GetFSAAMode(samples, quality).c_str(), true}; pCurrentMenu->Invoke("Root.MainMenu.Options.SetOption", option, 3); } } } else { ICVar *pCVar = gEnv->pConsole->GetCVar(it->first); if(pCVar) { const char* name = pCVar->GetName(); const char* value = pCVar->GetString(); bool bIsValid = pCVar->GetIVal()==pCVar->GetRealIVal(); if(!stricmp(name, "r_fsaa_samples")) //fsaa workaround for RnD { ICVar *pFSAA = gEnv->pConsole->GetCVar("r_fsaa"); if(pFSAA && pFSAA->GetIVal() == 0) value = pFSAA->GetString(); } SFlashVarValue option[3] = {name, value, bIsValid}; pCurrentMenu->Invoke("Root.MainMenu.Options.SetOption", option, 3); } } } pCurrentMenu->CheckedInvoke("_root.Root.MainMenu.Options.updateOptions"); }