[Scummvm-cvs-logs] SF.net SVN: scummvm: [31309] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Mar 30 01:55:16 CET 2008


Revision: 31309
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31309&view=rev
Author:   lordhoto
Date:     2008-03-29 17:55:16 -0700 (Sat, 29 Mar 2008)

Log Message:
-----------
- fixed formatting
- fixed const correctness (needed a const_cast though :-/)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen.h

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2008-03-30 00:54:46 UTC (rev 31308)
+++ scummvm/trunk/engines/kyra/screen.cpp	2008-03-30 00:55:16 UTC (rev 31309)
@@ -1194,7 +1194,7 @@
 	}
 
 	if (flags & 0x2000 && _vm->gameFlags().gameID == GI_KYRA2) {
-		int UNK = va_arg(args, int);
+		/*int UNK = */va_arg(args, int);
 	}
 
 	static const DsMarginSkipFunc dsMarginFunc[] = {
@@ -1262,7 +1262,7 @@
 	}
 
 	const uint8 *src = shapeData;
-	const uint8 *dst = _dsDstPage = getPagePtr(pageNum);
+	uint8 *dst = _dsDstPage = getPagePtr(pageNum);
 
 	const ScreenDim *dsDim = getScreenDim(sd);
 	dst += (dsDim->sx << 3);
@@ -1321,7 +1321,7 @@
 
 	int t = (flags & 2) ? y2 - y - shapeHeight : y - y1;
 
-	const uint8 *s = (uint8*) src;
+	const uint8 *s = src;
 
 	if (t < 0) {
 		shapeHeight += t;
@@ -1403,7 +1403,6 @@
 	}
 
 	dst += (320 * ty + x);
-	const uint8 *d = dst;
 
 	if (flags & DSF_SCALE) {
 		_dsOffscreenRight = 0;
@@ -1417,6 +1416,8 @@
 		addDirtyRect(x, y, shpWidthScaled1, shapeHeight);
 	clearOverlayRect(pageNum, x, y, shpWidthScaled1, shapeHeight);
 
+	const uint8 *d = dst;
+
 	while (shapeHeight--) {
 		while (!(scaleCounterV & 0xff00)) {
 			scaleCounterV += _dsScaleH;
@@ -1436,8 +1437,12 @@
 			int scaleState = (this->*_dsProcessMargin)(d, s, cnt);
 			if (_dsTmpWidth) {
 				cnt += shpWidthScaled1;
-				if (cnt > 0)
-					(this->*_dsProcessLine)(d, s, cnt, scaleState);
+				if (cnt > 0) {
+					// very ugly hack to pass non const version of d
+					uint8 *tempDst = const_cast<uint8*>(d);
+					(this->*_dsProcessLine)(tempDst, s, cnt, scaleState);
+					d = tempDst;
+				}
 				cnt += _dsOffscreenRight;
 				if (cnt)
 					(this->*_dsScaleSkip)(d, s, cnt);
@@ -1451,7 +1456,7 @@
 	va_end(args);
 }
 
-int Screen::drawShape_margin_noScale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_margin_noScale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	while (cnt-- > 0) {
 		if (*src++)
 			continue;
@@ -1463,7 +1468,7 @@
 	return 0;
 }
 
-int Screen::drawShape_margin_noScale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_margin_noScale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	while (cnt-- > 0) {
 		if (*src++)
 			continue;
@@ -1475,7 +1480,7 @@
 	return 0;
 }
 
-int Screen::drawShape_margin_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_margin_scale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
 	bool found = false;
 
@@ -1504,7 +1509,7 @@
 	return res;
 }
 
-int Screen::drawShape_margin_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_margin_scale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	_dsTmpWidth -= cnt;
 	bool found = false;
 
@@ -1533,7 +1538,7 @@
 	return res;
 }
 
-int Screen::drawShape_skip_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_skip_scale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	cnt = _dsTmpWidth;
 
 	if (cnt <= 0)
@@ -1548,7 +1553,7 @@
 	return 0;
 }
 
-int Screen::drawShape_skip_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt) {
+int Screen::drawShape_skip_scale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt) {
 	cnt = _dsTmpWidth;
 	bool found = false;
 
@@ -1565,11 +1570,11 @@
 	return found ? 0 : _dsOffscreenScaleVal1;
 }
 
