diff options
-rw-r--r-- | engines/kyra/eobcommon.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/eobcommon.h | 5 | ||||
-rw-r--r-- | engines/kyra/gui.cpp | 628 | ||||
-rw-r--r-- | engines/kyra/gui.h | 159 | ||||
-rw-r--r-- | engines/kyra/gui_eob.cpp | 54 | ||||
-rw-r--r-- | engines/kyra/gui_eob.h | 27 | ||||
-rw-r--r-- | engines/kyra/gui_lok.h | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lol.cpp | 40 | ||||
-rw-r--r-- | engines/kyra/gui_lol.h | 7 | ||||
-rw-r--r-- | engines/kyra/gui_v1.cpp | 630 | ||||
-rw-r--r-- | engines/kyra/gui_v1.h | 198 | ||||
-rw-r--r-- | engines/kyra/gui_v2.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 5 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 2 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/lol.h | 2 | ||||
-rw-r--r-- | engines/kyra/loleobbase.h | 2 | ||||
-rw-r--r-- | engines/kyra/module.mk | 1 | ||||
-rw-r--r-- | engines/kyra/staticres_eob.cpp | 3 |
23 files changed, 944 insertions, 834 deletions
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index 04739c2735..0cc2f5ab75 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -47,7 +47,6 @@ EobCoreEngine::EobCoreEngine(OSystem *system, const GameFlags &flags) : LolEobBa _runFlag = true; _saveLoadMode = 0; _configMouse = true; - _resting = false; _largeItemShapes = _smallItemShapes = _thrownItemShapes = _spellShapes = _firebeamShapes = _itemIconShapes = _wallOfForceShapes = _teleporterShapes = _sparkShapes = _compassShapes = 0; diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 27e0dc9545..0f9210ee5e 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -251,7 +251,7 @@ public: virtual ~EobCoreEngine(); Screen *screen() { return _screen; } - GUI_v1 *gui() const { return _gui; } + GUI *gui() const { return _gui; } protected: // Startup @@ -786,8 +786,7 @@ protected: void releaseMonsterTempData(LevelTempData *tmp); int _saveLoadMode; - bool _resting; - + Screen_Eob *_screen; GUI_Eob *_gui; diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 3a5d79817e..47461637b1 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -20,352 +20,33 @@ * */ -#include "kyra/gui.h" -#include "kyra/text.h" -#include "kyra/wsamovie.h" +#include "kyra/gui.h" +#include "kyra/kyra_v1.h" +#include "kyra/util.h" #include "common/savefile.h" #include "common/system.h" -namespace Kyra { - -GUI_v1::GUI_v1(KyraEngine_v1 *kyra) - : _vm(kyra), _screen(kyra->screen()), _text(kyra->text()) { - _menuButtonList = 0; - - _redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback); - _redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback); -} - -Button *GUI_v1::addButtonToList(Button *list, Button *newButton) { - if (!newButton) - return list; - - newButton->nextButton = 0; - - if (list) { - Button *cur = list; - while (cur->nextButton) - cur = cur->nextButton; - cur->nextButton = newButton; - } else { - list = newButton; - } - - return list; -} - -void GUI_v1::initMenuLayout(Menu &menu) { - if (menu.x == -1) - menu.x = (320 - menu.width) >> 1; - if (menu.y == -1) - menu.y = (200 - menu.height) >> 1; - - for (int i = 0; i < menu.numberOfItems; ++i) { - if (menu.item[i].x == -1) - menu.item[i].x = (menu.width - menu.item[i].width) >> 1; - } -} - -void GUI_v1::initMenu(Menu &menu) { - _menuButtonList = 0; - - _screen->hideMouse(); - - int textX; - int textY; - - int menu_x2 = menu.width + menu.x - 1; - int menu_y2 = menu.height + menu.y - 1; - - _screen->fillRect(menu.x + 2, menu.y + 2, menu_x2 - 2, menu_y2 - 2, menu.bkgdColor); - _screen->drawShadedBox(menu.x, menu.y, menu_x2, menu_y2, menu.color1, menu.color2); - - if (menu.titleX != -1) - textX = menu.titleX; - else - textX = getMenuCenterStringX(getMenuTitle(menu), menu.x, menu_x2); - textY = menu.y + menu.titleY; - - if (_vm->game() == GI_LOL) { - printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 9); - } else { - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuTitle(menu), textX - 1, textY + 1, defaultColor1(), defaultColor2(), 0); - printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 0); - } - - int x1, y1, x2, y2; - for (int i = 0; i < menu.numberOfItems; ++i) { - if (!menu.item[i].enabled) - continue; - - x1 = menu.x + menu.item[i].x; - y1 = menu.y + menu.item[i].y; - - x2 = x1 + menu.item[i].width - 1; - y2 = y1 + menu.item[i].height - 1; - - if (i < 7) { - Button *menuButtonData = getButtonListData() + i; - menuButtonData->nextButton = 0; - menuButtonData->x = x1; - menuButtonData->y = y1; - menuButtonData->width = menu.item[i].width - 1; - menuButtonData->height = menu.item[i].height - 1; - menuButtonData->buttonCallback = menu.item[i].callback; - menuButtonData->keyCode = menu.item[i].keyCode; - menuButtonData->keyCode2 = 0; - menuButtonData->arg = menu.item[i].itemId; - - _menuButtonList = addButtonToList(_menuButtonList, menuButtonData); - } - - _screen->fillRect(x1, y1, x2, y2, menu.item[i].bkgdColor); - _screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2); - - if (getMenuItemTitle(menu.item[i])) { - if (menu.item[i].titleX != -1) - textX = x1 + menu.item[i].titleX + 3; - else - textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); - - textY = y1 + 2; - if (_vm->game() == GI_LOL) { - textY++; - if (i == menu.highlightedItem) - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8); - else - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); - } else { - Screen::FontId of = _screen->_currentFont; - if (menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); - - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); - - if (i == menu.highlightedItem) - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); - else - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); - - _screen->setFont(of); - } - } - } - - for (int i = 0; i < menu.numberOfItems; ++i) { - if (getMenuItemLabel(menu.item[i])) { - if (_vm->game() == GI_LOL) { - menu.item[i].labelX = menu.item[i].x - 1; - menu.item[i].labelY = menu.item[i].y + 3; - printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 10); - } else { - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0); - printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 0); - } - } - } - - if (menu.scrollUpButtonX != -1) { - Button *scrollUpButton = getScrollUpButton(); - scrollUpButton->x = menu.scrollUpButtonX + menu.x; - scrollUpButton->y = menu.scrollUpButtonY + menu.y; - scrollUpButton->buttonCallback = getScrollUpButtonHandler(); - scrollUpButton->nextButton = 0; - scrollUpButton->mouseWheel = -1; - - _menuButtonList = addButtonToList(_menuButtonList, scrollUpButton); - updateMenuButton(scrollUpButton); - - Button *scrollDownButton = getScrollDownButton(); - scrollDownButton->x = menu.scrollDownButtonX + menu.x; - scrollDownButton->y = menu.scrollDownButtonY + menu.y; - scrollDownButton->buttonCallback = getScrollDownButtonHandler(); - scrollDownButton->nextButton = 0; - scrollDownButton->mouseWheel = 1; - - _menuButtonList = addButtonToList(_menuButtonList, scrollDownButton); - updateMenuButton(scrollDownButton); - } - - _screen->showMouse(); - _screen->updateScreen(); -} - -void GUI_v1::processHighlights(Menu &menu) { - int x1, y1, x2, y2; - Common::Point p = _vm->getMousePos(); - int mouseX = p.x; - int mouseY = p.y; - - if (_vm->game() == GI_LOL && menu.highlightedItem != 255) { - // LoL doesnt't have default highlighted items. - // We use a highlightedItem value of 255 for this. - - // With LoL no highlighting should take place unless the - // mouse cursor moves over a button. The highlighting should end - // when the mouse cursor leaves the button. - if (menu.item[menu.highlightedItem].enabled) - redrawText(menu); - } - - for (int i = 0; i < menu.numberOfItems; ++i) { - if (!menu.item[i].enabled) - continue; - - x1 = menu.x + menu.item[i].x; - y1 = menu.y + menu.item[i].y; - - x2 = x1 + menu.item[i].width; - y2 = y1 + menu.item[i].height; - - if (mouseX > x1 && mouseX < x2 && - mouseY > y1 && mouseY < y2) { - - if (menu.highlightedItem != i || _vm->game() == GI_LOL) { - if (_vm->game() != GI_LOL) { - if (menu.item[menu.highlightedItem].enabled) - redrawText(menu); - } - - menu.highlightedItem = i; - redrawHighlight(menu); - } - } - } - - _screen->updateScreen(); -} - -void GUI_v1::redrawText(const Menu &menu) { - int textX; - int i = menu.highlightedItem; - - int x1 = menu.x + menu.item[i].x; - int y1 = menu.y + menu.item[i].y; - - int x2 = x1 + menu.item[i].width - 1; - - if (menu.item[i].titleX >= 0) - textX = x1 + menu.item[i].titleX + 3; - else - textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); +namespace Kyra { - int textY = y1 + 2; - if (_vm->game() == GI_LOL) { - textY++; - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); - } else { - Screen::FontId of = _screen->_currentFont; - if (menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); - _screen->setFont(of); - } +GUI::GUI(KyraEngine_v1 *kyra) : _vm(kyra), _screen(kyra->screen()) { + _savegameListUpdateNeeded = false; + _savegameListSize = 0; + _savegameList = 0; } -void GUI_v1::redrawHighlight(const Menu &menu) { - int textX; - int i = menu.highlightedItem; - - int x1 = menu.x + menu.item[i].x; - int y1 = menu.y + menu.item[i].y; - - int x2 = x1 + menu.item[i].width - 1; - - if (menu.item[i].titleX != -1) - textX = x1 + menu.item[i].titleX + 3; - else - textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); - - int textY = y1 + 2; - - if (_vm->game() == GI_LOL) { - textY++; - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8); - } else { - Screen::FontId of = _screen->_currentFont; - if (menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); - _screen->setFont(of); +GUI::~GUI() { + if (_savegameList) { + for (int i = 0; i < _savegameListSize; i++) + delete[] _savegameList[i]; + delete[] _savegameList; + _savegameList = 0; } } -void GUI_v1::updateAllMenuButtons() { - for (Button *cur = _menuButtonList; cur; cur = cur->nextButton) - updateMenuButton(cur); -} - -void GUI_v1::updateMenuButton(Button *button) { - if (!_displayMenu) - return; - - _screen->hideMouse(); - updateButton(button); - _screen->updateScreen(); - _screen->showMouse(); -} - -void GUI_v1::updateButton(Button *button) { - if (!button || (button->flags & 8)) - return; - - if (button->flags2 & 1) - button->flags2 &= 0xFFF7; - else - button->flags2 |= 8; - - button->flags2 &= 0xFFFC; - - if (button->flags2 & 4) - button->flags2 |= 0x10; - else - button->flags2 &= 0xEEEF; - - button->flags2 &= 0xFFFB; - - processButton(button); -} - -int GUI_v1::redrawButtonCallback(Button *button) { - if (!_displayMenu) - return 0; - - _screen->hideMouse(); - if (_vm->gameFlags().platform == Common::kPlatformAmiga) - _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 17); - else - _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xF8); - _screen->showMouse(); - - return 0; -} - -int GUI_v1::redrawShadedButtonCallback(Button *button) { - if (!_displayMenu) - return 0; - - _screen->hideMouse(); - if (_vm->gameFlags().platform == Common::kPlatformAmiga) - _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 31, 18); - else - _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xF9, 0xFA); - _screen->showMouse(); - - return 0; -} - -void GUI_v1::updateSaveList(bool excludeQuickSaves) { +void GUI::updateSaveList(bool excludeQuickSaves) { Common::String pattern = _vm->_targetName + ".???"; Common::StringArray saveFileList = _vm->_saveFileMan->listSavefiles(pattern); _saveSlots.clear(); @@ -391,13 +72,13 @@ void GUI_v1::updateSaveList(bool excludeQuickSaves) { sortSaveSlots(); } -void GUI_v1::sortSaveSlots() { +void GUI::sortSaveSlots() { Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>()); if (_saveSlots.size() > 2) Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>()); } -int GUI_v1::getNextSavegameSlot() { +int GUI::getNextSavegameSlot() { Common::InSaveFile *in; int start = _vm->game() == GI_LOL ? 0 : 1; @@ -412,266 +93,47 @@ int GUI_v1::getNextSavegameSlot() { return 0; } -void GUI_v1::checkTextfieldInput() { - Common::Event event; - - uint32 now = _vm->_system->getMillis(); - - bool running = true; - int keys = 0; - while (running && _vm->_eventMan->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL)) - _vm->quitGame(); - else - _keyPressed = event.kbd; - running = false; - break; - - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_LBUTTONUP: { - Common::Point pos = _vm->getMousePos(); - _vm->_mouseX = pos.x; - _vm->_mouseY = pos.y; - keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800); - running = false; - } break; - - case Common::EVENT_MOUSEMOVE: { - Common::Point pos = _vm->getMousePos(); - _vm->_mouseX = pos.x; - _vm->_mouseY = pos.y; - - _vm->_system->updateScreen(); - _lastScreenUpdate = now; - } break; - - default: - break; - } - } - - if (now - _lastScreenUpdate > 50) { - _vm->_system->updateScreen(); - _lastScreenUpdate = now; - } - - processButtonList(_menuButtonList, keys | 0x8000, 0); - _vm->_system->delayMillis(3); -} - -void GUI_v1::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) { - _text->printText(str, x, y, c0, c1, c2); -} - -int GUI_v1::getMenuCenterStringX(const char *str, int x1, int x2) { - return _text->getCenterStringX(str, x1, x2); -} - -#pragma mark - - -MainMenu::MainMenu(KyraEngine_v1 *vm) : _vm(vm), _screen(0) { - _screen = _vm->screen(); - _nextUpdate = 0; - _system = g_system; -} - -void MainMenu::init(StaticData data, Animation anim) { - _static = data; - _anim = anim; - _animIntern.curFrame = _anim.startFrame; - _animIntern.direction = 1; -} - -void MainMenu::updateAnimation() { - if (_anim.anim) { - uint32 now = _system->getMillis(); - if (now > _nextUpdate) { - _nextUpdate = now + _anim.delay * _vm->tickLength(); - - _anim.anim->displayFrame(_animIntern.curFrame, 0, 0, 0, 0, 0, 0); - _animIntern.curFrame += _animIntern.direction; - if (_animIntern.curFrame < _anim.startFrame) { - _animIntern.curFrame = _anim.startFrame; - _animIntern.direction = 1; - } else if (_animIntern.curFrame > _anim.endFrame) { - _animIntern.curFrame = _anim.endFrame; - _animIntern.direction = -1; - } - } - } - - _screen->updateScreen(); -} - -bool MainMenu::getInput() { - Common::Event event; - Common::EventManager *eventMan = _vm->getEventManager(); - - bool updateScreen = false; - - while (eventMan->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_LBUTTONUP: - return true; +void GUI::updateSavegameList() { + if (!_savegameListUpdateNeeded) + return; - case Common::EVENT_MOUSEMOVE: - updateScreen = true; - break; + _savegameListUpdateNeeded = false; - default: - break; - } + if (_savegameList) { + for (int i = 0; i < _savegameListSize; i++) + delete[] _savegameList[i]; + delete[] _savegameList; } - if (updateScreen) - _system->updateScreen(); - return false; -} - -int MainMenu::handle(int dim) { - int command = -1; - - uint8 colorMap[16]; - memset(colorMap, 0, sizeof(colorMap)); - _screen->setTextColorMap(colorMap); - - Screen::FontId oldFont = _screen->setFont(_static.font); - int charWidthBackUp = _screen->_charWidth; - - if (_vm->game() != GI_LOL) - _screen->_charWidth = -2; - _screen->setScreenDim(dim); - - int backUpX = _screen->_curDim->sx; - int backUpY = _screen->_curDim->sy; - int backUpWidth = _screen->_curDim->w; - int backUpHeight = _screen->_curDim->h; - _screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 0, 3); - - int x = _screen->_curDim->sx << 3; - int y = _screen->_curDim->sy; - int width = _screen->_curDim->w << 3; - int height = _screen->_curDim->h; - - drawBox(x, y, width, height, 1); - drawBox(x + 1, y + 1, width - 2, height - 2, 0); + updateSaveList(true); + _savegameListSize = _saveSlots.size(); - int selected = 0; + if (_savegameListSize) { + Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>()); - draw(selected); + KyraEngine_v1::SaveHeader header; + Common::InSaveFile *in; - while (!_screen->isMouseVisible()) - _screen->showMouse(); + _savegameList = new char *[_savegameListSize]; - int fh = _screen->getFontHeight(); - if (_vm->gameFlags().lang == Common::JA_JPN) - fh++; - - int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; - - Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * _static.menuTable[3]); - - while (!_vm->shouldQuit()) { - updateAnimation(); - bool mousePressed = getInput(); - - Common::Point mouse = _vm->getMousePos(); - if (menuRect.contains(mouse)) { - int item = (mouse.y - menuRect.top) / fh; - - if (item != selected) { - printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[5], 0, 5, _static.strings[selected]); - printString("%s", textPos, menuRect.top + item * fh, _static.menuTable[6], 0, 5, _static.strings[item]); - - selected = item; - } - - if (mousePressed) { - for (int i = 0; i < 3; i++) { - printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[5], 0, 5, _static.strings[selected]); - _screen->updateScreen(); - _system->delayMillis(50); - printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[6], 0, 5, _static.strings[selected]); - _screen->updateScreen(); - _system->delayMillis(50); - } - command = item; - break; + for (int i = 0; i < _savegameListSize; i++) { + in = _vm->openSaveForReading(_vm->getSavegameFilename(i), header); + if (in) { + _savegameList[i] = new char[header.description.size() + 1]; + Common::strlcpy(_savegameList[i], header.description.c_str(), header.description.size() + 1); + Util::convertISOToDOS(_savegameList[i]); + delete in; + } else { + _savegameList[i] = 0; + error("GUI::updateSavegameList(): Unexpected missing save file for slot: %d.", i); } } - _system->delayMillis(10); - } - - if (_vm->shouldQuit()) - command = -1; - _screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0); - _screen->_charWidth = charWidthBackUp; - _screen->setFont(oldFont); - - return command; -} - -void MainMenu::draw(int select) { - int top = _screen->_curDim->sy; - top += _static.menuTable[1]; - int fh = _screen->getFontHeight(); - if (_vm->gameFlags().lang == Common::JA_JPN) - fh++; - - for (int i = 0; i < _static.menuTable[3]; ++i) { - int curY = top + i * fh; - int color = (i == select) ? _static.menuTable[6] : _static.menuTable[5]; - printString("%s", ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5, _static.strings[i]); + } else { + _savegameList = 0; } } -void MainMenu::drawBox(int x, int y, int w, int h, int fill) { - --w; --h; - - if (fill) - _screen->fillRect(x, y, x+w, y+h, _static.colorTable[0]); - - _screen->drawClippedLine(x, y+h, x+w, y+h, _static.colorTable[1]); - _screen->drawClippedLine(x+w, y, x+w, y+h, _static.colorTable[1]); - _screen->drawClippedLine(x, y, x+w, y, _static.colorTable[2]); - _screen->drawClippedLine(x, y, x, y+h, _static.colorTable[2]); - - _screen->setPagePixel(_screen->_curPage, x, y+h, _static.colorTable[3]); - _screen->setPagePixel(_screen->_curPage, x+w, y, _static.colorTable[3]); -} - -void MainMenu::printString(const char *format, int x, int y, int col1, int col2, int flags, ...) { - if (!format) - return; - - va_list vaList; - va_start(vaList, flags); - Common::String string = Common::String::vformat(format, vaList); - va_end(vaList); - - if (flags & 1) - x -= _screen->getTextWidth(string.c_str()) >> 1; - - if (flags & 2) - x -= _screen->getTextWidth(string.c_str()); - - if (_vm->gameFlags().use16ColorMode) - flags &= 3; - - if (flags & 4) { - _screen->printText(string.c_str(), x - 1, y, _static.altColor, col2); - _screen->printText(string.c_str(), x, y + 1, _static.altColor, col2); - } +} // End of namespace Kyra - if (flags & 8) { - _screen->printText(string.c_str(), x - 1, y, 227, col2); - _screen->printText(string.c_str(), x, y + 1, 227, col2); - } - _screen->printText(string.c_str(), x, y, col1, col2); -} - -} // End of namespace Kyra diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 597f088c0d..efca845482 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -93,118 +93,24 @@ struct Button { uint16 arg; }; -struct MenuItem { - bool enabled; - - const char *itemString; - uint16 itemId; - - int16 x, y; - uint16 width, height; - - uint8 textColor, highlightColor; - - int16 titleX; - - uint8 color1, color2; - uint8 bkgdColor; - - Button::Callback callback; - - int16 saveSlot; - - const char *labelString; - uint16 labelId; - int16 labelX, labelY; - - uint16 keyCode; -}; - -struct Menu { - int16 x, y; - uint16 width, height; - - uint8 bkgdColor; - uint8 color1, color2; - - const char *menuNameString; - uint16 menuNameId; - - uint8 textColor; - int16 titleX, titleY; - - uint8 highlightedItem; - - uint8 numberOfItems; - - int16 scrollUpButtonX, scrollUpButtonY; - int16 scrollDownButtonX, scrollDownButtonY; - - MenuItem item[7]; -}; - class Screen; class TextDisplayer; -class GUI_v1 { +class GUI { public: - GUI_v1(KyraEngine_v1 *vm); - virtual ~GUI_v1() {} + GUI(KyraEngine_v1 *vm); + virtual ~GUI(); // button specific - virtual Button *addButtonToList(Button *list, Button *newButton); - virtual void processButton(Button *button) = 0; virtual int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) = 0; - virtual int redrawShadedButtonCallback(Button *button); - virtual int redrawButtonCallback(Button *button); - - // menu specific - virtual void initMenuLayout(Menu &menu); - void initMenu(Menu &menu); - - void processHighlights(Menu &menu); - // utilities for thumbnail creation virtual void createScreenThumbnail(Graphics::Surface &dst) = 0; protected: KyraEngine_v1 *_vm; Screen *_screen; - TextDisplayer *_text; - - Button *_menuButtonList; - bool _displayMenu; - bool _displaySubMenu; - bool _cancelSubMenu; - - virtual void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2); - virtual int getMenuCenterStringX(const char *str, int x1, int x2); - - Button::Callback _redrawShadedButtonFunctor; - Button::Callback _redrawButtonFunctor; - - virtual Button *getButtonListData() = 0; - virtual Button *getScrollUpButton() = 0; - virtual Button *getScrollDownButton() = 0; - - virtual Button::Callback getScrollUpButtonHandler() const = 0; - virtual Button::Callback getScrollDownButtonHandler() const = 0; - - virtual uint8 defaultColor1() const = 0; - virtual uint8 defaultColor2() const = 0; - - virtual const char *getMenuTitle(const Menu &menu) = 0; - virtual const char *getMenuItemTitle(const MenuItem &menuItem) = 0; - virtual const char *getMenuItemLabel(const MenuItem &menuItem) = 0; - - void updateAllMenuButtons(); - void updateMenuButton(Button *button); - virtual void updateButton(Button *button); - - void redrawText(const Menu &menu); - void redrawHighlight(const Menu &menu); // The engine expects a list of contiguous savegame indices. // Since ScummVM's savegame indices aren't, we re-index them. @@ -212,65 +118,18 @@ protected: Common::Array<int> _saveSlots; void updateSaveList(bool excludeQuickSaves = false); int getNextSavegameSlot(); + void updateSavegameList(); virtual void sortSaveSlots(); uint32 _lastScreenUpdate; - Common::KeyState _keyPressed; - void checkTextfieldInput(); -}; - -class Movie; + char **_savegameList; + int _savegameListSize; + bool _savegameListUpdateNeeded; -class MainMenu { -public: - MainMenu(KyraEngine_v1 *vm); - virtual ~MainMenu() {} - - struct Animation { - Animation() : anim(0), startFrame(0), endFrame(0), delay(0) {} - - Movie *anim; - int startFrame; - int endFrame; - int delay; - }; - - struct StaticData { - const char *strings[5]; - - uint8 menuTable[7]; - uint8 colorTable[4]; - - Screen::FontId font; - uint8 altColor; - }; - - void init(StaticData data, Animation anim); - int handle(int dim); -private: - KyraEngine_v1 *_vm; - Screen *_screen; - OSystem *_system; - - StaticData _static; - struct AnimIntern { - int curFrame; - int direction; - }; - Animation _anim; - AnimIntern _animIntern; - - uint32 _nextUpdate; - - void updateAnimation(); - void draw(int select); - void drawBox(int x, int y, int w, int h, int fill); - bool getInput(); - - void printString(const char *string, int x, int y, int col1, int col2, int flags, ...) GCC_PRINTF(2, 8); + Common::KeyState _keyPressed; }; -} // end of namesapce Kyra +} // End of namespace Kyra #endif diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index 5d86b9c589..6eab4a0083 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -29,6 +29,7 @@ #include "kyra/util.h" #include "common/system.h" +#include "common/savefile.h" namespace Kyra { @@ -1428,12 +1429,9 @@ void EobCoreEngine::gui_processInventorySlotClick(int slot) { } } -GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) { +GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) { _scrollUpFunctor = _scrollDownFunctor = BUTTON_FUNCTOR(GUI_Eob, this, 0); - _redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback); - _redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback); - _menuStringsPrefsTemp = new char*[4]; memset(_menuStringsPrefsTemp, 0, 4 * sizeof(char*)); @@ -1445,7 +1443,6 @@ GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) _cflag = 0xffff; _menuLineSpacing = 0; - //_menuUnk1 = 0; _menuLastInFlags = 0; _menuCur = 0; _menuNumItems = 0; @@ -1462,6 +1459,7 @@ GUI_Eob::GUI_Eob(EobCoreEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) _updateBoxIndex = -1; _highLightBoxTimer = 0; _updateBoxColorIndex = 0; + _needRest = false; } GUI_Eob::~GUI_Eob() { @@ -1979,7 +1977,6 @@ void GUI_Eob::simpleMenu_setup(int sd, int maxItem, const char *const *strings, _screen->updateScreen(); _menuLineSpacing = lineSpacing; - //_menuUnk1 = 0; _menuLastInFlags = 0; _vm->removeInputTop(); } @@ -2081,7 +2078,7 @@ void GUI_Eob::runCampMenu() { bool redrawPortraits = false; bool res = false; _charSelectRedraw = false; - _vm->_resting = false; + _needRest = false; Button *buttonList = 0; for (bool runLoop = true; runLoop && !_vm->shouldQuit(); ) { @@ -2164,7 +2161,7 @@ void GUI_Eob::runCampMenu() { if (_vm->restParty()) runLoop = false; else - _vm->_resting = false; + _needRest = false; redrawPortraits = true; break; @@ -2192,7 +2189,7 @@ void GUI_Eob::runCampMenu() { break; case 0x8007: - if (_vm->_resting) + if (_needRest) displayTextBox(44); // fall through @@ -2207,11 +2204,17 @@ void GUI_Eob::runCampMenu() { break; case 0x8008: - // load + if (runLoadMenu(0, 0)) + runLoop = false; + else + newMenu = 1; break; case 0x8009: - // save + if (runSaveMenu(0, 0)) + displayTextBox(14); + else + newMenu = 1; break; case 0x800a: @@ -2289,8 +2292,21 @@ void GUI_Eob::runCampMenu() { _screen->setFont(of); } -int GUI_Eob::runLoadMenu(int x, int y) { - return 0; +bool GUI_Eob::runLoadMenu(int x, int y) { + const ScreenDim *dm = _screen->getScreenDim(11); + int xo = dm->sx; + int yo = dm->sy; + bool result = false; + _savegameListUpdateNeeded = true; + + _screen->modifyScreenDim(11, dm->sx + (x >> 8), dm->sy + y, dm->w, dm->sy); + + updateSavegameList(); + setupSaveMenuSlots(); + + _screen->modifyScreenDim(11, xo, yo, dm->w, dm->sy); + + return result; } void GUI_Eob::updateBoxFrameHighLight(int box) { @@ -2462,8 +2478,8 @@ void GUI_Eob::simpleMenu_initMenuItemsMask(int menuId, int maxItem, int32 menuIt _menuCur = 0; } -void GUI_Eob::runSaveMenu() { - +bool GUI_Eob::runSaveMenu(int x, int y) { + return true; } void GUI_Eob::runMemorizePrayMenu(int charIndex, int spellType) { @@ -2642,7 +2658,7 @@ void GUI_Eob::runMemorizePrayMenu(int charIndex, int spellType) { } if (inputFlag & 0x8000) { - Button *b = _vm->gui_getButton(buttonList, inputFlag & 0x7fff); + b = _vm->gui_getButton(buttonList, inputFlag & 0x7fff); drawMenuButton(b, true, true, true); _screen->updateScreen(); _vm->_system->delayMillis(80); @@ -2726,7 +2742,7 @@ void GUI_Eob::runMemorizePrayMenu(int charIndex, int spellType) { } else if (_numAssignedSpellsOfType[i * 2]) { _numAssignedSpellsOfType[i * 2]--; - _vm->_resting = true; + _needRest = true; int pg = lh[i] - 1; for (int ii = 0; ii < 10; ii++) { if (!charSpellList[pg * 10 + ii]) { @@ -3164,6 +3180,10 @@ void GUI_Eob::releaseButtons(Button *list) { } } +void GUI_Eob::setupSaveMenuSlots() { + +} + #endif // ENABLE_EOB } // End of namespace Kyra diff --git a/engines/kyra/gui_eob.h b/engines/kyra/gui_eob.h index 6d4edfde24..c8e9744152 100644 --- a/engines/kyra/gui_eob.h +++ b/engines/kyra/gui_eob.h @@ -41,7 +41,7 @@ struct EobRect16 { class DarkMoonEngine; class Screen_Eob; -class GUI_Eob : public GUI_v1 { +class GUI_Eob : public GUI { friend class EobCoreEngine; friend class CharacterGenerator; public: @@ -58,9 +58,9 @@ public: void simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing); int simpleMenu_process(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk); - // Button based menus (camp menu, options, save/load) + // Button based menus (camp menu, load menu) void runCampMenu(); - int runLoadMenu(int x, int y); + bool runLoadMenu(int x, int y); void updateBoxFrameHighLight(int box); @@ -78,7 +78,7 @@ private: void simpleMenu_flashSelection(const char *str, int x, int y, int color1, int color2, int color3); void simpleMenu_initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk); - void runSaveMenu(); + bool runSaveMenu(int x, int y); void runMemorizePrayMenu(int charIndex, int spellType); void scribeScrollDialogue(); @@ -96,6 +96,8 @@ private: Button *linkButton(Button *list, Button *newbt); void releaseButtons(Button *list); + void setupSaveMenuSlots(); + Button _scrollUpButton;//////////////////77 Button _scrollDownButton; @@ -119,7 +121,6 @@ private: Button::Callback _scrollDownFunctor; int _menuLineSpacing; - //int _menuUnk1; int _menuLastInFlags; uint8 _numPages; @@ -127,6 +128,7 @@ private: int8 *_numAssignedSpellsOfType; uint32 _clericSpellAvltyFlags; uint32 _paladinSpellAvltyFlags; + bool _needRest; int _menuCur; int _menuNumItems; @@ -136,21 +138,6 @@ private: int _updateBoxColorIndex; uint32 _highLightBoxTimer; static const EobRect16 _updateBoxFrameHighLights[]; - - // unused - Button *getButtonListData() { return 0; } - Button *getScrollUpButton() { return &_scrollUpButton; } - Button *getScrollDownButton() { return &_scrollDownButton; } - - Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; } - Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; } - - uint8 defaultColor1() const { return 0xFE; } - uint8 defaultColor2() const { return 0x00; } - - const char *getMenuTitle(const Menu &menu) { return 0; } - const char *getMenuItemTitle(const MenuItem &menuItem) { return 0; } - const char *getMenuItemLabel(const MenuItem &menuItem) { return 0; } }; } // End of namespace Kyra diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h index 1d1060312d..d3e0beaa9e 100644 --- a/engines/kyra/gui_lok.h +++ b/engines/kyra/gui_lok.h @@ -23,7 +23,7 @@ #ifndef KYRA_GUI_LOK_H #define KYRA_GUI_LOK_H -#include "kyra/gui.h" +#include "kyra/gui_v1.h" #include "kyra/screen_lok.h" namespace Kyra { diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 681caf93b1..ac3d16be67 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -1848,8 +1848,6 @@ GUI_LoL::GUI_LoL(LoLEngine *vm) : GUI_v1(vm), _vm(vm), _screen(vm->_screen) { _specialProcessButton = _backUpButtonList = 0; _flagsModifier = 0; _sliderSfx = 11; - _savegameList = 0; - _savegameListSize = 0; } void GUI_LoL::processButton(Button *button) { @@ -2530,44 +2528,6 @@ void GUI_LoL::setupSaveMenuSlots(Menu &menu, int num) { } } -void GUI_LoL::updateSavegameList() { - if (!_savegameListUpdateNeeded) - return; - - _savegameListUpdateNeeded = false; - - if (_savegameList) { - for (int i = 0; i < _savegameListSize; i++) - delete[] _savegameList[i]; - delete[] _savegameList; - } - - updateSaveList(true); - _savegameListSize = _saveSlots.size(); - - if (_savegameListSize) { - LoLEngine::SaveHeader header; - Common::InSaveFile *in; - - _savegameList = new char *[_savegameListSize]; - - for (int i = 0; i < _savegameListSize; i++) { - in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i]), header); - if (in) { - _savegameList[i] = new char[header.description.size() + 1]; - Common::strlcpy(_savegameList[i], header.description.c_str(), header.description.size() + 1); - Util::convertISOToDOS(_savegameList[i]); - delete in; - } else { - _savegameList[i] = 0; - warning("GUI_LoL::updateSavegameList(): Unexpected missing save file for slot: %d.", _saveSlots[i]); - } - } - } else { - _savegameList = 0; - } -} - void GUI_LoL::sortSaveSlots() { Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>()); } diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h index 3a8135a1b9..dbf54e41f0 100644 --- a/engines/kyra/gui_lol.h +++ b/engines/kyra/gui_lol.h @@ -25,7 +25,7 @@ #ifndef KYRA_GUI_LOL_H #define KYRA_GUI_LOL_H -#include "kyra/gui.h" +#include "kyra/gui_v1.h" namespace Kyra { #define GUI_LOL_MENU(menu, a, b, c, d, e, f, g, i) \ @@ -112,7 +112,6 @@ private: void restorePage0(); void setupSaveMenuSlots(Menu &menu, int num); - void updateSavegameList(); void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags); int getMenuCenterStringX(const char *str, int x1, int x2); @@ -170,10 +169,6 @@ private: Button::Callback _scrollUpFunctor; Button::Callback _scrollDownFunctor; - char **_savegameList; - int _savegameListSize; - bool _savegameListUpdateNeeded; - virtual void sortSaveSlots(); }; diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp new file mode 100644 index 0000000000..c38c828ff0 --- /dev/null +++ b/engines/kyra/gui_v1.cpp @@ -0,0 +1,630 @@ +/* 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "kyra/gui_v1.h" + +#include "kyra/text.h" +#include "kyra/wsamovie.h" + +#include "common/savefile.h" +#include "common/system.h" + +namespace Kyra { + +GUI_v1::GUI_v1(KyraEngine_v1 *kyra) : GUI(kyra), _text(kyra->text()) { + _menuButtonList = 0; + + _redrawButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawButtonCallback); + _redrawShadedButtonFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::redrawShadedButtonCallback); +} + +Button *GUI_v1::addButtonToList(Button *list, Button *newButton) { + if (!newButton) + return list; + + newButton->nextButton = 0; + + if (list) { + Button *cur = list; + while (cur->nextButton) + cur = cur->nextButton; + cur->nextButton = newButton; + } else { + list = newButton; + } + + return list; +} + +void GUI_v1::initMenuLayout(Menu &menu) { + if (menu.x == -1) + menu.x = (320 - menu.width) >> 1; + if (menu.y == -1) + menu.y = (200 - menu.height) >> 1; + + for (int i = 0; i < menu.numberOfItems; ++i) { + if (menu.item[i].x == -1) + menu.item[i].x = (menu.width - menu.item[i].width) >> 1; + } +} + +void GUI_v1::initMenu(Menu &menu) { + _menuButtonList = 0; + + _screen->hideMouse(); + + int textX; + int textY; + + int menu_x2 = menu.width + menu.x - 1; + int menu_y2 = menu.height + menu.y - 1; + + _screen->fillRect(menu.x + 2, menu.y + 2, menu_x2 - 2, menu_y2 - 2, menu.bkgdColor); + _screen->drawShadedBox(menu.x, menu.y, menu_x2, menu_y2, menu.color1, menu.color2); + + if (menu.titleX != -1) + textX = menu.titleX; + else + textX = getMenuCenterStringX(getMenuTitle(menu), menu.x, menu_x2); + + textY = menu.y + menu.titleY; + + if (_vm->game() == GI_LOL) { + printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 9); + } else { + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + printMenuText(getMenuTitle(menu), textX - 1, textY + 1, defaultColor1(), defaultColor2(), 0); + printMenuText(getMenuTitle(menu), textX, textY, menu.textColor, 0, 0); + } + + int x1, y1, x2, y2; + for (int i = 0; i < menu.numberOfItems; ++i) { + if (!menu.item[i].enabled) + continue; + + x1 = menu.x + menu.item[i].x; + y1 = menu.y + menu.item[i].y; + + x2 = x1 + menu.item[i].width - 1; + y2 = y1 + menu.item[i].height - 1; + + if (i < 7) { + Button *menuButtonData = getButtonListData() + i; + menuButtonData->nextButton = 0; + menuButtonData->x = x1; + menuButtonData->y = y1; + menuButtonData->width = menu.item[i].width - 1; + menuButtonData->height = menu.item[i].height - 1; + menuButtonData->buttonCallback = menu.item[i].callback; + menuButtonData->keyCode = menu.item[i].keyCode; + menuButtonData->keyCode2 = 0; + menuButtonData->arg = menu.item[i].itemId; + + _menuButtonList = addButtonToList(_menuButtonList, menuButtonData); + } + + _screen->fillRect(x1, y1, x2, y2, menu.item[i].bkgdColor); + _screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2); + + if (getMenuItemTitle(menu.item[i])) { + if (menu.item[i].titleX != -1) + textX = x1 + menu.item[i].titleX + 3; + else + textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); + + textY = y1 + 2; + if (_vm->game() == GI_LOL) { + textY++; + if (i == menu.highlightedItem) + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8); + else + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); + } else { + Screen::FontId of = _screen->_currentFont; + if (menu.item[i].saveSlot > 0) + _screen->setFont(Screen::FID_8_FNT); + + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); + + if (i == menu.highlightedItem) + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); + else + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); + + _screen->setFont(of); + } + } + } + + for (int i = 0; i < menu.numberOfItems; ++i) { + if (getMenuItemLabel(menu.item[i])) { + if (_vm->game() == GI_LOL) { + menu.item[i].labelX = menu.item[i].x - 1; + menu.item[i].labelY = menu.item[i].y + 3; + printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 10); + } else { + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0); + printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 0); + } + } + } + + if (menu.scrollUpButtonX != -1) { + Button *scrollUpButton = getScrollUpButton(); + scrollUpButton->x = menu.scrollUpButtonX + menu.x; + scrollUpButton->y = menu.scrollUpButtonY + menu.y; + scrollUpButton->buttonCallback = getScrollUpButtonHandler(); + scrollUpButton->nextButton = 0; + scrollUpButton->mouseWheel = -1; + + _menuButtonList = addButtonToList(_menuButtonList, scrollUpButton); + updateMenuButton(scrollUpButton); + + Button *scrollDownButton = getScrollDownButton(); + scrollDownButton->x = menu.scrollDownButtonX + menu.x; + scrollDownButton->y = menu.scrollDownButtonY + menu.y; + scrollDownButton->buttonCallback = getScrollDownButtonHandler(); + scrollDownButton->nextButton = 0; + scrollDownButton->mouseWheel = 1; + + _menuButtonList = addButtonToList(_menuButtonList, scrollDownButton); + updateMenuButton(scrollDownButton); + } + + _screen->showMouse(); + _screen->updateScreen(); +} + +void GUI_v1::processHighlights(Menu &menu) { + int x1, y1, x2, y2; + Common::Point p = _vm->getMousePos(); + int mouseX = p.x; + int mouseY = p.y; + + if (_vm->game() == GI_LOL && menu.highlightedItem != 255) { + // LoL doesnt't have default highlighted items. + // We use a highlightedItem value of 255 for this. + + // With LoL no highlighting should take place unless the + // mouse cursor moves over a button. The highlighting should end + // when the mouse cursor leaves the button. + if (menu.item[menu.highlightedItem].enabled) + redrawText(menu); + } + + for (int i = 0; i < menu.numberOfItems; ++i) { + if (!menu.item[i].enabled) + continue; + + x1 = menu.x + menu.item[i].x; + y1 = menu.y + menu.item[i].y; + + x2 = x1 + menu.item[i].width; + y2 = y1 + menu.item[i].height; + + if (mouseX > x1 && mouseX < x2 && + mouseY > y1 && mouseY < y2) { + + if (menu.highlightedItem != i || _vm->game() == GI_LOL) { + if (_vm->game() != GI_LOL) { + if (menu.item[menu.highlightedItem].enabled) + redrawText(menu); + } + + menu.highlightedItem = i; + redrawHighlight(menu); + } + } + } + + _screen->updateScreen(); +} + +void GUI_v1::redrawText(const Menu &menu) { + int textX; + int i = menu.highlightedItem; + + int x1 = menu.x + menu.item[i].x; + int y1 = menu.y + menu.item[i].y; + + int x2 = x1 + menu.item[i].width - 1; + + if (menu.item[i].titleX >= 0) + textX = x1 + menu.item[i].titleX + 3; + else + textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); + + int textY = y1 + 2; + if (_vm->game() == GI_LOL) { + textY++; + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); + } else { + Screen::FontId of = _screen->_currentFont; + if (menu.item[i].saveSlot > 0) + _screen->setFont(Screen::FID_8_FNT); + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); + _screen->setFont(of); + } +} + +void GUI_v1::redrawHighlight(const Menu &menu) { + int textX; + int i = menu.highlightedItem; + + int x1 = menu.x + menu.item[i].x; + int y1 = menu.y + menu.item[i].y; + + int x2 = x1 + menu.item[i].width - 1; + + if (menu.item[i].titleX != -1) + textX = x1 + menu.item[i].titleX + 3; + else + textX = getMenuCenterStringX(getMenuItemTitle(menu.item[i]), x1, x2); + + int textY = y1 + 2; + + if (_vm->game() == GI_LOL) { + textY++; + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8); + } else { + Screen::FontId of = _screen->_currentFont; + if (menu.item[i].saveSlot > 0) + _screen->setFont(Screen::FID_8_FNT); + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); + _screen->setFont(of); + } +} + +void GUI_v1::updateAllMenuButtons() { + for (Button *cur = _menuButtonList; cur; cur = cur->nextButton) + updateMenuButton(cur); +} + +void GUI_v1::updateMenuButton(Button *button) { + if (!_displayMenu) + return; + + _screen->hideMouse(); + updateButton(button); + _screen->updateScreen(); + _screen->showMouse(); +} + +void GUI_v1::updateButton(Button *button) { + if (!button || (button->flags & 8)) + return; + + if (button->flags2 & 1) + button->flags2 &= 0xFFF7; + else + button->flags2 |= 8; + + button->flags2 &= 0xFFFC; + + if (button->flags2 & 4) + button->flags2 |= 0x10; + else + button->flags2 &= 0xEEEF; + + button->flags2 &= 0xFFFB; + + processButton(button); +} + +int GUI_v1::redrawButtonCallback(Button *button) { + if (!_displayMenu) + return 0; + + _screen->hideMouse(); + if (_vm->gameFlags().platform == Common::kPlatformAmiga) + _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 17); + else + _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xF8); + _screen->showMouse(); + + return 0; +} + +int GUI_v1::redrawShadedButtonCallback(Button *button) { + if (!_displayMenu) + return 0; + + _screen->hideMouse(); + if (_vm->gameFlags().platform == Common::kPlatformAmiga) + _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 31, 18); + else + _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xF9, 0xFA); + _screen->showMouse(); + + return 0; +} + +void GUI_v1::checkTextfieldInput() { + Common::Event event; + + uint32 now = _vm->_system->getMillis(); + + bool running = true; + int keys = 0; + while (_vm->_eventMan->pollEvent(event) && running) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.hasFlags(Common::KBD_CTRL)) + _vm->quitGame(); + else + _keyPressed = event.kbd; + running = false; + break; + + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: { + Common::Point pos = _vm->getMousePos(); + _vm->_mouseX = pos.x; + _vm->_mouseY = pos.y; + keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800); + running = false; + } break; + + case Common::EVENT_MOUSEMOVE: { + Common::Point pos = _vm->getMousePos(); + _vm->_mouseX = pos.x; + _vm->_mouseY = pos.y; + + _vm->_system->updateScreen(); + _lastScreenUpdate = now; + } break; + + default: + break; + } + } + + if (now - _lastScreenUpdate > 50) { + _vm->_system->updateScreen(); + _lastScreenUpdate = now; + } + + processButtonList(_menuButtonList, keys | 0x8000, 0); + _vm->_system->delayMillis(3); +} + +void GUI_v1::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) { + _text->printText(str, x, y, c0, c1, c2); +} + +int GUI_v1::getMenuCenterStringX(const char *str, int x1, int x2) { + return _text->getCenterStringX(str, x1, x2); +} + +#pragma mark - + +MainMenu::MainMenu(KyraEngine_v1 *vm) : _vm(vm), _screen(0) { + _screen = _vm->screen(); + _nextUpdate = 0; + _system = g_system; +} + +void MainMenu::init(StaticData data, Animation anim) { + _static = data; + _anim = anim; + _animIntern.curFrame = _anim.startFrame; + _animIntern.direction = 1; +} + +void MainMenu::updateAnimation() { + if (_anim.anim) { + uint32 now = _system->getMillis(); + if (now > _nextUpdate) { + _nextUpdate = now + _anim.delay * _vm->tickLength(); + + _anim.anim->displayFrame(_animIntern.curFrame, 0, 0, 0, 0, 0, 0); + _animIntern.curFrame += _animIntern.direction; + if (_animIntern.curFrame < _anim.startFrame) { + _animIntern.curFrame = _anim.startFrame; + _animIntern.direction = 1; + } else if (_animIntern.curFrame > _anim.endFrame) { + _animIntern.curFrame = _anim.endFrame; + _animIntern.direction = -1; + } + } + } + + _screen->updateScreen(); +} + +bool MainMenu::getInput() { + Common::Event event; + Common::EventManager *eventMan = _vm->getEventManager(); + + bool updateScreen = false; + + while (eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_LBUTTONUP: + return true; + + case Common::EVENT_MOUSEMOVE: + updateScreen = true; + break; + + default: + break; + } + } + + if (updateScreen) + _system->updateScreen(); + return false; +} + +int MainMenu::handle(int dim) { + int command = -1; + + uint8 colorMap[16]; + memset(colorMap, 0, sizeof(colorMap)); + _screen->setTextColorMap(colorMap); + + Screen::FontId oldFont = _screen->setFont(_static.font); + int charWidthBackUp = _screen->_charWidth; + + if (_vm->game() != GI_LOL) + _screen->_charWidth = -2; + _screen->setScreenDim(dim); + + int backUpX = _screen->_curDim->sx; + int backUpY = _screen->_curDim->sy; + int backUpWidth = _screen->_curDim->w; + int backUpHeight = _screen->_curDim->h; + _screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 0, 3); + + int x = _screen->_curDim->sx << 3; + int y = _screen->_curDim->sy; + int width = _screen->_curDim->w << 3; + int height = _screen->_curDim->h; + + drawBox(x, y, width, height, 1); + drawBox(x + 1, y + 1, width - 2, height - 2, 0); + + int selected = 0; + + draw(selected); + + while (!_screen->isMouseVisible()) + _screen->showMouse(); + + int fh = _screen->getFontHeight(); + if (_vm->gameFlags().lang == Common::JA_JPN) + fh++; + + int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; + + Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * _static.menuTable[3]); + + while (!_vm->shouldQuit()) { + updateAnimation(); + bool mousePressed = getInput(); + + Common::Point mouse = _vm->getMousePos(); + if (menuRect.contains(mouse)) { + int item = (mouse.y - menuRect.top) / fh; + + if (item != selected) { + printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[5], 0, 5, _static.strings[selected]); + printString("%s", textPos, menuRect.top + item * fh, _static.menuTable[6], 0, 5, _static.strings[item]); + + selected = item; + } + + if (mousePressed) { + for (int i = 0; i < 3; i++) { + printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[5], 0, 5, _static.strings[selected]); + _screen->updateScreen(); + _system->delayMillis(50); + printString("%s", textPos, menuRect.top + selected * fh, _static.menuTable[6], 0, 5, _static.strings[selected]); + _screen->updateScreen(); + _system->delayMillis(50); + } + command = item; + break; + } + } + _system->delayMillis(10); + } + + if (_vm->shouldQuit()) + command = -1; + + _screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0); + _screen->_charWidth = charWidthBackUp; + _screen->setFont(oldFont); + + return command; +} + +void MainMenu::draw(int select) { + int top = _screen->_curDim->sy; + top += _static.menuTable[1]; + int fh = _screen->getFontHeight(); + if (_vm->gameFlags().lang == Common::JA_JPN) + fh++; + + for (int i = 0; i < _static.menuTable[3]; ++i) { + int curY = top + i * fh; + int color = (i == select) ? _static.menuTable[6] : _static.menuTable[5]; + printString("%s", ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5, _static.strings[i]); + } +} + +void MainMenu::drawBox(int x, int y, int w, int h, int fill) { + --w; --h; + + if (fill) + _screen->fillRect(x, y, x+w, y+h, _static.colorTable[0]); + + _screen->drawClippedLine(x, y+h, x+w, y+h, _static.colorTable[1]); + _screen->drawClippedLine(x+w, y, x+w, y+h, _static.colorTable[1]); + _screen->drawClippedLine(x, y, x+w, y, _static.colorTable[2]); + _screen->drawClippedLine(x, y, x, y+h, _static.colorTable[2]); + + _screen->setPagePixel(_screen->_curPage, x, y+h, _static.colorTable[3]); + _screen->setPagePixel(_screen->_curPage, x+w, y, _static.colorTable[3]); +} + +void MainMenu::printString(const char *format, int x, int y, int col1, int col2, int flags, ...) { + if (!format) + return; + + va_list vaList; + va_start(vaList, flags); + Common::String string = Common::String::vformat(format, vaList); + va_end(vaList); + + if (flags & 1) + x -= _screen->getTextWidth(string.c_str()) >> 1; + + if (flags & 2) + x -= _screen->getTextWidth(string.c_str()); + + if (_vm->gameFlags().use16ColorMode) + flags &= 3; + + if (flags & 4) { + _screen->printText(string.c_str(), x - 1, y, _static.altColor, col2); + _screen->printText(string.c_str(), x, y + 1, _static.altColor, col2); + } + + if (flags & 8) { + _screen->printText(string.c_str(), x - 1, y, 227, col2); + _screen->printText(string.c_str(), x, y + 1, 227, col2); + } + + _screen->printText(string.c_str(), x, y, col1, col2); +} + +} // End of namespace Kyra + diff --git a/engines/kyra/gui_v1.h b/engines/kyra/gui_v1.h new file mode 100644 index 0000000000..ec0d577982 --- /dev/null +++ b/engines/kyra/gui_v1.h @@ -0,0 +1,198 @@ +/* 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef KYRA_GUI_V1_H +#define KYRA_GUI_V1_H + +#include "kyra/gui.h" + +namespace Kyra { + +struct MenuItem { + bool enabled; + + const char *itemString; + uint16 itemId; + + int16 x, y; + uint16 width, height; + + uint8 textColor, highlightColor; + + int16 titleX; + + uint8 color1, color2; + uint8 bkgdColor; + + Button::Callback callback; + + int16 saveSlot; + + const char *labelString; + uint16 labelId; + int16 labelX, labelY; + + uint16 keyCode; +}; + +struct Menu { + int16 x, y; + uint16 width, height; + + uint8 bkgdColor; + uint8 color1, color2; + + const char *menuNameString; + uint16 menuNameId; + + uint8 textColor; + int16 titleX, titleY; + + uint8 highlightedItem; + + uint8 numberOfItems; + + int16 scrollUpButtonX, scrollUpButtonY; + int16 scrollDownButtonX, scrollDownButtonY; + + MenuItem item[7]; +}; + +class TextDisplayer; + +class GUI_v1 : public GUI { +public: + GUI_v1(KyraEngine_v1 *vm); + virtual ~GUI_v1() {} + + // button specific + virtual Button *addButtonToList(Button *list, Button *newButton); + + virtual void processButton(Button *button) = 0; + virtual int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) = 0; + + virtual int redrawShadedButtonCallback(Button *button); + virtual int redrawButtonCallback(Button *button); + + // menu specific + virtual void initMenuLayout(Menu &menu); + void initMenu(Menu &menu); + + void processHighlights(Menu &menu); + + // utilities for thumbnail creation + virtual void createScreenThumbnail(Graphics::Surface &dst) = 0; + +protected: + TextDisplayer *_text; + + Button *_menuButtonList; + bool _displayMenu; + bool _displaySubMenu; + bool _cancelSubMenu; + + virtual void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2); + virtual int getMenuCenterStringX(const char *str, int x1, int x2); + + Button::Callback _redrawShadedButtonFunctor; + Button::Callback _redrawButtonFunctor; + + virtual Button *getButtonListData() = 0; + virtual Button *getScrollUpButton() = 0; + virtual Button *getScrollDownButton() = 0; + + virtual Button::Callback getScrollUpButtonHandler() const = 0; + virtual Button::Callback getScrollDownButtonHandler() const = 0; + + virtual uint8 defaultColor1() const = 0; + virtual uint8 defaultColor2() const = 0; + + virtual const char *getMenuTitle(const Menu &menu) = 0; + virtual const char *getMenuItemTitle(const MenuItem &menuItem) = 0; + virtual const char *getMenuItemLabel(const MenuItem &menuItem) = 0; + + void updateAllMenuButtons(); + void updateMenuButton(Button *button); + virtual void updateButton(Button *button); + + void redrawText(const Menu &menu); + void redrawHighlight(const Menu &menu); + + uint32 _lastScreenUpdate; + void checkTextfieldInput(); +}; + +class Movie; + +class MainMenu { +public: + MainMenu(KyraEngine_v1 *vm); + virtual ~MainMenu() {} + + struct Animation { + Animation() : anim(0), startFrame(0), endFrame(0), delay(0) {} + + Movie *anim; + int startFrame; + int endFrame; + int delay; + }; + + struct StaticData { + const char *strings[5]; + + uint8 menuTable[7]; + uint8 colorTable[4]; + + Screen::FontId font; + uint8 altColor; + }; + + void init(StaticData data, Animation anim); + int handle(int dim); +private: + KyraEngine_v1 *_vm; + Screen *_screen; + OSystem *_system; + + StaticData _static; + struct AnimIntern { + int curFrame; + int direction; + }; + Animation _anim; + AnimIntern _animIntern; + + uint32 _nextUpdate; + + void updateAnimation(); + void draw(int select); + void drawBox(int x, int y, int w, int h, int fill); + bool getInput(); + + void printString(const char *string, int x, int y, int col1, int col2, int flags, ...) GCC_PRINTF(2, 8); +}; + +} // end of namesapce Kyra + +#endif + diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index 402766b1ca..bdbcce1c4f 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -23,7 +23,7 @@ #ifndef KYRA_GUI_V2_H #define KYRA_GUI_V2_H -#include "kyra/gui.h" +#include "kyra/gui_v1.h" namespace Kyra { diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h index 3acefdde8e..a6add505cb 100644 --- a/engines/kyra/kyra_hof.h +++ b/engines/kyra/kyra_hof.h @@ -199,7 +199,7 @@ public: Screen *screen() { return _screen; } Screen_v2 *screen_v2() const { return _screen; } - GUI_v1 *gui() const { return _gui; } + GUI *gui() const { return _gui; } virtual TextDisplayer *text() { return _text; } int language() const { return _lang; } protected: diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h index 3ecefbac5d..e5fb3cddca 100644 --- a/engines/kyra/kyra_lok.h +++ b/engines/kyra/kyra_lok.h @@ -109,7 +109,7 @@ public: Screen *screen() { return _screen; } Animator_LoK *animator() { return _animator; } - GUI_v1 *gui() const { return _gui; } + GUI *gui() const { return _gui; } virtual Movie *createWSAMovie(); uint8 **shapes() { return _shapes; } diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h index 4b3e8b3fc7..38ff271037 100644 --- a/engines/kyra/kyra_mr.h +++ b/engines/kyra/kyra_mr.h @@ -54,7 +54,7 @@ public: Screen *screen() { return _screen; } Screen_v2 *screen_v2() const { return _screen; } - GUI_v1 *gui() const { return _gui; } + GUI *gui() const { return _gui; } SoundDigital *soundDigital() { return _soundDigital; } int language() const { return _lang; } bool heliumMode() const { return _configHelium; } diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 72cc5bc396..c1b9f2a453 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -345,7 +345,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) _eventList.erase(_eventList.begin()); } - GUI_v1 *guiInstance = gui(); + GUI *guiInstance = gui(); if (guiInstance) { if (keys) return guiInstance->processButtonList(buttonList, keys | eventFlag, mouseWheel); diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 3a4be467ac..f530c02980 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -176,13 +176,14 @@ class TextDisplayer; class StaticResource; class TimerManager; class Debugger; -class GUI_v1; +class GUI; struct Button; class KyraEngine_v1 : public Engine { friend class Debugger; friend class ::KyraMetaEngine; +friend class GUI; friend class GUI_v1; friend class SoundMidiPC; // For _eventMan public: @@ -196,7 +197,7 @@ public: Resource *resource() { return _res; } virtual Screen *screen() = 0; virtual TextDisplayer *text() { return _text; } - virtual GUI_v1 *gui() const { return 0; } + virtual GUI *gui() const { return 0; } Sound *sound() { return _sound; } StaticResource *staticres() { return _staticres; } TimerManager *timer() { return _timer; } diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 7896748b96..3d7b9c4997 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -24,7 +24,7 @@ #define KYRA_KYRA_V2_H #include "kyra/kyra_v1.h" -#include "kyra/gui.h" +#include "kyra/gui_v1.h" #include "kyra/wsamovie.h" #include "kyra/item.h" diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 8e978c1b34..7a4a3ec3e2 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -357,7 +357,7 @@ Screen *LoLEngine::screen() { return _screen; } -GUI_v1 *LoLEngine::gui() const { +GUI *LoLEngine::gui() const { return _gui; } diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a33263fc96..8ddba8607c 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -279,7 +279,7 @@ public: virtual void initKeymap(); Screen *screen(); - GUI_v1 *gui() const; + GUI *gui() const; private: Screen_LoL *_screen; diff --git a/engines/kyra/loleobbase.h b/engines/kyra/loleobbase.h index 8bebfe4306..a2c13827fc 100644 --- a/engines/kyra/loleobbase.h +++ b/engines/kyra/loleobbase.h @@ -86,7 +86,7 @@ public: virtual ~LolEobBaseEngine(); virtual Screen *screen() = 0; - virtual GUI_v1 *gui() const = 0; + virtual GUI *gui() const = 0; protected: // Startup diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index 50bcbdd6e9..6eed6daae4 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -9,6 +9,7 @@ MODULE_OBJS := \ debugger.o \ detection.o \ gui.o \ + gui_v1.o \ gui_lok.o \ gui_v2.o \ gui_hof.o \ diff --git a/engines/kyra/staticres_eob.cpp b/engines/kyra/staticres_eob.cpp index e348ef2616..6800a13da3 100644 --- a/engines/kyra/staticres_eob.cpp +++ b/engines/kyra/staticres_eob.cpp @@ -665,8 +665,7 @@ void EobCoreEngine::initMenus() { { 32, 40, 16, 24, 20, 3, 5 }, { 33, 72, 16, 24, 20, 4, 5 }, { 34, 104, 16, 24, 20, 5, 5 }, - { 35, 136, 16, 24, 20, 6, 5 }, - { 31, 8, 16, 24, 20, 2, 5 } + { 35, 136, 16, 24, 20, 6, 5 } }; _menuButtonDefs = buttonDefs; |