diff options
author | Paul Gilbert | 2015-05-19 08:13:46 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-19 08:13:46 -0400 |
commit | 1c395b4de91f3edb0ad7109da016eb42a32b434b (patch) | |
tree | 3111d1c46227c5cfc7fa0db7084c46ebceb98e8e /engines | |
parent | fa35249a240d7bdfe5f5b7eb9ae073126d5080c4 (diff) | |
download | scummvm-rg350-1c395b4de91f3edb0ad7109da016eb42a32b434b.tar.gz scummvm-rg350-1c395b4de91f3edb0ad7109da016eb42a32b434b.tar.bz2 scummvm-rg350-1c395b4de91f3edb0ad7109da016eb42a32b434b.zip |
SHERLOCK: Add extra constants for object bit-flags
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/events.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/objects.cpp | 10 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 2 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 48 |
4 files changed, 35 insertions, 33 deletions
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp index b01437d54b..94ddc9a792 100644 --- a/engines/sherlock/events.cpp +++ b/engines/sherlock/events.cpp @@ -214,18 +214,18 @@ bool Events::delay(uint32 time, bool interruptable) { void Events::setButtonState() { _released = _rightReleased = false; - if (_mouseButtons & 1) + if (_mouseButtons & LEFT_BUTTON) _pressed = _oldButtons = true; - if ((_mouseButtons & 1) == 0 && _oldButtons) { + if ((_mouseButtons & LEFT_BUTTON) == 0 && _oldButtons) { _pressed = _oldButtons = false; _released = true; } - if (_mouseButtons & 2) + if (_mouseButtons & RIGHT_BUTTON) _rightPressed = _oldRightButton = true; - if ((_mouseButtons & 2) == 0 && _oldRightButton) { + if ((_mouseButtons & RIGHT_BUTTON) == 0 && _oldRightButton) { _rightPressed = _oldRightButton = false; _rightReleased = true; } diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index e630b48f3a..94457b3dd5 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -575,7 +575,7 @@ void Object::checkObject() { _seqCounter2 = _seqCounter; _seqStack = _frameNumber + 1; setObjSequence(v, false); - } else if (v >= SOUND_CODE && (v <= (SOUND_CODE + 29))) { + } else if (v >= SOUND_CODE && (v < (SOUND_CODE + 30))) { codeFound = true; ++_frameNumber; v -= SOUND_CODE; @@ -584,7 +584,7 @@ void Object::checkObject() { if (!scene._sounds[v - 1]._name.empty() && sound._digitized) sound.playLoadedSound(v - 1, WAIT_RETURN_IMMEDIATELY); } - } else if (v >= FLIP_CODE && v <= (FLIP_CODE + 2)) { + } else if (v >= FLIP_CODE && v < (FLIP_CODE + 3)) { // Flip code codeFound = true; ++_frameNumber; @@ -594,15 +594,15 @@ void Object::checkObject() { switch (v) { case 0: // Clear the flag - _flags &= ~2; + _flags &= ~OBJ_FLIPPED; break; case 1: // Set the flag - _flags |= 2; + _flags |= OBJ_FLIPPED; break; case 2: // Toggle the flag - _flags ^= 2; + _flags ^= OBJ_FLIPPED; break; default: break; diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index 53752a7351..6dbe645d4b 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -189,7 +189,7 @@ struct UseType { void load(Common::SeekableReadStream &s); }; -enum { TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 }; +enum { OBJ_BEHIND = 1, OBJ_FLIPPED = 2, OBJ_FORWARD = 4, TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 }; #define USE_COUNT 4 class Object { diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 5ac43fc1be..d835b5caa8 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -727,27 +727,27 @@ void Scene::updateBackground() { // Draw all active shapes which are behind the person for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & 2); + screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all canimations which are behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == BEHIND) screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, - _canimShapes[idx]._position, _canimShapes[idx]._flags & 2); + _canimShapes[idx]._position, _canimShapes[idx]._flags & OBJ_FLIPPED); } // Draw all active shapes which are normal and behind the person for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & 2); + screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all canimations which are normal and behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == NORMAL_BEHIND) screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & 2); + _canimShapes[idx]._flags & OBJ_FLIPPED); } // Draw the player if he's active @@ -764,7 +764,8 @@ void Scene::updateBackground() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && _bgShapes[idx]._misc == NORMAL_FORWARD) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & 2); + screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, + _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are NORMAL and are in front of the player @@ -772,7 +773,7 @@ void Scene::updateBackground() { if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) && _canimShapes[idx]._misc == NORMAL_FORWARD) screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & 2); + _canimShapes[idx]._flags & OBJ_FLIPPED); } // Draw all static and active shapes that are FORWARD @@ -783,7 +784,8 @@ void Scene::updateBackground() { if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) && _bgShapes[idx]._misc == FORWARD) - screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & 2); + screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, + _bgShapes[idx]._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are forward @@ -791,7 +793,7 @@ void Scene::updateBackground() { if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) && _canimShapes[idx]._misc == FORWARD) screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position, - _canimShapes[idx]._flags & 2); + _canimShapes[idx]._flags & OBJ_FLIPPED); } screen.resetDisplayBounds(); @@ -814,9 +816,9 @@ void Scene::checkBgShapes(ImageFrame *frame, const Common::Point &pt) { if ((obj._flags & 5) == 1) { obj._misc = (pt.y < (obj._position.y + obj.frameHeight() - 1)) ? NORMAL_FORWARD : NORMAL_BEHIND; - } else if (!(obj._flags & 1)) { + } else if (!(obj._flags & OBJ_BEHIND)) { obj._misc = BEHIND; - } else if (obj._flags & 4) { + } else if (obj._flags & OBJ_FORWARD) { obj._misc = FORWARD; } } @@ -1147,7 +1149,7 @@ void Scene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; - if (o._type == NO_SHAPE && ((o._flags & 1) == 0)) { + if (o._type == NO_SHAPE && ((o._flags & OBJ_BEHIND) == 0)) { // Restore screen area screen._backBuffer->blitFrom(screen._backBuffer2, o._position, Common::Rect(o._position.x, o._position.y, @@ -1198,14 +1200,14 @@ void Scene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all canimations which are behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { Object &o = _canimShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -1213,14 +1215,14 @@ void Scene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all canimations which are NORMAL and behind the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { Object &o = _canimShapes[idx]; if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -1241,14 +1243,14 @@ void Scene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw all static and active canimations that are NORMAL and are in front of the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { Object &o = _canimShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } @@ -1256,27 +1258,27 @@ void Scene::doBgAnim() { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Draw any active portrait if (people._portraitLoaded && people._portrait._type == ACTIVE_BG_SHAPE) screen._backBuffer->transBlitFrom(*people._portrait._imageFrame, - people._portrait._position, people._portrait._flags & 2); + people._portrait._position, people._portrait._flags & OBJ_FLIPPED); // Draw all static and active canimations that are in front of the person for (uint idx = 0; idx < _canimShapes.size(); ++idx) { Object &o = _canimShapes[idx]; if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) { - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } } // Draw all NO_SHAPE shapes which have flag bit 0 clear for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; - if (o._type == NO_SHAPE && (o._flags & 1) == 0) - screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & 2); + if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0) + screen._backBuffer->transBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED); } // Bring the newly built picture to the screen @@ -1331,7 +1333,7 @@ void Scene::doBgAnim() { if (_goToScene == -1) { for (uint idx = 0; idx < _bgShapes.size(); ++idx) { Object &o = _bgShapes[idx]; - if (o._type == NO_SHAPE && (o._flags & 1) == 0) { + if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0) { screen.slamArea(o._position.x, o._position.y, o._oldSize.x, o._oldSize.y); screen.slamArea(o._oldPosition.x, o._oldPosition.y, o._oldSize.x, o._oldSize.y); } else if (o._type == HIDE_SHAPE) { |