ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gui_lol.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 #ifdef ENABLE_LOL
23 
24 #ifndef KYRA_GUI_LOL_H
25 #define KYRA_GUI_LOL_H
26 
27 #include "kyra/gui/gui_v1.h"
28 
29 namespace Kyra {
30 #define GUI_LOL_MENU(menu, a, b, c, d, e, f, g, i) \
31  do { \
32  const ScreenDim *dim = _screen->getScreenDim(a); \
33  menu.x = (dim->sx << 3); \
34  menu.y = (dim->sy); \
35  menu.width = (dim->w << 3); \
36  menu.height = (dim->h); \
37  if (_vm->gameFlags().use16ColorMode) { \
38  menu.bkgdColor = 0xCC; \
39  menu.color1 = 0xFF; \
40  menu.color2 = 0xDD; \
41  } else { \
42  menu.bkgdColor = 225; \
43  menu.color1 = 223; \
44  menu.color2 = 227; \
45  } \
46  menu.menuNameId = b; \
47  menu.highlightedItem = c; \
48  menu.numberOfItems = d; \
49  menu.titleX = (dim->sx << 3) + (dim->w << 2); \
50  menu.titleY = 6; \
51  menu.textColor = _vm->gameFlags().use16ColorMode ? 0xE1 : 254; \
52  menu.scrollUpButtonX = e; \
53  menu.scrollUpButtonY = f; \
54  menu.scrollDownButtonX = g; \
55  menu.scrollDownButtonY = i; \
56  } while (0)
57 
58  #define GUI_LOL_MENU_ITEM(item, a, b, c, d, e, f, g) \
59  do { \
60  item.enabled = 1; \
61  item.itemId = a; \
62  item.itemString = ""; \
63  item.useItemString = false; \
64  item.x = b; \
65  item.y = c; \
66  item.width = d; \
67  item.height = e; \
68  item.textColor = _vm->gameFlags().use16ColorMode ? 0xC1 : 204; \
69  item.highlightColor = _vm->gameFlags().use16ColorMode ? 0xE1 : 254; \
70  item.titleX = -1; \
71  if (_vm->gameFlags().use16ColorMode) { \
72  item.bkgdColor = 0xCC; \
73  item.color1 = 0xFF; \
74  item.color2 = 0xDD; \
75  } else { \
76  item.bkgdColor = 225; \
77  item.color1 = 223; \
78  item.color2 = 227; \
79  } \
80  item.saveSlot = 0; \
81  item.labelId = f; \
82  item.labelString = 0; \
83  item.labelX = 0; \
84  item.labelY = 0; \
85  item.keyCode = g; \
86  } while (0)
87 
88 class LoLEngine;
89 class Screen_LoL;
90 
91 class GUI_LoL : public GUI_v1 {
92  friend class LoLEngine;
93 public:
94  GUI_LoL(LoLEngine *vm);
95 
96  void initStaticData();
97 
98  // button specific
99  void processButton(Button *button) override;
100  int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) override;
101 
102  int redrawShadedButtonCallback(Button *button) override;
103  int redrawButtonCallback(Button *button) override;
104 
105  int runMenu(Menu &menu);
106 
107  // utilities for thumbnail creation
108  void createScreenThumbnail(Graphics::Surface &dst) override;
109 
110 private:
111  void backupPage0();
112  void restorePage0();
113 
114  void setupSaveMenuSlots(Menu &menu, int num);
115 
116  void printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 flags) override;
117  int getMenuCenterStringX(const Common::String &str, int x1, int x2) override;
118 
119  int getInput();
120 
121  int clickedMainMenu(Button *button);
122  int clickedLoadMenu(Button *button);
123  int clickedSaveMenu(Button *button);
124  int clickedDeleteMenu(Button *button);
125  int clickedOptionsMenu(Button *button);
126  int clickedAudioMenu(Button *button);
127  int clickedDeathMenu(Button *button);
128  int clickedSavenameMenu(Button *button);
129  int clickedChoiceMenu(Button *button);
130 
131  int scrollUp(Button *button);
132  int scrollDown(Button *button);
133 
134  Button *getButtonListData() override { return _menuButtons; }
135  Button *getScrollUpButton() override { return &_scrollUpButton; }
136  Button *getScrollDownButton() override { return &_scrollDownButton; }
137 
138 
139  Button::Callback getScrollUpButtonHandler() const override { return _scrollUpFunctor; }
140  Button::Callback getScrollDownButtonHandler() const override { return _scrollDownFunctor; }
141 
142  uint8 defaultColor1() const override { return 0xFE; }
143  uint8 defaultColor2() const override { return 0x00; }
144  uint8 menuItemLabelColor() const override { return 0xCC; }
145 
146  Common::String getMenuTitle(const Menu &menu) override;
147  Common::String getMenuItemTitle(const MenuItem &menuItem) override;
148  Common::String getMenuItemLabel(const MenuItem &menuItem) override;
149 
150  Button _menuButtons[10];
151  Button _scrollUpButton;
152  Button _scrollDownButton;
153  Menu _mainMenu, _gameOptions, _audioOptions, _choiceMenu, _loadMenu, _saveMenu, _deleteMenu, _savenameMenu, _deathMenu;
154  Menu *_currentMenu, *_lastMenu, *_newMenu;
155  int _menuResult;
156  char *_saveDescription;
157 
158  LoLEngine *_vm;
159  Screen_LoL *_screen;
160 
161  bool _pressFlag;
162 
163  Button *_specialProcessButton;
164  Button *_backUpButtonList;
165  uint16 _flagsModifier;
166 
167  int _savegameOffset;
168  int _sliderSfx;
169 
170  Button::Callback _scrollUpFunctor;
171  Button::Callback _scrollDownFunctor;
172 
173  void sortSaveSlots() override;
174 };
175 
176 } // End of namespace Kyra
177 
178 #endif
179 
180 #endif // ENABLE_LOL
Definition: str.h:59
Definition: surface.h:67
Definition: detection.h:27
Definition: input.h:69