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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Tue Jun 16 23:23:26 CEST 2009


Revision: 41596
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41596&view=rev
Author:   athrxx
Date:     2009-06-16 21:23:26 +0000 (Tue, 16 Jun 2009)

Log Message:
-----------
LOL: implemented options menu (settings aren't saved yet)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/gui_lol.h
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/sequences_lol.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/gui.cpp	2009-06-16 21:23:26 UTC (rev 41596)
@@ -154,7 +154,9 @@
 	for (int i = 0; i < menu.numberOfItems; ++i) {
 		if (getMenuItemLabel(menu.item[i])) {
 			if (_vm->gameFlags().gameID == GI_LOL) {
-				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 8);
+				menu.item[i].labelX = menu.item[i].x - 1;
+				menu.item[i].labelY = menu.item[i].y + 3;
+				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 10);
 			} else {
 				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX - 1, menu.y + menu.item[i].labelY + 1, defaultColor1(), 0, 0);
 				printMenuText(getMenuItemLabel(menu.item[i]), menu.x + menu.item[i].labelX, menu.y + menu.item[i].labelY, menu.item[i].textColor, 0, 0);

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-16 21:23:26 UTC (rev 41596)
@@ -1570,15 +1570,7 @@
 	enableSysTimer(2);
 	updateDrawPage2();
 
-	char filename[13];
-	snprintf(filename, sizeof(filename), "LEVEL%02d.%s", _currentLevel, _languageExt[_lang]);
-	if (_levelLangFile)
-		delete[] _levelLangFile;
-	_levelLangFile = _res->fileData(filename, 0);
-	snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]);
-	if (_landsFile)
-		delete[] _landsFile;
-	_landsFile = _res->fileData(filename, 0);
+	gui_drawPlayField();
 
 //	if (!_speechFlag)
 //		enableText()	
@@ -1988,9 +1980,8 @@
 		}
 	}
 
-	Common::Point p = _vm->getMousePos();
-	int mouseX = p.x;
-	int mouseY = p.y;
+	int mouseX = _vm->_mouseX;
+	int mouseY = _vm->_mouseY;
 
 	uint16 flags = 0;
 
@@ -2251,6 +2242,34 @@
 			setupSavegameNames(*_currentMenu, 4);
 		}
 
+		if (_currentMenu == &_gameOptions) {
+			char *s = (char *)_vm->_tempBuffer5120;
+			strncpy(s, _vm->getLangString(0x406f + _vm->_monsterDifficulty), 30);
+			s[29] = 0;
+			_currentMenu->item[0].itemString = s;
+			s += (strlen(s) + 1);
+			
+			strncpy(s, _vm->getLangString(_vm->_smoothScrollingEnabled ? 0x4068 : 0x4069), 30);
+			s[29] = 0;
+			_currentMenu->item[1].itemString = s;
+			s += (strlen(s) + 1);
+
+			strncpy(s, _vm->getLangString(_vm->_floatingCursorsEnabled ? 0x4068 : 0x4069), 30);
+			s[29] = 0;
+			_currentMenu->item[2].itemString = s;
+			s += (strlen(s) + 1);
+
+			strncpy(s, _vm->getLangString(0x42d6 + _vm->_lang), 30);
+			s[29] = 0;
+			_currentMenu->item[3].itemString = s;
+			s += (strlen(s) + 1);
+
+			strncpy(s, _vm->getLangString(_vm->textEnabled() ? 0x4068 : 0x4069), 30);
+			s[29] = 0;
+			_currentMenu->item[4].itemString = s;
+			s += (strlen(s) + 1);
+		}
+
 		hasScrollButtons = _currentMenu->highlightedItem;
 		_currentMenu->highlightedItem = 255;
 
@@ -2281,7 +2300,7 @@
 
 		if (_currentMenu == &_mainMenu) {
 			Screen::FontId f = _screen->setFont(Screen::FID_6_FNT);
-			_screen->fprintString("SVN %s", menu.x + 8, menu.y + menu.height - 12, 204, 0, 8, gScummVMVersion);
+			_screen->fprintString("%s", menu.x + 8, menu.y + menu.height - 12, 204, 0, 8, gScummVMVersion);
 			_screen->setFont(f);
 			_screen->updateScreen();
 		}
