ScummVM API documentation
menu.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ALCACHOFA_MENU_H
23 #define ALCACHOFA_MENU_H
24 
25 #include "common/savefile.h"
26 
27 namespace Alcachofa {
28 
29 class Room;
30 
31 enum class MainMenuAction : int32 {
32  ContinueGame = 0,
33  Save,
34  Load,
35  InternetMenu,
36  OptionsMenu,
37  Exit,
38  NextSave,
39  PrevSave,
40  NewGame,
41  AlsoExit // there seems to be no difference to Exit
42 };
43 
44 enum class OptionsMenuAction : int32 {
45  SubtitlesOn = 0,
46  SubtitlesOff,
47  HighQuality,
48  LowQuality,
49  Bits32,
50  Bits16,
51  MainMenu
52 };
53 
54 enum class OptionsMenuValue : int32 {
55  Music = 0,
56  Speech = 1
57 };
58 
59 class Menu {
60 public:
61  Menu();
62 
63  inline bool isOpen() const { return _isOpen; }
64  inline uint32 millisBeforeMenu() const { return _millisBeforeMenu; }
65  inline Room *previousRoom() { return _previousRoom; }
66  inline FakeSemaphore &interactionSemaphore() { return _interactionSemaphore; }
67 
68  void resetAfterLoad();
69  void updateOpeningMenu();
70  void triggerMainMenuAction(MainMenuAction action);
71  void triggerLoad();
72 
73  void openOptionsMenu();
74  void triggerOptionsAction(OptionsMenuAction action);
75  void triggerOptionsValue(OptionsMenuValue valueId, float value);
76 
77  // if we do still have a big thumbnail, any autosaves, ScummVM-saves, ingame-saves
78  // do not have to render themselves, they can just reuse the one we have.
79  // as such - may return nullptr
80  const Graphics::Surface *getBigThumbnail() const;
81 
82 private:
83  void triggerSave();
84  void updateSelectedSavefile(bool hasJustSaved);
85  bool tryReadOldSavefile();
86  void continueGame();
87  void continueMainMenu();
88  void setOptionsState();
89 
90  bool
91  _isOpen = false,
92  _openAtNextFrame = false;
93  uint32
94  _millisBeforeMenu = 0,
95  _selectedSavefileI = 0;
96  Room *_previousRoom = nullptr;
97  FakeSemaphore _interactionSemaphore; // to prevent ScummVM loading during button clicks
98  Common::String _selectedSavefileDescription = "<unset>";
101  _bigThumbnail, // big because it is for the in-game menu, not for ScummVM
102  _selectedThumbnail;
103  Common::SaveFileManager *_saveFileMgr;
104 };
105 
106 }
107 
108 #endif // ALCACHOFA_MENU_H
Definition: managed_surface.h:51
Definition: alcachofa.h:45
Definition: str.h:59
Definition: surface.h:67
Definition: menu.h:59
Definition: savefile.h:142
Definition: rooms.h:31
This fake semaphore does not work in multi-threaded scenarios It is used as a safer option for a simp...
Definition: common.h:84