[Scummvm-cvs-logs] SF.net SVN: scummvm:[52215] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Thu Aug 19 19:33:10 CEST 2010


Revision: 52215
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52215&view=rev
Author:   mthreepwood
Date:     2010-08-19 17:33:10 +0000 (Thu, 19 Aug 2010)

Log Message:
-----------
MOHAWK: Draw in the telescope combination in Catherine's journal

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/graphics.cpp
    scummvm/trunk/engines/mohawk/graphics.h
    scummvm/trunk/engines/mohawk/riven_external.cpp

Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp	2010-08-19 16:21:31 UTC (rev 52214)
+++ scummvm/trunk/engines/mohawk/graphics.cpp	2010-08-19 17:33:10 UTC (rev 52215)
@@ -672,6 +672,21 @@
 	_vm->_system->unlockScreen();
 }
 
+void RivenGraphics::drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect) {
+	// Draw tBMP id from srcRect to dstRect
+	ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getRawData(ID_TBMP, id));
+	Graphics::Surface *surface = imageData->getSurface();
+	delete imageData;
+
+	assert(srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height());
+
+	for (uint16 i = 0; i < srcRect.height(); i++)
+		memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(srcRect.left, i + srcRect.top), srcRect.width() * surface->bytesPerPixel);
+
+	surface->free();
+	delete surface;
+}
+
 LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm) : _vm(vm) {
 	_bmpDecoder = (_vm->getGameType() == GType_LIVINGBOOKSV1) ? new OldMohawkBitmap() : new MohawkBitmap();
 	_palette = new byte[256 * 4];
@@ -707,7 +722,7 @@
 }
 
 void LBGraphics::setPalette(uint16 id) {
-	// Old Living Books gamnes use the old CTBL-style palette format while newer
+	// Old Living Books games use the old CTBL-style palette format while newer
 	// games use the better tPAL format which can store partial palettes.
 
 	if (_vm->getGameType() == GType_LIVINGBOOKSV1) {

Modified: scummvm/trunk/engines/mohawk/graphics.h
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.h	2010-08-19 16:21:31 UTC (rev 52214)
+++ scummvm/trunk/engines/mohawk/graphics.h	2010-08-19 17:33:10 UTC (rev 52215)
@@ -117,7 +117,7 @@
 			uint16 type;
 			uint16 width;
 			uint16 height;
-			} *entries;
+		} *entries;
 
 		Common::File picFile;
 	} _pictureFile;
@@ -147,6 +147,7 @@
 	Common::Array<uint16> _activatedPLSTs;
 	void drawPLST(uint16 x);
 	void drawRect(Common::Rect rect, bool active);
+	void drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect);
 
 	// Water Effect
 	void scheduleWaterEffect(uint16);
@@ -181,7 +182,6 @@
 	Graphics::Surface *_mainScreen;
 	bool _dirtyScreen;
 	Graphics::PixelFormat _pixelFormat;
-	byte findBlackIndex();
 };
 
 class LBGraphics {

Modified: scummvm/trunk/engines/mohawk/riven_external.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_external.cpp	2010-08-19 16:21:31 UTC (rev 52214)
+++ scummvm/trunk/engines/mohawk/riven_external.cpp	2010-08-19 17:33:10 UTC (rev 52215)
@@ -340,7 +340,21 @@
 		_vm->_gfx->drawPLST(51);
 
 	if (page == 28) {
-		// TODO: Draw telescope combination
+		// Draw the telescope combination
+		// The images for the numbers are tBMP's 13 through 17.
+		// The start point is at (156, 247)
+		uint32 teleCombo = *_vm->matchVarToString("tcorrectorder");
+		static const uint16 kNumberWidth = 32;
+		static const uint16 kNumberHeight = 25;
+		static const uint16 kDstX = 156;
+		static const uint16 kDstY = 247;
+
+		for (byte i = 0; i < 5; i++) {
+			uint16 offset = (getComboDigit(teleCombo, i) - 1) * kNumberWidth;
+			Common::Rect srcRect = Common::Rect(offset, 0, offset + kNumberWidth, kNumberHeight);
+			Common::Rect dstRect = Common::Rect(i * kNumberWidth + kDstX, kDstY, (i + 1) * kNumberWidth + kDstX, kDstY + kNumberHeight);
+			_vm->_gfx->drawImageRect(i + 13, srcRect, dstRect);
+		}
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list