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

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Nov 12 04:02:28 CET 2006


Revision: 24683
          http://svn.sourceforge.net/scummvm/?rev=24683&view=rev
Author:   cyx
Date:     2006-11-11 19:02:20 -0800 (Sat, 11 Nov 2006)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/touche/graphics.cpp
    scummvm/trunk/engines/touche/graphics.h
    scummvm/trunk/engines/touche/touche.cpp
    scummvm/trunk/engines/touche/touche.h
    scummvm/trunk/engines/touche/ui.cpp

Modified: scummvm/trunk/engines/touche/graphics.cpp
===================================================================
--- scummvm/trunk/engines/touche/graphics.cpp	2006-11-12 02:34:09 UTC (rev 24682)
+++ scummvm/trunk/engines/touche/graphics.cpp	2006-11-12 03:02:20 UTC (rev 24683)
@@ -152,21 +152,12 @@
 
 void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, int flags) {
 	if (w != 0 && h != 0) {
-		if (flags & kHFlipped) {
-			srcY += h - 1;
-			srcPitch = -srcPitch;
-		}
-		int u = 1;
-		if (flags & kVFlipped) {
-			srcX += w - 1;
-			u = -1;
-		}
 		dst += dstY * dstPitch + dstX;
 		src += srcY * srcPitch + srcX;
 		while (h--) {
 			for (int i = 0; i < w; ++i) {
-				if ((flags & kTransparent) == 0 || src[u * i] != 0) {
-					dst[i] = src[u * i];
+				if ((flags & kTransparent) == 0 || src[i] != 0) {
+					dst[i] = src[i];
 				}
 			}
 			dst += dstPitch;
@@ -176,16 +167,18 @@
 }
 
 void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) {
-	dst += dstY * dstPitch + dstX;
-	src += srcY * srcPitch + srcX;
-	while (h--) {
-		for (int i = 0; i < w; ++i) {
-			if (src[i] != 0) {
-				dst[i] = fillColor;
+	if (w != 0 && h != 0) {
+		dst += dstY * dstPitch + dstX;
+		src += srcY * srcPitch + srcX;
+		while (h--) {
+			for (int i = 0; i < w; ++i) {
+				if (src[i] != 0) {
+					dst[i] = fillColor;
+				}
 			}
+			dst += dstPitch;
+			src += srcPitch;
 		}
-		dst += dstPitch;
-		src += srcPitch;
 	}
 }
 

Modified: scummvm/trunk/engines/touche/graphics.h
===================================================================
--- scummvm/trunk/engines/touche/graphics.h	2006-11-12 02:34:09 UTC (rev 24682)
+++ scummvm/trunk/engines/touche/graphics.h	2006-11-12 03:02:20 UTC (rev 24683)
@@ -28,10 +28,9 @@
 namespace Touche {
 
 struct Graphics {
+
 	enum {
-		kVFlipped    = 1 << 0,
-		kHFlipped    = 1 << 1,
-		kTransparent = 1 << 2
+		kTransparent = 1 << 0
 	};
 
 	static int getStringWidth16(const char *str);

Modified: scummvm/trunk/engines/touche/touche.cpp
===================================================================
--- scummvm/trunk/engines/touche/touche.cpp	2006-11-12 02:34:09 UTC (rev 24682)
+++ scummvm/trunk/engines/touche/touche.cpp	2006-11-12 03:02:20 UTC (rev 24683)
@@ -1244,10 +1244,10 @@
 	return Graphics::getStringWidth16(str);
 }
 
-void ToucheEngine::drawString(uint8 *dst, int dstPitch, uint16 color, int x, int y, int16 num) {
+void ToucheEngine::drawString(uint16 color, int x, int y, int16 num) {
 	if (num) {
 		const char *str = getString(num);
-		Graphics::drawString16(dst, dstPitch, color, x, y, str);
+		Graphics::drawString16(_offscreenBuffer, 640, color, x, y, str);
 	}
 }
 
@@ -1810,9 +1810,9 @@
 		if (actionsTable[i] == 0) {
 			break;
 		}
-		drawString(_offscreenBuffer, 640, 0xF8F9, offs, y + i * 16, actionsTable[i]);
+		drawString(0xF8F9, offs, y + i * 16, actionsTable[i]);
 	}
-	updateScreenArea(_offscreenBuffer, 640, cursorPosX, cursorPosY, cursorPosX, cursorPosY, cursorW, cursorH);
+	updateScreenArea(cursorPosX, cursorPosY, cursorW, cursorH);
 
 	_redrawScreenCounter1 = 2;
 	Common::Rect rect(0, y, 640, y + h);
@@ -1823,18 +1823,18 @@
 			if (c != i) {
 				if (i >= 0) {
 					drawY = y + i * 16;
-					drawString(_offscreenBuffer, 640, 0xF8F9, offs, drawY, actionsTable[i]);
-					updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+					drawString(0xF8F9, offs, drawY, actionsTable[i]);
+					updateScreenArea(offs, drawY, strW, 16);
 				}
 				i = c;
 				drawY = y + i * 16;
-				drawString(_offscreenBuffer, 640, 0xF8FF, offs, drawY, actionsTable[i]);
-				updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+				drawString(0xF8FF, offs, drawY, actionsTable[i]);
+				updateScreenArea(offs, drawY, strW, 16);
 			}
 		} else if (i >= 0) {
 			drawY = y + i * 16;
-			drawString(_offscreenBuffer, 640, 0xF8F9, offs, drawY, actionsTable[i]);
-			updateScreenArea(_offscreenBuffer, 640, offs, drawY, offs, drawY, strW, 16);
+			drawString(0xF8F9, offs, drawY, actionsTable[i]);
+			updateScreenArea(offs, drawY, strW, 16);
 			i = -1;
 		}
 		processEvents(false);
@@ -2064,7 +2064,7 @@
 			}
 		}
 		drawAmountOfMoneyInInventory();
-		updateScreenArea(_offscreenBuffer, 640, 0, 352, 0, 352, 640, 48);
+		updateScreenArea(0, 352, 640, 48);
 	}
 }
 
@@ -2074,14 +2074,14 @@
 		sprintf(text, "%d", _keyCharsTable[0].money);
 		Graphics::fillRect(_offscreenBuffer, 640, 74, 354, 40, 16, 0xD2);
 		drawGameString(217, 94, 355, text);
-		updateScreenArea(_offscreenBuffer, 640, 74, 354, 74, 354, 40, 16);
+		updateScreenArea(74, 354, 40, 16);
 		Graphics::fillRect(_offscreenBuffer, 640, 150, 353, 40, 41, 0xD2);
 		if (_currentAmountOfMoney != 0) {
 			drawIcon(141, 348, 1);
 			sprintf(text, "%d", _currentAmountOfMoney);
 			drawGameString(217, 170, 378, text);
 		}
-		updateScreenArea(_offscreenBuffer, 640, 150, 353, 150, 353, 40, 41);
+		updateScreenArea(150, 353, 40, 41);
 	}
 }
 
