aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb/room.cpp
diff options
context:
space:
mode:
authorĽubomír Remák2018-07-21 17:37:23 +0200
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commit2e656e69b3b9416f5164f0963951df203f4978e5 (patch)
tree21320d109d41d6c3acd102aaddac3599d21c1b88 /engines/mutationofjb/room.cpp
parent6c4ae7f19883dd7fa6de4fc3234351f1e33ba7a3 (diff)
downloadscummvm-rg350-2e656e69b3b9416f5164f0963951df203f4978e5.tar.gz
scummvm-rg350-2e656e69b3b9416f5164f0963951df203f4978e5.tar.bz2
scummvm-rg350-2e656e69b3b9416f5164f0963951df203f4978e5.zip
MUTATIONOFJB: Blit with threshold.
Diffstat (limited to 'engines/mutationofjb/room.cpp')
-rw-r--r--engines/mutationofjb/room.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/engines/mutationofjb/room.cpp b/engines/mutationofjb/room.cpp
index 1da2730a48..dd9a6dbab5 100644
--- a/engines/mutationofjb/room.cpp
+++ b/engines/mutationofjb/room.cpp
@@ -28,6 +28,7 @@
#include "mutationofjb/gamedata.h"
#include "mutationofjb/util.h"
+#include "common/rect.h"
#include "common/str.h"
#include "common/translation.h"
@@ -117,6 +118,13 @@ bool Room::load(uint8 roomNumber, bool roomB) {
return decoder.decode(&callback);
}
+// TODO: Take the threshold value from ATN data.
+struct ThresholdBlitOperation {
+ bool operator()(const byte /*srcColor*/, const byte destColor) {
+ return destColor <= 0xBF;
+ }
+};
+
void Room::drawObjectAnimation(uint8 objectId, int animOffset) {
Scene *const scene = _game->getGameData().getCurrentScene();
if (!scene) {
@@ -129,8 +137,8 @@ void Room::drawObjectAnimation(uint8 objectId, int animOffset) {
const int startFrame = _objectsStart[objectId - 1];
const int animFrame = startFrame + animOffset;
- // TODO: Threshold.
- _screen->blitFrom(_surfaces[animFrame], Common::Point(object->_x, object->_y));
+
+ blit_if(_surfaces[animFrame], *_screen, Common::Point(object->_x, object->_y), ThresholdBlitOperation());
}
void Room::redraw() {
@@ -140,7 +148,7 @@ void Room::redraw() {
}
Scene *const currentScene = _game->getGameData().getCurrentScene();
- for (int i = 0; i < currentScene->getNoObjects(); ++i) {
+ for (uint8 i = 0; i < currentScene->getNoObjects(); ++i) {
Object *const obj = currentScene->getObject(i + 1);
if (obj->_active) {
drawObjectAnimation(i + 1, obj->_currentFrame - _objectsStart[i] - 1);