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 HARVESTER_MENU_H
23 #define HARVESTER_MENU_H
24 
25 #include "common/array.h"
26 #include "common/error.h"
27 #include "common/rect.h"
28 #include "common/str.h"
29 #include "harvester/art.h"
30 
31 namespace Graphics {
32 class Font;
33 }
34 
35 namespace Harvester {
36 
37 class HarvesterEngine;
38 class Flow;
39 
42  Common::String yesLabel = "YES";
43  Common::String noLabel = "NO";
44  Common::String clickLabel = "CLICK";
45  Common::String onLabel = "On";
46  Common::String offLabel = "Off";
47  Common::String enterPasswordLabel = "ENTER PASSWORD";
48  Common::String newGamePrompt = "NEW GAME";
49  Common::String quitGamePrompt = "QUIT GAME";
50  Common::String talkToVerb = "Talk to";
51  Common::String examineVerb = "Examine";
52  Common::String examineTheVerb = "Examine the";
53  Common::String operateVerb = "Operate the";
54  Common::String pickUpVerb = "Pick up the";
55  Common::String useVerb = "Use";
56  Common::String useOnPreposition = "on";
57  Common::String dialogueOtherLabel = "Other";
58  Common::String dialogueResponsesLabel = "Responses";
59  Common::String dialogueKeywordLabel;
60  Common::Array<Common::String> weekdayLabels;
61  Common::String quickTipsExitLabel = "Exit";
62  Common::String quickTipsNextLabel = "Next";
63  Common::String quickTipsOnLabel = "Show Tips ON";
64  Common::String quickTipsOffLabel = "Show Tips OFF";
65  Common::String quickTipsHeader;
66 
67  bool hasDialogueKeywordLabel() const { return !dialogueKeywordLabel.empty(); }
68  bool hasQuickTipsHeader() const { return !quickTipsHeader.empty(); }
69 };
70 
72  Common::Rect exitRect;
73  Common::Rect nextRect;
74  Common::Rect toggleRect;
75 };
76 
77 bool loadMenuTextConfig(HarvesterEngine &engine, MenuTextConfig &config);
78 Common::String buildUseItemPrompt(const MenuTextConfig &config,
79  const Common::String &itemLabel, const Common::String &targetLabel);
80 bool resolveQuickTipsLayout(HarvesterEngine &engine, const MenuTextConfig &config,
81  QuickTipsLayout &layout);
82 void drawQuickTipsPanel(HarvesterEngine &engine, const MenuTextConfig &config,
83  const QuickTipsLayout &layout, const Common::String &tipText);
84 
85 class MenuSystem {
86 public:
87  MenuSystem(HarvesterEngine &engine, Common::Point &mousePos,
88  const Common::Array<Common::String> &menuItems);
89 
90  Common::Error runMainMenuStub(Flow &flow);
91  Common::Error runRoomMenuStub(const IndexedBitmap &backdrop, const byte *palette,
92  float paletteBrightness, Flow &flow, bool canSaveGame);
93  Common::Error validateParentalPassword(Flow &flow);
94 
95 private:
96  Common::Error runLoadGameMenu(const byte *palette, float paletteBrightness,
97  Flow &flow, bool &loadedGame);
98  Common::Error runOptionsMenu(const IndexedBitmap &backdrop, const byte *palette,
99  float paletteBrightness, Flow &flow);
100  Common::Error runHelpScreen(const byte *palette, float paletteBrightness, Flow &flow);
101  Common::Error runSaveGameMenu(const byte *palette, float paletteBrightness,
102  Flow &flow, bool &savedGame);
103  Common::Error restoreRoomBackdropAfterSave(const IndexedBitmap &backdrop, const byte *palette,
104  float paletteBrightness, Flow &flow) const;
105  Common::Error runConfirmPrompt(const IndexedBitmap &backdrop, const byte *palette,
106  float paletteBrightness, Flow &flow, const Common::String &promptText,
107  bool &confirmed);
108  Common::Error runQuitGameConfirm(const IndexedBitmap &backdrop, const byte *palette,
109  float paletteBrightness, Flow &flow);
110  Common::Error runPasswordPrompt(const IndexedBitmap &backdrop, const byte *palette,
111  float paletteBrightness, Flow &flow, bool drawLogo, Common::String &password,
112  bool &accepted) const;
113  Common::Error showGameOverBackdrop(Flow &flow);
114  void clearMainMenuBackdrop();
115  void renderMainMenuStub(const Common::Array<Common::String> &menuItems, int selectedItem,
116  const Common::String &statusMessage) const;
117  void renderMainMenuScreen(int selectedItem, const Common::String &statusMessage,
118  bool drawCursor, const Common::Array<Common::String> &menuItems) const;
119  void renderBackdropMenuScreen(const IndexedBitmap &backdrop, const byte *palette,
120  float paletteBrightness, const Common::Array<Common::String> &menuItems,
121  int selectedItem) const;
122  int getMenuItemAt(const Common::Point &mousePos, const Common::Array<Common::String> &menuItems) const;
123  int getBackdropMenuItemAt(const Common::Point &mousePos,
124  const Common::Array<Common::String> &menuItems) const;
125 
126  HarvesterEngine &_engine;
127  Common::Point &_mousePos;
128  const Common::Array<Common::String> &_menuItems;
129  IndexedBitmap _mainMenuBackdrop;
130  byte _mainMenuBackdropPalette[256 * 3] = { 0 };
131  bool _hasMainMenuBackdrop = false;
132 };
133 
134 } // End of namespace Harvester
135 
136 #endif // HARVESTER_MENU_H
Definition: flow.h:47
Definition: str.h:59
Definition: art.h:31
Definition: menu.h:85
Definition: error.h:81
Definition: art.h:35
Definition: rect.h:536
Definition: menu.h:71
Definition: menu.h:40
Definition: formatinfo.h:28
Definition: rect.h:144
Definition: harvester.h:47