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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef MYST_SCRIPTS_MENU_H 24 #define MYST_SCRIPTS_MENU_H 25 26 #include "mohawk/myst_scripts.h" 27 28 #include "common/scummsys.h" 29 #include "common/util.h" 30 31 #include "graphics/font.h" 32 33 namespace Mohawk { 34 35 class MystAreaVideo; 36 struct MystScriptEntry; 37 38 namespace MystStacks { 39 40 #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) 41 42 class Menu : public MystScriptParser { 43 public: 44 explicit Menu(MohawkEngine_Myst *vm); 45 ~Menu() override; 46 setInGame(bool inGame)47 void setInGame(bool inGame) { 48 _inGame = inGame; 49 } 50 setCanSave(bool canSave)51 void setCanSave(bool canSave) { 52 _canSave = canSave; 53 } 54 55 void disablePersistentScripts() override; 56 void runPersistentScripts() override; 57 58 private: 59 void setupOpcodes(); 60 uint16 getVar(uint16 var) override; 61 62 DECLARE_OPCODE(o_playIntroMovies); 63 DECLARE_OPCODE(o_menuItemEnter); 64 DECLARE_OPCODE(o_menuItemLeave); 65 DECLARE_OPCODE(o_menuResume); 66 DECLARE_OPCODE(o_menuLoad); 67 DECLARE_OPCODE(o_menuSave); 68 DECLARE_OPCODE(o_menuNew); 69 DECLARE_OPCODE(o_menuOptions); 70 DECLARE_OPCODE(o_menuQuit); 71 DECLARE_OPCODE(o_menuInit); 72 DECLARE_OPCODE(o_menuExit); 73 74 bool _inGame; 75 bool _canSave; 76 bool _menuItemHovered[6]; 77 bool _wasCursorVisible; 78 79 bool _introMoviesRunning; 80 int _introStep; 81 void introMovies_run(); 82 83 bool showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton); 84 85 void drawButtonImages(const Common::U32String &text, MystAreaImageSwitch *area, Graphics::TextAlign align, uint16 highlightedIndex, uint16 disabledIndex) const; 86 void replaceButtonSubImageWithText(const Common::U32String &text, const Graphics::TextAlign &align, MystAreaImageSwitch *area, 87 uint16 subimageIndex, const Common::Rect &backgroundRect, int16 deltaY, 88 uint8 r, uint8 g, uint8 b) const; 89 const char **getButtonCaptions() const; 90 void resetButtons(); 91 92 }; 93 94 } // End of namespace MystStacks 95 } // End of namespace Mohawk 96 97 #undef DECLARE_OPCODE 98 99 #endif 100