-void Screen::drawShape_processLine_noScale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt, int) {
+void Screen::drawShape_processLine_noScale_upwind(uint8 *&dst, const uint8 *&src, int &cnt, int) {
 	do {
 		uint8 c = *src++;
 		if (c) {
-			uint8 *d = (uint8*) dst++;
+			uint8 *d = dst++;
 			(this->*_dsPlot)(d, c);
 			cnt--;
 		} else {
@@ -1580,11 +1585,11 @@
 	} while (cnt > 0);
 }
 
-void Screen::drawShape_processLine_noScale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt, int) {
+void Screen::drawShape_processLine_noScale_downwind(uint8 *&dst, const uint8 *&src, int &cnt, int) {
 	do {
 		uint8 c = *src++;
 		if (c) {
-			uint8 *d = (uint8*) dst--;
+			uint8 *d = dst--;
 			(this->*_dsPlot)(d, c);
 			cnt--;
 		} else {
@@ -1595,7 +1600,7 @@
 	} while (cnt > 0);
 }
 
-void Screen::drawShape_processLine_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState) {
+void Screen::drawShape_processLine_scale_upwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) {
 	int c = 0;
 
 	do {
@@ -1614,7 +1619,7 @@
 				scaleState = r & 0xff;
 			}
 		} else {
-			uint8 *d = (uint8*) dst++;
+			uint8 *d = dst++;
 			(this->*_dsPlot)(d, c);
 			scaleState -= 256;
 			cnt--;
@@ -1624,7 +1629,7 @@
 	cnt = -1;
 }
 
-void Screen::drawShape_processLine_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState) {
+void Screen::drawShape_processLine_scale_downwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState) {
 	int c = 0;
 
 	do {
@@ -1643,7 +1648,7 @@
 				scaleState = r & 0xff;
 			}
 		} else {
-			uint8 *d = (uint8*) dst--;
+			uint8 *d = dst--;
 			(this->*_dsPlot)(d, c);
 			scaleState -= 256;
 			cnt--;

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2008-03-30 00:54:46 UTC (rev 31308)
+++ scummvm/trunk/engines/kyra/screen.h	2008-03-30 00:55:16 UTC (rev 31309)
@@ -180,16 +180,16 @@
 
 	void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...);
 
-	int drawShape_margin_noScale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	int drawShape_margin_noScale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	int drawShape_margin_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	int drawShape_margin_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	int drawShape_skip_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	int drawShape_skip_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt);
-	void drawShape_processLine_noScale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState);
-	void drawShape_processLine_noScale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState);
-	void drawShape_processLine_scale_upwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState);
-	void drawShape_processLine_scale_downwind(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState);
+	int drawShape_margin_noScale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShape_margin_noScale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShape_margin_scale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShape_margin_scale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShape_skip_scale_upwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	int drawShape_skip_scale_downwind(const uint8 *&dst, const uint8 *&src, int &cnt);
+	void drawShape_processLine_noScale_upwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	void drawShape_processLine_noScale_downwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	void drawShape_processLine_scale_upwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	void drawShape_processLine_scale_downwind(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
 
 	void drawShapePlotType0(uint8 *dst, uint8 cmd);
 	void drawShapePlotType4(uint8 *dst, uint8 cmd);
@@ -199,9 +199,9 @@
 	void drawShapePlotType13(uint8 *dst, uint8 cmd);
 	void drawShapePlotType14(uint8 *dst, uint8 cmd);
 
-	typedef int (Screen::*DsMarginSkipFunc)(const uint8 *& dst, const uint8 *& src, int & cnt);
-	typedef void (Screen::*DsLineFunc)(const uint8 *& dst, const uint8 *& src, int & cnt, int scaleState);
-	typedef void (Screen::*DsPlotFunc)(uint8 * dst, uint8 cmd);
+	typedef int (Screen::*DsMarginSkipFunc)(const uint8 *&dst, const uint8 *&src, int &cnt);
+	typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState);
+	typedef void (Screen::*DsPlotFunc)(uint8 *dst, uint8 cmd);
 
 	DsMarginSkipFunc _dsProcessMargin;
 	DsMarginSkipFunc _dsScaleSkip;


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