diff options
| author | Johannes Schickel | 2008-05-05 17:56:39 +0000 | 
|---|---|---|
| committer | Johannes Schickel | 2008-05-05 17:56:39 +0000 | 
| commit | c26e62e288f7454d47e201216c1cd98ee4cb3607 (patch) | |
| tree | 5f6b5a1bac4ea7511cae1e290fe4f79afa178003 /engines/kyra/gui_mr.cpp | |
| parent | f42d222069d7ae130c85201e895e7f23d27c88d0 (diff) | |
| download | scummvm-rg350-c26e62e288f7454d47e201216c1cd98ee4cb3607.tar.gz scummvm-rg350-c26e62e288f7454d47e201216c1cd98ee4cb3607.tar.bz2 scummvm-rg350-c26e62e288f7454d47e201216c1cd98ee4cb3607.zip  | |
- Implemented Kyra3 audio options menu, Helium mode still missing.
- Fixed unitialized variable
svn-id: r31881
Diffstat (limited to 'engines/kyra/gui_mr.cpp')
| -rw-r--r-- | engines/kyra/gui_mr.cpp | 142 | 
1 files changed, 142 insertions, 0 deletions
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index bf04e66a51..8d27938aff 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -1077,5 +1077,147 @@ int GUI_MR::toggleSkipSupport(Button *caller) {  	return 0;  } +int GUI_MR::audioOptions(Button *caller) { +	updateMenuButton(caller); + +	restorePage1(_vm->_screenBuffer); +	backUpPage1(_vm->_screenBuffer); + +	//if (_configHelium) +	//	_audioOptions.item[3].itemId = 18; +	//else +		_audioOptions.item[3].itemId = 17; + +	initMenu(_audioOptions); + +	const int menuX = _audioOptions.x; +	const int menuY = _audioOptions.y; + +	const int maxButton = 3;	// 2 if voc is disabled + +	for (int i = 0; i < maxButton; ++i) { +		int x = menuX + _sliderBarsPosition[i*2+0]; +		int y = menuY + _sliderBarsPosition[i*2+1]; +		_screen->drawShape(0, _vm->getShapePtr(0x1CF), x, y, 0, 0); +		drawSliderBar(i, _vm->getShapePtr(0x1D0)); +		_sliderButtons[0][i].buttonCallback = _sliderHandlerFunctor; +		_sliderButtons[0][i].x = x; +		_sliderButtons[0][i].y = y; +		_menuButtonList = addButtonToList(_menuButtonList, &_sliderButtons[0][i]); +		_sliderButtons[2][i].buttonCallback = _sliderHandlerFunctor; +		_sliderButtons[2][i].x = x + 10; +		_sliderButtons[2][i].y = y; +		_menuButtonList = addButtonToList(_menuButtonList, &_sliderButtons[2][i]); +		_sliderButtons[1][i].buttonCallback = _sliderHandlerFunctor; +		_sliderButtons[1][i].x = x + 120; +		_sliderButtons[1][i].y = y; +		_menuButtonList = addButtonToList(_menuButtonList, &_sliderButtons[1][i]); +	} + +	_isOptionsMenu = true; +	updateAllMenuButtons(); +	bool speechEnabled = _vm->speechEnabled(); +	while (_isOptionsMenu) { +		processHighlights(_audioOptions, _vm->_mouseX, _vm->_mouseY); +		getInput(); +	} + +	restorePage1(_vm->_screenBuffer); +	backUpPage1(_vm->_screenBuffer); +	if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine::kVolumeSpeech) == 2)) { +		_vm->_configVoice = 0; +		choiceDialog(0x1D, 0); +	} + +	_vm->writeSettings(); + +	initMenu(*_currentMenu); +	updateAllMenuButtons(); +	return 0; +} + +int GUI_MR::sliderHandler(Button *caller) { +	int button = 0; +	if (caller->index >= 24 && caller->index <= 27) +		button = caller->index - 24; +	else if (caller->index >= 28 && caller->index <= 31) +		button = caller->index - 28; +	else +		button = caller->index - 32; + +	assert(button >= 0 && button <= 3); + +	int oldVolume = _vm->getVolume(KyraEngine::kVolumeEntry(button)); +	int newVolume = oldVolume; + +	if (caller->index >= 24 && caller->index <= 27) +		newVolume -= 10; +	else if (caller->index >= 28 && caller->index <= 31) +		newVolume += 10; +	else +		newVolume = _vm->_mouseX - caller->x - 7; + +	newVolume = MAX(2, newVolume); +	newVolume = MIN(97, newVolume); + +	if (newVolume == oldVolume) +		return 0; + +	int lastMusicCommand = -1; +	bool playSoundEffect = false; + +	drawSliderBar(button, _vm->getShapePtr(0x1D1)); + +	if (button == 2) { +		if (_vm->textEnabled()) +			_vm->_configVoice = 2; +		else +			_vm->_configVoice = 1; +	} + +	_vm->setVolume(KyraEngine::kVolumeEntry(button), newVolume); + +	switch (button) { +	case 0: +		lastMusicCommand = _vm->_lastMusicCommand; +		break; + +	case 1: +		playSoundEffect = true; +		break; + +	case 2: +		if (_vm->_voiceSoundChannel != _vm->_musicSoundChannel) +			_vm->_soundDigital->stopSound(_vm->_voiceSoundChannel); +		_vm->playVoice(200, 943); +		break; + +	default: +		return 0; +	} + +	drawSliderBar(button, _vm->getShapePtr(0x1D0)); +	if (playSoundEffect) +		_vm->snd_playSoundEffect(0x18, 0xC8); +	else if (lastMusicCommand >= 0) +		_vm->snd_playWanderScoreViaMap(lastMusicCommand, 1); + +	_screen->updateScreen(); +	return 0; +} + +void GUI_MR::drawSliderBar(int slider, const uint8 *shape) { +	const int menuX = _audioOptions.x; +	const int menuY = _audioOptions.y; +	int x = menuX + _sliderBarsPosition[slider*2+0] + 10; +	int y = menuY + _sliderBarsPosition[slider*2+1]; + +	int position = _vm->getVolume(KyraEngine::kVolumeEntry(slider)); + +	position = MAX(2, position); +	position = MIN(97, position); +	_screen->drawShape(0, shape, x+position, y, 0, 0); +} +  } // end of namespace Kyra  | 