@@ -2432,21 +2432,21 @@
 	}
 	drawConversationPanel();
 	for (int i = 0; i < 4; ++i) {
-		drawString(_offscreenBuffer, 640, 214, 42, 328 + i * 16, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg);
+		drawString(214, 42, 328 + i * 16, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg);
 	}
-	updateScreenArea(_offscreenBuffer, 640, 0, 320, 0, 320, 640, 80);
+	updateScreenArea(0, 320, 640, 80);
 	_conversationAreaCleared = false;
 }
 
 void ToucheEngine::drawConversationString(int num, uint16 color) {
 	const int y = 328 + num * 16;
-	drawString(_offscreenBuffer, 640, color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg);
-	updateScreenArea(_offscreenBuffer, 640, 0, y, 0, y, 640, 16);
+	drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg);
+	updateScreenArea(0, y, 640, 16);
 }
 
 void ToucheEngine::clearConversationArea() {
 	drawConversationPanel();
-	updateScreenArea(_offscreenBuffer, 640, 0, 320, 0, 320, 640, 80);
+	updateScreenArea(0, 320, 640, 80);
 	_conversationAreaCleared = true;
 }
 
@@ -3230,8 +3230,8 @@
 	_system->setPalette(&pal[firstColor * 4], firstColor, colorCount);
 }
 
