DRAGONS: Wired up config for subtitles and audio volume
This commit is contained in:
parent
7a31472c81
commit
05835e2204
7 changed files with 47 additions and 11 deletions
|
@ -1156,7 +1156,7 @@ void DragonsEngine::loadScene(uint16 sceneId) {
|
||||||
_flags |= 0x26;
|
_flags |= 0x26;
|
||||||
_unkFlags1 = 0;
|
_unkFlags1 = 0;
|
||||||
|
|
||||||
clearFlags(ENGINE_FLAG_1000_TEXT_ENABLED); //TODO wire this up to subtitle config.
|
initSubtitleFlag();
|
||||||
|
|
||||||
_scriptOpcodes->_scriptTargetINI = 0; //TODO this should be reset in scriptopcode.
|
_scriptOpcodes->_scriptTargetINI = 0; //TODO this should be reset in scriptopcode.
|
||||||
_cursor->init(_actorManager, _dragonINIResource);
|
_cursor->init(_actorManager, _dragonINIResource);
|
||||||
|
@ -1472,6 +1472,15 @@ void DragonsEngine::updateCamera() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DragonsEngine::initSubtitleFlag() {
|
||||||
|
bool showSubtitles = ConfMan.getBool("subtitles");
|
||||||
|
if (showSubtitles) {
|
||||||
|
clearFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
|
||||||
|
} else {
|
||||||
|
setFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void (*DragonsEngine::getSceneUpdateFunction())() {
|
void (*DragonsEngine::getSceneUpdateFunction())() {
|
||||||
return _sceneUpdateFunction;
|
return _sceneUpdateFunction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ enum Flags {
|
||||||
ENGINE_FLAG_200 = 0x200,
|
ENGINE_FLAG_200 = 0x200,
|
||||||
ENGINE_FLAG_400 = 0x400,
|
ENGINE_FLAG_400 = 0x400,
|
||||||
ENGINE_FLAG_800 = 0x800,
|
ENGINE_FLAG_800 = 0x800,
|
||||||
ENGINE_FLAG_1000_TEXT_ENABLED = 0x1000,
|
ENGINE_FLAG_1000_SUBTITLES_DISABLED = 0x1000,
|
||||||
ENGINE_FLAG_8000 = 0x8000, // speech dialog is playing.
|
ENGINE_FLAG_8000 = 0x8000, // speech dialog is playing.
|
||||||
|
|
||||||
ENGINE_FLAG_10000 = 0x10000,
|
ENGINE_FLAG_10000 = 0x10000,
|
||||||
|
@ -313,6 +313,8 @@ private:
|
||||||
void initializeSound();
|
void initializeSound();
|
||||||
|
|
||||||
void SomeInitSound_fun_8003f64c();
|
void SomeInitSound_fun_8003f64c();
|
||||||
|
|
||||||
|
void initSubtitleFlag();
|
||||||
};
|
};
|
||||||
|
|
||||||
DragonsEngine *getEngine();
|
DragonsEngine *getEngine();
|
||||||
|
|
|
@ -192,7 +192,7 @@ void Minigame3::run() {
|
||||||
_vm->clearFlags(ENGINE_FLAG_8);
|
_vm->clearFlags(ENGINE_FLAG_8);
|
||||||
_vm->clearFlags(ENGINE_FLAG_1);
|
_vm->clearFlags(ENGINE_FLAG_1);
|
||||||
_vm->setFlags(ENGINE_FLAG_100);
|
_vm->setFlags(ENGINE_FLAG_100);
|
||||||
_vm->setFlags(ENGINE_FLAG_1000_TEXT_ENABLED);
|
_vm->setFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
|
||||||
// TODO
|
// TODO
|
||||||
// memcpy2(auStack1584_palette, scrFileData_maybe, 0x200);
|
// memcpy2(auStack1584_palette, scrFileData_maybe, 0x200);
|
||||||
// memcpy2(auStack1072_palette, scrFileData_maybe, 0x200);
|
// memcpy2(auStack1072_palette, scrFileData_maybe, 0x200);
|
||||||
|
|
|
@ -938,7 +938,7 @@ void ScriptOpcodes::opCodeActorTalk(ScriptOpCall &scriptOpCall) {
|
||||||
|
|
||||||
int sVar2 = -1; //TODO findTextToDtSpeechIndex(textIndex);
|
int sVar2 = -1; //TODO findTextToDtSpeechIndex(textIndex);
|
||||||
|
|
||||||
if (!_vm->isUnkFlagSet(1) && (!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || sVar2 == -1)) {
|
if (!_vm->isUnkFlagSet(1) && (!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || sVar2 == -1)) {
|
||||||
_vm->_talk->loadText(textIndex, dialog, 2048);
|
_vm->_talk->loadText(textIndex, dialog, 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "audio/audiostream.h"
|
#include "audio/audiostream.h"
|
||||||
#include "audio/decoders/raw.h"
|
#include "audio/decoders/raw.h"
|
||||||
#include "audio/decoders/xa.h"
|
#include "audio/decoders/xa.h"
|
||||||
|
#include "common/config-manager.h"
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/memstream.h"
|
#include "common/memstream.h"
|
||||||
#include "dragons/dragons.h"
|
#include "dragons/dragons.h"
|
||||||
|
@ -98,7 +99,7 @@ void SoundManager::playSpeech(uint32 textIndex) {
|
||||||
fd->close();
|
fd->close();
|
||||||
delete fd;
|
delete fd;
|
||||||
_vm->setFlags(ENGINE_FLAG_8000);
|
_vm->setFlags(ENGINE_FLAG_8000);
|
||||||
_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, _audioTrack->getAudioStream());
|
_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, _audioTrack->getAudioStream(), -1, _speechVolume);
|
||||||
delete _audioTrack;
|
delete _audioTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +260,27 @@ SoundManager::SoundManager(DragonsEngine *vm, BigfileArchive *bigFileArchive, Dr
|
||||||
_bigFileArchive(bigFileArchive),
|
_bigFileArchive(bigFileArchive),
|
||||||
_dragonRMS(dragonRMS) {
|
_dragonRMS(dragonRMS) {
|
||||||
_dat_8006bb60_sound_related = 0;
|
_dat_8006bb60_sound_related = 0;
|
||||||
// TODO: Set volumes
|
|
||||||
|
bool allSoundIsMuted = false;
|
||||||
|
if (ConfMan.hasKey("mute")) {
|
||||||
|
allSoundIsMuted = ConfMan.getBool("mute");
|
||||||
|
}
|
||||||
|
_speechVolume = ConfMan.getInt("speech_volume");
|
||||||
|
_sfxVolume = ConfMan.getInt("sfx_volume");
|
||||||
|
_musicVolume = ConfMan.getInt("music_volume");
|
||||||
|
|
||||||
|
if (ConfMan.hasKey("speech_mute") && !allSoundIsMuted) {
|
||||||
|
_vm->_mixer->muteSoundType(_vm->_mixer->kSpeechSoundType, ConfMan.getBool("speech_mute"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfMan.hasKey("sfx_mute") && !allSoundIsMuted) {
|
||||||
|
_vm->_mixer->muteSoundType(_vm->_mixer->kSFXSoundType, ConfMan.getBool("sfx_mute"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfMan.hasKey("music_mute") && !allSoundIsMuted) {
|
||||||
|
_vm->_mixer->muteSoundType(_vm->_mixer->kMusicSoundType, ConfMan.getBool("music_mute"));
|
||||||
|
}
|
||||||
|
|
||||||
SomeInitSound_FUN_8003f64c();
|
SomeInitSound_FUN_8003f64c();
|
||||||
loadMusAndGlob();
|
loadMusAndGlob();
|
||||||
}
|
}
|
||||||
|
@ -400,7 +421,7 @@ void SoundManager::playSound(uint16 soundId, uint16 volumeId) {
|
||||||
|
|
||||||
Audio::SoundHandle *handle = getVoiceHandle(soundId);
|
Audio::SoundHandle *handle = getVoiceHandle(soundId);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, vabSound->getAudioStream(program, key));
|
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, vabSound->getAudioStream(program, key), -1, _sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,10 @@ private:
|
||||||
BigfileArchive *_bigFileArchive;
|
BigfileArchive *_bigFileArchive;
|
||||||
DragonRMS *_dragonRMS;
|
DragonRMS *_dragonRMS;
|
||||||
|
|
||||||
|
uint8 _speechVolume;
|
||||||
|
uint8 _sfxVolume;
|
||||||
|
uint8 _musicVolume;
|
||||||
|
|
||||||
// SOUND_ARR_DAT_80071f6c
|
// SOUND_ARR_DAT_80071f6c
|
||||||
uint8 _soundArr[0x780];
|
uint8 _soundArr[0x780];
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
|
||||||
_dat_8008e848_dialogBox_x2 = (uVar11 + _dat_8008e7e8_dialogBox_x1) - 1;
|
_dat_8008e848_dialogBox_x2 = (uVar11 + _dat_8008e7e8_dialogBox_x1) - 1;
|
||||||
_dat_8008e844_dialogBox_y1 = (uVar19 - sVar4 * _dat_800726f0_tfont_field2) + 1;
|
_dat_8008e844_dialogBox_y1 = (uVar19 - sVar4 * _dat_800726f0_tfont_field2) + 1;
|
||||||
_dat_8008e874_dialogBox_y2 = _dat_8008e844_dialogBox_y1 + sVar4 * _dat_800726f0_tfont_field2 + 1;
|
_dat_8008e874_dialogBox_y2 = _dat_8008e844_dialogBox_y1 + sVar4 * _dat_800726f0_tfont_field2 + 1;
|
||||||
if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) && ((!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || (param_7 != 0)))) {
|
if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) && ((!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || (param_7 != 0)))) {
|
||||||
unaff_s4 = 0;
|
unaff_s4 = 0;
|
||||||
drawDialogBox((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
|
drawDialogBox((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
|
||||||
(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2, 0);
|
(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2, 0);
|
||||||
|
@ -382,7 +382,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
|
||||||
return (uint)returnStatus;
|
return (uint)returnStatus;
|
||||||
}
|
}
|
||||||
uVar9 = ((int)((int)(short)unaff_s4 * (uint)1 * (int)sVar3) >> 3) * 0x3c;
|
uVar9 = ((int)((int)(short)unaff_s4 * (uint)1 * (int)sVar3) >> 3) * 0x3c;
|
||||||
if ((param_7 == 0) && _vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED)) {
|
if ((param_7 == 0) && _vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED)) {
|
||||||
uVar9 = 0;
|
uVar9 = 0;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -392,7 +392,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
|
||||||
if (_vm->_sound->_dat_8006bb60_sound_related != 0) {
|
if (_vm->_sound->_dat_8006bb60_sound_related != 0) {
|
||||||
_vm->_sound->_dat_8006bb60_sound_related = 0;
|
_vm->_sound->_dat_8006bb60_sound_related = 0;
|
||||||
curDialogTextPtr = dialogText;
|
curDialogTextPtr = dialogText;
|
||||||
if (!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED)) {
|
if (!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED)) {
|
||||||
returnStatus = 1;
|
returnStatus = 1;
|
||||||
goto LAB_80032e18;
|
goto LAB_80032e18;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
|
||||||
(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2);
|
(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2);
|
||||||
}
|
}
|
||||||
} while (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) &&
|
} while (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) &&
|
||||||
(((!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || (param_7 != 0)) && (*curDialogTextPtr != 0))));
|
(((!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || (param_7 != 0)) && (*curDialogTextPtr != 0))));
|
||||||
}
|
}
|
||||||
if (param_5 != 0) {
|
if (param_5 != 0) {
|
||||||
if (_vm->isFlagSet(ENGINE_FLAG_8000)) {
|
if (_vm->isFlagSet(ENGINE_FLAG_8000)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue