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 MYST_SCRIPTS_MENU_H
23 #define MYST_SCRIPTS_MENU_H
24 
25 #include "mohawk/myst_scripts.h"
26 
27 #include "common/scummsys.h"
28 #include "common/util.h"
29 
30 #include "graphics/font.h"
31 
32 namespace Mohawk {
33 
34 class MystAreaVideo;
35 struct MystScriptEntry;
36 
37 namespace MystStacks {
38 
39 #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
40 
41 class Menu : public MystScriptParser {
42 public:
43  explicit Menu(MohawkEngine_Myst *vm);
44  ~Menu() override;
45 
46  void setInGame(bool inGame) {
47  _inGame = inGame;
48  }
49 
50  void setCanSave(bool canSave) {
51  _canSave = canSave;
52  }
53 
54  void disablePersistentScripts() override;
55  void runPersistentScripts() override;
56 
57 private:
58  void setupOpcodes();
59  uint16 getVar(uint16 var) override;
60 
61  DECLARE_OPCODE(o_playIntroMovies);
62  DECLARE_OPCODE(o_menuItemEnter);
63  DECLARE_OPCODE(o_menuItemLeave);
64  DECLARE_OPCODE(o_menuResume);
65  DECLARE_OPCODE(o_menuLoad);
66  DECLARE_OPCODE(o_menuSave);
67  DECLARE_OPCODE(o_menuNew);
68  DECLARE_OPCODE(o_menuOptions);
69  DECLARE_OPCODE(o_menuQuit);
70  DECLARE_OPCODE(o_menuInit);
71  DECLARE_OPCODE(o_menuExit);
72 
73  bool _inGame;
74  bool _canSave;
75  bool _menuItemHovered[6];
76  bool _wasCursorVisible;
77 
78  bool _introMoviesRunning;
79  int _introStep;
80  void introMovies_run();
81 
82  bool showConfirmationDialog(const Common::U32String &message, const Common::U32String &confirmButton, const Common::U32String &cancelButton);
83 
84  void drawButtonImages(const Common::U32String &text, MystAreaImageSwitch *area, Graphics::TextAlign align, uint16 highlightedIndex, uint16 disabledIndex) const;
85  void replaceButtonSubImageWithText(const Common::U32String &text, const Graphics::TextAlign &align, MystAreaImageSwitch *area,
86  uint16 subimageIndex, const Common::Rect &backgroundRect, int16 deltaY,
87  uint8 r, uint8 g, uint8 b) const;
88  const char **getButtonCaptions() const;
89  void resetButtons();
90 
91  PauseToken _pauseToken;
92 
93 };
94 
95 } // End of namespace MystStacks
96 } // End of namespace Mohawk
97 
98 #undef DECLARE_OPCODE
99 
100 #endif
Definition: engine.h:102
TextAlign
Definition: font.h:48
Definition: rect.h:144
Definition: myst_scripts.h:60
Definition: myst.h:129
Definition: ustr.h:57
Definition: myst_areas.h:154
Definition: menu.h:41
Definition: bitmap.h:32