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 #ifdef ENABLE_LOL 24 25 #ifndef KYRA_GUI_LOL_H 26 #define KYRA_GUI_LOL_H 27 28 #include "kyra/gui/gui_v1.h" 29 30 namespace Kyra { 31 #define GUI_LOL_MENU(menu, a, b, c, d, e, f, g, i) \ 32 do { \ 33 const ScreenDim *dim = _screen->getScreenDim(a); \ 34 menu.x = (dim->sx << 3); \ 35 menu.y = (dim->sy); \ 36 menu.width = (dim->w << 3); \ 37 menu.height = (dim->h); \ 38 if (_vm->gameFlags().use16ColorMode) { \ 39 menu.bkgdColor = 0xCC; \ 40 menu.color1 = 0xFF; \ 41 menu.color2 = 0xDD; \ 42 } else { \ 43 menu.bkgdColor = 225; \ 44 menu.color1 = 223; \ 45 menu.color2 = 227; \ 46 } \ 47 menu.menuNameId = b; \ 48 menu.highlightedItem = c; \ 49 menu.numberOfItems = d; \ 50 menu.titleX = (dim->sx << 3) + (dim->w << 2); \ 51 menu.titleY = 6; \ 52 menu.textColor = _vm->gameFlags().use16ColorMode ? 0xE1 : 254; \ 53 menu.scrollUpButtonX = e; \ 54 menu.scrollUpButtonY = f; \ 55 menu.scrollDownButtonX = g; \ 56 menu.scrollDownButtonY = i; \ 57 } while (0) 58 59 #define GUI_LOL_MENU_ITEM(item, a, b, c, d, e, f, g) \ 60 do { \ 61 item.enabled = 1; \ 62 item.itemId = a; \ 63 item.itemString = ""; \ 64 item.useItemString = false; \ 65 item.x = b; \ 66 item.y = c; \ 67 item.width = d; \ 68 item.height = e; \ 69 item.textColor = _vm->gameFlags().use16ColorMode ? 0xC1 : 204; \ 70 item.highlightColor = _vm->gameFlags().use16ColorMode ? 0xE1 : 254; \ 71 item.titleX = -1; \ 72 if (_vm->gameFlags().use16ColorMode) { \ 73 item.bkgdColor = 0xCC; \ 74 item.color1 = 0xFF; \ 75 item.color2 = 0xDD; \ 76 } else { \ 77 item.bkgdColor = 225; \ 78 item.color1 = 223; \ 79 item.color2 = 227; \ 80 } \ 81 item.saveSlot = 0; \ 82 item.labelId = f; \ 83 item.labelString = 0; \ 84 item.labelX = 0; \ 85 item.labelY = 0; \ 86 item.keyCode = g; \ 87 } while (0) 88 89 class LoLEngine; 90 class Screen_LoL; 91 92 class GUI_LoL : public GUI_v1 { 93 friend class LoLEngine; 94 public: 95 GUI_LoL(LoLEngine *vm); 96 97 void initStaticData(); 98 99 // button specific 100 void processButton(Button *button) override; 101 int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) override; 102 103 int redrawShadedButtonCallback(Button *button) override; 104 int redrawButtonCallback(Button *button) override; 105 106 int runMenu(Menu &menu); 107 108 // utilities for thumbnail creation 109 void createScreenThumbnail(Graphics::Surface &dst) override; 110 111 private: 112 void backupPage0(); 113 void restorePage0(); 114 115 void setupSaveMenuSlots(Menu &menu, int num); 116 117 void printMenuText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 flags) override; 118 int getMenuCenterStringX(const Common::String &str, int x1, int x2) override; 119 120 int getInput(); 121 122 int clickedMainMenu(Button *button); 123 int clickedLoadMenu(Button *button); 124 int clickedSaveMenu(Button *button); 125 int clickedDeleteMenu(Button *button); 126 int clickedOptionsMenu(Button *button); 127 int clickedAudioMenu(Button *button); 128 int clickedDeathMenu(Button *button); 129 int clickedSavenameMenu(Button *button); 130 int clickedChoiceMenu(Button *button); 131 132 int scrollUp(Button *button); 133 int scrollDown(Button *button); 134 getButtonListData()135 Button *getButtonListData() override { return _menuButtons; } getScrollUpButton()136 Button *getScrollUpButton() override { return &_scrollUpButton; } getScrollDownButton()137 Button *getScrollDownButton() override { return &_scrollDownButton; } 138 139 getScrollUpButtonHandler()140 Button::Callback getScrollUpButtonHandler() const override { return _scrollUpFunctor; } getScrollDownButtonHandler()141 Button::Callback getScrollDownButtonHandler() const override { return _scrollDownFunctor; } 142 defaultColor1()143 uint8 defaultColor1() const override { return 0xFE; } defaultColor2()144 uint8 defaultColor2() const override { return 0x00; } 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 181