[Scummvm-cvs-logs] SF.net SVN: scummvm: [21849] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Apr 13 14:53:00 CEST 2006


Revision: 21849
Author:   drmccoy
Date:     2006-04-13 14:52:23 -0700 (Thu, 13 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21849&view=rev

Log Message:
-----------
Fixed the invalid reads visible with valgrind, deleted the
printText-dup, it's wrong for Gob2 anyway...

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/global.cpp
    scummvm/trunk/engines/gob/mult_v2.cpp
Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2006-04-13 21:09:39 UTC (rev 21848)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2006-04-13 21:52:23 UTC (rev 21849)
@@ -57,162 +57,7 @@
 
 	_vm->_cdrom->playMultMusic();
 
-	dataPtr = (char *)_vm->_game->_totTextData + _vm->_game->_totTextData->items[index].offset;
-	ptr = dataPtr;
-
-	if (_renderFlags & RENDERFLAG_CAPTUREPUSH) {
-		_destSpriteX = READ_LE_UINT16(ptr);
-		_destSpriteY = READ_LE_UINT16(ptr + 2);
-		_spriteRight = READ_LE_UINT16(ptr + 4) - _destSpriteX + 1;
-		_spriteBottom = READ_LE_UINT16(ptr + 6) - _destSpriteY + 1;
-		_vm->_game->capturePush(_destSpriteX, _destSpriteY,
-						 _spriteRight, _spriteBottom);
-		(*_vm->_scenery->_pCaptureCounter)++;
-	}
-	_destSpriteX = READ_LE_UINT16(ptr);
-	destX = _destSpriteX;
-
-	_destSpriteY = READ_LE_UINT16(ptr + 2);
-	destY = _destSpriteY;
-
-	_spriteRight = READ_LE_UINT16(ptr + 4);
-	_spriteBottom = READ_LE_UINT16(ptr + 6);
-	_destSurface = 21;
-
-	ptr += 8;
-
-	_backColor = *ptr++;
-	_transparency = 1;
-//	spriteOperation(DRAW_CLEARRECT);
-
-	_backColor = 0;
-	savedFlags = _renderFlags;
-
-	_renderFlags &= ~RENDERFLAG_NOINVALIDATE;
-	for (; (_destSpriteX = READ_LE_UINT16(ptr)) != -1; ptr++) {
-		_destSpriteX += destX;
-		_destSpriteY = READ_LE_UINT16(ptr + 2) + destY;
-		_spriteRight = READ_LE_UINT16(ptr + 4) + destX;
-		_spriteBottom = READ_LE_UINT16(ptr + 6) + destY;
-		ptr += 8;
-
-		cmd = (*ptr & 0xf0) >> 4;
-		if (cmd == 0) {
-			_frontColor = *ptr & 0xf;
-//			spriteOperation(DRAW_DRAWLINE);
-		} else if (cmd == 1) {
-			_frontColor = *ptr & 0xf;
-//			spriteOperation(DRAW_DRAWBAR);
-		} else if (cmd == 2) {
-			_backColor = *ptr & 0xf;
-//			spriteOperation(DRAW_FILLRECTABS);
-		}
-	}
-	ptr += 2;
-
-	for (ptr2 = ptr; *ptr2 != 1; ptr2++) {
-		if (*ptr2 == 3)
-			ptr2++;
-
-		if (*ptr2 == 2)
-			ptr2 += 4;
-	}
-
-	ptr2++;
-
-	while (*ptr != 1) {
-		cmd = *ptr;
-		if (cmd == 3) {
-			ptr++;
-			_fontIndex = (*ptr & 0xf0) >> 4;
-			_frontColor = *ptr & 0xf;
-			ptr++;
-			continue;
-		} else if (cmd == 2) {
-			ptr++;
-			_destSpriteX = destX + READ_LE_UINT16(ptr);
-			_destSpriteY = destY + READ_LE_UINT16(ptr + 2);
-			ptr += 4;
-			continue;
-		}
-
-		if ((byte)*ptr != 0xba) {
-			_letterToPrint = *ptr;
-//			spriteOperation(DRAW_DRAWLETTER);
-//			_destSpriteX +=
-//			    _fonts[_fontIndex]->itemWidth;
-			ptr++;
-		} else {
-			cmd = ptr2[17] & 0x7f;
-			if (cmd == 0) {
-				val = READ_LE_UINT16(ptr2 + 18) * 4;
-				sprintf(buf, "%d",  VAR_OFFSET(val));
-			} else if (cmd == 1) {
-				val = READ_LE_UINT16(ptr2 + 18) * 4;
-
-				strcpy(buf, _vm->_global->_inter_variables + val);
-			} else {
-				val = READ_LE_UINT16(ptr2 + 18) * 4;
-
-				sprintf(buf, "%d",  VAR_OFFSET(val));
-				if (buf[0] == '-') {
-					while (strlen(buf) - 1 < (uint32)ptr2[17]) {
-						_vm->_util->insertStr("0", buf, 1);
-					}
-				} else {
-					while (strlen(buf) - 1 < (uint32)ptr2[17]) {
-						_vm->_util->insertStr("0", buf, 0);
-					}
-				}
-
-				_vm->_util->insertStr(",", buf, strlen(buf) + 1 - ptr2[17]);
-			}
-
-			_textToPrint = buf;
-			ldestSpriteX = _destSpriteX;
-//			spriteOperation(DRAW_PRINTTEXT);
-			if (ptr2[17] & 0x80) {
-				if (ptr[1] == ' ') {
-//					_destSpriteX += _fonts[_fontIndex]->itemWidth;
-					while (ptr[1] == ' ')
-						ptr++;
-					if (ptr[1] == 2) {
-						if (READ_LE_UINT16(ptr + 4) == _destSpriteY)
-							ptr += 5;
-					}
-				} else if (ptr[1] == 2 && READ_LE_UINT16(ptr + 4) == _destSpriteY) {
-					ptr += 5;
-//					_destSpriteX += _fonts[_fontIndex]->itemWidth;
-				}
-//			} else {
-//				_destSpriteX = ldestSpriteX + _fonts[_fontIndex]->itemWidth;
-			}
-			ptr2 += 23;
-			ptr++;
-		}
-	}
-
-	_renderFlags = savedFlags;
-	if (_renderFlags & 4) {
-		warning("printText: Input not supported");
-//              xor     ax, ax
-//              loc_436_1391:
-//              xor     dx, dx
-//              push    ax
-//              push    dx
-//              push    ax
-//              push    dx
-//              push    ax
-//              mov     al, 0
-//              push    ax
-//              call    sub_9FF_1E71
-//              add     sp, 0Ch
-	}
-
-	if ((_renderFlags & RENDERFLAG_CAPTUREPOP) && *_vm->_scenery->_pCaptureCounter != 0) {
-		(*_vm->_scenery->_pCaptureCounter)--;
-		_vm->_game->capturePop(1);
-	}
+	return;
 }
 
 void Draw_v2::spriteOperation(int16 operation) {

Modified: scummvm/trunk/engines/gob/global.cpp
===================================================================
--- scummvm/trunk/engines/gob/global.cpp	2006-04-13 21:09:39 UTC (rev 21848)
+++ scummvm/trunk/engines/gob/global.cpp	2006-04-13 21:52:23 UTC (rev 21849)
@@ -147,6 +147,9 @@
 
 	_inter_mouseX = 0;
 	_inter_mouseY = 0;
+
+	for (i = 0; i < 128; i++)
+		_pressedKeys[i] = 0;
 }
 
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2006-04-13 21:09:39 UTC (rev 21848)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2006-04-13 21:52:23 UTC (rev 21849)
@@ -196,8 +196,8 @@
 		_multData2->sndKeys[i].freq = (int16)READ_LE_UINT16(_dataPtr + 4);
 		_multData2->sndKeys[i].channel = (int16)READ_LE_UINT16(_dataPtr + 6);
 		_multData2->sndKeys[i].repCount = (int16)READ_LE_UINT16(_dataPtr + 8);
-		_multData2->sndKeys[i].resId = (int16)READ_LE_UINT16(_dataPtr + 10);
-		_multData2->sndKeys[i].soundIndex = (int16)READ_LE_UINT16(_dataPtr + 12);
+/*		_multData2->sndKeys[i].resId = (int16)READ_LE_UINT16(_dataPtr + 10);
+		_multData2->sndKeys[i].soundIndex = (int16)READ_LE_UINT16(_dataPtr + 12);*/
 
 		_multData2->sndKeys[i].soundIndex = -1;
 		_multData2->sndKeys[i].resId = -1;


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