diff options
author | Johannes Schickel | 2008-04-04 06:24:49 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-04 06:24:49 +0000 |
commit | 3dc6f9000de5782ccb1a08cb081300dcb0961580 (patch) | |
tree | bd5dec0cb2f663f3a72b3189c8f0c2c7b6f9d667 | |
parent | 834badfc954750b4adfb3a14c3abf5bfcd6f5600 (diff) | |
download | scummvm-rg350-3dc6f9000de5782ccb1a08cb081300dcb0961580.tar.gz scummvm-rg350-3dc6f9000de5782ccb1a08cb081300dcb0961580.tar.bz2 scummvm-rg350-3dc6f9000de5782ccb1a08cb081300dcb0961580.zip |
Added partial support for main menu. Only load, save and resume buttons are working currently
svn-id: r31375
-rw-r--r-- | engines/kyra/gui.cpp | 15 | ||||
-rw-r--r-- | engines/kyra/gui.h | 2 | ||||
-rw-r--r-- | engines/kyra/gui_v1.cpp | 13 | ||||
-rw-r--r-- | engines/kyra/gui_v1.h | 1 | ||||
-rw-r--r-- | engines/kyra/gui_v2.cpp | 298 | ||||
-rw-r--r-- | engines/kyra/gui_v2.h | 36 | ||||
-rw-r--r-- | engines/kyra/kyra.h | 1 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 48 |
9 files changed, 374 insertions, 42 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index c1d0ba1085..366e1d8432 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -28,6 +28,8 @@ #include "kyra/screen.h" #include "kyra/text.h" +#include "common/savefile.h" + namespace Kyra { GUI::GUI(KyraEngine *kyra) @@ -294,5 +296,18 @@ int GUI::redrawShadedButtonCallback(Button *button) { return 0; } +int GUI::getNextSavegameSlot() { + Common::InSaveFile *in; + + for (int i = 1; i < 1000; i++) { + if ((in = _vm->_saveFileMan->openForLoading(_vm->getSavegameFilename(i)))) + delete in; + else + return i; + } + warning("Didn't save: Ran out of saveGame filenames"); + return 0; +} + } // end of namespace Kyra diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 2724424ff9..ae0ec2014a 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -184,6 +184,8 @@ protected: void redrawText(const Menu &menu); void redrawHighlight(const Menu &menu); + + int getNextSavegameSlot(); }; } // end of namesapce Kyra diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp index c86521a625..96449e31b4 100644 --- a/engines/kyra/gui_v1.cpp +++ b/engines/kyra/gui_v1.cpp @@ -597,19 +597,6 @@ int GUI_v1::resumeGame(Button *button) { return 0; } -int GUI_v1::getNextSavegameSlot() { - Common::InSaveFile *in; - - for (int i = 1; i < 1000; i++) { - if ((in = _vm->_saveFileMan->openForLoading(_vm->getSavegameFilename(i)))) - delete in; - else - return i; - } - warning("Didn't save: Ran out of saveGame filenames"); - return 0; -} - void GUI_v1::setupSavegames(Menu &menu, int num) { Common::InSaveFile *in; static char savenames[5][31]; diff --git a/engines/kyra/gui_v1.h b/engines/kyra/gui_v1.h index 1819a85d18..94c7013ad3 100644 --- a/engines/kyra/gui_v1.h +++ b/engines/kyra/gui_v1.h @@ -113,7 +113,6 @@ private: void setGUILabels(); void setupSavegames(Menu &menu, int num); - int getNextSavegameSlot(); int resumeGame(Button *button); int loadGameMenu(Button *button); diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 82dc465785..4583136743 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -252,6 +252,7 @@ GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI(vm), _vm(vm), _screen(vm->screen_v2()) { _currentMenu = 0; _isDeathMenu = false; _isSaveMenu = false; + _isLoadMenu = false; _scrollUpFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::scrollUpButton); _scrollDownFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::scrollDownButton); } @@ -272,7 +273,7 @@ void GUI_v2::processButton(Button *button) { } return; } - + int entry = button->flags2 & 5; byte val1 = 0, val2 = 0, val3 = 0; @@ -1163,7 +1164,8 @@ void GUI_v2::getInput() { _vm->removeInputTop(); if (_vm->quit()) { _displayMenu = false; - _displaySubMenu = false; + _isLoadMenu = false; + _isSaveMenu = false; } } @@ -1204,12 +1206,16 @@ int GUI_v2::optionsButton(Button *button) { _menuButtons[i].data1Callback = _menuButtons[i].data2Callback = _redrawButtonFunctor; } + initMenuLayout(_mainMenu); //XXX _loadMenu.numberOfItems = 6; initMenuLayout(_loadMenu); - //XXX + initMenuLayout(_saveMenu); + initMenuLayout(_savenameMenu); initMenuLayout(_deathMenu); + _currentMenu = &_mainMenu; + if (_vm->_menuDirectlyToLoad) { backUpPage1(_vm->_screenBuffer); setupPalette(); @@ -1235,14 +1241,13 @@ int GUI_v2::optionsButton(Button *button) { _currentMenu = &_deathMenu; _isDeathMenu = true; } else { - //XXX just fail for now - return 0; + _isDeathMenu = false; } backUpPage1(_vm->_screenBuffer); setupPalette(); initMenu(*_currentMenu); - _madeTempSave = false; + _madeSave = false; _loadedSave = false; _vm->_itemInHand = -1; updateAllMenuButtons(); @@ -1257,7 +1262,7 @@ int GUI_v2::optionsButton(Button *button) { getInput(); } - if (_vm->_runFlag && !_loadedSave && !_madeTempSave) { + if (_vm->_runFlag && !_loadedSave && !_madeSave) { restorePalette(); restorePage1(_vm->_screenBuffer); } @@ -1334,9 +1339,13 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) { menu.item[i].enabled = false; } + int startSlot = 0; + if (_isSaveMenu && _savegameOffset == 0) + startSlot = 1; + KyraEngine::SaveHeader header; Common::InSaveFile *in; - for (int i = 0; i < num; ++i) { + for (int i = startSlot; i < num; ++i) { if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(i + _savegameOffset), header)) != 0) { strncpy(_vm->getTableString(menu.item[i].itemId, _vm->_optionsBuffer, 0), header.description.c_str(), 80); menu.item[i].saveSlot = i + _savegameOffset; @@ -1344,11 +1353,19 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) { delete in; } } - + if (_savegameOffset == 0) { - char *dst = _vm->getTableString(menu.item[0].itemId, _vm->_optionsBuffer, 0); - const char *src = _vm->getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->_optionsBuffer, 0); - strcpy(dst, src); + if (_isSaveMenu) { + char *dst = _vm->getTableString(menu.item[0].itemId, _vm->_optionsBuffer, 0); + const char *src = _vm->getTableString(/*_vm->gameFlags().isTalkie ? */10/* : ??*/, _vm->_optionsBuffer, 0); + strcpy(dst, src); + menu.item[0].saveSlot = -2; + menu.item[0].enabled = true; + } else { + char *dst = _vm->getTableString(menu.item[0].itemId, _vm->_optionsBuffer, 0); + const char *src = _vm->getTableString(_vm->gameFlags().isTalkie ? 34 : 42, _vm->_optionsBuffer, 0); + strcpy(dst, src); + } } } @@ -1360,11 +1377,14 @@ int GUI_v2::scrollUpButton(Button *button) { return 0; --_savegameOffset; - if (_displaySubMenu) { + if (_isLoadMenu) { setupSavegameNames(_loadMenu, 5); // original calls something different here... initMenu(_loadMenu); } else if (_isSaveMenu) { + setupSavegameNames(_saveMenu, 5); + // original calls something different here... + initMenu(_saveMenu); } return 0; @@ -1373,11 +1393,14 @@ int GUI_v2::scrollUpButton(Button *button) { int GUI_v2::scrollDownButton(Button *button) { updateMenuButton(button); ++_savegameOffset; - if (_displaySubMenu) { + if (_isLoadMenu) { setupSavegameNames(_loadMenu, 5); // original calls something different here... initMenu(_loadMenu); } else if (_isSaveMenu) { + setupSavegameNames(_saveMenu, 5); + // original calls something different here... + initMenu(_saveMenu); } return 0; @@ -1385,6 +1408,12 @@ int GUI_v2::scrollDownButton(Button *button) { #pragma mark - +int GUI_v2::resumeGame(Button *caller) { + updateMenuButton(caller); + _displayMenu = false; + return 0; +} + int GUI_v2::loadMenu(Button *caller) { if (!_vm->_menuDirectlyToLoad) { updateMenuButton(caller); @@ -1395,18 +1424,18 @@ int GUI_v2::loadMenu(Button *caller) { _savegameOffset = 0; setupSavegameNames(_loadMenu, 5); initMenu(_loadMenu); - _displaySubMenu = true; - _cancelSubMenu = false; + _isLoadMenu = true; + _noLoadProcess = false; _vm->_gameToLoad = -1; updateAllMenuButtons(); _screen->updateScreen(); - while (_displaySubMenu) { + while (_isLoadMenu) { processHighlights(_loadMenu, _vm->_mouseX, _vm->_mouseY); getInput(); } - if (_cancelSubMenu) { + if (_noLoadProcess) { if (!_vm->_menuDirectlyToLoad) { restorePage1(_vm->_screenBuffer); backUpPage1(_vm->_screenBuffer); @@ -1438,11 +1467,242 @@ int GUI_v2::clickLoadSlot(Button *caller) { if (item.saveSlot >= 0) { _vm->_gameToLoad = item.saveSlot; - _displaySubMenu = false; + _isLoadMenu = false; + } + + return 0; +} + +int GUI_v2::cancelLoadMenu(Button *caller) { + updateMenuButton(caller); + _isLoadMenu = false; + _noLoadProcess = true; + return 0; +} + +int GUI_v2::saveMenu(Button *caller) { + //XXX + updateMenuButton(caller); + + restorePage1(_vm->_screenBuffer); + backUpPage1(_vm->_screenBuffer); + + _isSaveMenu = true; + _noSaveProcess = false; + _saveSlot = -1; + _savegameOffset = 0; + setupSavegameNames(_saveMenu, 5); + initMenu(_saveMenu); + + updateAllMenuButtons(); + + while (_isSaveMenu) { + processHighlights(_saveMenu, _vm->_mouseX, _vm->_mouseY); + getInput(); + } + + if (_noSaveProcess) { + restorePage1(_vm->_screenBuffer); + backUpPage1(_vm->_screenBuffer); + initMenu(*_currentMenu); + updateAllMenuButtons(); + return 0; + } else if(_saveSlot <= -1) { + return 0; } + restorePage1(_vm->_screenBuffer); + restorePalette(); + //if (getNextSaveGameslot() == _saveSlot) { + // while (_saveSlot > 1) { + // rename(_vm->getSavegameFilename(_saveSlot-1), _vm->getSavegameFilename(_saveSlot)); + // --_saveSlot; + // } + //} + _vm->saveGame(_vm->getSavegameFilename(_saveSlot), _saveDescription); + _displayMenu = false; + _madeSave = true; + return 0; } +int GUI_v2::clickSaveSlot(Button *caller) { + updateMenuButton(caller); + + assert((caller->index-0x10) >= 0 && (caller->index-0x10 <= 6)); + MenuItem &item = _saveMenu.item[caller->index-0x10]; + + if (item.saveSlot >= 0) { + //if (_isDeleteMenu) { + // _slotToDelete = item.saveSlot; + // _isDeleteMenu = false; + // return 0; + //else { + _saveSlot = item.saveSlot; + strcpy(_saveDescription, _vm->getTableString(item.itemId, _vm->_optionsBuffer, 0)); + //} + } else if (item.saveSlot == -2) { + _saveSlot = getNextSavegameSlot(); + memset(_saveDescription, 0, sizeof(_saveDescription)); + } + + restorePage1(_vm->_screenBuffer); + backUpPage1(_vm->_screenBuffer); + + initMenu(_savenameMenu); + _screen->fillRect(0x26, 0x5B, 0x11F, 0x66, 0xFA); + const char *desc = nameInputProcess(_saveDescription, 0x27, 0x5C, 0xFD, 0xFA, 0xFE, 0x50); + restorePage1(_vm->_screenBuffer); + backUpPage1(_vm->_screenBuffer); + if (desc) { + _isSaveMenu = false; + //_isDeleteMenu = false; + } else { + initMenu(_saveMenu); + } + + return 0; +} + +int GUI_v2::cancelSaveMenu(Button *caller) { + updateMenuButton(caller); + _isSaveMenu = false; + //_isDeleteMenu = false; + _noSaveProcess = true; + return 0; +} + +const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 c2, uint8 c3, int bufferSize) { + bool running = true; + int curPos = strlen(buffer); + + int x2 = x, y2 = y; + _text->printText(buffer, x, y, c1, c2, c2); + + for (int i = 0; i < curPos; ++i) + x2 += getCharWidth(buffer[i]); + + drawTextfieldBlock(x2, y2, c3); + + _keyPressed.reset(); + _cancelNameInput = _finishNameInput = false; + while (running) { + processHighlights(_savenameMenu, _vm->_mouseX, _vm->_mouseY); + checkTextfieldInput(); + if (_keyPressed.keycode == Common::KEYCODE_RETURN || _keyPressed.keycode == Common::KEYCODE_KP_ENTER || _finishNameInput) { + if (checkSavegameDescription(buffer, curPos)) { + buffer[curPos] = 0; + running = false; + } else { + _finishNameInput = false; + } + } else if (_keyPressed.keycode == Common::KEYCODE_ESCAPE || _cancelNameInput) { + running = false; + return 0; + } else if ((_keyPressed.keycode == Common::KEYCODE_BACKSPACE || _keyPressed.keycode == Common::KEYCODE_DELETE) && curPos > 0) { + drawTextfieldBlock(x2, y2, c2); + --curPos; + x2 -= getCharWidth(buffer[curPos]); + drawTextfieldBlock(x2, y2, c3); + _screen->updateScreen(); + } else if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127 && curPos < bufferSize) { + if (x2 + getCharWidth(_keyPressed.ascii) + 7 < 0x11F) { + buffer[curPos] = _keyPressed.ascii; + const char text[2] = { buffer[curPos], 0 }; + _text->printText(text, x2, y2, c1, c2, c2); + x2 += getCharWidth(_keyPressed.ascii); + drawTextfieldBlock(x2, y2, c3); + ++curPos; + _screen->updateScreen(); + } + } + + _keyPressed.reset(); + } + + return buffer; +} + +int GUI_v2::finishSavename(Button *caller) { + updateMenuButton(caller); + _finishNameInput = true; + return 0; +} + +int GUI_v2::cancelSavename(Button *caller) { + updateMenuButton(caller); + _cancelNameInput = true; + return 0; +} + +bool GUI_v2::checkSavegameDescription(const char *buffer, int size) { + if (!buffer || !size) + return false; + if (buffer[0] == 0) + return false; + for (int i = 0; i < size; ++i) { + if (buffer[i] != 0x20) + return true; + else if (buffer[i] == 0x00) + return false; + } + return false; +} + +int GUI_v2::getCharWidth(uint8 c) { + Screen::FontId old = _screen->setFont(Screen::FID_8_FNT); + _screen->_charWidth = -2; + int width = _screen->getCharWidth(c); + _screen->_charWidth = 0; + _screen->setFont(old); + return width; +} + +void GUI_v2::checkTextfieldInput() { + Common::Event event; + + bool running = true; + int keys = 0; + while (_vm->_eventMan->pollEvent(event) && running) { + switch (event.type) { + case Common::EVENT_QUIT: + _vm->_quitFlag = true; + break; + + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) + _vm->_quitFlag = true; + else + _keyPressed = event.kbd; + running = false; + break; + + case Common::EVENT_LBUTTONUP: { + Common::Point pos = _vm->getMousePos(); + _vm->_mouseX = pos.x; + _vm->_mouseY = pos.y; + keys = 199; + running = false; + } break; + + case Common::EVENT_MOUSEMOVE: { + Common::Point pos = _vm->getMousePos(); + _vm->_mouseX = pos.x; + _vm->_mouseY = pos.y; + _screen->updateScreen(); + } break; + + default: + break; + } + } + + processButtonList(_menuButtonList, keys | 0x8000); +} + +void GUI_v2::drawTextfieldBlock(int x, int y, uint8 c) { + _screen->fillRect(x+1, y+1, x+7, y+8, c); +} + } // end of namespace Kyra diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index 55387208f4..fbac982bd4 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -111,7 +111,7 @@ private: Button _menuButtons[7]; Button _scrollUpButton; Button _scrollDownButton; - Menu _loadMenu, _deathMenu; + Menu _mainMenu, _loadMenu, _saveMenu, _savenameMenu, _deathMenu; void initStaticData(); const char *getMenuTitle(const Menu &menu); @@ -149,9 +149,10 @@ private: Button *_unknownButtonList; Menu *_currentMenu; + bool _isLoadMenu; bool _isDeathMenu; bool _isSaveMenu; - bool _madeTempSave; + bool _madeSave; bool _loadedSave; bool _restartGame; bool _reloadTemporarySave; @@ -160,12 +161,39 @@ private: void setupSavegameNames(Menu &menu, int num); + // main menu + int resumeGame(Button *caller); + // load menu + bool _noLoadProcess; int loadMenu(Button *caller); int clickLoadSlot(Button *caller); + 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); + + // 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); - static const uint16 MenuStrings_TALKIE[]; - static const uint16 MenuStrings_OTHER[]; + static const uint16 _menuStringsTalkie[]; + static const uint16 _menuStringsOther[]; }; } // end of namespace Kyra diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index 0f760997c1..07c7cddf42 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -104,6 +104,7 @@ class ScriptHelper; class KyraEngine : public Engine { friend class Debugger; friend class ::KyraMetaEngine; +friend class GUI; public: KyraEngine(OSystem *system, const GameFlags &flags); virtual ~KyraEngine(); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index b88ff773c8..f7f579b0e1 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -795,7 +795,7 @@ void Screen::drawBox(int x1, int y1, int x2, int y2, int color) { void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) { debugC(9, kDebugLevelScreen, "Screen::drawShadedBox(%i, %i, %i, %i, %i, %i)", x1, y1, x2, y2, color1, color2); - assert(x1 > 0 && y1 > 0); + assert(x1 >= 0 && y1 >= 0); hideMouse(); fillRect(x1, y1, x2, y1 + 1, color1); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index e35196b021..f599e9b634 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -1506,9 +1506,24 @@ void GUI_v2::initStaticData() { } Button::Callback clickLoadSlotFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::clickLoadSlot); + Button::Callback clickSaveSlotFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::clickSaveSlot); Button::Callback clickLoadMenuFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::loadMenu); - const uint16 *menuStr = _vm->gameFlags().isTalkie ? MenuStrings_TALKIE : MenuStrings_OTHER; + const uint16 *menuStr = _vm->gameFlags().isTalkie ? _menuStringsTalkie : _menuStringsOther; + + GUI_V2_MENU(_mainMenu, -1, -1, 0x100, 0xAC, 0xF8, 0xF9, 0xFA, menuStr[0 * 8], 0xFB, -1, 8, 0, 7, -1, -1, -1, -1); + GUI_V2_MENU_ITEM(_mainMenu.item[0], 1, 0x02, -1, 0x1E, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _mainMenu.item[0].callback = clickLoadMenuFunctor; + GUI_V2_MENU_ITEM(_mainMenu.item[1], 1, 0x03, -1, 0x2F, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _mainMenu.item[1].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::saveMenu); + GUI_V2_MENU_ITEM(_mainMenu.item[2], 1, 0x23, -1, 0x40, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_mainMenu.item[3], 1, 0x04, -1, 0x51, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_mainMenu.item[4], 1, 0x25, -1, 0x62, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_mainMenu.item[5], 1, 0x05, -1, 0x73, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_mainMenu.item[6], 1, 0x06, -1, 0x90, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _mainMenu.item[6].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::resumeGame); + for (int i = 0; i < 7; ++i) + _mainMenu.item[i].itemId = menuStr[0 * 8 + i + 1]; GUI_V2_MENU(_loadMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, menuStr[4 * 8], 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C); GUI_V2_MENU_ITEM(_loadMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); @@ -1519,10 +1534,35 @@ void GUI_v2::initStaticData() { for (int i = 0; i <= 4; ++i) _loadMenu.item[i].callback = clickLoadSlotFunctor; GUI_V2_MENU_ITEM(_loadMenu.item[5], 1, 0x0B, 0xB8, 0x86, 0x58, 0xF, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); - _loadMenu.item[6].enabled = false; + _loadMenu.item[5].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::cancelLoadMenu); + _loadMenu.item[6].enabled = false; for (int i = 0; i < 7; ++i) _loadMenu.item[i].itemId = menuStr[4 * 8 + i + 1]; + GUI_V2_MENU(_saveMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, menuStr[5 * 8], 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C); + GUI_V2_MENU_ITEM(_saveMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_saveMenu.item[1], 1, 0x2A, -1, 0x38, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_saveMenu.item[2], 1, 0x2B, -1, 0x49, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_saveMenu.item[3], 1, 0x2C, -1, 0x5A, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_saveMenu.item[4], 1, 0x2D, -1, 0x6B, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + for (int i = 0; i <= 4; ++i) + _saveMenu.item[i].callback = clickSaveSlotFunctor; + GUI_V2_MENU_ITEM(_saveMenu.item[5], 1, 0x0B, 0xB8, 0x86, 0x58, 0xF, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _saveMenu.item[5].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::cancelSaveMenu); + _saveMenu.item[6].enabled = false; + for (int i = 0; i < 7; ++i) + _saveMenu.item[i].itemId = menuStr[5 * 8 + i + 1]; + + GUI_V2_MENU(_savenameMenu, -1, -1, 0x140, 0x43, 0xF8, 0xF9, 0xFA, menuStr[6 * 8], 0xFB, -1, 8, 0, 2, -1, -1, -1, -1); + GUI_V2_MENU_ITEM(_savenameMenu.item[0], 1, 0xD, 0x18, 0x2C, 0x58, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _savenameMenu.item[0].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::finishSavename); + GUI_V2_MENU_ITEM(_savenameMenu.item[1], 1, 0xB, 0xD0, 0x2C, 0x58, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + _savenameMenu.item[1].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::cancelSavename); + for (int i = 2; i <= 6; ++i) + _savenameMenu.item[i].enabled = false; + for (int i = 0; i < 7; ++i) + _savenameMenu.item[i].itemId = menuStr[6 * 8 + i + 1]; + GUI_V2_MENU(_deathMenu, -1, -1, 0xD0, 0x4C, 0xF8, 0xF9, 0xFA, menuStr[7 * 8], 0xFB, -1, 8, 0, 2, -1, -1, -1, -1); GUI_V2_MENU_ITEM(_deathMenu.item[0], 1, 2, -1, 0x1E, 0xB4, 0x0F, 0xFC, 0xFD, 8, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); _deathMenu.item[0].callback = clickLoadMenuFunctor; @@ -1533,7 +1573,7 @@ void GUI_v2::initStaticData() { _deathMenu.item[i].itemId = menuStr[7 * 8 + i + 1]; } -const uint16 GUI_v2::MenuStrings_TALKIE[] = { +const uint16 GUI_v2::_menuStringsTalkie[] = { 0x001, 0x002, 0x003, 0x023, 0x004, 0x025, 0x005, 0x006, // Main Menu String IDs 0x025, 0x000, 0x000, 0x000, 0x010, 0x000, 0x000, 0x000, // Options Menu String IDs 0x007, 0x000, 0x000, 0x000, 0x010, 0x000, 0x000, 0x000, // Audio Menu String IDs @@ -1544,7 +1584,7 @@ const uint16 GUI_v2::MenuStrings_TALKIE[] = { 0x00E, 0x002, 0x005, 0x000, 0x000, 0x000, 0x000, 0x000 // Death Menu String IDs }; -const uint16 GUI_v2::MenuStrings_OTHER[] = { +const uint16 GUI_v2::_menuStringsOther[] = { 0x009, 0x00A, 0x00B, 0x001, 0x00C, 0x00D, 0x00E, 0x000, // Main Menu String IDs 0x00F, 0x02B, 0x02C, 0x02D, 0x02E, 0x018, 0x000, 0x000, // Options Menu String IDs 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, // Dummy |