@@ -2376,6 +2395,9 @@
 	if (!_displayMenu)
 		return 0;
 
+	Common::Point p = _vm->getMousePos();
+	_vm->_mouseX = p.x;
+	_vm->_mouseY = p.y;
 	int inputFlag = _vm->checkInput(_menuButtonList);
 	_vm->removeInputTop();
 
@@ -2399,7 +2421,7 @@
 		//_newMenu = &_deleteMenu;
 		break;
 	case 0x4004:
-		//_newMenu = &_gameOptions;
+		_newMenu = &_gameOptions;
 		break;
 	case 0x42D9:
 		//_newMenu = &_audioOptions;
@@ -2433,6 +2455,42 @@
 	return 1;
 }
 
+int GUI_LoL::clickedOptionsMenu(Button *button) {
+	updateMenuButton(button);
+	
+	switch (button->arg) {
+	case 0xfff7:
+		_vm->_monsterDifficulty = ++_vm->_monsterDifficulty % 3;
+		break;
+	case 0xfff6:
+		_vm->_smoothScrollingEnabled ^= true;		
+		break;		
+	case 0xfff5:
+		_vm->_floatingCursorsEnabled ^= true;		
+		break;
+	case 0xfff4:
+		_vm->_lang = ++_vm->_lang % 3;
+		break;
+	case 0xfff3:
+		_vm->_configVoice ^= 1;		
+		break;
+	case 0x4072:
+		char filename[13];
+		snprintf(filename, sizeof(filename), "LEVEL%02d.%s", _vm->_currentLevel, _vm->_languageExt[_vm->_lang]);
+		if (_vm->_levelLangFile)
+			delete[] _vm->_levelLangFile;
+		_vm->_levelLangFile = _vm->resource()->fileData(filename, 0);
+		snprintf(filename, sizeof(filename), "LANDS.%s", _vm->_languageExt[_vm->_lang]);
+		if (_vm->_landsFile)
+			delete[] _vm->_landsFile;
+		_vm->_landsFile = _vm->resource()->fileData(filename, 0);
+		_newMenu = _lastMenu;
+		break;
+	}
+
+	return 1;
+}
+
 int GUI_LoL::clickedDeathMenu(Button *button) {
 	updateMenuButton(button);
 	if (button->arg == _deathMenu.item[0].itemId) {
@@ -2481,13 +2539,15 @@
 const char *GUI_LoL::getMenuItemTitle(const MenuItem &menuItem) {
 	if (menuItem.itemId & 0x8000 && menuItem.itemString)
 		return menuItem.itemString;
-	else if (menuItem.itemId & 0x8000)
+	else if (menuItem.itemId & 0x8000 || !menuItem.itemId)
 		return 0;
 	return _vm->getLangString(menuItem.itemId);
 }
 
 const char *GUI_LoL::getMenuItemLabel(const MenuItem &menuItem) {
-	if (!menuItem.labelId)
+	if (menuItem.labelId & 0x8000 && menuItem.labelString)
+		return menuItem.labelString;
+	else if (menuItem.labelId & 0x8000 || !menuItem.labelId)
 		return 0;
 	return _vm->getLangString(menuItem.labelId);
 }

Modified: scummvm/trunk/engines/kyra/gui_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.h	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/gui_lol.h	2009-06-16 21:23:26 UTC (rev 41596)
@@ -57,6 +57,7 @@
 	do { \
 		item.enabled = 1; \
 		item.itemId = a; \
+		item.itemString = 0; \
 		item.x = b; \
 		item.y = c; \
 		item.width = d; \
@@ -69,6 +70,7 @@
 		item.color2 = 227; \
 		item.saveSlot = 0; \
 		item.labelId = f; \
+		item.labelString = 0; \
 		item.labelX = 0; \
 		item.labelY = 0; \
 		item.keyCode = g; \
@@ -109,6 +111,7 @@
 
 	int clickedMainMenu(Button *button);
 	int clickedLoadMenu(Button *button);
+	int clickedOptionsMenu(Button *button);
 	int clickedDeathMenu(Button *button);
 	int clickedChoiceMenu(Button *button);
 

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-16 21:23:26 UTC (rev 41596)
@@ -722,7 +722,7 @@
 	assert(menu);
 	menu->init(data[dataIndex], MainMenu::Animation());
 
-	int selection = menu->handle(_flags.isTalkie ? (hasSave ? 17 : 6) : (hasSave ? 6 : 18));
+	int selection = menu->handle(_flags.isTalkie ? (hasSave ? 19 : 6) : (hasSave ? 6 : 20));
 	delete menu;
 	_screen->setScreenDim(0);
 

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-06-16 21:23:26 UTC (rev 41596)
@@ -868,7 +868,7 @@
 	_screen->_charOffset = 0;
 
 	char *credits = (char *)_res->fileData("CREDITS.TXT", 0);
-	processCredits(credits, 19, 4, 5);
+	processCredits(credits, 21, 4, 5);
 	delete[] credits;
 
 	uint32 endTime = _system->getMillis() + 120 * _tickLength;
@@ -898,8 +898,8 @@
 	uint8 *doorShape = _screen->makeShapeCopy(_screen->getCPagePtr(5), 0);
 	assert(doorShape);
 
-	_screen->drawShape(0, doorShape, 0, 0, 20, 0x10);
-	_screen->drawShape(0, doorShape, 0, 0, 21, 0x11);
+	_screen->drawShape(0, doorShape, 0, 0, 22, 0x10);
+	_screen->drawShape(0, doorShape, 0, 0, 23, 0x11);
 
 	int curShapeFile = 0;
 	uint8 *shapes[12];
@@ -1045,8 +1045,8 @@
 		} else {
 			if (!monsterAnimFrame && doorRedraw) {
 				_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, page, Screen::CR_NO_P_CHECK);
-				_screen->drawShape(page, doorShape, 0, 0, 20, 0x10);
-				_screen->drawShape(page, doorShape, 0, 0, 21, 0x11);
+				_screen->drawShape(page, doorShape, 0, 0, 22, 0x10);
+				_screen->drawShape(page, doorShape, 0, 0, 23, 0x11);
 
 				--frameCounter;
 				doorRedraw = false;
@@ -1065,32 +1065,32 @@
 				bool isRightMonster = ((curShapeFile - 1) & 1) != 0;
 
 				if (isRightMonster) {
-					doorSD = 21;
+					doorSD = 23;
 					doorX = _outroRightDoorPos[monsterAnimFrame * 2 + 0];
 					doorY = _outroRightDoorPos[monsterAnimFrame * 2 + 1];
 
 					monsterX = _outroRightMonsterPos[monsterAnimFrame * 2 + 0];
 					monsterY = _outroRightMonsterPos[monsterAnimFrame * 2 + 1];
 
-					_screen->drawShape(page, doorShape, 0, 0, 20, 0x10);
+					_screen->drawShape(page, doorShape, 0, 0, 22, 0x10);
 				} else {
-					doorSD = 20;
+					doorSD = 22;
 					doorX = _outroLeftDoorPos[monsterAnimFrame * 2 + 0];
 					doorY = _outroLeftDoorPos[monsterAnimFrame * 2 + 1];
 
 					monsterX = _outroLeftMonsterPos[monsterAnimFrame * 2 + 0];
 					monsterY = _outroLeftMonsterPos[monsterAnimFrame * 2 + 1];
 
-					_screen->drawShape(page, doorShape, 0, 0, 21, 0x11);
+					_screen->drawShape(page, doorShape, 0, 0, 23, 0x11);
 				}
 
 				if (monsterAnimFrame >= 8)
-					_screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 20) ? 0 : 1);
+					_screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 22) ? 0 : 1);
 
 				_screen->drawShape(page, monsterShape, monsterX, monsterY, 0, 0x104 | ((!isRightMonster | (monsterAnimFrame < 20)) ? 0 : 1), _outroShapeTable, 1, _outroMonsterScaleTableX[monsterAnimFrame], _outroMonsterScaleTableY[monsterAnimFrame]);
 
 				if (monsterAnimFrame < 8)
