From 7605a9a5174ac5570cc29f92f4b467ab1b350b44 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 28 Mar 2008 16:15:00 +0000 Subject: [PATCH] Changed HoF GUI code to use common GUI code now. svn-id: r31295 --- engines/kyra/gui_v2.cpp | 84 ++++++++++++++++++++------------- engines/kyra/gui_v2.h | 95 ++++++++++++++++++++++++++++++++++++++ engines/kyra/kyra_v2.cpp | 12 +++-- engines/kyra/kyra_v2.h | 47 +++---------------- engines/kyra/staticres.cpp | 76 ++++++++++++++++++------------ 5 files changed, 208 insertions(+), 106 deletions(-) create mode 100644 engines/kyra/gui_v2.h diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 7afed9eb044..dfc82ac5fdc 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -243,26 +243,17 @@ void KyraEngine_v2::loadButtonShapes() { _buttonShapes[18] = _screen->makeShapeCopy(src, 18); } -KyraEngine_v2::Button *KyraEngine_v2::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; - } +GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI(vm), _vm(vm), _screen(vm->screen_v2()) { + _backUpButtonList = _unknownButtonList = 0; +} +Button *GUI_v2::addButtonToList(Button *list, Button *newButton) { + list = GUI::addButtonToList(list, newButton); _buttonListChanged = true; return list; } -void KyraEngine_v2::processButton(Button *button) { +void GUI_v2::processButton(Button *button) { if (!button) return; @@ -276,20 +267,20 @@ void KyraEngine_v2::processButton(Button *button) { int entry = button->flags2 & 5; byte val1 = 0, val2 = 0, val3 = 0; - uint8 *dataPtr = 0; + const uint8 *dataPtr = 0; if (entry == 1) { val1 = button->data1Val1; - dataPtr = button->shapePtr1; + dataPtr = button->data1ShapePtr; val2 = button->data1Val2; val3 = button->data1Val3; } else if (entry == 4 || entry == 5) { val1 = button->data2Val1; - dataPtr = button->shapePtr2; + dataPtr = button->data2ShapePtr; val2 = button->data2Val2; val3 = button->data2Val3; } else { val1 = button->data0Val1; - dataPtr = button->shapePtr0; + dataPtr = button->data0ShapePtr; val2 = button->data0Val2; val3 = button->data0Val3; } @@ -346,7 +337,7 @@ void KyraEngine_v2::processButton(Button *button) { _screen->updateScreen(); } -int KyraEngine_v2::processButtonList(Button *buttonList, uint16 inputFlag) { +int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag) { if (!buttonList) return inputFlag & 0x7FFF; @@ -362,8 +353,8 @@ int KyraEngine_v2::processButtonList(Button *buttonList, uint16 inputFlag) { } } - int mouseX = _mouseX; - int mouseY = _mouseY; + int mouseX = _vm->_mouseX; + int mouseY = _vm->_mouseY; uint16 flags = 0; @@ -554,8 +545,8 @@ int KyraEngine_v2::processButtonList(Button *buttonList, uint16 inputFlag) { buttonList->flags2 |= flags; if (buttonList->buttonCallback) { - removeInputTop(); - if ((this->*buttonList->buttonCallback)(buttonList)) + _vm->removeInputTop(); + if ((*buttonList->buttonCallback.get())(buttonList)) break; } @@ -574,6 +565,30 @@ int KyraEngine_v2::processButtonList(Button *buttonList, uint16 inputFlag) { return returnValue; } +const char *GUI_v2::getMenuTitle(const Menu &menu) { + if (!menu.menuNameId) + return 0; + + return _vm->getTableString(menu.menuNameId, _vm->_optionsBuffer, 1); +} + +const char *GUI_v2::getMenuItemTitle(const MenuItem &menuItem) { + if (!menuItem.itemId) + return 0; + + return _vm->getTableString(menuItem.itemId, _vm->_optionsBuffer, 1); +} + +const char *GUI_v2::getMenuItemLabel(const MenuItem &menuItem) { + if (!menuItem.labelId) + return 0; + + return _vm->getTableString(menuItem.labelId, _vm->_optionsBuffer, 1); +} + +#pragma mark - + + int KyraEngine_v2::buttonInventory(Button *button) { if (!_screen->isMouseVisible()) return 0; @@ -943,18 +958,23 @@ void KyraEngine_v2::showBookPage() { } void KyraEngine_v2::bookLoop() { - static Button bookButtons[] = { - { 0, 0x24, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x82, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookPrevPage }, - { 0, 0x25, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0xB1, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookNextPage }, - { 0, 0x26, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x8F, 0xBE, 0x21, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookClose }, - { 0, 0x27, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x08, 0x08, 0x90, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookPrevPage }, - { 0, 0x28, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0xAA, 0x08, 0x8E, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookNextPage } - }; + Button bookButtons[5]; + + GUI_V2_BUTTON(bookButtons[0], 0x24, 0, 0, 1, 1, 1, 0x4487, 0, 0x82, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + bookButtons[0].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookPrevPage); + GUI_V2_BUTTON(bookButtons[1], 0x25, 0, 0, 1, 1, 1, 0x4487, 0, 0xB1, 0xBE, 0x0A, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + bookButtons[1].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookNextPage); + GUI_V2_BUTTON(bookButtons[2], 0x26, 0, 0, 1, 1, 1, 0x4487, 0, 0x8F, 0xBE, 0x21, 0x0A, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + bookButtons[2].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookClose); + GUI_V2_BUTTON(bookButtons[3], 0x27, 0, 0, 1, 1, 1, 0x4487, 0, 0x08, 0x08, 0x90, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + bookButtons[3].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookPrevPage); + GUI_V2_BUTTON(bookButtons[4], 0x28, 0, 0, 1, 1, 1, 0x4487, 0, 0xAA, 0x08, 0x8E, 0xB4, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + bookButtons[4].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookNextPage); Button *buttonList = 0; for (uint i = 0; i < ARRAYSIZE(bookButtons); ++i) - buttonList = addButtonToList(buttonList, &bookButtons[i]); + buttonList = _gui->addButtonToList(buttonList, &bookButtons[i]); showBookPage(); _bookShown = true; diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h new file mode 100644 index 00000000000..a4307545759 --- /dev/null +++ b/engines/kyra/gui_v2.h @@ -0,0 +1,95 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef KYRA_GUI_V2_H +#define KYRA_GUI_V2_H + +#include "kyra/gui.h" + +#define GUI_V2_BUTTON(button, a, b, c, d, e, f, h, i, j, k, l, m, n, o, p, q, r, s, t) \ + button.nextButton = 0; \ + button.index = a; \ + button.unk6 = b; \ + button.unk8 = c; \ + button.data0Val1 = d; \ + button.data0Val2 = e; \ + button.data0Val3 = f; \ + button.flags = h; \ + button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \ + button.dimTableIndex = i; \ + button.x = j; \ + button.y = k; \ + button.width = l; \ + button.height = m; \ + button.data0Val2 = n; \ + button.data0Val3 = o; \ + button.data1Val2 = p; \ + button.data1Val3 = q; \ + button.data2Val2 = r; \ + button.data2Val3 = s; \ + button.flags2 = t; + +namespace Kyra { + +class KyraEngine_v2; +class Screen_v2; + +class GUI_v2 : public GUI { +friend class KyraEngine_v2; +public: + GUI_v2(KyraEngine_v2 *engine); + + Button *addButtonToList(Button *list, Button *newButton); + + void processButton(Button *button); + int processButtonList(Button *button, uint16 inputFlag); + +private: + const char *getMenuTitle(const Menu &menu); + const char *getMenuItemTitle(const MenuItem &menuItem); + const char *getMenuItemLabel(const MenuItem &menuItem); + + Button *getButtonListData() { return 0; } + Button *getScrollUpButton() { return 0; } + Button *getScrollDownButton() { return 0; } + + Button::Callback getScrollUpButtonHandler() const { return Button::Callback(); } + Button::Callback getScrollDownButtonHandler() const { return Button::Callback(); } + + uint8 defaultColor1() const { return 0xCF; } + uint8 defaultColor2() const { return 0xF8; } + + KyraEngine_v2 *_vm; + Screen_v2 *_screen; + + bool _buttonListChanged; + Button *_backUpButtonList; + Button *_unknownButtonList; +}; + +} // end of namespace Kyra + +#endif + diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 4d8a3a4e35b..3385d4ff0ae 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -120,9 +120,10 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi _sceneList = 0; memset(&_sceneAnimMovie, 0, sizeof(_sceneAnimMovie)); memset(&_wsaSlots, 0, sizeof(_wsaSlots)); - _backUpButtonList = _unknownButtonList = _buttonList = 0; memset(&_buttonShapes, 0, sizeof(_buttonShapes)); + _inventoryButtons = _buttonList = 0; + _dlgBuffer = 0; _conversationState = new int8*[19]; for (int i = 0; i < 19; i++) @@ -155,6 +156,7 @@ KyraEngine_v2::~KyraEngine_v2() { delete [] _mouseSHPBuf; delete _screen; delete _text; + delete _gui; _text = 0; delete _debugger; delete _invWsa.wsa; @@ -192,6 +194,8 @@ int KyraEngine_v2::init() { assert(_debugger); _text = new TextDisplayer_v2(this, _screen); assert(_text); + _gui = new GUI_v2(this); + assert(_gui); if (_flags.isDemo && !_flags.isTalkie) { _screen->loadFont(_screen->FID_8_FNT, "FONT9P.FNT"); @@ -354,7 +358,7 @@ void KyraEngine_v2::startup() { loadButtonShapes(); _loadedZTable = 1; loadZShapes(_loadedZTable); - initMainButtonList(); + initInventoryButtonList(); loadInventoryShapes(); _res->loadFileToBuf("PALETTE.COL", _screen->_currentPalette, 0x300); @@ -817,7 +821,7 @@ int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) { _eventList.erase(_eventList.begin()); } - return processButtonList(buttonList, keys | 0x8000); + return _gui->processButtonList(buttonList, keys | 0x8000); } void KyraEngine_v2::removeInputTop() { @@ -863,6 +867,8 @@ void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) { } void KyraEngine_v2::cleanup() { + delete [] _inventoryButtons; _inventoryButtons = 0; + delete [] _gamePlayBuffer; _gamePlayBuffer = 0; delete [] _unkBuf500Bytes; _unkBuf500Bytes = 0; delete [] _screenBuffer; _screenBuffer = 0; diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 4befc53f9a4..3eaf06d67a7 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -29,6 +29,7 @@ #include "kyra/kyra.h" #include "kyra/script.h" #include "kyra/screen_v2.h" +#include "kyra/gui_v2.h" #include "common/list.h" @@ -161,6 +162,7 @@ struct NestedSequence { class KyraEngine_v2 : public KyraEngine { friend class Debugger_v2; friend class TextDisplayer_v2; +friend class GUI_v2; public: KyraEngine_v2(OSystem *system, const GameFlags &flags); ~KyraEngine_v2(); @@ -306,7 +308,6 @@ protected: void dinoRide(); - struct Button; int checkInput(Button *buttonList, bool mainLoop = false); void removeInputTop(); void handleInput(int x, int y); @@ -605,50 +606,14 @@ protected: int _nextAnimItem; // gui + GUI_v2 *_gui; + void loadButtonShapes(); uint8 *_buttonShapes[19]; - struct Button { - Button *nextButton; - uint16 index; - uint16 unk6; - uint16 unk8; - byte data0Val1; - byte data1Val1; - byte data2Val1; - // XXX - uint16 flags; - uint8 *shapePtr0; - uint8 *shapePtr1; - uint8 *shapePtr2; - uint16 dimTableIndex; - int16 x; - int16 y; - int16 width; - int16 height; - uint8 data0Val2; - uint8 data0Val3; - uint8 data1Val2; - uint8 data1Val3; - uint8 data2Val2; - uint8 data2Val3; - // XXX - uint16 flags2; - typedef int (KyraEngine_v2::*ButtonCallback)(KyraEngine_v2::Button*); - ButtonCallback buttonCallback; - // XXX - }; - - bool _buttonListChanged; + void initInventoryButtonList(); + Button *_inventoryButtons; Button *_buttonList; - Button *_backUpButtonList; - Button *_unknownButtonList; - - void initMainButtonList(); - - void processButton(Button *button); - Button *addButtonToList(Button *list, Button *newButton); - int processButtonList(Button *button, uint16 inputFlag); int scrollInventory(Button *button); int buttonInventory(Button *button); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 865839b1bf3..613d0e10692 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -1424,51 +1424,67 @@ const int8 KyraEngine_v2::_dosTrackMap[] = { const int KyraEngine_v2::_dosTrackMapSize = ARRAYSIZE(KyraEngine_v2::_dosTrackMap); -void KyraEngine_v2::initMainButtonList() { - // note: _buttonDataListPtr - static Button mainButtons[] = { - { 0, 0x1, 0x4F, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x00A, 0x95, 0x39, 0x1D, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, /*&KyraEngine_v2::sub_C9A1*/0 }, - { 0, 0x2, 0x00, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x104, 0x90, 0x3C, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::cauldronButton }, - { 0, 0x5, 0x00, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x0FA, 0x90, 0x0A, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::cauldronClearButton }, - { 0, 0x3, 0x00, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x0CE, 0x90, 0x2C, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::bookButton }, - { 0, 0x4, 0x00, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0, 0x0B6, 0x9D, 0x18, 0x1E, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::scrollInventory }, - { 0, 0x6, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x04D, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0x7, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x061, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0x8, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x075, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0x9, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x089, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xA, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x09D, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xB, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x04D, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xC, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x061, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xD, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x075, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xE, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x089, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory }, - { 0, 0xF, 0x00, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0, 0x09D, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0, &KyraEngine_v2::buttonInventory } - }; +void KyraEngine_v2::initInventoryButtonList() { + delete [] _inventoryButtons; + + _inventoryButtons = new Button[15]; + assert(_inventoryButtons); + + GUI_V2_BUTTON(_inventoryButtons[0], 0x1, 0x4F, 0, 1, 1, 1, 0x4487, 0, 0x00A, 0x95, 0x39, 0x1D, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + /*&KyraEngine_v2::sub_C9A1*/ + + GUI_V2_BUTTON(_inventoryButtons[1], 0x2, 0x00, 0, 1, 1, 1, 0x4487, 0, 0x104, 0x90, 0x3C, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + _inventoryButtons[1].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::cauldronButton); + + GUI_V2_BUTTON(_inventoryButtons[2], 0x5, 0x00, 0, 1, 1, 1, 0x4487, 0, 0x0FA, 0x90, 0x0A, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + _inventoryButtons[2].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::cauldronClearButton); + + GUI_V2_BUTTON(_inventoryButtons[3], 0x3, 0x00, 0, 1, 1, 1, 0x4487, 0, 0x0CE, 0x90, 0x2C, 0x2C, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + _inventoryButtons[3].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::bookButton); + + GUI_V2_BUTTON(_inventoryButtons[4], 0x4, 0x00, 0, 1, 1, 1, 0x4487, 0, 0x0B6, 0x9D, 0x18, 0x1E, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + _inventoryButtons[4].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::scrollInventory); + + Button::Callback inventoryCallback = BUTTON_FUNCTOR(KyraEngine_v2, this, &KyraEngine_v2::buttonInventory); + GUI_V2_BUTTON(_inventoryButtons[5], 0x6, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x04D, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[6], 0x7, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x061, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[7], 0x8, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x075, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[8], 0x9, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x089, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[9], 0xA, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x09D, 0x92, 0x13, 0x15, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[10], 0xB, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x04D, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[11], 0xC, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x061, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[12], 0xD, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x075, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[13], 0xE, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x089, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + GUI_V2_BUTTON(_inventoryButtons[14], 0xF, 0x00, 0, 0, 0, 0, 0x1100, 0, 0x09D, 0xA8, 0x13, 0x14, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0); + + for (int i = 5; i <= 14; ++i) + _inventoryButtons[i].buttonCallback = inventoryCallback; switch (_lang) { case 0: - mainButtons[0].shapePtr0 = _buttonShapes[6]; - mainButtons[0].shapePtr1 = mainButtons[0].shapePtr2 = _buttonShapes[7]; + _inventoryButtons[0].data0ShapePtr = _buttonShapes[6]; + _inventoryButtons[0].data1ShapePtr = _inventoryButtons[0].data2ShapePtr = _buttonShapes[7]; break; case 1: - mainButtons[0].shapePtr0 = _buttonShapes[8]; - mainButtons[0].shapePtr1 = mainButtons[0].shapePtr2 = _buttonShapes[9]; + _inventoryButtons[0].data0ShapePtr = _buttonShapes[8]; + _inventoryButtons[0].data1ShapePtr = _inventoryButtons[0].data2ShapePtr = _buttonShapes[9]; break; case 2: - mainButtons[0].shapePtr0 = _buttonShapes[10]; - mainButtons[0].shapePtr1 = mainButtons[0].shapePtr2 = _buttonShapes[11]; + _inventoryButtons[0].data0ShapePtr = _buttonShapes[10]; + _inventoryButtons[0].data1ShapePtr = _inventoryButtons[0].data2ShapePtr = _buttonShapes[11]; break; default: - mainButtons[0].shapePtr0 = _buttonShapes[6]; - mainButtons[0].shapePtr1 = mainButtons[0].shapePtr2 = _buttonShapes[7]; + _inventoryButtons[0].data0ShapePtr = _buttonShapes[6]; + _inventoryButtons[0].data1ShapePtr = _inventoryButtons[0].data2ShapePtr = _buttonShapes[7]; break; } - _buttonList = &mainButtons[0]; - for (size_t i = 1; i < ARRAYSIZE(mainButtons); ++i) - _buttonList = addButtonToList(_buttonList, &mainButtons[i]); + _buttonList = &_inventoryButtons[0]; + for (size_t i = 1; i < 15; ++i) + _buttonList = _gui->addButtonToList(_buttonList, &_inventoryButtons[i]); } const uint16 KyraEngine_v2::_itemMagicTable[] = {