aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-02 03:16:34 +0000
committerJohannes Schickel2008-04-02 03:16:34 +0000
commit4fa0740a279b6e765db31bad3ec5d53ddef4ac2e (patch)
tree0f1bce8095e9c5f63b70111336f963436fa90294 /engines/kyra
parent887f7dfb283a90d1487f4e1d91c27b112d251bcd (diff)
downloadscummvm-rg350-4fa0740a279b6e765db31bad3ec5d53ddef4ac2e.tar.gz
scummvm-rg350-4fa0740a279b6e765db31bad3ec5d53ddef4ac2e.tar.bz2
scummvm-rg350-4fa0740a279b6e765db31bad3ec5d53ddef4ac2e.zip
Implemented death menu. This also fixes bug #1926892 "HoF: Odd behaviour when Zanthia gets killed(?)".
svn-id: r31360
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_v2.cpp63
-rw-r--r--engines/kyra/gui_v2.h3
-rw-r--r--engines/kyra/kyra_v2.cpp25
-rw-r--r--engines/kyra/staticres.cpp8
4 files changed, 84 insertions, 15 deletions
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index c80fc46969..141bb74afb 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -265,7 +265,7 @@ Button *GUI_v2::addButtonToList(Button *list, Button *newButton) {
void GUI_v2::processButton(Button *button) {
if (!button)
return;
-
+
if (button->flags & 8) {
if (button->flags & 0x10) {
// XXX
@@ -379,7 +379,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag) {
// but did some other magic, which looks like it depends on how the handle
// key input... so we just enable 0x1000 and 0x4000 here to allow
// all GUI buttons to work (for now at least...)
- if (inFlags == 199 || inFlags == 198)
+ if (inFlags == 198 || inFlags == 199)
temp = 0x1000 | 0x4000;
//if (inputFlag & 0x800)
@@ -546,7 +546,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag) {
if (!progress && buttonList == _unknownButtonList && !(buttonList->flags & 0x40))
_unknownButtonList = 0;
- if ((buttonList->flags2 & 0x18) == ((buttonList->flags2 & 3) << 3))
+ if ((buttonList->flags2 & 0x18) != ((buttonList->flags2 & 3) << 3))
processButton(buttonList);
if (unk2)
@@ -1156,7 +1156,11 @@ int KyraEngine_v2::cauldronButton(Button *button) {
#pragma mark -
void GUI_v2::getInput() {
+ if (!_displayMenu)
+ return;
+
_vm->checkInput(_menuButtonList);
+ _vm->removeInputTop();
if (_vm->quit()) {
_displayMenu = false;
_displaySubMenu = false;
@@ -1171,7 +1175,7 @@ int GUI_v2::optionsButton(Button *button) {
updateButton(&_vm->_inventoryButtons[0]);
_screen->showMouse();
- if (!_screen->isMouseVisible())
+ if (!_screen->isMouseVisible() && button)
return 0;
_vm->showMessage(0, 0xCF);
@@ -1184,7 +1188,7 @@ int GUI_v2::optionsButton(Button *button) {
return 0;
}
- //int oldHandItem = _vm->_itemInHand;
+ int oldHandItem = _vm->_itemInHand;
_screen->setMouseCursor(0, 0, _vm->getShapePtr(0));
_vm->displayInvWsaLastFrame();
//XXX
@@ -1203,6 +1207,8 @@ int GUI_v2::optionsButton(Button *button) {
//XXX
_loadMenu.numberOfItems = 6;
initMenuLayout(_loadMenu);
+ //XXX
+ initMenuLayout(_deathMenu);
if (_vm->_menuDirectlyToLoad) {
backUpPage1(_vm->_screenBuffer);
@@ -1225,6 +1231,48 @@ int GUI_v2::optionsButton(Button *button) {
return 0;
}
+ if (!button) {
+ _currentMenu = &_deathMenu;
+ _isDeathMenu = true;
+ } else {
+ //XXX just fail for now
+ return 0;
+ }
+
+ backUpPage1(_vm->_screenBuffer);
+ setupPalette();
+ initMenu(*_currentMenu);
+ _madeTempSave = false;
+ _loadedSave = false;
+ _vm->_itemInHand = -1;
+ updateAllMenuButtons();
+
+ if (_isDeathMenu) {
+ while (!_screen->isMouseVisible())
+ _screen->showMouse();
+ }
+
+ while (_displayMenu) {
+ processHighlights(*_currentMenu, _vm->_mouseX, _vm->_mouseY);
+ getInput();
+ }
+
+ if (_vm->_runFlag && !_loadedSave && !_madeTempSave) {
+ restorePalette();
+ restorePage1(_vm->_screenBuffer);
+ }
+
+ if (_vm->_runFlag)
+ updateMenuButton(&_vm->_inventoryButtons[0]);
+
+ resetState(oldHandItem);
+
+ if (!_loadedSave && _reloadTemporarySave) {
+ _vm->_unkSceneScreenFlag1 = true;
+ //XXX
+ _vm->_unkSceneScreenFlag1 = false;
+ }
+
return 0;
}
@@ -1354,8 +1402,7 @@ int GUI_v2::loadMenu(Button *caller) {
_screen->updateScreen();
while (_displaySubMenu) {
- Common::Point mouse = _vm->getMousePos();
- processHighlights(_loadMenu, mouse.x, mouse.y);
+ processHighlights(_loadMenu, _vm->_mouseX, _vm->_mouseY);
getInput();
}
@@ -1366,7 +1413,7 @@ int GUI_v2::loadMenu(Button *caller) {
initMenu(*_currentMenu);
updateAllMenuButtons();
}
- } else {
+ } else if (_vm->_gameToLoad >= 0) {
restorePage1(_vm->_screenBuffer);
restorePalette();
_vm->loadGame(_vm->getSavegameFilename(_vm->_gameToLoad));
diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h
index d103ae6c74..3d4c471f7b 100644
--- a/engines/kyra/gui_v2.h
+++ b/engines/kyra/gui_v2.h
@@ -111,7 +111,7 @@ private:
Button _menuButtons[7];
Button _scrollUpButton;
Button _scrollDownButton;
- Menu _loadMenu;
+ Menu _loadMenu, _deathMenu;
void initStaticData();
const char *getMenuTitle(const Menu &menu);
@@ -151,6 +151,7 @@ private:
Menu *_currentMenu;
bool _isDeathMenu;
bool _isSaveMenu;
+ bool _madeTempSave;
bool _loadedSave;
bool _restartGame;
bool _reloadTemporarySave;
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 04c98ca953..698a3484f6 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -411,11 +411,13 @@ void KyraEngine_v2::runLoop() {
_quitFlag = false;
_runFlag = true;
while (!_quitFlag && _runFlag) {
- //if (_deathHandler >= 0) {
- // removeHandItem();
- // waitTicks(5);
- // sub_270A0();
- //}
+ if (_deathHandler >= 0) {
+ removeHandItem();
+ delay(5);
+ _drawNoShapeFlag = 0;
+ _gui->optionsButton(0);
+ _deathHandler = -1;
+ }
if (_system->getMillis() > _nextIdleAnim)
showIdleAnim();
@@ -770,6 +772,10 @@ void KyraEngine_v2::updateInput() {
_eventList.push_back(Event(event, true));
break;
+ case Common::EVENT_MOUSEMOVE:
+ _eventList.push_back(event);
+ break;
+
default:
break;
}
@@ -806,11 +812,18 @@ int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) {
}
break;
+ case Common::EVENT_MOUSEMOVE: {
+ Common::Point pos = getMousePos();
+ _mouseX = pos.x;
+ _mouseY = pos.y;
+ _screen->updateScreen();
+ } break;
+
case Common::EVENT_LBUTTONUP: {
Common::Point pos = getMousePos();
_mouseX = pos.x;
_mouseY = pos.y;
- keys = 198;
+ keys = 199;
breakLoop = true;
} break;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 6fb29a9362..1e4989cab9 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1496,6 +1496,7 @@ void GUI_v2::initStaticData() {
}
Button::Callback clickLoadSlotFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::clickLoadSlot);
+ Button::Callback clickLoadMenuFunctor = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::loadMenu);
GUI_V2_MENU(_loadMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, 8, 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C);
GUI_V2_MENU_ITEM(_loadMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
@@ -1508,6 +1509,13 @@ void GUI_v2::initStaticData() {
GUI_V2_MENU_ITEM(_loadMenu.item[5], 1, 0x0B, 0xB8, 0x86, 0x58, 0xF, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
_loadMenu.item[6].enabled = false;
+
+ GUI_V2_MENU(_deathMenu, -1, -1, 0xD0, 0x4C, 0xF8, 0xF9, 0xFA, 0xE, 0xFB, -1, 8, 0, 2, -1, -1, -1, -1);
+ GUI_V2_MENU_ITEM(_deathMenu.item[0], 1, 2, -1, 0x1E, 0xB4, 0x0F, 0xFC, 0xFD, 8, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+ _deathMenu.item[0].callback = clickLoadMenuFunctor;
+ GUI_V2_MENU_ITEM(_deathMenu.item[1], 1, 5, -1, 0x2F, 0xB4, 0x0F, 0xFC, 0xFD, 8, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+ for (int i = 2; i <= 6; ++i)
+ _deathMenu.item[i].enabled = false;
}
const uint16 KyraEngine_v2::_itemMagicTable[] = {