-					_screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 20) ? 0 : 1);
+					_screen->drawShape(page, doorShape, doorX, doorY, doorSD, (doorSD == 22) ? 0 : 1);
 
 				_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 6, Screen::CR_NO_P_CHECK);
 				doorRedraw = true;

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-06-16 21:19:22 UTC (rev 41595)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-06-16 21:23:26 UTC (rev 41596)
@@ -2040,6 +2040,17 @@
 	for (int i = 0; i < 5; ++i)
 		_loadMenu.item[i].callback = loadMenuFunctor;
 
+	GUI_LOL_MENU(_gameOptions, 17, 0x400c, 0, 6, -1, -1, -1, -1);
+	GUI_LOL_MENU_ITEM(_gameOptions.item[0], 0xfff7, 120, 22, 80, 15, 0x406e, 0);
+	GUI_LOL_MENU_ITEM(_gameOptions.item[1], 0xfff6, 120, 39, 80, 15, 0x406c, 0);
+	GUI_LOL_MENU_ITEM(_gameOptions.item[2], 0xfff5, 120, 56, 80, 15, 0x406d, 0);
+	GUI_LOL_MENU_ITEM(_gameOptions.item[3], 0xfff4, 120, 73, 80, 15, 0x42d5, 0);
+	GUI_LOL_MENU_ITEM(_gameOptions.item[4], 0xfff3, 120, 90, 80, 15, 0x42d2, 0);	
+	GUI_LOL_MENU_ITEM(_gameOptions.item[5], 0x4072, 104, 110, 96, 15, 0, 110);	
+	Button::Callback optionsMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedOptionsMenu);
+	for (int i = 0; i < 6; ++i)
+		_gameOptions.item[i].callback = optionsMenuFunctor;
+
 	GUI_LOL_MENU(_deathMenu, 11, 0x4013, 0, 2, -1, -1, -1, -1);
 	GUI_LOL_MENU_ITEM(_deathMenu.item[0], 0x4006, 8, 30, 104, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_deathMenu.item[1], 0x4001, 176, 30, 104, 15, 0, 0);
