diff options
author | Matthew Hoops | 2010-09-09 17:27:02 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-09-09 17:27:02 +0000 |
commit | 30080c7e070aa06fa1fb795db90392d85351a62c (patch) | |
tree | 7c1d518e955a3da3195cba0c9c6d4034d8edbcc1 /engines/mohawk/graphics.cpp | |
parent | 746a1c56144e0d4e608244ac19e6774fd4de3933 (diff) | |
download | scummvm-rg350-30080c7e070aa06fa1fb795db90392d85351a62c.tar.gz scummvm-rg350-30080c7e070aa06fa1fb795db90392d85351a62c.tar.bz2 scummvm-rg350-30080c7e070aa06fa1fb795db90392d85351a62c.zip |
MOHAWK: Add initial work on the Riven marble puzzle
The marbles are currently drawn, and you can pick them up, but you can not place them on the grid yet.
svn-id: r52661
Diffstat (limited to 'engines/mohawk/graphics.cpp')
-rw-r--r-- | engines/mohawk/graphics.cpp | 83 |
1 files changed, 55 insertions, 28 deletions
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index 64629f949d..f472a9d721 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -326,7 +326,7 @@ void RivenGraphics::drawPLST(uint16 x) { // draw PLST 1 each time. This "hack" is here to catch any PLST attempting to draw // twice. There should never be a problem with doing it this way. if (index == x && !(Common::find(_activatedPLSTs.begin(), _activatedPLSTs.end(), x) != _activatedPLSTs.end())) { - debug (0, "Drawing image %d", id); + debug(0, "Drawing image %d", id); copyImageToScreen(id, left, top, right, bottom); _activatedPLSTs.push_back(x); break; @@ -491,95 +491,106 @@ void RivenGraphics::runScheduledTransition() { _scheduledTransition = -1; // Clear scheduled transition } -// TODO: Marble Cursors/Palettes void RivenGraphics::changeCursor(uint16 num) { // All of Riven's cursors are hardcoded. See riven_cursors.h for these definitions. switch (num) { case 1002: // Zip Mode - CursorMan.replaceCursor(zipModeCursor, 16, 16, 8, 8, 0); - CursorMan.replaceCursorPalette(zipModeCursorPalette, 1, ARRAYSIZE(zipModeCursorPalette) / 4); + CursorMan.replaceCursor(s_zipModeCursor, 16, 16, 8, 8, 0); + CursorMan.replaceCursorPalette(s_zipModeCursorPalette, 1, ARRAYSIZE(s_zipModeCursorPalette) / 4); break; case 2003: // Hand Over Object - CursorMan.replaceCursor(objectHandCursor, 16, 16, 8, 8, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_objectHandCursor, 16, 16, 8, 8, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 2004: // Grabbing/Using Object - CursorMan.replaceCursor(grabbingHandCursor, 13, 13, 6, 6, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_grabbingHandCursor, 13, 13, 6, 6, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3000: // Standard Hand - CursorMan.replaceCursor(standardHandCursor, 15, 16, 6, 0, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_standardHandCursor, 15, 16, 6, 0, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3001: // Pointing Left - CursorMan.replaceCursor(pointingLeftCursor, 15, 13, 0, 3, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingLeftCursor, 15, 13, 0, 3, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3002: // Pointing Right - CursorMan.replaceCursor(pointingRightCursor, 15, 13, 14, 3, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingRightCursor, 15, 13, 14, 3, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3003: // Pointing Down (Palm Up) - CursorMan.replaceCursor(pointingDownCursorPalmUp, 13, 16, 3, 15, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingDownCursorPalmUp, 13, 16, 3, 15, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3004: // Pointing Up (Palm Up) - CursorMan.replaceCursor(pointingUpCursorPalmUp, 13, 16, 3, 0, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingUpCursorPalmUp, 13, 16, 3, 0, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3005: // Pointing Left (Curved) - CursorMan.replaceCursor(pointingLeftCursorBent, 15, 13, 0, 5, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingLeftCursorBent, 15, 13, 0, 5, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3006: // Pointing Right (Curved) - CursorMan.replaceCursor(pointingRightCursorBent, 15, 13, 14, 5, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingRightCursorBent, 15, 13, 14, 5, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 3007: // Pointing Down (Palm Down) - CursorMan.replaceCursor(pointingDownCursorPalmDown, 15, 16, 7, 15, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + CursorMan.replaceCursor(s_pointingDownCursorPalmDown, 15, 16, 7, 15, 0); + CursorMan.replaceCursorPalette(s_handCursorPalette, 1, ARRAYSIZE(s_handCursorPalette) / 4); break; case 4001: // Red Marble + CursorMan.replaceCursor(s_redMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_redMarbleCursorPalette, 1, ARRAYSIZE(s_redMarbleCursorPalette) / 4); break; case 4002: // Orange Marble + CursorMan.replaceCursor(s_orangeMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_orangeMarbleCursorPalette, 1, ARRAYSIZE(s_orangeMarbleCursorPalette) / 4); break; case 4003: // Yellow Marble + CursorMan.replaceCursor(s_yellowMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_yellowMarbleCursorPalette, 1, ARRAYSIZE(s_yellowMarbleCursorPalette) / 4); break; case 4004: // Green Marble + CursorMan.replaceCursor(s_greenMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_greenMarbleCursorPalette, 1, ARRAYSIZE(s_greenMarbleCursorPalette) / 4); break; case 4005: // Blue Marble + CursorMan.replaceCursor(s_blueMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_blueMarbleCursorPalette, 1, ARRAYSIZE(s_blueMarbleCursorPalette) / 4); break; case 4006: - // Purple Marble + // Violet Marble + CursorMan.replaceCursor(s_violetMarbleCursor, 12, 12, 5, 5, 0); + CursorMan.replaceCursorPalette(s_violetMarbleCursorPalette, 1, ARRAYSIZE(s_violetMarbleCursorPalette) / 4); break; case 5000: // Pellet - CursorMan.replaceCursor(pelletCursor, 8, 8, 4, 4, 0); - CursorMan.replaceCursorPalette(pelletCursorPalette, 1, ARRAYSIZE(pelletCursorPalette) / 4); + CursorMan.replaceCursor(s_pelletCursor, 8, 8, 4, 4, 0); + CursorMan.replaceCursorPalette(s_pelletCursorPalette, 1, ARRAYSIZE(s_pelletCursorPalette) / 4); break; case 9000: // Hide Cursor CursorMan.showMouse(false); break; default: - error ("Cursor %d does not exist!", num); + error("Cursor %d does not exist!", num); } if (num != 9000) // Show Cursor @@ -696,6 +707,22 @@ void RivenGraphics::drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect _dirtyScreen = true; } +void RivenGraphics::drawExtrasImage(uint16 id, Common::Rect dstRect) { + ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, id)); + Graphics::Surface *surface = imageData->getSurface(); + delete imageData; + + assert(dstRect.width() == surface->w); + + for (uint16 i = 0; i < surface->h; i++) + memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(0, i), surface->pitch); + + surface->free(); + delete surface; + + _dirtyScreen = true; +} + LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm) : _vm(vm) { _bmpDecoder = (_vm->getGameType() == GType_LIVINGBOOKSV1) ? new OldMohawkBitmap() : new MohawkBitmap(); _palette = new byte[256 * 4]; |