ScummVM API documentation
gui_lok.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 KYRA_GUI_LOK_H
23 #define KYRA_GUI_LOK_H
24 
25 #include "kyra/gui/gui_v1.h"
26 #include "kyra/graphics/screen_lok.h"
27 
28 namespace Kyra {
29 
30 #define GUI_V1_BUTTON(button, a, b, c, d, e, f, g, h, i, j, k) \
31  do { \
32  button.nextButton = 0; \
33  button.index = a; \
34  button.keyCode = button.keyCode2 = 0; \
35  button.data0Val1 = b; \
36  button.data1Val1 = c; \
37  button.data2Val1 = d; \
38  button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
39  button.flags = e; \
40  button.dimTableIndex = f; \
41  button.x = g; \
42  button.y = h; \
43  button.width = i; \
44  button.height = j; \
45  button.flags2 = k; \
46  button.mouseWheel = 0; \
47  button.arg = 0; \
48  } while (0)
49 
50 #define GUI_V1_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
51  do { \
52  menu.x = a; \
53  menu.y = b; \
54  menu.width = c; \
55  menu.height = d; \
56  menu.bkgdColor = e; \
57  menu.color1 = f; \
58  menu.color2 = g; \
59  menu.menuNameString = h; \
60  menu.textColor = i; \
61  menu.titleX = j; \
62  menu.titleY = k; \
63  menu.highlightedItem = l; \
64  menu.numberOfItems = m; \
65  menu.scrollUpButtonX = n; \
66  menu.scrollUpButtonY = o; \
67  menu.scrollDownButtonX = p; \
68  menu.scrollDownButtonY = q; \
69  } while (0)
70 
71 #define GUI_V1_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) \
72  do { \
73  item.enabled = a; \
74  item.itemString = ""; \
75  item.x = e; \
76  item.y = g; \
77  item.width = h; \
78  item.height = i; \
79  item.textColor = j; \
80  item.highlightColor = k; \
81  item.titleX = l; \
82  item.bkgdColor = n; \
83  item.color1 = o; \
84  item.color2 = p; \
85  item.saveSlot = q; \
86  item.labelString = r; \
87  item.labelX = s; \
88  item.labelY = t; \
89  item.keyCode = v; \
90  } while (0)
91 
92 class KyraEngine_LoK;
93 
94 class GUI_LoK : public GUI_v1 {
95  friend class KyraEngine_LoK;
96 public:
97  GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen);
98  ~GUI_LoK() override;
99 
100  void processButton(Button *button) override;
101  int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) override;
102 
103  int buttonMenuCallback(Button *caller);
104 
105  void createScreenThumbnail(Graphics::Surface &dst) override;
106 private:
107  void initStaticResource();
108 
109  Button _menuButtonData[6];
110  Button _scrollUpButton;
111  Button _scrollDownButton;
112  Button *getButtonListData() override { return _menuButtonData; }
113  Button *getScrollUpButton() override { return &_scrollUpButton; }
114  Button *getScrollDownButton() override { return &_scrollDownButton; }
115 
116  Menu *_menu;
117 
118  bool _pressFlag;
119 
120  void setGUILabels();
121 
122  void setupSavegames(Menu &menu, int num);
123 
124  int resumeGame(Button *button);
125  int loadGameMenu(Button *button);
126  int saveGameMenu(Button *button);
127  int gameControlsMenu(Button *button);
128  int quitPlaying(Button *button);
129  int quitConfirmYes(Button *button);
130  int quitConfirmNo(Button *button);
131  int loadGame(Button *button);
132  int saveGame(Button *button);
133  int savegameConfirm(Button *button);
134  int cancelSubMenu(Button *button);
135  int scrollUp(Button *button);
136  int scrollDown(Button *button);
137  int controlsChangeMusic(Button *button);
138  int controlsChangeSounds(Button *button);
139  int controlsChangeWalk(Button *button);
140  int controlsChangeText(Button *button);
141  int controlsChangeVoice(Button *button);
142  int controlsApply(Button *button);
143 
144  bool quitConfirm(const char *str);
145  void getInput();
146  void updateSavegameString();
147  void redrawTextfield();
148  void fadePalette();
149  void restorePalette();
150  void setupControls(Menu &menu);
151 
152  uint8 defaultColor1() const override { return 12; }
153  uint8 defaultColor2() const override { return 248; }
154  uint8 menuItemLabelColor() const override { return 253; }
155 
156  Common::String getMenuTitle(const Menu &menu) override { return menu.menuNameString; }
157  Common::String getMenuItemTitle(const MenuItem &menuItem) override { return menuItem.itemString; }
158  Common::String getMenuItemLabel(const MenuItem &menuItem) override { return menuItem.labelString; }
159 
160  KyraEngine_LoK *_vm;
161  Screen_LoK *_screen;
162 
163  bool _menuRestoreScreen;
164  uint8 _toplevelMenu;
165  int _savegameOffset;
166  char _savegameName[35 * 4]; // allow extra space, since the string can be UTF-8, temporarily
167  char _savegameNames[5][35 * 4];
168  const char *_specialSavegameString;
169  bool _resetHanInput;
170 
171  int _inputType;
172  // The purpose of these variables is improved handling of backspace character deletion for
173  // Hangul input. The original allows "deconstruction" of the last glyph, so why shouldn't we...
174  uint8 _inputState;
175  uint16 _backupChars[4];
176 
177  int _saveLoadNumSlots;
178 
179  Button::Callback _scrollUpFunctor;
180  Button::Callback _scrollDownFunctor;
181  Button::Callback getScrollUpButtonHandler() const override { return _scrollUpFunctor; }
182  Button::Callback getScrollDownButtonHandler() const override { return _scrollDownFunctor; }
183 
184  const char *_voiceTextString;
185  const char *_textSpeedString;
186  const char *_onString;
187  const char *_offString;
188  const char *_confMusicMenuStrings[3];
189  uint8 _confMusicMenuMod;
190 };
191 
192 } // End of namespace Kyra
193 
194 #endif
Definition: str.h:59
Definition: surface.h:67
Definition: gui_v1.h:57
Definition: gui_v1.h:29
Definition: gui_lok.h:94
Definition: kyra_lok.h:97
Definition: screen_lok.h:31
Definition: detection.h:27
Definition: gui.h:38
Definition: gui_v1.h:82