[Scummvm-cvs-logs] SF.net SVN: scummvm: [27568] scummvm/trunk/engines/agi

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Thu Jun 21 01:12:38 CEST 2007


Revision: 27568
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27568&view=rev
Author:   buddha_
Date:     2007-06-20 16:12:38 -0700 (Wed, 20 Jun 2007)

Log Message:
-----------
Add AGI256 picture resource decoding support to PictureMgr::decodePicture.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/picture.cpp
    scummvm/trunk/engines/agi/picture.h

Modified: scummvm/trunk/engines/agi/picture.cpp
===================================================================
--- scummvm/trunk/engines/agi/picture.cpp	2007-06-20 23:10:30 UTC (rev 27567)
+++ scummvm/trunk/engines/agi/picture.cpp	2007-06-20 23:12:38 UTC (rev 27568)
@@ -619,8 +619,9 @@
  * drawing.
  * @param n      AGI picture resource number
  * @param clear  clear AGI screen before drawing
+ * @param agi256 load an AGI256 picture resource
  */
-int PictureMgr::decodePicture(int n, int clear) {
+int PictureMgr::decodePicture(int n, int clear, bool agi256) {
 	debugC(8, kDebugLevelResources, "(%d)", n);
 
 	patCode = 0;
@@ -633,11 +634,22 @@
 	flen = _vm->_game.dirPic[n].len;
 	foffs = 0;
 
-	if (clear)
-		memset(_vm->_game.sbuf, 0x4f, _WIDTH * _HEIGHT);
+	if (clear && !agi256) // 256 color pictures should always fill the whole screen, so no clearing for them.
+		memset(_vm->_game.sbuf16c, 0x4f, _WIDTH * _HEIGHT); // Clear 16 color AGI screen (Priority 4, color white).
 
-	drawPicture();
+	if (!agi256) {
+		drawPicture(); // Draw 16 color picture.
+	} else {
+		const uint32 maxFlen = _WIDTH * _HEIGHT;
+		memcpy(_vm->_game.sbuf256c, data, MIN(flen, maxFlen)); // Draw 256 color picture.
 
+		if (flen < maxFlen) {
+			warning("Undersized AGI256 picture resource %d, using it anyway. Filling rest with white.", n);
+			memset(_vm->_game.sbuf256c + flen, 0x0f, maxFlen - flen); // Fill missing area with white.
+		} else if (flen > maxFlen)
+			warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, _WIDTH, _HEIGHT);
+	}
+
 	if (clear)
 		_vm->clearImageStack();
 	_vm->recordImageStackCall(ADD_PIC, n, clear, 0, 0, 0, 0, 0);

Modified: scummvm/trunk/engines/agi/picture.h
===================================================================
--- scummvm/trunk/engines/agi/picture.h	2007-06-20 23:10:30 UTC (rev 27567)
+++ scummvm/trunk/engines/agi/picture.h	2007-06-20 23:12:38 UTC (rev 27568)
@@ -68,7 +68,7 @@
 		_gfx = gfx;
 	}
 
-	int decodePicture(int, int);
+	int decodePicture(int n, int clear, bool agi256 = false);
 	int unloadPicture(int);
 	void showPic();
 	uint8 *convertV3Pic(uint8 *src, uint32 len);


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