mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
CHEWY: Use the ScummVM config for toggling subs, speech, music and SFX
This commit is contained in:
parent
840c1d70b8
commit
9f5721124a
@ -177,24 +177,16 @@ void MainMenu::startGame() {
|
||||
animate();
|
||||
exit_room(-1);
|
||||
|
||||
bool soundSwitch = _G(gameState).SoundSwitch;
|
||||
uint8 soundVol = _G(gameState).SoundVol;
|
||||
bool musicSwitch = _G(gameState).MusicSwitch;
|
||||
uint8 musicVol = _G(gameState).MusicVol;
|
||||
bool speechSwitch = _G(gameState).SpeechSwitch;
|
||||
uint8 framesPerSecond = _G(gameState).FramesPerSecond;
|
||||
bool displayText = _G(gameState).DisplayText;
|
||||
int sndLoopMode = _G(gameState).soundLoopMode;
|
||||
|
||||
var_init();
|
||||
|
||||
_G(gameState).SoundSwitch = soundSwitch;
|
||||
_G(gameState).SoundVol = soundVol;
|
||||
_G(gameState).MusicSwitch = musicSwitch;
|
||||
_G(gameState).MusicVol = musicVol;
|
||||
_G(gameState).SpeechSwitch = speechSwitch;
|
||||
_G(gameState).FramesPerSecond = framesPerSecond;
|
||||
_G(gameState).DisplayText = displayText;
|
||||
_G(gameState).soundLoopMode = sndLoopMode;
|
||||
|
||||
_G(gameState)._personRoomNr[P_CHEWY] = 0;
|
||||
|
@ -95,7 +95,7 @@ void Options::execute(TafInfo *ti) {
|
||||
Common::String fps = Common::String::format("%d", _G(gameState).FramesPerSecond << 1);
|
||||
_G(out)->printxy(36 + bar_off, 65, 255, 300, 0, fps.c_str());
|
||||
|
||||
if (_G(gameState).SoundSwitch) {
|
||||
if (g_engine->_sound->soundEnabled()) {
|
||||
_G(out)->spriteSet(ti->_image[mund_ani],
|
||||
18 + ti->_correction[mund_ani << 1],
|
||||
8 + ti->_correction[(mund_ani << 1) + 1], 0);
|
||||
@ -117,7 +117,7 @@ void Options::execute(TafInfo *ti) {
|
||||
_G(out)->pop_box(52 - 2, 104 - 12, 62 + 4, 136 + 2, 192, 183, 182);
|
||||
_G(out)->printxy(52 + 3, 104 - 10, 31, 300, 0, "M");
|
||||
_G(out)->boxFill(53, 136 - (_G(gameState).MusicVol >> 1), 62, 136, 31);
|
||||
if (_G(gameState).MusicSwitch) {
|
||||
if (g_engine->_sound->musicEnabled()) {
|
||||
_G(out)->spriteSet(ti->_image[MUSIC_ON1],
|
||||
18 + ti->_correction[MUSIC_ON1 << 1],
|
||||
8 + ti->_correction[(MUSIC_ON1 << 1) + 1], 0);
|
||||
@ -129,7 +129,7 @@ void Options::execute(TafInfo *ti) {
|
||||
18 + ti->_correction[MUSIC_OFF << 1],
|
||||
8 + ti->_correction[(MUSIC_OFF << 1) + 1], 0);
|
||||
|
||||
if (_G(gameState).DisplayText) {
|
||||
if (g_engine->_sound->subtitlesEnabled()) {
|
||||
_G(out)->spriteSet(ti->_image[tdisp_ani],
|
||||
18 + ti->_correction[tdisp_ani << 1],
|
||||
8 + ti->_correction[(tdisp_ani << 1) + 1], 0);
|
||||
@ -160,32 +160,32 @@ void Options::execute(TafInfo *ti) {
|
||||
++_G(gameState).FramesPerSecond;
|
||||
break;
|
||||
case 2:
|
||||
if (_G(gameState).SoundSwitch) {
|
||||
_G(gameState).SoundSwitch = false;
|
||||
if (g_engine->_sound->soundEnabled()) {
|
||||
g_engine->_sound->toggleSound(false);
|
||||
_G(det)->disable_room_sound();
|
||||
} else {
|
||||
_G(gameState).SoundSwitch = true;
|
||||
g_engine->_sound->toggleSound(true);
|
||||
_G(det)->enable_room_sound();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
if (_G(gameState).DisplayText) {
|
||||
_G(gameState).DisplayText = false;
|
||||
if (g_engine->_sound->subtitlesEnabled()) {
|
||||
g_engine->_sound->toggleSubtitles(false);
|
||||
_G(atds)->setHasSpeech(true);
|
||||
_G(gameState).SpeechSwitch = true;
|
||||
g_engine->_sound->toggleSpeech(true);
|
||||
} else {
|
||||
_G(gameState).DisplayText = true;
|
||||
g_engine->_sound->toggleSubtitles(true);
|
||||
_G(atds)->setHasSpeech(false);
|
||||
_G(gameState).SpeechSwitch = false;
|
||||
g_engine->_sound->toggleSpeech(false);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (_G(gameState).MusicSwitch) {
|
||||
_G(gameState).MusicSwitch = false;
|
||||
if (g_engine->_sound->musicEnabled()) {
|
||||
g_engine->_sound->toggleMusic(false);
|
||||
_G(sndPlayer)->stopMod();
|
||||
} else {
|
||||
_G(gameState).MusicSwitch = true;
|
||||
g_engine->_sound->toggleMusic(true);
|
||||
_G(currentSong) = -1;
|
||||
load_room_music(_G(gameState)._personRoomNr[P_CHEWY]);
|
||||
}
|
||||
|
@ -142,7 +142,6 @@ void var_init() {
|
||||
init_room();
|
||||
init_atds();
|
||||
_G(gameState).FramesPerSecond = 7;
|
||||
_G(gameState).DisplayText = true;
|
||||
_G(currentSong) = -1;
|
||||
_G(SetUpScreenFunc) = nullptr;
|
||||
_G(pfeil_delay) = 0;
|
||||
@ -288,9 +287,6 @@ void tidy() {
|
||||
}
|
||||
|
||||
void sound_init() {
|
||||
_G(gameState).SoundSwitch = false;
|
||||
_G(gameState).MusicSwitch = false;
|
||||
|
||||
_G(sndPlayer)->initMixMode();
|
||||
_G(gameState).MusicVol = 63;
|
||||
_G(gameState).SoundVol = 63;
|
||||
@ -312,10 +308,6 @@ void sound_init() {
|
||||
}
|
||||
|
||||
_G(atds)->setHasSpeech(true);
|
||||
_G(gameState).DisplayText = false;
|
||||
_G(gameState).SoundSwitch = true;
|
||||
_G(gameState).MusicSwitch = true;
|
||||
_G(gameState).SpeechSwitch = true;
|
||||
}
|
||||
|
||||
void show_intro() {
|
||||
|
@ -37,7 +37,7 @@ void load_room_music(int16 room_nr) {
|
||||
int16 volume = _G(gameState).MusicVol;
|
||||
const int16 lp_mode = 1;
|
||||
const int16 play_mode = NORMAL_PLAY;
|
||||
if (_G(gameState).MusicSwitch && (_G(music_handle))) {
|
||||
if (g_engine->_sound->musicEnabled() && (_G(music_handle))) {
|
||||
switch (room_nr) {
|
||||
case 0:
|
||||
ttp_index = 0;
|
||||
|
@ -352,7 +352,7 @@ void enter_room(int16 eib_nr) {
|
||||
|
||||
case 17:
|
||||
Room17::entry();
|
||||
if (_G(gameState).SoundSwitch) {
|
||||
if (g_engine->_sound->soundEnabled()) {
|
||||
if (!_G(gameState).R17EnergieOut)
|
||||
g_engine->_sound->playSound(15);
|
||||
}
|
||||
@ -366,7 +366,7 @@ void enter_room(int16 eib_nr) {
|
||||
|
||||
case 24:
|
||||
Room24::entry();
|
||||
if (_G(gameState).SoundSwitch)
|
||||
if (g_engine->_sound->soundEnabled())
|
||||
g_engine->_sound->playSound(17);
|
||||
break;
|
||||
|
||||
@ -822,7 +822,7 @@ static void playIntroSequence() {
|
||||
start_aad(595);
|
||||
_G(atds)->print_aad(254, 0);
|
||||
|
||||
if (_G(gameState).SpeechSwitch) {
|
||||
if (g_engine->_sound->speechEnabled()) {
|
||||
g_engine->_sound->waitForSpeechToFinish();
|
||||
} else {
|
||||
delay(6000);
|
||||
@ -927,7 +927,7 @@ void flic_cut(int16 nr) {
|
||||
if (nr != FCUT_135) {
|
||||
load_room_music(_G(gameState)._personRoomNr[0]);
|
||||
|
||||
if (_G(gameState).SpeechSwitch)
|
||||
if (g_engine->_sound->speechEnabled())
|
||||
_G(det)->enable_room_sound();
|
||||
|
||||
_G(uhr)->resetTimer(0, 0);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "chewy/resource.h"
|
||||
#include "chewy/room.h"
|
||||
#include "chewy/ngshext.h"
|
||||
#include "chewy/sound.h"
|
||||
|
||||
namespace Chewy {
|
||||
|
||||
@ -183,7 +184,7 @@ void Room::loadRoom(RaumBlk *Rb, int16 room_nr, GameState *player) {
|
||||
clear_prog_ani();
|
||||
_G(det)->load_rdi(Rb->DetFile, room_nr);
|
||||
|
||||
if (player->SoundSwitch == false)
|
||||
if (!g_engine->_sound->soundEnabled())
|
||||
_G(det)->disable_room_sound();
|
||||
RoomDetailInfo *Rdi_ = _G(det)->getRoomDetailInfo();
|
||||
_roomInfo = &Rdi_->Ri;
|
||||
|
@ -160,7 +160,7 @@ void Room46::kloppe() {
|
||||
int16 delay = _G(gameState).DelaySpeed * 50;
|
||||
_G(atds)->print_aad(0, 0);
|
||||
|
||||
if (_G(gameState).SpeechSwitch) {
|
||||
if (g_engine->_sound->speechEnabled()) {
|
||||
g_engine->_sound->waitForSpeechToFinish();
|
||||
continue;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void Room68::setup_func() {
|
||||
case 1:
|
||||
if (_G(det)->get_ani_status(_G(r68HohesC)) == false) {
|
||||
_G(r68HohesC) = 2;
|
||||
if (_G(gameState).SpeechSwitch) {
|
||||
if (g_engine->_sound->speechEnabled()) {
|
||||
g_engine->_sound->playSound(2, 0);
|
||||
g_engine->_sound->playSound(_G(r68HohesC));
|
||||
_G(det)->startDetail(_G(r68HohesC), 255, ANI_FRONT);
|
||||
@ -347,7 +347,7 @@ void Room68::kostuem_aad(int16 aad_nr) {
|
||||
else if (!_G(gameState).R67LiedOk)
|
||||
startAadWait(389);
|
||||
else {
|
||||
if (_G(gameState).DisplayText == 0)
|
||||
if (!g_engine->_sound->subtitlesEnabled())
|
||||
_G(sndPlayer)->fadeOut(5);
|
||||
|
||||
_G(SetUpScreenFunc) = nullptr;
|
||||
@ -361,7 +361,7 @@ void Room68::kostuem_aad(int16 aad_nr) {
|
||||
_G(gameState)._personHide[P_HOWARD] = true;
|
||||
_G(det)->startDetail(27, 255, ANI_FRONT);
|
||||
|
||||
if (_G(gameState).DisplayText)
|
||||
if (g_engine->_sound->subtitlesEnabled())
|
||||
startSetAILWait(23, 3, ANI_FRONT);
|
||||
else {
|
||||
_G(det)->startDetail(23, 255, ANI_FRONT);
|
||||
@ -373,13 +373,13 @@ void Room68::kostuem_aad(int16 aad_nr) {
|
||||
_G(det)->stop_detail(23);
|
||||
}
|
||||
|
||||
if (_G(gameState).DisplayText) {
|
||||
if (g_engine->_sound->subtitlesEnabled()) {
|
||||
g_engine->_sound->playSound(108, 1, false);
|
||||
}
|
||||
|
||||
_G(det)->startDetail(24, 255, ANI_FRONT);
|
||||
setPersonPos(26, 40, P_NICHELLE, P_RIGHT);
|
||||
if (_G(gameState).DisplayText) {
|
||||
if (g_engine->_sound->subtitlesEnabled()) {
|
||||
startAadWait(391);
|
||||
} else {
|
||||
waitShowScreen(100);
|
||||
@ -416,7 +416,7 @@ void Room68::kostuem_aad(int16 aad_nr) {
|
||||
_G(gameState)._personHide[P_NICHELLE] = false;
|
||||
setPersonPos(150, -13, P_NICHELLE, P_RIGHT);
|
||||
|
||||
if (_G(gameState).DisplayText) {
|
||||
if (g_engine->_sound->subtitlesEnabled()) {
|
||||
_G(currentSong) = -1;
|
||||
load_room_music(_G(gameState)._personRoomNr[0]);
|
||||
}
|
||||
|
@ -276,8 +276,8 @@ void Sound::convertTMFToMod(uint8 *tmfData, uint32 tmfSize, uint8 *modData, uint
|
||||
}
|
||||
|
||||
void Sound::waitForSpeechToFinish() {
|
||||
if (_G(gameState).SpeechSwitch) {
|
||||
while (g_engine->_sound->isSpeechActive() && !SHOULD_QUIT) {
|
||||
if (speechEnabled()) {
|
||||
while (isSpeechActive() && !SHOULD_QUIT) {
|
||||
setupScreen(DO_SETUP);
|
||||
}
|
||||
}
|
||||
@ -292,4 +292,36 @@ DisplayMode Sound::getSpeechSubtitlesMode() const {
|
||||
return DISPLAY_TXT;
|
||||
}
|
||||
|
||||
bool Sound::soundEnabled() const {
|
||||
return !ConfMan.getBool("sfx_mute");
|
||||
}
|
||||
|
||||
void Sound::toggleSound(bool enable) {
|
||||
return ConfMan.setBool("sfx_mute", !enable);
|
||||
}
|
||||
|
||||
bool Sound::musicEnabled() const {
|
||||
return !ConfMan.getBool("music_mute");
|
||||
}
|
||||
|
||||
void Sound::toggleMusic(bool enable) {
|
||||
return ConfMan.setBool("music_mute", !enable);
|
||||
}
|
||||
|
||||
bool Sound::speechEnabled() const {
|
||||
return !ConfMan.getBool("speech_mute");
|
||||
}
|
||||
|
||||
void Sound::toggleSpeech(bool enable) {
|
||||
return ConfMan.setBool("speech_mute", !enable);
|
||||
}
|
||||
|
||||
bool Sound::subtitlesEnabled() const {
|
||||
return !ConfMan.getBool("subtitles");
|
||||
}
|
||||
|
||||
void Sound::toggleSubtitles(bool enable) {
|
||||
return ConfMan.setBool("subtitles", !enable);
|
||||
}
|
||||
|
||||
} // namespace Chewy
|
||||
|
@ -75,6 +75,18 @@ public:
|
||||
*/
|
||||
DisplayMode getSpeechSubtitlesMode() const;
|
||||
|
||||
bool soundEnabled() const;
|
||||
void toggleSound(bool enable);
|
||||
|
||||
bool musicEnabled() const;
|
||||
void toggleMusic(bool enable);
|
||||
|
||||
bool speechEnabled() const;
|
||||
void toggleSpeech(bool enable);
|
||||
|
||||
bool subtitlesEnabled() const;
|
||||
void toggleSubtitles(bool enable);
|
||||
|
||||
private:
|
||||
Audio::Mixer *_mixer;
|
||||
Audio::SoundHandle _soundHandle[MAX_SOUND_EFFECTS];
|
||||
|
@ -51,6 +51,8 @@ bool GameState::synchronize(Common::Serializer &s) {
|
||||
if (sizeof(GameFlags) != SPIELER_FLAGS_SIZE)
|
||||
error("Invalid flags structure size");
|
||||
|
||||
byte dummy = 0;
|
||||
|
||||
// Sync the structure's bitflags
|
||||
s.syncBytes((byte *)_flags, SPIELER_FLAGS_SIZE);
|
||||
|
||||
@ -147,13 +149,13 @@ bool GameState::synchronize(Common::Serializer &s) {
|
||||
s.syncAsSint16LE(SVal3);
|
||||
s.syncAsSint16LE(SVal4);
|
||||
s.syncAsSint16LE(soundLoopMode);
|
||||
s.syncAsByte(SoundSwitch);
|
||||
s.syncAsByte(dummy); // sound switch
|
||||
s.syncAsByte(SoundVol);
|
||||
s.syncAsByte(MusicSwitch);
|
||||
s.syncAsByte(dummy); // music switch
|
||||
s.syncAsByte(MusicVol);
|
||||
s.syncAsByte(SpeechSwitch);
|
||||
s.syncAsByte(dummy); // speech switch
|
||||
s.syncAsByte(FramesPerSecond);
|
||||
s.syncAsByte(DisplayText);
|
||||
s.syncAsByte(dummy); // subtitles switch
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -517,13 +517,9 @@ struct GameState : public GameFlags {
|
||||
int16 SVal3 = 0;
|
||||
int16 SVal4 = 0;
|
||||
int16 soundLoopMode = 0;
|
||||
bool SoundSwitch = false;
|
||||
uint8 SoundVol = 0;
|
||||
bool MusicSwitch = false;
|
||||
uint8 MusicVol = 0;
|
||||
bool SpeechSwitch = false;
|
||||
uint8 FramesPerSecond = 0;
|
||||
bool DisplayText = false;
|
||||
};
|
||||
|
||||
struct AutoMov {
|
||||
|
Loading…
Reference in New Issue
Block a user