From 68023904a4c4138cdd87e8f86ebddb19be802309 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 1 Dec 2016 12:53:02 -0600 Subject: SCI32: Fix LSL6hires text speed slider For whatever reason, this game uses a different global for specifying the text speed. --- engines/sci/engine/vm.cpp | 23 +++++++++++++++++------ engines/sci/engine/vm.h | 1 + engines/sci/sci.cpp | 15 ++++++++++++++- 3 files changed, 32 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 01051ebdd4..92228fd38a 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -199,6 +199,23 @@ static void write_var(EngineState *s, int type, int index, reg_t value) { s->variables[type][index] = value; +#ifdef ENABLE_SCI32 + if (type == VAR_GLOBAL && getSciVersion() >= SCI_VERSION_2 && g_sci->getEngineState()->_syncedAudioOptions) { + + switch (g_sci->getGameId()) { + case GID_LSL6HIRES: + if (index == kGlobalVarLSL6HiresTextSpeed) { + ConfMan.setInt("talkspeed", (14 - value.toSint16()) * 255 / 13); + } + break; + default: + if (index == kGlobalVarTextSpeed) { + ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8); + } + } + } +#endif + if (type == VAR_GLOBAL && index == kGlobalVarMessageType) { // The game is trying to change its speech/subtitle settings if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][kGlobalVarQuit] == TRUE_REG) { @@ -212,12 +229,6 @@ static void write_var(EngineState *s, int type, int index, reg_t value) { g_sci->updateScummVMAudioOptions(); } } - -#ifdef ENABLE_SCI32 - if (type == VAR_GLOBAL && index == kGlobalVarTextSpeed && getSciVersion() >= SCI_VERSION_2) { - ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8); - } -#endif } } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index cec9e1528c..13f60fd49c 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -150,6 +150,7 @@ enum GlobalVar { kGlobalVarFastCast = 84, // SCI16 kGlobalVarMessageType = 90, kGlobalVarTextSpeed = 94, // SCI32; 0 is fastest, 8 is slowest + kGlobalVarLSL6HiresTextSpeed = 167, // 1 is fastest, 14 is slowest kGlobalVarShivers1Score = 349 }; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index e89d05217c..1e3ab2ae34 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -1123,7 +1123,20 @@ void SciEngine::syncIngameAudioOptions() { #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) { - _gamestate->variables[VAR_GLOBAL][kGlobalVarTextSpeed] = make_reg(0, 8 - ConfMan.getInt("talkspeed") * 8 / 255); + GlobalVar index; + uint16 textSpeed; + + switch (g_sci->getGameId()) { + case GID_LSL6HIRES: + index = kGlobalVarLSL6HiresTextSpeed; + textSpeed = 14 - ConfMan.getInt("talkspeed") * 14 / 255 + 1; + break; + default: + index = kGlobalVarTextSpeed; + textSpeed = 8 - ConfMan.getInt("talkspeed") * 8 / 255; + } + + _gamestate->variables[VAR_GLOBAL][index] = make_reg(0, textSpeed); } #endif -- cgit v1.2.3