[Scummvm-cvs-logs] SF.net SVN: scummvm: [31360] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Apr 2 05:16:35 CEST 2008


Revision: 31360
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31360&view=rev
Author:   lordhoto
Date:     2008-04-01 20:16:34 -0700 (Tue, 01 Apr 2008)

Log Message:
-----------
Implemented death menu. This also fixes bug #1926892 "HoF: Odd behaviour when Zanthia gets killed(?)".

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/gui_v2.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-02 02:46:50 UTC (rev 31359)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-02 03:16:34 UTC (rev 31360)
@@ -265,7 +265,7 @@
 void GUI_v2::processButton(Button *button) {
 	if (!button)
 		return;
-	
+
 	if (button->flags & 8) {
 		if (button->flags & 0x10) {
 			// XXX
@@ -379,7 +379,7 @@
 		// 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 @@
 		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 @@
 #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 @@
 	updateButton(&_vm->_inventoryButtons[0]);
 	_screen->showMouse();
 
-	if (!_screen->isMouseVisible())
+	if (!_screen->isMouseVisible() && button)
 		return 0;
 
 	_vm->showMessage(0, 0xCF);
@@ -1184,7 +1188,7 @@
 		return 0;
 	}
 
-	//int oldHandItem = _vm->_itemInHand;
+	int oldHandItem = _vm->_itemInHand;
 	_screen->setMouseCursor(0, 0, _vm->getShapePtr(0));
 	_vm->displayInvWsaLastFrame();
 	//XXX
@@ -1203,6 +1207,8 @@
 	//XXX
 	_loadMenu.numberOfItems = 6;
 	initMenuLayout(_loadMenu);
+	//XXX
+	initMenuLayout(_deathMenu);
 	
 	if (_vm->_menuDirectlyToLoad) {
 		backUpPage1(_vm->_screenBuffer);
@@ -1225,6 +1231,48 @@
 		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 @@
 
 	_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 @@
 			initMenu(*_currentMenu);
 			updateAllMenuButtons();
 		}
-	} else {
+	} else if (_vm->_gameToLoad >= 0) {
 		restorePage1(_vm->_screenBuffer);
 		restorePalette();
 		_vm->loadGame(_vm->getSavegameFilename(_vm->_gameToLoad));

Modified: scummvm/trunk/engines/kyra/gui_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.h	2008-04-02 02:46:50 UTC (rev 31359)
+++ scummvm/trunk/engines/kyra/gui_v2.h	2008-04-02 03:16:34 UTC (rev 31360)
@@ -111,7 +111,7 @@
 	Button _menuButtons[7];
 	Button _scrollUpButton;
 	Button _scrollDownButton;
-	Menu _loadMenu;
+	Menu _loadMenu, _deathMenu;
 	void initStaticData();
 
 	const char *getMenuTitle(const Menu &menu);
@@ -151,6 +151,7 @@
 	Menu *_currentMenu;
 	bool _isDeathMenu;
 	bool _isSaveMenu;
+	bool _madeTempSave;
 	bool _loadedSave;
 	bool _restartGame;
 	bool _reloadTemporarySave;

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-04-02 02:46:50 UTC (rev 31359)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-04-02 03:16:34 UTC (rev 31360)
@@ -411,11 +411,13 @@
 	_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 @@
 			_eventList.push_back(Event(event, true));
 			break;
 
+		case Common::EVENT_MOUSEMOVE:
+			_eventList.push_back(event);
+			break;
+
 		default:
 			break;
 		}
@@ -806,11 +812,18 @@
 			}
 			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;
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-04-02 02:46:50 UTC (rev 31359)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-04-02 03:16:34 UTC (rev 31360)
@@ -1496,6 +1496,7 @@
 	}
 
 	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 @@
 
 	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[] = {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list