diff options
author | Ľubomír Remák | 2019-01-12 05:33:49 +0100 |
---|---|---|
committer | Ľubomír Remák | 2019-01-12 05:33:49 +0100 |
commit | b4fed90145e7aa22601de9f32b5a4b0501266d1a (patch) | |
tree | 608e339329980a6227772bd0e91cd3311dd1aa24 /engines/mutationofjb/room.cpp | |
parent | a97a14cc8918c7b60d94ec07ca4b214f3a7a2c93 (diff) | |
download | scummvm-rg350-b4fed90145e7aa22601de9f32b5a4b0501266d1a.tar.gz scummvm-rg350-b4fed90145e7aa22601de9f32b5a4b0501266d1a.tar.bz2 scummvm-rg350-b4fed90145e7aa22601de9f32b5a4b0501266d1a.zip |
MUTATIONOFJB: Fix SETANIM and add support for pickupable statics.
Diffstat (limited to 'engines/mutationofjb/room.cpp')
-rw-r--r-- | engines/mutationofjb/room.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/engines/mutationofjb/room.cpp b/engines/mutationofjb/room.cpp index e478a1cb8c..1d49fb3c80 100644 --- a/engines/mutationofjb/room.cpp +++ b/engines/mutationofjb/room.cpp @@ -148,11 +148,11 @@ void Room::drawObjectAnimation(uint8 objectId, int animOffset) { blit_if(_surfaces[animFrame], _background, Common::Point(object->_x, object->_y), ThresholdBlitOperation()); } -void Room::drawObject(uint8 objectId) { +void Room::drawObject(uint8 objectId, uint8 overrideFrame) { Scene *const currentScene = _game->getGameData().getCurrentScene(); Object *const object = currentScene->getObject(objectId); - drawObjectAnimation(objectId, object->_currentFrame - _objectsStart[objectId - 1] - 1); + drawObjectAnimation(objectId, (overrideFrame ? overrideFrame : object->_currentFrame) - _objectsStart[objectId - 1] - 1); } void Room::drawBitmap(uint8 bitmapId) { @@ -171,6 +171,16 @@ void Room::drawBitmap(uint8 bitmapId) { drawFrames(bitmap->_roomFrame - 1, bitmap->_roomFrame - 1, bitmapArea, 0xC0); } +void Room::drawStatic(Static *const stat) { + if (!stat || !stat->allowsImplicitPickup()) { + return; + } + + const uint8 frame = stat->_active ? 1 : 2; // Hardcoded values. Active is taken from frame 1 and inactive from frame 2. + const Common::Rect staticArea(stat->_x, stat->_y, stat->_x + stat->_width, stat->_y + stat->_height); + drawFrames(frame, frame, staticArea, 0xC0); // Hardcoded threshold. +} + void Room::drawFrames(uint8 fromFrame, uint8 toFrame, const Common::Rect &area, uint8 threshold) { GameData &gameData = _game->getGameData(); @@ -195,15 +205,19 @@ void Room::drawFrames(uint8 fromFrame, uint8 toFrame, const Common::Rect &area, AnimationDecoder decoder(fileName, _background); decoder.setPartialMode(fromFrame, toFrame, area, threshold); decoder.decode(nullptr); - if (!area.isEmpty()) - _screen->getSubArea(area); // Add dirty rect. - else - _screen->makeAllDirty(); } } void Room::initialDraw() { Scene *const currentScene = _game->getGameData().getCurrentScene(); + + for (uint8 i = 0; i < currentScene->getNoStatics(); ++i) { + Static *const stat = currentScene->getStatic(i + 1); + if (stat->_active && stat->allowsImplicitPickup()) { + drawStatic(stat); + } + } + for (uint8 i = 0; i < currentScene->getNoObjects(); ++i) { Object *const obj = currentScene->getObject(i + 1); if (obj->_active) { |