[Scummvm-cvs-logs] CVS: scummvm/sword1 screen.cpp,1.13,1.14

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sat Dec 20 05:44:06 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv19634

Modified Files:
	screen.cpp 
Log Message:
Modified the calculation of where to draw parallaxes to be more like the
one in Broken Sword II. At least the first room appears to behave like the
original now. (Except for a masking bug, which is almost certainly 
unrelated to parallaxes.)


Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- screen.cpp	20 Dec 2003 13:35:00 -0000	1.13
+++ screen.cpp	20 Dec 2003 13:43:40 -0000	1.14
@@ -441,10 +441,21 @@
 void SwordScreen::renderParallax(uint8 *data) {
 	ParallaxHeader *header = (ParallaxHeader*)data;
 	assert((FROM_LE_16(header->sizeX) >= SCREEN_WIDTH) && (FROM_LE_16(header->sizeY) >= SCREEN_DEPTH));
-	double scrlfx =  FROM_LE_16(header->sizeX) / ((double)_scrnSizeX );
-	double scrlfy = FROM_LE_16(header->sizeY) / ((double)_scrnSizeY );
-	uint16 scrlX = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_X] * scrlfx);
-	uint16 scrlY = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_Y] * scrlfy);
+
+	double scrlfx, scrlfy;
+	uint16 scrlX, scrlY;
+
+	if (_scrnSizeX != SCREEN_WIDTH) {
+		scrlfx = (FROM_LE_16(header->sizeX) - SCREEN_WIDTH) / ((double)(_scrnSizeX - SCREEN_WIDTH));
+		scrlX = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_X] * scrlfx);
+	} else
+		scrlX = 0;
+
+	if (_scrnSizeY != SCREEN_DEPTH) {
+		scrlfy = (FROM_LE_16(header->sizeY) - SCREEN_DEPTH) / ((double)(_scrnSizeY - SCREEN_DEPTH));
+		scrlY = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_Y] * scrlfy);
+	} else
+		scrlY = 0;
 
 	for (uint16 cnty = 0; cnty < SCREEN_DEPTH; cnty++) {
 		uint8 *src = data + READ_LE_UINT32(header->lineIndexes + cnty + scrlY);





More information about the Scummvm-git-logs mailing list