[Scummvm-cvs-logs] SF.net SVN: scummvm: [31376] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Fri Apr 4 08:45:39 CEST 2008
Revision: 31376
http://scummvm.svn.sourceforge.net/scummvm/?rev=31376&view=rev
Author: lordhoto
Date: 2008-04-03 23:45:39 -0700 (Thu, 03 Apr 2008)
Log Message:
-----------
Added support for quit game button.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/gui_v2.cpp
scummvm/trunk/engines/kyra/gui_v2.h
scummvm/trunk/engines/kyra/staticres.cpp
Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp 2008-04-04 06:24:49 UTC (rev 31375)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp 2008-04-04 06:45:39 UTC (rev 31376)
@@ -28,6 +28,7 @@
#include "kyra/screen.h"
#include "kyra/wsamovie.h"
#include "kyra/timer.h"
+#include "kyra/sound.h"
#include "common/savefile.h"
@@ -1208,6 +1209,7 @@
initMenuLayout(_mainMenu);
//XXX
+ initMenuLayout(_choiceMenu);
_loadMenu.numberOfItems = 6;
initMenuLayout(_loadMenu);
initMenuLayout(_saveMenu);
@@ -1408,6 +1410,24 @@
#pragma mark -
+int GUI_v2::quitGame(Button *caller) {
+ updateMenuButton(caller);
+ if (choiceDialog(0xF, 1)) {
+ _displayMenu = false;
+ _vm->_runFlag = false;
+ _vm->_sound->beginFadeOut();
+ _screen->fadeToBlack();
+ _screen->clearCurPage();
+ }
+
+ if (_vm->_runFlag) {
+ initMenu(*_currentMenu);
+ updateAllMenuButtons();
+ }
+
+ return 0;
+}
+
int GUI_v2::resumeGame(Button *caller) {
updateMenuButton(caller);
_displayMenu = false;
@@ -1704,5 +1724,43 @@
_screen->fillRect(x+1, y+1, x+7, y+8, c);
}
+bool GUI_v2::choiceDialog(int name, bool type) {
+ _choiceMenu.highlightedItem = 0;
+ restorePage1(_vm->_screenBuffer);
+ backUpPage1(_vm->_screenBuffer);
+ if (type)
+ _choiceMenu.numberOfItems = 2;
+ else
+ _choiceMenu.numberOfItems = 1;
+ _choiceMenu.menuNameId = name;
+
+ initMenu(_choiceMenu);
+ _isChoiceMenu = true;
+ _choice = false;
+
+ while (_isChoiceMenu) {
+ processHighlights(_choiceMenu, _vm->_mouseX, _vm->_mouseY);
+ getInput();
+ }
+
+ restorePage1(_vm->_screenBuffer);
+ backUpPage1(_vm->_screenBuffer);
+ return _choice;
+}
+
+int GUI_v2::choiceYes(Button *caller) {
+ updateMenuButton(caller);
+ _choice = true;
+ _isChoiceMenu = false;
+ return 0;
+}
+
+int GUI_v2::choiceNo(Button *caller) {
+ updateMenuButton(caller);
+ _choice = false;
+ _isChoiceMenu = false;
+ return 0;
+}
+
} // end of namespace Kyra
Modified: scummvm/trunk/engines/kyra/gui_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.h 2008-04-04 06:24:49 UTC (rev 31375)
+++ scummvm/trunk/engines/kyra/gui_v2.h 2008-04-04 06:45:39 UTC (rev 31376)
@@ -111,7 +111,7 @@
Button _menuButtons[7];
Button _scrollUpButton;
Button _scrollDownButton;
- Menu _mainMenu, _loadMenu, _saveMenu, _savenameMenu, _deathMenu;
+ Menu _mainMenu, _choiceMenu, _loadMenu, _saveMenu, _savenameMenu, _deathMenu;
void initStaticData();
const char *getMenuTitle(const Menu &menu);
@@ -152,6 +152,7 @@
bool _isLoadMenu;
bool _isDeathMenu;
bool _isSaveMenu;
+ bool _isChoiceMenu;
bool _madeSave;
bool _loadedSave;
bool _restartGame;
@@ -162,6 +163,7 @@
void setupSavegameNames(Menu &menu, int num);
// main menu
+ int quitGame(Button *caller);
int resumeGame(Button *caller);
// load menu
@@ -192,6 +194,13 @@
void checkTextfieldInput();
void drawTextfieldBlock(int x, int y, uint8 c);
+ // choice menu
+ bool _choice;
+
+ bool choiceDialog(int name, bool type);
+ int choiceYes(Button *caller);
+ int choiceNo(Button *caller);
+
static const uint16 _menuStringsTalkie[];
static const uint16 _menuStringsOther[];
};
Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp 2008-04-04 06:24:49 UTC (rev 31375)
+++ scummvm/trunk/engines/kyra/staticres.cpp 2008-04-04 06:45:39 UTC (rev 31376)
@@ -1520,10 +1520,21 @@
GUI_V2_MENU_ITEM(_mainMenu.item[3], 1, 0x04, -1, 0x51, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
GUI_V2_MENU_ITEM(_mainMenu.item[4], 1, 0x25, -1, 0x62, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
GUI_V2_MENU_ITEM(_mainMenu.item[5], 1, 0x05, -1, 0x73, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+ _mainMenu.item[5].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::quitGame);
GUI_V2_MENU_ITEM(_mainMenu.item[6], 1, 0x06, -1, 0x90, 0xDC, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
_mainMenu.item[6].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::resumeGame);
for (int i = 0; i < 7; ++i)
_mainMenu.item[i].itemId = menuStr[0 * 8 + i + 1];
+
+ GUI_V2_MENU(_choiceMenu, -1, -1, 0x140, 0x38, 0xF8, 0xF9, 0xFA, 0, 0xFE, -1, 8, 0, 2, -1, -1, -1, -1);
+ GUI_V2_MENU_ITEM(_choiceMenu.item[0], 1, 0x14, 0x18, 0x1E, 0x48, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+ _choiceMenu.item[0].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::choiceYes);
+ GUI_V2_MENU_ITEM(_choiceMenu.item[1], 1, 0x13, 0xD8, 0x1E, 0x48, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
+ _choiceMenu.item[1].callback = BUTTON_FUNCTOR(GUI_v2, this, &GUI_v2::choiceNo);
+ for (int i = 2; i <= 6; ++i)
+ _choiceMenu.item[i].enabled = false;
+ for (int i = 0; i < 7; ++i)
+ _choiceMenu.item[i].itemId = menuStr[3 * 8 + i + 1];
GUI_V2_MENU(_loadMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, menuStr[4 * 8], 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C);
GUI_V2_MENU_ITEM(_loadMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0);
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