void CScreenLevelList::ShowSoluceUpdate() { CWindow* pw; CEdit* pe; CCheck* pc; m_sceneSoluce = false; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_RESUME)); if ( pe == nullptr ) return; pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE)); if ( pc == nullptr ) return; if ( m_main->GetShowSoluce() ) { pc->SetState(STATE_VISIBLE); pc->SetState(STATE_CHECK); m_sceneSoluce = true; } else { pc->ClearState(STATE_VISIBLE); pc->ClearState(STATE_CHECK); m_sceneSoluce = false; } }
void CScreenLevelList::UpdateSceneResume(int chap, int rank) { CWindow* pw; CEdit* pe; CCheck* pc; std::string fileName; int numTry; bool bPassed, bVisible; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_RESUME)); if ( pe == nullptr ) return; pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE)); if ( pc == nullptr ) { m_sceneSoluce = false; } else { numTry = m_main->GetPlayerProfile()->GetLevelTryCount(m_category, chap, rank); bPassed = m_main->GetPlayerProfile()->GetLevelPassed(m_category, chap, rank); bVisible = ( numTry > 2 || bPassed || m_main->GetShowSoluce() ); if ( !CSettings::GetInstancePointer()->GetSoluce4() ) bVisible = false; pc->SetState(STATE_VISIBLE, bVisible); if ( !bVisible ) { pc->ClearState(STATE_CHECK); m_sceneSoluce = false; } } if(chap == 0 || rank == 0) return; try { CLevelParser levelParser(m_category, chap, rank); levelParser.Load(); pe->SetText(levelParser.Get("Resume")->GetParam("text")->AsString().c_str()); } catch (CLevelParserException& e) { pe->SetText((std::string("[ERROR]: ")+e.what()).c_str()); } }
void CScreenSetupGame::CreateInterface() { CWindow* pw; CLabel* pl; CCheck* pc; CSlider* psl; CList* pli; Math::Point pos, ddim; std::string name; CScreenSetup::CreateInterface(); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; ddim.x = dim.x*6; ddim.y = dim.y*0.5f; pos.x = ox+sx*3; pos.y = 0.65f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SCROLL); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTX); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTY); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_ENABLE); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pos.y -= ddim.y; ddim.x = dim.x*2.5f; psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_INTERVAL); psl->SetState(STATE_SHADOW); psl->SetLimit(1.0f, 30.0f); psl->SetArrowStep(1.0f); pos.y += ddim.y/2; GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_INTERVAL, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.y -= ddim.y/2; pos.x = ox+sx*3+dim.x*4.0f; psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_SLOTS); psl->SetState(STATE_SHADOW); psl->SetLimit(1.0f, 10.0f); psl->SetArrowStep(1.0f); pos.y += ddim.y/2; GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_SLOTS, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.y -= ddim.y/2; ddim.x = dim.x*6; ddim.y = dim.y*0.5f; pos.x = ox+sx*10; pos.y = 0.65f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOOLTIP); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_GLINT); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_RAIN); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BGPAUSE); pc->SetState(STATE_SHADOW); pos.y -= 0.048f; pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITMODE); pc->SetState(STATE_SHADOW); if ( m_simulationSetup ) { pc->SetState(STATE_DEAD); } pos.y -= 0.048f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITVALUE); pc->SetState(STATE_SHADOW); ddim.y = dim.y*3.0f; pos.y -= ddim.y; pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LANGUAGE); pli->SetState(STATE_SHADOW); // TODO: Add something like GetSupportedLanguages() and GetLanguageFriendlyName() for this pli->SetItemName(1+LANGUAGE_ENV, "[System default]"); pli->SetItemName(1+LANGUAGE_ENGLISH, "English"); pli->SetItemName(1+LANGUAGE_FRENCH, "French"); pli->SetItemName(1+LANGUAGE_GERMAN, "German"); pli->SetItemName(1+LANGUAGE_POLISH, "Polish"); pli->SetItemName(1+LANGUAGE_RUSSIAN, "Russian"); UpdateSetupButtons(); }
void CScreenSetupGame::UpdateSetupButtons() { CWindow* pw; CCheck* pc; CSlider* ps; CList* pli; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_TOOLTIP)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetTooltips()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_GLINT)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetInterfaceGlint()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_RAIN)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetInterfaceRain()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BGPAUSE)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetFocusLostPause()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITMODE)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_engine->GetEditIndentMode()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITVALUE)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_engine->GetEditIndentValue()>2); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE4)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetSoluce4()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_MOVIES)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_settings->GetMovies()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SCROLL)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_camera->GetOldCameraScroll()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTX)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_camera->GetCameraInvertX()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTY)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_camera->GetCameraInvertY()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EFFECT)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_camera->GetEffect()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BLOOD)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_camera->GetBlood()); } pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_ENABLE)); if ( pc != nullptr ) { pc->SetState(STATE_CHECK, m_main->GetAutosave()); } ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL)); if ( ps != nullptr ) { ps->SetState(STATE_ENABLE, m_main->GetAutosave()); ps->SetVisibleValue(m_main->GetAutosaveInterval()); } ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_SLOTS)); if ( ps != nullptr ) { ps->SetState(STATE_ENABLE, m_main->GetAutosave()); ps->SetVisibleValue(m_main->GetAutosaveSlots()); } pli = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LANGUAGE)); if ( pli != nullptr ) { pli->SetSelect(1+m_settings->GetLanguage()); } }
void CScreenLevelList::CreateInterface() { CWindow* pw; CEdit* pe; CLabel* pl; CButton* pb; CCheck* pc; CList* pli; Math::Point pos, ddim; int res; std::string name; if ( m_category == LevelCategory::FreeGame ) { m_accessChap = m_main->GetPlayerProfile()->GetChapPassed(LevelCategory::Missions); } pos.x = 0.10f; pos.y = 0.10f; ddim.x = 0.80f; ddim.y = 0.80f; pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5); pw->SetClosable(true); if ( m_category == LevelCategory::Exercises ) res = RT_TITLE_TRAINER; if ( m_category == LevelCategory::Challenges ) res = RT_TITLE_DEFI; if ( m_category == LevelCategory::Missions ) res = RT_TITLE_MISSION; if ( m_category == LevelCategory::FreeGame ) res = RT_TITLE_FREE; if ( m_category == LevelCategory::CodeBattles ) res = RT_TITLE_CODE_BATTLES; if ( m_category == LevelCategory::CustomLevels ) res = RT_TITLE_USER; GetResource(RES_TEXT, res, name); pw->SetName(name); pos.x = 0.10f; pos.y = 0.40f; ddim.x = 0.50f; ddim.y = 0.50f; pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner pos.x = 0.40f; pos.y = 0.10f; ddim.x = 0.50f; ddim.y = 0.50f; pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner // Displays a list of chapters: pos.x = ox+sx*3; pos.y = oy+sy*10.5f; ddim.x = dim.x*7.5f; ddim.y = dim.y*0.6f; res = RT_PLAY_CHAP_CHAPTERS; if ( m_category == LevelCategory::Missions ) res = RT_PLAY_CHAP_PLANETS; if ( m_category == LevelCategory::FreeGame ) res = RT_PLAY_CHAP_PLANETS; if ( m_category == LevelCategory::CustomLevels ) res = RT_PLAY_CHAP_USERLVL; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.y = oy+sy*6.7f; ddim.y = dim.y*4.5f; ddim.x = dim.x*6.5f; pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_CHAP); pli->SetState(STATE_SHADOW); m_chap[m_category] = m_main->GetPlayerProfile()->GetSelectedChap(m_category)-1; UpdateSceneChap(m_chap[m_category]); if ( m_category != LevelCategory::FreeGame && m_category != LevelCategory::CodeBattles && m_category != LevelCategory::CustomLevels ) // Don't show completion marks in free game, code battles and userlevels { pli->SetState(STATE_EXTEND); } // Displays a list of missions: pos.x = ox+sx*9.5f; pos.y = oy+sy*10.5f; ddim.x = dim.x*7.5f; ddim.y = dim.y*0.6f; res = RT_PLAY_LIST_LEVELS; if ( m_category == LevelCategory::Exercises ) res = RT_PLAY_LIST_EXERCISES; if ( m_category == LevelCategory::Challenges ) res = RT_PLAY_LIST_CHALLENGES; if ( m_category == LevelCategory::Missions ) res = RT_PLAY_LIST_MISSIONS; if ( m_category == LevelCategory::FreeGame ) res = RT_PLAY_LIST_FREEGAME; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.y = oy+sy*6.7f; ddim.y = dim.y*4.5f; ddim.x = dim.x*6.5f; pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LIST); pli->SetState(STATE_SHADOW); m_sel[m_category] = m_main->GetPlayerProfile()->GetSelectedRank(m_category)-1; UpdateSceneList(m_chap[m_category], m_sel[m_category]); if ( m_category != LevelCategory::FreeGame && m_category != LevelCategory::CodeBattles && m_category != LevelCategory::CustomLevels ) // Don't show completion marks in free game, code battles and userlevels { pli->SetState(STATE_EXTEND); } pos = pli->GetPos(); ddim = pli->GetDim(); // Displays the summary: pos.x = ox+sx*3; pos.y = oy+sy*5.4f; ddim.x = dim.x*6.5f; ddim.y = dim.y*0.6f; GetResource(RES_TEXT, RT_PLAY_RESUME, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.x = ox+sx*3; pos.y = oy+sy*3.6f; ddim.x = dim.x*13.4f; ddim.y = dim.y*1.9f; pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_RESUME); pe->SetState(STATE_SHADOW); pe->SetMaxChar(500); pe->SetEditCap(false); // just to see pe->SetHighlightCap(false); // Button displays the "soluce": if ( m_category != LevelCategory::Exercises && m_category != LevelCategory::FreeGame ) { pos.x = ox+sx*9.5f; pos.y = oy+sy*5.8f; ddim.x = dim.x*6.5f; ddim.y = dim.y*0.5f; pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE); pc->SetState(STATE_SHADOW); pc->ClearState(STATE_CHECK); } m_sceneSoluce = false; UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1); if ( m_category == LevelCategory::Missions || m_category == LevelCategory::FreeGame || m_category == LevelCategory::CustomLevels ) { pos.x = ox+sx*9.5f; pos.y = oy+sy*2; ddim.x = dim.x*3.7f; ddim.y = dim.y*1; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY); pb->SetState(STATE_SHADOW); if ( m_maxList == 0 ) { pb->ClearState(STATE_ENABLE); } pos.x += dim.x*4.0f; ddim.x = dim.x*2.5f; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_READ); pb->SetState(STATE_SHADOW); if ( !m_main->GetPlayerProfile()->HasAnySavedScene() ) // no file to read? { pb->ClearState(STATE_ENABLE); } } else { pos.x = ox+sx*9.5f; pos.y = oy+sy*2; ddim.x = dim.x*6.5f; ddim.y = dim.y*1; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY); pb->SetState(STATE_SHADOW); if ( m_maxList == 0 ) { pb->ClearState(STATE_ENABLE); } } pos.x = ox+sx*3; ddim.x = dim.x*4; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK); pb->SetState(STATE_SHADOW); SetBackground("textures/interface/interface.png"); CreateVersionDisplay(); if (m_category == LevelCategory::CustomLevels) { if(m_customLevelList.size() == 0) { m_main->ChangePhase(PHASE_MAIN_MENU); std::string title, text; GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TITLE, title); GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TEXT, text); m_dialog->StartInformation(title, title, text); } } }