[Scummvm-git-logs] scummvm master -> 51f1d4dc735dd5d27b7374525e1f74f9fada69a3
sluicebox
noreply at scummvm.org
Tue Jan 10 22:52:50 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6eea9e517b SCI: Detect SCI16 unthrottled inner loops
51f1d4dc73 SCI: Fix LB2 reporter message
Commit: 6eea9e517bdbad20b06170f2f2d3ba5d01eb1543
https://github.com/scummvm/scummvm/commit/6eea9e517bdbad20b06170f2f2d3ba5d01eb1543
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-10T14:50:51-08:00
Commit Message:
SCI: Detect SCI16 unthrottled inner loops
This restores kGetEvent throttling (10ms delay) during inner loops that
don't throttle themselves. For example, the event processing loop in
Dialog:doit doesn't include a kWait(1) call in some games.
In these games, dialogs max out CPU, and if they run animations then
they run too fast. This happens in the CD version of JONES, bug #14020.
I had considered doing something like this earlier, but it wasn't clear
how to best detect these loops. What I didn't realize is that the SCI32
code already does this by counting kGetEvent calls in between kFrameout.
Now that technique is adapted for SCI16. Combined with the existing
"fast cast" detection, this throttles event-polling inner loops while
keeping the kGetEvent and kGameIsRestarting throttling separate so that
they don't overlap and conflict.
See: e09010f7d8b7cc30ae3c8477d1a8b61b24d96306
Changed paths:
engines/sci/engine/kevent.cpp
engines/sci/engine/kgraphics.cpp
engines/sci/engine/kmisc.cpp
engines/sci/engine/state.cpp
engines/sci/engine/state.h
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index afe8082f0a0..7c5dd193f54 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -265,14 +265,21 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
g_sci->_soundCmd->updateSci0Cues();
}
- // Wait a bit if a "fast cast" game is polling kGetEvent while a message is
- // being said or displayed. This prevents fast cast mode from maxing out
- // CPU by polling from an inner loop when the fast cast global is set.
- // Fixes bugs #5091, #5326
- if (getSciVersion() <= SCI_VERSION_1_1 &&
- g_sci->_gfxAnimate->isFastCastEnabled() &&
- !s->variables[VAR_GLOBAL][kGlobalVarFastCast].isNull()) {
- g_system->delayMillis(10);
+ // If we're in a SCI16 unthrottled inner loop then delay a bit.
+ // This prevents the CPU from maxing out and prevents inner loop animations
+ // from running too fast. "Fast cast" games poll kGetEvent from an inner
+ // loop while they display or say a message. This can be detected by testing
+ // the fast cast global. Other inner loops can be detected by counting the
+ // kGetEvent calls since the last kGameIsRestarting(0) or kWait call.
+ // For example, some versions of Dialog:doit poll without calling kWait(1).
+ // See above for similar SCI32 code that counts calls between kFrameout.
+ // Fixes bugs #5091, #5326, #14020
+ if (getSciVersion() <= SCI_VERSION_1_1) {
+ if (++s->_eventCounter > 2 ||
+ (g_sci->_gfxAnimate->isFastCastEnabled() &&
+ !s->variables[VAR_GLOBAL][kGlobalVarFastCast].isNull())) {
+ g_system->delayMillis(10);
+ }
}
return s->r_acc;
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index b62eec7d061..3c72f693432 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -392,6 +392,7 @@ reg_t kWait(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+ s->_eventCounter = 0;
s->_paletteSetIntensityCounter = 0;
return make_reg(0, delta);
}
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 95c447ea5b6..20249ef5d87 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -157,6 +157,7 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
s->speedThrottler(neededSleep);
+ s->_eventCounter = 0;
s->_paletteSetIntensityCounter = 0;
return make_reg(0, previousRestartingFlag);
}
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index ea0c1d54373..ea17be6b304 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -104,9 +104,7 @@ void EngineState::reset(bool isRestoring) {
gcCountDown = 0;
-#ifdef ENABLE_SCI32
_eventCounter = 0;
-#endif
_paletteSetIntensityCounter = 0;
_throttleLastTime = 0;
_throttleTrigger = false;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 733a1fbd0e0..fba3c2d857e 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -116,10 +116,8 @@ public:
uint16 wait(uint16 ticks);
void sleep(uint16 ticks);
-#ifdef ENABLE_SCI32
- uint32 _eventCounter; /**< total times kGetEvent was invoked since the last call to kFrameOut */
-#endif
- uint32 _paletteSetIntensityCounter; /**< total times kPaletteSetIntensity was invoked since the last call to kGameIsRestarting or kWait */
+ uint32 _eventCounter; /**< total times kGetEvent was invoked since the last call to kGameIsRestarting(0) or kWait or kFrameOut */
+ uint32 _paletteSetIntensityCounter; /**< total times kPaletteSetIntensity was invoked since the last call to kGameIsRestarting(0) or kWait */
uint32 _throttleLastTime; /**< last time kAnimate was invoked */
bool _throttleTrigger;
Commit: 51f1d4dc735dd5d27b7374525e1f74f9fada69a3
https://github.com/scummvm/scummvm/commit/51f1d4dc735dd5d27b7374525e1f74f9fada69a3
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-10T14:50:51-08:00
Commit Message:
SCI: Fix LB2 reporter message
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 520fe54912d..2bdcdfeae3e 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10903,6 +10903,28 @@ static const uint16 laurabow2PatchMuseumMusicVolume[] = {
PATCH_END
};
+// In the news room (230) there are two reporters on the left, but one of them
+// responds to Ask with the other's message, talker, and voice. The script
+// passes the wrong noun to lb2Messager:say.
+//
+// We fix this by patching both doVerb methods to pass their noun property so
+// that they both respond to Ask with their own message.
+//
+// Applies to: All versions
+// Responsible Methods: personS:doVerb, personT:doVerb
+static const uint16 laurabow2SignatureReporterMessage[] = {
+ 0x39, 0x0d, // pushi 0d [ noun ]
+ SIG_MAGICDWORD,
+ 0x39, 0x06, // pushi 06 [ verb ]
+ 0x39, 0x2e, // pushi 2e [ cond ]
+ SIG_END
+};
+
+static const uint16 laurabow2PatchReporterMessage[] = {
+ 0x67, 0x1a, // pTos noun
+ PATCH_END
+};
+
// LB2CD reduces the music volume significantly during the introduction when
// characters talk while disembarking the ship in room 120. This is done so
// that their speech can be heard but it also occurs in text-only mode.
@@ -11051,6 +11073,7 @@ static const SciScriptPatcherEntry laurabow2Signatures[] = {
{ true, 26, "CD: fix act 4 wrong music", 1, laurabow2CDSignatureFixAct4WrongMusic, laurabow2CDPatchFixAct4WrongMusic },
{ true, 90, "CD: fix yvette's tut response", 1, laurabow2CDSignatureFixYvetteTutResponse, laurabow2CDPatchFixYvetteTutResponse },
{ true, 110, "CD: fix intro music", 1, laurabow2CDSignatureFixIntroMusic, laurabow2CDPatchFixIntroMusic },
+ { true, 230, "CD/Floppy: reporter message", 2, laurabow2SignatureReporterMessage, laurabow2PatchReporterMessage },
{ true, 350, "CD/Floppy: museum party fix entering south 1/2", 1, laurabow2SignatureMuseumPartyFixEnteringSouth1, laurabow2PatchMuseumPartyFixEnteringSouth1 },
{ true, 350, "CD/Floppy: museum party fix entering south 2/2", 1, laurabow2SignatureMuseumPartyFixEnteringSouth2, laurabow2PatchMuseumPartyFixEnteringSouth2 },
{ false, 355, "CD: fix museum actor loops", 2, laurabow2CDSignatureFixMuseumActorLoops1, laurabow2CDPatchFixMuseumActorLoops1 },
More information about the Scummvm-git-logs
mailing list