2008-03-28 16:15:00 +00:00
|
|
|
/* 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; \
|
2008-04-01 18:35:14 +00:00
|
|
|
button.data1Val1 = e; \
|
|
|
|
button.data2Val1 = f; \
|
2008-03-28 16:15:00 +00:00
|
|
|
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;
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
#define GUI_V2_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
|
|
|
|
menu.x = a; \
|
|
|
|
menu.y = b; \
|
|
|
|
menu.width = c; \
|
|
|
|
menu.height = d; \
|
|
|
|
menu.bkgdColor = e; \
|
|
|
|
menu.color1 = f; \
|
|
|
|
menu.color2 = g; \
|
|
|
|
menu.menuNameId = 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
|
|
|
|
|
|
|
|
#define GUI_V2_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
|
|
|
|
item.enabled = a; \
|
|
|
|
item.itemId = b; \
|
|
|
|
item.x = c; \
|
|
|
|
item.y = d; \
|
|
|
|
item.width = e; \
|
|
|
|
item.height = f; \
|
|
|
|
item.textColor = g; \
|
|
|
|
item.highlightColor = h; \
|
|
|
|
item.titleX = i; \
|
|
|
|
item.bkgdColor = j; \
|
|
|
|
item.color1 = k; \
|
|
|
|
item.color2 = l; \
|
|
|
|
item.saveSlot = m; \
|
2008-03-30 18:37:27 +00:00
|
|
|
item.labelId = n; \
|
2008-03-30 18:27:46 +00:00
|
|
|
item.labelX = o; \
|
|
|
|
item.labelY = p; \
|
|
|
|
item.unk1F = q
|
|
|
|
|
2008-03-28 16:15:00 +00:00
|
|
|
namespace Kyra {
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
class KyraEngine_HoF;
|
2008-03-28 16:15:00 +00:00
|
|
|
class Screen_v2;
|
|
|
|
|
2008-05-04 15:18:46 +00:00
|
|
|
class GUI_HoF : public GUI {
|
2008-05-02 14:46:30 +00:00
|
|
|
friend class KyraEngine_HoF;
|
2008-03-28 16:15:00 +00:00
|
|
|
public:
|
2008-05-04 15:18:46 +00:00
|
|
|
GUI_HoF(KyraEngine_HoF *engine);
|
2008-03-28 16:15:00 +00:00
|
|
|
|
|
|
|
Button *addButtonToList(Button *list, Button *newButton);
|
|
|
|
|
|
|
|
void processButton(Button *button);
|
|
|
|
int processButtonList(Button *button, uint16 inputFlag);
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
int optionsButton(Button *button);
|
2008-03-28 16:15:00 +00:00
|
|
|
private:
|
2008-03-30 18:41:11 +00:00
|
|
|
void getInput();
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
Button _menuButtons[7];
|
|
|
|
Button _scrollUpButton;
|
|
|
|
Button _scrollDownButton;
|
2008-04-04 18:02:50 +00:00
|
|
|
Menu _mainMenu, _gameOptions, _audioOptions, _choiceMenu, _loadMenu, _saveMenu, _savenameMenu, _deathMenu;
|
2008-03-30 18:27:46 +00:00
|
|
|
void initStaticData();
|
|
|
|
|
2008-03-28 16:15:00 +00:00
|
|
|
const char *getMenuTitle(const Menu &menu);
|
|
|
|
const char *getMenuItemTitle(const MenuItem &menuItem);
|
|
|
|
const char *getMenuItemLabel(const MenuItem &menuItem);
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
Button *getButtonListData() { return _menuButtons; }
|
|
|
|
|
|
|
|
Button *getScrollUpButton() { return &_scrollUpButton; }
|
|
|
|
Button *getScrollDownButton() { return &_scrollDownButton; }
|
2008-03-28 16:15:00 +00:00
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
int scrollUpButton(Button *button);
|
|
|
|
int scrollDownButton(Button *button);
|
|
|
|
Button::Callback _scrollUpFunctor;
|
|
|
|
Button::Callback _scrollDownFunctor;
|
|
|
|
Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; }
|
|
|
|
Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; }
|
2008-03-28 16:15:00 +00:00
|
|
|
|
2008-04-06 16:54:51 +00:00
|
|
|
Button _sliderButtons[3][4];
|
2008-04-04 18:02:50 +00:00
|
|
|
|
2008-03-28 16:15:00 +00:00
|
|
|
uint8 defaultColor1() const { return 0xCF; }
|
|
|
|
uint8 defaultColor2() const { return 0xF8; }
|
|
|
|
|
2008-04-04 08:13:35 +00:00
|
|
|
void renewHighlight(Menu &menu);
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
void setupPalette();
|
|
|
|
void restorePalette();
|
|
|
|
|
|
|
|
void backUpPage1(uint8 *buffer);
|
|
|
|
void restorePage1(const uint8 *buffer);
|
|
|
|
|
|
|
|
void resetState(int item);
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
KyraEngine_HoF *_vm;
|
2008-03-28 16:15:00 +00:00
|
|
|
Screen_v2 *_screen;
|
|
|
|
|
|
|
|
bool _buttonListChanged;
|
|
|
|
Button *_backUpButtonList;
|
|
|
|
Button *_unknownButtonList;
|
2008-03-30 18:27:46 +00:00
|
|
|
|
|
|
|
Menu *_currentMenu;
|
2008-04-04 06:24:49 +00:00
|
|
|
bool _isLoadMenu;
|
2008-03-30 18:27:46 +00:00
|
|
|
bool _isDeathMenu;
|
|
|
|
bool _isSaveMenu;
|
2008-04-05 02:22:11 +00:00
|
|
|
bool _isDeleteMenu;
|
2008-04-04 06:45:39 +00:00
|
|
|
bool _isChoiceMenu;
|
2008-04-04 08:13:35 +00:00
|
|
|
bool _isOptionsMenu;
|
2008-04-04 06:24:49 +00:00
|
|
|
bool _madeSave;
|
2008-03-30 18:27:46 +00:00
|
|
|
bool _loadedSave;
|
|
|
|
bool _restartGame;
|
|
|
|
bool _reloadTemporarySave;
|
|
|
|
|
|
|
|
int _savegameOffset;
|
|
|
|
|
|
|
|
void setupSavegameNames(Menu &menu, int num);
|
|
|
|
|
2008-04-04 06:24:49 +00:00
|
|
|
// main menu
|
2008-04-04 06:45:39 +00:00
|
|
|
int quitGame(Button *caller);
|
2008-04-04 06:24:49 +00:00
|
|
|
int resumeGame(Button *caller);
|
|
|
|
|
2008-04-04 08:13:35 +00:00
|
|
|
// options menu
|
|
|
|
int gameOptions(Button *caller);
|
2008-04-06 16:54:51 +00:00
|
|
|
int gameOptionsTalkie(Button *caller);
|
2008-04-04 08:13:35 +00:00
|
|
|
int quitOptionsMenu(Button *caller);
|
|
|
|
|
|
|
|
int toggleWalkspeed(Button *caller);
|
|
|
|
int changeLanguage(Button *caller);
|
|
|
|
int toggleText(Button *caller);
|
|
|
|
|
|
|
|
void setupOptionsButtons();
|
|
|
|
|
2008-04-04 18:02:50 +00:00
|
|
|
// audio menu
|
|
|
|
int audioOptions(Button *caller);
|
|
|
|
|
|
|
|
Button::Callback _sliderHandlerFunctor;
|
|
|
|
int sliderHandler(Button *caller);
|
|
|
|
|
|
|
|
void drawSliderBar(int slider, const uint8 *shape);
|
|
|
|
|
|
|
|
static const int _sliderBarsPosition[];
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
// load menu
|
2008-04-04 06:24:49 +00:00
|
|
|
bool _noLoadProcess;
|
2008-03-30 18:27:46 +00:00
|
|
|
int loadMenu(Button *caller);
|
|
|
|
int clickLoadSlot(Button *caller);
|
2008-04-04 06:24:49 +00:00
|
|
|
int cancelLoadMenu(Button *caller);
|
|
|
|
|
|
|
|
// save menu
|
|
|
|
bool _noSaveProcess;
|
|
|
|
int _saveSlot;
|
|
|
|
char _saveDescription[0x50];
|
|
|
|
|
|
|
|
int saveMenu(Button *caller);
|
|
|
|
int clickSaveSlot(Button *caller);
|
|
|
|
int cancelSaveMenu(Button *caller);
|
|
|
|
|
2008-04-05 02:22:11 +00:00
|
|
|
// delete menu
|
|
|
|
int _slotToDelete;
|
|
|
|
int deleteMenu(Button *caller);
|
|
|
|
|
2008-04-04 06:24:49 +00:00
|
|
|
// savename menu
|
|
|
|
bool _finishNameInput, _cancelNameInput;
|
|
|
|
Common::KeyState _keyPressed;
|
|
|
|
|
|
|
|
const char *nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 c2, uint8 c3, int bufferSize);
|
|
|
|
int finishSavename(Button *caller);
|
|
|
|
int cancelSavename(Button *caller);
|
|
|
|
|
|
|
|
bool checkSavegameDescription(const char *buffer, int size);
|
|
|
|
int getCharWidth(uint8 c);
|
|
|
|
void checkTextfieldInput();
|
|
|
|
void drawTextfieldBlock(int x, int y, uint8 c);
|
2008-04-04 01:12:35 +00:00
|
|
|
|
2008-04-04 06:45:39 +00:00
|
|
|
// choice menu
|
|
|
|
bool _choice;
|
|
|
|
|
|
|
|
bool choiceDialog(int name, bool type);
|
|
|
|
int choiceYes(Button *caller);
|
|
|
|
int choiceNo(Button *caller);
|
|
|
|
|
2008-04-04 06:24:49 +00:00
|
|
|
static const uint16 _menuStringsTalkie[];
|
|
|
|
static const uint16 _menuStringsOther[];
|
2008-03-28 16:15:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace Kyra
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|