CHEWY: Respect the ScummVM speech/subtitle setting

This commit is contained in:
Paul Gilbert
2022-03-03 18:35:10 -08:00
parent 2381c1ab76
commit cdc8bc4e58
6 changed files with 50 additions and 19 deletions
+9
View File
@@ -22,6 +22,7 @@
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "common/config-manager.h"
#include "chewy/chewy.h"
#include "chewy/ailclass.h"
#include "chewy/file.h"
@@ -192,6 +193,14 @@ void ailScummVM::waitForSpeechToFinish() {
}
}
bool ailScummVM::hasSubtitles() {
return ConfMan.getBool("subtitles");
}
bool ailScummVM::isSpeechMuted() {
return ConfMan.getBool("speech_mute");
}
ailclass::ailclass() {
#if 0
+10
View File
@@ -56,6 +56,16 @@ public:
* Helper method to wait until any playing speech is finished
*/
void waitForSpeechToFinish();
/**
* Returns true if subtitles are enabled
*/
bool hasSubtitles();
/**
* Returns true if speech is muted
*/
bool isSpeechMuted();
};
class ailclass : public ailScummVM {
+25 -15
View File
@@ -104,8 +104,19 @@ void atdsys::set_string_end_func
atdsv.aad_str = str_func;
}
void atdsys::set_display(int16 mode) {
atdsv.Display = mode;
void atdsys::setHasSpeech(bool hasSpeech) {
_hasSpeech = hasSpeech;
updateSoundSettings();
}
void atdsys::updateSoundSettings() {
atdsv.Display = DISPLAY_TXT;
if (_hasSpeech) {
// TODO: In the future, properly implement DISPLAY_ALL
if (!ailsnd->isSpeechMuted())
atdsv.Display = DISPLAY_VOC;
}
}
int16 atdsys::get_delay(int16 txt_len) {
@@ -735,26 +746,25 @@ void atdsys::del_steuer_bit(int16 txt_nr, int16 bit_idx, int16 mode) {
}
char *atdsys::ats_search_block(int16 txt_mode, char *txt_adr) {
char *str_;
int16 ende;
str_ = txt_adr;
ende = 0;
while (!ende) {
if (str_[0] == (char)BLOCKENDE &&
str_[1] == (char)BLOCKENDE &&
str_[2] == (char)BLOCKENDE) {
char *strP = txt_adr;
int ende = 0;
for (; !ende; ++strP) {
if (strP[0] == (char)BLOCKENDE &&
strP[1] == (char)BLOCKENDE &&
strP[2] == (char)BLOCKENDE) {
ende = 2;
} else if (str_[0] == (char)0xf2 && str_[1] == (char)0xfe) {
if (str_[2] == (char)txt_mode)
} else if (strP[0] == (char)0xf2 && strP[1] == (char)0xfe) {
if (strP[2] == (char)txt_mode)
ende = 1;
str_ += 3;
strP += 2;
}
}
if (ende == 2)
str_ = 0;
strP = nullptr;
return str_;
return strP;
}
void atdsys::ats_search_nr(int16 txt_nr, char **str_) {
+3 -1
View File
@@ -253,7 +253,8 @@ public:
void set_font(byte *font_adr, int16 fvorx, int16 fhoehe);
void set_delay(int16 *delay, int16 silent);
void set_display(int16 mode);
void setHasSpeech(bool hasSpeech);
void updateSoundSettings();
void set_split_win(int16 nr, SplitStringInit *ssinit);
SplitStringRet *split_string(SplitStringInit *ssi);
void calc_txt_win(SplitStringInit *ssi);
@@ -344,6 +345,7 @@ private:
char *inv_use_mem;
int16 tmp_delay;
in_zeiger *inzeig;
bool _hasSpeech = false;
};
} // namespace Chewy
+2 -2
View File
@@ -533,12 +533,12 @@ void option_menue(taf_info *ti) {
if (spieler.DisplayText) {
if (flags.InitSound) {
spieler.DisplayText = false;
atds->set_display(DISPLAY_VOC);
atds->setHasSpeech(true);
spieler.SpeechSwitch = true;
}
} else {
spieler.DisplayText = true;
atds->set_display(DISPLAY_TXT);
atds->setHasSpeech(false);
spieler.SpeechSwitch = false;
}
break;
+1 -1
View File
@@ -489,7 +489,7 @@ void sound_init() {
ailsnd->init_double_buffer(SpeechBuf[0], SpeechBuf[1], SPEECH_HALF_BUF, 0);
atds->set_speech_handle(speech_handle);
atds->set_display(DISPLAY_VOC);
atds->setHasSpeech(true);
spieler.DisplayText = false;
}