[Scummvm-cvs-logs] SF.net SVN: scummvm: [24728] scummvm/trunk/engines/touche

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sat Nov 18 02:20:42 CET 2006


Revision: 24728
          http://svn.sourceforge.net/scummvm/?rev=24728&view=rev
Author:   cyx
Date:     2006-11-17 17:20:41 -0800 (Fri, 17 Nov 2006)

Log Message:
-----------
fixed palette glitches during introduction/on restart, cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/touche/opcodes.cpp
    scummvm/trunk/engines/touche/resource.cpp
    scummvm/trunk/engines/touche/touche.cpp
    scummvm/trunk/engines/touche/touche.h

Modified: scummvm/trunk/engines/touche/opcodes.cpp
===================================================================
--- scummvm/trunk/engines/touche/opcodes.cpp	2006-11-16 21:20:24 UTC (rev 24727)
+++ scummvm/trunk/engines/touche/opcodes.cpp	2006-11-18 01:20:41 UTC (rev 24728)
@@ -414,7 +414,8 @@
 	case 618:
 		showCursor(val == 0);
 		break;
-	default:
+	case 619:
+		debug(0, "Unknown music flag %d", val);
 		break;
 	}
 }
@@ -468,32 +469,6 @@
 void ToucheEngine::op_loadRoom() {
 	debugC(9, kDebugOpcodes, "ToucheEngine::op_loadRoom()");
 	int16 num = _script.readNextWord();
-	if (_currentEpisodeNum == 27 && num == 34 && _currentRoomNum != 58) {
-		//
-		// Workaround to what appears to be a scripting bug. The script
-		// 27 triggers a palette fading just after loading the room 34.
-		// Set flag 115, so that only *one* palette refresh occurs.
-		//
-		//  [0086] (13) ST[0] = 1
-		//  [0089] (1E) FLAGS[606] = ST[0]
-		//  [008C] (34) LOAD_ROOM(34)
-		//  [xxxx] ...
-		//  [00B4] (84) START_PALETTE_FADE_IN(20)
-		//
-		_flagsTable[115] = 1;
-	}
-	if (_currentEpisodeNum == 100 && num == 1 && _currentRoomNum == 2) {
-		//
-		// Same problem in script 100...
-		//
-		//  [021F] (34) LOAD_ROOM(1)
-		//  [xxxx] ...
-		//  [023D] (13) ST[0] = 1
-		//  [0240] (1E) FLAGS[604] = ST[0]
-		//  [0243] (84) START_PALETTE_FADE_IN(2)
-		//
-		_flagsTable[115] = 1;
-	}
 	res_loadRoom(num);
 }
 
@@ -740,7 +715,7 @@
 }
 
 void ToucheEngine::op_updateRoomAreas() {
-	debugC(9, kDebugOpcodes, "ToucheEngine::op_setupWaitingKeyChars()");
+	debugC(9, kDebugOpcodes, "ToucheEngine::op_updateRoomAreas()");
 	int16 area = _script.readNextWord();
 	updateRoomAreas(area, 1);
 }

Modified: scummvm/trunk/engines/touche/resource.cpp
===================================================================
--- scummvm/trunk/engines/touche/resource.cpp	2006-11-16 21:20:24 UTC (rev 24727)
+++ scummvm/trunk/engines/touche/resource.cpp	2006-11-18 01:20:41 UTC (rev 24728)
@@ -409,6 +409,8 @@
 	_currentRoomNum = num;
 	_updatedRoomAreasTable[0] = 1;
 
+	debug(0, "Setting up room %d", num);
+
 	const uint32 offsInfo = res_getDataOffset(kResourceTypeRoomInfo, num);
 	_fData.seek(offsInfo);
 	_fData.skip(2);
@@ -423,9 +425,21 @@
 	_fData.seek(offsImage);
 	res_loadBackdrop();
 
