Implemented helium mode support for Kyra3.

svn-id: r32028
This commit is contained in:
Johannes Schickel 2008-05-11 17:50:13 +00:00
parent 825e3b5136
commit 4b21c2958d
7 changed files with 31 additions and 6 deletions

View File

@ -1539,15 +1539,26 @@ int GUI_MR::toggleSkipSupport(Button *caller) {
return 0;
}
int GUI_MR::toggleHeliumMode(Button *caller) {
updateMenuButton(caller);
_vm->_configHelium ^= 1;
if (_vm->_configHelium)
_audioOptions.item[3].itemId = 18;
else
_audioOptions.item[3].itemId = 17;
renewHighlight(_audioOptions);
return 0;
}
int GUI_MR::audioOptions(Button *caller) {
updateMenuButton(caller);
restorePage1(_vm->_screenBuffer);
backUpPage1(_vm->_screenBuffer);
//if (_configHelium)
// _audioOptions.item[3].itemId = 18;
//else
if (_vm->_configHelium)
_audioOptions.item[3].itemId = 18;
else
_audioOptions.item[3].itemId = 17;
initMenu(_audioOptions);

View File

@ -79,6 +79,7 @@ private:
int changeLanguage(Button *caller);
int toggleStudioSFX(Button *caller);
int toggleSkipSupport(Button *caller);
int toggleHeliumMode(Button *caller);
KyraEngine_MR *_vm;
Screen_MR *_screen;

View File

@ -146,6 +146,7 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi
_chatAltFlag = false;
_albumChatActive = false;
memset(&_album, 0, sizeof(_album));
_configHelium = false;
}
KyraEngine_MR::~KyraEngine_MR() {
@ -1515,6 +1516,7 @@ void KyraEngine_MR::registerDefaultSettings() {
ConfMan.registerDefault("walkspeed", 5);
ConfMan.registerDefault("studio_audience", true);
ConfMan.registerDefault("skip_support", true);
ConfMan.registerDefault("helium_mode", false);
}
void KyraEngine_MR::writeSettings() {
@ -1538,6 +1540,7 @@ void KyraEngine_MR::writeSettings() {
ConfMan.setBool("studio_audience", _configStudio);
ConfMan.setBool("skip_support", _configSkip);
ConfMan.setBool("helium_mode", _configHelium);
KyraEngine::writeSettings();
}
@ -1548,6 +1551,7 @@ void KyraEngine_MR::readSettings() {
_configStudio = ConfMan.getBool("studio_audience");
_configSkip = ConfMan.getBool("skip_support");
_configHelium = ConfMan.getBool("helium_mode");
}
} // end of namespace Kyra

View File

@ -55,6 +55,7 @@ public:
GUI_v2 *gui_v2() const { return _gui; }
SoundDigital *soundDigital() { return _soundDigital; }
int language() const { return _lang; }
bool heliumMode() const { return _configHelium; }
int go();
@ -66,6 +67,7 @@ private:
// config
bool _configStudio;
bool _configSkip;
bool _configHelium;
void registerDefaultSettings();
void writeSettings();

View File

@ -491,6 +491,7 @@ private:
// Digital Audio
class AUDStream;
class KyraEngine_MR;
/**
* Digital audio output device.
@ -499,7 +500,7 @@ class AUDStream;
*/
class SoundDigital {
public:
SoundDigital(KyraEngine *vm, Audio::Mixer *mixer);
SoundDigital(KyraEngine_MR *vm, Audio::Mixer *mixer);
~SoundDigital();
bool init() { return true; }
@ -548,7 +549,7 @@ public:
*/
void beginFadeOut(int channel, int ticks);
private:
KyraEngine *_vm;
KyraEngine_MR *_vm;
Audio::Mixer *_mixer;
struct Sound {

View File

@ -25,6 +25,7 @@
#include "kyra/sound.h"
#include "kyra/resource.h"
#include "kyra/kyra_mr.h"
#include "sound/audiostream.h"
@ -45,6 +46,7 @@ public:
bool isStereo() const { return false; }
bool endOfData() const { return _endOfData; }
void setRate(int newRate) { _rate = newRate; }
int getRate() const { return _rate; }
void beginFadeIn(uint32 millis);
@ -319,7 +321,7 @@ int AUDStream::readChunk(int16 *buffer, const int maxSamples) {
#pragma mark -
SoundDigital::SoundDigital(KyraEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _sounds() {
SoundDigital::SoundDigital(KyraEngine_MR *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _sounds() {
for (uint i = 0; i < ARRAYSIZE(_sounds); ++i)
_sounds[i].stream = 0;
}
@ -384,6 +386,9 @@ int SoundDigital::playSound(const char *filename, uint8 priority, Audio::Mixer::
if (volume > 255)
volume = 255;
volume = (volume * Audio::Mixer::kMaxChannelVolume) / 255;
if (type == Audio::Mixer::kSpeechSoundType && _vm->heliumMode())
use->stream->setRate(32765);
_mixer->playInputStream(type, &use->handle, use->stream, -1, volume);

View File

@ -2596,6 +2596,7 @@ void GUI_MR::initStaticData() {
GUI_V2_MENU_ITEM(_audioOptions.item[1], 0, 0, 160, 47, 116, 15, 0xFA, 0xFF, 5, 0xD0, 0xD1, 0xCF, -1, 24, 8, 49, 0x0000);
GUI_V2_MENU_ITEM(_audioOptions.item[2], 0, 0, 160, 64, 116, 15, 0xFA, 0xFF, 5, 0xD0, 0xD1, 0xCF, -1, 39, 8, 66, 0x0000);
GUI_V2_MENU_ITEM(_audioOptions.item[3], 1, 0, 152, 81, 116, 15, 0xFA, 0xFF, 5, 0xD0, 0xD1, 0xCF, -1, 47, 8, 83, 0x0000);
_audioOptions.item[3].callback = BUTTON_FUNCTOR(GUI_MR, this, &GUI_MR::toggleHeliumMode);
GUI_V2_MENU_ITEM(_audioOptions.item[4], 1, 16, -1, 110, 92, 15, 0xFA, 0xFF, -1, 0xD0, 0xD1, 0xCF, -1, 0, 0, 0, 0x0000);
_audioOptions.item[4].callback = clickQuitOptionsFunctor;
for (int i = 5; i < 7; ++i)