aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_v1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/gui_v1.cpp')
-rw-r--r--engines/kyra/gui_v1.cpp789
1 files changed, 283 insertions, 506 deletions
diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp
index 1b86b1bb80..5c8b382f14 100644
--- a/engines/kyra/gui_v1.cpp
+++ b/engines/kyra/gui_v1.cpp
@@ -29,6 +29,7 @@
#include "kyra/text.h"
#include "kyra/animator_v1.h"
#include "kyra/sound.h"
+#include "kyra/gui_v1.h"
#include "common/config-manager.h"
#include "common/savefile.h"
@@ -38,31 +39,13 @@
namespace Kyra {
void KyraEngine_v1::initMainButtonList() {
- _haveScrollButtons = false;
_buttonList = &_buttonData[0];
for (int i = 0; _buttonDataListPtr[i]; ++i)
- _buttonList = initButton(_buttonList, _buttonDataListPtr[i]);
-}
-
-Button *KyraEngine_v1::initButton(Button *list, Button *newButton) {
- if (!newButton)
- return list;
- if (!list)
- return newButton;
- Button *cur = list;
-
- while (true) {
- if (!cur->nextButton)
- break;
- cur = cur->nextButton;
- }
-
- cur->nextButton = newButton;
- return list;
+ _buttonList = _gui->addButtonToList(_buttonList, _buttonDataListPtr[i]);
}
int KyraEngine_v1::buttonInventoryCallback(Button *caller) {
- int itemOffset = caller->specialValue - 2;
+ int itemOffset = caller->index - 2;
uint8 inventoryItem = _currentCharacter->inventoryItems[itemOffset];
if (_itemInHand == -1) {
if (inventoryItem == 0xFF) {
@@ -108,7 +91,7 @@ int KyraEngine_v1::buttonInventoryCallback(Button *caller) {
int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
if (!(_deathHandler & 8))
return 1;
- int jewel = caller->specialValue - 0x14;
+ int jewel = caller->index - 0x14;
if (_currentCharacter->sceneId == 210) {
if (_beadStateVar == 4 || _beadStateVar == 6)
return 1;
@@ -201,12 +184,25 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
return 1;
}
-void KyraEngine_v1::processButtonList(Button *list) {
+#pragma mark -
+
+GUI_v1::GUI_v1(KyraEngine_v1 *vm) : GUI(vm), _vm(vm) {
+ _menu = 0;
+ initStaticResource();
+ _scrollUpFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::scrollUp);
+ _scrollDownFunctor = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::scrollDown);
+}
+
+GUI_v1::~GUI_v1() {
+ delete [] _menu;
+}
+
+int GUI_v1::processButtonList(Button *list, uint16 inputFlag) {
if (_haveScrollButtons) {
if (_mouseWheel < 0)
- gui_scrollUp(&_scrollUpButton);
+ scrollUp(&_scrollUpButton);
else if (_mouseWheel > 0)
- gui_scrollDown(&_scrollDownButton);
+ scrollDown(&_scrollDownButton);
}
while (list) {
if (list->flags & 8) {
@@ -227,11 +223,11 @@ void KyraEngine_v1::processButtonList(Button *list) {
}
y += _screen->_screenDimTable[list->dimTableIndex].sy;
- Common::Point mouse = getMousePos();
+ Common::Point mouse = _vm->getMousePos();
if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) {
int processMouseClick = 0;
if (list->flags & 0x400) {
- if (_mousePressFlag) {
+ if (_vm->_mousePressFlag) {
if (!(list->flags2 & 1)) {
list->flags2 |= 1;
list->flags2 |= 4;
@@ -245,13 +241,13 @@ void KyraEngine_v1::processButtonList(Button *list) {
processMouseClick = 1;
}
}
- } else if (_mousePressFlag) {
+ } else if (_vm->_mousePressFlag) {
processMouseClick = 1;
}
if (processMouseClick) {
if (list->buttonCallback) {
- if ((this->*(list->buttonCallback))(list)) {
+ if ((*list->buttonCallback.get())(list)) {
break;
}
}
@@ -272,35 +268,36 @@ void KyraEngine_v1::processButtonList(Button *list) {
list = list->nextButton;
}
+ return 0;
}
-void KyraEngine_v1::processButton(Button *button) {
+void GUI_v1::processButton(Button *button) {
if (!button)
return;
int processType = 0;
- uint8 *shape = 0;
- Button::ButtonCallback callback = 0;
+ const uint8 *shape = 0;
+ Button::Callback callback;
int flags = (button->flags2 & 5);
if (flags == 1) {
- processType = button->process2;
+ processType = button->data2Val1;
if (processType == 1)
- shape = button->process2PtrShape;
+ shape = button->data2ShapePtr;
else if (processType == 4)
- callback = button->process2PtrCallback;
+ callback = button->data2Callback;
} else if (flags == 4 || flags == 5) {
- processType = button->process1;
+ processType = button->data1Val1;
if (processType == 1)
- shape = button->process1PtrShape;
+ shape = button->data1ShapePtr;
else if (processType == 4)
- callback = button->process1PtrCallback;
+ callback = button->data1Callback;
} else {
- processType = button->process0;
+ processType = button->data0Val1;
if (processType == 1)
- shape = button->process0PtrShape;
+ shape = button->data0ShapePtr;
else if (processType == 4)
- callback = button->process0PtrCallback;
+ callback = button->data0Callback;
}
int x = button->x;
@@ -315,70 +312,10 @@ void KyraEngine_v1::processButton(Button *button) {
if (processType == 1 && shape)
_screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10);
else if (processType == 4 && callback)
- (this->*callback)(button);
+ (*callback.get())(button);
}
-void KyraEngine_v1::processAllMenuButtons() {
- if (!_menuButtonList)
- return;
-
- Button *cur = _menuButtonList;
- while (true) {
- if (!cur->nextButton)
- break;
- processMenuButton(cur);
- cur = cur->nextButton;
- }
- return;
-}
-
-void KyraEngine_v1::processMenuButton(Button *button) {
- if (!_displayMenu)
- return;
-
- if (!button || (button->flags & 8))
- return;
-
- if (button->flags2 & 1)
- button->flags2 &= 0xf7;
- else
- button->flags2 |= 8;
-
- button->flags2 &= 0xfc;
-
- if (button->flags2 & 4)
- button->flags2 |= 0x10;
- else
- button->flags2 &= 0xef;
-
- button->flags2 &= 0xfb;
-
- processButton(button);
-}
-
-int KyraEngine_v1::drawBoxCallback(Button *button) {
- if (!_displayMenu)
- return 0;
-
- _screen->hideMouse();
- _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xf8);
- _screen->showMouse();
-
- return 0;
-}
-
-int KyraEngine_v1::drawShadedBoxCallback(Button *button) {
- if (!_displayMenu)
- return 0;
-
- _screen->hideMouse();
- _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xf9, 0xfa);
- _screen->showMouse();
-
- return 0;
-}
-
-void KyraEngine_v1::setGUILabels() {
+void GUI_v1::setGUILabels() {
int offset = 0;
int offsetOptions = 0;
int offsetMainMenu = 0;
@@ -387,146 +324,147 @@ void KyraEngine_v1::setGUILabels() {
int walkspeedGarbageOffset = 36;
int menuLabelGarbageOffset = 0;
- if (_flags.isTalkie) {
- if (_flags.lang == Common::EN_ANY)
+ if (_vm->gameFlags().isTalkie) {
+ if (_vm->gameFlags().lang == Common::EN_ANY)
offset = 52;
- else if (_flags.lang == Common::DE_DEU)
+ else if (_vm->gameFlags().lang == Common::DE_DEU)
offset = 30;
- else if (_flags.lang == Common::FR_FRA || _flags.lang == Common::IT_ITA)
+ else if (_vm->gameFlags().lang == Common::FR_FRA || _vm->gameFlags().lang == Common::IT_ITA)
offset = 6;
offsetOn = offsetMainMenu = offsetOptions = offset;
walkspeedGarbageOffset = 48;
- } else if (_flags.lang == Common::ES_ESP) {
+ } else if (_vm->gameFlags().lang == Common::ES_ESP) {
offsetOn = offsetMainMenu = offsetOptions = offset = -4;
menuLabelGarbageOffset = 72;
- } else if (_flags.lang == Common::DE_DEU) {
+ } else if (_vm->gameFlags().lang == Common::DE_DEU) {
offset = offsetMainMenu = offsetOn = offsetOptions = 24;
- } else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) {
+ } else if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) {
offset = 1;
offsetOptions = 10;
offsetOn = 0;
walkspeedGarbageOffset = 0;
}
- assert(offset + 27 < _guiStringsSize);
+ assert(offset + 27 < _vm->_guiStringsSize);
// The Legend of Kyrandia
- _menu[0].menuName = _guiStrings[0];
+ _menu[0].menuNameString = _vm->_guiStrings[0];
// Load a Game
- _menu[0].item[0].itemString = _guiStrings[1];
+ _menu[0].item[0].itemString = _vm->_guiStrings[1];
// Save a Game
- _menu[0].item[1].itemString = _guiStrings[2];
+ _menu[0].item[1].itemString = _vm->_guiStrings[2];
// Game controls
- _menu[0].item[2].itemString = _guiStrings[3];
+ _menu[0].item[2].itemString = _vm->_guiStrings[3];
// Quit playing
- _menu[0].item[3].itemString = _guiStrings[4];
+ _menu[0].item[3].itemString = _vm->_guiStrings[4];
// Resume game
- _menu[0].item[4].itemString = _guiStrings[5];
+ _menu[0].item[4].itemString = _vm->_guiStrings[5];
// Cancel
- _menu[2].item[5].itemString = _guiStrings[10];
+ _menu[2].item[5].itemString = _vm->_guiStrings[10];
// Enter a description of your saved game:
- _menu[3].menuName = _guiStrings[11];
+ _menu[3].menuNameString = _vm->_guiStrings[11];
// Save
- _menu[3].item[0].itemString = _guiStrings[12];
+ _menu[3].item[0].itemString = _vm->_guiStrings[12];
// Cancel
- _menu[3].item[1].itemString = _guiStrings[10];
+ _menu[3].item[1].itemString = _vm->_guiStrings[10];
// Rest in peace, Brandon
- _menu[4].menuName = _guiStrings[13];
+ _menu[4].menuNameString = _vm->_guiStrings[13];
// Load a game
- _menu[4].item[0].itemString = _guiStrings[1];
+ _menu[4].item[0].itemString = _vm->_guiStrings[1];
// Quit playing
- _menu[4].item[1].itemString = _guiStrings[4];
+ _menu[4].item[1].itemString = _vm->_guiStrings[4];
// Game Controls
- _menu[5].menuName = _guiStrings[6];
+ _menu[5].menuNameString = _vm->_guiStrings[6];
// Yes
- _menu[1].item[0].itemString = _guiStrings[22 + offset];
+ _menu[1].item[0].itemString = _vm->_guiStrings[22 + offset];
// No
- _menu[1].item[1].itemString = _guiStrings[23 + offset];
+ _menu[1].item[1].itemString = _vm->_guiStrings[23 + offset];
// Music is
- _menu[5].item[0].labelString = _guiStrings[26 + offsetOptions];
+ _menu[5].item[0].labelString = _vm->_guiStrings[26 + offsetOptions];
// Sounds are
- _menu[5].item[1].labelString = _guiStrings[27 + offsetOptions];
+ _menu[5].item[1].labelString = _vm->_guiStrings[27 + offsetOptions];
// Walk speed
- _menu[5].item[2].labelString = &_guiStrings[24 + offsetOptions][walkspeedGarbageOffset];
+ _menu[5].item[2].labelString = &_vm->_guiStrings[24 + offsetOptions][walkspeedGarbageOffset];
// Text speed
- _menu[5].item[4].labelString = _guiStrings[25 + offsetOptions];
+ _menu[5].item[4].labelString = _vm->_guiStrings[25 + offsetOptions];
// Main Menu
- _menu[5].item[5].itemString = &_guiStrings[19 + offsetMainMenu][menuLabelGarbageOffset];
+ _menu[5].item[5].itemString = &_vm->_guiStrings[19 + offsetMainMenu][menuLabelGarbageOffset];
- if (_flags.isTalkie)
+ if (_vm->gameFlags().isTalkie)
// Text & Voice
- _voiceTextString = _guiStrings[28 + offset];
+ _voiceTextString = _vm->_guiStrings[28 + offset];
- _textSpeedString = _guiStrings[25 + offsetOptions];
- _onString = _guiStrings[20 + offsetOn];
- _offString = _guiStrings[21 + offset];
- _onCDString = _guiStrings[21];
+ _textSpeedString = _vm->_guiStrings[25 + offsetOptions];
+ _onString = _vm->_guiStrings[20 + offsetOn];
+ _offString = _vm->_guiStrings[21 + offset];
+ _onCDString = _vm->_guiStrings[21];
}
-int KyraEngine_v1::buttonMenuCallback(Button *caller) {
+int GUI_v1::buttonMenuCallback(Button *caller) {
_displayMenu = true;
- assert(_guiStrings);
- assert(_configStrings);
+ assert(_vm->_guiStrings);
+ assert(_vm->_configStrings);
/*
- for (int i = 0; i < _guiStringsSize; i++)
- debug("GUI string %i: %s", i, _guiStrings[i]);
+ for (int i = 0; i < _vm->_guiStringsSize; i++)
+ debug("GUI string %i: %s", i, _vm->_guiStrings[i]);
- for (int i = 0; i < _configStringsSize; i++)
- debug("Config string %i: %s", i, _configStrings[i]);
+ for (int i = 0; i < _vm->_configStringsSize; i++)
+ debug("Config string %i: %s", i, _vm->_configStrings[i]);
*/
setGUILabels();
- if (_currentCharacter->sceneId == 210 && _deathHandler == 0xFF) {
- snd_playSoundEffect(0x36);
+ if (_vm->_currentCharacter->sceneId == 210 && _vm->_deathHandler == 0xFF) {
+ _vm->snd_playSoundEffect(0x36);
return 0;
}
// XXX
_screen->setPaletteIndex(0xFE, 60, 60, 0);
for (int i = 0; i < 6; i++) {
- _menuButtonData[i].process0 = _menuButtonData[i].process1 = _menuButtonData[i].process2 = 4;
- _menuButtonData[i].process0PtrCallback = &KyraEngine_v1::drawShadedBoxCallback;
- _menuButtonData[i].process1PtrCallback = &KyraEngine_v1::drawBoxCallback;
- _menuButtonData[i].process2PtrCallback = &KyraEngine_v1::drawShadedBoxCallback;
+ _menuButtonData[i].data0Val1 = _menuButtonData[i].data1Val1 = _menuButtonData[i].data2Val1 = 4;
+ _menuButtonData[i].data0Callback = _redrawShadedButtonFunctor;
+ _menuButtonData[i].data1Callback = _redrawButtonFunctor;
+ _menuButtonData[i].data2Callback = _redrawButtonFunctor;
}
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- gui_fadePalette();
+ fadePalette();
for (int i = 0; i < 5; i++)
- calcCoords(_menu[i]);
+ initMenuLayout(_menu[i]);
_menuRestoreScreen = true;
_keyPressed.reset();
- _mousePressFlag = false;
+ _vm->_mousePressFlag = false;
_toplevelMenu = 0;
- if (_menuDirectlyToLoad) {
- gui_loadGameMenu(0);
+ if (_vm->_menuDirectlyToLoad) {
+ loadGameMenu(0);
} else {
if (!caller)
_toplevelMenu = 4;
initMenu(_menu[_toplevelMenu]);
- processAllMenuButtons();
+ updateAllMenuButtons();
}
- while (_displayMenu && !_quitFlag) {
- gui_processHighlights(_menu[_toplevelMenu]);
- processButtonList(_menuButtonList);
- gui_getInput();
+ while (_displayMenu && !_vm->_quitFlag) {
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[_toplevelMenu], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
+ getInput();
}
if (_menuRestoreScreen) {
- gui_restorePalette();
+ restorePalette();
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
- _animator->_updateScreen = true;
+ _vm->_animator->_updateScreen = true;
} else {
_screen->deletePageFromDisk(0);
}
@@ -534,106 +472,7 @@ int KyraEngine_v1::buttonMenuCallback(Button *caller) {
return 0;
}
-void KyraEngine_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.bgcolor);
- _screen->drawShadedBox(menu.x, menu.y, menu_x2, menu_y2, menu.color1, menu.color2);
-
- if (menu.field_10 != -1)
- textX = menu.x;
- else
- textX = _text->getCenterStringX(menu.menuName, menu.x, menu_x2);
-
- textY = menu.y + menu.field_12;
-
- _text->printText(menu.menuName, textX - 1, textY + 1, 12, 248, 0);
- _text->printText(menu.menuName, textX, textY, menu.textColor, 0, 0);
-
- int x1, y1, x2, y2;
- for (int i = 0; i < menu.nrOfItems; 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 < 6) {
- _menuButtonData[i].nextButton = 0;
- _menuButtonData[i].x = x1;
- _menuButtonData[i].y = y1;
- _menuButtonData[i].width = menu.item[i].width - 1;
- _menuButtonData[i].height = menu.item[i].height - 1;
- _menuButtonData[i].buttonCallback = menu.item[i].callback;
- _menuButtonData[i].specialValue = menu.item[i].saveSlot;
- //_menuButtonData[i].field_6 = menu.item[i].field_25;
- //_menuButtonData[i].field_8 = 0;
-
- if (!_menuButtonList)
- _menuButtonList = &_menuButtonData[i];
- else
- _menuButtonList = initButton(_menuButtonList, &_menuButtonData[i]);
- }
- _screen->fillRect(x1, y1, x2, y2, menu.item[i].bgcolor);
- _screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2);
-
- if (menu.item[i].itemString) {
- if (menu.item[i].field_12 != -1 && _flags.lang == Common::EN_ANY)
- textX = x1 + menu.item[i].field_12 + 3;
- else
- textX = _text->getCenterStringX(menu.item[i].itemString, x1, x2);
-
- textY = y1 + 2;
- _text->printText(menu.item[i].itemString, textX - 1, textY + 1, 12, 0, 0);
-
- if (i == menu.highlightedItem)
- _text->printText(menu.item[i].itemString, textX, textY, menu.item[i].highlightColor, 0, 0);
- else
- _text->printText(menu.item[i].itemString, textX, textY, menu.item[i].textColor, 0, 0);
-
- if (menu.item[i].labelString) {
- _text->printText(menu.item[i].labelString, menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, 12, 0, 0);
- _text->printText(menu.item[i].labelString, menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, 253, 0, 0);
- }
- }
- }
-
- if (menu.scrollUpBtnX != -1) {
- _haveScrollButtons = true;
-
- _scrollUpButton.x = menu.scrollUpBtnX + menu.x;
- _scrollUpButton.y = menu.scrollUpBtnY + menu.y;
- _scrollUpButton.buttonCallback = &KyraEngine_v1::gui_scrollUp;
- _scrollUpButton.nextButton = 0;
- _menuButtonList = initButton(_menuButtonList, &_scrollUpButton);
- processMenuButton(&_scrollUpButton);
-
- _scrollDownButton.x = menu.scrollDownBtnX + menu.x;
- _scrollDownButton.y = menu.scrollDownBtnY + menu.y;
- _scrollDownButton.buttonCallback = &KyraEngine_v1::gui_scrollDown;
- _scrollDownButton.nextButton = 0;
- _menuButtonList = initButton(_menuButtonList, &_scrollDownButton);
- processMenuButton(&_scrollDownButton);
- } else {
- _haveScrollButtons = false;
- }
-
- _screen->showMouse();
- _screen->updateScreen();
-}
-
-void KyraEngine_v1::calcCoords(Menu &menu) {
+/*void KyraEngine_v1::initMenuLayout(Menu &menu) {
assert(menu.nrOfItems < 7);
int widthBackup = _screen->_charWidth;
@@ -688,10 +527,10 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
menu.width += maxOffset;
}
- if (menu.menuName != 0) {
- int menuNameLength = _screen->getTextWidth(menu.menuName);
- if (menuNameLength > menu.width)
- menu.width = menuNameLength;
+ if (menu.menuNameString != 0) {
+ int menuNameStringLength = _screen->getTextWidth(menu.menuNameString);
+ if (menuNameStringLength > menu.width)
+ menu.width = menuNameStringLength;
}
if (menu.width > 310)
@@ -703,27 +542,27 @@ void KyraEngine_v1::calcCoords(Menu &menu) {
menu.y = (200 - menu.height)/2;
_screen->_charWidth = widthBackup;
-}
+}*/
-void KyraEngine_v1::gui_getInput() {
+void GUI_v1::getInput() {
Common::Event event;
static uint32 lastScreenUpdate = 0;
- uint32 now = _system->getMillis();
+ uint32 now = _vm->_system->getMillis();
_mouseWheel = 0;
- while (_eventMan->pollEvent(event)) {
+ while (_vm->_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
- quitGame();
+ _vm->quitGame();
break;
case Common::EVENT_LBUTTONDOWN:
- _mousePressFlag = true;
+ _vm->_mousePressFlag = true;
break;
case Common::EVENT_LBUTTONUP:
- _mousePressFlag = false;
+ _vm->_mousePressFlag = false;
break;
case Common::EVENT_MOUSEMOVE:
- _system->updateScreen();
+ _vm->_system->updateScreen();
lastScreenUpdate = now;
break;
case Common::EVENT_WHEELUP:
@@ -741,35 +580,35 @@ void KyraEngine_v1::gui_getInput() {
}
if (now - lastScreenUpdate > 50) {
- _system->updateScreen();
+ _vm->_system->updateScreen();
lastScreenUpdate = now;
}
- _system->delayMillis(3);
+ _vm->_system->delayMillis(3);
}
-int KyraEngine_v1::gui_resumeGame(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_resumeGame()");
- processMenuButton(button);
+int GUI_v1::resumeGame(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::resumeGame()");
+ updateMenuButton(button);
_displayMenu = false;
return 0;
}
-int KyraEngine_v1::getNextSavegameSlot() {
+int GUI_v1::getNextSavegameSlot() {
Common::InSaveFile *in;
for (int i = 1; i < 1000; i++) {
- if ((in = _saveFileMan->openForLoading(getSavegameFilename(i))))
+ if ((in = _vm->_saveFileMan->openForLoading(_vm->getSavegameFilename(i))))
delete in;
else
return i;
}
- warning("Didn't save: Ran out of savegame filenames");
+ warning("Didn't save: Ran out of saveGame filenames");
return 0;
}
-void KyraEngine_v1::setupSavegames(Menu &menu, int num) {
+void GUI_v1::setupSavegames(Menu &menu, int num) {
Common::InSaveFile *in;
static char savenames[5][31];
uint8 startSlot;
@@ -785,7 +624,7 @@ void KyraEngine_v1::setupSavegames(Menu &menu, int num) {
}
for (int i = startSlot; i < num; i++) {
- if ((in = _saveFileMan->openForLoading(getSavegameFilename(i + _savegameOffset)))) {
+ if ((in = _vm->_saveFileMan->openForLoading(_vm->getSavegameFilename(i + _savegameOffset)))) {
in->skip(8);
in->read(savenames[i], 31);
menu.item[i].itemString = savenames[i];
@@ -800,32 +639,33 @@ void KyraEngine_v1::setupSavegames(Menu &menu, int num) {
}
}
-int KyraEngine_v1::gui_saveGameMenu(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_saveGameMenu()");
- processMenuButton(button);
+int GUI_v1::saveGameMenu(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::saveGameMenu()");
+ updateMenuButton(button);
_menu[2].item[5].enabled = true;
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- _menu[2].menuName = _guiStrings[8]; // Select a position to save to:
- _specialSavegameString = _guiStrings[9]; // [ EMPTY SLOT ]
+ _menu[2].menuNameString = _vm->_guiStrings[8]; // Select a position to save to:
+ _specialSavegameString = _vm->_guiStrings[9]; // [ EMPTY SLOT ]
for (int i = 0; i < 5; i++)
- _menu[2].item[i].callback = &KyraEngine_v1::gui_saveGame;
+ _menu[2].item[i].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::saveGame);
_savegameOffset = 0;
setupSavegames(_menu[2], 5);
initMenu(_menu[2]);
- processAllMenuButtons();
+ updateAllMenuButtons();
_displaySubMenu = true;
_cancelSubMenu = false;
- while (_displaySubMenu && !_quitFlag) {
- gui_getInput();
- gui_processHighlights(_menu[2]);
- processButtonList(_menuButtonList);
+ while (_displaySubMenu && !_vm->_quitFlag) {
+ getInput();
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[2], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
}
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -833,43 +673,44 @@ int KyraEngine_v1::gui_saveGameMenu(Button *button) {
if (_cancelSubMenu) {
initMenu(_menu[0]);
- processAllMenuButtons();
+ updateAllMenuButtons();
} else {
_displayMenu = false;
}
return 0;
}
-int KyraEngine_v1::gui_loadGameMenu(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_loadGameMenu()");
- if (_menuDirectlyToLoad) {
+int GUI_v1::loadGameMenu(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::loadGameMenu()");
+ if (_vm->_menuDirectlyToLoad) {
_menu[2].item[5].enabled = false;
} else {
- processMenuButton(button);
+ updateMenuButton(button);
_menu[2].item[5].enabled = true;
}
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- _specialSavegameString = _newGameString[0]; //[ START A NEW GAME ]
- _menu[2].menuName = _guiStrings[7]; // Which game would you like to reload?
+ _specialSavegameString = _vm->_newGameString[0]; //[ START A NEW GAME ]
+ _menu[2].menuNameString = _vm->_guiStrings[7]; // Which game would you like to reload?
for (int i = 0; i < 5; i++)
- _menu[2].item[i].callback = &KyraEngine_v1::gui_loadGame;
+ _menu[2].item[i].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::loadGame);
_savegameOffset = 0;
setupSavegames(_menu[2], 5);
initMenu(_menu[2]);
- processAllMenuButtons();
+ updateAllMenuButtons();
_displaySubMenu = true;
_cancelSubMenu = false;
- while (_displaySubMenu && !_quitFlag) {
- gui_getInput();
- gui_processHighlights(_menu[2]);
- processButtonList(_menuButtonList);
+ while (_displaySubMenu && !_vm->_quitFlag) {
+ getInput();
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[2], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
}
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -877,17 +718,17 @@ int KyraEngine_v1::gui_loadGameMenu(Button *button) {
if (_cancelSubMenu) {
initMenu(_menu[_toplevelMenu]);
- processAllMenuButtons();
+ updateAllMenuButtons();
} else {
- gui_restorePalette();
- loadGame(getSavegameFilename(_gameToLoad));
+ restorePalette();
+ _vm->loadGame(_vm->getSavegameFilename(_vm->_gameToLoad));
_displayMenu = false;
_menuRestoreScreen = false;
}
return 0;
}
-void KyraEngine_v1::gui_redrawTextfield() {
+void GUI_v1::redrawTextfield() {
_screen->fillRect(38, 91, 287, 102, 250);
_text->printText(_savegameName, 38, 92, 253, 0, 0);
@@ -899,7 +740,7 @@ void KyraEngine_v1::gui_redrawTextfield() {
_screen->updateScreen();
}
-void KyraEngine_v1::gui_updateSavegameString() {
+void GUI_v1::updateSavegameString() {
int length;
if (_keyPressed.keycode) {
@@ -909,13 +750,13 @@ void KyraEngine_v1::gui_updateSavegameString() {
if (length < 31) {
_savegameName[length] = _keyPressed.ascii;
_savegameName[length+1] = 0;
- gui_redrawTextfield();
+ redrawTextfield();
}
} else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE ||
_keyPressed.keycode == Common::KEYCODE_DELETE) {
if (length > 0) {
_savegameName[length-1] = 0;
- gui_redrawTextfield();
+ redrawTextfield();
}
} else if (_keyPressed.keycode == Common::KEYCODE_RETURN ||
_keyPressed.keycode == Common::KEYCODE_KP_ENTER) {
@@ -926,111 +767,113 @@ void KyraEngine_v1::gui_updateSavegameString() {
_keyPressed.reset();
}
-int KyraEngine_v1::gui_saveGame(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_saveGame()");
- processMenuButton(button);
- _gameToLoad = button->specialValue;
+int GUI_v1::saveGame(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::saveGame()");
+ updateMenuButton(button);
+ _vm->_gameToLoad = button->index;
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
initMenu(_menu[3]);
- processAllMenuButtons();
+ updateAllMenuButtons();
_displaySubMenu = true;
_cancelSubMenu = false;
- if (_savegameOffset == 0 && _gameToLoad == 0) {
+ if (_savegameOffset == 0 && _vm->_gameToLoad == 0) {
_savegameName[0] = 0;
} else {
for (int i = 0; i < 5; i++) {
- if (_menu[2].item[i].saveSlot == _gameToLoad) {
+ if (_menu[2].item[i].saveSlot == _vm->_gameToLoad) {
strncpy(_savegameName, _menu[2].item[i].itemString, 31);
break;
}
}
}
- gui_redrawTextfield();
-
- while (_displaySubMenu && !_quitFlag) {
- gui_getInput();
- gui_updateSavegameString();
- gui_processHighlights(_menu[3]);
- processButtonList(_menuButtonList);
+ redrawTextfield();
+
+ while (_displaySubMenu && !_vm->_quitFlag) {
+ getInput();
+ updateSavegameString();
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[3], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
}
if (_cancelSubMenu) {
_displaySubMenu = true;
_cancelSubMenu = false;
initMenu(_menu[2]);
- processAllMenuButtons();
+ updateAllMenuButtons();
} else {
- if (_savegameOffset == 0 && _gameToLoad == 0)
- _gameToLoad = getNextSavegameSlot();
- if (_gameToLoad > 0)
- saveGame(getSavegameFilename(_gameToLoad), _savegameName);
+ if (_savegameOffset == 0 && _vm->_gameToLoad == 0)
+ _vm->_gameToLoad = getNextSavegameSlot();
+ if (_vm->_gameToLoad > 0)
+ _vm->saveGame(_vm->getSavegameFilename(_vm->_gameToLoad), _savegameName);
}
return 0;
}
-int KyraEngine_v1::gui_savegameConfirm(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_savegameConfirm()");
- processMenuButton(button);
+int GUI_v1::savegameConfirm(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::savegameConfirm()");
+ updateMenuButton(button);
_displaySubMenu = false;
return 0;
}
-int KyraEngine_v1::gui_loadGame(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_loadGame()");
- processMenuButton(button);
+int GUI_v1::loadGame(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::loadGame()");
+ updateMenuButton(button);
_displaySubMenu = false;
- _gameToLoad = button->specialValue;
+ _vm->_gameToLoad = button->index;
return 0;
}
-int KyraEngine_v1::gui_cancelSubMenu(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_cancelLoadGameMenu()");
- processMenuButton(button);
+int GUI_v1::cancelSubMenu(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::cancelSubMenu()");
+ updateMenuButton(button);
_displaySubMenu = false;
_cancelSubMenu = true;
return 0;
}
-int KyraEngine_v1::gui_quitPlaying(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitPlaying()");
- processMenuButton(button);
+int GUI_v1::quitPlaying(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::quitPlaying()");
+ updateMenuButton(button);
- if (gui_quitConfirm(_guiStrings[14])) { // Are you sure you want to quit playing?
- quitGame();
+ if (quitConfirm(_vm->_guiStrings[14])) { // Are you sure you want to quit playing?
+ _vm->quitGame();
} else {
initMenu(_menu[_toplevelMenu]);
- processAllMenuButtons();
+ updateAllMenuButtons();
}
return 0;
}
-bool KyraEngine_v1::gui_quitConfirm(const char *str) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirm()");
+bool GUI_v1::quitConfirm(const char *str) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirm()");
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- _menu[1].menuName = str;
- calcCoords(_menu[1]);
+ _menu[1].menuNameString = str;
+ initMenuLayout(_menu[1]);
initMenu(_menu[1]);
_displaySubMenu = true;
_cancelSubMenu = true;
- while (_displaySubMenu && !_quitFlag) {
- gui_getInput();
- gui_processHighlights(_menu[1]);
- processButtonList(_menuButtonList);
+ while (_displaySubMenu && !_vm->_quitFlag) {
+ getInput();
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[1], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
}
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -1039,33 +882,33 @@ bool KyraEngine_v1::gui_quitConfirm(const char *str) {
return !_cancelSubMenu;
}
-int KyraEngine_v1::gui_quitConfirmYes(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirmYes()");
- processMenuButton(button);
+int GUI_v1::quitConfirmYes(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirmYes()");
+ updateMenuButton(button);
_displaySubMenu = false;
_cancelSubMenu = false;
return 0;
}
-int KyraEngine_v1::gui_quitConfirmNo(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_quitConfirmNo()");
- processMenuButton(button);
+int GUI_v1::quitConfirmNo(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirmNo()");
+ updateMenuButton(button);
_displaySubMenu = false;
_cancelSubMenu = true;
return 0;
}
-int KyraEngine_v1::gui_gameControlsMenu(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_gameControlsMenu()");
+int GUI_v1::gameControlsMenu(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::gameControlsMenu()");
- readSettings();
+ _vm->readSettings();
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0);
- if (_flags.isTalkie) {
+ if (_vm->gameFlags().isTalkie) {
//_menu[5].width = 230;
for (int i = 0; i < 5; i++) {
@@ -1075,27 +918,28 @@ int KyraEngine_v1::gui_gameControlsMenu(Button *button) {
}
_menu[5].item[3].labelString = _voiceTextString; //"Voice / Text "
- _menu[5].item[3].callback = &KyraEngine_v1::gui_controlsChangeVoice;
+ _menu[5].item[3].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::controlsChangeVoice);
} else {
//_menu[5].height = 136;
//_menu[5].item[5].y = 110;
_menu[5].item[4].enabled = 0;
_menu[5].item[3].labelString = _textSpeedString; // "Text speed "
- _menu[5].item[3].callback = &KyraEngine_v1::gui_controlsChangeText;
+ _menu[5].item[3].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::controlsChangeText);
}
- gui_setupControls(_menu[5]);
+ setupControls(_menu[5]);
- processAllMenuButtons();
+ updateAllMenuButtons();
_displaySubMenu = true;
_cancelSubMenu = false;
- while (_displaySubMenu && !_quitFlag) {
- gui_getInput();
- gui_processHighlights(_menu[5]);
- processButtonList(_menuButtonList);
+ while (_displaySubMenu && !_vm->_quitFlag) {
+ getInput();
+ Common::Point mouse = _vm->getMousePos();
+ processHighlights(_menu[5], mouse.x, mouse.y);
+ processButtonList(_menuButtonList, 0);
}
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
@@ -1103,15 +947,15 @@ int KyraEngine_v1::gui_gameControlsMenu(Button *button) {
if (_cancelSubMenu) {
initMenu(_menu[_toplevelMenu]);
- processAllMenuButtons();
+ updateAllMenuButtons();
}
return 0;
}
-void KyraEngine_v1::gui_setupControls(Menu &menu) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_setupControls()");
+void GUI_v1::setupControls(Menu &menu) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::setupControls()");
- switch (_configMusic) {
+ switch (_vm->_configMusic) {
case 0:
menu.item[0].itemString = _offString; //"Off"
break;
@@ -1123,27 +967,27 @@ void KyraEngine_v1::gui_setupControls(Menu &menu) {
break;
}
- if (_configSounds)
+ if (_vm->_configSounds)
menu.item[1].itemString = _onString; //"On"
else
menu.item[1].itemString = _offString; //"Off"
- switch (_configWalkspeed) {
+ switch (_vm->_configWalkspeed) {
case 0:
- menu.item[2].itemString = _configStrings[0]; //"Slowest"
+ menu.item[2].itemString = _vm->_configStrings[0]; //"Slowest"
break;
case 1:
- menu.item[2].itemString = _configStrings[1]; //"Slow"
+ menu.item[2].itemString = _vm->_configStrings[1]; //"Slow"
break;
case 2:
- menu.item[2].itemString = _configStrings[2]; //"Normal"
+ menu.item[2].itemString = _vm->_configStrings[2]; //"Normal"
break;
case 3:
- menu.item[2].itemString = _configStrings[3]; //"Fast"
+ menu.item[2].itemString = _vm->_configStrings[3]; //"Fast"
break;
case 4:
- menu.item[2].itemString = _configStrings[4]; //"Fastest"
+ menu.item[2].itemString = _vm->_configStrings[4]; //"Fastest"
break;
default:
menu.item[2].itemString = "ERROR";
@@ -1152,24 +996,24 @@ void KyraEngine_v1::gui_setupControls(Menu &menu) {
int textControl = 3;
int clickableOffset = 8;
- if (_flags.isTalkie) {
+ if (_vm->gameFlags().isTalkie) {
textControl = 4;
clickableOffset = 11;
- if (_configVoice == 0)
+ if (_vm->_configVoice == 0)
_menu[5].item[4].enabled = 1;
else
_menu[5].item[4].enabled = 0;
- switch (_configVoice) {
+ switch (_vm->_configVoice) {
case 0:
- menu.item[3].itemString = _configStrings[5]; //"Text only"
+ menu.item[3].itemString = _vm->_configStrings[5]; //"Text only"
break;
case 1:
- menu.item[3].itemString = _configStrings[6]; //"Voice only"
+ menu.item[3].itemString = _vm->_configStrings[6]; //"Voice only"
break;
case 2:
- menu.item[3].itemString = _configStrings[7]; //"Voice & Text"
+ menu.item[3].itemString = _vm->_configStrings[7]; //"Voice & Text"
break;
default:
menu.item[3].itemString = "ERROR";
@@ -1177,83 +1021,83 @@ void KyraEngine_v1::gui_setupControls(Menu &menu) {
}
}
- switch (_configTextspeed) {
+ switch (_vm->_configTextspeed) {
case 0:
- menu.item[textControl].itemString = _configStrings[1]; //"Slow"
+ menu.item[textControl].itemString = _vm->_configStrings[1]; //"Slow"
break;
case 1:
- menu.item[textControl].itemString = _configStrings[2]; //"Normal"
+ menu.item[textControl].itemString = _vm->_configStrings[2]; //"Normal"
break;
case 2:
- menu.item[textControl].itemString = _configStrings[3]; //"Fast"
+ menu.item[textControl].itemString = _vm->_configStrings[3]; //"Fast"
break;
case 3:
- menu.item[textControl].itemString = _configStrings[clickableOffset]; //"Clickable"
+ menu.item[textControl].itemString = _vm->_configStrings[clickableOffset]; //"Clickable"
break;
default:
menu.item[textControl].itemString = "ERROR";
break;
}
- calcCoords(menu);
+ initMenuLayout(menu);
initMenu(menu);
}
-int KyraEngine_v1::gui_controlsChangeMusic(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeMusic()");
- processMenuButton(button);
+int GUI_v1::controlsChangeMusic(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeMusic()");
+ updateMenuButton(button);
- _configMusic = ++_configMusic % ((_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) ? 3 : 2);
- gui_setupControls(_menu[5]);
+ _vm->_configMusic = ++_vm->_configMusic % ((_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) ? 3 : 2);
+ setupControls(_menu[5]);
return 0;
}
-int KyraEngine_v1::gui_controlsChangeSounds(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeSounds()");
- processMenuButton(button);
+int GUI_v1::controlsChangeSounds(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeSounds()");
+ updateMenuButton(button);
- _configSounds = !_configSounds;
- gui_setupControls(_menu[5]);
+ _vm->_configSounds = !_vm->_configSounds;
+ setupControls(_menu[5]);
return 0;
}
-int KyraEngine_v1::gui_controlsChangeWalk(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeWalk()");
- processMenuButton(button);
+int GUI_v1::controlsChangeWalk(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeWalk()");
+ updateMenuButton(button);
- _configWalkspeed = ++_configWalkspeed % 5;
- setWalkspeed(_configWalkspeed);
- gui_setupControls(_menu[5]);
+ _vm->_configWalkspeed = ++_vm->_configWalkspeed % 5;
+ _vm->setWalkspeed(_vm->_configWalkspeed);
+ setupControls(_menu[5]);
return 0;
}
-int KyraEngine_v1::gui_controlsChangeText(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeText()");
- processMenuButton(button);
+int GUI_v1::controlsChangeText(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeText()");
+ updateMenuButton(button);
- _configTextspeed = ++_configTextspeed % 4;
- gui_setupControls(_menu[5]);
+ _vm->_configTextspeed = ++_vm->_configTextspeed % 4;
+ setupControls(_menu[5]);
return 0;
}
-int KyraEngine_v1::gui_controlsChangeVoice(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsChangeVoice()");
- processMenuButton(button);
+int GUI_v1::controlsChangeVoice(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeVoice()");
+ updateMenuButton(button);
- _configVoice = ++_configVoice % 3;
- gui_setupControls(_menu[5]);
+ _vm->_configVoice = ++_vm->_configVoice % 3;
+ setupControls(_menu[5]);
return 0;
}
-int KyraEngine_v1::gui_controlsApply(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_controlsApply()");
- writeSettings();
- return gui_cancelSubMenu(button);
+int GUI_v1::controlsApply(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::controlsApply()");
+ _vm->writeSettings();
+ return cancelSubMenu(button);
}
-int KyraEngine_v1::gui_scrollUp(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_scrollUp()");
- processMenuButton(button);
+int GUI_v1::scrollUp(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::scrollUp()");
+ updateMenuButton(button);
if (_savegameOffset > 0) {
_savegameOffset--;
@@ -1263,9 +1107,9 @@ int KyraEngine_v1::gui_scrollUp(Button *button) {
return 0;
}
-int KyraEngine_v1::gui_scrollDown(Button *button) {
- debugC(9, kDebugLevelGUI, "KyraEngine_v1::gui_scrollDown()");
- processMenuButton(button);
+int GUI_v1::scrollDown(Button *button) {
+ debugC(9, kDebugLevelGUI, "GUI_v1::scrollDown()");
+ updateMenuButton(button);
_savegameOffset++;
setupSavegames(_menu[2], 5);
@@ -1274,75 +1118,8 @@ int KyraEngine_v1::gui_scrollDown(Button *button) {
return 0;
}
-void KyraEngine_v1::gui_processHighlights(Menu &menu) {
- int x1, y1, x2, y2;
-
- Common::Point mouse = getMousePos();
- for (int i = 0; i < menu.nrOfItems; 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 (mouse.x > x1 && mouse.x < x2 &&
- mouse.y > y1 && mouse.y < y2) {
-
- if (menu.highlightedItem != i) {
- if (menu.item[menu.highlightedItem].enabled )
- gui_redrawText(menu);
-
- menu.highlightedItem = i;
- gui_redrawHighlight(menu);
- _screen->updateScreen();
- }
- }
- }
-}
-
-void KyraEngine_v1::gui_redrawText(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].field_12 != -1 &&_flags.lang == Common::EN_ANY)
- textX = x1 + menu.item[i].field_12 + 3;
- else
- textX = _text->getCenterStringX(menu.item[i].itemString, x1, x2);
-
- int textY = y1 + 2;
- _text->printText(menu.item[i].itemString, textX - 1, textY + 1, 12, 0, 0);
- _text->printText(menu.item[i].itemString, textX, textY, menu.item[i].textColor, 0, 0);
-}
-
-void KyraEngine_v1::gui_redrawHighlight(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].field_12 != -1 &&_flags.lang == Common::EN_ANY)
- textX = x1 + menu.item[i].field_12 + 3;
- else
- textX = _text->getCenterStringX(menu.item[i].itemString, x1, x2);
-
- int textY = y1 + 2;
- _text->printText(menu.item[i].itemString, textX - 1, textY + 1, 12, 0, 0);
- _text->printText(menu.item[i].itemString, textX, textY, menu.item[i].highlightColor, 0, 0);
-}
-
-void KyraEngine_v1::gui_fadePalette() {
- if (_flags.platform == Common::kPlatformAmiga)
+void GUI_v1::fadePalette() {
+ if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return;
static int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1};
@@ -1361,8 +1138,8 @@ void KyraEngine_v1::gui_fadePalette() {
_screen->fadePalette(_screen->_currentPalette, 2);
}
-void KyraEngine_v1::gui_restorePalette() {
- if (_flags.platform == Common::kPlatformAmiga)
+void GUI_v1::restorePalette() {
+ if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return;
memcpy(_screen->_currentPalette, _screen->getPalette(2), 768);