[Scummvm-git-logs] scummvm master -> bfd4170532538e18c0c9e36b4b05069e0524b19e
sluicebox
22204938+sluicebox at users.noreply.github.com
Thu Mar 11 13:47:31 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bfd4170532 SCI32: Fix kStringToInteger space parsing
Commit: bfd4170532538e18c0c9e36b4b05069e0524b19e
https://github.com/scummvm/scummvm/commit/bfd4170532538e18c0c9e36b4b05069e0524b19e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-03-11T05:47:02-08:00
Commit Message:
SCI32: Fix kStringToInteger space parsing
Fixes reading settings from game.opt in HOYLE5, where most strings
begin with spaces. SSCI called atoi() which handles this, and so did
we, until it was changed during a large refactor in
3f9172676526aa04983f148d1262af6ea9fb53ef
Changed paths:
engines/sci/engine/guest_additions.cpp
engines/sci/engine/kstring.cpp
engines/sci/engine/vm.h
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index dfca1c433d..49ba1a9187 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -167,16 +167,6 @@ void GuestAdditions::writeVarHook(const int type, const int index, const reg_t v
syncGK1StartupVolumeFromScummVM(index, value);
} else if (g_sci->getGameId() == GID_HOYLE5 && index == kGlobalVarHoyle5MusicVolume) {
syncHoyle5VolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kHoyle5VolumeMax / Audio::Mixer::kMaxMixerVolume);
- } else if (g_sci->getGameId() == GID_HOYLE5 && index == kGlobalVarHoyle5ResponseTime && value.getOffset() == 0) {
- // WORKAROUND: Global 899 contains the response time value,
- // which may have values between 1 and 15. There is a script
- // bug when loading values from game.opt, where this variable
- // may be incorrectly set to 0. This makes the opponent freeze
- // while playing Backgammon and Bridge. Fix this case here, by
- // setting the correct minimum value, 1.
- // TODO: Either make this a script patch, or find out if it's
- // a bug with ScummVM when reading values from text files.
- _state->variables[VAR_GLOBAL][index].setOffset(1);
} else if (g_sci->getGameId() == GID_RAMA && !g_sci->isDemo() && index == kGlobalVarRamaMusicVolume) {
syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume);
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index ffebf8a202..c837eb2ae2 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -824,7 +824,9 @@ reg_t kStringFormatAt(EngineState *s, int argc, reg_t *argv) {
}
reg_t kStringToInteger(EngineState *s, int argc, reg_t *argv) {
- return make_reg(0, (uint16)s->_segMan->getString(argv[0]).asUint64());
+ Common::String string = s->_segMan->getString(argv[0]);
+ int16 result = (int16)atoi(string.c_str());
+ return make_reg(0, result);
}
reg_t kStringTrim(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 9136f77b9c..08ea4e9e88 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -181,8 +181,7 @@ enum GlobalVar {
kGlobalVarPhant2ControlPanel = 250,
kGlobalVarShivers1Score = 349,
kGlobalVarQFG4Flags = 500,
- kGlobalVarHoyle5MusicVolume = 897,
- kGlobalVarHoyle5ResponseTime = 899
+ kGlobalVarHoyle5MusicVolume = 897
};
/** Number of kernel calls in between gcs; should be < 50000 */
More information about the Scummvm-git-logs
mailing list