/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #ifndef KYRA_GUI_LOK_H #define KYRA_GUI_LOK_H #include "kyra/gui/gui_v1.h" #include "kyra/graphics/screen_lok.h" namespace Kyra { #define GUI_V1_BUTTON(button, a, b, c, d, e, f, g, h, i, j, k) \ do { \ button.nextButton = 0; \ button.index = a; \ button.keyCode = button.keyCode2 = 0; \ button.data0Val1 = b; \ button.data1Val1 = c; \ button.data2Val1 = d; \ button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \ button.flags = e; \ button.dimTableIndex = f; \ button.x = g; \ button.y = h; \ button.width = i; \ button.height = j; \ button.flags2 = k; \ button.mouseWheel = 0; \ button.arg = 0; \ } while (0) #define GUI_V1_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \ do { \ menu.x = a; \ menu.y = b; \ menu.width = c; \ menu.height = d; \ menu.bkgdColor = e; \ menu.color1 = f; \ menu.color2 = g; \ menu.menuNameString = h; \ menu.textColor = i; \ menu.titleX = j; \ menu.titleY = k; \ menu.highlightedItem = l; \ menu.numberOfItems = m; \ menu.scrollUpButtonX = n; \ menu.scrollUpButtonY = o; \ menu.scrollDownButtonX = p; \ menu.scrollDownButtonY = q; \ } while (0) #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) \ do { \ item.enabled = a; \ item.itemString = ""; \ item.x = e; \ item.y = g; \ item.width = h; \ item.height = i; \ item.textColor = j; \ item.highlightColor = k; \ item.titleX = l; \ item.bkgdColor = n; \ item.color1 = o; \ item.color2 = p; \ item.saveSlot = q; \ item.labelString = r; \ item.labelX = s; \ item.labelY = t; \ item.keyCode = v; \ } while (0) class KyraEngine_LoK; class GUI_LoK : public GUI_v1 { friend class KyraEngine_LoK; public: GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen); ~GUI_LoK() override; void processButton(Button *button) override; int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) override; int buttonMenuCallback(Button *caller); void createScreenThumbnail(Graphics::Surface &dst) override; private: void initStaticResource(); Button _menuButtonData[6]; Button _scrollUpButton; Button _scrollDownButton; Button *getButtonListData() override { return _menuButtonData; } Button *getScrollUpButton() override { return &_scrollUpButton; } Button *getScrollDownButton() override { return &_scrollDownButton; } Menu *_menu; bool _pressFlag; void setGUILabels(); void setupSavegames(Menu &menu, int num); int resumeGame(Button *button); int loadGameMenu(Button *button); int saveGameMenu(Button *button); int gameControlsMenu(Button *button); int quitPlaying(Button *button); int quitConfirmYes(Button *button); int quitConfirmNo(Button *button); int loadGame(Button *button); int saveGame(Button *button); int savegameConfirm(Button *button); int cancelSubMenu(Button *button); int scrollUp(Button *button); int scrollDown(Button *button); int controlsChangeMusic(Button *button); int controlsChangeSounds(Button *button); int controlsChangeWalk(Button *button); int controlsChangeText(Button *button); int controlsChangeVoice(Button *button); int controlsApply(Button *button); bool quitConfirm(const char *str); void getInput(); void updateSavegameString(); void redrawTextfield(); void fadePalette(); void restorePalette(); void setupControls(Menu &menu); uint8 defaultColor1() const override { return 12; } uint8 defaultColor2() const override { return 248; } uint8 menuItemLabelColor() const override { return 253; } Common::String getMenuTitle(const Menu &menu) override { return menu.menuNameString; } Common::String getMenuItemTitle(const MenuItem &menuItem) override { return menuItem.itemString; } Common::String getMenuItemLabel(const MenuItem &menuItem) override { return menuItem.labelString; } KyraEngine_LoK *_vm; Screen_LoK *_screen; bool _menuRestoreScreen; uint8 _toplevelMenu; int _savegameOffset; char _savegameName[35 * 4]; // allow extra space, since the string can be UTF-8, temporarily char _savegameNames[5][35 * 4]; const char *_specialSavegameString; bool _resetHanInput; int _inputType; // The purpose of these variables is improved handling of backspace character deletion for // Hangul input. The original allows "deconstruction" of the last glyph, so why shouldn't we... uint8 _inputState; uint16 _backupChars[4]; int _saveLoadNumSlots; Button::Callback _scrollUpFunctor; Button::Callback _scrollDownFunctor; Button::Callback getScrollUpButtonHandler() const override { return _scrollUpFunctor; } Button::Callback getScrollDownButtonHandler() const override { return _scrollDownFunctor; } const char *_voiceTextString; const char *_textSpeedString; const char *_onString; const char *_offString; const char *_confMusicMenuStrings[3]; uint8 _confMusicMenuMod; }; } // End of namespace Kyra #endif