-void ToucheEngine::updateScreenArea(const uint8 *src, int srcPitch, int srcX, int srcY, int dstX, int dstY, int w, int h) {
-	_system->copyRectToScreen(src + srcY * srcPitch + srcX, srcPitch, dstX, dstY, w, h);
+void ToucheEngine::updateScreenArea(int x, int y, int w, int h) {
+	_system->copyRectToScreen(_offscreenBuffer + y * 640 + x, 640, x, y, w, h);
 	_system->updateScreen();
 }
 
@@ -3243,18 +3243,18 @@
 
 void ToucheEngine::updateDirtyScreenAreas() {
 	// XXX
-	updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 400);
+	updateScreenArea(0, 0, 640, 400);
 	if (_fullRedrawCounter) {
 //		updateEntireScreen();
 		--_fullRedrawCounter;
 	} else {
 //		for (int i = 0; i < _dirtyRectsCount; ++i) {
 //			Common::Rect *r = &_dirtyRects[i];
-//			updateScreenArea(_offscreenBuffer, 640, r->x, r->y, r->x, r->y, r->w, r->h);
+//			updateScreenArea(r->x, r->y, r->w, r->h);
 //		}
 		if (_redrawScreenCounter1) {
 			--_redrawScreenCounter1;
-//			updateScreenArea(_offscreenBuffer, 640, _cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.w, _cursorObjectRect.h);
+//			updateScreenArea(_cursorObjectRect.x, _cursorObjectRect.y, _cursorObjectRect.w, _cursorObjectRect.h);
 		}
 	}
 }

Modified: scummvm/trunk/engines/touche/touche.h
===================================================================
--- scummvm/trunk/engines/touche/touche.h	2006-11-12 02:34:09 UTC (rev 24682)
+++ scummvm/trunk/engines/touche/touche.h	2006-11-12 03:02:20 UTC (rev 24683)
@@ -380,7 +380,7 @@
 	void setKeyCharMoney();
 	const char *getString(int num) const;
 	int getStringWidth(int num) const;
-	void drawString(uint8 *dst, int dstPitch, uint16 color, int x, int y, int16 num);
+	void drawString(uint16 color, int x, int y, int16 num);
 	void drawGameString(uint16 color, int x1, int y, const char *str);
 	int restartKeyCharScriptOnAction(int action, int obj1, int obj2);
 	void buildSpriteScalingTable(int z1, int z2);
@@ -463,7 +463,7 @@
 	void addToDirtyRect(const Common::Rect &r);
 	void clearDirtyRects();
 	void setPalette(int firstColor, int colorCount, int redScale, int greenScale, int blueScale);
-	void updateScreenArea(const uint8 *src, int srcPitch, int srcX, int srcY, int dstX, int dstY, int w, int h);
+	void updateScreenArea(int x, int y, int w, int h);
 	void updateEntireScreen();
 	void updateDirtyScreenAreas();
 	void updatePalette();

Modified: scummvm/trunk/engines/touche/ui.cpp
===================================================================
--- scummvm/trunk/engines/touche/ui.cpp	2006-11-12 02:34:09 UTC (rev 24682)
+++ scummvm/trunk/engines/touche/ui.cpp	2006-11-12 03:02:20 UTC (rev 24683)
@@ -406,7 +406,7 @@
 					break;
 				}
 			}
-			updateScreenArea(_offscreenBuffer, 640, 90, 102, 90, 102, 460, 196);
+			updateScreenArea(90, 102, 460, 196);
 			_system->updateScreen();
 			_system->delayMillis(50);
 		}
@@ -513,14 +513,14 @@
 	Graphics::fillRect(_offscreenBuffer, 640, 0, 0, 640, 16, 0xD7);
 	Graphics::drawRect(_offscreenBuffer, 640, 0, 0, 640, 16, 0xD6, 0xD8);
 	Graphics::drawString16(_offscreenBuffer, 640, 0xFF, 0, 0, str);
-	updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 16);
+	updateScreenArea(0, 0, 640, 16);
 }
 
 void ToucheEngine::clearStatusString() {
 	Graphics::copyRect(_offscreenBuffer, 640, 0, 0,
 	  _backdropBuffer, _currentBitmapWidth, _flagsTable[614], _flagsTable[615],
 	  640, 16);
-	updateScreenArea(_offscreenBuffer, 640, 0, 0, 0, 0, 640, 16);
+	updateScreenArea(0, 0, 640, 16);
 }
 
 int ToucheEngine::displayQuitDialog() {


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