diff options
author | Lars Skovlund | 2018-12-27 08:06:16 +0100 |
---|---|---|
committer | Filippos Karapetis | 2018-12-28 11:55:32 +0200 |
commit | 4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a (patch) | |
tree | bbbb0aaea918c665d2f687a8d85d0621c3a9045e /engines | |
parent | 45d852cbaf5e46982bb98fb6425c34cd68537be1 (diff) | |
download | scummvm-rg350-4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a.tar.gz scummvm-rg350-4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a.tar.bz2 scummvm-rg350-4b6e0e0e7de7589f7e4ce09b7f4c77da45e4477a.zip |
SCI32: Add feature detection for plane id base
This provides a generic fix for AddScreenItem crashes in early SCI32
floppy games that have previously required individual script patches.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/features.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/features.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/plane32.cpp | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index 06fa046228..df57655d8a 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -628,6 +628,14 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const { return kMessageTypeSyncStrategyNone; } +int GameFeatures::detectPlaneIdBase() { + if (getSciVersion() == SCI_VERSION_2 && + g_sci->getGameId() != GID_PQ4) + return 0; + else + return 20000; +} + bool GameFeatures::autoDetectMoveCountType() { // Look up the script address reg_t addr = getDetectionAddr("Motion", SELECTOR(doit)); diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h index 7a1c6f59aa..d776495c2f 100644 --- a/engines/sci/engine/features.h +++ b/engines/sci/engine/features.h @@ -228,6 +228,8 @@ public: */ MoveCountType detectMoveCountType(); + int detectPlaneIdBase(); + bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; } bool usesCdTrack() { return _usesCdTrack; } diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp index 46a8aedbb0..c85965e755 100644 --- a/engines/sci/graphics/plane32.cpp +++ b/engines/sci/graphics/plane32.cpp @@ -44,8 +44,8 @@ void DrawList::add(ScreenItem *screenItem, const Common::Rect &rect) { #pragma mark - #pragma mark Plane -uint16 Plane::_nextObjectId = 20000; -uint32 Plane::_nextCreationId = 0; +uint16 Plane::_nextObjectId; // Will be initialized in Plane::init() +uint32 Plane::_nextCreationId; // ditto Plane::Plane(const Common::Rect &gameRect, PlanePictureCodes pictureId) : _creationId(_nextCreationId++), @@ -132,7 +132,7 @@ void Plane::operator=(const Plane &other) { } void Plane::init() { - _nextObjectId = 20000; + _nextObjectId = g_sci->_features->detectPlaneIdBase(); _nextCreationId = 0; } |