[Scummvm-cvs-logs] SF.net SVN: scummvm:[41730] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Jun 21 21:00:50 CEST 2009
Revision: 41730
http://scummvm.svn.sourceforge.net/scummvm/?rev=41730&view=rev
Author: lordhoto
Date: 2009-06-21 19:00:50 +0000 (Sun, 21 Jun 2009)
Log Message:
-----------
Cleanup: Change LoL code to use KYRA volume handling.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/gui_lol.cpp
scummvm/trunk/engines/kyra/kyra_v1.cpp
scummvm/trunk/engines/kyra/kyra_v1.h
scummvm/trunk/engines/kyra/lol.cpp
scummvm/trunk/engines/kyra/lol.h
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/text_lol.cpp
Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -1564,6 +1564,7 @@
gui_toggleButtonDisplayMode(76, 0);
+ bool speechWasEnabled = speechEnabled();
_gui->runMenu(_gui->_mainMenu);
_updateFlags &= 0xfffb;
@@ -1575,8 +1576,8 @@
gui_drawPlayField();
- if (!_speechVolume)
- _configVoice |= 1;
+ if (speechWasEnabled && !textEnabled() && (!speechEnabled() || getVolume(kVolumeSpeech) == 2))
+ _configVoice = 0;
writeSettings();
@@ -2352,10 +2353,10 @@
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);
+ int volume = _vm->getVolume((KyraEngine_v1::kVolumeEntry)(i - 1));
_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->drawShape(_screen->_curPage, _vm->_gameShapes[86], tX + oX[1] + volume, tY, 0, 0x10);
}
_screen->updateScreen();
@@ -2669,30 +2670,33 @@
}
int tX = button->x;
- int *status = (button->arg == 3) ? &_vm->_musicVolume : ((button->arg == 4) ? &_vm->_sfxVolume : &_vm->_speechVolume);
- int statusOld = *status;
+ int oldVolume = _vm->getVolume((KyraEngine_v1::kVolumeEntry)(button->arg - 3));
+ int newVolume = oldVolume;
if (button->index == 0) {
- *status -= 10;
+ newVolume -= 10;
tX += 10;
} else if (button->index == 1) {
- *status = _vm->_mouseX - (tX + 7);
+ newVolume = _vm->_mouseX - (tX + 7);
} else if (button->index == 2) {
- *status += 10;
+ newVolume += 10;
tX -= 114;
}
- *status = CLIP(*status, 0, 100);
+ newVolume = CLIP(newVolume, 2, 102);
- _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);
+ if (newVolume == oldVolume)
+ return 0;
+
+ _screen->drawShape(0, _vm->_gameShapes[87], tX + oldVolume, button->y, 0, 0x10);
+ _screen->drawShape(0, _vm->_gameShapes[86], tX + newVolume, button->y, 0, 0x10);
_screen->updateScreen();
_vm->snd_stopSpeech(0);
- _vm->setVolume((KyraEngine_v1::kVolumeEntry)(button->arg - 3), *status);
+ _vm->setVolume((KyraEngine_v1::kVolumeEntry)(button->arg - 3), newVolume);
- if (*status) {
+ if (newVolume) {
if (button->arg == 4) {
_vm->snd_playSoundEffect(_sliderSfx, -1);
int16 vocIndex = (int16)READ_LE_UINT16(&_vm->_ingameSoundIndex[_sliderSfx * 2]);
@@ -2709,7 +2713,6 @@
continue;
break;
} while (1);
-
} else if (button->arg == 5) {
_vm->_lastSpeechId = -1;
_vm->snd_playCharacterSpeech(0x42e0, 0, 0);
Modified: scummvm/trunk/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/kyra_v1.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -594,12 +594,12 @@
return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
}
-inline int convertValueToMixer(int value) {
+int KyraEngine_v1::convertValueToMixer(int value) {
value -= 2;
return (value * Audio::Mixer::kMaxMixerVolume) / 95;
}
-inline int convertValueFromMixer(int value) {
+int KyraEngine_v1::convertValueFromMixer(int value) {
return (value * 95) / Audio::Mixer::kMaxMixerVolume + 2;
}
Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/kyra_v1.h 2009-06-21 19:00:50 UTC (rev 41730)
@@ -153,7 +153,7 @@
kVolumeSpeech = 2
};
- // volume reaches from 2 to 97
+ // volume reaches per default from 2 to 97
void setVolume(kVolumeEntry vol, uint8 value);
uint8 getVolume(kVolumeEntry vol);
@@ -289,6 +289,9 @@
const int8 *_trackMap;
int _trackMapSize;
+ virtual int convertValueToMixer(int value);
+ virtual int convertValueFromMixer(int value);
+
// pathfinder
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end);
Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -918,10 +918,6 @@
ConfMan.set("language", Common::getLanguageCode(_flags.lang));
KyraEngine_v1::writeSettings();
-
- setVolume(kVolumeMusic, _musicVolume);
- setVolume(kVolumeSfx, _sfxVolume);
- setVolume(kVolumeSpeech, _speechVolume);
}
void LoLEngine::readSettings() {
@@ -930,12 +926,6 @@
_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() {
@@ -1149,7 +1139,7 @@
f -= 5;
f += 7;
- if (_speechVolume) {
+ if (speechEnabled()) {
if (snd_updateCharacterSpeech() == 2)
_updatePortraitSpeechAnimDuration = 2;
else
Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/lol.h 2009-06-21 19:00:50 UTC (rev 41730)
@@ -446,6 +446,9 @@
int _timer3Para;
// sound
+ int convertValueToMixer(int value);
+ int convertValueFromMixer(int value);
+
void loadTalkFile(int index);
void snd_playVoiceFile(int track) {}
bool snd_playCharacterSpeech(int id, int8 speaker, int);
@@ -479,10 +482,6 @@
int _curTlkFile;
- int _musicVolume;
- int _sfxVolume;
- int _speechVolume;
-
char **_ingameSoundList;
int _ingameSoundListSize;
Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/script_lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -663,7 +663,7 @@
case 12:
return _drainMagic;
case 13:
- return _speechVolume;
+ return getVolume(kVolumeSpeech);
default:
break;
}
Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/script_tim.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -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->_speechVolume) {
+ if (numStr == 1 && _vm->speechEnabled()) {
_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 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -371,7 +371,7 @@
_sound->voicePlay("KING01", &_speechHandle);
int index = 4;
- while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && !skipFlag()) {
+ while ((!speechEnabled() || (speechEnabled() && _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 (_speechVolume)
+ if (speechEnabled())
index = (index + 1) % 22;
else if (++index >= 27)
break;
@@ -410,7 +410,7 @@
_sound->voicePlay("KING02", &_speechHandle);
int index = 0;
- while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelection == -1 && !shouldQuit() && index < 15) {
+ while ((!speechEnabled() || (speechEnabled() && _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 (_speechVolume)
+ if (speechEnabled())
index = (index + 1) % 22;
else if (++index >= 27)
break;
@@ -437,7 +437,7 @@
_sound->voicePlay("KING03", &_speechHandle);
int index = 0;
- while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && !shouldQuit() && !skipFlag()) {
+ while ((!speechEnabled() || (speechEnabled() && _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 (_speechVolume)
+ if (speechEnabled())
index = (index + 1) % 22;
else if (++index >= 27)
break;
@@ -584,13 +584,13 @@
bool processAnim = true;
while (_charSelectionInfoResult == -1 && !shouldQuit()) {
- if (_speechVolume && !_sound->isVoicePresent(file))
+ if (speechEnabled() && !_sound->isVoicePresent(file))
break;
_sound->voicePlay(file, &_speechHandle);
int i = 0;
- while ((!_speechVolume || (_speechVolume && _sound->voiceIsPlaying(&_speechHandle))) && _charSelectionInfoResult == -1 && !shouldQuit()) {
+ while ((!speechEnabled() || (speechEnabled() && _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 (_speechVolume || processAnim)
+ if (speechEnabled() || 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 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/sound_lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -34,7 +34,7 @@
namespace Kyra {
bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {
- if (!_speechVolume)
+ if (!speechEnabled())
return false;
if (speaker < 65) {
@@ -304,6 +304,15 @@
return snd_playTrack(-1);
}
+int LoLEngine::convertValueToMixer(int value) {
+ value -= 2;
+ return (value * Audio::Mixer::kMaxMixerVolume) / 100;
+}
+
+int LoLEngine::convertValueFromMixer(int value) {
+ return (value * 100) / Audio::Mixer::kMaxMixerVolume + 2;
+}
+
} // end of namespace Kyra
#endif // ENABLE_LOL
Modified: scummvm/trunk/engines/kyra/text_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.cpp 2009-06-21 16:59:51 UTC (rev 41729)
+++ scummvm/trunk/engines/kyra/text_lol.cpp 2009-06-21 19:00:50 UTC (rev 41730)
@@ -608,7 +608,7 @@
}
uint32 speechPartTime = 0;
- if (_vm->_speechVolume && _vm->_activeVoiceFileTotalTime && _numCharsTotal)
+ if (_vm->speechEnabled() && _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->_speechVolume) {
+ if (_vm->speechEnabled()) {
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