SAGA: Don't disable voice on missing SFX

This commit is contained in:
Vladimir Serbinenko 2022-12-14 14:48:12 +01:00
parent 41f967afdb
commit c068ce04c2

View File

@ -53,19 +53,18 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm), _sfxContext(nullptr), _voiceContext(nu
_sfxContext = _vm->_resource->getContext(GAME_SOUNDFILE);
if (_sfxContext == nullptr) {
warning("SndRes::SndRes resource context not found");
return;
}
setVoiceBank(0);
if (_vm->getGameId() == GID_ITE) {
if (_vm->getGameId() == GID_ITE && _sfxContext) {
_fxTable.resize(ITE_SFXCOUNT);
for (uint i = 0; i < _fxTable.size(); i++) {
_fxTable[i].res = ITE_SfxTable[i].res;
_fxTable[i].vol = ITE_SfxTable[i].vol;
}
#ifdef ENABLE_IHNM
} else if (_vm->getGameId() == GID_IHNM) {
} else if (_vm->getGameId() == GID_IHNM && _sfxContext) {
ResourceContext *resourceContext;
resourceContext = _vm->_resource->getContext(GAME_SOUNDFILE);
@ -106,8 +105,6 @@ SndRes::~SndRes() {
void SndRes::setVoiceBank(int serial) {
Common::File *file;
if (_sfxContext == nullptr)
return;
if (_voiceSerial == serial)
return;
@ -158,9 +155,6 @@ void SndRes::playSound(uint32 resourceId, int volume, bool loop) {
void SndRes::playVoice(uint32 resourceId) {
SoundBuffer buffer;
if (_sfxContext == nullptr)
return;
if (!(_vm->_voiceFilesExist))
return;
@ -204,7 +198,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
int rate = 0, size = 0;
Common::File *file;
if (_sfxContext == nullptr)
if (context == nullptr)
return false;
if (resourceId == (uint32)-1) {
@ -467,9 +461,6 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
int SndRes::getVoiceLength(uint32 resourceId) {
SoundBuffer buffer;
if (_sfxContext == nullptr)
return -1;
if (!(_vm->_voiceFilesExist))
return -1;