-	if (_flagsTable[115] == 0) {
+	bool updateScreenPalette = _flagsTable[115] == 0;
+
+	// Workaround to what appears to be a scripting bug. Scripts 27 and 100 triggers
+	// a palette fading just after loading a room. Catch this, so that only *one*
+	// palette refresh occurs.
+	if ((_currentEpisodeNum == 27 && num == 34) || (_currentEpisodeNum == 100 && num == 1)) {
+		updateScreenPalette = false;
+	}
+
+	if (updateScreenPalette) {
 		updatePalette();
+	} else {
+		setPalette(0, 255, 0, 0, 0);
 	}
+
 	_fullRedrawCounter = 1;
 	_roomNeedRedraw = true;
 

Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp	2006-11-16 21:20:24 UTC (rev 24727)
+++ scummvm/trunk/engines/touche/touche.cpp	2006-11-18 01:20:41 UTC (rev 24728)
@@ -41,10 +41,11 @@
 
 	_screenRect = Common::Rect(640, 400);
 	_roomAreaRect = Common::Rect(640, 352);
-	clearDirtyRects();
 
 	memset(_flagsTable, 0, sizeof(_flagsTable));
 
+	clearDirtyRects();
+
 	_playSoundCounter = 0;
 
 	_processRandomPaletteCounter = 0;
@@ -114,6 +115,8 @@
 
 	memset(_flagsTable, 0, sizeof(_flagsTable));
 
+	clearDirtyRects();
+
 	_currentKeyCharNum = 0;
 	initKeyChars(-1);
 
@@ -183,6 +186,7 @@
 	memset(_conversationChoicesTable, 0, sizeof(_conversationChoicesTable));
 
 	_flagsTable[901] = 1;
+//	_flagsTable[902] = 1;
 	if (_language == Common::FR_FRA) {
 		_flagsTable[621] = 1;
 	}
@@ -1660,14 +1664,14 @@
 			}
 		}
 	} else {
-		if (flag) {
+		if (flag == 0) {
 			drawHitBoxes();
 		}
 	}
 }
 
 void ToucheEngine::handleMouseClickOnInventory(int flag) {
-	if (flag) {
+	if (flag == 0) {
 		drawHitBoxes();
 	}
 	if (_hideInventoryTexts && _giveItemToCounter == 0) {
@@ -1873,7 +1877,6 @@
 	debugC(9, kDebugEngine, "ToucheEngine::addRoomArea(%d, %d)", num, flag);
 	if (_flagsTable[flag] == 20000) {
 		Area area = _programBackgroundTable[num].area;
-		addToDirtyRect(area.r);
 		area.r.translate(-_flagsTable[614], -_flagsTable[615]);
 		addToDirtyRect(area.r);
 	}
@@ -1899,9 +1902,10 @@
 			  area.r.width(), area.r.height(),
 			  Graphics::kTransparent);
 			if (flags != 0) {
-				addToDirtyRect(area.r);
-				area.r.translate(-_flagsTable[614], -_flagsTable[615]);
-				addToDirtyRect(area.r);
+				debug(0, "updateRoomAreas(num=%d index=%d)", num, i);
+				redrawRoomRegion(i, true);
+//				area.r.translate(-_flagsTable[614], -_flagsTable[615]);
+//				addToDirtyRect(area.r);
 			}
 		}
 	}
@@ -1920,7 +1924,7 @@
 	debugC(9, kDebugEngine, "ToucheEngine::findAndRedrawRoomRegion(%d)", num);
 	for (uint i = 0; i < _programAreaTable.size(); ++i) {
 		if (_programAreaTable[i].id == num) {
-			redrawRoomRegion(i, 0);
+			redrawRoomRegion(i, false);
 			break;
 		}
 	}
@@ -3201,7 +3205,7 @@
 			if (index != -1) {
 				_dirtyRectsTable[index].extend(dirtyRect);
 			} else if (_dirtyRectsTableCount == NUM_DIRTY_RECTS) {
-				// trigger full screen redraw
+				debug(0, "Too many dirty rects, performing full screen update");
 				_fullRedrawCounter = 1;
 			} else {
 				_dirtyRectsTable[_dirtyRectsTableCount] = dirtyRect;
@@ -3256,11 +3260,7 @@
 		for (int i = 0; i < _dirtyRectsTableCount; ++i) {
 			const Common::Rect &r = _dirtyRectsTable[i];
 #if 0
-			const int pts[4] = { r.left, r.top, r.right - 1, r.bottom - 1 };
-			Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[1], pts[2], pts[1], 0xFF);
-			Graphics::drawLine(_offscreenBuffer, 640, pts[2], pts[1], pts[2], pts[3], 0xFF);
-			Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[3], pts[2], pts[3], 0xFF);
-			Graphics::drawLine(_offscreenBuffer, 640, pts[0], pts[1], pts[0], pts[3], 0xFF);
+			Graphics::drawRect(_offscreenBuffer, 640, r.left, r.top, r.width(), r.height(), 0xFF, 0xFF);
 #endif
 			_system->copyRectToScreen(_offscreenBuffer + r.top * 640 + r.left, 640, r.left, r.top, r.width(), r.height());
 		}

Modified: scummvm/trunk/engines/touche/touche.h
===================================================================
--- scummvm/trunk/engines/touche/touche.h	2006-11-16 21:20:24 UTC (rev 24727)
+++ scummvm/trunk/engines/touche/touche.h	2006-11-18 01:20:41 UTC (rev 24728)
@@ -321,7 +321,6 @@
 	enum {
 		NUM_FLAGS = 2000,
 		NUM_KEYCHARS = 32,
-		NUM_AREAS = 10,
 		NUM_SPRITES = 7,
 		NUM_SEQUENCES = 7,
 		NUM_CONVERSATION_CHOICES = 40,


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