2007-05-30 21:56:52 +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.
|
2006-01-02 22:58:59 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-01-02 22:58:59 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2006-02-09 12:19:53 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2006-01-02 22:58:59 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
#include "kyra/kyra_v1.h"
|
2006-01-02 22:58:59 +00:00
|
|
|
#include "kyra/screen.h"
|
|
|
|
#include "kyra/script.h"
|
2006-01-22 09:34:12 +00:00
|
|
|
#include "kyra/text.h"
|
2007-07-29 16:31:29 +00:00
|
|
|
#include "kyra/animator_v1.h"
|
2006-06-02 22:57:02 +00:00
|
|
|
#include "kyra/sound.h"
|
2008-03-28 09:00:30 +00:00
|
|
|
#include "kyra/gui_v1.h"
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-05-28 09:21:32 +00:00
|
|
|
#include "common/config-manager.h"
|
2006-01-22 09:34:12 +00:00
|
|
|
#include "common/savefile.h"
|
2007-03-17 00:53:21 +00:00
|
|
|
#include "common/events.h"
|
2006-01-22 09:34:12 +00:00
|
|
|
#include "common/system.h"
|
2006-01-02 22:58:59 +00:00
|
|
|
|
|
|
|
namespace Kyra {
|
2006-02-09 07:37:19 +00:00
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
void KyraEngine_v1::initMainButtonList() {
|
2006-02-09 07:37:19 +00:00
|
|
|
_buttonList = &_buttonData[0];
|
2007-04-15 16:41:20 +00:00
|
|
|
for (int i = 0; _buttonDataListPtr[i]; ++i)
|
2008-03-28 09:00:30 +00:00
|
|
|
_buttonList = _gui->addButtonToList(_buttonList, _buttonDataListPtr[i]);
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
int KyraEngine_v1::buttonInventoryCallback(Button *caller) {
|
2008-03-28 09:00:30 +00:00
|
|
|
int itemOffset = caller->index - 2;
|
2006-01-02 22:58:59 +00:00
|
|
|
uint8 inventoryItem = _currentCharacter->inventoryItems[itemOffset];
|
|
|
|
if (_itemInHand == -1) {
|
|
|
|
if (inventoryItem == 0xFF) {
|
2006-01-12 13:16:42 +00:00
|
|
|
snd_playSoundEffect(0x36);
|
2006-01-02 22:58:59 +00:00
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
_screen->hideMouse();
|
|
|
|
_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
|
2006-01-12 13:16:42 +00:00
|
|
|
snd_playSoundEffect(0x35);
|
2006-01-02 22:58:59 +00:00
|
|
|
setMouseItem(inventoryItem);
|
|
|
|
updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179);
|
|
|
|
_itemInHand = inventoryItem;
|
|
|
|
_screen->showMouse();
|
|
|
|
_currentCharacter->inventoryItems[itemOffset] = 0xFF;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (inventoryItem != 0xFF) {
|
2006-01-12 13:16:42 +00:00
|
|
|
snd_playSoundEffect(0x35);
|
2006-01-02 22:58:59 +00:00
|
|
|
_screen->hideMouse();
|
|
|
|
_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12);
|
2007-04-27 12:15:47 +00:00
|
|
|
_screen->drawShape(0, _shapes[216+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
|
2006-01-02 22:58:59 +00:00
|
|
|
setMouseItem(inventoryItem);
|
|
|
|
updateSentenceCommand(_itemList[inventoryItem], _takenList[1], 179);
|
|
|
|
_screen->showMouse();
|
|
|
|
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
|
|
|
|
_itemInHand = inventoryItem;
|
|
|
|
} else {
|
2006-01-12 13:16:42 +00:00
|
|
|
snd_playSoundEffect(0x32);
|
2006-01-02 22:58:59 +00:00
|
|
|
_screen->hideMouse();
|
2007-04-27 12:15:47 +00:00
|
|
|
_screen->drawShape(0, _shapes[216+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
|
|
|
|
_screen->setMouseCursor(1, 1, _shapes[0]);
|
2006-01-02 22:58:59 +00:00
|
|
|
updateSentenceCommand(_itemList[_itemInHand], _placedList[0], 179);
|
|
|
|
_screen->showMouse();
|
|
|
|
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
|
|
|
|
_itemInHand = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_screen->updateScreen();
|
|
|
|
// XXX clearKyrandiaButtonIO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
int KyraEngine_v1::buttonAmuletCallback(Button *caller) {
|
2006-01-02 22:58:59 +00:00
|
|
|
if (!(_deathHandler & 8))
|
|
|
|
return 1;
|
2008-03-28 09:00:30 +00:00
|
|
|
int jewel = caller->index - 0x14;
|
2006-01-02 22:58:59 +00:00
|
|
|
if (_currentCharacter->sceneId == 210) {
|
2006-01-06 10:45:42 +00:00
|
|
|
if (_beadStateVar == 4 || _beadStateVar == 6)
|
|
|
|
return 1;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
|
|
|
if (!queryGameFlag(0x2D))
|
|
|
|
return 1;
|
|
|
|
if (_itemInHand != -1) {
|
|
|
|
assert(_putDownFirst);
|
2007-01-31 18:35:50 +00:00
|
|
|
characterSays(2000, _putDownFirst[0], 0, -2);
|
2006-01-02 22:58:59 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (queryGameFlag(0xF1)) {
|
|
|
|
assert(_waitForAmulet);
|
2008-01-27 19:47:41 +00:00
|
|
|
characterSays(2001, _waitForAmulet[0], 0, -2);
|
2006-01-02 22:58:59 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (!queryGameFlag(0x55+jewel)) {
|
|
|
|
assert(_blackJewel);
|
2006-02-11 08:31:13 +00:00
|
|
|
_animator->makeBrandonFaceMouse();
|
2006-01-02 22:58:59 +00:00
|
|
|
drawJewelPress(jewel, 1);
|
2007-01-31 18:35:50 +00:00
|
|
|
characterSays(2002, _blackJewel[0], 0, -2);
|
2006-01-02 22:58:59 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
drawJewelPress(jewel, 0);
|
|
|
|
drawJewelsFadeOutStart();
|
|
|
|
drawJewelsFadeOutEnd(jewel);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
_scriptInterpreter->initScript(_scriptClick, _scriptClickData);
|
2007-07-08 12:50:24 +00:00
|
|
|
_scriptClick->regs[3] = 0;
|
|
|
|
_scriptClick->regs[6] = jewel;
|
2006-01-02 22:58:59 +00:00
|
|
|
_scriptInterpreter->startScript(_scriptClick, 4);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-04-15 16:41:20 +00:00
|
|
|
while (_scriptInterpreter->validScript(_scriptClick))
|
2006-01-02 22:58:59 +00:00
|
|
|
_scriptInterpreter->runScript(_scriptClick);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-07-08 12:50:24 +00:00
|
|
|
if (_scriptClick->regs[3])
|
2006-01-02 22:58:59 +00:00
|
|
|
return 1;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
_unkAmuletVar = 1;
|
|
|
|
switch (jewel-1) {
|
2006-05-08 10:16:19 +00:00
|
|
|
case 0:
|
|
|
|
if (_brandonStatusBit & 1) {
|
|
|
|
seq_brandonHealing2();
|
|
|
|
} else if (_brandonStatusBit == 0) {
|
|
|
|
seq_brandonHealing();
|
|
|
|
assert(_healingTip);
|
2007-01-31 18:35:50 +00:00
|
|
|
characterSays(2003, _healingTip[0], 0, -2);
|
2006-05-08 10:16:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-05-08 10:16:19 +00:00
|
|
|
case 1:
|
|
|
|
seq_makeBrandonInv();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
if (_brandonStatusBit & 1) {
|
|
|
|
assert(_wispJewelStrings);
|
2007-01-31 18:38:22 +00:00
|
|
|
characterSays(2004, _wispJewelStrings[0], 0, -2);
|
2006-05-08 10:16:19 +00:00
|
|
|
} else {
|
|
|
|
if (_brandonStatusBit & 2) {
|
|
|
|
// XXX
|
|
|
|
seq_makeBrandonNormal2();
|
|
|
|
// XXX
|
2006-01-02 22:58:59 +00:00
|
|
|
} else {
|
2006-05-08 10:16:19 +00:00
|
|
|
// do not check for item in hand again as in the original since some strings are missing
|
|
|
|
// in the cd version
|
|
|
|
if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
|
|
|
|
snd_playWanderScoreViaMap(1, 0);
|
|
|
|
seq_makeBrandonWisp();
|
|
|
|
snd_playWanderScoreViaMap(17, 0);
|
2006-01-02 22:58:59 +00:00
|
|
|
} else {
|
2006-05-08 10:16:19 +00:00
|
|
|
seq_makeBrandonWisp();
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
2006-05-08 10:16:19 +00:00
|
|
|
setGameFlag(0x9E);
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
2006-05-08 10:16:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
seq_dispelMagicAnimation();
|
|
|
|
assert(_magicJewelString);
|
2007-01-31 18:35:50 +00:00
|
|
|
characterSays(2007, _magicJewelString[0], 0, -2);
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-05-08 10:16:19 +00:00
|
|
|
default:
|
|
|
|
break;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
|
|
|
_unkAmuletVar = 0;
|
|
|
|
// XXX clearKyrandiaButtonIO (!used before every return in this function!)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
2008-04-12 23:17:21 +00:00
|
|
|
GUI_v1::GUI_v1(KyraEngine_v1 *vm, Screen_v1 *screen) : GUI(vm), _vm(vm), _screen(screen) {
|
2008-03-28 09:00:30 +00:00
|
|
|
_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) {
|
2006-03-15 13:32:35 +00:00
|
|
|
if (_haveScrollButtons) {
|
|
|
|
if (_mouseWheel < 0)
|
2008-03-28 09:00:30 +00:00
|
|
|
scrollUp(&_scrollUpButton);
|
2006-03-15 13:32:35 +00:00
|
|
|
else if (_mouseWheel > 0)
|
2008-03-28 09:00:30 +00:00
|
|
|
scrollDown(&_scrollDownButton);
|
2006-03-15 13:32:35 +00:00
|
|
|
}
|
2006-01-02 22:58:59 +00:00
|
|
|
while (list) {
|
|
|
|
if (list->flags & 8) {
|
|
|
|
list = list->nextButton;
|
|
|
|
continue;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
int x = list->x;
|
|
|
|
int y = list->y;
|
2008-04-12 23:17:21 +00:00
|
|
|
assert(_screen->getScreenDim(list->dimTableIndex) != 0);
|
2006-01-02 22:58:59 +00:00
|
|
|
if (x < 0) {
|
2008-04-12 23:17:21 +00:00
|
|
|
x += _screen->getScreenDim(list->dimTableIndex)->w << 3;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
2008-04-12 23:17:21 +00:00
|
|
|
x += _screen->getScreenDim(list->dimTableIndex)->sx << 3;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
if (y < 0) {
|
2008-04-12 23:17:21 +00:00
|
|
|
y += _screen->getScreenDim(list->dimTableIndex)->h;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
2008-04-12 23:17:21 +00:00
|
|
|
y += _screen->getScreenDim(list->dimTableIndex)->sy;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
Common::Point mouse = _vm->getMousePos();
|
2007-03-18 18:27:52 +00:00
|
|
|
if (mouse.x >= x && mouse.y >= y && x + list->width >= mouse.x && y + list->height >= mouse.y) {
|
2006-01-02 22:58:59 +00:00
|
|
|
int processMouseClick = 0;
|
|
|
|
if (list->flags & 0x400) {
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->_mousePressFlag) {
|
2006-01-02 22:58:59 +00:00
|
|
|
if (!(list->flags2 & 1)) {
|
|
|
|
list->flags2 |= 1;
|
2006-03-19 05:55:26 +00:00
|
|
|
list->flags2 |= 4;
|
2006-01-02 22:58:59 +00:00
|
|
|
processButton(list);
|
2006-03-19 05:55:26 +00:00
|
|
|
_screen->updateScreen();
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (list->flags2 & 1) {
|
|
|
|
list->flags2 &= 0xFFFE;
|
|
|
|
processButton(list);
|
|
|
|
processMouseClick = 1;
|
|
|
|
}
|
|
|
|
}
|
2008-03-28 09:00:30 +00:00
|
|
|
} else if (_vm->_mousePressFlag) {
|
2006-01-02 22:58:59 +00:00
|
|
|
processMouseClick = 1;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
if (processMouseClick) {
|
|
|
|
if (list->buttonCallback) {
|
2008-03-28 09:00:30 +00:00
|
|
|
if ((*list->buttonCallback.get())(list)) {
|
2006-01-02 22:58:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (list->flags2 & 1) {
|
|
|
|
list->flags2 &= 0xFFFE;
|
|
|
|
processButton(list);
|
|
|
|
}
|
2006-03-19 05:55:26 +00:00
|
|
|
if (list->flags2 & 4) {
|
|
|
|
list->flags2 &= 0xFFFB;
|
|
|
|
processButton(list);
|
|
|
|
_screen->updateScreen();
|
|
|
|
}
|
2006-01-02 22:58:59 +00:00
|
|
|
list = list->nextButton;
|
|
|
|
continue;
|
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
list = list->nextButton;
|
|
|
|
}
|
2008-03-28 09:00:30 +00:00
|
|
|
return 0;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::processButton(Button *button) {
|
2006-01-02 22:58:59 +00:00
|
|
|
if (!button)
|
|
|
|
return;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
int processType = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
const uint8 *shape = 0;
|
|
|
|
Button::Callback callback;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
int flags = (button->flags2 & 5);
|
|
|
|
if (flags == 1) {
|
2008-03-28 09:00:30 +00:00
|
|
|
processType = button->data2Val1;
|
2007-04-15 16:41:20 +00:00
|
|
|
if (processType == 1)
|
2008-03-28 09:00:30 +00:00
|
|
|
shape = button->data2ShapePtr;
|
2007-04-15 16:41:20 +00:00
|
|
|
else if (processType == 4)
|
2008-03-28 09:00:30 +00:00
|
|
|
callback = button->data2Callback;
|
2006-01-02 22:58:59 +00:00
|
|
|
} else if (flags == 4 || flags == 5) {
|
2008-03-28 09:00:30 +00:00
|
|
|
processType = button->data1Val1;
|
2007-04-15 16:41:20 +00:00
|
|
|
if (processType == 1)
|
2008-03-28 09:00:30 +00:00
|
|
|
shape = button->data1ShapePtr;
|
2007-04-15 16:41:20 +00:00
|
|
|
else if (processType == 4)
|
2008-03-28 09:00:30 +00:00
|
|
|
callback = button->data1Callback;
|
2006-01-02 22:58:59 +00:00
|
|
|
} else {
|
2008-03-28 09:00:30 +00:00
|
|
|
processType = button->data0Val1;
|
2007-04-15 16:41:20 +00:00
|
|
|
if (processType == 1)
|
2008-03-28 09:00:30 +00:00
|
|
|
shape = button->data0ShapePtr;
|
2007-04-15 16:41:20 +00:00
|
|
|
else if (processType == 4)
|
2008-03-28 09:00:30 +00:00
|
|
|
callback = button->data0Callback;
|
2006-01-02 22:58:59 +00:00
|
|
|
}
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
int x = button->x;
|
|
|
|
int y = button->y;
|
2008-04-12 23:17:21 +00:00
|
|
|
assert(_screen->getScreenDim(button->dimTableIndex) != 0);
|
2007-04-15 16:41:20 +00:00
|
|
|
if (x < 0)
|
2008-04-12 23:17:21 +00:00
|
|
|
x += _screen->getScreenDim(button->dimTableIndex)->w << 3;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-04-15 16:41:20 +00:00
|
|
|
if (y < 0)
|
2008-04-12 23:17:21 +00:00
|
|
|
y += _screen->getScreenDim(button->dimTableIndex)->h;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-04-15 16:41:20 +00:00
|
|
|
if (processType == 1 && shape)
|
2006-01-02 22:58:59 +00:00
|
|
|
_screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10);
|
2007-04-15 16:41:20 +00:00
|
|
|
else if (processType == 4 && callback)
|
2008-03-28 09:00:30 +00:00
|
|
|
(*callback.get())(button);
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::setGUILabels() {
|
2006-04-23 14:43:16 +00:00
|
|
|
int offset = 0;
|
2007-02-08 09:24:33 +00:00
|
|
|
int offsetOptions = 0;
|
|
|
|
int offsetMainMenu = 0;
|
|
|
|
int offsetOn = 0;
|
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
int walkspeedGarbageOffset = 36;
|
2006-05-28 12:10:11 +00:00
|
|
|
int menuLabelGarbageOffset = 0;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->gameFlags().isTalkie) {
|
|
|
|
if (_vm->gameFlags().lang == Common::EN_ANY)
|
2006-04-23 14:43:16 +00:00
|
|
|
offset = 52;
|
2008-03-28 09:00:30 +00:00
|
|
|
else if (_vm->gameFlags().lang == Common::DE_DEU)
|
2006-04-23 14:43:16 +00:00
|
|
|
offset = 30;
|
2008-03-28 09:00:30 +00:00
|
|
|
else if (_vm->gameFlags().lang == Common::FR_FRA || _vm->gameFlags().lang == Common::IT_ITA)
|
2006-04-23 14:43:16 +00:00
|
|
|
offset = 6;
|
2007-02-08 09:24:33 +00:00
|
|
|
offsetOn = offsetMainMenu = offsetOptions = offset;
|
2006-04-23 14:43:16 +00:00
|
|
|
walkspeedGarbageOffset = 48;
|
2008-03-28 09:00:30 +00:00
|
|
|
} else if (_vm->gameFlags().lang == Common::ES_ESP) {
|
2007-02-08 09:24:33 +00:00
|
|
|
offsetOn = offsetMainMenu = offsetOptions = offset = -4;
|
2006-05-28 12:10:11 +00:00
|
|
|
menuLabelGarbageOffset = 72;
|
2008-03-28 09:00:30 +00:00
|
|
|
} else if (_vm->gameFlags().lang == Common::DE_DEU) {
|
2007-03-18 16:15:19 +00:00
|
|
|
offset = offsetMainMenu = offsetOn = offsetOptions = 24;
|
2008-03-28 09:00:30 +00:00
|
|
|
} else if (_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) {
|
2007-02-08 09:24:33 +00:00
|
|
|
offset = 1;
|
|
|
|
offsetOptions = 10;
|
|
|
|
offsetOn = 0;
|
|
|
|
walkspeedGarbageOffset = 0;
|
2006-04-23 14:43:16 +00:00
|
|
|
}
|
2007-03-18 16:15:19 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
assert(offset + 27 < _vm->_guiStringsSize);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
// The Legend of Kyrandia
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].menuNameString = _vm->_guiStrings[0];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Load a Game
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].item[0].itemString = _vm->_guiStrings[1];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Save a Game
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].item[1].itemString = _vm->_guiStrings[2];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Game controls
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].item[2].itemString = _vm->_guiStrings[3];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Quit playing
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].item[3].itemString = _vm->_guiStrings[4];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Resume game
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[0].item[4].itemString = _vm->_guiStrings[5];
|
2006-04-23 14:43:16 +00:00
|
|
|
|
|
|
|
// Cancel
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[2].item[5].itemString = _vm->_guiStrings[10];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
// Enter a description of your saved game:
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[3].menuNameString = _vm->_guiStrings[11];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Save
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[3].item[0].itemString = _vm->_guiStrings[12];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Cancel
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[3].item[1].itemString = _vm->_guiStrings[10];
|
2006-04-23 14:43:16 +00:00
|
|
|
|
|
|
|
// Rest in peace, Brandon
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[4].menuNameString = _vm->_guiStrings[13];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Load a game
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[4].item[0].itemString = _vm->_guiStrings[1];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Quit playing
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[4].item[1].itemString = _vm->_guiStrings[4];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
// Game Controls
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].menuNameString = _vm->_guiStrings[6];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Yes
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[1].item[0].itemString = _vm->_guiStrings[22 + offset];
|
2006-04-23 14:43:16 +00:00
|
|
|
// No
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[1].item[1].itemString = _vm->_guiStrings[23 + offset];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
// Music is
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[0].labelString = _vm->_guiStrings[26 + offsetOptions];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Sounds are
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[1].labelString = _vm->_guiStrings[27 + offsetOptions];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Walk speed
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[2].labelString = &_vm->_guiStrings[24 + offsetOptions][walkspeedGarbageOffset];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Text speed
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[4].labelString = _vm->_guiStrings[25 + offsetOptions];
|
2006-04-23 14:43:16 +00:00
|
|
|
// Main Menu
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[5].itemString = &_vm->_guiStrings[19 + offsetMainMenu][menuLabelGarbageOffset];
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->gameFlags().isTalkie)
|
2006-04-23 14:43:16 +00:00
|
|
|
// Text & Voice
|
2008-03-28 09:00:30 +00:00
|
|
|
_voiceTextString = _vm->_guiStrings[28 + offset];
|
2007-04-15 16:41:20 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_textSpeedString = _vm->_guiStrings[25 + offsetOptions];
|
|
|
|
_onString = _vm->_guiStrings[20 + offsetOn];
|
|
|
|
_offString = _vm->_guiStrings[21 + offset];
|
|
|
|
_onCDString = _vm->_guiStrings[21];
|
2006-04-23 14:43:16 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::buttonMenuCallback(Button *caller) {
|
2006-01-22 09:34:12 +00:00
|
|
|
_displayMenu = true;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
assert(_vm->_guiStrings);
|
|
|
|
assert(_vm->_configStrings);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
/*
|
2008-03-28 09:00:30 +00:00
|
|
|
for (int i = 0; i < _vm->_guiStringsSize; i++)
|
|
|
|
debug("GUI string %i: %s", i, _vm->_guiStrings[i]);
|
2006-04-23 14:43:16 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
for (int i = 0; i < _vm->_configStringsSize; i++)
|
|
|
|
debug("Config string %i: %s", i, _vm->_configStrings[i]);
|
2006-04-23 14:43:16 +00:00
|
|
|
*/
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
setGUILabels();
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->_currentCharacter->sceneId == 210 && _vm->_deathHandler == 0xFF) {
|
|
|
|
_vm->snd_playSoundEffect(0x36);
|
2006-01-22 09:34:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
// XXX
|
2006-03-18 11:22:18 +00:00
|
|
|
_screen->setPaletteIndex(0xFE, 60, 60, 0);
|
2006-01-22 09:34:12 +00:00
|
|
|
for (int i = 0; i < 6; i++) {
|
2008-03-28 09:00:30 +00:00
|
|
|
_menuButtonData[i].data0Val1 = _menuButtonData[i].data1Val1 = _menuButtonData[i].data2Val1 = 4;
|
|
|
|
_menuButtonData[i].data0Callback = _redrawShadedButtonFunctor;
|
|
|
|
_menuButtonData[i].data1Callback = _redrawButtonFunctor;
|
|
|
|
_menuButtonData[i].data2Callback = _redrawButtonFunctor;
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
2008-03-28 09:00:30 +00:00
|
|
|
fadePalette();
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-03-08 13:15:13 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
2008-03-28 09:00:30 +00:00
|
|
|
initMenuLayout(_menu[i]);
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
_menuRestoreScreen = true;
|
2007-06-22 23:03:12 +00:00
|
|
|
_keyPressed.reset();
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_mousePressFlag = false;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-03-07 14:16:52 +00:00
|
|
|
_toplevelMenu = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->_menuDirectlyToLoad) {
|
|
|
|
loadGameMenu(0);
|
2007-04-15 16:41:20 +00:00
|
|
|
} else {
|
2006-03-07 14:16:52 +00:00
|
|
|
if (!caller)
|
|
|
|
_toplevelMenu = 4;
|
|
|
|
|
|
|
|
initMenu(_menu[_toplevelMenu]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_displayMenu && !_vm->_quitFlag) {
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[_toplevelMenu], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
|
|
|
getInput();
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_menuRestoreScreen) {
|
2008-03-28 09:00:30 +00:00
|
|
|
restorePalette();
|
2006-01-22 09:34:12 +00:00
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_animator->_updateScreen = true;
|
2007-04-15 16:41:20 +00:00
|
|
|
} else {
|
2006-01-22 09:34:12 +00:00
|
|
|
_screen->deletePageFromDisk(0);
|
2007-04-15 16:41:20 +00:00
|
|
|
}
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::getInput() {
|
2007-03-17 19:02:05 +00:00
|
|
|
Common::Event event;
|
2006-06-18 10:39:57 +00:00
|
|
|
static uint32 lastScreenUpdate = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
uint32 now = _vm->_system->getMillis();
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-03-15 13:32:35 +00:00
|
|
|
_mouseWheel = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_vm->_eventMan->pollEvent(event)) {
|
2006-01-22 09:34:12 +00:00
|
|
|
switch (event.type) {
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_QUIT:
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->quitGame();
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_mousePressFlag = true;
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_LBUTTONUP:
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_mousePressFlag = false;
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_MOUSEMOVE:
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_system->updateScreen();
|
2006-06-18 10:39:57 +00:00
|
|
|
lastScreenUpdate = now;
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_WHEELUP:
|
2006-05-08 10:16:19 +00:00
|
|
|
_mouseWheel = -1;
|
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_WHEELDOWN:
|
2006-05-08 10:16:19 +00:00
|
|
|
_mouseWheel = 1;
|
|
|
|
break;
|
2007-03-17 19:02:05 +00:00
|
|
|
case Common::EVENT_KEYDOWN:
|
2007-06-22 23:03:12 +00:00
|
|
|
_keyPressed = event.kbd;
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-27 08:23:53 +00:00
|
|
|
|
2006-06-18 10:39:57 +00:00
|
|
|
if (now - lastScreenUpdate > 50) {
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_system->updateScreen();
|
2006-06-18 10:39:57 +00:00
|
|
|
lastScreenUpdate = now;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_system->delayMillis(3);
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::resumeGame(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::resumeGame()");
|
|
|
|
updateMenuButton(button);
|
2006-01-22 09:34:12 +00:00
|
|
|
_displayMenu = false;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::setupSavegames(Menu &menu, int num) {
|
2006-01-22 09:34:12 +00:00
|
|
|
Common::InSaveFile *in;
|
|
|
|
static char savenames[5][31];
|
2006-01-27 08:23:53 +00:00
|
|
|
uint8 startSlot;
|
2006-01-22 09:34:12 +00:00
|
|
|
assert(num <= 5);
|
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
if (_savegameOffset == 0) {
|
|
|
|
menu.item[0].itemString = _specialSavegameString;
|
|
|
|
menu.item[0].enabled = 1;
|
2007-12-24 02:42:58 +00:00
|
|
|
menu.item[0].saveSlot = 0;
|
2006-01-27 08:23:53 +00:00
|
|
|
startSlot = 1;
|
2007-04-15 16:41:20 +00:00
|
|
|
} else {
|
2006-01-27 08:23:53 +00:00
|
|
|
startSlot = 0;
|
2007-04-15 16:41:20 +00:00
|
|
|
}
|
2006-01-27 08:23:53 +00:00
|
|
|
|
2008-04-05 17:33:54 +00:00
|
|
|
for (int i = startSlot; i < num; ++i)
|
|
|
|
menu.item[i].enabled = 0;
|
|
|
|
|
2008-03-30 18:27:46 +00:00
|
|
|
KyraEngine::SaveHeader header;
|
2008-04-05 01:49:28 +00:00
|
|
|
for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); i++) {
|
|
|
|
if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header))) {
|
2008-03-30 18:27:46 +00:00
|
|
|
strncpy(savenames[i], header.description.c_str(), 31);
|
2006-01-22 09:34:12 +00:00
|
|
|
menu.item[i].itemString = savenames[i];
|
|
|
|
menu.item[i].enabled = 1;
|
2008-04-05 01:49:28 +00:00
|
|
|
menu.item[i].saveSlot = _saveSlots[i + _savegameOffset];
|
2006-01-22 09:34:12 +00:00
|
|
|
delete in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::saveGameMenu(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::saveGameMenu()");
|
2008-04-05 01:49:28 +00:00
|
|
|
updateSaveList();
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_menu[2].item[5].enabled = true;
|
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[2].menuNameString = _vm->_guiStrings[8]; // Select a position to save to:
|
|
|
|
_specialSavegameString = _vm->_guiStrings[9]; // [ EMPTY SLOT ]
|
2006-01-27 08:23:53 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[2].item[i].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::saveGame);
|
2006-01-27 08:23:53 +00:00
|
|
|
|
|
|
|
_savegameOffset = 0;
|
|
|
|
setupSavegames(_menu[2], 5);
|
|
|
|
|
|
|
|
initMenu(_menu[2]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-27 08:23:53 +00:00
|
|
|
|
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = false;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_displaySubMenu && !_vm->_quitFlag) {
|
|
|
|
getInput();
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[2], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
|
|
|
if (_cancelSubMenu) {
|
|
|
|
initMenu(_menu[0]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-27 08:23:53 +00:00
|
|
|
} else {
|
|
|
|
_displayMenu = false;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::loadGameMenu(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::loadGameMenu()");
|
2008-04-05 01:49:28 +00:00
|
|
|
updateSaveList();
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->_menuDirectlyToLoad) {
|
2006-01-27 08:23:53 +00:00
|
|
|
_menu[2].item[5].enabled = false;
|
2007-04-15 16:41:20 +00:00
|
|
|
} else {
|
2008-03-28 09:00:30 +00:00
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_menu[2].item[5].enabled = true;
|
|
|
|
}
|
|
|
|
|
2006-01-22 09:34:12 +00:00
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_specialSavegameString = _vm->_newGameString[0]; //[ START A NEW GAME ]
|
|
|
|
_menu[2].menuNameString = _vm->_guiStrings[7]; // Which game would you like to reload?
|
2006-01-27 08:23:53 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[2].item[i].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::loadGame);
|
2006-01-27 08:23:53 +00:00
|
|
|
|
2006-01-22 09:34:12 +00:00
|
|
|
_savegameOffset = 0;
|
|
|
|
setupSavegames(_menu[2], 5);
|
2006-01-27 08:23:53 +00:00
|
|
|
|
2006-01-22 09:34:12 +00:00
|
|
|
initMenu(_menu[2]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = false;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_displaySubMenu && !_vm->_quitFlag) {
|
|
|
|
getInput();
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[2], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
if (_cancelSubMenu) {
|
2006-03-07 14:16:52 +00:00
|
|
|
initMenu(_menu[_toplevelMenu]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-22 09:34:12 +00:00
|
|
|
} else {
|
2008-03-28 09:00:30 +00:00
|
|
|
restorePalette();
|
|
|
|
_vm->loadGame(_vm->getSavegameFilename(_vm->_gameToLoad));
|
2006-01-22 09:34:12 +00:00
|
|
|
_displayMenu = false;
|
|
|
|
_menuRestoreScreen = false;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::redrawTextfield() {
|
2006-01-27 08:23:53 +00:00
|
|
|
_screen->fillRect(38, 91, 287, 102, 250);
|
2006-01-28 05:09:39 +00:00
|
|
|
_text->printText(_savegameName, 38, 92, 253, 0, 0);
|
|
|
|
|
|
|
|
_screen->_charWidth = -2;
|
|
|
|
int width = _screen->getTextWidth(_savegameName);
|
|
|
|
_screen->fillRect(39 + width, 93, 45 + width, 100, 254);
|
|
|
|
_screen->_charWidth = 0;
|
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
_screen->updateScreen();
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::updateSavegameString() {
|
2006-01-27 08:23:53 +00:00
|
|
|
int length;
|
|
|
|
|
2007-06-22 23:03:12 +00:00
|
|
|
if (_keyPressed.keycode) {
|
2006-01-27 08:23:53 +00:00
|
|
|
length = strlen(_savegameName);
|
|
|
|
|
2007-06-22 23:03:12 +00:00
|
|
|
if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127) {
|
2006-01-27 08:23:53 +00:00
|
|
|
if (length < 31) {
|
2007-06-22 23:03:12 +00:00
|
|
|
_savegameName[length] = _keyPressed.ascii;
|
2006-01-27 08:23:53 +00:00
|
|
|
_savegameName[length+1] = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
redrawTextfield();
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
2007-06-22 23:03:12 +00:00
|
|
|
} else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE ||
|
|
|
|
_keyPressed.keycode == Common::KEYCODE_DELETE) {
|
2006-01-27 08:23:53 +00:00
|
|
|
if (length > 0) {
|
|
|
|
_savegameName[length-1] = 0;
|
2008-03-28 09:00:30 +00:00
|
|
|
redrawTextfield();
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
2007-06-22 23:03:12 +00:00
|
|
|
} else if (_keyPressed.keycode == Common::KEYCODE_RETURN ||
|
|
|
|
_keyPressed.keycode == Common::KEYCODE_KP_ENTER) {
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-22 23:03:12 +00:00
|
|
|
_keyPressed.reset();
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::saveGame(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::saveGame()");
|
|
|
|
updateMenuButton(button);
|
2008-03-30 18:27:46 +00:00
|
|
|
_vm->_gameToLoad = _menu[2].item[button->index-0xC].saveSlot;
|
2006-01-27 08:23:53 +00:00
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
|
|
|
initMenu(_menu[3]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-27 08:23:53 +00:00
|
|
|
|
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = false;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_savegameOffset == 0 && _vm->_gameToLoad == 0) {
|
2006-01-27 08:23:53 +00:00
|
|
|
_savegameName[0] = 0;
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < 5; i++) {
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_menu[2].item[i].saveSlot == _vm->_gameToLoad) {
|
2006-01-27 08:23:53 +00:00
|
|
|
strncpy(_savegameName, _menu[2].item[i].itemString, 31);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-03-28 09:00:30 +00:00
|
|
|
redrawTextfield();
|
|
|
|
|
|
|
|
while (_displaySubMenu && !_vm->_quitFlag) {
|
|
|
|
getInput();
|
|
|
|
updateSavegameString();
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[3], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_cancelSubMenu) {
|
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = false;
|
|
|
|
initMenu(_menu[2]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-27 08:23:53 +00:00
|
|
|
} else {
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_savegameOffset == 0 && _vm->_gameToLoad == 0)
|
|
|
|
_vm->_gameToLoad = getNextSavegameSlot();
|
|
|
|
if (_vm->_gameToLoad > 0)
|
|
|
|
_vm->saveGame(_vm->getSavegameFilename(_vm->_gameToLoad), _savegameName);
|
2006-01-27 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::savegameConfirm(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::savegameConfirm()");
|
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::loadGame(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::loadGame()");
|
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
2008-03-30 18:27:46 +00:00
|
|
|
_vm->_gameToLoad = _menu[2].item[button->index-0xC].saveSlot;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::cancelSubMenu(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::cancelSubMenu()");
|
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
|
|
|
_cancelSubMenu = true;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::quitPlaying(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::quitPlaying()");
|
|
|
|
updateMenuButton(button);
|
2006-01-28 05:09:39 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (quitConfirm(_vm->_guiStrings[14])) { // Are you sure you want to quit playing?
|
|
|
|
_vm->quitGame();
|
2007-04-15 16:41:20 +00:00
|
|
|
} else {
|
2006-03-07 14:16:52 +00:00
|
|
|
initMenu(_menu[_toplevelMenu]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
bool GUI_v1::quitConfirm(const char *str) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirm()");
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[1].menuNameString = str;
|
|
|
|
initMenuLayout(_menu[1]);
|
2006-01-22 09:34:12 +00:00
|
|
|
initMenu(_menu[1]);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = true;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_displaySubMenu && !_vm->_quitFlag) {
|
|
|
|
getInput();
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[1], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2006-01-27 08:23:53 +00:00
|
|
|
return !_cancelSubMenu;
|
2006-01-22 09:34:12 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::quitConfirmYes(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirmYes()");
|
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
|
|
|
_cancelSubMenu = false;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::quitConfirmNo(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::quitConfirmNo()");
|
|
|
|
updateMenuButton(button);
|
2006-01-27 08:23:53 +00:00
|
|
|
_displaySubMenu = false;
|
|
|
|
_cancelSubMenu = true;
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::gameControlsMenu(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::gameControlsMenu()");
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->readSettings();
|
2006-05-28 09:21:32 +00:00
|
|
|
|
2006-03-08 13:15:13 +00:00
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->gameFlags().isTalkie) {
|
2006-04-25 15:42:37 +00:00
|
|
|
//_menu[5].width = 230;
|
2006-03-08 13:15:13 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
2006-04-25 15:42:37 +00:00
|
|
|
//_menu[5].item[i].labelX = 24;
|
|
|
|
//_menu[5].item[i].x = 115;
|
2007-01-26 21:47:42 +00:00
|
|
|
//_menu[5].item[i].width = 94;
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
|
2006-04-23 14:43:16 +00:00
|
|
|
_menu[5].item[3].labelString = _voiceTextString; //"Voice / Text "
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[3].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::controlsChangeVoice);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
|
|
|
} else {
|
2007-01-26 21:47:42 +00:00
|
|
|
//_menu[5].height = 136;
|
|
|
|
//_menu[5].item[5].y = 110;
|
2006-03-08 13:15:13 +00:00
|
|
|
_menu[5].item[4].enabled = 0;
|
2006-04-23 14:43:16 +00:00
|
|
|
_menu[5].item[3].labelString = _textSpeedString; // "Text speed "
|
2008-03-28 09:00:30 +00:00
|
|
|
_menu[5].item[3].callback = BUTTON_FUNCTOR(GUI_v1, this, &GUI_v1::controlsChangeText);
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-03-08 13:15:13 +00:00
|
|
|
|
|
|
|
_displaySubMenu = true;
|
|
|
|
_cancelSubMenu = false;
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
while (_displaySubMenu && !_vm->_quitFlag) {
|
|
|
|
getInput();
|
|
|
|
Common::Point mouse = _vm->getMousePos();
|
|
|
|
processHighlights(_menu[5], mouse.x, mouse.y);
|
|
|
|
processButtonList(_menuButtonList, 0);
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
|
|
|
|
_screen->savePageToDisk("SEENPAGE.TMP", 0);
|
|
|
|
|
|
|
|
if (_cancelSubMenu) {
|
|
|
|
initMenu(_menu[_toplevelMenu]);
|
2008-03-28 09:00:30 +00:00
|
|
|
updateAllMenuButtons();
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::setupControls(Menu &menu) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::setupControls()");
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
switch (_vm->_configMusic) {
|
2007-03-24 00:04:08 +00:00
|
|
|
case 0:
|
|
|
|
menu.item[0].itemString = _offString; //"Off"
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
menu.item[0].itemString = _onString; //"On"
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
menu.item[0].itemString = _onCDString; //"On + CD"
|
|
|
|
break;
|
|
|
|
}
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->_configSounds)
|
2006-04-23 14:43:16 +00:00
|
|
|
menu.item[1].itemString = _onString; //"On"
|
2006-03-08 13:15:13 +00:00
|
|
|
else
|
2006-04-23 14:43:16 +00:00
|
|
|
menu.item[1].itemString = _offString; //"Off"
|
2006-03-08 13:15:13 +00:00
|
|
|
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
switch (_vm->_configWalkspeed) {
|
2006-05-08 10:16:19 +00:00
|
|
|
case 0:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[2].itemString = _vm->_configStrings[0]; //"Slowest"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[2].itemString = _vm->_configStrings[1]; //"Slow"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[2].itemString = _vm->_configStrings[2]; //"Normal"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[2].itemString = _vm->_configStrings[3]; //"Fast"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[2].itemString = _vm->_configStrings[4]; //"Fastest"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
menu.item[2].itemString = "ERROR";
|
|
|
|
break;
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int textControl = 3;
|
2006-04-23 14:43:16 +00:00
|
|
|
int clickableOffset = 8;
|
2008-03-28 09:00:30 +00:00
|
|
|
if (_vm->gameFlags().isTalkie) {
|
2006-03-08 13:15:13 +00:00
|
|
|
textControl = 4;
|
2006-04-23 14:43:16 +00:00
|
|
|
clickableOffset = 11;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-04-18 15:05:46 +00:00
|
|
|
if (_vm->_configVoice == 0) {
|
|
|
|
menu.item[4].enabled = 1;
|
|
|
|
menu.item[4].labelString = _textSpeedString;
|
|
|
|
} else {
|
|
|
|
menu.item[4].enabled = 0;
|
|
|
|
menu.item[4].labelString = 0;
|
|
|
|
}
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
switch (_vm->_configVoice) {
|
2006-03-08 13:15:13 +00:00
|
|
|
case 0:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[3].itemString = _vm->_configStrings[5]; //"Text only"
|
2006-03-08 13:15:13 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[3].itemString = _vm->_configStrings[6]; //"Voice only"
|
2006-03-08 13:15:13 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[3].itemString = _vm->_configStrings[7]; //"Voice & Text"
|
2006-03-08 13:15:13 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-05-08 10:16:19 +00:00
|
|
|
menu.item[3].itemString = "ERROR";
|
|
|
|
break;
|
|
|
|
}
|
2008-04-18 15:58:49 +00:00
|
|
|
} else {
|
|
|
|
menu.item[4].enabled = 0;
|
|
|
|
menu.item[4].labelString = 0;
|
2006-05-08 10:16:19 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
switch (_vm->_configTextspeed) {
|
2006-05-08 10:16:19 +00:00
|
|
|
case 0:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[textControl].itemString = _vm->_configStrings[1]; //"Slow"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[textControl].itemString = _vm->_configStrings[2]; //"Normal"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[textControl].itemString = _vm->_configStrings[3]; //"Fast"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2008-03-28 09:00:30 +00:00
|
|
|
menu.item[textControl].itemString = _vm->_configStrings[clickableOffset]; //"Clickable"
|
2006-05-08 10:16:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
menu.item[textControl].itemString = "ERROR";
|
|
|
|
break;
|
2006-03-08 13:15:13 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
initMenuLayout(menu);
|
2006-03-08 13:15:13 +00:00
|
|
|
initMenu(menu);
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsChangeMusic(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeMusic()");
|
|
|
|
updateMenuButton(button);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_configMusic = ++_vm->_configMusic % ((_vm->gameFlags().platform == Common::kPlatformFMTowns || _vm->gameFlags().platform == Common::kPlatformPC98) ? 3 : 2);
|
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsChangeSounds(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeSounds()");
|
|
|
|
updateMenuButton(button);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_configSounds = !_vm->_configSounds;
|
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsChangeWalk(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeWalk()");
|
|
|
|
updateMenuButton(button);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_configWalkspeed = ++_vm->_configWalkspeed % 5;
|
|
|
|
_vm->setWalkspeed(_vm->_configWalkspeed);
|
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsChangeText(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeText()");
|
|
|
|
updateMenuButton(button);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_configTextspeed = ++_vm->_configTextspeed % 4;
|
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsChangeVoice(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsChangeVoice()");
|
|
|
|
updateMenuButton(button);
|
2006-03-08 13:15:13 +00:00
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
_vm->_configVoice = ++_vm->_configVoice % 3;
|
|
|
|
setupControls(_menu[5]);
|
2006-03-08 13:15:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::controlsApply(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::controlsApply()");
|
|
|
|
_vm->writeSettings();
|
|
|
|
return cancelSubMenu(button);
|
2006-05-28 09:21:32 +00:00
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::scrollUp(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::scrollUp()");
|
|
|
|
updateMenuButton(button);
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
if (_savegameOffset > 0) {
|
|
|
|
_savegameOffset--;
|
|
|
|
setupSavegames(_menu[2], 5);
|
|
|
|
initMenu(_menu[2]);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
int GUI_v1::scrollDown(Button *button) {
|
|
|
|
debugC(9, kDebugLevelGUI, "GUI_v1::scrollDown()");
|
|
|
|
updateMenuButton(button);
|
2006-01-22 09:34:12 +00:00
|
|
|
|
|
|
|
_savegameOffset++;
|
2008-04-05 01:49:28 +00:00
|
|
|
if (uint(_savegameOffset + 5) >= _saveSlots.size())
|
|
|
|
_savegameOffset = MAX<int>(_saveSlots.size() - 5, 0);
|
2006-01-22 09:34:12 +00:00
|
|
|
setupSavegames(_menu[2], 5);
|
|
|
|
initMenu(_menu[2]);
|
|
|
|
|
2006-01-13 03:27:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::fadePalette() {
|
|
|
|
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
|
2007-03-23 16:24:28 +00:00
|
|
|
return;
|
|
|
|
|
2006-01-28 05:09:39 +00:00
|
|
|
static int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1};
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);
|
|
|
|
|
2007-04-15 16:41:20 +00:00
|
|
|
for (int i = 0; i < 768; i++)
|
|
|
|
_screen->_currentPalette[i] >>= 1;
|
2006-01-28 05:09:39 +00:00
|
|
|
|
2006-07-14 13:33:58 +00:00
|
|
|
while (menuPalIndexes[index] != -1) {
|
2006-01-28 05:09:39 +00:00
|
|
|
memcpy(&_screen->_currentPalette[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3);
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
_screen->fadePalette(_screen->_currentPalette, 2);
|
|
|
|
}
|
|
|
|
|
2008-03-28 09:00:30 +00:00
|
|
|
void GUI_v1::restorePalette() {
|
|
|
|
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
|
2007-03-23 16:24:28 +00:00
|
|
|
return;
|
|
|
|
|
2006-01-28 05:09:39 +00:00
|
|
|
memcpy(_screen->_currentPalette, _screen->getPalette(2), 768);
|
|
|
|
_screen->fadePalette(_screen->_currentPalette, 2);
|
|
|
|
}
|
|
|
|
|
2007-07-29 16:33:11 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
void KyraEngine_v1::drawAmulet() {
|
|
|
|
debugC(9, kDebugLevelMain, "KyraEngine_v1::drawAmulet()");
|
|
|
|
static const int16 amuletTable1[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x150, 0x155, 0x15A, 0x15F, 0x164, 0x145, -1};
|
|
|
|
static const int16 amuletTable3[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x14F, 0x154, 0x159, 0x15E, 0x163, 0x144, -1};
|
|
|
|
static const int16 amuletTable2[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x152, 0x157, 0x15C, 0x161, 0x166, 0x147, -1};
|
|
|
|
static const int16 amuletTable4[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x151, 0x156, 0x15B, 0x160, 0x165, 0x146, -1};
|
|
|
|
|
|
|
|
resetGameFlag(0xF1);
|
|
|
|
_screen->hideMouse();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
while (amuletTable1[i] != -1) {
|
|
|
|
if (queryGameFlag(87))
|
|
|
|
_screen->drawShape(0, _shapes[amuletTable1[i]], _amuletX[0], _amuletY[0], 0, 0);
|
|
|
|
|
|
|
|
if (queryGameFlag(89))
|
|
|
|
_screen->drawShape(0, _shapes[amuletTable2[i]], _amuletX[1], _amuletY[1], 0, 0);
|
|
|
|
|
|
|
|
if (queryGameFlag(86))
|
|
|
|
_screen->drawShape(0, _shapes[amuletTable3[i]], _amuletX[2], _amuletY[2], 0, 0);
|
|
|
|
|
|
|
|
if (queryGameFlag(88))
|
|
|
|
_screen->drawShape(0, _shapes[amuletTable4[i]], _amuletX[3], _amuletY[3], 0, 0);
|
|
|
|
|
|
|
|
_screen->updateScreen();
|
|
|
|
delayWithTicks(3);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
_screen->showMouse();
|
|
|
|
}
|
|
|
|
|
2006-01-02 22:58:59 +00:00
|
|
|
} // end of namespace Kyra
|
2008-01-27 19:47:41 +00:00
|
|
|
|