diff options
author | Colin Snover | 2016-06-26 10:52:17 -0500 |
---|---|---|
committer | Colin Snover | 2016-06-26 12:44:36 -0500 |
commit | 1632bd50c890c9e50139c57b52d8e1bfc8f61c61 (patch) | |
tree | 89f47c9a21b62c14be891751c45e00104d9b449b | |
parent | 60849a16cb34a35a29734ff86ca4776a0f21e868 (diff) | |
download | scummvm-rg350-1632bd50c890c9e50139c57b52d8e1bfc8f61c61.tar.gz scummvm-rg350-1632bd50c890c9e50139c57b52d8e1bfc8f61c61.tar.bz2 scummvm-rg350-1632bd50c890c9e50139c57b52d8e1bfc8f61c61.zip |
SCI32: Fix benchmarking for QFG4
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 32 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.h | 6 |
2 files changed, 30 insertions, 8 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 09e705aebf..cb777301b0 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -253,6 +253,28 @@ void GfxFrameout::syncWithScripts(bool addElements) { } #pragma mark - +#pragma mark Benchmarking + +bool GfxFrameout::checkForFred(const reg_t object) { + const int16 viewId = readSelectorValue(_segMan, object, SELECTOR(view)); + const SciGameId gameId = g_sci->getGameId(); + + if (gameId == GID_QFG4 && viewId == 9999) { + return true; + } + + if (gameId != GID_QFG4 && viewId == -556) { + return true; + } + + if (Common::String(_segMan->getObjectName(object)) == "fred") { + return true; + } + + return false; +} + +#pragma mark - #pragma mark Screen items void GfxFrameout::deleteScreenItem(ScreenItem *screenItem, Plane *plane) { @@ -276,10 +298,7 @@ void GfxFrameout::kernelAddScreenItem(const reg_t object) { // it is impacted by framerate throttling, so disable the // throttling when this item is on the screen for the // performance check to pass. - if (!_benchmarkingFinished && ( - (int16)readSelectorValue(_segMan, object, SELECTOR(view)) == -556 || - Common::String(_segMan->getObjectName(object)) == "fred" - )) { + if (!_benchmarkingFinished && _throttleFrameOut && checkForFred(object)) { _throttleFrameOut = false; } @@ -326,10 +345,7 @@ void GfxFrameout::kernelDeleteScreenItem(const reg_t object) { // it is impacted by framerate throttling, so disable the // throttling when this item is on the screen for the // performance check to pass. - if (!_benchmarkingFinished && ( - (int16)readSelectorValue(_segMan, object, SELECTOR(view)) == -556 || - Common::String(_segMan->getObjectName(object)) == "fred" - )) { + if (!_benchmarkingFinished && checkForFred(object)) { _benchmarkingFinished = true; _throttleFrameOut = true; } diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 53df5d975f..0be5aece1e 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -189,6 +189,12 @@ private: */ bool _throttleFrameOut; + /** + * Determines whether or not a screen item is the "Fred" + * object. + */ + bool checkForFred(const reg_t object); + #pragma mark - #pragma mark Screen items private: |