@@ -3061,6 +3072,8 @@
 	{ 0x0D, 0xA2, 0x18, 0x0C, 0xFE, 0x01, 0x00, 0x00 },
 	{ 0x0F, 0x06, 0x14, 0x6E, 0x01, 0x00, 0x00, 0x00 },
 	{ 0x1A, 0xBE, 0x0A, 0x07, 0xFE, 0x01, 0x00, 0x00 },
+	{ 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 },
+	{ 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 },
 	{ 0x0B, 0x8C, 0x10, 0x33, 0x3D, 0x01, 0x00, 0x00 },	// Main menu box (5 entries, CD version only)
 	{ 0x0B, 0x8C, 0x10, 0x23, 0x3D, 0x01, 0x00, 0x00 },	// Main menu box (3 entries, floppy version only)
 
@@ -3088,6 +3101,8 @@
 	{ 0x0D, 0xA2, 0x18, 0x0C, 0x33, 0x44, 0x00, 0x00 },
 	{ 0x0F, 0x06, 0x14, 0x6E, 0x44, 0x00, 0x00, 0x00 },
 	{ 0x1A, 0xBE, 0x0A, 0x07, 0x33, 0x44, 0x00, 0x00 },
+	{ 0x07, 0x21, 0x1A, 0x85, 0x00, 0x00, 0x00, 0x00 },
+	{ 0x03, 0x32, 0x22, 0x62, 0x00, 0x00, 0x00, 0x00 },
 	{ 0x0B, 0x8C, 0x10, 0x33, 0x33, 0x44, 0x00, 0x00 },	// Main menu box (5 entries, not used here)
 	{ 0x0B, 0x8C, 0x10, 0x23, 0x33, 0x44, 0x00, 0x00 },	// Main menu box (3 entries)
 


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