OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4StartupScenSelDlg.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // Startup screen for non-parameterized engine start: Scenario selection dialog
17 
18 #ifndef INC_C4StartupScenSelDlg
19 #define INC_C4StartupScenSelDlg
20 
21 #include "gui/C4Folder.h"
22 #include "gui/C4Startup.h"
23 #include "landscape/C4Scenario.h"
25 #include "player/C4Achievement.h"
26 
28 
38  C4StartupScenSel_TitleOverlayMargin = 20, // number of pixels to each side of title overlay picture
39  C4StartupScenSel_MaxAchievements = 3; // maximum number of achievements shown next to entry
40 
41 // a list of loaded scenarios
43 {
44 public:
45  class Folder;
46  // either a scenario or scenario folder; manages singly linked tree
47  class Entry
48  {
49  protected:
52  class Folder *pParent;
53 
54  friend class Folder;
55 
56  protected:
63 
64  public:
65  Entry(class C4ScenarioListLoader *pLoader, class Folder *pParent);
66  virtual ~Entry(); // dtor: unlink from tree
67 
68  bool Load(C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx); // load as child if pFromGrp, else directly from filename
69  virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) { return true; } // load custom data for entry type (e.g. scenario title fallback in Scenario.txt)
70  virtual bool LoadCustomPre(C4Group &rGrp) { return true; } // preload stuff that's early in the group (Scenario.txt)
71  virtual bool Start() = 0; // start/open entry
72  virtual Folder *GetIsFolder() { return nullptr; } // return this if this is a folder
73 
74  const StdStrBuf &GetName() const { return sName; }
75  const StdStrBuf &GetEntryFilename() const { return sFilename; }
76  const StdStrBuf &GetVersion() const { return sVersion; }
77  const StdStrBuf &GetAuthor() const { return sAuthor; }
78  const C4Facet &GetIconFacet() const { return fctIcon; }
79  const C4Facet &GetTitlePicture() const { return fctTitle; }
80  const StdStrBuf &GetDesc() const { return sDesc; }
81  int GetIconIndex() { return iIconIndex; }
82  int GetDifficulty() { return iDifficulty; }
83  int GetFolderIndex() { return iFolderIndex; }
84  Entry *GetNext() const { return pNext; }
85  class Folder *GetParent() const { return pParent; }
86  virtual StdStrBuf GetTypeName() = 0;
87  virtual bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) { return false; } // return true and fill output parameters if player got the indexed achievement
88 
89  static Entry *CreateEntryForFile(const StdStrBuf &sFilename, C4ScenarioListLoader *pLoader, Folder *pParent); // create correct entry type based on file extension
90 
91  virtual bool CanOpen(StdStrBuf &sError) { return true; } // whether item can be started/opened (e.g. mission access, unregistered)
92  virtual bool IsGrayed() { return false; } // additional condition for graying out - notice unreg folders are grayed but can still be opened
93  virtual bool IsHidden() { return false; } // condition for hiding element completely
94  virtual bool HasMissionAccess() const { return true; }
95  virtual bool HasUnregisteredAccess() const { return false; }
96  virtual StdStrBuf GetOpenText() = 0; // get open button text
97  virtual StdStrBuf GetOpenTooltip() = 0;
98 
99  virtual const char *GetDefaultExtension() { return nullptr; } // extension to be added when item is renamed
100  virtual bool SetTitleInGroup(C4Group &rGrp, const char *szNewTitle);
101  bool RenameTo(const char *szNewName); // change name+filename
102  virtual bool IsScenario() { return false; }
103 
104  virtual C4ScenarioParameterDefs *GetParameterDefs() { return nullptr; }
105  virtual C4ScenarioParameters *GetParameters() { return nullptr; }
106  };
107 
108  // a loaded scenario to be started
109  class Scenario : public Entry
110  {
111  private:
112  C4Scenario C4S;
113  C4ScenarioParameterDefs ParameterDefs;
114  C4ScenarioParameters Parameters; // each entry caches its parameters set by the user
116  StdCopyStrBuf sAchievementDescriptions[C4StartupScenSel_MaxAchievements];
117  int32_t nAchievements;
118  bool fNoMissionAccess;
119  int32_t iMinPlrCount;
120 
121  public:
122  Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent) : Entry(pLoader, pParent), fNoMissionAccess(false), nAchievements(0), iMinPlrCount(0) {}
123  ~Scenario() override = default;
124 
125  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // do fallbacks for title and icon; check whether scenario is valid
126  bool LoadCustomPre(C4Group &rGrp) override; // load scenario core
127  bool Start() override; // launch scenario!
128 
129  bool CanOpen(StdStrBuf &sError) override; // check mission access, player count, etc.
130  bool IsGrayed() override { return false; } // additional option for graying out
131  bool IsHidden() override { return C4S.Head.Secret && !HasMissionAccess(); } // condition for hiding element completely
132  bool HasMissionAccess() const override { return !fNoMissionAccess; }; // check mission access only
133  StdStrBuf GetOpenText() override; // get open button text
134  StdStrBuf GetOpenTooltip() override;
135  const C4Scenario &GetC4S() const { return C4S; } // get scenario core
136  bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) override; // return true and fill output parameters if player got the indexed achievement
137 
138  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_SCENARIO"), true); }
139 
140  const char *GetDefaultExtension() override { return "ocs"; }
141 
142  C4ScenarioParameterDefs *GetParameterDefs() override { return &ParameterDefs; }
143  C4ScenarioParameters *GetParameters() override { return &Parameters; }
144 
145  bool IsScenario() override { return true; }
146  };
147 
148  // scenario folder
149  class Folder : public Entry
150  {
151  protected:
153  bool fContentsLoaded; // if set, directory contents are already loaded
154  Entry *pFirst; // tree structure
155  class C4MapFolderData *pMapData; // if set, contains gfx and data for special map-style folders
156  friend class Entry;
157 
158  public:
159  Folder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Entry(pLoader, pParent), fContentsLoaded(false), pFirst(nullptr), pMapData(nullptr) {}
160  ~Folder() override;
161 
162  bool LoadCustomPre(C4Group &rGrp) override; // load folder core
163 
164  bool LoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx, bool fReload); // load folder contents as child if pFromGrp, else directly from filename
165  uint32_t GetEntryCount() const;
166 
167  protected:
168  void ClearChildren();
169  void Sort();
170  virtual bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) = 0; // load folder contents as child if pFromGrp, else directly from filename
171 
172  public:
173  bool Start() override; // open as subfolder
174  Folder *GetIsFolder() override { return this; } // this is a folder
175  Entry *GetFirstEntry() const { return pFirst; }
176  void Resort() { Sort(); }
177  Entry *FindEntryByName(const char *szFilename) const; // find entry by filename comparison
178 
179  bool CanOpen(StdStrBuf &sError) override { return true; } // can always open folders
180  bool IsGrayed() override; // unreg folders can be opened to view stuff but they are still grayed out for clarity
181  StdStrBuf GetOpenText() override; // get open button text
182  StdStrBuf GetOpenTooltip() override;
183  C4MapFolderData *GetMapData() const { return pMapData; }
184 
185  virtual const C4ScenarioParameterDefs *GetAchievementDefs() const { return nullptr; }
186  virtual const C4AchievementGraphics *GetAchievementGfx() const { return nullptr; }
187  };
188 
189  // .ocf subfolder: Read through by group
190  class SubFolder : public Folder
191  {
192  private:
193  C4ScenarioParameterDefs AchievementDefs;
194  C4AchievementGraphics AchievementGfx;
195 
196  public:
197  SubFolder(class C4ScenarioListLoader *pLoader, Folder *pParent) : Folder(pLoader, pParent) {}
198  ~SubFolder() override = default;
199 
200  const char *GetDefaultExtension() override { return "ocf"; }
201 
202  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_FOLDER"), true); }
203 
204  const C4ScenarioParameterDefs *GetAchievementDefs() const override { return &AchievementDefs; }
205  const C4AchievementGraphics *GetAchievementGfx() const override { return &AchievementGfx; }
206 
207  protected:
208  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // load custom data for entry type - icon fallback to folder icon
209  bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override; // load folder contents as child if pFromGrp, else directly from filename
210  };
211 
212  // regular, open folder: Read through by directory iterator
213  class RegularFolder : public Folder
214  {
215  public:
217  ~RegularFolder() override;
218 
219  StdStrBuf GetTypeName() override { return StdCopyStrBuf(LoadResStr("IDS_TYPE_DIRECTORY"), true); }
220 
221  void Merge(const char *szPath);
222 
223  protected:
224  bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override; // load custom data for entry type - icon fallback to folder icon
225  bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override; // load folder contents as child if pFromGrp, else directly from filename
226 
227  typedef std::list<std::string> NameList;
228  NameList contents;
229  };
230 
231 private:
232  RegularFolder *pRootFolder;
233  Folder *pCurrFolder; // scenario list in working directory
234  int32_t iLoading, iProgress, iMaxProgress;
235  StdCopyStrBuf current_load_info; // extra string for currently loaded item
236  bool fAbortThis, fAbortPrevious; // activity state
237  const C4ScenarioParameters &Achievements;
238 
239 public:
240  C4ScenarioListLoader(const C4ScenarioParameters &Achievements);
242 
243 private:
244  // activity control (to be replaced by true multithreading)
245  bool BeginActivity(bool fAbortPrevious);
246  void EndActivity();
247 
248 public:
249  bool DoProcessCallback(int32_t iProgress, int32_t iMaxProgress, const char *current_load_info); // returns false if the activity was aborted
250 
251 public:
252  bool Load(const StdStrBuf &sRootFolder); // (unthreaded) loading of all entries in root folder
253  bool Load(Folder *pSpecifiedFolder, bool fReload); // (unthreaded) loading of all entries in subfolder
254  bool LoadExtended(Entry *pEntry); // (unthreaded) loading of desc and title image of specified entry
255  bool FolderBack(); // go upwards by one folder
256  bool ReloadCurrent(); // reload file list
257  bool IsLoading() const { return !!iLoading; }
258  Entry *GetFirstEntry() const { return pCurrFolder ? pCurrFolder->GetFirstEntry() : nullptr; }
259 
260  Folder *GetCurrFolder() const { return pCurrFolder; }
261  Folder *GetRootFolder() const { return pRootFolder; }
262 
263  int32_t GetProgress() const { return iProgress; }
264  int32_t GetMaxProgress() const { return iMaxProgress; }
265  int32_t GetProgressPercent() const { return iProgress * 100 / std::max<int32_t>(iMaxProgress, 1); }
266  const char *GetProgressInfo() const { return current_load_info.getData(); }
267 
268  const C4ScenarioParameters &GetAchievements() const { return Achievements; }
269 };
270 
271 
272 // -----------------------------------------------
273 
274 
275 
276 // for map-style folders: Data for map display
278 {
279 private:
280  struct Scenario
281  {
282  // compiled data
283  StdStrBuf sFilename;
284  StdStrBuf sBaseImage, sOverlayImage;
285 
286  // parameters for title as drawn on the map (if desired; otherwise sTitle empty)
287  StdStrBuf sTitle;
288  int32_t iTitleFontSize;
289  uint32_t dwTitleInactClr, dwTitleActClr;
290  int32_t iTitleOffX, iTitleOffY;
291  uint8_t byTitleAlign;
292  bool fTitleBookFont;
293  bool fImgDump; // developer help: Dump background image part
294 
295  C4Rect rcOverlayPos;
296  FLOAT_RECT rcfOverlayPos;
297 
298  // set during initialization
299  C4FacetSurface fctBase, fctOverlay;
300  C4ScenarioListLoader::Entry *pScenEntry;
301  C4GUI::Button *pBtn; // used to resolve button events to scenario
302 
303  void CompileFunc(StdCompiler *pComp);
304  };
305 
306  struct AccessGfx
307  {
308  // compiled data
309  StdStrBuf sPassword;
310  StdStrBuf sOverlayImage;
311  C4Rect rcOverlayPos;
312  FLOAT_RECT rcfOverlayPos;
313 
314  // set during initialization
315  C4FacetSurface fctOverlay;
316 
317  void CompileFunc(StdCompiler *pComp);
318  };
319 
320  // non-interactive map item
321  class MapPic : public C4GUI::Picture
322  {
323  private:
324  FLOAT_RECT rcfBounds; // drawing bounds
325  public:
326  MapPic(const FLOAT_RECT &rcfBounds, const C4Facet &rfct); // ctor
327 
328  void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override; // input: mouse movement or buttons - deselect everything if clicked
329 
330  protected:
331  void DrawElement(C4TargetFacet &cgo) override; // draw the image
332  };
333 
334 private:
335  C4FacetSurface fctBackgroundPicture; FLOAT_RECT rcfBG;
336  bool fCoordinatesAdjusted{false};
337  C4Rect rcScenInfoArea; // area in which scenario info is displayed
338  class C4ScenarioListLoader::Folder *pScenarioFolder;
339  class C4ScenarioListLoader::Entry *pSelectedEntry;
340  C4GUI::TextWindow *pSelectionInfoBox;
341  int32_t MinResX, MinResY; // minimum resolution for display of the map
342  bool fUseFullscreenMap;
343  Scenario **ppScenList{nullptr}; int32_t iScenCount{0};
344  AccessGfx **ppAccessGfxList{nullptr}; int32_t iAccessGfxCount{0};
345  class C4StartupScenSelDlg *pMainDlg{nullptr};
346 
347 public:
348  C4MapFolderData() = default;
350 
351 private:
352  void ConvertFacet2ScreenCoord(const C4Rect &rc, FLOAT_RECT *pfrc, float fBGZoomX, float fBGZoomY, int iOffX, int iOffY);
353  void ConvertFacet2ScreenCoord(int32_t *piValue, float fBGZoom, int iOff);
354  void ConvertFacet2ScreenCoord(C4Rect &rcMapArea, bool fAspect); // adjust coordinates of loaded facets so they match given area
355 
356 protected:
357  void OnButtonScenario(C4GUI::Control *pEl);
358 
359  friend class C4StartupScenSelDlg;
360 
361 public:
362  void Clear();
363  bool Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenLoaderFolder);
364  void CompileFunc(StdCompiler *pComp);
365  void CreateGUIElements(C4StartupScenSelDlg *pMainDlg, C4GUI::Window &rContainer);
366  void ResetSelection();
367 
368  C4GUI::TextWindow *GetSelectionInfoBox() const { return pSelectionInfoBox; }
369  C4ScenarioListLoader::Entry *GetSelectedEntry() const { return pSelectedEntry; }
370 };
371 
372 
373 
374 
375 // -----------------------------------------------
376 
377 // startup dialog: Scenario selection
379 {
380 public:
381  // one item in the scenario list
383  {
384  private:
385  typedef C4GUI::Window BaseClass;
386  // subcomponents
387  C4GUI::Picture *pIcon; // item icon
388  C4GUI::Label *pNameLabel; // item caption
389  C4GUI::Picture *ppAchievements[C4StartupScenSel_MaxAchievements]; // achievement icons
390  C4ScenarioListLoader::Entry *pScenListEntry; // associated, loaded item info
391 
392  public:
393  ScenListItem(C4GUI::ListBox *pForListBox, C4ScenarioListLoader::Entry *pForEntry, C4GUI::Element *pInsertBeforeElement=nullptr);
394 
395  protected:
396  struct RenameParams { };
397  void AbortRenaming(RenameParams par);
398  C4GUI::RenameEdit::RenameResult DoRenaming(RenameParams par, const char *szNewName);
399  public:
400  bool KeyRename();
401 
402  protected:
403  void UpdateOwnPos() override; // recalculate item positioning
404  void Update() {}
405 
406  public:
407  void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override;
408  C4ScenarioListLoader::Entry *GetEntry() const { return pScenListEntry; }
409  ScenListItem *GetNext() { return static_cast<ScenListItem *>(BaseClass::GetNext()); }
410 
411  bool CheckNameHotkey(const char * c) override; // return whether this item can be selected by entering given char
412  };
413 
414 public:
415  C4StartupScenSelDlg(bool fNetwork); // ctor
416  ~C4StartupScenSelDlg() override; // dtor
417 
418 private:
419  enum { ShowStyle_Book=0, ShowStyle_Map=1 };
420  enum { IconLabelSpacing = 2 }; // space between an icon and its text
421 
422  // book style scenario selection
423  C4GUI::Label *pScenSelCaption; // caption label atop scenario list; indicating current folder
424  C4GUI::ListBox *pScenSelList; // left page of book: Scenario selection
425  C4GUI::Label *pScenSelProgressLabel; // progress label shown while scenario list is being generated
426  C4GUI::Label *pScenSelProgressInfoLabel; // extra progress label showing currently processed item
427  C4GUI::TextWindow *pSelectionInfo; // used to display the description of the current selection
428  class C4GameOptionsList *pSelectionOptions; // displays custom scenario options for selected item below description
429 
430  C4KeyBinding *pKeyRefresh, *pKeyBack, *pKeyForward, *pKeyRename, *pKeyDelete, *pKeyCheat;
431  class C4GameOptionButtons *pGameOptionButtons;
432  C4GUI::Button *pOpenBtn;
433  C4GUI::Tabular *pScenSelStyleTabular;
434 
435  C4ScenarioListLoader *pScenLoader;
436 
437  // map style scenario selection
438  C4MapFolderData *pMapData;
439  C4Facet *pfctBackground;
440 
441  bool fIsInitialLoading;
442  bool fStartNetworkGame;
443 
444  C4GUI::RenameEdit *pRenameEdit;
445 
446  // achievements of all activated players
447  C4ScenarioParameters Achievements;
448 
449 public:
450  static C4StartupScenSelDlg *pInstance; // singleton
451 
452 protected:
453  int32_t GetMarginTop() override { return (rcBounds.Hgt/7); }
454  bool HasBackground() override { return false; }
455  void DrawElement(C4TargetFacet &cgo) override;
456 
457  bool OnEnter() override { DoOK(); return true; }
458  bool OnEscape() override { DoBack(true); return true; }
459  bool KeyBack() { return DoBack(true); }
460  bool KeyRefresh() { DoRefresh(); return true; }
461  bool KeyForward() { DoOK(); return true; }
462  bool KeyRename();
463  bool KeyDelete();
464  bool KeyCheat();
465  void KeyCheat2(const StdStrBuf &rsCheatCode);
466 
467  void DeleteConfirm(ScenListItem *pSel);
468 
469  void OnShown() override; // callback when shown: Init file list
470  void OnClosed(bool fOK) override; // callback when dlg got closed: Return to main screen
471  void OnBackBtn(C4GUI::Control *btn) { DoBack(true); }
472  void OnNextBtn(C4GUI::Control *btn) { DoOK(); }
473  void OnSelChange(class C4GUI::Element *pEl) { UpdateSelection(); }
474  void OnSelDblClick(class C4GUI::Element *pEl) { DoOK(); }
475  void OnButtonScenario(C4GUI::Control *pEl);
476 
477  void OnLeagueOptionChanged() override;
478 
479  friend class C4MapFolderData;
480 
481 private:
482  void UpdateList();
483  void UpdateSelection();
484  void ResortFolder();
485  ScenListItem *GetSelectedItem();
487  void SetOpenButtonDefaultText();
488  void FocusScenList();
489  void UpdateAchievements();
490 
491 public:
493  bool OpenFolder(C4ScenarioListLoader::Folder *pNewFolder);
494  void ProcessCallback() { UpdateList(); } // process callback by loader
495  bool DoOK(); // open/start currently selected item
496  bool DoBack(bool fAllowClose); // back folder, or abort dialog
497  void DoRefresh(); // refresh file list
498  void DeselectAll(); // reset focus and update selection info
499 
500  void StartRenaming(C4GUI::RenameEdit *pNewRenameEdit);
501  void AbortRenaming();
502  bool IsRenaming() const { return !!pRenameEdit; }
503  void SetRenamingDone() { pRenameEdit=nullptr; }
504 
505  void SetBackground(C4Facet *pNewBG) { pfctBackground=pNewBG; }
506 
507  bool IsNetworkStart() const { return fStartNetworkGame; }
508 
509  friend class ScenListItem;
510 };
511 
512 
513 #endif // INC_C4StartupScenSelDlg
const char * getData() const
Definition: StdBuf.h:442
void MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
const int32_t C4StartupScenSel_DefaultIcon_WinFolder
const int32_t C4StartupScenSel_TitlePictureWdt
int32_t GetProgressPercent() const
const char * GetDefaultExtension() override
void OnClosed(bool fOK) override
bool LoadExtended(Entry *pEntry)
const int32_t C4StartupScenSel_IconCount
void OnSelChange(class C4GUI::Element *pEl)
virtual bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx)=0
virtual const C4ScenarioParameterDefs * GetAchievementDefs() const
void StartRenaming(C4GUI::RenameEdit *pNewRenameEdit)
const char * GetProgressInfo() const
bool CanOpen(StdStrBuf &sError) override
const int32_t C4StartupScenSel_DefaultIcon_OldIconBG
StdCopyStrBuf sAuthor
C4GUI::TextWindow * GetSelectionInfoBox() const
virtual bool IsHidden()
bool StartScenario(C4ScenarioListLoader::Scenario *pStartScen)
virtual bool HasUnregisteredAccess() const
SubFolder(class C4ScenarioListLoader *pLoader, Folder *pParent)
C4GUI::RenameEdit::RenameResult DoRenaming(RenameParams par, const char *szNewName)
void OnSelDblClick(class C4GUI::Element *pEl)
C4MapFolderData()=default
C4ScenarioListLoader(const C4ScenarioParameters &Achievements)
virtual const C4AchievementGraphics * GetAchievementGfx() const
void SetBackground(C4Facet *pNewBG)
~Scenario() override=default
bool HasBackground() override
Definition: C4Rect.h:27
virtual const char * GetDefaultExtension()
Entry * pNext
RegularFolder(class C4ScenarioListLoader *pLoader, Folder *pParent)
void OnButtonScenario(C4GUI::Control *pEl)
int GetFolderIndex()
void DrawElement(C4TargetFacet &cgo) override
const C4Scenario & GetC4S() const
C4ScenarioParameters * GetParameters() override
StdCopyStrBuf sDesc
const StdStrBuf & GetAuthor() const
virtual bool IsScenario()
virtual StdStrBuf GetOpenText()=0
virtual ~Entry()
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
StdCopyStrBuf sName
StdCopyStrBuf sFilename
bool fOK
Definition: C4Gui.h:2082
const StdStrBuf & GetVersion() const
void CreateGUIElements(C4StartupScenSelDlg *pMainDlg, C4GUI::Window &rContainer)
bool LoadCustomPre(C4Group &rGrp) override
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const StdStrBuf & GetDesc() const
C4StartupScenSelDlg(bool fNetwork)
int iDifficulty
void KeyCheat2(const StdStrBuf &rsCheatCode)
int32_t GetMarginTop() override
const int32_t C4StartupScenSel_TitlePictureHgt
bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override
StdCopyStrBuf sVersion
const C4AchievementGraphics * GetAchievementGfx() const override
const int32_t C4StartupScenSel_TitleOverlayMargin
void CompileFunc(StdCompiler *pComp)
void OnButtonScenario(C4GUI::Control *pEl)
bool CanOpen(StdStrBuf &sError) override
virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded)
C4Rect rcBounds
Definition: C4Gui.h:385
bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description) override
int iIconIndex
virtual StdStrBuf GetTypeName()=0
bool DoProcessCallback(int32_t iProgress, int32_t iMaxProgress, const char *current_load_info)
const int32_t C4StartupScenSel_DefaultIcon_SavegamesFolder
virtual bool SetTitleInGroup(C4Group &rGrp, const char *szNewTitle)
const int32_t C4StartupScenSel_TitlePicturePadding
virtual bool HasMissionAccess() const
static Entry * CreateEntryForFile(const StdStrBuf &sFilename, C4ScenarioListLoader *pLoader, Folder *pParent)
bool DoLoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf &sFilename, bool fLoadEx) override
Folder * GetRootFolder() const
virtual Folder * GetIsFolder()
Entry(class C4ScenarioListLoader *pLoader, class Folder *pParent)
bool DoBack(bool fAllowClose)
virtual StdStrBuf GetOpenTooltip()=0
bool HasMissionAccess() const override
void OnNextBtn(C4GUI::Control *btn)
bool OpenFolder(C4ScenarioListLoader::Folder *pNewFolder)
bool Load(const StdStrBuf &sRootFolder)
C4FacetSurface fctIcon
class C4MapFolderData * pMapData
bool fBaseLoaded
Element * GetNext() const
Definition: C4Gui.h:449
int32_t GetProgress() const
Entry * GetFirstEntry() const
virtual C4ScenarioParameters * GetParameters()
bool fExLoaded
int32_t GetMaxProgress() const
const int32_t C4StartupScenSel_DefaultIcon_Folder
virtual bool IsGrayed()
class C4ScenarioListLoader * pLoader
Scenario(class C4ScenarioListLoader *pLoader, class Folder *pParent)
class Folder * GetParent() const
bool LoadContents(C4ScenarioListLoader *pLoader, C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx, bool fReload)
const C4Facet & GetTitlePicture() const
bool LoadCustomPre(C4Group &rGrp) override
bool Secret
Definition: C4Scenario.h:77
ScenListItem(C4GUI::ListBox *pForListBox, C4ScenarioListLoader::Entry *pForEntry, C4GUI::Element *pInsertBeforeElement=nullptr)
void OnBackBtn(C4GUI::Control *btn)
bool IsNetworkStart() const
const StdStrBuf & GetName() const
const int32_t C4StartupScenSel_DefaultIcon_Scenario
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
bool Load(C4Group *pFromGrp, const StdStrBuf *psFilename, bool fLoadEx)
void DeleteConfirm(ScenListItem *pSel)
int32_t Hgt
Definition: C4Rect.h:30
C4ScenarioListLoader::Entry * GetSelectedEntry() const
C4SHead Head
Definition: C4Scenario.h:230
C4ScenarioListLoader::Entry * GetEntry() const
const int32_t C4StartupScenSel_MaxAchievements
Folder * GetCurrFolder() const
int GetDifficulty()
Folder(class C4ScenarioListLoader *pLoader, Folder *pParent)
uint32_t DWORD
bool CheckNameHotkey(const char *c) override
virtual bool Start()=0
Entry * FindEntryByName(const char *szFilename) const
bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded) override
C4ScenarioParameterDefs * GetParameterDefs() override
~SubFolder() override=default
int iFolderIndex
const C4Facet & GetIconFacet() const
const StdStrBuf & GetEntryFilename() const
const C4ScenarioParameters & GetAchievements() const
void OnLeagueOptionChanged() override
class Folder * pParent
bool OnEscape() override
virtual bool LoadCustomPre(C4Group &rGrp)
C4MapFolderData * GetMapData() const
virtual bool GetAchievement(int32_t idx, C4Facet *out_facet, const char **out_description)
virtual bool CanOpen(StdStrBuf &sError)
int GetIconIndex()
bool Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenLoaderFolder)
const char * GetDefaultExtension() override
const C4ScenarioParameterDefs * GetAchievementDefs() const override
C4FacetSurface fctTitle
bool RenameTo(const char *szNewName)
virtual C4ScenarioParameterDefs * GetParameterDefs()
static C4StartupScenSelDlg * pInstance
Entry * GetNext() const