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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Sep 2 15:23:07 CEST 2007


Revision: 28819
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28819&view=rev
Author:   thebluegr
Date:     2007-09-02 06:23:07 -0700 (Sun, 02 Sep 2007)

Log Message:
-----------
The dimensions of the picture resources in preagi games is different for each game. Mickey's pictures are shown correctly now

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

Modified: scummvm/trunk/engines/agi/picture.cpp
===================================================================
--- scummvm/trunk/engines/agi/picture.cpp	2007-09-02 12:56:55 UTC (rev 28818)
+++ scummvm/trunk/engines/agi/picture.cpp	2007-09-02 13:23:07 UTC (rev 28819)
@@ -84,7 +84,7 @@
 void PictureMgr::putVirtPixel(int x, int y) {
 	uint8 *p;
 
-	if (x < 0 || y < 0 || x >= width || y >= _HEIGHT)
+	if (x < 0 || y < 0 || x >= width || y >= height)
 		return;
 
 	p = &_vm->_game.sbuf16c[y * width + x];
@@ -133,8 +133,8 @@
 #define clip(x, y) if((x)>=(y)) (x)=(y)
 	clip(x1, width - 1);
 	clip(x2, width - 1);
-	clip(y1, _HEIGHT - 1);
-	clip(y2, _HEIGHT - 1);
+	clip(y1, height - 1);
+	clip(y2, height - 1);
 
 	/* Vertical line */
 
@@ -276,7 +276,7 @@
 INLINE int PictureMgr::isOkFillHere(int x, int y) {
 	uint8 p;
 
-	if (x < 0 || x >= width || y < 0 || y >= _HEIGHT)
+	if (x < 0 || x >= width || y < 0 || y >= height)
 		return false;
 
 	if (!scrOn && !priOn)
@@ -714,7 +714,7 @@
  * @param clear  clear AGI screen before drawing
  * @param agi256 load an AGI256 picture resource
  */
-int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width) {
+int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width, int pic_height) {
 	debugC(8, kDebugLevelResources, "(%d)", n);
 
 	patCode = 0;
@@ -728,21 +728,22 @@
 	foffs = 0;
 
 	width = pic_width;
+	height = pic_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).
+		memset(_vm->_game.sbuf16c, 0x4f, width * height); // Clear 16 color AGI screen (Priority 4, color white).
 
 	if (!agi256) {
 		drawPicture(); // Draw 16 color picture.
 	} else {
-		const uint32 maxFlen = width * _HEIGHT;
+		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);
+			warning("Oversized AGI256 picture resource %d, decoding only %ux%u part of it", n, width, height);
 	}
 
 	if (clear)
@@ -772,16 +773,17 @@
  * Show AGI picture.
  * This function copies a ``hidden'' AGI picture to the output device.
  */
-void PictureMgr::showPic(int x, int pic_width) {
+void PictureMgr::showPic(int x, int pic_width, int pic_height) {
 	int i, y;
 	int offset;
 	width = pic_width;
+	height = pic_height;
 
 	debugC(8, kDebugLevelMain, "Show picture!");
 
 	i = 0;
 	offset = _vm->_game.lineMinPrint * CHAR_LINES;
-	for (y = 0; y < _HEIGHT; y++) {
+	for (y = 0; y < height; y++) {
 		_gfx->putPixelsA(x, y + offset, width, &_vm->_game.sbuf16c[i]);
 		i += width;
 	}

Modified: scummvm/trunk/engines/agi/picture.h
===================================================================
--- scummvm/trunk/engines/agi/picture.h	2007-09-02 12:56:55 UTC (rev 28818)
+++ scummvm/trunk/engines/agi/picture.h	2007-09-02 13:23:07 UTC (rev 28819)
@@ -31,6 +31,7 @@
 namespace Agi {
 
 #define _DEFAULT_WIDTH		160
+#define _DEFAULT_HEIGHT		168
 
 /**
  * AGI picture resource.
@@ -74,7 +75,7 @@
 
 	// TODO: this is hardcoded for V2 pictures for now
 	static const int pictureType = AGIPIC_V2;
-	int width;
+	int width, height;
 
 public:
 	PictureMgr(AgiBase *agi, GfxMgr *gfx) {
@@ -82,9 +83,9 @@
 		_gfx = gfx;
 	}
 
-	int decodePicture(int n, int clear, bool agi256 = false, int pic_width = _DEFAULT_WIDTH);
+	int decodePicture(int n, int clear, bool agi256 = false, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT);
 	int unloadPicture(int);
-	void showPic(int x = 0, int pic_width = _DEFAULT_WIDTH);
+	void showPic(int x = 0, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT);
 	uint8 *convertV3Pic(uint8 *src, uint32 len);
 };
 

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-02 12:56:55 UTC (rev 28818)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-02 13:23:07 UTC (rev 28819)
@@ -620,7 +620,7 @@
 
 void Mickey::drawPic(int iPic) {
 	_vm->preAgiLoadResource(rPICTURE, iPic);
-	_vm->_picture->decodePicture(iPic, true, false, _WIDTH - 20);
+	_vm->_picture->decodePicture(iPic, true, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
 	_vm->_picture->showPic(10, _WIDTH - 20);
 	_vm->_gfx->doUpdate();
 	_vm->_system->updateScreen();	// TODO: this should go in the game's main loop


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