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

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Jun 21 18:59:52 CEST 2009


Revision: 41729
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41729&view=rev
Author:   athrxx
Date:     2009-06-21 16:59:51 +0000 (Sun, 21 Jun 2009)

Log Message:
-----------
LOL: - implemented audio menu
- menu settings now get saved
- remove white spaces

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/lol.h
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/script_lol.cpp
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/sequences_lol.cpp
    scummvm/trunk/engines/kyra/sound_lol.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/kyra/text_lol.cpp

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/gui.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -142,12 +142,12 @@
 				else
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8);
 			} else {
-				printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);				
+				printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0);
 				if (i == menu.highlightedItem)
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0);
 				else
 					printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0);
-			}			
+			}
 		}
 	}
 
@@ -196,6 +196,17 @@
 	int mouseX = p.x;
 	int mouseY = p.y;
 
+	if (_vm->_flags.gameID == GI_LOL && menu.highlightedItem != 255) {
+		// LoL doesnt't have default highlighted items.
+		// We use a highlightedItem value of 255 for this.
+
+		// With LoL no highlighting should take place unless the
+		// mouse cursor moves over a button. The highlighting should end
+		// when the mouse cursor leaves the button.
+		if (menu.item[menu.highlightedItem].enabled)
+			redrawText(menu);
+	}
+
 	for (int i = 0; i < menu.numberOfItems; ++i) {
 		if (!menu.item[i].enabled)
 			continue;
@@ -209,10 +220,8 @@
 		if (mouseX > x1 && mouseX < x2 &&
 			mouseY > y1 && mouseY < y2) {
 
-			if (menu.highlightedItem != i) {
-				// LoL doesnt't have default highlighted items. 
-				// We use a highlightedItem value of 255 for this.
-				if (menu.highlightedItem != 255) {
+			if (menu.highlightedItem != i || _vm->_flags.gameID == GI_LOL) {
+				if (_vm->_flags.gameID != GI_LOL) {
 					if (menu.item[menu.highlightedItem].enabled)
 						redrawText(menu);
 				}

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -32,6 +32,7 @@
 #include "kyra/util.h"
 
 #include "common/savefile.h"
+#include "common/config-manager.h"
 #include "graphics/scaler.h"
 
 #include "base/version.h"
@@ -1545,9 +1546,9 @@
 int LoLEngine::clickedOptions(Button *button) {
 	removeInputTop();
 	gui_toggleButtonDisplayMode(76, 1);
-		
+
 	_updateFlags |= 4;
-	
+
 	Button b;
 	b.data0Val2 = b.data1Val2 = b.data2Val2 = 0xfe;
 	b.data0Val3 = b.data1Val3 = b.data2Val3 = 0x01;
@@ -1558,7 +1559,7 @@
 	initTextFading(0, 1);
 	updatePortraits();
 	setLampMode(true);
-	setMouseCursorToIcon(0);		
+	setMouseCursorToIcon(0);
 	disableSysTimer(2);
 
 	gui_toggleButtonDisplayMode(76, 0);
@@ -1574,9 +1575,11 @@
 
 	gui_drawPlayField();
 
-//	if (!_speechFlag)
-//		enableText()	
+	if (!_speechVolume)
+		_configVoice |= 1;
 
+	writeSettings();
+
 	return 1;
 }
 
@@ -1869,6 +1872,7 @@
 	_specialProcessButton = _backUpButtonList = 0;
 	_flagsModifier = 0;
 	_mouseClick = 0;
+	_sliderSfx = 11;
 	_buttonListChanged = false;
 }
 
@@ -2233,15 +2237,15 @@
 	uint32 textCursorTimer = 0;
 	uint8 textCursorStatus = 1;
 	int wW = _screen->getCharWidth('W');
-	int fW = (d->w << 3) - wW;	
+	int fW = (d->w << 3) - wW;
 	int fC = 0;
 
 	// LoL doesnt't have default higlighted items. No item should be
 	// highlighted when entering a new menu.
 	// Instead, the respevtive struct entry is used to determine whether
-	// a menu has scroll buttons or not.
-	uint8 hasScrollButtons = 0;
-			
+	// a menu has scroll buttons or slider bars.
+	uint8 hasSpecialButtons = 0;
+
 	while (_displayMenu) {
 		_vm->_mouseX = _vm->_mouseY = 0;
 
@@ -2251,13 +2255,16 @@
 			setupSavegameNames(*_currentMenu, 4);
 		}
 
+		hasSpecialButtons = _currentMenu->highlightedItem;
+		_currentMenu->highlightedItem = 255;
+
 		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;
@@ -2279,10 +2286,7 @@
 			s += (strlen(s) + 1);
 		}
 
-		hasScrollButtons = _currentMenu->highlightedItem;
-		_currentMenu->highlightedItem = 255;
-
-		if (hasScrollButtons) {
+		if (hasSpecialButtons == 1) {
 			if (_savegameOffset == 0) {
 				_scrollUpButton.data0ShapePtr = _scrollUpButton.data1ShapePtr = _scrollUpButton.data2ShapePtr = 0;
 			} else {
@@ -2307,6 +2311,56 @@
 
 		initMenu(*_currentMenu);
 
+		if (hasSpecialButtons == 2) {
+			static const uint8 oX[] = { 0, 10, 124 };
+			static const uint8 oW[] = { 10, 114, 10 };
+
+			for (int i = 1; i < 4; ++i) {
+				int tX = _currentMenu->x + _currentMenu->item[i].x;
+				int tY = _currentMenu->y + _currentMenu->item[i].y;
+
+				for (int ii = 0; ii < 3; ++ii) {
+					Button *b = getButtonListData() + 1 + (i - 1) * 3 + ii;
+					b->nextButton = 0;
+					b->data0Val2 = b->data1Val2 = b->data2Val2 = 0xfe;
+					b->data0Val3 = b->data1Val3 = b->data2Val3 = 0x01;
+
+					b->index = ii;
+					b->keyCode = b->keyCode2 = 0;
+
+					b->x = tX + oX[ii];
+					b->y = tY;
+					b->width = oW[ii];
+					b->height = _currentMenu->item[i].height;
+
+					b->data0Val1 = b->data1Val1 = b->data2Val1 = 0;
+					b->flags = (ii == 1) ? 0x6606 : 0x4406;
+
+					b->dimTableIndex = 0;
+
+					b->buttonCallback = _currentMenu->item[i].callback;
+					b->arg = _currentMenu->item[i].itemId;
+
+					_menuButtonList = addButtonToList(_menuButtonList, b);
+
+					processButton(b);
+					updateButton(b);
+				}
+
+				_currentMenu->item[i].labelX = _currentMenu->item[i].x - 5;
+				_currentMenu->item[i].labelY = _currentMenu->item[i].y + 3;
+
+				printMenuText(getMenuItemLabel(_currentMenu->item[i]), _currentMenu->x + _currentMenu->item[i].labelX, _currentMenu->y + _currentMenu->item[i].labelY, _currentMenu->item[i].textColor, 0, 10);
+
+				int status = (i == 1) ? _vm->_musicVolume : ((i == 2) ? _vm->_sfxVolume : _vm->_speechVolume);
+				_screen->drawShape(_screen->_curPage, _vm->_gameShapes[85], tX , tY, 0, 0x10);
+				_screen->drawShape(_screen->_curPage, _vm->_gameShapes[87], tX + 2 + oX[1], tY, 0, 0x10);
+				_screen->drawShape(_screen->_curPage, _vm->_gameShapes[86], tX + 2 + oX[1] + status, tY, 0, 0x10);
+			}
+
+			_screen->updateScreen();
+		}
+
 		if (_currentMenu == &_mainMenu) {
 			Screen::FontId f = _screen->setFont(Screen::FID_6_FNT);
 			_screen->fprintString("%s", menu.x + 8, menu.y + menu.height - 12, 204, 0, 8, gScummVMVersion);
@@ -2331,7 +2385,7 @@
 				fC = _screen->getTextWidth(_saveDescription);
 			}
 
-			_screen->fprintString(_saveDescription, (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0);	
+			_screen->fprintString(_saveDescription, (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0);
 			_screen->fillRect((d->sx << 3) + fC, d->sy, (d->sx << 3) + fC + wW, d->sy + d->h - 1, d->unk8, 0);
 			_screen->setCurPage(pg);
 		}
@@ -2346,7 +2400,7 @@
 					textCursorTimer = _vm->_system->getMillis() + 20 * _vm->_tickLength;
 					_screen->fillRect((d->sx << 3) + fC, d->sy, (d->sx << 3) + fC + wW, d->sy + d->h - 1, textCursorStatus ? d->unk8 : d->unkA, 0);
 					_screen->updateScreen();
-				}				
+				}
 			}
 
 			if (getInput()) {
@@ -2363,7 +2417,7 @@
 		if (_newMenu != _currentMenu || !_displayMenu)
 			restorePage0();
 
-		_currentMenu->highlightedItem = hasScrollButtons;
+		_currentMenu->highlightedItem = hasSpecialButtons;
 
 		if (_newMenu)
 			_currentMenu = _newMenu;
@@ -2471,9 +2525,7 @@
 			inputFlag |= 0x8000;
 		} else if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE && strlen(_saveDescription)) {
 			_saveDescription[strlen(_saveDescription) - 1] = 0;
-			inputFlag |= 0x8000;			
-		} else {
-
+			inputFlag |= 0x8000;
 		}
 	}
 
@@ -2497,7 +2549,7 @@
 	case 0x4002:
 		_savegameOffset = 0;
 		_newMenu = &_saveMenu;
-		break;		
+		break;
 	case 0x4003:
 		_savegameOffset = 0;
 		_newMenu = &_deleteMenu;
@@ -2506,7 +2558,7 @@
 		_newMenu = &_gameOptions;
 		break;
 	case 0x42D9:
-		//_newMenu = &_audioOptions;
+		_newMenu = &_audioOptions;
 		break;
 	case 0x4006:
 		_choiceMenu.menuNameId = 0x400a;
@@ -2521,12 +2573,12 @@
 
 int GUI_LoL::clickedLoadMenu(Button *button) {
 	updateMenuButton(button);
-	
+
 	if (button->arg == 0x4011) {
 		if (_currentMenu != _lastMenu)
 			_newMenu = _lastMenu;
 		else
-			_menuResult = 0;		
+			_menuResult = 0;
 		return 1;
 	}
 
@@ -2539,7 +2591,7 @@
 
 int GUI_LoL::clickedSaveMenu(Button *button) {
 	updateMenuButton(button);
-	
+
 	if (button->arg == 0x4011) {
 		_newMenu = &_mainMenu;
 		return 1;
@@ -2552,13 +2604,13 @@
 	_saveDescription[0] = 0;
 	if (_saveMenu.item[-s - 2].saveSlot != -3)
 		strcpy(_saveDescription, _saveMenu.item[-s - 2].itemString);
-	
+
 	return 1;
 }
 
 int GUI_LoL::clickedDeleteMenu(Button *button) {
 	updateMenuButton(button);
-	
+
 	if (button->arg == 0x4011) {
 		_newMenu = &_mainMenu;
 		return 1;
@@ -2574,22 +2626,22 @@
 
 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;		
+		_vm->_smoothScrollingEnabled ^= true;
+		break;
 	case 0xfff5:
-		_vm->_floatingCursorsEnabled ^= true;		
+		_vm->_floatingCursorsEnabled ^= true;
 		break;
 	case 0xfff4:
 		_vm->_lang = ++_vm->_lang % 3;
 		break;
 	case 0xfff3:
-		_vm->_configVoice ^= 1;		
+		_vm->_configVoice ^= 1;
 		break;
 	case 0x4072:
 		char filename[13];
@@ -2608,6 +2660,65 @@
 	return 1;
 }
 
+int GUI_LoL::clickedAudioMenu(Button *button) {
+	updateMenuButton(button);
+
+	if (button->arg == 0x4072) {
+		_newMenu = _lastMenu;
+		return 1;
+	}
+
+	int tX = button->x;
+	int *status = (button->arg == 3) ? &_vm->_musicVolume : ((button->arg == 4) ? &_vm->_sfxVolume : &_vm->_speechVolume);
+	int statusOld = *status;
+
+	if (button->index == 0) {
+		*status -= 10;
+		tX += 10;
+	} else if (button->index == 1) {
+		*status = _vm->_mouseX - (tX + 7);
+	} else if (button->index == 2) {
+		*status += 10;
+		tX -= 114;
+	}
+
+	*status = CLIP(*status, 0, 100);
+
+	_screen->drawShape(0, _vm->_gameShapes[87], tX + 2 + statusOld, button->y, 0, 0x10);
+	_screen->drawShape(0, _vm->_gameShapes[86], tX + 2 + *status, button->y, 0, 0x10);
+	_screen->updateScreen();
+
+	_vm->snd_stopSpeech(0);
+
+	_vm->setVolume((KyraEngine_v1::kVolumeEntry)(button->arg - 3), *status);
+
+	if (*status) {
+		if (button->arg == 4) {
+			_vm->snd_playSoundEffect(_sliderSfx, -1);
+			int16 vocIndex = (int16)READ_LE_UINT16(&_vm->_ingameSoundIndex[_sliderSfx * 2]);
+			do {
+				++_sliderSfx;
+				if (_sliderSfx < 47)
+					_sliderSfx++;
+				if (vocIndex == 199)
+					_sliderSfx = 11;
+				vocIndex = (int16)READ_LE_UINT16(&_vm->_ingameSoundIndex[_sliderSfx * 2]);
+				if (vocIndex == -1)
+					continue;
+				if (!scumm_stricmp(_vm->_ingameSoundList[vocIndex], "EMPTY"))
+					continue;
+				break;
+			} while (1);
+
+		} else if (button->arg == 5) {
+			_vm->_lastSpeechId = -1;
+			_vm->snd_playCharacterSpeech(0x42e0, 0, 0);
+		}
+	}
+
+	return 1;
+}
+
 int GUI_LoL::clickedDeathMenu(Button *button) {
 	updateMenuButton(button);
 	if (button->arg == _deathMenu.item[0].itemId) {
@@ -2621,6 +2732,7 @@
 int GUI_LoL::clickedSavenameMenu(Button *button) {
 	updateMenuButton(button);
 	if (button->arg == _savenameMenu.item[0].itemId) {
+
 		Util::convertDOSToISO(_saveDescription);
 
 		int slot = _menuResult == -2 ? getNextSavegameSlot() : _menuResult;

Modified: scummvm/trunk/engines/kyra/gui_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.h	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/gui_lol.h	2009-06-21 16:59:51 UTC (rev 41729)
@@ -114,6 +114,7 @@
 	int clickedSaveMenu(Button *button);
 	int clickedDeleteMenu(Button *button);
 	int clickedOptionsMenu(Button *button);
+	int clickedAudioMenu(Button *button);
 	int clickedDeathMenu(Button *button);
 	int clickedSavenameMenu(Button *button);
 	int clickedChoiceMenu(Button *button);
@@ -125,7 +126,7 @@
 	Button *getScrollUpButton() { return &_scrollUpButton; }
 	Button *getScrollDownButton() { return &_scrollDownButton; }
 
-	
+
 	Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; }
 	Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; }
 
@@ -136,7 +137,7 @@
 	const char *getMenuItemTitle(const MenuItem &menuItem);
 	const char *getMenuItemLabel(const MenuItem &menuItem);
 
-	Button _menuButtons[7];
+	Button _menuButtons[10];
 	Button _scrollUpButton;
 	Button _scrollDownButton;
 	Menu _mainMenu, _gameOptions, _audioOptions, _choiceMenu, _loadMenu, _saveMenu, _deleteMenu, _savenameMenu, _deathMenu;
@@ -156,6 +157,7 @@
 	uint8 _mouseClick;
 
 	int _savegameOffset;
+	int _sliderSfx;
 
 	Button::Callback _scrollUpFunctor;
 	Button::Callback _scrollDownFunctor;

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -222,10 +222,6 @@
 	_preserveEvents = false;
 	_buttonList1 = _buttonList2 = _buttonList3 = _buttonList4 = _buttonList5 = _buttonList6 = _buttonList7 = _buttonList8 = 0;
 
-	_monsterDifficulty = 1;
-	_smoothScrollingEnabled = true;
-	_floatingCursorsEnabled = false;
-
 	memset(_lvlTempData, 0, sizeof(_lvlTempData));
 
 	_mapOverlay = 0;
@@ -457,8 +453,6 @@
 	if (!_sound->init())
 		error("Couldn't init sound");
 
-	_speechFlag = speechEnabled() ? 0x48 : 0;
-
 	_wllVmpMap = new uint8[80];
 	memset(_wllVmpMap, 0, 80);
 	_wllShapeMap = new int8[80];
@@ -823,12 +817,6 @@
 	_compassDirection = _compassDirectionIndex = -1;
 
 	_lastMouseRegion = -1;
-
-	/*
-	_unk5 = 1;
-	_unk6 = 1;
-	_unk7 = 1
-	_unk8 = 1*/
 	_currentLevel = 1;
 
 	giveCredits(41, 0);
@@ -891,6 +879,65 @@
 	}
 }
 
+void LoLEngine::registerDefaultSettings() {
+	KyraEngine_v1::registerDefaultSettings();
+
+	// Most settings already have sensible defaults. This one, however, is
+	// specific to the LoL engine.
+	ConfMan.registerDefault("floating cursors", false);
+	ConfMan.registerDefault("smooth scrolling", true);
+	ConfMan.registerDefault("monster difficulty", 1);
+}
+
+void LoLEngine::writeSettings() {
+	ConfMan.setInt("monster difficulty", _monsterDifficulty);
+	ConfMan.setBool("floating cursors", _floatingCursorsEnabled);
+	ConfMan.setBool("smooth scrolling", _smoothScrollingEnabled);
+
+	switch (_lang) {
+	case 1:
+		_flags.lang = Common::FR_FRA;
+		break;
+
+	case 2:
+		_flags.lang = Common::DE_DEU;
+		break;
+
+	case 3:
+		_flags.lang = Common::JA_JPN;
+		break;
+
+	case 0:
+	default:
+		_flags.lang = Common::EN_ANY;
+	}
+
+	if (_flags.lang == _flags.replacedLang && _flags.fanLang != Common::UNK_LANG)
+		_flags.lang = _flags.fanLang;
+
+	ConfMan.set("language", Common::getLanguageCode(_flags.lang));
+
+	KyraEngine_v1::writeSettings();
+
+	setVolume(kVolumeMusic, _musicVolume);
+	setVolume(kVolumeSfx, _sfxVolume);
+	setVolume(kVolumeSpeech, _speechVolume);
+}
+
+void LoLEngine::readSettings() {
+	_monsterDifficulty = ConfMan.getInt("monster difficulty");
+	_smoothScrollingEnabled = ConfMan.getBool("smooth scrolling");
+	_floatingCursorsEnabled = ConfMan.getBool("floating cursors");
+
+	KyraEngine_v1::readSettings();
+
+	_musicVolume = getVolume(kVolumeMusic);
+	_sfxVolume = getVolume(kVolumeSfx);
+	_speechVolume = getVolume(kVolumeSpeech);
+	if (_speechVolume == 2)
+		_speechVolume = 0;
+}
+
 void LoLEngine::update() {
 	updateSequenceBackgroundAnimations();
 
@@ -1102,7 +1149,7 @@
 		f -= 5;
 	f += 7;
 
-	if (_speechFlag) {
+	if (_speechVolume) {
 		if (snd_updateCharacterSpeech() == 2)
 			_updatePortraitSpeechAnimDuration = 2;
 		else
@@ -1240,7 +1287,7 @@
 
 	if (charNum > 3)
 		return;
-	
+
 	LoLCharacter *c = &_characters[charNum];
 	if (!(c->flags & 1))
 		return;
@@ -2476,8 +2523,8 @@
 
 int LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) {
 	static const uint8 mistDamage[] = { 30, 70, 110, 200 };
-	
-	_envSfxUseQueue = true;	
+
+	_envSfxUseQueue = true;
 	inflictMagicalDamageForBlock(calcNewBlockPosition(_currentBlock, _currentDirection), charNum, mistDamage[spellLevel], 0x80);
 	_envSfxUseQueue = false;
 
@@ -2723,7 +2770,7 @@
 	playSpellAnimation(mov, 0, 37, 2, 112, 0, 0, 0, 0, 0, false);
 
 	_screen->copyPage(2, 12);
-	
+
 	uint16 bl = calcNewBlockPosition(_currentBlock, _currentDirection);
 	int res = (_levelBlockProperties[bl].assignedObjects & 0x8000) ? 1 : 0;
 	inflictMagicalDamageForBlock(bl, charNum, 200, 0x80);
@@ -2735,7 +2782,7 @@
 	_screen->copyPage(2, 12);
 	snd_playSoundEffect(176, -1);
 	playSpellAnimation(mov, 38, 48, 8, 112, 0, 0, 0, 0, 0, false);
-	
+
 	mov->close();
 	delete mov;
 
@@ -2786,7 +2833,7 @@
 void LoLEngine::drinkBezelCup(int numUses, int charNum) {
 	int cp = _screen->setCurPage(2);
 	snd_playSoundEffect(73, -1);
-	
+
 	WSAMovie_v2 *mov = new WSAMovie_v2(this);
 	mov->open("bezel.wsa", 0, 0);
 	if (!mov->opened())
@@ -2816,7 +2863,7 @@
 		_screen->copyRegion(x, y, x, y, w, h, 2, 0, Screen::CR_NO_P_CHECK);
 		_screen->updateScreen();
 
-		delayUntil(etime);		
+		delayUntil(etime);
 	} while (++frm < bezelAnimData[numUses * 3 + 1]);
 
 	_characters[charNum].hitPointsCur = _characters[charNum].hitPointsMax;
@@ -2825,7 +2872,7 @@
 	gui_drawCharPortraitWithStats(charNum);
 	_screen->copyRegion(x, y, x, y, w, h, 2, 0, Screen::CR_NO_P_CHECK);
 	_screen->updateScreen();
-	
+
 	mov->close();
 	delete mov;
 
@@ -3321,7 +3368,7 @@
 			continue;
 		return;
 	}
-	
+
 	if (_weaponsDisabled)
 		clickedExitCharInventory(&b);
 
@@ -3347,7 +3394,7 @@
 		_updateFlags |= 4;
 		setLampMode(true);
 		disableSysTimer(2);
-	
+
 		_gui->runMenu(_gui->_deathMenu);
 
 		setMouseCursorToItemInHand();

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-21 16:59:51 UTC (rev 41729)
@@ -307,6 +307,7 @@
 
 	Screen *screen();
 	GUI *gui() const;
+
 private:
 	Screen_LoL *_screen;
 	GUI_LoL *_gui;
@@ -326,6 +327,10 @@
 	void startup();
 	void startupNew();
 
+	void registerDefaultSettings();
+	void writeSettings();
+	void readSettings();
+
 	// options
 	int _monsterDifficulty;
 	bool _smoothScrollingEnabled;
@@ -473,8 +478,11 @@
 	Common::List<Audio::AudioStream*> _speechList;
 
 	int _curTlkFile;
-	int _speechFlag;
 
+	int _musicVolume;
+	int _sfxVolume;
+	int _speechVolume;
+
 	char **_ingameSoundList;
 	int _ingameSoundListSize;
 
@@ -587,7 +595,7 @@
 	int clickedAutomap(Button *button);
 	int clickedLamp(Button *button);
 	int clickedStatusIcon(Button *button);
-	
+
 	const ButtonDef *_buttonData;
 	int _buttonDataSize;
 	const int16 *_buttonList1;
@@ -772,7 +780,7 @@
 	int olol_getNextActiveCharacter(EMCState *script);
 	int olol_paralyzePoisonCharacter(EMCState *script);
 	int olol_drawCharPortrait(EMCState *script);
-	int olol_removeInventoryItem(EMCState *script);	
+	int olol_removeInventoryItem(EMCState *script);
 	int olol_getAnimationLastPart(EMCState *script);
 	int olol_assignSpecialGuiShape(EMCState *script);
 	int olol_findInventoryItem(EMCState *script);

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -949,7 +949,7 @@
 
 	int16 t = 0;
 	int16 d = 256 / numTabs;
-		
+
 	for (int i = 1; i < numTabs - 1; i++) {
 		p2 = src1;
 		p3 = p1;

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -663,7 +663,7 @@
 	case 12:
 		return _drainMagic;
 	case 13:
-		return _speechFlag;
+		return _speechVolume;
 	default:
 		break;
 	}

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -1004,7 +1004,7 @@
 void TIMInterpreter_LoL::drawDialogueBox(int numStr, const char *s1, const char *s2, const char *s3) {
 	_screen->setScreenDim(5);
 
-	if (numStr == 1 && _vm->_speechFlag) {
+	if (numStr == 1 && _vm->_speechVolume) {
 		_dialogueNumButtons = 0;
 		_dialogueButtonString[0] = _dialogueButtonString[1] = _dialogueButtonString[2] = 0;
 	} else {

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -71,7 +71,7 @@
 
 		_eventList.clear();
 		int selection = mainMenu();
-		
+
 		if (selection != 3) {
 			_screen->hideMouse();
 			// Unlike the original, we add a nice fade to black
@@ -371,7 +371,7 @@
 	_sound->voicePlay("KING01", &_speechHandle);
 
 	int index = 4;
-	while ((!_speechFlag || (_speechFlag && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && !skipFlag()) {
+	while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && !skipFlag()) {
 		index = MAX(index, 4);
 
 		_chargenWSA->displayFrame(_chargenFrameTable[index], 0, 113, 0, 0, 0, 0);
@@ -387,7 +387,7 @@
 			_system->delayMillis(10);
 		}
 
-		if (_speechFlag)
+		if (_speechVolume)
 			index = (index + 1) % 22;
 		else if (++index >= 27)
 			break;
@@ -410,7 +410,7 @@
 	_sound->voicePlay("KING02", &_speechHandle);
 
 	int index = 0;
-	while ((!_speechFlag || (_speechFlag && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && index < 15) {
+	while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && index < 15) {
 		_chargenWSA->displayFrame(_chargenFrameTable[index+9], 0, 113, 0, 0, 0, 0);
 		_screen->copyRegion(_selectionPosTable[_reminderChar1IdxTable[index]*2+0], _selectionPosTable[_reminderChar1IdxTable[index]*2+1], _charPreviews[0].x, _charPreviews[0].y, 32, 32, 4, 0);
 		_screen->copyRegion(_selectionPosTable[_reminderChar2IdxTable[index]*2+0], _selectionPosTable[_reminderChar2IdxTable[index]*2+1], _charPreviews[1].x, _charPreviews[1].y, 32, 32, 4, 0);
@@ -424,7 +424,7 @@
 			_system->delayMillis(10);
 		}
 
-		if (_speechFlag)
+		if (_speechVolume)
 			index = (index + 1) % 22;
 		else if (++index >= 27)
 			break;
@@ -437,7 +437,7 @@
 	_sound->voicePlay("KING03", &_speechHandle);
 
 	int index = 0;
-	while ((!_speechFlag || (_speechFlag && _sound->voiceIsPlaying(&_speechHandle))) && !shouldQuit() && !skipFlag()) {
+	while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && !shouldQuit() && !skipFlag()) {
 		index = MAX(index, 4);
 
 		_chargenWSA->displayFrame(_chargenFrameTable[index], 0, 113, 0, 0, 0, 0);
@@ -449,7 +449,7 @@
 			_system->delayMillis(10);
 		}
 
-		if (_speechFlag)
+		if (_speechVolume)
 			index = (index + 1) % 22;
 		else if (++index >= 27)
 			break;
@@ -584,13 +584,13 @@
 	bool processAnim = true;
 
 	while (_charSelectionInfoResult == -1 && !shouldQuit()) {
-		if (_speechFlag && !_sound->isVoicePresent(file))
+		if (_speechVolume && !_sound->isVoicePresent(file))
 			break;
 
 		_sound->voicePlay(file, &_speechHandle);
 
 		int i = 0;
-		while ((!_speechFlag || (_speechFlag && _sound->voiceIsPlaying(&_speechHandle))) && _charSelectionInfoResult == -1 && !shouldQuit()) {
+		while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelectionInfoResult == -1 && !shouldQuit()) {
 			_screen->drawShape(0, _screen->getPtrToShape(_screen->getCPagePtr(9), _charInfoFrameTable[i]), 11, 130, 0, 0);
 			_screen->updateScreen();
 
@@ -600,7 +600,7 @@
 				_system->delayMillis(10);
 			}
 
-			if (_speechFlag || processAnim)
+			if (_speechVolume || processAnim)
 				i = (i + 1) % 32;
 			if (i == 0)
 				processAnim = false;

Modified: scummvm/trunk/engines/kyra/sound_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/sound_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -34,7 +34,7 @@
 namespace Kyra {
 
 bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {
-	if (!_speechFlag)
+	if (!_speechVolume)
 		return false;
 
 	if (speaker < 65) {

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -2017,7 +2017,7 @@
 
 	for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i)
 		GUI_V2_BUTTON(_menuButtons[i], i, 0, 0, 0, 0, 0, 0x4487, 0, 0, 0, 0, 0, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0);
-	
+
 	GUI_LOL_MENU(_mainMenu, 9, 0x4000, 0, 7, -1, -1, -1, -1);
 	GUI_LOL_MENU_ITEM(_mainMenu.item[0], 0x4001, 16, 23, 176, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_mainMenu.item[1], 0x4002, 16, 40, 176, 15, 0, 0);
@@ -2035,7 +2035,7 @@
 	GUI_LOL_MENU_ITEM(_loadMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_loadMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_loadMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0);
-	GUI_LOL_MENU_ITEM(_loadMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);	
+	GUI_LOL_MENU_ITEM(_loadMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);
 	Button::Callback loadMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedLoadMenu);
 	for (int i = 0; i < 5; ++i)
 		_loadMenu.item[i].callback = loadMenuFunctor;
@@ -2045,7 +2045,7 @@
 	GUI_LOL_MENU_ITEM(_saveMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_saveMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_saveMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0);
-	GUI_LOL_MENU_ITEM(_saveMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);	
+	GUI_LOL_MENU_ITEM(_saveMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);
 	Button::Callback saveMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedSaveMenu);
 	for (int i = 0; i < 5; ++i)
 		_saveMenu.item[i].callback = saveMenuFunctor;
@@ -2055,7 +2055,7 @@
 	GUI_LOL_MENU_ITEM(_deleteMenu.item[1], 0xfffd, 8, 56, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_deleteMenu.item[2], 0xfffc, 8, 73, 256, 15, 0, 0);
 	GUI_LOL_MENU_ITEM(_deleteMenu.item[3], 0xfffb, 8, 90, 256, 15, 0, 0);
-	GUI_LOL_MENU_ITEM(_deleteMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);	
+	GUI_LOL_MENU_ITEM(_deleteMenu.item[4], 0x4011, 168, 118, 96, 15, 0, 110);
 	Button::Callback deleteMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedDeleteMenu);
 	for (int i = 0; i < 5; ++i)
 		_deleteMenu.item[i].callback = deleteMenuFunctor;
@@ -2065,12 +2065,21 @@
 	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);	
+	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(_audioOptions, 18, 0x42d9, 2, 1, -1, -1, -1, -1);
+	GUI_LOL_MENU_ITEM(_audioOptions.item[0], 0x4072, 152, 76, 96, 15, 0, 110);
+	GUI_LOL_MENU_ITEM(_audioOptions.item[1], 3, 128, 22, 114, 14, 0x42db, 0);
+	GUI_LOL_MENU_ITEM(_audioOptions.item[2], 4, 128, 39, 114, 14, 0x42da, 0);
+	GUI_LOL_MENU_ITEM(_audioOptions.item[3], 5, 128, 56, 114, 14, 0x42dc, 0);
+	Button::Callback audioMenuFunctor = BUTTON_FUNCTOR(GUI_LoL, this, &GUI_LoL::clickedAudioMenu);
+	for (int i = 0; i < 4; ++i)
+		_audioOptions.item[i].callback = audioMenuFunctor;
+
 	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);

Modified: scummvm/trunk/engines/kyra/text_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.cpp	2009-06-21 14:43:06 UTC (rev 41728)
+++ scummvm/trunk/engines/kyra/text_lol.cpp	2009-06-21 16:59:51 UTC (rev 41729)
@@ -608,7 +608,7 @@
 	}
 
 	uint32 speechPartTime = 0;
-	if (_vm->_speechFlag && _vm->_activeVoiceFileTotalTime && _numCharsTotal)
+	if (_vm->_speechVolume && _vm->_activeVoiceFileTotalTime && _numCharsTotal)
 		speechPartTime = _vm->_system->getMillis() + ((_numCharsPrinted * _vm->_activeVoiceFileTotalTime) / _numCharsTotal);
 
 	const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex());
@@ -643,7 +643,7 @@
 		while (!inputFlag) {
 			_vm->update();
 
-			if (_vm->_speechFlag) {
+			if (_vm->_speechVolume) {
 				if (((_vm->_system->getMillis() > speechPartTime) || (_vm->snd_updateCharacterSpeech() != 2)) && speechPartTime) {
 					loop = false;
 					inputFlag = 43;


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