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 #ifndef PELROCK_MENU_H
22 #define PELROCK_MENU_H
23 
24 namespace Graphics {
25 class Screen;
26 }
27 namespace Pelrock {
28 
29 class PelrockEventManager;
30 class ResourceManager;
31 class SoundManager;
32 
33 enum MainMenuButton {
34  QUESTION_MARK_BUTTON,
35  INVENTORY_PREV_BUTTON,
36  INVENTORY_NEXT_BUTTON,
37  SAVEGAME_PREV_BUTTON,
38  SAVEGAME_NEXT_BUTTON,
39  EXIT_MENU_BUTTON,
40  SAVE_GAME_BUTTON,
41  LOAD_GAME_BUTTON,
42  SOUNDS_BUTTON,
43  NO_MAIN_BUTTON
44 };
45 
46 enum SoundMenuButton {
47  MASTER_LEFT_BUTTON,
48  MASTER_RIGHT_BUTTON,
49  SFX_LEFT_BUTTON,
50  SFX_RIGHT_BUTTON,
51  MUSIC_LEFT_BUTTON,
52  MUSIC_RIGHT_BUTTON,
53  NO_SOUND_BUTTON
54 };
55 
56 static const int kCreditsOrder[34] = {
57  5, // PROGRAMACION
58  8, // Juan Jose Gil
59  20, // Jose Vicente Pons
60  24, // LuisFer Fernandez
61  22, // Fernando Perez
62  7, // GRAFICOS
63  12, // Queral,
64  14, // Ana maria polo
65  18, // Juan Arocas
66  16, // Gost
67  26, // Astorga
68  28, // Santi Sanz
69  2, // Fernando Aparicio
70  11, // INTRODUCCION
71  12, // Queral,
72  26, // Astorga
73  28, // Santi Sanz
74  9, // MUSICA
75  6, // Rufino Acosta
76  13, // GUION
77  8, // Juan Jose Gil
78  19, // DIALOGOS
79  4, // Vicent raul arnau,
80  8, // Juan Jose Gil,
81  21, // PROBADORES
82  0, // David Burgos
83  10, // Alberto Leon
84  1, // Carles Pons
85  3, // Roman Pons
86  25, // Andres Ruiz,
87  27, // Juan Jose Ruiz
88  23, // Marilo
89  15, // PRODUCCION
90  17 // DDM
91 };
92 
93 class MenuManager {
94 
95  enum MenuState {
96  MAIN_MENU,
97  SOUND,
98  ORIGINAL_SAVE,
99  ORIGINAL_LOAD,
100  EXIT_GAME
101  };
102 
103 public:
105  ~MenuManager();
106  void menuLoop();
107  void saveScreenshot();
108  void drawScreen();
109  void drawInventoryIcons();
110  void loadMenu();
111  byte _mainMenuPalette[768] = {0};
112 
113 private:
114  void checkMouseDown(int x, int y);
115  bool checkMouseClick(int x, int y);
116  void checkSoundMenuClick(int x, int y);
117  bool checkMainMenuMouse(int x, int y); // returns bool if its supposed to close the menu
118  void showCredits();
119  bool selectInventoryItem(int i);
120  void loadMenuTexts();
121  void cleanUp();
122  void drawButtons();
123  void drawConfirmation();
124  void drawSaves();
125  void drawMainButtons();
126  void drawSoundControls();
127  void readButton(byte *rawData, uint32 offset, byte *outBuffer[2], int w, int h);
128  void readButton(Common::File &alfred7, uint32 offset, byte *outBuffer[2], Common::Rect rect);
129  void refreshSaveDescriptions();
130  void handleSaveMenuKey(Common::KeyCode key, uint16 ascii);
131  void backToMainMenu();
132  SoundMenuButton isSoundMenuButtonUnder(int x, int y);
133  MainMenuButton isMainMenuButtonUnder(int x, int y);
134  Graphics::Screen *_screen = nullptr;
135  PelrockEventManager *_events = nullptr;
136  ResourceManager *_res = nullptr;
137  SoundManager *_sound = nullptr;
138  Graphics::ManagedSurface _mainMenu;
139  Graphics::ManagedSurface _compositeBuffer;
140 
141  Common::Rect _saveGameRect = Common::Rect(Common::Point(132, 186), 81, 34);
142  byte *_saveButtons[2] = {nullptr};
143 
144  Common::Rect _loadGameRect = Common::Rect(Common::Point(133, 222), 80, 33);
145  byte *_loadButtons[2] = {nullptr};
146 
147  Common::Rect _soundsRect = Common::Rect(Common::Point(134, 258), 77, 33);
148  byte *_soundsButtons[2] = {nullptr};
149 
150  Common::Rect _exitToDosRect = Common::Rect(Common::Point(134, 293), 75, 30);
151  byte *_exitToDosButtons[2] = {nullptr};
152 
153  Common::Rect _invLeft = Common::Rect(Common::Point(469, 88), 26, 37);
154  byte *_inventoryLeftArrow[2] = {nullptr};
155 
156  Common::Rect _invRight = Common::Rect(Common::Point(463, 132), 26, 37);
157  byte *_inventoryRightArrow[2] = {nullptr};
158 
159  Common::Rect _savesUp = Common::Rect(Common::Point(457, 189), 26, 24);
160  byte *_savesUpArrows[2] = {nullptr};
161 
162  Common::Rect _savesDown = Common::Rect(Common::Point(450, 278), 26, 24);
163  byte *_savesDownArrows[2] = {nullptr};
164 
165  Common::Rect _questionMarkRect = Common::Rect(Common::Point(217, 293), 31, 30);
166  byte *_questionMark[2] = {nullptr};
167 
168  Common::Rect _masterVolumeLeftRect = Common::Rect(Common::Point(232, 252), 36, 28);
169  Common::Rect _masterVolumeRightRect = Common::Rect(Common::Point(268, 252), 31, 28);
170 
171  Common::Rect _musicVolumeLeftRect = Common::Rect(Common::Point(298, 252), 36, 28);
172  Common::Rect _musicVolumeRightRect = Common::Rect(Common::Point(334, 252), 31, 28);
173 
174  Common::Rect _sfxVolumeLeftRect = Common::Rect(Common::Point(364, 252), 36, 28);
175  Common::Rect _sfxVolumeRightRect = Common::Rect(Common::Point(400, 252), 31, 28);
176 
177  byte *_soundControlArrowLeft[2] = {nullptr};
178  byte *_soundControlArrowRight[2] = {nullptr};
179 
180  byte *_soundControlMasterIcon = nullptr;
181  byte *_soundControlSfxIcon = nullptr;
182  byte *_soundControlMusicIcon = nullptr;
183 
184  Graphics::ManagedSurface _masterSoundIcon;
185  Graphics::ManagedSurface _sfxSoundIcon;
186  Graphics::ManagedSurface _musicSoundIcon;
187 
188  int _masterVolumeLevel = 14;
189  int _sfxVolumeLevel = 14;
190  int _musicVolumeLevel = 14;
191 
193  // Temporary
194  int _selectedInvIndex = 0;
195  uint _curInventoryPage = 0;
196  Common::StringArray _menuText;
197  Common::Array<Common::StringArray> _inventoryDescriptions;
198  Common::Array<Common::Point> _inventorySlots;
199 
200  bool showButtons = true;
201  MenuState _menuState = MAIN_MENU;
202  int _textLineH = 0;
203 
204  // Save/Load sub-menu state
205  int _saveGamePage = 0;
206  int _editingSaveSlot = -1; // -1 = not editing any slot
207  Common::String _editingName; // name being typed for a save
208  Common::Rect _cancelRect; // hit-rect for the CANCELAR row
209  Common::Array<Common::Rect> _saveSlotRects; // hit-rects for the 8 visible save rows
210  Common::StringArray _saveDescriptions; // indexed by slot 0-255
211 };
212 
213 } // End of namespace Pelrock
214 #endif // PELROCK_MENU_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: array.h:52
Definition: events.h:28
Definition: actions.h:26
Definition: rect.h:536
Definition: atari-screen.h:58
Definition: screen.h:47
Definition: file.h:47
Definition: formatinfo.h:28
Definition: rect.h:144
Definition: resources.h:30
Definition: sound.h:55
Definition: menu.h:93